xmlui 0.9.45 → 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.
Files changed (38) hide show
  1. package/dist/lib/{apiInterceptorWorker-DzZYVTsV.mjs → apiInterceptorWorker-BY933b9G.mjs} +1 -1
  2. package/dist/lib/{index-erPY1EdW.mjs → index-DLZaCu6v.mjs} +11623 -11354
  3. package/dist/lib/index.css +1 -1
  4. package/dist/lib/language-server-web-worker.mjs +1 -1
  5. package/dist/lib/language-server.mjs +1 -1
  6. package/dist/lib/{metadata-utils-Cf8v_9Lr.mjs → metadata-utils-DiiTyP_-.mjs} +12 -7
  7. package/dist/lib/{server-common-kMTAr-QU.mjs → server-common-DJ9dCJkg.mjs} +4201 -4231
  8. package/dist/lib/xmlui.d.ts +28 -1
  9. package/dist/lib/xmlui.mjs +27 -26
  10. package/dist/metadata/style.css +1 -1
  11. package/dist/metadata/xmlui-metadata.mjs +4102 -4056
  12. package/dist/metadata/xmlui-metadata.umd.js +9 -9
  13. package/dist/scripts/package.json +1 -1
  14. package/dist/scripts/src/components/App/App.js +3 -2
  15. package/dist/scripts/src/components/App/AppNative.js +1 -1
  16. package/dist/scripts/src/components/App/SearchContext.js +1 -1
  17. package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -1
  18. package/dist/scripts/src/components/ComponentProvider.js +240 -121
  19. package/dist/scripts/src/components/DatePicker/DatePickerNative.js +34 -2
  20. package/dist/scripts/src/components/Markdown/Markdown.js +9 -0
  21. package/dist/scripts/src/components/Markdown/MarkdownNative.js +11 -1
  22. package/dist/scripts/src/components/Markdown/utils.js +38 -0
  23. package/dist/scripts/src/components/NavGroup/NavGroupContext.js +12 -0
  24. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +19 -26
  25. package/dist/scripts/src/components/NavLink/NavLinkNative.js +11 -5
  26. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +1 -1
  27. package/dist/scripts/src/components/Select/Select.js +3 -3
  28. package/dist/scripts/src/components/Text/Text.js +1 -1
  29. package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
  30. package/dist/scripts/src/components/TreeDisplay/TreeDisplay.js +47 -0
  31. package/dist/scripts/src/components/TreeDisplay/TreeDisplayNative.js +102 -0
  32. package/dist/scripts/src/components/abstractions.js +6 -0
  33. package/dist/scripts/src/components-core/theming/ThemeProvider.js +1 -1
  34. package/dist/scripts/src/components-core/theming/themes/root.js +2 -2
  35. package/dist/scripts/src/components-core/theming/transformThemeVars.js +27 -0
  36. package/dist/standalone/xmlui-standalone.es.d.ts +33 -3
  37. package/dist/standalone/xmlui-standalone.umd.js +216 -212
  38. package/package.json +1 -1
