xmlui 0.9.92 → 0.9.94

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 (45) hide show
  1. package/dist/lib/{index-C5eOg7bB.mjs → index-BRjPUpBp.mjs} +8930 -8672
  2. package/dist/lib/index.css +1 -1
  3. package/dist/lib/{initMock-DLD4GmW7.mjs → initMock-DqOvDfSZ.mjs} +1 -1
  4. package/dist/lib/language-server-web-worker.mjs +1 -1
  5. package/dist/lib/language-server.mjs +1 -1
  6. package/dist/lib/{metadata-utils-BE5_Lmoa.mjs → metadata-utils-PjrGUxZN.mjs} +1 -1
  7. package/dist/lib/{server-common-xCK0Af2K.mjs → server-common-BdwSpo3T.mjs} +4466 -4436
  8. package/dist/lib/{transform-bUuxPyao.mjs → transform-CDSgqN5L.mjs} +1240 -1202
  9. package/dist/lib/xmlui-parser.d.ts +3 -1
  10. package/dist/lib/xmlui-parser.mjs +2 -2
  11. package/dist/lib/{xmlui-serializer-BLFl30t9.mjs → xmlui-serializer-D6rtRMNI.mjs} +1 -1
  12. package/dist/lib/xmlui.d.ts +21 -13
  13. package/dist/lib/xmlui.mjs +2 -2
  14. package/dist/metadata/{collectedComponentMetadata-iKGyD6r3.mjs → collectedComponentMetadata-yBdEI1xB.mjs} +8819 -8524
  15. package/dist/metadata/{initMock-CZGAyfXr.mjs → initMock-BQykhNyQ.mjs} +1 -1
  16. package/dist/metadata/style.css +1 -1
  17. package/dist/metadata/xmlui-metadata.mjs +1 -1
  18. package/dist/metadata/xmlui-metadata.umd.js +118 -114
  19. package/dist/scripts/package.json +2 -1
  20. package/dist/scripts/src/components/AutoComplete/AutoComplete.js +5 -2
  21. package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +1 -2
  22. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +9 -12
  23. package/dist/scripts/src/components/Bookmark/Bookmark.js +1 -1
  24. package/dist/scripts/src/components/Option/Option.js +11 -11
  25. package/dist/scripts/src/components/Select/HiddenOption.js +2 -2
  26. package/dist/scripts/src/components/Select/Select.js +5 -9
  27. package/dist/scripts/src/components/Select/SelectNative.js +95 -45
  28. package/dist/scripts/src/components/SlotItem.js +1 -0
  29. package/dist/scripts/src/components/Spinner/SpinnerNative.js +3 -4
  30. package/dist/scripts/src/components/Tabs/TabContext.js +7 -7
  31. package/dist/scripts/src/components/Tabs/TabItem.js +17 -1
  32. package/dist/scripts/src/components/Tabs/TabItemNative.js +11 -9
  33. package/dist/scripts/src/components/Tabs/Tabs.js +17 -3
  34. package/dist/scripts/src/components/Tabs/TabsNative.js +50 -46
  35. package/dist/scripts/src/components/TextArea/TextArea.js +1 -2
  36. package/dist/scripts/src/components/Toggle/Toggle.js +34 -10
  37. package/dist/scripts/src/components/container-helpers.js +2 -1
  38. package/dist/scripts/src/components-core/rendering/ComponentWrapper.js +2 -1
  39. package/dist/scripts/src/components-core/xmlui-parser.js +365 -196
  40. package/dist/scripts/src/parsers/xmlui-parser/diagnostics.js +1 -1
  41. package/dist/scripts/src/parsers/xmlui-parser/parser.js +69 -1
  42. package/dist/standalone/xmlui-standalone.es.d.ts +25 -14
  43. package/dist/standalone/xmlui-standalone.umd.js +259 -255
  44. package/package.json +2 -1
  45. package/dist/scripts/src/abstractions/scripting/modules.js +0 -2
@@ -33,6 +33,18 @@ const RECOVER_CLOSE_TAG = [
33
33
  syntax_kind_1.SyntaxKind.CData,
34
34
  syntax_kind_1.SyntaxKind.Script,
35
35
  ];
