@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.
- package/.storybook/main.ts +32 -0
- package/.storybook/preview.ts +20 -0
- package/ComponentName.ts +60 -0
- package/README.md +204 -0
- package/configuration/ColorScheme.ts +17 -0
- package/configuration/LayoutConfigProvider.tsx +182 -0
- package/configuration/LayoutConfigState.ts +46 -0
- package/configuration/LayoutMode.ts +50 -0
- package/configuration/MenuTheme.ts +24 -0
- package/configuration/index.ts +11 -0
- package/configuration/layoutConfigStorage.ts +102 -0
- package/configuration/layoutConfigTransitions.ts +150 -0
- package/configuration/layoutWrapperClasses.ts +68 -0
- package/defaultBlueprint.ts +66 -0
- package/defaultBlueprintComponents.ts +51 -0
- package/dist/cjs/ComponentName.js +33 -0
- package/dist/cjs/ComponentName.js.map +1 -0
- package/dist/cjs/configuration/ColorScheme.js +23 -0
- package/dist/cjs/configuration/ColorScheme.js.map +1 -0
- package/dist/cjs/configuration/LayoutConfigProvider.js +96 -0
- package/dist/cjs/configuration/LayoutConfigProvider.js.map +1 -0
- package/dist/cjs/configuration/LayoutMode.js +38 -0
- package/dist/cjs/configuration/LayoutMode.js.map +1 -0
- package/dist/cjs/configuration/MenuTheme.js +26 -0
- package/dist/cjs/configuration/MenuTheme.js.map +1 -0
- package/dist/cjs/configuration/layoutConfigStorage.js +85 -0
- package/dist/cjs/configuration/layoutConfigStorage.js.map +1 -0
- package/dist/cjs/configuration/layoutConfigTransitions.js +158 -0
- package/dist/cjs/configuration/layoutConfigTransitions.js.map +1 -0
- package/dist/cjs/configuration/layoutWrapperClasses.js +62 -0
- package/dist/cjs/configuration/layoutWrapperClasses.js.map +1 -0
- package/dist/cjs/defaultBlueprint.js +92 -0
- package/dist/cjs/defaultBlueprint.js.map +1 -0
- package/dist/cjs/defaultBlueprintComponents.js +54 -0
- package/dist/cjs/defaultBlueprintComponents.js.map +1 -0
- package/dist/cjs/gallery/GalleryScreenPreview.js +63 -0
- package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -0
- package/dist/cjs/gallery/TemplateSlotName.js +25 -0
- package/dist/cjs/gallery/TemplateSlotName.js.map +1 -0
- package/dist/cjs/gallery/applicationChrome.js +134 -0
- package/dist/cjs/gallery/applicationChrome.js.map +1 -0
- package/dist/cjs/gallery/authTemplates.js +234 -0
- package/dist/cjs/gallery/authTemplates.js.map +1 -0
- package/dist/cjs/gallery/componentNames.js +53 -0
- package/dist/cjs/gallery/componentNames.js.map +1 -0
- package/dist/cjs/gallery/composeScreen.js +99 -0
- package/dist/cjs/gallery/composeScreen.js.map +1 -0
- package/dist/cjs/gallery/dependencyComponentNames.js +72 -0
- package/dist/cjs/gallery/dependencyComponentNames.js.map +1 -0
- package/dist/cjs/gallery/dialogTemplates.js +161 -0
- package/dist/cjs/gallery/dialogTemplates.js.map +1 -0
- package/dist/cjs/gallery/elements.js +80 -0
- package/dist/cjs/gallery/elements.js.map +1 -0
- package/dist/cjs/gallery/navigation.js +129 -0
- package/dist/cjs/gallery/navigation.js.map +1 -0
- package/dist/cjs/gallery/nesting.js +129 -0
- package/dist/cjs/gallery/nesting.js.map +1 -0
- package/dist/cjs/gallery/previewProfile.js +68 -0
- package/dist/cjs/gallery/previewProfile.js.map +1 -0
- package/dist/cjs/gallery/resolveElementNames.js +63 -0
- package/dist/cjs/gallery/resolveElementNames.js.map +1 -0
- package/dist/cjs/gallery/screens.js +222 -0
- package/dist/cjs/gallery/screens.js.map +1 -0
- package/dist/cjs/gallery/statusTemplates.js +190 -0
- package/dist/cjs/gallery/statusTemplates.js.map +1 -0
- package/dist/cjs/gallery/supportTemplates.js +319 -0
- package/dist/cjs/gallery/supportTemplates.js.map +1 -0
- package/dist/cjs/gallery/widgets.js +94 -0
- package/dist/cjs/gallery/widgets.js.map +1 -0
- package/dist/cjs/gallery/workspaceTemplates.js +395 -0
- package/dist/cjs/gallery/workspaceTemplates.js.map +1 -0
- package/dist/cjs/index.js +220 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/layouts/LayoutName.js +19 -0
- package/dist/cjs/layouts/LayoutName.js.map +1 -0
- package/dist/cjs/layouts/SlotName.js +31 -0
- package/dist/cjs/layouts/SlotName.js.map +1 -0
- package/dist/cjs/layouts/appShell.js +160 -0
- package/dist/cjs/layouts/appShell.js.map +1 -0
- package/dist/cjs/layouts/defaultLayouts.js +20 -0
- package/dist/cjs/layouts/defaultLayouts.js.map +1 -0
- package/dist/cjs/layouts/flowBuilders.js +66 -0
- package/dist/cjs/layouts/flowBuilders.js.map +1 -0
- package/dist/cjs/layouts/fullPage.js +78 -0
- package/dist/cjs/layouts/fullPage.js.map +1 -0
- package/dist/cjs/layouts/shellComponents.js +29 -0
- package/dist/cjs/layouts/shellComponents.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/packageName.js +15 -0
- package/dist/cjs/packageName.js.map +1 -0
- package/dist/cjs/shell/AppShell.js +88 -0
- package/dist/cjs/shell/AppShell.js.map +1 -0
- package/dist/cjs/shell/Breadcrumb.js +33 -0
- package/dist/cjs/shell/Breadcrumb.js.map +1 -0
- package/dist/cjs/shell/ConfigPanel.js +128 -0
- package/dist/cjs/shell/ConfigPanel.js.map +1 -0
- package/dist/cjs/shell/Footer.js +28 -0
- package/dist/cjs/shell/Footer.js.map +1 -0
- package/dist/cjs/shell/FullPageShell.js +53 -0
- package/dist/cjs/shell/FullPageShell.js.map +1 -0
- package/dist/cjs/shell/LayoutModeSwitcher.js +58 -0
- package/dist/cjs/shell/LayoutModeSwitcher.js.map +1 -0
- package/dist/cjs/shell/Logo.js +44 -0
- package/dist/cjs/shell/Logo.js.map +1 -0
- package/dist/cjs/shell/Mask.js +34 -0
- package/dist/cjs/shell/Mask.js.map +1 -0
- package/dist/cjs/shell/Menu.js +36 -0
- package/dist/cjs/shell/Menu.js.map +1 -0
- package/dist/cjs/shell/MenuItem.js +65 -0
- package/dist/cjs/shell/MenuItem.js.map +1 -0
- package/dist/cjs/shell/PageHeader.js +43 -0
- package/dist/cjs/shell/PageHeader.js.map +1 -0
- package/dist/cjs/shell/RightPanel.js +30 -0
- package/dist/cjs/shell/RightPanel.js.map +1 -0
- package/dist/cjs/shell/Sidebar.js +51 -0
- package/dist/cjs/shell/Sidebar.js.map +1 -0
- package/dist/cjs/shell/ThemeOption.js +42 -0
- package/dist/cjs/shell/ThemeOption.js.map +1 -0
- package/dist/cjs/shell/ThemeSwitcher.js +50 -0
- package/dist/cjs/shell/ThemeSwitcher.js.map +1 -0
- package/dist/cjs/shell/Topbar.js +54 -0
- package/dist/cjs/shell/Topbar.js.map +1 -0
- package/dist/cjs/shell/UserMenu.js +68 -0
- package/dist/cjs/shell/UserMenu.js.map +1 -0
- package/dist/cjs/shell/elementProperties.js +56 -0
- package/dist/cjs/shell/elementProperties.js.map +1 -0
- package/dist/cjs/themes/LayoutThemeProvider.js +33 -0
- package/dist/cjs/themes/LayoutThemeProvider.js.map +1 -0
- package/dist/cjs/themes/blueprintThemeCompatibility.js +28 -0
- package/dist/cjs/themes/blueprintThemeCompatibility.js.map +1 -0
- package/dist/cjs/themes/dark.js +40 -0
- package/dist/cjs/themes/dark.js.map +1 -0
- package/dist/cjs/themes/defaultBlueprintThemes.js +19 -0
- package/dist/cjs/themes/defaultBlueprintThemes.js.map +1 -0
- package/dist/cjs/themes/light.js +43 -0
- package/dist/cjs/themes/light.js.map +1 -0
- package/dist/esm/ComponentName.d.ts +19 -0
- package/dist/esm/ComponentName.d.ts.map +1 -0
- package/dist/esm/ComponentName.js +31 -0
- package/dist/esm/ComponentName.js.map +1 -0
- package/dist/esm/configuration/ColorScheme.d.ts +6 -0
- package/dist/esm/configuration/ColorScheme.d.ts.map +1 -0
- package/dist/esm/configuration/ColorScheme.js +20 -0
- package/dist/esm/configuration/ColorScheme.js.map +1 -0
- package/dist/esm/configuration/LayoutConfigProvider.d.ts +29 -0
- package/dist/esm/configuration/LayoutConfigProvider.d.ts.map +1 -0
- package/dist/esm/configuration/LayoutConfigProvider.js +92 -0
- package/dist/esm/configuration/LayoutConfigProvider.js.map +1 -0
- package/dist/esm/configuration/LayoutConfigState.d.ts +14 -0
- package/dist/esm/configuration/LayoutConfigState.d.ts.map +1 -0
- package/dist/esm/configuration/LayoutConfigState.js +2 -0
- package/dist/esm/configuration/LayoutConfigState.js.map +1 -0
- package/dist/esm/configuration/LayoutMode.d.ts +12 -0
- package/dist/esm/configuration/LayoutMode.d.ts.map +1 -0
- package/dist/esm/configuration/LayoutMode.js +35 -0
- package/dist/esm/configuration/LayoutMode.js.map +1 -0
- package/dist/esm/configuration/MenuTheme.d.ts +7 -0
- package/dist/esm/configuration/MenuTheme.d.ts.map +1 -0
- package/dist/esm/configuration/MenuTheme.js +23 -0
- package/dist/esm/configuration/MenuTheme.js.map +1 -0
- package/dist/esm/configuration/index.d.ts +9 -0
- package/dist/esm/configuration/index.d.ts.map +1 -0
- package/dist/esm/configuration/index.js +9 -0
- package/dist/esm/configuration/index.js.map +1 -0
- package/dist/esm/configuration/layoutConfigStorage.d.ts +6 -0
- package/dist/esm/configuration/layoutConfigStorage.d.ts.map +1 -0
- package/dist/esm/configuration/layoutConfigStorage.js +81 -0
- package/dist/esm/configuration/layoutConfigStorage.js.map +1 -0
- package/dist/esm/configuration/layoutConfigTransitions.d.ts +22 -0
- package/dist/esm/configuration/layoutConfigTransitions.d.ts.map +1 -0
- package/dist/esm/configuration/layoutConfigTransitions.js +140 -0
- package/dist/esm/configuration/layoutConfigTransitions.js.map +1 -0
- package/dist/esm/configuration/layoutWrapperClasses.d.ts +4 -0
- package/dist/esm/configuration/layoutWrapperClasses.d.ts.map +1 -0
- package/dist/esm/configuration/layoutWrapperClasses.js +59 -0
- package/dist/esm/configuration/layoutWrapperClasses.js.map +1 -0
- package/dist/esm/defaultBlueprint.d.ts +5 -0
- package/dist/esm/defaultBlueprint.d.ts.map +1 -0
- package/dist/esm/defaultBlueprint.js +89 -0
- package/dist/esm/defaultBlueprint.js.map +1 -0
- package/dist/esm/defaultBlueprintComponents.d.ts +3 -0
- package/dist/esm/defaultBlueprintComponents.d.ts.map +1 -0
- package/dist/esm/defaultBlueprintComponents.js +52 -0
- package/dist/esm/defaultBlueprintComponents.js.map +1 -0
- package/dist/esm/for_AppShell/when_rendering_a_gallery_screen.d.ts +2 -0
- package/dist/esm/for_AppShell/when_rendering_a_gallery_screen.d.ts.map +1 -0
- package/dist/esm/for_AppShell/when_rendering_a_gallery_screen.js +60 -0
- package/dist/esm/for_AppShell/when_rendering_a_gallery_screen.js.map +1 -0
- package/dist/esm/for_LayoutConfigProvider/when_switching_mode_and_reloading.d.ts +2 -0
- package/dist/esm/for_LayoutConfigProvider/when_switching_mode_and_reloading.d.ts.map +1 -0
- package/dist/esm/for_LayoutConfigProvider/when_switching_mode_and_reloading.js +60 -0
- package/dist/esm/for_LayoutConfigProvider/when_switching_mode_and_reloading.js.map +1 -0
- package/dist/esm/for_appShellLayout/when_evaluating_the_arrangement_at_each_size_class.d.ts +2 -0
- package/dist/esm/for_appShellLayout/when_evaluating_the_arrangement_at_each_size_class.d.ts.map +1 -0
- package/dist/esm/for_appShellLayout/when_evaluating_the_arrangement_at_each_size_class.js +26 -0
- package/dist/esm/for_appShellLayout/when_evaluating_the_arrangement_at_each_size_class.js.map +1 -0
- package/dist/esm/for_defaultBlueprint/when_validating_the_bundle.d.ts +2 -0
- package/dist/esm/for_defaultBlueprint/when_validating_the_bundle.d.ts.map +1 -0
- package/dist/esm/for_defaultBlueprint/when_validating_the_bundle.js +32 -0
- package/dist/esm/for_defaultBlueprint/when_validating_the_bundle.js.map +1 -0
- package/dist/esm/for_defaultBlueprintThemes/when_checking_attribution_and_tokens.d.ts +2 -0
- package/dist/esm/for_defaultBlueprintThemes/when_checking_attribution_and_tokens.d.ts.map +1 -0
- package/dist/esm/for_defaultBlueprintThemes/when_checking_attribution_and_tokens.js +40 -0
- package/dist/esm/for_defaultBlueprintThemes/when_checking_attribution_and_tokens.js.map +1 -0
- package/dist/esm/for_fullPageLayout/when_evaluating_the_arrangement_at_each_size_class.d.ts +2 -0
- package/dist/esm/for_fullPageLayout/when_evaluating_the_arrangement_at_each_size_class.d.ts.map +1 -0
- package/dist/esm/for_fullPageLayout/when_evaluating_the_arrangement_at_each_size_class.js +27 -0
- package/dist/esm/for_fullPageLayout/when_evaluating_the_arrangement_at_each_size_class.js.map +1 -0
- package/dist/esm/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts +2 -0
- package/dist/esm/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts.map +1 -0
- package/dist/esm/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js +41 -0
- package/dist/esm/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js.map +1 -0
- package/dist/esm/for_galleryScreenTemplates/when_following_the_nesting_chain.d.ts +2 -0
- package/dist/esm/for_galleryScreenTemplates/when_following_the_nesting_chain.d.ts.map +1 -0
- package/dist/esm/for_galleryScreenTemplates/when_following_the_nesting_chain.js +31 -0
- package/dist/esm/for_galleryScreenTemplates/when_following_the_nesting_chain.js.map +1 -0
- package/dist/esm/for_galleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts +2 -0
- package/dist/esm/for_galleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts.map +1 -0
- package/dist/esm/for_galleryScreens/when_checking_the_layouts_and_slots_they_fill.js +33 -0
- package/dist/esm/for_galleryScreens/when_checking_the_layouts_and_slots_they_fill.js.map +1 -0
- package/dist/esm/for_galleryScreens/when_resolving_the_component_names_they_reference.d.ts +2 -0
- package/dist/esm/for_galleryScreens/when_resolving_the_component_names_they_reference.d.ts.map +1 -0
- package/dist/esm/for_galleryScreens/when_resolving_the_component_names_they_reference.js +44 -0
- package/dist/esm/for_galleryScreens/when_resolving_the_component_names_they_reference.js.map +1 -0
- package/dist/esm/for_layoutConfigStorage/when_restoring_a_persisted_configuration.d.ts +2 -0
- package/dist/esm/for_layoutConfigStorage/when_restoring_a_persisted_configuration.d.ts.map +1 -0
- package/dist/esm/for_layoutConfigStorage/when_restoring_a_persisted_configuration.js +60 -0
- package/dist/esm/for_layoutConfigStorage/when_restoring_a_persisted_configuration.js.map +1 -0
- package/dist/esm/for_layoutConfigTransitions/when_anchoring_a_reveal_sidebar.d.ts +2 -0
- package/dist/esm/for_layoutConfigTransitions/when_anchoring_a_reveal_sidebar.d.ts.map +1 -0
- package/dist/esm/for_layoutConfigTransitions/when_anchoring_a_reveal_sidebar.js +28 -0
- package/dist/esm/for_layoutConfigTransitions/when_anchoring_a_reveal_sidebar.js.map +1 -0
- package/dist/esm/for_layoutConfigTransitions/when_the_viewport_crosses_the_mobile_breakpoint.d.ts +2 -0
- package/dist/esm/for_layoutConfigTransitions/when_the_viewport_crosses_the_mobile_breakpoint.d.ts.map +1 -0
- package/dist/esm/for_layoutConfigTransitions/when_the_viewport_crosses_the_mobile_breakpoint.js +38 -0
- package/dist/esm/for_layoutConfigTransitions/when_the_viewport_crosses_the_mobile_breakpoint.js.map +1 -0
- package/dist/esm/for_layoutWrapperClasses/when_rendering_each_mode.d.ts +2 -0
- package/dist/esm/for_layoutWrapperClasses/when_rendering_each_mode.d.ts.map +1 -0
- package/dist/esm/for_layoutWrapperClasses/when_rendering_each_mode.js +39 -0
- package/dist/esm/for_layoutWrapperClasses/when_rendering_each_mode.js.map +1 -0
- package/dist/esm/for_navigation/when_aggregating_the_navigation_contributions.d.ts +2 -0
- package/dist/esm/for_navigation/when_aggregating_the_navigation_contributions.d.ts.map +1 -0
- package/dist/esm/for_navigation/when_aggregating_the_navigation_contributions.js +37 -0
- package/dist/esm/for_navigation/when_aggregating_the_navigation_contributions.js.map +1 -0
- package/dist/esm/gallery/ApplicationScreens.stories.d.ts +31 -0
- package/dist/esm/gallery/ApplicationScreens.stories.d.ts.map +1 -0
- package/dist/esm/gallery/ApplicationScreens.stories.js +29 -0
- package/dist/esm/gallery/ApplicationScreens.stories.js.map +1 -0
- package/dist/esm/gallery/FullPageScreens.stories.d.ts +28 -0
- package/dist/esm/gallery/FullPageScreens.stories.d.ts.map +1 -0
- package/dist/esm/gallery/FullPageScreens.stories.js +26 -0
- package/dist/esm/gallery/FullPageScreens.stories.js.map +1 -0
- package/dist/esm/gallery/GalleryScreenPreview.d.ts +12 -0
- package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -0
- package/dist/esm/gallery/GalleryScreenPreview.js +60 -0
- package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -0
- package/dist/esm/gallery/NavigationEntry.d.ts +8 -0
- package/dist/esm/gallery/NavigationEntry.d.ts.map +1 -0
- package/dist/esm/gallery/NavigationEntry.js +2 -0
- package/dist/esm/gallery/NavigationEntry.js.map +1 -0
- package/dist/esm/gallery/TemplateSlotName.d.ts +11 -0
- package/dist/esm/gallery/TemplateSlotName.d.ts.map +1 -0
- package/dist/esm/gallery/TemplateSlotName.js +23 -0
- package/dist/esm/gallery/TemplateSlotName.js.map +1 -0
- package/dist/esm/gallery/applicationChrome.d.ts +8 -0
- package/dist/esm/gallery/applicationChrome.d.ts.map +1 -0
- package/dist/esm/gallery/applicationChrome.js +131 -0
- package/dist/esm/gallery/applicationChrome.js.map +1 -0
- package/dist/esm/gallery/authTemplates.d.ts +9 -0
- package/dist/esm/gallery/authTemplates.d.ts.map +1 -0
- package/dist/esm/gallery/authTemplates.js +226 -0
- package/dist/esm/gallery/authTemplates.js.map +1 -0
- package/dist/esm/gallery/componentNames.d.ts +4 -0
- package/dist/esm/gallery/componentNames.d.ts.map +1 -0
- package/dist/esm/gallery/componentNames.js +50 -0
- package/dist/esm/gallery/componentNames.js.map +1 -0
- package/dist/esm/gallery/composeScreen.d.ts +5 -0
- package/dist/esm/gallery/composeScreen.d.ts.map +1 -0
- package/dist/esm/gallery/composeScreen.js +95 -0
- package/dist/esm/gallery/composeScreen.js.map +1 -0
- package/dist/esm/gallery/dependencyComponentNames.d.ts +4 -0
- package/dist/esm/gallery/dependencyComponentNames.d.ts.map +1 -0
- package/dist/esm/gallery/dependencyComponentNames.js +68 -0
- package/dist/esm/gallery/dependencyComponentNames.js.map +1 -0
- package/dist/esm/gallery/dialogTemplates.d.ts +6 -0
- package/dist/esm/gallery/dialogTemplates.d.ts.map +1 -0
- package/dist/esm/gallery/dialogTemplates.js +156 -0
- package/dist/esm/gallery/dialogTemplates.js.map +1 -0
- package/dist/esm/gallery/elements.d.ts +7 -0
- package/dist/esm/gallery/elements.d.ts.map +1 -0
- package/dist/esm/gallery/elements.js +74 -0
- package/dist/esm/gallery/elements.js.map +1 -0
- package/dist/esm/gallery/index.d.ts +20 -0
- package/dist/esm/gallery/index.d.ts.map +1 -0
- package/dist/esm/gallery/index.js +20 -0
- package/dist/esm/gallery/index.js.map +1 -0
- package/dist/esm/gallery/navigation.d.ts +9 -0
- package/dist/esm/gallery/navigation.d.ts.map +1 -0
- package/dist/esm/gallery/navigation.js +122 -0
- package/dist/esm/gallery/navigation.js.map +1 -0
- package/dist/esm/gallery/nesting.d.ts +6 -0
- package/dist/esm/gallery/nesting.d.ts.map +1 -0
- package/dist/esm/gallery/nesting.js +124 -0
- package/dist/esm/gallery/nesting.js.map +1 -0
- package/dist/esm/gallery/previewProfile.d.ts +6 -0
- package/dist/esm/gallery/previewProfile.d.ts.map +1 -0
- package/dist/esm/gallery/previewProfile.js +64 -0
- package/dist/esm/gallery/previewProfile.js.map +1 -0
- package/dist/esm/gallery/resolveElementNames.d.ts +4 -0
- package/dist/esm/gallery/resolveElementNames.d.ts.map +1 -0
- package/dist/esm/gallery/resolveElementNames.js +61 -0
- package/dist/esm/gallery/resolveElementNames.js.map +1 -0
- package/dist/esm/gallery/screens.d.ts +5 -0
- package/dist/esm/gallery/screens.d.ts.map +1 -0
- package/dist/esm/gallery/screens.js +218 -0
- package/dist/esm/gallery/screens.js.map +1 -0
- package/dist/esm/gallery/statusTemplates.d.ts +7 -0
- package/dist/esm/gallery/statusTemplates.d.ts.map +1 -0
- package/dist/esm/gallery/statusTemplates.js +184 -0
- package/dist/esm/gallery/statusTemplates.js.map +1 -0
- package/dist/esm/gallery/supportTemplates.d.ts +8 -0
- package/dist/esm/gallery/supportTemplates.d.ts.map +1 -0
- package/dist/esm/gallery/supportTemplates.js +312 -0
- package/dist/esm/gallery/supportTemplates.js.map +1 -0
- package/dist/esm/gallery/widgets.d.ts +12 -0
- package/dist/esm/gallery/widgets.d.ts.map +1 -0
- package/dist/esm/gallery/widgets.js +86 -0
- package/dist/esm/gallery/widgets.js.map +1 -0
- package/dist/esm/gallery/workspaceTemplates.d.ts +8 -0
- package/dist/esm/gallery/workspaceTemplates.d.ts.map +1 -0
- package/dist/esm/gallery/workspaceTemplates.js +388 -0
- package/dist/esm/gallery/workspaceTemplates.js.map +1 -0
- package/dist/esm/index.d.ts +10 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +60 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/layouts/LayoutName.d.ts +5 -0
- package/dist/esm/layouts/LayoutName.d.ts.map +1 -0
- package/dist/esm/layouts/LayoutName.js +17 -0
- package/dist/esm/layouts/LayoutName.js.map +1 -0
- package/dist/esm/layouts/SlotName.d.ts +12 -0
- package/dist/esm/layouts/SlotName.d.ts.map +1 -0
- package/dist/esm/layouts/SlotName.js +29 -0
- package/dist/esm/layouts/SlotName.js.map +1 -0
- package/dist/esm/layouts/appShell.d.ts +8 -0
- package/dist/esm/layouts/appShell.d.ts.map +1 -0
- package/dist/esm/layouts/appShell.js +153 -0
- package/dist/esm/layouts/appShell.js.map +1 -0
- package/dist/esm/layouts/defaultLayouts.d.ts +3 -0
- package/dist/esm/layouts/defaultLayouts.d.ts.map +1 -0
- package/dist/esm/layouts/defaultLayouts.js +18 -0
- package/dist/esm/layouts/defaultLayouts.js.map +1 -0
- package/dist/esm/layouts/flowBuilders.d.ts +6 -0
- package/dist/esm/layouts/flowBuilders.d.ts.map +1 -0
- package/dist/esm/layouts/flowBuilders.js +61 -0
- package/dist/esm/layouts/flowBuilders.js.map +1 -0
- package/dist/esm/layouts/fullPage.d.ts +6 -0
- package/dist/esm/layouts/fullPage.d.ts.map +1 -0
- package/dist/esm/layouts/fullPage.js +73 -0
- package/dist/esm/layouts/fullPage.js.map +1 -0
- package/dist/esm/layouts/index.d.ts +8 -0
- package/dist/esm/layouts/index.d.ts.map +1 -0
- package/dist/esm/layouts/index.js +8 -0
- package/dist/esm/layouts/index.js.map +1 -0
- package/dist/esm/layouts/shellComponents.d.ts +3 -0
- package/dist/esm/layouts/shellComponents.d.ts.map +1 -0
- package/dist/esm/layouts/shellComponents.js +27 -0
- package/dist/esm/layouts/shellComponents.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/packageName.d.ts +2 -0
- package/dist/esm/packageName.d.ts.map +1 -0
- package/dist/esm/packageName.js +13 -0
- package/dist/esm/packageName.js.map +1 -0
- package/dist/esm/shell/AppShell.d.ts +3 -0
- package/dist/esm/shell/AppShell.d.ts.map +1 -0
- package/dist/esm/shell/AppShell.js +86 -0
- package/dist/esm/shell/AppShell.js.map +1 -0
- package/dist/esm/shell/Breadcrumb.d.ts +3 -0
- package/dist/esm/shell/Breadcrumb.d.ts.map +1 -0
- package/dist/esm/shell/Breadcrumb.js +31 -0
- package/dist/esm/shell/Breadcrumb.js.map +1 -0
- package/dist/esm/shell/ConfigPanel.d.ts +3 -0
- package/dist/esm/shell/ConfigPanel.d.ts.map +1 -0
- package/dist/esm/shell/ConfigPanel.js +126 -0
- package/dist/esm/shell/ConfigPanel.js.map +1 -0
- package/dist/esm/shell/Footer.d.ts +3 -0
- package/dist/esm/shell/Footer.d.ts.map +1 -0
- package/dist/esm/shell/Footer.js +26 -0
- package/dist/esm/shell/Footer.js.map +1 -0
- package/dist/esm/shell/FullPageShell.d.ts +3 -0
- package/dist/esm/shell/FullPageShell.d.ts.map +1 -0
- package/dist/esm/shell/FullPageShell.js +51 -0
- package/dist/esm/shell/FullPageShell.js.map +1 -0
- package/dist/esm/shell/LayoutModeSwitcher.d.ts +3 -0
- package/dist/esm/shell/LayoutModeSwitcher.d.ts.map +1 -0
- package/dist/esm/shell/LayoutModeSwitcher.js +56 -0
- package/dist/esm/shell/LayoutModeSwitcher.js.map +1 -0
- package/dist/esm/shell/LayoutModes.stories.d.ts +29 -0
- package/dist/esm/shell/LayoutModes.stories.d.ts.map +1 -0
- package/dist/esm/shell/LayoutModes.stories.js +43 -0
- package/dist/esm/shell/LayoutModes.stories.js.map +1 -0
- package/dist/esm/shell/Logo.d.ts +3 -0
- package/dist/esm/shell/Logo.d.ts.map +1 -0
- package/dist/esm/shell/Logo.js +42 -0
- package/dist/esm/shell/Logo.js.map +1 -0
- package/dist/esm/shell/Mask.d.ts +3 -0
- package/dist/esm/shell/Mask.d.ts.map +1 -0
- package/dist/esm/shell/Mask.js +31 -0
- package/dist/esm/shell/Mask.js.map +1 -0
- package/dist/esm/shell/Menu.d.ts +3 -0
- package/dist/esm/shell/Menu.d.ts.map +1 -0
- package/dist/esm/shell/Menu.js +34 -0
- package/dist/esm/shell/Menu.js.map +1 -0
- package/dist/esm/shell/MenuItem.d.ts +3 -0
- package/dist/esm/shell/MenuItem.d.ts.map +1 -0
- package/dist/esm/shell/MenuItem.js +63 -0
- package/dist/esm/shell/MenuItem.js.map +1 -0
- package/dist/esm/shell/PageHeader.d.ts +3 -0
- package/dist/esm/shell/PageHeader.d.ts.map +1 -0
- package/dist/esm/shell/PageHeader.js +41 -0
- package/dist/esm/shell/PageHeader.js.map +1 -0
- package/dist/esm/shell/RightPanel.d.ts +3 -0
- package/dist/esm/shell/RightPanel.d.ts.map +1 -0
- package/dist/esm/shell/RightPanel.js +28 -0
- package/dist/esm/shell/RightPanel.js.map +1 -0
- package/dist/esm/shell/Sidebar.d.ts +3 -0
- package/dist/esm/shell/Sidebar.d.ts.map +1 -0
- package/dist/esm/shell/Sidebar.js +49 -0
- package/dist/esm/shell/Sidebar.js.map +1 -0
- package/dist/esm/shell/ThemeOption.d.ts +10 -0
- package/dist/esm/shell/ThemeOption.d.ts.map +1 -0
- package/dist/esm/shell/ThemeOption.js +39 -0
- package/dist/esm/shell/ThemeOption.js.map +1 -0
- package/dist/esm/shell/ThemeSwitcher.d.ts +3 -0
- package/dist/esm/shell/ThemeSwitcher.d.ts.map +1 -0
- package/dist/esm/shell/ThemeSwitcher.js +48 -0
- package/dist/esm/shell/ThemeSwitcher.js.map +1 -0
- package/dist/esm/shell/Topbar.d.ts +3 -0
- package/dist/esm/shell/Topbar.d.ts.map +1 -0
- package/dist/esm/shell/Topbar.js +52 -0
- package/dist/esm/shell/Topbar.js.map +1 -0
- package/dist/esm/shell/UserMenu.d.ts +3 -0
- package/dist/esm/shell/UserMenu.d.ts.map +1 -0
- package/dist/esm/shell/UserMenu.js +66 -0
- package/dist/esm/shell/UserMenu.js.map +1 -0
- package/dist/esm/shell/elementProperties.d.ts +9 -0
- package/dist/esm/shell/elementProperties.d.ts.map +1 -0
- package/dist/esm/shell/elementProperties.js +48 -0
- package/dist/esm/shell/elementProperties.js.map +1 -0
- package/dist/esm/shell/index.d.ts +19 -0
- package/dist/esm/shell/index.d.ts.map +1 -0
- package/dist/esm/shell/index.js +19 -0
- package/dist/esm/shell/index.js.map +1 -0
- package/dist/esm/themes/LayoutThemeProvider.d.ts +9 -0
- package/dist/esm/themes/LayoutThemeProvider.d.ts.map +1 -0
- package/dist/esm/themes/LayoutThemeProvider.js +31 -0
- package/dist/esm/themes/LayoutThemeProvider.js.map +1 -0
- package/dist/esm/themes/Theming.stories.d.ts +21 -0
- package/dist/esm/themes/Theming.stories.d.ts.map +1 -0
- package/dist/esm/themes/Theming.stories.js +54 -0
- package/dist/esm/themes/Theming.stories.js.map +1 -0
- package/dist/esm/themes/blueprintThemeCompatibility.d.ts +2 -0
- package/dist/esm/themes/blueprintThemeCompatibility.d.ts.map +1 -0
- package/dist/esm/themes/blueprintThemeCompatibility.js +26 -0
- package/dist/esm/themes/blueprintThemeCompatibility.js.map +1 -0
- package/dist/esm/themes/dark.d.ts +3 -0
- package/dist/esm/themes/dark.d.ts.map +1 -0
- package/dist/esm/themes/dark.js +38 -0
- package/dist/esm/themes/dark.js.map +1 -0
- package/dist/esm/themes/defaultBlueprintThemes.d.ts +3 -0
- package/dist/esm/themes/defaultBlueprintThemes.d.ts.map +1 -0
- package/dist/esm/themes/defaultBlueprintThemes.js +17 -0
- package/dist/esm/themes/defaultBlueprintThemes.js.map +1 -0
- package/dist/esm/themes/index.d.ts +6 -0
- package/dist/esm/themes/index.d.ts.map +1 -0
- package/dist/esm/themes/index.js +6 -0
- package/dist/esm/themes/index.js.map +1 -0
- package/dist/esm/themes/light.d.ts +3 -0
- package/dist/esm/themes/light.d.ts.map +1 -0
- package/dist/esm/themes/light.js +41 -0
- package/dist/esm/themes/light.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/for_AppShell/when_rendering_a_gallery_screen.tsx +76 -0
- package/for_LayoutConfigProvider/when_switching_mode_and_reloading.tsx +77 -0
- package/for_appShellLayout/when_evaluating_the_arrangement_at_each_size_class.ts +42 -0
- package/for_defaultBlueprint/when_validating_the_bundle.ts +43 -0
- package/for_defaultBlueprintThemes/when_checking_attribution_and_tokens.ts +50 -0
- package/for_fullPageLayout/when_evaluating_the_arrangement_at_each_size_class.ts +36 -0
- package/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.ts +53 -0
- package/for_galleryScreenTemplates/when_following_the_nesting_chain.ts +41 -0
- package/for_galleryScreens/when_checking_the_layouts_and_slots_they_fill.ts +44 -0
- package/for_galleryScreens/when_resolving_the_component_names_they_reference.ts +60 -0
- package/for_layoutConfigStorage/when_restoring_a_persisted_configuration.ts +76 -0
- package/for_layoutConfigTransitions/when_anchoring_a_reveal_sidebar.ts +44 -0
- package/for_layoutConfigTransitions/when_the_viewport_crosses_the_mobile_breakpoint.ts +61 -0
- package/for_layoutWrapperClasses/when_rendering_each_mode.ts +63 -0
- package/for_navigation/when_aggregating_the_navigation_contributions.ts +50 -0
- package/gallery/ApplicationScreens.stories.tsx +70 -0
- package/gallery/FullPageScreens.stories.tsx +60 -0
- package/gallery/GalleryScreenPreview.tsx +68 -0
- package/gallery/NavigationEntry.ts +27 -0
- package/gallery/TemplateSlotName.ts +36 -0
- package/gallery/applicationChrome.ts +110 -0
- package/gallery/authTemplates.ts +161 -0
- package/gallery/componentNames.ts +55 -0
- package/gallery/composeScreen.ts +95 -0
- package/gallery/dependencyComponentNames.ts +64 -0
- package/gallery/dialogTemplates.ts +79 -0
- package/gallery/elements.ts +65 -0
- package/gallery/index.ts +22 -0
- package/gallery/navigation.ts +71 -0
- package/gallery/nesting.ts +82 -0
- package/gallery/previewProfile.ts +59 -0
- package/gallery/resolveElementNames.ts +55 -0
- package/gallery/screens.ts +111 -0
- package/gallery/statusTemplates.ts +118 -0
- package/gallery/supportTemplates.ts +164 -0
- package/gallery/widgets.ts +63 -0
- package/gallery/workspaceTemplates.ts +198 -0
- package/index.ts +12 -0
- package/layouts/LayoutName.ts +18 -0
- package/layouts/SlotName.ts +44 -0
- package/layouts/appShell.ts +106 -0
- package/layouts/defaultLayouts.ts +15 -0
- package/layouts/flowBuilders.ts +49 -0
- package/layouts/fullPage.ts +48 -0
- package/layouts/index.ts +10 -0
- package/layouts/shellComponents.ts +28 -0
- package/package.json +68 -0
- package/packageName.ts +12 -0
- package/shell/AppShell.tsx +66 -0
- package/shell/Breadcrumb.tsx +31 -0
- package/shell/ConfigPanel.tsx +105 -0
- package/shell/Footer.tsx +23 -0
- package/shell/FullPageShell.tsx +41 -0
- package/shell/LayoutModeSwitcher.tsx +50 -0
- package/shell/LayoutModes.stories.tsx +83 -0
- package/shell/Logo.tsx +30 -0
- package/shell/Mask.tsx +29 -0
- package/shell/Menu.tsx +26 -0
- package/shell/MenuItem.tsx +39 -0
- package/shell/PageHeader.tsx +28 -0
- package/shell/RightPanel.tsx +23 -0
- package/shell/Sidebar.tsx +45 -0
- package/shell/ThemeOption.ts +60 -0
- package/shell/ThemeSwitcher.tsx +42 -0
- package/shell/Topbar.tsx +49 -0
- package/shell/UserMenu.tsx +53 -0
- package/shell/elementProperties.ts +64 -0
- package/shell/index.ts +21 -0
- package/shell/layout.css +821 -0
- package/themes/LayoutThemeProvider.tsx +41 -0
- package/themes/Theming.stories.tsx +89 -0
- package/themes/blueprintThemeCompatibility.ts +19 -0
- package/themes/dark.ts +38 -0
- package/themes/defaultBlueprintThemes.ts +14 -0
- package/themes/index.ts +8 -0
- package/themes/light.ts +41 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { StorybookConfig } from "@storybook/react-vite";
|
|
5
|
+
import { dirname, join, resolve } from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import type { InlineConfig } from 'vite';
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
|
|
11
|
+
const config: StorybookConfig = {
|
|
12
|
+
// Scoped away from `dist/` so a story is never indexed twice - once as source and once as the
|
|
13
|
+
// tsc-emitted copy beside it.
|
|
14
|
+
stories: ["../*.stories.@(js|jsx|mjs|ts|tsx)", "../!(dist|node_modules)/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
15
|
+
addons: [getAbsolutePath("@storybook/addon-links")],
|
|
16
|
+
framework: { name: getAbsolutePath("@storybook/react-vite"), options: {} },
|
|
17
|
+
async viteFinal(config: InlineConfig) {
|
|
18
|
+
config.resolve = config.resolve || {};
|
|
19
|
+
config.resolve.alias = {
|
|
20
|
+
...config.resolve.alias,
|
|
21
|
+
'@cratis/scene.engine': resolve(__dirname, '../../engine/index.ts'),
|
|
22
|
+
'@cratis/scene.model': resolve(__dirname, '../../model/index.ts'),
|
|
23
|
+
'@cratis/scene.react': resolve(__dirname, '../../react/index.ts'),
|
|
24
|
+
};
|
|
25
|
+
return config;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
export default config;
|
|
29
|
+
|
|
30
|
+
function getAbsolutePath(value: string): string {
|
|
31
|
+
return dirname(fileURLToPath(import.meta.resolve(join(value, "package.json"))));
|
|
32
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { Preview } from '@storybook/react';
|
|
5
|
+
|
|
6
|
+
// PrimeReact 10 ships its base styles and one theme per file, and the shell's own stylesheet layers on
|
|
7
|
+
// top of them. Loading them here rather than from a story keeps every story looking the same and matches
|
|
8
|
+
// what a host does once, at its entry point.
|
|
9
|
+
import 'primereact/resources/primereact.min.css';
|
|
10
|
+
import 'primereact/resources/themes/lara-light-indigo/theme.css';
|
|
11
|
+
import 'primeicons/primeicons.css';
|
|
12
|
+
import '../shell/layout.css';
|
|
13
|
+
|
|
14
|
+
const preview: Preview = {
|
|
15
|
+
parameters: {
|
|
16
|
+
controls: { matchers: { color: /(background|color)$/i, date: /Date$/i } },
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default preview;
|
package/ComponentName.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The bare names this package declares components under.
|
|
6
|
+
*
|
|
7
|
+
* A page template writes a bare name and `resolveComponentName` decides which active package wins it, so
|
|
8
|
+
* these names are public API: renaming one breaks every template that referenced it, in this package and
|
|
9
|
+
* in anyone else's. Keeping them in one enum means the manifest, the registry and every template
|
|
10
|
+
* reference the same symbol, and the specs can prove all three agree rather than hoping they do.
|
|
11
|
+
*/
|
|
12
|
+
export enum ComponentName {
|
|
13
|
+
/** The application shell - topbar, sidebar, breadcrumb, content, footer and an optional right panel. */
|
|
14
|
+
AppShell = 'appShell',
|
|
15
|
+
|
|
16
|
+
/** The chrome-less shell - content, an optional branding aside, and the configurator. */
|
|
17
|
+
FullPageShell = 'fullPageShell',
|
|
18
|
+
|
|
19
|
+
/** The fixed strip across the top of the application shell. */
|
|
20
|
+
Topbar = 'topbar',
|
|
21
|
+
|
|
22
|
+
/** The sidebar's own chrome, inside the shell-positioned panel. */
|
|
23
|
+
Sidebar = 'sidebar',
|
|
24
|
+
|
|
25
|
+
/** A navigation list. */
|
|
26
|
+
Menu = 'menu',
|
|
27
|
+
|
|
28
|
+
/** One entry in a navigation list, optionally with a submenu. */
|
|
29
|
+
MenuItem = 'menuItem',
|
|
30
|
+
|
|
31
|
+
/** The trail above the content. */
|
|
32
|
+
Breadcrumb = 'breadcrumb',
|
|
33
|
+
|
|
34
|
+
/** The strip below the content. */
|
|
35
|
+
Footer = 'footer',
|
|
36
|
+
|
|
37
|
+
/** The inspector panel down the right-hand edge. */
|
|
38
|
+
RightPanel = 'rightPanel',
|
|
39
|
+
|
|
40
|
+
/** The floating configurator: color scheme, layout mode, menu theme and theme. */
|
|
41
|
+
ConfigPanel = 'configPanel',
|
|
42
|
+
|
|
43
|
+
/** A screen's title, subtitle and actions. */
|
|
44
|
+
PageHeader = 'pageHeader',
|
|
45
|
+
|
|
46
|
+
/** The scrim behind a floating sidebar, which also closes it. */
|
|
47
|
+
Mask = 'mask',
|
|
48
|
+
|
|
49
|
+
/** The brand mark. */
|
|
50
|
+
Logo = 'logo',
|
|
51
|
+
|
|
52
|
+
/** The signed-in user's avatar and menu. */
|
|
53
|
+
UserMenu = 'userMenu',
|
|
54
|
+
|
|
55
|
+
/** Switches between the themes a host offers. */
|
|
56
|
+
ThemeSwitcher = 'themeSwitcher',
|
|
57
|
+
|
|
58
|
+
/** Switches between the layout modes. */
|
|
59
|
+
LayoutModeSwitcher = 'layoutModeSwitcher',
|
|
60
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# @cratis/scene.blueprint.default
|
|
2
|
+
|
|
3
|
+
The default **blueprint** for Scene: the application shells an application picks once, the screen and
|
|
4
|
+
dialog templates that go inside them, the components that fill their slots, and two themes.
|
|
5
|
+
|
|
6
|
+
User-facing documentation lives in [`Documentation/blueprints/`](../../../Documentation/blueprints/index.md).
|
|
7
|
+
This file is the contributor's note: the conventions the source follows and the reasoning behind them.
|
|
8
|
+
|
|
9
|
+
## Layout
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
blueprint.default/
|
|
13
|
+
├── defaultBlueprint.ts the ScenePackage manifest + the ScenePackageBundle
|
|
14
|
+
├── defaultBlueprintComponents.ts the ComponentRegistry - every bare name to its shell component
|
|
15
|
+
├── ComponentName.ts the bare names this blueprint declares
|
|
16
|
+
├── packageName.ts the name a ui profile lists it under
|
|
17
|
+
├── configuration/ the layout-mode state machine, its React provider and persistence
|
|
18
|
+
├── layouts/ the two Layout definitions and the flow builders behind them
|
|
19
|
+
├── shell/ the sixteen shell components, and layout.css
|
|
20
|
+
├── gallery/ the screen and dialog templates, the screens, and preview helpers
|
|
21
|
+
├── themes/ the two themes and the provider that applies them
|
|
22
|
+
└── for_*/ BDD specs beside the code they specify
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## The four things this ships, and why they are four
|
|
26
|
+
|
|
27
|
+
| Concept | What it is | How many |
|
|
28
|
+
| --- | --- | --- |
|
|
29
|
+
| **Layout** | the application's base navigational look | one per application, chosen from two |
|
|
30
|
+
| **Screen template** | a reusable shape *inside* a layout, at module / feature / slice level | twenty-three |
|
|
31
|
+
| **Dialog template** | the same, for overlays - no `fitsSlot`, because a dialog occupies no parent slot | three |
|
|
32
|
+
| **Screen** | an instance: names its layout and template, and provides the content | twenty-three |
|
|
33
|
+
|
|
34
|
+
A screen template states where it belongs, in `fitsSlot`, rather than being told by whatever hosts it.
|
|
35
|
+
That one rule composes at every depth: a module's template fits the layout's `content`, a feature's fits a
|
|
36
|
+
slot the module declares, a slice's fits one the feature declares. `nestScreenTemplates` folds a chain from
|
|
37
|
+
the inside out, and `ModuleWorkspace` → `FeatureSection` → `SliceSection` exists to be asserted rather than
|
|
38
|
+
only described.
|
|
39
|
+
|
|
40
|
+
## Regions (slots)
|
|
41
|
+
|
|
42
|
+
`topbar`, `sidebar`, `menu`, `breadcrumb`, `content`, `footer`, `rightPanel`, `configPanel`, `aside`.
|
|
43
|
+
|
|
44
|
+
Sakai establishes topbar/sidebar/menu/content/footer; the premium PrimeTek templates add the breadcrumb
|
|
45
|
+
and the right panel; `aside` is the branding half of a full-page screen's split. All of them are here,
|
|
46
|
+
because a blueprint covering only the free template's regions forces a fork on anyone wanting the others.
|
|
47
|
+
|
|
48
|
+
`SlotName` is one enum used by the layouts, the templates and the shell components, because a slot filled
|
|
49
|
+
under a name the shell never reads renders nothing and reports nothing.
|
|
50
|
+
|
|
51
|
+
## Layout modes
|
|
52
|
+
|
|
53
|
+
Eight, plus a mobile regime nobody selects. The class vocabulary is PrimeTek's, unchanged.
|
|
54
|
+
|
|
55
|
+
| Mode | Wrapper class | What it does |
|
|
56
|
+
| --- | --- | --- |
|
|
57
|
+
| Static | `layout-static` | Sidebar docked at 18rem; content pushed by a matching margin, never covered |
|
|
58
|
+
| Overlay | `layout-overlay` | Sidebar parked off-canvas; opening floats it over the content behind a mask |
|
|
59
|
+
| Slim | `layout-slim` | 5rem icon-only rail, circular buttons; submenus pop out at the rail's width |
|
|
60
|
+
| Slim+ | `layout-slim-plus` | 7rem rail with each label stacked under its icon |
|
|
61
|
+
| Compact | `layout-compact` | The 5rem rail with square buttons; the topbar shifts by the rail width too |
|
|
62
|
+
| Horizontal | `layout-horizontal` | Sidebar goes `position: static` into the topbar as a nowrap row; submenus drop down |
|
|
63
|
+
| Reveal | `layout-reveal` | Full panel translated off-left behind a 4.25rem icon strip; hover slides it in over the content; a pin pushes the content out instead |
|
|
64
|
+
| Drawer | `layout-drawer` | A 5.25rem rail that *animates its width* to full on hover - reveal slides, drawer grows - and pins the same way |
|
|
65
|
+
|
|
66
|
+
State classes: `layout-static-inactive`, `layout-overlay-active`, `layout-sidebar-active`,
|
|
67
|
+
`layout-sidebar-anchored`, `layout-mobile`, `layout-mobile-active`. Menu tint:
|
|
68
|
+
`layout-menu-light|dark|primary`. Color scheme: `layout-color-scheme-light|dark`.
|
|
69
|
+
|
|
70
|
+
**Mobile is not a mode.** At or below 991px `effectiveLayoutMode` returns `overlay` regardless of what was
|
|
71
|
+
chosen, the mode picker disables itself and says why, and the choice is kept so it comes back when the
|
|
72
|
+
window grows. The breakpoint is exported as `mobileBreakpoint` so the resize listener and the media query
|
|
73
|
+
cannot disagree.
|
|
74
|
+
|
|
75
|
+
## Where the state lives
|
|
76
|
+
|
|
77
|
+
One `LayoutConfigState`, one `LayoutConfigProvider`, one `useLayoutConfig`. Every transition is a pure
|
|
78
|
+
function over the record (`layoutConfigTransitions.ts`), so the whole state machine is testable without
|
|
79
|
+
React, and exactly one function turns state into CSS (`layoutWrapperClasses`).
|
|
80
|
+
|
|
81
|
+
Preferences persist to `localStorage` under `cratis.scene.blueprint.default`: mode, menu theme, color
|
|
82
|
+
scheme, theme name and the pin. Deliberately *not* whether the sidebar happened to be open, whether the
|
|
83
|
+
pointer was over it, or whether the viewport was narrow - restoring those produces a shell that opens in a
|
|
84
|
+
state nobody chose. Everything read back is validated against the enums, because storage outlives the
|
|
85
|
+
version of the package that wrote it and an unknown mode puts a class on the wrapper that no rule matches.
|
|
86
|
+
|
|
87
|
+
## Token vocabulary
|
|
88
|
+
|
|
89
|
+
Thirteen tokens, matching `@cratis/scene.primereact`'s table exactly. A vocabulary that grows per package
|
|
90
|
+
is one no package can rely on.
|
|
91
|
+
|
|
92
|
+
`primary.color`, `primary.contrastColor`, `surface.background`, `surface.card`, `surface.border`,
|
|
93
|
+
`surface.hover`, `surface.overlay`, `text.color`, `text.mutedColor`, `highlight.background`,
|
|
94
|
+
`highlight.color`, `content.borderRadius`, `focus.ring`.
|
|
95
|
+
|
|
96
|
+
`layout.css` aliases the `--scene-*` custom properties into `--layout-*` locals once, at the top, and no
|
|
97
|
+
rule below references a `--scene-*` name - the same bridge pattern `@cratis/components` uses for its
|
|
98
|
+
`--cratis-*` layer. Overriding the look means overriding tokens, never editing a rule.
|
|
99
|
+
|
|
100
|
+
The stylesheet is a plain `.css` file rather than an import from TypeScript, because this repo's rollup
|
|
101
|
+
config has no CSS plugin and adding one is not this package's call. A host imports
|
|
102
|
+
`@cratis/scene.blueprint.default/styles` once; Storybook does it in `.storybook/preview.ts`.
|
|
103
|
+
|
|
104
|
+
## Theme attribution
|
|
105
|
+
|
|
106
|
+
| Theme | Author | Link | License |
|
|
107
|
+
| --- | --- | --- | --- |
|
|
108
|
+
| Scene Default Light | Cratis | <https://cratis.io> | MIT |
|
|
109
|
+
| Scene Default Dark | Cratis | <https://cratis.io> | MIT |
|
|
110
|
+
|
|
111
|
+
Both palettes are original to Cratis - a neutral grey ramp with an indigo accent - not adopted from any
|
|
112
|
+
existing preset, which is why `author` says so rather than being left blank. A theme with empty
|
|
113
|
+
attribution reads as "nobody has checked", and once a palette is lifted without its credit nobody can tell
|
|
114
|
+
afterwards which of the two it was. Anything adopted later must fill `author`, `authorUrl` and `license`
|
|
115
|
+
from the source package's own LICENSE file, verified rather than assumed.
|
|
116
|
+
|
|
117
|
+
Both themes declare `compatibleWith: ['core', 'Cratis.Blueprint.Default', 'PrimeReact',
|
|
118
|
+
'Cratis.Components', 'Tailwind']`. `core` is on the list on purpose: `incompatiblePackages` has no implicit
|
|
119
|
+
exemption for it, so a theme omitting it is reported incompatible for `core` with every profile that lists
|
|
120
|
+
it - which is every profile.
|
|
121
|
+
|
|
122
|
+
## Component names borrowed from elsewhere
|
|
123
|
+
|
|
124
|
+
A screen template names components by their **bare** name, so `resolveComponentName` picks the package and
|
|
125
|
+
the template stays portable. `gallery/dependencyComponentNames.ts` lists every name the gallery borrows;
|
|
126
|
+
each was checked against the owning package's own manifest (`primeReactPackage.ts`,
|
|
127
|
+
`cratisComponentsPackage.ts`) rather than assumed, and a spec resolves all of them.
|
|
128
|
+
|
|
129
|
+
Two names a dashboard obviously wants - `chart` and `fileUpload` - are declared by *neither* package, so
|
|
130
|
+
the templates use what does exist (a table of monthly figures; an image beside a "Change photo" button)
|
|
131
|
+
rather than referencing something that would render as a red placeholder.
|
|
132
|
+
|
|
133
|
+
`menu`, `breadcrumb` and `sidebar` are declared by both PrimeReact and this blueprint. That is override
|
|
134
|
+
priority working as designed: this blueprint sits last in the profile's ascending-priority list, so its
|
|
135
|
+
shell versions win the bare names while PrimeReact's stay reachable as `PrimeReact.menu`.
|
|
136
|
+
|
|
137
|
+
## Previewing
|
|
138
|
+
|
|
139
|
+
`GalleryScreenPreview` boots one gallery screen through the real path - real `Screen`, real
|
|
140
|
+
`resolveComponentName`, real `SceneElementView`, real registry. Nothing in it is a preview-only code path.
|
|
141
|
+
|
|
142
|
+
It resolves against `galleryPreviewProfile` rather than `galleryProfile`. Same four packages, different
|
|
143
|
+
order: this package takes no npm dependency on PrimeReact's or Cratis Components' *bundles* (a blueprint
|
|
144
|
+
declares its dependencies in its manifest, not in its bundler graph), so a preview run from here has only
|
|
145
|
+
`core` and this blueprint implemented. Ranking `core` above the two libraries means `text`, `button` and
|
|
146
|
+
`card` resolve to something that exists. Names only the libraries declare still resolve to them, find no
|
|
147
|
+
implementation, and render as `UnresolvedComponent`'s dashed box - which is the honest outcome, not a
|
|
148
|
+
papered-over one. A host with all four bundles uses `galleryProfile` and sees the real widgets.
|
|
149
|
+
|
|
150
|
+
## PrimeReact 11
|
|
151
|
+
|
|
152
|
+
This shell is deliberately hand-rolled CSS **today**, because PrimeReact 10 has no app-shell primitive:
|
|
153
|
+
its `Sidebar` is an overlay drawer (v11 renames it `Drawer` for exactly that reason), and the docked, rail,
|
|
154
|
+
reveal and drawer behaviors have nowhere to come from but a stylesheet.
|
|
155
|
+
|
|
156
|
+
PrimeReact 11 introduces a first-class `Sidebar` for the app-shell role, with `variant`, `collapsible`,
|
|
157
|
+
`side`, `overlay` and `openOnHover` props and a `Sidebar.Layout` registry. A v11 port would collapse:
|
|
158
|
+
|
|
159
|
+
- the docked/off-canvas rules (`layout-static*`, `layout-overlay*`) into `variant` + `overlay`;
|
|
160
|
+
- the reveal and drawer hover machinery, and most of `isSidebarRevealed`, into `openOnHover`;
|
|
161
|
+
- the rail widths (`slim`, `slim-plus`, `compact`) into `collapsible` plus a width token;
|
|
162
|
+
- the wrapper-class plumbing in `layoutWrapperClasses` into `Sidebar.Layout`.
|
|
163
|
+
|
|
164
|
+
What would **not** collapse, and would stay this package's own: the mobile forcing at 991px, the
|
|
165
|
+
persistence, the menu-theme axis, and `horizontal` (a sidebar that stops being a sidebar is not a sidebar
|
|
166
|
+
variant). Studio pins `primereact` to `10.9.8` and `@cratis/components` hard-depends on it, so the port is
|
|
167
|
+
blocked on that pin, not on this package.
|
|
168
|
+
|
|
169
|
+
## Deliberately not built
|
|
170
|
+
|
|
171
|
+
- **No router.** `menuItem` and `breadcrumb` render hash routes (`#/Dashboard`) against a screen name. A
|
|
172
|
+
host with a real router wraps the shell and rewrites them; hashes keep the gallery navigable with no
|
|
173
|
+
router at all, which is what a preview needs.
|
|
174
|
+
- **No widget adapters.** Every widget a template places comes from PrimeReact or Cratis Components. A
|
|
175
|
+
blueprint that shipped its own table would be a component library wearing a blueprint's manifest.
|
|
176
|
+
- **No layout-arrangement renderer.** The layouts' `FlowArrangement`s are evaluated by the real
|
|
177
|
+
`evaluateFlowArrangement` in specs, but the shell positions its regions with CSS. Rendering an
|
|
178
|
+
arrangement generically is Scene#4's job, layered on top rather than folded in here.
|
|
179
|
+
- **No `FreeformSlotArrangement`.** Both layouts reflow; neither has a fixed-position variant worth
|
|
180
|
+
expressing as absolute placements.
|
|
181
|
+
|
|
182
|
+
## Known gaps outside this package
|
|
183
|
+
|
|
184
|
+
- **`yarn install` has not been run since the folder was renamed** from `layout.default`, so Yarn's
|
|
185
|
+
workspace state still names the old path and `yarn build` / `yarn test` fail with
|
|
186
|
+
`Package for @cratis/scene.blueprint.default@workspace:... not found in the project`. Run `yarn install`
|
|
187
|
+
once; until then the gates run through `npx tsc -b`, `npx rollup -c ./rollup.config.mjs`, `npx vitest run`,
|
|
188
|
+
`npx eslint --cache --quiet .` and `npx storybook build`, which are what the `g:*` scripts invoke.
|
|
189
|
+
- `Source/JavaScript/blueprint.default` is not in the root `tsconfig.json` `references` (which now lists
|
|
190
|
+
`tailwind`, `primereact` and `components`), so a root `npx tsc -b` does not build it.
|
|
191
|
+
- `FlowRow`, `FlowColumn` and a `FlowGrid` with no `columns` are structurally identical in `Scene.Model`,
|
|
192
|
+
so a consumer cannot tell a row from a column by value. The builders in `layouts/flowBuilders.ts` keep
|
|
193
|
+
the *intent* legible at the declaration site, and `grid()` always sets `columns`, but the model gap is
|
|
194
|
+
real.
|
|
195
|
+
|
|
196
|
+
## Gates
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
npx tsc -b # from the repository root
|
|
200
|
+
yarn build # from this package
|
|
201
|
+
yarn test
|
|
202
|
+
yarn lint:ci
|
|
203
|
+
yarn build-storybook
|
|
204
|
+
```
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The light/dark axis of the configurator.
|
|
6
|
+
*
|
|
7
|
+
* The shell never paints a color for a scheme itself - it only records which one is chosen, so the host
|
|
8
|
+
* can hand {@link SceneThemeProvider} a matching {@link Theme}. Keeping the choice and the palette apart
|
|
9
|
+
* is what lets a third-party theme participate in the same switch as the two this package ships.
|
|
10
|
+
*/
|
|
11
|
+
export enum ColorScheme {
|
|
12
|
+
Light = 'light',
|
|
13
|
+
Dark = 'dark',
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Every {@link ColorScheme}, in the order a configurator should offer them. */
|
|
17
|
+
export const colorSchemes: ColorScheme[] = [ColorScheme.Light, ColorScheme.Dark];
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ReactNode, createContext, useContext, useEffect, useMemo, useState } from 'react';
|
|
5
|
+
import { ColorScheme } from './ColorScheme';
|
|
6
|
+
import { LayoutConfigState } from './LayoutConfigState';
|
|
7
|
+
import { LayoutMode } from './LayoutMode';
|
|
8
|
+
import { MenuTheme } from './MenuTheme';
|
|
9
|
+
import { persistLayoutConfig, readPersistedLayoutConfig } from './layoutConfigStorage';
|
|
10
|
+
import { isLayoutMaskVisible, layoutWrapperClasses } from './layoutWrapperClasses';
|
|
11
|
+
import {
|
|
12
|
+
effectiveLayoutMode,
|
|
13
|
+
isMobileWidth,
|
|
14
|
+
mobileMediaQuery,
|
|
15
|
+
toggleSidebar,
|
|
16
|
+
toggleSidebarAnchor,
|
|
17
|
+
withColorScheme,
|
|
18
|
+
withMenuTheme,
|
|
19
|
+
withMobile,
|
|
20
|
+
withMode,
|
|
21
|
+
withSidebarOpen,
|
|
22
|
+
withSidebarRevealed,
|
|
23
|
+
withThemeName,
|
|
24
|
+
} from './layoutConfigTransitions';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* What {@link useLayoutConfig} hands a shell component: the current state, the values every part of the
|
|
28
|
+
* shell derives from it, and one function per transition.
|
|
29
|
+
*
|
|
30
|
+
* The derived values live here rather than being recomputed per component so that the topbar, the
|
|
31
|
+
* sidebar and the mask cannot end up disagreeing about which mode is in force - the exact class of bug a
|
|
32
|
+
* shell with per-component state produces.
|
|
33
|
+
*/
|
|
34
|
+
export interface LayoutConfigContextValue {
|
|
35
|
+
/** The current state. */
|
|
36
|
+
config: LayoutConfigState;
|
|
37
|
+
|
|
38
|
+
/** The mode actually in force, with the mobile override applied. */
|
|
39
|
+
effectiveMode: LayoutMode;
|
|
40
|
+
|
|
41
|
+
/** The classes for the shell's wrapper element. */
|
|
42
|
+
wrapperClasses: string[];
|
|
43
|
+
|
|
44
|
+
/** Whether the scrim behind a floating sidebar should be showing. */
|
|
45
|
+
isMaskVisible: boolean;
|
|
46
|
+
|
|
47
|
+
/** Chooses a different mode. Below the mobile breakpoint the choice is still recorded, but the shell keeps rendering off-canvas. */
|
|
48
|
+
setMode(mode: LayoutMode): void;
|
|
49
|
+
|
|
50
|
+
/** Chooses how the sidebar surface is tinted. */
|
|
51
|
+
setMenuTheme(menuTheme: MenuTheme): void;
|
|
52
|
+
|
|
53
|
+
/** Chooses the light/dark axis. */
|
|
54
|
+
setColorScheme(colorScheme: ColorScheme): void;
|
|
55
|
+
|
|
56
|
+
/** Records which theme is applied. */
|
|
57
|
+
setThemeName(themeName: string): void;
|
|
58
|
+
|
|
59
|
+
/** Opens or closes the sidebar. */
|
|
60
|
+
setSidebarOpen(isOpen: boolean): void;
|
|
61
|
+
|
|
62
|
+
/** Flips the sidebar between open and closed. */
|
|
63
|
+
toggleSidebar(): void;
|
|
64
|
+
|
|
65
|
+
/** Holds a `reveal`/`drawer` sidebar out, or lets it fall back. */
|
|
66
|
+
setSidebarRevealed(isRevealed: boolean): void;
|
|
67
|
+
|
|
68
|
+
/** Pins or unpins a `reveal`/`drawer` sidebar. */
|
|
69
|
+
toggleSidebarAnchor(): void;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const LayoutConfigContext = createContext<LayoutConfigContextValue | undefined>(undefined);
|
|
73
|
+
|
|
74
|
+
export interface LayoutConfigProviderProps {
|
|
75
|
+
/** Values to start from, overriding both the defaults and anything persisted - a story or a spec pinning a mode. */
|
|
76
|
+
initialConfig?: Partial<LayoutConfigState>;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Where preferences are read from and written to. Defaults to `window.localStorage` when there is a
|
|
80
|
+
* window; pass a fake in a spec, or `null` to opt out of persistence entirely.
|
|
81
|
+
*/
|
|
82
|
+
storage?: Storage | null;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The width the shell should consider its viewport, for a host that renders it into a sized element
|
|
86
|
+
* rather than the window - Studio's preview surface, where the device frame is a few hundred pixels
|
|
87
|
+
* wide while the real window is a desktop one. When given, this replaces the `matchMedia` listener
|
|
88
|
+
* entirely rather than competing with it.
|
|
89
|
+
*/
|
|
90
|
+
viewportWidth?: number;
|
|
91
|
+
|
|
92
|
+
/** The shell this configuration applies to. */
|
|
93
|
+
children?: ReactNode;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Owns the shell's configuration and keeps it in step with the viewport and with `localStorage`.
|
|
98
|
+
*
|
|
99
|
+
* One provider rather than state per shell component is what makes the modes work at all: the topbar's
|
|
100
|
+
* toggle, the sidebar's pin, the mask's click-to-close and the configurator's mode picker are four
|
|
101
|
+
* different components acting on one machine. It is also what makes a chosen mode survive a reload, which
|
|
102
|
+
* is the whole reason a mode picker is worth having.
|
|
103
|
+
*/
|
|
104
|
+
export function LayoutConfigProvider({ initialConfig, storage, viewportWidth, children }: LayoutConfigProviderProps) {
|
|
105
|
+
const resolvedStorage = useMemo(() => (storage !== undefined ? storage ?? undefined : defaultStorage()), [storage]);
|
|
106
|
+
const [config, setConfig] = useState<LayoutConfigState>(() => ({
|
|
107
|
+
...readPersistedLayoutConfig(resolvedStorage),
|
|
108
|
+
...initialConfig,
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
useEffect(() => {
|
|
112
|
+
persistLayoutConfig(config, resolvedStorage);
|
|
113
|
+
}, [config, resolvedStorage]);
|
|
114
|
+
|
|
115
|
+
const isReportedMobile = viewportWidth === undefined ? undefined : isMobileWidth(viewportWidth);
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
if (isReportedMobile !== undefined) {
|
|
118
|
+
setConfig(current => withMobile(current, isReportedMobile));
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const query = window.matchMedia(mobileMediaQuery);
|
|
127
|
+
setConfig(current => withMobile(current, query.matches));
|
|
128
|
+
|
|
129
|
+
const listener = (event: MediaQueryListEvent) => setConfig(current => withMobile(current, event.matches));
|
|
130
|
+
query.addEventListener('change', listener);
|
|
131
|
+
return () => query.removeEventListener('change', listener);
|
|
132
|
+
}, [isReportedMobile]);
|
|
133
|
+
|
|
134
|
+
const value = useMemo<LayoutConfigContextValue>(
|
|
135
|
+
() => ({
|
|
136
|
+
config,
|
|
137
|
+
effectiveMode: effectiveLayoutMode(config),
|
|
138
|
+
wrapperClasses: layoutWrapperClasses(config),
|
|
139
|
+
isMaskVisible: isLayoutMaskVisible(config),
|
|
140
|
+
setMode: mode => setConfig(current => withMode(current, mode)),
|
|
141
|
+
setMenuTheme: menuTheme => setConfig(current => withMenuTheme(current, menuTheme)),
|
|
142
|
+
setColorScheme: colorScheme => setConfig(current => withColorScheme(current, colorScheme)),
|
|
143
|
+
setThemeName: themeName => setConfig(current => withThemeName(current, themeName)),
|
|
144
|
+
setSidebarOpen: isOpen => setConfig(current => withSidebarOpen(current, isOpen)),
|
|
145
|
+
toggleSidebar: () => setConfig(toggleSidebar),
|
|
146
|
+
setSidebarRevealed: isRevealed => setConfig(current => withSidebarRevealed(current, isRevealed)),
|
|
147
|
+
toggleSidebarAnchor: () => setConfig(toggleSidebarAnchor),
|
|
148
|
+
}),
|
|
149
|
+
[config],
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
return <LayoutConfigContext.Provider value={value}>{children}</LayoutConfigContext.Provider>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* The shell configuration, or `undefined` when there is no {@link LayoutConfigProvider} above.
|
|
157
|
+
*
|
|
158
|
+
* This is what lets the shell components put a provider around themselves when a host has not - a gallery
|
|
159
|
+
* preview drops a single `appShell` element into a renderer with no wrapper of its own, and it still has
|
|
160
|
+
* to work.
|
|
161
|
+
*/
|
|
162
|
+
export function useOptionalLayoutConfig(): LayoutConfigContextValue | undefined {
|
|
163
|
+
return useContext(LayoutConfigContext);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The shell configuration. Throws when there is no {@link LayoutConfigProvider} above, because every
|
|
168
|
+
* alternative - a silent default, a no-op setter - produces a shell whose buttons do nothing and says
|
|
169
|
+
* nothing about why.
|
|
170
|
+
*/
|
|
171
|
+
export function useLayoutConfig(): LayoutConfigContextValue {
|
|
172
|
+
const value = useOptionalLayoutConfig();
|
|
173
|
+
if (!value) {
|
|
174
|
+
throw new Error('useLayoutConfig() requires a <LayoutConfigProvider> above it.');
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return value;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function defaultStorage(): Storage | undefined {
|
|
181
|
+
return typeof window !== 'undefined' ? window.localStorage : undefined;
|
|
182
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ColorScheme } from './ColorScheme';
|
|
5
|
+
import { LayoutMode } from './LayoutMode';
|
|
6
|
+
import { MenuTheme } from './MenuTheme';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Everything the shell needs to know about itself, in one place.
|
|
10
|
+
*
|
|
11
|
+
* The shell has a lot of visual state - eight modes, a sidebar that can be open, hovered or pinned, a
|
|
12
|
+
* mobile breakpoint that overrides the chosen mode, two color axes - and every one of those was, in the
|
|
13
|
+
* template line this follows, a separate boolean scattered across components. Holding it as one plain
|
|
14
|
+
* value instead means the whole state machine is pure functions over this record
|
|
15
|
+
* (`layoutConfigTransitions.ts`), testable without React, and rendered by exactly one function
|
|
16
|
+
* ({@link layoutWrapperClasses}).
|
|
17
|
+
*/
|
|
18
|
+
export interface LayoutConfigState {
|
|
19
|
+
/** The mode the user chose. Below the mobile breakpoint the shell renders a different one - see {@link effectiveLayoutMode}. */
|
|
20
|
+
mode: LayoutMode;
|
|
21
|
+
|
|
22
|
+
/** How the sidebar surface is tinted. */
|
|
23
|
+
menuTheme: MenuTheme;
|
|
24
|
+
|
|
25
|
+
/** The light/dark axis. The host maps this onto a {@link Theme}; the shell only records it. */
|
|
26
|
+
colorScheme: ColorScheme;
|
|
27
|
+
|
|
28
|
+
/** The name of the {@link Theme} currently applied, so a theme switcher has something to reflect. */
|
|
29
|
+
themeName: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether the sidebar currently occupies space (`static`) or floats over the content
|
|
33
|
+
* (`overlay`, mobile). One flag rather than the separate desktop/mobile/overlay booleans the
|
|
34
|
+
* template line uses - the mode already says how "open" should look.
|
|
35
|
+
*/
|
|
36
|
+
isSidebarOpen: boolean;
|
|
37
|
+
|
|
38
|
+
/** Whether a `reveal`/`drawer` sidebar is pinned open, so it stays out when the pointer leaves. */
|
|
39
|
+
isSidebarAnchored: boolean;
|
|
40
|
+
|
|
41
|
+
/** Whether a `reveal`/`drawer` sidebar is currently held out by the pointer. */
|
|
42
|
+
isSidebarRevealed: boolean;
|
|
43
|
+
|
|
44
|
+
/** Whether the viewport is below the mobile breakpoint. Never set by a user action - only by the viewport. */
|
|
45
|
+
isMobile: boolean;
|
|
46
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How the application shell arranges its sidebar against its content.
|
|
6
|
+
*
|
|
7
|
+
* The vocabulary - and the `layout-<mode>` wrapper class each value maps to - is deliberately the one
|
|
8
|
+
* PrimeTek's template line has used unchanged across Sakai, Diamond, Atlantis, Freya, Apollo, Ultima,
|
|
9
|
+
* Avalon and Verona. Anyone who has themed a PrimeReact application recognizes it, and a shell that
|
|
10
|
+
* invents its own names forces them to learn a second one for no gain.
|
|
11
|
+
*
|
|
12
|
+
* Every value here is user-selectable. Mobile deliberately is not - see {@link effectiveLayoutMode}.
|
|
13
|
+
*/
|
|
14
|
+
export enum LayoutMode {
|
|
15
|
+
/** Sidebar permanently docked; content is pushed by a matching margin, never covered. */
|
|
16
|
+
Static = 'static',
|
|
17
|
+
|
|
18
|
+
/** Sidebar parked off-canvas; opening floats it over the content behind a mask. */
|
|
19
|
+
Overlay = 'overlay',
|
|
20
|
+
|
|
21
|
+
/** Icon-only rail with circular buttons; submenus pop out as a floating panel. */
|
|
22
|
+
Slim = 'slim',
|
|
23
|
+
|
|
24
|
+
/** Wider rail with each icon's label stacked directly beneath it. */
|
|
25
|
+
SlimPlus = 'slim-plus',
|
|
26
|
+
|
|
27
|
+
/** The icon-only rail again, with square buttons, and the topbar shifted by the rail width. */
|
|
28
|
+
Compact = 'compact',
|
|
29
|
+
|
|
30
|
+
/** Sidebar flows into the topbar strip as a horizontal row; submenus drop down. */
|
|
31
|
+
Horizontal = 'horizontal',
|
|
32
|
+
|
|
33
|
+
/** Full panel translated off-left leaving a strip of icons; hovering slides it in over the content. */
|
|
34
|
+
Reveal = 'reveal',
|
|
35
|
+
|
|
36
|
+
/** Collapsed rail that animates its width to full on hover - it grows where reveal slides. */
|
|
37
|
+
Drawer = 'drawer',
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Every {@link LayoutMode}, in the order a configurator should offer them. */
|
|
41
|
+
export const layoutModes: LayoutMode[] = [
|
|
42
|
+
LayoutMode.Static,
|
|
43
|
+
LayoutMode.Overlay,
|
|
44
|
+
LayoutMode.Slim,
|
|
45
|
+
LayoutMode.SlimPlus,
|
|
46
|
+
LayoutMode.Compact,
|
|
47
|
+
LayoutMode.Horizontal,
|
|
48
|
+
LayoutMode.Reveal,
|
|
49
|
+
LayoutMode.Drawer,
|
|
50
|
+
];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* How the sidebar surface is tinted, independently of the overall {@link ColorScheme}.
|
|
6
|
+
*
|
|
7
|
+
* A dark sidebar against a light page is the single most common brand customization in the PrimeTek
|
|
8
|
+
* template line, which is why menu theme is its own configurator axis rather than something implied by
|
|
9
|
+
* the color scheme. The shell resolves each value from the active theme's tokens, so a menu theme never
|
|
10
|
+
* introduces a color of its own.
|
|
11
|
+
*/
|
|
12
|
+
export enum MenuTheme {
|
|
13
|
+
/** The sidebar uses the theme's ordinary card surface. */
|
|
14
|
+
Light = 'light',
|
|
15
|
+
|
|
16
|
+
/** The sidebar uses an inverted surface, regardless of the page's color scheme. */
|
|
17
|
+
Dark = 'dark',
|
|
18
|
+
|
|
19
|
+
/** The sidebar uses the theme's primary color as its surface. */
|
|
20
|
+
Primary = 'primary',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Every {@link MenuTheme}, in the order a configurator should offer them. */
|
|
24
|
+
export const menuThemes: MenuTheme[] = [MenuTheme.Light, MenuTheme.Dark, MenuTheme.Primary];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
export * from './LayoutMode';
|
|
5
|
+
export * from './ColorScheme';
|
|
6
|
+
export * from './MenuTheme';
|
|
7
|
+
export * from './LayoutConfigState';
|
|
8
|
+
export * from './layoutConfigTransitions';
|
|
9
|
+
export * from './layoutWrapperClasses';
|
|
10
|
+
export * from './layoutConfigStorage';
|
|
11
|
+
export * from './LayoutConfigProvider';
|