@dxos/app-framework 0.7.5-main.9d26e3a → 0.7.5-main.b19bfc8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/app-graph-builder-S4MYSHQA.mjs +137 -0
- package/dist/lib/browser/app-graph-builder-S4MYSHQA.mjs.map +7 -0
- package/dist/lib/browser/chunk-BCMEJONP.mjs +1432 -0
- package/dist/lib/browser/chunk-BCMEJONP.mjs.map +7 -0
- package/dist/lib/browser/chunk-QS4J6O47.mjs +285 -0
- package/dist/lib/browser/chunk-QS4J6O47.mjs.map +7 -0
- package/dist/lib/browser/chunk-SRZH2PQ2.mjs +32 -0
- package/dist/lib/browser/chunk-SRZH2PQ2.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +119 -642
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-dispatcher-GFBH7T2J.mjs +11 -0
- package/dist/lib/browser/intent-resolver-KAFM7CQH.mjs +39 -0
- package/dist/lib/browser/intent-resolver-KAFM7CQH.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/store-L3VRR7II.mjs +29 -0
- package/dist/lib/browser/store-L3VRR7II.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +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-VMHWFCTP.cjs +146 -0
- package/dist/lib/node/app-graph-builder-VMHWFCTP.cjs.map +7 -0
- package/dist/lib/node/chunk-7Y6KJ3OK.cjs +1466 -0
- package/dist/lib/node/chunk-7Y6KJ3OK.cjs.map +7 -0
- package/dist/lib/node/chunk-B65NJEIJ.cjs +308 -0
- package/dist/lib/node/chunk-B65NJEIJ.cjs.map +7 -0
- package/dist/lib/node/{chunk-FCMHRU3M.cjs → chunk-VCIHQZSN.cjs} +23 -35
- package/dist/lib/node/chunk-VCIHQZSN.cjs.map +7 -0
- package/dist/lib/node/index.cjs +125 -665
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/{plugin-settings-W6UHMH5M.cjs → intent-dispatcher-PRCC4KZT.cjs} +10 -14
- package/dist/lib/node/intent-dispatcher-PRCC4KZT.cjs.map +7 -0
- package/dist/lib/node/intent-resolver-OZDKCHPW.cjs +46 -0
- package/dist/lib/node/intent-resolver-OZDKCHPW.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/store-BVUKNVKL.cjs +44 -0
- package/dist/lib/node/store-BVUKNVKL.cjs.map +7 -0
- package/dist/lib/node/testing/index.cjs +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-XHI5IIXQ.mjs +138 -0
- package/dist/lib/node-esm/app-graph-builder-XHI5IIXQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-CBT75GCX.mjs +34 -0
- package/dist/lib/node-esm/chunk-CBT75GCX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-JDAHZRYQ.mjs +286 -0
- package/dist/lib/node-esm/chunk-JDAHZRYQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-TVIR2PHY.mjs +1434 -0
- package/dist/lib/node-esm/chunk-TVIR2PHY.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +119 -642
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-dispatcher-LGACN32C.mjs +12 -0
- package/dist/lib/node-esm/intent-resolver-RBNG76ZX.mjs +40 -0
- package/dist/lib/node-esm/intent-resolver-RBNG76ZX.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/store-PHTOEREN.mjs +30 -0
- package/dist/lib/node-esm/store-PHTOEREN.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +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 +304 -0
- package/dist/types/src/common/capabilities.d.ts.map +1 -0
- package/dist/types/src/common/events.d.ts +52 -0
- package/dist/types/src/common/events.d.ts.map +1 -0
- package/dist/types/src/common/file.d.ts +14 -0
- package/dist/types/src/common/file.d.ts.map +1 -0
- package/dist/types/src/common/graph.d.ts +21 -0
- package/dist/types/src/common/graph.d.ts.map +1 -0
- package/dist/types/src/common/index.d.ts +8 -0
- package/dist/types/src/common/index.d.ts.map +1 -0
- package/dist/types/src/common/layout.d.ts +262 -0
- package/dist/types/src/common/layout.d.ts.map +1 -0
- package/dist/types/src/{plugins/plugin-surface/SurfaceContext.d.ts → common/surface.d.ts} +12 -29
- package/dist/types/src/common/surface.d.ts.map +1 -0
- package/dist/types/src/common/translations.d.ts +11 -0
- package/dist/types/src/common/translations.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.d.ts +94 -0
- package/dist/types/src/core/capabilities.d.ts.map +1 -0
- package/dist/types/src/core/capabilities.test.d.ts +2 -0
- package/dist/types/src/core/capabilities.test.d.ts.map +1 -0
- package/dist/types/src/core/events.d.ts +58 -0
- package/dist/types/src/core/events.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +5 -0
- package/dist/types/src/core/index.d.ts.map +1 -0
- package/dist/types/src/core/manager.d.ts +119 -0
- package/dist/types/src/core/manager.d.ts.map +1 -0
- package/dist/types/src/core/manager.test.d.ts +2 -0
- package/dist/types/src/core/manager.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +97 -0
- package/dist/types/src/core/plugin.d.ts.map +1 -0
- package/dist/types/src/helpers.d.ts +10 -0
- package/dist/types/src/helpers.d.ts.map +1 -0
- package/dist/types/src/helpers.test.d.ts +2 -0
- package/dist/types/src/helpers.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +5 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/debug/Debug.d.ts +5 -0
- package/dist/types/src/playground/debug/Debug.d.ts.map +1 -0
- package/dist/types/src/playground/debug/index.d.ts +2 -0
- package/dist/types/src/playground/debug/index.d.ts.map +1 -0
- package/dist/types/src/playground/debug/plugin.d.ts +2 -0
- package/dist/types/src/playground/debug/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/generator/Main.d.ts +5 -0
- package/dist/types/src/playground/generator/Main.d.ts.map +1 -0
- package/dist/types/src/playground/generator/Toolbar.d.ts +5 -0
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -0
- package/dist/types/src/playground/generator/generator.d.ts +7 -0
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -0
- package/dist/types/src/playground/generator/index.d.ts +3 -0
- package/dist/types/src/playground/generator/index.d.ts.map +1 -0
- package/dist/types/src/playground/generator/plugin.d.ts +2 -0
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/layout/Layout.d.ts +8 -0
- package/dist/types/src/playground/layout/Layout.d.ts.map +1 -0
- package/dist/types/src/playground/layout/index.d.ts +2 -0
- package/dist/types/src/playground/layout/index.d.ts.map +1 -0
- package/dist/types/src/playground/layout/plugin.d.ts +2 -0
- package/dist/types/src/playground/layout/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/logger/Toolbar.d.ts +5 -0
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -0
- package/dist/types/src/playground/logger/index.d.ts +2 -0
- package/dist/types/src/playground/logger/index.d.ts.map +1 -0
- package/dist/types/src/playground/logger/plugin.d.ts +2 -0
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -0
- package/dist/types/src/playground/logger/schema.d.ts +13 -0
- package/dist/types/src/playground/logger/schema.d.ts.map +1 -0
- package/dist/types/src/playground/playground.stories.d.ts +9 -0
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +2 -0
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/actions.d.ts +23 -0
- package/dist/types/src/plugin-intent/actions.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/errors.d.ts +16 -0
- package/dist/types/src/plugin-intent/errors.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/index.d.ts +5 -0
- package/dist/types/src/plugin-intent/index.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +113 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +1 -0
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +1 -0
- package/dist/types/src/{plugins/plugin-intent → plugin-intent}/intent.d.ts +8 -28
- package/dist/types/src/plugin-intent/intent.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +2 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/actions.d.ts +27 -0
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +197 -0
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/index.d.ts +3 -0
- package/dist/types/src/plugin-settings/index.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +4 -0
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/store.d.ts +5 -0
- package/dist/types/src/plugin-settings/store.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/translations.d.ts +11 -0
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -0
- package/dist/types/src/{plugins/plugin-surface → react}/ErrorBoundary.d.ts +1 -1
- package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -0
- package/dist/types/src/{plugins/plugin-intent → react}/IntentContext.d.ts +2 -2
- package/dist/types/src/react/IntentContext.d.ts.map +1 -0
- package/dist/types/src/react/PluginManagerProvider.d.ts +10 -0
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +1 -0
- package/dist/types/src/react/Surface.d.ts +12 -0
- package/dist/types/src/react/Surface.d.ts.map +1 -0
- package/dist/types/src/react/Surface.stories.d.ts +15 -0
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -0
- package/dist/types/src/react/common.d.ts +13 -0
- package/dist/types/src/react/common.d.ts.map +1 -0
- package/dist/types/src/react/index.d.ts +7 -0
- package/dist/types/src/react/index.d.ts.map +1 -0
- package/dist/types/src/react/useCapabilities.d.ts +13 -0
- package/dist/types/src/react/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/react/useIntentResolver.d.ts +3 -0
- package/dist/types/src/react/useIntentResolver.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +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 -1
- package/package.json +40 -19
- package/project.json +5 -3
- package/src/App.tsx +140 -34
- package/src/common/capabilities.ts +101 -0
- package/src/common/events.ts +77 -0
- package/src/common/file.ts +22 -0
- package/src/common/graph.ts +30 -0
- package/src/{plugins/common → common}/index.ts +3 -2
- package/src/common/layout.ts +238 -0
- package/src/{plugins/plugin-surface/SurfaceContext.ts → common/surface.ts} +6 -37
- package/src/common/translations.ts +17 -0
- package/src/core/capabilities.test.ts +116 -0
- package/src/core/capabilities.ts +222 -0
- package/src/core/events.ts +58 -0
- package/src/core/index.ts +8 -0
- package/src/core/manager.test.ts +516 -0
- package/src/core/manager.ts +511 -0
- package/src/core/plugin.ts +131 -0
- package/src/helpers.test.ts +97 -0
- package/src/helpers.ts +45 -0
- package/src/index.ts +6 -3
- package/src/playground/debug/Debug.tsx +39 -0
- package/src/playground/debug/index.ts +5 -0
- package/src/playground/debug/plugin.ts +17 -0
- package/src/playground/generator/Main.tsx +71 -0
- package/src/playground/generator/Toolbar.tsx +46 -0
- package/src/playground/generator/generator.ts +48 -0
- package/src/playground/generator/index.ts +6 -0
- package/src/playground/generator/plugin.ts +23 -0
- package/src/playground/layout/Layout.tsx +33 -0
- package/src/playground/layout/index.ts +5 -0
- package/src/playground/layout/plugin.ts +17 -0
- package/src/playground/logger/Toolbar.tsx +29 -0
- package/src/playground/logger/index.ts +5 -0
- package/src/playground/logger/plugin.ts +36 -0
- package/src/playground/logger/schema.ts +12 -0
- package/src/playground/playground.stories.tsx +34 -0
- package/src/plugin-intent/IntentPlugin.tsx +20 -0
- package/src/plugin-intent/actions.ts +22 -0
- package/src/plugin-intent/errors.ts +39 -0
- package/src/plugin-intent/index.ts +8 -0
- package/src/{plugins/plugin-intent → plugin-intent}/intent-dispatcher.test.ts +83 -63
- package/src/{plugins/plugin-intent → plugin-intent}/intent-dispatcher.ts +118 -95
- package/src/{plugins/plugin-intent → plugin-intent}/intent.ts +10 -26
- package/src/plugin-settings/SettingsPlugin.ts +35 -0
- package/src/plugin-settings/actions.ts +27 -0
- package/src/plugin-settings/app-graph-builder.ts +122 -0
- package/src/plugin-settings/index.ts +6 -0
- package/src/plugin-settings/intent-resolver.ts +34 -0
- package/src/plugin-settings/store.ts +30 -0
- package/src/plugin-settings/translations.ts +17 -0
- package/src/{plugins/plugin-intent → react}/IntentContext.tsx +13 -5
- package/src/react/PluginManagerProvider.ts +22 -0
- package/src/react/Surface.stories.tsx +96 -0
- package/src/react/Surface.tsx +75 -0
- package/src/react/common.ts +12 -0
- package/src/react/index.ts +10 -0
- package/src/react/useCapabilities.ts +40 -0
- package/src/react/useIntentResolver.ts +22 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/withPluginManager.stories.tsx +47 -0
- package/src/testing/withPluginManager.tsx +75 -0
- package/src/worker.ts +11 -0
- package/tsconfig.json +19 -13
- package/dist/lib/browser/chunk-3E7RY3CE.mjs +0 -72
- package/dist/lib/browser/chunk-3E7RY3CE.mjs.map +0 -7
- package/dist/lib/browser/chunk-QG25ZU2N.mjs +0 -320
- package/dist/lib/browser/chunk-QG25ZU2N.mjs.map +0 -7
- package/dist/lib/browser/chunk-SPDTXTOV.mjs +0 -163
- package/dist/lib/browser/chunk-SPDTXTOV.mjs.map +0 -7
- package/dist/lib/browser/chunk-WBOXEHBE.mjs +0 -51
- package/dist/lib/browser/chunk-WBOXEHBE.mjs.map +0 -7
- package/dist/lib/browser/plugin-intent-T7Y3MJ5C.mjs +0 -32
- package/dist/lib/browser/plugin-settings-5U2L2NRU.mjs +0 -15
- package/dist/lib/browser/plugin-surface-OKPF3EQI.mjs +0 -24
- package/dist/lib/node/chunk-BW3RNEVI.cjs +0 -185
- package/dist/lib/node/chunk-BW3RNEVI.cjs.map +0 -7
- package/dist/lib/node/chunk-FCMHRU3M.cjs.map +0 -7
- package/dist/lib/node/chunk-QBM42OQ6.cjs +0 -97
- package/dist/lib/node/chunk-QBM42OQ6.cjs.map +0 -7
- package/dist/lib/node/chunk-VWHAALIN.cjs +0 -344
- package/dist/lib/node/chunk-VWHAALIN.cjs.map +0 -7
- package/dist/lib/node/plugin-intent-F3TQZIUR.cjs +0 -53
- package/dist/lib/node/plugin-intent-F3TQZIUR.cjs.map +0 -7
- package/dist/lib/node/plugin-settings-W6UHMH5M.cjs.map +0 -7
- package/dist/lib/node/plugin-surface-CCSIONYW.cjs +0 -45
- package/dist/lib/node/plugin-surface-CCSIONYW.cjs.map +0 -7
- package/dist/lib/node-esm/chunk-3T5UIJY3.mjs +0 -53
- package/dist/lib/node-esm/chunk-3T5UIJY3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4GX7V5ZE.mjs +0 -164
- package/dist/lib/node-esm/chunk-4GX7V5ZE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CFOUYXQ6.mjs +0 -321
- package/dist/lib/node-esm/chunk-CFOUYXQ6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs +0 -74
- package/dist/lib/node-esm/chunk-EYCTSFEJ.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-intent-W2HQC6LC.mjs +0 -33
- package/dist/lib/node-esm/plugin-settings-H5RHNFVC.mjs +0 -16
- package/dist/lib/node-esm/plugin-settings-H5RHNFVC.mjs.map +0 -7
- package/dist/lib/node-esm/plugin-surface-V3YET3UL.mjs +0 -25
- package/dist/lib/node-esm/plugin-surface-V3YET3UL.mjs.map +0 -7
- package/dist/types/src/plugins/common/file.d.ts +0 -22
- package/dist/types/src/plugins/common/file.d.ts.map +0 -1
- package/dist/types/src/plugins/common/graph.d.ts +0 -51
- package/dist/types/src/plugins/common/graph.d.ts.map +0 -1
- package/dist/types/src/plugins/common/index.d.ts +0 -7
- package/dist/types/src/plugins/common/index.d.ts.map +0 -1
- package/dist/types/src/plugins/common/layout.d.ts +0 -176
- package/dist/types/src/plugins/common/layout.d.ts.map +0 -1
- package/dist/types/src/plugins/common/metadata.d.ts +0 -16
- package/dist/types/src/plugins/common/metadata.d.ts.map +0 -1
- package/dist/types/src/plugins/common/navigation.d.ts +0 -243
- package/dist/types/src/plugins/common/navigation.d.ts.map +0 -1
- package/dist/types/src/plugins/common/translations.d.ts +0 -22
- package/dist/types/src/plugins/common/translations.d.ts.map +0 -1
- package/dist/types/src/plugins/helpers.d.ts +0 -41
- package/dist/types/src/plugins/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/index.d.ts +0 -7
- package/dist/types/src/plugins/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts +0 -16
- package/dist/types/src/plugins/plugin-host/HostPlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts +0 -14
- package/dist/types/src/plugins/plugin-host/PluginContainer.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/PluginContext.d.ts +0 -47
- package/dist/types/src/plugins/plugin-host/PluginContext.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/index.d.ts +0 -6
- package/dist/types/src/plugins/plugin-host/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/plugin.d.ts +0 -104
- package/dist/types/src/plugins/plugin-host/plugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-host/plugin.test.d.ts +0 -35
- package/dist/types/src/plugins/plugin-host/plugin.test.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/IntentContext.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts +0 -8
- package/dist/types/src/plugins/plugin-intent/IntentPlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/index.d.ts +0 -7
- package/dist/types/src/plugins/plugin-intent/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/intent-dispatcher.d.ts +0 -107
- package/dist/types/src/plugins/plugin-intent/intent-dispatcher.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/intent-dispatcher.test.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/intent.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/meta.d.ts +0 -6
- package/dist/types/src/plugins/plugin-intent/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-intent/provides.d.ts +0 -16
- package/dist/types/src/plugins/plugin-intent/provides.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts +0 -4
- package/dist/types/src/plugins/plugin-settings/SettingsPlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/index.d.ts +0 -4
- package/dist/types/src/plugins/plugin-settings/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/meta.d.ts +0 -5
- package/dist/types/src/plugins/plugin-settings/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-settings/provides.d.ts +0 -26
- package/dist/types/src/plugins/plugin-settings/provides.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/ErrorBoundary.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/Surface.d.ts +0 -7
- package/dist/types/src/plugins/plugin-surface/Surface.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/SurfaceContext.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts +0 -7
- package/dist/types/src/plugins/plugin-surface/SurfacePlugin.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/helpers.d.ts +0 -21
- package/dist/types/src/plugins/plugin-surface/helpers.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/index.d.ts +0 -8
- package/dist/types/src/plugins/plugin-surface/index.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/meta.d.ts +0 -5
- package/dist/types/src/plugins/plugin-surface/meta.d.ts.map +0 -1
- package/dist/types/src/plugins/plugin-surface/provides.d.ts +0 -17
- package/dist/types/src/plugins/plugin-surface/provides.d.ts.map +0 -1
- package/src/plugins/common/file.ts +0 -36
- package/src/plugins/common/graph.ts +0 -70
- package/src/plugins/common/layout.ts +0 -173
- package/src/plugins/common/metadata.ts +0 -29
- package/src/plugins/common/navigation.ts +0 -214
- package/src/plugins/common/translations.ts +0 -36
- package/src/plugins/helpers.ts +0 -92
- package/src/plugins/index.ts +0 -11
- package/src/plugins/plugin-host/HostPlugin.tsx +0 -88
- package/src/plugins/plugin-host/PluginContainer.tsx +0 -120
- package/src/plugins/plugin-host/PluginContext.tsx +0 -79
- package/src/plugins/plugin-host/index.ts +0 -12
- package/src/plugins/plugin-host/plugin.test.ts +0 -158
- package/src/plugins/plugin-host/plugin.ts +0 -133
- package/src/plugins/plugin-intent/IntentPlugin.tsx +0 -75
- package/src/plugins/plugin-intent/index.ts +0 -13
- package/src/plugins/plugin-intent/meta.ts +0 -11
- package/src/plugins/plugin-intent/provides.ts +0 -26
- package/src/plugins/plugin-settings/SettingsPlugin.tsx +0 -22
- package/src/plugins/plugin-settings/index.ts +0 -9
- package/src/plugins/plugin-settings/meta.ts +0 -9
- package/src/plugins/plugin-settings/provides.ts +0 -34
- package/src/plugins/plugin-surface/Surface.tsx +0 -62
- package/src/plugins/plugin-surface/SurfacePlugin.tsx +0 -45
- package/src/plugins/plugin-surface/helpers.ts +0 -22
- package/src/plugins/plugin-surface/index.ts +0 -14
- package/src/plugins/plugin-surface/meta.ts +0 -9
- package/src/plugins/plugin-surface/provides.ts +0 -27
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
- /package/dist/lib/browser/{plugin-intent-T7Y3MJ5C.mjs.map → intent-dispatcher-GFBH7T2J.mjs.map} +0 -0
- /package/dist/lib/browser/{plugin-settings-5U2L2NRU.mjs.map → worker.mjs.map} +0 -0
- /package/dist/lib/{browser/plugin-surface-OKPF3EQI.mjs.map → node-esm/intent-dispatcher-LGACN32C.mjs.map} +0 -0
- /package/dist/lib/node-esm/{plugin-intent-W2HQC6LC.mjs.map → worker.mjs.map} +0 -0
- /package/dist/types/src/{plugins/plugin-intent → plugin-intent}/intent-dispatcher.test.d.ts +0 -0
- /package/src/{plugins/plugin-surface → react}/ErrorBoundary.tsx +0 -0
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type FC } from 'react';
|
|
6
|
-
import { describe, expect, test } from 'vitest';
|
|
7
|
-
|
|
8
|
-
import { log } from '@dxos/log';
|
|
9
|
-
|
|
10
|
-
import { type Plugin } from './plugin';
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
13
|
-
export interface Interface<T> {
|
|
14
|
-
key: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
type InterfaceDef<T> = {
|
|
18
|
-
key: Interface<T>;
|
|
19
|
-
impl: T;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const provide = <T>(key: Interface<T>, impl: T): InterfaceDef<T> => ({ key, impl });
|
|
23
|
-
|
|
24
|
-
export type PluginProps = {
|
|
25
|
-
provides?: InterfaceDef<any>[];
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export class TestPlugin {
|
|
29
|
-
readonly _interfaces = new Map<string, any>();
|
|
30
|
-
constructor({ provides }: PluginProps) {
|
|
31
|
-
provides?.forEach(({ key, impl }) => this._interfaces.set(key.key, impl));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getInterface = <T>(key: Interface<T>): T | undefined => this._interfaces.get(key.key);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const getInterfaces = <T>(plugins: TestPlugin[], key: Interface<T>): T[] =>
|
|
38
|
-
plugins.map((plugin) => plugin.getInterface(key)).filter(Boolean) as any;
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
// Interfaces allow shared typesafe contracts between plugins.
|
|
42
|
-
// The system might define common contracts (e.g., Printable); others would be defined by individual plugins.
|
|
43
|
-
// This allows parts of the system to find interfaces across all plugins to enable loosely coupled actions
|
|
44
|
-
// (separate from broadcast events) or requests for information.
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
export interface Printable {
|
|
48
|
-
print: (data: any | undefined) => void;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const Printable: Interface<Printable> = { key: 'printable' };
|
|
52
|
-
|
|
53
|
-
export interface Selectable {
|
|
54
|
-
selection: () => string | undefined;
|
|
55
|
-
select: (object?: { id: string | undefined }) => void;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export const Selectable: Interface<Selectable> = { key: 'selectable' };
|
|
59
|
-
|
|
60
|
-
// NOTE: Would allow Stack to define a contract for plugins that have embeddable content.
|
|
61
|
-
export type Section = FC<{ object: any; onSelect: (object: string | undefined) => void }>;
|
|
62
|
-
|
|
63
|
-
export const Section: Interface<Section> = { key: 'list' };
|
|
64
|
-
|
|
65
|
-
//
|
|
66
|
-
// Plugin defs
|
|
67
|
-
//
|
|
68
|
-
|
|
69
|
-
// TODO(burdon): Tie to declarative manifest.
|
|
70
|
-
// {
|
|
71
|
-
// Printable: { print: (data: any) => console.log(data) }
|
|
72
|
-
// }
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
const plugin1 = new TestPlugin({
|
|
76
|
-
provides: [
|
|
77
|
-
provide(Printable, {
|
|
78
|
-
print: (data: any | undefined) => log(data),
|
|
79
|
-
}),
|
|
80
|
-
|
|
81
|
-
provide(Selectable, {
|
|
82
|
-
selection: () => undefined,
|
|
83
|
-
select: (data: any) => {}, // TODO(burdon): Update plugin state.
|
|
84
|
-
}),
|
|
85
|
-
|
|
86
|
-
// provide(Section, ({ object }) => <div>{JSON.stringify(object)}</div>),
|
|
87
|
-
],
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
const plugin2 = new TestPlugin({
|
|
91
|
-
provides: [
|
|
92
|
-
provide(Printable, {
|
|
93
|
-
print: (data: any) => log(data),
|
|
94
|
-
}),
|
|
95
|
-
],
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const plugin3 = new TestPlugin({});
|
|
99
|
-
|
|
100
|
-
describe('Plugins', () => {
|
|
101
|
-
const plugins = [plugin1, plugin2, plugin3];
|
|
102
|
-
|
|
103
|
-
test('invocation', () => {
|
|
104
|
-
// Invoke against all plugins that provide interface.
|
|
105
|
-
expect(getInterfaces(plugins, Printable)).to.have.length(2);
|
|
106
|
-
getInterfaces(plugins, Printable).forEach((i) => i.print({}));
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
test('symbols', () => {
|
|
110
|
-
const s1 = Symbol.for('s1');
|
|
111
|
-
const s2 = Symbol.for('s1');
|
|
112
|
-
expect(s1).to.be.eq(s2);
|
|
113
|
-
|
|
114
|
-
const map = new Map();
|
|
115
|
-
map.set(s1, true);
|
|
116
|
-
map.set(s2, false);
|
|
117
|
-
expect(map.get(s1)).to.be.false;
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
test('filter', () => {
|
|
121
|
-
type Provides1 = {
|
|
122
|
-
test1: {};
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
type Provides2 = {
|
|
126
|
-
test2: {};
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const p1: Plugin<Provides1> = {
|
|
130
|
-
meta: { id: 'example.com/plugin/plugin-1' },
|
|
131
|
-
provides: {
|
|
132
|
-
test1: {},
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const p2: Plugin<Provides2> = {
|
|
137
|
-
meta: { id: 'example.com/plugin/plugin-2' },
|
|
138
|
-
provides: {
|
|
139
|
-
test2: {},
|
|
140
|
-
},
|
|
141
|
-
};
|
|
142
|
-
|
|
143
|
-
const plugins: Plugin[] = [p1, p2];
|
|
144
|
-
|
|
145
|
-
const matching = plugins.filter((plugin) => true);
|
|
146
|
-
expect(matching).to.have.length(2);
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
// eslint-disable-next-line unused-imports/no-unused-vars
|
|
151
|
-
// const StackContainer: FC<{}> = () => {
|
|
152
|
-
// const StackSection = plugin1.getInterface(Section)!;
|
|
153
|
-
// const selected = plugin1.getInterface(Selectable)?.selection();
|
|
154
|
-
|
|
155
|
-
// return (
|
|
156
|
-
// <StackSection object={selected} onSelect={(object) => plugin1.getInterface(Selectable)?.select({ id: object })} />
|
|
157
|
-
// );
|
|
158
|
-
// };
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import type { FC, PropsWithChildren } from 'react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Application context to be provided to plugin callbacks.
|
|
9
|
-
*/
|
|
10
|
-
export type HostContext = {
|
|
11
|
-
plugins: Plugin[];
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Capabilities provided by a plugin.
|
|
16
|
-
* The base surface capabilities are always included.
|
|
17
|
-
*/
|
|
18
|
-
export type PluginProvides<TProvides> = TProvides & {
|
|
19
|
-
/**
|
|
20
|
-
* React Context which is wrapped around the application to enable any hooks the plugin may provide.
|
|
21
|
-
*/
|
|
22
|
-
context?: FC<PropsWithChildren>;
|
|
23
|
-
|
|
24
|
-
/*
|
|
25
|
-
* React component which is rendered at the root of the application.
|
|
26
|
-
*/
|
|
27
|
-
root?: FC<PropsWithChildren>;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export type PluginMeta = {
|
|
31
|
-
/**
|
|
32
|
-
* Globally unique ID.
|
|
33
|
-
*
|
|
34
|
-
* Expected to be in the form of a valid URL.
|
|
35
|
-
*
|
|
36
|
-
* @example dxos.org/plugin/example
|
|
37
|
-
*/
|
|
38
|
-
id: string;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Short ID for use in URLs.
|
|
42
|
-
*
|
|
43
|
-
* NOTE: This is especially experimental and likely to change.
|
|
44
|
-
*/
|
|
45
|
-
// TODO(wittjosiah): How should these be managed?
|
|
46
|
-
shortId?: string;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Human-readable name.
|
|
50
|
-
*/
|
|
51
|
-
name?: string;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Short description of plugin functionality.
|
|
55
|
-
*/
|
|
56
|
-
description?: string;
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* URL of home page.
|
|
60
|
-
*/
|
|
61
|
-
homePage?: string;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* URL of source code.
|
|
65
|
-
*/
|
|
66
|
-
source?: string;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Tags to help categorize the plugin.
|
|
70
|
-
*/
|
|
71
|
-
tags?: string[];
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.
|
|
75
|
-
*/
|
|
76
|
-
icon?: string;
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
/**
|
|
80
|
-
* A unit of containment of modular functionality that can be provided to an application.
|
|
81
|
-
* Plugins provide things like components, state, actions, etc. to the application.
|
|
82
|
-
*/
|
|
83
|
-
export type Plugin<TProvides = {}> = {
|
|
84
|
-
meta: PluginMeta;
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Capabilities provided by the plugin.
|
|
88
|
-
*/
|
|
89
|
-
provides: PluginProvides<TProvides>;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Plugin definitions extend the base `Plugin` interface with additional lifecycle methods.
|
|
94
|
-
*/
|
|
95
|
-
export type PluginDefinition<TProvides = {}, TInitializeProvides = {}> = Omit<Plugin, 'provides'> & {
|
|
96
|
-
/**
|
|
97
|
-
* Capabilities provided by the plugin.
|
|
98
|
-
*/
|
|
99
|
-
provides?: Plugin<TProvides>['provides'];
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Initialize any async behavior required by the plugin.
|
|
103
|
-
*
|
|
104
|
-
* @return Capabilities provided by the plugin which are merged with base capabilities.
|
|
105
|
-
*/
|
|
106
|
-
initialize?: () => Promise<PluginProvides<TInitializeProvides> | void>;
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Called once all plugins have been initialized.
|
|
110
|
-
* This is the place to do any initialization which requires other plugins to be ready.
|
|
111
|
-
*
|
|
112
|
-
* @param plugins All plugins which successfully initialized.
|
|
113
|
-
*/
|
|
114
|
-
// TODO(wittjosiah): Rename `ready` to a verb?
|
|
115
|
-
ready?: (context: HostContext) => Promise<void>;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Called when the plugin is unloaded.
|
|
119
|
-
* This is the place to do any cleanup required by the plugin.
|
|
120
|
-
*/
|
|
121
|
-
unload?: () => Promise<void>;
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
type LazyPlugin<T> = () => Promise<{ default: (props: T) => PluginDefinition }>;
|
|
125
|
-
|
|
126
|
-
export namespace Plugin {
|
|
127
|
-
export const lazy = <T>(p: LazyPlugin<T>, props?: T) => {
|
|
128
|
-
return () =>
|
|
129
|
-
p().then(({ default: definition }) => {
|
|
130
|
-
return definition(props as T);
|
|
131
|
-
});
|
|
132
|
-
};
|
|
133
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Effect } from 'effect';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { create } from '@dxos/live-object';
|
|
9
|
-
|
|
10
|
-
import { IntentProvider } from './IntentContext';
|
|
11
|
-
import { createDispatcher, type AnyIntentResolver, type IntentContext } from './intent-dispatcher';
|
|
12
|
-
import IntentMeta from './meta';
|
|
13
|
-
import { type IntentPluginProvides, type ResolverDefinitions, parseIntentResolverPlugin } from './provides';
|
|
14
|
-
import { filterPlugins } from '../helpers';
|
|
15
|
-
import { type PluginDefinition } from '../plugin-host';
|
|
16
|
-
|
|
17
|
-
const defaultEffect = () => Effect.fail(new Error('Intent runtime not ready'));
|
|
18
|
-
const defaultPromise = () => Effect.runPromise(defaultEffect());
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Allows plugins to register intent handlers and routes sent intents to the appropriate plugin.
|
|
22
|
-
* Inspired by https://developer.android.com/reference/android/content/Intent.
|
|
23
|
-
*/
|
|
24
|
-
export const IntentPlugin = (): PluginDefinition<IntentPluginProvides> => {
|
|
25
|
-
const state = create<IntentContext>({
|
|
26
|
-
dispatch: defaultEffect,
|
|
27
|
-
dispatchPromise: defaultPromise,
|
|
28
|
-
undo: defaultEffect,
|
|
29
|
-
undoPromise: defaultPromise,
|
|
30
|
-
registerResolver: () => () => {},
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
meta: IntentMeta,
|
|
35
|
-
ready: async ({ plugins }) => {
|
|
36
|
-
const resolvers = Object.fromEntries(
|
|
37
|
-
filterPlugins(plugins, parseIntentResolverPlugin).map((plugin): [string, AnyIntentResolver[]] => {
|
|
38
|
-
const resolvers = reduceResolvers(
|
|
39
|
-
plugin.provides.intent.resolvers({
|
|
40
|
-
plugins,
|
|
41
|
-
dispatch: (intent) => state.dispatch(intent),
|
|
42
|
-
dispatchPromise: (intent) => state.dispatchPromise(intent),
|
|
43
|
-
undo: () => state.undo(),
|
|
44
|
-
undoPromise: () => state.undoPromise(),
|
|
45
|
-
registerResolver: (id, resolver) => state.registerResolver(id, resolver),
|
|
46
|
-
}),
|
|
47
|
-
);
|
|
48
|
-
return [plugin.meta.id, resolvers];
|
|
49
|
-
}),
|
|
50
|
-
);
|
|
51
|
-
const { dispatch, dispatchPromise, undo, undoPromise, registerResolver } = createDispatcher(resolvers);
|
|
52
|
-
|
|
53
|
-
state.dispatch = dispatch;
|
|
54
|
-
state.dispatchPromise = dispatchPromise;
|
|
55
|
-
state.undo = undo;
|
|
56
|
-
state.undoPromise = undoPromise;
|
|
57
|
-
state.registerResolver = registerResolver;
|
|
58
|
-
},
|
|
59
|
-
provides: {
|
|
60
|
-
intent: state,
|
|
61
|
-
context: ({ children }) => <IntentProvider value={state}>{children}</IntentProvider>,
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const reduceResolvers = (
|
|
67
|
-
definitions: ResolverDefinitions,
|
|
68
|
-
resolvers: AnyIntentResolver[] = [],
|
|
69
|
-
): AnyIntentResolver[] => {
|
|
70
|
-
if (Array.isArray(definitions)) {
|
|
71
|
-
return definitions.reduce((acc: AnyIntentResolver[], definition) => reduceResolvers(definition, acc), resolvers);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return [...resolvers, definitions];
|
|
75
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { IntentPlugin } from './IntentPlugin';
|
|
6
|
-
|
|
7
|
-
export * from './intent';
|
|
8
|
-
export * from './intent-dispatcher';
|
|
9
|
-
export * from './provides';
|
|
10
|
-
|
|
11
|
-
export * from './IntentContext';
|
|
12
|
-
|
|
13
|
-
export default IntentPlugin;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type IntentContext, type AnyIntentResolver } from './intent-dispatcher';
|
|
6
|
-
import { type HostContext, type Plugin } from '../plugin-host';
|
|
7
|
-
|
|
8
|
-
type Context = HostContext & IntentContext;
|
|
9
|
-
|
|
10
|
-
export type ResolverDefinitions = AnyIntentResolver | AnyIntentResolver[] | ResolverDefinitions[];
|
|
11
|
-
|
|
12
|
-
export type IntentResolverProvides = {
|
|
13
|
-
intent: {
|
|
14
|
-
resolvers: (context: Context) => ResolverDefinitions;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type IntentPluginProvides = {
|
|
19
|
-
intent: IntentContext;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const parseIntentPlugin = (plugin: Plugin) =>
|
|
23
|
-
(plugin.provides as any).intent?.dispatch ? (plugin as Plugin<IntentPluginProvides>) : undefined;
|
|
24
|
-
|
|
25
|
-
export const parseIntentResolverPlugin = (plugin: Plugin) =>
|
|
26
|
-
(plugin.provides as any).intent?.resolvers ? (plugin as Plugin<IntentResolverProvides>) : undefined;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { RootSettingsStore } from '@dxos/local-storage';
|
|
6
|
-
|
|
7
|
-
import SettingsMeta from './meta';
|
|
8
|
-
import { type SettingsPluginProvides } from './provides';
|
|
9
|
-
import { type PluginDefinition } from '../plugin-host';
|
|
10
|
-
|
|
11
|
-
export const SettingsPlugin = (): PluginDefinition<SettingsPluginProvides> => {
|
|
12
|
-
// Global settings singleton.
|
|
13
|
-
// TODO(burdon): Make settings storage extensible so that other plugins can decide the persistence of them.
|
|
14
|
-
const settingsStore = new RootSettingsStore();
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
meta: SettingsMeta,
|
|
18
|
-
provides: {
|
|
19
|
-
settingsStore,
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { S } from '@dxos/echo-schema';
|
|
6
|
-
import { type SettingsStoreFactory, type SettingsValue } from '@dxos/local-storage';
|
|
7
|
-
|
|
8
|
-
import { type Plugin } from '../plugin-host';
|
|
9
|
-
|
|
10
|
-
export type SettingsProvides<T extends SettingsValue> = {
|
|
11
|
-
settings: T;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export type SettingsPluginProvides = {
|
|
15
|
-
settingsStore: SettingsStoreFactory;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export const parseSettingsPlugin = (plugin: Plugin) => {
|
|
19
|
-
return typeof (plugin.provides as any).settingsStore === 'object'
|
|
20
|
-
? (plugin as Plugin<SettingsPluginProvides>)
|
|
21
|
-
: undefined;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export const SETTINGS_PLUGIN = 'dxos.org/plugin/settings';
|
|
25
|
-
export const SETTINGS_ACTION = `${SETTINGS_PLUGIN}/action`;
|
|
26
|
-
|
|
27
|
-
export namespace SettingsAction {
|
|
28
|
-
export class Open extends S.TaggedClass<Open>()(`${SETTINGS_ACTION}/open`, {
|
|
29
|
-
input: S.Struct({
|
|
30
|
-
plugin: S.optional(S.String),
|
|
31
|
-
}),
|
|
32
|
-
output: S.Void,
|
|
33
|
-
}) {}
|
|
34
|
-
}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2022 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React, { Suspense, forwardRef, memo, useEffect, useId, useMemo } from 'react';
|
|
6
|
-
|
|
7
|
-
import { useDefaultValue } from '@dxos/react-hooks';
|
|
8
|
-
|
|
9
|
-
import { ErrorBoundary } from './ErrorBoundary';
|
|
10
|
-
import { type SurfaceProps, useSurfaceRoot } from './SurfaceContext';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* A surface is a named region of the screen that can be populated by plugins.
|
|
14
|
-
*/
|
|
15
|
-
export const Surface = memo(
|
|
16
|
-
forwardRef<HTMLElement, SurfaceProps>(
|
|
17
|
-
({ id: _id, role, data: _data, limit, fallback, placeholder, ...rest }, forwardedRef) => {
|
|
18
|
-
const { surfaces, debugInfo } = useSurfaceRoot();
|
|
19
|
-
const data = useDefaultValue(_data, () => ({}));
|
|
20
|
-
|
|
21
|
-
// Track debug info.
|
|
22
|
-
const reactId = useId();
|
|
23
|
-
const id = _id ?? reactId;
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
debugInfo?.set(id, { id, created: Date.now(), role, renderCount: 0 });
|
|
26
|
-
return () => {
|
|
27
|
-
debugInfo?.delete(id);
|
|
28
|
-
};
|
|
29
|
-
}, [id]);
|
|
30
|
-
|
|
31
|
-
if (debugInfo?.get(id)) {
|
|
32
|
-
debugInfo.get(id)!.renderCount++;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const candidates = useMemo(() => {
|
|
36
|
-
const definitions = Object.values(surfaces)
|
|
37
|
-
.filter((definition) =>
|
|
38
|
-
Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role,
|
|
39
|
-
)
|
|
40
|
-
.filter(({ filter }) => (filter ? filter(data) : true))
|
|
41
|
-
.toSorted(({ disposition: a = 'static' }, { disposition: b = 'static' }) => {
|
|
42
|
-
return a === b ? 0 : a === 'hoist' || b === 'fallback' ? -1 : b === 'hoist' || a === 'fallback' ? 1 : 0;
|
|
43
|
-
});
|
|
44
|
-
return limit ? definitions.slice(0, limit) : definitions;
|
|
45
|
-
}, [surfaces, role, data, limit]);
|
|
46
|
-
|
|
47
|
-
const nodes = candidates.map(({ component: Component, id }) => (
|
|
48
|
-
<Component ref={forwardedRef} key={id} id={id} role={role} data={data} limit={limit} {...rest} />
|
|
49
|
-
));
|
|
50
|
-
|
|
51
|
-
const suspense = placeholder ? <Suspense fallback={placeholder}>{nodes}</Suspense> : nodes;
|
|
52
|
-
|
|
53
|
-
return fallback ? (
|
|
54
|
-
<ErrorBoundary data={data} fallback={fallback}>
|
|
55
|
-
{suspense}
|
|
56
|
-
</ErrorBoundary>
|
|
57
|
-
) : (
|
|
58
|
-
suspense
|
|
59
|
-
);
|
|
60
|
-
},
|
|
61
|
-
),
|
|
62
|
-
);
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import React from 'react';
|
|
6
|
-
|
|
7
|
-
import { create } from '@dxos/live-object';
|
|
8
|
-
|
|
9
|
-
import { SurfaceProvider, type SurfaceContextValue } from './SurfaceContext';
|
|
10
|
-
import SurfaceMeta from './meta';
|
|
11
|
-
import { parseSurfacePlugin, type SurfacePluginProvides, type SurfaceDefinitions } from './provides';
|
|
12
|
-
import { filterPlugins } from '../helpers';
|
|
13
|
-
import { type PluginDefinition } from '../plugin-host';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Provides a registry of surface components.
|
|
17
|
-
*/
|
|
18
|
-
export const SurfacePlugin = (): PluginDefinition<SurfacePluginProvides> => {
|
|
19
|
-
const state = create<SurfaceContextValue>({ surfaces: {}, debugInfo: new Map() });
|
|
20
|
-
|
|
21
|
-
return {
|
|
22
|
-
meta: SurfaceMeta,
|
|
23
|
-
ready: async (context) => {
|
|
24
|
-
state.surfaces = filterPlugins(context.plugins, parseSurfacePlugin).reduce(
|
|
25
|
-
(acc, plugin) => reduceSurfaces(plugin.provides.surface.definitions(context), acc),
|
|
26
|
-
{},
|
|
27
|
-
);
|
|
28
|
-
},
|
|
29
|
-
provides: {
|
|
30
|
-
surface: state,
|
|
31
|
-
context: ({ children }) => <SurfaceProvider value={state}>{children}</SurfaceProvider>,
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const reduceSurfaces = (
|
|
37
|
-
definitions: SurfaceDefinitions,
|
|
38
|
-
surfaces: SurfaceContextValue['surfaces'] = {},
|
|
39
|
-
): SurfaceContextValue['surfaces'] => {
|
|
40
|
-
if (Array.isArray(definitions)) {
|
|
41
|
-
return definitions.reduce((acc, definition) => reduceSurfaces(definition, acc), surfaces);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return { ...surfaces, [definitions.id]: definitions };
|
|
45
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Checks if the given data is an object and not null.
|
|
7
|
-
*
|
|
8
|
-
* Useful inside surface component resolvers as a type guard.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* const old =
|
|
13
|
-
* data.content &&
|
|
14
|
-
* typeof data.content === 'object' &&
|
|
15
|
-
* 'id' in data.content &&
|
|
16
|
-
* typeof data.content.id === 'string';
|
|
17
|
-
*
|
|
18
|
-
* // becomes
|
|
19
|
-
* const new = isObject(data.content) && typeof data.content.id === 'string';
|
|
20
|
-
* ```
|
|
21
|
-
*/
|
|
22
|
-
export const isObject = (data: unknown): data is { [key: string]: unknown } => !!data && typeof data === 'object';
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { SurfacePlugin } from './SurfacePlugin';
|
|
6
|
-
|
|
7
|
-
export * from './helpers';
|
|
8
|
-
export * from './provides';
|
|
9
|
-
|
|
10
|
-
export * from './ErrorBoundary';
|
|
11
|
-
export * from './Surface';
|
|
12
|
-
export * from './SurfaceContext';
|
|
13
|
-
|
|
14
|
-
export default SurfacePlugin;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type SurfaceDefinition, type SurfaceContextValue } from './SurfaceContext';
|
|
6
|
-
import { type HostContext, type Plugin } from '../plugin-host';
|
|
7
|
-
|
|
8
|
-
export type SurfaceDefinitions = SurfaceDefinition | SurfaceDefinition[] | SurfaceDefinitions[];
|
|
9
|
-
|
|
10
|
-
export type SurfaceProvides = {
|
|
11
|
-
surface: {
|
|
12
|
-
/**
|
|
13
|
-
* Used by the `Surface` resolver to find a component to render.
|
|
14
|
-
*/
|
|
15
|
-
definitions: (context: HostContext) => SurfaceDefinitions;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type SurfacePluginProvides = {
|
|
20
|
-
surface: SurfaceContextValue;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const parseRootSurfacePlugin = (plugin?: Plugin) =>
|
|
24
|
-
(plugin?.provides as any)?.surface?.surfaces ? (plugin as Plugin<SurfacePluginProvides>) : undefined;
|
|
25
|
-
|
|
26
|
-
export const parseSurfacePlugin = (plugin?: Plugin) =>
|
|
27
|
-
(plugin?.provides as any)?.surface?.definitions ? (plugin as Plugin<SurfaceProvides>) : undefined;
|
|
File without changes
|
/package/dist/lib/browser/{plugin-intent-T7Y3MJ5C.mjs.map → intent-dispatcher-GFBH7T2J.mjs.map}
RENAMED
|
File without changes
|
|
File without changes
|