veo-sdk 0.5.25 → 0.5.27

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/builder.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import './chunk-RDV5GIU7.mjs';
2
- import { initBuilderMode } from './chunk-5F3DX5VP.mjs';
3
- export { createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker } from './chunk-5F3DX5VP.mjs';
4
- export { closeGuidePreview, previewGuide } from './chunk-ZK4HWKL3.mjs';
1
+ import './chunk-XW4KLWLJ.mjs';
2
+ import { initBuilderMode } from './chunk-RHYVNG3X.mjs';
3
+ export { createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker } from './chunk-RHYVNG3X.mjs';
4
+ export { closeGuidePreview, previewGuide } from './chunk-6XZPR7VC.mjs';
5
5
  import './chunk-PTG3BTJE.mjs';
6
6
 
7
7
  // src/builder.ts
@@ -1861,7 +1861,25 @@ function escapeClosing(code, tag) {
1861
1861
  }
1862
1862
 
1863
1863
  // src/plugins/guides/code-block.ts
1864
- function mountCodeBlock(block, doc, context) {
1864
+ function insertRawNodes(anchor, nodes, pos) {
1865
+ const parent = anchor.parentNode;
1866
+ if (pos === "prepend") {
1867
+ const first = anchor.firstChild;
1868
+ for (const n of nodes) anchor.insertBefore(n, first);
1869
+ } else if (pos === "append") {
1870
+ for (const n of nodes) anchor.appendChild(n);
1871
+ } else if (pos === "before") {
1872
+ for (const n of nodes) parent?.insertBefore(n, anchor);
1873
+ } else {
1874
+ let ref = anchor;
1875
+ for (const n of nodes) {
1876
+ parent?.insertBefore(n, ref.nextSibling);
1877
+ ref = n;
1878
+ }
1879
+ }
1880
+ }
1881
+ var codeSlotSeq = 0;
1882
+ function mountCodeBlock(block, doc, context, host, rawInline) {
1865
1883
  if (block.sandboxed) {
1866
1884
  const step = { html: block.html ?? "", css: block.css, js: block.js };
1867
1885
  const { iframe, cleanup } = mountCustomFrame(doc, step, context, { width: "100%" });
@@ -1880,19 +1898,28 @@ function mountCodeBlock(block, doc, context) {
1880
1898
  }
1881
1899
  let node = null;
1882
1900
  if (typeof block.html === "string" && block.html.trim()) {
1883
- node = doc.createElement("div");
1884
- node.className = "veo-code-html";
1885
- const inner = node.attachShadow({ mode: "open" });
1886
- for (const sheet of Array.from(hostDoc.querySelectorAll('link[rel="stylesheet"], style'))) {
1887
- inner.appendChild(sheet.cloneNode(true));
1888
- }
1889
1901
  const holder = doc.createElement("div");
1902
+ holder.className = "veo-code-html";
1890
1903
  holder.innerHTML = block.html;
1891
1904
  for (const old of Array.from(holder.querySelectorAll("script"))) {
1892
1905
  injected.push(runScript(old, hostDoc));
1893
1906
  old.remove();
1894
1907
  }
1895
- inner.appendChild(holder);
1908
+ if (rawInline) {
1909
+ const rawNodes = Array.from(holder.childNodes);
1910
+ insertRawNodes(rawInline.anchor, rawNodes, rawInline.pos);
1911
+ injected.push(...rawNodes);
1912
+ } else if (host) {
1913
+ const slotName = `veo-code-${++codeSlotSeq}`;
1914
+ holder.slot = slotName;
1915
+ host.appendChild(holder);
1916
+ injected.push(holder);
1917
+ const slot = doc.createElement("slot");
1918
+ slot.setAttribute("name", slotName);
1919
+ node = slot;
1920
+ } else {
1921
+ node = holder;
1922
+ }
1896
1923
  }
1897
1924
  if (typeof block.js === "string" && block.js.trim()) {
1898
1925
  const s = hostDoc.createElement("script");
@@ -2197,6 +2224,18 @@ var CompositeRenderer = class extends BaseRenderer {
2197
2224
  anchor = await waitForElement(anchorSelector);
2198
2225
  if (!anchor) return;
2199
2226
  }
2227
+ const blocks = step.blocks ?? [];
2228
+ const soleCode = blocks.length === 1 && blocks[0]?.type === "code" ? blocks[0] : void 0;
2229
+ if (step.presentation === "inline" && anchor && soleCode && !soleCode.sandboxed) {
2230
+ const rawDoc = anchor.ownerDocument ?? document;
2231
+ const { cleanup } = mountCodeBlock(soleCode, rawDoc, context, void 0, {
2232
+ anchor,
2233
+ pos: inlinePosOf(step.inlinePosition)
2234
+ });
2235
+ this.registerCleanup(cleanup);
2236
+ context.onInteraction({ guideId: context.guide.guideId, stepIndex: idx, action: "shown" });
2237
+ return;
2238
+ }
2200
2239
  const { host, root } = this.createHost();
2201
2240
  const doc = root.ownerDocument ?? document;
2202
2241
  const design = step.design ?? {};
@@ -2213,7 +2252,7 @@ var CompositeRenderer = class extends BaseRenderer {
2213
2252
  });
2214
2253
  };
2215
2254
  const readers = [];
2216
- this.buildContent(card, step.blocks ?? [], doc, context, idx, readers);
2255
+ this.buildContent(card, step.blocks ?? [], doc, context, idx, readers, host);
2217
2256
  const lastBlock = card.lastElementChild;
2218
2257
  if (lastBlock && !lastBlock.style.marginBottom) lastBlock.style.marginBottom = "0";
2219
2258
  if (design.closeButton !== false) {
@@ -2284,7 +2323,7 @@ var CompositeRenderer = class extends BaseRenderer {
2284
2323
  context.onInteraction({ guideId: context.guide.guideId, stepIndex: idx, action: "shown" });
2285
2324
  }
2286
2325
  /** Recorre los bloques en orden y los pinta en la card. */
2287
- buildContent(card, blocks, doc, context, idx, readers) {
2326
+ buildContent(card, blocks, doc, context, idx, readers, host) {
2288
2327
  const emit = (block) => {
2289
2328
  context.onInteraction({
2290
2329
  guideId: context.guide.guideId,
@@ -2318,7 +2357,7 @@ var CompositeRenderer = class extends BaseRenderer {
2318
2357
  continue;
2319
2358
  }
2320
2359
  if (b.type === "code") {
2321
- const { node: node2, cleanup } = mountCodeBlock(b, doc, context);
2360
+ const { node: node2, cleanup } = mountCodeBlock(b, doc, context, host);
2322
2361
  if (node2) card.appendChild(node2);
2323
2362
  this.registerCleanup(cleanup);
2324
2363
  i++;
@@ -3366,5 +3405,5 @@ function buildSelectorPath(element, maxAncestors = 5) {
3366
3405
  }
3367
3406
 
3368
3407
  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, closeGuidePreview, filterHumanClasses, hasDocument, hasLocalStorage, hasNavigatorSendBeacon, hasWindow, isBuilderMode, previewGuide, resolveBuilderContext, resolveBuilderToken, stepMatchesPage, uuidv7 };
3369
- //# sourceMappingURL=chunk-ZK4HWKL3.mjs.map
3370
- //# sourceMappingURL=chunk-ZK4HWKL3.mjs.map
3408
+ //# sourceMappingURL=chunk-6XZPR7VC.mjs.map
3409
+ //# sourceMappingURL=chunk-6XZPR7VC.mjs.map