veo-sdk 0.4.2 → 0.5.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.
@@ -0,0 +1,5 @@
1
+ export { attachDesignManipulator, createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker } from './chunk-PGGUVH4V.mjs';
2
+ import './chunk-L3JSRBVO.mjs';
3
+ import './chunk-PTG3BTJE.mjs';
4
+ //# sourceMappingURL=builder-R2BHDQZH.mjs.map
5
+ //# sourceMappingURL=builder-R2BHDQZH.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-S6ZODU2M.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-R2BHDQZH.mjs"}
package/dist/builder.cjs CHANGED
@@ -377,12 +377,12 @@ function buildButtonBlock(block, doc, callbacks) {
377
377
  applyBlockStyle(btn, block.style, "button");
378
378
  btn.addEventListener("click", () => {
379
379
  const action = block.action ?? "dismiss";
380
- const url = action === "url" && typeof block.url === "string" && isSafeUrl(block.url) ? block.url : void 0;
380
+ const target = action === "url" && typeof block.url === "string" && isSafeUrl(block.url) ? block.url : action === "guide" && typeof block.targetGuideId === "string" && block.targetGuideId ? block.targetGuideId : void 0;
381
381
  const meta = {
382
382
  ...typeof block.id === "string" && block.id ? { buttonId: block.id } : {},
383
383
  ...typeof block.text === "string" && block.text ? { buttonText: block.text } : {}
384
384
  };
385
- callbacks.onCtaClick(action, url, Object.keys(meta).length ? meta : void 0);
385
+ callbacks.onCtaClick(action, target, Object.keys(meta).length ? meta : void 0);
386
386
  });
387
387
  return btn;
388
388
  }
