veo-sdk 0.3.3 → 0.3.4
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-LXIR3WMJ.mjs +5 -0
- package/dist/{builder-VPQDAUIL.mjs.map → builder-LXIR3WMJ.mjs.map} +1 -1
- package/dist/builder.cjs +103 -36
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.mjs +2 -2
- package/dist/{chunk-PASI5SAK.mjs → chunk-IKFTO7MX.mjs} +105 -38
- package/dist/chunk-IKFTO7MX.mjs.map +1 -0
- package/dist/index.cjs +104 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/veo-builder.js +22 -16
- package/dist/veo-builder.js.map +1 -1
- package/package.json +1 -1
- package/dist/builder-VPQDAUIL.mjs +0 -5
- package/dist/chunk-PASI5SAK.mjs.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createBuilderSession, initBuilderMode, startElementPicker, stopElementPicker } from './chunk-IKFTO7MX.mjs';
|
|
2
|
+
import './chunk-GHP7ZJCW.mjs';
|
|
3
|
+
import './chunk-PTG3BTJE.mjs';
|
|
4
|
+
//# sourceMappingURL=builder-LXIR3WMJ.mjs.map
|
|
5
|
+
//# sourceMappingURL=builder-LXIR3WMJ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"builder-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"builder-LXIR3WMJ.mjs"}
|
package/dist/builder.cjs
CHANGED
|
@@ -1596,12 +1596,15 @@ var VEO_BUILDER_SOURCE = "veo-builder";
|
|
|
1596
1596
|
var DEFAULT_PANEL_PATH = "/guides/design";
|
|
1597
1597
|
var PANEL_W = 400;
|
|
1598
1598
|
var PANEL_H = 640;
|
|
1599
|
+
var MIN_W = 320;
|
|
1600
|
+
var MIN_H = 320;
|
|
1599
1601
|
var MARGIN = 16;
|
|
1600
1602
|
function injectBuilderPanel(opts) {
|
|
1601
1603
|
if (!hasWindow() || !hasDocument()) {
|
|
1602
1604
|
return { target: () => null, teardown: () => {
|
|
1603
1605
|
} };
|
|
1604
1606
|
}
|
|
1607
|
+
const panelUrl = buildPanelUrl(opts);
|
|
1605
1608
|
const host = document.createElement("div");
|
|
1606
1609
|
host.setAttribute("data-veo-builder-panel", "");
|
|
1607
1610
|
const shadow = host.attachShadow({ mode: "open" });
|
|
@@ -1613,55 +1616,113 @@ function injectBuilderPanel(opts) {
|
|
|
1613
1616
|
let top = MARGIN;
|
|
1614
1617
|
card.style.left = `${left}px`;
|
|
1615
1618
|
card.style.top = `${top}px`;
|
|
1619
|
+
card.style.width = `${PANEL_W}px`;
|
|
1620
|
+
card.style.height = `${PANEL_H}px`;
|
|
1616
1621
|
const header = document.createElement("div");
|
|
1617
1622
|
header.className = "veo-panel-header";
|
|
1618
1623
|
const title = document.createElement("span");
|
|
1619
1624
|
title.className = "veo-panel-title";
|
|
1620
1625
|
title.textContent = "Veo \xB7 Editor";
|
|
1626
|
+
const actions = document.createElement("div");
|
|
1627
|
+
actions.className = "veo-panel-actions";
|
|
1628
|
+
const popout = document.createElement("button");
|
|
1629
|
+
popout.className = "veo-panel-btn";
|
|
1630
|
+
popout.type = "button";
|
|
1631
|
+
popout.title = "Abrir en ventana aparte";
|
|
1632
|
+
popout.setAttribute("aria-label", "Abrir en ventana aparte");
|
|
1633
|
+
popout.textContent = "\u29C9";
|
|
1621
1634
|
const close = document.createElement("button");
|
|
1622
|
-
close.className = "veo-panel-close";
|
|
1635
|
+
close.className = "veo-panel-btn veo-panel-close";
|
|
1623
1636
|
close.type = "button";
|
|
1637
|
+
close.title = "Cerrar";
|
|
1624
1638
|
close.setAttribute("aria-label", "Cerrar");
|
|
1625
1639
|
close.textContent = "\u2715";
|
|
1626
|
-
|
|
1627
|
-
header.append(title,
|
|
1640
|
+
actions.append(popout, close);
|
|
1641
|
+
header.append(title, actions);
|
|
1628
1642
|
const iframe = document.createElement("iframe");
|
|
1629
1643
|
iframe.className = "veo-panel-frame";
|
|
1630
1644
|
iframe.title = "Editor de Veo";
|
|
1631
|
-
iframe.src =
|
|
1632
|
-
|
|
1645
|
+
iframe.src = panelUrl;
|
|
1646
|
+
const grip = document.createElement("div");
|
|
1647
|
+
grip.className = "veo-panel-resize";
|
|
1648
|
+
grip.setAttribute("aria-hidden", "true");
|
|
1649
|
+
card.append(header, iframe, grip);
|
|
1633
1650
|
shadow.append(style, card);
|
|
1634
1651
|
document.body.appendChild(host);
|
|
1635
|
-
|
|
1636
|
-
|
|
1652
|
+
let popped = null;
|
|
1653
|
+
let pollTimer;
|
|
1654
|
+
const stopPoll = () => {
|
|
1655
|
+
if (pollTimer !== void 0) {
|
|
1656
|
+
clearInterval(pollTimer);
|
|
1657
|
+
pollTimer = void 0;
|
|
1658
|
+
}
|
|
1659
|
+
};
|
|
1660
|
+
close.addEventListener("click", () => opts.onClose());
|
|
1661
|
+
popout.addEventListener("click", () => {
|
|
1662
|
+
const win = window.open(
|
|
1663
|
+
panelUrl,
|
|
1664
|
+
"veo-editor",
|
|
1665
|
+
`popup,width=${Math.round(card.offsetWidth)},height=${Math.round(card.offsetHeight) + 60}`
|
|
1666
|
+
);
|
|
1667
|
+
if (!win) return;
|
|
1668
|
+
popped = win;
|
|
1669
|
+
card.style.display = "none";
|
|
1670
|
+
pollTimer = setInterval(() => {
|
|
1671
|
+
if (popped?.closed) {
|
|
1672
|
+
stopPoll();
|
|
1673
|
+
opts.onClose();
|
|
1674
|
+
}
|
|
1675
|
+
}, 600);
|
|
1676
|
+
});
|
|
1677
|
+
header.addEventListener("mousedown", (e) => {
|
|
1678
|
+
if (e.target?.classList.contains("veo-panel-btn")) return;
|
|
1637
1679
|
e.preventDefault();
|
|
1638
|
-
const
|
|
1639
|
-
const
|
|
1640
|
-
const
|
|
1641
|
-
const
|
|
1680
|
+
const sx = e.clientX;
|
|
1681
|
+
const sy = e.clientY;
|
|
1682
|
+
const ol = left;
|
|
1683
|
+
const ot = top;
|
|
1642
1684
|
iframe.style.pointerEvents = "none";
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
const maxTop = window.innerHeight - 40;
|
|
1647
|
-
left = clamp2(origLeft + (ev.clientX - startX), 0, Math.max(0, maxLeft));
|
|
1648
|
-
top = clamp2(origTop + (ev.clientY - startY), 0, Math.max(0, maxTop));
|
|
1685
|
+
const move = (ev) => {
|
|
1686
|
+
left = clamp2(ol + (ev.clientX - sx), 0, Math.max(0, window.innerWidth - card.offsetWidth));
|
|
1687
|
+
top = clamp2(ot + (ev.clientY - sy), 0, Math.max(0, window.innerHeight - 40));
|
|
1649
1688
|
card.style.left = `${left}px`;
|
|
1650
1689
|
card.style.top = `${top}px`;
|
|
1651
1690
|
};
|
|
1652
|
-
const
|
|
1653
|
-
window.removeEventListener("mousemove",
|
|
1654
|
-
window.removeEventListener("mouseup",
|
|
1691
|
+
const up = () => {
|
|
1692
|
+
window.removeEventListener("mousemove", move);
|
|
1693
|
+
window.removeEventListener("mouseup", up);
|
|
1655
1694
|
iframe.style.pointerEvents = "";
|
|
1656
|
-
card.classList.remove("dragging");
|
|
1657
1695
|
};
|
|
1658
|
-
window.addEventListener("mousemove",
|
|
1659
|
-
window.addEventListener("mouseup",
|
|
1660
|
-
};
|
|
1661
|
-
|
|
1696
|
+
window.addEventListener("mousemove", move);
|
|
1697
|
+
window.addEventListener("mouseup", up);
|
|
1698
|
+
});
|
|
1699
|
+
grip.addEventListener("mousedown", (e) => {
|
|
1700
|
+
e.preventDefault();
|
|
1701
|
+
e.stopPropagation();
|
|
1702
|
+
const sx = e.clientX;
|
|
1703
|
+
const sy = e.clientY;
|
|
1704
|
+
const sw = card.offsetWidth;
|
|
1705
|
+
const sh = card.offsetHeight;
|
|
1706
|
+
iframe.style.pointerEvents = "none";
|
|
1707
|
+
const move = (ev) => {
|
|
1708
|
+
card.style.width = `${clamp2(sw + (ev.clientX - sx), MIN_W, window.innerWidth)}px`;
|
|
1709
|
+
card.style.height = `${clamp2(sh + (ev.clientY - sy), MIN_H, window.innerHeight)}px`;
|
|
1710
|
+
};
|
|
1711
|
+
const up = () => {
|
|
1712
|
+
window.removeEventListener("mousemove", move);
|
|
1713
|
+
window.removeEventListener("mouseup", up);
|
|
1714
|
+
iframe.style.pointerEvents = "";
|
|
1715
|
+
};
|
|
1716
|
+
window.addEventListener("mousemove", move);
|
|
1717
|
+
window.addEventListener("mouseup", up);
|
|
1718
|
+
});
|
|
1662
1719
|
return {
|
|
1663
|
-
target: () => iframe.contentWindow,
|
|
1664
|
-
teardown: () =>
|
|
1720
|
+
target: () => popped && !popped.closed ? popped : iframe.contentWindow,
|
|
1721
|
+
teardown: () => {
|
|
1722
|
+
stopPoll();
|
|
1723
|
+
if (popped && !popped.closed) popped.close();
|
|
1724
|
+
host.remove();
|
|
1725
|
+
}
|
|
1665
1726
|
};
|
|
1666
1727
|
}
|
|
1667
1728
|
function clamp2(v, min, max) {
|
|
@@ -1679,35 +1740,41 @@ var PANEL_CSS = `
|
|
|
1679
1740
|
:host { all: initial; }
|
|
1680
1741
|
.veo-panel {
|
|
1681
1742
|
position: fixed;
|
|
1682
|
-
width: ${
|
|
1683
|
-
min-width: 320px; min-height: 320px;
|
|
1743
|
+
min-width: ${MIN_W}px; min-height: ${MIN_H}px;
|
|
1684
1744
|
max-width: 96vw; max-height: 94vh;
|
|
1685
1745
|
display: flex; flex-direction: column;
|
|
1686
1746
|
background: #fff;
|
|
1687
1747
|
border-radius: 12px;
|
|
1688
1748
|
box-shadow: 0 12px 40px rgba(0,0,0,0.28);
|
|
1689
1749
|
overflow: hidden;
|
|
1690
|
-
resize: both;
|
|
1691
1750
|
z-index: 2147483647;
|
|
1692
1751
|
font-family: system-ui, -apple-system, sans-serif;
|
|
1693
1752
|
}
|
|
1694
|
-
.veo-panel.dragging { user-select: none; }
|
|
1695
1753
|
.veo-panel-header {
|
|
1696
1754
|
flex: 0 0 auto;
|
|
1697
1755
|
display: flex; align-items: center; justify-content: space-between;
|
|
1698
|
-
padding: 8px 12px;
|
|
1756
|
+
padding: 8px 10px 8px 12px;
|
|
1699
1757
|
background: #0f172a; color: #fff;
|
|
1700
1758
|
font-size: 13px; font-weight: 600;
|
|
1701
1759
|
cursor: grab;
|
|
1702
1760
|
}
|
|
1703
1761
|
.veo-panel-header:active { cursor: grabbing; }
|
|
1704
|
-
.veo-panel-
|
|
1762
|
+
.veo-panel-actions { display: flex; gap: 2px; }
|
|
1763
|
+
.veo-panel-btn {
|
|
1705
1764
|
border: 0; background: transparent; color: #fff;
|
|
1706
|
-
font-size:
|
|
1707
|
-
padding: 4px
|
|
1765
|
+
font-size: 14px; cursor: pointer; line-height: 1;
|
|
1766
|
+
padding: 4px 7px; border-radius: 6px;
|
|
1708
1767
|
}
|
|
1709
|
-
.veo-panel-
|
|
1768
|
+
.veo-panel-btn:hover { background: rgba(255,255,255,0.15); }
|
|
1710
1769
|
.veo-panel-frame { flex: 1 1 auto; width: 100%; border: 0; background: #fff; }
|
|
1770
|
+
.veo-panel-resize {
|
|
1771
|
+
position: absolute; right: 0; bottom: 0;
|
|
1772
|
+
width: 16px; height: 16px;
|
|
1773
|
+
cursor: nwse-resize;
|
|
1774
|
+
background:
|
|
1775
|
+
linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.25) 50%, rgba(0,0,0,0.25) 60%,
|
|
1776
|
+
transparent 60%, transparent 72%, rgba(0,0,0,0.25) 72%, rgba(0,0,0,0.25) 82%, transparent 82%);
|
|
1777
|
+
}
|
|
1711
1778
|
`;
|
|
1712
1779
|
|
|
1713
1780
|
// src/plugins/autocapture/constants.ts
|