xmlui 0.9.6 → 0.9.7
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-BPCEQ5nI.mjs → apiInterceptorWorker-DJ9I-JAW.mjs} +1 -1
- package/dist/{index-B18vblD8.mjs → index-ohXvHX94.mjs} +51 -15
- package/dist/{lint-gX2osbkz.mjs → lint-B9tKGcOX.mjs} +35 -8
- package/dist/scripts/src/abstractions/scripting/Compilation.js +2 -0
- package/dist/scripts/src/components-core/rendering/Container.js +50 -12
- package/dist/scripts/src/parsers/scripting/Parser.js +7 -3
- package/dist/scripts/src/parsers/scripting/code-behind-collect.js +1 -1
- package/dist/scripts/src/parsers/scripting/modules.js +0 -1
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +28 -3
- package/dist/xmlui-metadata.mjs +35 -8
- package/dist/xmlui-metadata.umd.js +35 -8
- package/dist/xmlui-parser.mjs +2 -2
- package/dist/xmlui-standalone.umd.js +87 -24
- package/dist/xmlui.mjs +1 -1
- package/package.json +2 -2
|
@@ -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-ohXvHX94.mjs";
|
|
16
16
|
import Dexie from "dexie";
|
|
17
17
|
var POSITIONALS_EXP = /(%?)(%([sdijo]))/g;
|
|
18
18
|
function serializePositional(positional, flag) {
|
|
@@ -7,7 +7,7 @@ import { useQuery, useInfiniteQuery, QueryClientProvider, QueryClient } from "@t
|
|
|
7
7
|
import produce, { createDraft, finishDraft, enableMapSet } from "immer";
|
|
8
8
|
import { throttle, get, isNil, omitBy, isUndefined, noop as noop$2, isPlainObject, isEqual, union, uniq, orderBy as orderBy$1, isEmpty, isObject, isArray, groupBy, sortBy, omit, isNumber, isString, cloneDeep, merge, defaultTo, capitalize, unset, setWith, keyBy, pick } from "lodash-es";
|
|
9
9
|
import { formatDistanceToNow, parse, format, parseISO, isValid, isTomorrow, isYesterday, isToday, isThisWeek, formatRelative, isThisYear, isSameDay, differenceInMinutes } from "date-fns";
|
|
10
|
-
import { v as validationStatusMd, l as labelPositionMd, o as orientationOptionMd, a as alignmentOptionValues, L as LinkTargetMd, b as alignmentOptionMd, i as iconPositionMd, c as buttonTypesMd, s as sizeMd, d as buttonThemeMd, e as buttonVariantMd, P as Parser, T as T_CALCULATED_MEMBER_ACCESS_EXPRESSION, f as T_MEMBER_ACCESS_EXPRESSION, g as T_IDENTIFIER, h as T_PREFIX_OP_EXPRESSION, j as T_FUNCTION_DECLARATION, k as T_ARROW_EXPRESSION, m as createXmlUiTreeNodeId, n as T_EMPTY_STATEMENT, p as T_SWITCH_STATEMENT, q as T_TRY_STATEMENT, r as T_THROW_STATEMENT, t as T_FOR_OF_STATEMENT, u as T_FOR_IN_STATEMENT, w as T_FOR_STATEMENT, x as T_EXPRESSION_STATEMENT, y as T_BREAK_STATEMENT, z as T_CONTINUE_STATEMENT, A as T_DO_WHILE_STATEMENT, B as T_WHILE_STATEMENT, C as T_RETURN_STATEMENT, D as T_IF_STATEMENT, E as T_CONST_STATEMENT, F as T_LET_STATEMENT, G as T_ARROW_EXPRESSION_STATEMENT, H as T_BLOCK_STATEMENT, I as T_VAR_STATEMENT, J as T_ASSIGNMENT_EXPRESSION, K as T_LITERAL, M as T_SPREAD_EXPRESSION, N as T_FUNCTION_INVOCATION_EXPRESSION, O as T_POSTFIX_OP_EXPRESSION, Q as T_CONDITIONAL_EXPRESSION, R as T_BINARY_EXPRESSION, S as T_UNARY_EXPRESSION, U as T_OBJECT_LITERAL, V as T_ARRAY_LITERAL, W as T_SEQUENCE_EXPRESSION, X as T_TEMPLATE_LITERAL_EXPRESSION, Y as T_VAR_DECLARATION, Z as T_DESTRUCTURE, _ as TextVariantElement, $ as VariantPropsKeys, a0 as variantOptionsMd, a1 as scrollAnchoringValues, a2 as buttonThemeNames, a3 as iconPositionNames, a4 as buttonVariantNames, a5 as nodeToComponentDef, a6 as triggerPositionNames, a7 as statusColorMd, a8 as placementMd, a9 as httpMethodNames, aa as PARSED_MARK_PROP, ab as layoutOptionKeys, ac as viewportSizeNames, ad as componentFileExtension, ae as codeBehindFileExtension, af as getLintSeverity, ag as LintSeverity, ah as lintApp, ai as printComponentLints, aj as lintErrorsComponent, ak as collectCodeBehindFromSource, al as removeCodeBehindTokensFromTree } from "./lint-
|
|
10
|
+
import { v as validationStatusMd, l as labelPositionMd, o as orientationOptionMd, a as alignmentOptionValues, L as LinkTargetMd, b as alignmentOptionMd, i as iconPositionMd, c as buttonTypesMd, s as sizeMd, d as buttonThemeMd, e as buttonVariantMd, P as Parser, T as T_CALCULATED_MEMBER_ACCESS_EXPRESSION, f as T_MEMBER_ACCESS_EXPRESSION, g as T_IDENTIFIER, h as T_PREFIX_OP_EXPRESSION, j as T_FUNCTION_DECLARATION, k as T_ARROW_EXPRESSION, m as createXmlUiTreeNodeId, n as T_EMPTY_STATEMENT, p as T_SWITCH_STATEMENT, q as T_TRY_STATEMENT, r as T_THROW_STATEMENT, t as T_FOR_OF_STATEMENT, u as T_FOR_IN_STATEMENT, w as T_FOR_STATEMENT, x as T_EXPRESSION_STATEMENT, y as T_BREAK_STATEMENT, z as T_CONTINUE_STATEMENT, A as T_DO_WHILE_STATEMENT, B as T_WHILE_STATEMENT, C as T_RETURN_STATEMENT, D as T_IF_STATEMENT, E as T_CONST_STATEMENT, F as T_LET_STATEMENT, G as T_ARROW_EXPRESSION_STATEMENT, H as T_BLOCK_STATEMENT, I as T_VAR_STATEMENT, J as T_ASSIGNMENT_EXPRESSION, K as T_LITERAL, M as T_SPREAD_EXPRESSION, N as T_FUNCTION_INVOCATION_EXPRESSION, O as T_POSTFIX_OP_EXPRESSION, Q as T_CONDITIONAL_EXPRESSION, R as T_BINARY_EXPRESSION, S as T_UNARY_EXPRESSION, U as T_OBJECT_LITERAL, V as T_ARRAY_LITERAL, W as T_SEQUENCE_EXPRESSION, X as T_TEMPLATE_LITERAL_EXPRESSION, Y as T_VAR_DECLARATION, Z as T_DESTRUCTURE, _ as TextVariantElement, $ as VariantPropsKeys, a0 as variantOptionsMd, a1 as scrollAnchoringValues, a2 as buttonThemeNames, a3 as iconPositionNames, a4 as buttonVariantNames, a5 as nodeToComponentDef, a6 as triggerPositionNames, a7 as statusColorMd, a8 as placementMd, a9 as httpMethodNames, aa as PARSED_MARK_PROP, ab as layoutOptionKeys, ac as viewportSizeNames, ad as componentFileExtension, ae as codeBehindFileExtension, af as getLintSeverity, ag as LintSeverity, ah as lintApp, ai as printComponentLints, aj as lintErrorsComponent, ak as collectCodeBehindFromSource, al as removeCodeBehindTokensFromTree } from "./lint-B9tKGcOX.mjs";
|
|
11
11
|
import classnames from "classnames";
|
|
12
12
|
import Color from "color";
|
|
13
13
|
import TextareaAutosize from "react-textarea-autosize";
|
|
@@ -31671,7 +31671,7 @@ function IconProvider({ children }) {
|
|
|
31671
31671
|
/* @__PURE__ */ jsx("svg", { style: { display: "none" }, ref: spriteRootRef })
|
|
31672
31672
|
] });
|
|
31673
31673
|
}
|
|
31674
|
-
const version = "0.9.
|
|
31674
|
+
const version = "0.9.7";
|
|
31675
31675
|
const ApiInterceptorContext = createContext(null);
|
|
31676
31676
|
function useApiInterceptorContext() {
|
|
31677
31677
|
return useContext(ApiInterceptorContext);
|
|
@@ -33522,6 +33522,15 @@ const Container = memo(
|
|
|
33522
33522
|
);
|
|
33523
33523
|
}
|
|
33524
33524
|
statements = parsedStatementsRef.current[source];
|
|
33525
|
+
} else if (isParsedEventValue(source)) {
|
|
33526
|
+
const parseId = source.parseId.toString();
|
|
33527
|
+
if (!parsedStatementsRef.current[parseId]) {
|
|
33528
|
+
parsedStatementsRef.current[parseId] = prepareHandlerStatements(
|
|
33529
|
+
source.statements,
|
|
33530
|
+
evalContext
|
|
33531
|
+
);
|
|
33532
|
+
}
|
|
33533
|
+
statements = parsedStatementsRef.current[parseId];
|
|
33525
33534
|
} else {
|
|
33526
33535
|
statements = [
|
|
33527
33536
|
{
|
|
@@ -33639,23 +33648,44 @@ const Container = memo(
|
|
|
33639
33648
|
);
|
|
33640
33649
|
const getOrCreateEventHandlerFn = useEvent(
|
|
33641
33650
|
(src, uid, options2) => {
|
|
33642
|
-
var _a2;
|
|
33651
|
+
var _a2, _b;
|
|
33643
33652
|
if (Array.isArray(src)) {
|
|
33644
33653
|
throw new Error("Multiple event handlers are not supported");
|
|
33645
33654
|
}
|
|
33646
|
-
|
|
33647
|
-
|
|
33648
|
-
|
|
33649
|
-
|
|
33650
|
-
|
|
33651
|
-
|
|
33652
|
-
|
|
33655
|
+
if (typeof src === "string") {
|
|
33656
|
+
const fnCacheKey = `${options2 == null ? void 0 : options2.eventName};${src}`;
|
|
33657
|
+
const handler = (...eventArgs) => {
|
|
33658
|
+
return runCodeAsync(src, uid, options2, ...cloneDeep(eventArgs));
|
|
33659
|
+
};
|
|
33660
|
+
if (options2 == null ? void 0 : options2.ephemeral) {
|
|
33661
|
+
return handler;
|
|
33662
|
+
}
|
|
33663
|
+
if (!((_a2 = fnsRef.current[uid]) == null ? void 0 : _a2[fnCacheKey])) {
|
|
33664
|
+
fnsRef.current[uid] = fnsRef.current[uid] || {};
|
|
33665
|
+
fnsRef.current[uid][fnCacheKey] = handler;
|
|
33666
|
+
}
|
|
33667
|
+
return fnsRef.current[uid][fnCacheKey];
|
|
33653
33668
|
}
|
|
33654
|
-
if (
|
|
33655
|
-
|
|
33656
|
-
|
|
33669
|
+
if (isParsedEventValue(src)) {
|
|
33670
|
+
return (...eventArgs) => {
|
|
33671
|
+
return runCodeAsync(src, uid, options2, ...cloneDeep(eventArgs));
|
|
33672
|
+
};
|
|
33657
33673
|
}
|
|
33658
|
-
|
|
33674
|
+
if (isArrowExpression(src)) {
|
|
33675
|
+
const fnCacheKey = `${options2 == null ? void 0 : options2.eventName};${src.statement.nodeId}`;
|
|
33676
|
+
const handler = (...eventArgs) => {
|
|
33677
|
+
return runCodeAsync(src, uid, options2, ...cloneDeep(eventArgs));
|
|
33678
|
+
};
|
|
33679
|
+
if (options2 == null ? void 0 : options2.ephemeral) {
|
|
33680
|
+
return handler;
|
|
33681
|
+
}
|
|
33682
|
+
if (!((_b = fnsRef.current[uid]) == null ? void 0 : _b[fnCacheKey])) {
|
|
33683
|
+
fnsRef.current[uid] = fnsRef.current[uid] || {};
|
|
33684
|
+
fnsRef.current[uid][fnCacheKey] = handler;
|
|
33685
|
+
}
|
|
33686
|
+
return fnsRef.current[uid][fnCacheKey];
|
|
33687
|
+
}
|
|
33688
|
+
throw new Error("Invalid event handler");
|
|
33659
33689
|
}
|
|
33660
33690
|
);
|
|
33661
33691
|
const getOrCreateSyncCallbackFn = useCallback(
|
|
@@ -33943,6 +33973,12 @@ function renderLoaders({
|
|
|
33943
33973
|
);
|
|
33944
33974
|
}
|
|
33945
33975
|
}
|
|
33976
|
+
function isParsedEventValue(value) {
|
|
33977
|
+
return value.__PARSED === true;
|
|
33978
|
+
}
|
|
33979
|
+
function isArrowExpression(value) {
|
|
33980
|
+
return value.type === T_ARROW_EXPRESSION;
|
|
33981
|
+
}
|
|
33946
33982
|
const StateContainer = memo(
|
|
33947
33983
|
forwardRef(function StateContainer2({
|
|
33948
33984
|
node,
|
|
@@ -35663,7 +35699,7 @@ function ApiInterceptorProvider({
|
|
|
35663
35699
|
let interceptorWorker;
|
|
35664
35700
|
(async () => {
|
|
35665
35701
|
if (process.env.VITE_MOCK_ENABLED) {
|
|
35666
|
-
const { createApiInterceptorWorker } = await import("./apiInterceptorWorker-
|
|
35702
|
+
const { createApiInterceptorWorker } = await import("./apiInterceptorWorker-DJ9I-JAW.mjs");
|
|
35667
35703
|
if (interceptor) {
|
|
35668
35704
|
interceptorWorker = await createApiInterceptorWorker(interceptor, apiWorker);
|
|
35669
35705
|
if (!apiWorker) {
|
|
@@ -1552,7 +1552,11 @@ class Parser {
|
|
|
1552
1552
|
case TokenType.Function:
|
|
1553
1553
|
return this.parseFunctionDeclaration();
|
|
1554
1554
|
default:
|
|
1555
|
-
|
|
1555
|
+
if (this.isExpressionStart(startToken)) {
|
|
1556
|
+
return this.parseExpressionStatement(allowSequence);
|
|
1557
|
+
}
|
|
1558
|
+
this.reportError("W002", startToken, startToken.text);
|
|
1559
|
+
return null;
|
|
1556
1560
|
}
|
|
1557
1561
|
} finally {
|
|
1558
1562
|
this._statementLevel--;
|
|
@@ -3701,7 +3705,9 @@ class Parser {
|
|
|
3701
3705
|
}
|
|
3702
3706
|
this._parseErrors.push({
|
|
3703
3707
|
code: errorCode,
|
|
3704
|
-
text: errorText
|
|
3708
|
+
text: errorText,
|
|
3709
|
+
line: token.startLine,
|
|
3710
|
+
column: token.startColumn
|
|
3705
3711
|
});
|
|
3706
3712
|
throw new ParserError$1(errorText, errorCode);
|
|
3707
3713
|
function replace(input, placeholder, replacement) {
|
|
@@ -4808,8 +4814,7 @@ function parseScriptModule(moduleName, source) {
|
|
|
4808
4814
|
exports,
|
|
4809
4815
|
functions,
|
|
4810
4816
|
statements,
|
|
4811
|
-
sources: /* @__PURE__ */ new Map()
|
|
4812
|
-
executed: false
|
|
4817
|
+
sources: /* @__PURE__ */ new Map()
|
|
4813
4818
|
};
|
|
4814
4819
|
parsedModules.set(moduleName2, parsedModule2);
|
|
4815
4820
|
if (errors.length > 0) {
|
|
@@ -4864,7 +4869,7 @@ function collectCodeBehindFromSource(moduleName, source) {
|
|
|
4864
4869
|
addFunctionDeclaration(stmt);
|
|
4865
4870
|
break;
|
|
4866
4871
|
default:
|
|
4867
|
-
throw new Error(`
|
|
4872
|
+
throw new Error(`Only reactive variable and function definitions are allowed in a code-behind module.`);
|
|
4868
4873
|
}
|
|
4869
4874
|
});
|
|
4870
4875
|
return result;
|
|
@@ -4995,6 +5000,7 @@ const HelperNode = {
|
|
|
4995
5000
|
item: "item",
|
|
4996
5001
|
field: "field"
|
|
4997
5002
|
};
|
|
5003
|
+
let lastParseId = 0;
|
|
4998
5004
|
function nodeToComponentDef(node, originalGetText, fileId) {
|
|
4999
5005
|
const getText = (node2) => {
|
|
5000
5006
|
return node2.text ?? originalGetText(node2);
|
|
@@ -5202,7 +5208,7 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
5202
5208
|
(name, value) => {
|
|
5203
5209
|
if (!isComponent(comp)) return;
|
|
5204
5210
|
comp.events ?? (comp.events = {});
|
|
5205
|
-
comp.events[name] = value;
|
|
5211
|
+
comp.events[name] = parseEvent(value);
|
|
5206
5212
|
},
|
|
5207
5213
|
(name) => {
|
|
5208
5214
|
if (onPrefixRegex.test(name)) {
|
|
@@ -5311,11 +5317,11 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
5311
5317
|
comp.api[name] = value;
|
|
5312
5318
|
} else if (startSegment === "event") {
|
|
5313
5319
|
comp.events ?? (comp.events = {});
|
|
5314
|
-
comp.events[name] = value;
|
|
5320
|
+
comp.events[name] = parseEvent(value);
|
|
5315
5321
|
} else if (onPrefixRegex.test(name)) {
|
|
5316
5322
|
comp.events ?? (comp.events = {});
|
|
5317
5323
|
const eventName = name[2].toLowerCase() + name.substring(3);
|
|
5318
|
-
comp.events[eventName] = value;
|
|
5324
|
+
comp.events[eventName] = parseEvent(value);
|
|
5319
5325
|
} else {
|
|
5320
5326
|
comp.props ?? (comp.props = {});
|
|
5321
5327
|
comp.props[name] = value;
|
|
@@ -5734,6 +5740,27 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
5734
5740
|
}
|
|
5735
5741
|
}
|
|
5736
5742
|
}
|
|
5743
|
+
function parseEvent(value) {
|
|
5744
|
+
if (typeof value !== "string") {
|
|
5745
|
+
return value;
|
|
5746
|
+
}
|
|
5747
|
+
const parser = new Parser(value);
|
|
5748
|
+
try {
|
|
5749
|
+
const statements = parser.parseStatements();
|
|
5750
|
+
return {
|
|
5751
|
+
__PARSED: true,
|
|
5752
|
+
statements,
|
|
5753
|
+
parseId: ++lastParseId,
|
|
5754
|
+
// TODO: retrieve the event source code only in dev mode
|
|
5755
|
+
source: value
|
|
5756
|
+
};
|
|
5757
|
+
} catch {
|
|
5758
|
+
if (parser.errors.length > 0) {
|
|
5759
|
+
const errMsg = parser.errors[0];
|
|
5760
|
+
throw new ParserError2(`${errMsg.text} [${errMsg.line}: ${errMsg.column}]`, errMsg.code);
|
|
5761
|
+
}
|
|
5762
|
+
}
|
|
5763
|
+
}
|
|
5737
5764
|
}
|
|
5738
5765
|
function createTextNodeCDataElement(textValue) {
|
|
5739
5766
|
return {
|
|
@@ -160,6 +160,13 @@ exports.Container = (0, react_1.memo)((0, react_1.forwardRef)(function Container
|
|
|
160
160
|
}
|
|
161
161
|
statements = parsedStatementsRef.current[source];
|
|
162
162
|
}
|
|
163
|
+
else if (isParsedEventValue(source)) {
|
|
164
|
+
const parseId = source.parseId.toString();
|
|
165
|
+
if (!parsedStatementsRef.current[parseId]) {
|
|
166
|
+
parsedStatementsRef.current[parseId] = (0, statementUtils_1.prepareHandlerStatements)(source.statements, evalContext);
|
|
167
|
+
}
|
|
168
|
+
statements = parsedStatementsRef.current[parseId];
|
|
169
|
+
}
|
|
163
170
|
else {
|
|
164
171
|
statements = [
|
|
165
172
|
{
|
|
@@ -293,23 +300,48 @@ exports.Container = (0, react_1.memo)((0, react_1.forwardRef)(function Container
|
|
|
293
300
|
}
|
|
294
301
|
}, [appContext]);
|
|
295
302
|
const getOrCreateEventHandlerFn = (0, misc_1.useEvent)((src, uid, options) => {
|
|
296
|
-
var _a;
|
|
303
|
+
var _a, _b;
|
|
297
304
|
if (Array.isArray(src)) {
|
|
298
305
|
throw new Error("Multiple event handlers are not supported");
|
|
299
306
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
+
if (typeof src === "string") {
|
|
308
|
+
// --- We have a string event handler
|
|
309
|
+
const fnCacheKey = `${options === null || options === void 0 ? void 0 : options.eventName};${src}`;
|
|
310
|
+
const handler = (...eventArgs) => {
|
|
311
|
+
return runCodeAsync(src, uid, options, ...(0, lodash_es_1.cloneDeep)(eventArgs));
|
|
312
|
+
};
|
|
313
|
+
if (options === null || options === void 0 ? void 0 : options.ephemeral) {
|
|
314
|
+
return handler;
|
|
315
|
+
}
|
|
316
|
+
if (!((_a = fnsRef.current[uid]) === null || _a === void 0 ? void 0 : _a[fnCacheKey])) {
|
|
317
|
+
fnsRef.current[uid] = fnsRef.current[uid] || {};
|
|
318
|
+
fnsRef.current[uid][fnCacheKey] = handler;
|
|
319
|
+
}
|
|
320
|
+
return fnsRef.current[uid][fnCacheKey];
|
|
307
321
|
}
|
|
308
|
-
if (
|
|
309
|
-
|
|
310
|
-
|
|
322
|
+
if (isParsedEventValue(src)) {
|
|
323
|
+
// --- We have the syntax tree to execute, no need to cache
|
|
324
|
+
return (...eventArgs) => {
|
|
325
|
+
return runCodeAsync(src, uid, options, ...(0, lodash_es_1.cloneDeep)(eventArgs));
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
if (isArrowExpression(src)) {
|
|
329
|
+
// --- We have an arrow expression to execute
|
|
330
|
+
const fnCacheKey = `${options === null || options === void 0 ? void 0 : options.eventName};${src.statement.nodeId}`;
|
|
331
|
+
const handler = (...eventArgs) => {
|
|
332
|
+
return runCodeAsync(src, uid, options, ...(0, lodash_es_1.cloneDeep)(eventArgs));
|
|
333
|
+
};
|
|
334
|
+
if (options === null || options === void 0 ? void 0 : options.ephemeral) {
|
|
335
|
+
return handler;
|
|
336
|
+
}
|
|
337
|
+
if (!((_b = fnsRef.current[uid]) === null || _b === void 0 ? void 0 : _b[fnCacheKey])) {
|
|
338
|
+
fnsRef.current[uid] = fnsRef.current[uid] || {};
|
|
339
|
+
fnsRef.current[uid][fnCacheKey] = handler;
|
|
340
|
+
}
|
|
341
|
+
return fnsRef.current[uid][fnCacheKey];
|
|
311
342
|
}
|
|
312
|
-
|
|
343
|
+
// --- We have an unknown event handler
|
|
344
|
+
throw new Error("Invalid event handler");
|
|
313
345
|
});
|
|
314
346
|
const getOrCreateSyncCallbackFn = (0, react_1.useCallback)((arrowExpression, uid) => {
|
|
315
347
|
var _a;
|
|
@@ -565,3 +597,9 @@ function renderLoaders({ uidInfo, uidInfoRef, loaders = constants_1.EMPTY_ARRAY,
|
|
|
565
597
|
return ((0, jsx_runtime_1.jsx)(LoaderComponent_1.LoaderComponent, { onUnmount: cleanup, node: loader, state: componentState, dispatch: dispatch, registerComponentApi: registerComponentApi, lookupAction: lookupAction, lookupSyncCallback: lookupSyncCallback, memoedVarsRef: memoedVarsRef, appContext: appContext }));
|
|
566
598
|
}
|
|
567
599
|
}
|
|
600
|
+
function isParsedEventValue(value) {
|
|
601
|
+
return value.__PARSED === true;
|
|
602
|
+
}
|
|
603
|
+
function isArrowExpression(value) {
|
|
604
|
+
return value.type === ScriptingSourceTree_1.T_ARROW_EXPRESSION;
|
|
605
|
+
}
|
|
@@ -152,9 +152,11 @@ class Parser {
|
|
|
152
152
|
case TokenType_1.TokenType.Function:
|
|
153
153
|
return this.parseFunctionDeclaration();
|
|
154
154
|
default:
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
155
|
+
if (this.isExpressionStart(startToken)) {
|
|
156
|
+
return this.parseExpressionStatement(allowSequence);
|
|
157
|
+
}
|
|
158
|
+
this.reportError("W002", startToken, startToken.text);
|
|
159
|
+
return null;
|
|
158
160
|
}
|
|
159
161
|
}
|
|
160
162
|
finally {
|
|
@@ -2144,6 +2146,8 @@ class Parser {
|
|
|
2144
2146
|
this._parseErrors.push({
|
|
2145
2147
|
code: errorCode,
|
|
2146
2148
|
text: errorText,
|
|
2149
|
+
line: token.startLine,
|
|
2150
|
+
column: token.startColumn,
|
|
2147
2151
|
});
|
|
2148
2152
|
throw new ParserError_1.ParserError(errorText, errorCode);
|
|
2149
2153
|
function replace(input, placeholder, replacement) {
|
|
@@ -38,7 +38,7 @@ function collectCodeBehindFromSource(moduleName, source) {
|
|
|
38
38
|
addFunctionDeclaration(stmt);
|
|
39
39
|
break;
|
|
40
40
|
default:
|
|
41
|
-
throw new Error(`
|
|
41
|
+
throw new Error(`Only reactive variable and function definitions are allowed in a code-behind module.`);
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
return result;
|
|
@@ -28,6 +28,7 @@ const HelperNode = {
|
|
|
28
28
|
item: "item",
|
|
29
29
|
field: "field",
|
|
30
30
|
};
|
|
31
|
+
let lastParseId = 0;
|
|
31
32
|
function nodeToComponentDef(node, originalGetText, fileId) {
|
|
32
33
|
const getText = (node) => {
|
|
33
34
|
var _a;
|
|
@@ -249,7 +250,7 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
249
250
|
if (!isComponent(comp))
|
|
250
251
|
return;
|
|
251
252
|
(_a = comp.events) !== null && _a !== void 0 ? _a : (comp.events = {});
|
|
252
|
-
comp.events[name] = value;
|
|
253
|
+
comp.events[name] = parseEvent(value);
|
|
253
254
|
}, (name) => {
|
|
254
255
|
if (exports.onPrefixRegex.test(name)) {
|
|
255
256
|
reportError("T008", name);
|
|
@@ -354,12 +355,12 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
354
355
|
}
|
|
355
356
|
else if (startSegment === "event") {
|
|
356
357
|
(_c = comp.events) !== null && _c !== void 0 ? _c : (comp.events = {});
|
|
357
|
-
comp.events[name] = value;
|
|
358
|
+
comp.events[name] = parseEvent(value);
|
|
358
359
|
}
|
|
359
360
|
else if (exports.onPrefixRegex.test(name)) {
|
|
360
361
|
(_d = comp.events) !== null && _d !== void 0 ? _d : (comp.events = {});
|
|
361
362
|
const eventName = name[2].toLowerCase() + name.substring(3);
|
|
362
|
-
comp.events[eventName] = value;
|
|
363
|
+
comp.events[eventName] = parseEvent(value);
|
|
363
364
|
}
|
|
364
365
|
else {
|
|
365
366
|
(_e = comp.props) !== null && _e !== void 0 ? _e : (comp.props = {});
|
|
@@ -849,6 +850,30 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
849
850
|
}
|
|
850
851
|
}
|
|
851
852
|
}
|
|
853
|
+
function parseEvent(value) {
|
|
854
|
+
if (typeof value !== "string") {
|
|
855
|
+
// --- It must be a component definition in the event code
|
|
856
|
+
return value;
|
|
857
|
+
}
|
|
858
|
+
// --- Parse the event code
|
|
859
|
+
const parser = new Parser_1.Parser(value);
|
|
860
|
+
try {
|
|
861
|
+
const statements = parser.parseStatements();
|
|
862
|
+
return {
|
|
863
|
+
__PARSED: true,
|
|
864
|
+
statements,
|
|
865
|
+
parseId: ++lastParseId,
|
|
866
|
+
// TODO: retrieve the event source code only in dev mode
|
|
867
|
+
source: value,
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
catch (_a) {
|
|
871
|
+
if (parser.errors.length > 0) {
|
|
872
|
+
const errMsg = parser.errors[0];
|
|
873
|
+
throw new ParserError_1.ParserError(`${errMsg.text} [${errMsg.line}: ${errMsg.column}]`, errMsg.code);
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
}
|
|
852
877
|
}
|
|
853
878
|
function createTextNodeCDataElement(textValue) {
|
|
854
879
|
return {
|
package/dist/xmlui-metadata.mjs
CHANGED
|
@@ -8752,7 +8752,11 @@ class Parser {
|
|
|
8752
8752
|
case TokenType.Function:
|
|
8753
8753
|
return this.parseFunctionDeclaration();
|
|
8754
8754
|
default:
|
|
8755
|
-
|
|
8755
|
+
if (this.isExpressionStart(startToken)) {
|
|
8756
|
+
return this.parseExpressionStatement(allowSequence);
|
|
8757
|
+
}
|
|
8758
|
+
this.reportError("W002", startToken, startToken.text);
|
|
8759
|
+
return null;
|
|
8756
8760
|
}
|
|
8757
8761
|
} finally {
|
|
8758
8762
|
this._statementLevel--;
|
|
@@ -10901,7 +10905,9 @@ class Parser {
|
|
|
10901
10905
|
}
|
|
10902
10906
|
this._parseErrors.push({
|
|
10903
10907
|
code: errorCode,
|
|
10904
|
-
text: errorText
|
|
10908
|
+
text: errorText,
|
|
10909
|
+
line: token.startLine,
|
|
10910
|
+
column: token.startColumn
|
|
10905
10911
|
});
|
|
10906
10912
|
throw new ParserError$1(errorText, errorCode);
|
|
10907
10913
|
function replace(input2, placeholder2, replacement) {
|
|
@@ -18899,8 +18905,7 @@ function parseScriptModule(moduleName, source) {
|
|
|
18899
18905
|
exports,
|
|
18900
18906
|
functions,
|
|
18901
18907
|
statements,
|
|
18902
|
-
sources: /* @__PURE__ */ new Map()
|
|
18903
|
-
executed: false
|
|
18908
|
+
sources: /* @__PURE__ */ new Map()
|
|
18904
18909
|
};
|
|
18905
18910
|
parsedModules.set(moduleName2, parsedModule2);
|
|
18906
18911
|
if (errors.length > 0) {
|
|
@@ -18955,7 +18960,7 @@ function collectCodeBehindFromSource(moduleName, source) {
|
|
|
18955
18960
|
addFunctionDeclaration(stmt);
|
|
18956
18961
|
break;
|
|
18957
18962
|
default:
|
|
18958
|
-
throw new Error(`
|
|
18963
|
+
throw new Error(`Only reactive variable and function definitions are allowed in a code-behind module.`);
|
|
18959
18964
|
}
|
|
18960
18965
|
});
|
|
18961
18966
|
return result;
|
|
@@ -19060,6 +19065,7 @@ const HelperNode = {
|
|
|
19060
19065
|
item: "item",
|
|
19061
19066
|
field: "field"
|
|
19062
19067
|
};
|
|
19068
|
+
let lastParseId = 0;
|
|
19063
19069
|
function nodeToComponentDef(node, originalGetText, fileId) {
|
|
19064
19070
|
const getText = (node2) => {
|
|
19065
19071
|
return node2.text ?? originalGetText(node2);
|
|
@@ -19267,7 +19273,7 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
19267
19273
|
(name, value) => {
|
|
19268
19274
|
if (!isComponent(comp)) return;
|
|
19269
19275
|
comp.events ?? (comp.events = {});
|
|
19270
|
-
comp.events[name] = value;
|
|
19276
|
+
comp.events[name] = parseEvent(value);
|
|
19271
19277
|
},
|
|
19272
19278
|
(name) => {
|
|
19273
19279
|
if (onPrefixRegex.test(name)) {
|
|
@@ -19376,11 +19382,11 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
19376
19382
|
comp.api[name] = value;
|
|
19377
19383
|
} else if (startSegment === "event") {
|
|
19378
19384
|
comp.events ?? (comp.events = {});
|
|
19379
|
-
comp.events[name] = value;
|
|
19385
|
+
comp.events[name] = parseEvent(value);
|
|
19380
19386
|
} else if (onPrefixRegex.test(name)) {
|
|
19381
19387
|
comp.events ?? (comp.events = {});
|
|
19382
19388
|
const eventName = name[2].toLowerCase() + name.substring(3);
|
|
19383
|
-
comp.events[eventName] = value;
|
|
19389
|
+
comp.events[eventName] = parseEvent(value);
|
|
19384
19390
|
} else {
|
|
19385
19391
|
comp.props ?? (comp.props = {});
|
|
19386
19392
|
comp.props[name] = value;
|
|
@@ -19799,6 +19805,27 @@ function nodeToComponentDef(node, originalGetText, fileId) {
|
|
|
19799
19805
|
}
|
|
19800
19806
|
}
|
|
19801
19807
|
}
|
|
19808
|
+
function parseEvent(value) {
|
|
19809
|
+
if (typeof value !== "string") {
|
|
19810
|
+
return value;
|
|
19811
|
+
}
|
|
19812
|
+
const parser = new Parser(value);
|
|
19813
|
+
try {
|
|
19814
|
+
const statements = parser.parseStatements();
|
|
19815
|
+
return {
|
|
19816
|
+
__PARSED: true,
|
|
19817
|
+
statements,
|
|
19818
|
+
parseId: ++lastParseId,
|
|
19819
|
+
// TODO: retrieve the event source code only in dev mode
|
|
19820
|
+
source: value
|
|
19821
|
+
};
|
|
19822
|
+
} catch {
|
|
19823
|
+
if (parser.errors.length > 0) {
|
|
19824
|
+
const errMsg = parser.errors[0];
|
|
19825
|
+
throw new ParserError2(`${errMsg.text} [${errMsg.line}: ${errMsg.column}]`, errMsg.code);
|
|
19826
|
+
}
|
|
19827
|
+
}
|
|
19828
|
+
}
|
|
19802
19829
|
}
|
|
19803
19830
|
function createTextNodeCDataElement(textValue) {
|
|
19804
19831
|
return {
|
|
@@ -8751,7 +8751,11 @@
|
|
|
8751
8751
|
case TokenType.Function:
|
|
8752
8752
|
return this.parseFunctionDeclaration();
|
|
8753
8753
|
default:
|
|
8754
|
-
|
|
8754
|
+
if (this.isExpressionStart(startToken)) {
|
|
8755
|
+
return this.parseExpressionStatement(allowSequence);
|
|
8756
|
+
}
|
|
8757
|
+
this.reportError("W002", startToken, startToken.text);
|
|
8758
|
+
return null;
|
|
8755
8759
|
}
|
|
8756
8760
|
} finally {
|
|
8757
8761
|
this._statementLevel--;
|
|
@@ -10900,7 +10904,9 @@
|
|
|
10900
10904
|
}
|
|
10901
10905
|
this._parseErrors.push({
|
|
10902
10906
|
code: errorCode,
|
|
10903
|
-
text: errorText
|
|
10907
|
+
text: errorText,
|
|
10908
|
+
line: token.startLine,
|
|
10909
|
+
column: token.startColumn
|
|
10904
10910
|
});
|
|
10905
10911
|
throw new ParserError$1(errorText, errorCode);
|
|
10906
10912
|
function replace(input2, placeholder2, replacement) {
|
|
@@ -18898,8 +18904,7 @@
|
|
|
18898
18904
|
exports: exports2,
|
|
18899
18905
|
functions,
|
|
18900
18906
|
statements,
|
|
18901
|
-
sources: /* @__PURE__ */ new Map()
|
|
18902
|
-
executed: false
|
|
18907
|
+
sources: /* @__PURE__ */ new Map()
|
|
18903
18908
|
};
|
|
18904
18909
|
parsedModules.set(moduleName2, parsedModule2);
|
|
18905
18910
|
if (errors.length > 0) {
|
|
@@ -18954,7 +18959,7 @@
|
|
|
18954
18959
|
addFunctionDeclaration(stmt);
|
|
18955
18960
|
break;
|
|
18956
18961
|
default:
|
|
18957
|
-
throw new Error(`
|
|
18962
|
+
throw new Error(`Only reactive variable and function definitions are allowed in a code-behind module.`);
|
|
18958
18963
|
}
|
|
18959
18964
|
});
|
|
18960
18965
|
return result;
|
|
@@ -19059,6 +19064,7 @@
|
|
|
19059
19064
|
item: "item",
|
|
19060
19065
|
field: "field"
|
|
19061
19066
|
};
|
|
19067
|
+
let lastParseId = 0;
|
|
19062
19068
|
function nodeToComponentDef(node, originalGetText, fileId) {
|
|
19063
19069
|
const getText = (node2) => {
|
|
19064
19070
|
return node2.text ?? originalGetText(node2);
|
|
@@ -19266,7 +19272,7 @@
|
|
|
19266
19272
|
(name, value) => {
|
|
19267
19273
|
if (!isComponent(comp)) return;
|
|
19268
19274
|
comp.events ?? (comp.events = {});
|
|
19269
|
-
comp.events[name] = value;
|
|
19275
|
+
comp.events[name] = parseEvent(value);
|
|
19270
19276
|
},
|
|
19271
19277
|
(name) => {
|
|
19272
19278
|
if (onPrefixRegex.test(name)) {
|
|
@@ -19375,11 +19381,11 @@
|
|
|
19375
19381
|
comp.api[name] = value;
|
|
19376
19382
|
} else if (startSegment === "event") {
|
|
19377
19383
|
comp.events ?? (comp.events = {});
|
|
19378
|
-
comp.events[name] = value;
|
|
19384
|
+
comp.events[name] = parseEvent(value);
|
|
19379
19385
|
} else if (onPrefixRegex.test(name)) {
|
|
19380
19386
|
comp.events ?? (comp.events = {});
|
|
19381
19387
|
const eventName = name[2].toLowerCase() + name.substring(3);
|
|
19382
|
-
comp.events[eventName] = value;
|
|
19388
|
+
comp.events[eventName] = parseEvent(value);
|
|
19383
19389
|
} else {
|
|
19384
19390
|
comp.props ?? (comp.props = {});
|
|
19385
19391
|
comp.props[name] = value;
|
|
@@ -19798,6 +19804,27 @@
|
|
|
19798
19804
|
}
|
|
19799
19805
|
}
|
|
19800
19806
|
}
|
|
19807
|
+
function parseEvent(value) {
|
|
19808
|
+
if (typeof value !== "string") {
|
|
19809
|
+
return value;
|
|
19810
|
+
}
|
|
19811
|
+
const parser = new Parser(value);
|
|
19812
|
+
try {
|
|
19813
|
+
const statements = parser.parseStatements();
|
|
19814
|
+
return {
|
|
19815
|
+
__PARSED: true,
|
|
19816
|
+
statements,
|
|
19817
|
+
parseId: ++lastParseId,
|
|
19818
|
+
// TODO: retrieve the event source code only in dev mode
|
|
19819
|
+
source: value
|
|
19820
|
+
};
|
|
19821
|
+
} catch {
|
|
19822
|
+
if (parser.errors.length > 0) {
|
|
19823
|
+
const errMsg = parser.errors[0];
|
|
19824
|
+
throw new ParserError(`${errMsg.text} [${errMsg.line}: ${errMsg.column}]`, errMsg.code);
|
|
19825
|
+
}
|
|
19826
|
+
}
|
|
19827
|
+
}
|
|
19801
19828
|
}
|
|
19802
19829
|
function createTextNodeCDataElement(textValue) {
|
|
19803
19830
|
return {
|
package/dist/xmlui-parser.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { C, o, k, i, n, h, l, a, m, j, f, e, g, b, D, E, S, q, c, d, x, u, r, t, s, p, w, v } from "./parser-B3m9ZEAK.mjs";
|
|
2
|
-
import { am as COMPOUND_COMP_ID } from "./lint-
|
|
3
|
-
import { au, ao, ag, aq, as, ae, ad, ar, af, ap, ah, aj, an, a5, at, ai } from "./lint-
|
|
2
|
+
import { am as COMPOUND_COMP_ID } from "./lint-B9tKGcOX.mjs";
|
|
3
|
+
import { au, ao, ag, aq, as, ae, ad, ar, af, ap, ah, aj, an, a5, at, ai } from "./lint-B9tKGcOX.mjs";
|
|
4
4
|
const attrBreakRegex = /[\r\n<>'"&]/;
|
|
5
5
|
class XmlUiHelper {
|
|
6
6
|
/**
|
|
@@ -16008,7 +16008,7 @@ li ._htmlOl_1wzn5_205 {
|
|
|
16008
16008
|
});
|
|
16009
16009
|
}
|
|
16010
16010
|
}
|
|
16011
|
-
var define_process_env_default$9 = { NODE_ENV: "production", VITE_MOCK_ENABLED: true, VITE_MOCK_WORKER_LOCATION: "mockApi.js", VITE_USED_COMPONENTS_Pdf: "false", VITE_USED_COMPONENTS_Chart: "false", VITE_USER_COMPONENTS_XmluiCodeHightlighter: "false", VITE_USED_COMPONENTS_Tree: "false", VITE_XMLUI_VERSION: "0.9.
|
|
16011
|
+
var define_process_env_default$9 = { NODE_ENV: "production", VITE_MOCK_ENABLED: true, VITE_MOCK_WORKER_LOCATION: "mockApi.js", VITE_USED_COMPONENTS_Pdf: "false", VITE_USED_COMPONENTS_Chart: "false", VITE_USER_COMPONENTS_XmluiCodeHightlighter: "false", VITE_USED_COMPONENTS_Tree: "false", VITE_XMLUI_VERSION: "0.9.7 (built 4/7/2025)" };
|
|
16012
16012
|
class Mutation extends Removable {
|
|
16013
16013
|
constructor(config2) {
|
|
16014
16014
|
super();
|
|
@@ -40381,7 +40381,11 @@ ${error2.errorObject}`;
|
|
|
40381
40381
|
case TokenType$1.Function:
|
|
40382
40382
|
return this.parseFunctionDeclaration();
|
|
40383
40383
|
default:
|
|
40384
|
-
|
|
40384
|
+
if (this.isExpressionStart(startToken)) {
|
|
40385
|
+
return this.parseExpressionStatement(allowSequence);
|
|
40386
|
+
}
|
|
40387
|
+
this.reportError("W002", startToken, startToken.text);
|
|
40388
|
+
return null;
|
|
40385
40389
|
}
|
|
40386
40390
|
} finally {
|
|
40387
40391
|
this._statementLevel--;
|
|
@@ -42530,7 +42534,9 @@ ${error2.errorObject}`;
|
|
|
42530
42534
|
}
|
|
42531
42535
|
this._parseErrors.push({
|
|
42532
42536
|
code: errorCode,
|
|
42533
|
-
text: errorText
|
|
42537
|
+
text: errorText,
|
|
42538
|
+
line: token.startLine,
|
|
42539
|
+
column: token.startColumn
|
|
42534
42540
|
});
|
|
42535
42541
|
throw new ParserError$1(errorText, errorCode);
|
|
42536
42542
|
function replace2(input2, placeholder2, replacement) {
|
|
@@ -124893,8 +124899,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
124893
124899
|
exports,
|
|
124894
124900
|
functions,
|
|
124895
124901
|
statements,
|
|
124896
|
-
sources: /* @__PURE__ */ new Map()
|
|
124897
|
-
executed: false
|
|
124902
|
+
sources: /* @__PURE__ */ new Map()
|
|
124898
124903
|
};
|
|
124899
124904
|
parsedModules.set(moduleName2, parsedModule2);
|
|
124900
124905
|
if (errors.length > 0) {
|
|
@@ -124949,7 +124954,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
124949
124954
|
addFunctionDeclaration(stmt);
|
|
124950
124955
|
break;
|
|
124951
124956
|
default:
|
|
124952
|
-
throw new Error(`
|
|
124957
|
+
throw new Error(`Only reactive variable and function definitions are allowed in a code-behind module.`);
|
|
124953
124958
|
}
|
|
124954
124959
|
});
|
|
124955
124960
|
return result;
|
|
@@ -125080,6 +125085,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
125080
125085
|
item: "item",
|
|
125081
125086
|
field: "field"
|
|
125082
125087
|
};
|
|
125088
|
+
let lastParseId = 0;
|
|
125083
125089
|
function nodeToComponentDef(node2, originalGetText, fileId) {
|
|
125084
125090
|
const getText = (node22) => {
|
|
125085
125091
|
return node22.text ?? originalGetText(node22);
|
|
@@ -125287,7 +125293,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
125287
125293
|
(name2, value) => {
|
|
125288
125294
|
if (!isComponent(comp)) return;
|
|
125289
125295
|
comp.events ?? (comp.events = {});
|
|
125290
|
-
comp.events[name2] = value;
|
|
125296
|
+
comp.events[name2] = parseEvent(value);
|
|
125291
125297
|
},
|
|
125292
125298
|
(name2) => {
|
|
125293
125299
|
if (onPrefixRegex.test(name2)) {
|
|
@@ -125396,11 +125402,11 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
125396
125402
|
comp.api[name2] = value;
|
|
125397
125403
|
} else if (startSegment === "event") {
|
|
125398
125404
|
comp.events ?? (comp.events = {});
|
|
125399
|
-
comp.events[name2] = value;
|
|
125405
|
+
comp.events[name2] = parseEvent(value);
|
|
125400
125406
|
} else if (onPrefixRegex.test(name2)) {
|
|
125401
125407
|
comp.events ?? (comp.events = {});
|
|
125402
125408
|
const eventName = name2[2].toLowerCase() + name2.substring(3);
|
|
125403
|
-
comp.events[eventName] = value;
|
|
125409
|
+
comp.events[eventName] = parseEvent(value);
|
|
125404
125410
|
} else {
|
|
125405
125411
|
comp.props ?? (comp.props = {});
|
|
125406
125412
|
comp.props[name2] = value;
|
|
@@ -125819,6 +125825,27 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
125819
125825
|
}
|
|
125820
125826
|
}
|
|
125821
125827
|
}
|
|
125828
|
+
function parseEvent(value) {
|
|
125829
|
+
if (typeof value !== "string") {
|
|
125830
|
+
return value;
|
|
125831
|
+
}
|
|
125832
|
+
const parser = new Parser$2(value);
|
|
125833
|
+
try {
|
|
125834
|
+
const statements = parser.parseStatements();
|
|
125835
|
+
return {
|
|
125836
|
+
__PARSED: true,
|
|
125837
|
+
statements,
|
|
125838
|
+
parseId: ++lastParseId,
|
|
125839
|
+
// TODO: retrieve the event source code only in dev mode
|
|
125840
|
+
source: value
|
|
125841
|
+
};
|
|
125842
|
+
} catch {
|
|
125843
|
+
if (parser.errors.length > 0) {
|
|
125844
|
+
const errMsg = parser.errors[0];
|
|
125845
|
+
throw new ParserError(`${errMsg.text} [${errMsg.line}: ${errMsg.column}]`, errMsg.code);
|
|
125846
|
+
}
|
|
125847
|
+
}
|
|
125848
|
+
}
|
|
125822
125849
|
}
|
|
125823
125850
|
function createTextNodeCDataElement(textValue) {
|
|
125824
125851
|
return {
|
|
@@ -144740,7 +144767,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
144740
144767
|
/* @__PURE__ */ jsxRuntimeExports.jsx("svg", { style: { display: "none" }, ref: spriteRootRef })
|
|
144741
144768
|
] });
|
|
144742
144769
|
}
|
|
144743
|
-
const version = "0.9.
|
|
144770
|
+
const version = "0.9.7";
|
|
144744
144771
|
const ApiInterceptorContext = reactExports.createContext(null);
|
|
144745
144772
|
function useApiInterceptorContext() {
|
|
144746
144773
|
return reactExports.useContext(ApiInterceptorContext);
|
|
@@ -146591,6 +146618,15 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
146591
146618
|
);
|
|
146592
146619
|
}
|
|
146593
146620
|
statements = parsedStatementsRef.current[source];
|
|
146621
|
+
} else if (isParsedEventValue(source)) {
|
|
146622
|
+
const parseId = source.parseId.toString();
|
|
146623
|
+
if (!parsedStatementsRef.current[parseId]) {
|
|
146624
|
+
parsedStatementsRef.current[parseId] = prepareHandlerStatements(
|
|
146625
|
+
source.statements,
|
|
146626
|
+
evalContext
|
|
146627
|
+
);
|
|
146628
|
+
}
|
|
146629
|
+
statements = parsedStatementsRef.current[parseId];
|
|
146594
146630
|
} else {
|
|
146595
146631
|
statements = [
|
|
146596
146632
|
{
|
|
@@ -146708,23 +146744,44 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
146708
146744
|
);
|
|
146709
146745
|
const getOrCreateEventHandlerFn = useEvent(
|
|
146710
146746
|
(src, uid, options2) => {
|
|
146711
|
-
var _a4;
|
|
146747
|
+
var _a4, _b2;
|
|
146712
146748
|
if (Array.isArray(src)) {
|
|
146713
146749
|
throw new Error("Multiple event handlers are not supported");
|
|
146714
146750
|
}
|
|
146715
|
-
|
|
146716
|
-
|
|
146717
|
-
|
|
146718
|
-
|
|
146719
|
-
|
|
146720
|
-
|
|
146721
|
-
|
|
146751
|
+
if (typeof src === "string") {
|
|
146752
|
+
const fnCacheKey = `${options2 == null ? void 0 : options2.eventName};${src}`;
|
|
146753
|
+
const handler = (...eventArgs) => {
|
|
146754
|
+
return runCodeAsync(src, uid, options2, ...cloneDeep(eventArgs));
|
|
146755
|
+
};
|
|
146756
|
+
if (options2 == null ? void 0 : options2.ephemeral) {
|
|
146757
|
+
return handler;
|
|
146758
|
+
}
|
|
146759
|
+
if (!((_a4 = fnsRef.current[uid]) == null ? void 0 : _a4[fnCacheKey])) {
|
|
146760
|
+
fnsRef.current[uid] = fnsRef.current[uid] || {};
|
|
146761
|
+
fnsRef.current[uid][fnCacheKey] = handler;
|
|
146762
|
+
}
|
|
146763
|
+
return fnsRef.current[uid][fnCacheKey];
|
|
146722
146764
|
}
|
|
146723
|
-
if (
|
|
146724
|
-
|
|
146725
|
-
|
|
146765
|
+
if (isParsedEventValue(src)) {
|
|
146766
|
+
return (...eventArgs) => {
|
|
146767
|
+
return runCodeAsync(src, uid, options2, ...cloneDeep(eventArgs));
|
|
146768
|
+
};
|
|
146726
146769
|
}
|
|
146727
|
-
|
|
146770
|
+
if (isArrowExpression(src)) {
|
|
146771
|
+
const fnCacheKey = `${options2 == null ? void 0 : options2.eventName};${src.statement.nodeId}`;
|
|
146772
|
+
const handler = (...eventArgs) => {
|
|
146773
|
+
return runCodeAsync(src, uid, options2, ...cloneDeep(eventArgs));
|
|
146774
|
+
};
|
|
146775
|
+
if (options2 == null ? void 0 : options2.ephemeral) {
|
|
146776
|
+
return handler;
|
|
146777
|
+
}
|
|
146778
|
+
if (!((_b2 = fnsRef.current[uid]) == null ? void 0 : _b2[fnCacheKey])) {
|
|
146779
|
+
fnsRef.current[uid] = fnsRef.current[uid] || {};
|
|
146780
|
+
fnsRef.current[uid][fnCacheKey] = handler;
|
|
146781
|
+
}
|
|
146782
|
+
return fnsRef.current[uid][fnCacheKey];
|
|
146783
|
+
}
|
|
146784
|
+
throw new Error("Invalid event handler");
|
|
146728
146785
|
}
|
|
146729
146786
|
);
|
|
146730
146787
|
const getOrCreateSyncCallbackFn = reactExports.useCallback(
|
|
@@ -147012,6 +147069,12 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
147012
147069
|
);
|
|
147013
147070
|
}
|
|
147014
147071
|
}
|
|
147072
|
+
function isParsedEventValue(value) {
|
|
147073
|
+
return value.__PARSED === true;
|
|
147074
|
+
}
|
|
147075
|
+
function isArrowExpression(value) {
|
|
147076
|
+
return value.type === T_ARROW_EXPRESSION;
|
|
147077
|
+
}
|
|
147015
147078
|
const StateContainer = reactExports.memo(
|
|
147016
147079
|
reactExports.forwardRef(function StateContainer2({
|
|
147017
147080
|
node: node2,
|
|
@@ -149503,7 +149566,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
149503
149566
|
ToneChangerButton: ToneChangerButtonMd,
|
|
149504
149567
|
Tree: TreeMd
|
|
149505
149568
|
};
|
|
149506
|
-
var define_process_env_default$2 = { VITE_XMLUI_VERSION: "0.9.
|
|
149569
|
+
var define_process_env_default$2 = { VITE_XMLUI_VERSION: "0.9.7 (built 4/7/2025)" };
|
|
149507
149570
|
const MAIN_FILE = "Main." + componentFileExtension;
|
|
149508
149571
|
const MAIN_CODE_BEHIND_FILE = "Main." + codeBehindFileExtension;
|
|
149509
149572
|
const CONFIG_FILE = "config.json";
|
|
@@ -153825,7 +153888,7 @@ For more information, see https://radix-ui.com/primitives/docs/components/${titl
|
|
|
153825
153888
|
function isResponseWithoutBody(status) {
|
|
153826
153889
|
return RESPONSE_STATUS_CODES_WITHOUT_BODY.has(status);
|
|
153827
153890
|
}
|
|
153828
|
-
var define_process_env_default$1 = { NODE_ENV: "production", VITE_MOCK_ENABLED: true, VITE_MOCK_WORKER_LOCATION: "mockApi.js", VITE_USED_COMPONENTS_Pdf: "false", VITE_USED_COMPONENTS_Chart: "false", VITE_USER_COMPONENTS_XmluiCodeHightlighter: "false", VITE_USED_COMPONENTS_Tree: "false", VITE_XMLUI_VERSION: "0.9.
|
|
153891
|
+
var define_process_env_default$1 = { NODE_ENV: "production", VITE_MOCK_ENABLED: true, VITE_MOCK_WORKER_LOCATION: "mockApi.js", VITE_USED_COMPONENTS_Pdf: "false", VITE_USED_COMPONENTS_Chart: "false", VITE_USER_COMPONENTS_XmluiCodeHightlighter: "false", VITE_USED_COMPONENTS_Tree: "false", VITE_XMLUI_VERSION: "0.9.7 (built 4/7/2025)" };
|
|
153829
153892
|
var __defProp$7 = Object.defineProperty;
|
|
153830
153893
|
var __export = (target2, all2) => {
|
|
153831
153894
|
for (var name2 in all2)
|
package/dist/xmlui.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xmlui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start-test-bed": "cd src/testing/infrastructure && xmlui start",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"build:xmlui-metadata": "vite build --mode metadata",
|
|
12
12
|
"build:ext-meta": "node scripts/build-extension-packages/build-extension-packages.mjs",
|
|
13
13
|
"build": "rimraf dist && tsc && npm run build:bin && npm run build:xmlui-metadata && npm run build:xmlui && npm run build:xmlui-standalone",
|
|
14
|
-
"build:extensions": "cd ../packages/xmlui-animations && npm run build && cd ../xmlui-charts && npm run build && cd ../xmlui-pdf && npm run build",
|
|
14
|
+
"build:extensions": "cd ../packages/xmlui-animations && npm run build && cd ../xmlui-charts && npm run build && cd ../xmlui-pdf && npm run build && cd ../xmlui-spreadsheet && npm run build",
|
|
15
15
|
"test": "npm run test:unit",
|
|
16
16
|
"test:unit": "vitest run",
|
|
17
17
|
"test:e2e": "playwright test",
|