@ikas/bp-storefront 1.4.0-beta.8 → 1.4.0-beta.80

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.
Files changed (42) hide show
  1. package/dist/analytics/analytics-functions/helpers.js +1 -1
  2. package/dist/analytics/analytics.js +1 -1
  3. package/dist/analytics/google-tag-manager/productView.js +1 -1
  4. package/dist/analytics/google-tag-manager/viewCategory.js +1 -1
  5. package/dist/analytics/ikas/analytics.js +1 -1
  6. package/dist/analytics/utils.js +1 -1
  7. package/dist/ext/lodash/flatten.js +1 -0
  8. package/dist/functions/api/cart/index.js +1 -1
  9. package/dist/functions/models/category/index.js +1 -1
  10. package/dist/functions/models/product/option-set/index.d.ts +18 -0
  11. package/dist/functions/models/product/option-set/index.js +1 -1
  12. package/dist/functions/models/product-list/index.js +1 -1
  13. package/dist/functions/models/validator/account-info/index.js +1 -1
  14. package/dist/functions/models/validator/contact-form/index.js +1 -1
  15. package/dist/functions/models/validator/coupon-code-form/index.js +1 -1
  16. package/dist/functions/models/validator/customer-review/index.js +1 -1
  17. package/dist/functions/models/validator/forgot-password/index.js +1 -1
  18. package/dist/functions/models/validator/login/index.js +1 -1
  19. package/dist/functions/models/validator/newsletter-subscription/index.js +1 -1
  20. package/dist/functions/models/validator/order-tracking/index.js +1 -1
  21. package/dist/functions/models/validator/recover-password/index.js +1 -1
  22. package/dist/functions/models/validator/register/index.js +1 -1
  23. package/dist/functions/models/validator/sms-login/index.js +1 -1
  24. package/dist/functions/models/validator/verify-phone-number/index.js +1 -1
  25. package/dist/functions/stores/base/index.d.ts +76 -1
  26. package/dist/functions/stores/base/index.js +1 -1
  27. package/dist/functions/stores/cart/index.js +1 -1
  28. package/dist/functions/stores/customer/index.js +1 -1
  29. package/dist/index.d.ts +1 -0
  30. package/dist/index.js +1 -1
  31. package/dist/packages/storefront-config/src/index.js +1 -1
  32. package/dist/packages/storefront-config/src/theme-globals.js +1 -0
  33. package/dist/storefront-config/src/index.d.ts +4 -0
  34. package/dist/storefront-config/src/theme-globals.d.ts +211 -0
  35. package/dist/storefront-models/src/models/blueprint/prop-value/index.d.ts +2 -0
  36. package/dist/storefront-models/src/models/blueprint/prop-value/svg-list.d.ts +3 -0
  37. package/dist/storefront-models/src/models/blueprint/prop-value/svg.d.ts +3 -0
  38. package/dist/theme/settings/index.d.ts +55 -0
  39. package/dist/theme/settings/index.js +1 -0
  40. package/dist/utils/component-renderer.d.ts +2 -1
  41. package/dist/utils/component-renderer.js +1 -1
  42. package/package.json +1 -1
@@ -1,4 +1,6 @@
1
1
  import { IkasCustomerReviewSettings, IkasCustomerSettings, IkasIndexPageSeoSetting, IkasLoyaltyProgram, IkasMerchantSettings, IkasProductBackInStockSettings, IkasSalesChannelPaymentGateway, IkasStorefontMetaTemplates, IkasStorefrontB2BSettings, IkasStorefrontPopup, IkasStorefrontRouting, IkasStorefrontType, IkasThemeStockPreference } from "../../storefront-models/src";
