veo-sdk 0.6.3 → 0.6.4

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.
@@ -1,5 +1,5 @@
1
- export { INTERACTIVE_SELECTOR, VEO_BLOCK_MIME, attachBlockDropTarget, attachDesignManipulator, closestInteractive, createBuilderSession, elementLabelText, initBuilderMode, isInteractiveElement, startElementPicker, stopElementPicker } from './chunk-DU6I4ZU2.mjs';
2
- import './chunk-SZCIXA5X.mjs';
1
+ export { INTERACTIVE_SELECTOR, VEO_BLOCK_MIME, attachBlockDropTarget, attachDesignManipulator, closestInteractive, createBuilderSession, elementLabelText, initBuilderMode, isInteractiveElement, startElementPicker, stopElementPicker } from './chunk-YEKCBVNJ.mjs';
2
+ import './chunk-CMPOHTUM.mjs';
3
3
  import './chunk-PTG3BTJE.mjs';
4
- //# sourceMappingURL=builder-PPLIAUCM.mjs.map
5
- //# sourceMappingURL=builder-PPLIAUCM.mjs.map
4
+ //# sourceMappingURL=builder-5F2EFT4X.mjs.map
5
+ //# sourceMappingURL=builder-5F2EFT4X.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-PPLIAUCM.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-5F2EFT4X.mjs"}
package/dist/builder.cjs CHANGED
@@ -395,6 +395,7 @@ var GUIDE_Z_INDEX = 2147483640;
395
395
  var DEFAULT_ANCHOR_WAIT_MS = 5e3;
396
396
  var SAFE_URL_PROTOCOLS = ["http:", "https:"];
397
397
  var GUIDE_HOST_ATTR = "data-veo-guide";
398
+ var BADGE_MARKER_HOST_ATTR = "data-veo-badge";
398
399
  var WALKTHROUGH_STEP_SELECTOR_TIMEOUT_MS = 5e3;
399
400
 
400
401
  // src/plugins/guides/rich-text.ts
@@ -2209,6 +2210,25 @@ var BaseRenderer = class {
2209
2210
  this.shadow = shadow;
2210
2211
  return { host, shadow, root };
2211
2212
  }
