@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,161 @@
|
|
|
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 { ScreenTemplate } from '@cratis/scene.model';
|
|
5
|
+
import { ComponentName } from '../ComponentName';
|
|
6
|
+
import { SlotName } from '../layouts';
|
|
7
|
+
import { TemplateSlotName } from './TemplateSlotName';
|
|
8
|
+
import { button, card, externalComponent, text } from './elements';
|
|
9
|
+
import { field, formActions } from './widgets';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The six screens that stand between someone and the application: sign in, register, forgotten password,
|
|
13
|
+
* new password, verification and the lock screen.
|
|
14
|
+
*
|
|
15
|
+
* All six fit the full-page layout's `content` slot and fill its `aside` with the branding half. That
|
|
16
|
+
* split - a colored panel of brand next to a narrow column of form - is the shape the premium PrimeTek
|
|
17
|
+
* templates use for every one of them, and the reason it works is that it gives the form somewhere to be
|
|
18
|
+
* *small*, which is what a sign-in form should be.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** The branding half every authentication screen shares. */
|
|
22
|
+
function brandingAside(id: string, headline: string, supporting: string) {
|
|
23
|
+
return [
|
|
24
|
+
externalComponent(`${id}-logo`, ComponentName.Logo, { label: 'Contoso', initials: 'C' }),
|
|
25
|
+
text(`${id}-headline`, headline),
|
|
26
|
+
text(`${id}-supporting`, supporting),
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Sign in. */
|
|
31
|
+
export const loginTemplate: ScreenTemplate = {
|
|
32
|
+
name: 'Login',
|
|
33
|
+
fitsSlot: SlotName.Content,
|
|
34
|
+
slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],
|
|
35
|
+
content: {
|
|
36
|
+
[SlotName.Aside]: brandingAside('login', 'Welcome back', 'Everything your team shipped since you were last here is waiting.'),
|
|
37
|
+
[TemplateSlotName.Body]: [
|
|
38
|
+
card('login-card', [
|
|
39
|
+
text('login-title', 'Sign in'),
|
|
40
|
+
field('login-email', 'Email', 'inputText', { placeholder: 'you@contoso.com' }),
|
|
41
|
+
field('login-password', 'Password', 'password', { feedback: false }),
|
|
42
|
+
field('login-remember', 'Keep me signed in', 'checkbox', {}),
|
|
43
|
+
formActions('login-actions', 'Sign in', 'Use a different account'),
|
|
44
|
+
button('login-forgot', 'I forgot my password', { link: true, targetScreen: 'ForgotPassword' }),
|
|
45
|
+
]),
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
displayName: 'Sign in',
|
|
49
|
+
description: 'Email and password beside the branding panel.',
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** Register. */
|
|
53
|
+
export const registerTemplate: ScreenTemplate = {
|
|
54
|
+
name: 'Register',
|
|
55
|
+
fitsSlot: SlotName.Content,
|
|
56
|
+
slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],
|
|
57
|
+
content: {
|
|
58
|
+
[SlotName.Aside]: brandingAside('register', 'Start in two minutes', 'No card, no call, no sales engineer. Just an account.'),
|
|
59
|
+
[TemplateSlotName.Body]: [
|
|
60
|
+
card('register-card', [
|
|
61
|
+
text('register-title', 'Create your account'),
|
|
62
|
+
field('register-name', 'Full name', 'inputText', {}),
|
|
63
|
+
field('register-email', 'Work email', 'inputText', { placeholder: 'you@contoso.com' }),
|
|
64
|
+
field('register-password', 'Password', 'password', { feedback: true }),
|
|
65
|
+
field('register-terms', 'I accept the terms of service', 'checkbox', {}),
|
|
66
|
+
formActions('register-actions', 'Create account', 'I already have one'),
|
|
67
|
+
]),
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
displayName: 'Register',
|
|
71
|
+
description: 'Account creation with a password strength meter and the terms checkbox.',
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** Forgotten password: ask for the address. */
|
|
75
|
+
export const forgotPasswordTemplate: ScreenTemplate = {
|
|
76
|
+
name: 'ForgotPassword',
|
|
77
|
+
fitsSlot: SlotName.Content,
|
|
78
|
+
slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],
|
|
79
|
+
content: {
|
|
80
|
+
[SlotName.Aside]: brandingAside('forgot', 'It happens', 'Tell us the address you signed up with and we will send a link.'),
|
|
81
|
+
[TemplateSlotName.Body]: [
|
|
82
|
+
card('forgot-card', [
|
|
83
|
+
text('forgot-title', 'Reset your password'),
|
|
84
|
+
field('forgot-email', 'Email', 'inputText', { placeholder: 'you@contoso.com' }),
|
|
85
|
+
formActions('forgot-actions', 'Send the link', 'Back to sign in'),
|
|
86
|
+
]),
|
|
87
|
+
],
|
|
88
|
+
},
|
|
89
|
+
displayName: 'Forgotten password',
|
|
90
|
+
description: 'One field and one button - the whole point is that it asks for nothing else.',
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/** New password: the other end of the link. */
|
|
94
|
+
export const newPasswordTemplate: ScreenTemplate = {
|
|
95
|
+
name: 'NewPassword',
|
|
96
|
+
fitsSlot: SlotName.Content,
|
|
97
|
+
slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],
|
|
98
|
+
content: {
|
|
99
|
+
[SlotName.Aside]: brandingAside('new-password', 'Almost there', 'Choose something you have not used anywhere else.'),
|
|
100
|
+
[TemplateSlotName.Body]: [
|
|
101
|
+
card('new-password-card', [
|
|
102
|
+
text('new-password-title', 'Choose a new password'),
|
|
103
|
+
field('new-password-value', 'New password', 'password', { feedback: true }),
|
|
104
|
+
field('new-password-confirm', 'Confirm it', 'password', { feedback: false }),
|
|
105
|
+
formActions('new-password-actions', 'Set the password', 'Cancel'),
|
|
106
|
+
]),
|
|
107
|
+
],
|
|
108
|
+
},
|
|
109
|
+
displayName: 'New password',
|
|
110
|
+
description: 'Where a reset link lands: choose it, confirm it, done.',
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
/** Verification: the code from the email. */
|
|
114
|
+
export const verificationTemplate: ScreenTemplate = {
|
|
115
|
+
name: 'Verification',
|
|
116
|
+
fitsSlot: SlotName.Content,
|
|
117
|
+
slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],
|
|
118
|
+
content: {
|
|
119
|
+
[SlotName.Aside]: brandingAside('verification', 'Check your email', 'We sent a six-digit code. It expires in ten minutes.'),
|
|
120
|
+
[TemplateSlotName.Body]: [
|
|
121
|
+
card('verification-card', [
|
|
122
|
+
text('verification-title', 'Enter the code'),
|
|
123
|
+
externalComponent('verification-steps', 'steps', { model: ['Account', 'Verify', 'Done'], activeIndex: 1 }),
|
|
124
|
+
field('verification-code', 'Six-digit code', 'inputText', { maxLength: 6 }),
|
|
125
|
+
formActions('verification-actions', 'Verify', 'Send it again'),
|
|
126
|
+
]),
|
|
127
|
+
],
|
|
128
|
+
},
|
|
129
|
+
displayName: 'Verification',
|
|
130
|
+
description: 'The code step, with the progress indicator that tells you how much is left.',
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
/** Lock screen: the session is still there, the person has to prove they are. */
|
|
134
|
+
export const lockScreenTemplate: ScreenTemplate = {
|
|
135
|
+
name: 'LockScreen',
|
|
136
|
+
fitsSlot: SlotName.Content,
|
|
137
|
+
slots: [{ name: SlotName.Aside }, { name: TemplateSlotName.Body }],
|
|
138
|
+
content: {
|
|
139
|
+
[SlotName.Aside]: brandingAside('lock', 'Locked', 'Your work is exactly where you left it.'),
|
|
140
|
+
[TemplateSlotName.Body]: [
|
|
141
|
+
card('lock-card', [
|
|
142
|
+
externalComponent('lock-avatar', 'avatar', { label: 'AN', size: 'xlarge', shape: 'circle' }),
|
|
143
|
+
text('lock-name', 'Amelia Nyquist'),
|
|
144
|
+
field('lock-password', 'Password', 'password', { feedback: false }),
|
|
145
|
+
formActions('lock-actions', 'Unlock', 'Sign in as someone else'),
|
|
146
|
+
]),
|
|
147
|
+
],
|
|
148
|
+
},
|
|
149
|
+
displayName: 'Lock screen',
|
|
150
|
+
description: 'One person, one password, and no way to lose what was open.',
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/** The six authentication templates. */
|
|
154
|
+
export const authTemplates: ScreenTemplate[] = [
|
|
155
|
+
loginTemplate,
|
|
156
|
+
registerTemplate,
|
|
157
|
+
forgotPasswordTemplate,
|
|
158
|
+
newPasswordTemplate,
|
|
159
|
+
verificationTemplate,
|
|
160
|
+
lockScreenTemplate,
|
|
161
|
+
];
|
|
@@ -0,0 +1,55 @@
|
|
|
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 { SceneElement } from '@cratis/scene.model';
|
|
5
|
+
import { isContentControl, isExternalComponent, isItemsControl, isPanel } from '@cratis/scene.engine';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Every component name an element tree references.
|
|
9
|
+
*
|
|
10
|
+
* A blueprint's templates name components the blueprint itself does not provide - the widgets come from
|
|
11
|
+
* the component libraries it depends on - and a name no active package declares renders as a dashed red
|
|
12
|
+
* placeholder somewhere inside a screen, with nothing pointing back at the template that wrote it.
|
|
13
|
+
* Collecting the names up front is what lets that be a failed check at build or design time instead.
|
|
14
|
+
*
|
|
15
|
+
* The walk uses the engine's own kind guards rather than its own, so it visits exactly the branches the
|
|
16
|
+
* renderer visits and cannot drift from it.
|
|
17
|
+
*
|
|
18
|
+
* @param element The root to walk.
|
|
19
|
+
* @returns Every `componentName` found, in encounter order, with duplicates.
|
|
20
|
+
*/
|
|
21
|
+
export function componentNamesIn(element: SceneElement): string[] {
|
|
22
|
+
const names: string[] = [];
|
|
23
|
+
|
|
24
|
+
if (isExternalComponent(element)) {
|
|
25
|
+
names.push(element.componentName);
|
|
26
|
+
for (const children of Object.values(element.slots)) {
|
|
27
|
+
for (const child of children) {
|
|
28
|
+
names.push(...componentNamesIn(child));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (isContentControl(element)) {
|
|
34
|
+
names.push(...componentNamesIn(element.content));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (isItemsControl(element)) {
|
|
38
|
+
names.push(...componentNamesIn(element.itemTemplate));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (isPanel(element)) {
|
|
42
|
+
for (const child of element.children) {
|
|
43
|
+
names.push(...componentNamesIn(child));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return names;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Every distinct component name a set of element trees references, sorted so a report of them is stable.
|
|
52
|
+
*/
|
|
53
|
+
export function distinctComponentNames(elements: SceneElement[]): string[] {
|
|
54
|
+
return [...new Set(elements.flatMap(componentNamesIn))].sort();
|
|
55
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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 { ExternalComponent, Layout, SceneElement, Screen, ScreenTemplate } from '@cratis/scene.model';
|
|
5
|
+
import { shellComponentForLayout } from '../layouts';
|
|
6
|
+
import { externalComponent } from './elements';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Turns a {@link ScreenTemplate}'s content into slot content on the {@link Layout} that contains it.
|
|
10
|
+
*
|
|
11
|
+
* The rule has two halves, and both matter. Content filed under a slot the *layout* also declares stays
|
|
12
|
+
* under that name - which is how a sign-in template's branding half reaches the full-page layout's `aside`
|
|
13
|
+
* region rather than being buried inside the form column. Everything else flows into the slot the
|
|
14
|
+
* template's `fitsSlot` names, because that is what `fitsSlot` means: this template occupies that region.
|
|
15
|
+
*
|
|
16
|
+
* @param template The template to place.
|
|
17
|
+
* @param layout The layout it is placed into.
|
|
18
|
+
* @returns Slot content keyed by the layout's own slot names.
|
|
19
|
+
*/
|
|
20
|
+
export function templateContentInLayout(template: ScreenTemplate, layout: Layout): Record<string, SceneElement[]> {
|
|
21
|
+
const layoutSlots = new Set(layout.slots.map(slot => slot.name));
|
|
22
|
+
const placed: Record<string, SceneElement[]> = {};
|
|
23
|
+
const ownSlotOrder = template.slots.map(slot => slot.name);
|
|
24
|
+
const content = template.content ?? {};
|
|
25
|
+
|
|
26
|
+
for (const slotName of ownSlotOrder) {
|
|
27
|
+
const elements = content[slotName];
|
|
28
|
+
if (!elements || elements.length === 0) {
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const target = layoutSlots.has(slotName) ? slotName : template.fitsSlot;
|
|
33
|
+
if (!target) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
placed[target] = [...(placed[target] ?? []), ...elements];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return placed;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Folds a containment chain of screen templates into the outermost one.
|
|
45
|
+
*
|
|
46
|
+
* This is `fitsSlot` doing its job, applied repeatedly. A slice's template fits a slot on the feature's
|
|
47
|
+
* template, which fits a slot on the module's, which fits a slot on the application layout - so the way to
|
|
48
|
+
* place the slice is to place it in the feature, place *that* result in the module, and hand the module to
|
|
49
|
+
* the layout. Folding from the inside out means the rule is written once and the chain can be any depth.
|
|
50
|
+
*
|
|
51
|
+
* The alternative - filing a nested template's content under its own `fitsSlot` at the top level - looks
|
|
52
|
+
* right and is not: the layout has no `body` slot, so the content lands in a region nothing renders and
|
|
53
|
+
* the screen comes up empty with nothing to explain it.
|
|
54
|
+
*
|
|
55
|
+
* @param chain The templates from outermost to innermost. A chain of one is returned unchanged.
|
|
56
|
+
* @returns A template with the same slots and `fitsSlot` as the outermost, carrying the whole chain's content.
|
|
57
|
+
*/
|
|
58
|
+
export function nestScreenTemplates(chain: ScreenTemplate[]): ScreenTemplate {
|
|
59
|
+
return chain.reduceRight((inner, outer) => (inner === outer ? outer : placeInside(outer, inner)));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function placeInside(outer: ScreenTemplate, inner: ScreenTemplate): ScreenTemplate {
|
|
63
|
+
if (!inner.fitsSlot) {
|
|
64
|
+
return outer;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const innerContent = inner.slots.flatMap(slot => inner.content?.[slot.name] ?? []);
|
|
68
|
+
return {
|
|
69
|
+
...outer,
|
|
70
|
+
content: {
|
|
71
|
+
...outer.content,
|
|
72
|
+
[inner.fitsSlot]: [...(outer.content?.[inner.fitsSlot] ?? []), ...innerContent],
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Builds the element tree that renders a {@link Screen}.
|
|
79
|
+
*
|
|
80
|
+
* The screen's slot content becomes the shell component's slots one-for-one, which is the whole trick: a
|
|
81
|
+
* layout's slots and a shell component's slots are the same vocabulary, so nothing has to translate
|
|
82
|
+
* between them and a slot filled under a name the shell does not read is a spec failure rather than a
|
|
83
|
+
* silently missing region.
|
|
84
|
+
*
|
|
85
|
+
* @param screen The screen to render.
|
|
86
|
+
* @returns The shell element, ready for `SceneElementView`.
|
|
87
|
+
*/
|
|
88
|
+
export function composeScreenElement(screen: Screen): ExternalComponent {
|
|
89
|
+
const shell = shellComponentForLayout(screen.layout);
|
|
90
|
+
if (!shell) {
|
|
91
|
+
throw new Error(`Screen '${screen.name}' names the layout '${screen.layout}', which this blueprint does not provide.`);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return externalComponent(`screen-${screen.name}`, shell, { screenName: screen.name }, screen.slotContent);
|
|
95
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
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 component names the gallery borrows from this blueprint's dependencies.
|
|
6
|
+
*
|
|
7
|
+
* A screen template names components by their **bare** name and lets `resolveComponentName` pick the
|
|
8
|
+
* package, which is what makes a template portable across profiles. The cost is that a template can
|
|
9
|
+
* reference a name no active package declares, and the only symptom is a dashed red placeholder in the
|
|
10
|
+
* middle of an otherwise fine screen.
|
|
11
|
+
*
|
|
12
|
+
* Every name below was checked against the owning package's own manifest - `primeReactPackage.ts` and
|
|
13
|
+
* `cratisComponentsPackage.ts` - rather than assumed. Two that a dashboard obviously wants, `chart` and
|
|
14
|
+
* `fileUpload`, are deliberately absent from both, so the templates use what does exist (a table of
|
|
15
|
+
* figures, an image beside a button) rather than referencing something that would not render.
|
|
16
|
+
*
|
|
17
|
+
* This list exists because this package does not take an npm dependency on either of those packages - a
|
|
18
|
+
* blueprint declares its dependencies in its manifest, not in its bundler graph. When a host wires the
|
|
19
|
+
* real manifests together, it should resolve against those instead, and any name that drifted will fail
|
|
20
|
+
* this blueprint's specs immediately.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Names borrowed from the `PrimeReact` package, each present in its declared component list.
|
|
25
|
+
*
|
|
26
|
+
* `menu`, `breadcrumb` and `sidebar` are here even though the gallery uses this blueprint's versions of
|
|
27
|
+
* them, because PrimeReact really does declare all three - and leaving them out would hide the shadowing
|
|
28
|
+
* that makes a blueprint's own shell components win those bare names.
|
|
29
|
+
*/
|
|
30
|
+
export const primeReactComponentNames: string[] = [
|
|
31
|
+
'avatar',
|
|
32
|
+
'breadcrumb',
|
|
33
|
+
'calendar',
|
|
34
|
+
'card',
|
|
35
|
+
'checkbox',
|
|
36
|
+
'column',
|
|
37
|
+
'dataTable',
|
|
38
|
+
'dropdown',
|
|
39
|
+
'image',
|
|
40
|
+
'menu',
|
|
41
|
+
'sidebar',
|
|
42
|
+
'inputNumber',
|
|
43
|
+
'inputText',
|
|
44
|
+
'inputTextarea',
|
|
45
|
+
'message',
|
|
46
|
+
'password',
|
|
47
|
+
'progressBar',
|
|
48
|
+
'steps',
|
|
49
|
+
'tag',
|
|
50
|
+
'text',
|
|
51
|
+
'timeline',
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Names borrowed from the `Cratis.Components` package.
|
|
56
|
+
*
|
|
57
|
+
* Deliberately short. The gallery's templates are built from primitives so that they stay legible as
|
|
58
|
+
* *structure*; an application replaces a seeded table with a real `dataPage` bound to a query, and that is
|
|
59
|
+
* the point at which the Arc-bound composites earn their place.
|
|
60
|
+
*/
|
|
61
|
+
export const cratisComponentsNames: string[] = ['dataPage', 'observableDataTable', 'commandDialog', 'dialog'];
|
|
62
|
+
|
|
63
|
+
/** The names `core` guarantees, regardless of which packages a profile lists. */
|
|
64
|
+
export const coreComponentNames: string[] = ['text', 'button', 'card'];
|
|
@@ -0,0 +1,79 @@
|
|
|
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 { DialogTemplate } from '@cratis/scene.model';
|
|
5
|
+
import { TemplateSlotName } from './TemplateSlotName';
|
|
6
|
+
import { button, card, externalComponent, panel, text } from './elements';
|
|
7
|
+
import { field } from './widgets';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The three dialog shapes an application repeats: confirm something destructive, capture a short form, and
|
|
11
|
+
* show a record without leaving the list behind it.
|
|
12
|
+
*
|
|
13
|
+
* A dialog template has no `fitsSlot`, and that absence is the whole distinction. A screen template is
|
|
14
|
+
* *placed* - it fills a slot on whatever contains it, and the containment chain is what decides where it
|
|
15
|
+
* appears. A dialog is *summoned*: it opens over the application from wherever the code that opened it
|
|
16
|
+
* happens to be, so there is no parent slot for it to name.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/** Confirm: one question, two answers, and enough context to answer it. */
|
|
20
|
+
export const confirmDialogTemplate: DialogTemplate = {
|
|
21
|
+
name: 'ConfirmDialog',
|
|
22
|
+
slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],
|
|
23
|
+
content: {
|
|
24
|
+
[TemplateSlotName.Header]: [text('confirm-title', 'Archive this product?')],
|
|
25
|
+
[TemplateSlotName.Body]: [
|
|
26
|
+
text('confirm-message', 'Bamboo Watch will stop appearing in the catalog. Existing orders keep it.'),
|
|
27
|
+
externalComponent('confirm-note', 'message', { severity: 'warn', text: 'This can be undone from the archive.' }),
|
|
28
|
+
],
|
|
29
|
+
[TemplateSlotName.Actions]: [
|
|
30
|
+
panel('confirm-actions', [button('confirm-yes', 'Archive', { severity: 'danger' }), button('confirm-no', 'Keep it', { severity: 'secondary' })]),
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
displayName: 'Confirmation dialog',
|
|
34
|
+
description: 'One question with the consequence spelled out, and a way back.',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** Form: a short capture that does not deserve a page of its own. */
|
|
38
|
+
export const formDialogTemplate: DialogTemplate = {
|
|
39
|
+
name: 'FormDialog',
|
|
40
|
+
slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],
|
|
41
|
+
content: {
|
|
42
|
+
[TemplateSlotName.Header]: [text('form-dialog-title', 'Invite someone')],
|
|
43
|
+
[TemplateSlotName.Body]: [
|
|
44
|
+
field('form-dialog-email', 'Email', 'inputText', { placeholder: 'them@contoso.com' }),
|
|
45
|
+
field('form-dialog-role', 'Role', 'dropdown', { options: ['Viewer', 'Editor', 'Administrator'] }),
|
|
46
|
+
field('form-dialog-message', 'Message', 'inputTextarea', { rows: 3 }),
|
|
47
|
+
],
|
|
48
|
+
[TemplateSlotName.Actions]: [
|
|
49
|
+
panel('form-dialog-actions', [button('form-dialog-send', 'Send invitation', { severity: 'primary' }), button('form-dialog-cancel', 'Cancel', { severity: 'secondary' })]),
|
|
50
|
+
],
|
|
51
|
+
},
|
|
52
|
+
displayName: 'Form dialog',
|
|
53
|
+
description: 'A handful of fields captured without leaving the page underneath.',
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/** Detail: a record shown over the list it came from. */
|
|
57
|
+
export const detailDialogTemplate: DialogTemplate = {
|
|
58
|
+
name: 'DetailDialog',
|
|
59
|
+
slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.SidePanel }, { name: TemplateSlotName.Actions }],
|
|
60
|
+
content: {
|
|
61
|
+
[TemplateSlotName.Header]: [text('detail-dialog-title', 'ORD-4192')],
|
|
62
|
+
[TemplateSlotName.Body]: [
|
|
63
|
+
card('detail-dialog-summary', [
|
|
64
|
+
text('detail-dialog-customer', 'Northwind Traders'),
|
|
65
|
+
text('detail-dialog-total', '$1,240.00'),
|
|
66
|
+
externalComponent('detail-dialog-status', 'tag', { value: 'Shipped', severity: 'success' }),
|
|
67
|
+
]),
|
|
68
|
+
],
|
|
69
|
+
[TemplateSlotName.SidePanel]: [externalComponent('detail-dialog-timeline', 'timeline', { align: 'left' })],
|
|
70
|
+
[TemplateSlotName.Actions]: [
|
|
71
|
+
panel('detail-dialog-actions', [button('detail-dialog-open', 'Open full record', { severity: 'primary', targetScreen: 'DetailView' }), button('detail-dialog-close', 'Close', { severity: 'secondary' })]),
|
|
72
|
+
],
|
|
73
|
+
},
|
|
74
|
+
displayName: 'Detail dialog',
|
|
75
|
+
description: 'A record over the list it came from, with a route to the full page.',
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/** The dialog templates this blueprint provides. */
|
|
79
|
+
export const galleryDialogTemplates: DialogTemplate[] = [confirmDialogTemplate, formDialogTemplate, detailDialogTemplate];
|
|
@@ -0,0 +1,65 @@
|
|
|
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 { ExternalComponent, HorizontalAlignment, Panel, SceneElement, VerticalAlignment, Visibility } from '@cratis/scene.model';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Constructors for the element trees the gallery templates are built from.
|
|
8
|
+
*
|
|
9
|
+
* `ExternalComponent` inherits fifteen required members from `FrameworkElement` and `VisualElement` -
|
|
10
|
+
* visibility, opacity, z-index, both size constraints, margin and both alignments - before it gets to the
|
|
11
|
+
* two that matter to a template author. Written as object literals, a page of realistic content is
|
|
12
|
+
* ninety percent boilerplate and unreadable. These put the defaults in one place so a template reads as
|
|
13
|
+
* the tree it is.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const elementDefaults = {
|
|
17
|
+
properties: {},
|
|
18
|
+
visibility: Visibility.Visible,
|
|
19
|
+
isEnabled: true,
|
|
20
|
+
opacity: 1,
|
|
21
|
+
size: {},
|
|
22
|
+
zIndex: 0,
|
|
23
|
+
minimumSize: {},
|
|
24
|
+
maximumSize: {},
|
|
25
|
+
margin: { left: 0, top: 0, right: 0, bottom: 0 },
|
|
26
|
+
horizontalAlignment: HorizontalAlignment.Stretch,
|
|
27
|
+
verticalAlignment: VerticalAlignment.Stretch,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* An {@link ExternalComponent} naming a component by its **bare** name.
|
|
32
|
+
*
|
|
33
|
+
* Bare rather than package-qualified on purpose: `resolveComponentName` then decides which active package
|
|
34
|
+
* wins the name against the profile's priority order, so the same template renders with PrimeReact's
|
|
35
|
+
* widgets in one profile and somebody else's in another. A template that qualified its names would pin
|
|
36
|
+
* itself to one library and stop being a template.
|
|
37
|
+
*/
|
|
38
|
+
export function externalComponent(
|
|
39
|
+
id: string,
|
|
40
|
+
componentName: string,
|
|
41
|
+
properties: Record<string, unknown> = {},
|
|
42
|
+
slots: Record<string, SceneElement[]> = {},
|
|
43
|
+
): ExternalComponent {
|
|
44
|
+
return { ...elementDefaults, id, name: id, properties, componentName, slots };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** A {@link Panel} grouping children, for a row or column of content inside a slot. */
|
|
48
|
+
export function panel(id: string, children: SceneElement[]): Panel {
|
|
49
|
+
return { ...elementDefaults, id, name: id, children };
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** A `core:text` run - the one component name guaranteed to resolve in every profile. */
|
|
53
|
+
export function text(id: string, value: string): ExternalComponent {
|
|
54
|
+
return externalComponent(id, 'text', { text: value });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** A `core:button`. */
|
|
58
|
+
export function button(id: string, label: string, properties: Record<string, unknown> = {}): ExternalComponent {
|
|
59
|
+
return externalComponent(id, 'button', { label, ...properties });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A `core:card` wrapping content. */
|
|
63
|
+
export function card(id: string, content: SceneElement[], properties: Record<string, unknown> = {}): ExternalComponent {
|
|
64
|
+
return externalComponent(id, 'card', properties, { content });
|
|
65
|
+
}
|
package/gallery/index.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
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 './elements';
|
|
5
|
+
export * from './widgets';
|
|
6
|
+
export * from './TemplateSlotName';
|
|
7
|
+
export * from './NavigationEntry';
|
|
8
|
+
export * from './navigation';
|
|
9
|
+
export * from './applicationChrome';
|
|
10
|
+
export * from './composeScreen';
|
|
11
|
+
export * from './nesting';
|
|
12
|
+
export * from './workspaceTemplates';
|
|
13
|
+
export * from './supportTemplates';
|
|
14
|
+
export * from './authTemplates';
|
|
15
|
+
export * from './statusTemplates';
|
|
16
|
+
export * from './dialogTemplates';
|
|
17
|
+
export * from './screens';
|
|
18
|
+
export * from './dependencyComponentNames';
|
|
19
|
+
export * from './componentNames';
|
|
20
|
+
export * from './previewProfile';
|
|
21
|
+
export * from './resolveElementNames';
|
|
22
|
+
export * from './GalleryScreenPreview';
|
|
@@ -0,0 +1,71 @@
|
|
|
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 { Contribution, SceneElement } from '@cratis/scene.model';
|
|
5
|
+
import { ComponentName } from '../ComponentName';
|
|
6
|
+
import { NavigationEntry } from './NavigationEntry';
|
|
7
|
+
import { externalComponent } from './elements';
|
|
8
|
+
|
|
9
|
+
/** The contribution point the built-in navigation aggregation reads. */
|
|
10
|
+
export const navigationContributionPoint = 'Navigation';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The gallery's navigation, declared once.
|
|
14
|
+
*
|
|
15
|
+
* One list, two consumers: the sidebar menu renders it as `menuItem` elements, and the same elements go to
|
|
16
|
+
* the `Navigation` contribution point where `aggregateContributions` + `extractNavigationItem` turn them
|
|
17
|
+
* back into navigation items. A blueprint that maintained a menu *and* a separate navigation declaration
|
|
18
|
+
* would have two lists that agree right up until someone adds a screen to one of them.
|
|
19
|
+
*/
|
|
20
|
+
export const navigationEntries: NavigationEntry[] = [
|
|
21
|
+
{ label: 'Dashboard', targetScreen: 'Dashboard', icon: 'pi pi-home', group: 'Workspace', order: 10 },
|
|
22
|
+
{ label: 'Products', targetScreen: 'CrudList', icon: 'pi pi-box', group: 'Workspace', order: 20 },
|
|
23
|
+
{ label: 'Product detail', targetScreen: 'DetailView', icon: 'pi pi-file', group: 'Workspace', order: 30 },
|
|
24
|
+
{ label: 'New product', targetScreen: 'FormPage', icon: 'pi pi-plus-circle', group: 'Workspace', order: 40 },
|
|
25
|
+
{ label: 'Invoices', targetScreen: 'Invoice', icon: 'pi pi-receipt', group: 'Workspace', order: 50 },
|
|
26
|
+
{ label: 'Nothing yet', targetScreen: 'Empty', icon: 'pi pi-inbox', group: 'Workspace', order: 60 },
|
|
27
|
+
{ label: 'Users', targetScreen: 'UserManagement', icon: 'pi pi-users', group: 'Administration', order: 10 },
|
|
28
|
+
{ label: 'Your profile', targetScreen: 'ProfileSettings', icon: 'pi pi-user', group: 'Administration', order: 20 },
|
|
29
|
+
{ label: 'Documentation', targetScreen: 'Documentation', icon: 'pi pi-book', group: 'Support', order: 10 },
|
|
30
|
+
{ label: 'Help', targetScreen: 'Help', icon: 'pi pi-question-circle', group: 'Support', order: 20 },
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The element one navigation entry becomes.
|
|
35
|
+
*
|
|
36
|
+
* `routeParameterBindings` is present and empty rather than omitted, because that is what
|
|
37
|
+
* `extractNavigationItem` expects to read - and an omitted bag and an empty one are the same thing right
|
|
38
|
+
* up until something iterates it.
|
|
39
|
+
*/
|
|
40
|
+
export function navigationElement(entry: NavigationEntry, activeScreen?: string): SceneElement {
|
|
41
|
+
return externalComponent(`nav-${entry.targetScreen}`, ComponentName.MenuItem, {
|
|
42
|
+
label: entry.label,
|
|
43
|
+
targetScreen: entry.targetScreen,
|
|
44
|
+
routeParameterBindings: {},
|
|
45
|
+
order: entry.order,
|
|
46
|
+
group: entry.group,
|
|
47
|
+
icon: entry.icon,
|
|
48
|
+
isActive: entry.targetScreen === activeScreen,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The navigation as contributions to the `Navigation` contribution point.
|
|
54
|
+
*
|
|
55
|
+
* A screen carries these in its `contributions`, and anything bound to the contribution point recomputes
|
|
56
|
+
* from whatever is currently in scope - so a screen that contributes an extra entry gets it in the
|
|
57
|
+
* navigation without the navigation knowing that screen exists.
|
|
58
|
+
*/
|
|
59
|
+
export const navigationContributions: Contribution[] = navigationEntries.map(entry => ({
|
|
60
|
+
contributionPointName: navigationContributionPoint,
|
|
61
|
+
content: navigationElement(entry),
|
|
62
|
+
order: entry.order,
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
/** The navigation entries of one group, in order. */
|
|
66
|
+
export function entriesInGroup(group: string): NavigationEntry[] {
|
|
67
|
+
return navigationEntries.filter(entry => entry.group === group).sort((first, second) => first.order - second.order);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Every group named by the navigation, in first-declared order. */
|
|
71
|
+
export const navigationGroups: string[] = [...new Set(navigationEntries.map(entry => entry.group))];
|