@dxos/app-framework 0.8.4-main.84f28bd → 0.8.4-main.ae835ea
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.storybook/main.mts +11 -0
- package/.storybook/preview.mts +8 -0
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/.swc/plugins/{v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 → linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7} +0 -0
- package/dist/lib/browser/{app-graph-builder-BGGXLD6T.mjs → app-graph-builder-PSA3RESL.mjs} +31 -30
- package/dist/lib/browser/app-graph-builder-PSA3RESL.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2636QSIK.mjs → chunk-2VZ4RF4A.mjs} +347 -257
- package/dist/lib/browser/chunk-2VZ4RF4A.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DHZB7HG7.mjs → chunk-CPVYIS24.mjs} +172 -134
- package/dist/lib/browser/chunk-CPVYIS24.mjs.map +7 -0
- package/dist/lib/browser/{chunk-ORWHM7CO.mjs → chunk-SCPE4ZO2.mjs} +11 -8
- package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -28
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs → intent-dispatcher-BND6IF4U.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-O67UANYP.mjs → intent-resolver-27FJAJDE.mjs} +7 -7
- package/dist/lib/browser/intent-resolver-27FJAJDE.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-LFKDWHUQ.mjs → store-F545UOIR.mjs} +4 -4
- package/dist/lib/browser/{store-LFKDWHUQ.mjs.map → store-F545UOIR.mjs.map} +2 -2
- package/dist/lib/browser/testing/index.mjs +17 -21
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/worker.mjs +7 -9
- package/dist/lib/node-esm/{app-graph-builder-QHIJUYYW.mjs → app-graph-builder-VJGZ6KH7.mjs} +31 -30
- package/dist/lib/node-esm/app-graph-builder-VJGZ6KH7.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VSKRV3NW.mjs → chunk-3RRWO5TD.mjs} +347 -257
- package/dist/lib/node-esm/chunk-3RRWO5TD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NJAFK626.mjs → chunk-MN37WUJ2.mjs} +172 -134
- package/dist/lib/node-esm/chunk-MN37WUJ2.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UMZQERLE.mjs → chunk-ZX63QUGE.mjs} +11 -8
- package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +20 -28
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs → intent-dispatcher-254AZ6EE.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-K3D4BXQQ.mjs → intent-resolver-NPMOPNFL.mjs} +7 -7
- package/dist/lib/node-esm/intent-resolver-NPMOPNFL.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-53XDUBMD.mjs → store-CINC4R4L.mjs} +4 -4
- package/dist/lib/node-esm/{store-53XDUBMD.mjs.map → store-CINC4R4L.mjs.map} +2 -2
- package/dist/lib/node-esm/testing/index.mjs +17 -21
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/worker.mjs +7 -9
- package/dist/types/src/common/capabilities.d.ts +89 -10
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/collaboration.d.ts +10 -9
- package/dist/types/src/common/collaboration.d.ts.map +1 -1
- package/dist/types/src/common/events.d.ts.map +1 -1
- package/dist/types/src/common/file.d.ts +1 -1
- package/dist/types/src/common/file.d.ts.map +1 -1
- package/dist/types/src/common/layout.d.ts +1 -3
- package/dist/types/src/common/layout.d.ts.map +1 -1
- package/dist/types/src/common/surface.d.ts +7 -13
- package/dist/types/src/common/surface.d.ts.map +1 -1
- package/dist/types/src/common/translations.d.ts +1 -1
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/components/App.d.ts +10 -0
- package/dist/types/src/components/App.d.ts.map +1 -0
- package/dist/types/src/components/App.stories.d.ts +14 -0
- package/dist/types/src/components/App.stories.d.ts.map +1 -0
- package/dist/types/src/components/DefaultFallback.d.ts +8 -0
- package/dist/types/src/components/DefaultFallback.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.d.ts.map +1 -0
- package/dist/types/src/{App.d.ts → components/useApp.d.ts} +7 -6
- package/dist/types/src/components/useApp.d.ts.map +1 -0
- package/dist/types/src/components/useLoading.d.ts +19 -0
- package/dist/types/src/components/useLoading.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.d.ts +7 -4
- package/dist/types/src/core/capabilities.d.ts.map +1 -1
- package/dist/types/src/core/manager.d.ts +6 -2
- package/dist/types/src/core/manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin.d.ts +8 -1
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/debug/Debug.d.ts +1 -1
- package/dist/types/src/playground/debug/plugin.d.ts +1 -1
- package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/generator/Main.d.ts +1 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +1 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
- package/dist/types/src/playground/generator/generator.d.ts +1 -1
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/layout/Layout.d.ts +2 -2
- package/dist/types/src/playground/layout/plugin.d.ts +1 -1
- package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +1 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/schema.d.ts +1 -1
- package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
- package/dist/types/src/playground/playground.stories.d.ts +5 -4
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/actions.d.ts +5 -7
- package/dist/types/src/plugin-intent/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/errors.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/index.d.ts +1 -0
- package/dist/types/src/plugin-intent/index.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +7 -7
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/intent.d.ts +1 -1
- package/dist/types/src/plugin-intent/intent.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/meta.d.ts +3 -0
- package/dist/types/src/plugin-intent/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +1 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/actions.d.ts +5 -7
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +1 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +1 -1
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/meta.d.ts +3 -0
- package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/store.d.ts +1 -1
- package/dist/types/src/plugin-settings/store.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/translations.d.ts +2 -1
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
- package/dist/types/src/react/ErrorBoundary.d.ts +13 -14
- package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
- package/dist/types/src/react/IntentContext.d.ts.map +1 -1
- package/dist/types/src/react/Surface.d.ts +2 -2
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +6 -5
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
- package/dist/types/src/react/common.d.ts.map +1 -1
- package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts +9 -8
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +4 -0
- package/package.json +34 -29
- package/src/common/capabilities.ts +117 -13
- package/src/common/collaboration.ts +6 -9
- package/src/common/events.ts +3 -1
- package/src/common/file.ts +1 -1
- package/src/common/layout.ts +3 -4
- package/src/common/surface.ts +15 -18
- package/src/common/translations.ts +1 -1
- package/src/components/App.stories.tsx +33 -0
- package/src/components/App.tsx +59 -0
- package/src/components/DefaultFallback.tsx +26 -0
- package/src/components/index.ts +5 -0
- package/src/{App.tsx → components/useApp.tsx} +24 -136
- package/src/components/useLoading.tsx +70 -0
- package/src/core/capabilities.test.ts +2 -2
- package/src/core/capabilities.ts +18 -9
- package/src/core/manager.test.ts +22 -21
- package/src/core/manager.ts +139 -54
- package/src/core/plugin.ts +13 -2
- package/src/helpers.test.ts +1 -1
- package/src/index.ts +1 -1
- package/src/playground/debug/Debug.tsx +1 -1
- package/src/playground/debug/plugin.ts +7 -8
- package/src/playground/generator/Toolbar.tsx +2 -1
- package/src/playground/generator/generator.ts +4 -4
- package/src/playground/generator/plugin.ts +12 -13
- package/src/playground/layout/plugin.ts +10 -9
- package/src/playground/logger/Toolbar.tsx +2 -1
- package/src/playground/logger/plugin.ts +30 -25
- package/src/playground/logger/schema.ts +1 -1
- package/src/playground/playground.stories.tsx +20 -16
- package/src/plugin-intent/IntentPlugin.ts +13 -13
- package/src/plugin-intent/actions.ts +4 -6
- package/src/plugin-intent/errors.ts +2 -1
- package/src/plugin-intent/index.ts +1 -0
- package/src/plugin-intent/intent-dispatcher.test.ts +10 -3
- package/src/plugin-intent/intent-dispatcher.ts +16 -12
- package/src/plugin-intent/intent.ts +1 -1
- package/src/plugin-intent/meta.ts +10 -0
- package/src/plugin-settings/SettingsPlugin.ts +27 -28
- package/src/plugin-settings/actions.ts +9 -13
- package/src/plugin-settings/app-graph-builder.ts +20 -17
- package/src/plugin-settings/intent-resolver.ts +5 -4
- package/src/plugin-settings/meta.ts +10 -0
- package/src/plugin-settings/store.ts +1 -1
- package/src/plugin-settings/translations.ts +3 -3
- package/src/react/ErrorBoundary.tsx +26 -15
- package/src/react/IntentContext.tsx +3 -2
- package/src/react/Surface.stories.tsx +23 -18
- package/src/react/Surface.tsx +14 -5
- package/src/react/common.ts +2 -1
- package/src/react/useCapabilities.ts +2 -1
- package/src/testing/withPluginManager.stories.tsx +9 -5
- package/src/testing/withPluginManager.tsx +33 -32
- package/tsconfig.json +6 -10
- package/vitest.config.ts +8 -6
- package/.eslintrc.cjs +0 -9
- package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
- package/dist/lib/browser/app-graph-builder-BGGXLD6T.mjs.map +0 -7
- package/dist/lib/browser/chunk-2636QSIK.mjs.map +0 -7
- package/dist/lib/browser/chunk-DHZB7HG7.mjs.map +0 -7
- package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-O67UANYP.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-QHIJUYYW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NJAFK626.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VSKRV3NW.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-K3D4BXQQ.mjs.map +0 -7
- package/dist/types/src/App.d.ts.map +0 -1
- package/typedoc/.nojekyll +0 -1
- package/typedoc/assets/hierarchy.js +0 -1
- package/typedoc/assets/highlight.css +0 -106
- package/typedoc/assets/icons.js +0 -18
- package/typedoc/assets/icons.svg +0 -1
- package/typedoc/assets/main.js +0 -60
- package/typedoc/assets/navigation.js +0 -1
- package/typedoc/assets/search.js +0 -1
- package/typedoc/assets/style.css +0 -1640
- package/typedoc/classes/CollaborationActions.InsertContent.html +0 -421
- package/typedoc/classes/ErrorBoundary.html +0 -125
- package/typedoc/classes/IntentAction.ShowUndo.html +0 -227
- package/typedoc/classes/IntentAction.Track.html +0 -266
- package/typedoc/classes/LayoutAction.AddToast.html +0 -265
- package/typedoc/classes/LayoutAction.Close.html +0 -382
- package/typedoc/classes/LayoutAction.Expose.html +0 -265
- package/typedoc/classes/LayoutAction.Open.html +0 -1123
- package/typedoc/classes/LayoutAction.RevertWorkspace.html +0 -343
- package/typedoc/classes/LayoutAction.ScrollIntoView.html +0 -460
- package/typedoc/classes/LayoutAction.Set.html +0 -460
- package/typedoc/classes/LayoutAction.SetLayoutMode.html +0 -499
- package/typedoc/classes/LayoutAction.SwitchWorkspace.html +0 -265
- package/typedoc/classes/LayoutAction.UpdateComplementary.html +0 -616
- package/typedoc/classes/LayoutAction.UpdateDialog.html +0 -1123
- package/typedoc/classes/LayoutAction.UpdateLayout.html +0 -461
- package/typedoc/classes/LayoutAction.UpdatePopover.html +0 -1435
- package/typedoc/classes/LayoutAction.UpdateSidebar.html +0 -616
- package/typedoc/classes/Plugin.html +0 -6
- package/typedoc/classes/PluginContext.html +0 -38
- package/typedoc/classes/PluginManager.html +0 -43
- package/typedoc/classes/PluginModule.html +0 -18
- package/typedoc/classes/SettingsAction.Open.html +0 -226
- package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +0 -265
- package/typedoc/functions/Events.createStateEvent.html +0 -2
- package/typedoc/functions/IntentPlugin.html +0 -1
- package/typedoc/functions/SettingsPlugin.html +0 -1
- package/typedoc/functions/allOf.html +0 -2
- package/typedoc/functions/chain.html +0 -3
- package/typedoc/functions/contributes.html +0 -2
- package/typedoc/functions/createDispatcher.html +0 -3
- package/typedoc/functions/createIntent.html +0 -6
- package/typedoc/functions/createResolver.html +0 -2
- package/typedoc/functions/createSurface.html +0 -2
- package/typedoc/functions/defineCapability.html +0 -2
- package/typedoc/functions/defineEvent.html +0 -2
- package/typedoc/functions/defineModule.html +0 -2
- package/typedoc/functions/definePlugin.html +0 -2
- package/typedoc/functions/eventKey.html +0 -2
- package/typedoc/functions/getEvents.html +0 -2
- package/typedoc/functions/isAllOf.html +0 -2
- package/typedoc/functions/isOneOf.html +0 -2
- package/typedoc/functions/isSurfaceAvailable.html +0 -2
- package/typedoc/functions/lazy.html +0 -2
- package/typedoc/functions/oneOf.html +0 -2
- package/typedoc/functions/useApp.html +0 -6
- package/typedoc/functions/useAppGraph.html +0 -1
- package/typedoc/functions/useCapabilities.html +0 -3
- package/typedoc/functions/useCapability.html +0 -4
- package/typedoc/functions/useIntentDispatcher.html +0 -1
- package/typedoc/functions/useIntentResolver.html +0 -1
- package/typedoc/functions/useLayout.html +0 -1
- package/typedoc/functions/usePluginManager.html +0 -2
- package/typedoc/hierarchy.html +0 -1
- package/typedoc/index.html +0 -12
- package/typedoc/interfaces/LayoutAction.Toast.html +0 -10
- package/typedoc/media/LICENSE +0 -8
- package/typedoc/modules/Capabilities.html +0 -1
- package/typedoc/modules/CollaborationActions.html +0 -1
- package/typedoc/modules/Events.html +0 -1
- package/typedoc/modules/IntentAction.html +0 -1
- package/typedoc/modules/LayoutAction.html +0 -2
- package/typedoc/modules/SettingsAction.html +0 -1
- package/typedoc/modules.html +0 -1
- package/typedoc/types/ActivationEvent.html +0 -8
- package/typedoc/types/ActivationEvents.html +0 -2
- package/typedoc/types/AnyCapability.html +0 -1
- package/typedoc/types/AnyIntent.html +0 -1
- package/typedoc/types/AnyIntentChain.html +0 -1
- package/typedoc/types/AnyIntentEffectResult.html +0 -1
- package/typedoc/types/AnyIntentResolver.html +0 -1
- package/typedoc/types/AnyIntentResult.html +0 -1
- package/typedoc/types/Capabilities.FileUploader.html +0 -1
- package/typedoc/types/Capabilities.IntentResolver.html +0 -1
- package/typedoc/types/Capabilities.Layout.html +0 -1
- package/typedoc/types/Capabilities.Metadata.html +0 -1
- package/typedoc/types/Capabilities.ReactContext.html +0 -1
- package/typedoc/types/Capabilities.ReactRoot.html +0 -1
- package/typedoc/types/Capabilities.ReactSurface.html +0 -1
- package/typedoc/types/Capabilities.Settings.html +0 -4
- package/typedoc/types/Capability.html +0 -9
- package/typedoc/types/CreateAppOptions.html +0 -10
- package/typedoc/types/FileInfo.html +0 -1
- package/typedoc/types/Intent.html +0 -10
- package/typedoc/types/IntentChain.html +0 -6
- package/typedoc/types/IntentContext.html +0 -5
- package/typedoc/types/IntentData.html +0 -1
- package/typedoc/types/IntentDispatcher.html +0 -2
- package/typedoc/types/IntentDispatcherResult.html +0 -2
- package/typedoc/types/IntentEffectDefinition.html +0 -2
- package/typedoc/types/IntentEffectResult.html +0 -15
- package/typedoc/types/IntentParams.html +0 -3
- package/typedoc/types/IntentResolver.html +0 -2
- package/typedoc/types/IntentResultData.html +0 -1
- package/typedoc/types/IntentSchema.html +0 -1
- package/typedoc/types/IntentUndo.html +0 -2
- package/typedoc/types/InterfaceDef.html +0 -4
- package/typedoc/types/Label.html +0 -1
- package/typedoc/types/NodeSerializer.html +0 -8
- package/typedoc/types/PluginManagerOptions.html +0 -6
- package/typedoc/types/PluginMeta.html +0 -21
- package/typedoc/types/PromiseIntentDispatcher.html +0 -2
- package/typedoc/types/PromiseIntentUndo.html +0 -2
- package/typedoc/types/Resource.html +0 -1
- package/typedoc/types/ResourceKey.html +0 -1
- package/typedoc/types/ResourceLanguage.html +0 -1
- package/typedoc/types/SerializedNode.html +0 -4
- package/typedoc/types/SurfaceComponent.html +0 -2
- package/typedoc/types/SurfaceDefinition.html +0 -2
- package/typedoc/types/SurfaceProps.html +0 -4
- package/typedoc/variables/Capabilities.AnchorSort.html +0 -1
- package/typedoc/variables/Capabilities.AppGraph.html +0 -1
- package/typedoc/variables/Capabilities.AppGraphBuilder.html +0 -1
- package/typedoc/variables/Capabilities.AppGraphSerializer.html +0 -1
- package/typedoc/variables/Capabilities.ArtifactDefinition.html +0 -1
- package/typedoc/variables/Capabilities.FileUploader.html +0 -1
- package/typedoc/variables/Capabilities.IntentDispatcher.html +0 -1
- package/typedoc/variables/Capabilities.IntentResolver.html +0 -1
- package/typedoc/variables/Capabilities.Layout.html +0 -1
- package/typedoc/variables/Capabilities.Metadata.html +0 -1
- package/typedoc/variables/Capabilities.Null.html +0 -1
- package/typedoc/variables/Capabilities.PluginManager.html +0 -1
- package/typedoc/variables/Capabilities.ReactContext.html +0 -1
- package/typedoc/variables/Capabilities.ReactRoot.html +0 -1
- package/typedoc/variables/Capabilities.ReactSurface.html +0 -1
- package/typedoc/variables/Capabilities.RxRegistry.html +0 -1
- package/typedoc/variables/Capabilities.Settings.html +0 -1
- package/typedoc/variables/Capabilities.SettingsStore.html +0 -1
- package/typedoc/variables/Capabilities.Tools.html +0 -1
- package/typedoc/variables/Capabilities.Translations.html +0 -1
- package/typedoc/variables/Events.AppGraphReady.html +0 -2
- package/typedoc/variables/Events.DispatcherReady.html +0 -2
- package/typedoc/variables/Events.LayoutReady.html +0 -1
- package/typedoc/variables/Events.SettingsReady.html +0 -2
- package/typedoc/variables/Events.SetupAppGraph.html +0 -2
- package/typedoc/variables/Events.SetupArtifactDefinition.html +0 -2
- package/typedoc/variables/Events.SetupIntentResolver.html +0 -2
- package/typedoc/variables/Events.SetupMetadata.html +0 -2
- package/typedoc/variables/Events.SetupReactSurface.html +0 -2
- package/typedoc/variables/Events.SetupSettings.html +0 -2
- package/typedoc/variables/Events.SetupTranslations.html +0 -2
- package/typedoc/variables/Events.Startup.html +0 -2
- package/typedoc/variables/FileInfoSchema.html +0 -1
- package/typedoc/variables/INTENT_ACTION.html +0 -1
- package/typedoc/variables/INTENT_PLUGIN.html +0 -1
- package/typedoc/variables/LAYOUT_ACTION.html +0 -1
- package/typedoc/variables/LAYOUT_PLUGIN.html +0 -1
- package/typedoc/variables/Label.html +0 -1
- package/typedoc/variables/LayoutAction.Toast.html +0 -1
- package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +0 -1
- package/typedoc/variables/PluginManagerProvider.html +0 -2
- package/typedoc/variables/Resource.html +0 -2
- package/typedoc/variables/ResourceKey.html +0 -1
- package/typedoc/variables/ResourceLanguage.html +0 -1
- package/typedoc/variables/SETTINGS_ACTION.html +0 -1
- package/typedoc/variables/SETTINGS_ID.html +0 -1
- package/typedoc/variables/SETTINGS_KEY.html +0 -1
- package/typedoc/variables/SETTINGS_PLUGIN.html +0 -1
- package/typedoc/variables/Surface.html +0 -2
- package/typedoc/variables/defaultFileTypes.html +0 -1
- /package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs.map → intent-dispatcher-BND6IF4U.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs.map → intent-dispatcher-254AZ6EE.mjs.map} +0 -0
package/moon.yml
CHANGED
|
@@ -5,6 +5,7 @@ tags:
|
|
|
5
5
|
- ts-build
|
|
6
6
|
- ts-test
|
|
7
7
|
- typedoc
|
|
8
|
+
- storybook
|
|
8
9
|
tasks:
|
|
9
10
|
compile:
|
|
10
11
|
args:
|
|
@@ -12,3 +13,6 @@ tasks:
|
|
|
12
13
|
- '--entryPoint=src/testing/index.ts'
|
|
13
14
|
- '--entryPoint=src/worker.ts'
|
|
14
15
|
- '--preactSignalTracking'
|
|
16
|
+
test:
|
|
17
|
+
inputs:
|
|
18
|
+
- .storybook/*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/app-framework",
|
|
3
|
-
"version": "0.8.4-main.
|
|
3
|
+
"version": "0.8.4-main.ae835ea",
|
|
4
4
|
"description": "A framework for building applications from composible plugins.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -10,16 +10,19 @@
|
|
|
10
10
|
"type": "module",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
|
+
"source": "./src/index.ts",
|
|
13
14
|
"types": "./dist/types/src/index.d.ts",
|
|
14
15
|
"browser": "./dist/lib/browser/index.mjs",
|
|
15
16
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
16
17
|
},
|
|
17
18
|
"./testing": {
|
|
19
|
+
"source": "./src/testing/index.ts",
|
|
18
20
|
"types": "./dist/types/src/testing/index.d.ts",
|
|
19
21
|
"browser": "./dist/lib/browser/testing/index.mjs",
|
|
20
22
|
"node": "./dist/lib/node-esm/testing/index.mjs"
|
|
21
23
|
},
|
|
22
24
|
"./worker": {
|
|
25
|
+
"source": "./src/worker.ts",
|
|
23
26
|
"types": "./dist/types/src/worker.d.ts",
|
|
24
27
|
"browser": "./dist/lib/browser/worker.mjs",
|
|
25
28
|
"node": "./dist/lib/node-esm/worker.mjs"
|
|
@@ -37,43 +40,45 @@
|
|
|
37
40
|
}
|
|
38
41
|
},
|
|
39
42
|
"dependencies": {
|
|
43
|
+
"@effect/ai": "0.29.1",
|
|
44
|
+
"@effect/experimental": "0.56.0",
|
|
40
45
|
"@preact-signals/safe-react": "^0.9.0",
|
|
41
|
-
"@preact/signals-core": "^1.
|
|
42
|
-
"@dxos/ai": "0.8.4-main.
|
|
43
|
-
"@dxos/app-graph": "0.8.4-main.
|
|
44
|
-
"@dxos/async": "0.8.4-main.
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/log": "0.8.4-main.
|
|
56
|
-
"@dxos/
|
|
46
|
+
"@preact/signals-core": "^1.12.1",
|
|
47
|
+
"@dxos/ai": "0.8.4-main.ae835ea",
|
|
48
|
+
"@dxos/app-graph": "0.8.4-main.ae835ea",
|
|
49
|
+
"@dxos/async": "0.8.4-main.ae835ea",
|
|
50
|
+
"@dxos/blueprints": "0.8.4-main.ae835ea",
|
|
51
|
+
"@dxos/debug": "0.8.4-main.ae835ea",
|
|
52
|
+
"@dxos/echo": "0.8.4-main.ae835ea",
|
|
53
|
+
"@dxos/client-protocol": "0.8.4-main.ae835ea",
|
|
54
|
+
"@dxos/functions": "0.8.4-main.ae835ea",
|
|
55
|
+
"@dxos/invariant": "0.8.4-main.ae835ea",
|
|
56
|
+
"@dxos/keys": "0.8.4-main.ae835ea",
|
|
57
|
+
"@dxos/live-object": "0.8.4-main.ae835ea",
|
|
58
|
+
"@dxos/local-storage": "0.8.4-main.ae835ea",
|
|
59
|
+
"@dxos/react-hooks": "0.8.4-main.ae835ea",
|
|
60
|
+
"@dxos/log": "0.8.4-main.ae835ea",
|
|
61
|
+
"@dxos/schema": "0.8.4-main.ae835ea",
|
|
62
|
+
"@dxos/util": "0.8.4-main.ae835ea"
|
|
57
63
|
},
|
|
58
64
|
"devDependencies": {
|
|
59
|
-
"@effect-rx/rx-react": "0.
|
|
60
|
-
"@effect/platform": "0.
|
|
61
|
-
"@
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"react": "~18.2.0",
|
|
65
|
+
"@effect-rx/rx-react": "0.42.4",
|
|
66
|
+
"@effect/platform": "0.92.1",
|
|
67
|
+
"@types/react": "~19.2.2",
|
|
68
|
+
"effect": "3.18.3",
|
|
69
|
+
"react": "~19.2.0",
|
|
65
70
|
"typedoc": "0.28.1",
|
|
66
|
-
"@dxos/echo-signals": "0.8.4-main.
|
|
67
|
-
"@dxos/random": "0.8.4-main.
|
|
68
|
-
"@dxos/react-ui": "0.8.4-main.
|
|
69
|
-
"@dxos/
|
|
70
|
-
"@dxos/
|
|
71
|
+
"@dxos/echo-signals": "0.8.4-main.ae835ea",
|
|
72
|
+
"@dxos/random": "0.8.4-main.ae835ea",
|
|
73
|
+
"@dxos/react-ui": "0.8.4-main.ae835ea",
|
|
74
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.4-main.ae835ea",
|
|
75
|
+
"@dxos/storybook-utils": "0.8.4-main.ae835ea"
|
|
71
76
|
},
|
|
72
77
|
"peerDependencies": {
|
|
73
78
|
"@effect-rx/rx-react": "^0.34.1",
|
|
74
79
|
"@effect/platform": "^0.80.12",
|
|
75
80
|
"effect": "^3.13.3",
|
|
76
|
-
"react": "
|
|
81
|
+
"react": "^19.0.0"
|
|
77
82
|
},
|
|
78
83
|
"publishConfig": {
|
|
79
84
|
"access": "public"
|
|
@@ -2,43 +2,78 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import type * as Tool from '@effect/ai/Tool';
|
|
6
|
+
import type * as Toolkit from '@effect/ai/Toolkit';
|
|
5
7
|
import { type Registry } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
8
|
+
import type * as Layer from 'effect/Layer';
|
|
9
|
+
import type * as Schema from 'effect/Schema';
|
|
7
10
|
import { type FC, type PropsWithChildren } from 'react';
|
|
8
11
|
|
|
9
|
-
import { type
|
|
10
|
-
import
|
|
11
|
-
import { type
|
|
12
|
+
import { type AiService } from '@dxos/ai';
|
|
13
|
+
import type * as AiServiceRouter from '@dxos/ai/AiServiceRouter';
|
|
14
|
+
import { type BuilderExtensions, type GraphBuilder } from '@dxos/app-graph';
|
|
15
|
+
import { type Blueprint } from '@dxos/blueprints';
|
|
12
16
|
import { type Space } from '@dxos/client-protocol';
|
|
17
|
+
import { type FunctionDefinition } from '@dxos/functions';
|
|
13
18
|
import { type RootSettingsStore } from '@dxos/local-storage';
|
|
14
19
|
import { type AnchoredTo } from '@dxos/schema';
|
|
15
20
|
|
|
21
|
+
import { type PluginManager, defineCapability } from '../core';
|
|
22
|
+
import { type AnyIntentResolver, type IntentContext } from '../plugin-intent';
|
|
23
|
+
|
|
16
24
|
import { type FileInfo } from './file';
|
|
17
25
|
import { type NodeSerializer } from './graph';
|
|
18
26
|
import { type SurfaceDefinition } from './surface';
|
|
19
27
|
import { type Resource } from './translations';
|
|
20
|
-
import { type PluginManager, defineCapability } from '../core';
|
|
21
|
-
import { type AnyIntentResolver, type IntentContext } from '../plugin-intent';
|
|
22
28
|
|
|
29
|
+
// TODO(burdon): Sort.
|
|
23
30
|
export namespace Capabilities {
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
/**
|
|
32
|
+
* @category Capability
|
|
33
|
+
*/
|
|
26
34
|
export const Null = defineCapability<null>('dxos.org/app-framework/capability/null');
|
|
27
35
|
|
|
36
|
+
/**
|
|
37
|
+
* @category Capability
|
|
38
|
+
*/
|
|
39
|
+
export const PluginManager = defineCapability<PluginManager>('dxos.org/app-framework/capability/plugin-manager');
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @category Capability
|
|
43
|
+
*/
|
|
28
44
|
export const RxRegistry = defineCapability<Registry.Registry>('dxos.org/app-framework/capability/rx-registry');
|
|
29
45
|
|
|
30
46
|
export type ReactContext = Readonly<{ id: string; dependsOn?: string[]; context: FC<PropsWithChildren> }>;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @category Capability
|
|
50
|
+
*/
|
|
31
51
|
export const ReactContext = defineCapability<ReactContext>('dxos.org/app-framework/capability/react-context');
|
|
32
52
|
|
|
33
53
|
export type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* @category Capability
|
|
57
|
+
*/
|
|
34
58
|
export const ReactRoot = defineCapability<ReactRoot>('dxos.org/app-framework/capability/react-root');
|
|
35
59
|
|
|
36
60
|
export type ReactSurface = SurfaceDefinition | readonly SurfaceDefinition[];
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @category Capability
|
|
64
|
+
*/
|
|
37
65
|
export const ReactSurface = defineCapability<ReactSurface>('dxos.org/app-framework/common/react-surface');
|
|
38
66
|
|
|
39
67
|
export type IntentResolver = AnyIntentResolver | readonly AnyIntentResolver[];
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @category Capability
|
|
71
|
+
*/
|
|
40
72
|
export const IntentResolver = defineCapability<IntentResolver>('dxos.org/app-framework/capability/intent-resolver');
|
|
41
73
|
|
|
74
|
+
/**
|
|
75
|
+
* @category Capability
|
|
76
|
+
*/
|
|
42
77
|
export const IntentDispatcher = defineCapability<IntentContext>(
|
|
43
78
|
'dxos.org/app-framework/capability/intent-dispatcher',
|
|
44
79
|
);
|
|
@@ -65,23 +100,41 @@ export namespace Capabilities {
|
|
|
65
100
|
*/
|
|
66
101
|
scrollIntoView: string | undefined;
|
|
67
102
|
}>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @category Capability
|
|
106
|
+
*/
|
|
68
107
|
export const Layout = defineCapability<Layout>('dxos.org/app-framework/capability/layout');
|
|
69
108
|
|
|
70
|
-
|
|
109
|
+
/**
|
|
110
|
+
* @category Capability
|
|
111
|
+
*/
|
|
71
112
|
export const Translations = defineCapability<Readonly<Resource[]>>('dxos.org/app-framework/capability/translations');
|
|
72
113
|
|
|
114
|
+
/**
|
|
115
|
+
* @category Capability
|
|
116
|
+
*/
|
|
73
117
|
export const AppGraph = defineCapability<Readonly<Pick<GraphBuilder, 'graph' | 'explore'>>>(
|
|
74
118
|
'dxos.org/app-framework/capability/app-graph',
|
|
75
119
|
);
|
|
76
120
|
|
|
121
|
+
/**
|
|
122
|
+
* @category Capability
|
|
123
|
+
*/
|
|
77
124
|
export const AppGraphBuilder = defineCapability<BuilderExtensions>(
|
|
78
125
|
'dxos.org/app-framework/capability/app-graph-builder',
|
|
79
126
|
);
|
|
80
127
|
|
|
128
|
+
/**
|
|
129
|
+
* @category Capability
|
|
130
|
+
*/
|
|
81
131
|
export const AppGraphSerializer = defineCapability<NodeSerializer[]>(
|
|
82
132
|
'dxos.org/app-framework/capability/app-graph-serializer',
|
|
83
133
|
);
|
|
84
134
|
|
|
135
|
+
/**
|
|
136
|
+
* @category Capability
|
|
137
|
+
*/
|
|
85
138
|
export const SettingsStore = defineCapability<RootSettingsStore>('dxos.org/app-framework/capability/settings-store');
|
|
86
139
|
|
|
87
140
|
// TODO(wittjosiah): The generics caused type inference issues for schemas when contributing settings.
|
|
@@ -92,22 +145,73 @@ export namespace Capabilities {
|
|
|
92
145
|
schema: Schema.Schema.All;
|
|
93
146
|
value?: Record<string, any>;
|
|
94
147
|
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @category Capability
|
|
151
|
+
*/
|
|
95
152
|
export const Settings = defineCapability<Settings>('dxos.org/app-framework/capability/settings');
|
|
96
153
|
|
|
97
154
|
export type Metadata = Readonly<{ id: string; metadata: Record<string, any> }>;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @category Capability
|
|
158
|
+
*/
|
|
98
159
|
export const Metadata = defineCapability<Metadata>('dxos.org/app-framework/capability/metadata');
|
|
99
160
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
161
|
+
// TODO(dmaretskyi): Consider combining Toolkit and ToolkitHandler for type-safe context.
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @category Capability
|
|
165
|
+
*/
|
|
166
|
+
export const Toolkit = defineCapability<Toolkit.Any>('dxos.org/app-framework/capability/ai-toolkit');
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* @category Capability
|
|
170
|
+
*/
|
|
171
|
+
export const ToolkitHandler = defineCapability<Layer.Layer<Tool.Handler<any>, never, never>>(
|
|
172
|
+
'dxos.org/app-framework/capability/ai-toolkit-handler',
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* @category Capability
|
|
177
|
+
*/
|
|
178
|
+
export const BlueprintDefinition = defineCapability<Blueprint.Blueprint>(
|
|
179
|
+
'dxos.org/app-framework/capability/blueprint-definition',
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
export type AiServiceLayer = Layer.Layer<AiService.AiService>;
|
|
183
|
+
export const AiServiceLayer = defineCapability<AiServiceLayer>(
|
|
184
|
+
'dxos.org/app-framework/capability/ai-service-factory',
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Plugins can contribute them to provide model resolvers.
|
|
189
|
+
*/
|
|
190
|
+
export const AiModelResolver = defineCapability<Layer.Layer<AiServiceRouter.AiModelResolver>>(
|
|
191
|
+
'dxos.org/app-framework/capability/ai-model-resolver',
|
|
103
192
|
);
|
|
104
193
|
|
|
105
|
-
|
|
194
|
+
/**
|
|
195
|
+
* @category Capability
|
|
196
|
+
*/
|
|
197
|
+
export const Functions = defineCapability<FunctionDefinition<any, any>[]>(
|
|
198
|
+
'dxos.org/app-framework/capability/functions',
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
export type FileUploader = (space: Space, file: File) => Promise<FileInfo | undefined>;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @category Capability
|
|
205
|
+
*/
|
|
106
206
|
export const FileUploader = defineCapability<FileUploader>('dxos.org/app-framework/capability/file-uploader');
|
|
107
207
|
|
|
108
208
|
type AnchorSort = {
|
|
109
209
|
key: string;
|
|
110
210
|
sort: (anchorA: AnchoredTo, anchorB: AnchoredTo) => number;
|
|
111
211
|
};
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @category Capability
|
|
215
|
+
*/
|
|
112
216
|
export const AnchorSort = defineCapability<AnchorSort>('dxos.org/app-framework/capability/anchor-sort');
|
|
113
217
|
}
|
|
@@ -2,19 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { DataType } from '@dxos/schema';
|
|
8
8
|
|
|
9
9
|
export namespace CollaborationActions {
|
|
10
|
-
export class
|
|
10
|
+
export class AcceptProposal extends Schema.TaggedClass<AcceptProposal>()('collaboration/accept-proposal', {
|
|
11
11
|
input: Schema.Struct({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
label: Schema.String.pipe(Schema.optional),
|
|
16
|
-
}).annotations({
|
|
17
|
-
description: 'Enables plugins to inject content blocks or references into a related entity.',
|
|
12
|
+
subject: Schema.Any,
|
|
13
|
+
anchor: Schema.String,
|
|
14
|
+
proposal: DataType.MessageBlock.Proposal,
|
|
18
15
|
}),
|
|
19
16
|
output: Schema.Void,
|
|
20
17
|
}) {}
|
package/src/common/events.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Capabilities } from './capabilities';
|
|
6
5
|
import { defineEvent } from '../core';
|
|
7
6
|
|
|
7
|
+
import { Capabilities } from './capabilities';
|
|
8
|
+
|
|
8
9
|
export namespace Events {
|
|
9
10
|
/**
|
|
10
11
|
* Fired when the app is started.
|
|
@@ -48,6 +49,7 @@ export namespace Events {
|
|
|
48
49
|
/**
|
|
49
50
|
* Fired to load any newly available artifacts definitions.
|
|
50
51
|
*/
|
|
52
|
+
// TODO(burdon): Rename.
|
|
51
53
|
export const SetupArtifactDefinition = defineEvent('dxos.org/app-framework/event/setup-artifact-definition');
|
|
52
54
|
|
|
53
55
|
//
|
package/src/common/file.ts
CHANGED
package/src/common/layout.ts
CHANGED
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { Label } from '../plugin-intent';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
export const LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
9
|
+
const LAYOUT_PLUGIN = 'dxos.org/plugin/layout';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* Expected payload for layout actions.
|
|
14
13
|
*/
|
|
15
14
|
export namespace LayoutAction {
|
|
16
|
-
export const UPDATE_LAYOUT = `${
|
|
15
|
+
export const UPDATE_LAYOUT = `${LAYOUT_PLUGIN}/action/update-layout`;
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* Generic layout action.
|
package/src/common/surface.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import type { ComponentType, PropsWithChildren, ReactNode } from 'react';
|
|
6
6
|
|
|
7
7
|
import { type GuardedType, type MakeOptional, type Position } from '@dxos/util';
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ import { type ErrorBoundary } from '../react';
|
|
|
11
11
|
/**
|
|
12
12
|
* SurfaceProps are the props that are passed to the Surface component.
|
|
13
13
|
*/
|
|
14
|
-
export type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> =
|
|
14
|
+
export type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {
|
|
15
15
|
/**
|
|
16
16
|
* If specified, the Surface will be wrapped in an error boundary.
|
|
17
17
|
* The fallback component will be rendered if an error occurs.
|
|
@@ -23,17 +23,16 @@ export type SurfaceProps<T extends Record<string, any> = Record<string, unknown>
|
|
|
23
23
|
* The placeholder component will be rendered while the surface component is loading.
|
|
24
24
|
*/
|
|
25
25
|
placeholder?: ReactNode;
|
|
26
|
-
}> &
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
[key: string]: unknown;
|
|
26
|
+
} & MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> &
|
|
27
|
+
// Additional props to pass to the component.
|
|
28
|
+
// These props are not used by Surface itself but may be used by components which resolve the surface.
|
|
29
|
+
// Exclude known prop names to prevent overriding well-defined props.
|
|
30
|
+
{
|
|
31
|
+
[K in keyof Record<string, any>]: K extends keyof CoreSurfaceProps<T> | 'fallback' | 'placeholder' ? never : any;
|
|
33
32
|
};
|
|
34
33
|
|
|
35
34
|
// NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.
|
|
36
|
-
type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {
|
|
35
|
+
type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{
|
|
37
36
|
/**
|
|
38
37
|
* ID for debugging.
|
|
39
38
|
*/
|
|
@@ -53,19 +52,17 @@ type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> =
|
|
|
53
52
|
* If more than one component is resolved, the limit determines how many are rendered.
|
|
54
53
|
*/
|
|
55
54
|
limit?: number | undefined;
|
|
56
|
-
}
|
|
55
|
+
}>;
|
|
57
56
|
|
|
58
|
-
type SurfaceComponentProps<T extends Record<string, any> = Record<string, unknown>> =
|
|
59
|
-
|
|
60
|
-
>;
|
|
57
|
+
type SurfaceComponentProps<T extends Record<string, any> = Record<string, unknown>> = CoreSurfaceProps<T> &
|
|
58
|
+
Record<string, any>;
|
|
61
59
|
|
|
62
60
|
/**
|
|
63
61
|
* React component used to render a surface once is has matched.
|
|
64
62
|
*/
|
|
65
|
-
export type SurfaceComponent<T extends Record<string, any> = Record<string, unknown>> =
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
) => JSX.Element | null;
|
|
63
|
+
export type SurfaceComponent<T extends Record<string, any> = Record<string, unknown>> = ComponentType<
|
|
64
|
+
SurfaceComponentProps<T>
|
|
65
|
+
>;
|
|
69
66
|
|
|
70
67
|
/**
|
|
71
68
|
* Definition of when a SurfaceComponent should be rendered.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
export const ResourceKey = Schema.Union(Schema.String, Schema.Record({ key: Schema.String, value: Schema.Any }));
|
|
8
8
|
export type ResourceKey = Schema.Schema.Type<typeof ResourceKey>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2022 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
9
|
+
|
|
10
|
+
import { useApp } from './useApp';
|
|
11
|
+
|
|
12
|
+
const DefaultStory = () => {
|
|
13
|
+
const App = useApp({
|
|
14
|
+
placeholder: () => <div className='fixed inset-0 flex items-center justify-center'>Loading...</div>,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
return <App />;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
const meta = {
|
|
21
|
+
title: 'sdk/app-framework/App',
|
|
22
|
+
render: DefaultStory,
|
|
23
|
+
decorators: [withTheme],
|
|
24
|
+
parameters: {
|
|
25
|
+
layout: 'fullscreen',
|
|
26
|
+
},
|
|
27
|
+
} satisfies Meta;
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
|
|
31
|
+
type Story = StoryObj<typeof meta>;
|
|
32
|
+
|
|
33
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { type PropsWithChildren } from 'react';
|
|
6
|
+
|
|
7
|
+
import { Capabilities } from '../common';
|
|
8
|
+
import { topologicalSort } from '../helpers';
|
|
9
|
+
import { useCapabilities } from '../react';
|
|
10
|
+
|
|
11
|
+
import { type UseAppOptions } from './useApp';
|
|
12
|
+
import { LoadingState, useLoading } from './useLoading';
|
|
13
|
+
|
|
14
|
+
export type AppProps = Pick<UseAppOptions, 'placeholder' | 'debounce'> & {
|
|
15
|
+
state: { ready: boolean; error: unknown };
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const App = ({ placeholder: Placeholder, state, debounce }: AppProps) => {
|
|
19
|
+
const reactContexts = useCapabilities(Capabilities.ReactContext);
|
|
20
|
+
const reactRoots = useCapabilities(Capabilities.ReactRoot);
|
|
21
|
+
const stage = useLoading(state, debounce);
|
|
22
|
+
|
|
23
|
+
if (state.error) {
|
|
24
|
+
// This triggers the error boundary to provide UI feedback for the startup error.
|
|
25
|
+
throw state.error;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// TODO(wittjosiah): Consider using Suspense instead.
|
|
29
|
+
if (stage < LoadingState.Done) {
|
|
30
|
+
if (!Placeholder) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return <Placeholder stage={stage} />;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const ComposedContext = composeContexts(reactContexts);
|
|
38
|
+
return (
|
|
39
|
+
<ComposedContext>
|
|
40
|
+
{reactRoots.map(({ id, root: Component }) => (
|
|
41
|
+
<Component key={id} />
|
|
42
|
+
))}
|
|
43
|
+
</ComposedContext>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const composeContexts = (contexts: Capabilities.ReactContext[]) => {
|
|
48
|
+
if (contexts.length === 0) {
|
|
49
|
+
return ({ children }: PropsWithChildren) => <>{children}</>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return topologicalSort(contexts)
|
|
53
|
+
.map(({ context }) => context)
|
|
54
|
+
.reduce((Acc, Next) => ({ children }) => (
|
|
55
|
+
<Acc>
|
|
56
|
+
<Next>{children}</Next>
|
|
57
|
+
</Acc>
|
|
58
|
+
));
|
|
59
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* NOTE: Default fallback should not use tailwind or theme.
|
|
9
|
+
*/
|
|
10
|
+
export const DefaultFallback = ({ error }: { error: Error }) => {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
style={{
|
|
14
|
+
margin: '1rem',
|
|
15
|
+
padding: '1rem',
|
|
16
|
+
overflow: 'hidden',
|
|
17
|
+
border: '4px solid teal',
|
|
18
|
+
borderRadius: '1rem',
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
{/* TODO(wittjosiah): Link to docs for replacing default. */}
|
|
22
|
+
<h1 style={{ margin: '0.5rem 0', fontSize: '1.2rem' }}>[ERROR]: {error.message}</h1>
|
|
23
|
+
<pre style={{ overflow: 'auto', fontSize: '1rem', whiteSpace: 'pre-wrap', color: '#888888' }}>{error.stack}</pre>
|
|
24
|
+
</div>
|
|
25
|
+
);
|
|
26
|
+
};
|