@getv.design/embed 0.6.0 → 0.6.1

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.6.0. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- import{a as y}from"./chunks/chunk-VTEBIFPH.js";import"./chunks/chunk-UN7F6SH4.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.6.1. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
+ import{a as y}from"./chunks/chunk-KF7NJEZQ.js";import"./chunks/chunk-DXK755VP.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,2 +1,2 @@
1
- /*! @getv.design/embed v0.6.0. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- import{a as f,b as p,d as u}from"./chunks/chunk-FXERLAK5.js";import{e as F}from"./chunks/chunk-7P37TP37.js";import"./chunks/chunk-RSOCS6S4.js";import"./chunks/chunk-P42KFNKD.js";import"./chunks/chunk-VTEBIFPH.js";import"./chunks/chunk-UN7F6SH4.js";function I(l,t={}){let o=l.renderer.rules,s=o.fence,i=new WeakMap;o.fence=(n,c,k,d,g)=>{let e=n[c];if(!e||!p(e.info))return s?s(n,c,k,d,g):"";let r=t.idPrefix;r||(r=i.get(n)??f(),i.set(n,r));let{resolveSrc:a,...w}=t;return u(e.content,e.info,{...w,idPrefix:r,...e.attrs?{attributes:e.attrs}:{},...a?{resolveSrc:m=>a(m,d)}:{}})}}var b=I;export{F as createRenderer,b as default,I as vdesignMarkdownIt};
1
+ /*! @getv.design/embed v0.6.1. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
+ import{a as f,b as p,d as u}from"./chunks/chunk-HHLJB4PE.js";import{e as F}from"./chunks/chunk-ER6HNUNJ.js";import"./chunks/chunk-FM6ZYYTD.js";import"./chunks/chunk-JAYW4VNL.js";import"./chunks/chunk-KF7NJEZQ.js";import"./chunks/chunk-DXK755VP.js";function I(l,t={}){let o=l.renderer.rules,s=o.fence,i=new WeakMap;o.fence=(n,c,k,d,g)=>{let e=n[c];if(!e||!p(e.info))return s?s(n,c,k,d,g):"";let r=t.idPrefix;r||(r=i.get(n)??f(),i.set(n,r));let{resolveSrc:a,...w}=t;return u(e.content,e.info,{...w,idPrefix:r,...e.attrs?{attributes:e.attrs}:{},...a?{resolveSrc:m=>a(m,d)}:{}})}}var b=I;export{F as createRenderer,b as default,I as vdesignMarkdownIt};
package/dist/markdown.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! @getv.design/embed v0.6.0. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- import{a as b,b as c,c as d,d as e}from"./chunks/chunk-FXERLAK5.js";import{e as a}from"./chunks/chunk-7P37TP37.js";import"./chunks/chunk-RSOCS6S4.js";import"./chunks/chunk-P42KFNKD.js";import"./chunks/chunk-VTEBIFPH.js";import"./chunks/chunk-UN7F6SH4.js";export{b as createFenceIds,a as createRenderer,c as isVdFence,d as parseInfo,e as renderFence};
1
+ /*! @getv.design/embed v0.6.1. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
+ import{a as b,b as c,c as d,d as e}from"./chunks/chunk-HHLJB4PE.js";import{e as a}from"./chunks/chunk-ER6HNUNJ.js";import"./chunks/chunk-FM6ZYYTD.js";import"./chunks/chunk-JAYW4VNL.js";import"./chunks/chunk-KF7NJEZQ.js";import"./chunks/chunk-DXK755VP.js";export{b as createFenceIds,a as createRenderer,c as isVdFence,d as parseInfo,e as renderFence};
package/dist/marked.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! @getv.design/embed v0.6.0. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- import{a as t,b as i,d as o}from"./chunks/chunk-FXERLAK5.js";import{e as f}from"./chunks/chunk-7P37TP37.js";import"./chunks/chunk-RSOCS6S4.js";import"./chunks/chunk-P42KFNKD.js";import"./chunks/chunk-VTEBIFPH.js";import"./chunks/chunk-UN7F6SH4.js";function p(r={}){let s=r.idPrefix??t();return{renderer:{code(e,d){let c=typeof e=="string"?e:e.text,n=typeof e=="string"?d:e.lang;return i(n)?o(c,n??"vd",{...r,idPrefix:s}):!1}}}}var a=p;export{f as createRenderer,a as default,p as vdesignMarked};
1
+ /*! @getv.design/embed v0.6.1. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
+ import{a as t,b as i,d as o}from"./chunks/chunk-HHLJB4PE.js";import{e as f}from"./chunks/chunk-ER6HNUNJ.js";import"./chunks/chunk-FM6ZYYTD.js";import"./chunks/chunk-JAYW4VNL.js";import"./chunks/chunk-KF7NJEZQ.js";import"./chunks/chunk-DXK755VP.js";function p(r={}){let s=r.idPrefix??t();return{renderer:{code(e,d){let c=typeof e=="string"?e:e.text,n=typeof e=="string"?d:e.lang;return i(n)?o(c,n??"vd",{...r,idPrefix:s}):!1}}}}var a=p;export{f as createRenderer,a as default,p as vdesignMarked};
package/dist/rehype.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! @getv.design/embed v0.6.0. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- import{a as h,d as m}from"./chunks/chunk-FXERLAK5.js";import{e as g}from"./chunks/chunk-7P37TP37.js";import"./chunks/chunk-RSOCS6S4.js";import"./chunks/chunk-P42KFNKD.js";import"./chunks/chunk-VTEBIFPH.js";import"./chunks/chunk-UN7F6SH4.js";function x(e={}){let n,i=()=>e.renderer?Promise.resolve(e.renderer):n??=g({fonts:e.fonts??"exact",...e.fontBase===void 0?{}:{fontBase:e.fontBase}});return async(t,r)=>{let s=r?.path??r?.history?.at(-1);if(e.include&&!e.include(s))return;let o=[];if(v(t,(d,l,a)=>{if(d.type!=="element"||d.tagName!=="pre"||!l)return;let c=d.children?.find(p=>p.type==="element");c?.tagName!=="code"||!F(c)||o.push({parent:l,index:a,code:c})}),o.length===0)return;let u=await i(),f={...e};for(let d of["resolveSrc","fonts","fontBase","include"])delete f[d];let N=e.idPrefix??h(),R=e.resolveSrc??k;for(let{parent:d,index:l,code:a}of o){let c=typeof a.data?.meta=="string"?a.data.meta:"",p=m(y(a),`vd ${c}`,{...f,renderer:u,idPrefix:N,resolveSrc:H=>R(H,s)});d.children[l]={type:"raw",value:p}}}}var B=x;function F(e){let n=e.properties?.className;return(Array.isArray(n)?n:typeof n=="string"?n.split(/\s+/):[]).some(t=>t==="language-vd"||t==="language-vdesign")}function y(e){return e.type==="text"?e.value??"":(e.children??[]).map(y).join("")}function v(e,n,i,t=0){n(e,i,t),e.children?.forEach((r,s)=>v(r,n,e,s))}function k(e,n){let i=globalThis,t=i.process?.getBuiltinModule?.("node:fs"),r=i.process?.getBuiltinModule?.("node:path"),s=i.process?.cwd?.();if(!t||!r||s===void 0||/^[a-z][a-z0-9+.-]*:/i.test(e)||e.includes("\\")||!/\.vd(\.svg)?$/i.test(e))return;let o=n===void 0?s:r.dirname(r.resolve(s,n));try{let u=t.realpathSync(r.resolve(o,e)),f=t.realpathSync(s);return u.startsWith(f+r.sep)?t.readFileSync(u,"utf8"):void 0}catch{return}}export{B as default,x as rehypeVdesign};
1
+ /*! @getv.design/embed v0.6.1. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
+ import{a as h,d as m}from"./chunks/chunk-HHLJB4PE.js";import{e as g}from"./chunks/chunk-ER6HNUNJ.js";import"./chunks/chunk-FM6ZYYTD.js";import"./chunks/chunk-JAYW4VNL.js";import"./chunks/chunk-KF7NJEZQ.js";import"./chunks/chunk-DXK755VP.js";function x(e={}){let n,i=()=>e.renderer?Promise.resolve(e.renderer):n??=g({fonts:e.fonts??"exact",...e.fontBase===void 0?{}:{fontBase:e.fontBase}});return async(t,r)=>{let s=r?.path??r?.history?.at(-1);if(e.include&&!e.include(s))return;let o=[];if(v(t,(d,l,a)=>{if(d.type!=="element"||d.tagName!=="pre"||!l)return;let c=d.children?.find(p=>p.type==="element");c?.tagName!=="code"||!F(c)||o.push({parent:l,index:a,code:c})}),o.length===0)return;let u=await i(),f={...e};for(let d of["resolveSrc","fonts","fontBase","include"])delete f[d];let N=e.idPrefix??h(),R=e.resolveSrc??k;for(let{parent:d,index:l,code:a}of o){let c=typeof a.data?.meta=="string"?a.data.meta:"",p=m(y(a),`vd ${c}`,{...f,renderer:u,idPrefix:N,resolveSrc:H=>R(H,s)});d.children[l]={type:"raw",value:p}}}}var B=x;function F(e){let n=e.properties?.className;return(Array.isArray(n)?n:typeof n=="string"?n.split(/\s+/):[]).some(t=>t==="language-vd"||t==="language-vdesign")}function y(e){return e.type==="text"?e.value??"":(e.children??[]).map(y).join("")}function v(e,n,i,t=0){n(e,i,t),e.children?.forEach((r,s)=>v(r,n,e,s))}function k(e,n){let i=globalThis,t=i.process?.getBuiltinModule?.("node:fs"),r=i.process?.getBuiltinModule?.("node:path"),s=i.process?.cwd?.();if(!t||!r||s===void 0||/^[a-z][a-z0-9+.-]*:/i.test(e)||e.includes("\\")||!/\.vd(\.svg)?$/i.test(e))return;let o=n===void 0?s:r.dirname(r.resolve(s,n));try{let u=t.realpathSync(r.resolve(o,e)),f=t.realpathSync(s);return u.startsWith(f+r.sep)?t.readFileSync(u,"utf8"):void 0}catch{return}}export{B as default,x as rehypeVdesign};
package/dist/static.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! @getv.design/embed v0.6.0. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- import{a as b,b as c,c as d,d as e,e as f,f as g}from"./chunks/chunk-7P37TP37.js";import"./chunks/chunk-RSOCS6S4.js";import"./chunks/chunk-P42KFNKD.js";import{a}from"./chunks/chunk-VTEBIFPH.js";import"./chunks/chunk-UN7F6SH4.js";export{g as approximateRenderer,f as createRenderer,d as designOf,e as outline,b as parse,c as renderSvg,a as version};
1
+ /*! @getv.design/embed v0.6.1. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
+ import{a as b,b as c,c as d,d as e,e as f,f as g}from"./chunks/chunk-ER6HNUNJ.js";import"./chunks/chunk-FM6ZYYTD.js";import"./chunks/chunk-JAYW4VNL.js";import{a}from"./chunks/chunk-KF7NJEZQ.js";import"./chunks/chunk-DXK755VP.js";export{g as approximateRenderer,f as createRenderer,d as designOf,e as outline,b as parse,c as renderSvg,a as version};
package/dist/view.js CHANGED
@@ -1,5 +1,5 @@
1
- /*! @getv.design/embed v0.6.0. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- import{c as an,e as ct,f as de,g as Oe,h as cn,i as He}from"./chunks/chunk-RSOCS6S4.js";import{$ as at,A as Ve,B as nt,C as Vt,D as Bt,E as rt,F as it,I as jt,J as Ht,K as Ut,L as Kt,M as ot,N as Be,O as Gt,P as Wt,Q as qt,R as Yt,S as Zt,T as st,U as Xt,V as Jt,W as Qt,X as en,Y as tn,Z as nn,_ as rn,a as Ze,aa as on,b as Tt,ba as je,c as Ot,ca as sn,d as Re,e as Ct,f as Xe,g as Je,h as Pt,i as Qe,j as _t,k as Lt,l as Dt,m as Ee,o as Ft,q as It,s as et,v as tt,w as Nt,x as $t,y as zt,z as Rt}from"./chunks/chunk-P42KFNKD.js";import{a as qn,b as Mt}from"./chunks/chunk-VTEBIFPH.js";import"./chunks/chunk-UN7F6SH4.js";var Yn=.8,Zn=.2;function lt(e,t){let r=e.createElement("canvas").getContext("2d"),i=Bt(),a=new Map,c=new Map,m=new Set;function d(f){return`${f.italic?"italic ":""}${f.weight} ${f.size}px ${f.family}`}function S(){a.clear(),c.clear()}return{advance(f,y){if(!r)return i.advance(f,y);let w=d(y),k=`${w}\0${y.letterSpacing}\0${f}`,_=a.get(k);if(_!==void 0)return _;r.font=w;let v=r.measureText(f).width+y.letterSpacing*[...f].length;return a.set(k,v),v},metrics(f){if(!r)return i.metrics(f);let y=d(f),w=c.get(y);if(w)return w;r.font=y;let k=r.measureText("Hxg"),_=k.fontBoundingBoxAscent??f.size*Yn,v=k.fontBoundingBoxDescent??f.size*Zn,I={ascent:_,descent:v,lineGap:0};return c.set(y,I),I},load(f,y){let w=e.fonts;if(!w||typeof FontFace!="function")return!1;let k=!1;for(let _ of Object.values(f.fonts))for(let v of Xn(_)){let I=`${_.family}\0${v.src}\0${v.weight??400}\0${v.style??"normal"}`;if(m.has(I))continue;m.add(I);let P=v.src.startsWith("data:")?void 0:y?.(v.src),T={weight:String(v.weight??400),style:v.style??"normal"},j=ee=>{let V=new FontFace(_.family,typeof ee=="string"?`url(${ee})`:Jn(ee),T);w.add(V),V.load().then(()=>{S(),t?.()},()=>{w.delete(V)})};P===void 0?j(v.src):(k=!0,P.then(j,()=>{}))}return k},invalidate:S,destroy(){S(),m.clear()}}}function Xn(e){return(e.faces??[]).flatMap(t=>t.src===void 0?[]:[{...t,src:t.src}])}function Jn(e){return e instanceof Uint8Array?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}var Ue={x:0,y:0,zoom:1},ln=.02,dn=64;function Ce(e){return Number.isFinite(e)?Math.min(Math.max(e,ln),dn):1}function Ke(e,t){return{x:(t.x-e.x)/e.zoom,y:(t.y-e.y)/e.zoom}}function dt(e,t){return{x:t.x*e.zoom+e.x,y:t.y*e.zoom+e.y}}function Pe(e,t,n){let r=Ce(e.zoom*n),i=Ke(e,t);return{zoom:r,x:t.x-i.x*r,y:t.y-i.y*r}}function we(e,t,n){return{...e,x:e.x+t,y:e.y+n}}function ft(e){return`translate(${e.x} ${e.y}) scale(${e.zoom})`}function fe(e,t,n){let r={width:Math.max(1,t.width-n*2),height:Math.max(1,t.height-n*2)};if(e.width<=0||e.height<=0)return Ue;let i=Ce(Math.min(r.width/e.width,r.height/e.height));return{zoom:i,x:(t.width-e.width*i)/2-(e.x??0)*i,y:(t.height-e.height*i)/2-(e.y??0)*i}}var H="http://www.w3.org/2000/svg",fn="vd-viewer-styles",un=`
1
+ /*! @getv.design/embed v0.6.1. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
+ import{c as an,e as ct,f as de,g as Oe,h as cn,i as He}from"./chunks/chunk-FM6ZYYTD.js";import{$ as at,A as Ve,B as nt,C as Vt,D as Bt,E as rt,F as it,I as jt,J as Ht,K as Ut,L as Kt,M as ot,N as Be,O as Gt,P as Wt,Q as qt,R as Yt,S as Zt,T as st,U as Xt,V as Jt,W as Qt,X as en,Y as tn,Z as nn,_ as rn,a as Ze,aa as on,b as Tt,ba as je,c as Ot,ca as sn,d as Re,e as Ct,f as Xe,g as Je,h as Pt,i as Qe,j as _t,k as Lt,l as Dt,m as Ee,o as Ft,q as It,s as et,v as tt,w as Nt,x as $t,y as zt,z as Rt}from"./chunks/chunk-JAYW4VNL.js";import{a as qn,b as Mt}from"./chunks/chunk-KF7NJEZQ.js";import"./chunks/chunk-DXK755VP.js";var Yn=.8,Zn=.2;function lt(e,t){let r=e.createElement("canvas").getContext("2d"),i=Bt(),a=new Map,c=new Map,m=new Set;function d(f){return`${f.italic?"italic ":""}${f.weight} ${f.size}px ${f.family}`}function S(){a.clear(),c.clear()}return{advance(f,y){if(!r)return i.advance(f,y);let w=d(y),k=`${w}\0${y.letterSpacing}\0${f}`,_=a.get(k);if(_!==void 0)return _;r.font=w;let v=r.measureText(f).width+y.letterSpacing*[...f].length;return a.set(k,v),v},metrics(f){if(!r)return i.metrics(f);let y=d(f),w=c.get(y);if(w)return w;r.font=y;let k=r.measureText("Hxg"),_=k.fontBoundingBoxAscent??f.size*Yn,v=k.fontBoundingBoxDescent??f.size*Zn,I={ascent:_,descent:v,lineGap:0};return c.set(y,I),I},load(f,y){let w=e.fonts;if(!w||typeof FontFace!="function")return!1;let k=!1;for(let _ of Object.values(f.fonts))for(let v of Xn(_)){let I=`${_.family}\0${v.src}\0${v.weight??400}\0${v.style??"normal"}`;if(m.has(I))continue;m.add(I);let P=v.src.startsWith("data:")?void 0:y?.(v.src),T={weight:String(v.weight??400),style:v.style??"normal"},j=ee=>{let V=new FontFace(_.family,typeof ee=="string"?`url(${ee})`:Jn(ee),T);w.add(V),V.load().then(()=>{S(),t?.()},()=>{w.delete(V)})};P===void 0?j(v.src):(k=!0,P.then(j,()=>{}))}return k},invalidate:S,destroy(){S(),m.clear()}}}function Xn(e){return(e.faces??[]).flatMap(t=>t.src===void 0?[]:[{...t,src:t.src}])}function Jn(e){return e instanceof Uint8Array?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}var Ue={x:0,y:0,zoom:1},ln=.02,dn=64;function Ce(e){return Number.isFinite(e)?Math.min(Math.max(e,ln),dn):1}function Ke(e,t){return{x:(t.x-e.x)/e.zoom,y:(t.y-e.y)/e.zoom}}function dt(e,t){return{x:t.x*e.zoom+e.x,y:t.y*e.zoom+e.y}}function Pe(e,t,n){let r=Ce(e.zoom*n),i=Ke(e,t);return{zoom:r,x:t.x-i.x*r,y:t.y-i.y*r}}function we(e,t,n){return{...e,x:e.x+t,y:e.y+n}}function ft(e){return`translate(${e.x} ${e.y}) scale(${e.zoom})`}function fe(e,t,n){let r={width:Math.max(1,t.width-n*2),height:Math.max(1,t.height-n*2)};if(e.width<=0||e.height<=0)return Ue;let i=Ce(Math.min(r.width/e.width,r.height/e.height));return{zoom:i,x:(t.width-e.width*i)/2-(e.x??0)*i,y:(t.height-e.height*i)/2-(e.y??0)*i}}var H="http://www.w3.org/2000/svg",fn="vd-viewer-styles",un=`
3
3
  .vd-viewer {
4
4
  position: relative;
5
5
  overflow: hidden;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@getv.design/embed",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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": {
7
7
  "name": "vDesign",
8
- "email": "sagar@getv.design"
8
+ "email": "teams@getv.design"
9
9
  },
10
10
  "homepage": "https://getv.design/docs/embed/",
11
11
  "private": false,
@@ -1,2 +0,0 @@
1
- /*! @getv.design/embed v0.6.0. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- var _="0.6.0",e="https://cdn.jsdelivr.net/npm/@getv.design/embed@0.6.0/fonts/";export{_ as a,e as b};