xmlui 0.8.6 → 0.9.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 (106) hide show
  1. package/dist/{apiInterceptorWorker-fLBfPj2T.mjs → apiInterceptorWorker-B1u6prJM.mjs} +1 -1
  2. package/dist/{index-wd8FRzuM.mjs → index-CVvazA5D.mjs} +5849 -6109
  3. package/dist/index.css +274 -301
  4. package/dist/language-server.mjs +25 -1
  5. package/dist/{lint-B18Ko6Sy.mjs → lint-gX2osbkz.mjs} +920 -1120
  6. package/dist/scripts/bin/build.js +2 -2
  7. package/dist/scripts/bin/start.js +3 -9
  8. package/dist/scripts/bin/vite-xmlui-plugin.js +2 -2
  9. package/dist/scripts/bin/viteConfig.js +89 -63
  10. package/dist/scripts/src/abstractions/scripting/ScriptingSourceTreeExp.js +1 -2
  11. package/dist/scripts/src/components/Accordion/Accordion.js +6 -16
  12. package/dist/scripts/src/components/App/AppNative.js +8 -0
  13. package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -5
  14. package/dist/scripts/src/components/AppHeader/AppHeaderNative.js +10 -4
  15. package/dist/scripts/src/components/AutoComplete/AutoComplete.js +13 -19
  16. package/dist/scripts/src/components/AutoComplete/AutoCompleteContext.js +2 -0
  17. package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +7 -3
  18. package/dist/scripts/src/components/Avatar/Avatar.js +2 -9
  19. package/dist/scripts/src/components/Badge/Badge.js +2 -8
  20. package/dist/scripts/src/components/Button/Button.js +28 -60
  21. package/dist/scripts/src/components/Card/Card.js +1 -6
  22. package/dist/scripts/src/components/Checkbox/Checkbox.js +4 -12
  23. package/dist/scripts/src/components/ComponentProvider.js +4 -0
  24. package/dist/scripts/src/components/DatePicker/DatePicker.js +3 -10
  25. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +1 -1
  26. package/dist/scripts/src/components/Form/Form.js +12 -28
  27. package/dist/scripts/src/components/Form/FormNative.js +9 -0
  28. package/dist/scripts/src/components/FormItem/HelperText.js +1 -1
  29. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +2 -2
  30. package/dist/scripts/src/components/Heading/HeadingNative.js +0 -1
  31. package/dist/scripts/src/components/HtmlTags/HtmlTags.js +4 -19
  32. package/dist/scripts/src/components/IconProvider.js +2 -2
  33. package/dist/scripts/src/components/Link/Link.js +2 -8
  34. package/dist/scripts/src/components/Markdown/MarkdownNative.js +4 -4
  35. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +1 -3
  36. package/dist/scripts/src/components/NavGroup/NavGroup.js +34 -3
  37. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +24 -12
  38. package/dist/scripts/src/components/NavLink/NavLink.js +4 -11
  39. package/dist/scripts/src/components/NavPanel/NavPanel.js +1 -6
  40. package/dist/scripts/src/components/ProgressBar/ProgressBar.js +2 -8
  41. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +4 -12
  42. package/dist/scripts/src/components/Select/Select.js +5 -13
  43. package/dist/scripts/src/components/Select/SelectNative.js +7 -3
  44. package/dist/scripts/src/components/Slider/Slider.js +2 -8
  45. package/dist/scripts/src/components/Spinner/Spinner.js +1 -6
  46. package/dist/scripts/src/components/SubNavPanel/SubNavPanel.js +22 -0
  47. package/dist/scripts/src/components/SubNavPanel/SubNavPanelNative.js +9 -0
  48. package/dist/scripts/src/components/Switch/Switch.js +6 -16
  49. package/dist/scripts/src/components/Table/Table.js +8 -17
  50. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +4 -12
  51. package/dist/scripts/src/components/Tabs/Tabs.js +3 -10
  52. package/dist/scripts/src/components/Text/Text.js +10 -24
  53. package/dist/scripts/src/components/TextBox/TextBoxNative.js +1 -1
  54. package/dist/scripts/src/components/Theme/ThemeNative.js +1 -1
  55. package/dist/scripts/src/components/ValidationSummary/ValidationSummary.js +3 -3
  56. package/dist/scripts/src/components-core/DevTools.js +5 -4
  57. package/dist/scripts/src/components-core/RestApiProxy.js +7 -3
  58. package/dist/scripts/src/components-core/action/APICall.js +2 -1
  59. package/dist/scripts/src/components-core/rendering/Container.js +15 -11
  60. package/dist/scripts/src/components-core/rendering/StateContainer.js +3 -2
  61. package/dist/scripts/src/components-core/script-runner/BindingTreeEvaluationContext.js +0 -2
  62. package/dist/scripts/src/components-core/script-runner/ParameterParser.js +1 -1
  63. package/dist/scripts/src/components-core/script-runner/asyncProxy.js +11 -64
  64. package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +177 -175
  65. package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +173 -231
  66. package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +129 -100
  67. package/dist/scripts/src/components-core/script-runner/process-statement-async.js +170 -175
  68. package/dist/scripts/src/components-core/script-runner/process-statement-common.js +48 -33
  69. package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +164 -170
  70. package/dist/scripts/src/components-core/script-runner/statement-queue.js +5 -4
  71. package/dist/scripts/src/components-core/script-runner/visitors.js +124 -116
  72. package/dist/scripts/src/components-core/theming/themes/palette.js +1 -0
  73. package/dist/scripts/src/components-core/theming/themes/root.js +300 -154
  74. package/dist/scripts/src/components-core/theming/themes/theme-colors.js +510 -510
  75. package/dist/scripts/src/components-core/theming/themes/xmlui.js +0 -1
  76. package/dist/scripts/src/components-core/theming/transformThemeVars.js +11 -11
  77. package/dist/scripts/src/components-core/utils/misc.js +13 -0
  78. package/dist/scripts/src/components-core/utils/statementUtils.js +56 -53
  79. package/dist/scripts/src/components-core/xmlui-parser.js +1 -1
  80. package/dist/scripts/src/parsers/scripting-exp/Lexer.js +1092 -0
  81. package/dist/scripts/src/parsers/scripting-exp/Parser.js +2635 -0
  82. package/dist/scripts/src/parsers/scripting-exp/ParserError.js +47 -0
  83. package/dist/scripts/src/parsers/scripting-exp/TokenTrait.js +109 -0
  84. package/dist/scripts/src/parsers/scripting-exp/TokenType.js +2 -4
  85. package/dist/scripts/src/parsers/scripting-exp/code-behind-collect.js +101 -0
  86. package/dist/scripts/src/parsers/scripting-exp/modules.js +107 -0
  87. package/dist/scripts/src/parsers/{scripting → scripting-exp}/tree-visitor.js +103 -107
  88. package/dist/scripts/src/parsers/xmlui-parser/transform.js +12 -12
  89. package/dist/style.css +245 -286
  90. package/dist/xmlui-metadata.mjs +2741 -2211
  91. package/dist/xmlui-metadata.umd.js +2740 -2212
  92. package/dist/xmlui-parser.d.ts +320 -232
  93. package/dist/xmlui-parser.mjs +19 -19
  94. package/dist/xmlui-standalone.umd.js +6754 -7220
  95. package/dist/xmlui.d.ts +322 -230
  96. package/dist/xmlui.mjs +1 -1
  97. package/package.json +10 -6
  98. package/dist/_commonjsHelpers-CcAunmGO.mjs +0 -33
  99. package/dist/scripts/src/components-core/script-runner/ICustomOperations.js +0 -34
  100. package/dist/scripts/src/components-core/script-runner/custom-operations-registry.js +0 -40
  101. package/dist/scripts/src/components-core/script-runner/custom-ui-data.js +0 -40
  102. package/dist/scripts/src/components-core/script-runner/syncProxy.js +0 -31
  103. package/dist/scripts/src/parsers/scripting/code-behind-collect.js +0 -153
  104. package/dist/scripts/src/parsers/scripting/modules.js +0 -284
  105. /package/dist/scripts/src/abstractions/scripting/{LogicalThread.js → LogicalThreadExp.js} +0 -0
  106. /package/dist/scripts/src/abstractions/scripting/{TryScope.js → TryScopeExp.js} +0 -0
