xmlui 0.9.81 → 0.9.82
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-D77lU9Le.mjs → index-z40PVcrw.mjs} +14895 -19628
- package/dist/lib/index.css +1 -1
- package/dist/lib/{initMock-C5i5r003.mjs → initMock-BPsXM5rg.mjs} +1 -1
- package/dist/lib/language-server-web-worker.mjs +1 -1
- package/dist/lib/language-server.mjs +1 -1
- package/dist/lib/{server-common-CfdMYx46.mjs → server-common-LUcdzTQs.mjs} +4433 -4463
- package/dist/lib/xmlui-parser.d.ts +46 -46
- package/dist/lib/xmlui.d.ts +22 -1
- package/dist/lib/xmlui.mjs +8 -7
- package/dist/metadata/{collectedComponentMetadata-B0baUYi4.mjs → collectedComponentMetadata-DMqRnWLT.mjs} +19809 -24517
- package/dist/metadata/{initMock-CET5B1va.mjs → initMock-qDOHn1cO.mjs} +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +1 -1
- package/dist/metadata/xmlui-metadata.umd.js +130 -138
- package/dist/scripts/package.json +2 -1
- package/dist/scripts/src/components/FormItem/FormItem.js +7 -39
- package/dist/scripts/src/components/FormItem/FormItemNative.js +24 -1
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +1 -2
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +6 -2
- package/dist/scripts/src/components/ModalDialog/ModalDialogNative.js +21 -8
- package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +6 -4
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +18 -4
- package/dist/scripts/src/components-core/rendering/AppContent.js +2 -1
- package/dist/scripts/src/syntax/grammar.tmLanguage.json +1 -1
- package/dist/standalone/xmlui-standalone.es.d.ts +37 -14
- package/dist/standalone/xmlui-standalone.umd.js +236 -244
- package/package.json +2 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xmlui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.82",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start-test-bed": "cd src/testing/infrastructure && xmlui start",
|
|
@@ -114,6 +114,7 @@
|
|
|
114
114
|
"vite-plugin-svgr": "4.2.0",
|
|
115
115
|
"vscode-languageserver": "^9.0.1",
|
|
116
116
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
117
|
+
"framer-motion": "^12.18.1",
|
|
117
118
|
"yargs": "17.7.2"
|
|
118
119
|
},
|
|
119
120
|
"devDependencies": {
|
|
@@ -19,7 +19,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
19
19
|
const FormItem_module_scss_1 = __importDefault(require("./FormItem.module.scss"));
|
|
20
20
|
const renderers_1 = require("../../components-core/renderers");
|
|
21
21
|
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
22
|
-
const react_1 = require("react");
|
|
23
22
|
const FormContext_1 = require("../Form/FormContext");
|
|
24
23
|
const metadata_helpers_1 = require("../metadata-helpers");
|
|
25
24
|
const Validations_1 = require("./Validations");
|
|
@@ -193,43 +192,6 @@ exports.FormItemMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
193
192
|
exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.FormItemMd, ({ node, renderChild, extractValue, layoutCss, layoutContext, lookupEventHandler, lookupAction, registerComponentApi, }) => {
|
|
194
193
|
var _a;
|
|
195
194
|
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"]);
|
|
196
|
-
//extractValue works as a memoization mechanism too (if there's nothing to resolve, it won't produce a new object every time)
|
|
197
|
-
const resolvedValidationPropsAndEvents = (0, react_1.useMemo)(() => ({
|
|
198
|
-
required: extractValue.asOptionalBoolean(required),
|
|
199
|
-
requiredInvalidMessage: extractValue.asOptionalString(requiredInvalidMessage),
|
|
200
|
-
minLength: extractValue.asOptionalNumber(minLength),
|
|
201
|
-
maxLength: extractValue.asOptionalNumber(maxLength),
|
|
202
|
-
lengthInvalidMessage: extractValue.asOptionalString(lengthInvalidMessage),
|
|
203
|
-
lengthInvalidSeverity: (0, Validations_1.parseSeverity)(extractValue.asOptionalString(lengthInvalidSeverity)),
|
|
204
|
-
minValue: extractValue.asOptionalNumber(minValue),
|
|
205
|
-
maxValue: extractValue.asOptionalNumber(maxValue),
|
|
206
|
-
rangeInvalidMessage: extractValue.asOptionalString(rangeInvalidMessage),
|
|
207
|
-
rangeInvalidSeverity: (0, Validations_1.parseSeverity)(extractValue.asOptionalString(rangeInvalidSeverity)),
|
|
208
|
-
pattern: extractValue.asOptionalString(pattern),
|
|
209
|
-
patternInvalidMessage: extractValue.asOptionalString(patternInvalidMessage),
|
|
210
|
-
patternInvalidSeverity: (0, Validations_1.parseSeverity)(extractValue.asOptionalString(patternInvalidSeverity)),
|
|
211
|
-
regex: extractValue.asOptionalString(regex),
|
|
212
|
-
regexInvalidMessage: extractValue.asOptionalString(regexInvalidMessage),
|
|
213
|
-
regexInvalidSeverity: (0, Validations_1.parseSeverity)(extractValue.asOptionalString(regexInvalidSeverity)),
|
|
214
|
-
}), [
|
|
215
|
-
required,
|
|
216
|
-
requiredInvalidMessage,
|
|
217
|
-
minLength,
|
|
218
|
-
maxLength,
|
|
219
|
-
lengthInvalidMessage,
|
|
220
|
-
lengthInvalidSeverity,
|
|
221
|
-
minValue,
|
|
222
|
-
maxValue,
|
|
223
|
-
rangeInvalidMessage,
|
|
224
|
-
rangeInvalidSeverity,
|
|
225
|
-
pattern,
|
|
226
|
-
patternInvalidMessage,
|
|
227
|
-
patternInvalidSeverity,
|
|
228
|
-
regex,
|
|
229
|
-
regexInvalidMessage,
|
|
230
|
-
regexInvalidSeverity,
|
|
231
|
-
extractValue,
|
|
232
|
-
]);
|
|
233
195
|
const nonLayoutCssProps = !layoutCss
|
|
234
196
|
? rest
|
|
235
197
|
: Object.fromEntries(Object.entries(rest).filter(([key, _]) => {
|
|
@@ -239,7 +201,13 @@ exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COM
|
|
|
239
201
|
const formItemType = extractValue.asOptionalString(type);
|
|
240
202
|
const isCustomFormItem = (formItemType === undefined || formItemType === "custom") && !!node.children;
|
|
241
203
|
const inputTemplate = node.children || ((_a = node.props) === null || _a === void 0 ? void 0 : _a.inputTemplate);
|
|
242
|
-
return ((0, jsx_runtime_1.jsx)(FormItemNative_1.FormItem
|
|
204
|
+
return ((0, jsx_runtime_1.jsx)(FormItemNative_1.FormItem
|
|
205
|
+
// --- validation props
|
|
206
|
+
, Object.assign({
|
|
207
|
+
// --- validation props
|
|
208
|
+
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)),
|
|
209
|
+
// ----
|
|
210
|
+
style: layoutCss, 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
|
|
243
211
|
? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: inputTemplate, renderChild: renderChild, layoutContext: layoutContext }))
|
|
244
212
|
: 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, {
|
|
245
213
|
type: formItemType,
|
|
@@ -38,6 +38,7 @@ const HelperText_1 = require("./HelperText");
|
|
|
38
38
|
const NumberBox2Native_1 = require("../NumberBox/NumberBox2Native");
|
|
39
39
|
const ItemsNative_1 = require("../Items/ItemsNative");
|
|
40
40
|
const constants_1 = require("../../components-core/constants");
|
|
41
|
+
const hooks_1 = require("../../components-core/utils/hooks");
|
|
41
42
|
const DEFAULT_LABEL_POSITIONS = {
|
|
42
43
|
checkbox: "end",
|
|
43
44
|
};
|
|
@@ -70,7 +71,29 @@ function ArrayLikeFormItem({ children, formItemId, registerComponentApi, value =
|
|
|
70
71
|
return (0, jsx_runtime_1.jsx)(FormItemContext.Provider, { value: formContextValue, children: children });
|
|
71
72
|
}
|
|
72
73
|
exports.FormItem = (0, react_1.memo)(function FormItem(_a) {
|
|
73
|
-
var {
|
|
74
|
+
var {
|
|
75
|
+
// --- validation props
|
|
76
|
+
required, requiredInvalidMessage, minLength, maxLength, lengthInvalidMessage, lengthInvalidSeverity, minValue, maxValue, rangeInvalidMessage, rangeInvalidSeverity, pattern, patternInvalidMessage, patternInvalidSeverity, regex, regexInvalidMessage, regexInvalidSeverity,
|
|
77
|
+
// ---
|
|
78
|
+
style, 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", "bindTo", "type", "label", "enabled", "labelPosition", "labelWidth", "labelBreak", "children", "onValidate", "customValidationsDebounce", "validationMode", "registerComponentApi", "maxTextLength", "inputRenderer", "itemIndex", "initialValue", "gap"]);
|
|
79
|
+
const validations = (0, hooks_1.useShallowCompareMemoize)({
|
|
80
|
+
required,
|
|
81
|
+
requiredInvalidMessage,
|
|
82
|
+
minLength,
|
|
83
|
+
maxLength,
|
|
84
|
+
lengthInvalidMessage,
|
|
85
|
+
lengthInvalidSeverity,
|
|
86
|
+
minValue,
|
|
87
|
+
maxValue,
|
|
88
|
+
rangeInvalidMessage,
|
|
89
|
+
rangeInvalidSeverity,
|
|
90
|
+
pattern,
|
|
91
|
+
patternInvalidMessage,
|
|
92
|
+
patternInvalidSeverity,
|
|
93
|
+
regex,
|
|
94
|
+
regexInvalidMessage,
|
|
95
|
+
regexInvalidSeverity,
|
|
96
|
+
});
|
|
74
97
|
const defaultId = (0, react_1.useId)();
|
|
75
98
|
const { parentFormItemId } = (0, react_1.useContext)(FormItemContext);
|
|
76
99
|
const formItemId = (0, react_1.useMemo)(() => {
|
|
@@ -396,7 +396,6 @@ function removeSuffixFromReactNodes(node, suffix) {
|
|
|
396
396
|
}
|
|
397
397
|
const LinkAwareHeading = ({ level, children, showHeadingAnchors }) => {
|
|
398
398
|
const { appGlobals } = (0, AppContext_1.useAppContext)();
|
|
399
|
-
const headingRef = (0, react_1.useRef)(null);
|
|
400
399
|
// --- Extract the optional anchor
|
|
401
400
|
let anchor = undefined;
|
|
402
401
|
let label = children;
|
|
@@ -408,7 +407,7 @@ const LinkAwareHeading = ({ level, children, showHeadingAnchors }) => {
|
|
|
408
407
|
label = removeSuffixFromReactNodes(children, anchorText);
|
|
409
408
|
}
|
|
410
409
|
const headingId = anchor !== null && anchor !== void 0 ? anchor : getHeadingId(children);
|
|
411
|
-
return ((0, jsx_runtime_1.jsxs)(HeadingNative_1.Heading, { level: level, id: headingId, className: Markdown_module_scss_1.default.linkAwareHeading,
|
|
410
|
+
return ((0, jsx_runtime_1.jsxs)(HeadingNative_1.Heading, { level: level, id: headingId, className: Markdown_module_scss_1.default.linkAwareHeading, children: [label, showHeadingAnchors && ((0, jsx_runtime_1.jsx)("a", { href: `#${headingId}`, className: Markdown_module_scss_1.default.headingLink, onClick: (e) => {
|
|
412
411
|
var _a;
|
|
413
412
|
e.preventDefault();
|
|
414
413
|
(_a = appGlobals.events) === null || _a === void 0 ? void 0 : _a.emit("scroll-to-anchor", { anchor: headingId });
|
|
@@ -95,11 +95,15 @@ const ConfirmationModalContextProvider = ({ children }) => {
|
|
|
95
95
|
});
|
|
96
96
|
}), []);
|
|
97
97
|
const handleOk = (0, react_1.useCallback)((value) => {
|
|
98
|
-
|
|
98
|
+
if (resolver.current) {
|
|
99
|
+
resolver.current(value);
|
|
100
|
+
}
|
|
99
101
|
setShowConfirmationModal(false);
|
|
100
102
|
}, []);
|
|
101
103
|
const handleCancel = (0, react_1.useCallback)(() => {
|
|
102
|
-
|
|
104
|
+
if (resolver.current) {
|
|
105
|
+
resolver.current(false);
|
|
106
|
+
}
|
|
103
107
|
setShowConfirmationModal(false);
|
|
104
108
|
}, []);
|
|
105
109
|
const contextValue = (0, react_1.useMemo)(() => {
|
|
@@ -76,6 +76,7 @@ exports.ModalDialogFrame = react_1.default.forwardRef(({ isInitiallyOpen, onOpen
|
|
|
76
76
|
ref,
|
|
77
77
|
}) })) : null;
|
|
78
78
|
});
|
|
79
|
+
exports.ModalDialogFrame.displayName = "ModalDialogFrame";
|
|
79
80
|
const ModalStateContext = react_1.default.createContext(null);
|
|
80
81
|
function useModalLocalOpenState(isInitiallyOpen, onOpen, onClose) {
|
|
81
82
|
const [isOpen, setIsOpen] = (0, react_1.useState)(isInitiallyOpen);
|
|
@@ -117,6 +118,10 @@ function useModalOpenState(isInitiallyOpen = true, onOpen, onClose) {
|
|
|
117
118
|
}
|
|
118
119
|
exports.ModalDialog = react_1.default.forwardRef(({ children, style, isInitiallyOpen, fullScreen = exports.defaultProps.fullScreen, title, closeButtonVisible = exports.defaultProps.closeButtonVisible, onOpen, onClose, }, ref) => {
|
|
119
120
|
const { root } = (0, ThemeContext_1.useTheme)();
|
|
121
|
+
// NOTE: at this point, we can't use useAppContext here,
|
|
122
|
+
// since the ModalDialog context provider (via ConfirmationModalContextProvider) is mounted outside of the AppContext,
|
|
123
|
+
// and ModalDialogs can also be called using the imperative API (see functions like "confirm")
|
|
124
|
+
const isDialogRootInShadowDom = (root === null || root === void 0 ? void 0 : root.getRootNode()) instanceof ShadowRoot;
|
|
120
125
|
const modalRef = (0, react_1.useRef)(null);
|
|
121
126
|
const composedRef = ref ? (0, react_compose_refs_1.composeRefs)(ref, modalRef) : modalRef;
|
|
122
127
|
const { isOpen, doClose, doOpen } = useModalOpenState(isInitiallyOpen, onOpen, onClose);
|
|
@@ -159,14 +164,22 @@ exports.ModalDialog = react_1.default.forwardRef(({ children, style, isInitially
|
|
|
159
164
|
if (!root) {
|
|
160
165
|
return null;
|
|
161
166
|
}
|
|
162
|
-
|
|
167
|
+
const Content = ((0, jsx_runtime_1.jsxs)(Dialog.Content, { className: (0, classnames_1.default)(ModalDialog_module_scss_1.default.content), onPointerDownOutside: (event) => {
|
|
168
|
+
if (event.target instanceof Element &&
|
|
169
|
+
event.target.closest("._debug-inspect-button") !== null) {
|
|
170
|
+
//we prevent the auto modal close on clicking the inspect button
|
|
171
|
+
event.preventDefault();
|
|
172
|
+
}
|
|
173
|
+
}, ref: composedRef, style: Object.assign(Object.assign({}, style), { gap: undefined }), children: [!!title && ((0, jsx_runtime_1.jsx)(Dialog.Title, { style: { marginTop: 0 }, children: (0, jsx_runtime_1.jsx)("header", { id: "dialogTitle", className: ModalDialog_module_scss_1.default.dialogTitle, children: title }) })), (0, jsx_runtime_1.jsx)("div", { className: ModalDialog_module_scss_1.default.innerContent, style: { gap: style === null || style === void 0 ? void 0 : style.gap }, children: (0, jsx_runtime_1.jsx)(ModalVisibilityContext_1.ModalVisibilityContext.Provider, { value: modalVisibilityContextValue, children: children }) }), closeButtonVisible && ((0, jsx_runtime_1.jsx)(Dialog.Close, { asChild: true, children: (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", themeColor: "secondary", className: ModalDialog_module_scss_1.default.closeButton, "aria-label": "Close", icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "close", size: "sm" }), orientation: "vertical" }) }))] }));
|
|
174
|
+
return ((0, jsx_runtime_1.jsx)(Dialog.Root, { open: isOpen, onOpenChange: (open) => (open ? doOpen() : doClose()), children: (0, jsx_runtime_1.jsxs)(Dialog.Portal, { container: root, children: [isDialogRootInShadowDom && (
|
|
175
|
+
/*
|
|
176
|
+
In the Shadow DOM we can omit the Dialog.Overlay,
|
|
177
|
+
since we get the same result & the main content outside remains scrollable.
|
|
178
|
+
*/
|
|
179
|
+
(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(ModalDialog_module_scss_1.default.overlayBg, ModalDialog_module_scss_1.default.nested, {
|
|
163
180
|
[ModalDialog_module_scss_1.default.fullScreen]: fullScreen,
|
|
164
|
-
}), children: (0, jsx_runtime_1.jsxs)(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
//we prevent the auto modal close on clicking the inspect button
|
|
168
|
-
event.preventDefault();
|
|
169
|
-
}
|
|
170
|
-
}, ref: composedRef, style: Object.assign(Object.assign({}, style), { gap: undefined }), children: [!!title && ((0, jsx_runtime_1.jsx)(Dialog.Title, { style: { marginTop: 0 }, children: (0, jsx_runtime_1.jsx)("header", { id: "dialogTitle", className: ModalDialog_module_scss_1.default.dialogTitle, children: title }) })), (0, jsx_runtime_1.jsx)("div", { className: ModalDialog_module_scss_1.default.innerContent, style: { gap: style === null || style === void 0 ? void 0 : style.gap }, children: (0, jsx_runtime_1.jsx)(ModalVisibilityContext_1.ModalVisibilityContext.Provider, { value: modalVisibilityContextValue, children: children }) }), closeButtonVisible && ((0, jsx_runtime_1.jsx)(Dialog.Close, { asChild: true, children: (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", themeColor: "secondary", className: ModalDialog_module_scss_1.default.closeButton, "aria-label": "Close", icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: "close", size: "sm" }), orientation: "vertical" }) }))] }) })] }) }));
|
|
181
|
+
}), children: Content })), !isDialogRootInShadowDom && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(ModalDialog_module_scss_1.default.overlayBg) }), (0, jsx_runtime_1.jsx)(Dialog.Overlay, { className: (0, classnames_1.default)(ModalDialog_module_scss_1.default.overlay, {
|
|
182
|
+
[ModalDialog_module_scss_1.default.fullScreen]: fullScreen,
|
|
183
|
+
}), children: Content })] }))] }) }));
|
|
171
184
|
});
|
|
172
185
|
exports.ModalDialog.displayName = "ModalDialog";
|
|
@@ -26,6 +26,7 @@ const utils_1 = require("./utils");
|
|
|
26
26
|
const AppContext_1 = require("../../components-core/AppContext");
|
|
27
27
|
const classnames_1 = __importDefault(require("classnames"));
|
|
28
28
|
const logo_svg_react_1 = __importDefault(require("./logo.svg?react"));
|
|
29
|
+
const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
|
|
29
30
|
/**
|
|
30
31
|
* A component that displays markdown content on the left and a NestedApp on the right
|
|
31
32
|
*/
|
|
@@ -34,7 +35,8 @@ function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader
|
|
|
34
35
|
const [showCode, setShowCode] = (0, react_1.useState)(initiallyShowCode);
|
|
35
36
|
const appContext = (0, AppContext_1.useAppContext)();
|
|
36
37
|
const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(0);
|
|
37
|
-
const
|
|
38
|
+
const { activeTheme: currentTheme, activeThemeTone, activeThemeId } = (0, ThemeContext_1.useTheme)();
|
|
39
|
+
const safePopOutUrl = (0, utils_1.withoutTrailingSlash)(popOutUrl || ((_a = appContext === null || appContext === void 0 ? void 0 : appContext.appGlobals) === null || _a === void 0 ? void 0 : _a.popOutUrl) || "https://docs.xmlui.org/#/playground");
|
|
38
40
|
const openPlayground = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
|
|
39
41
|
const data = {
|
|
40
42
|
standalone: {
|
|
@@ -42,7 +44,7 @@ function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader
|
|
|
42
44
|
components,
|
|
43
45
|
config: {
|
|
44
46
|
name: title,
|
|
45
|
-
themes: [],
|
|
47
|
+
themes: [currentTheme],
|
|
46
48
|
defaultTheme: activeTheme,
|
|
47
49
|
},
|
|
48
50
|
api: api,
|
|
@@ -52,8 +54,8 @@ function AppWithCodeViewNative({ markdown, splitView, withFrame = true, noHeader
|
|
|
52
54
|
swapped: false,
|
|
53
55
|
previewMode: false,
|
|
54
56
|
orientation: "horizontal",
|
|
55
|
-
activeTheme,
|
|
56
|
-
activeTone,
|
|
57
|
+
activeTheme: activeThemeId || activeTheme,
|
|
58
|
+
activeTone: activeTone || activeThemeTone,
|
|
57
59
|
content: "app",
|
|
58
60
|
},
|
|
59
61
|
};
|
|
@@ -8,12 +8,14 @@ const renderers_1 = require("../../components-core/renderers");
|
|
|
8
8
|
const ButtonNative_1 = require("../Button/ButtonNative");
|
|
9
9
|
const IconNative_1 = require("../Icon/IconNative");
|
|
10
10
|
const metadata_helpers_1 = require("../metadata-helpers");
|
|
11
|
+
const lodash_es_1 = require("lodash-es");
|
|
11
12
|
const COMP = "ToneChangerButton";
|
|
12
13
|
const LIGHT_TO_DARK_ICON = "lightToDark:ToneChangerButton";
|
|
13
14
|
const DARK_TO_LIGHT_ICON = "darkToLight:ToneChangerButton";
|
|
14
15
|
exports.defaultProps = {
|
|
15
16
|
lightToDarkIcon: LIGHT_TO_DARK_ICON,
|
|
16
17
|
darkToLightIcon: DARK_TO_LIGHT_ICON,
|
|
18
|
+
onClick: lodash_es_1.noop,
|
|
17
19
|
};
|
|
18
20
|
exports.ToneChangerButtonMd = (0, metadata_helpers_1.createMetadata)({
|
|
19
21
|
status: "stable",
|
|
@@ -32,18 +34,30 @@ exports.ToneChangerButtonMd = (0, metadata_helpers_1.createMetadata)({
|
|
|
32
34
|
defaultValue: exports.defaultProps.darkToLightIcon,
|
|
33
35
|
},
|
|
34
36
|
},
|
|
37
|
+
events: {
|
|
38
|
+
click: (0, metadata_helpers_1.dClick)(COMP),
|
|
39
|
+
},
|
|
35
40
|
});
|
|
36
|
-
function ToneChangerButton({ lightToDarkIcon = exports.defaultProps.lightToDarkIcon, darkToLightIcon = exports.defaultProps.darkToLightIcon, }) {
|
|
41
|
+
function ToneChangerButton({ lightToDarkIcon = exports.defaultProps.lightToDarkIcon, darkToLightIcon = exports.defaultProps.darkToLightIcon, onClick = exports.defaultProps.onClick, }) {
|
|
37
42
|
const { activeThemeTone, setActiveThemeTone } = (0, ThemeContext_1.useThemes)();
|
|
38
43
|
// Use the direct icon name as both the main icon and the fallback
|
|
39
44
|
// This ensures we always have a working icon
|
|
40
45
|
const iconName = activeThemeTone === "light" ? lightToDarkIcon : darkToLightIcon;
|
|
41
46
|
const fallbackIcon = activeThemeTone === "light" ? "lightToDark" : "darkToLight";
|
|
42
|
-
return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", style: { flexShrink: 0 }, icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: iconName, fallback: fallbackIcon }), onClick: () =>
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "ghost", style: { flexShrink: 0 }, icon: (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: iconName, fallback: fallbackIcon }), onClick: () => {
|
|
48
|
+
if (activeThemeTone === "light") {
|
|
49
|
+
setActiveThemeTone("dark");
|
|
50
|
+
onClick === null || onClick === void 0 ? void 0 : onClick("dark");
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
setActiveThemeTone("light");
|
|
54
|
+
onClick === null || onClick === void 0 ? void 0 : onClick("light");
|
|
55
|
+
}
|
|
56
|
+
} }));
|
|
43
57
|
}
|
|
44
58
|
/**
|
|
45
59
|
* Define the renderer for the ToneChangerButton component
|
|
46
60
|
*/
|
|
47
|
-
exports.toneChangerButtonComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.ToneChangerButtonMd, ({ node, extractValue }) => {
|
|
48
|
-
return ((0, jsx_runtime_1.jsx)(ToneChangerButton, { lightToDarkIcon: extractValue.asOptionalString(node.props.lightToDarkIcon), darkToLightIcon: extractValue.asOptionalString(node.props.darkToLightIcon) }));
|
|
61
|
+
exports.toneChangerButtonComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.ToneChangerButtonMd, ({ node, extractValue, lookupEventHandler }) => {
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(ToneChangerButton, { onClick: lookupEventHandler("click"), lightToDarkIcon: extractValue.asOptionalString(node.props.lightToDarkIcon), darkToLightIcon: extractValue.asOptionalString(node.props.darkToLightIcon) }));
|
|
49
63
|
});
|
|
@@ -281,7 +281,7 @@ function AppContent({ rootContainer, routerBaseName, globalProps, standalone, tr
|
|
|
281
281
|
environment,
|
|
282
282
|
mediaSize,
|
|
283
283
|
queryClient: AppRoot_1.queryClient,
|
|
284
|
-
standalone }, date_functions_1.dateFunctions), math_function_1.mathFunctions), {
|
|
284
|
+
standalone, appIsInShadowDom: (root === null || root === void 0 ? void 0 : root.getRootNode()) instanceof ShadowRoot }, date_functions_1.dateFunctions), math_function_1.mathFunctions), {
|
|
285
285
|
// --- File Utilities
|
|
286
286
|
formatFileSizeInBytes: misc_1.formatFileSizeInBytes,
|
|
287
287
|
getFileExtension: misc_1.getFileExtension,
|
|
@@ -324,6 +324,7 @@ function AppContent({ rootContainer, routerBaseName, globalProps, standalone, tr
|
|
|
324
324
|
embed,
|
|
325
325
|
apiInterceptorContext,
|
|
326
326
|
forceRefreshAnchorScroll,
|
|
327
|
+
root,
|
|
327
328
|
]);
|
|
328
329
|
// --- We prepare the helper infrastructure for the `AppState` component, which manages
|
|
329
330
|
// --- app-wide state using buckets (state sections).
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
"patterns": [{ "include": "#attribute" }, { "include": "#comments" }]
|
|
240
240
|
},
|
|
241
241
|
"componentTag": {
|
|
242
|
-
"begin": "(
|
|
242
|
+
"begin": "(\\s*</?)((?:[a-zA-Z_][\\w\\.\\-]*?:)?)([a-zA-Z][\\w\\.\\-]*)",
|
|
243
243
|
"beginCaptures": {
|
|
244
244
|
"1": { "name": "punctuation.definition.tag.xmlui" },
|
|
245
245
|
"2": { "name": "keyword.operator.namespace.xmlui" },
|
|
@@ -3,6 +3,7 @@ import { default as default_2 } from 'react';
|
|
|
3
3
|
import { default as default_3 } from 'react/jsx-runtime';
|
|
4
4
|
import { DefaultToastOptions } from 'react-hot-toast';
|
|
5
5
|
import { DelayMode } from 'msw';
|
|
6
|
+
import { Dispatch } from 'react';
|
|
6
7
|
import { ErrorInfo } from 'react';
|
|
7
8
|
import { ForwardedRef } from 'react';
|
|
8
9
|
import { ForwardRefExoticComponent } from 'react';
|
|
@@ -15,6 +16,7 @@ import { RefAttributes } from 'react';
|
|
|
15
16
|
import { RefObject } from 'react';
|
|
16
17
|
import { Renderable } from 'react-hot-toast';
|
|
17
18
|
import { Root } from 'react-dom/client';
|
|
19
|
+
import { SetStateAction } from 'react';
|
|
18
20
|
import { SetupWorker } from 'msw/browser';
|
|
19
21
|
import { StrictRequest } from 'msw';
|
|
20
22
|
import { To } from 'react-router-dom';
|
|
@@ -83,6 +85,7 @@ declare type AppContextObject = {
|
|
|
83
85
|
mediaSize: MediaSize;
|
|
84
86
|
queryClient: QueryClient | null;
|
|
85
87
|
standalone?: boolean;
|
|
88
|
+
appIsInShadowDom?: boolean;
|
|
86
89
|
formatDate: (date: string | Date) => string | undefined;
|
|
87
90
|
formatDateTime: (date: any) => string | undefined;
|
|
88
91
|
formatDateWithoutYear: (date: string | Date) => string | undefined;
|
|
@@ -158,6 +161,21 @@ declare function AppRoot({ apiInterceptor, contributes, node, decorateComponents
|
|
|
158
161
|
isNested?: boolean;
|
|
159
162
|
}): JSX_2.Element;
|
|
160
163
|
|
|
164
|
+
declare type AppThemes = {
|
|
165
|
+
root: HTMLElement | undefined;
|
|
166
|
+
setRoot: Dispatch<SetStateAction<HTMLElement | undefined>>;
|
|
167
|
+
setActiveThemeId: (newThemeId: string) => void;
|
|
168
|
+
setActiveThemeTone: (newTone: ThemeTone) => void;
|
|
169
|
+
toggleThemeTone: () => void;
|
|
170
|
+
activeThemeId: string;
|
|
171
|
+
activeThemeTone: ThemeTone;
|
|
172
|
+
themes: Array<ThemeDefinition>;
|
|
173
|
+
resources: Record<string, string>;
|
|
174
|
+
resourceMap: Record<string, string>;
|
|
175
|
+
availableThemeIds: Array<string>;
|
|
176
|
+
activeTheme: ThemeDefinition;
|
|
177
|
+
};
|
|
178
|
+
|
|
161
179
|
declare type AppWrapperProps = {
|
|
162
180
|
node: ComponentLike;
|
|
163
181
|
previewMode?: boolean;
|
|
@@ -1292,16 +1310,16 @@ declare const standaloneExports: {
|
|
|
1292
1310
|
} & default_2.RefAttributes<any>>;
|
|
1293
1311
|
Button: default_2.ForwardRefExoticComponent<{
|
|
1294
1312
|
id?: string;
|
|
1295
|
-
type?:
|
|
1296
|
-
variant?:
|
|
1297
|
-
themeColor?:
|
|
1298
|
-
size?:
|
|
1313
|
+
type?: ButtonType;
|
|
1314
|
+
variant?: ButtonVariant;
|
|
1315
|
+
themeColor?: ButtonThemeColor;
|
|
1316
|
+
size?: ComponentSize;
|
|
1299
1317
|
disabled?: boolean;
|
|
1300
1318
|
children?: default_2.ReactNode | default_2.ReactNode[];
|
|
1301
1319
|
icon?: default_2.ReactNode;
|
|
1302
|
-
iconPosition?:
|
|
1303
|
-
contentPosition?:
|
|
1304
|
-
orientation?:
|
|
1320
|
+
iconPosition?: IconPosition;
|
|
1321
|
+
contentPosition?: AlignmentOptions;
|
|
1322
|
+
orientation?: OrientationOptions;
|
|
1305
1323
|
formId?: string;
|
|
1306
1324
|
style?: default_2.CSSProperties;
|
|
1307
1325
|
gap?: string | number;
|
|
@@ -1310,10 +1328,10 @@ declare const standaloneExports: {
|
|
|
1310
1328
|
contextualLabel?: string;
|
|
1311
1329
|
} & Pick<default_2.HTMLAttributes<HTMLButtonElement>, "className" | "aria-disabled" | "aria-label" | "aria-controls" | "aria-expanded" | "onClick" | "onFocus" | "onBlur" | "tabIndex" | "onMouseEnter" | "onMouseLeave"> & default_2.RefAttributes<HTMLButtonElement>>;
|
|
1312
1330
|
Splitter: ({ initialPrimarySize, minPrimarySize, maxPrimarySize, orientation, children, style, swapped, floating, splitterTemplate, resize, }: {
|
|
1313
|
-
children: default_2.ReactNode | default_2.ReactNode
|
|
1331
|
+
children: default_2.ReactNode[] | default_2.ReactNode;
|
|
1314
1332
|
style?: default_2.CSSProperties;
|
|
1315
1333
|
splitterTemplate?: default_2.ReactNode;
|
|
1316
|
-
orientation?:
|
|
1334
|
+
orientation?: OrientationOptions;
|
|
1317
1335
|
floating?: boolean;
|
|
1318
1336
|
resize?: (sizes: [number, number]) => void;
|
|
1319
1337
|
swapped?: boolean;
|
|
@@ -1325,7 +1343,7 @@ declare const standaloneExports: {
|
|
|
1325
1343
|
TabItem: default_2.ForwardRefExoticComponent<Tab & default_2.RefAttributes<HTMLDivElement>>;
|
|
1326
1344
|
Tabs: default_2.ForwardRefExoticComponent<{
|
|
1327
1345
|
activeTab?: number;
|
|
1328
|
-
orientation?: "
|
|
1346
|
+
orientation?: "horizontal" | "vertical";
|
|
1329
1347
|
tabRenderer?: (item: {
|
|
1330
1348
|
label: string;
|
|
1331
1349
|
isActive: boolean;
|
|
@@ -1354,13 +1372,14 @@ declare const standaloneExports: {
|
|
|
1354
1372
|
fullScreen?: boolean;
|
|
1355
1373
|
style?: default_2.CSSProperties;
|
|
1356
1374
|
} & default_2.RefAttributes<HTMLDivElement>>;
|
|
1375
|
+
useThemes: typeof xmluiExports.useThemes;
|
|
1357
1376
|
builtInThemes: xmluiExports.ThemeDefinition[];
|
|
1358
1377
|
XmlUiHelper: typeof xmluiExports.XmlUiHelper;
|
|
1359
1378
|
Text: default_2.ForwardRefExoticComponent<Omit<{
|
|
1360
1379
|
[variantSpecificProps: string]: any;
|
|
1361
1380
|
uid?: string;
|
|
1362
1381
|
children?: default_2.ReactNode;
|
|
1363
|
-
variant?:
|
|
1382
|
+
variant?: TextVariant;
|
|
1364
1383
|
maxLines?: number;
|
|
1365
1384
|
preserveLinebreaks?: boolean;
|
|
1366
1385
|
ellipses?: boolean;
|
|
@@ -1368,7 +1387,7 @@ declare const standaloneExports: {
|
|
|
1368
1387
|
}, "ref"> & default_2.RefAttributes<unknown>>;
|
|
1369
1388
|
TextBox: default_2.ForwardRefExoticComponent<{
|
|
1370
1389
|
id?: string;
|
|
1371
|
-
type?: "
|
|
1390
|
+
type?: "text" | "password" | "search";
|
|
1372
1391
|
value?: string;
|
|
1373
1392
|
updateState?: UpdateStateFn;
|
|
1374
1393
|
initialValue?: string;
|
|
@@ -1376,7 +1395,7 @@ declare const standaloneExports: {
|
|
|
1376
1395
|
maxLength?: number;
|
|
1377
1396
|
enabled?: boolean;
|
|
1378
1397
|
placeholder?: string;
|
|
1379
|
-
validationStatus?:
|
|
1398
|
+
validationStatus?: ValidationStatus;
|
|
1380
1399
|
onDidChange?: (newValue: string) => void;
|
|
1381
1400
|
onFocus?: () => void;
|
|
1382
1401
|
onBlur?: () => void;
|
|
@@ -1786,9 +1805,10 @@ declare enum TokenType {
|
|
|
1786
1805
|
From = 97
|
|
1787
1806
|
}
|
|
1788
1807
|
|
|
1789
|
-
declare function ToneChangerButton({ lightToDarkIcon, darkToLightIcon, }: {
|
|
1808
|
+
declare function ToneChangerButton({ lightToDarkIcon, darkToLightIcon, onClick, }: {
|
|
1790
1809
|
lightToDarkIcon?: string;
|
|
1791
1810
|
darkToLightIcon?: string;
|
|
1811
|
+
onClick?: (...args: any[]) => void;
|
|
1792
1812
|
}): JSX_2.Element;
|
|
1793
1813
|
|
|
1794
1814
|
declare type TrackContainerHeight = "auto" | "fixed";
|
|
@@ -1859,6 +1879,8 @@ declare const useSearchContextContent: () => Record<string, SearchEntry>;
|
|
|
1859
1879
|
|
|
1860
1880
|
declare function useTheme(): ThemeScope;
|
|
1861
1881
|
|
|
1882
|
+
declare function useThemes(): AppThemes;
|
|
1883
|
+
|
|
1862
1884
|
declare type ValidationStatus = (typeof validationStatusValues)[number];
|
|
1863
1885
|
|
|
1864
1886
|
declare const validationStatusValues: readonly ["none", "error", "warning", "valid"];
|
|
@@ -1970,6 +1992,7 @@ declare namespace xmluiExports {
|
|
|
1970
1992
|
xmlUiMarkupToComponent,
|
|
1971
1993
|
ApiInterceptorProvider,
|
|
1972
1994
|
Spinner,
|
|
1995
|
+
useThemes,
|
|
1973
1996
|
builtInThemes,
|
|
1974
1997
|
XmlUiHelper,
|
|
1975
1998
|
Text_2 as Text,
|