xmlui 0.9.44 → 0.9.46

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 (42) hide show
  1. package/dist/lib/{index-ODN_c1bh.mjs → apiInterceptorWorker-D_OwtjcQ.mjs} +1920 -1362
  2. package/dist/lib/{index-Cc1nHN3N.mjs → index-_koqcHz7.mjs} +7673 -7530
  3. package/dist/lib/index.css +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-DI1nTN3y.mjs → metadata-utils-Cf8v_9Lr.mjs} +7 -7
  7. package/dist/lib/{server-common-C3t9MFME.mjs → server-common-kMTAr-QU.mjs} +210 -178
  8. package/dist/lib/{transform-BV--wKhF.mjs → transform-DU7v4c9h.mjs} +1193 -1158
  9. package/dist/lib/xmlui-parser.d.ts +10 -3
  10. package/dist/lib/xmlui-parser.mjs +31 -30
  11. package/dist/lib/{xmlui-serializer-D5UV-ftG.mjs → xmlui-serializer-B3OkRzrr.mjs} +9 -9
  12. package/dist/lib/xmlui.d.ts +37 -1
  13. package/dist/lib/xmlui.mjs +31 -29
  14. package/dist/metadata/style.css +1 -1
  15. package/dist/metadata/xmlui-metadata.mjs +4790 -4740
  16. package/dist/metadata/xmlui-metadata.umd.js +10 -10
  17. package/dist/scripts/package.json +2 -1
  18. package/dist/scripts/src/components/App/App.js +141 -27
  19. package/dist/scripts/src/components/App/AppNative.js +2 -1
  20. package/dist/scripts/src/components/App/IndexerContext.js +44 -0
  21. package/dist/scripts/src/components/App/SearchContext.js +35 -0
  22. package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -1
  23. package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +41 -44
  24. package/dist/scripts/src/components/CodeBlock/highlight-code.js +4 -1
  25. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +34 -2
  26. package/dist/scripts/src/components/Markdown/MarkdownNative.js +64 -28
  27. package/dist/scripts/src/components/NestedApp/NestedApp.js +4 -3
  28. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +61 -66
  29. package/dist/scripts/src/components/Select/Select.js +3 -3
  30. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +9 -1
  31. package/dist/scripts/src/components/Text/Text.js +1 -2
  32. package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
  33. package/dist/scripts/src/components/Theme/ThemeNative.js +5 -0
  34. package/dist/scripts/src/components-core/loader/DataLoader.js +9 -1
  35. package/dist/scripts/src/components-core/rendering/Container.js +7 -0
  36. package/dist/scripts/src/components-core/theming/themes/root.js +2 -2
  37. package/dist/scripts/src/parsers/xmlui-parser/diagnostics.js +10 -4
  38. package/dist/scripts/src/parsers/xmlui-parser/parser.js +74 -30
  39. package/dist/standalone/xmlui-standalone.es.d.ts +47 -2
  40. package/dist/standalone/xmlui-standalone.umd.js +217 -217
  41. package/package.json +2 -1
  42. package/dist/lib/apiInterceptorWorker-B62b9K2p.mjs +0 -563
