@aiaiai-pt/design-system 0.48.0 → 0.49.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,23 +1,31 @@
1
1
  /**
2
- * Widget dispatcher — tester/priority, not a flat map (D4, JSONForms model).
2
+ * Widget dispatcher — COMPATIBILITY ADAPTER over @aiaiai-pt/widget-system/core.
3
3
  *
4
- * Generalises the admin app's XSS-hardened layout registry
5
- * (`admin/src/lib/renderer-layouts/resolve.ts`) from form-row LayoutKeys to
6
- * widget `kind`s. Each entry carries a `tester(binding, schema) → score`; the
7
- * highest score wins. A more specific tester (e.g. "list of `occurrence`")
8
- * outranks the generic "any list" and overrides one widget for one entity
9
- * WITHOUT editing the catalog (open/closed).
4
+ * @deprecated Import the generic dispatch from `@aiaiai-pt/widget-system/core`
5
+ * instead. This module is the S2 (#60) compatibility shim: it preserves the
6
+ * Atelier-shaped `@aiaiai-pt/design-system/renderer/dispatch` import surface for
7
+ * one migration window while the ranking ALGORITHM lives in exactly one place —
8
+ * `@aiaiai-pt/widget-system/core`. Scheduled for removal in the next MAJOR of
9
+ * `@aiaiai-pt/design-system` (S3). See `docs/migration/widget-system.md`.
10
10
  *
11
- * The ranking core here is generic over the payload `P` so it stays
12
- * component-free and fully unit/mutation-testable; the real registry (73b)
13
- * instantiates it with Svelte `Component`s.
11
+ * Classification (#60 AC5): the tester/priority ranking loop is a GENERIC
12
+ * widget-system API it is delegated below and NOT reimplemented here. The
13
+ * `(binding, schema, type)` tester SIGNATURE is ATELIER-COUPLED (it names
14
+ * `Binding`/`OntologySchema`/`Block` from ./types) and stays here as a thin
15
+ * adapter until consumers migrate to the ctx-shaped `WidgetMatchContext`.
14
16
  *
15
- * TH-08 (R-SEC-07) preserved: the resolved `key` is a known-good literal from
16
- * the matched entry — the operator's raw `binding.kind`/`entity`/block `type`
17
- * is NEVER returned as the key, so it never reaches `class`/`data-*`/`style`.
17
+ * TH-08 (R-SEC-07) preserved end-to-end: `core.selectEntry` returns the matched
18
+ * entry's known-good `key` literal — the operator's raw `binding.kind`/`type`
19
+ * is never returned as the key, so it never reaches `class`/`data-*`/`style`.
18
20
  */
21
+ import { type Match as CoreMatch, type RenderDecision as CoreRenderDecision } from "@aiaiai-pt/widget-system/core";
19
22
  import type { Binding, Block, OntologySchema } from "./types";
20
- /** Tester sentinel — "this widget does not apply to this binding". */
23
+ /**
24
+ * Tester sentinel — "this widget does not apply to this binding".
25
+ *
26
+ * @deprecated Re-exported from `@aiaiai-pt/widget-system/core`. Import it from
27
+ * there directly.
28
+ */
21
29
  export declare const NOT_APPLICABLE = -1;
22
30
  /**
23
31
  * A tester ranks a registry entry against a binding (+ optional schema and the
@@ -26,38 +34,67 @@ export declare const NOT_APPLICABLE = -1;
26
34
  * generic kind widget (`entity-list`) for the SAME `binding.kind` without
27
35
  * editing the kind entry. `type` is UNTRUSTED — it only influences ranking; the
28
36
  * resolved `key` still comes from the matched entry (TH-08), never from `type`.
37
+ *
38
+ * @deprecated ATELIER-COUPLED signature. The generic tester in
39
+ * `@aiaiai-pt/widget-system/core` is `(ctx: WidgetMatchContext) => number`.
40
+ * Migrate custom testers to read `ctx.kind`/`ctx.type` from a match context.
29
41
  */
30
42
  export type WidgetTester = (binding: Binding, schema: OntologySchema | null, type?: string) => number;
