veo-sdk 0.3.8 → 0.3.10
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-TIN4M7IH.mjs +5 -0
- package/dist/{builder-YYMD7MNK.mjs.map → builder-TIN4M7IH.mjs.map} +1 -1
- package/dist/builder.cjs +46 -62
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.mjs +4 -4
- package/dist/{chunk-T4BZ53QV.mjs → chunk-FC5IA6CO.mjs} +3 -3
- package/dist/{chunk-T4BZ53QV.mjs.map → chunk-FC5IA6CO.mjs.map} +1 -1
- package/dist/{chunk-E2KQJBUT.mjs → chunk-OENKQRLR.mjs} +48 -64
- package/dist/chunk-OENKQRLR.mjs.map +1 -0
- package/dist/{chunk-7OMKQH5J.mjs → chunk-P4WHQV2T.mjs} +3 -3
- package/dist/{chunk-7OMKQH5J.mjs.map → chunk-P4WHQV2T.mjs.map} +1 -1
- package/dist/index.cjs +47 -64
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/veo-builder.js +5 -19
- package/dist/veo-builder.js.map +1 -1
- package/dist/veo-guides.js +4 -18
- package/dist/veo-guides.js.map +1 -1
- package/package.json +1 -1
- package/dist/builder-YYMD7MNK.mjs +0 -5
- package/dist/chunk-E2KQJBUT.mjs.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker } from './chunk-FC5IA6CO.mjs';
|
|
2
|
+
import './chunk-OENKQRLR.mjs';
|
|
3
|
+
import './chunk-PTG3BTJE.mjs';
|
|
4
|
+
//# sourceMappingURL=builder-TIN4M7IH.mjs.map
|
|
5
|
+
//# sourceMappingURL=builder-TIN4M7IH.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"builder-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"builder-TIN4M7IH.mjs"}
|
package/dist/builder.cjs
CHANGED
|
@@ -792,21 +792,6 @@ var GUIDE_STYLES = `
|
|
|
792
792
|
background: transparent;
|
|
793
793
|
color-scheme: normal;
|
|
794
794
|
}
|
|
795
|
-
/*
|
|
796
|
-
* X de cerrar de las gu\xEDas custom: el HTML del cliente vive en un iframe
|
|
797
|
-
* sandbox, as\xED que el bot\xF3n lo pone el host POR ENCIMA del iframe. Con fondo
|
|
798
|
-
* propio para ser visible sobre cualquier contenido.
|
|
799
|
-
*/
|
|
800
|
-
.veo-custom-close {
|
|
801
|
-
position: absolute; top: 6px; right: 6px; z-index: 1;
|
|
802
|
-
width: 22px; height: 22px; padding: 0;
|
|
803
|
-
display: flex; align-items: center; justify-content: center;
|
|
804
|
-
font-size: 16px; line-height: 1; color: #6b7280;
|
|
805
|
-
background: rgba(255, 255, 255, 0.92);
|
|
806
|
-
border: 1px solid rgba(0, 0, 0, 0.08); border-radius: 50%;
|
|
807
|
-
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); cursor: pointer;
|
|
808
|
-
}
|
|
809
|
-
.veo-custom-close:hover { color: #111827; }
|
|
810
795
|
|
|
811
796
|
@keyframes veo-fade-in { from { opacity: 0; } to { opacity: 1; } }
|
|
812
797
|
@keyframes veo-slide-up {
|
|
@@ -980,7 +965,8 @@ function mountCustomFrame(doc, step, context, opts) {
|
|
|
980
965
|
const token = uuidv7();
|
|
981
966
|
const wantsTailwind = step.style?.tailwind === true;
|
|
982
967
|
iframe.srcdoc = buildSrcdoc(step.html ?? "", step.css ?? "", step.js ?? "", token, {
|
|
983
|
-
|
|
968
|
+
hostCss: collectHostStyles(),
|
|
969
|
+
htmlAttrs: hostHtmlAttrs(),
|
|
984
970
|
tailwind: wantsTailwind
|
|
985
971
|
});
|
|
986
972
|
const close = () => context.onClose();
|
|
@@ -1031,25 +1017,40 @@ function mountCustomFrame(doc, step, context, opts) {
|
|
|
1031
1017
|
function toCssSize(value) {
|
|
1032
1018
|
return typeof value === "number" ? `${value}px` : value;
|
|
1033
1019
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1020
|
+
var MAX_HOST_CSS = 800 * 1024;
|
|
1021
|
+
function collectHostStyles() {
|
|
1022
|
+
if (typeof document === "undefined") return "";
|
|
1023
|
+
let out = "";
|
|
1036
1024
|
try {
|
|
1037
|
-
const
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1025
|
+
for (const sheet of Array.from(document.styleSheets)) {
|
|
1026
|
+
let rules = null;
|
|
1027
|
+
try {
|
|
1028
|
+
rules = sheet.cssRules;
|
|
1029
|
+
} catch {
|
|
1030
|
+
continue;
|
|
1031
|
+
}
|
|
1032
|
+
if (!rules) continue;
|
|
1033
|
+
for (const rule of Array.from(rules)) {
|
|
1034
|
+
out += `${rule.cssText}
|
|
1035
|
+
`;
|
|
1036
|
+
if (out.length > MAX_HOST_CSS) return out;
|
|
1037
|
+
}
|
|
1047
1038
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1039
|
+
} catch {
|
|
1040
|
+
return out;
|
|
1041
|
+
}
|
|
1042
|
+
return out;
|
|
1043
|
+
}
|
|
1044
|
+
function hostHtmlAttrs() {
|
|
1045
|
+
if (typeof document === "undefined") return "";
|
|
1046
|
+
try {
|
|
1047
|
+
const el = document.documentElement;
|
|
1048
|
+
const attrs = [];
|
|
1049
|
+
for (const name of ["class", "style", "data-theme", "data-mode", "data-color-mode"]) {
|
|
1050
|
+
const v = el.getAttribute(name);
|
|
1051
|
+
if (v && v.length <= 1e3 && !/["<>]/.test(v)) attrs.push(`${name}="${v}"`);
|
|
1051
1052
|
}
|
|
1052
|
-
return
|
|
1053
|
+
return attrs.join(" ");
|
|
1053
1054
|
} catch {
|
|
1054
1055
|
return "";
|
|
1055
1056
|
}
|
|
@@ -1059,9 +1060,20 @@ function isRecord(value) {
|
|
|
1059
1060
|
}
|
|
1060
1061
|
function buildSrcdoc(html, css, js, token, opts) {
|
|
1061
1062
|
const bridge = `(function(){var T=${JSON.stringify(token)};function P(m){m.__veo=T;parent.postMessage(m,'*');}window.veo={dismiss:function(){P({type:'dismiss'});},cta:function(u){P({type:'cta',url:u});},track:function(n,p){P({type:'track',name:n,props:p||{}});},navigate:function(u){P({type:'navigate',url:u});}};document.addEventListener('click',function(e){var a=e.target&&e.target.closest?e.target.closest('a[href]'):null;if(!a)return;var h=a.getAttribute('href');if(!h||h.charAt(0)==='#'||/^(javascript|mailto|tel):/i.test(h))return;e.preventDefault();if(a.target==='_blank'){P({type:'cta',url:a.href,close:false});}else{P({type:'navigate',url:h});}},true);function H(){P({type:'resize',height:Math.ceil(document.documentElement.scrollHeight)});}window.addEventListener('load',H);try{if(typeof ResizeObserver!=='undefined'){new ResizeObserver(H).observe(document.documentElement);}}catch(e){}})();`;
|
|
1062
|
-
const
|
|
1063
|
+
const hostStyle = opts.hostCss ? `<style>${escapeClosing(opts.hostCss, "style")}</style>` : "";
|
|
1063
1064
|
const tailwind = opts.tailwind ? '<script src="https://cdn.tailwindcss.com"></script>' : "";
|
|
1064
|
-
return
|
|
1065
|
+
return (
|
|
1066
|
+
// Orden: base → CSS del host (utilidades+clases propias+:root) → reset
|
|
1067
|
+
// flotante (fondo transparente, sin márgenes) → Tailwind → CSS del autor (gana).
|
|
1068
|
+
`<!DOCTYPE html><html ${opts.htmlAttrs}><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;}body{font-family:system-ui,-apple-system,sans-serif;}</style>` + hostStyle + // Reset flotante: el CSS de la app trae reglas de PÁGINA (body{min-height:100vh},
|
|
1069
|
+
// html{height:100%}, fondo del layout…) que en un iframe embebido lo estirarían a
|
|
1070
|
+
// toda la pantalla (caja negra) en vez de ajustarse al contenido. Neutralizamos
|
|
1071
|
+
// tamaño/fondo/overflow (mantenemos color y fuente heredados de la app).
|
|
1072
|
+
"<style>html,body{margin:0!important;padding:0!important;background:transparent!important;height:auto!important;min-height:0!important;max-height:none!important;width:auto!important;min-width:0!important;overflow:visible!important;}</style>" + tailwind + // Inline en <body>: gana incluso sobre reglas `!important` de la app (p. ej.
|
|
1073
|
+
// `.dark body{background:#000!important}`) porque el estilo inline tiene la
|
|
1074
|
+
// mayor especificidad dentro de la capa important-author.
|
|
1075
|
+
`<style>${escapeClosing(css, "style")}</style></head><body style="margin:0!important;background:transparent!important;min-height:0!important;height:auto!important;">` + html + `<script>${bridge}</script>` + (js ? `<script>${escapeClosing(js, "script")}</script>` : "") + "</body></html>"
|
|
1076
|
+
);
|
|
1065
1077
|
}
|
|
1066
1078
|
function escapeClosing(code, tag) {
|
|
1067
1079
|
const rx = tag === "script" ? /<\/script/gi : /<\/style/gi;
|
|
@@ -1094,20 +1106,6 @@ var CustomRenderer = class extends BaseRenderer {
|
|
|
1094
1106
|
});
|
|
1095
1107
|
this.registerCleanup(cleanup);
|
|
1096
1108
|
wrapper.appendChild(iframe);
|
|
1097
|
-
wrapper.appendChild(
|
|
1098
|
-
createCloseButton(
|
|
1099
|
-
doc,
|
|
1100
|
-
() => {
|
|
1101
|
-
context.onInteraction({
|
|
1102
|
-
guideId: context.guide.guideId,
|
|
1103
|
-
stepIndex: 0,
|
|
1104
|
-
action: "dismissed"
|
|
1105
|
-
});
|
|
1106
|
-
context.onClose();
|
|
1107
|
-
},
|
|
1108
|
-
"veo-custom-close"
|
|
1109
|
-
)
|
|
1110
|
-
);
|
|
1111
1109
|
root.appendChild(wrapper);
|
|
1112
1110
|
if (placement.mode === "floating") {
|
|
1113
1111
|
applyFloatingPosition(wrapper, placement);
|
|
@@ -1509,20 +1507,6 @@ var InlineCustomRenderer = class extends BaseRenderer {
|
|
|
1509
1507
|
const { iframe, cleanup } = mountCustomFrame(doc, step, context, { width: "100%" });
|
|
1510
1508
|
this.registerCleanup(cleanup);
|
|
1511
1509
|
wrapper.appendChild(iframe);
|
|
1512
|
-
wrapper.appendChild(
|
|
1513
|
-
createCloseButton(
|
|
1514
|
-
doc,
|
|
1515
|
-
() => {
|
|
1516
|
-
context.onInteraction({
|
|
1517
|
-
guideId: context.guide.guideId,
|
|
1518
|
-
stepIndex: 0,
|
|
1519
|
-
action: "dismissed"
|
|
1520
|
-
});
|
|
1521
|
-
context.onClose();
|
|
1522
|
-
},
|
|
1523
|
-
"veo-custom-close"
|
|
1524
|
-
)
|
|
1525
|
-
);
|
|
1526
1510
|
root.appendChild(wrapper);
|
|
1527
1511
|
context.onInteraction({ guideId: context.guide.guideId, stepIndex: 0, action: "shown" });
|
|
1528
1512
|
}
|