@dxos/app-framework 0.7.5-main.499c70c → 0.7.5-main.5ae2ba8
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-S4MYSHQA.mjs +137 -0
- package/dist/lib/browser/app-graph-builder-S4MYSHQA.mjs.map +7 -0
- package/dist/lib/browser/chunk-BCMEJONP.mjs +1432 -0
- package/dist/lib/browser/chunk-BCMEJONP.mjs.map +7 -0
- package/dist/lib/browser/chunk-QS4J6O47.mjs +285 -0
- package/dist/lib/browser/chunk-QS4J6O47.mjs.map +7 -0
- package/dist/lib/browser/chunk-SRZH2PQ2.mjs +32 -0
- package/dist/lib/browser/chunk-SRZH2PQ2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +119 -642
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-dispatcher-GFBH7T2J.mjs +11 -0
- package/dist/lib/browser/intent-resolver-KAFM7CQH.mjs +39 -0
- package/dist/lib/browser/intent-resolver-KAFM7CQH.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/store-L3VRR7II.mjs +29 -0
- package/dist/lib/browser/store-L3VRR7II.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +77 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/browser/worker.mjs +77 -0
- package/dist/lib/node/app-graph-builder-VMHWFCTP.cjs +146 -0
- package/dist/lib/node/app-graph-builder-VMHWFCTP.cjs.map +7 -0
- package/dist/lib/node/chunk-7Y6KJ3OK.cjs +1466 -0
- package/dist/lib/node/chunk-7Y6KJ3OK.cjs.map +7 -0
- package/dist/lib/node/chunk-B65NJEIJ.cjs +308 -0
- package/dist/lib/node/chunk-B65NJEIJ.cjs.map +7 -0
- package/dist/lib/node/{chunk-FCMHRU3M.cjs → chunk-VCIHQZSN.cjs} +23 -35
- package/dist/lib/node/chunk-VCIHQZSN.cjs.map +7 -0
- package/dist/lib/node/index.cjs +125 -665
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/{plugin-settings-W6UHMH5M.cjs → intent-dispatcher-PRCC4KZT.cjs} +10 -14
- package/dist/lib/node/intent-dispatcher-PRCC4KZT.cjs.map +7 -0
- package/dist/lib/node/intent-resolver-OZDKCHPW.cjs +46 -0
- package/dist/lib/node/intent-resolver-OZDKCHPW.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/store-BVUKNVKL.cjs +44 -0
- package/dist/lib/node/store-BVUKNVKL.cjs.map +7 -0
- package/dist/lib/node/testing/index.cjs +101 -0
- package/dist/lib/node/testing/index.cjs.map +7 -0
- package/dist/lib/node/worker.cjs +99 -0
- package/dist/lib/node/worker.cjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-XHI5IIXQ.mjs +138 -0
- package/dist/lib/node-esm/app-graph-builder-XHI5IIXQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CBT75GCX.mjs +34 -0
- package/dist/lib/node-esm/chunk-CBT75GCX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JDAHZRYQ.mjs +286 -0
- package/dist/lib/node-esm/chunk-JDAHZRYQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TVIR2PHY.mjs +1434 -0
- package/dist/lib/node-esm/chunk-TVIR2PHY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +119 -642
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-dispatcher-LGACN32C.mjs +12 -0
- package/dist/lib/node-esm/intent-resolver-RBNG76ZX.mjs +40 -0
- package/dist/lib/node-esm/intent-resolver-RBNG76ZX.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/store-PHTOEREN.mjs +30 -0
- package/dist/lib/node-esm/store-PHTOEREN.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +78 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/lib/node-esm/worker.mjs +78 -0
- package/dist/types/src/App.d.ts +22 -13
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/common/capabilities.d.ts +304 -0
- package/dist/types/src/common/capabilities.d.ts.map +1 -0
- package/dist/types/src/common/events.d.ts +52 -0
- package/dist/types/src/common/events.d.ts.map +1 -0
- package/dist/types/src/common/file.d.ts +14 -0
- package/dist/types/src/common/file.d.ts.map +1 -0
- package/dist/types/src/common/graph.d.ts +21 -0
- package/dist/types/src/common/graph.d.ts.map +1 -0
- package/dist/types/src/common/index.d.ts +8 -0
- package/dist/types/src/common/index.d.ts.map +1 -0
- package/dist/types/src/common/layout.d.ts +262 -0
- package/dist/types/src/common/layout.d.ts.map +1 -0
- package/dist/types/src/{plugins/plugin-surface/SurfaceContext.d.ts → common/surface.d.ts} +12 -29
- package/dist/types/src/common/surface.d.ts.map +1 -0
- package/dist/types/src/common/translations.d.ts +11 -0
- package/dist/types/src/common/translations.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.d.ts +94 -0
- package/dist/types/src/core/capabilities.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.test.d.ts +2 -0
- package/dist/types/src/core/capabilities.test.d.ts.map +1 -0
- package/dist/types/src/core/events.d.ts +58 -0
- package/dist/types/src/core/events.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +5 -0
- package/dist/types/src/core/index.d.ts.map +1 -0
- package/dist/types/src/core/manager.d.ts +119 -0
- package/dist/types/src/core/manager.d.ts.map +1 -0
- package/dist/types/src/core/manager.test.d.ts +2 -0
- package/dist/types/src/core/manager.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +97 -0
- package/dist/types/src/core/plugin.d.ts.map +1 -0
- package/dist/types/src/helpers.d.ts +10 -0
- package/dist/types/src/helpers.d.ts.map +1 -0
- package/dist/types/src/helpers.test.d.ts +2 -0
- package/dist/types/src/helpers.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/debug/Debug.d.ts +5 -0
- package/dist/types/src/playground/debug/Debug.d.ts.map +1 -0
- package/dist/types/src/playground/debug/index.d.ts +2 -0
- package/dist/types/src/playground/debug/index.d.ts.map +1 -0
- package/dist/types/src/playground/debug/plugin.d.ts +2 -0
- package/dist/types/src/playground/debug/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/generator/Main.d.ts +5 -0
- package/dist/types/src/playground/generator/Main.d.ts.map +1 -0
- package/dist/types/src/playground/generator/Toolbar.d.ts +5 -0
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -0
- package/dist/types/src/playground/generator/generator.d.ts +7 -0
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -0
- package/dist/types/src/playground/generator/index.d.ts +3 -0
- package/dist/types/src/playground/generator/index.d.ts.map +1 -0
- package/dist/types/src/playground/generator/plugin.d.ts +2 -0
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/layout/Layout.d.ts +8 -0
- package/dist/types/src/playground/layout/Layout.d.ts.map +1 -0
- package/dist/types/src/playground/layout/index.d.ts +2 -0
- package/dist/types/src/playground/layout/index.d.ts.map +1 -0
- package/dist/types/src/playground/layout/plugin.d.ts +2 -0
- package/dist/types/src/playground/layout/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/logger/Toolbar.d.ts +5 -0
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -0
- package/dist/types/src/playground/logger/index.d.ts +2 -0
- package/dist/types/src/playground/logger/index.d.ts.map +1 -0
- package/dist/types/src/playground/logger/plugin.d.ts +2 -0
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/logger/schema.d.ts +13 -0
- package/dist/types/src/playground/logger/schema.d.ts.map +1 -0
- package/dist/types/src/playground/playground.stories.d.ts +9 -0
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +2 -0
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/actions.d.ts +23 -0
- package/dist/types/src/plugin-intent/actions.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/errors.d.ts +16 -0
- package/dist/types/src/plugin-intent/errors.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/index.d.ts +5 -0
- package/dist/types/src/plugin-intent/index.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +113 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +1 -0
- package/dist/types/src/{plugins/plugin-intent → plugin-intent}/intent.d.ts +8 -28
- package/dist/types/src/plugin-intent/intent.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +2 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/actions.d.ts +27 -0
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +197 -0
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/index.d.ts +3 -0
- package/dist/types/src/plugin-settings/index.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +4 -0
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/store.d.ts +5 -0
- package/dist/types/src/plugin-settings/store.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/translations.d.ts +11 -0
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -0
- package/dist/types/src/{plugins/plugin-surface → react}/ErrorBoundary.d.ts +1 -1
- package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -0
- package/dist/types/src/{plugins/plugin-intent → react}/IntentContext.d.ts +2 -2
- package/dist/types/src/react/IntentContext.d.ts.map +1 -0
- package/dist/types/src/react/PluginManagerProvider.d.ts +10 -0
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +1 -0
- package/dist/types/src/react/Surface.d.ts +12 -0
- package/dist/types/src/react/Surface.d.ts.map +1 -0
- package/dist/types/src/react/Surface.stories.d.ts +15 -0
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -0
- package/dist/types/src/react/common.d.ts +13 -0
- package/dist/types/src/react/common.d.ts.map +1 -0
- package/dist/types/src/react/index.d.ts +7 -0
- package/dist/types/src/react/index.d.ts.map +1 -0
- package/dist/types/src/react/useCapabilities.d.ts +13 -0
- package/dist/types/src/react/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/react/useIntentResolver.d.ts +3 -0
- package/dist/types/src/react/useIntentResolver.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +12 -0
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.stories.d.ts +5 -0
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -0
- package/dist/types/src/worker.d.ts +4 -0
- package/dist/types/src/worker.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +40 -19
- package/project.json +5 -3
- package/src/App.tsx +140 -34
- package/src/common/capabilities.ts +101 -0
- package/src/common/events.ts +77 -0
- package/src/common/file.ts +22 -0
- package/src/common/graph.ts +30 -0
- package/src/{plugins/common → common}/index.ts +3 -2
- package/src/common/layout.ts +238 -0
- package/src/{plugins/plugin-surface/SurfaceContext.ts → common/surface.ts} +6 -37
- package/src/common/translations.ts +17 -0
- package/src/core/capabilities.test.ts +116 -0
- package/src/core/capabilities.ts +222 -0
- package/src/core/events.ts +58 -0
- package/src/core/index.ts +8 -0
- package/src/core/manager.test.ts +516 -0
- package/src/core/manager.ts +511 -0
- package/src/core/plugin.ts +131 -0
- package/src/helpers.test.ts +97 -0
- package/src/helpers.ts +45 -0
- package/src/index.ts +6 -3
- package/src/playground/debug/Debug.tsx +39 -0
- package/src/playground/debug/index.ts +5 -0
- package/src/playground/debug/plugin.ts +17 -0
- package/src/playground/generator/Main.tsx +71 -0
- package/src/playground/generator/Toolbar.tsx +46 -0
- package/src/playground/generator/generator.ts +48 -0
- package/src/playground/generator/index.ts +6 -0
- package/src/playground/generator/plugin.ts +23 -0
- package/src/playground/layout/Layout.tsx +33 -0
- package/src/playground/layout/index.ts +5 -0
- package/src/playground/layout/plugin.ts +17 -0
- package/src/playground/logger/Toolbar.tsx +29 -0
- package/src/playground/logger/index.ts +5 -0
- package/src/playground/logger/plugin.ts +36 -0
- package/src/playground/logger/schema.ts +12 -0
- package/src/playground/playground.stories.tsx +34 -0
- package/src/plugin-intent/IntentPlugin.tsx +20 -0
- package/src/plugin-intent/actions.ts +22 -0
- package/src/plugin-intent/errors.ts +39 -0
- package/src/plugin-intent/index.ts +8 -0
- package/src/{plugins/plugin-intent → plugin-intent}/intent-dispatcher.test.ts +83 -63
- package/src/{plugins/plugin-intent → plugin-intent}/intent-dispatcher.ts +118 -95
- package/src/{plugins/plugin-intent → plugin-intent}/intent.ts +10 -26
- package/src/plugin-settings/SettingsPlugin.ts +35 -0
- package/src/plugin-settings/actions.ts +27 -0
- package/src/plugin-settings/app-graph-builder.ts +122 -0
- package/src/plugin-settings/index.ts +6 -0
- package/src/plugin-settings/intent-resolver.ts +34 -0
- package/src/plugin-settings/store.ts +30 -0
- package/src/plugin-settings/translations.ts +17 -0
- package/src/{plugins/plugin-intent → react}/IntentContext.tsx +13 -5
- package/src/react/PluginManagerProvider.ts +22 -0
- package/src/react/Surface.stories.tsx +96 -0
- package/src/react/Surface.tsx +75 -0
- package/src/react/common.ts +12 -0
- package/src/react/index.ts +10 -0
- package/src/react/useCapabilities.ts +40 -0
- package/src/react/useIntentResolver.ts +22 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/withPluginManager.stories.tsx +47 -0
- package/src/testing/withPluginManager.tsx +91 -0
- package/src/worker.ts +11 -0
- package/tsconfig.json +19 -13
- package/dist/lib/browser/chunk-3E7RY3CE.mjs +0 -72
- package/dist/lib/browser/chunk-3E7RY3CE.mjs.map +0 -7
- package/dist/lib/browser/chunk-QG25ZU2N.mjs +0 -320
- package/dist/lib/browser/chunk-QG25ZU2N.mjs.map +0 -7
- package/dist/lib/browser/chunk-SPDTXTOV.mjs +0 -163
- package/dist/lib/browser/chunk-SPDTXTOV.mjs.map +0 -7
- package/dist/lib/browser/chunk-WBOXEHBE.mjs +0 -51
- package/dist/lib/browser/chunk-WBOXEHBE.mjs.map +0 -7
- package/dist/lib/browser/plugin-intent-T7Y3MJ5C.mjs +0 -32
- package/dist/lib/browser/plugin-settings-5U2L2NRU.mjs +0 -15
- package/dist/lib/browser/plugin-surface-OKPF3EQI.mjs +0 -24
- package/dist/lib/node/chunk-BW3RNEVI.cjs +0 -185
- package/dist/lib/node/chunk-BW3RNEVI.cjs.map +0 -7
- package/dist/lib/node/chunk-FCMHRU3M.cjs.map +0 -7
- package/dist/lib/node/chunk-QBM42OQ6.cjs +0 -97
- package/dist/lib/node/chunk-QBM42OQ6.cjs.map +0 -7
- package/dist/lib/node/chunk-VWHAALIN.cjs +0 -344
- package/dist/lib/node/chunk-VWHAALIN.cjs.map +0 -7
- package/dist/lib/node/plugin-intent-F3TQZIUR.cjs +0 -53
- package/dist/lib/node/plugin-intent-F3TQZIUR.cjs.map +0 -7
- package/dist/lib/node/plugin-settings-W6UHMH5M.cjs.map +0 -7
- package/dist/lib/node/plugin-surface-CCSIONYW.cjs +0 -45
- package/dist/lib/node/plugin-surface-CCSIONYW.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-3T5UIJY3.mjs +0 -53
- package/dist/lib/node-esm/chunk-3T5UIJY3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4GX7V5ZE.mjs +0 -164
- package/dist/lib/node-esm/chunk-4GX7V5ZE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CFOUYXQ6.mjs +0 -321
- package/dist/lib/node-esm/chunk-CFOUYXQ6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs +0 -74
- package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-intent-W2HQC6LC.mjs +0 -33
- package/dist/lib/node-esm/plugin-settings-H5RHNFVC.mjs +0 -16
- package/dist/lib/node-esm/plugin-settings-H5RHNFVC.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-surface-V3YET3UL.mjs +0 -25
- package/dist/lib/node-esm/plugin-surface-V3YET3UL.mjs.map +0 -7
- package/dist/types/src/plugins/common/file.d.ts +0 -22
- package/dist/types/src/plugins/common/file.d.ts.map +0 -1
- package/dist/types/src/plugins/common/graph.d.ts +0 -51
- package/dist/types/src/plugins/common/graph.d.ts.map +0 -1
- package/dist/types/src/plugins/common/index.d.ts +0 -7
- package/dist/types/src/plugins/common/index.d.ts.map +0 -1
- package/dist/types/src/plugins/common/layout.d.ts +0 -176
- package/dist/types/src/plugins/common/layout.d.ts.map +0 -1
- package/dist/types/src/plugins/common/metadata.d.ts +0 -16
- package/dist/types/src/plugins/common/metadata.d.ts.map +0 -1
- package/dist/types/src/plugins/common/navigation.d.ts +0 -243
- package/dist/types/src/plugins/common/navigation.d.ts.map +0 -1
- package/dist/types/src/plugins/common/translations.d.ts +0 -22
- package/dist/types/src/plugins/common/translations.d.ts.map +0 -1
- package/dist/types/src/plugins/helpers.d.ts +0 -41
- package/dist/types/src/plugins/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/index.d.ts +0 -7
- package/dist/types/src/plugins/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts +0 -16
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts +0 -14
- package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/PluginContext.d.ts +0 -47
- package/dist/types/src/plugins/plugin-host/PluginContext.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/index.d.ts +0 -6
- package/dist/types/src/plugins/plugin-host/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/plugin.d.ts +0 -104
- package/dist/types/src/plugins/plugin-host/plugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/plugin.test.d.ts +0 -35
- package/dist/types/src/plugins/plugin-host/plugin.test.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts +0 -8
- package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/index.d.ts +0 -7
- package/dist/types/src/plugins/plugin-intent/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/intent-dispatcher.d.ts +0 -107
- package/dist/types/src/plugins/plugin-intent/intent-dispatcher.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/intent-dispatcher.test.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/meta.d.ts +0 -6
- package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/provides.d.ts +0 -16
- package/dist/types/src/plugins/plugin-intent/provides.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts +0 -4
- package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/index.d.ts +0 -4
- package/dist/types/src/plugins/plugin-settings/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/meta.d.ts +0 -5
- package/dist/types/src/plugins/plugin-settings/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/provides.d.ts +0 -26
- package/dist/types/src/plugins/plugin-settings/provides.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/ErrorBoundary.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/Surface.d.ts +0 -7
- package/dist/types/src/plugins/plugin-surface/Surface.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/SurfaceContext.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts +0 -7
- package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/helpers.d.ts +0 -21
- package/dist/types/src/plugins/plugin-surface/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/index.d.ts +0 -8
- package/dist/types/src/plugins/plugin-surface/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/meta.d.ts +0 -5
- package/dist/types/src/plugins/plugin-surface/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/provides.d.ts +0 -17
- package/dist/types/src/plugins/plugin-surface/provides.d.ts.map +0 -1
- package/src/plugins/common/file.ts +0 -36
- package/src/plugins/common/graph.ts +0 -70
- package/src/plugins/common/layout.ts +0 -173
- package/src/plugins/common/metadata.ts +0 -29
- package/src/plugins/common/navigation.ts +0 -214
- package/src/plugins/common/translations.ts +0 -36
- package/src/plugins/helpers.ts +0 -92
- package/src/plugins/index.ts +0 -11
- package/src/plugins/plugin-host/HostPlugin.tsx +0 -88
- package/src/plugins/plugin-host/PluginContainer.tsx +0 -120
- package/src/plugins/plugin-host/PluginContext.tsx +0 -79
- package/src/plugins/plugin-host/index.ts +0 -12
- package/src/plugins/plugin-host/plugin.test.ts +0 -158
- package/src/plugins/plugin-host/plugin.ts +0 -133
- package/src/plugins/plugin-intent/IntentPlugin.tsx +0 -75
- package/src/plugins/plugin-intent/index.ts +0 -13
- package/src/plugins/plugin-intent/meta.ts +0 -11
- package/src/plugins/plugin-intent/provides.ts +0 -26
- package/src/plugins/plugin-settings/SettingsPlugin.tsx +0 -22
- package/src/plugins/plugin-settings/index.ts +0 -9
- package/src/plugins/plugin-settings/meta.ts +0 -9
- package/src/plugins/plugin-settings/provides.ts +0 -34
- package/src/plugins/plugin-surface/Surface.tsx +0 -62
- package/src/plugins/plugin-surface/SurfacePlugin.tsx +0 -45
- package/src/plugins/plugin-surface/helpers.ts +0 -22
- package/src/plugins/plugin-surface/index.ts +0 -14
- package/src/plugins/plugin-surface/meta.ts +0 -9
- package/src/plugins/plugin-surface/provides.ts +0 -27
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/dist/lib/browser/{plugin-intent-T7Y3MJ5C.mjs.map → intent-dispatcher-GFBH7T2J.mjs.map} +0 -0
- /package/dist/lib/browser/{plugin-settings-5U2L2NRU.mjs.map → worker.mjs.map} +0 -0
- /package/dist/lib/{browser/plugin-surface-OKPF3EQI.mjs.map → node-esm/intent-dispatcher-LGACN32C.mjs.map} +0 -0
- /package/dist/lib/node-esm/{plugin-intent-W2HQC6LC.mjs.map → worker.mjs.map} +0 -0
- /package/dist/types/src/{plugins/plugin-intent → plugin-intent}/intent-dispatcher.test.d.ts +0 -0
- /package/src/{plugins/plugin-surface → react}/ErrorBoundary.tsx +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/testing/withPluginManager.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Decorator } from '@storybook/react';\nimport React, { useEffect } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { createApp, type CreateAppOptions } from '../App';\nimport { Capabilities, Events } from '../common';\nimport {\n type ActivationEvent,\n type AnyCapability,\n contributes,\n defineModule,\n definePlugin,\n PluginManager,\n} from '../core';\n\n/**\n * @internal\n */\nexport const setupPluginManager = ({\n capabilities,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n ...options\n}: CreateAppOptions & { capabilities?: AnyCapability[] } = {}) => {\n const pluginManager = new PluginManager({\n pluginLoader: () => raise(new Error('Not implemented')),\n plugins: [StoryPlugin(), ...plugins],\n core: [STORY_PLUGIN, ...core],\n ...options,\n });\n\n if (capabilities) {\n capabilities.forEach((capability) => {\n pluginManager.context.contributeCapability({\n interface: capability.interface,\n implementation: capability.implementation,\n module: 'story',\n });\n });\n }\n\n return pluginManager;\n};\n\nexport type WithPluginManagerOptions = CreateAppOptions & {\n capabilities?: AnyCapability[];\n fireEvents?: (ActivationEvent | string)[];\n};\n\n/**\n * Wraps a story with a plugin manager.\n */\nexport const withPluginManager = (options: WithPluginManagerOptions = {}): Decorator => {\n const pluginManager = setupPluginManager(options);\n const App = createApp({ pluginManager });\n\n options.fireEvents?.forEach((event) => {\n void pluginManager.activate(event);\n });\n\n return (Story, context) => {\n useEffect(() => {\n const capability = contributes(Capabilities.ReactRoot, {\n id: context.id,\n root: () => <Story />,\n });\n\n pluginManager.context.contributeCapability({\n ...capability,\n module: 'dxos.org/app-framework/withPluginManager',\n });\n\n return () => pluginManager.context.removeCapability(capability.interface, capability.implementation);\n }, []);\n\n return <App />;\n };\n};\n\n// No-op plugin to ensure there exists at least one plugin for the startup event.\n// This is necessary because `createApp` expects the startup event to complete before the app is ready.\nconst STORY_PLUGIN = 'dxos.org/app-framework/story';\nconst StoryPlugin = () =>\n definePlugin({ id: STORY_PLUGIN }, [\n defineModule({ id: STORY_PLUGIN, activatesOn: Events.Startup, activate: () => [] }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,mBAAiC;AAEjC,mBAAsB;AAgBf,IAAMA,qBAAqB,CAAC,EACjCC,cACAC,UAAU,CAAA,GACVC,OAAOD,QAAQE,IAAI,CAAC,EAAEC,KAAI,MAAOA,KAAKC,EAAE,GACxC,GAAGC,QAAAA,IACsD,CAAC,MAAC;AAC3D,QAAMC,gBAAgB,IAAIC,oCAAc;IACtCC,cAAc,UAAMC,oBAAM,IAAIC,MAAM,iBAAA,CAAA;IACpCV,SAAS;MAACW,YAAAA;SAAkBX;;IAC5BC,MAAM;MAACW;SAAiBX;;IACxB,GAAGI;EACL,CAAA;AAEA,MAAIN,cAAc;AAChBA,iBAAac,QAAQ,CAACC,eAAAA;AACpBR,oBAAcS,QAAQC,qBAAqB;QACzCC,WAAWH,WAAWG;QACtBC,gBAAgBJ,WAAWI;QAC3BC,QAAQ;MACV,CAAA;IACF,CAAA;EACF;AAEA,SAAOb;AACT;AAUO,IAAMc,oBAAoB,CAACf,UAAoC,CAAC,MAAC;AACtE,QAAMC,gBAAgBR,mBAAmBO,OAAAA;AACzC,QAAMgB,UAAMC,iCAAU;IAAEhB;EAAc,CAAA;AAEtCD,UAAQkB,YAAYV,QAAQ,CAACW,UAAAA;AAC3B,SAAKlB,cAAcmB,SAASD,KAAAA;EAC9B,CAAA;AAEA,SAAO,CAACE,OAAOX,YAAAA;AACbY,gCAAU,MAAA;AACR,YAAMb,iBAAac,mCAAYC,mCAAaC,WAAW;QACrD1B,IAAIW,QAAQX;QACZ2B,MAAM,MAAM,6BAAAC,QAAA,cAACN,OAAAA,IAAAA;MACf,CAAA;AAEApB,oBAAcS,QAAQC,qBAAqB;QACzC,GAAGF;QACHK,QAAQ;MACV,CAAA;AAEA,aAAO,MAAMb,cAAcS,QAAQkB,iBAAiBnB,WAAWG,WAAWH,WAAWI,cAAc;IACrG,GAAG,CAAA,CAAE;AAEL,WAAO,6BAAAc,QAAA,cAACX,KAAAA,IAAAA;EACV;AACF;AAIA,IAAMT,eAAe;AACrB,IAAMD,cAAc,UAClBuB,oCAAa;EAAE9B,IAAIQ;AAAa,GAAG;MACjCuB,oCAAa;IAAE/B,IAAIQ;IAAcwB,aAAaC,6BAAOC;IAASb,UAAU,MAAM,CAAA;EAAG,CAAA;CAClF;",
|
|
6
|
+
"names": ["setupPluginManager", "capabilities", "plugins", "core", "map", "meta", "id", "options", "pluginManager", "PluginManager", "pluginLoader", "raise", "Error", "StoryPlugin", "STORY_PLUGIN", "forEach", "capability", "context", "contributeCapability", "interface", "implementation", "module", "withPluginManager", "App", "createApp", "fireEvents", "event", "activate", "Story", "useEffect", "contributes", "Capabilities", "ReactRoot", "root", "React", "removeCapability", "definePlugin", "defineModule", "activatesOn", "Events", "Startup"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var worker_exports = {};
|
|
20
|
+
__export(worker_exports, {
|
|
21
|
+
Capabilities: () => import_chunk_7Y6KJ3OK.Capabilities,
|
|
22
|
+
Events: () => import_chunk_7Y6KJ3OK.Events,
|
|
23
|
+
FileInfoSchema: () => import_chunk_7Y6KJ3OK.FileInfoSchema,
|
|
24
|
+
INTENT_ACTION: () => import_chunk_7Y6KJ3OK.INTENT_ACTION,
|
|
25
|
+
INTENT_PLUGIN: () => import_chunk_7Y6KJ3OK.INTENT_PLUGIN,
|
|
26
|
+
IntentAction: () => import_chunk_7Y6KJ3OK.IntentAction,
|
|
27
|
+
IntentPlugin: () => import_chunk_7Y6KJ3OK.IntentPlugin,
|
|
28
|
+
LAYOUT_ACTION: () => import_chunk_7Y6KJ3OK.LAYOUT_ACTION,
|
|
29
|
+
LAYOUT_PLUGIN: () => import_chunk_7Y6KJ3OK.LAYOUT_PLUGIN,
|
|
30
|
+
Label: () => import_chunk_7Y6KJ3OK.Label,
|
|
31
|
+
LayoutAction: () => import_chunk_7Y6KJ3OK.LayoutAction,
|
|
32
|
+
Plugin: () => import_chunk_7Y6KJ3OK.Plugin,
|
|
33
|
+
PluginManager: () => import_chunk_7Y6KJ3OK.PluginManager,
|
|
34
|
+
PluginModule: () => import_chunk_7Y6KJ3OK.PluginModule,
|
|
35
|
+
PluginsContext: () => import_chunk_7Y6KJ3OK.PluginsContext,
|
|
36
|
+
Resource: () => import_chunk_7Y6KJ3OK.Resource,
|
|
37
|
+
ResourceKey: () => import_chunk_7Y6KJ3OK.ResourceKey,
|
|
38
|
+
ResourceLanguage: () => import_chunk_7Y6KJ3OK.ResourceLanguage,
|
|
39
|
+
allOf: () => import_chunk_7Y6KJ3OK.allOf,
|
|
40
|
+
chain: () => import_chunk_7Y6KJ3OK.chain,
|
|
41
|
+
contributes: () => import_chunk_7Y6KJ3OK.contributes,
|
|
42
|
+
createDispatcher: () => import_chunk_7Y6KJ3OK.createDispatcher,
|
|
43
|
+
createIntent: () => import_chunk_7Y6KJ3OK.createIntent,
|
|
44
|
+
createResolver: () => import_chunk_7Y6KJ3OK.createResolver,
|
|
45
|
+
createSurface: () => import_chunk_7Y6KJ3OK.createSurface,
|
|
46
|
+
defaultFileTypes: () => import_chunk_7Y6KJ3OK.defaultFileTypes,
|
|
47
|
+
defineCapability: () => import_chunk_7Y6KJ3OK.defineCapability,
|
|
48
|
+
defineEvent: () => import_chunk_7Y6KJ3OK.defineEvent,
|
|
49
|
+
defineModule: () => import_chunk_7Y6KJ3OK.defineModule,
|
|
50
|
+
definePlugin: () => import_chunk_7Y6KJ3OK.definePlugin,
|
|
51
|
+
eventKey: () => import_chunk_7Y6KJ3OK.eventKey,
|
|
52
|
+
getEvents: () => import_chunk_7Y6KJ3OK.getEvents,
|
|
53
|
+
isAllOf: () => import_chunk_7Y6KJ3OK.isAllOf,
|
|
54
|
+
isOneOf: () => import_chunk_7Y6KJ3OK.isOneOf,
|
|
55
|
+
lazy: () => import_chunk_7Y6KJ3OK.lazy,
|
|
56
|
+
oneOf: () => import_chunk_7Y6KJ3OK.oneOf
|
|
57
|
+
});
|
|
58
|
+
module.exports = __toCommonJS(worker_exports);
|
|
59
|
+
var import_chunk_7Y6KJ3OK = require("./chunk-7Y6KJ3OK.cjs");
|
|
60
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
61
|
+
0 && (module.exports = {
|
|
62
|
+
Capabilities,
|
|
63
|
+
Events,
|
|
64
|
+
FileInfoSchema,
|
|
65
|
+
INTENT_ACTION,
|
|
66
|
+
INTENT_PLUGIN,
|
|
67
|
+
IntentAction,
|
|
68
|
+
IntentPlugin,
|
|
69
|
+
LAYOUT_ACTION,
|
|
70
|
+
LAYOUT_PLUGIN,
|
|
71
|
+
Label,
|
|
72
|
+
LayoutAction,
|
|
73
|
+
Plugin,
|
|
74
|
+
PluginManager,
|
|
75
|
+
PluginModule,
|
|
76
|
+
PluginsContext,
|
|
77
|
+
Resource,
|
|
78
|
+
ResourceKey,
|
|
79
|
+
ResourceLanguage,
|
|
80
|
+
allOf,
|
|
81
|
+
chain,
|
|
82
|
+
contributes,
|
|
83
|
+
createDispatcher,
|
|
84
|
+
createIntent,
|
|
85
|
+
createResolver,
|
|
86
|
+
createSurface,
|
|
87
|
+
defaultFileTypes,
|
|
88
|
+
defineCapability,
|
|
89
|
+
defineEvent,
|
|
90
|
+
defineModule,
|
|
91
|
+
definePlugin,
|
|
92
|
+
eventKey,
|
|
93
|
+
getEvents,
|
|
94
|
+
isAllOf,
|
|
95
|
+
isOneOf,
|
|
96
|
+
lazy,
|
|
97
|
+
oneOf
|
|
98
|
+
});
|
|
99
|
+
//# sourceMappingURL=worker.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["worker.cjs"],
|
|
4
|
+
"sourcesContent": ["import {\n Capabilities,\n Events,\n FileInfoSchema,\n INTENT_ACTION,\n INTENT_PLUGIN,\n IntentAction,\n IntentPlugin,\n LAYOUT_ACTION,\n LAYOUT_PLUGIN,\n Label,\n LayoutAction,\n Plugin,\n PluginManager,\n PluginModule,\n PluginsContext,\n Resource,\n ResourceKey,\n ResourceLanguage,\n allOf,\n chain,\n contributes,\n createDispatcher,\n createIntent,\n createResolver,\n createSurface,\n defaultFileTypes,\n defineCapability,\n defineEvent,\n defineModule,\n definePlugin,\n eventKey,\n getEvents,\n isAllOf,\n isOneOf,\n lazy,\n oneOf\n} from \"./chunk-7Y6KJ3OK.cjs\";\nexport {\n Capabilities,\n Events,\n FileInfoSchema,\n INTENT_ACTION,\n INTENT_PLUGIN,\n IntentAction,\n IntentPlugin,\n LAYOUT_ACTION,\n LAYOUT_PLUGIN,\n Label,\n LayoutAction,\n Plugin,\n PluginManager,\n PluginModule,\n PluginsContext,\n Resource,\n ResourceKey,\n ResourceLanguage,\n allOf,\n chain,\n contributes,\n createDispatcher,\n createIntent,\n createResolver,\n createSurface,\n defaultFileTypes,\n defineCapability,\n defineEvent,\n defineModule,\n definePlugin,\n eventKey,\n getEvents,\n isAllOf,\n isOneOf,\n lazy,\n oneOf\n};\n//# sourceMappingURL=worker.cjs.map\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAqCO;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
SETTINGS_ID,
|
|
4
|
+
SETTINGS_KEY,
|
|
5
|
+
SETTINGS_PLUGIN,
|
|
6
|
+
SettingsAction
|
|
7
|
+
} from "./chunk-CBT75GCX.mjs";
|
|
8
|
+
import {
|
|
9
|
+
Capabilities,
|
|
10
|
+
contributes,
|
|
11
|
+
createIntent
|
|
12
|
+
} from "./chunk-TVIR2PHY.mjs";
|
|
13
|
+
|
|
14
|
+
// packages/sdk/app-framework/src/plugin-settings/app-graph-builder.ts
|
|
15
|
+
import { createExtension } from "@dxos/app-graph";
|
|
16
|
+
import { isNonNullable } from "@dxos/util";
|
|
17
|
+
var app_graph_builder_default = (context) => contributes(Capabilities.AppGraphBuilder, [
|
|
18
|
+
createExtension({
|
|
19
|
+
id: `${SETTINGS_PLUGIN}/action`,
|
|
20
|
+
filter: (node) => node.id === "root",
|
|
21
|
+
actions: () => [
|
|
22
|
+
{
|
|
23
|
+
id: SETTINGS_PLUGIN,
|
|
24
|
+
data: async () => {
|
|
25
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
26
|
+
await dispatch(createIntent(SettingsAction.Open));
|
|
27
|
+
},
|
|
28
|
+
properties: {
|
|
29
|
+
label: [
|
|
30
|
+
"open settings label",
|
|
31
|
+
{
|
|
32
|
+
ns: SETTINGS_PLUGIN
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
icon: "ph--gear--regular",
|
|
36
|
+
keyBinding: {
|
|
37
|
+
macos: "meta+,",
|
|
38
|
+
windows: "alt+,"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}),
|
|
44
|
+
createExtension({
|
|
45
|
+
id: `${SETTINGS_PLUGIN}/core`,
|
|
46
|
+
filter: (node) => node.id === "root",
|
|
47
|
+
connector: () => [
|
|
48
|
+
{
|
|
49
|
+
id: SETTINGS_ID,
|
|
50
|
+
type: SETTINGS_PLUGIN,
|
|
51
|
+
properties: {
|
|
52
|
+
label: [
|
|
53
|
+
"app settings label",
|
|
54
|
+
{
|
|
55
|
+
ns: SETTINGS_PLUGIN
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
icon: "ph--gear--regular",
|
|
59
|
+
disposition: "pin-end",
|
|
60
|
+
position: "hoist",
|
|
61
|
+
testId: "treeView.appSettings"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}),
|
|
66
|
+
createExtension({
|
|
67
|
+
id: `${SETTINGS_PLUGIN}/core-plugins`,
|
|
68
|
+
filter: (node) => node.id === SETTINGS_ID,
|
|
69
|
+
connector: () => {
|
|
70
|
+
const manager = context.requestCapability(Capabilities.PluginManager);
|
|
71
|
+
const [settingsStore] = context.requestCapabilities(Capabilities.SettingsStore);
|
|
72
|
+
return [
|
|
73
|
+
...manager.plugins.filter((plugin) => manager.core.includes(plugin.meta.id)).map((plugin) => {
|
|
74
|
+
const settings = settingsStore?.getStore(plugin.meta.id);
|
|
75
|
+
if (!settings) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
return [
|
|
79
|
+
plugin.meta,
|
|
80
|
+
settings
|
|
81
|
+
];
|
|
82
|
+
}).filter(isNonNullable).map(([meta, settings]) => ({
|
|
83
|
+
id: `${SETTINGS_KEY}:${meta.id.replaceAll("/", ":")}`,
|
|
84
|
+
type: "category",
|
|
85
|
+
data: settings,
|
|
86
|
+
properties: {
|
|
87
|
+
label: meta.name ?? meta.id,
|
|
88
|
+
icon: meta.icon ?? "ph--circle--regular"
|
|
89
|
+
}
|
|
90
|
+
})),
|
|
91
|
+
{
|
|
92
|
+
id: `${SETTINGS_KEY}:custom-plugins`,
|
|
93
|
+
type: "collection",
|
|
94
|
+
properties: {
|
|
95
|
+
label: [
|
|
96
|
+
"custom plugins label",
|
|
97
|
+
{
|
|
98
|
+
ns: SETTINGS_PLUGIN
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
icon: "ph--squares-four--regular",
|
|
102
|
+
role: "branch"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
}),
|
|
108
|
+
createExtension({
|
|
109
|
+
id: `${SETTINGS_PLUGIN}/custom-plugins`,
|
|
110
|
+
filter: (node) => node.id === `${SETTINGS_KEY}:custom-plugins`,
|
|
111
|
+
connector: () => {
|
|
112
|
+
const manager = context.requestCapability(Capabilities.PluginManager);
|
|
113
|
+
const [settingsStore] = context.requestCapabilities(Capabilities.SettingsStore);
|
|
114
|
+
return manager.plugins.filter((plugin) => !manager.core.includes(plugin.meta.id)).map((plugin) => {
|
|
115
|
+
const settings = settingsStore?.getStore(plugin.meta.id);
|
|
116
|
+
if (!settings) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
return [
|
|
120
|
+
plugin.meta,
|
|
121
|
+
settings
|
|
122
|
+
];
|
|
123
|
+
}).filter(isNonNullable).map(([meta, settings]) => ({
|
|
124
|
+
id: `${SETTINGS_KEY}:${meta.id.replaceAll("/", ":")}`,
|
|
125
|
+
type: "category",
|
|
126
|
+
data: settings,
|
|
127
|
+
properties: {
|
|
128
|
+
label: meta.name ?? meta.id,
|
|
129
|
+
icon: meta.icon ?? "ph--circle--regular"
|
|
130
|
+
}
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
})
|
|
134
|
+
]);
|
|
135
|
+
export {
|
|
136
|
+
app_graph_builder_default as default
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=app-graph-builder-XHI5IIXQ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugin-settings/app-graph-builder.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createExtension, type Node } from '@dxos/app-graph';\nimport { type SettingsStore, type SettingsValue } from '@dxos/local-storage';\nimport { isNonNullable } from '@dxos/util';\n\nimport { SETTINGS_ID, SETTINGS_KEY, SETTINGS_PLUGIN, SettingsAction } from './actions';\nimport { Capabilities } from '../common';\nimport { contributes, type PluginMeta, type PluginsContext } from '../core';\nimport { createIntent } from '../plugin-intent';\n\nexport default (context: PluginsContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${SETTINGS_PLUGIN}/action`,\n filter: (node): node is Node<null> => node.id === 'root',\n actions: () => [\n {\n id: SETTINGS_PLUGIN,\n data: async () => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n await dispatch(createIntent(SettingsAction.Open));\n },\n properties: {\n label: ['open settings label', { ns: SETTINGS_PLUGIN }],\n icon: 'ph--gear--regular',\n keyBinding: {\n macos: 'meta+,',\n windows: 'alt+,',\n },\n },\n },\n ],\n }),\n createExtension({\n id: `${SETTINGS_PLUGIN}/core`,\n filter: (node): node is Node<null> => node.id === 'root',\n connector: () => [\n {\n id: SETTINGS_ID,\n type: SETTINGS_PLUGIN,\n properties: {\n label: ['app settings label', { ns: SETTINGS_PLUGIN }],\n icon: 'ph--gear--regular',\n disposition: 'pin-end',\n position: 'hoist',\n testId: 'treeView.appSettings',\n },\n },\n ],\n }),\n createExtension({\n id: `${SETTINGS_PLUGIN}/core-plugins`,\n filter: (node): node is Node<null> => node.id === SETTINGS_ID,\n connector: () => {\n const manager = context.requestCapability(Capabilities.PluginManager);\n const [settingsStore] = context.requestCapabilities(Capabilities.SettingsStore);\n return [\n ...manager.plugins\n .filter((plugin) => manager.core.includes(plugin.meta.id))\n .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {\n const settings = settingsStore?.getStore(plugin.meta.id);\n if (!settings) {\n return null;\n }\n\n return [plugin.meta, settings];\n })\n .filter(isNonNullable)\n .map(([meta, settings]) => ({\n id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,\n type: 'category',\n data: settings,\n properties: {\n label: meta.name ?? meta.id,\n icon: meta.icon ?? 'ph--circle--regular',\n },\n })),\n\n {\n id: `${SETTINGS_KEY}:custom-plugins`,\n type: 'collection',\n properties: {\n label: ['custom plugins label', { ns: SETTINGS_PLUGIN }],\n icon: 'ph--squares-four--regular',\n role: 'branch',\n },\n },\n ];\n },\n }),\n createExtension({\n id: `${SETTINGS_PLUGIN}/custom-plugins`,\n filter: (node): node is Node<null> => node.id === `${SETTINGS_KEY}:custom-plugins`,\n connector: () => {\n const manager = context.requestCapability(Capabilities.PluginManager);\n const [settingsStore] = context.requestCapabilities(Capabilities.SettingsStore);\n return manager.plugins\n .filter((plugin) => !manager.core.includes(plugin.meta.id))\n .map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {\n const settings = settingsStore?.getStore(plugin.meta.id);\n if (!settings) {\n return null;\n }\n\n return [plugin.meta, settings];\n })\n .filter(isNonNullable)\n .map(([meta, settings]) => ({\n id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,\n type: 'category',\n data: settings,\n properties: {\n label: meta.name ?? meta.id,\n icon: meta.icon ?? 'ph--circle--regular',\n },\n }));\n },\n }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAIA,SAASA,uBAAkC;AAE3C,SAASC,qBAAqB;AAO9B,IAAA,4BAAe,CAACC,YACdC,YAAYC,aAAaC,iBAAiB;EACxCC,gBAAgB;IACdC,IAAI,GAAGC,eAAAA;IACPC,QAAQ,CAACC,SAA6BA,KAAKH,OAAO;IAClDI,SAAS,MAAM;MACb;QACEJ,IAAIC;QACJI,MAAM,YAAA;AACJ,gBAAM,EAAEC,iBAAiBC,SAAQ,IAAKZ,QAAQa,kBAAkBX,aAAaY,gBAAgB;AAC7F,gBAAMF,SAASG,aAAaC,eAAeC,IAAI,CAAA;QACjD;QACAC,YAAY;UACVC,OAAO;YAAC;YAAuB;cAAEC,IAAId;YAAgB;;UACrDe,MAAM;UACNC,YAAY;YACVC,OAAO;YACPC,SAAS;UACX;QACF;MACF;;EAEJ,CAAA;EACApB,gBAAgB;IACdC,IAAI,GAAGC,eAAAA;IACPC,QAAQ,CAACC,SAA6BA,KAAKH,OAAO;IAClDoB,WAAW,MAAM;MACf;QACEpB,IAAIqB;QACJC,MAAMrB;QACNY,YAAY;UACVC,OAAO;YAAC;YAAsB;cAAEC,IAAId;YAAgB;;UACpDe,MAAM;UACNO,aAAa;UACbC,UAAU;UACVC,QAAQ;QACV;MACF;;EAEJ,CAAA;EACA1B,gBAAgB;IACdC,IAAI,GAAGC,eAAAA;IACPC,QAAQ,CAACC,SAA6BA,KAAKH,OAAOqB;IAClDD,WAAW,MAAA;AACT,YAAMM,UAAU/B,QAAQa,kBAAkBX,aAAa8B,aAAa;AACpE,YAAM,CAACC,aAAAA,IAAiBjC,QAAQkC,oBAAoBhC,aAAaiC,aAAa;AAC9E,aAAO;WACFJ,QAAQK,QACR7B,OAAO,CAAC8B,WAAWN,QAAQO,KAAKC,SAASF,OAAOG,KAAKnC,EAAE,CAAA,EACvDoC,IAAI,CAACJ,WAAAA;AACJ,gBAAMK,WAAWT,eAAeU,SAASN,OAAOG,KAAKnC,EAAE;AACvD,cAAI,CAACqC,UAAU;AACb,mBAAO;UACT;AAEA,iBAAO;YAACL,OAAOG;YAAME;;QACvB,CAAA,EACCnC,OAAOqC,aAAAA,EACPH,IAAI,CAAC,CAACD,MAAME,QAAAA,OAAe;UAC1BrC,IAAI,GAAGwC,YAAAA,IAAgBL,KAAKnC,GAAGyC,WAAW,KAAK,GAAA,CAAA;UAC/CnB,MAAM;UACNjB,MAAMgC;UACNxB,YAAY;YACVC,OAAOqB,KAAKO,QAAQP,KAAKnC;YACzBgB,MAAMmB,KAAKnB,QAAQ;UACrB;QACF,EAAA;QAEF;UACEhB,IAAI,GAAGwC,YAAAA;UACPlB,MAAM;UACNT,YAAY;YACVC,OAAO;cAAC;cAAwB;gBAAEC,IAAId;cAAgB;;YACtDe,MAAM;YACN2B,MAAM;UACR;QACF;;IAEJ;EACF,CAAA;EACA5C,gBAAgB;IACdC,IAAI,GAAGC,eAAAA;IACPC,QAAQ,CAACC,SAA6BA,KAAKH,OAAO,GAAGwC,YAAAA;IACrDpB,WAAW,MAAA;AACT,YAAMM,UAAU/B,QAAQa,kBAAkBX,aAAa8B,aAAa;AACpE,YAAM,CAACC,aAAAA,IAAiBjC,QAAQkC,oBAAoBhC,aAAaiC,aAAa;AAC9E,aAAOJ,QAAQK,QACZ7B,OAAO,CAAC8B,WAAW,CAACN,QAAQO,KAAKC,SAASF,OAAOG,KAAKnC,EAAE,CAAA,EACxDoC,IAAI,CAACJ,WAAAA;AACJ,cAAMK,WAAWT,eAAeU,SAASN,OAAOG,KAAKnC,EAAE;AACvD,YAAI,CAACqC,UAAU;AACb,iBAAO;QACT;AAEA,eAAO;UAACL,OAAOG;UAAME;;MACvB,CAAA,EACCnC,OAAOqC,aAAAA,EACPH,IAAI,CAAC,CAACD,MAAME,QAAAA,OAAe;QAC1BrC,IAAI,GAAGwC,YAAAA,IAAgBL,KAAKnC,GAAGyC,WAAW,KAAK,GAAA,CAAA;QAC/CnB,MAAM;QACNjB,MAAMgC;QACNxB,YAAY;UACVC,OAAOqB,KAAKO,QAAQP,KAAKnC;UACzBgB,MAAMmB,KAAKnB,QAAQ;QACrB;MACF,EAAA;IACJ;EACF,CAAA;CACD;",
|
|
6
|
+
"names": ["createExtension", "isNonNullable", "context", "contributes", "Capabilities", "AppGraphBuilder", "createExtension", "id", "SETTINGS_PLUGIN", "filter", "node", "actions", "data", "dispatchPromise", "dispatch", "requestCapability", "IntentDispatcher", "createIntent", "SettingsAction", "Open", "properties", "label", "ns", "icon", "keyBinding", "macos", "windows", "connector", "SETTINGS_ID", "type", "disposition", "position", "testId", "manager", "PluginManager", "settingsStore", "requestCapabilities", "SettingsStore", "plugins", "plugin", "core", "includes", "meta", "map", "settings", "getStore", "isNonNullable", "SETTINGS_KEY", "replaceAll", "name", "role"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// packages/sdk/app-framework/src/plugin-settings/actions.ts
|
|
4
|
+
import { Schema as S } from "@effect/schema";
|
|
5
|
+
var SETTINGS_PLUGIN = "dxos.org/plugin/settings";
|
|
6
|
+
var SETTINGS_ACTION = `${SETTINGS_PLUGIN}/action`;
|
|
7
|
+
var SETTINGS_ID = "!dxos:settings";
|
|
8
|
+
var SETTINGS_KEY = "settings";
|
|
9
|
+
var SettingsAction;
|
|
10
|
+
(function(SettingsAction2) {
|
|
11
|
+
class Open extends S.TaggedClass()(`${SETTINGS_ACTION}/open`, {
|
|
12
|
+
input: S.Struct({
|
|
13
|
+
plugin: S.optional(S.String)
|
|
14
|
+
}),
|
|
15
|
+
output: S.Void
|
|
16
|
+
}) {
|
|
17
|
+
}
|
|
18
|
+
SettingsAction2.Open = Open;
|
|
19
|
+
class OpenPluginRegistry extends S.TaggedClass()(`${SETTINGS_ACTION}/open-plugin-registry`, {
|
|
20
|
+
input: S.Void,
|
|
21
|
+
output: S.Void
|
|
22
|
+
}) {
|
|
23
|
+
}
|
|
24
|
+
SettingsAction2.OpenPluginRegistry = OpenPluginRegistry;
|
|
25
|
+
})(SettingsAction || (SettingsAction = {}));
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
SETTINGS_PLUGIN,
|
|
29
|
+
SETTINGS_ACTION,
|
|
30
|
+
SETTINGS_ID,
|
|
31
|
+
SETTINGS_KEY,
|
|
32
|
+
SettingsAction
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=chunk-CBT75GCX.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugin-settings/actions.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Schema as S } from '@effect/schema';\n\nexport const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';\nexport const SETTINGS_ACTION = `${SETTINGS_PLUGIN}/action`;\nexport const SETTINGS_ID = '!dxos:settings';\nexport const SETTINGS_KEY = 'settings';\n\nexport namespace SettingsAction {\n export class Open extends S.TaggedClass<Open>()(`${SETTINGS_ACTION}/open`, {\n input: S.Struct({\n plugin: S.optional(S.String),\n }),\n output: S.Void,\n }) {}\n\n export class OpenPluginRegistry extends S.TaggedClass<OpenPluginRegistry>()(\n `${SETTINGS_ACTION}/open-plugin-registry`,\n {\n input: S.Void,\n output: S.Void,\n },\n ) {}\n}\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,UAAUC,SAAS;AAErB,IAAMC,kBAAkB;AACxB,IAAMC,kBAAkB,GAAGD,eAAAA;AAC3B,IAAME,cAAc;AACpB,IAAMC,eAAe;;UAEXC,iBAAAA;EACR,MAAMC,aAAaC,EAAEC,YAAW,EAAS,GAAGN,eAAAA,SAAwB;IACzEO,OAAOF,EAAEG,OAAO;MACdC,QAAQJ,EAAEK,SAASL,EAAEM,MAAM;IAC7B,CAAA;IACAC,QAAQP,EAAEQ;EACZ,CAAA,EAAA;EAAI;kBALST,OAAAA;EAON,MAAMU,2BAA2BT,EAAEC,YAAW,EACnD,GAAGN,eAAAA,yBACH;IACEO,OAAOF,EAAEQ;IACTD,QAAQP,EAAEQ;EACZ,CAAA,EAAA;EACC;kBANUC,qBAAAA;AAOf,GAfiBX,mBAAAA,iBAAAA,CAAAA,EAAAA;",
|
|
6
|
+
"names": ["Schema", "S", "SETTINGS_PLUGIN", "SETTINGS_ACTION", "SETTINGS_ID", "SETTINGS_KEY", "SettingsAction", "Open", "S", "TaggedClass", "input", "Struct", "plugin", "optional", "String", "output", "Void", "OpenPluginRegistry"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
Capabilities,
|
|
4
|
+
Events,
|
|
5
|
+
PluginManager
|
|
6
|
+
} from "./chunk-TVIR2PHY.mjs";
|
|
7
|
+
|
|
8
|
+
// packages/sdk/app-framework/src/react/PluginManagerProvider.ts
|
|
9
|
+
import { createContext, useContext } from "react";
|
|
10
|
+
import { raise } from "@dxos/debug";
|
|
11
|
+
var PluginManagerContext = createContext(void 0);
|
|
12
|
+
var usePluginManager = () => useContext(PluginManagerContext) ?? raise(new Error("Missing PluginManagerContext"));
|
|
13
|
+
var PluginManagerProvider = PluginManagerContext.Provider;
|
|
14
|
+
|
|
15
|
+
// packages/sdk/app-framework/src/react/useCapabilities.ts
|
|
16
|
+
import { computed } from "@preact/signals-core";
|
|
17
|
+
import { useMemo } from "react";
|
|
18
|
+
var useCapabilities = (interfaceDef, filter) => {
|
|
19
|
+
const manager = usePluginManager();
|
|
20
|
+
const signal = useMemo(() => computed(() => manager.context.requestCapabilities(interfaceDef, filter)), [
|
|
21
|
+
interfaceDef
|
|
22
|
+
]);
|
|
23
|
+
return signal.value;
|
|
24
|
+
};
|
|
25
|
+
var useCapability = (interfaceDef, filter) => {
|
|
26
|
+
const manager = usePluginManager();
|
|
27
|
+
const signal = useMemo(() => computed(() => manager.context.requestCapability(interfaceDef, filter)), [
|
|
28
|
+
interfaceDef
|
|
29
|
+
]);
|
|
30
|
+
return signal.value;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// packages/sdk/app-framework/src/react/common.ts
|
|
34
|
+
var useIntentDispatcher = () => useCapability(Capabilities.IntentDispatcher);
|
|
35
|
+
var useAppGraph = () => useCapability(Capabilities.AppGraph);
|
|
36
|
+
var useLayout = () => useCapability(Capabilities.Layout);
|
|
37
|
+
|
|
38
|
+
// packages/sdk/app-framework/src/react/ErrorBoundary.tsx
|
|
39
|
+
import React, { Component } from "react";
|
|
40
|
+
var ErrorBoundary = class extends Component {
|
|
41
|
+
constructor(props) {
|
|
42
|
+
super(props);
|
|
43
|
+
this.state = {
|
|
44
|
+
error: void 0
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
static getDerivedStateFromError(error) {
|
|
48
|
+
return {
|
|
49
|
+
error
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
componentDidUpdate(prevProps) {
|
|
53
|
+
if (prevProps.data !== this.props.data) {
|
|
54
|
+
this.resetError();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
if (this.state.error) {
|
|
59
|
+
return /* @__PURE__ */ React.createElement(this.props.fallback, {
|
|
60
|
+
data: this.props.data,
|
|
61
|
+
error: this.state.error,
|
|
62
|
+
reset: this.resetError
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
return this.props.children;
|
|
66
|
+
}
|
|
67
|
+
resetError() {
|
|
68
|
+
this.setState({
|
|
69
|
+
error: void 0
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// packages/sdk/app-framework/src/react/Surface.tsx
|
|
75
|
+
import React2, { memo, forwardRef, Suspense, useMemo as useMemo2 } from "react";
|
|
76
|
+
import { useDefaultValue } from "@dxos/react-hooks";
|
|
77
|
+
import { byPosition } from "@dxos/util";
|
|
78
|
+
var useSurfaces = () => {
|
|
79
|
+
const surfaces = useCapabilities(Capabilities.ReactSurface);
|
|
80
|
+
return useMemo2(() => surfaces.flat(), [
|
|
81
|
+
surfaces
|
|
82
|
+
]);
|
|
83
|
+
};
|
|
84
|
+
var findCandidates = (surfaces, { role, data }) => {
|
|
85
|
+
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);
|
|
86
|
+
};
|
|
87
|
+
var isSurfaceAvailable = (context, { role, data }) => {
|
|
88
|
+
const surfaces = context.requestCapabilities(Capabilities.ReactSurface);
|
|
89
|
+
const candidates = findCandidates(surfaces.flat(), {
|
|
90
|
+
role,
|
|
91
|
+
data
|
|
92
|
+
});
|
|
93
|
+
return candidates.length > 0;
|
|
94
|
+
};
|
|
95
|
+
var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef(({ id: _id, role, data: _data, limit, fallback, placeholder, ...rest }, forwardedRef) => {
|
|
96
|
+
const surfaces = useSurfaces();
|
|
97
|
+
const data = useDefaultValue(_data, () => ({}));
|
|
98
|
+
const definitions = findCandidates(surfaces, {
|
|
99
|
+
role,
|
|
100
|
+
data
|
|
101
|
+
});
|
|
102
|
+
const candidates = limit ? definitions.slice(0, limit) : definitions;
|
|
103
|
+
const nodes = candidates.map(({ component: Component2, id }) => /* @__PURE__ */ React2.createElement(Component2, {
|
|
104
|
+
ref: forwardedRef,
|
|
105
|
+
key: id,
|
|
106
|
+
id,
|
|
107
|
+
role,
|
|
108
|
+
data,
|
|
109
|
+
limit,
|
|
110
|
+
...rest
|
|
111
|
+
}));
|
|
112
|
+
const suspense = placeholder ? /* @__PURE__ */ React2.createElement(Suspense, {
|
|
113
|
+
fallback: placeholder
|
|
114
|
+
}, nodes) : nodes;
|
|
115
|
+
return fallback ? /* @__PURE__ */ React2.createElement(ErrorBoundary, {
|
|
116
|
+
data,
|
|
117
|
+
fallback
|
|
118
|
+
}, suspense) : suspense;
|
|
119
|
+
}));
|
|
120
|
+
Surface.displayName = "Surface";
|
|
121
|
+
|
|
122
|
+
// packages/sdk/app-framework/src/react/useIntentResolver.ts
|
|
123
|
+
import { useEffect } from "react";
|
|
124
|
+
var useIntentResolver = (module, resolver) => {
|
|
125
|
+
const manager = usePluginManager();
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
manager.context.contributeCapability({
|
|
128
|
+
module,
|
|
129
|
+
interface: Capabilities.IntentResolver,
|
|
130
|
+
implementation: resolver
|
|
131
|
+
});
|
|
132
|
+
return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);
|
|
133
|
+
}, [
|
|
134
|
+
module,
|
|
135
|
+
resolver
|
|
136
|
+
]);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// packages/sdk/app-framework/src/App.tsx
|
|
140
|
+
import { effect } from "@preact/signals-core";
|
|
141
|
+
import React3 from "react";
|
|
142
|
+
import { invariant } from "@dxos/invariant";
|
|
143
|
+
import { create } from "@dxos/live-object";
|
|
144
|
+
|
|
145
|
+
// packages/sdk/app-framework/src/helpers.ts
|
|
146
|
+
var topologicalSort = (nodes) => {
|
|
147
|
+
const getDependencies = (nodeId, seen = /* @__PURE__ */ new Set(), path = /* @__PURE__ */ new Set()) => {
|
|
148
|
+
if (path.has(nodeId)) {
|
|
149
|
+
throw new Error(`Circular dependency detected involving ${nodeId}`);
|
|
150
|
+
}
|
|
151
|
+
if (seen.has(nodeId)) {
|
|
152
|
+
return [];
|
|
153
|
+
}
|
|
154
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
155
|
+
if (!node) {
|
|
156
|
+
throw new Error(`Node ${nodeId} not found but is listed as a dependency`);
|
|
157
|
+
}
|
|
158
|
+
const newPath = /* @__PURE__ */ new Set([
|
|
159
|
+
...path,
|
|
160
|
+
nodeId
|
|
161
|
+
]);
|
|
162
|
+
const newSeen = /* @__PURE__ */ new Set([
|
|
163
|
+
...seen,
|
|
164
|
+
nodeId
|
|
165
|
+
]);
|
|
166
|
+
const dependsOn = node.dependsOn ?? [];
|
|
167
|
+
return [
|
|
168
|
+
...dependsOn.flatMap((depId) => getDependencies(depId, newSeen, newPath)),
|
|
169
|
+
nodeId
|
|
170
|
+
];
|
|
171
|
+
};
|
|
172
|
+
const allDependencies = nodes.map((node) => node.id).flatMap((id) => getDependencies(id)).filter((id, index, self) => self.indexOf(id) === index);
|
|
173
|
+
return allDependencies.map((id) => nodes.find((node) => node.id === id)).filter((node) => node !== void 0);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// packages/sdk/app-framework/src/App.tsx
|
|
177
|
+
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/sdk/app-framework/src/App.tsx";
|
|
178
|
+
var ENABLED_KEY = "dxos.org/app-framework/enabled";
|
|
179
|
+
var createApp = ({ pluginManager, pluginLoader: _pluginLoader, plugins = [], core = plugins.map(({ meta }) => meta.id), defaults = [], placeholder = null, fallback = DefaultFallback, cacheEnabled = false }) => {
|
|
180
|
+
const pluginLoader = _pluginLoader ?? ((id) => {
|
|
181
|
+
const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
|
|
182
|
+
invariant(plugin, `Plugin not found: ${id}`, {
|
|
183
|
+
F: __dxlog_file,
|
|
184
|
+
L: 68,
|
|
185
|
+
S: void 0,
|
|
186
|
+
A: [
|
|
187
|
+
"plugin",
|
|
188
|
+
"`Plugin not found: ${id}`"
|
|
189
|
+
]
|
|
190
|
+
});
|
|
191
|
+
return plugin;
|
|
192
|
+
});
|
|
193
|
+
const state = create({
|
|
194
|
+
ready: false,
|
|
195
|
+
error: null
|
|
196
|
+
});
|
|
197
|
+
const cached = JSON.parse(localStorage.getItem(ENABLED_KEY) ?? "[]");
|
|
198
|
+
const enabled = cacheEnabled && cached.length > 0 ? cached : defaults;
|
|
199
|
+
const manager = pluginManager ?? new PluginManager({
|
|
200
|
+
pluginLoader,
|
|
201
|
+
plugins,
|
|
202
|
+
core,
|
|
203
|
+
enabled
|
|
204
|
+
});
|
|
205
|
+
manager.activation.on(({ event, state: _state, error }) => {
|
|
206
|
+
if (!state.ready && event === Events.Startup.id) {
|
|
207
|
+
state.ready = _state === "activated";
|
|
208
|
+
}
|
|
209
|
+
if (error && !state.ready && !state.error) {
|
|
210
|
+
state.error = error;
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
effect(() => {
|
|
214
|
+
cacheEnabled && localStorage.setItem(ENABLED_KEY, JSON.stringify(manager.enabled));
|
|
215
|
+
});
|
|
216
|
+
manager.context.contributeCapability({
|
|
217
|
+
interface: Capabilities.PluginManager,
|
|
218
|
+
implementation: manager,
|
|
219
|
+
module: "dxos.org/app-framework/plugin-manager"
|
|
220
|
+
});
|
|
221
|
+
setupDevtools(manager);
|
|
222
|
+
void manager.activate(Events.SetupReactSurface);
|
|
223
|
+
void manager.activate(Events.Startup);
|
|
224
|
+
return () => /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
225
|
+
fallback
|
|
226
|
+
}, /* @__PURE__ */ React3.createElement(PluginManagerProvider, {
|
|
227
|
+
value: manager
|
|
228
|
+
}, /* @__PURE__ */ React3.createElement(App, {
|
|
229
|
+
placeholder,
|
|
230
|
+
state
|
|
231
|
+
})));
|
|
232
|
+
};
|
|
233
|
+
var App = ({ placeholder, state }) => {
|
|
234
|
+
const reactContexts = useCapabilities(Capabilities.ReactContext);
|
|
235
|
+
const reactRoots = useCapabilities(Capabilities.ReactRoot);
|
|
236
|
+
if (state.error) {
|
|
237
|
+
throw state.error;
|
|
238
|
+
}
|
|
239
|
+
if (!state.ready) {
|
|
240
|
+
return /* @__PURE__ */ React3.createElement(React3.Fragment, null, placeholder);
|
|
241
|
+
}
|
|
242
|
+
const ComposedContext = composeContexts(reactContexts);
|
|
243
|
+
return /* @__PURE__ */ React3.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ React3.createElement(Component2, {
|
|
244
|
+
key: id
|
|
245
|
+
})));
|
|
246
|
+
};
|
|
247
|
+
var DefaultFallback = ({ error }) => {
|
|
248
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
249
|
+
style: {
|
|
250
|
+
padding: "1rem"
|
|
251
|
+
}
|
|
252
|
+
}, /* @__PURE__ */ React3.createElement("h1", {
|
|
253
|
+
style: {
|
|
254
|
+
fontSize: "1.2rem",
|
|
255
|
+
fontWeight: 700,
|
|
256
|
+
margin: "0.5rem 0"
|
|
257
|
+
}
|
|
258
|
+
}, error.message), /* @__PURE__ */ React3.createElement("pre", null, error.stack));
|
|
259
|
+
};
|
|
260
|
+
var composeContexts = (contexts) => {
|
|
261
|
+
if (contexts.length === 0) {
|
|
262
|
+
return ({ children }) => /* @__PURE__ */ React3.createElement(React3.Fragment, null, children);
|
|
263
|
+
}
|
|
264
|
+
return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React3.createElement(Acc, null, /* @__PURE__ */ React3.createElement(Next, null, children)));
|
|
265
|
+
};
|
|
266
|
+
var setupDevtools = (manager) => {
|
|
267
|
+
globalThis.composer ??= {};
|
|
268
|
+
globalThis.composer.manager = manager;
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
export {
|
|
272
|
+
usePluginManager,
|
|
273
|
+
PluginManagerProvider,
|
|
274
|
+
useCapabilities,
|
|
275
|
+
useCapability,
|
|
276
|
+
useIntentDispatcher,
|
|
277
|
+
useAppGraph,
|
|
278
|
+
useLayout,
|
|
279
|
+
ErrorBoundary,
|
|
280
|
+
useSurfaces,
|
|
281
|
+
isSurfaceAvailable,
|
|
282
|
+
Surface,
|
|
283
|
+
useIntentResolver,
|
|
284
|
+
createApp
|
|
285
|
+
};
|
|
286
|
+
//# sourceMappingURL=chunk-JDAHZRYQ.mjs.map
|