@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
|
@@ -4,20 +4,22 @@
|
|
|
4
4
|
|
|
5
5
|
import { RegistryContext } from '@effect-rx/rx-react';
|
|
6
6
|
import { effect } from '@preact/signals-core';
|
|
7
|
-
import React, { useCallback, useEffect, useMemo
|
|
7
|
+
import React, { type FC, useCallback, useEffect, useMemo } from 'react';
|
|
8
8
|
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
10
10
|
import { live } from '@dxos/live-object';
|
|
11
|
-
import { useDefaultValue } from '@dxos/react-hooks';
|
|
11
|
+
import { useAsyncEffect, useDefaultValue } from '@dxos/react-hooks';
|
|
12
12
|
|
|
13
|
-
import { Capabilities, Events } from '
|
|
14
|
-
import { PluginManager, type PluginManagerOptions
|
|
15
|
-
import {
|
|
16
|
-
|
|
13
|
+
import { Capabilities, Events } from '../common';
|
|
14
|
+
import { type Plugin, PluginManager, type PluginManagerOptions } from '../core';
|
|
15
|
+
import { ErrorBoundary, PluginManagerProvider } from '../react';
|
|
16
|
+
|
|
17
|
+
import { App } from './App';
|
|
18
|
+
import { DefaultFallback } from './DefaultFallback';
|
|
17
19
|
|
|
18
20
|
const ENABLED_KEY = 'dxos.org/app-framework/enabled';
|
|
19
21
|
|
|
20
|
-
export type
|
|
22
|
+
export type UseAppOptions = {
|
|
21
23
|
pluginManager?: PluginManager;
|
|
22
24
|
pluginLoader?: PluginManagerOptions['pluginLoader'];
|
|
23
25
|
plugins?: Plugin[];
|
|
@@ -27,6 +29,7 @@ export type CreateAppOptions = {
|
|
|
27
29
|
fallback?: ErrorBoundary['props']['fallback'];
|
|
28
30
|
cacheEnabled?: boolean;
|
|
29
31
|
safeMode?: boolean;
|
|
32
|
+
debounce?: number;
|
|
30
33
|
};
|
|
31
34
|
|
|
32
35
|
/**
|
|
@@ -38,7 +41,7 @@ export type CreateAppOptions = {
|
|
|
38
41
|
* const core = [LayoutPluginId];
|
|
39
42
|
* const default = [MyPluginId];
|
|
40
43
|
* const fallback = <div>Initializing Plugins...</div>;
|
|
41
|
-
* const App =
|
|
44
|
+
* const App = useApp({ plugins, core, default, fallback });
|
|
42
45
|
* createRoot(document.getElementById('root')!).render(
|
|
43
46
|
* <StrictMode>
|
|
44
47
|
* <App />
|
|
@@ -64,7 +67,8 @@ export const useApp = ({
|
|
|
64
67
|
fallback = DefaultFallback,
|
|
65
68
|
cacheEnabled = false,
|
|
66
69
|
safeMode = false,
|
|
67
|
-
|
|
70
|
+
debounce = 0,
|
|
71
|
+
}: UseAppOptions) => {
|
|
68
72
|
const plugins = useDefaultValue(_plugins, () => []);
|
|
69
73
|
const core = useDefaultValue(_core, () => plugins.map(({ meta }) => meta.id));
|
|
70
74
|
const defaults = useDefaultValue(_defaults, () => []);
|
|
@@ -112,6 +116,10 @@ export const useApp = ({
|
|
|
112
116
|
}, [cacheEnabled, manager]);
|
|
113
117
|
|
|
114
118
|
useEffect(() => {
|
|
119
|
+
setupDevtools(manager);
|
|
120
|
+
}, [manager]);
|
|
121
|
+
|
|
122
|
+
useAsyncEffect(async () => {
|
|
115
123
|
manager.context.contributeCapability({
|
|
116
124
|
interface: Capabilities.PluginManager,
|
|
117
125
|
implementation: manager,
|
|
@@ -124,34 +132,24 @@ export const useApp = ({
|
|
|
124
132
|
module: 'dxos.org/app-framework/rx-registry',
|
|
125
133
|
});
|
|
126
134
|
|
|
135
|
+
await Promise.all([
|
|
136
|
+
// TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
|
|
137
|
+
manager.activate(Events.SetupReactSurface),
|
|
138
|
+
manager.activate(Events.Startup),
|
|
139
|
+
]);
|
|
140
|
+
|
|
127
141
|
return () => {
|
|
128
142
|
manager.context.removeCapability(Capabilities.PluginManager, manager);
|
|
129
143
|
manager.context.removeCapability(Capabilities.RxRegistry, manager.registry);
|
|
130
144
|
};
|
|
131
145
|
}, [manager]);
|
|
132
146
|
|
|
133
|
-
useEffect(() => {
|
|
134
|
-
setupDevtools(manager);
|
|
135
|
-
}, [manager]);
|
|
136
|
-
|
|
137
|
-
useEffect(() => {
|
|
138
|
-
const timeout = setTimeout(async () => {
|
|
139
|
-
await Promise.all([
|
|
140
|
-
// TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
|
|
141
|
-
manager.activate(Events.SetupReactSurface),
|
|
142
|
-
manager.activate(Events.Startup),
|
|
143
|
-
]);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
return () => clearTimeout(timeout);
|
|
147
|
-
}, [manager]);
|
|
148
|
-
|
|
149
147
|
return useCallback(
|
|
150
148
|
() => (
|
|
151
149
|
<ErrorBoundary fallback={fallback}>
|
|
152
150
|
<PluginManagerProvider value={manager}>
|
|
153
151
|
<RegistryContext.Provider value={manager.registry}>
|
|
154
|
-
<App placeholder={placeholder} state={state} />
|
|
152
|
+
<App placeholder={placeholder} state={state} debounce={debounce} />
|
|
155
153
|
</RegistryContext.Provider>
|
|
156
154
|
</PluginManagerProvider>
|
|
157
155
|
</ErrorBoundary>
|
|
@@ -160,116 +158,6 @@ export const useApp = ({
|
|
|
160
158
|
);
|
|
161
159
|
};
|
|
162
160
|
|
|
163
|
-
const DELAY_PLACEHOLDER = 2_000;
|
|
164
|
-
|
|
165
|
-
enum LoadingState {
|
|
166
|
-
Loading = 0,
|
|
167
|
-
FadeIn = 1,
|
|
168
|
-
FadeOut = 2,
|
|
169
|
-
Done = 3,
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* To avoid "flashing" the placeholder, we wait a period of time before starting the loading animation.
|
|
174
|
-
* If loading completes during this time the placehoder is not shown, otherwise is it displayed for a minimum period of time.
|
|
175
|
-
*
|
|
176
|
-
* States:
|
|
177
|
-
* 0: Loading - Wait for a period of time before starting the loading animation.
|
|
178
|
-
* 1: Fade-in - Display a loading animation.
|
|
179
|
-
* 2: Fade-out - Fade out the loading animation.
|
|
180
|
-
* 3: Done - Remove the placeholder.
|
|
181
|
-
*/
|
|
182
|
-
const useLoading = (state: AppProps['state']) => {
|
|
183
|
-
const [stage, setStage] = useState<LoadingState>(LoadingState.Loading);
|
|
184
|
-
useEffect(() => {
|
|
185
|
-
const i = setInterval(() => {
|
|
186
|
-
setStage((tick) => {
|
|
187
|
-
switch (tick) {
|
|
188
|
-
case LoadingState.Loading:
|
|
189
|
-
if (!state.ready) {
|
|
190
|
-
return LoadingState.FadeIn;
|
|
191
|
-
} else {
|
|
192
|
-
clearInterval(i);
|
|
193
|
-
return LoadingState.Done;
|
|
194
|
-
}
|
|
195
|
-
case LoadingState.FadeIn:
|
|
196
|
-
if (state.ready) {
|
|
197
|
-
return LoadingState.FadeOut;
|
|
198
|
-
}
|
|
199
|
-
break;
|
|
200
|
-
case LoadingState.FadeOut:
|
|
201
|
-
clearInterval(i);
|
|
202
|
-
return LoadingState.Done;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
return tick;
|
|
206
|
-
});
|
|
207
|
-
}, DELAY_PLACEHOLDER);
|
|
208
|
-
|
|
209
|
-
return () => clearInterval(i);
|
|
210
|
-
}, []);
|
|
211
|
-
|
|
212
|
-
return stage;
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
type AppProps = Pick<CreateAppOptions, 'placeholder'> & {
|
|
216
|
-
state: { ready: boolean; error: unknown };
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
const App = ({ placeholder: Placeholder, state }: AppProps) => {
|
|
220
|
-
const reactContexts = useCapabilities(Capabilities.ReactContext);
|
|
221
|
-
const reactRoots = useCapabilities(Capabilities.ReactRoot);
|
|
222
|
-
const stage = useLoading(state);
|
|
223
|
-
|
|
224
|
-
if (state.error) {
|
|
225
|
-
// This triggers the error boundary to provide UI feedback for the startup error.
|
|
226
|
-
throw state.error;
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// TODO(wittjosiah): Consider using Suspense instead?
|
|
230
|
-
if (stage < LoadingState.Done) {
|
|
231
|
-
if (!Placeholder) {
|
|
232
|
-
return null;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
return <Placeholder stage={stage} />;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
const ComposedContext = composeContexts(reactContexts);
|
|
239
|
-
return (
|
|
240
|
-
<ComposedContext>
|
|
241
|
-
{reactRoots.map(({ id, root: Component }) => (
|
|
242
|
-
<Component key={id} />
|
|
243
|
-
))}
|
|
244
|
-
</ComposedContext>
|
|
245
|
-
);
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
// Default fallback does not use tailwind or theme.
|
|
249
|
-
const DefaultFallback = ({ error }: { error: Error }) => {
|
|
250
|
-
return (
|
|
251
|
-
<div style={{ margin: '0.5rem', padding: '1rem', overflow: 'hidden', border: '1px solid red' }}>
|
|
252
|
-
{/* TODO(wittjosiah): Link to docs for replacing default. */}
|
|
253
|
-
<h1 style={{ margin: '0.5rem 0', fontSize: '1.2rem' }}>[ERROR]: {error.message}</h1>
|
|
254
|
-
<pre style={{ overflow: 'auto', fontSize: '1rem' }}>{error.stack}</pre>
|
|
255
|
-
</div>
|
|
256
|
-
);
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
const composeContexts = (contexts: Capabilities.ReactContext[]) => {
|
|
260
|
-
if (contexts.length === 0) {
|
|
261
|
-
return ({ children }: PropsWithChildren) => <>{children}</>;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
return topologicalSort(contexts)
|
|
265
|
-
.map(({ context }) => context)
|
|
266
|
-
.reduce((Acc, Next) => ({ children }) => (
|
|
267
|
-
<Acc>
|
|
268
|
-
<Next>{children}</Next>
|
|
269
|
-
</Acc>
|
|
270
|
-
));
|
|
271
|
-
};
|
|
272
|
-
|
|
273
161
|
const setupDevtools = (manager: PluginManager) => {
|
|
274
162
|
(globalThis as any).composer ??= {};
|
|
275
163
|
(globalThis as any).composer.manager = manager;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useEffect, useState } from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AppProps } from './App';
|
|
8
|
+
|
|
9
|
+
export enum LoadingState {
|
|
10
|
+
Loading = 0,
|
|
11
|
+
FadeIn = 1,
|
|
12
|
+
FadeOut = 2,
|
|
13
|
+
Done = 3,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* To avoid "flashing" the placeholder, we wait a period of time before starting the loading animation.
|
|
18
|
+
* If loading completes during this time the placehoder is not shown, otherwise is it displayed for a minimum period of time.
|
|
19
|
+
*
|
|
20
|
+
* States:
|
|
21
|
+
* 0: Loading - Wait for a period of time before starting the loading animation.
|
|
22
|
+
* 1: Fade-in - Display a loading animation.
|
|
23
|
+
* 2: Fade-out - Fade out the loading animation.
|
|
24
|
+
* 3: Done - Remove the placeholder.
|
|
25
|
+
*/
|
|
26
|
+
export const useLoading = (state: AppProps['state'], debounce = 0) => {
|
|
27
|
+
const [stage, setStage] = useState<LoadingState>(LoadingState.Loading);
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (!debounce) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const i = setInterval(() => {
|
|
34
|
+
setStage((stage) => {
|
|
35
|
+
switch (stage) {
|
|
36
|
+
case LoadingState.Loading: {
|
|
37
|
+
if (!state.ready) {
|
|
38
|
+
return LoadingState.FadeIn;
|
|
39
|
+
} else {
|
|
40
|
+
clearInterval(i);
|
|
41
|
+
return LoadingState.Done;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
case LoadingState.FadeIn: {
|
|
46
|
+
if (state.ready) {
|
|
47
|
+
return LoadingState.FadeOut;
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
case LoadingState.FadeOut: {
|
|
53
|
+
clearInterval(i);
|
|
54
|
+
return LoadingState.Done;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return stage;
|
|
59
|
+
});
|
|
60
|
+
}, debounce);
|
|
61
|
+
|
|
62
|
+
return () => clearInterval(i);
|
|
63
|
+
}, [debounce]);
|
|
64
|
+
|
|
65
|
+
if (!debounce) {
|
|
66
|
+
return state.ready ? LoadingState.Done : LoadingState.Loading;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return stage;
|
|
70
|
+
};
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Registry } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
7
|
import { describe, expect, it, onTestFinished } from 'vitest';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { PluginContext, defineCapability } from './capabilities';
|
|
10
10
|
|
|
11
11
|
const defaultOptions = {
|
|
12
12
|
activate: () => Effect.succeed(false),
|
package/src/core/capabilities.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Registry, Rx } from '@effect-rx/rx-react';
|
|
6
|
-
import
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
7
|
|
|
8
8
|
import { Trigger } from '@dxos/async';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
@@ -22,6 +22,10 @@ export type InterfaceDef<T> = {
|
|
|
22
22
|
identifier: string;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
+
export namespace InterfaceDef {
|
|
26
|
+
export type Implementation<I extends InterfaceDef<any>> = I extends InterfaceDef<infer T> ? T : never;
|
|
27
|
+
}
|
|
28
|
+
|
|
25
29
|
/**
|
|
26
30
|
* Helper to define the interface of a capability.
|
|
27
31
|
*/
|
|
@@ -37,12 +41,12 @@ export type Capability<T> = {
|
|
|
37
41
|
/**
|
|
38
42
|
* The interface definition of the capability.
|
|
39
43
|
*/
|
|
40
|
-
interface: InterfaceDef<T>;
|
|
44
|
+
readonly interface: InterfaceDef<T>;
|
|
41
45
|
|
|
42
46
|
/**
|
|
43
47
|
* The implementation of the capability.
|
|
44
48
|
*/
|
|
45
|
-
implementation: T;
|
|
49
|
+
readonly implementation: T;
|
|
46
50
|
|
|
47
51
|
/**
|
|
48
52
|
* Called when the capability is deactivated.
|
|
@@ -69,16 +73,21 @@ class CapabilityImpl<T> {
|
|
|
69
73
|
/**
|
|
70
74
|
* Helper to define the implementation of a capability.
|
|
71
75
|
*/
|
|
72
|
-
export const contributes = <T
|
|
73
|
-
interfaceDef:
|
|
74
|
-
implementation:
|
|
75
|
-
deactivate?: Capability<
|
|
76
|
-
): Capability<
|
|
77
|
-
return {
|
|
76
|
+
export const contributes = <I extends InterfaceDef<any>, T = InterfaceDef.Implementation<I>>(
|
|
77
|
+
interfaceDef: I,
|
|
78
|
+
implementation: T,
|
|
79
|
+
deactivate?: Capability<InterfaceDef.Implementation<I>>['deactivate'],
|
|
80
|
+
): Capability<I> => {
|
|
81
|
+
return {
|
|
82
|
+
interface: interfaceDef,
|
|
83
|
+
implementation: implementation as any, // NOTE: Added to allow providing readonly implementation.
|
|
84
|
+
deactivate,
|
|
85
|
+
} satisfies Capability<I>;
|
|
78
86
|
};
|
|
79
87
|
|
|
80
88
|
type LoadCapability<T, U> = () => Promise<{ default: (props: T) => MaybePromise<Capability<U>> }>;
|
|
81
89
|
type LoadCapabilities<T> = () => Promise<{ default: (props: T) => MaybePromise<AnyCapability[]> }>;
|
|
90
|
+
|
|
82
91
|
// TODO(wittjosiah): Not having the array be `any` causes type errors when using the lazy capability.
|
|
83
92
|
type LazyCapability<T, U> = (props?: T) => Promise<() => Promise<Capability<U> | AnyCapability[]>>;
|
|
84
93
|
|
package/src/core/manager.test.ts
CHANGED
|
@@ -7,16 +7,17 @@ import { afterEach, describe, expect, it } from 'vitest';
|
|
|
7
7
|
|
|
8
8
|
import { Trigger } from '@dxos/async';
|
|
9
9
|
import { raise } from '@dxos/debug';
|
|
10
|
-
import { updateCounter } from '@dxos/echo
|
|
10
|
+
import { updateCounter } from '@dxos/echo/testing';
|
|
11
11
|
import { registerSignalsRuntime } from '@dxos/echo-signals';
|
|
12
12
|
import { invariant } from '@dxos/invariant';
|
|
13
13
|
import { live } from '@dxos/live-object';
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { Events } from '../common';
|
|
16
|
+
|
|
17
|
+
import { type PluginContext, contributes, defineCapability } from './capabilities';
|
|
16
18
|
import { allOf, defineEvent, oneOf } from './events';
|
|
17
19
|
import { PluginManager } from './manager';
|
|
18
|
-
import {
|
|
19
|
-
import { Events } from '../common';
|
|
20
|
+
import { Plugin, defineModule } from './plugin';
|
|
20
21
|
|
|
21
22
|
registerSignalsRuntime();
|
|
22
23
|
|
|
@@ -42,7 +43,7 @@ describe('PluginManager', () => {
|
|
|
42
43
|
});
|
|
43
44
|
|
|
44
45
|
it('should be able to add and remove plugins', async () => {
|
|
45
|
-
const Test =
|
|
46
|
+
const Test = new Plugin(testMeta, []);
|
|
46
47
|
plugins = [Test];
|
|
47
48
|
|
|
48
49
|
const manager = new PluginManager({ pluginLoader });
|
|
@@ -58,7 +59,7 @@ describe('PluginManager', () => {
|
|
|
58
59
|
activatesOn: Events.Startup,
|
|
59
60
|
activate: () => contributes(String, { string: 'hello' }),
|
|
60
61
|
});
|
|
61
|
-
const Test =
|
|
62
|
+
const Test = new Plugin(testMeta, [Hello]);
|
|
62
63
|
|
|
63
64
|
const manager = new PluginManager({ plugins: [Test], core: [], pluginLoader });
|
|
64
65
|
await manager.enable(testMeta.id);
|
|
@@ -75,7 +76,7 @@ describe('PluginManager', () => {
|
|
|
75
76
|
activatesOn: Events.Startup,
|
|
76
77
|
activate: () => contributes(String, { string: 'hello' }),
|
|
77
78
|
});
|
|
78
|
-
const Test =
|
|
79
|
+
const Test = new Plugin(testMeta, [Hello]);
|
|
79
80
|
|
|
80
81
|
const manager = new PluginManager({ plugins: [Test], enabled: [Test.meta.id], pluginLoader });
|
|
81
82
|
expect(manager.plugins).toEqual([Test]);
|
|
@@ -94,7 +95,7 @@ describe('PluginManager', () => {
|
|
|
94
95
|
activatesOn: FailEvent,
|
|
95
96
|
activate: async () => raise(new Error('test')),
|
|
96
97
|
});
|
|
97
|
-
plugins = [
|
|
98
|
+
plugins = [new Plugin(testMeta, [Fail])];
|
|
98
99
|
|
|
99
100
|
const manager = new PluginManager({ pluginLoader });
|
|
100
101
|
await manager.add(testMeta.id);
|
|
@@ -113,7 +114,7 @@ describe('PluginManager', () => {
|
|
|
113
114
|
// TODO(wittjosiah): Test and catch more failure modes.
|
|
114
115
|
activate: async () => async () => raise(new Error('test')),
|
|
115
116
|
});
|
|
116
|
-
plugins = [
|
|
117
|
+
plugins = [new Plugin(testMeta, [Hello, Fail])];
|
|
117
118
|
|
|
118
119
|
const manager = new PluginManager({ pluginLoader });
|
|
119
120
|
const activating = new Trigger<boolean>();
|
|
@@ -148,7 +149,7 @@ describe('PluginManager', () => {
|
|
|
148
149
|
return contributes(String, { string: 'hello' });
|
|
149
150
|
},
|
|
150
151
|
});
|
|
151
|
-
plugins = [
|
|
152
|
+
plugins = [new Plugin(testMeta, [Hello])];
|
|
152
153
|
|
|
153
154
|
const manager = new PluginManager({ pluginLoader });
|
|
154
155
|
|
|
@@ -179,21 +180,21 @@ describe('PluginManager', () => {
|
|
|
179
180
|
});
|
|
180
181
|
|
|
181
182
|
it('should be able to fire custom activation events', async () => {
|
|
182
|
-
const Plugin1 =
|
|
183
|
+
const Plugin1 = new Plugin({ id: 'dxos.org/test/plugin-1', name: 'Plugin 1' }, [
|
|
183
184
|
defineModule({
|
|
184
185
|
id: 'dxos.org/test/plugin-1',
|
|
185
186
|
activatesOn: CountEvent,
|
|
186
187
|
activate: () => [contributes(Number, { number: 1 })],
|
|
187
188
|
}),
|
|
188
189
|
]);
|
|
189
|
-
const Plugin2 =
|
|
190
|
+
const Plugin2 = new Plugin({ id: 'dxos.org/test/plugin-2', name: 'Plugin 2' }, [
|
|
190
191
|
defineModule({
|
|
191
192
|
id: 'dxos.org/test/plugin-2',
|
|
192
193
|
activatesOn: CountEvent,
|
|
193
194
|
activate: () => [contributes(Number, { number: 2 })],
|
|
194
195
|
}),
|
|
195
196
|
]);
|
|
196
|
-
const Plugin3 =
|
|
197
|
+
const Plugin3 = new Plugin({ id: 'dxos.org/test/plugin-3', name: 'Plugin 3' }, [
|
|
197
198
|
defineModule({
|
|
198
199
|
id: 'dxos.org/test/plugin-3',
|
|
199
200
|
activatesOn: CountEvent,
|
|
@@ -230,7 +231,7 @@ describe('PluginManager', () => {
|
|
|
230
231
|
return contributes(String, { string: 'hello' });
|
|
231
232
|
},
|
|
232
233
|
});
|
|
233
|
-
plugins = [
|
|
234
|
+
plugins = [new Plugin(testMeta, [Hello])];
|
|
234
235
|
|
|
235
236
|
const manager = new PluginManager({ pluginLoader });
|
|
236
237
|
expect(manager.active).toEqual([]);
|
|
@@ -256,7 +257,7 @@ describe('PluginManager', () => {
|
|
|
256
257
|
return contributes(String, { string: 'hello' });
|
|
257
258
|
},
|
|
258
259
|
});
|
|
259
|
-
plugins = [
|
|
260
|
+
plugins = [new Plugin(testMeta, [Hello])];
|
|
260
261
|
|
|
261
262
|
const manager = new PluginManager({ pluginLoader });
|
|
262
263
|
expect(manager.active).toEqual([]);
|
|
@@ -282,7 +283,7 @@ describe('PluginManager', () => {
|
|
|
282
283
|
state.total = numbers.reduce((acc, n) => acc + n.number, 0);
|
|
283
284
|
};
|
|
284
285
|
|
|
285
|
-
const Count =
|
|
286
|
+
const Count = new Plugin({ id: 'dxos.org/test/count', name: 'Count' }, [
|
|
286
287
|
defineModule({
|
|
287
288
|
id: 'dxos.org/test/count',
|
|
288
289
|
activatesOn: Events.Startup,
|
|
@@ -294,7 +295,7 @@ describe('PluginManager', () => {
|
|
|
294
295
|
}),
|
|
295
296
|
]);
|
|
296
297
|
|
|
297
|
-
const Test =
|
|
298
|
+
const Test = new Plugin(testMeta, [
|
|
298
299
|
defineModule({
|
|
299
300
|
id: 'dxos.org/test/plugin-1',
|
|
300
301
|
activatesOn: CountEvent,
|
|
@@ -352,7 +353,7 @@ describe('PluginManager', () => {
|
|
|
352
353
|
const id = 'dxos.org/test/counter';
|
|
353
354
|
const stateEvent = Events.createStateEvent(id);
|
|
354
355
|
|
|
355
|
-
const Test =
|
|
356
|
+
const Test = new Plugin(testMeta, [
|
|
356
357
|
defineModule({
|
|
357
358
|
id,
|
|
358
359
|
activatesOn: Events.Startup,
|
|
@@ -389,21 +390,21 @@ describe('PluginManager', () => {
|
|
|
389
390
|
});
|
|
390
391
|
|
|
391
392
|
it('should be reactive', async () => {
|
|
392
|
-
const Plugin1 =
|
|
393
|
+
const Plugin1 = new Plugin({ id: 'dxos.org/test/plugin-1', name: 'Plugin 1' }, [
|
|
393
394
|
defineModule({
|
|
394
395
|
id: 'dxos.org/test/plugin-1',
|
|
395
396
|
activatesOn: CountEvent,
|
|
396
397
|
activate: () => [contributes(Number, { number: 1 })],
|
|
397
398
|
}),
|
|
398
399
|
]);
|
|
399
|
-
const Plugin2 =
|
|
400
|
+
const Plugin2 = new Plugin({ id: 'dxos.org/test/plugin-2', name: 'Plugin 2' }, [
|
|
400
401
|
defineModule({
|
|
401
402
|
id: 'dxos.org/test/plugin-2',
|
|
402
403
|
activatesOn: CountEvent,
|
|
403
404
|
activate: () => [contributes(Number, { number: 2 })],
|
|
404
405
|
}),
|
|
405
406
|
]);
|
|
406
|
-
const Plugin3 =
|
|
407
|
+
const Plugin3 = new Plugin({ id: 'dxos.org/test/plugin-3', name: 'Plugin 3' }, [
|
|
407
408
|
defineModule({
|
|
408
409
|
id: 'dxos.org/test/plugin-3',
|
|
409
410
|
activatesOn: CountEvent,
|