@@ -116,43 +116,73 @@ function parseXmlUiMarkup(text) {
116
116
  function parseTag() {
117
117
  startNode();
118
118
  bump(syntax_kind_1.SyntaxKind.OpenNodeStart);
119
+ let errInName = false;
119
120
  let openTagName = undefined;
120
121
  if (at(syntax_kind_1.SyntaxKind.Identifier)) {
121
122
  openTagName = parseTagName();
122
123
  }
123
124
  else {
124
- error(diagnostics_1.Diag_Tag_Identifier_Expected);
125
- }
126
- parseAttrList();
127
- if (eat(syntax_kind_1.SyntaxKind.NodeClose)) {
128
- completeNode(syntax_kind_1.SyntaxKind.ElementNode);
129
- return;
130
- }
131
- else if (eat(syntax_kind_1.SyntaxKind.NodeEnd)) {
132
- parseContent();
133
- if (eat(syntax_kind_1.SyntaxKind.CloseNodeStart)) {
134
- if (at(syntax_kind_1.SyntaxKind.Identifier)) {
135
- const closeTagName = parseTagName();
136
- const namesMismatch = openTagName !== undefined && !(0, utils_1.tagNameNodesWithoutErrorsMatch)(openTagName, closeTagName, getText);
137
- if (namesMismatch) {
138
- error(MakeErr.tagNameMismatch(getText(openTagName), getText(closeTagName)));
139
- }
140
- }
141
- else {
142
- errRecover(diagnostics_1.Diag_Tag_Identifier_Expected, [syntax_kind_1.SyntaxKind.NodeEnd]);
143
- }
144
- if (!eat(syntax_kind_1.SyntaxKind.NodeEnd)) {
145
- error(diagnostics_1.Diag_End_Token_Expected);
125
+ errInName = true;
126
+ const errNode = errNodeUntil([syntax_kind_1.SyntaxKind.OpenNodeStart, syntax_kind_1.SyntaxKind.NodeEnd, syntax_kind_1.SyntaxKind.NodeClose, syntax_kind_1.SyntaxKind.CloseNodeStart, syntax_kind_1.SyntaxKind.CData, syntax_kind_1.SyntaxKind.Script]);
127
+ if (errNode) {
128
+ errorAt(diagnostics_1.Diag_Tag_Identifier_Expected, errNode.pos, errNode.end);
129
+ }
130
+ else {
131
+ error(diagnostics_1.Diag_Tag_Identifier_Expected);
132
+ }
133
+ }
134
+ if (!errInName) {
135
+ parseAttrList();
136
+ }
137
+ switch (peek().kind) {
138
+ case syntax_kind_1.SyntaxKind.NodeClose: {
139
+ bumpAny();
140
+ completeNode(syntax_kind_1.SyntaxKind.ElementNode);
141
+ return;
142
+ }
143
+ case syntax_kind_1.SyntaxKind.NodeEnd: {
144
+ bumpAny();
145
+ parseContent();
146
+ parseClosingTag(openTagName);
147
+ completeNode(syntax_kind_1.SyntaxKind.ElementNode);
148
+ return;
149
+ }
150
+ case syntax_kind_1.SyntaxKind.OpenNodeStart:
151
+ case syntax_kind_1.SyntaxKind.Script:
152
+ case syntax_kind_1.SyntaxKind.CData: {
153
+ completeNode(syntax_kind_1.SyntaxKind.ElementNode);
154
+ error(diagnostics_1.Diag_End_Or_Close_Token_Expected);
155
+ return;
156
+ }
157
+ case syntax_kind_1.SyntaxKind.CloseNodeStart: {
158
+ error(diagnostics_1.Diag_End_Or_Close_Token_Expected);
159
+ parseClosingTag(openTagName);
160
+ completeNode(syntax_kind_1.SyntaxKind.ElementNode);
161
+ return;
162
+ }
163
+ default: {
164
+ error(diagnostics_1.Diag_End_Or_Close_Token_Expected);
165
+ }
166
+ }
167
+ }
168
+ function parseClosingTag(openTagName) {
169
+ if (eat(syntax_kind_1.SyntaxKind.CloseNodeStart)) {
170
+ if (at(syntax_kind_1.SyntaxKind.Identifier)) {
171
+ const closeTagName = parseTagName();
172
+ const namesMismatch = openTagName !== undefined && !(0, utils_1.tagNameNodesWithoutErrorsMatch)(openTagName, closeTagName, getText);
173
+ if (namesMismatch) {
174
+ error(MakeErr.tagNameMismatch(getText(openTagName), getText(closeTagName)));
146
175
  }
147
176
  }
148
177
  else {
149
- error(diagnostics_1.Diag_CloseNodeStart_Token_Expected);
178
+ errRecover(diagnostics_1.Diag_Tag_Identifier_Expected, [syntax_kind_1.SyntaxKind.NodeEnd]);
179
+ }
180
+ if (!eat(syntax_kind_1.SyntaxKind.NodeEnd)) {
181
+ error(diagnostics_1.Diag_End_Token_Expected);
150
182
  }
151
- completeNode(syntax_kind_1.SyntaxKind.ElementNode);
152
- return;
153
183
  }
154
184
  else {
155
- error(diagnostics_1.Diag_End_Or_Close_Token_Expected);
185
+ error(diagnostics_1.Diag_CloseNodeStart_Token_Expected);
156
186
  }
157
187
  }
158
188
  function parseTagName() {
@@ -258,6 +288,17 @@ function parseXmlUiMarkup(text) {
258
288
  function atAnyOf(kinds) {
259
289
  return kinds.includes(peek().kind);
260
290
  }
291
+ function errNodeUntil(tokens) {
292
+ startNode();
293
+ advance(tokens);
294
+ if (node.children.length === 0) {
295
+ abandonNode();
296
+ return null;
297
+ }
298
+ else {
299
+ return completeNode(syntax_kind_1.SyntaxKind.ErrorNode);
300
+ }
301
+ }
261
302
  /**
262
303
  * report an error and skip the next token if it isn't in the recoveryTokens. EoF isn't skipped.
263
304
  * @param recoveryTokens the [FollowSet](https://www.geeksforgeeks.org/follow-set-in-syntax-analysis/) of the parsed InnerNode. These tokens (or the EoF token) won't be skipped
@@ -274,6 +315,10 @@ function parseXmlUiMarkup(text) {
274
315
  completeNode(syntax_kind_1.SyntaxKind.ErrorNode);
275
316
  return false;
276
317
  }
318
+ /** Bumps over the next token and marks it as an error node while adding an error to the error list*/
319
+ function errorAndBump(errCodeAndMsg) {
320
+ errRecover(errCodeAndMsg, []);
321
+ }
277
322
  function error({ code, message, category }) {
278
323
  const { pos, end } = peek();
279
324
  errors.push({
@@ -293,6 +338,9 @@ function parseXmlUiMarkup(text) {
293
338
  end,
294
339
  });
295
340
  }
341
+ function advance(to) {
342
+ for (let token = peek(); token.kind !== syntax_kind_1.SyntaxKind.EndOfFileToken && !to.includes(token.kind); bumpAny(), token = peek()) { }
343
+ }
296
344
  function peek(inContent = false) {
297
345
  if (peekedToken !== undefined) {
298
346
  return peekedToken;
@@ -482,10 +530,6 @@ function parseXmlUiMarkup(text) {
482
530
  }
483
531
  }
484
532
  }
485
- /** Bumps over the next token and marks it as an error node while adding an error to the error list*/
486
- function errorAndBump(errCodeAndMsg) {
487
- errRecover(errCodeAndMsg, []);
488
- }
489
533
  function abandonNode() {
490
534
  const parentNode = parents[parents.length - 1];
491
535
  parentNode.children.push(...node.children);
@@ -103,7 +103,9 @@ declare namespace all {
103
103
  VisuallyHidden,
104
104
  LinkNative,
105
105
  ToneChangerButton,
106
- Logo
106
+ Logo,
107
+ useSearchContextContent,
108
+ useAppLayoutContext
107
109
  }
108
110
  }
109
111
 
@@ -374,6 +376,10 @@ declare type AppContextObject = {
374
376
  forceRefreshAnchorScroll: () => void;
375
377
  };
376
378
 
379
+ declare const appLayoutNames: readonly ["vertical", "vertical-sticky", "vertical-full-header", "condensed", "condensed-sticky", "horizontal", "horizontal-sticky"];
380
+
381
+ declare type AppLayoutType = (typeof appLayoutNames)[number];
382
+
377
383
  /**
378
384
  * This component is responsible for running a pre-compiled xmlui app. It
379
385
  * receives the internal representation of the app markup and code (coming
@@ -974,6 +980,7 @@ declare const _default: {
974
980
  onDidChange?: (newValue: string) => void;
975
981
  onFocus?: () => void;
976
982
  onBlur?: () => void;
983
+ onKeyDown?: (event: default_2.KeyboardEvent<HTMLInputElement>) => void;
977
984
  registerComponentApi?: all.RegisterComponentApiFn;
978
985
  startText?: string;
979
986
  startIcon?: string;
@@ -1009,6 +1016,12 @@ declare const _default: {
1009
1016
  Logo: default_2.ForwardRefExoticComponent<{
1010
1017
  style?: default_2.CSSProperties;
1011
1018
  } & default_2.RefAttributes<HTMLImageElement>>;
1019
+ useSearchContextContent: () => Record<string, {
1020
+ path: string;
1021
+ title: string;
1022
+ content: string;
1023
+ }>;
1024
+ useAppLayoutContext: typeof all.useAppLayoutContext;
1012
1025
  };
1013
1026
  export default _default;
1014
1027
 
@@ -1079,7 +1092,7 @@ declare type EntrypointCompilation = CompilationUnit & {
1079
1092
  declare enum ErrCodes {
1080
1093
  onlyOneElem = "U002",
1081
1094
  expTagOpen = "U003",
1082
- expTagIdent = "U004",
1095
+ expTagName = "U004",
1083
1096
  expCloseStart = "U005",
1084
1097
  expEndOrClose = "U006",
1085
1098
  tagNameMismatch = "U007",
@@ -1089,6 +1102,7 @@ declare enum ErrCodes {
1089
1102
  expAttrValue = "U011",
1090
1103
  duplAttr = "U012",
1091
1104
  uppercaseAttr = "U013",
1105
+ tagNameExpAfterNamespace = "U014",
1092
1106
  invalidChar = "W001",
1093
1107
  untermStr = "W002",
1094
1108
  untermComment = "W007",
@@ -1271,6 +1285,26 @@ declare interface IApiInterceptorContext {
1271
1285
  isMocked: (url: string) => boolean;
1272
1286
  }
1273
1287
 
1288
+ declare interface IAppLayoutContext {
1289
+ layout: AppLayoutType;
1290
+ navPanelVisible: boolean;
1291
+ drawerVisible: boolean;
1292
+ showDrawer: () => void;
1293
+ hideDrawer: () => void;
1294
+ toggleDrawer: () => void;
1295
+ hasRegisteredNavPanel: boolean;
1296
+ hasRegisteredHeader: boolean;
1297
+ navPanelDef?: ComponentDef;
1298
+ logoContentDef?: ComponentDef;
1299
+ logo?: string;
1300
+ logoDark?: string;
1301
+ logoLight?: string;
1302
+ registerSubNavPanelSlot?: (slot: HTMLElement) => void;
1303
+ subNavPanelSlot?: HTMLElement;
1304
+ scrollWholePage?: boolean;
1305
+ isFullVerticalWidth?: boolean;
1306
+ }
1307
+
1274
1308
  declare const Icon: default_2.ForwardRefExoticComponent<IconBaseProps & default_2.RefAttributes<unknown>>;
1275
1309
 
1276
1310
  declare interface IconBaseProps extends default_2.SVGAttributes<SVGElement> {
@@ -1617,6 +1651,7 @@ declare type Props_4 = {
1617
1651
  onDidChange?: (newValue: string) => void;
1618
1652
  onFocus?: () => void;
1619
1653
  onBlur?: () => void;
1654
+ onKeyDown?: (event: default_2.KeyboardEvent<HTMLInputElement>) => void;
1620
1655
  registerComponentApi?: RegisterComponentApiFn;
1621
1656
  startText?: string;
1622
1657
  startIcon?: string;
@@ -1740,6 +1775,12 @@ declare interface ScriptParserErrorMessage {
1740
1775
 
1741
1776
  declare type ScriptParsingErrorCodes = "W001" | "W002" | "W003" | "W004" | "W005" | "W006" | "W007" | "W008" | "W009" | "W010" | "W011" | "W012" | "W013" | "W014" | "W015" | "W016" | "W017" | "W018" | "W019" | "W020" | "W021" | "W022" | "W023" | "W024" | "W025" | "W026" | "W027" | "W028" | "W029" | "W030" | "W031";
1742
1777
 
1778
+ declare type SearchEntry = {
1779
+ path: string;
1780
+ title: string;
1781
+ content: string;
1782
+ };
1783
+
1743
1784
  declare type SEQUENCE_EXPRESSION = typeof T_SEQUENCE_EXPRESSION;
1744
1785
 
1745
1786
  declare interface SequenceExpression extends ExpressionBase {
@@ -2284,6 +2325,8 @@ declare type UnaryOpSymbols = "+" | "-" | "~" | "!" | "typeof" | "delete";
2284
2325
  */
2285
2326
  declare type UpdateStateFn = (componentState: any, options?: any) => void;
2286
2327
 
2328
+ declare function useAppLayoutContext(): IAppLayoutContext;
2329
+
2287
2330
  declare function useColors(...colorNames: (string | ColorDef)[]): Record<string, string>;
2288
2331
 
2289
2332
  declare function useDevTools(): {
@@ -2301,6 +2344,8 @@ declare function useDevTools(): {
2301
2344
 
2302
2345
  declare const useLogger: () => LogContextType;
2303
2346
 
2347
+ declare const useSearchContextContent: () => Record<string, SearchEntry>;
2348
+
2304
2349
  declare function useTheme(): ThemeScope;
2305
2350
 
2306
2351
  declare type ValidationStatus = (typeof validationStatusValues)[number];