@useinsider/guido 3.0.0-beta.a72fd61 → 3.0.0-beta.ae0075e
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/components/Guido.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue.js +1 -1
- package/dist/components/organisms/header/EditorActions.vue2.js +6 -6
- package/dist/components/organisms/onboarding/GenericOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/GenericOnboarding.vue2.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue.js +1 -1
- package/dist/components/organisms/onboarding/TextBlockOnboarding.vue2.js +2 -2
- package/dist/config/compiler/unsubscribeCompilerRules.js +14 -14
- package/dist/config/compiler/utils/recommendationCompilerUtils.js +29 -18
- package/dist/extensions/Blocks/Recommendation/block.js +3 -0
- package/dist/extensions/Blocks/Recommendation/constants/blockIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/controlIds.js +1 -1
- package/dist/extensions/Blocks/Recommendation/constants/selectors.js +15 -12
- package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +693 -144
- package/dist/extensions/Blocks/Recommendation/controls/customAttribute/index.js +78 -0
- package/dist/extensions/Blocks/Recommendation/controls/layout/index.js +27 -24
- package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +134 -126
- package/dist/extensions/Blocks/Recommendation/extension.js +18 -16
- package/dist/extensions/Blocks/Recommendation/recommendation.css.js +126 -2
- package/dist/extensions/Blocks/Recommendation/settingsPanel.js +124 -106
- package/dist/extensions/Blocks/Recommendation/store/recommendation.js +8 -7
- package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +63 -34
- package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +30 -33
- package/dist/extensions/Blocks/Recommendation/templates/index.js +8 -8
- package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +28 -13
- package/dist/extensions/Blocks/Recommendation/templates/list/template.js +25 -44
- package/dist/extensions/Blocks/Recommendation/templates/utils.js +62 -38
- package/dist/guido.css +1 -1
- package/dist/src/components/Guido.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/EditorActions.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/HeaderWrapper.vue.d.ts +1 -1
- package/dist/src/components/organisms/header/RightSlot.vue.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/block.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/constants/blockIds.d.ts +2 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/controlIds.d.ts +8 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +10 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +134 -44
- package/dist/src/extensions/Blocks/Recommendation/controls/customAttribute/index.d.ts +105 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/index.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +2 -0
- package/dist/src/extensions/Blocks/Recommendation/store/recommendation.d.ts +1 -0
- package/dist/src/extensions/Blocks/Recommendation/templates/grid/elementRenderer.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/elementRenderer.d.ts +1 -1
- package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +10 -4
- package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +37 -2
- package/dist/static/styles/base.css.js +7 -2
- package/dist/static/styles/variables.css.js +3 -0
- package/package.json +1 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { TextPaddingsBuiltInControl as d, ButtonBackgroundColorBuiltInControl as c, TextFontFamilyBuiltInControl as u, TextStyleBuiltInControl as i, TextSizeBuiltInControl as C, TextColorBuiltInControl as g, TextAlignBuiltInControl as a } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
2
|
+
import { RecommendationBlockId as l } from "../../constants/blockIds.js";
|
|
3
|
+
import { RecommendationControlId as e } from "../../constants/controlIds.js";
|
|
4
|
+
import { BLOCK_ROOT_SELECTOR as I, ATTR_PRODUCT_ATTR as s } from "../../constants/selectors.js";
|
|
5
|
+
function o(t) {
|
|
6
|
+
const n = t.closest(I);
|
|
7
|
+
if (!n)
|
|
8
|
+
return [];
|
|
9
|
+
const r = t.asElement().getAttribute(s);
|
|
10
|
+
if (r) {
|
|
11
|
+
const T = `[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"][${s}="${r}"]`;
|
|
12
|
+
return n.querySelectorAll(T);
|
|
13
|
+
}
|
|
14
|
+
return n.querySelectorAll(
|
|
15
|
+
`[esd-extension-block-id="${l.CUSTOM_ATTRIBUTE}"]`
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
const A = class extends a {
|
|
19
|
+
getId() {
|
|
20
|
+
return e.CUSTOM_ATTR_ALIGN;
|
|
21
|
+
}
|
|
22
|
+
getTargetNodes(t) {
|
|
23
|
+
return o(t);
|
|
24
|
+
}
|
|
25
|
+
}, _ = class extends g {
|
|
26
|
+
getId() {
|
|
27
|
+
return e.CUSTOM_ATTR_COLOR;
|
|
28
|
+
}
|
|
29
|
+
getTargetNodes(t) {
|
|
30
|
+
return o(t);
|
|
31
|
+
}
|
|
32
|
+
}, S = class extends C {
|
|
33
|
+
getId() {
|
|
34
|
+
return e.CUSTOM_ATTR_SIZE;
|
|
35
|
+
}
|
|
36
|
+
getTargetNodes(t) {
|
|
37
|
+
return o(t);
|
|
38
|
+
}
|
|
39
|
+
}, m = class extends i {
|
|
40
|
+
getId() {
|
|
41
|
+
return e.CUSTOM_ATTR_STYLE;
|
|
42
|
+
}
|
|
43
|
+
getTargetNodes(t) {
|
|
44
|
+
return o(t);
|
|
45
|
+
}
|
|
46
|
+
}, O = class extends u {
|
|
47
|
+
getId() {
|
|
48
|
+
return e.CUSTOM_ATTR_FONT_FAMILY;
|
|
49
|
+
}
|
|
50
|
+
getTargetNodes(t) {
|
|
51
|
+
return o(t);
|
|
52
|
+
}
|
|
53
|
+
}, R = class extends c {
|
|
54
|
+
getId() {
|
|
55
|
+
return e.CUSTOM_ATTR_BACKGROUND;
|
|
56
|
+
}
|
|
57
|
+
getTargetNodes(t) {
|
|
58
|
+
return o(t);
|
|
59
|
+
}
|
|
60
|
+
}, x = class extends d {
|
|
61
|
+
getId() {
|
|
62
|
+
return e.CUSTOM_ATTR_PADDINGS;
|
|
63
|
+
}
|
|
64
|
+
getTargetNodes(t) {
|
|
65
|
+
return o(t);
|
|
66
|
+
}
|
|
67
|
+
}, k = {
|
|
68
|
+
align: A,
|
|
69
|
+
color: _,
|
|
70
|
+
size: S,
|
|
71
|
+
style: m,
|
|
72
|
+
fontFamily: O,
|
|
73
|
+
background: R,
|
|
74
|
+
paddings: x
|
|
75
|
+
};
|
|
76
|
+
export {
|
|
77
|
+
k as CustomAttributeControls
|
|
78
|
+
};
|
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var r = (
|
|
4
|
-
import { ModificationDescription as
|
|
5
|
-
import { CommonControl as
|
|
6
|
-
import {
|
|
1
|
+
var A = Object.defineProperty;
|
|
2
|
+
var p = (e, o, t) => o in e ? A(e, o, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[o] = t;
|
|
3
|
+
var r = (e, o, t) => p(e, typeof o != "symbol" ? o + "" : o, t);
|
|
4
|
+
import { ModificationDescription as L } from "../../../../../node_modules/@stripoinc/ui-editor-extensions/dist/esm/index.js";
|
|
5
|
+
import { CommonControl as O } from "../../../common-control.js";
|
|
6
|
+
import { ATTR_DATA_CUSTOM_ATTRIBUTES as T } from "../../constants/selectors.js";
|
|
7
|
+
import { LAYOUT_OPTIONS as h, DEFAULT_MOBILE_ROW_SPACING as m, DEFAULT_MOBILE_COLUMN_SPACING as d, DEFAULT_ROW_SPACING as l, DEFAULT_COLUMN_SPACING as C } from "../../constants/layout.js";
|
|
8
|
+
import { DEFAULT_COMPOSITION as g } from "../../constants/defaultConfig.js";
|
|
7
9
|
import { RecommendationConfigService as s } from "../../services/configService.js";
|
|
8
|
-
import { useRecommendationExtensionStore as
|
|
9
|
-
import { getCurrentLayout as
|
|
10
|
-
const
|
|
10
|
+
import { useRecommendationExtensionStore as N } from "../../store/recommendation.js";
|
|
11
|
+
import { getCurrentLayout as _, getBlockElement as f, regenerateProductRowsWithStyles as S } from "../main/utils.js";
|
|
12
|
+
const I = "recommendation-layout-control", a = {
|
|
11
13
|
LAYOUT: "layout"
|
|
12
|
-
}, n = {
|
|
14
|
+
}, U = "data-card-composition", n = {
|
|
13
15
|
LAYOUT: "data-layout",
|
|
14
16
|
COLUMN_SPACING: "data-column-spacing",
|
|
15
17
|
ROW_SPACING: "data-row-spacing",
|
|
16
18
|
MOBILE_COLUMN_SPACING: "data-mobile-column-spacing",
|
|
17
19
|
MOBILE_ROW_SPACING: "data-mobile-row-spacing"
|
|
18
20
|
};
|
|
19
|
-
class
|
|
21
|
+
class w extends O {
|
|
20
22
|
constructor() {
|
|
21
23
|
super(...arguments);
|
|
22
|
-
r(this, "store",
|
|
24
|
+
r(this, "store", N());
|
|
23
25
|
r(this, "isChangingLayout", !1);
|
|
24
26
|
}
|
|
25
27
|
getId() {
|
|
26
|
-
return
|
|
28
|
+
return I;
|
|
27
29
|
}
|
|
28
30
|
getTemplate() {
|
|
29
31
|
return `
|
|
@@ -32,7 +34,7 @@ class G extends h {
|
|
|
32
34
|
this._GuLabel({ text: "Layout Orientation" }),
|
|
33
35
|
this._GuRadioButton({
|
|
34
36
|
name: a.LAYOUT,
|
|
35
|
-
buttons:
|
|
37
|
+
buttons: h
|
|
36
38
|
})
|
|
37
39
|
])}
|
|
38
40
|
</div>
|
|
@@ -45,7 +47,7 @@ class G extends h {
|
|
|
45
47
|
super.onTemplateNodeUpdated(t), this._setFormValues();
|
|
46
48
|
}
|
|
47
49
|
_setFormValues() {
|
|
48
|
-
const u = s.getConfig(this.currentNode).layout ||
|
|
50
|
+
const u = s.getConfig(this.currentNode).layout || _(this.currentNode);
|
|
49
51
|
this.api.updateValues({
|
|
50
52
|
[a.LAYOUT]: u
|
|
51
53
|
});
|
|
@@ -55,9 +57,9 @@ class G extends h {
|
|
|
55
57
|
* Updates node config, data attribute and regenerates product rows
|
|
56
58
|
*/
|
|
57
59
|
_onLayoutChange(t) {
|
|
58
|
-
if (this.isChangingLayout || !this.currentNode || (s.getConfig(this.currentNode).layout ||
|
|
60
|
+
if (this.isChangingLayout || !this.currentNode || (s.getConfig(this.currentNode).layout || _(this.currentNode)) === t)
|
|
59
61
|
return;
|
|
60
|
-
const c =
|
|
62
|
+
const c = f(this.currentNode);
|
|
61
63
|
if (c) {
|
|
62
64
|
this.isChangingLayout = !0;
|
|
63
65
|
try {
|
|
@@ -66,15 +68,15 @@ class G extends h {
|
|
|
66
68
|
this.currentNode,
|
|
67
69
|
{
|
|
68
70
|
layout: t,
|
|
69
|
-
columnSpacing:
|
|
71
|
+
columnSpacing: C,
|
|
70
72
|
rowSpacing: l,
|
|
71
73
|
mobileColumnSpacing: d,
|
|
72
74
|
mobileRowSpacing: m
|
|
73
75
|
},
|
|
74
76
|
`Changed layout to ${t}`
|
|
75
77
|
), this.store.patchCurrentBlockConfig({ orientation: t });
|
|
76
|
-
const i = this.api.getDocumentModifier().modifyHtml(c).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING,
|
|
77
|
-
t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), i.apply(new
|
|
78
|
+
const i = this.api.getDocumentModifier().modifyHtml(c).setAttribute(n.LAYOUT, t).setAttribute(n.COLUMN_SPACING, C.toString()).setAttribute(n.ROW_SPACING, l.toString()).setAttribute(n.MOBILE_COLUMN_SPACING, d.toString()).setAttribute(n.MOBILE_ROW_SPACING, m.toString());
|
|
79
|
+
t === "list" ? (i.setClass("es-m-p0"), i.setClass("ins-recommendation-list-layout")) : (i.removeClass("es-m-p0"), i.removeClass("ins-recommendation-list-layout")), i.setAttribute(U, g.join(",")).setAttribute(T, "[]"), i.apply(new L(`Update layout to ${t}`)), this._regenerateProductRows(t);
|
|
78
80
|
} finally {
|
|
79
81
|
this.isChangingLayout = !1;
|
|
80
82
|
}
|
|
@@ -86,10 +88,11 @@ class G extends h {
|
|
|
86
88
|
* @param layout - The layout to use for regeneration (passed explicitly to avoid stale DOM reads)
|
|
87
89
|
*/
|
|
88
90
|
_regenerateProductRows(t) {
|
|
89
|
-
this.currentNode &&
|
|
91
|
+
this.currentNode && S({
|
|
90
92
|
currentNode: this.currentNode,
|
|
91
93
|
documentModifier: this.api.getDocumentModifier(),
|
|
92
|
-
layout: t
|
|
94
|
+
layout: t,
|
|
95
|
+
composition: g
|
|
93
96
|
});
|
|
94
97
|
}
|
|
95
98
|
_listenToFormUpdates() {
|
|
@@ -99,6 +102,6 @@ class G extends h {
|
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
104
|
export {
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
I as LAYOUT_CONTROL_ID,
|
|
106
|
+
w as LayoutControl
|
|
104
107
|
};
|