@happyvertical/smrt-svelte 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +317 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +7 -0
- package/README.md +185 -0
- package/dist/Provider.svelte +204 -0
- package/dist/Provider.svelte.d.ts +73 -0
- package/dist/Provider.svelte.d.ts.map +1 -0
- package/dist/__tests__/app-state.test.js +156 -0
- package/dist/__tests__/warm-clients.test.js +186 -0
- package/dist/browser-ai/adapters/llm/factory.d.ts +38 -0
- package/dist/browser-ai/adapters/llm/factory.d.ts.map +1 -0
- package/dist/browser-ai/adapters/llm/factory.js +91 -0
- package/dist/browser-ai/adapters/llm/index.d.ts +7 -0
- package/dist/browser-ai/adapters/llm/index.d.ts.map +1 -0
- package/dist/browser-ai/adapters/llm/index.js +6 -0
- package/dist/browser-ai/adapters/llm/types.d.ts +182 -0
- package/dist/browser-ai/adapters/llm/types.d.ts.map +1 -0
- package/dist/browser-ai/adapters/llm/types.js +43 -0
- package/dist/browser-ai/adapters/llm/webllm.d.ts +33 -0
- package/dist/browser-ai/adapters/llm/webllm.d.ts.map +1 -0
- package/dist/browser-ai/adapters/llm/webllm.js +225 -0
- package/dist/browser-ai/adapters/stt/browser-speech.d.ts +31 -0
- package/dist/browser-ai/adapters/stt/browser-speech.d.ts.map +1 -0
- package/dist/browser-ai/adapters/stt/browser-speech.js +217 -0
- package/dist/browser-ai/adapters/stt/factory.d.ts +49 -0
- package/dist/browser-ai/adapters/stt/factory.d.ts.map +1 -0
- package/dist/browser-ai/adapters/stt/factory.js +110 -0
- package/dist/browser-ai/adapters/stt/index.d.ts +9 -0
- package/dist/browser-ai/adapters/stt/index.d.ts.map +1 -0
- package/dist/browser-ai/adapters/stt/index.js +8 -0
- package/dist/browser-ai/adapters/stt/types.d.ts +154 -0
- package/dist/browser-ai/adapters/stt/types.d.ts.map +1 -0
- package/dist/browser-ai/adapters/stt/types.js +4 -0
- package/dist/browser-ai/adapters/stt/whisper-cpp.d.ts +46 -0
- package/dist/browser-ai/adapters/stt/whisper-cpp.d.ts.map +1 -0
- package/dist/browser-ai/adapters/stt/whisper-cpp.js +348 -0
- package/dist/browser-ai/adapters/stt/whisper-wasm.d.ts +51 -0
- package/dist/browser-ai/adapters/stt/whisper-wasm.d.ts.map +1 -0
- package/dist/browser-ai/adapters/stt/whisper-wasm.js +380 -0
- package/dist/browser-ai/adapters/tts/browser-synthesis.d.ts +42 -0
- package/dist/browser-ai/adapters/tts/browser-synthesis.d.ts.map +1 -0
- package/dist/browser-ai/adapters/tts/browser-synthesis.js +235 -0
- package/dist/browser-ai/adapters/tts/factory.d.ts +53 -0
- package/dist/browser-ai/adapters/tts/factory.d.ts.map +1 -0
- package/dist/browser-ai/adapters/tts/factory.js +92 -0
- package/dist/browser-ai/adapters/tts/index.d.ts +7 -0
- package/dist/browser-ai/adapters/tts/index.d.ts.map +1 -0
- package/dist/browser-ai/adapters/tts/index.js +6 -0
- package/dist/browser-ai/adapters/tts/types.d.ts +140 -0
- package/dist/browser-ai/adapters/tts/types.d.ts.map +1 -0
- package/dist/browser-ai/adapters/tts/types.js +4 -0
- package/dist/browser-ai/capabilities/detector.d.ts +38 -0
- package/dist/browser-ai/capabilities/detector.d.ts.map +1 -0
- package/dist/browser-ai/capabilities/detector.js +211 -0
- package/dist/browser-ai/core/errors.d.ts +62 -0
- package/dist/browser-ai/core/errors.d.ts.map +1 -0
- package/dist/browser-ai/core/errors.js +92 -0
- package/dist/browser-ai/core/index.d.ts +6 -0
- package/dist/browser-ai/core/index.d.ts.map +1 -0
- package/dist/browser-ai/core/index.js +5 -0
- package/dist/browser-ai/core/types.d.ts +115 -0
- package/dist/browser-ai/core/types.d.ts.map +1 -0
- package/dist/browser-ai/core/types.js +34 -0
- package/dist/browser-ai/index.d.ts +12 -0
- package/dist/browser-ai/index.d.ts.map +1 -0
- package/dist/browser-ai/index.js +16 -0
- package/dist/browser-ai/svelte/components/AILoadingOverlay.svelte +77 -0
- package/dist/browser-ai/svelte/components/AILoadingOverlay.svelte.d.ts +16 -0
- package/dist/browser-ai/svelte/components/AILoadingOverlay.svelte.d.ts.map +1 -0
- package/dist/browser-ai/svelte/components/CapabilityGate.svelte +57 -0
- package/dist/browser-ai/svelte/components/CapabilityGate.svelte.d.ts +15 -0
- package/dist/browser-ai/svelte/components/CapabilityGate.svelte.d.ts.map +1 -0
- package/dist/browser-ai/svelte/components/DownloadProgress.svelte +141 -0
- package/dist/browser-ai/svelte/components/DownloadProgress.svelte.d.ts +15 -0
- package/dist/browser-ai/svelte/components/DownloadProgress.svelte.d.ts.map +1 -0
- package/dist/browser-ai/svelte/components/STTTest.svelte +379 -0
- package/dist/browser-ai/svelte/components/STTTest.svelte.d.ts +9 -0
- package/dist/browser-ai/svelte/components/STTTest.svelte.d.ts.map +1 -0
- package/dist/browser-ai/svelte/components/VoiceInput.svelte +200 -0
- package/dist/browser-ai/svelte/components/VoiceInput.svelte.d.ts +16 -0
- package/dist/browser-ai/svelte/components/VoiceInput.svelte.d.ts.map +1 -0
- package/dist/browser-ai/svelte/index.d.ts +15 -0
- package/dist/browser-ai/svelte/index.d.ts.map +1 -0
- package/dist/browser-ai/svelte/index.js +28 -0
- package/dist/browser-ai/ui.d.ts +16 -0
- package/dist/browser-ai/ui.d.ts.map +1 -0
- package/dist/browser-ai/ui.js +67 -0
- package/dist/components/admin/AgentAdminPanel.svelte +111 -0
- package/dist/components/admin/AgentAdminPanel.svelte.d.ts +25 -0
- package/dist/components/admin/AgentAdminPanel.svelte.d.ts.map +1 -0
- package/dist/components/admin/AgentAdminTabs.svelte +280 -0
- package/dist/components/admin/AgentAdminTabs.svelte.d.ts +23 -0
- package/dist/components/admin/AgentAdminTabs.svelte.d.ts.map +1 -0
- package/dist/components/admin/AgentSettingsShell.svelte +257 -0
- package/dist/components/admin/AgentSettingsShell.svelte.d.ts +33 -0
- package/dist/components/admin/AgentSettingsShell.svelte.d.ts.map +1 -0
- package/dist/components/admin/index.d.ts +5 -0
- package/dist/components/admin/index.d.ts.map +1 -0
- package/dist/components/admin/index.js +6 -0
- package/dist/components/forms/AddressInput.svelte +500 -0
- package/dist/components/forms/AddressInput.svelte.d.ts +36 -0
- package/dist/components/forms/AddressInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/CheckboxInput.svelte +208 -0
- package/dist/components/forms/CheckboxInput.svelte.d.ts +20 -0
- package/dist/components/forms/CheckboxInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/DateRangeInput.svelte +628 -0
- package/dist/components/forms/DateRangeInput.svelte.d.ts +33 -0
- package/dist/components/forms/DateRangeInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/DateTimeInput.svelte +521 -0
- package/dist/components/forms/DateTimeInput.svelte.d.ts +24 -0
- package/dist/components/forms/DateTimeInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/FileUpload.svelte +358 -0
- package/dist/components/forms/FileUpload.svelte.d.ts +22 -0
- package/dist/components/forms/FileUpload.svelte.d.ts.map +1 -0
- package/dist/components/forms/Form.svelte +771 -0
- package/dist/components/forms/Form.svelte.d.ts +26 -0
- package/dist/components/forms/Form.svelte.d.ts.map +1 -0
- package/dist/components/forms/FormGroup.svelte +86 -0
- package/dist/components/forms/FormGroup.svelte.d.ts +13 -0
- package/dist/components/forms/FormGroup.svelte.d.ts.map +1 -0
- package/dist/components/forms/FormMicButton.svelte +179 -0
- package/dist/components/forms/FormMicButton.svelte.d.ts +10 -0
- package/dist/components/forms/FormMicButton.svelte.d.ts.map +1 -0
- package/dist/components/forms/Input.svelte +83 -0
- package/dist/components/forms/Input.svelte.d.ts +9 -0
- package/dist/components/forms/Input.svelte.d.ts.map +1 -0
- package/dist/components/forms/MeasurementInput.svelte +505 -0
- package/dist/components/forms/MeasurementInput.svelte.d.ts +35 -0
- package/dist/components/forms/MeasurementInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/MoneyInput.svelte +412 -0
- package/dist/components/forms/MoneyInput.svelte.d.ts +30 -0
- package/dist/components/forms/MoneyInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/NumberInput.svelte +310 -0
- package/dist/components/forms/NumberInput.svelte.d.ts +28 -0
- package/dist/components/forms/NumberInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/PhoneInput.svelte +530 -0
- package/dist/components/forms/PhoneInput.svelte.d.ts +22 -0
- package/dist/components/forms/PhoneInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/SearchInput.svelte +358 -0
- package/dist/components/forms/SearchInput.svelte.d.ts +33 -0
- package/dist/components/forms/SearchInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/Select.svelte +83 -0
- package/dist/components/forms/Select.svelte.d.ts +11 -0
- package/dist/components/forms/Select.svelte.d.ts.map +1 -0
- package/dist/components/forms/SelectInput.svelte +254 -0
- package/dist/components/forms/SelectInput.svelte.d.ts +25 -0
- package/dist/components/forms/SelectInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/TextInput.svelte +415 -0
- package/dist/components/forms/TextInput.svelte.d.ts +26 -0
- package/dist/components/forms/TextInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/Textarea.svelte +85 -0
- package/dist/components/forms/Textarea.svelte.d.ts +10 -0
- package/dist/components/forms/Textarea.svelte.d.ts.map +1 -0
- package/dist/components/forms/TextareaInput.svelte +386 -0
- package/dist/components/forms/TextareaInput.svelte.d.ts +26 -0
- package/dist/components/forms/TextareaInput.svelte.d.ts.map +1 -0
- package/dist/components/forms/Toggle.svelte +217 -0
- package/dist/components/forms/Toggle.svelte.d.ts +37 -0
- package/dist/components/forms/Toggle.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/AddressInput.behavior.test.js +122 -0
- package/dist/components/forms/__tests__/CheckboxInput.test.js +92 -0
- package/dist/components/forms/__tests__/DateRangeInput.behavior.test.js +135 -0
- package/dist/components/forms/__tests__/DateTimeInput.behavior.test.js +103 -0
- package/dist/components/forms/__tests__/FileUpload.test.js +90 -0
- package/dist/components/forms/__tests__/Form.behavior.test.js +137 -0
- package/dist/components/forms/__tests__/Form.test.js +58 -0
- package/dist/components/forms/__tests__/FormGroup.test.js +48 -0
- package/dist/components/forms/__tests__/FormMicButton.test.js +86 -0
- package/dist/components/forms/__tests__/Input.test.js +49 -0
- package/dist/components/forms/__tests__/MeasurementInput.behavior.test.js +129 -0
- package/dist/components/forms/__tests__/MoneyInput.behavior.test.js +124 -0
- package/dist/components/forms/__tests__/NumberInput.behavior.test.js +141 -0
- package/dist/components/forms/__tests__/PhoneInput.behavior.test.js +96 -0
- package/dist/components/forms/__tests__/SearchInput.test.js +79 -0
- package/dist/components/forms/__tests__/Select.test.js +37 -0
- package/dist/components/forms/__tests__/SelectInput.behavior.test.js +132 -0
- package/dist/components/forms/__tests__/TextInput.behavior.test.js +131 -0
- package/dist/components/forms/__tests__/Textarea.test.js +39 -0
- package/dist/components/forms/__tests__/TextareaInput.behavior.test.js +96 -0
- package/dist/components/forms/__tests__/Toggle.test.js +87 -0
- package/dist/components/forms/__tests__/composite-inputs-a11y.test.js +69 -0
- package/dist/components/forms/__tests__/form-group-input.fixture.svelte +16 -0
- package/dist/components/forms/__tests__/form-group-input.fixture.svelte.d.ts +9 -0
- package/dist/components/forms/__tests__/form-group-input.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/form-with-fields.fixture.svelte +33 -0
- package/dist/components/forms/__tests__/form-with-fields.fixture.svelte.d.ts +12 -0
- package/dist/components/forms/__tests__/form-with-fields.fixture.svelte.d.ts.map +1 -0
- package/dist/components/forms/__tests__/rich-inputs-a11y.test.js +87 -0
- package/dist/components/forms/index.d.ts +25 -0
- package/dist/components/forms/index.d.ts.map +1 -0
- package/dist/components/forms/index.js +25 -0
- package/dist/components/forms/types.d.ts +33 -0
- package/dist/components/forms/types.d.ts.map +1 -0
- package/dist/components/forms/types.js +4 -0
- package/dist/components/module/ModulePanel.svelte +134 -0
- package/dist/components/module/ModulePanel.svelte.d.ts +22 -0
- package/dist/components/module/ModulePanel.svelte.d.ts.map +1 -0
- package/dist/components/module/index.d.ts +5 -0
- package/dist/components/module/index.d.ts.map +1 -0
- package/dist/components/module/index.js +4 -0
- package/dist/components/workspace/Breadcrumbs.svelte +141 -0
- package/dist/components/workspace/Breadcrumbs.svelte.d.ts +21 -0
- package/dist/components/workspace/Breadcrumbs.svelte.d.ts.map +1 -0
- package/dist/components/workspace/NavTree.svelte +354 -0
- package/dist/components/workspace/NavTree.svelte.d.ts +45 -0
- package/dist/components/workspace/NavTree.svelte.d.ts.map +1 -0
- package/dist/components/workspace/README.md +34 -0
- package/dist/components/workspace/RoleShell.svelte +309 -0
- package/dist/components/workspace/RoleShell.svelte.d.ts +91 -0
- package/dist/components/workspace/RoleShell.svelte.d.ts.map +1 -0
- package/dist/components/workspace/WorkspaceShell.svelte +951 -0
- package/dist/components/workspace/WorkspaceShell.svelte.d.ts +112 -0
- package/dist/components/workspace/WorkspaceShell.svelte.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/RoleShell.test.js +772 -0
- package/dist/components/workspace/__tests__/WorkspaceShell.test.js +630 -0
- package/dist/components/workspace/__tests__/breadcrumbs-helpers.test.js +141 -0
- package/dist/components/workspace/__tests__/context-forwarding-harness.svelte +45 -0
- package/dist/components/workspace/__tests__/context-forwarding-harness.svelte.d.ts +21 -0
- package/dist/components/workspace/__tests__/context-forwarding-harness.svelte.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/define-tools-dock.test.js +1010 -0
- package/dist/components/workspace/__tests__/harness.svelte +25 -0
- package/dist/components/workspace/__tests__/harness.svelte.d.ts +14 -0
- package/dist/components/workspace/__tests__/harness.svelte.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/index.test.js +37 -0
- package/dist/components/workspace/__tests__/manifest-nav-helpers.test.js +24 -0
- package/dist/components/workspace/__tests__/manifest-nav.test.js +599 -0
- package/dist/components/workspace/__tests__/nav-helpers.test.js +95 -0
- package/dist/components/workspace/__tests__/render-harness.svelte +66 -0
- package/dist/components/workspace/__tests__/render-harness.svelte.d.ts +32 -0
- package/dist/components/workspace/__tests__/render-harness.svelte.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/render-tools-dock.test.js +243 -0
- package/dist/components/workspace/__tests__/role-shell-bind-harness.svelte +58 -0
- package/dist/components/workspace/__tests__/role-shell-bind-harness.svelte.d.ts +16 -0
- package/dist/components/workspace/__tests__/role-shell-bind-harness.svelte.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/role-shell-switch-harness.svelte +41 -0
- package/dist/components/workspace/__tests__/role-shell-switch-harness.svelte.d.ts +13 -0
- package/dist/components/workspace/__tests__/role-shell-switch-harness.svelte.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/test-icon.svelte +17 -0
- package/dist/components/workspace/__tests__/test-icon.svelte.d.ts +19 -0
- package/dist/components/workspace/__tests__/test-icon.svelte.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/typed-tool-fixture/TypedTool.svelte +38 -0
- package/dist/components/workspace/__tests__/typed-tool-fixture/TypedTool.svelte.d.ts +22 -0
- package/dist/components/workspace/__tests__/typed-tool-fixture/TypedTool.svelte.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.d.ts +65 -0
- package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.js +115 -0
- package/dist/components/workspace/__tests__/typed-tool-fixture/typed-tool-types.d.ts +15 -0
- package/dist/components/workspace/__tests__/typed-tool-fixture/typed-tool-types.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/typed-tool-fixture/typed-tool-types.js +7 -0
- package/dist/components/workspace/__tests__/typed-tool-fixture.test.js +115 -0
- package/dist/components/workspace/__tests__/use-harness-orphan.svelte +9 -0
- package/dist/components/workspace/__tests__/use-harness-orphan.svelte.d.ts +19 -0
- package/dist/components/workspace/__tests__/use-harness-orphan.svelte.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/use-harness.svelte +23 -0
- package/dist/components/workspace/__tests__/use-harness.svelte.d.ts +8 -0
- package/dist/components/workspace/__tests__/use-harness.svelte.d.ts.map +1 -0
- package/dist/components/workspace/__tests__/use-tools-dock.test.js +33 -0
- package/dist/components/workspace/__tests__/workspace-shell-bind-harness.svelte +43 -0
- package/dist/components/workspace/__tests__/workspace-shell-bind-harness.svelte.d.ts +11 -0
- package/dist/components/workspace/__tests__/workspace-shell-bind-harness.svelte.d.ts.map +1 -0
- package/dist/components/workspace/breadcrumbs-helpers.d.ts +44 -0
- package/dist/components/workspace/breadcrumbs-helpers.d.ts.map +1 -0
- package/dist/components/workspace/breadcrumbs-helpers.js +88 -0
- package/dist/components/workspace/index.d.ts +16 -0
- package/dist/components/workspace/index.d.ts.map +1 -0
- package/dist/components/workspace/index.js +14 -0
- package/dist/components/workspace/manifest-nav.d.ts +200 -0
- package/dist/components/workspace/manifest-nav.d.ts.map +1 -0
- package/dist/components/workspace/manifest-nav.js +408 -0
- package/dist/components/workspace/nav-helpers.d.ts +36 -0
- package/dist/components/workspace/nav-helpers.d.ts.map +1 -0
- package/dist/components/workspace/nav-helpers.js +60 -0
- package/dist/components/workspace/server/__tests__/compose-availability.test.js +383 -0
- package/dist/components/workspace/server/__tests__/typed-context-fixture.d.ts +78 -0
- package/dist/components/workspace/server/__tests__/typed-context-fixture.d.ts.map +1 -0
- package/dist/components/workspace/server/__tests__/typed-context-fixture.js +104 -0
- package/dist/components/workspace/server/compose-availability.d.ts +73 -0
- package/dist/components/workspace/server/compose-availability.d.ts.map +1 -0
- package/dist/components/workspace/server/compose-availability.js +114 -0
- package/dist/components/workspace/server/index.d.ts +13 -0
- package/dist/components/workspace/server/index.d.ts.map +1 -0
- package/dist/components/workspace/server/index.js +11 -0
- package/dist/components/workspace/server/types.d.ts +108 -0
- package/dist/components/workspace/server/types.d.ts.map +1 -0
- package/dist/components/workspace/server/types.js +11 -0
- package/dist/components/workspace/tools-dock/ToolsDock.svelte +565 -0
- package/dist/components/workspace/tools-dock/ToolsDock.svelte.d.ts +14 -0
- package/dist/components/workspace/tools-dock/ToolsDock.svelte.d.ts.map +1 -0
- package/dist/components/workspace/tools-dock/define-tools-dock.svelte.d.ts +143 -0
- package/dist/components/workspace/tools-dock/define-tools-dock.svelte.d.ts.map +1 -0
- package/dist/components/workspace/tools-dock/define-tools-dock.svelte.js +487 -0
- package/dist/components/workspace/tools-dock/use-tools-dock.d.ts +41 -0
- package/dist/components/workspace/tools-dock/use-tools-dock.d.ts.map +1 -0
- package/dist/components/workspace/tools-dock/use-tools-dock.js +50 -0
- package/dist/components/workspace/types.d.ts +372 -0
- package/dist/components/workspace/types.d.ts.map +1 -0
- package/dist/components/workspace/types.js +6 -0
- package/dist/hooks/index.d.ts +11 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +10 -0
- package/dist/hooks/useAppState.svelte.d.ts +46 -0
- package/dist/hooks/useAppState.svelte.d.ts.map +1 -0
- package/dist/hooks/useAppState.svelte.js +59 -0
- package/dist/hooks/useAuth.svelte.d.ts +41 -0
- package/dist/hooks/useAuth.svelte.d.ts.map +1 -0
- package/dist/hooks/useAuth.svelte.js +43 -0
- package/dist/hooks/useLLM.svelte.d.ts +69 -0
- package/dist/hooks/useLLM.svelte.d.ts.map +1 -0
- package/dist/hooks/useLLM.svelte.js +85 -0
- package/dist/hooks/useSTT.svelte.d.ts +68 -0
- package/dist/hooks/useSTT.svelte.d.ts.map +1 -0
- package/dist/hooks/useSTT.svelte.js +97 -0
- package/dist/hooks/useSocket.svelte.d.ts +45 -0
- package/dist/hooks/useSocket.svelte.d.ts.map +1 -0
- package/dist/hooks/useSocket.svelte.js +54 -0
- package/dist/hooks/useTTS.svelte.d.ts +65 -0
- package/dist/hooks/useTTS.svelte.d.ts.map +1 -0
- package/dist/hooks/useTTS.svelte.js +93 -0
- package/dist/hooks/useTheme.d.ts +13 -0
- package/dist/hooks/useTheme.d.ts.map +1 -0
- package/dist/hooks/useTheme.js +16 -0
- package/dist/i18n/__tests__/server.spec.js +50 -0
- package/dist/i18n/server.d.ts +47 -0
- package/dist/i18n/server.d.ts.map +1 -0
- package/dist/i18n/server.js +58 -0
- package/dist/i18n/strings.forms.d.ts +33 -0
- package/dist/i18n/strings.forms.d.ts.map +1 -0
- package/dist/i18n/strings.forms.js +54 -0
- package/dist/i18n/strings.workspace.d.ts +34 -0
- package/dist/i18n/strings.workspace.d.ts.map +1 -0
- package/dist/i18n/strings.workspace.js +40 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/state/__tests__/warm-clients.test.js +40 -0
- package/dist/state/app-state.d.ts +308 -0
- package/dist/state/app-state.d.ts.map +1 -0
- package/dist/state/app-state.js +64 -0
- package/dist/state/app-state.svelte.d.ts +196 -0
- package/dist/state/app-state.svelte.d.ts.map +1 -0
- package/dist/state/app-state.svelte.js +774 -0
- package/dist/state/context.d.ts +23 -0
- package/dist/state/context.d.ts.map +1 -0
- package/dist/state/context.js +32 -0
- package/dist/state/form-context.d.ts +59 -0
- package/dist/state/form-context.d.ts.map +1 -0
- package/dist/state/form-context.js +31 -0
- package/dist/state/form-group-context.d.ts +13 -0
- package/dist/state/form-group-context.d.ts.map +1 -0
- package/dist/state/form-group-context.js +28 -0
- package/dist/state/index.d.ts +9 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +8 -0
- package/dist/state/warm-clients.d.ts +136 -0
- package/dist/state/warm-clients.d.ts.map +1 -0
- package/dist/state/warm-clients.js +231 -0
- package/package.json +137 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fixture for the typed tool-component pattern documented on
|
|
3
|
+
* `ToolDef.component`. The dock erases tool-specific types at registration,
|
|
4
|
+
* but the tool component itself locally annotates `context` with the
|
|
5
|
+
* narrowed `ToolsDockContext<TData, TActions>` shape — see
|
|
6
|
+
* `register-typed-tool.ts` for the registration site that must accept this
|
|
7
|
+
* component without a cast.
|
|
8
|
+
*
|
|
9
|
+
* If any of the type assertions below fail at `svelte-check` / `tsc` time,
|
|
10
|
+
* either the `ToolDef.component` erasure relaxation or the
|
|
11
|
+
* `ToolsDockContext` action-map constraint regressed.
|
|
12
|
+
*/
|
|
13
|
+
import type { ToolsDockApi, ToolsDockContext } from '../../types.js';
|
|
14
|
+
import type { MyActions, MyData } from './typed-tool-types.js';
|
|
15
|
+
type $$ComponentProps = {
|
|
16
|
+
context: ToolsDockContext<MyData, MyActions> | null;
|
|
17
|
+
dock: ToolsDockApi;
|
|
18
|
+
};
|
|
19
|
+
declare const TypedTool: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
20
|
+
type TypedTool = ReturnType<typeof TypedTool>;
|
|
21
|
+
export default TypedTool;
|
|
22
|
+
//# sourceMappingURL=TypedTool.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TypedTool.svelte.d.ts","sourceRoot":"","sources":["../../../../../src/components/workspace/__tests__/typed-tool-fixture/TypedTool.svelte.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE9D,KAAK,gBAAgB,GAAI;IACxB,OAAO,EAAE,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,IAAI,CAAC;IACpD,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AA4BF,QAAA,MAAM,SAAS,sDAAwC,CAAC;AACxD,KAAK,SAAS,GAAG,UAAU,CAAC,OAAO,SAAS,CAAC,CAAC;AAC9C,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registration site for the typed-tool fixture. This file is the contract
|
|
3
|
+
* the workspace ergonomics PR (#1239) is restoring:
|
|
4
|
+
*
|
|
5
|
+
* - `TypedTool.svelte` declares its own typed `context` prop of shape
|
|
6
|
+
* `ToolsDockContext<MyData, MyActions> | null`.
|
|
7
|
+
* - It must be assignable to `ToolDef.component` without a registration-
|
|
8
|
+
* site cast — but this assertion is only meaningful under
|
|
9
|
+
* `svelte-check`. Under `tsc --noEmit`, `.svelte` imports resolve to
|
|
10
|
+
* `Component<any>` via the ambient `declare module '*.svelte'`
|
|
11
|
+
* declaration, so the assignment compiles regardless of what
|
|
12
|
+
* `ToolDef.component` is typed as. CI runs both `typecheck` and `check`
|
|
13
|
+
* (which invokes `svelte-check`) for this reason — see the JSDoc on
|
|
14
|
+
* `../typed-tool-fixture.test.ts` for the full split.
|
|
15
|
+
* - `defineToolsDock<MyData, MyActions>(...)` must accept an interface
|
|
16
|
+
* `MyActions` (no string index signature) under the factory generic.
|
|
17
|
+
* - `dock.setContext({ actions: { triggerSave } })` must still compile
|
|
18
|
+
* with no generic arguments (back-compat for the untyped pattern).
|
|
19
|
+
* - The factory's `<TData, TActions>` generics must flow through to the
|
|
20
|
+
* returned `ToolsDockInstance<TData, TActions>` — see
|
|
21
|
+
* `_assertTypedDockFlow` below for the load-bearing assertion.
|
|
22
|
+
*
|
|
23
|
+
* If TypeScript ever rejects this file under strict checks, the regression
|
|
24
|
+
* from review thread #1239/PRRT_kwDOQDruXs6CbBcK has returned.
|
|
25
|
+
*/
|
|
26
|
+
import { type DefineToolsDockOptions, type ToolDef, type ToolsDockApi, type ToolsDockContext, type ToolsDockInstance } from '../../index.js';
|
|
27
|
+
import type { MyActions, MyData } from './typed-tool-types.js';
|
|
28
|
+
/** Type-only export: a tool registry that uses the typed component. */
|
|
29
|
+
export declare const typedTool: ToolDef;
|
|
30
|
+
/** Type-only export: options that pass the typed action map through. */
|
|
31
|
+
export declare const typedOptions: DefineToolsDockOptions<MyData, MyActions>;
|
|
32
|
+
/**
|
|
33
|
+
* Type-only export: a typed context literal. This must compile under the
|
|
34
|
+
* relaxed `TActions extends { [K in keyof TActions]: (...args: any[]) => any }`
|
|
35
|
+
* constraint — `MyActions` is an interface (no string index signature) and
|
|
36
|
+
* would fail a `Record<string, ...>` constraint.
|
|
37
|
+
*/
|
|
38
|
+
export declare const typedContext: ToolsDockContext<MyData, MyActions>;
|
|
39
|
+
/**
|
|
40
|
+
* Type-only export: the untyped (back-compat) setContext shape — passing
|
|
41
|
+
* `actions` with no factory generic. This caught a previous regression
|
|
42
|
+
* where `TActions = Record<string, never>` defaulted the action map to
|
|
43
|
+
* "no keys", rejecting `{ triggerSave }` outright.
|
|
44
|
+
*/
|
|
45
|
+
export declare const untypedContext: ToolsDockContext;
|
|
46
|
+
/** Type-only assertion: typed instance preserves the action shape. */
|
|
47
|
+
export type _AssertTypedActions = ToolsDockApi['context'] extends infer C ? C : never;
|
|
48
|
+
/**
|
|
49
|
+
* Type-only fixture: exercises the end-to-end generic flow on the public
|
|
50
|
+
* surface returned by `defineToolsDock<TData, TActions>(...)`. This is the
|
|
51
|
+
* regression Codex flagged in PR #1239 round-2 — the factory accepts the
|
|
52
|
+
* generics but erases them on the return type, so `dock.setContext(...)` and
|
|
53
|
+
* `dock.context?.data` fall back to the default-typed shape.
|
|
54
|
+
*
|
|
55
|
+
* The function below is never called at runtime. Its body has to compile,
|
|
56
|
+
* which is the load-bearing assertion: if `ToolsDockApi` / `ToolsDockInstance`
|
|
57
|
+
* ever stop parameterizing their `context` / `setContext` signatures, the
|
|
58
|
+
* lines marked TYPED below would fail to assign `MyData` / `MyActions` into
|
|
59
|
+
* the default-typed shape (no string index signature).
|
|
60
|
+
*
|
|
61
|
+
* Lives inline rather than at module scope because `defineToolsDock` calls
|
|
62
|
+
* `setContext`, which is only legal inside a component init scope.
|
|
63
|
+
*/
|
|
64
|
+
export declare function _assertTypedDockFlow(): ToolsDockInstance<MyData, MyActions>;
|
|
65
|
+
//# sourceMappingURL=register-typed-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-typed-tool.d.ts","sourceRoot":"","sources":["../../../../../src/components/workspace/__tests__/typed-tool-fixture/register-typed-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EACL,KAAK,sBAAsB,EAE3B,KAAK,OAAO,EACZ,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/D,uEAAuE;AACvE,eAAO,MAAM,SAAS,EAAE,OAQvB,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,YAAY,EAAE,sBAAsB,CAAC,MAAM,EAAE,SAAS,CAElE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAO5D,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,EAAE,gBAK5B,CAAC;AAEF,sEAAsE;AACtE,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,SAAS,CAAC,SAAS,MAAM,CAAC,GACrE,CAAC,GACD,KAAK,CAAC;AAEV;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,IAAI,iBAAiB,CAAC,MAAM,EAAE,SAAS,CAAC,CAmC3E"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registration site for the typed-tool fixture. This file is the contract
|
|
3
|
+
* the workspace ergonomics PR (#1239) is restoring:
|
|
4
|
+
*
|
|
5
|
+
* - `TypedTool.svelte` declares its own typed `context` prop of shape
|
|
6
|
+
* `ToolsDockContext<MyData, MyActions> | null`.
|
|
7
|
+
* - It must be assignable to `ToolDef.component` without a registration-
|
|
8
|
+
* site cast — but this assertion is only meaningful under
|
|
9
|
+
* `svelte-check`. Under `tsc --noEmit`, `.svelte` imports resolve to
|
|
10
|
+
* `Component<any>` via the ambient `declare module '*.svelte'`
|
|
11
|
+
* declaration, so the assignment compiles regardless of what
|
|
12
|
+
* `ToolDef.component` is typed as. CI runs both `typecheck` and `check`
|
|
13
|
+
* (which invokes `svelte-check`) for this reason — see the JSDoc on
|
|
14
|
+
* `../typed-tool-fixture.test.ts` for the full split.
|
|
15
|
+
* - `defineToolsDock<MyData, MyActions>(...)` must accept an interface
|
|
16
|
+
* `MyActions` (no string index signature) under the factory generic.
|
|
17
|
+
* - `dock.setContext({ actions: { triggerSave } })` must still compile
|
|
18
|
+
* with no generic arguments (back-compat for the untyped pattern).
|
|
19
|
+
* - The factory's `<TData, TActions>` generics must flow through to the
|
|
20
|
+
* returned `ToolsDockInstance<TData, TActions>` — see
|
|
21
|
+
* `_assertTypedDockFlow` below for the load-bearing assertion.
|
|
22
|
+
*
|
|
23
|
+
* If TypeScript ever rejects this file under strict checks, the regression
|
|
24
|
+
* from review thread #1239/PRRT_kwDOQDruXs6CbBcK has returned.
|
|
25
|
+
*/
|
|
26
|
+
import { defineToolsDock, } from '../../index.js';
|
|
27
|
+
import TypedTool from './TypedTool.svelte';
|
|
28
|
+
/** Type-only export: a tool registry that uses the typed component. */
|
|
29
|
+
export const typedTool = {
|
|
30
|
+
id: 'typed',
|
|
31
|
+
label: 'Typed',
|
|
32
|
+
// ↳ TypedTool's `context` prop is narrower than the base
|
|
33
|
+
// `ToolsDockContext | null`. Under strict prop variance this would be
|
|
34
|
+
// rejected if `ToolDef.component` were typed as
|
|
35
|
+
// `Component<{ context: ToolsDockContext | null; dock: ToolsDockApi }>`.
|
|
36
|
+
component: TypedTool,
|
|
37
|
+
};
|
|
38
|
+
/** Type-only export: options that pass the typed action map through. */
|
|
39
|
+
export const typedOptions = {
|
|
40
|
+
tools: [typedTool],
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Type-only export: a typed context literal. This must compile under the
|
|
44
|
+
* relaxed `TActions extends { [K in keyof TActions]: (...args: any[]) => any }`
|
|
45
|
+
* constraint — `MyActions` is an interface (no string index signature) and
|
|
46
|
+
* would fail a `Record<string, ...>` constraint.
|
|
47
|
+
*/
|
|
48
|
+
export const typedContext = {
|
|
49
|
+
type: 'route',
|
|
50
|
+
data: { siteSlug: 'demo', contentId: 'demo-1' },
|
|
51
|
+
actions: {
|
|
52
|
+
triggerSave: () => undefined,
|
|
53
|
+
triggerReview: (_kind) => undefined,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Type-only export: the untyped (back-compat) setContext shape — passing
|
|
58
|
+
* `actions` with no factory generic. This caught a previous regression
|
|
59
|
+
* where `TActions = Record<string, never>` defaulted the action map to
|
|
60
|
+
* "no keys", rejecting `{ triggerSave }` outright.
|
|
61
|
+
*/
|
|
62
|
+
export const untypedContext = {
|
|
63
|
+
type: 'route',
|
|
64
|
+
actions: {
|
|
65
|
+
triggerSave: () => undefined,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Type-only fixture: exercises the end-to-end generic flow on the public
|
|
70
|
+
* surface returned by `defineToolsDock<TData, TActions>(...)`. This is the
|
|
71
|
+
* regression Codex flagged in PR #1239 round-2 — the factory accepts the
|
|
72
|
+
* generics but erases them on the return type, so `dock.setContext(...)` and
|
|
73
|
+
* `dock.context?.data` fall back to the default-typed shape.
|
|
74
|
+
*
|
|
75
|
+
* The function below is never called at runtime. Its body has to compile,
|
|
76
|
+
* which is the load-bearing assertion: if `ToolsDockApi` / `ToolsDockInstance`
|
|
77
|
+
* ever stop parameterizing their `context` / `setContext` signatures, the
|
|
78
|
+
* lines marked TYPED below would fail to assign `MyData` / `MyActions` into
|
|
79
|
+
* the default-typed shape (no string index signature).
|
|
80
|
+
*
|
|
81
|
+
* Lives inline rather than at module scope because `defineToolsDock` calls
|
|
82
|
+
* `setContext`, which is only legal inside a component init scope.
|
|
83
|
+
*/
|
|
84
|
+
export function _assertTypedDockFlow() {
|
|
85
|
+
const typedDock = defineToolsDock({
|
|
86
|
+
tools: [typedTool],
|
|
87
|
+
fetchAvailability: async (ctx) => {
|
|
88
|
+
// TYPED: `ctx?.data?.siteSlug` must be `string | undefined`, not
|
|
89
|
+
// `unknown`. If the factory dropped its generics on the callback
|
|
90
|
+
// signature, the next line would only compile as `unknown`.
|
|
91
|
+
const _siteSlug = ctx?.data?.siteSlug;
|
|
92
|
+
const _save = ctx?.actions?.triggerSave;
|
|
93
|
+
return [];
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
// TYPED: `setContext` accepts the narrowed context with no manual cast.
|
|
97
|
+
// Pre-fix this assignment failed because `ToolsDockApi.setContext` was
|
|
98
|
+
// typed to receive only the default-generic `ToolsDockContext`, whose
|
|
99
|
+
// `actions` slot expected `Record<string, (...args: any[]) => unknown>` —
|
|
100
|
+
// `MyActions` (an interface, no string index signature) was rejected.
|
|
101
|
+
typedDock.setContext({
|
|
102
|
+
type: 'route',
|
|
103
|
+
data: { siteSlug: 'demo', contentId: 'demo-1' },
|
|
104
|
+
actions: {
|
|
105
|
+
triggerSave: () => undefined,
|
|
106
|
+
triggerReview: (_kind) => undefined,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
// TYPED: reading typed properties off the public `context` surface must
|
|
110
|
+
// resolve to the consumer's shapes, not `Record<string, unknown>` /
|
|
111
|
+
// `Record<string, (...args: any[]) => unknown>`.
|
|
112
|
+
const _slug = typedDock.context?.data?.siteSlug;
|
|
113
|
+
const _action = typedDock.context?.actions?.triggerSave;
|
|
114
|
+
return typedDock;
|
|
115
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-only fixtures for the typed tool-component pattern. Lives in a
|
|
3
|
+
* `.ts` file (not `.svelte`) so the types can be imported cleanly from
|
|
4
|
+
* both the component and the registration site without relying on
|
|
5
|
+
* Svelte's `<script context="module">` re-export semantics.
|
|
6
|
+
*/
|
|
7
|
+
export interface MyData {
|
|
8
|
+
siteSlug: string;
|
|
9
|
+
contentId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MyActions {
|
|
12
|
+
triggerSave(): void;
|
|
13
|
+
triggerReview(kind: string): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=typed-tool-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typed-tool-types.d.ts","sourceRoot":"","sources":["../../../../../src/components/workspace/__tests__/typed-tool-fixture/typed-tool-types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,MAAM;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,WAAW,IAAI,IAAI,CAAC;IACpB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-only fixtures for the typed tool-component pattern. Lives in a
|
|
3
|
+
* `.ts` file (not `.svelte`) so the types can be imported cleanly from
|
|
4
|
+
* both the component and the registration site without relying on
|
|
5
|
+
* Svelte's `<script context="module">` re-export semantics.
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression tests for the typed-tool component pattern documented on
|
|
3
|
+
* `ToolDef.component` and `ToolsDockContext`.
|
|
4
|
+
*
|
|
5
|
+
* The static type checks live in `typed-tool-fixture/register-typed-tool.ts`
|
|
6
|
+
* and `typed-tool-fixture/TypedTool.svelte`. They split across two checkers:
|
|
7
|
+
*
|
|
8
|
+
* - `tsc --noEmit` (the package's `typecheck` script, run in CI via
|
|
9
|
+
* `pnpm turbo run typecheck`) catches the regressions that live in the
|
|
10
|
+
* `.ts` files:
|
|
11
|
+
* * The factory `<TData, TActions>` generics flow into
|
|
12
|
+
* `ToolsDockApi.setContext` / `ToolsDockApi.context`. If they ever
|
|
13
|
+
* erase back to the default shape, the `_assertTypedDockFlow`
|
|
14
|
+
* function in `register-typed-tool.ts` fails to compile.
|
|
15
|
+
* * The `TActions` constraint accepts interface-style action maps
|
|
16
|
+
* (no string index signature). If it ever tightens back to
|
|
17
|
+
* `Record<string, ...>`, the `typedContext` / `untypedContext`
|
|
18
|
+
* literals fail to compile.
|
|
19
|
+
*
|
|
20
|
+
* - `svelte-check` (the package's `check` script, run in CI via
|
|
21
|
+
* `pnpm turbo run check`) catches the regression that lives in the
|
|
22
|
+
* `.svelte` file:
|
|
23
|
+
* * `ToolDef.component` is typed `Component<any>` so a tool component
|
|
24
|
+
* declaring a narrower `context` prop is assignable at registration.
|
|
25
|
+
* Under `tsc --noEmit` alone, `.svelte` imports resolve to
|
|
26
|
+
* `Component<any>` via the ambient `declare module '*.svelte'`
|
|
27
|
+
* declaration — so the registration-site assertion in
|
|
28
|
+
* `register-typed-tool.ts` would compile regardless of what
|
|
29
|
+
* `ToolDef.component` actually demands. Only `svelte-check` actually
|
|
30
|
+
* resolves `TypedTool.svelte`'s real prop shape and exercises the
|
|
31
|
+
* contravariant assignment, which is why the `check` script is part
|
|
32
|
+
* of CI alongside `typecheck`.
|
|
33
|
+
*
|
|
34
|
+
* The runtime test below guards against accidental regressions in the
|
|
35
|
+
* `ToolDef` storage shape itself (e.g. registering a component that ends
|
|
36
|
+
* up unreachable because of a runtime type assertion) and exercises the
|
|
37
|
+
* round-trip of typed / untyped context shapes through `dock.setContext`.
|
|
38
|
+
*/
|
|
39
|
+
import { flushSync, mount, unmount } from 'svelte';
|
|
40
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
41
|
+
import HostHarness from './harness.svelte';
|
|
42
|
+
import { typedContext, typedOptions, untypedContext, } from './typed-tool-fixture/register-typed-tool.js';
|
|
43
|
+
function mountTypedDock() {
|
|
44
|
+
const target = document.createElement('div');
|
|
45
|
+
document.body.appendChild(target);
|
|
46
|
+
const exposed = {
|
|
47
|
+
dock: undefined,
|
|
48
|
+
};
|
|
49
|
+
const component = mount(HostHarness, {
|
|
50
|
+
target,
|
|
51
|
+
props: {
|
|
52
|
+
options: typedOptions,
|
|
53
|
+
onReady: (dock) => {
|
|
54
|
+
exposed.dock = dock;
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
return {
|
|
59
|
+
dock: exposed.dock,
|
|
60
|
+
teardown: () => {
|
|
61
|
+
unmount(component);
|
|
62
|
+
target.remove();
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
describe('typed-tool fixture (regression guard for PR #1239 review)', () => {
|
|
67
|
+
let cleanup = [];
|
|
68
|
+
beforeEach(() => {
|
|
69
|
+
cleanup = [];
|
|
70
|
+
});
|
|
71
|
+
afterEach(() => {
|
|
72
|
+
for (const fn of cleanup.splice(0))
|
|
73
|
+
fn();
|
|
74
|
+
});
|
|
75
|
+
it('accepts a tool component with a narrowed context prop type', () => {
|
|
76
|
+
const { dock, teardown } = mountTypedDock();
|
|
77
|
+
cleanup.push(teardown);
|
|
78
|
+
// The fixture registered TypedTool, whose `context` prop is
|
|
79
|
+
// `ToolsDockContext<MyData, MyActions> | null`. If ToolDef.component's
|
|
80
|
+
// type contravariantly required the wider base context, this
|
|
81
|
+
// registration would not have compiled — which `pnpm typecheck` catches
|
|
82
|
+
// first. At runtime, we just need to confirm the tool is registered
|
|
83
|
+
// and reachable.
|
|
84
|
+
expect(dock.availableTools.map((t) => t.id)).toEqual(['typed']);
|
|
85
|
+
dock.open('typed');
|
|
86
|
+
flushSync();
|
|
87
|
+
expect(dock.isOpen).toBe(true);
|
|
88
|
+
expect(dock.activeTool).toBe('typed');
|
|
89
|
+
});
|
|
90
|
+
it('accepts the typed context shape via setContext()', () => {
|
|
91
|
+
const { dock, teardown } = mountTypedDock();
|
|
92
|
+
cleanup.push(teardown);
|
|
93
|
+
dock.setContext(typedContext);
|
|
94
|
+
flushSync();
|
|
95
|
+
// The context round-trips with the typed action shape intact at runtime
|
|
96
|
+
// (the dock erases the generic but does not mutate the value).
|
|
97
|
+
expect(dock.context?.data).toEqual({
|
|
98
|
+
siteSlug: 'demo',
|
|
99
|
+
contentId: 'demo-1',
|
|
100
|
+
});
|
|
101
|
+
// The action is callable — the runtime keeps reference identity.
|
|
102
|
+
expect(typeof dock.context?.actions?.triggerSave).toBe('function');
|
|
103
|
+
});
|
|
104
|
+
it('accepts the untyped (back-compat) context shape via setContext()', () => {
|
|
105
|
+
const { dock, teardown } = mountTypedDock();
|
|
106
|
+
cleanup.push(teardown);
|
|
107
|
+
// `untypedContext` uses the default `ToolsDockContext` (no generic
|
|
108
|
+
// arguments). If the default `TActions` were the prior
|
|
109
|
+
// `Record<string, never>`, this `actions: { triggerSave }` would have
|
|
110
|
+
// been rejected at typecheck time — the regression Copilot flagged.
|
|
111
|
+
dock.setContext(untypedContext);
|
|
112
|
+
flushSync();
|
|
113
|
+
expect(typeof dock.context?.actions?.triggerSave).toBe('function');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
11
|
+
};
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
13
|
+
}
|
|
14
|
+
declare const UseHarnessOrphan: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
+
[evt: string]: CustomEvent<any>;
|
|
16
|
+
}, {}, {}, string>;
|
|
17
|
+
type UseHarnessOrphan = InstanceType<typeof UseHarnessOrphan>;
|
|
18
|
+
export default UseHarnessOrphan;
|
|
19
|
+
//# sourceMappingURL=use-harness-orphan.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-harness-orphan.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/__tests__/use-harness-orphan.svelte.ts"],"names":[],"mappings":"AAkBA,UAAU,kCAAkC,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,EAAE,QAAQ,GAAG,MAAM;IACpM,KAAK,OAAO,EAAE,OAAO,QAAQ,EAAE,2BAA2B,CAAC,KAAK,CAAC,GAAG,OAAO,QAAQ,EAAE,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG;QAAE,UAAU,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC;IACjK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,KAAK,CAAA;KAAC,GAAG,OAAO,GAAG;QAAE,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,GAAG,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC;IACtG,YAAY,CAAC,EAAE,QAAQ,CAAC;CAC3B;AAKD,QAAA,MAAM,gBAAgB;;kBAA+E,CAAC;AACpF,KAAK,gBAAgB,GAAG,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Provider + consumer in one component. The factory call sets context on
|
|
4
|
+
* this component; an immediate-child snippet then reads it via useToolsDock.
|
|
5
|
+
*/
|
|
6
|
+
import { defineToolsDock } from '../tools-dock/define-tools-dock.svelte.js';
|
|
7
|
+
import { useToolsDock } from '../tools-dock/use-tools-dock.js';
|
|
8
|
+
import type { ToolsDockApi } from '../types.js';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
onReady: (api: ToolsDockApi) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const { onReady }: Props = $props();
|
|
15
|
+
defineToolsDock({
|
|
16
|
+
tools: [{ id: 'demo', label: 'Demo', component: (() => null) as never }],
|
|
17
|
+
});
|
|
18
|
+
// useToolsDock reads from the same component init scope's context tree.
|
|
19
|
+
const api = useToolsDock();
|
|
20
|
+
// This harness intentionally snapshots the callback during setup.
|
|
21
|
+
// svelte-ignore state_referenced_locally
|
|
22
|
+
onReady(api);
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToolsDockApi } from '../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
onReady: (api: ToolsDockApi) => void;
|
|
4
|
+
}
|
|
5
|
+
declare const UseHarness: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type UseHarness = ReturnType<typeof UseHarness>;
|
|
7
|
+
export default UseHarness;
|
|
8
|
+
//# sourceMappingURL=use-harness.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-harness.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/__tests__/use-harness.svelte.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGhD,UAAU,KAAK;IACb,OAAO,EAAE,CAAC,GAAG,EAAE,YAAY,KAAK,IAAI,CAAC;CACtC;AAqBD,QAAA,MAAM,UAAU,2CAAwC,CAAC;AACzD,KAAK,UAAU,GAAG,UAAU,CAAC,OAAO,UAAU,CAAC,CAAC;AAChD,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for useToolsDock.
|
|
3
|
+
*/
|
|
4
|
+
import { mount, unmount } from 'svelte';
|
|
5
|
+
import { describe, expect, it } from 'vitest';
|
|
6
|
+
import UseHarness from './use-harness.svelte';
|
|
7
|
+
import OrphanHarness from './use-harness-orphan.svelte';
|
|
8
|
+
describe('useToolsDock', () => {
|
|
9
|
+
it('returns the dock when called inside a <ToolsDock> provider', () => {
|
|
10
|
+
const target = document.createElement('div');
|
|
11
|
+
document.body.appendChild(target);
|
|
12
|
+
let observed = null;
|
|
13
|
+
const component = mount(UseHarness, {
|
|
14
|
+
target,
|
|
15
|
+
props: {
|
|
16
|
+
onReady: (api) => {
|
|
17
|
+
observed = { isOpen: api.isOpen, activeTool: api.activeTool };
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
expect(observed).not.toBeNull();
|
|
22
|
+
expect(observed?.isOpen).toBe(false);
|
|
23
|
+
expect(observed?.activeTool).toBeNull();
|
|
24
|
+
unmount(component);
|
|
25
|
+
target.remove();
|
|
26
|
+
});
|
|
27
|
+
it('throws a clear error when called outside a provider', () => {
|
|
28
|
+
const target = document.createElement('div');
|
|
29
|
+
document.body.appendChild(target);
|
|
30
|
+
expect(() => mount(OrphanHarness, { target })).toThrow(/ToolsDock/);
|
|
31
|
+
target.remove();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Test harness for `bind:mobileNavOpen` on `WorkspaceShell`.
|
|
4
|
+
*
|
|
5
|
+
* Exposes the bindable drawer state on the outer `state` object so tests
|
|
6
|
+
* can observe the consumer-visible value after every interaction. The
|
|
7
|
+
* `onReady` callback hands back a setter the test can use to drive the
|
|
8
|
+
* value externally — verifying the two-way binding really is two-way.
|
|
9
|
+
*/
|
|
10
|
+
import { createRawSnippet } from 'svelte';
|
|
11
|
+
import WorkspaceShell from '../WorkspaceShell.svelte';
|
|
12
|
+
|
|
13
|
+
interface Props {
|
|
14
|
+
initial?: boolean;
|
|
15
|
+
onReady?: (controls: {
|
|
16
|
+
setMobileNavOpen: (next: boolean) => void;
|
|
17
|
+
getMobileNavOpen: () => boolean;
|
|
18
|
+
}) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { initial = false, onReady }: Props = $props();
|
|
22
|
+
|
|
23
|
+
// This harness intentionally snapshots the initial bindable value.
|
|
24
|
+
// svelte-ignore state_referenced_locally
|
|
25
|
+
let mobileNavOpen = $state(initial);
|
|
26
|
+
|
|
27
|
+
const content = createRawSnippet(() => ({
|
|
28
|
+
render: () => '<span>content</span>',
|
|
29
|
+
}));
|
|
30
|
+
|
|
31
|
+
// This harness intentionally snapshots the callback during setup.
|
|
32
|
+
// svelte-ignore state_referenced_locally
|
|
33
|
+
onReady?.({
|
|
34
|
+
setMobileNavOpen: (next: boolean) => {
|
|
35
|
+
mobileNavOpen = next;
|
|
36
|
+
},
|
|
37
|
+
getMobileNavOpen: () => mobileNavOpen,
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
|
|
41
|
+
<WorkspaceShell bind:mobileNavOpen>
|
|
42
|
+
{@render content()}
|
|
43
|
+
</WorkspaceShell>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
initial?: boolean;
|
|
3
|
+
onReady?: (controls: {
|
|
4
|
+
setMobileNavOpen: (next: boolean) => void;
|
|
5
|
+
getMobileNavOpen: () => boolean;
|
|
6
|
+
}) => void;
|
|
7
|
+
}
|
|
8
|
+
declare const WorkspaceShellBindHarness: import("svelte").Component<Props, {}, "">;
|
|
9
|
+
type WorkspaceShellBindHarness = ReturnType<typeof WorkspaceShellBindHarness>;
|
|
10
|
+
export default WorkspaceShellBindHarness;
|
|
11
|
+
//# sourceMappingURL=workspace-shell-bind-harness.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workspace-shell-bind-harness.svelte.d.ts","sourceRoot":"","sources":["../../../../src/components/workspace/__tests__/workspace-shell-bind-harness.svelte.ts"],"names":[],"mappings":"AAeA,UAAU,KAAK;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE;QACnB,gBAAgB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;QAC1C,gBAAgB,EAAE,MAAM,OAAO,CAAC;KACjC,KAAK,IAAI,CAAC;CACZ;AAiCD,QAAA,MAAM,yBAAyB,2CAAwC,CAAC;AACxE,KAAK,yBAAyB,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC9E,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure helpers for breadcrumb derivation.
|
|
3
|
+
*
|
|
4
|
+
* Extracted so the path-walking logic can be unit-tested without rendering
|
|
5
|
+
* a Svelte component.
|
|
6
|
+
*/
|
|
7
|
+
import type { BreadcrumbItem, NavItem } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Walk a nav tree depth-first and return the label of the item whose
|
|
10
|
+
* `href` matches exactly, or `null` if not found.
|
|
11
|
+
*/
|
|
12
|
+
export declare function findLabelInNav(items: NavItem[], href: string): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Default label fallback for unknown segments: capitalize the first letter
|
|
15
|
+
* and turn dashes/underscores into spaces.
|
|
16
|
+
*/
|
|
17
|
+
export declare function capitalizeSegment(segment: string): string;
|
|
18
|
+
export interface DeriveCrumbsOptions {
|
|
19
|
+
/** Optional first crumb (e.g., site identity). */
|
|
20
|
+
rootCrumb?: BreadcrumbItem;
|
|
21
|
+
/**
|
|
22
|
+
* Skip pathname segments until (and including) the given path is matched.
|
|
23
|
+
* Example: `startAfter: 'sites/foo'` ignores everything up through
|
|
24
|
+
* `/sites/foo` in the pathname.
|
|
25
|
+
*/
|
|
26
|
+
startAfter?: string;
|
|
27
|
+
/** Fall back to capitalized segments for unmatched paths (default: true). */
|
|
28
|
+
capitalize?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Derive a breadcrumb trail from a pathname + nav tree.
|
|
32
|
+
*
|
|
33
|
+
* Strategy:
|
|
34
|
+
* 1. Optionally prepend `rootCrumb`.
|
|
35
|
+
* 2. Split the pathname into segments.
|
|
36
|
+
* 3. If `startAfter` is set, locate its trailing segment in the
|
|
37
|
+
* pathname and skip everything before/including it. The
|
|
38
|
+
* `startAfter` value may include a leading slash or none and
|
|
39
|
+
* may be a multi-segment path (e.g. `sites/foo`).
|
|
40
|
+
* 4. Walk the remaining segments, building cumulative paths; for
|
|
41
|
+
* each, try to find a matching nav label, otherwise capitalize.
|
|
42
|
+
*/
|
|
43
|
+
export declare function deriveCrumbsFromNav(pathname: string, nav: NavItem[], options?: DeriveCrumbsOptions): BreadcrumbItem[];
|
|
44
|
+
//# sourceMappingURL=breadcrumbs-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"breadcrumbs-helpers.d.ts","sourceRoot":"","sources":["../../../src/components/workspace/breadcrumbs-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1D;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAS5E;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAIzD;AAED,MAAM,WAAW,mBAAmB;IAClC,kDAAkD;IAClD,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,OAAO,EAAE,EACd,OAAO,GAAE,mBAAwB,GAChC,cAAc,EAAE,CA+ClB"}
|