@dxos/app-framework 0.8.4-main.84f28bd → 0.8.4-main.937b3ca
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/.storybook/main.mts +11 -0
- package/.storybook/preview.mts +8 -0
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs +149 -0
- package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs.map +7 -0
- package/dist/lib/browser/capability-7PCNSWBT.mjs +33 -0
- package/dist/lib/browser/capability-7PCNSWBT.mjs.map +7 -0
- package/dist/lib/browser/capability-KP3PFEXD.mjs +31 -0
- package/dist/lib/browser/capability-KP3PFEXD.mjs.map +7 -0
- package/dist/lib/browser/chunk-6Y7PZV72.mjs +77 -0
- package/dist/lib/browser/chunk-6Y7PZV72.mjs.map +7 -0
- package/dist/lib/browser/chunk-7IQHKD4U.mjs +170 -0
- package/dist/lib/browser/chunk-7IQHKD4U.mjs.map +7 -0
- package/dist/lib/browser/chunk-BLQJSGL3.mjs +732 -0
- package/dist/lib/browser/chunk-BLQJSGL3.mjs.map +7 -0
- package/dist/lib/browser/chunk-FHQTHCX7.mjs +8 -0
- package/dist/lib/browser/chunk-FHQTHCX7.mjs.map +7 -0
- package/dist/lib/browser/chunk-FMZN33N4.mjs +807 -0
- package/dist/lib/browser/chunk-FMZN33N4.mjs.map +7 -0
- package/dist/lib/browser/chunk-H4WPA7U7.mjs +77 -0
- package/dist/lib/browser/chunk-H4WPA7U7.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-PKQT6C53.mjs +47 -0
- package/dist/lib/browser/chunk-PKQT6C53.mjs.map +7 -0
- package/dist/lib/browser/chunk-TCLLRCS3.mjs +145 -0
- package/dist/lib/browser/chunk-TCLLRCS3.mjs.map +7 -0
- package/dist/lib/browser/chunk-XYNO72GQ.mjs +746 -0
- package/dist/lib/browser/chunk-XYNO72GQ.mjs.map +7 -0
- package/dist/lib/browser/common/index.mjs +38 -0
- package/dist/lib/browser/core/activation-event.mjs +20 -0
- package/dist/lib/browser/core/capability.mjs +28 -0
- package/dist/lib/browser/core/plugin-manager.mjs +15 -0
- package/dist/lib/browser/core/plugin-manager.mjs.map +7 -0
- package/dist/lib/browser/core/plugin.mjs +27 -0
- package/dist/lib/browser/core/plugin.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +165 -139
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs +32 -0
- package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs +64 -0
- package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs.map +7 -0
- package/dist/lib/browser/react/index.mjs +46 -0
- package/dist/lib/browser/react/index.mjs.map +7 -0
- package/dist/lib/browser/testing/index.mjs +79 -37
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs +150 -0
- package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs.map +7 -0
- package/dist/lib/node-esm/capability-CFLQ2QQU.mjs +34 -0
- package/dist/lib/node-esm/capability-CFLQ2QQU.mjs.map +7 -0
- package/dist/lib/node-esm/capability-RCUNM2M7.mjs +32 -0
- package/dist/lib/node-esm/capability-RCUNM2M7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-663A54LQ.mjs +171 -0
- package/dist/lib/node-esm/chunk-663A54LQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-6WXBT3EC.mjs +747 -0
- package/dist/lib/node-esm/chunk-6WXBT3EC.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7OWSHPYK.mjs +48 -0
- package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GQEBIGKD.mjs +733 -0
- package/dist/lib/node-esm/chunk-GQEBIGKD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-GT6OKM5I.mjs +146 -0
- package/dist/lib/node-esm/chunk-GT6OKM5I.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-STMXUEPO.mjs +78 -0
- package/dist/lib/node-esm/chunk-STMXUEPO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-UEWJDI2L.mjs +10 -0
- package/dist/lib/node-esm/chunk-UEWJDI2L.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XR6NMKEP.mjs +78 -0
- package/dist/lib/node-esm/chunk-XR6NMKEP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-XYQTBFPA.mjs +808 -0
- package/dist/lib/node-esm/chunk-XYQTBFPA.mjs.map +7 -0
- package/dist/lib/node-esm/common/index.mjs +39 -0
- package/dist/lib/node-esm/common/index.mjs.map +7 -0
- package/dist/lib/node-esm/core/activation-event.mjs +21 -0
- package/dist/lib/node-esm/core/activation-event.mjs.map +7 -0
- package/dist/lib/node-esm/core/capability.mjs +29 -0
- package/dist/lib/node-esm/core/capability.mjs.map +7 -0
- package/dist/lib/node-esm/core/plugin-manager.mjs +16 -0
- package/dist/lib/node-esm/core/plugin-manager.mjs.map +7 -0
- package/dist/lib/node-esm/core/plugin.mjs +28 -0
- package/dist/lib/node-esm/core/plugin.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +165 -139
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs +33 -0
- package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs +65 -0
- package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs.map +7 -0
- package/dist/lib/node-esm/react/index.mjs +47 -0
- package/dist/lib/node-esm/react/index.mjs.map +7 -0
- package/dist/lib/node-esm/testing/index.mjs +79 -37
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/types/src/cli.d.ts +39 -0
- package/dist/types/src/cli.d.ts.map +1 -0
- package/dist/types/src/common/activation-event.d.ts +66 -0
- package/dist/types/src/common/activation-event.d.ts.map +1 -0
- package/dist/types/src/common/capability.d.ts +265 -0
- package/dist/types/src/common/capability.d.ts.map +1 -0
- package/dist/types/src/common/collaboration.d.ts +24 -17
- package/dist/types/src/common/collaboration.d.ts.map +1 -1
- package/dist/types/src/common/file.d.ts +1 -1
- package/dist/types/src/common/file.d.ts.map +1 -1
- package/dist/types/src/common/graph.d.ts +2 -2
- package/dist/types/src/common/graph.d.ts.map +1 -1
- package/dist/types/src/common/index.d.ts +4 -3
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +380 -0
- package/dist/types/src/common/operations.d.ts.map +1 -0
- package/dist/types/src/common/plugin.d.ts +201 -0
- package/dist/types/src/common/plugin.d.ts.map +1 -0
- package/dist/types/src/common/surface.d.ts +50 -21
- package/dist/types/src/common/surface.d.ts.map +1 -1
- package/dist/types/src/common/translations.d.ts +10 -1
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/context.d.ts +5 -0
- package/dist/types/src/context.d.ts.map +1 -0
- package/dist/types/src/core/{events.d.ts → activation-event.d.ts} +6 -6
- package/dist/types/src/core/activation-event.d.ts.map +1 -0
- package/dist/types/src/core/capability-manager.d.ts +43 -0
- package/dist/types/src/core/capability-manager.d.ts.map +1 -0
- package/dist/types/src/core/capability-manager.test.d.ts +2 -0
- package/dist/types/src/core/capability-manager.test.d.ts.map +1 -0
- package/dist/types/src/core/capability.d.ts +150 -0
- package/dist/types/src/core/capability.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +5 -4
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manager.d.ts +66 -0
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.test.d.ts +2 -0
- package/dist/types/src/core/plugin-manager.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +97 -32
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +5 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/playground/debug/Debug.d.ts +4 -2
- package/dist/types/src/playground/debug/Debug.d.ts.map +1 -1
- package/dist/types/src/playground/debug/plugin.d.ts +2 -1
- package/dist/types/src/playground/debug/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/generator/Main.d.ts +4 -2
- package/dist/types/src/playground/generator/Main.d.ts.map +1 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +4 -2
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +1 -1
- package/dist/types/src/playground/generator/generator.d.ts +17 -5
- package/dist/types/src/playground/generator/generator.d.ts.map +1 -1
- package/dist/types/src/playground/generator/plugin.d.ts +2 -1
- package/dist/types/src/playground/generator/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/layout/Layout.d.ts +4 -2
- package/dist/types/src/playground/layout/Layout.d.ts.map +1 -1
- package/dist/types/src/playground/layout/plugin.d.ts +2 -1
- package/dist/types/src/playground/layout/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +4 -2
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +1 -1
- package/dist/types/src/playground/logger/plugin.d.ts +2 -1
- package/dist/types/src/playground/logger/plugin.d.ts.map +1 -1
- package/dist/types/src/playground/logger/schema.d.ts +15 -1
- package/dist/types/src/playground/logger/schema.d.ts.map +1 -1
- package/dist/types/src/playground/playground.stories.d.ts +5 -4
- package/dist/types/src/playground/playground.stories.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts +3 -0
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/capability.d.ts +7 -0
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/errors.d.ts +5 -0
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts +18 -0
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts +2 -0
- package/dist/types/src/plugin-operation/history/history-tracker.test.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/index.d.ts +6 -0
- package/dist/types/src/plugin-operation/history/index.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/types.d.ts +13 -0
- package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +93 -0
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts +23 -0
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts +2 -0
- package/dist/types/src/plugin-operation/history/undo-registry.test.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/index.d.ts +3 -0
- package/dist/types/src/plugin-operation/index.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +6 -0
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/meta.d.ts +3 -0
- package/dist/types/src/plugin-operation/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-operation/testing.d.ts +109 -0
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts +3 -0
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/capability.d.ts +6 -0
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/index.d.ts +2 -0
- package/dist/types/src/plugin-runtime/index.d.ts.map +1 -0
- package/dist/types/src/plugin-runtime/meta.d.ts +3 -0
- package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +2 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/actions.d.ts +41 -7
- package/dist/types/src/plugin-settings/actions.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +4 -2
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/plugin-settings/meta.d.ts +3 -0
- package/dist/types/src/plugin-settings/meta.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/operation-resolver.d.ts +6 -0
- package/dist/types/src/plugin-settings/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/plugin-settings/translations.d.ts +2 -1
- package/dist/types/src/plugin-settings/translations.d.ts.map +1 -1
- package/dist/types/src/react/App.d.ts +8 -0
- package/dist/types/src/react/App.d.ts.map +1 -0
- package/dist/types/src/react/App.stories.d.ts +14 -0
- package/dist/types/src/react/App.stories.d.ts.map +1 -0
- package/dist/types/src/react/DefaultFallback.d.ts +8 -0
- package/dist/types/src/react/DefaultFallback.d.ts.map +1 -0
- package/dist/types/src/react/ErrorBoundary.d.ts +13 -14
- package/dist/types/src/react/ErrorBoundary.d.ts.map +1 -1
- package/dist/types/src/react/PluginManagerContext.stories.d.ts +13 -0
- package/dist/types/src/react/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/react/PluginManagerProvider.d.ts +2 -2
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +1 -1
- package/dist/types/src/react/Surface.d.ts +9 -7
- package/dist/types/src/react/Surface.d.ts.map +1 -1
- package/dist/types/src/react/Surface.stories.d.ts +8 -10
- package/dist/types/src/react/Surface.stories.d.ts.map +1 -1
- package/dist/types/src/react/SurfaceInfo.d.ts +11 -0
- package/dist/types/src/react/SurfaceInfo.d.ts.map +1 -0
- package/dist/types/src/react/common.d.ts +13 -12
- package/dist/types/src/react/common.d.ts.map +1 -1
- package/dist/types/src/react/index.d.ts +3 -1
- package/dist/types/src/react/index.d.ts.map +1 -1
- package/dist/types/src/react/types.d.ts +12 -0
- package/dist/types/src/react/types.d.ts.map +1 -0
- package/dist/types/src/{App.d.ts → react/useApp.d.ts} +11 -9
- package/dist/types/src/react/useApp.d.ts.map +1 -0
- package/dist/types/src/react/useCapabilities.d.ts +16 -3
- package/dist/types/src/react/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/react/useLoading.d.ts +18 -0
- package/dist/types/src/react/useLoading.d.ts.map +1 -0
- package/dist/types/src/react/useOperationResolver.d.ts +19 -0
- package/dist/types/src/react/useOperationResolver.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/service.d.ts +8 -0
- package/dist/types/src/testing/service.d.ts.map +1 -0
- package/dist/types/src/testing/withPluginManager.d.ts +11 -10
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts +9 -3
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +10 -2
- package/package.json +103 -42
- package/src/cli.ts +107 -0
- package/src/common/activation-event.ts +99 -0
- package/src/common/capability.ts +343 -0
- package/src/common/collaboration.ts +24 -14
- package/src/common/file.ts +1 -1
- package/src/common/graph.ts +2 -2
- package/src/common/index.ts +4 -3
- package/src/common/operations.ts +412 -0
- package/src/common/plugin.ts +364 -0
- package/src/common/surface.ts +60 -26
- package/src/common/translations.ts +21 -1
- package/src/context.ts +9 -0
- package/src/core/{events.ts → activation-event.ts} +5 -5
- package/src/core/capability-manager.test.ts +151 -0
- package/src/core/capability-manager.ts +171 -0
- package/src/core/capability.ts +236 -0
- package/src/core/index.ts +5 -4
- package/src/core/plugin-manager.test.ts +845 -0
- package/src/core/plugin-manager.ts +696 -0
- package/src/core/plugin.ts +229 -36
- package/src/helpers.test.ts +1 -1
- package/src/index.ts +5 -4
- package/src/playground/debug/Debug.tsx +27 -17
- package/src/playground/debug/plugin.ts +10 -11
- package/src/playground/generator/Main.tsx +20 -11
- package/src/playground/generator/Toolbar.tsx +27 -16
- package/src/playground/generator/generator.ts +28 -28
- package/src/playground/generator/plugin.ts +15 -17
- package/src/playground/layout/Layout.tsx +11 -7
- package/src/playground/layout/plugin.ts +12 -11
- package/src/playground/logger/Toolbar.tsx +20 -16
- package/src/playground/logger/plugin.ts +33 -27
- package/src/playground/logger/schema.ts +11 -1
- package/src/playground/playground.stories.tsx +29 -17
- package/src/plugin-operation/OperationPlugin.ts +25 -0
- package/src/plugin-operation/history/capability.ts +37 -0
- package/src/plugin-operation/history/errors.ts +11 -0
- package/src/plugin-operation/history/history-tracker.test.ts +380 -0
- package/src/plugin-operation/history/history-tracker.ts +129 -0
- package/src/plugin-operation/history/index.ts +9 -0
- package/src/plugin-operation/history/types.ts +17 -0
- package/src/plugin-operation/history/undo-mapping.ts +132 -0
- package/src/plugin-operation/history/undo-registry.test.ts +73 -0
- package/src/plugin-operation/history/undo-registry.ts +54 -0
- package/src/plugin-operation/index.ts +6 -0
- package/src/plugin-operation/invoker-capability.ts +40 -0
- package/src/plugin-operation/meta.ts +11 -0
- package/src/plugin-operation/testing.ts +174 -0
- package/src/plugin-runtime/RuntimePlugin.ts +20 -0
- package/src/plugin-runtime/capability.ts +53 -0
- package/src/plugin-runtime/index.ts +5 -0
- package/src/plugin-runtime/meta.ts +11 -0
- package/src/plugin-settings/SettingsPlugin.ts +13 -29
- package/src/plugin-settings/actions.ts +45 -10
- package/src/plugin-settings/app-graph-builder.ts +124 -141
- package/src/plugin-settings/meta.ts +10 -0
- package/src/plugin-settings/operation-resolver.ts +55 -0
- package/src/plugin-settings/translations.ts +4 -4
- package/src/react/App.stories.tsx +63 -0
- package/src/react/App.tsx +60 -0
- package/src/react/DefaultFallback.tsx +26 -0
- package/src/react/ErrorBoundary.tsx +26 -15
- package/src/react/PluginManagerContext.stories.tsx +184 -0
- package/src/react/PluginManagerProvider.ts +2 -2
- package/src/react/Surface.stories.tsx +103 -58
- package/src/react/Surface.tsx +236 -46
- package/src/react/SurfaceInfo.tsx +107 -0
- package/src/react/common.ts +30 -5
- package/src/react/index.ts +5 -1
- package/src/react/types.ts +27 -0
- package/src/react/useApp.tsx +209 -0
- package/src/react/useCapabilities.ts +38 -5
- package/src/react/useLoading.tsx +68 -0
- package/src/react/useOperationResolver.ts +40 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/service.ts +52 -0
- package/src/testing/withPluginManager.stories.tsx +14 -10
- package/src/testing/withPluginManager.tsx +43 -44
- package/tsconfig.json +30 -16
- package/vitest.config.ts +8 -6
- package/.eslintrc.cjs +0 -9
- package/.swc/plugins/v7_linux_x86_64_13.0.0/f45bdff002284d9e8f9ef3f0be909de12da36c049cbcf261ac78fc00abb09a2d +0 -0
- package/.swc/plugins/v7_linux_x86_64_13.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429 +0 -0
- package/dist/lib/browser/app-graph-builder-BGGXLD6T.mjs +0 -137
- package/dist/lib/browser/app-graph-builder-BGGXLD6T.mjs.map +0 -7
- package/dist/lib/browser/chunk-2636QSIK.mjs +0 -1518
- package/dist/lib/browser/chunk-2636QSIK.mjs.map +0 -7
- package/dist/lib/browser/chunk-DHZB7HG7.mjs +0 -413
- package/dist/lib/browser/chunk-DHZB7HG7.mjs.map +0 -7
- package/dist/lib/browser/chunk-ORWHM7CO.mjs +0 -32
- package/dist/lib/browser/chunk-ORWHM7CO.mjs.map +0 -7
- package/dist/lib/browser/intent-dispatcher-TWKB22NI.mjs +0 -11
- package/dist/lib/browser/intent-resolver-O67UANYP.mjs +0 -39
- package/dist/lib/browser/intent-resolver-O67UANYP.mjs.map +0 -7
- package/dist/lib/browser/store-LFKDWHUQ.mjs +0 -30
- package/dist/lib/browser/store-LFKDWHUQ.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -79
- package/dist/lib/node-esm/app-graph-builder-QHIJUYYW.mjs +0 -138
- package/dist/lib/node-esm/app-graph-builder-QHIJUYYW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NJAFK626.mjs +0 -414
- package/dist/lib/node-esm/chunk-NJAFK626.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UMZQERLE.mjs +0 -34
- package/dist/lib/node-esm/chunk-UMZQERLE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VSKRV3NW.mjs +0 -1520
- package/dist/lib/node-esm/chunk-VSKRV3NW.mjs.map +0 -7
- package/dist/lib/node-esm/intent-dispatcher-5PRM3KGH.mjs +0 -12
- package/dist/lib/node-esm/intent-resolver-K3D4BXQQ.mjs +0 -40
- package/dist/lib/node-esm/intent-resolver-K3D4BXQQ.mjs.map +0 -7
- package/dist/lib/node-esm/store-53XDUBMD.mjs +0 -31
- package/dist/lib/node-esm/store-53XDUBMD.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -80
- package/dist/types/src/App.d.ts.map +0 -1
- package/dist/types/src/common/capabilities.d.ts +0 -122
- package/dist/types/src/common/capabilities.d.ts.map +0 -1
- package/dist/types/src/common/events.d.ts +0 -52
- package/dist/types/src/common/events.d.ts.map +0 -1
- package/dist/types/src/common/layout.d.ts +0 -281
- package/dist/types/src/common/layout.d.ts.map +0 -1
- package/dist/types/src/core/capabilities.d.ts +0 -114
- package/dist/types/src/core/capabilities.d.ts.map +0 -1
- package/dist/types/src/core/capabilities.test.d.ts +0 -2
- package/dist/types/src/core/capabilities.test.d.ts.map +0 -1
- package/dist/types/src/core/events.d.ts.map +0 -1
- package/dist/types/src/core/manager.d.ts +0 -122
- package/dist/types/src/core/manager.d.ts.map +0 -1
- package/dist/types/src/core/manager.test.d.ts +0 -2
- package/dist/types/src/core/manager.test.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts +0 -2
- package/dist/types/src/plugin-intent/IntentPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/actions.d.ts +0 -38
- package/dist/types/src/plugin-intent/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/errors.d.ts +0 -16
- package/dist/types/src/plugin-intent/errors.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/index.d.ts +0 -5
- package/dist/types/src/plugin-intent/index.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts +0 -139
- package/dist/types/src/plugin-intent/intent-dispatcher.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts +0 -2
- package/dist/types/src/plugin-intent/intent-dispatcher.test.d.ts.map +0 -1
- package/dist/types/src/plugin-intent/intent.d.ts +0 -63
- package/dist/types/src/plugin-intent/intent.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/intent-resolver.d.ts +0 -4
- package/dist/types/src/plugin-settings/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/store.d.ts +0 -5
- package/dist/types/src/plugin-settings/store.d.ts.map +0 -1
- package/dist/types/src/react/IntentContext.d.ts +0 -8
- package/dist/types/src/react/IntentContext.d.ts.map +0 -1
- package/dist/types/src/react/useIntentResolver.d.ts +0 -3
- package/dist/types/src/react/useIntentResolver.d.ts.map +0 -1
- package/dist/types/src/worker.d.ts +0 -4
- package/dist/types/src/worker.d.ts.map +0 -1
- package/src/App.tsx +0 -276
- package/src/common/capabilities.ts +0 -113
- package/src/common/events.ts +0 -77
- package/src/common/layout.ts +0 -278
- package/src/core/capabilities.test.ts +0 -136
- package/src/core/capabilities.ts +0 -254
- package/src/core/manager.test.ts +0 -515
- package/src/core/manager.ts +0 -519
- package/src/plugin-intent/IntentPlugin.ts +0 -20
- package/src/plugin-intent/actions.ts +0 -33
- package/src/plugin-intent/errors.ts +0 -39
- package/src/plugin-intent/index.ts +0 -8
- package/src/plugin-intent/intent-dispatcher.test.ts +0 -279
- package/src/plugin-intent/intent-dispatcher.ts +0 -333
- package/src/plugin-intent/intent.ts +0 -154
- package/src/plugin-settings/intent-resolver.ts +0 -34
- package/src/plugin-settings/store.ts +0 -33
- package/src/react/IntentContext.tsx +0 -34
- package/src/react/useIntentResolver.ts +0 -22
- package/src/worker.ts +0 -11
- package/typedoc/.nojekyll +0 -1
- package/typedoc/assets/hierarchy.js +0 -1
- package/typedoc/assets/highlight.css +0 -106
- package/typedoc/assets/icons.js +0 -18
- package/typedoc/assets/icons.svg +0 -1
- package/typedoc/assets/main.js +0 -60
- package/typedoc/assets/navigation.js +0 -1
- package/typedoc/assets/search.js +0 -1
- package/typedoc/assets/style.css +0 -1640
- package/typedoc/classes/CollaborationActions.InsertContent.html +0 -421
- package/typedoc/classes/ErrorBoundary.html +0 -125
- package/typedoc/classes/IntentAction.ShowUndo.html +0 -227
- package/typedoc/classes/IntentAction.Track.html +0 -266
- package/typedoc/classes/LayoutAction.AddToast.html +0 -265
- package/typedoc/classes/LayoutAction.Close.html +0 -382
- package/typedoc/classes/LayoutAction.Expose.html +0 -265
- package/typedoc/classes/LayoutAction.Open.html +0 -1123
- package/typedoc/classes/LayoutAction.RevertWorkspace.html +0 -343
- package/typedoc/classes/LayoutAction.ScrollIntoView.html +0 -460
- package/typedoc/classes/LayoutAction.Set.html +0 -460
- package/typedoc/classes/LayoutAction.SetLayoutMode.html +0 -499
- package/typedoc/classes/LayoutAction.SwitchWorkspace.html +0 -265
- package/typedoc/classes/LayoutAction.UpdateComplementary.html +0 -616
- package/typedoc/classes/LayoutAction.UpdateDialog.html +0 -1123
- package/typedoc/classes/LayoutAction.UpdateLayout.html +0 -461
- package/typedoc/classes/LayoutAction.UpdatePopover.html +0 -1435
- package/typedoc/classes/LayoutAction.UpdateSidebar.html +0 -616
- package/typedoc/classes/Plugin.html +0 -6
- package/typedoc/classes/PluginContext.html +0 -38
- package/typedoc/classes/PluginManager.html +0 -43
- package/typedoc/classes/PluginModule.html +0 -18
- package/typedoc/classes/SettingsAction.Open.html +0 -226
- package/typedoc/classes/SettingsAction.OpenPluginRegistry.html +0 -265
- package/typedoc/functions/Events.createStateEvent.html +0 -2
- package/typedoc/functions/IntentPlugin.html +0 -1
- package/typedoc/functions/SettingsPlugin.html +0 -1
- package/typedoc/functions/allOf.html +0 -2
- package/typedoc/functions/chain.html +0 -3
- package/typedoc/functions/contributes.html +0 -2
- package/typedoc/functions/createDispatcher.html +0 -3
- package/typedoc/functions/createIntent.html +0 -6
- package/typedoc/functions/createResolver.html +0 -2
- package/typedoc/functions/createSurface.html +0 -2
- package/typedoc/functions/defineCapability.html +0 -2
- package/typedoc/functions/defineEvent.html +0 -2
- package/typedoc/functions/defineModule.html +0 -2
- package/typedoc/functions/definePlugin.html +0 -2
- package/typedoc/functions/eventKey.html +0 -2
- package/typedoc/functions/getEvents.html +0 -2
- package/typedoc/functions/isAllOf.html +0 -2
- package/typedoc/functions/isOneOf.html +0 -2
- package/typedoc/functions/isSurfaceAvailable.html +0 -2
- package/typedoc/functions/lazy.html +0 -2
- package/typedoc/functions/oneOf.html +0 -2
- package/typedoc/functions/useApp.html +0 -6
- package/typedoc/functions/useAppGraph.html +0 -1
- package/typedoc/functions/useCapabilities.html +0 -3
- package/typedoc/functions/useCapability.html +0 -4
- package/typedoc/functions/useIntentDispatcher.html +0 -1
- package/typedoc/functions/useIntentResolver.html +0 -1
- package/typedoc/functions/useLayout.html +0 -1
- package/typedoc/functions/usePluginManager.html +0 -2
- package/typedoc/hierarchy.html +0 -1
- package/typedoc/index.html +0 -12
- package/typedoc/interfaces/LayoutAction.Toast.html +0 -10
- package/typedoc/media/LICENSE +0 -8
- package/typedoc/modules/Capabilities.html +0 -1
- package/typedoc/modules/CollaborationActions.html +0 -1
- package/typedoc/modules/Events.html +0 -1
- package/typedoc/modules/IntentAction.html +0 -1
- package/typedoc/modules/LayoutAction.html +0 -2
- package/typedoc/modules/SettingsAction.html +0 -1
- package/typedoc/modules.html +0 -1
- package/typedoc/types/ActivationEvent.html +0 -8
- package/typedoc/types/ActivationEvents.html +0 -2
- package/typedoc/types/AnyCapability.html +0 -1
- package/typedoc/types/AnyIntent.html +0 -1
- package/typedoc/types/AnyIntentChain.html +0 -1
- package/typedoc/types/AnyIntentEffectResult.html +0 -1
- package/typedoc/types/AnyIntentResolver.html +0 -1
- package/typedoc/types/AnyIntentResult.html +0 -1
- package/typedoc/types/Capabilities.FileUploader.html +0 -1
- package/typedoc/types/Capabilities.IntentResolver.html +0 -1
- package/typedoc/types/Capabilities.Layout.html +0 -1
- package/typedoc/types/Capabilities.Metadata.html +0 -1
- package/typedoc/types/Capabilities.ReactContext.html +0 -1
- package/typedoc/types/Capabilities.ReactRoot.html +0 -1
- package/typedoc/types/Capabilities.ReactSurface.html +0 -1
- package/typedoc/types/Capabilities.Settings.html +0 -4
- package/typedoc/types/Capability.html +0 -9
- package/typedoc/types/CreateAppOptions.html +0 -10
- package/typedoc/types/FileInfo.html +0 -1
- package/typedoc/types/Intent.html +0 -10
- package/typedoc/types/IntentChain.html +0 -6
- package/typedoc/types/IntentContext.html +0 -5
- package/typedoc/types/IntentData.html +0 -1
- package/typedoc/types/IntentDispatcher.html +0 -2
- package/typedoc/types/IntentDispatcherResult.html +0 -2
- package/typedoc/types/IntentEffectDefinition.html +0 -2
- package/typedoc/types/IntentEffectResult.html +0 -15
- package/typedoc/types/IntentParams.html +0 -3
- package/typedoc/types/IntentResolver.html +0 -2
- package/typedoc/types/IntentResultData.html +0 -1
- package/typedoc/types/IntentSchema.html +0 -1
- package/typedoc/types/IntentUndo.html +0 -2
- package/typedoc/types/InterfaceDef.html +0 -4
- package/typedoc/types/Label.html +0 -1
- package/typedoc/types/NodeSerializer.html +0 -8
- package/typedoc/types/PluginManagerOptions.html +0 -6
- package/typedoc/types/PluginMeta.html +0 -21
- package/typedoc/types/PromiseIntentDispatcher.html +0 -2
- package/typedoc/types/PromiseIntentUndo.html +0 -2
- package/typedoc/types/Resource.html +0 -1
- package/typedoc/types/ResourceKey.html +0 -1
- package/typedoc/types/ResourceLanguage.html +0 -1
- package/typedoc/types/SerializedNode.html +0 -4
- package/typedoc/types/SurfaceComponent.html +0 -2
- package/typedoc/types/SurfaceDefinition.html +0 -2
- package/typedoc/types/SurfaceProps.html +0 -4
- package/typedoc/variables/Capabilities.AnchorSort.html +0 -1
- package/typedoc/variables/Capabilities.AppGraph.html +0 -1
- package/typedoc/variables/Capabilities.AppGraphBuilder.html +0 -1
- package/typedoc/variables/Capabilities.AppGraphSerializer.html +0 -1
- package/typedoc/variables/Capabilities.ArtifactDefinition.html +0 -1
- package/typedoc/variables/Capabilities.FileUploader.html +0 -1
- package/typedoc/variables/Capabilities.IntentDispatcher.html +0 -1
- package/typedoc/variables/Capabilities.IntentResolver.html +0 -1
- package/typedoc/variables/Capabilities.Layout.html +0 -1
- package/typedoc/variables/Capabilities.Metadata.html +0 -1
- package/typedoc/variables/Capabilities.Null.html +0 -1
- package/typedoc/variables/Capabilities.PluginManager.html +0 -1
- package/typedoc/variables/Capabilities.ReactContext.html +0 -1
- package/typedoc/variables/Capabilities.ReactRoot.html +0 -1
- package/typedoc/variables/Capabilities.ReactSurface.html +0 -1
- package/typedoc/variables/Capabilities.RxRegistry.html +0 -1
- package/typedoc/variables/Capabilities.Settings.html +0 -1
- package/typedoc/variables/Capabilities.SettingsStore.html +0 -1
- package/typedoc/variables/Capabilities.Tools.html +0 -1
- package/typedoc/variables/Capabilities.Translations.html +0 -1
- package/typedoc/variables/Events.AppGraphReady.html +0 -2
- package/typedoc/variables/Events.DispatcherReady.html +0 -2
- package/typedoc/variables/Events.LayoutReady.html +0 -1
- package/typedoc/variables/Events.SettingsReady.html +0 -2
- package/typedoc/variables/Events.SetupAppGraph.html +0 -2
- package/typedoc/variables/Events.SetupArtifactDefinition.html +0 -2
- package/typedoc/variables/Events.SetupIntentResolver.html +0 -2
- package/typedoc/variables/Events.SetupMetadata.html +0 -2
- package/typedoc/variables/Events.SetupReactSurface.html +0 -2
- package/typedoc/variables/Events.SetupSettings.html +0 -2
- package/typedoc/variables/Events.SetupTranslations.html +0 -2
- package/typedoc/variables/Events.Startup.html +0 -2
- package/typedoc/variables/FileInfoSchema.html +0 -1
- package/typedoc/variables/INTENT_ACTION.html +0 -1
- package/typedoc/variables/INTENT_PLUGIN.html +0 -1
- package/typedoc/variables/LAYOUT_ACTION.html +0 -1
- package/typedoc/variables/LAYOUT_PLUGIN.html +0 -1
- package/typedoc/variables/Label.html +0 -1
- package/typedoc/variables/LayoutAction.Toast.html +0 -1
- package/typedoc/variables/LayoutAction.UPDATE_LAYOUT.html +0 -1
- package/typedoc/variables/PluginManagerProvider.html +0 -2
- package/typedoc/variables/Resource.html +0 -2
- package/typedoc/variables/ResourceKey.html +0 -1
- package/typedoc/variables/ResourceLanguage.html +0 -1
- package/typedoc/variables/SETTINGS_ACTION.html +0 -1
- package/typedoc/variables/SETTINGS_ID.html +0 -1
- package/typedoc/variables/SETTINGS_KEY.html +0 -1
- package/typedoc/variables/SETTINGS_PLUGIN.html +0 -1
- package/typedoc/variables/Surface.html +0 -2
- package/typedoc/variables/defaultFileTypes.html +0 -1
- /package/dist/lib/browser/{intent-dispatcher-TWKB22NI.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/browser/{worker.mjs.map → common/index.mjs.map} +0 -0
- /package/dist/lib/{node-esm/intent-dispatcher-5PRM3KGH.mjs.map → browser/core/activation-event.mjs.map} +0 -0
- /package/dist/lib/{node-esm/worker.mjs.map → browser/core/capability.mjs.map} +0 -0
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
import {
|
|
2
|
+
PluginManagerContext
|
|
3
|
+
} from "./chunk-FHQTHCX7.mjs";
|
|
4
|
+
import {
|
|
5
|
+
ActivationEvent,
|
|
6
|
+
Capability
|
|
7
|
+
} from "./chunk-BLQJSGL3.mjs";
|
|
8
|
+
import {
|
|
9
|
+
plugin_manager_exports
|
|
10
|
+
} from "./chunk-FMZN33N4.mjs";
|
|
11
|
+
|
|
12
|
+
// src/react/common.ts
|
|
13
|
+
import { RegistryContext, useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
|
|
14
|
+
import { useCallback as useCallback2, useContext as useContext2 } from "react";
|
|
15
|
+
|
|
16
|
+
// src/react/useCapabilities.ts
|
|
17
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
18
|
+
import { useCallback } from "react";
|
|
19
|
+
import { invariant } from "@dxos/invariant";
|
|
20
|
+
|
|
21
|
+
// src/react/PluginManagerProvider.ts
|
|
22
|
+
import { createContext, useContext } from "react";
|
|
23
|
+
import { raise } from "@dxos/debug";
|
|
24
|
+
var PluginManagerContext2 = createContext(void 0);
|
|
25
|
+
var usePluginManager = () => useContext(PluginManagerContext2) ?? raise(new Error("Missing PluginManagerContext"));
|
|
26
|
+
var PluginManagerProvider = PluginManagerContext2.Provider;
|
|
27
|
+
|
|
28
|
+
// src/react/useCapabilities.ts
|
|
29
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/react/useCapabilities.ts";
|
|
30
|
+
var useCapabilities = (interfaceDef) => {
|
|
31
|
+
const manager = usePluginManager();
|
|
32
|
+
return useAtomValue(manager.capabilities.atom(interfaceDef));
|
|
33
|
+
};
|
|
34
|
+
var useCapability = (interfaceDef) => {
|
|
35
|
+
const capabilities = useCapabilities(interfaceDef);
|
|
36
|
+
invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, {
|
|
37
|
+
F: __dxlog_file,
|
|
38
|
+
L: 31,
|
|
39
|
+
S: void 0,
|
|
40
|
+
A: [
|
|
41
|
+
"capabilities.length > 0",
|
|
42
|
+
"`No capability found for ${interfaceDef.identifier}`"
|
|
43
|
+
]
|
|
44
|
+
});
|
|
45
|
+
return capabilities[0];
|
|
46
|
+
};
|
|
47
|
+
var useAtomCapability = (atomCapability) => {
|
|
48
|
+
const atom = useCapability(atomCapability);
|
|
49
|
+
return useAtomValue(atom);
|
|
50
|
+
};
|
|
51
|
+
var useAtomCapabilityState = (atomCapability) => {
|
|
52
|
+
const registry = useCapability(Capability.AtomRegistry);
|
|
53
|
+
const atom = useCapability(atomCapability);
|
|
54
|
+
const value = useAtomValue(atom);
|
|
55
|
+
const update = useCallback((fn) => {
|
|
56
|
+
registry.set(atom, fn(registry.get(atom)));
|
|
57
|
+
}, [
|
|
58
|
+
registry,
|
|
59
|
+
atom
|
|
60
|
+
]);
|
|
61
|
+
return [
|
|
62
|
+
value,
|
|
63
|
+
update
|
|
64
|
+
];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// src/react/common.ts
|
|
68
|
+
var useOperationInvoker = () => useCapability(Capability.OperationInvoker);
|
|
69
|
+
var useAppGraph = () => useCapability(Capability.AppGraph);
|
|
70
|
+
var useLayout = () => useAtomCapability(Capability.Layout);
|
|
71
|
+
var useSettingsState = (atom) => {
|
|
72
|
+
const registry = useContext2(RegistryContext);
|
|
73
|
+
const settings = useAtomValue2(atom);
|
|
74
|
+
const updateSettings = useCallback2((fn) => {
|
|
75
|
+
registry.set(atom, fn(registry.get(atom)));
|
|
76
|
+
}, [
|
|
77
|
+
registry,
|
|
78
|
+
atom
|
|
79
|
+
]);
|
|
80
|
+
return {
|
|
81
|
+
settings,
|
|
82
|
+
updateSettings
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// src/react/ErrorBoundary.tsx
|
|
87
|
+
import React, { Component } from "react";
|
|
88
|
+
var ErrorBoundary = class extends Component {
|
|
89
|
+
static getDerivedStateFromError(error) {
|
|
90
|
+
return {
|
|
91
|
+
error
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
state = {
|
|
95
|
+
error: void 0
|
|
96
|
+
};
|
|
97
|
+
componentDidUpdate(prevProps) {
|
|
98
|
+
if (prevProps.data !== this.props.data) {
|
|
99
|
+
this.resetError();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
render() {
|
|
103
|
+
if (this.state.error) {
|
|
104
|
+
const Fallback = this.props.fallback ?? DefaultFallback;
|
|
105
|
+
return /* @__PURE__ */ React.createElement(Fallback, {
|
|
106
|
+
data: this.props.data,
|
|
107
|
+
error: this.state.error
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return this.props.children;
|
|
111
|
+
}
|
|
112
|
+
resetError() {
|
|
113
|
+
this.setState({
|
|
114
|
+
error: void 0
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
var DefaultFallback = ({ data, error }) => {
|
|
119
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
120
|
+
className: "flex flex-col gap-2 overflow-hidden border border-red-500 rounded-sm"
|
|
121
|
+
}, /* @__PURE__ */ React.createElement("h1", {
|
|
122
|
+
className: "p-2"
|
|
123
|
+
}, "ERROR: ", error.message), /* @__PURE__ */ React.createElement("pre", {
|
|
124
|
+
className: "p-2 overflow-y-auto text-sm text-subdued"
|
|
125
|
+
}, JSON.stringify(data, null, 2)));
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
// src/react/Surface.tsx
|
|
129
|
+
import React3, { Fragment, Suspense, createContext as createContext2, forwardRef as forwardRef2, memo, useContext as useContext3, useEffect, useMemo, useRef } from "react";
|
|
130
|
+
import { raise as raise2 } from "@dxos/debug";
|
|
131
|
+
import { log } from "@dxos/log";
|
|
132
|
+
import { useDefaultValue } from "@dxos/react-hooks";
|
|
133
|
+
import { byPosition } from "@dxos/util";
|
|
134
|
+
|
|
135
|
+
// src/react/SurfaceInfo.tsx
|
|
136
|
+
import React2, { cloneElement, forwardRef, useCallback as useCallback3, useLayoutEffect, useState } from "react";
|
|
137
|
+
import { createPortal } from "react-dom";
|
|
138
|
+
import { addEventListener, combine } from "@dxos/async";
|
|
139
|
+
import { useMergeRefs } from "@dxos/react-hooks";
|
|
140
|
+
var SurfaceInfo = /* @__PURE__ */ forwardRef(({ children }, forwardedRef) => {
|
|
141
|
+
const [rect, setRect] = useState(null);
|
|
142
|
+
const [expand, setExpand] = useState(false);
|
|
143
|
+
const info = useSurface();
|
|
144
|
+
const [root, setRoot] = useState(null);
|
|
145
|
+
const measureRef = useCallback3((node) => setRoot(node), []);
|
|
146
|
+
const mergedRef = useMergeRefs([
|
|
147
|
+
measureRef,
|
|
148
|
+
forwardedRef
|
|
149
|
+
]);
|
|
150
|
+
const childWithRef = /* @__PURE__ */ cloneElement(children, {
|
|
151
|
+
ref: mergedRef
|
|
152
|
+
});
|
|
153
|
+
useLayoutEffect(() => {
|
|
154
|
+
if (!root) {
|
|
155
|
+
setRect(null);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
const measure = () => {
|
|
159
|
+
setRect(root.getBoundingClientRect());
|
|
160
|
+
};
|
|
161
|
+
const observer = new ResizeObserver(measure);
|
|
162
|
+
observer.observe(root);
|
|
163
|
+
measure();
|
|
164
|
+
return combine(addEventListener(window, "scroll", measure, true), addEventListener(window, "resize", measure), () => {
|
|
165
|
+
observer.disconnect();
|
|
166
|
+
});
|
|
167
|
+
}, [
|
|
168
|
+
root
|
|
169
|
+
]);
|
|
170
|
+
const padding = 0;
|
|
171
|
+
return /* @__PURE__ */ React2.createElement(React2.Fragment, null, childWithRef, rect && /* @__PURE__ */ createPortal(
|
|
172
|
+
/* @__PURE__ */ React2.createElement("div", {
|
|
173
|
+
role: "none",
|
|
174
|
+
className: "z-[100] fixed flex flex-col-reverse scrollbar-none overflow-auto pointer-events-none",
|
|
175
|
+
style: {
|
|
176
|
+
top: rect.top + padding,
|
|
177
|
+
left: rect.left + padding,
|
|
178
|
+
width: rect.width - padding * 2,
|
|
179
|
+
height: rect.height - padding * 2
|
|
180
|
+
}
|
|
181
|
+
}, expand ? /* @__PURE__ */ React2.createElement("div", {
|
|
182
|
+
className: "absolute inset-0 bg-deckSurface border border-green-500 cursor-pointer pointer-events-auto overflow-auto",
|
|
183
|
+
onPointerDown: (ev) => ev.stopPropagation(),
|
|
184
|
+
onClick: (ev) => {
|
|
185
|
+
ev.stopPropagation();
|
|
186
|
+
setExpand(false);
|
|
187
|
+
}
|
|
188
|
+
}, /* @__PURE__ */ React2.createElement("pre", {
|
|
189
|
+
className: "p-2 text-xs text-description font-mono"
|
|
190
|
+
}, JSON.stringify({
|
|
191
|
+
info
|
|
192
|
+
}, null, 2))) : /* @__PURE__ */ React2.createElement("span", {
|
|
193
|
+
className: "absolute right-1 bottom-0 flex items-center p-1 text-green-500 opacity-80 hover:opacity-100 text-xl cursor-pointer pointer-events-auto",
|
|
194
|
+
title: info.id,
|
|
195
|
+
onPointerDown: (ev) => ev.stopPropagation(),
|
|
196
|
+
onClick: (ev) => {
|
|
197
|
+
ev.stopPropagation();
|
|
198
|
+
setExpand(true);
|
|
199
|
+
}
|
|
200
|
+
}, "\u24D8")),
|
|
201
|
+
// TODO(burdon): Create well-known element to gather all debug portals.
|
|
202
|
+
document.body
|
|
203
|
+
));
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// src/react/Surface.tsx
|
|
207
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/react/Surface.tsx";
|
|
208
|
+
var DEFAULT_PLACEHOLDER = /* @__PURE__ */ React3.createElement(Fragment, null);
|
|
209
|
+
var DEBUG = import.meta.env.VITE_DEBUG;
|
|
210
|
+
var SurfaceContext = /* @__PURE__ */ createContext2(void 0);
|
|
211
|
+
var WebComponentWrapper = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ id, role, data, limit, definition, ...rest }, forwardedRef) => {
|
|
212
|
+
const containerRef = useRef(null);
|
|
213
|
+
const elementRef = useRef(null);
|
|
214
|
+
const propsRef = useRef({
|
|
215
|
+
id,
|
|
216
|
+
role,
|
|
217
|
+
data,
|
|
218
|
+
limit,
|
|
219
|
+
...rest
|
|
220
|
+
});
|
|
221
|
+
propsRef.current = {
|
|
222
|
+
id,
|
|
223
|
+
role,
|
|
224
|
+
data,
|
|
225
|
+
limit,
|
|
226
|
+
...rest
|
|
227
|
+
};
|
|
228
|
+
useEffect(() => {
|
|
229
|
+
if (!containerRef.current || elementRef.current) return;
|
|
230
|
+
const element = document.createElement(definition.tagName);
|
|
231
|
+
elementRef.current = element;
|
|
232
|
+
Object.assign(element, propsRef.current);
|
|
233
|
+
containerRef.current.appendChild(element);
|
|
234
|
+
if (typeof forwardedRef === "function") {
|
|
235
|
+
forwardedRef(element);
|
|
236
|
+
} else if (forwardedRef) {
|
|
237
|
+
forwardedRef.current = element;
|
|
238
|
+
}
|
|
239
|
+
return () => {
|
|
240
|
+
if (elementRef.current && containerRef.current?.contains(elementRef.current)) {
|
|
241
|
+
containerRef.current.removeChild(elementRef.current);
|
|
242
|
+
}
|
|
243
|
+
if (typeof forwardedRef === "function") {
|
|
244
|
+
forwardedRef(null);
|
|
245
|
+
} else if (forwardedRef) {
|
|
246
|
+
forwardedRef.current = null;
|
|
247
|
+
}
|
|
248
|
+
elementRef.current = null;
|
|
249
|
+
};
|
|
250
|
+
}, [
|
|
251
|
+
definition.tagName,
|
|
252
|
+
forwardedRef
|
|
253
|
+
]);
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
const element = elementRef.current;
|
|
256
|
+
if (!element) return;
|
|
257
|
+
Object.assign(element, propsRef.current);
|
|
258
|
+
});
|
|
259
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
260
|
+
ref: containerRef
|
|
261
|
+
});
|
|
262
|
+
}));
|
|
263
|
+
WebComponentWrapper.displayName = "WebComponentWrapper";
|
|
264
|
+
var SurfaceContextProvider = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ id, role, data, limit, fallback = DefaultFallback2, definition, ...rest }, forwardedRef) => {
|
|
265
|
+
const contextValue = useMemo(() => ({
|
|
266
|
+
id,
|
|
267
|
+
role,
|
|
268
|
+
data
|
|
269
|
+
}), [
|
|
270
|
+
id,
|
|
271
|
+
role,
|
|
272
|
+
data
|
|
273
|
+
]);
|
|
274
|
+
if (definition.kind === "web-component") {
|
|
275
|
+
return /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
276
|
+
data,
|
|
277
|
+
fallback
|
|
278
|
+
}, /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
|
|
279
|
+
value: contextValue
|
|
280
|
+
}, /* @__PURE__ */ React3.createElement(WebComponentWrapper, {
|
|
281
|
+
id,
|
|
282
|
+
role,
|
|
283
|
+
data,
|
|
284
|
+
limit,
|
|
285
|
+
definition,
|
|
286
|
+
ref: forwardedRef,
|
|
287
|
+
...rest
|
|
288
|
+
})));
|
|
289
|
+
}
|
|
290
|
+
const Component2 = definition.component;
|
|
291
|
+
const debug = DEBUG || "__DX_DEBUG__" in window;
|
|
292
|
+
if (debug) {
|
|
293
|
+
return /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
294
|
+
data,
|
|
295
|
+
fallback
|
|
296
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
297
|
+
role: "none",
|
|
298
|
+
className: "contents",
|
|
299
|
+
"data-id": id,
|
|
300
|
+
"data-role": role
|
|
301
|
+
}, /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
|
|
302
|
+
value: contextValue
|
|
303
|
+
}, /* @__PURE__ */ React3.createElement(SurfaceInfo, {
|
|
304
|
+
ref: forwardedRef
|
|
305
|
+
}, /* @__PURE__ */ React3.createElement(Component2, {
|
|
306
|
+
id,
|
|
307
|
+
role,
|
|
308
|
+
data,
|
|
309
|
+
limit,
|
|
310
|
+
...rest
|
|
311
|
+
})))));
|
|
312
|
+
}
|
|
313
|
+
return /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
314
|
+
data,
|
|
315
|
+
fallback
|
|
316
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
317
|
+
role: "none",
|
|
318
|
+
className: "contents",
|
|
319
|
+
"data-id": id,
|
|
320
|
+
"data-role": role
|
|
321
|
+
}, /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
|
|
322
|
+
value: contextValue
|
|
323
|
+
}, /* @__PURE__ */ React3.createElement(Component2, {
|
|
324
|
+
id,
|
|
325
|
+
role,
|
|
326
|
+
data,
|
|
327
|
+
limit,
|
|
328
|
+
...rest,
|
|
329
|
+
ref: forwardedRef
|
|
330
|
+
}))));
|
|
331
|
+
}));
|
|
332
|
+
SurfaceContextProvider.displayName = "SurfaceContextProvider";
|
|
333
|
+
var useSurface = () => {
|
|
334
|
+
const context = useContext3(SurfaceContext) ?? raise2(new Error("Missing SurfaceContext"));
|
|
335
|
+
return context;
|
|
336
|
+
};
|
|
337
|
+
var Surface = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ id: _id, role, data: dataProp, limit, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
|
|
338
|
+
const data = useDefaultValue(dataProp, () => ({}));
|
|
339
|
+
const surfaces = useSurfaces();
|
|
340
|
+
const definitions = findCandidates(surfaces, {
|
|
341
|
+
role,
|
|
342
|
+
data
|
|
343
|
+
});
|
|
344
|
+
const candidates = limit ? definitions.slice(0, limit) : definitions;
|
|
345
|
+
if (DEBUG && candidates.length === 0) {
|
|
346
|
+
log.warn("no candidates for surface", {
|
|
347
|
+
role,
|
|
348
|
+
data
|
|
349
|
+
}, {
|
|
350
|
+
F: __dxlog_file2,
|
|
351
|
+
L: 191,
|
|
352
|
+
S: void 0,
|
|
353
|
+
C: (f, a) => f(...a)
|
|
354
|
+
});
|
|
355
|
+
return null;
|
|
356
|
+
}
|
|
357
|
+
return /* @__PURE__ */ React3.createElement(Suspense, {
|
|
358
|
+
fallback: placeholder
|
|
359
|
+
}, candidates.map((definition) => /* @__PURE__ */ React3.createElement(SurfaceContextProvider, {
|
|
360
|
+
key: definition.id,
|
|
361
|
+
id: definition.id,
|
|
362
|
+
role,
|
|
363
|
+
data,
|
|
364
|
+
limit,
|
|
365
|
+
definition,
|
|
366
|
+
ref: forwardedRef,
|
|
367
|
+
...rest
|
|
368
|
+
})));
|
|
369
|
+
}));
|
|
370
|
+
Surface.displayName = "Surface";
|
|
371
|
+
var findCandidates = (surfaces, { role, data }) => {
|
|
372
|
+
return Object.values(surfaces).filter((definition) => Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role).filter(({ filter }) => filter ? filter(data ?? {}) : true).toSorted(byPosition);
|
|
373
|
+
};
|
|
374
|
+
var DefaultFallback2 = ({ data, error, dev }) => {
|
|
375
|
+
if (dev) {
|
|
376
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
377
|
+
className: "flex flex-col gap-4 p-4 is-full overflow-y-auto"
|
|
378
|
+
}, /* @__PURE__ */ React3.createElement("h1", {
|
|
379
|
+
className: "flex gap-2 text-sm mbs-2"
|
|
380
|
+
}, error.message), /* @__PURE__ */ React3.createElement("pre", {
|
|
381
|
+
className: "overflow-auto text-xs text-description"
|
|
382
|
+
}, JSON.stringify(data, null, 2)));
|
|
383
|
+
}
|
|
384
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
385
|
+
className: "flex flex-col gap-4 p-4 is-full overflow-y-auto border border-roseFill"
|
|
386
|
+
}, /* @__PURE__ */ React3.createElement("h1", {
|
|
387
|
+
className: "flex gap-2 text-sm mbs-2 text-rose-500"
|
|
388
|
+
}, error.message), /* @__PURE__ */ React3.createElement("pre", {
|
|
389
|
+
className: "overflow-auto text-xs text-description"
|
|
390
|
+
}, error.stack), /* @__PURE__ */ React3.createElement("pre", {
|
|
391
|
+
className: "overflow-auto text-xs text-description"
|
|
392
|
+
}, JSON.stringify(data, null, 2)));
|
|
393
|
+
};
|
|
394
|
+
var useSurfaces = () => {
|
|
395
|
+
const surfaces = useCapabilities(Capability.ReactSurface);
|
|
396
|
+
return useMemo(() => surfaces.flat(), [
|
|
397
|
+
surfaces
|
|
398
|
+
]);
|
|
399
|
+
};
|
|
400
|
+
var isSurfaceAvailable = (capabilityManager, { role, data }) => {
|
|
401
|
+
const surfaces = capabilityManager.getAll(Capability.ReactSurface);
|
|
402
|
+
const candidates = findCandidates(surfaces.flat(), {
|
|
403
|
+
role,
|
|
404
|
+
data
|
|
405
|
+
});
|
|
406
|
+
return candidates.length > 0;
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
// src/react/useApp.tsx
|
|
410
|
+
import { RegistryContext as RegistryContext2 } from "@effect-atom/atom-react";
|
|
411
|
+
import * as Effect from "effect/Effect";
|
|
412
|
+
import * as Fiber from "effect/Fiber";
|
|
413
|
+
import * as PubSub from "effect/PubSub";
|
|
414
|
+
import * as Queue from "effect/Queue";
|
|
415
|
+
import React6, { useCallback as useCallback4, useEffect as useEffect3, useMemo as useMemo2, useRef as useRef2, useState as useState3 } from "react";
|
|
416
|
+
import { runAndForwardErrors } from "@dxos/effect";
|
|
417
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
418
|
+
import { log as log2 } from "@dxos/log";
|
|
419
|
+
import { useAsyncEffect, useDefaultValue as useDefaultValue2 } from "@dxos/react-hooks";
|
|
420
|
+
import { ContextProtocolProvider } from "@dxos/web-context-react";
|
|
421
|
+
|
|
422
|
+
// src/react/App.tsx
|
|
423
|
+
import React4 from "react";
|
|
424
|
+
|
|
425
|
+
// src/helpers.ts
|
|
426
|
+
var topologicalSort = (nodes) => {
|
|
427
|
+
const getDependencies = (nodeId, seen = /* @__PURE__ */ new Set(), path = /* @__PURE__ */ new Set()) => {
|
|
428
|
+
if (path.has(nodeId)) {
|
|
429
|
+
throw new Error(`Circular dependency detected involving ${nodeId}`);
|
|
430
|
+
}
|
|
431
|
+
if (seen.has(nodeId)) {
|
|
432
|
+
return [];
|
|
433
|
+
}
|
|
434
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
435
|
+
if (!node) {
|
|
436
|
+
throw new Error(`Node ${nodeId} not found but is listed as a dependency`);
|
|
437
|
+
}
|
|
438
|
+
const newPath = /* @__PURE__ */ new Set([
|
|
439
|
+
...path,
|
|
440
|
+
nodeId
|
|
441
|
+
]);
|
|
442
|
+
const newSeen = /* @__PURE__ */ new Set([
|
|
443
|
+
...seen,
|
|
444
|
+
nodeId
|
|
445
|
+
]);
|
|
446
|
+
const dependsOn = node.dependsOn ?? [];
|
|
447
|
+
return [
|
|
448
|
+
...dependsOn.flatMap((depId) => getDependencies(depId, newSeen, newPath)),
|
|
449
|
+
nodeId
|
|
450
|
+
];
|
|
451
|
+
};
|
|
452
|
+
const allDependencies = nodes.map((node) => node.id).flatMap((id) => getDependencies(id)).filter((id, index, self) => self.indexOf(id) === index);
|
|
453
|
+
return allDependencies.map((id) => nodes.find((node) => node.id === id)).filter((node) => node !== void 0);
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
// src/react/useLoading.tsx
|
|
457
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
458
|
+
var LoadingState = /* @__PURE__ */ (function(LoadingState2) {
|
|
459
|
+
LoadingState2[LoadingState2["Loading"] = 0] = "Loading";
|
|
460
|
+
LoadingState2[LoadingState2["FadeIn"] = 1] = "FadeIn";
|
|
461
|
+
LoadingState2[LoadingState2["FadeOut"] = 2] = "FadeOut";
|
|
462
|
+
LoadingState2[LoadingState2["Done"] = 3] = "Done";
|
|
463
|
+
return LoadingState2;
|
|
464
|
+
})({});
|
|
465
|
+
var useLoading = (ready, debounce = 0) => {
|
|
466
|
+
const [stage, setStage] = useState2(0);
|
|
467
|
+
useEffect2(() => {
|
|
468
|
+
if (!debounce) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
const i = setInterval(() => {
|
|
472
|
+
setStage((stage2) => {
|
|
473
|
+
switch (stage2) {
|
|
474
|
+
case 0: {
|
|
475
|
+
if (!ready) {
|
|
476
|
+
return 1;
|
|
477
|
+
} else {
|
|
478
|
+
clearInterval(i);
|
|
479
|
+
return 3;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
case 1: {
|
|
483
|
+
if (ready) {
|
|
484
|
+
return 2;
|
|
485
|
+
}
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
case 2: {
|
|
489
|
+
clearInterval(i);
|
|
490
|
+
return 3;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
return stage2;
|
|
494
|
+
});
|
|
495
|
+
}, debounce);
|
|
496
|
+
return () => clearInterval(i);
|
|
497
|
+
}, [
|
|
498
|
+
debounce
|
|
499
|
+
]);
|
|
500
|
+
if (!debounce) {
|
|
501
|
+
return ready ? 3 : 0;
|
|
502
|
+
}
|
|
503
|
+
return stage;
|
|
504
|
+
};
|
|
505
|
+
|
|
506
|
+
// src/react/App.tsx
|
|
507
|
+
var App = ({ placeholder: Placeholder, ready, error, debounce }) => {
|
|
508
|
+
const reactContexts = useCapabilities(Capability.ReactContext);
|
|
509
|
+
const reactRoots = useCapabilities(Capability.ReactRoot);
|
|
510
|
+
const stage = useLoading(ready, debounce);
|
|
511
|
+
if (error) {
|
|
512
|
+
throw error;
|
|
513
|
+
}
|
|
514
|
+
if (stage < LoadingState.Done) {
|
|
515
|
+
if (!Placeholder) {
|
|
516
|
+
return null;
|
|
517
|
+
}
|
|
518
|
+
return /* @__PURE__ */ React4.createElement(Placeholder, {
|
|
519
|
+
stage
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
const ComposedContext = composeContexts(reactContexts);
|
|
523
|
+
return /* @__PURE__ */ React4.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component2 }) => /* @__PURE__ */ React4.createElement(Component2, {
|
|
524
|
+
key: id
|
|
525
|
+
})));
|
|
526
|
+
};
|
|
527
|
+
var composeContexts = (contexts) => {
|
|
528
|
+
if (contexts.length === 0) {
|
|
529
|
+
return ({ children }) => /* @__PURE__ */ React4.createElement(React4.Fragment, null, children);
|
|
530
|
+
}
|
|
531
|
+
return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React4.createElement(Acc, null, /* @__PURE__ */ React4.createElement(Next, null, children)));
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
// src/react/DefaultFallback.tsx
|
|
535
|
+
import React5 from "react";
|
|
536
|
+
var DefaultFallback3 = ({ error }) => {
|
|
537
|
+
return /* @__PURE__ */ React5.createElement("div", {
|
|
538
|
+
style: {
|
|
539
|
+
margin: "1rem",
|
|
540
|
+
padding: "1rem",
|
|
541
|
+
overflow: "hidden",
|
|
542
|
+
border: "4px solid teal",
|
|
543
|
+
borderRadius: "1rem"
|
|
544
|
+
}
|
|
545
|
+
}, /* @__PURE__ */ React5.createElement("h1", {
|
|
546
|
+
style: {
|
|
547
|
+
margin: "0.5rem 0",
|
|
548
|
+
fontSize: "1.2rem"
|
|
549
|
+
}
|
|
550
|
+
}, "ERROR: ", error.message), /* @__PURE__ */ React5.createElement("pre", {
|
|
551
|
+
style: {
|
|
552
|
+
overflow: "auto",
|
|
553
|
+
fontSize: "1rem",
|
|
554
|
+
whiteSpace: "pre-wrap",
|
|
555
|
+
color: "#888888"
|
|
556
|
+
}
|
|
557
|
+
}, error.stack));
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
// src/react/useApp.tsx
|
|
561
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/sdk/app-framework/src/react/useApp.tsx";
|
|
562
|
+
var ENABLED_KEY = "dxos.org/app-framework/enabled";
|
|
563
|
+
var useApp = ({ pluginManager, pluginLoader: pluginLoaderProp, plugins: pluginsProp, core: coreProp, defaults: defaultsProp, placeholder, fallback = DefaultFallback3, cacheEnabled = false, safeMode = false, debounce = 0, timeout = 3e4 }) => {
|
|
564
|
+
const plugins = useDefaultValue2(pluginsProp, () => []);
|
|
565
|
+
const core = useDefaultValue2(coreProp, () => plugins.map(({ meta }) => meta.id));
|
|
566
|
+
const defaults = useDefaultValue2(defaultsProp, () => []);
|
|
567
|
+
const pluginLoader = useMemo2(() => pluginLoaderProp ?? ((id) => Effect.sync(() => {
|
|
568
|
+
const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
|
|
569
|
+
invariant2(plugin, `Plugin not found: ${id}`, {
|
|
570
|
+
F: __dxlog_file3,
|
|
571
|
+
L: 92,
|
|
572
|
+
S: void 0,
|
|
573
|
+
A: [
|
|
574
|
+
"plugin",
|
|
575
|
+
"`Plugin not found: ${id}`"
|
|
576
|
+
]
|
|
577
|
+
});
|
|
578
|
+
return plugin;
|
|
579
|
+
})), [
|
|
580
|
+
pluginLoaderProp,
|
|
581
|
+
plugins
|
|
582
|
+
]);
|
|
583
|
+
const readyRef = useRef2(false);
|
|
584
|
+
const [ready, setReady] = useState3(false);
|
|
585
|
+
const errorRef = useRef2(null);
|
|
586
|
+
const [error, setError] = useState3(null);
|
|
587
|
+
const cached = useMemo2(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? "[]"), []);
|
|
588
|
+
const enabled = useMemo2(() => safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults, [
|
|
589
|
+
safeMode,
|
|
590
|
+
cacheEnabled,
|
|
591
|
+
cached,
|
|
592
|
+
defaults
|
|
593
|
+
]);
|
|
594
|
+
const manager = useMemo2(() => pluginManager ?? plugin_manager_exports.make({
|
|
595
|
+
pluginLoader,
|
|
596
|
+
plugins,
|
|
597
|
+
core,
|
|
598
|
+
enabled
|
|
599
|
+
}), [
|
|
600
|
+
pluginManager,
|
|
601
|
+
pluginLoader,
|
|
602
|
+
plugins,
|
|
603
|
+
core,
|
|
604
|
+
enabled
|
|
605
|
+
]);
|
|
606
|
+
useEffect3(() => {
|
|
607
|
+
if (!cacheEnabled) {
|
|
608
|
+
return;
|
|
609
|
+
}
|
|
610
|
+
return manager.registry.subscribe(manager.enabled, (value) => {
|
|
611
|
+
localStorage.setItem(ENABLED_KEY, JSON.stringify(value));
|
|
612
|
+
});
|
|
613
|
+
}, [
|
|
614
|
+
cacheEnabled,
|
|
615
|
+
manager
|
|
616
|
+
]);
|
|
617
|
+
useEffect3(() => {
|
|
618
|
+
setupDevtools(manager);
|
|
619
|
+
}, [
|
|
620
|
+
manager
|
|
621
|
+
]);
|
|
622
|
+
useAsyncEffect(async () => {
|
|
623
|
+
manager.capabilities.contribute({
|
|
624
|
+
interface: Capability.PluginManager,
|
|
625
|
+
implementation: manager,
|
|
626
|
+
module: "dxos.org/app-framework/plugin-manager"
|
|
627
|
+
});
|
|
628
|
+
manager.capabilities.contribute({
|
|
629
|
+
interface: Capability.AtomRegistry,
|
|
630
|
+
implementation: manager.registry,
|
|
631
|
+
module: "dxos.org/app-framework/atom-registry"
|
|
632
|
+
});
|
|
633
|
+
const fiber = Effect.gen(function* () {
|
|
634
|
+
const queue = yield* PubSub.subscribe(manager.activation);
|
|
635
|
+
const listener = yield* Effect.forkDaemon(Queue.take(queue).pipe(Effect.tap(({ event, state, error: error$ }) => Effect.sync(() => {
|
|
636
|
+
if (event === ActivationEvent.Startup.id && state === "activated") {
|
|
637
|
+
clearTimeout(timeoutId);
|
|
638
|
+
setReady(true);
|
|
639
|
+
readyRef.current = true;
|
|
640
|
+
}
|
|
641
|
+
if (error$ && !readyRef.current) {
|
|
642
|
+
setError(error$);
|
|
643
|
+
errorRef.current = error$;
|
|
644
|
+
}
|
|
645
|
+
})), Effect.forever));
|
|
646
|
+
yield* Effect.all([
|
|
647
|
+
manager.activate(ActivationEvent.SetupSettings),
|
|
648
|
+
manager.activate(ActivationEvent.SetupReactSurface),
|
|
649
|
+
manager.activate(ActivationEvent.Startup)
|
|
650
|
+
]);
|
|
651
|
+
return yield* Fiber.join(listener);
|
|
652
|
+
}).pipe(Effect.scoped, Effect.runFork);
|
|
653
|
+
const timeoutId = setTimeout(() => {
|
|
654
|
+
if (!readyRef.current && !errorRef.current) {
|
|
655
|
+
log2.warn("startup timeout diagnostic", {
|
|
656
|
+
eventsFired: manager.getEventsFired(),
|
|
657
|
+
activeModules: manager.getActive(),
|
|
658
|
+
pendingReset: manager.getPendingReset()
|
|
659
|
+
}, {
|
|
660
|
+
F: __dxlog_file3,
|
|
661
|
+
L: 172,
|
|
662
|
+
S: void 0,
|
|
663
|
+
C: (f, a) => f(...a)
|
|
664
|
+
});
|
|
665
|
+
void runAndForwardErrors(Fiber.interrupt(fiber));
|
|
666
|
+
setError(new Error(`Startup timed out after ${timeout}ms`));
|
|
667
|
+
}
|
|
668
|
+
}, timeout);
|
|
669
|
+
return () => {
|
|
670
|
+
clearTimeout(timeoutId);
|
|
671
|
+
void runAndForwardErrors(Fiber.interrupt(fiber));
|
|
672
|
+
manager.capabilities.remove(Capability.PluginManager, manager);
|
|
673
|
+
manager.capabilities.remove(Capability.AtomRegistry, manager.registry);
|
|
674
|
+
};
|
|
675
|
+
}, [
|
|
676
|
+
manager
|
|
677
|
+
]);
|
|
678
|
+
return useCallback4(() => /* @__PURE__ */ React6.createElement(ErrorBoundary, {
|
|
679
|
+
fallback
|
|
680
|
+
}, /* @__PURE__ */ React6.createElement(PluginManagerProvider, {
|
|
681
|
+
value: manager
|
|
682
|
+
}, /* @__PURE__ */ React6.createElement(ContextProtocolProvider, {
|
|
683
|
+
value: manager,
|
|
684
|
+
context: PluginManagerContext
|
|
685
|
+
}, /* @__PURE__ */ React6.createElement(RegistryContext2.Provider, {
|
|
686
|
+
value: manager.registry
|
|
687
|
+
}, /* @__PURE__ */ React6.createElement(App, {
|
|
688
|
+
placeholder,
|
|
689
|
+
ready,
|
|
690
|
+
error,
|
|
691
|
+
debounce
|
|
692
|
+
}))))), [
|
|
693
|
+
fallback,
|
|
694
|
+
manager,
|
|
695
|
+
placeholder,
|
|
696
|
+
ready,
|
|
697
|
+
error
|
|
698
|
+
]);
|
|
699
|
+
};
|
|
700
|
+
var setupDevtools = (manager) => {
|
|
701
|
+
globalThis.composer ??= {};
|
|
702
|
+
globalThis.composer.manager = manager;
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
// src/react/useOperationResolver.ts
|
|
706
|
+
import { useEffect as useEffect4, useMemo as useMemo3 } from "react";
|
|
707
|
+
var useOperationResolver = (module, resolver) => {
|
|
708
|
+
const manager = usePluginManager();
|
|
709
|
+
const resolverArray = useMemo3(() => [
|
|
710
|
+
resolver
|
|
711
|
+
], [
|
|
712
|
+
resolver
|
|
713
|
+
]);
|
|
714
|
+
useEffect4(() => {
|
|
715
|
+
manager.capabilities.contribute({
|
|
716
|
+
module,
|
|
717
|
+
interface: Capability.OperationResolver,
|
|
718
|
+
implementation: resolverArray
|
|
719
|
+
});
|
|
720
|
+
return () => manager.capabilities.remove(Capability.OperationResolver, resolverArray);
|
|
721
|
+
}, [
|
|
722
|
+
module,
|
|
723
|
+
resolverArray
|
|
724
|
+
]);
|
|
725
|
+
};
|
|
726
|
+
|
|
727
|
+
export {
|
|
728
|
+
usePluginManager,
|
|
729
|
+
PluginManagerProvider,
|
|
730
|
+
useCapabilities,
|
|
731
|
+
useCapability,
|
|
732
|
+
useAtomCapability,
|
|
733
|
+
useAtomCapabilityState,
|
|
734
|
+
useOperationInvoker,
|
|
735
|
+
useAppGraph,
|
|
736
|
+
useLayout,
|
|
737
|
+
useSettingsState,
|
|
738
|
+
ErrorBoundary,
|
|
739
|
+
useSurface,
|
|
740
|
+
Surface,
|
|
741
|
+
useSurfaces,
|
|
742
|
+
isSurfaceAvailable,
|
|
743
|
+
useApp,
|
|
744
|
+
useOperationResolver
|
|
745
|
+
};
|
|
746
|
+
//# sourceMappingURL=chunk-XYNO72GQ.mjs.map
|