xmlui 0.9.60 → 0.9.62

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 (184) hide show
  1. package/dist/lib/{apiInterceptorWorker-CNiXy9XE.mjs → apiInterceptorWorker-BXyXjzpe.mjs} +1 -1
  2. package/dist/lib/{index-B1V2vJWh.mjs → index-BRbUXnCk.mjs} +13541 -12973
  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-4EQ6kQIM.mjs → metadata-utils-DJM8orNd.mjs} +40 -31
  7. package/dist/lib/{server-common-SNl_47nE.mjs → server-common-D0VA8gIv.mjs} +1450 -858
  8. package/dist/lib/{transform-CgRMkbb0.mjs → transform-BdB0APqE.mjs} +1543 -1384
  9. package/dist/lib/xmlui-parser.d.ts +76 -253
  10. package/dist/lib/xmlui-parser.mjs +49 -42
  11. package/dist/lib/{xmlui-serializer-EDw51UFN.mjs → xmlui-serializer-COAfRndx.mjs} +1 -1
  12. package/dist/lib/xmlui.d.ts +88 -670
  13. package/dist/lib/xmlui.mjs +2 -2
  14. package/dist/metadata/{apiInterceptorWorker-DsjW46f_.mjs → apiInterceptorWorker-8ismUE1H.mjs} +1 -1
  15. package/dist/metadata/{collectedComponentMetadata-CBiI_eDf.mjs → collectedComponentMetadata-xeEJhtEt.mjs} +13617 -12870
  16. package/dist/metadata/style.css +1 -1
  17. package/dist/metadata/xmlui-metadata.mjs +1 -1
  18. package/dist/metadata/xmlui-metadata.umd.js +116 -116
  19. package/dist/scripts/package.json +5 -5
  20. package/dist/scripts/src/abstractions/ComponentDefs.js +0 -8
  21. package/dist/scripts/src/abstractions/ThemingDefs.js +0 -9
  22. package/dist/scripts/src/components/APICall/APICall.js +30 -18
  23. package/dist/scripts/src/components/Accordion/Accordion.js +5 -4
  24. package/dist/scripts/src/components/Accordion/AccordionItem.js +10 -4
  25. package/dist/scripts/src/components/App/App.js +9 -4
  26. package/dist/scripts/src/components/App/AppNative.js +11 -1
  27. package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -2
  28. package/dist/scripts/src/components/AppState/AppState.js +3 -3
  29. package/dist/scripts/src/components/AutoComplete/AutoComplete.js +6 -7
  30. package/dist/scripts/src/components/Avatar/Avatar.js +3 -3
  31. package/dist/scripts/src/components/Backdrop/Backdrop.js +1 -2
  32. package/dist/scripts/src/components/Badge/Badge.js +1 -2
  33. package/dist/scripts/src/components/Bookmark/Bookmark.js +2 -2
  34. package/dist/scripts/src/components/Breakout/Breakout.js +2 -2
  35. package/dist/scripts/src/components/Button/Button.js +1 -2
  36. package/dist/scripts/src/components/Card/Card.js +2 -3
  37. package/dist/scripts/src/components/Card/CardNative.js +2 -1
  38. package/dist/scripts/src/components/Carousel/Carousel.js +6 -7
  39. package/dist/scripts/src/components/Carousel/CarouselItem.js +2 -2
  40. package/dist/scripts/src/components/ChangeListener/ChangeListener.js +1 -2
  41. package/dist/scripts/src/components/Charts/BarChart/BarChart.js +2 -2
  42. package/dist/scripts/src/components/Charts/DonutChart/DonutChart.js +8 -7
  43. package/dist/scripts/src/components/Charts/LabelList/LabelList.js +2 -2
  44. package/dist/scripts/src/components/Charts/Legend/Legend.js +2 -2
  45. package/dist/scripts/src/components/Charts/LineChart/LineChart.js +6 -6
  46. package/dist/scripts/src/components/Charts/PieChart/PieChart.js +14 -10
  47. package/dist/scripts/src/components/Charts/PieChart/PieChartNative.js +9 -4
  48. package/dist/scripts/src/components/Checkbox/Checkbox.js +1 -2
  49. package/dist/scripts/src/components/CodeBlock/CodeBlock.js +6 -3
  50. package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +1 -1
  51. package/dist/scripts/src/components/ColorPicker/ColorPicker.js +1 -2
  52. package/dist/scripts/src/components/ColorPicker/ColorPickerNative.js +2 -2
  53. package/dist/scripts/src/components/Column/Column.js +2 -2
  54. package/dist/scripts/src/components/ComponentProvider.js +4 -0
  55. package/dist/scripts/src/components/ContentSeparator/ContentSeparator.js +2 -2
  56. package/dist/scripts/src/components/DatePicker/DatePicker.js +2 -3
  57. package/dist/scripts/src/components/DropdownMenu/DropdownMenu.js +6 -7
  58. package/dist/scripts/src/components/EmojiSelector/EmojiSelector.js +2 -3
  59. package/dist/scripts/src/components/ExpandableItem/ExpandableItem.js +9 -10
  60. package/dist/scripts/src/components/FileInput/FileInput.js +14 -15
  61. package/dist/scripts/src/components/FileUploadDropZone/FileUploadDropZone.js +4 -4
  62. package/dist/scripts/src/components/FlowLayout/FlowLayout.js +2 -2
  63. package/dist/scripts/src/components/FlowLayout/FlowLayoutNative.js +35 -6
  64. package/dist/scripts/src/components/Footer/Footer.js +4 -3
  65. package/dist/scripts/src/components/Form/Form.js +12 -9
  66. package/dist/scripts/src/components/Form/FormNative.js +12 -4
  67. package/dist/scripts/src/components/FormItem/FormItem.js +7 -8
  68. package/dist/scripts/src/components/FormItem/ItemWithLabel.js +1 -1
  69. package/dist/scripts/src/components/FormSection/FormSection.js +2 -2
  70. package/dist/scripts/src/components/Heading/Heading.js +11 -11
  71. package/dist/scripts/src/components/HelloWorld/HelloWorld.js +102 -0
  72. package/dist/scripts/src/components/HelloWorld/HelloWorldNative.js +92 -0
  73. package/dist/scripts/src/components/HoverCard/HoverCard.js +1 -2
  74. package/dist/scripts/src/components/HtmlTags/HtmlTags.js +297 -297
  75. package/dist/scripts/src/components/Icon/Icon.js +5 -5
  76. package/dist/scripts/src/components/Image/Image.js +4 -5
  77. package/dist/scripts/src/components/InspectButton/InspectButton.js +2 -2
  78. package/dist/scripts/src/components/Items/Items.js +2 -3
  79. package/dist/scripts/src/components/Link/Link.js +3 -4
  80. package/dist/scripts/src/components/Link/LinkNative.js +46 -1
  81. package/dist/scripts/src/components/List/List.js +15 -16
  82. package/dist/scripts/src/components/Logo/Logo.js +2 -2
  83. package/dist/scripts/src/components/Markdown/Markdown.js +6 -6
  84. package/dist/scripts/src/components/Markdown/MarkdownNative.js +2 -4
  85. package/dist/scripts/src/components/Markdown/parse-binding-expr.js +1 -1
  86. package/dist/scripts/src/components/Markdown/utils.js +32 -13
  87. package/dist/scripts/src/components/ModalDialog/ModalDialog.js +9 -9
  88. package/dist/scripts/src/components/NavGroup/NavGroup.js +2 -3
  89. package/dist/scripts/src/components/NavGroup/NavGroupContext.js +1 -0
  90. package/dist/scripts/src/components/NavGroup/NavGroupNative.js +6 -2
  91. package/dist/scripts/src/components/NavLink/NavLink.js +3 -4
  92. package/dist/scripts/src/components/NavLink/NavLinkNative.js +10 -9
  93. package/dist/scripts/src/components/NavPanel/NavPanel.js +4 -4
  94. package/dist/scripts/src/components/NavPanel/NavPanelNative.js +132 -3
  95. package/dist/scripts/src/components/NestedApp/AppWithCodeView.js +24 -5
  96. package/dist/scripts/src/components/NestedApp/AppWithCodeViewNative.js +64 -7
  97. package/dist/scripts/src/components/NestedApp/NestedApp.js +19 -9
  98. package/dist/scripts/src/components/NestedApp/NestedAppNative.js +11 -7
  99. package/dist/scripts/src/components/NoResult/NoResult.js +1 -2
  100. package/dist/scripts/src/components/NumberBox/NumberBox.js +5 -6
  101. package/dist/scripts/src/components/NumberBox/NumberBox2.js +5 -6
  102. package/dist/scripts/src/components/Option/Option.js +5 -5
  103. package/dist/scripts/src/components/PageMetaTitle/PageMetaTitle.js +2 -2
  104. package/dist/scripts/src/components/Pages/Pages.js +7 -8
  105. package/dist/scripts/src/components/Pages/PagesNative.js +8 -3
  106. package/dist/scripts/src/components/PositionedContainer/PositionedContainer.js +3 -3
  107. package/dist/scripts/src/components/ProgressBar/ProgressBar.js +2 -2
  108. package/dist/scripts/src/components/Queue/Queue.js +16 -16
  109. package/dist/scripts/src/components/RadioGroup/RadioGroup.js +13 -13
  110. package/dist/scripts/src/components/RadioGroup/RadioGroupNative.js +13 -28
  111. package/dist/scripts/src/components/RadioGroup/RadioItem.js +2 -2
  112. package/dist/scripts/src/components/RealTimeAdapter/RealTimeAdapter.js +3 -3
  113. package/dist/scripts/src/components/Redirect/Redirect.js +2 -2
  114. package/dist/scripts/src/components/Select/Select.js +8 -8
  115. package/dist/scripts/src/components/Select/SelectNative.js +1 -1
  116. package/dist/scripts/src/components/SelectionStore/SelectionStore.js +2 -2
  117. package/dist/scripts/src/components/Slider/Slider.js +4 -5
  118. package/dist/scripts/src/components/SpaceFiller/SpaceFiller.js +2 -2
  119. package/dist/scripts/src/components/Spinner/Spinner.js +2 -2
  120. package/dist/scripts/src/components/Splitter/Splitter.js +2 -3
  121. package/dist/scripts/src/components/Stack/Stack.js +1 -2
  122. package/dist/scripts/src/components/StickyBox/StickyBox.js +2 -2
  123. package/dist/scripts/src/components/StickyBox/StickyBoxNative.js +2 -0
  124. package/dist/scripts/src/components/Switch/Switch.js +7 -4
  125. package/dist/scripts/src/components/Table/Table.js +19 -20
  126. package/dist/scripts/src/components/Table/TableNative.js +6 -2
  127. package/dist/scripts/src/components/Table/useRowSelection.js +6 -2
  128. package/dist/scripts/src/components/TableOfContents/TableOfContents.js +2 -2
  129. package/dist/scripts/src/components/Tabs/TabItem.js +1 -2
  130. package/dist/scripts/src/components/Tabs/Tabs.js +9 -6
  131. package/dist/scripts/src/components/Text/Text.js +6 -6
  132. package/dist/scripts/src/components/TextArea/TextArea.js +4 -5
  133. package/dist/scripts/src/components/TextBox/TextBox.js +4 -5
  134. package/dist/scripts/src/components/Theme/NotificationToast.js +11 -0
  135. package/dist/scripts/src/components/Theme/Theme.js +4 -4
  136. package/dist/scripts/src/components/Theme/ThemeNative.js +4 -4
  137. package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +2 -2
  138. package/dist/scripts/src/components/Tree/TreeComponent.js +1 -2
  139. package/dist/scripts/src/components/TreeDisplay/TreeDisplay.js +4 -2
  140. package/dist/scripts/src/components/metadata-helpers.js +8 -0
  141. package/dist/scripts/src/components-core/Fragment.js +7 -4
  142. package/dist/scripts/src/components-core/LoaderComponent.js +1 -1
  143. package/dist/scripts/src/components-core/RestApiProxy.js +11 -8
  144. package/dist/scripts/src/components-core/Slot.js +3 -3
  145. package/dist/scripts/src/components-core/appContext/date-functions.js +1 -0
  146. package/dist/scripts/src/components-core/descriptorHelper.js +9 -0
  147. package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +2 -2
  148. package/dist/scripts/src/components-core/loader/ApiLoader.js +4 -4
  149. package/dist/scripts/src/components-core/loader/DataLoader.js +20 -20
  150. package/dist/scripts/src/components-core/loader/ExternalDataLoader.js +6 -6
  151. package/dist/scripts/src/components-core/loader/MockLoaderRenderer.js +4 -4
  152. package/dist/scripts/src/components-core/rendering/AppContent.js +8 -4
  153. package/dist/scripts/src/components-core/rendering/AppRoot.js +4 -2
  154. package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +1 -1
  155. package/dist/scripts/src/components-core/rendering/Container.js +2 -2
  156. package/dist/scripts/src/components-core/rendering/StateContainer.js +8 -2
  157. package/dist/scripts/src/components-core/rendering/reducer.js +1 -1
  158. package/dist/scripts/src/components-core/script-runner/ScriptingSourceTree.js +45 -0
  159. package/dist/scripts/src/components-core/script-runner/eval-tree-async.js +1 -1
  160. package/dist/scripts/src/components-core/script-runner/eval-tree-common.js +1 -1
  161. package/dist/scripts/src/components-core/script-runner/eval-tree-sync.js +1 -1
  162. package/dist/scripts/src/components-core/script-runner/process-statement-async.js +1 -1
  163. package/dist/scripts/src/components-core/script-runner/process-statement-common.js +1 -1
  164. package/dist/scripts/src/components-core/script-runner/process-statement-sync.js +1 -1
  165. package/dist/scripts/src/components-core/script-runner/visitors.js +1 -1
  166. package/dist/scripts/src/components-core/theming/ThemeProvider.js +2 -2
  167. package/dist/scripts/src/components-core/theming/layout-resolver.js +18 -0
  168. package/dist/scripts/src/components-core/theming/themes/root.js +3 -0
  169. package/dist/scripts/src/components-core/theming/utils.js +31 -0
  170. package/dist/scripts/src/components-core/utils/date-utils.js +60 -0
  171. package/dist/scripts/src/components-core/utils/statementUtils.js +1 -1
  172. package/dist/scripts/src/parsers/scripting/Parser.js +1 -1
  173. package/dist/scripts/src/parsers/scripting/code-behind-collect.js +1 -1
  174. package/dist/scripts/src/parsers/scripting/modules.js +1 -1
  175. package/dist/scripts/src/parsers/scripting/tree-visitor.js +1 -1
  176. package/dist/scripts/src/parsers/xmlui-parser/parser.js +42 -39
  177. package/dist/scripts/src/parsers/xmlui-parser/syntax-node.js +65 -0
  178. package/dist/scripts/src/parsers/xmlui-parser/transform.js +10 -8
  179. package/dist/scripts/src/parsers/xmlui-parser/utils.js +1 -2
  180. package/dist/standalone/xmlui-standalone.es.d.ts +88 -670
  181. package/dist/standalone/xmlui-standalone.umd.js +257 -257
  182. package/package.json +5 -5
  183. /package/dist/scripts/src/components-core/{abstractions → rendering}/containers.js +0 -0
  184. /package/dist/scripts/src/{abstractions/scripting/ScriptingSourceTree.js → parsers/scripting/ScriptingNodeTypes.js} +0 -0
