diff --git a/assets/styles/main.css b/assets/styles/main.css index a313302..3a2c09b 100644 --- a/assets/styles/main.css +++ b/assets/styles/main.css @@ -531,22 +531,11 @@ body { } /* ========================================================================= - Degraded mode — old/weak signage players (html.legacy set by the inline gate - in index.html). Assume the device can't afford animation; drop it entirely. - .anim has a base opacity:0 and only appears via the entrance animation, so the - legacy block reveals it (opacity:1), mirroring the reduced-motion resting - state; the ambient breathe is then cancelled. + Degraded mode — app-specific resting state (the generic html.legacy kill-switch + is prepended at build by @screenly-labs/signage-kit). .anim has a base + opacity:0 and only appears via the entrance animation, so reveal it here + (the kill-switch cancels the animation itself), mirroring reduced-motion. ========================================================================= */ html.legacy .anim { opacity: 1; } -html.legacy *, -html.legacy *::before, -html.legacy *::after { - /* biome-ignore lint/complexity/noImportantStyles: kill-switch must override the entrance/ambient animation rules */ - animation: none !important; - /* biome-ignore lint/complexity/noImportantStyles: kill-switch must override any transition */ - transition: none !important; - /* biome-ignore lint/complexity/noImportantStyles: release GPU layer hints on weak devices */ - will-change: auto !important; -} diff --git a/build.ts b/build.ts index 4dfe185..7cfe9f6 100644 --- a/build.ts +++ b/build.ts @@ -9,20 +9,11 @@ // project subpath like https://.github.io/world-clock/. import { cp, mkdir, rm } from 'node:fs/promises' -import browserslist from 'browserslist' -import { build as esbuild } from 'esbuild' -import { browserslistToTargets, transform as lightningcss } from 'lightningcss' +import { bundleJs, injectGate, processCss } from '@screenly-labs/signage-kit/build' import { run as syncFonts } from './sync-fonts.ts' const DIST = 'dist' -// The `browserslist` field in package.json is the CSS support floor: Lightning -// CSS down-levels the stylesheet to it. The JS is lowered separately by esbuild to -// a fixed ES2017 syntax floor (kept at/below the browserslist minimum); esbuild -// can't read browserslist, so keep the two in sync if you change the floor. See -// the degraded-mode notes in index.html / main.css. -const cssTargets = browserslistToTargets(browserslist()) - // Vendor the Bun-managed webfonts into ./assets/fonts before copying them on. await syncFonts() @@ -30,22 +21,11 @@ await syncFonts() await rm(DIST, { recursive: true, force: true }) await mkdir(`${DIST}/styles`, { recursive: true }) -// JS: esbuild bundles main.ts (inlining clocks.ts + the polyfills shim) into one -// minified ES module and lowers modern syntax (?., ??, spread) to the ES2017 -// floor so old signage players can parse it. Kept as an ES module (the page -// still loads it with + diff --git a/package.json b/package.json index 38dbca6..c12dcad 100644 --- a/package.json +++ b/package.json @@ -17,15 +17,10 @@ "serve": "bun run build.ts && bunx serve dist" }, "license": "AGPL-3.0-only", - "browserslist": [ - "chrome >= 87", - "firefox >= 78", - "safari >= 14.1", - "edge >= 87" - ], "dependencies": { "@fontsource-variable/fraunces": "^5.2.9", - "@fontsource-variable/hanken-grotesk": "^5.2.8" + "@fontsource-variable/hanken-grotesk": "^5.2.8", + "@screenly-labs/signage-kit": "github:Screenly-Labs/signage-kit#2026.7.0" }, "devDependencies": { "@biomejs/biome": "^2.5.1", diff --git a/src/main.ts b/src/main.ts index 06f8532..4816ae3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -5,8 +5,8 @@ // index.html — no framework, no server. // Side-effect import: installs the replaceChildren shim for the older-browser -// degraded mode. Must stay first so the shim is in place before any render. -import './polyfills' +// degraded mode (shared across all apps). Must stay first. +import '@screenly-labs/signage-kit/polyfills' import { buildFormatters, type ClockConfig, diff --git a/src/polyfills.ts b/src/polyfills.ts deleted file mode 100644 index 4262c22..0000000 --- a/src/polyfills.ts +++ /dev/null @@ -1,23 +0,0 @@ -// Minimal runtime shim for the older-browser degraded mode. esbuild lowers modern -// *syntax* (?., ??, spread) at build time, but it does not add missing runtime -// APIs. The one DOM gap the apps can hit at the support floor is -// Element.prototype.replaceChildren (Chrome 86 / Safari 14, 2020); it's included -// as a defensive shim even in apps that don't call it directly. Everything else -// the apps use (fetch, Intl, URLSearchParams) predates the floor, so no core-js. -// -// Imported only for its side effect (installing the shim) as the first line of -// main.ts; it exports nothing. - -if (typeof Element !== 'undefined' && !Element.prototype.replaceChildren) { - Element.prototype.replaceChildren = function replaceChildren( - this: Element, - ...nodes: (Node | string)[] - ): void { - // Build the new children in a fragment first so a bad node throws before we - // touch the element, keeping the swap effectively atomic like the native API. - const frag = document.createDocumentFragment() - frag.append(...nodes) - while (this.firstChild) this.removeChild(this.firstChild) - this.appendChild(frag) - } -}