@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,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/common/index.ts", "../../../src/common/capability.ts", "../../../src/common/activation-event.ts", "../../../src/common/collaboration.ts", "../../../src/common/file.ts", "../../../src/common/operations.ts", "../../../src/common/translations.ts", "../../../src/common/plugin.ts", "../../../src/common/surface.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nexport * from './activation-event';\nexport * from './capability';\nexport * from './collaboration';\nexport * from './file';\nexport * from './graph';\nexport * from './operations';\nexport * from './plugin';\nexport * from './surface';\nexport * from './translations';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Command$ from '@effect/cli/Command';\nimport { Atom, type Registry } from '@effect-atom/atom-react';\nimport * as Effect from 'effect/Effect';\nimport type * as Layer$ from 'effect/Layer';\nimport type * as ManagedRuntime$ from 'effect/ManagedRuntime';\nimport type * as Schema$ from 'effect/Schema';\nimport type { FC, PropsWithChildren } from 'react';\n\nimport type { AiModelResolver as AiModelResolver$, AiService as AiService$ } from '@dxos/ai';\nimport type { BuilderExtensions, GraphBuilder } from '@dxos/app-graph';\nimport type { GenericToolkit } from '@dxos/assistant';\nimport type { Blueprint } from '@dxos/blueprints';\nimport type { Database, Type } from '@dxos/echo';\nimport type { FunctionDefinition } from '@dxos/functions';\nimport type { OperationInvoker as OperationInvoker$, OperationResolver as OperationResolver$ } from '@dxos/operation';\nimport type { AnchoredTo } from '@dxos/types';\n\nimport { Capability as Capability$, type PluginManager as PluginManager$ } from '../core';\nimport type {\n HistoryTracker as HistoryTracker$,\n UndoMapping as UndoMapping$,\n UndoRegistry as UndoRegistry$,\n} from '../plugin-operation';\n\nimport type { FileInfo } from './file';\nimport type { NodeSerializer } from './graph';\nimport type { SurfaceDefinition } from './surface';\nimport type { Resource } from './translations';\n\nexport namespace Capability {\n // TODO(burdon): Sort.\n\n /**\n * @category Capability\n */\n export const Null = Capability$.make<null>('dxos.org/app-framework/capability/null');\n\n /**\n * @category Capability\n */\n export const PluginManager = Capability$.make<PluginManager$.PluginManager>(\n 'dxos.org/app-framework/capability/plugin-manager',\n );\n\n /**\n * @category Capability\n */\n export const AtomRegistry = Capability$.make<Registry.Registry>('dxos.org/app-framework/capability/atom-registry');\n\n export type ReactContext = Readonly<{\n id: string;\n dependsOn?: string[];\n context: FC<PropsWithChildren>;\n }>;\n\n /**\n * @category Capability\n */\n export const ReactContext = Capability$.make<ReactContext>('dxos.org/app-framework/capability/react-context');\n\n export type ReactRoot = Readonly<{ id: string; root: FC<PropsWithChildren> }>;\n\n /**\n * @category Capability\n */\n export const ReactRoot = Capability$.make<ReactRoot>('dxos.org/app-framework/capability/react-root');\n\n /**\n * Surface definitions that can be either React components or Web Components.\n */\n export type ReactSurface = SurfaceDefinition | readonly SurfaceDefinition[];\n\n /**\n * @category Capability\n */\n export const ReactSurface = Capability$.make<ReactSurface>('dxos.org/app-framework/common/react-surface');\n\n export type Layout = Readonly<{\n mode: string;\n dialogOpen: boolean;\n sidebarOpen: boolean;\n complementarySidebarOpen: boolean;\n /**\n * The id of the active workspace, where a workspace is a set of active items.\n */\n workspace: string;\n /**\n * Identifiers of items which are currently active in the application.\n */\n active: string[];\n /**\n * Identifiers of items which were previously active in the application.\n */\n inactive: string[];\n /**\n * Identifier of the item which should be scrolled into view.\n */\n scrollIntoView: string | undefined;\n }>;\n\n /**\n * Layout capability - provides reactive access to the current layout state.\n * Use `useAtomValue(layoutAtom)` in React or `registry.get(layoutAtom)` in Effects.\n * @category Capability\n */\n export const Layout = Capability$.make<Atom.Atom<Layout>>('dxos.org/app-framework/capability/layout');\n\n /**\n * @category Capability\n */\n export const Translations = Capability$.make<Readonly<Resource[]>>('dxos.org/app-framework/capability/translations');\n\n export type AppGraph = Readonly<{\n graph: GraphBuilder.GraphBuilder['graph'];\n explore: typeof GraphBuilder.explore;\n }>;\n\n /**\n * @category Capability\n */\n export const AppGraph = Capability$.make<AppGraph>('dxos.org/app-framework/capability/app-graph');\n\n /**\n * @category Capability\n */\n export const AppGraphBuilder = Capability$.make<BuilderExtensions>(\n 'dxos.org/app-framework/capability/app-graph-builder',\n );\n\n /**\n * @category Capability\n */\n export const AppGraphSerializer = Capability$.make<NodeSerializer[]>(\n 'dxos.org/app-framework/capability/app-graph-serializer',\n );\n\n // TODO(wittjosiah): The generics caused type inference issues for schemas when contributing settings.\n // export type Settings = Parameters<RootSettingsStore['createStore']>[0];\n // export type Settings<T extends SettingsValue = SettingsValue> = SettingsProps<T>;\n export type Settings = {\n prefix: string;\n schema: Schema$.Schema.All;\n atom: Atom.Writable<any>;\n };\n\n /**\n * Type guard to check if a value is a Settings object.\n */\n export const isSettings = (value: unknown): value is Settings =>\n typeof value === 'object' &&\n value !== null &&\n 'prefix' in value &&\n typeof (value as Settings).prefix === 'string' &&\n 'atom' in value &&\n Atom.isAtom(value.atom) &&\n Atom.isWritable(value.atom);\n\n /**\n * @category Capability\n */\n export const Settings = Capability$.make<Settings>('dxos.org/app-framework/capability/settings');\n\n export type Metadata = Readonly<{\n id: string;\n metadata: Record<string, any>;\n }>;\n\n /**\n * @category Capability\n */\n export const Metadata = Capability$.make<Metadata>('dxos.org/app-framework/capability/metadata');\n\n export type Schema = ReadonlyArray<Type.Entity.Any>;\n\n /**\n * @category Capability\n */\n export const Schema = Capability$.make<Schema>('dxos.org/app-framework/capability/schema');\n\n export type Toolkit = GenericToolkit.GenericToolkit;\n\n /**\n * @category Capability\n */\n export const Toolkit = Capability$.make<Toolkit>('dxos.org/app-framework/capability/ai-toolkit');\n\n /**\n * @category Capability\n */\n export const BlueprintDefinition = Capability$.make<Blueprint.Blueprint>(\n 'dxos.org/app-framework/capability/blueprint-definition',\n );\n\n export type AiServiceLayer = Layer$.Layer<AiService$.AiService>;\n export const AiServiceLayer = Capability$.make<AiServiceLayer>(\n 'dxos.org/app-framework/capability/ai-service-factory',\n );\n\n /**\n * Plugins can contribute them to provide model resolvers.\n */\n export const AiModelResolver = Capability$.make<Layer$.Layer<AiModelResolver$.AiModelResolver>>(\n 'dxos.org/app-framework/capability/ai-model-resolver',\n );\n\n /**\n * @category Capability\n */\n export const Functions = Capability$.make<FunctionDefinition.Any[]>('dxos.org/app-framework/capability/functions');\n\n export type FileUploader = (db: Database.Database, file: File) => Promise<FileInfo | undefined>;\n\n /**\n * @category Capability\n */\n export const FileUploader = Capability$.make<FileUploader>('dxos.org/app-framework/capability/file-uploader');\n\n export type AnchorSort = {\n key: string;\n sort: (anchorA: AnchoredTo.AnchoredTo, anchorB: AnchoredTo.AnchoredTo) => number;\n };\n\n /**\n * @category Capability\n */\n export const AnchorSort = Capability$.make<AnchorSort>('dxos.org/app-framework/capability/anchor-sort');\n\n export type AnyCommand = Command$.Command<any, any, any, any>;\n\n /**\n * @category Capability\n */\n export const Command = Capability$.make<AnyCommand>('dxos.org/app-framework/capability/command');\n\n /**\n * @category Capability\n */\n export const Layer = Capability$.make<Layer$.Layer<any, any, any>>('dxos.org/app-framework/capability/layer');\n\n export type ManagedRuntime = ManagedRuntime$.ManagedRuntime<any, any>;\n\n /**\n * @category Capability\n */\n export const ManagedRuntime = Capability$.make<ManagedRuntime>('dxos.org/app-framework/capability/managed-runtime');\n\n //\n // Operation System Capabilities\n //\n\n export type OperationResolver = OperationResolver$.OperationResolver<any, any, any, any>;\n\n /**\n * Handler registration for operations - contributed by plugins.\n * @category Capability\n */\n export const OperationResolver = Capability$.make<OperationResolver[]>(\n 'dxos.org/app-framework/capability/operation-resolver',\n );\n\n export type UndoMapping = UndoMapping$.UndoMapping;\n\n /**\n * Undo mapping registration - contributed by plugins.\n * @category Capability\n */\n export const UndoMapping = Capability$.make<UndoMapping[]>('dxos.org/app-framework/capability/undo-mapping');\n\n export type OperationInvoker = OperationInvoker$.OperationInvoker;\n\n /**\n * Operation invoker - provided by OperationPlugin.\n * @category Capability\n */\n export const OperationInvoker = Capability$.make<OperationInvoker>(\n 'dxos.org/app-framework/capability/operation-invoker',\n );\n\n export type UndoRegistry = UndoRegistry$.UndoRegistry;\n\n /**\n * Undo registry - provided by OperationPlugin.\n * @category Capability\n */\n export const UndoRegistry = Capability$.make<UndoRegistry>('dxos.org/app-framework/capability/undo-registry');\n\n export type HistoryTracker = HistoryTracker$.HistoryTracker;\n\n /**\n * History tracker - provided by OperationPlugin.\n * @category Capability\n */\n export const HistoryTracker = Capability$.make<HistoryTracker>('dxos.org/app-framework/capability/history-tracker');\n\n //\n // Atom Capability Helpers\n //\n\n /**\n * Get the current value of an atom capability.\n * @example const settings = yield* Common.Capability.getAtomValue(ThreadCapabilities.Settings);\n */\n export const getAtomValue = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Atom<T>>,\n ): Effect.Effect<T, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n return registry.get(atom);\n });\n\n /**\n * Update an atom capability value (requires writable atom).\n * @example yield* Common.Capability.updateAtomValue(ThreadCapabilities.Settings, (s) => ({ ...s, foo: true }));\n */\n export const updateAtomValue = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Writable<T>>,\n fn: (current: T) => T,\n ): Effect.Effect<void, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n registry.set(atom, fn(registry.get(atom)));\n });\n\n /**\n * Subscribe to an atom capability.\n * @example const unsubscribe = yield* Common.Capability.subscribeAtom(ThreadCapabilities.Settings, (value) => ...);\n */\n export const subscribeAtom = <T>(\n atomCapability: Capability$.InterfaceDef<Atom.Atom<T>>,\n callback: (value: T) => void,\n ): Effect.Effect<() => void, Error, Capability$.Service> =>\n Effect.gen(function* () {\n const registry = yield* Capability$.get(AtomRegistry);\n const atom = yield* Capability$.get(atomCapability);\n return registry.subscribe(atom, () => callback(registry.get(atom)));\n });\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { ActivationEvent as ActivationEvent$ } from '../core';\n\nimport { Capability } from './capability';\n\nexport namespace ActivationEvent {\n /**\n * Fired when the app is started.\n */\n export const Startup = ActivationEvent$.make('dxos.org/app-framework/event/startup');\n\n //\n // Dependent Events\n //\n\n /**\n * Fired to load any newly available surfaces.\n */\n export const SetupReactSurface = ActivationEvent$.make('dxos.org/app-framework/event/setup-react-surface');\n\n /**\n * Fired to load any newly available metadata.\n */\n export const SetupMetadata = ActivationEvent$.make('dxos.org/app-framework/event/setup-metadata');\n\n /**\n * Fired before the operation invoker is activated.\n */\n export const SetupOperationResolver = ActivationEvent$.make('dxos.org/app-framework/event/setup-operation-resolver');\n\n /**\n * Fired before the managed runtime is created.\n * Plugins should contribute their Layer capabilities before this event.\n */\n export const SetupLayer = ActivationEvent$.make('dxos.org/app-framework/event/setup-layer');\n\n /**\n * Fired before the settings store is activated.\n */\n export const SetupSettings = ActivationEvent$.make('dxos.org/app-framework/event/setup-settings');\n\n /**\n * Fired before the graph is created.\n */\n export const SetupAppGraph = ActivationEvent$.make('dxos.org/app-framework/event/setup-graph');\n\n /**\n * Fired before the translations provider is created.\n */\n export const SetupTranslations = ActivationEvent$.make('dxos.org/app-framework/event/setup-translations');\n\n /**\n * Fired before the schema is created.\n */\n export const SetupSchema = ActivationEvent$.make('dxos.org/app-framework/event/setup-schema');\n\n /**\n * Fired to load any newly available artifacts definitions.\n */\n // TODO(burdon): Rename.\n export const SetupArtifactDefinition = ActivationEvent$.make(\n 'dxos.org/app-framework/event/setup-artifact-definition',\n );\n\n //\n // Triggered Events\n //\n\n /**\n * Fired after the operation invoker is ready.\n */\n export const OperationInvokerReady = ActivationEvent$.make('dxos.org/app-framework/event/operation-invoker-ready');\n\n /**\n * Fired after the managed runtime is ready.\n */\n export const ManagedRuntimeReady = ActivationEvent$.make('dxos.org/app-framework/event/managed-runtime-ready');\n\n /**\n * Fired when the graph is ready.\n */\n export const AppGraphReady = ActivationEvent$.make('dxos.org/app-framework/event/graph-ready');\n\n /**\n * Fired when plugin state is ready.\n */\n export const createStateEvent = (specifier: string) =>\n ActivationEvent$.make('dxos.org/app-framework/event/state', specifier);\n export const LayoutReady = createStateEvent(Capability.Layout.identifier);\n\n /**\n * Fired when a specific settings capability is ready.\n */\n export const createSettingsEvent = (specifier: string) =>\n ActivationEvent$.make('dxos.org/app-framework/event/settings', specifier);\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\nimport { ContentBlock } from '@dxos/types';\n\nimport { Capability } from '../core';\n\nconst COLLABORATION_OPERATION = 'dxos.org/app-framework/collaboration/operation';\n\nexport namespace CollaborationOperation {\n export const AcceptProposal = Operation.make({\n meta: {\n key: `${COLLABORATION_OPERATION}/accept-proposal`,\n name: 'Accept Proposal',\n description: 'Accept a proposal from a collaborator.',\n },\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.Any,\n anchor: Schema.String,\n proposal: ContentBlock.Proposal,\n }),\n output: Schema.Void,\n },\n });\n}\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\n// TODO(burdon): See Accept attribute (uses MIME types).\n// E.g., 'image/*': ['.jpg', '.jpeg', '.png', '.gif'],\nexport const defaultFileTypes = {\n images: ['png', 'jpg', 'jpeg', 'gif'],\n media: ['mp3', 'mp4', 'mov', 'avi'],\n text: ['pdf', 'txt', 'md'],\n};\n\nexport const FileInfoSchema = Schema.Struct({\n name: Schema.String,\n type: Schema.String,\n url: Schema.optional(Schema.String),\n cid: Schema.optional(Schema.String), // TODO(burdon): Meta key? Or other common properties with other file management system? (e.g., WNFS).\n});\n\nexport type FileInfo = Schema.Schema.Type<typeof FileInfoSchema>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\n\nimport { Capability } from '../core';\n\nimport { Label } from './translations';\n\nconst LAYOUT_PLUGIN = 'dxos.org/plugin/layout';\n\n/**\n * Layout operations - Operation-based equivalents of LayoutAction intents.\n * These mirror the LayoutAction namespace but use the Operation pattern.\n */\nexport namespace LayoutOperation {\n //\n // Sidebar Operations\n //\n\n export const UpdateSidebar = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/update-sidebar`,\n name: 'Update Sidebar',\n description: 'Update the sidebar state.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the sidebar.' }),\n ),\n state: Schema.optional(\n Schema.Literal('closed', 'collapsed', 'expanded').annotations({\n description: 'Whether the sidebar is closed, collapsed, or expanded.',\n }),\n ),\n }),\n output: Schema.Void,\n },\n });\n\n export const UpdateComplementary = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/update-complementary`,\n name: 'Update Complementary Sidebar',\n description: 'Update the complementary sidebar state.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the complementary area.' }),\n ),\n state: Schema.optional(\n Schema.Literal('closed', 'collapsed', 'expanded').annotations({\n description: 'Whether the complementary sidebar is closed, collapsed, or expanded.',\n }),\n ),\n }),\n output: Schema.Void,\n },\n });\n\n //\n // Dialog Operations\n //\n\n export const UpdateDialog = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/update-dialog`,\n name: 'Update Dialog',\n description: 'Open, close, or update the dialog.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.optional(\n Schema.String.annotations({ description: 'URI of the component to display in the dialog.' }),\n ),\n state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the dialog is open or closed.' })),\n type: Schema.optional(Schema.Literal('default', 'alert').annotations({ description: 'The type of dialog.' })),\n blockAlign: Schema.optional(\n Schema.Literal('start', 'center', 'end').annotations({ description: 'The alignment of the dialog.' }),\n ),\n overlayClasses: Schema.optional(\n Schema.String.annotations({ description: 'Additional classes for the dialog overlay.' }),\n ),\n overlayStyle: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional styles for the dialog overlay.',\n }),\n ),\n props: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional props for the dialog.',\n }),\n ),\n }),\n output: Schema.Void,\n },\n });\n\n //\n // Popover Operations\n //\n\n const PopoverBaseInput = Schema.Struct({\n subject: Schema.optional(\n Schema.Any.annotations({\n description: 'URI of the component to display in the popover or data to pass to the popover.',\n }),\n ),\n side: Schema.optional(\n Schema.Literal('top', 'right', 'bottom', 'left').annotations({ description: 'The side of the anchor.' }),\n ),\n state: Schema.optional(Schema.Boolean.annotations({ description: 'Whether the popover is open or closed.' })),\n props: Schema.optional(\n Schema.Record({ key: Schema.String, value: Schema.Any }).annotations({\n description: 'Additional props for the popover.',\n }),\n ),\n });\n\n const PopoverBaseWithKind = Schema.Union(\n PopoverBaseInput.pipe(\n Schema.extend(\n Schema.Struct({\n kind: Schema.Literal('base').pipe(Schema.optional),\n }),\n ),\n ),\n PopoverBaseInput.pipe(\n Schema.extend(\n Schema.Struct({\n kind: Schema.Literal('card'),\n title: Schema.optional(Label.annotations({ description: 'The title of the card.' })),\n }),\n ),\n ),\n );\n\n export const UpdatePopover = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/update-popover`,\n name: 'Update Popover',\n description: 'Open, close, or update a popover.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Union(\n PopoverBaseWithKind.pipe(\n Schema.extend(\n Schema.Struct({\n variant: Schema.Literal('virtual'),\n anchor: Schema.Any.annotations({ description: 'The DOM element to anchor the popover to.' }),\n }),\n ),\n ),\n PopoverBaseWithKind.pipe(\n Schema.extend(\n Schema.Struct({\n variant: Schema.optional(Schema.Literal('react')),\n anchorId: Schema.String.annotations({\n description: 'An id that can be used to determine whether to render the anchor subcomponent.',\n }),\n }),\n ),\n ),\n ),\n output: Schema.Void,\n },\n });\n\n //\n // Toast Operations\n //\n\n export const Toast = Schema.Struct({\n id: Schema.String.annotations({ description: 'The id of the toast.' }),\n title: Schema.optional(Label.annotations({ description: 'The title of the toast.' })),\n description: Schema.optional(Label.annotations({ description: 'The description of the toast.' })),\n icon: Schema.optional(Schema.String.annotations({ description: 'The icon of the toast.' })),\n duration: Schema.optional(Schema.Number.annotations({ description: 'The duration of the toast.' })),\n closeLabel: Schema.optional(Label.annotations({ description: 'The label of the close button.' })),\n actionLabel: Schema.optional(Label.annotations({ description: 'The label of the action button.' })),\n actionAlt: Schema.optional(Label.annotations({ description: 'The alt text of the action button.' })),\n onAction: Schema.optional(\n Schema.Any.annotations({ description: 'The action to perform when the action button is clicked.' }),\n ),\n });\n\n export interface Toast extends Omit<Schema.Schema.Type<typeof Toast>, 'onAction'> {\n onAction?: () => void;\n }\n\n export const AddToast = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/add-toast`,\n name: 'Add Toast',\n description: 'Add a toast notification.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Toast,\n output: Schema.Void,\n },\n });\n\n //\n // Layout Mode Operations\n //\n\n export const SetLayoutMode = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/set-layout-mode`,\n name: 'Set Layout Mode',\n description: 'Set the layout mode (solo, deck, fullscreen, etc.).',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Union(\n Schema.Struct({\n subject: Schema.optional(\n Schema.String.annotations({ description: 'Item which is the subject of the new layout mode.' }),\n ),\n mode: Schema.String.annotations({ description: 'The new layout mode.' }),\n }),\n Schema.Struct({\n revert: Schema.Boolean.annotations({ description: 'Revert to the previous layout mode.' }),\n }),\n ),\n output: Schema.Void,\n },\n });\n\n //\n // Workspace Operations\n //\n\n export const SwitchWorkspace = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/switch-workspace`,\n name: 'Switch Workspace',\n description: 'Switch to a different workspace.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.String.annotations({ description: 'The id of the workspace to switch to.' }),\n }),\n output: Schema.Void,\n },\n });\n\n export const RevertWorkspace = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/revert-workspace`,\n name: 'Revert Workspace',\n description: 'Revert to the previous workspace.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Void,\n output: Schema.Void,\n },\n });\n\n //\n // Main Content Operations\n //\n\n export const Open = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/open`,\n name: 'Open',\n description: 'Open items in the main content area.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to open.' })),\n state: Schema.optional(Schema.Literal(true).annotations({ description: 'The items are being added.' })),\n variant: Schema.optional(Schema.String.annotations({ description: 'The variant of the item to open.' })),\n key: Schema.optional(\n Schema.String.annotations({\n description: 'If provided, will replace item with a matching key (id prefix).',\n }),\n ),\n workspace: Schema.optional(Schema.String.annotations({ description: 'The workspace to open the items in.' })),\n scrollIntoView: Schema.optional(Schema.Boolean.annotations({ description: 'Scroll the items into view.' })),\n pivotId: Schema.optional(\n Schema.String.annotations({ description: 'The id of the item to place new items next to.' }),\n ),\n positioning: Schema.optional(\n Schema.Union(\n Schema.Literal('start').annotations({ description: 'The items are being added before the pivot item.' }),\n Schema.Literal('end').annotations({ description: 'The items are being added after the pivot item.' }),\n ),\n ),\n }),\n output: Schema.Void,\n },\n });\n\n export const Close = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/close`,\n name: 'Close',\n description: 'Close items in the main content area.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to close.' })),\n }),\n output: Schema.Void,\n },\n });\n\n export const Set = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/set`,\n name: 'Set',\n description: 'Override items in the main content area.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.Array(Schema.String.annotations({ description: 'Ids of the items to set.' })),\n }),\n output: Schema.Void,\n },\n });\n\n //\n // Navigation Operations\n //\n\n export const ScrollIntoView = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/scroll-into-view`,\n name: 'Scroll Into View',\n description: 'Scroll an item into view.',\n },\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.optional(Schema.String.annotations({ description: 'The id of the item to scroll into view.' })),\n cursor: Schema.optional(Schema.String.annotations({ description: 'A cursor to scroll to within the item.' })),\n ref: Schema.optional(Schema.String.annotations({ description: 'A reference id for the scroll target.' })),\n }),\n output: Schema.Void,\n },\n });\n\n export const Expose = Operation.make({\n meta: {\n key: `${LAYOUT_PLUGIN}/operation/expose`,\n name: 'Expose',\n description: 'Expose an item in the navigation area.',\n },\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n subject: Schema.String.annotations({ description: 'The id of the item to expose.' }),\n }),\n output: Schema.Void,\n },\n });\n}\n\nconst UNDO_NAMESPACE = 'dxos.org/app-framework/undo';\n\n/**\n * Operations related to undo/history functionality.\n */\nexport namespace UndoOperation {\n /**\n * Show an undo toast notification.\n * Fired by HistoryTracker when an undoable operation is tracked.\n */\n export const ShowUndo = Operation.make({\n meta: {\n key: `${UNDO_NAMESPACE}/operation/show-undo`,\n name: 'Show Undo',\n description: 'Show an undo toast notification.',\n },\n executionMode: 'sync',\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n message: Schema.optional(Label.annotations({ description: 'The message to display in the undo toast.' })),\n }),\n output: Schema.Void,\n },\n });\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\n/**\n * A Label represents translatable text - either a simple string or a tuple of [key, options].\n */\nexport const Label = Schema.Union(\n Schema.String,\n Schema.mutable(\n Schema.Tuple(\n Schema.String,\n Schema.mutable(\n Schema.Struct({\n ns: Schema.String,\n count: Schema.optional(Schema.Number),\n defaultValue: Schema.optional(Schema.String),\n }),\n ),\n ),\n ),\n);\nexport type Label = Schema.Schema.Type<typeof Label>;\n\nexport const ResourceKey = Schema.Union(Schema.String, Schema.Record({ key: Schema.String, value: Schema.Any }));\nexport type ResourceKey = Schema.Schema.Type<typeof ResourceKey>;\n\nexport const ResourceLanguage = Schema.Record({ key: Schema.String, value: ResourceKey });\nexport type ResourceLanguage = Schema.Schema.Type<typeof ResourceLanguage>;\n\n/**\n * A resource is a collection of translations for a language.\n */\nexport const Resource = Schema.Record({ key: Schema.String, value: ResourceLanguage });\nexport type Resource = Schema.Schema.Type<typeof Resource>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport type * as Command$ from '@effect/cli/Command';\nimport * as Effect from 'effect/Effect';\n\nimport { type Type } from '@dxos/echo';\n\nimport { Capability as Capability$, Plugin as Plugin$ } from '../core';\n\nimport { ActivationEvent } from './activation-event';\nimport { Capability } from './capability';\nimport { type Resource } from './translations';\n\ntype PluginModuleOptions = Partial<\n Pick<Plugin$.PluginModuleOptions, 'id' | 'activatesOn' | 'activatesBefore' | 'activatesAfter'>\n> &\n Pick<Plugin$.PluginModuleOptions, 'activate'>;\n\n/**\n * Helper functions for creating common plugin module patterns.\n */\nexport namespace Plugin {\n // TODO(wittjosiah): Restrict type to only allow operation handlers.\n export type OperationResolverModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes operation handlers.\n *\n * @param options Module options including the activate function and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addOperationResolverModule({\n * activate: (context) =>\n * Capability.contributes(Common.Capability.OperationResolver, [{\n * operation: MyOperation,\n * handler: (input) => Effect.succeed(...)\n * }])\n * })\n * )\n * ```\n */\n export function addOperationResolverModule<T = void>(\n options: OperationResolverModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'operation-resolver',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupOperationResolver,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow surfaces.\n export type SurfaceModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes React surfaces.\n *\n * @param options Module options including the activate function and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addSurfaceModule({\n * activate: (context) =>\n * Capability.contributes(Common.Capability.ReactSurface, [\n * Common.createSurface({ id: `${meta.id}/my-surface`, ... })\n * ])\n * })\n * )\n * ```\n */\n export function addSurfaceModule<T = void>(\n options: SurfaceModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'surfaces',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupReactSurface,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow react roots.\n export type ReactRootModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes a React root.\n */\n export function addReactRootModule<T = void>(\n options: ReactRootModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'react-root',\n activatesOn: options.activatesOn ?? ActivationEvent.Startup,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow react contexts.\n export type ReactContextModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes a React context.\n */\n export function addReactContextModule<T = void>(\n options: ReactContextModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'react-context',\n activatesOn: options.activatesOn ?? ActivationEvent.Startup,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow app graph builders.\n export type AppGraphModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes app graph builder extensions.\n *\n * @param options Module options including the activate function and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addAppGraphModule({\n * activate: Effect.fnUntraced(function* () {\n * const extensions = yield* GraphBuilder.createExtension({\n * id: meta.id,\n * match: NodeMatcher.whenRoot,\n * // All callbacks must return Effects.\n * actions: () => Effect.succeed([{\n * id: 'my-action',\n * // Action data returns Effect for automatic context access.\n * data: Effect.fnUntraced(function* () {\n * yield* Operation.invoke(MyOperation, { ... });\n * }),\n * properties: { label: 'My Action', icon: 'ph--icon' },\n * }]),\n * connector: (node, get) => Effect.succeed([{ id: 'child', ... }]),\n * });\n * return Capability.contributes(Common.Capability.AppGraphBuilder, extensions);\n * })\n * })\n * )\n * ```\n */\n export function addAppGraphModule<T = void>(\n options: AppGraphModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'app-graph-builder',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupAppGraph,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n export type TranslationsModuleOptions = Omit<PluginModuleOptions, 'activate'> & {\n translations: Resource | Resource[];\n };\n\n /**\n * Creates a module that contributes translations.\n *\n * @param options Module options including translations and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addTranslationsModule({\n * translations: translations\n * })\n * )\n * ```\n */\n export function addTranslationsModule<T = void>(\n options: TranslationsModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: options?.id ?? 'translations',\n activatesOn: options?.activatesOn ?? ActivationEvent.SetupTranslations,\n activatesBefore: options?.activatesBefore,\n activatesAfter: options?.activatesAfter,\n activate: Effect.fnUntraced(function* () {\n return Capability$.contributes(\n Capability.Translations,\n Array.isArray(options.translations) ? options.translations : ([options.translations] as Resource[]),\n );\n }),\n });\n }\n\n export type MetadataModuleOptions = Omit<PluginModuleOptions, 'activate'> & {\n metadata: Capability.Metadata | Capability.Metadata[];\n };\n\n /**\n * Creates a module that contributes metadata.\n *\n * @param options Module options including metadata and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addMetadataModule({\n * metadata: {\n * id: MyType.typename,\n * metadata: { icon: 'ph--icon', ... }\n * }\n * })\n * )\n * ```\n */\n export function addMetadataModule<T = void>(\n options: MetadataModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: options.id ?? 'metadata',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupMetadata,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: Effect.fnUntraced(function* () {\n return (Array.isArray(options.metadata) ? options.metadata : [options.metadata]).map((m) =>\n Capability$.contributes(Capability.Metadata, m),\n );\n }),\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow settings.\n export type SettingsModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes settings.\n */\n export function addSettingsModule<T = void>(\n options: SettingsModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'settings',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupSettings,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n // TODO(wittjosiah): Restrict type to only allow blueprint definitions.\n export type BlueprintDefinitionModuleOptions = PluginModuleOptions;\n\n /**\n * Creates a module that contributes blueprint definitions.\n *\n * @param options Module options including the activate function and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addBlueprintDefinitionModule({\n * activate: (context) =>\n * Capability.contributes(Common.Capability.BlueprintDefinition, [\n * BlueprintDefinition.make({ key: 'my-blueprint', ... })\n * ])\n * })\n * )\n * ```\n */\n export function addBlueprintDefinitionModule<T = void>(\n options: BlueprintDefinitionModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: Capability$.getModuleTag(options.activate) ?? options.id ?? 'blueprint-definition',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupArtifactDefinition,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: options.activate,\n });\n }\n\n export type SchemaModuleOptions = Omit<PluginModuleOptions, 'activate'> & {\n schema: ReadonlyArray<Type.Entity.Any>;\n };\n\n /**\n * Creates a module that contributes schemas.\n *\n * @param options Module options including schema array and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addSchemaModule({\n * schema: [MyType.Type, AnotherType.Type]\n * })\n * )\n * ```\n */\n export function addSchemaModule<T = void>(\n options: SchemaModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: options.id ?? 'schema',\n activatesOn: options.activatesOn ?? ActivationEvent.SetupSchema,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: Effect.fnUntraced(function* () {\n return Capability$.contributes(Capability.Schema, options.schema);\n }),\n });\n }\n\n export type CommandModuleOptions = Omit<PluginModuleOptions, 'activate'> & {\n commands: ReadonlyArray<Command$.Command<any, any, any, any>>;\n };\n\n /**\n * Creates a module that contributes CLI commands.\n *\n * @param options Module options including commands and optional configuration\n * @returns A function that can be used with Plugin.addModule() in a pipe chain\n *\n * @example\n * ```ts\n * Plugin.define(meta).pipe(\n * Common.Plugin.addCommandModule({\n * commands: [myCommand, anotherCommand]\n * })\n * )\n * ```\n */\n export function addCommandModule<T = void>(\n options: CommandModuleOptions,\n ): (builder: Plugin$.PluginBuilder<T>) => Plugin$.PluginBuilder<T> {\n return Plugin$.addModule({\n id: options.id ?? 'cli-commands',\n activatesOn: options.activatesOn ?? ActivationEvent.Startup,\n activatesBefore: options.activatesBefore,\n activatesAfter: options.activatesAfter,\n activate: Effect.fnUntraced(function* () {\n return options.commands.map((cmd) => Capability$.contributes(Capability.Command, cmd));\n }),\n });\n }\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport type { PropsWithChildren, ReactNode, RefCallback } from 'react';\n\nimport type { MakeOptional, Position } from '@dxos/util';\n\nimport type { ErrorBoundary } from '../react';\n\n/**\n * SurfaceProps are the props that are passed to the Surface component.\n */\nexport type SurfaceProps<T extends Record<string, any> = Record<string, unknown>> = {\n /**\n * If specified, the Surface will be wrapped in an error boundary.\n * The fallback component will be rendered if an error occurs.\n */\n fallback?: ErrorBoundary['props']['fallback'];\n\n /**\n * If specified, the Surface will be wrapped in a suspense boundary.\n * The placeholder component will be rendered while the surface component is loading.\n */\n placeholder?: ReactNode;\n} & MakeOptional<CoreSurfaceProps<T>, 'id' | 'data'> &\n /**\n * Additional props to pass to the component.\n * These props are not used by Surface itself but may be used by components which resolve the surface.\n * Exclude known prop names to prevent overriding well-defined props.\n */\n {\n [K in keyof Record<string, any>]: K extends keyof CoreSurfaceProps<T> | 'fallback' | 'placeholder' ? never : any;\n };\n\n/**\n * NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.\n */\nexport type CoreSurfaceProps<T extends Record<string, any> = Record<string, unknown>> = PropsWithChildren<{\n /**\n * ID for debugging.\n */\n id: string;\n\n /**\n * Role defines how the data should be rendered.\n */\n role: string;\n\n /**\n * The data to be rendered by the surface.\n * NOTE: This must be a stable value.\n */\n data: T;\n\n /**\n * If more than one component is resolved, the limit determines how many are rendered.\n */\n limit?: number | undefined;\n}>;\n\nexport type SurfaceComponentProps<T extends Record<string, any> = Record<string, any>> = CoreSurfaceProps<T> & {\n ref?: RefCallback<HTMLElement>;\n} & Record<string, any>;\n\n/**\n * React component used to render a surface once is has matched.\n */\nexport type SurfaceComponent<T extends Record<string, any> = Record<string, any>> = (\n props: SurfaceComponentProps<T>,\n) => ReactNode;\n\n/**\n * Definition of when a React SurfaceComponent should be rendered.\n */\nexport type ReactSurfaceDefinition<T extends Record<string, any> = any> = Readonly<{\n kind: 'react';\n id: string;\n role: string | string[];\n position?: Position;\n component: SurfaceComponent<T>;\n filter?: (data: Record<string, unknown>) => data is T;\n}>;\n\n/**\n * Definition of when a Web Component surface should be rendered.\n */\nexport type WebComponentSurfaceDefinition<T extends Record<string, any> = any> = Readonly<{\n kind: 'web-component';\n id: string;\n role: string | string[];\n position?: Position;\n /**\n * The tag name of the Web Component to render.\n * The Web Component will receive the same props as React surfaces via properties/attributes.\n */\n tagName: string;\n filter?: (data: Record<string, unknown>) => data is T;\n}>;\n\n/**\n * Definition of when a surface (React or Web Component) should be rendered.\n */\nexport type SurfaceDefinition<T extends Record<string, any> = any> =\n | ReactSurfaceDefinition<T>\n | WebComponentSurfaceDefinition<T>;\n\n/**\n * Creates a React surface definition.\n */\nexport const createSurface = <T extends Record<string, any> = any>(\n definition: Omit<ReactSurfaceDefinition<T>, 'kind'>,\n): ReactSurfaceDefinition<T> => ({ ...definition, kind: 'react' });\n\n/**\n * Creates a Web Component surface definition.\n */\nexport const createWebSurface = <T extends Record<string, any> = any>(\n definition: Omit<WebComponentSurfaceDefinition<T>, 'kind'>,\n): WebComponentSurfaceDefinition<T> => ({ ...definition, kind: 'web-component' });\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;ACKA,SAASA,YAA2B;AACpC,YAAYC,YAAY;UA2BPC,aAAAA;cAMFC,OAAOC,mBAAYC,KAAW,wCAAA;cAK9BC,gBAAgBF,mBAAYC,KACvC,kDAAA;cAMWE,eAAeH,mBAAYC,KAAwB,iDAAA;cAWnDG,eAAeJ,mBAAYC,KAAmB,iDAAA;cAO9CI,YAAYL,mBAAYC,KAAgB,8CAAA;cAUxCK,eAAeN,mBAAYC,KAAmB,6CAAA;cA8B9CM,SAASP,mBAAYC,KAAwB,0CAAA;cAK7CO,eAAeR,mBAAYC,KAA2B,gDAAA;cAUtDQ,WAAWT,mBAAYC,KAAe,6CAAA;cAKtCS,kBAAkBV,mBAAYC,KACzC,qDAAA;cAMWU,qBAAqBX,mBAAYC,KAC5C,wDAAA;cAeWW,aAAa,CAACC,UACzB,OAAOA,UAAU,YACjBA,UAAU,QACV,YAAYA,SACZ,OAAQA,MAAmBC,WAAW,YACtC,UAAUD,SACVE,KAAKC,OAAOH,MAAMI,IAAI,KACtBF,KAAKG,WAAWL,MAAMI,IAAI;cAKfE,WAAWnB,mBAAYC,KAAe,4CAAA;cAUtCmB,WAAWpB,mBAAYC,KAAe,4CAAA;cAOtCoB,SAASrB,mBAAYC,KAAa,0CAAA;cAOlCqB,UAAUtB,mBAAYC,KAAc,8CAAA;cAKpCsB,sBAAsBvB,mBAAYC,KAC7C,wDAAA;cAIWuB,iBAAiBxB,mBAAYC,KACxC,sDAAA;cAMWwB,kBAAkBzB,mBAAYC,KACzC,qDAAA;cAMWyB,YAAY1B,mBAAYC,KAA+B,6C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AAU;MACvBC,IAAIH,QAAQG,MAAM;MAClBI,aAAaP,QAAQO,eAAeC,gBAAgBO;MACpDL,iBAAiBV,QAAQU;MACzBC,gBAAgBX,QAAQW;MACxBL,UAAiBe,mBAAW,aAAA;AAC1B,eAAOrB,QAAQ2C,SAASZ,IAAI,CAACa,QAAQxC,mBAAYkB,YAAYC,WAAWsB,SAASD,GAAAA,CAAAA;MACnF,CAAA;IACF,CAAA;EACF;AAbC,EAAA9C,QACe4C,mBAAAA;AAalB,GApViB5C,WAAAA,SAAAA,CAAAA,EAAAA;;;;ACuFV,IAAMgD,gBAAgB,CAC3BC,gBAC+B;EAAE,GAAGA;EAAYC,MAAM;AAAQ;AAKzD,IAAMC,mBAAmB,CAC9BF,gBACsC;EAAE,GAAGA;EAAYC,MAAM;AAAgB;",
|
|
6
|
-
"names": ["Atom", "Effect", "Capability", "Null", "Capability$", "make", "PluginManager", "AtomRegistry", "ReactContext", "ReactRoot", "ReactSurface", "Layout", "Translations", "AppGraph", "AppGraphBuilder", "AppGraphSerializer", "isSettings", "value", "prefix", "Atom", "isAtom", "atom", "isWritable", "Settings", "Metadata", "Schema", "Toolkit", "BlueprintDefinition", "AiServiceLayer", "AiModelResolver", "Functions", "FileUploader", "AnchorSort", "Command", "Layer", "ManagedRuntime", "OperationResolver", "UndoMapping", "OperationInvoker", "UndoRegistry", "HistoryTracker", "getAtomValue", "atomCapability", "gen", "registry", "get", "updateAtomValue", "fn", "set", "subscribeAtom", "callback", "subscribe", "ActivationEvent", "Startup", "ActivationEvent$", "make", "SetupReactSurface", "SetupMetadata", "SetupOperationResolver", "SetupLayer", "SetupSettings", "SetupAppGraph", "SetupTranslations", "SetupSchema", "SetupArtifactDefinition", "OperationInvokerReady", "ManagedRuntimeReady", "AppGraphReady", "createStateEvent", "specifier", "LayoutReady", "Capability", "Layout", "identifier", "createSettingsEvent", "Schema", "Operation", "ContentBlock", "COLLABORATION_OPERATION", "CollaborationOperation", "AcceptProposal", "Operation", "make", "meta", "key", "name", "description", "services", "Capability", "Service", "schema", "input", "Struct", "subject", "Any", "anchor", "String", "proposal", "ContentBlock", "Proposal", "output", "Void", "Schema", "defaultFileTypes", "images", "media", "text", "FileInfoSchema", "Struct", "name", "String", "type", "url", "optional", "cid", "Schema", "Operation", "Schema", "Label", "Union", "String", "mutable", "Tuple", "Struct", "ns", "count", "optional", "Number", "defaultValue", "ResourceKey", "Record", "key", "value", "Any", "ResourceLanguage", "Resource", "LAYOUT_PLUGIN", "LayoutOperation", "UpdateSidebar", "Operation", "make", "meta", "key", "name", "description", "executionMode", "services", "Capability", "Service", "schema", "input", "Struct", "subject", "optional", "String", "annotations", "state", "Literal", "output", "Void", "UpdateComplementary", "UpdateDialog", "Boolean", "type", "blockAlign", "overlayClasses", "overlayStyle", "Record", "value", "Any", "props", "PopoverBaseInput", "side", "PopoverBaseWithKind", "Union", "pipe", "extend", "kind", "title", "Label", "UpdatePopover", "variant", "anchor", "anchorId", "Toast", "id", "icon", "duration", "Number", "closeLabel", "actionLabel", "actionAlt", "onAction", "AddToast", "SetLayoutMode", "mode", "revert", "SwitchWorkspace", "RevertWorkspace", "Open", "Array", "workspace", "scrollIntoView", "pivotId", "positioning", "Close", "Set", "ScrollIntoView", "cursor", "ref", "Expose", "UNDO_NAMESPACE", "UndoOperation", "ShowUndo", "message", "Effect", "Plugin", "addOperationResolverModule", "options", "Plugin$", "addModule", "id", "Capability$", "getModuleTag", "activate", "activatesOn", "ActivationEvent", "SetupOperationResolver", "activatesBefore", "activatesAfter", "addSurfaceModule", "SetupReactSurface", "addReactRootModule", "Startup", "addReactContextModule", "addAppGraphModule", "SetupAppGraph", "addTranslationsModule", "SetupTranslations", "fnUntraced", "contributes", "Capability", "Translations", "Array", "isArray", "translations", "addMetadataModule", "SetupMetadata", "metadata", "map", "m", "Metadata", "addSettingsModule", "SetupSettings", "addBlueprintDefinitionModule", "SetupArtifactDefinition", "addSchemaModule", "SetupSchema", "Schema", "schema", "addCommandModule", "commands", "cmd", "Command", "createSurface", "definition", "kind", "createWebSurface"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/core/plugin-manager.ts", "../../../src/core/capability-manager.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom, Registry } from '@effect-atom/atom-react';\nimport * as Array from 'effect/Array';\nimport * as Cause from 'effect/Cause';\nimport * as Deferred from 'effect/Deferred';\nimport * as Duration from 'effect/Duration';\nimport * as Effect from 'effect/Effect';\nimport * as Fiber from 'effect/Fiber';\nimport * as Function from 'effect/Function';\nimport * as HashSet from 'effect/HashSet';\nimport * as PubSub from 'effect/PubSub';\nimport * as Ref from 'effect/Ref';\n\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { log } from '@dxos/log';\n\nimport * as ActivationEvent from './activation-event';\nimport * as Capability from './capability';\nimport * as CapabilityManager from './capability-manager';\nimport * as Plugin from './plugin';\n\n/**\n * Identifier denoting a Manager.\n */\nexport const ManagerTypeId: unique symbol = Symbol.for('@dxos/app-framework/Manager');\nexport type ManagerTypeId = typeof ManagerTypeId;\n\nexport type ManagerOptions = {\n pluginLoader: (id: string) => Effect.Effect<Plugin.Plugin, Error>;\n plugins?: Plugin.Plugin[];\n core?: string[];\n enabled?: string[];\n registry?: Registry.Registry;\n};\n\ntype ActivationMessage = { event: string; state: 'activating' | 'activated' | 'error'; error?: Error };\n\n/**\n * Interface for the Plugin Manager.\n */\nexport interface PluginManager {\n readonly [ManagerTypeId]: ManagerTypeId;\n readonly activation: PubSub.PubSub<ActivationMessage>;\n readonly capabilities: CapabilityManager.CapabilityManager;\n readonly registry: Registry.Registry;\n\n readonly plugins: Atom.Atom<readonly Plugin.Plugin[]>;\n readonly core: Atom.Atom<readonly string[]>;\n readonly enabled: Atom.Atom<readonly string[]>;\n readonly modules: Atom.Atom<readonly Plugin.PluginModule[]>;\n readonly active: Atom.Atom<readonly string[]>;\n readonly eventsFired: Atom.Atom<readonly string[]>;\n readonly pendingReset: Atom.Atom<readonly string[]>;\n\n getPlugins(): readonly Plugin.Plugin[];\n getCore(): readonly string[];\n getEnabled(): readonly string[];\n getModules(): readonly Plugin.PluginModule[];\n getActive(): readonly string[];\n getEventsFired(): readonly string[];\n getPendingReset(): readonly string[];\n\n add(id: string): Effect.Effect<boolean, Error>;\n enable(id: string): Effect.Effect<boolean, Error>;\n remove(id: string): boolean;\n disable(id: string): Effect.Effect<boolean, Error>;\n // TODO(wittjosiah): Improve error typing.\n activate(\n event: ActivationEvent.ActivationEvent | string,\n params?: { before?: string; after?: string },\n ): Effect.Effect<boolean, Error>;\n deactivate(id: string): Effect.Effect<boolean, Error>;\n reset(event: ActivationEvent.ActivationEvent | string): Effect.Effect<boolean, Error>;\n}\n\n/**\n * Type guard to check if a value is a PluginManager.\n */\nexport const isManager = (value: unknown): value is PluginManager => {\n return typeof value === 'object' && value !== null && ManagerTypeId in value;\n};\n\n/**\n * Internal implementation of PluginManager.\n */\nclass ManagerImpl implements PluginManager {\n readonly [ManagerTypeId]: ManagerTypeId = ManagerTypeId;\n readonly activation = Effect.runSync(PubSub.unbounded<ActivationMessage>());\n readonly capabilities: CapabilityManager.CapabilityManager;\n readonly registry: Registry.Registry;\n\n private readonly _pluginsAtom: Atom.Writable<Plugin.Plugin[]>;\n private readonly _coreAtom: Atom.Writable<string[]>;\n private readonly _enabledAtom: Atom.Writable<string[]>;\n private readonly _modulesAtom: Atom.Writable<Plugin.PluginModule[]>;\n private readonly _activeAtom: Atom.Writable<string[]>;\n private readonly _eventsFiredAtom: Atom.Writable<string[]>;\n private readonly _pendingResetAtom: Atom.Writable<string[]>;\n private readonly _pluginLoader: ManagerOptions['pluginLoader'];\n private readonly _capabilities = new Map<string, Capability.Any[]>();\n private readonly _moduleMemoMap = new Map<Plugin.PluginModule['id'], Deferred.Deferred<Capability.Any[], Error>>();\n private readonly _moduleSemaphores = new Map<Plugin.PluginModule['id'], Effect.Semaphore>();\n private readonly _activatingEvents = Effect.runSync(Ref.make<string[]>([]));\n private readonly _activatingModules = Effect.runSync(Ref.make<string[]>([]));\n\n constructor({\n pluginLoader,\n plugins = [],\n core = plugins.map(({ meta }) => meta.id),\n enabled = [],\n registry,\n }: ManagerOptions) {\n this.registry = registry ?? Registry.make();\n this.capabilities = CapabilityManager.make({\n registry: this.registry,\n });\n\n this._pluginLoader = pluginLoader;\n this._pluginsAtom = Atom.make(plugins).pipe(Atom.keepAlive);\n this._coreAtom = Atom.make(core).pipe(Atom.keepAlive);\n this._enabledAtom = Atom.make(enabled).pipe(Atom.keepAlive);\n this._modulesAtom = Atom.make<Plugin.PluginModule[]>([]).pipe(Atom.keepAlive);\n this._activeAtom = Atom.make<string[]>([]).pipe(Atom.keepAlive);\n this._eventsFiredAtom = Atom.make<string[]>([]).pipe(Atom.keepAlive);\n this._pendingResetAtom = Atom.make<string[]>([]).pipe(Atom.keepAlive);\n plugins.forEach((plugin) => this._addPlugin(plugin));\n void Effect.all([...core, ...enabled].map((id) => this.enable(id))).pipe(runAndForwardErrors);\n }\n\n get plugins(): Atom.Atom<readonly Plugin.Plugin[]> {\n return this._pluginsAtom;\n }\n\n get core(): Atom.Atom<readonly string[]> {\n return this._coreAtom;\n }\n\n /**\n * Ids of plugins that are currently enabled.\n */\n get enabled(): Atom.Atom<readonly string[]> {\n return this._enabledAtom;\n }\n\n /**\n * Modules of plugins which are currently enabled.\n */\n get modules(): Atom.Atom<readonly Plugin.PluginModule[]> {\n return this._modulesAtom;\n }\n\n /**\n * Ids of modules which are currently active.\n */\n get active(): Atom.Atom<readonly string[]> {\n return this._activeAtom;\n }\n\n /**\n * Ids of events which have been fired.\n */\n get eventsFired(): Atom.Atom<readonly string[]> {\n return this._eventsFiredAtom;\n }\n\n /**\n * Ids of modules which are pending reset.\n */\n get pendingReset(): Atom.Atom<readonly string[]> {\n return this._pendingResetAtom;\n }\n\n getPlugins(): readonly Plugin.Plugin[] {\n return this._get(this._pluginsAtom);\n }\n\n getCore(): readonly string[] {\n return this._get(this._coreAtom);\n }\n\n getEnabled(): readonly string[] {\n return this._get(this._enabledAtom);\n }\n\n getModules(): readonly Plugin.PluginModule[] {\n return this._get(this._modulesAtom);\n }\n\n getActive(): readonly string[] {\n return this._get(this._activeAtom);\n }\n\n getEventsFired(): readonly string[] {\n return this._get(this._eventsFiredAtom);\n }\n\n getPendingReset(): readonly string[] {\n return this._get(this._pendingResetAtom);\n }\n\n /**\n * Adds a plugin to the manager via the plugin loader.\n * @param id The id of the plugin.\n */\n add(id: string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n log('add plugin', { id });\n const plugin = yield* this._pluginLoader(id);\n this._addPlugin(plugin);\n return yield* this.enable(id);\n });\n }\n\n /**\n * Enables a plugin.\n * @param id The id of the plugin.\n */\n enable(id: string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n log('enable plugin', { id });\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n this._update(this._enabledAtom, (enabled) => (enabled.includes(id) ? enabled : [...enabled, id]));\n\n plugin.modules.forEach((module) => {\n this._addModule(module);\n this._setPendingResetByModule(module);\n });\n\n log('pending reset', { events: [...this.getPendingReset()] });\n yield* Effect.all(\n this.getPendingReset().map((event) => this.activate(event)),\n { concurrency: 'unbounded' },\n );\n\n return true;\n });\n }\n\n /**\n * Removes a plugin from the manager.\n * @param id The id of the plugin.\n */\n remove(id: string): boolean {\n log('remove plugin', { id });\n const result = this.disable(id);\n if (!result) {\n return false;\n }\n\n this._removePlugin(id);\n return true;\n }\n\n /**\n * Disables a plugin.\n * @param id The id of the plugin.\n */\n disable(id: string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n log('disable plugin', { id });\n if (this._get(this._coreAtom).includes(id)) {\n return false;\n }\n\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n const enabledIndex = this._get(this._enabledAtom).findIndex((enabled) => enabled === id);\n if (enabledIndex !== -1) {\n this._update(this._enabledAtom, (enabled) => enabled.filter((item) => item !== id));\n yield* this.deactivate(id);\n\n plugin.modules.forEach((module) => {\n this._removeModule(module.id);\n });\n }\n\n return true;\n });\n }\n\n /**\n * Activates plugins based on the activation event.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\n activate(\n event: ActivationEvent.ActivationEvent | string,\n params?: { before?: string; after?: string },\n ): Effect.Effect<boolean, Error> {\n const key = typeof event === 'string' ? event : ActivationEvent.eventKey(event);\n return Effect.gen(this, function* () {\n log('activating', { key, ...params });\n yield* Ref.update(this._activatingEvents, (activating) => Array.append(activating, key));\n const pendingIndex = this._get(this._pendingResetAtom).findIndex((event) => event === key);\n if (pendingIndex !== -1) {\n this._update(this._pendingResetAtom, (pending) => pending.filter((event) => event !== key));\n }\n\n const activatingEvents = yield* this._activatingEvents;\n const activatingModules = yield* this._activatingModules;\n const modules = this._getInactiveModulesByEvent(key).filter((module) => {\n const allOf = ActivationEvent.isAllOf(module.activatesOn);\n if (!allOf) {\n return true;\n }\n\n // Check to see if all of the events in the `allOf` have been fired.\n // An event can be considered \"fired\" if it is in the `eventsFired` list or if it is currently being activated.\n const events = ActivationEvent.getEvents(module.activatesOn).filter(\n (event) => ActivationEvent.eventKey(event) !== key,\n );\n return (\n events.every(\n (event) =>\n this._get(this._eventsFiredAtom).includes(ActivationEvent.eventKey(event)) ||\n activatingEvents.includes(ActivationEvent.eventKey(event)),\n ) && !activatingModules.includes(module.id)\n );\n });\n yield* Ref.update(this._activatingModules, (activating) =>\n Array.appendAll(\n activating,\n modules.map((module) => module.id),\n ),\n );\n if (modules.length === 0) {\n log('no modules to activate', { key });\n if (!this._get(this._eventsFiredAtom).includes(key)) {\n this._update(this._eventsFiredAtom, (events) => [...events, key]);\n }\n return false;\n }\n\n log('activating modules', { key, modules: modules.map((module) => module.id) });\n yield* PubSub.publish(this.activation, { event: key, state: 'activating' });\n\n // Fire activatesBefore events.\n const beforeEvents = Function.pipe(\n modules,\n Array.flatMap((module) => module.activatesBefore ?? []),\n HashSet.fromIterable,\n HashSet.toValues,\n Array.filter((event) => !activatingEvents.includes(ActivationEvent.eventKey(event))),\n );\n yield* Function.pipe(\n beforeEvents,\n Array.map((event) => this.activate(event, { before: key })),\n Effect.allWith({ concurrency: 'unbounded' }),\n together(\n Effect.sleep(Duration.seconds(10)).pipe(\n Effect.andThen(\n Effect.sync(() =>\n log.warn('activatesBefore is taking a long time', {\n event: key,\n beforeEvents: beforeEvents.map(ActivationEvent.eventKey),\n }),\n ),\n ),\n ),\n ),\n );\n\n // Concurrently triggers loading of lazy capabilities.\n const getCapabilities = yield* Function.pipe(\n modules,\n Array.map((mod) => this._loadModule(mod)),\n Effect.allWith({ concurrency: 'unbounded' }),\n Effect.catchAll((error) => {\n return Effect.gen(this, function* () {\n yield* PubSub.publish(this.activation, { event: key, state: 'error', error });\n return yield* Effect.fail(error);\n });\n }),\n );\n\n // Contribute the capabilities from the activated modules.\n yield* Function.pipe(\n modules,\n Array.zip(getCapabilities),\n Array.map(([module, capabilities]) => this._contributeCapabilities(module, capabilities)),\n // TODO(wittjosiah): This currently can't be run in parallel.\n // Running this with concurrency causes races with `allOf` activation events.\n Effect.all,\n );\n\n // Fire activatesAfter events.\n const afterEvents = Function.pipe(\n modules,\n Array.flatMap((module) => module.activatesAfter ?? []),\n HashSet.fromIterable,\n HashSet.toValues,\n Array.filter((event) => !activatingEvents.includes(ActivationEvent.eventKey(event))),\n );\n yield* Function.pipe(\n afterEvents,\n Array.map((event) => this.activate(event, { after: key })),\n Effect.allWith({ concurrency: 'unbounded' }),\n together(\n Effect.sleep(Duration.seconds(10)).pipe(\n Effect.andThen(\n Effect.sync(() =>\n log.warn('activatesAfter is taking a long time', {\n event: key,\n afterEvents: afterEvents.map(ActivationEvent.eventKey),\n }),\n ),\n ),\n ),\n ),\n );\n\n yield* Ref.update(this._activatingEvents, (activating) => Array.filter(activating, (event) => event !== key));\n yield* Ref.update(this._activatingModules, (activating) =>\n Array.filter(activating, (module) => !modules.map((module) => module.id).includes(module)),\n );\n\n if (!this._get(this._eventsFiredAtom).includes(key)) {\n this._update(this._eventsFiredAtom, (events) => [...events, key]);\n }\n\n yield* PubSub.publish(this.activation, { event: key, state: 'activated' });\n log('activated', { key });\n\n return true;\n }).pipe(\n together(\n Effect.sleep(Duration.seconds(15)).pipe(\n Effect.andThen(Effect.sync(() => log.warn('event activation is taking a long time', { event: key }))),\n ),\n ),\n );\n }\n\n /**\n * Deactivates all of the modules for a plugin.\n * @param id The id of the plugin.\n * @returns Whether the deactivation was successful.\n */\n deactivate(id: string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const plugin = this._getPlugin(id);\n if (!plugin) {\n return false;\n }\n\n const modules = plugin.modules;\n const results = yield* Effect.all(\n modules.map((module) => this._deactivateModule(module)),\n { concurrency: 'unbounded' },\n );\n return results.every((result) => result);\n });\n }\n\n /**\n * Re-activates the modules that were activated by the event.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\n reset(event: ActivationEvent.ActivationEvent | string): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const key = typeof event === 'string' ? event : ActivationEvent.eventKey(event);\n log('reset', { key });\n const modules = this._getActiveModulesByEvent(key);\n const results = yield* Effect.all(\n modules.map((module) => this._deactivateModule(module)),\n { concurrency: 'unbounded' },\n );\n\n if (results.every((result) => result)) {\n return yield* this.activate(key);\n } else {\n return false;\n }\n });\n }\n\n private _get<T>(atom: Atom.Atom<T>): T {\n return this.registry.get(atom);\n }\n\n private _set<T>(atom: Atom.Writable<T>, value: T): void {\n this.registry.set(atom, value);\n }\n\n private _update<T>(atom: Atom.Writable<T>, updater: (current: T) => T): void {\n this._set(atom, updater(this._get(atom)));\n }\n\n private _addPlugin(plugin: Plugin.Plugin): void {\n log('add plugin', { id: plugin.meta.id });\n // TODO(wittjosiah): Find a way to add a warning for duplicate plugins that doesn't cause log spam.\n this._update(this._pluginsAtom, (plugins) => (plugins.includes(plugin) ? plugins : [...plugins, plugin]));\n }\n\n private _removePlugin(id: string): void {\n log('remove plugin', { id });\n this._update(this._pluginsAtom, (plugins) => plugins.filter((plugin) => plugin.meta.id !== id));\n }\n\n private _addModule(module: Plugin.PluginModule): void {\n log('add module', { id: module.id });\n // TODO(wittjosiah): Find a way to add a warning for duplicate modules that doesn't cause log spam.\n this._update(this._modulesAtom, (modules) => (modules.includes(module) ? modules : [...modules, module]));\n }\n\n private _removeModule(id: string): void {\n log('remove module', { id });\n this._update(this._modulesAtom, (modules) => modules.filter((module) => module.id !== id));\n }\n\n private _getPlugin(id: string): Plugin.Plugin | undefined {\n return this._get(this._pluginsAtom).find((plugin) => plugin.meta.id === id);\n }\n\n private _getActiveModules(): Plugin.PluginModule[] {\n const active = this._get(this._activeAtom);\n return this._get(this._modulesAtom).filter((module) => active.includes(module.id));\n }\n\n private _getInactiveModules(): Plugin.PluginModule[] {\n const active = this._get(this._activeAtom);\n return this._get(this._modulesAtom).filter((module) => !active.includes(module.id));\n }\n\n private _getActiveModulesByEvent(key: string): Plugin.PluginModule[] {\n return this._getActiveModules().filter((module) =>\n ActivationEvent.getEvents(module.activatesOn).map(ActivationEvent.eventKey).includes(key),\n );\n }\n\n private _getInactiveModulesByEvent(key: string): Plugin.PluginModule[] {\n return this._getInactiveModules().filter((module) =>\n ActivationEvent.getEvents(module.activatesOn).map(ActivationEvent.eventKey).includes(key),\n );\n }\n\n private _setPendingResetByModule(module: Plugin.PluginModule): void {\n const activationEvents = ActivationEvent.getEvents(module.activatesOn)\n .map(ActivationEvent.eventKey)\n .filter((key) => this._get(this._eventsFiredAtom).includes(key));\n\n const pendingReset = Array.fromIterable(new Set(activationEvents)).filter((event) => {\n const pending = this._get(this._pendingResetAtom);\n return !pending.includes(event);\n });\n if (pendingReset.length > 0) {\n log('pending reset', { events: pendingReset });\n this._update(this._pendingResetAtom, (current) => [...current, ...pendingReset]);\n }\n }\n\n private _getModuleSemaphore(moduleId: Plugin.PluginModule['id']): Effect.Semaphore {\n let semaphore = this._moduleSemaphores.get(moduleId);\n if (!semaphore) {\n semaphore = Effect.runSync(Effect.makeSemaphore(1));\n this._moduleSemaphores.set(moduleId, semaphore);\n }\n return semaphore;\n }\n\n private _loadModule = (module: Plugin.PluginModule): Effect.Effect<Capability.Any[], Error> =>\n Effect.gen(this, function* () {\n const semaphore = this._getModuleSemaphore(module.id);\n\n // Atomically check-and-set under per-module semaphore to prevent race conditions.\n const deferredToAwait = yield* Effect.gen(this, function* () {\n const existing = this._moduleMemoMap.get(module.id);\n if (existing) {\n return existing;\n }\n\n // First caller - create deferred, store it, and start loading in background.\n const deferred = yield* Deferred.make<Capability.Any[], Error>();\n this._moduleMemoMap.set(module.id, deferred);\n\n const loadEffect = Effect.gen(this, function* () {\n log('loading module', { module: module.id });\n const [duration, capabilities] = yield* module\n .activate()\n .pipe(\n Effect.provideService(Capability.Service, this.capabilities),\n Effect.provideService(Plugin.Service, this),\n Effect.timed,\n );\n const normalized = capabilities == null ? [] : Array.isArray(capabilities) ? capabilities : [capabilities];\n log('loaded module', {\n module: module.id,\n elapsed: Duration.toMillis(duration),\n failed: false,\n });\n return normalized as Capability.Any[];\n }).pipe(\n Effect.withSpan('PluginManager._loadModule'),\n together(\n Effect.sleep(Duration.seconds(10)).pipe(\n Effect.andThen(\n Effect.sync(() => log.warn(`module is taking a long time to activate`, { module: module.id })),\n ),\n ),\n ),\n );\n\n // Fork the load to run in background, completing the deferred when done.\n yield* Effect.forkDaemon(\n loadEffect.pipe(\n Effect.tap((result) => Deferred.succeed(deferred, result)),\n Effect.catchAllCause((cause) => {\n const error = Cause.squash(cause);\n log.error('module failed to activate', {\n module: module.id,\n error: error instanceof Error ? error.message : String(error),\n stack: error instanceof Error ? error.stack : undefined,\n isDefect: !Cause.isFailure(cause),\n });\n return Deferred.fail(deferred, error instanceof Error ? error : new Error(String(error)));\n }),\n ),\n );\n\n return deferred;\n }).pipe(semaphore.withPermits(1));\n\n // Wait for result outside the semaphore so multiple waiters can proceed concurrently.\n return yield* Deferred.await(deferredToAwait);\n });\n\n private _contributeCapabilities(\n module: Plugin.PluginModule,\n capabilities: Capability.Any[],\n ): Effect.Effect<void, Error> {\n return Effect.gen(this, function* () {\n capabilities.forEach((capability) => {\n this.capabilities.contribute({ module: module.id, ...capability });\n });\n this._update(this._activeAtom, (active) => [...active, module.id]);\n this._capabilities.set(module.id, capabilities);\n });\n }\n\n private _deactivateModule(module: Plugin.PluginModule): Effect.Effect<boolean, Error> {\n return Effect.gen(this, function* () {\n const id = module.id;\n log('deactivating', { id });\n this._moduleMemoMap.delete(id);\n\n const capabilities = this._capabilities.get(id);\n if (capabilities) {\n for (const capability of capabilities) {\n this.capabilities.remove(capability.interface, capability.implementation);\n const program = capability.deactivate?.() ?? Effect.succeed(undefined);\n yield* program;\n }\n this._capabilities.delete(id);\n }\n\n const activeIndex = this._get(this._activeAtom).findIndex((event) => event === id);\n if (activeIndex !== -1) {\n this._update(this._activeAtom, (active) => active.filter((event) => event !== id));\n }\n\n log('deactivated', { id });\n return true;\n });\n }\n}\n\n/**\n * Creates a new Plugin Manager instance.\n */\nexport const make = (options: ManagerOptions): PluginManager => new ManagerImpl(options);\n\n/**\n * Runs an effect concurrently with another effect.\n * If the first effect completes, the second effect is interrupted.\n */\n// TODO(dmaretskyi): Effect.race > Effect.asVoid\nconst together =\n <R1>(togetherEffect: Effect.Effect<void, never, R1>) =>\n <A, E, R2>(effect: Effect.Effect<A, E, R2>): Effect.Effect<A, E, R1 | R2> =>\n Effect.gen(function* () {\n const togetherFiber = yield* Effect.fork(togetherEffect);\n const result = yield* effect;\n yield* Fiber.interrupt(togetherFiber);\n return result;\n });\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { Atom, type Registry } from '@effect-atom/atom-react';\nimport * as Deferred from 'effect/Deferred';\nimport * as Effect from 'effect/Effect';\n\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nimport type * as Capability from './capability';\n\ntype CapabilityEntry<T> = {\n moduleId: string;\n implementation: T;\n};\n\n/**\n * Options for creating a capability manager.\n * @internal\n */\nexport type CapabilityManagerOptions = {\n registry: Registry.Registry;\n};\n\n/**\n * Interface for the Capability Manager.\n * Provides methods for contributing, removing, and accessing capabilities.\n */\nexport interface CapabilityManager {\n contribute<T>(args: { module: string; interface: Capability.InterfaceDef<T>; implementation: T }): void;\n\n remove<T>(interfaceDef: Capability.InterfaceDef<T>, implementation: T): void;\n\n /**\n * Get the Atom reference to the available capabilities for a given interface.\n * Primarily useful for deriving other Atom values based on the capabilities or\n * for subscribing to changes in the capabilities.\n * @returns An atom reference to the available capabilities.\n */\n atom<T>(interfaceDef: Capability.InterfaceDef<T>): Atom.Atom<T[]>;\n\n /**\n * Get capabilities from the capability manager.\n * @returns An array of capabilities.\n */\n getAll<T>(interfaceDef: Capability.InterfaceDef<T>): T[];\n\n /**\n * Requests a single capability from the capability manager.\n * @returns The capability.\n * @throws If no capability is found.\n */\n get<T>(interfaceDef: Capability.InterfaceDef<T>): T;\n\n /**\n * Waits for a capability to be available.\n * @returns The capability.\n */\n waitFor<T>(interfaceDef: Capability.InterfaceDef<T>): Effect.Effect<T, Error>;\n}\n\n/**\n * Internal implementation of CapabilityManager.\n */\nclass CapabilityManagerImpl implements CapabilityManager {\n private readonly _registry: Registry.Registry;\n\n private readonly _capabilityEntries = Atom.family<string, Atom.Writable<CapabilityEntry<unknown>[]>>(() => {\n return Atom.make<CapabilityEntry<unknown>[]>([]).pipe(Atom.keepAlive);\n });\n\n readonly _capabilities = Atom.family<string, Atom.Atom<unknown[]>>((id: string) => {\n return Atom.make((get) => {\n const current = get(this._capabilityEntries(id));\n return current.map((c) => c.implementation);\n });\n });\n\n readonly _capability = Atom.family<string, Atom.Atom<unknown>>((id: string) => {\n return Atom.make((get) => {\n const current = get(this._capabilities(id));\n invariant(current.length > 0, `No capability found for ${id}`);\n return current[0];\n });\n });\n\n constructor({ registry }: CapabilityManagerOptions) {\n this._registry = registry;\n }\n\n contribute<T>({\n module: moduleId,\n interface: interfaceDef,\n implementation,\n }: {\n module: string;\n interface: Capability.InterfaceDef<T>;\n implementation: T;\n }): void {\n const current = this._registry.get(this._capabilityEntries(interfaceDef.identifier));\n const isDuplicate = current.some((c) => c.moduleId === moduleId && c.implementation === implementation);\n if (isDuplicate) {\n log('capability already contributed, skipping', { id: interfaceDef.identifier, moduleId });\n return;\n }\n\n const entry: CapabilityEntry<T> = { moduleId, implementation };\n this._registry.set(this._capabilityEntries(interfaceDef.identifier), [...current, entry]);\n log('capability contributed', {\n id: interfaceDef.identifier,\n moduleId,\n count: current.length,\n });\n }\n\n remove<T>(interfaceDef: Capability.InterfaceDef<T>, implementation: T): void {\n const current = this._registry.get(this._capabilityEntries(interfaceDef.identifier));\n if (current.length === 0) {\n return;\n }\n\n const next = current.filter((c) => c.implementation !== implementation);\n if (next.length !== current.length) {\n this._registry.set(this._capabilityEntries(interfaceDef.identifier), next);\n log('capability removed', { id: interfaceDef.identifier, count: current.length });\n } else {\n log.warn('capability not removed', { id: interfaceDef.identifier });\n }\n }\n\n atom<T>(interfaceDef: Capability.InterfaceDef<T>): Atom.Atom<T[]> {\n // NOTE: This the type-checking for capabilities is done at the time of contribution.\n return this._capabilities(interfaceDef.identifier) as Atom.Atom<T[]>;\n }\n\n getAll<T>(interfaceDef: Capability.InterfaceDef<T>): T[] {\n return this._registry.get(this.atom(interfaceDef));\n }\n\n get<T>(interfaceDef: Capability.InterfaceDef<T>): T {\n const capabilities = this.getAll(interfaceDef);\n invariant(capabilities.length > 0, `No capability found for ${interfaceDef.identifier}`);\n return capabilities[0];\n }\n\n waitFor<T>(interfaceDef: Capability.InterfaceDef<T>): Effect.Effect<T, Error> {\n return Effect.gen(this, function* () {\n const [capability] = this.getAll(interfaceDef);\n if (capability) {\n return capability;\n }\n\n const deferred = yield* Deferred.make<T, Error>();\n const cancel = this._registry.subscribe(this.atom(interfaceDef), (capabilities) => {\n if (capabilities.length > 0) {\n Effect.runSync(Deferred.succeed(deferred, capabilities[0]));\n }\n });\n const result = yield* Deferred.await(deferred);\n cancel();\n return result;\n });\n }\n}\n\n/**\n * Creates a new Capability Manager instance.\n */\nexport const make = (options: CapabilityManagerOptions): CapabilityManager => new CapabilityManagerImpl(options);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;;;;cAAAA;;AAIA,SAASC,QAAAA,OAAMC,gBAAgB;AAC/B,YAAYC,WAAW;AACvB,YAAYC,WAAW;AACvB,YAAYC,eAAc;AAC1B,YAAYC,cAAc;AAC1B,YAAYC,aAAY;AACxB,YAAYC,WAAW;AACvB,YAAYC,cAAc;AAC1B,YAAYC,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,SAAS;AAErB,SAASC,2BAA2B;AACpC,SAASC,OAAAA,YAAW;;;ACjBpB;;cAAAC;;AAIA,SAASC,YAA2B;AACpC,YAAYC,cAAc;AAC1B,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,WAAW;;AAyDpB,IAAMC,wBAAN,MAAMA;EACaC;EAEAC,qBAAqBP,KAAKQ,OAA0D,MAAA;AACnG,WAAOR,KAAKD,KAAiC,CAAA,CAAE,EAAEU,KAAKT,KAAKU,SAAS;EACtE,CAAA;EAESC,gBAAgBX,KAAKQ,OAAqC,CAACI,OAAAA;AAClE,WAAOZ,KAAKD,KAAK,CAACc,QAAAA;AAChB,YAAMC,UAAUD,IAAI,KAAKN,mBAAmBK,EAAAA,CAAAA;AAC5C,aAAOE,QAAQC,IAAI,CAACC,MAAMA,EAAEC,cAAc;IAC5C,CAAA;EACF,CAAA;EAESC,cAAclB,KAAKQ,OAAmC,CAACI,OAAAA;AAC9D,WAAOZ,KAAKD,KAAK,CAACc,QAAAA;AAChB,YAAMC,UAAUD,IAAI,KAAKF,cAAcC,EAAAA,CAAAA;AACvCT,gBAAUW,QAAQK,SAAS,GAAG,2BAA2BP,EAAAA,IAAI;;;;;;;;;AAC7D,aAAOE,QAAQ,CAAA;IACjB,CAAA;EACF,CAA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ACA,aAAK5J,cAAcyJ,OAAO7I,EAAAA;MAC5B;AAEA,YAAMiJ,cAAc,KAAKhI,KAAK,KAAKjC,WAAW,EAAE0D,UAAU,CAACR,UAAUA,UAAUlC,EAAAA;AAC/E,UAAIiJ,gBAAgB,IAAI;AACtB,aAAKrH,QAAQ,KAAK5C,aAAa,CAAC6B,WAAWA,OAAO8B,OAAO,CAACT,UAAUA,UAAUlC,EAAAA,CAAAA;MAChF;AAEA0B,MAAAA,KAAI,eAAe;QAAE1B;MAAG,GAAA;;;;;;AACxB,aAAO;IACT,CAAA;EACF;AACF;AAKO,IAAMP,QAAO,CAACyJ,YAA2C,IAAI5K,YAAY4K,OAAAA;AAOhF,IAAMxE,WACJ,CAAKyE,mBACL,CAAWC,WACF3H,YAAI,aAAA;AACT,QAAM4H,gBAAgB,OAAcC,aAAKH,cAAAA;AACzC,QAAM7G,SAAS,OAAO8G;AACtB,SAAaG,gBAAUF,aAAAA;AACvB,SAAO/G;AACT,CAAA;",
|
|
6
|
-
"names": ["make", "Atom", "Registry", "Array", "Cause", "Deferred", "Duration", "Effect", "Fiber", "Function", "HashSet", "PubSub", "Ref", "runAndForwardErrors", "log", "make", "Atom", "Deferred", "Effect", "invariant", "log", "CapabilityManagerImpl", "_registry", "_capabilityEntries", "family", "pipe", "keepAlive", "_capabilities", "id", "get", "current", "map", "c", "implementation", "_capability", "length", "registry", "contribute", "module", "moduleId", "interface", "interfaceDef", "identifier", "isDuplicate", "some", "entry", "set", "count", "remove", "next", "filter", "warn", "atom", "getAll", "capabilities", "waitFor", "gen", "capability", "deferred", "cancel", "subscribe", "runSync", "succeed", "result", "await", "options", "ManagerTypeId", "Symbol", "for", "isManager", "value", "ManagerImpl", "activation", "runSync", "unbounded", "capabilities", "registry", "_pluginsAtom", "_coreAtom", "_enabledAtom", "_modulesAtom", "_activeAtom", "_eventsFiredAtom", "_pendingResetAtom", "_pluginLoader", "_capabilities", "Map", "_moduleMemoMap", "_moduleSemaphores", "_activatingEvents", "make", "_activatingModules", "pluginLoader", "plugins", "core", "map", "meta", "id", "enabled", "Registry", "Atom", "pipe", "keepAlive", "forEach", "plugin", "_addPlugin", "all", "enable", "runAndForwardErrors", "modules", "active", "eventsFired", "pendingReset", "getPlugins", "_get", "getCore", "getEnabled", "getModules", "getActive", "getEventsFired", "getPendingReset", "add", "gen", "log", "_getPlugin", "_update", "includes", "module", "_addModule", "_setPendingResetByModule", "events", "event", "activate", "concurrency", "remove", "result", "disable", "_removePlugin", "enabledIndex", "findIndex", "filter", "item", "deactivate", "_removeModule", "params", "key", "eventKey", "update", "activating", "append", "pendingIndex", "pending", "activatingEvents", "activatingModules", "_getInactiveModulesByEvent", "allOf", "isAllOf", "activatesOn", "getEvents", "every", "appendAll", "length", "publish", "state", "beforeEvents", "flatMap", "activatesBefore", "fromIterable", "toValues", "before", "allWith", "together", "sleep", "seconds", "andThen", "sync", "warn", "getCapabilities", "mod", "_loadModule", "catchAll", "error", "fail", "zip", "_contributeCapabilities", "afterEvents", "activatesAfter", "after", "results", "_deactivateModule", "reset", "_getActiveModulesByEvent", "atom", "get", "_set", "set", "updater", "find", "_getActiveModules", "_getInactiveModules", "activationEvents", "Set", "current", "_getModuleSemaphore", "moduleId", "semaphore", "makeSemaphore", "deferredToAwait", "existing", "deferred", "loadEffect", "duration", "provideService", "Service", "timed", "normalized", "isArray", "elapsed", "toMillis", "failed", "withSpan", "forkDaemon", "tap", "succeed", "catchAllCause", "cause", "squash", "Error", "message", "String", "stack", "undefined", "isDefect", "isFailure", "withPermits", "await", "capability", "contribute", "delete", "interface", "implementation", "program", "activeIndex", "options", "togetherEffect", "effect", "togetherFiber", "fork", "interrupt"]
|
|
7
|
-
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
capability_exports
|
|
3
|
-
} from "./chunk-6Y7PZV72.mjs";
|
|
4
|
-
|
|
5
|
-
// src/plugin-settings/meta.ts
|
|
6
|
-
var meta = {
|
|
7
|
-
id: "dxos.org/plugin/settings",
|
|
8
|
-
name: "Settings"
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// src/plugin-settings/actions.ts
|
|
12
|
-
import * as Schema from "effect/Schema";
|
|
13
|
-
import { Operation } from "@dxos/operation";
|
|
14
|
-
var SETTINGS_ID = "!dxos:settings";
|
|
15
|
-
var SETTINGS_KEY = "settings";
|
|
16
|
-
(function(SettingsAction2) {
|
|
17
|
-
class Open extends Schema.TaggedClass()(`${meta.id}/open`, {
|
|
18
|
-
input: Schema.Struct({
|
|
19
|
-
plugin: Schema.optional(Schema.String)
|
|
20
|
-
}),
|
|
21
|
-
output: Schema.Void
|
|
22
|
-
}) {
|
|
23
|
-
}
|
|
24
|
-
SettingsAction2.Open = Open;
|
|
25
|
-
class OpenPluginRegistry extends Schema.TaggedClass()(`${meta.id}/open-plugin-registry`, {
|
|
26
|
-
input: Schema.Void,
|
|
27
|
-
output: Schema.Void
|
|
28
|
-
}) {
|
|
29
|
-
}
|
|
30
|
-
SettingsAction2.OpenPluginRegistry = OpenPluginRegistry;
|
|
31
|
-
})(SettingsAction || (SettingsAction = {}));
|
|
32
|
-
var SETTINGS_OPERATION = `${meta.id}/operation`;
|
|
33
|
-
(function(SettingsOperation2) {
|
|
34
|
-
SettingsOperation2.Open = Operation.make({
|
|
35
|
-
meta: {
|
|
36
|
-
key: `${SETTINGS_OPERATION}/open`,
|
|
37
|
-
name: "Open Settings",
|
|
38
|
-
description: "Open the settings panel."
|
|
39
|
-
},
|
|
40
|
-
services: [
|
|
41
|
-
capability_exports.Service
|
|
42
|
-
],
|
|
43
|
-
schema: {
|
|
44
|
-
input: Schema.Struct({
|
|
45
|
-
plugin: Schema.optional(Schema.String.annotations({
|
|
46
|
-
description: "The plugin to open settings for."
|
|
47
|
-
}))
|
|
48
|
-
}),
|
|
49
|
-
output: Schema.Void
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
SettingsOperation2.OpenPluginRegistry = Operation.make({
|
|
53
|
-
meta: {
|
|
54
|
-
key: `${SETTINGS_OPERATION}/open-plugin-registry`,
|
|
55
|
-
name: "Open Plugin Registry",
|
|
56
|
-
description: "Open the plugin registry."
|
|
57
|
-
},
|
|
58
|
-
services: [
|
|
59
|
-
capability_exports.Service
|
|
60
|
-
],
|
|
61
|
-
schema: {
|
|
62
|
-
input: Schema.Void,
|
|
63
|
-
output: Schema.Void
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
})(SettingsOperation || (SettingsOperation = {}));
|
|
67
|
-
var SettingsAction;
|
|
68
|
-
var SettingsOperation;
|
|
69
|
-
|
|
70
|
-
export {
|
|
71
|
-
meta,
|
|
72
|
-
SETTINGS_ID,
|
|
73
|
-
SETTINGS_KEY,
|
|
74
|
-
SettingsAction,
|
|
75
|
-
SettingsOperation
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=chunk-H4WPA7U7.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugin-settings/meta.ts", "../../../src/plugin-settings/actions.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.org/plugin/settings',\n name: 'Settings',\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { Operation } from '@dxos/operation';\n\nimport { Capability } from '../core';\n\nimport { meta } from './meta';\n\n// TODO(burdon): Document.\nexport const SETTINGS_ID = '!dxos:settings';\nexport const SETTINGS_KEY = 'settings';\n\nexport namespace SettingsAction {\n export class Open extends Schema.TaggedClass<Open>()(`${meta.id}/open`, {\n input: Schema.Struct({\n plugin: Schema.optional(Schema.String),\n }),\n output: Schema.Void,\n }) {}\n\n export class OpenPluginRegistry extends Schema.TaggedClass<OpenPluginRegistry>()(`${meta.id}/open-plugin-registry`, {\n input: Schema.Void,\n output: Schema.Void,\n }) {}\n}\n\nconst SETTINGS_OPERATION = `${meta.id}/operation`;\n\n/**\n * Operations for the Settings plugin.\n */\nexport namespace SettingsOperation {\n export const Open = Operation.make({\n meta: {\n key: `${SETTINGS_OPERATION}/open`,\n name: 'Open Settings',\n description: 'Open the settings panel.',\n },\n services: [Capability.Service],\n schema: {\n input: Schema.Struct({\n plugin: Schema.optional(Schema.String.annotations({ description: 'The plugin to open settings for.' })),\n }),\n output: Schema.Void,\n },\n });\n\n export const OpenPluginRegistry = Operation.make({\n meta: {\n key: `${SETTINGS_OPERATION}/open-plugin-registry`,\n name: 'Open Plugin Registry',\n description: 'Open the plugin registry.',\n },\n services: [Capability.Service],\n schema: {\n input: Schema.Void,\n output: Schema.Void,\n },\n });\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAMO,IAAMA,OAAoB;EAC/BC,IAAI;EACJC,MAAM;AACR;;;ACLA,YAAYC,YAAY;AAExB,SAASC,iBAAiB;AAOnB,IAAMC,cAAc;AACpB,IAAMC,eAAe;UAEXC,iBAAAA;EACR,MAAMC,aAAoBC,mBAAW,EAAS,GAAGC,KAAKC,EAAE,SAAS;IACtEC,OAAcC,cAAO;MACnBC,QAAeC,gBAAgBC,aAAM;IACvC,CAAA;IACAC,QAAeC;EACjB,CAAA,EAAA;EAAI;kBALSV,OAAAA;EAON,MAAMW,2BAAkCV,mBAAW,EAAuB,GAAGC,KAAKC,EAAE,yBAAyB;IAClHC,OAAcM;IACdD,QAAeC;EACjB,CAAA,EAAA;EAAI;kBAHSC,qBAAAA;AAIf,GAZiBZ,mBAAAA,iBAAAA,CAAAA,EAAAA;AAcjB,IAAMa,qBAAqB,GAAGV,KAAKC,EAAE;UAKpBU,oBAAAA;qBACFb,OAAOc,UAAUC,KAAK;IACjCb,MAAM;MACJc,KAAK,GAAGJ,kBAAAA;MACRK,MAAM;MACNC,aAAa;IACf;IACAC,UAAU;MAACC,mBAAWC;;IACtBC,QAAQ;MACNlB,OAAcC,cAAO;QACnBC,QAAeC,gBAAgBC,cAAOe,YAAY;UAAEL,aAAa;QAAmC,CAAA,CAAA;MACtG,CAAA;MACAT,QAAeC;IACjB;EACF,CAAA;qBAEaC,qBAAqBG,UAAUC,KAAK;IAC/Cb,MAAM;MACJc,KAAK,GAAGJ,kBAAAA;MACRK,MAAM;MACNC,aAAa;IACf;IACAC,UAAU;MAACC,mBAAWC;;IACtBC,QAAQ;MACNlB,OAAcM;MACdD,QAAeC;IACjB;EACF,CAAA;AACF,GA5BiBG,sBAAAA,oBAAAA,CAAAA,EAAAA;;;",
|
|
6
|
-
"names": ["meta", "id", "name", "Schema", "Operation", "SETTINGS_ID", "SETTINGS_KEY", "SettingsAction", "Open", "TaggedClass", "meta", "id", "input", "Struct", "plugin", "optional", "String", "output", "Void", "OpenPluginRegistry", "SETTINGS_OPERATION", "SettingsOperation", "Operation", "make", "key", "name", "description", "services", "Capability", "Service", "schema", "annotations"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/core/activation-event.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * A unique string identifier representing an event.\n * This is expected to be a URI, where initial parts are often the id of the plugin whose package defines the event.\n *\n * @example dxos.org/plugin/example/event/ready\n */\nexport type ActivationEvent = {\n id: string;\n specifier?: string;\n};\n\n/**\n * An activation event that can be a single event, or a combination of events.\n */\nexport type Events =\n | ActivationEvent\n | { type: 'one-of'; events: ActivationEvent[] }\n | { type: 'all-of'; events: ActivationEvent[] };\n\n/**\n * Helper to define an activation event.\n */\nexport const make = (id: string, specifier?: string) => {\n return { id, specifier } as ActivationEvent;\n};\n\n/**\n * Helper to create an activation event key.\n */\nexport const eventKey = (event: ActivationEvent) => (event.specifier ? `${event.id}:${event.specifier}` : event.id);\n\n/**\n * Helper to create an activation event that triggers when any of the given events are activated.\n */\nexport const oneOf = (...events: ActivationEvent[]) => ({ type: 'one-of' as const, events });\n\n/**\n * Helper to create an activation event that triggers when all of the given events are activated.\n */\nexport const allOf = (...events: ActivationEvent[]) => ({ type: 'all-of' as const, events });\n\n/**\n * Helper to check if an activation event is a one-of event.\n */\nexport const isOneOf = (events: Events): events is { type: 'one-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'one-of';\n\n/**\n * Helper to check if an activation event is an all-of event.\n */\nexport const isAllOf = (events: Events): events is { type: 'all-of'; events: ActivationEvent[] } =>\n 'type' in events && events.type === 'all-of';\n\n/**\n * Helper to get the events from an activation event.\n */\nexport const getEvents = (events: Events) => ('type' in events ? events.events : [events]);\n"],
|
|
5
|
-
"mappings": ";;;;;AAAA;;;;;;;;;;AA0BO,IAAMA,OAAO,CAACC,IAAYC,cAAAA;AAC/B,SAAO;IAAED;IAAIC;EAAU;AACzB;AAKO,IAAMC,WAAW,CAACC,UAA4BA,MAAMF,YAAY,GAAGE,MAAMH,EAAE,IAAIG,MAAMF,SAAS,KAAKE,MAAMH;AAKzG,IAAMI,QAAQ,IAAIC,YAA+B;EAAEC,MAAM;EAAmBD;AAAO;AAKnF,IAAME,QAAQ,IAAIF,YAA+B;EAAEC,MAAM;EAAmBD;AAAO;AAKnF,IAAMG,UAAU,CAACH,WACtB,UAAUA,UAAUA,OAAOC,SAAS;AAK/B,IAAMG,UAAU,CAACJ,WACtB,UAAUA,UAAUA,OAAOC,SAAS;AAK/B,IAAMI,YAAY,CAACL,WAAoB,UAAUA,SAASA,OAAOA,SAAS;EAACA;;",
|
|
6
|
-
"names": ["make", "id", "specifier", "eventKey", "event", "oneOf", "events", "type", "allOf", "isOneOf", "isAllOf", "getEvents"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/core/plugin.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Context from 'effect/Context';\nimport * as Effect from 'effect/Effect';\nimport * as Option from 'effect/Option';\nimport * as Pipeable from 'effect/Pipeable';\n\nimport { invariant } from '@dxos/invariant';\n\nimport type * as ActivationEvent from './activation-event';\nimport * as Capability from './capability';\nimport type * as PluginManager from './plugin-manager';\n\n//\n// Plugin Service Layer\n//\n\n/**\n * Effect Context.Tag for accessing PluginManager via the Effect layer system.\n * This allows lifecycle operations to access the plugin manager without having it passed as an argument.\n */\nexport class Service extends Context.Tag('@dxos/app-framework/PluginManager')<Service, PluginManager.PluginManager>() {}\n\n//\n// Lifecycle Functions\n//\n\n/**\n * Activates plugins based on the activation event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the activation was successful.\n */\nexport const activate = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.activate(event));\n\n/**\n * Re-activates the modules that were activated by the event.\n * Accesses the PluginManager via the Effect layer system.\n * @param event The activation event.\n * @returns Whether the reset was successful.\n */\nexport const reset = (event: ActivationEvent.ActivationEvent): Effect.Effect<boolean, Error, Service> =>\n Effect.flatMap(Service, (manager) => manager.reset(event));\n\n/**\n * Computes a module ID from plugin ID and export name.\n */\nconst computeModuleId = (pluginId: string, moduleName: string): string => {\n return `${pluginId}/module/${moduleName}`;\n};\n\n/**\n * Identifier denoting a PluginModule.\n */\nexport const PluginModuleTypeId: unique symbol = Symbol.for('@dxos/app-framework/PluginModule');\nexport type PluginModuleTypeId = typeof PluginModuleTypeId;\n\n/**\n * Type guard to check if a value is a PluginModule.\n */\nexport const isPluginModule = (value: unknown): value is PluginModule => {\n return typeof value === 'object' && value !== null && PluginModuleTypeId in value;\n};\n\n/**\n * A unit of containment of modular functionality that can be provided to an application.\n * Activation of a module is async allowing for code to split and loaded lazily.\n */\nexport interface PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId;\n /**\n * Unique id of the module.\n */\n id: string;\n\n /**\n * Events for which the module will be activated.\n */\n activatesOn: ActivationEvent.Events;\n\n /**\n * Events which the plugin depends on being activated.\n * Plugin is marked as needing reset a plugin activated by a dependent event is removed.\n * Events are automatically activated before activation of the plugin.\n */\n activatesBefore?: ActivationEvent.ActivationEvent[];\n\n /**\n * Events which this plugin triggers upon activation.\n */\n activatesAfter?: ActivationEvent.ActivationEvent[];\n\n /**\n * Called when the module is activated.\n * CapabilityManager is accessed via the Effect layer system (Capability.Service).\n * PluginManager is accessed via Plugin.Service.\n * @param props Optional props passed to the module.\n * @returns The capabilities of the module.\n */\n activate: (props?: any) => Effect.Effect<Capability.ModuleReturn, Error, Capability.Service | Service | never>;\n}\n\nexport type PluginModuleOptions = Omit<PluginModule, 'id' | typeof PluginModuleTypeId> & { id?: string };\n\nclass PluginModuleImpl implements PluginModule {\n readonly [PluginModuleTypeId]: PluginModuleTypeId = PluginModuleTypeId;\n readonly id: PluginModule['id'];\n readonly activatesOn: PluginModule['activatesOn'];\n readonly activatesBefore?: PluginModule['activatesBefore'];\n readonly activatesAfter?: PluginModule['activatesAfter'];\n readonly activate: PluginModule['activate'];\n\n constructor(options: Omit<PluginModule, typeof PluginModuleTypeId>) {\n this.id = options.id;\n this.activatesOn = options.activatesOn;\n this.activatesBefore = options.activatesBefore;\n this.activatesAfter = options.activatesAfter;\n this.activate = options.activate;\n }\n}\n\nexport type Meta = {\n /**\n * Globally unique ID.\n *\n * Expected to be in the form of a valid URL.\n *\n * @example dxos.org/plugin/example\n */\n id: string;\n\n /**\n * Human-readable name.\n */\n name: string;\n\n /**\n * Short description of plugin functionality.\n */\n description?: string;\n\n /**\n * URL of home page.\n */\n homePage?: string;\n\n /**\n * URL of source code.\n */\n source?: string;\n\n /**\n * URL of screenshot.\n */\n screenshots?: string[];\n\n /**\n * Tags to help categorize the plugin.\n */\n tags?: string[];\n\n /**\n * A grep-able symbol string which can be resolved to an icon asset by @ch-ui/icons, via @ch-ui/vite-plugin-icons.\n */\n icon?: string;\n\n /**\n * Icon hue (ChromaticPalette).\n */\n iconHue?: string;\n};\n\n/**\n * Identifier denoting a Plugin.\n */\nexport const PluginTypeId: unique symbol = Symbol.for('@dxos/app-framework/Plugin');\nexport type PluginTypeId = typeof PluginTypeId;\n\n/**\n * Type guard to check if a value is a Plugin.\n */\nexport const isPlugin = (value: unknown): value is Plugin => {\n return typeof value === 'object' && value !== null && PluginTypeId in value;\n};\n\n/**\n * A collection of modules that are be enabled/disabled as a unit.\n * Plugins provide things such as components, state, actions, etc. to the application.\n */\nexport interface Plugin {\n readonly [PluginTypeId]: PluginTypeId;\n readonly meta: Readonly<Meta>;\n readonly modules: ReadonlyArray<PluginModule>;\n}\n\n/**\n * Internal implementation of Plugin.\n * @internal\n */\nclass PluginImpl implements Plugin {\n readonly [PluginTypeId]: PluginTypeId = PluginTypeId;\n\n constructor(\n private readonly _meta: Meta,\n private readonly _modules: PluginModule[],\n ) {}\n\n get meta(): Readonly<Meta> {\n return this._meta;\n }\n\n get modules(): ReadonlyArray<PluginModule> {\n return this._modules;\n }\n}\n\n/**\n * Builder interface for creating plugins incrementally.\n */\nexport interface PluginBuilder<T = void> extends Pipeable.Pipeable {\n readonly meta: Meta;\n readonly modules: ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)>;\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T>;\n}\n\n/**\n * Builder implementation for creating plugins incrementally.\n */\nclass PluginBuilderImpl<T = void> implements PluginBuilder<T> {\n readonly meta: Meta;\n private readonly _modules: Array<PluginModuleOptions | ((options: T) => PluginModuleOptions)> = [];\n\n constructor(meta: Meta) {\n this.meta = meta;\n }\n\n get modules(): ReadonlyArray<PluginModuleOptions | ((options: T) => PluginModuleOptions)> {\n return this._modules;\n }\n\n addModule(moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions)): PluginBuilder<T> {\n this._modules.push(moduleOptions);\n return this;\n }\n\n pipe() {\n // eslint-disable-next-line prefer-rest-params\n return Pipeable.pipeArguments(this, arguments);\n }\n}\n\n/**\n * Creates a new PluginBuilder to start building a plugin.\n */\nexport const define = <T = void>(meta: Meta): PluginBuilder<T> => new PluginBuilderImpl<T>(meta);\n\n/**\n * Adds a module to a plugin builder.\n * Supports both pipeline and direct call styles.\n * Modules can be either PluginModuleOptions or functions that receive options.\n */\nexport function addModule<T>(\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): (builder: PluginBuilder<T>) => PluginBuilder<T>;\nexport function addModule<T>(\n builder: PluginBuilder<T>,\n moduleOptions: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): PluginBuilder<T>;\nexport function addModule<T>(\n moduleOptionsOrBuilder: PluginModuleOptions | ((options: T) => PluginModuleOptions) | PluginBuilder<T>,\n moduleOptions?: PluginModuleOptions | ((options: T) => PluginModuleOptions),\n): ((builder: PluginBuilder<T>) => PluginBuilder<T>) | PluginBuilder<T> {\n // If second arg is provided, it's the direct call style: addModule(builder, moduleOptions)\n if (moduleOptions !== undefined) {\n return (moduleOptionsOrBuilder as PluginBuilder<T>).addModule(moduleOptions);\n }\n // Otherwise it's pipeline style: addModule(moduleOptions) returns a function\n const moduleOpts = moduleOptionsOrBuilder as PluginModuleOptions | ((options: T) => PluginModuleOptions);\n return (builder: PluginBuilder<T>) => builder.addModule(moduleOpts);\n}\n\nexport type PluginFactory<T = void> = ((options: T) => Plugin) & { meta: Meta };\n\n/**\n * Resolves a module from either PluginModuleOptions or a function that returns PluginModuleOptions.\n */\nconst resolveModule = (\n meta: Meta,\n module: PluginModuleOptions | ((options: any) => PluginModuleOptions),\n options?: any,\n): PluginModuleImpl => {\n const moduleOptions = typeof module === 'function' ? module(options) : module;\n const id = Option.fromNullable(moduleOptions.id).pipe(\n Option.match({\n onNone: () => {\n const exportName = Capability.getModuleTag(moduleOptions.activate);\n invariant(exportName, `Plugin module missing name. Plugin: ${meta.id}`);\n return computeModuleId(meta.id, exportName);\n },\n onSome: (id) => computeModuleId(meta.id, id),\n }),\n );\n return new PluginModuleImpl({ ...moduleOptions, id });\n};\n\n/**\n * Creates a Plugin from a builder.\n * Supports both pipeline and direct call styles.\n * Always returns a factory function (options: T) => Plugin.\n * When T is void, the function takes no arguments: () => Plugin.\n */\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T>;\nexport function make<T>(builder: PluginBuilder<T>): PluginFactory<T> {\n const meta = builder.meta;\n\n const factory = (options: T) => {\n const modules = builder.modules.map((module) => resolveModule(meta, module, options));\n return new PluginImpl(meta, modules);\n };\n\n return Object.assign(factory, { meta });\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;AAAA;;;;;;;;;;;;;AAIA,YAAYA,aAAa;AACzB,YAAYC,YAAY;AACxB,YAAYC,YAAY;AACxB,YAAYC,cAAc;AAE1B,SAASC,iBAAiB;;AAcnB,IAAMC,UAAN,cAA8BC,YAAI,mCAAA,EAAA,EAAA;AAA8E;AAYhH,IAAMC,WAAW,CAACC,UAChBC,eAAQJ,SAAS,CAACK,YAAYA,QAAQH,SAASC,KAAAA,CAAAA;AAQjD,IAAMG,QAAQ,CAACH,UACbC,eAAQJ,SAAS,CAACK,YAAYA,QAAQC,MAAMH,KAAAA,CAAAA;AAKrD,IAAMI,kBAAkB,CAACC,UAAkBC,eAAAA;AACzC,SAAO,GAAGD,QAAAA,WAAmBC,UAAAA;AAC/B;AAKO,IAAMC,qBAAoCC,OAAOC,IAAI,kCAAA;AAMrD,IAAMC,iBAAiB,CAACC,UAAAA;AAC7B,SAAO,OAAOA,UAAU,YAAYA,UAAU,QAAQJ,sBAAsBI;AAC9E;AA0CA,IAAMC,mBAAN,MAAMA;EACK,CAACL,kBAAAA,IAA0CA;EAC3CM;EACAC;EACAC;EACAC;EACAjB;EAET,YAAYkB,SAAwD;AAClE,SAAKJ,KAAKI,QAAQJ;AAClB,SAAKC,cAAcG,QAAQH;AAC3B,SAAKC,kBAAkBE,QAAQF;AAC/B,SAAKC,iBAAiBC,QAAQD;AAC9B,SAAKjB,WAAWkB,QAAQlB;EAC1B;AACF;AAwDO,IA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AAChC,QAAOT,gBAAgBmB,KAAKV,IAAIA,GAAAA;EAC3C,CAAA,CAAA;AAEF,SAAO,IAAID,iBAAiB;IAAE,GAAGe;IAAed;EAAG,CAAA;AACrD;AASO,SAASiC,KAAQV,SAAyB;AAC/C,QAAMb,OAAOa,QAAQb;AAErB,QAAMwB,UAAU,CAAC9B,YAAAA;AACf,UAAMO,UAAUY,QAAQZ,QAAQwB,IAAI,CAACV,WAAWD,cAAcd,MAAMe,QAAQrB,OAAAA,CAAAA;AAC5E,WAAO,IAAIG,WAAWG,MAAMC,OAAAA;EAC9B;AAEA,SAAOyB,OAAOC,OAAOH,SAAS;IAAExB;EAAK,CAAA;AACvC;",
|
|
6
|
-
"names": ["Context", "Effect", "Option", "Pipeable", "invariant", "Service", "Tag", "activate", "event", "flatMap", "manager", "reset", "computeModuleId", "pluginId", "moduleName", "PluginModuleTypeId", "Symbol", "for", "isPluginModule", "value", "PluginModuleImpl", "id", "activatesOn", "activatesBefore", "activatesAfter", "options", "PluginTypeId", "isPlugin", "PluginImpl", "_meta", "_modules", "meta", "modules", "PluginBuilderImpl", "addModule", "moduleOptions", "push", "pipe", "pipeArguments", "arguments", "define", "moduleOptionsOrBuilder", "undefined", "moduleOpts", "builder", "resolveModule", "module", "fromNullable", "match", "onNone", "exportName", "getModuleTag", "invariant", "onSome", "make", "factory", "map", "Object", "assign"]
|
|
7
|
-
}
|