@useinsider/guido 3.8.0 → 3.8.1-beta.1a5be20

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 (52) hide show
  1. package/dist/composables/useHtmlValidator.js +180 -133
  2. package/dist/config/compiler/utils/recommendationCompilerUtils.js +64 -69
  3. package/dist/config/compiler/utils/recommendationIgnoreUtils.js +15 -0
  4. package/dist/config/migrator/recommendation/extractors.js +44 -22
  5. package/dist/config/migrator/recommendation/htmlBuilder.js +175 -169
  6. package/dist/config/migrator/recommendationMigrator.js +30 -31
  7. package/dist/extensions/Blocks/Recommendation/constants/selectors.js +22 -15
  8. package/dist/extensions/Blocks/Recommendation/controls/cardComposition/index.js +55 -41
  9. package/dist/extensions/Blocks/Recommendation/controls/main/index.js +42 -43
  10. package/dist/extensions/Blocks/Recommendation/controls/main/layoutOrientation.js +48 -45
  11. package/dist/extensions/Blocks/Recommendation/controls/main/productCount.js +3 -2
  12. package/dist/extensions/Blocks/Recommendation/controls/main/productLayout.js +64 -60
  13. package/dist/extensions/Blocks/Recommendation/controls/main/utils.js +294 -335
  14. package/dist/extensions/Blocks/Recommendation/controls/syncInfoMessage.js +7 -6
  15. package/dist/extensions/Blocks/Recommendation/extension.js +7 -5
  16. package/dist/extensions/Blocks/Recommendation/settingsPanel.js +4 -2
  17. package/dist/extensions/Blocks/Recommendation/store/recommendation.js +3 -2
  18. package/dist/extensions/Blocks/Recommendation/templates/grid/elementRenderer.js +142 -173
  19. package/dist/extensions/Blocks/Recommendation/templates/grid/template.js +56 -29
  20. package/dist/extensions/Blocks/Recommendation/templates/index.js +30 -8
  21. package/dist/extensions/Blocks/Recommendation/templates/list/elementRenderer.js +132 -105
  22. package/dist/extensions/Blocks/Recommendation/templates/list/template.js +44 -23
  23. package/dist/extensions/Blocks/Recommendation/templates/utils.js +112 -64
  24. package/dist/extensions/Blocks/Recommendation/utils/captureStyleTemplates.js +219 -0
  25. package/dist/extensions/Blocks/Recommendation/utils/preserveTextStyles.js +24 -19
  26. package/dist/extensions/Blocks/Recommendation/utils/tagName.js +30 -22
  27. package/dist/extensions/Blocks/Unsubscribe/block.js +1 -1
  28. package/dist/extensions/Blocks/controlFactories.js +159 -133
  29. package/dist/src/composables/useHtmlValidator.d.ts +27 -0
  30. package/dist/src/composables/useHtmlValidator.test.d.ts +1 -0
  31. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.d.ts +17 -0
  32. package/dist/src/config/compiler/utils/recommendationIgnoreUtils.test.d.ts +1 -0
  33. package/dist/src/config/migrator/recommendation/extractors.d.ts +15 -0
  34. package/dist/src/config/migrator/recommendation/htmlBuilder.d.ts +8 -0
  35. package/dist/src/extensions/Blocks/Items/controls/index.d.ts +1 -1
  36. package/dist/src/extensions/Blocks/Recommendation/constants/index.d.ts +1 -1
  37. package/dist/src/extensions/Blocks/Recommendation/constants/selectors.d.ts +23 -0
  38. package/dist/src/extensions/Blocks/Recommendation/controls/button/index.d.ts +1 -1
  39. package/dist/src/extensions/Blocks/Recommendation/controls/cardComposition/index.d.ts +7 -0
  40. package/dist/src/extensions/Blocks/Recommendation/controls/main/layoutOrientation.d.ts +7 -1
  41. package/dist/src/extensions/Blocks/Recommendation/controls/main/productLayout.d.ts +6 -0
  42. package/dist/src/extensions/Blocks/Recommendation/controls/main/utils.d.ts +29 -47
  43. package/dist/src/extensions/Blocks/Recommendation/templates/grid/template.d.ts +4 -4
  44. package/dist/src/extensions/Blocks/Recommendation/templates/index.d.ts +1 -1
  45. package/dist/src/extensions/Blocks/Recommendation/templates/list/template.d.ts +3 -2
  46. package/dist/src/extensions/Blocks/Recommendation/templates/utils.d.ts +165 -11
  47. package/dist/src/extensions/Blocks/Recommendation/utils/captureStyleTemplates.d.ts +78 -0
  48. package/dist/src/extensions/Blocks/Recommendation/utils/preserveTextStyles.d.ts +15 -0
  49. package/dist/src/extensions/Blocks/Recommendation/utils/tagName.d.ts +29 -9
  50. package/dist/src/extensions/Blocks/controlFactories.d.ts +11 -1
  51. package/package.json +1 -1
  52. package/dist/src/extensions/Blocks/Recommendation/utils/stylePreserver.d.ts +0 -113