2213
+ /**
2214
+ * Host SUELTO con los mismos estilos (shadow DOM), sin agregarlo al DOM ni
2215
+ * registrarlo como `this.host`. Para piezas que deben vivir dentro de la app
2216
+ * (el marcador de un badge, junto a su ancla) mientras la tarjeta se queda
2217
+ * en `body`: si la tarjeta viajara dentro del ancla, un ancestro con
2218
+ * `transform`/`overflow` la recortaría y su z-index quedaría atrapado.
2219
+ */
2220
+ createDetachedHost(attr = BADGE_MARKER_HOST_ATTR) {
2221
+ const host = document.createElement("div");
2222
+ host.setAttribute(attr, "");
2223
+ const shadow = host.attachShadow({ mode: "open" });
2224
+ const style = document.createElement("style");
2225
+ style.textContent = GUIDE_STYLES;
2226
+ shadow.appendChild(style);
2227
+ const root = document.createElement("div");
2228
+ shadow.appendChild(root);
2229
+ this.registerCleanup(() => host.remove());
2230
+ return { host, root };
2231
+ }
2212
2232
  /**
2213
2233
  * Aplica la tematización por datos del step (`step.style`) como variables
2214
2234
  * CSS sobre el host. Llamar tras `createHost()`. No-op si no hay host o
@@ -3421,6 +3441,13 @@ function snoozeGuide(guideId, every, unit, now = Date.now()) {
3421
3441
  } catch {
3422
3442
  }
3423
3443
  }
3444
+
3445
+ // src/plugins/guides/z-index.ts
3446
+ var MAX_Z_INDEX = 2147483647;
3447
+ function clampZIndex(value, fallback) {
3448
+ if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
3449
+ return Math.max(-MAX_Z_INDEX, Math.min(MAX_Z_INDEX, Math.round(value)));
3450
+ }
3424
3451
  var INFO_GLYPH = "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021";
3425
3452
  var QUESTION_GLYPH = "M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75";
3426
3453
  var STAR_GLYPH = "M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z";
@@ -3605,7 +3632,7 @@ function canNest(anchor) {
3605
3632
  }
3606
3633
  function attachMarker(anchor, host, marker) {
3607
3634
  host.style.position = "absolute";
3608
- host.style.zIndex = String(num(marker.zIndex, DEFAULT_MARKER_Z));
3635
+ host.style.zIndex = String(clampZIndex(marker.zIndex, DEFAULT_MARKER_Z));
3609
3636
  host.style.margin = "0";
3610
3637
  const position = marker.position ?? "top-right";
3611
3638
  const offset6 = { x: num(marker.offsetX, 0), y: num(marker.offsetY, 0) };
@@ -3743,7 +3770,9 @@ var CompositeRenderer = class extends BaseRenderer {
3743
3770
  const { host, root } = this.createHost();
3744
3771
  const doc = root.ownerDocument ?? document;
3745
3772
  const design = step.design ?? {};
3746
- if (typeof design.zIndex === "number") host.style.zIndex = String(design.zIndex);
3773
+ if (typeof design.zIndex === "number") {
3774
+ host.style.zIndex = String(clampZIndex(design.zIndex, 0));
3775
+ }
3747
3776
  const card = doc.createElement("div");
3748
3777
  card.className = "veo-card";
3749
3778
  const themeMode = themeModeFor(context.guide.theme, design);
@@ -3852,7 +3881,7 @@ var CompositeRenderer = class extends BaseRenderer {
3852
3881
  const bg = doc.createElement("div");
3853
3882
  bg.className = "veo-composite-overlay veo-composite-overlay--dim";
3854
3883
  if (typeof design.backdropColor === "string") bg.style.background = design.backdropColor;
3855
- const bz = typeof design.backdropZIndex === "number" ? design.backdropZIndex : 2e5;
3884
+ const bz = clampZIndex(design.backdropZIndex, 2e5);
3856
3885
  bg.style.zIndex = String(bz);
3857
3886
  root.appendChild(bg);
3858
3887
  this.registerCleanup(lockScroll(doc));
@@ -3874,7 +3903,7 @@ var CompositeRenderer = class extends BaseRenderer {
3874
3903
  overlay.style.background = design.backdropColor;
3875
3904
  }
3876
3905
  if (typeof design.backdropZIndex === "number") {
3877
- overlay.style.zIndex = String(design.backdropZIndex);
3906
+ overlay.style.zIndex = String(clampZIndex(design.backdropZIndex, 0));
3878
3907
  }
3879
3908
  overlay.addEventListener("click", (e) => {
3880
3909
  if (e.target === overlay) {
@@ -4195,6 +4224,7 @@ var CompositeRenderer = class extends BaseRenderer {
4195
4224
  renderBadgeMode(step, card, anchor, anchorSelector, host, root, doc, context, idx, design) {
4196
4225
  const trigger = step.badge?.trigger === "click" ? "click" : "hover";
4197
4226
  const placement = step.badge?.placement === "top" || step.badge?.placement === "left" || step.badge?.placement === "right" ? step.badge.placement : "bottom";
4227
+ const { host: markerHost, root: markerRoot } = this.createDetachedHost();
4198
4228
  const badge = doc.createElement("div");
4199
4229
  badge.className = "veo-composite-badge";
4200
4230
  badge.setAttribute("role", "button");
@@ -4205,7 +4235,8 @@ var CompositeRenderer = class extends BaseRenderer {
4205
4235
  const marker = step.badge?.marker ?? null;
4206
4236
  if (marker) badge.appendChild(buildMarkerElement(doc, marker));
4207
4237
  else this.buildContent(badge, step.badge?.blocks ?? [], doc, context, idx, [], host);
4208
- root.appendChild(badge);
4238
+ markerRoot.appendChild(badge);
4239
+ host.style.display = "block";
4209
4240
  if (design.fullWidth === true) {
4210
4241
  card.style.width = "auto";
4211
4242
  card.style.maxWidth = "320px";
@@ -4220,13 +4251,13 @@ var CompositeRenderer = class extends BaseRenderer {
4220
4251
  wrapper.appendChild(card);
4221
4252
  root.appendChild(wrapper);
4222
4253
  if (marker) {
4223
- host.style.display = "inline-block";
4224
- this.registerCleanup(attachMarker(anchor, host, marker));
4254
+ markerHost.style.display = "inline-block";
4255
+ this.registerCleanup(attachMarker(anchor, markerHost, marker));
4225
4256
  } else {
4226
- host.style.display = "inline-block";
4257
+ markerHost.style.display = "inline-block";
4227
4258
  const pos = inlinePosOf(step.inlinePosition);
4228
- insertHost(anchor, host, pos);
4229
- this.registerCleanup(keepHostAttached(host, anchorSelector, pos));
4259
+ insertHost(anchor, markerHost, pos);
4260
+ this.registerCleanup(keepHostAttached(markerHost, anchorSelector, pos));
4230
4261
  }
4231
4262
  let open = false;
4232
4263
  let stopFloat = null;
@@ -4356,7 +4387,7 @@ function liftTarget(anchor, zIndex) {
4356
4387
  const prevPosition = el2.style.position;
4357
4388
  const prevZ = el2.style.zIndex;
4358
4389
  if (getComputedStyle(el2).position === "static") el2.style.position = "relative";
4359
- el2.style.zIndex = String(zIndex);
4390
+ el2.style.zIndex = String(clampZIndex(zIndex, 0));
4360
4391
  return () => {
4361
4392
  el2.style.position = prevPosition;
4362
4393
  el2.style.zIndex = prevZ;