@@ -18,6 +18,7 @@ const NavPanelNative_1 = require("../NavPanel/NavPanelNative");
18
18
  const react_2 = require("@remix-run/react");
19
19
  const classnames_1 = __importDefault(require("classnames"));
20
20
  const NavGroupContext_1 = require("./NavGroupContext");
21
+ const AppNative_1 = require("../App/AppNative");
21
22
  exports.defaultProps = {
22
23
  iconHorizontalExpanded: "chevronright",
23
24
  iconHorizontalCollapsed: "chevronright",
@@ -28,6 +29,7 @@ exports.NavGroup = (0, react_1.forwardRef)(function NavGroup({ node, style, labe
28
29
  const { level } = (0, react_1.useContext)(NavGroupContext_1.NavGroupContext);
29
30
  const appLayoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
30
31
  const navPanelContext = (0, react_1.useContext)(NavPanelNative_1.NavPanelContext);
32
+ const layoutIsVertical = !!appLayoutContext && (0, AppNative_1.getAppLayoutOrientation)(appLayoutContext.layout).includes("vertical");
31
33
  let inline = (appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical" ||
32
34
  (appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical-sticky" ||
33
35
  (appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === "vertical-full-header";
@@ -37,6 +39,7 @@ exports.NavGroup = (0, react_1.forwardRef)(function NavGroup({ node, style, labe
37
39
  const navGroupContextValue = (0, react_1.useMemo)(() => {
38
40
  return {
39
41
  level: level + 1,
42
+ layoutIsVertical,
40
43
  iconHorizontalCollapsed: iconHorizontalCollapsed !== null && iconHorizontalCollapsed !== void 0 ? iconHorizontalCollapsed : exports.defaultProps.iconHorizontalCollapsed,
41
44
  iconHorizontalExpanded: iconHorizontalExpanded !== null && iconHorizontalExpanded !== void 0 ? iconHorizontalExpanded : exports.defaultProps.iconHorizontalExpanded,
42
45
  iconVerticalCollapsed: iconVerticalCollapsed !== null && iconVerticalCollapsed !== void 0 ? iconVerticalCollapsed : exports.defaultProps.iconVerticalCollapsed,
@@ -48,11 +51,12 @@ exports.NavGroup = (0, react_1.forwardRef)(function NavGroup({ node, style, labe
48
51
  iconVerticalCollapsed,
49
52
  iconVerticalExpanded,
50
53
  level,
54
+ layoutIsVertical,
51
55
  ]);
52
56
  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 })) }));
53
57
  });
54
58
  const ExpandableNavGroup = (0, react_1.forwardRef)(function ExpandableNavGroup({ style = constants_1.EMPTY_OBJECT, label, icon, renderChild, node, to, initiallyExpanded = false, disabled = false, }, ref) {
55
- const { level, iconVerticalCollapsed, iconVerticalExpanded } = (0, react_1.useContext)(NavGroupContext_1.NavGroupContext);
59
+ const { level, iconVerticalCollapsed, iconVerticalExpanded, layoutIsVertical } = (0, react_1.useContext)(NavGroupContext_1.NavGroupContext);
56
60
  const [expanded, setExpanded] = (0, react_1.useState)(initiallyExpanded);
57
61
  const groupContentInnerRef = (0, react_1.useRef)(null);
58
62
  const { pathname } = (0, react_2.useLocation)();
@@ -62,7 +66,7 @@ const ExpandableNavGroup = (0, react_1.forwardRef)(function ExpandableNavGroup({
62
66
  setExpanded(true);
63
67
  }
64
68
  }, [pathname]);
65
- const toggleStyle = Object.assign(Object.assign({}, style), { "--nav-link-level": level });
69
+ const toggleStyle = Object.assign(Object.assign({}, style), { "--nav-link-level": layoutIsVertical ? level : 0 });
66
70
  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
71
  [NavGroup_module_scss_1.default.expanded]: expanded,
68
72
  }), children: (0, jsx_runtime_1.jsx)("div", { className: NavGroup_module_scss_1.default.groupContentInner, ref: groupContentInnerRef, children: renderChild(node.children) }) })] }));
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.navLinkComponentRenderer = exports.NavLinkMd = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const NavLink_module_scss_1 = __importDefault(require("./NavLink.module.scss"));
9
- const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
10
9
  const renderers_1 = require("../../components-core/renderers");
