@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,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useScena } from '../../react/ScenaProvider.js';
|
|
3
|
+
import { SectionHeader } from './SectionHeader.js';
|
|
4
|
+
import { useMountTitle } from './MountTitle.js';
|
|
5
|
+
// One mount fills the surface; no tab strip. Active mount picked via
|
|
6
|
+
// `state.activeContainerKey`, falling back to the most recently opened. When the
|
|
7
|
+
// active mount declares a title/icon/actions (mount.props ?? component.props), a
|
|
8
|
+
// SectionHeader strip renders above it — this is how sidebar sections get their
|
|
9
|
+
// `[icon Title] [actions] [⋯]` header.
|
|
10
|
+
export function SingleLayout({ mounts, state, renderMount }) {
|
|
11
|
+
const scena = useScena();
|
|
12
|
+
const active = mounts.find((m) => m.key === state.activeContainerKey) ??
|
|
13
|
+
mounts[mounts.length - 1];
|
|
14
|
+
const compProps = active ? scena.components.get(active.component.component)?.props : undefined;
|
|
15
|
+
const titleLabel = active?.props?.title ?? compProps?.title;
|
|
16
|
+
const title = useMountTitle(active, '');
|
|
17
|
+
const icon = active?.props?.icon ?? compProps?.icon;
|
|
18
|
+
const color = active?.props?.color ?? compProps?.color;
|
|
19
|
+
const actions = active?.props?.actions ?? compProps?.actions;
|
|
20
|
+
const showHeader = Boolean(titleLabel || (actions && actions.length));
|
|
21
|
+
return (_jsxs("div", { className: "oo-layout oo-layout--single", style: { height: '100%', width: '100%', display: 'flex', flexDirection: 'column', minHeight: 0 }, children: [showHeader ? _jsx(SectionHeader, { title: title || active?.key || '', icon: icon, color: color, actions: actions }) : null, _jsx("div", { style: { flex: 1, minHeight: 0, position: 'relative' }, children: mounts.length === 0 ? (_jsx("div", { style: { padding: 24, color: 'var(--oo-color-muted)' }, children: "Nothing open." })) : (
|
|
22
|
+
// Keep every mount mounted; show only the active one so switching
|
|
23
|
+
// between mounts doesn't unmount (and reset) the others.
|
|
24
|
+
mounts.map((m) => (_jsx("div", { className: "oo-layout__mount", "data-active": m === active || undefined, style: { position: 'absolute', inset: 0, overflow: 'auto', display: m === active ? 'block' : 'none' }, children: renderMount(m) }, m.key)))) })] }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LayoutProps } from '../../types/layout.js';
|
|
2
|
+
import type { ResolvedMount } from '../../types/mount-surface.js';
|
|
3
|
+
import type { CampusNodeRenderProps } from '../campus/types.js';
|
|
4
|
+
export interface SpatialCardData {
|
|
5
|
+
mount: ResolvedMount;
|
|
6
|
+
renderMount: LayoutProps['renderMount'];
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function SpatialCard({ selected, data }: CampusNodeRenderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useScena } from '../../react/ScenaProvider.js';
|
|
3
|
+
import { useMountTitle } from './MountTitle.js';
|
|
4
|
+
import { NAMED_GLYPH } from '../display/Icon.js';
|
|
5
|
+
export function SpatialCard({ selected, data }) {
|
|
6
|
+
const { mount, renderMount, onClose } = data;
|
|
7
|
+
const scena = useScena();
|
|
8
|
+
// Per-field merge: mount.props ?? component.props ?? key.
|
|
9
|
+
const compProps = scena.components.get(mount.component.component)?.props;
|
|
10
|
+
const title = useMountTitle(mount, mount.key);
|
|
11
|
+
const icon = mount.props?.icon ?? compProps?.icon;
|
|
12
|
+
const color = mount.props?.color ?? compProps?.color;
|
|
13
|
+
return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "oo-spatial-card__header", "data-campus-drag": true, "data-color": color, style: {
|
|
14
|
+
padding: 'var(--oo-spacing-xs) var(--oo-spacing-sm)',
|
|
15
|
+
borderBottom: '1px solid var(--oo-color-border)',
|
|
16
|
+
fontSize: 'var(--oo-font-size-xs)',
|
|
17
|
+
color: selected ? 'var(--oo-color-fg)' : 'var(--oo-color-muted)',
|
|
18
|
+
background: selected ? 'var(--oo-color-active)' : 'var(--oo-color-surface)',
|
|
19
|
+
display: 'flex',
|
|
20
|
+
justifyContent: 'space-between',
|
|
21
|
+
alignItems: 'center',
|
|
22
|
+
cursor: 'grab',
|
|
23
|
+
userSelect: 'none',
|
|
24
|
+
touchAction: 'none',
|
|
25
|
+
flex: '0 0 auto',
|
|
26
|
+
}, children: [_jsxs("span", { title: title, style: { display: 'inline-flex', alignItems: 'center', gap: 6, minWidth: 0 }, children: [icon ? _jsx("span", { className: "oo-spatial-card__icon", "aria-hidden": true, children: icon }) : null, _jsx("span", { className: "oo-spatial-card__title", style: { overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }, children: title })] }), _jsx("span", { onPointerDown: (e) => e.stopPropagation(), onClick: (e) => {
|
|
27
|
+
e.stopPropagation();
|
|
28
|
+
onClose();
|
|
29
|
+
}, title: "Close", style: { cursor: 'pointer' }, children: NAMED_GLYPH.closePanel })] }), _jsx("div", { className: "oo-spatial-card__body", style: { flex: 1, overflow: 'auto', minHeight: 0 }, children: renderMount(mount) })] }));
|
|
30
|
+
}
|
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useRef, useState, } from 'react';
|
|
3
|
+
import { useScena } from '../../react/ScenaProvider.js';
|
|
4
|
+
import { ContextMenu } from '../menu/ContextMenu.js';
|
|
5
|
+
import { CampusView } from '../campus/CampusView.js';
|
|
6
|
+
import { CampusMappa } from '../campus/CampusMappa.js';
|
|
7
|
+
import { SpatialCard } from './SpatialCard.js';
|
|
8
|
+
import { Toolbar } from '../navigation/Toolbar.js';
|
|
9
|
+
// Free-form positioning with three arrangement strategies:
|
|
10
|
+
//
|
|
11
|
+
// cascade — staircase offsets per mount index (default)
|
|
12
|
+
// grid — auto-near-square; n=4 → 2x2, n=9 → 3x3, n=5 → 2/2/1, etc.
|
|
13
|
+
// manual — user-positioned (drag header to move, edges/corners resize).
|
|
14
|
+
// Bounds persisted in state.spatial.bounds[mount.key].
|
|
15
|
+
//
|
|
16
|
+
// First user drag while in cascade/grid snapshots every mount's current
|
|
17
|
+
// bounds and switches to manual, so other mounts don't shift.
|
|
18
|
+
//
|
|
19
|
+
// SpatialLayout is now a mount-aware adapter over <CampusView>: it owns
|
|
20
|
+
// the arrangement strategy, selection, toolbar, context menus, and
|
|
21
|
+
// per-mount spatial commands. Pan/zoom/wheel/grid/drag live in Campus.
|
|
22
|
+
const CARD_DEFAULT_W = 960;
|
|
23
|
+
const CARD_DEFAULT_H = 768;
|
|
24
|
+
const CASCADE_STEP = 36;
|
|
25
|
+
const CASCADE_START = 40;
|
|
26
|
+
const GRID_MARGIN = 16;
|
|
27
|
+
const GRID_GAP = 16;
|
|
28
|
+
// World half-extent for the canvas. Hardcoded here because SpatialLayout
|
|
29
|
+
// doesn't take props from outside the layout registry; a future surface
|
|
30
|
+
// option could lift this into state.spatial.maxDepth. ±8000 world pixels
|
|
31
|
+
// is roughly 20× the default card size in each direction.
|
|
32
|
+
const MAX_DEPTH = 8000;
|
|
33
|
+
function computeInitialBounds(index, total, arrangement) {
|
|
34
|
+
if (arrangement === 'grid' && total > 0) {
|
|
35
|
+
const cols = Math.max(1, Math.floor(Math.sqrt(total)));
|
|
36
|
+
const col = index % cols;
|
|
37
|
+
const row = Math.floor(index / cols);
|
|
38
|
+
return {
|
|
39
|
+
x: GRID_MARGIN + col * (CARD_DEFAULT_W + GRID_GAP),
|
|
40
|
+
y: GRID_MARGIN + row * (CARD_DEFAULT_H + GRID_GAP),
|
|
41
|
+
w: CARD_DEFAULT_W,
|
|
42
|
+
h: CARD_DEFAULT_H,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
x: CASCADE_START + index * CASCADE_STEP,
|
|
47
|
+
y: CASCADE_START + index * CASCADE_STEP,
|
|
48
|
+
w: CARD_DEFAULT_W,
|
|
49
|
+
h: CARD_DEFAULT_H,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const DEFAULT_VIEWPORT = { scale: 1, panX: 0, panY: 0 };
|
|
53
|
+
// Stable identity for the "no saved bounds" case. An inline `?? {}` would mint
|
|
54
|
+
// a new object every render and defeat the bounds useMemo below.
|
|
55
|
+
const EMPTY_BOUNDS = {};
|
|
56
|
+
const ZOOM_STEP = 1.1;
|
|
57
|
+
// CampusView node registry. Spatial mounts all render as the `card` type.
|
|
58
|
+
const CARD_NODE_TYPES = { card: SpatialCard };
|
|
59
|
+
export function SpatialLayout({ surface, mounts, state, setState, renderMount, onClose, onActivate, }) {
|
|
60
|
+
const scena = useScena();
|
|
61
|
+
// Background + per-card context menus.
|
|
62
|
+
const [bgMenu, setBgMenu] = useState(null);
|
|
63
|
+
const [cardMenu, setCardMenu] = useState(null);
|
|
64
|
+
const arrangement = state.spatial?.arrangement ?? 'cascade';
|
|
65
|
+
const savedBounds = state.spatial?.bounds ?? EMPTY_BOUNDS;
|
|
66
|
+
const selectedKey = state.spatial?.selectedKey;
|
|
67
|
+
const viewport = state.spatial?.viewport ?? DEFAULT_VIEWPORT;
|
|
68
|
+
const spatialRef = useRef({ arrangement, bounds: savedBounds, selectedKey, viewport });
|
|
69
|
+
spatialRef.current = { arrangement, bounds: savedBounds, selectedKey, viewport };
|
|
70
|
+
function applySpatial(patch) {
|
|
71
|
+
const next = { ...spatialRef.current, ...patch };
|
|
72
|
+
spatialRef.current = next;
|
|
73
|
+
setState({ spatial: next });
|
|
74
|
+
}
|
|
75
|
+
// CampusView is fully controlled; its onViewportChange routes here.
|
|
76
|
+
function onViewportChange(next) {
|
|
77
|
+
applySpatial({ viewport: next });
|
|
78
|
+
}
|
|
79
|
+
// Effective bounds: manual reads saved (with cascade fallback for fresh
|
|
80
|
+
// mounts); cascade/grid recompute every render so adding a mount restacks.
|
|
81
|
+
const effectiveBounds = useMemo(() => {
|
|
82
|
+
const map = {};
|
|
83
|
+
mounts.forEach((m, i) => {
|
|
84
|
+
if (arrangement === 'manual') {
|
|
85
|
+
map[m.key] = savedBounds[m.key] ?? computeInitialBounds(i, mounts.length, 'cascade');
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
map[m.key] = computeInitialBounds(i, mounts.length, arrangement);
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return map;
|
|
92
|
+
}, [mounts, arrangement, savedBounds]);
|
|
93
|
+
function setArrangement(next) {
|
|
94
|
+
if (next === 'manual') {
|
|
95
|
+
const snapshot = {};
|
|
96
|
+
for (const m of mounts)
|
|
97
|
+
snapshot[m.key] = effectiveBounds[m.key];
|
|
98
|
+
applySpatial({ arrangement: 'manual', bounds: snapshot });
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
applySpatial({ arrangement: next, bounds: {} });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function commitBoundsForMount(key, next) {
|
|
105
|
+
// First drag/resize while in cascade/grid → snapshot ALL mounts so
|
|
106
|
+
// others don't shift when arrangement flips to manual.
|
|
107
|
+
if (spatialRef.current.arrangement !== 'manual') {
|
|
108
|
+
const snapshot = {};
|
|
109
|
+
for (const m of mounts)
|
|
110
|
+
snapshot[m.key] = effectiveBounds[m.key];
|
|
111
|
+
snapshot[key] = next;
|
|
112
|
+
applySpatial({ arrangement: 'manual', bounds: snapshot, selectedKey: key });
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
applySpatial({
|
|
116
|
+
bounds: { ...spatialRef.current.bounds, [key]: next },
|
|
117
|
+
selectedKey: key,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function select(key) {
|
|
121
|
+
if (spatialRef.current.selectedKey === key)
|
|
122
|
+
return;
|
|
123
|
+
applySpatial({ selectedKey: key });
|
|
124
|
+
if (key)
|
|
125
|
+
onActivate(key);
|
|
126
|
+
}
|
|
127
|
+
// ----- Campus controller + spatial-only command handlers -----
|
|
128
|
+
const campusRef = useRef(null);
|
|
129
|
+
function fitToView() {
|
|
130
|
+
if (mounts.length === 0) {
|
|
131
|
+
campusRef.current?.fitToView();
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;
|
|
135
|
+
for (const m of mounts) {
|
|
136
|
+
const b = effectiveBounds[m.key];
|
|
137
|
+
if (!b)
|
|
138
|
+
continue;
|
|
139
|
+
minX = Math.min(minX, b.x);
|
|
140
|
+
minY = Math.min(minY, b.y);
|
|
141
|
+
maxX = Math.max(maxX, b.x + b.w);
|
|
142
|
+
maxY = Math.max(maxY, b.y + b.h);
|
|
143
|
+
}
|
|
144
|
+
if (!isFinite(minX))
|
|
145
|
+
return;
|
|
146
|
+
campusRef.current?.fitToView({
|
|
147
|
+
x: minX, y: minY, w: maxX - minX, h: maxY - minY,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
function centerOnSelected() {
|
|
151
|
+
const key = selectedKey;
|
|
152
|
+
if (!key)
|
|
153
|
+
return;
|
|
154
|
+
const b = effectiveBounds[key];
|
|
155
|
+
if (!b)
|
|
156
|
+
return;
|
|
157
|
+
campusRef.current?.centerOn(b.x + b.w / 2, b.y + b.h / 2);
|
|
158
|
+
}
|
|
159
|
+
function centerOnCard(key) {
|
|
160
|
+
const b = effectiveBounds[key];
|
|
161
|
+
if (!b)
|
|
162
|
+
return;
|
|
163
|
+
campusRef.current?.centerOn(b.x + b.w / 2, b.y + b.h / 2);
|
|
164
|
+
}
|
|
165
|
+
function resetBoundsForCard(key) {
|
|
166
|
+
const idx = mounts.findIndex((m) => m.key === key);
|
|
167
|
+
if (idx < 0)
|
|
168
|
+
return;
|
|
169
|
+
commitBoundsForMount(key, computeInitialBounds(idx, mounts.length, 'cascade'));
|
|
170
|
+
}
|
|
171
|
+
// ----- Spatial-only commands (registered at mount; auto-disposed). -----
|
|
172
|
+
// Imperative spatial actions can't be expressed as pure state writes
|
|
173
|
+
// (they need DOM measurements). Registering them inside this layout via
|
|
174
|
+
// handlersRef keeps closures current across renders.
|
|
175
|
+
const handlersRef = useRef({
|
|
176
|
+
fitToView,
|
|
177
|
+
resetViewport: () => campusRef.current?.resetViewport(),
|
|
178
|
+
centerOnSelected,
|
|
179
|
+
setArrangement,
|
|
180
|
+
centerOnCard,
|
|
181
|
+
resetBoundsForCard,
|
|
182
|
+
});
|
|
183
|
+
handlersRef.current = {
|
|
184
|
+
fitToView,
|
|
185
|
+
resetViewport: () => campusRef.current?.resetViewport(),
|
|
186
|
+
centerOnSelected,
|
|
187
|
+
setArrangement,
|
|
188
|
+
centerOnCard,
|
|
189
|
+
resetBoundsForCard,
|
|
190
|
+
};
|
|
191
|
+
useEffect(() => {
|
|
192
|
+
const subs = [
|
|
193
|
+
scena.commands.register({
|
|
194
|
+
id: 'surface.fitToView',
|
|
195
|
+
title: 'Fit to view',
|
|
196
|
+
description: 'Frame all cards',
|
|
197
|
+
icon: '⛶',
|
|
198
|
+
color: 'blue',
|
|
199
|
+
slots: ['surface:context'],
|
|
200
|
+
when: '$/surface/layoutId == "spatial"',
|
|
201
|
+
run: (ctx) => {
|
|
202
|
+
handlersRef.current.fitToView();
|
|
203
|
+
ctx.host?.closeMenu();
|
|
204
|
+
},
|
|
205
|
+
}),
|
|
206
|
+
scena.commands.register({
|
|
207
|
+
id: 'surface.resetZoom',
|
|
208
|
+
title: 'Reset zoom',
|
|
209
|
+
icon: '↺',
|
|
210
|
+
slots: ['surface:context'],
|
|
211
|
+
when: '$/surface/layoutId == "spatial"',
|
|
212
|
+
run: (ctx) => {
|
|
213
|
+
handlersRef.current.resetViewport();
|
|
214
|
+
ctx.host?.closeMenu();
|
|
215
|
+
},
|
|
216
|
+
}),
|
|
217
|
+
scena.commands.register({
|
|
218
|
+
id: 'surface.centerSelected',
|
|
219
|
+
title: 'Center on selected',
|
|
220
|
+
icon: '◎',
|
|
221
|
+
color: 'teal',
|
|
222
|
+
slots: ['surface:context'],
|
|
223
|
+
when: '$/surface/layoutId == "spatial" && $/surface/hasSelection == true',
|
|
224
|
+
run: (ctx) => {
|
|
225
|
+
handlersRef.current.centerOnSelected();
|
|
226
|
+
ctx.host?.closeMenu();
|
|
227
|
+
},
|
|
228
|
+
}),
|
|
229
|
+
scena.commands.register({
|
|
230
|
+
id: 'surface.setArrangement.cascade',
|
|
231
|
+
title: 'Arrange: Cascade',
|
|
232
|
+
icon: '▤',
|
|
233
|
+
slots: ['surface:context'],
|
|
234
|
+
when: '$/surface/layoutId == "spatial" && $/surface/arrangement != "cascade"',
|
|
235
|
+
run: (ctx) => {
|
|
236
|
+
handlersRef.current.setArrangement('cascade');
|
|
237
|
+
ctx.host?.closeMenu();
|
|
238
|
+
},
|
|
239
|
+
}),
|
|
240
|
+
scena.commands.register({
|
|
241
|
+
id: 'surface.setArrangement.grid',
|
|
242
|
+
title: 'Arrange: Grid',
|
|
243
|
+
icon: '▦',
|
|
244
|
+
color: 'violet',
|
|
245
|
+
slots: ['surface:context'],
|
|
246
|
+
when: '$/surface/layoutId == "spatial" && $/surface/arrangement != "grid"',
|
|
247
|
+
run: (ctx) => {
|
|
248
|
+
handlersRef.current.setArrangement('grid');
|
|
249
|
+
ctx.host?.closeMenu();
|
|
250
|
+
},
|
|
251
|
+
}),
|
|
252
|
+
scena.commands.register({
|
|
253
|
+
id: 'surface.setArrangement.manual',
|
|
254
|
+
title: 'Arrange: Manual',
|
|
255
|
+
icon: '✥',
|
|
256
|
+
slots: ['surface:context'],
|
|
257
|
+
when: '$/surface/layoutId == "spatial" && $/surface/arrangement != "manual"',
|
|
258
|
+
run: (ctx) => {
|
|
259
|
+
handlersRef.current.setArrangement('manual');
|
|
260
|
+
ctx.host?.closeMenu();
|
|
261
|
+
},
|
|
262
|
+
}),
|
|
263
|
+
scena.commands.register({
|
|
264
|
+
id: 'card.centerOn',
|
|
265
|
+
title: 'Center on this card',
|
|
266
|
+
icon: '◎',
|
|
267
|
+
color: 'teal',
|
|
268
|
+
slots: ['card:context'],
|
|
269
|
+
when: '$/surface/layoutId == "spatial"',
|
|
270
|
+
run: (ctx) => {
|
|
271
|
+
const key = ctx.store.get('$/tab/key');
|
|
272
|
+
if (!key)
|
|
273
|
+
return;
|
|
274
|
+
handlersRef.current.centerOnCard(key);
|
|
275
|
+
ctx.host?.closeMenu();
|
|
276
|
+
},
|
|
277
|
+
}),
|
|
278
|
+
scena.commands.register({
|
|
279
|
+
id: 'card.resetBounds',
|
|
280
|
+
title: 'Reset bounds',
|
|
281
|
+
description: 'Recompute size + position',
|
|
282
|
+
icon: '↺',
|
|
283
|
+
slots: ['card:context'],
|
|
284
|
+
when: '$/surface/layoutId == "spatial"',
|
|
285
|
+
run: (ctx) => {
|
|
286
|
+
const key = ctx.store.get('$/tab/key');
|
|
287
|
+
if (!key)
|
|
288
|
+
return;
|
|
289
|
+
handlersRef.current.resetBoundsForCard(key);
|
|
290
|
+
ctx.host?.closeMenu();
|
|
291
|
+
},
|
|
292
|
+
}),
|
|
293
|
+
];
|
|
294
|
+
return () => {
|
|
295
|
+
for (const s of subs)
|
|
296
|
+
s.dispose();
|
|
297
|
+
};
|
|
298
|
+
}, [scena]);
|
|
299
|
+
// CampusView nodes — one `card` per mount, positioned at its effective
|
|
300
|
+
// bounds. Card-specific behavior (title/icon/close/body) rides on `data`;
|
|
301
|
+
// CampusView owns drag/resize/select/context generically.
|
|
302
|
+
const cardNodes = useMemo(() => mounts.map((mount) => ({
|
|
303
|
+
id: mount.key,
|
|
304
|
+
type: 'card',
|
|
305
|
+
bounds: effectiveBounds[mount.key],
|
|
306
|
+
selected: mount.key === selectedKey,
|
|
307
|
+
data: {
|
|
308
|
+
mount,
|
|
309
|
+
renderMount,
|
|
310
|
+
onClose: () => onClose(mount.key),
|
|
311
|
+
},
|
|
312
|
+
})), [mounts, effectiveBounds, selectedKey, renderMount, onClose]);
|
|
313
|
+
// Minimap nodes — colored by the registered component's opens.color
|
|
314
|
+
// so a "user" card lights up violet, a "file" blue, etc.
|
|
315
|
+
const mappaNodes = mounts.flatMap((m) => {
|
|
316
|
+
const b = effectiveBounds[m.key];
|
|
317
|
+
if (!b)
|
|
318
|
+
return [];
|
|
319
|
+
const def = scena.components.get(m.component.component);
|
|
320
|
+
const color = def?.opens?.color;
|
|
321
|
+
return [{ id: m.key, bounds: b, color, selected: m.key === selectedKey }];
|
|
322
|
+
});
|
|
323
|
+
function onContainerContextMenu(e) {
|
|
324
|
+
e.preventDefault();
|
|
325
|
+
setBgMenu({ x: e.clientX, y: e.clientY });
|
|
326
|
+
}
|
|
327
|
+
if (mounts.length === 0) {
|
|
328
|
+
return (_jsx("div", { style: { padding: 24, color: 'var(--oo-color-muted)' }, children: "Nothing open." }));
|
|
329
|
+
}
|
|
330
|
+
return (_jsxs("div", { className: "oo-layout oo-layout--spatial", style: { display: 'flex', flexDirection: 'column', height: '100%' }, children: [_jsxs(Toolbar, { className: "oo-spatial-toolbar", children: [_jsxs("label", { style: { display: 'flex', gap: 6, alignItems: 'center' }, children: [_jsx("span", { style: { color: 'var(--oo-color-muted)' }, children: "arrange:" }), _jsxs("select", { value: arrangement, onChange: (e) => setArrangement(e.target.value), children: [_jsx("option", { value: "cascade", children: "cascade" }), _jsx("option", { value: "grid", children: "grid" }), _jsx("option", { value: "manual", children: "manual" })] })] }), _jsx("button", { type: "button", onClick: () => campusRef.current?.zoomBy(1 / ZOOM_STEP), title: "Zoom out", "aria-label": "Zoom out", children: "\u2212" }), _jsx(ZoomPercentInput, { value: viewport.scale, onCommit: (scale) => campusRef.current?.zoomToScale(scale) }), _jsx("button", { type: "button", onClick: () => campusRef.current?.zoomBy(ZOOM_STEP), title: "Zoom in", "aria-label": "Zoom in", children: "+" }), _jsx("button", { type: "button", onClick: fitToView, title: "Fit all cards to viewport", children: "Fit" }), _jsx("button", { type: "button", onClick: () => campusRef.current?.resetViewport(), title: "Reset zoom + pan", children: "Reset" }), _jsxs("span", { style: {
|
|
331
|
+
color: 'var(--oo-color-muted)',
|
|
332
|
+
fontSize: 'var(--oo-font-size-xs)',
|
|
333
|
+
}, children: ["drag header to move \u00B7 drag edges to resize \u00B7 ctrl+wheel zooms \u00B7 drag empty area to pan \u00B7 first drag locks to ", _jsx("em", { children: "manual" })] })] }), _jsx("div", { style: { flex: 1, minHeight: 0, position: 'relative' }, children: _jsx(CampusView, { ref: campusRef, viewport: viewport, onViewportChange: onViewportChange, maxDepth: MAX_DEPTH, nodes: cardNodes, nodeTypes: CARD_NODE_TYPES, onNodeCommit: (key, next) => commitBoundsForMount(key, next), onNodeSelect: (key) => select(key), onNodeContextMenu: (key, e) => setCardMenu({ x: e.clientX, y: e.clientY, key }), onBackgroundClick: () => select(undefined), onBackgroundContextMenu: onContainerContextMenu, children: _jsx(CampusMappa, { nodes: mappaNodes, onJumpTo: (worldX, worldY) => campusRef.current?.centerOn(worldX, worldY) }) }) }), selectedKey ? (_jsx(SelectionFooter, { selectedKey: selectedKey, onCenter: () => centerOnCard(selectedKey), onReset: () => resetBoundsForCard(selectedKey), onClose: () => onClose(selectedKey), onDeselect: () => select(undefined) })) : null, bgMenu ? (_jsx(ContextMenu, { x: bgMenu.x, y: bgMenu.y, onClose: () => setBgMenu(null), spec: { query: { slot: 'surface:context' }, footerHints: true }, context: {
|
|
334
|
+
'$/surface/name': surface,
|
|
335
|
+
'$/surface/layoutId': 'spatial',
|
|
336
|
+
'$/surface/mountCount': mounts.length,
|
|
337
|
+
'$/surface/closedHistory': 0,
|
|
338
|
+
'$/surface/arrangement': arrangement,
|
|
339
|
+
'$/surface/hasSelection': Boolean(selectedKey),
|
|
340
|
+
} })) : null, cardMenu ? (_jsx(ContextMenu, { x: cardMenu.x, y: cardMenu.y, onClose: () => setCardMenu(null), spec: { query: { slot: 'card:context' }, footerHints: true }, context: {
|
|
341
|
+
'$/surface/name': surface,
|
|
342
|
+
'$/surface/layoutId': 'spatial',
|
|
343
|
+
'$/surface/mountCount': mounts.length,
|
|
344
|
+
'$/surface/closedHistory': 0,
|
|
345
|
+
'$/surface/arrangement': arrangement,
|
|
346
|
+
'$/tab/key': cardMenu.key,
|
|
347
|
+
'$/tab/index': mounts.findIndex((m) => m.key === cardMenu.key),
|
|
348
|
+
'$/tab/canSplit': false,
|
|
349
|
+
'$/tab/canMove': false,
|
|
350
|
+
'$/tab/isActive': cardMenu.key === selectedKey,
|
|
351
|
+
'$/tab/isPinned': false,
|
|
352
|
+
'$/group/tabCount': mounts.length,
|
|
353
|
+
} })) : null] }));
|
|
354
|
+
}
|
|
355
|
+
function SelectionFooter({ selectedKey, onCenter, onReset, onClose, onDeselect, }) {
|
|
356
|
+
return (_jsxs("div", { className: "oo-spatial-footer", role: "toolbar", "aria-label": "Selected card actions", style: {
|
|
357
|
+
position: 'absolute',
|
|
358
|
+
bottom: 16,
|
|
359
|
+
left: '50%',
|
|
360
|
+
transform: 'translateX(-50%)',
|
|
361
|
+
display: 'flex',
|
|
362
|
+
alignItems: 'center',
|
|
363
|
+
gap: 4,
|
|
364
|
+
padding: '6px 8px',
|
|
365
|
+
background: 'rgba(20, 20, 24, 0.78)',
|
|
366
|
+
backdropFilter: 'blur(8px)',
|
|
367
|
+
WebkitBackdropFilter: 'blur(8px)',
|
|
368
|
+
borderRadius: 9999,
|
|
369
|
+
color: '#fff',
|
|
370
|
+
fontSize: 'var(--oo-font-size-xs)',
|
|
371
|
+
boxShadow: '0 6px 20px rgba(0, 0, 0, 0.32)',
|
|
372
|
+
pointerEvents: 'auto',
|
|
373
|
+
zIndex: 50,
|
|
374
|
+
}, onPointerDown: (e) => e.stopPropagation(), children: [_jsx("span", { style: {
|
|
375
|
+
padding: '0 8px',
|
|
376
|
+
color: 'rgba(255, 255, 255, 0.65)',
|
|
377
|
+
fontFamily: 'var(--oo-font-mono)',
|
|
378
|
+
maxWidth: 180,
|
|
379
|
+
overflow: 'hidden',
|
|
380
|
+
textOverflow: 'ellipsis',
|
|
381
|
+
whiteSpace: 'nowrap',
|
|
382
|
+
}, title: selectedKey, children: selectedKey }), _jsx(FooterButton, { icon: "\u25CE", label: "Center on this card", onClick: onCenter }), _jsx(FooterButton, { icon: "\u21BA", label: "Reset bounds", onClick: onReset }), _jsx(FooterButton, { icon: "\u2715", label: "Close", onClick: onClose, variant: "danger" }), _jsx(FooterButton, { icon: "\u2297", label: "Deselect", onClick: onDeselect })] }));
|
|
383
|
+
}
|
|
384
|
+
function FooterButton({ icon, label, onClick, variant, }) {
|
|
385
|
+
return (_jsx("button", { type: "button", onClick: onClick, title: label, "aria-label": label, style: {
|
|
386
|
+
width: 28,
|
|
387
|
+
height: 28,
|
|
388
|
+
display: 'inline-flex',
|
|
389
|
+
alignItems: 'center',
|
|
390
|
+
justifyContent: 'center',
|
|
391
|
+
border: 'none',
|
|
392
|
+
borderRadius: '50%',
|
|
393
|
+
background: 'rgba(255, 255, 255, 0.08)',
|
|
394
|
+
color: variant === 'danger' ? 'rgb(255, 130, 130)' : '#fff',
|
|
395
|
+
cursor: 'pointer',
|
|
396
|
+
font: 'inherit',
|
|
397
|
+
lineHeight: 1,
|
|
398
|
+
}, onMouseEnter: (e) => {
|
|
399
|
+
e.currentTarget.style.background = 'rgba(255, 255, 255, 0.18)';
|
|
400
|
+
}, onMouseLeave: (e) => {
|
|
401
|
+
e.currentTarget.style.background = 'rgba(255, 255, 255, 0.08)';
|
|
402
|
+
}, children: icon }));
|
|
403
|
+
}
|
|
404
|
+
function ZoomPercentInput({ value, onCommit }) {
|
|
405
|
+
const percent = Math.round(value * 100);
|
|
406
|
+
const [draft, setDraft] = useState(`${percent}`);
|
|
407
|
+
const [editing, setEditing] = useState(false);
|
|
408
|
+
if (!editing && draft !== `${percent}`) {
|
|
409
|
+
setDraft(`${percent}`);
|
|
410
|
+
}
|
|
411
|
+
function commit() {
|
|
412
|
+
const n = parseInt(draft, 10);
|
|
413
|
+
if (Number.isFinite(n) && n > 0) {
|
|
414
|
+
onCommit(n / 100);
|
|
415
|
+
}
|
|
416
|
+
else {
|
|
417
|
+
setDraft(`${percent}`);
|
|
418
|
+
}
|
|
419
|
+
setEditing(false);
|
|
420
|
+
}
|
|
421
|
+
return (_jsx("input", { type: "text", inputMode: "numeric", value: editing ? draft : `${percent}%`, onFocus: (e) => {
|
|
422
|
+
setEditing(true);
|
|
423
|
+
setDraft(`${percent}`);
|
|
424
|
+
requestAnimationFrame(() => e.target.select?.());
|
|
425
|
+
}, onChange: (e) => setDraft(e.target.value.replace(/[^\d]/g, '')), onBlur: commit, onKeyDown: (e) => {
|
|
426
|
+
if (e.key === 'Enter') {
|
|
427
|
+
e.preventDefault();
|
|
428
|
+
e.target.blur();
|
|
429
|
+
}
|
|
430
|
+
else if (e.key === 'Escape') {
|
|
431
|
+
e.preventDefault();
|
|
432
|
+
setDraft(`${percent}`);
|
|
433
|
+
setEditing(false);
|
|
434
|
+
e.target.blur();
|
|
435
|
+
}
|
|
436
|
+
}, title: "Zoom percent", "aria-label": "Zoom percent", style: {
|
|
437
|
+
width: 56,
|
|
438
|
+
textAlign: 'center',
|
|
439
|
+
font: 'inherit',
|
|
440
|
+
padding: '2px 4px',
|
|
441
|
+
border: '1px solid var(--oo-color-border)',
|
|
442
|
+
borderRadius: 'var(--oo-radius-sm, 4px)',
|
|
443
|
+
background: 'var(--oo-color-canvas)',
|
|
444
|
+
color: 'var(--oo-color-fg)',
|
|
445
|
+
} }));
|
|
446
|
+
}
|