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

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 +1 @@
1
- var e=new RegExp(["[A-Z]?[a-z]+","[0-9]*(?:1ST|2ND|3RD|(?![123])[0-9]TH)(?=\\b|[a-z_])","[0-9]*(?:1st|2nd|3rd|(?![123])[0-9]th)(?=\\b|[A-Z_])","[A-Z]+(?![a-z])","[0-9]+","[A-Z]"].join("|"),"g");function n(n){return(String(n).match(e)||[]).map(function(e,n){var l=e.toLowerCase();return 0===n?l:l.charAt(0).toUpperCase()+l.slice(1)}).join("")}var l={settings:{},colors:[],typography:[],breakpoints:[],keyframes:[],colorSchemes:{schemes:[],values:[]}},r=function(e){return"var(--".concat(n(e),")")},i=function(e){return"_".concat(e)},t=function(e){return"bp(".concat(e,")")},o=function(e){return e.map(function(e){return{id:e.id,width:Number(e.width)||0}})};function u(e,n){return e&&e.includes("bp(")?n.reduce(function(e,n){return e.split(t(n.id)).join("".concat(n.width,"px"))},e):e}var a=function(e){var n;if(e)return Array.isArray(e)?null===(n=e[0])||void 0===n?void 0:n.value:e},d=function(e){var n,l=e;if(!l)return null;if(l.patternValueId)return r(l.patternValueId);if(l.colorSchemeId)return r(l.colorSchemeId);if(l.keyframeValueId)return i(l.keyframeValueId);var t=l.value;return null==t?null:"object"==typeof t?"string"==typeof t.css?t.css:null!=t.value?"".concat(t.value).concat(null!==(n=t.unit)&&void 0!==n?n:""):null:String(t)},v=/^__.+__$/,s=function(e){return v.test(null!=e?e:"")};function c(e){var t,o,u,v,c,f,p,m,y,h,b,g,S,A,I;if(!e)return l;for(var k=null===(t=e.theme)||void 0===t?void 0:t.pattern,N={},V=0,w=null!==(v=null===(u=null===(o=e.globalsBlueprint)||void 0===o?void 0:o.module)||void 0===u?void 0:u.variables)&&void 0!==v?v:[];V<w.length;V++){var _=w[V];if(!1!==_.isGlobal&&_.variableName&&(!s(_.id)&&!s(_.variableName))){var D=null!==(c=_.variableType)&&void 0!==c?c:"TEXT";N[_.variableName]={name:_.variableName,type:D,value:"BOOLEAN"===D?!!_.defaultValue:null!==(f=_.defaultValue)&&void 0!==f?f:null}}}var T=(null!==(p=null==k?void 0:k.values)&&void 0!==p?p:[]).map(function(e){var n;return{id:e.id,resolved:d(a(null===(n=e.style)||void 0===n?void 0:n.value)),cssVar:r(e.id)}}),j=function(e){return(null!=e?e:[]).map(function(e){return{property:e.property,value:d(a(e.value))}}).filter(function(e){return null!=e.value})},Z=(null!==(m=null==k?void 0:k.elements)&&void 0!==m?m:[]).map(function(e){for(var l={},r=0,t=j(e.styles);r<t.length;r++){var o=t[r],u=o.property,a=o.value;l[n(u)]=a}return{id:e.id,resolved:l,className:i(e.id)}}),x=(null!==(h=null===(y=e.theme)||void 0===y?void 0:y.breakpoints)&&void 0!==h?h:[]).map(function(e){var n;return{id:e.id,width:null!==(n=e.width)&&void 0!==n?n:0}}),z=(null!==(g=null===(b=e.theme)||void 0===b?void 0:b.keyframes)&&void 0!==g?g:[]).map(function(e){var n,l;return{id:e.id,type:null!==(n=e.type)&&void 0!==n?n:"keyframe",ref:i(e.id),settings:j(e.styles),points:(null!==(l=e.points)&&void 0!==l?l:[]).map(function(e){return{point:e.point,styles:j(e.styles)}})}}),B=(null!==(S=null==k?void 0:k.colorSchemes)&&void 0!==S?S:[]).map(function(e){return{id:e.id}}),E=null!==(A=null==k?void 0:k.colorSchemes)&&void 0!==A?A:[],C=null!==(I=null==k?void 0:k.colorSchemeValues)&&void 0!==I?I:[],L=C.map(function(e){for(var n,l,t,o=function(e){var n,l;return null!==(l=null===(n=C.find(function(n){return n.isDefault&&(e?n.designAssetId===e:!n.designAssetId)}))||void 0===n?void 0:n.colors)&&void 0!==l?l:[]}(e.designAssetId),u={},a=function(i){var a=null===(n=e.colors)||void 0===n?void 0:n.find(function(e){return e.colorSchemeId===i.id}),v=a?void 0:o.find(function(e){return e.colorSchemeId===i.id});u[i.id]={resolved:null!==(t=d(null!==(l=null==a?void 0:a.style)&&void 0!==l?l:null==v?void 0:v.style))&&void 0!==t?t:"#ffffff",cssVar:r(i.id)}},v=0,s=E;v<s.length;v++){a(s[v])}return{id:e.id,isDefault:!!e.isDefault,className:i(e.id),colorsByScheme:u}});return{settings:N,colors:T,typography:Z,breakpoints:x,keyframes:z,colorSchemes:{schemes:B,values:L}}}export{l as EMPTY_THEME_GLOBALS,t as breakpointCssToken,n as cssVarCamelCase,r as cssVarRef,s as isReservedVariableId,i as rawClassRef,u as resolveBreakpointMediaTokens,c as serializeThemeGlobals,o as toResolverBreakpoints};
1
+ var n=new RegExp(["[A-Z]?[a-z]+","[0-9]*(?:1ST|2ND|3RD|(?![123])[0-9]TH)(?=\\b|[a-z_])","[0-9]*(?:1st|2nd|3rd|(?![123])[0-9]th)(?=\\b|[A-Z_])","[A-Z]+(?![a-z])","[0-9]+","[A-Z]"].join("|"),"g");function e(e){return(String(e).match(n)||[]).map(function(n,e){var l=n.toLowerCase();return 0===e?l:l.charAt(0).toUpperCase()+l.slice(1)}).join("")}var l={settings:{},colors:[],typography:[],breakpoints:[],keyframes:[],colorSchemes:{schemes:[],values:[]}},i=function(n){return"var(--".concat(e(n),")")},r=function(n){return"_".concat(n)},o=function(n){return"bp(".concat(n,")")},u=function(n){return n.map(function(n){return{id:n.id,width:Number(n.width)||0}})};function t(n,e){return n&&n.includes("bp(")?e.reduce(function(n,e){return n.split(o(e.id)).join("".concat(e.width,"px"))},n):n}var a=function(n){var e;if(n)return Array.isArray(n)?null===(e=n[0])||void 0===e?void 0:e.value:n},d=function(n){var e,l=n;if(!l)return null;if(l.patternValueId)return i(l.patternValueId);if(l.colorSchemeId)return i(l.colorSchemeId);if(l.keyframeValueId)return r(l.keyframeValueId);var o=l.value;return null==o?null:"object"==typeof o?"string"==typeof o.css?o.css:null!=o.value?"".concat(o.value).concat(null!==(e=o.unit)&&void 0!==e?e:""):null:String(o)},v=/^__.+__$/,s=function(n){return v.test(null!=n?n:"")};function c(n){var o,u,t,v,c,f,m,p,y,h,b,g,S,N,A,I;if(!n)return l;for(var k=null===(o=n.theme)||void 0===o?void 0:o.pattern,V={},w=0,_=null!==(v=null===(t=null===(u=n.globalsBlueprint)||void 0===u?void 0:u.module)||void 0===t?void 0:t.variables)&&void 0!==v?v:[];w<_.length;w++){var D=_[w];if(!1!==D.isGlobal&&D.variableName&&(!s(D.id)&&!s(D.variableName))){var T=null!==(c=D.variableType)&&void 0!==c?c:"TEXT";V[D.variableName]={name:D.variableName,displayName:null!==(f=D.displayName)&&void 0!==f?f:D.variableName,type:T,value:"BOOLEAN"===T?!!D.defaultValue:null!==(m=D.defaultValue)&&void 0!==m?m:null}}}var j=(null!==(p=null==k?void 0:k.values)&&void 0!==p?p:[]).map(function(n){var e,l;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id,resolved:d(a(null===(l=n.style)||void 0===l?void 0:l.value)),cssVar:i(n.id)}}),Z=function(n){return(null!=n?n:[]).map(function(n){return{property:n.property,value:d(a(n.value))}}).filter(function(n){return null!=n.value})},x=(null!==(y=null==k?void 0:k.elements)&&void 0!==y?y:[]).map(function(n){for(var l,i={},o=0,u=Z(n.styles);o<u.length;o++){var t=u[o],a=t.property,d=t.value;i[e(a)]=d}return{id:n.id,name:null!==(l=n.name)&&void 0!==l?l:n.id,resolved:i,className:r(n.id)}}),z=(null!==(b=null===(h=n.theme)||void 0===h?void 0:h.breakpoints)&&void 0!==b?b:[]).map(function(n){var e,l;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id,width:null!==(l=n.width)&&void 0!==l?l:0}}),B=(null!==(S=null===(g=n.theme)||void 0===g?void 0:g.keyframes)&&void 0!==S?S:[]).map(function(n){var e,l,i;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id,type:null!==(l=n.type)&&void 0!==l?l:"keyframe",ref:r(n.id),settings:Z(n.styles),points:(null!==(i=n.points)&&void 0!==i?i:[]).map(function(n){return{point:n.point,styles:Z(n.styles)}})}}),E=(null!==(N=null==k?void 0:k.colorSchemes)&&void 0!==N?N:[]).map(function(n){var e;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id}}),C=null!==(A=null==k?void 0:k.colorSchemes)&&void 0!==A?A:[],L=null!==(I=null==k?void 0:k.colorSchemeValues)&&void 0!==I?I:[],O=L.map(function(n){for(var e,l,o,u,t=function(n){var e,l;return null!==(l=null===(e=L.find(function(e){return e.isDefault&&(n?e.designAssetId===n:!e.designAssetId)}))||void 0===e?void 0:e.colors)&&void 0!==l?l:[]}(n.designAssetId),a={},v=function(r){var u=null===(e=n.colors)||void 0===e?void 0:e.find(function(n){return n.colorSchemeId===r.id}),v=u?void 0:t.find(function(n){return n.colorSchemeId===r.id});a[r.id]={resolved:null!==(o=d(null!==(l=null==u?void 0:u.style)&&void 0!==l?l:null==v?void 0:v.style))&&void 0!==o?o:"#ffffff",cssVar:i(r.id)}},s=0,c=C;s<c.length;s++){v(c[s])}return{id:n.id,name:null!==(u=n.name)&&void 0!==u?u:n.id,isDefault:!!n.isDefault,className:r(n.id),colorsByScheme:a}});return{settings:V,colors:j,typography:x,breakpoints:z,keyframes:B,colorSchemes:{schemes:E,values:O}}}export{l as EMPTY_THEME_GLOBALS,o as breakpointCssToken,e as cssVarCamelCase,i as cssVarRef,s as isReservedVariableId,r as rawClassRef,t as resolveBreakpointMediaTokens,c as serializeThemeGlobals,u as toResolverBreakpoints};
@@ -11,15 +11,12 @@ export declare function cssVarCamelCase(str: string): string;
11
11
  */