2
+ import { ThemeGlobals } from "./theme-globals";
3
+ export * from "./theme-globals";
2
4
  export declare class IkasStorefrontConfig {
3
5
  static themeId?: string;
4
6
  static apiUrl?: string;
@@ -27,6 +29,7 @@ export declare class IkasStorefrontConfig {
27
29
  static tiktokPixelId?: string;
28
30
  static stockPreference?: IkasThemeStockPreference;
29
31
  static translations: Record<string, any>;
32
+ static themeGlobals: ThemeGlobals;
30
33
  static storefrontJSScripts: string[];
31
34
  static highPriorityStoreFrontJSScripts: string[];
32
35
  static customerReviewSettings?: IkasCustomerReviewSettings | null;
@@ -100,6 +103,7 @@ export type IkasStorefrontConfigParams = {
100
103
  tiktokPixelId?: string;
101
104
  stockPreference?: IkasThemeStockPreference;
102
105
  translations: Record<string, any>;
106
+ themeGlobals: ThemeGlobals;
103
107
  storefrontJSScripts: string[];
104
108
  highPriorityStoreFrontJSScripts: string[];
105
109
  customerReviewSettings?: IkasCustomerReviewSettings | null;
@@ -0,0 +1,211 @@
1
+ export declare function cssVarCamelCase(str: string): string;
2
+ /**
3
+ * Shared "theme globals" contract — the serialized, runtime-readable form of the editor's
4
+ * global theme settings (the left "Styles" panel): global variables + design tokens
5
+ * (colors, typography, breakpoints, keyframes, color schemes).
6
+ *
7
+ * This is packed into `IkasStorefrontConfig.themeGlobals` and read by the
8
+ * `@ikas/bp-storefront` runtime API (getThemeSetting / getThemeColors / ...). The same
9
+ * payload is produced for SSR, client hydration, and the editor canvas via
10
+ * {@link serializeThemeGlobals}, and returned by the CLI/MCP `list-theme-globals` reader.
11
+ */
12
+ /** Global-variable value kinds, mirrored from the editor sidebar `GlobalVariableType`. */
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. */
15
+ export type ThemeSetting = {
16
+ /** Stable runtime key — the variable's `variableName` (e.g. `_6Q0KV7VGGM`). */
17
+ name: string;
18
+ /** Human-facing label. */
19
+ displayName: string;
20
+ type: GlobalVariableType;
21
+ /**
22
+ * Concrete value, discriminated by `type`:
23
+ * - TEXT/RICH_TEXT → string · NUMBER → number · BOOLEAN → boolean · COLOR → hex string.
24
+ * - IMAGE → an IkasImage REFERENCE, e.g. `{ id: "theme-images/<uuid>" }`. It has NO
25
+ * `.url` field — resolve to a URL with `getDefaultSrc(value)` / `getSrc(value, size)`
26
+ * from `@ikas/bp-storefront`, never read `value.url`.
27
+ * - BORDER/SHADOW → object, or `null` when unset.
28
+ */
29
+ value: any;
30
+ };
31
+ /** A single-value design token (color). `cssVar` resolves the live, scheme-aware value. */
32
+ export type DesignToken = {
33
+ id: string;
34
+ name: string;
35
+ /** Resolved base/default value (e.g. a hex string), or null when unset. */
36
+ resolved: string | null;
37
+ /** CSS custom-property reference, e.g. `var(--primaryColor)`. */
38
+ cssVar: string;
39
+ };
40
+ /** A typography token (text style). Apply `className` to an element to use it. */
41
+ export type TypographyToken = {
42
+ id: string;
43
+ name: string;
44
+ /** Resolved CSS values keyed by camelCased CSS property (e.g. `fontSize`, `fontWeight`). */
45
+ resolved: Record<string, string>;
46
+ /** Class selector the editor emits for this text style, e.g. `_<id>`. */
47
+ className: string;
48
+ };
49
+ export type BreakpointToken = {
50
+ id: string;
51
+ name: string;
52
+ width: number;
53
+ };
54
+ /** A resolved CSS style entry, e.g. { property: "animation-duration", value: "1.4s" }. */
55
+ export type StyleEntry = {
56
+ property: string;
57
+ value: string;
58
+ };
59
+ export type KeyframeToken = {
60
+ id: string;
61
+ name: string;
62
+ type: string;
63
+ /** CSS reference — the animation name / class the editor emits, e.g. `_<id>`. */
64
+ ref: string;
65
+ /**
66
+ * Keyframe-level animation "settings" (the editor's Settings popover). These are CSS
67
+ * animation/transition properties and DIFFER BY TYPE: a `keyframe` carries
68
+ * animation-duration/-iteration-count/-play-state/-delay/-timing-function/-direction/
69
+ * -fill-mode/-timeline/-range + transform-origin; a `transition` carries `transition`.
70
+ * Both may carry backface-visibility. Empty when none are set.
71
+ */
72
+ settings?: StyleEntry[];
73
+ /** Animation points; each point may carry its own resolved styles. */
74
+ points?: {
75
+ point: string;
76
+ styles?: StyleEntry[];
77
+ }[];
78
+ };
79
+ /**
80
+ * A color palette (one entry of `getThemeColorSchemes().values`). Its colors live in
81
+ * `colorsByScheme` — the top-level `schemes` list holds only slot id→name labels.
82
+ */
83
+ export type ColorSchemeToken = {
84
+ id: string;
85
+ name: string;
86
+ isDefault: boolean;
87
+ /** Class selector to activate this scheme value, e.g. `_<id>`. */
88
+ className: string;
89
+ /**
90
+ * This palette's colors, keyed by color-SLOT id (the ids in
91
+ * `getThemeColorSchemes().schemes`). THIS — not the top-level `schemes` array — is
92
+ * the source of truth for swatch colors; iterate it to render a palette. Prefer
93
+ * `cssVar` for live, in-editor reactivity; `resolved` is a render-time snapshot.
94
+ */
95
+ colorsByScheme: Record<string, {
96
+ resolved: string | null;
97
+ cssVar: string;
98
+ }>;
99
+ };
100
+ export type ThemeGlobals = {
101
+ settings: Record<string, ThemeSetting>;
102
+ colors: DesignToken[];
103
+ typography: TypographyToken[];
104
+ breakpoints: BreakpointToken[];
105
+ keyframes: KeyframeToken[];
106
+ colorSchemes: {
107
+ schemes: {
108
+ id: string;
109
+ name: string;
110
+ }[];
111
+ values: ColorSchemeToken[];
112
+ };
113
+ };
114
+ export declare const EMPTY_THEME_GLOBALS: ThemeGlobals;
115
+ type StyleValueLike = {
116
+ value?: any;
117
+ patternValueId?: string;
118
+ keyframeValueId?: string;
119
+ colorSchemeId?: string;
120
+ };
121
+ type StyleConditionLike = {
122
+ value?: StyleValueLike;
123
+ };
124
+ type ElementStyleLike = {
125
+ property: string;
126
+ value?: StyleValueLike | StyleConditionLike[];
127
+ };
128
+ type PatternValueLike = {
129
+ id: string;
130
+ name?: string;
131
+ style?: ElementStyleLike;
132
+ };
133
+ type PatternElementLike = {
134
+ id: string;
135
+ name?: string;
136
+ styles?: ElementStyleLike[];
137
+ };
138
+ type ColorSchemeLike = {
139
+ id: string;
140
+ name?: string;
141
+ };
142
+ type ColorSchemeValueColorLike = {
143
+ colorSchemeId: string;
144
+ style?: StyleValueLike;
145
+ };
146
+ type ColorSchemeValueLike = {
147
+ id: string;
148
+ name?: string;
149
+ isDefault?: boolean;
150
+ /** Set when this scheme belongs to an installed design asset; groups the default fallback. */
151
+ designAssetId?: string;
152
+ colors?: ColorSchemeValueColorLike[];
153
+ };
154
+ type BreakpointLike = {
155
+ id: string;
156
+ name?: string;
157
+ width?: number;
158
+ };
159
+ type KeyframePointLike = {
160
+ point: string;
161
+ styles?: ElementStyleLike[];
162
+ };
163
+ type KeyframeLike = {
164
+ id: string;
165
+ name?: string;
166
+ type?: string;
167
+ styles?: ElementStyleLike[];
168
+ points?: KeyframePointLike[];
169
+ };
170
+ type VariableLike = {
171
+ id?: string;
172
+ variableName?: string;
173
+ displayName?: string;
174
+ variableType?: string;
175
+ defaultValue?: any;
176
+ isGlobal?: boolean;
177
+ };
178
+ export type SerializableProject = {
179
+ globalsBlueprint?: {
180
+ module?: {
181
+ variables?: VariableLike[];
182
+ };
183
+ };
184
+ theme?: {
185
+ breakpoints?: BreakpointLike[];
186
+ keyframes?: KeyframeLike[];
187
+ pattern?: {
188
+ values?: PatternValueLike[];
189
+ elements?: PatternElementLike[];
190
+ colorSchemes?: ColorSchemeLike[];
191
+ colorSchemeValues?: ColorSchemeValueLike[];
192
+ };
193
+ };
194
+ };
195
+ export declare const cssVarRef: (id: string) => string;
196
+ export declare const rawClassRef: (id: string) => string;
197
+ /**
198
+ * True for system/reserved global variables (e.g. `__breakpointsVar__`) — internal
199
+ * constructs that live in `module.variables` but are NOT user-facing theme settings.
200
+ * Single source of truth for the `__name__` reserved-id convention; consumers (theme
201
+ * serialization here, partner publish dependency collection) share it so a new
202
+ * synthetic var is excluded everywhere at once.
203
+ */
204
+ export declare const isReservedVariableId: (id?: string | null) => boolean;
205
+ /**
206
+ * Build the {@link ThemeGlobals} payload from a project's theme. Pure and dependency-free
207
+ * (works on plain JSON), so the same function serves SSR (`IProject`) and the editor canvas
208
+ * (`YjsProject.toJSON()`).
209
+ */
210
+ export declare function serializeThemeGlobals(project?: SerializableProject | null): ThemeGlobals;
211
+ export {};
@@ -25,5 +25,7 @@ export * from "./product-list";
25
25
  export * from "./raffle";
26
26
  export * from "./raffle-list";
27
27
  export * from "./rich-text";
28
+ export * from "./svg";
29
+ export * from "./svg-list";
28
30
  export * from "./text";
29
31
  export * from "./video";
@@ -0,0 +1,3 @@
1
+ export interface IBlueprintSvgListPropValue {
2
+ svgs: string[];
3
+ }
@@ -0,0 +1,3 @@
1
+ export interface IBlueprintSvgPropValue {
2
+ value: string;
3
+ }
@@ -0,0 +1,55 @@
1
+ import { BreakpointToken, ColorSchemeToken, DesignToken, KeyframeToken, ThemeSetting, TypographyToken } from "../../storefront-config/src";
2
+ /**
3
+ * Register the live global-variable object (`_g_`) so `getThemeSetting`/`getThemeSettings`
4
+ * return actual runtime values (constants, computed getters, and in-editor edits) instead
5
+ * of the serialized design-time defaults. Called by generated code, not by component authors.
6
+ */
7
+ export declare function registerThemeSettingValues(values: Record<string, any> | null): void;
8
+ /** All global variables (Theme Settings) defined for the theme. */
9
+ export declare function getThemeSettings(): ThemeSetting[];
10
+ /**
11
+ * A single global variable by its stable key (`variableName`, e.g. `_6Q0KV7VGGM`).
12
+ * Discover keys via {@link getThemeSettings} (each item carries a human `displayName`).
13
+ * The returned `value` is the live blueprint value when available, else the default.
14
+ * Its shape is discriminated by `type` (see {@link ThemeSetting.value}); note an
15
+ * IMAGE setting's value is an image REFERENCE (no `.url`) — resolve with
16
+ * `getDefaultSrc`/`getSrc`.
17
+ */
18
+ export declare function getThemeSetting(name: string): ThemeSetting | undefined;
19
+ /** Convenience: the resolved value of a global variable, or `undefined` if not found. */
20
+ export declare function getThemeSettingValue(name: string): any;
21
+ /** Theme color tokens. Each carries a resolved value and a `var(--id)` CSS reference. */
22
+ export declare function getThemeColors(): DesignToken[];
23
+ /** Theme typography tokens (text styles). Apply `className` or read `resolved` CSS values. */
24
+ export declare function getThemeTypography(): TypographyToken[];
25
+ /** Theme responsive breakpoints (`{ id, name, width }`). */
26
+ export declare function getThemeBreakpoints(): BreakpointToken[];
27
+ /** Theme keyframe/transition animations. Use `ref` as the CSS animation name. */
28
+ export declare function getThemeKeyframes(): KeyframeToken[];
29
+ /**
30
+ * Theme color schemes (palettes). Returns two PARALLEL lists with different jobs:
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
+ * - `values`: the actual palettes. A palette's colors live in its `colorsByScheme`
34
+ * map, keyed by slot id → `{ resolved, cssVar }`.
35
+ *
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:
40
+ *
41
+ * const { schemes, values } = getThemeColorSchemes();
42
+ * const slotName = (id: string) => schemes.find(s => s.id === id)?.name ?? id;
43
+ * values.forEach(palette =>
44
+ * Object.entries(palette.colorsByScheme).forEach(([slotId, { resolved, cssVar }]) => {
45
+ * // slotName(slotId) → label, cssVar → live var() ref (prefer this), resolved → hex snapshot
46
+ * })
47
+ * );
48
+ */
49
+ export declare function getThemeColorSchemes(): {
50
+ schemes: {
51
+ id: string;
52
+ name: string;
53
+ }[];
54
+ values: ColorSchemeToken[];
55
+ };
@@ -0,0 +1 @@
1
+ import{__assign as o}from'./../../ext/tslib/tslib.es6.mjs.js';import{IkasStorefrontConfig as l}from"../../packages/storefront-config/src/index.js";var n=null;function e(o){n=o}function i(l){return n&&l.name in n?o(o({},l),{value:n[l.name]}):l}function r(){var o,n;return Object.values(null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.settings)&&void 0!==n?n:{}).map(i)}function t(o){var n,e,r=null===(e=null===(n=l.themeGlobals)||void 0===n?void 0:n.settings)||void 0===e?void 0:e[o];return r?i(r):void 0}function u(o){var l;return null===(l=t(o))||void 0===l?void 0:l.value}function v(){var o,n;return null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.colors)&&void 0!==n?n:[]}function s(){var o,n;return null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.typography)&&void 0!==n?n:[]}function a(){var o,n;return null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.breakpoints)&&void 0!==n?n:[]}function d(){var o,n;return null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.keyframes)&&void 0!==n?n:[]}function m(){var o,n;return null!==(n=null===(o=l.themeGlobals)||void 0===o?void 0:o.colorSchemes)&&void 0!==n?n:{schemes:[],values:[]}}export{a as getThemeBreakpoints,m as getThemeColorSchemes,v as getThemeColors,d as getThemeKeyframes,t as getThemeSetting,u as getThemeSettingValue,r as getThemeSettings,s as getThemeTypography,e as registerThemeSettingValues};
@@ -30,8 +30,9 @@ interface IkasComponentRendererProps {
30
30
  /** Optional CSS class name applied to the wrapper div. */
31
31
  className?: string;
32
32
  }
