native-document 1.0.166 → 1.0.168
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vitepress/config.js +166 -0
- package/CHANGELOG.md +153 -0
- package/components.js +2 -1
- package/dist/native-document.components.min.js +495 -228
- package/dist/native-document.dev.js +7 -0
- package/dist/native-document.dev.js.map +1 -1
- package/dist/native-document.min.js +1 -1
- package/docs/advanced-components.md +213 -608
- package/docs/anchor.md +173 -312
- package/docs/cache.md +95 -803
- package/docs/cli.md +179 -0
- package/docs/components/accordion.md +172 -0
- package/docs/components/alert.md +99 -0
- package/docs/components/avatar.md +160 -0
- package/docs/components/badge.md +102 -0
- package/docs/components/breadcrumb.md +89 -0
- package/docs/components/button.md +183 -0
- package/docs/components/card.md +69 -0
- package/docs/components/context-menu.md +118 -0
- package/docs/components/data-table.md +345 -0
- package/docs/components/dropdown.md +214 -0
- package/docs/components/form/autocomplete-field.md +81 -0
- package/docs/components/form/checkbox-field.md +41 -0
- package/docs/components/form/checkbox-group-field.md +54 -0
- package/docs/components/form/color-field.md +64 -0
- package/docs/components/form/date-field.md +92 -0
- package/docs/components/form/field-collection.md +63 -0
- package/docs/components/form/file-field.md +203 -0
- package/docs/components/form/form-control.md +87 -0
- package/docs/components/form/image-field.md +90 -0
- package/docs/components/form/index.md +115 -0
- package/docs/components/form/number-field.md +65 -0
- package/docs/components/form/radio-field.md +51 -0
- package/docs/components/form/select-field.md +123 -0
- package/docs/components/form/slider.md +136 -0
- package/docs/components/form/string-field.md +134 -0
- package/docs/components/form/textarea-field.md +65 -0
- package/docs/components/form-fields.md +372 -0
- package/docs/components/getting-started.md +264 -0
- package/docs/components/index.md +337 -0
- package/docs/components/layout.md +279 -0
- package/docs/components/list.md +73 -0
- package/docs/components/menu.md +215 -0
- package/docs/components/modal.md +156 -0
- package/docs/components/pagination.md +95 -0
- package/docs/components/popover.md +131 -0
- package/docs/components/progress.md +111 -0
- package/docs/components/shortcut-manager.md +221 -0
- package/docs/components/simple-table.md +107 -0
- package/docs/components/skeleton.md +155 -0
- package/docs/components/spinner.md +100 -0
- package/docs/components/splitter.md +133 -0
- package/docs/components/stepper.md +163 -0
- package/docs/components/switch.md +113 -0
- package/docs/components/tabs.md +153 -0
- package/docs/components/toast.md +119 -0
- package/docs/components/tooltip.md +151 -0
- package/docs/components/traits.md +261 -0
- package/docs/conditional-rendering.md +170 -588
- package/docs/contributing.md +300 -25
- package/docs/core-concepts.md +205 -374
- package/docs/elements.md +251 -367
- package/docs/extending-native-document-element.md +192 -207
- package/docs/filters.md +153 -1122
- package/docs/getting-started.md +193 -267
- package/docs/i18n.md +241 -0
- package/docs/index.md +76 -0
- package/docs/lifecycle-events.md +143 -75
- package/docs/list-rendering.md +227 -852
- package/docs/memory-management.md +134 -47
- package/docs/native-document-element.md +337 -186
- package/docs/native-fetch.md +99 -630
- package/docs/observable-resource.md +364 -0
- package/docs/observables.md +592 -526
- package/docs/routing.md +244 -653
- package/docs/state-management.md +134 -241
- package/docs/svg-elements.md +231 -0
- package/docs/theming.md +409 -0
- package/docs/tutorials/.gitkeep +0 -0
- package/docs/validation.md +95 -97
- package/docs/vitepress-conventions.md +219 -0
- package/package.json +34 -13
- package/readme.md +269 -89
- package/src/components/card/Card.js +93 -39
- package/src/components/card/index.js +1 -1
- package/src/components/list/HasListItem.js +171 -0
- package/src/components/list/List.js +41 -107
- package/src/components/list/ListDivider.js +39 -0
- package/src/components/list/ListGroup.js +76 -59
- package/src/components/list/ListItem.js +117 -69
- package/src/components/list/index.js +3 -1
- package/src/components/list/types/ListItem.d.ts +45 -34
- package/src/components/spacer/Spacer.js +1 -1
- package/src/core/data/ObservableResource.js +5 -0
- package/src/core/data/observable-helpers/observable.prototypes.js +2 -0
- package/src/ui/components/card/CardRender.js +133 -0
- package/src/ui/components/card/card.css +169 -0
- package/src/ui/components/contextmenu/ContextmenuRender.js +1 -1
- package/src/ui/components/list/ListRender.js +18 -0
- package/src/ui/components/list/divider/ListDividerRender.js +10 -0
- package/src/ui/components/list/divider/list-divider.css +12 -0
- package/src/ui/components/list/group/ListGroupRender.js +61 -0
- package/src/ui/components/list/group/list-group.css +62 -0
- package/src/ui/components/list/item/ListItemRender.js +238 -0
- package/src/ui/components/list/item/list-item.css +191 -0
- package/src/ui/components/list/list.css +24 -0
- package/src/ui/components/spacer/SpacerRender.js +10 -0
- package/src/ui/index.js +8 -0
package/docs/validation.md
CHANGED
|
@@ -1,129 +1,122 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
title: Args Validation
|
|
3
|
+
description: Runtime argument validation with ArgTypes and withValidation - catch type errors early in development
|
|
4
|
+
---
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
# Args Validation
|
|
7
|
+
|
|
8
|
+
NativeDocument provides a runtime argument validation system that helps catch type errors early. It is only active in development mode - in production, `ArgTypes` is an empty object and `withValidation` is a no-op.
|
|
4
9
|
|
|
5
10
|
## Function Argument Validation
|
|
6
11
|
|
|
7
|
-
###
|
|
12
|
+
### `.args()` method
|
|
13
|
+
|
|
14
|
+
`.args()` is available on any function. It returns a new function that validates arguments before calling the original:
|
|
8
15
|
|
|
9
16
|
```javascript
|
|
10
|
-
|
|
17
|
+
import { ArgTypes } from 'native-document';
|
|
18
|
+
|
|
11
19
|
function createUser(name, age, email) {
|
|
12
20
|
console.log(`Creating user: ${name}, ${age}, ${email}`);
|
|
13
21
|
}
|
|
14
22
|
|
|
15
|
-
// .args() returns a function that validates arguments before calling original
|
|
16
23
|
const createUserWithValidation = createUser.args(
|
|
17
24
|
ArgTypes.string('name'),
|
|
18
|
-
ArgTypes.number('age'),
|
|
25
|
+
ArgTypes.number('age'),
|
|
19
26
|
ArgTypes.string('email')
|
|
20
27
|
);
|
|
21
28
|
|
|
22
|
-
//
|
|
23
|
-
createUserWithValidation(
|
|
24
|
-
createUserWithValidation("John", "25", "john@example.com"); // Throws validation error
|
|
29
|
+
createUserWithValidation('John', 25, 'john@example.com'); // valid
|
|
30
|
+
createUserWithValidation('John', '25', 'john@example.com'); // throws
|
|
25
31
|
```
|
|
26
32
|
|
|
27
|
-
###
|
|
33
|
+
### `withValidation(fn, argSchema, fnName?)` - equivalent
|
|
28
34
|
|
|
29
35
|
```javascript
|
|
30
|
-
|
|
36
|
+
import { ArgTypes, withValidation } from 'native-document';
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
const createUserWithValidation1 = createUser.args(
|
|
34
|
-
ArgTypes.string('name'),
|
|
35
|
-
ArgTypes.number('age'),
|
|
36
|
-
ArgTypes.string('email')
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
// Method 2: Using withValidation()
|
|
40
|
-
const createUserWithValidation2 = withValidation(createUser, [
|
|
38
|
+
const createUserWithValidation = withValidation(createUser, [
|
|
41
39
|
ArgTypes.string('name'),
|
|
42
40
|
ArgTypes.number('age'),
|
|
43
41
|
ArgTypes.string('email')
|
|
44
42
|
], 'createUser');
|
|
45
|
-
|
|
46
|
-
// Both return a function that validates arguments before calling the original
|
|
47
43
|
```
|
|
48
44
|
|
|
45
|
+
---
|
|
46
|
+
|
|
49
47
|
## ArgTypes Reference
|
|
50
48
|
|
|
51
|
-
### Basic
|
|
49
|
+
### Basic types
|
|
52
50
|
|
|
53
51
|
```javascript
|
|
54
|
-
ArgTypes.string('name')
|
|
55
|
-
ArgTypes.number('age')
|
|
56
|
-
ArgTypes.boolean('isActive')
|
|
57
|
-
ArgTypes.function('callback')
|
|
58
|
-
ArgTypes.object('config')
|
|
59
|
-
ArgTypes.objectNotNull('data')
|
|
52
|
+
ArgTypes.string('name') // Must be string
|
|
53
|
+
ArgTypes.number('age') // Must be number
|
|
54
|
+
ArgTypes.boolean('isActive') // Must be boolean
|
|
55
|
+
ArgTypes.function('callback') // Must be function
|
|
56
|
+
ArgTypes.object('config') // Must be object
|
|
57
|
+
ArgTypes.objectNotNull('data') // Must be object and not null
|
|
60
58
|
```
|
|
61
59
|
|
|
62
|
-
### NativeDocument
|
|
60
|
+
### NativeDocument types
|
|
63
61
|
|
|
64
62
|
```javascript
|
|
65
|
-
ArgTypes.observable('state')
|
|
66
|
-
ArgTypes.element('domNode')
|
|
67
|
-
ArgTypes.children('content')
|
|
68
|
-
ArgTypes.attributes('attrs')
|
|
63
|
+
ArgTypes.observable('state') // Must be an Observable instance
|
|
64
|
+
ArgTypes.element('domNode') // Must be an HTML element
|
|
65
|
+
ArgTypes.children('content') // Valid children (elements, strings, numbers, observables)
|
|
66
|
+
ArgTypes.attributes('attrs') // Valid attributes object
|
|
69
67
|
```
|
|
70
68
|
|
|
71
|
-
### Optional
|
|
69
|
+
### Optional arguments
|
|
72
70
|
|
|
73
71
|
```javascript
|
|
74
72
|
function greet(name, greeting) {
|
|
75
73
|
return `${greeting || 'Hello'} ${name}`;
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
const greetWithValidation = greet.args(
|
|
76
|
+
const greetSafe = greet.args(
|
|
80
77
|
ArgTypes.string('name'),
|
|
81
78
|
ArgTypes.optional(ArgTypes.string('greeting'))
|
|
82
79
|
);
|
|
83
80
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
81
|
+
greetSafe('John'); // valid - greeting is optional
|
|
82
|
+
greetSafe('John', 'Hi'); // valid
|
|
83
|
+
greetSafe('John', 123); // throws - greeting must be string if provided
|
|
87
84
|
```
|
|
88
85
|
|
|
89
|
-
###
|
|
86
|
+
### `oneOf` - union types
|
|
90
87
|
|
|
91
88
|
```javascript
|
|
92
|
-
function setTheme(theme, config) {
|
|
93
|
-
// Implementation
|
|
94
|
-
}
|
|
89
|
+
function setTheme(theme, config) { /* ... */ }
|
|
95
90
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
ArgTypes.oneOf('theme',
|
|
91
|
+
const setThemeSafe = setTheme.args(
|
|
92
|
+
ArgTypes.oneOf('theme',
|
|
99
93
|
ArgTypes.string('theme'),
|
|
100
94
|
ArgTypes.object('theme')
|
|
101
95
|
),
|
|
102
96
|
ArgTypes.object('config')
|
|
103
97
|
);
|
|
104
98
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
99
|
+
setThemeSafe('dark', {}); // valid - string
|
|
100
|
+
setThemeSafe({ name: 'custom' }, {}); // valid - object
|
|
101
|
+
setThemeSafe(123, {}); // throws - must be string or object
|
|
108
102
|
```
|
|
109
103
|
|
|
104
|
+
---
|
|
105
|
+
|
|
110
106
|
## Error Handling
|
|
111
107
|
|
|
112
|
-
### Validation
|
|
108
|
+
### Validation errors
|
|
113
109
|
|
|
114
110
|
```javascript
|
|
115
|
-
function processData(items, callback) {
|
|
116
|
-
// Implementation
|
|
117
|
-
}
|
|
111
|
+
function processData(items, callback) { /* ... */ }
|
|
118
112
|
|
|
119
|
-
|
|
120
|
-
const processDataWithValidation = processData.args(
|
|
113
|
+
const processDataSafe = processData.args(
|
|
121
114
|
ArgTypes.children('items'),
|
|
122
115
|
ArgTypes.function('callback')
|
|
123
116
|
);
|
|
124
117
|
|
|
125
118
|
try {
|
|
126
|
-
|
|
119
|
+
processDataSafe('invalid', 'not a function');
|
|
127
120
|
} catch (error) {
|
|
128
121
|
console.log(error.message);
|
|
129
122
|
// "Argument validation failed
|
|
@@ -132,69 +125,74 @@ try {
|
|
|
132
125
|
}
|
|
133
126
|
```
|
|
134
127
|
|
|
135
|
-
### Error
|
|
136
|
-
|
|
137
|
-
```javascript
|
|
138
|
-
// Original function with argument validation
|
|
139
|
-
const createUserWithValidation = createUser.args(
|
|
140
|
-
ArgTypes.string('name'),
|
|
141
|
-
ArgTypes.number('age'),
|
|
142
|
-
ArgTypes.string('email')
|
|
143
|
-
);
|
|
128
|
+
### Error boundary
|
|
144
129
|
|
|
145
|
-
|
|
146
|
-
const safeCreateUser = createUserWithValidation.errorBoundary((error) => {
|
|
147
|
-
console.error("User creation failed:", error.message);
|
|
148
|
-
return null; // Return fallback value
|
|
149
|
-
});
|
|
130
|
+
Combine with `.errorBoundary()` to handle validation errors gracefully instead of throwing:
|
|
150
131
|
|
|
151
|
-
|
|
152
|
-
const
|
|
132
|
+
```javascript
|
|
133
|
+
const safeCreateUser = createUser
|
|
134
|
+
.args(
|
|
135
|
+
ArgTypes.string('name'),
|
|
136
|
+
ArgTypes.number('age'),
|
|
137
|
+
ArgTypes.string('email')
|
|
138
|
+
)
|
|
139
|
+
.errorBoundary((error) => {
|
|
140
|
+
console.error('User creation failed:', error.message);
|
|
141
|
+
return null;
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
const result = safeCreateUser('John', 'invalid age', 'email'); // returns null, no throw
|
|
153
145
|
```
|
|
154
146
|
|
|
155
|
-
|
|
147
|
+
---
|
|
156
148
|
|
|
157
|
-
|
|
149
|
+
## Custom ArgTypes
|
|
150
|
+
|
|
151
|
+
Create reusable validators for domain-specific types:
|
|
158
152
|
|
|
159
153
|
```javascript
|
|
160
|
-
// Custom validator for email format
|
|
161
154
|
const emailType = (name) => ({
|
|
162
155
|
name,
|
|
163
156
|
type: 'email',
|
|
164
|
-
validate: (value) =>
|
|
165
|
-
return typeof value === 'string' && /\S+@\S+\.\S+/.test(value);
|
|
166
|
-
}
|
|
157
|
+
validate: (value) => typeof value === 'string' && /\S+@\S+\.\S+/.test(value)
|
|
167
158
|
});
|
|
168
159
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
160
|
+
const positiveInt = (name) => ({
|
|
161
|
+
name,
|
|
162
|
+
type: 'positiveInt',
|
|
163
|
+
validate: (value) => Number.isInteger(value) && value > 0
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
function registerUser(email, age) { /* ... */ }
|
|
172
167
|
|
|
173
168
|
registerUser.args(
|
|
174
169
|
emailType('email'),
|
|
175
|
-
|
|
170
|
+
positiveInt('age')
|
|
176
171
|
);
|
|
177
172
|
```
|
|
178
173
|
|
|
174
|
+
---
|
|
175
|
+
|
|
179
176
|
## Best Practices
|
|
180
177
|
|
|
181
|
-
1.
|
|
182
|
-
2.
|
|
183
|
-
3.
|
|
184
|
-
4.
|
|
185
|
-
5.
|
|
186
|
-
6.
|
|
178
|
+
1. Add validation to all public functions and component factories
|
|
179
|
+
2. Use descriptive argument names - they appear in error messages
|
|
180
|
+
3. Use `ArgTypes.objectNotNull()` for required objects - `ArgTypes.object()` accepts `null`
|
|
181
|
+
4. Use `ArgTypes.optional()` explicitly - makes the API contract clear
|
|
182
|
+
5. Create custom validators for domain types (email, URL, positive number, etc.)
|
|
183
|
+
6. Combine with `.errorBoundary()` to avoid uncaught errors in production
|
|
184
|
+
|
|
185
|
+
---
|
|
187
186
|
|
|
188
187
|
## Next Steps
|
|
189
188
|
|
|
190
|
-
- **[
|
|
191
|
-
- **[NDElement](native-document-element.md)** -
|
|
192
|
-
- **[
|
|
193
|
-
- **[Advanced Components](advanced-components.md)** - Template caching and singleton views
|
|
194
|
-
- **[Memory Management](memory-management.md)** - Debugging memory issues with validation
|
|
189
|
+
- **[NDElement](./native-document-element.md)** - Native Document Element
|
|
190
|
+
- **[Extending NDElement](./extending-native-document-element.md)** - Custom methods guide
|
|
191
|
+
- **[Memory Management](./memory-management.md)** - Debugging memory issues
|
|
192
|
+
- **[Advanced Components](./advanced-components.md)** - Template caching and singleton views
|
|
195
193
|
|
|
196
194
|
## Utilities
|
|
197
195
|
|
|
198
|
-
- **[Cache](
|
|
199
|
-
- **[NativeFetch](
|
|
200
|
-
- **[Filters](
|
|
196
|
+
- **[Cache](./cache.md)** - Lazy initialization and singleton patterns
|
|
197
|
+
- **[NativeFetch](./native-fetch.md)** - HTTP client with interceptors
|
|
198
|
+
- **[Filters](./filters.md)** - Data filtering helpers
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# VitePress Conventions for NativeDocument Docs
|
|
2
|
+
|
|
3
|
+
## Frontmatter
|
|
4
|
+
|
|
5
|
+
Every markdown file must start with a frontmatter block:
|
|
6
|
+
|
|
7
|
+
```yaml
|
|
8
|
+
---
|
|
9
|
+
title: Page Title
|
|
10
|
+
description: One sentence description for SEO and sidebar tooltip
|
|
11
|
+
---
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Special pages:
|
|
15
|
+
- Home page (`index.md`) uses the `layout: home` frontmatter with hero and features blocks
|
|
16
|
+
- API reference pages can add `outline: deep` to show all heading levels in the right sidebar
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Folder & File Structure
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
docs/
|
|
24
|
+
├── index.md # Home page (layout: home)
|
|
25
|
+
├── getting-started.md
|
|
26
|
+
├── core-concepts.md
|
|
27
|
+
├── observables.md
|
|
28
|
+
├── elements.md
|
|
29
|
+
├── conditional-rendering.md
|
|
30
|
+
├── list-rendering.md
|
|
31
|
+
├── routing.md
|
|
32
|
+
├── state-management.md
|
|
33
|
+
├── lifecycle-events.md
|
|
34
|
+
├── native-document-element.md
|
|
35
|
+
├── extending-native-document-element.md
|
|
36
|
+
├── advanced-components.md
|
|
37
|
+
├── validation.md
|
|
38
|
+
├── memory-management.md
|
|
39
|
+
├── anchor.md
|
|
40
|
+
├── svg-elements.md
|
|
41
|
+
├── i18n.md
|
|
42
|
+
├── components/
|
|
43
|
+
│ ├── index.md
|
|
44
|
+
│ ├── getting-started.md
|
|
45
|
+
│ ├── traits.md
|
|
46
|
+
│ ├── layout.md
|
|
47
|
+
│ ├── accordion.md
|
|
48
|
+
│ ├── alert.md
|
|
49
|
+
│ ├── avatar.md
|
|
50
|
+
│ ├── breadcrumb.md
|
|
51
|
+
│ ├── button.md
|
|
52
|
+
│ ├── context-menu.md
|
|
53
|
+
│ ├── data-table.md
|
|
54
|
+
│ ├── dropdown.md
|
|
55
|
+
│ ├── file.md
|
|
56
|
+
│ ├── form-fields.md
|
|
57
|
+
│ ├── checkbox-radio.md
|
|
58
|
+
│ ├── select.md
|
|
59
|
+
│ ├── menu.md
|
|
60
|
+
│ ├── modal.md
|
|
61
|
+
│ ├── slider-stepper.md
|
|
62
|
+
│ ├── splitter.md
|
|
63
|
+
│ ├── switch.md
|
|
64
|
+
│ ├── tabs.md
|
|
65
|
+
│ ├── toast.md
|
|
66
|
+
│ └── tooltip.md
|
|
67
|
+
└── utils/
|
|
68
|
+
├── cache.md
|
|
69
|
+
├── native-fetch.md
|
|
70
|
+
└── filters.md
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Internal Links
|
|
76
|
+
|
|
77
|
+
VitePress resolves links relative to the current file.
|
|
78
|
+
Always use `.md` extension — VitePress strips it at build time.
|
|
79
|
+
|
|
80
|
+
```markdown
|
|
81
|
+
<!-- From docs/readme.md or docs/getting-started.md -->
|
|
82
|
+
[Observables](./observables.md)
|
|
83
|
+
[Cache](./utils/cache.md)
|
|
84
|
+
[Components](./components/index.md)
|
|
85
|
+
|
|
86
|
+
<!-- From docs/components/accordion.md -->
|
|
87
|
+
[Getting Started](./getting-started.md) <!-- components/getting-started.md -->
|
|
88
|
+
[Observables](../observables.md) <!-- docs/observables.md -->
|
|
89
|
+
[Cache](../utils/cache.md) <!-- docs/utils/cache.md -->
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Never use absolute paths (`/docs/...`) or paths without `.md`.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## `.vitepress/config.js` — Sidebar & Nav
|
|
97
|
+
|
|
98
|
+
```javascript
|
|
99
|
+
// .vitepress/config.js
|
|
100
|
+
export default {
|
|
101
|
+
title: 'NativeDocument',
|
|
102
|
+
description: 'A reactive JavaScript framework that preserves native DOM simplicity',
|
|
103
|
+
themeConfig: {
|
|
104
|
+
nav: [
|
|
105
|
+
{ text: 'Guide', link: '/getting-started' },
|
|
106
|
+
{ text: 'Components', link: '/components/' },
|
|
107
|
+
{ text: 'Utilities', link: '/utils/cache' },
|
|
108
|
+
],
|
|
109
|
+
sidebar: {
|
|
110
|
+
'/components/': [
|
|
111
|
+
{
|
|
112
|
+
text: 'Components',
|
|
113
|
+
items: [
|
|
114
|
+
{ text: 'Overview', link: '/components/' },
|
|
115
|
+
{ text: 'Getting Started', link: '/components/getting-started' },
|
|
116
|
+
{ text: 'Traits', link: '/components/traits' },
|
|
117
|
+
{ text: 'Layout', link: '/components/layout' },
|
|
118
|
+
{ text: 'Accordion', link: '/components/accordion' },
|
|
119
|
+
{ text: 'Alert & Feedback', link: '/components/alert' },
|
|
120
|
+
{ text: 'Avatar', link: '/components/avatar' },
|
|
121
|
+
{ text: 'Breadcrumb', link: '/components/breadcrumb' },
|
|
122
|
+
{ text: 'Button', link: '/components/button' },
|
|
123
|
+
{ text: 'Context Menu', link: '/components/context-menu' },
|
|
124
|
+
{ text: 'Data Table', link: '/components/data-table' },
|
|
125
|
+
{ text: 'Dropdown', link: '/components/dropdown' },
|
|
126
|
+
{ text: 'File Upload', link: '/components/file' },
|
|
127
|
+
{ text: 'Form Fields', link: '/components/form-fields' },
|
|
128
|
+
{ text: 'Checkbox & Radio', link: '/components/checkbox-radio' },
|
|
129
|
+
{ text: 'Select', link: '/components/select' },
|
|
130
|
+
{ text: 'Menu', link: '/components/menu' },
|
|
131
|
+
{ text: 'Modal & Popover', link: '/components/modal' },
|
|
132
|
+
{ text: 'Slider & Stepper', link: '/components/slider-stepper' },
|
|
133
|
+
{ text: 'Splitter', link: '/components/splitter' },
|
|
134
|
+
{ text: 'Switch', link: '/components/switch' },
|
|
135
|
+
{ text: 'Tabs', link: '/components/tabs' },
|
|
136
|
+
{ text: 'Toast', link: '/components/toast' },
|
|
137
|
+
{ text: 'Tooltip', link: '/components/tooltip' },
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
'/utils/': [
|
|
142
|
+
{
|
|
143
|
+
text: 'Utilities',
|
|
144
|
+
items: [
|
|
145
|
+
{ text: 'Cache', link: '/utils/cache' },
|
|
146
|
+
{ text: 'NativeFetch', link: '/utils/native-fetch' },
|
|
147
|
+
{ text: 'Filters', link: '/utils/filters' },
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
'/': [
|
|
152
|
+
{
|
|
153
|
+
text: 'Guide',
|
|
154
|
+
items: [
|
|
155
|
+
{ text: 'Getting Started', link: '/getting-started' },
|
|
156
|
+
{ text: 'Core Concepts', link: '/core-concepts' },
|
|
157
|
+
{ text: 'Observables', link: '/observables' },
|
|
158
|
+
{ text: 'Elements', link: '/elements' },
|
|
159
|
+
{ text: 'Conditional Rendering', link: '/conditional-rendering' },
|
|
160
|
+
{ text: 'List Rendering', link: '/list-rendering' },
|
|
161
|
+
{ text: 'Routing', link: '/routing' },
|
|
162
|
+
{ text: 'State Management', link: '/state-management' },
|
|
163
|
+
{ text: 'Lifecycle Events', link: '/lifecycle-events' },
|
|
164
|
+
{ text: 'NDElement', link: '/native-document-element' },
|
|
165
|
+
{ text: 'Extending NDElement', link: '/extending-native-document-element' },
|
|
166
|
+
{ text: 'Advanced Components', link: '/advanced-components' },
|
|
167
|
+
{ text: 'Args Validation', link: '/validation' },
|
|
168
|
+
{ text: 'Memory Management', link: '/memory-management' },
|
|
169
|
+
{ text: 'Anchor', link: '/anchor' },
|
|
170
|
+
{ text: 'SVG Elements', link: '/svg-elements' },
|
|
171
|
+
{ text: 'i18n & Formatting', link: '/i18n' },
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
},
|
|
176
|
+
socialLinks: [
|
|
177
|
+
{ icon: 'github', link: 'https://github.com/afrocodeur/native-document' }
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Page Template
|
|
186
|
+
|
|
187
|
+
Every doc page follows this structure:
|
|
188
|
+
|
|
189
|
+
```markdown
|
|
190
|
+
---
|
|
191
|
+
title: Page Title
|
|
192
|
+
description: One sentence description
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
# Page Title
|
|
196
|
+
|
|
197
|
+
Brief intro paragraph.
|
|
198
|
+
|
|
199
|
+
## Section
|
|
200
|
+
|
|
201
|
+
Content.
|
|
202
|
+
|
|
203
|
+
## Next Steps
|
|
204
|
+
|
|
205
|
+
- [Link to related page](./related.md)
|
|
206
|
+
- [Another link](./other.md)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Rules Applied to All Files
|
|
212
|
+
|
|
213
|
+
1. Every file starts with frontmatter (`title` + `description`)
|
|
214
|
+
2. All internal links use relative paths with `.md` extension
|
|
215
|
+
3. No `docs/` prefix in any link (files are already inside `docs/`)
|
|
216
|
+
4. Utility links: `./utils/cache.md`, `./utils/native-fetch.md`, `./utils/filters.md`
|
|
217
|
+
5. Component links from guide pages: `./components/index.md`
|
|
218
|
+
6. Component links from component pages: `../observables.md` to go up to guide
|
|
219
|
+
7. The "Next Steps" section at the bottom of each page replaces the old flat link lists
|
package/package.json
CHANGED
|
@@ -1,7 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "native-document",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.168",
|
|
4
|
+
"description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
|
|
5
|
+
"author": "AfroCodeur <https://github.com/afrocodeur>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/afrocodeur/native-document#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/afrocodeur/native-document.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/afrocodeur/native-document/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"reactive",
|
|
17
|
+
"framework",
|
|
18
|
+
"dom",
|
|
19
|
+
"vanilla",
|
|
20
|
+
"javascript",
|
|
21
|
+
"observable",
|
|
22
|
+
"no-virtual-dom",
|
|
23
|
+
"ui"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"main": "index.js",
|
|
27
|
+
"sideEffects": [
|
|
5
28
|
"index.js",
|
|
6
29
|
"elements.js",
|
|
7
30
|
"**/*.css",
|
|
@@ -14,17 +37,16 @@
|
|
|
14
37
|
"**/observable.prototypes.js",
|
|
15
38
|
"**/observable.is-to.js"
|
|
16
39
|
],
|
|
17
|
-
"main": "index.js",
|
|
18
|
-
"type": "module",
|
|
19
40
|
"scripts": {
|
|
20
|
-
"build": "rollup --config rollup.config.js
|
|
41
|
+
"build": "rollup --config rollup.config.js",
|
|
42
|
+
"build:watch": "rollup --config rollup.config.js --watch",
|
|
21
43
|
"lint": "eslint ./src",
|
|
22
44
|
"lint:fix": "eslint ./src --fix"
|
|
23
45
|
},
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
46
|
+
"dependencies": {
|
|
47
|
+
"@floating-ui/dom": "^1.7.6",
|
|
48
|
+
"i18next": "^25.8.0"
|
|
49
|
+
},
|
|
28
50
|
"devDependencies": {
|
|
29
51
|
"@babel/parser": "^7.28.5",
|
|
30
52
|
"@babel/traverse": "^7.28.5",
|
|
@@ -38,8 +60,7 @@
|
|
|
38
60
|
"rollup": "^4.53.3",
|
|
39
61
|
"rollup-plugin-postcss": "^4.0.2"
|
|
40
62
|
},
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"i18next": "^25.8.0"
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=18.0.0"
|
|
44
65
|
}
|
|
45
|
-
}
|
|
66
|
+
}
|