veo-sdk 0.6.0 → 0.6.1

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/index.cjs CHANGED
@@ -3470,13 +3470,68 @@ function markerOffset(anchor, marker, position, offset6) {
3470
3470
  }
3471
3471
  return { x: x + offset6.x, y: y + offset6.y };
3472
3472
  }
3473
+ function canNest(anchor) {
3474
+ const win = anchor.ownerDocument.defaultView;
3475
+ if (!win || !(anchor instanceof win.HTMLElement)) return false;
3476
+ if (NO_CHILDREN.has(anchor.tagName.toLowerCase())) return false;
3477
+ const cs = win.getComputedStyle(anchor);
3478
+ if (cs.display === "contents") return false;
3479
+ const tokens = `${cs.overflow} ${cs.overflowX} ${cs.overflowY}`.split(/\s+/).filter(Boolean);
3480
+ return tokens.every((t) => t === "visible");
3481
+ }
3473
3482
  function attachMarker(anchor, host, marker) {
3474
3483
  host.style.position = "absolute";
3475
3484
  host.style.zIndex = String(num(marker.zIndex, DEFAULT_MARKER_Z));
3476
3485
  host.style.margin = "0";
3486
+ const position = marker.position ?? "top-right";
3487
+ const offset6 = { x: num(marker.offsetX, 0), y: num(marker.offsetY, 0) };
3488
+ const markerSize = () => {
3489
+ const m = host.getBoundingClientRect();
3490
+ return { width: m.width, height: m.height };
3491
+ };
3492
+ if (canNest(anchor)) {
3493
+ const win = anchor.ownerDocument.defaultView;
3494
+ const prevPosition = anchor.style.position;
3495
+ const computed = win.getComputedStyle(anchor).position;
3496
+ if (!computed || computed === "static") anchor.style.position = "relative";
3497
+ anchor.appendChild(host);
3498
+ const swallowClick = (e) => {
3499
+ e.preventDefault();
3500
+ e.stopPropagation();
3501
+ };
3502
+ const swallow = (e) => e.stopPropagation();
3503
+ host.addEventListener("click", swallowClick);
3504
+ host.addEventListener("pointerdown", swallow);
3505
+ host.addEventListener("mousedown", swallow);
3506
+ const update2 = () => {
3507
+ const { x, y } = markerOffset(
3508
+ {
3509
+ left: -anchor.clientLeft,
3510
+ top: -anchor.clientTop,
3511
+ width: anchor.offsetWidth,
3512
+ height: anchor.offsetHeight
3513
+ },
3514
+ markerSize(),
3515
+ position,
3516
+ offset6
3517
+ );
3518
+ host.style.left = `${Math.round(x)}px`;
3519
+ host.style.top = `${Math.round(y)}px`;
3520
+ };
3521
+ update2();
3522
+ const stop2 = dom.autoUpdate(anchor, host, update2, { ancestorScroll: false, layoutShift: false });
3523
+ return () => {
3524
+ stop2();
3525
+ host.removeEventListener("click", swallowClick);
3526
+ host.removeEventListener("pointerdown", swallow);
3527
+ host.removeEventListener("mousedown", swallow);
3528
+ host.remove();
3529
+ anchor.style.position = prevPosition;
3530
+ };
3531
+ }
3532
+ anchor.ownerDocument.body.appendChild(host);
3477
3533
  const update = () => {
3478
3534
  const a = anchor.getBoundingClientRect();
3479
- const m = host.getBoundingClientRect();
3480
3535
  const { x, y } = markerOffset(
3481
3536
  {
3482
3537
  left: a.left + window.scrollX,
@@ -3484,17 +3539,21 @@ function attachMarker(anchor, host, marker) {
3484
3539
  width: a.width,
3485
3540
  height: a.height
3486
3541
  },
3487
- { width: m.width, height: m.height },
3488
- marker.position ?? "top-right",
3489
- { x: num(marker.offsetX, 0), y: num(marker.offsetY, 0) }
3542
+ markerSize(),
3543
+ position,
3544
+ offset6
3490
3545
  );
3491
3546
  host.style.left = `${Math.round(x)}px`;
3492
3547
  host.style.top = `${Math.round(y)}px`;
3493
3548
  };
3494
3549
  update();
3495
- return dom.autoUpdate(anchor, host, update);
3550
+ const stop = dom.autoUpdate(anchor, host, update);
3551
+ return () => {
3552
+ stop();
3553
+ host.remove();
3554
+ };
3496
3555
  }
3497
- var INFO_GLYPH, QUESTION_GLYPH, STAR_GLYPH, CIRCLE, TARGET_GLYPH, BADGE_ICONS, DEFAULT_MARKER_SIZE, DEFAULT_MARKER_Z, SIDE_GAP;
3556
+ var INFO_GLYPH, QUESTION_GLYPH, STAR_GLYPH, CIRCLE, TARGET_GLYPH, BADGE_ICONS, DEFAULT_MARKER_SIZE, DEFAULT_MARKER_Z, SIDE_GAP, NO_CHILDREN;
3498
3557
  var init_badge_marker = __esm({
3499
3558
  "src/plugins/guides/renderers/badge-marker.ts"() {
3500
3559
  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";
@@ -3517,6 +3576,21 @@ var init_badge_marker = __esm({
3517
3576
  DEFAULT_MARKER_SIZE = 14;
3518
3577
  DEFAULT_MARKER_Z = 19e3;
3519
3578
  SIDE_GAP = 8;
3579
+ NO_CHILDREN = /* @__PURE__ */ new Set([
3580
+ "img",
3581
+ "input",
3582
+ "textarea",
3583
+ "select",
3584
+ "iframe",
3585
+ "video",
3586
+ "audio",
3587
+ "canvas",
3588
+ "br",
3589
+ "hr",
3590
+ "svg",
3591
+ "object",
3592
+ "embed"
3593
+ ]);
3520
3594
  }
3521
3595
  });
3522
3596
  function applyRowStyle(rowEl, style) {
@@ -4205,9 +4279,7 @@ var init_composite_renderer = __esm({
4205
4279
  root.appendChild(wrapper);
4206
4280
  if (marker) {
4207
4281
  host.style.display = "inline-block";
4208
- (anchor.ownerDocument ?? document).body.appendChild(host);
4209
4282
  this.registerCleanup(attachMarker(anchor, host, marker));
4210
- this.registerCleanup(() => host.remove());
4211
4283
  } else {
4212
4284
  host.style.display = "inline-block";
4213
4285
  const pos = inlinePosOf(step.inlinePosition);