@ikas/bp-storefront 1.4.0-beta.83 → 1.4.0-beta.85

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.
@@ -62,19 +62,26 @@ export declare function getThumbnailSrc(image: IkasImage): string;
62
62
  /**
63
63
  * Generates the full CDN source URL for an image or video at the specified size, handling both legacy path-based and merchant-scoped ID formats.
64
64
  *
65
+ * NOTE: For videos (`image.isVideo === true`) the `size` argument is IGNORED — the original .mp4 is always returned.
66
+ * So `getSrc(item, 240)` and `getDefaultSrc(item)` produce the identical URL for a video. PREFER `getDefaultSrc(item)`
67
+ * for video `src` (no size param) — do NOT pass an arbitrary size like `getSrc(item, 240)`, it is misleading.
68
+ *
65
69
  * @ai-category Image
66
70
  * @ai-related getDefaultSrc, getThumbnailSrc, createMediaSrcset
67
71
  *
68
72
  * @param image - The image object containing the id, fileName, and isVideo flag.
69
- * @param size - The desired image width in pixels for the generated URL.
73
+ * @param size - The desired image width in pixels. Ignored for videos.
70
74
  * @returns The full CDN URL string for the image or video.
71
75
  *
72
76
  * @example
73
77
  * ```typescript
74
- * import { getSrc } from "@ikas/bp-storefront";
78
+ * import { getSrc, getDefaultSrc } from "@ikas/bp-storefront";
75
79
  *
76
80
  * const src = getSrc(image, 640);
77
81
  * console.log(src); // "https://cdn.example.com/images/.../640/image.webp"
82
+ *
83
+ * // For a video, use getDefaultSrc (size is ignored anyway):
84
+ * <video src={getDefaultSrc(item)} muted playsInline preload="metadata" />
78
85
  * ```
79
86
  */
80
87
  export declare function getSrc(image: IkasImage, size: number): string;
@@ -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 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};
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){var n;return{id:e.id,name:null!==(n=e.name)&&void 0!==n?n: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
- /** A theme "global variable" (Theme Settings panel). `name` is the stable runtime key. */
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;
@@ -82,7 +81,6 @@ export type KeyframeToken = {
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/bp-storefront",
3
- "version": "1.4.0-beta.83",
3
+ "version": "1.4.0-beta.85",
4
4
  "description": "A framework for the ikas blueprint storefronts.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",