xmlui 0.9.46 → 0.9.47
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-BY933b9G.mjs} +1 -1
- package/dist/lib/{index-_koqcHz7.mjs → index-DLZaCu6v.mjs} +10860 -10615
- 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-DJ9dCJkg.mjs} +4201 -4231
- 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 +3333 -3307
- package/dist/metadata/xmlui-metadata.umd.js +10 -10
- package/dist/scripts/package.json +1 -1
- package/dist/scripts/src/components/App/AppNative.js +1 -1
- package/dist/scripts/src/components/ComponentProvider.js +240 -121
- 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/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 +209 -205
- package/package.json +1 -1
|
@@ -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",
|
|
@@ -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
|