@declarion/react 0.6.12 → 0.6.13

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.
@@ -0,0 +1,40 @@
1
+ /**
2
+ * One declared glyph. Matches the wire JSON the Go side serves on /api/schema
3
+ * as `icons` (plan §4):
4
+ * - svg: geometry-only path `d` strings, rendered into the fixed 24x24
5
+ * stroke frame (the same frame as the built-in set).
6
+ * - lucide: a Lucide icon name, lazily resolved via dynamicIconImports.
7
+ * - url: an asset URL, rendered via <img src> ONLY (security boundary, §6).
8
+ */
9
+ export type IconDef = {
10
+ kind: "svg";
11
+ paths: string[];
12
+ } | {
13
+ kind: "lucide";
14
+ name: string;
15
+ } | {
16
+ kind: "url";
17
+ src: string;
18
+ };
19
+ /**
20
+ * Replace the entire icon registry with `icons`. Called ONCE by the consumer
21
+ * after the schema fetch resolves (and again on an identity switch re-fetch).
22
+ * Replace-all (not merge) because the registry mirrors exactly the current
23
+ * deployment's declared set; a stale entry from a prior identity must not
24
+ * survive the switch. Notifies subscribers so mounted DynamicIcons re-render.
25
+ */
26
+ export declare function setIconRegistry(icons: Record<string, IconDef>): void;
27
+ /** Read one declared glyph, or undefined when the name is not in the registry. */
28
+ export declare function getIcon(name: string): IconDef | undefined;
29
+ /**
30
+ * Subscribe to registry replacement. Returns an unsubscribe fn. Pairs with
31
+ * getIconRegistryVersion as the useSyncExternalStore (subscribe, getSnapshot).
32
+ */
33
+ export declare function subscribeIconRegistry(listener: () => void): () => void;
34
+ /**
35
+ * Monotonic snapshot of the registry's identity. Increments on every
36
+ * setIconRegistry call so useSyncExternalStore detects a replacement and
37
+ * re-renders. A primitive (number) snapshot is referentially stable between
38
+ * notifications, satisfying useSyncExternalStore's tear-checking contract.
39
+ */
40
+ export declare function getIconRegistryVersion(): number;
@@ -1,6 +1,8 @@
1
1
  import { OrderedMap } from "./ordmap";
2
2
  import type { FileFieldDef } from "./files";
3
+ import type { IconDef } from "../stores/icon-registry";
3
4
  export { OrderedMap };
5
+ export type { IconDef };
4
6
  export type LocalizedString = Record<string, string>;
5
7
  /**
6
8
  * Per-entity empty-state copy declared in the manifest under
@@ -816,6 +818,15 @@ export interface Schema {
816
818
  * map when rendering locked-widget badges.
817
819
  */
818
820
  classifications?: Record<string, ClassificationTierDef>;
821
+ /**
822
+ * Consumer-declared icon glyphs, keyed by the name referenced at `icon:`
823
+ * call sites. Carries ONLY declared/overridden entries (the built-in ~119
824
+ * travel as bare names, never here); absent when no module declares an
825
+ * `icons:` block. The Admin loads this into the runtime icon registry
826
+ * (setIconRegistry) so custom glyphs render across the chrome. Plan
827
+ * 2026-06-12-consumer-extensible-icons.md §4.
828
+ */
829
+ icons?: Record<string, IconDef>;
819
830
  }
820
831
  /**
821
832
  * Plan 2026-05-26 §B9. One entry in the top-level classifications map.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@declarion/react",
3
- "version": "0.6.12",
3
+ "version": "0.6.13",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React SDK for Declarion, the schema-driven business apps platform.",
@@ -15,6 +15,11 @@
15
15
  "import": "./dist-lib/index.js",
16
16
  "default": "./dist-lib/index.js"
17
17
  },
18
+ "./icons": {
19
+ "types": "./dist-lib/icons.d.ts",
20
+ "import": "./dist-lib/icons.js",
21
+ "default": "./dist-lib/icons.js"
22
+ },
18
23
  "./vite": {
19
24
  "types": "./dist-lib/vite/index.d.ts",
20
25
  "import": "./dist-lib/vite/index.js",
@@ -52,6 +57,7 @@
52
57
  "class-variance-authority": "^0.7.1",
53
58
  "clsx": "^2.1.1",
54
59
  "date-fns": "^4.4.0",
60
+ "lucide-react": "^1.17.0",
55
61
  "mdast-util-to-string": "^4.0.0",
56
62
  "monaco-editor": "^0.55.1",
57
63
  "react-markdown": "^10.1.0",