@edv4h/usketch-core 1.0.0 → 1.1.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.
@@ -1,4 +1,4 @@
1
- import type { BoardStore, CommandRegistry, EventBus, LayerManager, LodPolicy, RenderMode, ShapeRegistry, ShortcutRegistry, ToolRegistry, TransientRegistry, UsketchPlugin } from "@edv4h/usketch-shared";
1
+ import type { BoardStore, CommandRegistry, EventBus, ExternalContentRegistry, LayerManager, LodPolicy, RenderMode, SelectionForeground, SelectionForegroundRegistry, 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;
@@ -10,6 +10,11 @@ export interface AppInstance {
10
10
  events: EventBus;
11
11
  transient: TransientRegistry;
12
12
  lod: LodControllerInternal;
13
+ ui: UiRegistry;
14
+ /** Exposed so canvas-engine can subscribe to the active entry. */
15
+ selectionForeground: SelectionForegroundRegistry;
16
+ /** Exposed so canvas-engine can dispatch drop/paste content. */
17
+ externalContent: ExternalContentRegistry;
13
18
  plugins: readonly UsketchPlugin[];
14
19
  destroy(): void;
15
20
  }
@@ -24,6 +29,14 @@ export interface CreateAppOptions {
24
29
  policy?: LodPolicy;
25
30
  initialMode?: RenderMode;
26
31
  };
32
+ /**
33
+ * Replace the default selection UI (handles, bounding box, marquee) with
34
+ * a host-provided implementation. Internally registered at priority 100,
35
+ * so it wins over plugin defaults (priority 0) and typical third-party
36
+ * plugin overrides (priority 50 by convention). Pass priority explicitly
37
+ * to override.
38
+ */
39
+ selectionForeground?: Pick<SelectionForeground, "render"> & Partial<Pick<SelectionForeground, "priority" | "order" | "fixed">>;
27
40
  }
28
41
  export declare function createApp(options: CreateAppOptions): Promise<AppInstance>;
29
42
  //# sourceMappingURL=create-app.d.ts.map
@@ -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,YAAY,EACZ,SAAS,EAET,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EAKN,KAAK,qBAAqB,EAC1B,MAAM,gBAAgB,CAAC;AAOxB,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,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;CACF;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,WAAW,CAAC,CA0E/E"}
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,EAET,UAAU,EACV,mBAAmB,EACnB,2BAA2B,EAC3B,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,aAAa,EACb,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAKN,KAAK,qBAAqB,EAC1B,MAAM,gBAAgB,CAAC;AAWxB,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,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,CAuG/E"}
@@ -1,12 +1,16 @@
1
1
  import { createCommandRegistry } from "./command-registry.js";
2
2
  import { createEventBus } from "./event-bus.js";
3
+ import { createExternalContentRegistry } from "./external-content-registry.js";
3
4
  import { createLayerManager } from "./layer-manager.js";
4
5
  import { createCompositeLodPolicy, createLodController, createShapeCountLodPolicy, createZoomLodPolicy, } from "./lod/index.js";
5
6
  import { createPluginRegistry } from "./plugin-registry.js";
7
+ import { createSelectionForegroundRegistry } from "./selection-foreground-registry.js";
6
8
  import { createShapeRegistry } from "./shape-registry.js";
7
9
  import { createShortcutRegistry } from "./shortcut-registry.js";
8
10
  import { createToolRegistry } from "./tool-registry.js";
9
11
  import { createTransientRegistry } from "./transient-registry.js";
