veo-sdk 0.5.31 → 0.5.33

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
1
  import { BUILDER_TOKEN_PARAM, BUILDER_PANEL_PATH_PARAM, BUILDER_GUIDE_PARAM, BUILDER_PANEL_PARAM, BUILDER_ORIGIN_PARAM } from './chunk-PTG3BTJE.mjs';
2
- import { computePosition, offset, flip, shift, arrow } from '@floating-ui/dom';
2
+ import { computePosition, offset, flip, shift, arrow, autoUpdate } from '@floating-ui/dom';
3
3
 
4
4
  // src/utils/safe-env.ts
5
5
  function hasWindow() {
@@ -553,6 +553,12 @@ function applyBlockStyle(el, style, kind) {
553
553
  if (kind !== "image" && typeof s.radius === "number" && Number.isFinite(s.radius)) {
554
554
  el.style.borderRadius = `${clampNum(s.radius, 0, 64)}px`;
555
555
  }
556
+ if (typeof s.height === "number" && Number.isFinite(s.height) && s.height > 0) {
557
+ el.style.height = `${clampNum(s.height, 1, 2e3)}px`;
558
+ }
559
+ if (kind !== "image" && typeof s.width === "number" && Number.isFinite(s.width) && s.width > 0) {
560
+ el.style.width = `${clampNum(s.width, 1, 2e3)}px`;
561
+ }
556
562
  for (const side of ["Top", "Right", "Bottom", "Left"]) {
557
563
  const p = s[`padding${side}`];
558
564
  if (typeof p === "number" && Number.isFinite(p)) {
@@ -2250,6 +2256,188 @@ function buildScale(wrapper, doc, min, max, btnClass, symbol) {
2250
2256
  wrapper.appendChild(row);
2251
2257
  return { wrapper, read: () => selected };
2252
2258
  }
2259
+ 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";
2260
+ 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";
2261
+ 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";
2262
+ var CIRCLE = "M21 12a9 9 0 11-18 0 9 9 0 0118 0z";
2263
+ var TARGET_GLYPH = "M7.5 3.75H6A2.25 2.25 0 0 0 3.75 6v1.5M16.5 3.75H18A2.25 2.25 0 0 1 20.25 6v1.5m0 9V18A2.25 2.25 0 0 1 18 20.25h-1.5m-9 0H6A2.25 2.25 0 0 1 3.75 18v-1.5M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z";
2264
+ var BADGE_ICONS = {
2265
+ info: { paths: [CIRCLE, INFO_GLYPH], dots: [[12, 8.25]] },
2266
+ exclamation: { paths: [CIRCLE, "M12 8v4.5"], dots: [[12, 15.75]] },
2267
+ question: { paths: [CIRCLE, QUESTION_GLYPH], dots: [[12, 17.25]] },
2268
+ star: { paths: [STAR_GLYPH] },
2269
+ "info-solid": { paths: [INFO_GLYPH], dots: [[12, 8.25]], solid: true, scale: 0.8 },
2270
+ "exclamation-solid": { paths: ["M12 8v4.5"], dots: [[12, 15.75]], solid: true, scale: 0.8 },
2271
+ "question-solid": { paths: [QUESTION_GLYPH], dots: [[12, 17.25]], solid: true, scale: 0.8 },
2272
+ "star-solid": { paths: [STAR_GLYPH], solid: true, scale: 0.55 },
2273
+ "target-solid": { paths: [TARGET_GLYPH], solid: true, scale: 0.6 },
2274
+ new: { paths: [], text: "New" }
2275
+ };
2276
+ var DEFAULT_MARKER_SIZE = 14;
2277
+ var DEFAULT_MARKER_Z = 19e3;
2278
+ var SIDE_GAP = 8;
2279
+ function num(v, fallback) {
2280
+ return typeof v === "number" && Number.isFinite(v) ? v : fallback;
2281
+ }
2282
+ function iconNode(doc, name, size, color) {
2283
+ const def = BADGE_ICONS[name] ?? BADGE_ICONS.info;
2284
+ if (def.text) {
2285
+ const t = doc.createElement("span");
2286
+ t.textContent = def.text;
2287
+ t.style.font = `700 ${Math.round(size * 0.85)}px/1 system-ui, -apple-system, sans-serif`;
2288
+ t.style.color = color;
2289
+ return t;
2290
+ }
2291
+ const ns = "http://www.w3.org/2000/svg";
2292
+ const svg = doc.createElementNS(ns, "svg");
2293
+ svg.setAttribute("viewBox", "0 0 24 24");
2294
+ svg.setAttribute("width", String(size));
2295
+ svg.setAttribute("height", String(size));
2296
+ svg.setAttribute("fill", "none");
2297
+ svg.setAttribute("aria-hidden", "true");
2298
+ const glyphColor = def.solid ? "#ffffff" : color;
2299
+ if (def.solid) {
2300
+ const bg = doc.createElementNS(ns, "circle");
2301
+ bg.setAttribute("cx", "12");
2302
+ bg.setAttribute("cy", "12");
2303
+ bg.setAttribute("r", "12");
2304
+ bg.setAttribute("fill", color);
2305
+ svg.appendChild(bg);
2306
+ }
2307
+ const g = doc.createElementNS(ns, "g");
2308
+ g.setAttribute("stroke", glyphColor);
2309
+ g.setAttribute("stroke-width", def.solid ? "2" : "1.8");
2310
+ g.setAttribute("stroke-linecap", "round");
2311
+ g.setAttribute("stroke-linejoin", "round");
2312
+ if (def.scale && def.scale !== 1) {
2313
+ const k = def.scale;
2314
+ const t = 12 - 12 * k;
2315
+ g.setAttribute("transform", `translate(${t} ${t}) scale(${k})`);
2316
+ }
2317
+ for (const d of def.paths) {
2318
+ const path = doc.createElementNS(ns, "path");
2319
+ path.setAttribute("d", d);
2320
+ g.appendChild(path);
2321
+ }
2322
+ for (const [cx, cy] of def.dots ?? []) {
2323
+ const dot = doc.createElementNS(ns, "circle");
2324
+ dot.setAttribute("cx", String(cx));
2325
+ dot.setAttribute("cy", String(cy));
2326
+ dot.setAttribute("r", "0.9");
2327
+ dot.setAttribute("fill", glyphColor);
2328
+ dot.setAttribute("stroke", "none");
2329
+ g.appendChild(dot);
2330
+ }
2331
+ svg.appendChild(g);
2332
+ return svg;
2333
+ }
2334
+ function buildMarkerElement(doc, marker) {
2335
+ const size = num(marker.size, DEFAULT_MARKER_SIZE);
2336
+ const color = marker.color || "#000000";
2337
+ const el = doc.createElement("span");
2338
+ el.className = `veo-badge-marker veo-badge-marker-${marker.kind}`;
2339
+ el.style.display = "inline-flex";
2340
+ el.style.alignItems = "center";
2341
+ el.style.justifyContent = "center";
2342
+ el.style.boxSizing = "border-box";
2343
+ el.style.lineHeight = "1";
2344
+ if (marker.kind === "image") {
2345
+ const img = doc.createElement("img");
2346
+ img.alt = "";
2347
+ img.src = marker.imageUrl || "";
2348
+ img.style.width = `${size}px`;
2349
+ img.style.height = `${size}px`;
2350
+ img.style.objectFit = "contain";
2351
+ img.style.display = "block";
2352
+ el.appendChild(img);
2353
+ return el;
2354
+ }
2355
+ if (marker.kind === "icon-text") {
2356
+ el.style.gap = "6px";
2357
+ el.style.color = color;
2358
+ el.style.fontSize = `${size}px`;
2359
+ el.style.fontFamily = "inherit";
2360
+ el.style.fontWeight = "600";
2361
+ el.style.whiteSpace = "nowrap";
2362
+ el.style.background = marker.bgColor || "transparent";
2363
+ const bw = num(marker.borderWidth, 0);
2364
+ if (bw > 0) el.style.border = `${bw}px solid ${marker.borderColor || color}`;
2365
+ el.style.padding = `${num(marker.paddingY, 6)}px ${num(marker.paddingX, 10)}px`;
2366
+ el.style.borderRadius = `${num(marker.radius, 999)}px`;
2367
+ if (marker.showIcon !== false)
2368
+ el.appendChild(iconNode(doc, marker.icon || "star", size, color));
2369
+ const text = doc.createElement("span");
2370
+ text.textContent = marker.text || "";
2371
+ el.appendChild(text);
2372
+ return el;
2373
+ }
2374
+ el.style.width = `${size}px`;
2375
+ el.style.height = `${size}px`;
2376
+ el.appendChild(iconNode(doc, marker.icon || "info", size, color));
2377
+ return el;
2378
+ }
2379
+ function markerOffset(anchor, marker, position, offset6) {
2380
+ const right = anchor.left + anchor.width;
2381
+ const bottom = anchor.top + anchor.height;
2382
+ const midY = anchor.top + anchor.height / 2 - marker.height / 2;
2383
+ const midX = anchor.left + anchor.width / 2 - marker.width / 2;
2384
+ let x;
2385
+ let y;
2386
+ switch (position) {
2387
+ case "top-left":
2388
+ x = anchor.left - marker.width / 2;
2389
+ y = anchor.top - marker.height / 2;
2390
+ break;
2391
+ case "bottom-left":
2392
+ x = anchor.left - marker.width / 2;
2393
+ y = bottom - marker.height / 2;
2394
+ break;
2395
+ case "bottom-right":
2396
+ x = right - marker.width / 2;
2397
+ y = bottom - marker.height / 2;
2398
+ break;
2399
+ case "left":
2400
+ x = anchor.left - marker.width - SIDE_GAP;
2401
+ y = midY;
2402
+ break;
2403
+ case "right":
2404
+ x = right + SIDE_GAP;
2405
+ y = midY;
2406
+ break;
2407
+ case "center":
2408
+ x = midX;
2409
+ y = midY;
2410
+ break;
2411
+ default:
2412
+ x = right - marker.width / 2;
2413
+ y = anchor.top - marker.height / 2;
2414
+ }
2415
+ return { x: x + offset6.x, y: y + offset6.y };
2416
+ }
2417
+ function attachMarker(anchor, host, marker) {
2418
+ host.style.position = "absolute";
2419
+ host.style.zIndex = String(num(marker.zIndex, DEFAULT_MARKER_Z));
2420
+ host.style.margin = "0";
2421
+ const update = () => {
2422
+ const a = anchor.getBoundingClientRect();
2423
+ const m = host.getBoundingClientRect();
2424
+ const { x, y } = markerOffset(
2425
+ {
2426
+ left: a.left + window.scrollX,
2427
+ top: a.top + window.scrollY,
2428
+ width: a.width,
2429
+ height: a.height
2430
+ },
2431
+ { width: m.width, height: m.height },
2432
+ marker.position ?? "top-right",
2433
+ { x: num(marker.offsetX, 0), y: num(marker.offsetY, 0) }
2434
+ );
2435
+ host.style.left = `${Math.round(x)}px`;
2436
+ host.style.top = `${Math.round(y)}px`;
2437
+ };
2438
+ update();
2439
+ return autoUpdate(anchor, host, update);
2440
+ }
2253
2441
 
2254
2442
  // src/plugins/guides/renderers/composite-renderer.ts
2255
2443
  var ROW_ALIGN = {
@@ -2545,7 +2733,9 @@ var CompositeRenderer = class extends BaseRenderer {
2545
2733
  badge.style.cursor = "pointer";
2546
2734
  badge.style.display = "inline-flex";
2547
2735
  badge.style.alignItems = "center";
2548
- this.buildContent(badge, step.badge?.blocks ?? [], doc, context, idx, [], host);
2736
+ const marker = step.badge?.marker ?? null;
2737
+ if (marker) badge.appendChild(buildMarkerElement(doc, marker));
2738
+ else this.buildContent(badge, step.badge?.blocks ?? [], doc, context, idx, [], host);
2549
2739
  root.appendChild(badge);
2550
2740
  if (design.fullWidth === true) {
2551
2741
  card.style.width = "auto";
@@ -2560,10 +2750,17 @@ var CompositeRenderer = class extends BaseRenderer {
2560
2750
  if (caretEl) wrapper.appendChild(caretEl);
2561
2751
  wrapper.appendChild(card);
2562
2752
  root.appendChild(wrapper);
2563
- host.style.display = "inline-block";
2564
- const pos = inlinePosOf(step.inlinePosition);
2565
- insertHost(anchor, host, pos);
2566
- this.registerCleanup(keepHostAttached(host, anchorSelector, pos));
2753
+ if (marker) {
2754
+ host.style.display = "inline-block";
2755
+ (anchor.ownerDocument ?? document).body.appendChild(host);
2756
+ this.registerCleanup(attachMarker(anchor, host, marker));
2757
+ this.registerCleanup(() => host.remove());
2758
+ } else {
2759
+ host.style.display = "inline-block";
2760
+ const pos = inlinePosOf(step.inlinePosition);
2761
+ insertHost(anchor, host, pos);
2762
+ this.registerCleanup(keepHostAttached(host, anchorSelector, pos));
2763
+ }
2567
2764
  let open = false;
2568
2765
  let stopFloat = null;
2569
2766
  let closeTimer = null;
@@ -2616,6 +2813,7 @@ var CompositeRenderer = class extends BaseRenderer {
2616
2813
  stopFloat?.();
2617
2814
  if (closeTimer !== null) clearTimeout(closeTimer);
2618
2815
  });
2816
+ if (context.badgeOpen) openTip();
2619
2817
  return closeTip;
2620
2818
  }
2621
2819
  };
@@ -3192,7 +3390,8 @@ var GuidePreviewController = class {
3192
3390
  }
3193
3391
  preview(input) {
3194
3392
  const nextStep = input.guideSteps[0];
3195
- if (this.singleStep && this.input && input.guideType === this.input.guideType && input.guideType !== "walkthrough" && nextStep && this.singleStep.updateStep(nextStep)) {
3393
+ if (this.singleStep && this.input && input.guideType === this.input.guideType && input.guideType !== "walkthrough" && // Abrir/cerrar el tooltip del badge requiere remontar.
3394
+ input.badgeOpen === true === (this.input.badgeOpen === true) && nextStep && this.singleStep.updateStep(nextStep)) {
3196
3395
  this.input = input;
3197
3396
  return {
3198
3397
  close: () => this.close(),
@@ -3222,7 +3421,8 @@ var GuidePreviewController = class {
3222
3421
  }
3223
3422
  return null;
3224
3423
  }
3225
- close() {
3424
+ close(byUser = false) {
3425
+ const onClosed = byUser ? this.input?.onClosed : void 0;
3226
3426
  if (this.singleStep) {
3227
3427
  safeDestroy(this.singleStep);
3228
3428
  this.singleStep = null;
@@ -3234,6 +3434,7 @@ var GuidePreviewController = class {
3234
3434
  this.walkthroughGuide = null;
3235
3435
  this.walkthroughIndex = 0;
3236
3436
  this.input = null;
3437
+ onClosed?.();
3237
3438
  }
3238
3439
  async renderSingleStep(guide) {
3239
3440
  const renderer = createSingleStepRenderer(guide.guideType);
@@ -3246,7 +3447,8 @@ var GuidePreviewController = class {
3246
3447
  onInteraction: (event) => {
3247
3448
  if (event.action === "shown") shown = true;
3248
3449
  },
3249
- onClose: () => this.close(),
3450
+ onClose: () => this.close(true),
3451
+ badgeOpen: this.input?.badgeOpen === true,
3250
3452
  onTrack: () => {
3251
3453
  },
3252
3454
  // Encadenado en preview: no-op — el editor no puede montar otra guía
@@ -3312,7 +3514,7 @@ var GuidePreviewController = class {
3312
3514
  guide,
3313
3515
  onInteraction: () => {
3314
3516
  },
3315
- onClose: () => this.close(),
3517
+ onClose: () => this.close(true),
3316
3518
  nav: { stepIndex: index, totalSteps: guide.guideSteps.length, callbacks }
3317
3519
  });
3318
3520
  } catch {
@@ -3405,16 +3607,36 @@ function safeDestroy(renderer) {
3405
3607
  }
3406
3608
  }
3407
3609
 
3610
+ // src/plugins/guides/activation-devices.ts
3611
+ var MOBILE_MAX_WIDTH = 767;
3612
+ function isDeviceAllowed(devices, viewportWidth = typeof window === "undefined" ? 1024 : window.innerWidth) {
3613
+ if (!devices || devices === "all") return true;
3614
+ const mobile = viewportWidth <= MOBILE_MAX_WIDTH;
3615
+ return devices === "mobile" ? mobile : !mobile;
3616
+ }
3617
+
3408
3618
  // src/plugins/guides/url-match.ts
3619
+ function urlCandidates(pageUrl) {
3620
+ const out = [pageUrl];
3621
+ try {
3622
+ const u = new URL(pageUrl);
3623
+ out.push(`${u.pathname}${u.search}${u.hash}`);
3624
+ if (u.hash.startsWith("#/")) out.push(u.hash.slice(1));
3625
+ } catch {
3626
+ }
3627
+ return out;
3628
+ }
3409
3629
  function matchesUrl(matcher, pageUrl) {
3630
+ const candidates = urlCandidates(pageUrl);
3410
3631
  switch (matcher.type) {
3411
3632
  case "exact":
3412
- return matcher.pattern === pageUrl;
3633
+ return candidates.some((c) => c === matcher.pattern);
3413
3634
  case "prefix":
3414
- return pageUrl.startsWith(matcher.pattern);
3635
+ return candidates.some((c) => c.startsWith(matcher.pattern));
3415
3636
  case "regex":
3416
3637
  try {
3417
- return new RegExp(matcher.pattern).test(pageUrl);
3638
+ const re = new RegExp(matcher.pattern);
3639
+ return candidates.some((c) => re.test(c));
3418
3640
  } catch {
3419
3641
  return false;
3420
3642
  }
@@ -3558,6 +3780,6 @@ function buildSelectorPath(element, maxAncestors = 5) {
3558
3780
  return parts.join(" > ");
3559
3781
  }
3560
3782
 
3561
- export { ALWAYS_BLOCK_SELECTORS, BadgeRenderer, BannerRenderer, CompositeRenderer, CustomRenderer, DEFAULT_AUTOCAPTURE_CONFIG, DEFAULT_TRACKER_BATCH_SIZE, DEFAULT_TRACKER_FLUSH_INTERVAL_MS, DEFAULT_TRACKER_MAX_RETRIES, FREQUENCY_CACHE_KEY_PREFIX, FREQUENCY_CACHE_MAX_ENTRIES, FREQUENCY_CACHE_TTL_MS, FormRenderer, InlineCustomRenderer, InlineFormRenderer, InlineRenderer, MAX_ANCESTORS, ModalRenderer, PRIORITY_ATTRIBUTES, SENSITIVE_ATTRIBUTES, TooltipRenderer, WALKTHROUGH_ABANDONMENT_TIMEOUT_MS, WALKTHROUGH_STATE_KEY_PREFIX, WalkthroughRenderer, buildSelectorPath, clearBuilderToken, clearPreviewToken, closeGuidePreview, filterHumanClasses, getPreviewToken, hasDocument, hasLocalStorage, hasNavigatorSendBeacon, hasWindow, isBuilderMode, previewGuide, resolveBuilderContext, resolveBuilderToken, stepMatchesPage, uuidv7 };
3562
- //# sourceMappingURL=chunk-PK2YOBFO.mjs.map
3563
- //# sourceMappingURL=chunk-PK2YOBFO.mjs.map
3783
+ export { ALWAYS_BLOCK_SELECTORS, BadgeRenderer, BannerRenderer, CompositeRenderer, CustomRenderer, DEFAULT_AUTOCAPTURE_CONFIG, DEFAULT_TRACKER_BATCH_SIZE, DEFAULT_TRACKER_FLUSH_INTERVAL_MS, DEFAULT_TRACKER_MAX_RETRIES, FREQUENCY_CACHE_KEY_PREFIX, FREQUENCY_CACHE_MAX_ENTRIES, FREQUENCY_CACHE_TTL_MS, FormRenderer, InlineCustomRenderer, InlineFormRenderer, InlineRenderer, MAX_ANCESTORS, ModalRenderer, PRIORITY_ATTRIBUTES, SENSITIVE_ATTRIBUTES, TooltipRenderer, WALKTHROUGH_ABANDONMENT_TIMEOUT_MS, WALKTHROUGH_STATE_KEY_PREFIX, WalkthroughRenderer, buildSelectorPath, clearBuilderToken, clearPreviewToken, closeGuidePreview, filterHumanClasses, getPreviewToken, hasDocument, hasLocalStorage, hasNavigatorSendBeacon, hasWindow, isBuilderMode, isDeviceAllowed, previewGuide, resolveBuilderContext, resolveBuilderToken, stepMatchesPage, uuidv7 };
3784
+ //# sourceMappingURL=chunk-M6PB5UMW.mjs.map
3785
+ //# sourceMappingURL=chunk-M6PB5UMW.mjs.map