@@ -5,6 +5,9 @@ exports.innermostBlockScope = innermostBlockScope;
5
5
  exports.innermostTryScope = innermostTryScope;
6
6
  exports.createLoopScope = createLoopScope;
7
7
  exports.releaseLoopScope = releaseLoopScope;
8
+ exports.toStatementItems = toStatementItems;
9
+ exports.guard = guard;
10
+ exports.closing = closing;
8
11
  exports.provideLoopBody = provideLoopBody;
9
12
  exports.createTryScope = createTryScope;
10
13
  exports.provideTryBody = provideTryBody;
@@ -13,8 +16,10 @@ exports.provideFinallyBody = provideFinallyBody;
13
16
  exports.provideFinallyErrorBody = provideFinallyErrorBody;
14
17
  exports.ensureMainThread = ensureMainThread;
15
18
  exports.hoistFunctionDeclarations = hoistFunctionDeclarations;
16
- const modules_1 = require("../../parsers/scripting/modules");
19
+ const ScriptingSourceTreeExp_1 = require("../../abstractions/scripting/ScriptingSourceTreeExp");
20
+ const eval_tree_common_1 = require("./eval-tree-common");
17
21
  const statement_queue_1 = require("./statement-queue");
22
+ const Parser_1 = require("../../parsers/scripting-exp/Parser");
18
23
  function innermostLoopScope(thread) {
19
24
  if (!thread.loops || thread.loops.length === 0) {
20
25
  throw new Error("Missing loop scope");
@@ -54,14 +59,31 @@ function releaseLoopScope(thread, skipContinuation = true) {
54
59
  (_a = thread.loops) === null || _a === void 0 ? void 0 : _a.pop();
55
60
  }
56
61
  if (thread.blocks) {
57
- thread.blocks.length = skipContinuation ? loopScope.breakBlockDepth : loopScope.continueBlockDepth;
62
+ thread.blocks.length = skipContinuation
63
+ ? loopScope.breakBlockDepth
64
+ : loopScope.continueBlockDepth;
58
65
  }
59
66
  }
67
+ // --- Converts statement to queable items
68
+ function toStatementItems(statements) {
69
+ return statements.map((s) => ({ statement: s }));
70
+ }
71
+ // --- Create a guarded statement for the specified one
72
+ function guard(statement) {
73
+ return { statement, execInfo: { guard: true } };
74
+ }
75
+ // --- Create a closing statement that removes the block scope
76
+ function closing() {
77
+ return {
78
+ statement: { type: ScriptingSourceTreeExp_1.T_EMPTY_STATEMENT, nodeId: (0, Parser_1.createXmlUiTreeNodeId)() },
79
+ execInfo: { removeBlockScope: true },
80
+ };
81
+ }
60
82
  // --- Create a list of body statements according to the specified loop statement and scope
61
83
  function provideLoopBody(loopScope, loopStatement, breakLabelValue) {
62
84
  // --- Stay in the loop, add the body and the guard condition
63
- const guardStatement = Object.assign(Object.assign({}, loopStatement), { guard: true });
64
- const toUnshift = (0, statement_queue_1.mapStatementsToQueueItems)([loopStatement.body, guardStatement]);
85
+ const guardStatement = guard(loopStatement);
86
+ const toUnshift = (0, statement_queue_1.mapStatementsToQueueItems)([{ statement: loopStatement.body }, guardStatement]);
65
87
  // --- The next queue label is for "break"
66
88
  loopScope.breakLabel = breakLabelValue !== null && breakLabelValue !== void 0 ? breakLabelValue : -1;
67
89
  // --- The guard action's label is for "continue"
@@ -83,54 +105,47 @@ function createTryScope(thread, tryStatement) {
83
105
  // --- Provide a body for the try block
84
106
  function provideTryBody(thread, tryScope) {
85
107
  // --- Stay in the error handling block, add the body and the guard condition
86
- const guardStatement = Object.assign(Object.assign({}, tryScope.statement), { guard: true });
108
+ const guardStatement = guard(tryScope.statement);
87
109
  // --- New block scope for try
88
110
  thread.blocks.push({
89
111
  vars: {},
90
112
  });
91
- // --- Prepare an empty statement that will only remove the block scope when the entire block is processed
92
- const closing = {
93
- type: "EmptyS",
94
- removeBlockScope: true,
95
- }; // --- We need the cast as we do not provide required props
96
- const toUnshift = (0, statement_queue_1.mapStatementsToQueueItems)([...tryScope.statement.tryBlock.statements, closing, guardStatement]);
113
+ const toUnshift = (0, statement_queue_1.mapStatementsToQueueItems)([
114
+ ...toStatementItems(tryScope.statement.tryB.stmts),
115
+ closing(),
116
+ guardStatement,
117
+ ]);
97
118
  tryScope.tryLabel = toUnshift[toUnshift.length - 1].label;
98
119
  return toUnshift;
99
120
  }
100
121
  // --- Provide a body for the catch block
101
122
  function provideCatchBody(thread, tryScope) {
102
123
  // --- Stay in the error handling block, add the body and the guard condition
103
- const guardStatement = Object.assign(Object.assign({}, tryScope.statement), { guard: true });
124
+ const guardStatement = guard(tryScope.statement);
104
125
  // --- New block scope for catch
105
126
  thread.blocks.push({
106
127
  vars: {},
107
128
  });
108
- // --- Prepare an empty statement that will only remove the block scope when the entire block is processed
109
- const closing = {
110
- type: "EmptyS",
111
- removeBlockScope: true,
112
- }; // --- We need the cast as we do not provide required props
113
- const toUnshift = (0, statement_queue_1.mapStatementsToQueueItems)([...tryScope.statement.catchBlock.statements, closing, guardStatement]);
129
+ const toUnshift = (0, statement_queue_1.mapStatementsToQueueItems)([
130
+ ...toStatementItems(tryScope.statement.catchB.stmts),
131
+ closing(),
132
+ guardStatement,
133
+ ]);
114
134
  tryScope.tryLabel = toUnshift[toUnshift.length - 1].label;
115
135
  return toUnshift;
116
136
  }
117
137
  // --- Provide a body for the finally block
118
138
  function provideFinallyBody(thread, tryScope) {
119
139
  // --- Stay in the error handling block, add the body and the guard condition
120
- const guardStatement = Object.assign(Object.assign({}, tryScope.statement), { guard: true });
140
+ const guardStatement = guard(tryScope.statement);
121
141
  // --- New block scope for finally
122
142
  thread.blocks.push({
123
143
  vars: {},
124
144
  });
125
- // --- Prepare an empty statement that will only remove the block scope when the entire block is processed
126
- const closing = {
127
- type: "EmptyS",
128
- removeBlockScope: true,
129
- }; // --- We need the cast as we do not provide required props
130
- const finallyBlock = tryScope.statement.finallyBlock;
145
+ const finallyBlock = tryScope.statement.finallyB;
131
146
  const toUnshift = (0, statement_queue_1.mapStatementsToQueueItems)([
132
- ...(finallyBlock ? finallyBlock.statements : []),
133
- closing,
147
+ ...toStatementItems(finallyBlock ? finallyBlock.stmts : []),
148
+ closing(),
134
149
  guardStatement,
135
150
  ]);
136
151
  tryScope.tryLabel = toUnshift[toUnshift.length - 1].label;
@@ -139,7 +154,7 @@ function provideFinallyBody(thread, tryScope) {
139
154
  // --- Provide a body for the error block in finally
140
155
  function provideFinallyErrorBody(tryScope) {
141
156
  // --- Stay in the error handling block, add the body and the guard condition
142
- const guardStatement = Object.assign(Object.assign({}, tryScope.statement), { guard: true });
157
+ const guardStatement = guard(tryScope.statement);
143
158
  const toUnshift = (0, statement_queue_1.mapStatementsToQueueItems)([guardStatement]);
144
159
  tryScope.tryLabel = toUnshift[0].label;
145
160
  return toUnshift;
@@ -167,21 +182,21 @@ function hoistFunctionDeclarations(thread, statements) {
167
182
  throw new Error("Missing block scope");
168
183
  }
169
184
  statements
170
- .filter((stmt) => stmt.type === "FuncD")
185
+ .filter((stmt) => stmt.type === ScriptingSourceTreeExp_1.T_FUNCTION_DECLARATION)
171
186
  .forEach((stmt) => {
172
187
  var _a;
173
188
  const funcDecl = stmt;
174
189
  // --- Turn the function into an arrow expression
175
190
  const arrowExpression = {
176
- type: "ArrowE",
191
+ type: ScriptingSourceTreeExp_1.T_ARROW_EXPRESSION,
177
192
  args: funcDecl.args,
178
- statement: funcDecl.statement,
179
- closureContext: (0, modules_1.obtainClosures)(thread),
193
+ statement: funcDecl.stmt,
194
+ closureContext: (0, eval_tree_common_1.obtainClosures)(thread),
180
195
  _ARROW_EXPR_: true,
181
196
  };
182
197
  // --- Remove the functions from the closure list
183
198
  // --- Check name uniqueness
184
- const id = funcDecl.name;
199
+ const id = funcDecl.id.name;
185
200
  if (block.vars[id]) {
186
201
  throw new Error(`Variable ${id} is already declared in the current scope.`);
187
202
  }