@gem-sdk/core 2.0.0-dev.713 → 2.0.0-dev.719

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.
@@ -209,18 +209,14 @@ const GRADIENT_BGR_KEY = 'linear-gradient';
209
209
  const getGradientBgrStyleForButton = (backgroundStyle)=>{
210
210
  if (!backgroundStyle) return;
211
211
  const bgrStyle = {};
212
- Object.keys(backgroundStyle).forEach((state)=>{
213
- if (!backgroundStyle[state]?.startsWith(GRADIENT_BGR_KEY)) return;
214
- if (state === 'normal') {
215
- Object.assign(bgrStyle, {
216
- '--bg': backgroundStyle[state]
217
- });
218
- } else {
219
- Object.assign(bgrStyle, {
220
- '--hvr-bg': backgroundStyle[state]
221
- });
222
- }
223
- });
212
+ for (const state of Object.keys(backgroundStyle)){
213
+ const color = backgroundStyle[state];
214
+ // Skip if not a gradient
215
+ if (!color?.startsWith(GRADIENT_BGR_KEY)) continue;
216
+ // Set normal or hover gradient
217
+ const cssVar = state === 'normal' ? '--bgi' : '--hvr-bgi';
218
+ bgrStyle[cssVar] = color;
219
+ }
224
220
  return bgrStyle;
225
221
  };
226
222
  const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage)=>{
@@ -71,8 +71,8 @@ const removeUndefinedValuesFromObject = (obj)=>{
71
71
  function sanitizeLiquid(input) {
72
72
  return input.replace(/\{\{\s*(.*?)\s*\}\}/g, (_, inner)=>{
73
73
  const trimmed = inner.trim();
74
- // eslint-disable-next-line regexp/no-unused-capturing-group, regexp/prefer-w, regexp/prefer-d
75
- const isValidLiquid = /^([a-zA-Z_][a-zA-Z0-9_]*)(\.[a-zA-Z0-9_]+)*$/.test(trimmed);
74
+ // eslint-disable-next-line regexp/no-unused-capturing-group, regexp/no-dupe-characters-character-class, regexp/prefer-w, regexp/prefer-d
75
+ const isValidLiquid = /^([a-zA-Z_][a-zA-Z0-9_-]*)(\.[a-zA-Z0-9_-]+)*$/i.test(trimmed);
76
76
  if (isValidLiquid) {
77
77
  return `{{ ${trimmed} }}`;
78
78
  }
@@ -207,18 +207,14 @@ const GRADIENT_BGR_KEY = 'linear-gradient';
207
207
  const getGradientBgrStyleForButton = (backgroundStyle)=>{
208
208
  if (!backgroundStyle) return;
209
209
  const bgrStyle = {};
210
- Object.keys(backgroundStyle).forEach((state)=>{
211
- if (!backgroundStyle[state]?.startsWith(GRADIENT_BGR_KEY)) return;
212
- if (state === 'normal') {
213
- Object.assign(bgrStyle, {
214
- '--bg': backgroundStyle[state]
215
- });
216
- } else {
217
- Object.assign(bgrStyle, {
218
- '--hvr-bg': backgroundStyle[state]
219
- });
220
- }
221
- });
210
+ for (const state of Object.keys(backgroundStyle)){
211
+ const color = backgroundStyle[state];
212
+ // Skip if not a gradient
213
+ if (!color?.startsWith(GRADIENT_BGR_KEY)) continue;
214
+ // Set normal or hover gradient
215
+ const cssVar = state === 'normal' ? '--bgi' : '--hvr-bgi';
216
+ bgrStyle[cssVar] = color;
217
+ }
222
218
  return bgrStyle;
223
219
  };
224
220
  const getGradientBgrStyleByDevice = (backgroundStyle, ignoreBackgroundImage)=>{
@@ -69,8 +69,8 @@ const removeUndefinedValuesFromObject = (obj)=>{
69
69
  function sanitizeLiquid(input) {
70
70
  return input.replace(/\{\{\s*(.*?)\s*\}\}/g, (_, inner)=>{
71
71
  const trimmed = inner.trim();
72
- // eslint-disable-next-line regexp/no-unused-capturing-group, regexp/prefer-w, regexp/prefer-d
73
- const isValidLiquid = /^([a-zA-Z_][a-zA-Z0-9_]*)(\.[a-zA-Z0-9_]+)*$/.test(trimmed);
72
+ // eslint-disable-next-line regexp/no-unused-capturing-group, regexp/no-dupe-characters-character-class, regexp/prefer-w, regexp/prefer-d
73
+ const isValidLiquid = /^([a-zA-Z_][a-zA-Z0-9_-]*)(\.[a-zA-Z0-9_-]+)*$/i.test(trimmed);
74
74
  if (isValidLiquid) {
75
75
  return `{{ ${trimmed} }}`;
76
76
  }
@@ -37370,7 +37370,7 @@ type Mapped<K, T> = NonNullable<T> extends ObjectDevices<infer U> ? {
37370
37370
  placeholder?: string;
37371
37371
  type: 'layout-selector';
37372
37372
  itemPerRow?: number;
37373
- popoverLabel?: string;
37373
+ popoverLabel?: LabelWithLang | string;
37374
37374
  itemSpacing?: 'large' | 'small';
37375
37375
  options?: Option<T>[];
37376
37376
  groups?: {
@@ -37686,7 +37686,7 @@ declare const makeFixedBgAttachment: (background?: ObjectDevices<Background>) =>
37686
37686
  };
37687
37687
  } | undefined;
37688
37688
  declare const GRADIENT_BGR_KEY = "linear-gradient";
37689
- declare const getGradientBgrStyleForButton: (backgroundStyle: Partial<Record<StateType, ColorValueType>> | undefined) => {} | undefined;
37689
+ declare const getGradientBgrStyleForButton: (backgroundStyle: Partial<Record<StateType, ColorValueType>> | undefined) => Record<string, string> | undefined;
37690
37690
  declare const getGradientBgrStyleByDevice: (backgroundStyle: Partial<Record<Devices, Background>> | undefined, ignoreBackgroundImage?: Record<Devices, boolean>) => {} | undefined;
37691
37691
  declare const getBgByDevice: (data: {
37692
37692
  backgroundColor: Partial<Record<Devices, string>> | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "2.0.0-dev.713",
3
+ "version": "2.0.0-dev.719",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",