xmlui 0.9.19 → 0.9.21
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-BH8WAcl0.mjs → apiInterceptorWorker-7aKQ2rBj.mjs} +1 -1
- package/dist/{index-KE5HIbCX.mjs → index-B3CWFAxa.mjs} +1795 -2065
- package/dist/index.css +1892 -690
- package/dist/{lint-Cd70ckJ6.mjs → lint-EcgF-9Wr.mjs} +22 -46
- package/dist/scripts/src/components/ComponentProvider.js +16 -24
- package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +3 -1
- package/dist/scripts/src/components/DropdownMenu/DropdownMenuNative.js +10 -2
- package/dist/scripts/src/components/Form/FormContext.js +4 -0
- package/dist/scripts/src/components/Form/FormNative.js +6 -4
- package/dist/scripts/src/components/Form/formActions.js +2 -1
- package/dist/scripts/src/components/FormItem/FormItemNative.js +7 -0
- package/dist/scripts/src/components/Icon/MoonIcon.js +10 -0
- package/dist/scripts/src/components/Icon/StarsIcon.js +10 -0
- package/dist/scripts/src/components/IconProvider.js +4 -1
- package/dist/scripts/src/components/InspectButton/InspectButton.js +34 -0
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +1 -1
- package/dist/scripts/src/components-core/InspectorContext.js +86 -21
- package/dist/scripts/src/components-core/rendering/Container.js +1 -6
- package/dist/style.css +1837 -631
- package/dist/xmlui-metadata.mjs +1283 -1438
- package/dist/xmlui-metadata.umd.js +1282 -1437
- package/dist/xmlui-parser.mjs +17 -17
- package/dist/xmlui-standalone.umd.js +4063 -3150
- package/dist/xmlui.d.ts +1 -1
- package/dist/xmlui.mjs +1 -1
- package/package.json +2 -2
- package/dist/scripts/src/components/Alert/Alert.js +0 -61
- package/dist/scripts/src/components/Alert/AlertNative.js +0 -8
- package/dist/scripts/src/components/ButtonGroup/ButtonGroup.js +0 -55
- package/dist/scripts/src/components/ButtonGroup/ButtonGroupNative.js +0 -8
- package/dist/scripts/src/components/OffCanvas/OffCanvas.js +0 -57
- package/dist/scripts/src/components/OffCanvas/OffCanvasNative.js +0 -48
- package/dist/scripts/src/components/StateViewer/StateViewerNative.js +0 -19
- package/dist/scripts/src/components/SubNavPanel/SubNavPanel.js +0 -22
- package/dist/scripts/src/components/SubNavPanel/SubNavPanelNative.js +0 -9
|
@@ -105,28 +105,6 @@ const iconPositionMd = [
|
|
|
105
105
|
description: "The icon will appear at the end (right side when the left-to-right direction is set)"
|
|
106
106
|
}
|
|
107
107
|
];
|
|
108
|
-
const statusColorMd = [
|
|
109
|
-
{ value: "primary", description: "Primary theme color, no default icon" },
|
|
110
|
-
{ value: "secondary", description: "Secondary theme color, no default icon" },
|
|
111
|
-
{ value: "success", description: 'Success theme color, "success" icon' },
|
|
112
|
-
{ value: "danger", description: 'Warning theme color, "warning" icon' },
|
|
113
|
-
{ value: "warning", description: 'Danger theme color, "danger" icon' },
|
|
114
|
-
{ value: "info", description: 'Info theme color, "info" icon' },
|
|
115
|
-
{ value: "light", description: "Light theme color, no default icon" },
|
|
116
|
-
{ value: "dark", description: "Dark theme color, no default icon" }
|
|
117
|
-
];
|
|
118
|
-
const placementMd = [
|
|
119
|
-
{
|
|
120
|
-
value: "start",
|
|
121
|
-
description: "The left side of the window (left-to-right) or the right side of the window (right-to-left)"
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
value: "end",
|
|
125
|
-
description: "The right side of the window (left-to-right) or the left side of the window (right-to-left)"
|
|
126
|
-
},
|
|
127
|
-
{ value: "top", description: "The top of the window" },
|
|
128
|
-
{ value: "bottom", description: "The bottom of the window" }
|
|
129
|
-
];
|
|
130
108
|
const labelPositionMd = [
|
|
131
109
|
{
|
|
132
110
|
value: "start",
|
|
@@ -6265,30 +6243,28 @@ export {
|
|
|
6265
6243
|
buttonVariantNames as a4,
|
|
6266
6244
|
nodeToComponentDef as a5,
|
|
6267
6245
|
triggerPositionNames as a6,
|
|
6268
|
-
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
onPrefixRegex as at,
|
|
6291
|
-
CORE_NAMESPACE_VALUE as au,
|
|
6246
|
+
httpMethodNames as a7,
|
|
6247
|
+
PARSED_MARK_PROP as a8,
|
|
6248
|
+
layoutOptionKeys as a9,
|
|
6249
|
+
viewportSizeNames as aa,
|
|
6250
|
+
componentFileExtension as ab,
|
|
6251
|
+
codeBehindFileExtension as ac,
|
|
6252
|
+
getLintSeverity as ad,
|
|
6253
|
+
LintSeverity as ae,
|
|
6254
|
+
lintApp as af,
|
|
6255
|
+
printComponentLints as ag,
|
|
6256
|
+
lintErrorsComponent as ah,
|
|
6257
|
+
collectCodeBehindFromSource as ai,
|
|
6258
|
+
removeCodeBehindTokensFromTree as aj,
|
|
6259
|
+
COMPOUND_COMP_ID as ak,
|
|
6260
|
+
moduleFileExtension as al,
|
|
6261
|
+
LintDiagKind as am,
|
|
6262
|
+
lint as an,
|
|
6263
|
+
ParserError2 as ao,
|
|
6264
|
+
errorMessages as ap,
|
|
6265
|
+
UCRegex as aq,
|
|
6266
|
+
onPrefixRegex as ar,
|
|
6267
|
+
CORE_NAMESPACE_VALUE as as,
|
|
6292
6268
|
alignmentOptionMd as b,
|
|
6293
6269
|
buttonTypesMd as c,
|
|
6294
6270
|
buttonThemeMd as d,
|
|
@@ -81,13 +81,10 @@ const Bookmark_1 = require("./Bookmark/Bookmark");
|
|
|
81
81
|
const AppState_1 = require("./AppState/AppState");
|
|
82
82
|
const TableOfContents_1 = require("./TableOfContents/TableOfContents");
|
|
83
83
|
const Accordion_1 = require("./Accordion/Accordion");
|
|
84
|
-
const Alert_1 = require("./Alert/Alert");
|
|
85
|
-
const OffCanvas_1 = require("./OffCanvas/OffCanvas");
|
|
86
84
|
const XmluiCodeHighlighter_1 = require("../components-core/XmluiCodeHighlighter");
|
|
87
85
|
const TabItem_1 = require("./Tabs/TabItem");
|
|
88
86
|
const AccordionItem_1 = require("./Accordion/AccordionItem");
|
|
89
87
|
const Slider_1 = require("./Slider/Slider");
|
|
90
|
-
const ButtonGroup_1 = require("./ButtonGroup/ButtonGroup");
|
|
91
88
|
const Carousel_1 = require("./Carousel/Carousel");
|
|
92
89
|
const CarouselItem_1 = require("./Carousel/CarouselItem");
|
|
93
90
|
const renderers_1 = require("../components-core/renderers");
|
|
@@ -100,7 +97,7 @@ const Backdrop_1 = require("./Backdrop/Backdrop");
|
|
|
100
97
|
const HtmlTags_1 = require("./HtmlTags/HtmlTags");
|
|
101
98
|
const ColorPicker_1 = require("./ColorPicker/ColorPicker");
|
|
102
99
|
const RadioItem_1 = require("./RadioGroup/RadioItem");
|
|
103
|
-
const
|
|
100
|
+
const InspectButton_1 = require("./InspectButton/InspectButton");
|
|
104
101
|
/**
|
|
105
102
|
* The framework has a specialized component concept, the "property holder
|
|
106
103
|
* component." These components only hold property values but do not render
|
|
@@ -151,6 +148,7 @@ class ComponentRegistry {
|
|
|
151
148
|
}
|
|
152
149
|
});
|
|
153
150
|
};
|
|
151
|
+
// --- Registers a renderable component using its renderer function
|
|
154
152
|
this.registerCoreComponent = (component) => {
|
|
155
153
|
const coreNamespaces = ["#xmlui-core-ns", ""];
|
|
156
154
|
if ("compoundComponentDef" in component) {
|
|
@@ -169,7 +167,6 @@ class ComponentRegistry {
|
|
|
169
167
|
this.registerComponentRenderer(component, ...appNamespaces);
|
|
170
168
|
}
|
|
171
169
|
};
|
|
172
|
-
// --- Registers a renderable component using its renderer function
|
|
173
170
|
// --- and metadata
|
|
174
171
|
this.registerComponentRenderer = ({ type, renderer, metadata, isCompoundComponent, }, ...namespaces) => {
|
|
175
172
|
const component = {
|
|
@@ -274,9 +271,6 @@ class ComponentRegistry {
|
|
|
274
271
|
if (process.env.VITE_USED_COMPONENTS_NavPanel !== "false") {
|
|
275
272
|
this.registerCoreComponent(NavPanel_1.navPanelRenderer);
|
|
276
273
|
}
|
|
277
|
-
if (process.env.VITE_USED_COMPONENTS_SubNavPanel !== "false") {
|
|
278
|
-
this.registerCoreComponent(SubNavPanel_1.subNavPanelRenderer);
|
|
279
|
-
}
|
|
280
274
|
if (process.env.VITE_USED_COMPONENTS_Pages !== "false") {
|
|
281
275
|
this.registerCoreComponent(Pages_1.pagesRenderer);
|
|
282
276
|
this.registerCoreComponent(Pages_1.pageRenderer);
|
|
@@ -372,6 +366,7 @@ class ComponentRegistry {
|
|
|
372
366
|
this.registerCoreComponent(AutoComplete_1.autoCompleteComponentRenderer);
|
|
373
367
|
this.registerCoreComponent(DropdownMenu_1.dropdownMenuComponentRenderer);
|
|
374
368
|
this.registerCoreComponent(ToneChangerButton_1.toneChangerButtonComponentRenderer);
|
|
369
|
+
this.registerCoreComponent(InspectButton_1.inspectButtonComponentRenderer);
|
|
375
370
|
this.registerCoreComponent(FormSection_1.formSectionRenderer);
|
|
376
371
|
this.registerCoreComponent(DropdownMenu_1.dropdownMenuComponentRenderer);
|
|
377
372
|
this.registerCoreComponent(DropdownMenu_1.menuItemRenderer);
|
|
@@ -388,10 +383,7 @@ class ComponentRegistry {
|
|
|
388
383
|
// --- New Bootstrap-inspired components
|
|
389
384
|
this.registerCoreComponent(Carousel_1.carouselComponentRenderer);
|
|
390
385
|
this.registerCoreComponent(Accordion_1.accordionComponentRenderer);
|
|
391
|
-
this.registerCoreComponent(Alert_1.alertComponentRenderer);
|
|
392
|
-
this.registerCoreComponent(OffCanvas_1.offCanvasComponentRenderer);
|
|
393
386
|
this.registerCoreComponent(Slider_1.sliderComponentRenderer);
|
|
394
|
-
this.registerCoreComponent(ButtonGroup_1.buttonGroupComponentRenderer);
|
|
395
387
|
this.registerCoreComponent(Backdrop_1.backdropComponentRenderer);
|
|
396
388
|
this.registerCoreComponent(HtmlTags_1.htmlATagRenderer);
|
|
397
389
|
this.registerCoreComponent(HtmlTags_1.htmlAbbrTagRenderer);
|
|
@@ -566,6 +558,19 @@ class ComponentRegistry {
|
|
|
566
558
|
this.loaders.get(componentName) !== undefined ||
|
|
567
559
|
this.actionFns.get(componentName) !== undefined);
|
|
568
560
|
}
|
|
561
|
+
// --- Registers a loader renderer using its definition
|
|
562
|
+
registerLoaderRenderer({ type, renderer }) {
|
|
563
|
+
this.loaders.set(type, renderer);
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* This method destroys the component registry; It unsubscribes from the component manager.
|
|
567
|
+
* This method is called when the component registry is no longer needed, e.g., when the
|
|
568
|
+
* component provider is unmounted (HMR).
|
|
569
|
+
*/
|
|
570
|
+
destroy() {
|
|
571
|
+
var _a;
|
|
572
|
+
(_a = this.extensionManager) === null || _a === void 0 ? void 0 : _a.unSubscribeFromRegistrations(this.extensionRegistered);
|
|
573
|
+
}
|
|
569
574
|
// --- Registers a compound component using its definition and metadata
|
|
570
575
|
registerCompoundComponentRenderer({ compoundComponentDef, metadata }, ...namespaces) {
|
|
571
576
|
const component = {
|
|
@@ -582,19 +587,6 @@ class ComponentRegistry {
|
|
|
582
587
|
registerActionFn({ actionName: functionName, actionFn }) {
|
|
583
588
|
this.actionFns.set(functionName, actionFn);
|
|
584
589
|
}
|
|
585
|
-
// --- Registers a loader renderer using its definition
|
|
586
|
-
registerLoaderRenderer({ type, renderer }) {
|
|
587
|
-
this.loaders.set(type, renderer);
|
|
588
|
-
}
|
|
589
|
-
/**
|
|
590
|
-
* This method destroys the component registry; It unsubscribes from the component manager.
|
|
591
|
-
* This method is called when the component registry is no longer needed, e.g., when the
|
|
592
|
-
* component provider is unmounted (HMR).
|
|
593
|
-
*/
|
|
594
|
-
destroy() {
|
|
595
|
-
var _a;
|
|
596
|
-
(_a = this.extensionManager) === null || _a === void 0 ? void 0 : _a.unSubscribeFromRegistrations(this.extensionRegistered);
|
|
597
|
-
}
|
|
598
590
|
}
|
|
599
591
|
exports.ComponentRegistry = ComponentRegistry;
|
|
600
592
|
/**
|
|
@@ -99,6 +99,7 @@ exports.MenuItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
99
99
|
valueType: "boolean",
|
|
100
100
|
defaultValue: DropdownMenuNative_1.defaultMenuItemProps.active,
|
|
101
101
|
},
|
|
102
|
+
enabled: (0, metadata_helpers_1.dEnabled)(),
|
|
102
103
|
},
|
|
103
104
|
events: {
|
|
104
105
|
click: (0, metadata_helpers_1.dClick)(MICOMP),
|
|
@@ -107,6 +108,7 @@ exports.MenuItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
107
108
|
defaultThemeVars: {
|
|
108
109
|
[`backgroundColor-${MICOMP}`]: "$backgroundColor-dropdown-item",
|
|
109
110
|
[`color-${MICOMP}`]: "$textColor-primary",
|
|
111
|
+
[`color-${MICOMP}--disabled`]: "$textColor--disabled",
|
|
110
112
|
[`fontFamily-${MICOMP}`]: "$fontFamily",
|
|
111
113
|
[`fontSize-${MICOMP}`]: "$fontSize-small",
|
|
112
114
|
[`paddingVertical-${MICOMP}`]: "$space-2",
|
|
@@ -131,7 +133,7 @@ exports.menuItemRenderer = (0, renderers_1.createComponentRenderer)(MICOMP, expo
|
|
|
131
133
|
navigateAction === null || navigateAction === void 0 ? void 0 : navigateAction({ pathname: to });
|
|
132
134
|
};
|
|
133
135
|
}
|
|
134
|
-
return ((0, jsx_runtime_1.jsx)(DropdownMenuNative_1.MenuItem, { onClick: clickHandler, label: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.label), style: layoutCss, iconPosition: extractValue(node.props.iconPosition), icon: ((_b = node.props) === null || _b === void 0 ? void 0 : _b.icon) && (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: extractValue(node.props.icon) }), active: extractValue.asOptionalBoolean(node.props.active, false), children: renderChild(node.children) }));
|
|
136
|
+
return ((0, jsx_runtime_1.jsx)(DropdownMenuNative_1.MenuItem, { onClick: clickHandler, label: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.label), style: layoutCss, iconPosition: extractValue(node.props.iconPosition), icon: ((_b = node.props) === null || _b === void 0 ? void 0 : _b.icon) && (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: extractValue(node.props.icon) }), active: extractValue.asOptionalBoolean(node.props.active, false), enabled: extractValue.asOptionalBoolean(node.props.enabled, true), children: renderChild(node.children) }));
|
|
135
137
|
});
|
|
136
138
|
const SMCOMP = "SubMenuItem";
|
|
137
139
|
exports.SubMenuItemMd = (0, ComponentDefs_1.createMetadata)({
|
|
@@ -87,13 +87,21 @@ exports.defaultMenuItemProps = {
|
|
|
87
87
|
iconPosition: "start",
|
|
88
88
|
active: false,
|
|
89
89
|
};
|
|
90
|
-
exports.MenuItem = (0, react_1.forwardRef)(function MenuItem({ children, onClick = constants_1.noop, label, style, icon, iconPosition = exports.defaultMenuItemProps.iconPosition, active = exports.defaultMenuItemProps.active, }, ref) {
|
|
90
|
+
exports.MenuItem = (0, react_1.forwardRef)(function MenuItem({ children, onClick = constants_1.noop, label, style, icon, iconPosition = exports.defaultMenuItemProps.iconPosition, active = exports.defaultMenuItemProps.active, enabled = true, }, ref) {
|
|
91
91
|
const iconToStart = iconPosition === "start";
|
|
92
92
|
return ((0, jsx_runtime_1.jsxs)(ReactDropdownMenu.Item, { style: style, className: (0, classnames_1.default)(DropdownMenu_module_scss_1.default.DropdownMenuItem, {
|
|
93
93
|
[DropdownMenu_module_scss_1.default.active]: active,
|
|
94
|
+
[DropdownMenu_module_scss_1.default.disabled]: !enabled,
|
|
94
95
|
}), onClick: (event) => {
|
|
96
|
+
if (!enabled) {
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
event.stopPropagation();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
95
101
|
event.stopPropagation();
|
|
96
|
-
|
|
102
|
+
if (enabled) {
|
|
103
|
+
onClick(event);
|
|
104
|
+
}
|
|
97
105
|
}, ref: ref, children: [iconToStart && icon, (0, jsx_runtime_1.jsx)("div", { className: DropdownMenu_module_scss_1.default.wrapper, children: label !== null && label !== void 0 ? label : children }), !iconToStart && icon] }));
|
|
98
106
|
});
|
|
99
107
|
function SubMenuItem({ children, label, triggerTemplate }) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formControlTypesMd = exports.formControlTypes = exports.FormContext = exports.validationModeMd = exports.defaultValidationMode = exports.validationModeValues = exports.validationSeverityMd = exports.validationSeverityValues = void 0;
|
|
4
|
+
exports.useFormContext = useFormContext;
|
|
4
5
|
exports.useFormContextPart = useFormContextPart;
|
|
5
6
|
const use_context_selector_1 = require("use-context-selector");
|
|
6
7
|
exports.validationSeverityValues = ["error", "warning", "valid", "none"];
|
|
@@ -27,6 +28,9 @@ exports.validationModeMd = [
|
|
|
27
28
|
}
|
|
28
29
|
];
|
|
29
30
|
exports.FormContext = (0, use_context_selector_1.createContext)(undefined);
|
|
31
|
+
function useFormContext() {
|
|
32
|
+
return (0, use_context_selector_1.useContext)(exports.FormContext);
|
|
33
|
+
}
|
|
30
34
|
function useFormContextPart(selector) {
|
|
31
35
|
return (0, use_context_selector_1.useContextSelector)(exports.FormContext, selector);
|
|
32
36
|
}
|
|
@@ -56,7 +56,7 @@ const getByPath = (obj, path) => {
|
|
|
56
56
|
};
|
|
57
57
|
exports.getByPath = getByPath;
|
|
58
58
|
const formReducer = (0, immer_1.default)((state, action) => {
|
|
59
|
-
var _a, _b, _c, _d;
|
|
59
|
+
var _a, _b, _c, _d, _e;
|
|
60
60
|
const { uid } = action.payload;
|
|
61
61
|
if (uid !== undefined && !state.interactionFlags[uid]) {
|
|
62
62
|
state.interactionFlags[uid] = {
|
|
@@ -70,7 +70,7 @@ const formReducer = (0, immer_1.default)((state, action) => {
|
|
|
70
70
|
}
|
|
71
71
|
switch (action.type) {
|
|
72
72
|
case formActions_1.FormActionKind.FIELD_INITIALIZED: {
|
|
73
|
-
if (!state.interactionFlags[uid].isDirty) {
|
|
73
|
+
if (!state.interactionFlags[uid].isDirty || action.payload.force) {
|
|
74
74
|
setByPath(state.subject, uid, action.payload.value);
|
|
75
75
|
}
|
|
76
76
|
break;
|
|
@@ -167,8 +167,7 @@ const formReducer = (0, immer_1.default)((state, action) => {
|
|
|
167
167
|
}
|
|
168
168
|
case formActions_1.FormActionKind.RESET: {
|
|
169
169
|
const { originalSubject } = action.payload;
|
|
170
|
-
return Object.assign(Object.assign({}, initialState), { subject: originalSubject });
|
|
171
|
-
break;
|
|
170
|
+
return Object.assign(Object.assign({}, initialState), { subject: originalSubject, resetVersion: ((_e = state.resetVersion) !== null && _e !== void 0 ? _e : 0) + 1 });
|
|
172
171
|
}
|
|
173
172
|
default:
|
|
174
173
|
}
|
|
@@ -179,6 +178,7 @@ const initialState = {
|
|
|
179
178
|
generalValidationResults: [],
|
|
180
179
|
interactionFlags: {},
|
|
181
180
|
submitInProgress: false,
|
|
181
|
+
resetVersion: 0,
|
|
182
182
|
};
|
|
183
183
|
exports.defaultProps = {
|
|
184
184
|
cancelLabel: "Cancel",
|
|
@@ -203,6 +203,7 @@ const Form = (0, react_2.forwardRef)(function ({ formState, dispatch, initialVal
|
|
|
203
203
|
originalSubject: initialValue,
|
|
204
204
|
validationResults: formState.validationResults,
|
|
205
205
|
interactionFlags: formState.interactionFlags,
|
|
206
|
+
resetVersion: formState.resetVersion,
|
|
206
207
|
dispatch,
|
|
207
208
|
enabled: isEnabled,
|
|
208
209
|
};
|
|
@@ -211,6 +212,7 @@ const Form = (0, react_2.forwardRef)(function ({ formState, dispatch, initialVal
|
|
|
211
212
|
formState.interactionFlags,
|
|
212
213
|
formState.subject,
|
|
213
214
|
formState.validationResults,
|
|
215
|
+
formState.resetVersion,
|
|
214
216
|
initialValue,
|
|
215
217
|
isEnabled,
|
|
216
218
|
itemLabelBreak,
|
|
@@ -27,12 +27,13 @@ var FormActionKind;
|
|
|
27
27
|
FormActionKind["SUBMITTED"] = "FormActionKind:SUBMITTED";
|
|
28
28
|
FormActionKind["RESET"] = "FormActionKind:RESET";
|
|
29
29
|
})(FormActionKind || (exports.FormActionKind = FormActionKind = {}));
|
|
30
|
-
function fieldInitialized(uid, value) {
|
|
30
|
+
function fieldInitialized(uid, value, force = false) {
|
|
31
31
|
return {
|
|
32
32
|
type: FormActionKind.FIELD_INITIALIZED,
|
|
33
33
|
payload: {
|
|
34
34
|
uid,
|
|
35
35
|
value,
|
|
36
|
+
force
|
|
36
37
|
},
|
|
37
38
|
};
|
|
38
39
|
}
|
|
@@ -46,12 +46,14 @@ exports.defaultProps = {
|
|
|
46
46
|
customValidationsDebounce: 0,
|
|
47
47
|
};
|
|
48
48
|
exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
49
|
+
var _b;
|
|
49
50
|
var { style, bindTo, type = exports.defaultProps.type, label, enabled = exports.defaultProps.enabled, labelPosition, labelWidth, labelBreak = exports.defaultProps.labelBreak, children, validations, onValidate, customValidationsDebounce = exports.defaultProps.customValidationsDebounce, validationMode, registerComponentApi, maxTextLength, inputRenderer } = _a, rest = __rest(_a, ["style", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "validations", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength", "inputRenderer"]);
|
|
50
51
|
const defaultId = (0, react_1.useId)();
|
|
51
52
|
const [formItemId, setFormItemId] = (0, react_1.useState)(bindTo);
|
|
52
53
|
const labelWidthValue = (0, FormContext_1.useFormContextPart)((value) => labelWidth || value.itemLabelWidth);
|
|
53
54
|
const labelBreakValue = (0, FormContext_1.useFormContextPart)((value) => labelBreak !== undefined ? labelBreak : value.itemLabelBreak);
|
|
54
55
|
const labelPositionValue = (0, FormContext_1.useFormContextPart)((value) => labelPosition || value.itemLabelPosition || DEFAULT_LABEL_POSITIONS[type]);
|
|
56
|
+
const resetVersion = (_b = (0, FormContext_1.useFormContext)()) === null || _b === void 0 ? void 0 : _b.resetVersion;
|
|
55
57
|
const initialValueFromSubject = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.originalSubject, formItemId));
|
|
56
58
|
const initialValue = initialValueFromSubject === undefined ? rest.initialValue : initialValueFromSubject;
|
|
57
59
|
const value = (0, FormContext_1.useFormContextPart)((value) => (0, FormNative_1.getByPath)(value.subject, formItemId));
|
|
@@ -64,6 +66,11 @@ exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
|
64
66
|
setFormItemId(newId);
|
|
65
67
|
dispatch((0, formActions_1.fieldInitialized)(newId, initialValue));
|
|
66
68
|
}, [bindTo, dispatch, initialValue]);
|
|
69
|
+
(0, react_1.useEffect)(() => {
|
|
70
|
+
if (resetVersion) {
|
|
71
|
+
dispatch((0, formActions_1.fieldInitialized)(formItemId, initialValue, true));
|
|
72
|
+
}
|
|
73
|
+
}, [resetVersion, formItemId, initialValue, dispatch]);
|
|
67
74
|
(0, Validations_1.useValidation)(validations, onValidate, value, dispatch, formItemId, customValidationsDebounce);
|
|
68
75
|
const onStateChange = (0, react_1.useCallback)(({ value }, options) => {
|
|
69
76
|
//we already handled the initial value in the useEffect with fieldInitialized(...);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MoonIcon = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const moon_svg_react_1 = __importDefault(require("./svg/moon.svg?react"));
|
|
9
|
+
const MoonIcon = (props) => ((0, jsx_runtime_1.jsx)(moon_svg_react_1.default, Object.assign({}, props)));
|
|
10
|
+
exports.MoonIcon = MoonIcon;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.StarsIcon = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const stars_svg_react_1 = __importDefault(require("./svg/stars.svg?react"));
|
|
9
|
+
const StarsIcon = (props) => ((0, jsx_runtime_1.jsx)(stars_svg_react_1.default, Object.assign({}, props)));
|
|
10
|
+
exports.StarsIcon = StarsIcon;
|
|
@@ -79,6 +79,8 @@ const SortDescendingIcon_1 = require("./Icon/SortDescendingIcon");
|
|
|
79
79
|
const NoSortIcon_1 = require("./Icon/NoSortIcon");
|
|
80
80
|
const TrendingLevelIcon_1 = require("./Icon/TrendingLevelIcon");
|
|
81
81
|
const Inspect_1 = require("./Icon/Inspect");
|
|
82
|
+
const MoonIcon_1 = require("./Icon/MoonIcon");
|
|
83
|
+
const StarsIcon_1 = require("./Icon/StarsIcon");
|
|
82
84
|
const pool = new Map();
|
|
83
85
|
function registerIconRenderer(name, renderer) {
|
|
84
86
|
if (typeof name === "object") {
|
|
@@ -194,7 +196,8 @@ registerIconRenderer("duplicate", (props) => (0, jsx_runtime_1.jsx)(hi_1.HiOutli
|
|
|
194
196
|
registerIconRenderer("connect", (props) => (0, jsx_runtime_1.jsx)(rx_1.RxLightningBolt, Object.assign({}, props)));
|
|
195
197
|
registerIconRenderer("cog", (props) => (0, jsx_runtime_1.jsx)(hi_1.HiOutlineCog, Object.assign({}, props)));
|
|
196
198
|
registerIconRenderer("sun", (props) => (0, jsx_runtime_1.jsx)(hi2_1.HiSun, Object.assign({}, props)));
|
|
197
|
-
registerIconRenderer("moon", (props) => (0, jsx_runtime_1.jsx)(
|
|
199
|
+
registerIconRenderer("moon", (props) => (0, jsx_runtime_1.jsx)(MoonIcon_1.MoonIcon, Object.assign({}, props)));
|
|
200
|
+
registerIconRenderer("stars", (props) => (0, jsx_runtime_1.jsx)(StarsIcon_1.StarsIcon, Object.assign({}, props)));
|
|
198
201
|
registerIconRenderer("share", (props) => (0, jsx_runtime_1.jsx)(ShareIcon_1.ShareIcon, Object.assign({}, props)));
|
|
199
202
|
registerIconRenderer("new-window", (props) => (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, Object.assign({}, props)));
|
|
200
203
|
registerIconRenderer("paint", (props) => (0, jsx_runtime_1.jsx)(hi2_1.HiOutlinePaintBrush, Object.assign({}, props)));
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.inspectButtonComponentRenderer = exports.InspectButtonMd = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
|
|
9
|
+
const renderers_1 = require("../../components-core/renderers");
|
|
10
|
+
const ButtonNative_1 = require("../Button/ButtonNative");
|
|
11
|
+
const InspectorContext_1 = require("../../components-core/InspectorContext");
|
|
12
|
+
const InspectButton_module_scss_1 = __importDefault(require("./InspectButton.module.scss"));
|
|
13
|
+
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
14
|
+
const pi_1 = require("react-icons/pi");
|
|
15
|
+
const COMP = "InspectButton";
|
|
16
|
+
exports.InspectButtonMd = (0, ComponentDefs_1.createMetadata)({
|
|
17
|
+
status: "experimental",
|
|
18
|
+
description: "This component displays a button that can turn the inspection " +
|
|
19
|
+
"mode of a running XMLUI app on or off.",
|
|
20
|
+
props: {},
|
|
21
|
+
themeVars: (0, themeVars_1.parseScssVar)(InspectButton_module_scss_1.default.themeVars),
|
|
22
|
+
});
|
|
23
|
+
function InspectButton({ children, style }) {
|
|
24
|
+
const { setInspectMode, inspectMode } = (0, InspectorContext_1.useInspectMode)();
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(ButtonNative_1.Button, { style: style, className: InspectButton_module_scss_1.default.inspectButton, themeColor: inspectMode ? "primary" : "secondary", variant: inspectMode ? "solid" : "outlined", onClick: () => {
|
|
26
|
+
setInspectMode((prev) => !prev);
|
|
27
|
+
}, children: [(0, jsx_runtime_1.jsx)(pi_1.PiFileCode, { className: InspectButton_module_scss_1.default.icon }), children] }));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Define the renderer for the Button component
|
|
31
|
+
*/
|
|
32
|
+
exports.inspectButtonComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.InspectButtonMd, ({ renderChild, node, layoutCss }) => {
|
|
33
|
+
return (0, jsx_runtime_1.jsx)(InspectButton, { style: layoutCss, children: renderChild(node.children) });
|
|
34
|
+
});
|
|
@@ -15,7 +15,7 @@ exports.ToneChangerButtonMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
15
15
|
});
|
|
16
16
|
function ToneChangerButton() {
|
|
17
17
|
const { activeThemeTone, setActiveThemeTone } = (0, ThemeContext_1.useThemes)();
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: activeThemeTone === "light" ? "
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: activeThemeTone === "light" ? "stars" : "sun" }), onClick: () => {
|
|
19
19
|
activeThemeTone === "light" ? setActiveThemeTone("dark") : setActiveThemeTone("light");
|
|
20
20
|
} }));
|
|
21
21
|
}
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.InspectorContext = void 0;
|
|
7
7
|
exports.InspectorProvider = InspectorProvider;
|
|
8
8
|
exports.useDevTools = useDevTools;
|
|
9
|
+
exports.useInspectMode = useInspectMode;
|
|
9
10
|
exports.useInspector = useInspector;
|
|
10
11
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
12
|
const react_1 = require("react");
|
|
@@ -14,9 +15,9 @@ const react_dom_1 = require("react-dom");
|
|
|
14
15
|
const ThemeContext_1 = require("./theming/ThemeContext");
|
|
15
16
|
const classnames_1 = __importDefault(require("classnames"));
|
|
16
17
|
const ButtonNative_1 = require("../components/Button/ButtonNative");
|
|
17
|
-
const IconNative_1 = __importDefault(require("../components/Icon/IconNative"));
|
|
18
18
|
const InspectorButton_module_scss_1 = __importDefault(require("./InspectorButton.module.scss"));
|
|
19
19
|
const ComponentRegistryContext_1 = require("../components/ComponentRegistryContext");
|
|
20
|
+
const pi_1 = require("react-icons/pi");
|
|
20
21
|
// --- The context object that is used to store the inspector information.
|
|
21
22
|
exports.InspectorContext = (0, react_1.createContext)(null);
|
|
22
23
|
function InspectorProvider({ children, sources, projectCompilation, mockApi, }) {
|
|
@@ -26,6 +27,7 @@ function InspectorProvider({ children, sources, projectCompilation, mockApi, })
|
|
|
26
27
|
const [showCode, setShowCode] = (0, react_1.useState)(false);
|
|
27
28
|
const [devToolsSize, setDevToolsSize] = (0, react_1.useState)(0);
|
|
28
29
|
const [devToolsSide, setDevToolsSide] = (0, react_1.useState)("bottom");
|
|
30
|
+
const [inspectMode, setInspectMode] = (0, react_1.useState)(false);
|
|
29
31
|
const componentRegistry = (0, ComponentRegistryContext_1.useComponentRegistry)();
|
|
30
32
|
const devToolsEntry = componentRegistry.lookupComponentRenderer("XMLUIDevtools.DevTools");
|
|
31
33
|
const contextValue = (0, react_1.useMemo)(() => {
|
|
@@ -61,19 +63,30 @@ function InspectorProvider({ children, sources, projectCompilation, mockApi, })
|
|
|
61
63
|
setDevToolsSide,
|
|
62
64
|
devToolsEnabled: showCode,
|
|
63
65
|
projectCompilation: projectCompilation,
|
|
66
|
+
setInspectMode,
|
|
67
|
+
inspectMode,
|
|
64
68
|
mockApi,
|
|
65
69
|
};
|
|
66
|
-
}, [
|
|
70
|
+
}, [
|
|
71
|
+
devToolsSide,
|
|
72
|
+
devToolsSize,
|
|
73
|
+
sources,
|
|
74
|
+
inspectedNode,
|
|
75
|
+
showCode,
|
|
76
|
+
projectCompilation,
|
|
77
|
+
inspectMode,
|
|
78
|
+
mockApi,
|
|
79
|
+
]);
|
|
67
80
|
return ((0, jsx_runtime_1.jsxs)(exports.InspectorContext.Provider, { value: contextValue, children: [children, process.env.VITE_USER_COMPONENTS_Inspect !== "false" &&
|
|
68
81
|
showCode &&
|
|
69
82
|
inspectedNode !== null &&
|
|
70
83
|
(0, react_dom_1.createPortal)(devToolsEntry === null || devToolsEntry === void 0 ? void 0 : devToolsEntry.renderer({}), root), process.env.VITE_USER_COMPONENTS_Inspect !== "false" &&
|
|
71
84
|
inspectable &&
|
|
72
85
|
Object.values(inspectable).map((item) => {
|
|
73
|
-
return ((0, jsx_runtime_1.jsx)(InspectButton, { setShowCode: setShowCode, inspectId: item.inspectId, node: item.node, setInspectedNode: setInspectedNode }, item.inspectId + +"-" + item.key));
|
|
86
|
+
return ((0, jsx_runtime_1.jsx)(InspectButton, { inspectedNode: inspectedNode, setShowCode: setShowCode, inspectId: item.inspectId, node: item.node, setInspectedNode: setInspectedNode, inspectMode: inspectMode }, item.inspectId + +"-" + item.key));
|
|
74
87
|
})] }));
|
|
75
88
|
}
|
|
76
|
-
function InspectButton({ inspectId, node, setInspectedNode, setShowCode, }) {
|
|
89
|
+
function InspectButton({ inspectId, node, inspectedNode, setInspectedNode, setShowCode, inspectMode, }) {
|
|
77
90
|
const { root } = (0, ThemeContext_1.useTheme)();
|
|
78
91
|
const [referenceElement, setReferenceElement] = (0, react_1.useState)(null);
|
|
79
92
|
const [popperElement, setPopperElement] = (0, react_1.useState)(null);
|
|
@@ -83,7 +96,7 @@ function InspectButton({ inspectId, node, setInspectedNode, setShowCode, }) {
|
|
|
83
96
|
{
|
|
84
97
|
name: "offset",
|
|
85
98
|
options: {
|
|
86
|
-
offset: [
|
|
99
|
+
offset: [-4, -18],
|
|
87
100
|
},
|
|
88
101
|
},
|
|
89
102
|
{
|
|
@@ -98,12 +111,55 @@ function InspectButton({ inspectId, node, setInspectedNode, setShowCode, }) {
|
|
|
98
111
|
const [visible, setVisible] = (0, react_1.useState)(false);
|
|
99
112
|
const timeoutRef = (0, react_1.useRef)(null);
|
|
100
113
|
const hoverRef = (0, react_1.useRef)(false);
|
|
114
|
+
(0, react_1.useEffect)(() => {
|
|
115
|
+
if (!referenceElement) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if ((inspectedNode === null || inspectedNode === void 0 ? void 0 : inspectedNode.inspectId) === inspectId) {
|
|
119
|
+
referenceElement.classList.add(InspectorButton_module_scss_1.default.inspectedNode);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
referenceElement.classList.remove(InspectorButton_module_scss_1.default.inspectedNode);
|
|
123
|
+
}
|
|
124
|
+
}, [inspectId, inspectedNode, referenceElement]);
|
|
125
|
+
(0, react_1.useEffect)(() => {
|
|
126
|
+
if (inspectedNode) {
|
|
127
|
+
setShowCode(true);
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
setShowCode(false);
|
|
131
|
+
}
|
|
132
|
+
}, [inspectedNode]);
|
|
101
133
|
(0, react_1.useEffect)(() => {
|
|
102
134
|
const htmlElement = document.querySelector(`[data-inspectId="${inspectId}"]`);
|
|
103
135
|
if (!htmlElement) {
|
|
104
136
|
return;
|
|
105
137
|
}
|
|
106
138
|
setReferenceElement(htmlElement);
|
|
139
|
+
if (inspectMode) {
|
|
140
|
+
htmlElement.classList.add(InspectorButton_module_scss_1.default.inspectableNode);
|
|
141
|
+
const overlay = document.createElement("div");
|
|
142
|
+
overlay.classList.add(InspectorButton_module_scss_1.default.inspectOverlay);
|
|
143
|
+
htmlElement.appendChild(overlay);
|
|
144
|
+
overlay.addEventListener("click", () => {
|
|
145
|
+
setInspectedNode((prev) => {
|
|
146
|
+
if ((prev === null || prev === void 0 ? void 0 : prev.inspectId) === inspectId) {
|
|
147
|
+
return null;
|
|
148
|
+
}
|
|
149
|
+
return Object.assign(Object.assign({}, node), { inspectId });
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (!inspectMode) {
|
|
154
|
+
htmlElement.classList.remove(InspectorButton_module_scss_1.default.inspectableNode);
|
|
155
|
+
setInspectedNode(null);
|
|
156
|
+
setShowCode(false);
|
|
157
|
+
const overlay = htmlElement.querySelector(`.${InspectorButton_module_scss_1.default.inspectOverlay}`);
|
|
158
|
+
if (overlay) {
|
|
159
|
+
overlay.remove();
|
|
160
|
+
}
|
|
161
|
+
htmlElement.classList.remove(InspectorButton_module_scss_1.default.inspectedNode);
|
|
162
|
+
}
|
|
107
163
|
function mouseenter() {
|
|
108
164
|
if (timeoutRef.current) {
|
|
109
165
|
clearTimeout(timeoutRef.current);
|
|
@@ -127,22 +183,24 @@ function InspectButton({ inspectId, node, setInspectedNode, setShowCode, }) {
|
|
|
127
183
|
htmlElement.removeEventListener("mouseenter", mouseenter);
|
|
128
184
|
htmlElement.removeEventListener("mouseleave", mouseleave);
|
|
129
185
|
};
|
|
130
|
-
}, [inspectId]);
|
|
131
|
-
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
timeoutRef.current
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
186
|
+
}, [inspectId, node, inspectMode, setShowCode]);
|
|
187
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: inspectMode
|
|
188
|
+
? null
|
|
189
|
+
: visible &&
|
|
190
|
+
!!root &&
|
|
191
|
+
(0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, Object.assign({ variant: "ghost", className: (0, classnames_1.default)(InspectorButton_module_scss_1.default.wrapper, "_debug-inspect-button"), ref: (el) => setPopperElement(el), style: Object.assign(Object.assign({}, popperStyles.popper), { padding: 0 }) }, attributes.popper, { onMouseEnter: () => {
|
|
192
|
+
hoverRef.current = true;
|
|
193
|
+
if (timeoutRef.current) {
|
|
194
|
+
clearTimeout(timeoutRef.current);
|
|
195
|
+
timeoutRef.current = null;
|
|
196
|
+
}
|
|
197
|
+
}, onMouseLeave: () => {
|
|
198
|
+
hoverRef.current = false;
|
|
199
|
+
setVisible(false);
|
|
200
|
+
}, onClick: () => {
|
|
201
|
+
setInspectedNode(node);
|
|
202
|
+
setShowCode(true);
|
|
203
|
+
}, children: (0, jsx_runtime_1.jsx)(pi_1.PiFileCode, { className: InspectorButton_module_scss_1.default.inspectIcon }) })), root) }));
|
|
146
204
|
}
|
|
147
205
|
function useDevTools() {
|
|
148
206
|
const context = (0, react_1.useContext)(exports.InspectorContext);
|
|
@@ -159,6 +217,13 @@ function useDevTools() {
|
|
|
159
217
|
mockApi: context === null || context === void 0 ? void 0 : context.mockApi,
|
|
160
218
|
};
|
|
161
219
|
}
|
|
220
|
+
function useInspectMode() {
|
|
221
|
+
const context = (0, react_1.useContext)(exports.InspectorContext);
|
|
222
|
+
return {
|
|
223
|
+
setInspectMode: context === null || context === void 0 ? void 0 : context.setInspectMode,
|
|
224
|
+
inspectMode: context === null || context === void 0 ? void 0 : context.inspectMode,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
162
227
|
function useInspector(node, uid) {
|
|
163
228
|
var _a;
|
|
164
229
|
const context = (0, react_1.useContext)(exports.InspectorContext);
|