@dxos/app-framework 0.10.0 → 0.11.1
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 -1
- package/.storybook/preview.mts +2 -2
- package/CHANGELOG.md +120 -0
- package/TASKS.md +11 -0
- package/dist/lib/chunk-SurfaceManager.mjs +960 -0
- package/dist/lib/chunk-SurfaceManager.mjs.map +1 -0
- package/dist/lib/chunk-capability.mjs +15 -0
- package/dist/lib/chunk-capability.mjs.map +1 -0
- package/dist/lib/{browser/chunk-FJ4765WW.mjs → chunk-context.mjs} +4 -5
- package/dist/lib/chunk-context.mjs.map +1 -0
- package/dist/lib/chunk-history-tracker.mjs +160 -0
- package/dist/lib/chunk-history-tracker.mjs.map +1 -0
- package/dist/lib/chunk-plugin-manager.mjs +1390 -0
- package/dist/lib/chunk-plugin-manager.mjs.map +1 -0
- package/dist/lib/chunk-plugin-manifest.mjs +125 -0
- package/dist/lib/chunk-plugin-manifest.mjs.map +1 -0
- package/dist/lib/chunk-process-manager-capability.mjs +126 -0
- package/dist/lib/chunk-process-manager-capability.mjs.map +1 -0
- package/dist/lib/chunk-rolldown-runtime.mjs +13 -0
- package/dist/lib/chunk-url-loader.mjs +347 -0
- package/dist/lib/chunk-url-loader.mjs.map +1 -0
- package/dist/lib/cli.mjs +78 -0
- package/dist/lib/cli.mjs.map +1 -0
- package/dist/lib/common/activation-events.mjs +35 -0
- package/dist/lib/common/activation-events.mjs.map +1 -0
- package/dist/lib/common/capabilities.mjs +184 -0
- package/dist/lib/common/capabilities.mjs.map +1 -0
- package/dist/lib/config.mjs +2 -0
- package/dist/lib/core/activation-event.mjs +55 -0
- package/dist/lib/core/activation-event.mjs.map +1 -0
- package/dist/lib/core/capability.mjs +189 -0
- package/dist/lib/core/capability.mjs.map +1 -0
- package/dist/lib/core/plugin-manager.mjs +2 -0
- package/dist/lib/core/plugin.mjs +340 -0
- package/dist/lib/core/plugin.mjs.map +1 -0
- package/dist/lib/core/url-loader.mjs +2 -0
- package/dist/lib/index.mjs +134 -0
- package/dist/lib/index.mjs.map +1 -0
- package/dist/lib/testing/react.mjs +70 -0
- package/dist/lib/testing/react.mjs.map +1 -0
- package/dist/lib/testing.mjs +399 -0
- package/dist/lib/testing.mjs.map +1 -0
- package/dist/lib/ui.mjs +636 -0
- package/dist/lib/ui.mjs.map +1 -0
- package/dist/lib/vite-plugin.mjs +986 -0
- package/dist/lib/vite-plugin.mjs.map +1 -0
- package/dist/plugin/node-esm/index.mjs +4 -3
- package/dist/plugin/node-esm/index.mjs.map +3 -3
- package/dist/plugin/node-esm/meta.json +1 -1
- package/dist/types/src/common/Role.d.ts +31 -0
- package/dist/types/src/common/Role.d.ts.map +1 -0
- package/dist/types/src/common/Role.test.d.ts +2 -0
- package/dist/types/src/common/Role.test.d.ts.map +1 -0
- package/dist/types/src/common/capabilities.d.ts +11 -2
- package/dist/types/src/common/capabilities.d.ts.map +1 -1
- package/dist/types/src/common/index.d.ts +1 -0
- package/dist/types/src/common/index.d.ts.map +1 -1
- package/dist/types/src/core/capability-manager.d.ts +1 -1
- package/dist/types/src/core/capability-manager.d.ts.map +1 -1
- package/dist/types/src/core/capability.d.ts +38 -5
- package/dist/types/src/core/capability.d.ts.map +1 -1
- package/dist/types/src/core/plugin-manager.d.ts +1 -1
- package/dist/types/src/core/plugin-manager.d.ts.map +1 -1
- package/dist/types/src/core/plugin.d.ts +14 -1
- package/dist/types/src/core/plugin.d.ts.map +1 -1
- package/dist/types/src/core/registry.d.ts +1 -1
- package/dist/types/src/core/registry.d.ts.map +1 -1
- package/dist/types/src/plugin-process-manager/history/capability.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts +1 -1
- package/dist/types/src/plugin-process-manager/process-manager-capability.d.ts.map +1 -1
- package/dist/types/src/testing/StorybookErrorFallback.d.ts +15 -0
- package/dist/types/src/testing/StorybookErrorFallback.d.ts.map +1 -0
- package/dist/types/src/testing/harness.d.ts +1 -1
- package/dist/types/src/testing/harness.d.ts.map +1 -1
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/react.d.ts +4 -4
- package/dist/types/src/testing/react.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 +6 -0
- package/dist/types/src/testing/withPluginManager.stories.d.ts.map +1 -1
- package/dist/types/src/testing/withSurfaceDebug.d.ts +10 -0
- package/dist/types/src/testing/withSurfaceDebug.d.ts.map +1 -0
- package/dist/types/src/ui/components/App/App.d.ts +0 -32
- package/dist/types/src/ui/components/App/App.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/index.d.ts +1 -0
- package/dist/types/src/ui/components/App/index.d.ts.map +1 -1
- package/dist/types/src/ui/components/App/loader.d.ts +35 -0
- package/dist/types/src/ui/components/App/loader.d.ts.map +1 -0
- package/dist/types/src/ui/components/HomeSection/HomeSection.d.ts +26 -0
- package/dist/types/src/ui/components/HomeSection/HomeSection.d.ts.map +1 -0
- package/dist/types/src/ui/components/HomeSection/HomeSection.stories.d.ts +15 -0
- package/dist/types/src/ui/components/HomeSection/HomeSection.stories.d.ts.map +1 -0
- package/dist/types/src/ui/components/HomeSection/index.d.ts +2 -0
- package/dist/types/src/ui/components/HomeSection/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/NamePopover/NamePopover.d.ts +14 -0
- package/dist/types/src/ui/components/NamePopover/NamePopover.d.ts.map +1 -0
- package/dist/types/src/ui/components/NamePopover/index.d.ts +2 -0
- package/dist/types/src/ui/components/NamePopover/index.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts +21 -9
- package/dist/types/src/ui/components/Surface/SurfaceComponent.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts +4 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.stories.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/SurfaceComponent.test.d.ts +2 -0
- package/dist/types/src/ui/components/Surface/SurfaceComponent.test.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceDebug.d.ts +40 -0
- package/dist/types/src/ui/components/Surface/SurfaceDebug.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceManager.d.ts +23 -0
- package/dist/types/src/ui/components/Surface/SurfaceManager.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceManagerContext.d.ts +11 -0
- package/dist/types/src/ui/components/Surface/SurfaceManagerContext.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceMetrics.d.ts +72 -0
- package/dist/types/src/ui/components/Surface/SurfaceMetrics.d.ts.map +1 -0
- package/dist/types/src/ui/components/Surface/SurfaceProfilerContext.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/index.d.ts +20 -25
- package/dist/types/src/ui/components/Surface/index.d.ts.map +1 -1
- package/dist/types/src/ui/components/Surface/types.d.ts +56 -52
- package/dist/types/src/ui/components/Surface/types.d.ts.map +1 -1
- package/dist/types/src/ui/components/index.d.ts +2 -0
- package/dist/types/src/ui/components/index.d.ts.map +1 -1
- package/dist/types/src/ui/hooks/useApp.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/moon.yml +25 -18
- package/package.json +58 -73
- package/src/common/Role.test.ts +41 -0
- package/src/common/Role.ts +54 -0
- package/src/common/capabilities.ts +17 -2
- package/src/common/index.ts +1 -0
- package/src/core/capability-manager.test.ts +1 -1
- package/src/core/capability-manager.ts +1 -1
- package/src/core/capability.ts +45 -6
- package/src/core/plugin-manager.test.ts +38 -3
- package/src/core/plugin-manager.ts +18 -1
- package/src/core/plugin.ts +16 -1
- package/src/core/registry.ts +1 -1
- package/src/plugin-process-manager/process-manager-capability.ts +25 -2
- package/src/testing/StorybookErrorFallback.tsx +40 -0
- package/src/testing/harness.ts +1 -1
- package/src/testing/index.ts +2 -0
- package/src/testing/react.test.tsx +2 -1
- package/src/testing/react.tsx +14 -8
- package/src/testing/withPluginManager.stories.tsx +16 -1
- package/src/testing/withPluginManager.tsx +13 -2
- package/src/testing/withSurfaceDebug.tsx +22 -0
- package/src/ui/components/App/App.tsx +7 -35
- package/src/ui/components/App/index.ts +1 -0
- package/src/ui/components/App/loader.ts +39 -0
- package/src/ui/components/HomeSection/HomeSection.stories.tsx +43 -0
- package/src/ui/components/HomeSection/HomeSection.tsx +69 -0
- package/src/ui/components/HomeSection/index.ts +5 -0
- package/src/ui/components/NamePopover/NamePopover.tsx +70 -0
- package/src/ui/components/NamePopover/index.ts +5 -0
- package/src/ui/components/Surface/DESIGN.md +136 -0
- package/src/ui/components/Surface/SurfaceComponent.stories.tsx +70 -41
- package/src/ui/components/Surface/SurfaceComponent.test.tsx +403 -0
- package/src/ui/components/Surface/SurfaceComponent.tsx +209 -189
- package/src/ui/components/Surface/SurfaceDebug.tsx +435 -0
- package/src/ui/components/Surface/SurfaceManager.ts +95 -0
- package/src/ui/components/Surface/SurfaceManagerContext.ts +23 -0
- package/src/ui/components/Surface/SurfaceMetrics.ts +202 -0
- package/src/ui/components/Surface/SurfaceProfilerContext.tsx +12 -2
- package/src/ui/components/Surface/index.ts +24 -22
- package/src/ui/components/Surface/types.test.ts +47 -54
- package/src/ui/components/Surface/types.ts +66 -91
- package/src/ui/components/index.ts +2 -0
- package/src/ui/hooks/useApp.tsx +7 -3
- package/src/vite-plugin/boot-loader/loader-app/boot-loader.css +1 -1
- package/tsconfig.json +3 -0
- package/vite.config.ts +26 -0
- package/dist/lib/browser/capability-S44TE2H7.mjs +0 -35
- package/dist/lib/browser/capability-S44TE2H7.mjs.map +0 -7
- package/dist/lib/browser/chunk-3NQLTQCP.mjs +0 -47
- package/dist/lib/browser/chunk-3NQLTQCP.mjs.map +0 -7
- package/dist/lib/browser/chunk-53HJHMS5.mjs +0 -7
- package/dist/lib/browser/chunk-53HJHMS5.mjs.map +0 -7
- package/dist/lib/browser/chunk-FJ4765WW.mjs.map +0 -7
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +0 -10
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +0 -7
- package/dist/lib/browser/chunk-KRJ4KK2W.mjs +0 -505
- package/dist/lib/browser/chunk-KRJ4KK2W.mjs.map +0 -7
- package/dist/lib/browser/chunk-LUH4Y5F2.mjs +0 -430
- package/dist/lib/browser/chunk-LUH4Y5F2.mjs.map +0 -7
- package/dist/lib/browser/chunk-NKVRSMFN.mjs +0 -95
- package/dist/lib/browser/chunk-NKVRSMFN.mjs.map +0 -7
- package/dist/lib/browser/chunk-OO53M5UK.mjs +0 -260
- package/dist/lib/browser/chunk-OO53M5UK.mjs.map +0 -7
- package/dist/lib/browser/chunk-OPTS3ZSN.mjs +0 -83
- package/dist/lib/browser/chunk-OPTS3ZSN.mjs.map +0 -7
- package/dist/lib/browser/chunk-Q2GLJTVV.mjs +0 -12
- package/dist/lib/browser/chunk-Q2GLJTVV.mjs.map +0 -7
- package/dist/lib/browser/chunk-SYXIYT6T.mjs +0 -143
- package/dist/lib/browser/chunk-SYXIYT6T.mjs.map +0 -7
- package/dist/lib/browser/chunk-U5MESPM5.mjs +0 -603
- package/dist/lib/browser/chunk-U5MESPM5.mjs.map +0 -7
- package/dist/lib/browser/chunk-UGYCLOXE.mjs +0 -1471
- package/dist/lib/browser/chunk-UGYCLOXE.mjs.map +0 -7
- package/dist/lib/browser/chunk-VF37YTXJ.mjs +0 -28
- package/dist/lib/browser/chunk-VF37YTXJ.mjs.map +0 -7
- package/dist/lib/browser/chunk-YUVQIOTB.mjs +0 -60
- package/dist/lib/browser/chunk-YUVQIOTB.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -74
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/common/activation-events.mjs +0 -20
- package/dist/lib/browser/common/activation-events.mjs.map +0 -7
- package/dist/lib/browser/common/capabilities.mjs +0 -56
- package/dist/lib/browser/common/capabilities.mjs.map +0 -7
- package/dist/lib/browser/config/index.mjs +0 -8
- package/dist/lib/browser/config/index.mjs.map +0 -7
- package/dist/lib/browser/core/activation-event.mjs +0 -20
- package/dist/lib/browser/core/activation-event.mjs.map +0 -7
- package/dist/lib/browser/core/capability.mjs +0 -32
- package/dist/lib/browser/core/capability.mjs.map +0 -7
- package/dist/lib/browser/core/plugin-manager.mjs +0 -19
- package/dist/lib/browser/core/plugin-manager.mjs.map +0 -7
- package/dist/lib/browser/core/plugin.mjs +0 -51
- package/dist/lib/browser/core/plugin.mjs.map +0 -7
- package/dist/lib/browser/core/url-loader.mjs +0 -24
- package/dist/lib/browser/core/url-loader.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -98
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/process-manager-capability-QK4BMKMN.mjs +0 -132
- package/dist/lib/browser/process-manager-capability-QK4BMKMN.mjs.map +0 -7
- package/dist/lib/browser/testing/index.mjs +0 -359
- package/dist/lib/browser/testing/index.mjs.map +0 -7
- package/dist/lib/browser/testing/react.mjs +0 -78
- package/dist/lib/browser/testing/react.mjs.map +0 -7
- package/dist/lib/browser/ui/index.mjs +0 -60
- package/dist/lib/browser/ui/index.mjs.map +0 -7
- package/dist/lib/node-esm/capability-3YRF77LV.mjs +0 -36
- package/dist/lib/node-esm/capability-3YRF77LV.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-2UPUZXGU.mjs +0 -9
- package/dist/lib/node-esm/chunk-2UPUZXGU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-37Z53PXZ.mjs +0 -10
- package/dist/lib/node-esm/chunk-37Z53PXZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4SE7SX7N.mjs +0 -261
- package/dist/lib/node-esm/chunk-4SE7SX7N.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BMW6P6QA.mjs +0 -48
- package/dist/lib/node-esm/chunk-BMW6P6QA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-COHOWGGJ.mjs +0 -144
- package/dist/lib/node-esm/chunk-COHOWGGJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DRT75WGD.mjs +0 -604
- package/dist/lib/node-esm/chunk-DRT75WGD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FKMVORZN.mjs +0 -431
- package/dist/lib/node-esm/chunk-FKMVORZN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FPW45EZH.mjs +0 -14
- package/dist/lib/node-esm/chunk-FPW45EZH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GLH4LGHZ.mjs +0 -84
- package/dist/lib/node-esm/chunk-GLH4LGHZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IL7O7IRX.mjs +0 -1472
- package/dist/lib/node-esm/chunk-IL7O7IRX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ND2HETHD.mjs +0 -506
- package/dist/lib/node-esm/chunk-ND2HETHD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TLKYZKPW.mjs +0 -29
- package/dist/lib/node-esm/chunk-TLKYZKPW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VCPGX7WN.mjs +0 -62
- package/dist/lib/node-esm/chunk-VCPGX7WN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XSZMX53L.mjs +0 -96
- package/dist/lib/node-esm/chunk-XSZMX53L.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -75
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/common/activation-events.mjs +0 -21
- package/dist/lib/node-esm/common/activation-events.mjs.map +0 -7
- package/dist/lib/node-esm/common/capabilities.mjs +0 -57
- package/dist/lib/node-esm/common/capabilities.mjs.map +0 -7
- package/dist/lib/node-esm/config/index.mjs +0 -9
- package/dist/lib/node-esm/config/index.mjs.map +0 -7
- package/dist/lib/node-esm/core/activation-event.mjs +0 -21
- package/dist/lib/node-esm/core/activation-event.mjs.map +0 -7
- package/dist/lib/node-esm/core/capability.mjs +0 -33
- package/dist/lib/node-esm/core/capability.mjs.map +0 -7
- package/dist/lib/node-esm/core/plugin-manager.mjs +0 -20
- package/dist/lib/node-esm/core/plugin-manager.mjs.map +0 -7
- package/dist/lib/node-esm/core/plugin.mjs +0 -52
- package/dist/lib/node-esm/core/plugin.mjs.map +0 -7
- package/dist/lib/node-esm/core/url-loader.mjs +0 -25
- package/dist/lib/node-esm/core/url-loader.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -99
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/process-manager-capability-5S7WZ2JR.mjs +0 -133
- package/dist/lib/node-esm/process-manager-capability-5S7WZ2JR.mjs.map +0 -7
- package/dist/lib/node-esm/testing/index.mjs +0 -360
- package/dist/lib/node-esm/testing/index.mjs.map +0 -7
- package/dist/lib/node-esm/testing/react.mjs +0 -79
- package/dist/lib/node-esm/testing/react.mjs.map +0 -7
- package/dist/lib/node-esm/ui/index.mjs +0 -61
- package/dist/lib/node-esm/ui/index.mjs.map +0 -7
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts +0 -11
- package/dist/types/src/ui/components/Surface/SurfaceInfo.d.ts.map +0 -1
- package/src/ui/components/Surface/SurfaceInfo.tsx +0 -106
- package/vitest.config.ts +0 -14
|
@@ -2,32 +2,18 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import type { FC, PropsWithChildren, ReactNode
|
|
5
|
+
import type { ComponentType, FC, PropsWithChildren, ReactNode } from 'react';
|
|
6
6
|
|
|
7
|
-
import type { DXN } from '@dxos/keys';
|
|
8
7
|
import { log } from '@dxos/log';
|
|
9
8
|
import type { MakeOptional, Position } from '@dxos/util';
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
* A typed role token. Carries a role NSID for runtime dispatch plus a phantom
|
|
13
|
-
* data type so consumers using `type={SomeToken}` and providers using
|
|
14
|
-
* `AppSurface.object(SomeToken, ...)` share a single type-level contract.
|
|
15
|
-
*
|
|
16
|
-
* Mint via {@link makeType}. The `role` field holds the bare NSID (e.g.
|
|
17
|
-
* `org.dxos.role.article`) — the dispatch key, `data-role` attribute value,
|
|
18
|
-
* and what `.role` comparisons inside matched components see.
|
|
19
|
-
*/
|
|
20
|
-
export type RoleToken<TData> = {
|
|
21
|
-
readonly role: string;
|
|
22
|
-
/** Covariant phantom; never accessed at runtime. */
|
|
23
|
-
readonly _phantom?: TData;
|
|
24
|
-
};
|
|
10
|
+
import * as Role from '../../../common/Role';
|
|
25
11
|
|
|
26
12
|
/**
|
|
27
|
-
* One entry in a {@link
|
|
28
|
-
*
|
|
13
|
+
* One entry in a {@link Filter} — a role NSID plus the guard that validates the
|
|
14
|
+
* data shape when the Surface dispatcher is matching that role.
|
|
29
15
|
*/
|
|
30
|
-
export type
|
|
16
|
+
export type Binding = {
|
|
31
17
|
readonly role: string;
|
|
32
18
|
readonly guard: (data: unknown) => boolean;
|
|
33
19
|
};
|
|
@@ -37,53 +23,21 @@ export type SurfaceBinding = {
|
|
|
37
23
|
* pairs so a provider can register against multiple roles while keeping the
|
|
38
24
|
* role and its data shape in a single expression.
|
|
39
25
|
*/
|
|
40
|
-
export type
|
|
41
|
-
readonly bindings: ReadonlyArray<
|
|
26
|
+
export type Filter<TData> = {
|
|
27
|
+
readonly bindings: ReadonlyArray<Binding>;
|
|
42
28
|
/** Covariant phantom; never accessed at runtime. */
|
|
43
29
|
readonly _phantom?: TData;
|
|
44
30
|
};
|
|
45
31
|
|
|
46
32
|
/**
|
|
47
|
-
*
|
|
33
|
+
* Runtime guard for {@link Filter}. Distinguishes new-style filter bindings from
|
|
34
|
+
* legacy predicate filters.
|
|
48
35
|
*/
|
|
49
|
-
export
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Runtime guard for {@link SurfaceFilter}. Distinguishes new-style filter
|
|
53
|
-
* bindings from legacy predicate filters.
|
|
54
|
-
*/
|
|
55
|
-
export const isSurfaceFilter = (value: unknown): value is SurfaceFilter<any> =>
|
|
36
|
+
export const isFilter = (value: unknown): value is Filter<any> =>
|
|
56
37
|
typeof value === 'object' && value !== null && Array.isArray((value as { bindings?: unknown }).bindings);
|
|
57
38
|
|
|
58
39
|
/**
|
|
59
|
-
*
|
|
60
|
-
* {@link DXN.Name}: the final segment must be camelCase (no hyphens).
|
|
61
|
-
* Dynamic NSIDs (template-literal / runtime strings) are validated at runtime.
|
|
62
|
-
*
|
|
63
|
-
* Identity is structural; all tokens with the same `role` string are
|
|
64
|
-
* interchangeable at runtime.
|
|
65
|
-
*/
|
|
66
|
-
export const makeType: {
|
|
67
|
-
<TData = unknown, T extends string = string>(
|
|
68
|
-
nsid: [DXN.Name<T>] extends [never] ? `Invalid NSID "${T}": final segment must be camelCase (no hyphens)` : T,
|
|
69
|
-
): RoleToken<TData>;
|
|
70
|
-
} = <TData>(nsid: string): RoleToken<TData> => {
|
|
71
|
-
// Runtime guard for dynamic NSIDs that bypass the compile-time DXN.Name<T> check.
|
|
72
|
-
if (
|
|
73
|
-
typeof nsid !== 'string' ||
|
|
74
|
-
!/^[a-zA-Z]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(\.[a-zA-Z][a-zA-Z0-9]{0,62})$/.test(
|
|
75
|
-
nsid,
|
|
76
|
-
)
|
|
77
|
-
) {
|
|
78
|
-
throw new Error(
|
|
79
|
-
`Invalid role NSID: "${nsid}". Must be a dotted name with a camelCase final segment (no hyphens in the last segment).`,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
return { role: nsid };
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Creates a {@link SurfaceFilter} from a role token and an optional guard.
|
|
40
|
+
* Creates a {@link Filter} from a role token and an optional guard.
|
|
87
41
|
*
|
|
88
42
|
* When `guard` is omitted the filter matches any data at the token's role
|
|
89
43
|
* (role-only dispatch). Pass a guard to add runtime data-shape validation on
|
|
@@ -92,7 +46,7 @@ export const makeType: {
|
|
|
92
46
|
* This is the framework-level primitive; `@dxos/app-toolkit` builds richer
|
|
93
47
|
* domain-aware helpers (ECHO schema checks, literal matching, etc.) on top of it.
|
|
94
48
|
*/
|
|
95
|
-
export const makeFilter = <TData>(token:
|
|
49
|
+
export const makeFilter = <TData>(token: Role.Role<TData>, guard?: (data: TData) => boolean): Filter<TData> => {
|
|
96
50
|
const boundGuard =
|
|
97
51
|
guard == null
|
|
98
52
|
? () => true
|
|
@@ -109,7 +63,7 @@ export const makeFilter = <TData>(token: RoleToken<TData>, guard?: (data: TData)
|
|
|
109
63
|
|
|
110
64
|
/**
|
|
111
65
|
* Typed Surface consumer props — carries the role/data-shape contract via a
|
|
112
|
-
* {@link
|
|
66
|
+
* {@link Role.Role}. The `type` prop is required; the string `role` prop has
|
|
113
67
|
* been removed from the consumer-facing API.
|
|
114
68
|
*/
|
|
115
69
|
export type Props<T extends Record<string, any> = Record<string, unknown>> = {
|
|
@@ -128,16 +82,16 @@ export type Props<T extends Record<string, any> = Record<string, unknown>> = {
|
|
|
128
82
|
|
|
129
83
|
/**
|
|
130
84
|
* Typed Surface consumer props — carries the role/data-shape contract via a
|
|
131
|
-
* {@link
|
|
85
|
+
* {@link Role.Role}. Available as a typed overload of the Surface component so
|
|
132
86
|
* ad-hoc `type` fields on arbitrary spread props don't conflict with the
|
|
133
87
|
* untyped consumer form.
|
|
134
88
|
*/
|
|
135
|
-
export type TypedProps<TToken extends
|
|
89
|
+
export type TypedProps<TToken extends Role.Role<any>> = {
|
|
136
90
|
fallback?: FC<{ error: Error; data?: any }>;
|
|
137
91
|
placeholder?: ReactNode;
|
|
138
92
|
id?: string;
|
|
139
93
|
type: TToken;
|
|
140
|
-
data?:
|
|
94
|
+
data?: Role.Data<TToken>;
|
|
141
95
|
limit?: number | undefined;
|
|
142
96
|
} & {
|
|
143
97
|
/**
|
|
@@ -163,7 +117,7 @@ export type CoreProps<T extends Record<string, any> = Record<string, unknown>> =
|
|
|
163
117
|
/**
|
|
164
118
|
* The role token defining how the data should be rendered.
|
|
165
119
|
*/
|
|
166
|
-
type:
|
|
120
|
+
type: Role.Role<T>;
|
|
167
121
|
|
|
168
122
|
/**
|
|
169
123
|
* The data to be rendered by the surface.
|
|
@@ -177,7 +131,6 @@ export type CoreProps<T extends Record<string, any> = Record<string, unknown>> =
|
|
|
177
131
|
limit?: number | undefined;
|
|
178
132
|
}>;
|
|
179
133
|
|
|
180
|
-
// TODO(burdon): Remove ref since relying on this would be error prone.
|
|
181
134
|
export type ComponentProps<T extends Record<string, any> = Record<string, any>> = {
|
|
182
135
|
/**
|
|
183
136
|
* The resolved role NSID string (e.g. `org.dxos.role.article`). Present on
|
|
@@ -185,7 +138,6 @@ export type ComponentProps<T extends Record<string, any> = Record<string, any>>
|
|
|
185
138
|
* by comparing against a token's `.role` (e.g. `role === AppSurface.Section.role`).
|
|
186
139
|
*/
|
|
187
140
|
role: string;
|
|
188
|
-
ref?: Ref<HTMLElement>;
|
|
189
141
|
} & PropsWithChildren<{
|
|
190
142
|
id: string;
|
|
191
143
|
data: T;
|
|
@@ -205,7 +157,7 @@ export type ComponentFunction<T extends Record<string, any> = Record<string, any
|
|
|
205
157
|
*
|
|
206
158
|
* The optional `filter` receives the consumer-supplied `role` as its second
|
|
207
159
|
* argument so a single definition can encode role-specific guards (used by the
|
|
208
|
-
* {@link
|
|
160
|
+
* {@link Filter}-based `create` overload).
|
|
209
161
|
*
|
|
210
162
|
* @internal The `role` field is populated by the framework from the filter
|
|
211
163
|
* bindings and is not authored directly.
|
|
@@ -215,7 +167,9 @@ export type ReactDefinition<T extends Record<string, any> = any> = Readonly<{
|
|
|
215
167
|
id: string;
|
|
216
168
|
role: string | string[];
|
|
217
169
|
position?: Position.Position;
|
|
218
|
-
component:
|
|
170
|
+
component: ComponentType<any>;
|
|
171
|
+
/** Maps the surface props onto the component's props; see {@link TypedReactDefinition.props}. */
|
|
172
|
+
props?: (props: ComponentProps<T>) => Record<string, any>;
|
|
219
173
|
filter?: (data: Record<string, unknown>, role?: string) => data is T;
|
|
220
174
|
}>;
|
|
221
175
|
|
|
@@ -246,11 +200,35 @@ export type Definition<T extends Record<string, any> = any> = ReactDefinition<T>
|
|
|
246
200
|
/**
|
|
247
201
|
* Typed React surface definition — role is derived from the filter's bindings.
|
|
248
202
|
*/
|
|
249
|
-
export type TypedReactDefinition<
|
|
203
|
+
export type TypedReactDefinition<
|
|
204
|
+
T extends Record<string, any> = any,
|
|
205
|
+
P extends Record<string, any> = ComponentProps<T>,
|
|
206
|
+
> = Readonly<{
|
|
250
207
|
id: string;
|
|
251
|
-
filter:
|
|
252
|
-
component: ComponentFunction<T>;
|
|
208
|
+
filter: Filter<T>;
|
|
253
209
|
position?: Position.Position;
|
|
210
|
+
/**
|
|
211
|
+
* Accepts any component type (not just a function) so a container re-exported through a
|
|
212
|
+
* `lazy()` barrel as `ComponentType<any>` can be registered without a cast.
|
|
213
|
+
*/
|
|
214
|
+
component: ComponentType<P>;
|
|
215
|
+
/**
|
|
216
|
+
* Maps the surface props onto the component's own props, so a plain container can be registered
|
|
217
|
+
* directly instead of being wrapped in an adapter that unpacks `data`.
|
|
218
|
+
*
|
|
219
|
+
* Prefer this over an inline `component: ({ data }) => <Container … />`: the mapper's input type
|
|
220
|
+
* derives from the same `filter` that defines the surface's data shape, so the unpacking is
|
|
221
|
+
* checked against the filter rather than restated by hand.
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* Surface.create({
|
|
225
|
+
* id: 'defaultPluginSettings',
|
|
226
|
+
* filter: AppSurface.settings(AppSurface.Article),
|
|
227
|
+
* component: DefaultSettings,
|
|
228
|
+
* props: ({ data: { subject } }) => ({ subject }),
|
|
229
|
+
* });
|
|
230
|
+
*/
|
|
231
|
+
props?: (props: ComponentProps<T>) => P;
|
|
254
232
|
}>;
|
|
255
233
|
|
|
256
234
|
/**
|
|
@@ -258,13 +236,13 @@ export type TypedReactDefinition<T extends Record<string, any> = any> = Readonly
|
|
|
258
236
|
*/
|
|
259
237
|
export type TypedWebComponentDefinition<T extends Record<string, any> = any> = Readonly<{
|
|
260
238
|
id: string;
|
|
261
|
-
filter:
|
|
239
|
+
filter: Filter<T>;
|
|
262
240
|
tagName: string;
|
|
263
241
|
position?: Position.Position;
|
|
264
242
|
}>;
|
|
265
243
|
|
|
266
244
|
const expandBindings = <T extends Record<string, any>>(
|
|
267
|
-
filter:
|
|
245
|
+
filter: Filter<T>,
|
|
268
246
|
): { role: string | string[]; guard: (data: Record<string, unknown>, role?: string) => data is T } => {
|
|
269
247
|
const bindings = filter.bindings;
|
|
270
248
|
const roles = Array.from(new Set(bindings.map((binding) => binding.role)));
|
|
@@ -280,33 +258,31 @@ const expandBindings = <T extends Record<string, any>>(
|
|
|
280
258
|
};
|
|
281
259
|
|
|
282
260
|
/**
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
* appended to a plugin's NSID to form a full DXN path.
|
|
261
|
+
* Whether a surface or extension local ID follows NSID conventions: the final
|
|
262
|
+
* dot-separated segment must be camelCase (letters and digits only, starting
|
|
263
|
+
* with a letter — no hyphens or underscores). This mirrors the rule enforced
|
|
264
|
+
* when the id is appended to a plugin's NSID to form a full DXN path.
|
|
265
|
+
*
|
|
266
|
+
* A definition with an invalid id is dropped at dispatch rather than rejected
|
|
267
|
+
* here, so a single malformed contribution cannot crash plugin activation.
|
|
287
268
|
*
|
|
288
269
|
* @example Valid: 'about', 'integrationArticle', 'article.journal'
|
|
289
270
|
* @example Invalid: 'integration-article', 'plugin-spec'
|
|
290
271
|
*/
|
|
291
|
-
const
|
|
292
|
-
const segments = id.split('.');
|
|
293
|
-
const finalSegment = segments[segments.length - 1];
|
|
294
|
-
if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(finalSegment)) {
|
|
295
|
-
throw new Error(
|
|
296
|
-
`Invalid surface id: "${id}". The final segment "${finalSegment}" must be camelCase (letters and digits only, starting with a letter — no hyphens or underscores).`,
|
|
297
|
-
);
|
|
298
|
-
}
|
|
299
|
-
};
|
|
272
|
+
export const isValidLocalId = (id: string): boolean => /^[a-zA-Z][a-zA-Z0-9]*$/.test(id.split('.').pop() ?? '');
|
|
300
273
|
|
|
301
274
|
/**
|
|
302
275
|
* Creates a React surface definition from a typed filter.
|
|
303
276
|
*/
|
|
304
|
-
export function create<T extends Record<string, any> = any
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
277
|
+
export function create<T extends Record<string, any> = any, P extends Record<string, any> = ComponentProps<T>>(
|
|
278
|
+
definition: TypedReactDefinition<T, P>,
|
|
279
|
+
): ReactDefinition<T>;
|
|
280
|
+
export function create<T extends Record<string, any> = any, P extends Record<string, any> = ComponentProps<T>>(
|
|
281
|
+
definition: TypedReactDefinition<T, P>,
|
|
282
|
+
): ReactDefinition<T> {
|
|
283
|
+
const { id, filter, component, props, position } = definition;
|
|
308
284
|
const { role, guard } = expandBindings(filter);
|
|
309
|
-
return { kind: 'react', id, role, position, component, filter: guard };
|
|
285
|
+
return { kind: 'react', id, role, position, component, props, filter: guard };
|
|
310
286
|
}
|
|
311
287
|
|
|
312
288
|
/**
|
|
@@ -318,7 +294,6 @@ export function createWeb<T extends Record<string, any> = any>(
|
|
|
318
294
|
export function createWeb<T extends Record<string, any> = any>(
|
|
319
295
|
definition: TypedWebComponentDefinition<T>,
|
|
320
296
|
): WebComponentDefinition<T> {
|
|
321
|
-
validateLocalId(definition.id);
|
|
322
297
|
const { id, filter, tagName, position } = definition;
|
|
323
298
|
const { role, guard } = expandBindings(filter);
|
|
324
299
|
return { kind: 'web-component', id, role, position, tagName, filter: guard };
|
package/src/ui/hooks/useApp.tsx
CHANGED
|
@@ -19,7 +19,7 @@ import { ContextProtocolProvider } from '@dxos/web-context-react';
|
|
|
19
19
|
import { ActivationEvents, Capabilities } from '../../common';
|
|
20
20
|
import { PluginManagerContext } from '../../context';
|
|
21
21
|
import { type ActivationEvent, type Plugin, PluginManager } from '../../core';
|
|
22
|
-
import { App, PluginManagerProvider } from '../components';
|
|
22
|
+
import { App, PluginManagerProvider, SurfaceManager, SurfaceManagerProvider } from '../components';
|
|
23
23
|
|
|
24
24
|
const ENABLED_KEY = 'org.dxos.app-framework.enabled';
|
|
25
25
|
|
|
@@ -317,19 +317,23 @@ export const useApp = ({
|
|
|
317
317
|
const progressRef = useRef(startupProgress);
|
|
318
318
|
progressRef.current = startupProgress;
|
|
319
319
|
|
|
320
|
+
const surfaces = useMemo(() => new SurfaceManager(manager.capabilities), [manager]);
|
|
321
|
+
|
|
320
322
|
return useCallback(
|
|
321
323
|
() => (
|
|
322
324
|
<ErrorBoundary name='app' FallbackComponent={fallback}>
|
|
323
325
|
<PluginManagerProvider value={manager}>
|
|
324
326
|
<ContextProtocolProvider value={manager} context={PluginManagerContext}>
|
|
325
327
|
<RegistryContext.Provider value={manager.registry}>
|
|
326
|
-
<
|
|
328
|
+
<SurfaceManagerProvider value={surfaces}>
|
|
329
|
+
<App ready={ready} error={error} debounce={debounce} progress={progressRef.current} />
|
|
330
|
+
</SurfaceManagerProvider>
|
|
327
331
|
</RegistryContext.Provider>
|
|
328
332
|
</ContextProtocolProvider>
|
|
329
333
|
</PluginManagerProvider>
|
|
330
334
|
</ErrorBoundary>
|
|
331
335
|
),
|
|
332
|
-
[fallback, manager, ready, error],
|
|
336
|
+
[fallback, manager, surfaces, ready, error],
|
|
333
337
|
);
|
|
334
338
|
};
|
|
335
339
|
|
|
@@ -14,7 +14,7 @@ body {
|
|
|
14
14
|
/*
|
|
15
15
|
* Defaults match `@dxos/ui-theme`'s `--color-base-surface`, which resolves to
|
|
16
16
|
* Tailwind's `neutral-50` / `neutral-950` in light / dark mode respectively
|
|
17
|
-
* (see `packages/ui/ui-theme/src/css/theme/
|
|
17
|
+
* (see `packages/ui/ui-theme/src/css/theme/surfaces.css`). Hosts can override
|
|
18
18
|
* with the `--boot-loader-bg-*` / `--boot-loader-fg-*` custom properties on
|
|
19
19
|
* `:root` if they need a different palette. Keeping the boot loader's
|
|
20
20
|
* background identical to the app's `body` eliminates the flash on handoff
|
package/tsconfig.json
CHANGED
package/vite.config.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { defineConfig } from '../../../vite.base.config.ts';
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
entry: {
|
|
9
|
+
'vite-plugin': 'src/vite-plugin/index.ts',
|
|
10
|
+
'index': 'src/index.ts',
|
|
11
|
+
'core/activation-event': 'src/core/activation-event.ts',
|
|
12
|
+
'common/activation-events': 'src/common/activation-events.ts',
|
|
13
|
+
'common/capabilities': 'src/common/capabilities.ts',
|
|
14
|
+
'core/capability': 'src/core/capability.ts',
|
|
15
|
+
'core/plugin': 'src/core/plugin.ts',
|
|
16
|
+
'core/plugin-manager': 'src/core/plugin-manager.ts',
|
|
17
|
+
'core/url-loader': 'src/core/url-loader.ts',
|
|
18
|
+
'config': 'src/config/index.ts',
|
|
19
|
+
'cli': 'src/cli/index.ts',
|
|
20
|
+
'testing': 'src/testing/index.ts',
|
|
21
|
+
'testing/react': 'src/testing/react.tsx',
|
|
22
|
+
'ui': 'src/ui/index.ts',
|
|
23
|
+
},
|
|
24
|
+
jsx: 'react',
|
|
25
|
+
test: { node: { environment: 'jsdom' }, storybook: true },
|
|
26
|
+
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
make,
|
|
3
|
-
make2
|
|
4
|
-
} from "./chunk-SYXIYT6T.mjs";
|
|
5
|
-
import "./chunk-Q2GLJTVV.mjs";
|
|
6
|
-
import {
|
|
7
|
-
capabilities_exports
|
|
8
|
-
} from "./chunk-NKVRSMFN.mjs";
|
|
9
|
-
import "./chunk-VF37YTXJ.mjs";
|
|
10
|
-
import "./chunk-YUVQIOTB.mjs";
|
|
11
|
-
import "./chunk-LUH4Y5F2.mjs";
|
|
12
|
-
import "./chunk-UGYCLOXE.mjs";
|
|
13
|
-
import "./chunk-3NQLTQCP.mjs";
|
|
14
|
-
import "./chunk-OO53M5UK.mjs";
|
|
15
|
-
import {
|
|
16
|
-
capability_exports
|
|
17
|
-
} from "./chunk-OPTS3ZSN.mjs";
|
|
18
|
-
import "./chunk-J5LGTIGS.mjs";
|
|
19
|
-
|
|
20
|
-
// src/plugin-process-manager/history/capability.ts
|
|
21
|
-
import * as Effect from "effect/Effect";
|
|
22
|
-
var capability_default = capability_exports.makeModule(Effect.fnUntraced(function* () {
|
|
23
|
-
const capabilities = yield* capability_exports.Service;
|
|
24
|
-
const undoRegistry = make(() => capabilities.getAll(capabilities_exports.UndoMapping).flat());
|
|
25
|
-
const invoker = yield* capability_exports.get(capabilities_exports.OperationInvoker);
|
|
26
|
-
const historyTracker = make2(invoker, undoRegistry);
|
|
27
|
-
return [
|
|
28
|
-
capability_exports.contributes(capabilities_exports.UndoRegistry, undoRegistry),
|
|
29
|
-
capability_exports.contributes(capabilities_exports.HistoryTracker, historyTracker)
|
|
30
|
-
];
|
|
31
|
-
}));
|
|
32
|
-
export {
|
|
33
|
-
capability_default as default
|
|
34
|
-
};
|
|
35
|
-
//# sourceMappingURL=capability-S44TE2H7.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/plugin-process-manager/history/capability.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { OperationInvoker } from '@dxos/operation';\n\nimport { Capabilities } from '../../common';\nimport { Capability } from '../../core';\nimport * as HistoryTracker from './history-tracker';\nimport * as UndoRegistry from './undo-registry';\n\n//\n// Capability Module - contributes both UndoRegistry and HistoryTracker.\n//\n\nexport default Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get the context for synchronous access in callbacks.\n const capabilities = yield* Capability.Service;\n\n // Create UndoRegistry.\n const undoRegistry = UndoRegistry.make(() => capabilities.getAll(Capabilities.UndoMapping).flat());\n\n // Create HistoryTracker (depends on UndoRegistry and OperationInvoker).\n const invoker = yield* Capability.get(Capabilities.OperationInvoker);\n // Cast to internal type - the factory always returns OperationInvokerInternal.\n const historyTracker = HistoryTracker.make(invoker as OperationInvoker.OperationInvokerInternal, undoRegistry);\n\n return [\n Capability.contributes(Capabilities.UndoRegistry, undoRegistry),\n Capability.contributes(Capabilities.HistoryTracker, historyTracker),\n ];\n }),\n);\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;AAIA,YAAYA,YAAY;AAaxB,IAAA,qBAAeC,mBAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,eAAe,OAAOH,mBAAWI;AAGvC,QAAMC,eAA4BC,KAAK,MAAMH,aAAaI,OAAOC,qBAAaC,WAAW,EAAEC,KAAI,CAAA;AAG/F,QAAMC,UAAU,OAAOX,mBAAWY,IAAIJ,qBAAaK,gBAAgB;AAEnE,QAAMC,iBAAgCR,MAAKK,SAAsDN,YAAAA;AAEjG,SAAO;IACLL,mBAAWe,YAAYP,qBAAaQ,cAAcX,YAAAA;IAClDL,mBAAWe,YAAYP,qBAAaS,gBAAgBH,cAAAA;;AAExD,CAAA,CAAA;",
|
|
6
|
-
"names": ["Effect", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "undoRegistry", "make", "getAll", "Capabilities", "UndoMapping", "flat", "invoker", "get", "OperationInvoker", "historyTracker", "contributes", "UndoRegistry", "HistoryTracker"]
|
|
7
|
-
}
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export
|
|
3
|
-
} from "./chunk-J5LGTIGS.mjs";
|
|
4
|
-
|
|
5
|
-
// src/core/activation-event.ts
|
|
6
|
-
var activation_event_exports = {};
|
|
7
|
-
__export(activation_event_exports, {
|
|
8
|
-
allOf: () => allOf,
|
|
9
|
-
eventKey: () => eventKey,
|
|
10
|
-
getEvents: () => getEvents,
|
|
11
|
-
isAllOf: () => isAllOf,
|
|
12
|
-
isOneOf: () => isOneOf,
|
|
13
|
-
make: () => make,
|
|
14
|
-
oneOf: () => oneOf
|
|
15
|
-
});
|
|
16
|
-
import { DXN } from "@dxos/keys";
|
|
17
|
-
import { compositeKey } from "@dxos/util";
|
|
18
|
-
var make = (nsid, specifier) => ({
|
|
19
|
-
id: DXN.make(nsid),
|
|
20
|
-
specifier
|
|
21
|
-
});
|
|
22
|
-
var eventKey = (event) => event.specifier ? compositeKey(event.id, event.specifier) : event.id;
|
|
23
|
-
var oneOf = (...events) => ({
|
|
24
|
-
type: "one-of",
|
|
25
|
-
events
|
|
26
|
-
});
|
|
27
|
-
var allOf = (...events) => ({
|
|
28
|
-
type: "all-of",
|
|
29
|
-
events
|
|
30
|
-
});
|
|
31
|
-
var isOneOf = (events) => "type" in events && events.type === "one-of";
|
|
32
|
-
var isAllOf = (events) => "type" in events && events.type === "all-of";
|
|
33
|
-
var getEvents = (events) => "type" in events ? events.events : [
|
|
34
|
-
events
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
make,
|
|
39
|
-
eventKey,
|
|
40
|
-
oneOf,
|
|
41
|
-
allOf,
|
|
42
|
-
isOneOf,
|
|
43
|
-
isAllOf,
|
|
44
|
-
getEvents,
|
|
45
|
-
activation_event_exports
|
|
46
|
-
};
|
|
47
|
-
//# sourceMappingURL=chunk-3NQLTQCP.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/core/activation-event.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { DXN } from '@dxos/keys';\nimport { compositeKey } from '@dxos/util';\n\n/**\n * A unique DXN identifier representing an event.\n *\n * @example dxn:org.dxos.plugin.example.event.ready\n */\nexport type ActivationEvent = {\n id: DXN.DXN;\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 from an NSID.\n * Static NSID strings are validated at compile time via {@link DXN.Name}.\n */\nexport const make: {\n <T extends string>(\n nsid: [DXN.Name<T>] extends [never] ? `Invalid NSID \"${T}\": final segment must be camelCase (no hyphens)` : T,\n specifier?: string,\n ): ActivationEvent;\n} = (nsid: string, specifier?: string): ActivationEvent => ({\n id: DXN.make(nsid),\n specifier,\n});\n\n/**\n * Helper to create an activation event key.\n */\nexport const eventKey = (event: ActivationEvent) =>\n event.specifier ? compositeKey(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;;;;;;;;;;AAIA,SAASA,WAAW;AACpB,SAASC,oBAAoB;AAwBtB,IAAMC,OAKT,CAACC,MAAcC,eAAyC;EAC1DC,IAAIL,IAAIE,KAAKC,IAAAA;EACbC;AACF;AAKO,IAAME,WAAW,CAACC,UACvBA,MAAMH,YAAYH,aAAaM,MAAMF,IAAIE,MAAMH,SAAS,IAAIG,MAAMF;AAK7D,IAAMG,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": ["DXN", "compositeKey", "make", "nsid", "specifier", "id", "eventKey", "event", "oneOf", "events", "type", "allOf", "isOneOf", "isAllOf", "getEvents"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/context.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { createContext } from '@dxos/web-context';\n\nimport { type PluginManager } from './core';\n\nexport const PluginManagerContext = createContext<PluginManager.PluginManager>('org.dxos.app-framework.plugin-manager');\n"],
|
|
5
|
-
"mappings": ";AAIA,SAASA,qBAAqB;AAIvB,IAAMC,uBAAuBD,cAA2C,uCAAA;",
|
|
6
|
-
"names": ["createContext", "PluginManagerContext"]
|
|
7
|
-
}
|