11
10
  const themeVars_1 = require("../../components-core/theming/themeVars");
12
11
  const metadata_helpers_1 = require("../metadata-helpers");
@@ -14,13 +13,13 @@ const IconNative_1 = require("../Icon/IconNative");
14
13
  const NavLinkNative_1 = require("./NavLinkNative");
15
14
  const abstractions_1 = require("../abstractions");
16
15
  const COMP = "NavLink";
17
- exports.NavLinkMd = (0, ComponentDefs_1.createMetadata)({
16
+ exports.NavLinkMd = (0, metadata_helpers_1.createMetadata)({
18
17
  description: "`NavLink` creates interactive navigation items that connect users to different " +
19
18
  "destinations within an app or external URLs. It automatically indicates active " +
20
19
  "states, supports custom icons and labels, and can execute custom actions instead " +
21
20
  "of navigation when needed.",
22
21
  props: {
23
- to: (0, ComponentDefs_1.d)(`This property defines the URL of the link.`),
22
+ to: (0, metadata_helpers_1.d)(`This property defines the URL of the link.`),
24
23
  enabled: (0, metadata_helpers_1.dEnabled)(),
25
24
  active: {
26
25
  description: `This property indicates if the particular navigation is an active link. An active link ` +
@@ -47,7 +46,7 @@ exports.NavLinkMd = (0, ComponentDefs_1.createMetadata)({
47
46
  valueType: "boolean",
48
47
  defaultValue: NavLinkNative_1.defaultProps.displayActive,
49
48
  },
50
- icon: (0, ComponentDefs_1.d)(`This property allows you to add an optional icon (specify the icon's name) to the navigation link.`),
49
+ icon: (0, metadata_helpers_1.d)(`This property allows you to add an optional icon (specify the icon's name) to the navigation link.`),
51
50
  },
52
51
  events: {
53
52
  click: (0, metadata_helpers_1.dClick)(COMP),
@@ -28,19 +28,20 @@ const NavGroupContext_1 = require("../NavGroup/NavGroupContext");
28
28
  // Default props for NavLink component
29
29
  exports.defaultProps = {
30
30
  active: false,
31
- displayActive: true
31
+ displayActive: true,
32
32
  };
33
33
  exports.NavLink = (0, react_1.forwardRef)(function NavLink(_a, ref) {
34
34
  var {
35
35
  /* eslint-disable react/prop-types */
36
36
  uid, children, disabled, to, displayActive = exports.defaultProps.displayActive, vertical, style, onClick, icon, forceActive } = _a, rest = __rest(_a, ["uid", "children", "disabled", "to", "displayActive", "vertical", "style", "onClick", "icon", "forceActive"]);
37
37
  const appLayoutContext = (0, AppLayoutContext_1.useAppLayoutContext)();
38
+ const layoutIsVertical = !!appLayoutContext && (0, AppNative_1.getAppLayoutOrientation)(appLayoutContext.layout).includes("vertical");
38
39
  const navPanelContext = (0, react_1.useContext)(NavPanelNative_1.NavPanelContext);
40
+ const inDrawer = navPanelContext === null || navPanelContext === void 0 ? void 0 : navPanelContext.inDrawer;
39
41
  const { level } = (0, react_1.useContext)(NavGroupContext_1.NavGroupContext);
40
42
  let safeVertical = vertical;
41
- if (appLayoutContext && safeVertical === undefined) {
42
- safeVertical =
43
- (0, AppNative_1.getAppLayoutOrientation)(appLayoutContext.layout) === "vertical" || (navPanelContext === null || navPanelContext === void 0 ? void 0 : navPanelContext.inDrawer);
43
+ if (safeVertical === undefined) {
44
+ safeVertical = layoutIsVertical || inDrawer;
44
45
  }
45
46
  const smartTo = (0, react_1.useMemo)(() => {
46
47
  if (to) {
@@ -48,16 +49,16 @@ exports.NavLink = (0, react_1.forwardRef)(function NavLink(_a, ref) {
48
49
  }
49
50
  }, [to]);
50
51
  const styleObj = (0, react_1.useMemo)(() => {
51
- return Object.assign({ "--nav-link-level": level + 1 }, style);
52
- }, [level, style]);
52
+ return Object.assign({ "--nav-link-level": layoutIsVertical ? level + 1 : 0 }, style);
53
+ }, [level, style, layoutIsVertical]);
53
54
  const baseClasses = (0, classnames_1.default)(NavLink_module_scss_1.default.content, NavLink_module_scss_1.default.base, {
54
55
  [NavLink_module_scss_1.default.disabled]: disabled,
55
56
  [NavLink_module_scss_1.default.vertical]: safeVertical,
56
57
  [NavLink_module_scss_1.default.includeHoverIndicator]: displayActive,
57
58
  [NavLink_module_scss_1.default.navItemActive]: displayActive && forceActive,
58
59
  });
59
- let innerContent = (0, jsx_runtime_1.jsxs)("div", { className: NavLink_module_scss_1.default.innerContent, children: [icon, children] });
60
- let content;
60
+ let innerContent = ((0, jsx_runtime_1.jsxs)("div", { className: NavLink_module_scss_1.default.innerContent, children: [icon, children] }));
61
+ let content = null;
61
62
  if (disabled || !smartTo) {
62
63
  content = ((0, jsx_runtime_1.jsx)("button", Object.assign({}, rest, { ref: ref, onClick: onClick, className: baseClasses, style: styleObj, disabled: disabled, children: innerContent })));
63
64
  }
@@ -65,7 +66,7 @@ exports.NavLink = (0, react_1.forwardRef)(function NavLink(_a, ref) {
65
66
  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, {
66
67
  [NavLink_module_scss_1.default.displayActive]: displayActive,
67
68
  [NavLink_module_scss_1.default.navItemActive]: displayActive && (isActive || forceActive),
68
- 'xmlui-navlink-active': isActive || forceActive
69
+ "xmlui-navlink-active": isActive || forceActive,
69
70
  }), children: innerContent })));
70
71
  }
71
72
  return content;
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.navPanelRenderer = exports.NavPanelMd = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const NavPanel_module_scss_1 = __importDefault(require("./NavPanel.module.scss"));
9
- const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
10
9
  const renderers_1 = require("../../components-core/renderers");
11
10
  const themeVars_1 = require("../../components-core/theming/themeVars");
12
11
  const metadata_helpers_1 = require("../metadata-helpers");
13
12
  const NavPanelNative_1 = require("./NavPanelNative");
14
13
  const COMP = "NavPanel";
15
- exports.NavPanelMd = (0, ComponentDefs_1.createMetadata)({
14
+ exports.NavPanelMd = (0, metadata_helpers_1.createMetadata)({
16
15
  description: "`NavPanel` defines the navigation structure within an App, serving as a container " +
17
16
  "for NavLink and NavGroup components that create your application's primary " +
18
17
  "navigation menu. Its appearance and behavior automatically adapt based on the " +
@@ -40,6 +39,7 @@ exports.NavPanelMd = (0, ComponentDefs_1.createMetadata)({
40
39
  [`boxShadow-${COMP}-vertical`]: "4px 0 4px 0 rgb(0 0 0 / 10%)",
41
40
  },
42
41
  });
43
- exports.navPanelRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NavPanelMd, ({ node, renderChild, layoutCss, layoutContext }) => {
44
- return ((0, jsx_runtime_1.jsx)(NavPanelNative_1.NavPanel, { style: layoutCss, logoContent: renderChild(node.props.logoTemplate), className: layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.themeClassName, inDrawer: layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.inDrawer, renderChild: renderChild, children: renderChild(node.children) }));
42
+ exports.navPanelRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NavPanelMd, ({ node, renderChild, layoutCss, layoutContext, extractValue }) => {
43
+ const navLinks = (0, NavPanelNative_1.buildNavHierarchy)(node.children, extractValue, undefined, []);
44
+ return ((0, jsx_runtime_1.jsx)(NavPanelNative_1.NavPanel, { style: layoutCss, logoContent: renderChild(node.props.logoTemplate), className: layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.themeClassName, inDrawer: layoutContext === null || layoutContext === void 0 ? void 0 : layoutContext.inDrawer, renderChild: renderChild, navLinks: navLinks, children: renderChild(node.children) }));
45
45
  });
@@ -37,6 +37,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.NavPanel = exports.NavPanelContext = exports.defaultProps = void 0;
40
+ exports.buildNavHierarchy = buildNavHierarchy;
41
+ exports.buildLinkMap = buildLinkMap;
40
42
  const jsx_runtime_1 = require("react/jsx-runtime");
41
43
  const react_1 = __importStar(require("react"));
42
44
  const react_compose_refs_1 = require("@radix-ui/react-compose-refs");
@@ -46,6 +48,126 @@ const ScrollContext_1 = require("../../components-core/ScrollContext");
46
48
  const LogoNative_1 = require("../Logo/LogoNative");
47
49
  const AppLayoutContext_1 = require("../App/AppLayoutContext");
48
50
  const AppNative_1 = require("../App/AppNative");
51
+ // Function to build navigation hierarchy from component children
52
+ function buildNavHierarchy(children, extractValue, parent, pathSegments = []) {
53
+ if (!children)
54
+ return [];
55
+ const hierarchy = [];
56
+ // Skip non-object children
57
+ children.filter(child => child && typeof child === 'object').forEach((child) => {
58
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
59
+ if (child.type === "NavLink") {
60
+ const label = ((_a = extractValue.asOptionalString) === null || _a === void 0 ? void 0 : _a.call(extractValue, (_b = child.props) === null || _b === void 0 ? void 0 : _b.label)) || extractValue((_c = child.props) === null || _c === void 0 ? void 0 : _c.label);
61
+ const to = ((_d = extractValue.asOptionalString) === null || _d === void 0 ? void 0 : _d.call(extractValue, (_e = child.props) === null || _e === void 0 ? void 0 : _e.to)) || extractValue((_f = child.props) === null || _f === void 0 ? void 0 : _f.to);
62
+ // Handle case where label might not be in props but in children as text
63
+ let finalLabel = label;
64
+ if (!finalLabel && ((_g = child.children) === null || _g === void 0 ? void 0 : _g.length) === 1 && child.children[0].type === "TextNode") {
65
+ finalLabel = extractValue((_h = child.children[0].props) === null || _h === void 0 ? void 0 : _h.value);
66
+ }
67
+ // Only include NavLinks that have both label and to values
68
+ if (finalLabel && to) {
69
+ const node = {
70
+ type: "NavLink",
71
+ label: finalLabel,
72
+ to: to,
73
+ parent: parent,
74
+ pathSegments: [...pathSegments],
75
+ };
76
+ hierarchy.push(node);
77
+ }
78
+ }
79
+ else if (child.type === "NavGroup") {
80
+ const label = ((_j = extractValue.asOptionalString) === null || _j === void 0 ? void 0 : _j.call(extractValue, (_k = child.props) === null || _k === void 0 ? void 0 : _k.label)) || extractValue((_l = child.props) === null || _l === void 0 ? void 0 : _l.label);
81
+ // NavGroups only need a label, no "to" value required
82
+ if (label) {
83
+ const groupNode = {
84
+ type: "NavGroup",
85
+ label: label,
86
+ parent: parent,
87
+ pathSegments: [...pathSegments],
88
+ children: [],
89
+ };
90
+ // Build children with this groupNode as parent and updated path
91
+ const newPathSegments = [...pathSegments, groupNode];
92
+ groupNode.children = buildNavHierarchy(child.children, extractValue, groupNode, newPathSegments);
93
+ hierarchy.push(groupNode);
94
+ }
95
+ else if (child.children && child.children.length > 0) {
96
+ // If no label but has children, process them at the current level with same parent and path
97
+ hierarchy.push(...buildNavHierarchy(child.children, extractValue, parent, pathSegments));
98
+ }
99
+ }
100
+ else if (child.children && child.children.length > 0) {
101
+ // Process any children that might contain NavGroup and NavLink components recursively
102
+ const nestedNodes = buildNavHierarchy(child.children, extractValue, parent, pathSegments);
103
+ if (nestedNodes.length > 0) {
104
+ hierarchy.push(...nestedNodes);
105
+ }
106
+ }
107
+ });
108
+ // Set navigation properties after building the hierarchy
109
+ setNavigationProperties(hierarchy);
110
+ return hierarchy;
111
+ }
112
+ // Helper function to set navigation properties (prevLink, nextLink, firstLink, lastLink)
113
+ function setNavigationProperties(hierarchy) {
114
+ // Collect all NavLinks in traversal order
115
+ const allNavLinks = [];
116
+ function collectNavLinks(nodes) {
117
+ nodes.forEach((node) => {
118
+ if (node.type === "NavLink") {
119
+ allNavLinks.push(node);
120
+ }
121
+ if (node.children) {
122
+ collectNavLinks(node.children);
123
+ }
124
+ });
125
+ }
126
+ collectNavLinks(hierarchy);
127
+ // Set prevLink and nextLink for all NavLinks
128
+ allNavLinks.forEach((link, index) => {
129
+ if (index > 0) {
130
+ link.prevLink = allNavLinks[index - 1];
131
+ }
132
+ if (index < allNavLinks.length - 1) {
133
+ link.nextLink = allNavLinks[index + 1];
134
+ }
135
+ });
136
+ // Set firstLink and lastLink properties
137
+ function setFirstLastProperties(nodes) {
138
+ const navLinks = nodes.filter((node) => node.type === "NavLink");
139
+ if (navLinks.length > 0) {
140
+ navLinks[0].firstLink = true;
141
+ navLinks[navLinks.length - 1].lastLink = true;
142
+ }
143
+ // Recursively process children
144
+ nodes.forEach((node) => {
145
+ if (node.children) {
146
+ setFirstLastProperties(node.children);
147
+ }
148
+ });
149
+ }
150
+ setFirstLastProperties(hierarchy);
151
+ }
152
+ // Function to build a map of NavLinks by their "to" property
153
+ function buildLinkMap(navLinks) {
154
+ const linkMap = new Map();
155
+ if (!navLinks)
156
+ return linkMap;
157
+ function processNodes(nodes) {
158
+ nodes.forEach((node) => {
159
+ if (node.type === "NavLink" && node.to) {
160
+ // If multiple items use the same "to" value, the last wins
161
+ linkMap.set(node.to, node);
162
+ }
163
+ if (node.children) {
164
+ processNodes(node.children);
165
+ }
166
+ });
167
+ }
168
+ processNodes(navLinks);
169
+ return linkMap;
170
+ }
49
171
  // Default props for NavPanel component
50
172
  exports.defaultProps = {
51
173
  inDrawer: false,
@@ -54,11 +176,11 @@ exports.NavPanelContext = react_1.default.createContext(null);
54
176
  const contextValue = {
55
177
  inDrawer: true,
56
178
  };
57
- function DrawerNavPanel({ logoContent, children, className, style, }) {
179
+ function DrawerNavPanel({ logoContent, children, className, style, navLinks, }) {
58
180
  const scrollContainerRef = (0, react_1.useRef)(null);
59
181
  return ((0, jsx_runtime_1.jsx)(exports.NavPanelContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)("div", { ref: scrollContainerRef, className: (0, classnames_1.default)(NavPanel_module_scss_1.default.wrapper, className), style: style, children: (0, jsx_runtime_1.jsxs)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(NavPanel_module_scss_1.default.logoWrapper, NavPanel_module_scss_1.default.inDrawer), children: logoContent || (0, jsx_runtime_1.jsx)(LogoNative_1.Logo, {}) }), (0, jsx_runtime_1.jsx)("div", { className: NavPanel_module_scss_1.default.wrapperInner, style: style, children: children })] }) }) }));
60
182
  }
61
- exports.NavPanel = (0, react_1.forwardRef)(function NavPanel({ children, style, logoContent, className, inDrawer = exports.defaultProps.inDrawer, renderChild }, forwardedRef) {
183
+ exports.NavPanel = (0, react_1.forwardRef)(function NavPanel({ children, style, logoContent, className, inDrawer = exports.defaultProps.inDrawer, renderChild, navLinks, }, forwardedRef) {
62
184
  var _a, _b;
63
185
  const scrollContainerRef = (0, react_1.useRef)(null);
64
186
  const ref = forwardedRef ? (0, react_compose_refs_1.composeRefs)(scrollContainerRef, forwardedRef) : scrollContainerRef;
@@ -68,8 +190,15 @@ exports.NavPanel = (0, react_1.forwardRef)(function NavPanel({ children, style,
68
190
  const isCondensed = (_a = appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === null || _a === void 0 ? void 0 : _a.startsWith("condensed");
69
191
  const vertical = (_b = appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.layout) === null || _b === void 0 ? void 0 : _b.startsWith("vertical");
70
192
  const safeLogoContent = logoContent || renderChild(appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.logoContentDef);
193
+ // Register the linkMap when navLinks change
194
+ (0, react_1.useEffect)(() => {
195
+ if ((appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.registerLinkMap) && navLinks) {
196
+ const linkMap = buildLinkMap(navLinks);
197
+ appLayoutContext.registerLinkMap(linkMap);
198
+ }
199
+ }, [navLinks, appLayoutContext === null || appLayoutContext === void 0 ? void 0 : appLayoutContext.registerLinkMap]);
71
200
  if (inDrawer) {
72
- return ((0, jsx_runtime_1.jsx)(DrawerNavPanel, { style: style, logoContent: safeLogoContent, className: className, children: children }));
201
+ return ((0, jsx_runtime_1.jsx)(DrawerNavPanel, { style: style, logoContent: safeLogoContent, className: className, navLinks: navLinks, children: children }));
73
202
  }
74
203
  return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: (0, classnames_1.default)(NavPanel_module_scss_1.default.wrapper, className, {
75
204
  [NavPanel_module_scss_1.default.horizontal]: horizontal,
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.appWithCodeViewComponentRenderer = exports.AppWithCodeViewMd = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const AppWithCodeView_module_scss_1 = __importDefault(require("./AppWithCodeView.module.scss"));
9
- const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
10
9
  const renderers_1 = require("../../components-core/renderers");
11
10
  const themeVars_1 = require("../../components-core/theming/themeVars");
12
11
  const AppWithCodeViewNative_1 = require("./AppWithCodeViewNative");
13
12
  const defaultProps_1 = require("./defaultProps");
13
+ const metadata_helpers_1 = require("../metadata-helpers");
14
14
  const COMP = "AppWithCodeView";
15
- exports.AppWithCodeViewMd = (0, ComponentDefs_1.createMetadata)({
15
+ exports.AppWithCodeViewMd = (0, metadata_helpers_1.createMetadata)({
16
16
  status: "experimental",
17
17
  description: `The ${COMP} component displays a combination of markdown content and a nested xmlui app.
18
18
  It supports both side-by-side and stacked layouts.`,
@@ -21,7 +21,7 @@ It supports both side-by-side and stacked layouts.`,
21
21
  description: "The markdown content to be displayed alongside the app",
22
22
  valueType: "string",
23
23
  },
24
- sideBySide: {
24
+ splitView: {
25
25
  description: "Whether to render the markdown and app side by side or stacked vertically",
26
26
  valueType: "boolean",
27
27
  },
@@ -66,7 +66,26 @@ It supports both side-by-side and stacked layouts.`,
66
66
  themeVars: (0, themeVars_1.parseScssVar)(AppWithCodeView_module_scss_1.default.themeVars),
67
67
  defaultThemeVars: {},
68
68
  });
69
- exports.appWithCodeViewComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppWithCodeViewMd, ({ node, extractValue }) => {
69
+ exports.appWithCodeViewComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppWithCodeViewMd, ({ node, extractValue, renderChild }) => {
70
70
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
71
- return ((0, jsx_runtime_1.jsx)(AppWithCodeViewNative_1.AppWithCodeViewNative, { markdown: extractValue((_a = node.props) === null || _a === void 0 ? void 0 : _a.markdown), sideBySide: extractValue.asOptionalBoolean((_b = node.props) === null || _b === void 0 ? void 0 : _b.sideBySide), app: (_c = node.props) === null || _c === void 0 ? void 0 : _c.app, api: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.api), components: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.components), config: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.config), activeTheme: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.activeTheme), activeTone: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.activeTone), title: extractValue((_j = node.props) === null || _j === void 0 ? void 0 : _j.title), height: extractValue((_k = node.props) === null || _k === void 0 ? void 0 : _k.height), allowPlaygroundPopup: extractValue.asOptionalBoolean((_l = node.props) === null || _l === void 0 ? void 0 : _l.allowPlaygroundPopup), withFrame: extractValue.asOptionalBoolean((_m = node.props) === null || _m === void 0 ? void 0 : _m.withFrame) }));
71
+ let renderedChildren = "";
72
+ // 1. Static content prop fallback
73
+ if (!renderedChildren) {
74
+ renderedChildren = extractValue.asString(node.props.markdown);
75
+ }
76
+ // 2. "data" property fallback
77
+ if (!renderedChildren && typeof node.props.data === "string") {
78
+ renderedChildren = extractValue.asString(node.props.data);
79
+ }
80
+ // 3. Children fallback
81
+ if (!renderedChildren) {
82
+ ((_a = node.children) !== null && _a !== void 0 ? _a : []).forEach((child) => {
83
+ const renderedChild = renderChild(child);
84
+ console.log("renderedChild", renderedChild);
85
+ if (typeof renderedChild === "string") {
86
+ renderedChildren += renderedChild;
87
+ }
88
+ });
89
+ }
90
+ return ((0, jsx_runtime_1.jsx)(AppWithCodeViewNative_1.AppWithCodeViewNative, { markdown: renderedChildren, splitView: extractValue.asOptionalBoolean((_b = node.props) === null || _b === void 0 ? void 0 : _b.splitView), app: (_c = node.props) === null || _c === void 0 ? void 0 : _c.app, api: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.api), components: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.components), config: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.config), activeTheme: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.activeTheme), activeTone: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.activeTone), title: extractValue((_j = node.props) === null || _j === void 0 ? void 0 : _j.title), height: extractValue((_k = node.props) === null || _k === void 0 ? void 0 : _k.height), allowPlaygroundPopup: extractValue.asOptionalBoolean((_l = node.props) === null || _l === void 0 ? void 0 : _l.allowPlaygroundPopup), withFrame: extractValue.asOptionalBoolean((_m = node.props) === null || _m === void 0 ? void 0 : _m.withFrame) }));
72
91
  });
@@ -1,22 +1,79 @@
1
1
  "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
2
11
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
13
  };
5
14
  Object.defineProperty(exports, "__esModule", { value: true });
6
15
  exports.AppWithCodeViewNative = AppWithCodeViewNative;
7
16
  const jsx_runtime_1 = require("react/jsx-runtime");
8
- const AppWithCodeView_module_scss_1 = __importDefault(require("./AppWithCodeView.module.scss"));
9
- const classnames_1 = __importDefault(require("classnames"));
17
+ const react_1 = require("react");
10
18
  const NestedAppNative_1 = require("./NestedAppNative");
11
19
  const Markdown_1 = require("../Markdown/Markdown");
20
+ const ButtonNative_1 = require("../Button/ButtonNative");
21
+ const NestedApp_module_scss_1 = __importDefault(require("./NestedApp.module.scss"));
22
+ const Tooltip_1 = require("./Tooltip");
23
+ const rx_1 = require("react-icons/rx");
24
+ const lia_1 = require("react-icons/lia");
25
+ const utils_1 = require("./utils");
26
+ const AppContext_1 = require("../../components-core/AppContext");
27
+ const classnames_1 = __importDefault(require("classnames"));
28
+ const logo_svg_react_1 = __importDefault(require("./logo.svg?react"));
12
29
  /**
13
30
  * A component that displays markdown content on the left and a NestedApp on the right
14
31
  */
15
- function AppWithCodeViewNative({ markdown, sideBySide, app, api, components = [], config, activeTone, activeTheme, title, height, allowPlaygroundPopup, withFrame, }) {
16
- return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(AppWithCodeView_module_scss_1.default.container, {
17
- [AppWithCodeView_module_scss_1.default.horizontal]: sideBySide,
18
- [AppWithCodeView_module_scss_1.default.vertical]: !sideBySide,
19
- }), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)({ [AppWithCodeView_module_scss_1.default.column]: sideBySide }), children: (0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { children: markdown }) }), (0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)({ [AppWithCodeView_module_scss_1.default.column]: sideBySide }), children: (0, jsx_runtime_1.jsx)(NestedAppNative_1.NestedApp, { app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, title: title, height: height, allowPlaygroundPopup: allowPlaygroundPopup, withFrame: sideBySide ? false : withFrame }) })] }));
32
+ function AppWithCodeViewNative({ markdown, splitView, initiallyShowCode = false, popOutUrl, app, api, components = [], config, activeTone, activeTheme, title, height, allowPlaygroundPopup, }) {
33
+ const [showCode, setShowCode] = (0, react_1.useState)(initiallyShowCode);
34
+ const { appGlobals } = (0, AppContext_1.useAppContext)();
35
+ const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(0);
36
+ const useHashBasedRouting = (appGlobals === null || appGlobals === void 0 ? void 0 : appGlobals.useHashBasedRouting) || true;
37
+ const openPlayground = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
38
+ const data = {
39
+ standalone: {
40
+ app,
41
+ components,
42
+ config: {
43
+ name: title,
44
+ themes: [],
45
+ defaultTheme: activeTheme,
46
+ },
47
+ api: api,
48
+ },
49
+ options: {
50
+ fixedTheme: false,
51
+ swapped: false,
52
+ previewMode: false,
53
+ orientation: "horizontal",
54
+ activeTheme,
55
+ activeTone,
56
+ content: "app",
57
+ },
58
+ };
59
+ const appQueryString = yield (0, utils_1.createQueryString)(JSON.stringify(data));
60
+ window.open(useHashBasedRouting
61
+ ? `https://docs.xmlui.com/#/playground#${appQueryString}`
62
+ : `https://docs.xmlui.com/playground#${appQueryString}`, "_blank");
63
+ }), [app, components, title, activeTheme, api, activeTone, useHashBasedRouting]);
64
+ if (splitView) {
65
+ return ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, style: { height }, children: [(0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.wrapper, children: (0, jsx_runtime_1.jsx)(logo_svg_react_1.default, { className: NestedApp_module_scss_1.default.logo }) }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.viewControls, children: [(0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => setShowCode(true), variant: showCode ? "solid" : "ghost", className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewButton), style: {
66
+ backgroundColor: !showCode ? "transparent" : "",
67
+ }, children: "XML" }), (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { onClick: () => setShowCode(false), variant: showCode ? "ghost" : "solid", className: (0, classnames_1.default)(NestedApp_module_scss_1.default.splitViewButton), style: {
68
+ backgroundColor: showCode ? "transparent" : "",
69
+ }, children: "UI" })] }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.wrapper, children: [allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
70
+ openPlayground();
71
+ }, children: (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, {}) }), label: "View and edit in new full-width window" })), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
72
+ setShowCode(false);
73
+ setRefreshVersion(refreshVersion + 1);
74
+ }, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.contentContainer, children: [showCode && (0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { style: { height: "100%" }, children: markdown }), !showCode && ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { height: "100%", refVersion: refreshVersion, app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, title: title, allowPlaygroundPopup: allowPlaygroundPopup, withFrame: false, popOutUrl: popOutUrl }))] })] }));
75
+ }
76
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(Markdown_1.Markdown, { children: markdown }) }), (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { app: app, api: api, components: components, config: config, activeTone: activeTone, activeTheme: activeTheme, title: title, height: height, allowPlaygroundPopup: allowPlaygroundPopup, withFrame: true, popOutUrl: popOutUrl }) })] }));
20
77
  }
