veo-sdk 0.3.15 → 0.3.16

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 { createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker } from './chunk-QCIT7CGE.mjs';
2
+ import './chunk-YHUPUTWH.mjs';
3
+ import './chunk-PTG3BTJE.mjs';
4
+ //# sourceMappingURL=builder-EQYOMQFY.mjs.map
5
+ //# sourceMappingURL=builder-EQYOMQFY.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-BKLDSVN5.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-EQYOMQFY.mjs"}
package/dist/builder.cjs CHANGED
@@ -854,6 +854,37 @@ var BaseRenderer = class {
854
854
  this.host = null;
855
855
  this.shadow = null;
856
856
  this.cleanups = [];
857
+ // ── Update in-place (preview en vivo del editor) ──
858
+ // La subclase setea estas piezas en render() para habilitarlo: el contenedor
859
+ // del contenido, el nodo de contenido actual y cómo reconstruirlo.
860
+ this.liveContainer = null;
861
+ this.liveContent = null;
862
+ this.liveBuild = null;
863
+ /** Clave de anclaje/estructura fijada en render(); si cambia → remontar. */
864
+ this.liveKey = "";
865
+ }
866
+ /** Clave de anclaje derivada del step (override por subclase). */
867
+ liveKeyOf(_step) {
868
+ return "";
869
+ }
870
+ /** Hook post-swap (reposicionar tooltip, actualizar clase del banner…). */
871
+ onLiveUpdate(_step) {
872
+ }
873
+ /**
874
+ * Actualiza el contenido del step SIN remontar el host — así el preview del
875
+ * editor no parpadea en cada tecla. Devuelve `false` cuando el renderer no
876
+ * lo soporta o el cambio requiere remontar (cambió el ancla/estructura);
877
+ * en ese caso el caller hace el re-render completo.
878
+ */
879
+ updateStep(step) {
880
+ if (!this.host || !this.liveContainer || !this.liveContent || !this.liveBuild) return false;
881
+ if (this.liveKeyOf(step) !== this.liveKey) return false;
882
+ const next = this.liveBuild(step);
883
+ this.liveContainer.replaceChild(next, this.liveContent);
884
+ this.liveContent = next;
885
+ this.applyDesign(step.style);
886
+ this.onLiveUpdate(step);
887
+ return true;
857
888
  }
