@useinsider/guido 3.7.2-beta.1489585 → 3.7.2-beta.2220fb0
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.
- package/dist/@types/config/schemas.js +70 -66
- package/dist/composables/usePreviewMode.js +15 -14
- package/dist/composables/useRecommendationPreview.js +100 -0
- package/dist/config/compiler/recommendationCompilerRules.js +1 -1
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +92 -78
- package/dist/config/migrator/recommendation/htmlBuilder.js +59 -58
- package/dist/config/migrator/recommendation/settingsMapper.js +38 -33
- package/dist/extensions/Blocks/Recommendation/block.js +60 -41
- package/dist/extensions/Blocks/Recommendation/canvasPreview.css.js +16 -0
- package/dist/extensions/Blocks/Recommendation/constants/defaultConfig.js +41 -32
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +10 -11
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +369 -288
- package/dist/extensions/Blocks/Recommendation/controls/main/index.js +96 -82
- package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +39 -30
- package/dist/extensions/Blocks/Recommendation/controls/main/pricePlacement.js +133 -0
- package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +34 -28
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +338 -288
- package/dist/extensions/Blocks/Recommendation/extension.js +30 -30
- package/dist/extensions/Blocks/Recommendation/iconsRegistry.js +21 -7
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +64 -4
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +2 -3
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +7 -5
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +217 -155
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +31 -56
- package/dist/extensions/Blocks/Recommendation/templates/index.js +10 -29
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +135 -145
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +22 -43
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +96 -109
- package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +19 -24
- package/dist/extensions/Blocks/Recommendation/utils/tagName.js +22 -30
- package/dist/extensions/Blocks/controlFactories.js +133 -159
- package/dist/src/@types/config/schemas.d.ts +16 -0
- package/dist/src/composables/useConfig.d.ts +4 -0
- package/dist/src/composables/useRecommendationPreview.d.ts +10 -0
- package/dist/src/config/migrator/recommendation/settingsMapper.d.ts +1 -1
- package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +0 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +29 -3
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/index.d.ts +3 -1
- package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +1 -2
- package/dist/src/extensions/Blocks/Recommendation/controls/main/pricePlacement.d.ts +59 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +47 -20
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +16 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +13 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -3
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +47 -163
- package/dist/src/extensions/Blocks/Recommendation/types/nodeConfig.d.ts +15 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +0 -15
- package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +113 -0
- package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +9 -29
- package/dist/src/extensions/Blocks/controlFactories.d.ts +1 -11
- package/dist/src/stores/config.d.ts +36 -0
- package/package.json +1 -1
- package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +0 -216
- package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +0 -78
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Style Preserver Utility
|
|
3
|
+
*
|
|
4
|
+
* Captures and restores element styles during block regeneration.
|
|
5
|
+
* This ensures user styling is preserved when:
|
|
6
|
+
* - Layout changes (grid <-> list)
|
|
7
|
+
* - Cards per row changes
|
|
8
|
+
* - Composition order changes
|
|
9
|
+
*
|
|
10
|
+
* Works with the node config system to provide complete style persistence.
|
|
11
|
+
*/
|
|
12
|
+
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
13
|
+
import { ModificationDescription } from '@stripoinc/ui-editor-extensions';
|
|
14
|
+
/**
|
|
15
|
+
* Style properties that can be captured for text elements
|
|
16
|
+
*/
|
|
17
|
+
export interface TextElementStyles {
|
|
18
|
+
fontSize?: string;
|
|
19
|
+
fontFamily?: string;
|
|
20
|
+
fontWeight?: string;
|
|
21
|
+
fontStyle?: string;
|
|
22
|
+
color?: string;
|
|
23
|
+
textAlign?: string;
|
|
24
|
+
lineHeight?: string;
|
|
25
|
+
textDecoration?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Style properties for button elements
|
|
29
|
+
*/
|
|
30
|
+
export interface ButtonElementStyles extends TextElementStyles {
|
|
31
|
+
backgroundColor?: string;
|
|
32
|
+
borderRadius?: string;
|
|
33
|
+
border?: string;
|
|
34
|
+
padding?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Style properties for image elements
|
|
38
|
+
*/
|
|
39
|
+
export interface ImageElementStyles {
|
|
40
|
+
width?: string;
|
|
41
|
+
height?: string;
|
|
42
|
+
maxWidth?: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Complete captured styles for a recommendation block
|
|
46
|
+
*/
|
|
47
|
+
export interface CapturedStyles {
|
|
48
|
+
/** Product name text styles */
|
|
49
|
+
name: TextElementStyles;
|
|
50
|
+
/** Current price text styles */
|
|
51
|
+
price: TextElementStyles;
|
|
52
|
+
/** Original/old price text styles */
|
|
53
|
+
oldPrice: TextElementStyles;
|
|
54
|
+
/** Omnibus price text styles */
|
|
55
|
+
omnibusPrice: TextElementStyles;
|
|
56
|
+
/** Omnibus discount text styles */
|
|
57
|
+
omnibusDiscount: TextElementStyles;
|
|
58
|
+
/** CTA button styles */
|
|
59
|
+
button: ButtonElementStyles;
|
|
60
|
+
/** Product image styles */
|
|
61
|
+
image: ImageElementStyles;
|
|
62
|
+
/** Card background color */
|
|
63
|
+
cardBackgroundColor: string | null;
|
|
64
|
+
/** Column spacing in pixels */
|
|
65
|
+
columnSpacing: number;
|
|
66
|
+
/** Row spacing in pixels */
|
|
67
|
+
rowSpacing: number;
|
|
68
|
+
/** Element composition order */
|
|
69
|
+
composition: string[];
|
|
70
|
+
/** Element visibility flags */
|
|
71
|
+
visibility: Record<string, boolean>;
|
|
72
|
+
}
|
|
73
|
+
type DocumentModifier = {
|
|
74
|
+
modifyHtml: (node: ImmutableHtmlNode) => {
|
|
75
|
+
setStyle: (prop: string, value: string) => DocumentModifier;
|
|
76
|
+
};
|
|
77
|
+
apply: (description: ModificationDescription) => void;
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Capture all styles from a recommendation block
|
|
81
|
+
*
|
|
82
|
+
* Call this BEFORE any operation that regenerates the block HTML.
|
|
83
|
+
* The captured styles can then be restored after regeneration.
|
|
84
|
+
* @example
|
|
85
|
+
* // Before layout change
|
|
86
|
+
* const styles = captureStyles(this.currentNode);
|
|
87
|
+
*
|
|
88
|
+
* // ... regenerate block HTML ...
|
|
89
|
+
*
|
|
90
|
+
* // After regeneration
|
|
91
|
+
* restoreStyles(this.currentNode, this.api.getDocumentModifier(), styles);
|
|
92
|
+
* @param node - The block node to capture styles from
|
|
93
|
+
* @returns Complete captured styles object
|
|
94
|
+
*/
|
|
95
|
+
export declare function captureStyles(node: ImmutableHtmlNode | null | undefined): CapturedStyles;
|
|
96
|
+
/**
|
|
97
|
+
* Restore captured styles to a regenerated block
|
|
98
|
+
*
|
|
99
|
+
* Call this AFTER regenerating block HTML to reapply user styling.
|
|
100
|
+
* @example
|
|
101
|
+
* restoreStyles(this.currentNode, this.api.getDocumentModifier(), capturedStyles);
|
|
102
|
+
* @param node - The block node to restore styles to
|
|
103
|
+
* @param modifier - Document modifier for applying changes
|
|
104
|
+
* @param styles - Previously captured styles
|
|
105
|
+
*/
|
|
106
|
+
export declare function restoreStyles(node: ImmutableHtmlNode | null | undefined, modifier: DocumentModifier, styles: CapturedStyles): void;
|
|
107
|
+
/**
|
|
108
|
+
* Check if styles have meaningful content worth restoring
|
|
109
|
+
* @param styles - Captured styles to check
|
|
110
|
+
* @returns True if styles contain restorable content
|
|
111
|
+
*/
|
|
112
|
+
export declare function hasRestorableStyles(styles: CapturedStyles): boolean;
|
|
113
|
+
export {};
|
|
@@ -5,54 +5,33 @@
|
|
|
5
5
|
* Handles both standard DOM properties and Stripo's custom methods.
|
|
6
6
|
*/
|
|
7
7
|
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
8
|
+
/** Interface for nodes with standard tagName property */
|
|
9
|
+
interface NodeWithTagName {
|
|
10
|
+
tagName: string;
|
|
11
|
+
}
|
|
8
12
|
/** Interface for nodes with getStyle method */
|
|
9
13
|
export interface NodeWithGetStyle {
|
|
10
14
|
getStyle: (property: string) => string | null | undefined;
|
|
11
15
|
}
|
|
12
|
-
/** Interface for nodes with getComputedStyle method */
|
|
13
|
-
export interface NodeWithGetComputedStyle {
|
|
14
|
-
getComputedStyle: (property: string) => string | null | undefined;
|
|
15
|
-
}
|
|
16
|
-
/** Interface for nodes with getAttribute method */
|
|
17
|
-
export interface NodeWithGetAttribute {
|
|
18
|
-
getAttribute: (name: string) => string | null;
|
|
19
|
-
}
|
|
20
16
|
/** Interface for nodes with parent method */
|
|
21
17
|
export interface NodeWithParent {
|
|
22
18
|
parent: () => ImmutableHtmlNode | null;
|
|
23
19
|
}
|
|
24
|
-
/** Interface for nodes with querySelectorAll method */
|
|
25
|
-
export interface NodeWithQuerySelectorAll {
|
|
26
|
-
querySelectorAll: (selector: string) => ImmutableHtmlNode[];
|
|
27
|
-
}
|
|
28
20
|
/**
|
|
29
21
|
* Type guard to check if a node has getStyle method
|
|
30
22
|
* @param node - The node to check
|
|
31
23
|
*/
|
|
32
24
|
export declare function hasGetStyle(node: unknown): node is NodeWithGetStyle;
|
|
33
25
|
/**
|
|
34
|
-
* Type guard to check if a node has
|
|
35
|
-
* This is the only read that sees a background applied by Stripo's built-in
|
|
36
|
-
* "Block Background Color" control — it writes neither an inline style nor a
|
|
37
|
-
* queryable stylesheet rule, but the computed value is still resolvable.
|
|
38
|
-
* @param node - The node to check
|
|
39
|
-
*/
|
|
40
|
-
export declare function hasGetComputedStyle(node: unknown): node is NodeWithGetComputedStyle;
|
|
41
|
-
/**
|
|
42
|
-
* Type guard to check if a node has getAttribute method
|
|
43
|
-
* @param node - The node to check
|
|
44
|
-
*/
|
|
45
|
-
export declare function hasGetAttribute(node: unknown): node is NodeWithGetAttribute;
|
|
46
|
-
/**
|
|
47
|
-
* Type guard to check if a node has querySelectorAll method
|
|
26
|
+
* Type guard to check if a node has parent method
|
|
48
27
|
* @param node - The node to check
|
|
49
28
|
*/
|
|
50
|
-
export declare function
|
|
29
|
+
export declare function hasParent(node: unknown): node is NodeWithParent;
|
|
51
30
|
/**
|
|
52
|
-
* Type guard to check if a node
|
|
31
|
+
* Type guard to check if a node is a TD element
|
|
53
32
|
* @param node - The node to check
|
|
54
33
|
*/
|
|
55
|
-
export declare function
|
|
34
|
+
export declare function isTdNode(node: unknown): node is ImmutableHtmlNode & NodeWithTagName;
|
|
56
35
|
/**
|
|
57
36
|
* Safely retrieves a style value from a node
|
|
58
37
|
* @param node - The node to get the style from
|
|
@@ -95,3 +74,4 @@ export declare function isTableCellNode(node: ImmutableHtmlNode | null | undefin
|
|
|
95
74
|
* @returns The CSS display value ('table-cell' or 'table-row')
|
|
96
75
|
*/
|
|
97
76
|
export declare function getTableDisplayValue(node: ImmutableHtmlNode | null | undefined): 'table-cell' | 'table-row';
|
|
77
|
+
export {};
|
|
@@ -280,21 +280,11 @@ export declare function createButtonTextStyleAndFontColorControl(controlId: stri
|
|
|
280
280
|
new (): {
|
|
281
281
|
getId(): string;
|
|
282
282
|
getTargetNodes(root: ImmutableHtmlNode): ImmutableHtmlNode[];
|
|
283
|
-
/**
|
|
284
|
-
* Propagates Bold/Italic to ALL product buttons, not just the focused one.
|
|
285
|
-
*
|
|
286
|
-
* Stripo's built-in applies font-color/size to every target node but writes
|
|
287
|
-
* the text-style (font-weight/font-style) only to the selected button. Bold/italic
|
|
288
|
-
* are plain inline CSS on the `<a class="es-button">` (no tags), so we mirror them
|
|
289
|
-
* onto every button's anchor. The toggle state comes from the control's form
|
|
290
|
-
* (`buttonTextStyleForm.{bold,italic}`) because the patched node isn't updated yet
|
|
291
|
-
* when this runs. Returned modifications are merged into the parent control's patch.
|
|
292
|
-
*/
|
|
293
|
-
getAdditionalModifications(root: ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
294
283
|
getParentControlId(): string;
|
|
295
284
|
getLabels(): import("@stripoinc/ui-editor-extensions").ButtonTextStyleAndFontColorControlLabels | undefined;
|
|
296
285
|
api: import("@stripoinc/ui-editor-extensions").ControlApi;
|
|
297
286
|
getModificationDescription(): import("@stripoinc/ui-editor-extensions").ModificationDescription | undefined;
|
|
287
|
+
getAdditionalModifications(_root: ImmutableHtmlNode): import("@stripoinc/ui-editor-extensions").TemplateModifier<import("@stripoinc/ui-editor-extensions").HtmlNodeModifier, import("@stripoinc/ui-editor-extensions").CssNodeModifier> | undefined;
|
|
298
288
|
isVisible(_node: ImmutableHtmlNode): boolean;
|
|
299
289
|
};
|
|
300
290
|
};
|
|
@@ -65,6 +65,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
65
65
|
blockType?: string | undefined;
|
|
66
66
|
size?: string | number | undefined;
|
|
67
67
|
verticalResponsiveness?: boolean | undefined;
|
|
68
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
69
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
68
70
|
} & {
|
|
69
71
|
[key: string]: unknown;
|
|
70
72
|
};
|
|
@@ -197,6 +199,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
197
199
|
blockType?: string | undefined;
|
|
198
200
|
size?: string | number | undefined;
|
|
199
201
|
verticalResponsiveness?: boolean | undefined;
|
|
202
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
203
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
200
204
|
} & {
|
|
201
205
|
[key: string]: unknown;
|
|
202
206
|
};
|
|
@@ -329,6 +333,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
329
333
|
blockType?: string | undefined;
|
|
330
334
|
size?: string | number | undefined;
|
|
331
335
|
verticalResponsiveness?: boolean | undefined;
|
|
336
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
337
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
332
338
|
} & {
|
|
333
339
|
[key: string]: unknown;
|
|
334
340
|
};
|
|
@@ -461,6 +467,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
461
467
|
blockType?: string | undefined;
|
|
462
468
|
size?: string | number | undefined;
|
|
463
469
|
verticalResponsiveness?: boolean | undefined;
|
|
470
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
471
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
464
472
|
} & {
|
|
465
473
|
[key: string]: unknown;
|
|
466
474
|
};
|
|
@@ -593,6 +601,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
593
601
|
blockType?: string | undefined;
|
|
594
602
|
size?: string | number | undefined;
|
|
595
603
|
verticalResponsiveness?: boolean | undefined;
|
|
604
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
605
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
596
606
|
} & {
|
|
597
607
|
[key: string]: unknown;
|
|
598
608
|
};
|
|
@@ -725,6 +735,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
725
735
|
blockType?: string | undefined;
|
|
726
736
|
size?: string | number | undefined;
|
|
727
737
|
verticalResponsiveness?: boolean | undefined;
|
|
738
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
739
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
728
740
|
} & {
|
|
729
741
|
[key: string]: unknown;
|
|
730
742
|
};
|
|
@@ -857,6 +869,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
857
869
|
blockType?: string | undefined;
|
|
858
870
|
size?: string | number | undefined;
|
|
859
871
|
verticalResponsiveness?: boolean | undefined;
|
|
872
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
873
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
860
874
|
} & {
|
|
861
875
|
[key: string]: unknown;
|
|
862
876
|
};
|
|
@@ -989,6 +1003,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
989
1003
|
blockType?: string | undefined;
|
|
990
1004
|
size?: string | number | undefined;
|
|
991
1005
|
verticalResponsiveness?: boolean | undefined;
|
|
1006
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1007
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
992
1008
|
} & {
|
|
993
1009
|
[key: string]: unknown;
|
|
994
1010
|
};
|
|
@@ -1121,6 +1137,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1121
1137
|
blockType?: string | undefined;
|
|
1122
1138
|
size?: string | number | undefined;
|
|
1123
1139
|
verticalResponsiveness?: boolean | undefined;
|
|
1140
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1141
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1124
1142
|
} & {
|
|
1125
1143
|
[key: string]: unknown;
|
|
1126
1144
|
};
|
|
@@ -1253,6 +1271,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1253
1271
|
blockType?: string | undefined;
|
|
1254
1272
|
size?: string | number | undefined;
|
|
1255
1273
|
verticalResponsiveness?: boolean | undefined;
|
|
1274
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1275
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1256
1276
|
} & {
|
|
1257
1277
|
[key: string]: unknown;
|
|
1258
1278
|
};
|
|
@@ -1385,6 +1405,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1385
1405
|
blockType?: string | undefined;
|
|
1386
1406
|
size?: string | number | undefined;
|
|
1387
1407
|
verticalResponsiveness?: boolean | undefined;
|
|
1408
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1409
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1388
1410
|
} & {
|
|
1389
1411
|
[key: string]: unknown;
|
|
1390
1412
|
};
|
|
@@ -1517,6 +1539,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1517
1539
|
blockType?: string | undefined;
|
|
1518
1540
|
size?: string | number | undefined;
|
|
1519
1541
|
verticalResponsiveness?: boolean | undefined;
|
|
1542
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1543
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1520
1544
|
} & {
|
|
1521
1545
|
[key: string]: unknown;
|
|
1522
1546
|
};
|
|
@@ -1649,6 +1673,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1649
1673
|
blockType?: string | undefined;
|
|
1650
1674
|
size?: string | number | undefined;
|
|
1651
1675
|
verticalResponsiveness?: boolean | undefined;
|
|
1676
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1677
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1652
1678
|
} & {
|
|
1653
1679
|
[key: string]: unknown;
|
|
1654
1680
|
};
|
|
@@ -1781,6 +1807,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1781
1807
|
blockType?: string | undefined;
|
|
1782
1808
|
size?: string | number | undefined;
|
|
1783
1809
|
verticalResponsiveness?: boolean | undefined;
|
|
1810
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1811
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1784
1812
|
} & {
|
|
1785
1813
|
[key: string]: unknown;
|
|
1786
1814
|
};
|
|
@@ -1913,6 +1941,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
1913
1941
|
blockType?: string | undefined;
|
|
1914
1942
|
size?: string | number | undefined;
|
|
1915
1943
|
verticalResponsiveness?: boolean | undefined;
|
|
1944
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
1945
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
1916
1946
|
} & {
|
|
1917
1947
|
[key: string]: unknown;
|
|
1918
1948
|
};
|
|
@@ -2045,6 +2075,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2045
2075
|
blockType?: string | undefined;
|
|
2046
2076
|
size?: string | number | undefined;
|
|
2047
2077
|
verticalResponsiveness?: boolean | undefined;
|
|
2078
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
2079
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
2048
2080
|
} & {
|
|
2049
2081
|
[key: string]: unknown;
|
|
2050
2082
|
};
|
|
@@ -2177,6 +2209,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2177
2209
|
blockType?: string | undefined;
|
|
2178
2210
|
size?: string | number | undefined;
|
|
2179
2211
|
verticalResponsiveness?: boolean | undefined;
|
|
2212
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
2213
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
2180
2214
|
} & {
|
|
2181
2215
|
[key: string]: unknown;
|
|
2182
2216
|
};
|
|
@@ -2309,6 +2343,8 @@ export declare const useConfigStore: import("pinia").StoreDefinition<"guido-conf
|
|
|
2309
2343
|
blockType?: string | undefined;
|
|
2310
2344
|
size?: string | number | undefined;
|
|
2311
2345
|
verticalResponsiveness?: boolean | undefined;
|
|
2346
|
+
isPriceMovedToNextLine?: boolean | undefined;
|
|
2347
|
+
isPriceDeletedForZeroSale?: boolean | undefined;
|
|
2312
2348
|
} & {
|
|
2313
2349
|
[key: string]: unknown;
|
|
2314
2350
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@useinsider/guido",
|
|
3
|
-
"version": "3.7.2-beta.
|
|
3
|
+
"version": "3.7.2-beta.2220fb0",
|
|
4
4
|
"description": "Guido is a Vue + TypeScript wrapper for Email Plugin. Easily embed the email editor in your Vue applications.",
|
|
5
5
|
"main": "./dist/guido.umd.cjs",
|
|
6
6
|
"module": "./dist/library.js",
|
|
@@ -1,216 +0,0 @@
|
|
|
1
|
-
import { RecommendationBlockId as c } from "../constants/blockIds.js";
|
|
2
|
-
import { DESKTOP_CONTAINER_SELECTOR as S, ATTR_PRODUCT_NAME as k, ATTR_PRODUCT_PRICE as E, ATTR_PRODUCT_OLD_PRICE as h, ATTR_PRODUCT_OMNIBUS_PRICE as y, ATTR_PRODUCT_OMNIBUS_DISCOUNT as m, ATTR_PRODUCT_BUTTON as P, ATTR_PRODUCT_IMAGE as x, ATTR_PRODUCT_ATTR as v } from "../constants/selectors.js";
|
|
3
|
-
import { CSS_CLASS_TEXT_TRIM as B } from "../controls/shared/textTrimCssRules.js";
|
|
4
|
-
import { toCustomCompositionKey as U } from "../templates/utils.js";
|
|
5
|
-
import { extractWrapperTags as C } from "./preserveTextStyles.js";
|
|
6
|
-
import { hasQuerySelectorAll as A, hasGetAttribute as l, hasGetStyle as R, hasGetComputedStyle as q } from "./tagName.js";
|
|
7
|
-
const s = [
|
|
8
|
-
"font-size",
|
|
9
|
-
"font-family",
|
|
10
|
-
"font-weight",
|
|
11
|
-
"font-style",
|
|
12
|
-
"color",
|
|
13
|
-
"text-align",
|
|
14
|
-
"line-height",
|
|
15
|
-
"text-decoration"
|
|
16
|
-
], N = [
|
|
17
|
-
"background",
|
|
18
|
-
"background-color",
|
|
19
|
-
"border-width",
|
|
20
|
-
"border-color",
|
|
21
|
-
"border-style",
|
|
22
|
-
"border-radius"
|
|
23
|
-
], M = [
|
|
24
|
-
...s,
|
|
25
|
-
"background",
|
|
26
|
-
"background-color",
|
|
27
|
-
"padding",
|
|
28
|
-
"width",
|
|
29
|
-
"mso-border-alt",
|
|
30
|
-
"mso-padding-alt"
|
|
31
|
-
], D = [
|
|
32
|
-
"display",
|
|
33
|
-
"width",
|
|
34
|
-
"height",
|
|
35
|
-
"max-width",
|
|
36
|
-
"border-radius",
|
|
37
|
-
"margin"
|
|
38
|
-
], g = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), G = [
|
|
39
|
-
{ attrKey: k, blockId: c.NAME, kind: "text" },
|
|
40
|
-
{ attrKey: E, blockId: c.PRICE, kind: "text" },
|
|
41
|
-
{ attrKey: h, blockId: c.OLD_PRICE, kind: "text" },
|
|
42
|
-
{ attrKey: y, blockId: c.OMNIBUS_PRICE, kind: "text" },
|
|
43
|
-
{ attrKey: m, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
|
|
44
|
-
{ attrKey: P, blockId: c.BUTTON, kind: "button" },
|
|
45
|
-
{ attrKey: x, blockId: c.IMAGE, kind: "image" }
|
|
46
|
-
];
|
|
47
|
-
function _(t) {
|
|
48
|
-
return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
|
|
49
|
-
}
|
|
50
|
-
function L(t) {
|
|
51
|
-
return t && "getInnerText" in t && typeof t.getInnerText == "function" ? t.getInnerText().trim() : "";
|
|
52
|
-
}
|
|
53
|
-
function a(t, e, r) {
|
|
54
|
-
!e || !R(e) || r.forEach((n) => {
|
|
55
|
-
const i = e.getStyle(n);
|
|
56
|
-
i && i !== "inherit" && i !== "initial" && (t[n] = i);
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function I(t) {
|
|
60
|
-
return Object.entries(t).map(([e, r]) => `${e}: ${r};`).join(" ");
|
|
61
|
-
}
|
|
62
|
-
function O(t) {
|
|
63
|
-
if (!t || !R(t))
|
|
64
|
-
return;
|
|
65
|
-
const e = t.getStyle("background-color") || t.getStyle("background");
|
|
66
|
-
return e && !g.has(e) ? e : void 0;
|
|
67
|
-
}
|
|
68
|
-
function b(t, e) {
|
|
69
|
-
const r = {};
|
|
70
|
-
return a(r, t, e), I(r);
|
|
71
|
-
}
|
|
72
|
-
function w(t) {
|
|
73
|
-
const e = t.querySelector("p"), r = {};
|
|
74
|
-
a(r, t, s), a(r, e, s), a(r, t.querySelector("strong"), s), a(r, t.querySelector("em"), s), a(r, t.querySelector("s"), s);
|
|
75
|
-
const n = I(r), { openTags: i, closeTags: o } = C(_(e));
|
|
76
|
-
return !n && !i ? null : { pStyle: n || void 0, openTags: i, closeTags: o };
|
|
77
|
-
}
|
|
78
|
-
function K(t) {
|
|
79
|
-
const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = b(e, N), i = b(r, M), o = e && "getAttribute" in e ? e.getAttribute("class") ?? "" : "", u = /\bes-fw\b/.test(o), { openTags: T, closeTags: d } = C(_(r)), p = L(r);
|
|
80
|
-
return !n && !i && !u && !T && !p ? null : {
|
|
81
|
-
buttonBorderStyle: n || void 0,
|
|
82
|
-
buttonAnchorStyle: i || void 0,
|
|
83
|
-
buttonFitToContainer: u || void 0,
|
|
84
|
-
buttonText: p || void 0,
|
|
85
|
-
openTags: T,
|
|
86
|
-
closeTags: d
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function H(t) {
|
|
90
|
-
const e = b(t.querySelector("img"), D);
|
|
91
|
-
return e ? { imgStyle: e } : null;
|
|
92
|
-
}
|
|
93
|
-
function $(t, e) {
|
|
94
|
-
return e === "button" ? K(t) : e === "image" ? H(t) : w(t);
|
|
95
|
-
}
|
|
96
|
-
function f(t, e) {
|
|
97
|
-
if (!t || !("querySelector" in t))
|
|
98
|
-
return;
|
|
99
|
-
const r = t.querySelector(S) ?? t;
|
|
100
|
-
if (G.forEach(({ attrKey: o, blockId: u, kind: T }) => {
|
|
101
|
-
const d = r.querySelector(`[esd-extension-block-id="${u}"]`);
|
|
102
|
-
d && e(d, o, T);
|
|
103
|
-
}), !A(r))
|
|
104
|
-
return;
|
|
105
|
-
const n = /* @__PURE__ */ new Set();
|
|
106
|
-
r.querySelectorAll(
|
|
107
|
-
`[esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"]`
|
|
108
|
-
).forEach((o) => {
|
|
109
|
-
const u = l(o) ? o.getAttribute(v) : null;
|
|
110
|
-
!u || n.has(u) || (n.add(u), e(o, U(u), "text"));
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function F(t) {
|
|
114
|
-
const e = {};
|
|
115
|
-
return f(t, (r, n, i) => {
|
|
116
|
-
if (!("querySelector" in r))
|
|
117
|
-
return;
|
|
118
|
-
const o = $(r, i);
|
|
119
|
-
o && (e[n] = o);
|
|
120
|
-
}), e;
|
|
121
|
-
}
|
|
122
|
-
function j(t) {
|
|
123
|
-
if (!t || !("querySelector" in t))
|
|
124
|
-
return;
|
|
125
|
-
const e = t.querySelector(S) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
|
|
126
|
-
return O(r);
|
|
127
|
-
}
|
|
128
|
-
function X(t) {
|
|
129
|
-
if (!t)
|
|
130
|
-
return;
|
|
131
|
-
const e = l(t) ? t.getAttribute("bgcolor") : null;
|
|
132
|
-
if (e && !g.has(e))
|
|
133
|
-
return e;
|
|
134
|
-
const r = O(t);
|
|
135
|
-
if (r)
|
|
136
|
-
return r;
|
|
137
|
-
const n = q(t) ? t.getComputedStyle("background-color") : void 0;
|
|
138
|
-
return n && !g.has(n) ? n : void 0;
|
|
139
|
-
}
|
|
140
|
-
function z(t) {
|
|
141
|
-
const e = {};
|
|
142
|
-
return f(t, (r, n, i) => {
|
|
143
|
-
if (i !== "text")
|
|
144
|
-
return;
|
|
145
|
-
const o = X(r);
|
|
146
|
-
o && (e[n] = o);
|
|
147
|
-
}), e;
|
|
148
|
-
}
|
|
149
|
-
function Q(t) {
|
|
150
|
-
const e = {};
|
|
151
|
-
return f(t, (r, n, i) => {
|
|
152
|
-
if (i === "image")
|
|
153
|
-
return;
|
|
154
|
-
const o = l(r) ? r.getAttribute("align") : null;
|
|
155
|
-
o && (e[n] = o);
|
|
156
|
-
}), e;
|
|
157
|
-
}
|
|
158
|
-
const V = /^es-[pm]\d+[trbl]?$/;
|
|
159
|
-
function W(t) {
|
|
160
|
-
const e = l(t) ? t.getAttribute("class") : null;
|
|
161
|
-
if (!e)
|
|
162
|
-
return;
|
|
163
|
-
const r = e.split(/\s+/).filter((n) => V.test(n) || n === B);
|
|
164
|
-
return r.length ? r.join(" ") : void 0;
|
|
165
|
-
}
|
|
166
|
-
function Y(t) {
|
|
167
|
-
const e = {};
|
|
168
|
-
return f(t, (r, n, i) => {
|
|
169
|
-
if (i === "image")
|
|
170
|
-
return;
|
|
171
|
-
const o = W(r);
|
|
172
|
-
o && (e[n] = o);
|
|
173
|
-
}), e;
|
|
174
|
-
}
|
|
175
|
-
function J(t) {
|
|
176
|
-
const e = {};
|
|
177
|
-
return f(t, (r, n) => {
|
|
178
|
-
if (n !== y && n !== m || !l(r))
|
|
179
|
-
return;
|
|
180
|
-
const i = r.getAttribute("data-text-before"), o = r.getAttribute("data-text-after");
|
|
181
|
-
(i != null || o != null) && (e[n] = { before: i ?? void 0, after: o ?? void 0 });
|
|
182
|
-
}), e;
|
|
183
|
-
}
|
|
184
|
-
function Z(t) {
|
|
185
|
-
const e = {};
|
|
186
|
-
if (!t || !("querySelector" in t))
|
|
187
|
-
return e;
|
|
188
|
-
const r = t.querySelector(S) ?? t;
|
|
189
|
-
return A(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
|
|
190
|
-
if (!l(n))
|
|
191
|
-
return;
|
|
192
|
-
const i = n.getAttribute("data-attribute-type"), o = n.getAttribute("data-visibility");
|
|
193
|
-
i && o != null && (e[i] = o !== "0");
|
|
194
|
-
}), e;
|
|
195
|
-
}
|
|
196
|
-
function ut(t) {
|
|
197
|
-
return {
|
|
198
|
-
styleTemplates: F(t),
|
|
199
|
-
cardBackgroundColor: j(t),
|
|
200
|
-
cellBackgroundColors: z(t),
|
|
201
|
-
cellAlignments: Q(t),
|
|
202
|
-
cellClasses: Y(t),
|
|
203
|
-
omnibusTexts: J(t),
|
|
204
|
-
visibility: Z(t)
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
export {
|
|
208
|
-
F as captureAttributeStyleTemplates,
|
|
209
|
-
j as captureCardBackgroundColor,
|
|
210
|
-
Q as captureCellAlignments,
|
|
211
|
-
z as captureCellBackgroundColors,
|
|
212
|
-
Y as captureCellClasses,
|
|
213
|
-
J as captureOmnibusTexts,
|
|
214
|
-
ut as captureStyles,
|
|
215
|
-
Z as captureVisibility
|
|
216
|
-
};
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Capture Style Templates
|
|
3
|
-
*
|
|
4
|
-
* Reads the user-applied styling of each text attribute from the LIVE block DOM
|
|
5
|
-
* and turns it into per-attribute `AttributeStyleTemplate`s that the template
|
|
6
|
-
* renderers bake straight into regenerated HTML.
|
|
7
|
-
*
|
|
8
|
-
* Why this exists: a full regeneration replaces product cells via `setInnerHtml`.
|
|
9
|
-
* Querying the new cells to re-apply styles after `apply()` requires a second
|
|
10
|
-
* (deferred) commit, and multiple commits corrupt Stripo's selection tracking
|
|
11
|
-
* (the `textContent` crash). Baking the captured styles into the HTML keeps the
|
|
12
|
-
* whole regeneration a SINGLE `setInnerHtml` + SINGLE `apply()`.
|
|
13
|
-
*
|
|
14
|
-
* Inline formats (bold/italic/strike) are captured as TAGS (`<strong>/<em>/<s>`),
|
|
15
|
-
* not CSS, because Stripo applies and detects them as tags — re-emitting
|
|
16
|
-
* `text-decoration` CSS would render a strike its own toggle can't see.
|
|
17
|
-
*/
|
|
18
|
-
import type { AttributeStyleTemplates, OmnibusText, RenderOptions } from '../templates/utils';
|
|
19
|
-
import type { ImmutableHtmlNode } from '@stripoinc/ui-editor-extensions';
|
|
20
|
-
/**
|
|
21
|
-
* Captures per-attribute style templates (text + button + image) from the block's desktop
|
|
22
|
-
* container. Scoped to desktop so the mobile container's duplicate block ids aren't read.
|
|
23
|
-
* Returns only the attributes that actually have styling worth preserving.
|
|
24
|
-
*/
|
|
25
|
-
export declare function captureAttributeStyleTemplates(node: ImmutableHtmlNode | null | undefined): AttributeStyleTemplates;
|
|
26
|
-
/**
|
|
27
|
-
* Captures the card background color (the "Styles" tab control) from the first card
|
|
28
|
-
* container — `.product-card-segment` in grid, `.product-card-wrapper` in list. Returns
|
|
29
|
-
* undefined when unset/transparent so the renderer keeps its (bg-less) default.
|
|
30
|
-
*/
|
|
31
|
-
export declare function captureCardBackgroundColor(node: ImmutableHtmlNode | null | undefined): string | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Captures each text attribute's "Block Background Color" (Styles tab) from the block's
|
|
34
|
-
* desktop container, keyed by composition key. The renderers bake these
|
|
35
|
-
* straight onto the regenerated `[esd-extension-block-id]` cell so the bg survives a full
|
|
36
|
-
* regeneration — unlike the card background, the text-cell bg lives on the attribute cell
|
|
37
|
-
* itself and is only readable via `getComputedStyle` (see `readCellBackground`). Returns
|
|
38
|
-
* only the attributes that actually carry a non-transparent background.
|
|
39
|
-
*/
|
|
40
|
-
export declare function captureCellBackgroundColors(node: ImmutableHtmlNode | null | undefined): Record<string, string>;
|
|
41
|
-
/**
|
|
42
|
-
* Captures each text attribute's alignment from the cell's `align` attribute, keyed by
|
|
43
|
-
* composition key. Stripo's built-in `TextAlignBuiltInControl` writes the
|
|
44
|
-
* alignment as the `align` HTML attribute on the `[esd-extension-block-id]` cell (not as
|
|
45
|
-
* inline `text-align`), so the renderers' hardcoded `align` would otherwise reset it on
|
|
46
|
-
* every regeneration. We capture the current value and re-bake it.
|
|
47
|
-
*/
|
|
48
|
-
export declare function captureCellAlignments(node: ImmutableHtmlNode | null | undefined): Record<string, string>;
|
|
49
|
-
/**
|
|
50
|
-
* Captures each text/button cell's preservable classes (padding `es-p*`, margin `es-m*`,
|
|
51
|
-
* text-trim) keyed by composition key, so a regeneration can re-bake them
|
|
52
|
-
* instead of resetting to the renderer's hardcoded spacing classes. Stripo stores padding
|
|
53
|
-
* and margin as these classes (NOT inline style), so an inline-style capture misses them.
|
|
54
|
-
*/
|
|
55
|
-
export declare function captureCellClasses(node: ImmutableHtmlNode | null | undefined): Record<string, string>;
|
|
56
|
-
/**
|
|
57
|
-
* Captures the omnibus cells' editable before/after text (from the `data-text-before` /
|
|
58
|
-
* `data-text-after` attributes the omnibus text controls write), keyed by attr, so a
|
|
59
|
-
* regeneration re-bakes the user's wording instead of the renderer's hardcoded prefix.
|
|
60
|
-
*/
|
|
61
|
-
export declare function captureOmnibusTexts(node: ImmutableHtmlNode | null | undefined): Record<string, OmnibusText>;
|
|
62
|
-
/**
|
|
63
|
-
* Captures the current per-attribute visibility from the live block, keyed by composition
|
|
64
|
-
* attribute (`data-attribute-type`). The card-composition control toggles visibility by
|
|
65
|
-
* setting `display`/`data-visibility` on `.recommendation-attribute-row`s, but the renderers
|
|
66
|
-
* re-apply the hardcoded `DEFAULT_CARD_VISIBILITY` on regeneration — so a user who showed
|
|
67
|
-
* omnibus (default-hidden) or hid a row would lose it. Capturing the live `data-visibility`
|
|
68
|
-
* lets the rebuild honor the user's choice.
|
|
69
|
-
*/
|
|
70
|
-
export declare function captureVisibility(node: ImmutableHtmlNode | null | undefined): Record<string, boolean>;
|
|
71
|
-
/**
|
|
72
|
-
* The full bundle of user-applied styling captured from the live block before a
|
|
73
|
-
* regeneration replaces its cells. Threaded as ONE object (not a long positional list)
|
|
74
|
-
* into the rebuild so the regenerated HTML re-bakes every preserved value.
|
|
75
|
-
*/
|
|
76
|
-
export type StyleCaptures = Pick<RenderOptions, 'styleTemplates' | 'cardBackgroundColor' | 'cellBackgroundColors' | 'cellAlignments' | 'cellClasses' | 'omnibusTexts' | 'visibility'>;
|
|
77
|
-
/** Runs every capture against the live node and returns them as a single bundle. */
|
|
78
|
-
export declare function captureStyles(node: ImmutableHtmlNode | null | undefined): StyleCaptures;
|