@dxos/app-framework 0.8.4-main.3eb6e50203 → 0.8.4-main.3fbcb4aa9b
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-DU35RXMD.mjs → capability-5RRH3WIB.mjs} +11 -10
- package/dist/lib/browser/capability-5RRH3WIB.mjs.map +7 -0
- package/dist/lib/browser/{capability-7LE5X2NH.mjs → capability-LUKGKUQH.mjs} +10 -9
- package/dist/lib/browser/{chunk-4DQMLMGU.mjs → chunk-23D4SJUE.mjs} +11 -13
- package/dist/lib/browser/{chunk-4DQMLMGU.mjs.map → chunk-23D4SJUE.mjs.map} +3 -3
- package/dist/lib/browser/{chunk-ZQO3UZ4R.mjs → chunk-3JWJXGLK.mjs} +6 -4
- package/dist/lib/browser/chunk-3JWJXGLK.mjs.map +7 -0
- package/dist/lib/browser/chunk-45CHLTBV.mjs +34 -0
- package/dist/lib/browser/chunk-45CHLTBV.mjs.map +7 -0
- package/dist/lib/browser/{chunk-PKQT6C53.mjs → chunk-66IXTIVK.mjs} +3 -2
- package/dist/lib/browser/chunk-66IXTIVK.mjs.map +7 -0
- package/dist/lib/browser/chunk-7VZJR2OA.mjs +581 -0
- package/dist/lib/browser/chunk-7VZJR2OA.mjs.map +7 -0
- package/dist/lib/browser/chunk-CZ4BIAHH.mjs +422 -0
- package/dist/lib/browser/chunk-CZ4BIAHH.mjs.map +7 -0
- package/dist/lib/browser/chunk-FJ4765WW.mjs +8 -0
- package/dist/lib/browser/{chunk-FHQTHCX7.mjs.map → chunk-FJ4765WW.mjs.map} +3 -3
- package/dist/lib/browser/chunk-FO3IYSLV.mjs +68 -0
- package/dist/lib/browser/chunk-FO3IYSLV.mjs.map +7 -0
- package/dist/lib/browser/chunk-JD3Z5NEF.mjs +469 -0
- package/dist/lib/browser/chunk-JD3Z5NEF.mjs.map +7 -0
- package/dist/lib/browser/chunk-NBXPP7JR.mjs +1174 -0
- package/dist/lib/browser/chunk-NBXPP7JR.mjs.map +7 -0
- package/dist/lib/browser/{chunk-IGRQWMWW.mjs → chunk-WBHCSOBW.mjs} +18 -18
- package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KWP6PKIU.mjs → chunk-Z55LVAGN.mjs} +87 -19
- package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-EIFGKQSA.mjs → chunk-ZGJAZSNE.mjs} +9 -37
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +16 -29
- package/dist/lib/browser/cli/index.mjs.map +3 -3
- package/dist/lib/browser/common/activation-events.mjs +9 -8
- package/dist/lib/browser/common/capabilities.mjs +9 -8
- package/dist/lib/browser/core/activation-event.mjs +1 -1
- package/dist/lib/browser/core/capability.mjs +3 -1
- package/dist/lib/browser/core/plugin-manager.mjs +8 -4
- package/dist/lib/browser/core/plugin.mjs +14 -4
- package/dist/lib/browser/core/url-loader.mjs +24 -0
- package/dist/lib/browser/index.mjs +45 -24
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{invoker-capability-7QW56NOM.mjs → invoker-capability-K4GHUFXF.mjs} +22 -14
- package/dist/lib/browser/invoker-capability-K4GHUFXF.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +184 -45
- 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 +19 -20
- package/dist/lib/node-esm/{capability-OSVYGK4X.mjs → capability-FCGZVIEG.mjs} +10 -9
- package/dist/lib/{browser/capability-7LE5X2NH.mjs.map → node-esm/capability-FCGZVIEG.mjs.map} +1 -1
- package/dist/lib/node-esm/{capability-SR2EIZFP.mjs → capability-JOIQ2MQE.mjs} +11 -10
- package/dist/lib/node-esm/capability-JOIQ2MQE.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs → chunk-37Z53PXZ.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-UEWJDI2L.mjs.map → chunk-37Z53PXZ.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-6XW6LET6.mjs +35 -0
- package/dist/lib/node-esm/chunk-6XW6LET6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-DHSHRYIB.mjs → chunk-D347W3KO.mjs} +9 -37
- package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DRZKO5UZ.mjs +470 -0
- package/dist/lib/node-esm/chunk-DRZKO5UZ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-DZ2XLAGI.mjs → chunk-HTBJU5FX.mjs} +87 -19
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-M3HKPRPO.mjs +423 -0
- package/dist/lib/node-esm/chunk-M3HKPRPO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MUVUQC3G.mjs +1175 -0
- package/dist/lib/node-esm/chunk-MUVUQC3G.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-J2PHTRHC.mjs → chunk-SBS2YMPT.mjs} +11 -13
- package/dist/lib/node-esm/{chunk-J2PHTRHC.mjs.map → chunk-SBS2YMPT.mjs.map} +3 -3
- package/dist/lib/node-esm/{chunk-64IMLAS2.mjs → chunk-SDJ4B2LU.mjs} +6 -4
- package/dist/lib/node-esm/chunk-SDJ4B2LU.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-V24UWT36.mjs +582 -0
- package/dist/lib/node-esm/chunk-V24UWT36.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-OQYHRZYF.mjs → chunk-WFSRZKBP.mjs} +18 -18
- package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs +70 -0
- package/dist/lib/node-esm/chunk-WK7OIQKI.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-7OWSHPYK.mjs → chunk-XOCUANHO.mjs} +3 -2
- package/dist/lib/node-esm/chunk-XOCUANHO.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +16 -29
- package/dist/lib/node-esm/cli/index.mjs.map +3 -3
- package/dist/lib/node-esm/common/activation-events.mjs +9 -8
- package/dist/lib/node-esm/common/capabilities.mjs +9 -8
- package/dist/lib/node-esm/core/activation-event.mjs +1 -1
- package/dist/lib/node-esm/core/capability.mjs +3 -1
- package/dist/lib/node-esm/core/plugin-manager.mjs +8 -4
- package/dist/lib/node-esm/core/plugin.mjs +14 -4
- package/dist/lib/node-esm/core/url-loader.mjs +25 -0
- package/dist/lib/node-esm/index.mjs +45 -24
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{invoker-capability-CK4AMF2R.mjs → invoker-capability-XEPW5LMJ.mjs} +22 -14
- package/dist/lib/node-esm/invoker-capability-XEPW5LMJ.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +184 -45
- 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 +19 -20
- package/dist/plugin/node-esm/index.mjs +893 -0
- package/dist/plugin/node-esm/index.mjs.map +7 -0
- package/dist/plugin/node-esm/meta.json +1 -0
- package/dist/types/src/common/activation-events.d.ts +1 -1
- package/dist/types/src/common/activation-events.d.ts.map +1 -1
- package/dist/types/src/common/annotations.d.ts +1 -0
- package/dist/types/src/common/annotations.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +4 -8
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +8 -22
- package/dist/types/src/common/operations.d.ts.map +1 -1
- package/dist/types/src/core/activation-event.d.ts +5 -5
- package/dist/types/src/core/activation-event.d.ts.map +1 -1
- package/dist/types/src/core/capability-manager.d.ts +5 -0
- package/dist/types/src/core/capability-manager.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +14 -8
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts +30 -0
- package/dist/types/src/core/edge-registry-plugin-provider.d.ts.map +1 -0
- package/dist/types/src/core/index.d.ts +6 -0
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
- package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.d.ts +177 -4
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manifest.d.ts +101 -0
- package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +113 -7
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/registry.d.ts +101 -0
- package/dist/types/src/core/registry.d.ts.map +1 -0
- package/dist/types/src/core/url-loader.d.ts +127 -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/helpers.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/OperationPlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +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/history-tracker.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-registry.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/meta.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/testing.d.ts +27 -77
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/RuntimePlugin.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/meta.d.ts.map +1 -1
- 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 +1 -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.map +1 -1
- 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.d.ts → App/App.d.ts} +3 -2
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -0
- package/dist/types/src/ui/components/{App.stories.d.ts → App/App.stories.d.ts} +6 -1
- 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/Placeholder/Placeholder.d.ts +64 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/{PluginManagerProvider.d.ts → 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 +24 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/{surface → Surface}/SurfaceInfo.d.ts.map +1 -1
- 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 → Surface}/context.d.ts.map +1 -1
- 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 +3 -3
- package/dist/types/src/ui/components/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/index.d.ts +0 -1
- package/dist/types/src/ui/hooks/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.d.ts +47 -8
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useSurface.d.ts +2 -2
- package/dist/types/src/ui/hooks/useSurface.d.ts.map +1 -1
- package/dist/types/src/ui/index.d.ts +0 -1
- package/dist/types/src/ui/index.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -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 +2 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/loader.d.ts +51 -0
- package/dist/types/src/vite-plugin/boot-loader/loader.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 +28 -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 +41 -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 +16 -4
- package/package.json +58 -62
- package/src/cli/cli.ts +3 -3
- package/src/common/activation-events.ts +6 -6
- package/src/common/annotations.ts +3 -0
- package/src/common/capabilities.ts +18 -23
- package/src/common/operations.ts +7 -10
- package/src/context.ts +1 -1
- package/src/core/activation-event.ts +5 -2
- package/src/core/capability-manager.test.ts +1 -1
- package/src/core/capability-manager.ts +22 -1
- package/src/core/capability.ts +21 -10
- package/src/core/edge-registry-plugin-provider.ts +92 -0
- package/src/core/index.ts +6 -0
- package/src/core/plugin-asset-cache.ts +60 -0
- package/src/core/plugin-manager.test.ts +855 -29
- package/src/core/plugin-manager.ts +818 -179
- package/src/core/plugin-manifest.test.ts +75 -0
- package/src/core/plugin-manifest.ts +134 -0
- package/src/core/plugin.ts +145 -12
- package/src/core/registry.ts +157 -0
- package/src/core/url-loader.test.ts +221 -0
- package/src/core/url-loader.ts +388 -0
- package/src/plugin-operation/OperationPlugin.ts +2 -3
- package/src/plugin-operation/history/capability.ts +1 -2
- package/src/plugin-operation/history/errors.ts +2 -6
- package/src/plugin-operation/history/history-tracker.test.ts +37 -43
- package/src/plugin-operation/history/history-tracker.ts +1 -2
- package/src/plugin-operation/history/types.ts +1 -1
- package/src/plugin-operation/history/undo-mapping.ts +1 -1
- package/src/plugin-operation/history/undo-registry.test.ts +3 -4
- package/src/plugin-operation/history/undo-registry.ts +1 -1
- package/src/plugin-operation/invoker-capability.ts +19 -4
- package/src/plugin-operation/meta.ts +2 -1
- package/src/plugin-operation/testing.ts +26 -45
- package/src/plugin-runtime/RuntimePlugin.ts +2 -3
- package/src/plugin-runtime/meta.ts +2 -1
- package/src/testing/harness.ts +229 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/react.test.tsx +48 -0
- package/src/testing/react.tsx +113 -0
- package/src/testing/service.ts +3 -3
- package/src/testing/withPluginManager.stories.tsx +1 -2
- package/src/testing/withPluginManager.tsx +40 -15
- package/src/ui/components/App/App.stories.tsx +88 -0
- package/src/ui/components/App/App.tsx +81 -0
- package/src/ui/components/App/index.ts +5 -0
- package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
- package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
- package/src/ui/components/Placeholder/index.ts +5 -0
- package/src/ui/components/{PluginManagerContext.stories.tsx → PluginManager/PluginManagerContext.stories.tsx} +15 -13
- package/src/ui/components/{PluginManagerProvider.ts → PluginManager/PluginManagerProvider.ts} +1 -1
- package/src/ui/components/PluginManager/index.ts +5 -0
- package/src/ui/components/{surface → Surface}/SurfaceComponent.stories.tsx +25 -23
- package/src/ui/components/Surface/SurfaceComponent.tsx +303 -0
- package/src/ui/components/{surface → Surface}/SurfaceInfo.tsx +1 -2
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +207 -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 +3 -3
- package/src/ui/hooks/index.ts +0 -1
- package/src/ui/hooks/useApp.test.tsx +159 -0
- package/src/ui/hooks/useApp.tsx +233 -24
- package/src/ui/hooks/useCapabilities.ts +1 -1
- package/src/ui/hooks/useLoading.tsx +14 -6
- package/src/ui/hooks/useSurface.ts +3 -3
- package/src/ui/index.ts +0 -1
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +270 -0
- package/src/vite-plugin/boot-loader/boot-loader.css +320 -0
- package/src/vite-plugin/boot-loader/boot-loader.js +325 -0
- package/src/vite-plugin/boot-loader/index.ts +5 -0
- package/src/vite-plugin/boot-loader/loader.ts +123 -0
- package/src/vite-plugin/composer/index.ts +306 -0
- package/src/vite-plugin/import-map/index.ts +527 -0
- package/src/vite-plugin/index.ts +10 -0
- package/src/vite-plugin/manifest.test.ts +46 -0
- package/src/vite-plugin/manifest.ts +57 -0
- package/src/vite-plugin/packages.ts +187 -0
- package/tsconfig.json +22 -1
- 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/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/dist/lib/browser/capability-DU35RXMD.mjs.map +0 -7
- package/dist/lib/browser/chunk-EIFGKQSA.mjs.map +0 -7
- package/dist/lib/browser/chunk-FHQTHCX7.mjs +0 -8
- package/dist/lib/browser/chunk-IGRQWMWW.mjs.map +0 -7
- package/dist/lib/browser/chunk-KWP6PKIU.mjs.map +0 -7
- package/dist/lib/browser/chunk-NPUEVX42.mjs +0 -34
- package/dist/lib/browser/chunk-NPUEVX42.mjs.map +0 -7
- package/dist/lib/browser/chunk-PKQT6C53.mjs.map +0 -7
- package/dist/lib/browser/chunk-WGWEEBUV.mjs +0 -807
- package/dist/lib/browser/chunk-WGWEEBUV.mjs.map +0 -7
- package/dist/lib/browser/chunk-YAFEA4GV.mjs +0 -1
- package/dist/lib/browser/chunk-YZQ6NFG4.mjs +0 -781
- package/dist/lib/browser/chunk-YZQ6NFG4.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZQO3UZ4R.mjs.map +0 -7
- package/dist/lib/browser/invoker-capability-7QW56NOM.mjs.map +0 -7
- package/dist/lib/node-esm/capability-SR2EIZFP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-64IMLAS2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7OWSHPYK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DHSHRYIB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DZ2XLAGI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JAZVHID3.mjs +0 -35
- package/dist/lib/node-esm/chunk-JAZVHID3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OQYHRZYF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VV4YHPQQ.mjs +0 -782
- package/dist/lib/node-esm/chunk-VV4YHPQQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XHAKT6UD.mjs +0 -808
- package/dist/lib/node-esm/chunk-XHAKT6UD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Z4TJPSMP.mjs +0 -2
- package/dist/lib/node-esm/invoker-capability-CK4AMF2R.mjs.map +0 -7
- package/dist/types/src/ui/components/App.d.ts.map +0 -1
- package/dist/types/src/ui/components/App.stories.d.ts.map +0 -1
- package/dist/types/src/ui/components/DefaultFallback.d.ts +0 -8
- package/dist/types/src/ui/components/DefaultFallback.d.ts.map +0 -1
- package/dist/types/src/ui/components/ErrorBoundary.d.ts +0 -30
- package/dist/types/src/ui/components/ErrorBoundary.d.ts.map +0 -1
- package/dist/types/src/ui/components/PluginManagerContext.stories.d.ts.map +0 -1
- package/dist/types/src/ui/components/PluginManagerProvider.d.ts.map +0 -1
- package/dist/types/src/ui/components/surface/SurfaceComponent.d.ts +0 -12
- package/dist/types/src/ui/components/surface/SurfaceComponent.d.ts.map +0 -1
- package/dist/types/src/ui/components/surface/SurfaceComponent.stories.d.ts.map +0 -1
- package/dist/types/src/ui/components/surface/index.d.ts +0 -5
- package/dist/types/src/ui/components/surface/index.d.ts.map +0 -1
- package/dist/types/src/ui/components/surface/types.d.ts +0 -94
- package/dist/types/src/ui/components/surface/types.d.ts.map +0 -1
- package/dist/types/src/ui/hooks/useOperationResolver.d.ts +0 -19
- package/dist/types/src/ui/hooks/useOperationResolver.d.ts.map +0 -1
- package/src/ui/components/App.stories.tsx +0 -62
- package/src/ui/components/App.tsx +0 -57
- package/src/ui/components/DefaultFallback.tsx +0 -26
- package/src/ui/components/ErrorBoundary.tsx +0 -56
- package/src/ui/components/surface/SurfaceComponent.tsx +0 -262
- package/src/ui/components/surface/index.ts +0 -8
- package/src/ui/components/surface/types.ts +0 -119
- package/src/ui/hooks/useOperationResolver.ts +0 -40
- /package/dist/lib/{node-esm/capability-OSVYGK4X.mjs.map → browser/capability-LUKGKUQH.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-YAFEA4GV.mjs.map → core/url-loader.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-Z4TJPSMP.mjs.map → core/url-loader.mjs.map} +0 -0
- /package/dist/types/src/ui/components/{PluginManagerContext.stories.d.ts → PluginManager/PluginManagerContext.stories.d.ts} +0 -0
- /package/dist/types/src/ui/components/{surface → Surface}/SurfaceComponent.stories.d.ts +0 -0
- /package/dist/types/src/ui/components/{surface → Surface}/SurfaceInfo.d.ts +0 -0
- /package/dist/types/src/ui/components/{surface → Surface}/context.d.ts +0 -0
- /package/src/ui/components/{surface → Surface}/context.ts +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugin-operation/history/capability.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { OperationInvoker } from '@dxos/operation';\n\nimport { Capabilities } from '../../common';\nimport { Capability } from '../../core';\nimport * as HistoryTracker from './history-tracker';\nimport * as UndoRegistry from './undo-registry';\n\n//\n// Capability Module - contributes both UndoRegistry and HistoryTracker.\n//\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get the context for synchronous access in callbacks.\n const capabilities = yield* Capability.Service;\n\n // Create UndoRegistry.\n const undoRegistry = UndoRegistry.make(() => capabilities.getAll(Capabilities.UndoMapping).flat());\n\n // Create HistoryTracker (depends on UndoRegistry and OperationInvoker).\n const invoker = yield* Capability.get(Capabilities.OperationInvoker);\n // Cast to internal type - the factory always returns OperationInvokerInternal.\n const historyTracker = HistoryTracker.make(invoker as OperationInvoker.OperationInvokerInternal, undoRegistry);\n\n return [\n Capability.contributes(Capabilities.UndoRegistry, undoRegistry),\n Capability.contributes(Capabilities.HistoryTracker, historyTracker),\n ];\n }),\n);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AAaxB,IAAA,qBAAeC,mBAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,eAAe,OAAOH,mBAAWI;AAGvC,QAAMC,eAA4BC,KAAK,MAAMH,aAAaI,OAAOC,qBAAaC,WAAW,EAAEC,KAAI,CAAA;AAG/F,QAAMC,UAAU,OAAOX,mBAAWY,IAAIJ,qBAAaK,gBAAgB;AAEnE,QAAMC,iBAAgCR,MAAKK,SAAsDN,YAAAA;AAEjG,SAAO;IACLL,mBAAWe,YAAYP,qBAAaQ,cAAcX,YAAAA;IAClDL,mBAAWe,YAAYP,qBAAaS,gBAAgBH,cAAAA;;AAExD,CAAA,CAAA;",
|
|
6
|
+
"names": ["Effect", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "undoRegistry", "make", "getAll", "Capabilities", "UndoMapping", "flat", "invoker", "get", "OperationInvoker", "historyTracker", "contributes", "UndoRegistry", "HistoryTracker"]
|
|
7
|
+
}
|
|
@@ -2,9 +2,9 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
|
|
3
3
|
// src/context.ts
|
|
4
4
|
import { createContext } from "@dxos/web-context";
|
|
5
|
-
var PluginManagerContext = createContext("dxos.
|
|
5
|
+
var PluginManagerContext = createContext("org.dxos.app-framework.plugin-manager");
|
|
6
6
|
|
|
7
7
|
export {
|
|
8
8
|
PluginManagerContext
|
|
9
9
|
};
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-37Z53PXZ.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/context.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@dxos/web-context';\n\nimport { type PluginManager } from './core';\n\nexport const PluginManagerContext = createContext<PluginManager.PluginManager>('dxos.
|
|
5
|
-
"mappings": ";;;AAIA,SAASA,qBAAqB;AAIvB,IAAMC,
|
|
6
|
-
"names": ["createContext", "PluginManagerContext"
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@dxos/web-context';\n\nimport { type PluginManager } from './core';\n\nexport const PluginManagerContext = createContext<PluginManager.PluginManager>('org.dxos.app-framework.plugin-manager');\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,qBAAqB;AAIvB,IAAMC,uBAAuBD,cAA2C,uCAAA;",
|
|
6
|
+
"names": ["createContext", "PluginManagerContext"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
activation_event_exports
|
|
4
|
+
} from "./chunk-XOCUANHO.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__export
|
|
7
|
+
} from "./chunk-HSLMI22Q.mjs";
|
|
8
|
+
|
|
9
|
+
// src/common/activation-events.ts
|
|
10
|
+
var activation_events_exports = {};
|
|
11
|
+
__export(activation_events_exports, {
|
|
12
|
+
ManagedRuntimeReady: () => ManagedRuntimeReady,
|
|
13
|
+
OperationInvokerReady: () => OperationInvokerReady,
|
|
14
|
+
SetupLayer: () => SetupLayer,
|
|
15
|
+
SetupOperationHandler: () => SetupOperationHandler,
|
|
16
|
+
SetupReactSurface: () => SetupReactSurface,
|
|
17
|
+
Startup: () => Startup
|
|
18
|
+
});
|
|
19
|
+
var Startup = activation_event_exports.make("org.dxos.app-framework.event.startup");
|
|
20
|
+
var SetupReactSurface = activation_event_exports.make("org.dxos.app-framework.event.setup-react-surface");
|
|
21
|
+
var SetupOperationHandler = activation_event_exports.make("org.dxos.app-framework.event.setup-operation-handler");
|
|
22
|
+
var SetupLayer = activation_event_exports.make("org.dxos.app-framework.event.setup-layer");
|
|
23
|
+
var OperationInvokerReady = activation_event_exports.make("org.dxos.app-framework.event.operation-invoker-ready");
|
|
24
|
+
var ManagedRuntimeReady = activation_event_exports.make("org.dxos.app-framework.event.managed-runtime-ready");
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
Startup,
|
|
28
|
+
SetupReactSurface,
|
|
29
|
+
SetupOperationHandler,
|
|
30
|
+
SetupLayer,
|
|
31
|
+
OperationInvokerReady,
|
|
32
|
+
ManagedRuntimeReady,
|
|
33
|
+
activation_events_exports
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=chunk-6XW6LET6.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/common/activation-events.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { ActivationEvent as ActivationEvent$ } from '../core';\n\n/**\n * Fired when the app is started.\n */\nexport const Startup = ActivationEvent$.make('org.dxos.app-framework.event.startup');\n\n//\n// Dependent Events\n//\n\n/**\n * Fired to load any newly available surfaces.\n */\nexport const SetupReactSurface = ActivationEvent$.make('org.dxos.app-framework.event.setup-react-surface');\n\n/**\n * Fired before the operation invoker is activated.\n */\nexport const SetupOperationHandler = ActivationEvent$.make('org.dxos.app-framework.event.setup-operation-handler');\n\n/**\n * Fired before the managed runtime is created.\n * Plugins should contribute their Layer capabilities before this event.\n */\nexport const SetupLayer = ActivationEvent$.make('org.dxos.app-framework.event.setup-layer');\n\n//\n// Triggered Events\n//\n\n/**\n * Fired after the operation invoker is ready.\n */\nexport const OperationInvokerReady = ActivationEvent$.make('org.dxos.app-framework.event.operation-invoker-ready');\n\n/**\n * Fired after the managed runtime is ready.\n */\nexport const ManagedRuntimeReady = ActivationEvent$.make('org.dxos.app-framework.event.managed-runtime-ready');\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAAA;;;;;;;;;AASO,IAAMA,UAAUC,yBAAiBC,KAAK,sCAAA;AAStC,IAAMC,oBAAoBF,yBAAiBC,KAAK,kDAAA;AAKhD,IAAME,wBAAwBH,yBAAiBC,KAAK,sDAAA;AAMpD,IAAMG,aAAaJ,yBAAiBC,KAAK,0CAAA;AASzC,IAAMI,wBAAwBL,yBAAiBC,KAAK,sDAAA;AAKpD,IAAMK,sBAAsBN,yBAAiBC,KAAK,oDAAA;",
|
|
6
|
+
"names": ["Startup", "ActivationEvent$", "make", "SetupReactSurface", "SetupOperationHandler", "SetupLayer", "OperationInvokerReady", "ManagedRuntimeReady"]
|
|
7
|
+
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
UndoOperation
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-SBS2YMPT.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__export
|
|
7
7
|
} from "./chunk-HSLMI22Q.mjs";
|
|
8
8
|
|
|
9
9
|
// src/plugin-operation/history/errors.ts
|
|
10
|
-
import {
|
|
11
|
-
var EmptyHistoryError = class extends
|
|
12
|
-
constructor() {
|
|
13
|
-
super("EMPTY_HISTORY", "Cannot undo: history is empty.");
|
|
14
|
-
}
|
|
10
|
+
import { BaseError } from "@dxos/errors";
|
|
11
|
+
var EmptyHistoryError = class extends BaseError.extend("EmptyHistoryError", "Cannot undo: history is empty.") {
|
|
15
12
|
};
|
|
16
13
|
|
|
17
14
|
// src/plugin-operation/history/undo-mapping.ts
|
|
@@ -76,12 +73,7 @@ var make3 = (invoker, undoRegistry) => {
|
|
|
76
73
|
if (inverseInput === void 0) {
|
|
77
74
|
log("operation not undoable", {
|
|
78
75
|
key: event.operation.meta.key
|
|
79
|
-
}, {
|
|
80
|
-
F: __dxlog_file,
|
|
81
|
-
L: 58,
|
|
82
|
-
S: void 0,
|
|
83
|
-
C: (f, a) => f(...a)
|
|
84
|
-
});
|
|
76
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 29, S: void 0 });
|
|
85
77
|
return;
|
|
86
78
|
}
|
|
87
79
|
const entry = {
|
|
@@ -96,12 +88,7 @@ var make3 = (invoker, undoRegistry) => {
|
|
|
96
88
|
log("history entry added", {
|
|
97
89
|
key: event.operation.meta.key,
|
|
98
90
|
historyLength: history.length
|
|
99
|
-
}, {
|
|
100
|
-
F: __dxlog_file,
|
|
101
|
-
L: 72,
|
|
102
|
-
S: void 0,
|
|
103
|
-
C: (f, a) => f(...a)
|
|
104
|
-
});
|
|
91
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 43, S: void 0 });
|
|
105
92
|
if (history.length > HISTORY_LIMIT) {
|
|
106
93
|
history.splice(0, history.length - HISTORY_LIMIT);
|
|
107
94
|
}
|
|
@@ -120,31 +107,16 @@ var make3 = (invoker, undoRegistry) => {
|
|
|
120
107
|
log("undoing operation", {
|
|
121
108
|
key: entry.operation.meta.key,
|
|
122
109
|
inverseKey: entry.inverse.meta.key
|
|
123
|
-
}, {
|
|
124
|
-
F: __dxlog_file,
|
|
125
|
-
L: 102,
|
|
126
|
-
S: this,
|
|
127
|
-
C: (f, a) => f(...a)
|
|
128
|
-
});
|
|
110
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 65, S: this });
|
|
129
111
|
yield* invoker._invokeCore(entry.inverse, entry.inverseInput);
|
|
130
112
|
log("undo completed", {
|
|
131
113
|
key: entry.operation.meta.key
|
|
132
|
-
}, {
|
|
133
|
-
F: __dxlog_file,
|
|
134
|
-
L: 107,
|
|
135
|
-
S: this,
|
|
136
|
-
C: (f, a) => f(...a)
|
|
137
|
-
});
|
|
114
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 71, S: this });
|
|
138
115
|
});
|
|
139
116
|
};
|
|
140
117
|
const undoPromise = async () => {
|
|
141
118
|
return runAndForwardErrors(undo()).then(() => ({})).catch((error) => {
|
|
142
|
-
log.catch(error, void 0, {
|
|
143
|
-
F: __dxlog_file,
|
|
144
|
-
L: 115,
|
|
145
|
-
S: void 0,
|
|
146
|
-
C: (f, a) => f(...a)
|
|
147
|
-
});
|
|
119
|
+
log.catch(error, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 78, S: void 0 });
|
|
148
120
|
return {
|
|
149
121
|
error
|
|
150
122
|
};
|
|
@@ -168,4 +140,4 @@ export {
|
|
|
168
140
|
make3 as make2,
|
|
169
141
|
history_tracker_exports
|
|
170
142
|
};
|
|
171
|
-
//# sourceMappingURL=chunk-
|
|
143
|
+
//# sourceMappingURL=chunk-D347W3KO.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/plugin-operation/history/errors.ts", "../../../src/plugin-operation/history/undo-mapping.ts", "../../../src/plugin-operation/history/undo-registry.ts", "../../../src/plugin-operation/history/history-tracker.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { BaseError } from '@dxos/errors';\n\nexport class EmptyHistoryError extends BaseError.extend('EmptyHistoryError', 'Cannot undo: history is empty.') {}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type { Operation } from '@dxos/compute';\n\n/**\n * Label type for translatable text (canonical definition in @dxos/app-toolkit).\n */\ntype Label = string | [string, { ns: string; count?: number; defaultValue?: string }];\n\n/**\n * Extract the input type from an OperationDefinition.\n */\nexport type InputOf<T> = T extends Operation.Definition<infer I, any> ? I : never;\n\n/**\n * Extract the output type from an OperationDefinition.\n */\nexport type OutputOf<T> = T extends Operation.Definition<any, infer O> ? O : never;\n\n/**\n * Message provider for undo toast.\n * Can be a static Label or a function that derives the message from input/output.\n */\nexport type MessageProvider<Op extends Operation.Definition<any, any>> =\n | Label\n | ((input: InputOf<Op>, output: OutputOf<Op>) => Label);\n\n/**\n * Undo mapping that links a forward operation to its inverse.\n * Type parameters ensure deriveContext has correctly typed arguments.\n *\n * @template Op - The forward operation definition type.\n * @template Inv - The inverse operation definition type.\n */\nexport interface UndoMapping<\n Op extends Operation.Definition<any, any> = Operation.Definition<any, any>,\n Inv extends Operation.Definition<any, any> = Operation.Definition<any, any>,\n> {\n /** The forward operation. */\n readonly operation: Op;\n\n /** The inverse operation to invoke for undo. */\n readonly inverse: Inv;\n\n /**\n * Derives the input for the inverse operation from the forward operation's input and output.\n * @param input - The input that was passed to the forward operation.\n * @param output - The output that was returned by the forward operation.\n * @returns The input to pass to the inverse operation, or undefined to indicate the operation is not undoable.\n */\n readonly deriveContext: (input: InputOf<Op>, output: OutputOf<Op>) => InputOf<Inv> | undefined;\n\n /**\n * Optional message to show in the undo toast.\n * Can be a static Label or a function that derives the message from input/output.\n */\n readonly message?: MessageProvider<Op>;\n}\n\n/**\n * Props for creating an UndoMapping.\n */\nexport interface UndoMappingProps<\n Op extends Operation.Definition<any, any>,\n Inv extends Operation.Definition<any, any>,\n> {\n /** The forward operation. */\n operation: Op;\n\n /** The inverse operation to invoke for undo. */\n inverse: Inv;\n\n /**\n * Derives the input for the inverse operation from the forward operation's input and output.\n * Return undefined to indicate the operation is not undoable.\n */\n deriveContext: (input: InputOf<Op>, output: OutputOf<Op>) => InputOf<Inv> | undefined;\n\n /**\n * Optional message to show in the undo toast.\n * Can be a static Label or a function that derives the message from input/output.\n */\n message?: MessageProvider<Op>;\n}\n\n/**\n * Creates a type-safe undo mapping.\n *\n * @example\n * ```ts\n * // Static message\n * const mapping = UndoMapping.make({\n * operation: DeleteThread,\n * inverse: RestoreThread,\n * deriveContext: (input, output) => ({\n * thread: output.thread,\n * anchor: output.anchor,\n * }),\n * message: ['thread deleted label', { ns: '@dxos/plugin-thread' }],\n * });\n *\n * // Dynamic message based on input/output\n * const mapping = UndoMapping.make({\n * operation: RemoveObjects,\n * inverse: RestoreObjects,\n * deriveContext: (_input, output) => output,\n * message: (input, _output) =>\n * input.objects.length === 1\n * ? ['object deleted label', { ns: getTypename(input.objects[0]) }]\n * : ['objects deleted label', { ns: '@dxos/plugin-space' }],\n * });\n * ```\n */\nexport const make = <Op extends Operation.Definition<any, any>, Inv extends Operation.Definition<any, any>>(\n props: UndoMappingProps<Op, Inv>,\n): UndoMapping<Op, Inv> => props;\n\n/**\n * Resolves a message provider to a Label.\n */\nexport const resolveMessage = <Op extends Operation.Definition<any, any>>(\n message: MessageProvider<Op> | undefined,\n input: InputOf<Op>,\n output: OutputOf<Op>,\n): Label | undefined => {\n if (message === undefined) {\n return undefined;\n }\n if (typeof message === 'function') {\n return message(input, output);\n }\n return message;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type { Operation } from '@dxos/compute';\n\nimport type * as UndoMapping from './undo-mapping';\n\n//\n// Public Interface\n//\n\n/**\n * Lookup result from UndoRegistry.\n */\nexport type UndoMappingResult = {\n inverse: Operation.Definition<any, any>;\n /** Returns undefined to indicate the operation is not undoable. */\n deriveContext: (input: any, output: any) => any | undefined;\n /** Message provider - may be a static Label or a function. */\n message?: UndoMapping.MessageProvider<Operation.Definition<any, any>>;\n};\n\n/**\n * UndoRegistry interface - looks up inverse operations.\n */\nexport interface UndoRegistry {\n lookup: (operation: Operation.Definition<any, any>) => UndoMappingResult | undefined;\n}\n\n//\n// Factory\n//\n\n/**\n * Creates an UndoRegistry that looks up inverse operations.\n */\nexport const make = (getMappings: () => UndoMapping.UndoMapping[]): UndoRegistry => {\n const lookup = (operation: Operation.Definition<any, any>): UndoMappingResult | undefined => {\n const mappings = getMappings();\n const mapping = mappings.find((m) => m.operation.meta.key === operation.meta.key);\n if (!mapping) {\n return undefined;\n }\n\n return {\n inverse: mapping.inverse,\n deriveContext: mapping.deriveContext,\n message: mapping.message,\n };\n };\n\n return { lookup };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Stream from 'effect/Stream';\n\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { log } from '@dxos/log';\nimport { OperationInvoker } from '@dxos/operation';\n\nimport { UndoOperation } from '../../common';\nimport { EmptyHistoryError } from './errors';\nimport type { HistoryEntry } from './types';\nimport { resolveMessage } from './undo-mapping';\nimport type { UndoRegistry } from './undo-registry';\n\nconst HISTORY_LIMIT = 100;\n\n//\n// Public Interface\n//\n\n/**\n * HistoryTracker interface - tracks operation history and provides undo.\n */\nexport interface HistoryTracker {\n undo: () => Effect.Effect<void, Error>;\n undoPromise: () => Promise<{ error?: Error }>;\n canUndo: () => boolean;\n}\n\n//\n// Factory\n//\n\n/**\n * Creates a HistoryTracker that subscribes to invocation events and provides undo.\n */\nexport const make = (\n invoker: OperationInvoker.OperationInvokerInternal,\n undoRegistry: UndoRegistry,\n): HistoryTracker => {\n const history: HistoryEntry[] = [];\n\n // Subscribe to invocation stream.\n const handleInvocation = (event: OperationInvoker.InvocationEvent) => {\n const mapping = undoRegistry.lookup(event.operation);\n if (!mapping) {\n // Operation is not undoable, skip.\n return;\n }\n\n const inverseInput = mapping.deriveContext(event.input, event.output);\n if (inverseInput === undefined) {\n // Operation is conditionally not undoable (deriveContext returned undefined).\n log('operation not undoable', { key: event.operation.meta.key });\n return;\n }\n\n const entry: HistoryEntry = {\n operation: event.operation,\n input: event.input,\n output: event.output,\n inverse: mapping.inverse,\n inverseInput,\n timestamp: event.timestamp,\n };\n\n history.push(entry);\n log('history entry added', { key: event.operation.meta.key, historyLength: history.length });\n\n // Trim history if it exceeds limit.\n if (history.length > HISTORY_LIMIT) {\n history.splice(0, history.length - HISTORY_LIMIT);\n }\n\n // Show undo toast (resolve message if it's a function).\n const resolvedMessage = resolveMessage(mapping.message, event.input, event.output);\n Effect.runFork(\n invoker.invoke(UndoOperation.ShowUndo, {\n message: resolvedMessage,\n }),\n );\n };\n\n // Fork a fiber to consume the invocation stream.\n Effect.runFork(\n Stream.fromPubSub(invoker.invocations).pipe(\n Stream.runForEach((event) => Effect.sync(() => handleInvocation(event))),\n ),\n );\n\n const undo = (): Effect.Effect<void, Error> => {\n return Effect.gen(function* () {\n const entry = history.pop();\n if (!entry) {\n return yield* Effect.fail(new EmptyHistoryError());\n }\n\n log('undoing operation', { key: entry.operation.meta.key, inverseKey: entry.inverse.meta.key });\n\n // Use _invokeCore to skip event emission (avoid undo-of-undo loops).\n yield* invoker._invokeCore(entry.inverse, entry.inverseInput);\n\n log('undo completed', { key: entry.operation.meta.key });\n });\n };\n\n const undoPromise = async (): Promise<{ error?: Error }> => {\n return runAndForwardErrors(undo())\n .then(() => ({}))\n .catch((error) => {\n log.catch(error);\n return { error };\n });\n };\n\n const canUndo = (): boolean => {\n return history.length > 0;\n };\n\n return {\n undo,\n undoPromise,\n canUndo,\n };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;AAIA,SAASA,iBAAiB;AAEnB,IAAMC,oBAAN,cAAgCD,UAAUE,OAAO,qBAAqB,gCAAA,EAAA;AAAmC;;;ACNhH;;;;;AAmHO,IAAMC,OAAO,CAClBC,UACyBA;AAKpB,IAAMC,iBAAiB,CAC5BC,SACAC,OACAC,WAAAA;AAEA,MAAIF,YAAYG,QAAW;AACzB,WAAOA;EACT;AACA,MAAI,OAAOH,YAAY,YAAY;AACjC,WAAOA,QAAQC,OAAOC,MAAAA;EACxB;AACA,SAAOF;AACT;;;ACtIA;;cAAAI;;AAqCO,IAAMA,QAAO,CAACC,gBAAAA;AACnB,QAAMC,SAAS,CAACC,cAAAA;AACd,UAAMC,WAAWH,YAAAA;AACjB,UAAMI,UAAUD,SAASE,KAAK,CAACC,MAAMA,EAAEJ,UAAUK,KAAKC,QAAQN,UAAUK,KAAKC,GAAG;AAChF,QAAI,CAACJ,SAAS;AACZ,aAAOK;IACT;AAEA,WAAO;MACLC,SAASN,QAAQM;MACjBC,eAAeP,QAAQO;MACvBC,SAASR,QAAQQ;IACnB;EACF;AAEA,SAAO;IAAEX;EAAO;AAClB;;;ACrDA;;cAAAY;;AAIA,YAAYC,YAAY;AACxB,YAAYC,YAAY;AAExB,SAASC,2BAA2B;AACpC,SAASC,WAAW;AASpB,IAAA,eAAMC;AAgBN,IAAA,gBAAU;AAYR,IAAAC,QAAA,CAAA,SAAA,iBAAkC;AAClC,QAAMC,UAAAA,CAAAA;QAEJ,mBAAc,CAAA,UAAA;UACZ,UAAA,aAAA,OAAA,MAAmC,SAAA;QACnC,CAAA,SAAA;AAGF;IACA;UACE,eAAA,QAAA,cAAA,MAAA,OAAA,MAAA,MAAA;QACAC,iBAAI,QAAA;AAA0D,UAAA,0BAAA;QAC9D,KAAA,MAAA,UAAA,KAAA;MACF,GAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,OAAA,CAAA;AAEA;;UAEEC,QAAOC;MACPC,WAAQD,MAAMC;MACdC,OAAAA,MAASC;MACTC,QAAAA,MAAAA;MACAC,SAAAA,QAAiBA;MACnB;MAEAC,WAAaC,MAAAA;IACbT;YAA6BU,KAAKR,KAAMS;QAAoBC,uBAAuBC;MAAO,KAAA,MAAA,UAAA,KAAA;MAE1F,eAAA,QAAA;IACA,GAAA,EAAA,YAAYA,YAAShB,GAAAA,cAAe,GAAA,IAAA,GAAA,OAAA,CAAA;AAEpC,QAAA,QAAA,SAAA,eAAA;AAEA,cAAA,OAAA,GAAA,QAAA,SAAA,aAAA;IACA;UAGIiB,kBAASC,eAAAA,QAAAA,SAAAA,MAAAA,OAAAA,MAAAA,MAAAA;AACX,IAAA,eAAA,QAAA,OAAA,cAAA,UAAA;MAEJ,SAAA;IAEA,CAAA,CAAA;EACAC;EAOE,eAAkB,kBAAA,QAAA,WAAA,EAAA,KAAA,kBAAA,CAAA,UAAA,YAAA,MAAA,iBAAA,KAAA,CAAA,CAAA,CAAA,CAAA;eAChB,MAAMP;WACDA,WAAO,aAAA;YACV,QAAO,QAAOO,IAAOC;AACvB,UAAA,CAAA,OAAA;AAEI,eAAA,OAAqB,YAAA,IAAA,kBAAA,CAAA;;UAAiCC,qBAAkBd;QAAiB,KAAA,MAAA,UAAA,KAAA;QAE7F,YAAA,MAAA,QAAA,KAAA;MACA,GAAA,EAAA,YAAOe,YAAQC,GAAYX,cAAa,GAAEA,IAAAA,GAAAA,KAAMH,CAAAA;aAExBI,QAAWC,YAAUU,MAAQ,SAAA,MAAA,YAAA;AAAC,UAAA,kBAAA;QACxD,KAAA,MAAA,UAAA,KAAA;MACF,GAAA,EAAA,YAAA,YAAA,GAAA,cAAA,GAAA,IAAA,GAAA,KAAA,CAAA;IAEA,CAAA;;sBAIgBC,YAAAA;WACV,oBAAO,KAAA,CAAA,EAAA,KAAA,OAAA,CAAA,EAAA,EAAA,MAAA,CAAA,UAAA;UAAEA,MAAAA,OAAAA,QAAAA,EAAAA,YAAAA,YAAAA,GAAAA,cAAAA,GAAAA,IAAAA,GAAAA,OAAAA,CAAAA;AAAM,aAAA;QACjB;MACJ;IAEA,CAAA;;AAEA,QAAA,UAAA,MAAA;AAEA,WAAO,QAAA,SAAA;;SAELC;IACAC;IACF;IACA;;;",
|
|
6
|
+
"names": ["BaseError", "EmptyHistoryError", "extend", "make", "props", "resolveMessage", "message", "input", "output", "undefined", "make", "getMappings", "lookup", "operation", "mappings", "mapping", "find", "m", "meta", "key", "undefined", "inverse", "deriveContext", "message", "make", "Effect", "Stream", "runAndForwardErrors", "log", "HISTORY_LIMIT", "make", "handleInvocation", "log", "input", "event", "output", "inverse", "mapping", "inverseInput", "timestamp", "history", "entry", "key", "operation", "historyLength", "length", "message", "resolvedMessage", "Effect", "fail", "inverseKey", "invoker", "_invokeCore", "meta", "error", "undoPromise", "canUndo"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
PluginManagerProvider,
|
|
4
|
+
topologicalSort,
|
|
5
|
+
usePluginManager
|
|
6
|
+
} from "./chunk-V24UWT36.mjs";
|
|
7
|
+
import {
|
|
8
|
+
PluginManagerContext
|
|
9
|
+
} from "./chunk-37Z53PXZ.mjs";
|
|
10
|
+
import {
|
|
11
|
+
capabilities_exports
|
|
12
|
+
} from "./chunk-WFSRZKBP.mjs";
|
|
13
|
+
import {
|
|
14
|
+
activation_events_exports
|
|
15
|
+
} from "./chunk-6XW6LET6.mjs";
|
|
16
|
+
import {
|
|
17
|
+
plugin_manager_exports
|
|
18
|
+
} from "./chunk-MUVUQC3G.mjs";
|
|
19
|
+
|
|
20
|
+
// src/ui/components/App/App.tsx
|
|
21
|
+
import React2, { useEffect as useEffect3 } from "react";
|
|
22
|
+
|
|
23
|
+
// src/ui/hooks/useApp.tsx
|
|
24
|
+
import { RegistryContext } from "@effect-atom/atom-react";
|
|
25
|
+
import * as Effect from "effect/Effect";
|
|
26
|
+
import * as Fiber from "effect/Fiber";
|
|
27
|
+
import * as PubSub from "effect/PubSub";
|
|
28
|
+
import * as Queue from "effect/Queue";
|
|
29
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
30
|
+
import { runAndForwardErrors } from "@dxos/effect";
|
|
31
|
+
import { invariant } from "@dxos/invariant";
|
|
32
|
+
import { log } from "@dxos/log";
|
|
33
|
+
import { ErrorBoundary, ErrorFallback } from "@dxos/react-error-boundary";
|
|
34
|
+
import { useAsyncEffect, useDefaultValue } from "@dxos/react-hooks";
|
|
35
|
+
import { ContextProtocolProvider } from "@dxos/web-context-react";
|
|
36
|
+
var __dxlog_file = "/__w/dxos/dxos/packages/sdk/app-framework/src/ui/hooks/useApp.tsx";
|
|
37
|
+
var ENABLED_KEY = "org.dxos.app-framework.enabled";
|
|
38
|
+
var useApp = ({ pluginManager, pluginLoader: pluginLoaderProp, onPluginRemove, pluginRegistryProvider, plugins: pluginsProp, core: coreProp, defaults: defaultsProp, setupEvents: setupEventsProp, placeholder, fallback = ErrorFallback, cacheEnabled = false, safeMode = false, debounce = 0, timeout = 3e4 }) => {
|
|
39
|
+
const plugins = useDefaultValue(pluginsProp, () => []);
|
|
40
|
+
const core = useDefaultValue(coreProp, () => plugins.map(({ meta }) => meta.id));
|
|
41
|
+
const defaults = useDefaultValue(defaultsProp, () => []);
|
|
42
|
+
const setupEvents = useDefaultValue(setupEventsProp, () => []);
|
|
43
|
+
const pluginLoader = useMemo(() => pluginLoaderProp ?? ((id) => Effect.sync(() => {
|
|
44
|
+
const plugin = plugins.find((plugin2) => plugin2.meta.id === id);
|
|
45
|
+
invariant(plugin, `Plugin not found: ${id}`, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 52, S: void 0, A: ["plugin", "`Plugin not found: ${id}`"] });
|
|
46
|
+
return {
|
|
47
|
+
plugin
|
|
48
|
+
};
|
|
49
|
+
})), [
|
|
50
|
+
pluginLoaderProp,
|
|
51
|
+
plugins
|
|
52
|
+
]);
|
|
53
|
+
const readyRef = useRef(false);
|
|
54
|
+
const [ready, setReady] = useState(false);
|
|
55
|
+
const errorRef = useRef(null);
|
|
56
|
+
const [error, setError] = useState(null);
|
|
57
|
+
const [startupProgress, setStartupProgress] = useState({
|
|
58
|
+
activated: 0,
|
|
59
|
+
total: 0,
|
|
60
|
+
progress: 0
|
|
61
|
+
});
|
|
62
|
+
const cached = useMemo(() => JSON.parse(localStorage.getItem(ENABLED_KEY) ?? "[]"), []);
|
|
63
|
+
const enabled = useMemo(() => safeMode ? [] : cacheEnabled && cached.length > 0 ? cached : defaults, [
|
|
64
|
+
safeMode,
|
|
65
|
+
cacheEnabled,
|
|
66
|
+
cached,
|
|
67
|
+
defaults
|
|
68
|
+
]);
|
|
69
|
+
const isExternalManager = !!pluginManager;
|
|
70
|
+
const manager = useMemo(() => {
|
|
71
|
+
const mgr = pluginManager ?? plugin_manager_exports.make({
|
|
72
|
+
pluginLoader,
|
|
73
|
+
plugins,
|
|
74
|
+
core,
|
|
75
|
+
enabled,
|
|
76
|
+
onRemove: onPluginRemove,
|
|
77
|
+
pluginRegistryProvider
|
|
78
|
+
});
|
|
79
|
+
log("useApp: useMemo created/reused manager", {
|
|
80
|
+
provided: !!pluginManager
|
|
81
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 87, S: void 0 });
|
|
82
|
+
return mgr;
|
|
83
|
+
}, [
|
|
84
|
+
pluginManager,
|
|
85
|
+
pluginLoader,
|
|
86
|
+
plugins,
|
|
87
|
+
core,
|
|
88
|
+
enabled,
|
|
89
|
+
onPluginRemove,
|
|
90
|
+
pluginRegistryProvider
|
|
91
|
+
]);
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
if (!cacheEnabled) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
return manager.registry.subscribe(manager.enabled, (value) => {
|
|
97
|
+
localStorage.setItem(ENABLED_KEY, JSON.stringify(value));
|
|
98
|
+
});
|
|
99
|
+
}, [
|
|
100
|
+
cacheEnabled,
|
|
101
|
+
manager
|
|
102
|
+
]);
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
setupDevtools(manager);
|
|
105
|
+
}, [
|
|
106
|
+
manager
|
|
107
|
+
]);
|
|
108
|
+
useAsyncEffect(async () => {
|
|
109
|
+
log("useApp: effect mount", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 117, S: void 0 });
|
|
110
|
+
manager.capabilities.contribute({
|
|
111
|
+
interface: capabilities_exports.PluginManager,
|
|
112
|
+
implementation: manager,
|
|
113
|
+
module: "org.dxos.app-framework.plugin-manager"
|
|
114
|
+
});
|
|
115
|
+
manager.capabilities.contribute({
|
|
116
|
+
interface: capabilities_exports.AtomRegistry,
|
|
117
|
+
implementation: manager.registry,
|
|
118
|
+
module: "org.dxos.app-framework.atom-registry"
|
|
119
|
+
});
|
|
120
|
+
const fiber = Effect.gen(function* () {
|
|
121
|
+
const queue = yield* PubSub.subscribe(manager.activation);
|
|
122
|
+
const listener = yield* Effect.forkDaemon(Queue.take(queue).pipe(Effect.tap(({ event, state, module, error: error$ }) => Effect.sync(() => {
|
|
123
|
+
if (event === activation_events_exports.Startup.id && state === "activated" && !module) {
|
|
124
|
+
clearTimeout(timeoutId);
|
|
125
|
+
setReady(true);
|
|
126
|
+
readyRef.current = true;
|
|
127
|
+
globalThis.composer?.profiler?.dump();
|
|
128
|
+
if (typeof window !== "undefined") {
|
|
129
|
+
window.dispatchEvent(new CustomEvent("app-framework:startup-activated"));
|
|
130
|
+
}
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (module && state === "activating" && !readyRef.current) {
|
|
134
|
+
setStartupProgress((current) => ({
|
|
135
|
+
...current,
|
|
136
|
+
// `event` here is the activation event that first
|
|
137
|
+
// triggered this module load (plumbed through
|
|
138
|
+
// `_loadCapabilitiesForModules` → `_loadModule`).
|
|
139
|
+
// Falsy/empty falls back to undefined so consumers can
|
|
140
|
+
// tell "no parent context" from "parent context: <X>".
|
|
141
|
+
event: event || void 0,
|
|
142
|
+
module,
|
|
143
|
+
humanizedName: humanizeModuleId(module)
|
|
144
|
+
}));
|
|
145
|
+
}
|
|
146
|
+
if (module && state === "activated" && !readyRef.current) {
|
|
147
|
+
const active = manager.getActive();
|
|
148
|
+
const total = manager.getModules().length;
|
|
149
|
+
setStartupProgress((current) => ({
|
|
150
|
+
...current,
|
|
151
|
+
activated: active.length,
|
|
152
|
+
total,
|
|
153
|
+
progress: total > 0 ? active.length / total : 0
|
|
154
|
+
}));
|
|
155
|
+
}
|
|
156
|
+
if (event && !module && state === "activating" && !readyRef.current) {
|
|
157
|
+
setStartupProgress((current) => ({
|
|
158
|
+
...current,
|
|
159
|
+
event,
|
|
160
|
+
module: void 0,
|
|
161
|
+
humanizedName: humanizeEventKey(event)
|
|
162
|
+
}));
|
|
163
|
+
}
|
|
164
|
+
if (error$ && !readyRef.current) {
|
|
165
|
+
setError(error$);
|
|
166
|
+
errorRef.current = error$;
|
|
167
|
+
}
|
|
168
|
+
})), Effect.forever));
|
|
169
|
+
yield* Effect.all([
|
|
170
|
+
...setupEvents.map((event) => manager.activate(event)),
|
|
171
|
+
manager.activate(activation_events_exports.SetupReactSurface),
|
|
172
|
+
manager.activate(activation_events_exports.Startup)
|
|
173
|
+
]);
|
|
174
|
+
return yield* Fiber.join(listener);
|
|
175
|
+
}).pipe(Effect.scoped, Effect.runFork);
|
|
176
|
+
const timeoutId = setTimeout(() => {
|
|
177
|
+
if (!readyRef.current && !errorRef.current) {
|
|
178
|
+
log.warn("startup timeout diagnostic", {
|
|
179
|
+
eventsFired: manager.getEventsFired(),
|
|
180
|
+
activeModules: manager.getActive(),
|
|
181
|
+
pendingReset: manager.getPendingReset()
|
|
182
|
+
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 224, S: void 0 });
|
|
183
|
+
void runAndForwardErrors(Fiber.interrupt(fiber));
|
|
184
|
+
setError(new Error(`Startup timed out after ${timeout}ms`));
|
|
185
|
+
}
|
|
186
|
+
}, timeout);
|
|
187
|
+
return () => {
|
|
188
|
+
log("useApp: effect cleanup", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 234, S: void 0 });
|
|
189
|
+
clearTimeout(timeoutId);
|
|
190
|
+
void runAndForwardErrors(Fiber.interrupt(fiber));
|
|
191
|
+
if (!isExternalManager) {
|
|
192
|
+
void runAndForwardErrors(manager.shutdown());
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}, [
|
|
196
|
+
manager
|
|
197
|
+
]);
|
|
198
|
+
const progressRef = useRef(startupProgress);
|
|
199
|
+
progressRef.current = startupProgress;
|
|
200
|
+
return useCallback(() => /* @__PURE__ */ React.createElement(ErrorBoundary, {
|
|
201
|
+
name: "app",
|
|
202
|
+
FallbackComponent: fallback
|
|
203
|
+
}, /* @__PURE__ */ React.createElement(PluginManagerProvider, {
|
|
204
|
+
value: manager
|
|
205
|
+
}, /* @__PURE__ */ React.createElement(ContextProtocolProvider, {
|
|
206
|
+
value: manager,
|
|
207
|
+
context: PluginManagerContext
|
|
208
|
+
}, /* @__PURE__ */ React.createElement(RegistryContext.Provider, {
|
|
209
|
+
value: manager.registry
|
|
210
|
+
}, /* @__PURE__ */ React.createElement(App, {
|
|
211
|
+
placeholder,
|
|
212
|
+
ready,
|
|
213
|
+
error,
|
|
214
|
+
debounce,
|
|
215
|
+
progress: progressRef.current
|
|
216
|
+
}))))), [
|
|
217
|
+
fallback,
|
|
218
|
+
manager,
|
|
219
|
+
placeholder,
|
|
220
|
+
ready,
|
|
221
|
+
error
|
|
222
|
+
]);
|
|
223
|
+
};
|
|
224
|
+
var setupDevtools = (manager) => {
|
|
225
|
+
globalThis.composer ??= {};
|
|
226
|
+
globalThis.composer.manager = manager;
|
|
227
|
+
};
|
|
228
|
+
var humanizeModuleId = (moduleId) => {
|
|
229
|
+
const match = moduleId.match(/\.plugin\.([^.]+)\.module\.(.+)$/);
|
|
230
|
+
if (!match) {
|
|
231
|
+
const parts = moduleId.split(".");
|
|
232
|
+
return parts[parts.length - 1];
|
|
233
|
+
}
|
|
234
|
+
const [, pluginSlug, moduleName] = match;
|
|
235
|
+
const pluginLabel = pluginSlug.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
236
|
+
const moduleLabel = moduleName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").toLowerCase();
|
|
237
|
+
if (moduleLabel === pluginSlug) {
|
|
238
|
+
return pluginLabel;
|
|
239
|
+
}
|
|
240
|
+
return `${pluginLabel}: ${moduleLabel}`;
|
|
241
|
+
};
|
|
242
|
+
var humanizeEventKey = (eventKey) => {
|
|
243
|
+
const id = eventKey.split(":")[0];
|
|
244
|
+
const match = id.match(/\.event\.(.+)$/);
|
|
245
|
+
const slug = match ? match[1] : id.split(".").pop() ?? id;
|
|
246
|
+
return slug.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// src/ui/hooks/useCapabilities.ts
|
|
250
|
+
import { useAtomValue } from "@effect-atom/atom-react";
|
|
251
|
+
import { useCallback as useCallback2 } from "react";
|
|
252
|
+
import { invariant as invariant2 } from "@dxos/invariant";
|
|
253
|
+
var __dxlog_file2 = "/__w/dxos/dxos/packages/sdk/app-framework/src/ui/hooks/useCapabilities.ts";
|
|
254
|
+
var useCapabilities = (interfaceDef) => {
|
|
255
|
+
const manager = usePluginManager();
|
|
256
|
+
return useAtomValue(manager.capabilities.atom(interfaceDef));
|
|
257
|
+
};
|
|
258
|
+
var useCapability = (interfaceDef) => {
|
|
259
|
+
const capabilities = useCapabilities(interfaceDef);
|
|
260
|
+
invariant2(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 22, S: void 0, A: ["capabilities.length > 0", "`No capability found for ${interfaceDef.identifier}`"] });
|
|
261
|
+
return capabilities[0];
|
|
262
|
+
};
|
|
263
|
+
var useAtomCapability = (atomCapability) => {
|
|
264
|
+
const atom = useCapability(atomCapability);
|
|
265
|
+
return useAtomValue(atom);
|
|
266
|
+
};
|
|
267
|
+
var useAtomCapabilityState = (atomCapability) => {
|
|
268
|
+
const registry = useCapability(capabilities_exports.AtomRegistry);
|
|
269
|
+
const atom = useCapability(atomCapability);
|
|
270
|
+
const value = useAtomValue(atom);
|
|
271
|
+
const update = useCallback2((fn) => {
|
|
272
|
+
registry.set(atom, fn(registry.get(atom)));
|
|
273
|
+
}, [
|
|
274
|
+
registry,
|
|
275
|
+
atom
|
|
276
|
+
]);
|
|
277
|
+
return [
|
|
278
|
+
value,
|
|
279
|
+
update
|
|
280
|
+
];
|
|
281
|
+
};
|
|
282
|
+
var useOperationInvoker = () => useCapability(capabilities_exports.OperationInvoker);
|
|
283
|
+
|
|
284
|
+
// src/ui/hooks/useLoading.tsx
|
|
285
|
+
import { useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
286
|
+
var LoadingState = /* @__PURE__ */ (function(LoadingState2) {
|
|
287
|
+
LoadingState2[LoadingState2["Loading"] = 0] = "Loading";
|
|
288
|
+
LoadingState2[LoadingState2["FadeIn"] = 1] = "FadeIn";
|
|
289
|
+
LoadingState2[LoadingState2["FadeOut"] = 2] = "FadeOut";
|
|
290
|
+
LoadingState2[LoadingState2["Done"] = 3] = "Done";
|
|
291
|
+
return LoadingState2;
|
|
292
|
+
})({});
|
|
293
|
+
var useLoading = (ready, debounce = 0) => {
|
|
294
|
+
const [stage, setStage] = useState2(0);
|
|
295
|
+
const readyRef = useRef2(ready);
|
|
296
|
+
readyRef.current = ready;
|
|
297
|
+
useEffect2(() => {
|
|
298
|
+
if (!debounce) {
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
const i = setInterval(() => {
|
|
302
|
+
setStage((stage2) => {
|
|
303
|
+
const isReady = readyRef.current;
|
|
304
|
+
switch (stage2) {
|
|
305
|
+
case 0: {
|
|
306
|
+
if (!isReady) {
|
|
307
|
+
return 1;
|
|
308
|
+
}
|
|
309
|
+
clearInterval(i);
|
|
310
|
+
return 3;
|
|
311
|
+
}
|
|
312
|
+
case 1: {
|
|
313
|
+
if (isReady) {
|
|
314
|
+
return 2;
|
|
315
|
+
}
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
case 2: {
|
|
319
|
+
clearInterval(i);
|
|
320
|
+
return 3;
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return stage2;
|
|
324
|
+
});
|
|
325
|
+
}, debounce);
|
|
326
|
+
return () => clearInterval(i);
|
|
327
|
+
}, [
|
|
328
|
+
debounce
|
|
329
|
+
]);
|
|
330
|
+
if (!debounce) {
|
|
331
|
+
return ready ? 3 : 0;
|
|
332
|
+
}
|
|
333
|
+
return stage;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
// src/ui/hooks/useSettingsState.ts
|
|
337
|
+
import { RegistryContext as RegistryContext2, useAtomValue as useAtomValue2 } from "@effect-atom/atom-react";
|
|
338
|
+
import { useCallback as useCallback3, useContext } from "react";
|
|
339
|
+
var useSettingsState = (atom) => {
|
|
340
|
+
const registry = useContext(RegistryContext2);
|
|
341
|
+
const settings = useAtomValue2(atom);
|
|
342
|
+
const updateSettings = useCallback3((fn) => {
|
|
343
|
+
registry.set(atom, fn(registry.get(atom)));
|
|
344
|
+
}, [
|
|
345
|
+
registry,
|
|
346
|
+
atom
|
|
347
|
+
]);
|
|
348
|
+
return {
|
|
349
|
+
settings,
|
|
350
|
+
updateSettings
|
|
351
|
+
};
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
// src/ui/components/App/App.tsx
|
|
355
|
+
var FIRST_INTERACTIVE_MARK = "app-framework:first-interactive";
|
|
356
|
+
var App = ({ placeholder: Placeholder2, ready, error, debounce, progress }) => {
|
|
357
|
+
const reactContexts = useCapabilities(capabilities_exports.ReactContext);
|
|
358
|
+
const reactRoots = useCapabilities(capabilities_exports.ReactRoot);
|
|
359
|
+
const stage = useLoading(ready, debounce);
|
|
360
|
+
const placeholderDismissed = stage >= LoadingState.Done;
|
|
361
|
+
useEffect3(() => {
|
|
362
|
+
if (!placeholderDismissed) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (performance.getEntriesByName(FIRST_INTERACTIVE_MARK).length === 0) {
|
|
366
|
+
performance.mark(FIRST_INTERACTIVE_MARK);
|
|
367
|
+
}
|
|
368
|
+
window.__bootLoader?.dismiss?.();
|
|
369
|
+
}, [
|
|
370
|
+
placeholderDismissed
|
|
371
|
+
]);
|
|
372
|
+
if (error) {
|
|
373
|
+
throw error;
|
|
374
|
+
}
|
|
375
|
+
if (!placeholderDismissed) {
|
|
376
|
+
if (!Placeholder2) {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
return /* @__PURE__ */ React2.createElement(Placeholder2, {
|
|
380
|
+
stage,
|
|
381
|
+
progress
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
const ComposedContext = composeContexts(reactContexts);
|
|
385
|
+
return /* @__PURE__ */ React2.createElement(ComposedContext, null, reactRoots.map(({ id, root: Component }) => /* @__PURE__ */ React2.createElement(Component, {
|
|
386
|
+
key: id
|
|
387
|
+
})));
|
|
388
|
+
};
|
|
389
|
+
var composeContexts = (contexts) => {
|
|
390
|
+
if (contexts.length === 0) {
|
|
391
|
+
return ({ children }) => /* @__PURE__ */ React2.createElement(React2.Fragment, null, children);
|
|
392
|
+
}
|
|
393
|
+
return topologicalSort(contexts).map(({ context }) => context).reduce((Acc, Next) => ({ children }) => /* @__PURE__ */ React2.createElement(Acc, null, /* @__PURE__ */ React2.createElement(Next, null, children)));
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
// src/ui/components/Placeholder/Placeholder.tsx
|
|
397
|
+
import React3, { useEffect as useEffect4, useLayoutEffect, useRef as useRef3 } from "react";
|
|
398
|
+
import { ThemeProvider } from "@dxos/react-ui";
|
|
399
|
+
import { defaultTx, mx } from "@dxos/ui-theme";
|
|
400
|
+
var Placeholder = ({ stage = 1, progress, logo }) => {
|
|
401
|
+
if (location.search === "?throw") {
|
|
402
|
+
throw new Error("Test error");
|
|
403
|
+
}
|
|
404
|
+
useEffect4(() => {
|
|
405
|
+
if (stage >= 2) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
const fraction = progress?.progress ?? 0;
|
|
409
|
+
window.__bootLoader?.progress(0.5 + fraction * 0.5);
|
|
410
|
+
if (progress?.humanizedName) {
|
|
411
|
+
window.__bootLoader?.status({
|
|
412
|
+
event: progress.event,
|
|
413
|
+
module: progress.module,
|
|
414
|
+
humanized: `Activating ${progress.humanizedName}`
|
|
415
|
+
});
|
|
416
|
+
}
|
|
417
|
+
}, [
|
|
418
|
+
stage,
|
|
419
|
+
progress?.progress,
|
|
420
|
+
progress?.event,
|
|
421
|
+
progress?.module,
|
|
422
|
+
progress?.humanizedName
|
|
423
|
+
]);
|
|
424
|
+
useLayoutEffect(() => {
|
|
425
|
+
if (stage >= 2) {
|
|
426
|
+
window.__bootLoader?.dismiss();
|
|
427
|
+
}
|
|
428
|
+
}, [
|
|
429
|
+
stage
|
|
430
|
+
]);
|
|
431
|
+
const stageRef = useRef3(stage);
|
|
432
|
+
stageRef.current = stage;
|
|
433
|
+
useEffect4(() => {
|
|
434
|
+
return () => {
|
|
435
|
+
if (stageRef.current >= 3) {
|
|
436
|
+
window.__bootLoader?.dismiss();
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
}, []);
|
|
440
|
+
if (stage < 2) {
|
|
441
|
+
return null;
|
|
442
|
+
}
|
|
443
|
+
const logoClassName = mx("h-[300px] w-[300px] scale-600 transition-all duration-500 ease-in-out filter grayscale opacity-0", stage >= 1 && "scale-100 grayscale-0 opacity-70", stage >= 2 && "scale-50 opacity-0");
|
|
444
|
+
return /* @__PURE__ */ React3.createElement(ThemeProvider, {
|
|
445
|
+
tx: defaultTx
|
|
446
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
447
|
+
className: "relative dx-container h-dvh flex flex-col"
|
|
448
|
+
}, /* @__PURE__ */ React3.createElement("div", {
|
|
449
|
+
className: "flex flex-col grow justify-center items-center"
|
|
450
|
+
}, typeof logo === "function" ? logo({
|
|
451
|
+
className: logoClassName
|
|
452
|
+
}) : logo ? /* @__PURE__ */ React3.createElement("div", {
|
|
453
|
+
className: logoClassName
|
|
454
|
+
}, logo) : null)));
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
export {
|
|
458
|
+
useApp,
|
|
459
|
+
useCapabilities,
|
|
460
|
+
useCapability,
|
|
461
|
+
useAtomCapability,
|
|
462
|
+
useAtomCapabilityState,
|
|
463
|
+
useOperationInvoker,
|
|
464
|
+
LoadingState,
|
|
465
|
+
useLoading,
|
|
466
|
+
useSettingsState,
|
|
467
|
+
App,
|
|
468
|
+
Placeholder
|
|
469
|
+
};
|
|
470
|
+
//# sourceMappingURL=chunk-DRZKO5UZ.mjs.map
|