21
78
  /**
22
79
  * Export a named default for easier imports
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.nestedAppComponentRenderer = exports.NestedAppMd = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const NestedApp_module_scss_1 = __importDefault(require("./NestedApp.module.scss"));
9
- const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
10
9
  const renderers_1 = require("../../components-core/renderers");
11
10
  const themeVars_1 = require("../../components-core/theming/themeVars");
12
11
  const NestedAppNative_1 = require("./NestedAppNative");
13
12
  const defaultProps_1 = require("./defaultProps");
13
+ const metadata_helpers_1 = require("../metadata-helpers");
14
14
  const COMP = "NestedApp";
15
- exports.NestedAppMd = (0, ComponentDefs_1.createMetadata)({
15
+ exports.NestedAppMd = (0, metadata_helpers_1.createMetadata)({
16
16
  description: `The ${COMP} component allows you to nest an entire xmlui app into another one.
17
17
  `,
18
18
  props: {
@@ -58,17 +58,27 @@ exports.NestedAppMd = (0, ComponentDefs_1.createMetadata)({
58
58
  defaultThemeVars: {
59
59
  [`marginTop-${COMP}`]: "$space-3",
60
60
  [`marginBottom-${COMP}`]: "$space-3",
61
- [`padding-${COMP}`]: "$space-4",
62
- [`paddingTop-${COMP}`]: "$space-2",
63
- [`border-${COMP}`]: "1px solid $color-surface-100",
64
- [`borderRadius-${COMP}`]: "$space-4",
61
+ [`padding-${COMP}`]: "0",
62
+ [`paddingTop-${COMP}`]: "0",
63
+ [`border-${COMP}`]: "0.5px solid $borderColor",
64
+ [`borderRadius-${COMP}`]: "$space-2",
65
65
  [`backgroundColor-frame-${COMP}`]: "$color-primary-50",
66
- [`gap-frame-${COMP}`]: "$space-4",
66
+ [`gap-frame-${COMP}`]: "0",
67
67
  [`fontWeight-header-${COMP}`]: "$fontWeight-bold",
68
68
  [`boxShadow-${COMP}`]: "$boxShadow-md",
69
+ [`backgroundColor-viewControls-${COMP}`]: "$color-primary-100",
70
+ [`borderRadius-viewControls-${COMP}`]: "5px",
71
+ [`padding-viewControls-${COMP}`]: "$space-0_5",
72
+ [`borderBottom-header-${COMP}`]: "0.5px solid $borderColor",
73
+ // --- Split view styles
74
+ [`padding-button-splitView-${COMP}`]: "4px 6px",
75
+ [`width-button-splitView-${COMP}`]: "60px",
76
+ [`width-logo-splitView-${COMP}`]: "2rem",
77
+ [`height-logo-splitView-${COMP}`]: "2rem",
78
+ [`width-controls-${COMP}`]: "76px",
69
79
  },
70
80
  });
71
- exports.nestedAppComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NestedAppMd, ({ node, extractValue }) => {
81
+ exports.nestedAppComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.NestedAppMd, ({ node, extractValue, layoutCss }) => {
72
82
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
73
- return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { app: (_a = node.props) === null || _a === void 0 ? void 0 : _a.app, api: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.api), components: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.components), config: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.config), activeTheme: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.activeTheme), activeTone: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.activeTone), title: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.title), height: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.height), allowPlaygroundPopup: extractValue.asOptionalBoolean((_j = node.props) === null || _j === void 0 ? void 0 : _j.allowPlaygroundPopup), withFrame: extractValue.asOptionalBoolean((_k = node.props) === null || _k === void 0 ? void 0 : _k.withFrame) }));
83
+ return ((0, jsx_runtime_1.jsx)(NestedAppNative_1.IndexAwareNestedApp, { app: (_a = node.props) === null || _a === void 0 ? void 0 : _a.app, style: layoutCss, api: extractValue((_b = node.props) === null || _b === void 0 ? void 0 : _b.api), components: extractValue((_c = node.props) === null || _c === void 0 ? void 0 : _c.components), config: extractValue((_d = node.props) === null || _d === void 0 ? void 0 : _d.config), activeTheme: extractValue((_e = node.props) === null || _e === void 0 ? void 0 : _e.activeTheme), activeTone: extractValue((_f = node.props) === null || _f === void 0 ? void 0 : _f.activeTone), title: extractValue((_g = node.props) === null || _g === void 0 ? void 0 : _g.title), height: extractValue((_h = node.props) === null || _h === void 0 ? void 0 : _h.height), allowPlaygroundPopup: extractValue.asOptionalBoolean((_j = node.props) === null || _j === void 0 ? void 0 : _j.allowPlaygroundPopup), withFrame: extractValue.asOptionalBoolean((_k = node.props) === null || _k === void 0 ? void 0 : _k.withFrame) }));
74
84
  });
@@ -53,22 +53,25 @@ function IndexAwareNestedApp(props) {
53
53
  }
54
54
  return (0, jsx_runtime_1.jsx)(LazyNestedApp, Object.assign({}, props));
55
55
  }
56
- function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, title, height, allowPlaygroundPopup = defaultProps_1.defaultProps.allowPlaygroundPopup, withFrame = defaultProps_1.defaultProps.withFrame, }) {
56
+ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, activeTheme, activeTone, title, height, allowPlaygroundPopup = defaultProps_1.defaultProps.allowPlaygroundPopup, popOutUrl, withFrame = defaultProps_1.defaultProps.withFrame, style, refVersion = 0, }) {
57
57
  const rootRef = (0, react_1.useRef)(null);
58
58
  const shadowRef = (0, react_1.useRef)(null);
59
59
  const contentRootRef = (0, react_1.useRef)(null);
60
60
  const nestedAppId = (0, react_1.useId)();
61
- const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(0);
61
+ const [refreshVersion, setRefreshVersion] = (0, react_1.useState)(refVersion);
62
62
  const theme = (0, ThemeContext_1.useTheme)();
63
63
  const toneToApply = activeTone || (config === null || config === void 0 ? void 0 : config.defaultTone) || (theme === null || theme === void 0 ? void 0 : theme.activeThemeTone);
64
64
  const { appGlobals } = (0, AppContext_1.useAppContext)();
65
65
  const componentRegistry = (0, ComponentRegistryContext_1.useComponentRegistry)();
66
66
  const { interceptorWorker } = (0, useApiInterceptorContext_1.useApiInterceptorContext)();
67
+ (0, react_1.useEffect)(() => {
68
+ setRefreshVersion(refVersion);
69
+ }, [refVersion]);
67
70
  //TODO illesg: we should come up with something to make sure that nestedApps doesn't overwrite each other's mocked api endpoints
68
71
  // disabled for now, as it messes up the paths of not mocked APIs (e.g. resources/{staticJsonfiles})
69
72
  //const safeId = playgroundId || nestedAppId;
70
73
  //const apiUrl = api ? `/${safeId.replaceAll(":", "")}` : '';
71
- const apiUrl = '';
74
+ const apiUrl = "";
72
75
  const mock = (0, react_1.useMemo)(() => {
73
76
  if (!api) {
74
77
  return undefined;
@@ -85,7 +88,6 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
85
88
  }
86
89
  return Object.assign(Object.assign({}, apiObject), { type: "in-memory" });
87
90
  }, [api]);
88
- //console.log("mock", mock);
89
91
  const useHashBasedRouting = (appGlobals === null || appGlobals === void 0 ? void 0 : appGlobals.useHashBasedRouting) || true;
90
92
  const openPlayground = (0, react_1.useCallback)(() => __awaiter(this, void 0, void 0, function* () {
91
93
  const data = {
@@ -110,7 +112,9 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
110
112
  },
111
113
  };
112
114
  const appQueryString = yield (0, utils_1.createQueryString)(JSON.stringify(data));
113
- window.open(useHashBasedRouting ? `/#/playground#${appQueryString}` : `/playground#${appQueryString}`, "_blank");
115
+ window.open(useHashBasedRouting
116
+ ? `${popOutUrl !== null && popOutUrl !== void 0 ? popOutUrl : ""}/#/playground#${appQueryString}`
117
+ : `${popOutUrl !== null && popOutUrl !== void 0 ? popOutUrl : ""}/playground#${appQueryString}`, "_blank");
114
118
  }), [app, components, title, activeTheme, api, activeTone, useHashBasedRouting]);
115
119
  (0, react_1.useEffect)(() => {
116
120
  var _a;
@@ -149,13 +153,13 @@ function NestedApp({ api, app, components = constants_1.EMPTY_ARRAY, config, act
149
153
  Object.keys(theme.themeStyles).forEach((key) => {
150
154
  themeVarReset[key] = "initial";
151
155
  });
152
- let nestedAppRoot = ((0, jsx_runtime_1.jsx)(ApiInterceptorProvider_1.ApiInterceptorProvider, { interceptor: mock, apiWorker: interceptorWorker, children: (0, jsx_runtime_1.jsx)("div", { style: Object.assign({ height }, themeVarReset), children: (0, jsx_runtime_1.jsx)(AppRoot_1.AppRoot, { previewMode: true, standalone: true, trackContainerHeight: height ? "fixed" : "auto", node: component, globalProps: globalProps, defaultTheme: activeTheme || (config === null || config === void 0 ? void 0 : config.defaultTheme), defaultTone: toneToApply, contributes: {
156
+ let nestedAppRoot = ((0, jsx_runtime_1.jsx)(ApiInterceptorProvider_1.ApiInterceptorProvider, { interceptor: mock, apiWorker: interceptorWorker, children: (0, jsx_runtime_1.jsx)("div", { style: Object.assign(Object.assign({ height }, style), themeVarReset), children: (0, jsx_runtime_1.jsx)(AppRoot_1.AppRoot, { isNested: true, previewMode: true, standalone: true, trackContainerHeight: height ? "fixed" : "auto", node: component, globalProps: globalProps, defaultTheme: activeTheme || (config === null || config === void 0 ? void 0 : config.defaultTheme), defaultTone: toneToApply, contributes: {
153
157
  compoundComponents,
154
158
  themes: config === null || config === void 0 ? void 0 : config.themes,
155
159
  }, resources: config === null || config === void 0 ? void 0 : config.resources, extensionManager: componentRegistry.getExtensionManager() }, `app-${nestedAppId}-${refreshVersion}`) }) }));
156
160
  (_a = contentRootRef.current) === null || _a === void 0 ? void 0 : _a.render((0, jsx_runtime_1.jsx)(ErrorBoundary_1.ErrorBoundary, { node: component, children: withFrame ? ((0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.nestedAppContainer, children: [(0, jsx_runtime_1.jsxs)("div", { className: NestedApp_module_scss_1.default.header, children: [(0, jsx_runtime_1.jsx)("span", { className: NestedApp_module_scss_1.default.headerText, children: title }), (0, jsx_runtime_1.jsx)("div", { className: NestedApp_module_scss_1.default.spacer }), allowPlaygroundPopup && ((0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
157
161
  openPlayground();
158
- }, children: (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, {}) }), label: "Edit code in new window" })), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
162
+ }, children: (0, jsx_runtime_1.jsx)(rx_1.RxOpenInNewWindow, {}) }), label: "View and edit in new full-width window" })), (0, jsx_runtime_1.jsx)(Tooltip_1.Tooltip, { trigger: (0, jsx_runtime_1.jsx)("button", { className: NestedApp_module_scss_1.default.headerButton, onClick: () => {
159
163
  setRefreshVersion(refreshVersion + 1);
160
164
  }, children: (0, jsx_runtime_1.jsx)(lia_1.LiaUndoAltSolid, {}) }), label: "Reset the app" })] }), nestedAppRoot] })) : (nestedAppRoot) }));
161
165
  }, [
@@ -6,13 +6,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.noResultComponentRenderer = exports.NoResultMd = void 0;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const NoResult_module_scss_1 = __importDefault(require("./NoResult.module.scss"));
9
- const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
10
9
  const renderers_1 = require("../../components-core/renderers");
11
10
  const themeVars_1 = require("../../components-core/theming/themeVars");
12
11
  const metadata_helpers_1 = require("../metadata-helpers");
13
12
  const NoResultNative_1 = require("./NoResultNative");
14
13
  const COMP = "NoResult";
15
- exports.NoResultMd = (0, ComponentDefs_1.createMetadata)({
14
+ exports.NoResultMd = (0, metadata_helpers_1.createMetadata)({
16
15
  description: "`NoResult` displays a visual indication that a query or search returned nothing.",
17
16
  props: {
18
17
  label: (0, metadata_helpers_1.dLabel)(),