@cratis/scene.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 +55 -0
- package/.storybook/preview.tsx +36 -0
- package/CratisComponents.stories.tsx +235 -0
- package/README.md +192 -0
- package/bindings/ArcRuntimeBoundary.tsx +36 -0
- package/bindings/BindingKind.ts +18 -0
- package/bindings/BoundConstructor.ts +21 -0
- package/bindings/ElementBinding.ts +19 -0
- package/bindings/MissingBinding.tsx +34 -0
- package/bindings/Placeholder.tsx +42 -0
- package/bindings/bindingRegistry.ts +105 -0
- package/bindings/for_bindingRegistry/when_a_command_is_registered.ts +30 -0
- package/bindings/for_bindingRegistry/when_a_query_is_not_registered.ts +17 -0
- package/bindings/for_bindingRegistry/when_a_query_is_registered.ts +30 -0
- package/bindings/for_bindingRegistry/when_bindings_are_cleared.ts +29 -0
- package/bindings/for_resolveElementBinding/when_resolving_a_command_binding.ts +34 -0
- package/bindings/for_resolveElementBinding/when_resolving_a_query_binding.ts +45 -0
- package/bindings/index.ts +11 -0
- package/bindings/resolveElementBinding.ts +33 -0
- package/common/SceneDropdown.tsx +31 -0
- package/common/SceneErrorBoundary.tsx +17 -0
- package/common/SceneIcon.tsx +18 -0
- package/common/SceneTooltip.tsx +28 -0
- package/common/index.ts +7 -0
- package/cratisComponents.ts +91 -0
- package/cratisComponentsPackage.ts +101 -0
- package/data/SceneDataTable.tsx +41 -0
- package/data/SceneObservableDataTable.tsx +41 -0
- package/data/for_SceneDataTable/when_the_query_binding_is_missing.tsx +48 -0
- package/data/index.ts +5 -0
- package/dialogs/SceneBusyIndicatorDialog.tsx +29 -0
- package/dialogs/SceneCommandDialog.tsx +42 -0
- package/dialogs/SceneConfirmationDialog.tsx +23 -0
- package/dialogs/SceneDialog.tsx +41 -0
- package/dialogs/SceneStepperCommandDialog.tsx +50 -0
- package/dialogs/index.ts +8 -0
- package/dist/cjs/bindings/ArcRuntimeBoundary.js +37 -0
- package/dist/cjs/bindings/ArcRuntimeBoundary.js.map +1 -0
- package/dist/cjs/bindings/BindingKind.js +19 -0
- package/dist/cjs/bindings/BindingKind.js.map +1 -0
- package/dist/cjs/bindings/MissingBinding.js +24 -0
- package/dist/cjs/bindings/MissingBinding.js.map +1 -0
- package/dist/cjs/bindings/Placeholder.js +38 -0
- package/dist/cjs/bindings/Placeholder.js.map +1 -0
- package/dist/cjs/bindings/bindingRegistry.js +101 -0
- package/dist/cjs/bindings/bindingRegistry.js.map +1 -0
- package/dist/cjs/bindings/resolveElementBinding.js +34 -0
- package/dist/cjs/bindings/resolveElementBinding.js.map +1 -0
- package/dist/cjs/common/SceneDropdown.js +30 -0
- package/dist/cjs/common/SceneDropdown.js.map +1 -0
- package/dist/cjs/common/SceneErrorBoundary.js +20 -0
- package/dist/cjs/common/SceneErrorBoundary.js.map +1 -0
- package/dist/cjs/common/SceneIcon.js +22 -0
- package/dist/cjs/common/SceneIcon.js.map +1 -0
- package/dist/cjs/common/SceneTooltip.js +29 -0
- package/dist/cjs/common/SceneTooltip.js.map +1 -0
- package/dist/cjs/cratisComponents.js +106 -0
- package/dist/cjs/cratisComponents.js.map +1 -0
- package/dist/cjs/cratisComponentsPackage.js +105 -0
- package/dist/cjs/cratisComponentsPackage.js.map +1 -0
- package/dist/cjs/data/SceneDataTable.js +46 -0
- package/dist/cjs/data/SceneDataTable.js.map +1 -0
- package/dist/cjs/data/SceneObservableDataTable.js +44 -0
- package/dist/cjs/data/SceneObservableDataTable.js.map +1 -0
- package/dist/cjs/dialogs/SceneBusyIndicatorDialog.js +30 -0
- package/dist/cjs/dialogs/SceneBusyIndicatorDialog.js.map +1 -0
- package/dist/cjs/dialogs/SceneCommandDialog.js +47 -0
- package/dist/cjs/dialogs/SceneCommandDialog.js.map +1 -0
- package/dist/cjs/dialogs/SceneConfirmationDialog.js +25 -0
- package/dist/cjs/dialogs/SceneConfirmationDialog.js.map +1 -0
- package/dist/cjs/dialogs/SceneDialog.js +41 -0
- package/dist/cjs/dialogs/SceneDialog.js.map +1 -0
- package/dist/cjs/dialogs/SceneStepperCommandDialog.js +54 -0
- package/dist/cjs/dialogs/SceneStepperCommandDialog.js.map +1 -0
- package/dist/cjs/editors/SceneFilterPanel.js +57 -0
- package/dist/cjs/editors/SceneFilterPanel.js.map +1 -0
- package/dist/cjs/editors/SceneObjectContentEditor.js +37 -0
- package/dist/cjs/editors/SceneObjectContentEditor.js.map +1 -0
- package/dist/cjs/editors/SceneObjectNavigationalBar.js +34 -0
- package/dist/cjs/editors/SceneObjectNavigationalBar.js.map +1 -0
- package/dist/cjs/editors/SceneSchemaEditor.js +33 -0
- package/dist/cjs/editors/SceneSchemaEditor.js.map +1 -0
- package/dist/cjs/editors/SceneTimeMachine.js +32 -0
- package/dist/cjs/editors/SceneTimeMachine.js.map +1 -0
- package/dist/cjs/editors/filterDefinitions.js +59 -0
- package/dist/cjs/editors/filterDefinitions.js.map +1 -0
- package/dist/cjs/editors/timeMachineVersions.js +44 -0
- package/dist/cjs/editors/timeMachineVersions.js.map +1 -0
- package/dist/cjs/editors/useEditableCopy.js +39 -0
- package/dist/cjs/editors/useEditableCopy.js.map +1 -0
- package/dist/cjs/forms/SceneCommandForm.js +46 -0
- package/dist/cjs/forms/SceneCommandForm.js.map +1 -0
- package/dist/cjs/forms/fields/CommandFormField.js +31 -0
- package/dist/cjs/forms/fields/CommandFormField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneCalendarField.js +41 -0
- package/dist/cjs/forms/fields/SceneCalendarField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneCheckboxField.js +28 -0
- package/dist/cjs/forms/fields/SceneCheckboxField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneChipsField.js +33 -0
- package/dist/cjs/forms/fields/SceneChipsField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneColorPickerField.js +30 -0
- package/dist/cjs/forms/fields/SceneColorPickerField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneDropdownField.js +35 -0
- package/dist/cjs/forms/fields/SceneDropdownField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneInputTextField.js +45 -0
- package/dist/cjs/forms/fields/SceneInputTextField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneMultiSelectField.js +40 -0
- package/dist/cjs/forms/fields/SceneMultiSelectField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneNumberField.js +32 -0
- package/dist/cjs/forms/fields/SceneNumberField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneRadioButtonField.js +35 -0
- package/dist/cjs/forms/fields/SceneRadioButtonField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneRadioGroupField.js +36 -0
- package/dist/cjs/forms/fields/SceneRadioGroupField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneSliderField.js +31 -0
- package/dist/cjs/forms/fields/SceneSliderField.js.map +1 -0
- package/dist/cjs/forms/fields/SceneTextAreaField.js +31 -0
- package/dist/cjs/forms/fields/SceneTextAreaField.js.map +1 -0
- package/dist/cjs/forms/fields/resolveFieldBinding.js +27 -0
- package/dist/cjs/forms/fields/resolveFieldBinding.js.map +1 -0
- package/dist/cjs/index.js +123 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/pages/SceneDataPage.js +45 -0
- package/dist/cjs/pages/SceneDataPage.js.map +1 -0
- package/dist/cjs/pages/SceneFormElement.js +26 -0
- package/dist/cjs/pages/SceneFormElement.js.map +1 -0
- package/dist/cjs/pages/ScenePage.js +28 -0
- package/dist/cjs/pages/ScenePage.js.map +1 -0
- package/dist/cjs/properties.js +104 -0
- package/dist/cjs/properties.js.map +1 -0
- package/dist/cjs/toolbar/SceneToolbar.js +27 -0
- package/dist/cjs/toolbar/SceneToolbar.js.map +1 -0
- package/dist/cjs/toolbar/SceneToolbarButton.js +32 -0
- package/dist/cjs/toolbar/SceneToolbarButton.js.map +1 -0
- package/dist/cjs/toolbar/SceneToolbarGroup.js +27 -0
- package/dist/cjs/toolbar/SceneToolbarGroup.js.map +1 -0
- package/dist/cjs/toolbar/SceneToolbarSeparator.js +25 -0
- package/dist/cjs/toolbar/SceneToolbarSeparator.js.map +1 -0
- package/dist/esm/CratisComponents.stories.d.ts +29 -0
- package/dist/esm/CratisComponents.stories.d.ts.map +1 -0
- package/dist/esm/CratisComponents.stories.js +187 -0
- package/dist/esm/CratisComponents.stories.js.map +1 -0
- package/dist/esm/bindings/ArcRuntimeBoundary.d.ts +6 -0
- package/dist/esm/bindings/ArcRuntimeBoundary.d.ts.map +1 -0
- package/dist/esm/bindings/ArcRuntimeBoundary.js +35 -0
- package/dist/esm/bindings/ArcRuntimeBoundary.js.map +1 -0
- package/dist/esm/bindings/BindingKind.d.ts +5 -0
- package/dist/esm/bindings/BindingKind.d.ts.map +1 -0
- package/dist/esm/bindings/BindingKind.js +17 -0
- package/dist/esm/bindings/BindingKind.js.map +1 -0
- package/dist/esm/bindings/BoundConstructor.d.ts +2 -0
- package/dist/esm/bindings/BoundConstructor.d.ts.map +1 -0
- package/dist/esm/bindings/BoundConstructor.js +2 -0
- package/dist/esm/bindings/BoundConstructor.js.map +1 -0
- package/dist/esm/bindings/ElementBinding.d.ts +6 -0
- package/dist/esm/bindings/ElementBinding.d.ts.map +1 -0
- package/dist/esm/bindings/ElementBinding.js +2 -0
- package/dist/esm/bindings/ElementBinding.js.map +1 -0
- package/dist/esm/bindings/MissingBinding.d.ts +9 -0
- package/dist/esm/bindings/MissingBinding.d.ts.map +1 -0
- package/dist/esm/bindings/MissingBinding.js +22 -0
- package/dist/esm/bindings/MissingBinding.js.map +1 -0
- package/dist/esm/bindings/Placeholder.d.ts +7 -0
- package/dist/esm/bindings/Placeholder.d.ts.map +1 -0
- package/dist/esm/bindings/Placeholder.js +36 -0
- package/dist/esm/bindings/Placeholder.js.map +1 -0
- package/dist/esm/bindings/bindingRegistry.d.ts +11 -0
- package/dist/esm/bindings/bindingRegistry.d.ts.map +1 -0
- package/dist/esm/bindings/bindingRegistry.js +91 -0
- package/dist/esm/bindings/bindingRegistry.js.map +1 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_command_is_registered.d.ts +2 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_command_is_registered.d.ts.map +1 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_command_is_registered.js +25 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_command_is_registered.js.map +1 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_not_registered.d.ts +2 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_not_registered.d.ts.map +1 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_not_registered.js +12 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_not_registered.js.map +1 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_registered.d.ts +2 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_registered.d.ts.map +1 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_registered.js +23 -0
- package/dist/esm/bindings/for_bindingRegistry/when_a_query_is_registered.js.map +1 -0
- package/dist/esm/bindings/for_bindingRegistry/when_bindings_are_cleared.d.ts +2 -0
- package/dist/esm/bindings/for_bindingRegistry/when_bindings_are_cleared.d.ts.map +1 -0
- package/dist/esm/bindings/for_bindingRegistry/when_bindings_are_cleared.js +18 -0
- package/dist/esm/bindings/for_bindingRegistry/when_bindings_are_cleared.js.map +1 -0
- package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_command_binding.d.ts +2 -0
- package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_command_binding.d.ts.map +1 -0
- package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_command_binding.js +25 -0
- package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_command_binding.js.map +1 -0
- package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_query_binding.d.ts +2 -0
- package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_query_binding.d.ts.map +1 -0
- package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_query_binding.js +33 -0
- package/dist/esm/bindings/for_resolveElementBinding/when_resolving_a_query_binding.js.map +1 -0
- package/dist/esm/bindings/index.d.ts +9 -0
- package/dist/esm/bindings/index.d.ts.map +1 -0
- package/dist/esm/bindings/index.js +9 -0
- package/dist/esm/bindings/index.js.map +1 -0
- package/dist/esm/bindings/resolveElementBinding.d.ts +5 -0
- package/dist/esm/bindings/resolveElementBinding.d.ts.map +1 -0
- package/dist/esm/bindings/resolveElementBinding.js +32 -0
- package/dist/esm/bindings/resolveElementBinding.js.map +1 -0
- package/dist/esm/common/SceneDropdown.d.ts +3 -0
- package/dist/esm/common/SceneDropdown.d.ts.map +1 -0
- package/dist/esm/common/SceneDropdown.js +28 -0
- package/dist/esm/common/SceneDropdown.js.map +1 -0
- package/dist/esm/common/SceneErrorBoundary.d.ts +3 -0
- package/dist/esm/common/SceneErrorBoundary.d.ts.map +1 -0
- package/dist/esm/common/SceneErrorBoundary.js +18 -0
- package/dist/esm/common/SceneErrorBoundary.js.map +1 -0
- package/dist/esm/common/SceneIcon.d.ts +3 -0
- package/dist/esm/common/SceneIcon.d.ts.map +1 -0
- package/dist/esm/common/SceneIcon.js +20 -0
- package/dist/esm/common/SceneIcon.js.map +1 -0
- package/dist/esm/common/SceneTooltip.d.ts +3 -0
- package/dist/esm/common/SceneTooltip.d.ts.map +1 -0
- package/dist/esm/common/SceneTooltip.js +27 -0
- package/dist/esm/common/SceneTooltip.js.map +1 -0
- package/dist/esm/common/index.d.ts +5 -0
- package/dist/esm/common/index.d.ts.map +1 -0
- package/dist/esm/common/index.js +5 -0
- package/dist/esm/common/index.js.map +1 -0
- package/dist/esm/cratisComponents.d.ts +4 -0
- package/dist/esm/cratisComponents.d.ts.map +1 -0
- package/dist/esm/cratisComponents.js +103 -0
- package/dist/esm/cratisComponents.js.map +1 -0
- package/dist/esm/cratisComponentsPackage.d.ts +5 -0
- package/dist/esm/cratisComponentsPackage.d.ts.map +1 -0
- package/dist/esm/cratisComponentsPackage.js +102 -0
- package/dist/esm/cratisComponentsPackage.js.map +1 -0
- package/dist/esm/data/SceneDataTable.d.ts +3 -0
- package/dist/esm/data/SceneDataTable.d.ts.map +1 -0
- package/dist/esm/data/SceneDataTable.js +44 -0
- package/dist/esm/data/SceneDataTable.js.map +1 -0
- package/dist/esm/data/SceneObservableDataTable.d.ts +3 -0
- package/dist/esm/data/SceneObservableDataTable.d.ts.map +1 -0
- package/dist/esm/data/SceneObservableDataTable.js +42 -0
- package/dist/esm/data/SceneObservableDataTable.js.map +1 -0
- package/dist/esm/data/for_SceneDataTable/when_the_query_binding_is_missing.d.ts +2 -0
- package/dist/esm/data/for_SceneDataTable/when_the_query_binding_is_missing.d.ts.map +1 -0
- package/dist/esm/data/for_SceneDataTable/when_the_query_binding_is_missing.js +36 -0
- package/dist/esm/data/for_SceneDataTable/when_the_query_binding_is_missing.js.map +1 -0
- package/dist/esm/data/index.d.ts +3 -0
- package/dist/esm/data/index.d.ts.map +1 -0
- package/dist/esm/data/index.js +3 -0
- package/dist/esm/data/index.js.map +1 -0
- package/dist/esm/dialogs/SceneBusyIndicatorDialog.d.ts +3 -0
- package/dist/esm/dialogs/SceneBusyIndicatorDialog.d.ts.map +1 -0
- package/dist/esm/dialogs/SceneBusyIndicatorDialog.js +28 -0
- package/dist/esm/dialogs/SceneBusyIndicatorDialog.js.map +1 -0
- package/dist/esm/dialogs/SceneCommandDialog.d.ts +3 -0
- package/dist/esm/dialogs/SceneCommandDialog.d.ts.map +1 -0
- package/dist/esm/dialogs/SceneCommandDialog.js +45 -0
- package/dist/esm/dialogs/SceneCommandDialog.js.map +1 -0
- package/dist/esm/dialogs/SceneConfirmationDialog.d.ts +2 -0
- package/dist/esm/dialogs/SceneConfirmationDialog.d.ts.map +1 -0
- package/dist/esm/dialogs/SceneConfirmationDialog.js +23 -0
- package/dist/esm/dialogs/SceneConfirmationDialog.js.map +1 -0
- package/dist/esm/dialogs/SceneDialog.d.ts +3 -0
- package/dist/esm/dialogs/SceneDialog.d.ts.map +1 -0
- package/dist/esm/dialogs/SceneDialog.js +39 -0
- package/dist/esm/dialogs/SceneDialog.js.map +1 -0
- package/dist/esm/dialogs/SceneStepperCommandDialog.d.ts +3 -0
- package/dist/esm/dialogs/SceneStepperCommandDialog.d.ts.map +1 -0
- package/dist/esm/dialogs/SceneStepperCommandDialog.js +52 -0
- package/dist/esm/dialogs/SceneStepperCommandDialog.js.map +1 -0
- package/dist/esm/dialogs/index.d.ts +6 -0
- package/dist/esm/dialogs/index.d.ts.map +1 -0
- package/dist/esm/dialogs/index.js +6 -0
- package/dist/esm/dialogs/index.js.map +1 -0
- package/dist/esm/editors/SceneFilterPanel.d.ts +3 -0
- package/dist/esm/editors/SceneFilterPanel.d.ts.map +1 -0
- package/dist/esm/editors/SceneFilterPanel.js +55 -0
- package/dist/esm/editors/SceneFilterPanel.js.map +1 -0
- package/dist/esm/editors/SceneObjectContentEditor.d.ts +3 -0
- package/dist/esm/editors/SceneObjectContentEditor.d.ts.map +1 -0
- package/dist/esm/editors/SceneObjectContentEditor.js +35 -0
- package/dist/esm/editors/SceneObjectContentEditor.js.map +1 -0
- package/dist/esm/editors/SceneObjectNavigationalBar.d.ts +3 -0
- package/dist/esm/editors/SceneObjectNavigationalBar.d.ts.map +1 -0
- package/dist/esm/editors/SceneObjectNavigationalBar.js +32 -0
- package/dist/esm/editors/SceneObjectNavigationalBar.js.map +1 -0
- package/dist/esm/editors/SceneSchemaEditor.d.ts +3 -0
- package/dist/esm/editors/SceneSchemaEditor.d.ts.map +1 -0
- package/dist/esm/editors/SceneSchemaEditor.js +31 -0
- package/dist/esm/editors/SceneSchemaEditor.js.map +1 -0
- package/dist/esm/editors/SceneTimeMachine.d.ts +3 -0
- package/dist/esm/editors/SceneTimeMachine.d.ts.map +1 -0
- package/dist/esm/editors/SceneTimeMachine.js +30 -0
- package/dist/esm/editors/SceneTimeMachine.js.map +1 -0
- package/dist/esm/editors/filterDefinitions.d.ts +3 -0
- package/dist/esm/editors/filterDefinitions.d.ts.map +1 -0
- package/dist/esm/editors/filterDefinitions.js +57 -0
- package/dist/esm/editors/filterDefinitions.js.map +1 -0
- package/dist/esm/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.d.ts +2 -0
- package/dist/esm/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.d.ts.map +1 -0
- package/dist/esm/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.js +15 -0
- package/dist/esm/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.js.map +1 -0
- package/dist/esm/editors/for_filterDefinitions/when_reading_filter_definitions.d.ts +2 -0
- package/dist/esm/editors/for_filterDefinitions/when_reading_filter_definitions.d.ts.map +1 -0
- package/dist/esm/editors/for_filterDefinitions/when_reading_filter_definitions.js +39 -0
- package/dist/esm/editors/for_filterDefinitions/when_reading_filter_definitions.js.map +1 -0
- package/dist/esm/editors/for_timeMachineVersions/when_reading_versions.d.ts +2 -0
- package/dist/esm/editors/for_timeMachineVersions/when_reading_versions.d.ts.map +1 -0
- package/dist/esm/editors/for_timeMachineVersions/when_reading_versions.js +32 -0
- package/dist/esm/editors/for_timeMachineVersions/when_reading_versions.js.map +1 -0
- package/dist/esm/editors/index.d.ts +9 -0
- package/dist/esm/editors/index.d.ts.map +1 -0
- package/dist/esm/editors/index.js +9 -0
- package/dist/esm/editors/index.js.map +1 -0
- package/dist/esm/editors/timeMachineVersions.d.ts +3 -0
- package/dist/esm/editors/timeMachineVersions.d.ts.map +1 -0
- package/dist/esm/editors/timeMachineVersions.js +42 -0
- package/dist/esm/editors/timeMachineVersions.js.map +1 -0
- package/dist/esm/editors/useEditableCopy.d.ts +2 -0
- package/dist/esm/editors/useEditableCopy.d.ts.map +1 -0
- package/dist/esm/editors/useEditableCopy.js +37 -0
- package/dist/esm/editors/useEditableCopy.js.map +1 -0
- package/dist/esm/for_cratisComponents/when_rendering_a_screen_through_the_real_renderer.d.ts +2 -0
- package/dist/esm/for_cratisComponents/when_rendering_a_screen_through_the_real_renderer.d.ts.map +1 -0
- package/dist/esm/for_cratisComponents/when_rendering_a_screen_through_the_real_renderer.js +25 -0
- package/dist/esm/for_cratisComponents/when_rendering_a_screen_through_the_real_renderer.js.map +1 -0
- package/dist/esm/for_cratisComponentsPackage/when_a_profile_ranks_it_above_the_packages_it_layers_on.d.ts +2 -0
- package/dist/esm/for_cratisComponentsPackage/when_a_profile_ranks_it_above_the_packages_it_layers_on.d.ts.map +1 -0
- package/dist/esm/for_cratisComponentsPackage/when_a_profile_ranks_it_above_the_packages_it_layers_on.js +34 -0
- package/dist/esm/for_cratisComponentsPackage/when_a_profile_ranks_it_above_the_packages_it_layers_on.js.map +1 -0
- package/dist/esm/for_cratisComponentsPackage/when_resolving_its_dependencies.d.ts +2 -0
- package/dist/esm/for_cratisComponentsPackage/when_resolving_its_dependencies.d.ts.map +1 -0
- package/dist/esm/for_cratisComponentsPackage/when_resolving_its_dependencies.js +49 -0
- package/dist/esm/for_cratisComponentsPackage/when_resolving_its_dependencies.js.map +1 -0
- package/dist/esm/for_cratisComponentsPackage/when_validating_the_bundle.d.ts +2 -0
- package/dist/esm/for_cratisComponentsPackage/when_validating_the_bundle.d.ts.map +1 -0
- package/dist/esm/for_cratisComponentsPackage/when_validating_the_bundle.js +27 -0
- package/dist/esm/for_cratisComponentsPackage/when_validating_the_bundle.js.map +1 -0
- package/dist/esm/for_properties/when_a_property_has_the_wrong_type.d.ts +2 -0
- package/dist/esm/for_properties/when_a_property_has_the_wrong_type.d.ts.map +1 -0
- package/dist/esm/for_properties/when_a_property_has_the_wrong_type.js +24 -0
- package/dist/esm/for_properties/when_a_property_has_the_wrong_type.js.map +1 -0
- package/dist/esm/for_properties/when_a_property_is_missing.d.ts +2 -0
- package/dist/esm/for_properties/when_a_property_is_missing.d.ts.map +1 -0
- package/dist/esm/for_properties/when_a_property_is_missing.js +13 -0
- package/dist/esm/for_properties/when_a_property_is_missing.js.map +1 -0
- package/dist/esm/for_properties/when_a_property_is_present.d.ts +2 -0
- package/dist/esm/for_properties/when_a_property_is_present.d.ts.map +1 -0
- package/dist/esm/for_properties/when_a_property_is_present.js +21 -0
- package/dist/esm/for_properties/when_a_property_is_present.js.map +1 -0
- package/dist/esm/forms/SceneCommandForm.d.ts +3 -0
- package/dist/esm/forms/SceneCommandForm.d.ts.map +1 -0
- package/dist/esm/forms/SceneCommandForm.js +44 -0
- package/dist/esm/forms/SceneCommandForm.js.map +1 -0
- package/dist/esm/forms/fields/CommandFormField.d.ts +9 -0
- package/dist/esm/forms/fields/CommandFormField.d.ts.map +1 -0
- package/dist/esm/forms/fields/CommandFormField.js +29 -0
- package/dist/esm/forms/fields/CommandFormField.js.map +1 -0
- package/dist/esm/forms/fields/FieldBinding.d.ts +6 -0
- package/dist/esm/forms/fields/FieldBinding.d.ts.map +1 -0
- package/dist/esm/forms/fields/FieldBinding.js +2 -0
- package/dist/esm/forms/fields/FieldBinding.js.map +1 -0
- package/dist/esm/forms/fields/SceneCalendarField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneCalendarField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneCalendarField.js +39 -0
- package/dist/esm/forms/fields/SceneCalendarField.js.map +1 -0
- package/dist/esm/forms/fields/SceneCheckboxField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneCheckboxField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneCheckboxField.js +26 -0
- package/dist/esm/forms/fields/SceneCheckboxField.js.map +1 -0
- package/dist/esm/forms/fields/SceneChipsField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneChipsField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneChipsField.js +31 -0
- package/dist/esm/forms/fields/SceneChipsField.js.map +1 -0
- package/dist/esm/forms/fields/SceneColorPickerField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneColorPickerField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneColorPickerField.js +28 -0
- package/dist/esm/forms/fields/SceneColorPickerField.js.map +1 -0
- package/dist/esm/forms/fields/SceneDropdownField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneDropdownField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneDropdownField.js +33 -0
- package/dist/esm/forms/fields/SceneDropdownField.js.map +1 -0
- package/dist/esm/forms/fields/SceneInputTextField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneInputTextField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneInputTextField.js +43 -0
- package/dist/esm/forms/fields/SceneInputTextField.js.map +1 -0
- package/dist/esm/forms/fields/SceneMultiSelectField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneMultiSelectField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneMultiSelectField.js +38 -0
- package/dist/esm/forms/fields/SceneMultiSelectField.js.map +1 -0
- package/dist/esm/forms/fields/SceneNumberField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneNumberField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneNumberField.js +30 -0
- package/dist/esm/forms/fields/SceneNumberField.js.map +1 -0
- package/dist/esm/forms/fields/SceneRadioButtonField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneRadioButtonField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneRadioButtonField.js +33 -0
- package/dist/esm/forms/fields/SceneRadioButtonField.js.map +1 -0
- package/dist/esm/forms/fields/SceneRadioGroupField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneRadioGroupField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneRadioGroupField.js +34 -0
- package/dist/esm/forms/fields/SceneRadioGroupField.js.map +1 -0
- package/dist/esm/forms/fields/SceneSliderField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneSliderField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneSliderField.js +29 -0
- package/dist/esm/forms/fields/SceneSliderField.js.map +1 -0
- package/dist/esm/forms/fields/SceneTextAreaField.d.ts +3 -0
- package/dist/esm/forms/fields/SceneTextAreaField.d.ts.map +1 -0
- package/dist/esm/forms/fields/SceneTextAreaField.js +29 -0
- package/dist/esm/forms/fields/SceneTextAreaField.js.map +1 -0
- package/dist/esm/forms/fields/for_CommandFormField/when_the_field_names_no_property.d.ts +2 -0
- package/dist/esm/forms/fields/for_CommandFormField/when_the_field_names_no_property.d.ts.map +1 -0
- package/dist/esm/forms/fields/for_CommandFormField/when_the_field_names_no_property.js +12 -0
- package/dist/esm/forms/fields/for_CommandFormField/when_the_field_names_no_property.js.map +1 -0
- package/dist/esm/forms/fields/for_resolveFieldBinding/when_resolving_a_field_binding.d.ts +2 -0
- package/dist/esm/forms/fields/for_resolveFieldBinding/when_resolving_a_field_binding.d.ts.map +1 -0
- package/dist/esm/forms/fields/for_resolveFieldBinding/when_resolving_a_field_binding.js +24 -0
- package/dist/esm/forms/fields/for_resolveFieldBinding/when_resolving_a_field_binding.js.map +1 -0
- package/dist/esm/forms/fields/index.d.ts +16 -0
- package/dist/esm/forms/fields/index.d.ts.map +1 -0
- package/dist/esm/forms/fields/index.js +16 -0
- package/dist/esm/forms/fields/index.js.map +1 -0
- package/dist/esm/forms/fields/resolveFieldBinding.d.ts +4 -0
- package/dist/esm/forms/fields/resolveFieldBinding.d.ts.map +1 -0
- package/dist/esm/forms/fields/resolveFieldBinding.js +25 -0
- package/dist/esm/forms/fields/resolveFieldBinding.js.map +1 -0
- package/dist/esm/forms/index.d.ts +3 -0
- package/dist/esm/forms/index.d.ts.map +1 -0
- package/dist/esm/forms/index.js +3 -0
- package/dist/esm/forms/index.js.map +1 -0
- package/dist/esm/given.d.ts +3 -0
- package/dist/esm/given.d.ts.map +1 -0
- package/dist/esm/given.js +21 -0
- package/dist/esm/given.js.map +1 -0
- package/dist/esm/index.d.ts +12 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +51 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/pages/SceneDataPage.d.ts +3 -0
- package/dist/esm/pages/SceneDataPage.d.ts.map +1 -0
- package/dist/esm/pages/SceneDataPage.js +43 -0
- package/dist/esm/pages/SceneDataPage.js.map +1 -0
- package/dist/esm/pages/SceneFormElement.d.ts +3 -0
- package/dist/esm/pages/SceneFormElement.d.ts.map +1 -0
- package/dist/esm/pages/SceneFormElement.js +24 -0
- package/dist/esm/pages/SceneFormElement.js.map +1 -0
- package/dist/esm/pages/ScenePage.d.ts +3 -0
- package/dist/esm/pages/ScenePage.d.ts.map +1 -0
- package/dist/esm/pages/ScenePage.js +26 -0
- package/dist/esm/pages/ScenePage.js.map +1 -0
- package/dist/esm/pages/for_ScenePage/when_rendering_a_page.d.ts +2 -0
- package/dist/esm/pages/for_ScenePage/when_rendering_a_page.d.ts.map +1 -0
- package/dist/esm/pages/for_ScenePage/when_rendering_a_page.js +31 -0
- package/dist/esm/pages/for_ScenePage/when_rendering_a_page.js.map +1 -0
- package/dist/esm/pages/index.d.ts +4 -0
- package/dist/esm/pages/index.d.ts.map +1 -0
- package/dist/esm/pages/index.js +4 -0
- package/dist/esm/pages/index.js.map +1 -0
- package/dist/esm/properties.d.ts +9 -0
- package/dist/esm/properties.d.ts.map +1 -0
- package/dist/esm/properties.js +95 -0
- package/dist/esm/properties.js.map +1 -0
- package/dist/esm/toolbar/SceneToolbar.d.ts +3 -0
- package/dist/esm/toolbar/SceneToolbar.d.ts.map +1 -0
- package/dist/esm/toolbar/SceneToolbar.js +25 -0
- package/dist/esm/toolbar/SceneToolbar.js.map +1 -0
- package/dist/esm/toolbar/SceneToolbarButton.d.ts +3 -0
- package/dist/esm/toolbar/SceneToolbarButton.d.ts.map +1 -0
- package/dist/esm/toolbar/SceneToolbarButton.js +30 -0
- package/dist/esm/toolbar/SceneToolbarButton.js.map +1 -0
- package/dist/esm/toolbar/SceneToolbarGroup.d.ts +3 -0
- package/dist/esm/toolbar/SceneToolbarGroup.d.ts.map +1 -0
- package/dist/esm/toolbar/SceneToolbarGroup.js +25 -0
- package/dist/esm/toolbar/SceneToolbarGroup.js.map +1 -0
- package/dist/esm/toolbar/SceneToolbarSeparator.d.ts +3 -0
- package/dist/esm/toolbar/SceneToolbarSeparator.d.ts.map +1 -0
- package/dist/esm/toolbar/SceneToolbarSeparator.js +23 -0
- package/dist/esm/toolbar/SceneToolbarSeparator.js.map +1 -0
- package/dist/esm/toolbar/index.d.ts +5 -0
- package/dist/esm/toolbar/index.d.ts.map +1 -0
- package/dist/esm/toolbar/index.js +5 -0
- package/dist/esm/toolbar/index.js.map +1 -0
- package/dist/esm/tsconfig.tsbuildinfo +1 -0
- package/editors/SceneFilterPanel.tsx +52 -0
- package/editors/SceneObjectContentEditor.tsx +36 -0
- package/editors/SceneObjectNavigationalBar.tsx +34 -0
- package/editors/SceneSchemaEditor.tsx +34 -0
- package/editors/SceneTimeMachine.tsx +32 -0
- package/editors/filterDefinitions.ts +59 -0
- package/editors/for_SceneObjectNavigationalBar/when_navigating_back_up_the_trail.tsx +18 -0
- package/editors/for_filterDefinitions/when_reading_filter_definitions.ts +49 -0
- package/editors/for_timeMachineVersions/when_reading_versions.ts +39 -0
- package/editors/index.ts +11 -0
- package/editors/timeMachineVersions.ts +44 -0
- package/editors/useEditableCopy.ts +32 -0
- package/for_cratisComponents/when_rendering_a_screen_through_the_real_renderer.tsx +37 -0
- package/for_cratisComponentsPackage/when_a_profile_ranks_it_above_the_packages_it_layers_on.ts +49 -0
- package/for_cratisComponentsPackage/when_resolving_its_dependencies.ts +68 -0
- package/for_cratisComponentsPackage/when_validating_the_bundle.ts +39 -0
- package/for_properties/when_a_property_has_the_wrong_type.ts +41 -0
- package/for_properties/when_a_property_is_missing.ts +26 -0
- package/for_properties/when_a_property_is_present.ts +36 -0
- package/forms/SceneCommandForm.tsx +45 -0
- package/forms/fields/CommandFormField.tsx +32 -0
- package/forms/fields/FieldBinding.ts +26 -0
- package/forms/fields/SceneCalendarField.tsx +41 -0
- package/forms/fields/SceneCheckboxField.tsx +29 -0
- package/forms/fields/SceneChipsField.tsx +34 -0
- package/forms/fields/SceneColorPickerField.tsx +31 -0
- package/forms/fields/SceneDropdownField.tsx +36 -0
- package/forms/fields/SceneInputTextField.tsx +37 -0
- package/forms/fields/SceneMultiSelectField.tsx +40 -0
- package/forms/fields/SceneNumberField.tsx +33 -0
- package/forms/fields/SceneRadioButtonField.tsx +37 -0
- package/forms/fields/SceneRadioGroupField.tsx +36 -0
- package/forms/fields/SceneSliderField.tsx +32 -0
- package/forms/fields/SceneTextAreaField.tsx +32 -0
- package/forms/fields/for_CommandFormField/when_the_field_names_no_property.tsx +16 -0
- package/forms/fields/for_resolveFieldBinding/when_resolving_a_field_binding.ts +34 -0
- package/forms/fields/index.ts +18 -0
- package/forms/fields/resolveFieldBinding.ts +27 -0
- package/forms/index.ts +5 -0
- package/given.ts +33 -0
- package/index.ts +14 -0
- package/package.json +68 -0
- package/pages/SceneDataPage.tsx +40 -0
- package/pages/SceneFormElement.tsx +21 -0
- package/pages/ScenePage.tsx +30 -0
- package/pages/for_ScenePage/when_rendering_a_page.tsx +39 -0
- package/pages/index.ts +6 -0
- package/properties.ts +112 -0
- package/storybook-static/assets/CommandDialog-B78_eDOU.css +1 -0
- package/storybook-static/assets/CratisComponents-qPooLvTv.css +1 -0
- package/storybook-static/assets/DataPage-CroWzXsC.css +1 -0
- package/storybook-static/assets/iframe-DQhZBFM5.css +1 -0
- package/theme/sceneTokenBridge.css +72 -0
- package/toolbar/SceneToolbar.tsx +28 -0
- package/toolbar/SceneToolbarButton.tsx +31 -0
- package/toolbar/SceneToolbarGroup.tsx +28 -0
- package/toolbar/SceneToolbarSeparator.tsx +21 -0
- package/toolbar/index.ts +7 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { StorybookConfig } from "@storybook/react-vite";
|
|
5
|
+
import { dirname, join, resolve } from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import type { InlineConfig } from 'vite';
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
|
|
11
|
+
const config: StorybookConfig = {
|
|
12
|
+
// Scoped away from `dist/` so a story is never indexed twice - once as source and once as the
|
|
13
|
+
// tsc-emitted copy beside it.
|
|
14
|
+
stories: ["../*.stories.@(js|jsx|mjs|ts|tsx)", "../!(dist|node_modules)/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
15
|
+
addons: [getAbsolutePath("@storybook/addon-links")],
|
|
16
|
+
framework: { name: getAbsolutePath("@storybook/react-vite"), options: {} },
|
|
17
|
+
async viteFinal(config: InlineConfig) {
|
|
18
|
+
config.resolve = config.resolve || {};
|
|
19
|
+
config.resolve.alias = {
|
|
20
|
+
...config.resolve.alias,
|
|
21
|
+
'@cratis/scene.engine': resolve(__dirname, '../../engine/index.ts'),
|
|
22
|
+
'@cratis/scene.model': resolve(__dirname, '../../model/index.ts'),
|
|
23
|
+
'@cratis/scene.react': resolve(__dirname, '../../react/index.ts'),
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// `@cratis/arc`, `@cratis/arc.react` and `@cratis/fundamentals` are peer dependencies of
|
|
27
|
+
// `@cratis/components` that the *host application* supplies. A Storybook preview is not a host:
|
|
28
|
+
// it has no Arc client and no backend, which is exactly the situation this package is designed
|
|
29
|
+
// around, so they are not installed here.
|
|
30
|
+
//
|
|
31
|
+
// Every adapter that reaches them does so through a dynamic `import()`, which puts the Arc-bound
|
|
32
|
+
// half of the library in its own chunk. Marking these external lets that chunk be emitted with
|
|
33
|
+
// its imports left bare, instead of failing the build; no story loads the chunk, because no
|
|
34
|
+
// story registers a binding. If one ever did, the chunk would fail to load in the browser and
|
|
35
|
+
// the `ArcRuntimeBoundary` around it would show that - which is the same thing a real host
|
|
36
|
+
// without Arc installed would see, and is worth seeing rather than hiding.
|
|
37
|
+
config.build = config.build || {};
|
|
38
|
+
config.build.rollupOptions = {
|
|
39
|
+
...(config.build.rollupOptions ?? {}),
|
|
40
|
+
external: [/^@cratis\/arc/, '@cratis/fundamentals'],
|
|
41
|
+
};
|
|
42
|
+
// Vite 8 minifies CSS with lightningcss, which rejects the whole bundle over one invalid file:
|
|
43
|
+
// `@cratis/components@2.9.0` ships `dist/esm/TimeMachine/Properties.css` with `//` line comments,
|
|
44
|
+
// which are not CSS. esbuild's minifier tolerates them. This is an upstream defect and the
|
|
45
|
+
// workaround belongs here, in preview tooling, rather than anywhere it could hide the problem -
|
|
46
|
+
// remove this line once the Components package ships that file with `/* */` comments.
|
|
47
|
+
config.build.cssMinify = 'esbuild';
|
|
48
|
+
return config;
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
export default config;
|
|
52
|
+
|
|
53
|
+
function getAbsolutePath(value: string): string {
|
|
54
|
+
return dirname(fileURLToPath(import.meta.resolve(join(value, "package.json"))));
|
|
55
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { Preview } from '@storybook/react';
|
|
5
|
+
import { CratisComponentsProvider } from '@cratis/components/Common';
|
|
6
|
+
|
|
7
|
+
// The three layers a `@cratis/components` component needs to look like itself, in the order they
|
|
8
|
+
// resolve. PrimeReact 10 ships every widget's *structural* CSS inside the theme file - there is no
|
|
9
|
+
// separate primitives stylesheet - so without a theme the wrapped widgets render as bare HTML. The
|
|
10
|
+
// library's own sheet adds its Tailwind utilities and the `--cratis-*` token layer on top, and this
|
|
11
|
+
// package's bridge puts Scene's `--scene-*` tokens in front of that wherever a Scene theme is applied.
|
|
12
|
+
import 'primereact/resources/themes/lara-light-blue/theme.css';
|
|
13
|
+
import 'primeicons/primeicons.css';
|
|
14
|
+
import '@cratis/components/styles';
|
|
15
|
+
import '../theme/sceneTokenBridge.css';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Every story renders inside `CratisComponentsProvider`, the library's own configuration provider over
|
|
19
|
+
* PrimeReact's. Without it the wrapped components fall back to PrimeReact's defaults rather than
|
|
20
|
+
* Cratis', so a story would be showing something subtly different from what an application renders -
|
|
21
|
+
* which defeats the point of having stories at all.
|
|
22
|
+
*/
|
|
23
|
+
const preview: Preview = {
|
|
24
|
+
decorators: [
|
|
25
|
+
Story => (
|
|
26
|
+
<CratisComponentsProvider>
|
|
27
|
+
<Story />
|
|
28
|
+
</CratisComponentsProvider>
|
|
29
|
+
),
|
|
30
|
+
],
|
|
31
|
+
parameters: {
|
|
32
|
+
controls: { matchers: { color: /(background|color)$/i, date: /Date$/i } },
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export default preview;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
5
|
+
import { expect, fireEvent, within } from 'storybook/test';
|
|
6
|
+
import { ExternalComponent, HorizontalAlignment, Theme, VerticalAlignment, Visibility } from '@cratis/scene.model';
|
|
7
|
+
import { SceneElementView, SceneThemeProvider } from '@cratis/scene.react';
|
|
8
|
+
import { cratisComponents } from './cratisComponents';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Builds the `ExternalComponent` a screen compiles to, with the inherited layout properties at their
|
|
12
|
+
* neutral values. Stories are about `properties` and `slots`; everything else is noise, so it lives here.
|
|
13
|
+
*/
|
|
14
|
+
function component(id: string, componentName: string, properties: Record<string, unknown> = {}, slots: Record<string, ExternalComponent[]> = {}): ExternalComponent {
|
|
15
|
+
return {
|
|
16
|
+
id,
|
|
17
|
+
name: id,
|
|
18
|
+
componentName,
|
|
19
|
+
properties,
|
|
20
|
+
slots,
|
|
21
|
+
visibility: Visibility.Visible,
|
|
22
|
+
isEnabled: true,
|
|
23
|
+
opacity: 1,
|
|
24
|
+
size: {},
|
|
25
|
+
zIndex: 0,
|
|
26
|
+
minimumSize: {},
|
|
27
|
+
maximumSize: {},
|
|
28
|
+
margin: { left: 0, top: 0, right: 0, bottom: 0 },
|
|
29
|
+
horizontalAlignment: HorizontalAlignment.Stretch,
|
|
30
|
+
verticalAlignment: VerticalAlignment.Stretch,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const toolbar = component('toolbar', 'Cratis.Components:toolbar', { orientation: 'horizontal' }, {
|
|
35
|
+
content: [
|
|
36
|
+
component('new', 'Cratis.Components:toolbarButton', { icon: 'pi pi-plus', title: 'New invoice' }),
|
|
37
|
+
component('refresh', 'Cratis.Components:toolbarButton', { icon: 'pi pi-refresh', title: 'Refresh' }),
|
|
38
|
+
component('separator', 'Cratis.Components:toolbarSeparator', { orientation: 'horizontal' }),
|
|
39
|
+
component('group', 'Cratis.Components:toolbarGroup', { orientation: 'horizontal' }, {
|
|
40
|
+
content: [
|
|
41
|
+
component('approve', 'Cratis.Components:toolbarButton', { icon: 'pi pi-check', title: 'Approve', active: true }),
|
|
42
|
+
component('reject', 'Cratis.Components:toolbarButton', { icon: 'pi pi-times', title: 'Reject' }),
|
|
43
|
+
],
|
|
44
|
+
}),
|
|
45
|
+
],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const statusDropdown = component('status', 'Cratis.Components:dropdown', {
|
|
49
|
+
placeholder: 'Any status',
|
|
50
|
+
showClear: true,
|
|
51
|
+
options: [
|
|
52
|
+
{ label: 'Draft', value: 'draft' },
|
|
53
|
+
{ label: 'Approved', value: 'approved' },
|
|
54
|
+
{ label: 'Paid', value: 'paid' },
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
const invoicesTable = component('invoices', 'Cratis.Components:dataTable', {
|
|
59
|
+
query: 'AllInvoices',
|
|
60
|
+
emptyMessage: 'No invoices yet',
|
|
61
|
+
dataKey: 'invoiceId',
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const invoicesScreen = component('page', 'Cratis.Components:page', { title: 'Invoices', showTitle: true, panel: true }, {
|
|
65
|
+
content: [toolbar, statusDropdown, invoicesTable],
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
const meta = {
|
|
69
|
+
title: 'Packages/Cratis Components',
|
|
70
|
+
component: SceneElementView,
|
|
71
|
+
tags: ['autodocs'],
|
|
72
|
+
parameters: {
|
|
73
|
+
layout: 'padded',
|
|
74
|
+
docs: {
|
|
75
|
+
description: {
|
|
76
|
+
component:
|
|
77
|
+
'The `Cratis.Components` Scene package: `@cratis/components` exposed as resolvable Scene components. ' +
|
|
78
|
+
'Every story renders a real `ExternalComponent` tree through the real `SceneElementView` and the real ' +
|
|
79
|
+
'component registry, so what is shown is exactly what a `.play` screen resolves to.',
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
args: {
|
|
84
|
+
registry: cratisComponents,
|
|
85
|
+
resolveBinding: () => undefined,
|
|
86
|
+
},
|
|
87
|
+
} satisfies Meta<typeof SceneElementView>;
|
|
88
|
+
|
|
89
|
+
export default meta;
|
|
90
|
+
|
|
91
|
+
type Story = StoryObj<typeof meta>;
|
|
92
|
+
|
|
93
|
+
/** An invoices screen: page chrome, a toolbar, a filter dropdown, and a table waiting on its query. */
|
|
94
|
+
export const Playground: Story = {
|
|
95
|
+
args: { element: invoicesScreen },
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* What design-time preview normally looks like. Nothing is registered in the binding registry, so every
|
|
100
|
+
* Arc-bound component names the binding it wanted instead of rendering blank or throwing - and the rest
|
|
101
|
+
* of the screen is entirely usable while that is true.
|
|
102
|
+
*/
|
|
103
|
+
export const MissingBindings: Story = {
|
|
104
|
+
args: {
|
|
105
|
+
element: component('unbound', 'Cratis.Components:page', { title: 'Unbound', showTitle: true }, {
|
|
106
|
+
content: [
|
|
107
|
+
component('table', 'Cratis.Components:dataTable', { query: 'AllInvoices', emptyMessage: 'None' }),
|
|
108
|
+
component('live', 'Cratis.Components:observableDataTable', { query: 'InvoicesInFlight', emptyMessage: 'None' }),
|
|
109
|
+
component('form', 'Cratis.Components:commandForm', { command: 'RegisterInvoice' }),
|
|
110
|
+
component('nameless', 'Cratis.Components:dataPage', { title: 'No query named' }),
|
|
111
|
+
component('field', 'Cratis.Components:inputTextField', { title: 'No property named' }),
|
|
112
|
+
],
|
|
113
|
+
}),
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/** The toolbar family - buttons, a group and a separator - inside its own container. */
|
|
118
|
+
export const Toolbar: Story = {
|
|
119
|
+
args: {
|
|
120
|
+
element: component('page', 'Cratis.Components:page', { title: 'Toolbar', showTitle: true }, { content: [toolbar] }),
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** The editors: a schema editor, a breadcrumb trail and a document editor, all Arc-free. */
|
|
125
|
+
export const Editors: Story = {
|
|
126
|
+
args: {
|
|
127
|
+
element: component('page', 'Cratis.Components:page', { title: 'Editors', showTitle: true }, {
|
|
128
|
+
content: [
|
|
129
|
+
component('trail', 'Cratis.Components:objectNavigationalBar', { navigationPath: ['shipping', 'address'] }),
|
|
130
|
+
component('schema', 'Cratis.Components:schemaEditor', {
|
|
131
|
+
eventTypeName: 'InvoiceRegistered',
|
|
132
|
+
canEdit: true,
|
|
133
|
+
schema: {
|
|
134
|
+
title: 'InvoiceRegistered',
|
|
135
|
+
type: 'object',
|
|
136
|
+
properties: {
|
|
137
|
+
number: { type: 'string' },
|
|
138
|
+
amount: { type: 'number' },
|
|
139
|
+
issued: { type: 'string', format: 'date-time' },
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
}),
|
|
143
|
+
component('document', 'Cratis.Components:objectContentEditor', {
|
|
144
|
+
editMode: true,
|
|
145
|
+
object: { number: 'INV-1001', amount: 4200 },
|
|
146
|
+
schema: { type: 'object', properties: { number: { type: 'string' }, amount: { type: 'number' } } },
|
|
147
|
+
}),
|
|
148
|
+
],
|
|
149
|
+
}),
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
/** The tooltip, icon and error boundary wrappers, in a small composition. */
|
|
154
|
+
export const InContext: Story = {
|
|
155
|
+
args: {
|
|
156
|
+
element: component('page', 'Cratis.Components:page', { title: 'Invoice INV-1001', showTitle: true, panel: true }, {
|
|
157
|
+
content: [
|
|
158
|
+
component('guard', 'Cratis.Components:errorBoundary', {}, {
|
|
159
|
+
content: [
|
|
160
|
+
component('hint', 'Cratis.Components:tooltip', { content: 'Approved on 5 January', position: 'right' }, {
|
|
161
|
+
content: [component('icon', 'Cratis.Components:icon', { icon: 'pi pi-check-circle' })],
|
|
162
|
+
}),
|
|
163
|
+
component('filters', 'Cratis.Components:filterPanel', {
|
|
164
|
+
label: 'Filters',
|
|
165
|
+
filters: [
|
|
166
|
+
{
|
|
167
|
+
key: 'status',
|
|
168
|
+
label: 'Status',
|
|
169
|
+
multi: true,
|
|
170
|
+
options: [
|
|
171
|
+
{ key: 'draft', label: 'Draft', count: 12 },
|
|
172
|
+
{ key: 'approved', label: 'Approved', count: 44 },
|
|
173
|
+
],
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
}),
|
|
177
|
+
],
|
|
178
|
+
}),
|
|
179
|
+
],
|
|
180
|
+
}),
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* A Scene theme driving `@cratis/components` through the token bridge.
|
|
186
|
+
*
|
|
187
|
+
* Neither side knows about the other: the theme carries semantic Scene tokens, `SceneThemeProvider`
|
|
188
|
+
* writes them as `--scene-*` custom properties, and this package's stylesheet maps those onto the
|
|
189
|
+
* `--cratis-*` names the library reads. Nothing in `@cratis/components` was changed to make this work.
|
|
190
|
+
*/
|
|
191
|
+
const midnight: Theme = {
|
|
192
|
+
name: 'Midnight',
|
|
193
|
+
compatibleWith: ['Cratis.Components', 'PrimeReact', 'Tailwind'],
|
|
194
|
+
isDark: true,
|
|
195
|
+
description: 'A dark Scene theme, applied to Cratis Components entirely through design tokens.',
|
|
196
|
+
tokens: {
|
|
197
|
+
'primary.color': '#a78bfa',
|
|
198
|
+
'primary.contrastColor': '#1e1b4b',
|
|
199
|
+
'surface.background': '#0f172a',
|
|
200
|
+
'surface.card': '#1e293b',
|
|
201
|
+
'surface.border': '#334155',
|
|
202
|
+
'surface.hover': '#273449',
|
|
203
|
+
'surface.overlay': '#1e293b',
|
|
204
|
+
'text.color': '#e2e8f0',
|
|
205
|
+
'text.mutedColor': '#94a3b8',
|
|
206
|
+
'highlight.background': '#312e81',
|
|
207
|
+
'highlight.color': '#e0e7ff',
|
|
208
|
+
'content.borderRadius': '10px',
|
|
209
|
+
'focus.ring': '0 0 0 0.2rem #4c1d95',
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
export const Themed: Story = {
|
|
214
|
+
args: { element: invoicesScreen },
|
|
215
|
+
render: args => (
|
|
216
|
+
<SceneThemeProvider theme={midnight}>
|
|
217
|
+
<SceneElementView {...args} />
|
|
218
|
+
</SceneThemeProvider>
|
|
219
|
+
),
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The breadcrumb trail is stateful: clicking a crumb truncates the path, which the underlying component
|
|
224
|
+
* reports and the adapter applies.
|
|
225
|
+
*/
|
|
226
|
+
export const Interactive: Story = {
|
|
227
|
+
args: {
|
|
228
|
+
element: component('trail', 'Cratis.Components:objectNavigationalBar', { navigationPath: ['shipping', 'address', 'street'] }),
|
|
229
|
+
},
|
|
230
|
+
play: async ({ canvasElement }) => {
|
|
231
|
+
const canvas = within(canvasElement);
|
|
232
|
+
fireEvent.click(canvas.getByText('address'));
|
|
233
|
+
await expect(canvas.queryByText('street')).toBeNull();
|
|
234
|
+
},
|
|
235
|
+
};
|
package/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# @cratis/scene.components
|
|
2
|
+
|
|
3
|
+
The Scene package that exposes [`@cratis/components`](https://www.npmjs.com/package/@cratis/components) — the
|
|
4
|
+
Cratis React component library — as resolvable Scene components.
|
|
5
|
+
|
|
6
|
+
User-facing documentation lives in [`Documentation/components-package/`](../../../Documentation/components-package/index.md).
|
|
7
|
+
This file is the contributor's note: how the package is laid out, and why the load-bearing decisions were
|
|
8
|
+
made the way they were.
|
|
9
|
+
|
|
10
|
+
## The constraint everything is shaped around
|
|
11
|
+
|
|
12
|
+
Most of `@cratis/components` is **Arc-bound**. `DataPage`, `DataTableForQuery`,
|
|
13
|
+
`DataTableForObservableQuery`, `AutoCommandForm`, `CommandDialog` and `StepperCommandDialog` all take a
|
|
14
|
+
*query or command class constructor* and talk to a live backend through `@cratis/arc.react`.
|
|
15
|
+
|
|
16
|
+
A Scene `ExternalComponent` carries a `properties` bag of plain values and named `slots`. There is no way to
|
|
17
|
+
put a TypeScript class in one, and there should not be — a `.play` document is text, compiled by Stage and
|
|
18
|
+
read back by Studio, and nothing in that round trip can carry a class.
|
|
19
|
+
|
|
20
|
+
So an adapter cannot conjure a query class out of a property string. The only honest seam is that the thing
|
|
21
|
+
in the screen *is a name*, and a name needs somewhere to become a class.
|
|
22
|
+
|
|
23
|
+
### The binding registry
|
|
24
|
+
|
|
25
|
+
`bindings/bindingRegistry.ts`:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
registerQuery(name: string, queryClass: BoundConstructor): void
|
|
29
|
+
registerQueries(bindings: Record<string, BoundConstructor>): void
|
|
30
|
+
resolveQuery(name: string): BoundConstructor | undefined
|
|
31
|
+
|
|
32
|
+
registerCommand(name: string, commandClass: BoundConstructor): void
|
|
33
|
+
registerCommands(bindings: Record<string, BoundConstructor>): void
|
|
34
|
+
resolveCommand(name: string): BoundConstructor | undefined
|
|
35
|
+
|
|
36
|
+
registeredQueryNames(): string[]
|
|
37
|
+
registeredCommandNames(): string[]
|
|
38
|
+
clearBindings(): void
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
A host — Stage's generated application, or Studio's preview when it is wired to a real backend — registers
|
|
42
|
+
the real generated Arc proxies under the names screens refer to them by. Adapters look them up at render
|
|
43
|
+
time through `resolveElementBinding`, which reads `properties.query` or `properties.command` depending on the
|
|
44
|
+
`BindingKind`.
|
|
45
|
+
|
|
46
|
+
Design notes:
|
|
47
|
+
|
|
48
|
+
- **Queries and commands are separate namespaces.** They are opposite halves of CQRS and a screen means
|
|
49
|
+
exactly one at each site; letting one satisfy the other would turn a modeling mistake into a runtime one.
|
|
50
|
+
- **`BoundConstructor` is `new (...args: never[]) => object`,** not an Arc type. Scene deliberately does not
|
|
51
|
+
depend on Arc. Whether a registered class really is a query is checkable where the host registers it, with
|
|
52
|
+
the real Arc types in scope — which is where that check belongs.
|
|
53
|
+
- **Re-registering a name replaces it**, so a host can re-register on hot reload.
|
|
54
|
+
- **`clearBindings()` exists** because module-level state is right for a host that registers once and wrong
|
|
55
|
+
for Studio switching projects, or for a spec that must not inherit the previous one's registrations.
|
|
56
|
+
|
|
57
|
+
### A missing binding is a placeholder, never a throw
|
|
58
|
+
|
|
59
|
+
`resolveQuery` returns `undefined`, and every Arc-bound adapter renders `MissingBinding`:
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
Unresolved query binding 'AllInvoices' on Cratis.Components:dataTable
|
|
63
|
+
Missing query binding on Cratis.Components:dataTable
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Two messages, because they are two different mistakes — one needs the host to register the name, the other
|
|
67
|
+
needs the screen edited. The presentation deliberately matches `UnresolvedComponent` in `@cratis/scene.react`.
|
|
68
|
+
|
|
69
|
+
Studio's design-time preview usually has nothing registered at all and must still show a usable layout: one
|
|
70
|
+
unbound table costs one dashed box, not the whole screen.
|
|
71
|
+
|
|
72
|
+
### Arc is loaded lazily
|
|
73
|
+
|
|
74
|
+
`@cratis/arc`, `@cratis/arc.react` and `@cratis/fundamentals` are peer dependencies of `@cratis/components`
|
|
75
|
+
that the *host* supplies. They are not installed in this repository, and a design surface is not a host.
|
|
76
|
+
|
|
77
|
+
Every adapter that reaches them does so through a dynamic `import()` inside `React.lazy`, wrapped in
|
|
78
|
+
`ArcRuntimeBoundary` (`Suspense` + the library's own `ErrorBoundary`). A screen built only from the library's
|
|
79
|
+
Arc-free half never pulls the Arc client in, and an unbound component never even reaches the import.
|
|
80
|
+
|
|
81
|
+
This splits the library cleanly, and the split is the library's own:
|
|
82
|
+
|
|
83
|
+
| Arc-free (static import) | Arc-bound (lazy import) |
|
|
84
|
+
|---|---|
|
|
85
|
+
| `Common`, `Dropdown`, `Filter`, `Toolbar`, `SchemaEditor`, `TimeMachine`, `ObjectContentEditor`, `ObjectNavigationalBar` | `DataPage`, `DataTables`, `CommandForm`, `CommandDialog`, `Dialogs` |
|
|
86
|
+
|
|
87
|
+
The Storybook build externalizes the Arc packages (`.storybook/main.ts`) so the lazy chunk can be emitted
|
|
88
|
+
with its imports left bare. No story loads that chunk, because no story registers a binding.
|
|
89
|
+
|
|
90
|
+
## Naming and shadowing
|
|
91
|
+
|
|
92
|
+
Bare names are `lowerCamelCase` and abstract — `dataTable`, not `DataTableForQuery` — registered under
|
|
93
|
+
`componentRegistryKey('Cratis.Components', name)`.
|
|
94
|
+
|
|
95
|
+
`table` and `dialog` deliberately reuse names `core` and `PrimeReact` declare. A profile listing
|
|
96
|
+
`core`, `PrimeReact`, `Cratis.Components` in that order resolves both here and records the others as
|
|
97
|
+
shadowed. Both replacements are better for a Cratis application: `DataTableForQuery` performs the query
|
|
98
|
+
rather than being handed rows, and the Cratis `Dialog` resolves its result through Arc's dialog context.
|
|
99
|
+
|
|
100
|
+
**`card` is deliberately not declared.** `@cratis/components` ships no card; the nearest thing is `Page`'s
|
|
101
|
+
`panel` chrome, whose `.panel` class the consuming application defines. Shadowing `card` with that would make
|
|
102
|
+
the name resolve to something worse — an override is only justified when the replacement is better for every
|
|
103
|
+
screen that already writes the name.
|
|
104
|
+
|
|
105
|
+
`dataTable` and `table` are the same adapter under two names, so adopting the package does not require
|
|
106
|
+
rewriting screens.
|
|
107
|
+
|
|
108
|
+
## Token bridge
|
|
109
|
+
|
|
110
|
+
`theme/sceneTokenBridge.css`, exported as `@cratis/scene.components/styles`, maps Scene's `--scene-*` tokens
|
|
111
|
+
onto the `--cratis-*` names `@cratis/components` reads:
|
|
112
|
+
|
|
113
|
+
```css
|
|
114
|
+
--cratis-surface-card: var(--scene-surface-card, var(--p-content-background, var(--surface-card)));
|
|
115
|
+
/* ^ Scene theme ^ PrimeReact v11 ^ v10 legacy */
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
It extends the library's own fallback chain rather than replacing it, so a partial theme leaves the rest as
|
|
119
|
+
the PrimeReact theme had it. The rules are scoped to `[data-scene-theme-root], [data-scene-theme]` — never
|
|
120
|
+
`:root`, where `--scene-*` does not exist and every mapping would resolve to nothing.
|
|
121
|
+
|
|
122
|
+
The vocabulary is thirteen tokens, verified against `theme/themePresets.ts` in `@cratis/scene.primereact` so
|
|
123
|
+
both packages write themes in one language: `primary.color`, `primary.contrastColor`, `surface.background`,
|
|
124
|
+
`surface.card`, `surface.border`, `surface.hover`, `surface.overlay`, `text.color`, `text.mutedColor`,
|
|
125
|
+
`highlight.background`, `highlight.color`, `content.borderRadius`, `focus.ring`.
|
|
126
|
+
|
|
127
|
+
## Deliberately not covered
|
|
128
|
+
|
|
129
|
+
- **`PivotViewer`** — drags in `pixi.js`, a full WebGL renderer, into every bundle that lists this package,
|
|
130
|
+
for a faceted browser that has nothing to show at design time. An application that wants it imports it
|
|
131
|
+
directly.
|
|
132
|
+
- **`card`** — see above.
|
|
133
|
+
- **`column`** — PrimeReact's `Column` is a configuration element and belongs to the PrimeReact package;
|
|
134
|
+
a duplicate here would be a shadow with nothing behind it. Columns come through the `content` slot.
|
|
135
|
+
- **Event handlers** — Scene has no action-binding seam yet. Where a callback drives a component's own
|
|
136
|
+
visible state the adapter holds it (`useEditableCopy`), so the breadcrumb, schema editor and time machine
|
|
137
|
+
behave like themselves; where it would reach outside, the adapter exposes nothing rather than a handler
|
|
138
|
+
that quietly does nothing.
|
|
139
|
+
- **`calendarField` date bounds** — would arrive as strings and have to be parsed here; a range that silently
|
|
140
|
+
misparses is worse than none. That rule belongs in the command's validator.
|
|
141
|
+
|
|
142
|
+
## Layout
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
bindings/ the registry, BindingKind, BoundConstructor, MissingBinding, ArcRuntimeBoundary
|
|
146
|
+
pages/ page, dataPage, formElement
|
|
147
|
+
data/ dataTable, table, observableDataTable
|
|
148
|
+
forms/ commandForm; forms/fields/ the twelve field types
|
|
149
|
+
dialogs/ dialog, confirmationDialog, busyIndicatorDialog, commandDialog, stepperCommandDialog
|
|
150
|
+
common/ icon, tooltip, dropdown, errorBoundary
|
|
151
|
+
editors/ objectContentEditor, objectNavigationalBar, schemaEditor, timeMachine, filterPanel
|
|
152
|
+
toolbar/ toolbar, toolbarButton, toolbarGroup, toolbarSeparator
|
|
153
|
+
theme/ sceneTokenBridge.css
|
|
154
|
+
properties.ts narrow readers for the property bag
|
|
155
|
+
cratisComponents.ts the component registry
|
|
156
|
+
cratisComponentsPackage.ts the manifest and bundle
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Adapters are prefixed `Scene` (`ScenePage`, `SceneDataTable`) because the wrapped components carry the same
|
|
160
|
+
names — `Page`, `DataPage`, `Dialog` — and both live in the same file.
|
|
161
|
+
|
|
162
|
+
## Property reading
|
|
163
|
+
|
|
164
|
+
`properties.ts` is the only place a property-bag value is narrowed, and nothing casts. Each helper answers
|
|
165
|
+
the same way: the value when it really is of the asked-for type, `undefined` otherwise, so an adapter reads a
|
|
166
|
+
property and applies its own default in one expression.
|
|
167
|
+
|
|
168
|
+
`stringProperty`, `booleanProperty`, `numberProperty`, `arrayProperty`, `stringArrayProperty`,
|
|
169
|
+
`objectArrayProperty`, `objectProperty`, `unionProperty`.
|
|
170
|
+
|
|
171
|
+
`unionProperty(properties, 'orientation', ['vertical', 'horizontal'] as const)` is what turns an authored
|
|
172
|
+
string into one of a component's string-literal union props without an assertion.
|
|
173
|
+
|
|
174
|
+
## Gates
|
|
175
|
+
|
|
176
|
+
```bash
|
|
177
|
+
npx tsc -b # from the repository root
|
|
178
|
+
yarn build
|
|
179
|
+
yarn test
|
|
180
|
+
yarn lint:ci
|
|
181
|
+
yarn build-storybook
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Two notes on the Storybook and Vitest configuration, both worked around in this folder and both upstream
|
|
185
|
+
issues rather than ours:
|
|
186
|
+
|
|
187
|
+
- `@cratis/components@2.9.0` ships `dist/esm/TimeMachine/Properties.css` with `//` line comments, which are
|
|
188
|
+
not valid CSS. Vite 8's default lightningcss minifier rejects the whole bundle over it, so
|
|
189
|
+
`.storybook/main.ts` sets `cssMinify: 'esbuild'`.
|
|
190
|
+
- `@cratis/components` and PrimeReact are published as ESM that still uses directory imports
|
|
191
|
+
(`primereact/api`), which Node's own resolver rejects. `vite.config.mts` inlines both so Vite resolves them
|
|
192
|
+
instead.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ReactNode, Suspense } from 'react';
|
|
5
|
+
import { ErrorBoundary } from '@cratis/components/Common';
|
|
6
|
+
|
|
7
|
+
export interface ArcRuntimeBoundaryProps {
|
|
8
|
+
/** The lazily loaded, Arc-bound content this boundary isolates. */
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Isolates one Arc-bound component so that neither loading it nor failing to load it can take the
|
|
14
|
+
* surrounding screen down with it.
|
|
15
|
+
*
|
|
16
|
+
* The Arc-bound half of `@cratis/components` - `DataPage`, the data tables, `CommandForm` and its
|
|
17
|
+
* fields, every dialog - reaches `@cratis/arc` and `@cratis/arc.react` at import time. Those are peer
|
|
18
|
+
* dependencies the *host* supplies, and a design surface is not a host: Studio previews a screen without
|
|
19
|
+
* an Arc client, without a backend, and often without a single binding registered. This package
|
|
20
|
+
* therefore imports every Arc-bound component through a dynamic `import()` rather than a static one, so
|
|
21
|
+
* that a screen made only of the library's Arc-free components never pulls the Arc runtime in at all.
|
|
22
|
+
*
|
|
23
|
+
* That deferral has two visible states, and this covers both: `Suspense` while the chunk is in flight,
|
|
24
|
+
* and the library's own `ErrorBoundary` when it cannot be loaded - which is what a host without Arc
|
|
25
|
+
* installed will see. One dashed-out region, not a blank screen and not a thrown render.
|
|
26
|
+
*
|
|
27
|
+
* `ErrorBoundary` is used by composition rather than by writing another one: an error boundary is the
|
|
28
|
+
* one thing React still requires a class for, and `@cratis/components` already ships that class.
|
|
29
|
+
*/
|
|
30
|
+
export function ArcRuntimeBoundary({ children }: ArcRuntimeBoundaryProps) {
|
|
31
|
+
return (
|
|
32
|
+
<ErrorBoundary>
|
|
33
|
+
<Suspense fallback={<span data-scene-arc-loading=''>Loading</span>}>{children}</Suspense>
|
|
34
|
+
</ErrorBoundary>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
@@ -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
|
+
* What a name in a screen is expected to resolve to when it is looked up in the binding registry.
|
|
6
|
+
*
|
|
7
|
+
* Queries and commands are kept apart rather than sharing one namespace because they are opposite halves
|
|
8
|
+
* of CQRS and a screen means exactly one of them at each site: `data Invoices via query AllInvoices`
|
|
9
|
+
* cannot be satisfied by a command of the same name, and letting it be satisfied would turn a modeling
|
|
10
|
+
* mistake into a runtime one.
|
|
11
|
+
*/
|
|
12
|
+
export enum BindingKind {
|
|
13
|
+
/** An Arc query proxy - what a data table or data page reads its rows from. */
|
|
14
|
+
Query = 'query',
|
|
15
|
+
|
|
16
|
+
/** An Arc command proxy - what a command form or command dialog submits. */
|
|
17
|
+
Command = 'command',
|
|
18
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
* A class a host registers under a name - an Arc query or command proxy, as generated from the backend's
|
|
6
|
+
* `[ReadModel]` and `[Command]` types.
|
|
7
|
+
*
|
|
8
|
+
* `@cratis/components` types these as `Constructor<T>` from `@cratis/fundamentals`, constrained to
|
|
9
|
+
* `IQueryFor<T>` / a command shape. This package cannot use those types: `@cratis/arc` and
|
|
10
|
+
* `@cratis/fundamentals` are peer dependencies of `@cratis/components` that the *host* provides, and
|
|
11
|
+
* Scene deliberately does not depend on Arc - a Scene screen is a UI model, and the whole point of the
|
|
12
|
+
* registry is that Scene never needs to know what an Arc proxy is.
|
|
13
|
+
*
|
|
14
|
+
* So the registry stores the widest honest shape: something that can be constructed. Whether a
|
|
15
|
+
* registered class really is a query or a command is the host's responsibility, and it is checkable
|
|
16
|
+
* where the host registers it, with the real Arc types in scope - which is exactly where it should be.
|
|
17
|
+
*
|
|
18
|
+
* `never[]` rather than `unknown[]` for the parameters so that any constructor is assignable, regardless
|
|
19
|
+
* of what it takes; `unknown[]` would only accept constructors whose parameters accept anything.
|
|
20
|
+
*/
|
|
21
|
+
export type BoundConstructor = new (...args: never[]) => object;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 { BoundConstructor } from './BoundConstructor';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* What a screen asked for at a binding site, and what the registry could actually produce for it.
|
|
8
|
+
*
|
|
9
|
+
* The name is kept even when nothing resolved, because the two failure modes an adapter has to
|
|
10
|
+
* distinguish - "the screen named something that is not registered" and "the screen named nothing" -
|
|
11
|
+
* are only tellable apart by whether a name is present.
|
|
12
|
+
*/
|
|
13
|
+
export interface ElementBinding {
|
|
14
|
+
/** The name the screen wrote, or `undefined` when the screen set no binding property at all. */
|
|
15
|
+
name?: string;
|
|
16
|
+
|
|
17
|
+
/** The registered class, or `undefined` when nothing is registered under {@link name}. */
|
|
18
|
+
target?: BoundConstructor;
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright (c) Cratis. All rights reserved.
|
|
2
|
+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
3
|
+
|
|
4
|
+
import { ExternalComponent } from '@cratis/scene.model';
|
|
5
|
+
import { BindingKind } from './BindingKind';
|
|
6
|
+
import { Placeholder } from './Placeholder';
|
|
7
|
+
|
|
8
|
+
export interface MissingBindingProps {
|
|
9
|
+
/** The element whose binding could not be satisfied. */
|
|
10
|
+
element: ExternalComponent;
|
|
11
|
+
|
|
12
|
+
/** Whether a query or a command was wanted. */
|
|
13
|
+
kind: BindingKind;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The name the screen asked for, or `undefined` when the screen never named one. The two are
|
|
17
|
+
* different mistakes and get different messages - a screen that names `AllInvoices` needs the host
|
|
18
|
+
* to register it, while a screen that names nothing needs editing.
|
|
19
|
+
*/
|
|
20
|
+
name?: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The placeholder an Arc-bound adapter renders instead of its real component when the binding it needs
|
|
25
|
+
* is not available.
|
|
26
|
+
*
|
|
27
|
+
* It names the binding, because that is the only actionable part: the fix is either to register that
|
|
28
|
+
* name in the host or to correct the name in the screen, and the message has to be enough to tell those
|
|
29
|
+
* two apart without opening a debugger.
|
|
30
|
+
*/
|
|
31
|
+
export function MissingBinding({ element, kind, name }: MissingBindingProps) {
|
|
32
|
+
const problem = name === undefined ? `Missing ${kind} binding` : `Unresolved ${kind} binding '${name}'`;
|
|
33
|
+
return <Placeholder element={element} problem={problem} />;
|
|
34
|
+
}
|