@edv4h/usketch-core 2.0.5 → 2.2.0
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/action-registry.d.ts +17 -0
- package/dist/action-registry.d.ts.map +1 -0
- package/dist/action-registry.js +76 -0
- package/dist/action-registry.js.map +1 -0
- package/dist/create-app.d.ts +7 -1
- package/dist/create-app.d.ts.map +1 -1
- package/dist/create-app.js +40 -2
- package/dist/create-app.js.map +1 -1
- package/dist/hud-registry.d.ts +19 -0
- package/dist/hud-registry.d.ts.map +1 -0
- package/dist/hud-registry.js +77 -0
- package/dist/hud-registry.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/lod/policies.js.map +1 -1
- package/dist/plugin-registry.d.ts.map +1 -1
- package/dist/service-registry.d.ts +10 -0
- package/dist/service-registry.d.ts.map +1 -0
- package/dist/service-registry.js +27 -0
- package/dist/service-registry.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ActionRegistry, PluginAction } from "@edv4h/usketch-shared";
|
|
2
|
+
/**
|
|
3
|
+
* Concrete registry type: the public {@link ActionRegistry} plus an internal
|
|
4
|
+
* `registerFor` used by the app to stamp the owning plugin id (see `createApp`'s
|
|
5
|
+
* per-plugin scoped context). Not part of the shared interface.
|
|
6
|
+
*/
|
|
7
|
+
export interface InternalActionRegistry extends ActionRegistry {
|
|
8
|
+
registerFor(pluginId: string | undefined, action: PluginAction): () => void;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Registry of declarative, invokable plugin operations ({@link PluginAction}).
|
|
12
|
+
* Mirrors the tool registry's enumerable shape and adds `subscribe` so a generic
|
|
13
|
+
* control surface (the Debug/Control HUD) can re-render when plugins register or
|
|
14
|
+
* unregister actions. Insertion order is preserved for stable sorting.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createActionRegistry(): InternalActionRegistry;
|
|
17
|
+
//# sourceMappingURL=action-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-registry.d.ts","sourceRoot":"","sources":["../src/action-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1E;;;;GAIG;AACH,MAAM,WAAW,sBAAuB,SAAQ,cAAc;IAC7D,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,CAAC;CAC5E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,sBAAsB,CAgE7D"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry of declarative, invokable plugin operations ({@link PluginAction}).
|
|
3
|
+
* Mirrors the tool registry's enumerable shape and adds `subscribe` so a generic
|
|
4
|
+
* control surface (the Debug/Control HUD) can re-render when plugins register or
|
|
5
|
+
* unregister actions. Insertion order is preserved for stable sorting.
|
|
6
|
+
*/
|
|
7
|
+
export function createActionRegistry() {
|
|
8
|
+
const actions = new Map();
|
|
9
|
+
const pluginOf = new Map();
|
|
10
|
+
const order = [];
|
|
11
|
+
const listeners = new Set();
|
|
12
|
+
function notify() {
|
|
13
|
+
for (const fn of listeners)
|
|
14
|
+
fn();
|
|
15
|
+
}
|
|
16
|
+
function unregister(id) {
|
|
17
|
+
if (!actions.delete(id))
|
|
18
|
+
return;
|
|
19
|
+
pluginOf.delete(id);
|
|
20
|
+
const i = order.indexOf(id);
|
|
21
|
+
if (i >= 0)
|
|
22
|
+
order.splice(i, 1);
|
|
23
|
+
notify();
|
|
24
|
+
}
|
|
25
|
+
function registerFor(pluginId, action) {
|
|
26
|
+
if (!actions.has(action.id))
|
|
27
|
+
order.push(action.id);
|
|
28
|
+
actions.set(action.id, action);
|
|
29
|
+
pluginOf.set(action.id, pluginId);
|
|
30
|
+
notify();
|
|
31
|
+
// Guard: only remove if THIS registration is still current, so a stale
|
|
32
|
+
// unsubscribe can't clobber a re-registration under the same id.
|
|
33
|
+
return () => {
|
|
34
|
+
if (actions.get(action.id) === action)
|
|
35
|
+
unregister(action.id);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
registerFor,
|
|
40
|
+
register: (action) => registerFor(undefined, action),
|
|
41
|
+
unregister,
|
|
42
|
+
get: (id) => actions.get(id),
|
|
43
|
+
// 内部 Map をそのまま返すと、ReadonlyMap 型でも実行時に型アサーションで
|
|
44
|
+
// 直接 mutate され register/unregister(と notify)を迂回されうる。防御的にコピーを返す。
|
|
45
|
+
getAll: () => new Map(actions),
|
|
46
|
+
getOrdered() {
|
|
47
|
+
// Sort by group (undefined last), then action.order, then registration order.
|
|
48
|
+
const indexed = order.map((id, i) => ({ id, i }));
|
|
49
|
+
indexed.sort((a, b) => {
|
|
50
|
+
const aa = actions.get(a.id);
|
|
51
|
+
const bb = actions.get(b.id);
|
|
52
|
+
if (!aa || !bb)
|
|
53
|
+
return 0;
|
|
54
|
+
const ga = aa.group ?? "";
|
|
55
|
+
const gb = bb.group ?? "";
|
|
56
|
+
if (ga !== gb)
|
|
57
|
+
return ga < gb ? -1 : 1;
|
|
58
|
+
const oa = aa.order ?? 0;
|
|
59
|
+
const ob = bb.order ?? 0;
|
|
60
|
+
if (oa !== ob)
|
|
61
|
+
return oa - ob;
|
|
62
|
+
return a.i - b.i;
|
|
63
|
+
});
|
|
64
|
+
return indexed.map(({ id }) => ({
|
|
65
|
+
id,
|
|
66
|
+
pluginId: pluginOf.get(id),
|
|
67
|
+
action: actions.get(id),
|
|
68
|
+
}));
|
|
69
|
+
},
|
|
70
|
+
subscribe(listener) {
|
|
71
|
+
listeners.add(listener);
|
|
72
|
+
return () => listeners.delete(listener);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=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E,KAAK,EAAE;oBAAE,OAAO,EAAE,GAAG,EAAE,CAAC;gBAC9B,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC,CAAC,CAAC;YACH,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;gBAC/B,EAAE;gBACF,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC1B,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAiB;aACvC,CAAC,CAAC,CAAC;QACL,CAAC;QACD,SAAS,CAAC,QAAoB;YAC7B,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/dist/create-app.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BoardStore, CommandRegistry, EventBus, ExternalContentRegistry, LayerManager, LodPolicy, RenderMode, SelectionForeground, SelectionForegroundRegistry, ShapeRegistry, ShortcutRegistry, ToolRegistry, TransientRegistry, UiRegistry, UsketchPlugin } from "@edv4h/usketch-shared";
|
|
1
|
+
import type { ActionRegistry, BoardStore, CommandRegistry, EventBus, ExternalContentRegistry, HudRegistry, LayerManager, LodPolicy, RenderMode, SelectionForeground, SelectionForegroundRegistry, ServiceRegistry, ShapeRegistry, ShortcutRegistry, ToolRegistry, TransientRegistry, UiRegistry, UsketchPlugin } from "@edv4h/usketch-shared";
|
|
2
2
|
import { type LodControllerInternal } from "./lod/index.js";
|
|
3
3
|
export interface AppInstance {
|
|
4
4
|
store: BoardStore;
|
|
@@ -15,6 +15,12 @@ export interface AppInstance {
|
|
|
15
15
|
selectionForeground: SelectionForegroundRegistry;
|
|
16
16
|
/** Exposed so canvas-engine can dispatch drop/paste content. */
|
|
17
17
|
externalContent: ExternalContentRegistry;
|
|
18
|
+
/** Enumerable declarative plugin operations (control HUD / command palette). */
|
|
19
|
+
actions: ActionRegistry;
|
|
20
|
+
/** Declarative HUD contributions (live settings + custom panels) by plugin. */
|
|
21
|
+
hud: HudRegistry;
|
|
22
|
+
/** String-keyed slot for plugin-provided services (IoC). */
|
|
23
|
+
services: ServiceRegistry;
|
|
18
24
|
plugins: readonly UsketchPlugin[];
|
|
19
25
|
destroy(): void;
|
|
20
26
|
}
|
package/dist/create-app.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../src/create-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,UAAU,EACV,eAAe,EACf,QAAQ,EACR,uBAAuB,EACvB,YAAY,EACZ,SAAS,
|
|
1
|
+
{"version":3,"file":"create-app.d.ts","sourceRoot":"","sources":["../src/create-app.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,cAAc,EACd,UAAU,EACV,eAAe,EACf,QAAQ,EACR,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,SAAS,EAIT,UAAU,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,MAAM,uBAAuB,CAAC;AAO/B,OAAO,EAKN,KAAK,qBAAqB,EAC1B,MAAM,gBAAgB,CAAC;AAYxB,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,YAAY,CAAC;IACrB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,eAAe,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,MAAM,EAAE,QAAQ,CAAC;IACjB,SAAS,EAAE,iBAAiB,CAAC;IAC7B,GAAG,EAAE,qBAAqB,CAAC;IAC3B,EAAE,EAAE,UAAU,CAAC;IACf,kEAAkE;IAClE,mBAAmB,EAAE,2BAA2B,CAAC;IACjD,gEAAgE;IAChE,eAAe,EAAE,uBAAuB,CAAC;IACzC,gFAAgF;IAChF,OAAO,EAAE,cAAc,CAAC;IACxB,+EAA+E;IAC/E,GAAG,EAAE,WAAW,CAAC;IACjB,4DAA4D;IAC5D,QAAQ,EAAE,eAAe,CAAC;IAC1B,OAAO,EAAE,SAAS,aAAa,EAAE,CAAC;IAClC,OAAO,IAAI,IAAI,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAChC,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB;;;OAGG;IACH,GAAG,CAAC,EAAE;QACL,MAAM,CAAC,EAAE,SAAS,CAAC;QACnB,WAAW,CAAC,EAAE,UAAU,CAAC;KACzB,CAAC;IACF;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,QAAQ,CAAC,GACxD,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;CACpE;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CAsK/E"}
|
package/dist/create-app.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
+
import { createActionRegistry } from "./action-registry.js";
|
|
1
2
|
import { createCommandRegistry } from "./command-registry.js";
|
|
2
3
|
import { createEventBus } from "./event-bus.js";
|
|
3
4
|
import { createExternalContentRegistry } from "./external-content-registry.js";
|
|
5
|
+
import { createHudRegistry } from "./hud-registry.js";
|
|
4
6
|
import { createLayerManager } from "./layer-manager.js";
|
|
5
7
|
import { createCompositeLodPolicy, createLodController, createShapeCountLodPolicy, createZoomLodPolicy, } from "./lod/index.js";
|
|
6
8
|
import { createPluginRegistry } from "./plugin-registry.js";
|
|
7
9
|
import { createSelectionForegroundRegistry } from "./selection-foreground-registry.js";
|
|
10
|
+
import { createServiceRegistry } from "./service-registry.js";
|
|
8
11
|
import { createShapeRegistry } from "./shape-registry.js";
|
|
9
12
|
import { createShortcutRegistry } from "./shortcut-registry.js";
|
|
10
13
|
import { createToolRegistry } from "./tool-registry.js";
|
|
@@ -20,6 +23,9 @@ export async function createApp(options) {
|
|
|
20
23
|
const shortcuts = createShortcutRegistry();
|
|
21
24
|
const events = createEventBus();
|
|
22
25
|
const transient = createTransientRegistry();
|
|
26
|
+
const actions = createActionRegistry();
|
|
27
|
+
const hud = createHudRegistry();
|
|
28
|
+
const services = createServiceRegistry();
|
|
23
29
|
const selectionForeground = createSelectionForegroundRegistry();
|
|
24
30
|
const ui = {
|
|
25
31
|
registerSelectionForeground: (entry) => selectionForeground.register(entry),
|
|
@@ -34,13 +40,17 @@ export async function createApp(options) {
|
|
|
34
40
|
const pluginRegistry = createPluginRegistry();
|
|
35
41
|
const lodPolicy = options.lod?.policy ??
|
|
36
42
|
createCompositeLodPolicy([
|
|
37
|
-
createZoomLodPolicy({ enterAt: 0.
|
|
43
|
+
createZoomLodPolicy({ enterAt: 0.25, exitAt: 0.4 }),
|
|
38
44
|
createShapeCountLodPolicy({ enterAt: 1000, exitAt: 800 }),
|
|
39
45
|
]);
|
|
40
46
|
const lod = createLodController({
|
|
41
47
|
policy: lodPolicy,
|
|
42
48
|
initialMode: options.lod?.initialMode ?? "interactive",
|
|
43
49
|
});
|
|
50
|
+
// Read-only view of active plugins (id + name) for UIs that group by plugin.
|
|
51
|
+
const pluginInfo = {
|
|
52
|
+
getAll: () => pluginRegistry.getAll().map((p) => ({ id: p.id, name: p.name })),
|
|
53
|
+
};
|
|
44
54
|
const ctx = {
|
|
45
55
|
store,
|
|
46
56
|
layers,
|
|
@@ -53,6 +63,10 @@ export async function createApp(options) {
|
|
|
53
63
|
lod,
|
|
54
64
|
ui,
|
|
55
65
|
externalContent,
|
|
66
|
+
actions,
|
|
67
|
+
hud,
|
|
68
|
+
plugins: pluginInfo,
|
|
69
|
+
services,
|
|
56
70
|
};
|
|
57
71
|
// Bridge store mutations to EventBus
|
|
58
72
|
const unsubMutation = store.onMutation((event) => {
|
|
@@ -67,7 +81,28 @@ export async function createApp(options) {
|
|
|
67
81
|
try {
|
|
68
82
|
for (const plugin of plugins) {
|
|
69
83
|
pluginRegistry.register(plugin);
|
|
70
|
-
|
|
84
|
+
// Per-plugin scoped context: `actions`/`hud` registrations (including any
|
|
85
|
+
// made later from callbacks) are auto-attributed to this plugin's id.
|
|
86
|
+
// Explicit public-surface wrappers (not `{ ...registry }`) so the internal
|
|
87
|
+
// attribution helpers (registerFor/registerSettingsFor/registerPanelFor)
|
|
88
|
+
// are NOT reachable from a plugin's context, even via `as any`.
|
|
89
|
+
const scopedActions = {
|
|
90
|
+
register: (action) => actions.registerFor(plugin.id, action),
|
|
91
|
+
unregister: actions.unregister,
|
|
92
|
+
get: actions.get,
|
|
93
|
+
getAll: actions.getAll,
|
|
94
|
+
getOrdered: actions.getOrdered,
|
|
95
|
+
subscribe: actions.subscribe,
|
|
96
|
+
};
|
|
97
|
+
const scopedHud = {
|
|
98
|
+
registerSettings: (descriptor) => hud.registerSettingsFor(plugin.id, descriptor),
|
|
99
|
+
registerPanel: (panel) => hud.registerPanelFor(plugin.id, panel),
|
|
100
|
+
getSettings: hud.getSettings,
|
|
101
|
+
getPanels: hud.getPanels,
|
|
102
|
+
subscribe: hud.subscribe,
|
|
103
|
+
};
|
|
104
|
+
const scopedCtx = { ...ctx, actions: scopedActions, hud: scopedHud };
|
|
105
|
+
const teardown = await plugin.setup(scopedCtx);
|
|
71
106
|
if (typeof teardown === "function") {
|
|
72
107
|
teardowns.push(teardown);
|
|
73
108
|
}
|
|
@@ -114,6 +149,9 @@ export async function createApp(options) {
|
|
|
114
149
|
ui,
|
|
115
150
|
selectionForeground,
|
|
116
151
|
externalContent,
|
|
152
|
+
actions,
|
|
153
|
+
hud,
|
|
154
|
+
services,
|
|
117
155
|
plugins: pluginRegistry.getAll(),
|
|
118
156
|
destroy() {
|
|
119
157
|
if (destroyed)
|
package/dist/create-app.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-app.js","sourceRoot":"","sources":["../src/create-app.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-app.js","sourceRoot":"","sources":["../src/create-app.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACN,wBAAwB,EACxB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,GAEnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAElE,gFAAgF;AAChF,MAAM,2BAA2B,GAAG,2BAA2B,CAAC;AAiDhE,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAyB;IACxD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAEnC,MAAM,MAAM,G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CAAC,KAAK,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC;gBACzD,CAAC;YACF,CAAC;YACD,GAAG,CAAC,OAAO,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;QACjB,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { HudPanel, HudRegistry, HudSettingsDescriptor } from "@edv4h/usketch-shared";
|
|
2
|
+
/**
|
|
3
|
+
* Concrete registry type: the public {@link HudRegistry} plus internal
|
|
4
|
+
* `registerSettingsFor`/`registerPanelFor` used by the app to stamp the owning
|
|
5
|
+
* plugin id (see `createApp`'s per-plugin scoped context).
|
|
6
|
+
*/
|
|
7
|
+
export interface InternalHudRegistry extends HudRegistry {
|
|
8
|
+
registerSettingsFor(pluginId: string | undefined, descriptor: HudSettingsDescriptor): () => void;
|
|
9
|
+
registerPanelFor(pluginId: string | undefined, panel: HudPanel): () => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Registry for declarative HUD contributions beyond {@link PluginAction}s: live
|
|
13
|
+
* {@link HudSettingsDescriptor}s and custom {@link HudPanel}s. Entries are
|
|
14
|
+
* attributed to the registering plugin (via the scoped context) so the HUD can
|
|
15
|
+
* render them under that plugin's section. `subscribe` lets the HUD re-render on
|
|
16
|
+
* register/unregister.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createHudRegistry(): InternalHudRegistry;
|
|
19
|
+
//# sourceMappingURL=hud-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hud-registry.d.ts","sourceRoot":"","sources":["../src/hud-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE1F;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACvD,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,qBAAqB,GAAG,MAAM,IAAI,CAAC;IACjG,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,QAAQ,GAAG,MAAM,IAAI,CAAC;CAC5E;AAWD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,IAAI,mBAAmB,CAmEvD"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry for declarative HUD contributions beyond {@link PluginAction}s: live
|
|
3
|
+
* {@link HudSettingsDescriptor}s and custom {@link HudPanel}s. Entries are
|
|
4
|
+
* attributed to the registering plugin (via the scoped context) so the HUD can
|
|
5
|
+
* render them under that plugin's section. `subscribe` lets the HUD re-render on
|
|
6
|
+
* register/unregister.
|
|
7
|
+
*/
|
|
8
|
+
export function createHudRegistry() {
|
|
9
|
+
const settings = new Map();
|
|
10
|
+
const panels = new Map();
|
|
11
|
+
const settingsOrder = [];
|
|
12
|
+
const panelsOrder = [];
|
|
13
|
+
const listeners = new Set();
|
|
14
|
+
function notify() {
|
|
15
|
+
for (const fn of listeners)
|
|
16
|
+
fn();
|
|
17
|
+
}
|
|
18
|
+
function registerSettingsFor(pluginId, descriptor) {
|
|
19
|
+
if (!settings.has(descriptor.id))
|
|
20
|
+
settingsOrder.push(descriptor.id);
|
|
21
|
+
settings.set(descriptor.id, { pluginId, descriptor });
|
|
22
|
+
notify();
|
|
23
|
+
return () => {
|
|
24
|
+
// Guard: only remove if THIS descriptor is still the current one, so a
|
|
25
|
+
// stale unsubscribe can't clobber a re-registration under the same id.
|
|
26
|
+
if (settings.get(descriptor.id)?.descriptor !== descriptor)
|
|
27
|
+
return;
|
|
28
|
+
settings.delete(descriptor.id);
|
|
29
|
+
const i = settingsOrder.indexOf(descriptor.id);
|
|
30
|
+
if (i >= 0)
|
|
31
|
+
settingsOrder.splice(i, 1);
|
|
32
|
+
notify();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function registerPanelFor(pluginId, panel) {
|
|
36
|
+
if (!panels.has(panel.id))
|
|
37
|
+
panelsOrder.push(panel.id);
|
|
38
|
+
panels.set(panel.id, { pluginId, panel });
|
|
39
|
+
notify();
|
|
40
|
+
return () => {
|
|
41
|
+
if (panels.get(panel.id)?.panel !== panel)
|
|
42
|
+
return;
|
|
43
|
+
panels.delete(panel.id);
|
|
44
|
+
const i = panelsOrder.indexOf(panel.id);
|
|
45
|
+
if (i >= 0)
|
|
46
|
+
panelsOrder.splice(i, 1);
|
|
47
|
+
notify();
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return {
|
|
51
|
+
registerSettingsFor,
|
|
52
|
+
registerPanelFor,
|
|
53
|
+
registerSettings: (descriptor) => registerSettingsFor(undefined, descriptor),
|
|
54
|
+
registerPanel: (panel) => registerPanelFor(undefined, panel),
|
|
55
|
+
getSettings() {
|
|
56
|
+
// Sort by `order`, then registration order (explicit tie-break, not relying
|
|
57
|
+
// on Array.sort stability) — mirrors ActionRegistry.getOrdered.
|
|
58
|
+
return settingsOrder
|
|
59
|
+
.map((id, i) => ({ entry: settings.get(id), i }))
|
|
60
|
+
.filter((x) => x.entry !== undefined)
|
|
61
|
+
.sort((a, b) => (a.entry.descriptor.order ?? 0) - (b.entry.descriptor.order ?? 0) || a.i - b.i)
|
|
62
|
+
.map((x) => x.entry);
|
|
63
|
+
},
|
|
64
|
+
getPanels() {
|
|
65
|
+
return panelsOrder
|
|
66
|
+
.map((id, i) => ({ entry: panels.get(id), i }))
|
|
67
|
+
.filter((x) => x.entry !== undefined)
|
|
68
|
+
.sort((a, b) => (a.entry.panel.order ?? 0) - (b.entry.panel.order ?? 0) || a.i - b.i)
|
|
69
|
+
.map((x) => x.entry);
|
|
70
|
+
},
|
|
71
|
+
subscribe(listener) {
|
|
72
|
+
listeners.add(listener);
|
|
73
|
+
return () => listeners.delete(listener);
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=hud-registry.js.map
|
|
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AC,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CACxF;iBACA,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QACD,SAAS;YACR,OAAO,WAAW;iBAChB,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;iBAC9C,MAAM,CAAC,CAAC,CAAC,EAAyC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC;iBAC3E,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;iBACpF,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;QACD,SAAS,CAAC,QAAoB;YAC7B,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,OAAO,GAAG,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QACzC,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { ActionRegistry } from "@edv4h/usketch-shared";
|
|
2
|
+
export declare const createActionRegistry: () => ActionRegistry;
|
|
1
3
|
export { createCommandRegistry } from "./command-registry.js";
|
|
2
4
|
export type { AppInstance, CreateAppOptions } from "./create-app.js";
|
|
3
5
|
export { createApp } from "./create-app.js";
|
|
@@ -8,6 +10,7 @@ export type { CreateLodControllerOptions, LodControllerInternal } from "./lod/in
|
|
|
8
10
|
export { createCompositeLodPolicy, createFpsLodPolicy, createLodController, createShapeCountLodPolicy, createZoomLodPolicy, } from "./lod/index.js";
|
|
9
11
|
export { createPluginRegistry } from "./plugin-registry.js";
|
|
10
12
|
export { createSelectionForegroundRegistry } from "./selection-foreground-registry.js";
|
|
13
|
+
export { createServiceRegistry } from "./service-registry.js";
|
|
11
14
|
export { createShapeRegistry } from "./shape-registry.js";
|
|
12
15
|
export { createShortcutRegistry } from "./shortcut-registry.js";
|
|
13
16
|
export { createToolRegistry } from "./tool-registry.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACxF,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AACvF,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AE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { createActionRegistry as createActionRegistryImpl } from "./action-registry.js";
|
|
2
|
+
// Narrow the public factory to {@link ActionRegistry}: the internal `registerFor`
|
|
3
|
+
// (plugin-id stamping) stays out of the package surface, used only by createApp
|
|
4
|
+
// (which imports the impl directly). `createHudRegistry` is intentionally NOT
|
|
5
|
+
// exported — it's an internal implementation detail of createApp.
|
|
6
|
+
export const createActionRegistry = createActionRegistryImpl;
|
|
1
7
|
export { createCommandRegistry } from "./command-registry.js";
|
|
2
8
|
export { createApp } from "./create-app.js";
|
|
3
9
|
export { createEventBus } from "./event-bus.js";
|
|
@@ -6,6 +12,7 @@ export { createLayerManager } from "./layer-manager.js";
|
|
|
6
12
|
export { createCompositeLodPolicy, createFpsLodPolicy, createLodController, createShapeCountLodPolicy, createZoomLodPolicy, } from "./lod/index.js";
|
|
7
13
|
export { createPluginRegistry } from "./plugin-registry.js";
|
|
8
14
|
export { createSelectionForegroundRegistry } from "./selection-foreground-registry.js";
|
|
15
|
+
export { createServiceRegistry } from "./service-registry.js";
|
|
9
16
|
export { createShapeRegistry } from "./shape-registry.js";
|
|
10
17
|
export { createShortcutRegistry } from "./shortcut-registry.js";
|
|
11
18
|
export { createToolRegistry } from "./tool-registry.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,IAAI,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAExF,kFAAkF;AAClF,gFAAgF;AAChF,8EAA8E;AAC9E,kEAAkE;AAClE,MAAM,CAAC,MAAM,oBAAoB,GAAyB,wBAAwB,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,EACN,wBAAwB,EACxB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/lod/policies.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../src/lod/policies.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,
|
|
1
|
+
{"version":3,"file":"policies.js","sourceRoot":"","sources":["../../src/lod/policies.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,IAAI,GAAsB,EAAE;IAC/D,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,IAAI,GAAG,CAAC;IACpC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,GAAG,CAAC;IAClC,OAAO;QACN,EAAE,EAAE,iBAAiB;QACrB,QAAQ,CAAC,GAAqB;YAC7B,IA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CAAC,CAAC,CAAC,KAAK,CAAC;YACjD,CAAC;YACD,OAAO,GAAG,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,aAAa,CAAC;QAClD,CAAC;KACD,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,QAA8B;IACtE,OAAO;QACN,EAAE,EAAE,sBAAsB;QAC1B,QAAQ,CAAC,GAAqB;YAC7B,IAAI,MAAM,GAAe,aAAa,CAAC;YACvC,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;gBAC1B,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;gBAC1B,IAAI,CAAC,KAAK,KAAK;oBAAE,OAAO,KAAK,CAAC;gBAC9B,IAAI,CAAC,KAAK,UAAU;oBAAE,MAAM,GAAG,UAAU,CAAC;YAC3C,CAAC;YACD,OAAO,MAAM,CAAC;QACf,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../src/plugin-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAgB,oBAAoB;
|
|
1
|
+
{"version":3,"file":"plugin-registry.d.ts","sourceRoot":"","sources":["../src/plugin-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D,wBAAgB,oBAAoB;IAIlC,QAAQ,SAAS,aAAa,GAAG,IAAI;IAIrC,GAAG,KAAK,MAAM,GAAG,aAAa,GAAG,SAAS;IAI1C,MAAM,IAAI,SAAS,aAAa,EAAE;EAInC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ServiceRegistry } from "@edv4h/usketch-shared";
|
|
2
|
+
/**
|
|
3
|
+
* Generic string-keyed service slot (see {@link ServiceRegistry}). The kernel
|
|
4
|
+
* owns no services itself — it just holds the map so a providing plugin and its
|
|
5
|
+
* consumers can rendezvous by key without importing each other. It's a
|
|
6
|
+
* synchronous map, not a lifecycle: a consumer that `get`s during its `setup()`
|
|
7
|
+
* must run after the provider (or handle a missing service).
|
|
8
|
+
*/
|
|
9
|
+
export declare function createServiceRegistry(): ServiceRegistry;
|
|
10
|
+
//# sourceMappingURL=service-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-registry.d.ts","sourceRoot":"","sources":["../src/service-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,eAAe,CAiBvD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic string-keyed service slot (see {@link ServiceRegistry}). The kernel
|
|
3
|
+
* owns no services itself — it just holds the map so a providing plugin and its
|
|
4
|
+
* consumers can rendezvous by key without importing each other. It's a
|
|
5
|
+
* synchronous map, not a lifecycle: a consumer that `get`s during its `setup()`
|
|
6
|
+
* must run after the provider (or handle a missing service).
|
|
7
|
+
*/
|
|
8
|
+
export function createServiceRegistry() {
|
|
9
|
+
const services = new Map();
|
|
10
|
+
return {
|
|
11
|
+
provide(key, service) {
|
|
12
|
+
services.set(key, service);
|
|
13
|
+
// Only remove if still the same instance (a later re-provide wins).
|
|
14
|
+
return () => {
|
|
15
|
+
if (services.get(key) === service)
|
|
16
|
+
services.delete(key);
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
get(key) {
|
|
20
|
+
return services.get(key);
|
|
21
|
+
},
|
|
22
|
+
has(key) {
|
|
23
|
+
return services.has(key);
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=service-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-registry.js","sourceRoot":"","sources":["../src/service-registry.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB;IACpC,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAmB,CAAC;IAC5C,OAAO;QACN,OAAO,CAAC,GAAG,EAAE,OAAO;YACnB,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAC3B,oEAAoE;YACpE,OAAO,GAAG,EAAE;gBACX,IAAI,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,OAAO;oBAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACzD,CAAC,CAAC;QACH,CAAC;QACD,GAAG,CAAI,GAAW;YACjB,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAkB,CAAC;QAC3C,CAAC;QACD,GAAG,CAAC,GAAG;YACN,OAAO,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;KACD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@edv4h/usketch-core",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -12,11 +12,11 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@edv4h/usketch-shared": "4.
|
|
15
|
+
"@edv4h/usketch-shared": "4.6.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"typescript": "
|
|
19
|
-
"vitest": "
|
|
18
|
+
"typescript": "7.0.2",
|
|
19
|
+
"vitest": "4.1.10"
|
|
20
20
|
},
|
|
21
21
|
"publishConfig": {
|
|
22
22
|
"access": "public"
|