@getv.design/embed 0.5.1 → 0.5.2

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.5.1. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- import{a as y}from"./chunks/chunk-OK6J2L2H.js";import"./chunks/chunk-7K6NORUY.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.5.2. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
+ import{a as y}from"./chunks/chunk-OE3F27L6.js";import"./chunks/chunk-OM66E7BL.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.5.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-VL77CJOG.js";import{e as F}from"./chunks/chunk-OQXGXTNC.js";import"./chunks/chunk-EFCLQF2H.js";import"./chunks/chunk-OMFQR6TE.js";import"./chunks/chunk-OK6J2L2H.js";import"./chunks/chunk-7K6NORUY.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.5.2. 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-OQJPNBNN.js";import{e as F}from"./chunks/chunk-ODPS4XJH.js";import"./chunks/chunk-NAQCHPKZ.js";import"./chunks/chunk-FMTYD7LD.js";import"./chunks/chunk-OE3F27L6.js";import"./chunks/chunk-OM66E7BL.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.5.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-VL77CJOG.js";import{e as a}from"./chunks/chunk-OQXGXTNC.js";import"./chunks/chunk-EFCLQF2H.js";import"./chunks/chunk-OMFQR6TE.js";import"./chunks/chunk-OK6J2L2H.js";import"./chunks/chunk-7K6NORUY.js";export{b as createFenceIds,a as createRenderer,c as isVdFence,d as parseInfo,e as renderFence};
1
+ /*! @getv.design/embed v0.5.2. 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-OQJPNBNN.js";import{e as a}from"./chunks/chunk-ODPS4XJH.js";import"./chunks/chunk-NAQCHPKZ.js";import"./chunks/chunk-FMTYD7LD.js";import"./chunks/chunk-OE3F27L6.js";import"./chunks/chunk-OM66E7BL.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.5.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-VL77CJOG.js";import{e as f}from"./chunks/chunk-OQXGXTNC.js";import"./chunks/chunk-EFCLQF2H.js";import"./chunks/chunk-OMFQR6TE.js";import"./chunks/chunk-OK6J2L2H.js";import"./chunks/chunk-7K6NORUY.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.5.2. 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-OQJPNBNN.js";import{e as f}from"./chunks/chunk-ODPS4XJH.js";import"./chunks/chunk-NAQCHPKZ.js";import"./chunks/chunk-FMTYD7LD.js";import"./chunks/chunk-OE3F27L6.js";import"./chunks/chunk-OM66E7BL.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.5.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-VL77CJOG.js";import{e as g}from"./chunks/chunk-OQXGXTNC.js";import"./chunks/chunk-EFCLQF2H.js";import"./chunks/chunk-OMFQR6TE.js";import"./chunks/chunk-OK6J2L2H.js";import"./chunks/chunk-7K6NORUY.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.5.2. 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-OQJPNBNN.js";import{e as g}from"./chunks/chunk-ODPS4XJH.js";import"./chunks/chunk-NAQCHPKZ.js";import"./chunks/chunk-FMTYD7LD.js";import"./chunks/chunk-OE3F27L6.js";import"./chunks/chunk-OM66E7BL.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.5.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-OQXGXTNC.js";import"./chunks/chunk-EFCLQF2H.js";import"./chunks/chunk-OMFQR6TE.js";import{a}from"./chunks/chunk-OK6J2L2H.js";import"./chunks/chunk-7K6NORUY.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.5.2. 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-ODPS4XJH.js";import"./chunks/chunk-NAQCHPKZ.js";import"./chunks/chunk-FMTYD7LD.js";import{a}from"./chunks/chunk-OE3F27L6.js";import"./chunks/chunk-OM66E7BL.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.5.1. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- import{c as Ct,e as Ye,f as de,g as Ae,h as It,i as Ne}from"./chunks/chunk-EFCLQF2H.js";import{A as At,B as Ke,E as Mt,F as Tt,G as Ot,H as _t,I as We,J as Lt,K as Pt,a as lt,b as ut,c as De,d as pt,e as Be,f as He,g as ht,h as Ue,i as mt,j as gt,k as yt,l as wt,n as xt,p as vt,t as je,u as bt,v as Et,w as St,x as kt,y as Ge,z as Fe}from"./chunks/chunk-OMFQR6TE.js";import{a as wn,b as ft}from"./chunks/chunk-OK6J2L2H.js";import"./chunks/chunk-7K6NORUY.js";var xn=.8,vn=.2;function qe(e,t){let n=e.createElement("canvas").getContext("2d"),o=At(),l=new Map,a=new Map,g=new Set;function u(d){return`${d.italic?"italic ":""}${d.weight} ${d.size}px ${d.family}`}function S(){l.clear(),a.clear()}return{advance(d,y){if(!n)return o.advance(d,y);let w=u(y),E=`${w}\0${y.letterSpacing}\0${d}`,L=l.get(E);if(L!==void 0)return L;n.font=w;let x=n.measureText(d).width+y.letterSpacing*[...d].length;return l.set(E,x),x},metrics(d){if(!n)return o.metrics(d);let y=u(d),w=a.get(y);if(w)return w;n.font=y;let E=n.measureText("Hxg"),L=E.fontBoundingBoxAscent??d.size*xn,x=E.fontBoundingBoxDescent??d.size*vn,V={ascent:L,descent:x,lineGap:0};return a.set(y,V),V},load(d,y){let w=e.fonts;if(!w||typeof FontFace!="function")return!1;let E=!1;for(let L of Object.values(d.fonts))for(let x of bn(L)){let V=`${L.family}\0${x.src}\0${x.weight??400}\0${x.style??"normal"}`;if(g.has(V))continue;g.add(V);let _=x.src.startsWith("data:")?void 0:y?.(x.src),M={weight:String(x.weight??400),style:x.style??"normal"},H=Q=>{let R=new FontFace(L.family,typeof Q=="string"?`url(${Q})`:En(Q),M);w.add(R),R.load().then(()=>{S(),t?.()},()=>{w.delete(R)})};_===void 0?H(x.src):(E=!0,_.then(H,()=>{}))}return E},invalidate:S,destroy(){S(),g.clear()}}}function bn(e){return(e.faces??[]).flatMap(t=>t.src===void 0?[]:[{...t,src:t.src}])}function En(e){return e instanceof Uint8Array?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}var ze={x:0,y:0,zoom:1},Dt=.02,Ft=64;function Me(e){return Number.isFinite(e)?Math.min(Math.max(e,Dt),Ft):1}function $e(e,t){return{x:(t.x-e.x)/e.zoom,y:(t.y-e.y)/e.zoom}}function Ze(e,t){return{x:t.x*e.zoom+e.x,y:t.y*e.zoom+e.y}}function Te(e,t,i){let n=Me(e.zoom*i),o=$e(e,t);return{zoom:n,x:t.x-o.x*n,y:t.y-o.y*n}}function ye(e,t,i){return{...e,x:e.x+t,y:e.y+i}}function Xe(e){return`translate(${e.x} ${e.y}) scale(${e.zoom})`}function fe(e,t,i){let n={width:Math.max(1,t.width-i*2),height:Math.max(1,t.height-i*2)};if(e.width<=0||e.height<=0)return ze;let o=Me(Math.min(n.width/e.width,n.height/e.height));return{zoom:o,x:(t.width-e.width*o)/2-(e.x??0)*o,y:(t.height-e.height*o)/2-(e.y??0)*o}}var ne="http://www.w3.org/2000/svg",Nt="vd-viewer-styles",zt=`
1
+ /*! @getv.design/embed v0.5.2. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
+ import{c as Ct,e as Ye,f as de,g as Ae,h as It,i as Ne}from"./chunks/chunk-NAQCHPKZ.js";import{A as At,B as Ke,E as Mt,F as Tt,G as Ot,H as _t,I as We,J as Lt,K as Pt,a as lt,b as ut,c as De,d as pt,e as Be,f as He,g as ht,h as Ue,i as mt,j as gt,k as yt,l as wt,n as xt,p as vt,t as je,u as bt,v as Et,w as St,x as kt,y as Ge,z as Fe}from"./chunks/chunk-FMTYD7LD.js";import{a as wn,b as ft}from"./chunks/chunk-OE3F27L6.js";import"./chunks/chunk-OM66E7BL.js";var xn=.8,vn=.2;function qe(e,t){let n=e.createElement("canvas").getContext("2d"),o=At(),l=new Map,a=new Map,g=new Set;function u(d){return`${d.italic?"italic ":""}${d.weight} ${d.size}px ${d.family}`}function S(){l.clear(),a.clear()}return{advance(d,y){if(!n)return o.advance(d,y);let w=u(y),E=`${w}\0${y.letterSpacing}\0${d}`,L=l.get(E);if(L!==void 0)return L;n.font=w;let x=n.measureText(d).width+y.letterSpacing*[...d].length;return l.set(E,x),x},metrics(d){if(!n)return o.metrics(d);let y=u(d),w=a.get(y);if(w)return w;n.font=y;let E=n.measureText("Hxg"),L=E.fontBoundingBoxAscent??d.size*xn,x=E.fontBoundingBoxDescent??d.size*vn,V={ascent:L,descent:x,lineGap:0};return a.set(y,V),V},load(d,y){let w=e.fonts;if(!w||typeof FontFace!="function")return!1;let E=!1;for(let L of Object.values(d.fonts))for(let x of bn(L)){let V=`${L.family}\0${x.src}\0${x.weight??400}\0${x.style??"normal"}`;if(g.has(V))continue;g.add(V);let _=x.src.startsWith("data:")?void 0:y?.(x.src),M={weight:String(x.weight??400),style:x.style??"normal"},H=Q=>{let R=new FontFace(L.family,typeof Q=="string"?`url(${Q})`:En(Q),M);w.add(R),R.load().then(()=>{S(),t?.()},()=>{w.delete(R)})};_===void 0?H(x.src):(E=!0,_.then(H,()=>{}))}return E},invalidate:S,destroy(){S(),g.clear()}}}function bn(e){return(e.faces??[]).flatMap(t=>t.src===void 0?[]:[{...t,src:t.src}])}function En(e){return e instanceof Uint8Array?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}var ze={x:0,y:0,zoom:1},Dt=.02,Ft=64;function Me(e){return Number.isFinite(e)?Math.min(Math.max(e,Dt),Ft):1}function $e(e,t){return{x:(t.x-e.x)/e.zoom,y:(t.y-e.y)/e.zoom}}function Ze(e,t){return{x:t.x*e.zoom+e.x,y:t.y*e.zoom+e.y}}function Te(e,t,i){let n=Me(e.zoom*i),o=$e(e,t);return{zoom:n,x:t.x-o.x*n,y:t.y-o.y*n}}function ye(e,t,i){return{...e,x:e.x+t,y:e.y+i}}function Xe(e){return`translate(${e.x} ${e.y}) scale(${e.zoom})`}function fe(e,t,i){let n={width:Math.max(1,t.width-i*2),height:Math.max(1,t.height-i*2)};if(e.width<=0||e.height<=0)return ze;let o=Me(Math.min(n.width/e.width,n.height/e.height));return{zoom:o,x:(t.width-e.width*o)/2-(e.x??0)*o,y:(t.height-e.height*o)/2-(e.y??0)*o}}var ne="http://www.w3.org/2000/svg",Nt="vd-viewer-styles",zt=`
3
3
  .vd-viewer {
4
4
  position: relative;
5
5
  overflow: hidden;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getv.design/embed",
3
- "version": "0.5.1",
3
+ "version": "0.5.2",
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.5.1. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
2
- var _="0.5.1",e="https://cdn.jsdelivr.net/npm/@getv.design/embed@0.5.1/fonts/";export{_ as a,e as b};