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-5UDF6IHS.mjs +5 -0
- package/dist/{builder-HDTWSDJR.mjs.map → builder-5UDF6IHS.mjs.map} +1 -1
- package/dist/builder.cjs +50 -11
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.mjs +4 -4
- package/dist/{chunk-ZK4HWKL3.mjs → chunk-6XZPR7VC.mjs} +52 -13
- package/dist/chunk-6XZPR7VC.mjs.map +1 -0
- package/dist/{chunk-5F3DX5VP.mjs → chunk-RHYVNG3X.mjs} +3 -3
- package/dist/{chunk-5F3DX5VP.mjs.map → chunk-RHYVNG3X.mjs.map} +1 -1
- package/dist/{chunk-RDV5GIU7.mjs → chunk-XW4KLWLJ.mjs} +3 -3
- package/dist/{chunk-RDV5GIU7.mjs.map → chunk-XW4KLWLJ.mjs.map} +1 -1
- package/dist/index.cjs +51 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/veo-builder.js +10 -10
- package/dist/veo-builder.js.map +1 -1
- package/dist/veo-guides.js +5 -5
- package/dist/veo-guides.js.map +1 -1
- package/package.json +1 -1
- package/dist/builder-HDTWSDJR.mjs +0 -5
- package/dist/chunk-ZK4HWKL3.mjs.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { VEO_BLOCK_MIME, attachBlockDropTarget, attachDesignManipulator, createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker } from './chunk-RHYVNG3X.mjs';
|
|
2
|
+
import './chunk-6XZPR7VC.mjs';
|
|
3
|
+
import './chunk-PTG3BTJE.mjs';
|
|
4
|
+
//# sourceMappingURL=builder-5UDF6IHS.mjs.map
|
|
5
|
+
//# sourceMappingURL=builder-5UDF6IHS.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"builder-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"builder-5UDF6IHS.mjs"}
|
package/dist/builder.cjs
CHANGED
|
@@ -1947,7 +1947,25 @@ function escapeClosing(code, tag) {
|
|
|
1947
1947
|
}
|
|
1948
1948
|
|
|
1949
1949
|
// src/plugins/guides/code-block.ts
|
|
1950
|
-
function
|
|
1950
|
+
function insertRawNodes(anchor, nodes, pos) {
|
|
1951
|
+
const parent = anchor.parentNode;
|
|
1952
|
+
if (pos === "prepend") {
|
|
1953
|
+
const first = anchor.firstChild;
|
|
1954
|
+
for (const n of nodes) anchor.insertBefore(n, first);
|
|
1955
|
+
} else if (pos === "append") {
|
|
1956
|
+
for (const n of nodes) anchor.appendChild(n);
|
|
1957
|
+
} else if (pos === "before") {
|
|
1958
|
+
for (const n of nodes) parent?.insertBefore(n, anchor);
|
|
1959
|
+
} else {
|
|
1960
|
+
let ref = anchor;
|
|
1961
|
+
for (const n of nodes) {
|
|
1962
|
+
parent?.insertBefore(n, ref.nextSibling);
|
|
1963
|
+
ref = n;
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
var codeSlotSeq = 0;
|
|
1968
|
+
function mountCodeBlock(block, doc, context, host, rawInline) {
|
|
1951
1969
|
if (block.sandboxed) {
|
|
1952
1970
|
const step = { html: block.html ?? "", css: block.css, js: block.js };
|
|
1953
1971
|
const { iframe, cleanup } = mountCustomFrame(doc, step, context, { width: "100%" });
|
|
@@ -1966,19 +1984,28 @@ function mountCodeBlock(block, doc, context) {
|
|
|
1966
1984
|
}
|
|
1967
1985
|
let node = null;
|
|
1968
1986
|
if (typeof block.html === "string" && block.html.trim()) {
|
|
1969
|
-
node = doc.createElement("div");
|
|
1970
|
-
node.className = "veo-code-html";
|
|
1971
|
-
const inner = node.attachShadow({ mode: "open" });
|
|
1972
|
-
for (const sheet of Array.from(hostDoc.querySelectorAll('link[rel="stylesheet"], style'))) {
|
|
1973
|
-
inner.appendChild(sheet.cloneNode(true));
|
|
1974
|
-
}
|
|
1975
1987
|
const holder = doc.createElement("div");
|
|
1988
|
+
holder.className = "veo-code-html";
|
|
1976
1989
|
holder.innerHTML = block.html;
|
|
1977
1990
|
for (const old of Array.from(holder.querySelectorAll("script"))) {
|
|
1978
1991
|
injected.push(runScript(old, hostDoc));
|
|
1979
1992
|
old.remove();
|
|
1980
1993
|
}
|
|
1981
|
-
|
|
1994
|
+
if (rawInline) {
|
|
1995
|
+
const rawNodes = Array.from(holder.childNodes);
|
|
1996
|
+
insertRawNodes(rawInline.anchor, rawNodes, rawInline.pos);
|
|
1997
|
+
injected.push(...rawNodes);
|
|
1998
|
+
} else if (host) {
|
|
1999
|
+
const slotName = `veo-code-${++codeSlotSeq}`;
|
|
2000
|
+
holder.slot = slotName;
|
|
2001
|
+
host.appendChild(holder);
|
|
2002
|
+
injected.push(holder);
|
|
2003
|
+
const slot = doc.createElement("slot");
|
|
2004
|
+
slot.setAttribute("name", slotName);
|
|
2005
|
+
node = slot;
|
|
2006
|
+
} else {
|
|
2007
|
+
node = holder;
|
|
2008
|
+
}
|
|
1982
2009
|
}
|
|
1983
2010
|
if (typeof block.js === "string" && block.js.trim()) {
|
|
1984
2011
|
const s = hostDoc.createElement("script");
|
|
@@ -2283,6 +2310,18 @@ var CompositeRenderer = class extends BaseRenderer {
|
|
|
2283
2310
|
anchor = await waitForElement(anchorSelector);
|
|
2284
2311
|
if (!anchor) return;
|
|
2285
2312
|
}
|
|
2313
|
+
const blocks = step.blocks ?? [];
|
|
2314
|
+
const soleCode = blocks.length === 1 && blocks[0]?.type === "code" ? blocks[0] : void 0;
|
|
2315
|
+
if (step.presentation === "inline" && anchor && soleCode && !soleCode.sandboxed) {
|
|
2316
|
+
const rawDoc = anchor.ownerDocument ?? document;
|
|
2317
|
+
const { cleanup } = mountCodeBlock(soleCode, rawDoc, context, void 0, {
|
|
2318
|
+
anchor,
|
|
2319
|
+
pos: inlinePosOf(step.inlinePosition)
|
|
2320
|
+
});
|
|
2321
|
+
this.registerCleanup(cleanup);
|
|
2322
|
+
context.onInteraction({ guideId: context.guide.guideId, stepIndex: idx, action: "shown" });
|
|
2323
|
+
return;
|
|
2324
|
+
}
|
|
2286
2325
|
const { host, root } = this.createHost();
|
|
2287
2326
|
const doc = root.ownerDocument ?? document;
|
|
2288
2327
|
const design = step.design ?? {};
|
|
@@ -2299,7 +2338,7 @@ var CompositeRenderer = class extends BaseRenderer {
|
|
|
2299
2338
|
});
|
|
2300
2339
|
};
|
|
2301
2340
|
const readers = [];
|
|
2302
|
-
this.buildContent(card, step.blocks ?? [], doc, context, idx, readers);
|
|
2341
|
+
this.buildContent(card, step.blocks ?? [], doc, context, idx, readers, host);
|
|
2303
2342
|
const lastBlock = card.lastElementChild;
|
|
2304
2343
|
if (lastBlock && !lastBlock.style.marginBottom) lastBlock.style.marginBottom = "0";
|
|
2305
2344
|
if (design.closeButton !== false) {
|
|
@@ -2370,7 +2409,7 @@ var CompositeRenderer = class extends BaseRenderer {
|
|
|
2370
2409
|
context.onInteraction({ guideId: context.guide.guideId, stepIndex: idx, action: "shown" });
|
|
2371
2410
|
}
|
|
2372
2411
|
/** Recorre los bloques en orden y los pinta en la card. */
|
|
2373
|
-
buildContent(card, blocks, doc, context, idx, readers) {
|
|
2412
|
+
buildContent(card, blocks, doc, context, idx, readers, host) {
|
|
2374
2413
|
const emit = (block) => {
|
|
2375
2414
|
context.onInteraction({
|
|
2376
2415
|
guideId: context.guide.guideId,
|
|
@@ -2404,7 +2443,7 @@ var CompositeRenderer = class extends BaseRenderer {
|
|
|
2404
2443
|
continue;
|
|
2405
2444
|
}
|
|
2406
2445
|
if (b.type === "code") {
|
|
2407
|
-
const { node: node2, cleanup } = mountCodeBlock(b, doc, context);
|
|
2446
|
+
const { node: node2, cleanup } = mountCodeBlock(b, doc, context, host);
|
|
2408
2447
|
if (node2) card.appendChild(node2);
|
|
2409
2448
|
this.registerCleanup(cleanup);
|
|
2410
2449
|
i++;
|