marko 5.39.50 → 5.40.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.
Files changed (77) hide show
  1. package/dist/compiler/index.js +0 -2
  2. package/dist/core-tags/core/await/index.d.marko +17 -0
  3. package/dist/core-tags/core/script.d.marko +6 -1
  4. package/dist/runtime/helpers/dynamic-tag.js +11 -4
  5. package/dist/runtime/helpers/load-tag.js +1 -1
  6. package/dist/runtime/helpers/tags-compat/dom-debug.js +1 -1
  7. package/dist/runtime/helpers/tags-compat/dom-debug.mjs +1 -1
  8. package/dist/runtime/helpers/tags-compat/dom.js +1 -1
  9. package/dist/runtime/helpers/tags-compat/dom.mjs +1 -1
  10. package/dist/runtime/helpers/tags-compat/html-debug.js +3 -1
  11. package/dist/runtime/helpers/tags-compat/html-debug.mjs +1 -1
  12. package/dist/runtime/helpers/tags-compat/html.js +3 -1
  13. package/dist/runtime/helpers/tags-compat/html.mjs +1 -1
  14. package/dist/runtime/helpers/tags-compat/runtime-dom.js +50 -51
  15. package/dist/runtime/helpers/tags-compat/runtime-html.js +18 -20
  16. package/dist/runtime/html/AsyncStream.js +10 -10
  17. package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
  18. package/dist/runtime/html/helpers/attr.js +2 -2
  19. package/dist/runtime/html/helpers/escape-xml.js +1 -1
  20. package/dist/runtime/renderable.js +1 -1
  21. package/dist/runtime/vdom/AsyncVDOMBuilder.js +65 -65
  22. package/dist/runtime/vdom/VComment.js +7 -7
  23. package/dist/runtime/vdom/VComponent.js +3 -3
  24. package/dist/runtime/vdom/VDocumentFragment.js +6 -6
  25. package/dist/runtime/vdom/VElement.js +39 -58
  26. package/dist/runtime/vdom/VFragment.js +5 -5
  27. package/dist/runtime/vdom/VNode.js +29 -29
  28. package/dist/runtime/vdom/VText.js +8 -8
  29. package/dist/runtime/vdom/helpers/const-element.js +3 -3
  30. package/dist/runtime/vdom/hot-reload.js +2 -2
  31. package/dist/runtime/vdom/morphdom/fragment.js +3 -3
  32. package/dist/runtime/vdom/morphdom/helpers.js +1 -1
  33. package/dist/runtime/vdom/morphdom/index.js +34 -35
  34. package/dist/runtime/vdom/vdom.js +15 -15
  35. package/dist/taglib/index.js +3 -6
  36. package/dist/translator/index.js +8 -23
  37. package/dist/translator/tag/attribute/index.js +0 -16
  38. package/dist/translator/tag/attribute-tag.js +4 -11
  39. package/dist/translator/tag/custom-tag.js +1 -2
  40. package/dist/translator/tag/native-tag[html]/index.js +1 -13
  41. package/dist/translator/tag/native-tag[vdom]/index.js +0 -12
  42. package/dist/translator/tag/util.js +69 -55
  43. package/dist/translator/taglib/core/index.js +17 -366
  44. package/dist/translator/util/get-component-files.js +1 -1
  45. package/dist/translator/util/runtime-flags.js +2 -3
  46. package/dist/translator.js +4 -2
  47. package/docs/marko-json.md +3 -6
  48. package/index.d.ts +3 -8
  49. package/package.json +4 -4
  50. package/src/compiler/index.js +0 -2
  51. package/src/core-tags/core/await/index.d.marko +17 -0
  52. package/src/core-tags/core/script.d.marko +6 -1
  53. package/src/runtime/helpers/dynamic-tag.js +10 -3
  54. package/src/runtime/helpers/tags-compat/dom-debug.js +1 -1
  55. package/src/runtime/helpers/tags-compat/dom-debug.mjs +1 -1
  56. package/src/runtime/helpers/tags-compat/dom.js +1 -1
  57. package/src/runtime/helpers/tags-compat/dom.mjs +1 -1
  58. package/src/runtime/helpers/tags-compat/html-debug.js +3 -1
  59. package/src/runtime/helpers/tags-compat/html-debug.mjs +1 -1
  60. package/src/runtime/helpers/tags-compat/html.js +3 -1
  61. package/src/runtime/helpers/tags-compat/html.mjs +1 -1
  62. package/src/runtime/helpers/tags-compat/runtime-dom.js +40 -41
  63. package/src/runtime/helpers/tags-compat/runtime-html.js +14 -16
  64. package/src/runtime/vdom/VElement.js +10 -29
  65. package/src/runtime/vdom/morphdom/index.js +0 -1
  66. package/src/taglib/index.js +3 -6
  67. package/src/translator/index.js +6 -21
  68. package/src/translator/tag/attribute/index.js +1 -17
  69. package/src/translator/tag/attribute-tag.js +4 -11
  70. package/src/translator/tag/custom-tag.js +1 -2
  71. package/src/translator/tag/native-tag[html]/index.js +0 -12
  72. package/src/translator/tag/native-tag[vdom]/index.js +1 -13
  73. package/src/translator/tag/util.js +69 -55
  74. package/src/translator/taglib/core/index.js +0 -349
  75. package/src/translator/util/runtime-flags.js +1 -2
  76. package/src/translator.js +2 -0
  77. package/translator/index.d.ts +1 -0
