marko 5.39.51 → 5.40.1
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/dist/compiler/index.js +0 -2
- package/dist/core-tags/core/await/index.d.marko +17 -0
- package/dist/core-tags/core/script.d.marko +6 -1
- package/dist/runtime/vdom/VElement.js +10 -29
- package/dist/runtime/vdom/morphdom/index.js +0 -1
- package/dist/taglib/index.js +3 -6
- package/dist/translator/index.js +6 -17
- package/dist/translator/tag/attribute/index.js +0 -16
- package/dist/translator/tag/attribute-tag.js +4 -11
- package/dist/translator/tag/native-tag[html]/index.js +1 -13
- package/dist/translator/tag/native-tag[vdom]/index.js +0 -12
- package/dist/translator/tag/util.js +64 -53
- package/dist/translator/taglib/core/index.js +17 -366
- package/dist/translator/util/runtime-flags.js +2 -3
- package/dist/translator.js +4 -2
- package/docs/marko-json.md +3 -6
- package/package.json +4 -4
- package/src/compiler/index.js +0 -2
- package/src/core-tags/core/await/index.d.marko +17 -0
- package/src/core-tags/core/script.d.marko +6 -1
- package/src/runtime/vdom/VElement.js +10 -29
- package/src/runtime/vdom/morphdom/index.js +0 -1
- package/src/taglib/index.js +3 -6
- package/src/translator/index.js +4 -15
- package/src/translator/tag/attribute/index.js +1 -17
- package/src/translator/tag/attribute-tag.js +4 -11
- package/src/translator/tag/native-tag[html]/index.js +0 -12
- package/src/translator/tag/native-tag[vdom]/index.js +1 -13
- package/src/translator/tag/util.js +64 -53
- package/src/translator/taglib/core/index.js +0 -349
- package/src/translator/util/runtime-flags.js +1 -2
- package/src/translator.js +2 -0
- package/tags-html.d.ts +65 -65
- package/translator/index.d.ts +1 -0
|
@@ -27,34 +27,14 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
|
|
|
27
27
|
"parse-options": {
|
|
28
28
|
statement: true,
|
|
29
29
|
rawOpenTag: true
|
|
30
|
-
}
|
|
31
|
-
autocomplete: [
|
|
32
|
-
{
|
|
33
|
-
displayText: 'import <scope> from "<path>"',
|
|
34
|
-
description:
|
|
35
|
-
"Use to import external modules, follows the same syntax as JavaScript imports.",
|
|
36
|
-
snippet: 'import ${2} from "${1:path}"',
|
|
37
|
-
descriptionMoreURL:
|
|
38
|
-
"https://markojs.com/docs/syntax/#importing-external-files"
|
|
39
|
-
}]
|
|
40
|
-
|
|
30
|
+
}
|
|
41
31
|
},
|
|
42
32
|
"<export>": {
|
|
43
33
|
"node-factory": parseExport,
|
|
44
34
|
"parse-options": {
|
|
45
35
|
statement: true,
|
|
46
36
|
rawOpenTag: true
|
|
47
|
-
}
|
|
48
|
-
autocomplete: [
|
|
49
|
-
{
|
|
50
|
-
displayText: "export <scope>",
|
|
51
|
-
description:
|
|
52
|
-
"Use export additional data with the template, follows the same syntax as JavaScript exports.",
|
|
53
|
-
snippet: "export ${1}",
|
|
54
|
-
descriptionMoreURL:
|
|
55
|
-
"https://markojs.com/docs/syntax/#importing-external-files"
|
|
56
|
-
}]
|
|
57
|
-
|
|
37
|
+
}
|
|
58
38
|
},
|
|
59
39
|
"<client>": {
|
|
60
40
|
"node-factory": parseClient,
|
|
@@ -75,33 +55,14 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
|
|
|
75
55
|
"parse-options": {
|
|
76
56
|
statement: true,
|
|
77
57
|
rawOpenTag: true
|
|
78
|
-
}
|
|
79
|
-
autocomplete: [
|
|
80
|
-
{
|
|
81
|
-
displayText: "class { /** lifecycle methods **/ }",
|
|
82
|
-
snippet: "class {\n\t$0\n}",
|
|
83
|
-
description:
|
|
84
|
-
"A class containing the lifecycle methods, event handlers, and other properties for this component.",
|
|
85
|
-
descriptionMoreURL:
|
|
86
|
-
"https://markojs.com/docs/class-components/#single-file-components"
|
|
87
|
-
}]
|
|
88
|
-
|
|
58
|
+
}
|
|
89
59
|
},
|
|
90
60
|
"<static>": {
|
|
91
61
|
"node-factory": parseStatic,
|
|
92
62
|
"parse-options": {
|
|
93
63
|
statement: true,
|
|
94
64
|
rawOpenTag: true
|
|
95
|
-
}
|
|
96
|
-
autocomplete: [
|
|
97
|
-
{
|
|
98
|
-
displayText: "static <statement>",
|
|
99
|
-
description:
|
|
100
|
-
"A JavaScript statement which is only evaluated once your template is loaded.",
|
|
101
|
-
descriptionMoreURL:
|
|
102
|
-
"https://markojs.com/docs/syntax/#static-javascript"
|
|
103
|
-
}]
|
|
104
|
-
|
|
65
|
+
}
|
|
105
66
|
},
|
|
106
67
|
"<style>": {
|
|
107
68
|
transformer: transformStyle,
|
|
@@ -113,190 +74,46 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
|
|
|
113
74
|
},
|
|
114
75
|
"<macro>": {
|
|
115
76
|
"node-factory": parseMacro,
|
|
116
|
-
"code-generator": translateMacro
|
|
117
|
-
"@name": {
|
|
118
|
-
type: "string",
|
|
119
|
-
autocomplete: [
|
|
120
|
-
{
|
|
121
|
-
description: "The name which can be used as a tag within a template."
|
|
122
|
-
}]
|
|
123
|
-
|
|
124
|
-
},
|
|
125
|
-
autocomplete: [
|
|
126
|
-
{
|
|
127
|
-
displayText: 'macro|<params>| name="<name>"',
|
|
128
|
-
description: "Creates a reusable fragment within the template.",
|
|
129
|
-
snippet: 'macro|${2:param1, param2}| name="${1:name}"',
|
|
130
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#macro"
|
|
131
|
-
}]
|
|
132
|
-
|
|
77
|
+
"code-generator": translateMacro
|
|
133
78
|
},
|
|
134
79
|
"<include-text>": {
|
|
135
|
-
"code-generator": translateIncludeContent
|
|
136
|
-
attributes: {},
|
|
137
|
-
autocomplete: [
|
|
138
|
-
{
|
|
139
|
-
displayText: 'include-text("<path>")',
|
|
140
|
-
description: "Allows you to inline the contents of a text file.",
|
|
141
|
-
snippet: 'include-text(${1:"./foo.txt"})',
|
|
142
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#include-text"
|
|
143
|
-
}]
|
|
144
|
-
|
|
80
|
+
"code-generator": translateIncludeContent
|
|
145
81
|
},
|
|
146
82
|
"<include-html>": {
|
|
147
|
-
"code-generator": translateIncludeContent
|
|
148
|
-
attributes: {},
|
|
149
|
-
autocomplete: [
|
|
150
|
-
{
|
|
151
|
-
displayText: 'include-html("<path>")',
|
|
152
|
-
snippet: 'include-html(${1:"./foo.html"})',
|
|
153
|
-
description: "Allows you to inline the contents of an html file.",
|
|
154
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#include-html"
|
|
155
|
-
}]
|
|
156
|
-
|
|
83
|
+
"code-generator": translateIncludeContent
|
|
157
84
|
},
|
|
158
85
|
"<if>": {
|
|
159
86
|
"parse-options": { controlFlow: true },
|
|
160
|
-
"code-generator": translateIf
|
|
161
|
-
attributes: {},
|
|
162
|
-
autocomplete: [
|
|
163
|
-
{
|
|
164
|
-
snippet: "if(${1:condition})",
|
|
165
|
-
description: "Use to display content only if the condition is meant.",
|
|
166
|
-
descriptionMoreURL:
|
|
167
|
-
"https://markojs.com/docs/core-tags/#if-else-if-else"
|
|
168
|
-
}]
|
|
169
|
-
|
|
87
|
+
"code-generator": translateIf
|
|
170
88
|
},
|
|
171
89
|
"<else-if>": {
|
|
172
90
|
"parse-options": { controlFlow: true },
|
|
173
|
-
"code-generator": translateElseIf
|
|
174
|
-
attributes: {},
|
|
175
|
-
autocomplete: [
|
|
176
|
-
{
|
|
177
|
-
snippet: "else-if(${1:condition})",
|
|
178
|
-
description:
|
|
179
|
-
"Use after an <if> or <else-if> tag to display content if those conditions do not match and this one does.",
|
|
180
|
-
descriptionMoreURL:
|
|
181
|
-
"https://markojs.com/docs/core-tags/#if-else-if-else"
|
|
182
|
-
}]
|
|
183
|
-
|
|
91
|
+
"code-generator": translateElseIf
|
|
184
92
|
},
|
|
185
93
|
"<else>": {
|
|
186
94
|
"parse-options": { controlFlow: true },
|
|
187
|
-
"code-generator": translateElse
|
|
188
|
-
attributes: {},
|
|
189
|
-
autocomplete: [
|
|
190
|
-
{
|
|
191
|
-
description:
|
|
192
|
-
"Use after an <if> or <else-if> tag to display content if those conditions do not match.",
|
|
193
|
-
descriptionMoreURL:
|
|
194
|
-
"https://markojs.com/docs/core-tags/#if-else-if-else"
|
|
195
|
-
}]
|
|
196
|
-
|
|
95
|
+
"code-generator": translateElse
|
|
197
96
|
},
|
|
198
97
|
"<for>": {
|
|
199
98
|
"parse-options": { controlFlow: true },
|
|
200
|
-
"code-generator": translateFor
|
|
201
|
-
"@of": {
|
|
202
|
-
type: "expression",
|
|
203
|
-
autocomplete: [
|
|
204
|
-
{
|
|
205
|
-
description: "Iterates over a list of items."
|
|
206
|
-
}]
|
|
207
|
-
|
|
208
|
-
},
|
|
209
|
-
"@in": {
|
|
210
|
-
type: "expression",
|
|
211
|
-
autocomplete: [
|
|
212
|
-
{
|
|
213
|
-
description: "Iterates over the keys and values of an object."
|
|
214
|
-
}]
|
|
215
|
-
|
|
216
|
-
},
|
|
217
|
-
"@to": {
|
|
218
|
-
type: "number",
|
|
219
|
-
autocomplete: [
|
|
220
|
-
{
|
|
221
|
-
description: "Iterates up to the provided number (inclusive)"
|
|
222
|
-
}]
|
|
223
|
-
|
|
224
|
-
},
|
|
225
|
-
"@from": {
|
|
226
|
-
type: "number",
|
|
227
|
-
autocomplete: [
|
|
228
|
-
{
|
|
229
|
-
description: "Iterates starting from the provided number (inclusive)"
|
|
230
|
-
}]
|
|
231
|
-
|
|
232
|
-
},
|
|
233
|
-
"@step": {
|
|
234
|
-
type: "number",
|
|
235
|
-
autocomplete: [
|
|
236
|
-
{
|
|
237
|
-
description:
|
|
238
|
-
"The amount to increment during each iteration (with from/to)"
|
|
239
|
-
}]
|
|
240
|
-
|
|
241
|
-
},
|
|
242
|
-
autocomplete: [
|
|
243
|
-
{
|
|
244
|
-
snippet: "for|${1:value, index}| of=${3:array}",
|
|
245
|
-
description:
|
|
246
|
-
"Use to iterate over lists, object properties, or between ranges.",
|
|
247
|
-
descriptionMoreURL:
|
|
248
|
-
"https://markojs.com/docs/core-tags/#iterating-over-a-list"
|
|
249
|
-
},
|
|
250
|
-
{
|
|
251
|
-
snippet: "for|${1:name, value}| in=${3:object}",
|
|
252
|
-
descriptionMoreURL:
|
|
253
|
-
"https://markojs.com/docs/core-tags/#iterating-over-an-objects-properties"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
snippet:
|
|
257
|
-
"for|${1:index}| from=${2:number} to=${3:number} step=${4:number}",
|
|
258
|
-
descriptionMoreURL:
|
|
259
|
-
"https://markojs.com/docs/core-tags/#iterating-between-a-range-of-numbers"
|
|
260
|
-
}]
|
|
261
|
-
|
|
99
|
+
"code-generator": translateFor
|
|
262
100
|
},
|
|
263
101
|
"<while>": {
|
|
264
102
|
"parse-options": { controlFlow: true },
|
|
265
|
-
"code-generator": translateWhile
|
|
266
|
-
autocomplete: [
|
|
267
|
-
{
|
|
268
|
-
snippet: "while(${1:condition})",
|
|
269
|
-
description:
|
|
270
|
-
"Renders the content multiple times until the condition is no longer met.",
|
|
271
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#while"
|
|
272
|
-
}]
|
|
273
|
-
|
|
103
|
+
"code-generator": translateWhile
|
|
274
104
|
},
|
|
275
105
|
"<html-comment>": {
|
|
276
106
|
"code-generator": translateHTMLComment,
|
|
277
107
|
"parse-options": {
|
|
278
108
|
text: true
|
|
279
|
-
}
|
|
280
|
-
attributes: {},
|
|
281
|
-
autocomplete: [
|
|
282
|
-
{
|
|
283
|
-
description:
|
|
284
|
-
"Use to create an html comment that is not stripped from the output.",
|
|
285
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#html-comment"
|
|
286
|
-
}]
|
|
287
|
-
|
|
109
|
+
}
|
|
288
110
|
},
|
|
289
111
|
"<_preserve>": {
|
|
290
|
-
renderer: "marko/src/core-tags/components/preserve-tag.js"
|
|
291
|
-
"@n": "boolean",
|
|
292
|
-
"@i": "boolean",
|
|
293
|
-
"@b": "boolean",
|
|
294
|
-
autocomplete: []
|
|
112
|
+
renderer: "marko/src/core-tags/components/preserve-tag.js"
|
|
295
113
|
},
|
|
296
114
|
"<init-components>": {
|
|
297
115
|
"code-generator": translateServerOnly,
|
|
298
|
-
renderer: "marko/src/core-tags/components/init-components-tag.js"
|
|
299
|
-
"@immediate": "boolean"
|
|
116
|
+
renderer: "marko/src/core-tags/components/init-components-tag.js"
|
|
300
117
|
},
|
|
301
118
|
"<_preferred-script-location>": {
|
|
302
119
|
"code-generator": translateServerOnly,
|
|
@@ -305,93 +122,11 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
|
|
|
305
122
|
"<await>": {
|
|
306
123
|
renderer: "marko/src/core-tags/core/await/renderer.js",
|
|
307
124
|
types: "marko/src/core-tags/core/await/index.d.marko",
|
|
308
|
-
"code-generator": translateAwait
|
|
309
|
-
"@_provider": "expression",
|
|
310
|
-
"@_name": "string",
|
|
311
|
-
"@name": {
|
|
312
|
-
type: "string",
|
|
313
|
-
autocomplete: [
|
|
314
|
-
{
|
|
315
|
-
description:
|
|
316
|
-
"Used to improve debugging and also to ensure promise ordering with the show-after attribute.",
|
|
317
|
-
snippet: 'name="${1:name}"'
|
|
318
|
-
}]
|
|
319
|
-
|
|
320
|
-
},
|
|
321
|
-
"@timeout": {
|
|
322
|
-
type: "number",
|
|
323
|
-
autocomplete: [
|
|
324
|
-
{
|
|
325
|
-
description:
|
|
326
|
-
"An optional timeout that when reached will cause the promise to reject with a TimeoutError."
|
|
327
|
-
}]
|
|
328
|
-
|
|
329
|
-
},
|
|
330
|
-
"@client-reorder": {
|
|
331
|
-
type: "boolean",
|
|
332
|
-
autocomplete: [
|
|
333
|
-
{
|
|
334
|
-
description:
|
|
335
|
-
"If set anything after this promise will be sent out immediately, and reordered using JS in the browser."
|
|
336
|
-
}]
|
|
337
|
-
|
|
338
|
-
},
|
|
339
|
-
"@show-after": {
|
|
340
|
-
type: "string",
|
|
341
|
-
autocomplete: [
|
|
342
|
-
{
|
|
343
|
-
description:
|
|
344
|
-
"This attribute will ensure that (with client-reorder) this await tag will always show after another await tag with the provided name."
|
|
345
|
-
}]
|
|
346
|
-
|
|
347
|
-
},
|
|
348
|
-
"@then <then>": {
|
|
349
|
-
autocomplete: [
|
|
350
|
-
{
|
|
351
|
-
displayText: "then|<result>|",
|
|
352
|
-
description: "Executed with the result of the resolved promise.",
|
|
353
|
-
snippet: "then|${1:result}|",
|
|
354
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
|
|
355
|
-
}]
|
|
356
|
-
|
|
357
|
-
},
|
|
358
|
-
"@catch <catch>": {
|
|
359
|
-
autocomplete: [
|
|
360
|
-
{
|
|
361
|
-
displayText: "catch|<err>|",
|
|
362
|
-
description: "Executed with the err of the rejected promise.",
|
|
363
|
-
snippet: "catch|${1:err}|",
|
|
364
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
|
|
365
|
-
}]
|
|
366
|
-
|
|
367
|
-
},
|
|
368
|
-
"@placeholder <placeholder>": {
|
|
369
|
-
autocomplete: [
|
|
370
|
-
{
|
|
371
|
-
description: "A placeholder to display while the promise is pending.",
|
|
372
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
|
|
373
|
-
}]
|
|
374
|
-
|
|
375
|
-
},
|
|
376
|
-
autocomplete: [
|
|
377
|
-
{
|
|
378
|
-
displayText: "await(<promise>)",
|
|
379
|
-
description:
|
|
380
|
-
"Used to render a template asynchronously with the results of a Promise",
|
|
381
|
-
snippet: "await(${1:promise})",
|
|
382
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
|
|
383
|
-
}]
|
|
384
|
-
|
|
125
|
+
"code-generator": translateAwait
|
|
385
126
|
},
|
|
386
127
|
"<await-reorderer>": {
|
|
387
128
|
"code-generator": translateServerOnly,
|
|
388
|
-
renderer: "marko/src/core-tags/core/await/reorderer-renderer.js"
|
|
389
|
-
autocomplete: [
|
|
390
|
-
{
|
|
391
|
-
snippet: "await-reorderer",
|
|
392
|
-
descriptionMoreURL: "https://markojs.com/docs/core-tags/#await"
|
|
393
|
-
}]
|
|
394
|
-
|
|
129
|
+
renderer: "marko/src/core-tags/core/await/reorderer-renderer.js"
|
|
395
130
|
},
|
|
396
131
|
"<__flush_here_and_after__>": {
|
|
397
132
|
"code-generator": translateServerOnly,
|
|
@@ -405,89 +140,5 @@ var translateWhile = _interopRequireWildcard(require("./translate-while"));funct
|
|
|
405
140
|
},
|
|
406
141
|
"<script>": {
|
|
407
142
|
types: "marko/src/core-tags/core/script.d.marko"
|
|
408
|
-
},
|
|
409
|
-
"<*>": {
|
|
410
|
-
"@key": {
|
|
411
|
-
type: "string",
|
|
412
|
-
"preserve-name": true,
|
|
413
|
-
autocomplete: [
|
|
414
|
-
{
|
|
415
|
-
displayText: 'key="<method>"',
|
|
416
|
-
snippet: 'key="${1:method}"',
|
|
417
|
-
descriptionMoreURL: "https://markojs.com/docs/class-components/#key"
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
descriptionMoreURL: "https://markojs.com/docs/class-components/#key"
|
|
421
|
-
}]
|
|
422
|
-
|
|
423
|
-
},
|
|
424
|
-
"@on*": {
|
|
425
|
-
pattern: true,
|
|
426
|
-
type: "statement",
|
|
427
|
-
"allow-expressions": true,
|
|
428
|
-
"preserve-name": true,
|
|
429
|
-
"set-flag": "hasComponentEvents",
|
|
430
|
-
autocomplete: [
|
|
431
|
-
{
|
|
432
|
-
displayText: 'on<event>("<method>")',
|
|
433
|
-
snippet: 'on${1:Click}("handle${2:Button}${1:Click}")',
|
|
434
|
-
descriptionMoreURL:
|
|
435
|
-
"https://markojs.com/docs/components/#attaching-dom-event-listeners"
|
|
436
|
-
}]
|
|
437
|
-
|
|
438
|
-
},
|
|
439
|
-
"@once*": {
|
|
440
|
-
pattern: true,
|
|
441
|
-
type: "statement",
|
|
442
|
-
"allow-expressions": true,
|
|
443
|
-
"preserve-name": true,
|
|
444
|
-
"set-flag": "hasComponentEvents",
|
|
445
|
-
autocomplete: {
|
|
446
|
-
displayText: 'once<event>("<method>")',
|
|
447
|
-
snippet: 'once${1:Click}("handle${2:Button}${1:Click}")',
|
|
448
|
-
descriptionMoreURL:
|
|
449
|
-
"https://markojs.com/docs/components/#attaching-dom-event-listeners"
|
|
450
|
-
}
|
|
451
|
-
},
|
|
452
|
-
"@no-update": {
|
|
453
|
-
type: "flag",
|
|
454
|
-
"preserve-name": true,
|
|
455
|
-
autocomplete: [
|
|
456
|
-
{
|
|
457
|
-
descriptionMoreURL:
|
|
458
|
-
"https://markojs.com/docs/class-components/#no-update"
|
|
459
|
-
}]
|
|
460
|
-
|
|
461
|
-
},
|
|
462
|
-
"@no-update-body": {
|
|
463
|
-
type: "flag",
|
|
464
|
-
"preserve-name": true,
|
|
465
|
-
autocomplete: [
|
|
466
|
-
{
|
|
467
|
-
descriptionMoreURL:
|
|
468
|
-
"https://markojs.com/docs/class-components/#no-update-body"
|
|
469
|
-
}]
|
|
470
|
-
|
|
471
|
-
},
|
|
472
|
-
"@no-update-if": {
|
|
473
|
-
"preserve-name": true,
|
|
474
|
-
autocomplete: [
|
|
475
|
-
{
|
|
476
|
-
snippet: "no-update-if(${1:condition})",
|
|
477
|
-
descriptionMoreURL:
|
|
478
|
-
"https://markojs.com/docs/class-components/#no-update-if"
|
|
479
|
-
}]
|
|
480
|
-
|
|
481
|
-
},
|
|
482
|
-
"@no-update-body-if": {
|
|
483
|
-
"preserve-name": true,
|
|
484
|
-
autocomplete: [
|
|
485
|
-
{
|
|
486
|
-
snippet: "no-update-body-if(${1:condition})",
|
|
487
|
-
descriptionMoreURL:
|
|
488
|
-
"https://markojs.com/docs/class-components/#no-update-body-if"
|
|
489
|
-
}]
|
|
490
|
-
|
|
491
|
-
}
|
|
492
143
|
}
|
|
493
144
|
};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
"use strict";exports.__esModule = true;exports.SPREAD_ATTRS = exports.
|
|
2
|
-
const
|
|
3
|
-
const SPREAD_ATTRS = exports.SPREAD_ATTRS = 4; // TODO: impl custom elements.
|
|
1
|
+
"use strict";exports.__esModule = true;exports.SPREAD_ATTRS = exports.HAS_SIMPLE_ATTRS = void 0;const HAS_SIMPLE_ATTRS = exports.HAS_SIMPLE_ATTRS = 1;
|
|
2
|
+
const SPREAD_ATTRS = exports.SPREAD_ATTRS = 4;
|
package/dist/translator.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";exports.__esModule = true;exports.version = exports.translate = exports.transform = exports.taglibs = exports.tagDiscoveryDirs = exports.preferAPI = exports.getRuntimeEntryFiles = exports.analyze = void 0;var tagsAPI = _interopRequireWildcard(require("@marko/runtime-tags/translator"));
|
|
1
|
+
"use strict";exports.__esModule = true;exports.version = exports.translate = exports.transform = exports.taglibs = exports.tagDiscoveryDirs = exports.preferAPI = exports.optionalTaglibs = exports.getRuntimeEntryFiles = exports.classTaglibs = exports.analyze = void 0;var tagsAPI = _interopRequireWildcard(require("@marko/runtime-tags/translator"));
|
|
2
2
|
|
|
3
3
|
var classAPI = _interopRequireWildcard(require("./translator/index"));function _interopRequireWildcard(e, t) {if ("function" == typeof WeakMap) var r = new WeakMap(),n = new WeakMap();return (_interopRequireWildcard = function (e, t) {if (!t && e && e.__esModule) return e;var o,i,f = { __proto__: null, default: e };if (null === e || "object" != typeof e && "function" != typeof e) return f;if (o = t ? n : r) {if (o.has(e)) return o.get(e);o.set(e, f);}for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]);return f;})(e, t);}
|
|
4
4
|
|
|
@@ -6,9 +6,11 @@ const {
|
|
|
6
6
|
version,
|
|
7
7
|
preferAPI,
|
|
8
8
|
tagDiscoveryDirs,
|
|
9
|
+
classTaglibs,
|
|
10
|
+
optionalTaglibs,
|
|
9
11
|
transform,
|
|
10
12
|
analyze,
|
|
11
13
|
translate,
|
|
12
14
|
taglibs,
|
|
13
15
|
getRuntimeEntryFiles
|
|
14
|
-
} = tagsAPI.createInteropTranslator(classAPI);exports.getRuntimeEntryFiles = getRuntimeEntryFiles;exports.taglibs = taglibs;exports.translate = translate;exports.analyze = analyze;exports.transform = transform;exports.tagDiscoveryDirs = tagDiscoveryDirs;exports.preferAPI = preferAPI;exports.version = version;
|
|
16
|
+
} = tagsAPI.createInteropTranslator(classAPI);exports.getRuntimeEntryFiles = getRuntimeEntryFiles;exports.taglibs = taglibs;exports.translate = translate;exports.analyze = analyze;exports.transform = transform;exports.optionalTaglibs = optionalTaglibs;exports.classTaglibs = classTaglibs;exports.tagDiscoveryDirs = tagDiscoveryDirs;exports.preferAPI = preferAPI;exports.version = version;
|
package/docs/marko-json.md
CHANGED
|
@@ -35,7 +35,7 @@ There are 2 types of configuration files:
|
|
|
35
35
|
|
|
36
36
|
### Attributes
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
Attributes declared in this config file control how they are passed to the tag's `input`.
|
|
39
39
|
|
|
40
40
|
```js
|
|
41
41
|
{
|
|
@@ -45,9 +45,7 @@ One commonly-used feature of this config file is compile-time checks for attribu
|
|
|
45
45
|
}
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
-
The
|
|
49
|
-
|
|
50
|
-
The `string` value is used as documentation for the custom tag. It may be picked up by tooling, like Marko’s editor plugins, to provide hints to the user.
|
|
48
|
+
The `string` value only documents the attribute. For type checking and editor hints, type the tag's `Input` with TypeScript instead.
|
|
51
49
|
|
|
52
50
|
The recommended list of attribute types are as follows:
|
|
53
51
|
|
|
@@ -69,11 +67,10 @@ You can also provide an object for an attribute definition’s value for additio
|
|
|
69
67
|
"heading": {
|
|
70
68
|
"type": "string", // Same as setting "string" above.
|
|
71
69
|
"default-value": 0, // The attribute will default to this value.
|
|
72
|
-
"required": true, // Error during compilation if this attribute is undefined. (Mutually exclusive with "default-value"
|
|
73
70
|
"preserve-name": true, // By default component attributes are camelCased; this disables that feature.
|
|
74
71
|
"remove-dashes": true, // By default native tag attributes are dash-cased; this disables that feature.
|
|
75
72
|
|
|
76
|
-
// The following
|
|
73
|
+
// The following are ignored.
|
|
77
74
|
"deprecated": true,
|
|
78
75
|
"description": "The component’s heading text" // Describes the attribute’s purpose.
|
|
79
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marko",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.40.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "UI Components + streaming, async, high performance, HTML templating for Node.js and the browser.",
|
|
6
6
|
"keywords": [
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
},
|
|
68
68
|
"types": "index.d.ts",
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@marko/compiler": "^5.
|
|
71
|
-
"@marko/runtime-tags": "6.4.
|
|
70
|
+
"@marko/compiler": "^5.43.0",
|
|
71
|
+
"@marko/runtime-tags": "6.4.14",
|
|
72
72
|
"app-module-path": "^2.2.0",
|
|
73
73
|
"argly": "^1.2.0",
|
|
74
74
|
"browser-refresh-client": "1.1.4",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"warp10": "^2.1.0"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"marko": "5.
|
|
86
|
+
"marko": "5.40.1"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
89
|
"node": ">=22.12.0"
|
package/src/compiler/index.js
CHANGED
|
@@ -147,8 +147,6 @@ exports.compileFileForBrowser = compileFileForBrowser;
|
|
|
147
147
|
exports.configure = configure;
|
|
148
148
|
|
|
149
149
|
exports.taglibLookup = taglib.lookup;
|
|
150
|
-
exports.taglibLoader = taglib.loader;
|
|
151
|
-
exports.taglibFinder = taglib.finder;
|
|
152
150
|
exports.buildTaglibLookup = taglib.lookup.buildLookup;
|
|
153
151
|
exports.clearCaches = function clearCaches() {
|
|
154
152
|
compiler._clearDefaults();
|
|
@@ -1,11 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Renders asynchronously with the result of the promise in its argument:
|
|
3
|
+
* `@then` with the value it resolves to, `@catch` with the error it rejects
|
|
4
|
+
* with, and `@placeholder` while it is pending.
|
|
5
|
+
*
|
|
6
|
+
* [Marko 5 docs](https://v5.markojs.com/docs/core-tags/#await)
|
|
7
|
+
*/
|
|
1
8
|
export type Input<T> = {
|
|
2
9
|
value: readonly [T];
|
|
10
|
+
/** Rendered with the value the promise resolves to. */
|
|
3
11
|
then?: Marko.AttrTag<{ renderBody: Marko.Body<[Awaited<T>]> }>;
|
|
12
|
+
/** Rendered with the error the promise rejects with. */
|
|
4
13
|
catch?: Marko.AttrTag<{ renderBody: Marko.Body<[unknown]> }>;
|
|
14
|
+
/** Displayed while the promise is pending. */
|
|
5
15
|
placeholder?: Marko.AttrTag<{ renderBody: Marko.Body }>;
|
|
16
|
+
/**
|
|
17
|
+
* Sends the content after this tag without waiting for the promise, and
|
|
18
|
+
* moves this tag's content into place in the browser once it settles.
|
|
19
|
+
*/
|
|
6
20
|
"client-reorder"?: boolean;
|
|
21
|
+
/** Names this tag for debugging and for another tag's `show-after`. */
|
|
7
22
|
name?: string;
|
|
23
|
+
/** Rejects with a `TimeoutError` after this many milliseconds (10,000 by default). */
|
|
8
24
|
timeout?: number;
|
|
25
|
+
/** With `client-reorder`, keeps this tag after the `<await>` with this name. */
|
|
9
26
|
"show-after"?: string;
|
|
10
27
|
} | {
|
|
11
28
|
value: T;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/* File for types only, not actual implementation */
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A native `<script>` element.
|
|
5
|
+
*
|
|
6
|
+
* [MDN](https://developer.mozilla.org/docs/Web/HTML/Element/script)
|
|
7
|
+
*/
|
|
3
8
|
export interface Input extends Marko.HTML.Script {
|
|
4
9
|
value?(): unknown;
|
|
5
10
|
}
|
|
@@ -8,7 +8,6 @@ var VNode = require("./VNode");
|
|
|
8
8
|
var isTextOnly = require("./is-text-only");
|
|
9
9
|
var ATTR_XLINK_HREF = "xlink:href";
|
|
10
10
|
var xmlnsRegExp = /^xmlns(:|$)/;
|
|
11
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
12
11
|
var NS_XLINK = "http://www.w3.org/1999/xlink";
|
|
13
12
|
var NS_HTML = "http://www.w3.org/1999/xhtml";
|
|
14
13
|
var NS_MATH = "http://www.w3.org/1998/Math/MathML";
|
|
@@ -19,7 +18,6 @@ var DEFAULT_NS = {
|
|
|
19
18
|
};
|
|
20
19
|
|
|
21
20
|
var FLAG_SIMPLE_ATTRS = 1;
|
|
22
|
-
var FLAG_CUSTOM_ELEMENT = 2;
|
|
23
21
|
var FLAG_SPREAD_ATTRS = 4;
|
|
24
22
|
|
|
25
23
|
var ATTR_HREF = "href";
|
|
@@ -72,14 +70,6 @@ function normalizeValue(value) {
|
|
|
72
70
|
return value + "";
|
|
73
71
|
}
|
|
74
72
|
|
|
75
|
-
function assign(a, b) {
|
|
76
|
-
for (var key in b) {
|
|
77
|
-
if (hasOwnProperty.call(b, key)) {
|
|
78
|
-
a[key] = b[key];
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
73
|
function VElementClone(other) {
|
|
84
74
|
this.___firstChildInternal = other.___firstChildInternal;
|
|
85
75
|
this.___parentNode = null;
|
|
@@ -174,30 +164,25 @@ VElement.prototype = {
|
|
|
174
164
|
var attributes = this.___attributes;
|
|
175
165
|
var namespaceURI = DEFAULT_NS[tagName] || parentNamespaceURI || NS_HTML;
|
|
176
166
|
|
|
177
|
-
var flags = this.___flags;
|
|
178
167
|
var el = (host.ownerDocument || host).createElementNS(
|
|
179
168
|
namespaceURI,
|
|
180
169
|
tagName,
|
|
181
170
|
);
|
|
182
171
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
} else {
|
|
186
|
-
for (var attrName in attributes) {
|
|
187
|
-
var attrValue = normalizeValue(attributes[attrName]);
|
|
172
|
+
for (var attrName in attributes) {
|
|
173
|
+
var attrValue = normalizeValue(attributes[attrName]);
|
|
188
174
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
}
|
|
175
|
+
if (attrValue !== undefined) {
|
|
176
|
+
if (attrName == ATTR_XLINK_HREF) {
|
|
177
|
+
el.setAttributeNS(NS_XLINK, ATTR_HREF, attrValue);
|
|
178
|
+
} else {
|
|
179
|
+
el.setAttribute(attrName, attrValue);
|
|
195
180
|
}
|
|
196
181
|
}
|
|
182
|
+
}
|
|
197
183
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
184
|
+
if (isTextOnly(tagName)) {
|
|
185
|
+
el.textContent = this.___textContent;
|
|
201
186
|
}
|
|
202
187
|
|
|
203
188
|
vElementByDOMNode.set(el, this);
|
|
@@ -266,10 +251,6 @@ VElement.___morphAttrs = function (fromEl, vFromEl, toEl) {
|
|
|
266
251
|
var toFlags = toEl.___flags;
|
|
267
252
|
var attrs = toEl.___attributes;
|
|
268
253
|
|
|
269
|
-
if (toFlags & FLAG_CUSTOM_ELEMENT) {
|
|
270
|
-
return assign(fromEl, attrs);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
254
|
var props = toEl.___properties;
|
|
274
255
|
var attrName;
|
|
275
256
|
|