@@ -1,66 +1,101 @@
1
- import { ATTR_CUSTOM_PREFIX as d, ATTR_PRODUCT_IMAGE as u, ATTR_PRODUCT_NAME as p, ATTR_PRODUCT_OLD_PRICE as m, ATTR_PRODUCT_PRICE as b, ATTR_PRODUCT_OMNIBUS_PRICE as T, ATTR_PRODUCT_OMNIBUS_DISCOUNT as _, ATTR_PRODUCT_BUTTON as g } from "../constants/selectors.js";
2
- function y(t) {
3
- return t.replace(/_/g, " ").replace(/\b\w/g, (e) => e.toUpperCase());
4
- }
1
+ import { ATTR_CUSTOM_PREFIX as c, PRODUCT_ATTRIBUTE_PREFIX as l, ATTR_PRODUCT_IMAGE as b, ATTR_PRODUCT_NAME as T, ATTR_PRODUCT_OLD_PRICE as g, ATTR_PRODUCT_PRICE as _, ATTR_PRODUCT_OMNIBUS_PRICE as f, ATTR_PRODUCT_OMNIBUS_DISCOUNT as p, ATTR_PRODUCT_BUTTON as m } from "../constants/selectors.js";
5
2
  function U(t) {
6
- const e = Array.isArray(t) ? t[t.length - 1] : t;
7
- if (typeof e == "string")
8
- return e;
9
- if (typeof e == "number")
10
- return String(e);
3
+ return t.replace(/_/g, " ").replace(/\b\w/g, (n) => n.toUpperCase());
4
+ }
5
+ function S(t) {
6
+ const n = Array.isArray(t) ? t[t.length - 1] : t;
7
+ if (typeof n == "string")
8
+ return n;
9
+ if (typeof n == "number")
10
+ return String(n);
11
+ }
12
+ function C(t, n) {
13
+ const e = Object.values(n).find((o) => o.attributeName === t);
14
+ return (e == null ? void 0 : e.type) === "defaultAttribute";
11
15
  }
