@dxos/app-framework 0.8.4-main.f9ba587 → 0.8.4-main.fffef41
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-OIEZZC45.mjs} +32 -31
- package/dist/lib/browser/app-graph-builder-OIEZZC45.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DHZB7HG7.mjs → chunk-6XKO24JP.mjs} +254 -184
- package/dist/lib/browser/chunk-6XKO24JP.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/{chunk-2636QSIK.mjs → chunk-WPW5VVAX.mjs} +399 -266
- package/dist/lib/browser/chunk-WPW5VVAX.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +20 -56
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs → intent-dispatcher-LZ4AE66E.mjs} +2 -2
- package/dist/lib/browser/{intent-resolver-O67UANYP.mjs → intent-resolver-QVCKRX6G.mjs} +7 -7
- package/dist/lib/browser/intent-resolver-QVCKRX6G.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react/index.mjs +34 -0
- package/dist/lib/browser/{store-LFKDWHUQ.mjs → store-CNPHOYTJ.mjs} +5 -5
- package/dist/lib/browser/store-CNPHOYTJ.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +17 -21
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{app-graph-builder-QHIJUYYW.mjs → app-graph-builder-EBU4NVWD.mjs} +32 -31
- package/dist/lib/node-esm/app-graph-builder-EBU4NVWD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NJAFK626.mjs → chunk-3UPX5OIS.mjs} +254 -184
- package/dist/lib/node-esm/chunk-3UPX5OIS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VSKRV3NW.mjs → chunk-XJZGUJ3H.mjs} +399 -266
- package/dist/lib/node-esm/chunk-XJZGUJ3H.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 -56
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs → intent-dispatcher-MGOJ3CHD.mjs} +2 -2
- package/dist/lib/node-esm/{intent-resolver-K3D4BXQQ.mjs → intent-resolver-URF3HN3G.mjs} +7 -7
- package/dist/lib/node-esm/intent-resolver-URF3HN3G.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react/index.mjs +35 -0
- package/dist/lib/node-esm/{store-53XDUBMD.mjs → store-RK5B4XEL.mjs} +5 -5
- package/dist/lib/node-esm/store-RK5B4XEL.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +17 -21
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/types/src/common/capabilities.d.ts +111 -38
- 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 +19 -16
- 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/core/capabilities.d.ts +19 -16
- package/dist/types/src/core/capabilities.d.ts.map +1 -1
- package/dist/types/src/core/manager.d.ts +7 -3
- 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 +0 -2
- 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/Main.d.ts.map +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/App.d.ts +10 -0
- package/dist/types/src/react/App.d.ts.map +1 -0
- package/dist/types/src/react/App.stories.d.ts +14 -0
- package/dist/types/src/react/App.stories.d.ts.map +1 -0
- package/dist/types/src/react/DefaultFallback.d.ts +8 -0
- package/dist/types/src/react/DefaultFallback.d.ts.map +1 -0
- 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 +5 -5
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +8 -10
- 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/index.d.ts +2 -0
- package/dist/types/src/react/index.d.ts.map +1 -1
- package/dist/types/src/react/types.d.ts +14 -0
- package/dist/types/src/react/types.d.ts.map +1 -0
- package/dist/types/src/{App.d.ts → react/useApp.d.ts} +7 -6
- package/dist/types/src/react/useApp.d.ts.map +1 -0
- package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/react/useLoading.d.ts +19 -0
- package/dist/types/src/react/useLoading.d.ts.map +1 -0
- 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 +5 -1
- package/package.json +46 -38
- package/src/common/capabilities.ts +120 -19
- 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 +23 -21
- package/src/common/translations.ts +1 -1
- package/src/core/capabilities.test.ts +3 -3
- package/src/core/capabilities.ts +36 -27
- package/src/core/manager.test.ts +22 -21
- package/src/core/manager.ts +141 -56
- package/src/core/plugin.ts +13 -2
- package/src/helpers.test.ts +1 -1
- package/src/index.ts +0 -2
- package/src/playground/debug/Debug.tsx +1 -1
- package/src/playground/debug/plugin.ts +7 -8
- package/src/playground/generator/Main.tsx +0 -1
- 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 +21 -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 +25 -22
- package/src/plugin-settings/intent-resolver.ts +5 -4
- package/src/plugin-settings/meta.ts +10 -0
- package/src/plugin-settings/store.ts +3 -3
- package/src/plugin-settings/translations.ts +4 -4
- package/src/react/App.stories.tsx +33 -0
- package/src/react/App.tsx +59 -0
- package/src/react/DefaultFallback.tsx +26 -0
- package/src/react/ErrorBoundary.tsx +26 -15
- package/src/react/IntentContext.tsx +3 -2
- package/src/react/Surface.stories.tsx +81 -52
- package/src/react/Surface.tsx +70 -38
- package/src/react/common.ts +2 -1
- package/src/react/index.ts +4 -0
- package/src/react/types.ts +38 -0
- package/src/react/useApp.tsx +165 -0
- package/src/react/useCapabilities.ts +4 -3
- package/src/react/useLoading.tsx +70 -0
- package/src/testing/withPluginManager.stories.tsx +9 -5
- package/src/testing/withPluginManager.tsx +33 -32
- package/tsconfig.json +15 -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/browser/store-LFKDWHUQ.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -79
- 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/lib/node-esm/store-53XDUBMD.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -80
- package/dist/types/src/App.d.ts.map +0 -1
- package/dist/types/src/worker.d.ts +0 -4
- package/dist/types/src/worker.d.ts.map +0 -1
- package/src/App.tsx +0 -276
- package/src/worker.ts +0 -11
- 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-LZ4AE66E.mjs.map} +0 -0
- /package/dist/lib/browser/{worker.mjs.map → react/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{intent-dispatcher-5PRM3KGH.mjs.map → intent-dispatcher-MGOJ3CHD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{worker.mjs.map → react/index.mjs.map} +0 -0
|
@@ -3,7 +3,11 @@ import {
|
|
|
3
3
|
Capabilities,
|
|
4
4
|
Events,
|
|
5
5
|
PluginManager
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XJZGUJ3H.mjs";
|
|
7
|
+
|
|
8
|
+
// src/react/useCapabilities.ts
|
|
9
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
10
|
+
import { invariant } from "@dxos/invariant";
|
|
7
11
|
|
|
8
12
|
// src/react/PluginManagerProvider.ts
|
|
9
13
|
import { createContext, useContext } from "react";
|
|
@@ -13,18 +17,16 @@ var usePluginManager = () => useContext(PluginManagerContext) ?? raise(new Error
|
|
|
13
17
|
var PluginManagerProvider = PluginManagerContext.Provider;
|
|
14
18
|
|
|
15
19
|
// src/react/useCapabilities.ts
|
|
16
|
-
import { useRxValue } from "@effect-rx/rx-react";
|
|
17
|
-
import { invariant } from "@dxos/invariant";
|
|
18
20
|
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/react/useCapabilities.ts";
|
|
19
21
|
var useCapabilities = (interfaceDef) => {
|
|
20
22
|
const manager = usePluginManager();
|
|
21
|
-
return
|
|
23
|
+
return useAtomValue(manager.context.capabilities(interfaceDef));
|
|
22
24
|
};
|
|
23
25
|
var useCapability = (interfaceDef) => {
|
|
24
26
|
const capabilities = useCapabilities(interfaceDef);
|
|
25
27
|
invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, {
|
|
26
28
|
F: __dxlog_file,
|
|
27
|
-
L:
|
|
29
|
+
L: 29,
|
|
28
30
|
S: void 0,
|
|
29
31
|
A: [
|
|
30
32
|
"capabilities.length > 0",
|
|
@@ -39,20 +41,22 @@ var useIntentDispatcher = () => useCapability(Capabilities.IntentDispatcher);
|
|
|
39
41
|
var useAppGraph = () => useCapability(Capabilities.AppGraph);
|
|
40
42
|
var useLayout = () => useCapability(Capabilities.Layout);
|
|
41
43
|
|
|
44
|
+
// src/react/types.ts
|
|
45
|
+
import * as Schema from "effect/Schema";
|
|
46
|
+
var SurfaceCardRole = Schema.Literal("card", "card--popover", "card--intrinsic", "card--extrinsic", "card--transclusion");
|
|
47
|
+
|
|
42
48
|
// src/react/ErrorBoundary.tsx
|
|
49
|
+
import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
|
|
43
50
|
import React, { Component } from "react";
|
|
44
51
|
var ErrorBoundary = class extends Component {
|
|
45
|
-
constructor(props) {
|
|
46
|
-
super(props);
|
|
47
|
-
this.state = {
|
|
48
|
-
error: void 0
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
52
|
static getDerivedStateFromError(error) {
|
|
52
53
|
return {
|
|
53
54
|
error
|
|
54
55
|
};
|
|
55
56
|
}
|
|
57
|
+
state = {
|
|
58
|
+
error: void 0
|
|
59
|
+
};
|
|
56
60
|
componentDidUpdate(prevProps) {
|
|
57
61
|
if (prevProps.data !== this.props.data) {
|
|
58
62
|
this.resetError();
|
|
@@ -60,10 +64,10 @@ var ErrorBoundary = class extends Component {
|
|
|
60
64
|
}
|
|
61
65
|
render() {
|
|
62
66
|
if (this.state.error) {
|
|
63
|
-
|
|
67
|
+
const Fallback = this.props.fallback ?? DefaultFallback;
|
|
68
|
+
return /* @__PURE__ */ React.createElement(Fallback, {
|
|
64
69
|
data: this.props.data,
|
|
65
|
-
error: this.state.error
|
|
66
|
-
reset: this.resetError
|
|
70
|
+
error: this.state.error
|
|
67
71
|
});
|
|
68
72
|
}
|
|
69
73
|
return this.props.children;
|
|
@@ -74,41 +78,38 @@ var ErrorBoundary = class extends Component {
|
|
|
74
78
|
});
|
|
75
79
|
}
|
|
76
80
|
};
|
|
81
|
+
var DefaultFallback = ({ data, error }) => {
|
|
82
|
+
var _effect = _useSignals();
|
|
83
|
+
try {
|
|
84
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
85
|
+
className: "flex flex-col gap-2 overflow-hidden border border-red-500 rounded-sm"
|
|
86
|
+
}, /* @__PURE__ */ React.createElement("h1", {
|
|
87
|
+
className: "p-2"
|
|
88
|
+
}, "ERROR: ", error.message), /* @__PURE__ */ React.createElement("pre", {
|
|
89
|
+
className: "p-2 overflow-y-auto text-sm text-subdued"
|
|
90
|
+
}, JSON.stringify(data, null, 2)));
|
|
91
|
+
} finally {
|
|
92
|
+
_effect.f();
|
|
93
|
+
}
|
|
94
|
+
};
|
|
77
95
|
|
|
78
96
|
// src/react/Surface.tsx
|
|
79
|
-
import { useSignals as
|
|
80
|
-
import React2, {
|
|
97
|
+
import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
|
|
98
|
+
import React2, { Fragment, Suspense, forwardRef, memo, useMemo } from "react";
|
|
81
99
|
import { useDefaultValue } from "@dxos/react-hooks";
|
|
82
100
|
import { byPosition } from "@dxos/util";
|
|
83
101
|
var DEFAULT_PLACEHOLDER = /* @__PURE__ */ React2.createElement(Fragment, null);
|
|
84
|
-
var
|
|
85
|
-
|
|
86
|
-
return useMemo(() => surfaces.flat(), [
|
|
87
|
-
surfaces
|
|
88
|
-
]);
|
|
89
|
-
};
|
|
90
|
-
var findCandidates = (surfaces, { role, data }) => {
|
|
91
|
-
return Object.values(surfaces).filter((definition) => Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role).filter(({ filter }) => filter ? filter(data ?? {}) : true).toSorted(byPosition);
|
|
92
|
-
};
|
|
93
|
-
var isSurfaceAvailable = (context, { role, data }) => {
|
|
94
|
-
const surfaces = context.getCapabilities(Capabilities.ReactSurface);
|
|
95
|
-
const candidates = findCandidates(surfaces.flat(), {
|
|
96
|
-
role,
|
|
97
|
-
data
|
|
98
|
-
});
|
|
99
|
-
return candidates.length > 0;
|
|
100
|
-
};
|
|
101
|
-
var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role, data: _data, limit, fallback, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
|
|
102
|
-
var _effect = _useSignals();
|
|
102
|
+
var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role, data: dataParam, limit, fallback = DefaultFallback2, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
|
|
103
|
+
var _effect = _useSignals2();
|
|
103
104
|
try {
|
|
104
105
|
const surfaces = useSurfaces();
|
|
105
|
-
const data = useDefaultValue(
|
|
106
|
+
const data = useDefaultValue(dataParam, () => ({}));
|
|
106
107
|
const definitions = findCandidates(surfaces, {
|
|
107
108
|
role,
|
|
108
109
|
data
|
|
109
110
|
});
|
|
110
111
|
const candidates = limit ? definitions.slice(0, limit) : definitions;
|
|
111
|
-
const nodes = candidates.map(({ component: Component2
|
|
112
|
+
const nodes = candidates.map(({ id, component: Component2 }) => /* @__PURE__ */ React2.createElement(Component2, {
|
|
112
113
|
ref: forwardedRef,
|
|
113
114
|
key: id,
|
|
114
115
|
id,
|
|
@@ -120,41 +121,69 @@ var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role,
|
|
|
120
121
|
const suspense = /* @__PURE__ */ React2.createElement(Suspense, {
|
|
121
122
|
fallback: placeholder
|
|
122
123
|
}, nodes);
|
|
123
|
-
return
|
|
124
|
+
return /* @__PURE__ */ React2.createElement(ErrorBoundary, {
|
|
124
125
|
data,
|
|
125
126
|
fallback
|
|
126
|
-
}, suspense)
|
|
127
|
+
}, suspense);
|
|
127
128
|
} finally {
|
|
128
129
|
_effect.f();
|
|
129
130
|
}
|
|
130
131
|
}));
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
143
|
-
return
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
132
|
+
var DefaultFallback2 = ({ data, error, dev }) => {
|
|
133
|
+
var _effect = _useSignals2();
|
|
134
|
+
try {
|
|
135
|
+
if (dev) {
|
|
136
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
137
|
+
className: "flex flex-col gap-4 p-4 is-full overflow-y-auto"
|
|
138
|
+
}, /* @__PURE__ */ React2.createElement("h1", {
|
|
139
|
+
className: "flex gap-2 text-sm mbs-2"
|
|
140
|
+
}, error.message), /* @__PURE__ */ React2.createElement("pre", {
|
|
141
|
+
className: "overflow-auto text-xs text-description"
|
|
142
|
+
}, JSON.stringify(data, null, 2)));
|
|
143
|
+
}
|
|
144
|
+
return /* @__PURE__ */ React2.createElement("div", {
|
|
145
|
+
className: "flex flex-col gap-4 p-4 is-full overflow-y-auto border border-roseFill"
|
|
146
|
+
}, /* @__PURE__ */ React2.createElement("h1", {
|
|
147
|
+
className: "flex gap-2 text-sm mbs-2 text-rose-500"
|
|
148
|
+
}, error.message), /* @__PURE__ */ React2.createElement("pre", {
|
|
149
|
+
className: "overflow-auto text-xs text-description"
|
|
150
|
+
}, error.stack), /* @__PURE__ */ React2.createElement("pre", {
|
|
151
|
+
className: "overflow-auto text-xs text-description"
|
|
152
|
+
}, JSON.stringify(data, null, 2)));
|
|
153
|
+
} finally {
|
|
154
|
+
_effect.f();
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var useSurfaces = () => {
|
|
158
|
+
const surfaces = useCapabilities(Capabilities.ReactSurface);
|
|
159
|
+
return useMemo(() => surfaces.flat(), [
|
|
160
|
+
surfaces
|
|
147
161
|
]);
|
|
148
162
|
};
|
|
163
|
+
var isSurfaceAvailable = (context, { role, data }) => {
|
|
164
|
+
const surfaces = context.getCapabilities(Capabilities.ReactSurface);
|
|
165
|
+
const candidates = findCandidates(surfaces.flat(), {
|
|
166
|
+
role,
|
|
167
|
+
data
|
|
168
|
+
});
|
|
169
|
+
return candidates.length > 0;
|
|
170
|
+
};
|
|
171
|
+
var findCandidates = (surfaces, { role, data }) => {
|
|
172
|
+
return Object.values(surfaces).filter((definition) => Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role).filter(({ filter }) => filter ? filter(data ?? {}) : true).toSorted(byPosition);
|
|
173
|
+
};
|
|
174
|
+
Surface.displayName = "Surface";
|
|
149
175
|
|
|
150
|
-
// src/
|
|
151
|
-
import {
|
|
152
|
-
import { RegistryContext } from "@effect-rx/rx-react";
|
|
176
|
+
// src/react/useApp.tsx
|
|
177
|
+
import { RegistryContext } from "@effect-atom/atom-react";
|
|
153
178
|
import { effect } from "@preact/signals-core";
|
|
154
|
-
import
|
|
179
|
+
import React5, { useCallback, useEffect as useEffect2, useMemo as useMemo2 } from "react";
|
|
155
180
|
import { invariant as invariant2 } from "@dxos/invariant";
|
|
156
181
|
import { live } from "@dxos/live-object";
|
|
157
|
-
import { useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
|
|
182
|
+
import { useAsyncEffect, useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
|
|
183
|
+
|
|
184
|
+
// src/react/App.tsx
|
|
185
|
+
import { useSignals as _useSignals3 } from "@preact-signals/safe-react/tracking";
|
|
186
|
+
import React3 from "react";
|
|
158
187
|
|
|
159
188
|
// src/helpers.ts
|
|
160
189
|
var topologicalSort = (nodes) => {
|
|
@@ -187,18 +216,133 @@ var topologicalSort = (nodes) => {
|
|
|
187
216
|
return allDependencies.map((id) => nodes.find((node) => node.id === id)).filter((node) => node !== void 0);
|
|
188
217
|
};
|
|
189
218
|
|
|
190
|
-
// src/
|
|
191
|
-
|
|
219
|
+
// src/react/useLoading.tsx
|
|
220
|
+
import { useEffect, useState } from "react";
|
|
221
|
+
var LoadingState = /* @__PURE__ */ (function(LoadingState2) {
|
|
222
|
+
LoadingState2[LoadingState2["Loading"] = 0] = "Loading";
|
|
223
|
+
LoadingState2[LoadingState2["FadeIn"] = 1] = "FadeIn";
|
|
224
|
+
LoadingState2[LoadingState2["FadeOut"] = 2] = "FadeOut";
|
|
225
|
+
LoadingState2[LoadingState2["Done"] = 3] = "Done";
|
|
226
|
+
return LoadingState2;
|
|
227
|
+
})({});
|
|
228
|
+
var useLoading = (state, debounce = 0) => {
|
|
229
|
+
const [stage, setStage] = useState(0);
|
|
230
|
+
useEffect(() => {
|
|
231
|
+
if (!debounce) {
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const i = setInterval(() => {
|
|
235
|
+
setStage((stage2) => {
|
|
236
|
+
switch (stage2) {
|
|
237
|
+
case 0: {
|
|
238
|
+
if (!state.ready) {
|
|
239
|
+
return 1;
|
|
240
|
+
} else {
|
|
241
|
+
clearInterval(i);
|
|
242
|
+
return 3;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
case 1: {
|
|
246
|
+
if (state.ready) {
|
|
247
|
+
return 2;
|
|
248
|
+
}
|
|
249
|
+
break;
|
|
250
|
+
}
|
|
251
|
+
case 2: {
|
|
252
|
+
clearInterval(i);
|
|
253
|
+
return 3;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return stage2;
|
|
257
|
+
});
|
|
258
|
+
}, debounce);
|
|
259
|
+
return () => clearInterval(i);
|
|
260
|
+
}, [
|
|
261
|
+
debounce
|
|
262
|
+
]);
|
|
263
|
+
if (!debounce) {
|
|
264
|
+
return state.ready ? 3 : 0;
|
|
265
|
+
}
|
|
266
|
+
return stage;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// src/react/App.tsx
|
|
270
|
+
var App = ({ placeholder: Placeholder, state, debounce }) => {
|
|
271
|
+
var _effect = _useSignals3();
|
|
272
|
+
try {
|
|
273
|
+
const reactContexts = useCapabilities(Capabilities.ReactContext);
|
|
274
|
+
const reactRoots = useCapabilities(Capabilities.ReactRoot);
|
|
275
|
+
const stage = useLoading(state, debounce);
|
|
276
|
+
if (state.error) {
|
|
277
|
+
throw state.error;
|
|
278
|
+
}
|
|
279
|
+
if (stage < LoadingState.Done) {
|
|
280
|
+
if (!Placeholder) {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
return /* @__PURE__ */ React3.createElement(Placeholder, {
|
|
284
|
+
stage
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
const ComposedContext = composeContexts(reactContexts);
|
|
288
|
+
return /* @__PURE__ */ React3.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ React3.createElement(Component2, {
|
|
289
|
+
key: id
|
|
290
|
+
})));
|
|
291
|
+
} finally {
|
|
292
|
+
_effect.f();
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
var composeContexts = (contexts) => {
|
|
296
|
+
if (contexts.length === 0) {
|
|
297
|
+
return ({ children }) => /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
|
|
298
|
+
}
|
|
299
|
+
return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React3.createElement(Acc, null, /* @__PURE__ */ React3.createElement(Next, null, children)));
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
// src/react/DefaultFallback.tsx
|
|
303
|
+
import { useSignals as _useSignals4 } from "@preact-signals/safe-react/tracking";
|
|
304
|
+
import React4 from "react";
|
|
305
|
+
var DefaultFallback3 = ({ error }) => {
|
|
306
|
+
var _effect = _useSignals4();
|
|
307
|
+
try {
|
|
308
|
+
return /* @__PURE__ */ React4.createElement("div", {
|
|
309
|
+
style: {
|
|
310
|
+
margin: "1rem",
|
|
311
|
+
padding: "1rem",
|
|
312
|
+
overflow: "hidden",
|
|
313
|
+
border: "4px solid teal",
|
|
314
|
+
borderRadius: "1rem"
|
|
315
|
+
}
|
|
316
|
+
}, /* @__PURE__ */ React4.createElement("h1", {
|
|
317
|
+
style: {
|
|
318
|
+
margin: "0.5rem 0",
|
|
319
|
+
fontSize: "1.2rem"
|
|
320
|
+
}
|
|
321
|
+
}, "ERROR: ", error.message), /* @__PURE__ */ React4.createElement("pre", {
|
|
322
|
+
style: {
|
|
323
|
+
overflow: "auto",
|
|
324
|
+
fontSize: "1rem",
|
|
325
|
+
whiteSpace: "pre-wrap",
|
|
326
|
+
color: "#888888"
|
|
327
|
+
}
|
|
328
|
+
}, error.stack));
|
|
329
|
+
} finally {
|
|
330
|
+
_effect.f();
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
// src/react/useApp.tsx
|
|
335
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/react/useApp.tsx";
|
|
192
336
|
var ENABLED_KEY = "dxos.org/app-framework/enabled";
|
|
193
|
-
var useApp = ({ pluginManager, pluginLoader:
|
|
194
|
-
const plugins = useDefaultValue2(
|
|
195
|
-
const core = useDefaultValue2(
|
|
196
|
-
const defaults = useDefaultValue2(
|
|
197
|
-
const pluginLoader = useMemo2(() =>
|
|
337
|
+
var useApp = ({ pluginManager, pluginLoader: pluginLoaderParam, plugins: pluginsParam, core: coreParam, defaults: defaultsParam, placeholder, fallback = DefaultFallback3, cacheEnabled = false, safeMode = false, debounce = 0 }) => {
|
|
338
|
+
const plugins = useDefaultValue2(pluginsParam, () => []);
|
|
339
|
+
const core = useDefaultValue2(coreParam, () => plugins.map(({ meta }) => meta.id));
|
|
340
|
+
const defaults = useDefaultValue2(defaultsParam, () => []);
|
|
341
|
+
const pluginLoader = useMemo2(() => pluginLoaderParam ?? ((id) => {
|
|
198
342
|
const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
|
|
199
343
|
invariant2(plugin, `Plugin not found: ${id}`, {
|
|
200
344
|
F: __dxlog_file2,
|
|
201
|
-
L:
|
|
345
|
+
L: 83,
|
|
202
346
|
S: void 0,
|
|
203
347
|
A: [
|
|
204
348
|
"plugin",
|
|
@@ -207,7 +351,7 @@ var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, c
|
|
|
207
351
|
});
|
|
208
352
|
return plugin;
|
|
209
353
|
}), [
|
|
210
|
-
|
|
354
|
+
pluginLoaderParam,
|
|
211
355
|
plugins
|
|
212
356
|
]);
|
|
213
357
|
const state = useMemo2(() => live({
|
|
@@ -255,49 +399,43 @@ var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, c
|
|
|
255
399
|
manager
|
|
256
400
|
]);
|
|
257
401
|
useEffect2(() => {
|
|
402
|
+
setupDevtools(manager);
|
|
403
|
+
}, [
|
|
404
|
+
manager
|
|
405
|
+
]);
|
|
406
|
+
useAsyncEffect(async () => {
|
|
258
407
|
manager.context.contributeCapability({
|
|
259
408
|
interface: Capabilities.PluginManager,
|
|
260
409
|
implementation: manager,
|
|
261
410
|
module: "dxos.org/app-framework/plugin-manager"
|
|
262
411
|
});
|
|
263
412
|
manager.context.contributeCapability({
|
|
264
|
-
interface: Capabilities.
|
|
413
|
+
interface: Capabilities.AtomRegistry,
|
|
265
414
|
implementation: manager.registry,
|
|
266
|
-
module: "dxos.org/app-framework/
|
|
415
|
+
module: "dxos.org/app-framework/atom-registry"
|
|
267
416
|
});
|
|
417
|
+
await Promise.all([
|
|
418
|
+
// TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
|
|
419
|
+
manager.activate(Events.SetupReactSurface),
|
|
420
|
+
manager.activate(Events.Startup)
|
|
421
|
+
]);
|
|
268
422
|
return () => {
|
|
269
423
|
manager.context.removeCapability(Capabilities.PluginManager, manager);
|
|
270
|
-
manager.context.removeCapability(Capabilities.
|
|
424
|
+
manager.context.removeCapability(Capabilities.AtomRegistry, manager.registry);
|
|
271
425
|
};
|
|
272
426
|
}, [
|
|
273
427
|
manager
|
|
274
428
|
]);
|
|
275
|
-
|
|
276
|
-
setupDevtools(manager);
|
|
277
|
-
}, [
|
|
278
|
-
manager
|
|
279
|
-
]);
|
|
280
|
-
useEffect2(() => {
|
|
281
|
-
const timeout = setTimeout(async () => {
|
|
282
|
-
await Promise.all([
|
|
283
|
-
// TODO(wittjosiah): Factor out such that this could be called per surface role when attempting to render.
|
|
284
|
-
manager.activate(Events.SetupReactSurface),
|
|
285
|
-
manager.activate(Events.Startup)
|
|
286
|
-
]);
|
|
287
|
-
});
|
|
288
|
-
return () => clearTimeout(timeout);
|
|
289
|
-
}, [
|
|
290
|
-
manager
|
|
291
|
-
]);
|
|
292
|
-
return useCallback(() => /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
429
|
+
return useCallback(() => /* @__PURE__ */ React5.createElement(ErrorBoundary, {
|
|
293
430
|
fallback
|
|
294
|
-
}, /* @__PURE__ */
|
|
431
|
+
}, /* @__PURE__ */ React5.createElement(PluginManagerProvider, {
|
|
295
432
|
value: manager
|
|
296
|
-
}, /* @__PURE__ */
|
|
433
|
+
}, /* @__PURE__ */ React5.createElement(RegistryContext.Provider, {
|
|
297
434
|
value: manager.registry
|
|
298
|
-
}, /* @__PURE__ */
|
|
435
|
+
}, /* @__PURE__ */ React5.createElement(App, {
|
|
299
436
|
placeholder,
|
|
300
|
-
state
|
|
437
|
+
state,
|
|
438
|
+
debounce
|
|
301
439
|
})))), [
|
|
302
440
|
fallback,
|
|
303
441
|
manager,
|
|
@@ -305,97 +443,28 @@ var useApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins: _plugins, c
|
|
|
305
443
|
state
|
|
306
444
|
]);
|
|
307
445
|
};
|
|
308
|
-
var DELAY_PLACEHOLDER = 2e3;
|
|
309
|
-
var useLoading = (state) => {
|
|
310
|
-
const [stage, setStage] = useState(0);
|
|
311
|
-
useEffect2(() => {
|
|
312
|
-
const i = setInterval(() => {
|
|
313
|
-
setStage((tick) => {
|
|
314
|
-
switch (tick) {
|
|
315
|
-
case 0:
|
|
316
|
-
if (!state.ready) {
|
|
317
|
-
return 1;
|
|
318
|
-
} else {
|
|
319
|
-
clearInterval(i);
|
|
320
|
-
return 3;
|
|
321
|
-
}
|
|
322
|
-
case 1:
|
|
323
|
-
if (state.ready) {
|
|
324
|
-
return 2;
|
|
325
|
-
}
|
|
326
|
-
break;
|
|
327
|
-
case 2:
|
|
328
|
-
clearInterval(i);
|
|
329
|
-
return 3;
|
|
330
|
-
}
|
|
331
|
-
return tick;
|
|
332
|
-
});
|
|
333
|
-
}, DELAY_PLACEHOLDER);
|
|
334
|
-
return () => clearInterval(i);
|
|
335
|
-
}, []);
|
|
336
|
-
return stage;
|
|
337
|
-
};
|
|
338
|
-
var App = ({ placeholder: Placeholder, state }) => {
|
|
339
|
-
var _effect = _useSignals2();
|
|
340
|
-
try {
|
|
341
|
-
const reactContexts = useCapabilities(Capabilities.ReactContext);
|
|
342
|
-
const reactRoots = useCapabilities(Capabilities.ReactRoot);
|
|
343
|
-
const stage = useLoading(state);
|
|
344
|
-
if (state.error) {
|
|
345
|
-
throw state.error;
|
|
346
|
-
}
|
|
347
|
-
if (stage < 3) {
|
|
348
|
-
if (!Placeholder) {
|
|
349
|
-
return null;
|
|
350
|
-
}
|
|
351
|
-
return /* @__PURE__ */ React3.createElement(Placeholder, {
|
|
352
|
-
stage
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
const ComposedContext = composeContexts(reactContexts);
|
|
356
|
-
return /* @__PURE__ */ React3.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ React3.createElement(Component2, {
|
|
357
|
-
key: id
|
|
358
|
-
})));
|
|
359
|
-
} finally {
|
|
360
|
-
_effect.f();
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
var DefaultFallback = ({ error }) => {
|
|
364
|
-
var _effect = _useSignals2();
|
|
365
|
-
try {
|
|
366
|
-
return /* @__PURE__ */ React3.createElement("div", {
|
|
367
|
-
style: {
|
|
368
|
-
margin: "0.5rem",
|
|
369
|
-
padding: "1rem",
|
|
370
|
-
overflow: "hidden",
|
|
371
|
-
border: "1px solid red"
|
|
372
|
-
}
|
|
373
|
-
}, /* @__PURE__ */ React3.createElement("h1", {
|
|
374
|
-
style: {
|
|
375
|
-
margin: "0.5rem 0",
|
|
376
|
-
fontSize: "1.2rem"
|
|
377
|
-
}
|
|
378
|
-
}, "[ERROR]: ", error.message), /* @__PURE__ */ React3.createElement("pre", {
|
|
379
|
-
style: {
|
|
380
|
-
overflow: "auto",
|
|
381
|
-
fontSize: "1rem"
|
|
382
|
-
}
|
|
383
|
-
}, error.stack));
|
|
384
|
-
} finally {
|
|
385
|
-
_effect.f();
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
var composeContexts = (contexts) => {
|
|
389
|
-
if (contexts.length === 0) {
|
|
390
|
-
return ({ children }) => /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
|
|
391
|
-
}
|
|
392
|
-
return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React3.createElement(Acc, null, /* @__PURE__ */ React3.createElement(Next, null, children)));
|
|
393
|
-
};
|
|
394
446
|
var setupDevtools = (manager) => {
|
|
395
447
|
globalThis.composer ??= {};
|
|
396
448
|
globalThis.composer.manager = manager;
|
|
397
449
|
};
|
|
398
450
|
|
|
451
|
+
// src/react/useIntentResolver.ts
|
|
452
|
+
import { useEffect as useEffect3 } from "react";
|
|
453
|
+
var useIntentResolver = (module, resolver) => {
|
|
454
|
+
const manager = usePluginManager();
|
|
455
|
+
useEffect3(() => {
|
|
456
|
+
manager.context.contributeCapability({
|
|
457
|
+
module,
|
|
458
|
+
interface: Capabilities.IntentResolver,
|
|
459
|
+
implementation: resolver
|
|
460
|
+
});
|
|
461
|
+
return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);
|
|
462
|
+
}, [
|
|
463
|
+
module,
|
|
464
|
+
resolver
|
|
465
|
+
]);
|
|
466
|
+
};
|
|
467
|
+
|
|
399
468
|
export {
|
|
400
469
|
usePluginManager,
|
|
401
470
|
PluginManagerProvider,
|
|
@@ -404,11 +473,12 @@ export {
|
|
|
404
473
|
useIntentDispatcher,
|
|
405
474
|
useAppGraph,
|
|
406
475
|
useLayout,
|
|
476
|
+
SurfaceCardRole,
|
|
407
477
|
ErrorBoundary,
|
|
478
|
+
Surface,
|
|
408
479
|
useSurfaces,
|
|
409
480
|
isSurfaceAvailable,
|
|
410
|
-
|
|
411
|
-
useIntentResolver
|
|
412
|
-
useApp
|
|
481
|
+
useApp,
|
|
482
|
+
useIntentResolver
|
|
413
483
|
};
|
|
414
|
-
//# sourceMappingURL=chunk-
|
|
484
|
+
//# sourceMappingURL=chunk-3UPX5OIS.mjs.map
|