@softov/scena 0.1.2
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/LICENSE +21 -0
- package/README.md +42 -0
- package/dist/controls/command.d.ts +18 -0
- package/dist/controls/command.js +150 -0
- package/dist/controls/events.d.ts +3 -0
- package/dist/controls/events.js +43 -0
- package/dist/controls/index.d.ts +10 -0
- package/dist/controls/index.js +10 -0
- package/dist/controls/keybinding.d.ts +9 -0
- package/dist/controls/keybinding.js +94 -0
- package/dist/controls/layout.d.ts +16 -0
- package/dist/controls/layout.js +201 -0
- package/dist/controls/manifest.d.ts +21 -0
- package/dist/controls/manifest.js +219 -0
- package/dist/controls/session.d.ts +16 -0
- package/dist/controls/session.js +95 -0
- package/dist/controls/shell.d.ts +8 -0
- package/dist/controls/shell.js +48 -0
- package/dist/controls/storage/layout-local.d.ts +6 -0
- package/dist/controls/storage/layout-local.js +47 -0
- package/dist/controls/storage/session-local.d.ts +5 -0
- package/dist/controls/storage/session-local.js +38 -0
- package/dist/controls/when.d.ts +7 -0
- package/dist/controls/when.js +226 -0
- package/dist/converters/a2ui-v0.10.d.ts +23 -0
- package/dist/converters/a2ui-v0.10.js +136 -0
- package/dist/converters/index.d.ts +1 -0
- package/dist/converters/index.js +1 -0
- package/dist/core/backends/modus-backend.d.ts +13 -0
- package/dist/core/backends/modus-backend.js +115 -0
- package/dist/core/backends/storage-backend.d.ts +7 -0
- package/dist/core/backends/storage-backend.js +73 -0
- package/dist/core/backends/yjs-backend.d.ts +3 -0
- package/dist/core/backends/yjs-backend.js +44 -0
- package/dist/core/binding-resolver.d.ts +7 -0
- package/dist/core/binding-resolver.js +106 -0
- package/dist/core/component-graph.d.ts +6 -0
- package/dist/core/component-graph.js +77 -0
- package/dist/core/component-registry.d.ts +7 -0
- package/dist/core/component-registry.js +87 -0
- package/dist/core/computed-dsl.d.ts +2 -0
- package/dist/core/computed-dsl.js +267 -0
- package/dist/core/converter-registry.d.ts +2 -0
- package/dist/core/converter-registry.js +37 -0
- package/dist/core/disposable.d.ts +3 -0
- package/dist/core/disposable.js +19 -0
- package/dist/core/dynamic-resolver.d.ts +12 -0
- package/dist/core/dynamic-resolver.js +134 -0
- package/dist/core/index.d.ts +44 -0
- package/dist/core/index.js +48 -0
- package/dist/core/label.d.ts +2 -0
- package/dist/core/label.js +14 -0
- package/dist/core/mount-menu.d.ts +2 -0
- package/dist/core/mount-menu.js +23 -0
- package/dist/core/mount-surface.d.ts +15 -0
- package/dist/core/mount-surface.js +214 -0
- package/dist/core/path-resolver.d.ts +14 -0
- package/dist/core/path-resolver.js +169 -0
- package/dist/core/permissions.d.ts +2 -0
- package/dist/core/permissions.js +50 -0
- package/dist/core/reactive-store.d.ts +17 -0
- package/dist/core/reactive-store.js +496 -0
- package/dist/core/scena.d.ts +2 -0
- package/dist/core/scena.js +115 -0
- package/dist/core/surface-presentation.d.ts +6 -0
- package/dist/core/surface-presentation.js +12 -0
- package/dist/i18n/i18n-backend.d.ts +2 -0
- package/dist/i18n/i18n-backend.js +35 -0
- package/dist/i18n/registry.d.ts +32 -0
- package/dist/i18n/registry.js +200 -0
- package/dist/porta/Limen.css +50 -0
- package/dist/porta/Limen.d.ts +16 -0
- package/dist/porta/Limen.js +14 -0
- package/dist/porta/PortaContext.d.ts +10 -0
- package/dist/porta/PortaContext.js +20 -0
- package/dist/porta/PortaLock.css +14 -0
- package/dist/porta/PortaLock.d.ts +10 -0
- package/dist/porta/PortaLock.js +13 -0
- package/dist/porta/SigillumGate.d.ts +8 -0
- package/dist/porta/SigillumGate.js +7 -0
- package/dist/porta/commands.d.ts +3 -0
- package/dist/porta/commands.js +125 -0
- package/dist/porta/index.d.ts +18 -0
- package/dist/porta/index.js +22 -0
- package/dist/porta/login-form.block.d.ts +2 -0
- package/dist/porta/login-form.block.js +7 -0
- package/dist/porta/match.d.ts +2 -0
- package/dist/porta/match.js +20 -0
- package/dist/porta/provider.d.ts +59 -0
- package/dist/porta/provider.js +1 -0
- package/dist/porta/providers/examples/google-oauth.d.ts +6 -0
- package/dist/porta/providers/examples/google-oauth.js +21 -0
- package/dist/porta/providers/examples/index.d.ts +6 -0
- package/dist/porta/providers/examples/index.js +3 -0
- package/dist/porta/providers/examples/magic-link.d.ts +8 -0
- package/dist/porta/providers/examples/magic-link.js +31 -0
- package/dist/porta/providers/examples/sms-otp.d.ts +9 -0
- package/dist/porta/providers/examples/sms-otp.js +31 -0
- package/dist/porta/providers/password.d.ts +12 -0
- package/dist/porta/providers/password.js +46 -0
- package/dist/porta/register-blocks.d.ts +3 -0
- package/dist/porta/register-blocks.js +31 -0
- package/dist/porta/register.d.ts +15 -0
- package/dist/porta/register.js +31 -0
- package/dist/porta/sigillum.d.ts +19 -0
- package/dist/porta/sigillum.js +41 -0
- package/dist/react/DefaultShell.d.ts +1 -0
- package/dist/react/DefaultShell.js +37 -0
- package/dist/react/Scena.d.ts +9 -0
- package/dist/react/Scena.js +20 -0
- package/dist/react/ScenaProvider.d.ts +8 -0
- package/dist/react/ScenaProvider.js +13 -0
- package/dist/react/ShellSplitter.d.ts +13 -0
- package/dist/react/ShellSplitter.js +88 -0
- package/dist/react/SurfaceArea.d.ts +13 -0
- package/dist/react/SurfaceArea.js +75 -0
- package/dist/react/Translate.d.ts +8 -0
- package/dist/react/Translate.js +10 -0
- package/dist/react/ViewMount.d.ts +12 -0
- package/dist/react/ViewMount.js +268 -0
- package/dist/react/core.d.ts +6 -0
- package/dist/react/core.js +10 -0
- package/dist/react/hooks/useCommand.d.ts +1 -0
- package/dist/react/hooks/useCommand.js +6 -0
- package/dist/react/hooks/useI18n.d.ts +9 -0
- package/dist/react/hooks/useI18n.js +16 -0
- package/dist/react/hooks/useLabel.d.ts +2 -0
- package/dist/react/hooks/useLabel.js +19 -0
- package/dist/react/hooks/useLayout.d.ts +2 -0
- package/dist/react/hooks/useLayout.js +10 -0
- package/dist/react/hooks/useMounts.d.ts +2 -0
- package/dist/react/hooks/useMounts.js +17 -0
- package/dist/react/hooks/useStore.d.ts +3 -0
- package/dist/react/hooks/useStore.js +40 -0
- package/dist/react/hooks/useStoreLabel.d.ts +3 -0
- package/dist/react/hooks/useStoreLabel.js +25 -0
- package/dist/react/hooks/useSurfacePresentation.d.ts +4 -0
- package/dist/react/hooks/useSurfacePresentation.js +16 -0
- package/dist/react/index.d.ts +20 -0
- package/dist/react/index.js +20 -0
- package/dist/react/mount-context.d.ts +8 -0
- package/dist/react/mount-context.js +20 -0
- package/dist/react/useSurfaceResize.d.ts +39 -0
- package/dist/react/useSurfaceResize.js +135 -0
- package/dist/runtime/args-schema.d.ts +11 -0
- package/dist/runtime/args-schema.js +45 -0
- package/dist/runtime/builtins.d.ts +3 -0
- package/dist/runtime/builtins.js +193 -0
- package/dist/runtime/client-handlers.d.ts +3 -0
- package/dist/runtime/client-handlers.js +19 -0
- package/dist/runtime/in-memory-socket.d.ts +7 -0
- package/dist/runtime/in-memory-socket.js +53 -0
- package/dist/runtime/index.d.ts +10 -0
- package/dist/runtime/index.js +7 -0
- package/dist/runtime/layout-commands.d.ts +5 -0
- package/dist/runtime/layout-commands.js +548 -0
- package/dist/runtime/opener-commands.d.ts +17 -0
- package/dist/runtime/opener-commands.js +96 -0
- package/dist/runtime/surface-bridge.d.ts +15 -0
- package/dist/runtime/surface-bridge.js +116 -0
- package/dist/styles/bar.css +155 -0
- package/dist/styles/base.css +285 -0
- package/dist/styles/geometry.css +32 -0
- package/dist/styles/index.d.ts +29 -0
- package/dist/styles/index.js +109 -0
- package/dist/styles/scrollbar.css +45 -0
- package/dist/styles/surface.css +179 -0
- package/dist/styles/theme.css +3 -0
- package/dist/styles/themes/dark.css +30 -0
- package/dist/styles/themes/light.css +1 -0
- package/dist/styles/themes/tokens.css +222 -0
- package/dist/types/binding-resolver.d.ts +30 -0
- package/dist/types/binding-resolver.js +1 -0
- package/dist/types/colors.d.ts +7 -0
- package/dist/types/colors.js +59 -0
- package/dist/types/command.d.ts +62 -0
- package/dist/types/command.js +1 -0
- package/dist/types/component-graph.d.ts +72 -0
- package/dist/types/component-graph.js +40 -0
- package/dist/types/component-registry.d.ts +70 -0
- package/dist/types/component-registry.js +1 -0
- package/dist/types/converter-registry.d.ts +17 -0
- package/dist/types/converter-registry.js +1 -0
- package/dist/types/disposable.d.ts +3 -0
- package/dist/types/disposable.js +1 -0
- package/dist/types/events.d.ts +75 -0
- package/dist/types/events.js +1 -0
- package/dist/types/host.d.ts +50 -0
- package/dist/types/host.js +1 -0
- package/dist/types/index.d.ts +23 -0
- package/dist/types/index.js +23 -0
- package/dist/types/keybinding.d.ts +36 -0
- package/dist/types/keybinding.js +1 -0
- package/dist/types/label.d.ts +9 -0
- package/dist/types/label.js +1 -0
- package/dist/types/layout.d.ts +117 -0
- package/dist/types/layout.js +1 -0
- package/dist/types/manifest.d.ts +152 -0
- package/dist/types/manifest.js +1 -0
- package/dist/types/mount-menu.d.ts +8 -0
- package/dist/types/mount-menu.js +1 -0
- package/dist/types/mount-surface.d.ts +87 -0
- package/dist/types/mount-surface.js +1 -0
- package/dist/types/permissions.d.ts +18 -0
- package/dist/types/permissions.js +1 -0
- package/dist/types/query.d.ts +34 -0
- package/dist/types/query.js +7 -0
- package/dist/types/reactive-store.d.ts +39 -0
- package/dist/types/reactive-store.js +1 -0
- package/dist/types/scena.d.ts +53 -0
- package/dist/types/scena.js +1 -0
- package/dist/types/scope-backend.d.ts +16 -0
- package/dist/types/scope-backend.js +1 -0
- package/dist/types/session.d.ts +39 -0
- package/dist/types/session.js +1 -0
- package/dist/types/shell.d.ts +21 -0
- package/dist/types/shell.js +1 -0
- package/dist/types/when.d.ts +10 -0
- package/dist/types/when.js +1 -0
- package/dist/ui/_utils.d.ts +8 -0
- package/dist/ui/_utils.js +53 -0
- package/dist/ui/campus/CampusMappa.d.ts +18 -0
- package/dist/ui/campus/CampusMappa.js +106 -0
- package/dist/ui/campus/CampusNodus.d.ts +25 -0
- package/dist/ui/campus/CampusNodus.js +211 -0
- package/dist/ui/campus/CampusStratum.d.ts +13 -0
- package/dist/ui/campus/CampusStratum.js +20 -0
- package/dist/ui/campus/CampusVelum.d.ts +7 -0
- package/dist/ui/campus/CampusVelum.js +12 -0
- package/dist/ui/campus/CampusView.d.ts +27 -0
- package/dist/ui/campus/CampusView.js +420 -0
- package/dist/ui/campus/context.d.ts +13 -0
- package/dist/ui/campus/context.js +12 -0
- package/dist/ui/campus/index.d.ts +14 -0
- package/dist/ui/campus/index.js +11 -0
- package/dist/ui/campus/stratum-context.d.ts +2 -0
- package/dist/ui/campus/stratum-context.js +10 -0
- package/dist/ui/campus/types.d.ts +47 -0
- package/dist/ui/campus/types.js +4 -0
- package/dist/ui/chart/BarChart.css +53 -0
- package/dist/ui/chart/BarChart.d.ts +24 -0
- package/dist/ui/chart/BarChart.js +32 -0
- package/dist/ui/chart/Donut.css +15 -0
- package/dist/ui/chart/Donut.d.ts +15 -0
- package/dist/ui/chart/Donut.js +18 -0
- package/dist/ui/chart/LineChart.css +8 -0
- package/dist/ui/chart/LineChart.d.ts +24 -0
- package/dist/ui/chart/LineChart.js +29 -0
- package/dist/ui/chart/catalog.d.ts +2 -0
- package/dist/ui/chart/catalog.js +7 -0
- package/dist/ui/chart/index.d.ts +6 -0
- package/dist/ui/chart/index.js +4 -0
- package/dist/ui/control/Button.css +7 -0
- package/dist/ui/control/Button.d.ts +17 -0
- package/dist/ui/control/Button.js +17 -0
- package/dist/ui/control/CheckBox.css +16 -0
- package/dist/ui/control/CheckBox.d.ts +15 -0
- package/dist/ui/control/CheckBox.js +23 -0
- package/dist/ui/control/Checks.css +6 -0
- package/dist/ui/control/Checks.d.ts +9 -0
- package/dist/ui/control/Checks.js +10 -0
- package/dist/ui/control/ChoicePicker.css +16 -0
- package/dist/ui/control/ChoicePicker.d.ts +25 -0
- package/dist/ui/control/ChoicePicker.js +38 -0
- package/dist/ui/control/DateTimeInput.css +1 -0
- package/dist/ui/control/DateTimeInput.d.ts +22 -0
- package/dist/ui/control/DateTimeInput.js +41 -0
- package/dist/ui/control/LocaleToggle.css +38 -0
- package/dist/ui/control/LocaleToggle.d.ts +11 -0
- package/dist/ui/control/LocaleToggle.js +23 -0
- package/dist/ui/control/ReloadButton.d.ts +6 -0
- package/dist/ui/control/ReloadButton.js +9 -0
- package/dist/ui/control/Slider.css +2 -0
- package/dist/ui/control/Slider.d.ts +21 -0
- package/dist/ui/control/Slider.js +37 -0
- package/dist/ui/control/TextField.css +0 -0
- package/dist/ui/control/TextField.d.ts +25 -0
- package/dist/ui/control/TextField.js +36 -0
- package/dist/ui/control/_field-parts.css +102 -0
- package/dist/ui/control/_field-parts.d.ts +15 -0
- package/dist/ui/control/_field-parts.js +17 -0
- package/dist/ui/control/catalog.d.ts +2 -0
- package/dist/ui/control/catalog.js +10 -0
- package/dist/ui/control/index.d.ts +13 -0
- package/dist/ui/control/index.js +11 -0
- package/dist/ui/data/DataTable.d.ts +19 -0
- package/dist/ui/data/DataTable.js +20 -0
- package/dist/ui/data/Filter.d.ts +13 -0
- package/dist/ui/data/Filter.js +56 -0
- package/dist/ui/data/List.css +16 -0
- package/dist/ui/data/List.d.ts +15 -0
- package/dist/ui/data/List.js +18 -0
- package/dist/ui/data/Listable.css +245 -0
- package/dist/ui/data/Listable.d.ts +60 -0
- package/dist/ui/data/Listable.js +209 -0
- package/dist/ui/data/Pagination.d.ts +5 -0
- package/dist/ui/data/Pagination.js +43 -0
- package/dist/ui/data/Tree.css +118 -0
- package/dist/ui/data/Tree.d.ts +45 -0
- package/dist/ui/data/Tree.js +170 -0
- package/dist/ui/data/catalog.d.ts +2 -0
- package/dist/ui/data/catalog.js +7 -0
- package/dist/ui/data/index.d.ts +11 -0
- package/dist/ui/data/index.js +7 -0
- package/dist/ui/display/AddPlaceholder.d.ts +6 -0
- package/dist/ui/display/AddPlaceholder.js +24 -0
- package/dist/ui/display/Alert.css +42 -0
- package/dist/ui/display/Alert.d.ts +14 -0
- package/dist/ui/display/Alert.js +13 -0
- package/dist/ui/display/Avatar.css +19 -0
- package/dist/ui/display/Avatar.d.ts +16 -0
- package/dist/ui/display/Avatar.js +52 -0
- package/dist/ui/display/Badge.css +26 -0
- package/dist/ui/display/Badge.d.ts +16 -0
- package/dist/ui/display/Badge.js +9 -0
- package/dist/ui/display/Card.css +15 -0
- package/dist/ui/display/Card.d.ts +11 -0
- package/dist/ui/display/Card.js +8 -0
- package/dist/ui/display/DetailContainer.d.ts +6 -0
- package/dist/ui/display/DetailContainer.js +7 -0
- package/dist/ui/display/DetailHeader.css +53 -0
- package/dist/ui/display/DetailHeader.d.ts +22 -0
- package/dist/ui/display/DetailHeader.js +8 -0
- package/dist/ui/display/DetailList.css +26 -0
- package/dist/ui/display/DetailList.d.ts +13 -0
- package/dist/ui/display/DetailList.js +5 -0
- package/dist/ui/display/DetailNotFound.d.ts +17 -0
- package/dist/ui/display/DetailNotFound.js +39 -0
- package/dist/ui/display/Divider.css +6 -0
- package/dist/ui/display/Divider.d.ts +8 -0
- package/dist/ui/display/Divider.js +16 -0
- package/dist/ui/display/Divisor.css +30 -0
- package/dist/ui/display/Divisor.d.ts +11 -0
- package/dist/ui/display/Divisor.js +43 -0
- package/dist/ui/display/Icon.css +10 -0
- package/dist/ui/display/Icon.d.ts +14 -0
- package/dist/ui/display/Icon.js +144 -0
- package/dist/ui/display/Image.css +1 -0
- package/dist/ui/display/Image.d.ts +16 -0
- package/dist/ui/display/Image.js +19 -0
- package/dist/ui/display/Markdown.css +38 -0
- package/dist/ui/display/Markdown.d.ts +8 -0
- package/dist/ui/display/Markdown.js +140 -0
- package/dist/ui/display/Progress.css +39 -0
- package/dist/ui/display/Progress.d.ts +15 -0
- package/dist/ui/display/Progress.js +17 -0
- package/dist/ui/display/SectionTitle.d.ts +6 -0
- package/dist/ui/display/SectionTitle.js +6 -0
- package/dist/ui/display/Skeleton.css +20 -0
- package/dist/ui/display/Skeleton.d.ts +11 -0
- package/dist/ui/display/Skeleton.js +11 -0
- package/dist/ui/display/Spinner.css +20 -0
- package/dist/ui/display/Spinner.d.ts +12 -0
- package/dist/ui/display/Spinner.js +12 -0
- package/dist/ui/display/Svg.d.ts +13 -0
- package/dist/ui/display/Svg.js +17 -0
- package/dist/ui/display/Text.css +20 -0
- package/dist/ui/display/Text.d.ts +13 -0
- package/dist/ui/display/Text.js +15 -0
- package/dist/ui/display/catalog.d.ts +2 -0
- package/dist/ui/display/catalog.js +12 -0
- package/dist/ui/display/index.d.ts +22 -0
- package/dist/ui/display/index.js +14 -0
- package/dist/ui/embed/HtmlEmbed.d.ts +12 -0
- package/dist/ui/embed/HtmlEmbed.js +16 -0
- package/dist/ui/embed/index.d.ts +2 -0
- package/dist/ui/embed/index.js +1 -0
- package/dist/ui/forms/DangerZone.d.ts +8 -0
- package/dist/ui/forms/DangerZone.js +31 -0
- package/dist/ui/forms/Field.css +15 -0
- package/dist/ui/forms/Field.d.ts +28 -0
- package/dist/ui/forms/Field.js +25 -0
- package/dist/ui/forms/FieldGroup.css +15 -0
- package/dist/ui/forms/FieldGroup.d.ts +7 -0
- package/dist/ui/forms/FieldGroup.js +7 -0
- package/dist/ui/forms/Form.css +14 -0
- package/dist/ui/forms/Form.d.ts +18 -0
- package/dist/ui/forms/Form.js +17 -0
- package/dist/ui/forms/FormActions.css +11 -0
- package/dist/ui/forms/FormActions.d.ts +18 -0
- package/dist/ui/forms/FormActions.js +10 -0
- package/dist/ui/forms/FormSection.css +19 -0
- package/dist/ui/forms/FormSection.d.ts +7 -0
- package/dist/ui/forms/FormSection.js +7 -0
- package/dist/ui/forms/LoginForm.css +105 -0
- package/dist/ui/forms/LoginForm.d.ts +12 -0
- package/dist/ui/forms/LoginForm.js +137 -0
- package/dist/ui/forms/SchemaForm.css +81 -0
- package/dist/ui/forms/SchemaForm.d.ts +26 -0
- package/dist/ui/forms/SchemaForm.js +186 -0
- package/dist/ui/forms/SettingsContainer.d.ts +8 -0
- package/dist/ui/forms/SettingsContainer.js +8 -0
- package/dist/ui/forms/catalog.d.ts +2 -0
- package/dist/ui/forms/catalog.js +11 -0
- package/dist/ui/forms/index.d.ts +19 -0
- package/dist/ui/forms/index.js +12 -0
- package/dist/ui/forms/schema-walk.d.ts +50 -0
- package/dist/ui/forms/schema-walk.js +116 -0
- package/dist/ui/index.d.ts +58 -0
- package/dist/ui/index.js +63 -0
- package/dist/ui/layout/BarLayout.d.ts +2 -0
- package/dist/ui/layout/BarLayout.js +18 -0
- package/dist/ui/layout/Column.css +6 -0
- package/dist/ui/layout/Column.d.ts +12 -0
- package/dist/ui/layout/Column.js +13 -0
- package/dist/ui/layout/FloatingLayout.d.ts +2 -0
- package/dist/ui/layout/FloatingLayout.js +12 -0
- package/dist/ui/layout/Grid.css +5 -0
- package/dist/ui/layout/Grid.d.ts +13 -0
- package/dist/ui/layout/Grid.js +19 -0
- package/dist/ui/layout/InlineLayout.d.ts +2 -0
- package/dist/ui/layout/InlineLayout.js +13 -0
- package/dist/ui/layout/MountTitle.d.ts +12 -0
- package/dist/ui/layout/MountTitle.js +42 -0
- package/dist/ui/layout/RailLayout.d.ts +2 -0
- package/dist/ui/layout/RailLayout.js +38 -0
- package/dist/ui/layout/Row.css +16 -0
- package/dist/ui/layout/Row.d.ts +13 -0
- package/dist/ui/layout/Row.js +21 -0
- package/dist/ui/layout/SectionHeader.d.ts +10 -0
- package/dist/ui/layout/SectionHeader.js +65 -0
- package/dist/ui/layout/SingleLayout.d.ts +2 -0
- package/dist/ui/layout/SingleLayout.js +25 -0
- package/dist/ui/layout/SpatialCard.d.ts +9 -0
- package/dist/ui/layout/SpatialCard.js +30 -0
- package/dist/ui/layout/SpatialLayout.d.ts +2 -0
- package/dist/ui/layout/SpatialLayout.js +446 -0
- package/dist/ui/layout/SplitLayout.d.ts +2 -0
- package/dist/ui/layout/SplitLayout.js +159 -0
- package/dist/ui/layout/Splitter.d.ts +12 -0
- package/dist/ui/layout/Splitter.js +64 -0
- package/dist/ui/layout/StackHeader.d.ts +9 -0
- package/dist/ui/layout/StackHeader.js +87 -0
- package/dist/ui/layout/StackLayout.d.ts +2 -0
- package/dist/ui/layout/StackLayout.js +137 -0
- package/dist/ui/layout/TabLayout.d.ts +2 -0
- package/dist/ui/layout/TabLayout.js +145 -0
- package/dist/ui/layout/TabPanelLayout.d.ts +20 -0
- package/dist/ui/layout/TabPanelLayout.js +615 -0
- package/dist/ui/layout/catalog.d.ts +2 -0
- package/dist/ui/layout/catalog.js +10 -0
- package/dist/ui/layout/index.d.ts +17 -0
- package/dist/ui/layout/index.js +17 -0
- package/dist/ui/layout/register.d.ts +3 -0
- package/dist/ui/layout/register.js +25 -0
- package/dist/ui/media/Audio.css +1 -0
- package/dist/ui/media/Audio.d.ts +12 -0
- package/dist/ui/media/Audio.js +8 -0
- package/dist/ui/media/Video.css +1 -0
- package/dist/ui/media/Video.d.ts +16 -0
- package/dist/ui/media/Video.js +9 -0
- package/dist/ui/media/catalog.d.ts +2 -0
- package/dist/ui/media/catalog.js +5 -0
- package/dist/ui/media/index.d.ts +2 -0
- package/dist/ui/media/index.js +3 -0
- package/dist/ui/menu/ActionList.css +262 -0
- package/dist/ui/menu/ActionList.d.ts +19 -0
- package/dist/ui/menu/ActionList.js +369 -0
- package/dist/ui/menu/ContainerMenu.d.ts +13 -0
- package/dist/ui/menu/ContainerMenu.js +57 -0
- package/dist/ui/menu/ContextMenu.d.ts +27 -0
- package/dist/ui/menu/ContextMenu.js +93 -0
- package/dist/ui/menu/index.d.ts +10 -0
- package/dist/ui/menu/index.js +7 -0
- package/dist/ui/menu/token.d.ts +22 -0
- package/dist/ui/menu/token.js +145 -0
- package/dist/ui/menu/useChatPicker.d.ts +24 -0
- package/dist/ui/menu/useChatPicker.js +210 -0
- package/dist/ui/navigation/Breadcrumb.css +30 -0
- package/dist/ui/navigation/Breadcrumb.d.ts +14 -0
- package/dist/ui/navigation/Breadcrumb.js +12 -0
- package/dist/ui/navigation/Link.css +13 -0
- package/dist/ui/navigation/Link.d.ts +18 -0
- package/dist/ui/navigation/Link.js +43 -0
- package/dist/ui/navigation/Tabs.css +39 -0
- package/dist/ui/navigation/Tabs.d.ts +18 -0
- package/dist/ui/navigation/Tabs.js +55 -0
- package/dist/ui/navigation/Toolbar.css +25 -0
- package/dist/ui/navigation/Toolbar.d.ts +12 -0
- package/dist/ui/navigation/Toolbar.js +21 -0
- package/dist/ui/navigation/catalog.d.ts +2 -0
- package/dist/ui/navigation/catalog.js +5 -0
- package/dist/ui/navigation/index.d.ts +8 -0
- package/dist/ui/navigation/index.js +5 -0
- package/dist/ui/overlay/Modal.css +35 -0
- package/dist/ui/overlay/Modal.d.ts +12 -0
- package/dist/ui/overlay/Modal.js +57 -0
- package/dist/ui/overlay/Popup.d.ts +12 -0
- package/dist/ui/overlay/Popup.js +74 -0
- package/dist/ui/overlay/catalog.d.ts +2 -0
- package/dist/ui/overlay/catalog.js +4 -0
- package/dist/ui/overlay/index.d.ts +1 -0
- package/dist/ui/overlay/index.js +2 -0
- package/dist/ui/register.d.ts +6 -0
- package/dist/ui/register.js +26 -0
- package/package.json +115 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { isAction, isDataBinding, isFunctionCall, } from '../types/component-graph.js';
|
|
2
|
+
import { readPath, writePath } from './path-resolver.js';
|
|
3
|
+
// Resolves a DynamicValue to its concrete value.
|
|
4
|
+
// literal → returned as-is
|
|
5
|
+
// DataBinding → store.get(joinAbsolute(dataCtx, path))
|
|
6
|
+
// FunctionCall → look up command, resolve args, invoke run() synchronously
|
|
7
|
+
export function resolveDynamicValue(value, dataContext, scena) {
|
|
8
|
+
if (value === null || typeof value !== 'object')
|
|
9
|
+
return value;
|
|
10
|
+
if (isDataBinding(value)) {
|
|
11
|
+
return readPath(scena.store, dataContext, value.path);
|
|
12
|
+
}
|
|
13
|
+
if (isFunctionCall(value)) {
|
|
14
|
+
return resolveFunctionCall(value, dataContext, scena);
|
|
15
|
+
}
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
function resolveArgs(args, dataContext, scena) {
|
|
19
|
+
if (!args)
|
|
20
|
+
return {};
|
|
21
|
+
const out = {};
|
|
22
|
+
for (const [k, v] of Object.entries(args)) {
|
|
23
|
+
out[k] = resolveDynamicValue(v, dataContext, scena);
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
function valueCallContext(scena) {
|
|
28
|
+
return {
|
|
29
|
+
scena,
|
|
30
|
+
store: scena.store,
|
|
31
|
+
surfaces: scena.surfaces,
|
|
32
|
+
commands: scena.commands,
|
|
33
|
+
events: scena.events,
|
|
34
|
+
source: 'graph',
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// Synchronous FunctionCall resolution — bypasses the async command bus so
|
|
38
|
+
// `{ call: 'required', args: {...} }` returns a value, not a Promise.
|
|
39
|
+
//
|
|
40
|
+
// The command bus (`scena.commands.executeFrom`) is for fire-and-forget
|
|
41
|
+
// dispatch (palette, menu, keybinding). FunctionCall as a DynamicValue source
|
|
42
|
+
// needs a real value back in the same render tick.
|
|
43
|
+
export function resolveFunctionCall(fc, dataContext, scena) {
|
|
44
|
+
const cmd = scena.commands.get(fc.call);
|
|
45
|
+
if (!cmd) {
|
|
46
|
+
if (fc.callableFrom === 'clientOnly') {
|
|
47
|
+
throw new Error(`FunctionCall "${fc.call}" callableFrom=clientOnly has no registered handler`);
|
|
48
|
+
}
|
|
49
|
+
throw new Error(`FunctionCall "${fc.call}" not registered`);
|
|
50
|
+
}
|
|
51
|
+
if (!cmd.run) {
|
|
52
|
+
throw new Error(`FunctionCall "${fc.call}" has no client run — remote-only commands ` +
|
|
53
|
+
`cannot serve as DynamicValue sources`);
|
|
54
|
+
}
|
|
55
|
+
const args = resolveArgs(fc.args, dataContext, scena);
|
|
56
|
+
return cmd.run(valueCallContext(scena), args);
|
|
57
|
+
}
|
|
58
|
+
// Async dispatch — used by Action.functionCall (click handlers). Returns
|
|
59
|
+
// a Promise so awaitable side-effects work as expected.
|
|
60
|
+
function dispatchFunctionCall(fc, dataContext, scena) {
|
|
61
|
+
const args = resolveArgs(fc.args, dataContext, scena);
|
|
62
|
+
return scena.commands.executeFrom('graph', fc.call, args);
|
|
63
|
+
}
|
|
64
|
+
function narrow(value, predicate, expected) {
|
|
65
|
+
if (predicate(value))
|
|
66
|
+
return value;
|
|
67
|
+
throw new Error(`Dynamic value type mismatch: expected ${expected}, got ${typeof value}`);
|
|
68
|
+
}
|
|
69
|
+
export function resolveDynamicString(v, dataContext, scena) {
|
|
70
|
+
if (typeof v === 'string')
|
|
71
|
+
return v;
|
|
72
|
+
const resolved = resolveDynamicValue(v, dataContext, scena);
|
|
73
|
+
return narrow(resolved, (x) => typeof x === 'string', 'string');
|
|
74
|
+
}
|
|
75
|
+
export function resolveDynamicNumber(v, dataContext, scena) {
|
|
76
|
+
if (typeof v === 'number')
|
|
77
|
+
return v;
|
|
78
|
+
const resolved = resolveDynamicValue(v, dataContext, scena);
|
|
79
|
+
return narrow(resolved, (x) => typeof x === 'number', 'number');
|
|
80
|
+
}
|
|
81
|
+
export function resolveDynamicBoolean(v, dataContext, scena) {
|
|
82
|
+
if (typeof v === 'boolean')
|
|
83
|
+
return v;
|
|
84
|
+
const resolved = resolveDynamicValue(v, dataContext, scena);
|
|
85
|
+
return narrow(resolved, (x) => typeof x === 'boolean', 'boolean');
|
|
86
|
+
}
|
|
87
|
+
export function resolveDynamicStringList(v, dataContext, scena) {
|
|
88
|
+
if (Array.isArray(v) && v.every((x) => typeof x === 'string'))
|
|
89
|
+
return v;
|
|
90
|
+
const resolved = resolveDynamicValue(v, dataContext, scena);
|
|
91
|
+
return narrow(resolved, (x) => Array.isArray(x) && x.every((y) => typeof y === 'string'), 'string[]');
|
|
92
|
+
}
|
|
93
|
+
// Returns a 0-arg async callable that performs the Action when invoked.
|
|
94
|
+
// { event: { name, context, ... } } → emits 'scena:action:event' on the bus
|
|
95
|
+
// { functionCall: { call, args } } → dispatches through the command bus
|
|
96
|
+
export function resolveAction(action, dataContext, scena, mountKey) {
|
|
97
|
+
if ('functionCall' in action) {
|
|
98
|
+
const fc = action.functionCall;
|
|
99
|
+
return () => dispatchFunctionCall(fc, dataContext, scena);
|
|
100
|
+
}
|
|
101
|
+
const ev = action.event;
|
|
102
|
+
return async () => {
|
|
103
|
+
const resolvedContext = ev.context
|
|
104
|
+
? Object.fromEntries(Object.entries(ev.context).map(([k, v]) => [
|
|
105
|
+
k,
|
|
106
|
+
resolveDynamicValue(v, dataContext, scena),
|
|
107
|
+
]))
|
|
108
|
+
: undefined;
|
|
109
|
+
scena.events.emit('scena:action:event', {
|
|
110
|
+
mountKey,
|
|
111
|
+
name: ev.name,
|
|
112
|
+
context: resolvedContext,
|
|
113
|
+
wantResponse: ev.wantResponse,
|
|
114
|
+
responsePath: ev.responsePath,
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
// Write-back for bidirectional widgets. Accepts only DataBinding form;
|
|
119
|
+
// throws on FunctionCall, on `#/` indirection, and on wildcard paths.
|
|
120
|
+
export function writeDynamic(value, dataContext, scena, next) {
|
|
121
|
+
if (!isDataBinding(value)) {
|
|
122
|
+
if (isFunctionCall(value)) {
|
|
123
|
+
throw new Error('writeDynamic: FunctionCall values are read-only');
|
|
124
|
+
}
|
|
125
|
+
if (isAction(value)) {
|
|
126
|
+
throw new Error('writeDynamic: Action values are not writable');
|
|
127
|
+
}
|
|
128
|
+
throw new Error('writeDynamic: only DataBinding values are writable');
|
|
129
|
+
}
|
|
130
|
+
writePath(scena.store, dataContext, value.path, next);
|
|
131
|
+
}
|
|
132
|
+
export function isWritableDynamic(v) {
|
|
133
|
+
return isDataBinding(v);
|
|
134
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export * from '../types/index.js';
|
|
2
|
+
export { combineDisposables, disposableFrom } from './disposable.js';
|
|
3
|
+
export { walk, clone, addIds, findById, stripMeta } from './component-graph.js';
|
|
4
|
+
export { createPermissionEngine } from './permissions.js';
|
|
5
|
+
export { createReactiveStore, localPath, rewriteLocal, clearMountLocal, } from './reactive-store.js';
|
|
6
|
+
export { createBindingResolver } from './binding-resolver.js';
|
|
7
|
+
export { resolveLabel } from './label.js';
|
|
8
|
+
export { createStorageBackend, createLocalStorageStorage, } from './backends/storage-backend.js';
|
|
9
|
+
export type { BackendStorage } from './backends/storage-backend.js';
|
|
10
|
+
export { createModusBackend, DEFAULT_MODUS_BREAKPOINTS, } from './backends/modus-backend.js';
|
|
11
|
+
export type { ModusClass, ModusBreakpoints, ModusBackendOptions, } from './backends/modus-backend.js';
|
|
12
|
+
export { resolveSurfacePresentation, isOverlaid } from './surface-presentation.js';
|
|
13
|
+
export type { PresentationPolicy } from './surface-presentation.js';
|
|
14
|
+
export { registerMessages, registerLocale, unregisterMessages, setLocale, getLocale, getLocaleInfo, listLocaleInfo, setFallbackLocale, listLocales, lookup, resolveMessage, translate, allKeys, subscribeI18n, clearMessages, } from '../i18n/registry.js';
|
|
15
|
+
export type { TranslateOptions, MessageTree, LocaleInfo, RegisterMessagesExtra, } from '../i18n/registry.js';
|
|
16
|
+
export { createI18nBackend } from '../i18n/i18n-backend.js';
|
|
17
|
+
export { createComponentRegistry } from './component-registry.js';
|
|
18
|
+
export { createConverterRegistry } from './converter-registry.js';
|
|
19
|
+
export { createMountSurfaceRegistry } from './mount-surface.js';
|
|
20
|
+
export { createScena } from './scena.js';
|
|
21
|
+
export { parsePath, joinAbsolute, joinSegments, hasWildcard, interpolatePath, readPath, writePath, scopeOf, } from './path-resolver.js';
|
|
22
|
+
export { resolveDynamicValue, resolveDynamicString, resolveDynamicNumber, resolveDynamicBoolean, resolveDynamicStringList, resolveFunctionCall, resolveAction, writeDynamic, isWritableDynamic, } from './dynamic-resolver.js';
|
|
23
|
+
export { createEventBus } from '../controls/events.js';
|
|
24
|
+
export { createWhenEngine } from '../controls/when.js';
|
|
25
|
+
export { createCommandRegistry } from '../controls/command.js';
|
|
26
|
+
export { createKeybindingRegistry } from '../controls/keybinding.js';
|
|
27
|
+
export { createLayoutAPI, createLayoutRegistry } from '../controls/layout.js';
|
|
28
|
+
export { createSessionAPI } from '../controls/session.js';
|
|
29
|
+
export { createShellRegistry } from '../controls/shell.js';
|
|
30
|
+
export { createManifestAPI } from '../controls/manifest.js';
|
|
31
|
+
export { createLocalStorageLayoutStorage, createNoopLayoutStorage, } from '../controls/storage/layout-local.js';
|
|
32
|
+
export { createLocalStorageSessionStorage } from '../controls/storage/session-local.js';
|
|
33
|
+
export { validateArgs, isPermissionPath } from '../runtime/args-schema.js';
|
|
34
|
+
export type { ValidateArgsResult } from '../runtime/args-schema.js';
|
|
35
|
+
export { createSurfaceBridge } from '../runtime/surface-bridge.js';
|
|
36
|
+
export { registerClientHandler, getClientHandler, } from '../runtime/client-handlers.js';
|
|
37
|
+
export { createInMemorySocket } from '../runtime/in-memory-socket.js';
|
|
38
|
+
export type { InMemorySocket } from '../runtime/in-memory-socket.js';
|
|
39
|
+
export { registerBuiltinFunctions } from '../runtime/builtins.js';
|
|
40
|
+
export { registerLayoutCommands } from '../runtime/layout-commands.js';
|
|
41
|
+
export { registerOpenerCommands } from '../runtime/opener-commands.js';
|
|
42
|
+
export type { RegisterOpenerCommandsOptions } from '../runtime/opener-commands.js';
|
|
43
|
+
export { a2uiV010Converter } from '../converters/a2ui-v0.10.js';
|
|
44
|
+
export type { A2uiCreateSurface, A2uiComponentSpec, A2uiConverterInput, } from '../converters/a2ui-v0.10.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Public runtime entry — re-exports the type surface alongside the factory functions.
|
|
2
|
+
export * from '../types/index.js';
|
|
3
|
+
export { combineDisposables, disposableFrom } from './disposable.js';
|
|
4
|
+
export { walk, clone, addIds, findById, stripMeta } from './component-graph.js';
|
|
5
|
+
export { createPermissionEngine } from './permissions.js';
|
|
6
|
+
export { createReactiveStore, localPath, rewriteLocal, clearMountLocal, } from './reactive-store.js';
|
|
7
|
+
export { createBindingResolver } from './binding-resolver.js';
|
|
8
|
+
// Pure Label resolver. `types/label.ts` documents this as the intended way to
|
|
9
|
+
// resolve a Label outside React (useLabel is the reactive counterpart), so it
|
|
10
|
+
// belongs on the public surface.
|
|
11
|
+
export { resolveLabel } from './label.js';
|
|
12
|
+
// Reference ScopeBackend implementations. The Yjs backend is a deep import
|
|
13
|
+
// (`core/backends/yjs-backend.js`) so the barrel never references `yjs`.
|
|
14
|
+
export { createStorageBackend, createLocalStorageStorage, } from './backends/storage-backend.js';
|
|
15
|
+
// `$/modus` — display environment (size class, orientation, pointer accuracy)
|
|
16
|
+
// published as a scope so `when` clauses can gate surfaces on it.
|
|
17
|
+
export { createModusBackend, DEFAULT_MODUS_BREAKPOINTS, } from './backends/modus-backend.js';
|
|
18
|
+
// Maps a `$/modus` size class to how each surface occupies space. The policy
|
|
19
|
+
// is supplied by the app — scena ships the mechanism, not the opinion.
|
|
20
|
+
// `isOverlaid` tells a shell whether to drop the splitter and draw a scrim.
|
|
21
|
+
export { resolveSurfacePresentation, isOverlaid } from './surface-presentation.js';
|
|
22
|
+
// i18n — registry (source of truth + active locale) + the `$/t` ScopeBackend.
|
|
23
|
+
export { registerMessages, registerLocale, unregisterMessages, setLocale, getLocale, getLocaleInfo, listLocaleInfo, setFallbackLocale, listLocales, lookup, resolveMessage, translate, allKeys, subscribeI18n, clearMessages, } from '../i18n/registry.js';
|
|
24
|
+
export { createI18nBackend } from '../i18n/i18n-backend.js';
|
|
25
|
+
export { createComponentRegistry } from './component-registry.js';
|
|
26
|
+
export { createConverterRegistry } from './converter-registry.js';
|
|
27
|
+
export { createMountSurfaceRegistry } from './mount-surface.js';
|
|
28
|
+
export { createScena } from './scena.js';
|
|
29
|
+
export { parsePath, joinAbsolute, joinSegments, hasWildcard, interpolatePath, readPath, writePath, scopeOf, } from './path-resolver.js';
|
|
30
|
+
export { resolveDynamicValue, resolveDynamicString, resolveDynamicNumber, resolveDynamicBoolean, resolveDynamicStringList, resolveFunctionCall, resolveAction, writeDynamic, isWritableDynamic, } from './dynamic-resolver.js';
|
|
31
|
+
export { createEventBus } from '../controls/events.js';
|
|
32
|
+
export { createWhenEngine } from '../controls/when.js';
|
|
33
|
+
export { createCommandRegistry } from '../controls/command.js';
|
|
34
|
+
export { createKeybindingRegistry } from '../controls/keybinding.js';
|
|
35
|
+
export { createLayoutAPI, createLayoutRegistry } from '../controls/layout.js';
|
|
36
|
+
export { createSessionAPI } from '../controls/session.js';
|
|
37
|
+
export { createShellRegistry } from '../controls/shell.js';
|
|
38
|
+
export { createManifestAPI } from '../controls/manifest.js';
|
|
39
|
+
export { createLocalStorageLayoutStorage, createNoopLayoutStorage, } from '../controls/storage/layout-local.js';
|
|
40
|
+
export { createLocalStorageSessionStorage } from '../controls/storage/session-local.js';
|
|
41
|
+
export { validateArgs, isPermissionPath } from '../runtime/args-schema.js';
|
|
42
|
+
export { createSurfaceBridge } from '../runtime/surface-bridge.js';
|
|
43
|
+
export { registerClientHandler, getClientHandler, } from '../runtime/client-handlers.js';
|
|
44
|
+
export { createInMemorySocket } from '../runtime/in-memory-socket.js';
|
|
45
|
+
export { registerBuiltinFunctions } from '../runtime/builtins.js';
|
|
46
|
+
export { registerLayoutCommands } from '../runtime/layout-commands.js';
|
|
47
|
+
export { registerOpenerCommands } from '../runtime/opener-commands.js';
|
|
48
|
+
export { a2uiV010Converter } from '../converters/a2ui-v0.10.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// the useLabel hook (reactive).
|
|
2
|
+
export function resolveLabel(label, ctx) {
|
|
3
|
+
if (label == null)
|
|
4
|
+
return '';
|
|
5
|
+
if (typeof label === 'string')
|
|
6
|
+
return label;
|
|
7
|
+
if ('t' in label)
|
|
8
|
+
return ctx.translate(label.t);
|
|
9
|
+
if ('path' in label) {
|
|
10
|
+
const v = ctx.get(label.path);
|
|
11
|
+
return v == null ? '' : String(v);
|
|
12
|
+
}
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { disposableFrom } from './disposable.js';
|
|
2
|
+
export function createMountMenuRegistry() {
|
|
3
|
+
const bySlot = new Map();
|
|
4
|
+
function register(slot, contributor) {
|
|
5
|
+
let set = bySlot.get(slot);
|
|
6
|
+
if (!set) {
|
|
7
|
+
set = new Set();
|
|
8
|
+
bySlot.set(slot, set);
|
|
9
|
+
}
|
|
10
|
+
set.add(contributor);
|
|
11
|
+
return disposableFrom(() => set.delete(contributor));
|
|
12
|
+
}
|
|
13
|
+
function collect(slot, mount) {
|
|
14
|
+
const set = bySlot.get(slot);
|
|
15
|
+
if (!set)
|
|
16
|
+
return [];
|
|
17
|
+
const out = [];
|
|
18
|
+
for (const fn of set)
|
|
19
|
+
out.push(...fn(mount));
|
|
20
|
+
return out;
|
|
21
|
+
}
|
|
22
|
+
return { register, collect };
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EventBus } from '../types/events.js';
|
|
2
|
+
import type { MountSurfaceRegistry } from '../types/mount-surface.js';
|
|
3
|
+
import type { ComponentRegistry } from '../types/component-registry.js';
|
|
4
|
+
import type { WhenEngine } from '../types/when.js';
|
|
5
|
+
import type { BindingResolver } from '../types/binding-resolver.js';
|
|
6
|
+
import type { ReactiveStore } from '../types/reactive-store.js';
|
|
7
|
+
interface Deps {
|
|
8
|
+
events: EventBus;
|
|
9
|
+
when: WhenEngine;
|
|
10
|
+
bindings: BindingResolver;
|
|
11
|
+
store: ReactiveStore;
|
|
12
|
+
components: ComponentRegistry;
|
|
13
|
+
}
|
|
14
|
+
export declare function createMountSurfaceRegistry(deps: Deps): MountSurfaceRegistry;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { isDataBinding } from '../types/component-graph.js';
|
|
2
|
+
import { combineDisposables, disposableFrom } from './disposable.js';
|
|
3
|
+
import { clearMountLocal } from './reactive-store.js';
|
|
4
|
+
const MISSING_NODE = {
|
|
5
|
+
component: 'MissingComponent',
|
|
6
|
+
reason: 'unbound',
|
|
7
|
+
};
|
|
8
|
+
export function createMountSurfaceRegistry(deps) {
|
|
9
|
+
const { events, when, store, components } = deps;
|
|
10
|
+
const mountsByKey = new Map();
|
|
11
|
+
const visibleByKey = new Set();
|
|
12
|
+
function resolveTarget(t) {
|
|
13
|
+
if (isDataBinding(t)) {
|
|
14
|
+
const value = store.get(t.path);
|
|
15
|
+
if (!value || typeof value !== 'object' || !('component' in value)) {
|
|
16
|
+
return MISSING_NODE;
|
|
17
|
+
}
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
return t;
|
|
21
|
+
}
|
|
22
|
+
function attachTargetSub(internal, target) {
|
|
23
|
+
if (!isDataBinding(target))
|
|
24
|
+
return;
|
|
25
|
+
internal.targetSub?.dispose();
|
|
26
|
+
internal.targetSub = store.subscribe(target.path, () => {
|
|
27
|
+
internal.component = resolveTarget(target);
|
|
28
|
+
if (visibleByKey.has(internal.key)) {
|
|
29
|
+
events.emit('scena:mount:opened', {
|
|
30
|
+
key: internal.key,
|
|
31
|
+
surface: internal.surface,
|
|
32
|
+
component: internal.component,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function setVisible(key, mount, next) {
|
|
38
|
+
const was = visibleByKey.has(key);
|
|
39
|
+
if (next === was)
|
|
40
|
+
return;
|
|
41
|
+
if (next) {
|
|
42
|
+
visibleByKey.add(key);
|
|
43
|
+
events.emit('scena:mount:opened', {
|
|
44
|
+
key,
|
|
45
|
+
surface: mount.surface,
|
|
46
|
+
component: mount.component,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
visibleByKey.delete(key);
|
|
51
|
+
events.emit('scena:mount:closed', { key });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
function mount(decl) {
|
|
55
|
+
const internal = {
|
|
56
|
+
key: decl.key,
|
|
57
|
+
surface: decl.surface,
|
|
58
|
+
component: resolveTarget(decl.resource),
|
|
59
|
+
props: decl.props,
|
|
60
|
+
policy: decl.policy ?? {},
|
|
61
|
+
dataContext: decl.dataContext,
|
|
62
|
+
openedAt: Date.now(),
|
|
63
|
+
decl,
|
|
64
|
+
};
|
|
65
|
+
mountsByKey.set(decl.key, internal);
|
|
66
|
+
attachTargetSub(internal, decl.resource);
|
|
67
|
+
let whenSub;
|
|
68
|
+
if (decl.when !== undefined) {
|
|
69
|
+
whenSub = when.watch(decl.when, (visible) => setVisible(decl.key, internal, visible));
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
setVisible(decl.key, internal, true);
|
|
73
|
+
}
|
|
74
|
+
return combineDisposables(whenSub, disposableFrom(() => {
|
|
75
|
+
if (mountsByKey.get(decl.key) === internal) {
|
|
76
|
+
internal.targetSub?.dispose();
|
|
77
|
+
if (visibleByKey.has(decl.key))
|
|
78
|
+
setVisible(decl.key, internal, false);
|
|
79
|
+
mountsByKey.delete(decl.key);
|
|
80
|
+
clearMountLocal(store, decl.key);
|
|
81
|
+
}
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
function open(opts) {
|
|
85
|
+
const existing = mountsByKey.get(opts.key);
|
|
86
|
+
if (existing) {
|
|
87
|
+
existing.surface = opts.surface;
|
|
88
|
+
existing.policy = opts.policy ?? existing.policy;
|
|
89
|
+
existing.dataContext = opts.dataContext ?? existing.dataContext;
|
|
90
|
+
// Re-opening an existing mount with a fresh display overrides;
|
|
91
|
+
// otherwise we keep what was there so silent re-opens (e.g. focus)
|
|
92
|
+
// don't drop the title.
|
|
93
|
+
if (opts.props)
|
|
94
|
+
existing.props = opts.props;
|
|
95
|
+
existing.targetSub?.dispose();
|
|
96
|
+
existing.component = resolveTarget(opts.resource);
|
|
97
|
+
attachTargetSub(existing, opts.resource);
|
|
98
|
+
if (!visibleByKey.has(opts.key))
|
|
99
|
+
setVisible(opts.key, existing, true);
|
|
100
|
+
focus(opts.key);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
const internal = {
|
|
104
|
+
key: opts.key,
|
|
105
|
+
surface: opts.surface,
|
|
106
|
+
component: resolveTarget(opts.resource),
|
|
107
|
+
props: opts.props,
|
|
108
|
+
policy: opts.policy ?? {},
|
|
109
|
+
dataContext: opts.dataContext,
|
|
110
|
+
openedAt: Date.now(),
|
|
111
|
+
};
|
|
112
|
+
mountsByKey.set(opts.key, internal);
|
|
113
|
+
attachTargetSub(internal, opts.resource);
|
|
114
|
+
setVisible(opts.key, internal, true);
|
|
115
|
+
focus(opts.key);
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
key: opts.key,
|
|
119
|
+
surface: opts.surface,
|
|
120
|
+
close: (closeOpts) => close(opts.key, closeOpts),
|
|
121
|
+
focus: () => focus(opts.key),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
function openResource(kind, args) {
|
|
125
|
+
if (!kind)
|
|
126
|
+
return null;
|
|
127
|
+
const id = args?.resourceId ?? store.get('$/resource/id');
|
|
128
|
+
const argsOpts = {
|
|
129
|
+
...args?.options,
|
|
130
|
+
};
|
|
131
|
+
const extraProps = args?.extraProps ?? {};
|
|
132
|
+
if (!id)
|
|
133
|
+
return null;
|
|
134
|
+
const def = components.findOpeners(kind)[0];
|
|
135
|
+
if (!def)
|
|
136
|
+
return null;
|
|
137
|
+
store.patchMany({
|
|
138
|
+
'$/resource/kind': kind,
|
|
139
|
+
'$/resource/id': id,
|
|
140
|
+
'$/active/kind': kind,
|
|
141
|
+
'$/active/id': id,
|
|
142
|
+
});
|
|
143
|
+
const key = argsOpts?.mountKey ?? `${kind}:${id}`;
|
|
144
|
+
// Data context = the record root (`$/<namespace>/byId/<id>`), built from the
|
|
145
|
+
// declared namespace. With it set, `opens.title` and the mounted component's
|
|
146
|
+
// bindings can be RELATIVE (`{ path: '/name' }`) and resolve against this
|
|
147
|
+
// record — every open path (row-click, the generic resource.open command,
|
|
148
|
+
// cross-links) gets the record-name title from one declaration, no per-id
|
|
149
|
+
// string interpolation.
|
|
150
|
+
const ns = def.opens?.namespace;
|
|
151
|
+
const dataContext = ns ? `$/${ns}/byId/${String(id)}` : argsOpts?.dataContext;
|
|
152
|
+
return open({
|
|
153
|
+
surface: argsOpts?.surface ?? def.opens?.preferredSurface ?? 'main',
|
|
154
|
+
key,
|
|
155
|
+
dataContext,
|
|
156
|
+
resource: { component: def.component, resourceId: id, ...extraProps },
|
|
157
|
+
props: {
|
|
158
|
+
title: argsOpts?.title ?? def.opens?.title,
|
|
159
|
+
icon: def.opens?.icon,
|
|
160
|
+
color: def.opens?.color,
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function close(key, opts) {
|
|
165
|
+
const mount = mountsByKey.get(key);
|
|
166
|
+
if (!mount)
|
|
167
|
+
return;
|
|
168
|
+
mount.targetSub?.dispose();
|
|
169
|
+
if (visibleByKey.has(key)) {
|
|
170
|
+
visibleByKey.delete(key);
|
|
171
|
+
events.emit('scena:mount:closed', { key, reason: opts?.reason });
|
|
172
|
+
}
|
|
173
|
+
mountsByKey.delete(key);
|
|
174
|
+
clearMountLocal(store, key);
|
|
175
|
+
}
|
|
176
|
+
function focus(key) {
|
|
177
|
+
const m = mountsByKey.get(key);
|
|
178
|
+
if (!m)
|
|
179
|
+
return;
|
|
180
|
+
events.emit('scena:mount:focused', { key, surface: m.surface });
|
|
181
|
+
}
|
|
182
|
+
function listAt(surface) {
|
|
183
|
+
const out = [];
|
|
184
|
+
for (const m of mountsByKey.values()) {
|
|
185
|
+
if (m.surface === surface && visibleByKey.has(m.key)) {
|
|
186
|
+
const { decl: _decl, targetSub: _targetSub, ...resolved } = m;
|
|
187
|
+
void _decl;
|
|
188
|
+
void _targetSub;
|
|
189
|
+
out.push(resolved);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return out.sort((a, b) => a.openedAt - b.openedAt);
|
|
193
|
+
}
|
|
194
|
+
function move(opts) {
|
|
195
|
+
const m = mountsByKey.get(opts.key);
|
|
196
|
+
if (!m)
|
|
197
|
+
return;
|
|
198
|
+
if (opts.fromSurface && m.surface !== opts.fromSurface)
|
|
199
|
+
return;
|
|
200
|
+
if (m.surface === opts.toSurface)
|
|
201
|
+
return;
|
|
202
|
+
const prev = m.surface;
|
|
203
|
+
m.surface = opts.toSurface;
|
|
204
|
+
if (visibleByKey.has(opts.key)) {
|
|
205
|
+
events.emit('scena:mount:closed', { key: opts.key, reason: `move:from:${prev}` });
|
|
206
|
+
events.emit('scena:mount:opened', {
|
|
207
|
+
key: opts.key,
|
|
208
|
+
surface: opts.toSurface,
|
|
209
|
+
component: m.component,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return { mount, open, openResource, close, focus, listAt, move };
|
|
214
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BindingPath } from '../types/component-graph.js';
|
|
2
|
+
import type { ReactiveStore, ScopeName } from '../types/reactive-store.js';
|
|
3
|
+
export interface ParsedPath {
|
|
4
|
+
absolute: boolean;
|
|
5
|
+
segments: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function parsePath(path: string): ParsedPath;
|
|
8
|
+
export declare function scopeOf(path: BindingPath): ScopeName;
|
|
9
|
+
export declare function joinAbsolute(dataContext: BindingPath | undefined, path: BindingPath): BindingPath;
|
|
10
|
+
export declare function joinSegments(segments: string[]): BindingPath;
|
|
11
|
+
export declare function hasWildcard(path: BindingPath): boolean;
|
|
12
|
+
export declare function interpolatePath(store: ReactiveStore, dataContext: BindingPath | undefined, raw: string, depth?: number): string;
|
|
13
|
+
export declare function readPath(store: ReactiveStore, dataContext: BindingPath | undefined, path: BindingPath, depth?: number): unknown;
|
|
14
|
+
export declare function writePath(store: ReactiveStore, dataContext: BindingPath | undefined, path: BindingPath, value: unknown): void;
|