@ikas/bp-storefront 1.4.0-beta.197 → 1.4.0-beta.198
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
|
-
|
|
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 i=n.toLowerCase();return 0===e?i:i.charAt(0).toUpperCase()+i.slice(1)}).join("")}var i={settings:{},colors:[],typography:[],breakpoints:[],keyframes:[],colorSchemes:{schemes:[],values:[]}},r=function(n,i){return i?"var(--".concat(e(n),", ").concat(i,")"):"var(--".concat(e(n),")")},l=function(n){return"_".concat(n)},t=function(n){return"bp(".concat(n,")")},u=function(n){return n.map(function(n){return{id:n.id,width:Number(n.width)||0}})},a=/\d*\.?\d+(?:e[+-]?\d+)?px|\d*\.?\d+(?:e[+-]?\d+)?|[()+\-*/]|\S/gi,o=function(n,e){var i=s(n,e);return i&&d(n,e,i)},d=function(n,e,i){var r=n[e.i];if("+"!==r&&"-"!==r)return i;e.i+=1;var l=s(n,e);return l&&l.isPx===i.isPx?d(n,e,{n:"+"===r?i.n+l.n:i.n-l.n,isPx:i.isPx}):null},s=function(n,e){var i=c(n,e);return i&&v(n,e,i)},v=function(n,e,i){var r=n[e.i];if("*"!==r&&"/"!==r)return i;e.i+=1;var l=c(n,e);return l?"*"===r?i.isPx&&l.isPx?null:v(n,e,{n:i.n*l.n,isPx:i.isPx||l.isPx}):l.isPx||0===l.n?null:v(n,e,{n:i.n/l.n,isPx:i.isPx}):null},c=function(n,e){var i,r=n[e.i];return"-"===r?(e.i+=1,(i=c(n,e))&&{n:-i.n,isPx:i.isPx}):"+"===r?(e.i+=1,c(n,e)):"("===r?(e.i+=1,(i=o(n,e))&&")"===n[e.i]?(e.i+=1,i):null):"object"==typeof r&&null!==r?(e.i+=1,r):null},f=function(n){var e=function(n){var e=(n.match(a)||[]).map(function(n){return/^\d*\.?\d+(?:e[+-]?\d+)?px$/i.test(n)?{n:parseFloat(n),isPx:!0}:/^\d*\.?\d+(?:e[+-]?\d+)?$/i.test(n)?{n:parseFloat(n),isPx:!1}:"()+-*/".includes(n)?n:null});return e.every(function(n){return null!==n})?e:null}(n.replace(/calc\(/gi,"("));if(!e)return null;var i={i:0},r=o(e,i);return r&&r.isPx&&i.i===e.length&&Number.isFinite(r.n)&&Math.abs(r.n)<1e8?r.n:null},m=function(n,e,i,r){if(e>=n.length||e>r)return-1;var l=n[e],t="("===l?i+1:")"===l?i-1:i;return 0===t?e:m(n,e+1,t,r)},p=function(n,e){return e.reduce(function(n,e){return n.split(t(e.id)).join("".concat(e.width,"px"))},n)},h=/^-(?:webkit|moz|ms|o)-$/i,y=/[-A-Za-z0-9_]+$/,x=function(n,e,i){var r=n.indexOf("bp(",i);if(-1===r)return n;var l=Math.max(i,r-512-5),t=n.slice(l,r+5).indexOf("calc("),u=-1===t?-1:l+t;if(-1===u||u>r)return x(n,e,r+3);var a=y.exec(n.slice(Math.max(0,u-12),u)),o=a?a[0]:"",d=h.test(o)&&!y.test(n.slice(u-o.length-1,u-o.length));if(o&&!d)return x(n,e,u+5);var s=d?u-o.length:u,v=u+4,c=m(n,v,0,v+512);if(-1===c)return x(n,e,u+5);if(c<r)return x(n,e,c+1);var b=p(n.slice(v+1,c),e),g=f(b);if(null===g)return x(n,e,u+5);var N="".concat(parseFloat(g.toFixed(4)),"px");return x(n.slice(0,s)+N+n.slice(c+1),e,s+N.length)};function b(n,e){if(!n||!n.includes("bp("))return n;var i=x(n,e,0);return i.includes("bp(")?p(i,e):i}var g=function(n){var e;if(n)return Array.isArray(n)?null===(e=n[0])||void 0===e?void 0:e.value:n},N=function(n){var e,i=n;if(!i)return null;if(i.patternValueId)return r(i.patternValueId);if(i.colorSchemeId)return r(i.colorSchemeId);if(i.keyframeValueId)return l(i.keyframeValueId);var t=i.value;return null==t?null:"object"==typeof t?"string"==typeof t.css?t.css:null!=t.value?"".concat(t.value).concat(null!==(e=t.unit)&&void 0!==e?e:""):null:String(t)},P=/^__.+__$/,S=function(n){return P.test(null!=n?n:"")},A=function(n,e){if("BOOLEAN"===n)return!!e;if("NUMBER"===n){if("number"!=typeof e&&"string"!=typeof e)return null;var i="string"==typeof e&&""===e.trim()?NaN:Number(e);return Number.isFinite(i)?i:null}return null!=e?e:null};function I(n){var t,u,a,o,d,s,v,c,f,m,p,h,y,x,b;if(!n)return i;for(var P=null===(t=n.theme)||void 0===t?void 0:t.pattern,I={},k=0,w=null!==(o=null===(a=null===(u=n.globalsBlueprint)||void 0===u?void 0:u.module)||void 0===a?void 0:a.variables)&&void 0!==o?o:[];k<w.length;k++){var V=w[k];if(!1!==V.isGlobal&&V.variableName&&(!S(V.id)&&!S(V.variableName))){var _=null!==(d=V.variableType)&&void 0!==d?d:"TEXT";I[V.variableName]={name:V.variableName,displayName:null!==(s=V.displayName)&&void 0!==s?s:V.variableName,type:_,value:A(_,V.defaultValue)}}}var D=(null!==(v=null==P?void 0:P.values)&&void 0!==v?v:[]).map(function(n){var e,i;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id,resolved:N(g(null===(i=n.style)||void 0===i?void 0:i.value)),cssVar:r(n.id)}}),F=function(n){return(null!=n?n:[]).map(function(n){return{property:n.property,value:N(g(n.value))}}).filter(function(n){return null!=n.value})},j=(null!==(c=null==P?void 0:P.elements)&&void 0!==c?c:[]).map(function(n){for(var i,r={},t=0,u=F(n.styles);t<u.length;t++){var a=u[t],o=a.property,d=a.value;r[e(o)]=d}return{id:n.id,name:null!==(i=n.name)&&void 0!==i?i:n.id,resolved:r,className:l(n.id),isDefault:!!n.isDefault}}),z=(null!==(m=null===(f=n.theme)||void 0===f?void 0:f.breakpoints)&&void 0!==m?m:[]).map(function(n){var e,i;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id,width:null!==(i=n.width)&&void 0!==i?i:0}}),T=(null!==(h=null===(p=n.theme)||void 0===p?void 0:p.keyframes)&&void 0!==h?h:[]).map(function(n){var e,i,r;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id,type:null!==(i=n.type)&&void 0!==i?i:"keyframe",ref:l(n.id),settings:F(n.styles),points:(null!==(r=n.points)&&void 0!==r?r:[]).map(function(n){return{point:n.point,styles:F(n.styles)}})}}),Z=(null!==(y=null==P?void 0:P.colorSchemes)&&void 0!==y?y:[]).map(function(n){var e;return{id:n.id,name:null!==(e=n.name)&&void 0!==e?e:n.id}}),$=null!==(x=null==P?void 0:P.colorSchemes)&&void 0!==x?x:[],B=null!==(b=null==P?void 0:P.colorSchemeValues)&&void 0!==b?b:[],E=B.map(function(n){for(var e,i,t,u,a=function(n){var e,i;return null!==(i=null===(e=B.find(function(e){return e.isDefault&&(n?e.designAssetId===n:!e.designAssetId)}))||void 0===e?void 0:e.colors)&&void 0!==i?i:[]}(n.designAssetId),o={},d=function(l){var u=null===(e=n.colors)||void 0===e?void 0:e.find(function(n){return n.colorSchemeId===l.id}),d=u?void 0:a.find(function(n){return n.colorSchemeId===l.id});o[l.id]={resolved:null!==(t=N(null!==(i=null==u?void 0:u.style)&&void 0!==i?i:null==d?void 0:d.style))&&void 0!==t?t:"#ffffff",cssVar:r(l.id)}},s=0,v=$;s<v.length;s++){d(v[s])}return{id:n.id,name:null!==(u=n.name)&&void 0!==u?u:n.id,isDefault:!!n.isDefault,className:l(n.id),colorsByScheme:o}});return{settings:I,colors:D,typography:j,breakpoints:z,keyframes:T,colorSchemes:{schemes:Z,values:E}}}export{i as EMPTY_THEME_GLOBALS,t as breakpointCssToken,e as cssVarCamelCase,r as cssVarRef,S as isReservedVariableId,l as rawClassRef,b as resolveBreakpointMediaTokens,I as serializeThemeGlobals,u as toResolverBreakpoints};
|
|
@@ -10,7 +10,7 @@ export declare function cssVarCamelCase(str: string): string;
|
|
|
10
10
|
* {@link serializeThemeGlobals}, and returned by the CLI/MCP `list-theme-globals` reader.
|
|
11
11
|
*/
|
|
12
12
|
/** Global-variable value kinds, mirrored from the editor sidebar `GlobalVariableType`. */
|
|
13
|
-
export type GlobalVariableType = "TEXT" | "RICH_TEXT" | "IMAGE" | "COLOR" | "NUMBER" | "BOOLEAN" | "BORDER" | "SHADOW"
|
|
13
|
+
export type GlobalVariableType = "TEXT" | "RICH_TEXT" | "IMAGE" | "COLOR" | "NUMBER" | "BOOLEAN" | "BORDER" | "SHADOW";
|
|
14
14
|
/** A theme "global variable" (Theme Settings panel). `name` is the stable runtime key. */
|
|
15
15
|
export type ThemeSetting = {
|
|
16
16
|
/** Stable runtime key — the variable's `variableName` (e.g. `_6Q0KV7VGGM`). */
|
|
@@ -25,21 +25,8 @@ export type ThemeSetting = {
|
|
|
25
25
|
* `.url` field — resolve to a URL with `getDefaultSrc(value)` / `getSrc(value, size)`
|
|
26
26
|
* from `@ikas/bp-storefront`, never read `value.url`.
|
|
27
27
|
* - BORDER/SHADOW → object, or `null` when unset.
|
|
28
|
-
* - ENUM → the selected option VALUE string (one of `Object.values(options)`, never a label),
|
|
29
|
-
* or `null` when unset or when that option no longer exists on the enum.
|
|
30
28
|
*/
|
|
31
29
|
value: any;
|
|
32
|
-
/**
|
|
33
|
-
* ENUM only — id of the project enum type (`project.types[].id`) this setting selects from. It is
|
|
34
|
-
* the same id an ENUM component prop carries as `enumTypeId`; matching ids are what make a prop
|
|
35
|
-
* bindable to the setting.
|
|
36
|
-
*/
|
|
37
|
-
enumTypeId?: string;
|
|
38
|
-
/**
|
|
39
|
-
* ENUM only — the enum's options at serialize time, `{ [label]: value }`. `value` above is always
|
|
40
|
-
* one of these VALUES or `null`. Empty when the enum type could not be found in the project.
|
|
41
|
-
*/
|
|
42
|
-
options?: Record<string, string>;
|
|
43
30
|
};
|
|
44
31
|
/** A single-value design token (color). `cssVar` resolves the live, scheme-aware value. */
|
|
45
32
|
export type DesignToken = {
|
|
@@ -229,25 +216,15 @@ type VariableLike = {
|
|
|
229
216
|
variableName?: string;
|
|
230
217
|
displayName?: string;
|
|
231
218
|
variableType?: string;
|
|
232
|
-
/** Blueprint type id. For an ENUM global this is the enum type's id (`project.types[].id`). */
|
|
233
|
-
typeId?: string;
|
|
234
219
|
defaultValue?: any;
|
|
235
220
|
isGlobal?: boolean;
|
|
236
221
|
};
|
|
237
|
-
/** The slice of a project `IType` an ENUM setting reads: its id and its `{ label: value }` options. */
|
|
238
|
-
type TypeLike = {
|
|
239
|
-
id: string;
|
|
240
|
-
type?: unknown;
|
|
241
|
-
enumOptions?: Record<string, any> | null;
|
|
242
|
-
};
|
|
243
222
|
export type SerializableProject = {
|
|
244
223
|
globalsBlueprint?: {
|
|
245
224
|
module?: {
|
|
246
225
|
variables?: VariableLike[];
|
|
247
226
|
};
|
|
248
227
|
};
|
|
249
|
-
/** Project custom types; only enum entries are read, to resolve ENUM settings' options. */
|
|
250
|
-
types?: TypeLike[];
|
|
251
228
|
theme?: {
|
|
252
229
|
breakpoints?: BreakpointLike[];
|
|
253
230
|
keyframes?: KeyframeLike[];
|
|
@@ -13,10 +13,7 @@ export declare function getThemeSettings(): ThemeSetting[];
|
|
|
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
|
|
16
|
-
* `getDefaultSrc`/`getSrc`.
|
|
17
|
-
* (or null) and the setting also carries `enumTypeId` and `options` (`{ label: value }`);
|
|
18
|
-
* in a code component prefer the typed `themeValue("_key")` from `./global-types`, which
|
|
19
|
-
* narrows the value to the enum's union.
|
|
16
|
+
* `getDefaultSrc`/`getSrc`.
|
|
20
17
|
*/
|
|
21
18
|
export declare function getThemeSetting(name: string): ThemeSetting | undefined;
|
|
22
19
|
/** Convenience: the resolved value of a global variable, or `undefined` if not found. */
|
|
@@ -38,7 +38,6 @@ export declare function IkasComponentRenderer({ id: baseId, components, style, c
|
|
|
38
38
|
};
|
|
39
39
|
style: {
|
|
40
40
|
cssText?: string | null;
|
|
41
|
-
[Symbol.iterator]?: string | number | null | undefined;
|
|
42
41
|
length?: string | number | null | undefined;
|
|
43
42
|
filter?: string | number | null | undefined;
|
|
44
43
|
fill?: string | number | null | undefined;
|
|
@@ -49,7 +49,6 @@ export declare function PayWithIkas({ product, quantity, className, style }: Pay
|
|
|
49
49
|
className: string | undefined;
|
|
50
50
|
style: {
|
|
51
51
|
cssText?: string | null;
|
|
52
|
-
[Symbol.iterator]?: string | number | null | undefined;
|
|
53
52
|
clipPath?: string | number | null | undefined;
|
|
54
53
|
filter?: string | number | null | undefined;
|
|
55
54
|
marker?: string | number | null | undefined;
|