@ikas/bp-storefront 1.4.0-beta.87 → 1.4.0-beta.89

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.
@@ -76,6 +76,15 @@ export type KeyframeToken = {
76
76
  styles?: StyleEntry[];
77
77
  }[];
78
78
  };
79
+ /**
80
+ * A color SLOT — one entry of the top-level `getThemeColorSchemes().schemes` list. It is a
81
+ * label only (`id` + display `name`); the actual colors for the slot live in each palette's
82
+ * `colorsByScheme[id]`.
83
+ */
84
+ export type ColorSchemeSlot = {
85
+ id: string;
86
+ name: string;
87
+ };
79
88
  /**
80
89
  * A color palette (one entry of `getThemeColorSchemes().values`). Its colors live in
81
90
  * `colorsByScheme` — the top-level `schemes` list holds only slot id→name labels.
@@ -104,13 +113,50 @@ export type ThemeGlobals = {
104
113
  breakpoints: BreakpointToken[];
105
114
  keyframes: KeyframeToken[];
106
115
  colorSchemes: {
107
- schemes: {
108
- id: string;
109
- name: string;
110
- }[];
116
+ schemes: ColorSchemeSlot[];
111
117
  values: ColorSchemeToken[];
112
118
  };
113
119
  };
120
+ /**
121
+ * Stamps a theme-token type as its RUNTIME view returned by the `@ikas/bp-storefront` getters
122
+ * (`getThemeColors` / `getThemeTypography` / ...). `name` is removed, then re-added as a
123
+ * DEPRECATED `never`. Plainly `Omit`-ing it would only ever surface a bare "Property 'name' does
124
+ * not exist on type" — re-adding it as a documented `@deprecated never` instead means a developer
125
+ * who reaches for `.name` at runtime sees the strikethrough + the explanation below on hover, and
126
+ * any actual use of the value is a type error (`never`). The agent is steered the same way.
127
+ *
128
+ * The full types above (with a real `name: string`) are still produced in the serialized
129
+ * {@link ThemeGlobals} payload and surfaced by the CLI/MCP `list-theme-globals` AUTHORING read, so
130
+ * the agent/editor can still discover and reuse existing tokens by name. `name` is hidden ONLY at
131
+ * the runtime getter return types (the getters cast the live payload to these views).
132
+ */
133
+ type RuntimeView<T> = Omit<T, "name"> & {
134
+ /**
135
+ * @deprecated `name` is authoring-only and is NOT exposed at runtime. Identify this token by its
136
+ * STABLE `id` instead — color → `cssVar` (`var(--<id>)`), typography & keyframe → `className` /
137
+ * `ref` (`_<id>`), color-scheme slot → a `colorsByScheme` key. Token names are non-unique (two
138
+ * design assets can ship the same name) and renaming one must not break references, so matching
139
+ * by name is unsafe. Need a human-readable label? Read it from `list_theme_globals` (MCP/CLI) or
140
+ * the editor's Styles panel — not from the runtime getters.
141
+ */
142
+ name?: never;
143
+ };
144
+ export type RuntimeDesignToken = RuntimeView<DesignToken>;
145
+ export type RuntimeTypographyToken = RuntimeView<TypographyToken>;
146
+ export type RuntimeBreakpointToken = RuntimeView<BreakpointToken>;
147
+ export type RuntimeKeyframeToken = RuntimeView<KeyframeToken>;
148
+ export type RuntimeColorSchemeToken = RuntimeView<ColorSchemeToken>;
149
+ export type RuntimeColorSchemeSlot = RuntimeView<ColorSchemeSlot>;
150
+ /**
151
+ * Runtime view of {@link ThemeGlobals.colorSchemes} (returned by `getThemeColorSchemes`). The
152
+ * slot list carries only `{ id }`: slot display LABELS (the slot `name`) are authoring-only —
153
+ * read them via the CLI/MCP `list-theme-globals` or the editor, not at runtime. Render a palette
154
+ * by iterating each value's `colorsByScheme`, keyed by slot id.
155
+ */
156
+ export type RuntimeThemeColorSchemes = {
157
+ schemes: RuntimeColorSchemeSlot[];
158
+ values: RuntimeColorSchemeToken[];
159
+ };
114
160
  export declare const EMPTY_THEME_GLOBALS: ThemeGlobals;
