xmlui 0.9.1 → 0.9.3
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.
- package/dist/{apiInterceptorWorker-230V_-Ds.mjs → apiInterceptorWorker-Y5MxQ95G.mjs} +1 -1
- package/dist/{core-XLM8cuFP.mjs → core-DowI-7YH.mjs} +2 -52
- package/dist/{index-DUwwx3L4.mjs → index-DHAz4bv_.mjs} +14904 -1512
- package/dist/index.css +309 -233
- package/dist/scripts/bin/vite-xmlui-plugin.js +1 -1
- package/dist/scripts/src/abstractions/scripting/ScriptingSourceTree.js +48 -0
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +11 -1
- package/dist/scripts/src/components/Markdown/Markdown.js +17 -13
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +40 -21
- package/dist/scripts/src/components/Slider/Slider.js +25 -6
- package/dist/scripts/src/components/Slider/SliderNative.js +78 -18
- package/dist/scripts/src/components/Theme/ThemeNative.js +1 -1
- package/dist/scripts/src/components-core/InspectorContext.js +1 -1
- package/dist/scripts/src/components-core/RestApiProxy.js +21 -11
- package/dist/scripts/src/components-core/{DevTools.js → devtools/DevTools.js} +71 -10
- package/dist/scripts/src/components-core/rendering/Container.js +3 -3
- package/dist/scripts/src/components-core/rendering/StateContainer.js +3 -3
- package/dist/scripts/src/components-core/script-runner/ParameterParser.js +1 -1
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +37 -37
- package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +8 -8
- package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +37 -37
- package/dist/scripts/src/components-core/script-runner/process-statement-async.js +29 -29
- package/dist/scripts/src/components-core/script-runner/process-statement-common.js +5 -5
- package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +29 -29
- package/dist/scripts/src/components-core/script-runner/visitors.js +47 -47
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +2 -2
- package/dist/scripts/src/components-core/theming/themes/root.js +1 -1
- package/dist/scripts/src/components-core/utils/statementUtils.js +32 -32
- package/dist/scripts/src/parsers/scripting/Lexer.js +166 -178
- package/dist/scripts/src/parsers/scripting/Parser.js +555 -701
- package/dist/scripts/src/parsers/scripting/ParserError.js +3 -3
- package/dist/scripts/src/parsers/scripting/TokenTrait.js +103 -105
- package/dist/scripts/src/parsers/{scripting-exp → scripting}/code-behind-collect.js +4 -4
- package/dist/scripts/src/parsers/{scripting-exp → scripting}/modules.js +2 -2
- package/dist/scripts/src/parsers/{scripting-exp → scripting}/tree-visitor.js +45 -45
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +2 -2
- package/dist/scripts/src/syntax/monaco/grammar.monacoLanguage.js +286 -0
- package/dist/scripts/src/syntax/monaco/xmlui-dark.js +27 -0
- package/dist/scripts/src/syntax/monaco/xmlui-light.js +26 -0
- package/dist/scripts/src/syntax/monaco/xmluiscript.monacoLanguage.js +310 -0
- package/dist/style.css +222 -152
- package/dist/xmlui-metadata.mjs +307 -478
- package/dist/xmlui-metadata.umd.js +309 -477
- package/dist/xmlui-parser.d.ts +1 -11
- package/dist/xmlui-standalone.umd.js +34047 -29191
- package/dist/xmlui.d.ts +2 -75
- package/dist/xmlui.mjs +10 -10
- package/package.json +5 -6
- package/dist/scripts/src/abstractions/scripting/ScriptingSourceTreeExp.js +0 -50
- package/dist/scripts/src/abstractions/scripting/Token.js +0 -112
- package/dist/scripts/src/components-core/theming/abstractions.js +0 -11
- package/dist/scripts/src/parsers/scripting-exp/Lexer.js +0 -1092
- package/dist/scripts/src/parsers/scripting-exp/Parser.js +0 -2635
- package/dist/scripts/src/parsers/scripting-exp/ParserError.js +0 -47
- package/dist/scripts/src/parsers/scripting-exp/TokenTrait.js +0 -109
- /package/dist/scripts/src/abstractions/scripting/{LogicalThreadExp.js → LogicalThread.js} +0 -0
- /package/dist/scripts/src/parsers/{scripting-exp → scripting}/TokenType.js +0 -0
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.processStatementQueue = processStatementQueue;
|
|
4
4
|
exports.processDeclarations = processDeclarations;
|
|
5
|
-
const
|
|
5
|
+
const ScriptingSourceTree_1 = require("../../abstractions/scripting/ScriptingSourceTree");
|
|
6
6
|
const reportEngineError_1 = require("../reportEngineError");
|
|
7
7
|
const EngineError_1 = require("../EngineError");
|
|
8
8
|
const process_statement_common_1 = require("./process-statement-common");
|
|
9
9
|
const eval_tree_sync_1 = require("./eval-tree-sync");
|
|
10
10
|
const statement_queue_1 = require("./statement-queue");
|
|
11
|
-
const Parser_1 = require("../../parsers/scripting
|
|
11
|
+
const Parser_1 = require("../../parsers/scripting/Parser");
|
|
12
12
|
const SYNC_EVAL_TIMEOUT = 1000;
|
|
13
13
|
// --- Helper function to process the entire queue synchronously
|
|
14
14
|
function processStatementQueue(statements, evalContext, thread) {
|
|
@@ -115,18 +115,18 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
115
115
|
let clearToLabel;
|
|
116
116
|
// --- Process the statement according to its type
|
|
117
117
|
switch (statement.type) {
|
|
118
|
-
case
|
|
118
|
+
case ScriptingSourceTree_1.T_FUNCTION_DECLARATION:
|
|
119
119
|
// --- Function declarations are already hoisted, nothing to do
|
|
120
120
|
break;
|
|
121
|
-
case
|
|
121
|
+
case ScriptingSourceTree_1.T_VAR_STATEMENT:
|
|
122
122
|
if (thread !== evalContext.mainThread) {
|
|
123
123
|
throw new Error("'var' declarations are not allowed within functions");
|
|
124
124
|
}
|
|
125
125
|
break;
|
|
126
|
-
case
|
|
126
|
+
case ScriptingSourceTree_1.T_EMPTY_STATEMENT:
|
|
127
127
|
// --- Nothing to do
|
|
128
128
|
break;
|
|
129
|
-
case
|
|
129
|
+
case ScriptingSourceTree_1.T_BLOCK_STATEMENT:
|
|
130
130
|
// --- No statement, nothing to process
|
|
131
131
|
if (statement.stmts.length === 0)
|
|
132
132
|
break;
|
|
@@ -142,21 +142,21 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
142
142
|
(0, process_statement_common_1.closing)(),
|
|
143
143
|
]);
|
|
144
144
|
break;
|
|
145
|
-
case
|
|
145
|
+
case ScriptingSourceTree_1.T_EXPRESSION_STATEMENT:
|
|
146
146
|
// --- Just evaluate it
|
|
147
147
|
const statementValue = (0, eval_tree_sync_1.evalBinding)(statement.expr, evalContext, thread);
|
|
148
148
|
if (thread.blocks && thread.blocks.length !== 0) {
|
|
149
149
|
thread.blocks[thread.blocks.length - 1].returnValue = statementValue;
|
|
150
150
|
}
|
|
151
151
|
break;
|
|
152
|
-
case
|
|
152
|
+
case ScriptingSourceTree_1.T_ARROW_EXPRESSION_STATEMENT:
|
|
153
153
|
// --- Compile the arrow expression
|
|
154
154
|
const arrowFuncValue = (0, eval_tree_sync_1.executeArrowExpressionSync)(statement.expr, evalContext, thread, ...((_b = evalContext.eventArgs) !== null && _b !== void 0 ? _b : []));
|
|
155
155
|
if (thread.blocks && thread.blocks.length !== 0) {
|
|
156
156
|
thread.blocks[thread.blocks.length - 1].returnValue = arrowFuncValue;
|
|
157
157
|
}
|
|
158
158
|
break;
|
|
159
|
-
case
|
|
159
|
+
case ScriptingSourceTree_1.T_LET_STATEMENT: {
|
|
160
160
|
// --- Create a new variable in the innermost scope
|
|
161
161
|
const block = (0, process_statement_common_1.innermostBlockScope)(thread);
|
|
162
162
|
if (!block) {
|
|
@@ -165,7 +165,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
165
165
|
processDeclarations(block, evalContext, thread, statement.decls);
|
|
166
166
|
break;
|
|
167
167
|
}
|
|
168
|
-
case
|
|
168
|
+
case ScriptingSourceTree_1.T_CONST_STATEMENT: {
|
|
169
169
|
// --- Create a new variable in the innermost scope
|
|
170
170
|
const block = (0, process_statement_common_1.innermostBlockScope)(thread);
|
|
171
171
|
if (!block) {
|
|
@@ -174,7 +174,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
174
174
|
processDeclarations(block, evalContext, thread, statement.decls, true);
|
|
175
175
|
break;
|
|
176
176
|
}
|
|
177
|
-
case
|
|
177
|
+
case ScriptingSourceTree_1.T_IF_STATEMENT:
|
|
178
178
|
// --- Evaluate the condition
|
|
179
179
|
const condition = !!(0, eval_tree_sync_1.evalBinding)(statement.cond, evalContext, thread);
|
|
180
180
|
if (condition) {
|
|
@@ -184,7 +184,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
184
184
|
toUnshift = (0, statement_queue_1.mapToItem)(statement.elseB);
|
|
185
185
|
}
|
|
186
186
|
break;
|
|
187
|
-
case
|
|
187
|
+
case ScriptingSourceTree_1.T_RETURN_STATEMENT: {
|
|
188
188
|
// --- Check if return is valid here
|
|
189
189
|
let blockScope = (0, process_statement_common_1.innermostBlockScope)(thread);
|
|
190
190
|
if (blockScope === undefined) {
|
|
@@ -213,7 +213,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
213
213
|
}
|
|
214
214
|
break;
|
|
215
215
|
}
|
|
216
|
-
case
|
|
216
|
+
case ScriptingSourceTree_1.T_WHILE_STATEMENT: {
|
|
217
217
|
// --- Create or get the loop's scope (guard is falsy for the first execution)
|
|
218
218
|
let loopScope = execInfo.guard ? (0, process_statement_common_1.innermostLoopScope)(thread) : (0, process_statement_common_1.createLoopScope)(thread);
|
|
219
219
|
// --- Evaluate the loop condition
|
|
@@ -227,7 +227,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
227
227
|
}
|
|
228
228
|
break;
|
|
229
229
|
}
|
|
230
|
-
case
|
|
230
|
+
case ScriptingSourceTree_1.T_DO_WHILE_STATEMENT: {
|
|
231
231
|
if (!execInfo.guard) {
|
|
232
232
|
// --- First loop execution (do-while is a post-test loop)
|
|
233
233
|
toUnshift = (0, process_statement_common_1.provideLoopBody)((0, process_statement_common_1.createLoopScope)(thread), statement, thread.breakLabelValue);
|
|
@@ -244,7 +244,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
244
244
|
}
|
|
245
245
|
break;
|
|
246
246
|
}
|
|
247
|
-
case
|
|
247
|
+
case ScriptingSourceTree_1.T_CONTINUE_STATEMENT: {
|
|
248
248
|
// --- Search for the innermost non-switch loop scope, release the switch scopes
|
|
249
249
|
if (!thread.loops || thread.loops.length === 0) {
|
|
250
250
|
throw new Error("Missing loop scope");
|
|
@@ -276,7 +276,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
276
276
|
}
|
|
277
277
|
break;
|
|
278
278
|
}
|
|
279
|
-
case
|
|
279
|
+
case ScriptingSourceTree_1.T_BREAK_STATEMENT: {
|
|
280
280
|
const loopScope = (0, process_statement_common_1.innermostLoopScope)(thread);
|
|
281
281
|
if (loopScope === undefined) {
|
|
282
282
|
throw new Error("Missing loop scope");
|
|
@@ -303,7 +303,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
303
303
|
}
|
|
304
304
|
break;
|
|
305
305
|
}
|
|
306
|
-
case
|
|
306
|
+
case ScriptingSourceTree_1.T_FOR_STATEMENT:
|
|
307
307
|
if (!execInfo.guard) {
|
|
308
308
|
// --- Init the loop with a new scope
|
|
309
309
|
(0, process_statement_common_1.createLoopScope)(thread, 1);
|
|
@@ -328,7 +328,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
328
328
|
if (statement.upd) {
|
|
329
329
|
const updateStmt = {
|
|
330
330
|
statement: {
|
|
331
|
-
type:
|
|
331
|
+
type: ScriptingSourceTree_1.T_EXPRESSION_STATEMENT,
|
|
332
332
|
nodeId: (0, Parser_1.createXmlUiTreeNodeId)(),
|
|
333
333
|
expr: statement.upd,
|
|
334
334
|
},
|
|
@@ -356,7 +356,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
break;
|
|
359
|
-
case
|
|
359
|
+
case ScriptingSourceTree_1.T_FOR_IN_STATEMENT:
|
|
360
360
|
if (!execInfo.guard) {
|
|
361
361
|
// --- Get the object keys
|
|
362
362
|
const keyedObject = (0, eval_tree_sync_1.evalBinding)(statement.expr, evalContext, thread);
|
|
@@ -385,14 +385,14 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
385
385
|
switch (statement.varB) {
|
|
386
386
|
case "none": {
|
|
387
387
|
const assigmentExpr = {
|
|
388
|
-
type:
|
|
388
|
+
type: ScriptingSourceTree_1.T_ASSIGNMENT_EXPRESSION,
|
|
389
389
|
leftValue: {
|
|
390
|
-
type:
|
|
390
|
+
type: ScriptingSourceTree_1.T_IDENTIFIER,
|
|
391
391
|
name: statement.id.name,
|
|
392
392
|
},
|
|
393
393
|
op: "=",
|
|
394
394
|
expr: {
|
|
395
|
-
type:
|
|
395
|
+
type: ScriptingSourceTree_1.T_LITERAL,
|
|
396
396
|
value: propValue,
|
|
397
397
|
},
|
|
398
398
|
};
|
|
@@ -432,7 +432,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
break;
|
|
435
|
-
case
|
|
435
|
+
case ScriptingSourceTree_1.T_FOR_OF_STATEMENT:
|
|
436
436
|
if (!execInfo.guard) {
|
|
437
437
|
// --- Get the object keys
|
|
438
438
|
const iteratorObject = (0, eval_tree_sync_1.evalBinding)(statement.expr, evalContext, thread);
|
|
@@ -466,14 +466,14 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
466
466
|
switch (statement.varB) {
|
|
467
467
|
case "none": {
|
|
468
468
|
const assigmentExpr = {
|
|
469
|
-
type:
|
|
469
|
+
type: ScriptingSourceTree_1.T_ASSIGNMENT_EXPRESSION,
|
|
470
470
|
leftValue: {
|
|
471
|
-
type:
|
|
471
|
+
type: ScriptingSourceTree_1.T_IDENTIFIER,
|
|
472
472
|
name: statement.id.name,
|
|
473
473
|
},
|
|
474
474
|
op: "=",
|
|
475
475
|
expr: {
|
|
476
|
-
type:
|
|
476
|
+
type: ScriptingSourceTree_1.T_LITERAL,
|
|
477
477
|
value: propValue,
|
|
478
478
|
},
|
|
479
479
|
};
|
|
@@ -508,10 +508,10 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
508
508
|
loopScope.continueLabel = toUnshift[1].label;
|
|
509
509
|
}
|
|
510
510
|
break;
|
|
511
|
-
case
|
|
511
|
+
case ScriptingSourceTree_1.T_THROW_STATEMENT: {
|
|
512
512
|
throw new EngineError_1.ThrowStatementError((0, eval_tree_sync_1.evalBinding)(statement.expr, evalContext, thread));
|
|
513
513
|
}
|
|
514
|
-
case
|
|
514
|
+
case ScriptingSourceTree_1.T_TRY_STATEMENT: {
|
|
515
515
|
if (!execInfo.guard) {
|
|
516
516
|
// --- Execute the try block
|
|
517
517
|
toUnshift = (0, process_statement_common_1.provideTryBody)(thread, (0, process_statement_common_1.createTryScope)(thread, statement));
|
|
@@ -614,7 +614,7 @@ function processStatement(statement, execInfo, evalContext, thread) {
|
|
|
614
614
|
}
|
|
615
615
|
break;
|
|
616
616
|
}
|
|
617
|
-
case
|
|
617
|
+
case ScriptingSourceTree_1.T_SWITCH_STATEMENT: {
|
|
618
618
|
// --- Create or get the loop's scope (guard is falsy for the first execution)
|
|
619
619
|
if (execInfo.guard) {
|
|
620
620
|
// --- Complete the switch
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.collectVariableDependencies = collectVariableDependencies;
|
|
4
4
|
const lodash_es_1 = require("lodash-es");
|
|
5
5
|
const eval_tree_common_1 = require("./eval-tree-common");
|
|
6
|
-
const
|
|
6
|
+
const ScriptingSourceTree_1 = require("../../abstractions/scripting/ScriptingSourceTree");
|
|
7
7
|
const process_statement_common_1 = require("./process-statement-common");
|
|
8
8
|
/**
|
|
9
9
|
* Collects the name of local context variables the specified program depends on
|
|
@@ -26,21 +26,21 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
26
26
|
program.forEach((stmt) => {
|
|
27
27
|
let stmtDeps = [];
|
|
28
28
|
switch (stmt.type) {
|
|
29
|
-
case
|
|
29
|
+
case ScriptingSourceTree_1.T_BLOCK_STATEMENT:
|
|
30
30
|
thread.blocks.push({ vars: {} });
|
|
31
31
|
stmtDeps = collectDependencies(stmt.stmts, stmt, "block");
|
|
32
32
|
thread.blocks.pop();
|
|
33
33
|
break;
|
|
34
|
-
case
|
|
34
|
+
case ScriptingSourceTree_1.T_EXPRESSION_STATEMENT:
|
|
35
35
|
stmtDeps = collectDependencies(stmt.expr, stmt, "expression");
|
|
36
36
|
break;
|
|
37
|
-
case
|
|
37
|
+
case ScriptingSourceTree_1.T_ARROW_EXPRESSION_STATEMENT:
|
|
38
38
|
thread.blocks.push({ vars: {} });
|
|
39
39
|
stmtDeps = collectDependencies(stmt.expr, stmt, "arrow");
|
|
40
40
|
thread.blocks.pop();
|
|
41
41
|
break;
|
|
42
|
-
case
|
|
43
|
-
case
|
|
42
|
+
case ScriptingSourceTree_1.T_LET_STATEMENT:
|
|
43
|
+
case ScriptingSourceTree_1.T_CONST_STATEMENT:
|
|
44
44
|
processDeclarations((0, process_statement_common_1.innermostBlockScope)(thread), stmt.decls);
|
|
45
45
|
stmt.decls.forEach((decl) => {
|
|
46
46
|
if (decl.expr) {
|
|
@@ -48,27 +48,27 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
break;
|
|
51
|
-
case
|
|
51
|
+
case ScriptingSourceTree_1.T_IF_STATEMENT:
|
|
52
52
|
stmtDeps = collectDependencies(stmt.cond, stmt, "if");
|
|
53
53
|
stmtDeps = stmtDeps.concat(collectDependencies([stmt.thenB], stmt, "if"));
|
|
54
54
|
if (stmt.elseB) {
|
|
55
55
|
stmtDeps = stmtDeps.concat(collectDependencies([stmt.elseB], stmt, "if"));
|
|
56
56
|
}
|
|
57
57
|
break;
|
|
58
|
-
case
|
|
58
|
+
case ScriptingSourceTree_1.T_RETURN_STATEMENT:
|
|
59
59
|
if (stmt.expr) {
|
|
60
60
|
stmtDeps = collectDependencies(stmt.expr, stmt, "return");
|
|
61
61
|
}
|
|
62
62
|
break;
|
|
63
|
-
case
|
|
63
|
+
case ScriptingSourceTree_1.T_WHILE_STATEMENT:
|
|
64
64
|
stmtDeps = collectDependencies(stmt.cond, stmt, "while");
|
|
65
65
|
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "while"));
|
|
66
66
|
break;
|
|
67
|
-
case
|
|
67
|
+
case ScriptingSourceTree_1.T_DO_WHILE_STATEMENT:
|
|
68
68
|
stmtDeps = collectDependencies(stmt.cond, stmt, "doWhile");
|
|
69
69
|
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "doWhile"));
|
|
70
70
|
break;
|
|
71
|
-
case
|
|
71
|
+
case ScriptingSourceTree_1.T_FOR_STATEMENT:
|
|
72
72
|
thread.blocks.push({ vars: {} });
|
|
73
73
|
if (stmt.init) {
|
|
74
74
|
stmtDeps.concat(collectDependencies([stmt.init], stmt, "for"));
|
|
@@ -82,7 +82,7 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
82
82
|
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "for"));
|
|
83
83
|
thread.blocks.pop();
|
|
84
84
|
break;
|
|
85
|
-
case
|
|
85
|
+
case ScriptingSourceTree_1.T_FOR_IN_STATEMENT:
|
|
86
86
|
thread.blocks.push({ vars: {} });
|
|
87
87
|
if (stmt.varB !== "none") {
|
|
88
88
|
const block = (0, process_statement_common_1.innermostBlockScope)(thread);
|
|
@@ -92,7 +92,7 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
92
92
|
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "forIn"));
|
|
93
93
|
thread.blocks.pop();
|
|
94
94
|
break;
|
|
95
|
-
case
|
|
95
|
+
case ScriptingSourceTree_1.T_FOR_OF_STATEMENT:
|
|
96
96
|
thread.blocks.push({ vars: {} });
|
|
97
97
|
if (stmt.varB !== "none") {
|
|
98
98
|
const block = (0, process_statement_common_1.innermostBlockScope)(thread);
|
|
@@ -102,10 +102,10 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
102
102
|
stmtDeps = stmtDeps.concat(collectDependencies([stmt.body], stmt, "forOf"));
|
|
103
103
|
thread.blocks.pop();
|
|
104
104
|
break;
|
|
105
|
-
case
|
|
105
|
+
case ScriptingSourceTree_1.T_THROW_STATEMENT:
|
|
106
106
|
stmtDeps = collectDependencies(stmt.expr, stmt, "throw");
|
|
107
107
|
break;
|
|
108
|
-
case
|
|
108
|
+
case ScriptingSourceTree_1.T_TRY_STATEMENT:
|
|
109
109
|
stmtDeps = collectDependencies([stmt.tryB], stmt, "try");
|
|
110
110
|
if (stmt.catchB) {
|
|
111
111
|
thread.blocks.push({ vars: {} });
|
|
@@ -120,7 +120,7 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
120
120
|
stmtDeps = stmtDeps.concat(collectDependencies([stmt.finallyB], stmt, "finallyBlock"));
|
|
121
121
|
}
|
|
122
122
|
break;
|
|
123
|
-
case
|
|
123
|
+
case ScriptingSourceTree_1.T_SWITCH_STATEMENT:
|
|
124
124
|
stmtDeps = collectDependencies(stmt.expr, stmt, "switch");
|
|
125
125
|
stmt.cases.forEach((c) => {
|
|
126
126
|
if (c.caseE) {
|
|
@@ -139,17 +139,17 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
139
139
|
else {
|
|
140
140
|
// --- Visit expression
|
|
141
141
|
switch (program.type) {
|
|
142
|
-
case
|
|
142
|
+
case ScriptingSourceTree_1.T_IDENTIFIER:
|
|
143
143
|
// --- Any non-block-scoped variable is a dependency to return
|
|
144
144
|
const scope = (0, eval_tree_common_1.getIdentifierScope)(program, evalContext, thread);
|
|
145
145
|
return scope.type !== "block" ? [program.name] : [];
|
|
146
|
-
case
|
|
146
|
+
case ScriptingSourceTree_1.T_MEMBER_ACCESS_EXPRESSION:
|
|
147
147
|
// --- Check for a simple member-access chain. If it exist, add the member to the chain with the "." syntax
|
|
148
148
|
const memberChain = traverseMemberAccessChain(program);
|
|
149
149
|
return memberChain
|
|
150
150
|
? [memberChain]
|
|
151
151
|
: collectDependencies(program.obj, program, "memberAccess");
|
|
152
|
-
case
|
|
152
|
+
case ScriptingSourceTree_1.T_CALCULATED_MEMBER_ACCESS_EXPRESSION:
|
|
153
153
|
// --- Check for a simple member-access chain. If it exist, add the member to the chain with the "[]" syntax
|
|
154
154
|
const calcMemberChain = traverseMemberAccessChain(program);
|
|
155
155
|
if (calcMemberChain) {
|
|
@@ -157,20 +157,20 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
157
157
|
}
|
|
158
158
|
let calcDeps = collectDependencies(program.obj, program, "calculatedMember");
|
|
159
159
|
return calcDeps.concat(collectDependencies(program.member, program, "calculatedMember"));
|
|
160
|
-
case
|
|
160
|
+
case ScriptingSourceTree_1.T_SEQUENCE_EXPRESSION:
|
|
161
161
|
let sequenceDeps = [];
|
|
162
162
|
program.exprs.forEach((expr) => {
|
|
163
163
|
sequenceDeps = sequenceDeps.concat(collectDependencies(expr, program, "sequence"));
|
|
164
164
|
});
|
|
165
165
|
return sequenceDeps;
|
|
166
|
-
case
|
|
166
|
+
case ScriptingSourceTree_1.T_FUNCTION_INVOCATION_EXPRESSION:
|
|
167
167
|
let uncDeps = [];
|
|
168
168
|
(_a = program.arguments) === null || _a === void 0 ? void 0 : _a.forEach((arg) => {
|
|
169
169
|
uncDeps = uncDeps.concat(collectDependencies(arg, program, "functionInvocation"));
|
|
170
170
|
});
|
|
171
|
-
if (program.obj.type ===
|
|
171
|
+
if (program.obj.type === ScriptingSourceTree_1.T_MEMBER_ACCESS_EXPRESSION) {
|
|
172
172
|
const caller = program.obj;
|
|
173
|
-
if (caller.obj.type ===
|
|
173
|
+
if (caller.obj.type === ScriptingSourceTree_1.T_IDENTIFIER) {
|
|
174
174
|
if (typeof (0, lodash_es_1.get)(referenceTrackedApis, `${caller.obj.name}.${caller.member}`) ===
|
|
175
175
|
"function") {
|
|
176
176
|
uncDeps.push(`${caller.obj.name}.${caller.member}`);
|
|
@@ -179,8 +179,8 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
179
179
|
uncDeps.push(`${caller.obj.name}`);
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
else if (caller.obj.type ===
|
|
183
|
-
caller.obj.type ===
|
|
182
|
+
else if (caller.obj.type === ScriptingSourceTree_1.T_MEMBER_ACCESS_EXPRESSION ||
|
|
183
|
+
caller.obj.type === ScriptingSourceTree_1.T_CALCULATED_MEMBER_ACCESS_EXPRESSION) {
|
|
184
184
|
uncDeps = uncDeps.concat(collectDependencies(caller.obj, caller, "functionInvocation"));
|
|
185
185
|
}
|
|
186
186
|
else {
|
|
@@ -191,7 +191,7 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
191
191
|
uncDeps = uncDeps.concat(collectDependencies(program.obj, program, "functionInvocation"));
|
|
192
192
|
}
|
|
193
193
|
return uncDeps;
|
|
194
|
-
case
|
|
194
|
+
case ScriptingSourceTree_1.T_ARROW_EXPRESSION:
|
|
195
195
|
// --- Process the current arguments
|
|
196
196
|
thread.blocks.push({ vars: {} });
|
|
197
197
|
const block = (0, process_statement_common_1.innermostBlockScope)(thread);
|
|
@@ -202,17 +202,17 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
202
202
|
const argSpec = argSpecs[i];
|
|
203
203
|
let decl;
|
|
204
204
|
switch (argSpec.type) {
|
|
205
|
-
case
|
|
205
|
+
case ScriptingSourceTree_1.T_IDENTIFIER: {
|
|
206
206
|
decl = {
|
|
207
|
-
type:
|
|
207
|
+
type: ScriptingSourceTree_1.T_VAR_DECLARATION,
|
|
208
208
|
nodeId: argSpec.nodeId,
|
|
209
209
|
id: argSpec.name,
|
|
210
210
|
};
|
|
211
211
|
break;
|
|
212
212
|
}
|
|
213
|
-
case
|
|
213
|
+
case ScriptingSourceTree_1.T_DESTRUCTURE: {
|
|
214
214
|
decl = {
|
|
215
|
-
type:
|
|
215
|
+
type: ScriptingSourceTree_1.T_VAR_DECLARATION,
|
|
216
216
|
nodeId: argSpec.nodeId,
|
|
217
217
|
id: argSpec.id,
|
|
218
218
|
aDestr: argSpec.aDestr,
|
|
@@ -220,10 +220,10 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
220
220
|
};
|
|
221
221
|
break;
|
|
222
222
|
}
|
|
223
|
-
case
|
|
223
|
+
case ScriptingSourceTree_1.T_SPREAD_EXPRESSION: {
|
|
224
224
|
restFound = true;
|
|
225
225
|
decl = {
|
|
226
|
-
type:
|
|
226
|
+
type: ScriptingSourceTree_1.T_VAR_DECLARATION,
|
|
227
227
|
nodeId: argSpec.nodeId,
|
|
228
228
|
id: argSpec.expr.name,
|
|
229
229
|
};
|
|
@@ -241,7 +241,7 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
241
241
|
thread.blocks.pop();
|
|
242
242
|
// --- Done
|
|
243
243
|
return arrowDeps;
|
|
244
|
-
case
|
|
244
|
+
case ScriptingSourceTree_1.T_OBJECT_LITERAL:
|
|
245
245
|
let objectDeps = [];
|
|
246
246
|
program.props.forEach((prop) => {
|
|
247
247
|
if (Array.isArray(prop)) {
|
|
@@ -252,7 +252,7 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
254
|
return objectDeps;
|
|
255
|
-
case
|
|
255
|
+
case ScriptingSourceTree_1.T_ARRAY_LITERAL:
|
|
256
256
|
let arrayDeps = [];
|
|
257
257
|
program.items.forEach((expr) => {
|
|
258
258
|
if (expr) {
|
|
@@ -260,21 +260,21 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
260
260
|
}
|
|
261
261
|
});
|
|
262
262
|
return arrayDeps;
|
|
263
|
-
case
|
|
263
|
+
case ScriptingSourceTree_1.T_UNARY_EXPRESSION:
|
|
264
264
|
return collectDependencies(program.expr, program, "unary");
|
|
265
|
-
case
|
|
265
|
+
case ScriptingSourceTree_1.T_PREFIX_OP_EXPRESSION:
|
|
266
266
|
return collectDependencies(program.expr, program, "prefix");
|
|
267
|
-
case
|
|
267
|
+
case ScriptingSourceTree_1.T_POSTFIX_OP_EXPRESSION:
|
|
268
268
|
return collectDependencies(program.expr, program, "postfix");
|
|
269
|
-
case
|
|
269
|
+
case ScriptingSourceTree_1.T_BINARY_EXPRESSION:
|
|
270
270
|
return collectDependencies(program.left, program, "left").concat(collectDependencies(program.right, program, "right"));
|
|
271
|
-
case
|
|
271
|
+
case ScriptingSourceTree_1.T_ASSIGNMENT_EXPRESSION:
|
|
272
272
|
return collectDependencies(program.expr, program, "right");
|
|
273
|
-
case
|
|
273
|
+
case ScriptingSourceTree_1.T_CONDITIONAL_EXPRESSION:
|
|
274
274
|
return collectDependencies(program.cond, program, "condition").concat(collectDependencies(program.thenE, program, "trueExpr"), collectDependencies(program.elseE, program, "falseExpr"));
|
|
275
|
-
case
|
|
275
|
+
case ScriptingSourceTree_1.T_VAR_DECLARATION:
|
|
276
276
|
return collectDependencies(program.expr, program, "varDeclaration");
|
|
277
|
-
case
|
|
277
|
+
case ScriptingSourceTree_1.T_SPREAD_EXPRESSION:
|
|
278
278
|
return collectDependencies(program.expr, program, "spread");
|
|
279
279
|
}
|
|
280
280
|
}
|
|
@@ -285,22 +285,22 @@ function collectVariableDependencies(program, referenceTrackedApis = {}) {
|
|
|
285
285
|
function traverseMemberAccessChain(expr) {
|
|
286
286
|
var _a, _b;
|
|
287
287
|
switch (expr.type) {
|
|
288
|
-
case
|
|
288
|
+
case ScriptingSourceTree_1.T_MEMBER_ACCESS_EXPRESSION:
|
|
289
289
|
const memberChain = traverseMemberAccessChain(expr.obj);
|
|
290
290
|
return memberChain ? `${memberChain}.${expr.member}` : null;
|
|
291
|
-
case
|
|
291
|
+
case ScriptingSourceTree_1.T_CALCULATED_MEMBER_ACCESS_EXPRESSION:
|
|
292
292
|
let value = null;
|
|
293
|
-
if (expr.member.type ===
|
|
293
|
+
if (expr.member.type === ScriptingSourceTree_1.T_LITERAL) {
|
|
294
294
|
value = `'${(_b = (_a = expr.member.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : null}'`;
|
|
295
295
|
}
|
|
296
|
-
else if (expr.member.type ===
|
|
296
|
+
else if (expr.member.type === ScriptingSourceTree_1.T_IDENTIFIER) {
|
|
297
297
|
value = expr.member.name;
|
|
298
298
|
}
|
|
299
299
|
if (!value)
|
|
300
300
|
break;
|
|
301
301
|
const calcMemberChain = traverseMemberAccessChain(expr.obj);
|
|
302
302
|
return calcMemberChain ? `${calcMemberChain}[${value}]` : null;
|
|
303
|
-
case
|
|
303
|
+
case ScriptingSourceTree_1.T_IDENTIFIER:
|
|
304
304
|
const scope = (0, eval_tree_common_1.getIdentifierScope)(expr, evalContext, thread);
|
|
305
305
|
return scope.type !== "block" ? expr.name : null;
|
|
306
306
|
}
|
|
@@ -45,7 +45,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
45
|
exports.builtInThemes = void 0;
|
|
46
46
|
exports.useCompiledTheme = useCompiledTheme;
|
|
47
47
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
48
|
-
const abstractions_1 = require("./abstractions");
|
|
49
48
|
const react_1 = require("react");
|
|
50
49
|
const transformThemeVars_1 = require("./transformThemeVars");
|
|
51
50
|
const misc_1 = require("../utils/misc");
|
|
@@ -58,6 +57,7 @@ const ComponentRegistryContext_1 = require("../../components/ComponentRegistryCo
|
|
|
58
57
|
const xmlui_1 = require("../theming/themes/xmlui");
|
|
59
58
|
const solid_1 = require("../theming/themes/solid");
|
|
60
59
|
const hooks_1 = require("../utils/hooks");
|
|
60
|
+
const ThemingDefs_1 = require("../../abstractions/ThemingDefs");
|
|
61
61
|
function useCompiledTheme(activeTheme, activeTone, themes = constants_1.EMPTY_ARRAY, resources = constants_1.EMPTY_OBJECT, resourceMap = constants_1.EMPTY_OBJECT) {
|
|
62
62
|
const componentRegistry = (0, ComponentRegistryContext_1.useComponentRegistry)();
|
|
63
63
|
const { componentThemeVars, componentDefaultThemeVars } = componentRegistry;
|
|
@@ -204,7 +204,7 @@ exports.builtInThemes = [
|
|
|
204
204
|
function ThemeProvider({ children, themes: custThemes = constants_1.EMPTY_ARRAY, defaultTheme = "xmlui", defaultTone = "light", resources = constants_1.EMPTY_OBJECT, resourceMap = constants_1.EMPTY_OBJECT, }) {
|
|
205
205
|
const [activeThemeTone, setActiveThemeTone] = (0, react_1.useState)(() => {
|
|
206
206
|
if (!defaultTone) {
|
|
207
|
-
return
|
|
207
|
+
return ThemingDefs_1.ThemeToneKeys[0];
|
|
208
208
|
}
|
|
209
209
|
return defaultTone;
|
|
210
210
|
});
|
|
@@ -8,7 +8,7 @@ const { $colorSurface0, $colorSurface50, $colorSurface100, $colorSurface200, $co
|
|
|
8
8
|
exports.RootThemeDefinition = {
|
|
9
9
|
id: "root",
|
|
10
10
|
resources: {
|
|
11
|
-
|
|
11
|
+
// "font.inter": "https://rsms.me/inter/inter.css",
|
|
12
12
|
},
|
|
13
13
|
themeVars: {
|
|
14
14
|
// --- The unit of measurement for all sizes/spaces
|