43
+ /**
44
+ * @deprecated ATELIER-COUPLED entry shape (its `tester` names `Binding`). The
45
+ * generic entry lives in `@aiaiai-pt/widget-system/core` as
46
+ * `RegistryEntry<P, Ctx>`.
47
+ */
31
48
  export interface RegistryEntry<P> {
32
49
  /** Known-good literal. Safe to render as `data-widget={key}` (TH-08). */
33
50
  key: string;
34
51
  payload: P;
35
52
  tester: WidgetTester;
36
53
  }
37
- export interface Match<P> {
38
- key: string;
39
- payload: P;
40
- }
54
+ /**
55
+ * The matched entry. Structurally identical to
56
+ * `@aiaiai-pt/widget-system/core`'s `Match<P>` — re-exported so consumers can
57
+ * migrate the import without a type change.
58
+ *
59
+ * @deprecated Import `Match` from `@aiaiai-pt/widget-system/core`.
60
+ */
61
+ export type Match<P> = CoreMatch<P>;
62
+ /**
63
+ * The render decision. Structurally identical to
64
+ * `@aiaiai-pt/widget-system/core`'s `RenderDecision`.
65
+ *
66
+ * @deprecated Import `RenderDecision` from `@aiaiai-pt/widget-system/core`.
67
+ */
68
+ export type RenderDecision = CoreRenderDecision;
41
69
  /**
42
70
  * Run every tester against the binding; the highest applicable score wins.
43
71
  * Ties resolve to the first-registered entry (stable, deterministic). Returns
44
- * `null` when no tester is applicable — the caller fails closed per blast
45
- * radius; nothing about the binding is interpolated.
72
+ * `null` when no tester is applicable.
73
+ *
74
+ * DELEGATION (#60): the ranking loop is NOT implemented here. Each
75
+ * Atelier-shaped entry is adapted into a `core.RegistryEntry` whose tester
76
+ * closes over `(binding, schema, type)` — so the full `(binding, schema, type)`
77
+ * tester contract (including `schema`, which the ctx model omits) is preserved
78
+ * — and the loop itself runs in `@aiaiai-pt/widget-system/core.selectEntry`.
79
+ * The `ctx` handed to core is a formality: core invokes `tester(ctx)` once per
80
+ * entry, and our adapted tester ignores it in favour of the closed-over args.
81
+ *
82
+ * @deprecated Use `selectEntry(entries, ctx)` from
83
+ * `@aiaiai-pt/widget-system/core` with `ctx: WidgetMatchContext`.
46
84
  */
47
85
  export declare function selectEntry<P>(entries: ReadonlyArray<RegistryEntry<P>>, binding: Binding, schema: OntologySchema | null, type?: string): Match<P> | null;
48
- export type RenderDecision = {
49
- render: "widget";
50
- } | {
51
- render: "empty";
52
- } | {
53
- render: "error";
54
- };
55
86
  /**
56
87
  * Fail-closed per blast radius (§14.8). Given whether a widget matched AND
57
88
  * whether its data resolved, decide how the slot renders:
58
89
  * - matched + data ok → render the widget
59
90
  * - failed, optional slot → soft-empty (render nothing)
60
91
  * - failed, structural slot → visible error (MUST NOT silently vanish)
61
- * The operator's raw `type`/`kind` is never interpolated in any branch.
92
+ *
93
+ * DELEGATION (#60): the decision is `@aiaiai-pt/widget-system/core.decideRender`;
94
+ * this adapter only projects the Atelier `Block.importance` field onto the
95
+ * generic `importance` argument.
96
+ *
97
+ * @deprecated Use `decideRender(importance, matched, dataOk)` from
98
+ * `@aiaiai-pt/widget-system/core`, passing `block.importance` directly.
62
99
  */
63
100
  export declare function decideRender(block: Pick<Block, "importance">, matched: boolean, dataOk: boolean): RenderDecision;
