forked from jsnbuchanan/crowd-funder-for-time-pwa
docs: comprehensive documentation updates and modernization
- Update BUILDING.md with current build system information - Modernize various README files across the project - Update CHANGELOG.md with recent changes - Improve documentation consistency and formatting - Update platform-specific documentation (iOS, Electron, Docker) - Enhance test documentation and build guides
This commit is contained in:
@@ -93,6 +93,7 @@ export default class FormComponent extends Vue {
|
||||
When generating component templates, follow these patterns:
|
||||
|
||||
#### Function Props Template
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div class="component-name">
|
||||
@@ -124,6 +125,7 @@ export default class ComponentName extends Vue {
|
||||
```
|
||||
|
||||
#### $emit Template (for DOM events)
|
||||
|
||||
```vue
|
||||
<template>
|
||||
<div class="component-name">
|
||||
@@ -155,12 +157,14 @@ export default class ComponentName extends Vue {
|
||||
### Code Generation Rules
|
||||
|
||||
#### 1. Function Props for Business Logic
|
||||
|
||||
- **Data operations**: Save, delete, update, validate
|
||||
- **Navigation**: Route changes, modal opening/closing
|
||||
- **State management**: Store actions, state updates
|
||||
- **API calls**: Data fetching, form submissions
|
||||
|
||||
#### 2. $emit for User Interactions
|
||||
|
||||
- **Click events**: Button clicks, link navigation
|
||||
- **Form events**: Input changes, form submissions
|
||||
- **Lifecycle events**: Component mounting, unmounting
|
||||
@@ -169,6 +173,7 @@ export default class ComponentName extends Vue {
|
||||
#### 3. Naming Conventions
|
||||
|
||||
**Function Props:**
|
||||
|
||||
```typescript
|
||||
// Action-oriented names
|
||||
onSave: (data: SaveData) => Promise<void>
|
||||
@@ -179,6 +184,7 @@ onNavigate: (route: string) => void
|
||||
```
|
||||
|
||||
**$emit Events:**
|
||||
|
||||
```typescript
|
||||
// Event-oriented names
|
||||
@click: (event: MouseEvent) => void
|
||||
@@ -191,6 +197,7 @@ onNavigate: (route: string) => void
|
||||
### TypeScript Integration
|
||||
|
||||
#### Function Prop Types
|
||||
|
||||
```typescript
|
||||
// Define reusable function types
|
||||
interface SaveHandler {
|
||||
@@ -207,6 +214,7 @@ interface ValidationHandler {
|
||||
```
|
||||
|
||||
#### Event Types
|
||||
|
||||
```typescript
|
||||
// Define event payload types
|
||||
interface ClickEvent {
|
||||
@@ -226,6 +234,7 @@ handleClick(): ClickEvent {
|
||||
## Testing Guidelines
|
||||
|
||||
### Function Props Testing
|
||||
|
||||
```typescript
|
||||
// Easy to mock and test
|
||||
const mockOnSave = jest.fn();
|
||||
@@ -240,6 +249,7 @@ expect(mockOnSave).toHaveBeenCalledWith(expectedData);
|
||||
```
|
||||
|
||||
### $emit Testing
|
||||
|
||||
```typescript
|
||||
// Requires event simulation
|
||||
const wrapper = mount(MyComponent);
|
||||
@@ -260,6 +270,7 @@ expect(wrapper.emitted('click')).toBeTruthy();
|
||||
### Example Migration
|
||||
|
||||
**Before ($emit):**
|
||||
|
||||
```typescript
|
||||
@Emit("save")
|
||||
handleSave() {
|
||||
@@ -268,6 +279,7 @@ handleSave() {
|
||||
```
|
||||
|
||||
**After (Function Props):**
|
||||
|
||||
```typescript
|
||||
@Prop({ required: true }) onSave!: (data: FormData) => void;
|
||||
|
||||
@@ -288,6 +300,7 @@ handleSave() {
|
||||
## Code Generation Templates
|
||||
|
||||
### Component Generator Input
|
||||
|
||||
```typescript
|
||||
interface ComponentSpec {
|
||||
name: string;
|
||||
@@ -306,9 +319,10 @@ interface ComponentSpec {
|
||||
```
|
||||
|
||||
### Generated Output
|
||||
|
||||
```typescript
|
||||
// Generator should automatically choose function props vs $emit
|
||||
// based on the nature of the interaction (business logic vs DOM event)
|
||||
```
|
||||
|
||||
This guide ensures consistent, maintainable component communication patterns across the application.
|
||||
This guide ensures consistent, maintainable component communication patterns across the application.
|
||||
|
||||
Reference in New Issue
Block a user