veo-sdk 0.5.5 → 0.5.6
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-AMCPHL4K.mjs +5 -0
- package/dist/{builder-O2QHV2DV.mjs.map → builder-AMCPHL4K.mjs.map} +1 -1
- package/dist/builder.cjs +218 -1
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.d.cts +2 -2
- package/dist/builder.d.ts +2 -2
- package/dist/builder.mjs +4 -4
- package/dist/{chunk-JPA46JBS.mjs → chunk-764FSEHS.mjs} +221 -4
- package/dist/chunk-764FSEHS.mjs.map +1 -0
- package/dist/{chunk-XPB4DL2Y.mjs → chunk-A4RHMCCM.mjs} +3 -3
- package/dist/{chunk-XPB4DL2Y.mjs.map → chunk-A4RHMCCM.mjs.map} +1 -1
- package/dist/{chunk-GKJW5TOZ.mjs → chunk-CPSHNLZG.mjs} +7 -3
- package/dist/chunk-CPSHNLZG.mjs.map +1 -0
- package/dist/{guide-preview-B912Y6UY.d.cts → guide-preview-XUnTmzUO.d.cts} +22 -4
- package/dist/{guide-preview-B912Y6UY.d.ts → guide-preview-XUnTmzUO.d.ts} +22 -4
- package/dist/index.cjs +233 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +5 -5
- package/dist/veo-builder.js +39 -10
- package/dist/veo-builder.js.map +1 -1
- package/dist/veo-guides.js +34 -5
- package/dist/veo-guides.js.map +1 -1
- package/package.json +1 -1
- package/dist/builder-O2QHV2DV.mjs +0 -5
- package/dist/chunk-GKJW5TOZ.mjs.map +0 -1
- package/dist/chunk-JPA46JBS.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -654,7 +654,8 @@ function buildButtonBlock(block, doc, callbacks) {
|
|
|
654
654
|
btn.textContent = typeof block.text === "string" && block.text ? block.text : "OK";
|
|
655
655
|
applyBlockStyle(btn, block.style, "button");
|
|
656
656
|
btn.addEventListener("click", () => {
|
|
657
|
-
const
|
|
657
|
+
const raw = block.action ?? "dismiss";
|
|
658
|
+
const action = raw === "next" || raw === "url" || raw === "guide" ? raw : "dismiss";
|
|
658
659
|
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;
|
|
659
660
|
const meta = {
|
|
660
661
|
...typeof block.id === "string" && block.id ? { buttonId: block.id } : {},
|
|
@@ -1075,6 +1076,35 @@ var init_styles = __esm({
|
|
|
1075
1076
|
animation: veo-fade-in 160ms ease-out;
|
|
1076
1077
|
}
|
|
1077
1078
|
|
|
1079
|
+
/* \u2500\u2500 Modelo unificado (composite) \u2500\u2500 */
|
|
1080
|
+
.veo-composite-overlay {
|
|
1081
|
+
position: fixed; inset: 0;
|
|
1082
|
+
z-index: ${GUIDE_Z_INDEX};
|
|
1083
|
+
pointer-events: none;
|
|
1084
|
+
}
|
|
1085
|
+
/* Backdrop atenuado (solo centro con backdrop activo). */
|
|
1086
|
+
.veo-composite-overlay--dim {
|
|
1087
|
+
background: rgba(0, 0, 0, 0.5);
|
|
1088
|
+
pointer-events: auto;
|
|
1089
|
+
}
|
|
1090
|
+
.veo-composite-anchored {
|
|
1091
|
+
position: fixed;
|
|
1092
|
+
z-index: ${GUIDE_Z_INDEX};
|
|
1093
|
+
}
|
|
1094
|
+
/* Card gen\xE9rica del modelo unificado. El dise\xF1o (bg/borde/padding/\u2026) lo aplica
|
|
1095
|
+
el renderer como estilos inline desde step.design; ac\xE1 van los defaults. */
|
|
1096
|
+
.veo-card {
|
|
1097
|
+
pointer-events: auto;
|
|
1098
|
+
background: var(--veo-bg, #ffffff);
|
|
1099
|
+
color: var(--veo-text, #1f2937);
|
|
1100
|
+
border-radius: var(--veo-radius, 12px);
|
|
1101
|
+
padding: 20px;
|
|
1102
|
+
max-width: 90vw;
|
|
1103
|
+
box-shadow: var(--veo-shadow, 0 12px 40px rgba(0, 0, 0, 0.18));
|
|
1104
|
+
animation: veo-fade-in 160ms ease-out;
|
|
1105
|
+
}
|
|
1106
|
+
.veo-composite-anchored .veo-card, .veo-composite-overlay .veo-card { position: relative; }
|
|
1107
|
+
|
|
1078
1108
|
.veo-guide-content {
|
|
1079
1109
|
position: relative;
|
|
1080
1110
|
display: flex; flex-direction: column;
|
|
@@ -1920,6 +1950,191 @@ var init_banner_renderer = __esm({
|
|
|
1920
1950
|
};
|
|
1921
1951
|
}
|
|
1922
1952
|
});
|
|
1953
|
+
function inlinePosOf(p) {
|
|
1954
|
+
return p === "before" || p === "prepend" || p === "append" ? p : "after";
|
|
1955
|
+
}
|
|
1956
|
+
function applyViewportPosition(card, position) {
|
|
1957
|
+
const s = card.style;
|
|
1958
|
+
s.position = "fixed";
|
|
1959
|
+
const M = "16px";
|
|
1960
|
+
const v = position.includes("top") ? "top" : position.includes("bottom") ? "bottom" : "middle";
|
|
1961
|
+
const h = position.includes("left") ? "left" : position.includes("right") ? "right" : "middle";
|
|
1962
|
+
if (position === "center") {
|
|
1963
|
+
s.top = "50%";
|
|
1964
|
+
s.left = "50%";
|
|
1965
|
+
s.transform = "translate(-50%, -50%)";
|
|
1966
|
+
return;
|
|
1967
|
+
}
|
|
1968
|
+
if (v === "top") s.top = M;
|
|
1969
|
+
else if (v === "bottom") s.bottom = M;
|
|
1970
|
+
else {
|
|
1971
|
+
s.top = "50%";
|
|
1972
|
+
s.transform = "translateY(-50%)";
|
|
1973
|
+
}
|
|
1974
|
+
if (h === "left") s.left = M;
|
|
1975
|
+
else if (h === "right") s.right = M;
|
|
1976
|
+
else {
|
|
1977
|
+
s.left = "50%";
|
|
1978
|
+
s.transform = `${s.transform} translateX(-50%)`.trim();
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
async function anchorPosition(anchor, wrapper) {
|
|
1982
|
+
const update = async () => {
|
|
1983
|
+
const { x, y } = await dom.computePosition(anchor, wrapper, {
|
|
1984
|
+
placement: "bottom",
|
|
1985
|
+
strategy: "fixed",
|
|
1986
|
+
middleware: [dom.offset(8), dom.flip(), dom.shift({ padding: 8 })]
|
|
1987
|
+
});
|
|
1988
|
+
wrapper.style.left = `${x}px`;
|
|
1989
|
+
wrapper.style.top = `${y}px`;
|
|
1990
|
+
};
|
|
1991
|
+
await update();
|
|
1992
|
+
const reposition = () => void update();
|
|
1993
|
+
window.addEventListener("scroll", reposition, true);
|
|
1994
|
+
window.addEventListener("resize", reposition);
|
|
1995
|
+
return () => {
|
|
1996
|
+
window.removeEventListener("scroll", reposition, true);
|
|
1997
|
+
window.removeEventListener("resize", reposition);
|
|
1998
|
+
};
|
|
1999
|
+
}
|
|
2000
|
+
function applyCompositeDesign(card, design) {
|
|
2001
|
+
const s = card.style;
|
|
2002
|
+
const px = (v) => typeof v === "number" && Number.isFinite(v) ? `${v}px` : null;
|
|
2003
|
+
const strv = (v) => typeof v === "string" && v ? v : null;
|
|
2004
|
+
if (strv(design.background)) s.background = design.background;
|
|
2005
|
+
if (strv(design.textColor)) s.color = design.textColor;
|
|
2006
|
+
if (px(design.fontSize)) s.fontSize = px(design.fontSize);
|
|
2007
|
+
if (strv(design.fontWeight)) s.fontWeight = design.fontWeight;
|
|
2008
|
+
if (strv(design.align)) s.textAlign = design.align;
|
|
2009
|
+
if (typeof design.lineHeight === "number") s.lineHeight = `${design.lineHeight}%`;
|
|
2010
|
+
if (px(design.radius)) s.borderRadius = px(design.radius);
|
|
2011
|
+
if (px(design.width)) s.width = px(design.width);
|
|
2012
|
+
const bw = px(design.borderWidth);
|
|
2013
|
+
if (bw) s.border = `${bw} solid ${strv(design.borderColor) ?? "#e5e5e5"}`;
|
|
2014
|
+
for (const side of ["Top", "Right", "Bottom", "Left"]) {
|
|
2015
|
+
const p = px(design[`padding${side}`]);
|
|
2016
|
+
if (p) s.setProperty(`padding-${side.toLowerCase()}`, p);
|
|
2017
|
+
const m = px(design[`margin${side}`]);
|
|
2018
|
+
if (m) s.setProperty(`margin-${side.toLowerCase()}`, m);
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
var CompositeRenderer;
|
|
2022
|
+
var init_composite_renderer = __esm({
|
|
2023
|
+
"src/plugins/guides/renderers/composite-renderer.ts"() {
|
|
2024
|
+
init_block_builder();
|
|
2025
|
+
init_inline_host();
|
|
2026
|
+
init_wait_for_element();
|
|
2027
|
+
init_base_renderer();
|
|
2028
|
+
CompositeRenderer = class extends BaseRenderer {
|
|
2029
|
+
async render(context) {
|
|
2030
|
+
const idx = context.nav?.stepIndex ?? 0;
|
|
2031
|
+
const step = context.guide.guideSteps[idx];
|
|
2032
|
+
if (!step) return;
|
|
2033
|
+
const anchorSelector = step.position === "relative-to-element" || step.presentation === "inline" ? step.anchorSelector?.trim() || void 0 : void 0;
|
|
2034
|
+
let anchor = null;
|
|
2035
|
+
if (anchorSelector) {
|
|
2036
|
+
anchor = await waitForElement(anchorSelector);
|
|
2037
|
+
if (!anchor) return;
|
|
2038
|
+
}
|
|
2039
|
+
const { host, root } = this.createHost();
|
|
2040
|
+
const doc = root.ownerDocument ?? document;
|
|
2041
|
+
const card = doc.createElement("div");
|
|
2042
|
+
card.className = "veo-card";
|
|
2043
|
+
applyCompositeDesign(card, step.design ?? {});
|
|
2044
|
+
const dismiss = (action, meta) => {
|
|
2045
|
+
context.onInteraction({
|
|
2046
|
+
guideId: context.guide.guideId,
|
|
2047
|
+
stepIndex: idx,
|
|
2048
|
+
action,
|
|
2049
|
+
...meta?.id ? { metadata: { buttonId: meta.id } } : {}
|
|
2050
|
+
});
|
|
2051
|
+
};
|
|
2052
|
+
const synthetic = { blocks: step.blocks ?? [] };
|
|
2053
|
+
for (const node of buildContentNodes(synthetic, doc)) card.appendChild(node);
|
|
2054
|
+
const buttons = (step.blocks ?? []).filter((b) => b.type === "button");
|
|
2055
|
+
if (buttons.length) {
|
|
2056
|
+
const row = doc.createElement("div");
|
|
2057
|
+
row.className = "veo-guide-actions";
|
|
2058
|
+
for (const b of buttons) row.appendChild(this.buildButton(b, doc, context, dismiss));
|
|
2059
|
+
card.appendChild(row);
|
|
2060
|
+
}
|
|
2061
|
+
card.appendChild(
|
|
2062
|
+
createCloseButton(doc, () => {
|
|
2063
|
+
dismiss("dismissed");
|
|
2064
|
+
this.closeOrSkip(context);
|
|
2065
|
+
})
|
|
2066
|
+
);
|
|
2067
|
+
if (step.presentation === "inline" && anchor) {
|
|
2068
|
+
host.style.display = "block";
|
|
2069
|
+
const pos = inlinePosOf(step.inlinePosition);
|
|
2070
|
+
root.appendChild(card);
|
|
2071
|
+
insertHost(anchor, host, pos);
|
|
2072
|
+
this.registerCleanup(keepHostAttached(host, anchorSelector, pos));
|
|
2073
|
+
} else if (step.position === "relative-to-element" && anchor) {
|
|
2074
|
+
const wrapper = doc.createElement("div");
|
|
2075
|
+
wrapper.className = "veo-composite-anchored";
|
|
2076
|
+
wrapper.appendChild(card);
|
|
2077
|
+
root.appendChild(wrapper);
|
|
2078
|
+
this.registerCleanup(await anchorPosition(anchor, wrapper));
|
|
2079
|
+
} else {
|
|
2080
|
+
const overlay = doc.createElement("div");
|
|
2081
|
+
overlay.className = "veo-composite-overlay";
|
|
2082
|
+
if (step.position === "center" && step.design?.backdrop !== false) {
|
|
2083
|
+
overlay.classList.add("veo-composite-overlay--dim");
|
|
2084
|
+
overlay.addEventListener("click", (e) => {
|
|
2085
|
+
if (e.target === overlay) {
|
|
2086
|
+
dismiss("dismissed");
|
|
2087
|
+
this.closeOrSkip(context);
|
|
2088
|
+
}
|
|
2089
|
+
});
|
|
2090
|
+
}
|
|
2091
|
+
applyViewportPosition(card, step.position);
|
|
2092
|
+
overlay.appendChild(card);
|
|
2093
|
+
root.appendChild(overlay);
|
|
2094
|
+
}
|
|
2095
|
+
context.onInteraction({ guideId: context.guide.guideId, stepIndex: idx, action: "shown" });
|
|
2096
|
+
}
|
|
2097
|
+
/** Botón con enrutado de acción (navegación / cierre / url / guía). */
|
|
2098
|
+
buildButton(block, doc, context, emit) {
|
|
2099
|
+
const btn = doc.createElement("button");
|
|
2100
|
+
btn.type = "button";
|
|
2101
|
+
btn.className = "veo-guide-cta";
|
|
2102
|
+
btn.textContent = block.text?.trim() || "OK";
|
|
2103
|
+
btn.addEventListener("click", () => {
|
|
2104
|
+
emit("cta_clicked", block);
|
|
2105
|
+
const nav = context.nav?.callbacks;
|
|
2106
|
+
switch (block.action) {
|
|
2107
|
+
case "next":
|
|
2108
|
+
case "submit-forms":
|
|
2109
|
+
case "submit-forms-advance":
|
|
2110
|
+
if (nav) nav.onNext();
|
|
2111
|
+
else context.onClose();
|
|
2112
|
+
break;
|
|
2113
|
+
case "prev":
|
|
2114
|
+
nav?.onBack();
|
|
2115
|
+
break;
|
|
2116
|
+
case "url":
|
|
2117
|
+
if (typeof block.url === "string" && isSafeUrl(block.url)) {
|
|
2118
|
+
window.open(block.url, "_blank", "noopener,noreferrer");
|
|
2119
|
+
}
|
|
2120
|
+
break;
|
|
2121
|
+
case "guide":
|
|
2122
|
+
if (block.targetGuideId) context.onOpenGuide?.(block.targetGuideId);
|
|
2123
|
+
this.closeOrSkip(context);
|
|
2124
|
+
break;
|
|
2125
|
+
default:
|
|
2126
|
+
this.closeOrSkip(context);
|
|
2127
|
+
}
|
|
2128
|
+
});
|
|
2129
|
+
return btn;
|
|
2130
|
+
}
|
|
2131
|
+
closeOrSkip(context) {
|
|
2132
|
+
if (context.nav?.callbacks) context.nav.callbacks.onSkip();
|
|
2133
|
+
else context.onClose();
|
|
2134
|
+
}
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
});
|
|
1923
2138
|
|
|
1924
2139
|
// src/plugins/guides/renderers/custom-frame.ts
|
|
1925
2140
|
function mountCustomFrame(doc, step, context, opts) {
|
|
@@ -2880,8 +3095,12 @@ function createSingleStepRenderer(type) {
|
|
|
2880
3095
|
return new InlineFormRenderer();
|
|
2881
3096
|
case "badge":
|
|
2882
3097
|
return new BadgeRenderer();
|
|
3098
|
+
case "composite":
|
|
3099
|
+
return new CompositeRenderer();
|
|
2883
3100
|
case "walkthrough":
|
|
2884
3101
|
return null;
|
|
3102
|
+
default:
|
|
3103
|
+
return null;
|
|
2885
3104
|
}
|
|
2886
3105
|
}
|
|
2887
3106
|
function safeDestroy(renderer) {
|
|
@@ -2897,6 +3116,7 @@ var init_guide_preview = __esm({
|
|
|
2897
3116
|
init_badge_renderer();
|
|
2898
3117
|
init_banner_renderer();
|
|
2899
3118
|
init_base_renderer();
|
|
3119
|
+
init_composite_renderer();
|
|
2900
3120
|
init_custom_renderer();
|
|
2901
3121
|
init_form_renderer();
|
|
2902
3122
|
init_inline_custom_renderer();
|
|
@@ -2930,6 +3150,13 @@ var init_guide_preview = __esm({
|
|
|
2930
3150
|
this.input = input;
|
|
2931
3151
|
const guide = normalize(input);
|
|
2932
3152
|
const start = typeof input.startStepIndex === "number" ? input.startStepIndex : 0;
|
|
3153
|
+
if (guide.guideType === "composite") {
|
|
3154
|
+
const s = Math.min(Math.max(0, start), guide.guideSteps.length - 1);
|
|
3155
|
+
const active2 = guide.guideSteps[s];
|
|
3156
|
+
if (active2) guide.guideSteps = [active2];
|
|
3157
|
+
const ready2 = this.renderSingleStep(guide);
|
|
3158
|
+
return { close: () => this.close(), ready: ready2, host: () => this.activeHost() };
|
|
3159
|
+
}
|
|
2933
3160
|
const ready = guide.guideType === "walkthrough" ? this.startWalkthrough(guide, start) : this.renderSingleStep(guide);
|
|
2934
3161
|
return { close: () => this.close(), ready, host: () => this.activeHost() };
|
|
2935
3162
|
}
|
|
@@ -5434,6 +5661,7 @@ var GuideTrackerQueue = class {
|
|
|
5434
5661
|
// src/plugins/guides/guides-controller.ts
|
|
5435
5662
|
init_badge_renderer();
|
|
5436
5663
|
init_banner_renderer();
|
|
5664
|
+
init_composite_renderer();
|
|
5437
5665
|
init_custom_renderer();
|
|
5438
5666
|
init_form_renderer();
|
|
5439
5667
|
init_inline_custom_renderer();
|
|
@@ -6108,8 +6336,12 @@ ${pageUrl}`;
|
|
|
6108
6336
|
return new InlineFormRenderer();
|
|
6109
6337
|
case "badge":
|
|
6110
6338
|
return new BadgeRenderer();
|
|
6339
|
+
case "composite":
|
|
6340
|
+
return new CompositeRenderer();
|
|
6111
6341
|
case "walkthrough":
|
|
6112
6342
|
return null;
|
|
6343
|
+
default:
|
|
6344
|
+
return null;
|
|
6113
6345
|
}
|
|
6114
6346
|
}
|
|
6115
6347
|
/**
|