veo-sdk 0.3.2 → 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.
@@ -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-AGIBF67L.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-LXIR3WMJ.mjs"}
package/dist/builder.cjs CHANGED
@@ -1594,42 +1594,140 @@ var VEO_BUILDER_SOURCE = "veo-builder";
1594
1594
 
1595
1595
  // src/plugins/builder/builder-panel.ts
1596
1596
  var DEFAULT_PANEL_PATH = "/guides/design";
1597
+ var PANEL_W = 400;
1598
+ var PANEL_H = 640;
1599
+ var MIN_W = 320;
1600
+ var MIN_H = 320;
1601
+ var MARGIN = 16;
1597
1602
  function injectBuilderPanel(opts) {
1598
1603
  if (!hasWindow() || !hasDocument()) {
1599
1604
  return { target: () => null, teardown: () => {
1600
1605
  } };
1601
1606
  }
1607
+ const panelUrl = buildPanelUrl(opts);
1602
1608
  const host = document.createElement("div");
1603
1609
  host.setAttribute("data-veo-builder-panel", "");
1604
1610
  const shadow = host.attachShadow({ mode: "open" });
1605
1611
  const style = document.createElement("style");
1606
1612
  style.textContent = PANEL_CSS;
1607
- const container = document.createElement("div");
1608
- container.className = "veo-panel";
1613
+ const card = document.createElement("div");
1614
+ card.className = "veo-panel";
1615
+ let left = Math.max(MARGIN, window.innerWidth - PANEL_W - MARGIN);
1616
+ let top = MARGIN;
1617
+ card.style.left = `${left}px`;
1618
+ card.style.top = `${top}px`;
1619
+ card.style.width = `${PANEL_W}px`;
1620
+ card.style.height = `${PANEL_H}px`;
1609
1621
  const header = document.createElement("div");
1610
1622
  header.className = "veo-panel-header";
1611
1623
  const title = document.createElement("span");
1612
1624
  title.className = "veo-panel-title";
1613
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";
1614
1634
  const close = document.createElement("button");
1615
- close.className = "veo-panel-close";
1635
+ close.className = "veo-panel-btn veo-panel-close";
1616
1636
  close.type = "button";
1637
+ close.title = "Cerrar";
1617
1638
  close.setAttribute("aria-label", "Cerrar");
1618
1639
  close.textContent = "\u2715";
1619
- close.addEventListener("click", () => opts.onClose());
1620
- header.append(title, close);
1640
+ actions.append(popout, close);
1641
+ header.append(title, actions);
1621
1642
  const iframe = document.createElement("iframe");
1622
1643
  iframe.className = "veo-panel-frame";
1623
1644
  iframe.title = "Editor de Veo";
1624
- iframe.src = buildPanelUrl(opts);
1625
- container.append(header, iframe);
1626
- shadow.append(style, container);
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);
1650
+ shadow.append(style, card);
1627
1651
  document.body.appendChild(host);
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;
1679
+ e.preventDefault();
1680
+ const sx = e.clientX;
1681
+ const sy = e.clientY;
1682
+ const ol = left;
1683
+ const ot = top;
1684
+ iframe.style.pointerEvents = "none";
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));
1688
+ card.style.left = `${left}px`;
1689
+ card.style.top = `${top}px`;
1690
+ };
1691
+ const up = () => {
1692
+ window.removeEventListener("mousemove", move);
1693
+ window.removeEventListener("mouseup", up);
1694
+ iframe.style.pointerEvents = "";
1695
+ };
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
+ });
1628
1719
  return {
1629
- target: () => iframe.contentWindow,
1630
- teardown: () => host.remove()
1720
+ target: () => popped && !popped.closed ? popped : iframe.contentWindow,
1721
+ teardown: () => {
1722
+ stopPoll();
1723
+ if (popped && !popped.closed) popped.close();
1724
+ host.remove();
1725
+ }
1631
1726
  };
1632
1727
  }
1728
+ function clamp2(v, min, max) {
1729
+ return Math.min(Math.max(v, min), max);
1730
+ }
1633
1731
  function buildPanelUrl(opts) {
1634
1732
  const path = opts.panelPath ?? DEFAULT_PANEL_PATH;
1635
1733
  const url = new URL(path, opts.dashboardOrigin);
@@ -1641,28 +1739,42 @@ function buildPanelUrl(opts) {
1641
1739
  var PANEL_CSS = `
1642
1740
  :host { all: initial; }
1643
1741
  .veo-panel {
1644
- position: fixed; top: 0; right: 0; bottom: 0;
1645
- width: 420px; max-width: 100vw;
1742
+ position: fixed;
1743
+ min-width: ${MIN_W}px; min-height: ${MIN_H}px;
1744
+ max-width: 96vw; max-height: 94vh;
1646
1745
  display: flex; flex-direction: column;
1647
1746
  background: #fff;
1648
- box-shadow: -8px 0 30px rgba(0,0,0,0.18);
1747
+ border-radius: 12px;
1748
+ box-shadow: 0 12px 40px rgba(0,0,0,0.28);
1749
+ overflow: hidden;
1649
1750
  z-index: 2147483647;
1650
1751
  font-family: system-ui, -apple-system, sans-serif;
1651
1752
  }
1652
1753
  .veo-panel-header {
1653
1754
  flex: 0 0 auto;
1654
1755
  display: flex; align-items: center; justify-content: space-between;
1655
- padding: 8px 12px;
1756
+ padding: 8px 10px 8px 12px;
1656
1757
  background: #0f172a; color: #fff;
1657
1758
  font-size: 13px; font-weight: 600;
1759
+ cursor: grab;
1658
1760
  }
1659
- .veo-panel-close {
1761
+ .veo-panel-header:active { cursor: grabbing; }
1762
+ .veo-panel-actions { display: flex; gap: 2px; }
1763
+ .veo-panel-btn {
1660
1764
  border: 0; background: transparent; color: #fff;
1661
- font-size: 15px; cursor: pointer; line-height: 1;
1662
- padding: 4px 6px; border-radius: 6px;
1765
+ font-size: 14px; cursor: pointer; line-height: 1;
1766
+ padding: 4px 7px; border-radius: 6px;
1663
1767
  }
1664
- .veo-panel-close:hover { background: rgba(255,255,255,0.15); }
1768
+ .veo-panel-btn:hover { background: rgba(255,255,255,0.15); }
1665
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
+ }
1666
1778
  `;
1667
1779
 
1668
1780
  // src/plugins/autocapture/constants.ts