@514sid/signagekit 0.0.2 → 0.0.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/CHANGELOG.md +11 -0
- package/dist/chunks/{chart-WERjiRho.js → chart-Dk8Cjn4t.js} +2 -2
- package/dist/chunks/{lists-qOUpM5us.js → lists-Lp1TT3y5.js} +2 -2
- package/dist/chunks/{measures-D0av_G5P.js → measures-DlXV_PQC.js} +2 -2
- package/dist/chunks/{media-DI35kQ5D.js → media-DdNjnnhA.js} +3 -3
- package/dist/chunks/share-KNCRqMVQ.js +2 -0
- package/dist/chunks/{stat-DEE3meII.js → stat-DbgL2D35.js} +2 -2
- package/dist/cli.js +1 -1
- package/dist/index.js +3 -2
- package/dist/types/check.d.ts +22 -0
- package/dist/types/fit-memo.d.ts +6 -0
- package/dist/types/measure.d.ts +13 -0
- package/dist/types/table-fit.d.ts +16 -0
- package/dist/types/trend-fit.d.ts +2 -0
- package/docs/api.md +5 -3
- package/package.json +2 -1
- package/dist/chunks/share-D64VSp1B.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.3
|
|
4
|
+
|
|
5
|
+
- A screen is fitted once when it mounts, instead of twice. Mounting does about 65% fewer layouts across the examples.
|
|
6
|
+
- A data update refits only what changed. Text, stats, clocks, cycles and tables keep their size while their content and zone stay the same, so `update()` takes less than a third of the time it did on the examples.
|
|
7
|
+
- The same data text pushed again isn't parsed again.
|
|
8
|
+
- Fixed-width tables find their size in a few checks instead of shrinking 1 px at a time.
|
|
9
|
+
- A stacked zone keeps the density it mounted with, so a neighbour's text no longer changes size on the first update.
|
|
10
|
+
- Chart and QR screens fetch uPlot and uqr along with their component, one round trip sooner.
|
|
11
|
+
- The import map in the docs maps `yaml` to jsDelivr's bundled `+esm` build. The unbundled build loads about 70 modules one level at a time; YAML screens are ready about three times sooner with the bundled one.
|
|
12
|
+
- `bun run bench` measures mount, refit, update and load time in Chrome.
|
|
13
|
+
|
|
3
14
|
## 0.0.2
|
|
4
15
|
|
|
5
16
|
- Data values that match a built-in object key, like `state: constructor` or `trend: toString`, are treated as unknown instead of crashing the screen. The same goes for component types and area names.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=chart-
|
|
1
|
+
import{S as e,x as t}from"./share-KNCRqMVQ.js";import{n}from"./ready-Boq20M-G.js";import{t as r}from"./empty--6iNLsra.js";import{useLayoutEffect as i,useRef as a,useState as o}from"preact/hooks";import{jsx as s,jsxs as c}from"preact/jsx-runtime";var l,u=()=>l??(l=import(`uplot`).then(e=>e.default).catch(e=>{throw l=void 0,e}));function d(e){let t=typeof e==`number`?e:parseFloat(String(e).replace(/,/g,``));return Number.isFinite(t)?t:null}function f(n,r){let i=t(n.labels,r).map(t=>e(t,r));return{labels:i,series:n.series.map(n=>({name:e(n.name,r),values:i.map((e,i)=>d(t(n.values,r)[i]))})),target:n.target===void 0?null:d(e(n.target,r)),targetLabel:e(n.target_label,r)}}var p=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}),m=e=>e===null?``:Math.abs(e)>=1e4?p.format(e):e.toLocaleString(),h=e=>[...e].reverse().find(e=>e!==null)??null;function g(e,t){return getComputedStyle(e).getPropertyValue(t).trim()}function _(e,t){let n=parseInt(e.slice(1),16);return`rgba(${n>>16&255}, ${n>>8&255}, ${n&255}, ${t})`}function v(e,t){return{fontSize:Math.round(Math.max(16,Math.min(28,e.clientHeight/16))),muted:g(e,`--muted`),line:g(e,`--line`),text:g(e,`--text`),background:g(e,`--background`),colors:t.series.map((t,n)=>g(e,`--series-${n+1}`))}}function y(e,t,n){let r={stroke:t.muted,font:`500 ${t.fontSize}px system-ui, sans-serif`,grid:{stroke:t.line,width:1},ticks:{show:!1},gap:t.fontSize/2},i=Math.max(1,...e.labels.map(e=>e.length)),a=Math.max(1,Math.floor(n/(i*t.fontSize*.6+t.fontSize*1.2))),o=Math.ceil(e.labels.length/a);return[{...r,grid:{show:!1},splits:()=>e.labels.map((e,t)=>t).filter(e=>e%o===0),values:(t,n)=>n.map(t=>e.labels[t]??``),size:t.fontSize*2.2},{...r,values:(e,t)=>t.map(e=>m(e)),size:(e,n)=>Math.max(...(n??[``]).map(e=>e.length))*t.fontSize*.62+t.fontSize}]}function b(e,t,n,r){let i=t.kind===`column`;return[{},...n.series.map((n,a)=>({label:n.name,stroke:r.colors[a],width:i?0:3,fill:t.kind===`area`?_(r.colors[a],.12):i?r.colors[a]:void 0,points:{show:!1},paths:i?e.paths.bars({size:[.6,64],radius:[.15,0]}):void 0}))]}function x(e,t){return n=>{let r=n.bbox.width/n.width||1,{ctx:i}=n;i.save(),i.fillStyle=t.text,i.font=`700 ${Math.round(t.fontSize*r)}px system-ui, sans-serif`,i.textAlign=`center`,i.textBaseline=`bottom`,e.series[0].values.forEach((e,a)=>{if(e===null)return;let o=n.valToPos(a,`x`,!0),s=n.valToPos(e,`y`,!0);i.fillText(m(e),o,s-t.fontSize*.35*r)}),i.restore()}}function S(e,t){return n=>{if(e.target===null)return;let r=n.bbox.width/n.width||1,i=n.valToPos(e.target,`y`,!0),{ctx:a}=n;a.save(),a.strokeStyle=t.text,a.globalAlpha=.7,a.lineWidth=2*r,a.beginPath(),a.moveTo(n.bbox.left,i),a.lineTo(n.bbox.left+n.bbox.width,i),a.stroke(),a.globalAlpha=1;let o=Math.round(t.fontSize*.9*r);a.font=`600 ${o}px system-ui, sans-serif`;let s=e.targetLabel||`Target ${m(e.target)}`,c=o*.5,l=a.measureText(s).width+c*2,u=o*1.5,d=n.bbox.left+n.bbox.width,f=i-u-4*r>=n.bbox.top?i-u-4*r:i+4*r;a.fillStyle=t.text,a.beginPath(),a.roundRect?a.roundRect(d-l,f,l,u,u/4):a.rect(d-l,f,l,u),a.fill(),a.fillStyle=t.background,a.textAlign=`right`,a.textBaseline=`middle`,a.fillText(s,d-c,f+u/2),a.restore()}}function C(e,t){return(n,r,i)=>{let a=t.target,o=e.kind===`line`?r:0,s=i;a!==null&&(o=Math.min(o,a),s=Math.max(s,a));let c=(s-o||Math.abs(s)||1)*(e.kind===`column`?.18:.08);return[e.y_min??(e.kind===`line`?o-c:o),e.y_max??s+c]}}async function w(e,t,n,r){let i=await u(),a=e.clientWidth,o=e.clientHeight;if(r(`${a}x${o}`),!a||!o)return()=>{};let s=v(e,n),c=new i({width:a,height:o,padding:[s.fontSize,s.fontSize*2,0,0],cursor:{show:!1},legend:{show:!1},select:{show:!1,left:0,top:0,width:0,height:0},scales:{x:t.kind===`column`?{time:!1,range:(e,t,n)=>[t-.5,n+.5]}:{time:!1},y:{range:C(t,n)}},axes:y(n,s,a),series:b(i,t,n,s),hooks:{draw:[...t.kind===`column`?[x(n,s)]:[],S(n,s)]}},[n.labels.map((e,t)=>t),...n.series.map(e=>e.values)],e);return()=>c.destroy()}function T({c:e,data:t}){let l=a(null),u=f(e,t),d=JSON.stringify([e,u]),[p,g]=o(``),_=a(``);i(()=>{let t=l.current;if(!t)return;let r,i=!1,a=w(t,e,u,e=>_.current=e).then(e=>{i?e():r=e}).catch(e=>console.error(`signagekit: chart failed`,e));return n(a),()=>{i=!0,r?.()}},[d,p]);let v=!u.labels.length||u.series.every(e=>e.values.every(e=>e===null));return i(()=>{let e=l.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>{let t=`${e.clientWidth}x${e.clientHeight}`;t!==_.current&&g(t)});return t.observe(e),()=>t.disconnect()},[v]),v?/* @__PURE__ */ s(r,{text:`No data`}):/* @__PURE__ */ c(`div`,{class:`c-chart`,children:[u.series.length>1&&/* @__PURE__ */ s(`div`,{class:`c-chart-legend`,children:u.series.map((e,t)=>/* @__PURE__ */ c(`span`,{class:`c-chart-key`,children:[/* @__PURE__ */ s(`span`,{class:`c-chart-swatch`,style:{background:`var(--series-${t+1})`}}),e.name,/* @__PURE__ */ s(`strong`,{children:m(h(e.values))})]},t))}),/* @__PURE__ */ s(`div`,{class:`c-chart-plot`,ref:l})]})}export{T as Chart};
|
|
2
|
+
//# sourceMappingURL=chart-Dk8Cjn4t.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=lists-
|
|
1
|
+
import{S as e,x as t}from"./share-KNCRqMVQ.js";import{t as n}from"./empty--6iNLsra.js";import{o as r,r as i}from"./stat-DbgL2D35.js";import{c as a,n as o,o as s,r as c,s as l}from"./time-KYYBrpD9.js";import{jsx as u,jsxs as d}from"preact/jsx-runtime";function f({c:a,data:o}){let s=t(a.items,o).filter(t=>t&&e(t.label,o));return s.length?/* @__PURE__ */ u(`ul`,{class:`c-status`,"data-fit":`wrap`,"data-kind":`status`,children:s.map((t,n)=>{let a=t??{},s=r(a.state,o);return/* @__PURE__ */ d(`li`,{children:[s===`neutral`?/* @__PURE__ */ u(`span`,{class:`c-status-dot`}):/* @__PURE__ */ u(i,{state:s}),/* @__PURE__ */ u(`span`,{class:`c-status-label`,children:e(a.label,o)}),/* @__PURE__ */ u(`span`,{class:`c-status-note`,children:e(a.note,o)})]},n)})}):/* @__PURE__ */ u(n,{})}var p=/^(\d{1,2}):(\d{2})$/;function m(e){let t=p.exec(e.trim());if(t)return{kind:`day`,at:Number(t[1])*60+Number(t[2])};let n=Date.parse(e);return Number.isNaN(n)?null:{kind:`abs`,at:n}}function h(t,n,r,i,a={}){let o={day:s(r,a),abs:r.getTime()},c={day:60,abs:36e5},l=t.map(e=>e??{}).map(t=>({r:t,start:m(e(t.start,n))})).filter(e=>e.start!==null).sort((e,t)=>e.start.at-t.start.at),u=l.filter(t=>{let r=t.start;return(m(e(t.r.end,n))?.at??l.find(e=>e.start.kind===r.kind&&e.start.at>r.at)?.start.at??r.at+c[r.kind])>o[r.kind]}),d=!1;return u.slice(0,i).map(t=>{let r=t.start.at<=o[t.start.kind],i=r?`now`:d?``:`next`;return r||(d=!0),{start:e(t.r.start,n),title:e(t.r.title,n),detail:e(t.r.detail,n),tag:i}})}function g(e,t){if(p.test(e.trim()))return e.trim();let n=Date.parse(e);return Number.isNaN(n)?e:o(new Date(n),void 0,t)}function _({c:e,data:n}){let r=l(),i=a(),o=h(t(e.items,n),n,r,e.rows??5,i);return/* @__PURE__ */ d(`ol`,{class:`c-schedule`,"data-fit":`wrap`,"data-kind":`schedule`,children:[o.length===0&&/* @__PURE__ */ u(`li`,{class:`c-schedule-empty`,children:`Nothing more today`}),o.map((e,t)=>{let n=e.tag;return/* @__PURE__ */ d(`li`,{class:n?`is-${n}`:``,children:[/* @__PURE__ */ u(`span`,{class:`c-schedule-time`,children:g(e.start,i)}),/* @__PURE__ */ d(`span`,{class:`c-schedule-what`,children:[/* @__PURE__ */ u(`span`,{class:`c-schedule-title`,children:e.title}),e.detail&&/* @__PURE__ */ u(`span`,{class:`c-schedule-detail`,children:e.detail})]}),n&&/* @__PURE__ */ u(`span`,{class:`c-schedule-tag`,children:n===`now`?`Now`:`Next`})]},t)})]})}function v({c:n,data:r}){let i=n.recent?t(n.recent,r):[];return/* @__PURE__ */ d(`div`,{class:`c-queue`,"data-fit":`wrap`,"data-kind":`queue`,children:[/* @__PURE__ */ u(`div`,{class:`c-stat-label`,children:e(n.label,r)||`Now serving`}),/* @__PURE__ */ u(`div`,{class:`c-queue-current`,children:e(n.current,r)||`—`}),i.length>0&&/* @__PURE__ */ u(`div`,{class:`c-queue-recent`,children:i.slice(0,6).map((t,n)=>/* @__PURE__ */ u(`span`,{children:e(t,r)},n))})]})}function y({c:t,data:n}){let r=l(),i=a();return/* @__PURE__ */ u(`ul`,{class:`c-clocks`,"data-fit":`wrap`,"data-kind":`clocks`,children:t.zones.map((a,o)=>/* @__PURE__ */ d(`li`,{children:[/* @__PURE__ */ u(`span`,{class:`c-clocks-label`,children:e(a.label,n)}),/* @__PURE__ */ u(`span`,{class:`c-clocks-time`,children:c(r,a.timezone??a.zone??`UTC`,t.hour12,i)})]},o))})}export{y as ClocksView,v as QueueView,_ as ScheduleView,f as StatusView};
|
|
2
|
+
//# sourceMappingURL=lists-Lp1TT3y5.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=measures-
|
|
1
|
+
import{S as e,x as t}from"./share-KNCRqMVQ.js";import{t as n}from"./empty--6iNLsra.js";import{a as r,i,o as a,r as o,s,t as c}from"./stat-DbgL2D35.js";import{jsx as l,jsxs as u}from"preact/jsx-runtime";var d=e=>{let t=parseFloat(e.replace(/,/g,``));return Number.isFinite(t)?t:0},f=(e,t)=>t>0?Math.min(1,Math.max(0,e/t)):0,p=e=>`${Math.round(e*1e3)/10}%`;function m(n,r){return t(n,r).map(t=>{let n=t??{},o=e(n.value,r);return{label:e(n.label,r),value:d(o),shown:i(o),max:n.max===void 0?null:d(e(n.max,r)),state:a(n.state,r)}})}function h({value:e,state:t}){return/* @__PURE__ */ l(`div`,{class:`c-bar fill-${t}`,children:/* @__PURE__ */ l(`div`,{class:`c-bar-fill`,style:{width:p(e)}})})}function g({state:e,label:t}){let n=t||c[e]||``;return n?/* @__PURE__ */ u(`div`,{class:`c-stat-label`,children:[e!==`neutral`&&/* @__PURE__ */ l(o,{state:e}),n]}):null}function _({c:t,data:n}){let a=e(t.value,n),o=e(t.max??100,n),s=e(t.unit,n),c=r(t,n);return/* @__PURE__ */ u(`div`,{class:`c-meter`,"data-fit":`wrap`,"data-kind":`meter`,children:[/* @__PURE__ */ u(`div`,{class:`c-meter-figure`,children:[i(a)||`—`,/* @__PURE__ */ u(`span`,{class:`c-meter-of`,children:[` / `,i(o),s&&` ${s}`]})]}),/* @__PURE__ */ l(h,{value:f(d(a),d(o)),state:c}),/* @__PURE__ */ l(g,{state:c,label:e(t.label,n)})]})}function v({c:t,data:r}){let a=e(t.unit,r),c=d(e(t.max??100,r)),p=m(t.items,r).filter(e=>e.label||e.shown).map(e=>e.state===`neutral`&&e.shown?{...e,state:s(e.value,t.thresholds)}:e);return p.length?/* @__PURE__ */ l(`div`,{class:`c-meters`,"data-fit":`wrap`,"data-kind":`meters`,children:p.map((e,t)=>/* @__PURE__ */ u(`div`,{class:`c-meters-row`,children:[/* @__PURE__ */ u(`div`,{class:`c-meters-head`,children:[/* @__PURE__ */ u(`span`,{class:`c-meters-label`,children:[e.state!==`neutral`&&/* @__PURE__ */ l(o,{state:e.state}),e.label]}),/* @__PURE__ */ u(`span`,{class:`c-meters-value`,children:[e.shown||`—`,/* @__PURE__ */ u(`span`,{class:`c-meter-of`,children:[` / `,i(String(e.max??c)),a&&` ${a}`]})]})]}),/* @__PURE__ */ l(h,{value:f(e.value,e.max??c),state:e.state})]},t))}):/* @__PURE__ */ l(n,{})}function y({c:t,data:r}){let i=e(t.unit,r),a=m(t.items,r).filter(e=>e.label||e.shown).sort((e,t)=>t.value-e.value).slice(0,t.limit??12);if(!a.length)return/* @__PURE__ */ l(n,{});let o=Math.max(0,...a.map(e=>e.value));return/* @__PURE__ */ l(`div`,{class:`c-bars`,"data-fit":`wrap`,"data-kind":`bars`,children:a.map((e,t)=>/* @__PURE__ */ u(`div`,{class:`c-bars-row`,children:[/* @__PURE__ */ l(`span`,{class:`c-bars-label`,children:e.label}),/* @__PURE__ */ l(`div`,{class:`c-bars-track`,children:/* @__PURE__ */ l(`div`,{class:`c-bars-fill`,style:{width:p(f(e.value,o))}})}),/* @__PURE__ */ u(`span`,{class:`c-bars-value`,children:[e.shown,i&&/* @__PURE__ */ u(`span`,{class:`c-meter-of`,children:[` `,i]})]})]},t))})}function b({c:e,data:t}){let r=m(e.items,t).slice(0,6),i=r.reduce((e,t)=>e+Math.max(0,t.value),0);return i<=0?/* @__PURE__ */ l(n,{}):/* @__PURE__ */ u(`div`,{class:`c-split`,"data-fit":`wrap`,"data-kind":`split`,children:[/* @__PURE__ */ l(`div`,{class:`c-split-bar`,children:r.map((e,t)=>{let n=f(e.value,i);return n===0?null:/* @__PURE__ */ l(`div`,{class:`c-split-part`,style:{flexGrow:n,background:`var(--series-${t+1})`,color:`var(--on-series-${t+1})`},children:n>=.08?p(n):``},t)})}),/* @__PURE__ */ l(`div`,{class:`c-split-legend`,children:r.map((e,t)=>/* @__PURE__ */ u(`span`,{class:`c-chart-key`,children:[/* @__PURE__ */ l(`span`,{class:`c-chart-swatch`,style:{background:`var(--series-${t+1})`}}),e.label,/* @__PURE__ */ l(`strong`,{children:p(f(e.value,i))})]},t))})]})}export{y as BarsView,_ as MeterView,v as MetersView,b as SplitView};
|
|
2
|
+
//# sourceMappingURL=measures-DlXV_PQC.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{
|
|
2
|
-
`),[f,p]=c(0),m=u.length?f%u.length:0;if(a(()=>{if(u.length<2)return;let e=setInterval(()=>p(e=>e+1),(r.seconds??10)*1e3);return()=>clearInterval(e)},[d,r.seconds]),a(()=>{if(u.length<2)return;let e=new Image;e.decoding=`async`,e.src=u[(m+1)%u.length]},[d,m]),!u.length)return/* @__PURE__ */ l(n,{text:o.length?`Images not available`:`No images`});let h=u[m];return/* @__PURE__ */ l(`img`,{class:`c-image`,src:h,alt:``,decoding:`async`,onError:()=>s(e=>e.includes(h)?e:[...e,h]),style:{objectFit:r.fit??`cover`}})}var f,p=()=>f??(f=import(`uqr`).then(e=>e.encode).catch(e=>{throw f=void 0,e}));function m(e){let t=``;return e.forEach((e,n)=>e.forEach((e,r)=>{e&&(t+=`M${r} ${n}h1v1h-1z`)})),t}function h({c:
|
|
3
|
-
//# sourceMappingURL=media-
|
|
1
|
+
import{S as e,x as t}from"./share-KNCRqMVQ.js";import{t as n}from"./empty--6iNLsra.js";import{t as r}from"./qr-size-Dq23do6_.js";import{n as i}from"./ready-Boq20M-G.js";import{useEffect as a,useLayoutEffect as o,useRef as s,useState as c}from"preact/hooks";import{jsx as l,jsxs as u}from"preact/jsx-runtime";function d({c:r,data:i}){let[o,s]=c([]),u=t(r.images,i).map(t=>e(t,i)).filter(e=>e&&!o.includes(e)),d=u.join(`
|
|
2
|
+
`),[f,p]=c(0),m=u.length?f%u.length:0;if(a(()=>{if(u.length<2)return;let e=setInterval(()=>p(e=>e+1),(r.seconds??10)*1e3);return()=>clearInterval(e)},[d,r.seconds]),a(()=>{if(u.length<2)return;let e=new Image;e.decoding=`async`,e.src=u[(m+1)%u.length]},[d,m]),!u.length)return/* @__PURE__ */ l(n,{text:o.length?`Images not available`:`No images`});let h=u[m];return/* @__PURE__ */ l(`img`,{class:`c-image`,src:h,alt:``,decoding:`async`,onError:()=>s(e=>e.includes(h)?e:[...e,h]),style:{objectFit:r.fit??`cover`}})}var f,p=()=>f??(f=import(`uqr`).then(e=>e.encode).catch(e=>{throw f=void 0,e}));function m(e){let t=``;return e.forEach((e,n)=>e.forEach((e,r)=>{e&&(t+=`M${r} ${n}h1v1h-1z`)})),t}function h({c:t,data:a}){let d=e(t.value,a),f=e(t.label,a),[h,g]=c(null);o(()=>{if(!d)return;let e=!1,t=p().then(t=>{let n=t(d,{ecc:`M`,border:4});e||g({size:n.size,d:m(n.data)})}).catch(e=>console.error(`signagekit: QR code failed`,e));return i(t),()=>{e=!0}},[d]);let _=s(null);return o(()=>{_.current?.parentElement&&r(_.current.parentElement)},[h]),d?/* @__PURE__ */ u(`div`,{class:`c-qr`,ref:_,children:[h&&/* @__PURE__ */ u(`svg`,{class:`c-qr-code`,viewBox:`0 0 ${h.size} ${h.size}`,"shape-rendering":`crispEdges`,role:`img`,"aria-label":f||`QR code`,children:[/* @__PURE__ */ l(`rect`,{width:h.size,height:h.size,fill:`#ffffff`}),/* @__PURE__ */ l(`path`,{d:h.d,fill:`#000000`})]}),f&&/* @__PURE__ */ l(`div`,{class:`c-qr-label`,children:f})]}):/* @__PURE__ */ l(n,{text:`No link`})}export{h as QrView,d as SlideshowView};
|
|
3
|
+
//# sourceMappingURL=media-DdNjnnhA.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function e(e,t){let n=e;for(let e of t.split(`/`))if(e!==``){if(typeof n!=`object`||!n)return;n=n[e]}return n}function t(e){return typeof e==`object`&&!!e&&typeof e.bind==`string`}function n(n,r){let i=t(n)?e(r,n.bind):n,a=i==null||typeof i==`object`?``:String(i);return a===``&&t(n)&&n.fallback!==void 0?String(n.fallback):a}function r(n,r){let i=t(n)?e(r,n.bind):n;return Array.isArray(i)?i:[]}function i(n,r,a,o){if(t(n))e(a,n.bind)===void 0&&n.fallback===void 0&&o.push(`${r}: ${n.bind} is not in the data, shown as empty`);else if(Array.isArray(n))n.forEach((e,t)=>i(e,`${r}[${t}]`,a,o));else if(n&&typeof n==`object`)for(let[e,t]of Object.entries(n))i(t,r?`${r}.${e}`:e,a,o)}function a(e,t){let n=[];return i(e.zones,`zones`,t,n),e.alert&&i(e.alert,`alert`,t,n),n}var o=[`background`,`surface`,`text`,`muted`,`line`,`accent`,`on_accent`,`good`,`warning`,`danger`],s={dark:{background:`#0b0f17`,surface:`#161c27`,text:`#f1f5f9`,muted:`#a3adbb`,line:`#2a3443`,good:`#22c55e`,warning:`#fab219`,danger:`#ef4444`},light:{background:`#eef0f3`,surface:`#ffffff`,text:`#111827`,muted:`#4b5563`,line:`#dde1e7`,good:`#16a34a`,warning:`#f59e0b`,danger:`#dc2626`}},c={dark:[`#3987e5`,`#d95926`,`#199e70`,`#c98500`,`#d55181`,`#008300`,`#9085e9`,`#e66767`],light:[`#2a78d6`,`#eb6834`,`#1baf7a`,`#eda100`,`#e87ba4`,`#008300`,`#6250d6`,`#e34948`]},l=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i;function u(e){let t=e.slice(1);t.length===3&&(t=t.replace(/./g,e=>e+e));let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}function d(e){let[t,n,r]=u(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function f(e,t){let[n,r]=[d(e),d(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}function ee(e){let t=s.light.text,n=s.dark.text;return f(e,t)>=f(e,n)?t:n}function p(e,t,n){let r=s[e?.scheme??t],i=e?.accent??n;return{...r,accent:i,on_accent:ee(i),...te(e)}}function te(e){if(!e)return{};let t={};for(let n of o)e[n]&&(t[n]=e[n]);return t}var ne=[[`text`,`background`],[`text`,`surface`],[`muted`,`background`],[`muted`,`surface`],[`on_accent`,`accent`]],m=[`good`,`warning`,`danger`];function h(e){return f(e,`#ffffff`)>=f(e,`#0b0f17`)?`#ffffff`:`#0b0f17`}function re(e){let t=(t,n)=>t.flatMap(([t,r])=>{let i=f(e[t],e[r]);return i<n?[`colors: ${t} ${e[t]} on ${r} ${e[r]} has contrast ${i.toFixed(1)}:1, needs at least ${n}:1`]:[]}),n=m.flatMap(t=>{let n=f(h(e[t]),e[t]);return n<3?[`colors: ${t} ${e[t]} leaves its icon at ${n.toFixed(1)}:1, needs at least 3:1`]:[]});return[...t(ne,4.5),...n]}function ie(e,t=document.documentElement){for(let n of o)t.style.setProperty(`--${n.replace(`_`,`-`)}`,e[n]);let n=d(e.background)>.4?`light`:`dark`;for(let n of m)t.style.setProperty(`--on-${n}`,h(e[n]));c[n].forEach((e,n)=>{t.style.setProperty(`--series-${n+1}`,e),t.style.setProperty(`--on-series-${n+1}`,h(e))})}async function ae(e,t){let n=e.trim(),r;try{return{value:JSON.parse(n)}}catch(e){r=e.message}try{let{parse:e}=await import(`yaml`);return{value:e(n,{schema:t===`data`?`failsafe`:`core`,maxAliasCount:50,prettyErrors:!0})}}catch(e){return{value:null,error:n.startsWith(`{`)||n.startsWith(`[`)?`not valid JSON: ${r}`:`not valid YAML: ${e.message}`}}}var oe=1,se={},ce=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function g(e){let t=e.version??1;return typeof t==`number`&&Number.isInteger(t)&&t>=1?t:null}async function le(e,t=se,n=1){if(!ce(e))return{doc:e,notes:[]};let r=g(e);if(r===null||r>=n)return{doc:e,notes:[]};let i=e,a=[];for(let e=r;e<n;e++){let n=t[e];if(!n)return a.push(`version: no upgrade from ${e} to ${e+1}, shown as is`),{doc:i,notes:a};let r=(await n()).default(i);i={...r.doc,version:e+1},a.push(...r.notes.map(t=>`version ${e} to ${e+1}: ${t}`))}return{doc:i,notes:a}}var _=e=>typeof e==`object`&&!!e&&!Array.isArray(e),ue=/^(\d+(\.\d+)?(px|fr|%)|auto|min-content|max-content)$/,v=/^[a-z][a-z0-9_-]*$/;function y(e,t,n,r){if(e===void 0)return;if(typeof e!=`string`)return void r.push(`${t}: expected a string like "2fr 1fr"`);let i=e.trim().split(/\s+/),a=i.find(e=>!ue.test(e));if(a)return void r.push(`${t}: ${JSON.stringify(a)} is not a track size, use px, fr, % or auto`);i.length!==n&&r.push(`${t}: has ${i.length} sizes, the areas have ${n}`)}function de(e,t){let n=/* @__PURE__ */ new Set;for(let r of new Set(e.flat())){if(r===`.`||n.has(r))continue;n.add(r);let i=1/0,a=-1,o=1/0,s=-1,c=0;e.forEach((e,t)=>e.forEach((e,n)=>{e===r&&(c++,i=Math.min(i,t),a=Math.max(a,t),o=Math.min(o,n),s=Math.max(s,n))})),c!==(a-i+1)*(s-o+1)&&t.push(`layout.areas: area "${r}" is not a rectangle`)}}function b(e,t){e.gap!==void 0&&(typeof e.gap!=`number`||e.gap<0||e.gap>200)&&t.push(`layout.gap: expected a number of pixels from 0 to 200`)}function fe(e,t){return _(e)?`flow`in e&&`areas`in e?(t.push(`layout: use "flow" or "areas", not both`),[]):`flow`in e?ge(e,t):_e(e,t):(t.push(`layout: expected an object with "flow" or "areas"`),[])}var pe=/^\d+(\.\d+)?px$/,me=[`zone`,`span`,`height`];function he(e,t,n){if(typeof e==`string`)return v.test(e)?e:(n.push(`${t}: "${e}" is not a valid zone name`),null);if(!_(e)||typeof e.zone!=`string`||!v.test(e.zone))return n.push(`${t}: expected a zone name or {"zone": "name", "span": 6}`),null;let{span:r,height:i}=e;r!==void 0&&!(Number.isInteger(r)&&r>=1&&r<=12)&&n.push(`${t}.span: expected a whole number of columns from 1 to 12`),i!==void 0&&!(typeof i==`number`&&i>0&&i<=100)&&!(typeof i==`string`&&pe.test(i))&&n.push(`${t}.height: expected a share like 2, or pixels like "150px"`);for(let r of Object.keys(e))me.includes(r)||n.push(`${t}.${r}: unknown property, expected zone, span or height`);return e.zone}function ge(e,t){if(!Array.isArray(e.flow)||e.flow.length===0)return t.push(`layout.flow: expected a non-empty list of zones`),[];e.design!==void 0&&e.design!==`landscape`&&e.design!==`portrait`&&t.push(`layout.design: expected "landscape" or "portrait"`);for(let n of Object.keys(e))[`flow`,`design`,`gap`].includes(n)||t.push(`layout.${n}: not used with "flow", expected flow, design or gap`);b(e,t);let n=[];return e.flow.forEach((e,r)=>{let i=he(e,`layout.flow[${r}]`,t);i&&(n.includes(i)&&t.push(`layout.flow[${r}]: zone "${i}" is already in the flow`),n.push(i))}),n}function _e(e,t){if(!Array.isArray(e.areas)||e.areas.length===0||e.areas.some(e=>typeof e!=`string`))return t.push(`layout.areas: expected a non-empty array of strings like "head head"`),[];let n=e.areas.map(e=>e.trim().split(/\s+/)),r=n[0].length;return n.forEach((e,n)=>{e.length!==r&&t.push(`layout.areas[${n}]: has ${e.length} names, the first row has ${r}`),e.forEach(e=>{e!==`.`&&!v.test(e)&&t.push(`layout.areas[${n}]: "${e}" is not a valid name, use lowercase letters, digits, - and _`)})}),t.length?[]:(de(n,t),y(e.columns,`layout.columns`,r,t),y(e.rows,`layout.rows`,n.length,t),b(e,t),[...new Set(n.flat())].filter(e=>e!==`.`))}var x=/* @__PURE__ */ `info.check.warning.danger.fire.evacuate.assembly.medical.first-aid.storm.wind.snow.flood.heat.lockdown.shelter.security.power.water.network.closed.delay.maintenance.announcement.phone.biohazard.radiation.chemical.event.location.accessibility`.split(`.`),S=e=>typeof e==`string`&&x.includes(e),C=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),w=e=>typeof e==`object`&&!!e&&!Array.isArray(e),T=e=>w(e)&&typeof e.bind==`string`&&e.bind.startsWith(`/`),E=(e,t,n)=>{if(typeof e==`string`||typeof e==`number`)return;if(!T(e))return void n.push(`${t}: expected a string, a number or {"bind": "/path"}`);let{fallback:r}=e;r!==void 0&&typeof r!=`string`&&typeof r!=`number`&&n.push(`${t}.fallback: expected a string or a number`);for(let r of Object.keys(e))r!==`bind`&&r!==`fallback`&&n.push(`${t}.${r}: unknown property, a bind takes bind and fallback`)},D=(...e)=>(t,n,r)=>{e.includes(t)||r.push(`${n}: expected one of ${e.map(e=>JSON.stringify(e)).join(`, `)}`)},O=(e,t,n)=>{typeof e!=`boolean`&&n.push(`${t}: expected true or false`)},ve=(e,t,n)=>{typeof e!=`string`&&n.push(`${t}: expected a string`)},k=(e,t,n)=>{typeof e==`number`&&e>=3&&e<=3600||n.push(`${t}: expected a number of seconds from 3 to 3600`)},A=e=>(t,n,r,i)=>{if(!T(t)){if(!Array.isArray(t))return void r.push(`${n}: expected an array or {"bind": "/path"}`);t.forEach((t,a)=>e(t,`${n}[${a}]`,r,i))}},ye=(e,t,n)=>{(!Array.isArray(e)||e.some(e=>typeof e!=`string`))&&n.push(`${t}: expected an array of strings`)},be=(e,t,n)=>{if(!Array.isArray(e)||e.length<1||e.length>8)return void n.push(`${t}: expected 1 to 8 series`);e.forEach((e,r)=>{if(!w(e)||!(`name`in e)||!(`values`in e))return void n.push(`${t}[${r}]: expected {"name": ..., "values": [...]}`);E(e.name,`${t}[${r}].name`,n),A(E)(e.values,`${t}[${r}].values`,n)})},j=(e,t,n)=>T(e)?void 0:D(`neutral`,`good`,`warning`,`danger`)(e,t,n),M=D(`start`,`center`,`end`),xe=D(`base`,`raised`,`accent`),N=(e,t)=>(n,r,i)=>{Number.isInteger(n)&&n>=e&&n<=t||i.push(`${r}: expected a whole number from ${e} to ${t}`)},P=(e,t={})=>(n,r,i,a)=>{if(w(n)){for(let[t,o]of Object.entries(e))C(n,t)?o(n[t],`${r}.${t}`,i,a):i.push(`${r}.${t}: required`);for(let[o,s]of Object.entries(n))C(e,o)||(C(t,o)?t[o](s,`${r}.${o}`,i,a):(a??i).push(`${r}.${o}: unknown property, ignored`))}else{let t=Object.keys(e).join(`, `);i.push(`${r}: expected an object with ${t}`)}},F=P({label:E,value:E},{max:E,state:j}),I=(e,t)=>(n,r,i,a)=>{if(Array.isArray(n)&&n.length>t)return void i.push(`${r}: at most ${t} items`);A(e)(n,r,i,a)},L=(e,t,n)=>Se(e,t,n),Se=(e,t,n)=>{try{if(typeof e!=`string`)throw Error();new Intl.DateTimeFormat(void 0,{timeZone:e})}catch{n.push(`${t}: expected a time zone like "Europe/London"`)}},R=(e,t)=>(n,r,i)=>{typeof n==`number`&&n>=e&&n<=t||i.push(`${r}: expected a number from ${e} to ${t}`)},z=(e,t,n)=>{typeof e==`number`&&Number.isFinite(e)||n.push(`${t}: expected a number`)},B=P({},{warning:z,danger:z}),V=z,H={heading:{required:{text:E},optional:{align:M}},text:{required:{text:E},optional:{size:D(`s`,`m`,`l`,`xl`),align:M,fit:O}},stat:{required:{value:E},optional:{label:E,unit:E,state:j,trend:(e,t,n)=>T(e)?void 0:D(`up`,`down`,`flat`)(e,t,n),delta:E,good_when:D(`up`,`down`),format:D(`compact`,`full`),match_row:O,thresholds:B,spark:A(E)}},table:{required:{columns:ye,rows:A(A(E))},optional:{align:(e,t,n)=>Array.isArray(e)?e.forEach((e,r)=>M(e,`${t}[${r}]`,n)):n.push(`${t}: expected an array`),page_rows:N(1,100),widths:(e,t,n)=>{(!Array.isArray(e)||e.some(e=>typeof e!=`number`||!(e>0)))&&n.push(`${t}: expected positive numbers, like [3, 1, 1]`)},seconds:k}},list:{required:{items:A(E)},optional:{}},image:{required:{src:E},optional:{fit:D(`cover`,`contain`),alt:ve}},clock:{required:{},optional:{hour12:O,show_date:O}},countdown:{required:{to:E},optional:{label:E,done:E}},chart:{required:{kind:D(`line`,`area`,`column`),labels:A(E),series:be},optional:{target:E,target_label:E,y_min:V,y_max:V}},cycle:{required:{items:A(E)},optional:{seconds:k,align:M}},stack:{required:{items:()=>{}},optional:{direction:D(`row`,`column`)}},meter:{required:{value:E},optional:{max:E,label:E,unit:E,state:j,thresholds:B}},meters:{required:{items:A(F)},optional:{max:E,unit:E,thresholds:B}},bars:{required:{items:A(F)},optional:{unit:E,limit:N(1,50)}},split:{required:{items:I(F,6)},optional:{}},status:{required:{items:A(P({label:E,state:j},{note:E}))},optional:{}},schedule:{required:{items:A(P({start:E,title:E},{end:E,detail:E}))},optional:{rows:N(1,20)}},queue:{required:{current:E},optional:{recent:A(E),label:E}},clocks:{required:{zones:I((e,t,n,r)=>{if(w(e)&&`zone`in e&&!(`timezone`in e)){let{zone:i,...a}=e,o=[];P({label:E,timezone:L})({...a,timezone:i},t,o,r),n.push(...o.map(e=>e.replace(`${t}.timezone`,`${t}.zone`)))}else P({label:E,timezone:L})(e,t,n,r)},12)},optional:{hour12:O}},slideshow:{required:{images:A(E)},optional:{seconds:k,fit:D(`cover`,`contain`)}},qr:{required:{value:E},optional:{label:E}}},U=4,W={surface:(e,t,n)=>xe(e,t,n),title:(e,t,n)=>E(e,t,n),size:R(8,400),weight:R(.1,20),icon:(e,t,n)=>S(e)?void 0:n.push(`${t}: unknown icon, expected one of ${x.join(`, `)}`)};function Ce(e,t,n,r,i){for(let[a,o]of Object.entries(t.required))C(e,a)?o(e[a],`${n}.${a}`,r,i):r.push(`${n}.${a}: required for ${e.type}`);for(let[a,o]of Object.entries(e)){if(a===`type`||C(t.required,a))continue;let s=C(t.optional,a)?t.optional[a]:C(W,a)?W[a]:void 0;s?s(o,`${n}.${a}`,r,i):i.push(`${n}.${a}: unknown property for ${e.type}, ignored`)}}function we(e,t,n){if(!Array.isArray(e.rows)||!Array.isArray(e.columns))return;let r=e.columns.length;e.rows.forEach((e,i)=>{Array.isArray(e)&&e.length!==r&&n.push(`${t}.rows[${i}]: has ${e.length} cells, columns has ${r}`)})}function G(e,t,n,r,i=0){if(!w(e))return void n.push(`${t}: expected an object with a "type"`);let a=typeof e.type==`string`&&C(H,e.type)?H[e.type]:void 0;if(!a)n.push(`${t}.type: unknown component ${JSON.stringify(e.type)}, expected one of ${Object.keys(H).join(`, `)}`);else if(Ce(e,a,t,n,r),e.type===`table`&&we(e,t,r),e.type===`chart`&&e.kind===`column`&&Array.isArray(e.series)&&e.series.length>1&&n.push(`${t}.series: column charts take one series, use a line chart to compare several`),e.type===`stack`){if(i>=U)return void n.push(`${t}: stacks nest at most ${U} deep`);if(!Array.isArray(e.items))return void n.push(`${t}.items: expected an array of components`);e.items.forEach((e,a)=>G(e,`${t}.items[${a}]`,n,r,i+1))}}var Te=[`$schema`,`version`,`colors`,`alert`,`layout`,`zones`],Ee=P({},{level:(e,t,n)=>T(e)?void 0:D(`info`,`good`,`warning`,`danger`)(e,t,n),icon:(e,t,n)=>T(e)||S(e)?void 0:n.push(`${t}: unknown icon, expected one of ${x.join(`, `)}`),title:E,message:E,text:E,steps:A(E),footer:E,mode:D(`takeover`,`banner`),until:E,state:D(`warning`,`danger`)});function De(e,t,n,r){if(T(e))return E(e,t,n);Ee(e,t,n,r),w(e)&&!(`title`in e)&&!(`message`in e)&&!(`text`in e)&&n.push(`${t}: needs a title or a message`)}function Oe(e,t,n){if(e===void 0)return;if(!w(e))return t.push(`colors: expected an object`),void 0;let r={};for(let[i,a]of Object.entries(e))i===`scheme`?a===`dark`||a===`light`?r.scheme=a:t.push(`colors.scheme: expected "dark" or "light"`):o.includes(i)?typeof a==`string`&&l.test(a)?r[i]=a:t.push(`colors.${i}: expected a hex color like "#1e293b"`):n.push(`colors.${i}: unknown color, expected one of scheme, ${o.join(`, `)}`);return r}function K(e){let t=[],n=[];if(!w(e))return{doc:null,errors:[`expected a JSON object with "layout" and "zones"`],warnings:n};let r=g(e),i=r!==null&&r>1;r===null?t.push(`version: expected a whole number from 1`):i?n.push(`version: written for format ${r}; this signagekit reads format 1, so anything newer is skipped`):r<1&&t.push(`version: format ${r} needs upgrading; use check() or mount()`);let a=Oe(e.colors,t,n),o=[];e.alert!==void 0&&De(e.alert,`alert`,o,n),t.push(...o);let s=e.alert!==void 0&&o.length===0?e.alert:void 0;for(let t of Object.keys(e))Te.includes(t)||n.push(`${t}: unknown top-level property, ignored`);let c=[],l=fe(e.layout,c);if(c.length)return{doc:null,errors:[...t,...c],warnings:n};if(!w(e.zones))return{doc:null,errors:[...t,`zones: expected an object of named components`],warnings:n};let u={};for(let[r,a]of Object.entries(e.zones)){if(!l.includes(r)){n.push(`zones.${r}: not placed in the layout, not shown`);continue}let e=[];G(a,`zones.${r}`,e,n),e.length?(i?n:t).push(...e):u[r]=a}for(let t of l)C(e.zones,t)||n.push(`layout: "${t}" has no zone, left empty`);return{doc:{version:1,colors:a,alert:s,layout:e.layout,zones:u},errors:t,warnings:n}}var ke=`#2563eb`,Ae=e=>typeof e==`object`&&!!e&&!Array.isArray(e);async function q(e,t){return typeof e==`string`?e.trim()?ae(e,t):{value:null,error:`empty`}:{value:e}}async function J(e){if(e===void 0||typeof e==`string`&&!e.trim())return{data:{},errors:[]};let t=await q(e,`data`);return t.error?{data:{},errors:[`data: ${t.error}`]}:Ae(t.value)?{data:t.value,errors:[]}:{data:{},errors:[`data: expected an object (a JSON object or a YAML mapping)`]}}async function Y(e,t={}){let n=await q(e,`layout`);if(n.error)return{doc:null,errors:[`layout: ${n.error}`],warnings:[],contrast:[]};let r=await le(n.value),i=K(r.doc),a=i.doc?re(p({...i.doc.colors,...t.colors},t.scheme??`dark`,t.accent??`#2563eb`)):[];return{doc:i.doc,errors:i.errors,warnings:[...r.notes,...i.warnings],contrast:a}}async function X(e,t,n={}){let{data:r,errors:i}=await J(t),o=e.doc&&n.checkBinds!==!1?a(e.doc,r):[];return{doc:e.doc,data:r,errors:[...e.errors,...i],warnings:[...e.warnings,...o,...e.contrast]}}async function je(e,t,n={}){return X(await Y(e,n),t,n)}var Me=`https://signagekit.514sid.com/preview/`;async function Z(e,t){let n=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}function Q(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function Ne(e){let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}async function $(e){let t=JSON.stringify(e.data?e:{layout:e.layout});return Q(await Z(new TextEncoder().encode(t),new CompressionStream(`deflate-raw`)))}async function Pe(e){let t=await Z(Ne(e),new DecompressionStream(`deflate-raw`)),n=JSON.parse(new TextDecoder().decode(t));if(typeof n.layout!=`string`)throw Error(`no layout in link`);return{layout:n.layout,data:typeof n.data==`string`?n.data:void 0}}async function Fe(e,t,n={}){let r=e=>typeof e==`string`?e:JSON.stringify(e),i=new URL(n.base??`https://signagekit.514sid.com/preview/`),a=i.searchParams;return n.mode&&n.mode!==`screen`&&a.set(`mode`,n.mode),n.size&&a.set(`size`,[].concat(n.size).join(`,`)),n.scheme&&a.set(`scheme`,n.scheme),n.accent&&a.set(`accent`,n.accent),n.timeZone&&a.set(`tz`,n.timeZone),n.locale&&a.set(`locale`,n.locale),n.problems&&a.set(`problems`,`1`),n.now&&a.set(`now`,n.now),i.hash=`s=`+await $({layout:r(e),data:t===void 0?void 0:r(t)}),i.toString()}export{n as S,ie as _,ke as a,t as b,Y as c,C as d,x as f,s as g,o as h,Pe as i,J as l,oe as m,$ as n,je as o,S as p,Fe as r,X as s,Me as t,K as u,p as v,r as x,e as y};
|
|
2
|
+
//# sourceMappingURL=share-KNCRqMVQ.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=stat-
|
|
1
|
+
import{S as e,d as t,x as n}from"./share-KNCRqMVQ.js";import{jsx as r,jsxs as i}from"preact/jsx-runtime";var a={good:`Good`,warning:`Warning`,danger:`Danger`};function o(n,r){let i=n===void 0?``:e(n,r);return t(a,i)?i:`neutral`}function s(e,t){if(!t||!Number.isFinite(e))return`neutral`;let n=t.warning!==void 0&&t.danger!==void 0&&t.danger<t.warning,r=t=>t!==void 0&&(n?e<=t:e>=t);return r(t.danger)?`danger`:r(t.warning)?`warning`:`neutral`}var c=e=>parseFloat(e.replace(/,/g,``));function l(t,n){return t.type!==`stat`&&t.type!==`meter`?`neutral`:t.state===void 0?s(c(e(t.value,n)),t.thresholds):o(t.state,n)}var u={good:{shape:`M12 2a10 10 0 1 0 0 20a10 10 0 1 0 0-20z`,mark:[`m8.5 12 2.5 2.5 4.5-5`]},warning:{shape:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3z`,mark:[`M12 9v4`,`M12 17h.01`]},danger:{shape:`M12 2a10 10 0 1 0 0 20a10 10 0 1 0 0-20z`,mark:[`m15 9-6 6`,`m9 9 6 6`]}};function d({state:e}){let t=u[e];return/* @__PURE__ */ i(`svg`,{class:`c-state-icon is-${e}`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[/* @__PURE__ */ r(`path`,{class:`c-state-shape`,d:t.shape}),t.mark.map(e=>/* @__PURE__ */ r(`path`,{class:`c-state-mark`,d:e},e))]})}var f={up:[`M16 7h6v6`,`m22 7-8.5 8.5-5-5L2 17`],down:[`M16 17h6v-6`,`m22 17-8.5-8.5-5 5L2 7`],flat:[`M5 12h14`,`m12 5 7 7-7 7`]};function p(n,r){let i=n.trend===void 0?``:e(n.trend,r);return t(f,i)?{dir:i,tone:!n.good_when||i===`flat`?`neutral`:i===n.good_when?`good`:`danger`}:null}function m({c:t,data:n}){let a=p(t,n);if(!a)return null;let o=e(t.delta,n);return/* @__PURE__ */ i(`span`,{class:`c-stat-trend tone-${a.tone}`,children:[/* @__PURE__ */ r(`svg`,{class:`c-trend-icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:f[a.dir].map(e=>/* @__PURE__ */ r(`path`,{d:e},e))}),o]})}var h=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1});function g(e,t){let n=e.replace(/,/g,``).trim();if(n===``||!/^-?\d+(\.\d+)?$/.test(n)||/^-?0\d/.test(n))return e;let r=Number(n);return t!==`full`&&Math.abs(r)>=1e4?h.format(r):e.includes(`,`)?e:r.toLocaleString(void 0,{maximumFractionDigits:20})}function _({c:t,data:o}){let s=e(t.unit,o),c=l(t,o),u=e(t.label,o)||a[c]||``;return/* @__PURE__ */ i(`div`,{class:`c-stat`,"data-fit":`line`,"data-kind":`stat`,"data-own-size":t.match_row===!1?``:void 0,children:[/* @__PURE__ */ i(`div`,{class:`c-stat-value`,children:[g(e(t.value,o),t.format)||`—`,s&&/* @__PURE__ */ r(`span`,{class:`c-stat-unit`,children:s}),/* @__PURE__ */ r(m,{c:t,data:o})]}),t.spark&&/* @__PURE__ */ r(v,{values:n(t.spark,o),data:o}),u&&/* @__PURE__ */ i(`div`,{class:`c-stat-label`,children:[c!==`neutral`&&/* @__PURE__ */ r(d,{state:c}),u]})]})}function v({values:t,data:n}){let a=t.map(t=>parseFloat(e(t,n).replace(/,/g,``))).filter(Number.isFinite);if(a.length<2)return null;let o=Math.min(...a),s=Math.max(...a),c=e=>28-(e-o)/(s-o||1)*24,l=e=>e/(a.length-1)*100,u=a.map((e,t)=>`${l(t)},${c(e)}`).join(` `),d=a.length-1;return/* @__PURE__ */ i(`svg`,{class:`c-spark`,viewBox:`0 0 100 30`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[/* @__PURE__ */ r(`polyline`,{points:u}),/* @__PURE__ */ r(`path`,{d:`M${l(d)} ${c(a[d])}h0`})]})}export{l as a,g as i,_ as n,o,d as r,s,a as t};
|
|
2
|
+
//# sourceMappingURL=stat-DbgL2D35.js.map
|
package/dist/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e,r as t}from"./chunks/share-
|
|
1
|
+
import{o as e,r as t}from"./chunks/share-KNCRqMVQ.js";import{readFileSync as n}from"node:fs";var r=`usage:
|
|
2
2
|
signagekit check <layout file> [data file] [--scheme dark|light] [--accent #hex]
|
|
3
3
|
Checks a screen document (JSON or YAML) and its data. Exits with 1 on errors.
|
|
4
4
|
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import{_ as e,d as t,f as n,g as r,h as i,i as a,l as o,m as s,n as c,o as l,p as u,r as d,s as f,t as p,u as m,v as h,y as g}from"./chunks/share-D64VSp1B.js";import{a as ee,n as te,r as ne}from"./chunks/stat-DEE3meII.js";import{t as _}from"./chunks/empty--6iNLsra.js";import{a as re,c as ie,i as ae,n as oe,s as v,t as se}from"./chunks/time-KYYBrpD9.js";import{n as ce,t as le}from"./chunks/ready-Boq20M-G.js";import{t as ue}from"./chunks/qr-size-Dq23do6_.js";import{render as y}from"preact";import{useEffect as b,useLayoutEffect as de,useRef as fe,useState as x}from"preact/hooks";import{Fragment as pe,jsx as S,jsxs as C}from"preact/jsx-runtime";var w,T;function E(){return T??(T=import(`./chunks/icon-paths-Dl0Rqja7.js`).then(e=>w=e.ICONS)),T}function D({name:e,cls:t=``}){let[,n]=x(0);return b(()=>{w||E().then(()=>n(e=>e+1))},[]),/* @__PURE__ */ S(`svg`,{class:`icon ${t}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:w?.[e]??``}})}function me({c:e,data:t}){let n=fe(null),[r,i]=x(null),a=t=>`a-${e.align?.[t]??`start`}`,o=h(e.rows,t),s=Math.min(e.page_rows??1/0,r??1/0,o.length),c=Math.max(1,Math.ceil(o.length/Math.max(1,s))),[l,u]=x(0),d=l%c;if(de(()=>{n.current&&(n.current.__autoPage=e=>i(t=>t===e?t:e))},[]),b(()=>{if(c<2)return;let t=setInterval(()=>u(e=>e+1),(e.seconds??10)*1e3);return()=>clearInterval(t)},[c,e.seconds]),!o.length)return/* @__PURE__ */ S(_,{text:`No rows`});let f=(e.widths??[]).reduce((e,t)=>e+t,0);return/* @__PURE__ */ C(`table`,{ref:n,class:`c-table${e.widths?` has-widths`:``}`,"data-fit":`line`,"data-kind":`table`,"data-page-rows":e.page_rows,"data-auto-paged":r?``:void 0,children:[e.widths&&/* @__PURE__ */ S(`colgroup`,{children:e.widths.map((e,t)=>/* @__PURE__ */ S(`col`,{style:{width:`${e/f*100}%`}},t))}),c>1&&/* @__PURE__ */ C(`caption`,{class:`c-table-page`,children:[d+1,` / `,c]}),/* @__PURE__ */ S(`thead`,{children:/* @__PURE__ */ S(`tr`,{children:e.columns.map((e,t)=>/* @__PURE__ */ S(`th`,{class:a(t),children:e},t))})}),/* @__PURE__ */ S(`tbody`,{children:o.map((e,n)=>/* @__PURE__ */ S(`tr`,{class:Math.floor(n/s)===d?``:`off-page`,children:(Array.isArray(e)?e:[]).map((e,n)=>{let r=g(e,t);return/* @__PURE__ */ S(`td`,{class:`${a(n)}${r?``:` is-missing`}`,children:r||`—`},n)})},n))})]})}var O=[`info`,`good`,`warning`,`danger`],he={info:`info`,good:`check`,warning:`warning`,danger:`danger`};function k(t,n,r){let i=t[n];return typeof i==`string`||typeof i==`number`||e(i)?g(i,r):``}function ge(t,n,i){if(!t)return null;let a=e(t)?r(n,t.bind):t;if(!a||typeof a!=`object`||Array.isArray(a))return null;let o=a,s=k(o,`title`,n),c=k(o,`message`,n)||k(o,`text`,n);if((o.text!==void 0&&o.message===void 0||!s)&&!c)return null;let l=Date.parse(k(o,`until`,n));if(!Number.isNaN(l)&&l<=i.getTime())return null;let u=k(o,`level`,n)||k(o,`state`,n),d=O.includes(u)?u:`danger`,f=k(o,`icon`,n),p=Array.isArray(o.steps)||e(o.steps)?h(o.steps,n).map(e=>g(e,n)).filter(Boolean):[];return{level:d,icon:m(f)?f:he[d],title:s,message:c,steps:p,footer:k(o,`footer`,n),mode:k(o,`mode`,n)===`banner`?`banner`:`takeover`}}function _e(e,t){return ge(e,t,v())}function ve({a:e}){return/* @__PURE__ */ C(`div`,{class:`alert takeover lvl-${e.level}`,role:`alert`,children:[/* @__PURE__ */ C(`div`,{class:`alert-head`,children:[/* @__PURE__ */ S(D,{name:e.icon,cls:`alert-icon`}),e.title&&/* @__PURE__ */ S(`div`,{class:`alert-title-box`,children:/* @__PURE__ */ S(`h1`,{class:`alert-title`,"data-fit":`line`,"data-kind":`alert-title`,children:e.title})})]}),/* @__PURE__ */ S(`div`,{class:`alert-box`,children:/* @__PURE__ */ C(`div`,{class:`alert-content`,"data-fit":`wrap`,"data-kind":`alert`,children:[e.message&&/* @__PURE__ */ S(`p`,{class:`alert-message`,children:e.message}),e.steps.length>0&&/* @__PURE__ */ S(`ol`,{class:`alert-steps`,children:e.steps.map((e,t)=>/* @__PURE__ */ C(`li`,{children:[/* @__PURE__ */ S(`span`,{class:`alert-step-n`,children:t+1}),/* @__PURE__ */ S(`span`,{children:e})]},t))})]})}),e.footer&&/* @__PURE__ */ S(`div`,{class:`alert-footer`,children:e.footer})]})}function ye({a:e}){return/* @__PURE__ */ C(`div`,{class:`alert banner lvl-${e.level}`,role:`alert`,children:[/* @__PURE__ */ S(D,{name:e.icon,cls:`alert-icon`}),/* @__PURE__ */ S(`div`,{class:`alert-box`,children:/* @__PURE__ */ C(`div`,{class:`alert-content`,"data-fit":`wrap`,"data-kind":`alert-banner`,children:[e.title&&/* @__PURE__ */ S(`strong`,{class:`alert-banner-title`,children:e.title}),e.message&&/* @__PURE__ */ S(`span`,{children:e.message})]})}),e.footer&&/* @__PURE__ */ S(`div`,{class:`alert-footer`,children:e.footer})]})}function A({a:e}){return e.mode===`banner`?/* @__PURE__ */ S(ye,{a:e}):/* @__PURE__ */ S(ve,{a:e})}var j={chart:()=>import(`./chunks/chart-WERjiRho.js`).then(e=>e.Chart),meter:()=>import(`./chunks/measures-D0av_G5P.js`).then(e=>e.MeterView),meters:()=>import(`./chunks/measures-D0av_G5P.js`).then(e=>e.MetersView),bars:()=>import(`./chunks/measures-D0av_G5P.js`).then(e=>e.BarsView),split:()=>import(`./chunks/measures-D0av_G5P.js`).then(e=>e.SplitView),status:()=>import(`./chunks/lists-qOUpM5us.js`).then(e=>e.StatusView),schedule:()=>import(`./chunks/lists-qOUpM5us.js`).then(e=>e.ScheduleView),queue:()=>import(`./chunks/lists-qOUpM5us.js`).then(e=>e.QueueView),clocks:()=>import(`./chunks/lists-qOUpM5us.js`).then(e=>e.ClocksView),slideshow:()=>import(`./chunks/media-DI35kQ5D.js`).then(e=>e.SlideshowView),qr:()=>import(`./chunks/media-DI35kQ5D.js`).then(e=>e.QrView)},be=e=>e in j,M=/* @__PURE__ */ new Map,N=/* @__PURE__ */ new Map,xe=e=>M.get(e);function P(e){let t=N.get(e);return t||(t=j[e]().then(t=>(M.set(e,t),t),t=>{throw N.delete(e),t}),N.set(e,t)),t}function F(e,t){t.add(e.type),e.icon&&t.add(`icon`),e.type===`stack`&&e.items.forEach(e=>F(e,t))}function Se(e){let t=/* @__PURE__ */ new Set;return Object.values(e.zones).forEach(e=>F(e,t)),t}function Ce(e){if(!e)return Promise.resolve();let t=Se(e),n=t.has(`icon`)||e.alert?[E()]:[],r=Promise.all([...[...t].filter(be).map(P),...n]).then(()=>void 0);return ce(r),r}var we=`trend-below`,Te=`label-beside`,Ee=[[!1,!1],[!0,!1],[!1,!0],[!0,!0]],I=([e,t])=>`${+e}${+t}`,De=e=>e.closest(`.cell`)?.dataset.density??``;function L(e,[t,n]){e.classList.toggle(we,t),e.classList.toggle(Te,n)}function Oe(e){let t=De(e);if(t===`strip`)return[];let n=e.querySelector(`.c-stat-trend`)!==null,r=t!==`compact`&&e.querySelector(`.c-stat-label`)!==null&&e.querySelector(`.c-spark`)===null;return Ee.filter(([e,t])=>(n||!e)&&(r||!t))}function ke(e,t,n){let r=Oe(e);if(r.length<2)return L(e,[!1,!1]),delete e.dataset.arrangements,!1;let i={};for(let n of r)L(e,n),i[I(n)]=t();e.dataset.arrangements=JSON.stringify(i);let a=r.reduce((e,t)=>i[I(t)]>i[I(e)]?t:e);return L(e,a),e.style.fontSize=Math.max(n,i[I(a)])+`px`,!0}function Ae(e,t,n=0){let r=e.filter(e=>e.dataset.arrangements);if(!r.length)return Math.min(...e.map(t));let i=new Map(r.map(e=>[e,JSON.parse(e.dataset.arrangements)])),a=(e,n)=>{let r=i.get(e);return r?r[I(n)]??r[I([n[0],!1])]??r[I([!1,n[1]])]??r[`00`]:t(e)},o=t=>Math.min(...e.map(e=>a(e,t))),s=t=>e.reduce((e,n)=>e+a(n,t),0),c=e=>[Math.max(n,o(e)),s(e)],l=Ee.reduce((e,t)=>{let[n,r]=c(e),[i,a]=c(t);return i>n||i===n&&a>r?t:e});for(let e of r){let t=i.get(e),n=e=>e.some(e=>e in t);L(e,[l[0]&&n([`10`,`11`]),l[1]&&n([`01`,`11`])])}return o(l)}function R(e){let t=getComputedStyle(e);return[e.clientWidth-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight),e.clientHeight-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)]}var z={heading:[28,400],text:[22,200],table:[22,64],list:[22,96],stat:[22,240],clock:[22,600],countdown:[22,300],cycle:[22,200],meter:[22,160],meters:[22,64],bars:[22,64],split:[22,64],status:[22,72],schedule:[22,64],queue:[22,320],clocks:[22,120],alert:[32,120],"alert-title":[56,240],"alert-banner":[28,72]},je=[22,24,28,32,36,40,44,48,56,64,72,80,96,112,128,144,160,192,224,256,320,400],B=[`table`,`list`,`status`,`meters`,`bars`,`schedule`,`clocks`,`split`],Me=[`heading`,`cycle`,`text`],Ne=3.5,Pe=1.4;function Fe(e,t,n,r,[i,a]){e.textContent=t;let o=i,s=a+1;for(;s-o>1;){let t=o+s>>1;e.style.fontSize=t+`px`,e.scrollHeight<=r&&e.scrollWidth<=n?o=t:s=t}return o}function V(e,t){let n=e.parentElement;if(!n||t.length===0)return;let r=e.closest(`.cell`)?.dataset.size;if(r){e.style.fontSize=r+`px`;return}let i=z.cycle,[a,o]=i,[s,c]=R(n),l=e.cloneNode();l.removeAttribute(`data-wrap`),l.style.cssText=`position:absolute;visibility:hidden;font-size:100px`,n.appendChild(l);let u=1/0;for(let e of t)l.textContent=e,u=Math.min(u,s/l.scrollWidth,c/l.scrollHeight);let d=Math.max(a,Math.min(o,Math.floor(100*u*.98)));l.style.cssText=`position:absolute;visibility:hidden;white-space:normal;width:${s}px`;let f=Math.min(...t.map(e=>Fe(l,e,s,c,i)));n.removeChild(l);let p=f>d;e.toggleAttribute(`data-wrap`,p),e.style.fontSize=(p?f:d)+`px`}var H=e=>parseFloat(e.style.fontSize)||0;function Ie(e){e.classList.add(`measuring`);let t=document.createRange(),n=Array.from(e.querySelectorAll(`td, th`)).some(e=>{let n=getComputedStyle(e),r=e.clientWidth-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight);return t.selectNodeContents(e),t.getBoundingClientRect().width>r+.1});return e.classList.remove(`measuring`),n}function Le(e){let[t,n]=R(e.parentElement),r=e;if(r.classList.contains(`has-widths`)){let[t]=z.table,n=H(e);for(;n>t&&Ie(r);)e.style.fontSize=--n+`px`}if(e.scrollWidth>t+1&&Be(r),!r.__autoPage)return;let i=Array.from(r.tBodies[0]?.rows??[]).filter(e=>e.style.visibility===`visible`);if(!i.length)return;let a=r.tHead?.offsetHeight??0,o=i.map(e=>e.offsetHeight),s=a+o.reduce((e,t)=>e+t,0),c=Re(r),l=(r.tBodies[0]?.rows.length??0)>i.length?n-c:n;if(s<=l+1){r.__autoPage(null);let t=Math.min((l-s-4)/o.length,H(e)*.9);t>1&&(r.style.setProperty(`--row-room`,`${t/2}px`),r.offsetHeight>l&&r.style.removeProperty(`--row-room`));return}let u=Math.max(...o,1);r.__autoPage(Math.max(1,Math.floor((n-a-c)/u)))}function Re(e){let t=e.caption;if(!t)return H(e)*1.5;t.style.display=``;let n=t.offsetHeight;return t.style.display=`none`,n||H(e)*1.5}function ze(e){let t=Array.from(e.querySelectorAll(`.c-table`));for(let e of t){e.style.removeProperty(`--row-room`);let t=Number(e.dataset.pageRows)||1/0;Array.from(e.tBodies[0]?.rows??[]).forEach((e,n)=>{e.style.visibility=n<t?`visible`:`collapse`}),e.caption&&(e.caption.style.display=`none`)}return()=>{for(let e of t)Array.from(e.tBodies[0]?.rows??[]).forEach(e=>e.style.visibility=``),e.caption&&(e.caption.style.display=``)}}function Be(e){let t=[];for(let n of Array.from(e.rows))Array.from(n.cells).forEach((e,n)=>t[n]=Math.max(t[n]??0,e.scrollWidth));e.dataset.flex=String(t.indexOf(Math.max(...t)))}var U={list:`:scope > li`,status:`:scope > li`,schedule:`:scope > li`,clocks:`:scope > li`,meters:`:scope > .c-meters-row`,bars:`:scope > .c-bars-row`},W=(e,t)=>{let n=t;for(let r of je)r<=e&&r>=t&&(n=r);return n},G=e=>parseFloat(e.style.fontSize)||0,K=e=>e.dataset.kind??``;function q(e){let[t,n]=R(e.parentElement);return e.scrollHeight>n+1||e.scrollWidth>t+1}function J(e,t,n,r){return e.style.fontSize=t+`px`,e.scrollHeight<=r&&e.scrollWidth<=n}function Ve(e){e.querySelectorAll(Y).forEach(e=>e.style.minHeight=``),e.querySelectorAll(`.c-stat-value`).forEach(e=>e.style.fontSize=``),e.querySelectorAll(`.c-stat.label-under`).forEach(e=>e.classList.remove(`label-under`)),e.querySelectorAll(`[data-trimmed]`).forEach(e=>{e.style.display=``,delete e.dataset.trimmed}),e.querySelectorAll(`.body[data-more]`).forEach(e=>delete e.dataset.more),e.querySelectorAll(`.c-table[data-flex]`).forEach(e=>delete e.dataset.flex)}function He(e){e.querySelectorAll(`.c-stack.d-row`).forEach(e=>{let t=e.children.length,n=t>=3&&e.clientWidth/t<300;e.classList.toggle(`wrapped`,n&&e.clientHeight>=300)});let t=Array.from(e.querySelectorAll(`.cell`)),n=t.map(e=>[e.clientWidth,e.clientHeight]);t.forEach((e,t)=>{let[r,i]=n[t],a=i<170||i<230&&r/i>4;e.dataset.density=i<100?`strip`:a?`compact`:i<300||r<360?`tight`:``})}function Ue(e){let t=e.parentElement;if(!t)return;let[n,r]=z[K(e)]??[22,160],i=e=>Math.max(n,Math.min(r,Math.floor(e))),[a,o]=R(t);e.style.fontSize=`100px`;let s=a/e.scrollWidth,c=o/e.scrollHeight;if(K(e)===`table`){let t=i(100*Math.min(c,s*1.3));e.style.fontSize=t+`px`;return}if(e.dataset.fit===`line`){let t=()=>{e.style.fontSize=`100px`;let t=Math.min(a/e.scrollWidth,o/e.scrollHeight),r=i(100*t);for(;r>n&&!J(e,r,a,o);)r--;return J(e,r,a,o)?r:r*Math.min(a/e.scrollWidth,o/e.scrollHeight)};ke(e,t,n)||(e.style.fontSize=Math.max(n,t())+`px`);return}let l=100*Math.sqrt(s*c),u=i(l*.6),d=i(l*1.6);for(J(e,u,a,o)?J(e,d,a,o)&&([u,d]=[d,r+1]):[u,d]=[n,u];d-u>1;){let t=u+d>>1;J(e,t,a,o)?u=t:d=t}e.style.fontSize=u+`px`}var Y=`[data-kind="stat"]:not([data-own-size]), [data-kind="countdown"]`;function X(e,t){let n=/* @__PURE__ */ new Map;return e.querySelectorAll(Y).forEach(e=>{if(t.has(e))return;let r=e.closest(`.cell`);if(!r)return;let i=r.getBoundingClientRect(),a=`${Math.round(i.top)}:${Math.round(i.height)}`;n.set(a,[...n.get(a)??[],e])}),[...n.values()]}function We(e,t){for(let n of X(e,t)){let[e]=z[K(n[0])]??[22],t=Math.max(e,Ae(n,G,e));for(let e of n)e.style.fontSize=t+`px`}}function Ge(e,t){for(let n of X(e,t)){let e=Math.max(...n.map(e=>e.offsetHeight));for(let t of n){let[,n]=R(t.parentElement);t.style.minHeight=Math.min(e,n)+`px`}}}function Ke(e,t,n){let r=e.filter(e=>B.includes(K(e))),i=r.filter(e=>e.closest(`.cell`)?.dataset.density?.match(/strip|compact/)==null),a=z.table[0],o=i.length?i:r,s=o.length?W(Math.min(...o.map(G)),a):0;for(let e of r){let t=Math.min(G(e),s*Pe);e.style.fontSize=W(t,s)+`px`}We(t,n);let c=s?s*Ne:1/0;for(let t of e){let e=K(t);if(B.includes(e))continue;let[n]=z[e]??[22,0],r=Me.includes(e)?Math.min(G(t),c):G(t);t.style.fontSize=W(r,n)+`px`}return s}function qe(e,t){let n=Array.from(e.querySelectorAll(t)),r=e.closest(`.body`),[i,a]=R(e.parentElement),o=e.closest(`.cell`)?.dataset.density?.match(/strip|compact/)!=null,s=G(e),c=t=>o?e.scrollWidth>(t?i-s*5:i)+1:e.scrollHeight>(t?a-s*1.5:a)+1,l=0;for(;n.length-l>1&&c(l);){let e=n[n.length-1-l];e.style.display=`none`,e.dataset.trimmed=``,l++}l&&r&&(r.dataset.more=`+${l} more`,r.style.setProperty(`--more-size`,`${Math.max(20,s*.75)}px`))}function Je(e){let t=e.querySelector(`.c-spark`);t&&q(e)&&(t.style.display=`none`,t.dataset.trimmed=``);let n=e.querySelector(`.c-stat-value`);if(n){for(let t=2.4;t>=1.2&&q(e);t-=.2)n.style.fontSize=t.toFixed(1)+`em`;q(e)&&e.closest(`.cell`)?.dataset.density===`compact`&&(e.classList.add(`label-under`),q(e)&&e.classList.remove(`label-under`))}}function Ye(e){for(let t of e){let e=K(t);e===`stat`||e===`countdown`?Je(t):e===`table`?Le(t):U[e]&&q(t)&&qe(t,U[e])}}function Xe(e){let t=e.closest(`.cell`)?.dataset.size;return t?(e.style.fontSize=t+`px`,!0):!1}function Ze(e){Ve(e),He(e);let t=ze(e),n=[],r=/* @__PURE__ */ new Set;for(let t of Array.from(e.querySelectorAll(`[data-fit]`)))Xe(t)?r.add(t):(Ue(t),n.push(t));e.querySelectorAll(`.c-cycle`).forEach(e=>{let t=e.__messages;t&&(V(e,t),e.closest(`.cell`)?.dataset.size?r.add(e):n.push(e))}),Ke(n,e,r),Ye(n),t(),Ge(e,r),ue(e)}var Qe={s:24,m:32,l:48,xl:64};function $e({c:e,data:t}){return g(e.text,t)?/* @__PURE__ */ S(`h1`,{class:`c-heading a-${e.align??`start`}`,"data-fit":`wrap`,"data-kind":`heading`,children:g(e.text,t)}):/* @__PURE__ */ S(_,{text:`—`})}function et({c:e,data:t}){if(!g(e.text,t))return/* @__PURE__ */ S(_,{});let n=e.fit?{"data-fit":`wrap`,"data-kind":`text`}:{};return/* @__PURE__ */ S(`p`,{class:`c-text a-${e.align??`start`}`,style:e.fit?void 0:{fontSize:Qe[e.size??`m`]+`px`},...n,children:g(e.text,t)})}function tt({c:e,data:t}){let n=h(e.items,t).map(e=>g(e,t)).filter(Boolean);return n.length?/* @__PURE__ */ S(`ul`,{class:`c-list`,"data-fit":`wrap`,"data-kind":`list`,children:n.map((e,t)=>/* @__PURE__ */ S(`li`,{children:e},t))}):/* @__PURE__ */ S(_,{})}function nt({c:e,data:t}){let n=g(e.src,t),[r,i]=x(``);return n?r===n?/* @__PURE__ */ S(_,{text:`Image not available`}):/* @__PURE__ */ S(`img`,{class:`c-image`,src:n,alt:e.alt??``,decoding:`async`,onError:()=>i(n),style:{objectFit:e.fit??`cover`}}):/* @__PURE__ */ S(_,{text:`No image`})}function rt({c:e}){let t=v(),n=ie();return/* @__PURE__ */ C(`div`,{class:`c-clock`,"data-fit":`line`,"data-kind":`clock`,children:[/* @__PURE__ */ S(`div`,{class:`c-clock-time`,children:oe(t,e.hour12,n)}),e.show_date&&/* @__PURE__ */ S(`div`,{class:`c-clock-date`,children:re(t,n)})]})}function it({c:e,data:t}){let n=v(),r=new Date(g(e.to,t)),i=g(e.label,t);return/* @__PURE__ */ C(`div`,{class:`c-stat`,"data-fit":`line`,"data-kind":`countdown`,children:[/* @__PURE__ */ S(`div`,{class:`c-stat-value`,children:isNaN(r.getTime())?`—`:ae(r,n)||g(e.done,t)||`Now`}),i&&/* @__PURE__ */ S(`div`,{class:`c-stat-label`,children:i})]})}function at({c:e,data:t}){let n=fe(null),r=h(e.items,t).map(e=>g(e,t)).filter(Boolean),i=r.join(`
|
|
2
|
-
`),[
|
|
1
|
+
import{S as e,_ as t,b as n,c as r,f as i,g as a,h as o,i as s,l as c,m as l,n as u,o as d,p as f,r as p,s as m,t as h,u as ee,v as te,x as g,y as ne}from"./chunks/share-KNCRqMVQ.js";import{a as re,n as ie,r as ae}from"./chunks/stat-DbgL2D35.js";import{t as _}from"./chunks/empty--6iNLsra.js";import{a as oe,c as se,i as ce,n as le,s as v,t as ue}from"./chunks/time-KYYBrpD9.js";import{n as de,t as fe}from"./chunks/ready-Boq20M-G.js";import{t as pe}from"./chunks/qr-size-Dq23do6_.js";import{render as y}from"preact";import{useEffect as b,useLayoutEffect as me,useRef as x,useState as S}from"preact/hooks";import{Fragment as he,jsx as C,jsxs as w}from"preact/jsx-runtime";var T,E;function D(){return E??(E=import(`./chunks/icon-paths-Dl0Rqja7.js`).then(e=>T=e.ICONS)),E}function O({name:e,cls:t=``}){let[,n]=S(0);return b(()=>{T||D().then(()=>n(e=>e+1))},[]),/* @__PURE__ */ C(`svg`,{class:`icon ${t}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`,dangerouslySetInnerHTML:{__html:T?.[e]??``}})}function ge({c:t,data:n}){let r=x(null),[i,a]=S(null),o=e=>`a-${t.align?.[e]??`start`}`,s=g(t.rows,n),c=Math.min(t.page_rows??1/0,i??1/0,s.length),l=Math.max(1,Math.ceil(s.length/Math.max(1,c))),[u,d]=S(0),f=u%l;if(me(()=>{r.current&&(r.current.__autoPage=e=>a(t=>t===e?t:e))},[]),b(()=>{if(l<2)return;let e=setInterval(()=>d(e=>e+1),(t.seconds??10)*1e3);return()=>clearInterval(e)},[l,t.seconds]),!s.length)return/* @__PURE__ */ C(_,{text:`No rows`});let p=(t.widths??[]).reduce((e,t)=>e+t,0);return/* @__PURE__ */ w(`table`,{ref:r,class:`c-table${t.widths?` has-widths`:``}`,"data-fit":`line`,"data-kind":`table`,"data-page-rows":t.page_rows,"data-auto-paged":i?``:void 0,children:[t.widths&&/* @__PURE__ */ C(`colgroup`,{children:t.widths.map((e,t)=>/* @__PURE__ */ C(`col`,{style:{width:`${e/p*100}%`}},t))}),l>1&&/* @__PURE__ */ w(`caption`,{class:`c-table-page`,children:[f+1,` / `,l]}),/* @__PURE__ */ C(`thead`,{children:/* @__PURE__ */ C(`tr`,{children:t.columns.map((e,t)=>/* @__PURE__ */ C(`th`,{class:o(t),children:e},t))})}),/* @__PURE__ */ C(`tbody`,{children:s.map((t,r)=>/* @__PURE__ */ C(`tr`,{class:Math.floor(r/c)===f?``:`off-page`,children:(Array.isArray(t)?t:[]).map((t,r)=>{let i=e(t,n);return/* @__PURE__ */ C(`td`,{class:`${o(r)}${i?``:` is-missing`}`,children:i||`—`},r)})},r))})]})}var _e=[`info`,`good`,`warning`,`danger`],ve={info:`info`,good:`check`,warning:`warning`,danger:`danger`};function k(t,r,i){let a=t[r];return typeof a==`string`||typeof a==`number`||n(a)?e(a,i):``}function ye(t,r,i){if(!t)return null;let a=n(t)?ne(r,t.bind):t;if(!a||typeof a!=`object`||Array.isArray(a))return null;let o=a,s=k(o,`title`,r),c=k(o,`message`,r)||k(o,`text`,r);if((o.text!==void 0&&o.message===void 0||!s)&&!c)return null;let l=Date.parse(k(o,`until`,r));if(!Number.isNaN(l)&&l<=i.getTime())return null;let u=k(o,`level`,r)||k(o,`state`,r),d=_e.includes(u)?u:`danger`,p=k(o,`icon`,r),m=Array.isArray(o.steps)||n(o.steps)?g(o.steps,r).map(t=>e(t,r)).filter(Boolean):[];return{level:d,icon:f(p)?p:ve[d],title:s,message:c,steps:m,footer:k(o,`footer`,r),mode:k(o,`mode`,r)===`banner`?`banner`:`takeover`}}function be(e,t){return ye(e,t,v())}function xe({a:e}){return/* @__PURE__ */ w(`div`,{class:`alert takeover lvl-${e.level}`,role:`alert`,children:[/* @__PURE__ */ w(`div`,{class:`alert-head`,children:[/* @__PURE__ */ C(O,{name:e.icon,cls:`alert-icon`}),e.title&&/* @__PURE__ */ C(`div`,{class:`alert-title-box`,children:/* @__PURE__ */ C(`h1`,{class:`alert-title`,"data-fit":`line`,"data-kind":`alert-title`,children:e.title})})]}),/* @__PURE__ */ C(`div`,{class:`alert-box`,children:/* @__PURE__ */ w(`div`,{class:`alert-content`,"data-fit":`wrap`,"data-kind":`alert`,children:[e.message&&/* @__PURE__ */ C(`p`,{class:`alert-message`,children:e.message}),e.steps.length>0&&/* @__PURE__ */ C(`ol`,{class:`alert-steps`,children:e.steps.map((e,t)=>/* @__PURE__ */ w(`li`,{children:[/* @__PURE__ */ C(`span`,{class:`alert-step-n`,children:t+1}),/* @__PURE__ */ C(`span`,{children:e})]},t))})]})}),e.footer&&/* @__PURE__ */ C(`div`,{class:`alert-footer`,children:e.footer})]})}function Se({a:e}){return/* @__PURE__ */ w(`div`,{class:`alert banner lvl-${e.level}`,role:`alert`,children:[/* @__PURE__ */ C(O,{name:e.icon,cls:`alert-icon`}),/* @__PURE__ */ C(`div`,{class:`alert-box`,children:/* @__PURE__ */ w(`div`,{class:`alert-content`,"data-fit":`wrap`,"data-kind":`alert-banner`,children:[e.title&&/* @__PURE__ */ C(`strong`,{class:`alert-banner-title`,children:e.title}),e.message&&/* @__PURE__ */ C(`span`,{children:e.message})]})}),e.footer&&/* @__PURE__ */ C(`div`,{class:`alert-footer`,children:e.footer})]})}function Ce({a:e}){return e.mode===`banner`?/* @__PURE__ */ C(Se,{a:e}):/* @__PURE__ */ C(xe,{a:e})}var we={chart:()=>import(`./chunks/chart-Dk8Cjn4t.js`).then(e=>e.Chart),meter:()=>import(`./chunks/measures-DlXV_PQC.js`).then(e=>e.MeterView),meters:()=>import(`./chunks/measures-DlXV_PQC.js`).then(e=>e.MetersView),bars:()=>import(`./chunks/measures-DlXV_PQC.js`).then(e=>e.BarsView),split:()=>import(`./chunks/measures-DlXV_PQC.js`).then(e=>e.SplitView),status:()=>import(`./chunks/lists-Lp1TT3y5.js`).then(e=>e.StatusView),schedule:()=>import(`./chunks/lists-Lp1TT3y5.js`).then(e=>e.ScheduleView),queue:()=>import(`./chunks/lists-Lp1TT3y5.js`).then(e=>e.QueueView),clocks:()=>import(`./chunks/lists-Lp1TT3y5.js`).then(e=>e.ClocksView),slideshow:()=>import(`./chunks/media-DdNjnnhA.js`).then(e=>e.SlideshowView),qr:()=>import(`./chunks/media-DdNjnnhA.js`).then(e=>e.QrView)},Te={chart:()=>import(`uplot`),qr:()=>import(`uqr`)},Ee=e=>e in we,De=/* @__PURE__ */ new Map,A=/* @__PURE__ */ new Map,Oe=e=>De.get(e);function j(e){let t=A.get(e);return t||(t=we[e]().then(t=>(De.set(e,t),t),t=>{throw A.delete(e),t}),A.set(e,t)),t}function M(e,t){t.add(e.type),e.icon&&t.add(`icon`),e.type===`stack`&&e.items.forEach(e=>M(e,t))}function ke(e){let t=/* @__PURE__ */ new Set;return Object.values(e.zones).forEach(e=>M(e,t)),t}function Ae(e){if(!e)return Promise.resolve();let t=ke(e),n=t.has(`icon`)||e.alert?[D()]:[],r=[...t].filter(Ee),i=r.flatMap(e=>{let t=Te[e];return t?[t().catch(()=>void 0)]:[]}),a=Promise.all([...r.map(j),...i,...n]).then(()=>void 0);return de(a),a}var je={s:24,m:32,l:48,xl:64};function Me({c:t,data:n}){return e(t.text,n)?/* @__PURE__ */ C(`h1`,{class:`c-heading a-${t.align??`start`}`,"data-fit":`wrap`,"data-kind":`heading`,children:e(t.text,n)}):/* @__PURE__ */ C(_,{text:`—`})}function Ne({c:t,data:n}){if(!e(t.text,n))return/* @__PURE__ */ C(_,{});let r=t.fit?{"data-fit":`wrap`,"data-kind":`text`}:{};return/* @__PURE__ */ C(`p`,{class:`c-text a-${t.align??`start`}`,style:t.fit?void 0:{fontSize:je[t.size??`m`]+`px`},...r,children:e(t.text,n)})}function Pe({c:t,data:n}){let r=g(t.items,n).map(t=>e(t,n)).filter(Boolean);return r.length?/* @__PURE__ */ C(`ul`,{class:`c-list`,"data-fit":`wrap`,"data-kind":`list`,children:r.map((e,t)=>/* @__PURE__ */ C(`li`,{children:e},t))}):/* @__PURE__ */ C(_,{})}function Fe({c:t,data:n}){let r=e(t.src,n),[i,a]=S(``);return r?i===r?/* @__PURE__ */ C(_,{text:`Image not available`}):/* @__PURE__ */ C(`img`,{class:`c-image`,src:r,alt:t.alt??``,decoding:`async`,onError:()=>a(r),style:{objectFit:t.fit??`cover`}}):/* @__PURE__ */ C(_,{text:`No image`})}function Ie({c:e}){let t=v(),n=se();return/* @__PURE__ */ w(`div`,{class:`c-clock`,"data-fit":`line`,"data-kind":`clock`,children:[/* @__PURE__ */ C(`div`,{class:`c-clock-time`,children:le(t,e.hour12,n)}),e.show_date&&/* @__PURE__ */ C(`div`,{class:`c-clock-date`,children:oe(t,n)})]})}function Le({c:t,data:n}){let r=v(),i=new Date(e(t.to,n)),a=e(t.label,n);return/* @__PURE__ */ w(`div`,{class:`c-stat`,"data-fit":`line`,"data-kind":`countdown`,children:[/* @__PURE__ */ C(`div`,{class:`c-stat-value`,children:isNaN(i.getTime())?`—`:ce(i,r)||e(t.done,n)||`Now`}),a&&/* @__PURE__ */ C(`div`,{class:`c-stat-label`,children:a})]})}function Re({c:t,data:n}){let r=x(null),i=g(t.items,n).map(t=>e(t,n)).filter(Boolean),a=i.join(`
|
|
2
|
+
`),[o,s]=S(0);return me(()=>{let e=r.current;e&&(e.__messages=i)},[a]),b(()=>{if(i.length<2)return;let e=setInterval(()=>s(e=>e+1),(t.seconds??8)*1e3);return()=>clearInterval(e)},[a,t.seconds]),i.length?/* @__PURE__ */ C(`div`,{class:`c-cycle a-${t.align??`start`}`,ref:r,"data-kind":`cycle`,children:i[o%i.length]??``}):/* @__PURE__ */ C(_,{})}function ze({c:e,data:t}){return/* @__PURE__ */ C(`div`,{class:`c-stack d-${e.direction??`column`}`,children:e.items.map((e,n)=>/* @__PURE__ */ C(P,{c:e,data:t},n))})}var Be=3e4;function N({c:e,data:t}){let n=e.type,[r,i]=S(()=>Oe(n)),[a,o]=S(0);return b(()=>{if(r)return;let e=!1,t;return j(n).then(t=>{e||i(()=>t)},n=>{console.error(`signagekit: chunk failed`,n),e||(t=setTimeout(()=>o(e=>e+1),Be))}),()=>{e=!0,clearTimeout(t)}},[n,r,a]),r?/* @__PURE__ */ C(r,{c:e,data:t}):null}var Ve={heading:Me,text:Ne,stat:ie,table:ge,list:Pe,image:Fe,clock:Ie,countdown:Le,cycle:Re,chart:N,stack:ze,meter:N,meters:N,bars:N,split:N,status:N,schedule:N,queue:N,clocks:N,slideshow:N,qr:N};function He({c:e,data:t}){let n=Ve[e.type];return/* @__PURE__ */ C(n,{c:e,data:t})}function P({c:t,data:n}){let r=typeof t.size==`number`?String(t.size):void 0,i=re(t,n),a=f(t.icon)?t.icon:null,o=`title${i===`neutral`?``:` has-state`}${a?` has-icon`:``}`,s=e(t.title,n);return/* @__PURE__ */ w(`div`,{class:`cell s-${t.surface??`base`} k-${t.type} state-${i}`,"data-size":r,style:t.weight?{flexGrow:t.weight}:void 0,children:[s&&/* @__PURE__ */ w(`div`,{class:o,children:[i!==`neutral`&&/* @__PURE__ */ C(`span`,{class:`title-state`,children:/* @__PURE__ */ C(ae,{state:i})}),a&&/* @__PURE__ */ C(O,{name:a,cls:`title-icon`}),/* @__PURE__ */ C(`span`,{children:s})]}),/* @__PURE__ */ C(`div`,{class:`body`,children:/* @__PURE__ */ C(He,{c:t,data:n})})]})}function Ue(e){return{gridTemplateAreas:e.areas.map(e=>`"${e.trim()}"`).join(` `),gridTemplateColumns:e.columns??`repeat(${e.areas[0].trim().split(/\s+/).length}, 1fr)`,gridTemplateRows:e.rows??`repeat(${e.areas.length}, 1fr)`,gap:(e.gap??2)+`px`,"--gap":(e.gap??2)+`px`}}function We({zones:e,layout:t,data:n,alert:r}){let i=be(r,n);return i?.mode===`takeover`?/* @__PURE__ */ C(Ce,{a:i}):/* @__PURE__ */ w(`div`,{class:`screen`,children:[i&&/* @__PURE__ */ C(Ce,{a:i}),/* @__PURE__ */ C(`div`,{class:`grid`,style:Ue(t),children:Object.entries(e).map(([e,t])=>/* @__PURE__ */ C(`div`,{class:`zone`,style:{gridArea:e},children:/* @__PURE__ */ C(P,{c:t,data:n})},e))})]})}function Ge({errors:e,warnings:t}){return e.length+t.length===0?null:/* @__PURE__ */ w(`div`,{class:`problems`,role:`status`,children:[e.map((e,t)=>/* @__PURE__ */ w(`div`,{children:[`Error: `,e]},`e`+t)),t.map((e,t)=>/* @__PURE__ */ w(`div`,{children:[`Warning: `,e]},`w`+t))]})}var F=`trend-below`,I=`label-beside`,Ke=[F,I],qe=[[!1,!1],[!0,!1],[!1,!0],[!0,!0]],L=([e,t])=>`${+e}${+t}`,Je=e=>e.closest(`.cell`)?.dataset.density??``;function R(e,[t,n]){e.classList.toggle(F,t),e.classList.toggle(I,n)}function Ye(e){let t=Je(e);if(t===`strip`)return[];let n=e.querySelector(`.c-stat-trend`)!==null,r=t!==`compact`&&e.querySelector(`.c-stat-label`)!==null&&e.querySelector(`.c-spark`)===null;return qe.filter(([e,t])=>(n||!e)&&(r||!t))}function Xe(e,t,n){let r=Ye(e);if(r.length<2)return R(e,[!1,!1]),delete e.dataset.arrangements,!1;let i={};for(let n of r)R(e,n),i[L(n)]=t();e.dataset.arrangements=JSON.stringify(i);let a=r.reduce((e,t)=>i[L(t)]>i[L(e)]?t:e);return R(e,a),e.style.fontSize=Math.max(n,i[L(a)])+`px`,!0}function Ze(e,t,n=0){let r=e.filter(e=>e.dataset.arrangements);if(!r.length)return Math.min(...e.map(t));let i=new Map(r.map(e=>[e,JSON.parse(e.dataset.arrangements)])),a=(e,n)=>{let r=i.get(e);return r?r[L(n)]??r[L([n[0],!1])]??r[L([!1,n[1]])]??r[`00`]:t(e)},o=t=>Math.min(...e.map(e=>a(e,t))),s=t=>e.reduce((e,n)=>e+a(n,t),0),c=e=>[Math.max(n,o(e)),s(e)],l=qe.reduce((e,t)=>{let[n,r]=c(e),[i,a]=c(t);return i>n||i===n&&a>r?t:e});for(let e of r){let t=i.get(e),n=e=>e.some(e=>e in t);R(e,[l[0]&&n([`10`,`11`]),l[1]&&n([`01`,`11`])])}return o(l)}var z=0;typeof document<`u`&&document.fonts?.addEventListener?.(`loadingdone`,()=>z++);var B=()=>z,V=null;function H(e){let t=V?.get(e);if(t)return t;let n=getComputedStyle(e);return[e.clientWidth-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight),e.clientHeight-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)]}function Qe(e){V=null;let t=new Map(e.map(e=>[e,H(e)]));return V=t,()=>{V===t&&(V=null)}}var U={heading:[28,400],text:[22,200],table:[22,64],list:[22,96],stat:[22,240],clock:[22,600],countdown:[22,300],cycle:[22,200],meter:[22,160],meters:[22,64],bars:[22,64],split:[22,64],status:[22,72],schedule:[22,64],queue:[22,320],clocks:[22,120],alert:[32,120],"alert-title":[56,240],"alert-banner":[28,72]},$e=[22,24,28,32,36,40,44,48,56,64,72,80,96,112,128,144,160,192,224,256,320,400],W=[`table`,`list`,`status`,`meters`,`bars`,`schedule`,`clocks`,`split`],et=[`heading`,`cycle`,`text`],tt=3.5,nt=1.4;function rt(e,t,n,r,[i,a],o=!1){e.textContent=t;let s=t=>(e.style.fontSize=t+`px`,e.scrollHeight<=r&&e.scrollWidth<=n);if(o&&s(a))return a;let c=i,l=o?a:a+1;for(;l-c>1;){let e=c+l>>1;s(e)?c=e:l=e}return c}var G=/* @__PURE__ */ new WeakMap;function it(e,t){let n=e.parentElement;if(!n||t.length===0)return;let r=e.closest(`.cell`)?.dataset.size;if(r){e.style.fontSize=r+`px`;return}let[i,a]=U.cycle,[o,s]=H(n),c=e.closest(`.cell`)?.dataset.density??``,l=[o,s,B(),c,e.className,...t].join(`
|
|
3
|
+
`),u=G.get(e);if(u?.key===l){e.toggleAttribute(`data-wrap`,u.wrap),e.style.fontSize=u.size;return}let d=e.cloneNode();d.removeAttribute(`data-wrap`),d.style.cssText=`position:absolute;visibility:hidden;font-size:100px`,n.appendChild(d);let f=1/0;for(let e of t)d.textContent=e,f=Math.min(f,o/d.scrollWidth,s/d.scrollHeight);let p=Math.max(i,Math.min(a,Math.floor(100*f*.98)));d.style.cssText=`position:absolute;visibility:hidden;white-space:normal;width:${o}px`;let m=a;t.forEach((e,t)=>{m=rt(d,e,o,s,[i,m],t>0)}),n.removeChild(d);let h=m>p;e.toggleAttribute(`data-wrap`,h),e.style.fontSize=(h?m:p)+`px`,G.set(e,{key:l,wrap:h,size:e.style.fontSize})}var K=/* @__PURE__ */ new WeakMap;function at(e,t,n){let r=e.closest(`.cell`)?.dataset.density??``,i=Array.from(e.classList).filter(e=>!Ke.includes(e));return[t,n,B(),r,i,e.innerHTML].join(`|`)}function ot(e,t,n,r){let i=at(e,t,n),a=K.get(e);a?.key===i?(e.className=a.className,a.arrangements?e.dataset.arrangements=a.arrangements:delete e.dataset.arrangements,e.style.fontSize=a.size):(r(),K.set(e,{key:i,size:e.style.fontSize,className:e.className,arrangements:e.dataset.arrangements}))}var q=e=>parseFloat(e.style.fontSize)||0;function st(e){e.classList.add(`measuring`);let t=document.createRange(),n=Array.from(e.querySelectorAll(`td, th`)).some(e=>{let n=getComputedStyle(e),r=e.clientWidth-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight);return t.selectNodeContents(e),t.getBoundingClientRect().width>r+.1});return e.classList.remove(`measuring`),n}function ct(e,t=st){let[n]=U.table,r=q(e);if(r<=n||!t(e))return;let i=t=>{e.style.fontSize=Math.max(n,r-t)+`px`},a=Math.ceil(r-n),o=0,s=a;for(let n=1;n<a;n*=2){if(i(n),!t(e)){s=n;break}o=n}for(;s-o>1;){let n=o+s>>1;i(n),t(e)?o=n:s=n}i(s)}var lt=/* @__PURE__ */ new WeakMap;function ut(e){let[t,n]=H(e.parentElement),r=e,i=[t,n,B(),r.className,r.style.fontSize,r.dataset.pageRows,r.tHead?.innerHTML,r.tBodies[0]?.innerHTML].join(`|`),a=lt.get(r);if(a?.key===i)r.style.fontSize=a.size,a.flex!==void 0&&(r.dataset.flex=a.flex),a.rowRoom&&r.style.setProperty(`--row-room`,a.rowRoom);else{let e=dt(r,t,n);a={key:i,size:r.style.fontSize,flex:r.dataset.flex,rowRoom:r.style.getPropertyValue(`--row-room`),page:e},lt.set(r,a)}a.page!==void 0&&r.__autoPage?.(a.page)}function dt(e,t,n){if(e.classList.contains(`has-widths`)&&ct(e),e.scrollWidth>t+1&&mt(e),!e.__autoPage)return;let r=Array.from(e.tBodies[0]?.rows??[]).filter(e=>e.style.visibility===`visible`);if(!r.length)return;let i=e.tHead?.offsetHeight??0,a=r.map(e=>e.offsetHeight),o=i+a.reduce((e,t)=>e+t,0),s=ft(e),c=(e.tBodies[0]?.rows.length??0)>r.length?n-s:n;if(o<=c+1){let t=Math.min((c-o-4)/a.length,q(e)*.9);return t>1&&(e.style.setProperty(`--row-room`,`${t/2}px`),e.offsetHeight>c&&e.style.removeProperty(`--row-room`)),null}let l=Math.max(...a,1);return Math.max(1,Math.floor((n-i-s)/l))}function ft(e){let t=e.caption;if(!t)return q(e)*1.5;t.style.display=``;let n=t.offsetHeight;return t.style.display=`none`,n||q(e)*1.5}function pt(e){let t=Array.from(e.querySelectorAll(`.c-table`));for(let e of t){e.style.removeProperty(`--row-room`);let t=Number(e.dataset.pageRows)||1/0;Array.from(e.tBodies[0]?.rows??[]).forEach((e,n)=>{e.style.visibility=n<t?`visible`:`collapse`}),e.caption&&(e.caption.style.display=`none`)}return()=>{for(let e of t)Array.from(e.tBodies[0]?.rows??[]).forEach(e=>e.style.visibility=``),e.caption&&(e.caption.style.display=``)}}function mt(e){let t=[];for(let n of Array.from(e.rows))Array.from(n.cells).forEach((e,n)=>t[n]=Math.max(t[n]??0,e.scrollWidth));e.dataset.flex=String(t.indexOf(Math.max(...t)))}var ht={list:`:scope > li`,status:`:scope > li`,schedule:`:scope > li`,clocks:`:scope > li`,meters:`:scope > .c-meters-row`,bars:`:scope > .c-bars-row`},J=(e,t)=>{let n=t;for(let r of $e)r<=e&&r>=t&&(n=r);return n},Y=e=>parseFloat(e.style.fontSize)||0,X=e=>e.dataset.kind??``;function Z(e){let[t,n]=H(e.parentElement);return e.scrollHeight>n+1||e.scrollWidth>t+1}function Q(e,t,n,r){return e.style.fontSize=t+`px`,e.scrollHeight<=r&&e.scrollWidth<=n}function gt(e){e.querySelectorAll(bt).forEach(e=>e.style.minHeight=``),e.querySelectorAll(`.c-stat-value`).forEach(e=>e.style.fontSize=``),e.querySelectorAll(`.c-stat.label-under`).forEach(e=>e.classList.remove(`label-under`)),e.querySelectorAll(`[data-trimmed]`).forEach(e=>{e.style.display=``,delete e.dataset.trimmed}),e.querySelectorAll(`.body[data-more]`).forEach(e=>delete e.dataset.more),e.querySelectorAll(`.c-table[data-flex]`).forEach(e=>delete e.dataset.flex)}function _t(e){let t=Array.from(e.querySelectorAll(`.cell`));t.forEach(e=>delete e.dataset.density),e.querySelectorAll(`.c-stack.d-row`).forEach(e=>{let t=e.children.length,n=t>=3&&e.clientWidth/t<300;e.classList.toggle(`wrapped`,n&&e.clientHeight>=300)});let n=t.map(e=>[e.clientWidth,e.clientHeight]);t.forEach((e,t)=>{let[r,i]=n[t],a=i<170||i<230&&r/i>4;e.dataset.density=i<100?`strip`:a?`compact`:i<300||r<360?`tight`:``})}function vt(e){let t=e.parentElement;if(!t)return;let[n,r]=H(t);ot(e,n,r,()=>yt(e,n,r))}function yt(e,t,n){let[r,i]=U[X(e)]??[22,160],a=e=>Math.max(r,Math.min(i,Math.floor(e)));e.style.fontSize=`100px`;let o=t/e.scrollWidth,s=n/e.scrollHeight;if(X(e)===`table`){let t=a(100*Math.min(s,o*1.3));e.style.fontSize=t+`px`;return}if(e.dataset.fit===`line`){let i=()=>{e.style.fontSize=`100px`;let i=Math.min(t/e.scrollWidth,n/e.scrollHeight),o=a(100*i),s=Q(e,o,t,n);for(;!s&&o>r;)s=Q(e,--o,t,n);return s?o:o*Math.min(t/e.scrollWidth,n/e.scrollHeight)};Xe(e,i,r)||(e.style.fontSize=Math.max(r,i())+`px`);return}let c=100*Math.sqrt(o*s),l=a(c*.6),u=a(c*1.6);for(Q(e,l,t,n)?Q(e,u,t,n)&&([l,u]=[u,i+1]):[l,u]=[r,l];u-l>1;){let r=l+u>>1;Q(e,r,t,n)?l=r:u=r}e.style.fontSize=l+`px`}var bt=`[data-kind="stat"]:not([data-own-size]), [data-kind="countdown"]`;function xt(e,t){let n=/* @__PURE__ */ new Map;return e.querySelectorAll(bt).forEach(e=>{if(t.has(e))return;let r=e.closest(`.cell`);if(!r)return;let i=r.getBoundingClientRect(),a=`${Math.round(i.top)}:${Math.round(i.height)}`;n.set(a,[...n.get(a)??[],e])}),[...n.values()]}function St(e,t){for(let n of xt(e,t)){let[e]=U[X(n[0])]??[22],t=Math.max(e,Ze(n,Y,e));for(let e of n)e.style.fontSize=t+`px`}}function Ct(e,t){for(let n of xt(e,t)){let e=Math.max(...n.map(e=>e.offsetHeight));for(let t of n){let[,n]=H(t.parentElement);t.style.minHeight=Math.min(e,n)+`px`}}}function wt(e,t,n){let r=e.filter(e=>W.includes(X(e))),i=r.filter(e=>e.closest(`.cell`)?.dataset.density?.match(/strip|compact/)==null),a=U.table[0],o=i.length?i:r,s=o.length?J(Math.min(...o.map(Y)),a):0;for(let e of r){let t=Math.min(Y(e),s*nt);e.style.fontSize=J(t,s)+`px`}St(t,n);let c=s?s*tt:1/0;for(let t of e){let e=X(t);if(W.includes(e))continue;let[n]=U[e]??[22,0],r=et.includes(e)?Math.min(Y(t),c):Y(t);t.style.fontSize=J(r,n)+`px`}return s}function Tt(e,t){let n=Array.from(e.querySelectorAll(t)),r=e.closest(`.body`),[i,a]=H(e.parentElement),o=e.closest(`.cell`)?.dataset.density?.match(/strip|compact/)!=null,s=Y(e),c=t=>o?e.scrollWidth>(t?i-s*5:i)+1:e.scrollHeight>(t?a-s*1.5:a)+1,l=0;for(;n.length-l>1&&c(l);){let e=n[n.length-1-l];e.style.display=`none`,e.dataset.trimmed=``,l++}l&&r&&(r.dataset.more=`+${l} more`,r.style.setProperty(`--more-size`,`${Math.max(20,s*.75)}px`))}function Et(e){let t=e.querySelector(`.c-spark`);t&&Z(e)&&(t.style.display=`none`,t.dataset.trimmed=``);let n=e.querySelector(`.c-stat-value`);if(n){for(let t=2.4;t>=1.2&&Z(e);t-=.2)n.style.fontSize=t.toFixed(1)+`em`;Z(e)&&e.closest(`.cell`)?.dataset.density===`compact`&&(e.classList.add(`label-under`),Z(e)&&e.classList.remove(`label-under`))}}function Dt(e){for(let t of e){let e=X(t);e===`stat`||e===`countdown`?Et(t):e===`table`?ut(t):ht[e]&&Z(t)&&Tt(t,ht[e])}}function Ot(e){let t=e.closest(`.cell`)?.dataset.size;return t?(e.style.fontSize=t+`px`,!0):!1}function kt(e){gt(e),_t(e);let t=pt(e),n=/* @__PURE__ */ new Set;e.querySelectorAll(`[data-fit], .c-cycle`).forEach(e=>{let t=e.parentElement;t?.closest(`.zone`)&&n.add(t)});let r=Qe([...n]),i=[],a=/* @__PURE__ */ new Set;for(let t of Array.from(e.querySelectorAll(`[data-fit]`)))Ot(t)?a.add(t):(vt(t),i.push(t));e.querySelectorAll(`.c-cycle`).forEach(e=>{let t=e.__messages;t&&(it(e,t),e.closest(`.cell`)?.dataset.size?a.add(e):i.push(e))}),wt(i,e,a),Dt(i),t(),Ct(e,a),r(),pe(e)}var At=.75;function jt(e,t){return e>=t?[Math.round(1080*e/t),1080]:[1080,Math.round(1080*t/e)]}var Mt=e=>`flow`in e,Nt=e=>typeof e==`string`?{zone:e}:e,$=e=>e.reduce((e,t)=>e+t,0);function Pt(e,t){let n=$(t);if(e<=0||n<=0)return t.map(()=>0);let r=t.map(t=>e*t/n),i=r.map(Math.floor),a=e-$(i),o=r.map((e,t)=>[e-Math.floor(e),t]).sort((e,t)=>t[0]-e[0]);for(let e=0;e<a;e++)i[o[e][1]]++;return i}function Ft(e){if($(e.wants)<=12){let t=Pt(12-$(e.wants),e.wants);return e.wants.map((e,n)=>e+t[n])}let t=e.wants.map((t,n)=>t-e.mins[n]),n=Pt(12-$(e.mins),$(t)>0?t:e.wants);return e.mins.map((e,t)=>e+n[t])}function It(e){if(e.fixed)return`${Math.max(...e.heights.map(e=>parseFloat(String(e))))}px`;let t=e.heights.map(e=>typeof e==`number`?e:1);return`${Math.max(...t)}fr`}function Lt(e,t){let n=e.design===`portrait`?1080:1920,r=e.design===`portrait`==t<=1080,i=t/12,a=[],o;for(let t of e.flow){let{zone:e,span:s=12,height:c}=Nt(t),l=Math.min(12,Math.max(1,Math.round(s/12*n/i))),u=Math.max(1,Math.ceil(l*At)),d=typeof c==`string`,f=r&&$(o?.designed??[])>=12,p=o!==void 0&&($(o.wants)+l<=12||!f&&$(o.mins)+u<=12);o&&o.fixed===d&&p||(o={zones:[],designed:[],wants:[],mins:[],heights:[],fixed:d},a.push(o)),o.zones.push(e),o.designed.push(s),o.wants.push(l),o.mins.push(u),o.heights.push(c)}return{areas:a.map(e=>{let t=Ft(e);return e.zones.flatMap((e,n)=>Array(t[n]).fill(e)).join(` `)}),columns:`repeat(12, 1fr)`,rows:a.map(It).join(` `),gap:e.gap}}function Rt(e,t){return Mt(e)?Lt(e,t):e}function zt(e){getComputedStyle(e).position===`static`&&(e.style.position=`relative`),e.style.overflow=`hidden`;let t=document.createElement(`div`);return t.className=`signagekit signagekit-canvas`,e.appendChild(t),t}function Bt(e,t){let n=e.clientWidth||1920,[r,i]=jt(n,e.clientHeight||1080);return t.style.width=r+`px`,t.style.height=i+`px`,t.style.transform=`scale(${n/r})`,r}async function Vt(e){await Promise.race([Ae(e.doc).catch(e=>console.error(`signagekit: chunk failed`,e)),new Promise(e=>setTimeout(e,5e3))])}function Ht(e,n,r,i,a,o){let s=te({...n.doc?.colors,...i.colors},i.scheme??`dark`,i.accent??`#2563eb`);t(s,e),y(/* @__PURE__ */ w(he,{children:[n.doc&&/* @__PURE__ */ C(ue.Provider,{value:a,children:/* @__PURE__ */ C(We,{zones:n.doc.zones,layout:Rt(n.doc.layout,r),alert:n.doc.alert,data:n.data})}),i.showProblems&&/* @__PURE__ */ C(Ge,{errors:[...n.errors,...o],warnings:n.warnings})]}),e),kt(e)}function Ut(){let e,t={};return async n=>{if(typeof n!=`string`)return n;if(n===e)return t;let r=await c(n);return r.errors.length?n:(e=n,t=r.data,t)}}async function Wt(e,t){let n={timeZone:t.timeZone,locale:t.locale,now:t.now},i={scheme:t.scheme,accent:t.accent,colors:t.colors},a=zt(e),o=Bt(e,a),s=()=>`${e.clientWidth}x${e.clientHeight}`,c=s(),l=await r(t.layout,i),u=Ut(),d=await m(l,await u(t.data),i),f=[],p=()=>Ht(a,d,o,t,n,f);await Vt(d),p(),await fe();let h=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{let t=s();t!==c&&(c=t,o=Bt(e,a),p())});return h?.observe(e),{get errors(){return[...d.errors,...f]},get warnings(){return d.warnings},async update(e){e.layout!==void 0&&(l=await r(e.layout,i)),d=await m(l,await u(e.data)??d.data,i),e.layout!==void 0&&await Vt(d),p(),await fe()},report(e){f.push(e),p()},destroy(){h?.disconnect(),y(null,a),a.remove()}}}var Gt=Object.fromEntries([{name:`hd`,width:1280,height:720,label:`HD`},{name:`fullhd`,width:1920,height:1080,label:`Full HD`},{name:`qhd`,width:2560,height:1440,label:`QHD`},{name:`4k`,width:3840,height:2160,label:`4K`},{name:`hd-portrait`,width:720,height:1280,label:`HD portrait`},{name:`portrait`,width:1080,height:1920,label:`Full HD portrait`},{name:`4k-portrait`,width:2160,height:3840,label:`4K portrait`},{name:`xga`,width:1024,height:768,label:`4:3`},{name:`xga-portrait`,width:768,height:1024,label:`4:3 portrait`},{name:`sxga`,width:1280,height:1024,label:`5:4`},{name:`ultrawide`,width:2560,height:1080,label:`Ultrawide 21:9`},{name:`bar`,width:1920,height:540,label:`Bar 32:9`},{name:`square`,width:1080,height:1080,label:`Square`}].map(e=>[e.name,e])),Kt={"720p":`hd`,"1080p":`fullhd`,fhd:`fullhd`,"1440p":`qhd`,uhd:`4k`,"2160p":`4k`,"fullhd-portrait":`portrait`},qt=[`fullhd`,`portrait`,`xga`,`ultrawide`,`square`];function Jt(e){let t=e.trim().toLowerCase(),n=Gt[Kt[t]??t];if(n)return n;let r=t.match(/^(\d{2,5})\s*[x×*]\s*(\d{2,5})$/);if(!r)return null;let i=Number(r[1]),a=Number(r[2]),o=e=>e>=64&&e<=16384;return!o(i)||!o(a)?null:{name:`${i}x${a}`,width:i,height:a,label:`${i}×${a}`}}export{o as COLOR_KEYS,qt as DEFAULT_SIZES,l as FORMAT,i as ICON_NAMES,_e as LEVELS,h as PREVIEW_BASE,a as SCHEMES,Gt as SIZES,jt as canvasSize,d as check,Wt as mount,u as pack,Jt as parseSize,p as previewUrl,s as unpack,ee as validate};
|
|
3
4
|
//# sourceMappingURL=index.js.map
|
package/dist/types/check.d.ts
CHANGED
|
@@ -27,5 +27,27 @@ export interface CheckResult {
|
|
|
27
27
|
warnings: string[];
|
|
28
28
|
}
|
|
29
29
|
export type Source = string | object;
|
|
30
|
+
/** Reads data text, or checks a parsed object, and reports what's wrong. */
|
|
31
|
+
export declare function readData(src: Source | undefined): Promise<{
|
|
32
|
+
data: Data;
|
|
33
|
+
errors: string[];
|
|
34
|
+
}>;
|
|
35
|
+
/** What checking a document finds before any data is involved. */
|
|
36
|
+
export interface LayoutCheck {
|
|
37
|
+
doc: ScreenDoc | null;
|
|
38
|
+
errors: string[];
|
|
39
|
+
/** Upgrade notes and validation warnings. */
|
|
40
|
+
warnings: string[];
|
|
41
|
+
/** Kept apart so bind warnings can go between, where they always were. */
|
|
42
|
+
contrast: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parses, upgrades and validates a document and checks its colors. None of
|
|
46
|
+
* this depends on the data, so a screen that only gets new data keeps the
|
|
47
|
+
* result. Never throws.
|
|
48
|
+
*/
|
|
49
|
+
export declare function checkLayout(layout: Source, options?: CheckOptions): Promise<LayoutCheck>;
|
|
50
|
+
/** Reads the data and checks it against a document already checked. */
|
|
51
|
+
export declare function checkData(layout: LayoutCheck, data?: Source, options?: CheckOptions): Promise<CheckResult>;
|
|
30
52
|
/** Parses, validates and checks a document and its data. Never throws. */
|
|
31
53
|
export declare function check(layout: Source, data?: Source, options?: CheckOptions): Promise<CheckResult>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs `fit` on an element in a `w` by `h` box, or, when neither its text nor
|
|
3
|
+
* its box changed since the last time, puts back what that fit gave. On a
|
|
4
|
+
* data update most text stays the same.
|
|
5
|
+
*/
|
|
6
|
+
export declare function remembered(el: HTMLElement, w: number, h: number, fit: () => void): void;
|
package/dist/types/measure.d.ts
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
/** Font size, in px, that components are measured at before scaling. */
|
|
2
2
|
export declare const PROBE = 100;
|
|
3
|
+
/**
|
|
4
|
+
* Counts web fonts that finished loading, which changes how wide all text
|
|
5
|
+
* is, so a size fitted before one did is stale.
|
|
6
|
+
*/
|
|
7
|
+
export declare const fontLoads: () => number;
|
|
3
8
|
/** The box a component fills: its parent, without padding. */
|
|
4
9
|
export declare function contentBox(box: HTMLElement): [number, number];
|
|
10
|
+
/**
|
|
11
|
+
* Reads the boxes of `els` together, in one layout, and answers contentBox
|
|
12
|
+
* for them from memory until the returned function is called. Measuring one
|
|
13
|
+
* box at a time, between size changes, costs a layout for each. Only for
|
|
14
|
+
* while nothing changes those boxes: during the fit every zone has a fixed
|
|
15
|
+
* size, whatever size its text takes.
|
|
16
|
+
*/
|
|
17
|
+
export declare function holdBoxes(els: HTMLElement[]): () => void;
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The largest size, at most the current one, where no cell is cut short, or
|
|
3
|
+
* the floor when none is. A check that finds a cut cell stops there, but one
|
|
4
|
+
* that passes measures every cell, so the search tries 1, 2, 4, 8 px down
|
|
5
|
+
* until the text fits, then halves the gap. Most tables fit 1 or 2 px down,
|
|
6
|
+
* which costs the same as stepping 1 px at a time; a long way down takes a
|
|
7
|
+
* few checks instead of one per px. Sizes stay whole px below the current
|
|
8
|
+
* one, as stepping gave.
|
|
9
|
+
*/
|
|
10
|
+
export declare function shrinkToFit(table: HTMLTableElement, cut?: (t: HTMLTableElement) => boolean): void;
|
|
11
|
+
/**
|
|
12
|
+
* Shrinks, truncates and pages a table that overflows its zone. A table
|
|
13
|
+
* whose rows, size and box are the same as last time gets the same result
|
|
14
|
+
* without measuring again: measuring every cell is the costliest part of a
|
|
15
|
+
* data update.
|
|
16
|
+
*/
|
|
1
17
|
export declare function tableOverflow(el: HTMLElement): void;
|
|
2
18
|
/**
|
|
3
19
|
* Shows every row a table could show at once, all of them or the first
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** The classes an arrangement sets; the fit pass chooses them. */
|
|
2
|
+
export declare const ARRANGEMENT_CLASSES: string[];
|
|
1
3
|
/**
|
|
2
4
|
* Fits a stat in each arrangement it can take, using `fitLine`, which returns
|
|
3
5
|
* the size the element fits at as it stands, or less than `floor` by how far
|
package/docs/api.md
CHANGED
|
@@ -19,21 +19,23 @@ await screen.update({ data: { menu: [...], wait: 12 } })
|
|
|
19
19
|
|
|
20
20
|
Without a bundler, load it as a module with an import map. The YAML parser, uPlot and the QR encoder only download when a screen needs them.
|
|
21
21
|
|
|
22
|
+
Map `yaml` to jsDelivr's bundled `+esm` build, as below. The package's own `browser/index.js` is about 70 separate modules that load one level at a time, which adds over a second before a YAML screen shows on a slow network.
|
|
23
|
+
|
|
22
24
|
```html
|
|
23
25
|
<link
|
|
24
26
|
rel="stylesheet"
|
|
25
|
-
href="https://cdn.jsdelivr.net/npm/@514sid/signagekit@0.0.
|
|
27
|
+
href="https://cdn.jsdelivr.net/npm/@514sid/signagekit@0.0.3/dist/style.css"
|
|
26
28
|
/>
|
|
27
29
|
<script type="importmap">
|
|
28
30
|
{
|
|
29
31
|
"imports": {
|
|
30
|
-
"@514sid/signagekit": "https://cdn.jsdelivr.net/npm/@514sid/signagekit@0.0.
|
|
32
|
+
"@514sid/signagekit": "https://cdn.jsdelivr.net/npm/@514sid/signagekit@0.0.3/dist/index.js",
|
|
31
33
|
"preact": "https://cdn.jsdelivr.net/npm/preact@10.27.2/dist/preact.module.js",
|
|
32
34
|
"preact/hooks": "https://cdn.jsdelivr.net/npm/preact@10.27.2/hooks/dist/hooks.module.js",
|
|
33
35
|
"preact/jsx-runtime": "https://cdn.jsdelivr.net/npm/preact@10.27.2/jsx-runtime/dist/jsxRuntime.module.js",
|
|
34
36
|
"uplot": "https://cdn.jsdelivr.net/npm/uplot@1.6.32/dist/uPlot.esm.js",
|
|
35
37
|
"uqr": "https://cdn.jsdelivr.net/npm/uqr@0.1.3/dist/index.mjs",
|
|
36
|
-
"yaml": "https://cdn.jsdelivr.net/npm/yaml@2.9.1
|
|
38
|
+
"yaml": "https://cdn.jsdelivr.net/npm/yaml@2.9.1/+esm"
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
</script>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@514sid/signagekit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "A toolkit for AI agents that build digital signage screens: dashboards, menus, schedules and alerts as JSON or YAML templates, laid out for any display.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -65,6 +65,7 @@
|
|
|
65
65
|
"format:check": "prettier --check src stories scripts bin .storybook docs site README.md",
|
|
66
66
|
"check": "bun run build && node bin/signagekit.js check",
|
|
67
67
|
"preview": "bun scripts/preview.ts",
|
|
68
|
+
"bench": "bun run build && bun scripts/bench.ts",
|
|
68
69
|
"storybook": "storybook dev -p 6006",
|
|
69
70
|
"build-storybook": "storybook build",
|
|
70
71
|
"site:build": "cd site && astro build",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function e(e,t){let n=e;for(let e of t.split(`/`))if(e!==``){if(typeof n!=`object`||!n)return;n=n[e]}return n}function t(e){return typeof e==`object`&&!!e&&typeof e.bind==`string`}function n(n,r){let i=t(n)?e(r,n.bind):n,a=i==null||typeof i==`object`?``:String(i);return a===``&&t(n)&&n.fallback!==void 0?String(n.fallback):a}function r(n,r){let i=t(n)?e(r,n.bind):n;return Array.isArray(i)?i:[]}function i(n,r,a,o){if(t(n))e(a,n.bind)===void 0&&n.fallback===void 0&&o.push(`${r}: ${n.bind} is not in the data, shown as empty`);else if(Array.isArray(n))n.forEach((e,t)=>i(e,`${r}[${t}]`,a,o));else if(n&&typeof n==`object`)for(let[e,t]of Object.entries(n))i(t,r?`${r}.${e}`:e,a,o)}function a(e,t){let n=[];return i(e.zones,`zones`,t,n),e.alert&&i(e.alert,`alert`,t,n),n}var o=[`background`,`surface`,`text`,`muted`,`line`,`accent`,`on_accent`,`good`,`warning`,`danger`],s={dark:{background:`#0b0f17`,surface:`#161c27`,text:`#f1f5f9`,muted:`#a3adbb`,line:`#2a3443`,good:`#22c55e`,warning:`#fab219`,danger:`#ef4444`},light:{background:`#eef0f3`,surface:`#ffffff`,text:`#111827`,muted:`#4b5563`,line:`#dde1e7`,good:`#16a34a`,warning:`#f59e0b`,danger:`#dc2626`}},c={dark:[`#3987e5`,`#d95926`,`#199e70`,`#c98500`,`#d55181`,`#008300`,`#9085e9`,`#e66767`],light:[`#2a78d6`,`#eb6834`,`#1baf7a`,`#eda100`,`#e87ba4`,`#008300`,`#6250d6`,`#e34948`]},l=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i;function u(e){let t=e.slice(1);t.length===3&&(t=t.replace(/./g,e=>e+e));let n=parseInt(t,16);return[n>>16&255,n>>8&255,n&255]}function d(e){let[t,n,r]=u(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function f(e,t){let[n,r]=[d(e),d(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)}function ee(e){let t=s.light.text,n=s.dark.text;return f(e,t)>=f(e,n)?t:n}function p(e,t,n){let r=s[e?.scheme??t],i=e?.accent??n;return{...r,accent:i,on_accent:ee(i),...te(e)}}function te(e){if(!e)return{};let t={};for(let n of o)e[n]&&(t[n]=e[n]);return t}var ne=[[`text`,`background`],[`text`,`surface`],[`muted`,`background`],[`muted`,`surface`],[`on_accent`,`accent`]],m=[`good`,`warning`,`danger`];function h(e){return f(e,`#ffffff`)>=f(e,`#0b0f17`)?`#ffffff`:`#0b0f17`}function re(e){let t=(t,n)=>t.flatMap(([t,r])=>{let i=f(e[t],e[r]);return i<n?[`colors: ${t} ${e[t]} on ${r} ${e[r]} has contrast ${i.toFixed(1)}:1, needs at least ${n}:1`]:[]}),n=m.flatMap(t=>{let n=f(h(e[t]),e[t]);return n<3?[`colors: ${t} ${e[t]} leaves its icon at ${n.toFixed(1)}:1, needs at least 3:1`]:[]});return[...t(ne,4.5),...n]}function g(e,t=document.documentElement){for(let n of o)t.style.setProperty(`--${n.replace(`_`,`-`)}`,e[n]);let n=d(e.background)>.4?`light`:`dark`;for(let n of m)t.style.setProperty(`--on-${n}`,h(e[n]));c[n].forEach((e,n)=>{t.style.setProperty(`--series-${n+1}`,e),t.style.setProperty(`--on-series-${n+1}`,h(e))})}async function _(e,t){let n=e.trim(),r;try{return{value:JSON.parse(n)}}catch(e){r=e.message}try{let{parse:e}=await import(`yaml`);return{value:e(n,{schema:t===`data`?`failsafe`:`core`,maxAliasCount:50,prettyErrors:!0})}}catch(e){return{value:null,error:n.startsWith(`{`)||n.startsWith(`[`)?`not valid JSON: ${r}`:`not valid YAML: ${e.message}`}}}var ie=1,ae={},oe=e=>typeof e==`object`&&!!e&&!Array.isArray(e);function v(e){let t=e.version??1;return typeof t==`number`&&Number.isInteger(t)&&t>=1?t:null}async function se(e,t=ae,n=1){if(!oe(e))return{doc:e,notes:[]};let r=v(e);if(r===null||r>=n)return{doc:e,notes:[]};let i=e,a=[];for(let e=r;e<n;e++){let n=t[e];if(!n)return a.push(`version: no upgrade from ${e} to ${e+1}, shown as is`),{doc:i,notes:a};let r=(await n()).default(i);i={...r.doc,version:e+1},a.push(...r.notes.map(t=>`version ${e} to ${e+1}: ${t}`))}return{doc:i,notes:a}}var y=e=>typeof e==`object`&&!!e&&!Array.isArray(e),ce=/^(\d+(\.\d+)?(px|fr|%)|auto|min-content|max-content)$/,b=/^[a-z][a-z0-9_-]*$/;function x(e,t,n,r){if(e===void 0)return;if(typeof e!=`string`)return void r.push(`${t}: expected a string like "2fr 1fr"`);let i=e.trim().split(/\s+/),a=i.find(e=>!ce.test(e));if(a)return void r.push(`${t}: ${JSON.stringify(a)} is not a track size, use px, fr, % or auto`);i.length!==n&&r.push(`${t}: has ${i.length} sizes, the areas have ${n}`)}function le(e,t){let n=/* @__PURE__ */ new Set;for(let r of new Set(e.flat())){if(r===`.`||n.has(r))continue;n.add(r);let i=1/0,a=-1,o=1/0,s=-1,c=0;e.forEach((e,t)=>e.forEach((e,n)=>{e===r&&(c++,i=Math.min(i,t),a=Math.max(a,t),o=Math.min(o,n),s=Math.max(s,n))})),c!==(a-i+1)*(s-o+1)&&t.push(`layout.areas: area "${r}" is not a rectangle`)}}function S(e,t){e.gap!==void 0&&(typeof e.gap!=`number`||e.gap<0||e.gap>200)&&t.push(`layout.gap: expected a number of pixels from 0 to 200`)}function ue(e,t){return y(e)?`flow`in e&&`areas`in e?(t.push(`layout: use "flow" or "areas", not both`),[]):`flow`in e?me(e,t):he(e,t):(t.push(`layout: expected an object with "flow" or "areas"`),[])}var de=/^\d+(\.\d+)?px$/,fe=[`zone`,`span`,`height`];function pe(e,t,n){if(typeof e==`string`)return b.test(e)?e:(n.push(`${t}: "${e}" is not a valid zone name`),null);if(!y(e)||typeof e.zone!=`string`||!b.test(e.zone))return n.push(`${t}: expected a zone name or {"zone": "name", "span": 6}`),null;let{span:r,height:i}=e;r!==void 0&&!(Number.isInteger(r)&&r>=1&&r<=12)&&n.push(`${t}.span: expected a whole number of columns from 1 to 12`),i!==void 0&&!(typeof i==`number`&&i>0&&i<=100)&&!(typeof i==`string`&&de.test(i))&&n.push(`${t}.height: expected a share like 2, or pixels like "150px"`);for(let r of Object.keys(e))fe.includes(r)||n.push(`${t}.${r}: unknown property, expected zone, span or height`);return e.zone}function me(e,t){if(!Array.isArray(e.flow)||e.flow.length===0)return t.push(`layout.flow: expected a non-empty list of zones`),[];e.design!==void 0&&e.design!==`landscape`&&e.design!==`portrait`&&t.push(`layout.design: expected "landscape" or "portrait"`);for(let n of Object.keys(e))[`flow`,`design`,`gap`].includes(n)||t.push(`layout.${n}: not used with "flow", expected flow, design or gap`);S(e,t);let n=[];return e.flow.forEach((e,r)=>{let i=pe(e,`layout.flow[${r}]`,t);i&&(n.includes(i)&&t.push(`layout.flow[${r}]: zone "${i}" is already in the flow`),n.push(i))}),n}function he(e,t){if(!Array.isArray(e.areas)||e.areas.length===0||e.areas.some(e=>typeof e!=`string`))return t.push(`layout.areas: expected a non-empty array of strings like "head head"`),[];let n=e.areas.map(e=>e.trim().split(/\s+/)),r=n[0].length;return n.forEach((e,n)=>{e.length!==r&&t.push(`layout.areas[${n}]: has ${e.length} names, the first row has ${r}`),e.forEach(e=>{e!==`.`&&!b.test(e)&&t.push(`layout.areas[${n}]: "${e}" is not a valid name, use lowercase letters, digits, - and _`)})}),t.length?[]:(le(n,t),x(e.columns,`layout.columns`,r,t),x(e.rows,`layout.rows`,n.length,t),S(e,t),[...new Set(n.flat())].filter(e=>e!==`.`))}var C=/* @__PURE__ */ `info.check.warning.danger.fire.evacuate.assembly.medical.first-aid.storm.wind.snow.flood.heat.lockdown.shelter.security.power.water.network.closed.delay.maintenance.announcement.phone.biohazard.radiation.chemical.event.location.accessibility`.split(`.`),w=e=>typeof e==`string`&&C.includes(e),T=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),E=e=>typeof e==`object`&&!!e&&!Array.isArray(e),D=e=>E(e)&&typeof e.bind==`string`&&e.bind.startsWith(`/`),O=(e,t,n)=>{if(typeof e==`string`||typeof e==`number`)return;if(!D(e))return void n.push(`${t}: expected a string, a number or {"bind": "/path"}`);let{fallback:r}=e;r!==void 0&&typeof r!=`string`&&typeof r!=`number`&&n.push(`${t}.fallback: expected a string or a number`);for(let r of Object.keys(e))r!==`bind`&&r!==`fallback`&&n.push(`${t}.${r}: unknown property, a bind takes bind and fallback`)},k=(...e)=>(t,n,r)=>{e.includes(t)||r.push(`${n}: expected one of ${e.map(e=>JSON.stringify(e)).join(`, `)}`)},A=(e,t,n)=>{typeof e!=`boolean`&&n.push(`${t}: expected true or false`)},ge=(e,t,n)=>{typeof e!=`string`&&n.push(`${t}: expected a string`)},j=(e,t,n)=>{typeof e==`number`&&e>=3&&e<=3600||n.push(`${t}: expected a number of seconds from 3 to 3600`)},M=e=>(t,n,r,i)=>{if(!D(t)){if(!Array.isArray(t))return void r.push(`${n}: expected an array or {"bind": "/path"}`);t.forEach((t,a)=>e(t,`${n}[${a}]`,r,i))}},_e=(e,t,n)=>{(!Array.isArray(e)||e.some(e=>typeof e!=`string`))&&n.push(`${t}: expected an array of strings`)},ve=(e,t,n)=>{if(!Array.isArray(e)||e.length<1||e.length>8)return void n.push(`${t}: expected 1 to 8 series`);e.forEach((e,r)=>{if(!E(e)||!(`name`in e)||!(`values`in e))return void n.push(`${t}[${r}]: expected {"name": ..., "values": [...]}`);O(e.name,`${t}[${r}].name`,n),M(O)(e.values,`${t}[${r}].values`,n)})},N=(e,t,n)=>D(e)?void 0:k(`neutral`,`good`,`warning`,`danger`)(e,t,n),P=k(`start`,`center`,`end`),F=k(`base`,`raised`,`accent`),I=(e,t)=>(n,r,i)=>{Number.isInteger(n)&&n>=e&&n<=t||i.push(`${r}: expected a whole number from ${e} to ${t}`)},L=(e,t={})=>(n,r,i,a)=>{if(E(n)){for(let[t,o]of Object.entries(e))T(n,t)?o(n[t],`${r}.${t}`,i,a):i.push(`${r}.${t}: required`);for(let[o,s]of Object.entries(n))T(e,o)||(T(t,o)?t[o](s,`${r}.${o}`,i,a):(a??i).push(`${r}.${o}: unknown property, ignored`))}else{let t=Object.keys(e).join(`, `);i.push(`${r}: expected an object with ${t}`)}},R=L({label:O,value:O},{max:O,state:N}),z=(e,t)=>(n,r,i,a)=>{if(Array.isArray(n)&&n.length>t)return void i.push(`${r}: at most ${t} items`);M(e)(n,r,i,a)},B=(e,t,n)=>ye(e,t,n),ye=(e,t,n)=>{try{if(typeof e!=`string`)throw Error();new Intl.DateTimeFormat(void 0,{timeZone:e})}catch{n.push(`${t}: expected a time zone like "Europe/London"`)}},V=(e,t)=>(n,r,i)=>{typeof n==`number`&&n>=e&&n<=t||i.push(`${r}: expected a number from ${e} to ${t}`)},H=(e,t,n)=>{typeof e==`number`&&Number.isFinite(e)||n.push(`${t}: expected a number`)},U=L({},{warning:H,danger:H}),W=H,G={heading:{required:{text:O},optional:{align:P}},text:{required:{text:O},optional:{size:k(`s`,`m`,`l`,`xl`),align:P,fit:A}},stat:{required:{value:O},optional:{label:O,unit:O,state:N,trend:(e,t,n)=>D(e)?void 0:k(`up`,`down`,`flat`)(e,t,n),delta:O,good_when:k(`up`,`down`),format:k(`compact`,`full`),match_row:A,thresholds:U,spark:M(O)}},table:{required:{columns:_e,rows:M(M(O))},optional:{align:(e,t,n)=>Array.isArray(e)?e.forEach((e,r)=>P(e,`${t}[${r}]`,n)):n.push(`${t}: expected an array`),page_rows:I(1,100),widths:(e,t,n)=>{(!Array.isArray(e)||e.some(e=>typeof e!=`number`||!(e>0)))&&n.push(`${t}: expected positive numbers, like [3, 1, 1]`)},seconds:j}},list:{required:{items:M(O)},optional:{}},image:{required:{src:O},optional:{fit:k(`cover`,`contain`),alt:ge}},clock:{required:{},optional:{hour12:A,show_date:A}},countdown:{required:{to:O},optional:{label:O,done:O}},chart:{required:{kind:k(`line`,`area`,`column`),labels:M(O),series:ve},optional:{target:O,target_label:O,y_min:W,y_max:W}},cycle:{required:{items:M(O)},optional:{seconds:j,align:P}},stack:{required:{items:()=>{}},optional:{direction:k(`row`,`column`)}},meter:{required:{value:O},optional:{max:O,label:O,unit:O,state:N,thresholds:U}},meters:{required:{items:M(R)},optional:{max:O,unit:O,thresholds:U}},bars:{required:{items:M(R)},optional:{unit:O,limit:I(1,50)}},split:{required:{items:z(R,6)},optional:{}},status:{required:{items:M(L({label:O,state:N},{note:O}))},optional:{}},schedule:{required:{items:M(L({start:O,title:O},{end:O,detail:O}))},optional:{rows:I(1,20)}},queue:{required:{current:O},optional:{recent:M(O),label:O}},clocks:{required:{zones:z((e,t,n,r)=>{if(E(e)&&`zone`in e&&!(`timezone`in e)){let{zone:i,...a}=e,o=[];L({label:O,timezone:B})({...a,timezone:i},t,o,r),n.push(...o.map(e=>e.replace(`${t}.timezone`,`${t}.zone`)))}else L({label:O,timezone:B})(e,t,n,r)},12)},optional:{hour12:A}},slideshow:{required:{images:M(O)},optional:{seconds:j,fit:k(`cover`,`contain`)}},qr:{required:{value:O},optional:{label:O}}},K=4,q={surface:(e,t,n)=>F(e,t,n),title:(e,t,n)=>O(e,t,n),size:V(8,400),weight:V(.1,20),icon:(e,t,n)=>w(e)?void 0:n.push(`${t}: unknown icon, expected one of ${C.join(`, `)}`)};function be(e,t,n,r,i){for(let[a,o]of Object.entries(t.required))T(e,a)?o(e[a],`${n}.${a}`,r,i):r.push(`${n}.${a}: required for ${e.type}`);for(let[a,o]of Object.entries(e)){if(a===`type`||T(t.required,a))continue;let s=T(t.optional,a)?t.optional[a]:T(q,a)?q[a]:void 0;s?s(o,`${n}.${a}`,r,i):i.push(`${n}.${a}: unknown property for ${e.type}, ignored`)}}function xe(e,t,n){if(!Array.isArray(e.rows)||!Array.isArray(e.columns))return;let r=e.columns.length;e.rows.forEach((e,i)=>{Array.isArray(e)&&e.length!==r&&n.push(`${t}.rows[${i}]: has ${e.length} cells, columns has ${r}`)})}function J(e,t,n,r,i=0){if(!E(e))return void n.push(`${t}: expected an object with a "type"`);let a=typeof e.type==`string`&&T(G,e.type)?G[e.type]:void 0;if(!a)n.push(`${t}.type: unknown component ${JSON.stringify(e.type)}, expected one of ${Object.keys(G).join(`, `)}`);else if(be(e,a,t,n,r),e.type===`table`&&xe(e,t,r),e.type===`chart`&&e.kind===`column`&&Array.isArray(e.series)&&e.series.length>1&&n.push(`${t}.series: column charts take one series, use a line chart to compare several`),e.type===`stack`){if(i>=K)return void n.push(`${t}: stacks nest at most ${K} deep`);if(!Array.isArray(e.items))return void n.push(`${t}.items: expected an array of components`);e.items.forEach((e,a)=>J(e,`${t}.items[${a}]`,n,r,i+1))}}var Se=[`$schema`,`version`,`colors`,`alert`,`layout`,`zones`],Ce=L({},{level:(e,t,n)=>D(e)?void 0:k(`info`,`good`,`warning`,`danger`)(e,t,n),icon:(e,t,n)=>D(e)||w(e)?void 0:n.push(`${t}: unknown icon, expected one of ${C.join(`, `)}`),title:O,message:O,text:O,steps:M(O),footer:O,mode:k(`takeover`,`banner`),until:O,state:k(`warning`,`danger`)});function we(e,t,n,r){if(D(e))return O(e,t,n);Ce(e,t,n,r),E(e)&&!(`title`in e)&&!(`message`in e)&&!(`text`in e)&&n.push(`${t}: needs a title or a message`)}function Te(e,t,n){if(e===void 0)return;if(!E(e))return t.push(`colors: expected an object`),void 0;let r={};for(let[i,a]of Object.entries(e))i===`scheme`?a===`dark`||a===`light`?r.scheme=a:t.push(`colors.scheme: expected "dark" or "light"`):o.includes(i)?typeof a==`string`&&l.test(a)?r[i]=a:t.push(`colors.${i}: expected a hex color like "#1e293b"`):n.push(`colors.${i}: unknown color, expected one of scheme, ${o.join(`, `)}`);return r}function Y(e){let t=[],n=[];if(!E(e))return{doc:null,errors:[`expected a JSON object with "layout" and "zones"`],warnings:n};let r=v(e),i=r!==null&&r>1;r===null?t.push(`version: expected a whole number from 1`):i?n.push(`version: written for format ${r}; this signagekit reads format 1, so anything newer is skipped`):r<1&&t.push(`version: format ${r} needs upgrading; use check() or mount()`);let a=Te(e.colors,t,n),o=[];e.alert!==void 0&&we(e.alert,`alert`,o,n),t.push(...o);let s=e.alert!==void 0&&o.length===0?e.alert:void 0;for(let t of Object.keys(e))Se.includes(t)||n.push(`${t}: unknown top-level property, ignored`);let c=[],l=ue(e.layout,c);if(c.length)return{doc:null,errors:[...t,...c],warnings:n};if(!E(e.zones))return{doc:null,errors:[...t,`zones: expected an object of named components`],warnings:n};let u={};for(let[r,a]of Object.entries(e.zones)){if(!l.includes(r)){n.push(`zones.${r}: not placed in the layout, not shown`);continue}let e=[];J(a,`zones.${r}`,e,n),e.length?(i?n:t).push(...e):u[r]=a}for(let t of l)T(e.zones,t)||n.push(`layout: "${t}" has no zone, left empty`);return{doc:{version:1,colors:a,alert:s,layout:e.layout,zones:u},errors:t,warnings:n}}var X=`#2563eb`,Ee=e=>typeof e==`object`&&!!e&&!Array.isArray(e);async function Z(e,t){return typeof e==`string`?e.trim()?_(e,t):{value:null,error:`empty`}:{value:e}}async function De(e,t){if(e===void 0||typeof e==`string`&&!e.trim())return{};let n=await Z(e,`data`);if(n.error)t.push(`data: ${n.error}`);else if(!Ee(n.value))t.push(`data: expected an object (a JSON object or a YAML mapping)`);else return n.value;return{}}async function Oe(e,t,n={}){let r=[],i=await De(t,r),o=await Z(e,`layout`);if(o.error)return{doc:null,data:i,errors:[`layout: ${o.error}`,...r],warnings:[]};let s=await se(o.value),c=Y(s.doc),l=[...s.notes,...c.warnings];if(c.doc){n.checkBinds!==!1&&l.push(...a(c.doc,i));let e=p({...c.doc.colors,...n.colors},n.scheme??`dark`,n.accent??`#2563eb`);l.push(...re(e))}return{doc:c.doc,data:i,errors:[...c.errors,...r],warnings:l}}var ke=`https://signagekit.514sid.com/preview/`;async function Q(e,t){let n=new Blob([e]).stream().pipeThrough(t);return new Uint8Array(await new Response(n).arrayBuffer())}function Ae(e){let t=``;for(let n of e)t+=String.fromCharCode(n);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}function je(e){let t=atob(e.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(t,e=>e.charCodeAt(0))}async function $(e){let t=JSON.stringify(e.data?e:{layout:e.layout});return Ae(await Q(new TextEncoder().encode(t),new CompressionStream(`deflate-raw`)))}async function Me(e){let t=await Q(je(e),new DecompressionStream(`deflate-raw`)),n=JSON.parse(new TextDecoder().decode(t));if(typeof n.layout!=`string`)throw Error(`no layout in link`);return{layout:n.layout,data:typeof n.data==`string`?n.data:void 0}}async function Ne(e,t,n={}){let r=e=>typeof e==`string`?e:JSON.stringify(e),i=new URL(n.base??`https://signagekit.514sid.com/preview/`),a=i.searchParams;return n.mode&&n.mode!==`screen`&&a.set(`mode`,n.mode),n.size&&a.set(`size`,[].concat(n.size).join(`,`)),n.scheme&&a.set(`scheme`,n.scheme),n.accent&&a.set(`accent`,n.accent),n.timeZone&&a.set(`tz`,n.timeZone),n.locale&&a.set(`locale`,n.locale),n.problems&&a.set(`problems`,`1`),n.now&&a.set(`now`,n.now),i.hash=`s=`+await $({layout:r(e),data:t===void 0?void 0:r(t)}),i.toString()}export{t as _,X as a,T as c,ie as d,o as f,e as g,p as h,Me as i,C as l,g as m,$ as n,Oe as o,s as p,Ne as r,Y as s,ke as t,w as u,r as v,n as y};
|
|
2
|
-
//# sourceMappingURL=share-D64VSp1B.js.map
|