@dxos/app-framework 0.8.4-main.bc674ce → 0.8.4-main.bcb3aa67d6
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 +1 -3
- package/dist/lib/browser/{capability-7PCNSWBT.mjs → capability-4NSF2SOO.mjs} +16 -11
- package/dist/lib/browser/capability-4NSF2SOO.mjs.map +7 -0
- package/dist/lib/browser/capability-EB3UKSKA.mjs +35 -0
- package/dist/lib/browser/capability-EB3UKSKA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FMZN33N4.mjs → chunk-27FZETIA.mjs} +324 -181
- package/dist/lib/browser/chunk-27FZETIA.mjs.map +7 -0
- package/dist/lib/browser/chunk-CV7I2AAB.mjs +80 -0
- package/dist/lib/browser/chunk-CV7I2AAB.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6Y7PZV72.mjs → chunk-FL2XTEJH.mjs} +3 -4
- package/dist/lib/browser/chunk-FL2XTEJH.mjs.map +7 -0
- package/dist/lib/browser/chunk-H7OMDDGW.mjs +42 -0
- package/dist/lib/browser/chunk-H7OMDDGW.mjs.map +7 -0
- package/dist/lib/browser/chunk-HDQXX5DC.mjs +157 -0
- package/dist/lib/browser/chunk-HDQXX5DC.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-KNBRTZVK.mjs +892 -0
- package/dist/lib/browser/chunk-KNBRTZVK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7IQHKD4U.mjs → chunk-NO7R7QHA.mjs} +4 -7
- package/dist/lib/browser/chunk-NO7R7QHA.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TCLLRCS3.mjs → chunk-P2E7VMRF.mjs} +10 -7
- package/dist/lib/browser/chunk-P2E7VMRF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-QSXYHXCE.mjs} +3 -2
- package/dist/lib/browser/chunk-QSXYHXCE.mjs.map +7 -0
- package/dist/lib/browser/chunk-RFSO3JRG.mjs +1 -0
- package/dist/lib/browser/chunk-TGX63LTL.mjs +8 -0
- package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-TGX63LTL.mjs.map} +1 -1
- 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 +1 -1
- package/dist/lib/browser/core/capability.mjs +1 -1
- package/dist/lib/browser/core/plugin-manager.mjs +4 -4
- package/dist/lib/browser/core/plugin.mjs +6 -4
- package/dist/lib/browser/core/url-loader.mjs +12 -0
- package/dist/lib/browser/index.mjs +40 -131
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/invoker-capability-P7KPBTP3.mjs +43 -0
- package/dist/lib/browser/invoker-capability-P7KPBTP3.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +56 -34
- package/dist/lib/browser/testing/index.mjs.map +3 -3
- package/dist/lib/browser/{react → ui}/index.mjs +19 -21
- package/dist/lib/browser/ui/index.mjs.map +7 -0
- package/dist/lib/node-esm/{capability-CFLQ2QQU.mjs → capability-CB3MNEI3.mjs} +16 -11
- package/dist/lib/node-esm/capability-CB3MNEI3.mjs.map +7 -0
- package/dist/lib/node-esm/capability-CMROGK7R.mjs +36 -0
- package/dist/lib/node-esm/capability-CMROGK7R.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-STMXUEPO.mjs → chunk-37NG7SIN.mjs} +3 -4
- package/dist/lib/node-esm/chunk-37NG7SIN.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7JPKC7OM.mjs +893 -0
- package/dist/lib/node-esm/chunk-7JPKC7OM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-7PPVTBYR.mjs +81 -0
- package/dist/lib/node-esm/chunk-7PPVTBYR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BQ56U4QX.mjs +43 -0
- package/dist/lib/node-esm/chunk-BQ56U4QX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-GT6OKM5I.mjs → chunk-CG6UBBZZ.mjs} +10 -7
- package/dist/lib/node-esm/chunk-CG6UBBZZ.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-663A54LQ.mjs → chunk-EXYTXQ47.mjs} +4 -7
- package/dist/lib/node-esm/chunk-EXYTXQ47.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-FKE4Z3D6.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-FKE4Z3D6.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-OXXXRCQX.mjs +158 -0
- package/dist/lib/node-esm/chunk-OXXXRCQX.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-XYQTBFPA.mjs → chunk-YH44RHP6.mjs} +324 -181
- package/dist/lib/node-esm/chunk-YH44RHP6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-ZZ7CKK6W.mjs} +3 -2
- 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 +1 -1
- package/dist/lib/node-esm/core/capability.mjs +1 -1
- package/dist/lib/node-esm/core/plugin-manager.mjs +4 -4
- package/dist/lib/node-esm/core/plugin.mjs +6 -4
- package/dist/lib/node-esm/core/url-loader.mjs +13 -0
- package/dist/lib/node-esm/core/url-loader.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +40 -131
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/invoker-capability-3C5H46ZY.mjs +44 -0
- package/dist/lib/node-esm/invoker-capability-3C5H46ZY.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +56 -34
- package/dist/lib/node-esm/testing/index.mjs.map +3 -3
- package/dist/lib/node-esm/{react → ui}/index.mjs +19 -21
- package/dist/lib/node-esm/ui/index.mjs.map +7 -0
- package/dist/plugin/node-esm/index.mjs +384 -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.d.ts → cli/cli.d.ts} +2 -2
- 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 +110 -0
- package/dist/types/src/common/capabilities.d.ts.map +1 -0
- package/dist/types/src/common/index.d.ts +4 -9
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +8 -369
- package/dist/types/src/common/operations.d.ts.map +1 -1
- package/dist/types/src/common/translations.d.ts +0 -9
- package/dist/types/src/common/translations.d.ts.map +1 -1
- package/dist/types/src/core/activation-event.d.ts +1 -1
- package/dist/types/src/core/activation-event.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +7 -7
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/index.d.ts +1 -0
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manager.d.ts +9 -2
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin.d.ts +6 -1
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/url-loader.d.ts +25 -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 +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/errors.d.ts +30 -3
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +11 -3
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/testing.d.ts +26 -77
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts +2 -2
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/{react → ui/components/App}/App.d.ts +3 -2
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
- package/dist/types/src/{react/Surface.stories.d.ts → ui/components/App/App.stories.d.ts} +7 -2
- 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/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerProvider.d.ts +1 -1
- 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 +12 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
- package/dist/types/src/{react/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.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 +26 -0
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -0
- package/dist/types/src/{common/surface.d.ts → ui/components/Surface/types.d.ts} +20 -18
- package/dist/types/src/ui/components/Surface/types.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/{react → ui/hooks}/useApp.d.ts +26 -9
- 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/{react → ui/hooks}/useCapabilities.d.ts +6 -1
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -0
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -0
- package/dist/types/src/{react/common.d.ts → ui/hooks/useSettingsState.d.ts} +1 -5
- 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/composer-plugin.d.ts +18 -0
- package/dist/types/src/vite-plugin/composer-plugin.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/import-map-plugin.d.ts +16 -0
- package/dist/types/src/vite-plugin/import-map-plugin.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/index.d.ts +3 -0
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/packages.d.ts +7 -0
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +20 -6
- package/package.json +91 -64
- package/src/{cli.ts → cli/cli.ts} +10 -10
- package/src/{playground/debug → cli}/index.ts +1 -1
- package/src/common/activation-events.ts +44 -0
- package/src/common/capabilities.ts +172 -0
- package/src/common/index.ts +4 -9
- package/src/common/operations.ts +6 -382
- package/src/common/translations.ts +0 -12
- package/src/context.ts +1 -1
- package/src/core/activation-event.ts +5 -2
- package/src/core/capability-manager.ts +1 -1
- package/src/core/capability.ts +11 -10
- package/src/core/index.ts +1 -0
- package/src/core/plugin-manager.test.ts +313 -44
- package/src/core/plugin-manager.ts +344 -157
- package/src/core/plugin.ts +10 -2
- package/src/core/url-loader.test.ts +79 -0
- package/src/core/url-loader.ts +148 -0
- package/src/index.ts +1 -3
- package/src/plugin-operation/OperationPlugin.ts +5 -5
- package/src/plugin-operation/history/capability.ts +5 -5
- package/src/plugin-operation/history/errors.ts +2 -6
- package/src/plugin-operation/history/history-tracker.test.ts +36 -42
- package/src/plugin-operation/history/undo-mapping.ts +6 -3
- package/src/plugin-operation/history/undo-registry.test.ts +3 -3
- package/src/plugin-operation/invoker-capability.ts +21 -7
- package/src/plugin-operation/meta.ts +1 -1
- package/src/plugin-operation/testing.ts +25 -45
- package/src/plugin-runtime/RuntimePlugin.ts +4 -4
- package/src/plugin-runtime/capability.ts +5 -5
- package/src/plugin-runtime/meta.ts +1 -1
- package/src/testing/service.ts +6 -6
- package/src/testing/withPluginManager.stories.tsx +6 -6
- package/src/testing/withPluginManager.tsx +46 -19
- package/src/ui/components/App/App.stories.tsx +92 -0
- package/src/{react → ui/components/App}/App.tsx +9 -11
- package/src/{playground/layout → ui/components/App}/index.ts +1 -1
- package/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.tsx +13 -14
- package/src/{react → ui/components/PluginManager}/PluginManagerProvider.ts +1 -1
- package/src/ui/components/PluginManager/index.ts +5 -0
- package/src/{react/Surface.stories.tsx → ui/components/Surface/SurfaceComponent.stories.tsx} +28 -24
- package/src/{react/Surface.tsx → ui/components/Surface/SurfaceComponent.tsx} +48 -58
- package/src/{react → ui/components/Surface}/SurfaceInfo.tsx +2 -2
- 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 +35 -0
- package/src/{common/surface.ts → ui/components/Surface/types.ts} +22 -25
- 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/{react → ui/hooks}/useApp.tsx +110 -30
- package/src/{react → ui/hooks}/useCapabilities.ts +9 -5
- package/src/{react/common.ts → ui/hooks/useSettingsState.ts} +0 -11
- package/src/ui/hooks/useSurface.ts +13 -0
- package/src/ui/index.ts +6 -0
- package/src/vite-plugin/composer-plugin.ts +128 -0
- package/src/vite-plugin/import-map-plugin.ts +315 -0
- package/src/vite-plugin/index.ts +6 -0
- package/src/vite-plugin/packages.ts +29 -0
- package/tsconfig.json +4 -28
- package/tsconfig.node.json +2 -4
- package/typedoc.json +2 -4
- package/vitest.config.ts +1 -1
- package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs +0 -149
- package/dist/lib/browser/app-graph-builder-M2VPYQC6.mjs.map +0 -7
- package/dist/lib/browser/capability-7PCNSWBT.mjs.map +0 -7
- package/dist/lib/browser/capability-KP3PFEXD.mjs +0 -31
- package/dist/lib/browser/capability-KP3PFEXD.mjs.map +0 -7
- package/dist/lib/browser/chunk-6Y7PZV72.mjs.map +0 -7
- package/dist/lib/browser/chunk-7IQHKD4U.mjs.map +0 -7
- package/dist/lib/browser/chunk-BLQJSGL3.mjs +0 -732
- package/dist/lib/browser/chunk-BLQJSGL3.mjs.map +0 -7
- package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
- package/dist/lib/browser/chunk-FMZN33N4.mjs.map +0 -7
- package/dist/lib/browser/chunk-H4WPA7U7.mjs +0 -77
- package/dist/lib/browser/chunk-H4WPA7U7.mjs.map +0 -7
- package/dist/lib/browser/chunk-PKQT6C53.mjs.map +0 -7
- package/dist/lib/browser/chunk-TCLLRCS3.mjs.map +0 -7
- package/dist/lib/browser/chunk-XYNO72GQ.mjs +0 -746
- package/dist/lib/browser/chunk-XYNO72GQ.mjs.map +0 -7
- package/dist/lib/browser/common/index.mjs +0 -38
- package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs +0 -32
- package/dist/lib/browser/invoker-capability-SZRSTHEH.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs +0 -64
- package/dist/lib/browser/operation-resolver-6MP2MYOY.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs +0 -150
- package/dist/lib/node-esm/app-graph-builder-LROHGJEM.mjs.map +0 -7
- package/dist/lib/node-esm/capability-CFLQ2QQU.mjs.map +0 -7
- package/dist/lib/node-esm/capability-RCUNM2M7.mjs +0 -32
- package/dist/lib/node-esm/capability-RCUNM2M7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-663A54LQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6WXBT3EC.mjs +0 -747
- package/dist/lib/node-esm/chunk-6WXBT3EC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GQEBIGKD.mjs +0 -733
- package/dist/lib/node-esm/chunk-GQEBIGKD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GT6OKM5I.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-STMXUEPO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XR6NMKEP.mjs +0 -78
- package/dist/lib/node-esm/chunk-XR6NMKEP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XYQTBFPA.mjs.map +0 -7
- package/dist/lib/node-esm/common/index.mjs +0 -39
- package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs +0 -33
- package/dist/lib/node-esm/invoker-capability-PNMA5JOS.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs +0 -65
- package/dist/lib/node-esm/operation-resolver-7YWDMTNU.mjs.map +0 -7
- package/dist/types/src/cli.d.ts.map +0 -1
- package/dist/types/src/common/activation-event.d.ts +0 -66
- package/dist/types/src/common/activation-event.d.ts.map +0 -1
- package/dist/types/src/common/capability.d.ts +0 -265
- package/dist/types/src/common/capability.d.ts.map +0 -1
- package/dist/types/src/common/collaboration.d.ts +0 -26
- package/dist/types/src/common/collaboration.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/plugin.d.ts +0 -201
- package/dist/types/src/common/plugin.d.ts.map +0 -1
- package/dist/types/src/common/surface.d.ts.map +0 -1
- package/dist/types/src/playground/debug/Debug.d.ts +0 -8
- 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 -3
- package/dist/types/src/playground/debug/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Main.d.ts +0 -8
- package/dist/types/src/playground/generator/Main.d.ts.map +0 -1
- package/dist/types/src/playground/generator/Toolbar.d.ts +0 -8
- package/dist/types/src/playground/generator/Toolbar.d.ts.map +0 -1
- package/dist/types/src/playground/generator/generator.d.ts +0 -19
- 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 -3
- package/dist/types/src/playground/generator/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/layout/Layout.d.ts +0 -10
- 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 -3
- package/dist/types/src/playground/layout/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/Toolbar.d.ts +0 -8
- 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 -3
- package/dist/types/src/playground/logger/plugin.d.ts.map +0 -1
- package/dist/types/src/playground/logger/schema.d.ts +0 -27
- package/dist/types/src/playground/logger/schema.d.ts.map +0 -1
- package/dist/types/src/playground/playground.stories.d.ts +0 -11
- package/dist/types/src/playground/playground.stories.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts +0 -3
- package/dist/types/src/plugin-settings/SettingsPlugin.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/actions.d.ts +0 -61
- package/dist/types/src/plugin-settings/actions.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/app-graph-builder.d.ts +0 -6
- 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/meta.d.ts +0 -3
- package/dist/types/src/plugin-settings/meta.d.ts.map +0 -1
- package/dist/types/src/plugin-settings/operation-resolver.d.ts +0 -6
- package/dist/types/src/plugin-settings/operation-resolver.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/App.d.ts.map +0 -1
- package/dist/types/src/react/App.stories.d.ts.map +0 -1
- package/dist/types/src/react/DefaultFallback.d.ts +0 -8
- package/dist/types/src/react/DefaultFallback.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/PluginManagerContext.stories.d.ts.map +0 -1
- package/dist/types/src/react/PluginManagerProvider.d.ts.map +0 -1
- package/dist/types/src/react/Surface.d.ts +0 -14
- package/dist/types/src/react/Surface.d.ts.map +0 -1
- package/dist/types/src/react/Surface.stories.d.ts.map +0 -1
- package/dist/types/src/react/SurfaceInfo.d.ts.map +0 -1
- package/dist/types/src/react/common.d.ts.map +0 -1
- package/dist/types/src/react/index.d.ts +0 -9
- package/dist/types/src/react/index.d.ts.map +0 -1
- package/dist/types/src/react/types.d.ts +0 -12
- package/dist/types/src/react/types.d.ts.map +0 -1
- package/dist/types/src/react/useApp.d.ts.map +0 -1
- package/dist/types/src/react/useCapabilities.d.ts.map +0 -1
- package/dist/types/src/react/useLoading.d.ts.map +0 -1
- package/dist/types/src/react/useOperationResolver.d.ts +0 -19
- package/dist/types/src/react/useOperationResolver.d.ts.map +0 -1
- package/src/common/activation-event.ts +0 -99
- package/src/common/capability.ts +0 -343
- package/src/common/collaboration.ts +0 -31
- package/src/common/file.ts +0 -22
- package/src/common/graph.ts +0 -30
- package/src/common/plugin.ts +0 -364
- package/src/playground/debug/Debug.tsx +0 -49
- package/src/playground/debug/plugin.ts +0 -16
- package/src/playground/generator/Main.tsx +0 -80
- package/src/playground/generator/Toolbar.tsx +0 -57
- package/src/playground/generator/generator.ts +0 -48
- package/src/playground/generator/index.ts +0 -6
- package/src/playground/generator/plugin.ts +0 -21
- package/src/playground/layout/Layout.tsx +0 -37
- package/src/playground/layout/plugin.ts +0 -18
- package/src/playground/logger/Toolbar.tsx +0 -33
- package/src/playground/logger/index.ts +0 -5
- package/src/playground/logger/plugin.ts +0 -42
- package/src/playground/logger/schema.ts +0 -22
- package/src/playground/playground.stories.tsx +0 -54
- package/src/plugin-settings/SettingsPlugin.ts +0 -19
- package/src/plugin-settings/actions.ts +0 -64
- package/src/plugin-settings/app-graph-builder.ts +0 -140
- package/src/plugin-settings/index.ts +0 -6
- package/src/plugin-settings/meta.ts +0 -10
- package/src/plugin-settings/operation-resolver.ts +0 -55
- package/src/plugin-settings/translations.ts +0 -19
- package/src/react/App.stories.tsx +0 -63
- package/src/react/DefaultFallback.tsx +0 -26
- package/src/react/ErrorBoundary.tsx +0 -56
- package/src/react/index.ts +0 -14
- package/src/react/types.ts +0 -27
- package/src/react/useOperationResolver.ts +0 -40
- /package/dist/lib/{node-esm/react/index.mjs.map → browser/chunk-RFSO3JRG.mjs.map} +0 -0
- /package/dist/lib/{node-esm/common/index.mjs.map → browser/common/activation-events.mjs.map} +0 -0
- /package/dist/lib/browser/{react/index.mjs.map → common/capabilities.mjs.map} +0 -0
- /package/dist/lib/browser/{common/index.mjs.map → core/url-loader.mjs.map} +0 -0
- /package/dist/types/src/{react → ui/components/PluginManager}/PluginManagerContext.stories.d.ts +0 -0
- /package/dist/types/src/{react → ui/components/Surface}/SurfaceInfo.d.ts +0 -0
- /package/dist/types/src/{react → ui/hooks}/useLoading.d.ts +0 -0
- /package/src/{react → ui/hooks}/useLoading.tsx +0 -0
|
@@ -1,746 +0,0 @@
|
|
|
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
|