@getv.design/embed 0.5.1 → 0.5.5
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/auto.js +2 -2
- package/dist/chunks/{chunk-OQXGXTNC.js → chunk-2ZC4KNI4.js} +2 -2
- package/dist/chunks/{chunk-7K6NORUY.js → chunk-565P424V.js} +1 -1
- package/dist/chunks/{chunk-OMFQR6TE.js → chunk-5XTOQNJT.js} +6 -6
- package/dist/chunks/{chunk-VL77CJOG.js → chunk-JOUOURQK.js} +2 -2
- package/dist/chunks/{chunk-EFCLQF2H.js → chunk-NMTM7OEB.js} +2 -2
- package/dist/chunks/chunk-OJEQYRTB.js +2 -0
- package/dist/chunks/fonts.js +2 -2
- package/dist/cli.js +12 -12
- package/dist/edit.js +35 -33
- package/dist/index.js +2 -2
- package/dist/markdown-it.js +2 -2
- package/dist/markdown.js +2 -2
- package/dist/marked.js +2 -2
- package/dist/rehype.js +2 -2
- package/dist/static.js +2 -2
- package/dist/view.js +2 -2
- package/package.json +1 -1
- package/dist/chunks/chunk-OK6J2L2H.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.5.
|
|
39
|
+
import { view } from 'https://cdn.jsdelivr.net/npm/@getv.design/embed@0.5.5/dist/view.js';
|
|
40
40
|
|
|
41
41
|
const text = await (await fetch('/designs/home.vd')).text();
|
|
42
42
|
await view(document.querySelector('#design'), text);
|
|
@@ -230,7 +230,7 @@ has no `problems` or `fonts` event yet to say so.
|
|
|
230
230
|
### Where the faces come from
|
|
231
231
|
|
|
232
232
|
The faces come from `fontBase`, by default this package's `fonts/` folder on
|
|
233
|
-
jsDelivr (`https://cdn.jsdelivr.net/npm/@getv.design/embed@0.5.
|
|
233
|
+
jsDelivr (`https://cdn.jsdelivr.net/npm/@getv.design/embed@0.5.5/fonts/`). That means
|
|
234
234
|
your readers' browsers request the faces from jsDelivr, and a content security
|
|
235
235
|
policy needs it in `connect-src`. To keep those requests on your own origin,
|
|
236
236
|
copy `node_modules/@getv.design/embed/fonts/` to your site and point `fontBase` at it:
|
|
@@ -259,7 +259,7 @@ The embed's styles reach the page by one of two routes.
|
|
|
259
259
|
```
|
|
260
260
|
|
|
261
261
|
Link them before the embed runs, from your own origin or from the CDN
|
|
262
|
-
(`https://cdn.jsdelivr.net/npm/@getv.design/embed@0.5.
|
|
262
|
+
(`https://cdn.jsdelivr.net/npm/@getv.design/embed@0.5.5/view.css`). The id is what
|
|
263
263
|
the embed looks for: linked without it, the stylesheet still works, but
|
|
264
264
|
the embed inserts its `<style>` as well.
|
|
265
265
|
|
package/THIRD_PARTY_NOTICES.txt
CHANGED
package/dist/auto.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @getv.design/embed v0.5.
|
|
2
|
-
import"./chunks/chunk-
|
|
1
|
+
/*! @getv.design/embed v0.5.5. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
|
|
2
|
+
import"./chunks/chunk-565P424V.js";var f="data-vd-live";async function L(n=document,s={}){let e=[...n.querySelectorAll('figure.vd-figure[data-vd-mode="view"]')].filter(t=>!t.hasAttribute(f)&&t.dataset.vdSource);if(e.length===0)return[];for(let t of e)t.setAttribute(f,"opening");let{view:r}=await import("./view.js");return(await Promise.all(e.map(t=>w(t,r,s)))).filter(t=>t!==void 0)}async function w(n,s,e){let r;try{let d=atob(n.dataset.vdSource??"");r=new TextDecoder().decode(Uint8Array.from(d,u=>u.charCodeAt(0)))}catch{n.removeAttribute(f);return}let i=n.querySelector(".vd-figure-art"),t=n.ownerDocument.createElement("div");t.className="vd-figure-live",t.style.height=`${x(n,i)}px`,i?.after(t);let o=n.dataset.vdPage;try{let d=await s(t,r,{fit:"page",...o===void 0?{}:{page:/^\d+$/.test(o)?Number(o):o},...e.fonts?{fonts:e.fonts}:{},...e.fontBase?{fontBase:e.fontBase}:{},...e.surface?{surface:e.surface}:{},...e.onLink?{onLink:e.onLink}:{}});return i?.setAttribute("hidden",""),n.setAttribute(f,"true"),d.pages().length>1&&H(n,t,d,o),d}catch{t.remove(),n.removeAttribute(f);return}}function H(n,s,e,r){let i=(a,v,y)=>{let b=n.ownerDocument.createElement(a);return b.className=v,b.textContent=y,b},t=i("div","vd-figure-pager",""),o=i("button","vd-figure-pager__button","\u2039"),d=i("span","vd-figure-pager__label",""),u=i("button","vd-figure-pager__button","\u203A"),m=i("button","vd-figure-pager__button","Present");o.setAttribute("aria-label","Previous page"),u.setAttribute("aria-label","Next page"),d.setAttribute("aria-live","polite");for(let a of[o,u,m])a.setAttribute("type","button");t.append(o,d,u,m),s.after(t);let c=e.pages(),g=r===void 0?-1:/^\d+$/.test(r)?Number(r):c.findIndex(a=>a.id===r),l=g>=0&&g<c.length?g:0,p=()=>{let a=c[l];d.textContent=`${a?.name??a?.id??""} \xB7 ${l+1} of ${c.length}`},h=a=>{l=Math.min(c.length-1,Math.max(0,l+a)),e.goTo(l),p()};e.on("page",a=>{l=Math.max(0,c.findIndex(v=>v.id===a.id)),p()}),o.addEventListener("click",()=>h(-1)),u.addEventListener("click",()=>h(1)),m.addEventListener("click",()=>{e.play()}),p()}function x(n,s){let e=Number(n.dataset.vdHeight);if(Number.isFinite(e)&&e>0)return e;let r=s?.getBoundingClientRect().height??0;return r>0?Math.max(240,Math.round(r)):420}export{L as hydrate};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! @getv.design/embed v0.5.
|
|
2
|
-
import{a as m,b as w,d as g,e as O,f as P,g as S,h as y,i as p}from"./chunk-
|
|
1
|
+
/*! @getv.design/embed v0.5.5. Free to use under the vDesign Embed Licence. © 2026 vDesign. https://getv.design/docs/licence/ */
|
|
2
|
+
import{a as m,b as w,d as g,e as O,f as P,g as S,h as y,i as p}from"./chunk-NMTM7OEB.js";import{L as R,n as v}from"./chunk-5XTOQNJT.js";import{b as h}from"./chunk-OJEQYRTB.js";function E(e){return m(e)}async function L(e,n={}){let t=n.fonts??"approximate";if(!x.includes(t))throw new TypeError(`renderSvg: fonts must be one of ${x.join(", ")}; got ${String(t)}.`);let o=t==="exact"?y(n.fontBase,F()):void 0,{document:i,blocks:a,problems:s}=await O(e),r=n.page===void 0?i:D(i,n.page),u=B(a),f=n.idPrefix,d=[...s],c;if(t==="exact")if(o===void 0)d.push(p([],"no fontBase was given and this build has no default"));else{let{exactSvg:l}=await import("./fonts.js"),b=await l(r,{base:o,resolveAsset:u,...f?{idPrefix:f}:{}});"svg"in b?c=b.svg:d.push(p(b.failures))}return c??=R(r,{ids:!1,resolveAsset:u,...f?{idPrefix:f}:{}}),n.onProblems?.(d),c}function M(e){return typeof e=="string"?w(e).vd:void 0}function C(e){let{document:n,problems:t}=m(e),{document:o}=g(n),{vd:i,offset:a}=typeof e=="string"?w(e):{vd:void 0,offset:0},s=new Map;if(i!==void 0){let r=/^frame\s+(\S+)/;i.split(`
|
|
3
3
|
`).some((u,f)=>{if(u.startsWith("--- payload"))return!0;let d=r.exec(u)?.[1];return d!==void 0&&!s.has(d)&&s.set(d,f+1+a),!1})}return{...o.title===void 0?{}:{title:o.title},pages:P(o).map(r=>({id:r.id,...r.name===void 0?{}:{name:r.name},...s.has(r.id)?{line:s.get(r.id)}:{}})),problems:t}}async function W(e={}){let n=e.fonts??"approximate";if(!x.includes(n))throw new TypeError(`createRenderer: fonts must be one of ${x.join(", ")}; got ${String(n)}.`);let t,o="approximate",i,a;if(n==="exact")if(t=y(e.fontBase,F()),t===void 0)a=p([],"no fontBase was given and this build has no default");else{let s=await import("./fonts.js"),r=await s.exactFontsAt(t).ensureAll();i=s.exactSvgNow,o=r.length<s.BUNDLED_FACE_COUNT?"exact":"approximate",r.length>0&&(a=p(r))}return N({fonts:o,base:t,exactNow:i,failed:a})}function _(){return N({fonts:"approximate",base:void 0,exactNow:void 0,failed:void 0})}function N(e){let{fonts:n,base:t,exactNow:o,failed:i}=e;return{fonts:n,renderSvg(a,s={}){let r=typeof a=="string"?g(m(a).document):g(a),u=s.page===void 0?r.document:D(r.document,s.page),f=B(r.blocks),d=s.idPrefix,c=[...r.problems],l;return n==="exact"&&t!==void 0&&o!==void 0?(l=o(u,{base:t,resolveAsset:f,...d?{idPrefix:d}:{}}),l===void 0&&i&&c.push(i)):i&&c.push(i),l??=R(u,{ids:!1,resolveAsset:f,...d?{idPrefix:d}:{}}),s.onProblems?.(c),l}}}function B(e){return n=>{let t=e.get(n.hash);return t===void 0?void 0:v(n.type,t)}}var x=["approximate","exact"];function F(){let e=import.meta.url;if(typeof e!="string")return h;let t=typeof globalThis.process?.getBuiltinModule=="function",o=/\/dist\/chunks\/[^/]*$/.test(e)?"../../fonts/":"../fonts/";return e.startsWith("file:")&&t?new URL(o,e).href:h}function D(e,n){let t=S(e,n);return{...e,root:{...e.root,children:e.root.children.map(o=>o===t?o:{...o,hidden:!0})}}}export{E as a,L as b,M as c,C as d,W as e,_ as f};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @getv.design/embed v0.5.
|
|
1
|
+
/*! @getv.design/embed v0.5.5. Free to use under the vDesign Embed Licence. © 2026 vDesign. 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};
|