@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,131 @@
1
+ import { ComponentName } from '../ComponentName.js';
2
+ import { SlotName } from '../layouts/SlotName.js';
3
+ import '@cratis/scene.model';
4
+ import '../layouts/shellComponents.js';
5
+ import '../layouts/appShell.js';
6
+ import '../layouts/fullPage.js';
7
+ import { defaultBlueprintThemes } from '../themes/defaultBlueprintThemes.js';
8
+ import 'react/jsx-runtime';
9
+ import 'react';
10
+ import '@cratis/scene.react';
11
+ import { externalComponent } from './elements.js';
12
+ import { navigationGroups, entriesInGroup, navigationElement } from './navigation.js';
13
+
14
+ // Copyright (c) Cratis. All rights reserved.
15
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
16
+ /**
17
+ * The chrome every screen in the application shell shares: the topbar, the sidebar, the menu, the footer
18
+ * and the configurator.
19
+ *
20
+ * It is built once, per screen, rather than repeated in twenty templates. A screen template describes what
21
+ * is *different* about a screen; if it also had to describe the topbar, then adding an item to the menu
22
+ * would mean editing twenty files, and nineteen of them would eventually be missed.
23
+ */ /** The brand mark, shared by the topbar and the sidebar header. */ function logo(id) {
24
+ return externalComponent(id, ComponentName.Logo, {
25
+ label: 'Contoso',
26
+ initials: 'C',
27
+ targetScreen: 'Dashboard'
28
+ });
29
+ }
30
+ /** One menu section per navigation group, each holding that group's entries. */ function menuSections(activeScreen) {
31
+ return navigationGroups.map((group)=>externalComponent(`menu-${group.toLowerCase()}`, ComponentName.Menu, {
32
+ title: group,
33
+ label: group
34
+ }, {
35
+ items: entriesInGroup(group).map((entry)=>navigationElement(entry, activeScreen))
36
+ }));
37
+ }
38
+ /** The configurator, offering the themes this blueprint ships. */ function configPanel() {
39
+ return externalComponent(ComponentName.ConfigPanel, ComponentName.ConfigPanel, {
40
+ title: 'Settings',
41
+ themes: defaultBlueprintThemes.map((theme)=>({
42
+ name: theme.name,
43
+ label: theme.name,
44
+ isDark: theme.isDark ?? false
45
+ }))
46
+ });
47
+ }
48
+ /**
49
+ * The application shell's slot content for one screen.
50
+ *
51
+ * Only the breadcrumb and which menu entry is marked active differ from screen to screen - everything else
52
+ * is identical, which is the point of chrome.
53
+ *
54
+ * @param activeScreen The screen being rendered, so its menu entry is marked current.
55
+ * @param breadcrumb The trail above the content.
56
+ * @returns Slot content keyed by the {@link SlotName}s the `AppShell` layout declares.
57
+ */ function applicationChrome(activeScreen, breadcrumb) {
58
+ return {
59
+ [SlotName.Topbar]: [
60
+ externalComponent('topbar', ComponentName.Topbar, {}, {
61
+ logo: [
62
+ logo('topbar-logo')
63
+ ],
64
+ end: [
65
+ externalComponent('topbar-user', ComponentName.UserMenu, {
66
+ name: 'Amelia Nyquist',
67
+ role: 'Owner',
68
+ initials: 'AN',
69
+ items: [
70
+ {
71
+ label: 'Your profile',
72
+ icon: 'pi pi-user',
73
+ targetScreen: 'ProfileSettings'
74
+ },
75
+ {
76
+ label: 'Help',
77
+ icon: 'pi pi-question-circle',
78
+ targetScreen: 'Help'
79
+ },
80
+ {
81
+ label: 'Lock',
82
+ icon: 'pi pi-lock',
83
+ targetScreen: 'LockScreen'
84
+ }
85
+ ]
86
+ })
87
+ ]
88
+ })
89
+ ],
90
+ [SlotName.Sidebar]: [
91
+ externalComponent('sidebar', ComponentName.Sidebar, {
92
+ title: 'Contoso'
93
+ }, {
94
+ logo: [
95
+ logo('sidebar-logo')
96
+ ]
97
+ })
98
+ ],
99
+ [SlotName.Menu]: menuSections(activeScreen),
100
+ [SlotName.Breadcrumb]: [
101
+ externalComponent('breadcrumb', ComponentName.Breadcrumb, {
102
+ homeTargetScreen: 'Dashboard',
103
+ items: breadcrumb
104
+ })
105
+ ],
106
+ [SlotName.Footer]: [
107
+ externalComponent('footer', ComponentName.Footer, {
108
+ text: '© Contoso · Built with Cratis Scene'
109
+ })
110
+ ],
111
+ [SlotName.ConfigPanel]: [
112
+ configPanel()
113
+ ]
114
+ };
115
+ }
116
+ /**
117
+ * The full-page shell's slot content: the configurator and nothing else.
118
+ *
119
+ * A sign-in screen has no navigation to render, but it does have to honor the chosen theme - it is very
120
+ * often the first page anyone sees, and arriving at a light sign-in page before a dark application is a
121
+ * jarring way to start.
122
+ */ function fullPageChrome() {
123
+ return {
124
+ [SlotName.ConfigPanel]: [
125
+ configPanel()
126
+ ]
127
+ };
128
+ }
129
+
130
+ export { applicationChrome, fullPageChrome };
131
+ //# sourceMappingURL=applicationChrome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applicationChrome.js","sources":["../../../gallery/applicationChrome.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 { SceneElement } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { SlotName } from '../layouts';\nimport { defaultBlueprintThemes } from '../themes';\nimport { externalComponent } from './elements';\nimport { entriesInGroup, navigationElement, navigationGroups } from './navigation';\n\n/**\n * The chrome every screen in the application shell shares: the topbar, the sidebar, the menu, the footer\n * and the configurator.\n *\n * It is built once, per screen, rather than repeated in twenty templates. A screen template describes what\n * is *different* about a screen; if it also had to describe the topbar, then adding an item to the menu\n * would mean editing twenty files, and nineteen of them would eventually be missed.\n */\n\n/** The brand mark, shared by the topbar and the sidebar header. */\nfunction logo(id: string): SceneElement {\n return externalComponent(id, ComponentName.Logo, { label: 'Contoso', initials: 'C', targetScreen: 'Dashboard' });\n}\n\n/** One menu section per navigation group, each holding that group's entries. */\nfunction menuSections(activeScreen: string): SceneElement[] {\n return navigationGroups.map(group =>\n externalComponent(\n `menu-${group.toLowerCase()}`,\n ComponentName.Menu,\n { title: group, label: group },\n { items: entriesInGroup(group).map(entry => navigationElement(entry, activeScreen)) },\n ),\n );\n}\n\n/** The configurator, offering the themes this blueprint ships. */\nfunction configPanel(): SceneElement {\n return externalComponent(ComponentName.ConfigPanel, ComponentName.ConfigPanel, {\n title: 'Settings',\n themes: defaultBlueprintThemes.map(theme => ({ name: theme.name, label: theme.name, isDark: theme.isDark ?? false })),\n });\n}\n\n/** One trail entry: a label, and the screen it goes back to. */\nexport interface BreadcrumbEntry {\n /** What the entry is called. */\n label: string;\n\n /** The screen it navigates back to, or undefined for the current page. */\n targetScreen?: string;\n}\n\n/**\n * The application shell's slot content for one screen.\n *\n * Only the breadcrumb and which menu entry is marked active differ from screen to screen - everything else\n * is identical, which is the point of chrome.\n *\n * @param activeScreen The screen being rendered, so its menu entry is marked current.\n * @param breadcrumb The trail above the content.\n * @returns Slot content keyed by the {@link SlotName}s the `AppShell` layout declares.\n */\nexport function applicationChrome(activeScreen: string, breadcrumb: BreadcrumbEntry[]): Record<string, SceneElement[]> {\n return {\n [SlotName.Topbar]: [\n externalComponent(\n 'topbar',\n ComponentName.Topbar,\n {},\n {\n logo: [logo('topbar-logo')],\n end: [\n externalComponent('topbar-user', ComponentName.UserMenu, {\n name: 'Amelia Nyquist',\n role: 'Owner',\n initials: 'AN',\n items: [\n { label: 'Your profile', icon: 'pi pi-user', targetScreen: 'ProfileSettings' },\n { label: 'Help', icon: 'pi pi-question-circle', targetScreen: 'Help' },\n { label: 'Lock', icon: 'pi pi-lock', targetScreen: 'LockScreen' },\n ],\n }),\n ],\n },\n ),\n ],\n [SlotName.Sidebar]: [externalComponent('sidebar', ComponentName.Sidebar, { title: 'Contoso' }, { logo: [logo('sidebar-logo')] })],\n [SlotName.Menu]: menuSections(activeScreen),\n [SlotName.Breadcrumb]: [\n externalComponent('breadcrumb', ComponentName.Breadcrumb, {\n homeTargetScreen: 'Dashboard',\n items: breadcrumb,\n }),\n ],\n [SlotName.Footer]: [externalComponent('footer', ComponentName.Footer, { text: '© Contoso · Built with Cratis Scene' })],\n [SlotName.ConfigPanel]: [configPanel()],\n };\n}\n\n/**\n * The full-page shell's slot content: the configurator and nothing else.\n *\n * A sign-in screen has no navigation to render, but it does have to honor the chosen theme - it is very\n * often the first page anyone sees, and arriving at a light sign-in page before a dark application is a\n * jarring way to start.\n */\nexport function fullPageChrome(): Record<string, SceneElement[]> {\n return { [SlotName.ConfigPanel]: [configPanel()] };\n}\n"],"names":["logo","id","externalComponent","ComponentName","Logo","label","initials","targetScreen","menuSections","activeScreen","navigationGroups","map","group","toLowerCase","Menu","title","items","entriesInGroup","entry","navigationElement","configPanel","ConfigPanel","themes","defaultBlueprintThemes","theme","name","isDark","applicationChrome","breadcrumb","SlotName","Topbar","end","UserMenu","role","icon","Sidebar","Breadcrumb","homeTargetScreen","Footer","text","fullPageChrome"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AASA;;;;;;;AAOC,wEAGD,SAASA,IAAAA,CAAKC,EAAU,EAAA;AACpB,IAAA,OAAOC,iBAAAA,CAAkBD,EAAAA,EAAIE,aAAAA,CAAcC,IAAI,EAAE;QAAEC,KAAAA,EAAO,SAAA;QAAWC,QAAAA,EAAU,GAAA;QAAKC,YAAAA,EAAc;AAAY,KAAA,CAAA;AAClH;AAEA,iFACA,SAASC,YAAAA,CAAaC,YAAoB,EAAA;AACtC,IAAA,OAAOC,gBAAAA,CAAiBC,GAAG,CAACC,CAAAA,QACxBV,iBAAAA,CACI,CAAC,KAAK,EAAEU,MAAMC,WAAW,EAAA,CAAA,CAAI,EAC7BV,aAAAA,CAAcW,IAAI,EAClB;YAAEC,KAAAA,EAAOH,KAAAA;YAAOP,KAAAA,EAAOO;SAAM,EAC7B;AAAEI,YAAAA,KAAAA,EAAOC,eAAeL,KAAAA,CAAAA,CAAOD,GAAG,C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gCAAc3B,YAAAA,EAAc;AAAa;AACnE;AACL,qBAAA;AACH;AACL,aAAA;AAEP,SAAA;QACD,CAACsB,QAAAA,CAASM,OAAO,GAAG;YAACjC,iBAAAA,CAAkB,SAAA,EAAWC,aAAAA,CAAcgC,OAAO,EAAE;gBAAEpB,KAAAA,EAAO;aAAU,EAAG;gBAAEf,IAAAA,EAAM;oBAACA,IAAAA,CAAK,cAAA;AAAgB;AAAC,aAAA;AAAG,SAAA;AACjI,QAAA,CAAC6B,QAAAA,CAASf,IAAI,GAAGN,YAAAA,CAAaC,YAAAA,CAAAA;QAC9B,CAACoB,QAAAA,CAASO,UAAU,GAAG;YACnBlC,iBAAAA,CAAkB,YAAA,EAAcC,aAAAA,CAAciC,UAAU,EAAE;gBACtDC,gBAAAA,EAAkB,WAAA;gBAClBrB,KAAAA,EAAOY;AACX,aAAA;AACH,SAAA;QACD,CAACC,QAAAA,CAASS,MAAM,GAAG;YAACpC,iBAAAA,CAAkB,QAAA,EAAUC,aAAAA,CAAcmC,MAAM,EAAE;gBAAEC,IAAAA,EAAM;AAAsC,aAAA;AAAG,SAAA;QACvH,CAACV,QAAAA,CAASR,WAAW,GAAG;AAACD,YAAAA,WAAAA;AAAc;AAC3C,KAAA;AACJ;AAEA;;;;;;AAMC,IACM,SAASoB,cAAAA,GAAAA;IACZ,OAAO;QAAE,CAACX,QAAAA,CAASR,WAAW,GAAG;AAACD,YAAAA,WAAAA;AAAc;AAAC,KAAA;AACrD;;;;"}
@@ -0,0 +1,9 @@
1
+ import { ScreenTemplate } from '@cratis/scene.model';
2
+ export declare const loginTemplate: ScreenTemplate;
3
+ export declare const registerTemplate: ScreenTemplate;
4
+ export declare const forgotPasswordTemplate: ScreenTemplate;
5
+ export declare const newPasswordTemplate: ScreenTemplate;
6
+ export declare const verificationTemplate: ScreenTemplate;
7
+ export declare const lockScreenTemplate: ScreenTemplate;
8
+ export declare const authTemplates: ScreenTemplate[];
9
+ //# sourceMappingURL=authTemplates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authTemplates.d.ts","sourceRoot":"","sources":["../../../gallery/authTemplates.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA2BrD,eAAO,MAAM,aAAa,EAAE,cAmB3B,CAAC;AAGF,eAAO,MAAM,gBAAgB,EAAE,cAmB9B,CAAC;AAGF,eAAO,MAAM,sBAAsB,EAAE,cAgBpC,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,cAiBjC,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,cAiBlC,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,cAiBhC,CAAC;AAGF,eAAO,MAAM,aAAa,EAAE,cAAc,EAOzC,CAAC"}
@@ -0,0 +1,226 @@
1
+ import { ComponentName } from '../ComponentName.js';
2
+ import { SlotName } from '../layouts/SlotName.js';
3
+ import '@cratis/scene.model';
4
+ import '../layouts/shellComponents.js';
5
+ import '../layouts/appShell.js';
6
+ import '../layouts/fullPage.js';
7
+ import { TemplateSlotName } from './TemplateSlotName.js';
8
+ import { card, text, button, externalComponent } from './elements.js';
9
+ import { field, formActions } from './widgets.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
+ * The six screens that stand between someone and the application: sign in, register, forgotten password,
15
+ * new password, verification and the lock screen.
16
+ *
17
+ * All six fit the full-page layout's `content` slot and fill its `aside` with the branding half. That
18
+ * split - a colored panel of brand next to a narrow column of form - is the shape the premium PrimeTek
19
+ * templates use for every one of them, and the reason it works is that it gives the form somewhere to be
20
+ * *small*, which is what a sign-in form should be.
21
+ */ /** The branding half every authentication screen shares. */ function brandingAside(id, headline, supporting) {
22
+ return [
23
+ externalComponent(`${id}-logo`, ComponentName.Logo, {
24
+ label: 'Contoso',
25
+ initials: 'C'
26
+ }),
27
+ text(`${id}-headline`, headline),
28
+ text(`${id}-supporting`, supporting)
29
+ ];
30
+ }
31
+ /** Sign in. */ const loginTemplate = {
32
+ name: 'Login',
33
+ fitsSlot: SlotName.Content,
34
+ slots: [
35
+ {
36
+ name: SlotName.Aside
37
+ },
38
+ {
39
+ name: TemplateSlotName.Body
40
+ }
41
+ ],
42
+ content: {
43
+ [SlotName.Aside]: brandingAside('login', 'Welcome back', 'Everything your team shipped since you were last here is waiting.'),
44
+ [TemplateSlotName.Body]: [
45
+ card('login-card', [
46
+ text('login-title', 'Sign in'),
47
+ field('login-email', 'Email', 'inputText', {
48
+ placeholder: 'you@contoso.com'
49
+ }),
50
+ field('login-password', 'Password', 'password', {
51
+ feedback: false
52
+ }),
53
+ field('login-remember', 'Keep me signed in', 'checkbox', {}),
54
+ formActions('login-actions', 'Sign in', 'Use a different account'),
55
+ button('login-forgot', 'I forgot my password', {
56
+ link: true,
57
+ targetScreen: 'ForgotPassword'
58
+ })
59
+ ])
60
+ ]
61
+ },
62
+ displayName: 'Sign in',
63
+ description: 'Email and password beside the branding panel.'
64
+ };
65
+ /** Register. */ const registerTemplate = {
66
+ name: 'Register',
67
+ fitsSlot: SlotName.Content,
68
+ slots: [
69
+ {
70
+ name: SlotName.Aside
71
+ },
72
+ {
73
+ name: TemplateSlotName.Body
74
+ }
75
+ ],
76
+ content: {
77
+ [SlotName.Aside]: brandingAside('register', 'Start in two minutes', 'No card, no call, no sales engineer. Just an account.'),
78
+ [TemplateSlotName.Body]: [
79
+ card('register-card', [
80
+ text('register-title', 'Create your account'),
81
+ field('register-name', 'Full name', 'inputText', {}),
82
+ field('register-email', 'Work email', 'inputText', {
83
+ placeholder: 'you@contoso.com'
84
+ }),
85
+ field('register-password', 'Password', 'password', {
86
+ feedback: true
87
+ }),
88
+ field('register-terms', 'I accept the terms of service', 'checkbox', {}),
89
+ formActions('register-actions', 'Create account', 'I already have one')
90
+ ])
91
+ ]
92
+ },
93
+ displayName: 'Register',
94
+ description: 'Account creation with a password strength meter and the terms checkbox.'
95
+ };
96
+ /** Forgotten password: ask for the address. */ const forgotPasswordTemplate = {
97
+ name: 'ForgotPassword',
98
+ fitsSlot: SlotName.Content,
99
+ slots: [
100
+ {
101
+ name: SlotName.Aside
102
+ },
103
+ {
104
+ name: TemplateSlotName.Body
105
+ }
106
+ ],
107
+ content: {
108
+ [SlotName.Aside]: brandingAside('forgot', 'It happens', 'Tell us the address you signed up with and we will send a link.'),
109
+ [TemplateSlotName.Body]: [
110
+ card('forgot-card', [
111
+ text('forgot-title', 'Reset your password'),
112
+ field('forgot-email', 'Email', 'inputText', {
113
+ placeholder: 'you@contoso.com'
114
+ }),
115
+ formActions('forgot-actions', 'Send the link', 'Back to sign in')
116
+ ])
117
+ ]
118
+ },
119
+ displayName: 'Forgotten password',
120
+ description: 'One field and one button - the whole point is that it asks for nothing else.'
121
+ };
122
+ /** New password: the other end of the link. */ const newPasswordTemplate = {
123
+ name: 'NewPassword',
124
+ fitsSlot: SlotName.Content,
125
+ slots: [
126
+ {
127
+ name: SlotName.Aside
128
+ },
129
+ {
130
+ name: TemplateSlotName.Body
131
+ }
132
+ ],
133
+ content: {
134
+ [SlotName.Aside]: brandingAside('new-password', 'Almost there', 'Choose something you have not used anywhere else.'),
135
+ [TemplateSlotName.Body]: [
136
+ card('new-password-card', [
137
+ text('new-password-title', 'Choose a new password'),
138
+ field('new-password-value', 'New password', 'password', {
139
+ feedback: true
140
+ }),
141
+ field('new-password-confirm', 'Confirm it', 'password', {
142
+ feedback: false
143
+ }),
144
+ formActions('new-password-actions', 'Set the password', 'Cancel')
145
+ ])
146
+ ]
147
+ },
148
+ displayName: 'New password',
149
+ description: 'Where a reset link lands: choose it, confirm it, done.'
150
+ };
151
+ /** Verification: the code from the email. */ const verificationTemplate = {
152
+ name: 'Verification',
153
+ fitsSlot: SlotName.Content,
154
+ slots: [
155
+ {
156
+ name: SlotName.Aside
157
+ },
158
+ {
159
+ name: TemplateSlotName.Body
160
+ }
161
+ ],
162
+ content: {
163
+ [SlotName.Aside]: brandingAside('verification', 'Check your email', 'We sent a six-digit code. It expires in ten minutes.'),
164
+ [TemplateSlotName.Body]: [
165
+ card('verification-card', [
166
+ text('verification-title', 'Enter the code'),
167
+ externalComponent('verification-steps', 'steps', {
168
+ model: [
169
+ 'Account',
170
+ 'Verify',
171
+ 'Done'
172
+ ],
173
+ activeIndex: 1
174
+ }),
175
+ field('verification-code', 'Six-digit code', 'inputText', {
176
+ maxLength: 6
177
+ }),
178
+ formActions('verification-actions', 'Verify', 'Send it again')
179
+ ])
180
+ ]
181
+ },
182
+ displayName: 'Verification',
183
+ description: 'The code step, with the progress indicator that tells you how much is left.'
184
+ };
185
+ /** Lock screen: the session is still there, the person has to prove they are. */ const lockScreenTemplate = {
186
+ name: 'LockScreen',
187
+ fitsSlot: SlotName.Content,
188
+ slots: [
189
+ {
190
+ name: SlotName.Aside
191
+ },
192
+ {
193
+ name: TemplateSlotName.Body
194
+ }
195
+ ],
196
+ content: {
197
+ [SlotName.Aside]: brandingAside('lock', 'Locked', 'Your work is exactly where you left it.'),
198
+ [TemplateSlotName.Body]: [
199
+ card('lock-card', [
200
+ externalComponent('lock-avatar', 'avatar', {
201
+ label: 'AN',
202
+ size: 'xlarge',
203
+ shape: 'circle'
204
+ }),
205
+ text('lock-name', 'Amelia Nyquist'),
206
+ field('lock-password', 'Password', 'password', {
207
+ feedback: false
208
+ }),
209
+ formActions('lock-actions', 'Unlock', 'Sign in as someone else')
210
+ ])
211
+ ]
212
+ },
213
+ displayName: 'Lock screen',
214
+ description: 'One person, one password, and no way to lose what was open.'
215
+ };
216
+ /** The six authentication templates. */ const authTemplates = [
217
+ loginTemplate,
218
+ registerTemplate,
219
+ forgotPasswordTemplate,
220
+ newPasswordTemplate,
221
+ verificationTemplate,
222
+ lockScreenTemplate
223
+ ];
224
+
225
+ export { authTemplates, forgotPasswordTemplate, lockScreenTemplate, loginTemplate, newPasswordTemplate, registerTemplate, verificationTemplate };
226
+ //# sourceMappingURL=authTemplates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authTemplates.js","sources":["../../../gallery/authTemplates.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 { ScreenTemplate } from '@cratis/scene.model';\nimport { ComponentName } from '../ComponentName';\nimport { SlotName } from '../layouts';\nimport { TemplateSlotName } from './TemplateSlotName';\nimport { button, card, externalComponent, text } from './elements';\nimport { field, formActions } from './widgets';\n\n/**\n * The six screens that stand between someone and the application: sign in, register, forgotten password,\n * new password, verification and the lock screen.\n *\n * All six fit the full-page layout's `content` slot and fill its `aside` with the branding half. That\n * split - a colored panel of brand next to a narrow column of form - is the shape the premium PrimeTek\n * templates use for every one of them, and the reason it works is that it gives the form somewhere to be\n * *small*, which is what a sign-in form should be.\n */\n\n/** The branding half every authentication screen shares. */\nfunction brandingAside(id: string, headline: string, supporting: string) {\n return [\n externalComponent(`${id}-logo`, ComponentName.Logo, { label: 'Contoso', initials: 'C' }),\n text(`${id}-headline`, headline),\n text(`${id}-supporting`, supporting),\n ];\n}\n\n/** Sign in. */\nexport const loginTemplate: ScreenTemplate = {\n name: 'Login',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('login', 'Welcome back', 'Everything your team shipped since you were last here is waiting.'),\n [TemplateSlotName.Body]: [\n card('login-card', [\n text('login-title', 'Sign in'),\n field('login-email', 'Email', 'inputText', { placeholder: 'you@contoso.com' }),\n field('login-password', 'Password', 'password', { feedback: false }),\n field('login-remember', 'Keep me signed in', 'checkbox', {}),\n formActions('login-actions', 'Sign in', 'Use a different account'),\n button('login-forgot', 'I forgot my password', { link: true, targetScreen: 'ForgotPassword' }),\n ]),\n ],\n },\n displayName: 'Sign in',\n description: 'Email and password beside the branding panel.',\n};\n\n/** Register. */\nexport const registerTemplate: ScreenTemplate = {\n name: 'Register',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('register', 'Start in two minutes', 'No card, no call, no sales engineer. Just an account.'),\n [TemplateSlotName.Body]: [\n card('register-card', [\n text('register-title', 'Create your account'),\n field('register-name', 'Full name', 'inputText', {}),\n field('register-email', 'Work email', 'inputText', { placeholder: 'you@contoso.com' }),\n field('register-password', 'Password', 'password', { feedback: true }),\n field('register-terms', 'I accept the terms of service', 'checkbox', {}),\n formActions('register-actions', 'Create account', 'I already have one'),\n ]),\n ],\n },\n displayName: 'Register',\n description: 'Account creation with a password strength meter and the terms checkbox.',\n};\n\n/** Forgotten password: ask for the address. */\nexport const forgotPasswordTemplate: ScreenTemplate = {\n name: 'ForgotPassword',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('forgot', 'It happens', 'Tell us the address you signed up with and we will send a link.'),\n [TemplateSlotName.Body]: [\n card('forgot-card', [\n text('forgot-title', 'Reset your password'),\n field('forgot-email', 'Email', 'inputText', { placeholder: 'you@contoso.com' }),\n formActions('forgot-actions', 'Send the link', 'Back to sign in'),\n ]),\n ],\n },\n displayName: 'Forgotten password',\n description: 'One field and one button - the whole point is that it asks for nothing else.',\n};\n\n/** New password: the other end of the link. */\nexport const newPasswordTemplate: ScreenTemplate = {\n name: 'NewPassword',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('new-password', 'Almost there', 'Choose something you have not used anywhere else.'),\n [TemplateSlotName.Body]: [\n card('new-password-card', [\n text('new-password-title', 'Choose a new password'),\n field('new-password-value', 'New password', 'password', { feedback: true }),\n field('new-password-confirm', 'Confirm it', 'password', { feedback: false }),\n formActions('new-password-actions', 'Set the password', 'Cancel'),\n ]),\n ],\n },\n displayName: 'New password',\n description: 'Where a reset link lands: choose it, confirm it, done.',\n};\n\n/** Verification: the code from the email. */\nexport const verificationTemplate: ScreenTemplate = {\n name: 'Verification',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('verification', 'Check your email', 'We sent a six-digit code. It expires in ten minutes.'),\n [TemplateSlotName.Body]: [\n card('verification-card', [\n text('verification-title', 'Enter the code'),\n externalComponent('verification-steps', 'steps', { model: ['Account', 'Verify', 'Done'], activeIndex: 1 }),\n field('verification-code', 'Six-digit code', 'inputText', { maxLength: 6 }),\n formActions('verification-actions', 'Verify', 'Send it again'),\n ]),\n ],\n },\n displayName: 'Verification',\n description: 'The code step, with the progress indicator that tells you how much is left.',\n};\n\n/** Lock screen: the session is still there, the person has to prove they are. */\nexport const lockScreenTemplate: ScreenTemplate = {\n name: 'LockScreen',\n fitsSlot: SlotName.Content,\n slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],\n content: {\n [SlotName.Aside]: brandingAside('lock', 'Locked', 'Your work is exactly where you left it.'),\n [TemplateSlotName.Body]: [\n card('lock-card', [\n externalComponent('lock-avatar', 'avatar', { label: 'AN', size: 'xlarge', shape: 'circle' }),\n text('lock-name', 'Amelia Nyquist'),\n field('lock-password', 'Password', 'password', { feedback: false }),\n formActions('lock-actions', 'Unlock', 'Sign in as someone else'),\n ]),\n ],\n },\n displayName: 'Lock screen',\n description: 'One person, one password, and no way to lose what was open.',\n};\n\n/** The six authentication templates. */\nexport const authTemplates: ScreenTemplate[] = [\n loginTemplate,\n registerTemplate,\n forgotPasswordTemplate,\n newPasswordTemplate,\n verificationTemplate,\n lockScreenTemplate,\n];\n"],"names":["brandingAside","id","headline","supporting","externalComponent","ComponentName","Logo","label","initials","text","loginTemplate","name","fitsSlot","SlotName","Content","slots","Aside","TemplateSlotName","Body","content","card","field","placeholder","feedback","formActions","button","link","targetScreen","displayName","description","registerTemplate","forgotPasswordTemplate","newPasswordTemplate","verificationTemplate","model","activeIndex","maxLength","lockScreenTemplate","size","shape","authTemplates"],"mappings":";;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MAAMQ,kBAAAA,GAAqC;IAC9C1B,IAAAA,EAAM,YAAA;AACNC,IAAAA,QAAAA,EAAUC,SAASC,OAAO;IAC1BC,KAAAA,EAAO;AAAC,QAAA;AAAEJ,YAAAA,IAAAA,EAAME,SAASG;AAAM,SAAA;AAAG,QAAA;AAAEL,YAAAA,IAAAA,EAAMM,iBAAiBC;AAAK;AAAE,KAAA;IAClEC,OAAAA,EAAS;AACL,QAAA,CAACN,SAASG,KAAK,GAAGhB,aAAAA,CAAc,QAAQ,QAAA,EAAU,yCAAA,CAAA;QAClD,CAACiB,gBAAAA,CAAiBC,IAAI,GAAG;AACrBE,YAAAA,IAAAA,CAAK,WAAA,EAAa;AACdhB,gBAAAA,iBAAAA,CAAkB,eAAe,QAAA,EAAU;oBAAEG,KAAAA,EAAO,IAAA;oBAAM+B,IAAAA,EAAM,QAAA;oBAAUC,KAAAA,EAAO;AAAS,iBAAA,CAAA;AAC1F9B,gBAAAA,IAAAA,CAAK,WAAA,EAAa,gBAAA,CAAA;gBAClBY,KAAAA,CAAM,eAAA,EAAiB,YAAY,UAAA,EAAY;oBAAEE,QAAAA,EAAU;AAAM,iBAAA,CAAA;AACjEC,gBAAAA,WAAAA,CAAY,gBAAgB,QAAA,EAAU,yBAAA;AACzC,aAAA;AACJ;AACL,KAAA;IACAI,WAAAA,EAAa,aAAA;IACbC,WAAAA,EAAa;AACjB;AAEA,yCACO,MAAMW,aAAAA,GAAkC;AAC3C9B,IAAAA,aAAAA;AACAoB,IAAAA,gBAAAA;AACAC,IAAAA,sBAAAA;AACAC,IAAAA,mBAAAA;AACAC,IAAAA,oBAAAA;AACAI,IAAAA;;;;;"}
@@ -0,0 +1,4 @@
1
+ import { SceneElement } from '@cratis/scene.model';
2
+ export declare function componentNamesIn(element: SceneElement): string[];
3
+ export declare function distinctComponentNames(elements: SceneElement[]): string[];
4
+ //# sourceMappingURL=componentNames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentNames.d.ts","sourceRoot":"","sources":["../../../gallery/componentNames.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAiBnD,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,EAAE,CA2BhE;AAKD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,CAEzE"}
@@ -0,0 +1,50 @@
1
+ import { isExternalComponent, isContentControl, isItemsControl, isPanel } from '@cratis/scene.engine';
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
+ * Every component name an element tree references.
7
+ *
8
+ * A blueprint's templates name components the blueprint itself does not provide - the widgets come from
9
+ * the component libraries it depends on - and a name no active package declares renders as a dashed red
10
+ * placeholder somewhere inside a screen, with nothing pointing back at the template that wrote it.
11
+ * Collecting the names up front is what lets that be a failed check at build or design time instead.
12
+ *
13
+ * The walk uses the engine's own kind guards rather than its own, so it visits exactly the branches the
14
+ * renderer visits and cannot drift from it.
15
+ *
16
+ * @param element The root to walk.
17
+ * @returns Every `componentName` found, in encounter order, with duplicates.
18
+ */ function componentNamesIn(element) {
19
+ const names = [];
20
+ if (isExternalComponent(element)) {
21
+ names.push(element.componentName);
22
+ for (const children of Object.values(element.slots)){
23
+ for (const child of children){
24
+ names.push(...componentNamesIn(child));
25
+ }
26
+ }
27
+ }
28
+ if (isContentControl(element)) {
29
+ names.push(...componentNamesIn(element.content));
30
+ }
31
+ if (isItemsControl(element)) {
32
+ names.push(...componentNamesIn(element.itemTemplate));
33
+ }
34
+ if (isPanel(element)) {
35
+ for (const child of element.children){
36
+ names.push(...componentNamesIn(child));
37
+ }
38
+ }
39
+ return names;
40
+ }
41
+ /**
42
+ * Every distinct component name a set of element trees references, sorted so a report of them is stable.
43
+ */ function distinctComponentNames(elements) {
44
+ return [
45
+ ...new Set(elements.flatMap(componentNamesIn))
46
+ ].sort();
47
+ }
48
+
49
+ export { componentNamesIn, distinctComponentNames };
50
+ //# sourceMappingURL=componentNames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"componentNames.js","sources":["../../../gallery/componentNames.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 { SceneElement } from '@cratis/scene.model';\nimport { isContentControl, isExternalComponent, isItemsControl, isPanel } from '@cratis/scene.engine';\n\n/**\n * Every component name an element tree references.\n *\n * A blueprint's templates name components the blueprint itself does not provide - the widgets come from\n * the component libraries it depends on - and a name no active package declares renders as a dashed red\n * placeholder somewhere inside a screen, with nothing pointing back at the template that wrote it.\n * Collecting the names up front is what lets that be a failed check at build or design time instead.\n *\n * The walk uses the engine's own kind guards rather than its own, so it visits exactly the branches the\n * renderer visits and cannot drift from it.\n *\n * @param element The root to walk.\n * @returns Every `componentName` found, in encounter order, with duplicates.\n */\nexport function componentNamesIn(element: SceneElement): string[] {\n const names: string[] = [];\n\n if (isExternalComponent(element)) {\n names.push(element.componentName);\n for (const children of Object.values(element.slots)) {\n for (const child of children) {\n names.push(...componentNamesIn(child));\n }\n }\n }\n\n if (isContentControl(element)) {\n names.push(...componentNamesIn(element.content));\n }\n\n if (isItemsControl(element)) {\n names.push(...componentNamesIn(element.itemTemplate));\n }\n\n if (isPanel(element)) {\n for (const child of element.children) {\n names.push(...componentNamesIn(child));\n }\n }\n\n return names;\n}\n\n/**\n * Every distinct component name a set of element trees references, sorted so a report of them is stable.\n */\nexport function distinctComponentNames(elements: SceneElement[]): string[] {\n return [...new Set(elements.flatMap(componentNamesIn))].sort();\n}\n"],"names":["componentNamesIn","element","names","isExternalComponent","push","componentName","children","Object","values","slots","child","isContentControl","content","isItemsControl","itemTemplate","isPanel","distinctComponentNames","elements","Set","flatMap","sort"],"mappings":";;AAAA;AACA;AAKA;;;;;;;;;;;;;IAcO,SAASA,gBAAAA,CAAiBC,OAAqB,EAAA;AAClD,IAAA,MAAMC,QAAkB,EAAE;AAE1B,IAAA,IAAIC,oBAAoBF,OAAAA,CAAAA,EAAU;QAC9BC,KAAAA,CAAME,IAAI,CAACH,OAAAA,CAAQI,aAAa,CAAA;AAChC,QAAA,KAAK,MAAMC,QAAAA,IAAYC,MAAAA,CAAOC,MAAM,CAACP,OAAAA,CAAQQ,KAAK,CAAA,CAAG;YACjD,KAAK,MAAMC,SAASJ,QAAAA,CAAU;gBAC1BJ,KAAAA,CAAME,IAAI,IAAIJ,gBAAAA,CAAiBU,KAAAA,CAAAA,CAAAA;AACnC,YAAA;AACJ,QAAA;AACJ,IAAA;AAEA,IAAA,IAAIC,iBAAiBV,OAAAA,CAAAA,EAAU;AAC3BC,QAAAA,KAAAA,CAAME,IAAI,CAAA,GAAIJ,gBAAAA,CAAiBC,OAAAA,CAAQW,OAAO,CAAA,CAAA;AAClD,IAAA;AAEA,IAAA,IAAIC,eAAeZ,OAAAA,CAAAA,EAAU;AACzBC,QAAAA,KAAAA,CAAME,IAAI,CAAA,GAAIJ,gBAAAA,CAAiBC,OAAAA,CAAQa,YAAY,CAAA,CAAA;AACvD,IAAA;AAEA,IAAA,IAAIC,QAAQd,OAAAA,CAAAA,EAAU;AAClB,QAAA,KAAK,MAAMS,KAAAA,IAAST,OAAAA,CAAQK,QAAQ,CAAE;YAClCJ,KAAAA,CAAME,IAAI,IAAIJ,gBAAAA,CAAiBU,KAAAA,CAAAA,CAAAA;AACnC,QAAA;AACJ,IAAA;IAEA,OAAOR,KAAAA;AACX;AAEA;;IAGO,SAASc,sBAAAA,CAAuBC,QAAwB,EAAA;IAC3D,OAAO;WAAI,IAAIC,GAAAA,CAAID,QAAAA,CAASE,OAAO,CAACnB,gBAAAA,CAAAA;AAAmB,KAAA,CAACoB,IAAI,EAAA;AAChE;;;;"}
@@ -0,0 +1,5 @@
1
+ import { ExternalComponent, Layout, SceneElement, Screen, ScreenTemplate } from '@cratis/scene.model';
2
+ export declare function templateContentInLayout(template: ScreenTemplate, layout: Layout): Record<string, SceneElement[]>;
3
+ export declare function nestScreenTemplates(chain: ScreenTemplate[]): ScreenTemplate;
4
+ export declare function composeScreenElement(screen: Screen): ExternalComponent;
5
+ //# sourceMappingURL=composeScreen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composeScreen.d.ts","sourceRoot":"","sources":["../../../gallery/composeScreen.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAgBtG,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,CAqBhH;AAiBD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,cAAc,CAE3E;AA4BD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAOtE"}
@@ -0,0 +1,95 @@
1
+ import '@cratis/scene.model';
2
+ import { shellComponentForLayout } from '../layouts/shellComponents.js';
3
+ import '../layouts/appShell.js';
4
+ import '../layouts/fullPage.js';
5
+ import { externalComponent } from './elements.js';
6
+
7
+ // Copyright (c) Cratis. All rights reserved.
8
+ // Licensed under the MIT license. See LICENSE file in the project root for full license information.
9
+ /**
10
+ * Turns a {@link ScreenTemplate}'s content into slot content on the {@link Layout} that contains it.
11
+ *
12
+ * The rule has two halves, and both matter. Content filed under a slot the *layout* also declares stays
13
+ * under that name - which is how a sign-in template's branding half reaches the full-page layout's `aside`
14
+ * region rather than being buried inside the form column. Everything else flows into the slot the
15
+ * template's `fitsSlot` names, because that is what `fitsSlot` means: this template occupies that region.
16
+ *
17
+ * @param template The template to place.
18
+ * @param layout The layout it is placed into.
19
+ * @returns Slot content keyed by the layout's own slot names.
20
+ */ function templateContentInLayout(template, layout) {
21
+ const layoutSlots = new Set(layout.slots.map((slot)=>slot.name));
22
+ const placed = {};
23
+ const ownSlotOrder = template.slots.map((slot)=>slot.name);
24
+ const content = template.content ?? {};
25
+ for (const slotName of ownSlotOrder){
26
+ const elements = content[slotName];
27
+ if (!elements || elements.length === 0) {
28
+ continue;
29
+ }
30
+ const target = layoutSlots.has(slotName) ? slotName : template.fitsSlot;
31
+ if (!target) {
32
+ continue;
33
+ }
34
+ placed[target] = [
35
+ ...placed[target] ?? [],
36
+ ...elements
37
+ ];
38
+ }
39
+ return placed;
40
+ }
41
+ /**
42
+ * Folds a containment chain of screen templates into the outermost one.
43
+ *
44
+ * This is `fitsSlot` doing its job, applied repeatedly. A slice's template fits a slot on the feature's
45
+ * template, which fits a slot on the module's, which fits a slot on the application layout - so the way to
46
+ * place the slice is to place it in the feature, place *that* result in the module, and hand the module to
47
+ * the layout. Folding from the inside out means the rule is written once and the chain can be any depth.
48
+ *
49
+ * The alternative - filing a nested template's content under its own `fitsSlot` at the top level - looks
50
+ * right and is not: the layout has no `body` slot, so the content lands in a region nothing renders and
51
+ * the screen comes up empty with nothing to explain it.
52
+ *
53
+ * @param chain The templates from outermost to innermost. A chain of one is returned unchanged.
54
+ * @returns A template with the same slots and `fitsSlot` as the outermost, carrying the whole chain's content.
55
+ */ function nestScreenTemplates(chain) {
56
+ return chain.reduceRight((inner, outer)=>inner === outer ? outer : placeInside(outer, inner));
57
+ }
58
+ function placeInside(outer, inner) {
59
+ if (!inner.fitsSlot) {
60
+ return outer;
61
+ }
62
+ const innerContent = inner.slots.flatMap((slot)=>inner.content?.[slot.name] ?? []);
63
+ return {
64
+ ...outer,
65
+ content: {
66
+ ...outer.content,
67
+ [inner.fitsSlot]: [
68
+ ...outer.content?.[inner.fitsSlot] ?? [],
69
+ ...innerContent
70
+ ]
71
+ }
72
+ };
73
+ }
74
+ /**
75
+ * Builds the element tree that renders a {@link Screen}.
76
+ *
77
+ * The screen's slot content becomes the shell component's slots one-for-one, which is the whole trick: a
78
+ * layout's slots and a shell component's slots are the same vocabulary, so nothing has to translate
79
+ * between them and a slot filled under a name the shell does not read is a spec failure rather than a
80
+ * silently missing region.
81
+ *
82
+ * @param screen The screen to render.
83
+ * @returns The shell element, ready for `SceneElementView`.
84
+ */ function composeScreenElement(screen) {
85
+ const shell = shellComponentForLayout(screen.layout);
86
+ if (!shell) {
87
+ throw new Error(`Screen '${screen.name}' names the layout '${screen.layout}', which this blueprint does not provide.`);
88
+ }
89
+ return externalComponent(`screen-${screen.name}`, shell, {
90
+ screenName: screen.name
91
+ }, screen.slotContent);
92
+ }
93
+
94
+ export { composeScreenElement, nestScreenTemplates, templateContentInLayout };
95
+ //# sourceMappingURL=composeScreen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composeScreen.js","sources":["../../../gallery/composeScreen.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, Layout, SceneElement, Screen, ScreenTemplate } from '@cratis/scene.model';\nimport { shellComponentForLayout } from '../layouts';\nimport { externalComponent } from './elements';\n\n/**\n * Turns a {@link ScreenTemplate}'s content into slot content on the {@link Layout} that contains it.\n *\n * The rule has two halves, and both matter. Content filed under a slot the *layout* also declares stays\n * under that name - which is how a sign-in template's branding half reaches the full-page layout's `aside`\n * region rather than being buried inside the form column. Everything else flows into the slot the\n * template's `fitsSlot` names, because that is what `fitsSlot` means: this template occupies that region.\n *\n * @param template The template to place.\n * @param layout The layout it is placed into.\n * @returns Slot content keyed by the layout's own slot names.\n */\nexport function templateContentInLayout(template: ScreenTemplate, layout: Layout): Record<string, SceneElement[]> {\n const layoutSlots = new Set(layout.slots.map(slot => slot.name));\n const placed: Record<string, SceneElement[]> = {};\n const ownSlotOrder = template.slots.map(slot => slot.name);\n const content = template.content ?? {};\n\n for (const slotName of ownSlotOrder) {\n const elements = content[slotName];\n if (!elements || elements.length === 0) {\n continue;\n }\n\n const target = layoutSlots.has(slotName) ? slotName : template.fitsSlot;\n if (!target) {\n continue;\n }\n\n placed[target] = [...(placed[target] ?? []), ...elements];\n }\n\n return placed;\n}\n\n/**\n * Folds a containment chain of screen templates into the outermost one.\n *\n * This is `fitsSlot` doing its job, applied repeatedly. A slice's template fits a slot on the feature's\n * template, which fits a slot on the module's, which fits a slot on the application layout - so the way to\n * place the slice is to place it in the feature, place *that* result in the module, and hand the module to\n * the layout. Folding from the inside out means the rule is written once and the chain can be any depth.\n *\n * The alternative - filing a nested template's content under its own `fitsSlot` at the top level - looks\n * right and is not: the layout has no `body` slot, so the content lands in a region nothing renders and\n * the screen comes up empty with nothing to explain it.\n *\n * @param chain The templates from outermost to innermost. A chain of one is returned unchanged.\n * @returns A template with the same slots and `fitsSlot` as the outermost, carrying the whole chain's content.\n */\nexport function nestScreenTemplates(chain: ScreenTemplate[]): ScreenTemplate {\n return chain.reduceRight((inner, outer) => (inner === outer ? outer : placeInside(outer, inner)));\n}\n\nfunction placeInside(outer: ScreenTemplate, inner: ScreenTemplate): ScreenTemplate {\n if (!inner.fitsSlot) {\n return outer;\n }\n\n const innerContent = inner.slots.flatMap(slot => inner.content?.[slot.name] ?? []);\n return {\n ...outer,\n content: {\n ...outer.content,\n [inner.fitsSlot]: [...(outer.content?.[inner.fitsSlot] ?? []), ...innerContent],\n },\n };\n}\n\n/**\n * Builds the element tree that renders a {@link Screen}.\n *\n * The screen's slot content becomes the shell component's slots one-for-one, which is the whole trick: a\n * layout's slots and a shell component's slots are the same vocabulary, so nothing has to translate\n * between them and a slot filled under a name the shell does not read is a spec failure rather than a\n * silently missing region.\n *\n * @param screen The screen to render.\n * @returns The shell element, ready for `SceneElementView`.\n */\nexport function composeScreenElement(screen: Screen): ExternalComponent {\n const shell = shellComponentForLayout(screen.layout);\n if (!shell) {\n throw new Error(`Screen '${screen.name}' names the layout '${screen.layout}', which this blueprint does not provide.`);\n }\n\n return externalComponent(`screen-${screen.name}`, shell, { screenName: screen.name }, screen.slotContent);\n}\n"],"names":["templateContentInLayout","template","layout","layoutSlots","Set","slots","map","slot","name","placed","ownSlotOrder","content","slotName","elements","length","target","has","fitsSlot","nestScreenTemplates","chain","reduceRight","inner","outer","placeInside","innerContent","flatMap","composeScreenElement","screen","shell","shellComponentForLayout","Error","externalComponent","screenName","slotContent"],"mappings":";;;;;;AAAA;AACA;AAMA;;;;;;;;;;;AAWC,IACM,SAASA,uBAAAA,CAAwBC,QAAwB,EAAEC,MAAc,EAAA;IAC5E,MAAMC,WAAAA,GAAc,IAAIC,GAAAA,CAAIF,MAAAA,CAAOG,KAAK,CAACC,GAAG,CAACC,CAAAA,IAAAA,GAAQA,IAAAA,CAAKC,IAAI,CAAA,CAAA;AAC9D,IAAA,MAAMC,SAAyC,EAAC;IAChD,MAAMC,YAAAA,GAAeT,SAASI,KAAK,CAACC,GAAG,CAACC,CAAAA,IAAAA,GAAQA,IAAAA,CAAKC,IAAI,CAAA;AACzD,IAAA,MAAMG,OAAAA,GAAUV,QAAAA,CAASU,OAAO,IAAI,EAAC;IAErC,KAAK,MAAMC,YAAYF,YAAAA,CAAc;QACjC,MAAMG,QAAAA,GAAWF,OAAO,CAACC,QAAAA,CAAS;AAClC,QAAA,IAAI,CAACC,QAAAA,IAAYA,QAAAA,CAASC,MAAM,KAAK,CAAA,EAAG;AACpC,YAAA;AACJ,QAAA;AAEA,QAAA,MAAMC,SAASZ,WAAAA,CAAYa,GAAG,CAACJ,QAAAA,CAAAA,GAAYA,QAAAA,GAAWX,SAASgB,QAAQ;AACvE,QAAA,IAAI,CAACF,MAAAA,EAAQ;AACT,YAAA;AACJ,QAAA;QAEAN,MAAM,CAACM,OAAO,GAAG;eAAKN,MAAM,CAACM,MAAAA,CAAO,IAAI,EAAE;AAAMF,YAAAA,GAAAA;AAAS,SAAA;AAC7D,IAAA;IAEA,OAAOJ,MAAAA;AACX;AAEA;;;;;;;;;;;;;;IAeO,SAASS,mBAAAA,CAAoBC,KAAuB,EAAA;IACvD,OAAOA,KAAAA,CAAMC,WAAW,CAAC,CAACC,KAAAA,EAAOC,QAAWD,KAAAA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const cratisComponentsNames: string[];
3
+ export declare const coreComponentNames: string[];
4
+ //# sourceMappingURL=dependencyComponentNames.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependencyComponentNames.d.ts","sourceRoot":"","sources":["../../../gallery/dependencyComponentNames.ts"],"names":[],"mappings":"AA6BA,eAAO,MAAM,wBAAwB,EAAE,MAAM,EAsB5C,CAAC;AASF,eAAO,MAAM,qBAAqB,EAAE,MAAM,EAAmE,CAAC;AAG9G,eAAO,MAAM,kBAAkB,EAAE,MAAM,EAA+B,CAAC"}