@getv.design/embed 0.1.2 → 0.1.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.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! @getv.design/embed v0.1.2. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
- import{a as y}from"./chunks/chunk-PCMXJXR4.js";import"./chunks/chunk-GI6ZV6OJ.js";var d=["view","edit","play"];async function l(a,i,e){let o=e?.mode;if(!d.includes(o))throw new TypeError(`mount: mode must be one of ${d.join(", ")}; got ${String(o)}.`);if(o==="edit"){let{edit:t}=await import("./edit.js");return t(a,i,e)}let{view:s}=await import("./view.js"),n=await s(a,i,e);if(o==="view")return n;let r;try{r=await n.play(e.page===void 0?{}:{page:e.page})}catch(t){throw n.destroy(),t}return{goTo:t=>r.goTo(t),destroy(){r.destroy(),n.destroy()}}}export{l as mount,y as version};
1
+ /*! @getv.design/embed v0.1.3. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
+ import{a as y}from"./chunks/chunk-ETXF3NVH.js";import"./chunks/chunk-FGXZYG3Y.js";var d=["view","edit","play"];async function l(a,i,e){let o=e?.mode;if(!d.includes(o))throw new TypeError(`mount: mode must be one of ${d.join(", ")}; got ${String(o)}.`);if(o==="edit"){let{edit:t}=await import("./edit.js");return t(a,i,e)}let{view:s}=await import("./view.js"),n=await s(a,i,e);if(o==="view")return n;let r;try{r=await n.play(e.page===void 0?{}:{page:e.page})}catch(t){throw n.destroy(),t}return{goTo:t=>r.goTo(t),destroy(){r.destroy(),n.destroy()}}}export{l as mount,y as version};
package/dist/static.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! @getv.design/embed v0.1.2. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
- import{a as g,c as h,e as b,f as v,g as f}from"./chunks/chunk-VBG4ORCT.js";import{a as P,b as l}from"./chunks/chunk-PCMXJXR4.js";import{j as d,x as m}from"./chunks/chunk-JWKZL5KP.js";import"./chunks/chunk-GI6ZV6OJ.js";function A(e){return g(e)}async function F(e,t={}){let o=t.fonts??"approximate";if(!S.includes(o))throw new TypeError(`renderSvg: fonts must be one of ${S.join(", ")}; got ${String(o)}.`);let n=o==="exact"?v(t.fontBase,w()):void 0,{document:c,blocks:x,problems:y}=await h(e),u=t.page===void 0?c:O(c,t.page),p=s=>{let r=x.get(s.hash);return r===void 0?void 0:d(s.type,r)},i=[...y],a;if(o==="exact")if(n===void 0)i.push(f([],"no fontBase was given and this build has no default"));else{let{exactSvg:s}=await import("./chunks/fonts.js"),r=await s(u,{base:n,resolveAsset:p});"svg"in r?a=r.svg:i.push(f(r.failures))}return a??=m(u,{ids:!1,resolveAsset:p}),t.onProblems?.(i),a}var S=["approximate","exact"];function w(){let e=import.meta.url,o=typeof globalThis.process?.getBuiltinModule=="function";return e.startsWith("file:")&&o?new URL("../fonts/",e).href:l}function O(e,t){let o=b(e,t);return{...e,root:{...e.root,children:e.root.children.map(n=>n===o?n:{...n,hidden:!0})}}}export{A as parse,F as renderSvg,P as version};
1
+ /*! @getv.design/embed v0.1.3. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
+ import{a as g,c as h,e as b,f as v,g as f}from"./chunks/chunk-3XUNDFDN.js";import{a as P,b as l}from"./chunks/chunk-ETXF3NVH.js";import{j as d,x as m}from"./chunks/chunk-KODHLOJV.js";import"./chunks/chunk-FGXZYG3Y.js";function A(e){return g(e)}async function F(e,t={}){let o=t.fonts??"approximate";if(!S.includes(o))throw new TypeError(`renderSvg: fonts must be one of ${S.join(", ")}; got ${String(o)}.`);let n=o==="exact"?v(t.fontBase,w()):void 0,{document:c,blocks:x,problems:y}=await h(e),u=t.page===void 0?c:O(c,t.page),p=s=>{let r=x.get(s.hash);return r===void 0?void 0:d(s.type,r)},i=[...y],a;if(o==="exact")if(n===void 0)i.push(f([],"no fontBase was given and this build has no default"));else{let{exactSvg:s}=await import("./chunks/fonts.js"),r=await s(u,{base:n,resolveAsset:p});"svg"in r?a=r.svg:i.push(f(r.failures))}return a??=m(u,{ids:!1,resolveAsset:p}),t.onProblems?.(i),a}var S=["approximate","exact"];function w(){let e=import.meta.url,o=typeof globalThis.process?.getBuiltinModule=="function";return e.startsWith("file:")&&o?new URL("../fonts/",e).href:l}function O(e,t){let o=b(e,t);return{...e,root:{...e.root,children:e.root.children.map(n=>n===o?n:{...n,hidden:!0})}}}export{A as parse,F as renderSvg,P as version};
package/dist/view.js CHANGED
@@ -1,5 +1,5 @@
1
- /*! @getv.design/embed v0.1.2. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
- import{b as Qe,c as Ae,d as ee,e as ue,f as et,g as ye}from"./chunks/chunk-VBG4ORCT.js";import{a as Ft,b as Re}from"./chunks/chunk-PCMXJXR4.js";import{a as Ve,b as $e,c as ge,d as Se,e as He,f as Be,g as je,h as Ue,j as We,k as Ke,m as Ee,n as me,o as Ge,p as ke,s as Ye,t as Ze,u as qe,v as Xe,w as Je}from"./chunks/chunk-JWKZL5KP.js";import"./chunks/chunk-GI6ZV6OJ.js";var It=.8,Nt=.2;function Oe(e,t){let i=e.createElement("canvas").getContext("2d"),n=Ge(),l=new Map,c=new Map,m=new Set;function u(f){return`${f.italic?"italic ":""}${f.weight} ${f.size}px ${f.family}`}function y(){l.clear(),c.clear()}return{advance(f,p){if(!i)return n.advance(f,p);let A=u(p),S=`${A}\0${p.letterSpacing}\0${f}`,E=l.get(S);if(E!==void 0)return E;i.font=A;let x=i.measureText(f).width+p.letterSpacing*[...f].length;return l.set(S,x),x},metrics(f){if(!i)return n.metrics(f);let p=u(f),A=c.get(p);if(A)return A;i.font=p;let S=i.measureText("Hxg"),E=S.fontBoundingBoxAscent??f.size*It,x=S.fontBoundingBoxDescent??f.size*Nt,C={ascent:E,descent:x,lineGap:0};return c.set(p,C),C},load(f,p){let A=e.fonts;if(!A||typeof FontFace!="function")return!1;let S=!1;for(let E of Object.values(f.fonts))for(let x of zt(E)){let C=`${E.family}\0${x.src}\0${x.weight??400}\0${x.style??"normal"}`;if(m.has(C))continue;m.add(C);let O=x.src.startsWith("data:")?void 0:p?.(x.src),_={weight:String(x.weight??400),style:x.style??"normal"},N=$=>{let P=new FontFace(E.family,typeof $=="string"?`url(${$})`:Rt($),_);A.add(P),P.load().then(()=>{y(),t?.()},()=>{A.delete(P)})};O===void 0?N(x.src):(S=!0,O.then(N,()=>{}))}return S},invalidate:y,destroy(){y(),m.clear()}}}function zt(e){return e.faces??[]}function Rt(e){return e instanceof Uint8Array?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}var we={x:0,y:0,zoom:1},tt=.02,nt=64;function Me(e){return Number.isFinite(e)?Math.min(Math.max(e,tt),nt):1}function ve(e,t){return{x:(t.x-e.x)/e.zoom,y:(t.y-e.y)/e.zoom}}function Te(e,t){return{x:t.x*e.zoom+e.x,y:t.y*e.zoom+e.y}}function xe(e,t,r){let i=Me(e.zoom*r),n=ve(e,t);return{zoom:i,x:t.x-n.x*i,y:t.y-n.y*i}}function fe(e,t,r){return{...e,x:e.x+t,y:e.y+r}}function _e(e){return`translate(${e.x} ${e.y}) scale(${e.zoom})`}function oe(e,t,r){let i={width:Math.max(1,t.width-r*2),height:Math.max(1,t.height-r*2)};if(e.width<=0||e.height<=0)return we;let n=Me(Math.min(i.width/e.width,i.height/e.height));return{zoom:n,x:(t.width-e.width*n)/2-(e.x??0)*n,y:(t.height-e.height*n)/2-(e.y??0)*n}}var j="http://www.w3.org/2000/svg",rt="vd-viewer-styles",it=`
1
+ /*! @getv.design/embed v0.1.3. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
+ import{b as Qe,c as Ae,d as ee,e as ue,f as et,g as ye}from"./chunks/chunk-3XUNDFDN.js";import{a as Ft,b as Re}from"./chunks/chunk-ETXF3NVH.js";import{a as Ve,b as $e,c as ge,d as Se,e as He,f as Be,g as je,h as Ue,j as We,k as Ke,m as Ee,n as me,o as Ge,p as ke,s as Ye,t as Ze,u as qe,v as Xe,w as Je}from"./chunks/chunk-KODHLOJV.js";import"./chunks/chunk-FGXZYG3Y.js";var It=.8,Nt=.2;function Oe(e,t){let i=e.createElement("canvas").getContext("2d"),n=Ge(),l=new Map,c=new Map,m=new Set;function u(f){return`${f.italic?"italic ":""}${f.weight} ${f.size}px ${f.family}`}function y(){l.clear(),c.clear()}return{advance(f,p){if(!i)return n.advance(f,p);let A=u(p),S=`${A}\0${p.letterSpacing}\0${f}`,E=l.get(S);if(E!==void 0)return E;i.font=A;let x=i.measureText(f).width+p.letterSpacing*[...f].length;return l.set(S,x),x},metrics(f){if(!i)return n.metrics(f);let p=u(f),A=c.get(p);if(A)return A;i.font=p;let S=i.measureText("Hxg"),E=S.fontBoundingBoxAscent??f.size*It,x=S.fontBoundingBoxDescent??f.size*Nt,C={ascent:E,descent:x,lineGap:0};return c.set(p,C),C},load(f,p){let A=e.fonts;if(!A||typeof FontFace!="function")return!1;let S=!1;for(let E of Object.values(f.fonts))for(let x of zt(E)){let C=`${E.family}\0${x.src}\0${x.weight??400}\0${x.style??"normal"}`;if(m.has(C))continue;m.add(C);let O=x.src.startsWith("data:")?void 0:p?.(x.src),_={weight:String(x.weight??400),style:x.style??"normal"},N=$=>{let P=new FontFace(E.family,typeof $=="string"?`url(${$})`:Rt($),_);A.add(P),P.load().then(()=>{y(),t?.()},()=>{A.delete(P)})};O===void 0?N(x.src):(S=!0,O.then(N,()=>{}))}return S},invalidate:y,destroy(){y(),m.clear()}}}function zt(e){return e.faces??[]}function Rt(e){return e instanceof Uint8Array?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}var we={x:0,y:0,zoom:1},tt=.02,nt=64;function Me(e){return Number.isFinite(e)?Math.min(Math.max(e,tt),nt):1}function ve(e,t){return{x:(t.x-e.x)/e.zoom,y:(t.y-e.y)/e.zoom}}function Te(e,t){return{x:t.x*e.zoom+e.x,y:t.y*e.zoom+e.y}}function xe(e,t,r){let i=Me(e.zoom*r),n=ve(e,t);return{zoom:i,x:t.x-n.x*i,y:t.y-n.y*i}}function fe(e,t,r){return{...e,x:e.x+t,y:e.y+r}}function _e(e){return`translate(${e.x} ${e.y}) scale(${e.zoom})`}function oe(e,t,r){let i={width:Math.max(1,t.width-r*2),height:Math.max(1,t.height-r*2)};if(e.width<=0||e.height<=0)return we;let n=Me(Math.min(i.width/e.width,i.height/e.height));return{zoom:n,x:(t.width-e.width*n)/2-(e.x??0)*n,y:(t.height-e.height*n)/2-(e.y??0)*n}}var j="http://www.w3.org/2000/svg",rt="vd-viewer-styles",it=`
3
3
  .vd-viewer {
4
4
  position: relative;
5
5
  overflow: hidden;
package/edit.css CHANGED
@@ -626,6 +626,8 @@
626
626
  */
