@dxos/app-framework 0.7.4 → 0.7.5-labs.071a3e2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/app-graph-builder-MOLT4EHG.mjs +137 -0
- package/dist/lib/browser/app-graph-builder-MOLT4EHG.mjs.map +7 -0
- package/dist/lib/browser/chunk-G3HBVVT5.mjs +1403 -0
- package/dist/lib/browser/chunk-G3HBVVT5.mjs.map +7 -0
- package/dist/lib/browser/chunk-LDJ3T4V3.mjs +32 -0
- package/dist/lib/browser/chunk-LDJ3T4V3.mjs.map +7 -0
- package/dist/lib/browser/chunk-TGOF2WQZ.mjs +285 -0
- package/dist/lib/browser/chunk-TGOF2WQZ.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +135 -543
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-dispatcher-LJKNIGAM.mjs +11 -0
- package/dist/lib/browser/intent-resolver-Z724VAMC.mjs +38 -0
- package/dist/lib/browser/intent-resolver-Z724VAMC.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/store-NWCY7LAP.mjs +19 -0
- package/dist/lib/browser/store-NWCY7LAP.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +74 -0
- package/dist/lib/browser/testing/index.mjs.map +7 -0
- package/dist/lib/browser/worker.mjs +77 -0
- package/dist/lib/node/app-graph-builder-G7SRXDFD.cjs +146 -0
- package/dist/lib/node/app-graph-builder-G7SRXDFD.cjs.map +7 -0
- package/dist/lib/node/chunk-55KIQ6YK.cjs +1437 -0
- package/dist/lib/node/chunk-55KIQ6YK.cjs.map +7 -0
- package/dist/lib/node/chunk-5GABBW2Q.cjs +308 -0
- package/dist/lib/node/chunk-5GABBW2Q.cjs.map +7 -0
- package/dist/lib/node/chunk-QLVQ6PND.cjs +58 -0
- package/dist/lib/node/chunk-QLVQ6PND.cjs.map +7 -0
- package/dist/lib/node/index.cjs +136 -558
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/{plugin-settings-OZ6IKAE5.cjs → intent-dispatcher-CGUK3BCJ.cjs} +10 -10
- package/dist/lib/node/intent-dispatcher-CGUK3BCJ.cjs.map +7 -0
- package/dist/lib/node/intent-resolver-7GNKPRWT.cjs +45 -0
- package/dist/lib/node/intent-resolver-7GNKPRWT.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/store-WMJSEQPC.cjs +34 -0
- package/dist/lib/node/store-WMJSEQPC.cjs.map +7 -0
- package/dist/lib/node/testing/index.cjs +98 -0
- package/dist/lib/node/testing/index.cjs.map +7 -0
- package/dist/lib/node/worker.cjs +99 -0
- package/dist/lib/node/worker.cjs.map +7 -0
- package/dist/lib/node-esm/app-graph-builder-MKLYH3NE.mjs +138 -0
- package/dist/lib/node-esm/app-graph-builder-MKLYH3NE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-47FG42II.mjs +286 -0
- package/dist/lib/node-esm/chunk-47FG42II.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CNJYZNSL.mjs +34 -0
- package/dist/lib/node-esm/chunk-CNJYZNSL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZTB4TA6Q.mjs +1405 -0
- package/dist/lib/node-esm/chunk-ZTB4TA6Q.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +135 -543
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-dispatcher-RZAWA4XD.mjs +12 -0
- package/dist/lib/node-esm/intent-resolver-UIU37CKJ.mjs +39 -0
- package/dist/lib/node-esm/intent-resolver-UIU37CKJ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/store-YUWINFBN.mjs +20 -0
- package/dist/lib/node-esm/store-YUWINFBN.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +75 -0
- package/dist/lib/node-esm/testing/index.mjs.map +7 -0
- package/dist/lib/node-esm/worker.mjs +78 -0
- package/dist/types/src/App.d.ts +22 -13
- package/dist/types/src/App.d.ts.map +1 -1
- package/dist/types/src/common/capabilities.d.ts +296 -0
- package/dist/types/src/common/capabilities.d.ts.map +1 -0
- package/dist/types/src/common/events.d.ts +48 -0
- package/dist/types/src/common/events.d.ts.map +1 -0
- package/dist/types/src/common/file.d.ts +14 -0
- package/dist/types/src/common/file.d.ts.map +1 -0
- package/dist/types/src/common/graph.d.ts +21 -0
- package/dist/types/src/common/graph.d.ts.map +1 -0
- package/dist/types/src/common/index.d.ts +8 -0
- package/dist/types/src/common/index.d.ts.map +1 -0
- package/dist/types/src/common/layout.d.ts +248 -0
- package/dist/types/src/common/layout.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/common/translations.d.ts +11 -0
- package/dist/types/src/common/translations.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.d.ts +94 -0
- package/dist/types/src/core/capabilities.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.test.d.ts +2 -0
- package/dist/types/src/core/capabilities.test.d.ts.map +1 -0
- package/dist/types/src/core/events.d.ts +58 -0
- package/dist/types/src/core/events.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +5 -0
- package/dist/types/src/core/index.d.ts.map +1 -0
- package/dist/types/src/core/manager.d.ts +119 -0
- package/dist/types/src/core/manager.d.ts.map +1 -0
- package/dist/types/src/core/manager.test.d.ts +2 -0
- package/dist/types/src/core/manager.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +97 -0
- package/dist/types/src/core/plugin.d.ts.map +1 -0
- package/dist/types/src/helpers.d.ts +10 -0
- package/dist/types/src/helpers.d.ts.map +1 -0
- package/dist/types/src/helpers.test.d.ts +2 -0
- package/dist/types/src/helpers.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/debug/Debug.d.ts +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 +7 -0
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -0
- package/dist/types/src/playground/generator/index.d.ts +3 -0
- package/dist/types/src/playground/generator/index.d.ts.map +1 -0
- package/dist/types/src/playground/generator/plugin.d.ts +2 -0
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/layout/Layout.d.ts +8 -0
- package/dist/types/src/playground/layout/Layout.d.ts.map +1 -0
- package/dist/types/src/playground/layout/index.d.ts +2 -0
- package/dist/types/src/playground/layout/index.d.ts.map +1 -0
- package/dist/types/src/playground/layout/plugin.d.ts +2 -0
- package/dist/types/src/playground/layout/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/logger/Toolbar.d.ts +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/IntentPlugin.d.ts +2 -0
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/actions.d.ts +23 -0
- package/dist/types/src/plugin-intent/actions.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/errors.d.ts +16 -0
- package/dist/types/src/plugin-intent/errors.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/index.d.ts +5 -0
- package/dist/types/src/plugin-intent/index.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +113 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +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 +27 -0
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +197 -0
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/index.d.ts +3 -0
- package/dist/types/src/plugin-settings/index.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +4 -0
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/store.d.ts +5 -0
- package/dist/types/src/plugin-settings/store.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/translations.d.ts +11 -0
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -0
- package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -0
- package/dist/types/src/react/IntentContext.d.ts +8 -0
- package/dist/types/src/react/IntentContext.d.ts.map +1 -0
- package/dist/types/src/react/PluginManagerProvider.d.ts +10 -0
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +1 -0
- package/dist/types/src/react/Surface.d.ts +12 -0
- package/dist/types/src/react/Surface.d.ts.map +1 -0
- package/dist/types/src/react/Surface.stories.d.ts +16 -0
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -0
- package/dist/types/src/react/common.d.ts +12 -0
- package/dist/types/src/react/common.d.ts.map +1 -0
- package/dist/types/src/react/index.d.ts +7 -0
- package/dist/types/src/react/index.d.ts.map +1 -0
- package/dist/types/src/react/useCapabilities.d.ts +13 -0
- package/dist/types/src/react/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/react/useIntentResolver.d.ts +3 -0
- package/dist/types/src/react/useIntentResolver.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +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/src/worker.d.ts +4 -0
- package/dist/types/src/worker.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +39 -17
- package/project.json +4 -3
- package/src/App.tsx +139 -34
- package/src/common/capabilities.ts +97 -0
- package/src/common/events.ts +72 -0
- package/src/common/file.ts +22 -0
- package/src/common/graph.ts +30 -0
- package/src/{plugins/common → common}/index.ts +3 -2
- package/src/common/layout.ts +225 -0
- package/src/common/surface.ts +81 -0
- package/src/common/translations.ts +17 -0
- package/src/core/capabilities.test.ts +116 -0
- package/src/core/capabilities.ts +222 -0
- package/src/core/events.ts +58 -0
- package/src/core/index.ts +8 -0
- package/src/core/manager.test.ts +516 -0
- package/src/core/manager.ts +511 -0
- package/src/core/plugin.ts +131 -0
- package/src/helpers.test.ts +97 -0
- package/src/helpers.ts +45 -0
- package/src/index.ts +6 -3
- package/src/playground/debug/Debug.tsx +39 -0
- package/src/playground/debug/index.ts +5 -0
- package/src/playground/debug/plugin.ts +17 -0
- package/src/playground/generator/Main.tsx +71 -0
- package/src/playground/generator/Toolbar.tsx +46 -0
- package/src/playground/generator/generator.ts +48 -0
- package/src/playground/generator/index.ts +6 -0
- package/src/playground/generator/plugin.ts +23 -0
- package/src/playground/layout/Layout.tsx +33 -0
- package/src/playground/layout/index.ts +5 -0
- package/src/playground/layout/plugin.ts +17 -0
- package/src/playground/logger/Toolbar.tsx +29 -0
- package/src/playground/logger/index.ts +5 -0
- package/src/playground/logger/plugin.ts +36 -0
- package/src/playground/logger/schema.ts +12 -0
- package/src/playground/playground.stories.tsx +34 -0
- package/src/plugin-intent/IntentPlugin.tsx +20 -0
- package/src/plugin-intent/actions.ts +22 -0
- package/src/plugin-intent/errors.ts +39 -0
- package/src/plugin-intent/index.ts +8 -0
- package/src/plugin-intent/intent-dispatcher.test.ts +299 -0
- package/src/plugin-intent/intent-dispatcher.ts +304 -0
- package/src/plugin-intent/intent.ts +146 -0
- package/src/plugin-settings/SettingsPlugin.ts +35 -0
- package/src/plugin-settings/actions.ts +27 -0
- package/src/plugin-settings/app-graph-builder.ts +122 -0
- package/src/plugin-settings/index.ts +6 -0
- package/src/plugin-settings/intent-resolver.ts +28 -0
- package/src/plugin-settings/store.ts +20 -0
- package/src/plugin-settings/translations.ts +17 -0
- package/src/react/IntentContext.tsx +34 -0
- package/src/react/PluginManagerProvider.ts +22 -0
- package/src/react/Surface.stories.tsx +96 -0
- package/src/react/Surface.tsx +75 -0
- package/src/react/common.ts +12 -0
- package/src/react/index.ts +10 -0
- package/src/react/useCapabilities.ts +40 -0
- package/src/react/useIntentResolver.ts +22 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/withPluginManager.stories.tsx +47 -0
- package/src/testing/withPluginManager.tsx +75 -0
- package/src/worker.ts +11 -0
- package/tsconfig.json +54 -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-settings-OM3G2QFY.mjs +0 -11
- package/dist/lib/browser/plugin-surface-LECZMKSQ.mjs +0 -24
- 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.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-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 +0 -7
- 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 +0 -196
- package/dist/types/src/plugins/common/navigation.d.ts.map +0 -1
- package/dist/types/src/plugins/common/translations.d.ts +0 -22
- package/dist/types/src/plugins/common/translations.d.ts.map +0 -1
- package/dist/types/src/plugins/helpers.d.ts +0 -41
- package/dist/types/src/plugins/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/index.d.ts +0 -7
- package/dist/types/src/plugins/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts +0 -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/navigation.ts +0 -185
- 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/lib/browser/{plugin-intent-LU4KL2RO.mjs.map → intent-dispatcher-LJKNIGAM.mjs.map} +0 -0
- /package/dist/lib/browser/{plugin-settings-OM3G2QFY.mjs.map → worker.mjs.map} +0 -0
- /package/dist/lib/{browser/plugin-surface-LECZMKSQ.mjs.map → node-esm/intent-dispatcher-RZAWA4XD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{plugin-intent-V7ER24Y6.mjs.map → worker.mjs.map} +0 -0
- /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,146 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Schema as S } from '@effect/schema';
|
|
6
|
+
|
|
7
|
+
export type IntentParams = {
|
|
8
|
+
readonly input: S.Schema.All;
|
|
9
|
+
readonly output: S.Schema.All;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export type IntentData<Fields extends IntentParams> =
|
|
13
|
+
S.Schema.Type<S.Struct<Fields>> extends { readonly input: any } ? S.Schema.Type<S.Struct<Fields>>['input'] : any;
|
|
14
|
+
|
|
15
|
+
export type IntentResultData<Fields extends IntentParams> =
|
|
16
|
+
S.Schema.Type<S.Struct<Fields>> extends { readonly output: any } ? S.Schema.Type<S.Struct<Fields>>['output'] : any;
|
|
17
|
+
|
|
18
|
+
export type IntentSchema<Tag extends string, Fields extends IntentParams> = S.TaggedClass<any, Tag, Fields>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* An intent is an abstract description of an operation to be performed.
|
|
22
|
+
* Intents allow actions to be performed across plugins.
|
|
23
|
+
*/
|
|
24
|
+
export type Intent<Tag extends string, Fields extends IntentParams> = {
|
|
25
|
+
_schema: IntentSchema<Tag, Fields>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The id of the intent.
|
|
29
|
+
*/
|
|
30
|
+
id: Tag;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Any data needed to perform the desired action.
|
|
34
|
+
*/
|
|
35
|
+
data: IntentData<Fields>;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Module ID.
|
|
39
|
+
* If specified, the intent will be sent explicitly to the plugin module.
|
|
40
|
+
* Otherwise, the intent will be sent to all plugins, in order and the first to resolve a non-null value will be used.
|
|
41
|
+
*/
|
|
42
|
+
module?: string;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Whether or not the intent is being undone.
|
|
46
|
+
*/
|
|
47
|
+
undo?: boolean;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type AnyIntent = Intent<any, any>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Chain of intents to be executed together.
|
|
54
|
+
* The result of each intent is merged into the next intent's input data.
|
|
55
|
+
*/
|
|
56
|
+
export type IntentChain<
|
|
57
|
+
FirstTag extends string,
|
|
58
|
+
LastTag extends string,
|
|
59
|
+
FirstFields extends IntentParams,
|
|
60
|
+
LastFields extends IntentParams,
|
|
61
|
+
> = {
|
|
62
|
+
first: Intent<FirstTag, FirstFields>;
|
|
63
|
+
last: Intent<LastTag, LastFields>;
|
|
64
|
+
all: AnyIntent[];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type AnyIntentChain = IntentChain<any, any, any, any>;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Creates a typed intent.
|
|
71
|
+
* @param schema Schema of the intent. Must be a tagged class with input and output schemas.
|
|
72
|
+
* @param data Data fulfilling the input schema of the intent.
|
|
73
|
+
* @param params.plugin Optional plugin ID to send the intent to.
|
|
74
|
+
* @param params.undo Optional flag to indicate that the intent is being undone. Generally not set manually.
|
|
75
|
+
*/
|
|
76
|
+
export const createIntent = <Tag extends string, Fields extends IntentParams>(
|
|
77
|
+
schema: IntentSchema<Tag, Fields>,
|
|
78
|
+
data: IntentData<Fields> = {},
|
|
79
|
+
params: Pick<AnyIntent, 'module' | 'undo'> = {},
|
|
80
|
+
): IntentChain<Tag, Tag, Fields, Fields> => {
|
|
81
|
+
// The output of validateSync breaks proxy objects so this is just used for validation.
|
|
82
|
+
// TODO(wittjosiah): Is there a better way to make theses types align?
|
|
83
|
+
const _ = S.validateSync(schema.fields.input as S.Schema<any, any, unknown>)(data);
|
|
84
|
+
const intent = {
|
|
85
|
+
...params,
|
|
86
|
+
_schema: schema,
|
|
87
|
+
id: schema._tag,
|
|
88
|
+
data,
|
|
89
|
+
} satisfies Intent<Tag, Fields>;
|
|
90
|
+
|
|
91
|
+
return {
|
|
92
|
+
first: intent,
|
|
93
|
+
last: intent,
|
|
94
|
+
all: [intent],
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// TODO(wittjosiah): Add a function for mapping the output of one intent to the input of another.
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Chain two intents together.
|
|
102
|
+
*
|
|
103
|
+
* NOTE: Chaining of intents depends on the data inputs and outputs being structs.
|
|
104
|
+
*/
|
|
105
|
+
export const chain =
|
|
106
|
+
<
|
|
107
|
+
FirstTag extends string,
|
|
108
|
+
NextTag extends string,
|
|
109
|
+
FirstFields extends IntentParams,
|
|
110
|
+
LastFields extends IntentParams,
|
|
111
|
+
NextFields extends IntentParams,
|
|
112
|
+
>(
|
|
113
|
+
schema: IntentSchema<NextTag, NextFields>,
|
|
114
|
+
data: Omit<IntentData<NextFields>, keyof IntentResultData<LastFields>> = {},
|
|
115
|
+
params: Pick<AnyIntent, 'module' | 'undo'> = {},
|
|
116
|
+
) =>
|
|
117
|
+
(
|
|
118
|
+
intent: IntentChain<FirstTag, any, FirstFields, LastFields>,
|
|
119
|
+
): IntentChain<FirstTag, NextTag, FirstFields, NextFields> => {
|
|
120
|
+
const intents = 'all' in intent ? intent.all : [intent];
|
|
121
|
+
const first = intents[0];
|
|
122
|
+
const last = {
|
|
123
|
+
...params,
|
|
124
|
+
_schema: schema,
|
|
125
|
+
id: schema._tag,
|
|
126
|
+
data,
|
|
127
|
+
} satisfies Intent<NextTag, NextFields>;
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
first,
|
|
131
|
+
last,
|
|
132
|
+
all: [...intents, last],
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
//
|
|
137
|
+
// Intents
|
|
138
|
+
//
|
|
139
|
+
|
|
140
|
+
// NOTE: Should maintain compatibility with `i18next` (and @dxos/react-ui).
|
|
141
|
+
// TODO(wittjosiah): Making this immutable breaks type compatibility.
|
|
142
|
+
export const Label = S.Union(
|
|
143
|
+
S.String,
|
|
144
|
+
S.mutable(S.Tuple(S.String, S.mutable(S.Struct({ ns: S.String, count: S.optional(S.Number) })))),
|
|
145
|
+
);
|
|
146
|
+
export type Label = S.Schema.Type<typeof Label>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { SETTINGS_PLUGIN } from './actions';
|
|
6
|
+
import translations from './translations';
|
|
7
|
+
import { Capabilities, Events } from '../common';
|
|
8
|
+
import { contributes, defineModule, definePlugin, lazy } from '../core';
|
|
9
|
+
|
|
10
|
+
// TODO(wittjosiah): Add options to exclude some modules.
|
|
11
|
+
export const SettingsPlugin = () =>
|
|
12
|
+
definePlugin({ id: SETTINGS_PLUGIN }, [
|
|
13
|
+
defineModule({
|
|
14
|
+
id: `${SETTINGS_PLUGIN}/module/store`,
|
|
15
|
+
activatesOn: Events.Startup,
|
|
16
|
+
activatesBefore: [Events.SetupSettings],
|
|
17
|
+
activatesAfter: [Events.SettingsReady],
|
|
18
|
+
activate: lazy(() => import('./store')),
|
|
19
|
+
}),
|
|
20
|
+
defineModule({
|
|
21
|
+
id: `${SETTINGS_PLUGIN}/module/translations`,
|
|
22
|
+
activatesOn: Events.SetupTranslations,
|
|
23
|
+
activate: () => contributes(Capabilities.Translations, translations),
|
|
24
|
+
}),
|
|
25
|
+
defineModule({
|
|
26
|
+
id: `${SETTINGS_PLUGIN}/module/intent-resolver`,
|
|
27
|
+
activatesOn: Events.SetupIntents,
|
|
28
|
+
activate: lazy(() => import('./intent-resolver')),
|
|
29
|
+
}),
|
|
30
|
+
defineModule({
|
|
31
|
+
id: `${SETTINGS_PLUGIN}/module/app-graph-builder`,
|
|
32
|
+
activatesOn: Events.SetupAppGraph,
|
|
33
|
+
activate: lazy(() => import('./app-graph-builder')),
|
|
34
|
+
}),
|
|
35
|
+
]);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Schema as S } from '@effect/schema';
|
|
6
|
+
|
|
7
|
+
export const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';
|
|
8
|
+
export const SETTINGS_ACTION = `${SETTINGS_PLUGIN}/action`;
|
|
9
|
+
export const SETTINGS_ID = 'dxos:settings';
|
|
10
|
+
export const SETTINGS_KEY = 'settings';
|
|
11
|
+
|
|
12
|
+
export namespace SettingsAction {
|
|
13
|
+
export class Open extends S.TaggedClass<Open>()(`${SETTINGS_ACTION}/open`, {
|
|
14
|
+
input: S.Struct({
|
|
15
|
+
plugin: S.optional(S.String),
|
|
16
|
+
}),
|
|
17
|
+
output: S.Void,
|
|
18
|
+
}) {}
|
|
19
|
+
|
|
20
|
+
export class OpenPluginRegistry extends S.TaggedClass<OpenPluginRegistry>()(
|
|
21
|
+
`${SETTINGS_ACTION}/open-plugin-registry`,
|
|
22
|
+
{
|
|
23
|
+
input: S.Void,
|
|
24
|
+
output: S.Void,
|
|
25
|
+
},
|
|
26
|
+
) {}
|
|
27
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createExtension, type Node } from '@dxos/app-graph';
|
|
6
|
+
import { type SettingsStore, type SettingsValue } from '@dxos/local-storage';
|
|
7
|
+
import { nonNullable } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import { SETTINGS_ID, SETTINGS_KEY, SETTINGS_PLUGIN, SettingsAction } from './actions';
|
|
10
|
+
import { Capabilities } from '../common';
|
|
11
|
+
import { contributes, type PluginMeta, type PluginsContext } from '../core';
|
|
12
|
+
import { createIntent } from '../plugin-intent';
|
|
13
|
+
|
|
14
|
+
export default (context: PluginsContext) =>
|
|
15
|
+
contributes(Capabilities.AppGraphBuilder, [
|
|
16
|
+
createExtension({
|
|
17
|
+
id: `${SETTINGS_PLUGIN}/action`,
|
|
18
|
+
filter: (node): node is Node<null> => node.id === 'root',
|
|
19
|
+
actions: () => [
|
|
20
|
+
{
|
|
21
|
+
id: SETTINGS_PLUGIN,
|
|
22
|
+
data: async () => {
|
|
23
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
24
|
+
await dispatch(createIntent(SettingsAction.Open));
|
|
25
|
+
},
|
|
26
|
+
properties: {
|
|
27
|
+
label: ['open settings label', { ns: SETTINGS_PLUGIN }],
|
|
28
|
+
icon: 'ph--gear--regular',
|
|
29
|
+
keyBinding: {
|
|
30
|
+
macos: 'meta+,',
|
|
31
|
+
windows: 'alt+,',
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
}),
|
|
37
|
+
createExtension({
|
|
38
|
+
id: `${SETTINGS_PLUGIN}/core`,
|
|
39
|
+
filter: (node): node is Node<null> => node.id === 'root',
|
|
40
|
+
connector: () => [
|
|
41
|
+
{
|
|
42
|
+
id: SETTINGS_ID,
|
|
43
|
+
type: SETTINGS_PLUGIN,
|
|
44
|
+
properties: {
|
|
45
|
+
label: ['app settings label', { ns: SETTINGS_PLUGIN }],
|
|
46
|
+
icon: 'ph--gear--regular',
|
|
47
|
+
disposition: 'pin-end',
|
|
48
|
+
position: 'fallback',
|
|
49
|
+
testId: 'treeView.appSettings',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
}),
|
|
54
|
+
createExtension({
|
|
55
|
+
id: `${SETTINGS_PLUGIN}/core-plugins`,
|
|
56
|
+
filter: (node): node is Node<null> => node.id === SETTINGS_ID,
|
|
57
|
+
connector: () => {
|
|
58
|
+
const manager = context.requestCapability(Capabilities.PluginManager);
|
|
59
|
+
const [settingsStore] = context.requestCapabilities(Capabilities.SettingsStore);
|
|
60
|
+
return [
|
|
61
|
+
...manager.plugins
|
|
62
|
+
.filter((plugin) => manager.core.includes(plugin.meta.id))
|
|
63
|
+
.map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {
|
|
64
|
+
const settings = settingsStore?.getStore(plugin.meta.id);
|
|
65
|
+
if (!settings) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return [plugin.meta, settings];
|
|
70
|
+
})
|
|
71
|
+
.filter(nonNullable)
|
|
72
|
+
.map(([meta, settings]) => ({
|
|
73
|
+
id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,
|
|
74
|
+
type: 'category',
|
|
75
|
+
data: settings,
|
|
76
|
+
properties: {
|
|
77
|
+
label: meta.name ?? meta.id,
|
|
78
|
+
icon: meta.icon ?? 'ph--circle--regular',
|
|
79
|
+
},
|
|
80
|
+
})),
|
|
81
|
+
|
|
82
|
+
{
|
|
83
|
+
id: `${SETTINGS_KEY}:custom-plugins`,
|
|
84
|
+
type: 'collection',
|
|
85
|
+
properties: {
|
|
86
|
+
label: ['custom plugins label', { ns: SETTINGS_PLUGIN }],
|
|
87
|
+
icon: 'ph--squares-four--regular',
|
|
88
|
+
role: 'branch',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
},
|
|
93
|
+
}),
|
|
94
|
+
createExtension({
|
|
95
|
+
id: `${SETTINGS_PLUGIN}/custom-plugins`,
|
|
96
|
+
filter: (node): node is Node<null> => node.id === `${SETTINGS_KEY}:custom-plugins`,
|
|
97
|
+
connector: () => {
|
|
98
|
+
const manager = context.requestCapability(Capabilities.PluginManager);
|
|
99
|
+
const [settingsStore] = context.requestCapabilities(Capabilities.SettingsStore);
|
|
100
|
+
return manager.plugins
|
|
101
|
+
.filter((plugin) => !manager.core.includes(plugin.meta.id))
|
|
102
|
+
.map((plugin): [PluginMeta, SettingsStore<SettingsValue>] | null => {
|
|
103
|
+
const settings = settingsStore?.getStore(plugin.meta.id);
|
|
104
|
+
if (!settings) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return [plugin.meta, settings];
|
|
109
|
+
})
|
|
110
|
+
.filter(nonNullable)
|
|
111
|
+
.map(([meta, settings]) => ({
|
|
112
|
+
id: `${SETTINGS_KEY}:${meta.id.replaceAll('/', ':')}`,
|
|
113
|
+
type: 'category',
|
|
114
|
+
data: settings,
|
|
115
|
+
properties: {
|
|
116
|
+
label: meta.name ?? meta.id,
|
|
117
|
+
icon: meta.icon ?? 'ph--circle--regular',
|
|
118
|
+
},
|
|
119
|
+
}));
|
|
120
|
+
},
|
|
121
|
+
}),
|
|
122
|
+
]);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { pipe } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { SETTINGS_ID, SETTINGS_KEY, SettingsAction } from './actions';
|
|
8
|
+
import { Capabilities, LayoutAction } from '../common';
|
|
9
|
+
import { contributes } from '../core';
|
|
10
|
+
import { createResolver, createIntent, chain } from '../plugin-intent';
|
|
11
|
+
|
|
12
|
+
export default () =>
|
|
13
|
+
contributes(
|
|
14
|
+
Capabilities.IntentResolver,
|
|
15
|
+
createResolver({
|
|
16
|
+
intent: SettingsAction.Open,
|
|
17
|
+
resolve: ({ plugin }) => {
|
|
18
|
+
return {
|
|
19
|
+
intents: [
|
|
20
|
+
pipe(
|
|
21
|
+
createIntent(LayoutAction.SwitchWorkspace, { part: 'workspace', subject: SETTINGS_ID }),
|
|
22
|
+
chain(LayoutAction.Open, { part: 'main', subject: [`${SETTINGS_KEY}:${plugin.replaceAll('/', ':')}`] }),
|
|
23
|
+
),
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { RootSettingsStore } from '@dxos/local-storage';
|
|
6
|
+
|
|
7
|
+
import { Capabilities } from '../common';
|
|
8
|
+
import { contributes, type PluginsContext } from '../core';
|
|
9
|
+
|
|
10
|
+
export default (context: PluginsContext) => {
|
|
11
|
+
// TODO(wittjosiah): This should subscribe to capabilities and create stores for newly added settings objects.
|
|
12
|
+
const allSettings = context.requestCapabilities(Capabilities.Settings);
|
|
13
|
+
const settingsStore = new RootSettingsStore();
|
|
14
|
+
|
|
15
|
+
allSettings.forEach((setting) => {
|
|
16
|
+
settingsStore.createStore(setting as any);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
return contributes(Capabilities.SettingsStore, settingsStore);
|
|
20
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { SETTINGS_PLUGIN } from './actions';
|
|
6
|
+
|
|
7
|
+
export default [
|
|
8
|
+
{
|
|
9
|
+
'en-US': {
|
|
10
|
+
[SETTINGS_PLUGIN]: {
|
|
11
|
+
'open settings label': 'Open settings',
|
|
12
|
+
'app settings label': 'Settings',
|
|
13
|
+
'custom plugins label': 'Plugins',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Context, createContext, useContext, type Provider, useEffect } from 'react';
|
|
6
|
+
|
|
7
|
+
import { raise } from '@dxos/debug';
|
|
8
|
+
import { pick } from '@dxos/util';
|
|
9
|
+
|
|
10
|
+
import { usePluginManager } from './PluginManagerProvider';
|
|
11
|
+
import { Capabilities } from '../common';
|
|
12
|
+
import { type AnyIntentResolver, type IntentContext } from '../plugin-intent';
|
|
13
|
+
|
|
14
|
+
const IntentContext: Context<IntentContext | undefined> = createContext<IntentContext | undefined>(undefined);
|
|
15
|
+
|
|
16
|
+
export const useIntentDispatcher = (): Pick<IntentContext, 'dispatch' | 'dispatchPromise'> => {
|
|
17
|
+
const context = useContext(IntentContext) ?? raise(new Error('IntentContext not found'));
|
|
18
|
+
return pick(context, ['dispatch', 'dispatchPromise']);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const useIntentResolver = (module: string, resolver: AnyIntentResolver) => {
|
|
22
|
+
const manager = usePluginManager();
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
manager.context.contributeCapability({
|
|
25
|
+
module,
|
|
26
|
+
interface: Capabilities.IntentResolver,
|
|
27
|
+
implementation: resolver,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
return () => manager.context.removeCapability(Capabilities.IntentResolver, resolver);
|
|
31
|
+
}, [module, resolver]);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const IntentProvider: Provider<IntentContext | undefined> = IntentContext.Provider;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { createContext, useContext } from 'react';
|
|
6
|
+
|
|
7
|
+
import { raise } from '@dxos/debug';
|
|
8
|
+
|
|
9
|
+
import { type PluginManager } from '../core';
|
|
10
|
+
|
|
11
|
+
const PluginManagerContext = createContext<PluginManager | undefined>(undefined);
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Get the plugin manager.
|
|
15
|
+
*/
|
|
16
|
+
export const usePluginManager = (): PluginManager =>
|
|
17
|
+
useContext(PluginManagerContext) ?? raise(new Error('Missing PluginManagerContext'));
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Context provider for a plugin manager.
|
|
21
|
+
*/
|
|
22
|
+
export const PluginManagerProvider = PluginManagerContext.Provider;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import React, { useCallback, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { faker } from '@dxos/random';
|
|
10
|
+
import { Button, List, ListItem } from '@dxos/react-ui';
|
|
11
|
+
import { withLayout, withTheme } from '@dxos/storybook-utils';
|
|
12
|
+
|
|
13
|
+
import { PluginManagerProvider, usePluginManager } from './PluginManagerProvider';
|
|
14
|
+
import { Surface, useSurfaces } from './Surface';
|
|
15
|
+
import { Capabilities, createSurface } from '../common';
|
|
16
|
+
import { type PluginManager } from '../core';
|
|
17
|
+
import { setupPluginManager } from '../testing';
|
|
18
|
+
|
|
19
|
+
const randomColor = (): string => {
|
|
20
|
+
const hue = faker.number.int({ min: 0, max: 360 });
|
|
21
|
+
const saturation = faker.number.int({ min: 50, max: 90 });
|
|
22
|
+
const lightness = faker.number.int({ min: 40, max: 70 });
|
|
23
|
+
return `hsl(${hue}, ${saturation}%, ${lightness}%)`;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const Story = () => {
|
|
27
|
+
const manager = usePluginManager();
|
|
28
|
+
const surfaces = useSurfaces();
|
|
29
|
+
const [picked, setPicked] = useState('test');
|
|
30
|
+
|
|
31
|
+
const handleAdd = useCallback(() => {
|
|
32
|
+
const id = `test-${faker.number.int({ min: 0, max: 1_000_000 })}`;
|
|
33
|
+
const backgroundColor = randomColor();
|
|
34
|
+
|
|
35
|
+
manager.context.contributeCapability({
|
|
36
|
+
module: 'test',
|
|
37
|
+
interface: Capabilities.ReactSurface,
|
|
38
|
+
implementation: createSurface({
|
|
39
|
+
id,
|
|
40
|
+
role: id,
|
|
41
|
+
component: () => (
|
|
42
|
+
<div className='flex-1' style={{ backgroundColor }}>
|
|
43
|
+
{id}
|
|
44
|
+
</div>
|
|
45
|
+
),
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
setPicked(id);
|
|
50
|
+
}, [manager]);
|
|
51
|
+
|
|
52
|
+
const handlePick = useCallback(() => {
|
|
53
|
+
setPicked(faker.helpers.arrayElement(surfaces).id);
|
|
54
|
+
}, [surfaces]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className='flex flex-col gap-2'>
|
|
58
|
+
<div className='flex gap-2'>
|
|
59
|
+
<Button onClick={handleAdd}>Add</Button>
|
|
60
|
+
<Button onClick={handlePick}>Pick</Button>
|
|
61
|
+
</div>
|
|
62
|
+
<div className='flex gap-2'>
|
|
63
|
+
<div className='flex-1'>
|
|
64
|
+
<List itemSizes='one'>
|
|
65
|
+
{surfaces.map((surface) => (
|
|
66
|
+
<ListItem.Root key={surface.id} id={surface.id}>
|
|
67
|
+
<ListItem.Heading classNames='grow pbs-2'>{surface.id}</ListItem.Heading>
|
|
68
|
+
</ListItem.Root>
|
|
69
|
+
))}
|
|
70
|
+
</List>
|
|
71
|
+
</div>
|
|
72
|
+
<div className='flex-1'>
|
|
73
|
+
<Surface role={picked} limit={1} />
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export default {
|
|
81
|
+
title: 'sdk/app-framework/Surface',
|
|
82
|
+
render: ({ manager }: { manager: PluginManager }) => {
|
|
83
|
+
return (
|
|
84
|
+
<PluginManagerProvider value={manager}>
|
|
85
|
+
<Story />
|
|
86
|
+
</PluginManagerProvider>
|
|
87
|
+
);
|
|
88
|
+
},
|
|
89
|
+
// NOTE: Intentionally not using withPluginManager to try to reduce surface area of the story.
|
|
90
|
+
decorators: [withTheme, withLayout({ tooltips: true })],
|
|
91
|
+
args: {
|
|
92
|
+
manager: setupPluginManager(),
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const Default = {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React, { memo, forwardRef, Suspense, useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
import { useDefaultValue } from '@dxos/react-hooks';
|
|
8
|
+
import { byPosition } from '@dxos/util';
|
|
9
|
+
|
|
10
|
+
import { ErrorBoundary } from './ErrorBoundary';
|
|
11
|
+
import { useCapabilities } from './useCapabilities';
|
|
12
|
+
import { Capabilities, type SurfaceDefinition, type SurfaceProps } from '../common';
|
|
13
|
+
import { type PluginsContext } from '../core';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export const useSurfaces = () => {
|
|
19
|
+
const surfaces = useCapabilities(Capabilities.ReactSurface);
|
|
20
|
+
return useMemo(() => surfaces.flat(), [surfaces]);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const findCandidates = (surfaces: SurfaceDefinition[], { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {
|
|
24
|
+
return Object.values(surfaces)
|
|
25
|
+
.filter((definition) =>
|
|
26
|
+
Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role,
|
|
27
|
+
)
|
|
28
|
+
.filter(({ filter }) => (filter ? filter(data ?? {}) : true))
|
|
29
|
+
.toSorted(byPosition);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @returns `true` if there is a contributed surface which matches the specified role & data, `false` otherwise.
|
|
34
|
+
*/
|
|
35
|
+
export const isSurfaceAvailable = (context: PluginsContext, { role, data }: Pick<SurfaceProps, 'role' | 'data'>) => {
|
|
36
|
+
const surfaces = context.requestCapabilities(Capabilities.ReactSurface);
|
|
37
|
+
const candidates = findCandidates(surfaces.flat(), { role, data });
|
|
38
|
+
return candidates.length > 0;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A surface is a named region of the screen that can be populated by plugins.
|
|
43
|
+
*/
|
|
44
|
+
export const Surface = memo(
|
|
45
|
+
forwardRef<HTMLElement, SurfaceProps>(
|
|
46
|
+
({ id: _id, role, data: _data, limit, fallback, placeholder, ...rest }, forwardedRef) => {
|
|
47
|
+
// TODO(wittjosiah): This will make all surfaces depend on a single signal.
|
|
48
|
+
// This isn't ideal because it means that any change to the data will cause all surfaces to re-render.
|
|
49
|
+
// This effectively means that plugin modules which contribute surfaces need to all be activated at startup.
|
|
50
|
+
// This should be fine for now because it's how it worked prior to capabilities api anyways.
|
|
51
|
+
// In the future, it would be nice to be able to bucket the surface contributions by role.
|
|
52
|
+
const surfaces = useSurfaces();
|
|
53
|
+
const data = useDefaultValue(_data, () => ({}));
|
|
54
|
+
|
|
55
|
+
// NOTE: Memoizing the candidates makes the surface not re-render based on reactivity within data.
|
|
56
|
+
const definitions = findCandidates(surfaces, { role, data });
|
|
57
|
+
const candidates = limit ? definitions.slice(0, limit) : definitions;
|
|
58
|
+
const nodes = candidates.map(({ component: Component, id }) => (
|
|
59
|
+
<Component ref={forwardedRef} key={id} id={id} role={role} data={data} limit={limit} {...rest} />
|
|
60
|
+
));
|
|
61
|
+
|
|
62
|
+
const suspense = placeholder ? <Suspense fallback={placeholder}>{nodes}</Suspense> : nodes;
|
|
63
|
+
|
|
64
|
+
return fallback ? (
|
|
65
|
+
<ErrorBoundary data={data} fallback={fallback}>
|
|
66
|
+
{suspense}
|
|
67
|
+
</ErrorBoundary>
|
|
68
|
+
) : (
|
|
69
|
+
suspense
|
|
70
|
+
);
|
|
71
|
+
},
|
|
72
|
+
),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
Surface.displayName = 'Surface';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { useCapability } from './useCapabilities';
|
|
6
|
+
import { Capabilities } from '../common';
|
|
7
|
+
|
|
8
|
+
export const useIntentDispatcher = () => useCapability(Capabilities.IntentDispatcher);
|
|
9
|
+
|
|
10
|
+
export const useAppGraph = () => useCapability(Capabilities.AppGraph);
|
|
11
|
+
|
|
12
|
+
export const useLayout = () => useCapability(Capabilities.Layout);
|