@@ -1,25 +1,39 @@
1
1
  /**
2
- * Widget dispatcher — tester/priority, not a flat map (D4, JSONForms model).
2
+ * Widget dispatcher — COMPATIBILITY ADAPTER over @aiaiai-pt/widget-system/core.
3
3
  *
4
- * Generalises the admin app's XSS-hardened layout registry
5
- * (`admin/src/lib/renderer-layouts/resolve.ts`) from form-row LayoutKeys to
6
- * widget `kind`s. Each entry carries a `tester(binding, schema) → score`; the
7
- * highest score wins. A more specific tester (e.g. "list of `occurrence`")
8
- * outranks the generic "any list" and overrides one widget for one entity
9
- * WITHOUT editing the catalog (open/closed).
4
+ * @deprecated Import the generic dispatch from `@aiaiai-pt/widget-system/core`
5
+ * instead. This module is the S2 (#60) compatibility shim: it preserves the
6
+ * Atelier-shaped `@aiaiai-pt/design-system/renderer/dispatch` import surface for
7
+ * one migration window while the ranking ALGORITHM lives in exactly one place —
8
+ * `@aiaiai-pt/widget-system/core`. Scheduled for removal in the next MAJOR of
9
+ * `@aiaiai-pt/design-system` (S3). See `docs/migration/widget-system.md`.
10
10
  *
11
- * The ranking core here is generic over the payload `P` so it stays
12
- * component-free and fully unit/mutation-testable; the real registry (73b)
13
- * instantiates it with Svelte `Component`s.
11
+ * Classification (#60 AC5): the tester/priority ranking loop is a GENERIC
12
+ * widget-system API it is delegated below and NOT reimplemented here. The
13
+ * `(binding, schema, type)` tester SIGNATURE is ATELIER-COUPLED (it names
14
+ * `Binding`/`OntologySchema`/`Block` from ./types) and stays here as a thin
15
+ * adapter until consumers migrate to the ctx-shaped `WidgetMatchContext`.
14
16
  *
15
- * TH-08 (R-SEC-07) preserved: the resolved `key` is a known-good literal from
16
- * the matched entry — the operator's raw `binding.kind`/`entity`/block `type`
17
- * is NEVER returned as the key, so it never reaches `class`/`data-*`/`style`.
17
+ * TH-08 (R-SEC-07) preserved end-to-end: `core.selectEntry` returns the matched
18
+ * entry's known-good `key` literal — the operator's raw `binding.kind`/`type`
19
+ * is never returned as the key, so it never reaches `class`/`data-*`/`style`.
18
20
  */
21
+ import {
22
+ decideRender as coreDecideRender,
23
+ NOT_APPLICABLE as CORE_NOT_APPLICABLE,
24
+ selectEntry as coreSelectEntry,
25
+ type Match as CoreMatch,
26
+ type RenderDecision as CoreRenderDecision,
27
+ } from "@aiaiai-pt/widget-system/core";
19
28
  import type { Binding, Block, OntologySchema } from "./types";
20
29
 
21
- /** Tester sentinel — "this widget does not apply to this binding". */
22
- export const NOT_APPLICABLE = -1;
30
+ /**
31
+ * Tester sentinel — "this widget does not apply to this binding".
32
+ *
33
+ * @deprecated Re-exported from `@aiaiai-pt/widget-system/core`. Import it from
34
+ * there directly.
35
+ */
36
+ export const NOT_APPLICABLE = CORE_NOT_APPLICABLE;
23
37
 
24
38
  /**
25
39
  * A tester ranks a registry entry against a binding (+ optional schema and the
@@ -28,6 +42,10 @@ export const NOT_APPLICABLE = -1;
28
42
  * generic kind widget (`entity-list`) for the SAME `binding.kind` without
29
43
  * editing the kind entry. `type` is UNTRUSTED — it only influences ranking; the
30
44
  * resolved `key` still comes from the matched entry (TH-08), never from `type`.
45
+ *
46
+ * @deprecated ATELIER-COUPLED signature. The generic tester in
47
+ * `@aiaiai-pt/widget-system/core` is `(ctx: WidgetMatchContext) => number`.
48
+ * Migrate custom testers to read `ctx.kind`/`ctx.type` from a match context.
31
49
  */