@@ -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)();
@@ -252,7 +253,7 @@ exports.Markdown = (0, react_1.memo)(function Markdown({ removeIndents = true, c
252
253
  return ((0, jsx_runtime_1.jsx)(Toggle_1.Toggle, { variant: "checkbox", readOnly: disabled, value: checked }));
253
254
  },
254
255
  table({ children }) {
255
- return (0, jsx_runtime_1.jsx)("table", { className: HtmlTags_module_scss_1.default.htmlTable, children: children });
256
+ return ((0, jsx_runtime_1.jsx)("div", { className: Markdown_module_scss_1.default.tableScrollContainer, children: (0, jsx_runtime_1.jsx)("table", { className: HtmlTags_module_scss_1.default.htmlTable, children: children }) }));
256
257
  },
257
258
  tr({ children }) {
258
259
  return (0, jsx_runtime_1.jsx)("tr", { className: HtmlTags_module_scss_1.default.htmlTr, children: children });
@@ -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 toggleStyle = Object.assign(Object.assign({}, style), { paddingLeft: level >= 1 ? level * 2 + "em" : undefined });
62
- 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 })] }), expanded &&
63
- renderChild(node.children, {
64
- wrapChild: ({ node }, renderedChild) => {
65
- if (node.type === "NavLink") {
66
- const element = renderedChild;
67
- return (0, react_1.cloneElement)(element, Object.assign({}, (0, mergeProps_1.mergeProps)(renderedChild.props, {
68
- style: {
69
- paddingLeft: (level + 1) * 2 + "em",
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, sx = {}, displayActive = true, vertical, style, onClick, icon, forceActive } = _a, rest = __rest(_a, ["uid", "children", "disabled", "to", "sx", "displayActive", "vertical", "style", "onClick", "icon", "forceActive"]);
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 = Object.assign(Object.assign({}, sx), style);
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.jsxs)("button", Object.assign({}, rest, { ref: ref, onClick: onClick, className: baseClasses, style: styleObj, disabled: disabled, children: [icon, children] })));
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.jsxs)(react_2.NavLink, Object.assign({ id: uid }, rest, { ref: ref, to: smartTo, style: styleObj, onClick: onClick, className: ({ isActive }) => (0, classnames_1.default)(baseClasses, {
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
- }), children: [icon, children] })));
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)(`<Fragment xmlns:XMLUIExtensions="component-ns">${app}</Fragment>`);
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
  }
@@ -63,9 +63,6 @@ exports.SelectMd = (0, ComponentDefs_1.createMetadata)({
63
63
  [`borderRadius-menu-${COMP}`]: "$borderRadius",
64
64
  [`borderWidth-menu-${COMP}`]: "1px",
65
65
  [`borderColor-menu-${COMP}`]: "$borderColor",
66
- [`backgroundColor-item-${COMP}`]: "$backgroundColor-dropdown-item",
67
- [`backgroundColor-item-${COMP}--hover`]: "$backgroundColor-dropdown-item--active",
68
- [`backgroundColor-item-${COMP}--active`]: "$backgroundColor-dropdown-item--active",
69
66
  [`minHeight-Input`]: "39px",
70
67
  [`backgroundColor-${COMP}-badge`]: "$color-primary-500",
71
68
  [`fontSize-${COMP}-badge`]: "$fontSize-small",
@@ -79,6 +76,9 @@ exports.SelectMd = (0, ComponentDefs_1.createMetadata)({
79
76
  [`backgroundColor-${COMP}-badge--active`]: "$color-primary-500",
80
77
  [`textColor-item-${COMP}--disabled`]: "$color-surface-200",
81
78
  [`textColor-${COMP}-badge`]: "$color-surface-50",
79
+ [`backgroundColor-item-${COMP}`]: "$backgroundColor-dropdown-item",
80
+ [`backgroundColor-item-${COMP}--hover`]: "$backgroundColor-dropdown-item--hover",
81
+ [`backgroundColor-item-${COMP}--active`]: "$backgroundColor-dropdown-item--active",
82
82
  },
83
83
  });
84
84
  exports.selectComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.SelectMd, ({ node, state, updateState, extractValue, renderChild, lookupEventHandler, layoutCss, registerComponentApi, }) => {
@@ -104,10 +104,10 @@ 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",
110
- [`fontSize-${COMP}-markdown`]: "$fontSize-normal",
111
111
  [`backgroundColor-${COMP}-code`]: "rgba($color-surface-100-rgb, .4)",
112
112
  [`borderColor-${COMP}-code`]: "$color-surface-100",
113
113
  [`backgroundColor-${COMP}-keyboard`]: "rgba($color-surface-100-rgb, .4)",
@@ -46,7 +46,7 @@ const constants_1 = require("../../components-core/constants");
46
46
  const misc_1 = require("../../components-core/utils/misc");
47
47
  const InputAdornment_1 = require("../Input/InputAdornment");
48
48
  const ItemWithLabel_1 = require("../FormItem/ItemWithLabel");
49
- exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text", value = "", updateState = constants_1.noop, initialValue = "", style, maxLength, enabled = true, placeholder, validationStatus = "none", onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, registerComponentApi, startText, startIcon, endText, endIcon, gap, autoFocus, readOnly, tabIndex, label, labelPosition, labelWidth, labelBreak, required, }, ref) {
49
+ exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text", value = "", updateState = constants_1.noop, initialValue = "", style, maxLength, enabled = true, placeholder, validationStatus = "none", onDidChange = constants_1.noop, onFocus = constants_1.noop, onBlur = constants_1.noop, onKeyDown = constants_1.noop, registerComponentApi, startText, startIcon, endText, endIcon, gap, autoFocus, readOnly, tabIndex, label, labelPosition, labelWidth, labelBreak, required, }, ref) {
50
50
  const _id = (0, react_1.useId)();
51
51
  id = id || _id;
52
52
  const inputRef = (0, react_2.useRef)(null);
@@ -104,5 +104,5 @@ exports.TextBox = (0, react_1.forwardRef)(function TextBox({ id, type = "text",
104
104
  [TextBox_module_scss_1.default.error]: validationStatus === "error",
105
105
  [TextBox_module_scss_1.default.warning]: validationStatus === "warning",
106
106
  [TextBox_module_scss_1.default.valid]: validationStatus === "valid",
107
- }), tabIndex: -1, onFocus: focus, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: TextBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: type, className: (0, classnames_1.default)(TextBox_module_scss_1.default.input, { [TextBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: localValue, maxLength: maxLength, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: enabled ? tabIndex : -1, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: TextBox_module_scss_1.default.adornment })] }) }));
107
+ }), tabIndex: -1, onFocus: focus, style: { gap }, children: [(0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: startText, iconName: startIcon, className: TextBox_module_scss_1.default.adornment }), (0, jsx_runtime_1.jsx)("input", { id: id, type: type, className: (0, classnames_1.default)(TextBox_module_scss_1.default.input, { [TextBox_module_scss_1.default.readOnly]: readOnly }), disabled: !enabled, value: localValue, maxLength: maxLength, placeholder: placeholder, onChange: onInputChange, onFocus: handleOnFocus, onBlur: handleOnBlur, onKeyDown: onKeyDown, ref: inputRef, readOnly: readOnly, autoFocus: autoFocus, tabIndex: enabled ? tabIndex : -1, required: required }), (0, jsx_runtime_1.jsx)(InputAdornment_1.Adornment, { text: endText, iconName: endIcon, className: TextBox_module_scss_1.default.adornment })] }) }));
108
108
  });
@@ -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]);
@@ -126,7 +126,7 @@ exports.RootThemeDefinition = {
126
126
  "color-info": "$color-info-500",
127
127
  "color-valid": "$color-success-600",
128
128
  "color-warning": "$color-warn-700",
129
- "color-error": "$color-danger-600",
129
+ "color-error": "$color-danger-500",
130
130
  // --- Default line height values (relative to the base unit, "space-base")
131
131
  "lineHeight-none": "1",
132
132
  "lineHeight-tight": "1.25",
@@ -212,7 +212,7 @@ exports.RootThemeDefinition = {
212
212
  "borderColor-Input-default--focus": $colorSurface600,
213
213
  "borderColor-Input-default--success": $colorSuccess600,
214
214
  "borderColor-Input-default--warning": $colorWarn700,
215
- "borderColor-Input-default--error": $colorDanger600,
215
+ "borderColor-Input-default--error": $colorDanger500,
216
216
  // --- InputLabel is a React component, so we define its default theme variables here
217
217
  "textColor-InputLabel-required": $colorDanger600,
218
218
  },
@@ -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 {};