@cratis/scene.blueprint.default 0.1.0

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 (558) hide show
  1. package/.storybook/main.ts +32 -0
  2. package/.storybook/preview.ts +20 -0
  3. package/ComponentName.ts +60 -0
  4. package/README.md +204 -0
  5. package/configuration/ColorScheme.ts +17 -0
  6. package/configuration/LayoutConfigProvider.tsx +182 -0
  7. package/configuration/LayoutConfigState.ts +46 -0
  8. package/configuration/LayoutMode.ts +50 -0
  9. package/configuration/MenuTheme.ts +24 -0
  10. package/configuration/index.ts +11 -0
  11. package/configuration/layoutConfigStorage.ts +102 -0
  12. package/configuration/layoutConfigTransitions.ts +150 -0
  13. package/configuration/layoutWrapperClasses.ts +68 -0
  14. package/defaultBlueprint.ts +66 -0
  15. package/defaultBlueprintComponents.ts +51 -0
  16. package/dist/cjs/ComponentName.js +33 -0
  17. package/dist/cjs/ComponentName.js.map +1 -0
  18. package/dist/cjs/configuration/ColorScheme.js +23 -0
  19. package/dist/cjs/configuration/ColorScheme.js.map +1 -0
  20. package/dist/cjs/configuration/LayoutConfigProvider.js +96 -0
  21. package/dist/cjs/configuration/LayoutConfigProvider.js.map +1 -0
  22. package/dist/cjs/configuration/LayoutMode.js +38 -0
  23. package/dist/cjs/configuration/LayoutMode.js.map +1 -0
  24. package/dist/cjs/configuration/MenuTheme.js +26 -0
  25. package/dist/cjs/configuration/MenuTheme.js.map +1 -0
  26. package/dist/cjs/configuration/layoutConfigStorage.js +85 -0
  27. package/dist/cjs/configuration/layoutConfigStorage.js.map +1 -0
  28. package/dist/cjs/configuration/layoutConfigTransitions.js +158 -0
  29. package/dist/cjs/configuration/layoutConfigTransitions.js.map +1 -0
  30. package/dist/cjs/configuration/layoutWrapperClasses.js +62 -0
  31. package/dist/cjs/configuration/layoutWrapperClasses.js.map +1 -0
  32. package/dist/cjs/defaultBlueprint.js +92 -0
  33. package/dist/cjs/defaultBlueprint.js.map +1 -0
  34. package/dist/cjs/defaultBlueprintComponents.js +54 -0
  35. package/dist/cjs/defaultBlueprintComponents.js.map +1 -0
  36. package/dist/cjs/gallery/GalleryScreenPreview.js +63 -0
  37. package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -0
  38. package/dist/cjs/gallery/TemplateSlotName.js +25 -0
  39. package/dist/cjs/gallery/TemplateSlotName.js.map +1 -0
  40. package/dist/cjs/gallery/applicationChrome.js +134 -0
  41. package/dist/cjs/gallery/applicationChrome.js.map +1 -0
  42. package/dist/cjs/gallery/authTemplates.js +234 -0
  43. package/dist/cjs/gallery/authTemplates.js.map +1 -0
  44. package/dist/cjs/gallery/componentNames.js +53 -0
  45. package/dist/cjs/gallery/componentNames.js.map +1 -0
  46. package/dist/cjs/gallery/composeScreen.js +99 -0
  47. package/dist/cjs/gallery/composeScreen.js.map +1 -0
  48. package/dist/cjs/gallery/dependencyComponentNames.js +72 -0
  49. package/dist/cjs/gallery/dependencyComponentNames.js.map +1 -0
  50. package/dist/cjs/gallery/dialogTemplates.js +161 -0
  51. package/dist/cjs/gallery/dialogTemplates.js.map +1 -0
  52. package/dist/cjs/gallery/elements.js +80 -0
  53. package/dist/cjs/gallery/elements.js.map +1 -0
  54. package/dist/cjs/gallery/navigation.js +129 -0
  55. package/dist/cjs/gallery/navigation.js.map +1 -0
  56. package/dist/cjs/gallery/nesting.js +129 -0
  57. package/dist/cjs/gallery/nesting.js.map +1 -0
  58. package/dist/cjs/gallery/previewProfile.js +68 -0
  59. package/dist/cjs/gallery/previewProfile.js.map +1 -0
  60. package/dist/cjs/gallery/resolveElementNames.js +63 -0
  61. package/dist/cjs/gallery/resolveElementNames.js.map +1 -0
  62. package/dist/cjs/gallery/screens.js +222 -0
  63. package/dist/cjs/gallery/screens.js.map +1 -0
  64. package/dist/cjs/gallery/statusTemplates.js +190 -0
  65. package/dist/cjs/gallery/statusTemplates.js.map +1 -0
  66. package/dist/cjs/gallery/supportTemplates.js +319 -0
  67. package/dist/cjs/gallery/supportTemplates.js.map +1 -0
  68. package/dist/cjs/gallery/widgets.js +94 -0
  69. package/dist/cjs/gallery/widgets.js.map +1 -0
  70. package/dist/cjs/gallery/workspaceTemplates.js +395 -0
  71. package/dist/cjs/gallery/workspaceTemplates.js.map +1 -0
  72. package/dist/cjs/index.js +220 -0
  73. package/dist/cjs/index.js.map +1 -0
  74. package/dist/cjs/layouts/LayoutName.js +19 -0
  75. package/dist/cjs/layouts/LayoutName.js.map +1 -0
  76. package/dist/cjs/layouts/SlotName.js +31 -0
  77. package/dist/cjs/layouts/SlotName.js.map +1 -0
  78. package/dist/cjs/layouts/appShell.js +160 -0
  79. package/dist/cjs/layouts/appShell.js.map +1 -0
  80. package/dist/cjs/layouts/defaultLayouts.js +20 -0
  81. package/dist/cjs/layouts/defaultLayouts.js.map +1 -0
  82. package/dist/cjs/layouts/flowBuilders.js +66 -0
  83. package/dist/cjs/layouts/flowBuilders.js.map +1 -0
  84. package/dist/cjs/layouts/fullPage.js +78 -0
  85. package/dist/cjs/layouts/fullPage.js.map +1 -0
  86. package/dist/cjs/layouts/shellComponents.js +29 -0
  87. package/dist/cjs/layouts/shellComponents.js.map +1 -0
  88. package/dist/cjs/package.json +3 -0
  89. package/dist/cjs/packageName.js +15 -0
  90. package/dist/cjs/packageName.js.map +1 -0
  91. package/dist/cjs/shell/AppShell.js +88 -0
  92. package/dist/cjs/shell/AppShell.js.map +1 -0
  93. package/dist/cjs/shell/Breadcrumb.js +33 -0
  94. package/dist/cjs/shell/Breadcrumb.js.map +1 -0
  95. package/dist/cjs/shell/ConfigPanel.js +128 -0
  96. package/dist/cjs/shell/ConfigPanel.js.map +1 -0
  97. package/dist/cjs/shell/Footer.js +28 -0
  98. package/dist/cjs/shell/Footer.js.map +1 -0
  99. package/dist/cjs/shell/FullPageShell.js +53 -0
  100. package/dist/cjs/shell/FullPageShell.js.map +1 -0
  101. package/dist/cjs/shell/LayoutModeSwitcher.js +58 -0
  102. package/dist/cjs/shell/LayoutModeSwitcher.js.map +1 -0
  103. package/dist/cjs/shell/Logo.js +44 -0
  104. package/dist/cjs/shell/Logo.js.map +1 -0
  105. package/dist/cjs/shell/Mask.js +34 -0
  106. package/dist/cjs/shell/Mask.js.map +1 -0
  107. package/dist/cjs/shell/Menu.js +36 -0
  108. package/dist/cjs/shell/Menu.js.map +1 -0
  109. package/dist/cjs/shell/MenuItem.js +65 -0
  110. package/dist/cjs/shell/MenuItem.js.map +1 -0
  111. package/dist/cjs/shell/PageHeader.js +43 -0
  112. package/dist/cjs/shell/PageHeader.js.map +1 -0
  113. package/dist/cjs/shell/RightPanel.js +30 -0
  114. package/dist/cjs/shell/RightPanel.js.map +1 -0
  115. package/dist/cjs/shell/Sidebar.js +51 -0
  116. package/dist/cjs/shell/Sidebar.js.map +1 -0
  117. package/dist/cjs/shell/ThemeOption.js +42 -0
  118. package/dist/cjs/shell/ThemeOption.js.map +1 -0
  119. package/dist/cjs/shell/ThemeSwitcher.js +50 -0
  120. package/dist/cjs/shell/ThemeSwitcher.js.map +1 -0
  121. package/dist/cjs/shell/Topbar.js +54 -0
  122. package/dist/cjs/shell/Topbar.js.map +1 -0
  123. package/dist/cjs/shell/UserMenu.js +68 -0
  124. package/dist/cjs/shell/UserMenu.js.map +1 -0
  125. package/dist/cjs/shell/elementProperties.js +56 -0
  126. package/dist/cjs/shell/elementProperties.js.map +1 -0
  127. package/dist/cjs/themes/LayoutThemeProvider.js +33 -0
  128. package/dist/cjs/themes/LayoutThemeProvider.js.map +1 -0
  129. package/dist/cjs/themes/blueprintThemeCompatibility.js +28 -0
  130. package/dist/cjs/themes/blueprintThemeCompatibility.js.map +1 -0
  131. package/dist/cjs/themes/dark.js +40 -0
  132. package/dist/cjs/themes/dark.js.map +1 -0
  133. package/dist/cjs/themes/defaultBlueprintThemes.js +19 -0
  134. package/dist/cjs/themes/defaultBlueprintThemes.js.map +1 -0
  135. package/dist/cjs/themes/light.js +43 -0
  136. package/dist/cjs/themes/light.js.map +1 -0
  137. package/dist/esm/ComponentName.d.ts +19 -0
  138. package/dist/esm/ComponentName.d.ts.map +1 -0
  139. package/dist/esm/ComponentName.js +31 -0
  140. package/dist/esm/ComponentName.js.map +1 -0
  141. package/dist/esm/configuration/ColorScheme.d.ts +6 -0
  142. package/dist/esm/configuration/ColorScheme.d.ts.map +1 -0
  143. package/dist/esm/configuration/ColorScheme.js +20 -0
  144. package/dist/esm/configuration/ColorScheme.js.map +1 -0
  145. package/dist/esm/configuration/LayoutConfigProvider.d.ts +29 -0
  146. package/dist/esm/configuration/LayoutConfigProvider.d.ts.map +1 -0
  147. package/dist/esm/configuration/LayoutConfigProvider.js +92 -0
  148. package/dist/esm/configuration/LayoutConfigProvider.js.map +1 -0
  149. package/dist/esm/configuration/LayoutConfigState.d.ts +14 -0
  150. package/dist/esm/configuration/LayoutConfigState.d.ts.map +1 -0
  151. package/dist/esm/configuration/LayoutConfigState.js +2 -0
  152. package/dist/esm/configuration/LayoutConfigState.js.map +1 -0
  153. package/dist/esm/configuration/LayoutMode.d.ts +12 -0
  154. package/dist/esm/configuration/LayoutMode.d.ts.map +1 -0
  155. package/dist/esm/configuration/LayoutMode.js +35 -0
  156. package/dist/esm/configuration/LayoutMode.js.map +1 -0
  157. package/dist/esm/configuration/MenuTheme.d.ts +7 -0
  158. package/dist/esm/configuration/MenuTheme.d.ts.map +1 -0
  159. package/dist/esm/configuration/MenuTheme.js +23 -0
  160. package/dist/esm/configuration/MenuTheme.js.map +1 -0
  161. package/dist/esm/configuration/index.d.ts +9 -0
  162. package/dist/esm/configuration/index.d.ts.map +1 -0
  163. package/dist/esm/configuration/index.js +9 -0
  164. package/dist/esm/configuration/index.js.map +1 -0
  165. package/dist/esm/configuration/layoutConfigStorage.d.ts +6 -0
  166. package/dist/esm/configuration/layoutConfigStorage.d.ts.map +1 -0
  167. package/dist/esm/configuration/layoutConfigStorage.js +81 -0
  168. package/dist/esm/configuration/layoutConfigStorage.js.map +1 -0
  169. package/dist/esm/configuration/layoutConfigTransitions.d.ts +22 -0
  170. package/dist/esm/configuration/layoutConfigTransitions.d.ts.map +1 -0
  171. package/dist/esm/configuration/layoutConfigTransitions.js +140 -0
  172. package/dist/esm/configuration/layoutConfigTransitions.js.map +1 -0
  173. package/dist/esm/configuration/layoutWrapperClasses.d.ts +4 -0
  174. package/dist/esm/configuration/layoutWrapperClasses.d.ts.map +1 -0
  175. package/dist/esm/configuration/layoutWrapperClasses.js +59 -0
  176. package/dist/esm/configuration/layoutWrapperClasses.js.map +1 -0
  177. package/dist/esm/defaultBlueprint.d.ts +5 -0
  178. package/dist/esm/defaultBlueprint.d.ts.map +1 -0
  179. package/dist/esm/defaultBlueprint.js +89 -0
  180. package/dist/esm/defaultBlueprint.js.map +1 -0
  181. package/dist/esm/defaultBlueprintComponents.d.ts +3 -0
  182. package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -0
  183. package/dist/esm/defaultBlueprintComponents.js +52 -0
  184. package/dist/esm/defaultBlueprintComponents.js.map +1 -0
  185. package/dist/esm/for_AppShell/when_rendering_a_gallery_screen.d.ts +2 -0
  186. package/dist/esm/for_AppShell/when_rendering_a_gallery_screen.d.ts.map +1 -0
  187. package/dist/esm/for_AppShell/when_rendering_a_gallery_screen.js +60 -0
  188. package/dist/esm/for_AppShell/when_rendering_a_gallery_screen.js.map +1 -0
  189. package/dist/esm/for_LayoutConfigProvider/when_switching_mode_and_reloading.d.ts +2 -0
  190. package/dist/esm/for_LayoutConfigProvider/when_switching_mode_and_reloading.d.ts.map +1 -0
  191. package/dist/esm/for_LayoutConfigProvider/when_switching_mode_and_reloading.js +60 -0
  192. package/dist/esm/for_LayoutConfigProvider/when_switching_mode_and_reloading.js.map +1 -0
  193. package/dist/esm/for_appShellLayout/when_evaluating_the_arrangement_at_each_size_class.d.ts +2 -0
  194. package/dist/esm/for_appShellLayout/when_evaluating_the_arrangement_at_each_size_class.d.ts.map +1 -0
  195. package/dist/esm/for_appShellLayout/when_evaluating_the_arrangement_at_each_size_class.js +26 -0
  196. package/dist/esm/for_appShellLayout/when_evaluating_the_arrangement_at_each_size_class.js.map +1 -0
  197. package/dist/esm/for_defaultBlueprint/when_validating_the_bundle.d.ts +2 -0
  198. package/dist/esm/for_defaultBlueprint/when_validating_the_bundle.d.ts.map +1 -0
  199. package/dist/esm/for_defaultBlueprint/when_validating_the_bundle.js +32 -0
  200. package/dist/esm/for_defaultBlueprint/when_validating_the_bundle.js.map +1 -0
  201. package/dist/esm/for_defaultBlueprintThemes/when_checking_attribution_and_tokens.d.ts +2 -0
  202. package/dist/esm/for_defaultBlueprintThemes/when_checking_attribution_and_tokens.d.ts.map +1 -0
  203. package/dist/esm/for_defaultBlueprintThemes/when_checking_attribution_and_tokens.js +40 -0
  204. package/dist/esm/for_defaultBlueprintThemes/when_checking_attribution_and_tokens.js.map +1 -0
  205. package/dist/esm/for_fullPageLayout/when_evaluating_the_arrangement_at_each_size_class.d.ts +2 -0
  206. package/dist/esm/for_fullPageLayout/when_evaluating_the_arrangement_at_each_size_class.d.ts.map +1 -0
  207. package/dist/esm/for_fullPageLayout/when_evaluating_the_arrangement_at_each_size_class.js +27 -0
  208. package/dist/esm/for_fullPageLayout/when_evaluating_the_arrangement_at_each_size_class.js.map +1 -0
  209. package/dist/esm/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts +2 -0
  210. package/dist/esm/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts.map +1 -0
  211. package/dist/esm/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js +41 -0
  212. package/dist/esm/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js.map +1 -0
  213. package/dist/esm/for_galleryScreenTemplates/when_following_the_nesting_chain.d.ts +2 -0
  214. package/dist/esm/for_galleryScreenTemplates/when_following_the_nesting_chain.d.ts.map +1 -0
  215. package/dist/esm/for_galleryScreenTemplates/when_following_the_nesting_chain.js +31 -0
  216. package/dist/esm/for_galleryScreenTemplates/when_following_the_nesting_chain.js.map +1 -0
  217. package/dist/esm/for_galleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts +2 -0
  218. package/dist/esm/for_galleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts.map +1 -0
  219. package/dist/esm/for_galleryScreens/when_checking_the_layouts_and_slots_they_fill.js +33 -0
  220. package/dist/esm/for_galleryScreens/when_checking_the_layouts_and_slots_they_fill.js.map +1 -0
  221. package/dist/esm/for_galleryScreens/when_resolving_the_component_names_they_reference.d.ts +2 -0
  222. package/dist/esm/for_galleryScreens/when_resolving_the_component_names_they_reference.d.ts.map +1 -0
  223. package/dist/esm/for_galleryScreens/when_resolving_the_component_names_they_reference.js +44 -0
  224. package/dist/esm/for_galleryScreens/when_resolving_the_component_names_they_reference.js.map +1 -0
  225. package/dist/esm/for_layoutConfigStorage/when_restoring_a_persisted_configuration.d.ts +2 -0
  226. package/dist/esm/for_layoutConfigStorage/when_restoring_a_persisted_configuration.d.ts.map +1 -0
  227. package/dist/esm/for_layoutConfigStorage/when_restoring_a_persisted_configuration.js +60 -0
  228. package/dist/esm/for_layoutConfigStorage/when_restoring_a_persisted_configuration.js.map +1 -0
  229. package/dist/esm/for_layoutConfigTransitions/when_anchoring_a_reveal_sidebar.d.ts +2 -0
  230. package/dist/esm/for_layoutConfigTransitions/when_anchoring_a_reveal_sidebar.d.ts.map +1 -0
  231. package/dist/esm/for_layoutConfigTransitions/when_anchoring_a_reveal_sidebar.js +28 -0
  232. package/dist/esm/for_layoutConfigTransitions/when_anchoring_a_reveal_sidebar.js.map +1 -0
  233. package/dist/esm/for_layoutConfigTransitions/when_the_viewport_crosses_the_mobile_breakpoint.d.ts +2 -0
  234. package/dist/esm/for_layoutConfigTransitions/when_the_viewport_crosses_the_mobile_breakpoint.d.ts.map +1 -0
  235. package/dist/esm/for_layoutConfigTransitions/when_the_viewport_crosses_the_mobile_breakpoint.js +38 -0
  236. package/dist/esm/for_layoutConfigTransitions/when_the_viewport_crosses_the_mobile_breakpoint.js.map +1 -0
  237. package/dist/esm/for_layoutWrapperClasses/when_rendering_each_mode.d.ts +2 -0
  238. package/dist/esm/for_layoutWrapperClasses/when_rendering_each_mode.d.ts.map +1 -0
  239. package/dist/esm/for_layoutWrapperClasses/when_rendering_each_mode.js +39 -0
  240. package/dist/esm/for_layoutWrapperClasses/when_rendering_each_mode.js.map +1 -0
  241. package/dist/esm/for_navigation/when_aggregating_the_navigation_contributions.d.ts +2 -0
  242. package/dist/esm/for_navigation/when_aggregating_the_navigation_contributions.d.ts.map +1 -0
  243. package/dist/esm/for_navigation/when_aggregating_the_navigation_contributions.js +37 -0
  244. package/dist/esm/for_navigation/when_aggregating_the_navigation_contributions.js.map +1 -0
  245. package/dist/esm/gallery/ApplicationScreens.stories.d.ts +31 -0
  246. package/dist/esm/gallery/ApplicationScreens.stories.d.ts.map +1 -0
  247. package/dist/esm/gallery/ApplicationScreens.stories.js +29 -0
  248. package/dist/esm/gallery/ApplicationScreens.stories.js.map +1 -0
  249. package/dist/esm/gallery/FullPageScreens.stories.d.ts +28 -0
  250. package/dist/esm/gallery/FullPageScreens.stories.d.ts.map +1 -0
  251. package/dist/esm/gallery/FullPageScreens.stories.js +26 -0
  252. package/dist/esm/gallery/FullPageScreens.stories.js.map +1 -0
  253. package/dist/esm/gallery/GalleryScreenPreview.d.ts +12 -0
  254. package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -0
  255. package/dist/esm/gallery/GalleryScreenPreview.js +60 -0
  256. package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -0
  257. package/dist/esm/gallery/NavigationEntry.d.ts +8 -0
  258. package/dist/esm/gallery/NavigationEntry.d.ts.map +1 -0
  259. package/dist/esm/gallery/NavigationEntry.js +2 -0
  260. package/dist/esm/gallery/NavigationEntry.js.map +1 -0
  261. package/dist/esm/gallery/TemplateSlotName.d.ts +11 -0
  262. package/dist/esm/gallery/TemplateSlotName.d.ts.map +1 -0
  263. package/dist/esm/gallery/TemplateSlotName.js +23 -0
  264. package/dist/esm/gallery/TemplateSlotName.js.map +1 -0
  265. package/dist/esm/gallery/applicationChrome.d.ts +8 -0
  266. package/dist/esm/gallery/applicationChrome.d.ts.map +1 -0
  267. package/dist/esm/gallery/applicationChrome.js +131 -0
  268. package/dist/esm/gallery/applicationChrome.js.map +1 -0
  269. package/dist/esm/gallery/authTemplates.d.ts +9 -0
  270. package/dist/esm/gallery/authTemplates.d.ts.map +1 -0
  271. package/dist/esm/gallery/authTemplates.js +226 -0
  272. package/dist/esm/gallery/authTemplates.js.map +1 -0
  273. package/dist/esm/gallery/componentNames.d.ts +4 -0
  274. package/dist/esm/gallery/componentNames.d.ts.map +1 -0
  275. package/dist/esm/gallery/componentNames.js +50 -0
  276. package/dist/esm/gallery/componentNames.js.map +1 -0
  277. package/dist/esm/gallery/composeScreen.d.ts +5 -0
  278. package/dist/esm/gallery/composeScreen.d.ts.map +1 -0
  279. package/dist/esm/gallery/composeScreen.js +95 -0
  280. package/dist/esm/gallery/composeScreen.js.map +1 -0
  281. package/dist/esm/gallery/dependencyComponentNames.d.ts +4 -0
  282. package/dist/esm/gallery/dependencyComponentNames.d.ts.map +1 -0
  283. package/dist/esm/gallery/dependencyComponentNames.js +68 -0
  284. package/dist/esm/gallery/dependencyComponentNames.js.map +1 -0
  285. package/dist/esm/gallery/dialogTemplates.d.ts +6 -0
  286. package/dist/esm/gallery/dialogTemplates.d.ts.map +1 -0
  287. package/dist/esm/gallery/dialogTemplates.js +156 -0
  288. package/dist/esm/gallery/dialogTemplates.js.map +1 -0
  289. package/dist/esm/gallery/elements.d.ts +7 -0
  290. package/dist/esm/gallery/elements.d.ts.map +1 -0
  291. package/dist/esm/gallery/elements.js +74 -0
  292. package/dist/esm/gallery/elements.js.map +1 -0
  293. package/dist/esm/gallery/index.d.ts +20 -0
  294. package/dist/esm/gallery/index.d.ts.map +1 -0
  295. package/dist/esm/gallery/index.js +20 -0
  296. package/dist/esm/gallery/index.js.map +1 -0
  297. package/dist/esm/gallery/navigation.d.ts +9 -0
  298. package/dist/esm/gallery/navigation.d.ts.map +1 -0
  299. package/dist/esm/gallery/navigation.js +122 -0
  300. package/dist/esm/gallery/navigation.js.map +1 -0
  301. package/dist/esm/gallery/nesting.d.ts +6 -0
  302. package/dist/esm/gallery/nesting.d.ts.map +1 -0
  303. package/dist/esm/gallery/nesting.js +124 -0
  304. package/dist/esm/gallery/nesting.js.map +1 -0
  305. package/dist/esm/gallery/previewProfile.d.ts +6 -0
  306. package/dist/esm/gallery/previewProfile.d.ts.map +1 -0
  307. package/dist/esm/gallery/previewProfile.js +64 -0
  308. package/dist/esm/gallery/previewProfile.js.map +1 -0
  309. package/dist/esm/gallery/resolveElementNames.d.ts +4 -0
  310. package/dist/esm/gallery/resolveElementNames.d.ts.map +1 -0
  311. package/dist/esm/gallery/resolveElementNames.js +61 -0
  312. package/dist/esm/gallery/resolveElementNames.js.map +1 -0
  313. package/dist/esm/gallery/screens.d.ts +5 -0
  314. package/dist/esm/gallery/screens.d.ts.map +1 -0
  315. package/dist/esm/gallery/screens.js +218 -0
  316. package/dist/esm/gallery/screens.js.map +1 -0
  317. package/dist/esm/gallery/statusTemplates.d.ts +7 -0
  318. package/dist/esm/gallery/statusTemplates.d.ts.map +1 -0
  319. package/dist/esm/gallery/statusTemplates.js +184 -0
  320. package/dist/esm/gallery/statusTemplates.js.map +1 -0
  321. package/dist/esm/gallery/supportTemplates.d.ts +8 -0
  322. package/dist/esm/gallery/supportTemplates.d.ts.map +1 -0
  323. package/dist/esm/gallery/supportTemplates.js +312 -0
  324. package/dist/esm/gallery/supportTemplates.js.map +1 -0
  325. package/dist/esm/gallery/widgets.d.ts +12 -0
  326. package/dist/esm/gallery/widgets.d.ts.map +1 -0
  327. package/dist/esm/gallery/widgets.js +86 -0
  328. package/dist/esm/gallery/widgets.js.map +1 -0
  329. package/dist/esm/gallery/workspaceTemplates.d.ts +8 -0
  330. package/dist/esm/gallery/workspaceTemplates.d.ts.map +1 -0
  331. package/dist/esm/gallery/workspaceTemplates.js +388 -0
  332. package/dist/esm/gallery/workspaceTemplates.js.map +1 -0
  333. package/dist/esm/index.d.ts +10 -0
  334. package/dist/esm/index.d.ts.map +1 -0
  335. package/dist/esm/index.js +60 -0
  336. package/dist/esm/index.js.map +1 -0
  337. package/dist/esm/layouts/LayoutName.d.ts +5 -0
  338. package/dist/esm/layouts/LayoutName.d.ts.map +1 -0
  339. package/dist/esm/layouts/LayoutName.js +17 -0
  340. package/dist/esm/layouts/LayoutName.js.map +1 -0
  341. package/dist/esm/layouts/SlotName.d.ts +12 -0
  342. package/dist/esm/layouts/SlotName.d.ts.map +1 -0
  343. package/dist/esm/layouts/SlotName.js +29 -0
  344. package/dist/esm/layouts/SlotName.js.map +1 -0
  345. package/dist/esm/layouts/appShell.d.ts +8 -0
  346. package/dist/esm/layouts/appShell.d.ts.map +1 -0
  347. package/dist/esm/layouts/appShell.js +153 -0
  348. package/dist/esm/layouts/appShell.js.map +1 -0
  349. package/dist/esm/layouts/defaultLayouts.d.ts +3 -0
  350. package/dist/esm/layouts/defaultLayouts.d.ts.map +1 -0
  351. package/dist/esm/layouts/defaultLayouts.js +18 -0
  352. package/dist/esm/layouts/defaultLayouts.js.map +1 -0
  353. package/dist/esm/layouts/flowBuilders.d.ts +6 -0
  354. package/dist/esm/layouts/flowBuilders.d.ts.map +1 -0
  355. package/dist/esm/layouts/flowBuilders.js +61 -0
  356. package/dist/esm/layouts/flowBuilders.js.map +1 -0
  357. package/dist/esm/layouts/fullPage.d.ts +6 -0
  358. package/dist/esm/layouts/fullPage.d.ts.map +1 -0
  359. package/dist/esm/layouts/fullPage.js +73 -0
  360. package/dist/esm/layouts/fullPage.js.map +1 -0
  361. package/dist/esm/layouts/index.d.ts +8 -0
  362. package/dist/esm/layouts/index.d.ts.map +1 -0
  363. package/dist/esm/layouts/index.js +8 -0
  364. package/dist/esm/layouts/index.js.map +1 -0
  365. package/dist/esm/layouts/shellComponents.d.ts +3 -0
  366. package/dist/esm/layouts/shellComponents.d.ts.map +1 -0
  367. package/dist/esm/layouts/shellComponents.js +27 -0
  368. package/dist/esm/layouts/shellComponents.js.map +1 -0
  369. package/dist/esm/package.json +3 -0
  370. package/dist/esm/packageName.d.ts +2 -0
  371. package/dist/esm/packageName.d.ts.map +1 -0
  372. package/dist/esm/packageName.js +13 -0
  373. package/dist/esm/packageName.js.map +1 -0
  374. package/dist/esm/shell/AppShell.d.ts +3 -0
  375. package/dist/esm/shell/AppShell.d.ts.map +1 -0
  376. package/dist/esm/shell/AppShell.js +86 -0
  377. package/dist/esm/shell/AppShell.js.map +1 -0
  378. package/dist/esm/shell/Breadcrumb.d.ts +3 -0
  379. package/dist/esm/shell/Breadcrumb.d.ts.map +1 -0
  380. package/dist/esm/shell/Breadcrumb.js +31 -0
  381. package/dist/esm/shell/Breadcrumb.js.map +1 -0
  382. package/dist/esm/shell/ConfigPanel.d.ts +3 -0
  383. package/dist/esm/shell/ConfigPanel.d.ts.map +1 -0
  384. package/dist/esm/shell/ConfigPanel.js +126 -0
  385. package/dist/esm/shell/ConfigPanel.js.map +1 -0
  386. package/dist/esm/shell/Footer.d.ts +3 -0
  387. package/dist/esm/shell/Footer.d.ts.map +1 -0
  388. package/dist/esm/shell/Footer.js +26 -0
  389. package/dist/esm/shell/Footer.js.map +1 -0
  390. package/dist/esm/shell/FullPageShell.d.ts +3 -0
  391. package/dist/esm/shell/FullPageShell.d.ts.map +1 -0
  392. package/dist/esm/shell/FullPageShell.js +51 -0
  393. package/dist/esm/shell/FullPageShell.js.map +1 -0
  394. package/dist/esm/shell/LayoutModeSwitcher.d.ts +3 -0
  395. package/dist/esm/shell/LayoutModeSwitcher.d.ts.map +1 -0
  396. package/dist/esm/shell/LayoutModeSwitcher.js +56 -0
  397. package/dist/esm/shell/LayoutModeSwitcher.js.map +1 -0
  398. package/dist/esm/shell/LayoutModes.stories.d.ts +29 -0
  399. package/dist/esm/shell/LayoutModes.stories.d.ts.map +1 -0
  400. package/dist/esm/shell/LayoutModes.stories.js +43 -0
  401. package/dist/esm/shell/LayoutModes.stories.js.map +1 -0
  402. package/dist/esm/shell/Logo.d.ts +3 -0
  403. package/dist/esm/shell/Logo.d.ts.map +1 -0
  404. package/dist/esm/shell/Logo.js +42 -0
  405. package/dist/esm/shell/Logo.js.map +1 -0
  406. package/dist/esm/shell/Mask.d.ts +3 -0
  407. package/dist/esm/shell/Mask.d.ts.map +1 -0
  408. package/dist/esm/shell/Mask.js +31 -0
  409. package/dist/esm/shell/Mask.js.map +1 -0
  410. package/dist/esm/shell/Menu.d.ts +3 -0
  411. package/dist/esm/shell/Menu.d.ts.map +1 -0
  412. package/dist/esm/shell/Menu.js +34 -0
  413. package/dist/esm/shell/Menu.js.map +1 -0
  414. package/dist/esm/shell/MenuItem.d.ts +3 -0
  415. package/dist/esm/shell/MenuItem.d.ts.map +1 -0
  416. package/dist/esm/shell/MenuItem.js +63 -0
  417. package/dist/esm/shell/MenuItem.js.map +1 -0
  418. package/dist/esm/shell/PageHeader.d.ts +3 -0
  419. package/dist/esm/shell/PageHeader.d.ts.map +1 -0
  420. package/dist/esm/shell/PageHeader.js +41 -0
  421. package/dist/esm/shell/PageHeader.js.map +1 -0
  422. package/dist/esm/shell/RightPanel.d.ts +3 -0
  423. package/dist/esm/shell/RightPanel.d.ts.map +1 -0
  424. package/dist/esm/shell/RightPanel.js +28 -0
  425. package/dist/esm/shell/RightPanel.js.map +1 -0
  426. package/dist/esm/shell/Sidebar.d.ts +3 -0
  427. package/dist/esm/shell/Sidebar.d.ts.map +1 -0
  428. package/dist/esm/shell/Sidebar.js +49 -0
  429. package/dist/esm/shell/Sidebar.js.map +1 -0
  430. package/dist/esm/shell/ThemeOption.d.ts +10 -0
  431. package/dist/esm/shell/ThemeOption.d.ts.map +1 -0
  432. package/dist/esm/shell/ThemeOption.js +39 -0
  433. package/dist/esm/shell/ThemeOption.js.map +1 -0
  434. package/dist/esm/shell/ThemeSwitcher.d.ts +3 -0
  435. package/dist/esm/shell/ThemeSwitcher.d.ts.map +1 -0
  436. package/dist/esm/shell/ThemeSwitcher.js +48 -0
  437. package/dist/esm/shell/ThemeSwitcher.js.map +1 -0
  438. package/dist/esm/shell/Topbar.d.ts +3 -0
  439. package/dist/esm/shell/Topbar.d.ts.map +1 -0
  440. package/dist/esm/shell/Topbar.js +52 -0
  441. package/dist/esm/shell/Topbar.js.map +1 -0
  442. package/dist/esm/shell/UserMenu.d.ts +3 -0
  443. package/dist/esm/shell/UserMenu.d.ts.map +1 -0
  444. package/dist/esm/shell/UserMenu.js +66 -0
  445. package/dist/esm/shell/UserMenu.js.map +1 -0
  446. package/dist/esm/shell/elementProperties.d.ts +9 -0
  447. package/dist/esm/shell/elementProperties.d.ts.map +1 -0
  448. package/dist/esm/shell/elementProperties.js +48 -0
  449. package/dist/esm/shell/elementProperties.js.map +1 -0
  450. package/dist/esm/shell/index.d.ts +19 -0
  451. package/dist/esm/shell/index.d.ts.map +1 -0
  452. package/dist/esm/shell/index.js +19 -0
  453. package/dist/esm/shell/index.js.map +1 -0
  454. package/dist/esm/themes/LayoutThemeProvider.d.ts +9 -0
  455. package/dist/esm/themes/LayoutThemeProvider.d.ts.map +1 -0
  456. package/dist/esm/themes/LayoutThemeProvider.js +31 -0
  457. package/dist/esm/themes/LayoutThemeProvider.js.map +1 -0
  458. package/dist/esm/themes/Theming.stories.d.ts +21 -0
  459. package/dist/esm/themes/Theming.stories.d.ts.map +1 -0
  460. package/dist/esm/themes/Theming.stories.js +54 -0
  461. package/dist/esm/themes/Theming.stories.js.map +1 -0
  462. package/dist/esm/themes/blueprintThemeCompatibility.d.ts +2 -0
  463. package/dist/esm/themes/blueprintThemeCompatibility.d.ts.map +1 -0
  464. package/dist/esm/themes/blueprintThemeCompatibility.js +26 -0
  465. package/dist/esm/themes/blueprintThemeCompatibility.js.map +1 -0
  466. package/dist/esm/themes/dark.d.ts +3 -0
  467. package/dist/esm/themes/dark.d.ts.map +1 -0
  468. package/dist/esm/themes/dark.js +38 -0
  469. package/dist/esm/themes/dark.js.map +1 -0
  470. package/dist/esm/themes/defaultBlueprintThemes.d.ts +3 -0
  471. package/dist/esm/themes/defaultBlueprintThemes.d.ts.map +1 -0
  472. package/dist/esm/themes/defaultBlueprintThemes.js +17 -0
  473. package/dist/esm/themes/defaultBlueprintThemes.js.map +1 -0
  474. package/dist/esm/themes/index.d.ts +6 -0
  475. package/dist/esm/themes/index.d.ts.map +1 -0
  476. package/dist/esm/themes/index.js +6 -0
  477. package/dist/esm/themes/index.js.map +1 -0
  478. package/dist/esm/themes/light.d.ts +3 -0
  479. package/dist/esm/themes/light.d.ts.map +1 -0
  480. package/dist/esm/themes/light.js +41 -0
  481. package/dist/esm/themes/light.js.map +1 -0
  482. package/dist/esm/tsconfig.tsbuildinfo +1 -0
  483. package/for_AppShell/when_rendering_a_gallery_screen.tsx +76 -0
  484. package/for_LayoutConfigProvider/when_switching_mode_and_reloading.tsx +77 -0
  485. package/for_appShellLayout/when_evaluating_the_arrangement_at_each_size_class.ts +42 -0
  486. package/for_defaultBlueprint/when_validating_the_bundle.ts +43 -0
  487. package/for_defaultBlueprintThemes/when_checking_attribution_and_tokens.ts +50 -0
  488. package/for_fullPageLayout/when_evaluating_the_arrangement_at_each_size_class.ts +36 -0
  489. package/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.ts +53 -0
  490. package/for_galleryScreenTemplates/when_following_the_nesting_chain.ts +41 -0
  491. package/for_galleryScreens/when_checking_the_layouts_and_slots_they_fill.ts +44 -0
  492. package/for_galleryScreens/when_resolving_the_component_names_they_reference.ts +60 -0
  493. package/for_layoutConfigStorage/when_restoring_a_persisted_configuration.ts +76 -0
  494. package/for_layoutConfigTransitions/when_anchoring_a_reveal_sidebar.ts +44 -0
  495. package/for_layoutConfigTransitions/when_the_viewport_crosses_the_mobile_breakpoint.ts +61 -0
  496. package/for_layoutWrapperClasses/when_rendering_each_mode.ts +63 -0
  497. package/for_navigation/when_aggregating_the_navigation_contributions.ts +50 -0
  498. package/gallery/ApplicationScreens.stories.tsx +70 -0
  499. package/gallery/FullPageScreens.stories.tsx +60 -0
  500. package/gallery/GalleryScreenPreview.tsx +68 -0
  501. package/gallery/NavigationEntry.ts +27 -0
  502. package/gallery/TemplateSlotName.ts +36 -0
  503. package/gallery/applicationChrome.ts +110 -0
  504. package/gallery/authTemplates.ts +161 -0
  505. package/gallery/componentNames.ts +55 -0
  506. package/gallery/composeScreen.ts +95 -0
  507. package/gallery/dependencyComponentNames.ts +64 -0
  508. package/gallery/dialogTemplates.ts +79 -0
  509. package/gallery/elements.ts +65 -0
  510. package/gallery/index.ts +22 -0
  511. package/gallery/navigation.ts +71 -0
  512. package/gallery/nesting.ts +82 -0
  513. package/gallery/previewProfile.ts +59 -0
  514. package/gallery/resolveElementNames.ts +55 -0
  515. package/gallery/screens.ts +111 -0
  516. package/gallery/statusTemplates.ts +118 -0
  517. package/gallery/supportTemplates.ts +164 -0
  518. package/gallery/widgets.ts +63 -0
  519. package/gallery/workspaceTemplates.ts +198 -0
  520. package/index.ts +12 -0
  521. package/layouts/LayoutName.ts +18 -0
  522. package/layouts/SlotName.ts +44 -0
  523. package/layouts/appShell.ts +106 -0
  524. package/layouts/defaultLayouts.ts +15 -0
  525. package/layouts/flowBuilders.ts +49 -0
  526. package/layouts/fullPage.ts +48 -0
  527. package/layouts/index.ts +10 -0
  528. package/layouts/shellComponents.ts +28 -0
  529. package/package.json +68 -0
  530. package/packageName.ts +12 -0
  531. package/shell/AppShell.tsx +66 -0
  532. package/shell/Breadcrumb.tsx +31 -0
  533. package/shell/ConfigPanel.tsx +105 -0
  534. package/shell/Footer.tsx +23 -0
  535. package/shell/FullPageShell.tsx +41 -0
  536. package/shell/LayoutModeSwitcher.tsx +50 -0
  537. package/shell/LayoutModes.stories.tsx +83 -0
  538. package/shell/Logo.tsx +30 -0
  539. package/shell/Mask.tsx +29 -0
  540. package/shell/Menu.tsx +26 -0
  541. package/shell/MenuItem.tsx +39 -0
  542. package/shell/PageHeader.tsx +28 -0
  543. package/shell/RightPanel.tsx +23 -0
  544. package/shell/Sidebar.tsx +45 -0
  545. package/shell/ThemeOption.ts +60 -0
  546. package/shell/ThemeSwitcher.tsx +42 -0
  547. package/shell/Topbar.tsx +49 -0
  548. package/shell/UserMenu.tsx +53 -0
  549. package/shell/elementProperties.ts +64 -0
  550. package/shell/index.ts +21 -0
  551. package/shell/layout.css +821 -0
  552. package/themes/LayoutThemeProvider.tsx +41 -0
  553. package/themes/Theming.stories.tsx +89 -0
  554. package/themes/blueprintThemeCompatibility.ts +19 -0
  555. package/themes/dark.ts +38 -0
  556. package/themes/defaultBlueprintThemes.ts +14 -0
  557. package/themes/index.ts +8 -0
  558. package/themes/light.ts +41 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mask.js","sources":["../../../shell/Mask.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useLayoutConfig } from '../configuration';\n\n/**\n * The scrim behind a floating sidebar.\n *\n * It is a `button` rather than a `div` because its only job is to close the sidebar, and a click target\n * that is not focusable or reachable from the keyboard traps anyone not using a mouse behind an open\n * overlay with no way out. It renders nothing at all when no sidebar is floating, so it never sits\n * invisibly over the page swallowing clicks.\n */\nexport function LayoutMask() {\n const { isMaskVisible, setSidebarOpen } = useLayoutConfig();\n if (!isMaskVisible) {\n return undefined;\n }\n\n return <button type='button' className='layout-mask' aria-label='Close the menu' onClick={() => setSidebarOpen(false)} />;\n}\n\n/**\n * The `mask` component, for a template that wants to place the scrim itself rather than let\n * {@link AppShell} do it.\n */\nexport function Mask() {\n return <LayoutMask />;\n}\n"],"names":["LayoutMask","isMaskVisible","setSidebarOpen","useLayoutConfig","undefined","_jsx","button","type","className","aria-label","onClick","Mask"],"mappings":";;;;;AAKA;;;;;;;AAOC,IACM,SAASA,UAAAA,GAAAA;AACZ,IAAA,MAAM,EAAEC,aAAa,EAAEC,cAAc,EAAE,GAAGC,oCAAAA,EAAAA;AAC1C,IAAA,IAAI,CAACF,aAAAA,EAAe;QAChB,OAAOG,SAAAA;AACX,IAAA;AAEA,IAAA,qBAAOC,cAAA,CAACC,QAAAA,EAAAA;QAAOC,IAAAA,EAAK,QAAA;QAASC,SAAAA,EAAU,aAAA;QAAcC,YAAAA,EAAW,gBAAA;AAAiBC,QAAAA,OAAAA,EAAS,IAAMR,cAAAA,CAAe,KAAA;;AACnH;AAEA;;;AAGC,IACM,SAASS,IAAAA,GAAAA;AACZ,IAAA,qBAAON,cAAA,CAACL,UAAAA,EAAAA,EAAAA,CAAAA;AACZ;;;;;"}
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var elementProperties = require('./elementProperties.js');
5
+
6
+ // Copyright (c) Cratis. All rights reserved.
7
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
8
+ /**
9
+ * A navigation list.
10
+ *
11
+ * One markup shape - a `nav` around a `ul` of {@link MenuItem}s - serves every mode; the difference
12
+ * between a docked list, a circular icon rail, a stacked label rail and a horizontal strip with drop-down
13
+ * submenus is entirely in the stylesheet. That is the point of the mode class vocabulary: the menu does
14
+ * not know which mode it is in, so a screen's navigation cannot be written for one mode and broken in
15
+ * another.
16
+ */ function Menu({ element, slots }) {
17
+ const title = elementProperties.readString(element, 'title');
18
+ const label = elementProperties.readString(element, 'label', 'Main');
19
+ return /*#__PURE__*/ jsxRuntime.jsxs("nav", {
20
+ "data-scene-id": element.id,
21
+ "aria-label": label,
22
+ children: [
23
+ title && /*#__PURE__*/ jsxRuntime.jsx("div", {
24
+ className: "layout-menu-section-title",
25
+ children: title
26
+ }),
27
+ /*#__PURE__*/ jsxRuntime.jsx("ul", {
28
+ className: "layout-menu",
29
+ children: slots.items
30
+ })
31
+ ]
32
+ });
33
+ }
34
+
35
+ exports.Menu = Menu;
36
+ //# sourceMappingURL=Menu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Menu.js","sources":["../../../shell/Menu.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { readString } from './elementProperties';\n\n/**\n * A navigation list.\n *\n * One markup shape - a `nav` around a `ul` of {@link MenuItem}s - serves every mode; the difference\n * between a docked list, a circular icon rail, a stacked label rail and a horizontal strip with drop-down\n * submenus is entirely in the stylesheet. That is the point of the mode class vocabulary: the menu does\n * not know which mode it is in, so a screen's navigation cannot be written for one mode and broken in\n * another.\n */\nexport function Menu({ element, slots }: RegisteredComponentProps) {\n const title = readString(element, 'title');\n const label = readString(element, 'label', 'Main');\n\n return (\n <nav data-scene-id={element.id} aria-label={label}>\n {title && <div className='layout-menu-section-title'>{title}</div>}\n <ul className='layout-menu'>{slots.items}</ul>\n </nav>\n );\n}\n"],"names":["Menu","element","slots","title","readString","label","_jsxs","nav","data-scene-id","id","aria-label","_jsx","div","className","ul","items"],"mappings":";;;;;AAAA;AACA;AAKA;;;;;;;;AAQC,IACM,SAASA,IAAAA,CAAK,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;IAC7D,MAAMC,KAAAA,GAAQC,6BAAWH,OAAAA,EAAS,OAAA,CAAA;IAClC,MAAMI,KAAAA,GAAQD,4BAAAA,CAAWH,OAAAA,EAAS,OAAA,EAAS,MAAA,CAAA;AAE3C,IAAA,qBACIK,eAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAeP,QAAQQ,EAAE;QAAEC,YAAAA,EAAYL,KAAAA;;AACvCF,YAAAA,KAAAA,kBAASQ,cAAA,CAACC,KAAAA,EAAAA;gBAAIC,SAAAA,EAAU,2BAAA;AAA6BV,gBAAAA,QAAAA,EAAAA;;0BACtDQ,cAAA,CAACG,IAAAA,EAAAA;gBAAGD,SAAAA,EAAU,aAAA;AAAeX,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMa;;;;AAG/C;;;;"}
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var elementProperties = require('./elementProperties.js');
5
+
6
+ // Copyright (c) Cratis. All rights reserved.
7
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
8
+ /**
9
+ * One entry in a navigation list, optionally with a submenu.
10
+ *
11
+ * Its properties are deliberately the {@link NavigationItem} contract - `label`, `targetScreen`,
12
+ * `routeParameterBindings`, `order`, `group` - so the very same element can be handed to the
13
+ * `Navigation` contribution point and read back by `extractNavigationItem`. A screen therefore declares
14
+ * its navigation once and gets both the sidebar entry and the aggregated navigation for free, instead of
15
+ * maintaining a menu and a contribution that drift apart.
16
+ *
17
+ * The route is rendered as a hash route against the target screen's name. A host with a real router
18
+ * renders the shell inside it and rewrites these; hashes keep the gallery navigable with no router at all,
19
+ * which is what a preview needs.
20
+ */ function MenuItem({ element, slots }) {
21
+ const label = elementProperties.readString(element, 'label');
22
+ const icon = elementProperties.readOptionalString(element, 'icon');
23
+ const badge = elementProperties.readOptionalString(element, 'badge');
24
+ const targetScreen = elementProperties.readOptionalString(element, 'targetScreen');
25
+ const isActive = elementProperties.readBoolean(element, 'isActive');
26
+ const hasSubmenu = (slots.items?.length ?? 0) > 0;
27
+ return /*#__PURE__*/ jsxRuntime.jsxs("li", {
28
+ className: "layout-menu-item",
29
+ "data-scene-id": element.id,
30
+ "data-active": isActive,
31
+ "data-target-screen": targetScreen,
32
+ children: [
33
+ /*#__PURE__*/ jsxRuntime.jsxs("a", {
34
+ className: "layout-menu-link",
35
+ href: targetScreen ? `#/${targetScreen}` : undefined,
36
+ "aria-current": isActive ? 'page' : undefined,
37
+ children: [
38
+ icon && /*#__PURE__*/ jsxRuntime.jsx("i", {
39
+ className: `layout-menu-icon ${icon}`,
40
+ "aria-hidden": "true"
41
+ }),
42
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
43
+ className: "layout-menu-label",
44
+ children: label
45
+ }),
46
+ badge && /*#__PURE__*/ jsxRuntime.jsx("span", {
47
+ className: "layout-menu-badge",
48
+ children: badge
49
+ }),
50
+ hasSubmenu && /*#__PURE__*/ jsxRuntime.jsx("i", {
51
+ className: "pi pi-angle-down",
52
+ "aria-hidden": "true"
53
+ })
54
+ ]
55
+ }),
56
+ hasSubmenu && /*#__PURE__*/ jsxRuntime.jsx("ul", {
57
+ className: "layout-submenu",
58
+ children: slots.items
59
+ })
60
+ ]
61
+ });
62
+ }
63
+
64
+ exports.MenuItem = MenuItem;
65
+ //# sourceMappingURL=MenuItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MenuItem.js","sources":["../../../shell/MenuItem.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { readBoolean, readOptionalString, readString } from './elementProperties';\n\n/**\n * One entry in a navigation list, optionally with a submenu.\n *\n * Its properties are deliberately the {@link NavigationItem} contract - `label`, `targetScreen`,\n * `routeParameterBindings`, `order`, `group` - so the very same element can be handed to the\n * `Navigation` contribution point and read back by `extractNavigationItem`. A screen therefore declares\n * its navigation once and gets both the sidebar entry and the aggregated navigation for free, instead of\n * maintaining a menu and a contribution that drift apart.\n *\n * The route is rendered as a hash route against the target screen's name. A host with a real router\n * renders the shell inside it and rewrites these; hashes keep the gallery navigable with no router at all,\n * which is what a preview needs.\n */\nexport function MenuItem({ element, slots }: RegisteredComponentProps) {\n const label = readString(element, 'label');\n const icon = readOptionalString(element, 'icon');\n const badge = readOptionalString(element, 'badge');\n const targetScreen = readOptionalString(element, 'targetScreen');\n const isActive = readBoolean(element, 'isActive');\n const hasSubmenu = (slots.items?.length ?? 0) > 0;\n\n return (\n <li className='layout-menu-item' data-scene-id={element.id} data-active={isActive} data-target-screen={targetScreen}>\n <a className='layout-menu-link' href={targetScreen ? `#/${targetScreen}` : undefined} aria-current={isActive ? 'page' : undefined}>\n {icon && <i className={`layout-menu-icon ${icon}`} aria-hidden='true' />}\n <span className='layout-menu-label'>{label}</span>\n {badge && <span className='layout-menu-badge'>{badge}</span>}\n {hasSubmenu && <i className='pi pi-angle-down' aria-hidden='true' />}\n </a>\n {hasSubmenu && <ul className='layout-submenu'>{slots.items}</ul>}\n </li>\n );\n}\n"],"names":["MenuItem","element","slots","label","readString","icon","readOptionalString","badge","targetScreen","isActive","readBoolean","hasSubmenu","items","length","_jsxs","li","className","data-scene-id","id","data-active","data-target-screen","a","href","undefined","aria-current","_jsx","i","aria-hidden","span","ul"],"mappings":";;;;;AAAA;AACA;AAKA;;;;;;;;;;;;AAYC,IACM,SAASA,QAAAA,CAAS,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;IACjE,MAAMC,KAAAA,GAAQC,6BAAWH,OAAAA,EAAS,OAAA,CAAA;IAClC,MAAMI,IAAAA,GAAOC,qCAAmBL,OAAAA,EAAS,MAAA,CAAA;IACzC,MAAMM,KAAAA,GAAQD,qCAAmBL,OAAAA,EAAS,OAAA,CAAA;IAC1C,MAAMO,YAAAA,GAAeF,qCAAmBL,OAAAA,EAAS,cAAA,CAAA;IACjD,MAAMQ,QAAAA,GAAWC,8BAAYT,OAAAA,EAAS,UAAA,CAAA;IACtC,MAAMU,UAAAA,GAAa,CAACT,KAAAA,CAAMU,KAAK,EAAEC,MAAAA,IAAU,CAAA,IAAK,CAAA;AAEhD,IAAA,qBACIC,eAAA,CAACC,IAAAA,EAAAA;QAAGC,SAAAA,EAAU,kBAAA;AAAmBC,QAAAA,eAAAA,EAAehB,QAAQiB,EAAE;QAAEC,aAAAA,EAAaV,QAAAA;QAAUW,oBAAAA,EAAoBZ,YAAAA;;0BACnGM,eAAA,CAACO,GAAAA,EAAAA;gBAAEL,SAAAA,EAAU,kBAAA;AAAmBM,gBAAAA,IAAAA,EAAMd,YAAAA,GAAe,CAAC,EAAE,EAAEA,cAAc,GAAGe,SAAAA;AAAWC,gBAAAA,cAAAA,EAAcf,WAAW,MAAA,GAASc,SAAAA;;AACnHlB,oBAAAA,IAAAA,kBAAQoB,cAAA,CAACC,GAAAA,EAAAA;wBAAEV,SAAAA,EAAW,CAAC,iBAAiB,EAAEX,IAAAA,CAAAA,CAAM;wBAAEsB,aAAAA,EAAY;;kCAC/DF,cAAA,CAACG,MAAAA,EAAAA;wBAAKZ,SAAAA,EAAU,mBAAA;AAAqBb,wBAAAA,QAAAA,EAAAA;;AACpCI,oBAAAA,KAAAA,kBAASkB,cAAA,CAACG,MAAAA,EAAAA;wBAAKZ,SAAAA,EAAU,mBAAA;AAAqBT,wBAAAA,QAAAA,EAAAA;;AAC9CI,oBAAAA,UAAAA,kBAAcc,cAAA,CAACC,GAAAA,EAAAA;wBAAEV,SAAAA,EAAU,kBAAA;wBAAmBW,aAAAA,EAAY;;;;AAE9DhB,YAAAA,UAAAA,kBAAcc,cAAA,CAACI,IAAAA,EAAAA;gBAAGb,SAAAA,EAAU,gBAAA;AAAkBd,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMU;;;;AAGjE;;;;"}
@@ -0,0 +1,43 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var elementProperties = require('./elementProperties.js');
5
+
6
+ // Copyright (c) Cratis. All rights reserved.
7
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
8
+ /**
9
+ * A screen's title, subtitle and actions.
10
+ *
11
+ * This belongs to the layout package rather than to each screen because it is the one piece of page
12
+ * furniture every page template repeats. Centralizing it means the title/actions relationship is spaced
13
+ * and aligned identically across the whole page set, which is most of what makes a template set look like
14
+ * one product rather than twenty pages.
15
+ */ function PageHeader({ element, slots }) {
16
+ const title = elementProperties.readString(element, 'title');
17
+ const subtitle = elementProperties.readString(element, 'subtitle');
18
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
19
+ className: "layout-page-header",
20
+ "data-scene-id": element.id,
21
+ children: [
22
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
23
+ children: [
24
+ /*#__PURE__*/ jsxRuntime.jsx("h1", {
25
+ className: "layout-page-header-title",
26
+ children: title
27
+ }),
28
+ subtitle && /*#__PURE__*/ jsxRuntime.jsx("p", {
29
+ className: "layout-page-header-subtitle",
30
+ children: subtitle
31
+ })
32
+ ]
33
+ }),
34
+ (slots.actions?.length ?? 0) > 0 && /*#__PURE__*/ jsxRuntime.jsx("div", {
35
+ className: "layout-page-header-actions",
36
+ children: slots.actions
37
+ })
38
+ ]
39
+ });
40
+ }
41
+
42
+ exports.PageHeader = PageHeader;
43
+ //# sourceMappingURL=PageHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PageHeader.js","sources":["../../../shell/PageHeader.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { readString } from './elementProperties';\n\n/**\n * A screen's title, subtitle and actions.\n *\n * This belongs to the layout package rather than to each screen because it is the one piece of page\n * furniture every page template repeats. Centralizing it means the title/actions relationship is spaced\n * and aligned identically across the whole page set, which is most of what makes a template set look like\n * one product rather than twenty pages.\n */\nexport function PageHeader({ element, slots }: RegisteredComponentProps) {\n const title = readString(element, 'title');\n const subtitle = readString(element, 'subtitle');\n\n return (\n <div className='layout-page-header' data-scene-id={element.id}>\n <div>\n <h1 className='layout-page-header-title'>{title}</h1>\n {subtitle && <p className='layout-page-header-subtitle'>{subtitle}</p>}\n </div>\n {(slots.actions?.length ?? 0) > 0 && <div className='layout-page-header-actions'>{slots.actions}</div>}\n </div>\n );\n}\n"],"names":["PageHeader","element","slots","title","readString","subtitle","_jsxs","div","className","data-scene-id","id","_jsx","h1","p","actions","length"],"mappings":";;;;;AAAA;AACA;AAKA;;;;;;;AAOC,IACM,SAASA,UAAAA,CAAW,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;IACnE,MAAMC,KAAAA,GAAQC,6BAAWH,OAAAA,EAAS,OAAA,CAAA;IAClC,MAAMI,QAAAA,GAAWD,6BAAWH,OAAAA,EAAS,UAAA,CAAA;AAErC,IAAA,qBACIK,eAAA,CAACC,KAAAA,EAAAA;QAAIC,SAAAA,EAAU,oBAAA;AAAqBC,QAAAA,eAAAA,EAAeR,QAAQS,EAAE;;0BACzDJ,eAAA,CAACC,KAAAA,EAAAA;;kCACGI,cAAA,CAACC,IAAAA,EAAAA;wBAAGJ,SAAAA,EAAU,0BAAA;AAA4BL,wBAAAA,QAAAA,EAAAA;;AACzCE,oBAAAA,QAAAA,kBAAYM,cAAA,CAACE,GAAAA,EAAAA;wBAAEL,SAAAA,EAAU,6BAAA;AAA+BH,wBAAAA,QAAAA,EAAAA;;;;AAE3DH,YAAAA,CAAAA,MAAMY,OAAO,EAAEC,UAAU,CAAA,IAAK,mBAAKJ,cAAA,CAACJ,KAAAA,EAAAA;gBAAIC,SAAAA,EAAU,4BAAA;AAA8BN,gBAAAA,QAAAA,EAAAA,KAAAA,CAAMY;;;;AAGpG;;;;"}
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var elementProperties = require('./elementProperties.js');
5
+
6
+ // Copyright (c) Cratis. All rights reserved.
7
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
8
+ /**
9
+ * The inspector panel down the right-hand edge.
10
+ *
11
+ * Sakai has no right panel; the premium PrimeTek templates all do, and it is where activity feeds, recent
12
+ * items and inline help live. It is exposed as a slot the shell simply does not render when nothing fills
13
+ * it, so a screen pays nothing for a region it does not use.
14
+ */ function RightPanel({ element, slots }) {
15
+ const title = elementProperties.readString(element, 'title');
16
+ return /*#__PURE__*/ jsxRuntime.jsxs("section", {
17
+ "data-scene-id": element.id,
18
+ "aria-label": title || 'Panel',
19
+ children: [
20
+ title && /*#__PURE__*/ jsxRuntime.jsx("h2", {
21
+ className: "layout-page-header-title",
22
+ children: title
23
+ }),
24
+ slots.content
25
+ ]
26
+ });
27
+ }
28
+
29
+ exports.RightPanel = RightPanel;
30
+ //# sourceMappingURL=RightPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RightPanel.js","sources":["../../../shell/RightPanel.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { readString } from './elementProperties';\n\n/**\n * The inspector panel down the right-hand edge.\n *\n * Sakai has no right panel; the premium PrimeTek templates all do, and it is where activity feeds, recent\n * items and inline help live. It is exposed as a slot the shell simply does not render when nothing fills\n * it, so a screen pays nothing for a region it does not use.\n */\nexport function RightPanel({ element, slots }: RegisteredComponentProps) {\n const title = readString(element, 'title');\n\n return (\n <section data-scene-id={element.id} aria-label={title || 'Panel'}>\n {title && <h2 className='layout-page-header-title'>{title}</h2>}\n {slots.content}\n </section>\n );\n}\n"],"names":["RightPanel","element","slots","title","readString","_jsxs","section","data-scene-id","id","aria-label","_jsx","h2","className","content"],"mappings":";;;;;AAAA;AACA;AAKA;;;;;;AAMC,IACM,SAASA,UAAAA,CAAW,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;IACnE,MAAMC,KAAAA,GAAQC,6BAAWH,OAAAA,EAAS,OAAA,CAAA;AAElC,IAAA,qBACII,eAAA,CAACC,SAAAA,EAAAA;AAAQC,QAAAA,eAAAA,EAAeN,QAAQO,EAAE;AAAEC,QAAAA,YAAAA,EAAYN,KAAAA,IAAS,OAAA;;AACpDA,YAAAA,KAAAA,kBAASO,cAAA,CAACC,IAAAA,EAAAA;gBAAGC,SAAAA,EAAU,0BAAA;AAA4BT,gBAAAA,QAAAA,EAAAA;;AACnDD,YAAAA,KAAAA,CAAMW;;;AAGnB;;;;"}
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var button = require('primereact/button');
5
+ var layoutConfigTransitions = require('../configuration/layoutConfigTransitions.js');
6
+ var LayoutConfigProvider = require('../configuration/LayoutConfigProvider.js');
7
+ var elementProperties = require('./elementProperties.js');
8
+
9
+ /**
10
+ * The sidebar's own chrome, inside the panel {@link AppShell} positions.
11
+ *
12
+ * The panel and its contents are deliberately different components. Everything about *where* the sidebar
13
+ * is - translated off-canvas, collapsed to a rail, growing on hover - belongs to the mode and therefore to
14
+ * the shell; everything about *what is in it* belongs to the screen. A template can replace this header
15
+ * wholesale without any of the mode CSS noticing.
16
+ *
17
+ * The pin button only appears in `reveal` and `drawer`, the two modes where the sidebar answers to the
18
+ * pointer and therefore needs a way to be made to stay.
19
+ */ function Sidebar({ element, slots }) {
20
+ const { effectiveMode, config, toggleSidebarAnchor } = LayoutConfigProvider.useLayoutConfig();
21
+ const title = elementProperties.readString(element, 'title');
22
+ const isPinnable = layoutConfigTransitions.isPointerRevealMode(effectiveMode);
23
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
24
+ children: [
25
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
26
+ className: "layout-sidebar-header",
27
+ "data-scene-id": element.id,
28
+ children: [
29
+ slots.logo,
30
+ title && /*#__PURE__*/ jsxRuntime.jsx("span", {
31
+ className: "layout-sidebar-title",
32
+ children: title
33
+ }),
34
+ isPinnable && /*#__PURE__*/ jsxRuntime.jsx(button.Button, {
35
+ type: "button",
36
+ text: true,
37
+ rounded: true,
38
+ icon: config.isSidebarAnchored ? 'pi pi-lock' : 'pi pi-lock-open',
39
+ "aria-label": config.isSidebarAnchored ? 'Unpin the menu' : 'Pin the menu open',
40
+ "aria-pressed": config.isSidebarAnchored,
41
+ onClick: toggleSidebarAnchor
42
+ })
43
+ ]
44
+ }),
45
+ slots.content
46
+ ]
47
+ });
48
+ }
49
+
50
+ exports.Sidebar = Sidebar;
51
+ //# sourceMappingURL=Sidebar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Sidebar.js","sources":["../../../shell/Sidebar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Button } from 'primereact/button';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { isPointerRevealMode, useLayoutConfig } from '../configuration';\nimport { readString } from './elementProperties';\n\n/**\n * The sidebar's own chrome, inside the panel {@link AppShell} positions.\n *\n * The panel and its contents are deliberately different components. Everything about *where* the sidebar\n * is - translated off-canvas, collapsed to a rail, growing on hover - belongs to the mode and therefore to\n * the shell; everything about *what is in it* belongs to the screen. A template can replace this header\n * wholesale without any of the mode CSS noticing.\n *\n * The pin button only appears in `reveal` and `drawer`, the two modes where the sidebar answers to the\n * pointer and therefore needs a way to be made to stay.\n */\nexport function Sidebar({ element, slots }: RegisteredComponentProps) {\n const { effectiveMode, config, toggleSidebarAnchor } = useLayoutConfig();\n const title = readString(element, 'title');\n const isPinnable = isPointerRevealMode(effectiveMode);\n\n return (\n <>\n <div className='layout-sidebar-header' data-scene-id={element.id}>\n {slots.logo}\n {title && <span className='layout-sidebar-title'>{title}</span>}\n {isPinnable && (\n <Button\n type='button'\n text\n rounded\n icon={config.isSidebarAnchored ? 'pi pi-lock' : 'pi pi-lock-open'}\n aria-label={config.isSidebarAnchored ? 'Unpin the menu' : 'Pin the menu open'}\n aria-pressed={config.isSidebarAnchored}\n onClick={toggleSidebarAnchor}\n />\n )}\n </div>\n {slots.content}\n </>\n );\n}\n"],"names":["Sidebar","element","slots","effectiveMode","config","toggleSidebarAnchor","useLayoutConfig","title","readString","isPinnable","isPointerRevealMode","_jsxs","_Fragment","div","className","data-scene-id","id","logo","_jsx","span","Button","type","text","rounded","icon","isSidebarAnchored","aria-label","aria-pressed","onClick","content"],"mappings":";;;;;;;;AAQA;;;;;;;;;;AAUC,IACM,SAASA,OAAAA,CAAQ,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;AAChE,IAAA,MAAM,EAAEC,aAAa,EAAEC,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,oCAAAA,EAAAA;IACvD,MAAMC,KAAAA,GAAQC,6BAAWP,OAAAA,EAAS,OAAA,CAAA;AAClC,IAAA,MAAMQ,aAAaC,2CAAAA,CAAoBP,aAAAA,CAAAA;IAEvC,qBACIQ,eAAA,CAAAC,mBAAA,EAAA;;0BACID,eAAA,CAACE,KAAAA,EAAAA;gBAAIC,SAAAA,EAAU,uBAAA;AAAwBC,gBAAAA,eAAAA,EAAed,QAAQe,EAAE;;AAC3Dd,oBAAAA,KAAAA,CAAMe,IAAI;AACVV,oBAAAA,KAAAA,kBAASW,cAAA,CAACC,MAAAA,EAAAA;wBAAKL,SAAAA,EAAU,sBAAA;AAAwBP,wBAAAA,QAAAA,EAAAA;;AACjDE,oBAAAA,UAAAA,kBACGS,cAAA,CAACE,aAAAA,EAAAA;wBACGC,IAAAA,EAAK,QAAA;wBACLC,IAAI,EAAA,IAAA;wBACJC,OAAO,EAAA,IAAA;wBACPC,IAAAA,EAAMpB,MAAAA,CAAOqB,iBAAiB,GAAG,YAAA,GAAe,iBAAA;wBAChDC,YAAAA,EAAYtB,MAAAA,CAAOqB,iBAAiB,GAAG,gBAAA,GAAmB,mBAAA;AAC1DE,wBAAAA,cAAAA,EAAcvB,OAAOqB,iBAAiB;wBACtCG,OAAAA,EAASvB;;;;AAIpBH,YAAAA,KAAAA,CAAM2B;;;AAGnB;;;;"}
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ var ColorScheme = require('../configuration/ColorScheme.js');
4
+ require('react/jsx-runtime');
5
+ require('react');
6
+ var elementProperties = require('./elementProperties.js');
7
+
8
+ // Copyright (c) Cratis. All rights reserved.
9
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
10
+ /**
11
+ * Reads the themes a switcher should offer out of an element's properties, falling back to the ones
12
+ * supplied by the host.
13
+ *
14
+ * A template says which themes it wants offered; a host that renders the shell with a different theme set
15
+ * passes those as the fallback. Neither has to know the other's list.
16
+ *
17
+ * @param element The element carrying an optional `themes` property - an array of `{ name, label, isDark }`.
18
+ * @param fallback The options to offer when the element names none.
19
+ * @returns The options to render.
20
+ */ function readThemeOptions(element, fallback) {
21
+ const declared = elementProperties.readRecords(element, 'themes').map((record)=>({
22
+ name: elementProperties.recordString(record, 'name'),
23
+ label: elementProperties.recordString(record, 'label') || elementProperties.recordString(record, 'name'),
24
+ colorScheme: record.isDark === true ? ColorScheme.ColorScheme.Dark : ColorScheme.ColorScheme.Light
25
+ }));
26
+ const named = declared.filter((option)=>option.name.length > 0);
27
+ return named.length > 0 ? named : fallback;
28
+ }
29
+ /**
30
+ * Turns the {@link Theme}s a package ships into switcher options, so a host offering its own themes and a
31
+ * host offering this package's use the same code path.
32
+ */ function themeOptionsFor(themes) {
33
+ return themes.map((theme)=>({
34
+ name: theme.name,
35
+ label: theme.name,
36
+ colorScheme: theme.isDark ? ColorScheme.ColorScheme.Dark : ColorScheme.ColorScheme.Light
37
+ }));
38
+ }
39
+
40
+ exports.readThemeOptions = readThemeOptions;
41
+ exports.themeOptionsFor = themeOptionsFor;
42
+ //# sourceMappingURL=ThemeOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeOption.js","sources":["../../../shell/ThemeOption.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ExternalComponent, Theme } from '@cratis/scene.model';\nimport { ColorScheme } from '../configuration';\nimport { readRecords, recordString } from './elementProperties';\n\n/**\n * One entry a theme switcher offers.\n *\n * A switcher needs a name to record and a color scheme to record alongside it, but must not need the\n * theme's tokens - the tokens belong to whoever applies the theme, and a switcher that carried them would\n * force every page template to inline a full palette just to offer a choice.\n */\nexport interface ThemeOption {\n /** The {@link Theme.name} to record when this option is chosen. */\n name: string;\n\n /** What to show on the button. */\n label: string;\n\n /** Which side of the light/dark axis choosing this option puts the shell on. */\n colorScheme: ColorScheme;\n}\n\n/**\n * Reads the themes a switcher should offer out of an element's properties, falling back to the ones\n * supplied by the host.\n *\n * A template says which themes it wants offered; a host that renders the shell with a different theme set\n * passes those as the fallback. Neither has to know the other's list.\n *\n * @param element The element carrying an optional `themes` property - an array of `{ name, label, isDark }`.\n * @param fallback The options to offer when the element names none.\n * @returns The options to render.\n */\nexport function readThemeOptions(element: ExternalComponent, fallback: ThemeOption[]): ThemeOption[] {\n const declared = readRecords(element, 'themes').map(\n (record): ThemeOption => ({\n name: recordString(record, 'name'),\n label: recordString(record, 'label') || recordString(record, 'name'),\n colorScheme: record.isDark === true ? ColorScheme.Dark : ColorScheme.Light,\n }),\n );\n\n const named = declared.filter(option => option.name.length > 0);\n return named.length > 0 ? named : fallback;\n}\n\n/**\n * Turns the {@link Theme}s a package ships into switcher options, so a host offering its own themes and a\n * host offering this package's use the same code path.\n */\nexport function themeOptionsFor(themes: Theme[]): ThemeOption[] {\n return themes.map(theme => ({\n name: theme.name,\n label: theme.name,\n colorScheme: theme.isDark ? ColorScheme.Dark : ColorScheme.Light,\n }));\n}\n"],"names":["readThemeOptions","element","fallback","declared","readRecords","map","record","name","recordString","label","colorScheme","isDark","ColorScheme","Dark","Light","named","filter","option","length","themeOptionsFor","themes","theme"],"mappings":";;;;;;;AAAA;AACA;AAwBA;;;;;;;;;;AAUC,IACM,SAASA,gBAAAA,CAAiBC,OAA0B,EAAEC,QAAuB,EAAA;IAChF,MAAMC,QAAAA,GAAWC,8BAAYH,OAAAA,EAAS,QAAA,CAAA,CAAUI,GAAG,CAC/C,CAACC,UAAyB;AACtBC,YAAAA,IAAAA,EAAMC,+BAAaF,MAAAA,EAAQ,MAAA,CAAA;AAC3BG,YAAAA,KAAAA,EAAOD,8BAAAA,CAAaF,MAAAA,EAAQ,OAAA,CAAA,IAAYE,8BAAAA,CAAaF,MAAAA,EAAQ,MAAA,CAAA;YAC7DI,WAAAA,EAAaJ,MAAAA,CAAOK,MAAM,KAAK,IAAA,GAAOC,wBAAYC,IAAI,GAAGD,wBAAYE;SACzE,CAAA,CAAA;IAGJ,MAAMC,KAAAA,GAAQZ,QAAAA,CAASa,MAAM,CAACC,CAAAA,SAAUA,MAAAA,CAAOV,IAAI,CAACW,MAAM,GAAG,CAAA,CAAA;AAC7D,IAAA,OAAOH,KAAAA,CAAMG,MAAM,GAAG,CAAA,GAAIH,KAAAA,GAAQb,QAAAA;AACtC;AAEA;;;IAIO,SAASiB,eAAAA,CAAgBC,MAAe,EAAA;AAC3C,IAAA,OAAOA,MAAAA,CAAOf,GAAG,CAACgB,CAAAA,SAAU;AACxBd,YAAAA,IAAAA,EAAMc,MAAMd,IAAI;AAChBE,YAAAA,KAAAA,EAAOY,MAAMd,IAAI;AACjBG,YAAAA,WAAAA,EAAaW,MAAMV,MAAM,GAAGC,wBAAYC,IAAI,GAAGD,wBAAYE;SAC/D,CAAA,CAAA;AACJ;;;;;"}
@@ -0,0 +1,50 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var LayoutConfigProvider = require('../configuration/LayoutConfigProvider.js');
5
+ var defaultBlueprintThemes = require('../themes/defaultBlueprintThemes.js');
6
+ require('react');
7
+ require('@cratis/scene.react');
8
+ var elementProperties = require('./elementProperties.js');
9
+ var ThemeOption = require('./ThemeOption.js');
10
+
11
+ // Copyright (c) Cratis. All rights reserved.
12
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
13
+ /**
14
+ * Switches between the themes a host offers.
15
+ *
16
+ * It records a name and a color scheme and nothing else - {@link LayoutThemeProvider} resolves the name
17
+ * against the real theme set. That split is what makes switching live: the tokens are rewritten on the
18
+ * element that already exists, so nothing below remounts and no form loses what was typed into it.
19
+ */ function ThemeSwitcher({ element }) {
20
+ const { config, setThemeName, setColorScheme } = LayoutConfigProvider.useLayoutConfig();
21
+ const label = elementProperties.readString(element, 'label', 'Theme');
22
+ const options = ThemeOption.readThemeOptions(element, ThemeOption.themeOptionsFor(defaultBlueprintThemes.defaultBlueprintThemes));
23
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
24
+ "data-scene-id": element.id,
25
+ children: [
26
+ /*#__PURE__*/ jsxRuntime.jsx("h3", {
27
+ className: "layout-config-section-title",
28
+ children: label
29
+ }),
30
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
31
+ className: "layout-config-options",
32
+ role: "group",
33
+ "aria-label": label,
34
+ children: options.map((option)=>/*#__PURE__*/ jsxRuntime.jsx("button", {
35
+ type: "button",
36
+ className: "layout-config-option",
37
+ "aria-pressed": config.themeName === option.name,
38
+ onClick: ()=>{
39
+ setThemeName(option.name);
40
+ setColorScheme(option.colorScheme);
41
+ },
42
+ children: option.label
43
+ }, option.name))
44
+ })
45
+ ]
46
+ });
47
+ }
48
+
49
+ exports.ThemeSwitcher = ThemeSwitcher;
50
+ //# sourceMappingURL=ThemeSwitcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ThemeSwitcher.js","sources":["../../../shell/ThemeSwitcher.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { useLayoutConfig } from '../configuration';\nimport { defaultBlueprintThemes } from '../themes';\nimport { readString } from './elementProperties';\nimport { readThemeOptions, themeOptionsFor } from './ThemeOption';\n\n/**\n * Switches between the themes a host offers.\n *\n * It records a name and a color scheme and nothing else - {@link LayoutThemeProvider} resolves the name\n * against the real theme set. That split is what makes switching live: the tokens are rewritten on the\n * element that already exists, so nothing below remounts and no form loses what was typed into it.\n */\nexport function ThemeSwitcher({ element }: RegisteredComponentProps) {\n const { config, setThemeName, setColorScheme } = useLayoutConfig();\n const label = readString(element, 'label', 'Theme');\n const options = readThemeOptions(element, themeOptionsFor(defaultBlueprintThemes));\n\n return (\n <div data-scene-id={element.id}>\n <h3 className='layout-config-section-title'>{label}</h3>\n <div className='layout-config-options' role='group' aria-label={label}>\n {options.map(option => (\n <button\n key={option.name}\n type='button'\n className='layout-config-option'\n aria-pressed={config.themeName === option.name}\n onClick={() => {\n setThemeName(option.name);\n setColorScheme(option.colorScheme);\n }}>\n {option.label}\n </button>\n ))}\n </div>\n </div>\n );\n}\n"],"names":["ThemeSwitcher","element","config","setThemeName","setColorScheme","useLayoutConfig","label","readString","options","readThemeOptions","themeOptionsFor","defaultBlueprintThemes","_jsxs","div","data-scene-id","id","_jsx","h3","className","role","aria-label","map","option","button","type","aria-pressed","themeName","name","onClick","colorScheme"],"mappings":";;;;;;;;;;AAAA;AACA;AAQA;;;;;;AAMC,IACM,SAASA,aAAAA,CAAc,EAAEC,OAAO,EAA4B,EAAA;AAC/D,IAAA,MAAM,EAAEC,MAAM,EAAEC,YAAY,EAAEC,cAAc,EAAE,GAAGC,oCAAAA,EAAAA;IACjD,MAAMC,KAAAA,GAAQC,4BAAAA,CAAWN,OAAAA,EAAS,OAAA,EAAS,OAAA,CAAA;IAC3C,MAAMO,OAAAA,GAAUC,4BAAAA,CAAiBR,OAAAA,EAASS,2BAAAA,CAAgBC,6CAAAA,CAAAA,CAAAA;AAE1D,IAAA,qBACIC,eAAA,CAACC,KAAAA,EAAAA;AAAIC,QAAAA,eAAAA,EAAeb,QAAQc,EAAE;;0BAC1BC,cAAA,CAACC,IAAAA,EAAAA;gBAAGC,SAAAA,EAAU,6BAAA;AAA+BZ,gBAAAA,QAAAA,EAAAA;;0BAC7CU,cAAA,CAACH,KAAAA,EAAAA;gBAAIK,SAAAA,EAAU,uBAAA;gBAAwBC,IAAAA,EAAK,OAAA;gBAAQC,YAAAA,EAAYd,KAAAA;AAC3DE,gBAAAA,QAAAA,EAAAA,OAAAA,CAAQa,GAAG,CAACC,CAAAA,MAAAA,iBACTN,cAAA,CAACO,QAAAA,EAAAA;wBAEGC,IAAAA,EAAK,QAAA;wBACLN,SAAAA,EAAU,sBAAA;AACVO,wBAAAA,cAAAA,EAAcvB,MAAAA,CAAOwB,SAAS,KAAKJ,MAAAA,CAAOK,IAAI;wBAC9CC,OAAAA,EAAS,IAAA;AACLzB,4BAAAA,YAAAA,CAAamB,OAAOK,IAAI,CAAA;AACxBvB,4BAAAA,cAAAA,CAAekB,OAAOO,WAAW,CAAA;AACrC,wBAAA,CAAA;AACCP,wBAAAA,QAAAA,EAAAA,MAAAA,CAAOhB;AARHgB,qBAAAA,EAAAA,MAAAA,CAAOK,IAAI,CAAA;;;;AAcxC;;;;"}
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var button = require('primereact/button');
5
+ var LayoutMode = require('../configuration/LayoutMode.js');
6
+ var LayoutConfigProvider = require('../configuration/LayoutConfigProvider.js');
7
+ var elementProperties = require('./elementProperties.js');
8
+
9
+ /**
10
+ * The fixed strip across the top of the application shell.
11
+ *
12
+ * It owns the one control every mode needs: the sidebar toggle. In `horizontal` mode it also hosts the
13
+ * menu itself, which is why the menu arrives here as a slot rather than being hard-wired into the
14
+ * sidebar - the same navigation markup has to be able to render in two places.
15
+ *
16
+ * The toggle hides itself in the rail modes, where there is nothing to toggle: `slim`, `slim-plus` and
17
+ * `compact` are always showing, `reveal` and `drawer` answer to the pointer and the pin, and `horizontal`
18
+ * has no sidebar at all. A button that does nothing is worse than no button.
19
+ */ function Topbar({ element, slots }) {
20
+ const { effectiveMode, config, toggleSidebar } = LayoutConfigProvider.useLayoutConfig();
21
+ const showsToggle = elementProperties.readBoolean(element, 'showToggle', true) && togglesSidebar(effectiveMode);
22
+ return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
23
+ children: [
24
+ /*#__PURE__*/ jsxRuntime.jsxs("div", {
25
+ className: "layout-topbar-start",
26
+ "data-scene-id": element.id,
27
+ children: [
28
+ showsToggle && /*#__PURE__*/ jsxRuntime.jsx(button.Button, {
29
+ type: "button",
30
+ text: true,
31
+ rounded: true,
32
+ icon: "pi pi-bars",
33
+ "aria-label": config.isSidebarOpen ? 'Close the menu' : 'Open the menu',
34
+ "aria-expanded": config.isSidebarOpen,
35
+ onClick: toggleSidebar
36
+ }),
37
+ slots.logo,
38
+ slots.start
39
+ ]
40
+ }),
41
+ slots.menu,
42
+ /*#__PURE__*/ jsxRuntime.jsx("div", {
43
+ className: "layout-topbar-end",
44
+ children: slots.end
45
+ })
46
+ ]
47
+ });
48
+ }
49
+ function togglesSidebar(mode) {
50
+ return mode === LayoutMode.LayoutMode.Static || mode === LayoutMode.LayoutMode.Overlay;
51
+ }
52
+
53
+ exports.Topbar = Topbar;
54
+ //# sourceMappingURL=Topbar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Topbar.js","sources":["../../../shell/Topbar.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Button } from 'primereact/button';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { LayoutMode, useLayoutConfig } from '../configuration';\nimport { readBoolean } from './elementProperties';\n\n/**\n * The fixed strip across the top of the application shell.\n *\n * It owns the one control every mode needs: the sidebar toggle. In `horizontal` mode it also hosts the\n * menu itself, which is why the menu arrives here as a slot rather than being hard-wired into the\n * sidebar - the same navigation markup has to be able to render in two places.\n *\n * The toggle hides itself in the rail modes, where there is nothing to toggle: `slim`, `slim-plus` and\n * `compact` are always showing, `reveal` and `drawer` answer to the pointer and the pin, and `horizontal`\n * has no sidebar at all. A button that does nothing is worse than no button.\n */\nexport function Topbar({ element, slots }: RegisteredComponentProps) {\n const { effectiveMode, config, toggleSidebar } = useLayoutConfig();\n const showsToggle = readBoolean(element, 'showToggle', true) && togglesSidebar(effectiveMode);\n\n return (\n <>\n <div className='layout-topbar-start' data-scene-id={element.id}>\n {showsToggle && (\n <Button\n type='button'\n text\n rounded\n icon='pi pi-bars'\n aria-label={config.isSidebarOpen ? 'Close the menu' : 'Open the menu'}\n aria-expanded={config.isSidebarOpen}\n onClick={toggleSidebar}\n />\n )}\n {slots.logo}\n {slots.start}\n </div>\n {slots.menu}\n <div className='layout-topbar-end'>{slots.end}</div>\n </>\n );\n}\n\nfunction togglesSidebar(mode: LayoutMode): boolean {\n return mode === LayoutMode.Static || mode === LayoutMode.Overlay;\n}\n"],"names":["Topbar","element","slots","effectiveMode","config","toggleSidebar","useLayoutConfig","showsToggle","readBoolean","togglesSidebar","_jsxs","_Fragment","div","className","data-scene-id","id","_jsx","Button","type","text","rounded","icon","aria-label","isSidebarOpen","aria-expanded","onClick","logo","start","menu","end","mode","LayoutMode","Static","Overlay"],"mappings":";;;;;;;;AAQA;;;;;;;;;;AAUC,IACM,SAASA,MAAAA,CAAO,EAAEC,OAAO,EAAEC,KAAK,EAA4B,EAAA;AAC/D,IAAA,MAAM,EAAEC,aAAa,EAAEC,MAAM,EAAEC,aAAa,EAAE,GAAGC,oCAAAA,EAAAA;AACjD,IAAA,MAAMC,WAAAA,GAAcC,6BAAAA,CAAYP,OAAAA,EAAS,YAAA,EAAc,SAASQ,cAAAA,CAAeN,aAAAA,CAAAA;IAE/E,qBACIO,eAAA,CAAAC,mBAAA,EAAA;;0BACID,eAAA,CAACE,KAAAA,EAAAA;gBAAIC,SAAAA,EAAU,qBAAA;AAAsBC,gBAAAA,eAAAA,EAAeb,QAAQc,EAAE;;AACzDR,oBAAAA,WAAAA,kBACGS,cAAA,CAACC,aAAAA,EAAAA;wBACGC,IAAAA,EAAK,QAAA;wBACLC,IAAI,EAAA,IAAA;wBACJC,OAAO,EAAA,IAAA;wBACPC,IAAAA,EAAK,YAAA;wBACLC,YAAAA,EAAYlB,MAAAA,CAAOmB,aAAa,GAAG,gBAAA,GAAmB,eAAA;AACtDC,wBAAAA,eAAAA,EAAepB,OAAOmB,aAAa;wBACnCE,OAAAA,EAASpB;;AAGhBH,oBAAAA,KAAAA,CAAMwB,IAAI;AACVxB,oBAAAA,KAAAA,CAAMyB;;;AAEVzB,YAAAA,KAAAA,CAAM0B,IAAI;0BACXZ,cAAA,CAACJ,KAAAA,EAAAA;gBAAIC,SAAAA,EAAU,mBAAA;AAAqBX,gBAAAA,QAAAA,EAAAA,KAAAA,CAAM2B;;;;AAGtD;AAEA,SAASpB,eAAeqB,IAAgB,EAAA;AACpC,IAAA,OAAOA,SAASC,qBAAAA,CAAWC,MAAM,IAAIF,IAAAA,KAASC,sBAAWE,OAAO;AACpE;;;;"}
@@ -0,0 +1,68 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var react = require('react');
5
+ var avatar = require('primereact/avatar');
6
+ var button = require('primereact/button');
7
+ var menu = require('primereact/menu');
8
+ var elementProperties = require('./elementProperties.js');
9
+
10
+ /**
11
+ * The signed-in user's avatar and menu.
12
+ *
13
+ * The popup is PrimeReact's `Menu` rather than hand-written markup: an overlay that positions itself,
14
+ * traps focus and closes on escape is framework behavior, and re-implementing it in a layout package is
15
+ * how a shell ends up with its own subtly broken menu. The shell hand-writes CSS only where PrimeReact 10
16
+ * has no primitive at all - the app-shell modes - and uses the library everywhere else.
17
+ */ function UserMenu({ element }) {
18
+ const menu$1 = react.useRef(null);
19
+ const name = elementProperties.readString(element, 'name');
20
+ const role = elementProperties.readString(element, 'role');
21
+ const initials = elementProperties.readString(element, 'initials', name.slice(0, 1).toUpperCase());
22
+ const items = elementProperties.readRecords(element, 'items').map((item)=>({
23
+ label: elementProperties.recordString(item, 'label'),
24
+ icon: elementProperties.recordString(item, 'icon') || undefined,
25
+ url: elementProperties.recordString(item, 'targetScreen') ? `#/${elementProperties.recordString(item, 'targetScreen')}` : undefined
26
+ }));
27
+ return /*#__PURE__*/ jsxRuntime.jsxs("div", {
28
+ className: "layout-user-menu",
29
+ "data-scene-id": element.id,
30
+ children: [
31
+ /*#__PURE__*/ jsxRuntime.jsx(avatar.Avatar, {
32
+ label: initials,
33
+ shape: "circle"
34
+ }),
35
+ /*#__PURE__*/ jsxRuntime.jsxs("span", {
36
+ className: "layout-user-menu-name",
37
+ children: [
38
+ /*#__PURE__*/ jsxRuntime.jsx("span", {
39
+ children: name
40
+ }),
41
+ role && /*#__PURE__*/ jsxRuntime.jsx("span", {
42
+ className: "layout-user-menu-role",
43
+ children: role
44
+ })
45
+ ]
46
+ }),
47
+ /*#__PURE__*/ jsxRuntime.jsx(menu.Menu, {
48
+ ref: menu$1,
49
+ model: items,
50
+ popup: true,
51
+ id: `${element.id}-menu`
52
+ }),
53
+ /*#__PURE__*/ jsxRuntime.jsx(button.Button, {
54
+ type: "button",
55
+ text: true,
56
+ rounded: true,
57
+ icon: "pi pi-angle-down",
58
+ "aria-label": `Open the menu for ${name}`,
59
+ "aria-controls": `${element.id}-menu`,
60
+ "aria-haspopup": true,
61
+ onClick: (event)=>menu$1.current?.toggle(event)
62
+ })
63
+ ]
64
+ });
65
+ }
66
+
67
+ exports.UserMenu = UserMenu;
68
+ //# sourceMappingURL=UserMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserMenu.js","sources":["../../../shell/UserMenu.tsx"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { useRef } from 'react';\nimport { Avatar } from 'primereact/avatar';\nimport { Button } from 'primereact/button';\nimport { Menu as PrimeMenu } from 'primereact/menu';\nimport { MenuItem as PrimeMenuItem } from 'primereact/menuitem';\nimport { RegisteredComponentProps } from '@cratis/scene.react';\nimport { readRecords, readString, recordString } from './elementProperties';\n\n/**\n * The signed-in user's avatar and menu.\n *\n * The popup is PrimeReact's `Menu` rather than hand-written markup: an overlay that positions itself,\n * traps focus and closes on escape is framework behavior, and re-implementing it in a layout package is\n * how a shell ends up with its own subtly broken menu. The shell hand-writes CSS only where PrimeReact 10\n * has no primitive at all - the app-shell modes - and uses the library everywhere else.\n */\nexport function UserMenu({ element }: RegisteredComponentProps) {\n const menu = useRef<PrimeMenu>(null);\n const name = readString(element, 'name');\n const role = readString(element, 'role');\n const initials = readString(element, 'initials', name.slice(0, 1).toUpperCase());\n const items = readRecords(element, 'items').map(\n (item): PrimeMenuItem => ({\n label: recordString(item, 'label'),\n icon: recordString(item, 'icon') || undefined,\n url: recordString(item, 'targetScreen') ? `#/${recordString(item, 'targetScreen')}` : undefined,\n }),\n );\n\n return (\n <div className='layout-user-menu' data-scene-id={element.id}>\n <Avatar label={initials} shape='circle' />\n <span className='layout-user-menu-name'>\n <span>{name}</span>\n {role && <span className='layout-user-menu-role'>{role}</span>}\n </span>\n <PrimeMenu ref={menu} model={items} popup id={`${element.id}-menu`} />\n <Button\n type='button'\n text\n rounded\n icon='pi pi-angle-down'\n aria-label={`Open the menu for ${name}`}\n aria-controls={`${element.id}-menu`}\n aria-haspopup\n onClick={event => menu.current?.toggle(event)}\n />\n </div>\n );\n}\n"],"names":["UserMenu","element","menu","useRef","name","readString","role","initials","slice","toUpperCase","items","readRecords","map","item","label","recordString","icon","undefined","url","_jsxs","div","className","data-scene-id","id","_jsx","Avatar","shape","span","PrimeMenu","ref","model","popup","Button","type","text","rounded","aria-label","aria-controls","aria-haspopup","onClick","event","current","toggle"],"mappings":";;;;;;;;;AAWA;;;;;;;AAOC,IACM,SAASA,QAAAA,CAAS,EAAEC,OAAO,EAA4B,EAAA;AAC1D,IAAA,MAAMC,SAAOC,YAAAA,CAAkB,IAAA,CAAA;IAC/B,MAAMC,IAAAA,GAAOC,6BAAWJ,OAAAA,EAAS,MAAA,CAAA;IACjC,MAAMK,IAAAA,GAAOD,6BAAWJ,OAAAA,EAAS,MAAA,CAAA;IACjC,MAAMM,QAAAA,GAAWF,6BAAWJ,OAAAA,EAAS,UAAA,EAAYG,KAAKI,KAAK,CAAC,CAAA,EAAG,CAAA,CAAA,CAAGC,WAAW,EAAA,CAAA;IAC7E,MAAMC,KAAAA,GAAQC,8BAAYV,OAAAA,EAAS,OAAA,CAAA,CAASW,GAAG,CAC3C,CAACC,QAAyB;AACtBC,YAAAA,KAAAA,EAAOC,+BAAaF,IAAAA,EAAM,OAAA,CAAA;YAC1BG,IAAAA,EAAMD,8BAAAA,CAAaF,MAAM,MAAA,CAAA,IAAWI,SAAAA;YACpCC,GAAAA,EAAKH,8BAAAA,CAAaF,MAAM,cAAA,CAAA,GAAkB,CAAC,EAAE,EAAEE,8BAAAA,CAAaF,IAAAA,EAAM,cAAA,CAAA,CAAA,CAAiB,GAAGI;SAC1F,CAAA,CAAA;AAGJ,IAAA,qBACIE,eAAA,CAACC,KAAAA,EAAAA;QAAIC,SAAAA,EAAU,kBAAA;AAAmBC,QAAAA,eAAAA,EAAerB,QAAQsB,EAAE;;0BACvDC,cAAA,CAACC,aAAAA,EAAAA;gBAAOX,KAAAA,EAAOP,QAAAA;gBAAUmB,KAAAA,EAAM;;0BAC/BP,eAAA,CAACQ,MAAAA,EAAAA;gBAAKN,SAAAA,EAAU,uBAAA;;kCACZG,cAAA,CAACG,MAAAA,EAAAA;AAAMvB,wBAAAA,QAAAA,EAAAA;;AACNE,oBAAAA,IAAAA,kBAAQkB,cAAA,CAACG,MAAAA,EAAAA;wBAAKN,SAAAA,EAAU,uBAAA;AAAyBf,wBAAAA,QAAAA,EAAAA;;;;0BAEtDkB,cAAA,CAACI,SAAAA,EAAAA;gBAAUC,GAAAA,EAAK3B,MAAAA;gBAAM4B,KAAAA,EAAOpB,KAAAA;gBAAOqB,KAAK,EAAA,IAAA;AAACR,gBAAAA,EAAAA,EAAI,CAAA,EAAGtB,OAAAA,CAAQsB,EAAE,CAAC,KAAK;;0BACjEC,cAAA,CAACQ,aAAAA,EAAAA;gBACGC,IAAAA,EAAK,QAAA;gBACLC,IAAI,EAAA,IAAA;gBACJC,OAAO,EAAA,IAAA;gBACPnB,IAAAA,EAAK,kBAAA;gBACLoB,YAAAA,EAAY,CAAC,kBAAkB,EAAEhC,IAAAA,CAAAA,CAAM;AACvCiC,gBAAAA,eAAAA,EAAe,CAAA,EAAGpC,OAAAA,CAAQsB,EAAE,CAAC,KAAK,CAAC;gBACnCe,eAAa,EAAA,IAAA;AACbC,gBAAAA,OAAAA,EAASC,CAAAA,KAAAA,GAAStC,MAAAA,CAAKuC,OAAO,EAAEC,MAAAA,CAAOF,KAAAA;;;;AAIvD;;;;"}
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+
3
+ // Copyright (c) Cratis. All rights reserved.
4
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
5
+ /**
6
+ * Typed reads out of a {@link SceneElement}'s open `properties` bag.
7
+ *
8
+ * The bag is `Record<string, unknown>` by design - it carries whatever a page template author wrote, and
9
+ * Scene never re-validates it. A shell component that trusts it and reads `properties.label as string`
10
+ * renders `[object Object]` or crashes the moment a template has a typo, so every read goes through one of
11
+ * these instead and falls back to something renderable.
12
+ */ /** Reads a string property, or the fallback when it is absent or not a string. */ function readString(element, name, fallback = '') {
13
+ const value = element.properties[name];
14
+ return typeof value === 'string' ? value : fallback;
15
+ }
16
+ /** Reads an optional string property, or `undefined` when it is absent or not a string. */ function readOptionalString(element, name) {
17
+ const value = element.properties[name];
18
+ return typeof value === 'string' ? value : undefined;
19
+ }
20
+ /** Reads a boolean property, or the fallback when it is absent or not a boolean. */ function readBoolean(element, name, fallback = false) {
21
+ const value = element.properties[name];
22
+ return typeof value === 'boolean' ? value : fallback;
23
+ }
24
+ /** Reads a number property, or the fallback when it is absent or not a number. */ function readNumber(element, name, fallback = 0) {
25
+ const value = element.properties[name];
26
+ return typeof value === 'number' ? value : fallback;
27
+ }
28
+ /** Reads an array of strings, or an empty array when the property is absent or holds anything else. */ function readStrings(element, name) {
29
+ const value = element.properties[name];
30
+ return Array.isArray(value) ? value.filter((entry)=>typeof entry === 'string') : [];
31
+ }
32
+ /**
33
+ * Reads an array of objects - a breadcrumb trail, a set of table columns, a user menu's items.
34
+ *
35
+ * Entries that are not objects are dropped rather than rendered, for the same reason the scalar reads
36
+ * fall back: half a table is a better failure than a thrown render.
37
+ */ function readRecords(element, name) {
38
+ const value = element.properties[name];
39
+ if (!Array.isArray(value)) {
40
+ return [];
41
+ }
42
+ return value.filter((entry)=>typeof entry === 'object' && entry !== null && !Array.isArray(entry));
43
+ }
44
+ /** Reads a string out of one of {@link readRecords}' entries. */ function recordString(record, name, fallback = '') {
45
+ const value = record[name];
46
+ return typeof value === 'string' ? value : fallback;
47
+ }
48
+
49
+ exports.readBoolean = readBoolean;
50
+ exports.readNumber = readNumber;
51
+ exports.readOptionalString = readOptionalString;
52
+ exports.readRecords = readRecords;
53
+ exports.readString = readString;
54
+ exports.readStrings = readStrings;
55
+ exports.recordString = recordString;
56
+ //# sourceMappingURL=elementProperties.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elementProperties.js","sources":["../../../shell/elementProperties.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ExternalComponent } from '@cratis/scene.model';\n\n/**\n * Typed reads out of a {@link SceneElement}'s open `properties` bag.\n *\n * The bag is `Record<string, unknown>` by design - it carries whatever a page template author wrote, and\n * Scene never re-validates it. A shell component that trusts it and reads `properties.label as string`\n * renders `[object Object]` or crashes the moment a template has a typo, so every read goes through one of\n * these instead and falls back to something renderable.\n */\n\n/** Reads a string property, or the fallback when it is absent or not a string. */\nexport function readString(element: ExternalComponent, name: string, fallback = ''): string {\n const value = element.properties[name];\n return typeof value === 'string' ? value : fallback;\n}\n\n/** Reads an optional string property, or `undefined` when it is absent or not a string. */\nexport function readOptionalString(element: ExternalComponent, name: string): string | undefined {\n const value = element.properties[name];\n return typeof value === 'string' ? value : undefined;\n}\n\n/** Reads a boolean property, or the fallback when it is absent or not a boolean. */\nexport function readBoolean(element: ExternalComponent, name: string, fallback = false): boolean {\n const value = element.properties[name];\n return typeof value === 'boolean' ? value : fallback;\n}\n\n/** Reads a number property, or the fallback when it is absent or not a number. */\nexport function readNumber(element: ExternalComponent, name: string, fallback = 0): number {\n const value = element.properties[name];\n return typeof value === 'number' ? value : fallback;\n}\n\n/** Reads an array of strings, or an empty array when the property is absent or holds anything else. */\nexport function readStrings(element: ExternalComponent, name: string): string[] {\n const value = element.properties[name];\n return Array.isArray(value) ? value.filter((entry): entry is string => typeof entry === 'string') : [];\n}\n\n/**\n * Reads an array of objects - a breadcrumb trail, a set of table columns, a user menu's items.\n *\n * Entries that are not objects are dropped rather than rendered, for the same reason the scalar reads\n * fall back: half a table is a better failure than a thrown render.\n */\nexport function readRecords(element: ExternalComponent, name: string): Record<string, unknown>[] {\n const value = element.properties[name];\n if (!Array.isArray(value)) {\n return [];\n }\n\n return value.filter((entry): entry is Record<string, unknown> => typeof entry === 'object' && entry !== null && !Array.isArray(entry));\n}\n\n/** Reads a string out of one of {@link readRecords}' entries. */\nexport function recordString(record: Record<string, unknown>, name: string, fallback = ''): string {\n const value = record[name];\n return typeof value === 'string' ? value : fallback;\n}\n"],"names":["readString","element","name","fallback","value","properties","readOptionalString","undefined","readBoolean","readNumber","readStrings","Array","isArray","filter","entry","readRecords","recordString","record"],"mappings":";;AAAA;AACA;AAIA;;;;;;;uFAUO,SAASA,UAAAA,CAAWC,OAA0B,EAAEC,IAAY,EAAEC,QAAAA,GAAW,EAAE,EAAA;AAC9E,IAAA,MAAMC,KAAAA,GAAQH,OAAAA,CAAQI,UAAU,CAACH,IAAAA,CAAK;IACtC,OAAO,OAAOE,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQD,QAAAA;AAC/C;AAEA,4FACO,SAASG,kBAAAA,CAAmBL,OAA0B,EAAEC,IAAY,EAAA;AACvE,IAAA,MAAME,KAAAA,GAAQH,OAAAA,CAAQI,UAAU,CAACH,IAAAA,CAAK;IACtC,OAAO,OAAOE,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQG,SAAAA;AAC/C;AAEA,qFACO,SAASC,WAAAA,CAAYP,OAA0B,EAAEC,IAAY,EAAEC,QAAAA,GAAW,KAAK,EAAA;AAClF,IAAA,MAAMC,KAAAA,GAAQH,OAAAA,CAAQI,UAAU,CAACH,IAAAA,CAAK;IACtC,OAAO,OAAOE,KAAAA,KAAU,SAAA,GAAYA,KAAAA,GAAQD,QAAAA;AAChD;AAEA,mFACO,SAASM,UAAAA,CAAWR,OAA0B,EAAEC,IAAY,EAAEC,QAAAA,GAAW,CAAC,EAAA;AAC7E,IAAA,MAAMC,KAAAA,GAAQH,OAAAA,CAAQI,UAAU,CAACH,IAAAA,CAAK;IACtC,OAAO,OAAOE,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQD,QAAAA;AAC/C;AAEA,wGACO,SAASO,WAAAA,CAAYT,OAA0B,EAAEC,IAAY,EAAA;AAChE,IAAA,MAAME,KAAAA,GAAQH,OAAAA,CAAQI,UAAU,CAACH,IAAAA,CAAK;AACtC,IAAA,OAAOS,KAAAA,CAAMC,OAAO,CAACR,KAAAA,CAAAA,GAASA,KAAAA,CAAMS,MAAM,CAAC,CAACC,KAAAA,GAA2B,OAAOA,KAAAA,KAAU,QAAA,CAAA,GAAY,EAAE;AAC1G;AAEA;;;;;AAKC,IACM,SAASC,WAAAA,CAAYd,OAA0B,EAAEC,IAAY,EAAA;AAChE,IAAA,MAAME,KAAAA,GAAQH,OAAAA,CAAQI,UAAU,CAACH,IAAAA,CAAK;AACtC,IAAA,IAAI,CAACS,KAAAA,CAAMC,OAAO,CAACR,KAAAA,CAAAA,EAAQ;AACvB,QAAA,OAAO,EAAE;AACb,IAAA;AAEA,IAAA,OAAOA,KAAAA,CAAMS,MAAM,CAAC,CAACC,KAAAA,GAA4C,OAAOA,KAAAA,KAAU,QAAA,IAAYA,KAAAA,KAAU,IAAA,IAAQ,CAACH,KAAAA,CAAMC,OAAO,CAACE,KAAAA,CAAAA,CAAAA;AACnI;AAEA,kEACO,SAASE,YAAAA,CAAaC,MAA+B,EAAEf,IAAY,EAAEC,QAAAA,GAAW,EAAE,EAAA;IACrF,MAAMC,KAAAA,GAAQa,MAAM,CAACf,IAAAA,CAAK;IAC1B,OAAO,OAAOE,KAAAA,KAAU,QAAA,GAAWA,KAAAA,GAAQD,QAAAA;AAC/C;;;;;;;;;;"}