32
50
  export type WidgetTester = (
33
51
  binding: Binding,
@@ -35,6 +53,11 @@ export type WidgetTester = (
35
53
  type?: string,
36
54
  ) => number;
37
55
 
56
+ /**
57
+ * @deprecated ATELIER-COUPLED entry shape (its `tester` names `Binding`). The
58
+ * generic entry lives in `@aiaiai-pt/widget-system/core` as
59
+ * `RegistryEntry<P, Ctx>`.
60
+ */
38
61
  export interface RegistryEntry<P> {
39
62
  /** Known-good literal. Safe to render as `data-widget={key}` (TH-08). */
40
63
  key: string;
@@ -42,16 +65,38 @@ export interface RegistryEntry<P> {
42
65
  tester: WidgetTester;
43
66
  }
44
67
 
45
- export interface Match<P> {
46
- key: string;
47
- payload: P;
48
- }
68
+ /**
69
+ * The matched entry. Structurally identical to
70
+ * `@aiaiai-pt/widget-system/core`'s `Match<P>` — re-exported so consumers can
71
+ * migrate the import without a type change.
72
+ *
73
+ * @deprecated Import `Match` from `@aiaiai-pt/widget-system/core`.
74
+ */
75
+ export type Match<P> = CoreMatch<P>;
76
+
77
+ /**
78
+ * The render decision. Structurally identical to
79
+ * `@aiaiai-pt/widget-system/core`'s `RenderDecision`.
80
+ *
81
+ * @deprecated Import `RenderDecision` from `@aiaiai-pt/widget-system/core`.
82
+ */
83
+ export type RenderDecision = CoreRenderDecision;
49
84
 
50
85
  /**
51
86
  * Run every tester against the binding; the highest applicable score wins.
52
87
  * Ties resolve to the first-registered entry (stable, deterministic). Returns
53
- * `null` when no tester is applicable — the caller fails closed per blast
54
- * radius; nothing about the binding is interpolated.
88
+ * `null` when no tester is applicable.
89
+ *
90
+ * DELEGATION (#60): the ranking loop is NOT implemented here. Each
91
+ * Atelier-shaped entry is adapted into a `core.RegistryEntry` whose tester
92
+ * closes over `(binding, schema, type)` — so the full `(binding, schema, type)`
93
+ * tester contract (including `schema`, which the ctx model omits) is preserved
94
+ * — and the loop itself runs in `@aiaiai-pt/widget-system/core.selectEntry`.
95
+ * The `ctx` handed to core is a formality: core invokes `tester(ctx)` once per
96
+ * entry, and our adapted tester ignores it in favour of the closed-over args.
97
+ *
98
+ * @deprecated Use `selectEntry(entries, ctx)` from
99
+ * `@aiaiai-pt/widget-system/core` with `ctx: WidgetMatchContext`.
55
100
  */
56
101
  export function selectEntry<P>(
57
102
  entries: ReadonlyArray<RegistryEntry<P>>,
@@ -59,41 +104,35 @@ export function selectEntry<P>(
59
104
  schema: OntologySchema | null,
60
105
  type?: string,
61
106
  ): Match<P> | null {
62
- let best: RegistryEntry<P> | null = null;
63
- let bestScore: number = NOT_APPLICABLE;
64
- for (const entry of entries) {
65
- const score = entry.tester(binding, schema, type);
66
- // Strictly greater first registered wins ties.
67
- if (score > bestScore) {
68
- bestScore = score;
69
- best = entry;
70
- }
71
- }
72
- if (best === null) return null;
73
- // TH-08: key from the matched entry, never from the binding/block.
74
- return { key: best.key, payload: best.payload };
107
+ const ctx = { kind: binding.kind, type };
108
+ const adapted = entries.map((entry) => ({
109
+ key: entry.key,
110
+ payload: entry.payload,
111
+ // Close over the Atelier-shaped selection inputs; core supplies `ctx` but
112
+ // this adapter reads the richer (binding, schema, type) triple instead.
113
+ tester: () => entry.tester(binding, schema, type),
114
+ }));
115
+ return coreSelectEntry(adapted, ctx);
75
116
  }
76
117
 
77
- export type RenderDecision =
78
- | { render: "widget" }
79
- | { render: "empty" }
80
- | { render: "error" };
81
-
82
118
  /**
83
119
  * Fail-closed per blast radius (§14.8). Given whether a widget matched AND
84
120
  * whether its data resolved, decide how the slot renders:
85
121
  * - matched + data ok → render the widget
86
122
  * - failed, optional slot → soft-empty (render nothing)
87
123
  * - failed, structural slot → visible error (MUST NOT silently vanish)
88
- * The operator's raw `type`/`kind` is never interpolated in any branch.
124
+ *
125
+ * DELEGATION (#60): the decision is `@aiaiai-pt/widget-system/core.decideRender`;
126
+ * this adapter only projects the Atelier `Block.importance` field onto the
127
+ * generic `importance` argument.
128
+ *
129
+ * @deprecated Use `decideRender(importance, matched, dataOk)` from
130
+ * `@aiaiai-pt/widget-system/core`, passing `block.importance` directly.
89
131
  */
90
132
  export function decideRender(
91
133
  block: Pick<Block, "importance">,
92
134
  matched: boolean,
93
135
  dataOk: boolean,
94
136
  ): RenderDecision {
95
- if (matched && dataOk) return { render: "widget" };
96
- return block.importance === "structural"
97
- ? { render: "error" }
98
- : { render: "empty" };
137
+ return coreDecideRender(block.importance, matched, dataOk);
99
138
  }
@@ -1,14 +1,23 @@
1
1
  /**
2
- * DS renderer widget registry — the extensible dispatcher layer (#492).
2
+ * DS renderer widget registry — the Atelier-coupled BASE registry (#492).
3
3
  *
4
- * Ships a BASE registry with the two clean DS widgets (stat-grid + results-chart)
5
- * and exposes a `registerWidget` hook so host apps (the portal, the admin) can
6
- * append their own coupled widgets at startup without modifying this module
7
- * (open/closed principle, JSONForms model).
4
+ * @deprecated This is an S2 (#60) COMPATIBILITY surface. It is NOT a generic
5
+ * widget-system API do not reclassify it as one (#60 AC5). It is an
6
+ * Atelier-coupled base registry: a module-global entry list preloaded with the
7
+ * DS widgets (stat-grid, results-chart, chart, metabase-embed) whose testers
8
+ * name `Binding`/`Block`/`WidgetKind` from ./types.
8
9
  *
9
- * `dispatch.ts` (the tester/priority core) is the single dispatcher both the DS
10
- * base registry and host-extended registries share; the registry is generic over
11
- * the payload so `selectEntry` stays component-free and unit-testable.
10
+ * Migration destination: the generic isolated-registry machinery lives in
11
+ * `@aiaiai-pt/widget-system/core` (`createRegistry()` an isolated, override-
12
+ * aware factory, not a module-global singleton) and its base-widget preload in
13
+ * `@aiaiai-pt/widget-system/widgets` (`registerBaseWidgets`). The Atelier host
14
+ * owns which widgets it preloads. This module is scheduled for removal in the
15
+ * next MAJOR of `@aiaiai-pt/design-system` (S3). See
16
+ * `docs/migration/widget-system.md`.
17
+ *
18
+ * NO DUPLICATE DISPATCH (#60 AC3): this module holds ZERO ranking logic. It
19
+ * only stores entries and delegates resolution to `./dispatch.selectEntry`,
20
+ * which itself delegates the ranking loop to `@aiaiai-pt/widget-system/core`.
12
21
  *
13
22
  * TH-08 preserved: `resolveWidget` returns the matched entry's known-good `key`
14
23
  * literal — the operator's raw block `type`/`binding.kind` is never the key.
@@ -22,9 +31,18 @@ export type WidgetComponent = Component<WidgetProps>;
22
31
  * `type` hint ranks it ABOVE the kind-generic widget (score 20 > 10) for the
23
32
  * same binding. `type` is UNTRUSTED — it only influences ranking; the resolved
24
33
  * key is the entry literal (TH-08).
34
+ *
35
+ * @deprecated ATELIER-COUPLED builder (its `kind` is a `WidgetKind` and its
36
+ * tester names `Binding`). Migrate to `byTypeOnKind` from
37
+ * `@aiaiai-pt/widget-system/core`, whose tester reads a ctx `WidgetMatchContext`.
25
38
  */
26
39
  export declare function byTypeOnKind(key: string, kind: WidgetKind, component: unknown): RegistryEntry<WidgetComponent>;
27
- /** A widget whose tester is the generic "binding.kind === K" check (score 10). */
40
+ /**
41
+ * A widget whose tester is the generic "binding.kind === K" check (score 10).
42
+ *
43
+ * @deprecated ATELIER-COUPLED builder. Migrate to `byKind` from
44
+ * `@aiaiai-pt/widget-system/core` (ctx-shaped tester).
45
+ */
28
46
  export declare function byKind(key: string, kind: WidgetKind, component: unknown): RegistryEntry<WidgetComponent>;
29
47
  /**
30
48
  * Register a widget in the host-extensible registry. Call at app startup
@@ -37,6 +55,11 @@ export declare function byKind(key: string, kind: WidgetKind, component: unknown
37
55
  *
38
56
  * @param entry - A registry entry built with `byKind`, `byTypeOnKind`, or a
39
57
  * hand-crafted `{ key, payload, tester }` for a custom tester.
58
+ *
59
+ * @deprecated ATELIER-COUPLED module-global registration. Migrate to an
60
+ * isolated `createRegistry()` from `@aiaiai-pt/widget-system/core` plus
61
+ * `registerBaseWidgets` from `@aiaiai-pt/widget-system/widgets`, and call
62
+ * `registry.register(...)` on the host-owned instance.
40
63
  */
41
64
  export declare function registerWidget(entry: RegistryEntry<WidgetComponent>): void;
42
65
  /**
@@ -44,5 +67,11 @@ export declare function registerWidget(entry: RegistryEntry<WidgetComponent>): v
44
67
  * the full registry (base DS entries + host-registered). Returns `null` when
45
68
  * no widget applies — the caller renders per blast radius (`decideRender`),
46
69
  * never interpolating the block's raw `type`/`kind`.
70
+ *
71
+ * Resolution delegates to `./dispatch.selectEntry` (→ widget-system/core); this
72
+ * module contributes only the entry list, never the ranking loop.
73
+ *
74
+ * @deprecated Migrate to `registry.resolve(ctx)` on an isolated
75
+ * `createRegistry()` from `@aiaiai-pt/widget-system/core`.
47
76
  */
48
77
  export declare function resolveWidget(block: Block, schema?: OntologySchema | null): Match<WidgetComponent> | null;
@@ -1,14 +1,23 @@
1
1
  /**
2
- * DS renderer widget registry — the extensible dispatcher layer (#492).
2
+ * DS renderer widget registry — the Atelier-coupled BASE registry (#492).
3
3
  *
4
- * Ships a BASE registry with the two clean DS widgets (stat-grid + results-chart)
5
- * and exposes a `registerWidget` hook so host apps (the portal, the admin) can
6
- * append their own coupled widgets at startup without modifying this module
7
- * (open/closed principle, JSONForms model).
4
+ * @deprecated This is an S2 (#60) COMPATIBILITY surface. It is NOT a generic
5
+ * widget-system API do not reclassify it as one (#60 AC5). It is an
6
+ * Atelier-coupled base registry: a module-global entry list preloaded with the
7
+ * DS widgets (stat-grid, results-chart, chart, metabase-embed) whose testers
8
+ * name `Binding`/`Block`/`WidgetKind` from ./types.
8
9
  *
9
- * `dispatch.ts` (the tester/priority core) is the single dispatcher both the DS
10
- * base registry and host-extended registries share; the registry is generic over
11
- * the payload so `selectEntry` stays component-free and unit-testable.
10
+ * Migration destination: the generic isolated-registry machinery lives in
11
+ * `@aiaiai-pt/widget-system/core` (`createRegistry()` an isolated, override-
12
+ * aware factory, not a module-global singleton) and its base-widget preload in
13
+ * `@aiaiai-pt/widget-system/widgets` (`registerBaseWidgets`). The Atelier host
14
+ * owns which widgets it preloads. This module is scheduled for removal in the
15
+ * next MAJOR of `@aiaiai-pt/design-system` (S3). See
16
+ * `docs/migration/widget-system.md`.
17
+ *
18
+ * NO DUPLICATE DISPATCH (#60 AC3): this module holds ZERO ranking logic. It
19
+ * only stores entries and delegates resolution to `./dispatch.selectEntry`,
20
+ * which itself delegates the ranking loop to `@aiaiai-pt/widget-system/core`.
12
21
  *
13
22
  * TH-08 preserved: `resolveWidget` returns the matched entry's known-good `key`
14
23
  * literal — the operator's raw block `type`/`binding.kind` is never the key.
@@ -34,6 +43,10 @@ export type WidgetComponent = Component<WidgetProps>;
34
43
  * `type` hint ranks it ABOVE the kind-generic widget (score 20 > 10) for the
35
44
  * same binding. `type` is UNTRUSTED — it only influences ranking; the resolved
36
45
  * key is the entry literal (TH-08).
46
+ *
47
+ * @deprecated ATELIER-COUPLED builder (its `kind` is a `WidgetKind` and its
48
+ * tester names `Binding`). Migrate to `byTypeOnKind` from
49
+ * `@aiaiai-pt/widget-system/core`, whose tester reads a ctx `WidgetMatchContext`.
37
50
  */
38
51
  export function byTypeOnKind(
39
52
  key: string,
@@ -48,7 +61,12 @@ export function byTypeOnKind(
48
61
  };
49
62
  }
50
63
 
51
- /** A widget whose tester is the generic "binding.kind === K" check (score 10). */
64
+ /**
65
+ * A widget whose tester is the generic "binding.kind === K" check (score 10).
66
+ *
67
+ * @deprecated ATELIER-COUPLED builder. Migrate to `byKind` from
68
+ * `@aiaiai-pt/widget-system/core` (ctx-shaped tester).
69
+ */
52
70
  export function byKind(
53
71
  key: string,
54
72
  kind: WidgetKind,
@@ -92,6 +110,11 @@ const _entries: RegistryEntry<WidgetComponent>[] = [
92
110
  *
93
111
  * @param entry - A registry entry built with `byKind`, `byTypeOnKind`, or a
94
112
  * hand-crafted `{ key, payload, tester }` for a custom tester.
113
+ *
114
+ * @deprecated ATELIER-COUPLED module-global registration. Migrate to an
115
+ * isolated `createRegistry()` from `@aiaiai-pt/widget-system/core` plus
116
+ * `registerBaseWidgets` from `@aiaiai-pt/widget-system/widgets`, and call
117
+ * `registry.register(...)` on the host-owned instance.
95
118
  */
96
119
  export function registerWidget(entry: RegistryEntry<WidgetComponent>): void {
97
120
  _entries.push(entry);
@@ -102,6 +125,12 @@ export function registerWidget(entry: RegistryEntry<WidgetComponent>): void {
102
125
  * the full registry (base DS entries + host-registered). Returns `null` when
103
126
  * no widget applies — the caller renders per blast radius (`decideRender`),
104
127
  * never interpolating the block's raw `type`/`kind`.
128
+ *
129
+ * Resolution delegates to `./dispatch.selectEntry` (→ widget-system/core); this
130
+ * module contributes only the entry list, never the ranking loop.
131
+ *
132
+ * @deprecated Migrate to `registry.resolve(ctx)` on an isolated
133
+ * `createRegistry()` from `@aiaiai-pt/widget-system/core`.
105
134
  */
106
135
  export function resolveWidget(
107
136
  block: Block,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiaiai-pt/design-system",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "Design system tokens and Svelte components for aiaiai products",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -74,6 +74,9 @@
74
74
  "components",
75
75
  "tokens"
76
76
  ],
77
+ "dependencies": {
78
+ "@aiaiai-pt/widget-system": ">=0.1.0 <1"
79
+ },
77
80
  "peerDependencies": {
78
81
  "@codemirror/commands": "^6.10.3",
79
82
  "@codemirror/lang-json": "^6.0.2",