@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
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { type JSX, type ForwardedRef } from 'react';
|
|
2
|
-
import { type SurfaceProps } from './Surface';
|
|
3
|
-
type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
|
|
4
|
-
[Property in Key]-?: Type[Property];
|
|
5
|
-
};
|
|
6
|
-
type SurfaceComponentProps = WithRequiredProperty<SurfaceProps, 'data'>;
|
|
7
|
-
/**
|
|
8
|
-
* Determines the priority of the surface when multiple components are resolved.
|
|
9
|
-
*/
|
|
10
|
-
export type SurfaceDisposition = 'hoist' | 'fallback';
|
|
11
|
-
/**
|
|
12
|
-
* Surface debug info.
|
|
13
|
-
* NOTE: Short-term measure to track perf issues.
|
|
14
|
-
*/
|
|
15
|
-
export type DebugInfo = {
|
|
16
|
-
id: string;
|
|
17
|
-
created: number;
|
|
18
|
-
renderCount: number;
|
|
19
|
-
} & Pick<SurfaceProps, 'role' | 'name'>;
|
|
20
|
-
export type SurfaceResult = {
|
|
21
|
-
node: JSX.Element;
|
|
22
|
-
disposition?: SurfaceDisposition;
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* Function that resolves a Surface.
|
|
26
|
-
* If a null value is returned, the rendering is deferred to other plugins.
|
|
27
|
-
*/
|
|
28
|
-
export type SurfaceComponent = (props: SurfaceComponentProps, forwardedRef: ForwardedRef<HTMLElement>) => JSX.Element | SurfaceResult | null;
|
|
29
|
-
export type SurfaceRootContext = {
|
|
30
|
-
components: Record<string, SurfaceComponent>;
|
|
31
|
-
/**
|
|
32
|
-
* Debug info.
|
|
33
|
-
*/
|
|
34
|
-
debugInfo?: Map<string, DebugInfo>;
|
|
35
|
-
};
|
|
36
|
-
export declare const useSurfaceRoot: () => SurfaceRootContext;
|
|
37
|
-
export declare const SurfaceProvider: import("react").Provider<SurfaceRootContext | undefined>;
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=SurfaceRootContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SurfaceRootContext.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/plugin-surface/SurfaceRootContext.tsx"],"names":[],"mappings":"AAIA,OAAO,EAA6B,KAAK,GAAG,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAI/E,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AAG9C,KAAK,oBAAoB,CAAC,IAAI,EAAE,GAAG,SAAS,MAAM,IAAI,IAAI,IAAI,GAAG;KAC9D,QAAQ,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;CACpC,CAAC;AAEF,KAAK,qBAAqB,GAAG,oBAAoB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,UAAU,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;AAExC,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,kBAAkB,CAAC;CAClC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAC7B,KAAK,EAAE,qBAAqB,EAC5B,YAAY,EAAE,YAAY,CAAC,WAAW,CAAC,KACpC,GAAG,CAAC,OAAO,GAAG,aAAa,GAAG,IAAI,CAAC;AAExC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAE7C;;OAEG;IACH,SAAS,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACpC,CAAC;AAIF,eAAO,MAAM,cAAc,0BAAyF,CAAC;AAErH,eAAO,MAAM,eAAe,0DAA8B,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checks if the given data is an object and not null.
|
|
3
|
-
*
|
|
4
|
-
* Useful inside surface component resolvers as a type guard.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* const old =
|
|
9
|
-
* data.content &&
|
|
10
|
-
* typeof data.content === 'object' &&
|
|
11
|
-
* 'id' in data.content &&
|
|
12
|
-
* typeof data.content.id === 'string';
|
|
13
|
-
*
|
|
14
|
-
* // becomes
|
|
15
|
-
* const new = isObject(data.content) && typeof data.content.id === 'string';
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare const isObject: (data: unknown) => data is {
|
|
19
|
-
[key: string]: unknown;
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/plugin-surface/helpers.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,QAAQ,SAAU,OAAO,KAAG,IAAI,IAAI;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAwC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { SurfacePlugin } from './SurfacePlugin';
|
|
2
|
-
export * from './helpers';
|
|
3
|
-
export * from './provides';
|
|
4
|
-
export * from './ErrorBoundary';
|
|
5
|
-
export * from './Surface';
|
|
6
|
-
export * from './SurfaceRootContext';
|
|
7
|
-
export default SurfacePlugin;
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/plugin-surface/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAE3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AAErC,eAAe,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/plugin-surface/meta.ts"],"names":[],"mappings":"AAIA,QAAA,MAAM,WAAW;;CAEhB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { type SurfaceComponent, type SurfaceRootContext } from './SurfaceRootContext';
|
|
2
|
-
import { type Plugin } from '../plugin-host';
|
|
3
|
-
export type SurfaceProvides = {
|
|
4
|
-
surface: {
|
|
5
|
-
/**
|
|
6
|
-
* Used by the `Surface` resolver to find a component to render.
|
|
7
|
-
*/
|
|
8
|
-
component: SurfaceComponent;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
export type SurfacePluginProvides = {
|
|
12
|
-
surface: SurfaceRootContext;
|
|
13
|
-
};
|
|
14
|
-
export declare const parseRootSurfacePlugin: (plugin?: Plugin) => Plugin<SurfacePluginProvides> | undefined;
|
|
15
|
-
export declare const parseSurfacePlugin: (plugin?: Plugin) => Plugin<SurfaceProvides> | undefined;
|
|
16
|
-
//# sourceMappingURL=provides.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provides.d.ts","sourceRoot":"","sources":["../../../../../src/plugins/plugin-surface/provides.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACtF,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAG7C,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE;QACP;;WAEG;QACH,SAAS,EAAE,gBAAgB,CAAC;KAC7B,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,kBAAkB,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,sBAAsB,YAAa,MAAM,8CACkD,CAAC;AAEzG,eAAO,MAAM,kBAAkB,YAAa,MAAM,wCAC+C,CAAC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Space } from '@dxos/client-protocol';
|
|
6
|
-
|
|
7
|
-
import { type Plugin } from '../plugin-host';
|
|
8
|
-
|
|
9
|
-
// TODO(burdon): See Accept attribute (uses MIME types).
|
|
10
|
-
// E.g., 'image/*': ['.jpg', '.jpeg', '.png', '.gif'],
|
|
11
|
-
export const defaultFileTypes = {
|
|
12
|
-
images: ['png', 'jpg', 'jpeg', 'gif'],
|
|
13
|
-
media: ['mp3', 'mp4', 'mov', 'avi'],
|
|
14
|
-
text: ['pdf', 'txt', 'md'],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type FileInfo = {
|
|
18
|
-
url?: string;
|
|
19
|
-
cid?: string; // TODO(burdon): Meta key? Or other common properties with other file management system? (e.g., WNFS).
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type FileUploader = (file: File, space: Space) => Promise<FileInfo | undefined>;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Generic interface provided by file plugins (e.g., IPFS, WNFS).
|
|
26
|
-
*/
|
|
27
|
-
export type FileManagerProvides = {
|
|
28
|
-
file: {
|
|
29
|
-
upload?: FileUploader;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
// TODO(burdon): Better match against interface? and Return provided service type. What if multiple?
|
|
34
|
-
export const parseFileManagerPlugin = (plugin: Plugin) => {
|
|
35
|
-
return (plugin.provides as any).file ? (plugin as Plugin<FileManagerProvides>) : undefined;
|
|
36
|
-
};
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import type { Graph, GraphBuilder, Node } from '@dxos/app-graph';
|
|
6
|
-
import { type MaybePromise } from '@dxos/util';
|
|
7
|
-
|
|
8
|
-
import type { Plugin } from '../plugin-host';
|
|
9
|
-
|
|
10
|
-
// TODO(wittjosiah): Factor out.
|
|
11
|
-
export type SerializedNode = {
|
|
12
|
-
name: string;
|
|
13
|
-
data: string;
|
|
14
|
-
type?: string;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
// TODO(wittjosiah): Factor out.
|
|
18
|
-
export type NodeSerializer<T = any> = {
|
|
19
|
-
inputType: string;
|
|
20
|
-
outputType: string;
|
|
21
|
-
disposition?: 'hoist' | 'fallback';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Takes a node and serializes it into a format that can be stored.
|
|
25
|
-
*/
|
|
26
|
-
serialize: (node: Node<T>) => MaybePromise<SerializedNode>;
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Takes a serialized node and deserializes it into the application.
|
|
30
|
-
*/
|
|
31
|
-
deserialize: (data: SerializedNode, ancestors: unknown[]) => MaybePromise<T>;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Provides for a plugin that exposes the application graph.
|
|
36
|
-
*/
|
|
37
|
-
export type GraphProvides = {
|
|
38
|
-
graph: Graph;
|
|
39
|
-
explore: GraphBuilder['explore'];
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export type GraphBuilderProvides = {
|
|
43
|
-
graph: {
|
|
44
|
-
builder: (plugins: Plugin[]) => Parameters<GraphBuilder['addExtension']>[0];
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type GraphSerializerProvides = {
|
|
49
|
-
graph: {
|
|
50
|
-
serializer: (plugins: Plugin[]) => NodeSerializer[];
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Type guard for graph plugins.
|
|
56
|
-
*/
|
|
57
|
-
export const parseGraphPlugin = (plugin: Plugin) =>
|
|
58
|
-
(plugin.provides as any).graph?.root ? (plugin as Plugin<GraphProvides>) : undefined;
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Type guard for graph builder plugins.
|
|
62
|
-
*/
|
|
63
|
-
export const parseGraphBuilderPlugin = (plugin: Plugin) =>
|
|
64
|
-
(plugin.provides as any).graph?.builder ? (plugin as Plugin<GraphBuilderProvides>) : undefined;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Type guard for graph serializer plugins.
|
|
68
|
-
*/
|
|
69
|
-
export const parseGraphSerializerPlugin = (plugin: Plugin) =>
|
|
70
|
-
(plugin.provides as any).graph?.serializer ? (plugin as Plugin<GraphSerializerProvides>) : undefined;
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
|
|
7
|
-
import { type Plugin } from '../plugin-host';
|
|
8
|
-
import { type IntentData } from '../plugin-intent';
|
|
9
|
-
|
|
10
|
-
//
|
|
11
|
-
// Provides
|
|
12
|
-
//
|
|
13
|
-
|
|
14
|
-
export const Toast = z.object({
|
|
15
|
-
id: z.string(),
|
|
16
|
-
title: z.string().optional(),
|
|
17
|
-
description: z.string().optional(),
|
|
18
|
-
// TODO(wittjosiah): `icon` should be string to be parsed by an `Icon` component.
|
|
19
|
-
icon: z.any().optional(),
|
|
20
|
-
duration: z.number().optional(),
|
|
21
|
-
closeLabel: z.string().optional(),
|
|
22
|
-
actionLabel: z.string().optional(),
|
|
23
|
-
actionAlt: z.string().optional(),
|
|
24
|
-
onAction: z.function().optional(),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
export type Toast = z.infer<typeof Toast>;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Basic state provided by a layout plugin.
|
|
31
|
-
*
|
|
32
|
-
* Layout provides the state of global UI landmarks, such as the sidebar, dialog, and popover.
|
|
33
|
-
* Generally only one dialog or popover should be open at a time, a layout plugin should manage this.
|
|
34
|
-
* For other landmarks, such as toasts, rendering them in the layout prevents them from unmounting when navigating.
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
const LayoutMode = z.union([z.literal('deck'), z.literal('solo'), z.literal('fullscreen')]);
|
|
38
|
-
export const isLayoutMode = (value: any): value is LayoutMode => LayoutMode.safeParse(value).success;
|
|
39
|
-
export type LayoutMode = z.infer<typeof LayoutMode>;
|
|
40
|
-
|
|
41
|
-
// TODO(wittjosiah): Replace Zod w/ Effect Schema to align with ECHO.
|
|
42
|
-
export const Layout = z.object({
|
|
43
|
-
layoutMode: z.union([z.literal('deck'), z.literal('solo'), z.literal('fullscreen')]),
|
|
44
|
-
|
|
45
|
-
sidebarOpen: z.boolean(),
|
|
46
|
-
complementarySidebarOpen: z.boolean(),
|
|
47
|
-
/**
|
|
48
|
-
* @deprecated
|
|
49
|
-
*/
|
|
50
|
-
complementarySidebarContent: z
|
|
51
|
-
.any()
|
|
52
|
-
.optional()
|
|
53
|
-
.describe('DEPRECATED. Data to be passed to the complementary sidebar Surface.'),
|
|
54
|
-
|
|
55
|
-
dialogOpen: z.boolean(),
|
|
56
|
-
dialogContent: z.any().optional().describe('Data to be passed to the dialog Surface.'),
|
|
57
|
-
// TODO(wittjosiah): Custom properties?
|
|
58
|
-
dialogBlockAlign: z.union([z.literal('start'), z.literal('center')]).optional(),
|
|
59
|
-
dialogType: z.union([z.literal('default'), z.literal('alert')]).optional(),
|
|
60
|
-
|
|
61
|
-
popoverOpen: z.boolean(),
|
|
62
|
-
popoverContent: z.any().optional().describe('Data to be passed to the popover Surface.'),
|
|
63
|
-
popoverAnchorId: z.string().optional(),
|
|
64
|
-
|
|
65
|
-
toasts: z.array(Toast),
|
|
66
|
-
|
|
67
|
-
scrollIntoView: z
|
|
68
|
-
.string()
|
|
69
|
-
.optional()
|
|
70
|
-
.describe('The identifier of a component to scroll into view when it is mounted.'),
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
export type Layout = z.infer<typeof Layout>;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Provides for a plugin that can manage the app layout.
|
|
77
|
-
*/
|
|
78
|
-
export type LayoutProvides = {
|
|
79
|
-
layout: Readonly<Layout>;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Type guard for layout plugins.
|
|
84
|
-
*/
|
|
85
|
-
export const parseLayoutPlugin = (plugin: Plugin) => {
|
|
86
|
-
const { success } = Layout.safeParse((plugin.provides as any).layout);
|
|
87
|
-
return success ? (plugin as Plugin<LayoutProvides>) : undefined;
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
//
|
|
91
|
-
// Intents
|
|
92
|
-
//
|
|
93
|
-
|
|
94
|
-
const LAYOUT_PLUGIN = 'dxos.org/plugin/layout';
|
|
95
|
-
|
|
96
|
-
const LAYOUT_ACTION = `${LAYOUT_PLUGIN}/action`;
|
|
97
|
-
|
|
98
|
-
export enum LayoutAction {
|
|
99
|
-
SET_LAYOUT = `${LAYOUT_ACTION}/set-layout`,
|
|
100
|
-
SET_LAYOUT_MODE = `${LAYOUT_ACTION}/set-layout-mode`,
|
|
101
|
-
SCROLL_INTO_VIEW = `${LAYOUT_ACTION}/scroll-into-view`,
|
|
102
|
-
UPDATE_PLANK_SIZE = `${LAYOUT_ACTION}/update-plank-size`,
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Expected payload for layout actions.
|
|
107
|
-
*/
|
|
108
|
-
export namespace LayoutAction {
|
|
109
|
-
export type SetLayoutMode = IntentData<{
|
|
110
|
-
layoutMode?: LayoutMode;
|
|
111
|
-
revert?: boolean;
|
|
112
|
-
}>;
|
|
113
|
-
|
|
114
|
-
export type SetLayout = IntentData<{
|
|
115
|
-
/**
|
|
116
|
-
* Element to set the state of.
|
|
117
|
-
*/
|
|
118
|
-
element: 'fullscreen' | 'sidebar' | 'complementary' | 'dialog' | 'popover' | 'toast';
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Whether the element is on or off.
|
|
122
|
-
*
|
|
123
|
-
* If omitted, the element's state will be toggled or set based on other provided data.
|
|
124
|
-
* For example, if `component` is provided, the state will be set to `true`.
|
|
125
|
-
*/
|
|
126
|
-
state?: boolean;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Component to render in the dialog or popover.
|
|
130
|
-
*/
|
|
131
|
-
component?: string;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Data to be passed to the dialog or popover Surface.
|
|
135
|
-
*/
|
|
136
|
-
subject?: any;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Anchor ID for the popover.
|
|
140
|
-
*/
|
|
141
|
-
anchorId?: string;
|
|
142
|
-
|
|
143
|
-
// TODO(wittjosiah): Custom properties?
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Block alignment for the dialog.
|
|
147
|
-
*/
|
|
148
|
-
dialogBlockAlign?: 'start' | 'center';
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Type of dialog.
|
|
152
|
-
*/
|
|
153
|
-
dialogType?: 'default' | 'alert';
|
|
154
|
-
}>;
|
|
155
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { type Plugin } from '../plugin-host';
|
|
6
|
-
|
|
7
|
-
export type Metadata = Record<string, any>;
|
|
8
|
-
|
|
9
|
-
export type MetadataRecordsProvides = {
|
|
10
|
-
metadata: {
|
|
11
|
-
records: Record<string, Metadata>;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export type MetadataResolver = (type: string) => Metadata;
|
|
16
|
-
|
|
17
|
-
export type MetadataResolverProvides = {
|
|
18
|
-
metadata: {
|
|
19
|
-
resolver: MetadataResolver;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export const parseMetadataRecordsPlugin = (plugin: Plugin) => {
|
|
24
|
-
return (plugin.provides as any).metadata?.records ? (plugin as Plugin<MetadataRecordsProvides>) : undefined;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export const parseMetadataResolverPlugin = (plugin: Plugin) => {
|
|
28
|
-
return (plugin.provides as any).metadata?.resolver ? (plugin as Plugin<MetadataResolverProvides>) : undefined;
|
|
29
|
-
};
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { Schema as S } from '@effect/schema';
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
|
|
8
|
-
import { pick } from '@dxos/util';
|
|
9
|
-
|
|
10
|
-
import { type Plugin } from '../plugin-host';
|
|
11
|
-
import { type IntentData } from '../plugin-intent';
|
|
12
|
-
|
|
13
|
-
// NOTE(thure): These are chosen from RFC 1738’s `safe` characters: http://www.faqs.org/rfcs/rfc1738.html
|
|
14
|
-
export const SLUG_LIST_SEPARATOR = '+';
|
|
15
|
-
export const SLUG_ENTRY_SEPARATOR = '_';
|
|
16
|
-
export const SLUG_KEY_VALUE_SEPARATOR = '-';
|
|
17
|
-
export const SLUG_PATH_SEPARATOR = '~';
|
|
18
|
-
export const SLUG_COLLECTION_INDICATOR = '';
|
|
19
|
-
|
|
20
|
-
const LayoutEntrySchema = S.mutable(S.Struct({ id: S.String, path: S.optional(S.String) }));
|
|
21
|
-
export type LayoutEntry = S.Schema.Type<typeof LayoutEntrySchema>;
|
|
22
|
-
|
|
23
|
-
// TODO(Zan): Consider renaming the 'main' part to 'deck' part now that we are throwing out the old layout plugin.
|
|
24
|
-
// TODO(Zan): Extend to all strings?
|
|
25
|
-
const LayoutPartSchema = S.Union(
|
|
26
|
-
S.Literal('sidebar'),
|
|
27
|
-
S.Literal('main'),
|
|
28
|
-
S.Literal('solo'),
|
|
29
|
-
S.Literal('complementary'),
|
|
30
|
-
S.Literal('fullScreen'),
|
|
31
|
-
);
|
|
32
|
-
export type LayoutPart = S.Schema.Type<typeof LayoutPartSchema>;
|
|
33
|
-
|
|
34
|
-
const LayoutPartsSchema = S.partial(
|
|
35
|
-
S.mutable(S.Record({ key: LayoutPartSchema, value: S.mutable(S.Array(LayoutEntrySchema)) })),
|
|
36
|
-
);
|
|
37
|
-
export type LayoutParts = S.Schema.Type<typeof LayoutPartsSchema>;
|
|
38
|
-
|
|
39
|
-
const LayoutCoordinateSchema = S.mutable(S.Struct({ part: LayoutPartSchema, entryId: S.String }));
|
|
40
|
-
export type LayoutCoordinate = S.Schema.Type<typeof LayoutCoordinateSchema>;
|
|
41
|
-
|
|
42
|
-
const PartAdjustmentSchema = S.Union(S.Literal('increment-start'), S.Literal('increment-end'), S.Literal('solo'));
|
|
43
|
-
export type PartAdjustment = S.Schema.Type<typeof PartAdjustmentSchema>;
|
|
44
|
-
|
|
45
|
-
const LayoutAdjustmentSchema = S.mutable(
|
|
46
|
-
S.Struct({ layoutCoordinate: LayoutCoordinateSchema, type: PartAdjustmentSchema }),
|
|
47
|
-
);
|
|
48
|
-
export type LayoutAdjustment = S.Schema.Type<typeof LayoutAdjustmentSchema>;
|
|
49
|
-
|
|
50
|
-
/** @deprecated */
|
|
51
|
-
export const ActiveParts = z.record(z.string(), z.union([z.string(), z.array(z.string())]));
|
|
52
|
-
export type ActiveParts = z.infer<typeof ActiveParts>;
|
|
53
|
-
|
|
54
|
-
// TODO(burdon): Where should this go?
|
|
55
|
-
export type LayoutContainerProps<T> = T & { role?: string; coordinate?: LayoutCoordinate };
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Provides for a plugin that can manage the app navigation.
|
|
59
|
-
*/
|
|
60
|
-
const LocationProvidesSchema = S.mutable(
|
|
61
|
-
S.Struct({
|
|
62
|
-
location: S.Struct({
|
|
63
|
-
active: LayoutPartsSchema,
|
|
64
|
-
closed: S.Array(S.String),
|
|
65
|
-
}),
|
|
66
|
-
}),
|
|
67
|
-
);
|
|
68
|
-
export type LocationProvides = S.Schema.Type<typeof LocationProvidesSchema>;
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Type guard for layout plugins.
|
|
72
|
-
*/
|
|
73
|
-
export const isLayoutParts = (value: unknown): value is LayoutParts => {
|
|
74
|
-
return S.is(LayoutPartsSchema)(value);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
// Type guard for PartAdjustment.
|
|
78
|
-
export const isLayoutAdjustment = (value: unknown): value is LayoutAdjustment => {
|
|
79
|
-
return S.is(LayoutAdjustmentSchema)(value);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
export const parseNavigationPlugin = (plugin: Plugin): Plugin<LocationProvides> | undefined => {
|
|
83
|
-
const location = (plugin.provides as any)?.location;
|
|
84
|
-
if (!location) {
|
|
85
|
-
return undefined;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (S.is(LocationProvidesSchema)({ location })) {
|
|
89
|
-
return plugin as Plugin<LocationProvides>;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return undefined;
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Utilities.
|
|
97
|
-
*/
|
|
98
|
-
|
|
99
|
-
/** Extracts all unique IDs from the layout parts. */
|
|
100
|
-
export const openIds = (layout: LayoutParts, parts?: LayoutPart[]): string[] => {
|
|
101
|
-
return Object.values(parts ? pick(layout, parts) : layout)
|
|
102
|
-
.flatMap((part) => part?.map((entry) => entry.id) ?? [])
|
|
103
|
-
.filter((id): id is string => id !== undefined);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
export const firstIdInPart = (layout: LayoutParts | undefined, part: LayoutPart): string | undefined => {
|
|
107
|
-
if (!layout) {
|
|
108
|
-
return undefined;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
return layout[part]?.at(0)?.id;
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
export const indexInPart = (
|
|
115
|
-
layout: LayoutParts | undefined,
|
|
116
|
-
layoutCoordinate: LayoutCoordinate | undefined,
|
|
117
|
-
): number | undefined => {
|
|
118
|
-
if (!layout || !layoutCoordinate) {
|
|
119
|
-
return undefined;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const { part, entryId } = layoutCoordinate;
|
|
123
|
-
return layout[part]?.findIndex((entry) => entry.id === entryId);
|
|
124
|
-
};
|
|
125
|
-
|
|
126
|
-
export const partLength = (layout: LayoutParts | undefined, part: LayoutPart | undefined): number => {
|
|
127
|
-
if (!layout || !part) {
|
|
128
|
-
return 0;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return layout[part]?.length ?? 0;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
// Intents
|
|
136
|
-
//
|
|
137
|
-
|
|
138
|
-
const NAVIGATION_PLUGIN = 'dxos.org/plugin/navigation';
|
|
139
|
-
|
|
140
|
-
const NAVIGATION_ACTION = `${NAVIGATION_PLUGIN}/action`;
|
|
141
|
-
|
|
142
|
-
export enum NavigationAction {
|
|
143
|
-
OPEN = `${NAVIGATION_ACTION}/open`,
|
|
144
|
-
ADD_TO_ACTIVE = `${NAVIGATION_ACTION}/add-to-active`,
|
|
145
|
-
SET = `${NAVIGATION_ACTION}/set`,
|
|
146
|
-
ADJUST = `${NAVIGATION_ACTION}/adjust`,
|
|
147
|
-
CLOSE = `${NAVIGATION_ACTION}/close`,
|
|
148
|
-
EXPOSE = `${NAVIGATION_ACTION}/expose`,
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Expected payload for navigation actions.
|
|
153
|
-
*/
|
|
154
|
-
export namespace NavigationAction {
|
|
155
|
-
/**
|
|
156
|
-
* An additive overlay to apply to `location.active` (i.e. the result is a union of previous active and the argument)
|
|
157
|
-
*/
|
|
158
|
-
export type Open = IntentData<{ activeParts: ActiveParts }>;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Payload for adding an item to the active items.
|
|
162
|
-
*/
|
|
163
|
-
export type AddToActive = IntentData<{
|
|
164
|
-
part: LayoutPart;
|
|
165
|
-
id: string;
|
|
166
|
-
scrollIntoView?: boolean;
|
|
167
|
-
pivotId?: string;
|
|
168
|
-
positioning?: 'start' | 'end';
|
|
169
|
-
}>;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* A subtractive overlay to apply to `location.active` (i.e. the result is a subtraction from the previous active of the argument)
|
|
173
|
-
*/
|
|
174
|
-
export type Close = IntentData<{ activeParts: ActiveParts; noToggle?: boolean }>;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* The active parts to directly set, to be used when working with URLs or restoring a specific state.
|
|
178
|
-
*/
|
|
179
|
-
export type Set = IntentData<{ activeParts: ActiveParts }>;
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* An atomic transaction to apply to `location.active`, describing which element to (attempt to) move to which location.
|
|
183
|
-
*/
|
|
184
|
-
export type Adjust = IntentData<LayoutAdjustment>;
|
|
185
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2023 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
|
|
7
|
-
import { type Plugin } from '../plugin-host';
|
|
8
|
-
|
|
9
|
-
// TODO(burdon): Replace zed with effect.
|
|
10
|
-
export const ResourceKey = z.union([z.string(), z.record(z.any())]);
|
|
11
|
-
export type ResourceKey = z.infer<typeof ResourceKey>;
|
|
12
|
-
|
|
13
|
-
export const ResourceLanguage = z.record(ResourceKey);
|
|
14
|
-
export type ResourceLanguage = z.infer<typeof ResourceLanguage>;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A resource is a collection of translations for a language.
|
|
18
|
-
*/
|
|
19
|
-
export const Resource = z.record(ResourceLanguage);
|
|
20
|
-
export type Resource = z.infer<typeof Resource>;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Provides for a plugin that exposes translations.
|
|
24
|
-
*/
|
|
25
|
-
// TODO(wittjosiah): Rename to TranslationResourcesProvides.
|
|
26
|
-
export type TranslationsProvides = {
|
|
27
|
-
translations: Readonly<Resource[]>;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Type guard for translation plugins.
|
|
32
|
-
*/
|
|
33
|
-
export const parseTranslationsPlugin = (plugin: Plugin) => {
|
|
34
|
-
const { success } = z.array(Resource).safeParse((plugin.provides as any).translations);
|
|
35
|
-
return success ? (plugin as Plugin<TranslationsProvides>) : undefined;
|
|
36
|
-
};
|