cronwatch 0.11.0 → 0.11.1
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.
- checksums.yaml +4 -4
- data/lib/cronwatch/version.rb +1 -1
- data/lib/cronwatch/web/html.rb +4 -3
- data/lib/cronwatch/web/pwa.rb +18 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4a31800c33f9abb5092e104cc1572940190883006bab28dfc5c389d01ab3d5c8
|
|
4
|
+
data.tar.gz: 2e85fbf87e5c1929124d105f54791eb36726f69eae05db77ff22b6b665672471
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd728e8770453f91445d006f0ce7f15d709c04e4c130366a5adfb99f104570fca428e6363c91b69a55c0b58a6e4b90472ec13fd3588b85548b195161a4a2c0f8
|
|
7
|
+
data.tar.gz: 951158243f2598f6d75fe9cb4095138a4480af3f1d9dc9de1d9f24af011d63ad4df5001bbc6e3227c70f9cdb3c1b3e031e4a4b175b570a12ab04786946484ad8
|
data/lib/cronwatch/version.rb
CHANGED
data/lib/cronwatch/web/html.rb
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Cronwatch
|
|
4
4
|
class Web
|
|
5
5
|
# The dashboard's pages, markup for markup the SDK's routes/html.ts. The
|
|
6
|
-
# one script, app.js,
|
|
6
|
+
# one script, app.js, registers the service worker and toggles the theme: the pages refresh
|
|
7
7
|
# themselves and the forget button confirms with a <details>.
|
|
8
8
|
#
|
|
9
9
|
# Set like cronwatch.dev: a printed sheet on grey paper, a serif for what a
|
|
@@ -26,7 +26,8 @@ module Cronwatch
|
|
|
26
26
|
module HTML
|
|
27
27
|
CSS = "\n" + <<~'CSS'
|
|
28
28
|
:root{color-scheme:light dark;--paper:#f4f4f5;--sheet:#fff;--sunk:#fafafa;--rule:#e4e4e7;--rule-2:#d4d4d8;--tick:#909098;--ink:#000;--body:#18181b;--muted:#71717a;--ok:#15803d;--warn:#a16207;--bad:#b91c1c;--serif:"Newsreader",ui-serif,Georgia,Cambria,"Times New Roman",serif;--mono:"IBM Plex Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;--who:200px}
|
|
29
|
-
@media(prefers-color-scheme:dark){:root{--paper:#09090b;--sheet:#111113;--sunk:#18181b;--rule:#27272a;--rule-2:#3f3f46;--tick:#66666f;--ink:#fff;--body:#e4e4e7;--muted:#a1a1aa;--ok:#4ade80;--warn:#fbbf24;--bad:#f87171}}
|
|
29
|
+
@media(prefers-color-scheme:dark){:root:not([data-theme=light]){--paper:#09090b;--sheet:#111113;--sunk:#18181b;--rule:#27272a;--rule-2:#3f3f46;--tick:#66666f;--ink:#fff;--body:#e4e4e7;--muted:#a1a1aa;--ok:#4ade80;--warn:#fbbf24;--bad:#f87171}}
|
|
30
|
+
:root[data-theme=light]{color-scheme:light}:root[data-theme=dark]{color-scheme:dark;--paper:#09090b;--sheet:#111113;--sunk:#18181b;--rule:#27272a;--rule-2:#3f3f46;--tick:#66666f;--ink:#fff;--body:#e4e4e7;--muted:#a1a1aa;--ok:#4ade80;--warn:#fbbf24;--bad:#f87171}
|
|
30
31
|
*{box-sizing:border-box}html{-webkit-text-size-adjust:100%}
|
|
31
32
|
body{margin:0;background:var(--paper);color:var(--ink);font:400 16px/1.55 var(--serif);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}
|
|
32
33
|
a{color:inherit;text-decoration:underline;text-decoration-thickness:1px;text-underline-offset:.16em;text-decoration-color:var(--rule-2)}a:hover{text-decoration-color:currentColor}
|
|
@@ -251,7 +252,7 @@ module Cronwatch
|
|
|
251
252
|
|
|
252
253
|
# A page. `base` is where the dashboard is mounted ("" at the root): the
|
|
253
254
|
# head links the web app manifest, the icons and app.js, the one script,
|
|
254
|
-
# which
|
|
255
|
+
# which registers the service worker and toggles the theme (Web::PWA). Everything works
|
|
255
256
|
# without it.
|
|
256
257
|
def layout(title, body, base, refresh: nil)
|
|
257
258
|
b = h(base)
|
data/lib/cronwatch/web/pwa.rb
CHANGED
|
@@ -16,11 +16,27 @@ module Cronwatch
|
|
|
16
16
|
THEME_COLOR = "#ffffff"
|
|
17
17
|
THEME_COLOR_DARK = "#111113"
|
|
18
18
|
|
|
19
|
-
# Registers the service worker, and
|
|
20
|
-
#
|
|
19
|
+
# Registers the service worker, and switches between light and dark on
|
|
20
|
+
# Cmd+Shift+D (Ctrl+Shift+D elsewhere), keeping the choice in
|
|
21
|
+
# localStorage. The page works the same without it. Its own URL gives the base, so it is the same
|
|
21
22
|
# text wherever the dashboard is mounted.
|
|
22
23
|
APP_JS = <<~'JS'
|
|
23
24
|
"use strict";
|
|
25
|
+
(function () {
|
|
26
|
+
var root = document.documentElement;
|
|
27
|
+
try {
|
|
28
|
+
var stored = localStorage.getItem("cronwatch-theme");
|
|
29
|
+
if (stored === "light" || stored === "dark") root.setAttribute("data-theme", stored);
|
|
30
|
+
} catch (e) {}
|
|
31
|
+
document.addEventListener("keydown", function (event) {
|
|
32
|
+
if (!(event.metaKey || event.ctrlKey) || !event.shiftKey || event.altKey || event.code !== "KeyD") return;
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
var shown = root.getAttribute("data-theme") || (matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
|
|
35
|
+
var next = shown === "dark" ? "light" : "dark";
|
|
36
|
+
root.setAttribute("data-theme", next);
|
|
37
|
+
try { localStorage.setItem("cronwatch-theme", next); } catch (e) {}
|
|
38
|
+
});
|
|
39
|
+
})();
|
|
24
40
|
(function () {
|
|
25
41
|
var script = document.currentScript;
|
|
26
42
|
if (!script || !("serviceWorker" in navigator)) return;
|