@dxos/app-framework 0.8.3-staging.0fa589b → 0.8.4-main.1da679c
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/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/.swc/plugins/linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
- package/README.md +0 -8
- package/dist/lib/browser/{app-graph-builder-BI4VVKSW.mjs → app-graph-builder-NJPA2G5W.mjs} +7 -7
- package/dist/lib/browser/app-graph-builder-NJPA2G5W.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DIBVO47Z.mjs → chunk-5PEC66SO.mjs} +194 -129
- package/dist/lib/browser/chunk-5PEC66SO.mjs.map +7 -0
- package/dist/lib/browser/{chunk-WWEJRWFX.mjs → chunk-ORWHM7CO.mjs} +2 -2
- package/dist/lib/browser/{chunk-EHM4UI3V.mjs → chunk-RAYLWQ5Q.mjs} +400 -273
- package/dist/lib/browser/chunk-RAYLWQ5Q.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +16 -10
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-XVBOMF2Y.mjs → intent-dispatcher-MDRGYJIB.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-3QMBXLIY.mjs → intent-resolver-M6FKP6GN.mjs} +6 -6
- package/dist/lib/browser/intent-resolver-M6FKP6GN.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-5H7XPJGA.mjs → store-3APFOQKK.mjs} +5 -5
- package/dist/lib/browser/{store-5H7XPJGA.mjs.map → store-3APFOQKK.mjs.map} +2 -2
- package/dist/lib/browser/testing/index.mjs +6 -8
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/worker.mjs +7 -1
- package/dist/lib/node-esm/{app-graph-builder-NROP6RPQ.mjs → app-graph-builder-QSVQIJL5.mjs} +7 -7
- package/dist/lib/node-esm/app-graph-builder-QSVQIJL5.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-2J6FVECI.mjs → chunk-NL3BJGAH.mjs} +400 -273
- package/dist/lib/node-esm/chunk-NL3BJGAH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FHNZZWP4.mjs → chunk-TIGGOZBR.mjs} +194 -129
- package/dist/lib/node-esm/chunk-TIGGOZBR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-I6BVZMAH.mjs → chunk-UMZQERLE.mjs} +2 -2
- package/dist/lib/node-esm/index.mjs +16 -10
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-7JPGLCQ5.mjs → intent-dispatcher-YFOVJIJP.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-VY4X5UHN.mjs → intent-resolver-KERU62QF.mjs} +6 -6
- package/dist/lib/node-esm/intent-resolver-KERU62QF.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-UKD2R2KA.mjs → store-EZER6ON2.mjs} +5 -5
- package/dist/lib/node-esm/{store-UKD2R2KA.mjs.map → store-EZER6ON2.mjs.map} +2 -2
- package/dist/lib/node-esm/testing/index.mjs +6 -8
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/worker.mjs +7 -1
- package/dist/types/src/common/capabilities.d.ts +85 -9
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/collaboration.d.ts +9 -8
- 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/surface.d.ts +1 -1
- package/dist/types/src/common/surface.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 +15 -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 +4 -1
- 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/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/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.map +1 -1
- package/dist/types/src/playground/layout/Layout.d.ts +2 -2
- 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.map +1 -1
- package/dist/types/src/playground/playground.stories.d.ts +5 -3
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
- package/dist/types/src/plugin-intent/IntentPlugin.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 +3 -3
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.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/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 +7 -8
- 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.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +6 -4
- 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 +4 -2
- 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 +14 -0
- package/package.json +32 -28
- package/src/common/capabilities.ts +111 -11
- package/src/common/collaboration.ts +5 -8
- package/src/common/events.ts +3 -1
- package/src/common/surface.ts +1 -1
- package/src/components/App.stories.tsx +35 -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} +20 -130
- package/src/components/useLoading.tsx +70 -0
- package/src/core/capabilities.test.ts +1 -1
- package/src/core/capabilities.ts +11 -6
- package/src/core/manager.test.ts +5 -5
- package/src/core/manager.ts +132 -54
- package/src/helpers.test.ts +1 -1
- package/src/index.ts +1 -1
- package/src/playground/debug/Debug.tsx +1 -1
- package/src/playground/generator/Toolbar.tsx +2 -1
- package/src/playground/generator/generator.ts +2 -2
- package/src/playground/layout/plugin.ts +1 -1
- package/src/playground/logger/Toolbar.tsx +2 -1
- package/src/playground/logger/plugin.ts +3 -2
- package/src/playground/playground.stories.tsx +15 -10
- package/src/plugin-intent/IntentPlugin.ts +2 -1
- package/src/plugin-intent/index.ts +1 -0
- package/src/plugin-intent/intent-dispatcher.test.ts +1 -1
- package/src/plugin-intent/intent-dispatcher.ts +10 -8
- package/src/plugin-settings/SettingsPlugin.ts +3 -2
- package/src/plugin-settings/app-graph-builder.ts +4 -3
- package/src/plugin-settings/intent-resolver.ts +3 -2
- package/src/plugin-settings/store.ts +1 -1
- package/src/plugin-settings/translations.ts +4 -2
- package/src/react/ErrorBoundary.tsx +24 -15
- package/src/react/IntentContext.tsx +3 -2
- package/src/react/Surface.stories.tsx +21 -13
- package/src/react/Surface.tsx +4 -3
- 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 +13 -13
- package/tsconfig.json +5 -9
- package/vitest.config.ts +5 -2
- package/.eslintrc.cjs +0 -9
- package/README.yml +0 -5
- package/dist/lib/browser/app-graph-builder-BI4VVKSW.mjs.map +0 -7
- package/dist/lib/browser/chunk-DIBVO47Z.mjs.map +0 -7
- package/dist/lib/browser/chunk-EHM4UI3V.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3QMBXLIY.mjs.map +0 -7
- package/dist/lib/node/app-graph-builder-H7QVE4MJ.cjs +0 -146
- package/dist/lib/node/app-graph-builder-H7QVE4MJ.cjs.map +0 -7
- package/dist/lib/node/chunk-G774ASXO.cjs +0 -58
- package/dist/lib/node/chunk-G774ASXO.cjs.map +0 -7
- package/dist/lib/node/chunk-VSOSVDQ3.cjs +0 -1551
- package/dist/lib/node/chunk-VSOSVDQ3.cjs.map +0 -7
- package/dist/lib/node/chunk-YGAY3H34.cjs +0 -429
- package/dist/lib/node/chunk-YGAY3H34.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -193
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-dispatcher-C3SVKJ62.cjs +0 -32
- package/dist/lib/node/intent-dispatcher-C3SVKJ62.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-IOJDYO34.cjs +0 -46
- package/dist/lib/node/intent-resolver-IOJDYO34.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/store-ESF5VR57.cjs +0 -45
- package/dist/lib/node/store-ESF5VR57.cjs.map +0 -7
- package/dist/lib/node/testing/index.cjs +0 -119
- package/dist/lib/node/testing/index.cjs.map +0 -7
- package/dist/lib/node/worker.cjs +0 -101
- package/dist/lib/node/worker.cjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-NROP6RPQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2J6FVECI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FHNZZWP4.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-VY4X5UHN.mjs.map +0 -7
- package/dist/types/src/App.d.ts.map +0 -1
- package/project.json +0 -29
- 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 -16
- 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/{chunk-WWEJRWFX.mjs.map → chunk-ORWHM7CO.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-dispatcher-XVBOMF2Y.mjs.map → intent-dispatcher-MDRGYJIB.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-I6BVZMAH.mjs.map → chunk-UMZQERLE.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-7JPGLCQ5.mjs.map → intent-dispatcher-YFOVJIJP.mjs.map} +0 -0
|
@@ -6,12 +6,13 @@ import React, { useCallback } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Button } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
|
-
import { createGeneratorIntent, createPluginId, Number } from './generator';
|
|
10
9
|
import { Capabilities } from '../../common';
|
|
11
10
|
import { contributes } from '../../core';
|
|
12
11
|
import { createIntent } from '../../plugin-intent';
|
|
13
12
|
import { useCapabilities, useIntentDispatcher, usePluginManager } from '../../react';
|
|
14
13
|
|
|
14
|
+
import { Number, createGeneratorIntent, createPluginId } from './generator';
|
|
15
|
+
|
|
15
16
|
export const Toolbar = () => {
|
|
16
17
|
const manager = usePluginManager();
|
|
17
18
|
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Events } from '../../common';
|
|
8
|
-
import { contributes,
|
|
9
|
-
import {
|
|
8
|
+
import { contributes, defineCapability, defineEvent, defineModule, definePlugin } from '../../core';
|
|
9
|
+
import { type IntentSchema, createResolver } from '../../plugin-intent';
|
|
10
10
|
|
|
11
11
|
export const Number = defineCapability<number>('dxos.org/test/generator/number');
|
|
12
12
|
|
|
@@ -6,12 +6,13 @@ import React, { useCallback } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Button } from '@dxos/react-ui';
|
|
8
8
|
|
|
9
|
-
import { Log } from './schema';
|
|
10
9
|
import { Capabilities, createSurface } from '../../common';
|
|
11
10
|
import { contributes } from '../../core';
|
|
12
11
|
import { createIntent } from '../../plugin-intent';
|
|
13
12
|
import { useIntentDispatcher } from '../../react';
|
|
14
13
|
|
|
14
|
+
import { Log } from './schema';
|
|
15
|
+
|
|
15
16
|
export const Logger = () => {
|
|
16
17
|
const { dispatchPromise } = useIntentDispatcher();
|
|
17
18
|
const handleClick = useCallback(() => dispatchPromise(createIntent(Log, { message: 'Hello, world!' })), []);
|
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
import { log } from '@dxos/log';
|
|
6
6
|
|
|
7
|
-
import { Log } from './schema';
|
|
8
7
|
import { Capabilities, Events } from '../../common';
|
|
9
|
-
import { contributes, defineModule,
|
|
8
|
+
import { contributes, defineModule, definePlugin, lazy } from '../../core';
|
|
10
9
|
import { createResolver } from '../../plugin-intent';
|
|
11
10
|
|
|
11
|
+
import { Log } from './schema';
|
|
12
|
+
|
|
12
13
|
const Toolbar = lazy(() => import('./Toolbar'));
|
|
13
14
|
|
|
14
15
|
export const LoggerPlugin = () =>
|
|
@@ -4,16 +4,18 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React from 'react';
|
|
8
9
|
|
|
9
10
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
10
11
|
|
|
12
|
+
import { useApp } from '../components';
|
|
13
|
+
import { IntentPlugin } from '../plugin-intent';
|
|
14
|
+
|
|
11
15
|
import { DebugPlugin } from './debug';
|
|
12
|
-
import {
|
|
16
|
+
import { GeneratorPlugin, createNumberPlugin } from './generator';
|
|
13
17
|
import { LayoutPlugin } from './layout';
|
|
14
18
|
import { LoggerPlugin } from './logger';
|
|
15
|
-
import { useApp } from '../App';
|
|
16
|
-
import { IntentPlugin } from '../plugin-intent';
|
|
17
19
|
|
|
18
20
|
const plugins = [IntentPlugin(), LayoutPlugin(), DebugPlugin(), LoggerPlugin(), GeneratorPlugin()];
|
|
19
21
|
|
|
@@ -21,22 +23,25 @@ const Placeholder = () => {
|
|
|
21
23
|
return <div>Loading...</div>;
|
|
22
24
|
};
|
|
23
25
|
|
|
24
|
-
const
|
|
26
|
+
const DefaultStory = () => {
|
|
25
27
|
const App = useApp({
|
|
26
28
|
pluginLoader: (id) => createNumberPlugin(id),
|
|
27
29
|
plugins,
|
|
28
30
|
core: plugins.map((plugin) => plugin.meta.id),
|
|
29
|
-
// Having a non-empty placeholder makes it clear if it's taking a while to load.
|
|
30
31
|
placeholder: Placeholder,
|
|
31
32
|
});
|
|
32
33
|
|
|
33
34
|
return <App />;
|
|
34
35
|
};
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
export default {
|
|
37
|
+
const meta = {
|
|
39
38
|
title: 'sdk/app-framework/playground',
|
|
40
|
-
render:
|
|
39
|
+
render: DefaultStory,
|
|
41
40
|
decorators: [withTheme, withLayout()],
|
|
42
|
-
}
|
|
41
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
42
|
+
|
|
43
|
+
export default meta;
|
|
44
|
+
|
|
45
|
+
type Story = StoryObj<typeof meta>;
|
|
46
|
+
|
|
47
|
+
export const Playground: Story = {};
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { INTENT_PLUGIN } from './actions';
|
|
6
5
|
import { Events } from '../common';
|
|
7
6
|
import { defineModule, definePlugin, lazy } from '../core';
|
|
8
7
|
|
|
8
|
+
import { INTENT_PLUGIN } from './actions';
|
|
9
|
+
|
|
9
10
|
export const IntentPlugin = () =>
|
|
10
11
|
definePlugin({ id: INTENT_PLUGIN, name: 'Intent' }, [
|
|
11
12
|
defineModule({
|
|
@@ -2,17 +2,19 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Effect, Option,
|
|
5
|
+
import { Effect, Option, Ref, pipe } from 'effect';
|
|
6
6
|
import { type Simplify } from 'effect/Types';
|
|
7
7
|
|
|
8
8
|
import { live } from '@dxos/live-object';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
|
-
import {
|
|
10
|
+
import { type GuardedType, type MaybePromise, type Position, byPosition } from '@dxos/util';
|
|
11
|
+
|
|
12
|
+
import { Capabilities, Events } from '../common';
|
|
13
|
+
import { type PluginContext, contributes } from '../core';
|
|
11
14
|
|
|
12
15
|
import { IntentAction } from './actions';
|
|
13
16
|
import { CycleDetectedError, NoResolversError } from './errors';
|
|
14
17
|
import {
|
|
15
|
-
createIntent,
|
|
16
18
|
type AnyIntent,
|
|
17
19
|
type AnyIntentChain,
|
|
18
20
|
type Intent,
|
|
@@ -22,9 +24,8 @@ import {
|
|
|
22
24
|
type IntentResultData,
|
|
23
25
|
type IntentSchema,
|
|
24
26
|
type Label,
|
|
27
|
+
createIntent,
|
|
25
28
|
} from './intent';
|
|
26
|
-
import { Events, Capabilities } from '../common';
|
|
27
|
-
import { contributes, type PluginContext } from '../core';
|
|
28
29
|
|
|
29
30
|
const EXECUTION_LIMIT = 100;
|
|
30
31
|
const HISTORY_LIMIT = 100;
|
|
@@ -196,7 +197,8 @@ export const createDispatcher = (
|
|
|
196
197
|
.filter((resolver) => !resolver.filter || resolver.filter(intent.data))
|
|
197
198
|
.toSorted(byPosition);
|
|
198
199
|
if (candidates.length === 0) {
|
|
199
|
-
|
|
200
|
+
log.info('no resolvers found', { intent: intent.id });
|
|
201
|
+
return yield* Effect.fail(new NoResolversError(intent.id));
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
const effect = candidates[0].resolve(intent.data, intent.undo ?? false);
|
|
@@ -207,7 +209,7 @@ export const createDispatcher = (
|
|
|
207
209
|
const dispatch: IntentDispatcher = (intentChain, depth = 0) => {
|
|
208
210
|
return Effect.gen(function* () {
|
|
209
211
|
if (depth > executionLimit) {
|
|
210
|
-
yield* Effect.fail(new CycleDetectedError());
|
|
212
|
+
return yield* Effect.fail(new CycleDetectedError());
|
|
211
213
|
}
|
|
212
214
|
|
|
213
215
|
const resultsRef = yield* Ref.make<AnyIntentResult[]>([]);
|
|
@@ -230,7 +232,7 @@ export const createDispatcher = (
|
|
|
230
232
|
// error: result.error.message,
|
|
231
233
|
// }),
|
|
232
234
|
// );
|
|
233
|
-
yield* Effect.fail(result.error);
|
|
235
|
+
return yield* Effect.fail(result.error);
|
|
234
236
|
}
|
|
235
237
|
}
|
|
236
238
|
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { SETTINGS_PLUGIN } from './actions';
|
|
6
|
-
import translations from './translations';
|
|
7
5
|
import { Capabilities, Events } from '../common';
|
|
8
6
|
import { contributes, defineModule, definePlugin, lazy } from '../core';
|
|
9
7
|
|
|
8
|
+
import { SETTINGS_PLUGIN } from './actions';
|
|
9
|
+
import { translations } from './translations';
|
|
10
|
+
|
|
10
11
|
// TODO(wittjosiah): Add options to exclude some modules.
|
|
11
12
|
export const SettingsPlugin = () =>
|
|
12
13
|
definePlugin({ id: SETTINGS_PLUGIN, name: 'Settings' }, [
|
|
@@ -5,15 +5,16 @@
|
|
|
5
5
|
import { Rx } from '@effect-rx/rx-react';
|
|
6
6
|
import { Option, pipe } from 'effect';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { ROOT_ID, createExtension } from '@dxos/app-graph';
|
|
9
9
|
import { type SettingsStore, type SettingsValue } from '@dxos/local-storage';
|
|
10
10
|
import { isNonNullable } from '@dxos/util';
|
|
11
11
|
|
|
12
|
-
import { SETTINGS_ID, SETTINGS_KEY, SETTINGS_PLUGIN, SettingsAction } from './actions';
|
|
13
12
|
import { Capabilities } from '../common';
|
|
14
|
-
import {
|
|
13
|
+
import { type PluginContext, type PluginMeta, contributes } from '../core';
|
|
15
14
|
import { createIntent } from '../plugin-intent';
|
|
16
15
|
|
|
16
|
+
import { SETTINGS_ID, SETTINGS_KEY, SETTINGS_PLUGIN, SettingsAction } from './actions';
|
|
17
|
+
|
|
17
18
|
export default (context: PluginContext) =>
|
|
18
19
|
contributes(Capabilities.AppGraphBuilder, [
|
|
19
20
|
createExtension({
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import { pipe } from 'effect';
|
|
6
6
|
|
|
7
|
-
import { SETTINGS_ID, SETTINGS_KEY, SettingsAction } from './actions';
|
|
8
7
|
import { Capabilities, LayoutAction } from '../common';
|
|
9
8
|
import { contributes } from '../core';
|
|
10
|
-
import {
|
|
9
|
+
import { chain, createIntent, createResolver } from '../plugin-intent';
|
|
10
|
+
|
|
11
|
+
import { SETTINGS_ID, SETTINGS_KEY, SettingsAction } from './actions';
|
|
11
12
|
|
|
12
13
|
export default () =>
|
|
13
14
|
contributes(
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { RootSettingsStore } from '@dxos/local-storage';
|
|
6
6
|
|
|
7
7
|
import { Capabilities } from '../common';
|
|
8
|
-
import {
|
|
8
|
+
import { type PluginContext, contributes } from '../core';
|
|
9
9
|
|
|
10
10
|
export default (context: PluginContext) => {
|
|
11
11
|
// TODO(wittjosiah): Replace with rx?
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Resource } from '@dxos/react-ui';
|
|
6
|
+
|
|
5
7
|
import { SETTINGS_PLUGIN } from './actions';
|
|
6
8
|
|
|
7
|
-
export
|
|
9
|
+
export const translations = [
|
|
8
10
|
{
|
|
9
11
|
'en-US': {
|
|
10
12
|
[SETTINGS_PLUGIN]: {
|
|
@@ -14,4 +16,4 @@ export default [
|
|
|
14
16
|
},
|
|
15
17
|
},
|
|
16
18
|
},
|
|
17
|
-
];
|
|
19
|
+
] as const satisfies Resource[];
|
|
@@ -2,38 +2,40 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, { Component, type FC, type PropsWithChildren } from 'react';
|
|
5
|
+
import React, { Component, type FC, type JSX, type PropsWithChildren, type ReactNode } from 'react';
|
|
6
6
|
|
|
7
|
-
type
|
|
8
|
-
|
|
7
|
+
type State = {
|
|
8
|
+
error: Error | undefined;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type ErrorBoundaryProps = PropsWithChildren<{
|
|
12
|
+
data?: any;
|
|
13
|
+
fallback?: FC<{ data?: any; error: Error }>;
|
|
14
|
+
}>;
|
|
9
15
|
|
|
10
16
|
/**
|
|
11
17
|
* Surface error boundary.
|
|
12
|
-
*
|
|
13
18
|
* For basic usage prefer providing a fallback component to `Surface`.
|
|
14
19
|
*
|
|
15
|
-
*
|
|
16
|
-
* https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary
|
|
20
|
+
* Ref: https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary
|
|
17
21
|
*/
|
|
18
|
-
export class ErrorBoundary extends Component<
|
|
19
|
-
constructor(props: Props) {
|
|
20
|
-
super(props);
|
|
21
|
-
this.state = { error: undefined };
|
|
22
|
-
}
|
|
23
|
-
|
|
22
|
+
export class ErrorBoundary extends Component<ErrorBoundaryProps, State> {
|
|
24
23
|
static getDerivedStateFromError(error: Error): { error: Error } {
|
|
25
24
|
return { error };
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
override
|
|
27
|
+
override state = { error: undefined };
|
|
28
|
+
|
|
29
|
+
override componentDidUpdate(prevProps: ErrorBoundaryProps): void {
|
|
29
30
|
if (prevProps.data !== this.props.data) {
|
|
30
31
|
this.resetError();
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
override render(): string | number | boolean |
|
|
35
|
+
override render(): string | number | boolean | JSX.Element | Iterable<ReactNode> | null | undefined {
|
|
35
36
|
if (this.state.error) {
|
|
36
|
-
|
|
37
|
+
const Fallback = this.props.fallback ?? DefaultFallback;
|
|
38
|
+
return <Fallback data={this.props.data} error={this.state.error} />;
|
|
37
39
|
}
|
|
38
40
|
|
|
39
41
|
return this.props.children;
|
|
@@ -43,3 +45,10 @@ export class ErrorBoundary extends Component<Props, State> {
|
|
|
43
45
|
this.setState({ error: undefined });
|
|
44
46
|
}
|
|
45
47
|
}
|
|
48
|
+
|
|
49
|
+
const DefaultFallback: NonNullable<ErrorBoundaryProps['fallback']> = ({ data, error }) => (
|
|
50
|
+
<div className='flex flex-col gap-2 overflow-hidden border border-red-500 rounded-sm'>
|
|
51
|
+
<pre className='whitespace-pre-wrap font-sm text-xs p-2'>ERROR: {error.message}</pre>
|
|
52
|
+
<pre className='whitespace-pre-wrap font-sm text-xs p-2 text-subdued'>{JSON.stringify(data, null, 2)}</pre>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type Context, createContext, useContext,
|
|
5
|
+
import { type Context, type Provider, createContext, useContext, useEffect } from 'react';
|
|
6
6
|
|
|
7
7
|
import { raise } from '@dxos/debug';
|
|
8
8
|
import { pick } from '@dxos/util';
|
|
9
9
|
|
|
10
|
-
import { usePluginManager } from './PluginManagerProvider';
|
|
11
10
|
import { Capabilities } from '../common';
|
|
12
11
|
import { type AnyIntentResolver, type IntentContext } from '../plugin-intent';
|
|
13
12
|
|
|
13
|
+
import { usePluginManager } from './PluginManagerProvider';
|
|
14
|
+
|
|
14
15
|
const IntentContext: Context<IntentContext | undefined> = createContext<IntentContext | undefined>(undefined);
|
|
15
16
|
|
|
16
17
|
export const useIntentDispatcher = (): Pick<IntentContext, 'dispatch' | 'dispatchPromise'> => {
|
|
@@ -4,18 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
import '@dxos-theme';
|
|
6
6
|
|
|
7
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
7
8
|
import React, { useCallback, useState } from 'react';
|
|
8
9
|
|
|
9
10
|
import { faker } from '@dxos/random';
|
|
10
11
|
import { Button, List, ListItem } from '@dxos/react-ui';
|
|
11
12
|
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
12
13
|
|
|
13
|
-
import { PluginManagerProvider, usePluginManager } from './PluginManagerProvider';
|
|
14
|
-
import { Surface, useSurfaces } from './Surface';
|
|
15
14
|
import { Capabilities, createSurface } from '../common';
|
|
16
15
|
import { type PluginManager } from '../core';
|
|
17
16
|
import { setupPluginManager } from '../testing';
|
|
18
17
|
|
|
18
|
+
import { PluginManagerProvider, usePluginManager } from './PluginManagerProvider';
|
|
19
|
+
import { Surface, useSurfaces } from './Surface';
|
|
20
|
+
|
|
19
21
|
const randomColor = (): string => {
|
|
20
22
|
const hue = faker.number.int({ min: 0, max: 360 });
|
|
21
23
|
const saturation = faker.number.int({ min: 50, max: 90 });
|
|
@@ -23,7 +25,7 @@ const randomColor = (): string => {
|
|
|
23
25
|
return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
|
|
24
26
|
};
|
|
25
27
|
|
|
26
|
-
const
|
|
28
|
+
const Component = () => {
|
|
27
29
|
const manager = usePluginManager();
|
|
28
30
|
const surfaces = useSurfaces();
|
|
29
31
|
const [picked, setPicked] = useState('test');
|
|
@@ -77,20 +79,26 @@ const Story = () => {
|
|
|
77
79
|
);
|
|
78
80
|
};
|
|
79
81
|
|
|
80
|
-
|
|
82
|
+
const DefaultStory = (props: { manager: PluginManager }) => {
|
|
83
|
+
return (
|
|
84
|
+
<PluginManagerProvider value={props.manager}>
|
|
85
|
+
<Component />
|
|
86
|
+
</PluginManagerProvider>
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
const meta = {
|
|
81
91
|
title: 'sdk/app-framework/Surface',
|
|
82
|
-
render:
|
|
83
|
-
return (
|
|
84
|
-
<PluginManagerProvider value={manager}>
|
|
85
|
-
<Story />
|
|
86
|
-
</PluginManagerProvider>
|
|
87
|
-
);
|
|
88
|
-
},
|
|
92
|
+
render: DefaultStory,
|
|
89
93
|
// NOTE: Intentionally not using withPluginManager to try to reduce surface area of the story.
|
|
90
94
|
decorators: [withTheme, withLayout()],
|
|
91
95
|
args: {
|
|
92
96
|
manager: setupPluginManager(),
|
|
93
97
|
},
|
|
94
|
-
}
|
|
98
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
99
|
+
|
|
100
|
+
export default meta;
|
|
101
|
+
|
|
102
|
+
type Story = StoryObj<typeof meta>;
|
|
95
103
|
|
|
96
|
-
export const Default = {};
|
|
104
|
+
export const Default: Story = {};
|
package/src/react/Surface.tsx
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import React, {
|
|
5
|
+
import React, { Fragment, Suspense, forwardRef, memo, useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { useDefaultValue } from '@dxos/react-hooks';
|
|
8
8
|
import { byPosition } from '@dxos/util';
|
|
9
9
|
|
|
10
|
-
import { ErrorBoundary } from './ErrorBoundary';
|
|
11
|
-
import { useCapabilities } from './useCapabilities';
|
|
12
10
|
import { Capabilities, type SurfaceDefinition, type SurfaceProps } from '../common';
|
|
13
11
|
import { type PluginContext } from '../core';
|
|
14
12
|
|
|
13
|
+
import { ErrorBoundary } from './ErrorBoundary';
|
|
14
|
+
import { useCapabilities } from './useCapabilities';
|
|
15
|
+
|
|
15
16
|
const DEFAULT_PLACEHOLDER = <Fragment />;
|
|
16
17
|
|
|
17
18
|
/**
|
package/src/react/common.ts
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { useCapability } from './useCapabilities';
|
|
6
5
|
import { Capabilities } from '../common';
|
|
7
6
|
|
|
7
|
+
import { useCapability } from './useCapabilities';
|
|
8
|
+
|
|
8
9
|
export const useIntentDispatcher = () => useCapability(Capabilities.IntentDispatcher);
|
|
9
10
|
|
|
10
11
|
export const useAppGraph = () => useCapability(Capabilities.AppGraph);
|
|
@@ -6,9 +6,10 @@ import { useRxValue } from '@effect-rx/rx-react';
|
|
|
6
6
|
|
|
7
7
|
import { invariant } from '@dxos/invariant';
|
|
8
8
|
|
|
9
|
-
import { usePluginManager } from './PluginManagerProvider';
|
|
10
9
|
import { type InterfaceDef } from '../core';
|
|
11
10
|
|
|
11
|
+
import { usePluginManager } from './PluginManagerProvider';
|
|
12
|
+
|
|
12
13
|
/**
|
|
13
14
|
* Hook to request capabilities from the plugin context.
|
|
14
15
|
* @returns An array of capabilities.
|
|
@@ -2,15 +2,17 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
|
-
import { withTheme
|
|
8
|
+
import { withTheme } from '@dxos/storybook-utils';
|
|
8
9
|
|
|
9
|
-
import { withPluginManager } from './withPluginManager';
|
|
10
10
|
import { Capabilities, createSurface } from '../common';
|
|
11
11
|
import { contributes } from '../core';
|
|
12
12
|
import { Surface } from '../react';
|
|
13
13
|
|
|
14
|
+
import { withPluginManager } from './withPluginManager';
|
|
15
|
+
|
|
14
16
|
const DefaultStory = () => {
|
|
15
17
|
console.log('Render');
|
|
16
18
|
return (
|
|
@@ -21,7 +23,7 @@ const DefaultStory = () => {
|
|
|
21
23
|
);
|
|
22
24
|
};
|
|
23
25
|
|
|
24
|
-
const meta
|
|
26
|
+
const meta = {
|
|
25
27
|
title: 'sdk/app-framework/withPluginManager',
|
|
26
28
|
render: DefaultStory,
|
|
27
29
|
decorators: [
|
|
@@ -39,8 +41,10 @@ const meta: Meta = {
|
|
|
39
41
|
],
|
|
40
42
|
}),
|
|
41
43
|
],
|
|
42
|
-
}
|
|
44
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
43
45
|
|
|
44
46
|
export default meta;
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
type Story = StoryObj<typeof meta>;
|
|
49
|
+
|
|
50
|
+
export const Default: Story = {};
|
|
@@ -6,22 +6,24 @@ import { type Decorator } from '@storybook/react';
|
|
|
6
6
|
import React, { useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { raise } from '@dxos/debug';
|
|
9
|
+
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
9
10
|
|
|
10
|
-
import { useApp, type CreateAppOptions } from '../App';
|
|
11
11
|
import { Capabilities, Events } from '../common';
|
|
12
|
+
import { type UseAppOptions, useApp } from '../components';
|
|
12
13
|
import {
|
|
13
|
-
contributes,
|
|
14
|
-
defineModule,
|
|
15
|
-
definePlugin,
|
|
16
14
|
type ActivationEvent,
|
|
17
15
|
type AnyCapability,
|
|
18
|
-
PluginManager,
|
|
19
16
|
type PluginContext,
|
|
17
|
+
PluginManager,
|
|
18
|
+
contributes,
|
|
19
|
+
defineModule,
|
|
20
|
+
definePlugin,
|
|
20
21
|
} from '../core';
|
|
21
22
|
|
|
22
23
|
// TODO(burdon): Factor out (use consistently in plugin framework?)
|
|
23
24
|
export type Provider<C, R> = (context: C) => R;
|
|
24
25
|
export type ProviderOrValue<C, R> = Provider<C, R> | R;
|
|
26
|
+
|
|
25
27
|
export const getValue = <C, R>(providerOrValue: ProviderOrValue<C, R>, context: C): R => {
|
|
26
28
|
return typeof providerOrValue === 'function' ? (providerOrValue as Provider<C, R>)(context) : providerOrValue;
|
|
27
29
|
};
|
|
@@ -34,7 +36,7 @@ export const setupPluginManager = ({
|
|
|
34
36
|
plugins = [],
|
|
35
37
|
core = plugins.map(({ meta }) => meta.id),
|
|
36
38
|
...options
|
|
37
|
-
}:
|
|
39
|
+
}: UseAppOptions & Pick<WithPluginManagerOptions, 'capabilities'> = {}) => {
|
|
38
40
|
const pluginManager = new PluginManager({
|
|
39
41
|
pluginLoader: () => raise(new Error('Not implemented')),
|
|
40
42
|
plugins: [storyPlugin(), ...plugins],
|
|
@@ -55,8 +57,10 @@ export const setupPluginManager = ({
|
|
|
55
57
|
return pluginManager;
|
|
56
58
|
};
|
|
57
59
|
|
|
58
|
-
export type WithPluginManagerOptions =
|
|
60
|
+
export type WithPluginManagerOptions = UseAppOptions & {
|
|
61
|
+
/** @deprecated */
|
|
59
62
|
capabilities?: ProviderOrValue<PluginContext, AnyCapability[]>;
|
|
63
|
+
/** @deprecated */
|
|
60
64
|
fireEvents?: (ActivationEvent | string)[];
|
|
61
65
|
};
|
|
62
66
|
|
|
@@ -86,12 +90,8 @@ export const withPluginManager = (options: WithPluginManagerOptions = {}): Decor
|
|
|
86
90
|
}, [pluginManager, context]);
|
|
87
91
|
|
|
88
92
|
// Fire events.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
await Promise.all(options.fireEvents?.map((event) => pluginManager.activate(event)) ?? []);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
return () => clearTimeout(timeout);
|
|
93
|
+
useAsyncEffect(async () => {
|
|
94
|
+
await Promise.all(options.fireEvents?.map((event) => pluginManager.activate(event)) ?? []);
|
|
95
95
|
}, [pluginManager]);
|
|
96
96
|
|
|
97
97
|
// Create app.
|
package/tsconfig.json
CHANGED
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"path": "../../core/ai"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
"path": "../../core/
|
|
42
|
+
"path": "../../core/blueprints"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
"path": "../../core/echo/echo-schema"
|
|
@@ -50,6 +50,9 @@
|
|
|
50
50
|
{
|
|
51
51
|
"path": "../../core/echo/live-object"
|
|
52
52
|
},
|
|
53
|
+
{
|
|
54
|
+
"path": "../../core/functions"
|
|
55
|
+
},
|
|
53
56
|
{
|
|
54
57
|
"path": "../../ui/primitives/react-hooks"
|
|
55
58
|
},
|
|
@@ -68,12 +71,5 @@
|
|
|
68
71
|
{
|
|
69
72
|
"path": "../schema"
|
|
70
73
|
}
|
|
71
|
-
]
|
|
72
|
-
"ts-node": {
|
|
73
|
-
"compilerOptions": {
|
|
74
|
-
"module": "CommonJS"
|
|
75
|
-
},
|
|
76
|
-
"files": true,
|
|
77
|
-
"transpileOnly": true
|
|
78
|
-
}
|
|
74
|
+
]
|
|
79
75
|
}
|
package/vitest.config.ts
CHANGED
|
@@ -4,6 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import { defineConfig, mergeConfig } from 'vitest/config';
|
|
6
6
|
|
|
7
|
-
import { baseConfig } from '../../../vitest.
|
|
7
|
+
import { baseConfig } from '../../../vitest.base.config';
|
|
8
8
|
|
|
9
|
-
export default mergeConfig(
|
|
9
|
+
export default mergeConfig(
|
|
10
|
+
baseConfig({ cwd: __dirname }),
|
|
11
|
+
defineConfig({}),
|
|
12
|
+
);
|