@ikas/bp-storefront 1.4.0-beta.84 → 1.4.0-beta.86
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
|
|
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};
|
|
@@ -11,12 +11,15 @@ 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
|
-
/**
|
|
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
|
+
*/
|
|
15
20
|
export type ThemeSetting = {
|
|
16
21
|
/** Stable runtime key — the variable's `variableName` (e.g. `_6Q0KV7VGGM`). */
|
|
17
22
|
name: string;
|
|
18
|
-
/** Human-facing label. */
|
|
19
|
-
displayName: string;
|
|
20
23
|
type: GlobalVariableType;
|
|
21
24
|
/**
|
|
22
25
|
* Concrete value, discriminated by `type`:
|
|
@@ -31,7 +34,6 @@ export type ThemeSetting = {
|
|
|
31
34
|
/** A single-value design token (color). `cssVar` resolves the live, scheme-aware value. */
|
|
32
35
|
export type DesignToken = {
|
|
33
36
|
id: string;
|
|
34
|
-
name: string;
|
|
35
37
|
/** Resolved base/default value (e.g. a hex string), or null when unset. */
|
|
36
38
|
resolved: string | null;
|
|
37
39
|
/** CSS custom-property reference, e.g. `var(--primaryColor)`. */
|
|
@@ -40,7 +42,6 @@ export type DesignToken = {
|
|
|
40
42
|
/** A typography token (text style). Apply `className` to an element to use it. */
|
|
41
43
|
export type TypographyToken = {
|
|
42
44
|
id: string;
|
|
43
|
-
name: string;
|
|
44
45
|
/** Resolved CSS values keyed by camelCased CSS property (e.g. `fontSize`, `fontWeight`). */
|
|
45
46
|
resolved: Record<string, string>;
|
|
46
47
|
/** Class selector the editor emits for this text style, e.g. `_<id>`. */
|
|
@@ -48,7 +49,6 @@ export type TypographyToken = {
|
|
|
48
49
|
};
|
|
49
50
|
export type BreakpointToken = {
|
|
50
51
|
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,7 +58,6 @@ export type StyleEntry = {
|
|
|
58
58
|
};
|
|
59
59
|
export type KeyframeToken = {
|
|
60
60
|
id: string;
|
|
61
|
-
name: string;
|
|
62
61
|
type: string;
|
|
63
62
|
/** CSS reference — the animation name / class the editor emits, e.g. `_<id>`. */
|
|
64
63
|
ref: string;
|
|
@@ -78,11 +77,10 @@ export type KeyframeToken = {
|
|
|
78
77
|
};
|
|
79
78
|
/**
|
|
80
79
|
* A color palette (one entry of `getThemeColorSchemes().values`). Its colors live in
|
|
81
|
-
* `colorsByScheme
|
|
80
|
+
* `colorsByScheme`, keyed by color-SLOT id — the top-level `schemes` list holds only slot ids.
|
|
82
81
|
*/
|
|
83
82
|
export type ColorSchemeToken = {
|
|
84
83
|
id: string;
|
|
85
|
-
name: string;
|
|
86
84
|
isDefault: boolean;
|
|
87
85
|
/** Class selector to activate this scheme value, e.g. `_<id>`. */
|
|
88
86
|
className: string;
|
|
@@ -106,7 +104,6 @@ export type ThemeGlobals = {
|
|
|
106
104
|
colorSchemes: {
|
|
107
105
|
schemes: {
|
|
108
106
|
id: string;
|
|
109
|
-
name: string;
|
|
110
107
|
}[];
|
|
111
108
|
values: ColorSchemeToken[];
|
|
112
109
|
};
|
|
@@ -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}.
|
|
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,34 +22,30 @@ 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,
|
|
25
|
+
/** Theme responsive breakpoints (`{ id, 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
|
|
32
|
-
*
|
|
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).
|
|
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
|
|
37
|
-
*
|
|
38
|
-
* iterating it renders empty. Look up each swatch's label from `schemes` by its
|
|
39
|
-
* slot-id key:
|
|
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:
|
|
40
38
|
*
|
|
41
|
-
* const {
|
|
42
|
-
* const slotName = (id: string) => schemes.find(s => s.id === id)?.name ?? id;
|
|
39
|
+
* const { values } = getThemeColorSchemes();
|
|
43
40
|
* values.forEach(palette =>
|
|
44
41
|
* Object.entries(palette.colorsByScheme).forEach(([slotId, { resolved, cssVar }]) => {
|
|
45
|
-
* //
|
|
42
|
+
* // slotId → the slot id, cssVar → live var() ref (prefer this), resolved → hex snapshot
|
|
46
43
|
* })
|
|
47
44
|
* );
|
|
48
45
|
*/
|
|
49
46
|
export declare function getThemeColorSchemes(): {
|
|
50
47
|
schemes: {
|
|
51
48
|
id: string;
|
|
52
|
-
name: string;
|
|
53
49
|
}[];
|
|
54
50
|
values: ColorSchemeToken[];
|
|
55
51
|
};
|