627
627
  .vd-strip {
628
628
  box-sizing: border-box;
629
+ /* The drop line and the context menu are placed against it. */
630
+ position: relative;
629
631
  display: flex;
630
632
  flex: 0 0 104px;
631
633
  height: 104px;
@@ -652,21 +654,121 @@
652
654
  }
653
655
 
654
656
  .vd-strip__list[hidden],
655
- .vd-strip__empty[hidden] {
657
+ .vd-strip__blank[hidden],
658
+ .vd-strip__drop[hidden] {
656
659
  display: none;
657
660
  }
658
661
 
659
- .vd-strip__empty {
662
+ /* No frames: what the strip is for, and the way to start one. */
663
+ .vd-strip__blank {
664
+ display: flex;
660
665
  flex: 1 1 auto;
661
- align-self: center;
662
- margin: 0;
666
+ align-items: center;
667
+ justify-content: center;
668
+ gap: 12px;
669
+ min-width: 0;
663
670
  padding: 0 16px;
671
+ }
672
+
673
+ .vd-strip__empty {
674
+ min-width: 0;
675
+ margin: 0;
664
676
  font-size: 12px;
665
677
  line-height: 1.5;
666
- text-align: center;
667
678
  color: var(--vd-muted, rgb(0 0 0 / 0.55));
668
679
  }
669
680
 
681
+ .vd-strip__add {
682
+ flex: 0 0 auto;
683
+ height: 28px;
684
+ padding: 0 12px;
685
+ border: 1px solid var(--vd-rule, rgb(0 0 0 / 0.12));
686
+ border-radius: 6px;
687
+ background: none;
688
+ color: var(--vd-ink, #1a1a1f);
689
+ font: inherit;
690
+ font-size: 12px;
691
+ cursor: default;
692
+ }
693
+
694
+ .vd-strip__add:hover {
695
+ background: var(--vd-row-hover, rgb(0 0 0 / 0.06));
696
+ }
697
+
698
+ .vd-strip__add:focus-visible {
699
+ outline: 2px solid var(--vd-focus, var(--vd-accent, #3b82f6));
700
+ outline-offset: 2px;
701
+ }
702
+
703
+ /* Where a dragged tile lands: a line in the gap, the tile's height, level
704
+ with the pictures (the list's 11 px top padding). */
705
+ .vd-strip__drop {
706
+ position: absolute;
707
+ top: 11px;
708
+ width: 2px;
709
+ height: 64px;
710
+ border-radius: 1px;
711
+ background: var(--vd-chosen, var(--vd-accent, #3b82f6));
712
+ pointer-events: none;
713
+ }
714
+
715
+ /* The tiles being dragged stay in place, faded, until the drop moves them. */
716
+ .vd-strip__tile[data-dragging='true'] {
717
+ opacity: 0.35;
718
+ }
719
+
720
+ .vd-strip--dragging,
721
+ .vd-strip--dragging * {
722
+ cursor: grabbing;
723
+ }
724
+
725
+ /* The picture under the pointer while dragging, with a count for several. */
726
+ .vd-strip__ghost {
727
+ position: fixed;
728
+ top: 0;
729
+ left: 0;
730
+ z-index: 10;
731
+ pointer-events: none;
732
+ opacity: 0.9;
733
+ }
734
+
735
+ .vd-strip__ghost .vd-strip__thumb {
736
+ outline: 2px solid var(--vd-chosen, var(--vd-accent, #3b82f6));
737
+ outline-offset: 1px;
738
+ }
739
+
740
+ .vd-strip__count {
741
+ position: absolute;
742
+ top: -8px;
743
+ right: -8px;
744
+ min-width: 18px;
745
+ height: 18px;
746
+ padding: 0 5px;
747
+ box-sizing: border-box;
748
+ border-radius: 9px;
749
+ background: var(--vd-chosen, var(--vd-accent, #3b82f6));
750
+ color: var(--vd-on-chosen, #ffffff);
751
+ font-family: var(--vd-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
752
+ font-size: 11px;
753
+ line-height: 18px;
754
+ text-align: center;
755
+ }
756
+
757
+ /* Read by a screen reader, never seen. */
758
+ .vd-strip__status {
759
+ position: absolute;
760
+ width: 1px;
761
+ height: 1px;
762
+ overflow: hidden;
763
+ clip-path: inset(50%);
764
+ white-space: nowrap;
765
+ }
766
+
767
+ /* The menu opens up over the canvas, so it sits above the canvas's chrome. */
768
+ .vd-strip > .vd-menu {
769
+ z-index: 10;
770
+ }
771
+
670
772
  .vd-strip__tile {
671
773
  display: flex;
672
774
  flex: 0 0 auto;
@@ -689,7 +791,9 @@
689
791
  box-sizing: border-box;
690
792
  overflow: hidden;
691
793
  border-radius: 4px;
692
- outline: 1px solid var(--vd-rule, rgb(0 0 0 / 0.12));
794
+ /* Its own variable, not the strip's rule: a dark slide on a dark strip
795
+ needs a stronger edge than a panel's hairline to be told apart. */
796
+ outline: 1px solid var(--vd-thumb-rule, var(--vd-rule, rgb(0 0 0 / 0.12)));
693
797
  outline-offset: -1px;
694
798
  background: var(--vd-thumb-bg, #f2f2f2);
695
799
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getv.design/embed",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Render, present and edit vDesign (.vd) documents in any web page. Free to use.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": {
@@ -1,2 +0,0 @@
1
- /*! @getv.design/embed v0.1.2. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
- var _="0.1.2",e="https://cdn.jsdelivr.net/npm/@getv.design/embed@0.1.2/fonts/";export{_ as a,e as b};