xmlui 0.9.47 → 0.9.48
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/{apiInterceptorWorker-BY933b9G.mjs → apiInterceptorWorker-Ap4Sg3e9.mjs} +1 -1
- package/dist/lib/{index-DLZaCu6v.mjs → index-CSz52AVL.mjs} +10206 -10193
- package/dist/lib/index.css +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-DJ9dCJkg.mjs → server-common-COd84jF-.mjs} +4232 -4202
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +2094 -2088
- package/dist/metadata/xmlui-metadata.umd.js +8 -8
- package/dist/scripts/package.json +3 -2
- package/dist/scripts/src/components/Badge/Badge.js +18 -1
- package/dist/scripts/src/components/Badge/BadgeNative.js +10 -0
- package/dist/scripts/src/components/Column/Column.js +3 -2
- package/dist/scripts/src/components/ComponentProvider.js +11 -3
- package/dist/scripts/src/components/Form/FormContext.js +4 -3
- package/dist/scripts/src/components/FormItem/FormItem.js +1 -1
- package/dist/scripts/src/components/Icon/Icon.js +5 -2
- package/dist/scripts/src/components/Icon/IconNative.js +2 -2
- package/dist/scripts/src/components/Theme/ThemeNative.js +3 -32
- package/dist/standalone/xmlui-standalone.umd.js +334 -231
- package/package.json +3 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xmlui",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.48",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"start-test-bed": "cd src/testing/infrastructure && xmlui start",
|
|
@@ -106,7 +106,8 @@
|
|
|
106
106
|
"vscode-languageserver": "^9.0.1",
|
|
107
107
|
"vscode-languageserver-textdocument": "^1.0.11",
|
|
108
108
|
"xml-formatter": "^3.6.6",
|
|
109
|
-
"yargs": "17.7.2"
|
|
109
|
+
"yargs": "17.7.2",
|
|
110
|
+
"xmlui-charts": "*"
|
|
110
111
|
},
|
|
111
112
|
"devDependencies": {
|
|
112
113
|
"@babel/core": "7.19.6",
|
|
@@ -11,6 +11,7 @@ const renderers_1 = require("../../components-core/renderers");
|
|
|
11
11
|
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
12
12
|
const BadgeNative_1 = require("./BadgeNative");
|
|
13
13
|
const metadata_helpers_1 = require("../metadata-helpers");
|
|
14
|
+
const StyleParser_1 = require("../../parsers/style-parser/StyleParser");
|
|
14
15
|
const COMP = "Badge";
|
|
15
16
|
exports.BadgeMd = (0, ComponentDefs_1.createMetadata)({
|
|
16
17
|
status: "stable",
|
|
@@ -57,5 +58,21 @@ exports.badgeComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP,
|
|
|
57
58
|
var _a;
|
|
58
59
|
const value = extractValue.asDisplayText(node.props.value);
|
|
59
60
|
const colorMap = extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.colorMap);
|
|
60
|
-
|
|
61
|
+
let colorValue;
|
|
62
|
+
if (colorMap && value) {
|
|
63
|
+
const resolvedColor = colorMap[value];
|
|
64
|
+
if (typeof resolvedColor === "string") {
|
|
65
|
+
colorValue = resolveColor(resolvedColor);
|
|
66
|
+
}
|
|
67
|
+
else if ((0, BadgeNative_1.isBadgeColors)(resolvedColor)) {
|
|
68
|
+
colorValue = {
|
|
69
|
+
label: resolveColor(resolvedColor.label),
|
|
70
|
+
background: resolveColor(resolvedColor.background),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return ((0, jsx_runtime_1.jsx)(BadgeNative_1.Badge, { variant: extractValue(node.props.variant), color: colorValue, style: layoutCss, children: value || renderChild(node.children) }));
|
|
61
75
|
});
|
|
76
|
+
function resolveColor(value) {
|
|
77
|
+
return value.startsWith("$") ? (0, StyleParser_1.toCssVar)(value) : value;
|
|
78
|
+
}
|
|
@@ -4,11 +4,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Badge = exports.defaultProps = exports.badgeVariantValues = void 0;
|
|
7
|
+
exports.isBadgeColors = isBadgeColors;
|
|
7
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
9
|
const react_1 = require("react");
|
|
9
10
|
const classnames_1 = __importDefault(require("classnames"));
|
|
10
11
|
const Badge_module_scss_1 = __importDefault(require("./Badge.module.scss"));
|
|
11
12
|
exports.badgeVariantValues = ["badge", "pill"];
|
|
13
|
+
// --- Type guard for BadgeColors ---
|
|
14
|
+
function isBadgeColors(color) {
|
|
15
|
+
return (typeof color === "object" &&
|
|
16
|
+
color !== null &&
|
|
17
|
+
"label" in color &&
|
|
18
|
+
"background" in color &&
|
|
19
|
+
typeof color.label === "string" &&
|
|
20
|
+
typeof color.background === "string");
|
|
21
|
+
}
|
|
12
22
|
exports.defaultProps = {
|
|
13
23
|
variant: "badge",
|
|
14
24
|
};
|
|
@@ -35,6 +35,7 @@ exports.ColumnMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
35
35
|
canSort: {
|
|
36
36
|
description: `This property sets whether the user can sort by a column by clicking on its header ` +
|
|
37
37
|
`(\`true\`) or not (\`false\`).`,
|
|
38
|
+
defaultValue: true,
|
|
38
39
|
valueType: "boolean",
|
|
39
40
|
},
|
|
40
41
|
pinTo: {
|
|
@@ -71,9 +72,9 @@ exports.ColumnMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
71
72
|
$cell: {
|
|
72
73
|
description: "The value of the cell being rendered.",
|
|
73
74
|
},
|
|
74
|
-
}
|
|
75
|
+
},
|
|
75
76
|
});
|
|
76
77
|
exports.columnComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.ColumnMd, (rendererContext) => {
|
|
77
78
|
const { node, renderChild, extractValue, layoutCss } = rendererContext;
|
|
78
|
-
return ((0, jsx_runtime_1.jsx)(ColumnNative_1.Column, { style: layoutCss, header: extractValue.asDisplayText(node.props.header), accessorKey: extractValue.asOptionalString(node.props.bindTo), canSort: extractValue.asOptionalBoolean(node.props.canSort), canResize: extractValue.asOptionalBoolean(node.props.canResize), pinTo: extractValue.asOptionalString(node.props.pinTo), width: extractValue(node.props.width), minWidth: extractValue(node.props.minWidth), maxWidth: extractValue(node.props.maxWidth), nodeChildren: node.children, renderChild: renderChild, id: node.uid }));
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)(ColumnNative_1.Column, { style: layoutCss, header: extractValue.asDisplayText(node.props.header), accessorKey: extractValue.asOptionalString(node.props.bindTo), canSort: extractValue.asOptionalBoolean(node.props.canSort, true), canResize: extractValue.asOptionalBoolean(node.props.canResize), pinTo: extractValue.asOptionalString(node.props.pinTo), width: extractValue(node.props.width), minWidth: extractValue(node.props.minWidth), maxWidth: extractValue(node.props.maxWidth), nodeChildren: node.children, renderChild: renderChild, id: node.uid }));
|
|
79
80
|
});
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.ComponentRegistry = void 0;
|
|
4
7
|
exports.ComponentProvider = ComponentProvider;
|
|
@@ -95,6 +98,8 @@ const APICall_2 = require("./APICall/APICall");
|
|
|
95
98
|
const Option_1 = require("./Option/Option");
|
|
96
99
|
const AutoComplete_1 = require("./AutoComplete/AutoComplete");
|
|
97
100
|
const Backdrop_1 = require("./Backdrop/Backdrop");
|
|
101
|
+
// @ts-ignore
|
|
102
|
+
const xmlui_charts_1 = __importDefault(require("xmlui-charts"));
|
|
98
103
|
const HtmlTags_1 = require("./HtmlTags/HtmlTags");
|
|
99
104
|
const ColorPicker_1 = require("./ColorPicker/ColorPicker");
|
|
100
105
|
const RadioItem_1 = require("./RadioGroup/RadioItem");
|
|
@@ -346,12 +351,15 @@ class ComponentRegistry {
|
|
|
346
351
|
if (process.env.VITE_USED_COMPONENTS_Image !== "false") {
|
|
347
352
|
this.registerCoreComponent(Image_1.imageComponentRenderer);
|
|
348
353
|
}
|
|
349
|
-
if (process.env.
|
|
354
|
+
if (process.env.VITE_USED_COMPONENTS_XmluiCodeHightlighter !== "false") {
|
|
350
355
|
this.registerCoreComponent(XmluiCodeHighlighter_1.codeComponentRenderer);
|
|
351
356
|
}
|
|
352
|
-
if (process.env.
|
|
357
|
+
if (process.env.VITE_USED_COMPONENTS_Markdown !== "false") {
|
|
353
358
|
this.registerCoreComponent(Markdown_1.markdownComponentRenderer);
|
|
354
359
|
}
|
|
360
|
+
if (process.env.VITE_USED_COMPONENTS_Charts !== "false") {
|
|
361
|
+
this.extensionRegistered(xmlui_charts_1.default);
|
|
362
|
+
}
|
|
355
363
|
if (process.env.VITE_INCLUDE_REST_COMPONENTS !== "false") {
|
|
356
364
|
//TODO, if it proves to be a working solution, make these components skippable, too
|
|
357
365
|
this.registerCoreComponent(PageMetaTitle_1.pageMetaTitleComponentRenderer);
|
|
@@ -679,7 +687,7 @@ class ComponentRegistry {
|
|
|
679
687
|
* @returns True if the component is registered; otherwise, false.
|
|
680
688
|
*/
|
|
681
689
|
hasComponent(componentName) {
|
|
682
|
-
return (this.
|
|
690
|
+
return (this.lookupComponentRenderer(componentName) !== undefined ||
|
|
683
691
|
this.loaders.get(componentName) !== undefined ||
|
|
684
692
|
this.actionFns.get(componentName) !== undefined);
|
|
685
693
|
}
|
|
@@ -24,7 +24,7 @@ exports.validationModeMd = [
|
|
|
24
24
|
{
|
|
25
25
|
value: "onLostFocus",
|
|
26
26
|
description: "Show/hide error (if present) only if the field loses focus.",
|
|
27
|
-
}
|
|
27
|
+
},
|
|
28
28
|
];
|
|
29
29
|
exports.FormContext = (0, use_context_selector_1.createContext)(undefined);
|
|
30
30
|
function useFormContextPart(selector) {
|
|
@@ -113,6 +113,7 @@ exports.formControlTypesMd = [
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
value: "custom",
|
|
116
|
-
description: "
|
|
117
|
-
|
|
116
|
+
description: "A custom control specified in children. If `type` is not specified " +
|
|
117
|
+
"but the `FormItem` has children, it considers the control a custom one.",
|
|
118
|
+
},
|
|
118
119
|
];
|
|
@@ -204,7 +204,7 @@ exports.formItemComponentRenderer = (0, renderers_1.createComponentRenderer)(COM
|
|
|
204
204
|
}));
|
|
205
205
|
const resolvedRestProps = extractValue(nonLayoutCssProps);
|
|
206
206
|
const formItemType = extractValue.asOptionalString(type);
|
|
207
|
-
const isCustomFormItem = formItemType === undefined && !!node.children;
|
|
207
|
+
const isCustomFormItem = (formItemType === undefined || formItemType === "custom") && !!node.children;
|
|
208
208
|
const inputTemplate = node.children || ((_a = node.props) === null || _a === void 0 ? void 0 : _a.inputTemplate);
|
|
209
209
|
return ((0, jsx_runtime_1.jsx)(FormItemNative_1.FormItem, Object.assign({ 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, validations: resolvedValidationPropsAndEvents, 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
|
|
210
210
|
? (contextVars) => ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { contextVars: contextVars, node: inputTemplate, renderChild: renderChild, layoutContext: layoutContext }))
|
|
@@ -25,11 +25,14 @@ exports.IconMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
25
25
|
fallback: (0, ComponentDefs_1.d)(`This optional property provides a way to handle situations when the provided ` +
|
|
26
26
|
`[icon name](#name) is not found in the registry.`),
|
|
27
27
|
},
|
|
28
|
+
events: {
|
|
29
|
+
click: (0, ComponentDefs_1.d)("This event is triggered when the icon is clicked."),
|
|
30
|
+
},
|
|
28
31
|
themeVars: (0, themeVars_1.parseScssVar)(Icon_module_scss_1.default.themeVars),
|
|
29
32
|
defaultThemeVars: {
|
|
30
33
|
[`size-${COMP}`]: "1.25em",
|
|
31
34
|
},
|
|
32
35
|
});
|
|
33
|
-
exports.iconComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.IconMd, ({ node, extractValue, layoutCss }) => {
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: extractValue.asOptionalString(node.props.name), size: extractValue(node.props.size), style: layoutCss, fallback: extractValue.asOptionalString(node.props.fallback) }));
|
|
36
|
+
exports.iconComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.IconMd, ({ node, extractValue, layoutCss, lookupEventHandler }) => {
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(IconNative_1.default, { name: extractValue.asOptionalString(node.props.name), size: extractValue(node.props.size), style: layoutCss, fallback: extractValue.asOptionalString(node.props.fallback), onClick: lookupEventHandler("click") }));
|
|
35
38
|
});
|
|
@@ -25,14 +25,14 @@ const StyleParser_1 = require("../../parsers/style-parser/StyleParser");
|
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
26
|
exports.Icon = (0, react_1.forwardRef)(function Icon(_a, ref) {
|
|
27
27
|
var _b;
|
|
28
|
-
var { name, fallback, style, className, size } = _a, restProps = __rest(_a, ["name", "fallback", "style", "className", "size"]);
|
|
28
|
+
var { name, fallback, style, className, size, onClick } = _a, restProps = __rest(_a, ["name", "fallback", "style", "className", "size", "onClick"]);
|
|
29
29
|
const iconRenderer = useFindIconRenderer(name, fallback);
|
|
30
30
|
const computedSize = typeof size === "string" ? mapSizeToIconPack(size) : size;
|
|
31
31
|
const width = computedSize || restProps.width;
|
|
32
32
|
const height = computedSize || restProps.height;
|
|
33
33
|
const computedProps = Object.assign(Object.assign({
|
|
34
34
|
// className is needed to apply a default color to the icon, thus other component classes can override this one
|
|
35
|
-
className: (0, classnames_1.default)(Icon_module_scss_1.default.base, className) }, restProps), { size: computedSize, width: width, height: height, style: Object.assign(Object.assign({}, style), { "--icon-width": width, "--icon-height": height }) });
|
|
35
|
+
className: (0, classnames_1.default)(Icon_module_scss_1.default.base, className, { [Icon_module_scss_1.default.clickable]: !!onClick }) }, restProps), { size: computedSize, width: width, height: height, style: Object.assign(Object.assign({}, style), { "--icon-width": width, "--icon-height": height }), onClick });
|
|
36
36
|
// ---
|
|
37
37
|
const customIconUrl = useCustomIconUrl(name);
|
|
38
38
|
if (customIconUrl) {
|
|
@@ -12,7 +12,6 @@ const classnames_1 = __importDefault(require("classnames"));
|
|
|
12
12
|
const Theme_module_scss_1 = __importDefault(require("./Theme.module.scss"));
|
|
13
13
|
const ThemeProvider_1 = require("../../components-core/theming/ThemeProvider");
|
|
14
14
|
const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
|
|
15
|
-
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
16
15
|
const constants_1 = require("../../components-core/constants");
|
|
17
16
|
const ErrorBoundary_1 = require("../../components-core/rendering/ErrorBoundary");
|
|
18
17
|
const NotificationToast_1 = require("./NotificationToast");
|
|
@@ -47,7 +46,7 @@ function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 50
|
|
|
47
46
|
return foundTheme;
|
|
48
47
|
}, [activeTheme, generatedId, id, themeTone, themeVars, themes]);
|
|
49
48
|
const { themeCssVars, getResourceUrl, fontLinks, allThemeVarsWithResolvedHierarchicalVars, getThemeVar, } = (0, ThemeProvider_1.useCompiledTheme)(currentTheme, themeTone, themes, resources, resourceMap);
|
|
50
|
-
const { css, className
|
|
49
|
+
const { css, className } = (0, react_1.useMemo)(() => {
|
|
51
50
|
const vars = Object.assign(Object.assign({}, themeCssVars), { "color-scheme": themeTone });
|
|
52
51
|
// const vars = themeCssVars;
|
|
53
52
|
let css = Object.entries(vars)
|
|
@@ -55,16 +54,8 @@ function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 50
|
|
|
55
54
|
return key + ":" + value + ";";
|
|
56
55
|
})
|
|
57
56
|
.join(" ");
|
|
58
|
-
css += `font-family: var(${(0, themeVars_1.getVarKey)("fontFamily")});`;
|
|
59
57
|
const className = getClassName(css);
|
|
60
|
-
|
|
61
|
-
const toClass = `${className}-to`;
|
|
62
|
-
let rangeClassName;
|
|
63
|
-
if (!isRoot) {
|
|
64
|
-
rangeClassName = `${fromClass} ~ *:has(~ .${toClass})`;
|
|
65
|
-
css += `color: var(${(0, themeVars_1.getVarKey)("textColor-primary")});`;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
58
|
+
if (isRoot) {
|
|
68
59
|
css += `--screenSize: 0;`;
|
|
69
60
|
const maxWidthPhone = getThemeVar("maxWidth-phone");
|
|
70
61
|
const maxWidthLandscapePhone = getThemeVar("maxWidth-landscape-phone");
|
|
@@ -95,29 +86,9 @@ function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 50
|
|
|
95
86
|
}
|
|
96
87
|
return {
|
|
97
88
|
className,
|
|
98
|
-
rangeClassName,
|
|
99
|
-
fromClass,
|
|
100
|
-
toClass,
|
|
101
89
|
css,
|
|
102
90
|
};
|
|
103
91
|
}, [isRoot, themeCssVars, themeTone, getThemeVar]);
|
|
104
|
-
// useInsertionEffect(() => {
|
|
105
|
-
// //PERF OPT IDEA: don't inject the css content that we already have
|
|
106
|
-
// // (e.g. in Items component we inject and generate classes for all items if we use a theme for an item, but they have the same content.
|
|
107
|
-
// // We could inject one class, and use that instead. The harder part is keeping track of them, and remove when nobody uses them)
|
|
108
|
-
// injectCSS(`.${className} {${css}}`, className);
|
|
109
|
-
// if (rangeClassName) {
|
|
110
|
-
// injectCSS(`.${rangeClassName} {${css}}`, rangeClassName);
|
|
111
|
-
// }
|
|
112
|
-
// let injectedClassNames = [className, rangeClassName];
|
|
113
|
-
// return () => {
|
|
114
|
-
// injectedClassNames.forEach(injectedClassName => {
|
|
115
|
-
// if (injectedClassName) {
|
|
116
|
-
// cleanupCss(injectedClassName);
|
|
117
|
-
// }
|
|
118
|
-
// });
|
|
119
|
-
// };
|
|
120
|
-
// }, [className, css]);
|
|
121
92
|
const [themeRoot, setThemeRoot] = (0, react_1.useState)(root);
|
|
122
93
|
const currentThemeContextValue = (0, react_1.useMemo)(() => {
|
|
123
94
|
const themeVal = {
|
|
@@ -167,7 +138,7 @@ function Theme({ id, isRoot = false, renderChild, node, tone, toastDuration = 50
|
|
|
167
138
|
// </ThemeContext.Provider>
|
|
168
139
|
);
|
|
169
140
|
}
|
|
170
|
-
return ((0, jsx_runtime_1.jsxs)(ThemeContext_1.ThemeContext.Provider, { value: currentThemeContextValue, children: [(0, jsx_runtime_1.jsx)("style", { children: `.${
|
|
141
|
+
return ((0, jsx_runtime_1.jsxs)(ThemeContext_1.ThemeContext.Provider, { value: currentThemeContextValue, children: [(0, jsx_runtime_1.jsx)("style", { children: `.${className} {${css}}` }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(Theme_module_scss_1.default.baseRootComponent, Theme_module_scss_1.default.wrapper, className), children: renderChild(node.children, Object.assign(Object.assign({}, layoutContext), { themeClassName: className })) }), root &&
|
|
171
142
|
(0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(className), ref: (el) => {
|
|
172
143
|
if (el) {
|
|
173
144
|
setThemeRoot(el);
|