@cratis/scene.blueprint.components 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 +61 -0
- package/.storybook/preview.tsx +42 -0
- package/BorrowedComponentName.ts +22 -0
- package/ComponentName.ts +27 -0
- package/CompositeName.ts +97 -0
- package/README.md +40 -0
- package/componentsBlueprint.ts +72 -0
- package/componentsBlueprintComponents.ts +23 -0
- package/dist/cjs/BorrowedComponentName.js +25 -0
- package/dist/cjs/BorrowedComponentName.js.map +1 -0
- package/dist/cjs/ComponentName.js +30 -0
- package/dist/cjs/ComponentName.js.map +1 -0
- package/dist/cjs/CompositeName.js +52 -0
- package/dist/cjs/CompositeName.js.map +1 -0
- package/dist/cjs/componentsBlueprint.js +93 -0
- package/dist/cjs/componentsBlueprint.js.map +1 -0
- package/dist/cjs/componentsBlueprintComponents.js +27 -0
- package/dist/cjs/componentsBlueprintComponents.js.map +1 -0
- package/dist/cjs/gallery/DialogTemplatePreview.js +46 -0
- package/dist/cjs/gallery/DialogTemplatePreview.js.map +1 -0
- package/dist/cjs/gallery/GalleryScreenPreview.js +65 -0
- package/dist/cjs/gallery/GalleryScreenPreview.js.map +1 -0
- package/dist/cjs/gallery/applicationChrome.js +137 -0
- package/dist/cjs/gallery/applicationChrome.js.map +1 -0
- package/dist/cjs/gallery/navigation.js +128 -0
- package/dist/cjs/gallery/navigation.js.map +1 -0
- package/dist/cjs/gallery/previewProfile.js +87 -0
- package/dist/cjs/gallery/previewProfile.js.map +1 -0
- package/dist/cjs/gallery/screens.js +80 -0
- package/dist/cjs/gallery/screens.js.map +1 -0
- package/dist/cjs/header/ArcPageHeader.js +65 -0
- package/dist/cjs/header/ArcPageHeader.js.map +1 -0
- package/dist/cjs/header/deriveArcHeading.js +51 -0
- package/dist/cjs/header/deriveArcHeading.js.map +1 -0
- package/dist/cjs/header/humanizeBindingName.js +36 -0
- package/dist/cjs/header/humanizeBindingName.js.map +1 -0
- package/dist/cjs/index.js +119 -0
- package/dist/cjs/index.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/templates/SampleBindingName.js +39 -0
- package/dist/cjs/templates/SampleBindingName.js.map +1 -0
- package/dist/cjs/templates/commandTemplates.js +82 -0
- package/dist/cjs/templates/commandTemplates.js.map +1 -0
- package/dist/cjs/templates/dataElements.js +131 -0
- package/dist/cjs/templates/dataElements.js.map +1 -0
- package/dist/cjs/templates/dialogElements.js +69 -0
- package/dist/cjs/templates/dialogElements.js.map +1 -0
- package/dist/cjs/templates/dialogTemplates.js +118 -0
- package/dist/cjs/templates/dialogTemplates.js.map +1 -0
- package/dist/cjs/templates/editorElements.js +81 -0
- package/dist/cjs/templates/editorElements.js.map +1 -0
- package/dist/cjs/templates/editorTemplates.js +172 -0
- package/dist/cjs/templates/editorTemplates.js.map +1 -0
- package/dist/cjs/templates/elements.js +101 -0
- package/dist/cjs/templates/elements.js.map +1 -0
- package/dist/cjs/templates/formElements.js +77 -0
- package/dist/cjs/templates/formElements.js.map +1 -0
- package/dist/cjs/templates/listTemplates.js +187 -0
- package/dist/cjs/templates/listTemplates.js.map +1 -0
- package/dist/cjs/templates/nesting.js +150 -0
- package/dist/cjs/templates/nesting.js.map +1 -0
- package/dist/cjs/templates/sampleData.js +141 -0
- package/dist/cjs/templates/sampleData.js.map +1 -0
- package/dist/cjs/templates/screenTemplates.js +41 -0
- package/dist/cjs/templates/screenTemplates.js.map +1 -0
- package/dist/cjs/templates/workspaceTemplates.js +212 -0
- package/dist/cjs/templates/workspaceTemplates.js.map +1 -0
- package/dist/esm/BorrowedComponentName.d.ts +4 -0
- package/dist/esm/BorrowedComponentName.d.ts.map +1 -0
- package/dist/esm/BorrowedComponentName.js +23 -0
- package/dist/esm/BorrowedComponentName.js.map +1 -0
- package/dist/esm/ComponentName.d.ts +4 -0
- package/dist/esm/ComponentName.d.ts.map +1 -0
- package/dist/esm/ComponentName.js +28 -0
- package/dist/esm/ComponentName.js.map +1 -0
- package/dist/esm/CompositeName.d.ts +28 -0
- package/dist/esm/CompositeName.d.ts.map +1 -0
- package/dist/esm/CompositeName.js +50 -0
- package/dist/esm/CompositeName.js.map +1 -0
- package/dist/esm/componentsBlueprint.d.ts +5 -0
- package/dist/esm/componentsBlueprint.d.ts.map +1 -0
- package/dist/esm/componentsBlueprint.js +90 -0
- package/dist/esm/componentsBlueprint.js.map +1 -0
- package/dist/esm/componentsBlueprintComponents.d.ts +3 -0
- package/dist/esm/componentsBlueprintComponents.d.ts.map +1 -0
- package/dist/esm/componentsBlueprintComponents.js +25 -0
- package/dist/esm/componentsBlueprintComponents.js.map +1 -0
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.d.ts +2 -0
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.d.ts.map +1 -0
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.js +57 -0
- package/dist/esm/for_ArcPageHeader/when_rendering_a_gallery_screen.js.map +1 -0
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.d.ts +2 -0
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.d.ts.map +1 -0
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.js +26 -0
- package/dist/esm/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.js.map +1 -0
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.d.ts +2 -0
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.d.ts.map +1 -0
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.js +65 -0
- package/dist/esm/for_componentsBlueprint/when_resolving_its_dependencies.js.map +1 -0
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.d.ts +2 -0
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.d.ts.map +1 -0
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.js +41 -0
- package/dist/esm/for_componentsBlueprint/when_validating_the_bundle.js.map +1 -0
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts +2 -0
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.d.ts.map +1 -0
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.js +38 -0
- package/dist/esm/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.js.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts +2 -0
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.d.ts.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js +47 -0
- package/dist/esm/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.js.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.d.ts +2 -0
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.d.ts.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.js +56 -0
- package/dist/esm/for_componentsScreenTemplates/when_following_the_nesting_chain.js.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.d.ts +2 -0
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.d.ts.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.js +31 -0
- package/dist/esm/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.js.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.d.ts +2 -0
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.d.ts.map +1 -0
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.js +54 -0
- package/dist/esm/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.js.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.d.ts +2 -0
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.d.ts.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.js +27 -0
- package/dist/esm/for_deriveArcHeading/when_no_binding_is_named.js.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.d.ts +2 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.d.ts.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.js +18 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_not_registered.js.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.d.ts +2 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.d.ts.map +1 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.js +26 -0
- package/dist/esm/for_deriveArcHeading/when_the_binding_is_registered.js.map +1 -0
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.d.ts +2 -0
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.d.ts.map +1 -0
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.js +25 -0
- package/dist/esm/for_humanizeBindingName/when_reading_a_proxy_name.js.map +1 -0
- package/dist/esm/gallery/ArcPages.stories.d.ts +30 -0
- package/dist/esm/gallery/ArcPages.stories.d.ts.map +1 -0
- package/dist/esm/gallery/ArcPages.stories.js +34 -0
- package/dist/esm/gallery/ArcPages.stories.js.map +1 -0
- package/dist/esm/gallery/Bindings.stories.d.ts +22 -0
- package/dist/esm/gallery/Bindings.stories.d.ts.map +1 -0
- package/dist/esm/gallery/Bindings.stories.js +78 -0
- package/dist/esm/gallery/Bindings.stories.js.map +1 -0
- package/dist/esm/gallery/DialogTemplatePreview.d.ts +7 -0
- package/dist/esm/gallery/DialogTemplatePreview.d.ts.map +1 -0
- package/dist/esm/gallery/DialogTemplatePreview.js +44 -0
- package/dist/esm/gallery/DialogTemplatePreview.js.map +1 -0
- package/dist/esm/gallery/DialogTemplates.stories.d.ts +21 -0
- package/dist/esm/gallery/DialogTemplates.stories.d.ts.map +1 -0
- package/dist/esm/gallery/DialogTemplates.stories.js +23 -0
- package/dist/esm/gallery/DialogTemplates.stories.js.map +1 -0
- package/dist/esm/gallery/GalleryScreenPreview.d.ts +10 -0
- package/dist/esm/gallery/GalleryScreenPreview.d.ts.map +1 -0
- package/dist/esm/gallery/GalleryScreenPreview.js +62 -0
- package/dist/esm/gallery/GalleryScreenPreview.js.map +1 -0
- package/dist/esm/gallery/applicationChrome.d.ts +3 -0
- package/dist/esm/gallery/applicationChrome.d.ts.map +1 -0
- package/dist/esm/gallery/applicationChrome.js +135 -0
- package/dist/esm/gallery/applicationChrome.js.map +1 -0
- package/dist/esm/gallery/index.d.ts +7 -0
- package/dist/esm/gallery/index.d.ts.map +1 -0
- package/dist/esm/gallery/index.js +7 -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 +121 -0
- package/dist/esm/gallery/navigation.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 +83 -0
- package/dist/esm/gallery/previewProfile.js.map +1 -0
- package/dist/esm/gallery/screens.d.ts +4 -0
- package/dist/esm/gallery/screens.d.ts.map +1 -0
- package/dist/esm/gallery/screens.js +77 -0
- package/dist/esm/gallery/screens.js.map +1 -0
- package/dist/esm/header/ArcHeading.d.ts +9 -0
- package/dist/esm/header/ArcHeading.d.ts.map +1 -0
- package/dist/esm/header/ArcHeading.js +2 -0
- package/dist/esm/header/ArcHeading.js.map +1 -0
- package/dist/esm/header/ArcPageHeader.d.ts +3 -0
- package/dist/esm/header/ArcPageHeader.d.ts.map +1 -0
- package/dist/esm/header/ArcPageHeader.js +63 -0
- package/dist/esm/header/ArcPageHeader.js.map +1 -0
- package/dist/esm/header/deriveArcHeading.d.ts +4 -0
- package/dist/esm/header/deriveArcHeading.d.ts.map +1 -0
- package/dist/esm/header/deriveArcHeading.js +49 -0
- package/dist/esm/header/deriveArcHeading.js.map +1 -0
- package/dist/esm/header/humanizeBindingName.d.ts +2 -0
- package/dist/esm/header/humanizeBindingName.d.ts.map +1 -0
- package/dist/esm/header/humanizeBindingName.js +34 -0
- package/dist/esm/header/humanizeBindingName.js.map +1 -0
- package/dist/esm/header/index.d.ts +5 -0
- package/dist/esm/header/index.d.ts.map +1 -0
- package/dist/esm/header/index.js +5 -0
- package/dist/esm/header/index.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 +30 -0
- package/dist/esm/index.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/templates/ArcHeaderOptions.d.ts +8 -0
- package/dist/esm/templates/ArcHeaderOptions.d.ts.map +1 -0
- package/dist/esm/templates/ArcHeaderOptions.js +2 -0
- package/dist/esm/templates/ArcHeaderOptions.js.map +1 -0
- package/dist/esm/templates/ColumnDefinition.d.ts +5 -0
- package/dist/esm/templates/ColumnDefinition.d.ts.map +1 -0
- package/dist/esm/templates/ColumnDefinition.js +2 -0
- package/dist/esm/templates/ColumnDefinition.js.map +1 -0
- package/dist/esm/templates/SampleBindingName.d.ts +11 -0
- package/dist/esm/templates/SampleBindingName.d.ts.map +1 -0
- package/dist/esm/templates/SampleBindingName.js +37 -0
- package/dist/esm/templates/SampleBindingName.js.map +1 -0
- package/dist/esm/templates/TableOptions.d.ts +6 -0
- package/dist/esm/templates/TableOptions.d.ts.map +1 -0
- package/dist/esm/templates/TableOptions.js +2 -0
- package/dist/esm/templates/TableOptions.js.map +1 -0
- package/dist/esm/templates/commandTemplates.d.ts +4 -0
- package/dist/esm/templates/commandTemplates.d.ts.map +1 -0
- package/dist/esm/templates/commandTemplates.js +79 -0
- package/dist/esm/templates/commandTemplates.js.map +1 -0
- package/dist/esm/templates/dataElements.d.ts +11 -0
- package/dist/esm/templates/dataElements.d.ts.map +1 -0
- package/dist/esm/templates/dataElements.js +123 -0
- package/dist/esm/templates/dataElements.js.map +1 -0
- package/dist/esm/templates/dialogElements.d.ts +5 -0
- package/dist/esm/templates/dialogElements.d.ts.map +1 -0
- package/dist/esm/templates/dialogElements.js +65 -0
- package/dist/esm/templates/dialogElements.js.map +1 -0
- package/dist/esm/templates/dialogTemplates.d.ts +6 -0
- package/dist/esm/templates/dialogTemplates.d.ts.map +1 -0
- package/dist/esm/templates/dialogTemplates.js +113 -0
- package/dist/esm/templates/dialogTemplates.js.map +1 -0
- package/dist/esm/templates/editorElements.d.ts +11 -0
- package/dist/esm/templates/editorElements.d.ts.map +1 -0
- package/dist/esm/templates/editorElements.js +74 -0
- package/dist/esm/templates/editorElements.js.map +1 -0
- package/dist/esm/templates/editorTemplates.d.ts +5 -0
- package/dist/esm/templates/editorTemplates.d.ts.map +1 -0
- package/dist/esm/templates/editorTemplates.js +168 -0
- package/dist/esm/templates/editorTemplates.js.map +1 -0
- package/dist/esm/templates/elements.d.ts +11 -0
- package/dist/esm/templates/elements.d.ts.map +1 -0
- package/dist/esm/templates/elements.js +92 -0
- package/dist/esm/templates/elements.js.map +1 -0
- package/dist/esm/templates/formElements.d.ts +11 -0
- package/dist/esm/templates/formElements.d.ts.map +1 -0
- package/dist/esm/templates/formElements.js +70 -0
- package/dist/esm/templates/formElements.js.map +1 -0
- package/dist/esm/templates/index.d.ts +18 -0
- package/dist/esm/templates/index.d.ts.map +1 -0
- package/dist/esm/templates/index.js +18 -0
- package/dist/esm/templates/index.js.map +1 -0
- package/dist/esm/templates/listTemplates.d.ts +6 -0
- package/dist/esm/templates/listTemplates.d.ts.map +1 -0
- package/dist/esm/templates/listTemplates.js +182 -0
- package/dist/esm/templates/listTemplates.js.map +1 -0
- package/dist/esm/templates/nesting.d.ts +6 -0
- package/dist/esm/templates/nesting.d.ts.map +1 -0
- package/dist/esm/templates/nesting.js +145 -0
- package/dist/esm/templates/nesting.js.map +1 -0
- package/dist/esm/templates/sampleData.d.ts +10 -0
- package/dist/esm/templates/sampleData.d.ts.map +1 -0
- package/dist/esm/templates/sampleData.js +134 -0
- package/dist/esm/templates/sampleData.js.map +1 -0
- package/dist/esm/templates/screenTemplates.d.ts +4 -0
- package/dist/esm/templates/screenTemplates.d.ts.map +1 -0
- package/dist/esm/templates/screenTemplates.js +38 -0
- package/dist/esm/templates/screenTemplates.js.map +1 -0
- package/dist/esm/templates/workspaceTemplates.d.ts +5 -0
- package/dist/esm/templates/workspaceTemplates.d.ts.map +1 -0
- package/dist/esm/templates/workspaceTemplates.js +208 -0
- package/dist/esm/templates/workspaceTemplates.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/for_ArcPageHeader/when_rendering_a_gallery_screen.tsx +79 -0
- package/for_CompositeName/when_checking_the_names_against_the_packages_that_declare_them.ts +41 -0
- package/for_componentsBlueprint/when_resolving_its_dependencies.ts +85 -0
- package/for_componentsBlueprint/when_validating_the_bundle.ts +55 -0
- package/for_componentsGalleryScreens/when_checking_the_layouts_and_slots_they_fill.ts +56 -0
- package/for_componentsScreenTemplates/when_checking_that_arrangements_reference_declared_slots.ts +66 -0
- package/for_componentsScreenTemplates/when_following_the_nesting_chain.ts +83 -0
- package/for_componentsScreenTemplates/when_placing_them_in_the_default_blueprint_layout.ts +51 -0
- package/for_componentsScreenTemplates/when_resolving_the_component_names_they_reference.ts +72 -0
- package/for_deriveArcHeading/when_no_binding_is_named.ts +42 -0
- package/for_deriveArcHeading/when_the_binding_is_not_registered.ts +25 -0
- package/for_deriveArcHeading/when_the_binding_is_registered.ts +35 -0
- package/for_humanizeBindingName/when_reading_a_proxy_name.ts +34 -0
- package/gallery/ArcPages.stories.tsx +80 -0
- package/gallery/Bindings.stories.tsx +134 -0
- package/gallery/DialogTemplatePreview.tsx +49 -0
- package/gallery/DialogTemplates.stories.tsx +44 -0
- package/gallery/GalleryScreenPreview.tsx +70 -0
- package/gallery/applicationChrome.ts +108 -0
- package/gallery/index.ts +9 -0
- package/gallery/navigation.ts +63 -0
- package/gallery/previewProfile.ts +68 -0
- package/gallery/screens.ts +75 -0
- package/header/ArcHeading.ts +39 -0
- package/header/ArcPageHeader.tsx +44 -0
- package/header/deriveArcHeading.ts +47 -0
- package/header/humanizeBindingName.ts +36 -0
- package/header/index.ts +7 -0
- package/index.ts +12 -0
- package/package.json +71 -0
- package/packageName.ts +12 -0
- package/templates/ArcHeaderOptions.ts +27 -0
- package/templates/ColumnDefinition.ts +18 -0
- package/templates/SampleBindingName.ts +50 -0
- package/templates/TableOptions.ts +22 -0
- package/templates/commandTemplates.ts +59 -0
- package/templates/dataElements.ts +97 -0
- package/templates/dialogElements.ts +53 -0
- package/templates/dialogTemplates.ts +105 -0
- package/templates/editorElements.ts +69 -0
- package/templates/editorTemplates.ts +129 -0
- package/templates/elements.ts +81 -0
- package/templates/formElements.ts +61 -0
- package/templates/index.ts +20 -0
- package/templates/listTemplates.ts +142 -0
- package/templates/nesting.ts +118 -0
- package/templates/sampleData.ts +81 -0
- package/templates/screenTemplates.ts +35 -0
- package/templates/workspaceTemplates.ts +163 -0
|
@@ -0,0 +1,68 @@
|
|
|
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 { UiProfile } from '@cratis/scene.model';
|
|
5
|
+
import { PackageCatalog } from '@cratis/scene.engine';
|
|
6
|
+
import { corePackageManifest } from '@cratis/scene.react';
|
|
7
|
+
import { cratisComponentsPackageManifest } from '@cratis/scene.components';
|
|
8
|
+
import { defaultBlueprintManifest, defaultBlueprintName } from '@cratis/scene.blueprint.default';
|
|
9
|
+
import { ComponentName } from '../ComponentName';
|
|
10
|
+
import { componentsBlueprintName } from '../packageName';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The names this blueprint borrows from `PrimeReact`.
|
|
14
|
+
*
|
|
15
|
+
* Every other package in the catalog below contributes its *real* manifest, because this package takes an
|
|
16
|
+
* npm dependency on each of them. `PrimeReact` is the exception: this blueprint depends on it in the
|
|
17
|
+
* manifest sense - `column` comes from there - without depending on its bundle, so its declaration is not
|
|
18
|
+
* importable here and the borrowed names are written out instead.
|
|
19
|
+
*
|
|
20
|
+
* Every name below was checked against `primeReactPackage.ts`'s own component list rather than assumed.
|
|
21
|
+
* The default blueprint learned why that matters when it referenced `chart` and `fileUpload`, which
|
|
22
|
+
* neither library declares - names that look obvious and render as dashed red boxes.
|
|
23
|
+
*
|
|
24
|
+
* A host that has all five packages loaded should build this catalog from their manifests instead. The
|
|
25
|
+
* shape is the same, and anything that has drifted then fails this blueprint's specs rather than a preview.
|
|
26
|
+
*/
|
|
27
|
+
export const primeReactComponentNames: string[] = ['column', 'dataTable', 'table', 'dialog', 'button', 'card', 'text', 'toolbar', 'dropdown', 'tooltip', 'menu', 'breadcrumb', 'sidebar'];
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* The profile this blueprint's templates resolve against.
|
|
31
|
+
*
|
|
32
|
+
* Declaration order is ascending priority, which is why this exact order matters rather than being
|
|
33
|
+
* cosmetic. `Cratis.Components` outranks `PrimeReact`, so a template naming `table` or `dialog` gets the
|
|
34
|
+
* Arc-aware one and PrimeReact's is recorded as shadowed. Both blueprints outrank both libraries, so
|
|
35
|
+
* `pageHeader` and `arcPageHeader` resolve to the packages that declare them. And this blueprint sits at
|
|
36
|
+
* the top, which costs nothing today - it declares one name nobody else does - but is the correct place
|
|
37
|
+
* for the package doing the layering.
|
|
38
|
+
*
|
|
39
|
+
* `core` is listed explicitly rather than left to `effectivePackages` to prepend, because a theme's
|
|
40
|
+
* compatibility is checked against exactly what a profile declares, and a profile leaning on the implicit
|
|
41
|
+
* fallback would make a theme look incompatible with a package the profile never admitted to using.
|
|
42
|
+
*
|
|
43
|
+
* Unlike the default blueprint, this package needs no separate *preview* profile. That blueprint takes no
|
|
44
|
+
* npm dependency on the libraries its templates reference, so previewing it from its own package resolves
|
|
45
|
+
* most names to implementations that are not loaded. This one depends on `@cratis/scene.components` and
|
|
46
|
+
* `@cratis/scene.blueprint.default` for real, so everything its templates name is loadable except
|
|
47
|
+
* PrimeReact's `column` - and a `column` never reaches the DOM at design time anyway, because the table it
|
|
48
|
+
* belongs to is a placeholder until a host registers its query.
|
|
49
|
+
*/
|
|
50
|
+
export const componentsBlueprintProfile: UiProfile = {
|
|
51
|
+
name: 'Arc pages',
|
|
52
|
+
targetPlatform: 'web',
|
|
53
|
+
packages: ['core', 'PrimeReact', cratisComponentsPackageManifest.name, defaultBlueprintName, componentsBlueprintName],
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The component catalog the templates resolve against.
|
|
58
|
+
*
|
|
59
|
+
* Four of the five entries are the owning package's real declared list, read straight off its manifest, so
|
|
60
|
+
* a name renamed upstream fails a spec here instead of rendering as a dashed box in someone's application.
|
|
61
|
+
*/
|
|
62
|
+
export const componentsBlueprintCatalog: PackageCatalog = {
|
|
63
|
+
[corePackageManifest.name]: corePackageManifest.components,
|
|
64
|
+
PrimeReact: primeReactComponentNames,
|
|
65
|
+
[cratisComponentsPackageManifest.name]: cratisComponentsPackageManifest.components,
|
|
66
|
+
[defaultBlueprintName]: defaultBlueprintManifest.components,
|
|
67
|
+
[componentsBlueprintName]: Object.values(ComponentName),
|
|
68
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
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 { Screen, ScreenTemplate } from '@cratis/scene.model';
|
|
5
|
+
import { LayoutName, appShellLayout, nestScreenTemplates, templateContentInLayout } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { componentsScreenTemplates, nestingChainTemplates } from '../templates';
|
|
7
|
+
import { componentsApplicationChrome } from './applicationChrome';
|
|
8
|
+
import { componentsNavigationContributions } from './navigation';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The gallery: one {@link Screen} per template, ready to boot through the real engine.
|
|
12
|
+
*
|
|
13
|
+
* These exist so a preview is a working miniature application rather than a set of pictures - the same
|
|
14
|
+
* `Screen` shape Stage produces, put through the same `Scene.Engine` and `Scene.React`, with no separate
|
|
15
|
+
* preview pipeline and nothing mocked.
|
|
16
|
+
*
|
|
17
|
+
* They will render with unregistered bindings, and that is the normal design-time state rather than a
|
|
18
|
+
* shortcoming of the gallery. A host owns the generated Arc proxies; a gallery is not a host. What a
|
|
19
|
+
* preview therefore shows is every Arc-bound region as a placeholder naming the binding it wanted, every
|
|
20
|
+
* Arc-free region rendered for real, and a header on each page saying which of the two you are looking at.
|
|
21
|
+
*
|
|
22
|
+
* Every screen renders in the default blueprint's `AppShell`. There is no full-page variant here because
|
|
23
|
+
* there is no Arc-bound page that belongs outside the application shell - a sign-in screen queries nothing
|
|
24
|
+
* and submits no command, so it stays where it already is, in the default blueprint.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Builds the {@link Screen} that instantiates one template.
|
|
29
|
+
*
|
|
30
|
+
* A screen is an instance, not a shape: it names the layout it renders in, the template it fills, the
|
|
31
|
+
* content that fills it, and what it contributes elsewhere. Everything structural comes from the template,
|
|
32
|
+
* which is why adding a screen is a handful of lines rather than another copy of the chrome.
|
|
33
|
+
*/
|
|
34
|
+
function screenFor(template: ScreenTemplate): Screen {
|
|
35
|
+
const placeable = nestScreenTemplates(containmentChainFor(template));
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
name: template.name,
|
|
39
|
+
layout: LayoutName.AppShell,
|
|
40
|
+
screenTemplate: template.name,
|
|
41
|
+
slotContent: mergeSlotContent(componentsApplicationChrome(template.name), templateContentInLayout(placeable, appShellLayout)),
|
|
42
|
+
forms: [],
|
|
43
|
+
contributions: componentsNavigationContributions,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* The chain of templates a screen renders through, outermost first.
|
|
49
|
+
*
|
|
50
|
+
* The eight page templates fit the layout's own `content` slot, so each one's chain is just itself. The
|
|
51
|
+
* three nesting-chain templates are the exception and the only ones that need the walk - which is the
|
|
52
|
+
* honest version of the story: nesting exists for the applications that need it, and costs nothing for the
|
|
53
|
+
* ones that do not.
|
|
54
|
+
*/
|
|
55
|
+
function containmentChainFor(template: ScreenTemplate): ScreenTemplate[] {
|
|
56
|
+
const depth = nestingChainTemplates.findIndex(candidate => candidate.name === template.name);
|
|
57
|
+
return depth < 0 ? [template] : nestingChainTemplates.slice(0, depth + 1);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function mergeSlotContent(chrome: Record<string, Screen['slotContent'][string]>, content: Record<string, Screen['slotContent'][string]>): Screen['slotContent'] {
|
|
61
|
+
const merged: Screen['slotContent'] = { ...chrome };
|
|
62
|
+
for (const [slotName, elements] of Object.entries(content)) {
|
|
63
|
+
merged[slotName] = [...(merged[slotName] ?? []), ...elements];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return merged;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** One screen per screen template this blueprint provides. */
|
|
70
|
+
export const componentsGalleryScreens: Screen[] = componentsScreenTemplates.map(screenFor);
|
|
71
|
+
|
|
72
|
+
/** One gallery screen by name, for a story or a host that boots a specific one. */
|
|
73
|
+
export function componentsGalleryScreen(name: string): Screen | undefined {
|
|
74
|
+
return componentsGalleryScreens.find(screen => screen.name === name);
|
|
75
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
* Everything {@link ArcPageHeader} renders, derived from one binding name and a handful of properties.
|
|
6
|
+
*
|
|
7
|
+
* It is a separate type from the component so the derivation can be specified without rendering anything.
|
|
8
|
+
* That matters more here than it usually does: the whole argument for this being a component rather than
|
|
9
|
+
* a content tree is that it *derives* rather than holds, so the derivation is the part that has to be
|
|
10
|
+
* provably right.
|
|
11
|
+
*/
|
|
12
|
+
export interface ArcHeading {
|
|
13
|
+
/** The heading text - the screen's `title`, or the binding name read as a sentence when it set none. */
|
|
14
|
+
title: string;
|
|
15
|
+
|
|
16
|
+
/** The line under the heading, when the screen supplied one. */
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The breadcrumb trail, outermost first, ending in {@link title}.
|
|
21
|
+
*
|
|
22
|
+
* Derived rather than authored, which is the point: a screen states its section once and the trail
|
|
23
|
+
* follows the heading automatically, so the two can never drift apart the way two literals do.
|
|
24
|
+
*/
|
|
25
|
+
trail: string[];
|
|
26
|
+
|
|
27
|
+
/** The binding name the header was given, or `undefined` when the screen named none. */
|
|
28
|
+
bindingName?: string;
|
|
29
|
+
|
|
30
|
+
/** Whether a host has actually registered {@link bindingName}. */
|
|
31
|
+
isBound: boolean;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The design-time state, in words - what a designer reads off the header when a page is not yet
|
|
35
|
+
* wired. The three cases are genuinely different problems: nothing named, named but unregistered, and
|
|
36
|
+
* working.
|
|
37
|
+
*/
|
|
38
|
+
bindingLabel: string;
|
|
39
|
+
}
|
|
@@ -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 { RegisteredComponentProps } from '@cratis/scene.react';
|
|
5
|
+
import { BindingKind, resolveElementBinding } from '@cratis/scene.components';
|
|
6
|
+
import { deriveArcHeading } from './deriveArcHeading';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The one component this blueprint registers: a page header whose heading, trail and design-time state all
|
|
10
|
+
* follow from a single binding name.
|
|
11
|
+
*
|
|
12
|
+
* Every template in this package opens with one, and every template gives it the same binding its body is
|
|
13
|
+
* built around - `AllInvoices` on the list page, `RecordAdjustment` on the command page. Saying it once is
|
|
14
|
+
* the point. A hand-authored header repeats the page's subject in the title, again in the trail, and a
|
|
15
|
+
* third time in the table below it, and those three copies drift the first time anything is renamed.
|
|
16
|
+
*
|
|
17
|
+
* It also reports whether the binding is registered, which is what makes a design-time preview readable.
|
|
18
|
+
* A page whose body is one dashed placeholder is ambiguous - is the name wrong, or has the host simply not
|
|
19
|
+
* wired anything yet? The header answers that at the top of the page, in words, without opening a debugger.
|
|
20
|
+
*
|
|
21
|
+
* The `layout-page-header` class names are the default blueprint's, not this package's. That is this
|
|
22
|
+
* blueprint's whole posture in one detail: it reuses the shell it depends on rather than shipping a rival
|
|
23
|
+
* one, so a page of Arc-bound content sits inside the default shell looking like it belongs there.
|
|
24
|
+
*/
|
|
25
|
+
export function ArcPageHeader({ element, slots }: RegisteredComponentProps) {
|
|
26
|
+
const query = resolveElementBinding(element, BindingKind.Query);
|
|
27
|
+
const kind = query.name === undefined ? BindingKind.Command : BindingKind.Query;
|
|
28
|
+
const binding = kind === BindingKind.Query ? query : resolveElementBinding(element, BindingKind.Command);
|
|
29
|
+
const heading = deriveArcHeading(element.properties, binding, kind);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className='layout-page-header' data-scene-id={element.id} data-scene-binding={heading.bindingName}>
|
|
33
|
+
<div>
|
|
34
|
+
<nav className='layout-page-header-trail' aria-label='Breadcrumb'>
|
|
35
|
+
{heading.trail.join(' › ')}
|
|
36
|
+
</nav>
|
|
37
|
+
<h1 className='layout-page-header-title'>{heading.title}</h1>
|
|
38
|
+
{heading.subtitle && <p className='layout-page-header-subtitle'>{heading.subtitle}</p>}
|
|
39
|
+
<span data-scene-binding-state={heading.isBound ? 'bound' : 'unbound'}>{heading.bindingLabel}</span>
|
|
40
|
+
</div>
|
|
41
|
+
{(slots.actions?.length ?? 0) > 0 && <div className='layout-page-header-actions'>{slots.actions}</div>}
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 { BindingKind, ElementBinding, stringProperty } from '@cratis/scene.components';
|
|
5
|
+
import { ArcHeading } from './ArcHeading';
|
|
6
|
+
import { humanizeBindingName } from './humanizeBindingName';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Derives everything a page header shows from one binding and the few properties around it.
|
|
10
|
+
*
|
|
11
|
+
* This function is the entire argument for {@link ArcPageHeader} being a component at all. A screen
|
|
12
|
+
* template can hold a title, a subtitle and a breadcrumb trail perfectly well - they are three literals in
|
|
13
|
+
* a property bag, and a tree is the right place for literals. What a tree cannot do is *derive* them from
|
|
14
|
+
* a single binding name and a registry lookup, and that is what an Arc-bound page needs: the page is about
|
|
15
|
+
* `AllInvoices`, so the heading, the trail and the design-time state should all follow from saying so once.
|
|
16
|
+
*
|
|
17
|
+
* The three binding states are kept apart deliberately, because they are three different problems with
|
|
18
|
+
* three different fixes. No name at all means the template is incomplete. A name nothing is registered
|
|
19
|
+
* under means the host has not wired it - which is the *normal* state at design time, not an error. A
|
|
20
|
+
* resolved name means the page will really talk to a backend.
|
|
21
|
+
*
|
|
22
|
+
* @param properties The element's property bag - `title`, `subtitle` and `section` are read from it.
|
|
23
|
+
* @param binding What the element asked for at its binding site, and what the registry produced.
|
|
24
|
+
* @param kind Whether the binding was a query or a command, so the state can be described in the right words.
|
|
25
|
+
* @returns The derived {@link ArcHeading}.
|
|
26
|
+
*/
|
|
27
|
+
export function deriveArcHeading(properties: Record<string, unknown>, binding: ElementBinding, kind: BindingKind): ArcHeading {
|
|
28
|
+
const title = stringProperty(properties, 'title') ?? (binding.name === undefined ? 'Untitled page' : humanizeBindingName(binding.name));
|
|
29
|
+
const section = stringProperty(properties, 'section');
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
title,
|
|
33
|
+
subtitle: stringProperty(properties, 'subtitle'),
|
|
34
|
+
trail: section === undefined ? [title] : [section, title],
|
|
35
|
+
bindingName: binding.name,
|
|
36
|
+
isBound: binding.target !== undefined,
|
|
37
|
+
bindingLabel: bindingLabelFor(binding, kind),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function bindingLabelFor(binding: ElementBinding, kind: BindingKind): string {
|
|
42
|
+
if (binding.name === undefined) {
|
|
43
|
+
return 'No binding';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return binding.target === undefined ? `No ${kind} registered as ${binding.name}` : `Bound to ${kind} ${binding.name}`;
|
|
47
|
+
}
|
|
@@ -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
|
+
/**
|
|
5
|
+
* Reads an Arc binding name as a sentence: `AllInvoices` becomes `All invoices`.
|
|
6
|
+
*
|
|
7
|
+
* Arc proxy names are the C# artifact names - a `[ReadModel]`'s static query method, a `[Command]` record -
|
|
8
|
+
* so they arrive in PascalCase and describe exactly what the page is about. Using them as the fallback
|
|
9
|
+
* heading means a page template is legible before anyone has written a title, and the heading a designer
|
|
10
|
+
* sees at design time is the one the backend actually named.
|
|
11
|
+
*
|
|
12
|
+
* Only the boundary between a lowercase or numeric character and an uppercase one is treated as a word
|
|
13
|
+
* break, so a run of capitals stays together: `AllPIIRecords` reads as `All PIIRecords` rather than being
|
|
14
|
+
* chopped into initials. That is the right trade - a wrong word break in an acronym is much more jarring
|
|
15
|
+
* than a missing one. For the same reason a word is only lowered when it looks like an ordinary
|
|
16
|
+
* capitalized word, so an acronym keeps its shape instead of being flattened into `piirecords`.
|
|
17
|
+
*
|
|
18
|
+
* @param name The binding name as a screen wrote it.
|
|
19
|
+
* @returns The name as a sentence, with only the first word capitalized.
|
|
20
|
+
*/
|
|
21
|
+
export function humanizeBindingName(name: string): string {
|
|
22
|
+
const words = name
|
|
23
|
+
.replace(/([a-z0-9])([A-Z])/g, '$1 $2')
|
|
24
|
+
.split(/\s+/)
|
|
25
|
+
.filter(word => word.length > 0);
|
|
26
|
+
|
|
27
|
+
if (words.length === 0) {
|
|
28
|
+
return name;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return [words[0], ...words.slice(1).map(lowered)].join(' ');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function lowered(word: string): string {
|
|
35
|
+
return /^[A-Z][a-z]/.test(word) ? `${word[0].toLowerCase()}${word.slice(1)}` : word;
|
|
36
|
+
}
|
package/header/index.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
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 './ArcHeading';
|
|
5
|
+
export * from './humanizeBindingName';
|
|
6
|
+
export * from './deriveArcHeading';
|
|
7
|
+
export * from './ArcPageHeader';
|
package/index.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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 './packageName';
|
|
5
|
+
export * from './ComponentName';
|
|
6
|
+
export * from './CompositeName';
|
|
7
|
+
export * from './BorrowedComponentName';
|
|
8
|
+
export * from './header';
|
|
9
|
+
export * from './templates';
|
|
10
|
+
export * from './gallery';
|
|
11
|
+
export * from './componentsBlueprintComponents';
|
|
12
|
+
export * from './componentsBlueprint';
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cratis/scene.blueprint.components",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A blueprint of Arc-bound screen and dialog templates: full pages built from Cratis Components composites, so a data list, a command form or a master-detail screen is a template rather than something you assemble.",
|
|
5
|
+
"author": "Cratis",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Cratis/Scene.git"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"**/*.ts",
|
|
17
|
+
"**/*.tsx"
|
|
18
|
+
],
|
|
19
|
+
"main": "dist/cjs/index.js",
|
|
20
|
+
"module": "dist/esm/index.js",
|
|
21
|
+
"types": "dist/esm/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
"./package.json": "./package.json",
|
|
24
|
+
".": {
|
|
25
|
+
"types": "./dist/esm/index.d.ts",
|
|
26
|
+
"require": "./dist/cjs/index.js",
|
|
27
|
+
"import": "./dist/esm/index.js"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"prepare": "yarn g:build",
|
|
32
|
+
"clean": "yarn g:clean",
|
|
33
|
+
"build": "yarn g:build",
|
|
34
|
+
"lint": "yarn g:lint",
|
|
35
|
+
"lint:ci": "yarn g:lint:ci",
|
|
36
|
+
"test": "yarn g:test",
|
|
37
|
+
"ci": "yarn g:ci",
|
|
38
|
+
"up": "yarn g:up",
|
|
39
|
+
"dev": "storybook dev -p 6006",
|
|
40
|
+
"build-storybook": "storybook build"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@cratis/components": "^2.8.1",
|
|
44
|
+
"@cratis/scene.blueprint.default": "0.1.0",
|
|
45
|
+
"@cratis/scene.components": "0.1.0",
|
|
46
|
+
"@cratis/scene.engine": "0.1.0",
|
|
47
|
+
"@cratis/scene.model": "0.1.0",
|
|
48
|
+
"@cratis/scene.react": "0.1.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@cratis/components": "^2.8.1",
|
|
52
|
+
"@cratis/scene.blueprint.default": "0.1.0",
|
|
53
|
+
"@cratis/scene.components": "0.1.0",
|
|
54
|
+
"@cratis/scene.engine": "0.1.0",
|
|
55
|
+
"@cratis/scene.model": "0.1.0",
|
|
56
|
+
"@cratis/scene.react": "0.1.0",
|
|
57
|
+
"@storybook/addon-links": "^10.4.1",
|
|
58
|
+
"@storybook/react": "^10.4.1",
|
|
59
|
+
"@storybook/react-vite": "^10.4.1",
|
|
60
|
+
"primeicons": "^7.0.0",
|
|
61
|
+
"primereact": "10.9.8",
|
|
62
|
+
"react": "^19.2.6",
|
|
63
|
+
"react-dom": "^19.2.6",
|
|
64
|
+
"storybook": "^10.4.1"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"primereact": "^10.9.0",
|
|
68
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
69
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
70
|
+
}
|
|
71
|
+
}
|
package/packageName.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
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 name this blueprint is known by inside a `ui profile`.
|
|
6
|
+
*
|
|
7
|
+
* It is not the npm package name: a profile lists Scene package names, a `PackageDependency` refers to
|
|
8
|
+
* one, and `componentRegistryKey` builds every registry key from this. It therefore lives on its own
|
|
9
|
+
* rather than inside the manifest, so the registry can key off it without importing the manifest that
|
|
10
|
+
* describes the registry.
|
|
11
|
+
*/
|
|
12
|
+
export const componentsBlueprintName = 'Cratis.Blueprint.Components';
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
* What a template tells its page header.
|
|
6
|
+
*
|
|
7
|
+
* `query` and `command` are separate and both optional, and at most one is ever set - which is the header
|
|
8
|
+
* component's contract, not a convenience here: a page is *about* one thing, and a header bound to both a
|
|
9
|
+
* query and a command would have nothing sensible to say about either. Setting neither is allowed and
|
|
10
|
+
* means the header states that no binding was named, which is a legitimate design-time state.
|
|
11
|
+
*/
|
|
12
|
+
export interface ArcHeaderOptions {
|
|
13
|
+
/** The heading. Left out to let the header read the binding name as a sentence instead. */
|
|
14
|
+
title?: string;
|
|
15
|
+
|
|
16
|
+
/** The line under the heading. */
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
|
|
19
|
+
/** The section this page belongs to, which becomes the first entry of the derived breadcrumb trail. */
|
|
20
|
+
section?: string;
|
|
21
|
+
|
|
22
|
+
/** The query this page is about. */
|
|
23
|
+
query?: string;
|
|
24
|
+
|
|
25
|
+
/** The command this page is about. */
|
|
26
|
+
command?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
* One column of a data table, as a template declares it.
|
|
6
|
+
*
|
|
7
|
+
* Two fields and no more, because that is genuinely all a column needs in a template: which property of
|
|
8
|
+
* the read model it shows, and what the heading says. Everything else a PrimeReact `Column` can do -
|
|
9
|
+
* sorting, filtering, body templates - is either turned on for the whole table or is application-specific
|
|
10
|
+
* detail that belongs in the application's own screen rather than in a shipped template.
|
|
11
|
+
*/
|
|
12
|
+
export interface ColumnDefinition {
|
|
13
|
+
/** The read-model property the column shows. */
|
|
14
|
+
field: string;
|
|
15
|
+
|
|
16
|
+
/** The column heading. */
|
|
17
|
+
header: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The Arc query and command names this blueprint's templates ship bound to.
|
|
6
|
+
*
|
|
7
|
+
* A template carries a binding *name*, never a class - the binding registry in `@cratis/scene.components`
|
|
8
|
+
* is what turns a name into the generated proxy at render time, and only a host owns those proxies. So a
|
|
9
|
+
* template has to write some name, and these are the ones it writes.
|
|
10
|
+
*
|
|
11
|
+
* They are defaults, not fixtures. An application picking `DataListPage` replaces `AllInvoices` with its
|
|
12
|
+
* own query and the page is done; nothing else about the template changes. Shipping a template with no
|
|
13
|
+
* name at all would have been the alternative, and it is a worse one - it renders as a diagram of a page
|
|
14
|
+
* rather than a page, and the thing a template most needs to prove is that it composes into something
|
|
15
|
+
* real.
|
|
16
|
+
*
|
|
17
|
+
* The names are deliberately in the shape Arc generates: a `[ReadModel]`'s static query method
|
|
18
|
+
* (`AllInvoices`), and a `[Command]` record (`RegisterInvoice`). A designer reading a preview should
|
|
19
|
+
* recognize them as the artifacts they would really be wiring.
|
|
20
|
+
*
|
|
21
|
+
* This is an enum of *this package's defaults*, not of every name a binding may take. The element builders
|
|
22
|
+
* therefore take a plain `string`, so an application can point the same builders at `AllPurchaseOrders`
|
|
23
|
+
* without having to widen anything - the set of Arc proxies in an application is open, and a closed type
|
|
24
|
+
* over it would make these builders usable only for the invoices they ship bound to.
|
|
25
|
+
*/
|
|
26
|
+
export enum SampleBindingName {
|
|
27
|
+
/** Every invoice - the snapshot query a list page reads. */
|
|
28
|
+
AllInvoices = 'AllInvoices',
|
|
29
|
+
|
|
30
|
+
/** Invoices still being processed - an observable query, so the page is live. */
|
|
31
|
+
InvoicesInFlight = 'InvoicesInFlight',
|
|
32
|
+
|
|
33
|
+
/** One invoice by its id - what a detail region reads. */
|
|
34
|
+
InvoiceById = 'InvoiceById',
|
|
35
|
+
|
|
36
|
+
/** Revenue aggregated by month - a dashboard widget's query. */
|
|
37
|
+
RevenueByMonth = 'RevenueByMonth',
|
|
38
|
+
|
|
39
|
+
/** Open support tickets - a second dashboard widget's query. */
|
|
40
|
+
OpenTickets = 'OpenTickets',
|
|
41
|
+
|
|
42
|
+
/** Every adjustment recorded against an invoice. */
|
|
43
|
+
AllAdjustments = 'AllAdjustments',
|
|
44
|
+
|
|
45
|
+
/** Registers a new invoice - the command a form page submits. */
|
|
46
|
+
RegisterInvoice = 'RegisterInvoice',
|
|
47
|
+
|
|
48
|
+
/** Records an adjustment against an invoice - the command a dialog submits. */
|
|
49
|
+
RecordAdjustment = 'RecordAdjustment',
|
|
50
|
+
}
|
|
@@ -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
|
+
/**
|
|
5
|
+
* The settings every table-shaped element in this package shares.
|
|
6
|
+
*
|
|
7
|
+
* `emptyMessage` and `dataKey` are required rather than optional on purpose. The library's adapters both
|
|
8
|
+
* default them to an empty string, and both defaults are quietly wrong in a shipped template: a table with
|
|
9
|
+
* no empty message reads as broken when the query legitimately returns nothing, and a table with no data
|
|
10
|
+
* key loses its selection every time the query is re-performed. Making them required means a template
|
|
11
|
+
* cannot be written without deciding.
|
|
12
|
+
*/
|
|
13
|
+
export interface TableOptions {
|
|
14
|
+
/** The message shown when the query returns nothing. */
|
|
15
|
+
emptyMessage: string;
|
|
16
|
+
|
|
17
|
+
/** The read-model property that identifies a row, so selection survives a re-query. */
|
|
18
|
+
dataKey: string;
|
|
19
|
+
|
|
20
|
+
/** The fields the search box filters across, when the table offers one. */
|
|
21
|
+
globalFilterFields?: string[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
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 { SlotName, TemplateSlotName, column, slotLeaf } from '@cratis/scene.blueprint.default';
|
|
6
|
+
import { arcPageHeader, page, toolbar, toolbarButton, toolbarSeparator } from './elements';
|
|
7
|
+
import { commandForm } from './formElements';
|
|
8
|
+
import { SampleBindingName } from './SampleBindingName';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The write side: a page whose body is one command, and whose action bar submits it.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* A command form page - a header, the generated form, and the bar that closes it.
|
|
16
|
+
*
|
|
17
|
+
* The form is `commandForm`, which is `AutoCommandForm`: it reads the command's own property descriptors
|
|
18
|
+
* and picks a field component per property type. That is the whole reason a *template* can ship a form at
|
|
19
|
+
* all. A template that listed fields by hand would be a snapshot of a command as it looked the day the
|
|
20
|
+
* template was written, and would go quietly wrong the first time a property was added on the backend.
|
|
21
|
+
* This one follows the command, which is the same guarantee Arc's generated proxies give everywhere else.
|
|
22
|
+
*
|
|
23
|
+
* `exclude` names the properties the form should not generate. `invoiceId` is excluded because it is the
|
|
24
|
+
* event-source identity - Arc resolves it, and a form offering to type it in is offering to break it.
|
|
25
|
+
*
|
|
26
|
+
* The action bar is the template's rather than the form's, and it declares its own slot for that reason: a
|
|
27
|
+
* screen replacing "Register" with "Register and approve" should not have to replace the form.
|
|
28
|
+
*/
|
|
29
|
+
export const commandFormPageTemplate: ScreenTemplate = {
|
|
30
|
+
name: 'CommandFormPage',
|
|
31
|
+
fitsSlot: SlotName.Content,
|
|
32
|
+
slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.Actions }],
|
|
33
|
+
arrangement: {
|
|
34
|
+
root: column([slotLeaf(TemplateSlotName.Header), slotLeaf(TemplateSlotName.Body, { grow: 1 }), slotLeaf(TemplateSlotName.Actions)], 16),
|
|
35
|
+
},
|
|
36
|
+
content: {
|
|
37
|
+
[TemplateSlotName.Header]: [
|
|
38
|
+
arcPageHeader('command-form-header', {
|
|
39
|
+
title: 'Register an invoice',
|
|
40
|
+
subtitle: 'The form follows the command, so a property added on the backend shows up here',
|
|
41
|
+
section: 'Billing',
|
|
42
|
+
command: SampleBindingName.RegisterInvoice,
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
[TemplateSlotName.Body]: [page('command-form-body', '', [commandForm('command-form', SampleBindingName.RegisterInvoice, ['invoiceId'])])],
|
|
46
|
+
[TemplateSlotName.Actions]: [
|
|
47
|
+
toolbar('command-form-actions', [
|
|
48
|
+
toolbarButton('command-form-submit', 'Register the invoice', 'pi pi-check', 'Register'),
|
|
49
|
+
toolbarSeparator('command-form-separator'),
|
|
50
|
+
toolbarButton('command-form-cancel', 'Discard and go back', 'pi pi-times', 'Cancel'),
|
|
51
|
+
]),
|
|
52
|
+
],
|
|
53
|
+
},
|
|
54
|
+
displayName: 'Command form page',
|
|
55
|
+
description: 'A generated command form under a header that states the command, with its own action bar.',
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
/** The command-shaped templates. */
|
|
59
|
+
export const commandTemplates: ScreenTemplate[] = [commandFormPageTemplate];
|