12
+ /** Internal id used when `CreateAppOptions.selectionForeground` is provided. */
13
+ const APP_SELECTION_FOREGROUND_ID = "__app:selectionForeground";
10
14
  export async function createApp(options) {
11
15
  const { store, plugins } = options;
12
16
  const layers = createLayerManager();
@@ -16,6 +20,17 @@ export async function createApp(options) {
16
20
  const shortcuts = createShortcutRegistry();
17
21
  const events = createEventBus();
18
22
  const transient = createTransientRegistry();
23
+ const selectionForeground = createSelectionForegroundRegistry();
24
+ const ui = {
25
+ registerSelectionForeground: (entry) => selectionForeground.register(entry),
26
+ };
27
+ const externalContent = createExternalContentRegistry(() => ({
28
+ store,
29
+ shapes,
30
+ commands,
31
+ events,
32
+ externalContent,
33
+ }));
19
34
  const pluginRegistry = createPluginRegistry();
20
35
  const lodPolicy = options.lod?.policy ??
21
36
  createCompositeLodPolicy([
@@ -36,6 +51,8 @@ export async function createApp(options) {
36
51
  events,
37
52
  transient,
38
53
  lod,
54
+ ui,
55
+ externalContent,
39
56
  };
40
57
  // Bridge store mutations to EventBus
41
58
  const unsubMutation = store.onMutation((event) => {
@@ -55,6 +72,18 @@ export async function createApp(options) {
55
72
  // Register core shortcuts
56
73
  shortcuts.register("Ctrl+Z", () => commands.undo());
57
74
  shortcuts.register("Ctrl+Shift+Z", () => commands.redo());
75
+ // App-level selection foreground option is registered AFTER plugin setup
76
+ // so it wins on ties against a plugin that registered priority 100.
77
+ if (options.selectionForeground) {
78
+ const opt = options.selectionForeground;
79
+ selectionForeground.register({
80
+ id: APP_SELECTION_FOREGROUND_ID,
81
+ priority: opt.priority ?? 100,
82
+ order: opt.order ?? 80,
83
+ fixed: opt.fixed ?? true,
84
+ render: opt.render,
85
+ });
86
+ }
58
87
  return {
59
88
  store,
60
89
  layers,
@@ -65,6 +94,9 @@ export async function createApp(options) {
65
94
  events,
66
95
  transient,
67
96
  lod,
97
+ ui,
98
+ selectionForeground,
99
+ externalContent,
68
100
  plugins: pluginRegistry.getAll(),
69
101
  destroy() {
70
102
  for (const plugin of plugins) {
@@ -1 +1 @@
1
- {"version":3,"file":"create-app.js","sourceRoot":"","sources":["../src/create-app.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,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,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;AA6BlE,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAyB;IACxD,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC;IAEnC,MAAM,MAAM,GAAG,kBAAkB,EAAE,CAAC;IACpC,MAAM,KAAK,GAAG,kBAAkB,EAAE,CAAC;IACnC,MAAM,MAAM,GAAG,mBAAmB,EAAE,CAAC;IACrC,MAAM,QAAQ,GAAG,qBAAqB,EAAE,CAAC;IACzC,MAAM,SAAS,GAAG,sBAAsB,EAAE,CAA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ACJ,CAAC;IAED,OAAO;QACN,KAAK;QACL,MAAM;QACN,KAAK;QACL,MAAM;QACN,QAAQ;QACR,SAAS;QACT,MAAM;QACN,SAAS;QACT,GAAG;QACH,EAAE;QACF,mBAAmB;QACnB,eAAe;QACf,OAAO,EAAE,cAAc,CAAC,MAAM,EAAE;QAChC,OAAO;YACN,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;gBAC9B,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;YACrB,CAAC;YACD,GAAG,CAAC,OAAO,EAAE,CAAC;YACd,aAAa,EAAE,CAAC;QACjB,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../src/event-bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,wBAAgB,cAAc,IAAI,QAAQ,CAyBzC"}
1
+ {"version":3,"file":"event-bus.d.ts","sourceRoot":"","sources":["../src/event-bus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,wBAAgB,cAAc,IAAI,QAAQ,CA6CzC"}
package/dist/event-bus.js CHANGED
@@ -1,5 +1,8 @@
1
1
  export function createEventBus() {
2
2
  const listeners = new Map();
3
+ // Ref-counted so independent callers can nest pause/resume without one
4
+ // accidentally re-enabling delivery for the other.
5
+ let pauseDepth = 0;
3
6
  return {
4
7
  on(event, handler) {
5
8
  if (!listeners.has(event)) {
@@ -13,6 +16,8 @@ export function createEventBus() {
13
16
  };
14
17
  },
15
18
  emit(event, data) {
19
+ if (pauseDepth > 0)
20
+ return;
16
21
  const handlers = listeners.get(event);
17
22
  if (handlers) {
18
23
  for (const handler of handlers) {
@@ -20,6 +25,19 @@ export function createEventBus() {
20
25
  }
21
26
  }
22
27
  },
28
+ pause() {
29
+ pauseDepth++;
30
+ },
31
+ resume() {
32
+ if (pauseDepth === 0) {
33
+ console.warn("[EventBus] resume() called without a matching pause(); ignoring.");
34
+ return;
35
+ }
36
+ pauseDepth--;
37
+ },
38
+ isPaused() {
39
+ return pauseDepth > 0;
40
+ },
23
41
  };
24
42
  }
25
43
  //# sourceMappingURL=event-bus.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../src/event-bus.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc;IAC7B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;IAElE,OAAO;QACN,EAAE,CAAc,KAAa,EAAE,OAA0B;YACxD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3B,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;YACjC,CAAC;YACD,8EAA8E;YAC9E,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;YACvC,QAAQ,CAAC,GAAG,CAAC,OAAkC,CAAC,CAAC;YACjD,OAAO,GAAG,EAAE;gBACX,QAAQ,CAAC,MAAM,CAAC,OAAkC,CAAC,CAAC;YACrD,CAAC,CAAC;QACH,CAAC;QAED,IAAI,CAAc,KAAa,EAAE,IAAO;YACvC,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACtC,IAAI,QAAQ,EAAE,CAAC;gBACd,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;oBAChC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACf,CAAC;YACF,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"event-bus.js","sourceRoot":"","sources":["../src/event-bus.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc;IAC7B,MAAM,SAAS,GAAG,IAAI,GAAG,EAAwC,CAAC;IAClE,uEAAuE;IACvE,mDAAmD;IACnD,IAAI,UAAU,GAAG,CAAC,CAAC;IAEnB,OAAO;QACN,EAAE,CAAc,KAAa,EAAE,OAA0B;YACxD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3B,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;YACjC,CAAC;YACD,8EAA8E;YAC9E,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC;YACvC,QAAQ,CAAC,GAAG,CAAC,OAAkC,CAAC,CAAC;YACjD,OAAO,GAAG,EAAE;gBACX,QAAQ,CAAC,MAAM,CAAC,OAAkC,CAAC,CAAC;YACrD,CAAC,CAAC;QACH,CAAC;QAED,IAAI,CAAc,KAAa,EAAE,IAAO;YACvC,IAAI,UAAU,GAAG,CAAC;gBAAE,OAAO;YAC3B,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACtC,IAAI,QAAQ,EAAE,CAAC;gBACd,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;oBAChC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACf,CAAC;YACF,CAAC;QACF,CAAC;QAED,KAAK;YACJ,UAAU,EAAE,CAAC;QACd,CAAC;QAED,MAAM;YACL,IAAI,UAAU,KAAK,CAAC,EAAE,CAAC;gBACtB,OAAO,CAAC,IAAI,CAAC,kEAAkE,CAAC,CAAC;gBACjF,OAAO;YACR,CAAC;YACD,UAAU,EAAE,CAAC;QACd,CAAC;QAED,QAAQ;YACP,OAAO,UAAU,GAAG,CAAC,CAAC;QACvB,CAAC;KACD,CAAC;AACH,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { ExternalContentHandlerCtx, ExternalContentRegistry } from "@edv4h/usketch-shared";
2
+ /**
3
+ * Registry for external-content handlers (drop / paste / URL).
4
+ *
5
+ * Resolution rules (mirror {@link createSelectionForegroundRegistry}):
6
+ * - Filter by `kind`.
7
+ * - Call each handler's `match`. Errors thrown by `match` are caught, logged
8
+ * via `console.error`, and treated as `false` so one misbehaving handler
9
+ * can't poison the rest of the registry.
10
+ * - Among matching handlers, the highest `order` wins (default `0`).
11
+ * On ties the most-recently-registered handler wins (last-wins).
12
+ * - Re-registering the same `id` replaces the previous entry and bumps it
13
+ * to the end of insertion order (so the new entry wins on tie).
14
+ * - Exactly one handler's `handle` runs per dispatch (single-winner). If it
15
+ * throws or rejects the error is logged and the dispatch ends — the
16
+ * next-best handler is NOT tried, mirroring tldraw's `registerExternalContentHandler`.
17
+ *
18
+ * The handler context is built on each dispatch via `buildCtx`, so handlers
19
+ * always see the host's current `store` / `commands` / etc.
20
+ */
21
+ export declare function createExternalContentRegistry(buildCtx: () => ExternalContentHandlerCtx): ExternalContentRegistry;
22
+ //# sourceMappingURL=external-content-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-content-registry.d.ts","sourceRoot":"","sources":["../src/external-content-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,yBAAyB,EAEzB,uBAAuB,EACvB,MAAM,uBAAuB,CAAC;AAE/B;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,6BAA6B,CAC5C,QAAQ,EAAE,MAAM,yBAAyB,GACvC,uBAAuB,CAyDzB"}
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Registry for external-content handlers (drop / paste / URL).
3
+ *
4
+ * Resolution rules (mirror {@link createSelectionForegroundRegistry}):
5
+ * - Filter by `kind`.
6
+ * - Call each handler's `match`. Errors thrown by `match` are caught, logged
7
+ * via `console.error`, and treated as `false` so one misbehaving handler
8
+ * can't poison the rest of the registry.
9
+ * - Among matching handlers, the highest `order` wins (default `0`).
10
+ * On ties the most-recently-registered handler wins (last-wins).
11
+ * - Re-registering the same `id` replaces the previous entry and bumps it
12
+ * to the end of insertion order (so the new entry wins on tie).
13
+ * - Exactly one handler's `handle` runs per dispatch (single-winner). If it
14
+ * throws or rejects the error is logged and the dispatch ends — the
15
+ * next-best handler is NOT tried, mirroring tldraw's `registerExternalContentHandler`.
16
+ *
17
+ * The handler context is built on each dispatch via `buildCtx`, so handlers
18
+ * always see the host's current `store` / `commands` / etc.
19
+ */
20
+ export function createExternalContentRegistry(buildCtx) {
21
+ const handlers = new Map();
22
+ function pickWinner(content, ctx) {
23
+ let winner = null;
24
+ for (const h of handlers.values()) {
25
+ if (h.kind !== content.kind)
26
+ continue;
27
+ let matched = false;
28
+ try {
29
+ matched = h.match(content, ctx);
30
+ }
31
+ catch (err) {
32
+ console.error(`[usketch] external-content handler ${h.id}.match threw:`, err);
33
+ continue;
34
+ }
35
+ if (!matched)
36
+ continue;
37
+ const winnerOrder = winner?.order ?? 0;
38
+ const currentOrder = h.order ?? 0;
39
+ if (!winner || currentOrder >= winnerOrder)
40
+ winner = h;
41
+ }
42
+ return winner;
43
+ }
44
+ return {
45
+ register(handler) {
46
+ const entry = handler;
47
+ handlers.delete(entry.id);
48
+ handlers.set(entry.id, entry);
49
+ return () => {
50
+ if (handlers.get(entry.id) === entry) {
51
+ handlers.delete(entry.id);
52
+ }
53
+ };
54
+ },
55
+ unregister(id) {
56
+ handlers.delete(id);
57
+ },
58
+ async dispatch(content) {
59
+ const ctx = buildCtx();
60
+ const winner = pickWinner(content, ctx);
61
+ if (!winner)
62
+ return false;
63
+ try {
64
+ await winner.handle(content, ctx);
65
+ }
66
+ catch (err) {
67
+ console.error(`[usketch] external-content handler ${winner.id}.handle threw:`, err);
68
+ }
69
+ return true;
70
+ },
71
+ getHandlers() {
72
+ return Array.from(handlers.values());
73
+ },
74
+ };
75
+ }
76
+ //# sourceMappingURL=external-content-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-content-registry.js","sourceRoot":"","sources":["../src/external-content-registry.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,6BAA6B,CAC5C,QAAyC;IAEzC,MAAM,QAAQ,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CAAC;QAED,UAAU,CAAC,EAAE;YACZ,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACrB,CAAC;QAED,KAAK,CAAC,QAAQ,CAAC,OAAO;YACrB,MAAM,GAAG,GAAG,QAAQ,EAAE,CAAC;YACvB,MAAM,MAAM,GAAG,UAAU,CAAC,OAA0B,EAAE,GAAG,CAAC,CAAC;YAC3D,IAAI,CAAC,MAAM;gBAAE,OAAO,KAAK,CAAC;YAC1B,IAAI,CAAC;gBACJ,MAAM,MAAM,CAAC,MAAM,CAAC,OAAgD,EAAE,GAAG,CAAC,CAAC;YAC5E,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,KAAK,CAAC,sCAAsC,MAAM,CAAC,EAAE,gBAAgB,EAAE,GAAG,CAAC,CAAC;YACrF,CAAC;YACD,OAAO,IAAI,CAAC;QACb,CAAC;QAED,WAAW;YACV,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACtC,CAAC;KACD,CAAC;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,10 +2,12 @@ export { createCommandRegistry } from "./command-registry.js";
2
2
  export type { AppInstance, CreateAppOptions } from "./create-app.js";
3
3
  export { createApp } from "./create-app.js";
4
4
  export { createEventBus } from "./event-bus.js";
5
+ export { createExternalContentRegistry } from "./external-content-registry.js";
5
6
  export { createLayerManager } from "./layer-manager.js";
6
7
  export type { CreateLodControllerOptions, LodControllerInternal } from "./lod/index.js";
7
8
  export { createCompositeLodPolicy, createFpsLodPolicy, createLodController, createShapeCountLodPolicy, createZoomLodPolicy, } from "./lod/index.js";
8
9
  export { createPluginRegistry } from "./plugin-registry.js";
10
+ export { createSelectionForegroundRegistry } from "./selection-foreground-registry.js";
9
11
  export { createShapeRegistry } from "./shape-registry.js";
10
12
  export { createShortcutRegistry } from "./shortcut-registry.js";
11
13
  export { createToolRegistry } from "./tool-registry.js";
@@ -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,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,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"}
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,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/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  export { createCommandRegistry } from "./command-registry.js";
2
2
  export { createApp } from "./create-app.js";
3
3
  export { createEventBus } from "./event-bus.js";
4
+ export { createExternalContentRegistry } from "./external-content-registry.js";
4
5
  export { createLayerManager } from "./layer-manager.js";
5
6
  export { createCompositeLodPolicy, createFpsLodPolicy, createLodController, createShapeCountLodPolicy, createZoomLodPolicy, } from "./lod/index.js";
6
7
  export { createPluginRegistry } from "./plugin-registry.js";
8
+ export { createSelectionForegroundRegistry } from "./selection-foreground-registry.js";
7
9
  export { createShapeRegistry } from "./shape-registry.js";
8
10
  export { createShortcutRegistry } from "./shortcut-registry.js";
9
11
  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":"AAAA,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,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,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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,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,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"}
@@ -0,0 +1,15 @@
1
+ import type { SelectionForegroundRegistry } from "@edv4h/usketch-shared";
2
+ /**
3
+ * Registry for the canvas selection foreground (handles, bounding box, marquee).
4
+ *
5
+ * Resolution rules:
6
+ * - Higher `priority` wins.
7
+ * - On ties, the most-recently-registered entry wins (last-wins).
8
+ * - Re-registering the same `id` replaces the previous entry and bumps it to
9
+ * the end of insertion order (so the new entry wins on tie).
10
+ *
11
+ * Listeners registered via `subscribe` are notified only when the active
12
+ * entry actually changes (by referential identity).
13
+ */
14
+ export declare function createSelectionForegroundRegistry(): SelectionForegroundRegistry;
15
+ //# sourceMappingURL=selection-foreground-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection-foreground-registry.d.ts","sourceRoot":"","sources":["../src/selection-foreground-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAuB,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAE9F;;;;;;;;;;;GAWG;AACH,wBAAgB,iCAAiC,IAAI,2BAA2B,CAgD/E"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Registry for the canvas selection foreground (handles, bounding box, marquee).
3
+ *
4
+ * Resolution rules:
5
+ * - Higher `priority` wins.
6
+ * - On ties, the most-recently-registered entry wins (last-wins).
7
+ * - Re-registering the same `id` replaces the previous entry and bumps it to
8
+ * the end of insertion order (so the new entry wins on tie).
9
+ *
10
+ * Listeners registered via `subscribe` are notified only when the active
11
+ * entry actually changes (by referential identity).
12
+ */
13
+ export function createSelectionForegroundRegistry() {
14
+ const entries = new Map();
15
+ const listeners = new Set();
16
+ let active = null;
17
+ function computeActive() {
18
+ let winner = null;
19
+ for (const e of entries.values()) {
20
+ if (!winner || e.priority >= winner.priority)
21
+ winner = e;
22
+ }
23
+ return winner;
24
+ }
25
+ function refreshActive() {
26
+ const next = computeActive();
27
+ if (next === active)
28
+ return;
29
+ active = next;
30
+ for (const l of listeners)
31
+ l();
32
+ }
33
+ return {
34
+ register(entry) {
35
+ entries.delete(entry.id);
36
+ entries.set(entry.id, entry);
37
+ refreshActive();
38
+ return () => {
39
+ if (entries.get(entry.id) === entry) {
40
+ entries.delete(entry.id);
41
+ refreshActive();
42
+ }
43
+ };
44
+ },
45
+ unregister(id) {
46
+ if (entries.delete(id))
47
+ refreshActive();
48
+ },
49
+ getActive() {
50
+ return active;
51
+ },
52
+ subscribe(listener) {
53
+ listeners.add(listener);
54
+ return () => {
55
+ listeners.delete(listener);
56
+ };
57
+ },
58
+ };
59
+ }
60
+ //# sourceMappingURL=selection-foreground-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selection-foreground-registry.js","sourceRoot":"","sources":["../src/selection-foreground-registry.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,iCAAiC;IAChD,MAAM,OAAO,GAAG,IAAI,GAAG,EAA+B,CAAC;IACvD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;IACxC,IAAI,MAAM,GAA+B,IAAI,CAAC;IAE9C,SAAS,aAAa;QACrB,IAAI,MAAM,GAA+B,IAAI,CAAC;QAC9C,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ;gBAAE,MAAM,GAAG,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,MAAM,CAAC;IACf,CAAC;IAED,SAAS,aAAa;QACrB,MAAM,IAAI,GAAG,aAAa,EAAE,CAAC;QAC7B,IAAI,IAAI,KAAK,MAAM;YAAE,OAAO;QAC5B,MAAM,GAAG,IAAI,CAAC;QACd,KAAK,MAAM,CAAC,IAAI,SAAS;YAAE,CAAC,EAAE,CAAC;IAChC,CAAC;IAED,OAAO;QACN,QAAQ,CAAC,KAAK;YACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YACzB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;YAC7B,aAAa,EAAE,CAAC;YAChB,OAAO,GAAG,EAAE;gBACX,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC;oBACrC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;oBACzB,aAAa,EAAE,CAAC;gBACjB,CAAC;YACF,CAAC,CAAC;QACH,CAAC;QAED,UAAU,CAAC,EAAE;YACZ,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;gBAAE,aAAa,EAAE,CAAC;QACzC,CAAC;QAED,SAAS;YACR,OAAO,MAAM,CAAC;QACf,CAAC;QAED,SAAS,CAAC,QAAQ;YACjB,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YACxB,OAAO,GAAG,EAAE;gBACX,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5B,CAAC,CAAC;QACH,CAAC;KACD,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edv4h/usketch-core",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -12,7 +12,7 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@edv4h/usketch-shared": "1.0.0"
15
+ "@edv4h/usketch-shared": "2.0.0"
16
16
  },
17
17
  "devDependencies": {
18
18
  "typescript": "5.9.3",