@dxos/app-framework 0.8.4-main.9be5663bfe → 0.8.4-main.abd8ff62ef
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/dist/lib/browser/{capability-BBBBAPDI.mjs → capability-Q5XRXRD2.mjs} +10 -10
- package/dist/lib/browser/{capability-OP63CD5N.mjs → capability-V7LR4LQN.mjs} +11 -11
- package/dist/lib/browser/capability-V7LR4LQN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-T3Y4AEKX.mjs → chunk-23D4SJUE.mjs} +3 -3
- package/dist/lib/browser/{chunk-T3Y4AEKX.mjs.map → chunk-23D4SJUE.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-2CKCJ6PN.mjs → chunk-3JWJXGLK.mjs} +1 -1
- package/dist/lib/browser/{chunk-2CKCJ6PN.mjs.map → chunk-3JWJXGLK.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-GX4TUNM6.mjs → chunk-3ZS2A3DN.mjs} +170 -226
- package/dist/lib/browser/chunk-3ZS2A3DN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-I34GF4NG.mjs → chunk-45CHLTBV.mjs} +2 -2
- package/dist/lib/browser/chunk-5LAIGWLU.mjs +467 -0
- package/dist/lib/browser/chunk-5LAIGWLU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-QSXYHXCE.mjs → chunk-66IXTIVK.mjs} +1 -1
- package/dist/lib/browser/{chunk-QSXYHXCE.mjs.map → chunk-66IXTIVK.mjs.map} +2 -2
- package/dist/lib/browser/{chunk-TGX63LTL.mjs → chunk-FJ4765WW.mjs} +1 -1
- package/dist/lib/browser/{chunk-TGX63LTL.mjs.map → chunk-FJ4765WW.mjs.map} +2 -2
- package/dist/lib/browser/chunk-G7SDBRKH.mjs +1 -0
- package/dist/lib/browser/chunk-JXCBZSBJ.mjs +372 -0
- package/dist/lib/browser/chunk-JXCBZSBJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-MX5DKEJH.mjs +584 -0
- package/dist/lib/browser/chunk-MX5DKEJH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-JKWMHZP6.mjs → chunk-WBHCSOBW.mjs} +2 -2
- package/dist/lib/browser/chunk-WBHCSOBW.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FU4GAFUQ.mjs → chunk-Z55LVAGN.mjs} +80 -15
- package/dist/lib/browser/chunk-Z55LVAGN.mjs.map +7 -0
- package/dist/lib/browser/{chunk-F7FW2RK2.mjs → chunk-ZGJAZSNE.mjs} +7 -32
- package/dist/lib/browser/chunk-ZGJAZSNE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +11 -27
- package/dist/lib/browser/cli/index.mjs.map +2 -2
- package/dist/lib/browser/common/activation-events.mjs +7 -7
- package/dist/lib/browser/common/capabilities.mjs +7 -7
- 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 +6 -4
- package/dist/lib/browser/core/plugin.mjs +10 -2
- package/dist/lib/browser/core/url-loader.mjs +13 -5
- package/dist/lib/browser/index.mjs +22 -18
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{invoker-capability-H5PPENOC.mjs → invoker-capability-LNX4CGIV.mjs} +12 -11
- package/dist/lib/browser/invoker-capability-LNX4CGIV.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/testing/index.mjs +144 -27
- package/dist/lib/browser/testing/index.mjs.map +4 -4
- package/dist/lib/browser/testing/react.mjs +78 -0
- package/dist/lib/browser/testing/react.mjs.map +7 -0
- package/dist/lib/browser/ui/index.mjs +18 -14
- package/dist/lib/node-esm/{capability-AWBEMRYR.mjs → capability-EW5GJCI6.mjs} +10 -10
- package/dist/lib/node-esm/{capability-WFEG6CIZ.mjs → capability-YKBMMD53.mjs} +11 -11
- package/dist/lib/node-esm/capability-YKBMMD53.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs → chunk-37Z53PXZ.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-FKE4Z3D6.mjs.map → chunk-37Z53PXZ.mjs.map} +2 -2
- package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs → chunk-6XW6LET6.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-URWHJQT2.mjs → chunk-D347W3KO.mjs} +7 -32
- package/dist/lib/node-esm/chunk-D347W3KO.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D5PO2WXX.mjs +373 -0
- package/dist/lib/node-esm/chunk-D5PO2WXX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ULUEXB7Q.mjs → chunk-HTBJU5FX.mjs} +80 -15
- package/dist/lib/node-esm/chunk-HTBJU5FX.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KM2F6GH6.mjs +468 -0
- package/dist/lib/node-esm/chunk-KM2F6GH6.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-EL3R25OQ.mjs → chunk-OZ7DZA5Z.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-BCEOLX47.mjs → chunk-Q7XBFII4.mjs} +170 -226
- package/dist/lib/node-esm/chunk-Q7XBFII4.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs → chunk-SBS2YMPT.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-VKHGNEDB.mjs.map → chunk-SBS2YMPT.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-42KBWDE4.mjs → chunk-SDJ4B2LU.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-42KBWDE4.mjs.map → chunk-SDJ4B2LU.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-G3RTFSNG.mjs → chunk-WFSRZKBP.mjs} +2 -2
- package/dist/lib/node-esm/chunk-WFSRZKBP.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WKTLE7MG.mjs +585 -0
- package/dist/lib/node-esm/chunk-WKTLE7MG.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs → chunk-XOCUANHO.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-ZZ7CKK6W.mjs.map → chunk-XOCUANHO.mjs.map} +2 -2
- package/dist/lib/node-esm/cli/index.mjs +11 -27
- package/dist/lib/node-esm/cli/index.mjs.map +2 -2
- package/dist/lib/node-esm/common/activation-events.mjs +7 -7
- package/dist/lib/node-esm/common/capabilities.mjs +7 -7
- 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 +6 -4
- package/dist/lib/node-esm/core/plugin.mjs +10 -2
- package/dist/lib/node-esm/core/url-loader.mjs +13 -5
- package/dist/lib/node-esm/index.mjs +22 -18
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{invoker-capability-S3ZA527J.mjs → invoker-capability-O4T5PHLA.mjs} +12 -11
- package/dist/lib/node-esm/invoker-capability-O4T5PHLA.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/testing/index.mjs +144 -27
- package/dist/lib/node-esm/testing/index.mjs.map +4 -4
- package/dist/lib/node-esm/testing/react.mjs +79 -0
- package/dist/lib/node-esm/testing/react.mjs.map +7 -0
- package/dist/lib/node-esm/ui/index.mjs +18 -14
- package/dist/plugin/node-esm/index.mjs +480 -32
- package/dist/plugin/node-esm/index.mjs.map +4 -4
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/types/src/common/capabilities.d.ts +2 -1
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/operations.d.ts +1 -1
- package/dist/types/src/common/operations.d.ts.map +1 -1
- package/dist/types/src/core/activation-event.d.ts +4 -4
- package/dist/types/src/core/activation-event.d.ts.map +1 -1
- package/dist/types/src/core/capability-manager.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +2 -2
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/index.d.ts +2 -0
- package/dist/types/src/core/index.d.ts.map +1 -1
- package/dist/types/src/core/plugin-asset-cache.d.ts +71 -0
- package/dist/types/src/core/plugin-asset-cache.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manager.d.ts +51 -2
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manifest.d.ts +76 -0
- package/dist/types/src/core/plugin-manifest.d.ts.map +1 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts +2 -0
- package/dist/types/src/core/plugin-manifest.test.d.ts.map +1 -0
- package/dist/types/src/core/plugin.d.ts +107 -6
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/url-loader.d.ts +90 -3
- package/dist/types/src/core/url-loader.d.ts.map +1 -1
- package/dist/types/src/helpers.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/capability.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/errors.d.ts +6 -6
- package/dist/types/src/plugin-operation/history/errors.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/history-tracker.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/types.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/types.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-mapping.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts +1 -1
- package/dist/types/src/plugin-operation/history/undo-registry.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts +1 -1
- package/dist/types/src/plugin-operation/invoker-capability.d.ts.map +1 -1
- package/dist/types/src/plugin-operation/testing.d.ts +2 -1
- package/dist/types/src/plugin-operation/testing.d.ts.map +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts +1 -1
- package/dist/types/src/plugin-runtime/capability.d.ts.map +1 -1
- package/dist/types/src/testing/harness.d.ts +67 -0
- package/dist/types/src/testing/harness.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/react.d.ts +27 -0
- package/dist/types/src/testing/react.d.ts.map +1 -0
- package/dist/types/src/testing/react.test.d.ts +2 -0
- package/dist/types/src/testing/react.test.d.ts.map +1 -0
- package/dist/types/src/testing/service.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.d.ts.map +1 -1
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/App.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts +64 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts +19 -0
- package/dist/types/src/ui/components/Placeholder/Placeholder.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts +2 -0
- package/dist/types/src/ui/components/Placeholder/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/PluginManager/PluginManagerContext.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +16 -4
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/index.d.ts +16 -6
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.d.ts +110 -9
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.test.d.ts +2 -0
- package/dist/types/src/ui/components/Surface/types.test.d.ts.map +1 -0
- package/dist/types/src/ui/components/index.d.ts +1 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.d.ts +29 -3
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useCapabilities.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useLoading.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useSettingsState.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts +34 -0
- package/dist/types/src/vite-plugin/boot-loader/BootLoader.stories.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts +52 -0
- package/dist/types/src/vite-plugin/boot-loader/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts +34 -0
- package/dist/types/src/vite-plugin/composer/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts +28 -0
- package/dist/types/src/vite-plugin/import-map/index.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/index.d.ts +4 -2
- package/dist/types/src/vite-plugin/index.d.ts.map +1 -1
- package/dist/types/src/vite-plugin/manifest.d.ts +37 -0
- package/dist/types/src/vite-plugin/manifest.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts +2 -0
- package/dist/types/src/vite-plugin/manifest.test.d.ts.map +1 -0
- package/dist/types/src/vite-plugin/packages.d.ts +10 -4
- package/dist/types/src/vite-plugin/packages.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +1 -0
- package/package.json +33 -59
- package/src/common/capabilities.ts +2 -1
- package/src/common/operations.ts +1 -1
- package/src/core/capability.ts +1 -1
- package/src/core/index.ts +2 -0
- package/src/core/plugin-asset-cache.ts +60 -0
- package/src/core/plugin-manager.test.ts +246 -5
- package/src/core/plugin-manager.ts +167 -25
- package/src/core/plugin-manifest.test.ts +48 -0
- package/src/core/plugin-manifest.ts +102 -0
- package/src/core/plugin.ts +135 -10
- package/src/core/url-loader.test.ts +104 -5
- package/src/core/url-loader.ts +226 -37
- package/src/plugin-operation/OperationPlugin.ts +2 -2
- package/src/plugin-operation/history/capability.ts +1 -1
- package/src/plugin-operation/history/history-tracker.test.ts +2 -1
- package/src/plugin-operation/history/history-tracker.ts +1 -1
- package/src/plugin-operation/history/types.ts +1 -1
- package/src/plugin-operation/history/undo-mapping.ts +1 -1
- package/src/plugin-operation/history/undo-registry.ts +1 -1
- package/src/plugin-operation/invoker-capability.ts +2 -1
- package/src/plugin-operation/testing.ts +2 -1
- package/src/plugin-runtime/RuntimePlugin.ts +2 -2
- package/src/testing/harness.ts +229 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/react.test.tsx +48 -0
- package/src/testing/react.tsx +113 -0
- package/src/testing/withPluginManager.stories.tsx +1 -1
- package/src/ui/components/App/App.stories.tsx +1 -1
- package/src/ui/components/App/App.tsx +25 -2
- package/src/ui/components/Placeholder/Placeholder.stories.tsx +77 -0
- package/src/ui/components/Placeholder/Placeholder.tsx +155 -0
- package/src/ui/components/Placeholder/index.ts +5 -0
- package/src/ui/components/PluginManager/PluginManagerContext.stories.tsx +4 -2
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +1 -1
- package/src/ui/components/Surface/SurfaceComponent.tsx +83 -46
- package/src/ui/components/Surface/index.ts +20 -1
- package/src/ui/components/Surface/types.test.ts +126 -0
- package/src/ui/components/Surface/types.ts +164 -12
- package/src/ui/components/index.ts +1 -0
- package/src/ui/hooks/useApp.tsx +165 -41
- package/src/ui/hooks/useLoading.tsx +14 -6
- package/src/vite-plugin/boot-loader/BootLoader.stories.tsx +263 -0
- package/src/vite-plugin/boot-loader/boot-loader.css +294 -0
- package/src/vite-plugin/boot-loader/boot-loader.js +274 -0
- package/src/vite-plugin/boot-loader/index.ts +112 -0
- package/src/vite-plugin/composer/index.ts +277 -0
- package/src/vite-plugin/import-map/index.ts +524 -0
- package/src/vite-plugin/index.ts +6 -2
- package/src/vite-plugin/manifest.test.ts +24 -0
- package/src/vite-plugin/manifest.ts +50 -0
- package/src/vite-plugin/packages.ts +169 -10
- package/tsconfig.json +9 -0
- package/.swc/plugins/linux_x86_64_19.0.0/727453fb3a62f7f1d952a41e051ca8a6f88cadc45cee43c6a4d1aa45f9b75665.wasmer-v7 +0 -0
- package/dist/lib/browser/capability-OP63CD5N.mjs.map +0 -7
- package/dist/lib/browser/chunk-F7FW2RK2.mjs.map +0 -7
- package/dist/lib/browser/chunk-FU4GAFUQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-GX4TUNM6.mjs.map +0 -7
- package/dist/lib/browser/chunk-JKWMHZP6.mjs.map +0 -7
- package/dist/lib/browser/chunk-LVJW5EFU.mjs +0 -157
- package/dist/lib/browser/chunk-LVJW5EFU.mjs.map +0 -7
- package/dist/lib/browser/chunk-RFSO3JRG.mjs +0 -1
- package/dist/lib/browser/chunk-WPE6AL7I.mjs +0 -905
- package/dist/lib/browser/chunk-WPE6AL7I.mjs.map +0 -7
- package/dist/lib/browser/invoker-capability-H5PPENOC.mjs.map +0 -7
- package/dist/lib/node-esm/capability-WFEG6CIZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4A3ZCMI3.mjs +0 -158
- package/dist/lib/node-esm/chunk-4A3ZCMI3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BCEOLX47.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-G3RTFSNG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LQKOTNJW.mjs +0 -906
- package/dist/lib/node-esm/chunk-LQKOTNJW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ULUEXB7Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-URWHJQT2.mjs.map +0 -7
- package/dist/lib/node-esm/invoker-capability-S3ZA527J.mjs.map +0 -7
- package/dist/types/src/vite-plugin/composer-plugin.d.ts +0 -18
- package/dist/types/src/vite-plugin/composer-plugin.d.ts.map +0 -1
- package/dist/types/src/vite-plugin/import-map-plugin.d.ts +0 -16
- package/dist/types/src/vite-plugin/import-map-plugin.d.ts.map +0 -1
- package/src/vite-plugin/composer-plugin.ts +0 -128
- package/src/vite-plugin/import-map-plugin.ts +0 -314
- /package/dist/lib/browser/{capability-BBBBAPDI.mjs.map → capability-Q5XRXRD2.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-I34GF4NG.mjs.map → chunk-45CHLTBV.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-RFSO3JRG.mjs.map → chunk-G7SDBRKH.mjs.map} +0 -0
- /package/dist/lib/node-esm/{capability-AWBEMRYR.mjs.map → capability-EW5GJCI6.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-WZCSOX5Q.mjs.map → chunk-6XW6LET6.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-EL3R25OQ.mjs.map → chunk-OZ7DZA5Z.mjs.map} +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type Registry } from '@effect-atom/atom-react';
|
|
2
|
+
import { type Operation } from '@dxos/compute';
|
|
3
|
+
import { ActivationEvent, type Capability, type CapabilityManager, type Plugin, PluginManager } from '../core';
|
|
4
|
+
export type TestAppOptions = {
|
|
5
|
+
/** Plugins to register. */
|
|
6
|
+
plugins: Plugin.Plugin[];
|
|
7
|
+
/** Plugin ids that are always enabled. Defaults to all provided plugin ids. */
|
|
8
|
+
core?: string[];
|
|
9
|
+
/** Plugin ids that are enabled by default in addition to core. */
|
|
10
|
+
enabled?: string[];
|
|
11
|
+
/** Additional activation events fired alongside SetupReactSurface. */
|
|
12
|
+
setupEvents?: ActivationEvent.ActivationEvent[];
|
|
13
|
+
/**
|
|
14
|
+
* Whether to automatically fire SetupReactSurface + Startup during setup.
|
|
15
|
+
* Defaults to true.
|
|
16
|
+
*/
|
|
17
|
+
autoStart?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to register the PluginManager + AtomRegistry framework capabilities.
|
|
20
|
+
* Defaults to true.
|
|
21
|
+
*/
|
|
22
|
+
registerFrameworkCapabilities?: boolean;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* A running plugin manager plus helpers for driving it in tests.
|
|
26
|
+
*/
|
|
27
|
+
export interface TestHarness {
|
|
28
|
+
readonly manager: PluginManager.PluginManager;
|
|
29
|
+
readonly capabilities: CapabilityManager.CapabilityManager;
|
|
30
|
+
readonly registry: Registry.Registry;
|
|
31
|
+
/** Activate the given event. Equivalent to `manager.activate(event)`. */
|
|
32
|
+
fire(event: ActivationEvent.ActivationEvent | string): Promise<boolean>;
|
|
33
|
+
/** Re-activate all modules that were activated by the given event. */
|
|
34
|
+
reset(event: ActivationEvent.ActivationEvent | string): Promise<boolean>;
|
|
35
|
+
/** Returns the first contributed capability for the given interface. Throws if none are present. */
|
|
36
|
+
get<T>(iface: Capability.InterfaceDef<T>): T;
|
|
37
|
+
/** Returns all contributed capabilities for the given interface. */
|
|
38
|
+
getAll<T>(iface: Capability.InterfaceDef<T>): T[];
|
|
39
|
+
/** Waits until at least one capability is contributed for the given interface. */
|
|
40
|
+
waitForCapability<T>(iface: Capability.InterfaceDef<T>, opts?: {
|
|
41
|
+
timeout?: number;
|
|
42
|
+
}): Promise<T>;
|
|
43
|
+
/** Waits until the given activation event has completed. */
|
|
44
|
+
waitForEvent(event: ActivationEvent.ActivationEvent | string, opts?: {
|
|
45
|
+
timeout?: number;
|
|
46
|
+
}): Promise<void>;
|
|
47
|
+
/** Invokes an operation through the `Capabilities.OperationInvoker` capability. */
|
|
48
|
+
invoke<I, O>(op: Operation.Definition<I, O>, ...args: void extends I ? [input?: I] : [input: I]): Promise<O>;
|
|
49
|
+
enable(id: string): Promise<boolean>;
|
|
50
|
+
disable(id: string): Promise<boolean>;
|
|
51
|
+
/** Shuts down the underlying plugin manager. */
|
|
52
|
+
dispose(): Promise<void>;
|
|
53
|
+
/** Async-disposable support so tests can use `await using harness = ...`. */
|
|
54
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates a TestHarness with the same bootstrap sequence that `useApp` performs,
|
|
58
|
+
* minus the React provider tree.
|
|
59
|
+
*
|
|
60
|
+
* For Node-only tests, this is enough to fire activation events, read
|
|
61
|
+
* capabilities, and invoke operations.
|
|
62
|
+
*
|
|
63
|
+
* For React tests, pass the returned harness to `render` or `renderSurface`
|
|
64
|
+
* from `@dxos/app-framework/testing-react`.
|
|
65
|
+
*/
|
|
66
|
+
export declare const createTestApp: (opts: TestAppOptions) => Promise<TestHarness>;
|
|
67
|
+
//# sourceMappingURL=harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../../../src/testing/harness.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAMxD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAK/C,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,iBAAiB,EAAE,KAAK,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE/G,MAAM,MAAM,cAAc,GAAG;IAC3B,2BAA2B;IAC3B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;IACzB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,sEAAsE;IACtE,WAAW,CAAC,EAAE,eAAe,CAAC,eAAe,EAAE,CAAC;IAChD;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,aAAa,CAAC;IAC9C,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC,i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AO,CAAC,CAAC;IACrC,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtC,gDAAgD;IAChD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB,6EAA6E;IAC7E,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACxC;AAID;;;;;;;;;GASG;AACH,eAAO,MAAM,aAAa,SAAgB,cAAc,KAAG,OAAO,CAAC,WAAW,CAgD7E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/testing/index.ts"],"names":[],"mappings":"AAIA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type RenderOptions, type RenderResult } from '@testing-library/react';
|
|
2
|
+
import { type FC, type PropsWithChildren, type ReactNode } from 'react';
|
|
3
|
+
import { type TestHarness } from './harness';
|
|
4
|
+
export type HarnessRenderOptions = Omit<RenderOptions, 'wrapper'> & {
|
|
5
|
+
/** Additional providers to wrap around the harness tree (applied innermost first). */
|
|
6
|
+
reactContexts?: FC<PropsWithChildren>[];
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Renders `ui` wrapped in the same provider tree as `useApp` plus every contributed
|
|
10
|
+
* `Capabilities.ReactContext`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const render: (harness: TestHarness, ui: ReactNode, options?: HarnessRenderOptions) => RenderResult;
|
|
13
|
+
export type RenderSurfaceProps = {
|
|
14
|
+
role: string;
|
|
15
|
+
data?: unknown;
|
|
16
|
+
limit?: number;
|
|
17
|
+
fallback?: FC<{
|
|
18
|
+
error: Error;
|
|
19
|
+
data?: any;
|
|
20
|
+
}>;
|
|
21
|
+
placeholder?: ReactNode;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Renders a `Surface` with the given role/data inside the harness provider tree.
|
|
25
|
+
*/
|
|
26
|
+
export declare const renderSurface: (harness: TestHarness, props: RenderSurfaceProps, options?: HarnessRenderOptions) => RenderResult;
|
|
27
|
+
//# sourceMappingURL=react.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../../src/testing/react.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAuB,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACpG,OAAc,EAAE,KAAK,EAAE,EAAY,KAAK,iBAAiB,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AASzF,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,GAAG;IAClE,sFAAsF;IACtF,aAAa,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC;CACzC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,MAAM,YAAa,WAAW,MAAM,SAAS,YAAY,oBAAoB,KAAG,YAQ5F,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,EAAE,CAAC;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAC5C,WAAW,CAAC,EAAE,SAAS,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,YACf,WAAW,SACb,kBAAkB,YACf,oBAAoB,KAC7B,YAOF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.test.d.ts","sourceRoot":"","sources":["../../../../src/testing/react.test.tsx"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/testing/service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAKtC,OAAO,EAAE,MAAM,EAAiB,MAAM,SAAS,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../../src/testing/service.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAC;AAKtC,OAAO,EAAE,MAAM,EAAiB,MAAM,SAAS,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,WAAW,YAAa,MAAM,CAAC,MAAM,EAAE,8CAmCjD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withPluginManager.d.ts","sourceRoot":"","sources":["../../../../src/testing/withPluginManager.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOrE,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,YAAY,CAAC;AAGlE,OAAO,EAAE,KAAK,eAAe,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAyB,MAAM,SAAS,CAAC;AAC1G,OAAO,EAAE,KAAK,aAAa,EAAU,MAAM,OAAO,CAAC;AAsCnD,MAAM,MAAM,wBAAwB,GAAG,aAAa,GAAG;IACrD,kBAAkB;IAClB,YAAY,CAAC,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACpF,kBAAk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PluginManager.stories.d.ts","sourceRoot":"","sources":["../../../../src/testing/withPluginManager.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAmB1B,QAAA,MAAM,IAAI;;;;CAkB2B,CAAC;
|
|
1
|
+
{"version":3,"file":"withPluginManager.stories.d.ts","sourceRoot":"","sources":["../../../../src/testing/withPluginManager.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAAK,MAAM,OAAO,CAAC;AAmB1B,QAAA,MAAM,IAAI;;;;CAkB2B,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/App/App.tsx"],"names":[],"mappings":"AAIA,OAAO,
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/App/App.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA4C,MAAM,OAAO,CAAC;AAIjE,OAAO,EAAgB,KAAK,eAAe,EAAE,KAAK,aAAa,EAA+B,MAAM,aAAa,CAAC;AAElH,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,aAAa,GAAG,UAAU,CAAC,GAAG;IACvE,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,eAAe,CAAC;CAC5B,CAAC;AAIF,eAAO,MAAM,GAAG,mEAAoE,QAAQ,6BAgD3F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/App/App.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAoB,MAAM,OAAO,CAAC;AAKzC,OAAO,EAAc,MAAM,EAAE,MAAM,eAAe,CAAC;AAuCnD,KAAK,iBAAiB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;CAAE,CAAC;AAkBvD,QAAA,MAAM,IAAI;;0BAhByB,iBAAiB
|
|
1
|
+
{"version":3,"file":"App.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/App/App.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAoB,MAAM,OAAO,CAAC;AAKzC,OAAO,EAAc,MAAM,EAAE,MAAM,eAAe,CAAC;AAuCnD,KAAK,iBAAiB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;CAAE,CAAC;AAkBvD,QAAA,MAAM,IAAI;;0BAhByB,iBAAiB;;;QAqBhD,MAAM;;CAEM,CAAC;eAEF,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KAIvB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import { type PlaceholderProps as PlaceholderSlotProps } from '../../hooks';
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
/**
|
|
6
|
+
* Driver injected by `@dxos/app-framework/vite-plugin`'s `bootLoaderPlugin`.
|
|
7
|
+
* Declared here so the {@link Placeholder} can dismiss the native-DOM
|
|
8
|
+
* loader once the React placeholder commits without each host having to
|
|
9
|
+
* re-declare the type.
|
|
10
|
+
*/
|
|
11
|
+
__bootLoader?: {
|
|
12
|
+
status: (payload: {
|
|
13
|
+
event?: string;
|
|
14
|
+
module?: string;
|
|
15
|
+
humanized: string;
|
|
16
|
+
/**
|
|
17
|
+
* Optional `(index/total)` tick. When present, the loader replaces the
|
|
18
|
+
* current line in place ("Loading plugins (12/80)") instead of
|
|
19
|
+
* appending a new entry — keeps the visible log compact during long
|
|
20
|
+
* counted phases like plugin chunk-loading or module activation.
|
|
21
|
+
*/
|
|
22
|
+
range?: {
|
|
23
|
+
index: number;
|
|
24
|
+
total: number;
|
|
25
|
+
};
|
|
26
|
+
}) => void;
|
|
27
|
+
progress: (fraction?: number) => void;
|
|
28
|
+
dismiss: () => void;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export type PlaceholderComponentProps = PlaceholderSlotProps & {
|
|
33
|
+
/**
|
|
34
|
+
* Brand mark rendered while the React tree settles. Pass either a static
|
|
35
|
+
* `ReactNode` (the framework wraps it in a sizing/animation div) or a
|
|
36
|
+
* render function that receives the precomputed `className` so the host
|
|
37
|
+
* can apply it directly to its logo (e.g. an SVG that accepts `className`
|
|
38
|
+
* — `composer-app` passes `(p) => <Composer {...p} />` from `@dxos/brand`).
|
|
39
|
+
*/
|
|
40
|
+
logo?: ReactNode | ((props: {
|
|
41
|
+
className: string;
|
|
42
|
+
}) => ReactNode);
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* React placeholder. The native-DOM boot loader is the visible UI through
|
|
46
|
+
* stages 0 (Loading) and 1 (FadeIn): we render `null` until `stage >= 2`
|
|
47
|
+
* (FadeOut) and instead feed activation progress + status into the still-
|
|
48
|
+
* alive boot loader. At stage 2 the loader dismisses and the React mark
|
|
49
|
+
* appears for the cross-fade to the real shell:
|
|
50
|
+
*
|
|
51
|
+
* - composer-app fills `0 → 50%` from `getPlugins`'s per-chunk counter.
|
|
52
|
+
* - this component fills `50 → 100%` from `useApp`'s
|
|
53
|
+
* `startupProgress.progress` (`activated / total` modules) and pushes
|
|
54
|
+
* the per-module status text to the loader's status line.
|
|
55
|
+
* - at `stage >= 2` the boot loader is dismissed and the React mark
|
|
56
|
+
* starts its `FadeOut → Done` shrink-and-fade.
|
|
57
|
+
*
|
|
58
|
+
* Stage progression (driven by `useApp`):
|
|
59
|
+
* - `0` — Loading: native-DOM boot loader visible. Placeholder renders nothing.
|
|
60
|
+
* - `1` — FadeIn: same — boot loader still owns the screen.
|
|
61
|
+
* - `2` — FadeOut: boot loader dismissed, React mark visible at full opacity then shrinks.
|
|
62
|
+
*/
|
|
63
|
+
export declare const Placeholder: ({ stage, progress, logo }: PlaceholderComponentProps) => React.JSX.Element | null;
|
|
64
|
+
//# sourceMappingURL=Placeholder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Placeholder.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Placeholder/Placeholder.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,KAAK,SAAS,EAAsC,MAAM,OAAO,CAAC;AAKlF,OAAO,EAAE,KAAK,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE5E,OAAO,CAAC,MAAM,CAAC,CAAC;IACd,UAAU,MAAM;QACd;;;;;WAKG;QACH,YAAY,CAAC,EAAE;YACb,MAAM,EAAE,CAAC,OAAO,EAAE;gBAChB,KAAK,CAAC,EAAE,MAAM,CAAC;gBACf,MAAM,CAAC,EAAE,MAAM,CAAC;gBAChB,SAAS,EAAE,MAAM,CAAC;gBAClB;;;;;mBAKG;gBACH,KAAK,CAAC,EAAE;oBAAE,KAAK,EAAE,MAAM,CAAC;oBAAC,KAAK,EAAE,MAAM,CAAA;iBAAE,CAAC;aAC1C,KAAK,IAAI,CAAC;YACX,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;YACtC,OAAO,EAAE,MAAM,IAAI,CAAC;SACrB,CAAC;KACH;CACF;AAED,MAAM,MAAM,yBAAyB,GAAG,oBAAoB,GAAG;IAC7D;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,KAAK,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,KAAK,SAAS,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,8BAAmC,yBAAyB,6BAsFnF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* The story renders the brand-agnostic `Placeholder` from `@dxos/app-framework/ui`
|
|
5
|
+
* with the Composer brand icon as its `logo`, so the storybook mirrors what
|
|
6
|
+
* composer-app actually mounts in production. The render function form lets
|
|
7
|
+
* the SVG accept the placeholder's animation `className` directly.
|
|
8
|
+
*/
|
|
9
|
+
declare const meta: {
|
|
10
|
+
title: string;
|
|
11
|
+
component: ({ stage, progress, logo }: import("./Placeholder").PlaceholderComponentProps) => React.JSX.Element | null;
|
|
12
|
+
render: () => React.JSX.Element;
|
|
13
|
+
decorators: import("@storybook/react").Decorator[];
|
|
14
|
+
tags: string[];
|
|
15
|
+
};
|
|
16
|
+
export default meta;
|
|
17
|
+
type Story = StoryObj<typeof meta>;
|
|
18
|
+
export declare const Default: Story;
|
|
19
|
+
//# sourceMappingURL=Placeholder.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Placeholder.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Placeholder/Placeholder.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAA8B,MAAM,OAAO,CAAC;AASnD;;;;;GAKG;AACH,QAAA,MAAM,IAAI;;;;;;CAwC0B,CAAC;eAEtB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Placeholder/index.ts"],"names":[],"mappings":"AAIA,cAAc,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginManagerContext.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/PluginManager/PluginManagerContext.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAuC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"PluginManagerContext.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/PluginManager/PluginManagerContext.stories.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAuC,MAAM,OAAO,CAAC;AAsK5D,QAAA,MAAM,IAAI;;;;;QAKN,MAAM;;CAEM,CAAC;eAEF,IAAI;AAEnB,eAAO,MAAM,OAAO,EAAE,QAAQ,CAAC,OAAO,IAAI,CAAM,CAAC"}
|
|
@@ -1,12 +1,24 @@
|
|
|
1
|
-
import { type NamedExoticComponent, type RefAttributes } from 'react';
|
|
1
|
+
import React, { type NamedExoticComponent, type RefAttributes } from 'react';
|
|
2
2
|
import { type CapabilityManager } from '../../../core';
|
|
3
|
-
import { type Props } from './types';
|
|
3
|
+
import { type Props, type RoleToken, type TokenData, type TypedProps } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* A surface is a named region of the screen that can be populated by plugins.
|
|
6
6
|
*/
|
|
7
|
-
export declare const SurfaceComponent: NamedExoticComponent<Props & RefAttributes<HTMLElement>>;
|
|
7
|
+
export declare const SurfaceComponent: (<TToken extends RoleToken<any>>(props: TypedProps<TToken> & RefAttributes<HTMLElement>) => React.ReactNode) & NamedExoticComponent<Props & RefAttributes<HTMLElement>>;
|
|
8
8
|
/**
|
|
9
9
|
* @returns `true` if there is a contributed surface which matches the specified role & data, `false` otherwise.
|
|
10
|
+
*
|
|
11
|
+
* Two overloads:
|
|
12
|
+
* - Typed: pass a `type` role token and `data` is constrained to the token's
|
|
13
|
+
* declared contract (e.g. `AppSurface.Section` requires `attendableId`).
|
|
14
|
+
* - Legacy: pass a string `role` and `data` is untyped.
|
|
10
15
|
*/
|
|
11
|
-
export declare
|
|
16
|
+
export declare function isSurfaceAvailable<TToken extends RoleToken<any>>(capabilityManager: CapabilityManager.CapabilityManager, args: {
|
|
17
|
+
type: TToken;
|
|
18
|
+
data?: TokenData<TToken>;
|
|
19
|
+
role?: never;
|
|
20
|
+
}): boolean;
|
|
21
|
+
export declare function isSurfaceAvailable(capabilityManager: CapabilityManager.CapabilityManager, args: Pick<Props, 'role' | 'data'> & {
|
|
22
|
+
type?: undefined;
|
|
23
|
+
}): boolean;
|
|
12
24
|
//# sourceMappingURL=SurfaceComponent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurfaceComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Surface/SurfaceComponent.tsx"],"names":[],"mappings":"AAKA,
|
|
1
|
+
{"version":3,"file":"SurfaceComponent.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Surface/SurfaceComponent.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,EAEZ,KAAK,oBAAoB,EAEzB,KAAK,aAAa,EAOnB,MAAM,OAAO,CAAC;AAQf,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAKvD,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,UAAU,EAEhB,MAAM,SAAS,CAAC;AAkJjB;;GAEG;AAEH,eAAO,MAAM,gBAAgB,EA6CxB,CAAC,CAAC,MAAM,SAAS,SAAS,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,MAAM,CAAC,GAAG,aAAa,CAAC,WAAW,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,GAC/G,oBAAoB,CAAC,KAAK,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC;AAwC3D;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,SAAS,SAAS,CAAC,GAAG,CAAC,EAC9D,iBAAiB,EAAE,iBAAiB,CAAC,iBAAiB,EACtD,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IAAC,IAAI,CAAC,EAAE,KAAK,CAAA;CAAE,GAC7D,OAAO,CAAC;AACX,wBAAgB,kBAAkB,CAChC,iBAAiB,EAAE,iBAAiB,CAAC,iBAAiB,EACtD,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,SAAS,CAAA;CAAE,GACxD,OAAO,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurfaceComponent.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Surface/SurfaceComponent.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAA+D,MAAM,OAAO,CAAC;AA6HpF,QAAA,MAAM,IAAI
|
|
1
|
+
{"version":3,"file":"SurfaceComponent.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Surface/SurfaceComponent.stories.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,KAAK,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,KAA+D,MAAM,OAAO,CAAC;AA6HpF,QAAA,MAAM,IAAI;;;;;QAKN,MAAM;;CAE2B,CAAC;eAEvB,IAAI;AAEnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SurfaceProfilerContext.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Surface/SurfaceProfilerContext.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAEZ,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAM9B,MAAM,OAAO,CAAC;AAIf;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,eAAe,CAAC;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAmEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"SurfaceProfilerContext.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Surface/SurfaceProfilerContext.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAEZ,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAM9B,MAAM,OAAO,CAAC;AAIf;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,eAAe,CAAC;IAC5C,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAmEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,iBAAkB,iBAAiB,sBAQtE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B,QAAO,wBAAwB,GAAG,SAkBxE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,SAAS,oBAAoB,EAGzE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,oBAAoB,EAqC9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB,QAAO,CAAC,MAAM,IAAI,CAAC,GAAG,SAGzD,CAAC"}
|
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
import { SurfaceContext } from './context';
|
|
2
|
-
import {
|
|
2
|
+
import { isSurfaceAvailable } from './SurfaceComponent';
|
|
3
|
+
import { type Definition as SurfaceDefinition, type RoleToken as SurfaceRoleToken, type SurfaceBinding as SurfaceBindingType, type SurfaceFilter as SurfaceFilterType, type TokenData as SurfaceTokenData, type TypedProps as SurfaceTypedProps, create as createSurface, createWeb as createWebSurface } from './types';
|
|
3
4
|
export declare namespace Surface {
|
|
4
5
|
type Definition = SurfaceDefinition;
|
|
5
|
-
const create:
|
|
6
|
-
const createWeb:
|
|
6
|
+
const create: typeof createSurface;
|
|
7
|
+
const createWeb: typeof createWebSurface;
|
|
7
8
|
type Context = SurfaceContext;
|
|
8
9
|
const Context: import("react").Context<SurfaceContext | undefined>;
|
|
9
|
-
const Surface: import("react").NamedExoticComponent<{
|
|
10
|
+
const Surface: (<TToken extends SurfaceRoleToken<any>>(props: SurfaceTypedProps<TToken> & import("react").RefAttributes<HTMLElement>) => React.ReactNode) & import("react").NamedExoticComponent<{
|
|
10
11
|
fallback?: import("react").FC<{
|
|
11
12
|
error: Error;
|
|
12
13
|
data?: any;
|
|
13
14
|
}>;
|
|
14
15
|
placeholder?: import("react").ReactNode;
|
|
15
|
-
} & Omit<import("./types").CoreProps<Record<string, unknown>>, "id" | "
|
|
16
|
+
} & Omit<import("./types").CoreProps<Record<string, unknown>>, "data" | "id" | "role"> & Partial<Pick<import("./types").CoreProps<Record<string, unknown>>, "data" | "id" | "role">> & {
|
|
17
|
+
type?: undefined;
|
|
18
|
+
} & {
|
|
16
19
|
[x: string]: any;
|
|
17
20
|
} & import("react").RefAttributes<HTMLElement>>;
|
|
18
|
-
const isAvailable:
|
|
21
|
+
const isAvailable: typeof isSurfaceAvailable;
|
|
22
|
+
type RoleToken<TData> = SurfaceRoleToken<TData>;
|
|
23
|
+
type Binding = SurfaceBindingType;
|
|
24
|
+
type Filter<TData> = SurfaceFilterType<TData>;
|
|
25
|
+
type TokenData<T> = SurfaceTokenData<T>;
|
|
26
|
+
type TypedProps<TToken extends SurfaceRoleToken<any>> = SurfaceTypedProps<TToken>;
|
|
27
|
+
const makeType: <TData>(role: string) => SurfaceRoleToken<TData>;
|
|
28
|
+
const isFilter: (value: unknown) => value is SurfaceFilterType<any>;
|
|
19
29
|
const ProfilerProvider: ({ children }: import("react").PropsWithChildren) => import("react").JSX.Element;
|
|
20
30
|
const useProfilerCallback: () => import("react").ProfilerOnRenderCallback | undefined;
|
|
21
31
|
const useProfilerEntries: () => readonly import("./SurfaceProfilerContext").SurfaceProfilerEntry[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Surface/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Surface/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAoB,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAQ1E,OAAO,EACL,KAAK,UAAU,IAAI,iBAAiB,EACpC,KAAK,SAAS,IAAI,gBAAgB,EAClC,KAAK,cAAc,IAAI,kBAAkB,EACzC,KAAK,aAAa,IAAI,iBAAiB,EACvC,KAAK,SAAS,IAAI,gBAAgB,EAClC,KAAK,UAAU,IAAI,iBAAiB,EACpC,MAAM,IAAI,aAAa,EACvB,SAAS,IAAI,gBAAgB,EAG9B,MAAM,SAAS,CAAC;AAEjB,yBAAiB,OAAO,CAAC,CAAC;IACxB,KAAY,UAAU,GAAG,iBAAiB,CAAC;IACpC,MAAM,MAAM,sBAAgB,CAAC;IAC7B,MAAM,SAAS,yBAAmB,CAAC;IAE1C,KAAY,OAAO,GAAG,cAAc,CAAC;IAC9B,MAAM,OAAO,qDAAiB,CAAC;IAE/B,MAAM,OAAO;;;;;;;;;;mDAAmB,CAAC;IACjC,MAAM,WAAW,2BAAqB,CAAC;IAE9C,KAAY,SAAS,CAAC,KAAK,IAAI,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACvD,KAAY,OAAO,GAAG,kBAAkB,CAAC;IACzC,KAAY,MAAM,CAAC,KAAK,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACrD,KAAY,SAAS,CAAC,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC/C,KAAY,UAAU,CAAC,MAAM,SAAS,gBAAgB,CAAC,GAAG,CAAC,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAClF,MAAM,QAAQ,kDAAa,CAAC;IAC5B,MAAM,QAAQ,qDAAoB,CAAC;IAEnC,MAAM,gBAAgB,kFAA0B,CAAC;IACjD,MAAM,mBAAmB,4DAA6B,CAAC;IACvD,MAAM,kBAAkB,0EAA4B,CAAC;IACrD,MAAM,gBAAgB,iEAA0B,CAAC;IACjD,MAAM,gBAAgB,gCAA0B,CAAC;CACzD;AAED,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -1,7 +1,55 @@
|
|
|
1
1
|
import type { FC, PropsWithChildren, ReactNode, RefCallback } from 'react';
|
|
2
2
|
import type { MakeOptional, Position } from '@dxos/util';
|
|
3
|
+
/**
|
|
4
|
+
* A typed role token. Carries a role string for runtime dispatch plus a phantom
|
|
5
|
+
* data type so consumers using `type={SomeToken}` and providers using
|
|
6
|
+
* `AppSurface.object(SomeToken, ...)` share a single type-level contract.
|
|
7
|
+
*
|
|
8
|
+
* Mint via {@link makeType}.
|
|
9
|
+
*/
|
|
10
|
+
export type RoleToken<TData> = {
|
|
11
|
+
readonly role: string;
|
|
12
|
+
/** Covariant phantom; never accessed at runtime. */
|
|
13
|
+
readonly _phantom?: TData;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* One entry in a {@link SurfaceFilter} — a role plus the guard that validates
|
|
17
|
+
* the data shape when the Surface dispatcher is matching that role.
|
|
18
|
+
*/
|
|
19
|
+
export type SurfaceBinding = {
|
|
20
|
+
readonly role: string;
|
|
21
|
+
readonly guard: (data: unknown) => boolean;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Typed filter binding for {@link create}. Combines one or more `(role, guard)`
|
|
25
|
+
* pairs so a provider can register against multiple roles while keeping the
|
|
26
|
+
* role and its data shape in a single expression.
|
|
27
|
+
*/
|
|
28
|
+
export type SurfaceFilter<TData> = {
|
|
29
|
+
readonly bindings: ReadonlyArray<SurfaceBinding>;
|
|
30
|
+
/** Covariant phantom; never accessed at runtime. */
|
|
31
|
+
readonly _phantom?: TData;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Narrow data type carried by a role token.
|
|
35
|
+
*/
|
|
36
|
+
export type TokenData<T> = T extends RoleToken<infer D> ? D : never;
|
|
37
|
+
/**
|
|
38
|
+
* Runtime guard for {@link SurfaceFilter}. Distinguishes new-style filter
|
|
39
|
+
* bindings from legacy predicate filters.
|
|
40
|
+
*/
|
|
41
|
+
export declare const isSurfaceFilter: (value: unknown) => value is SurfaceFilter<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Mints a typed role token. Identity is structural; all tokens with the same
|
|
44
|
+
* `role` string are interchangeable at runtime.
|
|
45
|
+
*/
|
|
46
|
+
export declare const makeType: <TData>(role: string) => RoleToken<TData>;
|
|
3
47
|
/**
|
|
4
48
|
* Props that are passed to the Surface component.
|
|
49
|
+
*
|
|
50
|
+
* The role can be provided either as a string via `role` or as a typed
|
|
51
|
+
* {@link RoleToken} via `type`. The typed form narrows `data` to the token's
|
|
52
|
+
* declared shape.
|
|
5
53
|
*/
|
|
6
54
|
export type Props<T extends Record<string, any> = Record<string, unknown>> = {
|
|
7
55
|
/**
|
|
@@ -17,14 +65,40 @@ export type Props<T extends Record<string, any> = Record<string, unknown>> = {
|
|
|
17
65
|
* The placeholder component will be rendered while the surface component is loading.
|
|
18
66
|
*/
|
|
19
67
|
placeholder?: ReactNode;
|
|
20
|
-
} & MakeOptional<CoreProps<T>, 'id' | 'data'> &
|
|
21
|
-
/**
|
|
68
|
+
} & MakeOptional<CoreProps<T>, 'id' | 'data' | 'role'> & {
|
|
69
|
+
/**
|
|
70
|
+
* Explicitly disallow `type` on the untyped Props overload — if the caller
|
|
71
|
+
* provides `type={AppSurface.X}`, TypeScript must route to the typed
|
|
72
|
+
* overload (where `data` is narrowed by the token). Without this, the
|
|
73
|
+
* catch-all index signature below would accept any `type` value and mask
|
|
74
|
+
* the typed overload entirely.
|
|
75
|
+
*/
|
|
76
|
+
type?: undefined;
|
|
77
|
+
} /**
|
|
22
78
|
* Additional props to pass to the component.
|
|
23
79
|
* These props are not used by Surface itself but may be used by components which resolve the surface.
|
|
24
80
|
* Exclude known prop names to prevent overriding well-defined props.
|
|
81
|
+
*/ & {
|
|
82
|
+
[K in keyof Record<string, any>]: K extends keyof CoreProps<T> | 'fallback' | 'placeholder' | 'type' ? never : any;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Typed Surface consumer props — carries the role/data-shape contract via a
|
|
86
|
+
* {@link RoleToken}. Available as a typed overload of the Surface component so
|
|
87
|
+
* ad-hoc `type` fields on arbitrary spread props don't conflict with the
|
|
88
|
+
* untyped consumer form.
|
|
25
89
|
*/
|
|
26
|
-
{
|
|
27
|
-
|
|
90
|
+
export type TypedProps<TToken extends RoleToken<any>> = {
|
|
91
|
+
fallback?: FC<{
|
|
92
|
+
error: Error;
|
|
93
|
+
data?: any;
|
|
94
|
+
}>;
|
|
95
|
+
placeholder?: ReactNode;
|
|
96
|
+
id?: string;
|
|
97
|
+
type: TToken;
|
|
98
|
+
data?: TokenData<TToken>;
|
|
99
|
+
limit?: number | undefined;
|
|
100
|
+
} & {
|
|
101
|
+
[K in keyof Record<string, any>]: K extends 'fallback' | 'placeholder' | 'id' | 'type' | 'data' | 'limit' ? never : any;
|
|
28
102
|
};
|
|
29
103
|
/**
|
|
30
104
|
* NOTE: If `[key: string]: unknown` is included in shared types, when re-used other fields become unknown as well.
|
|
@@ -35,7 +109,10 @@ export type CoreProps<T extends Record<string, any> = Record<string, unknown>> =
|
|
|
35
109
|
*/
|
|
36
110
|
id: string;
|
|
37
111
|
/**
|
|
38
|
-
* Role defines how the data should be rendered.
|
|
112
|
+
* Role defines how the data should be rendered. For new code, prefer the
|
|
113
|
+
* typed overload of the Surface component which takes a {@link RoleToken}
|
|
114
|
+
* via the `type` prop instead — it enforces a role/data contract at compile
|
|
115
|
+
* time.
|
|
39
116
|
*/
|
|
40
117
|
role: string;
|
|
41
118
|
/**
|
|
@@ -57,6 +134,10 @@ export type ComponentProps<T extends Record<string, any> = Record<string, any>>
|
|
|
57
134
|
export type ComponentFunction<T extends Record<string, any> = Record<string, any>> = (props: ComponentProps<T>) => ReactNode;
|
|
58
135
|
/**
|
|
59
136
|
* Definition of when a React component surface should be rendered.
|
|
137
|
+
*
|
|
138
|
+
* The optional `filter` receives the consumer-supplied `role` as its second
|
|
139
|
+
* argument so a single definition can encode role-specific guards (used by the
|
|
140
|
+
* {@link SurfaceFilter}-based `create` overload).
|
|
60
141
|
*/
|
|
61
142
|
export type ReactDefinition<T extends Record<string, any> = any> = Readonly<{
|
|
62
143
|
kind: 'react';
|
|
@@ -64,7 +145,7 @@ export type ReactDefinition<T extends Record<string, any> = any> = Readonly<{
|
|
|
64
145
|
role: string | string[];
|
|
65
146
|
position?: Position;
|
|
66
147
|
component: ComponentFunction<T>;
|
|
67
|
-
filter?: (data: Record<string, unknown
|
|
148
|
+
filter?: (data: Record<string, unknown>, role?: string) => data is T;
|
|
68
149
|
}>;
|
|
69
150
|
/**
|
|
70
151
|
* Definition of when a Web Component surface should be rendered.
|
|
@@ -79,18 +160,38 @@ export type WebComponentDefinition<T extends Record<string, any> = any> = Readon
|
|
|
79
160
|
* The Web Component will receive the same props as React surfaces via properties/attributes.
|
|
80
161
|
*/
|
|
81
162
|
tagName: string;
|
|
82
|
-
filter?: (data: Record<string, unknown
|
|
163
|
+
filter?: (data: Record<string, unknown>, role?: string) => data is T;
|
|
83
164
|
}>;
|
|
84
165
|
/**
|
|
85
166
|
* Definition of when a surface (React or Web Component) should be rendered.
|
|
86
167
|
*/
|
|
87
168
|
export type Definition<T extends Record<string, any> = any> = ReactDefinition<T> | WebComponentDefinition<T>;
|
|
169
|
+
/**
|
|
170
|
+
* Typed React surface definition — role is derived from the filter's bindings.
|
|
171
|
+
*/
|
|
172
|
+
export type TypedReactDefinition<T extends Record<string, any> = any> = Readonly<{
|
|
173
|
+
id: string;
|
|
174
|
+
filter: SurfaceFilter<T>;
|
|
175
|
+
component: ComponentFunction<T>;
|
|
176
|
+
position?: Position;
|
|
177
|
+
}>;
|
|
178
|
+
/**
|
|
179
|
+
* Typed Web Component surface definition.
|
|
180
|
+
*/
|
|
181
|
+
export type TypedWebComponentDefinition<T extends Record<string, any> = any> = Readonly<{
|
|
182
|
+
id: string;
|
|
183
|
+
filter: SurfaceFilter<T>;
|
|
184
|
+
tagName: string;
|
|
185
|
+
position?: Position;
|
|
186
|
+
}>;
|
|
88
187
|
/**
|
|
89
188
|
* Creates a React surface definition.
|
|
90
189
|
*/
|
|
91
|
-
export declare
|
|
190
|
+
export declare function create<T extends Record<string, any> = any>(definition: TypedReactDefinition<T>): ReactDefinition<T>;
|
|
191
|
+
export declare function create<T extends Record<string, any> = any>(definition: Omit<ReactDefinition<T>, 'kind'>): ReactDefinition<T>;
|
|
92
192
|
/**
|
|
93
193
|
* Creates a Web Component surface definition.
|
|
94
194
|
*/
|
|
95
|
-
export declare
|
|
195
|
+
export declare function createWeb<T extends Record<string, any> = any>(definition: TypedWebComponentDefinition<T>): WebComponentDefinition<T>;
|
|
196
|
+
export declare function createWeb<T extends Record<string, any> = any>(definition: Omit<WebComponentDefinition<T>, 'kind'>): WebComponentDefinition<T>;
|
|
96
197
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Surface/types.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE3E,OAAO,KAAK,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AsB,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/components/Surface/types.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ui/components/index.ts"],"names":[],"mappings":"AAIA,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|