12
- function C(t, e) {
13
- const n = Object.values(e).find((r) => r.attributeName === t);
14
- return (n == null ? void 0 : n.type) === "defaultAttribute";
16
+ function E(t, n) {
17
+ return C(t, n) ? t : `${l}${t}`;
15
18
  }
16
- function h(t, e) {
17
- return C(t, e) ? t : `product_attribute.${t}`;
19
+ function M(t) {
20
+ const n = t.startsWith(l) ? t.substring(l.length) : t;
21
+ return `${c}${n}`;
18
22
  }
19
23
  const P = Symbol("customCellHtml");
20
- function L(t, e, n = {}) {
21
- const r = t[P];
22
- if (!r)
24
+ function k(t, n, e = {}) {
25
+ const o = t[P];
26
+ if (!o)
23
27
  return { ...t };
24
- const i = { ...t };
25
- return e.filter((o) => o.startsWith(d) && !i[o]).forEach((o) => {
26
- const s = o.substring(d.length), l = y(s), A = h(s, n), R = C(s, n);
27
- i[o] = (c) => {
28
- var a;
29
- const D = R ? c[s] : (a = c.product_attributes) == null ? void 0 : a[s], O = U(D) ?? l;
30
- return r(A, O);
28
+ const s = { ...t };
29
+ return n.filter((r) => r.startsWith(c) && !s[r]).forEach((r) => {
30
+ const i = r.substring(c.length), a = U(i), y = E(i, e), R = C(i, e);
31
+ s[r] = (d, A) => {
32
+ var u;
33
+ const D = R ? d[i] : (u = d.product_attributes) == null ? void 0 : u[i], O = S(D) ?? a;
34
+ return o(y, O, A);
31
35
  };
32
- }), i;
36
+ }), s;
33
37
  }
34
- const M = {
38
+ const x = {
35
39
  TITLE: "You May Also Like!"
36
- }, $ = [
37
- u,
38
- p,
39
- m,
40
+ }, v = [
40
41
  b,
41
42
  T,
43
+ g,
42
44
  _,
43
- g
44
- ], w = {
45
- [u]: !0,
46
- [p]: !0,
45
+ f,
46
+ p,
47
+ m
48
+ ], F = {
47
49
  [b]: !0,
48
- [m]: !0,
49
- [T]: !1,
50
- [_]: !1,
51
- [g]: !0
52
- }, I = `
50
+ [T]: !0,
51
+ [_]: !0,
52
+ [g]: !0,
53
+ [f]: !1,
54
+ [p]: !1,
55
+ [m]: !0
56
+ }, I = 10;
57
+ function $(t = I) {
58
+ return `
53
59
  <tr>
54
- <td class="spacer" style="height: 10px;"></td>
60
+ <td class="spacer" style="height: ${t}px;"></td>
55
61
  </tr>
56
- `, f = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
57
- function N(t) {
58
- return !t || typeof t != "string" || t.trim() === "" ? f : t.startsWith("http://") ? t.replace("http://", "https://") : t;
62
+ `;
63
+ }
64
+ const L = $();
65
+ function w(t, n) {
66
+ return n ? n.pStyle ?? "" : t;
67
+ }
68
+ function W(t, n, e) {
69
+ const o = w(n.pStyle, e), s = e ? e.openTags ?? "" : n.openTags, r = e ? e.closeTags ?? "" : n.closeTags;
70
+ return `<p contenteditable="false" style="${o}">${s}${t}${r}</p>`;
71
+ }
72
+ function H(t, n) {
73
+ const e = [];
74
+ return t && e.push(t), n && e.push(`background-color: ${n};`), e.join(" ");
75
+ }
76
+ function Y(t) {
77
+ return t ? ` style="background-color: ${t};"` : "";
78
+ }
79
+ function G(t, n = "") {
80
+ return {
81
+ before: (t == null ? void 0 : t.before) ?? n,
82
+ after: (t == null ? void 0 : t.after) ?? ""
83
+ };
84
+ }
85
+ function z(t, n) {
86
+ return `${(n == null ? void 0 : n.openTags) ?? ""}${t}${(n == null ? void 0 : n.closeTags) ?? ""}`;
87
+ }
88
+ function X(t) {
89
+ return t != null && t.buttonFitToContainer ? "es-button-border es-fw" : "es-button-border";
90
+ }
91
+ const j = "display: block; max-width: 100%; height: auto;", V = "border-width: 1px; background: rgb(217, 234, 211); border-color: rgb(106, 168, 79);", K = "color: rgb(56, 118, 29); background: rgb(217, 234, 211); font-family: arial, 'helvetica neue', helvetica, sans-serif; font-size: 16px; font-weight: normal; line-height: 120%; mso-border-alt: 10px solid rgb(217, 234, 211); mso-padding-alt: 0;", h = "https://email-static.useinsider.com/stripo/modules/email-recommendation-v3/assets/images/image-placeholder.png";
92
+ function q(t) {
93
+ return !t || typeof t != "string" || t.trim() === "" ? h : t.startsWith("http://") ? t.replace("http://", "https://") : t;
59
94
  }
60
- function E(t) {
95
+ function B(t) {
61
96
  return {
62
97
  name: "Product Name",
63
- image_url: f,
98
+ image_url: h,
64
99
  price: { USD: 18 },
65
100
  original_price: { USD: 20 },
66
101
  discount: { USD: 2 },
@@ -72,19 +107,19 @@ function E(t) {
72
107
  category: []
73
108
  };
74
109
  }
75
- function k(t = 6) {
110
+ function J(t = 6) {
76
111
  return Array.from(
77
112
  { length: t },
78
- (e, n) => E(String(n + 1))
113
+ (n, e) => B(String(e + 1))
79
114
  );
80
115
  }
81
- function x(t = "grid", e) {
82
- const n = t === "list" ? `
83
- data-layout="list"` : "", r = e ? ` ${e}` : "";
116
+ function Q(t = "grid", n) {
117
+ const e = t === "list" ? `
118
+ data-layout="list"` : "", o = n ? ` ${n}` : "";
84
119
  return `
85
120
  <td
86
121
  align="left"
87
- class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${r}`}"${n}>
122
+ class="${`recommendation-block-v2 esd-block-recommendation-v3-block es-p20${t === "list" ? " es-m-p0 ins-recommendation-list-layout" : ""}${o}`}"${e}>
88
123
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
89
124
  <tr>
90
125
  <td align="center">
@@ -116,7 +151,7 @@ function x(t = "grid", e) {
116
151
  </table>
117
152
  </td>
118
153
  </tr>
119
- ${I}
154
+ ${L}
120
155
  <tr>
121
156
  <td>
122
157
  <table
@@ -156,17 +191,30 @@ function x(t = "grid", e) {
156
191
  }
157
192
  export {
158
193
  P as CUSTOM_CELL_HTML,
159
- M as DEFAULTS,
160
- $ as DEFAULT_CARD_COMPOSITION,
161
- w as DEFAULT_CARD_VISIBILITY,
162
- f as PLACEHOLDER_IMAGE,
163
- L as buildElementRenderer,
164
- x as createBlockTemplate,
165
- k as getDefaultProducts,
194
+ x as DEFAULTS,
195
+ K as DEFAULT_BUTTON_ANCHOR_STYLE,
196
+ V as DEFAULT_BUTTON_BORDER_STYLE,
197
+ v as DEFAULT_CARD_COMPOSITION,
198
+ F as DEFAULT_CARD_VISIBILITY,
199
+ j as DEFAULT_IMG_STYLE,
200
+ I as DEFAULT_ROW_SPACING_PX,
201
+ h as PLACEHOLDER_IMAGE,
202
+ k as buildElementRenderer,
203
+ $ as buildSpacer,
204
+ Y as cellBgStyleAttr,
205
+ Q as createBlockTemplate,
206
+ J as getDefaultProducts,
166
207
  C as isDefaultAttribute,
167
- h as resolveProductAttrValue,
168
- N as sanitizeImageUrl,
169
- I as spacer,
170
- y as toDisplayName,
171
- U as toDisplayableAttributeValue
208
+ z as renderButtonLabel,
209
+ W as renderStyledParagraph,
210
+ X as resolveButtonBorderClass,
211
+ G as resolveOmnibusText,
212
+ w as resolvePStyle,
213
+ E as resolveProductAttrValue,
214
+ H as resolveSegmentBgStyle,
215
+ q as sanitizeImageUrl,
216
+ L as spacer,
217
+ M as toCustomCompositionKey,
218
+ U as toDisplayName,
219
+ S as toDisplayableAttributeValue
172
220
  };
@@ -0,0 +1,219 @@
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
+ // Stripo's Border Radius control writes the radius to the anchor too, not just the
28
+ // border span — capture it so it survives regeneration (symmetric with BUTTON_BORDER_PROPS).
29
+ "border-radius",
30
+ "padding",
31
+ "width",
32
+ "mso-border-alt",
33
+ "mso-padding-alt"
34
+ ], D = [
35
+ "display",
36
+ "width",
37
+ "height",
38
+ "max-width",
39
+ "border-radius",
40
+ "margin"
41
+ ], b = /* @__PURE__ */ new Set(["transparent", "rgba(0, 0, 0, 0)"]), G = [
42
+ { attrKey: k, blockId: c.NAME, kind: "text" },
43
+ { attrKey: E, blockId: c.PRICE, kind: "text" },
44
+ { attrKey: h, blockId: c.OLD_PRICE, kind: "text" },
45
+ { attrKey: y, blockId: c.OMNIBUS_PRICE, kind: "text" },
46
+ { attrKey: m, blockId: c.OMNIBUS_DISCOUNT, kind: "text" },
47
+ { attrKey: P, blockId: c.BUTTON, kind: "button" },
48
+ { attrKey: x, blockId: c.IMAGE, kind: "image" }
49
+ ];
50
+ function _(t) {
51
+ return t && "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "";
52
+ }
53
+ function L(t) {
54
+ return t && "getInnerText" in t && typeof t.getInnerText == "function" ? t.getInnerText().trim() : "";
55
+ }
56
+ function a(t, e, r) {
57
+ !e || !R(e) || r.forEach((n) => {
58
+ const i = e.getStyle(n);
59
+ i && i !== "inherit" && i !== "initial" && (t[n] = i);
60
+ });
61
+ }
62
+ function I(t) {
63
+ return Object.entries(t).map(([e, r]) => `${e}: ${r};`).join(" ");
64
+ }
65
+ function O(t) {
66
+ if (!t || !R(t))
67
+ return;
68
+ const e = t.getStyle("background-color") || t.getStyle("background");
69
+ return e && !b.has(e) ? e : void 0;
70
+ }
71
+ function g(t, e) {
72
+ const r = {};
73
+ return a(r, t, e), I(r);
74
+ }
75
+ function w(t) {
76
+ const e = t.querySelector("p"), r = {};
77
+ 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);
78
+ const n = I(r), { openTags: i, closeTags: o } = C(_(e));
79
+ return !n && !i ? null : { pStyle: n || void 0, openTags: i, closeTags: o };
80
+ }
81
+ function K(t) {
82
+ const e = t.querySelector(".es-button-border"), r = t.querySelector("a.es-button") ?? t.querySelector("a"), n = g(e, N), i = g(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);
83
+ return !n && !i && !u && !T && !p ? null : {
84
+ buttonBorderStyle: n || void 0,
85
+ buttonAnchorStyle: i || void 0,
86
+ buttonFitToContainer: u || void 0,
87
+ buttonText: p || void 0,
88
+ openTags: T,
89
+ closeTags: d
90
+ };
91
+ }
92
+ function H(t) {
93
+ const e = g(t.querySelector("img"), D);
94
+ return e ? { imgStyle: e } : null;
95
+ }
96
+ function $(t, e) {
97
+ return e === "button" ? K(t) : e === "image" ? H(t) : w(t);
98
+ }
99
+ function f(t, e) {
100
+ if (!t || !("querySelector" in t))
101
+ return;
102
+ const r = t.querySelector(S) ?? t;
103
+ if (G.forEach(({ attrKey: o, blockId: u, kind: T }) => {
104
+ const d = r.querySelector(`[esd-extension-block-id="${u}"]`);
105
+ d && e(d, o, T);
106
+ }), !A(r))
107
+ return;
108
+ const n = /* @__PURE__ */ new Set();
109
+ r.querySelectorAll(
110
+ `[esd-extension-block-id="${c.CUSTOM_ATTRIBUTE}"]`
111
+ ).forEach((o) => {
112
+ const u = l(o) ? o.getAttribute(v) : null;
113
+ !u || n.has(u) || (n.add(u), e(o, U(u), "text"));
114
+ });
115
+ }
116
+ function F(t) {
117
+ const e = {};
118
+ return f(t, (r, n, i) => {
119
+ if (!("querySelector" in r))
120
+ return;
121
+ const o = $(r, i);
122
+ o && (e[n] = o);
123
+ }), e;
124
+ }
125
+ function j(t) {
126
+ if (!t || !("querySelector" in t))
127
+ return;
128
+ const e = t.querySelector(S) ?? t, r = e.querySelector(".product-card-segment") ?? e.querySelector(".product-card-wrapper");
129
+ return O(r);
130
+ }
131
+ function X(t) {
132
+ if (!t)
133
+ return;
134
+ const e = l(t) ? t.getAttribute("bgcolor") : null;
135
+ if (e && !b.has(e))
136
+ return e;
137
+ const r = O(t);
138
+ if (r)
139
+ return r;
140
+ const n = q(t) ? t.getComputedStyle("background-color") : void 0;
141
+ return n && !b.has(n) ? n : void 0;
142
+ }
143
+ function z(t) {
144
+ const e = {};
145
+ return f(t, (r, n, i) => {
146
+ if (i !== "text")
147
+ return;
148
+ const o = X(r);
149
+ o && (e[n] = o);
150
+ }), e;
151
+ }
152
+ function Q(t) {
153
+ const e = {};
154
+ return f(t, (r, n, i) => {
155
+ if (i === "image")
156
+ return;
157
+ const o = l(r) ? r.getAttribute("align") : null;
158
+ o && (e[n] = o);
159
+ }), e;
160
+ }
161
+ const V = /^es-[pm]\d+[trbl]?$/;
162
+ function W(t) {
163
+ const e = l(t) ? t.getAttribute("class") : null;
164
+ if (!e)
165
+ return;
166
+ const r = e.split(/\s+/).filter((n) => V.test(n) || n === B);
167
+ return r.length ? r.join(" ") : void 0;
168
+ }
169
+ function Y(t) {
170
+ const e = {};
171
+ return f(t, (r, n, i) => {
172
+ if (i === "image")
173
+ return;
174
+ const o = W(r);
175
+ o && (e[n] = o);
176
+ }), e;
177
+ }
178
+ function J(t) {
179
+ const e = {};
180
+ return f(t, (r, n) => {
181
+ if (n !== y && n !== m || !l(r))
182
+ return;
183
+ const i = r.getAttribute("data-text-before"), o = r.getAttribute("data-text-after");
184
+ (i != null || o != null) && (e[n] = { before: i ?? void 0, after: o ?? void 0 });
185
+ }), e;
186
+ }
187
+ function Z(t) {
188
+ const e = {};
189
+ if (!t || !("querySelector" in t))
190
+ return e;
191
+ const r = t.querySelector(S) ?? t;
192
+ return A(r) && r.querySelectorAll(".recommendation-attribute-row").forEach((n) => {
193
+ if (!l(n))
194
+ return;
195
+ const i = n.getAttribute("data-attribute-type"), o = n.getAttribute("data-visibility");
196
+ i && o != null && (e[i] = o !== "0");
197
+ }), e;
198
+ }
199
+ function ut(t) {
200
+ return {
201
+ styleTemplates: F(t),
202
+ cardBackgroundColor: j(t),
203
+ cellBackgroundColors: z(t),
204
+ cellAlignments: Q(t),
205
+ cellClasses: Y(t),
206
+ omnibusTexts: J(t),
207
+ visibility: Z(t)
208
+ };
209
+ }
210
+ export {
211
+ F as captureAttributeStyleTemplates,
212
+ j as captureCardBackgroundColor,
213
+ Q as captureCellAlignments,
214
+ z as captureCellBackgroundColors,
215
+ Y as captureCellClasses,
216
+ J as captureOmnibusTexts,
217
+ ut as captureStyles,
218
+ Z as captureVisibility
219
+ };
@@ -1,27 +1,32 @@
1
- import { escapeHtml as m } from "../../../../utils/htmlEscape.js";
2
- function T(t) {
3
- return "getInnerHTML" in t && typeof t.getInnerHTML == "function" ? t.getInnerHTML().trim() : "innerHTML" in t ? t.innerHTML : "";
1
+ import { escapeHtml as g } from "../../../../utils/htmlEscape.js";
2
+ function u(n) {
3
+ return "getInnerHTML" in n && typeof n.getInnerHTML == "function" ? n.getInnerHTML().trim() : "innerHTML" in n ? n.innerHTML : "";
4
4
  }
5
- function H(t, f) {
6
- const n = m(f);
7
- if (!t)
8
- return n;
9
- const r = T(t);
10
- if (!r || r.trim() === "" || !/<(strong|em|u|s|b|i)\b/i.test(r))
11
- return n;
12
- const e = [], s = [];
13
- let o = r.trim();
5
+ function T(n) {
6
+ const s = [], t = [];
7
+ let r = n.trim();
14
8
  for (; ; ) {
15
- const u = o.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
16
- if (!u)
9
+ const e = r.match(/^<(strong|em|u|s|b|i)(\s[^>]*)?>(.*)$/is);
10
+ if (!e)
17
11
  break;
18
- const [, i, a = "", c] = u, g = new RegExp(`</${i}>$`, "i");
19
- if (!g.test(c))
12
+ const [, i, a = "", o] = e, c = new RegExp(`</${i}>$`, "i");
13
+ if (!c.test(o))
20
14
  break;
21
- e.push(`<${i}${a}>`), s.unshift(`</${i}>`), o = c.replace(g, "").trim();
15
+ s.push(`<${i}${a}>`), t.unshift(`</${i}>`), r = o.replace(c, "").trim();
22
16
  }
23
- return e.length > 0 ? e.join("") + n + s.join("") : n;
17
+ return { openTags: s.join(""), closeTags: t.join("") };
18
+ }
19
+ function p(n, s) {
20
+ const t = g(s);
21
+ if (!n)
22
+ return t;
23
+ const r = u(n);
24
+ if (!r || r.trim() === "")
25
+ return t;
26
+ const { openTags: e, closeTags: i } = T(r);
27
+ return e ? e + t + i : t;
24
28
  }
25
29
  export {
26
- H as preserveTextStyles
30
+ T as extractWrapperTags,
31
+ p as preserveTextStyles
27
32
  };
@@ -1,46 +1,54 @@
1
- function a(t) {
1
+ function r(t) {
2
2
  return typeof t == "object" && t !== null && "tagName" in t && typeof t.tagName == "string";
3
3
  }
4
- function n(t) {
4
+ function u(t) {
5
5
  return typeof t == "object" && t !== null && "getTagName" in t && typeof t.getTagName == "function";
6
6
  }
7
- function r(t) {
7
+ function n(t) {
8
8
  return typeof t == "object" && t !== null && "getStyle" in t && typeof t.getStyle == "function";
9
9
  }
10
- function u(t) {
11
- return typeof t == "object" && t !== null && "parent" in t && typeof t.parent == "function";
10
+ function p(t) {
11
+ return typeof t == "object" && t !== null && "getComputedStyle" in t && typeof t.getComputedStyle == "function";
12
12
  }
13
- function g(t) {
14
- return typeof t == "object" && t !== null && "tagName" in t && t.tagName === "TD";
13
+ function y(t) {
14
+ return typeof t == "object" && t !== null && "getAttribute" in t && typeof t.getAttribute == "function";
15
15
  }
16
- function p(t, e) {
17
- return !t || !r(t) ? null : t.getStyle(e);
16
+ function o(t) {
17
+ return typeof t == "object" && t !== null && "querySelectorAll" in t && typeof t.querySelectorAll == "function";
18
18
  }
19
- function N(t) {
20
- return !t || !u(t) ? null : t.parent() ?? null;
19
+ function l(t) {
20
+ return typeof t == "object" && t !== null && "parent" in t && typeof t.parent == "function";
21
21
  }
22
- function l(t, e = "UNKNOWN") {
23
- return t ? a(t) ? t.tagName.toUpperCase() : n(t) ? t.getTagName().toUpperCase() : e : e;
22
+ function g(t, e) {
23
+ return !t || !n(t) ? null : t.getStyle(e);
24
+ }
25
+ function s(t) {
26
+ return !t || !l(t) ? null : t.parent() ?? null;
27
+ }
28
+ function a(t, e = "UNKNOWN") {
29
+ return t ? r(t) ? t.tagName.toUpperCase() : u(t) ? t.getTagName().toUpperCase() : e : e;
24
30
  }
25
31
  const f = /* @__PURE__ */ new Set(["TD", "BLOCK_IMAGE", "BLOCK_BUTTON"]);
26
32
  function i(t) {
27
33
  return f.has(t.toUpperCase());
28
34
  }
29
35
  function c(t) {
30
- const e = l(t);
36
+ const e = a(t);
31
37
  return i(e);
32
38
  }
33
- function s(t) {
39
+ function N(t) {
34
40
  return c(t) ? "table-cell" : "table-row";
35
41
  }
36
42
  export {
37
- s as getTableDisplayValue,
38
- l as getTagName,
39
- r as hasGetStyle,
40
- u as hasParent,
43
+ N as getTableDisplayValue,
44
+ a as getTagName,
45
+ y as hasGetAttribute,
46
+ p as hasGetComputedStyle,
47
+ n as hasGetStyle,
48
+ l as hasParent,
49
+ o as hasQuerySelectorAll,
41
50
  c as isTableCellNode,
42
51
  i as isTableCellTag,
43
- g as isTdNode,
44
- N as safeGetParent,
45
- p as safeGetStyle
52
+ s as safeGetParent,
53
+ g as safeGetStyle
46
54
  };
@@ -52,7 +52,7 @@ class H extends y {
52
52
  onSelect(e) {
53
53
  this.currentNode = e;
54
54
  const t = this._getOrAssignBlockId(e);
55
- t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._setupSelectEventListener(), this._setupCancelEventListener(), this._checkExistingBlocks(), this._openDrawer());
55
+ t && this.linkStateByBlockId.set(t, this._hasUnsubscribeLink(e)), this._setupSelectEventListener(), this._setupCancelEventListener(), !("getAttribute" in e && e.getAttribute("data-migration")) && (this._resetStoreState(), this._loadBlockState(e), this._checkExistingBlocks(), this._openDrawer());
56
56
  }
57
57
  onCreated(e) {
58
58
  this._ensureLeadingTextGuard(e);