xmlui 0.9.46 → 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-D_OwtjcQ.mjs → apiInterceptorWorker-Ap4Sg3e9.mjs} +1 -1
- package/dist/lib/{index-_koqcHz7.mjs → index-CSz52AVL.mjs} +8556 -8298
- 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/{metadata-utils-Cf8v_9Lr.mjs → metadata-utils-DiiTyP_-.mjs} +12 -7
- package/dist/lib/{server-common-kMTAr-QU.mjs → server-common-COd84jF-.mjs} +1 -1
- package/dist/lib/xmlui.d.ts +1 -1
- package/dist/lib/xmlui.mjs +1 -1
- package/dist/metadata/style.css +1 -1
- package/dist/metadata/xmlui-metadata.mjs +3090 -3058
- package/dist/metadata/xmlui-metadata.umd.js +10 -10
- package/dist/scripts/package.json +3 -2
- package/dist/scripts/src/components/App/AppNative.js +1 -1
- 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 +251 -124
- 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/Markdown/Markdown.js +9 -0
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +10 -0
- package/dist/scripts/src/components/Markdown/utils.js +38 -0
- package/dist/scripts/src/components/NavGroup/NavGroupContext.js +12 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +19 -26
- package/dist/scripts/src/components/NavLink/NavLinkNative.js +11 -5
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +1 -1
- package/dist/scripts/src/components/Text/Text.js +1 -0
- package/dist/scripts/src/components/Theme/ThemeNative.js +3 -32
- package/dist/scripts/src/components/TreeDisplay/TreeDisplay.js +47 -0
- package/dist/scripts/src/components/TreeDisplay/TreeDisplayNative.js +102 -0
- package/dist/scripts/src/components/abstractions.js +6 -0
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +1 -1
- package/dist/scripts/src/components-core/theming/transformThemeVars.js +27 -0
- package/dist/standalone/xmlui-standalone.es.d.ts +2 -2
- package/dist/standalone/xmlui-standalone.umd.js +358 -251
- package/package.json +3 -2
|
@@ -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) {
|
|
@@ -113,6 +113,15 @@ const TransformedMarkdown = ({ children, removeIndents, style, extractValue, cod
|
|
|
113
113
|
(0, utils_1.convertPlaygroundPatternToMarkdown)(nextPlayground[2]) +
|
|
114
114
|
resolvedMd.slice(nextPlayground[1]);
|
|
115
115
|
}
|
|
116
|
+
while (true) {
|
|
117
|
+
const nextTreeDisplay = (0, utils_1.observeTreeDisplay)(resolvedMd);
|
|
118
|
+
if (!nextTreeDisplay)
|
|
119
|
+
break;
|
|
120
|
+
resolvedMd =
|
|
121
|
+
resolvedMd.slice(0, nextTreeDisplay[0]) +
|
|
122
|
+
(0, utils_1.convertTreeDisplayToMarkdown)(nextTreeDisplay[2]) +
|
|
123
|
+
resolvedMd.slice(nextTreeDisplay[1]);
|
|
124
|
+
}
|
|
116
125
|
resolvedMd = (0, parse_binding_expr_1.parseBindingExpression)(resolvedMd, extractValue);
|
|
117
126
|
return resolvedMd;
|
|
118
127
|
}, [children, extractValue]);
|
|
@@ -66,6 +66,7 @@ const AppContext_1 = require("../../components-core/AppContext");
|
|
|
66
66
|
const CodeBlockNative_1 = require("../CodeBlock/CodeBlockNative");
|
|
67
67
|
const classnames_1 = __importDefault(require("classnames"));
|
|
68
68
|
const IconNative_1 = __importDefault(require("../Icon/IconNative"));
|
|
69
|
+
const TreeDisplayNative_1 = require("../TreeDisplay/TreeDisplayNative");
|
|
69
70
|
function PreTagComponent({ id, children, codeHighlighter }) {
|
|
70
71
|
// TEMP: After ironing out theming for syntax highlighting, this should be removed
|
|
71
72
|
const { activeThemeTone } = (0, ThemeContext_1.useTheme)();
|
|
@@ -283,6 +284,15 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
|
|
|
283
284
|
}
|
|
284
285
|
return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { app: nestedProps.app, config: nestedProps.config, components: nestedProps.components, api: nestedProps.api, activeTheme: nestedProps.activeTheme, activeTone: nestedProps.activeTone, title: nestedProps.title, height: nestedProps.height, allowPlaygroundPopup: true }));
|
|
285
286
|
},
|
|
287
|
+
section(_a) {
|
|
288
|
+
var { children } = _a, props = __rest(_a, ["children"]);
|
|
289
|
+
const treeContentBase64 = props === null || props === void 0 ? void 0 : props["data-tree-content"];
|
|
290
|
+
if (treeContentBase64 !== undefined) {
|
|
291
|
+
const content = atob(treeContentBase64);
|
|
292
|
+
return (0, jsx_runtime_1.jsx)(TreeDisplayNative_1.TreeDisplay, { content: content, itemHeight: 24 });
|
|
293
|
+
}
|
|
294
|
+
return null;
|
|
295
|
+
}
|
|
286
296
|
}, children: children }) }));
|
|
287
297
|
});
|
|
288
298
|
const HorizontalRule = () => {
|
|
@@ -4,6 +4,8 @@ exports.observePlaygroundPattern = observePlaygroundPattern;
|
|
|
4
4
|
exports.parseSegmentProps = parseSegmentProps;
|
|
5
5
|
exports.parsePlaygroundPattern = parsePlaygroundPattern;
|
|
6
6
|
exports.convertPlaygroundPatternToMarkdown = convertPlaygroundPatternToMarkdown;
|
|
7
|
+
exports.observeTreeDisplay = observeTreeDisplay;
|
|
8
|
+
exports.convertTreeDisplayToMarkdown = convertTreeDisplayToMarkdown;
|
|
7
9
|
function observePlaygroundPattern(content) {
|
|
8
10
|
const startPattern = "```xmlui-pg";
|
|
9
11
|
const endPattern = "```";
|
|
@@ -280,3 +282,39 @@ function convertPlaygroundPatternToMarkdown(content) {
|
|
|
280
282
|
markdownContent += '<samp data-pg-content="' + base64String + '"></samp>\n\n';
|
|
281
283
|
return markdownContent;
|
|
282
284
|
}
|
|
285
|
+
function observeTreeDisplay(content) {
|
|
286
|
+
const startPattern = "```xmlui-tree";
|
|
287
|
+
const endPattern = "```";
|
|
288
|
+
const startIndex = content.indexOf(startPattern);
|
|
289
|
+
if (startIndex === -1) {
|
|
290
|
+
return null; // No match for the start pattern
|
|
291
|
+
}
|
|
292
|
+
// Find the end of the start pattern
|
|
293
|
+
const startContentIndex = content.indexOf("\n", startIndex);
|
|
294
|
+
if (startContentIndex === -1) {
|
|
295
|
+
return null; // Malformed pattern, no newline after start
|
|
296
|
+
}
|
|
297
|
+
// Search for the end pattern after the start content
|
|
298
|
+
let endIndex = startContentIndex;
|
|
299
|
+
while (endIndex !== -1) {
|
|
300
|
+
endIndex = content.indexOf(endPattern, endIndex + 1);
|
|
301
|
+
if (endIndex !== -1) {
|
|
302
|
+
// Check if the end pattern is not escaped
|
|
303
|
+
const precedingChar = content[endIndex - 1];
|
|
304
|
+
if (precedingChar !== "\\") {
|
|
305
|
+
return [
|
|
306
|
+
startIndex,
|
|
307
|
+
endIndex + endPattern.length,
|
|
308
|
+
content.substring(startIndex, endIndex + endPattern.length),
|
|
309
|
+
];
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return null; // No valid end pattern found
|
|
314
|
+
}
|
|
315
|
+
function convertTreeDisplayToMarkdown(content) {
|
|
316
|
+
if (content.startsWith("```xmlui-tree") && content.endsWith("```")) {
|
|
317
|
+
const treeContent = content.slice("```xmlui-tree".length, content.indexOf("```", "```xmlui-tree".length)).trim();
|
|
318
|
+
return `<section data-tree-content="${btoa(treeContent)}"></section>\n\n`;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavGroupContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const NavGroupNative_1 = require("./NavGroupNative");
|
|
6
|
+
exports.NavGroupContext = (0, react_1.createContext)({
|
|
7
|
+
level: -1,
|
|
8
|
+
iconHorizontalCollapsed: NavGroupNative_1.defaultProps.iconHorizontalCollapsed,
|
|
9
|
+
iconHorizontalExpanded: NavGroupNative_1.defaultProps.iconHorizontalExpanded,
|
|
10
|
+
iconVerticalCollapsed: NavGroupNative_1.defaultProps.iconVerticalCollapsed,
|
|
11
|
+
iconVerticalExpanded: NavGroupNative_1.defaultProps.iconVerticalExpanded,
|
|
12
|
+
});
|
|
@@ -15,21 +15,17 @@ const IconNative_1 = require("../Icon/IconNative");
|
|
|
15
15
|
const NavLinkNative_1 = require("../NavLink/NavLinkNative");
|
|
16
16
|
const AppLayoutContext_1 = require("../App/AppLayoutContext");
|
|
17
17
|
const NavPanelNative_1 = require("../NavPanel/NavPanelNative");
|
|
18
|
+
const react_2 = require("@remix-run/react");
|
|
19
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
20
|
+
const NavGroupContext_1 = require("./NavGroupContext");
|
|
18
21
|
exports.defaultProps = {
|
|
19
22
|
iconHorizontalExpanded: "chevronright",
|
|
20
23
|
iconHorizontalCollapsed: "chevronright",
|
|
21
24
|
iconVerticalExpanded: "chevrondown",
|
|
22
25
|
iconVerticalCollapsed: "chevronright",
|
|
23
26
|
};
|
|
24
|
-
const NavGroupContext = (0, react_1.createContext)({
|
|
25
|
-
level: -1,
|
|
26
|
-
iconHorizontalCollapsed: exports.defaultProps.iconHorizontalCollapsed,
|
|
27
|
-
iconHorizontalExpanded: exports.defaultProps.iconHorizontalExpanded,
|
|
28
|
-
iconVerticalCollapsed: exports.defaultProps.iconVerticalCollapsed,
|
|
29
|
-
iconVerticalExpanded: exports.defaultProps.iconVerticalExpanded,
|
|
30
|
-
});
|
|
31
27
|
exports.NavGroup = (0, react_1.forwardRef)(function NavGroup({ node, style, label, icon, renderChild, to, disabled = false, initiallyExpanded, iconHorizontalCollapsed, iconHorizontalExpanded, iconVerticalCollapsed, iconVerticalExpanded, }, ref) {
|
|
32
|
-
const { level } = (0, react_1.useContext)(NavGroupContext);
|
|
28
|
+
const { level } = (0, react_1.useContext)(NavGroupContext_1.NavGroupContext);
|
|
33
29
|
const appLayoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
|
|
34
30
|
const navPanelContext = (0, react_1.useContext)(NavPanelNative_1.NavPanelContext);
|
|
35
31
|
let inline = (appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical" ||
|
|
@@ -53,29 +49,26 @@ exports.NavGroup = (0, react_1.forwardRef)(function NavGroup({ node, style, labe
|
|
|
53
49
|
iconVerticalExpanded,
|
|
54
50
|
level,
|
|
55
51
|
]);
|
|
56
|
-
return ((0, jsx_runtime_1.jsx)(NavGroupContext.Provider, { value: navGroupContextValue, children: inline ? ((0, jsx_runtime_1.jsx)(ExpandableNavGroup, { to: to, style: style, label: label, icon: icon, node: node, renderChild: renderChild, ref: ref, initiallyExpanded: initiallyExpanded, disabled: disabled })) : ((0, jsx_runtime_1.jsx)(DropDownNavGroup, { label: label, icon: icon, node: node, renderChild: renderChild, ref: ref, to: to, disabled: disabled })) }));
|
|
52
|
+
return ((0, jsx_runtime_1.jsx)(NavGroupContext_1.NavGroupContext.Provider, { value: navGroupContextValue, children: inline ? ((0, jsx_runtime_1.jsx)(ExpandableNavGroup, { to: to, style: style, label: label, icon: icon, node: node, renderChild: renderChild, ref: ref, initiallyExpanded: initiallyExpanded, disabled: disabled })) : ((0, jsx_runtime_1.jsx)(DropDownNavGroup, { label: label, icon: icon, node: node, renderChild: renderChild, ref: ref, to: to, disabled: disabled })) }));
|
|
57
53
|
});
|
|
58
54
|
const ExpandableNavGroup = (0, react_1.forwardRef)(function ExpandableNavGroup({ style = constants_1.EMPTY_OBJECT, label, icon, renderChild, node, to, initiallyExpanded = false, disabled = false, }, ref) {
|
|
59
|
-
const { level, iconVerticalCollapsed, iconVerticalExpanded } = (0, react_1.useContext)(NavGroupContext);
|
|
55
|
+
const { level, iconVerticalCollapsed, iconVerticalExpanded } = (0, react_1.useContext)(NavGroupContext_1.NavGroupContext);
|
|
60
56
|
const [expanded, setExpanded] = (0, react_1.useState)(initiallyExpanded);
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return renderedChild;
|
|
74
|
-
},
|
|
75
|
-
})] }));
|
|
57
|
+
const groupContentInnerRef = (0, react_1.useRef)(null);
|
|
58
|
+
const { pathname } = (0, react_2.useLocation)();
|
|
59
|
+
(0, react_1.useEffect)(() => {
|
|
60
|
+
const hasActiveNavLink = groupContentInnerRef.current.querySelector(".xmlui-navlink-active") !== null;
|
|
61
|
+
if (hasActiveNavLink) {
|
|
62
|
+
setExpanded(true);
|
|
63
|
+
}
|
|
64
|
+
}, [pathname]);
|
|
65
|
+
const toggleStyle = Object.assign(Object.assign({}, style), { "--nav-link-level": level });
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(NavLinkNative_1.NavLink, { style: toggleStyle, onClick: () => setExpanded((prev) => !prev), icon: icon, to: to, disabled: disabled, children: [label, (0, jsx_runtime_1.jsx)("div", { style: { flex: 1 } }), (0, jsx_runtime_1.jsx)(IconNative_1.Icon, { name: expanded ? iconVerticalExpanded : iconVerticalCollapsed })] }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(NavGroup_module_scss_1.default.groupContent, {
|
|
67
|
+
[NavGroup_module_scss_1.default.expanded]: expanded,
|
|
68
|
+
}), children: (0, jsx_runtime_1.jsx)("div", { className: NavGroup_module_scss_1.default.groupContentInner, ref: groupContentInnerRef, children: renderChild(node.children) }) })] }));
|
|
76
69
|
});
|
|
77
70
|
const DropDownNavGroup = (0, react_1.forwardRef)(function DropDownNavGroup({ style, label, icon, renderChild, node, to, disabled = false, }, ref) {
|
|
78
|
-
const { level, iconHorizontalCollapsed, iconHorizontalExpanded, iconVerticalCollapsed, iconVerticalExpanded, } = (0, react_1.useContext)(NavGroupContext);
|
|
71
|
+
const { level, iconHorizontalCollapsed, iconHorizontalExpanded, iconVerticalCollapsed, iconVerticalExpanded, } = (0, react_1.useContext)(NavGroupContext_1.NavGroupContext);
|
|
79
72
|
const { root } = (0, ThemeContext_1.useTheme)();
|
|
80
73
|
let Wrapper = react_dropdown_menu_1.DropdownMenu;
|
|
81
74
|
let Trigger = react_dropdown_menu_1.DropdownMenuTrigger;
|
|
@@ -24,12 +24,14 @@ const component_utils_1 = require("../component-utils");
|
|
|
24
24
|
const AppNative_1 = require("../App/AppNative");
|
|
25
25
|
const AppLayoutContext_1 = require("../App/AppLayoutContext");
|
|
26
26
|
const NavPanelNative_1 = require("../NavPanel/NavPanelNative");
|
|
27
|
+
const NavGroupContext_1 = require("../NavGroup/NavGroupContext");
|
|
27
28
|
exports.NavLink = (0, react_1.forwardRef)(function NavLink(_a, ref) {
|
|
28
29
|
var {
|
|
29
30
|
/* eslint-disable react/prop-types */
|
|
30
|
-
uid, children, disabled, to,
|
|
31
|
+
uid, children, disabled, to, displayActive = true, vertical, style, onClick, icon, forceActive } = _a, rest = __rest(_a, ["uid", "children", "disabled", "to", "displayActive", "vertical", "style", "onClick", "icon", "forceActive"]);
|
|
31
32
|
const appLayoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
|
|
32
33
|
const navPanelContext = (0, react_1.useContext)(NavPanelNative_1.NavPanelContext);
|
|
34
|
+
const { level } = (0, react_1.useContext)(NavGroupContext_1.NavGroupContext);
|
|
33
35
|
let safeVertical = vertical;
|
|
34
36
|
if (appLayoutContext && safeVertical === undefined) {
|
|
35
37
|
safeVertical =
|
|
@@ -40,22 +42,26 @@ exports.NavLink = (0, react_1.forwardRef)(function NavLink(_a, ref) {
|
|
|
40
42
|
return (0, component_utils_1.createUrlWithQueryParams)(to);
|
|
41
43
|
}
|
|
42
44
|
}, [to]);
|
|
43
|
-
const styleObj =
|
|
45
|
+
const styleObj = (0, react_1.useMemo)(() => {
|
|
46
|
+
return Object.assign({ "--nav-link-level": level + 1 }, style);
|
|
47
|
+
}, [level, style]);
|
|
44
48
|
const baseClasses = (0, classnames_1.default)(NavLink_module_scss_1.default.content, NavLink_module_scss_1.default.base, {
|
|
45
49
|
[NavLink_module_scss_1.default.disabled]: disabled,
|
|
46
50
|
[NavLink_module_scss_1.default.vertical]: safeVertical,
|
|
47
51
|
[NavLink_module_scss_1.default.includeHoverIndicator]: displayActive,
|
|
48
52
|
[NavLink_module_scss_1.default.navItemActive]: displayActive && forceActive,
|
|
49
53
|
});
|
|
54
|
+
let innerContent = (0, jsx_runtime_1.jsxs)("div", { className: NavLink_module_scss_1.default.innerContent, children: [icon, children] });
|
|
50
55
|
let content;
|
|
51
56
|
if (disabled || !smartTo) {
|
|
52
|
-
content = ((0, jsx_runtime_1.
|
|
57
|
+
content = ((0, jsx_runtime_1.jsx)("button", Object.assign({}, rest, { ref: ref, onClick: onClick, className: baseClasses, style: styleObj, disabled: disabled, children: innerContent })));
|
|
53
58
|
}
|
|
54
59
|
else {
|
|
55
|
-
content = ((0, jsx_runtime_1.
|
|
60
|
+
content = ((0, jsx_runtime_1.jsx)(react_2.NavLink, Object.assign({ id: uid }, rest, { ref: ref, to: smartTo, style: styleObj, onClick: onClick, className: ({ isActive }) => (0, classnames_1.default)(baseClasses, {
|
|
56
61
|
[NavLink_module_scss_1.default.displayActive]: displayActive,
|
|
57
62
|
[NavLink_module_scss_1.default.navItemActive]: displayActive && (isActive || forceActive),
|
|
58
|
-
|
|
63
|
+
'xmlui-navlink-active': isActive || forceActive
|
|
64
|
+
}), children: innerContent })));
|
|
59
65
|
}
|
|
60
66
|
return content;
|
|
61
67
|
});
|
|
@@ -126,7 +126,7 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
|
|
|
126
126
|
if (!contentRootRef.current && shadowRef.current) {
|
|
127
127
|
contentRootRef.current = client_1.default.createRoot(shadowRef.current);
|
|
128
128
|
}
|
|
129
|
-
let { errors, component, erroneousCompoundComponentName } = (0, xmlui_parser_1.xmlUiMarkupToComponent)(
|
|
129
|
+
let { errors, component, erroneousCompoundComponentName } = (0, xmlui_parser_1.xmlUiMarkupToComponent)(app);
|
|
130
130
|
if (errors.length > 0) {
|
|
131
131
|
component = (0, xmlui_parser_1.errReportComponent)(errors, "Main.xmlui", erroneousCompoundComponentName);
|
|
132
132
|
}
|
|
@@ -104,6 +104,7 @@ exports.TextMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
104
104
|
[`marginTop-${COMP}-tableheading`]: "$space-1",
|
|
105
105
|
[`marginBottom-${COMP}-tableheading`]: "$space-4",
|
|
106
106
|
[`paddingHorizontal-${COMP}-tableheading`]: "$space-1",
|
|
107
|
+
[`fontSize-${COMP}-tableheading`]: "$fontSize-H6",
|
|
107
108
|
[`fontWeight-${COMP}-tableheading`]: "$fontWeight-bold",
|
|
108
109
|
[`marginTop-${COMP}-markdown`]: "$space-3",
|
|
109
110
|
[`marginBottom-${COMP}-markdown`]: "$space-6",
|
|
@@ -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);
|
|
@@ -0,0 +1,47 @@
|
|
|
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.treeDisplayComponentRenderer = exports.TreeDisplayMd = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const TreeDisplay_module_scss_1 = __importDefault(require("./TreeDisplay.module.scss"));
|
|
9
|
+
const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
|
|
10
|
+
const renderers_1 = require("../../components-core/renderers");
|
|
11
|
+
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
12
|
+
const TreeDisplayNative_1 = require("./TreeDisplayNative");
|
|
13
|
+
const COMP = "TreeDisplay";
|
|
14
|
+
exports.TreeDisplayMd = (0, ComponentDefs_1.createMetadata)({
|
|
15
|
+
status: "stable",
|
|
16
|
+
description: `The \`${COMP}\` component displays hierarchical data in a tree structure. ` +
|
|
17
|
+
`It accepts an indented text format where each line is an entry in the tree, and ` +
|
|
18
|
+
`the number of leading spaces determines the nesting level. The component renders ` +
|
|
19
|
+
`the tree with SVG lines and continuous vertical guides to clearly visualize parent-child relationships in the hierarchy.`,
|
|
20
|
+
props: {
|
|
21
|
+
content: {
|
|
22
|
+
description: "The indented text content to display as a tree structure. Each level of indentation (using spaces) represents one level in the tree hierarchy.",
|
|
23
|
+
valueType: "string",
|
|
24
|
+
defaultValue: TreeDisplayNative_1.defaultProps.content,
|
|
25
|
+
},
|
|
26
|
+
itemHeight: {
|
|
27
|
+
description: "The height of each tree item in pixels.",
|
|
28
|
+
valueType: "number",
|
|
29
|
+
defaultValue: 24,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
themeVars: (0, themeVars_1.parseScssVar)(TreeDisplay_module_scss_1.default.themeVars),
|
|
33
|
+
defaultThemeVars: {
|
|
34
|
+
[`backgroundColor-${COMP}`]: "$color-primary-50",
|
|
35
|
+
[`borderRadius-${COMP}`]: "8px",
|
|
36
|
+
[`padding-${COMP}`]: "$space-4",
|
|
37
|
+
[`paddingLeft-${COMP}`]: "$space-2",
|
|
38
|
+
[`fontSize-${COMP}`]: "$fontSize-default",
|
|
39
|
+
[`fontWeight-${COMP}`]: "$fontWeight-normal",
|
|
40
|
+
[`fontFamily-${COMP}`]: "$fontFamily-monospace",
|
|
41
|
+
[`color-${COMP}`]: "$textColor-primary",
|
|
42
|
+
[`color-connect-${COMP}`]: "$color-surface-200",
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
exports.treeDisplayComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.TreeDisplayMd, ({ node, extractValue, renderChild, layoutCss }) => {
|
|
46
|
+
return ((0, jsx_runtime_1.jsx)(TreeDisplayNative_1.TreeDisplay, { style: layoutCss, content: extractValue.asOptionalString(node.props.content), itemHeight: extractValue.asOptionalNumber(node.props.itemHeight), children: renderChild(node.children) }));
|
|
47
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
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.TreeDisplay = exports.defaultProps = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const TreeDisplay_module_scss_1 = __importDefault(require("./TreeDisplay.module.scss"));
|
|
10
|
+
exports.defaultProps = {
|
|
11
|
+
content: "",
|
|
12
|
+
};
|
|
13
|
+
// Parse the indented text into a tree structure
|
|
14
|
+
const parseTreeContent = (content) => {
|
|
15
|
+
if (!content)
|
|
16
|
+
return [];
|
|
17
|
+
const lines = content.split("\n").filter((line) => line.trim());
|
|
18
|
+
if (lines.length === 0)
|
|
19
|
+
return [];
|
|
20
|
+
const rootNodes = [];
|
|
21
|
+
const levelMap = {};
|
|
22
|
+
lines.forEach((line) => {
|
|
23
|
+
// Count leading spaces to determine level
|
|
24
|
+
const leadingSpaces = line.length - line.trimLeft().length;
|
|
25
|
+
const currentLevel = leadingSpaces;
|
|
26
|
+
const label = line.trim();
|
|
27
|
+
const node = { label, level: currentLevel, children: [] };
|
|
28
|
+
// If we're at level 0, this is a root node
|
|
29
|
+
if (currentLevel === 0) {
|
|
30
|
+
rootNodes.push(node);
|
|
31
|
+
levelMap[0] = rootNodes;
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// Find the nearest parent level
|
|
35
|
+
let parentLevel = currentLevel - 1;
|
|
36
|
+
while (parentLevel >= 0) {
|
|
37
|
+
if (levelMap[parentLevel] && levelMap[parentLevel].length > 0) {
|
|
38
|
+
// Get the last node at the parent level
|
|
39
|
+
const parent = levelMap[parentLevel][levelMap[parentLevel].length - 1];
|
|
40
|
+
parent.children.push(node);
|
|
41
|
+
// Initialize or update this level's map entry
|
|
42
|
+
if (!levelMap[currentLevel]) {
|
|
43
|
+
levelMap[currentLevel] = [];
|
|
44
|
+
}
|
|
45
|
+
levelMap[currentLevel].push(node);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
parentLevel--;
|
|
49
|
+
}
|
|
50
|
+
// If we get here, something is wrong with the tree structure
|
|
51
|
+
// Add to root as fallback
|
|
52
|
+
rootNodes.push(node);
|
|
53
|
+
});
|
|
54
|
+
// Mark last children at each level for correct connector rendering
|
|
55
|
+
const markLastChildren = (nodes) => {
|
|
56
|
+
if (nodes.length > 0) {
|
|
57
|
+
nodes[nodes.length - 1].isLast = true;
|
|
58
|
+
nodes.forEach((node) => {
|
|
59
|
+
if (node.children.length > 0) {
|
|
60
|
+
markLastChildren(node.children);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
markLastChildren(rootNodes);
|
|
66
|
+
return rootNodes;
|
|
67
|
+
};
|
|
68
|
+
// Calculate the total height of a node and its descendants
|
|
69
|
+
const calculateNodeHeight = (node, itemHeight) => {
|
|
70
|
+
if (node.children.length === 0) {
|
|
71
|
+
return itemHeight; // Single node height
|
|
72
|
+
}
|
|
73
|
+
return (itemHeight +
|
|
74
|
+
node.children.reduce((acc, child) => acc + calculateNodeHeight(child, itemHeight), 0));
|
|
75
|
+
};
|
|
76
|
+
// Render a node and its children with SVG line connectors
|
|
77
|
+
const renderTreeNode = (node, index, itemHeight, level = 0, ancestorLines = []) => {
|
|
78
|
+
const isLast = node.isLast;
|
|
79
|
+
const isRoot = level === 0;
|
|
80
|
+
const hasChildren = node.children.length > 0;
|
|
81
|
+
const nodeHeight = hasChildren ? calculateNodeHeight(node, itemHeight) : itemHeight;
|
|
82
|
+
const halfHeight = itemHeight / 2;
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: TreeDisplay_module_scss_1.default.treeNode, children: [(0, jsx_runtime_1.jsxs)("div", { className: TreeDisplay_module_scss_1.default.treeNodeRow, style: { height: `${itemHeight}px` }, children: [(0, jsx_runtime_1.jsx)("div", { className: TreeDisplay_module_scss_1.default.connectorArea, style: {
|
|
84
|
+
marginLeft: `${level * itemHeight}px`,
|
|
85
|
+
width: `${itemHeight}px`,
|
|
86
|
+
height: `${itemHeight}px`,
|
|
87
|
+
}, children: (0, jsx_runtime_1.jsxs)("svg", { className: TreeDisplay_module_scss_1.default.connector, width: itemHeight, height: hasChildren ? nodeHeight : itemHeight, viewBox: `0 0 ${itemHeight} ${hasChildren ? nodeHeight : itemHeight}`, style: { position: "absolute", top: 0, left: 0 }, children: [isRoot && ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsx)("line", { x1: halfHeight, y1: halfHeight, x2: itemHeight, y2: halfHeight, strokeWidth: "1.5", className: TreeDisplay_module_scss_1.default.connectorLine }) })), !isRoot && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("line", { x1: halfHeight, y1: 0, x2: halfHeight, y2: isLast ? halfHeight : itemHeight, strokeWidth: "1.5", className: TreeDisplay_module_scss_1.default.connectorLine }), (0, jsx_runtime_1.jsx)("line", { x1: halfHeight, y1: halfHeight, x2: itemHeight, y2: halfHeight, strokeWidth: "1.5", className: TreeDisplay_module_scss_1.default.connectorLine })] })), !isLast && hasChildren && ((0, jsx_runtime_1.jsx)("line", { x1: halfHeight, y1: halfHeight, x2: halfHeight, y2: nodeHeight, strokeWidth: "1.5", className: TreeDisplay_module_scss_1.default.connectorLine })), ancestorLines.map((shouldDraw, i) => shouldDraw && ((0, jsx_runtime_1.jsx)("line", { x1: halfHeight - (level - i) * itemHeight, y1: 0, x2: halfHeight - (level - i) * itemHeight, y2: nodeHeight, strokeWidth: "1.5", className: TreeDisplay_module_scss_1.default.connectorLine }, `ancestor-${i}`)))] }) }), (0, jsx_runtime_1.jsx)("div", { className: TreeDisplay_module_scss_1.default.treeNodeContent, style: { lineHeight: `${itemHeight}px` }, children: node.label })] }), hasChildren && ((0, jsx_runtime_1.jsx)("div", { className: TreeDisplay_module_scss_1.default.childrenContainer, children: node.children.map((child, i) => {
|
|
88
|
+
// Create new ancestor lines array for child nodes
|
|
89
|
+
const newAncestorLines = [...ancestorLines];
|
|
90
|
+
while (newAncestorLines.length <= level) {
|
|
91
|
+
newAncestorLines.push(false);
|
|
92
|
+
}
|
|
93
|
+
// Set current level's line status: draw if this child is not the last child
|
|
94
|
+
newAncestorLines[level] = i !== node.children.length - 1;
|
|
95
|
+
return renderTreeNode(child, i, itemHeight, level + 1, newAncestorLines);
|
|
96
|
+
}) }))] }, `${node.label}-${index}`));
|
|
97
|
+
};
|
|
98
|
+
exports.TreeDisplay = (0, react_1.forwardRef)(function TreeDisplay({ style, children, content = "", itemHeight = 24 }, forwardedRef) {
|
|
99
|
+
const contentString = (content || (children === null || children === void 0 ? void 0 : children.toString()) || "").toString();
|
|
100
|
+
const treeNodes = (0, react_1.useMemo)(() => parseTreeContent(contentString), [contentString]);
|
|
101
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: TreeDisplay_module_scss_1.default.treeDisplay, style: style, ref: forwardedRef, children: (0, jsx_runtime_1.jsx)("div", { className: TreeDisplay_module_scss_1.default.content, children: treeNodes.map((node, index) => renderTreeNode(node, index, itemHeight, 0, [])) }) }));
|
|
102
|
+
});
|
|
@@ -198,6 +198,7 @@ const TextVariantKeys = [
|
|
|
198
198
|
"code", // use <code>
|
|
199
199
|
"codefence", // use uniquely styled <![CDATA[
|
|
200
200
|
"deleted", // use <del>
|
|
201
|
+
"inherit",
|
|
201
202
|
"inserted", // use <ins>
|
|
202
203
|
"keyboard", // use <kbd>,
|
|
203
204
|
"marked", // use <mark>
|
|
@@ -224,6 +225,7 @@ exports.TextVariantElement = {
|
|
|
224
225
|
code: "code",
|
|
225
226
|
codefence: "pre",
|
|
226
227
|
deleted: "del",
|
|
228
|
+
inherit: "span",
|
|
227
229
|
inserted: "ins",
|
|
228
230
|
keyboard: "kbd",
|
|
229
231
|
marked: "mark",
|
|
@@ -255,6 +257,10 @@ exports.variantOptionsMd = [
|
|
|
255
257
|
},
|
|
256
258
|
{ value: "deleted", description: "Represents text that has been deleted" },
|
|
257
259
|
{ value: "em", description: "Marks text to stress emphasis" },
|
|
260
|
+
{
|
|
261
|
+
value: "inherit",
|
|
262
|
+
description: "Represents text that inherits the style from its parent element",
|
|
263
|
+
},
|
|
258
264
|
{
|
|
259
265
|
value: "inserted",
|
|
260
266
|
description: "Represents a range of text that has been added to a document",
|
|
@@ -122,7 +122,7 @@ function useCompiledTheme(activeTheme, activeTone, themes = constants_1.EMPTY_AR
|
|
|
122
122
|
})
|
|
123
123
|
.slice(0, themeDefChain.length - 1),
|
|
124
124
|
Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (0, transformThemeVars_1.generateBaseSpacings)(mergedThemeVars)), (0, transformThemeVars_1.generateBaseFontSizes)(mergedThemeVars)), (0, transformThemeVars_1.generatePaddingSegments)(mergedThemeVars)), (0, transformThemeVars_1.generateBorderSegments)(mergedThemeVars)), (0, transformThemeVars_1.generateBaseTones)(mergedThemeVars)), (0, transformThemeVars_1.generateButtonTones)(mergedThemeVars)),
|
|
125
|
-
Object.assign(Object.assign(Object.assign({}, themeDefChain[themeDefChain.length - 1].themeVars), (_a = themeDefChain[themeDefChain.length - 1].themeVars) === null || _a === void 0 ? void 0 : _a[activeTone]), (_c = (_b = themeDefChain[themeDefChain.length - 1].tones) === null || _b === void 0 ? void 0 : _b[activeTone]) === null || _c === void 0 ? void 0 : _c.themeVars),
|
|
125
|
+
Object.assign(Object.assign(Object.assign(Object.assign({}, themeDefChain[themeDefChain.length - 1].themeVars), (0, transformThemeVars_1.generateTextFontSizes)(mergedThemeVars)), (_a = themeDefChain[themeDefChain.length - 1].themeVars) === null || _a === void 0 ? void 0 : _a[activeTone]), (_c = (_b = themeDefChain[themeDefChain.length - 1].tones) === null || _b === void 0 ? void 0 : _b[activeTone]) === null || _c === void 0 ? void 0 : _c.themeVars),
|
|
126
126
|
];
|
|
127
127
|
return resultedTheme;
|
|
128
128
|
}, [activeTone, themeDefChain]);
|
|
@@ -8,12 +8,14 @@ exports.resolveThemeVar = resolveThemeVar;
|
|
|
8
8
|
exports.generateBaseTones = generateBaseTones;
|
|
9
9
|
exports.generateBaseSpacings = generateBaseSpacings;
|
|
10
10
|
exports.generateBaseFontSizes = generateBaseFontSizes;
|
|
11
|
+
exports.generateTextFontSizes = generateTextFontSizes;
|
|
11
12
|
exports.generateButtonTones = generateButtonTones;
|
|
12
13
|
exports.generatePaddingSegments = generatePaddingSegments;
|
|
13
14
|
exports.generateBorderSegments = generateBorderSegments;
|
|
14
15
|
const color_1 = __importDefault(require("color"));
|
|
15
16
|
const hvar_1 = require("../theming/hvar");
|
|
16
17
|
const StyleParser_1 = require("../../parsers/style-parser/StyleParser");
|
|
18
|
+
const layout_resolver_1 = require("./layout-resolver");
|
|
17
19
|
function isThemeVarName(varName) {
|
|
18
20
|
return typeof varName === "string" && (varName === null || varName === void 0 ? void 0 : varName.startsWith("$"));
|
|
19
21
|
}
|
|
@@ -95,6 +97,31 @@ function generateBaseFontSizes(theme) {
|
|
|
95
97
|
ret[`fontSize-tiny`] = `${0.625 * baseNum}${baseUnit}`;
|
|
96
98
|
return ret;
|
|
97
99
|
}
|
|
100
|
+
function generateTextFontSizes(theme) {
|
|
101
|
+
if (!theme) {
|
|
102
|
+
return {};
|
|
103
|
+
}
|
|
104
|
+
const resolvedTheme = resolveThemeVars(theme);
|
|
105
|
+
const base = resolvedTheme["fontSize-Text"];
|
|
106
|
+
if (!base || typeof base !== "string") {
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
// --- Get the CSS variable name of fontSize-Text-keyboard
|
|
110
|
+
const ret = {};
|
|
111
|
+
ret[`fontSize-Text-keyboard`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 0.875)`;
|
|
112
|
+
ret[`fontSize-Text-sample`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 0.875)`;
|
|
113
|
+
ret[`fontSize-Text-sup`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 0.625)`;
|
|
114
|
+
ret[`fontSize-Text-sub`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 0.625)`;
|
|
115
|
+
ret[`fontSize-Text-title`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 1.5)`;
|
|
116
|
+
ret[`fontSize-Text-subtitle`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 1.25)`;
|
|
117
|
+
ret[`fontSize-Text-small`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 0.875)`;
|
|
118
|
+
ret[`fontSize-Text-placeholder`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 0.875)`;
|
|
119
|
+
ret[`fontSize-Text-paragraph`] = (0, layout_resolver_1.toCssVar)("$fontSize-Text");
|
|
120
|
+
ret[`fontSize-Text-subheading`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 0.625)`;
|
|
121
|
+
ret[`fontSize-Text-tableheading`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 0.625)`;
|
|
122
|
+
ret[`fontSize-Text-secondary`] = `calc(${(0, layout_resolver_1.toCssVar)("$fontSize-Text")} * 0.875)`;
|
|
123
|
+
return ret;
|
|
124
|
+
}
|
|
98
125
|
function generateButtonTones(theme) {
|
|
99
126
|
if (!theme) {
|
|
100
127
|
return {};
|
|
@@ -960,7 +960,7 @@ declare const _default: {
|
|
|
960
960
|
[variantSpecificProps: string]: any;
|
|
961
961
|
uid?: string;
|
|
962
962
|
children?: default_2.ReactNode;
|
|
963
|
-
variant?: "small" | "sub" | "sup" | "abbr" | "caption" | "cite" | "code" | "em" | "strong" | "title" | "var" | "mono" | "secondary" | "codefence" | "deleted" | "inserted" | "keyboard" | "marked" | "sample" | "subtitle" | "placeholder" | "paragraph" | "subheading" | "tableheading";
|
|
963
|
+
variant?: "small" | "sub" | "sup" | "abbr" | "caption" | "cite" | "code" | "em" | "strong" | "title" | "var" | "inherit" | "mono" | "secondary" | "codefence" | "deleted" | "inserted" | "keyboard" | "marked" | "sample" | "subtitle" | "placeholder" | "paragraph" | "subheading" | "tableheading";
|
|
964
964
|
maxLines?: number;
|
|
965
965
|
preserveLinebreaks?: boolean;
|
|
966
966
|
ellipses?: boolean;
|
|
@@ -2063,7 +2063,7 @@ declare type TextProps = {
|
|
|
2063
2063
|
|
|
2064
2064
|
declare type TextVariant = (typeof TextVariantKeys)[number];
|
|
2065
2065
|
|
|
2066
|
-
declare const TextVariantKeys: readonly ["abbr", "cite", "code", "codefence", "deleted", "inserted", "keyboard", "marked", "sample", "sub", "sup", "var", "strong", "em", "mono", "title", "subtitle", "small", "caption", "placeholder", "paragraph", "subheading", "tableheading", "secondary"];
|
|
2066
|
+
declare const TextVariantKeys: readonly ["abbr", "cite", "code", "codefence", "deleted", "inherit", "inserted", "keyboard", "marked", "sample", "sub", "sup", "var", "strong", "em", "mono", "title", "subtitle", "small", "caption", "placeholder", "paragraph", "subheading", "tableheading", "secondary"];
|
|
2067
2067
|
|
|
2068
2068
|
/**
|
|
2069
2069
|
* This type represents a theme definition object. Theme files can use this object's JSON-serialized
|