@dxos/app-framework 0.8.2-main.fbd8ed0 → 0.8.2-staging.4d6ad0f
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/dist/lib/browser/{app-graph-builder-6E7NCZ77.mjs → app-graph-builder-DYEAGZPS.mjs} +3 -3
- package/dist/lib/browser/{chunk-2KSDY3EZ.mjs → chunk-5GE2ERNU.mjs} +24 -17
- package/dist/lib/browser/chunk-5GE2ERNU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KPRHX73H.mjs → chunk-WWEJRWFX.mjs} +2 -2
- package/dist/lib/browser/{chunk-KPRHX73H.mjs.map → chunk-WWEJRWFX.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-K3HOLGVH.mjs → chunk-ZMXJV64L.mjs} +95 -47
- package/dist/lib/browser/chunk-ZMXJV64L.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +8 -8
- package/dist/lib/browser/{intent-dispatcher-VGUJBPPN.mjs → intent-dispatcher-ELZN5EM7.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-QLFZY5R5.mjs → intent-resolver-SGWLINTO.mjs} +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{store-QGVXOY4T.mjs → store-YIU6IPZ2.mjs} +2 -2
- package/dist/lib/browser/testing/index.mjs +25 -13
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/worker.mjs +1 -1
- package/dist/lib/node/{app-graph-builder-4IWMG67O.cjs → app-graph-builder-GBLISL7L.cjs} +28 -28
- package/dist/lib/node/{chunk-JQMNABMK.cjs → chunk-G774ASXO.cjs} +5 -5
- package/dist/lib/node/{chunk-JQMNABMK.cjs.map → chunk-G774ASXO.cjs.map} +1 -1
- package/dist/lib/node/{chunk-2EBZ2ICH.cjs → chunk-HIVITTZD.cjs} +26 -19
- package/dist/lib/node/chunk-HIVITTZD.cjs.map +7 -0
- package/dist/lib/node/{chunk-7J66KH2T.cjs → chunk-Z2PMVDJ5.cjs} +107 -59
- package/dist/lib/node/chunk-Z2PMVDJ5.cjs.map +7 -0
- package/dist/lib/node/index.cjs +80 -80
- package/dist/lib/node/{intent-dispatcher-TASJBG5M.cjs → intent-dispatcher-LFXZJTAS.cjs} +8 -8
- package/dist/lib/node/{intent-dispatcher-TASJBG5M.cjs.map → intent-dispatcher-LFXZJTAS.cjs.map} +2 -2
- package/dist/lib/node/{intent-resolver-5CG5NIJY.cjs → intent-resolver-EPSFTHL6.cjs} +12 -12
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{store-IF3UR2KA.cjs → store-CVVRXUTH.cjs} +8 -8
- package/dist/lib/node/testing/index.cjs +28 -16
- package/dist/lib/node/testing/index.cjs.map +3 -3
- package/dist/lib/node/worker.cjs +38 -38
- package/dist/lib/node/worker.cjs.map +1 -1
- package/dist/lib/node-esm/{app-graph-builder-LYCG5CO3.mjs → app-graph-builder-LUBDEIT6.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-ISNBS46Y.mjs → chunk-6IKYKERU.mjs} +95 -47
- package/dist/lib/node-esm/chunk-6IKYKERU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-JUJF5L4G.mjs → chunk-I6BVZMAH.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-JUJF5L4G.mjs.map → chunk-I6BVZMAH.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-BOEJMAVK.mjs → chunk-Z2ZHH4HN.mjs} +24 -17
- package/dist/lib/node-esm/chunk-Z2ZHH4HN.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +8 -8
- package/dist/lib/node-esm/{intent-dispatcher-ZUSNX2OY.mjs → intent-dispatcher-A2JCMWRD.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-NGDHUKDD.mjs → intent-resolver-5C4O43GK.mjs} +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{store-NCRSE25X.mjs → store-HRZXZ2D2.mjs} +2 -2
- package/dist/lib/node-esm/testing/index.mjs +25 -13
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/worker.mjs +1 -1
- package/dist/types/src/App.d.ts +1 -1
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/common/capabilities.d.ts +36 -28
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/collaboration.d.ts +2 -9
- package/dist/types/src/common/collaboration.d.ts.map +1 -1
- package/dist/types/src/common/layout.d.ts +3 -1
- package/dist/types/src/common/layout.d.ts.map +1 -1
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
- package/dist/types/src/react/ErrorBoundary.d.ts +1 -1
- package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/package.json +22 -20
- package/src/App.tsx +93 -55
- package/src/common/capabilities.ts +11 -3
- package/src/common/collaboration.ts +4 -7
- package/src/common/layout.ts +9 -1
- package/src/core/capabilities.ts +2 -2
- package/src/core/manager.ts +10 -10
- package/src/playground/playground.stories.tsx +12 -8
- package/src/react/ErrorBoundary.tsx +3 -3
- package/src/testing/withPluginManager.tsx +24 -13
- package/tsconfig.json +1 -56
- package/typedoc/assets/navigation.js +1 -1
- package/typedoc/assets/search.js +1 -1
- package/typedoc/classes/CollaborationActions.InsertContent.html +131 -170
- package/typedoc/classes/ErrorBoundary.html +6 -6
- package/typedoc/classes/IntentAction.ShowUndo.html +5 -5
- package/typedoc/classes/IntentAction.Track.html +5 -5
- package/typedoc/classes/LayoutAction.AddToast.html +4 -4
- package/typedoc/classes/LayoutAction.Close.html +4 -4
- package/typedoc/classes/LayoutAction.Expose.html +4 -4
- package/typedoc/classes/LayoutAction.Open.html +4 -4
- package/typedoc/classes/LayoutAction.RevertWorkspace.html +4 -4
- package/typedoc/classes/LayoutAction.ScrollIntoView.html +4 -4
- package/typedoc/classes/LayoutAction.Set.html +4 -4
- package/typedoc/classes/LayoutAction.SetLayoutMode.html +4 -4
- package/typedoc/classes/LayoutAction.SwitchWorkspace.html +4 -4
- package/typedoc/classes/LayoutAction.UpdateComplementary.html +4 -4
- package/typedoc/classes/LayoutAction.UpdateDialog.html +365 -53
- package/typedoc/classes/LayoutAction.UpdateLayout.html +5 -5
- package/typedoc/classes/LayoutAction.UpdatePopover.html +4 -4
- package/typedoc/classes/LayoutAction.UpdateSidebar.html +4 -4
- package/typedoc/classes/Plugin.html +3 -3
- package/typedoc/classes/PluginContext.html +10 -10
- package/typedoc/classes/PluginManager.html +16 -16
- package/typedoc/classes/PluginModule.html +8 -8
- package/typedoc/classes/SettingsAction.Open.html +4 -4
- package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +4 -4
- package/typedoc/functions/Events.createStateEvent.html +2 -2
- package/typedoc/functions/IntentPlugin.html +1 -1
- package/typedoc/functions/SettingsPlugin.html +1 -1
- package/typedoc/functions/allOf.html +2 -2
- package/typedoc/functions/chain.html +2 -2
- package/typedoc/functions/contributes.html +2 -2
- package/typedoc/functions/createDispatcher.html +2 -2
- package/typedoc/functions/createIntent.html +2 -2
- package/typedoc/functions/createResolver.html +2 -2
- package/typedoc/functions/createSurface.html +2 -2
- package/typedoc/functions/defineCapability.html +2 -2
- package/typedoc/functions/defineEvent.html +2 -2
- package/typedoc/functions/defineModule.html +2 -2
- package/typedoc/functions/definePlugin.html +2 -2
- package/typedoc/functions/eventKey.html +2 -2
- package/typedoc/functions/getEvents.html +2 -2
- package/typedoc/functions/isAllOf.html +2 -2
- package/typedoc/functions/isOneOf.html +2 -2
- package/typedoc/functions/isSurfaceAvailable.html +2 -2
- package/typedoc/functions/lazy.html +2 -2
- package/typedoc/functions/oneOf.html +2 -2
- package/typedoc/functions/{createApp.html → useApp.html} +2 -2
- package/typedoc/functions/useAppGraph.html +1 -1
- package/typedoc/functions/useCapabilities.html +2 -2
- package/typedoc/functions/useCapability.html +2 -2
- package/typedoc/functions/useIntentDispatcher.html +1 -1
- package/typedoc/functions/useIntentResolver.html +1 -1
- package/typedoc/functions/useLayout.html +1 -1
- package/typedoc/functions/usePluginManager.html +2 -2
- package/typedoc/hierarchy.html +1 -1
- package/typedoc/index.html +2 -2
- package/typedoc/interfaces/LayoutAction.Toast.html +2 -2
- package/typedoc/modules/Capabilities.html +1 -1
- package/typedoc/modules/CollaborationActions.html +1 -1
- package/typedoc/modules/Events.html +1 -1
- package/typedoc/modules/IntentAction.html +1 -1
- package/typedoc/modules/LayoutAction.html +2 -2
- package/typedoc/modules/SettingsAction.html +1 -1
- package/typedoc/modules.html +1 -1
- package/typedoc/types/ActivationEvent.html +3 -3
- package/typedoc/types/ActivationEvents.html +2 -2
- package/typedoc/types/AnyCapability.html +1 -1
- package/typedoc/types/AnyIntent.html +1 -1
- package/typedoc/types/AnyIntentChain.html +1 -1
- package/typedoc/types/AnyIntentEffectResult.html +1 -1
- package/typedoc/types/AnyIntentResolver.html +1 -1
- package/typedoc/types/AnyIntentResult.html +1 -1
- package/typedoc/types/Capabilities.FileUploader.html +1 -1
- package/typedoc/types/Capabilities.IntentResolver.html +1 -1
- package/typedoc/types/Capabilities.Layout.html +1 -1
- package/typedoc/types/Capabilities.Metadata.html +1 -1
- package/typedoc/types/Capabilities.ReactContext.html +1 -1
- package/typedoc/types/Capabilities.ReactRoot.html +1 -1
- package/typedoc/types/Capabilities.ReactSurface.html +1 -1
- package/typedoc/types/Capabilities.Settings.html +2 -2
- package/typedoc/types/Capability.html +5 -5
- package/typedoc/types/CreateAppOptions.html +2 -2
- package/typedoc/types/FileInfo.html +1 -1
- package/typedoc/types/Intent.html +6 -6
- package/typedoc/types/IntentChain.html +3 -3
- package/typedoc/types/IntentContext.html +2 -2
- package/typedoc/types/IntentData.html +1 -1
- package/typedoc/types/IntentDispatcher.html +2 -2
- package/typedoc/types/IntentDispatcherResult.html +2 -2
- package/typedoc/types/IntentEffectDefinition.html +2 -2
- package/typedoc/types/IntentEffectResult.html +6 -6
- package/typedoc/types/IntentParams.html +2 -2
- package/typedoc/types/IntentResolver.html +2 -2
- package/typedoc/types/IntentResultData.html +1 -1
- package/typedoc/types/IntentSchema.html +1 -1
- package/typedoc/types/IntentUndo.html +2 -2
- package/typedoc/types/InterfaceDef.html +3 -3
- package/typedoc/types/Label.html +1 -1
- package/typedoc/types/NodeSerializer.html +3 -3
- package/typedoc/types/PluginManagerOptions.html +2 -2
- package/typedoc/types/PluginMeta.html +9 -9
- package/typedoc/types/PromiseIntentDispatcher.html +2 -2
- package/typedoc/types/PromiseIntentUndo.html +2 -2
- package/typedoc/types/Resource.html +1 -1
- package/typedoc/types/ResourceKey.html +1 -1
- package/typedoc/types/ResourceLanguage.html +1 -1
- package/typedoc/types/SerializedNode.html +2 -2
- package/typedoc/types/SurfaceComponent.html +2 -2
- package/typedoc/types/SurfaceDefinition.html +2 -2
- package/typedoc/types/SurfaceProps.html +2 -2
- package/typedoc/variables/Capabilities.AnchorSort.html +1 -0
- package/typedoc/variables/Capabilities.AppGraph.html +1 -1
- package/typedoc/variables/Capabilities.AppGraphBuilder.html +1 -1
- package/typedoc/variables/Capabilities.AppGraphSerializer.html +1 -1
- package/typedoc/variables/Capabilities.ArtifactDefinition.html +1 -1
- package/typedoc/variables/Capabilities.FileUploader.html +1 -1
- package/typedoc/variables/Capabilities.IntentDispatcher.html +1 -1
- package/typedoc/variables/Capabilities.IntentResolver.html +1 -1
- package/typedoc/variables/Capabilities.Layout.html +1 -1
- package/typedoc/variables/Capabilities.Metadata.html +1 -1
- package/typedoc/variables/Capabilities.Null.html +1 -1
- package/typedoc/variables/Capabilities.PluginManager.html +1 -1
- package/typedoc/variables/Capabilities.ReactContext.html +1 -1
- package/typedoc/variables/Capabilities.ReactRoot.html +1 -1
- package/typedoc/variables/Capabilities.ReactSurface.html +1 -1
- package/typedoc/variables/Capabilities.RxRegistry.html +1 -1
- package/typedoc/variables/Capabilities.Settings.html +1 -1
- package/typedoc/variables/Capabilities.SettingsStore.html +1 -1
- package/typedoc/variables/Capabilities.Tools.html +1 -1
- package/typedoc/variables/Capabilities.Translations.html +1 -1
- package/typedoc/variables/Events.AppGraphReady.html +2 -2
- package/typedoc/variables/Events.DispatcherReady.html +2 -2
- package/typedoc/variables/Events.LayoutReady.html +1 -1
- package/typedoc/variables/Events.SettingsReady.html +2 -2
- package/typedoc/variables/Events.SetupAppGraph.html +2 -2
- package/typedoc/variables/Events.SetupArtifactDefinition.html +2 -2
- package/typedoc/variables/Events.SetupIntentResolver.html +2 -2
- package/typedoc/variables/Events.SetupMetadata.html +2 -2
- package/typedoc/variables/Events.SetupReactSurface.html +2 -2
- package/typedoc/variables/Events.SetupSettings.html +2 -2
- package/typedoc/variables/Events.SetupTranslations.html +2 -2
- package/typedoc/variables/Events.Startup.html +2 -2
- package/typedoc/variables/FileInfoSchema.html +1 -1
- package/typedoc/variables/INTENT_ACTION.html +1 -1
- package/typedoc/variables/INTENT_PLUGIN.html +1 -1
- package/typedoc/variables/LAYOUT_ACTION.html +1 -1
- package/typedoc/variables/LAYOUT_PLUGIN.html +1 -1
- package/typedoc/variables/Label.html +1 -1
- package/typedoc/variables/LayoutAction.Toast.html +1 -1
- package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +1 -1
- package/typedoc/variables/PluginManagerProvider.html +2 -2
- package/typedoc/variables/Resource.html +2 -2
- package/typedoc/variables/ResourceKey.html +1 -1
- package/typedoc/variables/ResourceLanguage.html +1 -1
- package/typedoc/variables/SETTINGS_ACTION.html +1 -1
- package/typedoc/variables/SETTINGS_ID.html +1 -1
- package/typedoc/variables/SETTINGS_KEY.html +1 -1
- package/typedoc/variables/SETTINGS_PLUGIN.html +1 -1
- package/typedoc/variables/Surface.html +2 -2
- package/typedoc/variables/defaultFileTypes.html +1 -1
- package/dist/lib/browser/chunk-2KSDY3EZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-K3HOLGVH.mjs.map +0 -7
- package/dist/lib/node/chunk-2EBZ2ICH.cjs.map +0 -7
- package/dist/lib/node/chunk-7J66KH2T.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-BOEJMAVK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ISNBS46Y.mjs.map +0 -7
- /package/dist/lib/browser/{app-graph-builder-6E7NCZ77.mjs.map → app-graph-builder-DYEAGZPS.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-dispatcher-VGUJBPPN.mjs.map → intent-dispatcher-ELZN5EM7.mjs.map} +0 -0
- /package/dist/lib/browser/{intent-resolver-QLFZY5R5.mjs.map → intent-resolver-SGWLINTO.mjs.map} +0 -0
- /package/dist/lib/browser/{store-QGVXOY4T.mjs.map → store-YIU6IPZ2.mjs.map} +0 -0
- /package/dist/lib/node/{app-graph-builder-4IWMG67O.cjs.map → app-graph-builder-GBLISL7L.cjs.map} +0 -0
- /package/dist/lib/node/{intent-resolver-5CG5NIJY.cjs.map → intent-resolver-EPSFTHL6.cjs.map} +0 -0
- /package/dist/lib/node/{store-IF3UR2KA.cjs.map → store-CVVRXUTH.cjs.map} +0 -0
- /package/dist/lib/node-esm/{app-graph-builder-LYCG5CO3.mjs.map → app-graph-builder-LUBDEIT6.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-ZUSNX2OY.mjs.map → intent-dispatcher-A2JCMWRD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-resolver-NGDHUKDD.mjs.map → intent-resolver-5C4O43GK.mjs.map} +0 -0
- /package/dist/lib/node-esm/{store-NCRSE25X.mjs.map → store-HRZXZ2D2.mjs.map} +0 -0
|
@@ -10,6 +10,7 @@ export type WithPluginManagerOptions = CreateAppOptions & {
|
|
|
10
10
|
};
|
|
11
11
|
/**
|
|
12
12
|
* Wraps a story with a plugin manager.
|
|
13
|
+
* NOTE: This builds up and tears down the plugin manager on every render.
|
|
13
14
|
*/
|
|
14
15
|
export declare const withPluginManager: (options?: WithPluginManagerOptions) => Decorator;
|
|
15
16
|
//# sourceMappingURL=withPluginManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPluginManager.d.ts","sourceRoot":"","sources":["../../../../src/testing/withPluginManager.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,
|
|
1
|
+
{"version":3,"file":"withPluginManager.d.ts","sourceRoot":"","sources":["../../../../src/testing/withPluginManager.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAKlD,OAAO,EAAU,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAEvD,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,aAAa,EAElB,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAGjB,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;AAC/C,MAAM,MAAM,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;AACvD,eAAO,MAAM,QAAQ,GAAI,CAAC,EAAE,CAAC,EAAE,iBAAiB,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,SAAS,CAAC,KAAG,CAEnF,CAAC;AA+BF,MAAM,MAAM,wBAAwB,GAAG,gBAAgB,GAAG;IACxD,YAAY,CAAC,EAAE,eAAe,CAAC,aAAa,EAAE,aAAa,EAAE,CAAC,CAAC;IAC/D,UAAU,CAAC,EAAE,CAAC,eAAe,GAAG,MAAM,CAAC,EAAE,CAAC;CAC3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,UAAS,wBAA6B,KAAG,SAmC1E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/app-framework",
|
|
3
|
-
"version": "0.8.2-
|
|
3
|
+
"version": "0.8.2-staging.4d6ad0f",
|
|
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",
|
|
@@ -37,20 +37,22 @@
|
|
|
37
37
|
}
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@preact/signals-core": "^1.
|
|
41
|
-
"@dxos/
|
|
42
|
-
"@dxos/
|
|
43
|
-
"@dxos/
|
|
44
|
-
"@dxos/
|
|
45
|
-
"@dxos/
|
|
46
|
-
"@dxos/
|
|
47
|
-
"@dxos/
|
|
48
|
-
"@dxos/invariant": "0.8.2-
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/live-object": "0.8.2-
|
|
51
|
-
"@dxos/log": "0.8.2-
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/util": "0.8.2-
|
|
40
|
+
"@preact/signals-core": "^1.9.0",
|
|
41
|
+
"@dxos/ai": "0.8.2-staging.4d6ad0f",
|
|
42
|
+
"@dxos/app-graph": "0.8.2-staging.4d6ad0f",
|
|
43
|
+
"@dxos/artifact": "0.8.2-staging.4d6ad0f",
|
|
44
|
+
"@dxos/client-protocol": "0.8.2-staging.4d6ad0f",
|
|
45
|
+
"@dxos/async": "0.8.2-staging.4d6ad0f",
|
|
46
|
+
"@dxos/debug": "0.8.2-staging.4d6ad0f",
|
|
47
|
+
"@dxos/echo-schema": "0.8.2-staging.4d6ad0f",
|
|
48
|
+
"@dxos/invariant": "0.8.2-staging.4d6ad0f",
|
|
49
|
+
"@dxos/keys": "0.8.2-staging.4d6ad0f",
|
|
50
|
+
"@dxos/live-object": "0.8.2-staging.4d6ad0f",
|
|
51
|
+
"@dxos/log": "0.8.2-staging.4d6ad0f",
|
|
52
|
+
"@dxos/schema": "0.8.2-staging.4d6ad0f",
|
|
53
|
+
"@dxos/util": "0.8.2-staging.4d6ad0f",
|
|
54
|
+
"@dxos/react-hooks": "0.8.2-staging.4d6ad0f",
|
|
55
|
+
"@dxos/local-storage": "0.8.2-staging.4d6ad0f"
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
56
58
|
"@effect-rx/rx-react": "^0.34.1",
|
|
@@ -60,11 +62,11 @@
|
|
|
60
62
|
"effect": "3.14.21",
|
|
61
63
|
"react": "~18.2.0",
|
|
62
64
|
"typedoc": "0.28.1",
|
|
63
|
-
"@dxos/echo-signals": "0.8.2-
|
|
64
|
-
"@dxos/random": "0.8.2-
|
|
65
|
-
"@dxos/react-ui": "0.8.2-
|
|
66
|
-
"@dxos/
|
|
67
|
-
"@dxos/
|
|
65
|
+
"@dxos/echo-signals": "0.8.2-staging.4d6ad0f",
|
|
66
|
+
"@dxos/random": "0.8.2-staging.4d6ad0f",
|
|
67
|
+
"@dxos/react-ui": "0.8.2-staging.4d6ad0f",
|
|
68
|
+
"@dxos/storybook-utils": "0.8.2-staging.4d6ad0f",
|
|
69
|
+
"@dxos/react-ui-syntax-highlighter": "0.8.2-staging.4d6ad0f"
|
|
68
70
|
},
|
|
69
71
|
"peerDependencies": {
|
|
70
72
|
"@effect-rx/rx-react": "^0.34.1",
|
package/src/App.tsx
CHANGED
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
|
|
5
5
|
import { RegistryContext } from '@effect-rx/rx-react';
|
|
6
6
|
import { effect } from '@preact/signals-core';
|
|
7
|
-
import React, { useEffect, useState, type FC, type PropsWithChildren } from 'react';
|
|
7
|
+
import React, { useCallback, useEffect, useMemo, useState, type FC, type PropsWithChildren } 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
12
|
|
|
12
13
|
import { Capabilities, Events } from './common';
|
|
13
14
|
import { PluginManager, type PluginManagerOptions, type Plugin } from './core';
|
|
@@ -53,72 +54,109 @@ export type CreateAppOptions = {
|
|
|
53
54
|
* @param params.cacheEnabled Whether to cache enabled plugins in localStorage.
|
|
54
55
|
* @param params.safeMode Whether to enable safe mode, which disables optional plugins.
|
|
55
56
|
*/
|
|
56
|
-
export const
|
|
57
|
+
export const useApp = ({
|
|
57
58
|
pluginManager,
|
|
58
59
|
pluginLoader: _pluginLoader,
|
|
59
|
-
plugins
|
|
60
|
-
core
|
|
61
|
-
defaults
|
|
60
|
+
plugins: _plugins,
|
|
61
|
+
core: _core,
|
|
62
|
+
defaults: _defaults,
|
|
62
63
|
placeholder,
|
|
63
64
|
fallback = DefaultFallback,
|
|
64
65
|
cacheEnabled = false,
|
|
65
66
|
safeMode = false,
|
|
66
67
|
}: CreateAppOptions) => {
|
|
68
|
+
const plugins = useDefaultValue(_plugins, () => []);
|
|
69
|
+
const core = useDefaultValue(_core, () => plugins.map(({ meta }) => meta.id));
|
|
70
|
+
const defaults = useDefaultValue(_defaults, () => []);
|
|
71
|
+
|
|
67
72
|
// TODO(wittjosiah): Provide a custom plugin loader which supports loading via url.
|
|
68
|
-
const pluginLoader =
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
73
|
+
const pluginLoader = useMemo(
|
|
74
|
+
() =>
|
|
75
|
+
_pluginLoader ??
|
|
76
|
+
((id: string) => {
|
|
77
|
+
const plugin = plugins.find((plugin) => plugin.meta.id === id);
|
|
78
|
+
invariant(plugin, `Plugin not found: ${id}`);
|
|
79
|
+
return plugin;
|
|
80
|
+
}),
|
|
81
|
+
[_pluginLoader, plugins],
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
const state = useMemo(() => live({ ready: false, error: null }), []);
|
|
85
|
+
const cached: string[] = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? '[]'), []);
|
|
86
|
+
const enabled = useMemo(
|
|
87
|
+
() => (safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults),
|
|
88
|
+
[safeMode, cacheEnabled, cached, defaults],
|
|
89
|
+
);
|
|
90
|
+
const manager = useMemo(
|
|
91
|
+
() => pluginManager ?? new PluginManager({ pluginLoader, plugins, core, enabled }),
|
|
92
|
+
[pluginManager, pluginLoader, plugins, core, enabled],
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
return manager.activation.on(({ event, state: _state, error }) => {
|
|
97
|
+
// Once the app is ready the first time, don't show the fallback again.
|
|
98
|
+
if (!state.ready && event === Events.Startup.id) {
|
|
99
|
+
state.ready = _state === 'activated';
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (error && !state.ready && !state.error) {
|
|
103
|
+
state.error = error;
|
|
104
|
+
}
|
|
74
105
|
});
|
|
106
|
+
}, [manager, state]);
|
|
75
107
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
effect(() => {
|
|
110
|
+
cacheEnabled && localStorage.setItem(ENABLED_KEY, JSON.stringify(manager.enabled));
|
|
111
|
+
});
|
|
112
|
+
}, [cacheEnabled, manager]);
|
|
80
113
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
manager.context.contributeCapability({
|
|
116
|
+
interface: Capabilities.PluginManager,
|
|
117
|
+
implementation: manager,
|
|
118
|
+
module: 'dxos.org/app-framework/plugin-manager',
|
|
119
|
+
});
|
|
86
120
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
manager.context.contributeCapability({
|
|
122
|
+
interface: Capabilities.RxRegistry,
|
|
123
|
+
implementation: manager.registry,
|
|
124
|
+
module: 'dxos.org/app-framework/rx-registry',
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return () => {
|
|
128
|
+
manager.context.removeCapability(Capabilities.PluginManager, manager);
|
|
129
|
+
manager.context.removeCapability(Capabilities.RxRegistry, manager.registry);
|
|
130
|
+
};
|
|
131
|
+
}, [manager]);
|
|
132
|
+
|
|
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
|
+
return useCallback(
|
|
150
|
+
() => (
|
|
151
|
+
<ErrorBoundary fallback={fallback}>
|
|
152
|
+
<PluginManagerProvider value={manager}>
|
|
153
|
+
<RegistryContext.Provider value={manager.registry}>
|
|
154
|
+
<App placeholder={placeholder} state={state} />
|
|
155
|
+
</RegistryContext.Provider>
|
|
156
|
+
</PluginManagerProvider>
|
|
157
|
+
</ErrorBoundary>
|
|
158
|
+
),
|
|
159
|
+
[fallback, manager, placeholder, state],
|
|
122
160
|
);
|
|
123
161
|
};
|
|
124
162
|
|
|
@@ -6,16 +6,18 @@ import { type Registry } from '@effect-rx/rx-react';
|
|
|
6
6
|
import { type Schema } from 'effect';
|
|
7
7
|
import { type FC, type PropsWithChildren } from 'react';
|
|
8
8
|
|
|
9
|
+
import { type ExecutableTool } from '@dxos/ai';
|
|
9
10
|
import { type GraphBuilder, type BuilderExtensions } from '@dxos/app-graph';
|
|
10
|
-
import { type ArtifactDefinition
|
|
11
|
+
import { type ArtifactDefinition } from '@dxos/artifact';
|
|
11
12
|
import { type Space } from '@dxos/client-protocol';
|
|
12
13
|
import { type RootSettingsStore } from '@dxos/local-storage';
|
|
14
|
+
import { type AnchoredTo } from '@dxos/schema';
|
|
13
15
|
|
|
14
16
|
import { type FileInfo } from './file';
|
|
15
17
|
import { type NodeSerializer } from './graph';
|
|
16
18
|
import { type SurfaceDefinition } from './surface';
|
|
17
19
|
import { type Resource } from './translations';
|
|
18
|
-
import {
|
|
20
|
+
import { type PluginManager, defineCapability } from '../core';
|
|
19
21
|
import { type AnyIntentResolver, type IntentContext } from '../plugin-intent';
|
|
20
22
|
|
|
21
23
|
export namespace Capabilities {
|
|
@@ -94,11 +96,17 @@ export namespace Capabilities {
|
|
|
94
96
|
export type Metadata = Readonly<{ id: string; metadata: Record<string, any> }>;
|
|
95
97
|
export const Metadata = defineCapability<Metadata>('dxos.org/app-framework/capability/metadata');
|
|
96
98
|
|
|
97
|
-
export const Tools = defineCapability<
|
|
99
|
+
export const Tools = defineCapability<ExecutableTool[]>('dxos.org/app-framework/capability/tools');
|
|
98
100
|
export const ArtifactDefinition = defineCapability<ArtifactDefinition>(
|
|
99
101
|
'dxos.org/app-framework/capability/artifact-definition',
|
|
100
102
|
);
|
|
101
103
|
|
|
102
104
|
export type FileUploader = (file: File, space: Space) => Promise<FileInfo | undefined>;
|
|
103
105
|
export const FileUploader = defineCapability<FileUploader>('dxos.org/app-framework/capability/file-uploader');
|
|
106
|
+
|
|
107
|
+
type AnchorSort = {
|
|
108
|
+
key: string;
|
|
109
|
+
sort: (anchorA: AnchoredTo, anchorB: AnchoredTo) => number;
|
|
110
|
+
};
|
|
111
|
+
export const AnchorSort = defineCapability<AnchorSort>('dxos.org/app-framework/capability/anchor-sort');
|
|
104
112
|
}
|
|
@@ -2,22 +2,19 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { Schema
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
6
|
|
|
7
7
|
import { Expando, Ref } from '@dxos/echo-schema';
|
|
8
|
-
// TODO(dmaretskyi): Import from @dxos/echo
|
|
9
|
-
import { SpaceId } from '@dxos/keys';
|
|
10
8
|
|
|
11
9
|
export namespace CollaborationActions {
|
|
12
10
|
export class InsertContent extends Schema.TaggedClass<InsertContent>()('assistant/intent-content', {
|
|
13
11
|
input: Schema.Struct({
|
|
14
|
-
|
|
15
|
-
target: Ref(Expando),
|
|
12
|
+
target: Expando,
|
|
16
13
|
object: Ref(Expando),
|
|
14
|
+
at: Schema.optional(Schema.String),
|
|
17
15
|
label: Schema.String.pipe(Schema.optional),
|
|
18
16
|
}).annotations({
|
|
19
|
-
|
|
20
|
-
'Enables plugins to inject content blocks or references into a related entity.',
|
|
17
|
+
description: 'Enables plugins to inject content blocks or references into a related entity.',
|
|
21
18
|
}),
|
|
22
19
|
output: Schema.Void,
|
|
23
20
|
}) {}
|
package/src/common/layout.ts
CHANGED
|
@@ -97,10 +97,18 @@ export namespace LayoutAction {
|
|
|
97
97
|
),
|
|
98
98
|
options: Schema.Struct({
|
|
99
99
|
state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the dialog is open or closed.' })),
|
|
100
|
+
type: Schema.optional(Schema.Literal('default', 'alert').annotations({ description: 'The type of dialog.' })),
|
|
100
101
|
blockAlign: Schema.optional(
|
|
101
102
|
Schema.Literal('start', 'center', 'end').annotations({ description: 'The alignment of the dialog.' }),
|
|
102
103
|
),
|
|
103
|
-
|
|
104
|
+
overlayClasses: Schema.optional(
|
|
105
|
+
Schema.String.annotations({ description: 'Additional classes for the dialog overlay.' }),
|
|
106
|
+
),
|
|
107
|
+
overlayStyle: Schema.optional(
|
|
108
|
+
Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({
|
|
109
|
+
description: 'Additional styles for the dialog overlay.',
|
|
110
|
+
}),
|
|
111
|
+
),
|
|
104
112
|
props: Schema.optional(
|
|
105
113
|
Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({
|
|
106
114
|
description: 'Additional props for the dialog.',
|
package/src/core/capabilities.ts
CHANGED
|
@@ -150,7 +150,7 @@ export class PluginContext {
|
|
|
150
150
|
module: string;
|
|
151
151
|
interface: InterfaceDef<T>;
|
|
152
152
|
implementation: T;
|
|
153
|
-
}) {
|
|
153
|
+
}): void {
|
|
154
154
|
const current = this._registry.get(this._capabilityImpls(interfaceDef.identifier));
|
|
155
155
|
const capability = new CapabilityImpl(moduleId, implementation);
|
|
156
156
|
if (current.includes(capability)) {
|
|
@@ -168,7 +168,7 @@ export class PluginContext {
|
|
|
168
168
|
/**
|
|
169
169
|
* @internal
|
|
170
170
|
*/
|
|
171
|
-
removeCapability<T>(interfaceDef: InterfaceDef<T>, implementation: T) {
|
|
171
|
+
removeCapability<T>(interfaceDef: InterfaceDef<T>, implementation: T): void {
|
|
172
172
|
const current = this._registry.get(this._capabilityImpls(interfaceDef.identifier));
|
|
173
173
|
if (current.length === 0) {
|
|
174
174
|
return;
|
package/src/core/manager.ts
CHANGED
|
@@ -265,7 +265,7 @@ export class PluginManager {
|
|
|
265
265
|
return untracked(() => Effect.runPromise(this._reset(event)));
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
private _addPlugin(plugin: Plugin) {
|
|
268
|
+
private _addPlugin(plugin: Plugin): void {
|
|
269
269
|
untracked(() => {
|
|
270
270
|
log('add plugin', { id: plugin.meta.id });
|
|
271
271
|
if (!this._state.plugins.includes(plugin)) {
|
|
@@ -274,7 +274,7 @@ export class PluginManager {
|
|
|
274
274
|
});
|
|
275
275
|
}
|
|
276
276
|
|
|
277
|
-
private _removePlugin(id: string) {
|
|
277
|
+
private _removePlugin(id: string): void {
|
|
278
278
|
untracked(() => {
|
|
279
279
|
log('remove plugin', { id });
|
|
280
280
|
const pluginIndex = this._state.plugins.findIndex((plugin) => plugin.meta.id === id);
|
|
@@ -284,7 +284,7 @@ export class PluginManager {
|
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
private _addModule(module: PluginModule) {
|
|
287
|
+
private _addModule(module: PluginModule): void {
|
|
288
288
|
untracked(() => {
|
|
289
289
|
log('add module', { id: module.id });
|
|
290
290
|
if (!this._state.modules.includes(module)) {
|
|
@@ -293,7 +293,7 @@ export class PluginManager {
|
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
private _removeModule(id: string) {
|
|
296
|
+
private _removeModule(id: string): void {
|
|
297
297
|
untracked(() => {
|
|
298
298
|
log('remove module', { id });
|
|
299
299
|
const moduleIndex = this._state.modules.findIndex((module) => module.id === id);
|
|
@@ -303,27 +303,27 @@ export class PluginManager {
|
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
305
|
|
|
306
|
-
private _getPlugin(id: string) {
|
|
306
|
+
private _getPlugin(id: string): Plugin | undefined {
|
|
307
307
|
return this._state.plugins.find((plugin) => plugin.meta.id === id);
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
private _getActiveModules() {
|
|
310
|
+
private _getActiveModules(): PluginModule[] {
|
|
311
311
|
return this._state.modules.filter((module) => this._state.active.includes(module.id));
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
private _getInactiveModules() {
|
|
314
|
+
private _getInactiveModules(): PluginModule[] {
|
|
315
315
|
return this._state.modules.filter((module) => !this._state.active.includes(module.id));
|
|
316
316
|
}
|
|
317
317
|
|
|
318
|
-
private _getActiveModulesByEvent(key: string) {
|
|
318
|
+
private _getActiveModulesByEvent(key: string): PluginModule[] {
|
|
319
319
|
return this._getActiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
private _getInactiveModulesByEvent(key: string) {
|
|
322
|
+
private _getInactiveModulesByEvent(key: string): PluginModule[] {
|
|
323
323
|
return this._getInactiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));
|
|
324
324
|
}
|
|
325
325
|
|
|
326
|
-
private _setPendingResetByModule(module: PluginModule) {
|
|
326
|
+
private _setPendingResetByModule(module: PluginModule): void {
|
|
327
327
|
return untracked(() => {
|
|
328
328
|
const activationEvents = getEvents(module.activatesOn)
|
|
329
329
|
.map(eventKey)
|
|
@@ -12,7 +12,7 @@ import { DebugPlugin } from './debug';
|
|
|
12
12
|
import { createNumberPlugin, GeneratorPlugin } from './generator';
|
|
13
13
|
import { LayoutPlugin } from './layout';
|
|
14
14
|
import { LoggerPlugin } from './logger';
|
|
15
|
-
import {
|
|
15
|
+
import { useApp } from '../App';
|
|
16
16
|
import { IntentPlugin } from '../plugin-intent';
|
|
17
17
|
|
|
18
18
|
const plugins = [IntentPlugin(), LayoutPlugin(), DebugPlugin(), LoggerPlugin(), GeneratorPlugin()];
|
|
@@ -21,13 +21,17 @@ const Placeholder = () => {
|
|
|
21
21
|
return <div>Loading...</div>;
|
|
22
22
|
};
|
|
23
23
|
|
|
24
|
-
const Story =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
const Story = () => {
|
|
25
|
+
const App = useApp({
|
|
26
|
+
pluginLoader: (id) => createNumberPlugin(id),
|
|
27
|
+
plugins,
|
|
28
|
+
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
|
+
placeholder: Placeholder,
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
return <App />;
|
|
34
|
+
};
|
|
31
35
|
|
|
32
36
|
export const Playground = {};
|
|
33
37
|
|
|
@@ -21,7 +21,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
|
|
21
21
|
this.state = { error: undefined };
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
static getDerivedStateFromError(error: Error) {
|
|
24
|
+
static getDerivedStateFromError(error: Error): { error: Error } {
|
|
25
25
|
return { error };
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -31,7 +31,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
override render() {
|
|
34
|
+
override render(): string | number | boolean | React.JSX.Element | Iterable<React.ReactNode> | null | undefined {
|
|
35
35
|
if (this.state.error) {
|
|
36
36
|
return <this.props.fallback data={this.props.data} error={this.state.error} reset={this.resetError} />;
|
|
37
37
|
}
|
|
@@ -39,7 +39,7 @@ export class ErrorBoundary extends Component<Props, State> {
|
|
|
39
39
|
return this.props.children;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
private resetError() {
|
|
42
|
+
private resetError(): void {
|
|
43
43
|
this.setState({ error: undefined });
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Decorator } from '@storybook/react';
|
|
6
|
-
import React, { useEffect } from 'react';
|
|
6
|
+
import React, { useEffect, useMemo } from 'react';
|
|
7
7
|
|
|
8
8
|
import { raise } from '@dxos/debug';
|
|
9
9
|
|
|
10
|
-
import {
|
|
10
|
+
import { useApp, type CreateAppOptions } from '../App';
|
|
11
11
|
import { Capabilities, Events } from '../common';
|
|
12
12
|
import {
|
|
13
|
-
type ActivationEvent,
|
|
14
|
-
type AnyCapability,
|
|
15
13
|
contributes,
|
|
16
14
|
defineModule,
|
|
17
15
|
definePlugin,
|
|
16
|
+
type ActivationEvent,
|
|
17
|
+
type AnyCapability,
|
|
18
18
|
PluginManager,
|
|
19
19
|
type PluginContext,
|
|
20
20
|
} from '../core';
|
|
@@ -62,16 +62,13 @@ export type WithPluginManagerOptions = CreateAppOptions & {
|
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
64
|
* Wraps a story with a plugin manager.
|
|
65
|
+
* NOTE: This builds up and tears down the plugin manager on every render.
|
|
65
66
|
*/
|
|
66
67
|
export const withPluginManager = (options: WithPluginManagerOptions = {}): Decorator => {
|
|
67
|
-
const pluginManager = setupPluginManager(options);
|
|
68
|
-
const App = createApp({ pluginManager });
|
|
69
|
-
|
|
70
|
-
options.fireEvents?.forEach((event) => {
|
|
71
|
-
void pluginManager.activate(event);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
68
|
return (Story, context) => {
|
|
69
|
+
const pluginManager = useMemo(() => setupPluginManager(options), [options]);
|
|
70
|
+
|
|
71
|
+
// Set-up root capability.
|
|
75
72
|
useEffect(() => {
|
|
76
73
|
const capability = contributes(Capabilities.ReactRoot, {
|
|
77
74
|
id: context.id,
|
|
@@ -83,8 +80,22 @@ export const withPluginManager = (options: WithPluginManagerOptions = {}): Decor
|
|
|
83
80
|
module: 'dxos.org/app-framework/withPluginManager',
|
|
84
81
|
});
|
|
85
82
|
|
|
86
|
-
return () =>
|
|
87
|
-
|
|
83
|
+
return () => {
|
|
84
|
+
pluginManager.context.removeCapability(capability.interface, capability.implementation);
|
|
85
|
+
};
|
|
86
|
+
}, [pluginManager, context]);
|
|
87
|
+
|
|
88
|
+
// Fire events.
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
const timeout = setTimeout(async () => {
|
|
91
|
+
await Promise.all(options.fireEvents?.map((event) => pluginManager.activate(event)) ?? []);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return () => clearTimeout(timeout);
|
|
95
|
+
}, [pluginManager]);
|
|
96
|
+
|
|
97
|
+
// Create app.
|
|
98
|
+
const App = useApp({ pluginManager });
|
|
88
99
|
|
|
89
100
|
return <App />;
|
|
90
101
|
};
|
package/tsconfig.json
CHANGED
|
@@ -7,62 +7,7 @@
|
|
|
7
7
|
"include": [
|
|
8
8
|
"src"
|
|
9
9
|
],
|
|
10
|
-
"references": [
|
|
11
|
-
{
|
|
12
|
-
"path": "../../common/async"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
"path": "../../common/debug"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"path": "../../common/invariant"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
"path": "../../common/keys"
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
"path": "../../common/local-storage"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"path": "../../common/log"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"path": "../../common/random"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
"path": "../../common/storybook-utils"
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
"path": "../../common/util"
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
"path": "../../core/echo/echo-schema"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"path": "../../core/echo/echo-signals"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"path": "../../core/echo/live-object"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
"path": "../../experimental/artifact"
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
"path": "../../ui/primitives/react-hooks"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"path": "../../ui/react-ui"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"path": "../../ui/react-ui-syntax-highlighter"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"path": "../app-graph"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"path": "../client-protocol"
|
|
64
|
-
}
|
|
65
|
-
],
|
|
10
|
+
"references": [],
|
|
66
11
|
"ts-node": {
|
|
67
12
|
"compilerOptions": {
|
|
68
13
|
"module": "CommonJS"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
window.navigationData = "eJylmmFv2zYQhv+LPwfbmrTdlm+
|
|
1
|
+
window.navigationData = "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"
|