@514sid/signagekit 0.0.0-stage → 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.
Files changed (95) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/LICENSE +44 -0
  3. package/README.md +106 -2
  4. package/bin/signagekit.js +4 -0
  5. package/dist/chunks/chart-WERjiRho.js +2 -0
  6. package/dist/chunks/empty--6iNLsra.js +2 -0
  7. package/dist/chunks/icon-paths-Dl0Rqja7.js +2 -0
  8. package/dist/chunks/lists-qOUpM5us.js +2 -0
  9. package/dist/chunks/measures-D0av_G5P.js +2 -0
  10. package/dist/chunks/media-DI35kQ5D.js +3 -0
  11. package/dist/chunks/qr-size-Dq23do6_.js +2 -0
  12. package/dist/chunks/ready-Boq20M-G.js +2 -0
  13. package/dist/chunks/share-D64VSp1B.js +2 -0
  14. package/dist/chunks/stat-DEE3meII.js +2 -0
  15. package/dist/chunks/time-KYYBrpD9.js +2 -0
  16. package/dist/cli.js +10 -0
  17. package/dist/index.js +3 -0
  18. package/dist/style.css +2 -0
  19. package/dist/types/alert.d.ts +20 -0
  20. package/dist/types/binds.d.ts +6 -0
  21. package/dist/types/chart.d.ts +16 -0
  22. package/dist/types/check.d.ts +31 -0
  23. package/dist/types/checks.d.ts +36 -0
  24. package/dist/types/colors.d.ts +18 -0
  25. package/dist/types/components.d.ts +13 -0
  26. package/dist/types/cycle-fit.d.ts +6 -0
  27. package/dist/types/data.d.ts +19 -0
  28. package/dist/types/empty.d.ts +6 -0
  29. package/dist/types/fit.d.ts +3 -0
  30. package/dist/types/flow.d.ts +7 -0
  31. package/dist/types/icon-paths.d.ts +2 -0
  32. package/dist/types/icon.d.ts +7 -0
  33. package/dist/types/icons.d.ts +3 -0
  34. package/dist/types/index.d.ts +20 -0
  35. package/dist/types/lists.d.ts +29 -0
  36. package/dist/types/measure.d.ts +4 -0
  37. package/dist/types/measures.d.ts +22 -0
  38. package/dist/types/media.d.ts +15 -0
  39. package/dist/types/mount.d.ts +45 -0
  40. package/dist/types/parse.d.ts +11 -0
  41. package/dist/types/qr-size.d.ts +2 -0
  42. package/dist/types/ready.d.ts +3 -0
  43. package/dist/types/share.d.ts +33 -0
  44. package/dist/types/sizes.d.ts +15 -0
  45. package/dist/types/specs.d.ts +7 -0
  46. package/dist/types/stat.d.ts +38 -0
  47. package/dist/types/table-fit.d.ts +8 -0
  48. package/dist/types/table.d.ts +11 -0
  49. package/dist/types/time.d.ts +28 -0
  50. package/dist/types/trend-fit.d.ts +14 -0
  51. package/dist/types/type-scale.d.ts +10 -0
  52. package/dist/types/types.d.ts +271 -0
  53. package/dist/types/validate-layout.d.ts +2 -0
  54. package/dist/types/validate.d.ts +7 -0
  55. package/dist/types/version.d.ts +24 -0
  56. package/dist/types/views.d.ts +29 -0
  57. package/docs/api.md +106 -0
  58. package/docs/assistants.md +55 -0
  59. package/docs/format.md +183 -0
  60. package/docs/getting-started.md +77 -0
  61. package/docs/preview.md +84 -0
  62. package/examples/clinic-queue/data.json +17 -0
  63. package/examples/clinic-queue/layout.yml +43 -0
  64. package/examples/fire-alarm/data.yml +23 -0
  65. package/examples/fire-alarm/layout.yml +30 -0
  66. package/examples/gym-classes/data.yml +17 -0
  67. package/examples/gym-classes/layout.yml +47 -0
  68. package/examples/hotel-lobby/data.yml +2 -0
  69. package/examples/hotel-lobby/layout.yml +29 -0
  70. package/examples/lunch/data.yml +16 -0
  71. package/examples/lunch/layout.yml +43 -0
  72. package/examples/meeting-room/data.json +19 -0
  73. package/examples/meeting-room/layout.json +107 -0
  74. package/examples/noc-wall/data.yml +18 -0
  75. package/examples/noc-wall/layout.yml +63 -0
  76. package/examples/oee-line/data.yml +25 -0
  77. package/examples/oee-line/layout.yml +55 -0
  78. package/examples/office-air/data.yml +25 -0
  79. package/examples/office-air/layout.yml +71 -0
  80. package/examples/sales-today/data.json +28 -0
  81. package/examples/sales-today/layout.json +62 -0
  82. package/examples/snow-closure/data.yml +28 -0
  83. package/examples/snow-closure/layout.json +35 -0
  84. package/examples/station-departures/data.json +24 -0
  85. package/examples/station-departures/layout.json +34 -0
  86. package/examples/store-promo/data.yml +18 -0
  87. package/examples/store-promo/layout.yml +54 -0
  88. package/examples/storm-banner/data.json +20 -0
  89. package/examples/storm-banner/layout.json +33 -0
  90. package/examples/trading-floor/data.json +23 -0
  91. package/examples/trading-floor/layout.json +65 -0
  92. package/examples/warehouse/data.json +20 -0
  93. package/examples/warehouse/layout.json +50 -0
  94. package/package.json +100 -4
  95. package/schema.json +962 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,39 @@
