@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 @@
|
|
|
1
|
+
{"version":3,"file":"editorTemplates.js","sources":["../../../templates/editorTemplates.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ScreenTemplate, WidthSizeClass } from '@cratis/scene.model';\nimport { SlotName, TemplateSlotName, column, row, slotLeaf } from '@cratis/scene.blueprint.default';\nimport { filterPanel, objectContentEditor, objectNavigationalBar, schemaEditor, timeMachine } from './editorElements';\nimport { arcPageHeader, errorBoundary, page, toolbar, toolbarButton, toolbarSeparator } from './elements';\nimport { SampleBindingName } from './SampleBindingName';\n\n/**\n * The two inspection pages: one for a type's shape, one for an instance's content.\n *\n * These are the templates to open first when looking at this blueprint, because they are the two that\n * render completely with nothing registered. The schema editor, the document editor, the navigational bar\n * and the time machine all read their content out of the property bag rather than from a query, so a\n * preview of either page is a working page rather than a page of placeholders.\n *\n * That is not a trick to make a demo look better. It is the honest shape of the library: most of\n * `@cratis/components` is Arc-bound and needs a host, and a meaningful part of it is not. A blueprint built\n * on it should make both halves visible.\n */\n\n/**\n * The schema editor page: an event type's shape, edited as a typed property tree.\n *\n * Its header names no binding, and that is correct rather than an omission. A schema is design-time\n * metadata about an event type, not a read model anyone queries, so there is nothing for the header to be\n * bound to - and the header says `No binding` instead of implying a wiring step that does not exist. It is\n * the one page in this package where the unbound state is the finished state.\n *\n * `canEdit` is paired with `canNotEditReason` deliberately: in an event-sourced application a stored event\n * type's schema is very often deliberately locked, and saying why in the same place is what stops that\n * from reading as a bug.\n */\nexport const schemaEditorPageTemplate: ScreenTemplate = {\n name: 'SchemaEditorPage',\n fitsSlot: SlotName.Content,\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Toolbar }, { name: TemplateSlotName.Body }],\n arrangement: {\n root: column([slotLeaf(TemplateSlotName.Header), slotLeaf(TemplateSlotName.Toolbar), slotLeaf(TemplateSlotName.Body, { grow: 1 })], 16),\n },\n content: {\n [TemplateSlotName.Header]: [\n arcPageHeader('schema-header', {\n title: 'InvoiceRegistered',\n subtitle: 'The shape of the event, and what a new generation would be allowed to change',\n section: 'Event types',\n }),\n ],\n [TemplateSlotName.Toolbar]: [\n toolbar('schema-toolbar', [\n toolbarButton('schema-edit', 'Edit the schema', 'pi pi-pencil', 'Edit'),\n toolbarButton('schema-generation', 'Start a new generation', 'pi pi-clone', 'New generation'),\n toolbarSeparator('schema-separator'),\n toolbarButton('schema-download', 'Download as JSON Schema', 'pi pi-download'),\n ]),\n ],\n [TemplateSlotName.Body]: [\n page('schema-body', 'InvoiceRegistered', [schemaEditor('schema-editor', 'InvoiceRegistered', true)]),\n ],\n },\n displayName: 'Schema editor page',\n description: \"An event type's schema edited as a typed property tree, with the actions that evolve it.\",\n};\n\n/**\n * The object editor page: one document, its trail, and its history beside it.\n *\n * Bound to `InvoiceById`, because that is what a real page like this is: you arrive with an id, the query\n * fetches the record, and the editor renders it against its schema. The editors themselves take their\n * content from the property bag, so the page is fully legible before the query is wired - and the header\n * still says which query it is waiting for.\n *\n * The document is wrapped in an `errorBoundary` and the history is not, which is the decision this element\n * exists to let a template make. A malformed document should cost the document region; it should not take\n * the trail and the timeline down with it, and the timeline is the thing you would reach for to find out\n * *when* the document became malformed.\n */\nexport const objectEditorPageTemplate: ScreenTemplate = {\n name: 'ObjectEditorPage',\n fitsSlot: SlotName.Content,\n slots: [\n { name: TemplateSlotName.Header },\n { name: TemplateSlotName.Toolbar },\n { name: TemplateSlotName.Body },\n { name: TemplateSlotName.SidePanel },\n ],\n arrangement: {\n root: column([\n slotLeaf(TemplateSlotName.Header),\n slotLeaf(TemplateSlotName.Toolbar),\n row([slotLeaf(TemplateSlotName.Body, { grow: 2 }), slotLeaf(TemplateSlotName.SidePanel, { grow: 1 })], 16),\n ]),\n overrides: [\n {\n width: WidthSizeClass.Compact,\n root: column(\n [\n slotLeaf(TemplateSlotName.Header),\n slotLeaf(TemplateSlotName.Toolbar),\n slotLeaf(TemplateSlotName.Body),\n slotLeaf(TemplateSlotName.SidePanel),\n ],\n 16,\n ),\n },\n ],\n },\n content: {\n [TemplateSlotName.Header]: [\n arcPageHeader('object-header', {\n title: 'INV-2043',\n subtitle: 'The document as it stands, and every version it has been',\n section: 'Billing',\n query: SampleBindingName.InvoiceById,\n }),\n ],\n [TemplateSlotName.Toolbar]: [objectNavigationalBar('object-trail'), filterPanel('object-filters', 'Filters')],\n [TemplateSlotName.Body]: [\n errorBoundary('object-guard', [page('object-body', 'Document', [objectContentEditor('object-editor', true)])]),\n ],\n [TemplateSlotName.SidePanel]: [page('object-history', 'History', [timeMachine('object-time-machine')])],\n },\n displayName: 'Object editor page',\n description: 'One document edited against its schema, with its navigation trail and its version history.',\n};\n\n/** The two editor-shaped templates. */\nexport const editorTemplates: ScreenTemplate[] = [schemaEditorPageTemplate, objectEditorPageTemplate];\n"],"names":["schemaEditorPageTemplate","name","fitsSlot","SlotName","Content","slots","TemplateSlotName","Header","Toolbar","Body","arrangement","root","column","slotLeaf","grow","content","arcPageHeader","title","subtitle","section","toolbar","toolbarButton","toolbarSeparator","page","schemaEditor","displayName","description","objectEditorPageTemplate","SidePanel","row","overrides","width","WidthSizeClass","Compact","query","SampleBindingName","InvoiceById","objectNavigationalBar","filterPanel","errorBoundary","objectContentEditor","timeMachine","editorTemplates"],"mappings":";;;;;;;;AAAA;AACA;AAQA;;;;;;;;;;;;;;;;;;;;;;UAyBaA,wBAAAA,GAA2C;IACpDC,IAAAA,EAAM,kBAAA;AACNC,IAAAA,QAAAA,EAAUC,iCAASC,OAAO;IAC1BC,KAAAA,EAAO;AAAC,QAAA;AAAEJ,YAAAA,IAAAA,EAAMK,yCAAiBC;AAAO,SAAA;AAAG,QAAA;AAAEN,YAAAA,IAAAA,EAAMK,yCAAiBE;AAAQ,SAAA;AAAG,QAAA;AAAEP,YAAAA,IAAAA,EAAMK,yCAAiBG;AAAK;AAAE,KAAA;IAC/GC,WAAAA,EAAa;AACTC,QAAAA,IAAAA,EAAMC,8BAAAA,CAAO;AAACC,YAAAA,gCAAAA,CAASP,yCAAiBC,MAAM,CAAA;AAAGM,YAAAA,gCAAAA,CAASP,yCAAiBE,OAAO,CAAA;YAAGK,gCAAAA,CAASP,wCAAAA,CAAiBG,IAAI,EAAE;gBAAEK,IAAAA,EAAM;AAAE,aAAA;SAAG,EAAE,EAAA;AACxI,KAAA;IACAC,OAAAA,EAAS;QACL,CAACT,wCAAAA,CAAiBC,MAAM,GAAG;AACvB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AChH,SAAA;QACD,CAAClC,wCAAAA,CAAiBsB,SAAS,GAAG;AAACL,YAAAA,aAAAA,CAAK,kBAAkB,SAAA,EAAW;gBAACkB,0BAAAA,CAAY,qBAAA;AAAuB,aAAA;AAAE;AAC3G,KAAA;IACAhB,WAAAA,EAAa,oBAAA;IACbC,WAAAA,EAAa;AACjB;AAEA,wCACO,MAAMgB,eAAAA,GAAoC;AAAC1C,IAAAA,wBAAAA;AAA0B2B,IAAAA;;;;;;;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
4
|
+
var ComponentName = require('../ComponentName.js');
|
|
5
|
+
var CompositeName = require('../CompositeName.js');
|
|
6
|
+
|
|
7
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
8
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
9
|
+
/**
|
|
10
|
+
* The page furniture every template in this package repeats.
|
|
11
|
+
*
|
|
12
|
+
* `externalComponent` is imported from the default blueprint rather than written again, and that is worth
|
|
13
|
+
* pausing on: `ExternalComponent` inherits fifteen required members before it reaches the two a template
|
|
14
|
+
* author cares about, so a package that redeclared those defaults would be maintaining a second copy of a
|
|
15
|
+
* decision it does not own. Borrowing the builder is the same choice as depending on the shell - this
|
|
16
|
+
* blueprint layers on the default one, so it uses its parts.
|
|
17
|
+
*/ /**
|
|
18
|
+
* This blueprint's page header, given its heading and the one binding the page is about.
|
|
19
|
+
*
|
|
20
|
+
* Every template opens with one. The header derives the trail and the design-time binding state itself, so
|
|
21
|
+
* a template states the page's subject once instead of repeating it in a title, a trail and a table.
|
|
22
|
+
*/ function arcPageHeader(id, options, actions = []) {
|
|
23
|
+
return scene_blueprint_default.externalComponent(id, ComponentName.ComponentName.ArcPageHeader, {
|
|
24
|
+
...options
|
|
25
|
+
}, {
|
|
26
|
+
actions
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The library's `page` primitive wrapping content.
|
|
31
|
+
*
|
|
32
|
+
* A `div` would have done structurally, and would have been wrong: `page` is the full-height flex column
|
|
33
|
+
* every other component in `@cratis/components` is laid out inside, drawn from the same `--cratis-*`
|
|
34
|
+
* tokens as the tables and dialogs it contains. Content wrapped in it gets that consistency for free, and
|
|
35
|
+
* content wrapped in a `div` has to reinvent it and will drift.
|
|
36
|
+
*/ function page(id, title, content, panel = true) {
|
|
37
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.Page, {
|
|
38
|
+
title,
|
|
39
|
+
showTitle: title.length > 0,
|
|
40
|
+
panel
|
|
41
|
+
}, {
|
|
42
|
+
content
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/** One button in a tool palette. `title` is the accessible name as well as the tooltip, so it is never omitted. */ function toolbarButton(id, title, icon, text) {
|
|
46
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.ToolbarButton, {
|
|
47
|
+
title,
|
|
48
|
+
icon,
|
|
49
|
+
text
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
/** Related buttons kept together inside a toolbar. */ function toolbarGroup(id, buttons) {
|
|
53
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.ToolbarGroup, {
|
|
54
|
+
orientation: 'horizontal'
|
|
55
|
+
}, {
|
|
56
|
+
content: buttons
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** The divider between groups of tools. */ function toolbarSeparator(id) {
|
|
60
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.ToolbarSeparator, {
|
|
61
|
+
orientation: 'horizontal'
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A horizontal tool palette.
|
|
66
|
+
*
|
|
67
|
+
* `draggable` is deliberately left off rather than set per button - it is a property of the palette, and
|
|
68
|
+
* setting it per button is how you end up with a palette that is half draggable.
|
|
69
|
+
*/ function toolbar(id, content) {
|
|
70
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.Toolbar, {
|
|
71
|
+
orientation: 'horizontal'
|
|
72
|
+
}, {
|
|
73
|
+
content
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Scopes a failure to one region of a page.
|
|
78
|
+
*
|
|
79
|
+
* React's default is that a throw anywhere unmounts the whole tree, which on a composed screen means one
|
|
80
|
+
* broken widget takes the navigation with it. Which regions deserve a boundary is a decision about the
|
|
81
|
+
* page, which is exactly why it belongs in a template rather than in the renderer.
|
|
82
|
+
*/ function errorBoundary(id, content) {
|
|
83
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.ErrorBoundary, {}, {
|
|
84
|
+
content
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/** An icon, given a PrimeIcons class name. */ function icon(id, iconName) {
|
|
88
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.Icon, {
|
|
89
|
+
icon: iconName
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
exports.arcPageHeader = arcPageHeader;
|
|
94
|
+
exports.errorBoundary = errorBoundary;
|
|
95
|
+
exports.icon = icon;
|
|
96
|
+
exports.page = page;
|
|
97
|
+
exports.toolbar = toolbar;
|
|
98
|
+
exports.toolbarButton = toolbarButton;
|
|
99
|
+
exports.toolbarGroup = toolbarGroup;
|
|
100
|
+
exports.toolbarSeparator = toolbarSeparator;
|
|
101
|
+
//# sourceMappingURL=elements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elements.js","sources":["../../../templates/elements.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SceneElement } from '@cratis/scene.model';\nimport { externalComponent } from '@cratis/scene.blueprint.default';\nimport { ComponentName } from '../ComponentName';\nimport { CompositeName } from '../CompositeName';\nimport { ArcHeaderOptions } from './ArcHeaderOptions';\n\n/**\n * The page furniture every template in this package repeats.\n *\n * `externalComponent` is imported from the default blueprint rather than written again, and that is worth\n * pausing on: `ExternalComponent` inherits fifteen required members before it reaches the two a template\n * author cares about, so a package that redeclared those defaults would be maintaining a second copy of a\n * decision it does not own. Borrowing the builder is the same choice as depending on the shell - this\n * blueprint layers on the default one, so it uses its parts.\n */\n\n/**\n * This blueprint's page header, given its heading and the one binding the page is about.\n *\n * Every template opens with one. The header derives the trail and the design-time binding state itself, so\n * a template states the page's subject once instead of repeating it in a title, a trail and a table.\n */\nexport function arcPageHeader(id: string, options: ArcHeaderOptions, actions: SceneElement[] = []): SceneElement {\n return externalComponent(id, ComponentName.ArcPageHeader, { ...options }, { actions });\n}\n\n/**\n * The library's `page` primitive wrapping content.\n *\n * A `div` would have done structurally, and would have been wrong: `page` is the full-height flex column\n * every other component in `@cratis/components` is laid out inside, drawn from the same `--cratis-*`\n * tokens as the tables and dialogs it contains. Content wrapped in it gets that consistency for free, and\n * content wrapped in a `div` has to reinvent it and will drift.\n */\nexport function page(id: string, title: string, content: SceneElement[], panel = true): SceneElement {\n return externalComponent(id, CompositeName.Page, { title, showTitle: title.length > 0, panel }, { content });\n}\n\n/** One button in a tool palette. `title` is the accessible name as well as the tooltip, so it is never omitted. */\nexport function toolbarButton(id: string, title: string, icon: string, text?: string): SceneElement {\n return externalComponent(id, CompositeName.ToolbarButton, { title, icon, text });\n}\n\n/** Related buttons kept together inside a toolbar. */\nexport function toolbarGroup(id: string, buttons: SceneElement[]): SceneElement {\n return externalComponent(id, CompositeName.ToolbarGroup, { orientation: 'horizontal' }, { content: buttons });\n}\n\n/** The divider between groups of tools. */\nexport function toolbarSeparator(id: string): SceneElement {\n return externalComponent(id, CompositeName.ToolbarSeparator, { orientation: 'horizontal' });\n}\n\n/**\n * A horizontal tool palette.\n *\n * `draggable` is deliberately left off rather than set per button - it is a property of the palette, and\n * setting it per button is how you end up with a palette that is half draggable.\n */\nexport function toolbar(id: string, content: SceneElement[]): SceneElement {\n return externalComponent(id, CompositeName.Toolbar, { orientation: 'horizontal' }, { content });\n}\n\n/**\n * Scopes a failure to one region of a page.\n *\n * React's default is that a throw anywhere unmounts the whole tree, which on a composed screen means one\n * broken widget takes the navigation with it. Which regions deserve a boundary is a decision about the\n * page, which is exactly why it belongs in a template rather than in the renderer.\n */\nexport function errorBoundary(id: string, content: SceneElement[]): SceneElement {\n return externalComponent(id, CompositeName.ErrorBoundary, {}, { content });\n}\n\n/** An icon, given a PrimeIcons class name. */\nexport function icon(id: string, iconName: string): SceneElement {\n return externalComponent(id, CompositeName.Icon, { icon: iconName });\n}\n"],"names":["arcPageHeader","id","options","actions","externalComponent","ComponentName","ArcPageHeader","page","title","content","panel","CompositeName","Page","showTitle","length","toolbarButton","icon","text","ToolbarButton","toolbarGroup","buttons","ToolbarGroup","orientation","toolbarSeparator","ToolbarSeparator","toolbar","Toolbar","errorBoundary","ErrorBoundary","iconName","Icon"],"mappings":";;;;;;AAAA;AACA;AAQA;;;;;;;;;;;;;IAgBO,SAASA,aAAAA,CAAcC,EAAU,EAAEC,OAAyB,EAAEC,UAA0B,EAAE,EAAA;AAC7F,IAAA,OAAOC,yCAAAA,CAAkBH,EAAAA,EAAII,2BAAAA,CAAcC,aAAa,EAAE;AAAE,QAAA,GAAGJ;KAAQ,EAAG;AAAEC,QAAAA;AAAQ,KAAA,CAAA;AACxF;AAEA;;;;;;;IAQO,SAASI,IAAAA,CAAKN,EAAU,EAAEO,KAAa,EAAEC,OAAuB,EAAEC,KAAAA,GAAQ,IAAI,EAAA;AACjF,IAAA,OAAON,yCAAAA,CAAkBH,EAAAA,EAAIU,2BAAAA,CAAcC,IAAI,EAAE;AAAEJ,QAAAA,KAAAA;QAAOK,SAAAA,EAAWL,KAAAA,CAAMM,MAAM,GAAG,CAAA;AAAGJ,QAAAA;KAAM,EAAG;AAAED,QAAAA;AAAQ,KAAA,CAAA;AAC9G;AAEA,oHACO,SAASM,aAAAA,CAAcd,EAAU,EAAEO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0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
4
|
+
var CompositeName = require('../CompositeName.js');
|
|
5
|
+
|
|
6
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
7
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
8
|
+
/**
|
|
9
|
+
* The Arc-bound form elements this blueprint's templates are built from.
|
|
10
|
+
*
|
|
11
|
+
* Every field carries a `property` name, which the library turns into an accessor onto the command
|
|
12
|
+
* instance. That indirection is not incidental: a hand-written form binds a field with
|
|
13
|
+
* `value={command => command.number}` and is typechecked against the generated proxy, and a template has
|
|
14
|
+
* no types to check against because it is data. The name is what survives, so the name is what a field
|
|
15
|
+
* carries.
|
|
16
|
+
*/ /**
|
|
17
|
+
* A whole form generated from the command's own property descriptors.
|
|
18
|
+
*
|
|
19
|
+
* `commandForm` is `AutoCommandForm`, not `CommandForm`, and that is what makes it worth shipping in a
|
|
20
|
+
* template at all: a template that listed every field by hand would go stale the moment a property was
|
|
21
|
+
* added to the command on the backend, and a stale template is worse than no template. This one follows
|
|
22
|
+
* the command, which is the same guarantee Arc's generated proxies give the rest of the stack.
|
|
23
|
+
*
|
|
24
|
+
* @param exclude Properties the surrounding template places itself, so the generated form does not produce a second copy.
|
|
25
|
+
*/ function commandForm(id, command, exclude) {
|
|
26
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.CommandForm, {
|
|
27
|
+
command,
|
|
28
|
+
exclude
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** A single-line text field bound to one command property. */ function inputTextField(id, property, title, placeholder) {
|
|
32
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.InputTextField, {
|
|
33
|
+
property,
|
|
34
|
+
title,
|
|
35
|
+
placeholder
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** A numeric field bound to one command property. */ function numberField(id, property, title) {
|
|
39
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.NumberField, {
|
|
40
|
+
property,
|
|
41
|
+
title
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/** A multi-line text field bound to one command property. */ function textAreaField(id, property, title, rows = 3) {
|
|
45
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.TextAreaField, {
|
|
46
|
+
property,
|
|
47
|
+
title,
|
|
48
|
+
rows
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/** A date field bound to one command property. */ function calendarField(id, property, title) {
|
|
52
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.CalendarField, {
|
|
53
|
+
property,
|
|
54
|
+
title
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* A single-selection field over a list the template carries inline.
|
|
59
|
+
*
|
|
60
|
+
* Inline options only. A list that has to come from the backend is a different thing entirely - bind it to
|
|
61
|
+
* a query - because a property bag is the wrong place for data, and a template that embedded a real
|
|
62
|
+
* lookup table would be shipping someone else's reference data.
|
|
63
|
+
*/ function dropdownField(id, property, title, options) {
|
|
64
|
+
return scene_blueprint_default.externalComponent(id, CompositeName.CompositeName.DropdownField, {
|
|
65
|
+
property,
|
|
66
|
+
title,
|
|
67
|
+
options
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
exports.calendarField = calendarField;
|
|
72
|
+
exports.commandForm = commandForm;
|
|
73
|
+
exports.dropdownField = dropdownField;
|
|
74
|
+
exports.inputTextField = inputTextField;
|
|
75
|
+
exports.numberField = numberField;
|
|
76
|
+
exports.textAreaField = textAreaField;
|
|
77
|
+
//# sourceMappingURL=formElements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formElements.js","sources":["../../../templates/formElements.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SceneElement } from '@cratis/scene.model';\nimport { externalComponent } from '@cratis/scene.blueprint.default';\nimport { CompositeName } from '../CompositeName';\n\n/**\n * The Arc-bound form elements this blueprint's templates are built from.\n *\n * Every field carries a `property` name, which the library turns into an accessor onto the command\n * instance. That indirection is not incidental: a hand-written form binds a field with\n * `value={command => command.number}` and is typechecked against the generated proxy, and a template has\n * no types to check against because it is data. The name is what survives, so the name is what a field\n * carries.\n */\n\n/**\n * A whole form generated from the command's own property descriptors.\n *\n * `commandForm` is `AutoCommandForm`, not `CommandForm`, and that is what makes it worth shipping in a\n * template at all: a template that listed every field by hand would go stale the moment a property was\n * added to the command on the backend, and a stale template is worse than no template. This one follows\n * the command, which is the same guarantee Arc's generated proxies give the rest of the stack.\n *\n * @param exclude Properties the surrounding template places itself, so the generated form does not produce a second copy.\n */\nexport function commandForm(id: string, command: string, exclude?: string[]): SceneElement {\n return externalComponent(id, CompositeName.CommandForm, { command, exclude });\n}\n\n/** A single-line text field bound to one command property. */\nexport function inputTextField(id: string, property: string, title: string, placeholder?: string): SceneElement {\n return externalComponent(id, CompositeName.InputTextField, { property, title, placeholder });\n}\n\n/** A numeric field bound to one command property. */\nexport function numberField(id: string, property: string, title: string): SceneElement {\n return externalComponent(id, CompositeName.NumberField, { property, title });\n}\n\n/** A multi-line text field bound to one command property. */\nexport function textAreaField(id: string, property: string, title: string, rows = 3): SceneElement {\n return externalComponent(id, CompositeName.TextAreaField, { property, title, rows });\n}\n\n/** A date field bound to one command property. */\nexport function calendarField(id: string, property: string, title: string): SceneElement {\n return externalComponent(id, CompositeName.CalendarField, { property, title });\n}\n\n/**\n * A single-selection field over a list the template carries inline.\n *\n * Inline options only. A list that has to come from the backend is a different thing entirely - bind it to\n * a query - because a property bag is the wrong place for data, and a template that embedded a real\n * lookup table would be shipping someone else's reference data.\n */\nexport function dropdownField(id: string, property: string, title: string, options: { label: string; value: string }[]): SceneElement {\n return externalComponent(id, CompositeName.DropdownField, { property, title, options });\n}\n"],"names":["commandForm","id","command","exclude","externalComponent","CompositeName","CommandForm","inputTextField","property","title","placeholder","InputTextField","numberField","NumberField","textAreaField","rows","TextAreaField","calendarField","CalendarField","dropdownField","options","DropdownField"],"mappings":";;;;;AAAA;AACA;AAMA;;;;;;;;;;;;;;;;;AAmBC,IACM,SAASA,WAAAA,CAAYC,EAAU,EAAEC,OAAe,EAAEC,OAAkB,EAAA;AACvE,IAAA,OAAOC,yCAAAA,CAAkBH,EAAAA,EAAII,2BAAAA,CAAcC,WAAW,EAAE;AAAEJ,QAAAA,OAAAA;AAASC,QAAAA;AAAQ,KAAA,CAAA;AAC/E;AAEA,+DACO,SAASI,cAAAA,CAAeN,EAAU,EAAEO,QAAgB,EAAEC,KAAa,EAAEC,WAAoB,EAAA;AAC5F,IAAA,OAAON,yCAAAA,CAAkBH,EAAAA,EAAII,2BAAAA,CAAcM,cAAc,EAAE;AAAEH,QAAAA,QAAAA;AAAUC,QAAAA,KAAAA;AAAOC,QAAAA;AAAY,KAAA,CAAA;AAC9F;AAEA,sDACO,SAASE,WAAAA,CAAYX,EAAU,EAAEO,QAAgB,EAAEC,KAAa,EAAA;AACnE,IAAA,OAAOL,yCAAAA,CAAkBH,EAAAA,EAAII,2BAAAA,CAAcQ,WAAW,EAAE;AAAEL,QAAAA,QAAAA;AAAUC,QAAAA;AAAM,KAAA,CAAA;AAC9E;AAEA,8DACO,SAASK,aAAAA,CAAcb,EAAU,EAAEO,QAAgB,EAAEC,KAAa,EAAEM,IAAAA,GAAO,CAAC,EAAA;AAC/E,IAAA,OAAOX,yCAAAA,CAAkBH,EAAAA,EAAII,2BAAAA,CAAcW,aAAa,EAAE;AAAER,QAAAA,QAAAA;AAAUC,QAAAA,KAAAA;AAAOM,QAAAA;AAAK,KAAA,CAAA;AACtF;AAEA,mDACO,SAASE,aAAAA,CAAchB,EAAU,EAAEO,QAAgB,EAAEC,KAAa,EAAA;AACrE,IAAA,OAAOL,yCAAAA,CAAkBH,EAAAA,EAAII,2BAAAA,CAAca,aAAa,EAAE;AAAEV,QAAAA,QAAAA;AAAUC,QAAAA;AAAM,KAAA,CAAA;AAChF;AAEA;;;;;;IAOO,SAASU,aAAAA,CAAclB,EAAU,EAAEO,QAAgB,EAAEC,KAAa,EAAEW,OAA2C,EAAA;AAClH,IAAA,OAAOhB,yCAAAA,CAAkBH,EAAAA,EAAII,2BAAAA,CAAcgB,aAAa,EAAE;AAAEb,QAAAA,QAAAA;AAAUC,QAAAA,KAAAA;AAAOW,QAAAA;AAAQ,KAAA,CAAA;AACzF;;;;;;;;;"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_model = require('@cratis/scene.model');
|
|
4
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
5
|
+
var dataElements = require('./dataElements.js');
|
|
6
|
+
var editorElements = require('./editorElements.js');
|
|
7
|
+
var elements = require('./elements.js');
|
|
8
|
+
var SampleBindingName = require('./SampleBindingName.js');
|
|
9
|
+
|
|
10
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
11
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
12
|
+
/**
|
|
13
|
+
* The three list shapes an Arc application repeats: a list, a live list, and a list with the selected
|
|
14
|
+
* record beside it.
|
|
15
|
+
*
|
|
16
|
+
* All three fill the application shell's `content` slot, which is the only slot the default blueprint's
|
|
17
|
+
* `AppShell` layout declares for a screen - so an application that has picked the default blueprint can
|
|
18
|
+
* drop any of these in without arranging anything.
|
|
19
|
+
*
|
|
20
|
+
* What makes them worth shipping is what is *already wired*. A list page is not "a table in a slot"; it is
|
|
21
|
+
* a query name, a set of columns, an empty message, a data key, a filter field list, a header that states
|
|
22
|
+
* what the page is bound to, and an action bar. Every one of those is a decision, and repeating all seven
|
|
23
|
+
* per screen is how a list page ends up subtly different on every screen of an application.
|
|
24
|
+
*/ /**
|
|
25
|
+
* The archetype: a `dataPage` filling the body, under a header that says what it is bound to.
|
|
26
|
+
*
|
|
27
|
+
* `dataPage` is the single highest-leverage name `Cratis.Components` exposes - the library's whole
|
|
28
|
+
* list-screen composite, with its title bar, menubar, filterable table and optional details pane driven
|
|
29
|
+
* from one query. Building the same thing out of a `table` and a `toolbar` in a screen is pages of
|
|
30
|
+
* modeling for a worse result, and this template is the answer to that: an application supplies a query
|
|
31
|
+
* name and has a working list page.
|
|
32
|
+
*/ const dataListPageTemplate = {
|
|
33
|
+
name: 'DataListPage',
|
|
34
|
+
fitsSlot: scene_blueprint_default.SlotName.Content,
|
|
35
|
+
slots: [
|
|
36
|
+
{
|
|
37
|
+
name: scene_blueprint_default.TemplateSlotName.Header
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: scene_blueprint_default.TemplateSlotName.Body
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
content: {
|
|
44
|
+
[scene_blueprint_default.TemplateSlotName.Header]: [
|
|
45
|
+
elements.arcPageHeader('data-list-header', {
|
|
46
|
+
title: 'Invoices',
|
|
47
|
+
subtitle: 'Every invoice, filterable and paged against the server',
|
|
48
|
+
section: 'Billing',
|
|
49
|
+
query: SampleBindingName.SampleBindingName.AllInvoices
|
|
50
|
+
}, [
|
|
51
|
+
elements.toolbar('data-list-actions', [
|
|
52
|
+
elements.toolbarButton('data-list-new', 'Register an invoice', 'pi pi-plus', 'New'),
|
|
53
|
+
elements.toolbarButton('data-list-refresh', 'Refresh', 'pi pi-refresh'),
|
|
54
|
+
elements.toolbarSeparator('data-list-separator'),
|
|
55
|
+
elements.toolbarGroup('data-list-export', [
|
|
56
|
+
elements.toolbarButton('data-list-download', 'Download as CSV', 'pi pi-download'),
|
|
57
|
+
elements.toolbarButton('data-list-print', 'Print', 'pi pi-print')
|
|
58
|
+
])
|
|
59
|
+
])
|
|
60
|
+
])
|
|
61
|
+
],
|
|
62
|
+
[scene_blueprint_default.TemplateSlotName.Body]: [
|
|
63
|
+
dataElements.dataPage('data-list-body', SampleBindingName.SampleBindingName.AllInvoices, dataElements.invoiceTableOptions, dataElements.invoiceColumns)
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
displayName: 'Data list page',
|
|
67
|
+
description: 'A dataPage bound to one query, under a header that states the binding - the whole list screen in two elements.'
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* The live variant: the same page shape over an observable query.
|
|
71
|
+
*
|
|
72
|
+
* A separate template rather than a flag, for the same reason `observableDataTable` is a separate name
|
|
73
|
+
* from `dataTable`: the difference lives in the *proxy* a host registers, not in how the page is
|
|
74
|
+
* configured. An observable query opens a subscription and the page re-renders when the read model
|
|
75
|
+
* changes on the server. Choosing this template is an application saying its data is live, and that is a
|
|
76
|
+
* decision worth being able to read off the screen rather than infer from a property.
|
|
77
|
+
*/ const observableDataListPageTemplate = {
|
|
78
|
+
name: 'ObservableDataListPage',
|
|
79
|
+
fitsSlot: scene_blueprint_default.SlotName.Content,
|
|
80
|
+
slots: [
|
|
81
|
+
{
|
|
82
|
+
name: scene_blueprint_default.TemplateSlotName.Header
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: scene_blueprint_default.TemplateSlotName.Body
|
|
86
|
+
}
|
|
87
|
+
],
|
|
88
|
+
content: {
|
|
89
|
+
[scene_blueprint_default.TemplateSlotName.Header]: [
|
|
90
|
+
elements.arcPageHeader('observable-list-header', {
|
|
91
|
+
title: 'Invoices in flight',
|
|
92
|
+
subtitle: 'Updates as the read model changes - no refresh button, because there is nothing to refresh',
|
|
93
|
+
section: 'Billing',
|
|
94
|
+
query: SampleBindingName.SampleBindingName.InvoicesInFlight
|
|
95
|
+
})
|
|
96
|
+
],
|
|
97
|
+
[scene_blueprint_default.TemplateSlotName.Body]: [
|
|
98
|
+
elements.page('observable-list-body', 'In flight', [
|
|
99
|
+
dataElements.observableDataTable('observable-list-table', SampleBindingName.SampleBindingName.InvoicesInFlight, dataElements.invoiceTableOptions, dataElements.invoiceColumns)
|
|
100
|
+
])
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
displayName: 'Observable data list page',
|
|
104
|
+
description: 'A live list over an observable query, which re-renders when the read model changes on the server.'
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* List plus detail: the whole list screen, with the selected record's document and history beside it.
|
|
108
|
+
*
|
|
109
|
+
* The detail region is built from the library's Arc-free editors, which is the interesting part. They read
|
|
110
|
+
* their content out of the property bag rather than from a query, so this half of the page renders fully
|
|
111
|
+
* at design time while the list half is still a placeholder - and in an event-sourced application the
|
|
112
|
+
* record's *history* is as natural a thing to show as its current values, which is why the time machine is
|
|
113
|
+
* here rather than in some optional extra.
|
|
114
|
+
*
|
|
115
|
+
* Its arrangement drops the detail column below the list at a compact width, because a document editor and
|
|
116
|
+
* a paged table side by side on a phone are two unreadable slivers.
|
|
117
|
+
*/ const dataListWithDetailPageTemplate = {
|
|
118
|
+
name: 'DataListWithDetailPage',
|
|
119
|
+
fitsSlot: scene_blueprint_default.SlotName.Content,
|
|
120
|
+
slots: [
|
|
121
|
+
{
|
|
122
|
+
name: scene_blueprint_default.TemplateSlotName.Header
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: scene_blueprint_default.TemplateSlotName.Body
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: scene_blueprint_default.TemplateSlotName.SidePanel
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
arrangement: {
|
|
132
|
+
root: scene_blueprint_default.column([
|
|
133
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Header),
|
|
134
|
+
scene_blueprint_default.row([
|
|
135
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Body, {
|
|
136
|
+
grow: 2
|
|
137
|
+
}),
|
|
138
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.SidePanel, {
|
|
139
|
+
grow: 1
|
|
140
|
+
})
|
|
141
|
+
], 16)
|
|
142
|
+
]),
|
|
143
|
+
overrides: [
|
|
144
|
+
{
|
|
145
|
+
width: scene_model.WidthSizeClass.Compact,
|
|
146
|
+
root: scene_blueprint_default.column([
|
|
147
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Header),
|
|
148
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.Body),
|
|
149
|
+
scene_blueprint_default.slotLeaf(scene_blueprint_default.TemplateSlotName.SidePanel)
|
|
150
|
+
], 16)
|
|
151
|
+
}
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
content: {
|
|
155
|
+
[scene_blueprint_default.TemplateSlotName.Header]: [
|
|
156
|
+
elements.arcPageHeader('list-detail-header', {
|
|
157
|
+
title: 'Invoices',
|
|
158
|
+
subtitle: 'The list, with the selected invoice beside it',
|
|
159
|
+
section: 'Billing',
|
|
160
|
+
query: SampleBindingName.SampleBindingName.AllInvoices
|
|
161
|
+
})
|
|
162
|
+
],
|
|
163
|
+
[scene_blueprint_default.TemplateSlotName.Body]: [
|
|
164
|
+
dataElements.dataPage('list-detail-body', SampleBindingName.SampleBindingName.AllInvoices, dataElements.invoiceTableOptions, dataElements.invoiceColumns)
|
|
165
|
+
],
|
|
166
|
+
[scene_blueprint_default.TemplateSlotName.SidePanel]: [
|
|
167
|
+
elements.page('list-detail-panel', 'Selected invoice', [
|
|
168
|
+
editorElements.objectNavigationalBar('list-detail-trail'),
|
|
169
|
+
editorElements.objectContentEditor('list-detail-document', false),
|
|
170
|
+
editorElements.timeMachine('list-detail-history')
|
|
171
|
+
])
|
|
172
|
+
]
|
|
173
|
+
},
|
|
174
|
+
displayName: 'Data list with detail page',
|
|
175
|
+
description: 'A dataPage beside a detail region showing the selected record document and its history.'
|
|
176
|
+
};
|
|
177
|
+
/** The three list-shaped templates. */ const listTemplates = [
|
|
178
|
+
dataListPageTemplate,
|
|
179
|
+
observableDataListPageTemplate,
|
|
180
|
+
dataListWithDetailPageTemplate
|
|
181
|
+
];
|
|
182
|
+
|
|
183
|
+
exports.dataListPageTemplate = dataListPageTemplate;
|
|
184
|
+
exports.dataListWithDetailPageTemplate = dataListWithDetailPageTemplate;
|
|
185
|
+
exports.listTemplates = listTemplates;
|
|
186
|
+
exports.observableDataListPageTemplate = observableDataListPageTemplate;
|
|
187
|
+
//# sourceMappingURL=listTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listTemplates.js","sources":["../../../templates/listTemplates.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ScreenTemplate, WidthSizeClass } from '@cratis/scene.model';\nimport { SlotName, TemplateSlotName, column, row, slotLeaf } from '@cratis/scene.blueprint.default';\nimport { dataPage, invoiceColumns, invoiceTableOptions, observableDataTable } from './dataElements';\nimport { objectContentEditor, objectNavigationalBar, timeMachine } from './editorElements';\nimport { arcPageHeader, page, toolbar, toolbarButton, toolbarGroup, toolbarSeparator } from './elements';\nimport { SampleBindingName } from './SampleBindingName';\n\n/**\n * The three list shapes an Arc application repeats: a list, a live list, and a list with the selected\n * record beside it.\n *\n * All three fill the application shell's `content` slot, which is the only slot the default blueprint's\n * `AppShell` layout declares for a screen - so an application that has picked the default blueprint can\n * drop any of these in without arranging anything.\n *\n * What makes them worth shipping is what is *already wired*. A list page is not \"a table in a slot\"; it is\n * a query name, a set of columns, an empty message, a data key, a filter field list, a header that states\n * what the page is bound to, and an action bar. Every one of those is a decision, and repeating all seven\n * per screen is how a list page ends up subtly different on every screen of an application.\n */\n\n/**\n * The archetype: a `dataPage` filling the body, under a header that says what it is bound to.\n *\n * `dataPage` is the single highest-leverage name `Cratis.Components` exposes - the library's whole\n * list-screen composite, with its title bar, menubar, filterable table and optional details pane driven\n * from one query. Building the same thing out of a `table` and a `toolbar` in a screen is pages of\n * modeling for a worse result, and this template is the answer to that: an application supplies a query\n * name and has a working list page.\n */\nexport const dataListPageTemplate: ScreenTemplate = {\n name: 'DataListPage',\n fitsSlot: SlotName.Content,\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }],\n content: {\n [TemplateSlotName.Header]: [\n arcPageHeader(\n 'data-list-header',\n { title: 'Invoices', subtitle: 'Every invoice, filterable and paged against the server', section: 'Billing', query: SampleBindingName.AllInvoices },\n [\n toolbar('data-list-actions', [\n toolbarButton('data-list-new', 'Register an invoice', 'pi pi-plus', 'New'),\n toolbarButton('data-list-refresh', 'Refresh', 'pi pi-refresh'),\n toolbarSeparator('data-list-separator'),\n toolbarGroup('data-list-export', [\n toolbarButton('data-list-download', 'Download as CSV', 'pi pi-download'),\n toolbarButton('data-list-print', 'Print', 'pi pi-print'),\n ]),\n ]),\n ],\n ),\n ],\n [TemplateSlotName.Body]: [dataPage('data-list-body', SampleBindingName.AllInvoices, invoiceTableOptions, invoiceColumns)],\n },\n displayName: 'Data list page',\n description: 'A dataPage bound to one query, under a header that states the binding - the whole list screen in two elements.',\n};\n\n/**\n * The live variant: the same page shape over an observable query.\n *\n * A separate template rather than a flag, for the same reason `observableDataTable` is a separate name\n * from `dataTable`: the difference lives in the *proxy* a host registers, not in how the page is\n * configured. An observable query opens a subscription and the page re-renders when the read model\n * changes on the server. Choosing this template is an application saying its data is live, and that is a\n * decision worth being able to read off the screen rather than infer from a property.\n */\nexport const observableDataListPageTemplate: ScreenTemplate = {\n name: 'ObservableDataListPage',\n fitsSlot: SlotName.Content,\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }],\n content: {\n [TemplateSlotName.Header]: [\n arcPageHeader('observable-list-header', {\n title: 'Invoices in flight',\n subtitle: 'Updates as the read model changes - no refresh button, because there is nothing to refresh',\n section: 'Billing',\n query: SampleBindingName.InvoicesInFlight,\n }),\n ],\n [TemplateSlotName.Body]: [\n page('observable-list-body', 'In flight', [\n observableDataTable('observable-list-table', SampleBindingName.InvoicesInFlight, invoiceTableOptions, invoiceColumns),\n ]),\n ],\n },\n displayName: 'Observable data list page',\n description: 'A live list over an observable query, which re-renders when the read model changes on the server.',\n};\n\n/**\n * List plus detail: the whole list screen, with the selected record's document and history beside it.\n *\n * The detail region is built from the library's Arc-free editors, which is the interesting part. They read\n * their content out of the property bag rather than from a query, so this half of the page renders fully\n * at design time while the list half is still a placeholder - and in an event-sourced application the\n * record's *history* is as natural a thing to show as its current values, which is why the time machine is\n * here rather than in some optional extra.\n *\n * Its arrangement drops the detail column below the list at a compact width, because a document editor and\n * a paged table side by side on a phone are two unreadable slivers.\n */\nexport const dataListWithDetailPageTemplate: ScreenTemplate = {\n name: 'DataListWithDetailPage',\n fitsSlot: SlotName.Content,\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.SidePanel }],\n arrangement: {\n root: column([slotLeaf(TemplateSlotName.Header), row([slotLeaf(TemplateSlotName.Body, { grow: 2 }), slotLeaf(TemplateSlotName.SidePanel, { grow: 1 })], 16)]),\n overrides: [\n {\n width: WidthSizeClass.Compact,\n root: column([slotLeaf(TemplateSlotName.Header), slotLeaf(TemplateSlotName.Body), slotLeaf(TemplateSlotName.SidePanel)], 16),\n },\n ],\n },\n content: {\n [TemplateSlotName.Header]: [\n arcPageHeader('list-detail-header', {\n title: 'Invoices',\n subtitle: 'The list, with the selected invoice beside it',\n section: 'Billing',\n query: SampleBindingName.AllInvoices,\n }),\n ],\n [TemplateSlotName.Body]: [dataPage('list-detail-body', SampleBindingName.AllInvoices, invoiceTableOptions, invoiceColumns)],\n [TemplateSlotName.SidePanel]: [\n page('list-detail-panel', 'Selected invoice', [\n objectNavigationalBar('list-detail-trail'),\n objectContentEditor('list-detail-document', false),\n timeMachine('list-detail-history'),\n ]),\n ],\n },\n displayName: 'Data list with detail page',\n description: 'A dataPage beside a detail region showing the selected record document and its history.',\n};\n\n/** The three list-shaped templates. */\nexport const listTemplates: ScreenTemplate[] = [dataListPageTemplate, observableDataListPageTemplate, dataListWithDetailPageTemplate];\n"],"names":["dataListPageTemplate","name","fitsSlot","SlotName","Content","slots","TemplateSlotName","Header","Body","content","arcPageHeader","title","subtitle","section","query","SampleBindingName","AllInvoices","toolbar","toolbarButton","toolbarSeparator","toolbarGroup","dataPage","invoiceTableOptions","invoiceColumns","displayName","description","observableDataListPageTemplate","InvoicesInFlight","page","observableDataTable","dataListWithDetailPageTemplate","SidePanel","arrangement","root","column","slotLeaf","row","grow","overrides","width","WidthSizeClass","Compact","objectNavigationalBar","objectContentEditor","timeMachine","listTemplates"],"mappings":";;;;;;;;;AAAA;AACA;AASA;;;;;;;;;;;;;;;;;;;;UAuBaA,oBAAAA,GAAuC;IAChDC,IAAAA,EAAM,cAAA;AACNC,IAAAA,QAAAA,EAAUC,iCAASC,OAAO;IAC1BC,KAAAA,EAAO;AAAC,QAAA;AAAEJ,YAAAA,IAAAA,EAAMK,yCAAiBC;AAAO,SAAA;AAAG,QAAA;AAAEN,YAAAA,IAAAA,EAAMK,yCAAiBE;AAAK;AAAE,KAAA;IAC3EC,OAAAA,EAAS;QACL,CAACH,wCAAAA,CAAiBC,MAAM,GAAG;AACvBG,YAAAA,sBAAAA,CACI,kBAAA,EACA;gBAAEC,KAAAA,EAAO,UAAA;gBAAYC,QAAAA,EAAU,wDAAA;gBAA0DC,OAAAA,EAAS,SAAA;AAAWC,gBAAAA,KAAAA,EAAOC,oCAAkBC;aAAY,EAClJ;AACIC,gBAAAA,gBAAAA,CAAQ,mBAAA,EAAqB;oBACzBC,sBAAAA,CAAc,eAAA,EAAiB,uBAAuB,YAAA,EAAc,KAAA,CAAA;AACpEA,oBAAAA,sBAAAA,CAAc,qBAAqB,SAAA,EAAW,eAAA,CAAA;oBAC9CC,yBAAAA,CAAiB,qBAAA,CAAA;AACjBC,oBAAAA,qBAAAA,CAAa,kBAAA,EAAoB;AAC7BF,wBAAAA,sBAAAA,CAAc,sBAAsB,iBAAA,EAAmB,gBAAA,CAAA;AACvDA,wBAAAA,sBAAAA,CAAc,mBAAmB,OAAA,EAAS,aAAA;AAC7C,qBAAA;AACJ,iBAAA;AACJ,aAAA;AAER,SAAA;QACD,CAACZ,wCAAA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qB,kBAAA,EAAoB;gBAC1Cc,oCAAAA,CAAsB,mBAAA,CAAA;AACtBC,gBAAAA,kCAAAA,CAAoB,sBAAA,EAAwB,KAAA,CAAA;gBAC5CC,0BAAAA,CAAY,qBAAA;AACf,aAAA;AACJ;AACL,KAAA;IACApB,WAAAA,EAAa,4BAAA;IACbC,WAAAA,EAAa;AACjB;AAEA,wCACO,MAAMoB,aAAAA,GAAkC;AAAC7C,IAAAA,oBAAAA;AAAsB0B,IAAAA,8BAAAA;AAAgCI,IAAAA;;;;;;;;"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var scene_blueprint_default = require('@cratis/scene.blueprint.default');
|
|
4
|
+
var dataElements = require('./dataElements.js');
|
|
5
|
+
var editorElements = require('./editorElements.js');
|
|
6
|
+
var elements = require('./elements.js');
|
|
7
|
+
var SampleBindingName = require('./SampleBindingName.js');
|
|
8
|
+
|
|
9
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
10
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
11
|
+
/**
|
|
12
|
+
* A worked three-level chain, from the application layout down to one behavior.
|
|
13
|
+
*
|
|
14
|
+
* The nesting rule is one rule applied at every depth: a template names, in `fitsSlot`, a slot declared by
|
|
15
|
+
* whatever contains it. A module's template fits the application layout's `content`; a feature's fits a
|
|
16
|
+
* slot the module's declares; a slice's fits one the feature's declares. Nothing here is a special case
|
|
17
|
+
* for a particular level, which is exactly why the hierarchy can be arbitrarily deep with no second
|
|
18
|
+
* mechanism.
|
|
19
|
+
*
|
|
20
|
+
* The slot names are chosen so that each fitted name is declared by exactly one container in the chain -
|
|
21
|
+
* `body` only by the module, `primary` only by the feature. That is not decoration: `resolveScreenTemplates`
|
|
22
|
+
* places a template only when the containers in scope agree on exactly one home for it, and reports it as
|
|
23
|
+
* unplaced rather than guessing when two of them declare the same name. A chain that reused `body` at
|
|
24
|
+
* three levels would read fine and resolve to nothing.
|
|
25
|
+
*
|
|
26
|
+
* The whole chain is Arc-bound, which is the point of it living in *this* blueprint rather than being a
|
|
27
|
+
* second copy of the default one's. It ends where a Cratis slice really ends: a button that summons the
|
|
28
|
+
* command dialog.
|
|
29
|
+
*/ /**
|
|
30
|
+
* Module level: fits the application shell's `content` slot.
|
|
31
|
+
*
|
|
32
|
+
* A module always has a name and a description, so it brings its own header, and it offers a body for the
|
|
33
|
+
* feature inside it plus a side panel for the filters that apply across the whole module.
|
|
34
|
+
*/ const dataModulePageTemplate = {
|
|
35
|
+
name: 'DataModulePage',
|
|
36
|
+
fitsSlot: scene_blueprint_default.SlotName.Content,
|
|
37
|
+
slots: [
|
|
38
|
+
{
|
|
39
|
+
name: scene_blueprint_default.TemplateSlotName.Header
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: scene_blueprint_default.TemplateSlotName.Body
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: scene_blueprint_default.TemplateSlotName.SidePanel
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
content: {
|
|
49
|
+
[scene_blueprint_default.TemplateSlotName.Header]: [
|
|
50
|
+
elements.arcPageHeader('module-header', {
|
|
51
|
+
title: 'Billing',
|
|
52
|
+
subtitle: 'Everything the billing module owns',
|
|
53
|
+
section: 'Operations'
|
|
54
|
+
})
|
|
55
|
+
],
|
|
56
|
+
[scene_blueprint_default.TemplateSlotName.SidePanel]: [
|
|
57
|
+
elements.page('module-filters', 'Filters', [
|
|
58
|
+
editorElements.filterPanel('module-filter-panel', 'Filter the module')
|
|
59
|
+
])
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
displayName: 'Data module page',
|
|
63
|
+
description: 'Module level: fits the application layout content slot and offers a body for one feature.'
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Feature level: fits the module page's `body` slot.
|
|
67
|
+
*
|
|
68
|
+
* A feature is where actions belong - a module is a grouping and a slice is one behavior, and the feature
|
|
69
|
+
* in between is what a user thinks of as "the screen with the buttons on it". It offers a primary region
|
|
70
|
+
* for the slice and a secondary one for the live view of what that slice is doing.
|
|
71
|
+
*/ const dataFeatureSectionTemplate = {
|
|
72
|
+
name: 'DataFeatureSection',
|
|
73
|
+
fitsSlot: scene_blueprint_default.TemplateSlotName.Body,
|
|
74
|
+
slots: [
|
|
75
|
+
{
|
|
76
|
+
name: scene_blueprint_default.TemplateSlotName.Toolbar
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
name: scene_blueprint_default.TemplateSlotName.Primary
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: scene_blueprint_default.TemplateSlotName.Secondary
|
|
83
|
+
}
|
|
84
|
+
],
|
|
85
|
+
content: {
|
|
86
|
+
[scene_blueprint_default.TemplateSlotName.Toolbar]: [
|
|
87
|
+
elements.toolbar('feature-toolbar', [
|
|
88
|
+
elements.toolbarButton('feature-new', 'Register an invoice', 'pi pi-plus', 'New'),
|
|
89
|
+
elements.toolbarButton('feature-adjust', 'Record an adjustment', 'pi pi-pencil', 'Adjust'),
|
|
90
|
+
elements.toolbarSeparator('feature-separator'),
|
|
91
|
+
elements.toolbarButton('feature-export', 'Export the feature data', 'pi pi-download')
|
|
92
|
+
])
|
|
93
|
+
],
|
|
94
|
+
[scene_blueprint_default.TemplateSlotName.Secondary]: [
|
|
95
|
+
elements.page('feature-live', 'In flight', [
|
|
96
|
+
dataElements.observableDataTable('feature-live-table', SampleBindingName.SampleBindingName.InvoicesInFlight, dataElements.invoiceTableOptions, dataElements.invoiceColumns)
|
|
97
|
+
])
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
displayName: 'Data feature section',
|
|
101
|
+
description: 'Feature level: fits a module page body slot, brings the action toolbar and a live view.'
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Slice level: fits the feature section's `primary` slot.
|
|
105
|
+
*
|
|
106
|
+
* The end of the chain, and deliberately the thinnest thing in it. A slice is one behavior, and in a
|
|
107
|
+
* Cratis application that behavior is one command - so its surface is a header saying what the command is
|
|
108
|
+
* and whether it is wired, and the action that summons it. The capture itself happens in the `CommandDialog`
|
|
109
|
+
* dialog template, which is why this template has no form on it and does not need one.
|
|
110
|
+
*/ const commandSliceSectionTemplate = {
|
|
111
|
+
name: 'CommandSliceSection',
|
|
112
|
+
fitsSlot: scene_blueprint_default.TemplateSlotName.Primary,
|
|
113
|
+
slots: [
|
|
114
|
+
{
|
|
115
|
+
name: scene_blueprint_default.TemplateSlotName.Header
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: scene_blueprint_default.TemplateSlotName.Actions
|
|
119
|
+
}
|
|
120
|
+
],
|
|
121
|
+
content: {
|
|
122
|
+
[scene_blueprint_default.TemplateSlotName.Header]: [
|
|
123
|
+
elements.arcPageHeader('slice-header', {
|
|
124
|
+
title: 'Record an adjustment',
|
|
125
|
+
subtitle: 'One behavior, one command, one button',
|
|
126
|
+
section: 'Adjustments',
|
|
127
|
+
command: SampleBindingName.SampleBindingName.RecordAdjustment
|
|
128
|
+
})
|
|
129
|
+
],
|
|
130
|
+
[scene_blueprint_default.TemplateSlotName.Actions]: [
|
|
131
|
+
elements.toolbar('slice-actions', [
|
|
132
|
+
elements.toolbarButton('slice-record', 'Record an adjustment', 'pi pi-check', 'Record'),
|
|
133
|
+
elements.toolbarButton('slice-cancel', 'Leave the invoice as it is', 'pi pi-times', 'Cancel')
|
|
134
|
+
])
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
displayName: 'Command slice section',
|
|
138
|
+
description: 'Slice level: fits a feature section primary slot and hosts one command behavior.'
|
|
139
|
+
};
|
|
140
|
+
/** The chain, outermost first - what a spec walks to prove `fitsSlot` resolves at every level. */ const nestingChainTemplates = [
|
|
141
|
+
dataModulePageTemplate,
|
|
142
|
+
dataFeatureSectionTemplate,
|
|
143
|
+
commandSliceSectionTemplate
|
|
144
|
+
];
|
|
145
|
+
|
|
146
|
+
exports.commandSliceSectionTemplate = commandSliceSectionTemplate;
|
|
147
|
+
exports.dataFeatureSectionTemplate = dataFeatureSectionTemplate;
|
|
148
|
+
exports.dataModulePageTemplate = dataModulePageTemplate;
|
|
149
|
+
exports.nestingChainTemplates = nestingChainTemplates;
|
|
150
|
+
//# sourceMappingURL=nesting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nesting.js","sources":["../../../templates/nesting.ts"],"sourcesContent":["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ScreenTemplate } from '@cratis/scene.model';\nimport { SlotName, TemplateSlotName } from '@cratis/scene.blueprint.default';\nimport { invoiceColumns, invoiceTableOptions, observableDataTable } from './dataElements';\nimport { filterPanel } from './editorElements';\nimport { arcPageHeader, page, toolbar, toolbarButton, toolbarSeparator } from './elements';\nimport { SampleBindingName } from './SampleBindingName';\n\n/**\n * A worked three-level chain, from the application layout down to one behavior.\n *\n * The nesting rule is one rule applied at every depth: a template names, in `fitsSlot`, a slot declared by\n * whatever contains it. A module's template fits the application layout's `content`; a feature's fits a\n * slot the module's declares; a slice's fits one the feature's declares. Nothing here is a special case\n * for a particular level, which is exactly why the hierarchy can be arbitrarily deep with no second\n * mechanism.\n *\n * The slot names are chosen so that each fitted name is declared by exactly one container in the chain -\n * `body` only by the module, `primary` only by the feature. That is not decoration: `resolveScreenTemplates`\n * places a template only when the containers in scope agree on exactly one home for it, and reports it as\n * unplaced rather than guessing when two of them declare the same name. A chain that reused `body` at\n * three levels would read fine and resolve to nothing.\n *\n * The whole chain is Arc-bound, which is the point of it living in *this* blueprint rather than being a\n * second copy of the default one's. It ends where a Cratis slice really ends: a button that summons the\n * command dialog.\n */\n\n/**\n * Module level: fits the application shell's `content` slot.\n *\n * A module always has a name and a description, so it brings its own header, and it offers a body for the\n * feature inside it plus a side panel for the filters that apply across the whole module.\n */\nexport const dataModulePageTemplate: ScreenTemplate = {\n name: 'DataModulePage',\n fitsSlot: SlotName.Content,\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Body }, { name: TemplateSlotName.SidePanel }],\n content: {\n [TemplateSlotName.Header]: [\n arcPageHeader('module-header', {\n title: 'Billing',\n subtitle: 'Everything the billing module owns',\n section: 'Operations',\n }),\n ],\n [TemplateSlotName.SidePanel]: [page('module-filters', 'Filters', [filterPanel('module-filter-panel', 'Filter the module')])],\n },\n displayName: 'Data module page',\n description: 'Module level: fits the application layout content slot and offers a body for one feature.',\n};\n\n/**\n * Feature level: fits the module page's `body` slot.\n *\n * A feature is where actions belong - a module is a grouping and a slice is one behavior, and the feature\n * in between is what a user thinks of as \"the screen with the buttons on it\". It offers a primary region\n * for the slice and a secondary one for the live view of what that slice is doing.\n */\nexport const dataFeatureSectionTemplate: ScreenTemplate = {\n name: 'DataFeatureSection',\n fitsSlot: TemplateSlotName.Body,\n slots: [{ name: TemplateSlotName.Toolbar }, { name: TemplateSlotName.Primary }, { name: TemplateSlotName.Secondary }],\n content: {\n [TemplateSlotName.Toolbar]: [\n toolbar('feature-toolbar', [\n toolbarButton('feature-new', 'Register an invoice', 'pi pi-plus', 'New'),\n toolbarButton('feature-adjust', 'Record an adjustment', 'pi pi-pencil', 'Adjust'),\n toolbarSeparator('feature-separator'),\n toolbarButton('feature-export', 'Export the feature data', 'pi pi-download'),\n ]),\n ],\n [TemplateSlotName.Secondary]: [\n page('feature-live', 'In flight', [\n observableDataTable('feature-live-table', SampleBindingName.InvoicesInFlight, invoiceTableOptions, invoiceColumns),\n ]),\n ],\n },\n displayName: 'Data feature section',\n description: 'Feature level: fits a module page body slot, brings the action toolbar and a live view.',\n};\n\n/**\n * Slice level: fits the feature section's `primary` slot.\n *\n * The end of the chain, and deliberately the thinnest thing in it. A slice is one behavior, and in a\n * Cratis application that behavior is one command - so its surface is a header saying what the command is\n * and whether it is wired, and the action that summons it. The capture itself happens in the `CommandDialog`\n * dialog template, which is why this template has no form on it and does not need one.\n */\nexport const commandSliceSectionTemplate: ScreenTemplate = {\n name: 'CommandSliceSection',\n fitsSlot: TemplateSlotName.Primary,\n slots: [{ name: TemplateSlotName.Header }, { name: TemplateSlotName.Actions }],\n content: {\n [TemplateSlotName.Header]: [\n arcPageHeader('slice-header', {\n title: 'Record an adjustment',\n subtitle: 'One behavior, one command, one button',\n section: 'Adjustments',\n command: SampleBindingName.RecordAdjustment,\n }),\n ],\n [TemplateSlotName.Actions]: [\n toolbar('slice-actions', [\n toolbarButton('slice-record', 'Record an adjustment', 'pi pi-check', 'Record'),\n toolbarButton('slice-cancel', 'Leave the invoice as it is', 'pi pi-times', 'Cancel'),\n ]),\n ],\n },\n displayName: 'Command slice section',\n description: 'Slice level: fits a feature section primary slot and hosts one command behavior.',\n};\n\n/** The chain, outermost first - what a spec walks to prove `fitsSlot` resolves at every level. */\nexport const nestingChainTemplates: ScreenTemplate[] = [dataModulePageTemplate, dataFeatureSectionTemplate, commandSliceSectionTemplate];\n"],"names":["dataModulePageTemplate","name","fitsSlot","SlotName","Content","slots","TemplateSlotName","Header","Body","SidePanel","content","arcPageHeader","title","subtitle","section","page","filterPanel","displayName","description","dataFeatureSectionTemplate","Toolbar","Primary","Secondary","toolbar","toolbarButton","toolbarSeparator","observableDataTable","SampleBindingName","InvoicesInFlight","invoiceTableOptions","invoiceColumns","commandSliceSectionTemplate","Actions","command","RecordAdjustment","nestingChainTemplates"],"mappings":";;;;;;;;AAAA;AACA;AASA;;;;;;;;;;;;;;;;;;;;;;;UA0BaA,sBAAAA,GAAyC;IAClDC,IAAAA,EAAM,gBAAA;AACNC,IAAAA,QAAAA,EAAUC,iCAASC,OAAO;IAC1BC,KAAAA,EAAO;AAAC,QAAA;AAAEJ,YAAAA,IAAAA,EAAMK,yCAAiBC;AAAO,SAAA;AAAG,QAAA;AAAEN,YAAAA,IAAAA,EAAMK,yCAAiBE;AAAK,SAAA;AAAG,QAAA;AAAEP,YAAAA,IAAAA,EAAMK,yCAAiBG;AAAU;AAAE,KAAA;IACjHC,OAAAA,EAAS;QACL,CAAC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