@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,219 @@
|
|
|
1
|
+
import { combineDisposables, disposableFrom } from '../core/disposable.js';
|
|
2
|
+
import { isPermissionPath } from '../runtime/args-schema.js';
|
|
3
|
+
// Validates an AuthorManifest. Returns a list of errors; empty = ok.
|
|
4
|
+
// - plugin component names must be `<slug>.<TypeName>`
|
|
5
|
+
// - plugin command ids must be `<slug>.<...>`
|
|
6
|
+
// - permission read/write paths must use `$/scope/...` syntax
|
|
7
|
+
function validateManifest(manifest) {
|
|
8
|
+
const errors = [];
|
|
9
|
+
const slug = manifest.source.id;
|
|
10
|
+
const c = manifest.contributes;
|
|
11
|
+
for (const comp of c?.components ?? []) {
|
|
12
|
+
if (!comp.component.includes('.')) {
|
|
13
|
+
errors.push(`component "${comp.component}": plugin component names must be namespaced ` +
|
|
14
|
+
`(expected "${slug}.${comp.component}")`);
|
|
15
|
+
}
|
|
16
|
+
else if (!comp.component.startsWith(`${slug}.`)) {
|
|
17
|
+
errors.push(`component "${comp.component}": namespace must match plugin slug "${slug}"`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
for (const cmd of c?.commands ?? []) {
|
|
21
|
+
if (!cmd.id.startsWith(`${slug}.`)) {
|
|
22
|
+
errors.push(`command "${cmd.id}": id must be prefixed with plugin slug "${slug}"`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
for (const p of manifest.permissions?.read ?? []) {
|
|
26
|
+
if (!isPermissionPath(p)) {
|
|
27
|
+
errors.push(`permissions.read "${p}": not a valid path (expected "$/scope/...")`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
for (const p of manifest.permissions?.write ?? []) {
|
|
31
|
+
if (!isPermissionPath(p)) {
|
|
32
|
+
errors.push(`permissions.write "${p}": not a valid path`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return errors;
|
|
36
|
+
}
|
|
37
|
+
export function createManifestAPI(deps) {
|
|
38
|
+
const loaded = new Map();
|
|
39
|
+
async function load(manifest, _loader) {
|
|
40
|
+
const sourceId = manifest.source.id;
|
|
41
|
+
if (loaded.has(sourceId)) {
|
|
42
|
+
throw new Error(`Manifest "${sourceId}" already loaded`);
|
|
43
|
+
}
|
|
44
|
+
const errors = validateManifest(manifest);
|
|
45
|
+
if (errors.length > 0) {
|
|
46
|
+
throw new Error(`Manifest "${sourceId}" rejected:\n - ${errors.join('\n - ')}`);
|
|
47
|
+
}
|
|
48
|
+
if (manifest.permissions) {
|
|
49
|
+
deps.permissions.grant(sourceId, manifest.permissions);
|
|
50
|
+
}
|
|
51
|
+
const subs = [];
|
|
52
|
+
const c = manifest.contributes;
|
|
53
|
+
const allowedSurfaces = manifest.permissions?.surfaces;
|
|
54
|
+
if (c) {
|
|
55
|
+
for (const def of c.components ?? [])
|
|
56
|
+
subs.push(deps.components.register(def));
|
|
57
|
+
for (const t of c.converters ?? [])
|
|
58
|
+
subs.push(deps.converters.register(t));
|
|
59
|
+
for (const dp of c.dataProviders ?? [])
|
|
60
|
+
subs.push(deps.store.registerDataProvider(dp));
|
|
61
|
+
for (const cp of c.computedPaths ?? [])
|
|
62
|
+
subs.push(deps.store.computed(cp.path, cp.def));
|
|
63
|
+
for (const cmd of c.commands ?? []) {
|
|
64
|
+
subs.push(deps.commands.register({
|
|
65
|
+
id: cmd.id,
|
|
66
|
+
title: cmd.title,
|
|
67
|
+
category: cmd.category,
|
|
68
|
+
icon: cmd.icon,
|
|
69
|
+
keywords: cmd.keywords,
|
|
70
|
+
slots: cmd.slots,
|
|
71
|
+
args: cmd.args,
|
|
72
|
+
dispatch: cmd.dispatch,
|
|
73
|
+
run: undefined,
|
|
74
|
+
}));
|
|
75
|
+
}
|
|
76
|
+
for (const kb of c.keybindings ?? []) {
|
|
77
|
+
subs.push(deps.keybindings.register({
|
|
78
|
+
keys: kb.keys,
|
|
79
|
+
commandId: kb.commandId,
|
|
80
|
+
args: kb.args,
|
|
81
|
+
when: kb.when,
|
|
82
|
+
scope: kb.scope,
|
|
83
|
+
}));
|
|
84
|
+
}
|
|
85
|
+
for (const ck of c.contextKeys ?? []) {
|
|
86
|
+
deps.store.set(ck.key, ck.value);
|
|
87
|
+
}
|
|
88
|
+
for (const view of c.views ?? []) {
|
|
89
|
+
if (allowedSurfaces && !allowedSurfaces.includes(view.surface)) {
|
|
90
|
+
deps.events.emit('scena:permission:denied', {
|
|
91
|
+
sourceId,
|
|
92
|
+
kind: 'surface',
|
|
93
|
+
path: view.surface,
|
|
94
|
+
});
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const component = typeof view.component === 'string'
|
|
98
|
+
? {
|
|
99
|
+
component: 'MissingComponent',
|
|
100
|
+
reason: 'graph-module-not-resolved',
|
|
101
|
+
}
|
|
102
|
+
: view.component;
|
|
103
|
+
subs.push(deps.surfaces.mount({
|
|
104
|
+
surface: view.surface,
|
|
105
|
+
key: view.key,
|
|
106
|
+
when: view.when,
|
|
107
|
+
resource: component,
|
|
108
|
+
policy: view.policy,
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const dispose = combineDisposables(...subs, disposableFrom(() => {
|
|
113
|
+
deps.permissions.revoke(sourceId);
|
|
114
|
+
loaded.delete(sourceId);
|
|
115
|
+
deps.events.emit('scena:plugin:unloaded', { sourceId });
|
|
116
|
+
}));
|
|
117
|
+
loaded.set(sourceId, { source: manifest.source, dispose });
|
|
118
|
+
deps.events.emit('scena:plugin:contributed', {
|
|
119
|
+
sourceId,
|
|
120
|
+
version: manifest.source.version,
|
|
121
|
+
});
|
|
122
|
+
return dispose;
|
|
123
|
+
}
|
|
124
|
+
// Bridges RuntimeManifestJSON → AuthorManifest by lifting module specifiers
|
|
125
|
+
// into lazy loader.resolve() calls, then delegates to load().
|
|
126
|
+
async function loadRuntime(manifest, loader) {
|
|
127
|
+
const c = manifest.contributes;
|
|
128
|
+
const components = (c?.components ?? []).map((rc) => {
|
|
129
|
+
if (rc.renderer.kind === 'template') {
|
|
130
|
+
return {
|
|
131
|
+
component: rc.component,
|
|
132
|
+
category: rc.category,
|
|
133
|
+
propsSchema: rc.propsSchema,
|
|
134
|
+
fallback: rc.fallback,
|
|
135
|
+
renderer: { kind: 'template', template: rc.renderer.template },
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
if (rc.renderer.kind === 'react') {
|
|
139
|
+
const moduleSpec = rc.renderer.module;
|
|
140
|
+
return {
|
|
141
|
+
component: rc.component,
|
|
142
|
+
category: rc.category,
|
|
143
|
+
propsSchema: rc.propsSchema,
|
|
144
|
+
fallback: rc.fallback,
|
|
145
|
+
renderer: {
|
|
146
|
+
kind: 'react',
|
|
147
|
+
load: async () => {
|
|
148
|
+
const mod = await loader.resolve(moduleSpec, manifest.source);
|
|
149
|
+
return mod;
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
const moduleSpec = rc.renderer.module;
|
|
155
|
+
return {
|
|
156
|
+
component: rc.component,
|
|
157
|
+
category: rc.category,
|
|
158
|
+
propsSchema: rc.propsSchema,
|
|
159
|
+
fallback: rc.fallback,
|
|
160
|
+
renderer: {
|
|
161
|
+
kind: 'html',
|
|
162
|
+
mount: (host, props) => {
|
|
163
|
+
let disposed = false;
|
|
164
|
+
let inner = null;
|
|
165
|
+
void loader.resolve(moduleSpec, manifest.source).then((mod) => {
|
|
166
|
+
if (disposed)
|
|
167
|
+
return;
|
|
168
|
+
const fn = mod.default ??
|
|
169
|
+
mod;
|
|
170
|
+
const result = fn(host, props);
|
|
171
|
+
inner = result ?? null;
|
|
172
|
+
});
|
|
173
|
+
return disposableFrom(() => {
|
|
174
|
+
disposed = true;
|
|
175
|
+
inner?.dispose();
|
|
176
|
+
});
|
|
177
|
+
},
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
const bridged = {
|
|
182
|
+
source: manifest.source,
|
|
183
|
+
requires: manifest.requires,
|
|
184
|
+
engine: manifest.engine,
|
|
185
|
+
permissions: manifest.permissions,
|
|
186
|
+
contributes: c
|
|
187
|
+
? {
|
|
188
|
+
components,
|
|
189
|
+
commands: c.commands?.map((cmd) => ({
|
|
190
|
+
id: cmd.id,
|
|
191
|
+
title: cmd.title,
|
|
192
|
+
category: cmd.category,
|
|
193
|
+
icon: cmd.icon,
|
|
194
|
+
keywords: cmd.keywords,
|
|
195
|
+
slots: cmd.slots,
|
|
196
|
+
when: cmd.when,
|
|
197
|
+
args: cmd.args,
|
|
198
|
+
dispatch: cmd.dispatch,
|
|
199
|
+
run: cmd.run,
|
|
200
|
+
})),
|
|
201
|
+
keybindings: c.keybindings,
|
|
202
|
+
contextKeys: c.contextKeys,
|
|
203
|
+
views: c.views,
|
|
204
|
+
}
|
|
205
|
+
: undefined,
|
|
206
|
+
};
|
|
207
|
+
return load(bridged, loader);
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
load,
|
|
211
|
+
loadRuntime,
|
|
212
|
+
unload(sourceId) {
|
|
213
|
+
loaded.get(sourceId)?.dispose.dispose();
|
|
214
|
+
},
|
|
215
|
+
listSources() {
|
|
216
|
+
return [...loaded.values()].map((e) => e.source);
|
|
217
|
+
},
|
|
218
|
+
};
|
|
219
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EventBus } from '../types/events.js';
|
|
2
|
+
import type { ReactiveStore } from '../types/reactive-store.js';
|
|
3
|
+
import type { MountSurfaceRegistry } from '../types/mount-surface.js';
|
|
4
|
+
import type { SessionAPI, SessionStorage } from '../types/session.js';
|
|
5
|
+
import type { ComponentRegistry } from '../types/component-registry.js';
|
|
6
|
+
interface Deps {
|
|
7
|
+
events: EventBus;
|
|
8
|
+
store: ReactiveStore;
|
|
9
|
+
surfaces: MountSurfaceRegistry;
|
|
10
|
+
components: ComponentRegistry;
|
|
11
|
+
storage?: SessionStorage;
|
|
12
|
+
}
|
|
13
|
+
export declare function createSessionAPI(deps: Deps): SessionAPI & {
|
|
14
|
+
setStorage(s: SessionStorage | null): void;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { disposableFrom } from '../core/disposable.js';
|
|
2
|
+
const ALL_SURFACES = [
|
|
3
|
+
'titlebar',
|
|
4
|
+
'activitybar',
|
|
5
|
+
'sidebar:left',
|
|
6
|
+
'sidebar:right',
|
|
7
|
+
'main',
|
|
8
|
+
'panel:bottom',
|
|
9
|
+
'statusbar',
|
|
10
|
+
'overlay',
|
|
11
|
+
'detached',
|
|
12
|
+
];
|
|
13
|
+
export function createSessionAPI(deps) {
|
|
14
|
+
const { events, surfaces, components } = deps;
|
|
15
|
+
let storage = deps.storage ?? null;
|
|
16
|
+
let autoPersistTimer = null;
|
|
17
|
+
let autoPersistSub = null;
|
|
18
|
+
function snapshot() {
|
|
19
|
+
const mounts = [];
|
|
20
|
+
for (const surface of ALL_SURFACES) {
|
|
21
|
+
for (const m of surfaces.listAt(surface)) {
|
|
22
|
+
mounts.push({
|
|
23
|
+
key: m.key,
|
|
24
|
+
surface: m.surface,
|
|
25
|
+
component: m.component,
|
|
26
|
+
state: {},
|
|
27
|
+
openedAt: m.openedAt,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
version: 1,
|
|
33
|
+
capturedAt: Date.now(),
|
|
34
|
+
mounts,
|
|
35
|
+
surfaces: {},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async function restore(snap) {
|
|
39
|
+
const restored = [];
|
|
40
|
+
const skipped = [];
|
|
41
|
+
for (const sm of snap.mounts) {
|
|
42
|
+
if (!components.get(sm.component.component)) {
|
|
43
|
+
skipped.push(sm);
|
|
44
|
+
events.emit('scena:session:skipped', {
|
|
45
|
+
key: sm.key,
|
|
46
|
+
surface: sm.surface,
|
|
47
|
+
reason: `component "${sm.component.component}" not registered`,
|
|
48
|
+
});
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
restored.push(surfaces.open({
|
|
52
|
+
surface: sm.surface,
|
|
53
|
+
key: sm.key,
|
|
54
|
+
resource: sm.component,
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
return { restored, skipped };
|
|
58
|
+
}
|
|
59
|
+
async function save() {
|
|
60
|
+
if (!storage)
|
|
61
|
+
return;
|
|
62
|
+
await storage.save(snapshot());
|
|
63
|
+
}
|
|
64
|
+
function enableAutoPersist(opts) {
|
|
65
|
+
const debounce = opts?.debounceMs ?? 1000;
|
|
66
|
+
const schedule = () => {
|
|
67
|
+
if (autoPersistTimer)
|
|
68
|
+
clearTimeout(autoPersistTimer);
|
|
69
|
+
autoPersistTimer = setTimeout(() => {
|
|
70
|
+
autoPersistTimer = null;
|
|
71
|
+
void save();
|
|
72
|
+
}, debounce);
|
|
73
|
+
};
|
|
74
|
+
autoPersistSub?.dispose();
|
|
75
|
+
autoPersistSub = events.on('scena:mount:opened', schedule);
|
|
76
|
+
const closedSub = events.on('scena:mount:closed', schedule);
|
|
77
|
+
return disposableFrom(() => {
|
|
78
|
+
autoPersistSub?.dispose();
|
|
79
|
+
closedSub.dispose();
|
|
80
|
+
autoPersistSub = null;
|
|
81
|
+
if (autoPersistTimer)
|
|
82
|
+
clearTimeout(autoPersistTimer);
|
|
83
|
+
autoPersistTimer = null;
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
snapshot,
|
|
88
|
+
restore,
|
|
89
|
+
save,
|
|
90
|
+
enableAutoPersist,
|
|
91
|
+
setStorage(s) {
|
|
92
|
+
storage = s;
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { disposableFrom } from '../core/disposable.js';
|
|
2
|
+
export function createShellRegistry(deps) {
|
|
3
|
+
const { events } = deps;
|
|
4
|
+
const shells = new Map();
|
|
5
|
+
let activeId = deps.initialId ?? null;
|
|
6
|
+
function announce() {
|
|
7
|
+
events.emit('scena:registry:changed', { registry: 'shells' });
|
|
8
|
+
}
|
|
9
|
+
return {
|
|
10
|
+
register(def) {
|
|
11
|
+
shells.set(def.id, def);
|
|
12
|
+
if (!activeId) {
|
|
13
|
+
activeId = def.id;
|
|
14
|
+
events.emit('scena:shell:changed', { shellId: def.id });
|
|
15
|
+
}
|
|
16
|
+
announce();
|
|
17
|
+
return disposableFrom(() => {
|
|
18
|
+
if (shells.get(def.id) === def) {
|
|
19
|
+
shells.delete(def.id);
|
|
20
|
+
if (activeId === def.id)
|
|
21
|
+
activeId = null;
|
|
22
|
+
announce();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
unregister(id) {
|
|
27
|
+
if (shells.delete(id)) {
|
|
28
|
+
if (activeId === id)
|
|
29
|
+
activeId = null;
|
|
30
|
+
announce();
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
list() {
|
|
34
|
+
return [...shells.values()];
|
|
35
|
+
},
|
|
36
|
+
setActive(id) {
|
|
37
|
+
if (!shells.has(id))
|
|
38
|
+
throw new Error(`Shell "${id}" not registered`);
|
|
39
|
+
if (activeId === id)
|
|
40
|
+
return;
|
|
41
|
+
activeId = id;
|
|
42
|
+
events.emit('scena:shell:changed', { shellId: id });
|
|
43
|
+
},
|
|
44
|
+
getActive() {
|
|
45
|
+
return activeId ? shells.get(activeId) ?? null : null;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { LayoutStorage } from '../../types/layout.js';
|
|
2
|
+
export interface LocalStorageLayoutStorageOptions {
|
|
3
|
+
key?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function createLocalStorageLayoutStorage(opts?: LocalStorageLayoutStorageOptions): LayoutStorage;
|
|
6
|
+
export declare function createNoopLayoutStorage(): LayoutStorage;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Browser localStorage-backed LayoutStorage. Pass to createScena
|
|
2
|
+
// via opts.layoutStorage. Falls back to a no-op store on environments
|
|
3
|
+
// where localStorage is unavailable (e.g., SSR).
|
|
4
|
+
export function createLocalStorageLayoutStorage(opts = {}) {
|
|
5
|
+
const key = opts.key ?? 'scena.layout';
|
|
6
|
+
const available = typeof localStorage !== 'undefined';
|
|
7
|
+
return {
|
|
8
|
+
async load() {
|
|
9
|
+
if (!available)
|
|
10
|
+
return null;
|
|
11
|
+
const raw = localStorage.getItem(key);
|
|
12
|
+
if (!raw)
|
|
13
|
+
return null;
|
|
14
|
+
try {
|
|
15
|
+
return JSON.parse(raw);
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
async save(layout) {
|
|
22
|
+
if (!available)
|
|
23
|
+
return;
|
|
24
|
+
try {
|
|
25
|
+
localStorage.setItem(key, JSON.stringify(layout));
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
// Quota or permission error — silently drop. Step 5 doesn't surface this;
|
|
29
|
+
// an alerter / metrics hook can be added later.
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
async clear() {
|
|
33
|
+
if (!available)
|
|
34
|
+
return;
|
|
35
|
+
localStorage.removeItem(key);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function createNoopLayoutStorage() {
|
|
40
|
+
return {
|
|
41
|
+
async load() {
|
|
42
|
+
return null;
|
|
43
|
+
},
|
|
44
|
+
async save() { },
|
|
45
|
+
async clear() { },
|
|
46
|
+
};
|
|
47
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Browser localStorage-backed SessionStorage. Pass to createScena via
|
|
2
|
+
// opts.sessionStorage, then drive restore()/enableAutoPersist() from the app
|
|
3
|
+
// once components are registered. Falls back to a no-op on environments where
|
|
4
|
+
// localStorage is unavailable (e.g., SSR).
|
|
5
|
+
export function createLocalStorageSessionStorage(opts = {}) {
|
|
6
|
+
const key = opts.key ?? 'scena.session';
|
|
7
|
+
const available = typeof localStorage !== 'undefined';
|
|
8
|
+
return {
|
|
9
|
+
async load() {
|
|
10
|
+
if (!available)
|
|
11
|
+
return null;
|
|
12
|
+
const raw = localStorage.getItem(key);
|
|
13
|
+
if (!raw)
|
|
14
|
+
return null;
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(raw);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
async save(snapshot) {
|
|
23
|
+
if (!available)
|
|
24
|
+
return;
|
|
25
|
+
try {
|
|
26
|
+
localStorage.setItem(key, JSON.stringify(snapshot));
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Quota or permission error — silently drop, matching the layout store.
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
async clear() {
|
|
33
|
+
if (!available)
|
|
34
|
+
return;
|
|
35
|
+
localStorage.removeItem(key);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
}
|