@ikas/bp-storefront 1.4.0-beta.61 → 1.4.0-beta.62

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.
@@ -18,7 +18,14 @@ export type ThemeSetting = {
18
18
  /** Human-facing label. */
19
19
  displayName: string;
20
20
  type: GlobalVariableType;
21
- /** Concrete value (string/number/boolean for primitives, object/null for IMAGE/BORDER/SHADOW). */
21
+ /**
22
+ * Concrete value, discriminated by `type`:
23
+ * - TEXT/RICH_TEXT → string · NUMBER → number · BOOLEAN → boolean · COLOR → hex string.
24
+ * - IMAGE → an IkasImage REFERENCE, e.g. `{ id: "theme-images/<uuid>" }`. It has NO
25
+ * `.url` field — resolve to a URL with `getDefaultSrc(value)` / `getSrc(value, size)`
26
+ * from `@ikas/bp-storefront`, never read `value.url`.
27
+ * - BORDER/SHADOW → object, or `null` when unset.
28
+ */
22
29
  value: any;
23
30
  };
24
31
  /** A single-value design token (color). `cssVar` resolves the live, scheme-aware value. */
@@ -54,13 +61,22 @@ export type KeyframeToken = {
54
61
  point: string;
55
62
  }[];
56
63
  };
64
+ /**
65
+ * A color palette (one entry of `getThemeColorSchemes().values`). Its colors live in
66
+ * `colorsByScheme` — the top-level `schemes` list holds only slot id→name labels.
67
+ */
57
68
  export type ColorSchemeToken = {
58
69
  id: string;
59
70
  name: string;
60
71
  isDefault: boolean;
61
72
  /** Class selector to activate this scheme value, e.g. `_<id>`. */
62
73
  className: string;
63
- /** Per-scheme color overrides, keyed by color-scheme id. */
74
+ /**
75
+ * This palette's colors, keyed by color-SLOT id (the ids in
76
+ * `getThemeColorSchemes().schemes`). THIS — not the top-level `schemes` array — is
77
+ * the source of truth for swatch colors; iterate it to render a palette. Prefer
78
+ * `cssVar` for live, in-editor reactivity; `resolved` is a render-time snapshot.
79
+ */
64
80
  colorsByScheme: Record<string, {
65
81
  resolved: string | null;
66
82
  cssVar: string;
@@ -11,6 +11,9 @@ export declare function getThemeSettings(): ThemeSetting[];
11
11
  * A single global variable by its stable key (`variableName`, e.g. `_6Q0KV7VGGM`).
12
12
  * Discover keys via {@link getThemeSettings} (each item carries a human `displayName`).
13
13
  * The returned `value` is the live blueprint value when available, else the default.
14
+ * Its shape is discriminated by `type` (see {@link ThemeSetting.value}); note an
15
+ * IMAGE setting's value is an image REFERENCE (no `.url`) — resolve with
16
+ * `getDefaultSrc`/`getSrc`.
14
17
  */
15
18
  export declare function getThemeSetting(name: string): ThemeSetting | undefined;
16
19
  /** Convenience: the resolved value of a global variable, or `undefined` if not found. */
@@ -23,7 +26,26 @@ export declare function getThemeTypography(): TypographyToken[];
23
26
  export declare function getThemeBreakpoints(): BreakpointToken[];
24
27
  /** Theme keyframe/transition animations. Use `ref` as the CSS animation name. */
25
28
  export declare function getThemeKeyframes(): KeyframeToken[];
26
- /** Theme color schemes — the available schemes plus per-scheme color values. */
29
+ /**
30
+ * Theme color schemes (palettes). Returns two PARALLEL lists with different jobs:
31
+ * - `schemes`: the color SLOTS as `{ id, name }` LABELS only — no colors live here.
32
+ * Use it to resolve a slot's display name from its id.
33
+ * - `values`: the actual palettes. A palette's colors live in its `colorsByScheme`
34
+ * map, keyed by slot id → `{ resolved, cssVar }`.
35
+ *
36
+ * To render swatches, iterate `values[].colorsByScheme` (the source of truth for
37
+ * colors), NOT the top-level `schemes` array — `schemes` carries labels only, so
38
+ * iterating it renders empty. Look up each swatch's label from `schemes` by its
39
+ * slot-id key:
40
+ *
41
+ * const { schemes, values } = getThemeColorSchemes();
42
+ * const slotName = (id: string) => schemes.find(s => s.id === id)?.name ?? id;
43
+ * values.forEach(palette =>
44
+ * Object.entries(palette.colorsByScheme).forEach(([slotId, { resolved, cssVar }]) => {
45
+ * // slotName(slotId) → label, cssVar → live var() ref (prefer this), resolved → hex snapshot
46
+ * })
47
+ * );
48
+ */
27
49
  export declare function getThemeColorSchemes(): {
28
50
  schemes: {
29
51
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/bp-storefront",
3
- "version": "1.4.0-beta.61",
3
+ "version": "1.4.0-beta.62",
4
4
  "description": "A framework for the ikas blueprint storefronts.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",