xmlui 0.5.0 → 0.5.2-beta.2

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.
@@ -23,6 +23,7 @@ const start = (_a) => __awaiter(void 0, [_a], void 0, function* ({ port, withMoc
23
23
  }, define: {
24
24
  'process.env.VITE_BUILD_MODE': JSON.stringify("ALL"),
25
25
  'process.env.VITE_DEV_MODE': true,
26
+ 'process.env.VITE_STANDALONE': process.env.VITE_STANDALONE,
26
27
  'process.env.VITE_MOCK_ENABLED': withMock,
27
28
  "process.env.VITE_INCLUDE_ALL_COMPONENTS": JSON.stringify("true"),
28
29
  "process.env.VITE_LEGACY_PARSER": withLegacyParser,
@@ -595,6 +595,9 @@ function visitNode(subject, state, stmtVisitor, exprVisitor, parent, tag) {
595
595
  state = (exprVisitor === null || exprVisitor === void 0 ? void 0 : exprVisitor(false, subject, state, parent, tag)) || state;
596
596
  return state;
597
597
  }
598
+ case "TempLitE":
599
+ // TODO: Implement this
600
+ return state;
598
601
  default:
599
602
  unreachable(subject);
600
603
  return state;
@@ -404,7 +404,7 @@ function parseXmlUiMarkup(text) {
404
404
  if (errFromScanner !== undefined) {
405
405
  let err;
406
406
  if (errFromScanner.message.code === diagnostics_1.ErrCodes.invalidChar) {
407
- err = MakeErr.invalidChar(scanner.getText());
407
+ err = MakeErr.invalidChar(scanner.getTokenText());
408
408
  }
409
409
  else {
410
410
  err = errFromScanner.message;
@@ -52,9 +52,9 @@ function nodeToComponentDef(node, originalGetText, fileId, moduleResolver = () =
52
52
  reportError("T004");
53
53
  return null;
54
54
  }
55
- // --- Get "api" attributes
55
+ // --- Get "method" attributes
56
56
  let api;
57
- const apiAttrs = attrs.filter((attr) => attr.startSegment === "api");
57
+ const apiAttrs = attrs.filter((attr) => refersToApi(attr.startSegment));
58
58
  if (apiAttrs.length > 0) {
59
59
  api = {};
60
60
  apiAttrs.forEach((attr) => {
@@ -216,7 +216,6 @@ function nodeToComponentDef(node, originalGetText, fileId, moduleResolver = () =
216
216
  // --- Element with a lowercase start letter, it must be some traits of the host component
217
217
  switch (childName) {
218
218
  case "property":
219
- case "prop":
220
219
  collectElementHelper(usesStack, comp, child, (name) => { var _a; return (isComponent(comp) ? (_a = comp.props) === null || _a === void 0 ? void 0 : _a[name] : undefined); }, (name, value) => {
221
220
  var _a;
222
221
  if (!isComponent(comp))
@@ -253,7 +252,7 @@ function nodeToComponentDef(node, originalGetText, fileId, moduleResolver = () =
253
252
  case "uses":
254
253
  collectUsesElements(comp, child);
255
254
  return;
256
- case "api":
255
+ case "method":
257
256
  collectElementHelper(usesStack, comp, child, (name) => { var _a; return (isComponent(comp) ? (_a = comp.api) === null || _a === void 0 ? void 0 : _a[name] : undefined); }, (name, value) => {
258
257
  var _a;
259
258
  (_a = comp.api) !== null && _a !== void 0 ? _a : (comp.api = {});
@@ -296,7 +295,7 @@ function nodeToComponentDef(node, originalGetText, fileId, moduleResolver = () =
296
295
  const isCompound = !isComponent(comp);
297
296
  // --- Handle single-word attributes
298
297
  if (isCompound) {
299
- if (startSegment && startSegment !== "api" && startSegment !== "var") {
298
+ if (startSegment && !refersToApi(startSegment) && startSegment !== "var") {
300
299
  reportError("T021");
301
300
  return;
302
301
  }
@@ -331,7 +330,7 @@ function nodeToComponentDef(node, originalGetText, fileId, moduleResolver = () =
331
330
  (_a = comp.vars) !== null && _a !== void 0 ? _a : (comp.vars = {});
332
331
  comp.vars[name] = value;
333
332
  }
334
- else if (startSegment === "api") {
333
+ else if (refersToApi(startSegment)) {
335
334
  (_b = comp.api) !== null && _b !== void 0 ? _b : (comp.api = {});
336
335
  comp.api[name] = value;
337
336
  }
@@ -590,8 +589,8 @@ function nodeToComponentDef(node, originalGetText, fileId, moduleResolver = () =
590
589
  const childNodes = getChildNodes(node);
591
590
  const tagName = getTagName(node);
592
591
  const hasComponentName = exports.UCRegex.test(tagName);
593
- const shouldUseTextNodeElement = hasComponentName || tagName === "prop" || tagName === "property";
594
- const shouldCollapseWhitespace = tagName !== "event" && tagName !== "api";
592
+ const shouldUseTextNodeElement = hasComponentName || tagName === "property";
593
+ const shouldCollapseWhitespace = tagName !== "event" && !refersToApi(tagName);
595
594
  const attrs = getAttributes(node);
596
595
  desugarKeyOnlyAttrs(attrs);
597
596
  desugarQuotelessAttrs(attrs, getText);
@@ -975,3 +974,8 @@ function desugarQuotelessAttrs(attrs, getText) {
975
974
  }
976
975
  }
977
976
  }
977
+ /** Temporarily using 'method' as an alias to 'api'.
978
+ * In the future, 'api' may be completely removed.*/
979
+ function refersToApi(word) {
980
+ return word === "method";
981
+ }