@ikas/bp-storefront 1.4.0-beta.85 → 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 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){
|
|
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};
|
|
@@ -77,7 +77,7 @@ export type KeyframeToken = {
|
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
79
|
* A color palette (one entry of `getThemeColorSchemes().values`). Its colors live in
|
|
80
|
-
* `colorsByScheme
|
|
80
|
+
* `colorsByScheme`, keyed by color-SLOT id — the top-level `schemes` list holds only slot ids.
|
|
81
81
|
*/
|
|
82
82
|
export type ColorSchemeToken = {
|
|
83
83
|
id: string;
|
|
@@ -104,7 +104,6 @@ export type ThemeGlobals = {
|
|
|
104
104
|
colorSchemes: {
|
|
105
105
|
schemes: {
|
|
106
106
|
id: string;
|
|
107
|
-
name: string;
|
|
108
107
|
}[];
|
|
109
108
|
values: ColorSchemeToken[];
|
|
110
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
|
};
|