858
889
  /**
859
890
  * Crea un `<div data-veo-guide>` adjunto a `document.body`, le adjunta
@@ -936,9 +967,21 @@ var BannerRenderer = class extends BaseRenderer {
936
967
  banner.appendChild(content);
937
968
  root.appendChild(banner);
938
969
  if (!context.nav) {
970
+ this.liveContainer = banner;
971
+ this.liveContent = content;
972
+ this.liveBuild = (s) => buildStepContent(s, ownerDocument, {
973
+ onCtaClick: (action, url) => dismiss("cta_clicked", action === "url" ? url : void 0),
974
+ onDismiss: () => dismiss("dismissed")
975
+ });
939
976
  context.onInteraction({ guideId: context.guide.guideId, stepIndex: 0, action: "shown" });
940
977
  }
941
978
  }
979
+ onLiveUpdate(step) {
980
+ if (this.liveContainer) {
981
+ const position = step.style?.position === "bottom" ? "bottom" : "top";
982
+ this.liveContainer.className = `veo-banner veo-banner-${position}`;
983
+ }
984
+ }
942
985
  };
943
986
 
944
987
  // src/plugins/guides/wait-for-element.ts
@@ -1613,8 +1656,18 @@ var InlineRenderer = class extends BaseRenderer {
1613
1656
  });
1614
1657
  card.appendChild(content);
1615
1658
  root.appendChild(card);
1659
+ this.liveContainer = card;
1660
+ this.liveContent = content;
1661
+ this.liveKey = `${selector}|${position}`;
1662
+ this.liveBuild = (s) => buildStepContent(s, ownerDocument, {
1663
+ onCtaClick: (action, url) => dismiss("cta_clicked", action === "url" ? url : void 0),
1664
+ onDismiss: () => dismiss("dismissed")
1665
+ });
1616
1666
  context.onInteraction({ guideId: context.guide.guideId, stepIndex: 0, action: "shown" });
1617
1667
  }
1668
+ liveKeyOf(step) {
1669
+ return `${step.selector ?? ""}|${readInlinePosition(step.style)}`;
1670
+ }
1618
1671
  };
1619
1672
 
1620
1673
  // src/plugins/guides/renderers/modal-renderer.ts
@@ -1652,6 +1705,14 @@ var ModalRenderer = class extends BaseRenderer {
1652
1705
  card.appendChild(content);
1653
1706
  overlay.appendChild(card);
1654
1707
  root.appendChild(overlay);
1708
+ if (!context.nav) {
1709
+ this.liveContainer = card;
1710
+ this.liveContent = content;
1711
+ this.liveBuild = (s) => buildStepContent(s, ownerDocument, {
1712
+ onCtaClick: (action, url) => dismiss("cta_clicked", action === "url" ? url : void 0),
1713
+ onDismiss: () => dismiss("dismissed")
1714
+ });
1715
+ }
1655
1716
  overlay.addEventListener("click", (e) => {
1656
1717
  if (e.target === overlay) onBackdropOrEsc();
1657
1718
  });
@@ -1685,6 +1746,12 @@ function positionArrow(arrowEl, placement, data) {
1685
1746
 
1686
1747
  // src/plugins/guides/renderers/tooltip-renderer.ts
1687
1748
  var TooltipRenderer = class extends BaseRenderer {
1749
+ constructor() {
1750
+ super(...arguments);
1751
+ /** Lado preferido (mutable: el update in-place puede cambiarlo). */
1752
+ this.side = "bottom";
1753
+ this.reposition = null;
1754
+ }
1688
1755
  async render(context) {
1689
1756
  const step = context.guide.guideSteps[0];
1690
1757
  if (!step) return;
@@ -1693,7 +1760,7 @@ var TooltipRenderer = class extends BaseRenderer {
1693
1760
  const anchor = await waitForElement(selector);
1694
1761
  if (!anchor) return;
1695
1762
  const rawSide = step.style?.tooltipPlacement;
1696
- const side = rawSide === "top" || rawSide === "left" || rawSide === "right" ? rawSide : "bottom";
1763
+ this.side = rawSide === "top" || rawSide === "left" || rawSide === "right" ? rawSide : "bottom";
1697
1764
  const { root } = this.createHost();
1698
1765
  this.applyDesign(step.style);
1699
1766
  const ownerDocument = root.ownerDocument ?? document;
@@ -1721,7 +1788,7 @@ var TooltipRenderer = class extends BaseRenderer {
1721
1788
  root.appendChild(tooltip);
1722
1789
  const updatePosition = async () => {
1723
1790
  const { x, y, placement, middlewareData } = await dom.computePosition(anchor, tooltip, {
1724
- placement: side,
1791
+ placement: this.side,
1725
1792
  middleware: [dom.offset(10), dom.flip(), dom.shift({ padding: 8 }), dom.arrow({ element: arrowEl })]
1726
1793
  });
1727
1794
  tooltip.style.left = `${x}px`;
@@ -1732,18 +1799,34 @@ var TooltipRenderer = class extends BaseRenderer {
1732
1799
  const reposition = () => {
1733
1800
  void updatePosition();
1734
1801
  };
1802
+ this.reposition = reposition;
1735
1803
  window.addEventListener("scroll", reposition, true);
1736
1804
  window.addEventListener("resize", reposition);
1737
1805
  this.registerCleanup(() => {
1738
1806
  window.removeEventListener("scroll", reposition, true);
1739
1807
  window.removeEventListener("resize", reposition);
1740
1808
  });
1809
+ this.liveContainer = tooltip;
1810
+ this.liveContent = content;
1811
+ this.liveKey = selector;
1812
+ this.liveBuild = (s) => buildStepContent(s, ownerDocument, {
1813
+ onCtaClick: (action, url) => dismiss("cta_clicked", action === "url" ? url : void 0),
1814
+ onDismiss: () => dismiss("dismissed")
1815
+ });
1741
1816
  context.onInteraction({
1742
1817
  guideId: context.guide.guideId,
1743
1818
  stepIndex: 0,
1744
1819
  action: "shown"
1745
1820
  });
1746
1821
  }
1822
+ liveKeyOf(step) {
1823
+ return step.selector ?? "";
1824
+ }
1825
+ onLiveUpdate(step) {
1826
+ const raw = step.style?.tooltipPlacement;
1827
+ this.side = raw === "top" || raw === "left" || raw === "right" ? raw : "bottom";
1828
+ this.reposition?.();
1829
+ }
1747
1830
  };
1748
1831
  var WalkthroughRenderer = class extends BaseRenderer {
1749
1832
  async render(context) {
@@ -1808,6 +1891,11 @@ var GuidePreviewController = class {
1808
1891
  this.input = null;
1809
1892
  }
1810
1893
  preview(input) {
1894
+ const nextStep = input.guideSteps[0];
1895
+ if (this.singleStep && this.input && input.guideType === this.input.guideType && input.guideType !== "walkthrough" && nextStep && this.singleStep.updateStep(nextStep)) {
1896
+ this.input = input;
1897
+ return { close: () => this.close(), ready: Promise.resolve({ rendered: true }) };
1898
+ }
1811
1899
  this.close();
1812
1900
  this.input = input;
1813
1901
  const guide = normalize(input);