1
+ # Changelog
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
+
15
+ ## 0.0.1
16
+
17
+ First release.
18
+
19
+ - `mount()` renders a screen document into any element, scales it to the element's shape and reflows when the element resizes. `update()` swaps the layout or data.
20
+ - `check()` and `validate()` report errors and warnings with exact paths, including low contrast and binds that find nothing in the data.
21
+ - `signagekit check` does the same from the command line and exits with 1 on errors.
22
+ - `previewUrl()` and `signagekit url` pack a screen into a link to the preview tool, for sharing and for screenshots. Screens are sized by resolution, as `WIDTHxHEIGHT` or a name like `fullhd`, `portrait` or `4k` (`SIZES`, `parseSize()`).
23
+ - The `now` option freezes the clock, so screenshots of clocks, schedules and countdowns repeat exactly.
24
+ - Documents carry a format `version`. Older formats upgrade on load through migrations that load only when needed; newer formats render as far as the library can read them, with warnings for the rest.
25
+ - `mount()` and `check()` take `colors`, which win over the document's own, so a screen can be previewed in the other scheme.
26
+ - Flow rows whose spans add up to 12 stay as written on screens of the design's orientation; zones still regroup on the other orientation.
27
+ - Tables measure and page the same way on every update, page only when their rows don't fit, and spread their rows over spare height.
28
+ - Slideshows run edge to edge like images.
29
+ - Short zones centre their content vertically. A countdown that doesn't fit shrinks its value like a stat, and in a compact zone its label drops under the value.
30
+ - Long status notes end in an ellipsis; an alert banner's footer wraps within a quarter of the banner.
31
+ - `schema.json` is about a third smaller: shared properties are defined once. It now accepts `zone` in `clocks` entries, as the checker always did.
32
+ - Component titles accept a bind, like `title: { bind: /room/name }`.
33
+ - Stats pick the arrangement that lets their value be largest: trend beside or under the value, label under or beside it. Units and trends never shrink below a readable size.
34
+ - Cycles wrap their messages in tall, narrow zones instead of cutting them off.
35
+ - An image that fails to load shows the zone's empty state; a slideshow skips it.
36
+ - Screen styles are scoped to the screen, so they never touch the host page, and host page resets like Tailwind's don't change the screen.
37
+ - A Components page in the docs draws every component live with the YAML that makes it.
38
+ - 16 example screens in `examples/`, one folder each with a layout and a data file.
39
+ - 21 components, flow and fixed layouts, alerts with 31 icons, dark and light schemes, and JSON or YAML for both the layout and the data.
package/LICENSE ADDED
@@ -0,0 +1,44 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 514sid
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ The icons in src/icon-paths.ts are from Lucide (https://lucide.dev),
26
+ used under the ISC License:
27
+
28
+ ISC License
29
+
30
+ Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part
31
+ of Feather (MIT). All other copyright (c) for Lucide are held by Lucide
32
+ Contributors 2022.
33
+
34
+ Permission to use, copy, modify, and/or distribute this software for any
35
+ purpose with or without fee is hereby granted, provided that the above
36
+ copyright notice and this permission notice appear in all copies.
37
+
38
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
39
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
40
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
41
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
42
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
43
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
44
+ PERFORMANCE OF THIS SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,107 @@
1
- # Temporary Holding Version
1
+ # signagekit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A toolkit for AI agents that build digital signage screens: dashboards, menus, schedules and alerts. The agent writes a short JSON or YAML template that names the zones of a screen and what goes in each. signagekit validates it, lays it out for any display and sizes every piece of text, and gives the agent a checker and a preview link to see its work. After that, updating a screen means writing new data, not touching the template.
4
+
5
+ Docs, components, examples and the preview tool: https://signagekit.514sid.com
6
+
7
+ ```yaml
8
+ layout:
9
+ flow:
10
+ - { zone: head, span: 9, height: 150px }
11
+ - { zone: clock, span: 3, height: 150px }
12
+ - { zone: menu, span: 8 }
13
+ - { zone: wait, span: 4 }
14
+ zones:
15
+ head: { type: heading, text: Today's lunch }
16
+ clock: { type: clock, show_date: true }
17
+ menu: { type: table, columns: [Dish, Price], rows: { bind: /menu } }
18
+ wait: { type: stat, title: Wait time, value: { bind: /wait }, unit: min }
19
+ ```
20
+
21
+ It's built for the cheap hardware that drives most screens. The core is 39 KB of JavaScript (16 KB gzipped) and 16 KB of CSS (4 KB gzipped), plus Preact at 6 KB gzipped. There are no web fonts, shadows or filters. Charts, QR codes, YAML parsing and the rarer components load only on screens that use them, and clocks wake up once a minute.
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ npm install @514sid/signagekit
27
+ ```
28
+
29
+ ## Use
30
+
31
+ ```js
32
+ import { mount } from '@514sid/signagekit'
33
+ import '@514sid/signagekit/style.css'
34
+
35
+ const screen = await mount(document.getElementById('screen'), {
36
+ layout: layoutYamlOrObject,
37
+ data: { menu: [['Tomato soup', '4.50']], wait: 6 },
38
+ })
39
+
40
+ await screen.update({ data: newData })
41
+ ```
42
+
43
+ The screen fills the element you give it. [docs/api.md](docs/api.md) covers every option, `check()` for validating what an assistant wrote, use without a bundler, preview links, and the `signagekit` command.
44
+
45
+ ## The document format
46
+
47
+ [docs/format.md](docs/format.md) is the full reference: layouts, the 21 components, binding data, how text is sized, states and thresholds, charts, alerts, icons and colors. [schema.json](schema.json) has every property; reference it from a YAML file to get autocomplete in editors that read JSON Schema:
48
+
49
+ ```yaml
50
+ # yaml-language-server: $schema=https://signagekit.514sid.com/schema.json
51
+ ```
52
+
53
+ ## With AI assistants
54
+
55
+ signagekit is meant to be written by assistants as much as by people. [docs/assistants.md](docs/assistants.md) is a guide you can hand to one. The short version: give the assistant the guide, let it write the layout once and only the data after that, and run `signagekit check` on every change.
56
+
57
+ ## Development
58
+
59
+ ```bash
60
+ bun install
61
+ bun test
62
+ bun run storybook
63
+ ```
64
+
65
+ Storybook shows every component and the example screens at 16:9, 4:3, 21:9 and portrait, with controls for scheme and accent. [examples/](examples/) has a folder per example screen, each with its layout and data.
66
+
67
+ ```bash
68
+ bun run build
69
+ bun run check-all
70
+ ```
71
+
72
+ `build` writes the ES modules, `style.css` and type declarations to `dist/`. `check-all` runs the type check, lint, format check and tests, and `prepublishOnly` runs both.
73
+
74
+ ```bash
75
+ bun run preview screen.layout.yml screen.data.yml --out preview
76
+ ```
77
+
78
+ Renders a screen from the built package to PNG files at Full HD and Full HD portrait. `--size` takes other resolutions, by name or as `WIDTHxHEIGHT`, like `4k,xga,1366x768`. It needs a Chromium for Playwright: run `bun x playwright install chromium` once, or set `CHROMIUM_PATH`.
79
+
80
+ ## Website
81
+
82
+ `site/` is the documentation site, built with [Astro](https://astro.build) and [Tailwind CSS](https://tailwindcss.com): the docs from `docs/`, a gallery of every example, and the [preview tool](docs/preview.md). It's static and builds to `site/dist`.
83
+
84
+ ```bash
85
+ bun run site:dev
86
+ bun run site:build
87
+ ```
88
+
89
+ It's live at https://signagekit.514sid.com, deployed by Cloudflare Pages from this repository: build command `npm run site:build`, output directory `site/dist`, root directory left empty, and `NODE_VERSION` set to 22.23.4 or newer for Astro. `previewUrl()` and `signagekit url` link to its preview page by default; pass `base` or `--base` to link to a copy hosted elsewhere.
90
+
91
+ ## Releasing
92
+
93
+ Releases publish to npm from GitHub Actions through npm's trusted publishing, so no npm token is stored anywhere, and each version on npm links back to the commit that built it.
94
+
95
+ 1. Update `version` in `package.json` and add the changes to `CHANGELOG.md`.
96
+ 2. Commit and push.
97
+ 3. Create a GitHub release tagged with the version, like `v0.2.0`.
98
+
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.
104
+
105
+ ## License
106
+
107
+ MIT. The icons are from [Lucide](https://lucide.dev), under the ISC license; see [LICENSE](LICENSE).
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { run } from '../dist/cli.js'
3
+
4
+ process.exitCode = await run(process.argv.slice(2))
@@ -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{jsx as e}from"preact/jsx-runtime";function t({text:t=`Nothing to show`}){return/* @__PURE__ */ e(`p`,{class:`c-empty`,children:t})}export{t};
2
+ //# sourceMappingURL=empty--6iNLsra.js.map
@@ -0,0 +1,2 @@
1
+ var e={info:`<circle cx="12" cy="12" r="10"/><path d="M12 16v-4"/><path d="M12 8h.01"/>`,check:`<circle cx="12" cy="12" r="10"/><path d="m16 9-5.5 5.5L8 12"/>`,warning:`<path d="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-3"/><path d="M12 9v4"/><path d="M12 17h.01"/>`,danger:`<path d="M12 16h.01"/><path d="M12 8v4"/><path d="M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z"/>`,fire:`<path d="M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4"/>`,evacuate:`<path d="M10 21H2"/><path d="M10 3H7a2 2 0 00-2 2v16"/><path d="M14 12h.01"/><path d="M19 21V5a2 2 0 00-1.675-1.974l-6.163-1.013A1 1 0 0010 3v18a1 1 0 001.124.992z"/><path d="M22 21h-3"/>`,assembly:`<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><path d="M16 3.128a4 4 0 0 1 0 7.744"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><circle cx="9" cy="7" r="4"/>`,medical:`<path d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/><path d="M3.22 13H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27"/>`,"first-aid":`<path d="M12 11v4"/><path d="M14 13h-4"/><path d="M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2"/><path d="M18 6v14"/><path d="M6 6v14"/><rect width="20" height="14" x="2" y="6" rx="2"/>`,storm:`<path d="M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973"/><path d="m13 12-3 5h4l-3 5"/>`,wind:`<path d="M12.8 19.6A2 2 0 1 0 14 16H2"/><path d="M17.5 8a2.5 2.5 0 1 1 2 4H2"/><path d="M9.8 4.4A2 2 0 1 1 11 8H2"/>`,snow:`<path d="m10 20-1.25-2.5L6 18"/><path d="M10 4 8.75 6.5 6 6"/><path d="m14 20 1.25-2.5L18 18"/><path d="m14 4 1.25 2.5L18 6"/><path d="m17 21-3-6h-4"/><path d="m17 3-3 6 1.5 3"/><path d="M2 12h6.5L10 9"/><path d="m20 10-1.5 2 1.5 2"/><path d="M22 12h-6.5L14 15"/><path d="m4 10 1.5 2L4 14"/><path d="m7 21 3-6-1.5-3"/><path d="m7 3 3 6h4"/>`,flood:`<path d="M2 12q2.5 2 5 0t5 0 5 0 5 0"/><path d="M2 19q2.5 2 5 0t5 0 5 0 5 0"/><path d="M2 5q2.5 2 5 0t5 0 5 0 5 0"/>`,heat:`<path d="M12 2v2"/><path d="M12 8a4 4 0 0 0-1.645 7.647"/><path d="M2 12h2"/><path d="M20 14.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0z"/><path d="m4.93 4.93 1.41 1.41"/><path d="m6.34 17.66-1.41 1.41"/>`,lockdown:`<rect width="18" height="11" x="3" y="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/>`,shelter:`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/>`,security:`<path d="M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z"/><path d="M12 8v4"/><path d="M12 16h.01"/>`,power:`<path d="M10.768 5.111 13.44 2.44a1.5 1.5 0 012.474 1.561l-1.633 4.625"/><path d="m18.889 13.232.672-.672A1.5 1.5 0 0018.5 10h-2.844"/><path d="m2 2 20 20"/><path d="m7.94 7.94-3.5 3.499A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l5.5-5.5"/>`,water:`<path d="M18.715 13.186C18.29 11.858 17.384 10.607 16 9.5c-2-1.6-3.5-4-4-6.5a10.7 10.7 0 0 1-.884 2.586"/><path d="m2 2 20 20"/><path d="M8.795 8.797A11 11 0 0 1 8 9.5C6 11.1 5 13 5 15a7 7 0 0 0 13.222 3.208"/>`,network:`<path d="M12 20h.01"/><path d="M8.5 16.429a5 5 0 0 1 7 0"/><path d="M5 12.859a10 10 0 0 1 5.17-2.69"/><path d="M19 12.859a10 10 0 0 0-2.007-1.523"/><path d="M2 8.82a15 15 0 0 1 4.177-2.643"/><path d="M22 8.82a15 15 0 0 0-11.288-3.764"/><path d="m2 2 20 20"/>`,closed:`<circle cx="12" cy="12" r="10"/><path d="M4.929 4.929 19.07 19.071"/>`,delay:`<circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/>`,maintenance:`<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z"/>`,announcement:`<path d="M11 6a13 13 0 0 0 8.4-2.8A1 1 0 0 1 21 4v12a1 1 0 0 1-1.6.8A13 13 0 0 0 11 14H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2z"/><path d="M6 14a12 12 0 0 0 2.4 7.2 2 2 0 0 0 3.2-2.4A8 8 0 0 1 10 14"/><path d="M8 6v8"/>`,phone:`<path d="M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"/>`,biohazard:`<circle cx="12" cy="11.9" r="2"/><path d="M6.7 3.4c-.9 2.5 0 5.2 2.2 6.7C6.5 9 3.7 9.6 2 11.6"/><path d="m8.9 10.1 1.4.8"/><path d="M17.3 3.4c.9 2.5 0 5.2-2.2 6.7 2.4-1.2 5.2-.6 6.9 1.5"/><path d="m15.1 10.1-1.4.8"/><path d="M16.7 20.8c-2.6-.4-4.6-2.6-4.7-5.3-.2 2.6-2.1 4.8-4.7 5.2"/><path d="M12 13.9v1.6"/><path d="M13.5 5.4c-1-.2-2-.2-3 0"/><path d="M17 16.4c.7-.7 1.2-1.6 1.5-2.5"/><path d="M5.5 13.9c.3.9.8 1.8 1.5 2.5"/>`,radiation:`<path d="M12 12h.01"/><path d="M14 15.4641a4 4 0 0 1-4 0L7.52786 19.74597 A 1 1 0 0 0 7.99303 21.16211 10 10 0 0 0 16.00697 21.16211 1 1 0 0 0 16.47214 19.74597z"/><path d="M16 12a4 4 0 0 0-2-3.464l2.472-4.282a1 1 0 0 1 1.46-.305 10 10 0 0 1 4.006 6.94A1 1 0 0 1 21 12z"/><path d="M8 12a4 4 0 0 1 2-3.464L7.528 4.254a1 1 0 0 0-1.46-.305 10 10 0 0 0-4.006 6.94A1 1 0 0 0 3 12z"/>`,chemical:`<path d="M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2"/><path d="M6.453 15h11.094"/><path d="M8.5 2h7"/>`,event:`<path d="M8 2v3"/><path d="M16 2v3"/><rect x="3" y="3" width="18" height="18" rx="2"/><path d="M3 9h18"/>`,location:`<path d="M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0"/><circle cx="12" cy="10" r="3"/>`,accessibility:`<circle cx="16" cy="4" r="1"/><path d="m18 19 1-7-6 1"/><path d="m5 8 3-3 5.5 3-2.36 3.5"/><path d="M4.24 14.5a5 5 0 0 0 6.88 6"/><path d="M13.76 17.5a5 5 0 0 0-6.88-6"/>`};export{e as ICONS};
2
+ //# sourceMappingURL=icon-paths-Dl0Rqja7.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
@@ -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{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){e.querySelectorAll(`.c-qr`).forEach(e=>{let t=e.querySelector(`.c-qr-code`);if(!t)return;let n=e.querySelector(`.c-qr-label`),r=e.clientHeight-(n?n.offsetHeight+16:0),i=Math.max(0,Math.min(e.clientWidth,r));t.style.width=t.style.height=`${i}px`})}export{e as t};
2
+ //# sourceMappingURL=qr-size-Dq23do6_.js.map
@@ -0,0 +1,2 @@
1
+ var e=/* @__PURE__ */ new Set;function t(t){e.add(t);let n=()=>e.delete(t);t.then(n,n)}async function n(t=5e3){await Promise.race([Promise.allSettled([...e]),new Promise(e=>setTimeout(e,t))])}export{t as n,n as t};
2
+ //# sourceMappingURL=ready-Boq20M-G.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 ADDED
@@ -0,0 +1,10 @@
1
+ import{o as e,r as t}from"./chunks/share-D64VSp1B.js";import{readFileSync as n}from"node:fs";var r=`usage:
2
+ signagekit check <layout file> [data file] [--scheme dark|light] [--accent #hex]
3
+ Checks a screen document (JSON or YAML) and its data. Exits with 1 on errors.
4
+
5
+ signagekit url <layout file> [data file] [--mode screen|sizes|schemes|edit]
6
+ [--size fullhd,portrait,1366x768] [--scheme dark|light] [--accent #hex] [--tz Europe/Berlin]
7
+ [--locale de-DE] [--now 2026-11-14T09:30] [--problems]
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];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
+ //# sourceMappingURL=cli.js.map
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
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
+ //# sourceMappingURL=index.js.map
package/dist/style.css ADDED
@@ -0,0 +1,2 @@
1
+ .signagekit-canvas{transform-origin:0 0;position:absolute;top:0;left:0;overflow:hidden}.signagekit{background:var(--background);color:var(--text);-webkit-user-select:none;user-select:none;letter-spacing:normal;word-spacing:normal;text-align:start;text-indent:0;text-transform:none;white-space:normal;font:16px system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.signagekit :where(svg,img,video,canvas){vertical-align:baseline;max-width:none;display:inline}.signagekit :where(h1,h2,h3,th){font-size:inherit;font-weight:700}.signagekit :where(strong,b){font-weight:bolder}.signagekit .grid,.signagekit .grid *,.signagekit .alert,.signagekit .alert *{box-sizing:border-box;margin:0;padding:0}.signagekit .grid,.signagekit .alert{color:var(--text);font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif}.signagekit .grid{background:var(--line);width:100%;height:100%;display:grid}.signagekit .zone{contain:size layout style;min-width:0;min-height:0}.signagekit .cell{flex-direction:column;width:100%;height:100%;padding:40px 48px;display:flex;position:relative}.signagekit .body{flex:1 1 0;min-height:0;position:relative;overflow:hidden}.signagekit .s-base{background:var(--background)}.signagekit .s-raised{background:var(--surface)}.signagekit .s-accent{background:var(--accent);color:var(--on-accent);--muted:var(--on-accent);--line:var(--on-accent)}.signagekit .title{color:var(--muted);letter-spacing:.14em;text-transform:uppercase;white-space:nowrap;align-items:center;gap:14px;margin-bottom:24px;font-size:22px;font-weight:700;line-height:1;display:flex;overflow:hidden}.signagekit .title:before{content:"";background:var(--accent);flex:none;width:12px;height:12px}.signagekit .s-accent .title:before{background:var(--on-accent)}.signagekit .k-stack,.signagekit .k-image,.signagekit .k-slideshow{padding:0}.signagekit .k-stack>.title,.signagekit .k-image>.title,.signagekit .k-slideshow>.title{margin:40px 48px 24px}.signagekit .c-stack{gap:var(--gap,2px);background:var(--line);width:100%;height:100%;display:flex}.signagekit .d-column{flex-direction:column}.signagekit .d-row{flex-direction:row}.signagekit .c-stack>.cell{flex:1 1 0;min-width:0;min-height:0}.signagekit .a-start{text-align:start}.signagekit .a-center{text-align:center}.signagekit .a-end{text-align:end}.signagekit .c-heading{letter-spacing:-.025em;font-weight:800;line-height:1.02}.signagekit .c-text{white-space:pre-line;line-height:1.35}.signagekit .c-stat,.signagekit .c-clock,.signagekit .c-table,.signagekit .c-cycle{white-space:nowrap}.signagekit .c-stat,.signagekit .c-clock,.signagekit .c-cycle{width:max-content}.signagekit .c-stat-value{letter-spacing:-.03em;font-variant-numeric:tabular-nums;font-size:2.6em;font-weight:700;line-height:1}.signagekit .c-stat-unit{letter-spacing:0;color:var(--muted);margin-inline-start:.4em;font-size:max(.4em,min(1em,36px));font-weight:500}.signagekit .c-stat-label{color:var(--muted);letter-spacing:.12em;text-transform:uppercase;margin-top:.5em;font-size:.8em;font-weight:700}.signagekit .state-good{--state:var(--good);--on-state:var(--on-good)}.signagekit .state-warning{--state:var(--warning);--on-state:var(--on-warning)}.signagekit .state-danger{--state:var(--danger);--on-state:var(--on-danger)}.signagekit .state-good:before,.signagekit .state-warning:before,.signagekit .state-danger:before{content:"";top:0;left:0;right:calc(-1 * var(--gap,2px));background:var(--state);height:10px;position:absolute}.signagekit .cell[data-density=compact]:before,.signagekit .cell[data-density=strip]:before{width:8px;height:auto;bottom:0;right:auto}.signagekit .title.has-icon:before,.signagekit .cell[data-density=compact]>.title.has-state:before,.signagekit .cell[data-density=strip]>.title.has-state:before{display:none}.signagekit .title-icon{width:1.3em;height:1.3em;color:var(--accent);flex:none}.signagekit .s-accent .title-icon{color:var(--on-accent)}.signagekit .title-state{display:none}.signagekit .cell[data-density=compact]>.title>.title-state,.signagekit .cell[data-density=strip]>.title>.title-state{display:flex}.signagekit .title-state .c-state-icon{width:1.3em;height:1.3em}.signagekit .c-stat-label{align-items:center;gap:.4em;display:flex}.signagekit .cell[data-density=compact] .c-stat,.signagekit .cell[data-density=strip] .c-stat{align-items:baseline;gap:0 .8em;display:flex}.signagekit .cell[data-density=compact] .c-stat-label,.signagekit .cell[data-density=strip] .c-stat-label{margin-top:0}.signagekit .cell[data-density=compact] .c-stat.label-under{display:block}.signagekit .cell[data-density=compact] .c-stat.label-under .c-stat-label{margin-top:.3em}.signagekit .cell[data-density=compact] .c-spark,.signagekit .cell[data-density=strip] .c-spark{display:none}.signagekit .c-state-icon{flex:none;width:1.15em;height:1.15em}.signagekit .c-state-icon.is-good{--state:var(--good);--on-state:var(--on-good)}.signagekit .c-state-icon.is-warning{--state:var(--warning);--on-state:var(--on-warning)}.signagekit .c-state-icon.is-danger{--state:var(--danger);--on-state:var(--on-danger)}.signagekit .c-state-shape{fill:var(--state);stroke:var(--state);stroke-width:1.5px;stroke-linejoin:round}.signagekit .c-state-mark{fill:none;stroke:var(--on-state);stroke-width:2.25px;stroke-linecap:round;stroke-linejoin:round}.signagekit .c-stat-trend{letter-spacing:0;color:var(--text);vertical-align:baseline;align-items:center;gap:.25em;margin-inline-start:.35em;font-size:max(.32em,min(1em,32px));font-weight:600;display:inline-flex}.signagekit .c-stat.trend-below .c-stat-trend{width:max-content;margin:.45em 0 0;font-size:max(.36em,min(1em,32px));display:flex}.signagekit .c-stat.label-beside{align-items:baseline;gap:0 .8em;display:flex}.signagekit .c-stat.label-beside .c-stat-label{margin-top:0}.signagekit .c-trend-icon{fill:none;width:1.3em;height:1.3em;stroke:var(--muted);stroke-width:2.5px;stroke-linecap:round;stroke-linejoin:round}.signagekit .tone-good .c-trend-icon{stroke:var(--good)}.signagekit .tone-danger .c-trend-icon{stroke:var(--danger)}.signagekit .c-table{border-collapse:collapse;font-variant-numeric:tabular-nums;width:100%;line-height:1.25}.signagekit .c-table th{color:var(--muted);letter-spacing:.12em;text-transform:uppercase;padding:0 .5em .6em;font-size:.6em;font-weight:700}.signagekit .c-table td{padding:calc(.45em + var(--row-room,0px)) .5em;border-top:1px solid var(--line)}.signagekit .c-table td:first-child{font-weight:600}.signagekit .c-table th:first-child,.signagekit .c-table td:first-child{padding-inline-start:0}.signagekit .c-table th:last-child,.signagekit .c-table td:last-child{padding-inline-end:0}.signagekit .c-list{line-height:1.3;list-style:none}.signagekit .c-list li{gap:.6em;display:flex}.signagekit .c-list li+li{margin-top:.6em}.signagekit .c-list li:before{content:"";background:var(--accent);flex:none;width:.32em;height:.32em;margin-top:.48em}.signagekit .s-accent .c-list li:before{background:var(--on-accent)}.signagekit .c-image{width:100%;height:100%;display:block}.signagekit .c-clock-time{letter-spacing:-.03em;font-variant-numeric:tabular-nums;font-weight:300;line-height:1}.signagekit .c-clock-date{color:var(--muted);letter-spacing:.08em;text-transform:uppercase;margin-top:.35em;font-size:.24em;font-weight:600}.signagekit .k-cycle{padding-block-start:0;padding-block-end:0}.signagekit .k-cycle .body{flex-direction:column;justify-content:center;display:flex}.signagekit .c-cycle{font-weight:600;line-height:1.2}.signagekit .c-cycle[data-wrap]{white-space:normal;width:100%}.signagekit .c-cycle.a-center{align-self:center}.signagekit .c-cycle.a-end{align-self:flex-end}.signagekit .c-chart{flex-direction:column;width:100%;height:100%;display:flex}.signagekit .c-chart-legend{color:var(--muted);flex-wrap:wrap;gap:8px 32px;margin-bottom:16px;font-size:24px;line-height:1.2;display:flex}.signagekit .c-chart-key{white-space:nowrap;align-items:center;gap:10px;display:flex}.signagekit .c-chart-key strong{color:var(--text);font-weight:700}.signagekit .c-chart-swatch{width:14px;height:14px}.signagekit .c-chart-plot{flex:1 1 0;min-height:0}.signagekit .c-meter,.signagekit .c-meters,.signagekit .c-bars,.signagekit .c-split{white-space:nowrap;width:100%}.signagekit .c-meter-figure{letter-spacing:-.02em;font-size:2.2em;font-weight:700;line-height:1}.signagekit .c-meter-of{color:var(--muted);letter-spacing:0;font-size:.45em;font-weight:500}.signagekit .c-bar{background:var(--line);height:.6em;margin:.45em 0 .35em}.signagekit .c-bar-fill{background:var(--fill,var(--accent));height:100%}.signagekit .fill-good{--fill:var(--good);--state:var(--good);--on-state:var(--on-good)}.signagekit .fill-warning{--fill:var(--warning);--state:var(--warning);--on-state:var(--on-warning)}.signagekit .fill-danger{--fill:var(--danger);--state:var(--danger);--on-state:var(--on-danger)}.signagekit .c-meters-row+.c-meters-row{margin-top:.7em}.signagekit .c-meters-head{justify-content:space-between;gap:1em;display:flex}.signagekit .c-meters-label{text-overflow:ellipsis;align-items:center;gap:.4em;min-width:0;font-weight:600;display:flex;overflow:hidden}.signagekit .c-meters-value{flex:none}.signagekit .c-meters .c-meter-of,.signagekit .c-bars .c-meter-of{font-size:.7em}.signagekit .c-meters-row .c-bar{height:.45em;margin:.3em 0 0}.signagekit .c-meters-value{font-variant-numeric:tabular-nums}.signagekit .c-bars{grid-template-columns:minmax(0,max-content) minmax(40%,1fr) max-content;align-items:center;gap:.5em .6em;display:grid}.signagekit .c-bars-row{display:contents}.signagekit .c-bars-label{text-overflow:ellipsis;font-weight:600;overflow:hidden}.signagekit .c-bars-track{height:.9em}.signagekit .c-bars-fill{background:var(--series-1);height:100%}.signagekit .c-bars-value{font-variant-numeric:tabular-nums}.signagekit .c-split-bar{gap:2px;height:2.2em;display:flex}.signagekit .c-split-part{align-items:center;min-width:0;padding-inline-start:.4em;font-weight:700;display:flex;overflow:hidden}.signagekit .c-split-legend{color:var(--muted);flex-wrap:wrap;gap:.3em 1.2em;margin-top:.7em;display:flex}.signagekit .c-split-legend .c-chart-swatch{width:.6em;height:.6em}.signagekit .c-status,.signagekit .c-schedule,.signagekit .c-clocks{white-space:nowrap;width:100%;list-style:none}.signagekit .c-status li,.signagekit .c-clocks li{border-top:1px solid var(--line);align-items:center;gap:.5em;padding:.35em 0;display:flex}.signagekit .c-status li:first-child,.signagekit .c-clocks li:first-child,.signagekit .c-schedule li:first-child{border-top:none}.signagekit .c-status-dot{background:var(--line);border-radius:50%;flex:none;width:.95em;height:.95em;margin:0 .1em}.signagekit .c-status-label{font-weight:600}.signagekit .c-status-note{color:var(--muted);text-overflow:ellipsis;min-width:0;margin-inline-start:auto;overflow:hidden}.signagekit .c-status-label{flex:none}.signagekit .c-status li .c-state-icon,.signagekit .c-meters-label .c-state-icon{width:1.15em;height:1.15em}.signagekit .c-schedule li{border-top:1px solid var(--line);border-inline-start:.2em solid #0000;align-items:baseline;gap:.8em;padding:.4em 0 .4em .6em;display:flex}.signagekit .c-schedule li.is-now{border-inline-start-color:var(--accent);background:var(--surface)}.signagekit .c-schedule-time{min-width:3.2em;color:var(--muted);font-variant-numeric:tabular-nums}.signagekit .is-now .c-schedule-time{color:var(--text);font-weight:700}.signagekit .c-schedule-what{flex-direction:column;min-width:0;display:flex}.signagekit .c-schedule-title{font-weight:600}.signagekit .c-schedule-detail{color:var(--muted);font-size:.7em}.signagekit .c-schedule-tag{color:var(--muted);letter-spacing:.12em;text-transform:uppercase;margin-inline-start:auto;padding-inline-end:.4em;font-size:.6em;font-weight:700}.signagekit .is-now .c-schedule-tag{color:var(--text)}.signagekit .c-schedule-empty{color:var(--muted);border:none}.signagekit .c-queue{white-space:nowrap;width:100%}.signagekit .c-queue-current{letter-spacing:-.03em;font-size:3.2em;font-weight:800;line-height:1}.signagekit .c-queue-recent{color:var(--muted);font-variant-numeric:tabular-nums;gap:.8em;margin-top:.4em;font-weight:600;display:flex}.signagekit .c-clocks-label{font-weight:600}.signagekit .c-clocks-time{font-variant-numeric:tabular-nums;margin-inline-start:auto;font-weight:300}.signagekit .c-spark{width:100%;height:.9em;margin-top:.3em;display:block;overflow:visible}.signagekit .c-spark polyline{fill:none;stroke:var(--muted);stroke-width:2.5px;stroke-linejoin:round;vector-effect:non-scaling-stroke}.signagekit .c-spark path{stroke:var(--accent);stroke-width:9px;stroke-linecap:round;vector-effect:non-scaling-stroke}.signagekit .c-table tr.off-page{visibility:collapse}.signagekit .c-table-page{caption-side:bottom;color:var(--muted);text-align:end;font-variant-numeric:tabular-nums;padding-top:.5em;font-size:.6em}.signagekit .c-qr{flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;display:flex}.signagekit .c-qr-code{flex:none}.signagekit .c-qr-label{text-align:center;margin-top:16px;font-size:26px;font-weight:600}.signagekit .screen{flex-direction:column;width:100%;height:100%;display:flex}.signagekit .screen>.grid{flex:1 1 0;min-height:0}.signagekit .alert{--alert-bg:var(--accent);--alert-ink:var(--on-accent);background:var(--alert-bg);color:var(--alert-ink)}.signagekit .alert.lvl-good{--alert-bg:var(--good);--alert-ink:var(--on-good)}.signagekit .alert.lvl-warning{--alert-bg:var(--warning);--alert-ink:var(--on-warning)}.signagekit .alert.lvl-danger{--alert-bg:var(--danger);--alert-ink:var(--on-danger)}.signagekit .alert .alert-icon{stroke-width:2.25px;flex:none}.signagekit .alert.takeover{grid-template-rows:24% minmax(0,1fr) auto;width:100%;height:100%;padding:72px 96px 64px;display:grid}.signagekit .alert-head{border-bottom:3px solid var(--alert-ink);align-items:center;gap:40px;min-height:0;padding-bottom:32px;display:flex}.signagekit .takeover .alert-icon{aspect-ratio:1;width:auto;height:100%;max-height:200px}.signagekit .alert-title-box{flex:1 1 0;align-items:center;min-width:0;height:100%;display:flex}.signagekit .alert-title{letter-spacing:-.02em;white-space:nowrap;width:max-content;font-weight:800;line-height:1}.signagekit .alert-box{min-width:0;min-height:0;position:relative;overflow:hidden}.signagekit .takeover .alert-box{padding-top:40px}.signagekit .alert-content{line-height:1.25}.signagekit .alert-message{font-size:1.2em;font-weight:700}.signagekit .alert-steps{margin-top:.7em;list-style:none}.signagekit .alert-steps li{align-items:baseline;gap:.6em;display:flex}.signagekit .alert-steps li+li{margin-top:.4em}.signagekit .alert-step-n{border:.1em solid var(--alert-ink);font-variant-numeric:tabular-nums;border-radius:50%;flex:none;justify-content:center;align-items:center;width:1.5em;height:1.5em;font-size:.8em;font-weight:700;display:inline-flex;transform:translateY(-.1em)}.signagekit .alert-footer{padding-top:24px;font-size:28px;font-weight:600}.signagekit .alert.banner{flex:none;align-items:center;gap:32px;height:18%;min-height:140px;padding:20px 48px;display:flex}.signagekit .banner .alert-icon{aspect-ratio:1;width:auto;height:60%}.signagekit .banner .alert-box{flex:1 1 0;align-items:center;height:100%;display:flex}.signagekit .alert-banner-title{font-weight:800;display:block}.signagekit .banner .alert-footer{text-align:end;max-width:26%;padding:0;font-size:24px}.signagekit .cell[data-density=tight]:not(.k-stack):not(.k-image):not(.k-slideshow){padding:24px 28px}.signagekit .cell[data-density=tight]>.title{margin-bottom:14px;font-size:18px}.signagekit .cell[data-density=strip]:not(.k-stack):not(.k-image):not(.k-slideshow){flex-direction:row;align-items:center;gap:24px;padding:0 28px}.signagekit .cell[data-density=strip]>.title{flex:0 auto;max-width:30%;margin:0;font-size:18px}.signagekit .cell[data-density=strip]>.body{align-self:stretch;padding:10px 0}.signagekit .cell[data-density=compact]:not(.k-stack):not(.k-image):not(.k-slideshow){padding:12px 28px}.signagekit .cell[data-density=compact]>.title{margin-bottom:8px;font-size:16px}.signagekit .title>span{text-overflow:ellipsis;min-width:0;overflow:hidden}.signagekit .cell[data-density=strip]>.body,.signagekit .cell[data-density=compact]>.body{flex-direction:column;display:flex}.signagekit .cell[data-density=strip]>.body>*,.signagekit .cell[data-density=compact]>.body>*{margin-block-start:auto;margin-block-end:auto}.signagekit .k-stat>.body,.signagekit .k-clock>.body,.signagekit .k-queue>.body,.signagekit .k-countdown>.body,.signagekit .k-meter>.body{flex-direction:column;display:flex}.signagekit .k-stat>.body>*,.signagekit .k-clock>.body>*,.signagekit .k-queue>.body>*,.signagekit .k-countdown>.body>*,.signagekit .k-meter>.body>*{margin-block-start:auto;margin-block-end:auto}.signagekit .body[data-more]:after{content:attr(data-more);color:var(--muted);font-size:var(--more-size,20px);font-weight:600;line-height:1.2;position:absolute;bottom:0;left:0}.signagekit .cell[data-density=strip] .body[data-more]:after,.signagekit .cell[data-density=compact] .body[data-more]:after{top:50%;bottom:auto;left:auto;right:0;transform:translateY(-50%)}.signagekit .c-stack.d-row.wrapped{grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:1fr;display:grid}.signagekit .cell[data-density=strip] .c-clocks,.signagekit .cell[data-density=compact] .c-clocks{gap:0 1.6em;display:flex}.signagekit .cell[data-density=strip] .c-clocks li,.signagekit .cell[data-density=compact] .c-clocks li{border:none;gap:.5em;padding:0}.signagekit .cell[data-density=strip] .c-list,.signagekit .cell[data-density=compact] .c-list{gap:0 1.6em;display:flex}.signagekit .cell[data-density=strip] .c-list li+li,.signagekit .cell[data-density=compact] .c-list li+li{margin-top:0}.signagekit .is-missing{color:var(--muted)}.signagekit .c-empty{color:var(--muted);font-size:24px;font-weight:600}.signagekit .c-table[data-flex="0"] td:first-child,.signagekit .c-table[data-flex="0"] th:first-child,.signagekit .c-table[data-flex="1"] td:nth-child(2),.signagekit .c-table[data-flex="1"] th:nth-child(2),.signagekit .c-table[data-flex="2"] td:nth-child(3),.signagekit .c-table[data-flex="2"] th:nth-child(3),.signagekit .c-table[data-flex="3"] td:nth-child(4),.signagekit .c-table[data-flex="3"] th:nth-child(4),.signagekit .c-table[data-flex="4"] td:nth-child(5),.signagekit .c-table[data-flex="4"] th:nth-child(5),.signagekit .c-table[data-flex="5"] td:nth-child(6),.signagekit .c-table[data-flex="5"] th:nth-child(6),.signagekit .c-table[data-flex="6"] td:nth-child(7),.signagekit .c-table[data-flex="6"] th:nth-child(7),.signagekit .c-table[data-flex="7"] td:nth-child(8),.signagekit .c-table[data-flex="7"] th:nth-child(8){text-overflow:ellipsis;width:100%;max-width:0;overflow:hidden}.signagekit .c-table.measuring td,.signagekit .c-table.measuring th{text-overflow:clip!important;overflow:visible!important}.signagekit .c-table.has-widths{table-layout:fixed}.signagekit .c-table.has-widths th,.signagekit .c-table.has-widths td{text-overflow:ellipsis;overflow:hidden}.signagekit .problems{color:#fff;background:#7f1d1d;max-height:40%;padding:20px 48px;font:20px/1.4 ui-monospace,monospace;position:absolute;bottom:0;left:0;right:0;overflow:hidden}.uplot,.uplot *,.uplot :before,.uplot :after{box-sizing:border-box}.uplot{width:min-content;font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Noto Sans,Ubuntu,Cantarell,Helvetica Neue,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}.u-title{text-align:center;font-size:18px;font-weight:700}.u-wrap{-webkit-user-select:none;user-select:none;position:relative}.u-over,.u-under{position:absolute}.u-under{overflow:hidden}.uplot canvas{width:100%;height:100%;display:block;position:relative}.u-axis{position:absolute}.u-legend{text-align:center;margin:auto;font-size:14px}.u-inline{display:block}.u-inline *{display:inline-block}.u-inline tr{margin-right:16px}.u-legend th{font-weight:600}.u-legend th>*{vertical-align:middle;display:inline-block}.u-legend .u-marker{width:1em;height:1em;margin-right:4px;background-clip:padding-box!important}.u-inline.u-live th:after{content:":";vertical-align:middle}.u-inline:not(.u-live) .u-value{display:none}.u-series>*{padding:4px}.u-series th{cursor:pointer}.u-legend .u-off>*{opacity:.3}.u-select{pointer-events:none;background:#00000012;position:absolute}.u-cursor-x,.u-cursor-y{pointer-events:none;will-change:transform;position:absolute;top:0;left:0}.u-hz .u-cursor-x,.u-vt .u-cursor-y{border-right:1px dashed #607d8b;height:100%}.u-hz .u-cursor-y,.u-vt .u-cursor-x{border-bottom:1px dashed #607d8b;width:100%}.u-cursor-pt{pointer-events:none;will-change:transform;border:0 solid;border-radius:50%;position:absolute;top:0;left:0;background-clip:padding-box!important}.u-axis.u-off,.u-select.u-off,.u-cursor-x.u-off,.u-cursor-y.u-off,.u-cursor-pt.u-off{display:none}
2
+ /*$vite$:1*/
@@ -0,0 +1,20 @@
1
+ import { type IconName } from './icons';
2
+ import type { Alert, Data } from './types';
3
+ export declare const LEVELS: readonly ["info", "good", "warning", "danger"];
4
+ export type Level = (typeof LEVELS)[number];
5
+ export interface ActiveAlert {
6
+ level: Level;
7
+ icon: IconName;
8
+ title: string;
9
+ message: string;
10
+ steps: string[];
11
+ footer: string;
12
+ mode: 'takeover' | 'banner';
13
+ }
14
+ /** The alert to show now, or null. Unknown levels and icons fall back. */
15
+ export declare function resolveAlert(a: Alert | undefined, data: Data, now: Date): ActiveAlert | null;
16
+ /** Re-checks every minute, so an alert past its `until` time goes away. */
17
+ export declare function useAlert(a: Alert | undefined, data: Data): ActiveAlert | null;
18
+ export declare function AlertView({ a }: {
19
+ a: ActiveAlert;
20
+ }): import("preact").JSX.Element;
@@ -0,0 +1,6 @@
1
+ import type { Data } from './types';
2
+ /** Warnings for every bind in the zones and the alert that finds nothing. */
3
+ export declare function missingBinds(doc: {
4
+ zones: Record<string, unknown>;
5
+ alert?: unknown;
6
+ }, data: Data): string[];
@@ -0,0 +1,16 @@
1
+ import 'uplot/dist/uPlot.min.css';
2
+ import type { Chart as ChartSpec, Data } from './types';
3
+ export interface Resolved {
4
+ labels: string[];
5
+ series: {
6
+ name: string;
7
+ values: (number | null)[];
8
+ }[];
9
+ target: number | null;
10
+ targetLabel: string;
11
+ }
12
+ export declare function resolveChart(c: ChartSpec, data: Data): Resolved;
13
+ export declare function Chart({ c, data }: {
14
+ c: ChartSpec;
15
+ data: Data;
16
+ }): import("preact").JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { type Colors, type Scheme } from './colors';
2
+ import type { Data, ScreenDoc } from './types';
3
+ export declare const DEFAULT_ACCENT = "#2563eb";
4
+ export interface CheckOptions {
5
+ /** Scheme used when the document doesn't set `colors.scheme`. Default dark. */
6
+ scheme?: Scheme;
7
+ /** Accent used when the document doesn't set `colors.accent`. */
8
+ accent?: string;
9
+ /**
10
+ * Colors that win over the document's own, like `{ scheme: 'light' }` to
11
+ * see a screen in the other scheme.
12
+ */
13
+ colors?: Colors;
14
+ /**
15
+ * Report binds that find nothing in the data. Default true; turn it off
16
+ * when the data arrives later.
17
+ */
18
+ checkBinds?: boolean;
19
+ }
20
+ export interface CheckResult {
21
+ /** The validated document, or null when it can't be rendered at all. */
22
+ doc: ScreenDoc | null;
23
+ data: Data;
24
+ /** Problems that stop the screen, or part of it, from rendering. */
25
+ errors: string[];
26
+ /** Problems the screen renders through: unknown keys, low contrast, binds. */
27
+ warnings: string[];
28
+ }
29
+ export type Source = string | object;
30
+ /** Parses, validates and checks a document and its data. Never throws. */
31
+ export declare function check(layout: Source, data?: Source, options?: CheckOptions): Promise<CheckResult>;
@@ -0,0 +1,36 @@
1
+ export type Obj = Record<string, unknown>;
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;
9
+ export declare const isObj: (v: unknown) => v is Obj;
10
+ export declare const isBind: (v: unknown) => boolean;
11
+ export declare const value: Check;
12
+ export declare const oneOf: (...allowed: unknown[]) => Check;
13
+ export declare const bool: Check;
14
+ export declare const str: Check;
15
+ export declare const seconds: Check;
16
+ export declare const list: (item: Check) => Check;
17
+ export declare const strings: Check;
18
+ export declare const chartSeries: Check;
19
+ export declare const stateValue: Check;
20
+ export declare const ALIGN: Check;
21
+ export declare const SURFACE: Check;
22
+ export declare const int: (min: number, max: number) => Check;
23
+ /** An object with required and optional fields, each with its own check. */
24
+ export declare const shape: (required: Record<string, Check>, optional?: Record<string, Check>) => Check;
25
+ /** Labelled amounts for meters, bars and split. */
26
+ export declare const part: Check;
27
+ /** A list of at most `max` items, or a binding. */
28
+ export declare const capped: (item: Check, max: number) => Check;
29
+ export declare const timeZone: Check;
30
+ export declare const number: (min: number, max: number) => Check;
31
+ export declare const thresholds: Check;
32
+ export declare const finite: Check;
33
+ /** A clock entry: label and timezone (`zone` is the older name). */
34
+ export declare const clockZone: Check;
35
+ /** Relative widths, one positive number per column. */
36
+ export declare const widths: Check;