12
12
  /** Global-variable value kinds, mirrored from the editor sidebar `GlobalVariableType`. */
13
13
  export type GlobalVariableType = "TEXT" | "RICH_TEXT" | "IMAGE" | "COLOR" | "NUMBER" | "BOOLEAN" | "BORDER" | "SHADOW";
14
- /**
15
- * A theme "global variable" (Theme Settings panel). `name` is the stable runtime key.
16
- * The human-facing `displayName` is intentionally NOT part of this contract — the CC-server AI
17
- * agent kept referencing display labels instead of stable keys, so labels are dropped from the
18
- * theme-globals payload entirely (see the design-token types below).
19
- */
14
+ /** A theme "global variable" (Theme Settings panel). `name` is the stable runtime key. */
20
15
  export type ThemeSetting = {
21
16
  /** Stable runtime key — the variable's `variableName` (e.g. `_6Q0KV7VGGM`). */
22
17
  name: string;
18
+ /** Human-facing label. */
19
+ displayName: string;
23
20
  type: GlobalVariableType;
24
21
  /**
25
22
  * Concrete value, discriminated by `type`:
@@ -34,6 +31,7 @@ export type ThemeSetting = {
34
31
  /** A single-value design token (color). `cssVar` resolves the live, scheme-aware value. */
35
32
  export type DesignToken = {
36
33
  id: string;
34
+ name: string;
37
35
  /** Resolved base/default value (e.g. a hex string), or null when unset. */
38
36
  resolved: string | null;
39
37
  /** CSS custom-property reference, e.g. `var(--primaryColor)`. */
@@ -42,6 +40,7 @@ export type DesignToken = {
42
40
  /** A typography token (text style). Apply `className` to an element to use it. */
43
41
  export type TypographyToken = {
44
42
  id: string;
43
+ name: string;
45
44
  /** Resolved CSS values keyed by camelCased CSS property (e.g. `fontSize`, `fontWeight`). */
46
45
  resolved: Record<string, string>;
47
46
  /** Class selector the editor emits for this text style, e.g. `_<id>`. */
@@ -49,6 +48,7 @@ export type TypographyToken = {
49
48
  };
50
49
  export type BreakpointToken = {
51
50
  id: string;
51
+ name: string;
52
52
  width: number;
53
53
  };
54
54
  /** A resolved CSS style entry, e.g. { property: "animation-duration", value: "1.4s" }. */
@@ -58,6 +58,7 @@ export type StyleEntry = {
58
58
  };
59
59
  export type KeyframeToken = {
60
60
  id: string;
61
+ name: string;
61
62
  type: string;
62
63
  /** CSS reference — the animation name / class the editor emits, e.g. `_<id>`. */
63
64
  ref: string;
@@ -77,10 +78,11 @@ export type KeyframeToken = {
77
78
  };
78
79
  /**
79
80
  * A color palette (one entry of `getThemeColorSchemes().values`). Its colors live in
80
- * `colorsByScheme`, keyed by color-SLOT id — the top-level `schemes` list holds only slot ids.
81
+ * `colorsByScheme` — the top-level `schemes` list holds only slot id→name labels.
81
82
  */
82
83
  export type ColorSchemeToken = {
83
84
  id: string;
85
+ name: string;
84
86
  isDefault: boolean;
85
87
  /** Class selector to activate this scheme value, e.g. `_<id>`. */
86
88
  className: string;
@@ -104,6 +106,7 @@ export type ThemeGlobals = {
104
106
  colorSchemes: {
105
107
  schemes: {
106
108
  id: string;
109
+ name: string;
107
110
  }[];
108
111
  values: ColorSchemeToken[];
109
112
  };
@@ -9,7 +9,7 @@ export declare function registerThemeSettingValues(values: Record<string, any> |
9
9
  export declare function getThemeSettings(): ThemeSetting[];
10
10
  /**
11
11
  * A single global variable by its stable key (`variableName`, e.g. `_6Q0KV7VGGM`).
12
- * Discover keys via {@link getThemeSettings}.
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
14
  * Its shape is discriminated by `type` (see {@link ThemeSetting.value}); note an
15
15
  * IMAGE setting's value is an image REFERENCE (no `.url`) — resolve with
@@ -22,30 +22,34 @@ export declare function getThemeSettingValue(name: string): any;
22
22
  export declare function getThemeColors(): DesignToken[];
23
23
  /** Theme typography tokens (text styles). Apply `className` or read `resolved` CSS values. */
24
24
  export declare function getThemeTypography(): TypographyToken[];
25
- /** Theme responsive breakpoints (`{ id, width }`). */
25
+ /** Theme responsive breakpoints (`{ id, name, width }`). */
26
26
  export declare function getThemeBreakpoints(): BreakpointToken[];
27
27
  /** Theme keyframe/transition animations. Use `ref` as the CSS animation name. */
28
28
  export declare function getThemeKeyframes(): KeyframeToken[];
29
29
  /**
30
30
  * Theme color schemes (palettes). Returns two PARALLEL lists with different jobs:
31
- * - `schemes`: the color SLOTS as `{ id }` only — no colors and no display names live here.
32
- * Reference a slot by its id (slot display names are not exposed at runtime or to the agent).
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
33
  * - `values`: the actual palettes. A palette's colors live in its `colorsByScheme`
34
34
  * map, keyed by slot id → `{ resolved, cssVar }`.
35
35
  *
36
- * To render swatches, iterate `values[].colorsByScheme` (the source of truth for colors), NOT the
37
- * top-level `schemes` array — `schemes` carries slot ids only, so iterating it renders empty:
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:
38
40
  *
39
- * const { values } = getThemeColorSchemes();
41
+ * const { schemes, values } = getThemeColorSchemes();
42
+ * const slotName = (id: string) => schemes.find(s => s.id === id)?.name ?? id;
40
43
  * values.forEach(palette =>
41
44
  * Object.entries(palette.colorsByScheme).forEach(([slotId, { resolved, cssVar }]) => {
42
- * // slotId → the slot id, cssVar → live var() ref (prefer this), resolved → hex snapshot
45
+ * // slotName(slotId)label, cssVar → live var() ref (prefer this), resolved → hex snapshot
43
46
  * })
44
47
  * );
45
48
  */
46
49
  export declare function getThemeColorSchemes(): {
47
50
  schemes: {
48
51
  id: string;
52
+ name: string;
49
53
  }[];
50
54
  values: ColorSchemeToken[];
51
55
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/bp-storefront",
3
- "version": "1.4.0-beta.86",
3
+ "version": "1.4.0-beta.87",
4
4
  "description": "A framework for the ikas blueprint storefronts.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",