veo-sdk 0.3.2 → 0.3.3

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-PASI5SAK.mjs';
2
+ import './chunk-GHP7ZJCW.mjs';
3
+ import './chunk-PTG3BTJE.mjs';
4
+ //# sourceMappingURL=builder-VPQDAUIL.mjs.map
5
+ //# sourceMappingURL=builder-VPQDAUIL.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-AGIBF67L.mjs"}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"builder-VPQDAUIL.mjs"}
package/dist/builder.cjs CHANGED
@@ -1594,6 +1594,9 @@ 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 MARGIN = 16;
1597
1600
  function injectBuilderPanel(opts) {
1598
1601
  if (!hasWindow() || !hasDocument()) {
1599
1602
  return { target: () => null, teardown: () => {
@@ -1604,8 +1607,12 @@ function injectBuilderPanel(opts) {
1604
1607
  const shadow = host.attachShadow({ mode: "open" });
1605
1608
  const style = document.createElement("style");
1606
1609
  style.textContent = PANEL_CSS;
1607
- const container = document.createElement("div");
1608
- container.className = "veo-panel";
1610
+ const card = document.createElement("div");
1611
+ card.className = "veo-panel";
1612
+ let left = Math.max(MARGIN, window.innerWidth - PANEL_W - MARGIN);
1613
+ let top = MARGIN;
1614
+ card.style.left = `${left}px`;
1615
+ card.style.top = `${top}px`;
1609
1616
  const header = document.createElement("div");
1610
1617
  header.className = "veo-panel-header";
1611
1618
  const title = document.createElement("span");
@@ -1622,14 +1629,44 @@ function injectBuilderPanel(opts) {
1622
1629
  iframe.className = "veo-panel-frame";
1623
1630
  iframe.title = "Editor de Veo";
1624
1631
  iframe.src = buildPanelUrl(opts);
1625
- container.append(header, iframe);
1626
- shadow.append(style, container);
1632
+ card.append(header, iframe);
1633
+ shadow.append(style, card);
1627
1634
  document.body.appendChild(host);
1635
+ const onHeaderDown = (e) => {
1636
+ if (e.target?.classList.contains("veo-panel-close")) return;
1637
+ e.preventDefault();
1638
+ const startX = e.clientX;
1639
+ const startY = e.clientY;
1640
+ const origLeft = left;
1641
+ const origTop = top;
1642
+ iframe.style.pointerEvents = "none";
1643
+ card.classList.add("dragging");
1644
+ const onMove = (ev) => {
1645
+ const maxLeft = window.innerWidth - card.offsetWidth;
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));
1649
+ card.style.left = `${left}px`;
1650
+ card.style.top = `${top}px`;
1651
+ };
1652
+ const onUp = () => {
1653
+ window.removeEventListener("mousemove", onMove);
1654
+ window.removeEventListener("mouseup", onUp);
1655
+ iframe.style.pointerEvents = "";
1656
+ card.classList.remove("dragging");
1657
+ };
1658
+ window.addEventListener("mousemove", onMove);
1659
+ window.addEventListener("mouseup", onUp);
1660
+ };
1661
+ header.addEventListener("mousedown", onHeaderDown);
1628
1662
  return {
1629
1663
  target: () => iframe.contentWindow,
1630
1664
  teardown: () => host.remove()
1631
1665
  };
1632
1666
  }
1667
+ function clamp2(v, min, max) {
1668
+ return Math.min(Math.max(v, min), max);
1669
+ }
1633
1670
  function buildPanelUrl(opts) {
1634
1671
  const path = opts.panelPath ?? DEFAULT_PANEL_PATH;
1635
1672
  const url = new URL(path, opts.dashboardOrigin);
@@ -1641,21 +1678,29 @@ function buildPanelUrl(opts) {
1641
1678
  var PANEL_CSS = `
1642
1679
  :host { all: initial; }
1643
1680
  .veo-panel {
1644
- position: fixed; top: 0; right: 0; bottom: 0;
1645
- width: 420px; max-width: 100vw;
1681
+ position: fixed;
1682
+ width: ${PANEL_W}px; height: ${PANEL_H}px;
1683
+ min-width: 320px; min-height: 320px;
1684
+ max-width: 96vw; max-height: 94vh;
1646
1685
  display: flex; flex-direction: column;
1647
1686
  background: #fff;
1648
- box-shadow: -8px 0 30px rgba(0,0,0,0.18);
1687
+ border-radius: 12px;
1688
+ box-shadow: 0 12px 40px rgba(0,0,0,0.28);
1689
+ overflow: hidden;
1690
+ resize: both;
1649
1691
  z-index: 2147483647;
1650
1692
  font-family: system-ui, -apple-system, sans-serif;
1651
1693
  }
1694
+ .veo-panel.dragging { user-select: none; }
1652
1695
  .veo-panel-header {
1653
1696
  flex: 0 0 auto;
1654
1697
  display: flex; align-items: center; justify-content: space-between;
1655
1698
  padding: 8px 12px;
1656
1699
  background: #0f172a; color: #fff;
1657
1700
  font-size: 13px; font-weight: 600;
1701
+ cursor: grab;
1658
1702
  }
1703
+ .veo-panel-header:active { cursor: grabbing; }
1659
1704
  .veo-panel-close {
1660
1705
  border: 0; background: transparent; color: #fff;
1661
1706
  font-size: 15px; cursor: pointer; line-height: 1;