@514sid/signagekit 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +5 -1
- package/dist/chunks/chart-WERjiRho.js +2 -0
- package/dist/chunks/lists-qOUpM5us.js +2 -0
- package/dist/chunks/{measures-_ZIjSN7n.js → measures-D0av_G5P.js} +2 -2
- package/dist/chunks/media-DI35kQ5D.js +3 -0
- package/dist/chunks/ready-Boq20M-G.js +2 -0
- package/dist/chunks/share-D64VSp1B.js +2 -0
- package/dist/chunks/stat-DEE3meII.js +2 -0
- package/dist/chunks/time-KYYBrpD9.js +2 -0
- package/dist/cli.js +2 -2
- package/dist/index.js +2 -2
- package/dist/types/checks.d.ts +7 -1
- package/dist/types/lists.d.ts +3 -2
- package/dist/types/time.d.ts +20 -7
- package/docs/api.md +3 -3
- package/package.json +1 -1
- package/dist/chunks/chart-DT-Y4YWA.js +0 -2
- package/dist/chunks/lists-DYyvtVni.js +0 -2
- package/dist/chunks/media-DI-zWZSx.js +0 -3
- package/dist/chunks/ready-DI3QO8E5.js +0 -2
- package/dist/chunks/share-CtG_q4RM.js +0 -2
- package/dist/chunks/stat-DIAOyDND.js +0 -2
- package/dist/chunks/time-sq9LV8dr.js +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
- 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.
|
|
6
|
+
- An unknown property inside an alert, a list item or a clock entry is a warning and is ignored. It no longer drops the whole alert or zone.
|
|
7
|
+
- `timeZone`, `locale` and `now` belong to each `mount()`, so screens on one page no longer overwrite each other's. A fixed `now` stays fixed while another screen's clock ticks.
|
|
8
|
+
- Charts redraw when their zone changes size, like after the screen rotates.
|
|
9
|
+
- A component chunk that fails to load is tried again after 30 seconds, instead of leaving its zone blank until the page reloads. Chart and QR libraries are fetched again on their next draw.
|
|
10
|
+
- Schedule entries that share a start time are all shown as on now. An `HH:MM` entry is no longer ended by an entry with a full date.
|
|
11
|
+
- Numbers with a leading zero, like ticket `042`, are shown as written. Queue tickets are never reformatted.
|
|
12
|
+
- Bars drop empty items before applying `limit`.
|
|
13
|
+
- `signagekit` accepts `--name=value` flags, and a missing file is a one-line error.
|
|
14
|
+
|
|
3
15
|
## 0.0.1
|
|
4
16
|
|
|
5
17
|
First release.
|
package/README.md
CHANGED
|
@@ -96,7 +96,11 @@ Releases publish to npm from GitHub Actions through npm's trusted publishing, so
|
|
|
96
96
|
2. Commit and push.
|
|
97
97
|
3. Create a GitHub release tagged with the version, like `v0.2.0`.
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
4. Approve the staged version under Staged Packages on npmjs.com, or with `npm stage approve`. Approving needs two-factor authentication.
|
|
100
|
+
|
|
101
|
+
The publish workflow checks that the tag matches `package.json`, runs every check and the build, and stages the version on npm. Nothing goes live until it's approved. A release for a version that's already on npm stages nothing.
|
|
102
|
+
|
|
103
|
+
The trusted publisher is set once, in the package settings on npmjs.com: GitHub Actions, user `514sid`, repository `signagekit`, workflow `publish.yml`, no environment, with `npm publish` and `npm dist-tag` both left unallowed.
|
|
100
104
|
|
|
101
105
|
## License
|
|
102
106
|
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{v as e,y as t}from"./share-D64VSp1B.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=e(n.labels,r).map(e=>t(e,r));return{labels:i,series:n.series.map(n=>({name:t(n.name,r),values:i.map((t,i)=>d(e(n.values,r)[i]))})),target:n.target===void 0?null:d(t(n.target,r)),targetLabel:t(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-WERjiRho.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{v as e,y as t}from"./share-D64VSp1B.js";import{t as n}from"./empty--6iNLsra.js";import{o as r,r as i}from"./stat-DEE3meII.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=e(a.items,o).filter(e=>e&&t(e.label,o));return s.length?/* @__PURE__ */ u(`ul`,{class:`c-status`,"data-fit":`wrap`,"data-kind":`status`,children:s.map((e,n)=>{let a=e??{},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:t(a.label,o)}),/* @__PURE__ */ u(`span`,{class:`c-status-note`,children:t(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(e,n,r,i,a={}){let o={day:s(r,a),abs:r.getTime()},c={day:60,abs:36e5},l=e.map(e=>e??{}).map(e=>({r:e,start:m(t(e.start,n))})).filter(e=>e.start!==null).sort((e,t)=>e.start.at-t.start.at),u=l.filter(e=>{let r=e.start;return(m(t(e.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(e=>{let r=e.start.at<=o[e.start.kind],i=r?`now`:d?``:`next`;return r||(d=!0),{start:t(e.r.start,n),title:t(e.r.title,n),detail:t(e.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:t,data:n}){let r=l(),i=a(),o=h(e(t.items,n),n,r,t.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?e(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:t(n.label,r)||`Now serving`}),/* @__PURE__ */ u(`div`,{class:`c-queue-current`,children:t(n.current,r)||`—`}),i.length>0&&/* @__PURE__ */ u(`div`,{class:`c-queue-recent`,children:i.slice(0,6).map((e,n)=>/* @__PURE__ */ u(`span`,{children:t(e,r)},n))})]})}function y({c:e,data:n}){let r=l(),i=a();return/* @__PURE__ */ u(`ul`,{class:`c-clocks`,"data-fit":`wrap`,"data-kind":`clocks`,children:e.zones.map((a,o)=>/* @__PURE__ */ d(`li`,{children:[/* @__PURE__ */ u(`span`,{class:`c-clocks-label`,children:t(a.label,n)}),/* @__PURE__ */ u(`span`,{class:`c-clocks-time`,children:c(r,a.timezone??a.zone??`UTC`,e.hour12,i)})]},o))})}export{y as ClocksView,v as QueueView,_ as ScheduleView,f as StatusView};
|
|
2
|
+
//# sourceMappingURL=lists-qOUpM5us.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{
|
|
2
|
-
//# sourceMappingURL=measures-
|
|
1
|
+
import{v as e,y as t}from"./share-D64VSp1B.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-DEE3meII.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 e(n,r).map(e=>{let n=e??{},o=t(n.value,r);return{label:t(n.label,r),value:d(o),shown:i(o),max:n.max===void 0?null:d(t(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:e,data:n}){let a=t(e.value,n),o=t(e.max??100,n),s=t(e.unit,n),c=r(e,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:t(e.label,n)})]})}function v({c:e,data:r}){let a=t(e.unit,r),c=d(t(e.max??100,r)),p=m(e.items,r).filter(e=>e.label||e.shown).map(t=>t.state===`neutral`&&t.shown?{...t,state:s(t.value,e.thresholds)}:t);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:e,data:r}){let i=t(e.unit,r),a=m(e.items,r).filter(e=>e.label||e.shown).sort((e,t)=>t.value-e.value).slice(0,e.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-D0av_G5P.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{v as e,y as t}from"./share-D64VSp1B.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=e(r.images,i).map(e=>t(e,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:e,data:a}){let d=t(e.value,a),f=t(e.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-DI35kQ5D.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 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
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{c as e,v as t,y as n}from"./share-D64VSp1B.js";import{jsx as r,jsxs as i}from"preact/jsx-runtime";var a={good:`Good`,warning:`Warning`,danger:`Danger`};function o(t,r){let i=t===void 0?``:n(t,r);return e(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(e,t){return e.type!==`stat`&&e.type!==`meter`?`neutral`:e.state===void 0?s(c(n(e.value,t)),e.thresholds):o(e.state,t)}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(t,r){let i=t.trend===void 0?``:n(t.trend,r);return e(f,i)?{dir:i,tone:!t.good_when||i===`flat`?`neutral`:i===t.good_when?`good`:`danger`}:null}function m({c:e,data:t}){let a=p(e,t);if(!a)return null;let o=n(e.delta,t);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:e,data:o}){let s=n(e.unit,o),c=l(e,o),u=n(e.label,o)||a[c]||``;return/* @__PURE__ */ i(`div`,{class:`c-stat`,"data-fit":`line`,"data-kind":`stat`,"data-own-size":e.match_row===!1?``:void 0,children:[/* @__PURE__ */ i(`div`,{class:`c-stat-value`,children:[g(n(e.value,o),e.format)||`—`,s&&/* @__PURE__ */ r(`span`,{class:`c-stat-unit`,children:s}),/* @__PURE__ */ r(m,{c:e,data:o})]}),e.spark&&/* @__PURE__ */ r(v,{values:t(e.spark,o),data:o}),u&&/* @__PURE__ */ i(`div`,{class:`c-stat-label`,children:[c!==`neutral`&&/* @__PURE__ */ r(d,{state:c}),u]})]})}function v({values:e,data:t}){let a=e.map(e=>parseFloat(n(e,t).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-DEE3meII.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{createContext as e}from"preact";import{useContext as t,useEffect as n,useState as r}from"preact/hooks";var i=/* @__PURE__ */ new Set,a;function o(){let e=6e4-Date.now()%6e4+20;a=setTimeout(()=>{let e=/* @__PURE__ */ new Date;i.forEach(t=>t(e)),o()},e)}function s(e){return i.add(e),a===void 0&&o(),()=>{i.delete(e),i.size===0&&a!==void 0&&(clearTimeout(a),a=void 0)}}var c=e({}),l=()=>t(c),u=e=>e.now&&!Number.isNaN(e.now.getTime())?e.now:void 0;function d(){let e=u(l()),[t,i]=r(()=>/* @__PURE__ */ new Date);return n(()=>e?void 0:s(i),[e]),e??t}var f=/* @__PURE__ */ new Map;function p(e,t,n=t.timeZone||void 0){let r=t.locale||void 0,i=JSON.stringify([r,n,e]),a=f.get(i);return a||(a=new Intl.DateTimeFormat(r,{...e,timeZone:n}),f.set(i,a)),a}function m(e,t,n,r={}){return p({hour:`2-digit`,minute:`2-digit`,hour12:n},r,t).format(e)}function h(e,t={}){let n=p({hour:`2-digit`,minute:`2-digit`,hour12:!1},t).formatToParts(e),r=e=>Number(n.find(t=>t.type===e)?.value??0);return r(`hour`)%24*60+r(`minute`)}function g(e,t,n={}){return p({hour:`2-digit`,minute:`2-digit`,hour12:t},n).format(e)}function _(e,t={}){return p({weekday:`long`,day:`numeric`,month:`long`},t).format(e)}function v(e,t){let n=Math.ceil((e.getTime()-t.getTime())/6e4);if(!(n>0))return``;let r=Math.floor(n/1440),i=Math.floor(n%1440/60),a=n%60;return r>0?`${r} d ${i} h`:i>0?`${i} h ${a} min`:`${a} min`}export{_ as a,l as c,v as i,g as n,h as o,m as r,d as s,c as t};
|
|
2
|
+
//# sourceMappingURL=time-KYYBrpD9.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-D64VSp1B.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
|
|
|
@@ -6,5 +6,5 @@ import{o as e,r as t}from"./chunks/share-CtG_q4RM.js";import{readFileSync as n}f
|
|
|
6
6
|
[--size fullhd,portrait,1366x768] [--scheme dark|light] [--accent #hex] [--tz Europe/Berlin]
|
|
7
7
|
[--locale de-DE] [--now 2026-11-14T09:30] [--problems]
|
|
8
8
|
[--base https://your.site/preview/]
|
|
9
|
-
Prints a link to the preview page with the screen packed into it.`,i=/* @__PURE__ */ new Set([`problems`]);function a(e){let t=[],n={};for(let r=0;r<e.length;r++){let a=e[r];a.startsWith(`--`)
|
|
9
|
+
Prints a link to the preview page with the screen packed into it.`,i=/* @__PURE__ */ new Set([`problems`]);function a(e){let t=[],n={};for(let r=0;r<e.length;r++){let a=e[r];if(!a.startsWith(`--`)){t.push(a);continue}let o=a.indexOf(`=`),s=o<0?a.slice(2):a.slice(2,o);n[s]=o>=0?a.slice(o+1):i.has(s)?!0:e[++r]??``}return{files:t,flags:n}}var o=e=>typeof e==`string`&&e?e:void 0;async function s(t,n,r){let i=await e(t,n,{scheme:r.scheme===`light`?`light`:`dark`,accent:o(r.accent)});for(let e of i.errors)console.log(`error ${e}`);for(let e of i.warnings)console.log(`warning ${e}`);return console.log(i.errors.length+i.warnings.length===0?`ok: no problems found`:`${i.errors.length} error(s), ${i.warnings.length} warning(s)`),+!!i.errors.length}async function c(e,n,r){let i={mode:o(r.mode),size:o(r.size),scheme:o(r.scheme),accent:o(r.accent),timeZone:o(r.tz),locale:o(r.locale),base:o(r.base),problems:r.problems===!0,now:o(r.now)};return console.log(await t(e,n,i)),0}async function l(e){let[t,...i]=e,{files:o,flags:l}=a(i),u=t===`check`?s:t===`url`?c:null;if(!u||!o[0])return console.error(r),2;let d,f;try{d=n(o[0],`utf8`),f=o[1]?n(o[1],`utf8`):void 0}catch(e){return console.error(`signagekit: ${e.message}`),2}return u(d,f,l)}export{a as parseArgs,l as run};
|
|
10
10
|
//# sourceMappingURL=cli.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_ as e,c as t,d as n,f as r,g as i,h as a,i as o,l as s,m as c,n as l,o as u,p as d,r as f,s as p,t as m,u as h,v as g}from"./chunks/share-CtG_q4RM.js";import{a as ee,n as te,r as ne}from"./chunks/stat-DIAOyDND.js";import{t as _}from"./chunks/empty--6iNLsra.js";import{c as v,i as re,o as ie,r as ae,s as oe,t as se}from"./chunks/time-sq9LV8dr.js";import{n as ce,t as y}from"./chunks/ready-DI3QO8E5.js";import{t as le}from"./chunks/qr-size-Dq23do6_.js";import{render as b}from"preact";import{useEffect as x,useLayoutEffect as ue,useRef as de,useState as S}from"preact/hooks";import{Fragment as fe,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 x(()=>{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 pe({c:t,data:n}){let r=de(null),[i,a]=S(null),o=e=>`a-${t.align?.[e]??`start`}`,s=e(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(ue(()=>{r.current&&(r.current.__autoPage=e=>a(t=>t===e?t:e))},[]),x(()=>{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((e,t)=>/* @__PURE__ */ C(`tr`,{class:Math.floor(t/c)===f?``:`off-page`,children:(Array.isArray(e)?e:[]).map((e,t)=>{let r=g(e,n);return/* @__PURE__ */ C(`td`,{class:`${o(t)}${r?``:` is-missing`}`,children:r||`—`},t)})},t))})]})}var k=[`info`,`good`,`warning`,`danger`],me={info:`info`,good:`check`,warning:`warning`,danger:`danger`};function A(e,t,n){let r=e[t];return typeof r==`string`||typeof r==`number`||i(r)?g(r,n):``}function he(t,n,r){if(!t)return null;let o=i(t)?a(n,t.bind):t;if(!o||typeof o!=`object`||Array.isArray(o))return null;let c=o,l=A(c,`title`,n),u=A(c,`message`,n)||A(c,`text`,n);if((c.text!==void 0&&c.message===void 0||!l)&&!u)return null;let d=Date.parse(A(c,`until`,n));if(!Number.isNaN(d)&&d<=r.getTime())return null;let f=A(c,`level`,n)||A(c,`state`,n),p=k.includes(f)?f:`danger`,m=A(c,`icon`,n),h=Array.isArray(c.steps)||i(c.steps)?e(c.steps,n).map(e=>g(e,n)).filter(Boolean):[];return{level:p,icon:s(m)?m:me[p],title:l,message:u,steps:h,footer:A(c,`footer`,n),mode:A(c,`mode`,n)===`banner`?`banner`:`takeover`}}function ge(e,t){return he(e,t,v())}function _e({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 ve({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 j({a:e}){return e.mode===`banner`?/* @__PURE__ */ C(ve,{a:e}):/* @__PURE__ */ C(_e,{a:e})}var M={chart:()=>import(`./chunks/chart-DT-Y4YWA.js`).then(e=>e.Chart),meter:()=>import(`./chunks/measures-_ZIjSN7n.js`).then(e=>e.MeterView),meters:()=>import(`./chunks/measures-_ZIjSN7n.js`).then(e=>e.MetersView),bars:()=>import(`./chunks/measures-_ZIjSN7n.js`).then(e=>e.BarsView),split:()=>import(`./chunks/measures-_ZIjSN7n.js`).then(e=>e.SplitView),status:()=>import(`./chunks/lists-DYyvtVni.js`).then(e=>e.StatusView),schedule:()=>import(`./chunks/lists-DYyvtVni.js`).then(e=>e.ScheduleView),queue:()=>import(`./chunks/lists-DYyvtVni.js`).then(e=>e.QueueView),clocks:()=>import(`./chunks/lists-DYyvtVni.js`).then(e=>e.ClocksView),slideshow:()=>import(`./chunks/media-DI-zWZSx.js`).then(e=>e.SlideshowView),qr:()=>import(`./chunks/media-DI-zWZSx.js`).then(e=>e.QrView)},ye=e=>e in M,N=/* @__PURE__ */ new Map,P=/* @__PURE__ */ new Map,be=e=>N.get(e);function F(e){let t=P.get(e);return t||(t=M[e]().then(t=>(N.set(e,t),t)),P.set(e,t)),t}function xe(e,t){t.add(e.type),e.icon&&t.add(`icon`),e.type===`stack`&&e.items.forEach(e=>xe(e,t))}function Se(e){let t=/* @__PURE__ */ new Set;return Object.values(e.zones).forEach(e=>xe(e,t)),t}function Ce(e){if(!e)return Promise.resolve();let t=Se(e),n=t.has(`icon`)||e.alert?[D()]:[],r=Promise.all([...[...t].filter(ye).map(F),...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),le(e)}var Qe={s:24,m:32,l:48,xl:64};function $e({c:e,data:t}){return g(e.text,t)?/* @__PURE__ */ C(`h1`,{class:`c-heading a-${e.align??`start`}`,"data-fit":`wrap`,"data-kind":`heading`,children:g(e.text,t)}):/* @__PURE__ */ C(_,{text:`—`})}function et({c:e,data:t}){if(!g(e.text,t))return/* @__PURE__ */ C(_,{});let n=e.fit?{"data-fit":`wrap`,"data-kind":`text`}:{};return/* @__PURE__ */ C(`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:t,data:n}){let r=e(t.items,n).map(e=>g(e,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 nt({c:e,data:t}){let n=g(e.src,t),[r,i]=S(``);return n?r===n?/* @__PURE__ */ C(_,{text:`Image not available`}):/* @__PURE__ */ C(`img`,{class:`c-image`,src:n,alt:e.alt??``,decoding:`async`,onError:()=>i(n),style:{objectFit:e.fit??`cover`}}):/* @__PURE__ */ C(_,{text:`No image`})}function rt({c:e}){let t=v();return/* @__PURE__ */ w(`div`,{class:`c-clock`,"data-fit":`line`,"data-kind":`clock`,children:[/* @__PURE__ */ C(`div`,{class:`c-clock-time`,children:se(t,e.hour12)}),e.show_date&&/* @__PURE__ */ C(`div`,{class:`c-clock-date`,children:re(t)})]})}function it({c:e,data:t}){let n=v(),r=new Date(g(e.to,t)),i=g(e.label,t);return/* @__PURE__ */ w(`div`,{class:`c-stat`,"data-fit":`line`,"data-kind":`countdown`,children:[/* @__PURE__ */ C(`div`,{class:`c-stat-value`,children:isNaN(r.getTime())?`—`:ae(r,n)||g(e.done,t)||`Now`}),i&&/* @__PURE__ */ C(`div`,{class:`c-stat-label`,children:i})]})}function at({c:t,data:n}){let r=de(null),i=e(t.items,n).map(e=>g(e,n)).filter(Boolean),a=i.join(`
|
|
2
|
-
`),[o
|
|
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
|
+
`),[a,o]=x(0);return de(()=>{let e=n.current;e&&(e.__messages=r,V(e,r))},[i]),b(()=>{if(r.length<2)return;let t=setInterval(()=>o(e=>e+1),(e.seconds??8)*1e3);return()=>clearInterval(t)},[i,e.seconds]),r.length?/* @__PURE__ */ S(`div`,{class:`c-cycle a-${e.align??`start`}`,ref:n,"data-kind":`cycle`,children:r[a%r.length]??``}):/* @__PURE__ */ S(_,{})}function ot({c:e,data:t}){return/* @__PURE__ */ S(`div`,{class:`c-stack d-${e.direction??`column`}`,children:e.items.map((e,n)=>/* @__PURE__ */ S(ut,{c:e,data:t},n))})}var st=3e4;function Z({c:e,data:t}){let n=e.type,[r,i]=x(()=>xe(n)),[a,o]=x(0);return b(()=>{if(r)return;let e=!1,t;return P(n).then(t=>{e||i(()=>t)},n=>{console.error(`signagekit: chunk failed`,n),e||(t=setTimeout(()=>o(e=>e+1),st))}),()=>{e=!0,clearTimeout(t)}},[n,r,a]),r?/* @__PURE__ */ S(r,{c:e,data:t}):null}var ct={heading:$e,text:et,stat:te,table:me,list:tt,image:nt,clock:rt,countdown:it,cycle:at,chart:Z,stack:ot,meter:Z,meters:Z,bars:Z,split:Z,status:Z,schedule:Z,queue:Z,clocks:Z,slideshow:Z,qr:Z};function lt({c:e,data:t}){let n=ct[e.type];return/* @__PURE__ */ S(n,{c:e,data:t})}function ut({c:e,data:t}){let n=typeof e.size==`number`?String(e.size):void 0,r=ee(e,t),i=m(e.icon)?e.icon:null,a=`title${r===`neutral`?``:` has-state`}${i?` has-icon`:``}`,o=g(e.title,t);return/* @__PURE__ */ C(`div`,{class:`cell s-${e.surface??`base`} k-${e.type} state-${r}`,"data-size":n,style:e.weight?{flexGrow:e.weight}:void 0,children:[o&&/* @__PURE__ */ C(`div`,{class:a,children:[r!==`neutral`&&/* @__PURE__ */ S(`span`,{class:`title-state`,children:/* @__PURE__ */ S(ne,{state:r})}),i&&/* @__PURE__ */ S(D,{name:i,cls:`title-icon`}),/* @__PURE__ */ S(`span`,{children:o})]}),/* @__PURE__ */ S(`div`,{class:`body`,children:/* @__PURE__ */ S(lt,{c:e,data:t})})]})}function dt(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 ft({zones:e,layout:t,data:n,alert:r}){let i=_e(r,n);return i?.mode===`takeover`?/* @__PURE__ */ S(A,{a:i}):/* @__PURE__ */ C(`div`,{class:`screen`,children:[i&&/* @__PURE__ */ S(A,{a:i}),/* @__PURE__ */ S(`div`,{class:`grid`,style:dt(t),children:Object.entries(e).map(([e,t])=>/* @__PURE__ */ S(`div`,{class:`zone`,style:{gridArea:e},children:/* @__PURE__ */ S(ut,{c:t,data:n})},e))})]})}function pt({errors:e,warnings:t}){return e.length+t.length===0?null:/* @__PURE__ */ C(`div`,{class:`problems`,role:`status`,children:[e.map((e,t)=>/* @__PURE__ */ C(`div`,{children:[`Error: `,e]},`e`+t)),t.map((e,t)=>/* @__PURE__ */ C(`div`,{children:[`Warning: `,e]},`w`+t))]})}var mt=.75;function ht(e,t){return e>=t?[Math.round(1080*e/t),1080]:[1080,Math.round(1080*t/e)]}var gt=e=>`flow`in e,_t=e=>typeof e==`string`?{zone:e}:e,Q=e=>e.reduce((e,t)=>e+t,0);function $(e,t){let n=Q(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-Q(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 vt(e){if(Q(e.wants)<=12){let t=$(12-Q(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=$(12-Q(e.mins),Q(t)>0?t:e.wants);return e.mins.map((e,t)=>e+n[t])}function yt(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 bt(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}=_t(t),l=Math.min(12,Math.max(1,Math.round(s/12*n/i))),u=Math.max(1,Math.ceil(l*mt)),d=typeof c==`string`,f=r&&Q(o?.designed??[])>=12,p=o!==void 0&&(Q(o.wants)+l<=12||!f&&Q(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=vt(e);return e.zones.flatMap((e,n)=>Array(t[n]).fill(e)).join(` `)}),columns:`repeat(12, 1fr)`,rows:a.map(yt).join(` `),gap:e.gap}}function xt(e,t){return gt(e)?bt(e,t):e}function St(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 Ct(e,t){let n=e.clientWidth||1920,[r,i]=ht(n,e.clientHeight||1080);return t.style.width=r+`px`,t.style.height=i+`px`,t.style.transform=`scale(${n/r})`,r}async function wt(e){await Promise.race([Ce(e.doc).catch(e=>console.error(`signagekit: chunk failed`,e)),new Promise(e=>setTimeout(e,5e3))])}function Tt(e,t,n,r,a,o){let c=i({...t.doc?.colors,...r.colors},r.scheme??`dark`,r.accent??`#2563eb`);s(c,e),y(/* @__PURE__ */ C(pe,{children:[t.doc&&/* @__PURE__ */ S(se.Provider,{value:a,children:/* @__PURE__ */ S(ft,{zones:t.doc.zones,layout:xt(t.doc.layout,n),alert:t.doc.alert,data:t.data})}),r.showProblems&&/* @__PURE__ */ S(pt,{errors:[...t.errors,...o],warnings:t.warnings})]}),e),Ze(e)}async function Et(e,t){let n={timeZone:t.timeZone,locale:t.locale,now:t.now},r={scheme:t.scheme,accent:t.accent,colors:t.colors},i=St(e),a=Ct(e,i),o=t.layout,s=await l(o,t.data,r),c=[],u=()=>Tt(i,s,a,t,n,c);await wt(s),u(),await le();let d=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{a=Ct(e,i),u()});return d?.observe(e),{get errors(){return[...s.errors,...c]},get warnings(){return s.warnings},async update(e){e.layout!==void 0&&(o=e.layout),s=await l(o,e.data??s.data,r),e.layout!==void 0&&await wt(s),u(),await le()},report(e){c.push(e),u()},destroy(){d?.disconnect(),y(null,i),i.remove()}}}var Dt=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])),Ot={"720p":`hd`,"1080p":`fullhd`,fhd:`fullhd`,"1440p":`qhd`,uhd:`4k`,"2160p":`4k`,"fullhd-portrait":`portrait`},kt=[`fullhd`,`portrait`,`xga`,`ultrawide`,`square`];function At(e){let t=e.trim().toLowerCase(),n=Dt[Ot[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{n as COLOR_KEYS,kt as DEFAULT_SIZES,t as FORMAT,o as ICON_NAMES,O as LEVELS,p as PREVIEW_BASE,u as SCHEMES,Dt as SIZES,ht as canvasSize,l as check,Et as mount,c as pack,At as parseSize,d as previewUrl,a as unpack,f as validate};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/types/checks.d.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
export type Obj = Record<string, unknown>;
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Pushes problems that drop the part to `errs`. Problems the part renders
|
|
4
|
+
* through, like an unknown property, go to `warns` when the caller passes it.
|
|
5
|
+
*/
|
|
6
|
+
export type Check = (v: unknown, at: string, errs: string[], warns?: string[]) => void;
|
|
7
|
+
/** Own keys only, so a name like "constructor" never matches Object's. */
|
|
8
|
+
export declare const has: (o: object, k: string) => boolean;
|
|
3
9
|
export declare const isObj: (v: unknown) => v is Obj;
|
|
4
10
|
export declare const isBind: (v: unknown) => boolean;
|
|
5
11
|
export declare const value: Check;
|
package/dist/types/lists.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type TimeOptions } from './time';
|
|
1
2
|
import type { Clocks, Data, Queue, Schedule, Status } from './types';
|
|
2
3
|
export declare function StatusView({ c, data }: {
|
|
3
4
|
c: Status;
|
|
@@ -11,9 +12,9 @@ export interface Entry {
|
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
13
14
|
* Entries from the current one onward. An entry ends at its `end`, else when
|
|
14
|
-
* the next
|
|
15
|
+
* the next later entry of the same kind starts, else an hour after it starts.
|
|
15
16
|
*/
|
|
16
|
-
export declare function upcoming(raw: unknown[], data: Data, now: Date, limit: number): Entry[];
|
|
17
|
+
export declare function upcoming(raw: unknown[], data: Data, now: Date, limit: number, time?: TimeOptions): Entry[];
|
|
17
18
|
export declare function ScheduleView({ c, data }: {
|
|
18
19
|
c: Schedule;
|
|
19
20
|
data: Data;
|
package/dist/types/time.d.ts
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
type Listener = (now: Date) => void;
|
|
2
|
-
export declare function setFixedTime(d: Date | undefined): void;
|
|
3
|
-
export declare const currentTime: () => Date;
|
|
4
2
|
export declare function onMinute(fn: Listener): () => void;
|
|
3
|
+
/**
|
|
4
|
+
* Time zone, locale and an optional frozen clock for one mounted screen.
|
|
5
|
+
* Each mount() provides its own, so screens on one page don't share them.
|
|
6
|
+
*/
|
|
7
|
+
export interface TimeOptions {
|
|
8
|
+
timeZone?: string;
|
|
9
|
+
locale?: string;
|
|
10
|
+
/**
|
|
11
|
+
* A fixed time stops the clock, so screenshots of clocks, schedules and
|
|
12
|
+
* countdowns come out the same on every run.
|
|
13
|
+
*/
|
|
14
|
+
now?: Date;
|
|
15
|
+
}
|
|
16
|
+
export declare const TimeContext: import("preact").Context<TimeOptions>;
|
|
17
|
+
export declare const useTimeOptions: () => TimeOptions;
|
|
18
|
+
/** The current time, updated each minute, or the screen's fixed time. */
|
|
5
19
|
export declare function useMinute(): Date;
|
|
6
|
-
export declare function setTimeContext(tz: string | undefined, loc: string | undefined): void;
|
|
7
20
|
/** The time in another zone, for world clocks. */
|
|
8
|
-
export declare function formatClockIn(now: Date, zone: string, hour12: boolean | undefined): string;
|
|
21
|
+
export declare function formatClockIn(now: Date, zone: string, hour12: boolean | undefined, t?: TimeOptions): string;
|
|
9
22
|
/** Minutes since midnight on the screen's clock, for "HH:MM" schedules. */
|
|
10
|
-
export declare function minutesOfDay(now: Date): number;
|
|
11
|
-
export declare function formatClock(now: Date, hour12: boolean | undefined): string;
|
|
12
|
-
export declare function formatDate(now: Date): string;
|
|
23
|
+
export declare function minutesOfDay(now: Date, t?: TimeOptions): number;
|
|
24
|
+
export declare function formatClock(now: Date, hour12: boolean | undefined, t?: TimeOptions): string;
|
|
25
|
+
export declare function formatDate(now: Date, t?: TimeOptions): string;
|
|
13
26
|
/** "3 d 4 h", "4 h 12 min", "12 min", or "" once the time has passed. */
|
|
14
27
|
export declare function formatCountdown(to: Date, now: Date): string;
|
|
15
28
|
export {};
|
package/docs/api.md
CHANGED
|
@@ -22,12 +22,12 @@ Without a bundler, load it as a module with an import map. The YAML parser, uPlo
|
|
|
22
22
|
```html
|
|
23
23
|
<link
|
|
24
24
|
rel="stylesheet"
|
|
25
|
-
href="https://cdn.jsdelivr.net/npm/@514sid/signagekit@0.0.
|
|
25
|
+
href="https://cdn.jsdelivr.net/npm/@514sid/signagekit@0.0.2/dist/style.css"
|
|
26
26
|
/>
|
|
27
27
|
<script type="importmap">
|
|
28
28
|
{
|
|
29
29
|
"imports": {
|
|
30
|
-
"@514sid/signagekit": "https://cdn.jsdelivr.net/npm/@514sid/signagekit@0.0.
|
|
30
|
+
"@514sid/signagekit": "https://cdn.jsdelivr.net/npm/@514sid/signagekit@0.0.2/dist/index.js",
|
|
31
31
|
"preact": "https://cdn.jsdelivr.net/npm/preact@10.27.2/dist/preact.module.js",
|
|
32
32
|
"preact/hooks": "https://cdn.jsdelivr.net/npm/preact@10.27.2/hooks/dist/hooks.module.js",
|
|
33
33
|
"preact/jsx-runtime": "https://cdn.jsdelivr.net/npm/preact@10.27.2/jsx-runtime/dist/jsxRuntime.module.js",
|
|
@@ -60,7 +60,7 @@ Renders a document into `element` and resolves with a handle once the screen is
|
|
|
60
60
|
| `showProblems` | `false` | Shows errors and warnings over the screen. Useful while building. |
|
|
61
61
|
| `now` | live clock | A `Date` that freezes the clock, for screenshots and tests. |
|
|
62
62
|
|
|
63
|
-
`timeZone` and `
|
|
63
|
+
`timeZone`, `locale` and `now` belong to the screen they are given to: several screens on one page can each use their own.
|
|
64
64
|
|
|
65
65
|
The handle has:
|
|
66
66
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@514sid/signagekit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
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",
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,v as t}from"./share-CtG_q4RM.js";import{n}from"./ready-DI3QO8E5.js";import{t as r}from"./empty--6iNLsra.js";import{useLayoutEffect as i,useRef as a}from"preact/hooks";import{jsx as o,jsxs as s}from"preact/jsx-runtime";var c,l=()=>c??(c=import(`uplot`).then(e=>e.default));function u(e){let t=typeof e==`number`?e:parseFloat(String(e).replace(/,/g,``));return Number.isFinite(t)?t:null}function d(n,r){let i=e(n.labels,r).map(e=>t(e,r));return{labels:i,series:n.series.map(n=>({name:t(n.name,r),values:i.map((t,i)=>u(e(n.values,r)[i]))})),target:n.target===void 0?null:u(t(n.target,r)),targetLabel:t(n.target_label,r)}}var f=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1}),p=e=>e===null?``:Math.abs(e)>=1e4?f.format(e):e.toLocaleString(),m=e=>[...e].reverse().find(e=>e!==null)??null;function h(e,t){return getComputedStyle(e).getPropertyValue(t).trim()}function g(e,t){let n=parseInt(e.slice(1),16);return`rgba(${n>>16&255}, ${n>>8&255}, ${n&255}, ${t})`}function _(e,t){return{fontSize:Math.round(Math.max(16,Math.min(28,e.clientHeight/16))),muted:h(e,`--muted`),line:h(e,`--line`),text:h(e,`--text`),background:h(e,`--background`),colors:t.series.map((t,n)=>h(e,`--series-${n+1}`))}}function v(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=>p(e)),size:(e,n)=>Math.max(...(n??[``]).map(e=>e.length))*t.fontSize*.62+t.fontSize}]}function y(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`?g(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 b(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(p(e),o,s-t.fontSize*.35*r)}),i.restore()}}function x(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 ${p(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 S(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 C(e,t,n){let r=await l(),i=e.clientWidth,a=e.clientHeight;if(!i||!a)return()=>{};let o=_(e,n),s=new r({width:i,height:a,padding:[o.fontSize,o.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:S(t,n)}},axes:v(n,o,i),series:y(r,t,n,o),hooks:{draw:[...t.kind===`column`?[b(n,o)]:[],x(n,o)]}},[n.labels.map((e,t)=>t),...n.series.map(e=>e.values)],e);return()=>s.destroy()}function w({c:e,data:t}){let c=a(null),l=d(e,t),u=JSON.stringify([e,l]);return i(()=>{let t=c.current;if(!t)return;let r,i=!1,a=C(t,e,l).then(e=>{i?e():r=e});return n(a),()=>{i=!0,r?.()}},[u]),!l.labels.length||l.series.every(e=>e.values.every(e=>e===null))?/* @__PURE__ */ o(r,{text:`No data`}):/* @__PURE__ */ s(`div`,{class:`c-chart`,children:[l.series.length>1&&/* @__PURE__ */ o(`div`,{class:`c-chart-legend`,children:l.series.map((e,t)=>/* @__PURE__ */ s(`span`,{class:`c-chart-key`,children:[/* @__PURE__ */ o(`span`,{class:`c-chart-swatch`,style:{background:`var(--series-${t+1})`}}),e.name,/* @__PURE__ */ o(`strong`,{children:p(m(e.values))})]},t))}),/* @__PURE__ */ o(`div`,{class:`c-chart-plot`,ref:c})]})}export{w as Chart};
|
|
2
|
-
//# sourceMappingURL=chart-DT-Y4YWA.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,v as t}from"./share-CtG_q4RM.js";import{t as n}from"./empty--6iNLsra.js";import{i as r,o as i,r as a}from"./stat-DIAOyDND.js";import{a as o,c as s,n as c,t as l}from"./time-sq9LV8dr.js";import{jsx as u,jsxs as d}from"preact/jsx-runtime";function f({c:r,data:o}){let s=e(r.items,o).filter(e=>e&&t(e.label,o));return s.length?/* @__PURE__ */ u(`ul`,{class:`c-status`,"data-fit":`wrap`,"data-kind":`status`,children:s.map((e,n)=>{let r=e??{},s=i(r.state,o);return/* @__PURE__ */ d(`li`,{children:[s===`neutral`?/* @__PURE__ */ u(`span`,{class:`c-status-dot`}):/* @__PURE__ */ u(a,{state:s}),/* @__PURE__ */ u(`span`,{class:`c-status-label`,children:t(r.label,o)}),/* @__PURE__ */ u(`span`,{class:`c-status-note`,children:t(r.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(e,n,r,i){let a={day:o(r),abs:r.getTime()},s={day:60,abs:36e5},c=e.map(e=>e??{}).map(e=>({r:e,start:m(t(e.start,n))})).filter(e=>e.start!==null).sort((e,t)=>e.start.at-t.start.at),l=c.filter((e,r)=>{let i=e.start;return(m(t(e.r.end,n))?.at??c[r+1]?.start?.at??i.at+s[i.kind])>a[i.kind]}),u=!1;return l.slice(0,i).map(e=>{let r=e.start.at<=a[e.start.kind],i=r?`now`:u?``:`next`;return r||(u=!0),{start:t(e.r.start,n),title:t(e.r.title,n),detail:t(e.r.detail,n),tag:i}})}function g(e){if(p.test(e.trim()))return e.trim();let t=Date.parse(e);return Number.isNaN(t)?e:l(new Date(t),void 0)}function _({c:t,data:n}){let r=s(),i=h(e(t.items,n),n,r,t.rows??5);return/* @__PURE__ */ d(`ol`,{class:`c-schedule`,"data-fit":`wrap`,"data-kind":`schedule`,children:[i.length===0&&/* @__PURE__ */ u(`li`,{class:`c-schedule-empty`,children:`Nothing more today`}),i.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)}),/* @__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:i}){let a=n.recent?e(n.recent,i):[];return/* @__PURE__ */ d(`div`,{class:`c-queue`,"data-fit":`wrap`,"data-kind":`queue`,children:[/* @__PURE__ */ u(`div`,{class:`c-stat-label`,children:t(n.label,i)||`Now serving`}),/* @__PURE__ */ u(`div`,{class:`c-queue-current`,children:r(t(n.current,i),`full`)||`—`}),a.length>0&&/* @__PURE__ */ u(`div`,{class:`c-queue-recent`,children:a.slice(0,6).map((e,n)=>/* @__PURE__ */ u(`span`,{children:t(e,i)},n))})]})}function y({c:e,data:n}){let r=s();return/* @__PURE__ */ u(`ul`,{class:`c-clocks`,"data-fit":`wrap`,"data-kind":`clocks`,children:e.zones.map((i,a)=>/* @__PURE__ */ d(`li`,{children:[/* @__PURE__ */ u(`span`,{class:`c-clocks-label`,children:t(i.label,n)}),/* @__PURE__ */ u(`span`,{class:`c-clocks-time`,children:c(r,i.timezone??i.zone??`UTC`,e.hour12)})]},a))})}export{y as ClocksView,v as QueueView,_ as ScheduleView,f as StatusView};
|
|
2
|
-
//# sourceMappingURL=lists-DYyvtVni.js.map
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{_ as e,v as t}from"./share-CtG_q4RM.js";import{t as n}from"./empty--6iNLsra.js";import{t as r}from"./qr-size-Dq23do6_.js";import{n as i}from"./ready-DI3QO8E5.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=e(r.images,i).map(e=>t(e,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));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:e,data:a}){let d=t(e.value,a),f=t(e.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)})});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-DI-zWZSx.js.map
|
|
@@ -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 g(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 _(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 re(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?pe(e,t):me(e,t):(t.push(`layout: expected an object with "flow" or "areas"`),[])}var de=/^\d+(\.\d+)?px$/,C=[`zone`,`span`,`height`];function fe(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))C.includes(r)||n.push(`${t}.${r}: unknown property, expected zone, span or height`);return e.zone}function pe(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=fe(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 me(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 w=/* @__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(`.`),T=e=>typeof e==`string`&&w.includes(e),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`)},he=(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)=>{if(!D(t)){if(!Array.isArray(t))return void r.push(`${n}: expected an array or {"bind": "/path"}`);t.forEach((t,i)=>e(t,`${n}[${i}]`,r))}},ge=(e,t,n)=>{(!Array.isArray(e)||e.some(e=>typeof e!=`string`))&&n.push(`${t}: expected an array of strings`)},N=(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)})},P=(e,t,n)=>D(e)?void 0:k(`neutral`,`good`,`warning`,`danger`)(e,t,n),F=k(`start`,`center`,`end`),I=k(`base`,`raised`,`accent`),L=(e,t)=>(n,r,i)=>{Number.isInteger(n)&&n>=e&&n<=t||i.push(`${r}: expected a whole number from ${e} to ${t}`)},R=(e,t={})=>(n,r,i)=>{if(E(n)){for(let[t,a]of Object.entries(e))t in n?a(n[t],`${r}.${t}`,i):i.push(`${r}.${t}: required`);for(let[a,o]of Object.entries(n))a in e||(t[a]?t[a](o,`${r}.${a}`,i):i.push(`${r}.${a}: unknown property`))}else{let t=Object.keys(e).join(`, `);i.push(`${r}: expected an object with ${t}`)}},z=R({label:O,value:O},{max:O,state:P}),B=(e,t)=>(n,r,i)=>{if(Array.isArray(n)&&n.length>t)return void i.push(`${r}: at most ${t} items`);M(e)(n,r,i)},V=(e,t,n)=>_e(e,t,n),_e=(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"`)}},H=(e,t)=>(n,r,i)=>{typeof n==`number`&&n>=e&&n<=t||i.push(`${r}: expected a number from ${e} to ${t}`)},U=(e,t,n)=>{typeof e==`number`&&Number.isFinite(e)||n.push(`${t}: expected a number`)},W=R({},{warning:U,danger:U}),G=U,K={heading:{required:{text:O},optional:{align:F}},text:{required:{text:O},optional:{size:k(`s`,`m`,`l`,`xl`),align:F,fit:A}},stat:{required:{value:O},optional:{label:O,unit:O,state:P,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:W,spark:M(O)}},table:{required:{columns:ge,rows:M(M(O))},optional:{align:(e,t,n)=>Array.isArray(e)?e.forEach((e,r)=>F(e,`${t}[${r}]`,n)):n.push(`${t}: expected an array`),page_rows:L(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:he}},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:N},optional:{target:O,target_label:O,y_min:G,y_max:G}},cycle:{required:{items:M(O)},optional:{seconds:j,align:F}},stack:{required:{items:()=>{}},optional:{direction:k(`row`,`column`)}},meter:{required:{value:O},optional:{max:O,label:O,unit:O,state:P,thresholds:W}},meters:{required:{items:M(z)},optional:{max:O,unit:O,thresholds:W}},bars:{required:{items:M(z)},optional:{unit:O,limit:L(1,50)}},split:{required:{items:B(z,6)},optional:{}},status:{required:{items:M(R({label:O,state:P},{note:O}))},optional:{}},schedule:{required:{items:M(R({start:O,title:O},{end:O,detail:O}))},optional:{rows:L(1,20)}},queue:{required:{current:O},optional:{recent:M(O),label:O}},clocks:{required:{zones:B((e,t,n)=>{if(E(e)&&`zone`in e&&!(`timezone`in e)){let{zone:r,...i}=e,a=[];R({label:O,timezone:V})({...i,timezone:r},t,a),n.push(...a.map(e=>e.replace(`${t}.timezone`,`${t}.zone`)))}else R({label:O,timezone:V})(e,t,n)},12)},optional:{hour12:A}},slideshow:{required:{images:M(O)},optional:{seconds:j,fit:k(`cover`,`contain`)}},qr:{required:{value:O},optional:{label:O}}},q=4,ve={surface:(e,t,n)=>I(e,t,n),title:(e,t,n)=>O(e,t,n),size:H(8,400),weight:H(.1,20),icon:(e,t,n)=>T(e)?void 0:n.push(`${t}: unknown icon, expected one of ${w.join(`, `)}`)};function ye(e,t,n,r,i){for(let[i,a]of Object.entries(t.required))i in e?a(e[i],`${n}.${i}`,r):r.push(`${n}.${i}: required for ${e.type}`);for(let[a,o]of Object.entries(e)){if(a===`type`||a in t.required)continue;let s=t.optional[a]??ve[a];s?s(o,`${n}.${a}`,r):i.push(`${n}.${a}: unknown property for ${e.type}, ignored`)}}function be(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=K[e.type];if(!a)n.push(`${t}.type: unknown component ${JSON.stringify(e.type)}, expected one of ${Object.keys(K).join(`, `)}`);else if(ye(e,a,t,n,r),e.type===`table`&&be(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>=q)return void n.push(`${t}: stacks nest at most ${q} 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 xe=[`$schema`,`version`,`colors`,`alert`,`layout`,`zones`],Se=R({},{level:(e,t,n)=>D(e)?void 0:k(`info`,`good`,`warning`,`danger`)(e,t,n),icon:(e,t,n)=>D(e)||T(e)?void 0:n.push(`${t}: unknown icon, expected one of ${w.join(`, `)}`),title:O,message:O,text:O,steps:M(O),footer:O,mode:k(`takeover`,`banner`),until:O,state:k(`warning`,`danger`)});function Ce(e,t,n){if(D(e))return O(e,t,n);Se(e,t,n),E(e)&&!(`title`in e)&&!(`message`in e)&&!(`text`in e)&&n.push(`${t}: needs a title or a message`)}function we(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=we(e.colors,t,n),o=[];e.alert!==void 0&&Ce(e.alert,`alert`,o),t.push(...o);let s=e.alert!==void 0&&o.length===0?e.alert:void 0;for(let t of Object.keys(e))xe.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 in e.zones||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 Te=`#2563eb`,Ee=e=>typeof e==`object`&&!!e&&!Array.isArray(e);async function X(e,t){return typeof e==`string`?e.trim()?re(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 X(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 X(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(...g(e))}return{doc:c.doc,data:i,errors:[...c.errors,...r],warnings:l}}var ke=`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 Ae(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 je(e){let t=await Z(Ae(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 Me(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{r as _,Te as a,w as c,o as d,s as f,t as g,e as h,je as i,T as l,p as m,$ as n,Oe as o,_ as p,Me as r,Y as s,ke as t,ie as u,n as v};
|
|
2
|
-
//# sourceMappingURL=share-CtG_q4RM.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{_ as e,v as t}from"./share-CtG_q4RM.js";import{jsx as n,jsxs as r}from"preact/jsx-runtime";var i={good:`Good`,warning:`Warning`,danger:`Danger`};function a(e,n){let r=e===void 0?``:t(e,n);return r in i?r:`neutral`}function o(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 s=e=>parseFloat(e.replace(/,/g,``));function c(e,n){return e.type!==`stat`&&e.type!==`meter`?`neutral`:e.state===void 0?o(s(t(e.value,n)),e.thresholds):a(e.state,n)}var l={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 u({state:e}){let t=l[e];return/* @__PURE__ */ r(`svg`,{class:`c-state-icon is-${e}`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[/* @__PURE__ */ n(`path`,{class:`c-state-shape`,d:t.shape}),t.mark.map(e=>/* @__PURE__ */ n(`path`,{class:`c-state-mark`,d:e},e))]})}var d={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 f(e,n){let r=e.trend===void 0?``:t(e.trend,n);return r in d?{dir:r,tone:!e.good_when||r===`flat`?`neutral`:r===e.good_when?`good`:`danger`}:null}function p({c:e,data:i}){let a=f(e,i);if(!a)return null;let o=t(e.delta,i);return/* @__PURE__ */ r(`span`,{class:`c-stat-trend tone-${a.tone}`,children:[/* @__PURE__ */ n(`svg`,{class:`c-trend-icon`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:d[a.dir].map(e=>/* @__PURE__ */ n(`path`,{d:e},e))}),o]})}var m=new Intl.NumberFormat(void 0,{notation:`compact`,maximumFractionDigits:1});function h(e,t){let n=e.replace(/,/g,``).trim();if(n===``||!/^-?\d+(\.\d+)?$/.test(n))return e;let r=Number(n);return t!==`full`&&Math.abs(r)>=1e4?m.format(r):e.includes(`,`)?e:r.toLocaleString(void 0,{maximumFractionDigits:20})}function g({c:a,data:o}){let s=t(a.unit,o),l=c(a,o),d=t(a.label,o)||i[l]||``;return/* @__PURE__ */ r(`div`,{class:`c-stat`,"data-fit":`line`,"data-kind":`stat`,"data-own-size":a.match_row===!1?``:void 0,children:[/* @__PURE__ */ r(`div`,{class:`c-stat-value`,children:[h(t(a.value,o),a.format)||`—`,s&&/* @__PURE__ */ n(`span`,{class:`c-stat-unit`,children:s}),/* @__PURE__ */ n(p,{c:a,data:o})]}),a.spark&&/* @__PURE__ */ n(_,{values:e(a.spark,o),data:o}),d&&/* @__PURE__ */ r(`div`,{class:`c-stat-label`,children:[l!==`neutral`&&/* @__PURE__ */ n(u,{state:l}),d]})]})}function _({values:e,data:i}){let a=e.map(e=>parseFloat(t(e,i).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__ */ r(`svg`,{class:`c-spark`,viewBox:`0 0 100 30`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[/* @__PURE__ */ n(`polyline`,{points:u}),/* @__PURE__ */ n(`path`,{d:`M${l(d)} ${c(a[d])}h0`})]})}export{c as a,h as i,g as n,a as o,u as r,o as s,i as t};
|
|
2
|
-
//# sourceMappingURL=stat-DIAOyDND.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{useEffect as e,useState as t}from"preact/hooks";var n=/* @__PURE__ */ new Set,r;function i(){let e=6e4-Date.now()%6e4+20;r=setTimeout(()=>{let e=/* @__PURE__ */ new Date;n.forEach(t=>t(e)),i()},e)}var a;function o(e){a=e&&!Number.isNaN(e.getTime())?e:void 0}var s=()=>a??/* @__PURE__ */ new Date;function c(e){return n.add(e),r===void 0&&!a&&i(),()=>{n.delete(e),n.size===0&&r!==void 0&&(clearTimeout(r),r=void 0)}}function l(){let[n,r]=t(s);return e(()=>c(r),[]),n}var u,d;function f(e,t){u=e||void 0,d=t||void 0}var p=/* @__PURE__ */ new Map;function m(e,t=u){let n=JSON.stringify([d,t,e]),r=p.get(n);return r||(r=new Intl.DateTimeFormat(d,{...e,timeZone:t}),p.set(n,r)),r}function h(e,t,n){return m({hour:`2-digit`,minute:`2-digit`,hour12:n},t).format(e)}function g(e){let t=m({hour:`2-digit`,minute:`2-digit`,hour12:!1}).formatToParts(e),n=e=>Number(t.find(t=>t.type===e)?.value??0);return n(`hour`)%24*60+n(`minute`)}function _(e,t){return m({hour:`2-digit`,minute:`2-digit`,hour12:t}).format(e)}function v(e){return m({weekday:`long`,day:`numeric`,month:`long`}).format(e)}function y(e,t){let n=Math.ceil((e.getTime()-t.getTime())/6e4);if(!(n>0))return``;let r=Math.floor(n/1440),i=Math.floor(n%1440/60),a=n%60;return r>0?`${r} d ${i} h`:i>0?`${i} h ${a} min`:`${a} min`}export{g as a,l as c,v as i,h as n,o,y as r,f as s,_ as t};
|
|
2
|
-
//# sourceMappingURL=time-sq9LV8dr.js.map
|