33
- export declare function IkasComponentRenderer({ id: baseId, components, style, className, parentProps, map, }: IkasComponentRendererProps): import("preact").VNode<import("preact").ClassAttributes<HTMLElement> & {
33
+ export declare function IkasComponentRenderer({ id: baseId, components, style, className, parentProps, map, }: IkasComponentRendererProps): import("preact").VNode<import("preact").ClassAttributes<HTMLDivElement> & {
34
34
  id: string;
35
+ ref: import("preact/hooks").MutableRef<HTMLDivElement | null>;
35
36
  dangerouslySetInnerHTML: {
36
37
  __html: string;
37
38
  };
@@ -1 +1 @@
1
- import{__assign as r}from'./../ext/tslib/tslib.es6.mjs.js';import{createElement as t}from'./../ext/preact/dist/preact.mjs.js';import{useRef as n,useEffect as e,useMemo as o}from'./../ext/preact/hooks/dist/hooks.mjs.js';var c={};function s(s){var u=s.id,a=s.components,i=s.style,l=s.className,f=s.parentProps,m=void 0===f?c:f,d=s.map,p=void 0===d?c:d,h=n([]),v=n(m),j=n(p);v.current=m,j.current=p,e(function(){if(a&&0!==a.length){h.current.forEach(function(r){return r()}),h.current=[];for(var t=0;t<a.length;t++){var n=a[t];if(n.l){var e="".concat(u,"-").concat(t),o='[id="'.concat(u,'"] [id="').concat(e,'"]'),c=n.l(o,r(r({},v.current),j.current),{},{id:e,key:e});"function"==typeof c&&h.current.push(c)}}return function(){h.current.forEach(function(r){return r()}),h.current=[]}}},[a,u]);var y=o(function(){return a&&0!==a.length?a.map(function(t,n){var e="".concat(u,"-").concat(n);return t.r(r(r({},v.current),j.current),{},{id:e,key:e})}).join(""):""},[a,u]);return a&&0!==a.length?t("div",{id:u,dangerouslySetInnerHTML:{__html:y},style:r({display:"contents"},i),className:l}):null}export{s as IkasComponentRenderer};
1
+ import{__assign as r}from'./../ext/tslib/tslib.es6.mjs.js';import{createElement as t}from'./../ext/preact/dist/preact.mjs.js';import{useRef as n,useEffect as e,useMemo as o}from'./../ext/preact/hooks/dist/hooks.mjs.js';var c={};function u(r,t){for(var n=[],e=r;e;){var o=e.getAttribute("id");o&&n.unshift(o),e=e.parentElement}var c=n.map(function(r){return'[id="'.concat(r,'"]')}).join(" ");return c?"".concat(c,' [id="').concat(t,'"]'):'[id="'.concat(t,'"]')}function a(a){var s=a.id,i=a.components,f=a.style,l=a.className,m=a.parentProps,d=void 0===m?c:m,p=a.map,v=void 0===p?c:p,h=n([]),j=n(d),y=n(v),g=n(null);j.current=d,y.current=v,e(function(){if(i&&0!==i.length){h.current.forEach(function(r){return r()}),h.current=[];for(var t=0;t<i.length;t++){var n=i[t];if(n.l){var e="".concat(s,"-").concat(t),o=u(g.current,e),c=n.l(o,r(r({},j.current),y.current),{},{id:e,key:e});"function"==typeof c&&h.current.push(c)}}return function(){h.current.forEach(function(r){return r()}),h.current=[]}}},[i,s]);var E=o(function(){return i&&0!==i.length?i.map(function(t,n){var e="".concat(s,"-").concat(n);return t.r(r(r({},j.current),y.current),{},{id:e,key:e})}).join(""):""},[i,s]);return i&&0!==i.length?t("div",{id:s,ref:g,dangerouslySetInnerHTML:{__html:E},style:r({display:"contents"},f),className:l}):null}export{a as IkasComponentRenderer};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikas/bp-storefront",
3
- "version": "1.4.0-beta.8",
3
+ "version": "1.4.0-beta.80",
4
4
  "description": "A framework for the ikas blueprint storefronts.",
5
5
  "author": "ikas",
6
6
  "license": "ISC",