@@ -996,10 +996,22 @@ var GUIDE_STYLES = `
996
996
  padding: 3px 9px;
997
997
  white-space: nowrap;
998
998
  }
999
+ .veo-badge--text {
1000
+ color: var(--veo-primary);
1001
+ font-weight: 600;
1002
+ white-space: nowrap;
1003
+ text-decoration: underline dotted;
1004
+ text-underline-offset: 3px;
1005
+ }
999
1006
  .veo-badge--image img { display: block; border-radius: 4px; object-fit: cover; }
1000
1007
  /* El tooltip del badge usa strategy fixed (el host vive dentro del flujo del
1001
- cliente; un absoluto se recortar\xEDa con overflow de ancestros). */
1002
- .veo-badge-tooltip { position: fixed; }
1008
+ cliente; un absoluto se recortar\xEDa con overflow de ancestros). Su ancho es
1009
+ personalizable v\xEDa var dedicada (--veo-width no sirve: el :host la define
1010
+ en 420px siempre y pisar\xEDa el default de 300px de los tooltips). */
1011
+ .veo-badge-tooltip {
1012
+ position: fixed;
1013
+ max-width: var(--veo-badge-tip-width, 300px);
1014
+ }
1003
1015
  @keyframes veo-badge-pulse {
1004
1016
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--veo-primary) 45%, transparent); }
1005
1017
  70% { box-shadow: 0 0 0 7px transparent; }
@@ -1183,6 +1195,13 @@ var BadgeRenderer = class extends BaseRenderer {
1183
1195
  const { host, root } = this.createHost();
1184
1196
  const ownerDocument = root.ownerDocument ?? document;
1185
1197
  this.applyDesign(step.style);
1198
+ const tipWidth = step.style?.width;
1199
+ if (typeof tipWidth === "number" && Number.isFinite(tipWidth)) {
1200
+ host.style.setProperty(
1201
+ "--veo-badge-tip-width",
1202
+ `${Math.min(720, Math.max(220, tipWidth))}px`
1203
+ );
1204
+ }
1186
1205
  this.trigger = step.style?.badgeTrigger === "click" ? "click" : "hover";
1187
1206
  const rawSide = step.style?.tooltipPlacement;
1188
1207
  this.side = rawSide === "bottom" || rawSide === "left" || rawSide === "right" ? rawSide : "top";
@@ -1206,20 +1225,14 @@ var BadgeRenderer = class extends BaseRenderer {
1206
1225
  });
1207
1226
  };
1208
1227
  const buildTooltipContent = (s) => buildStepContent(s, ownerDocument, {
1209
- onCtaClick: (action, url, meta) => {
1228
+ onCtaClick: (action, target, meta) => {
1210
1229
  emit("cta_clicked", meta);
1211
- if (action === "url" && url) window.open(url, "_blank", "noopener,noreferrer");
1212
- if (action === "dismiss") {
1213
- emit("dismissed");
1214
- context.onClose();
1215
- return;
1216
- }
1230
+ if (action === "url" && target) window.open(target, "_blank", "noopener,noreferrer");
1217
1231
  this.closeTooltip();
1232
+ if (action === "guide" && target) context.onOpenGuide?.(target);
1218
1233
  },
1219
- onDismiss: () => {
1220
- emit("dismissed");
1221
- context.onClose();
1222
- }
1234
+ // La ✕ también cierra solo el tooltip (nunca el badge, nunca dismissed).
1235
+ onDismiss: () => this.closeTooltip()
1223
1236
  });
1224
1237
  const content = buildTooltipContent(step);
1225
1238
  tooltip.appendChild(content);
@@ -1350,7 +1363,7 @@ function readBadgeConfig(step) {
1350
1363
  const raw = step.style?.badge;
1351
1364
  if (!raw || typeof raw !== "object") return { kind: "icon" };
1352
1365
  const b = raw;
1353
- const kind = b.kind === "dot" || b.kind === "pill" || b.kind === "image" || b.kind === "icon" ? b.kind : "icon";
1366
+ const kind = b.kind === "dot" || b.kind === "pill" || b.kind === "text" || b.kind === "image" || b.kind === "icon" ? b.kind : "icon";
1354
1367
  return {
1355
1368
  kind,
1356
1369
  icon: typeof b.icon === "string" ? b.icon : null,
@@ -1381,6 +1394,12 @@ function buildBadgeElement(config, doc) {
1381
1394
  if (config.color) btn.style.background = config.color;
1382
1395
  break;
1383
1396
  }
1397
+ case "text": {
1398
+ btn.textContent = config.text?.slice(0, 32) || "Nuevo";
1399
+ btn.style.fontSize = `${clamp2(Math.round(size * 0.7), 9, 28)}px`;
1400
+ if (config.color) btn.style.color = config.color;
1401
+ break;
1402
+ }
1384
1403
  case "image": {
1385
1404
  if (config.imageUrl && isSafeUrl(config.imageUrl)) {
1386
1405
  const img = doc.createElement("img");
@@ -1517,7 +1536,10 @@ var BannerRenderer = class extends BaseRenderer {
1517
1536
  ownerDocument,
1518
1537
  context.nav.callbacks
1519
1538
  ) : buildStepContent(step, ownerDocument, {
1520
- onCtaClick: (action, url, meta) => dismiss("cta_clicked", action === "url" ? url : void 0, meta),
1539
+ onCtaClick: (action, target, meta) => {
1540
+ dismiss("cta_clicked", action === "url" ? target : void 0, meta);
1541
+ if (action === "guide" && target) context.onOpenGuide?.(target);
1542
+ },
1521
1543
  onDismiss: () => dismiss("dismissed")
1522
1544
  });
1523
1545
  banner.appendChild(content);
@@ -1532,7 +1554,10 @@ var BannerRenderer = class extends BaseRenderer {
1532
1554
  this.liveContainer = banner;
1533
1555
  this.liveContent = content;
1534
1556
  this.liveBuild = (s) => buildStepContent(s, ownerDocument, {
1535
- onCtaClick: (action, url, meta) => dismiss("cta_clicked", action === "url" ? url : void 0, meta),
1557
+ onCtaClick: (action, target, meta) => {
1558
+ dismiss("cta_clicked", action === "url" ? target : void 0, meta);
1559
+ if (action === "guide" && target) context.onOpenGuide?.(target);
1560
+ },
1536
1561
  onDismiss: () => dismiss("dismissed")
1537
1562
  });
1538
1563
  this.liveKey = this.liveKeyOf(step);
@@ -2168,7 +2193,10 @@ var InlineRenderer = class extends BaseRenderer {
2168
2193
  context.onClose();
2169
2194
  };
2170
2195
  const content = buildStepContent(step, ownerDocument, {
2171
- onCtaClick: (action, url, meta) => dismiss("cta_clicked", action === "url" ? url : void 0, meta),
2196
+ onCtaClick: (action, target, meta) => {
2197
+ dismiss("cta_clicked", action === "url" ? target : void 0, meta);
2198
+ if (action === "guide" && target) context.onOpenGuide?.(target);
2199
+ },
2172
2200
  onDismiss: () => dismiss("dismissed")
2173
2201
  });
2174
2202
  card.appendChild(content);
@@ -2177,7 +2205,10 @@ var InlineRenderer = class extends BaseRenderer {
2177
2205
  this.liveContent = content;
2178
2206
  this.liveKey = `${selector}|${position}`;
2179
2207
  this.liveBuild = (s) => buildStepContent(s, ownerDocument, {
2180
- onCtaClick: (action, url, meta) => dismiss("cta_clicked", action === "url" ? url : void 0, meta),
2208
+ onCtaClick: (action, target, meta) => {
2209
+ dismiss("cta_clicked", action === "url" ? target : void 0, meta);
2210
+ if (action === "guide" && target) context.onOpenGuide?.(target);
2211
+ },
2181
2212
  onDismiss: () => dismiss("dismissed")
2182
2213
  });
2183
2214
  context.onInteraction({ guideId: context.guide.guideId, stepIndex: 0, action: "shown" });
@@ -2229,7 +2260,10 @@ var ModalRenderer = class extends BaseRenderer {
2229
2260
  ownerDocument,
2230
2261
  context.nav.callbacks
2231
2262
  ) : buildStepContent(step, ownerDocument, {
2232
- onCtaClick: (action, url, meta) => dismiss("cta_clicked", action === "url" ? url : void 0, meta),
2263
+ onCtaClick: (action, target, meta) => {
2264
+ dismiss("cta_clicked", action === "url" ? target : void 0, meta);
2265
+ if (action === "guide" && target) context.onOpenGuide?.(target);
2266
+ },
2233
2267
  onDismiss: () => dismiss("dismissed")
2234
2268
  });
2235
2269
  card.appendChild(content);
@@ -2239,7 +2273,10 @@ var ModalRenderer = class extends BaseRenderer {
2239
2273
  this.liveContainer = card;
2240
2274
  this.liveContent = content;
2241
2275
  this.liveBuild = (s) => buildStepContent(s, ownerDocument, {
2242
- onCtaClick: (action, url, meta) => dismiss("cta_clicked", action === "url" ? url : void 0, meta),
2276
+ onCtaClick: (action, target, meta) => {
2277
+ dismiss("cta_clicked", action === "url" ? target : void 0, meta);
2278
+ if (action === "guide" && target) context.onOpenGuide?.(target);
2279
+ },
2243
2280
  onDismiss: () => dismiss("dismissed")
2244
2281
  });
2245
2282
  }
@@ -2295,8 +2332,9 @@ var TooltipRenderer = class extends BaseRenderer {
2295
2332
  context.onClose();
2296
2333
  };
2297
2334
  const content = buildStepContent(step, ownerDocument, {
2298
- onCtaClick: (action, url, meta) => {
2299
- dismiss("cta_clicked", action === "url" ? url : void 0, meta);
2335
+ onCtaClick: (action, target, meta) => {
2336
+ dismiss("cta_clicked", action === "url" ? target : void 0, meta);
2337
+ if (action === "guide" && target) context.onOpenGuide?.(target);
2300
2338
  },
2301
2339
  onDismiss: () => dismiss("dismissed")
2302
2340
  });
@@ -2329,7 +2367,10 @@ var TooltipRenderer = class extends BaseRenderer {
2329
2367
  this.liveContent = content;
2330
2368
  this.liveKey = selector;
2331
2369
  this.liveBuild = (s) => buildStepContent(s, ownerDocument, {
2332
- onCtaClick: (action, url, meta) => dismiss("cta_clicked", action === "url" ? url : void 0, meta),
2370
+ onCtaClick: (action, target, meta) => {
2371
+ dismiss("cta_clicked", action === "url" ? target : void 0, meta);
2372
+ if (action === "guide" && target) context.onOpenGuide?.(target);
2373
+ },
2333
2374
  onDismiss: () => dismiss("dismissed")
2334
2375
  });
2335
2376
  context.onInteraction({
@@ -2461,6 +2502,10 @@ var GuidePreviewController = class {
2461
2502
  onClose: () => this.close(),
2462
2503
  onTrack: () => {
2463
2504
  },
2505
+ // Encadenado en preview: no-op — el editor no puede montar otra guía
2506
+ // guardada; el click igual cierra la preview actual (vía onCtaClick).
2507
+ onOpenGuide: () => {
2508
+ },
2464
2509
  // Preview de forms: por defecto simula el envío SIN escribir props;
2465
2510
  // el caller puede pasar `formSubmit` real (link de preview).
2466
2511
  onFormSubmit: this.input?.formSubmit ?? (() => Promise.resolve(true)),