@dxos/app-framework 0.7.4 → 0.7.5-feature-compute.4d9d99a
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/chunk-EGGZVV7Q.mjs +1595 -0
- package/dist/lib/browser/chunk-EGGZVV7Q.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +136 -527
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +67 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/node/chunk-UBX6GP2N.cjs +1639 -0
- package/dist/lib/node/chunk-UBX6GP2N.cjs.map +7 -0
- package/dist/lib/node/index.cjs +141 -551
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/testing/index.cjs +91 -0
- package/dist/lib/node/testing/index.cjs.map +7 -0
- package/dist/lib/node-esm/chunk-HG5P55WF.mjs +1597 -0
- package/dist/lib/node-esm/chunk-HG5P55WF.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +136 -527
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +68 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -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 +340 -0
- package/dist/types/src/common/capabilities.d.ts.map +1 -0
- package/dist/types/src/common/events.d.ts +41 -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/{plugins/common → common}/index.d.ts +3 -1
- package/dist/types/src/common/index.d.ts.map +1 -0
- package/dist/types/src/common/layout.d.ts +165 -0
- package/dist/types/src/common/layout.d.ts.map +1 -0
- package/dist/types/src/{plugins/common → common}/navigation.d.ts +77 -32
- package/dist/types/src/common/navigation.d.ts.map +1 -0
- package/dist/types/src/common/surface.d.ts +68 -0
- package/dist/types/src/common/surface.d.ts.map +1 -0
- package/dist/types/src/{plugins/common → common}/translations.d.ts +0 -11
- package/dist/types/src/common/translations.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.d.ts +90 -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 +126 -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 +94 -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 +6 -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 +6 -0
- package/dist/types/src/playground/generator/Main.d.ts.map +1 -0
- package/dist/types/src/playground/generator/Toolbar.d.ts +6 -0
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -0
- package/dist/types/src/playground/generator/generator.d.ts +5 -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 +6 -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 +10 -0
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/IntentContext.d.ts +8 -0
- package/dist/types/src/plugin-intent/IntentContext.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 +6 -0
- package/dist/types/src/plugin-intent/index.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +106 -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 +2 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent.d.ts +68 -0
- 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 +17 -0
- package/dist/types/src/plugin-settings/actions.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/react/ErrorBoundary.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/index.d.ts +5 -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/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 +10 -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/tsconfig.tsbuildinfo +1 -0
- package/package.json +30 -14
- package/project.json +2 -1
- package/src/App.tsx +138 -34
- package/src/common/capabilities.ts +82 -0
- package/src/common/events.ts +63 -0
- package/src/common/file.ts +22 -0
- package/src/common/graph.ts +30 -0
- package/src/{plugins/common → common}/index.ts +3 -1
- package/src/common/layout.ts +157 -0
- package/src/{plugins/common → common}/navigation.ts +59 -45
- package/src/common/surface.ts +81 -0
- package/src/common/translations.ts +18 -0
- package/src/core/capabilities.test.ts +116 -0
- package/src/core/capabilities.ts +213 -0
- package/src/core/events.ts +58 -0
- package/src/core/index.ts +8 -0
- package/src/core/manager.test.ts +567 -0
- package/src/core/manager.ts +497 -0
- package/src/core/plugin.ts +128 -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 +23 -0
- package/src/playground/generator/index.ts +6 -0
- package/src/playground/generator/plugin.ts +18 -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 +28 -0
- package/src/playground/logger/index.ts +5 -0
- package/src/playground/logger/plugin.ts +33 -0
- package/src/playground/logger/schema.ts +12 -0
- package/src/playground/playground.stories.tsx +34 -0
- package/src/plugin-intent/IntentContext.tsx +34 -0
- package/src/plugin-intent/IntentPlugin.tsx +60 -0
- package/src/plugin-intent/actions.ts +22 -0
- package/src/plugin-intent/errors.ts +39 -0
- package/src/plugin-intent/index.ts +9 -0
- package/src/plugin-intent/intent-dispatcher.test.ts +280 -0
- package/src/plugin-intent/intent-dispatcher.ts +269 -0
- package/src/plugin-intent/intent.ts +146 -0
- package/src/plugin-settings/SettingsPlugin.ts +29 -0
- package/src/plugin-settings/actions.ts +17 -0
- package/src/plugin-settings/index.ts +6 -0
- package/src/react/PluginManagerProvider.ts +22 -0
- package/src/react/Surface.tsx +72 -0
- package/src/react/index.ts +8 -0
- package/src/react/useCapabilities.ts +40 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/withPluginManager.stories.tsx +47 -0
- package/src/testing/withPluginManager.tsx +67 -0
- package/tsconfig.json +51 -2
- package/dist/lib/browser/chunk-3E7RY3CE.mjs +0 -72
- package/dist/lib/browser/chunk-3E7RY3CE.mjs.map +0 -7
- package/dist/lib/browser/chunk-653Y45CL.mjs +0 -41
- package/dist/lib/browser/chunk-653Y45CL.mjs.map +0 -7
- package/dist/lib/browser/chunk-FRXJ25VI.mjs +0 -214
- package/dist/lib/browser/chunk-FRXJ25VI.mjs.map +0 -7
- package/dist/lib/browser/chunk-YXM35XRE.mjs +0 -213
- package/dist/lib/browser/chunk-YXM35XRE.mjs.map +0 -7
- package/dist/lib/browser/plugin-intent-LU4KL2RO.mjs +0 -22
- package/dist/lib/browser/plugin-intent-LU4KL2RO.mjs.map +0 -7
- package/dist/lib/browser/plugin-settings-OM3G2QFY.mjs +0 -11
- package/dist/lib/browser/plugin-settings-OM3G2QFY.mjs.map +0 -7
- package/dist/lib/browser/plugin-surface-LECZMKSQ.mjs +0 -24
- package/dist/lib/browser/plugin-surface-LECZMKSQ.mjs.map +0 -7
- package/dist/lib/node/chunk-JZ2JVKRY.cjs +0 -58
- package/dist/lib/node/chunk-JZ2JVKRY.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-QSVP5HOW.cjs +0 -238
- package/dist/lib/node/chunk-QSVP5HOW.cjs.map +0 -7
- package/dist/lib/node/chunk-SOVLKUWI.cjs +0 -236
- package/dist/lib/node/chunk-SOVLKUWI.cjs.map +0 -7
- package/dist/lib/node/plugin-intent-FVFR2LKB.cjs +0 -43
- package/dist/lib/node/plugin-intent-FVFR2LKB.cjs.map +0 -7
- package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs +0 -32
- package/dist/lib/node/plugin-settings-OZ6IKAE5.cjs.map +0 -7
- package/dist/lib/node/plugin-surface-YWDRXQTD.cjs +0 -45
- package/dist/lib/node/plugin-surface-YWDRXQTD.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-2R4GVK7O.mjs +0 -215
- package/dist/lib/node-esm/chunk-2R4GVK7O.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/chunk-YFMFQBB4.mjs +0 -214
- package/dist/lib/node-esm/chunk-YFMFQBB4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs +0 -43
- package/dist/lib/node-esm/chunk-YNU7FTGJ.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-intent-V7ER24Y6.mjs +0 -23
- package/dist/lib/node-esm/plugin-intent-V7ER24Y6.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs +0 -12
- package/dist/lib/node-esm/plugin-settings-37UVWF2V.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-surface-TEU42XQN.mjs +0 -25
- package/dist/lib/node-esm/plugin-surface-TEU42XQN.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.map +0 -1
- package/dist/types/src/plugins/common/layout.d.ts +0 -202
- 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.map +0 -1
- 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 -21
- 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 -4
- package/dist/types/src/plugins/plugin-host/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/plugin.d.ts +0 -98
- 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 +0 -21
- 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/helpers.d.ts +0 -6
- package/dist/types/src/plugins/plugin-intent/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/index.d.ts +0 -6
- package/dist/types/src/plugins/plugin-intent/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/intent.d.ts +0 -81
- package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/meta.d.ts +0 -5
- package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/provides.d.ts +0 -20
- 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 -13
- 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 -62
- package/dist/types/src/plugins/plugin-surface/Surface.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/SurfaceRootContext.d.ts +0 -39
- package/dist/types/src/plugins/plugin-surface/SurfaceRootContext.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 -16
- 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 -155
- package/src/plugins/common/metadata.ts +0 -29
- 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 -96
- 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 -8
- package/src/plugins/plugin-host/plugin.test.ts +0 -158
- package/src/plugins/plugin-host/plugin.ts +0 -126
- package/src/plugins/plugin-intent/IntentContext.tsx +0 -49
- package/src/plugins/plugin-intent/IntentPlugin.tsx +0 -151
- package/src/plugins/plugin-intent/helpers.ts +0 -11
- package/src/plugins/plugin-intent/index.ts +0 -12
- package/src/plugins/plugin-intent/intent.ts +0 -101
- package/src/plugins/plugin-intent/meta.ts +0 -9
- package/src/plugins/plugin-intent/provides.ts +0 -38
- 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 -29
- package/src/plugins/plugin-surface/Surface.tsx +0 -195
- package/src/plugins/plugin-surface/SurfacePlugin.tsx +0 -33
- package/src/plugins/plugin-surface/SurfaceRootContext.tsx +0 -60
- 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 -26
- /package/dist/types/src/{plugins/plugin-surface → react}/ErrorBoundary.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/core/capabilities.ts", "../../../src/core/events.ts", "../../../src/core/manager.ts", "../../../src/core/plugin.ts", "../../../src/common/capabilities.ts", "../../../src/common/events.ts", "../../../src/common/file.ts", "../../../src/plugin-intent/intent.ts", "../../../src/plugin-intent/actions.ts", "../../../src/plugin-intent/intent-dispatcher.ts", "../../../src/plugin-intent/errors.ts", "../../../src/react/ErrorBoundary.tsx", "../../../src/react/PluginManagerProvider.ts", "../../../src/react/useCapabilities.ts", "../../../src/react/Surface.tsx", "../../../src/common/layout.ts", "../../../src/plugin-intent/IntentContext.tsx", "../../../src/plugin-intent/IntentPlugin.tsx", "../../../src/common/navigation.ts", "../../../src/common/surface.ts", "../../../src/common/translations.ts", "../../../src/App.tsx", "../../../src/helpers.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Interface definition for a capability.\n */\n//\n// Copyright 2025 DXOS.org\n//\n\nimport { effect, untracked } from '@preact/signals-core';\nimport { type Effect } from 'effect';\n\nimport { Trigger } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { create } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type ActivationEvent } from './events';\n\nconst InterfaceDefTypeId: unique symbol = Symbol.for('InterfaceDefTypeId');\n\n/**\n * The interface definition of a capability.\n */\nexport type InterfaceDef<T> = {\n [InterfaceDefTypeId]: T;\n identifier: string;\n};\n\n/**\n * Helper to define the interface of a capability.\n */\nexport const defineCapability = <T>(identifier: string) => {\n return { identifier } as InterfaceDef<T>;\n};\n\n/**\n * Functionality contributed to the application by a plugin module.\n */\nexport type Capability<T> = {\n /**\n * The interface definition of the capability.\n */\n interface: InterfaceDef<T>;\n\n /**\n * The implementation of the capability.\n */\n implementation: T;\n\n /**\n * Called when the capability is deactivated.\n */\n deactivate?: () => MaybePromise<void> | Effect.Effect<void, Error>;\n};\n\nexport type AnyCapability = Capability<any>;\n\ntype PluginsContextOptions = {\n activate: (event: ActivationEvent) => MaybePromise<boolean>;\n reset: (event: ActivationEvent) => MaybePromise<boolean>;\n};\n\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nclass CapabilityImpl<T> {\n constructor(\n readonly moduleId: string,\n readonly implementation: T,\n ) {}\n}\n\n/**\n * Helper to define the implementation of a capability.\n */\nexport const contributes = <T>(\n interfaceDef: Capability<T>['interface'],\n implementation: Capability<T>['implementation'],\n deactivate?: Capability<T>['deactivate'],\n): Capability<T> => {\n return { interface: interfaceDef, implementation, deactivate } satisfies Capability<T>;\n};\n\ntype LazyCapability<T, U> = () => Promise<{ default: (props: T) => MaybePromise<Capability<U>> }>;\n\n/**\n * Helper to define a lazily loaded implementation of a capability.\n */\nexport const lazy =\n <T, U>(c: LazyCapability<T, U>) =>\n (props?: T): Promise<Capability<U>> =>\n c().then(({ default: getCapability }) => {\n return getCapability(props as T);\n });\n\n/**\n * Context which is passed to plugins, allowing them to interact with each other.\n */\nexport class PluginsContext {\n private readonly _definedCapabilities = new Map<string, CapabilityImpl<unknown>[]>();\n\n /**\n * Activates plugins based on the activation event.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\n readonly activate: PluginsContextOptions['activate'];\n\n /**\n * Re-activates the modules that were activated by the event.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\n readonly reset: PluginsContextOptions['reset'];\n\n constructor({ activate, reset }: PluginsContextOptions) {\n this.activate = activate;\n this.reset = reset;\n }\n\n /**\n * @internal\n */\n contributeCapability<T>({\n module: moduleId,\n interface: interfaceDef,\n implementation,\n }: {\n module: string;\n interface: InterfaceDef<T>;\n implementation: T;\n }) {\n let current = this._definedCapabilities.get(interfaceDef.identifier);\n if (!current) {\n const object = create<{ value: CapabilityImpl<unknown>[] }>({ value: [] });\n current = untracked(() => object.value);\n this._definedCapabilities.set(interfaceDef.identifier, current);\n }\n\n current.push(new CapabilityImpl(moduleId, implementation));\n log('capability contributed', { id: interfaceDef.identifier, count: untracked(() => current.length) });\n }\n\n /**\n * @internal\n */\n removeCapability<T>(interfaceDef: InterfaceDef<T>, implementation: T) {\n const current = this._definedCapabilities.get(interfaceDef.identifier);\n if (!current) {\n return;\n }\n\n const index = current.findIndex((i) => i.implementation === implementation);\n if (index !== -1) {\n current.splice(index, 1);\n log('capability removed', { id: interfaceDef.identifier, count: untracked(() => current.length) });\n }\n }\n\n /**\n * Requests capabilities from the plugin context.\n * @returns An array of capabilities.\n * @reactive\n */\n requestCapabilities<T, U extends T = T>(\n interfaceDef: InterfaceDef<T>,\n filter?: (capability: T, moduleId: string) => capability is U,\n ): U[] {\n let current = this._definedCapabilities.get(interfaceDef.identifier);\n if (!current) {\n const object = create<{ value: CapabilityImpl<unknown>[] }>({ value: [] });\n current = untracked(() => object.value);\n this._definedCapabilities.set(interfaceDef.identifier, current);\n }\n\n // NOTE: This the type-checking for capabilities is done at the time of contribution.\n const capabilities = filter ? current.filter((c) => filter(c.implementation as T, c.moduleId)) : current;\n return capabilities.map((c) => c.implementation) as U[];\n }\n\n /**\n * Requests a single capability from the plugin context.\n * @returns The capability.\n * @throws If no capability is found.\n * @reactive\n */\n requestCapability<T, U extends T = T>(\n interfaceDef: InterfaceDef<T>,\n filter?: (capability: T, moduleId: string) => capability is U,\n ): U {\n const capability = this.requestCapabilities(interfaceDef, filter)[0];\n invariant(capability, `No capability found for ${interfaceDef.identifier}`);\n return capability;\n }\n\n /**\n * Waits for a capability to be contributed.\n * @returns The capability.\n */\n async waitForCapability<T, U extends T = T>(\n interfaceDef: InterfaceDef<T>,\n filter?: (capability: T) => capability is U,\n ): Promise<U> {\n const trigger = new Trigger<U>();\n const unsubscribe = effect(() => {\n const capabilities = this.requestCapabilities(interfaceDef, filter);\n if (capabilities[0]) {\n trigger.wake(capabilities[0]);\n }\n });\n const capability = await trigger.wait();\n unsubscribe();\n return capability;\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * An event which activates a plugin module.\n */\nexport type ActivationEvent = {\n id: string;\n specifier?: string;\n};\n\n/**\n * An activation event that can be a single event, or a combination of events.\n */\nexport type ActivationEvents =\n | ActivationEvent\n | { type: 'one-of'; events: ActivationEvent[] }\n | { type: 'all-of'; events: ActivationEvent[] };\n\n/**\n * Helper to define an activation event.\n */\nexport const defineEvent = (id: string, specifier?: string) => {\n return { id, specifier } as ActivationEvent;\n};\n\n/**\n * Helper to create an activation event key.\n */\nexport const eventKey = (event: ActivationEvent) => (event.specifier ? `${event.id}:${event.specifier}` : event.id);\n\n/**\n * Helper to create an activation event that triggers when any of the given events are activated.\n */\nexport const oneOf = (...events: ActivationEvent[]) => ({ type: 'one-of' as const, events });\n\n/**\n * Helper to create an activation event that triggers when all of the given events are activated.\n */\nexport const allOf = (...events: ActivationEvent[]) => ({ type: 'all-of' as const, events });\n\n/**\n * Helper to check if an activation event is a one-of event.\n */\nexport const isOneOf = (events: ActivationEvents): events is { type: 'one-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'one-of';\n\n/**\n * Helper to check if an activation event is an all-of event.\n */\nexport const isAllOf = (events: ActivationEvents): events is { type: 'all-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'all-of';\n\n/**\n * Helper to get the events from an activation event.\n */\nexport const getEvents = (events: ActivationEvents) => ('type' in events ? events.events : [events]);\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { untracked } from '@preact/signals-core';\nimport { Effect, Either, Match } from 'effect';\n\nimport { Event } from '@dxos/async';\nimport { create, type ReactiveObject } from '@dxos/live-object';\nimport { log } from '@dxos/log';\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type AnyCapability, PluginsContext } from './capabilities';\nimport { type ActivationEvent, eventKey, getEvents, isAllOf } from './events';\nimport { type PluginModule, type Plugin } from './plugin';\n\n// TODO(wittjosiah): Factor out?\nconst isPromise = (value: unknown): value is Promise<unknown> => {\n return value !== null && typeof value === 'object' && 'then' in value;\n};\n\nexport type PluginManagerOptions = {\n pluginLoader: (id: string) => MaybePromise<Plugin>;\n plugins?: Plugin[];\n core?: string[];\n enabled?: string[];\n};\n\ntype PluginManagerState = {\n // Plugins\n plugins: Plugin[];\n core: string[];\n enabled: string[];\n\n // Modules\n modules: PluginModule[];\n active: string[];\n pendingRemoval: string[];\n\n // Events\n eventsFired: string[];\n pendingReset: string[];\n};\n\nexport class PluginManager {\n readonly activation = new Event<{ event: string; state: 'activating' | 'activated' | 'error'; error?: any }>();\n\n readonly context = new PluginsContext({\n activate: (event) => this.activate(event),\n reset: (id) => this.reset(id),\n });\n\n private readonly _state: ReactiveObject<PluginManagerState>;\n private readonly _pluginLoader: PluginManagerOptions['pluginLoader'];\n private readonly _capabilities = new Map<string, AnyCapability[]>();\n\n constructor({\n pluginLoader,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n enabled = [],\n }: PluginManagerOptions) {\n this._pluginLoader = pluginLoader;\n this._state = create({\n plugins,\n core,\n enabled,\n modules: [],\n active: [],\n pendingRemoval: [],\n pendingReset: [],\n eventsFired: [],\n });\n plugins.forEach((plugin) => this._addPlugin(plugin));\n core.forEach((id) => this.enable(id));\n enabled.forEach((id) => this.enable(id));\n }\n\n /**\n * Plugins that are currently registered.\n *\n * @reactive\n */\n get plugins(): ReactiveObject<readonly Plugin[]> {\n return this._state.plugins;\n }\n\n /**\n * Ids of plugins that are core and cannot be removed.\n *\n * @reactive\n */\n get core(): ReactiveObject<readonly string[]> {\n return this._state.core;\n }\n\n /**\n * Ids of plugins that are currently enabled.\n *\n * @reactive\n */\n get enabled(): ReactiveObject<readonly string[]> {\n return this._state.enabled;\n }\n\n /**\n * Modules of plugins which are currently enabled.\n *\n * @reactive\n */\n get modules(): ReactiveObject<readonly PluginModule[]> {\n return this._state.modules;\n }\n\n /**\n * Ids of modules which are currently active.\n *\n * @reactive\n */\n get active(): ReactiveObject<readonly string[]> {\n return this._state.active;\n }\n\n /**\n * Ids of modules which are pending removal.\n *\n * @reactive\n */\n get pendingRemoval(): ReactiveObject<readonly string[]> {\n return this._state.pendingRemoval;\n }\n\n /**\n * Ids of events which have been fired.\n *\n * @reactive\n */\n get eventsFired(): ReactiveObject<readonly string[]> {\n return this._state.eventsFired;\n }\n\n /**\n * Ids of modules which are pending reset.\n *\n * @reactive\n */\n get pendingReset(): ReactiveObject<readonly string[]> {\n return this._state.pendingReset;\n }\n\n /**\n * Adds a plugin to the manager via the plugin loader.\n * @param id The id of the plugin.\n */\n async add(id: string): Promise<boolean> {\n return untracked(async () => {\n log('add plugin', { id });\n const plugin = await this._pluginLoader(id);\n this._addPlugin(plugin);\n return this.enable(id);\n });\n }\n\n /**\n * Enables a plugin.\n * @param id The id of the plugin.\n */\n enable(id: string): boolean {\n return untracked(() => {\n log('enable plugin', { id });\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n if (!this._state.enabled.includes(id)) {\n this._state.enabled.push(id);\n }\n\n plugin.modules.forEach((module) => {\n this._addModule(module);\n this._setPendingResetByModule(module);\n });\n return true;\n });\n }\n\n /**\n * Removes a plugin from the manager.\n * @param id The id of the plugin.\n */\n remove(id: string): boolean {\n return untracked(() => {\n log('remove plugin', { id });\n const result = this.disable(id);\n if (!result) {\n return false;\n }\n\n this._removePlugin(id);\n return true;\n });\n }\n\n /**\n * Disables a plugin.\n * @param id The id of the plugin.\n */\n disable(id: string): boolean {\n return untracked(() => {\n log('disable plugin', { id });\n if (this._state.core.includes(id)) {\n return false;\n }\n\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n const enabledIndex = this._state.enabled.findIndex((enabled) => enabled === id);\n if (enabledIndex !== -1) {\n this._state.enabled.splice(enabledIndex, 1);\n\n plugin.modules.forEach((module) => {\n if (this._state.active.includes(module.id)) {\n this._setPendingResetByModule(module);\n if (!this._state.pendingRemoval.includes(module.id)) {\n this._state.pendingRemoval.push(module.id);\n }\n } else {\n this._removeModule(module.id);\n }\n });\n }\n\n return true;\n });\n }\n\n /**\n * Activates plugins based on the activation event.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\n activate(event: ActivationEvent | string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._activate(event)));\n }\n\n /**\n * Deactivates all of the modules for a plugin.\n * @param id The id of the plugin.\n * @returns Whether the deactivation was successful.\n */\n deactivate(id: string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._deactivate(id)));\n }\n\n /**\n * Re-activates the modules that were activated by the event.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\n reset(event: ActivationEvent | string): Promise<boolean> {\n return untracked(() => Effect.runPromise(this._reset(event)));\n }\n\n private _addPlugin(plugin: Plugin) {\n untracked(() => {\n log('add plugin', { id: plugin.meta.id });\n if (!this._state.plugins.includes(plugin)) {\n this._state.plugins.push(plugin);\n }\n });\n }\n\n private _removePlugin(id: string) {\n untracked(() => {\n log('remove plugin', { id });\n const pluginIndex = this._state.plugins.findIndex((plugin) => plugin.meta.id === id);\n if (pluginIndex !== -1) {\n this._state.plugins.splice(pluginIndex, 1);\n }\n });\n }\n\n private _addModule(module: PluginModule) {\n untracked(() => {\n log('add module', { id: module.id });\n if (!this._state.modules.includes(module)) {\n this._state.modules.push(module);\n }\n });\n }\n\n private _removeModule(id: string) {\n untracked(() => {\n log('remove module', { id });\n const moduleIndex = this._state.modules.findIndex((module) => module.id === id);\n if (moduleIndex !== -1) {\n this._state.modules.splice(moduleIndex, 1);\n }\n });\n }\n\n private _getPlugin(id: string) {\n return this._state.plugins.find((plugin) => plugin.meta.id === id);\n }\n\n private _getActiveModules() {\n return this._state.modules.filter((module) => this._state.active.includes(module.id));\n }\n\n private _getInactiveModules() {\n return this._state.modules.filter((module) => !this._state.active.includes(module.id));\n }\n\n private _getActiveModulesByEvent(key: string) {\n return this._getActiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));\n }\n\n private _getInactiveModulesByEvent(key: string) {\n return this._getInactiveModules().filter((module) => getEvents(module.activatesOn).map(eventKey).includes(key));\n }\n\n private _setPendingResetByModule(module: PluginModule) {\n return untracked(() => {\n const activationEvents = getEvents(module.activatesOn)\n .map(eventKey)\n .filter((key) => this._state.eventsFired.includes(key));\n const parentEvents = activationEvents.flatMap((event) => {\n const modules = this._getActiveModules().filter((module) =>\n module.activatesBefore?.map(eventKey).includes(event),\n );\n return modules.flatMap((module) => getEvents(module.activatesOn)).map(eventKey);\n });\n\n const pendingReset = Array.from(new Set([...activationEvents, ...parentEvents])).filter(\n (event) => !this._state.pendingReset.includes(event),\n );\n if (pendingReset.length > 0) {\n log('pending reset', { events: pendingReset });\n this._state.pendingReset.push(...pendingReset);\n }\n });\n }\n\n // TODO(wittjosiah): Improve error typing.\n private _activate(event: ActivationEvent | string): Effect.Effect<boolean, Error> {\n const self = this;\n return Effect.gen(function* () {\n const key = typeof event === 'string' ? event : eventKey(event);\n log('activating', { key });\n const pendingIndex = self._state.pendingReset.findIndex((event) => event === key);\n if (pendingIndex !== -1) {\n self._state.pendingReset.splice(pendingIndex, 1);\n }\n\n const modules = self._getInactiveModulesByEvent(key);\n if (modules.length === 0) {\n log('no modules to activate', { key });\n return false;\n }\n\n self.activation.emit({ event: key, state: 'activating' });\n\n for (const module of modules) {\n if (\n isAllOf(module.activatesOn) &&\n !module.activatesOn.events\n .filter((event) => eventKey(event) !== key)\n .every((event) => self._state.eventsFired.includes(eventKey(event)))\n ) {\n continue;\n }\n\n yield* Effect.all(module.activatesBefore?.map((event) => self._activate(event)) ?? []);\n\n const result = yield* self._activateModule(module).pipe(Effect.either);\n if (Either.isLeft(result)) {\n self.activation.emit({ event: key, state: 'error', error: result.left });\n yield* Effect.fail(result.left);\n }\n\n yield* Effect.all(module.activatesAfter?.map((event) => self._activate(event)) ?? []);\n }\n\n if (!self._state.eventsFired.includes(key)) {\n self._state.eventsFired.push(key);\n }\n\n self.activation.emit({ event: key, state: 'activated' });\n log('activated', { key });\n\n return true;\n });\n }\n\n private _activateModule(module: PluginModule): Effect.Effect<void, Error> {\n const self = this;\n return Effect.gen(function* () {\n // TODO(wittjosiah): This is not handling errors thrown if this is synchronous.\n const program = module.activate(self.context);\n const maybeCapabilities = yield* Match.value(program).pipe(\n Match.when(Effect.isEffect, (effect) => effect),\n Match.when(isPromise, (promise) =>\n Effect.tryPromise({\n try: () => promise,\n catch: (error) => error as Error,\n }),\n ),\n Match.orElse((program) => Effect.succeed(program)),\n );\n const capabilities = Match.value(maybeCapabilities).pipe(\n Match.when(Array.isArray, (array) => array),\n Match.orElse((value) => [value]),\n );\n capabilities.forEach((capability) => {\n self.context.contributeCapability({ module: module.id, ...capability });\n });\n self._state.active.push(module.id);\n self._capabilities.set(module.id, capabilities);\n });\n }\n\n private _deactivate(id: string): Effect.Effect<boolean, Error> {\n const self = this;\n return Effect.gen(function* () {\n const plugin = self._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n const modules = plugin.modules;\n const results = yield* Effect.all(modules.map((module) => self._deactivateModule(module)));\n return results.every((result) => result);\n });\n }\n\n private _deactivateModule(module: PluginModule): Effect.Effect<boolean, Error> {\n const self = this;\n return Effect.gen(function* () {\n const id = module.id;\n log('deactivating', { id });\n\n const capabilities = self._capabilities.get(id);\n if (capabilities) {\n for (const capability of capabilities) {\n self.context.removeCapability(capability.interface, capability.implementation);\n const program = capability.deactivate?.();\n yield* Match.value(program).pipe(\n Match.when(Effect.isEffect, (effect) => effect),\n Match.when(isPromise, (promise) =>\n Effect.tryPromise({\n try: () => promise,\n catch: (error) => error as Error,\n }),\n ),\n Match.orElse((program) => Effect.succeed(program)),\n );\n }\n self._capabilities.delete(id);\n }\n\n const activeIndex = self._state.active.findIndex((event) => event === id);\n if (activeIndex !== -1) {\n self._state.active.splice(activeIndex, 1);\n }\n\n log('deactivated', { id });\n return true;\n });\n }\n\n private _reset(event: ActivationEvent | string): Effect.Effect<boolean, Error> {\n const self = this;\n return Effect.gen(function* () {\n const key = typeof event === 'string' ? event : eventKey(event);\n log('reset', { key });\n const modules = self._getActiveModulesByEvent(key);\n const results = yield* Effect.all(modules.map((module) => self._deactivateModule(module)));\n\n if (self._state.pendingRemoval.length > 0) {\n self._state.pendingRemoval.forEach((id) => {\n self._removeModule(id);\n });\n self._state.pendingRemoval.splice(0, self._state.pendingRemoval.length);\n }\n\n if (results.every((result) => result)) {\n return yield* self._activate(key);\n } else {\n return false;\n }\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Effect } from 'effect';\n\nimport { type MaybePromise } from '@dxos/util';\n\nimport { type AnyCapability, type PluginsContext } from './capabilities';\nimport { type ActivationEvent, type ActivationEvents } from './events';\n\ninterface PluginModuleInterface {\n /**\n * Unique id of the module.\n */\n id: string;\n\n /**\n * Events for which the module will be activated.\n */\n activatesOn: ActivationEvents;\n\n /**\n * Events which the plugin depends on being activated.\n * Plugin is marked as needing reset a plugin activated by a dependent event is removed.\n * Events are automatically activated before activation of the plugin.\n */\n activatesBefore?: ActivationEvent[];\n\n /**\n * Events which this plugin triggers upon activation.\n */\n activatesAfter?: ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * @param context The plugin context.\n * @returns The capabilities of the module.\n */\n activate: (\n context: PluginsContext,\n ) => MaybePromise<AnyCapability | AnyCapability[]> | Effect.Effect<AnyCapability | AnyCapability[], Error>;\n}\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Plugins provide things like components, state, actions, etc. to the application.\n */\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nexport class PluginModule implements PluginModuleInterface {\n readonly id: PluginModuleInterface['id'];\n readonly activatesOn: PluginModuleInterface['activatesOn'];\n readonly activatesBefore?: PluginModuleInterface['activatesBefore'];\n readonly activatesAfter?: PluginModuleInterface['activatesAfter'];\n readonly activate: PluginModuleInterface['activate'];\n\n constructor(options: PluginModuleInterface) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.activatesBefore = options.activatesBefore;\n this.activatesAfter = options.activatesAfter;\n this.activate = options.activate;\n }\n}\n\n/**\n * Helper to define a module.\n */\nexport const defineModule = (options: PluginModuleInterface) => new PluginModule(options);\n\nexport type PluginMeta = {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Human-readable name.\n */\n name?: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n */\n// NOTE: This is implemented as a class to prevent it from being proxied by PluginManager state.\nexport class Plugin {\n constructor(\n readonly meta: PluginMeta,\n readonly modules: PluginModule[],\n ) {}\n}\n\n/**\n * Helper to define a plugin.\n */\nexport const definePlugin = (meta: PluginMeta, modules: PluginModule[]) => {\n return new Plugin(meta, modules);\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { type FC, type PropsWithChildren } from 'react';\n\nimport { type GraphBuilder } from '@dxos/app-graph';\nimport { type Space } from '@dxos/client-protocol';\nimport { type S } from '@dxos/echo-schema';\nimport { type RootSettingsStore } from '@dxos/local-storage';\nimport { type DeepReadonly } from '@dxos/util';\n\nimport { type FileInfo } from './file';\nimport { type NodeSerializer } from './graph';\nimport { type Layout } from './layout';\nimport { type LayoutParts } from './navigation';\nimport { type SurfaceDefinition } from './surface';\nimport { type Resource } from './translations';\nimport { defineCapability, type PluginManager } from '../core';\nimport { type AnyIntentResolver, type IntentContext } from '../plugin-intent';\n\nexport namespace Capabilities {\n export const PluginManager = defineCapability<PluginManager>('dxos.org/app-framework/capability/plugin-manager');\n\n export const Null = defineCapability<null>('dxos.org/app-framework/capability/null');\n\n export type ReactContext = Readonly<{ id: string; dependsOn?: string[]; context: FC<PropsWithChildren> }>;\n export const ReactContext = defineCapability<ReactContext>('dxos.org/app-framework/capability/react-context');\n\n export type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;\n export const ReactRoot = defineCapability<ReactRoot>('dxos.org/app-framework/capability/react-root');\n\n export type ReactSurface = SurfaceDefinition | readonly SurfaceDefinition[];\n export const ReactSurface = defineCapability<ReactSurface>('dxos.org/app-framework/common/react-surface');\n\n export type IntentResolver = AnyIntentResolver | readonly AnyIntentResolver[];\n export const IntentResolver = defineCapability<IntentResolver>('dxos.org/app-framework/capability/intent-resolver');\n\n export const IntentDispatcher = defineCapability<IntentContext>(\n 'dxos.org/app-framework/capability/intent-dispatcher',\n );\n\n export const Layout = defineCapability<Readonly<Layout>>('dxos.org/app-framework/capability/layout');\n export const MutableLayout = defineCapability<Layout>('dxos.org/app-framework/capability/layout');\n\n export type MutableLocation = { active: LayoutParts; closed: string[] };\n export type Location = DeepReadonly<MutableLocation>;\n export const Location = defineCapability<Location>('dxos.org/app-framework/capability/location');\n export const MutableLocation = defineCapability<MutableLocation>('dxos.org/app-framework/capability/location');\n\n export const Translations = defineCapability<Readonly<Resource[]>>('dxos.org/app-framework/capability/translations');\n\n export const AppGraph = defineCapability<Readonly<Pick<GraphBuilder, 'graph' | 'explore'>>>(\n 'dxos.org/app-framework/capability/app-graph',\n );\n\n export const AppGraphBuilder = defineCapability<Parameters<GraphBuilder['addExtension']>[0]>(\n 'dxos.org/app-framework/capability/app-graph-builder',\n );\n\n export const AppGraphSerializer = defineCapability<NodeSerializer[]>(\n 'dxos.org/app-framework/capability/app-graph-serializer',\n );\n\n export const SettingsStore = defineCapability<RootSettingsStore>('dxos.org/app-framework/capability/settings-store');\n\n // TODO(wittjosiah): The generics caused type inference issues for schemas when contributing settings.\n // export type Settings = Parameters<RootSettingsStore['createStore']>[0];\n // export type Settings<T extends SettingsValue = SettingsValue> = SettingsProps<T>;\n export type Settings = {\n schema: S.Schema.All;\n prefix: string;\n value?: Record<string, any>;\n };\n export const Settings = defineCapability<Settings>('dxos.org/app-framework/capability/settings');\n\n export type Metadata = Readonly<{ id: string; metadata: Record<string, any> }>;\n export const Metadata = defineCapability<Metadata>('dxos.org/app-framework/capability/metadata');\n\n export type FileUploader = (file: File, space: Space) => Promise<FileInfo | undefined>;\n export const FileUploader = defineCapability<FileUploader>('dxos.org/app-framework/capability/file-uploader');\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities } from './capabilities';\nimport { defineEvent } from '../core';\n\nexport namespace Events {\n /**\n * Fired when the app is started.\n */\n export const Startup = defineEvent('dxos.org/app-framework/event/startup');\n\n //\n // Dependent Events\n //\n\n /**\n * Fired before the intent dispatcher is activated.\n */\n export const SetupIntents = defineEvent('dxos.org/app-framework/event/setup-intents');\n\n /**\n * Fired before the settings store is activated.\n */\n export const SetupSettings = defineEvent('dxos.org/app-framework/event/setup-settings');\n\n /**\n * Fired before the graph is created.\n */\n export const SetupAppGraph = defineEvent('dxos.org/app-framework/event/setup-graph');\n\n /**\n * Fired before the translations provider is created.\n */\n export const SetupTranslations = defineEvent('dxos.org/app-framework/event/setup-translations');\n\n //\n // Triggered Events\n //\n\n /**\n * Fired after the intent dispatcher is ready.\n */\n export const DispatcherReady = defineEvent('dxos.org/app-framework/event/dispatcher-ready');\n\n /**\n * Fired after the settings store is ready.\n */\n export const SettingsReady = defineEvent('dxos.org/app-framework/event/settings-ready');\n\n /**\n * Fired when the graph is ready.\n */\n export const AppGraphReady = defineEvent('dxos.org/app-framework/event/graph-ready');\n\n /**\n * Fired when plugin state is ready.\n */\n export const createStateEvent = (specifier: string) => defineEvent('dxos.org/app-framework/event/state', specifier);\n export const LayoutReady = createStateEvent(Capabilities.Layout.identifier);\n export const LocationReady = createStateEvent(Capabilities.Location.identifier);\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { S } from '@dxos/echo-schema';\n\n// TODO(burdon): See Accept attribute (uses MIME types).\n// E.g., 'image/*': ['.jpg', '.jpeg', '.png', '.gif'],\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg', 'gif'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport const FileInfoSchema = S.Struct({\n name: S.String,\n type: S.String,\n url: S.optional(S.String),\n cid: S.optional(S.String), // TODO(burdon): Meta key? Or other common properties with other file management system? (e.g., WNFS).\n});\n\nexport type FileInfo = S.Schema.Type<typeof FileInfoSchema>;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { S } from '@dxos/echo-schema';\n\nexport type IntentParams = {\n readonly input: S.Schema.All;\n readonly output: S.Schema.All;\n};\n\nexport type IntentData<Fields extends IntentParams> =\n S.Schema.Type<S.Struct<Fields>> extends { readonly input: any } ? S.Schema.Type<S.Struct<Fields>>['input'] : any;\n\nexport type IntentResultData<Fields extends IntentParams> =\n S.Schema.Type<S.Struct<Fields>> extends { readonly output: any } ? S.Schema.Type<S.Struct<Fields>>['output'] : any;\n\nexport type IntentSchema<Tag extends string, Fields extends IntentParams> = S.TaggedClass<any, Tag, Fields>;\n\n/**\n * An intent is an abstract description of an operation to be performed.\n * Intents allow actions to be performed across plugins.\n */\nexport type Intent<Tag extends string, Fields extends IntentParams> = {\n _schema: IntentSchema<Tag, Fields>;\n\n /**\n * The action to perform.\n */\n action: Tag;\n\n /**\n * Any data needed to perform the desired action.\n */\n data: IntentData<Fields>;\n\n /**\n * Module ID.\n * If specified, the intent will be sent explicitly to the plugin module.\n * Otherwise, the intent will be sent to all plugins, in order and the first to resolve a non-null value will be used.\n */\n module?: string;\n\n /**\n * Whether or not the intent is being undone.\n */\n undo?: boolean;\n};\n\nexport type AnyIntent = Intent<any, any>;\n\n/**\n * Chain of intents to be executed together.\n * The result of each intent is merged into the next intent's input data.\n */\nexport type IntentChain<\n FirstTag extends string,\n LastTag extends string,\n FirstFields extends IntentParams,\n LastFields extends IntentParams,\n> = {\n first: Intent<FirstTag, FirstFields>;\n last: Intent<LastTag, LastFields>;\n all: AnyIntent[];\n};\n\nexport type AnyIntentChain = IntentChain<any, any, any, any>;\n\n/**\n * Creates a typed intent.\n * @param schema Schema of the intent. Must be a tagged class with input and output schemas.\n * @param data Data fulfilling the input schema of the intent.\n * @param params.plugin Optional plugin ID to send the intent to.\n * @param params.undo Optional flag to indicate that the intent is being undone. Generally not set manually.\n */\nexport const createIntent = <Tag extends string, Fields extends IntentParams>(\n schema: IntentSchema<Tag, Fields>,\n data: IntentData<Fields> = {},\n params: Pick<AnyIntent, 'module' | 'undo'> = {},\n): IntentChain<Tag, Tag, Fields, Fields> => {\n // The output of validateSync breaks proxy objects so this is just used for validation.\n // TODO(wittjosiah): Is there a better way to make theses types align?\n const _ = S.validateSync(schema.fields.input as S.Schema<any, any, unknown>)(data);\n const intent = {\n ...params,\n _schema: schema,\n action: schema._tag,\n data,\n } satisfies Intent<Tag, Fields>;\n\n return {\n first: intent,\n last: intent,\n all: [intent],\n };\n};\n\n// TODO(wittjosiah): Add a function for mapping the output of one intent to the input of another.\n\n/**\n * Chain two intents together.\n *\n * NOTE: Chaining of intents depends on the data inputs and outputs being structs.\n */\nexport const chain =\n <\n FirstTag extends string,\n NextTag extends string,\n FirstFields extends IntentParams,\n LastFields extends IntentParams,\n NextFields extends IntentParams,\n >(\n schema: IntentSchema<NextTag, NextFields>,\n data: Omit<IntentData<NextFields>, keyof IntentResultData<LastFields>> = {},\n params: Pick<AnyIntent, 'module' | 'undo'> = {},\n ) =>\n (\n intent: IntentChain<FirstTag, any, FirstFields, LastFields>,\n ): IntentChain<FirstTag, NextTag, FirstFields, NextFields> => {\n const intents = 'all' in intent ? intent.all : [intent];\n const first = intents[0];\n const last = {\n ...params,\n _schema: schema,\n action: schema._tag,\n data,\n } satisfies Intent<NextTag, NextFields>;\n\n return {\n first,\n last,\n all: [...intents, last],\n };\n };\n\n//\n// Intents\n//\n\n// NOTE: Should maintain compatibility with `i18next` (and @dxos/react-ui).\n// TODO(wittjosiah): Making this immutable breaks type compatibility.\nexport const Label = S.Union(\n S.String,\n S.mutable(S.Tuple(S.String, S.mutable(S.Struct({ ns: S.String, count: S.optional(S.Number) })))),\n);\nexport type Label = S.Schema.Type<typeof Label>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { S } from '@dxos/echo-schema';\n\nimport { Label } from './intent';\n\nexport const INTENT_PLUGIN = 'dxos.org/plugin/intent';\nexport const INTENT_ACTION = `${INTENT_PLUGIN}/action`;\n\nexport namespace IntentAction {\n /**\n * Fired after an intent is dispatched if the intent is undoable.\n */\n export class ShowUndo extends S.TaggedClass<ShowUndo>()(`${INTENT_ACTION}/show-undo`, {\n input: S.Struct({\n message: Label,\n }),\n output: S.Void,\n }) {}\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Effect, Option, pipe, Ref } from 'effect';\nimport { type Simplify } from 'effect/Types';\n\nimport { type MaybePromise, byDisposition, type Disposition } from '@dxos/util';\n\nimport { IntentAction } from './actions';\nimport { CycleDetectedError, NoResolversError } from './errors';\nimport {\n createIntent,\n type AnyIntent,\n type AnyIntentChain,\n type Intent,\n type IntentChain,\n type IntentData,\n type IntentParams,\n type IntentResultData,\n type IntentSchema,\n type Label,\n} from './intent';\n\nconst EXECUTION_LIMIT = 100;\nconst HISTORY_LIMIT = 100;\n\n/**\n * The return value of an intent effect.\n */\nexport type IntentEffectResult<Fields extends IntentParams> = {\n /**\n * The output of the action that was performed.\n *\n * If the intent is apart of a chain of intents, the data will be passed to the next intent.\n */\n data?: IntentResultData<Fields>;\n\n /**\n * If provided, the action will be undoable.\n */\n undoable?: {\n /**\n * Message to display to the user when indicating that the action can be undone.\n */\n message: Label;\n\n /**\n * Will be merged with the original intent data when firing the undo intent.\n */\n data?: Partial<IntentData<Fields>>;\n };\n\n /**\n * An error that occurred while performing the action.\n *\n * If the intent is apart of a chain of intents and an error occurs, the chain will be aborted.\n *\n * Return caught error instead of throwing to trigger other intent to be triggered prior to returning the error.\n */\n error?: Error;\n\n /**\n * Other intent chains to be triggered.\n */\n intents?: AnyIntentChain[];\n};\n\nexport type AnyIntentEffectResult = IntentEffectResult<any>;\n\n/**\n * The result of an intent dispatcher.\n */\nexport type IntentDispatcherResult<Fields extends IntentParams> = Pick<IntentEffectResult<Fields>, 'data' | 'error'>;\n\n/**\n * The implementation of an intent effect.\n */\nexport type IntentEffectDefinition<Fields extends IntentParams> = (\n data: IntentData<Fields>,\n undo: boolean,\n) => MaybePromise<IntentEffectResult<Fields> | void> | Effect.Effect<IntentEffectResult<Fields> | void>;\n\n/**\n * Intent resolver to match intents to their effects.\n */\nexport type IntentResolver<Tag extends string, Fields extends IntentParams> = Readonly<{\n action: Tag;\n disposition?: Disposition;\n // TODO(wittjosiah): Would be nice to make this a guard for intents with optional data.\n filter?: (data: IntentData<Fields>) => boolean;\n effect: IntentEffectDefinition<Fields>;\n}>;\n\nexport type AnyIntentResolver = IntentResolver<any, any>;\n\n/**\n * Creates an intent resolver to match intents to their effects.\n * @param schema Schema of the intent. Must be a tagged class with input and output schemas.\n * @param effect Effect to be performed when the intent is resolved.\n * @param params.disposition Determines the priority of the resolver when multiple are resolved.\n * @param params.filter Optional filter to determine if the resolver should be used.\n */\nexport const createResolver = <Tag extends string, Fields extends IntentParams>(\n schema: IntentSchema<Tag, Fields>,\n effect: IntentEffectDefinition<Fields>,\n params: Pick<IntentResolver<Tag, Fields>, 'disposition' | 'filter'> = {},\n): IntentResolver<Tag, Fields> => ({\n action: schema._tag,\n effect,\n ...params,\n});\n\n/**\n * Invokes intents and returns the result.\n */\nexport type PromiseIntentDispatcher = <Fields extends IntentParams>(\n intent: IntentChain<any, any, any, Fields>,\n) => Promise<Simplify<IntentDispatcherResult<Fields>>>;\n\n/**\n * Creates an effect for intents.\n */\nexport type IntentDispatcher = <Fields extends IntentParams>(\n intent: IntentChain<any, any, any, Fields>,\n depth?: number,\n) => Effect.Effect<Simplify<Required<IntentDispatcherResult<Fields>>['data']>, Error>;\n\ntype IntentResult<Tag extends string, Fields extends IntentParams> = IntentEffectResult<Fields> & {\n _intent: Intent<Tag, Fields>;\n};\n\nexport type AnyIntentResult = IntentResult<any, any>;\n\n/**\n * Invokes the most recent undoable intent with undo flags.\n */\nexport type PromiseIntentUndo = () => Promise<IntentDispatcherResult<any>>;\n\n/**\n * Creates an effect which undoes the last intent.\n */\nexport type IntentUndo = () => Effect.Effect<any, Error>;\n\n/**\n * Check if a chain of results is undoable.\n */\nconst isUndoable = (historyEntry: AnyIntentResult[]): boolean =>\n historyEntry.length > 0 && historyEntry.every(({ undoable }) => !!undoable);\n\nexport type IntentContext = {\n dispatch: IntentDispatcher;\n dispatchPromise: PromiseIntentDispatcher;\n undo: IntentUndo;\n undoPromise: PromiseIntentUndo;\n};\n\n/**\n * Sets of an intent dispatcher.\n *\n * @param resolvers An array of available intent resolvers.\n * @param params.historyLimit The maximum number of intent results to keep in history.\n * @param params.executionLimit The maximum recursion depth of intent chains.\n */\nexport const createDispatcher = (\n getResolvers: (module?: string) => AnyIntentResolver[],\n { executionLimit = EXECUTION_LIMIT, historyLimit = HISTORY_LIMIT } = {},\n): IntentContext => {\n const historyRef = Effect.runSync(Ref.make<AnyIntentResult[][]>([]));\n\n const handleIntent = (intent: AnyIntent) => {\n return Effect.gen(function* () {\n const candidates = getResolvers(intent.module)\n .filter((r) => r.action === intent.action)\n .filter((r) => !r.filter || r.filter(intent.data))\n .toSorted(byDisposition);\n if (candidates.length === 0) {\n return {\n _intent: intent,\n error: new NoResolversError(intent.action),\n } as AnyIntentResult;\n }\n\n const effect = candidates[0].effect(intent.data, intent.undo ?? false);\n const result = Effect.isEffect(effect) ? yield* effect : yield* Effect.promise(async () => effect);\n return { _intent: intent, ...result } as AnyIntentResult;\n });\n };\n\n const dispatch: IntentDispatcher = (intentChain, depth = 0) => {\n return Effect.gen(function* () {\n if (depth > executionLimit) {\n yield* Effect.fail(new CycleDetectedError());\n }\n\n const resultsRef = yield* Ref.make<AnyIntentResult[]>([]);\n for (const intent of intentChain.all) {\n const { data: prev } = (yield* resultsRef.get)[0] ?? {};\n const result = yield* handleIntent({ ...intent, data: { ...intent.data, ...prev } });\n yield* Ref.update(resultsRef, (results) => [result, ...results]);\n if (result.intents) {\n for (const intent of result.intents) {\n // Returned intents are dispatched but not yielded into results,\n // as such they cannot be undone.\n // TODO(wittjosiah): Use higher execution concurrency?\n yield* dispatch(intent, depth + 1);\n }\n }\n if (result.error) {\n yield* Effect.fail(result.error);\n }\n }\n\n const results = yield* resultsRef.get;\n const result = results[0];\n yield* Ref.update(historyRef, (history) => {\n const next = [...history, results];\n if (next.length > historyLimit) {\n next.splice(0, next.length - historyLimit);\n }\n return next;\n });\n\n if (result.undoable && isUndoable(results)) {\n // TODO(wittjosiah): Is there a better way to handle showing undo for chains?\n yield* pipe(\n dispatch(createIntent(IntentAction.ShowUndo, { message: result.undoable.message })),\n Effect.catchSome((err) =>\n err instanceof NoResolversError ? Option.some(Effect.succeed(undefined)) : Option.none(),\n ),\n );\n }\n\n return result.data;\n });\n };\n\n const dispatchPromise: PromiseIntentDispatcher = (intentChain) => {\n return Effect.runPromise(dispatch(intentChain))\n .then((data) => ({ data }))\n .catch((error) => ({ error }));\n };\n\n const undo: IntentUndo = () => {\n return Effect.gen(function* () {\n const history = yield* historyRef.get;\n const last = history.findLastIndex(isUndoable);\n const result = last !== -1 ? history[last] : undefined;\n if (result) {\n const all = result.map(({ _intent, undoable }): AnyIntent => {\n const data = _intent.data;\n const undoData = undoable?.data ?? {};\n return { ..._intent, data: { ...data, ...undoData }, undo: true } satisfies AnyIntent;\n });\n const intent = { first: all[0], last: all.at(-1)!, all } satisfies AnyIntentChain;\n yield* Ref.update(historyRef, (h) => h.filter((_, index) => index !== last));\n return yield* dispatch(intent);\n }\n });\n };\n\n const undoPromise: PromiseIntentUndo = () => {\n return Effect.runPromise(undo())\n .then((data) => ({ data }))\n .catch((error) => ({ error }));\n };\n\n return { dispatch, dispatchPromise, undo, undoPromise };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// TODO(wittjosiah): Reconcile with @dxos/protocols. Factor out errors.\n\n/**\n * NOTE: Messages should be sentences (Start with a capital letter and end with a period).\n * Errors can optionally include a JSON context object.\n */\nexport class BaseError extends Error {\n constructor(\n readonly code: string,\n message?: string,\n readonly context?: Record<string, any>,\n ) {\n // TODO(dmaretskyi): Error.cause.\n super(message ?? code);\n this.name = code;\n // NOTE: Restores prototype chain (https://stackoverflow.com/a/48342359).\n Object.setPrototypeOf(this, new.target.prototype);\n }\n}\n\nexport class NoResolversError extends BaseError {\n constructor(action: string) {\n super('NO_RESOLVERS', 'No resolvers were found for the action', { action });\n }\n}\n\nexport class CycleDetectedError extends BaseError {\n constructor(context?: Record<string, any>) {\n super(\n 'CYCLE_DETECTED',\n 'Intent execution limit exceeded. This is likely due to an infinite loop within intent resolvers.',\n context,\n );\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React, { Component, type FC, type PropsWithChildren } from 'react';\n\ntype Props = PropsWithChildren<{ data?: any; fallback: FC<{ data?: any; error: Error; reset: () => void }> }>;\ntype State = { error: Error | undefined };\n\n/**\n * Surface error boundary.\n *\n * For basic usage prefer providing a fallback component to `Surface`.\n *\n * For more information on error boundaries, see:\n * https://react.dev/reference/react/Component#catching-rendering-errors-with-an-error-boundary\n */\nexport class ErrorBoundary extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = { error: undefined };\n }\n\n static getDerivedStateFromError(error: Error) {\n return { error };\n }\n\n override componentDidUpdate(prevProps: Props): void {\n if (prevProps.data !== this.props.data) {\n this.resetError();\n }\n }\n\n override render() {\n if (this.state.error) {\n return <this.props.fallback data={this.props.data} error={this.state.error} reset={this.resetError} />;\n }\n\n return this.props.children;\n }\n\n private resetError() {\n this.setState({ error: undefined });\n }\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { createContext, useContext } from 'react';\n\nimport { raise } from '@dxos/debug';\n\nimport { type PluginManager } from '../core';\n\nconst PluginManagerContext = createContext<PluginManager | undefined>(undefined);\n\n/**\n * Get the plugin manager.\n */\nexport const usePluginManager = (): PluginManager =>\n useContext(PluginManagerContext) ?? raise(new Error('Missing PluginManagerContext'));\n\n/**\n * Context provider for a plugin manager.\n */\nexport const PluginManagerProvider = PluginManagerContext.Provider;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { computed } from '@preact/signals-core';\nimport { useMemo } from 'react';\n\nimport { usePluginManager } from './PluginManagerProvider';\nimport { type InterfaceDef } from '../core';\n\n/**\n * Hook to request capabilities from the plugin context.\n * @returns An array of capabilities.\n */\nexport const useCapabilities = <T, U extends T = T>(\n interfaceDef: InterfaceDef<T>,\n filter?: (capability: T, moduleId: string) => capability is U,\n) => {\n const manager = usePluginManager();\n const signal = useMemo(\n () => computed(() => manager.context.requestCapabilities(interfaceDef, filter)),\n [interfaceDef],\n );\n\n return signal.value;\n};\n\n/**\n * Hook to request a capability from the plugin context.\n * @returns The capability.\n * @throws If no capability is found.\n */\nexport const useCapability = <T, U extends T = T>(\n interfaceDef: InterfaceDef<T>,\n filter?: (capability: T, moduleId: string) => capability is U,\n) => {\n const manager = usePluginManager();\n const signal = useMemo(() => computed(() => manager.context.requestCapability(interfaceDef, filter)), [interfaceDef]);\n return signal.value;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport React, { memo, forwardRef, Suspense, useMemo } from 'react';\n\nimport { useDefaultValue } from '@dxos/react-hooks';\nimport { byDisposition } from '@dxos/util';\n\nimport { ErrorBoundary } from './ErrorBoundary';\nimport { useCapabilities } from './useCapabilities';\nimport { Capabilities, type SurfaceDefinition, type SurfaceProps } from '../common';\nimport { type PluginsContext } from '../core';\n\nconst useSurfaces = () => {\n const surfaces = useCapabilities(Capabilities.ReactSurface);\n return useMemo(() => surfaces.flat(), [surfaces]);\n};\n\nconst findCandidates = (surfaces: SurfaceDefinition[], { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {\n return Object.values(surfaces)\n .filter((definition) =>\n Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role,\n )\n .filter(({ filter }) => (filter ? filter(data ?? {}) : true))\n .toSorted(byDisposition);\n};\n\n/**\n * @returns `true` if there is a contributed surface which matches the specified role & data, `false` otherwise.\n */\nexport const isSurfaceAvailable = (context: PluginsContext, { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {\n const surfaces = context.requestCapabilities(Capabilities.ReactSurface);\n const candidates = findCandidates(surfaces.flat(), { role, data });\n return candidates.length > 0;\n};\n\n/**\n * A surface is a named region of the screen that can be populated by plugins.\n */\nexport const Surface = memo(\n forwardRef<HTMLElement, SurfaceProps>(\n ({ id: _id, role, data: _data, limit, fallback, placeholder, ...rest }, forwardedRef) => {\n // TODO(wittjosiah): This will make all surfaces depend on a single signal.\n // This isn't ideal because it means that any change to the data will cause all surfaces to re-render.\n // This effectively means that plugin modules which contribute surfaces need to all be activated at startup.\n // This should be fine for now because it's how it worked prior to capabilities api anyways.\n // In the future, it would be nice to be able to bucket the surface contributions by role.\n const surfaces = useSurfaces();\n const data = useDefaultValue(_data, () => ({}));\n\n const candidates = useMemo(() => {\n const definitions = findCandidates(surfaces, { role, data });\n return limit ? definitions.slice(0, limit) : definitions;\n }, [surfaces, role, data, limit]);\n\n const nodes = candidates.map(({ component: Component, id }) => (\n <Component ref={forwardedRef} key={id} id={id} role={role} data={data} limit={limit} {...rest} />\n ));\n\n const suspense = placeholder ? <Suspense fallback={placeholder}>{nodes}</Suspense> : nodes;\n\n return fallback ? (\n <ErrorBoundary data={data} fallback={fallback}>\n {suspense}\n </ErrorBoundary>\n ) : (\n suspense\n );\n },\n ),\n);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { S } from '@dxos/echo-schema';\n\nimport { Label } from '../plugin-intent';\n\n//\n// Provides\n//\n\nexport const Toast = S.Struct({\n id: S.String,\n title: S.optional(Label),\n description: S.optional(Label),\n icon: S.optional(S.String),\n duration: S.optional(S.Number),\n closeLabel: S.optional(Label),\n actionLabel: S.optional(Label),\n actionAlt: S.optional(Label),\n // TODO(wittjosiah): Make class with customizable method?\n onAction: S.optional(S.Any),\n});\n\nexport type Toast = S.Schema.Type<typeof Toast>;\n\n/**\n * Basic state provided by a layout plugin.\n *\n * Layout provides the state of global UI landmarks, such as the sidebar, dialog, and popover.\n * Generally only one dialog or popover should be open at a time, a layout plugin should manage this.\n * For other landmarks, such as toasts, rendering them in the layout prevents them from unmounting when navigating.\n */\n\nconst LayoutMode = S.Union(S.Literal('deck'), S.Literal('solo'), S.Literal('fullscreen'));\nexport const isLayoutMode = (value: any): value is LayoutMode => S.is(LayoutMode)(value);\nexport type LayoutMode = S.Schema.Type<typeof LayoutMode>;\n\nexport const Layout = S.mutable(\n S.Struct({\n layoutMode: LayoutMode,\n\n sidebarOpen: S.Boolean,\n complementarySidebarOpen: S.Boolean,\n /**\n * @deprecated Data to be passed to the complementary sidebar Surface.\n */\n complementarySidebarContent: S.optional(S.Any),\n\n dialogOpen: S.Boolean,\n /**\n * Data to be passed to the dialog Surface.\n */\n dialogContent: S.optional(S.Any),\n // TODO(wittjosiah): Custom properties?\n dialogBlockAlign: S.optional(S.Literal('start', 'center')),\n dialogType: S.optional(S.Literal('default', 'alert')),\n\n popoverOpen: S.Boolean,\n /**\n * Data to be passed to the popover Surface.\n */\n popoverContent: S.optional(S.Any),\n popoverAnchorId: S.optional(S.String),\n\n toasts: S.mutable(S.Array(Toast)),\n\n /**\n * The identifier of a component to scroll into view when it is mounted.\n */\n scrollIntoView: S.optional(S.String),\n }),\n);\n\nexport type Layout = S.Schema.Type<typeof Layout>;\n\n//\n// Intents\n//\n\nexport const LAYOUT_PLUGIN = 'dxos.org/plugin/layout';\nexport const LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;\n\n/**\n * Expected payload for layout actions.\n */\nexport namespace LayoutAction {\n export class SetLayout extends S.TaggedClass<SetLayout>()(`${LAYOUT_ACTION}/set-layout`, {\n input: S.Struct({\n /**\n * Element to set the state of.\n */\n element: S.Literal('fullscreen', 'sidebar', 'complementary', 'dialog', 'popover', 'toast'),\n\n /**\n * Whether the element is on or off.\n *\n * If omitted, the element's state will be toggled or set based on other provided data.\n * For example, if `component` is provided, the state will be set to `true`.\n */\n state: S.optional(S.Boolean),\n\n /**\n * Component to render in the dialog or popover.\n */\n component: S.optional(S.String),\n\n /**\n * Data to be passed to the dialog or popover Surface.\n */\n subject: S.optional(S.Any),\n\n /**\n * Anchor ID for the popover.\n */\n anchorId: S.optional(S.String),\n\n // TODO(wittjosiah): Custom properties?\n\n /**\n * Block alignment for the dialog.\n */\n dialogBlockAlign: S.optional(S.Literal('start', 'center')),\n\n /**\n * Type of dialog.\n */\n dialogType: S.optional(S.Literal('default', 'alert')),\n }),\n output: S.Void,\n }) {}\n\n // TODO(wittjosiah): Do all these need to be separate actions?\n\n export class SetLayoutMode extends S.TaggedClass<SetLayoutMode>()(`${LAYOUT_ACTION}/set-layout-mode`, {\n input: S.Union(\n S.Struct({\n layoutMode: LayoutMode,\n }),\n S.Struct({\n revert: S.Literal(true),\n }),\n ),\n output: S.Void,\n }) {}\n\n export class ScrollIntoView extends S.TaggedClass<ScrollIntoView>()(`${LAYOUT_ACTION}/scroll-into-view`, {\n input: S.Struct({\n id: S.optional(S.String),\n // TODO(wittjosiah): Factor out to thread scroll into view action?\n cursor: S.optional(S.String),\n ref: S.optional(S.String),\n }),\n output: S.Void,\n }) {}\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Context, createContext, useContext, type Provider, useEffect } from 'react';\n\nimport { raise } from '@dxos/debug';\nimport { pick } from '@dxos/util';\n\nimport { type AnyIntentResolver, type IntentContext } from './intent-dispatcher';\nimport { Capabilities } from '../common';\nimport { usePluginManager } from '../react';\n\nconst IntentContext: Context<IntentContext | undefined> = createContext<IntentContext | undefined>(undefined);\n\nexport const useIntentDispatcher = (): Pick<IntentContext, 'dispatch' | 'dispatchPromise'> => {\n const context = useContext(IntentContext) ?? raise(new Error('IntentContext not found'));\n return pick(context, ['dispatch', 'dispatchPromise']);\n};\n\nexport const useIntentResolver = (module: string, resolver: AnyIntentResolver) => {\n const manager = usePluginManager();\n useEffect(() => {\n manager.context.contributeCapability({\n module,\n interface: Capabilities.IntentResolver,\n implementation: resolver,\n });\n\n return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);\n }, [module, resolver]);\n};\n\nexport const IntentProvider: Provider<IntentContext | undefined> = IntentContext.Provider;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Effect } from 'effect';\nimport React from 'react';\n\nimport { create } from '@dxos/live-object';\n\nimport { IntentProvider } from './IntentContext';\nimport { INTENT_PLUGIN } from './actions';\nimport { type AnyIntentResolver, createDispatcher, type IntentContext } from './intent-dispatcher';\nimport { Capabilities, Events } from '../common';\nimport { contributes, defineModule, definePlugin } from '../core';\n\nconst defaultEffect = () => Effect.fail(new Error('Intent runtime not ready'));\nconst defaultPromise = () => Effect.runPromise(defaultEffect());\n\nexport const IntentPlugin = () =>\n definePlugin({ id: INTENT_PLUGIN }, [\n defineModule({\n id: `${INTENT_PLUGIN}/module/dispatcher`,\n // TODO(wittjosiah): This will mean that startup needs to be reset when intents are added or removed.\n // This is fine for now because it's how it worked prior to capabilities api anyways.\n // In the future, the intent dispatcher should be able to be reset without resetting the entire app.\n activatesOn: Events.Startup,\n activatesBefore: [Events.SetupIntents],\n activatesAfter: [Events.DispatcherReady],\n activate: (context) => {\n const state = create<IntentContext>({\n dispatch: defaultEffect,\n dispatchPromise: defaultPromise,\n undo: defaultEffect,\n undoPromise: defaultPromise,\n });\n\n // TODO(wittjosiah): Make getResolver callback async and allow resolvers to be requested on demand.\n const { dispatch, dispatchPromise, undo, undoPromise } = createDispatcher((module) =>\n context\n .requestCapabilities(Capabilities.IntentResolver, (c, moduleId): c is AnyIntentResolver => {\n return module ? moduleId === module : true;\n })\n .flat(),\n );\n\n state.dispatch = dispatch;\n state.dispatchPromise = dispatchPromise;\n state.undo = undo;\n state.undoPromise = undoPromise;\n\n return [\n contributes(Capabilities.IntentDispatcher, state),\n contributes(Capabilities.ReactContext, {\n id: INTENT_PLUGIN,\n context: ({ children }) => <IntentProvider value={state}>{children}</IntentProvider>,\n }),\n ];\n },\n }),\n ]);\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport { Schema as S } from '@effect/schema';\n\nimport { pick } from '@dxos/util';\n\n// NOTE(thure): These are chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html\nexport const SLUG_LIST_SEPARATOR = '+';\nexport const SLUG_ENTRY_SEPARATOR = '_';\nexport const SLUG_KEY_VALUE_SEPARATOR = '-';\nexport const SLUG_PATH_SEPARATOR = '~';\nexport const SLUG_COLLECTION_INDICATOR = '';\n\nconst LayoutEntrySchema = S.mutable(S.Struct({ id: S.String, path: S.optional(S.String) }));\nexport type LayoutEntry = S.Schema.Type<typeof LayoutEntrySchema>;\n\n// TODO(Zan): Consider renaming the 'main' part to 'deck' part now that we are throwing out the old layout plugin.\n// TODO(Zan): Extend to all strings?\nconst LayoutPartSchema = S.Union(\n S.Literal('sidebar'),\n S.Literal('main'),\n S.Literal('solo'),\n S.Literal('complementary'),\n S.Literal('fullScreen'),\n);\nexport type LayoutPart = S.Schema.Type<typeof LayoutPartSchema>;\n\nconst LayoutPartsSchema = S.partial(\n S.mutable(S.Record({ key: LayoutPartSchema, value: S.mutable(S.Array(LayoutEntrySchema)) })),\n);\nexport type LayoutParts = S.Schema.Type<typeof LayoutPartsSchema>;\n\nconst LayoutCoordinateSchema = S.mutable(S.Struct({ part: LayoutPartSchema, entryId: S.String }));\nexport type LayoutCoordinate = S.Schema.Type<typeof LayoutCoordinateSchema>;\n\nconst PartAdjustmentSchema = S.Union(\n S.Literal('increment-start'),\n S.Literal('increment-end'),\n S.Literal('pin-start'),\n S.Literal('pin-end'),\n S.Literal('close'),\n S.Literal('solo'),\n);\nexport type PartAdjustment = S.Schema.Type<typeof PartAdjustmentSchema>;\n\nconst LayoutAdjustmentSchema = S.mutable(\n S.Struct({ layoutCoordinate: LayoutCoordinateSchema, type: PartAdjustmentSchema }),\n);\nexport type LayoutAdjustment = S.Schema.Type<typeof LayoutAdjustmentSchema>;\n\n/** @deprecated */\nexport const ActiveParts = S.Record({ key: S.String, value: S.Union(S.String, S.mutable(S.Array(S.String))) });\nexport type ActiveParts = S.Schema.Type<typeof ActiveParts>;\n\n// TODO(burdon): Where should this go?\nexport type LayoutContainerProps<T> = T & { role?: string; coordinate?: LayoutCoordinate };\n\n/**\n * Provides for a plugin that can manage the app navigation.\n */\nconst LocationProvidesSchema = S.mutable(\n S.Struct({\n location: S.Struct({\n active: LayoutPartsSchema,\n closed: S.Array(S.String),\n }),\n }),\n);\nexport type LocationProvides = S.Schema.Type<typeof LocationProvidesSchema>;\n\n/**\n * Type guard for layout plugins.\n */\nexport const isLayoutParts = (value: unknown): value is LayoutParts => {\n return S.is(LayoutPartsSchema)(value);\n};\n\n// Type guard for PartAdjustment.\nexport const isLayoutAdjustment = (value: unknown): value is LayoutAdjustment => {\n return S.is(LayoutAdjustmentSchema)(value);\n};\n\n/**\n * Utilities.\n */\n\n/** Extracts all unique IDs from the layout parts. */\nexport const openIds = (layout: LayoutParts, parts?: LayoutPart[]): string[] => {\n return Object.values(parts ? pick(layout, parts) : layout)\n .flatMap((part) => part?.map((entry) => entry.id) ?? [])\n .filter((id): id is string => id !== undefined);\n};\n\nexport const firstIdInPart = (layout: LayoutParts | undefined, part: LayoutPart): string | undefined => {\n if (!layout) {\n return undefined;\n }\n\n return layout[part]?.at(0)?.id;\n};\n\nexport const indexInPart = (\n layout: LayoutParts | undefined,\n layoutCoordinate: LayoutCoordinate | undefined,\n): number | undefined => {\n if (!layout || !layoutCoordinate) {\n return undefined;\n }\n\n const { part, entryId } = layoutCoordinate;\n return layout[part]?.findIndex((entry) => entry.id === entryId);\n};\n\nexport const partLength = (layout: LayoutParts | undefined, part: LayoutPart | undefined): number => {\n if (!layout || !part) {\n return 0;\n }\n\n return layout[part]?.length ?? 0;\n};\n\n//\n// Intents\n//\n\nexport const NAVIGATION_PLUGIN = 'dxos.org/plugin/navigation';\nexport const NAVIGATION_ACTION = `${NAVIGATION_PLUGIN}/action`;\n\n/**\n * Expected payload for navigation actions.\n */\n// TODO(wittjosiah): These seem to be too deck-specific.\nexport namespace NavigationAction {\n /**\n * An additive overlay to apply to `location.active` (i.e. the result is a union of previous active and the argument)\n */\n export class Open extends S.TaggedClass<Open>()(`${NAVIGATION_ACTION}/open`, {\n input: S.Struct({\n activeParts: ActiveParts,\n noToggle: S.optional(S.Boolean),\n }),\n output: S.Struct({\n open: S.Array(S.String),\n }),\n }) {}\n\n /**\n * Payload for adding an item to the active items.\n */\n export class AddToActive extends S.TaggedClass<AddToActive>()(`${NAVIGATION_ACTION}/add-to-active`, {\n input: S.Struct({\n id: S.String,\n part: LayoutPartSchema,\n scrollIntoView: S.optional(S.Boolean),\n pivotId: S.optional(S.String),\n positioning: S.optional(S.Literal('start', 'end')),\n }),\n output: S.Void,\n }) {}\n\n /**\n * The active parts to directly set, to be used when working with URLs or restoring a specific state.\n */\n export class Set extends S.TaggedClass<Set>()(`${NAVIGATION_ACTION}/set`, {\n input: S.Struct({\n activeParts: ActiveParts,\n }),\n output: S.Void,\n }) {}\n\n /**\n * A subtractive overlay to apply to `location.active` (i.e. the result is a subtraction from the previous active of the argument)\n */\n export class Close extends S.TaggedClass<Close>()(`${NAVIGATION_ACTION}/close`, {\n input: S.Struct({\n activeParts: ActiveParts,\n noToggle: S.optional(S.Boolean),\n }),\n output: S.Void,\n }) {}\n\n /**\n * An atomic transaction to apply to `location.active`, describing which element to (attempt to) move to which location.\n */\n export class Adjust extends S.TaggedClass<Adjust>()(`${NAVIGATION_ACTION}/adjust`, {\n input: LayoutAdjustmentSchema,\n output: S.Void,\n }) {}\n\n // TODO(wittjosiah): This action seems unrelated to the others.\n export class Expose extends S.TaggedClass<Expose>()(`${NAVIGATION_ACTION}/expose`, {\n input: S.Struct({\n id: S.String,\n }),\n output: S.Void,\n }) {}\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type JSX, type ForwardedRef, type PropsWithChildren, type ReactNode } from 'react';\n\nimport { type GuardedType, type MakeOptional, type Disposition } from '@dxos/util';\n\nimport { type ErrorBoundary } from '../react';\n\n/**\n * SurfaceProps are the props that are passed to the Surface component.\n */\nexport type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\n}> &\n MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> & {\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n */\n [key: string]: unknown;\n };\n\n// NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.\ntype CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {\n /**\n * ID for debugging.\n */\n id: string;\n\n /**\n * Role defines how the data should be rendered.\n */\n role: string;\n\n /**\n * The data to be rendered by the surface.\n */\n data: T;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n};\n\ntype SurfaceComponentProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<\n CoreSurfaceProps<T> & { [key: string]: unknown }\n>;\n\n/**\n * React component used to render a surface once is has matched.\n */\nexport type SurfaceComponent<T extends Record<string, any> = Record<string, unknown>> = (\n props: SurfaceComponentProps<T>,\n forwardedRef: ForwardedRef<HTMLElement>,\n) => JSX.Element | null;\n\n/**\n * Definition of when a SurfaceComponent should be rendered.\n */\nexport type SurfaceDefinition<T extends Record<string, any> = any> = Readonly<{\n id: string;\n role: string | string[];\n disposition?: Disposition;\n filter?: (data: Record<string, unknown>) => data is T;\n component: SurfaceComponent<GuardedType<SurfaceDefinition<T>['filter']>>;\n}>;\n\nexport const createSurface = <T extends Record<string, any> = any>(definition: SurfaceDefinition<T>) => definition;\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { z } from 'zod';\n\n// TODO(burdon): Replace zod with effect.\nexport const ResourceKey = z.union([z.string(), z.record(z.any())]);\nexport type ResourceKey = z.infer<typeof ResourceKey>;\n\nexport const ResourceLanguage = z.record(ResourceKey);\nexport type ResourceLanguage = z.infer<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = z.record(ResourceLanguage);\nexport type Resource = z.infer<typeof Resource>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { effect } from '@preact/signals-core';\nimport React, { type PropsWithChildren, type ReactNode } from 'react';\n\nimport { invariant } from '@dxos/invariant';\nimport { create } from '@dxos/live-object';\n\nimport { Capabilities, Events } from './common';\nimport { PluginManager, type PluginManagerOptions, type Plugin } from './core';\nimport { topologicalSort } from './helpers';\nimport { ErrorBoundary, PluginManagerProvider } from './react';\n\nconst ENABLED_KEY = 'dxos.org/app-framework/enabled';\n\nexport type CreateAppOptions = {\n pluginManager?: PluginManager;\n pluginLoader?: PluginManagerOptions['pluginLoader'];\n plugins?: Plugin[];\n core?: string[];\n defaults?: string[];\n placeholder?: ReactNode;\n fallback?: ErrorBoundary['props']['fallback'];\n cacheEnabled?: boolean;\n};\n\n/**\n * Expected usage is for this to be the entrypoint of the application.\n * Initializes plugins and renders the root components.\n *\n * @example\n * const plugins = [LayoutPlugin(), MyPlugin()];\n * const core = [LayoutPluginId];\n * const default = [MyPluginId];\n * const fallback = <div>Initializing Plugins...</div>;\n * const App = createApp({ plugins, core, default, fallback });\n * createRoot(document.getElementById('root')!).render(\n * <StrictMode>\n * <App />\n * </StrictMode>,\n * );\n *\n * @param params.pluginLoader A function which loads new plugins.\n * @param params.plugins All plugins available to the application.\n * @param params.core Core plugins which will always be enabled.\n * @param params.defaults Default plugins are enabled by default but can be disabled by the user.\n * @param params.placeholder Placeholder component to render during startup.\n * @param params.fallback Fallback component to render if an error occurs during startup.\n * @param params.cacheEnabled Whether to cache enabled plugins in localStorage.\n */\nexport const createApp = ({\n pluginManager,\n pluginLoader: _pluginLoader,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n defaults = [],\n placeholder = null,\n fallback = DefaultFallback,\n cacheEnabled = false,\n}: CreateAppOptions) => {\n // TODO(wittjosiah): Provide a custom plugin loader which supports loading via url.\n const pluginLoader =\n _pluginLoader ??\n ((id: string) => {\n const plugin = plugins.find((plugin) => plugin.meta.id === id);\n invariant(plugin, `Plugin not found: ${id}`);\n return plugin;\n });\n\n const state = create({ ready: false, error: null });\n const cached: string[] = JSON.parse(localStorage.getItem(ENABLED_KEY) ?? '[]');\n const enabled = cacheEnabled && cached.length > 0 ? cached : defaults;\n const manager = pluginManager ?? new PluginManager({ pluginLoader, plugins, core, enabled });\n\n manager.activation.on(({ event, state: _state, error }) => {\n if (event === Events.Startup.id) {\n state.ready = _state === 'activated';\n }\n\n if (error && !state.ready && !state.error) {\n state.error = error;\n }\n });\n\n effect(() => {\n cacheEnabled && localStorage.setItem(ENABLED_KEY, JSON.stringify(manager.enabled));\n });\n\n manager.context.contributeCapability({\n interface: Capabilities.PluginManager,\n implementation: manager,\n module: 'dxos.org/app-framework/plugin-manager',\n });\n\n setupDevtools(manager);\n\n void manager.activate(Events.Startup);\n\n return () => (\n <ErrorBoundary fallback={fallback}>\n <App placeholder={placeholder} manager={manager} state={state} />\n </ErrorBoundary>\n );\n};\n\ntype AppProps = Required<Pick<CreateAppOptions, 'placeholder'>> & {\n manager: PluginManager;\n state: { ready: boolean; error: unknown };\n};\n\nconst App = ({ placeholder, manager, state }: AppProps) => {\n if (state.error) {\n // This trigger the error boundary to provide UI feedback for the startup error.\n throw state.error;\n }\n\n // TODO(wittjosiah): Consider using Suspense instead?\n if (!state.ready) {\n return <>{placeholder}</>;\n }\n\n const reactContexts = manager.context.requestCapabilities(Capabilities.ReactContext);\n const reactRoots = manager.context.requestCapabilities(Capabilities.ReactRoot);\n\n const ComposedContext = composeContexts(reactContexts);\n return (\n <PluginManagerProvider value={manager}>\n <ComposedContext>\n {reactRoots.map(({ id, root: Component }) => (\n <Component key={id} />\n ))}\n </ComposedContext>\n </PluginManagerProvider>\n );\n};\n\n// Default fallback does not use tailwind or theme.\nconst DefaultFallback = ({ error }: { error: Error }) => {\n return (\n <div style={{ padding: '1rem' }}>\n {/* TODO(wittjosiah): Link to docs for replacing default. */}\n <h1 style={{ fontSize: '1.2rem', fontWeight: 700, margin: '0.5rem 0' }}>{error.message}</h1>\n <pre>{error.stack}</pre>\n </div>\n );\n};\n\nconst composeContexts = (contexts: Capabilities.ReactContext[]) => {\n if (contexts.length === 0) {\n return ({ children }: PropsWithChildren) => <>{children}</>;\n }\n\n return topologicalSort(contexts)\n .map(({ context }) => context)\n .reduce((Acc, Next) => ({ children }) => (\n <Acc>\n <Next>{children}</Next>\n </Acc>\n ));\n};\n\nconst setupDevtools = (manager: PluginManager) => {\n (globalThis as any).composer ??= {};\n (globalThis as any).composer.manager = manager;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\ntype DependencyNode = {\n id: string;\n dependsOn?: string[];\n};\n\n/**\n * Topologically sorts a list of nodes based on their dependencies.\n */\n// TODO(wittjosiah): Factor out?\nexport const topologicalSort = <T extends DependencyNode>(nodes: T[]): T[] => {\n const getDependencies = (nodeId: string, seen = new Set<string>(), path = new Set<string>()): string[] => {\n if (path.has(nodeId)) {\n throw new Error(`Circular dependency detected involving ${nodeId}`);\n }\n if (seen.has(nodeId)) {\n return [];\n }\n\n const node = nodes.find((n) => n.id === nodeId);\n if (!node) {\n throw new Error(`Node ${nodeId} not found but is listed as a dependency`);\n }\n\n const newPath = new Set([...path, nodeId]);\n const newSeen = new Set([...seen, nodeId]);\n\n const dependsOn = node.dependsOn ?? [];\n return [...dependsOn.flatMap((depId) => getDependencies(depId, newSeen, newPath)), nodeId];\n };\n\n // Get all unique dependencies.\n const allDependencies = nodes\n .map((node) => node.id)\n .flatMap((id) => getDependencies(id))\n .filter((id, index, self) => self.indexOf(id) === index);\n\n // Map back to original nodes\n return allDependencies\n .map((id) => nodes.find((node) => node.id === id))\n .filter((node): node is T => node !== undefined);\n};\n"],
|
|
5
|
+
"mappings": ";AAOA,SAASA,QAAQC,iBAAiB;AAGlC,SAASC,eAAe;AACxB,SAASC,iBAAiB;AAC1B,SAASC,cAAc;AACvB,SAASC,WAAW;;AAKpB,IAAMC,qBAAoCC,OAAOC,IAAI,oBAAA;AAa9C,IAAMC,mBAAmB,CAAIC,eAAAA;AAClC,SAAO;IAAEA;EAAW;AACtB;AA8BA,IAAMC,iBAAN,MAAMA;EACJC,YACWC,UACAC,gBACT;SAFSD,WAAAA;SACAC,iBAAAA;EACR;AACL;AAKO,IAAMC,cAAc,CACzBC,cACAF,gBACAG,eAAAA;AAEA,SAAO;IAAEC,WAAWF;IA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C6B,KAAAA,MACC,gBAAA7B,OAAA,cAAC8B,MAAAA,MAAMJ,QAAAA,CAAAA,CAAAA;AAGf;AAEA,IAAM5B,gBAAgB,CAACjB,YAAAA;AACpBkD,aAAmBC,aAAa,CAAC;AACjCD,aAAmBC,SAASnD,UAAUA;AACzC;",
|
|
6
|
+
"names": ["effect", "untracked", "Trigger", "invariant", "create", "log", "InterfaceDefTypeId", "Symbol", "for", "defineCapability", "identifier", "CapabilityImpl", "constructor", "moduleId", "implementation", "contributes", "interfaceDef", "deactivate", "interface", "lazy", "c", "props", "then", "default", "getCapability", "PluginsContext", "activate", "reset", "_definedCapabilities", "Map", "contributeCapability", "module", "current", "get", "object", "value", "set", "push", "id", "count", "length", "removeCapability", "index", "findIndex", "i", "splice", "requestCapabilities", "filter", "capabilities", "map", "requestCapability", "capability", "waitForCapability", "trigger", "unsubscribe", "wake", "wait", "defineEvent", "id", "specifier", "eventKey", "event", "oneOf", "events", "type", "allOf", "isOneOf", "isAllOf", "getEvents", "untracked", "Effect", "Either", "Match", "Event", "create", "log", "isPromise", "value", "PluginManager", "constructor", "pluginLoader", "plugins", "core", "map", "meta", "id", "enabled", "activation", "Event", "context", "PluginsContext", "activate", "event", "reset", "_capabilities", "Map", "_pluginLoader", "_state", "create", "modules", "active", "pendingRemoval", "pendingReset", "eventsFired", "forEach", "plugin", "_addPlugin", "enable", "add", "untracked", "log", "_getPlugin", "includes", "push", "module", "_addModule", "_setPendingResetByModule", "remove", "result", "disable", "_removePlugin", "enabledIndex", "findIndex", "splice", "_removeModule", "Effect", "runPromise", "_activate", "deactivate", "_deactivate", "_reset", "pluginIndex", "moduleIndex", "find", "_getActiveModules", "filter", "_getInactiveModules", "_getActiveModulesByEvent", "key", "getEvents", "activatesOn", "eventKey", "_getInactiveModulesByEvent", "activationEvents", "parentEvents", "flatMap", "activatesBefore", "Array", "from", "Set", "length", "events", "self", "gen", "pendingIndex", "emit", "state", "isAllOf", "every", "all", "_activateModule", "pipe", "either", "Either", "isLeft", "error", "left", "fail", "activatesAfter", "program", "maybeCapabilities", "Match", "when", "isEffect", "effect", "promise", "tryPromise", "try", "catch", "orElse", "succeed", "capabilities", "isArray", "array", "capability", "contributeCapability", "set", "results", "_deactivateModule", "get", "removeCapability", "interface", "implementation", "delete", "activeIndex", "PluginModule", "constructor", "options", "id", "activatesOn", "activatesBefore", "activatesAfter", "activate", "defineModule", "Plugin", "meta", "modules", "definePlugin", "Capabilities", "PluginManager", "defineCapability", "Null", "ReactContext", "ReactRoot", "ReactSurface", "IntentResolver", "IntentDispatcher", "Layout", "MutableLayout", "Location", "MutableLocation", "Translations", "AppGraph", "AppGraphBuilder", "AppGraphSerializer", "SettingsStore", "Settings", "Metadata", "FileUploader", "Events", "Startup", "defineEvent", "SetupIntents", "SetupSettings", "SetupAppGraph", "SetupTranslations", "DispatcherReady", "SettingsReady", "AppGraphReady", "createStateEvent", "specifier", "LayoutReady", "Capabilities", "Layout", "identifier", "LocationReady", "Location", "S", "defaultFileTypes", "images", "media", "text", "FileInfoSchema", "S", "Struct", "name", "String", "type", "url", "optional", "cid", "S", "createIntent", "schema", "data", "params", "_", "S", "validateSync", "fields", "input", "intent", "_schema", "action", "_tag", "first", "last", "all", "chain", "intents", "Label", "Union", "String", "mutable", "Tuple", "Struct", "ns", "count", "optional", "Number", "S", "INTENT_PLUGIN", "INTENT_ACTION", "IntentAction", "ShowUndo", "S", "TaggedClass", "input", "Struct", "message", "Label", "output", "Void", "Effect", "Option", "pipe", "Ref", "byDisposition", "BaseError", "Error", "constructor", "code", "message", "context", "name", "Object", "setPrototypeOf", "prototype", "NoResolversError", "action", "CycleDetectedError", "EXECUTION_LIMIT", "HISTORY_LIMIT", "createResolver", "schema", "effect", "params", "action", "_tag", "isUndoable", "historyEntry", "length", "every", "undoable", "createDispatcher", "getResolvers", "executionLimit", "historyLimit", "historyRef", "Effect", "runSync", "Ref", "make", "handleIntent", "intent", "gen", "candidates", "module", "filter", "r", "data", "toSorted", "byDisposition", "_intent", "error", "NoResolversError", "undo", "result", "isEffect", "promise", "dispatch", "intentChain", "depth", "fail", "CycleDetectedError", "resultsRef", "all", "prev", "get", "update", "results", "intents", "history", "next", "splice", "pipe", "createIntent", "IntentAction", "ShowUndo", "message", "catchSome", "err", "Option", "some", "succeed", "undefined", "none", "dispatchPromise", "runPromise", "then", "catch", "last", "findLastIndex", "map", "undoData", "first", "at", "h", "_", "index", "undoPromise", "React", "Component", "ErrorBoundary", "Component", "constructor", "props", "state", "error", "undefined", "getDerivedStateFromError", "componentDidUpdate", "prevProps", "data", "resetError", "render", "this", "fallback", "reset", "children", "setState", "createContext", "useContext", "raise", "PluginManagerContext", "createContext", "undefined", "usePluginManager", "useContext", "raise", "Error", "PluginManagerProvider", "Provider", "computed", "useMemo", "useCapabilities", "interfaceDef", "filter", "manager", "usePluginManager", "signal", "useMemo", "computed", "context", "requestCapabilities", "value", "useCapability", "requestCapability", "React", "memo", "forwardRef", "Suspense", "useMemo", "useDefaultValue", "byDisposition", "S", "createContext", "useContext", "useEffect", "raise", "pick", "IntentContext", "createContext", "undefined", "useIntentDispatcher", "context", "useContext", "raise", "Error", "pick", "useIntentResolver", "module", "resolver", "manager", "usePluginManager", "useEffect", "contributeCapability", "interface", "Capabilities", "IntentResolver", "implementation", "removeCapability", "IntentProvider", "Provider", "Effect", "React", "create", "defaultEffect", "Effect", "fail", "Error", "defaultPromise", "runPromise", "IntentPlugin", "definePlugin", "id", "INTENT_PLUGIN", "defineModule", "activatesOn", "Events", "Startup", "activatesBefore", "SetupIntents", "activatesAfter", "DispatcherReady", "activate", "context", "state", "create", "dispatch", "dispatchPromise", "undo", "undoPromise", "createDispatcher", "module", "requestCapabilities", "Capabilities", "IntentResolver", "c", "moduleId", "flat", "contributes", "IntentDispatcher", "ReactContext", "children", "React", "IntentProvider", "value", "Toast", "S", "Struct", "id", "String", "title", "optional", "Label", "description", "icon", "duration", "Number", "closeLabel", "actionLabel", "actionAlt", "onAction", "Any", "LayoutMode", "Union", "Literal", "isLayoutMode", "value", "is", "Layout", "mutable", "layoutMode", "sidebarOpen", "Boolean", "complementarySidebarOpen", "complementarySidebarContent", "dialogOpen", "dialogContent", "dialogBlockAlign", "dialogType", "popoverOpen", "popoverContent", "popoverAnchorId", "toasts", "Array", "scrollIntoView", "LAYOUT_PLUGIN", "LAYOUT_ACTION", "LayoutAction", "SetLayout", "TaggedClass", "input", "element", "state", "component", "subject", "anchorId", "output", "Void", "SetLayoutMode", "revert", "ScrollIntoView", "cursor", "ref", "Schema", "S", "pick", "SLUG_LIST_SEPARATOR", "SLUG_ENTRY_SEPARATOR", "SLUG_KEY_VALUE_SEPARATOR", "SLUG_PATH_SEPARATOR", "SLUG_COLLECTION_INDICATOR", "LayoutEntrySchema", "S", "mutable", "Struct", "id", "String", "path", "optional", "LayoutPartSchema", "Union", "Literal", "LayoutPartsSchema", "partial", "Record", "key", "value", "Array", "LayoutCoordinateSchema", "part", "entryId", "PartAdjustmentSchema", "LayoutAdjustmentSchema", "layoutCoordinate", "type", "ActiveParts", "LocationProvidesSchema", "location", "active", "closed", "isLayoutParts", "is", "isLayoutAdjustment", "openIds", "layout", "parts", "Object", "values", "pick", "flatMap", "map", "entry", "filter", "undefined", "firstIdInPart", "at", "indexInPart", "findIndex", "partLength", "length", "NAVIGATION_PLUGIN", "NAVIGATION_ACTION", "NavigationAction", "Open", "TaggedClass", "input", "activeParts", "noToggle", "Boolean", "output", "open", "AddToActive", "scrollIntoView", "pivotId", "positioning", "Void", "Set", "Close", "Adjust", "Expose", "createSurface", "definition", "z", "ResourceKey", "z", "union", "string", "record", "any", "ResourceLanguage", "Resource", "useSurfaces", "surfaces", "useCapabilities", "Capabilities", "ReactSurface", "useMemo", "flat", "findCandidates", "role", "data", "Object", "values", "filter", "definition", "Array", "isArray", "includes", "toSorted", "byDisposition", "isSurfaceAvailable", "context", "requestCapabilities", "candidates", "length", "Surface", "memo", "forwardRef", "id", "_id", "_data", "limit", "fallback", "placeholder", "rest", "forwardedRef", "useDefaultValue", "definitions", "slice", "nodes", "map", "component", "Component", "React", "ref", "key", "suspense", "Suspense", "ErrorBoundary", "effect", "React", "invariant", "create", "topologicalSort", "nodes", "getDependencies", "nodeId", "seen", "Set", "path", "has", "Error", "node", "find", "n", "id", "newPath", "newSeen", "dependsOn", "flatMap", "depId", "allDependencies", "map", "filter", "index", "self", "indexOf", "undefined", "ENABLED_KEY", "createApp", "pluginManager", "pluginLoader", "_pluginLoader", "plugins", "core", "map", "meta", "id", "defaults", "placeholder", "fallback", "DefaultFallback", "cacheEnabled", "plugin", "find", "invariant", "state", "create", "ready", "error", "cached", "JSON", "parse", "localStorage", "getItem", "enabled", "length", "manager", "PluginManager", "activation", "on", "event", "_state", "Events", "Startup", "effect", "setItem", "stringify", "context", "contributeCapability", "interface", "Capabilities", "implementation", "module", "setupDevtools", "activate", "React", "ErrorBoundary", "App", "reactContexts", "requestCapabilities", "ReactContext", "reactRoots", "ReactRoot", "ComposedContext", "composeContexts", "PluginManagerProvider", "value", "root", "Component", "key", "div", "style", "padding", "h1", "fontSize", "fontWeight", "margin", "message", "pre", "stack", "contexts", "children", "topologicalSort", "reduce", "Acc", "Next", "globalThis", "composer"]
|
|
7
|
+
}
|