@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,76 @@
|
|
|
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 { render, screen } from '@testing-library/react';
|
|
5
|
+
import { SceneElementView, coreComponents, corePackage, mergePackageRegistries } from '@cratis/scene.react';
|
|
6
|
+
import { defaultBlueprint } from '../defaultBlueprint';
|
|
7
|
+
import { composeScreenElement, galleryComponentCatalog, galleryPreviewProfile, galleryScreen, resolveElementComponentNames } from '../gallery';
|
|
8
|
+
|
|
9
|
+
const registry = mergePackageRegistries([corePackage, defaultBlueprint]);
|
|
10
|
+
|
|
11
|
+
function renderGalleryScreen(name: string) {
|
|
12
|
+
const galleryItem = galleryScreen(name)!;
|
|
13
|
+
const element = resolveElementComponentNames(composeScreenElement(galleryItem), galleryPreviewProfile, galleryComponentCatalog);
|
|
14
|
+
render(<SceneElementView element={element} registry={registry} resolveBinding={() => undefined} />);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function has(selector: string): boolean {
|
|
18
|
+
return document.querySelector(selector) !== null;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe('when rendering a gallery screen', () => {
|
|
22
|
+
describe('and it is an application-shell screen', () => {
|
|
23
|
+
beforeEach(() => {
|
|
24
|
+
renderGalleryScreen('Dashboard');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should render the shell wrapper with the default static mode', () => {
|
|
28
|
+
document.querySelector('.layout-wrapper')!.className.should.contain('layout-static');
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should render the topbar', () => {
|
|
32
|
+
has('.layout-topbar').should.equal(true);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should render the sidebar panel the mode CSS positions', () => {
|
|
36
|
+
has('.layout-sidebar').should.equal(true);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should render the navigation the screen contributed', () => {
|
|
40
|
+
screen.getAllByRole('link', { name: /Products/ }).length.should.be.greaterThan(0);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('should render the seeded content rather than a placeholder', () => {
|
|
44
|
+
screen.getAllByText('Revenue').length.should.be.greaterThan(0);
|
|
45
|
+
screen.getAllByText('$284,120').length.should.be.greaterThan(0);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should register the core registry alongside the blueprint one', () => {
|
|
49
|
+
Object.keys(coreComponents)
|
|
50
|
+
.every(key => key in registry)
|
|
51
|
+
.should.equal(true);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe('and it is a full-page screen', () => {
|
|
56
|
+
beforeEach(() => {
|
|
57
|
+
renderGalleryScreen('Login');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should render the chrome-less shell', () => {
|
|
61
|
+
has('.layout-full-page').should.equal(true);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should render the branding aside beside the form', () => {
|
|
65
|
+
has('.layout-full-page-aside').should.equal(true);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should not render an application topbar', () => {
|
|
69
|
+
has('.layout-topbar').should.equal(false);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('should render the form the template seeded', () => {
|
|
73
|
+
screen.getAllByText('Sign in').length.should.be.greaterThan(0);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { render, screen } from '@testing-library/react';
|
|
5
|
+
import { userEvent } from '@testing-library/user-event';
|
|
6
|
+
import { ExternalComponent, HorizontalAlignment, VerticalAlignment, Visibility } from '@cratis/scene.model';
|
|
7
|
+
import { LayoutConfigProvider, LayoutMode, layoutConfigStorageKey, readPersistedLayoutConfig, useLayoutConfig } from '../configuration';
|
|
8
|
+
import { LayoutModeSwitcher } from '../shell';
|
|
9
|
+
|
|
10
|
+
class FakeStorage {
|
|
11
|
+
entries = new Map<string, string>();
|
|
12
|
+
getItem(key: string): string | null {
|
|
13
|
+
return this.entries.has(key) ? this.entries.get(key)! : null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
setItem(key: string, value: string): void {
|
|
17
|
+
this.entries.set(key, value);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const switcherElement: ExternalComponent = {
|
|
22
|
+
id: 'mode-switcher',
|
|
23
|
+
name: 'mode-switcher',
|
|
24
|
+
properties: {},
|
|
25
|
+
visibility: Visibility.Visible,
|
|
26
|
+
isEnabled: true,
|
|
27
|
+
opacity: 1,
|
|
28
|
+
size: {},
|
|
29
|
+
zIndex: 0,
|
|
30
|
+
minimumSize: {},
|
|
31
|
+
maximumSize: {},
|
|
32
|
+
margin: { left: 0, top: 0, right: 0, bottom: 0 },
|
|
33
|
+
horizontalAlignment: HorizontalAlignment.Stretch,
|
|
34
|
+
verticalAlignment: VerticalAlignment.Stretch,
|
|
35
|
+
componentName: 'layoutModeSwitcher',
|
|
36
|
+
slots: {},
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
function CurrentMode() {
|
|
40
|
+
const { config, effectiveMode } = useLayoutConfig();
|
|
41
|
+
return <output data-testid='mode'>{`${config.mode}/${effectiveMode}`}</output>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
describe('when switching mode and reloading', () => {
|
|
45
|
+
let storage: FakeStorage;
|
|
46
|
+
|
|
47
|
+
beforeEach(async () => {
|
|
48
|
+
storage = new FakeStorage();
|
|
49
|
+
render(
|
|
50
|
+
<LayoutConfigProvider storage={storage as unknown as Storage}>
|
|
51
|
+
<LayoutModeSwitcher element={switcherElement} slots={{}} />
|
|
52
|
+
<CurrentMode />
|
|
53
|
+
</LayoutConfigProvider>,
|
|
54
|
+
);
|
|
55
|
+
await userEvent.click(screen.getByRole('button', { name: 'Drawer' }));
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should apply the chosen mode immediately', () => {
|
|
59
|
+
screen.getByTestId('mode').textContent!.should.equal(`${LayoutMode.Drawer}/${LayoutMode.Drawer}`);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should mark the chosen mode as pressed', () => {
|
|
63
|
+
screen.getByRole('button', { name: 'Drawer' }).getAttribute('aria-pressed')!.should.equal('true');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should persist the choice under the storage key', () => {
|
|
67
|
+
storage.getItem(layoutConfigStorageKey)!.should.contain(LayoutMode.Drawer);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should come back with the same mode after a reload', () => {
|
|
71
|
+
readPersistedLayoutConfig(storage as unknown as Storage).mode.should.equal(LayoutMode.Drawer);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('should not persist whether the sidebar happened to be open', () => {
|
|
75
|
+
storage.getItem(layoutConfigStorageKey)!.should.not.contain('isSidebarOpen');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { FlowArrangement, HeightSizeClass, WidthSizeClass } from '@cratis/scene.model';
|
|
5
|
+
import { evaluateFlowArrangement } from '@cratis/scene.engine';
|
|
6
|
+
import {
|
|
7
|
+
appShellArrangement,
|
|
8
|
+
appShellCompactHeightRoot,
|
|
9
|
+
appShellCompactRoot,
|
|
10
|
+
appShellCompactWidthRoot,
|
|
11
|
+
appShellLayout,
|
|
12
|
+
appShellRegularRoot,
|
|
13
|
+
} from '../layouts';
|
|
14
|
+
|
|
15
|
+
describe('when evaluating the arrangement at each size class', () => {
|
|
16
|
+
const arrangement = appShellLayout.arrangement as FlowArrangement;
|
|
17
|
+
|
|
18
|
+
const regular = evaluateFlowArrangement(arrangement, { width: WidthSizeClass.Regular, height: HeightSizeClass.Regular });
|
|
19
|
+
const compactWidth = evaluateFlowArrangement(arrangement, { width: WidthSizeClass.Compact, height: HeightSizeClass.Regular });
|
|
20
|
+
const compactHeight = evaluateFlowArrangement(arrangement, { width: WidthSizeClass.Regular, height: HeightSizeClass.Compact });
|
|
21
|
+
const compactBoth = evaluateFlowArrangement(arrangement, { width: WidthSizeClass.Compact, height: HeightSizeClass.Compact });
|
|
22
|
+
|
|
23
|
+
it('should use the full tree at a regular width and height', () => {
|
|
24
|
+
regular.should.equal(appShellRegularRoot);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should collapse the sidebar out of the flow at a compact width', () => {
|
|
28
|
+
compactWidth.should.equal(appShellCompactWidthRoot);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should drop the breadcrumb and footer at a compact height', () => {
|
|
32
|
+
compactHeight.should.equal(appShellCompactHeightRoot);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should prefer the override targeting both axes when both are compact', () => {
|
|
36
|
+
compactBoth.should.equal(appShellCompactRoot);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should be the layout declared on the blueprint', () => {
|
|
40
|
+
arrangement.should.equal(appShellArrangement);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
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 { PackageKind } from '@cratis/scene.model';
|
|
5
|
+
import { validatePackageBundle } from '@cratis/scene.react';
|
|
6
|
+
import { defaultBlueprint, defaultBlueprintManifest } from '../defaultBlueprint';
|
|
7
|
+
import { defaultBlueprintName } from '../packageName';
|
|
8
|
+
|
|
9
|
+
describe('when validating the bundle', () => {
|
|
10
|
+
const problems = validatePackageBundle(defaultBlueprint);
|
|
11
|
+
|
|
12
|
+
it('should report no problems', () => {
|
|
13
|
+
problems.should.be.empty;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should declare itself a blueprint', () => {
|
|
17
|
+
defaultBlueprintManifest.kind.should.equal(PackageKind.Blueprint);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should be named as a blueprint package', () => {
|
|
21
|
+
defaultBlueprintManifest.name.should.equal(defaultBlueprintName);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should depend on the component libraries its shells are built from', () => {
|
|
25
|
+
defaultBlueprintManifest.dependencies.map(dependency => dependency.name).should.deep.equal(['PrimeReact', 'Cratis.Components']);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should declare only application shells as layouts', () => {
|
|
29
|
+
defaultBlueprintManifest.layouts.should.deep.equal(['AppShell', 'FullPage']);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should declare a screen template for every one it provides', () => {
|
|
33
|
+
defaultBlueprintManifest.screenTemplates.should.deep.equal((defaultBlueprint.screenTemplates ?? []).map(template => template.name));
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('should declare a dialog template for every one it provides', () => {
|
|
37
|
+
defaultBlueprintManifest.dialogTemplates.should.deep.equal((defaultBlueprint.dialogTemplates ?? []).map(template => template.name));
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should ship a screen for every screen template', () => {
|
|
41
|
+
(defaultBlueprint.screens ?? []).map(screen => screen.name).should.deep.equal(defaultBlueprintManifest.screenTemplates);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -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
|
+
import { incompatiblePackages } from '@cratis/scene.engine';
|
|
5
|
+
import { themeTokenProperty } from '@cratis/scene.react';
|
|
6
|
+
import { galleryProfile } from '../gallery';
|
|
7
|
+
import { darkTheme, defaultBlueprintThemes, lightTheme } from '../themes';
|
|
8
|
+
|
|
9
|
+
describe('when checking attribution and tokens', () => {
|
|
10
|
+
for (const theme of defaultBlueprintThemes) {
|
|
11
|
+
describe(`and the theme is '${theme.name}'`, () => {
|
|
12
|
+
it('should say who made it', () => {
|
|
13
|
+
(theme.author ?? '').should.not.be.empty;
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('should link to them', () => {
|
|
17
|
+
(theme.authorUrl ?? '').should.not.be.empty;
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should state the license it is used under', () => {
|
|
21
|
+
(theme.license ?? '').should.not.be.empty;
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should be compatible with every package the gallery profile activates', () => {
|
|
25
|
+
incompatiblePackages(theme, galleryProfile).should.be.empty;
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should declare compatibility with core, which gets no implicit exemption', () => {
|
|
29
|
+
theme.compatibleWith.should.contain('core');
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
it('should define exactly the same token names in both themes', () => {
|
|
35
|
+
Object.keys(lightTheme.tokens ?? {})
|
|
36
|
+
.sort()
|
|
37
|
+
.should.deep.equal(Object.keys(darkTheme.tokens ?? {}).sort());
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should ship one light and one dark theme', () => {
|
|
41
|
+
defaultBlueprintThemes.filter(theme => theme.isDark === true).should.have.lengthOf(1);
|
|
42
|
+
defaultBlueprintThemes.filter(theme => theme.isDark !== true).should.have.lengthOf(1);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should name tokens that become the custom properties the stylesheet reads', () => {
|
|
46
|
+
themeTokenProperty('primary.contrastColor').should.equal('--scene-primary-contrast-color');
|
|
47
|
+
themeTokenProperty('text.mutedColor').should.equal('--scene-text-muted-color');
|
|
48
|
+
themeTokenProperty('content.borderRadius').should.equal('--scene-content-border-radius');
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
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 { FlowArrangement, FlowContainer, FlowSlotLeaf, HeightSizeClass, WidthSizeClass } from '@cratis/scene.model';
|
|
5
|
+
import { evaluateFlowArrangement } from '@cratis/scene.engine';
|
|
6
|
+
import { SlotName, fullPageCompactWidthRoot, fullPageLayout, fullPageRegularRoot } from '../layouts';
|
|
7
|
+
|
|
8
|
+
describe('when evaluating the arrangement at each size class', () => {
|
|
9
|
+
const arrangement = fullPageLayout.arrangement as FlowArrangement;
|
|
10
|
+
|
|
11
|
+
const regular = evaluateFlowArrangement(arrangement, { width: WidthSizeClass.Regular, height: HeightSizeClass.Regular });
|
|
12
|
+
const compactWidth = evaluateFlowArrangement(arrangement, { width: WidthSizeClass.Compact, height: HeightSizeClass.Regular });
|
|
13
|
+
const compactHeight = evaluateFlowArrangement(arrangement, { width: WidthSizeClass.Regular, height: HeightSizeClass.Compact });
|
|
14
|
+
const compactBoth = evaluateFlowArrangement(arrangement, { width: WidthSizeClass.Compact, height: HeightSizeClass.Compact });
|
|
15
|
+
|
|
16
|
+
it('should use the split tree at a regular width', () => {
|
|
17
|
+
regular.should.equal(fullPageRegularRoot);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('should keep the split tree at a compact height, which the width override does not target', () => {
|
|
21
|
+
compactHeight.should.equal(fullPageRegularRoot);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should drop the branding aside at a compact width', () => {
|
|
25
|
+
compactWidth.should.equal(fullPageCompactWidthRoot);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should drop the branding aside whenever the width is compact, whatever the height is', () => {
|
|
29
|
+
compactBoth.should.equal(fullPageCompactWidthRoot);
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should leave the compact-width tree with no reference to the aside slot', () => {
|
|
33
|
+
const leaves = (fullPageCompactWidthRoot as FlowContainer).children as FlowSlotLeaf[];
|
|
34
|
+
leaves.map(leaf => leaf.slotName).should.not.contain(SlotName.Aside);
|
|
35
|
+
});
|
|
36
|
+
});
|
package/for_galleryScreenTemplates/when_checking_that_arrangements_reference_declared_slots.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
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 { Arrangement, FlowArrangement, FlowContainer, FlowNode, Slot } from '@cratis/scene.model';
|
|
5
|
+
import { defaultBlueprint } from '../defaultBlueprint';
|
|
6
|
+
import { galleryScreenTemplates } from '../gallery';
|
|
7
|
+
|
|
8
|
+
function slotNamesIn(node: FlowNode): string[] {
|
|
9
|
+
if ('slotName' in node) {
|
|
10
|
+
return [(node as { slotName: string }).slotName];
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if ('children' in node) {
|
|
14
|
+
return (node as FlowContainer).children.flatMap(slotNamesIn);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return [];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function referencedSlots(arrangement: Arrangement | undefined): string[] {
|
|
21
|
+
const flow = arrangement as FlowArrangement | undefined;
|
|
22
|
+
if (!flow?.root) {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return [flow.root, ...(flow.overrides ?? []).map(override => override.root)].flatMap(slotNamesIn);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function undeclared(slots: Slot[], arrangement: Arrangement | undefined): string[] {
|
|
30
|
+
const declared = new Set(slots.map(slot => slot.name));
|
|
31
|
+
return [...new Set(referencedSlots(arrangement))].filter(name => !declared.has(name));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
describe('when checking that arrangements reference declared slots', () => {
|
|
35
|
+
for (const layout of defaultBlueprint.layouts ?? []) {
|
|
36
|
+
it(`should reference only slots the '${layout.name}' layout declares`, () => {
|
|
37
|
+
undeclared(layout.slots, layout.arrangement).should.be.empty;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
for (const template of galleryScreenTemplates.filter(candidate => candidate.arrangement !== undefined)) {
|
|
42
|
+
it(`should reference only slots the '${template.name}' template declares`, () => {
|
|
43
|
+
undeclared(template.slots, template.arrangement).should.be.empty;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
for (const template of galleryScreenTemplates) {
|
|
48
|
+
it(`should file '${template.name}' content only under slots it declares`, () => {
|
|
49
|
+
const declared = new Set(template.slots.map(slot => slot.name));
|
|
50
|
+
Object.keys(template.content ?? {}).filter(name => !declared.has(name)).should.be.empty;
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { Slot } from '@cratis/scene.model';
|
|
5
|
+
import { appShellLayout, fullPageLayout } from '../layouts';
|
|
6
|
+
import { featureSectionTemplate, galleryScreenTemplates, moduleWorkspaceTemplate, sliceSectionTemplate } from '../gallery';
|
|
7
|
+
|
|
8
|
+
function declares(slots: Slot[], name: string | undefined): boolean {
|
|
9
|
+
return name !== undefined && slots.some(slot => slot.name === name);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
describe('when following the nesting chain', () => {
|
|
13
|
+
it('should fit the module template into a slot the application layout declares', () => {
|
|
14
|
+
declares(appShellLayout.slots, moduleWorkspaceTemplate.fitsSlot).should.be.true;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('should fit the feature template into a slot the module template declares', () => {
|
|
18
|
+
declares(moduleWorkspaceTemplate.slots, featureSectionTemplate.fitsSlot).should.be.true;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should fit the slice template into a slot the feature template declares', () => {
|
|
22
|
+
declares(featureSectionTemplate.slots, sliceSectionTemplate.fitsSlot).should.be.true;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should resolve each level against its direct parent rather than globally', () => {
|
|
26
|
+
featureSectionTemplate.fitsSlot!.should.equal(sliceSectionTemplate.fitsSlot!);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('should fit every other template into a slot one of the layouts declares', () => {
|
|
30
|
+
const layoutSlots = [...appShellLayout.slots, ...fullPageLayout.slots];
|
|
31
|
+
const templateSlots = galleryScreenTemplates.flatMap(template => template.slots);
|
|
32
|
+
galleryScreenTemplates
|
|
33
|
+
.filter(template => !declares(layoutSlots, template.fitsSlot) && !declares(templateSlots, template.fitsSlot))
|
|
34
|
+
.map(template => template.name)
|
|
35
|
+
.should.be.empty;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should give every screen template a slot to fit into', () => {
|
|
39
|
+
galleryScreenTemplates.filter(template => template.fitsSlot === undefined).map(template => template.name).should.be.empty;
|
|
40
|
+
});
|
|
41
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { Layout } from '@cratis/scene.model';
|
|
5
|
+
import { defaultBlueprint } from '../defaultBlueprint';
|
|
6
|
+
import { galleryScreens } from '../gallery';
|
|
7
|
+
import { shellComponentForLayout } from '../layouts';
|
|
8
|
+
|
|
9
|
+
describe('when checking the layouts and slots they fill', () => {
|
|
10
|
+
const layouts = defaultBlueprint.layouts ?? [];
|
|
11
|
+
const layoutsByName = new Map<string, Layout>(layouts.map(layout => [layout.name, layout]));
|
|
12
|
+
|
|
13
|
+
it('should have at least one screen to check', () => {
|
|
14
|
+
galleryScreens.should.not.be.empty;
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
for (const screen of galleryScreens) {
|
|
18
|
+
describe(`and the screen is '${screen.name}'`, () => {
|
|
19
|
+
const layout = layoutsByName.get(screen.layout);
|
|
20
|
+
|
|
21
|
+
it('should name a layout this blueprint provides', () => {
|
|
22
|
+
(layout !== undefined).should.be.true;
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('should fill only slots the layout declares', () => {
|
|
26
|
+
const declared = new Set((layout?.slots ?? []).map(slot => slot.name));
|
|
27
|
+
const filled = Object.keys(screen.slotContent);
|
|
28
|
+
filled.filter(name => !declared.has(name)).should.be.empty;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should fill the content slot, which is the only one every layout declares', () => {
|
|
32
|
+
(screen.slotContent.content?.length ?? 0).should.be.greaterThan(0);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should name a screen template this blueprint provides', () => {
|
|
36
|
+
(defaultBlueprint.screenTemplates ?? []).map(template => template.name).should.contain(screen.screenTemplate);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should render in a shell this blueprint provides', () => {
|
|
40
|
+
(shellComponentForLayout(screen.layout) !== undefined).should.be.true;
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -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
|
+
import { resolveComponentName } from '@cratis/scene.engine';
|
|
5
|
+
import { ComponentName } from '../ComponentName';
|
|
6
|
+
import {
|
|
7
|
+
composeScreenElement,
|
|
8
|
+
distinctComponentNames,
|
|
9
|
+
galleryComponentCatalog,
|
|
10
|
+
galleryDialogTemplates,
|
|
11
|
+
galleryProfile,
|
|
12
|
+
galleryScreens,
|
|
13
|
+
} from '../gallery';
|
|
14
|
+
import { defaultBlueprintName } from '../packageName';
|
|
15
|
+
|
|
16
|
+
describe('when resolving the component names they reference', () => {
|
|
17
|
+
const fromScreens = distinctComponentNames(galleryScreens.map(composeScreenElement));
|
|
18
|
+
const fromDialogs = distinctComponentNames(galleryDialogTemplates.flatMap(template => Object.values(template.content ?? {}).flat()));
|
|
19
|
+
const names = [...new Set([...fromScreens, ...fromDialogs])].sort();
|
|
20
|
+
const resolutions = names.map(name => ({ name, resolution: resolveComponentName(name, galleryProfile, galleryComponentCatalog) }));
|
|
21
|
+
const blueprintNames = new Set<string>(Object.values(ComponentName));
|
|
22
|
+
|
|
23
|
+
it('should reference something', () => {
|
|
24
|
+
names.should.not.be.empty;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should reference something from the dialog templates too', () => {
|
|
28
|
+
fromDialogs.should.not.be.empty;
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should resolve every referenced name against the profile', () => {
|
|
32
|
+
resolutions
|
|
33
|
+
.filter(entry => entry.resolution === undefined)
|
|
34
|
+
.map(entry => entry.name)
|
|
35
|
+
.should.be.empty;
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should resolve this blueprint own names to this blueprint', () => {
|
|
39
|
+
resolutions
|
|
40
|
+
.filter(entry => blueprintNames.has(entry.name))
|
|
41
|
+
.filter(entry => entry.resolution?.package !== defaultBlueprintName)
|
|
42
|
+
.map(entry => entry.name)
|
|
43
|
+
.should.be.empty;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('should shadow the component libraries for the names this blueprint also declares', () => {
|
|
47
|
+
const menu = resolveComponentName(ComponentName.Menu, galleryProfile, galleryComponentCatalog);
|
|
48
|
+
menu!.package.should.equal(defaultBlueprintName);
|
|
49
|
+
menu!.shadows.should.contain('PrimeReact');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should reference every shell component the blueprint registers except the ones a host places itself', () => {
|
|
53
|
+
const referenced = new Set(names);
|
|
54
|
+
const placedByAHostRatherThanATemplate = [ComponentName.Mask, ComponentName.ThemeSwitcher, ComponentName.LayoutModeSwitcher, ComponentName.RightPanel];
|
|
55
|
+
Object.values(ComponentName)
|
|
56
|
+
.filter(name => !placedByAHostRatherThanATemplate.includes(name))
|
|
57
|
+
.filter(name => !referenced.has(name))
|
|
58
|
+
.should.be.empty;
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
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, LayoutMode, MenuTheme, defaultLayoutConfigState, layoutConfigStorageKey, persistLayoutConfig, readPersistedLayoutConfig, withMobile, withMode, withSidebarAnchored } from '../configuration';
|
|
5
|
+
|
|
6
|
+
class FakeStorage {
|
|
7
|
+
entries = new Map<string, string>();
|
|
8
|
+
getItem(key: string): string | null {
|
|
9
|
+
return this.entries.has(key) ? this.entries.get(key)! : null;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
setItem(key: string, value: string): void {
|
|
13
|
+
this.entries.set(key, value);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function storageWith(raw: string): Storage {
|
|
18
|
+
const storage = new FakeStorage();
|
|
19
|
+
storage.setItem(layoutConfigStorageKey, raw);
|
|
20
|
+
return storage as unknown as Storage;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
describe('when restoring a persisted configuration', () => {
|
|
24
|
+
it('should fall back to the defaults when nothing was persisted', () => {
|
|
25
|
+
readPersistedLayoutConfig(new FakeStorage() as unknown as Storage).should.deep.equal(defaultLayoutConfigState());
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should fall back to the defaults when there is no storage at all', () => {
|
|
29
|
+
readPersistedLayoutConfig(undefined).should.deep.equal(defaultLayoutConfigState());
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('should round-trip the preferences that are worth keeping', () => {
|
|
33
|
+
const storage = new FakeStorage() as unknown as Storage;
|
|
34
|
+
const chosen = withSidebarAnchored(withMode(defaultLayoutConfigState(), LayoutMode.Drawer), true);
|
|
35
|
+
persistLayoutConfig(chosen, storage);
|
|
36
|
+
|
|
37
|
+
const restored = readPersistedLayoutConfig(storage);
|
|
38
|
+
restored.mode.should.equal(LayoutMode.Drawer);
|
|
39
|
+
restored.isSidebarAnchored.should.be.true;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should not restore the transient state', () => {
|
|
43
|
+
const storage = new FakeStorage() as unknown as Storage;
|
|
44
|
+
persistLayoutConfig(withMobile(defaultLayoutConfigState(), true), storage);
|
|
45
|
+
readPersistedLayoutConfig(storage).isMobile.should.be.false;
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('should ignore an unrecognized mode rather than putting a class no rule matches on the wrapper', () => {
|
|
49
|
+
readPersistedLayoutConfig(storageWith('{"mode":"kaleidoscope"}')).mode.should.equal(defaultLayoutConfigState().mode);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should ignore an unrecognized menu theme and color scheme', () => {
|
|
53
|
+
const restored = readPersistedLayoutConfig(storageWith('{"menuTheme":"neon","colorScheme":"sepia"}'));
|
|
54
|
+
restored.menuTheme.should.equal(MenuTheme.Light);
|
|
55
|
+
restored.colorScheme.should.equal(ColorScheme.Light);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should survive malformed json', () => {
|
|
59
|
+
readPersistedLayoutConfig(storageWith('{ not json')).should.deep.equal(defaultLayoutConfigState());
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('should survive json that is not an object', () => {
|
|
63
|
+
readPersistedLayoutConfig(storageWith('[1,2,3]')).should.deep.equal(defaultLayoutConfigState());
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should not throw when storage refuses to write', () => {
|
|
67
|
+
const refusing = {
|
|
68
|
+
getItem: () => null,
|
|
69
|
+
setItem: () => {
|
|
70
|
+
throw new Error('QuotaExceededError');
|
|
71
|
+
},
|
|
72
|
+
} as unknown as Storage;
|
|
73
|
+
|
|
74
|
+
(() => persistLayoutConfig(defaultLayoutConfigState(), refusing)).should.not.throw();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
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 {
|
|
5
|
+
LayoutMode,
|
|
6
|
+
defaultLayoutConfigState,
|
|
7
|
+
isPointerRevealMode,
|
|
8
|
+
toggleSidebarAnchor,
|
|
9
|
+
withMode,
|
|
10
|
+
withSidebarRevealed,
|
|
11
|
+
} from '../configuration';
|
|
12
|
+
|
|
13
|
+
describe('when anchoring a reveal sidebar', () => {
|
|
14
|
+
const reveal = withMode(defaultLayoutConfigState(), LayoutMode.Reveal);
|
|
15
|
+
const anchored = toggleSidebarAnchor(reveal);
|
|
16
|
+
|
|
17
|
+
it('should recognize reveal and drawer as the pointer-driven modes', () => {
|
|
18
|
+
isPointerRevealMode(LayoutMode.Reveal).should.be.true;
|
|
19
|
+
isPointerRevealMode(LayoutMode.Drawer).should.be.true;
|
|
20
|
+
isPointerRevealMode(LayoutMode.Static).should.be.false;
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should hold the sidebar out as soon as it is anchored', () => {
|
|
24
|
+
anchored.isSidebarRevealed.should.be.true;
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should ignore the pointer while anchored', () => {
|
|
28
|
+
withSidebarRevealed(anchored, false).should.equal(anchored);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('should let the pointer take over again once unanchored', () => {
|
|
32
|
+
const unanchored = toggleSidebarAnchor(anchored);
|
|
33
|
+
unanchored.isSidebarAnchored.should.be.false;
|
|
34
|
+
withSidebarRevealed(unanchored, true).isSidebarRevealed.should.be.true;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should keep the pin across a mode change, since it is a preference rather than transient state', () => {
|
|
38
|
+
withMode(anchored, LayoutMode.Drawer).isSidebarAnchored.should.be.true;
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('should drop a pointer-held reveal when the mode changes', () => {
|
|
42
|
+
withMode(withSidebarRevealed(reveal, true), LayoutMode.Static).isSidebarRevealed.should.be.false;
|
|
43
|
+
});
|
|
44
|
+
});
|