veo-sdk 0.6.2 → 0.6.3
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/builder-PPLIAUCM.mjs +5 -0
- package/dist/{builder-ENKEIVF2.mjs.map → builder-PPLIAUCM.mjs.map} +1 -1
- package/dist/builder.cjs +354 -92
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.d.cts +76 -6
- package/dist/builder.d.ts +76 -6
- package/dist/builder.mjs +4 -4
- package/dist/{chunk-L3QQJLDJ.mjs → chunk-3JEAPZ6A.mjs} +3 -3
- package/dist/{chunk-L3QQJLDJ.mjs.map → chunk-3JEAPZ6A.mjs.map} +1 -1
- package/dist/{chunk-4QZDNJJE.mjs → chunk-DU6I4ZU2.mjs} +284 -15
- package/dist/chunk-DU6I4ZU2.mjs.map +1 -0
- package/dist/{chunk-ZILDR4YE.mjs → chunk-SZCIXA5X.mjs} +70 -69
- package/dist/chunk-SZCIXA5X.mjs.map +1 -0
- package/dist/index.cjs +601 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +306 -6
- package/dist/index.mjs.map +1 -1
- package/dist/veo-builder.js +54 -19
- package/dist/veo-builder.js.map +1 -1
- package/dist/veo.js +2 -2
- package/dist/veo.js.map +1 -1
- package/package.json +1 -1
- package/dist/builder-ENKEIVF2.mjs +0 -5
- package/dist/chunk-4QZDNJJE.mjs.map +0 -1
- package/dist/chunk-ZILDR4YE.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { hasDocument, hasWindow, resolveBuilderContext, closeGuidePreview, clearBuilderToken, buildSelectorPath, filterHumanClasses, groupLayout, stepMatchesPage, isAutomaticActivation, activationDelayMs, previewGuide, applyBlockStyle, buildContentBlock, RAW_BLOCK_ATTR, GUIDE_STYLES, isDeviceAllowed } from './chunk-
|
|
1
|
+
import { hasDocument, hasWindow, resolveBuilderContext, closeGuidePreview, clearBuilderToken, buildSelectorPath, filterHumanClasses, groupLayout, stepMatchesPage, isAutomaticActivation, activationDelayMs, previewGuide, applyBlockStyle, buildContentBlock, RAW_BLOCK_ATTR, GUIDE_STYLES, isDeviceAllowed } from './chunk-SZCIXA5X.mjs';
|
|
2
2
|
import { BUILDER_TOKEN_PARAM, BUILDER_ORIGIN_PARAM } from './chunk-PTG3BTJE.mjs';
|
|
3
3
|
|
|
4
4
|
// src/plugins/builder/block-drop-target.ts
|
|
@@ -231,14 +231,19 @@ function injectBuilderChrome(opts) {
|
|
|
231
231
|
let previewOn = false;
|
|
232
232
|
let hiddenOn = false;
|
|
233
233
|
let heightCb = null;
|
|
234
|
-
|
|
234
|
+
let tagging = false;
|
|
235
|
+
const height = () => CHROME_TOPBAR_H + (collapsed || tagging ? 0 : CHROME_STEPS_H);
|
|
235
236
|
const applyHeight = () => {
|
|
236
237
|
const h = previewOn || hiddenOn ? 0 : height();
|
|
237
238
|
html.style.marginTop = dock === "top" ? `${h}px` : prevMarginTop;
|
|
238
239
|
html.style.marginBottom = dock === "bottom" ? `${h}px` : prevMarginBottom;
|
|
239
240
|
root.style.setProperty("--veo-chrome-h", `${height()}px`);
|
|
240
241
|
root.classList.toggle("is-bottom", dock === "bottom");
|
|
241
|
-
stepsBar.hidden = collapsed;
|
|
242
|
+
stepsBar.hidden = collapsed || tagging;
|
|
243
|
+
togglePill.hidden = tagging;
|
|
244
|
+
preview.hidden = tagging;
|
|
245
|
+
saveGroup.hidden = tagging;
|
|
246
|
+
showPanel.title = tagging ? "Mostrar el panel" : "Mostrar el editor";
|
|
242
247
|
const open = dock === "top" ? "chevronUp" : "chevronDown";
|
|
243
248
|
const closedIcon = dock === "top" ? "chevronDown" : "chevronUp";
|
|
244
249
|
togglePill.innerHTML = `<span>${collapsed ? "Mostrar pasos" : "Ocultar pasos"}</span>${svg(
|
|
@@ -291,8 +296,13 @@ function injectBuilderChrome(opts) {
|
|
|
291
296
|
const render = () => {
|
|
292
297
|
const s = current;
|
|
293
298
|
if (!s) return;
|
|
299
|
+
const nextTagging = s.variant === "tagging";
|
|
300
|
+
if (nextTagging !== tagging) {
|
|
301
|
+
tagging = nextTagging;
|
|
302
|
+
applyHeight();
|
|
303
|
+
}
|
|
294
304
|
const date = shortDate(s.createdAt);
|
|
295
|
-
nameEl.textContent = `${s.guideName.trim() || "Sin nombre"}${date ? ` \xB7 ${date}` : ""}`;
|
|
305
|
+
nameEl.textContent = tagging ? s.guideName.trim() || "Modo tagging" : `${s.guideName.trim() || "Sin nombre"}${date ? ` \xB7 ${date}` : ""}`;
|
|
296
306
|
if (s.status) {
|
|
297
307
|
statusEl.hidden = false;
|
|
298
308
|
statusEl.textContent = s.status.label;
|
|
@@ -391,6 +401,8 @@ var CHROME_CSS = `
|
|
|
391
401
|
font-size: 14px; color: #1c1917;
|
|
392
402
|
}
|
|
393
403
|
.veo-chrome[hidden] { display: none; }
|
|
404
|
+
/* Modo tagging oculta controles por atributo: gana a los display de sus clases. */
|
|
405
|
+
.veo-chrome [hidden], .veo-steps-toggle[hidden] { display: none !important; }
|
|
394
406
|
.veo-chrome.is-bottom { top: auto; bottom: 0; flex-direction: column-reverse; }
|
|
395
407
|
.veo-chrome.is-bottom .veo-tb-menu { top: auto; bottom: calc(100% + 8px); }
|
|
396
408
|
.veo-chrome.is-bottom .veo-steps { border-bottom: 0; border-top: 1px solid #d6cfc8; }
|
|
@@ -1010,6 +1022,60 @@ function attachBanner(opts, shadow, banner) {
|
|
|
1010
1022
|
};
|
|
1011
1023
|
}
|
|
1012
1024
|
|
|
1025
|
+
// src/plugins/builder/interactive-elements.ts
|
|
1026
|
+
var INTERACTIVE_ROLES = [
|
|
1027
|
+
"button",
|
|
1028
|
+
"link",
|
|
1029
|
+
"tab",
|
|
1030
|
+
"menuitem",
|
|
1031
|
+
"menuitemcheckbox",
|
|
1032
|
+
"menuitemradio",
|
|
1033
|
+
"checkbox",
|
|
1034
|
+
"radio",
|
|
1035
|
+
"switch",
|
|
1036
|
+
"option",
|
|
1037
|
+
"combobox",
|
|
1038
|
+
"textbox",
|
|
1039
|
+
"searchbox",
|
|
1040
|
+
"slider",
|
|
1041
|
+
"spinbutton"
|
|
1042
|
+
];
|
|
1043
|
+
var INTERACTIVE_SELECTOR = [
|
|
1044
|
+
"button",
|
|
1045
|
+
"a[href]",
|
|
1046
|
+
'input:not([type="hidden"])',
|
|
1047
|
+
"select",
|
|
1048
|
+
"textarea",
|
|
1049
|
+
"form",
|
|
1050
|
+
"summary",
|
|
1051
|
+
'[contenteditable="true"]',
|
|
1052
|
+
"[onclick]",
|
|
1053
|
+
"[data-veo-tag]",
|
|
1054
|
+
...INTERACTIVE_ROLES.map((r) => `[role="${r}"]`)
|
|
1055
|
+
].join(", ");
|
|
1056
|
+
function isInteractiveElement(element) {
|
|
1057
|
+
try {
|
|
1058
|
+
return element.matches(INTERACTIVE_SELECTOR);
|
|
1059
|
+
} catch {
|
|
1060
|
+
return false;
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
function closestInteractive(element) {
|
|
1064
|
+
try {
|
|
1065
|
+
return element.closest(INTERACTIVE_SELECTOR);
|
|
1066
|
+
} catch {
|
|
1067
|
+
return null;
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
var EMOJI_RE = /\p{Extended_Pictographic}|\p{Emoji_Modifier}|\u{FE0F}|\u{200D}|\u{20E3}/gu;
|
|
1071
|
+
function elementLabelText(element, max = 120) {
|
|
1072
|
+
const clean = (raw) => (raw ?? "").replace(EMOJI_RE, "").replace(/\s+/g, " ").trim();
|
|
1073
|
+
const text = clean(element.textContent);
|
|
1074
|
+
if (text) return text.slice(0, max);
|
|
1075
|
+
const fallback = clean(element.getAttribute("aria-label")) || clean(element.getAttribute("title"));
|
|
1076
|
+
return fallback.slice(0, max);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1013
1079
|
// src/plugins/builder/element-picker.ts
|
|
1014
1080
|
var PICKER_Z = 2147483646;
|
|
1015
1081
|
var PICKER_HOST_ATTR = "data-veo-picker";
|
|
@@ -1080,21 +1146,24 @@ var ElementPicker = class {
|
|
|
1080
1146
|
this.label = null;
|
|
1081
1147
|
this.current = null;
|
|
1082
1148
|
this.maxAncestors = DEFAULT_MAX_ANCESTORS;
|
|
1149
|
+
this.only = null;
|
|
1083
1150
|
this.onPick = null;
|
|
1084
1151
|
this.onCancel = null;
|
|
1085
1152
|
this.onMove = (event) => {
|
|
1086
|
-
|
|
1087
|
-
|
|
1153
|
+
if (!(event.target instanceof Element) || this.isOwn(event.target)) return;
|
|
1154
|
+
const target = this.resolveTarget(event.target);
|
|
1088
1155
|
this.current = target;
|
|
1089
|
-
this.draw(target);
|
|
1156
|
+
if (target) this.draw(target);
|
|
1157
|
+
else this.hideBox();
|
|
1090
1158
|
};
|
|
1091
1159
|
this.onClick = (event) => {
|
|
1092
1160
|
if (event.altKey) return;
|
|
1093
|
-
|
|
1094
|
-
if (!target || this.isOwn(target)) return;
|
|
1161
|
+
if (this.isOwn(event.target)) return;
|
|
1095
1162
|
event.preventDefault();
|
|
1096
1163
|
event.stopPropagation();
|
|
1097
1164
|
event.stopImmediatePropagation();
|
|
1165
|
+
const target = this.current ?? this.resolveTarget(event.target);
|
|
1166
|
+
if (!target) return;
|
|
1098
1167
|
const picked = this.describe(target);
|
|
1099
1168
|
const cb = this.onPick;
|
|
1100
1169
|
this.stop();
|
|
@@ -1121,6 +1190,7 @@ var ElementPicker = class {
|
|
|
1121
1190
|
start(options) {
|
|
1122
1191
|
this.stop();
|
|
1123
1192
|
this.maxAncestors = options.maxAncestors ?? DEFAULT_MAX_ANCESTORS;
|
|
1193
|
+
this.only = options.only ?? null;
|
|
1124
1194
|
this.onPick = options.onPick;
|
|
1125
1195
|
this.onCancel = options.onCancel ?? null;
|
|
1126
1196
|
const host = document.createElement("div");
|
|
@@ -1183,9 +1253,19 @@ var ElementPicker = class {
|
|
|
1183
1253
|
this.box = null;
|
|
1184
1254
|
this.label = null;
|
|
1185
1255
|
this.current = null;
|
|
1256
|
+
this.only = null;
|
|
1186
1257
|
this.onPick = null;
|
|
1187
1258
|
this.onCancel = null;
|
|
1188
1259
|
}
|
|
1260
|
+
/** Elemento que se elegiría para el nodo bajo el cursor (o null si no hay). */
|
|
1261
|
+
resolveTarget(target) {
|
|
1262
|
+
if (!(target instanceof Element) || this.isOwn(target)) return null;
|
|
1263
|
+
return this.only === "interactive" ? closestInteractive(target) : target;
|
|
1264
|
+
}
|
|
1265
|
+
hideBox() {
|
|
1266
|
+
if (this.box) this.box.style.display = "none";
|
|
1267
|
+
if (this.label) this.label.style.display = "none";
|
|
1268
|
+
}
|
|
1189
1269
|
/** ¿Es un nodo de nuestro propio overlay? (no debe ser seleccionable). */
|
|
1190
1270
|
isOwn(target) {
|
|
1191
1271
|
return target instanceof Node && this.host !== null && this.host.contains(target);
|
|
@@ -1222,7 +1302,7 @@ var ElementPicker = class {
|
|
|
1222
1302
|
tag: element.tagName.toLowerCase(),
|
|
1223
1303
|
id: element.id || null,
|
|
1224
1304
|
classes: filterHumanClasses(element),
|
|
1225
|
-
text: (element
|
|
1305
|
+
text: elementLabelText(element),
|
|
1226
1306
|
rect: {
|
|
1227
1307
|
x: Math.round(rect.left),
|
|
1228
1308
|
y: Math.round(rect.top),
|
|
@@ -1247,6 +1327,41 @@ function stopElementPicker() {
|
|
|
1247
1327
|
}
|
|
1248
1328
|
|
|
1249
1329
|
// src/plugins/builder/builder-mode.ts
|
|
1330
|
+
var CONFIRMATION_STYLES = `
|
|
1331
|
+
:host { all: initial; }
|
|
1332
|
+
.veo-confirm-backdrop {
|
|
1333
|
+
position: fixed; inset: 0; z-index: 2147483645;
|
|
1334
|
+
background: rgba(20, 16, 14, 0.45);
|
|
1335
|
+
}
|
|
1336
|
+
.veo-confirm {
|
|
1337
|
+
position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
|
|
1338
|
+
z-index: 2147483646; box-sizing: border-box;
|
|
1339
|
+
width: min(432px, calc(100vw - 32px)); padding: 28px 24px 24px;
|
|
1340
|
+
border-radius: 16px; background: #fff; color: #1d1917;
|
|
1341
|
+
box-shadow: 0 24px 64px rgba(0,0,0,0.28);
|
|
1342
|
+
font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
1343
|
+
text-align: center;
|
|
1344
|
+
}
|
|
1345
|
+
.veo-confirm-check {
|
|
1346
|
+
width: 64px; height: 64px; margin: 0 auto; border-radius: 50%;
|
|
1347
|
+
background: #e6f6df; color: #2f9a4e; display: flex; align-items: center; justify-content: center;
|
|
1348
|
+
}
|
|
1349
|
+
.veo-confirm-check svg { width: 30px; height: 30px; }
|
|
1350
|
+
.veo-confirm-title { margin: 18px 0 0; font-size: 17px; font-weight: 600; }
|
|
1351
|
+
.veo-confirm-msg { margin: 8px 0 0; font-size: 13px; color: #6b6461; }
|
|
1352
|
+
.veo-confirm-rows {
|
|
1353
|
+
margin: 18px 0 0; padding: 12px 14px; border-radius: 12px; background: #f6f2ef; text-align: left;
|
|
1354
|
+
}
|
|
1355
|
+
.veo-confirm-row { display: flex; justify-content: space-between; gap: 16px; font-size: 13px; padding: 4px 0; }
|
|
1356
|
+
.veo-confirm-row dt { color: #6b6461; margin: 0; }
|
|
1357
|
+
.veo-confirm-row dd { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1358
|
+
.veo-confirm-btn {
|
|
1359
|
+
display: block; width: 100%; margin-top: 18px; height: 44px; border: 0; border-radius: 10px;
|
|
1360
|
+
background: #b74d00; color: #fff; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
|
|
1361
|
+
}
|
|
1362
|
+
.veo-confirm-btn:hover { background: #953c00; }
|
|
1363
|
+
.veo-confirm-btn:focus-visible { outline: 3px solid rgba(183,77,0,0.35); outline-offset: 2px; }
|
|
1364
|
+
`;
|
|
1250
1365
|
function initBuilderMode() {
|
|
1251
1366
|
if (!hasWindow() || !hasDocument()) return null;
|
|
1252
1367
|
const ctx = resolveBuilderContext();
|
|
@@ -2228,7 +2343,7 @@ function initBuilderMode() {
|
|
|
2228
2343
|
if (h && hoverCard && !previewMode) renderCardChrome(h, previewStepIndex);
|
|
2229
2344
|
}
|
|
2230
2345
|
panel?.setTitle(
|
|
2231
|
-
cmd.state.section === "activation" ? "Ajustes de activaci\xF3n" : cmd.state.section === "badge" ? "Ajustes de badge" : cmd.state.section === "target" ? "Ajustes del elemento objetivo" : cmd.state.section === "row" ? "Editar fila" : cmd.state.blockLabel ? `Editor \xB7 ${cmd.state.blockLabel}` : cmd.state.steps[cmd.state.activeStep]?.label ?? "Paso"
|
|
2346
|
+
cmd.state.panelTitle ?? (cmd.state.section === "activation" ? "Ajustes de activaci\xF3n" : cmd.state.section === "badge" ? "Ajustes de badge" : cmd.state.section === "target" ? "Ajustes del elemento objetivo" : cmd.state.section === "row" ? "Editar fila" : cmd.state.blockLabel ? `Editor \xB7 ${cmd.state.blockLabel}` : cmd.state.steps[cmd.state.activeStep]?.label ?? "Paso")
|
|
2232
2347
|
);
|
|
2233
2348
|
break;
|
|
2234
2349
|
case "panel-visibility":
|
|
@@ -2266,7 +2381,8 @@ function initBuilderMode() {
|
|
|
2266
2381
|
post({ type: "pick-cancelled" });
|
|
2267
2382
|
},
|
|
2268
2383
|
...cmd.maxAncestors !== void 0 ? { maxAncestors: cmd.maxAncestors } : {},
|
|
2269
|
-
...cmd.hint !== void 0 ? { hint: cmd.hint } : {}
|
|
2384
|
+
...cmd.hint !== void 0 ? { hint: cmd.hint } : {},
|
|
2385
|
+
...cmd.only !== void 0 ? { only: cmd.only } : {}
|
|
2270
2386
|
});
|
|
2271
2387
|
break;
|
|
2272
2388
|
}
|
|
@@ -2275,6 +2391,15 @@ function initBuilderMode() {
|
|
|
2275
2391
|
picker = null;
|
|
2276
2392
|
chrome?.setHidden(false);
|
|
2277
2393
|
break;
|
|
2394
|
+
case "scan-page":
|
|
2395
|
+
post({ type: "page-scan", payload: scanPage(cmd.selectors) });
|
|
2396
|
+
break;
|
|
2397
|
+
case "highlight":
|
|
2398
|
+
setHighlight(cmd.selector);
|
|
2399
|
+
break;
|
|
2400
|
+
case "show-confirmation":
|
|
2401
|
+
showConfirmation(cmd.payload);
|
|
2402
|
+
break;
|
|
2278
2403
|
case "preview":
|
|
2279
2404
|
if (!cmd.guide) break;
|
|
2280
2405
|
if (manipulator?.isDragging()) pendingPreview = cmd;
|
|
@@ -2359,10 +2484,154 @@ function initBuilderMode() {
|
|
|
2359
2484
|
post({ type: "closed" });
|
|
2360
2485
|
panel?.teardown();
|
|
2361
2486
|
panel = null;
|
|
2487
|
+
highlightBox?.remove();
|
|
2488
|
+
highlightBox = null;
|
|
2489
|
+
confirmation?.remove();
|
|
2490
|
+
confirmation = null;
|
|
2491
|
+
if (confirmationKey) document.removeEventListener("keydown", confirmationKey, true);
|
|
2492
|
+
confirmationKey = null;
|
|
2362
2493
|
chrome?.teardown();
|
|
2363
2494
|
chrome = null;
|
|
2364
2495
|
clearBuilderToken();
|
|
2365
2496
|
};
|
|
2497
|
+
const scanPage = (selectors) => {
|
|
2498
|
+
const present = selectors.filter((sel) => {
|
|
2499
|
+
try {
|
|
2500
|
+
return document.querySelector(sel) !== null;
|
|
2501
|
+
} catch {
|
|
2502
|
+
return false;
|
|
2503
|
+
}
|
|
2504
|
+
});
|
|
2505
|
+
const taggedEls = /* @__PURE__ */ new Set();
|
|
2506
|
+
for (const sel of present) {
|
|
2507
|
+
try {
|
|
2508
|
+
for (const e of Array.from(document.querySelectorAll(sel))) taggedEls.add(e);
|
|
2509
|
+
} catch {
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2513
|
+
const candidates = [];
|
|
2514
|
+
const nodes = document.querySelectorAll(INTERACTIVE_SELECTOR);
|
|
2515
|
+
for (const element of Array.from(nodes)) {
|
|
2516
|
+
if (candidates.length >= 200) break;
|
|
2517
|
+
if (element.closest("[data-veo-builder-chrome],[data-veo-builder-panel],[data-veo-picker]")) {
|
|
2518
|
+
continue;
|
|
2519
|
+
}
|
|
2520
|
+
if (element.getClientRects().length === 0) continue;
|
|
2521
|
+
let tagged = false;
|
|
2522
|
+
for (let n = element; n; n = n.parentElement) {
|
|
2523
|
+
if (taggedEls.has(n)) {
|
|
2524
|
+
tagged = true;
|
|
2525
|
+
break;
|
|
2526
|
+
}
|
|
2527
|
+
}
|
|
2528
|
+
if (tagged) continue;
|
|
2529
|
+
const selector = buildSelectorPath(element, 5);
|
|
2530
|
+
if (!selector || seen.has(selector)) continue;
|
|
2531
|
+
seen.add(selector);
|
|
2532
|
+
candidates.push({
|
|
2533
|
+
selector,
|
|
2534
|
+
shortSelector: buildSelectorPath(element, 0),
|
|
2535
|
+
tag: element.tagName.toLowerCase(),
|
|
2536
|
+
id: element.id || null,
|
|
2537
|
+
classes: filterHumanClasses(element),
|
|
2538
|
+
text: elementLabelText(element)
|
|
2539
|
+
});
|
|
2540
|
+
}
|
|
2541
|
+
const { pathname, hash } = window.location;
|
|
2542
|
+
const routePath = /^#\/./.test(hash) ? `${pathname}${hash}` : pathname;
|
|
2543
|
+
return { pagePath: pathname, routePath, candidates, present };
|
|
2544
|
+
};
|
|
2545
|
+
let confirmation = null;
|
|
2546
|
+
let confirmationKey = null;
|
|
2547
|
+
const closeConfirmation = () => {
|
|
2548
|
+
if (!confirmation) return;
|
|
2549
|
+
confirmation.remove();
|
|
2550
|
+
confirmation = null;
|
|
2551
|
+
if (confirmationKey) document.removeEventListener("keydown", confirmationKey, true);
|
|
2552
|
+
confirmationKey = null;
|
|
2553
|
+
panel?.setVisible(true);
|
|
2554
|
+
post({ type: "confirmation-closed" });
|
|
2555
|
+
};
|
|
2556
|
+
const showConfirmation = (card) => {
|
|
2557
|
+
if (confirmation) {
|
|
2558
|
+
confirmation.remove();
|
|
2559
|
+
confirmation = null;
|
|
2560
|
+
}
|
|
2561
|
+
panel?.setVisible(false);
|
|
2562
|
+
const host = document.createElement("div");
|
|
2563
|
+
host.setAttribute("data-veo-builder-chrome", "");
|
|
2564
|
+
host.setAttribute("data-veo-confirmation", "");
|
|
2565
|
+
const shadow = host.attachShadow({ mode: "open" });
|
|
2566
|
+
const style = document.createElement("style");
|
|
2567
|
+
style.textContent = CONFIRMATION_STYLES;
|
|
2568
|
+
const backdrop = document.createElement("div");
|
|
2569
|
+
backdrop.className = "veo-confirm-backdrop";
|
|
2570
|
+
const dialog = document.createElement("div");
|
|
2571
|
+
dialog.className = "veo-confirm";
|
|
2572
|
+
dialog.setAttribute("role", "dialog");
|
|
2573
|
+
dialog.setAttribute("aria-modal", "true");
|
|
2574
|
+
dialog.setAttribute("aria-label", card.title);
|
|
2575
|
+
const badge = document.createElement("div");
|
|
2576
|
+
badge.className = "veo-confirm-check";
|
|
2577
|
+
badge.innerHTML = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg>';
|
|
2578
|
+
const title = document.createElement("h2");
|
|
2579
|
+
title.className = "veo-confirm-title";
|
|
2580
|
+
title.textContent = card.title;
|
|
2581
|
+
const message = document.createElement("p");
|
|
2582
|
+
message.className = "veo-confirm-msg";
|
|
2583
|
+
message.textContent = card.message;
|
|
2584
|
+
const rows = document.createElement("dl");
|
|
2585
|
+
rows.className = "veo-confirm-rows";
|
|
2586
|
+
for (const r of card.rows) {
|
|
2587
|
+
const row = document.createElement("div");
|
|
2588
|
+
row.className = "veo-confirm-row";
|
|
2589
|
+
const dt = document.createElement("dt");
|
|
2590
|
+
dt.textContent = r.label;
|
|
2591
|
+
const dd = document.createElement("dd");
|
|
2592
|
+
dd.textContent = r.value;
|
|
2593
|
+
row.append(dt, dd);
|
|
2594
|
+
rows.appendChild(row);
|
|
2595
|
+
}
|
|
2596
|
+
const button = document.createElement("button");
|
|
2597
|
+
button.type = "button";
|
|
2598
|
+
button.className = "veo-confirm-btn";
|
|
2599
|
+
button.textContent = card.buttonLabel ?? "Listo";
|
|
2600
|
+
button.addEventListener("click", closeConfirmation);
|
|
2601
|
+
dialog.append(badge, title, message);
|
|
2602
|
+
if (card.rows.length > 0) dialog.appendChild(rows);
|
|
2603
|
+
dialog.appendChild(button);
|
|
2604
|
+
shadow.append(style, backdrop, dialog);
|
|
2605
|
+
document.body.appendChild(host);
|
|
2606
|
+
confirmation = host;
|
|
2607
|
+
confirmationKey = (e) => {
|
|
2608
|
+
if (e.key !== "Escape") return;
|
|
2609
|
+
e.preventDefault();
|
|
2610
|
+
e.stopPropagation();
|
|
2611
|
+
closeConfirmation();
|
|
2612
|
+
};
|
|
2613
|
+
document.addEventListener("keydown", confirmationKey, true);
|
|
2614
|
+
button.focus();
|
|
2615
|
+
};
|
|
2616
|
+
let highlightBox = null;
|
|
2617
|
+
const setHighlight = (selector) => {
|
|
2618
|
+
highlightBox?.remove();
|
|
2619
|
+
highlightBox = null;
|
|
2620
|
+
if (!selector) return;
|
|
2621
|
+
let target = null;
|
|
2622
|
+
try {
|
|
2623
|
+
target = document.querySelector(selector);
|
|
2624
|
+
} catch {
|
|
2625
|
+
return;
|
|
2626
|
+
}
|
|
2627
|
+
if (!target) return;
|
|
2628
|
+
const r = target.getBoundingClientRect();
|
|
2629
|
+
const box = document.createElement("div");
|
|
2630
|
+
box.setAttribute("data-veo-builder-chrome", "");
|
|
2631
|
+
box.style.cssText = `position:fixed;left:${r.left - 3}px;top:${r.top - 3}px;width:${r.width + 6}px;height:${r.height + 6}px;border:2px solid #FF5B35;border-radius:6px;background:rgba(255,91,53,0.10);pointer-events:none;z-index:2147483646;`;
|
|
2632
|
+
document.body.appendChild(box);
|
|
2633
|
+
highlightBox = box;
|
|
2634
|
+
};
|
|
2366
2635
|
if (ctx.panel) {
|
|
2367
2636
|
chrome = injectBuilderChrome({
|
|
2368
2637
|
appLabel: window.location.hostname,
|
|
@@ -2610,6 +2879,6 @@ function noopSession() {
|
|
|
2610
2879
|
};
|
|
2611
2880
|
}
|
|
2612
2881
|
|
|
2613
|
-
export { VEO_BLOCK_MIME, attachBlockDropTarget, attachDesignManipulator, createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker };
|
|
2614
|
-
//# sourceMappingURL=chunk-
|
|
2615
|
-
//# sourceMappingURL=chunk-
|
|
2882
|
+
export { INTERACTIVE_SELECTOR, VEO_BLOCK_MIME, attachBlockDropTarget, attachDesignManipulator, closestInteractive, createBuilderSession, elementLabelText, initBuilderMode, isInteractiveElement, startElementPicker, stopElementPicker };
|
|
2883
|
+
//# sourceMappingURL=chunk-DU6I4ZU2.mjs.map
|
|
2884
|
+
//# sourceMappingURL=chunk-DU6I4ZU2.mjs.map
|