xmlui 0.10.26 → 0.11.1
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/lib/{index-DHXWMb-6.mjs → index-CEq6OdjV.js} +263 -643
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-TxnkId6_.mjs → initMock-DhUnLKrR.js} +1 -1
- package/dist/lib/{language-server-web-worker.mjs → language-server-web-worker.js} +1 -1
- package/dist/lib/{language-server.mjs → language-server.js} +1 -1
- package/dist/lib/{metadata-utils-DXUdlyja.mjs → metadata-utils-D27cn-XB.js} +1 -1
- package/dist/lib/{server-common-CtpN0Z4h.mjs → server-common-2DaoOOL5.js} +625 -616
- package/dist/lib/testing.d.ts +2011 -0
- package/dist/lib/testing.js +2386 -0
- package/dist/lib/vite-xmlui-plugin/index.js +13968 -0
- package/dist/lib/vite-xmlui-plugin/package.json +3 -0
- package/dist/lib/xmlui-parser-BZZ430Wm.js +523 -0
- package/dist/lib/xmlui-parser.d.ts +2 -1
- package/dist/lib/{xmlui-parser.mjs → xmlui-parser.js} +2 -2
- package/dist/lib/{xmlui-serializer-uCYa8_tZ.mjs → xmlui-serializer-D9D2mQ8m.js} +1 -1
- package/dist/lib/xmlui.d.ts +1 -0
- package/dist/lib/{xmlui.mjs → xmlui.js} +24 -23
- package/dist/metadata/{collectedComponentMetadata-BgHIc2Iu.mjs → collectedComponentMetadata-BAI5eK2v.js} +698 -567
- package/dist/metadata/{initMock-B3UDa-rw.mjs → initMock-CekNG5Ax.js} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/{xmlui-metadata.mjs → xmlui-metadata.js} +1 -1
- package/dist/metadata/xmlui-metadata.umd.cjs +207 -0
- package/dist/scripts/bin/bootstrap.cjs +4 -0
- package/dist/scripts/bin/index.js +85 -13
- package/dist/scripts/package.json +30 -22
- package/dist/scripts/src/components/App/App.spec.js +27 -15
- package/dist/scripts/src/components/Avatar/Avatar.spec.js +0 -29
- package/dist/scripts/src/components/Button/Button.spec.js +0 -29
- package/dist/scripts/src/components/Charts/BarChart/BarChartNative.js +2 -0
- package/dist/scripts/src/components/Charts/LineChart/LineChartNative.js +2 -2
- package/dist/scripts/src/components/Charts/Tooltip/TooltipContent.spec.js +8 -6
- package/dist/scripts/src/components/Form/Form.js +19 -0
- package/dist/scripts/src/components/Form/Form.spec.js +444 -0
- package/dist/scripts/src/components/Form/FormNative.js +46 -15
- package/dist/scripts/src/components/Form/formActions.js +3 -2
- package/dist/scripts/src/components/FormItem/FormItem.js +10 -2
- package/dist/scripts/src/components/FormItem/FormItem.spec.js +159 -0
- package/dist/scripts/src/components/FormItem/FormItemNative.js +6 -5
- package/dist/scripts/src/components/Heading/Heading.spec.js +34 -47
- package/dist/scripts/src/components/Queue/Queue.js +1 -16
- package/dist/scripts/src/components/Queue/QueueNative.js +60 -2
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +7 -5
- package/dist/scripts/src/components-core/appContext/misc-utils.js +2 -1
- package/dist/scripts/src/components-core/devtools/InspectorDialog.js +2 -2
- package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +2 -0
- package/dist/scripts/src/components-core/utils/base64-utils.js +2 -0
- package/dist/scripts/src/components-core/utils/misc.js +44 -0
- package/dist/scripts/src/language-server/server-common.js +2 -2
- package/dist/scripts/src/language-server/{xmlui-metadata-generated.mjs → xmlui-metadata-generated.js} +625 -615
- package/dist/scripts/src/testing/drivers/index.js +9 -0
- package/dist/scripts/src/testing/index.js +69 -0
- package/dist/standalone/xmlui-standalone.es.d.ts +32 -16
- package/dist/standalone/xmlui-standalone.umd.js +36 -36
- package/package.json +45 -37
- package/dist/metadata/xmlui-metadata.umd.js +0 -207
- package/dist/scripts/bin/bootstrap.js +0 -11
- /package/dist/lib/{apiInterceptorWorker-QiltRtq1.mjs → apiInterceptorWorker-QiltRtq1.js} +0 -0
- /package/dist/lib/{syntax-monaco.mjs → syntax-monaco.js} +0 -0
- /package/dist/lib/{syntax-textmate.mjs → syntax-textmate.js} +0 -0
- /package/dist/lib/{transform-Tooy42EB.mjs → transform-Tooy42EB.js} +0 -0
- /package/dist/metadata/{apiInterceptorWorker-Dql7QGw2.mjs → apiInterceptorWorker-Dql7QGw2.js} +0 -0
|
@@ -165,6 +165,14 @@ exports.FormItemMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
165
165
|
valueType: "string",
|
|
166
166
|
defaultValue: FormItemNative_1.defaultProps.gap,
|
|
167
167
|
},
|
|
168
|
+
noSubmit: {
|
|
169
|
+
description: "When set to `true`, the field will not be included in the form's submitted data. " +
|
|
170
|
+
"This is useful for fields that should be present in the form but not submitted, " +
|
|
171
|
+
"similar to hidden fields. If multiple FormItems reference the same `bindTo` value " +
|
|
172
|
+
"and any of them has `noSubmit` set to `true`, the field will NOT be submitted.",
|
|
173
|
+
type: "boolean",
|
|
174
|
+
defaultValue: FormItemNative_1.defaultProps.noSubmit,
|
|
175
|
+
},
|
|
168
176
|
},
|
|
169
177
|
events: {
|
|
170
178
|
validate: (0, metadata_helpers_1.d)(`This event is used to define a custom validation function.`),
|
|
@@ -204,7 +212,7 @@ exports.FormItemMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
204
212
|
});
|
|
205
213
|
exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.FormItemMd, ({ node, renderChild, extractValue, className, layoutContext, lookupEventHandler, lookupAction, registerComponentApi, }) => {
|
|
206
214
|
var _a;
|
|
207
|
-
const _b = node.props, { bindTo, autoFocus, label, labelPosition, labelWidth, labelBreak, enabled, required, type, requiredInvalidMessage, minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity, minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity, pattern, patternInvalidMessage, patternInvalidSeverity, regex, regexInvalidMessage, regexInvalidSeverity, customValidationsDebounce, validationMode, maxTextLength, gap } = _b, rest = __rest(_b, ["bindTo", "autoFocus", "label", "labelPosition", "labelWidth", "labelBreak", "enabled", "required", "type", "requiredInvalidMessage", "minLength", "maxLength", "lengthInvalidMessage", "lengthInvalidSeverity", "minValue", "maxValue", "rangeInvalidMessage", "rangeInvalidSeverity", "pattern", "patternInvalidMessage", "patternInvalidSeverity", "regex", "regexInvalidMessage", "regexInvalidSeverity", "customValidationsDebounce", "validationMode", "maxTextLength", "gap"]);
|
|
215
|
+
const _b = node.props, { bindTo, autoFocus, label, labelPosition, labelWidth, labelBreak, enabled, required, type, requiredInvalidMessage, minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity, minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity, pattern, patternInvalidMessage, patternInvalidSeverity, regex, regexInvalidMessage, regexInvalidSeverity, customValidationsDebounce, validationMode, maxTextLength, gap, noSubmit } = _b, rest = __rest(_b, ["bindTo", "autoFocus", "label", "labelPosition", "labelWidth", "labelBreak", "enabled", "required", "type", "requiredInvalidMessage", "minLength", "maxLength", "lengthInvalidMessage", "lengthInvalidSeverity", "minValue", "maxValue", "rangeInvalidMessage", "rangeInvalidSeverity", "pattern", "patternInvalidMessage", "patternInvalidSeverity", "regex", "regexInvalidMessage", "regexInvalidSeverity", "customValidationsDebounce", "validationMode", "maxTextLength", "gap", "noSubmit"]);
|
|
208
216
|
const resolvedRestProps = extractValue(rest);
|
|
209
217
|
const formItemType = extractValue.asOptionalString(type);
|
|
210
218
|
const isCustomFormItem = (formItemType === undefined || formItemType === "custom") && !!node.children;
|
|
@@ -215,7 +223,7 @@ exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COM
|
|
|
215
223
|
// --- validation props
|
|
216
224
|
required: extractValue.asOptionalBoolean(required), requiredInvalidMessage: extractValue.asOptionalString(requiredInvalidMessage), minLength: extractValue.asOptionalNumber(minLength), maxLength: extractValue.asOptionalNumber(maxLength), lengthInvalidMessage: extractValue.asOptionalString(lengthInvalidMessage), lengthInvalidSeverity: (0, Validations_1.parseSeverity)(extractValue.asOptionalString(lengthInvalidSeverity)), minValue: extractValue.asOptionalNumber(minValue), maxValue: extractValue.asOptionalNumber(maxValue), rangeInvalidMessage: extractValue.asOptionalString(rangeInvalidMessage), rangeInvalidSeverity: (0, Validations_1.parseSeverity)(extractValue.asOptionalString(rangeInvalidSeverity)), pattern: extractValue.asOptionalString(pattern), patternInvalidMessage: extractValue.asOptionalString(patternInvalidMessage), patternInvalidSeverity: (0, Validations_1.parseSeverity)(extractValue.asOptionalString(patternInvalidSeverity)), regex: extractValue.asOptionalString(regex), regexInvalidMessage: extractValue.asOptionalString(regexInvalidMessage), regexInvalidSeverity: (0, Validations_1.parseSeverity)(extractValue.asOptionalString(regexInvalidSeverity)),
|
|
217
225
|
// ----
|
|
218
|
-
className: className, layoutContext: layoutContext, labelBreak: extractValue.asOptionalBoolean(labelBreak), labelWidth: extractValue.asOptionalString(labelWidth), bindTo: extractValue.asString(bindTo), autoFocus: extractValue.asOptionalBoolean(autoFocus), enabled: extractValue.asOptionalBoolean(enabled), label: extractValue.asOptionalString(label), labelPosition: extractValue.asOptionalString(labelPosition), type: isCustomFormItem ? "custom" : formItemType, onValidate: lookupEventHandler("validate"), customValidationsDebounce: extractValue.asOptionalNumber(customValidationsDebounce), validationMode: extractValue.asOptionalString(validationMode), registerComponentApi: registerComponentApi, maxTextLength: extractValue(maxTextLength), itemIndex: extractValue("{$itemIndex}"), initialValue: extractValue(node.props.initialValue), inputRenderer: inputTemplate
|
|
226
|
+
className: className, layoutContext: layoutContext, labelBreak: extractValue.asOptionalBoolean(labelBreak), labelWidth: extractValue.asOptionalString(labelWidth), bindTo: extractValue.asString(bindTo), autoFocus: extractValue.asOptionalBoolean(autoFocus), enabled: extractValue.asOptionalBoolean(enabled), label: extractValue.asOptionalString(label), labelPosition: extractValue.asOptionalString(labelPosition), type: isCustomFormItem ? "custom" : formItemType, onValidate: lookupEventHandler("validate"), customValidationsDebounce: extractValue.asOptionalNumber(customValidationsDebounce), validationMode: extractValue.asOptionalString(validationMode), registerComponentApi: registerComponentApi, maxTextLength: extractValue(maxTextLength), itemIndex: extractValue("{$itemIndex}"), initialValue: extractValue(node.props.initialValue), noSubmit: extractValue.asOptionalBoolean(noSubmit), inputRenderer: inputTemplate
|
|
219
227
|
? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: inputTemplate, renderChild: renderChild, layoutContext: layoutContext }))
|
|
220
228
|
: undefined, gap: extractValue.asOptionalString(gap) }, resolvedRestProps, { children: isCustomFormItem ? ((0, jsx_runtime_1.jsx)(FormItemNative_1.CustomFormItem, { renderChild: renderChild, node: node, bindTo: extractValue.asString(bindTo) })) : (renderChild(node.children, {
|
|
221
229
|
type: formItemType,
|
|
@@ -860,4 +860,163 @@ fixtures_1.test.describe("Other Edge Cases", () => {
|
|
|
860
860
|
yield (0, fixtures_1.expect)(field).not.toBeVisible();
|
|
861
861
|
yield (0, fixtures_1.expect)(page.locator("[data-error-boundary]")).toBeVisible();
|
|
862
862
|
}));
|
|
863
|
+
// =============================================================================
|
|
864
|
+
// NOSUBMIT PROPERTY TESTS
|
|
865
|
+
// =============================================================================
|
|
866
|
+
fixtures_1.test.describe("noSubmit property", () => {
|
|
867
|
+
(0, fixtures_1.test)("excludes field from submission when noSubmit is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, createTextBoxDriver, }) {
|
|
868
|
+
const { testStateDriver } = yield initTestBed(`
|
|
869
|
+
<Form onSubmit="data => testState = data">
|
|
870
|
+
<FormItem testId="field1" label="Included Field" bindTo="included" initialValue="visible" />
|
|
871
|
+
<FormItem testId="field2" label="Excluded Field" bindTo="excluded" initialValue="hidden" noSubmit="true" />
|
|
872
|
+
</Form>
|
|
873
|
+
`);
|
|
874
|
+
const driver1 = yield createFormItemDriver("field1");
|
|
875
|
+
const input1 = yield createTextBoxDriver(driver1.input);
|
|
876
|
+
yield input1.field.fill("submitted value");
|
|
877
|
+
const driver2 = yield createFormItemDriver("field2");
|
|
878
|
+
const input2 = yield createTextBoxDriver(driver2.input);
|
|
879
|
+
yield input2.field.fill("not submitted");
|
|
880
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
881
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual({
|
|
882
|
+
included: "submitted value",
|
|
883
|
+
});
|
|
884
|
+
}));
|
|
885
|
+
(0, fixtures_1.test)("includes field in submission when noSubmit is false", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, createTextBoxDriver, }) {
|
|
886
|
+
const { testStateDriver } = yield initTestBed(`
|
|
887
|
+
<Form onSubmit="data => testState = data">
|
|
888
|
+
<FormItem testId="field1" label="Field 1" bindTo="field1" initialValue="value1" noSubmit="false" />
|
|
889
|
+
<FormItem testId="field2" label="Field 2" bindTo="field2" initialValue="value2" />
|
|
890
|
+
</Form>
|
|
891
|
+
`);
|
|
892
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
893
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual({
|
|
894
|
+
field1: "value1",
|
|
895
|
+
field2: "value2",
|
|
896
|
+
});
|
|
897
|
+
}));
|
|
898
|
+
(0, fixtures_1.test)("includes field by default when noSubmit is not specified", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, createTextBoxDriver, }) {
|
|
899
|
+
const { testStateDriver } = yield initTestBed(`
|
|
900
|
+
<Form onSubmit="data => testState = data">
|
|
901
|
+
<FormItem testId="field1" label="Field 1" bindTo="field1" initialValue="value1" />
|
|
902
|
+
<FormItem testId="field2" label="Field 2" bindTo="field2" initialValue="value2" />
|
|
903
|
+
</Form>
|
|
904
|
+
`);
|
|
905
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
906
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual({
|
|
907
|
+
field1: "value1",
|
|
908
|
+
field2: "value2",
|
|
909
|
+
});
|
|
910
|
+
}));
|
|
911
|
+
(0, fixtures_1.test)("excludes field when multiple FormItems with same bindTo all have noSubmit true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, createTextBoxDriver, }) {
|
|
912
|
+
const { testStateDriver } = yield initTestBed(`
|
|
913
|
+
<Form onSubmit="data => testState = data">
|
|
914
|
+
<FormItem testId="field1" label="FormItem 1" bindTo="shared" initialValue="first" noSubmit="true" />
|
|
915
|
+
<FormItem testId="field2" label="FormItem 2" bindTo="shared" initialValue="second" noSubmit="true" />
|
|
916
|
+
<FormItem testId="field3" label="Other Field" bindTo="other" initialValue="included" />
|
|
917
|
+
</Form>
|
|
918
|
+
`);
|
|
919
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
920
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual({
|
|
921
|
+
other: "included",
|
|
922
|
+
});
|
|
923
|
+
}));
|
|
924
|
+
(0, fixtures_1.test)("excludes field when any FormItem with same bindTo has noSubmit true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, createTextBoxDriver, }) {
|
|
925
|
+
const { testStateDriver } = yield initTestBed(`
|
|
926
|
+
<Form onSubmit="data => testState = data">
|
|
927
|
+
<FormItem testId="field1" label="FormItem 1" bindTo="shared" initialValue="first" noSubmit="true" />
|
|
928
|
+
<FormItem testId="field2" label="FormItem 2" bindTo="shared" initialValue="second" noSubmit="false" />
|
|
929
|
+
<FormItem testId="field3" label="Other Field" bindTo="other" initialValue="included" />
|
|
930
|
+
</Form>
|
|
931
|
+
`);
|
|
932
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
933
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual({
|
|
934
|
+
other: "included",
|
|
935
|
+
});
|
|
936
|
+
}));
|
|
937
|
+
(0, fixtures_1.test)("excludes field when any FormItem with same bindTo has noSubmit true (mixed order)", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, createTextBoxDriver, }) {
|
|
938
|
+
const { testStateDriver } = yield initTestBed(`
|
|
939
|
+
<Form onSubmit="data => testState = data">
|
|
940
|
+
<FormItem testId="field1" label="FormItem 1" bindTo="shared" initialValue="first" noSubmit="false" />
|
|
941
|
+
<FormItem testId="field2" label="FormItem 2" bindTo="shared" initialValue="second" noSubmit="true" />
|
|
942
|
+
<FormItem testId="field3" label="Other Field" bindTo="other" initialValue="included" />
|
|
943
|
+
</Form>
|
|
944
|
+
`);
|
|
945
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
946
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual({
|
|
947
|
+
other: "included",
|
|
948
|
+
});
|
|
949
|
+
}));
|
|
950
|
+
(0, fixtures_1.test)("field still participates in validation when noSubmit is true", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, createTextBoxDriver, }) {
|
|
951
|
+
const { testStateDriver } = yield initTestBed(`
|
|
952
|
+
<Form onSubmit="data => testState = data">
|
|
953
|
+
<FormItem
|
|
954
|
+
testId="field1"
|
|
955
|
+
label="Required No Submit"
|
|
956
|
+
bindTo="excluded"
|
|
957
|
+
required="true"
|
|
958
|
+
noSubmit="true"
|
|
959
|
+
/>
|
|
960
|
+
</Form>
|
|
961
|
+
`);
|
|
962
|
+
// Try to submit with empty required field
|
|
963
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
964
|
+
// Form should not submit due to validation error
|
|
965
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toBeNull();
|
|
966
|
+
// Fill the required field
|
|
967
|
+
const driver = yield createFormItemDriver("field1");
|
|
968
|
+
const input = yield createTextBoxDriver(driver.input);
|
|
969
|
+
yield input.field.fill("value");
|
|
970
|
+
// Now submit should succeed but field should not be in data
|
|
971
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
972
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual({});
|
|
973
|
+
}));
|
|
974
|
+
(0, fixtures_1.test)("noSubmit works with different input types", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, }) {
|
|
975
|
+
const { testStateDriver } = yield initTestBed(`
|
|
976
|
+
<Form onSubmit="data => testState = data">
|
|
977
|
+
<FormItem testId="text" label="Text" type="text" bindTo="text" initialValue="text" noSubmit="true" />
|
|
978
|
+
<FormItem testId="number" label="Number" type="number" bindTo="number" initialValue="42" noSubmit="true" />
|
|
979
|
+
<FormItem testId="checkbox" label="Checkbox" type="checkbox" bindTo="checkbox" initialValue="true" noSubmit="true" />
|
|
980
|
+
<FormItem testId="included" label="Included" bindTo="included" initialValue="visible" />
|
|
981
|
+
</Form>
|
|
982
|
+
`);
|
|
983
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
984
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual({
|
|
985
|
+
included: "visible",
|
|
986
|
+
});
|
|
987
|
+
}));
|
|
988
|
+
(0, fixtures_1.test)("noSubmit works with select type", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
989
|
+
const { testStateDriver } = yield initTestBed(`
|
|
990
|
+
<Form onSubmit="data => testState = data">
|
|
991
|
+
<FormItem testId="select" label="Select" type="select" bindTo="select" initialValue="opt1" noSubmit="true">
|
|
992
|
+
<Option value="opt1" label="Option 1" />
|
|
993
|
+
<Option value="opt2" label="Option 2" />
|
|
994
|
+
</FormItem>
|
|
995
|
+
<FormItem testId="included" label="Included" bindTo="included" initialValue="visible" />
|
|
996
|
+
</Form>
|
|
997
|
+
`);
|
|
998
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
999
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual({
|
|
1000
|
+
included: "visible",
|
|
1001
|
+
});
|
|
1002
|
+
}));
|
|
1003
|
+
(0, fixtures_1.test)("noSubmit field value changes do not affect submission data", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createFormItemDriver, createTextBoxDriver, }) {
|
|
1004
|
+
const { testStateDriver } = yield initTestBed(`
|
|
1005
|
+
<Form onSubmit="data => testState = data">
|
|
1006
|
+
<FormItem testId="excluded" label="Excluded" bindTo="excluded" initialValue="initial" noSubmit="true" />
|
|
1007
|
+
<FormItem testId="included" label="Included" bindTo="included" initialValue="value" />
|
|
1008
|
+
</Form>
|
|
1009
|
+
`);
|
|
1010
|
+
const excludedDriver = yield createFormItemDriver("excluded");
|
|
1011
|
+
const excludedInput = yield createTextBoxDriver(excludedDriver.input);
|
|
1012
|
+
yield excludedInput.field.fill("changed value");
|
|
1013
|
+
const includedDriver = yield createFormItemDriver("included");
|
|
1014
|
+
const includedInput = yield createTextBoxDriver(includedDriver.input);
|
|
1015
|
+
yield includedInput.field.fill("modified");
|
|
1016
|
+
yield page.getByRole("button", { name: "Save" }).click();
|
|
1017
|
+
yield fixtures_1.expect.poll(testStateDriver.testState).toEqual({
|
|
1018
|
+
included: "modified",
|
|
1019
|
+
});
|
|
1020
|
+
}));
|
|
1021
|
+
});
|
|
863
1022
|
});
|
|
@@ -51,6 +51,7 @@ exports.defaultProps = {
|
|
|
51
51
|
enabled: true,
|
|
52
52
|
customValidationsDebounce: 0,
|
|
53
53
|
gap: "0",
|
|
54
|
+
noSubmit: false,
|
|
54
55
|
};
|
|
55
56
|
const FormItemContext = (0, react_1.createContext)({ parentFormItemId: null });
|
|
56
57
|
function ArrayLikeFormItem({ children, formItemId, registerComponentApi, value = constants_1.EMPTY_ARRAY, updateState, }) {
|
|
@@ -78,7 +79,7 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
78
79
|
// --- validation props
|
|
79
80
|
required, requiredInvalidMessage, minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity, minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity, pattern, patternInvalidMessage, patternInvalidSeverity, regex, regexInvalidMessage, regexInvalidSeverity,
|
|
80
81
|
// ---
|
|
81
|
-
style, className, bindTo, type = exports.defaultProps.type, label, enabled = exports.defaultProps.enabled, labelPosition, labelWidth, labelBreak = exports.defaultProps.labelBreak, children, onValidate, customValidationsDebounce = exports.defaultProps.customValidationsDebounce, validationMode, registerComponentApi, maxTextLength, inputRenderer, itemIndex, initialValue: initialValueFromProps, gap } = _a, rest = __rest(_a, ["required", "requiredInvalidMessage", "minLength", "maxLength", "lengthInvalidMessage", "lengthInvalidSeverity", "minValue", "maxValue", "rangeInvalidMessage", "rangeInvalidSeverity", "pattern", "patternInvalidMessage", "patternInvalidSeverity", "regex", "regexInvalidMessage", "regexInvalidSeverity", "style", "className", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength", "inputRenderer", "itemIndex", "initialValue", "gap"]);
|
|
82
|
+
style, className, bindTo, type = exports.defaultProps.type, label, enabled = exports.defaultProps.enabled, labelPosition, labelWidth, labelBreak = exports.defaultProps.labelBreak, children, onValidate, customValidationsDebounce = exports.defaultProps.customValidationsDebounce, validationMode, registerComponentApi, maxTextLength, inputRenderer, itemIndex, initialValue: initialValueFromProps, gap, noSubmit = exports.defaultProps.noSubmit } = _a, rest = __rest(_a, ["required", "requiredInvalidMessage", "minLength", "maxLength", "lengthInvalidMessage", "lengthInvalidSeverity", "minValue", "maxValue", "rangeInvalidMessage", "rangeInvalidSeverity", "pattern", "patternInvalidMessage", "patternInvalidSeverity", "regex", "regexInvalidMessage", "regexInvalidSeverity", "style", "className", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength", "inputRenderer", "itemIndex", "initialValue", "gap", "noSubmit"]);
|
|
82
83
|
const validations = (0, hooks_1.useShallowCompareMemoize)({
|
|
83
84
|
required,
|
|
84
85
|
requiredInvalidMessage,
|
|
@@ -127,10 +128,10 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
127
128
|
const formEnabled = (0, FormContext_1.useFormContextPart)((value) => value === null || value === void 0 ? void 0 : value.enabled);
|
|
128
129
|
const isEnabled = enabled && formEnabled;
|
|
129
130
|
(0, react_1.useEffect)(() => {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}, [dispatch, formItemId, initialValue]);
|
|
131
|
+
// Always dispatch fieldInitialized to ensure noSubmit tracking
|
|
132
|
+
// Pass undefined as value when initialValue is undefined to avoid overwriting existing values
|
|
133
|
+
dispatch((0, formActions_1.fieldInitialized)(formItemId, initialValue, false, noSubmit));
|
|
134
|
+
}, [dispatch, formItemId, initialValue, noSubmit]);
|
|
134
135
|
(0, Validations_1.useValidation)(validations, onValidate, value, dispatch, formItemId, customValidationsDebounce);
|
|
135
136
|
const onStateChange = (0, react_1.useCallback)(({ value }, options) => {
|
|
136
137
|
//we already handled the initial value in the useEffect with fieldInitialized(...);
|
|
@@ -301,31 +301,29 @@ abstractions_1.headingLevels.forEach((level) => {
|
|
|
301
301
|
// BASIC FUNCTIONALITY TESTS
|
|
302
302
|
// =============================================================================
|
|
303
303
|
fixtures_1.test.describe("Basic Functionality", () => {
|
|
304
|
-
(0, fixtures_1.test)("component renders with basic props", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createHeadingDriver }) {
|
|
304
|
+
(0, fixtures_1.test)("component renders with basic props", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, createHeadingDriver }) {
|
|
305
305
|
yield initTestBed(`<Heading>Test Heading</Heading>`);
|
|
306
306
|
const driver = yield createHeadingDriver();
|
|
307
307
|
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
308
308
|
yield (0, fixtures_1.expect)(driver.component).toHaveText("Test Heading");
|
|
309
309
|
}));
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
yield initTestBed(`<Heading level="${level}">Level ${level}</Heading>`);
|
|
310
|
+
["h1", "h2", "h3", "h4", "h5", "h6"].forEach((lvl) => {
|
|
311
|
+
(0, fixtures_1.test)(`component renders with ${lvl} level`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createHeadingDriver }) {
|
|
312
|
+
yield initTestBed(`<Heading level="${lvl}">Level ${lvl}</Heading>`);
|
|
314
313
|
const driver = yield createHeadingDriver();
|
|
315
314
|
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
316
315
|
const tagName = yield driver.getComponentTagName();
|
|
317
|
-
(0, fixtures_1.expect)(tagName.toLowerCase()).toBe(
|
|
318
|
-
}
|
|
319
|
-
})
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
yield initTestBed(`<${component}>Specialized ${component}</${component}>`);
|
|
316
|
+
(0, fixtures_1.expect)(tagName.toLowerCase()).toBe(lvl);
|
|
317
|
+
}));
|
|
318
|
+
});
|
|
319
|
+
["H1", "H2", "H3", "H4", "H5", "H6"].forEach((c) => {
|
|
320
|
+
(0, fixtures_1.test)(`specialized ${c} components renders content`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createHeadingDriver, }) {
|
|
321
|
+
yield initTestBed(`<${c}>Specialized ${c}</${c}>`);
|
|
324
322
|
const driver = yield createHeadingDriver();
|
|
325
323
|
yield (0, fixtures_1.expect)(driver.component).toBeVisible();
|
|
326
|
-
yield (0, fixtures_1.expect)(driver.component).toHaveText(`Specialized ${
|
|
327
|
-
}
|
|
328
|
-
})
|
|
324
|
+
yield (0, fixtures_1.expect)(driver.component).toHaveText(`Specialized ${c}`);
|
|
325
|
+
}));
|
|
326
|
+
});
|
|
329
327
|
(0, fixtures_1.test)("component handles value prop", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createHeadingDriver }) {
|
|
330
328
|
yield initTestBed(`<Heading value="Value prop text" />`);
|
|
331
329
|
const driver = yield createHeadingDriver();
|
|
@@ -430,33 +428,22 @@ fixtures_1.test.describe("Accessibility", () => {
|
|
|
430
428
|
const tagName = yield driver.getComponentTagName();
|
|
431
429
|
(0, fixtures_1.expect)(tagName.toLowerCase()).toBe("h2");
|
|
432
430
|
}));
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
}
|
|
442
|
-
}));
|
|
443
|
-
(0, fixtures_1.test)("specialized components maintain semantic heading structure", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createHeadingDriver, }) {
|
|
444
|
-
const components = [
|
|
445
|
-
{ component: "H1", expectedTag: "h1" },
|
|
446
|
-
{ component: "H2", expectedTag: "h2" },
|
|
447
|
-
{ component: "H3", expectedTag: "h3" },
|
|
448
|
-
{ component: "H4", expectedTag: "h4" },
|
|
449
|
-
{ component: "H5", expectedTag: "h5" },
|
|
450
|
-
{ component: "H6", expectedTag: "h6" },
|
|
451
|
-
];
|
|
452
|
-
for (const { component, expectedTag } of components) {
|
|
431
|
+
[
|
|
432
|
+
{ component: "H1", expectedTag: "h1" },
|
|
433
|
+
{ component: "H2", expectedTag: "h2" },
|
|
434
|
+
{ component: "H3", expectedTag: "h3" },
|
|
435
|
+
{ component: "H4", expectedTag: "h4" },
|
|
436
|
+
{ component: "H5", expectedTag: "h5" },
|
|
437
|
+
{ component: "H6", expectedTag: "h6" },
|
|
438
|
+
].forEach(({ component, expectedTag }) => {
|
|
439
|
+
(0, fixtures_1.test)(`${component} renders as ${expectedTag} element`, (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createHeadingDriver, }) {
|
|
453
440
|
yield initTestBed(`<${component}>Heading Level ${expectedTag}</${component}>`);
|
|
454
441
|
const driver = yield createHeadingDriver();
|
|
455
442
|
yield (0, fixtures_1.expect)(driver.component).toHaveRole("heading");
|
|
456
443
|
const tagName = yield driver.getComponentTagName();
|
|
457
444
|
(0, fixtures_1.expect)(tagName.toLowerCase()).toBe(expectedTag);
|
|
458
|
-
}
|
|
459
|
-
})
|
|
445
|
+
}));
|
|
446
|
+
});
|
|
460
447
|
(0, fixtures_1.test)("component supports accessible text content", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, createHeadingDriver, }) {
|
|
461
448
|
yield initTestBed(`<Heading>Accessible heading with proper content</Heading>`);
|
|
462
449
|
const driver = yield createHeadingDriver();
|
|
@@ -834,8 +821,8 @@ fixtures_1.test.describe("API", () => {
|
|
|
834
821
|
const { testStateDriver } = yield initTestBed(`
|
|
835
822
|
<Fragment>
|
|
836
823
|
<Stack width="200px">
|
|
837
|
-
<H1 id="overflowHeading" maxLines="{1}"
|
|
838
|
-
value="This is a very long heading text that should definitely overflow when constrained to a small width"
|
|
824
|
+
<H1 id="overflowHeading" maxLines="{1}"
|
|
825
|
+
value="This is a very long heading text that should definitely overflow when constrained to a small width"
|
|
839
826
|
/>
|
|
840
827
|
<Button onClick="testState = overflowHeading.hasOverflow()" />
|
|
841
828
|
</Stack>
|
|
@@ -900,13 +887,13 @@ fixtures_1.test.describe("API", () => {
|
|
|
900
887
|
<H4 id="h4Text" maxLines="{1}" value="This is a very long heading that should overflow" />
|
|
901
888
|
<H5 id="h5Text" maxLines="{1}" value="This is a very long heading that should overflow" />
|
|
902
889
|
<H6 id="h6Text" maxLines="{1}" value="This is a very long heading that should overflow" />
|
|
903
|
-
<Button onClick="testState = {
|
|
904
|
-
h1: h1Text.hasOverflow(),
|
|
905
|
-
h2: h2Text.hasOverflow(),
|
|
906
|
-
h3: h3Text.hasOverflow(),
|
|
907
|
-
h4: h4Text.hasOverflow(),
|
|
908
|
-
h5: h5Text.hasOverflow(),
|
|
909
|
-
h6: h6Text.hasOverflow()
|
|
890
|
+
<Button onClick="testState = {
|
|
891
|
+
h1: h1Text.hasOverflow(),
|
|
892
|
+
h2: h2Text.hasOverflow(),
|
|
893
|
+
h3: h3Text.hasOverflow(),
|
|
894
|
+
h4: h4Text.hasOverflow(),
|
|
895
|
+
h5: h5Text.hasOverflow(),
|
|
896
|
+
h6: h6Text.hasOverflow()
|
|
910
897
|
}" />
|
|
911
898
|
</Stack>
|
|
912
899
|
</Fragment>
|
|
@@ -962,7 +949,7 @@ fixtures_1.test.describe("API", () => {
|
|
|
962
949
|
yield page.getByRole("button").click();
|
|
963
950
|
yield fixtures_1.expect.poll(testStateDriver.testState).toBe(true);
|
|
964
951
|
}));
|
|
965
|
-
(0, fixtures_1.test)("hasOverflow works with nested content instead of value prop", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page }) {
|
|
952
|
+
(0, fixtures_1.test)("hasOverflow works with nested content instead of value prop", (_a) => __awaiter(void 0, [_a], void 0, function* ({ initTestBed, page, }) {
|
|
966
953
|
const { testStateDriver } = yield initTestBed(`
|
|
967
954
|
<Fragment>
|
|
968
955
|
<Stack width="100px">
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.queueComponentRenderer = exports.QueueMd = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const renderers_1 = require("../../components-core/renderers");
|
|
6
|
-
const container_helpers_1 = require("../container-helpers");
|
|
7
6
|
const metadata_helpers_1 = require("../metadata-helpers");
|
|
8
7
|
const QueueNative_1 = require("./QueueNative");
|
|
9
8
|
const COMP = "Queue";
|
|
@@ -82,19 +81,5 @@ exports.QueueMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
82
81
|
},
|
|
83
82
|
});
|
|
84
83
|
exports.queueComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.QueueMd, ({ node, registerComponentApi, lookupEventHandler, renderChild, extractValue }) => {
|
|
85
|
-
return ((0, jsx_runtime_1.jsx)(QueueNative_1.
|
|
86
|
-
? (completedItems, queuedItems) => {
|
|
87
|
-
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.resultFeedback, contextVars: {
|
|
88
|
-
$completedItems: completedItems,
|
|
89
|
-
$queuedItems: queuedItems,
|
|
90
|
-
}, renderChild: renderChild }));
|
|
91
|
-
}
|
|
92
|
-
: undefined, renderProgressFeedback: node.props.progressFeedback
|
|
93
|
-
? (completedItems, queuedItems) => {
|
|
94
|
-
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.progressFeedback, contextVars: {
|
|
95
|
-
$completedItems: completedItems,
|
|
96
|
-
$queuedItems: queuedItems,
|
|
97
|
-
}, renderChild: renderChild }));
|
|
98
|
-
}
|
|
99
|
-
: undefined, willProcessItem: lookupEventHandler("willProcess"), processItem: lookupEventHandler("process", { signError: false }), didProcessItem: lookupEventHandler("didProcess"), processItemError: lookupEventHandler("processError"), onComplete: lookupEventHandler("complete"), clearAfterFinish: extractValue.asOptionalBoolean(node.props.clearAfterFinish) }));
|
|
84
|
+
return ((0, jsx_runtime_1.jsx)(QueueNative_1.QueueWithContextVar, { node: node, renderChild: renderChild, extractValue: extractValue, lookupEventHandler: lookupEventHandler, registerComponentApi: registerComponentApi }));
|
|
100
85
|
});
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.defaultProps = void 0;
|
|
16
16
|
exports.Queue = Queue;
|
|
17
|
+
exports.QueueWithContextVar = QueueWithContextVar;
|
|
17
18
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
18
19
|
const react_1 = require("react");
|
|
19
20
|
const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
|
|
@@ -22,6 +23,7 @@ const lodash_es_1 = require("lodash-es");
|
|
|
22
23
|
const hooks_1 = require("../../components-core/utils/hooks");
|
|
23
24
|
const misc_1 = require("../../components-core/utils/misc");
|
|
24
25
|
const AppContext_1 = require("../../components-core/AppContext");
|
|
26
|
+
const container_helpers_1 = require("../container-helpers");
|
|
25
27
|
const queueActions_1 = require("../Queue/queueActions");
|
|
26
28
|
// =====================================================================================================================
|
|
27
29
|
// React Queue component implementation
|
|
@@ -106,9 +108,12 @@ const INITIAL_STATE = {
|
|
|
106
108
|
};
|
|
107
109
|
function Queue({ registerComponentApi, willProcessItem, processItem, didProcessItem, processItemError, onComplete,
|
|
108
110
|
//progressFeedback,
|
|
109
|
-
renderProgressFeedback, renderResultFeedback, clearAfterFinish = exports.defaultProps.clearAfterFinish, }) {
|
|
111
|
+
renderProgressFeedback, renderResultFeedback, clearAfterFinish = exports.defaultProps.clearAfterFinish, queueState: externalQueueState, dispatch: externalDispatch, }) {
|
|
110
112
|
const runningActionItemRef = (0, react_1.useRef)(new Set());
|
|
111
|
-
const [
|
|
113
|
+
const [internalQueueState, internalDispatch] = (0, react_1.useReducer)(queueReducer, INITIAL_STATE);
|
|
114
|
+
// Use external state if provided, otherwise use internal state
|
|
115
|
+
const queueState = externalQueueState !== null && externalQueueState !== void 0 ? externalQueueState : internalQueueState;
|
|
116
|
+
const dispatch = externalDispatch !== null && externalDispatch !== void 0 ? externalDispatch : internalDispatch;
|
|
112
117
|
let appContext = (0, AppContext_1.useAppContext)();
|
|
113
118
|
// --- This Queue API adds a single item to the queue
|
|
114
119
|
const enqueueItem = (0, misc_1.useEvent)((item) => {
|
|
@@ -282,3 +287,56 @@ renderProgressFeedback, renderResultFeedback, clearAfterFinish = exports.default
|
|
|
282
287
|
}, [doComplete, doSingle, prevQueue, queue]);
|
|
283
288
|
return null;
|
|
284
289
|
}
|
|
290
|
+
function QueueWithContextVar({ node, renderChild, extractValue, lookupEventHandler, registerComponentApi, }) {
|
|
291
|
+
const [queueState, dispatch] = (0, react_1.useReducer)(queueReducer, INITIAL_STATE);
|
|
292
|
+
// Compute context variables from queue state
|
|
293
|
+
const completedItems = (0, react_1.useMemo)(() => {
|
|
294
|
+
return Object.values(queueState.queueState).filter((item) => item.status === "completed");
|
|
295
|
+
}, [queueState.queueState]);
|
|
296
|
+
const queuedItems = (0, react_1.useMemo)(() => {
|
|
297
|
+
return Object.values(queueState.queueState);
|
|
298
|
+
}, [queueState.queueState]);
|
|
299
|
+
const $completedItems = completedItems;
|
|
300
|
+
const $queuedItems = queuedItems;
|
|
301
|
+
return ((0, jsx_runtime_1.jsx)(Queue, { queueState: queueState, dispatch: dispatch, registerComponentApi: registerComponentApi, renderResultFeedback: node.props.resultFeedback
|
|
302
|
+
? (completedItems, queuedItems) => {
|
|
303
|
+
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.resultFeedback, contextVars: {
|
|
304
|
+
$completedItems: completedItems,
|
|
305
|
+
$queuedItems: queuedItems,
|
|
306
|
+
}, renderChild: renderChild }));
|
|
307
|
+
}
|
|
308
|
+
: undefined, renderProgressFeedback: node.props.progressFeedback
|
|
309
|
+
? (completedItems, queuedItems) => {
|
|
310
|
+
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.progressFeedback, contextVars: {
|
|
311
|
+
$completedItems: completedItems,
|
|
312
|
+
$queuedItems: queuedItems,
|
|
313
|
+
}, renderChild: renderChild }));
|
|
314
|
+
}
|
|
315
|
+
: undefined, willProcessItem: lookupEventHandler("willProcess", {
|
|
316
|
+
context: {
|
|
317
|
+
$completedItems,
|
|
318
|
+
$queuedItems,
|
|
319
|
+
},
|
|
320
|
+
}), processItem: lookupEventHandler("process", {
|
|
321
|
+
signError: false,
|
|
322
|
+
context: {
|
|
323
|
+
$completedItems,
|
|
324
|
+
$queuedItems,
|
|
325
|
+
},
|
|
326
|
+
}), didProcessItem: lookupEventHandler("didProcess", {
|
|
327
|
+
context: {
|
|
328
|
+
$completedItems,
|
|
329
|
+
$queuedItems,
|
|
330
|
+
},
|
|
331
|
+
}), processItemError: lookupEventHandler("processError", {
|
|
332
|
+
context: {
|
|
333
|
+
$completedItems,
|
|
334
|
+
$queuedItems,
|
|
335
|
+
},
|
|
336
|
+
}), onComplete: lookupEventHandler("complete", {
|
|
337
|
+
context: {
|
|
338
|
+
$completedItems,
|
|
339
|
+
$queuedItems,
|
|
340
|
+
},
|
|
341
|
+
}), clearAfterFinish: extractValue.asOptionalBoolean(node.props.clearAfterFinish) }));
|
|
342
|
+
}
|
|
@@ -53,12 +53,14 @@ exports.TableOfContentsMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
53
53
|
[`paddingLeft-${COMP_CHILD}-level-5`]: "$space-6",
|
|
54
54
|
[`paddingLeft-${COMP_CHILD}-level-6`]: "$space-6",
|
|
55
55
|
[`fontWeight-${COMP_CHILD}`]: "$fontWeight-bold",
|
|
56
|
-
[`fontWeight-${COMP_CHILD}-level-
|
|
57
|
-
[`fontWeight-${COMP_CHILD}-level-
|
|
58
|
-
[`fontWeight-${COMP_CHILD}-level-
|
|
59
|
-
[`fontWeight-${COMP_CHILD}-level-
|
|
56
|
+
[`fontWeight-${COMP_CHILD}-level-2`]: "$fontWeight-medium",
|
|
57
|
+
[`fontWeight-${COMP_CHILD}-level-3`]: "$fontWeight-normal",
|
|
58
|
+
[`fontWeight-${COMP_CHILD}-level-4`]: "$fontWeight-normal",
|
|
59
|
+
[`fontWeight-${COMP_CHILD}-level-5`]: "$fontWeight-normal",
|
|
60
|
+
[`fontWeight-${COMP_CHILD}-level-6`]: "$fontWeight-normal",
|
|
60
61
|
[`fontStyle-${COMP_CHILD}-level-6`]: "italic",
|
|
61
|
-
[`
|
|
62
|
+
[`textColor-${COMP_CHILD}--active`]: "$color-primary-400",
|
|
63
|
+
[`fontWeight-${COMP_CHILD}--active`]: "$fontWeight-bold",
|
|
62
64
|
},
|
|
63
65
|
});
|
|
64
66
|
function IndexAwareTableOfContents(props) {
|
|
@@ -43,8 +43,8 @@ const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
|
|
|
43
43
|
const classnames_1 = __importDefault(require("classnames"));
|
|
44
44
|
const Dialog = __importStar(require("@radix-ui/react-dialog"));
|
|
45
45
|
const InspectorDialog_module_scss_1 = __importDefault(require("./InspectorDialog.module.scss"));
|
|
46
|
-
const xmlui_1 = require("xmlui");
|
|
47
46
|
const framer_motion_1 = require("framer-motion");
|
|
47
|
+
const ThemeContext_1 = require("../theming/ThemeContext");
|
|
48
48
|
// =====================================================================================================================
|
|
49
49
|
// React component definition
|
|
50
50
|
const MotionContent = framer_motion_1.motion.create(Dialog.Content);
|
|
@@ -88,7 +88,7 @@ function durationToSeconds(durationString) {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
exports.InspectorDialog = react_1.default.forwardRef(({ children, style, isOpen, setIsOpen, clickPosition }, ref) => {
|
|
91
|
-
const { root, getThemeVar } = (0,
|
|
91
|
+
const { root, getThemeVar } = (0, ThemeContext_1.useTheme)();
|
|
92
92
|
const modalRef = (0, react_1.useRef)(null);
|
|
93
93
|
const composedRef = ref ? (0, react_compose_refs_1.composeRefs)(ref, modalRef) : modalRef;
|
|
94
94
|
const [rendered, setRendered] = (0, react_1.useState)(true);
|
|
@@ -244,10 +244,12 @@ function evalBinaryAsync(evaluator, thisStack, expr, evalContext, thread) {
|
|
|
244
244
|
const l = yield completeExprValue(expr.left, thread);
|
|
245
245
|
if (expr.op === "&&" && !l) {
|
|
246
246
|
(0, eval_tree_common_1.setExprValue)(expr, { value: l }, thread);
|
|
247
|
+
thisStack.push(l);
|
|
247
248
|
return l;
|
|
248
249
|
}
|
|
249
250
|
if (expr.op === "||" && l) {
|
|
250
251
|
(0, eval_tree_common_1.setExprValue)(expr, { value: l }, thread);
|
|
252
|
+
thisStack.push(l);
|
|
251
253
|
return l;
|
|
252
254
|
}
|
|
253
255
|
yield evaluator(thisStack, expr.right, evalContext, thread);
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.uint8ArrayToBase64 = uint8ArrayToBase64;
|
|
4
4
|
exports.encodeToBase64 = encodeToBase64;
|
|
5
|
+
exports.base64ToUint8Array = base64ToUint8Array;
|
|
5
6
|
exports.decodeFromBase64 = decodeFromBase64;
|
|
6
7
|
/**
|
|
7
8
|
* Convert Uint8Array to base64 string without using btoa.
|
|
@@ -60,6 +61,7 @@ function encodeToBase64(value) {
|
|
|
60
61
|
}
|
|
61
62
|
/**
|
|
62
63
|
* Convert base64 string to Uint8Array without using atob.
|
|
64
|
+
* Use this for binary data (e.g., compressed data).
|
|
63
65
|
*/
|
|
64
66
|
function base64ToUint8Array(base64) {
|
|
65
67
|
const base64abc = [
|
|
@@ -37,6 +37,7 @@ exports.toHashObject = toHashObject;
|
|
|
37
37
|
exports.findByField = findByField;
|
|
38
38
|
exports.distinct = distinct;
|
|
39
39
|
exports.asyncThrottle = asyncThrottle;
|
|
40
|
+
exports.debounce = debounce;
|
|
40
41
|
const react_1 = require("react");
|
|
41
42
|
const lodash_es_1 = require("lodash-es");
|
|
42
43
|
const date_fns_1 = require("date-fns");
|
|
@@ -493,3 +494,46 @@ function asyncThrottle(func, wait, options) {
|
|
|
493
494
|
throttled(resolve, reject, args);
|
|
494
495
|
});
|
|
495
496
|
}
|
|
497
|
+
/**
|
|
498
|
+
* Registry to store debounced function timers and their captured arguments by key
|
|
499
|
+
*/
|
|
500
|
+
const debounceRegistry = new Map();
|
|
501
|
+
/**
|
|
502
|
+
* Creates a debounced function that delays invoking the provided function until after
|
|
503
|
+
* the specified delay in milliseconds has elapsed since the last time it was invoked.
|
|
504
|
+
*
|
|
505
|
+
* When called from XMLUI markup, it automatically generates a stable key based on the
|
|
506
|
+
* call site to ensure proper debouncing across multiple invocations.
|
|
507
|
+
*
|
|
508
|
+
* @param delayMs The number of milliseconds to delay execution
|
|
509
|
+
* @param func The function to debounce
|
|
510
|
+
* @param args Optional arguments to pass to the function when it executes
|
|
511
|
+
* @returns void (executes the function after the delay)
|
|
512
|
+
*
|
|
513
|
+
* @example
|
|
514
|
+
* // In XMLUI markup with value capture:
|
|
515
|
+
* <TextBox onDidChange="e => debounce(500, () => console.log('value:', e), e)" />
|
|
516
|
+
*
|
|
517
|
+
* @example
|
|
518
|
+
* // In XMLUI markup with inline function:
|
|
519
|
+
* <TextBox onDidChange="e => debounce(500, (val) => console.log('value:', val), e)" />
|
|
520
|
+
*/
|
|
521
|
+
function debounce(delayMs, func, ...args) {
|
|
522
|
+
// Generate a unique key for this debounce call based on the function source
|
|
523
|
+
// This ensures that the same event handler in markup reuses the same timer
|
|
524
|
+
const key = func.toString();
|
|
525
|
+
// Clear existing timeout for this key
|
|
526
|
+
const existing = debounceRegistry.get(key);
|
|
527
|
+
if (existing !== undefined) {
|
|
528
|
+
clearTimeout(existing.timeoutId);
|
|
529
|
+
}
|
|
530
|
+
// Set new timeout with captured arguments
|
|
531
|
+
const timeoutId = setTimeout(() => {
|
|
532
|
+
const entry = debounceRegistry.get(key);
|
|
533
|
+
if (entry) {
|
|
534
|
+
func(...entry.args);
|
|
535
|
+
debounceRegistry.delete(key);
|
|
536
|
+
}
|
|
537
|
+
}, delayMs);
|
|
538
|
+
debounceRegistry.set(key, { timeoutId, args });
|
|
539
|
+
}
|