@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/README.md +3 -3
- package/THIRD_PARTY_NOTICES.txt +1 -1
- package/dist/chunks/{chunk-VBG4ORCT.js → chunk-3XUNDFDN.js} +2 -2
- package/dist/chunks/chunk-ETXF3NVH.js +2 -0
- package/dist/chunks/{chunk-GI6ZV6OJ.js → chunk-FGXZYG3Y.js} +1 -1
- package/dist/chunks/{chunk-JWKZL5KP.js → chunk-KODHLOJV.js} +1 -1
- package/dist/chunks/fonts.js +2 -2
- package/dist/edit.js +135 -31
- package/dist/index.js +2 -2
- package/dist/static.js +2 -2
- package/dist/view.js +2 -2
- package/edit.css +110 -6
- package/package.json +1 -1
- package/dist/chunks/chunk-PCMXJXR4.js +0 -2
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ rebundling), so the editor and the font code still load only when needed:
|
|
|
36
36
|
```html
|
|
37
37
|
<div id="design"></div>
|
|
38
38
|
<script type="module">
|
|
39
|
-
import { view } from 'https://cdn.jsdelivr.net/npm/@getv.design/embed@0.1.
|
|
39
|
+
import { view } from 'https://cdn.jsdelivr.net/npm/@getv.design/embed@0.1.3/dist/view.js';
|
|
40
40
|
|
|
41
41
|
const text = await (await fetch('/designs/home.vd')).text();
|
|
42
42
|
await view(document.querySelector('#design'), text);
|
|
@@ -187,7 +187,7 @@ has no `problems` or `fonts` event yet to say so.
|
|
|
187
187
|
### Where the faces come from
|
|
188
188
|
|
|
189
189
|
The faces come from `fontBase`, by default this package's `fonts/` folder on
|
|
190
|
-
jsDelivr (`https://cdn.jsdelivr.net/npm/@getv.design/embed@0.1.
|
|
190
|
+
jsDelivr (`https://cdn.jsdelivr.net/npm/@getv.design/embed@0.1.3/fonts/`). That means
|
|
191
191
|
your readers' browsers request the faces from jsDelivr, and a content security
|
|
192
192
|
policy needs it in `connect-src`. To keep those requests on your own origin,
|
|
193
193
|
copy `node_modules/@getv.design/embed/fonts/` to your site and point `fontBase` at it:
|
|
@@ -216,7 +216,7 @@ The embed's styles reach the page by one of two routes.
|
|
|
216
216
|
```
|
|
217
217
|
|
|
218
218
|
Link them before the embed runs, from your own origin or from the CDN
|
|
219
|
-
(`https://cdn.jsdelivr.net/npm/@getv.design/embed@0.1.
|
|
219
|
+
(`https://cdn.jsdelivr.net/npm/@getv.design/embed@0.1.3/view.css`). The id is what
|
|
220
220
|
the embed looks for: linked without it, the stylesheet still works, but
|
|
221
221
|
the embed inserts its `<style>` as well.
|
|
222
222
|
|
package/THIRD_PARTY_NOTICES.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @getv.design/embed v0.1.
|
|
2
|
-
import{a as m}from"./chunk-
|
|
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 m}from"./chunk-ETXF3NVH.js";import{i as c,l as a}from"./chunk-KODHLOJV.js";var l=Symbol.for(`vdesign.embed.documents@${m}`),u=globalThis[l]??=new WeakMap,p=/^Line (\d+): /;function b(e){let t=p.exec(e.message);return{...t?{line:Number(t[1])}:{},code:e.code,message:e.message,severity:e.severity}}function i(e){if(typeof e!="string")return d(a("").document,new Map,[{code:"not-text",message:`parse() takes .vd text, not ${e===null?"null":typeof e}.`,severity:"error"}]);let{head:t,blocks:o}=c(e),n=a(t);return d(n.document,o,n.problems.map(b))}function d(e,t,o){let n=Object.freeze({});return u.set(n,{document:e,blocks:t,problems:o}),{document:n,problems:o}}function P(e,t,o){return d(e,t,[...o]).document}function s(e){let t=u.get(e);if(!t)throw new TypeError("Not a vDesign document: pass .vd text or what parse() returned.");return t}async function x(e){if(typeof e=="string")return s(i(e).document);if(e instanceof URL){let t=await fetch(e);if(!t.ok)throw new Error(`Could not fetch ${e.href}: ${t.status}`);return s(i(await t.text()).document)}return y(e)?s(i(await e.text()).document):s(e)}function y(e){let t=e;return typeof t.text=="function"&&typeof t.size=="number"}function g(e){return e.root.children.filter(t=>t.type==="frame"&&t.hidden!==!0)}function V(e,t){let o=g(e),n=typeof t=="number"?o[t]:o.find(r=>r.id===t);if(!n){let r=o.map(f=>f.id).join(", ")||"none";throw new RangeError(`No page ${JSON.stringify(t)} in this document; its pages: ${r}.`)}return n}function v(e,t,o){let n=e===void 0?t:String(e);if(n===void 0)return;let r;try{r=new URL(n,o??globalThis.location?.href)}catch{throw new TypeError(`fontBase must be a URL, or a path on this page; got ${n}.`)}return r.pathname.endsWith("/")||(r.pathname+="/"),r}function k(e,t){return{code:"fonts-unavailable",message:`Exact fonts could not be loaded: ${t??e.map(n=>`${n.file} (${n.reason})`).join(", ")}. Text is measured without them, so lines may break differently from the app's.`,severity:"warning"}}export{i as a,P as b,x as c,g as d,V as e,v as f,k as g};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @getv.design/embed v0.1.
|
|
1
|
+
/*! @getv.design/embed v0.1.3. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
|
|
2
2
|
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>{try{return a||b((a={exports:{}}).exports,a),a.exports}catch(c){throw a=0,c}};var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @getv.design/embed v0.1.
|
|
1
|
+
/*! @getv.design/embed v0.1.3. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
|
|
2
2
|
function D(e){let t=e.trim();if(t.startsWith("#")){let r=t.slice(1);return r===""?void 0:{kind:"frame",id:r}}let n;try{n=new URL(t)}catch{return}if(!(n.protocol!=="https:"&&n.protocol!=="mailto:"))return{kind:"url",url:t}}var J="--- payload base64 ---",Pn="sha256-";function Ut(e){let t=Dn(e);return t===-1?{head:e,payload:""}:{head:e.slice(0,t),payload:e.slice(t+J.length)}}function Rn(e){let{head:t,payload:n}=Ut(e);return{head:t,blocks:Wt(n)}}function Wt(e){let t=new Map;for(let n of e.split(`
|
|
3
3
|
`)){let r=n.indexOf(" ");if(r===-1)continue;let o=n.slice(0,r);o.startsWith(Pn)&&t.set(o,n.slice(r+1).trim())}return t}function Ln(e,t){return`data:${e};base64,${t}`}function Vn(e){let t=Uint8Array.fromBase64;if(typeof t=="function")return t(e);let n=atob(e),r=new Uint8Array(n.length);for(let o=0;o<n.length;o+=1)r[o]=n.charCodeAt(o);return r}function Dn(e){if(e.startsWith(J))return 0;let t=e.indexOf(`
|
|
4
4
|
${J}`);return t===-1?-1:t+1}function ee(e){return{expr:e}}function P(e){return typeof e=="object"&&e!==null&&typeof e.expr=="string"}var me=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],te=["left","center","right","justify"],ne=["top","middle","bottom"],re=["cover","contain","fill"],ge=["nonzero","evenodd"],xe=["butt","round","square"],$e=["miter","round","bevel"],Bt=["canvas","frame","group"];function we(e){return Bt.includes(e)}function _(e){return we(e.type)}function oe(e){return e.type==="group"}var zt={canvas:["w","h"],ellipse:["x","y","w","h","rotation","strokeWidth","opacity"],frame:["x","y","w","h"],group:[],image:["x","y","w","h","rotation","radius","opacity"],rect:["x","y","w","h","rotation","strokeWidth","radius","opacity"],text:["x","y","w","h","rotation","size","weight","lineHeight","letterSpacing","opacity"],vector:["x","y","w","h","rotation","strokeWidth","opacity"]};function ke(e){return zt[e.type]}function T(e,t,n){if(t(e,n)!==!1&&_(e))for(let r of e.children)T(r,t,e)}function Ye(e,t){let n;return T(e,r=>{if(n)return!1;r.id===t&&(n=r)}),n}var ie=["design"],X="design";var ve=[1,2,3,4],F="doc";function se(e){return{type:"canvas",...e}}function be(e={}){return{version:4,kind:e.kind??X,...e.title===void 0?{}:{title:e.title},tokens:e.tokens??{},fonts:e.fonts??{},assets:e.assets??{},...e.motion===void 0||Object.keys(e.motion).length===0?{}:{motion:e.motion},root:e.root??se({id:F,children:[]})}}var Ee=["cut","fade","push","slide"],Se=["cut","fade","rise","drop","pop"],Fn=400,ue=1e4;function Y(e){let t=e.trim();return t==="back"?{kind:"back"}:t==="next"?{kind:"next"}:D(t)}function ae(e){return e===void 0||e.enter===void 0&&e.duration===void 0&&e.lines.length===0}function Oe(e){return e.enter!==void 0||e.exit!==void 0||e.go!==void 0}function Me(e){let t=e.motion;if(!t)return[];let n=e.root.children.map(o=>o.id).filter(o=>o in t),r=Object.keys(t).filter(o=>!n.includes(o)).sort();return[...n,...r]}function He(e){return new Set(e.root.children.filter(t=>t.type==="frame").map(t=>t.id))}function Ke(e){let t=new Map;for(let n of e.root.children)n.type==="frame"&&T(n,r=>{t.set(r.id,n.id)});return t}function jn(e){let t=new Set;return T(e,n=>{t.add(n.id)}),t}function ce(e,t){let n=e.motion;if(!n)return[];let r=[],o=He(e),i=Ke(e),s=jn(e.root),a=(u,c)=>{let f=t?.(u,c);return f===void 0?"":`Line ${f}: `};for(let u of Me(e)){let c=n[u];if(c){if(!o.has(u)){r.push({severity:"warning",code:"motion-not-a-page",message:`${a(u)}motion ${u}: ${u} is not a page (a top-level frame), so none of it plays`,nodeId:u});continue}for(let f of c.lines){let d=a(u,f.id);s.has(f.id)?i.get(f.id)!==u&&r.push({severity:"warning",code:"motion-wrong-page",message:`${d}motion ${u}: ${f.id} is not on ${u}, so Play skips it`,nodeId:f.id}):r.push({severity:"warning",code:"unknown-reference",message:`${d}motion ${u}: no node ${f.id}`,nodeId:f.id});let l=f.go===void 0?void 0:Y(f.go);l?.kind==="frame"&&!Cn(e,l.id)&&r.push({severity:"warning",code:"unknown-reference",message:`${d}motion ${u}: go=#${l.id} names no frame`,nodeId:f.id})}}}return r}function Cn(e,t){let n=!1;return T(e.root,r=>{if(n)return!1;r.id===t&&(n=r.type==="frame")}),n}function h(e){if(!Number.isFinite(e))return"0";let t=Math.round(e*1e4)/1e4,n=Object.is(t,-0)?0:t;return Math.abs(n)>=1e21?n.toFixed(0):String(n)}var Un={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};function qe(e){let t=[],n,r=0,o=0,i=0,s=0,a,u,c=Bn(e),f=()=>(n||(n={anchors:[{x:r,y:o}],closed:!1},t.push(n)),n.anchors[n.anchors.length-1]),d=(p,$)=>{f(),n?.anchors.push({x:p,y:$}),r=p,o=$},l=(p,$,k,g)=>{f().out=p,n?.anchors.push({x:k,y:g,in:$}),r=k,o=g},y="",b=!0;for(;c.more();){let p=c.command();if(p!==void 0)y=p,b=!0;else if(y===""||y.toUpperCase()==="Z")return{contours:Te(t),error:`Expected a command at ${c.at()}`};let $=y.toUpperCase(),k=y!==$,g=Un[$];if(g===void 0)return{contours:Te(t),error:`Unknown command ${y}`};if($==="Z"){n&&(n.closed=!0),n=void 0,r=i,o=s,a=void 0,u=void 0,y="";continue}let N=$==="A"?c.arc():c.numbers(g);if(N===void 0)return{contours:Te(t),error:`${y} expects ${g} numbers at ${c.at()}`};let m=k?r:0,w=k?o:0,x=v=>N[v];switch($){case"M":b&&(n={anchors:[{x:m+x(0),y:w+x(1)}],closed:!1},t.push(n),r=i=m+x(0),o=s=w+x(1),y=k?"l":"L"),a=u=void 0;break;case"L":d(m+x(0),w+x(1)),a=u=void 0;break;case"H":d(m+x(0),o),a=u=void 0;break;case"V":d(r,w+x(0)),a=u=void 0;break;case"C":{let v={x:m+x(2),y:w+x(3)};l({x:m+x(0),y:w+x(1)},v,m+x(4),w+x(5)),a=v,u=void 0;break}case"S":{let v=a?{x:2*r-a.x,y:2*o-a.y}:{x:r,y:o},S={x:m+x(0),y:w+x(1)};l(v,S,m+x(2),w+x(3)),a=S,u=void 0;break}case"Q":case"T":{let v=$==="Q"?{x:m+x(0),y:w+x(1)}:u?{x:2*r-u.x,y:2*o-u.y}:{x:r,y:o},S=$==="Q"?m+x(2):m+x(0),L=$==="Q"?w+x(3):w+x(1),U={x:r+2/3*(v.x-r),y:o+2/3*(v.y-o)},W={x:S+2/3*(v.x-S),y:L+2/3*(v.y-L)};l(U,W,S,L),u=v,a=void 0;break}case"A":{let v=m+x(5),S=w+x(6);for(let[L,U,W]of zn(r,o,x(0),x(1),x(2),x(3)!==0,x(4)!==0,v,S))l(L,U,W.x,W.y);(r!==v||o!==S)&&d(v,S),a=u=void 0;break}}b=!1}return{contours:Te(t)}}function Te(e){return e.map(t=>{let n=[...t.anchors];if(t.closed&&n.length>1){let r=n[0],o=n[n.length-1];fe(r,o)&&(n.pop(),n[0]={...r,...o.in?{in:o.in}:{}})}return{anchors:n.map(Wn),closed:t.closed}})}function Wn(e){let t={x:e.x,y:e.y};return e.in&&!fe(e.in,e)&&(t.in=e.in),e.out&&!fe(e.out,e)&&(t.out=e.out),t}function fe(e,t,n=1e-6){return Math.abs(e.x-t.x)<n&&Math.abs(e.y-t.y)<n}function Bn(e){let t=0,n=()=>{for(;t<e.length&&/[\s,]/.test(e[t]);)t+=1},r=()=>{n();let i=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/.exec(e.slice(t));if(i)return t+=i[0].length,Number(i[0])},o=()=>{n();let i=e[t];if(!(i!=="0"&&i!=="1"))return t+=1,Number(i)};return{more(){return n(),t<e.length},command(){n();let i=e[t];if(/[a-zA-Z]/.test(i))return t+=1,i},numbers(i){let s=[];for(let a=0;a<i;a+=1){let u=r();if(u===void 0)return;s.push(u)}return s},arc(){let i=this.numbers(3),s=o(),a=o(),u=this.numbers(2);if(!(!i||s===void 0||a===void 0||!u))return[...i,s,a,...u]},at(){return t}}}function zn(e,t,n,r,o,i,s,a,u){let c=Math.abs(n),f=Math.abs(r);if(c===0||f===0||e===a&&t===u)return[];let d=o*Math.PI/180,l=Math.cos(d),y=Math.sin(d),b=(e-a)/2,p=(t-u)/2,$=l*b+y*p,k=-y*b+l*p,g=$*$/(c*c)+k*k/(f*f);g>1&&(c*=Math.sqrt(g),f*=Math.sqrt(g));let N=c*c*f*f-c*c*k*k-f*f*$*$,m=c*c*k*k+f*f*$*$,w=(i===s?-1:1)*Math.sqrt(Math.max(0,N/m)),x=w*c*k/f,v=-w*f*$/c,S=l*x-y*v+(e+a)/2,L=y*x+l*v+(t+u)/2,U=(O,V,z,G)=>{let Z=O*z+V*G,ye=Math.hypot(O,V)*Math.hypot(z,G),Q=Math.acos(Math.min(1,Math.max(-1,Z/ye)));return O*G-V*z<0?-Q:Q},W=U(1,0,($-x)/c,(k-v)/f),B=U(($-x)/c,(k-v)/f,(-$-x)/c,(-k-v)/f);!s&&B>0&&(B-=2*Math.PI),s&&B<0&&(B+=2*Math.PI);let Je=Math.max(1,Math.ceil(Math.abs(B)/(Math.PI/2)-1e-9)),Xe=B/Je,he=4/3*Math.tan(Xe/4),Ft=O=>({x:S+c*Math.cos(O)*l-f*Math.sin(O)*y,y:L+c*Math.cos(O)*y+f*Math.sin(O)*l}),jt=O=>({x:-c*Math.sin(O)*l-f*Math.cos(O)*y,y:-c*Math.sin(O)*y+f*Math.cos(O)*l}),Ct=[];for(let O=0;O<Je;O+=1){let V=W+O*Xe,z=V+Xe,G=Ft(V),Z=O===Je-1?{x:a,y:u}:Ft(z),ye=jt(V),Q=jt(z);Ct.push([{x:G.x+he*ye.x,y:G.y+he*ye.y},{x:Z.x-he*Q.x,y:Z.y-he*Q.y},Z])}return Ct}function Ze(e){let t=[],n=r=>`${h(r.x)} ${h(r.y)}`;for(let r of e){let{anchors:o}=r,i=o[0];if(!i)continue;t.push(`M${n(i)}`);let s=Ne(r);for(let a=0;a<s;a+=1){let u=o[a],c=o[(a+1)%o.length],f=r.closed&&a===o.length-1;!u.out&&!c.in?f||t.push(`L${n(c)}`):t.push(`C${n(u.out??u)} ${n(c.in??c)} ${n(c)}`)}r.closed&&t.push("Z")}return t.join(" ")}function Ne(e){let t=e.anchors.length;return t<2?0:e.closed?t:t-1}function Qe(e,t){let n=e.anchors[t],r=e.anchors[(t+1)%e.anchors.length];return[{x:n.x,y:n.y},n.out??{x:n.x,y:n.y},r.in??{x:r.x,y:r.y},{x:r.x,y:r.y}]}function et(e,t){let[n,r,o,i]=e,s=1-t,a=s*s*s,u=3*s*s*t,c=3*s*t*t,f=t*t*t;return{x:a*n.x+u*r.x+c*o.x+f*i.x,y:a*n.y+u*r.y+c*o.y+f*i.y}}function tt(e,t){return e.map(n=>({closed:n.closed,anchors:n.anchors.map(r=>{let o=t(r);return{x:o.x,y:o.y,...r.in?{in:t(r.in)}:{},...r.out?{out:t(r.out)}:{}}})}))}function nt(e){let t=1/0,n=1/0,r=-1/0,o=-1/0,i=s=>{t=Math.min(t,s.x),n=Math.min(n,s.y),r=Math.max(r,s.x),o=Math.max(o,s.y)};for(let s of e){for(let u of s.anchors)i(u);let a=Ne(s);for(let u=0;u<a;u+=1){let c=Qe(s,u);for(let f of Gn(c))i(et(c,f))}}if(t!==1/0)return{x:t,y:n,w:r-t,h:o-n}}function Gn(e){let[t,n,r,o]=e,i=[];for(let s of["x","y"]){let a=-t[s]+3*n[s]-3*r[s]+o[s],u=2*(t[s]-2*n[s]+r[s]),c=n[s]-t[s];if(Math.abs(a)<1e-12){Math.abs(u)>1e-12&&i.push(-c/u);continue}let f=u*u-4*a*c;if(f<0)continue;let d=Math.sqrt(f);i.push((-u+d)/(2*a),(-u-d)/(2*a))}return i.filter(s=>s>0&&s<1)}function Ie(e){if(e===void 0)return;let t=e.trim().split(/[\s,]+/).map(Number);if(t.length!==4||t.some(s=>!Number.isFinite(s)))return;let[n,r,o,i]=t;return{x:n,y:r,w:o,h:i}}function rt(e,t,n){return Ie(e)??{x:0,y:0,w:t,h:n}}function ot(e,t){let n=e.w===0?1:t.w/e.w,r=e.h===0?1:t.h/e.h;return o=>({x:t.x+(o.x-e.x)*n,y:t.y+(o.y-e.y)*r})}function Gt(e,t=.5){let[n,r,o,i]=e;if(fe(n,r)&&fe(o,i))return[n,i];let a=Math.hypot(r.x-n.x,r.y-n.y)+Math.hypot(o.x-r.x,o.y-r.y)+Math.hypot(i.x-o.x,i.y-o.y),u=Math.min(256,Math.max(4,Math.ceil(Math.sqrt(a/t)))),c=[];for(let f=0;f<=u;f+=1)c.push(et(e,f/u));return c}function Jn(e,t,n){let r=0,o=0;for(let i of e){let s=Xn(i);if(s.length!==0){if(n.reach>0){let a=i.closed?s.length:s.length-1;for(let u=0;u<a;u+=1){let c=s[u],f=s[(u+1)%s.length];if(Yn(t,c,f)<=n.reach)return!0}if(s.length===1&&Math.hypot(t.x-s[0].x,t.y-s[0].y)<=n.reach)return!0}if(n.fill)for(let a=0;a<s.length;a+=1){let u=s[a],c=s[(a+1)%s.length];u.y<=t.y!=c.y<=t.y&&u.x+(t.y-u.y)/(c.y-u.y)*(c.x-u.x)>t.x&&(o+=1,r+=c.y>u.y?1:-1)}}}return n.fill?n.rule==="evenodd"?o%2===1:r!==0:!1}function Xn(e){let t=e.anchors[0];if(!t)return[];let n=[{x:t.x,y:t.y}],r=Ne(e);for(let o=0;o<r;o+=1)n.push(...Gt(Qe(e,o)).slice(1));return e.closed&&n.length>1&&n.pop(),n}function Yn(e,t,n){let r=n.x-t.x,o=n.y-t.y,i=r*r+o*o,s=i===0?0:Math.max(0,Math.min(1,((e.x-t.x)*r+(e.y-t.y)*o)/i));return Math.hypot(e.x-(t.x+s*r),e.y-(t.y+s*o))}var Ae={canvas:[["name","string"],["w","numberValue"],["h","numberValue"],["background","stringValue"]],frame:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["background","stringValue"],["clip","boolean"],["skip","boolean"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]],group:[["name","string"],["hidden","boolean"],["locked","boolean"]],ellipse:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["rotation","numberValue"],["fill","stringValue"],["stroke","stringValue"],["strokeWidth","numberValue"],["opacity","numberValue"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]],vector:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["rotation","numberValue"],["view","string"],["d","string"],["fill","stringValue"],["stroke","stringValue"],["strokeWidth","numberValue"],["opacity","numberValue"],["rule","fillRule"],["cap","lineCap"],["join","lineJoin"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]],rect:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["rotation","numberValue"],["fill","stringValue"],["stroke","stringValue"],["strokeWidth","numberValue"],["radius","numberValue"],["opacity","numberValue"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]],image:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["rotation","numberValue"],["src","stringValue"],["fit","imageFit"],["radius","numberValue"],["opacity","numberValue"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]],text:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["rotation","numberValue"],["font","stringValue"],["size","numberValue"],["weight","numberValue"],["lineHeight","numberValue"],["letterSpacing","numberValue"],["align","align"],["valign","valign"],["italic","boolean"],["fill","stringValue"],["opacity","numberValue"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]]},_e=[["font","string"],["size","number"],["weight","number"],["italic","boolean"],["underline","boolean"],["strike","boolean"],["fill","string"],["letterSpacing","number"],["link","string"]];var it=[["enter","pageEffect"],["duration","number"]],Pe=[["enter","nodeEffect"],["exit","nodeEffect"],["duration","number"],["delay","number"],["step","boolean"],["together","boolean"],["go","string"]],Yt=Object.keys(Ae);function Re(e){return Yt.includes(e)}function st(e,t){return Ae[e].find(([n])=>n===t)?.[1]}function I(e,t){if(t==="boolean")return e===""||e==="true"?{value:!0}:e==="false"?{value:!1}:{error:`Expected true or false, got ${e}`};if(e.startsWith('"')){let r=K(e);return r===void 0?{error:`Malformed quoted string ${e}`}:Jt(r,t,e)}if(tr(e)){if(!Zn(t))return{error:Qn(e,t)};let r=Kt(e).trim();return r===""?{error:"Empty expression"}:{value:ee(r)}}return t==="numberValue"&&Ht.test(e)?{value:ee(e)}:Jt(e,t,e)}var Ht=/^-?\d+(?:\.\d+)?%$/;function Zn(e){return e==="numberValue"||e==="stringValue"}function Qn(e,t){return t==="number"?`Expected a plain number, not an expression, got ${e}`:t==="string"&&/^\$\w+$/.test(e)?`Expected a literal, got ${e} \u2014 name a token without the $: ${e.slice(1)}`:`Expected a literal, not an expression, got ${e} \u2014 quote it if you meant the text`}function er(e,t){let n=/^(-?\d+(?:\.\d+)?)([A-Za-z]+)$/.exec(e);return n?n[2]==="s"&&t==="number"?` \u2014 durations are milliseconds: ${Number(n[1])*1e3}`:/^(?:px|pt|deg|ms)$/.test(n[2])?` \u2014 drop the unit: ${n[1]}`:" \u2014 units are not supported: use a number, a percentage like (100%), or an expression":t==="number"?Ht.test(e)?" \u2014 a percentage is not allowed here":"":/^-[$@(]/.test(e)?` \u2014 wrap an expression in parentheses: (${e})`:/^-?[A-Za-z_]\w*(?:\.\w+)+$/.test(e)?` \u2014 wrap an expression in parentheses: (${e})`:""}function Jt(e,t,n){switch(t){case"numberValue":case"number":{let r=Number(e);return Number.isFinite(r)&&e.trim()!==""?{value:r}:{error:`Expected a number, got ${n}${er(e,t)}`}}case"align":return te.includes(e)?{value:e}:{error:`Expected one of ${te.join(", ")}, got ${n}`};case"valign":return ne.includes(e)?{value:e}:{error:`Expected one of ${ne.join(", ")}, got ${n}`};case"fontStyle":return e==="normal"||e==="italic"?{value:e}:{error:`Expected normal or italic, got ${n}`};case"imageFit":return re.includes(e)?{value:e}:{error:`Expected one of ${re.join(", ")}, got ${n}`};case"fillRule":return H(ge,e,n);case"lineCap":return H(xe,e,n);case"lineJoin":return H($e,e,n);case"blendMode":return H(me,e,n);case"pageEffect":return H(Ee,e,n);case"nodeEffect":return H(Se,e,n);default:return{value:e}}}function H(e,t,n){return e.includes(t)?{value:t}:{error:`Expected one of ${e.join(", ")}, got ${n}`}}function tr(e){return/^[$@(]/.test(e)}function K(e){try{let t=JSON.parse(e);return typeof t=="string"?t:void 0}catch{return}}function Kt(e){if(!e.startsWith("("))return e;let t=0;for(let n=0;n<e.length;n+=1){let r=e[n];if(r==="(")t+=1;else if(r===")"&&(t-=1,t===0))return n===e.length-1?e.slice(1,-1):e}return e}function qt(e){let t=[],n="",r=0,o=!1;for(let i=0;i<e.length;i+=1){let s=e[i];if(o){n+=s,s==="\\"?(n+=e[i+1]??"",i+=1):s==='"'&&(o=!1);continue}if(s==='"'){o=!0,n+=s;continue}if(s==="("?r+=1:s===")"&&(r=Math.max(0,r-1)),r===0&&/\s/.test(s)){n!==""&&t.push(n),n="";continue}n+=s}return n!==""&&t.push(n),t}function ut(e,t,n){let r=n===void 0?void 0:A(n);if(r?.value===void 0||!Xt(e[t]??""))return;let o=t;for(;o<e.length&&Xt(e[o]??"");)o+=1;let i=[Kt(r.value),...e.slice(t,o)].join(" ");return{end:o,message:`${r.key}: an expression with spaces needs parentheses \u2014 write ${r.key}=(${i})`}}function Xt(e){return!e.includes("=")&&/^(?:[-+*/]|-?\d+(?:\.\d+)?%?|[$@][\w.]*|[A-Za-z_]\w*(?:\.\w+)+|\(.*|.*\))$/.test(e)}function A(e){let t=e.indexOf("=");return t===-1?{key:e,value:void 0}:{key:e.slice(0,t),value:e.slice(t+1)}}var or=new Set(["exit","delay","step","together","go"]);function at(e,t){let n=e.words[1];if(n===void 0||n.includes("=")){t(e.number,"invalid-motion","Expected motion <page>, e.g. motion intro enter=fade");return}let r={};for(let o of e.words.slice(2)){let{key:i,value:s}=A(o),a=it.find(([c])=>c===i)?.[1];if(a===void 0){let c=or.has(i)?` \u2014 ${i} goes on a node's line, under the header`:"";t(e.number,"invalid-motion",`motion ${n} has no "${i}"${c}`,n);continue}let u=I(s??"",a);"error"in u?t(e.number,"invalid-motion",`${i}: ${u.error}`,n):i==="duration"&&!Zt(u.value)?t(e.number,"invalid-motion",Qt(i,s),n):r[i]=u.value}return{page:n,number:e.number,head:r,lines:[],where:new Map,taken:new Map}}function ct(e,t,n){let r=t.words[0];if(t.indent!==1){n(t.number,"invalid-motion","A motion line sits one level under its page");return}if(r.includes("=")){n(t.number,"invalid-motion",`Expected a node id first, got ${r}`);return}if(r===e.page){n(t.number,"invalid-motion",`${r} is the page: its transition goes on the header (motion ${r} enter=fade)`,r);return}let o={id:r},i=!0;for(let a of t.words.slice(1)){let{key:u,value:c}=A(a),f=Pe.find(([l])=>l===u)?.[1];if(f===void 0){n(t.number,"invalid-motion",`A motion line has no "${u}"`,r),i=!1;continue}let d=I(c??"",f);"error"in d?(n(t.number,"invalid-motion",`${u}: ${d.error}`,r),i=!1):(u==="duration"||u==="delay")&&!Zt(d.value)?(n(t.number,"invalid-motion",Qt(u,c),r),i=!1):u==="go"&&Y(d.value)===void 0?(n(t.number,"invalid-motion",`go: expected #<page>, back, next, or an https: or mailto: link, got ${c??""}`,r),i=!1):d.value!==!1&&(o[u]=d.value)}if(o.enter!==void 0&&o.exit!==void 0&&(n(t.number,"invalid-motion",`${r} either enters or exits on one line \u2014 write a second line for the other`,r),i=!1),o.step===!0&&o.together===!0&&(n(t.number,"invalid-motion",`${r} waits for a step or starts together with the line above, not both`,r),i=!1),!i)return;let s=ir(o);if(!Oe(s)){n(t.number,"invalid-motion",`${r} says nothing: give it enter=, exit= or go=`,r);return}for(let a of["enter","exit","go"]){if(s[a]===void 0)continue;let u=e.taken.get(`${r} ${a}`);if(u!==void 0){let c=a==="go"?"has a go=":a==="enter"?"enters":"exits";n(t.number,"invalid-motion",`${r} already ${c} on line ${u}`,r);return}}for(let a of["enter","exit","go"])s[a]!==void 0&&e.taken.set(`${r} ${a}`,t.number);e.where.has(r)||e.where.set(r,t.number),e.lines.push(s)}function ft(e){let t={...e.head.enter===void 0?{}:{enter:e.head.enter},...e.head.duration===void 0?{}:{duration:e.head.duration},lines:e.lines};return ae(t)?void 0:t}function ir(e){let t={id:e.id};for(let[n]of Pe)e[n]!==void 0&&(t[n]=e[n]);return t}function Zt(e){return typeof e=="number"&&e>=0&&e<=ue}function Qt(e,t){return`${e}: expected 0 to ${ue} milliseconds, got ${t??""}`}function dt(e){return(t,n,r,o)=>{e.push({severity:"error",code:n,message:`Line ${t}: ${r}`,...o===void 0?{}:{nodeId:o}})}}function lt(e){let t=[],n=e.split(`
|