36
+ const needsExtendedContext = [
37
+ diagnostics_1.ErrCodes.unexpectedCloseTag,
38
+ diagnostics_1.ErrCodes.expCloseStartWithName,
39
+ diagnostics_1.ErrCodes.expCloseStart,
40
+ diagnostics_1.ErrCodes.tagNameMismatch,
41
+ diagnostics_1.ErrCodes.expEnd,
42
+ diagnostics_1.ErrCodes.expTagName,
43
+ diagnostics_1.ErrCodes.expTagOpen,
44
+ diagnostics_1.ErrCodes.expEndOrClose,
45
+ diagnostics_1.ErrCodes.expTagNameAfterNamespace,
46
+ diagnostics_1.ErrCodes.expTagNameAfterCloseStart,
47
+ ];
36
48
  function createXmlUiParser(source) {
37
49
  return {
38
50
  parse: () => parseXmlUiMarkup(source),
@@ -319,23 +331,70 @@ function parseXmlUiMarkup(text) {
319
331
  attrNames.push({ name: attrName, ns: attrNs });
320
332
  }
321
333
  }
334
+ function getContextWithSurroundingLines(pos, end, surroundingContextLines) {
335
+ let newlinesFound;
336
+ let cursor;
337
+ let contextPos;
338
+ cursor = pos;
339
+ newlinesFound = 0;
340
+ while (cursor >= 0) {
341
+ if (text[cursor] === "\n") {
342
+ newlinesFound++;
343
+ if (newlinesFound > surroundingContextLines) {
344
+ break;
345
+ }
346
+ }
347
+ cursor--;
348
+ }
349
+ contextPos = cursor + 1;
350
+ let contextEnd;
351
+ cursor = end;
352
+ newlinesFound = 0;
353
+ while (cursor < text.length) {
354
+ if (text[cursor] === "\n") {
355
+ newlinesFound++;
356
+ if (newlinesFound > surroundingContextLines) {
357
+ break;
358
+ }
359
+ cursor++;
360
+ }
361
+ else if (text[cursor] === "\r" && text[cursor + 1] === "\n") {
362
+ newlinesFound++;
363
+ if (newlinesFound > surroundingContextLines) {
364
+ break;
365
+ }
366
+ cursor += 2;
367
+ }
368
+ else {
369
+ cursor++;
370
+ }
371
+ }
372
+ contextEnd = cursor;
373
+ return { contextPos, contextEnd };
374
+ }
322
375
  function error({ code, message, category }) {
323
376
  const { pos, end } = peek();
377
+ const { contextPos, contextEnd } = getContextWithSurroundingLines(pos, end, 1);
324
378
  errors.push({
325
379
  category,
326
380
  code,
327
381
  message,
328
382
  pos,
329
383
  end,
384
+ contextPos,
385
+ contextEnd,
330
386
  });
331
387
  }
332
388
  function errorAt({ code, message, category }, pos, end) {
389
+ const { contextPos, contextEnd } = getContextWithSurroundingLines(pos, end, 1);
333
390
  errors.push({
334
391
  category,
335
392
  code,
336
393
  message,
337
394
  pos,
338
395
  end,
396
+ contextPos,
397
+ contextEnd,
339
398
  });
340
399
  }
341
400
  /**
@@ -523,7 +582,16 @@ function parseXmlUiMarkup(text) {
523
582
  scanner.resetTokenState(badPrefixEnd);
524
583
  startNode();
525
584
  node.children.push(token);
526
- errorAt(err, pos, badPrefixEnd);
585
+ const { contextPos, contextEnd } = getContextWithSurroundingLines(pos, badPrefixEnd, 0);
586
+ errors.push({
587
+ category: err.category,
588
+ code: err.code,
589
+ message: err.message,
590
+ pos,
591
+ end: badPrefixEnd,
592
+ contextPos,
593
+ contextEnd,
594
+ });
527
595
  completeNode(syntax_kind_1.SyntaxKind.ErrorNode);
528
596
  errFromScanner = undefined;
529
597
  return collectToken(inContent);
@@ -637,6 +637,8 @@ declare interface Error_2 {
637
637
  readonly message: string;
638
638
  readonly pos: number;
639
639
  readonly end: number;
640
+ readonly contextPos: number;
641
+ readonly contextEnd: number;
640
642
  }
641
643
 
642
644
  /**
@@ -674,15 +676,14 @@ declare class ErrorBoundary extends default_2.Component<Props, State> {
674
676
  render(): string | number | boolean | Iterable<default_2.ReactNode> | JSX_2.Element;
675
677
  }
676
678
 
677
- declare interface ErrorWithLineColInfo extends Error_2 {
678
- line: number;
679
- col: number;
679
+ declare interface ErrorForDisplay extends Error_2 {
680
+ contextStartLine: number;
681
+ contextSource: string;
682
+ errPosLine: number;
683
+ errPosCol: number;
680
684
  }
681
685
 
682
- /** returns a component definition containing the errors.
683
- * It is a component and a compound component definition at the same time,
684
- * so that it can be used to render the errors for a compound component as well*/
685
- declare function errReportComponent(errors: ErrorWithLineColInfo[], fileName: number | string, compoundCompName: string | undefined): any;
686
+ declare function errReportComponent(errors: ErrorForDisplay[], fileName: number | string, compoundCompName: string | undefined): any;
686
687
 
687
688
  declare type Expression = UnaryExpression | BinaryExpression | SequenceExpression | ConditionalExpression | FunctionInvocationExpression | MemberAccessExpression | CalculatedMemberAccessExpression | Identifier | TemplateLiteralExpression | Literal | ArrayLiteral | ObjectLiteral | SpreadExpression | AssignmentExpression | NoArgExpression | ArrowExpression | PrefixOpExpression | PostfixOpExpression | ReactiveVarDeclaration | VarDeclaration | Destructure | ObjectDestructure | ArrayDestructure | SwitchCase;
688
689
 
@@ -1006,6 +1007,12 @@ declare interface ParentRenderContext {
1006
1007
  props?: Record<string, any>;
1007
1008
  }
1008
1009
 
1010
+ declare type ParserResult = {
1011
+ component: null | ComponentDef | CompoundComponentDef;
1012
+ errors: ErrorForDisplay[];
1013
+ erroneousCompoundComponentName?: string;
1014
+ };
1015
+
1009
1016
  /**
1010
1017
  * This function extracts CSS variables from the specified SCSS input. It uses a hack to convert the CSS input to JSON
1011
1018
  * and then calls a JSON parser to create the desired object.
@@ -1069,9 +1076,12 @@ declare type Props_2 = {
1069
1076
  };
1070
1077
 
1071
1078
  declare type Props_3 = {
1079
+ id?: string;
1072
1080
  activeTab?: number;
1073
1081
  orientation?: "horizontal" | "vertical";
1074
- tabRenderer?: (item: {
1082
+ headerRenderer?: (item: {
1083
+ id?: string;
1084
+ index: number;
1075
1085
  label: string;
1076
1086
  isActive: boolean;
1077
1087
  }) => ReactNode;
@@ -1351,9 +1361,12 @@ declare const standaloneExports: {
1351
1361
  getColor: typeof xmluiExports.getColor;
1352
1362
  TabItem: default_2.ForwardRefExoticComponent<Tab & default_2.RefAttributes<HTMLDivElement>>;
1353
1363
  Tabs: default_2.ForwardRefExoticComponent<{
1364
+ id?: string;
1354
1365
  activeTab?: number;
1355
1366
  orientation?: "horizontal" | "vertical";
1356
- tabRenderer?: (item: {
1367
+ headerRenderer?: (item: {
1368
+ id?: string;
1369
+ index: number;
1357
1370
  label: string;
1358
1371
  isActive: boolean;
1359
1372
  }) => default_2.ReactNode;
@@ -1622,7 +1635,9 @@ declare const T_VAR_STATEMENT: number;
1622
1635
  declare const T_WHILE_STATEMENT: number;
1623
1636
 
1624
1637
  declare type Tab = {
1638
+ id?: string;
1625
1639
  label: string;
1640
+ headerRenderer?: (contextVars: any) => ReactNode;
1626
1641
  children?: ReactNode;
1627
1642
  style?: CSSProperties;
1628
1643
  };
@@ -2096,11 +2111,7 @@ declare class XmlUiHelper {
2096
2111
  private addComponentList;
2097
2112
  }
2098
2113
 
2099
- declare function xmlUiMarkupToComponent(source: string, fileId?: string | number): {
2100
- component: null | ComponentDef | CompoundComponentDef;
2101
- errors: ErrorWithLineColInfo[];
2102
- erroneousCompoundComponentName?: string;
2103
- };
2114
+ declare function xmlUiMarkupToComponent(source: string, fileId?: string | number): ParserResult;
2104
2115
 
2105
2116
  declare type XmlUiNode = XmlUiComment | XmlUiAttribute | XmlUiElement;
2106
2117