@dxos/app-framework 0.8.4-main.406dc2a → 0.8.4-main.422d1c7879
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 +2 -4
- package/.storybook/preview.mts +2 -2
- package/dist/lib/browser/capability-DOMNPRJP.mjs +35 -0
- package/dist/lib/browser/capability-DOMNPRJP.mjs.map +7 -0
- package/dist/lib/browser/capability-KSNT34SN.mjs +38 -0
- package/dist/lib/browser/capability-KSNT34SN.mjs.map +7 -0
- package/dist/lib/browser/chunk-2CKCJ6PN.mjs +79 -0
- package/dist/lib/browser/chunk-2CKCJ6PN.mjs.map +7 -0
- package/dist/lib/browser/chunk-7B6AJK4D.mjs +964 -0
- package/dist/lib/browser/chunk-7B6AJK4D.mjs.map +7 -0
- package/dist/lib/browser/chunk-BMIAYUWT.mjs +397 -0
- package/dist/lib/browser/chunk-BMIAYUWT.mjs.map +7 -0
- package/dist/lib/browser/chunk-F7FW2RK2.mjs +167 -0
- package/dist/lib/browser/chunk-F7FW2RK2.mjs.map +7 -0
- package/dist/lib/browser/chunk-GDWTW4ZW.mjs +148 -0
- package/dist/lib/browser/chunk-GDWTW4ZW.mjs.map +7 -0
- package/dist/lib/browser/chunk-I34GF4NG.mjs +34 -0
- package/dist/lib/browser/chunk-I34GF4NG.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-JKWMHZP6.mjs +80 -0
- package/dist/lib/browser/chunk-JKWMHZP6.mjs.map +7 -0
- package/dist/lib/browser/chunk-QRTB4Q3U.mjs +594 -0
- package/dist/lib/browser/chunk-QRTB4Q3U.mjs.map +7 -0
- package/dist/lib/browser/chunk-QSXYHXCE.mjs +48 -0
- package/dist/lib/browser/chunk-QSXYHXCE.mjs.map +7 -0
- package/dist/lib/browser/chunk-RFSO3JRG.mjs +1 -0
- package/dist/lib/browser/chunk-T3Y4AEKX.mjs +42 -0
- package/dist/lib/browser/chunk-T3Y4AEKX.mjs.map +7 -0
- package/dist/lib/browser/chunk-TGX63LTL.mjs +8 -0
- package/dist/lib/browser/chunk-TGX63LTL.mjs.map +7 -0
- package/dist/lib/browser/chunk-Y543KCO7.mjs +174 -0
- package/dist/lib/browser/chunk-Y543KCO7.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +90 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/common/activation-events.mjs +24 -0
- package/dist/lib/browser/common/capabilities.mjs +46 -0
- package/dist/lib/browser/core/activation-event.mjs +20 -0
- package/dist/lib/browser/core/activation-event.mjs.map +7 -0
- package/dist/lib/browser/core/capability.mjs +30 -0
- package/dist/lib/browser/core/capability.mjs.map +7 -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 +29 -0
- package/dist/lib/browser/core/plugin.mjs.map +7 -0
- package/dist/lib/browser/core/url-loader.mjs +16 -0
- package/dist/lib/browser/core/url-loader.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +91 -148
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/invoker-capability-VCMPQOIA.mjs +43 -0
- package/dist/lib/browser/invoker-capability-VCMPQOIA.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +243 -41
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/testing/react.mjs +78 -0
- package/dist/lib/browser/testing/react.mjs.map +7 -0
- package/dist/lib/browser/ui/index.mjs +46 -0
- package/dist/lib/browser/ui/index.mjs.map +7 -0
- package/dist/lib/node-esm/capability-EOQTORML.mjs +39 -0
- package/dist/lib/node-esm/capability-EOQTORML.mjs.map +7 -0
- package/dist/lib/node-esm/capability-KJTQIWDK.mjs +36 -0
- package/dist/lib/node-esm/capability-KJTQIWDK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-42KBWDE4.mjs +80 -0
- package/dist/lib/node-esm/chunk-42KBWDE4.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7PJ5OKRB.mjs +965 -0
- package/dist/lib/node-esm/chunk-7PJ5OKRB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DXVXOGJ7.mjs +175 -0
- package/dist/lib/node-esm/chunk-DXVXOGJ7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EL3R25OQ.mjs +2 -0
- package/dist/lib/node-esm/chunk-EL3R25OQ.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FKE4Z3D6.mjs +10 -0
- package/dist/lib/node-esm/chunk-FKE4Z3D6.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-G3RTFSNG.mjs +81 -0
- package/dist/lib/node-esm/chunk-G3RTFSNG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HI3YBICQ.mjs +149 -0
- package/dist/lib/node-esm/chunk-HI3YBICQ.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-JPWVIQ5I.mjs +595 -0
- package/dist/lib/node-esm/chunk-JPWVIQ5I.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-URWHJQT2.mjs +168 -0
- package/dist/lib/node-esm/chunk-URWHJQT2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-VKHGNEDB.mjs +43 -0
- package/dist/lib/node-esm/chunk-VKHGNEDB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WZ6DHQER.mjs +398 -0
- package/dist/lib/node-esm/chunk-WZ6DHQER.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WZCSOX5Q.mjs +35 -0
- package/dist/lib/node-esm/chunk-WZCSOX5Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-ZZ7CKK6W.mjs +49 -0
- package/dist/lib/node-esm/chunk-ZZ7CKK6W.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +91 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/common/activation-events.mjs +25 -0
- package/dist/lib/node-esm/common/activation-events.mjs.map +7 -0
- package/dist/lib/node-esm/common/capabilities.mjs +47 -0
- package/dist/lib/node-esm/common/capabilities.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 +31 -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 +30 -0
- package/dist/lib/node-esm/core/plugin.mjs.map +7 -0
- package/dist/lib/node-esm/core/url-loader.mjs +17 -0
- package/dist/lib/node-esm/core/url-loader.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +91 -148
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/invoker-capability-EGA3XW6J.mjs +44 -0
- package/dist/lib/node-esm/invoker-capability-EGA3XW6J.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +243 -41
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/testing/react.mjs +79 -0
- package/dist/lib/node-esm/testing/react.mjs.map +7 -0
- package/dist/lib/node-esm/ui/index.mjs +47 -0
- package/dist/lib/node-esm/ui/index.mjs.map +7 -0
- package/dist/plugin/node-esm/index.mjs +794 -0
- package/dist/plugin/node-esm/index.mjs.map +7 -0
- package/dist/plugin/node-esm/meta.json +1 -0
- package/dist/types/src/cli/cli.d.ts +39 -0
- package/dist/types/src/cli/cli.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/common/activation-events.d.ts +27 -0
- package/dist/types/src/common/activation-events.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +109 -200
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/index.d.ts +4 -8
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +19 -0
- package/dist/types/src/common/operations.d.ts.map +1 -0
- package/dist/types/src/common/translations.d.ts +7 -7
- 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} +7 -7
- package/dist/types/src/core/activation-event.d.ts.map +1 -0
- package/dist/types/src/core/capability-manager.d.ts +48 -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 +156 -0
- package/dist/types/src/core/capability.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +6 -4
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manager.d.ts +78 -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 +127 -39
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/url-loader.d.ts +42 -0
- package/dist/types/src/core/url-loader.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.test.d.ts +2 -0
- package/dist/types/src/core/url-loader.test.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +3 -4
- package/dist/types/src/index.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 +32 -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 +101 -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 +58 -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/testing/harness.d.ts +67 -0
- package/dist/types/src/testing/harness.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 -1
- package/dist/types/src/testing/react.d.ts +27 -0
- package/dist/types/src/testing/react.d.ts.map +1 -0
- package/dist/types/src/testing/react.test.d.ts +2 -0
- package/dist/types/src/testing/react.test.d.ts.map +1 -0
- 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 +7 -6
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/App.d.ts +9 -0
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/App.stories.d.ts +19 -0
- package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/index.d.ts +2 -0
- package/dist/types/src/ui/components/App/index.d.ts.map +1 -0
- package/dist/types/src/{playground/playground.stories.d.ts → ui/components/PluginManager/PluginManagerContext.stories.d.ts} +5 -3
- package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts +10 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerProvider.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/index.d.ts +2 -0
- package/dist/types/src/ui/components/PluginManager/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +24 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
- package/dist/types/src/{components/App.stories.d.ts → ui/components/Surface/SurfaceComponent.stories.d.ts} +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts +11 -0
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts +48 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/context.d.ts +5 -0
- package/dist/types/src/ui/components/Surface/context.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/index.d.ts +36 -0
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/types.d.ts +197 -0
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
- package/dist/types/src/ui/components/index.d.ts +4 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/index.d.ts +6 -0
- package/dist/types/src/ui/hooks/index.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useApp.d.ts +62 -0
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useApp.test.d.ts +2 -0
- package/dist/types/src/ui/hooks/useApp.test.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useCapabilities.d.ts +31 -0
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/{components → ui/hooks}/useLoading.d.ts +1 -2
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSettingsState.d.ts +10 -0
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useSurface.d.ts +3 -0
- package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -0
- package/dist/types/src/ui/index.d.ts +3 -0
- package/dist/types/src/ui/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +50 -0
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts +51 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts +16 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/index.d.ts +5 -0
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.d.ts +16 -0
- package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/packages.d.ts +13 -0
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +25 -6
- package/package.json +110 -55
- package/src/cli/cli.ts +107 -0
- package/src/{components → cli}/index.ts +1 -1
- package/src/common/activation-events.ts +44 -0
- package/src/common/capabilities.ts +168 -213
- package/src/common/index.ts +4 -8
- package/src/common/operations.ts +35 -0
- package/src/common/translations.ts +17 -9
- package/src/context.ts +9 -0
- package/src/core/{events.ts → activation-event.ts} +10 -7
- package/src/core/capability-manager.test.ts +151 -0
- package/src/core/capability-manager.ts +192 -0
- package/src/core/capability.ts +247 -0
- package/src/core/index.ts +6 -4
- package/src/core/plugin-manager.test.ts +1142 -0
- package/src/core/plugin-manager.ts +893 -0
- package/src/core/plugin.ts +263 -46
- package/src/core/url-loader.test.ts +112 -0
- package/src/core/url-loader.ts +178 -0
- package/src/index.ts +3 -4
- package/src/plugin-operation/OperationPlugin.ts +24 -0
- package/src/plugin-operation/history/capability.ts +36 -0
- package/src/plugin-operation/history/errors.ts +7 -0
- package/src/plugin-operation/history/history-tracker.test.ts +373 -0
- package/src/plugin-operation/history/history-tracker.ts +128 -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 +135 -0
- package/src/plugin-operation/history/undo-registry.test.ts +72 -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 +54 -0
- package/src/plugin-operation/meta.ts +11 -0
- package/src/plugin-operation/testing.ts +154 -0
- package/src/plugin-runtime/RuntimePlugin.ts +19 -0
- package/src/plugin-runtime/capability.ts +53 -0
- package/src/{playground/logger → plugin-runtime}/index.ts +1 -1
- package/src/plugin-runtime/meta.ts +11 -0
- package/src/testing/harness.ts +229 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/react.test.tsx +48 -0
- package/src/testing/react.tsx +113 -0
- package/src/testing/service.ts +52 -0
- package/src/testing/withPluginManager.stories.tsx +7 -8
- package/src/testing/withPluginManager.tsx +68 -40
- package/src/ui/components/App/App.stories.tsx +92 -0
- package/src/ui/components/App/App.tsx +70 -0
- package/src/{playground/debug → ui/components/App}/index.ts +1 -1
- package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +183 -0
- package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +3 -3
- package/src/ui/components/PluginManager/index.ts +5 -0
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +144 -0
- package/src/ui/components/Surface/SurfaceComponent.tsx +303 -0
- package/src/ui/components/Surface/SurfaceInfo.tsx +107 -0
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -0
- package/src/ui/components/Surface/context.ts +12 -0
- package/src/ui/components/Surface/index.ts +54 -0
- package/src/ui/components/Surface/types.test.ts +126 -0
- package/src/ui/components/Surface/types.ts +269 -0
- package/src/ui/components/index.ts +7 -0
- package/src/ui/hooks/index.ts +9 -0
- package/src/ui/hooks/useApp.test.tsx +159 -0
- package/src/ui/hooks/useApp.tsx +289 -0
- package/src/ui/hooks/useCapabilities.ts +67 -0
- package/src/{components → ui/hooks}/useLoading.tsx +4 -6
- package/src/ui/hooks/useSettingsState.ts +26 -0
- package/src/ui/hooks/useSurface.ts +13 -0
- package/src/ui/index.ts +6 -0
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +162 -0
- package/src/vite-plugin/boot-loader/boot-loader.css +117 -0
- package/src/vite-plugin/boot-loader/boot-loader.js +55 -0
- package/src/vite-plugin/boot-loader/index.ts +99 -0
- package/src/vite-plugin/composer/index.ts +284 -0
- package/src/vite-plugin/import-map/index.ts +490 -0
- package/src/vite-plugin/index.ts +10 -0
- package/src/vite-plugin/manifest.test.ts +23 -0
- package/src/vite-plugin/manifest.ts +20 -0
- package/src/vite-plugin/packages.ts +181 -0
- package/tsconfig.json +13 -19
- package/tsconfig.node.json +2 -4
- package/typedoc.json +2 -4
- package/vitest.config.ts +1 -1
- package/.swc/plugins/linux_x86_64_19.0.0/fce1bdb8e20a094e4af08bad09cc81497ed0e2e7c51223b07d371063cca18429.wasmer-v7 +0 -0
- package/dist/lib/browser/app-graph-builder-LG4RG2LM.mjs +0 -138
- package/dist/lib/browser/app-graph-builder-LG4RG2LM.mjs.map +0 -7
- package/dist/lib/browser/chunk-2GRQ4QXA.mjs +0 -1646
- package/dist/lib/browser/chunk-2GRQ4QXA.mjs.map +0 -7
- package/dist/lib/browser/chunk-FRUTKCPG.mjs +0 -467
- package/dist/lib/browser/chunk-FRUTKCPG.mjs.map +0 -7
- package/dist/lib/browser/chunk-SCPE4ZO2.mjs +0 -35
- package/dist/lib/browser/chunk-SCPE4ZO2.mjs.map +0 -7
- package/dist/lib/browser/intent-dispatcher-6SHA5B3N.mjs +0 -11
- package/dist/lib/browser/intent-resolver-UZZ4OANZ.mjs +0 -39
- package/dist/lib/browser/intent-resolver-UZZ4OANZ.mjs.map +0 -7
- package/dist/lib/browser/store-ACBEYK4B.mjs +0 -30
- package/dist/lib/browser/store-ACBEYK4B.mjs.map +0 -7
- package/dist/lib/browser/worker.mjs +0 -77
- package/dist/lib/node-esm/app-graph-builder-FMHVHPWA.mjs +0 -139
- package/dist/lib/node-esm/app-graph-builder-FMHVHPWA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CXT6CYPE.mjs +0 -468
- package/dist/lib/node-esm/chunk-CXT6CYPE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KSPOOYT3.mjs +0 -1648
- package/dist/lib/node-esm/chunk-KSPOOYT3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ZX63QUGE.mjs +0 -37
- package/dist/lib/node-esm/chunk-ZX63QUGE.mjs.map +0 -7
- package/dist/lib/node-esm/intent-dispatcher-SIYQ5ZIU.mjs +0 -12
- package/dist/lib/node-esm/intent-resolver-7FYJMXAG.mjs +0 -40
- package/dist/lib/node-esm/intent-resolver-7FYJMXAG.mjs.map +0 -7
- package/dist/lib/node-esm/store-6OBLTVXC.mjs +0 -31
- package/dist/lib/node-esm/store-6OBLTVXC.mjs.map +0 -7
- package/dist/lib/node-esm/worker.mjs +0 -78
- package/dist/types/src/common/collaboration.d.ts +0 -20
- package/dist/types/src/common/collaboration.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/file.d.ts +0 -14
- package/dist/types/src/common/file.d.ts.map +0 -1
- package/dist/types/src/common/graph.d.ts +0 -21
- package/dist/types/src/common/graph.d.ts.map +0 -1
- package/dist/types/src/common/layout.d.ts +0 -279
- package/dist/types/src/common/layout.d.ts.map +0 -1
- package/dist/types/src/common/surface.d.ts +0 -59
- package/dist/types/src/common/surface.d.ts.map +0 -1
- package/dist/types/src/components/App.d.ts +0 -10
- package/dist/types/src/components/App.d.ts.map +0 -1
- package/dist/types/src/components/App.stories.d.ts.map +0 -1
- package/dist/types/src/components/DefaultFallback.d.ts +0 -8
- package/dist/types/src/components/DefaultFallback.d.ts.map +0 -1
- package/dist/types/src/components/index.d.ts +0 -2
- package/dist/types/src/components/index.d.ts.map +0 -1
- package/dist/types/src/components/useApp.d.ts +0 -44
- package/dist/types/src/components/useApp.d.ts.map +0 -1
- package/dist/types/src/components/useLoading.d.ts.map +0 -1
- package/dist/types/src/core/capabilities.d.ts +0 -117
- 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 -126
- 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/playground/debug/Debug.d.ts +0 -6
- package/dist/types/src/playground/debug/Debug.d.ts.map +0 -1
- package/dist/types/src/playground/debug/index.d.ts +0 -2
- package/dist/types/src/playground/debug/index.d.ts.map +0 -1
- package/dist/types/src/playground/debug/plugin.d.ts +0 -2
- package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Main.d.ts +0 -6
- package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +0 -6
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/generator/generator.d.ts +0 -7
- package/dist/types/src/playground/generator/generator.d.ts.map +0 -1
- package/dist/types/src/playground/generator/index.d.ts +0 -3
- package/dist/types/src/playground/generator/index.d.ts.map +0 -1
- package/dist/types/src/playground/generator/plugin.d.ts +0 -2
- package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/layout/Layout.d.ts +0 -8
- package/dist/types/src/playground/layout/Layout.d.ts.map +0 -1
- package/dist/types/src/playground/layout/index.d.ts +0 -2
- package/dist/types/src/playground/layout/index.d.ts.map +0 -1
- package/dist/types/src/playground/layout/plugin.d.ts +0 -2
- package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +0 -6
- package/dist/types/src/playground/logger/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/logger/index.d.ts +0 -2
- package/dist/types/src/playground/logger/index.d.ts.map +0 -1
- package/dist/types/src/playground/logger/plugin.d.ts +0 -2
- package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/schema.d.ts +0 -13
- package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
- package/dist/types/src/playground/playground.stories.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 -36
- 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 -6
- 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-intent/meta.d.ts +0 -3
- package/dist/types/src/plugin-intent/meta.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -2
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/actions.d.ts +0 -25
- package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -4
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/index.d.ts +0 -3
- package/dist/types/src/plugin-settings/index.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/meta.d.ts +0 -3
- package/dist/types/src/plugin-settings/meta.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/plugin-settings/translations.d.ts +0 -11
- package/dist/types/src/plugin-settings/translations.d.ts.map +0 -1
- package/dist/types/src/react/ErrorBoundary.d.ts +0 -30
- package/dist/types/src/react/ErrorBoundary.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/PluginManagerProvider.d.ts +0 -10
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
- package/dist/types/src/react/Surface.d.ts +0 -12
- package/dist/types/src/react/Surface.d.ts.map +0 -1
- package/dist/types/src/react/Surface.stories.d.ts +0 -17
- package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
- package/dist/types/src/react/common.d.ts +0 -13
- package/dist/types/src/react/common.d.ts.map +0 -1
- package/dist/types/src/react/index.d.ts +0 -7
- package/dist/types/src/react/index.d.ts.map +0 -1
- package/dist/types/src/react/useCapabilities.d.ts +0 -13
- package/dist/types/src/react/useCapabilities.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/common/collaboration.ts +0 -18
- package/src/common/events.ts +0 -79
- package/src/common/file.ts +0 -22
- package/src/common/graph.ts +0 -30
- package/src/common/layout.ts +0 -277
- package/src/common/surface.ts +0 -83
- package/src/components/App.stories.tsx +0 -33
- package/src/components/App.tsx +0 -59
- package/src/components/DefaultFallback.tsx +0 -26
- package/src/components/useApp.tsx +0 -164
- package/src/core/capabilities.test.ts +0 -136
- package/src/core/capabilities.ts +0 -259
- package/src/core/manager.test.ts +0 -516
- package/src/core/manager.ts +0 -604
- package/src/playground/debug/Debug.tsx +0 -39
- package/src/playground/debug/plugin.ts +0 -16
- package/src/playground/generator/Main.tsx +0 -71
- package/src/playground/generator/Toolbar.tsx +0 -47
- package/src/playground/generator/generator.ts +0 -48
- package/src/playground/generator/index.ts +0 -6
- package/src/playground/generator/plugin.ts +0 -22
- package/src/playground/layout/Layout.tsx +0 -33
- package/src/playground/layout/index.ts +0 -5
- package/src/playground/layout/plugin.ts +0 -18
- package/src/playground/logger/Toolbar.tsx +0 -30
- package/src/playground/logger/plugin.ts +0 -41
- package/src/playground/logger/schema.ts +0 -12
- package/src/playground/playground.stories.tsx +0 -46
- package/src/plugin-intent/IntentPlugin.ts +0 -20
- package/src/plugin-intent/actions.ts +0 -31
- package/src/plugin-intent/errors.ts +0 -40
- package/src/plugin-intent/index.ts +0 -9
- package/src/plugin-intent/intent-dispatcher.test.ts +0 -286
- package/src/plugin-intent/intent-dispatcher.ts +0 -337
- package/src/plugin-intent/intent.ts +0 -154
- package/src/plugin-intent/meta.ts +0 -10
- package/src/plugin-settings/SettingsPlugin.ts +0 -34
- package/src/plugin-settings/actions.ts +0 -25
- package/src/plugin-settings/app-graph-builder.ts +0 -160
- package/src/plugin-settings/index.ts +0 -6
- package/src/plugin-settings/intent-resolver.ts +0 -35
- package/src/plugin-settings/meta.ts +0 -10
- package/src/plugin-settings/store.ts +0 -33
- package/src/plugin-settings/translations.ts +0 -19
- package/src/react/ErrorBoundary.tsx +0 -56
- package/src/react/IntentContext.tsx +0 -35
- package/src/react/Surface.stories.tsx +0 -101
- package/src/react/Surface.tsx +0 -86
- package/src/react/common.ts +0 -13
- package/src/react/index.ts +0 -10
- package/src/react/useCapabilities.ts +0 -31
- package/src/react/useIntentResolver.ts +0 -22
- package/src/worker.ts +0 -11
- /package/dist/lib/browser/{intent-dispatcher-6SHA5B3N.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/browser/{worker.mjs.map → chunk-RFSO3JRG.mjs.map} +0 -0
- /package/dist/lib/{node-esm/intent-dispatcher-SIYQ5ZIU.mjs.map → browser/common/activation-events.mjs.map} +0 -0
- /package/dist/lib/{node-esm/worker.mjs.map → browser/common/capabilities.mjs.map} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/core/plugin.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport * as Pipeable from 'effect/Pipeable';\n\nimport { invariant } from '@dxos/invariant';\n\nimport type * as ActivationEvent from './activation-event';\nimport * as Capability from './capability';\nimport type * as PluginManager from './plugin-manager';\n\n//\n// Plugin Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing PluginManager via the Effect layer system.\n * This allows lifecycle operations to access the plugin manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/PluginManager')<Service, PluginManager.PluginManager>() {}\n\n//\n// Lifecycle Functions\n//\n\n/**\n * Activates plugins based on the activation event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\nexport const activate = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.activate(event));\n\n/**\n * Re-activates the modules that were activated by the event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\nexport const reset = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.reset(event));\n\n/**\n * Shuts down the plugin manager, deactivating all active modules and clearing lifecycle state.\n * Accesses the PluginManager via the Effect layer system.\n */\nexport const shutdown = (): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.shutdown());\n\n/**\n * Computes a module ID from plugin ID and export name.\n */\nconst computeModuleId = (pluginId: string, moduleName: string): string => {\n return `${pluginId}.module.${moduleName}`;\n};\n\n/**\n * Identifier denoting a PluginModule.\n */\nexport const PluginModuleTypeId: unique symbol = Symbol.for('@dxos/app-framework/PluginModule');\nexport type PluginModuleTypeId = typeof PluginModuleTypeId;\n\n/**\n * Type guard to check if a value is a PluginModule.\n */\nexport const isPluginModule = (value: unknown): value is PluginModule => {\n return typeof value === 'object' && value !== null && PluginModuleTypeId in value;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Activation of a module is async allowing for code to split and loaded lazily.\n */\nexport interface PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId;\n /**\n * Unique id of the module.\n */\n id: string;\n\n /**\n * Events for which the module will be activated.\n */\n activatesOn: ActivationEvent.Events;\n\n /**\n * Events that this module fires *before* its own activation runs.\n *\n * When this module is asked to activate (via {@link activatesOn}), the\n * plugin manager first activates every event listed here, ensuring any\n * other modules that contribute to those events have completed before\n * this module's {@link activate} body executes. These events are fired\n * by the framework on this module's behalf — the module does not need\n * to wait for some other code to fire them.\n *\n * The module is marked as needing reset if a module activated by one\n * of these events is later removed.\n *\n * Read as: \"this module fires these events before [its] activation\".\n */\n firesBeforeActivation?: ActivationEvent.ActivationEvent[];\n\n /**\n * Events that this module fires *after* its own activation completes.\n *\n * Once this module's {@link activate} body has finished executing, the\n * plugin manager activates every event listed here, causing any modules\n * listening on those events to run. These events are fired by the\n * framework on this module's behalf as part of this module's lifecycle.\n *\n * Read as: \"this module fires these events after [its] activation\".\n */\n firesAfterActivation?: ActivationEvent.ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * CapabilityManager is accessed via the Effect layer system (Capability.Service).\n * PluginManager is accessed via Plugin.Service.\n * @param props Optional props passed to the module.\n * @returns The capabilities of the module.\n */\n activate: (props?: any) => Effect.Effect<Capability.ModuleReturn, Error, Capability.Service | Service | never>;\n}\n\nexport type PluginModuleOptions = Omit<PluginModule, 'id' | typeof PluginModuleTypeId> & { id?: string };\n\nclass PluginModuleImpl implements PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId = PluginModuleTypeId;\n readonly id: PluginModule['id'];\n readonly activatesOn: PluginModule['activatesOn'];\n readonly firesBeforeActivation?: PluginModule['firesBeforeActivation'];\n readonly firesAfterActivation?: PluginModule['firesAfterActivation'];\n readonly activate: PluginModule['activate'];\n\n constructor(options: Omit<PluginModule, typeof PluginModuleTypeId>) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.firesBeforeActivation = options.firesBeforeActivation;\n this.firesAfterActivation = options.firesAfterActivation;\n this.activate = options.activate;\n }\n}\n\nexport type Meta = {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example org.dxos.plugin.example\n */\n id: string;\n\n /**\n * Human-readable name.\n */\n name: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * Name of the author or organization that created the plugin.\n */\n author?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * URL of screenshot.\n */\n screenshots?: string[];\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n\n /**\n * Icon hue (ChromaticPalette).\n */\n iconHue?: string;\n};\n\n/**\n * Identifier denoting a Plugin.\n */\nexport const PluginTypeId: unique symbol = Symbol.for('@dxos/app-framework/Plugin');\nexport type PluginTypeId = typeof PluginTypeId;\n\n/**\n * Type guard to check if a value is a Plugin.\n */\nexport const isPlugin = (value: unknown): value is Plugin => {\n return typeof value === 'object' && value !== null && PluginTypeId in value;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n * Plugins provide things such as components, state, actions, etc. to the application.\n */\n// TODO(burdon): Convert to ECHO schema.\nexport interface Plugin {\n readonly [PluginTypeId]: PluginTypeId;\n readonly meta: Readonly<Meta>;\n readonly modules: ReadonlyArray<PluginModule>;\n}\n\n/**\n * Internal implementation of Plugin.\n * @internal\n */\nclass PluginImpl implements Plugin {\n readonly [PluginTypeId]: PluginTypeId = PluginTypeId;\n\n constructor(\n private readonly _meta: Meta,\n private readonly _modules: PluginModule[],\n ) {}\n\n get meta(): Readonly<Meta> {\n return this._meta;\n }\n\n get modules(): ReadonlyArray<PluginModule> {\n return this._modules;\n }\n}\n\n/**\n * Builder interface for creating plugins incrementally.\n */\nexport interface PluginBuilder<T = void> extends Pipeable.Pipeable {\n readonly meta: Meta;\n readonly modules: ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)>;\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T>;\n}\n\n/**\n * Builder implementation for creating plugins incrementally.\n */\nclass PluginBuilderImpl<T = void> implements PluginBuilder<T> {\n readonly meta: Meta;\n private readonly _modules: Array<PluginModuleOptions | ((options: T) => PluginModuleOptions)> = [];\n\n constructor(meta: Meta) {\n this.meta = meta;\n }\n\n get modules(): ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)> {\n return this._modules;\n }\n\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T> {\n this._modules.push(moduleOptions);\n return this;\n }\n\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return Pipeable.pipeArguments(this, arguments);\n }\n}\n\n/**\n * Creates a new PluginBuilder to start building a plugin.\n */\nexport const define = <T = void>(meta: Meta): PluginBuilder<T> => new PluginBuilderImpl<T>(meta);\n\n/**\n * Adds a module to a plugin builder.\n * Supports both pipeline and direct call styles.\n * Modules can be either PluginModuleOptions or functions that receive options.\n */\nexport function addModule<T>(\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): (builder: PluginBuilder<T>) => PluginBuilder<T>;\nexport function addModule<T>(\n builder: PluginBuilder<T>,\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): PluginBuilder<T>;\nexport function addModule<T>(\n moduleOptionsOrBuilder: PluginModuleOptions | ((options: T) => PluginModuleOptions) | PluginBuilder<T>,\n moduleOptions?: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): ((builder: PluginBuilder<T>) => PluginBuilder<T>) | PluginBuilder<T> {\n // If second arg is provided, it's the direct call style: addModule(builder, moduleOptions)\n if (moduleOptions !== undefined) {\n return (moduleOptionsOrBuilder as PluginBuilder<T>).addModule(moduleOptions);\n }\n // Otherwise it's pipeline style: addModule(moduleOptions) returns a function\n const moduleOpts = moduleOptionsOrBuilder as PluginModuleOptions | ((options: T) => PluginModuleOptions);\n return (builder: PluginBuilder<T>) => builder.addModule(moduleOpts);\n}\n\nexport type PluginFactory<T = void> = ((options: T) => Plugin) & { meta: Meta };\n\n/**\n * Resolves a module from either PluginModuleOptions or a function that returns PluginModuleOptions.\n */\nconst resolveModule = (\n meta: Meta,\n module: PluginModuleOptions | ((options: any) => PluginModuleOptions),\n options?: any,\n): PluginModuleImpl => {\n const moduleOptions = typeof module === 'function' ? module(options) : module;\n const id = Option.fromNullable(moduleOptions.id).pipe(\n Option.match({\n onNone: () => {\n const exportName = Capability.getModuleTag(moduleOptions.activate);\n invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`);\n return computeModuleId(meta.id, exportName);\n },\n onSome: (id) => computeModuleId(meta.id, id),\n }),\n );\n return new PluginModuleImpl({ ...moduleOptions, id });\n};\n\n/**\n * Creates a Plugin from a builder.\n * Supports both pipeline and direct call styles.\n * Always returns a factory function (options: T) => Plugin.\n * When T is void, the function takes no arguments: () => Plugin.\n */\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T>;\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T> {\n const meta = builder.meta;\n\n const factory = (options: T) => {\n const modules = builder.modules.map((module) => resolveModule(meta, module, options));\n return new PluginImpl(meta, modules);\n };\n\n return Object.assign(factory, { meta });\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAAA;;;;;;;;;;;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,iBAAiB;;AAcnB,IAAMC,UAAN,cAA8BC,YAAI,mCAAA,EAAA,EAAA;AAA8E;AAYhH,IAAMC,WAAW,CAACC,UAChBC,eAAQJ,SAAS,CAACK,YAAYA,QAAQH,SAASC,KAAAA,CAAAA;AAQjD,IAAMG,QAAQ,CAACH,UACbC,eAAQJ,SAAS,CAACK,YAAYA,QAAQC,MAAMH,KAAAA,CAAAA;AAM9C,IAAMI,WAAW,MACfH,eAAQJ,SAAS,CAACK,YAAYA,QAAQE,SAAQ,CAAA;AAKvD,IAAMC,kBAAkB,CAACC,UAAkBC,eAAAA;AACzC,SAAO,GAAGD,QAAAA,WAAmBC,UAAAA;AAC/B;AAKO,IAAMC,qBAAoCC,uBAAOC,IAAI,kCAAA;AAMrD,IAAMC,iBAAiB,CAACC,UAAAA;AAC7B,SAAO,OAAOA,UAAU,YAAYA,UAAU,QAAQJ,sBAAsBI;AAC9E;AA2DA,IAAMC,mBAAN,MAAMA;EACK,CAACL,kBAAAA,IAA0CA;EAC3CM;EACAC;EACAC;EACAC;EACAlB;EAET,YAAYmB,SAAwD;AAClE,SAAKJ,KAAKI,QAAQJ;AAClB,SAAKC,cAAcG,QAAQH;AAC3B,SAAKC,wBAAwBE,QAAQF;AACrC,SAAKC,uBAAuBC,QAAQD;AACpC,SAAKlB,WAAWmB,QAAQnB;EAC1B;AACF;AA6DO,IAAMoB,eAA8BV,uBAAOC,IAAI,4BAAA;AAM/C,IAAMU,WAAW,CAACR,UAAAA;AACvB,SAAO,OAAOA,UAAU,YAAYA,UAAU,QAAQO,gBAAgBP;AACxE;AAiBA,IAAMS,aAAN,MAAMA;;;EACK,CAACF,YAAAA,IAA8BA;EAExC,YACmBG,OACAC,UACjB;SAFiBD,QAAAA;SACAC,WAAAA;EAChB;EAEH,IAAIC,OAAuB;AACzB,WAAO,KAAKF;EACd;EAEA,IAAIG,UAAuC;AACzC,WAAO,KAAKF;EACd;AACF;AAcA,IAAMG,oBAAN,MAAMA;EACKF;EACQD,WAA+E,CAAA;EAEhG,YAAYC,MAAY;AACtB,SAAKA,OAAOA;EACd;EAEA,IAAIC,UAAsF;AACxF,WAAO,KAAKF;EACd;EAEAI,UAAUC,eAA8F;AACtG,SAAKL,SAASM,KAAKD,aAAAA;AACnB,WAAO;EACT;EAEAE,OAAO;AAEL,WAAgBC,uBAAc,MAAMC,SAAAA;EACtC;AACF;AAKO,IAAMC,SAAS,CAAWT,SAAiC,IAAIE,kBAAqBF,IAAAA;AAcpF,SAASG,UACdO,wBACAN,eAA2E;AAG3E,MAAIA,kBAAkBO,QAAW;AAC/B,WAAQD,uBAA4CP,UAAUC,aAAAA;EAChE;AAEA,QAAMQ,aAAaF;AACnB,SAAO,CAACG,YAA8BA,QAAQV,UAAUS,UAAAA;AAC1D;AAOA,IAAME,gBAAgB,CACpBd,MACAe,QACArB,YAAAA;AAEA,QAAMU,gBAAgB,OAAOW,WAAW,aAAaA,OAAOrB,OAAAA,IAAWqB;AACvE,QAAMzB,KAAY0B,oBAAaZ,cAAcd,EAAE,EAAEgB,KACxCW,aAAM;IACXC,QAAQ,MAAA;AACN,YAAMC,aAAwBC,aAAahB,cAAc7B,QAAQ;AACjE8C,gBAAUF,YAAY,uCAAuCnB,KAAKV,EAAE,IAAE;;;;;;;;;AACtE,aAAOT,gBAAgBmB,KAAKV,IAAI6B,UAAAA;IAClC;IACAG,QAAQ,CAAChC,QAAOT,gBAAgBmB,KAAKV,IAAIA,GAAAA;EAC3C,CAAA,CAAA;AAEF,SAAO,IAAID,iBAAiB;IAAE,GAAGe;IAAed;EAAG,CAAA;AACrD;AASO,SAASiC,KAAQV,SAAyB;AAC/C,QAAMb,OAAOa,QAAQb;AAErB,QAAMwB,UAAU,CAAC9B,YAAAA;AACf,UAAMO,UAAUY,QAAQZ,QAAQwB,IAAI,CAACV,WAAWD,cAAcd,MAAMe,QAAQrB,OAAAA,CAAAA;AAC5E,WAAO,IAAIG,WAAWG,MAAMC,OAAAA;EAC9B;AAEA,SAAOyB,OAAOC,OAAOH,SAAS;IAAExB;EAAK,CAAA;AACvC;",
|
|
6
|
+
"names": ["Context", "Effect", "Option", "Pipeable", "invariant", "Service", "Tag", "activate", "event", "flatMap", "manager", "reset", "shutdown", "computeModuleId", "pluginId", "moduleName", "PluginModuleTypeId", "Symbol", "for", "isPluginModule", "value", "PluginModuleImpl", "id", "activatesOn", "firesBeforeActivation", "firesAfterActivation", "options", "PluginTypeId", "isPlugin", "PluginImpl", "_meta", "_modules", "meta", "modules", "PluginBuilderImpl", "addModule", "moduleOptions", "push", "pipe", "pipeArguments", "arguments", "define", "moduleOptionsOrBuilder", "undefined", "moduleOpts", "builder", "resolveModule", "module", "fromNullable", "match", "onNone", "exportName", "getModuleTag", "invariant", "onSome", "make", "factory", "map", "Object", "assign"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export {
|
|
9
|
+
__export
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=chunk-HSLMI22Q.mjs.map
|
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
capabilities_exports
|
|
4
|
+
} from "./chunk-G3RTFSNG.mjs";
|
|
5
|
+
|
|
6
|
+
// src/helpers.ts
|
|
7
|
+
var topologicalSort = (nodes) => {
|
|
8
|
+
const getDependencies = (nodeId, seen = /* @__PURE__ */ new Set(), path = /* @__PURE__ */ new Set()) => {
|
|
9
|
+
if (path.has(nodeId)) {
|
|
10
|
+
throw new Error(`Circular dependency detected involving ${nodeId}`);
|
|
11
|
+
}
|
|
12
|
+
if (seen.has(nodeId)) {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
const node = nodes.find((n) => n.id === nodeId);
|
|
16
|
+
if (!node) {
|
|
17
|
+
throw new Error(`Node ${nodeId} not found but is listed as a dependency`);
|
|
18
|
+
}
|
|
19
|
+
const newPath = /* @__PURE__ */ new Set([
|
|
20
|
+
...path,
|
|
21
|
+
nodeId
|
|
22
|
+
]);
|
|
23
|
+
const newSeen = /* @__PURE__ */ new Set([
|
|
24
|
+
...seen,
|
|
25
|
+
nodeId
|
|
26
|
+
]);
|
|
27
|
+
const dependsOn = node.dependsOn ?? [];
|
|
28
|
+
return [
|
|
29
|
+
...dependsOn.flatMap((depId) => getDependencies(depId, newSeen, newPath)),
|
|
30
|
+
nodeId
|
|
31
|
+
];
|
|
32
|
+
};
|
|
33
|
+
const allDependencies = nodes.map((node) => node.id).flatMap((id) => getDependencies(id)).filter((id, index, self) => self.indexOf(id) === index);
|
|
34
|
+
return allDependencies.map((id) => nodes.find((node) => node.id === id)).filter((node) => node !== void 0);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// src/ui/hooks/useSurface.ts
|
|
38
|
+
import { useContext as useContext3 } from "react";
|
|
39
|
+
import { raise as raise2 } from "@dxos/debug";
|
|
40
|
+
|
|
41
|
+
// src/ui/components/PluginManager/PluginManagerProvider.ts
|
|
42
|
+
import { createContext, useContext } from "react";
|
|
43
|
+
import { raise } from "@dxos/debug";
|
|
44
|
+
var PluginManagerContext = createContext(void 0);
|
|
45
|
+
var usePluginManager = () => useContext(PluginManagerContext) ?? raise(new Error("Missing PluginManagerContext"));
|
|
46
|
+
var PluginManagerProvider = PluginManagerContext.Provider;
|
|
47
|
+
|
|
48
|
+
// src/ui/components/Surface/context.ts
|
|
49
|
+
import { createContext as createContext2 } from "react";
|
|
50
|
+
var SurfaceContext = createContext2(void 0);
|
|
51
|
+
|
|
52
|
+
// src/ui/components/Surface/SurfaceComponent.tsx
|
|
53
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
54
|
+
import React3, { Fragment, Profiler, Suspense, forwardRef as forwardRef2, memo, useEffect, useMemo as useMemo2, useRef as useRef2 } from "react";
|
|
55
|
+
import { log } from "@dxos/log";
|
|
56
|
+
import { ErrorBoundary } from "@dxos/react-error-boundary";
|
|
57
|
+
import { useDefaultValue } from "@dxos/react-hooks";
|
|
58
|
+
import { byPosition } from "@dxos/util";
|
|
59
|
+
|
|
60
|
+
// src/ui/components/Surface/SurfaceInfo.tsx
|
|
61
|
+
import React, { cloneElement, forwardRef, useCallback, useLayoutEffect, useState } from "react";
|
|
62
|
+
import { createPortal } from "react-dom";
|
|
63
|
+
import { addEventListener, combine } from "@dxos/async";
|
|
64
|
+
import { useMergeRefs } from "@dxos/react-hooks";
|
|
65
|
+
var SurfaceInfo = /* @__PURE__ */ forwardRef(({ children }, forwardedRef) => {
|
|
66
|
+
const [rect, setRect] = useState(null);
|
|
67
|
+
const [expand, setExpand] = useState(false);
|
|
68
|
+
const info = useSurface();
|
|
69
|
+
const [root, setRoot] = useState(null);
|
|
70
|
+
const measureRef = useCallback((node) => setRoot(node), []);
|
|
71
|
+
const mergedRef = useMergeRefs([
|
|
72
|
+
measureRef,
|
|
73
|
+
forwardedRef
|
|
74
|
+
]);
|
|
75
|
+
const childWithRef = /* @__PURE__ */ cloneElement(children, {
|
|
76
|
+
ref: mergedRef
|
|
77
|
+
});
|
|
78
|
+
useLayoutEffect(() => {
|
|
79
|
+
if (!root) {
|
|
80
|
+
setRect(null);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const measure = () => {
|
|
84
|
+
setRect(root.getBoundingClientRect());
|
|
85
|
+
};
|
|
86
|
+
const observer = new ResizeObserver(measure);
|
|
87
|
+
observer.observe(root);
|
|
88
|
+
measure();
|
|
89
|
+
return combine(addEventListener(window, "scroll", measure, true), addEventListener(window, "resize", measure), () => {
|
|
90
|
+
observer.disconnect();
|
|
91
|
+
});
|
|
92
|
+
}, [
|
|
93
|
+
root
|
|
94
|
+
]);
|
|
95
|
+
const padding = 0;
|
|
96
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, childWithRef, rect && /* @__PURE__ */ createPortal(
|
|
97
|
+
/* @__PURE__ */ React.createElement("div", {
|
|
98
|
+
role: "none",
|
|
99
|
+
className: "z-[100] fixed flex flex-col-reverse scrollbar-none overflow-auto pointer-events-none",
|
|
100
|
+
style: {
|
|
101
|
+
top: rect.top + padding,
|
|
102
|
+
left: rect.left + padding,
|
|
103
|
+
width: rect.width - padding * 2,
|
|
104
|
+
height: rect.height - padding * 2
|
|
105
|
+
}
|
|
106
|
+
}, expand ? /* @__PURE__ */ React.createElement("div", {
|
|
107
|
+
className: "absolute inset-0 bg-deck-surface border border-green-500 cursor-pointer pointer-events-auto overflow-auto",
|
|
108
|
+
onPointerDown: (ev) => ev.stopPropagation(),
|
|
109
|
+
onClick: (ev) => {
|
|
110
|
+
ev.stopPropagation();
|
|
111
|
+
setExpand(false);
|
|
112
|
+
}
|
|
113
|
+
}, /* @__PURE__ */ React.createElement("pre", {
|
|
114
|
+
className: "p-2 text-xs text-description font-mono"
|
|
115
|
+
}, JSON.stringify({
|
|
116
|
+
info
|
|
117
|
+
}, null, 2))) : /* @__PURE__ */ React.createElement("span", {
|
|
118
|
+
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",
|
|
119
|
+
title: info.id,
|
|
120
|
+
onPointerDown: (ev) => ev.stopPropagation(),
|
|
121
|
+
onClick: (ev) => {
|
|
122
|
+
ev.stopPropagation();
|
|
123
|
+
setExpand(true);
|
|
124
|
+
}
|
|
125
|
+
}, "\u24D8")),
|
|
126
|
+
// TODO(burdon): Create well-known element to gather all debug portals.
|
|
127
|
+
document.body
|
|
128
|
+
));
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// src/ui/components/Surface/SurfaceProfilerContext.tsx
|
|
132
|
+
import React2, { createContext as createContext3, useContext as useContext2, useMemo, useRef, useSyncExternalStore } from "react";
|
|
133
|
+
var MAX_ENTRIES = 500;
|
|
134
|
+
var SurfaceProfilerStore = class {
|
|
135
|
+
_entries = [];
|
|
136
|
+
_listeners = /* @__PURE__ */ new Set();
|
|
137
|
+
_snapshot = [];
|
|
138
|
+
_pendingNotify = false;
|
|
139
|
+
/** Records an entry and schedules a deferred notification to avoid re-render loops. */
|
|
140
|
+
record(entry) {
|
|
141
|
+
this._entries.push(entry);
|
|
142
|
+
if (this._entries.length > MAX_ENTRIES) {
|
|
143
|
+
this._entries = this._entries.slice(-MAX_ENTRIES);
|
|
144
|
+
}
|
|
145
|
+
this._snapshot = [
|
|
146
|
+
...this._entries
|
|
147
|
+
];
|
|
148
|
+
this._scheduleNotify();
|
|
149
|
+
}
|
|
150
|
+
clear() {
|
|
151
|
+
this._entries = [];
|
|
152
|
+
this._snapshot = [];
|
|
153
|
+
this._notifySync();
|
|
154
|
+
}
|
|
155
|
+
subscribe = (listener) => {
|
|
156
|
+
this._listeners.add(listener);
|
|
157
|
+
return () => {
|
|
158
|
+
this._listeners.delete(listener);
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
getSnapshot = () => {
|
|
162
|
+
return this._snapshot;
|
|
163
|
+
};
|
|
164
|
+
/**
|
|
165
|
+
* Defers notification to the next animation frame to break the
|
|
166
|
+
* Profiler onRender → record → notify → re-render → onRender loop.
|
|
167
|
+
*/
|
|
168
|
+
_scheduleNotify() {
|
|
169
|
+
if (!this._pendingNotify) {
|
|
170
|
+
this._pendingNotify = true;
|
|
171
|
+
requestAnimationFrame(() => {
|
|
172
|
+
this._pendingNotify = false;
|
|
173
|
+
this._notifySync();
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
_notifySync() {
|
|
178
|
+
for (const listener of this._listeners) {
|
|
179
|
+
listener();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
var SurfaceProfilerContext = /* @__PURE__ */ createContext3(void 0);
|
|
184
|
+
var SurfaceProfilerProvider = ({ children }) => {
|
|
185
|
+
const storeRef = useRef(null);
|
|
186
|
+
if (!storeRef.current) {
|
|
187
|
+
storeRef.current = new SurfaceProfilerStore();
|
|
188
|
+
}
|
|
189
|
+
return /* @__PURE__ */ React2.createElement(SurfaceProfilerContext.Provider, {
|
|
190
|
+
value: {
|
|
191
|
+
store: storeRef.current
|
|
192
|
+
}
|
|
193
|
+
}, children);
|
|
194
|
+
};
|
|
195
|
+
var useSurfaceProfilerCallback = () => {
|
|
196
|
+
const store = useContext2(SurfaceProfilerContext)?.store;
|
|
197
|
+
return useMemo(() => {
|
|
198
|
+
if (!store) {
|
|
199
|
+
return void 0;
|
|
200
|
+
}
|
|
201
|
+
return (id, phase, actualDuration, baseDuration, startTime, commitTime) => {
|
|
202
|
+
store.record({
|
|
203
|
+
id,
|
|
204
|
+
phase,
|
|
205
|
+
actualDuration,
|
|
206
|
+
baseDuration,
|
|
207
|
+
startTime,
|
|
208
|
+
commitTime,
|
|
209
|
+
timestamp: Date.now()
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
}, [
|
|
213
|
+
store
|
|
214
|
+
]);
|
|
215
|
+
};
|
|
216
|
+
var useSurfaceProfilerEntries = () => {
|
|
217
|
+
const context = useContext2(SurfaceProfilerContext);
|
|
218
|
+
return useSyncExternalStore(context?.store.subscribe ?? noop, context?.store.getSnapshot ?? emptySnapshot);
|
|
219
|
+
};
|
|
220
|
+
var useSurfaceProfilerStats = () => {
|
|
221
|
+
const entries = useSurfaceProfilerEntries();
|
|
222
|
+
const statsMap = /* @__PURE__ */ new Map();
|
|
223
|
+
for (const entry of entries) {
|
|
224
|
+
let stats = statsMap.get(entry.id);
|
|
225
|
+
if (!stats) {
|
|
226
|
+
stats = {
|
|
227
|
+
id: entry.id,
|
|
228
|
+
mountCount: 0,
|
|
229
|
+
updateCount: 0,
|
|
230
|
+
totalRenders: 0,
|
|
231
|
+
avgActualDuration: 0,
|
|
232
|
+
maxActualDuration: 0,
|
|
233
|
+
avgBaseDuration: 0,
|
|
234
|
+
lastActualDuration: 0,
|
|
235
|
+
lastCommitTime: 0
|
|
236
|
+
};
|
|
237
|
+
statsMap.set(entry.id, stats);
|
|
238
|
+
}
|
|
239
|
+
if (entry.phase === "mount") {
|
|
240
|
+
stats.mountCount++;
|
|
241
|
+
} else {
|
|
242
|
+
stats.updateCount++;
|
|
243
|
+
}
|
|
244
|
+
stats.totalRenders++;
|
|
245
|
+
stats.avgActualDuration = (stats.avgActualDuration * (stats.totalRenders - 1) + entry.actualDuration) / stats.totalRenders;
|
|
246
|
+
stats.avgBaseDuration = (stats.avgBaseDuration * (stats.totalRenders - 1) + entry.baseDuration) / stats.totalRenders;
|
|
247
|
+
stats.maxActualDuration = Math.max(stats.maxActualDuration, entry.actualDuration);
|
|
248
|
+
stats.lastActualDuration = entry.actualDuration;
|
|
249
|
+
stats.lastCommitTime = entry.commitTime;
|
|
250
|
+
}
|
|
251
|
+
return [
|
|
252
|
+
...statsMap.values()
|
|
253
|
+
].sort((a, b) => b.maxActualDuration - a.maxActualDuration);
|
|
254
|
+
};
|
|
255
|
+
var useSurfaceProfilerClear = () => {
|
|
256
|
+
const store = useContext2(SurfaceProfilerContext)?.store;
|
|
257
|
+
return useMemo(() => store ? () => store.clear() : void 0, [
|
|
258
|
+
store
|
|
259
|
+
]);
|
|
260
|
+
};
|
|
261
|
+
var noop = () => () => {
|
|
262
|
+
};
|
|
263
|
+
var EMPTY_SNAPSHOT = [];
|
|
264
|
+
var emptySnapshot = () => EMPTY_SNAPSHOT;
|
|
265
|
+
|
|
266
|
+
// src/ui/components/Surface/SurfaceComponent.tsx
|
|
267
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/ui/components/Surface/SurfaceComponent.tsx";
|
|
268
|
+
var DEBUG = import.meta.env.VITE_DEBUG;
|
|
269
|
+
var DEFAULT_PLACEHOLDER = /* @__PURE__ */ React3.createElement(Fragment, null);
|
|
270
|
+
var WebComponentWrapper = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ id, role, data, limit, definition, ...rest }, forwardedRef) => {
|
|
271
|
+
const containerRef = useRef2(null);
|
|
272
|
+
const elementRef = useRef2(null);
|
|
273
|
+
const propsRef = useRef2({
|
|
274
|
+
id,
|
|
275
|
+
role,
|
|
276
|
+
data,
|
|
277
|
+
limit,
|
|
278
|
+
...rest
|
|
279
|
+
});
|
|
280
|
+
propsRef.current = {
|
|
281
|
+
id,
|
|
282
|
+
role,
|
|
283
|
+
data,
|
|
284
|
+
limit,
|
|
285
|
+
...rest
|
|
286
|
+
};
|
|
287
|
+
useEffect(() => {
|
|
288
|
+
if (!containerRef.current || elementRef.current) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
const element = document.createElement(definition.tagName);
|
|
292
|
+
elementRef.current = element;
|
|
293
|
+
Object.assign(element, propsRef.current);
|
|
294
|
+
containerRef.current.appendChild(element);
|
|
295
|
+
if (typeof forwardedRef === "function") {
|
|
296
|
+
forwardedRef(element);
|
|
297
|
+
} else if (forwardedRef) {
|
|
298
|
+
forwardedRef.current = element;
|
|
299
|
+
}
|
|
300
|
+
return () => {
|
|
301
|
+
if (elementRef.current && containerRef.current?.contains(elementRef.current)) {
|
|
302
|
+
containerRef.current.removeChild(elementRef.current);
|
|
303
|
+
}
|
|
304
|
+
if (typeof forwardedRef === "function") {
|
|
305
|
+
forwardedRef(null);
|
|
306
|
+
} else if (forwardedRef) {
|
|
307
|
+
forwardedRef.current = null;
|
|
308
|
+
}
|
|
309
|
+
elementRef.current = null;
|
|
310
|
+
};
|
|
311
|
+
}, [
|
|
312
|
+
definition.tagName,
|
|
313
|
+
forwardedRef
|
|
314
|
+
]);
|
|
315
|
+
useEffect(() => {
|
|
316
|
+
const element = elementRef.current;
|
|
317
|
+
if (!element) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
Object.assign(element, propsRef.current);
|
|
321
|
+
});
|
|
322
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
323
|
+
ref: containerRef
|
|
324
|
+
});
|
|
325
|
+
}));
|
|
326
|
+
WebComponentWrapper.displayName = "WebComponentWrapper";
|
|
327
|
+
var SurfaceContextProvider = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ id, role, data, limit, fallback = ErrorFallback, definition, ...rest }, forwardedRef) => {
|
|
328
|
+
const contextValue = useMemo2(() => ({
|
|
329
|
+
id,
|
|
330
|
+
role,
|
|
331
|
+
data
|
|
332
|
+
}), [
|
|
333
|
+
id,
|
|
334
|
+
role,
|
|
335
|
+
data
|
|
336
|
+
]);
|
|
337
|
+
const onProfilerRender = useSurfaceProfilerCallback();
|
|
338
|
+
const profilerId = `surface/${id}/${role}`;
|
|
339
|
+
if (definition.kind === "web-component") {
|
|
340
|
+
return /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
341
|
+
name: "surface",
|
|
342
|
+
resetKeys: [
|
|
343
|
+
data
|
|
344
|
+
],
|
|
345
|
+
FallbackComponent: fallback
|
|
346
|
+
}, /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
|
|
347
|
+
value: contextValue
|
|
348
|
+
}, /* @__PURE__ */ React3.createElement(WebComponentWrapper, {
|
|
349
|
+
id,
|
|
350
|
+
role,
|
|
351
|
+
data,
|
|
352
|
+
limit,
|
|
353
|
+
definition,
|
|
354
|
+
ref: forwardedRef,
|
|
355
|
+
...rest
|
|
356
|
+
})));
|
|
357
|
+
}
|
|
358
|
+
const Component = definition.component;
|
|
359
|
+
const debug = DEBUG || "__DX_DEBUG__" in window;
|
|
360
|
+
if (debug) {
|
|
361
|
+
return /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
362
|
+
name: "surface",
|
|
363
|
+
resetKeys: [
|
|
364
|
+
data
|
|
365
|
+
],
|
|
366
|
+
FallbackComponent: fallback
|
|
367
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
368
|
+
role: "none",
|
|
369
|
+
className: "contents",
|
|
370
|
+
"data-id": id,
|
|
371
|
+
"data-role": role
|
|
372
|
+
}, /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
|
|
373
|
+
value: contextValue
|
|
374
|
+
}, /* @__PURE__ */ React3.createElement(SurfaceInfo, {
|
|
375
|
+
ref: forwardedRef
|
|
376
|
+
}, onProfilerRender && !profilerId.includes("org.dxos.plugin.debug") ? /* @__PURE__ */ React3.createElement(Profiler, {
|
|
377
|
+
id: profilerId,
|
|
378
|
+
onRender: onProfilerRender
|
|
379
|
+
}, /* @__PURE__ */ React3.createElement(Component, {
|
|
380
|
+
id,
|
|
381
|
+
role,
|
|
382
|
+
data,
|
|
383
|
+
limit,
|
|
384
|
+
...rest
|
|
385
|
+
})) : /* @__PURE__ */ React3.createElement(Component, {
|
|
386
|
+
id,
|
|
387
|
+
role,
|
|
388
|
+
data,
|
|
389
|
+
limit,
|
|
390
|
+
...rest
|
|
391
|
+
})))));
|
|
392
|
+
}
|
|
393
|
+
return /* @__PURE__ */ React3.createElement(ErrorBoundary, {
|
|
394
|
+
name: "surface",
|
|
395
|
+
resetKeys: [
|
|
396
|
+
data
|
|
397
|
+
],
|
|
398
|
+
FallbackComponent: fallback
|
|
399
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
400
|
+
role: "none",
|
|
401
|
+
className: "contents",
|
|
402
|
+
"data-id": id,
|
|
403
|
+
"data-role": role
|
|
404
|
+
}, /* @__PURE__ */ React3.createElement(SurfaceContext.Provider, {
|
|
405
|
+
value: contextValue
|
|
406
|
+
}, /* @__PURE__ */ React3.createElement(Component, {
|
|
407
|
+
id,
|
|
408
|
+
role,
|
|
409
|
+
data,
|
|
410
|
+
limit,
|
|
411
|
+
...rest,
|
|
412
|
+
ref: forwardedRef
|
|
413
|
+
}))));
|
|
414
|
+
}));
|
|
415
|
+
SurfaceContextProvider.displayName = "SurfaceContextProvider";
|
|
416
|
+
var SurfaceComponent = /* @__PURE__ */ memo(/* @__PURE__ */ forwardRef2(({ id: _id, role, type, data: dataProp, limit, placeholder = DEFAULT_PLACEHOLDER, ...rest }, forwardedRef) => {
|
|
417
|
+
const data = useDefaultValue(dataProp, () => ({}));
|
|
418
|
+
const surfaces = useSurfaces();
|
|
419
|
+
const effectiveRole = role ?? type?.role;
|
|
420
|
+
if (effectiveRole == null) {
|
|
421
|
+
if (DEBUG) {
|
|
422
|
+
log.warn("Surface has neither `role` nor `type` prop", {
|
|
423
|
+
id: _id
|
|
424
|
+
}, {
|
|
425
|
+
F: __dxlog_file,
|
|
426
|
+
L: 201,
|
|
427
|
+
S: void 0,
|
|
428
|
+
C: (f, a) => f(...a)
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
return null;
|
|
432
|
+
}
|
|
433
|
+
const definitions = findCandidates(surfaces, {
|
|
434
|
+
role: effectiveRole,
|
|
435
|
+
data
|
|
436
|
+
});
|
|
437
|
+
const candidates = limit ? definitions.slice(0, limit) : definitions;
|
|
438
|
+
if (DEBUG && candidates.length === 0) {
|
|
439
|
+
log.warn("no candidates for surface", {
|
|
440
|
+
role: effectiveRole,
|
|
441
|
+
data
|
|
442
|
+
}, {
|
|
443
|
+
F: __dxlog_file,
|
|
444
|
+
L: 210,
|
|
445
|
+
S: void 0,
|
|
446
|
+
C: (f, a) => f(...a)
|
|
447
|
+
});
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
return /* @__PURE__ */ React3.createElement(Suspense, {
|
|
451
|
+
fallback: placeholder
|
|
452
|
+
}, candidates.map((definition) => /* @__PURE__ */ React3.createElement(SurfaceContextProvider, {
|
|
453
|
+
key: definition.id,
|
|
454
|
+
id: definition.id,
|
|
455
|
+
role: effectiveRole,
|
|
456
|
+
data,
|
|
457
|
+
limit,
|
|
458
|
+
definition,
|
|
459
|
+
ref: forwardedRef,
|
|
460
|
+
...rest
|
|
461
|
+
})));
|
|
462
|
+
}));
|
|
463
|
+
SurfaceComponent.displayName = "Surface";
|
|
464
|
+
var ErrorFallback = ({ error }) => {
|
|
465
|
+
const { message } = error instanceof Error ? error : {
|
|
466
|
+
message: String(error)
|
|
467
|
+
};
|
|
468
|
+
return /* @__PURE__ */ React3.createElement("div", {
|
|
469
|
+
role: "alert",
|
|
470
|
+
"data-testid": "error-boundary-fallback"
|
|
471
|
+
}, /* @__PURE__ */ React3.createElement("h1", {
|
|
472
|
+
className: "flex gap-2 text-sm mt-2 text-info-text"
|
|
473
|
+
}, message));
|
|
474
|
+
};
|
|
475
|
+
var findCandidates = (surfaces, { role, data }) => {
|
|
476
|
+
return Object.values(surfaces).filter((definition) => Array.isArray(definition.role) ? definition.role.includes(role) : definition.role === role).filter(({ filter }) => filter ? filter(data ?? {}, role) : true).toSorted(byPosition);
|
|
477
|
+
};
|
|
478
|
+
var useSurfaces = () => {
|
|
479
|
+
const manager = usePluginManager();
|
|
480
|
+
const surfacesByModule = useAtomValue(manager.capabilities.atomByModule(capabilities_exports.ReactSurface));
|
|
481
|
+
return useMemo2(() => {
|
|
482
|
+
const result = [];
|
|
483
|
+
for (const [moduleId, surfaces] of Object.entries(surfacesByModule)) {
|
|
484
|
+
for (const def of surfaces.flat()) {
|
|
485
|
+
result.push({
|
|
486
|
+
...def,
|
|
487
|
+
id: `${moduleId}.${def.id}`
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
return result;
|
|
492
|
+
}, [
|
|
493
|
+
surfacesByModule
|
|
494
|
+
]);
|
|
495
|
+
};
|
|
496
|
+
function isSurfaceAvailable(capabilityManager, { role, type, data }) {
|
|
497
|
+
const effectiveRole = role ?? type?.role;
|
|
498
|
+
if (effectiveRole == null) {
|
|
499
|
+
return false;
|
|
500
|
+
}
|
|
501
|
+
const surfaces = capabilityManager.getAll(capabilities_exports.ReactSurface);
|
|
502
|
+
const candidates = findCandidates(surfaces.flat(), {
|
|
503
|
+
role: effectiveRole,
|
|
504
|
+
data
|
|
505
|
+
});
|
|
506
|
+
return candidates.length > 0;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// src/ui/components/Surface/types.ts
|
|
510
|
+
var isSurfaceFilter = (value) => typeof value === "object" && value !== null && Array.isArray(value.bindings);
|
|
511
|
+
var makeType = (role) => ({
|
|
512
|
+
role
|
|
513
|
+
});
|
|
514
|
+
var expandBindings = (filter) => {
|
|
515
|
+
const bindings = filter.bindings;
|
|
516
|
+
const roles = Array.from(new Set(bindings.map((binding) => binding.role)));
|
|
517
|
+
const guard = (data, role) => {
|
|
518
|
+
if (role != null) {
|
|
519
|
+
return bindings.some((entry) => entry.role === role && entry.guard(data));
|
|
520
|
+
}
|
|
521
|
+
return bindings.some((entry) => entry.guard(data));
|
|
522
|
+
};
|
|
523
|
+
return {
|
|
524
|
+
role: roles.length === 1 ? roles[0] : roles,
|
|
525
|
+
guard
|
|
526
|
+
};
|
|
527
|
+
};
|
|
528
|
+
function create(definition) {
|
|
529
|
+
if (isSurfaceFilter(definition.filter)) {
|
|
530
|
+
const { id, filter, component, position } = definition;
|
|
531
|
+
const { role, guard } = expandBindings(filter);
|
|
532
|
+
return {
|
|
533
|
+
kind: "react",
|
|
534
|
+
id,
|
|
535
|
+
role,
|
|
536
|
+
position,
|
|
537
|
+
component,
|
|
538
|
+
filter: guard
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
return {
|
|
542
|
+
...definition,
|
|
543
|
+
kind: "react"
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
function createWeb(definition) {
|
|
547
|
+
if (isSurfaceFilter(definition.filter)) {
|
|
548
|
+
const { id, filter, tagName, position } = definition;
|
|
549
|
+
const { role, guard } = expandBindings(filter);
|
|
550
|
+
return {
|
|
551
|
+
kind: "web-component",
|
|
552
|
+
id,
|
|
553
|
+
role,
|
|
554
|
+
position,
|
|
555
|
+
tagName,
|
|
556
|
+
filter: guard
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
return {
|
|
560
|
+
...definition,
|
|
561
|
+
kind: "web-component"
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// src/ui/components/Surface/index.ts
|
|
566
|
+
(function(Surface2) {
|
|
567
|
+
Surface2.create = create;
|
|
568
|
+
Surface2.createWeb = createWeb;
|
|
569
|
+
Surface2.Context = SurfaceContext;
|
|
570
|
+
Surface2.Surface = SurfaceComponent;
|
|
571
|
+
Surface2.isAvailable = isSurfaceAvailable;
|
|
572
|
+
Surface2.makeType = makeType;
|
|
573
|
+
Surface2.isFilter = isSurfaceFilter;
|
|
574
|
+
Surface2.ProfilerProvider = SurfaceProfilerProvider;
|
|
575
|
+
Surface2.useProfilerCallback = useSurfaceProfilerCallback;
|
|
576
|
+
Surface2.useProfilerEntries = useSurfaceProfilerEntries;
|
|
577
|
+
Surface2.useProfilerStats = useSurfaceProfilerStats;
|
|
578
|
+
Surface2.useProfilerClear = useSurfaceProfilerClear;
|
|
579
|
+
})(Surface || (Surface = {}));
|
|
580
|
+
var Surface;
|
|
581
|
+
|
|
582
|
+
// src/ui/hooks/useSurface.ts
|
|
583
|
+
var useSurface = () => {
|
|
584
|
+
return useContext3(Surface.Context) ?? raise2(new Error("Missing SurfaceContext"));
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
export {
|
|
588
|
+
topologicalSort,
|
|
589
|
+
useSurface,
|
|
590
|
+
usePluginManager,
|
|
591
|
+
PluginManagerProvider,
|
|
592
|
+
SurfaceComponent,
|
|
593
|
+
Surface
|
|
594
|
+
};
|
|
595
|
+
//# sourceMappingURL=chunk-JPWVIQ5I.mjs.map
|