115
161
  type StyleValueLike = {
116
162
  value?: any;
@@ -1,4 +1,4 @@
1
- import { BreakpointToken, ColorSchemeToken, DesignToken, KeyframeToken, ThemeSetting, TypographyToken } from "../../storefront-config/src";
1
+ import { RuntimeBreakpointToken, RuntimeDesignToken, RuntimeKeyframeToken, RuntimeThemeColorSchemes, RuntimeTypographyToken, ThemeSetting } from "../../storefront-config/src";
2
2
  /**
3
3
  * Register the live global-variable object (`_g_`) so `getThemeSetting`/`getThemeSettings`
4
4
  * return actual runtime values (constants, computed getters, and in-editor edits) instead
@@ -19,37 +19,30 @@ export declare function getThemeSetting(name: string): ThemeSetting | undefined;
19
19
  /** Convenience: the resolved value of a global variable, or `undefined` if not found. */
20
20
  export declare function getThemeSettingValue(name: string): any;
21
21
  /** Theme color tokens. Each carries a resolved value and a `var(--id)` CSS reference. */
22
- export declare function getThemeColors(): DesignToken[];
22
+ export declare function getThemeColors(): RuntimeDesignToken[];
23
23
  /** Theme typography tokens (text styles). Apply `className` or read `resolved` CSS values. */
24
- export declare function getThemeTypography(): TypographyToken[];
25
- /** Theme responsive breakpoints (`{ id, name, width }`). */
26
- export declare function getThemeBreakpoints(): BreakpointToken[];
24
+ export declare function getThemeTypography(): RuntimeTypographyToken[];
25
+ /** Theme responsive breakpoints (`{ id, width }`). */
26
+ export declare function getThemeBreakpoints(): RuntimeBreakpointToken[];
27
27
  /** Theme keyframe/transition animations. Use `ref` as the CSS animation name. */
28
- export declare function getThemeKeyframes(): KeyframeToken[];
28
+ export declare function getThemeKeyframes(): RuntimeKeyframeToken[];
29
29
  /**
30
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.
31
+ * - `schemes`: the color SLOTS as `{ id }` only — no colors and no display label live here at
32
+ * runtime. A slot's human name is authoring-only (read it via the CLI/MCP `list-theme-globals`
33
+ * or the editor); at runtime identify a slot solely by its `id`.
33
34
  * - `values`: the actual palettes. A palette's colors live in its `colorsByScheme`
34
35
  * map, keyed by slot id → `{ resolved, cssVar }`.
35
36
  *
36
37
  * 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:
38
+ * colors), NOT the top-level `schemes` array — `schemes` carries slot ids only, so
39
+ * iterating it renders empty:
40
40
  *
41
- * const { schemes, values } = getThemeColorSchemes();
42
- * const slotName = (id: string) => schemes.find(s => s.id === id)?.name ?? id;
41
+ * const { values } = getThemeColorSchemes();
43
42
  * values.forEach(palette =>
44
43
  * Object.entries(palette.colorsByScheme).forEach(([slotId, { resolved, cssVar }]) => {
45
- * // slotName(slotId)label, cssVar → live var() ref (prefer this), resolved → hex snapshot
44
+ * // slotId → stable slot key, cssVar → live var() ref (prefer this), resolved → hex snapshot
46
45
  * })
47
46
  * );
48
47
  */
49
- export declare function getThemeColorSchemes(): {
50
- schemes: {
51
- id: string;
52
- name: string;
53
- }[];
54
- values: ColorSchemeToken[];
55
- };
48
+ export declare function getThemeColorSchemes(): RuntimeThemeColorSchemes;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/bp-storefront",
3
- "version": "1.4.0-beta.87",
3
+ "version": "1.4.0-beta.89",
4
4
  "description": "A framework for the ikas blueprint storefronts.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",