@sprlab/wccompiler 0.12.1 → 0.14.0
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/README.md +998 -998
- package/adapters/angular-compiled/angular.d.ts +197 -197
- package/adapters/angular-compiled/angular.mjs +488 -488
- package/adapters/angular.js +54 -54
- package/adapters/angular.ts +630 -630
- package/adapters/react.js +114 -114
- package/adapters/vue.js +103 -103
- package/bin/wcc.js +412 -412
- package/bin/wcc.test.js +126 -126
- package/integrations/angular.js +73 -73
- package/integrations/react.js +859 -859
- package/integrations/vue.js +253 -253
- package/lib/codegen.js +2074 -2029
- package/lib/compiler-browser.js +545 -545
- package/lib/compiler.js +483 -473
- package/lib/config.js +71 -71
- package/lib/css-scoper.js +180 -180
- package/lib/dev-server.js +193 -193
- package/lib/import-resolver.js +160 -160
- package/lib/parser-extractors.js +1240 -1169
- package/lib/parser.js +273 -269
- package/lib/reactive-runtime.js +143 -143
- package/lib/sfc-parser.js +333 -333
- package/lib/template-normalizer.js +114 -109
- package/lib/tree-walker.js +1013 -923
- package/lib/types.js +262 -240
- package/lib/wcc-runtime.js +68 -68
- package/package.json +85 -85
- package/types/wcc.d.ts +28 -28
- package/types/wcc.test.js +46 -46
package/lib/types.js
CHANGED
|
@@ -1,240 +1,262 @@
|
|
|
1
|
-
// v2/lib/types.js — JSDoc type definitions for wcCompiler v2
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @typedef {Object} ReactiveVar
|
|
5
|
-
* @property {string} name — Signal variable name (e.g., 'count')
|
|
6
|
-
* @property {string} value — Initial value expression (e.g., '0', '[1, 2, 3]')
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @typedef {Object} ComputedDef
|
|
11
|
-
* @property {string} name — Computed variable name (e.g., 'doubled')
|
|
12
|
-
* @property {string} body — Computed expression body (e.g., 'count() * 2')
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @typedef {Object} EffectDef
|
|
17
|
-
* @property {string} body — Effect function body
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* @typedef {Object} ConstantVar
|
|
22
|
-
* @property {string} name — Constant variable name (e.g., 'TAX_RATE')
|
|
23
|
-
* @property {string} value — Value expression (e.g., '0.21', "'hello'")
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @typedef {Object} LifecycleHook
|
|
28
|
-
* @property {string} body — The callback body (JavaScript code)
|
|
29
|
-
* @property {boolean} async — Whether the callback is async
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @typedef {Object} WatcherDef
|
|
34
|
-
* @property {'signal' | 'getter'} kind — Type of watch target
|
|
35
|
-
* @property {string} target — Signal/computed name (for kind='signal') or getter expression (for kind='getter')
|
|
36
|
-
* @property {string} newParam — Parameter name for new value (e.g., 'newVal')
|
|
37
|
-
* @property {string} oldParam — Parameter name for old value (e.g., 'oldVal')
|
|
38
|
-
* @property {string} body — Callback body
|
|
39
|
-
*/
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* @typedef {Object} MethodDef
|
|
43
|
-
* @property {string} name — Function name (e.g., 'increment')
|
|
44
|
-
* @property {string} params — Parameter list (e.g., '', 'a, b')
|
|
45
|
-
* @property {string} body — Function body
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @typedef {Object} PropDef
|
|
50
|
-
* @property {string} name — camelCase prop name (e.g., 'itemCount')
|
|
51
|
-
* @property {string} default — Default value as source string (e.g., '0', "'Click'", 'undefined')
|
|
52
|
-
* @property {string} attrName — kebab-case attribute name (e.g., 'item-count')
|
|
53
|
-
*/
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @typedef {Object} Binding
|
|
57
|
-
* @property {string} varName — Internal name (e.g., '__b0')
|
|
58
|
-
* @property {string} name — Variable name from {{name}}
|
|
59
|
-
* @property {'signal'|'computed'|'method'|'prop'} type — Binding source type
|
|
60
|
-
* @property {string[]} path — DOM path from root (e.g., ['childNodes[0]', 'childNodes[1]'])
|
|
61
|
-
*/
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* @typedef {Object} EventBinding
|
|
65
|
-
* @property {string} varName — Internal name (e.g., '__e0')
|
|
66
|
-
* @property {string} event — Event name (e.g., 'click')
|
|
67
|
-
* @property {string} handler — Handler function name (e.g., 'increment')
|
|
68
|
-
* @property {string[]} path — DOM path from root
|
|
69
|
-
*/
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* @typedef {Object} ParseResult
|
|
73
|
-
* @property {string} tagName — Custom element tag (e.g., 'wcc-counter')
|
|
74
|
-
* @property {string} className — PascalCase class name (e.g., 'WccCounter')
|
|
75
|
-
* @property {string} template — Raw HTML template content
|
|
76
|
-
* @property {string} style — Raw CSS content (empty string if none)
|
|
77
|
-
* @property {ReactiveVar[]} signals — signal() declarations
|
|
78
|
-
* @property {ComputedDef[]} computeds — computed() declarations
|
|
79
|
-
* @property {EffectDef[]} effects — effect() declarations
|
|
80
|
-
* @property {ConstantVar[]} constantVars — Plain const declarations (non-reactive)
|
|
81
|
-
* @property {WatcherDef[]} watchers — watch() declarations
|
|
82
|
-
* @property {MethodDef[]} methods — function declarations
|
|
83
|
-
* @property {PropDef[]} propDefs — Prop definitions with names and defaults
|
|
84
|
-
* @property {string|null} propsObjectName — Variable name from `const X = defineProps(...)`
|
|
85
|
-
* @property {string[]} emits — Event names declared in defineEmits (empty array if no defineEmits)
|
|
86
|
-
* @property {string|null} emitsObjectName — Variable name from `const X = defineEmits(...)`
|
|
87
|
-
* @property {Binding[]} bindings — (populated by tree-walker)
|
|
88
|
-
* @property {EventBinding[]} events — (populated by tree-walker)
|
|
89
|
-
* @property {string|null} processedTemplate — (populated by tree-walker)
|
|
90
|
-
* @property {IfBlock[]} ifBlocks — Conditional blocks (empty array if none)
|
|
91
|
-
* @property {ShowBinding[]} showBindings — Show bindings (empty array if none)
|
|
92
|
-
* @property {ForBlock[]} forBlocks — For blocks (empty array if none)
|
|
93
|
-
* @property {LifecycleHook[]} onMountHooks — Mount lifecycle hooks (empty array if none)
|
|
94
|
-
* @property {LifecycleHook[]} onDestroyHooks — Destroy lifecycle hooks (empty array if none)
|
|
95
|
-
* @property {ModelBinding[]} modelBindings — Model bindings (empty array if none)
|
|
96
|
-
* @property {ModelPropBinding[]} modelPropBindings — Model prop bindings from model:propName directives (empty array if none)
|
|
97
|
-
* @property {AttrBinding[]} attrBindings — Attribute bindings (empty array if none)
|
|
98
|
-
* @property {SlotBinding[]} slots — Slot bindings (empty array if no slots)
|
|
99
|
-
* @property {RefDeclaration[]} refs — templateRef declarations from script (empty array if none)
|
|
100
|
-
* @property {RefBinding[]} refBindings — ref attribute bindings from template (empty array if none)
|
|
101
|
-
* @property {ChildComponentBinding[]} childComponents — Child component bindings (empty array if none)
|
|
102
|
-
* @property {ChildComponentImport[]} childImports — Resolved child component imports (empty array if none)
|
|
103
|
-
* @property {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
* @
|
|
109
|
-
* @property {string}
|
|
110
|
-
* @property {string
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
* @
|
|
116
|
-
* @property {string}
|
|
117
|
-
* @property {string}
|
|
118
|
-
* @property {
|
|
119
|
-
* @property {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
* @
|
|
125
|
-
* @property {
|
|
126
|
-
* @property {string}
|
|
127
|
-
* @property {
|
|
128
|
-
* @property {
|
|
129
|
-
* @property {
|
|
130
|
-
* @property {
|
|
131
|
-
* @property {
|
|
132
|
-
* @property {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
* @
|
|
138
|
-
* @property {string
|
|
139
|
-
* @property {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
* @
|
|
145
|
-
* @property {string}
|
|
146
|
-
* @property {string
|
|
147
|
-
* @property {string}
|
|
148
|
-
* @property {string
|
|
149
|
-
* @property {string}
|
|
150
|
-
* @property {string
|
|
151
|
-
* @property {
|
|
152
|
-
* @property {
|
|
153
|
-
* @property {
|
|
154
|
-
* @property {
|
|
155
|
-
* @property {
|
|
156
|
-
* @property {
|
|
157
|
-
* @property {
|
|
158
|
-
* @property {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
* @
|
|
164
|
-
* @property {string}
|
|
165
|
-
* @property {string}
|
|
166
|
-
* @property {string}
|
|
167
|
-
* @property {
|
|
168
|
-
* @property {
|
|
169
|
-
* @property {string
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
* @
|
|
175
|
-
* @property {string}
|
|
176
|
-
* @property {string}
|
|
177
|
-
* @property {string
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
* @
|
|
183
|
-
* @property {string}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
* @
|
|
189
|
-
* @property {string
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
* @
|
|
195
|
-
* @property {string}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
* @
|
|
201
|
-
* @property {string}
|
|
202
|
-
* @property {string
|
|
203
|
-
* @property {string}
|
|
204
|
-
* @property {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
* @
|
|
210
|
-
* @property {string}
|
|
211
|
-
* @property {string}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
* @
|
|
217
|
-
* @property {string}
|
|
218
|
-
* @property {string
|
|
219
|
-
* @property {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
* @
|
|
225
|
-
* @property {string}
|
|
226
|
-
* @property {string}
|
|
227
|
-
* @property {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
* @
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
1
|
+
// v2/lib/types.js — JSDoc type definitions for wcCompiler v2
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef {Object} ReactiveVar
|
|
5
|
+
* @property {string} name — Signal variable name (e.g., 'count')
|
|
6
|
+
* @property {string} value — Initial value expression (e.g., '0', '[1, 2, 3]')
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef {Object} ComputedDef
|
|
11
|
+
* @property {string} name — Computed variable name (e.g., 'doubled')
|
|
12
|
+
* @property {string} body — Computed expression body (e.g., 'count() * 2')
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Object} EffectDef
|
|
17
|
+
* @property {string} body — Effect function body
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {Object} ConstantVar
|
|
22
|
+
* @property {string} name — Constant variable name (e.g., 'TAX_RATE')
|
|
23
|
+
* @property {string} value — Value expression (e.g., '0.21', "'hello'")
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @typedef {Object} LifecycleHook
|
|
28
|
+
* @property {string} body — The callback body (JavaScript code)
|
|
29
|
+
* @property {boolean} async — Whether the callback is async
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @typedef {Object} WatcherDef
|
|
34
|
+
* @property {'signal' | 'getter'} kind — Type of watch target
|
|
35
|
+
* @property {string} target — Signal/computed name (for kind='signal') or getter expression (for kind='getter')
|
|
36
|
+
* @property {string} newParam — Parameter name for new value (e.g., 'newVal')
|
|
37
|
+
* @property {string} oldParam — Parameter name for old value (e.g., 'oldVal')
|
|
38
|
+
* @property {string} body — Callback body
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @typedef {Object} MethodDef
|
|
43
|
+
* @property {string} name — Function name (e.g., 'increment')
|
|
44
|
+
* @property {string} params — Parameter list (e.g., '', 'a, b')
|
|
45
|
+
* @property {string} body — Function body
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @typedef {Object} PropDef
|
|
50
|
+
* @property {string} name — camelCase prop name (e.g., 'itemCount')
|
|
51
|
+
* @property {string} default — Default value as source string (e.g., '0', "'Click'", 'undefined')
|
|
52
|
+
* @property {string} attrName — kebab-case attribute name (e.g., 'item-count')
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @typedef {Object} Binding
|
|
57
|
+
* @property {string} varName — Internal name (e.g., '__b0')
|
|
58
|
+
* @property {string} name — Variable name from {{name}}
|
|
59
|
+
* @property {'signal'|'computed'|'method'|'prop'} type — Binding source type
|
|
60
|
+
* @property {string[]} path — DOM path from root (e.g., ['childNodes[0]', 'childNodes[1]'])
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @typedef {Object} EventBinding
|
|
65
|
+
* @property {string} varName — Internal name (e.g., '__e0')
|
|
66
|
+
* @property {string} event — Event name (e.g., 'click')
|
|
67
|
+
* @property {string} handler — Handler function name (e.g., 'increment')
|
|
68
|
+
* @property {string[]} path — DOM path from root
|
|
69
|
+
*/
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @typedef {Object} ParseResult
|
|
73
|
+
* @property {string} tagName — Custom element tag (e.g., 'wcc-counter')
|
|
74
|
+
* @property {string} className — PascalCase class name (e.g., 'WccCounter')
|
|
75
|
+
* @property {string} template — Raw HTML template content
|
|
76
|
+
* @property {string} style — Raw CSS content (empty string if none)
|
|
77
|
+
* @property {ReactiveVar[]} signals — signal() declarations
|
|
78
|
+
* @property {ComputedDef[]} computeds — computed() declarations
|
|
79
|
+
* @property {EffectDef[]} effects — effect() declarations
|
|
80
|
+
* @property {ConstantVar[]} constantVars — Plain const declarations (non-reactive)
|
|
81
|
+
* @property {WatcherDef[]} watchers — watch() declarations
|
|
82
|
+
* @property {MethodDef[]} methods — function declarations
|
|
83
|
+
* @property {PropDef[]} propDefs — Prop definitions with names and defaults
|
|
84
|
+
* @property {string|null} propsObjectName — Variable name from `const X = defineProps(...)`
|
|
85
|
+
* @property {string[]} emits — Event names declared in defineEmits (empty array if no defineEmits)
|
|
86
|
+
* @property {string|null} emitsObjectName — Variable name from `const X = defineEmits(...)`
|
|
87
|
+
* @property {Binding[]} bindings — (populated by tree-walker)
|
|
88
|
+
* @property {EventBinding[]} events — (populated by tree-walker)
|
|
89
|
+
* @property {string|null} processedTemplate — (populated by tree-walker)
|
|
90
|
+
* @property {IfBlock[]} ifBlocks — Conditional blocks (empty array if none)
|
|
91
|
+
* @property {ShowBinding[]} showBindings — Show bindings (empty array if none)
|
|
92
|
+
* @property {ForBlock[]} forBlocks — For blocks (empty array if none)
|
|
93
|
+
* @property {LifecycleHook[]} onMountHooks — Mount lifecycle hooks (empty array if none)
|
|
94
|
+
* @property {LifecycleHook[]} onDestroyHooks — Destroy lifecycle hooks (empty array if none)
|
|
95
|
+
* @property {ModelBinding[]} modelBindings — Model bindings (empty array if none)
|
|
96
|
+
* @property {ModelPropBinding[]} modelPropBindings — Model prop bindings from model:propName directives (empty array if none)
|
|
97
|
+
* @property {AttrBinding[]} attrBindings — Attribute bindings (empty array if none)
|
|
98
|
+
* @property {SlotBinding[]} slots — Slot bindings (empty array if no slots)
|
|
99
|
+
* @property {RefDeclaration[]} refs — templateRef declarations from script (empty array if none)
|
|
100
|
+
* @property {RefBinding[]} refBindings — ref attribute bindings from template (empty array if none)
|
|
101
|
+
* @property {ChildComponentBinding[]} childComponents — Child component bindings (empty array if none)
|
|
102
|
+
* @property {ChildComponentImport[]} childImports — Resolved child component imports (empty array if none)
|
|
103
|
+
* @property {DynamicComponentBinding[]} dynamicComponents — Dynamic component bindings (empty array if none)
|
|
104
|
+
* @property {string[]} exposeNames — Property names from defineExpose (empty array if none)
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* @typedef {Object} ShowBinding
|
|
109
|
+
* @property {string} varName
|
|
110
|
+
* @property {string} expression
|
|
111
|
+
* @property {string[]} path
|
|
112
|
+
*/
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* @typedef {Object} AttrBinding
|
|
116
|
+
* @property {string} varName
|
|
117
|
+
* @property {string} attr
|
|
118
|
+
* @property {string} expression
|
|
119
|
+
* @property {'attr'|'class'|'style'|'bool'} kind
|
|
120
|
+
* @property {string[]} path
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* @typedef {Object} IfBranch
|
|
125
|
+
* @property {'if'|'else-if'|'else'} type — Branch type
|
|
126
|
+
* @property {string|null} expression — JS expression (null for else)
|
|
127
|
+
* @property {string} templateHtml — Processed HTML (directive attr removed)
|
|
128
|
+
* @property {Binding[]} bindings — Text interpolation bindings
|
|
129
|
+
* @property {EventBinding[]} events — @event bindings
|
|
130
|
+
* @property {ShowBinding[]} showBindings — show bindings
|
|
131
|
+
* @property {AttrBinding[]} attrBindings — :attr / bind bindings
|
|
132
|
+
* @property {ModelBinding[]} modelBindings — model bindings
|
|
133
|
+
* @property {SlotBinding[]} slots — slot bindings
|
|
134
|
+
*/
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* @typedef {Object} IfBlock
|
|
138
|
+
* @property {string} varName — Unique name: '__if0', '__if1', ...
|
|
139
|
+
* @property {string[]} anchorPath — DOM path to comment anchor from __root
|
|
140
|
+
* @property {IfBranch[]} branches — Array of branches in chain order
|
|
141
|
+
*/
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @typedef {Object} ForBlock
|
|
145
|
+
* @property {string} varName — Unique name: '__for0', '__for1', ...
|
|
146
|
+
* @property {string} itemVar — Iteration variable name (e.g., 'item')
|
|
147
|
+
* @property {string|null} indexVar — Index variable name or null
|
|
148
|
+
* @property {string} source — Source expression (e.g., 'items', '5')
|
|
149
|
+
* @property {string|null} keyExpr — :key expression or null
|
|
150
|
+
* @property {string} templateHtml — Processed item HTML (each/:key attrs removed)
|
|
151
|
+
* @property {string[]} anchorPath — DOM path to comment anchor from __root
|
|
152
|
+
* @property {Binding[]} bindings — Text interpolation bindings within item
|
|
153
|
+
* @property {EventBinding[]} events — @event bindings within item
|
|
154
|
+
* @property {ShowBinding[]} showBindings — show bindings within item
|
|
155
|
+
* @property {AttrBinding[]} attrBindings — :attr bindings within item
|
|
156
|
+
* @property {ModelBinding[]} modelBindings — model bindings within item
|
|
157
|
+
* @property {SlotBinding[]} slots — slot bindings within item
|
|
158
|
+
* @property {ForBlock[]} [forBlocks] — Nested each directives within item
|
|
159
|
+
* @property {IfBlock[]} [ifBlocks] — Nested if/else-if/else chains within item
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @typedef {Object} ModelBinding
|
|
164
|
+
* @property {string} varName — Internal name: '__model0', '__model1', ...
|
|
165
|
+
* @property {string} signal — Signal name referenced by model (e.g., 'name', 'count')
|
|
166
|
+
* @property {string} prop — DOM property to bind: 'value' or 'checked'
|
|
167
|
+
* @property {string} event — Event to listen for: 'input' or 'change'
|
|
168
|
+
* @property {boolean} coerce — true if value requires Number() coercion (input type="number")
|
|
169
|
+
* @property {string|null} radioValue — Value attribute for radio inputs, null for others
|
|
170
|
+
* @property {string[]} path — DOM path from root to the element
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* @typedef {Object} ModelPropBinding
|
|
175
|
+
* @property {string} varName — Internal name: '__modelProp0', '__modelProp1', ...
|
|
176
|
+
* @property {string} propName — The prop name after 'model:' (e.g., 'value')
|
|
177
|
+
* @property {string} signal — Parent signal name (e.g., 'searchText')
|
|
178
|
+
* @property {string[]} path — DOM path to the child element
|
|
179
|
+
*/
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @typedef {Object} RefDeclaration
|
|
183
|
+
* @property {string} varName — Variable name from script (e.g., 'canvas')
|
|
184
|
+
* @property {string} refName — Ref name from templateRef argument (e.g., 'canvas')
|
|
185
|
+
*/
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @typedef {Object} RefBinding
|
|
189
|
+
* @property {string} refName — Ref name from ref attribute (e.g., 'canvas')
|
|
190
|
+
* @property {string[]} path — DOM path from root to the element (e.g., ['childNodes[0]'])
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @typedef {Object} SlotProp
|
|
195
|
+
* @property {string} prop — Prop name (attribute name without ':'), e.g. 'item'
|
|
196
|
+
* @property {string} source — Source expression (attribute value), e.g. 'currentItem'
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* @typedef {Object} SlotBinding
|
|
201
|
+
* @property {string} varName — Internal name (e.g., '__s0')
|
|
202
|
+
* @property {string} name — Slot name (empty string for default slot)
|
|
203
|
+
* @property {string[]} path — DOM path from root to the replacement span
|
|
204
|
+
* @property {string} defaultContent — Fallback content from original <slot> element
|
|
205
|
+
* @property {SlotProp[]} slotProps — Array of :prop="expr" bindings on the slot
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @typedef {Object} ChildPropBinding
|
|
210
|
+
* @property {string} attr — Attribute name on the child element (e.g., 'label')
|
|
211
|
+
* @property {string} expr — Expression from {{expr}} (e.g., 'role')
|
|
212
|
+
* @property {string} type — Binding source type: 'signal' | 'computed' | 'prop' | 'constant' | 'method'
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* @typedef {Object} ChildComponentBinding
|
|
217
|
+
* @property {string} tag — Child component tag name (e.g., 'wcc-badge')
|
|
218
|
+
* @property {string} varName — Internal ref name (e.g., '__child0')
|
|
219
|
+
* @property {string[]} path — DOM path from __root
|
|
220
|
+
* @property {ChildPropBinding[]} propBindings — Reactive attribute bindings
|
|
221
|
+
*/
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @typedef {Object} ChildComponentImport
|
|
225
|
+
* @property {string} tag — Child component tag name (kebab-case, used in template)
|
|
226
|
+
* @property {string} identifier — Import identifier (PascalCase, e.g., 'WccBadge')
|
|
227
|
+
* @property {string} importPath — Relative import path (e.g., './wcc-badge.js')
|
|
228
|
+
* @property {boolean} sideEffect — true if this is a side-effect import (no identifier)
|
|
229
|
+
*/
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @typedef {Object} DynPropBinding
|
|
233
|
+
* @property {string} attr — Attribute name (e.g., 'label', 'count')
|
|
234
|
+
* @property {string} expression — Expression string (e.g., "name()", "props.title")
|
|
235
|
+
*/
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @typedef {Object} DynEventBinding
|
|
239
|
+
* @property {string} event — Event name (e.g., 'click', 'change')
|
|
240
|
+
* @property {string} handler — Handler expression (e.g., "handleClick", "handleClick($event)")
|
|
241
|
+
*/
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @typedef {Object} DynamicComponentBinding
|
|
245
|
+
* @property {string} varName — Unique name: '__dyn0', '__dyn1', ...
|
|
246
|
+
* @property {string} isExpression — The :is attribute expression (e.g., "currentTag()")
|
|
247
|
+
* @property {DynPropBinding[]} props — Prop bindings from :attr="expr" attributes
|
|
248
|
+
* @property {DynEventBinding[]} events — Event bindings from @event="handler" attributes
|
|
249
|
+
* @property {string[]} anchorPath — DOM path to comment anchor from __root
|
|
250
|
+
*/
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Set of HTML attributes that use property assignment instead of setAttribute.
|
|
254
|
+
* @type {Set<string>}
|
|
255
|
+
*/
|
|
256
|
+
export const BOOLEAN_ATTRIBUTES = new Set([
|
|
257
|
+
'disabled', 'checked', 'hidden', 'readonly', 'required',
|
|
258
|
+
'selected', 'multiple', 'autofocus', 'autoplay', 'controls',
|
|
259
|
+
'loop', 'muted', 'open', 'novalidate'
|
|
260
|
+
]);
|
|
261
|
+
|
|
262
|
+
export {}
|