xmlui 0.9.1 → 0.9.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.
- package/dist/{apiInterceptorWorker-230V_-Ds.mjs → apiInterceptorWorker-DJ_oGB-F.mjs} +1 -1
- package/dist/{index-DUwwx3L4.mjs → index-2qtmUAFJ.mjs} +11 -11
- package/dist/index.css +12 -14
- 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/Markdown/MarkdownNative.js +2 -2
- package/dist/scripts/src/components-core/RestApiProxy.js +2 -2
- 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/style.css +12 -14
- package/dist/xmlui-metadata.mjs +1 -1
- package/dist/xmlui-metadata.umd.js +1 -1
- package/dist/xmlui-parser.d.ts +1 -11
- package/dist/xmlui-standalone.umd.js +25 -27
- package/dist/xmlui.d.ts +2 -75
- package/dist/xmlui.mjs +1 -1
- package/package.json +3 -3
- 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
|
@@ -12,7 +12,7 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
|
|
|
12
12
|
var _executor, _DeferredPromise_instances, decorate_fn, _a2;
|
|
13
13
|
import { delay as delay$1, HttpResponse, http } from "msw";
|
|
14
14
|
import { isArray, isObject as isObject$1, mapValues } from "lodash-es";
|
|
15
|
-
import { r as runEventHandlerCode, g as getDate, d as delay, m as miscellaneousUtils, a as dateFunctions, o as orderBy, T as ThrowStatementError } from "./index-
|
|
15
|
+
import { r as runEventHandlerCode, g as getDate, d as delay, m as miscellaneousUtils, a as dateFunctions, o as orderBy, T as ThrowStatementError } from "./index-2qtmUAFJ.mjs";
|
|
16
16
|
import Dexie from "dexie";
|
|
17
17
|
var POSITIONALS_EXP = /(%?)(%([sdijo]))/g;
|
|
18
18
|
function serializePositional(positional, flag) {
|
|
@@ -11541,14 +11541,14 @@ const progressBarComponentRenderer = createComponentRenderer(
|
|
|
11541
11541
|
}
|
|
11542
11542
|
);
|
|
11543
11543
|
const themeVars$p = `'{"boxShadow-Splitter": "var(--xmlui-boxShadow-Splitter)", "backgroundColor-Splitter": "var(--xmlui-backgroundColor-Splitter)", "borderRadius-Splitter": "var(--xmlui-borderRadius-Splitter)", "borderColor-Splitter": "var(--xmlui-borderColor-Splitter)", "borderWidth-Splitter": "var(--xmlui-borderWidth-Splitter)", "borderStyle-Splitter": "var(--xmlui-borderStyle-Splitter)", "border-Splitter": "var(--xmlui-border-Splitter)", "backgroundColor-resizer-Splitter": "var(--xmlui-backgroundColor-resizer-Splitter)", "thickness-resizer-Splitter": "var(--xmlui-thickness-resizer-Splitter)", "cursor-resizer-horizontal-Splitter": "var(--xmlui-cursor-resizer-horizontal-Splitter)", "cursor-resizer-vertical-Splitter": "var(--xmlui-cursor-resizer-vertical-Splitter)"}'`;
|
|
11544
|
-
const splitter = "
|
|
11545
|
-
const vertical$1 = "
|
|
11546
|
-
const horizontal = "
|
|
11547
|
-
const panel = "
|
|
11548
|
-
const primaryPanel = "
|
|
11549
|
-
const secondaryPanel = "
|
|
11550
|
-
const resizer = "
|
|
11551
|
-
const floatingResizer = "
|
|
11544
|
+
const splitter = "_splitter_12v45_13";
|
|
11545
|
+
const vertical$1 = "_vertical_12v45_26";
|
|
11546
|
+
const horizontal = "_horizontal_12v45_29";
|
|
11547
|
+
const panel = "_panel_12v45_33";
|
|
11548
|
+
const primaryPanel = "_primaryPanel_12v45_40";
|
|
11549
|
+
const secondaryPanel = "_secondaryPanel_12v45_47";
|
|
11550
|
+
const resizer = "_resizer_12v45_53";
|
|
11551
|
+
const floatingResizer = "_floatingResizer_12v45_67";
|
|
11552
11552
|
const styles$F = {
|
|
11553
11553
|
themeVars: themeVars$p,
|
|
11554
11554
|
splitter,
|
|
@@ -21677,7 +21677,6 @@ const styles$j = {
|
|
|
21677
21677
|
to,
|
|
21678
21678
|
baseRootComponent
|
|
21679
21679
|
};
|
|
21680
|
-
const ThemeToneKeys = ["light", "dark"];
|
|
21681
21680
|
const palette = {
|
|
21682
21681
|
$colorSurface0: "$color-surface-0",
|
|
21683
21682
|
$colorSurface50: "$color-surface-50",
|
|
@@ -22826,6 +22825,7 @@ const SolidThemeDefinition = {
|
|
|
22826
22825
|
"size-Icon": "1rem"
|
|
22827
22826
|
}
|
|
22828
22827
|
};
|
|
22828
|
+
const ThemeToneKeys = ["light", "dark"];
|
|
22829
22829
|
function useCompiledTheme(activeTheme, activeTone, themes = EMPTY_ARRAY, resources = EMPTY_OBJECT, resourceMap = EMPTY_OBJECT) {
|
|
22830
22830
|
const componentRegistry = useComponentRegistry();
|
|
22831
22831
|
const { componentThemeVars, componentDefaultThemeVars } = componentRegistry;
|
|
@@ -30808,7 +30808,7 @@ function IconProvider({ children }) {
|
|
|
30808
30808
|
/* @__PURE__ */ jsx("svg", { style: { display: "none" }, ref: spriteRootRef })
|
|
30809
30809
|
] });
|
|
30810
30810
|
}
|
|
30811
|
-
const version = "0.9.
|
|
30811
|
+
const version = "0.9.2";
|
|
30812
30812
|
const ApiInterceptorContext = createContext(null);
|
|
30813
30813
|
function useApiInterceptorContext() {
|
|
30814
30814
|
return useContext(ApiInterceptorContext);
|
|
@@ -34792,7 +34792,7 @@ function ApiInterceptorProvider({
|
|
|
34792
34792
|
let interceptorWorker;
|
|
34793
34793
|
(async () => {
|
|
34794
34794
|
if (process.env.VITE_MOCK_ENABLED) {
|
|
34795
|
-
const { createApiInterceptorWorker } = await import("./apiInterceptorWorker-
|
|
34795
|
+
const { createApiInterceptorWorker } = await import("./apiInterceptorWorker-DJ_oGB-F.mjs");
|
|
34796
34796
|
if (interceptor) {
|
|
34797
34797
|
interceptorWorker = await createApiInterceptorWorker(interceptor, apiWorker);
|
|
34798
34798
|
if (!apiWorker) {
|
package/dist/index.css
CHANGED
|
@@ -4050,7 +4050,7 @@ See this source for details: https://css-tricks.com/line-clampin/
|
|
|
4050
4050
|
* This function allows other CSS modules to get the value of the CSS variable specified in $componentVariable.
|
|
4051
4051
|
Optionally, you can provide a $fallbackValue to set the variable's value if that is not defined.
|
|
4052
4052
|
*/
|
|
4053
|
-
.
|
|
4053
|
+
._splitter_12v45_13 {
|
|
4054
4054
|
overflow: hidden;
|
|
4055
4055
|
position: relative;
|
|
4056
4056
|
flex-wrap: nowrap;
|
|
@@ -4063,50 +4063,48 @@ See this source for details: https://css-tricks.com/line-clampin/
|
|
|
4063
4063
|
border: var(--xmlui-border-Splitter) var(--xmlui-borderStyle-Splitter) var(--xmlui-borderColor-Splitter);
|
|
4064
4064
|
user-select: none;
|
|
4065
4065
|
}
|
|
4066
|
-
.
|
|
4066
|
+
._splitter_12v45_13._vertical_12v45_26 {
|
|
4067
4067
|
flex-direction: column;
|
|
4068
4068
|
}
|
|
4069
|
-
.
|
|
4069
|
+
._splitter_12v45_13._horizontal_12v45_29 {
|
|
4070
4070
|
flex-direction: row;
|
|
4071
4071
|
}
|
|
4072
4072
|
|
|
4073
|
-
.
|
|
4073
|
+
._panel_12v45_33 {
|
|
4074
4074
|
overflow: hidden;
|
|
4075
4075
|
display: flex;
|
|
4076
4076
|
flex-direction: column;
|
|
4077
4077
|
flex: 1;
|
|
4078
4078
|
}
|
|
4079
4079
|
|
|
4080
|
-
.
|
|
4080
|
+
._primaryPanel_12v45_40 {
|
|
4081
4081
|
flex-shrink: 0;
|
|
4082
4082
|
flex-grow: 0;
|
|
4083
4083
|
overflow: auto;
|
|
4084
4084
|
order: 1;
|
|
4085
4085
|
}
|
|
4086
4086
|
|
|
4087
|
-
.
|
|
4087
|
+
._secondaryPanel_12v45_47 {
|
|
4088
4088
|
flex: 1;
|
|
4089
4089
|
overflow: auto;
|
|
4090
4090
|
order: 3;
|
|
4091
4091
|
}
|
|
4092
4092
|
|
|
4093
|
-
.
|
|
4093
|
+
._resizer_12v45_53 {
|
|
4094
4094
|
order: 2;
|
|
4095
4095
|
overflow: hidden;
|
|
4096
4096
|
background-color: var(--xmlui-backgroundColor-resizer-Splitter, transparent);
|
|
4097
4097
|
}
|
|
4098
|
-
.
|
|
4098
|
+
._resizer_12v45_53._vertical_12v45_26 {
|
|
4099
4099
|
cursor: var(--xmlui-cursor-resizer-vertical-Splitter, ns-resize);
|
|
4100
|
-
width: 100%;
|
|
4101
4100
|
height: var(--xmlui-thickness-resizer-Splitter, 5px);
|
|
4102
4101
|
}
|
|
4103
|
-
.
|
|
4102
|
+
._resizer_12v45_53._horizontal_12v45_29 {
|
|
4104
4103
|
cursor: var(--xmlui-cursor-resizer-horizontal-Splitter, ew-resize);
|
|
4105
4104
|
width: var(--xmlui-thickness-resizer-Splitter, 5px);
|
|
4106
|
-
height: 100%;
|
|
4107
4105
|
}
|
|
4108
4106
|
|
|
4109
|
-
.
|
|
4107
|
+
._floatingResizer_12v45_67 {
|
|
4110
4108
|
position: absolute;
|
|
4111
4109
|
z-index: 1000;
|
|
4112
4110
|
opacity: 0;
|
|
@@ -4114,13 +4112,13 @@ See this source for details: https://css-tricks.com/line-clampin/
|
|
|
4114
4112
|
transition: opacity 0.2s;
|
|
4115
4113
|
background-color: var(--xmlui-backgroundColor-resizer-Splitter, transparent);
|
|
4116
4114
|
}
|
|
4117
|
-
.
|
|
4115
|
+
._floatingResizer_12v45_67._vertical_12v45_26 {
|
|
4118
4116
|
cursor: var(--xmlui-cursor-resizer-vertical-Splitter, ns-resize);
|
|
4119
4117
|
width: 100%;
|
|
4120
4118
|
height: var(--xmlui-thickness-resizer-Splitter, 5px);
|
|
4121
4119
|
transform: translateY(-50%);
|
|
4122
4120
|
}
|
|
4123
|
-
.
|
|
4121
|
+
._floatingResizer_12v45_67._horizontal_12v45_29 {
|
|
4124
4122
|
cursor: var(--xmlui-cursor-resizer-horizontal-Splitter, ew-resize);
|
|
4125
4123
|
width: var(--xmlui-thickness-resizer-Splitter, 5px);
|
|
4126
4124
|
height: 100%;
|
|
@@ -44,7 +44,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
exports.default = viteXmluiPlugin;
|
|
46
46
|
const pluginutils_1 = require("@rollup/pluginutils");
|
|
47
|
-
const code_behind_collect_1 = require("../src/parsers/scripting
|
|
47
|
+
const code_behind_collect_1 = require("../src/parsers/scripting/code-behind-collect");
|
|
48
48
|
const fileExtensions_1 = require("../src/parsers/xmlui-parser/fileExtensions");
|
|
49
49
|
const Parser_1 = require("../src/parsers/scripting/Parser");
|
|
50
50
|
const fs = __importStar(require("fs"));
|
|
@@ -1,2 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.T_SWITCH_CASE = exports.T_OBJECT_DESTRUCTURE = exports.T_ARRAY_DESTRUCTURE = exports.T_DESTRUCTURE = exports.T_VAR_DECLARATION = exports.T_REACTIVE_VAR_DECLARATION = exports.T_POSTFIX_OP_EXPRESSION = exports.T_PREFIX_OP_EXPRESSION = exports.T_ARROW_EXPRESSION = exports.T_NO_ARG_EXPRESSION = exports.T_ASSIGNMENT_EXPRESSION = exports.T_SPREAD_EXPRESSION = exports.T_OBJECT_LITERAL = exports.T_ARRAY_LITERAL = exports.T_LITERAL = exports.T_TEMPLATE_LITERAL_EXPRESSION = exports.T_IDENTIFIER = exports.T_CALCULATED_MEMBER_ACCESS_EXPRESSION = exports.T_MEMBER_ACCESS_EXPRESSION = exports.T_FUNCTION_INVOCATION_EXPRESSION = exports.T_CONDITIONAL_EXPRESSION = exports.T_SEQUENCE_EXPRESSION = exports.T_BINARY_EXPRESSION = exports.T_UNARY_EXPRESSION = exports.T_FUNCTION_DECLARATION = exports.T_SWITCH_STATEMENT = exports.T_TRY_STATEMENT = exports.T_THROW_STATEMENT = exports.T_FOR_OF_STATEMENT = exports.T_FOR_IN_STATEMENT = exports.T_FOR_STATEMENT = exports.T_DO_WHILE_STATEMENT = exports.T_WHILE_STATEMENT = exports.T_CONTINUE_STATEMENT = exports.T_BREAK_STATEMENT = exports.T_RETURN_STATEMENT = exports.T_IF_STATEMENT = exports.T_VAR_STATEMENT = exports.T_CONST_STATEMENT = exports.T_LET_STATEMENT = exports.T_ARROW_EXPRESSION_STATEMENT = exports.T_EXPRESSION_STATEMENT = exports.T_EMPTY_STATEMENT = exports.T_BLOCK_STATEMENT = void 0;
|
|
4
|
+
// --- Statement node type values
|
|
5
|
+
exports.T_BLOCK_STATEMENT = 1;
|
|
6
|
+
exports.T_EMPTY_STATEMENT = 2;
|
|
7
|
+
exports.T_EXPRESSION_STATEMENT = 3;
|
|
8
|
+
exports.T_ARROW_EXPRESSION_STATEMENT = 4;
|
|
9
|
+
exports.T_LET_STATEMENT = 5;
|
|
10
|
+
exports.T_CONST_STATEMENT = 6;
|
|
11
|
+
exports.T_VAR_STATEMENT = 7;
|
|
12
|
+
exports.T_IF_STATEMENT = 8;
|
|
13
|
+
exports.T_RETURN_STATEMENT = 9;
|
|
14
|
+
exports.T_BREAK_STATEMENT = 10;
|
|
15
|
+
exports.T_CONTINUE_STATEMENT = 11;
|
|
16
|
+
exports.T_WHILE_STATEMENT = 12;
|
|
17
|
+
exports.T_DO_WHILE_STATEMENT = 13;
|
|
18
|
+
exports.T_FOR_STATEMENT = 14;
|
|
19
|
+
exports.T_FOR_IN_STATEMENT = 15;
|
|
20
|
+
exports.T_FOR_OF_STATEMENT = 16;
|
|
21
|
+
exports.T_THROW_STATEMENT = 17;
|
|
22
|
+
exports.T_TRY_STATEMENT = 18;
|
|
23
|
+
exports.T_SWITCH_STATEMENT = 19;
|
|
24
|
+
exports.T_FUNCTION_DECLARATION = 20;
|
|
25
|
+
// --- Expression node type values
|
|
26
|
+
exports.T_UNARY_EXPRESSION = 100;
|
|
27
|
+
exports.T_BINARY_EXPRESSION = 101;
|
|
28
|
+
exports.T_SEQUENCE_EXPRESSION = 102;
|
|
29
|
+
exports.T_CONDITIONAL_EXPRESSION = 103;
|
|
30
|
+
exports.T_FUNCTION_INVOCATION_EXPRESSION = 104;
|
|
31
|
+
exports.T_MEMBER_ACCESS_EXPRESSION = 105;
|
|
32
|
+
exports.T_CALCULATED_MEMBER_ACCESS_EXPRESSION = 106;
|
|
33
|
+
exports.T_IDENTIFIER = 107;
|
|
34
|
+
exports.T_TEMPLATE_LITERAL_EXPRESSION = 108;
|
|
35
|
+
exports.T_LITERAL = 109;
|
|
36
|
+
exports.T_ARRAY_LITERAL = 110;
|
|
37
|
+
exports.T_OBJECT_LITERAL = 111;
|
|
38
|
+
exports.T_SPREAD_EXPRESSION = 112;
|
|
39
|
+
exports.T_ASSIGNMENT_EXPRESSION = 113;
|
|
40
|
+
exports.T_NO_ARG_EXPRESSION = 114;
|
|
41
|
+
exports.T_ARROW_EXPRESSION = 115;
|
|
42
|
+
exports.T_PREFIX_OP_EXPRESSION = 116;
|
|
43
|
+
exports.T_POSTFIX_OP_EXPRESSION = 117;
|
|
44
|
+
exports.T_REACTIVE_VAR_DECLARATION = 118;
|
|
45
|
+
// --- Other node type values
|
|
46
|
+
exports.T_VAR_DECLARATION = 200;
|
|
47
|
+
exports.T_DESTRUCTURE = 201;
|
|
48
|
+
exports.T_ARRAY_DESTRUCTURE = 202;
|
|
49
|
+
exports.T_OBJECT_DESTRUCTURE = 203;
|
|
50
|
+
exports.T_SWITCH_CASE = 204;
|
|
@@ -16,7 +16,7 @@ const TextNative_1 = require("../Text/TextNative");
|
|
|
16
16
|
const LinkNative_1 = require("../Link/LinkNative");
|
|
17
17
|
const ImageNative_1 = require("../Image/ImageNative");
|
|
18
18
|
const Toggle_1 = require("../Toggle/Toggle");
|
|
19
|
-
const
|
|
19
|
+
const ScriptingSourceTree_1 = require("../../abstractions/scripting/ScriptingSourceTree");
|
|
20
20
|
exports.defaultProps = {
|
|
21
21
|
removeIndents: true,
|
|
22
22
|
};
|
|
@@ -253,7 +253,7 @@ function bindingExpression({ extractValue }) {
|
|
|
253
253
|
}
|
|
254
254
|
function parseArrowFunc(extracted) {
|
|
255
255
|
if (extracted.hasOwnProperty("type") &&
|
|
256
|
-
extracted.type ===
|
|
256
|
+
extracted.type === ScriptingSourceTree_1.T_ARROW_EXPRESSION &&
|
|
257
257
|
(extracted === null || extracted === void 0 ? void 0 : extracted._ARROW_EXPR_)) {
|
|
258
258
|
return "[xmlui function]";
|
|
259
259
|
}
|
|
@@ -43,7 +43,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
45
|
const lodash_es_1 = require("lodash-es");
|
|
46
|
-
const
|
|
46
|
+
const ScriptingSourceTree_1 = require("../abstractions/scripting/ScriptingSourceTree");
|
|
47
47
|
const extractParam_1 = require("./utils/extractParam");
|
|
48
48
|
const misc_1 = require("./utils/misc");
|
|
49
49
|
const EngineError_1 = require("./EngineError");
|
|
@@ -208,7 +208,7 @@ class RestApiProxy {
|
|
|
208
208
|
};
|
|
209
209
|
try {
|
|
210
210
|
const arrowStmt = {
|
|
211
|
-
type:
|
|
211
|
+
type: ScriptingSourceTree_1.T_ARROW_EXPRESSION_STATEMENT,
|
|
212
212
|
expr: value,
|
|
213
213
|
};
|
|
214
214
|
(0, process_statement_sync_1.processStatementQueue)([arrowStmt], evalContext);
|
|
@@ -52,7 +52,7 @@ const react_2 = require("@remix-run/react");
|
|
|
52
52
|
const lodash_es_1 = require("lodash-es");
|
|
53
53
|
const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
54
54
|
const memoize_one_1 = __importDefault(require("memoize-one"));
|
|
55
|
-
const
|
|
55
|
+
const ScriptingSourceTree_1 = require("../../abstractions/scripting/ScriptingSourceTree");
|
|
56
56
|
const containers_1 = require("../abstractions/containers");
|
|
57
57
|
const AppContext_1 = require("../AppContext");
|
|
58
58
|
const buildProxy_1 = require("../rendering/buildProxy");
|
|
@@ -163,7 +163,7 @@ exports.Container = (0, react_1.memo)((0, react_1.forwardRef)(function Container
|
|
|
163
163
|
else {
|
|
164
164
|
statements = [
|
|
165
165
|
{
|
|
166
|
-
type:
|
|
166
|
+
type: ScriptingSourceTree_1.T_ARROW_EXPRESSION_STATEMENT,
|
|
167
167
|
expr: source, //TODO illesg (talk it through why we need to deep clone, it it's omitted, it gets slower every time we run it)
|
|
168
168
|
},
|
|
169
169
|
];
|
|
@@ -278,7 +278,7 @@ exports.Container = (0, react_1.memo)((0, react_1.forwardRef)(function Container
|
|
|
278
278
|
};
|
|
279
279
|
try {
|
|
280
280
|
const arrowStmt = {
|
|
281
|
-
type:
|
|
281
|
+
type: ScriptingSourceTree_1.T_ARROW_EXPRESSION_STATEMENT,
|
|
282
282
|
expr: arrowExpression,
|
|
283
283
|
};
|
|
284
284
|
(0, process_statement_sync_1.processStatementQueue)([arrowStmt], evalContext);
|
|
@@ -11,7 +11,7 @@ const lodash_es_1 = require("lodash-es");
|
|
|
11
11
|
const memoize_one_1 = __importDefault(require("memoize-one"));
|
|
12
12
|
const react_2 = require("@remix-run/react");
|
|
13
13
|
const containers_1 = require("../abstractions/containers");
|
|
14
|
-
const
|
|
14
|
+
const ScriptingSourceTree_1 = require("../../abstractions/scripting/ScriptingSourceTree");
|
|
15
15
|
const constants_1 = require("../constants");
|
|
16
16
|
const collectFnVarDeps_1 = require("../rendering/collectFnVarDeps");
|
|
17
17
|
const reducer_1 = require("../rendering/reducer");
|
|
@@ -20,7 +20,7 @@ const ErrorBoundary_1 = require("../rendering/ErrorBoundary");
|
|
|
20
20
|
const visitors_1 = require("../script-runner/visitors");
|
|
21
21
|
const hooks_1 = require("../utils/hooks");
|
|
22
22
|
const Container_1 = require("./Container");
|
|
23
|
-
const code_behind_collect_1 = require("../../parsers/scripting
|
|
23
|
+
const code_behind_collect_1 = require("../../parsers/scripting/code-behind-collect");
|
|
24
24
|
const AppContext_1 = require("../AppContext");
|
|
25
25
|
const ParameterParser_1 = require("../script-runner/ParameterParser");
|
|
26
26
|
const eval_tree_sync_1 = require("../script-runner/eval-tree-sync");
|
|
@@ -78,7 +78,7 @@ exports.StateContainer = (0, react_1.memo)((0, react_1.forwardRef)(function Stat
|
|
|
78
78
|
const functionDeps = (0, react_1.useMemo)(() => {
|
|
79
79
|
const fnDeps = {};
|
|
80
80
|
Object.entries(varDefinitions).forEach(([key, value]) => {
|
|
81
|
-
if (isParsedValue(value) && value.tree.type ===
|
|
81
|
+
if (isParsedValue(value) && value.tree.type === ScriptingSourceTree_1.T_ARROW_EXPRESSION) {
|
|
82
82
|
fnDeps[key] = (0, visitors_1.collectVariableDependencies)(value.tree, referenceTrackedApi);
|
|
83
83
|
}
|
|
84
84
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parseParameterString = parseParameterString;
|
|
4
|
-
const Parser_1 = require("../../parsers/scripting
|
|
4
|
+
const Parser_1 = require("../../parsers/scripting/Parser");
|
|
5
5
|
/**
|
|
6
6
|
* This function parses a parameter string and splits them into string literal and binding expression sections
|
|
7
7
|
* @param source String to parse
|
|
@@ -13,7 +13,7 @@ exports.evalBindingAsync = evalBindingAsync;
|
|
|
13
13
|
exports.executeArrowExpression = executeArrowExpression;
|
|
14
14
|
exports.completeExprValue = completeExprValue;
|
|
15
15
|
const lodash_es_1 = require("lodash-es");
|
|
16
|
-
const
|
|
16
|
+
const ScriptingSourceTree_1 = require("../../abstractions/scripting/ScriptingSourceTree");
|
|
17
17
|
const process_statement_async_1 = require("./process-statement-async");
|
|
18
18
|
const eval_tree_common_1 = require("./eval-tree-common");
|
|
19
19
|
const process_statement_common_1 = require("./process-statement-common");
|
|
@@ -47,7 +47,7 @@ function evalBindingAsync(expr, evalContext, thread) {
|
|
|
47
47
|
function executeArrowExpression(expr, evalContext, thread, ...args) {
|
|
48
48
|
return __awaiter(this, void 0, void 0, function* () {
|
|
49
49
|
// --- Just an extra safety check
|
|
50
|
-
if (expr.type !==
|
|
50
|
+
if (expr.type !== ScriptingSourceTree_1.T_ARROW_EXPRESSION) {
|
|
51
51
|
throw new Error("executeArrowExpression expects an 'ArrowExpression' object.");
|
|
52
52
|
}
|
|
53
53
|
// --- This is the evaluator that an arrow expression uses internally
|
|
@@ -82,39 +82,39 @@ function evalBindingExpressionTreeAsync(thisStack, expr, evalContext, thread) {
|
|
|
82
82
|
// --- Process the expression according to its type
|
|
83
83
|
try {
|
|
84
84
|
switch (expr.type) {
|
|
85
|
-
case
|
|
85
|
+
case ScriptingSourceTree_1.T_TEMPLATE_LITERAL_EXPRESSION:
|
|
86
86
|
return evalTemplateLiteralAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
87
|
-
case
|
|
87
|
+
case ScriptingSourceTree_1.T_LITERAL:
|
|
88
88
|
return (0, eval_tree_common_1.evalLiteral)(thisStack, expr, thread);
|
|
89
|
-
case
|
|
89
|
+
case ScriptingSourceTree_1.T_IDENTIFIER:
|
|
90
90
|
return (0, eval_tree_common_1.evalIdentifier)(thisStack, expr, evalContext, thread);
|
|
91
|
-
case
|
|
91
|
+
case ScriptingSourceTree_1.T_MEMBER_ACCESS_EXPRESSION:
|
|
92
92
|
return yield evalMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
93
|
-
case
|
|
93
|
+
case ScriptingSourceTree_1.T_CALCULATED_MEMBER_ACCESS_EXPRESSION:
|
|
94
94
|
return yield evalCalculatedMemberAccessAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
95
|
-
case
|
|
95
|
+
case ScriptingSourceTree_1.T_SEQUENCE_EXPRESSION:
|
|
96
96
|
return yield evalSequenceAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
97
|
-
case
|
|
97
|
+
case ScriptingSourceTree_1.T_ARRAY_LITERAL:
|
|
98
98
|
return yield evalArrayLiteralAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
99
|
-
case
|
|
99
|
+
case ScriptingSourceTree_1.T_OBJECT_LITERAL:
|
|
100
100
|
return yield evalObjectLiteralAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
101
|
-
case
|
|
101
|
+
case ScriptingSourceTree_1.T_UNARY_EXPRESSION:
|
|
102
102
|
return yield evalUnaryAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
103
|
-
case
|
|
103
|
+
case ScriptingSourceTree_1.T_BINARY_EXPRESSION:
|
|
104
104
|
return yield evalBinaryAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
105
|
-
case
|
|
105
|
+
case ScriptingSourceTree_1.T_CONDITIONAL_EXPRESSION:
|
|
106
106
|
return yield evalConditionalAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
107
|
-
case
|
|
107
|
+
case ScriptingSourceTree_1.T_ASSIGNMENT_EXPRESSION:
|
|
108
108
|
return yield evalAssignmentAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
109
|
-
case
|
|
110
|
-
case
|
|
109
|
+
case ScriptingSourceTree_1.T_PREFIX_OP_EXPRESSION:
|
|
110
|
+
case ScriptingSourceTree_1.T_POSTFIX_OP_EXPRESSION:
|
|
111
111
|
return yield evalPreOrPostAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
112
|
-
case
|
|
112
|
+
case ScriptingSourceTree_1.T_FUNCTION_INVOCATION_EXPRESSION:
|
|
113
113
|
// --- Special async handling
|
|
114
114
|
return yield evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, thread);
|
|
115
|
-
case
|
|
115
|
+
case ScriptingSourceTree_1.T_ARROW_EXPRESSION:
|
|
116
116
|
return (0, eval_tree_common_1.evalArrow)(thisStack, expr, thread);
|
|
117
|
-
case
|
|
117
|
+
case ScriptingSourceTree_1.T_SPREAD_EXPRESSION:
|
|
118
118
|
throw new Error("Cannot use spread expression (...) with the current intermediate value.");
|
|
119
119
|
default:
|
|
120
120
|
throw new Error(`Unknown expression tree node: ${expr.type}`);
|
|
@@ -166,7 +166,7 @@ function evalArrayLiteralAsync(evaluator, thisStack, expr, evalContext, thread)
|
|
|
166
166
|
return __awaiter(this, void 0, void 0, function* () {
|
|
167
167
|
const value = [];
|
|
168
168
|
for (const item of expr.items) {
|
|
169
|
-
if (item.type ===
|
|
169
|
+
if (item.type === ScriptingSourceTree_1.T_SPREAD_EXPRESSION) {
|
|
170
170
|
const spreadArray = yield evaluator(thisStack, item.expr, evalContext, thread);
|
|
171
171
|
thisStack.pop();
|
|
172
172
|
if (!Array.isArray(spreadArray)) {
|
|
@@ -210,10 +210,10 @@ function evalObjectLiteralAsync(evaluator, thisStack, expr, evalContext, thread)
|
|
|
210
210
|
// --- We're using key/[value] pairs
|
|
211
211
|
let key;
|
|
212
212
|
switch (prop[0].type) {
|
|
213
|
-
case
|
|
213
|
+
case ScriptingSourceTree_1.T_LITERAL:
|
|
214
214
|
key = prop[0].value;
|
|
215
215
|
break;
|
|
216
|
-
case
|
|
216
|
+
case ScriptingSourceTree_1.T_IDENTIFIER:
|
|
217
217
|
key = prop[0].name;
|
|
218
218
|
break;
|
|
219
219
|
default:
|
|
@@ -312,11 +312,11 @@ function evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, th
|
|
|
312
312
|
let implicitContextObject = null;
|
|
313
313
|
let hostObject;
|
|
314
314
|
// --- Check for contexted object
|
|
315
|
-
if (expr.obj.type ===
|
|
315
|
+
if (expr.obj.type === ScriptingSourceTree_1.T_MEMBER_ACCESS_EXPRESSION) {
|
|
316
316
|
hostObject = yield evaluator(thisStack, expr.obj.obj, evalContext, thread);
|
|
317
317
|
yield completeExprValue(expr.obj.obj, thread);
|
|
318
318
|
functionObj = (0, eval_tree_common_1.evalMemberAccessCore)(thisStack, expr.obj, evalContext, thread);
|
|
319
|
-
if (expr.obj.obj.type ===
|
|
319
|
+
if (expr.obj.obj.type === ScriptingSourceTree_1.T_IDENTIFIER && (hostObject === null || hostObject === void 0 ? void 0 : hostObject._SUPPORT_IMPLICIT_CONTEXT)) {
|
|
320
320
|
implicitContextObject = hostObject;
|
|
321
321
|
}
|
|
322
322
|
}
|
|
@@ -333,7 +333,7 @@ function evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, th
|
|
|
333
333
|
functionArgs.push(functionObj.args, evalContext, thread, ...expr.arguments.map((a) => (Object.assign(Object.assign({}, a), { _EXPRESSION_: true }))));
|
|
334
334
|
functionObj = yield createArrowFunctionAsync(evaluator, functionObj);
|
|
335
335
|
}
|
|
336
|
-
else if (expr.obj.type ===
|
|
336
|
+
else if (expr.obj.type === ScriptingSourceTree_1.T_ARROW_EXPRESSION) {
|
|
337
337
|
// --- We delay evaluating expression values. We pass the argument names as the first parameter, and then
|
|
338
338
|
// --- all parameter expressions
|
|
339
339
|
functionArgs.push(expr.obj.args.map((a) => a.name), evalContext, thread, ...expr.arguments.map((a) => (Object.assign(Object.assign({}, a), { _EXPRESSION_: true }))));
|
|
@@ -342,7 +342,7 @@ function evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, th
|
|
|
342
342
|
// --- We evaluate the argument values to pass to a JavaScript function
|
|
343
343
|
for (let i = 0; i < expr.arguments.length; i++) {
|
|
344
344
|
const arg = expr.arguments[i];
|
|
345
|
-
if (arg.type ===
|
|
345
|
+
if (arg.type === ScriptingSourceTree_1.T_SPREAD_EXPRESSION) {
|
|
346
346
|
yield evaluator([], arg.expr, evalContext, thread);
|
|
347
347
|
const funcArg = yield completeExprValue(arg.expr, thread);
|
|
348
348
|
if (!Array.isArray(funcArg)) {
|
|
@@ -351,7 +351,7 @@ function evalFunctionInvocationAsync(evaluator, thisStack, expr, evalContext, th
|
|
|
351
351
|
functionArgs.push(...funcArg);
|
|
352
352
|
}
|
|
353
353
|
else {
|
|
354
|
-
if (arg.type ===
|
|
354
|
+
if (arg.type === ScriptingSourceTree_1.T_ARROW_EXPRESSION) {
|
|
355
355
|
const funcArg = yield createArrowFunctionAsync(evaluator, arg);
|
|
356
356
|
const wrappedFunc = (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
357
357
|
return funcArg(arg.args, evalContext, thread, ...args);
|
|
@@ -450,26 +450,26 @@ function createArrowFunctionAsync(evaluator, expr) {
|
|
|
450
450
|
const argSpec = argSpecs[i];
|
|
451
451
|
let decl;
|
|
452
452
|
switch (argSpec.type) {
|
|
453
|
-
case
|
|
453
|
+
case ScriptingSourceTree_1.T_IDENTIFIER: {
|
|
454
454
|
decl = {
|
|
455
|
-
type:
|
|
455
|
+
type: ScriptingSourceTree_1.T_VAR_DECLARATION,
|
|
456
456
|
id: argSpec.name,
|
|
457
457
|
};
|
|
458
458
|
break;
|
|
459
459
|
}
|
|
460
|
-
case
|
|
460
|
+
case ScriptingSourceTree_1.T_DESTRUCTURE: {
|
|
461
461
|
decl = {
|
|
462
|
-
type:
|
|
462
|
+
type: ScriptingSourceTree_1.T_VAR_DECLARATION,
|
|
463
463
|
id: argSpec.id,
|
|
464
464
|
aDestr: argSpec.aDestr,
|
|
465
465
|
oDestr: argSpec.oDestr,
|
|
466
466
|
};
|
|
467
467
|
break;
|
|
468
468
|
}
|
|
469
|
-
case
|
|
469
|
+
case ScriptingSourceTree_1.T_SPREAD_EXPRESSION: {
|
|
470
470
|
restFound = true;
|
|
471
471
|
decl = {
|
|
472
|
-
type:
|
|
472
|
+
type: ScriptingSourceTree_1.T_VAR_DECLARATION,
|
|
473
473
|
id: argSpec.expr.name,
|
|
474
474
|
};
|
|
475
475
|
break;
|
|
@@ -506,19 +506,19 @@ function createArrowFunctionAsync(evaluator, expr) {
|
|
|
506
506
|
let returnValue;
|
|
507
507
|
let statements;
|
|
508
508
|
switch (expr.statement.type) {
|
|
509
|
-
case
|
|
509
|
+
case ScriptingSourceTree_1.T_EMPTY_STATEMENT:
|
|
510
510
|
statements = [];
|
|
511
511
|
break;
|
|
512
|
-
case
|
|
512
|
+
case ScriptingSourceTree_1.T_EXPRESSION_STATEMENT:
|
|
513
513
|
// --- Create a new thread for the call
|
|
514
514
|
statements = [
|
|
515
515
|
{
|
|
516
|
-
type:
|
|
516
|
+
type: ScriptingSourceTree_1.T_RETURN_STATEMENT,
|
|
517
517
|
expr: expr.statement.expr,
|
|
518
518
|
},
|
|
519
519
|
];
|
|
520
520
|
break;
|
|
521
|
-
case
|
|
521
|
+
case ScriptingSourceTree_1.T_BLOCK_STATEMENT:
|
|
522
522
|
// --- Create a new thread for the call
|
|
523
523
|
statements = expr.statement.stmts;
|
|
524
524
|
break;
|
|
@@ -16,7 +16,7 @@ exports.evalPreOrPostCore = evalPreOrPostCore;
|
|
|
16
16
|
exports.evalArrow = evalArrow;
|
|
17
17
|
exports.obtainClosures = obtainClosures;
|
|
18
18
|
exports.evalTemplateLiteralCore = evalTemplateLiteralCore;
|
|
19
|
-
const
|
|
19
|
+
const ScriptingSourceTree_1 = require("../../abstractions/scripting/ScriptingSourceTree");
|
|
20
20
|
// --- Get the cached expression value
|
|
21
21
|
function getExprValue(expr, thread) {
|
|
22
22
|
var _a, _b;
|
|
@@ -129,12 +129,12 @@ function evalIdentifier(thisStack, expr, evalContext, thread) {
|
|
|
129
129
|
// --- Gets the scope of the root ID
|
|
130
130
|
function getRootIdScope(expr, evalContext, thread) {
|
|
131
131
|
switch (expr.type) {
|
|
132
|
-
case
|
|
132
|
+
case ScriptingSourceTree_1.T_IDENTIFIER:
|
|
133
133
|
const idScope = getIdentifierScope(expr, evalContext, thread);
|
|
134
134
|
return { type: idScope.type, name: expr.name };
|
|
135
|
-
case
|
|
135
|
+
case ScriptingSourceTree_1.T_MEMBER_ACCESS_EXPRESSION:
|
|
136
136
|
return getRootIdScope(expr.obj, evalContext, thread);
|
|
137
|
-
case
|
|
137
|
+
case ScriptingSourceTree_1.T_CALCULATED_MEMBER_ACCESS_EXPRESSION:
|
|
138
138
|
return getRootIdScope(expr.obj, evalContext, thread);
|
|
139
139
|
}
|
|
140
140
|
return null;
|
|
@@ -316,7 +316,7 @@ function evalAssignmentCore(thisStack, expr, evalContext, thread) {
|
|
|
316
316
|
throw new Error(`Unknown left-hand value`);
|
|
317
317
|
}
|
|
318
318
|
// --- Check for const value
|
|
319
|
-
if (expr.leftValue.type ===
|
|
319
|
+
if (expr.leftValue.type === ScriptingSourceTree_1.T_IDENTIFIER) {
|
|
320
320
|
if (isConstVar(expr.leftValue.name, thread)) {
|
|
321
321
|
throw new Error("A const variable cannot be modified");
|
|
322
322
|
}
|
|
@@ -387,17 +387,17 @@ function evalPreOrPostCore(thisStack, expr, evalContext, thread) {
|
|
|
387
387
|
throw new Error(`Evaluation of ${expr.op} requires a left-hand value.`);
|
|
388
388
|
}
|
|
389
389
|
// --- Check for const value
|
|
390
|
-
if (expr.expr.type ===
|
|
390
|
+
if (expr.expr.type === ScriptingSourceTree_1.T_IDENTIFIER) {
|
|
391
391
|
if (isConstVar(expr.expr.name, thread)) {
|
|
392
392
|
// --- We cannot modify a const value
|
|
393
393
|
throw new Error("A const variable cannot be modified");
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
const value = expr.op === "++"
|
|
397
|
-
? expr.type ===
|
|
397
|
+
? expr.type === ScriptingSourceTree_1.T_PREFIX_OP_EXPRESSION
|
|
398
398
|
? ++operand.valueScope[operand.valueIndex]
|
|
399
399
|
: operand.valueScope[operand.valueIndex]++
|
|
400
|
-
: expr.type ===
|
|
400
|
+
: expr.type === ScriptingSourceTree_1.T_PREFIX_OP_EXPRESSION
|
|
401
401
|
? --operand.valueScope[operand.valueIndex]
|
|
402
402
|
: operand.valueScope[operand.valueIndex]--;
|
|
403
403
|
setExprValue(expr, { value }, thread);
|