@@ -35,17 +35,10 @@ export function analyzeAttributeTags(rootTag) {
35
35
  assertNoArgs(child);
36
36
  const tagDef = getTagDef(child) || {};
37
37
  const name = getFullyResolvedTagName(child);
38
- let {
39
- targetProperty = child.node.name.value.slice(1),
40
- isRepeated = false,
41
- } = tagDef;
42
-
43
- const preserveName =
44
- tagDef.preserveName === true || tagDef.removeDashes === false;
45
-
46
- if (!preserveName) {
47
- targetProperty = removeDashes(targetProperty);
48
- }
38
+ const { isRepeated = false } = tagDef;
39
+ const targetProperty = removeDashes(
40
+ tagDef.targetProperty || child.node.name.value.slice(1),
41
+ );
49
42
 
50
43
  const attrTagMeta = ((attributeTags ||= {})[name] ||= {
51
44
  targetProperty,
@@ -57,8 +57,7 @@ export default function (path, isNullable) {
57
57
  }
58
58
  }
59
59
 
60
- let binding = !relativePath && path.scope.getBinding(tagName);
61
- if (binding && !binding.identifier.loc) binding = null;
60
+ const binding = !relativePath && path.scope.getBinding(tagName);
62
61
 
63
62
  if (relativePath) {
64
63
  tagIdentifier = node.extra?.tagNameLoad
@@ -1,5 +1,3 @@
1
- import { resolve } from "path";
2
-
3
1
  import { types as t } from "@marko/compiler";
4
2
  import {
5
3
  getTagDef,
@@ -14,8 +12,6 @@ import { hasUserKey } from "../../util/key-manager";
14
12
  import withPreviousLocation from "../../util/with-previous-location";
15
13
  import translateAttributes from "./attributes";
16
14
 
17
- const EMPTY_OBJECT = {};
18
-
19
15
  /**
20
16
  * Translates the html streaming version of a standard html element.
21
17
  */
@@ -34,14 +30,6 @@ export default function (path, isNullable) {
34
30
  const tagDef = getTagDef(path);
35
31
  const meta = file.metadata.marko;
36
32
 
37
- if (tagDef) {
38
- const { parseOptions = EMPTY_OBJECT } = tagDef;
39
- if (parseOptions.import) {
40
- // TODO: the taglib should be updated to support this as a top level option.
41
- file.metadata.marko.deps.push(resolve(tagDef.dir, parseOptions.import));
42
- }
43
- }
44
-
45
33
  if (handlers) {
46
34
  Object.entries(handlers).forEach(
47
35
  ([eventName, { arguments: args, once }]) => {
@@ -1,8 +1,5 @@
1
1
  import { types as t } from "@marko/compiler";
2
- import {
3
- getTagDef,
4
- normalizeTemplateString,
5
- } from "@marko/compiler/babel-utils";
2
+ import { normalizeTemplateString } from "@marko/compiler/babel-utils";
6
3
 
7
4
  import * as FLAGS from "../../util/runtime-flags";
8
5
  import write from "../../util/vdom-out-write";
@@ -186,15 +183,6 @@ function tagArguments(path) {
186
183
  runtimeFlags |= FLAGS.HAS_SIMPLE_ATTRS;
187
184
  }
188
185
 
189
- const tagDef = getTagDef(path);
190
-
191
- if (tagDef) {
192
- const { htmlType } = tagDef;
193
- if (htmlType === "custom-element") {
194
- runtimeFlags |= FLAGS.IS_CUSTOM_ELEMENT;
195
- }
196
- }
197
-
198
186
  writeArgs.push(t.numericLiteral(runtimeFlags));
199
187
 
200
188
  if (tagProperties.length) {
@@ -25,49 +25,34 @@ export function getAttrs(path, preserveNames, isAttrTag) {
25
25
  const foundProperties = {};
26
26
  const hasAttributeTags = !!attributeTags.length;
27
27
  const isTagsAPI = findRootTag(path)?.node.extra?.featureType === "tags";
28
+ const isTagsAttrTag = isTagsAPI && isAttrTag;
28
29
  const renderBodyKey = isTagsAPI ? "content" : "renderBody";
29
30
 
30
31
  for (let i = 0; i < attrsLen; i++) {
31
32
  const { name, value } = attributes[i];
32
33
 
33
34
  if (name) {
34
- const attrDef = tagDef && tagDef.getAttribute(name);
35
+ const attrDef = getAttrDef(tagDef, name);
35
36
  let targetProperties = properties;
36
- let targetProperty = name;
37
- let preserveName = preserveNames;
38
-
39
- if (attrDef) {
40
- if (attrDef.targetProperty) {
41
- const key = attrDef.targetProperty;
42
- preserveName =
43
- attrDef.preserveName !== false && attrDef.removeDashes !== true;
44
-
45
- if (attrDef.dynamicAttribute) {
46
- let targetObject = targetObjects[key];
47
-
48
- if (!targetObject) {
49
- properties.push(
50
- t.objectProperty(
51
- t.stringLiteral(key),
52
- (targetObject = targetObjects[key] = t.objectExpression([])),
53
- ),
54
- );
55
- }
56
-
57
- targetProperties = targetObject.properties;
58
- } else {
59
- targetProperty = key;
60
- }
61
- } else if (
62
- !preserveName &&
63
- (attrDef.preserveName === true || attrDef.removeDashes === false)
64
- ) {
65
- preserveName = true;
37
+ let targetProperty;
38
+
39
+ if (attrDef?.dynamicAttribute && attrDef.targetProperty) {
40
+ const key = attrDef.targetProperty;
41
+ let targetObject = targetObjects[key];
42
+
43
+ if (!targetObject) {
44
+ properties.push(
45
+ t.objectProperty(
46
+ t.stringLiteral(key),
47
+ (targetObject = targetObjects[key] = t.objectExpression([])),
48
+ ),
49
+ );
66
50
  }
67
- }
68
51
 
69
- if (!preserveName) {
70
- targetProperty = camelCase(targetProperty);
52
+ targetProperties = targetObject.properties;
53
+ targetProperty = keepsDashes(attrDef) ? name : camelCase(name);
54
+ } else {
55
+ targetProperty = getAttrProperty(attrDef, name, preserveNames);
71
56
  }
72
57
 
73
58
  foundProperties[targetProperty] = true;
@@ -79,7 +64,9 @@ export function getAttrs(path, preserveNames, isAttrTag) {
79
64
  }
80
65
  }
81
66
 
82
- if (childLen && !hasAttributeTags) {
67
+ // `attr-tag.js` › `i` stores a returned body as `renderBody`, so a Tags
68
+ // attribute tag keeps its body keyed even beside nested attribute tags.
69
+ if (childLen && (!hasAttributeTags || isTagsAttrTag)) {
83
70
  properties.push(
84
71
  t.objectProperty(
85
72
  t.stringLiteral(renderBodyKey),
@@ -92,26 +79,22 @@ export function getAttrs(path, preserveNames, isAttrTag) {
92
79
  }
93
80
 
94
81
  // Default parameters
95
- tagDef &&
96
- tagDef.forEachAttribute &&
97
- tagDef.forEachAttribute((attr) => {
98
- if (foundProperties[attr.name] || attr.dynamicAttribute) {
99
- return;
100
- }
101
-
102
- if (attr.defaultValue !== undefined) {
103
- properties.push(
104
- t.objectProperty(
105
- t.stringLiteral(attr.name),
106
- t.stringLiteral(attr.defaultValue + ""),
107
- ),
108
- );
109
- } else if (attr.required) {
110
- throw path
111
- .get("name")
112
- .buildCodeFrameError(`The "${attr.name}" attribute is required.`);
82
+ if (tagDef?.attributes) {
83
+ for (const name in tagDef.attributes) {
84
+ const attr = tagDef.attributes[name];
85
+ if (attr.defaultValue !== undefined && !attr.dynamicAttribute) {
86
+ const property = getAttrProperty(attr, name, preserveNames);
87
+ if (!foundProperties[property]) {
88
+ properties.push(
89
+ t.objectProperty(
90
+ t.stringLiteral(property),
91
+ t.stringLiteral(attr.defaultValue + ""),
92
+ ),
93
+ );
94
+ }
113
95
  }
114
- });
96
+ }
97
+ }
115
98
 
116
99
  let attrsObject =
117
100
  properties.length === 0
@@ -126,7 +109,7 @@ export function getAttrs(path, preserveNames, isAttrTag) {
126
109
  if (hasAttributeTags) {
127
110
  let attrTagBody = attributeTags;
128
111
 
129
- if (body.length) {
112
+ if (body.length && !isTagsAttrTag) {
130
113
  attrTagBody = attrTagBody.concat(
131
114
  t.returnStatement(
132
115
  t.arrowFunctionExpression(
@@ -258,3 +241,34 @@ function findRootTag(tag) {
258
241
 
259
242
  return cur;
260
243
  }
244
+
245
+ // A declared attribute, else the `*` attribute, else one whose pattern matches.
246
+ function getAttrDef(tagDef, name) {
247
+ if (!tagDef) return;
248
+ const attr =
249
+ tagDef.attributes && (tagDef.attributes[name] || tagDef.attributes["*"]);
250
+ if (attr || !tagDef.patternAttributes) return attr;
251
+ for (const patternAttr of tagDef.patternAttributes) {
252
+ if (patternAttr.pattern.test(name)) return patternAttr;
253
+ }
254
+ }
255
+
256
+ // The input property an attribute is passed as: camelCased unless its name is
257
+ // kept, and renamed by a declared target property.
258
+ function getAttrProperty(attrDef, name, preserveNames) {
259
+ if (!attrDef) return preserveNames ? name : camelCase(name);
260
+ if (attrDef.targetProperty) {
261
+ return keepsDashes(attrDef)
262
+ ? attrDef.targetProperty
263
+ : camelCase(attrDef.targetProperty);
264
+ }
265
+ return preserveNames ||
266
+ attrDef.preserveName === true ||
267
+ attrDef.removeDashes === false
268
+ ? name
269
+ : camelCase(name);
270
+ }
271
+
272
+ function keepsDashes(attrDef) {
273
+ return attrDef.preserveName !== false && attrDef.removeDashes !== true;
274
+ }
@@ -28,16 +28,6 @@ export default {
28
28
  statement: true,
29
29
  rawOpenTag: true,
30
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
- ],
41
31
  },
42
32
  "<export>": {
43
33
  "node-factory": parseExport,
@@ -45,16 +35,6 @@ export default {
45
35
  statement: true,
46
36
  rawOpenTag: true,
47
37
  },
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
- ],
58
38
  },
59
39
  "<client>": {
60
40
  "node-factory": parseClient,
@@ -76,16 +56,6 @@ export default {
76
56
  statement: true,
77
57
  rawOpenTag: true,
78
58
  },
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
- ],
89
59
  },
90
60
  "<static>": {
91
61
  "node-factory": parseStatic,
@@ -93,15 +63,6 @@ export default {
93
63
  statement: true,
94
64
  rawOpenTag: true,
95
65
  },
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
- ],
105
66
  },
106
67
  "<style>": {
107
68
  transformer: transformStyle,
@@ -114,189 +75,45 @@ export default {
114
75
  "<macro>": {
115
76
  "node-factory": parseMacro,
116
77
  "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
- ],
133
78
  },
134
79
  "<include-text>": {
135
80
  "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
- ],
145
81
  },
146
82
  "<include-html>": {
147
83
  "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
- ],
157
84
  },
158
85
  "<if>": {
159
86
  "parse-options": { controlFlow: true },
160
87
  "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
- ],
170
88
  },
171
89
  "<else-if>": {
172
90
  "parse-options": { controlFlow: true },
173
91
  "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
- ],
184
92
  },
185
93
  "<else>": {
186
94
  "parse-options": { controlFlow: true },
187
95
  "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
- ],
197
96
  },
198
97
  "<for>": {
199
98
  "parse-options": { controlFlow: true },
200
99
  "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
- ],
262
100
  },
263
101
  "<while>": {
264
102
  "parse-options": { controlFlow: true },
265
103
  "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
- ],
274
104
  },
275
105
  "<html-comment>": {
276
106
  "code-generator": translateHTMLComment,
277
107
  "parse-options": {
278
108
  text: true,
279
109
  },
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
- ],
288
110
  },
289
111
  "<_preserve>": {
290
112
  renderer: "marko/src/core-tags/components/preserve-tag.js",
291
- "@n": "boolean",
292
- "@i": "boolean",
293
- "@b": "boolean",
294
- autocomplete: [],
295
113
  },
296
114
  "<init-components>": {
297
115
  "code-generator": translateServerOnly,
298
116
  renderer: "marko/src/core-tags/components/init-components-tag.js",
299
- "@immediate": "boolean",
300
117
  },
301
118
  "<_preferred-script-location>": {
302
119
  "code-generator": translateServerOnly,
@@ -306,92 +123,10 @@ export default {
306
123
  renderer: "marko/src/core-tags/core/await/renderer.js",
307
124
  types: "marko/src/core-tags/core/await/index.d.marko",
308
125
  "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
- ],
385
126
  },
386
127
  "<await-reorderer>": {
387
128
  "code-generator": translateServerOnly,
388
129
  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
- ],
395
130
  },
396
131
  "<__flush_here_and_after__>": {
397
132
  "code-generator": translateServerOnly,
@@ -406,88 +141,4 @@ export default {
406
141
  "<script>": {
407
142
  types: "marko/src/core-tags/core/script.d.marko",
408
143
  },
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
- },
493
144
  };
@@ -1,3 +1,2 @@
1
1
  export const HAS_SIMPLE_ATTRS = 1;
2
- export const IS_CUSTOM_ELEMENT = 2; // TODO: impl custom elements.
3
- export const SPREAD_ATTRS = 4; // TODO: impl custom elements.
2
+ export const SPREAD_ATTRS = 4;