create-pmos 0.734.0 → 0.735.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.734.0",
3
+ "version": "0.735.0",
4
4
  "description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -34,8 +34,8 @@
34
34
  ],
35
35
  "pmosChanges": [
36
36
  {
37
- "v": "0.734.0",
38
- "at": "2026-11-23T06:23:41.755Z",
37
+ "v": "0.735.0",
38
+ "at": "2026-11-23T06:26:05.595Z",
39
39
  "f": 4,
40
40
  "prs": [
41
41
  {
@@ -67,6 +67,12 @@
67
67
  "t": "The case card shows a chat save at once",
68
68
  "s": "The case card shows a chat save at once",
69
69
  "k": "fix"
70
+ },
71
+ {
72
+ "n": 1627,
73
+ "t": "The Light ground follows the time of day (A339)",
74
+ "s": "The Light ground follows the time of day (A339)",
75
+ "k": "new"
70
76
  }
71
77
  ]
72
78
  },
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@75402dbf
1
+ kernel-source: pmos@5af57152
2
2
  assembled: 2026-11-23
3
3
  mode: vendor
@@ -2,3 +2,6 @@
2
2
  :root, [data-theme="light"] {--ground:#EFE8E3;--ground-morning:#EEF3F8;--ground-afternoon:#F5EEE2;--ground-evening:#EFE8E3;--ground-night:#1B1D21;--card:#FFFFFF;--well:#F4F2EE;--line:rgba(42,46,53,.12);--ink:#2A2E35;--muted:#646A74;--blue:#2F5FB3;--on-blue:#FFFFFF;--blue-tint:#ECF1F8;--leaf:#5F7A45;--leaf-tint:#F2F4F0;--alert:#A4461A;--alert-tint:#F7EEEA}
3
3
  [data-theme="dark"] {--ground:#1B1D21;--card:#24262B;--well:#1B1D21;--line:rgba(236,238,241,.12);--ink:#ECEEF1;--muted:#9EA4AD;--blue:#6AAAF0;--on-blue:#14161A;--blue-tint:#2A323D;--leaf:#A9C48C;--leaf-tint:#2F3333;--alert:#E8A07A;--alert-tint:#363132}
4
4
  :root {--duration-quick:120ms;--duration-enter:200ms;--duration-leaf:600ms;--duration-light:20min;--ease-out:cubic-bezier(.2, .7, .2, 1);--ease-drift:cubic-bezier(.4, 0, .2, 1);--font-sans:"Plus Jakarta Sans", system-ui, sans-serif;--font-mono:"IBM Plex Mono", ui-monospace, monospace}
5
+ :root[data-daytint="morning"]:not([data-theme="dark"]) {--ground:var(--ground-morning)}
6
+ :root[data-daytint="afternoon"]:not([data-theme="dark"]) {--ground:var(--ground-afternoon)}
7
+ :root[data-daytint="evening"]:not([data-theme="dark"]) {--ground:var(--ground-evening)}
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Eval calibration log"
4
4
  description: "Append-only record of every PM override of an evaluator verdict."
5
- generated: {by: process:create-pmos, at: "2026-11-23T06:23:39Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-23T06:26:02Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Health budgets"
4
4
  description: "Closed registry of health-budget anchors (D59), edited only by the PM."
5
- generated: {by: process:create-pmos, at: "2026-11-23T06:23:39Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-23T06:26:02Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -2,7 +2,7 @@
2
2
  type: Reference
3
3
  title: "Discoveries and friction log"
4
4
  description: "Append-only record of what runs discovered and where the process rubbed."
5
- generated: {by: process:create-pmos, at: "2026-11-23T06:23:39Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-23T06:26:02Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,7 +1,7 @@
1
1
  [
2
2
  {
3
- "v": "0.734.0",
4
- "at": "2026-11-23T06:23:41.755Z",
3
+ "v": "0.735.0",
4
+ "at": "2026-11-23T06:26:05.595Z",
5
5
  "f": 4,
6
6
  "prs": [
7
7
  {
@@ -33,6 +33,12 @@
33
33
  "t": "The case card shows a chat save at once",
34
34
  "s": "The case card shows a chat save at once",
35
35
  "k": "fix"
36
+ },
37
+ {
38
+ "n": 1627,
39
+ "t": "The Light ground follows the time of day (A339)",
40
+ "s": "The Light ground follows the time of day (A339)",
41
+ "k": "new"
36
42
  }
37
43
  ]
38
44
  },
@@ -2,3 +2,6 @@
2
2
  :root, [data-theme="light"] {--ground:#EFE8E3;--ground-morning:#EEF3F8;--ground-afternoon:#F5EEE2;--ground-evening:#EFE8E3;--ground-night:#1B1D21;--card:#FFFFFF;--well:#F4F2EE;--line:rgba(42,46,53,.12);--ink:#2A2E35;--muted:#646A74;--blue:#2F5FB3;--on-blue:#FFFFFF;--blue-tint:#ECF1F8;--leaf:#5F7A45;--leaf-tint:#F2F4F0;--alert:#A4461A;--alert-tint:#F7EEEA}
3
3
  [data-theme="dark"] {--ground:#1B1D21;--card:#24262B;--well:#1B1D21;--line:rgba(236,238,241,.12);--ink:#ECEEF1;--muted:#9EA4AD;--blue:#6AAAF0;--on-blue:#14161A;--blue-tint:#2A323D;--leaf:#A9C48C;--leaf-tint:#2F3333;--alert:#E8A07A;--alert-tint:#363132}
4
4
  :root {--duration-quick:120ms;--duration-enter:200ms;--duration-leaf:600ms;--duration-light:20min;--ease-out:cubic-bezier(.2, .7, .2, 1);--ease-drift:cubic-bezier(.4, 0, .2, 1);--font-sans:"Plus Jakarta Sans", system-ui, sans-serif;--font-mono:"IBM Plex Mono", ui-monospace, monospace}
5
+ :root[data-daytint="morning"]:not([data-theme="dark"]) {--ground:var(--ground-morning)}
6
+ :root[data-daytint="afternoon"]:not([data-theme="dark"]) {--ground:var(--ground-afternoon)}
7
+ :root[data-daytint="evening"]:not([data-theme="dark"]) {--ground:var(--ground-evening)}
@@ -2,7 +2,7 @@
2
2
  type: Guide
3
3
  title: "Settings, switches and data freshness"
4
4
  description: "What each section of Settings holds, every PMOS_ environment variable, and how the workspace keeps each source up to date."
5
- timestamp: 2026-11-22
5
+ timestamp: 2026-11-23
6
6
  ---
7
7
 
8
8
  # Settings, switches and data freshness
@@ -11,7 +11,7 @@ Press the round menu button at the bottom of any page, then the **Settings** ico
11
11
 
12
12
  | Section | What it holds |
13
13
  |---|---|
14
- | General | The theme (Light, Dark or Auto), the products Home, the Board and Intelligence read, **New work starts as** (Product, Project or Full SDLC: the kind a new initiative starts as when its name gives no hint; see [what each kind shows](initiatives-and-next-steps.md)), when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›**, **Jev and Laya ›**, **Use log ›** and **Ease check ›** open their own settings (see below). |
14
+ | General | The theme (Light, Dark or Auto), **Light through the day** (on the Light theme, the background is cool in the morning, warm in the afternoon and dusk in the evening; Dark does not change; turn it off here, and the choice follows you to your other devices), the products Home, the Board and Intelligence read, **New work starts as** (Product, Project or Full SDLC: the kind a new initiative starts as when its name gives no hint; see [what each kind shows](initiatives-and-next-steps.md)), when Your day ends, the Your impact switch, and that agents write to Jira only after you press Commit. When a new PMOS is ready, a card here says so. Under **Extras**, **Adler ›**, **Jev and Laya ›**, **Use log ›** and **Ease check ›** open their own settings (see below). |
15
15
  | How PMOS decides | One suggestion from PMOS when it sees a pattern in what you kept, each kind of change PMOS makes by itself, the calls that are **Always yours**, and PMOS's **Lessons**. |
16
16
  | Checks | When PMOS grills an initiative by itself and the monthly credit for its checks. |
17
17
  | Prototype rules | What every prototype version is checked for before you see it. |
@@ -105,6 +105,15 @@ function tokensOf(json) {
105
105
  // declaring them on every page changes no rule.
106
106
  const TYPE_ROOT = ':root:where(*)';
107
107
  const valueOf = (v) => String(v).replace(/\{([a-z0-9-]+)\}/g, 'var(--$1)');
108
+ /* The ground follows the clock (bet A339, initiative time-of-day-tint): each `ground-<part>` token the system defines (morning, afternoon,
109
+ * evening) becomes the page's --ground while pm/day-tint.js sets data-daytint="<part>" on the root. Never in the Dark theme. The rule holds
110
+ * no colour: a change to a ground token in tokens.json reaches every page. scopeSel keeps the :root[…] part in front of the scope. */
111
+ const DAY_PARTS = ['morning', 'afternoon', 'evening'];
112
+ function tintRules(json) {
113
+ const names = new Set(SECTIONS.flatMap((s) => (((json && json[s]) || {}).tokens || []).map((t) => t.name)));
114
+ if (!names.has('ground')) return [];
115
+ return DAY_PARTS.filter((p) => names.has(`ground-${p}`)).map((p) => `:root[data-daytint="${p}"]:not([data-theme="dark"]) {--ground:var(--ground-${p})}`);
116
+ }
108
117
  /** PURE. A system's tokens.json → its tokens.css: the themed tokens (light, then dark), the rest, and (ui only) the type classes. */
109
118
  function tokensCss(json, name) {
110
119
  const light = [], dark = [], rest = [];
@@ -124,6 +133,7 @@ function tokensCss(json, name) {
124
133
  // the UI system's spacing and corners sit at :root in the workspace sheet too (token-swap-same-value): a page sheet that reads them works
125
134
  // on every page, with or without pm-ds
126
135
  if (rest.length) L.push(`${(SYSTEMS[name] || {}).types ? TYPE_ROOT : ':root'} {${rest.join(';')}}`);
136
+ L.push(...tintRules(json));
127
137
  if ((SYSTEMS[name] || {}).types) {
128
138
  // the type styles are tokens (--type-, --leading-, --weight-<style>), and the type classes read them: a change to one style's size in
129
139
  // tokens.json reaches every class and part that names it (initiative token-first-design-system)
@@ -160,6 +170,7 @@ function scopeSel(sel, sys) {
160
170
  const S = sys.scope, t = sel.trim();
161
171
  if (t === ':root' || t === '[data-theme="light"]' || t === 'body') return S;
162
172
  if (t === '[data-theme="dark"]') return darkOf(S);
173
+ if (/^:root\[[^\s]*$/.test(t)) return `${t} ${S}`; // a state on the page root (data-daytint): the scope sits inside it
163
174
  if (t === '*') return `${S} *`;
164
175
  for (const r of sys.roots || []) {
165
176
  if (t === r) return S;
@@ -37,7 +37,7 @@ const DEVICES = ['phone', 'tablet', 'desk'];
37
37
  /* View choices only. A new view choice that should follow the person is added here; nothing else needs to change. */
38
38
  const KEYS = Object.freeze({
39
39
  exact: Object.freeze([
40
- 'pmos.c3.theme', 'pmos.adler',
40
+ 'pmos.c3.theme', 'pmos.daytint', 'pmos.adler',
41
41
  'pmos.work.view.3', 'pmos.work.sprint', 'pmos.work.classic', 'pmos.work.backlog',
42
42
  'pmos.backlog.view', 'pmos.backlog.prefs',
43
43
  'pmos.tasks.view', 'pmos.tasks.zoom', 'pmos.tasks.cols.timeline',
@@ -21,7 +21,8 @@
21
21
  * clear(dir) → { ok }
22
22
  * keys(lines, days, now) → { used, missed, pct } PURE, the action keys (bet A477)
23
23
  * CLI: node lib/use-log.js count → the distinct days with a line in the last KEEP_DAYS days, on its last line (the health number)
24
- * node lib/use-log.js keys [--days 7] → [action-keys] used n, [action-keys] missed n, then the hit percent on its last line */
24
+ * node lib/use-log.js keys [--days 7] → [action-keys] used n, [action-keys] missed n, then the hit percent on its last line
25
+ * node lib/use-log.js control <id> [--days 7] → the uses of one control on its last line (day-tint: bet A339's health number) */
25
26
  const fs = require('fs');
26
27
  const path = require('path');
27
28
 
@@ -134,13 +135,22 @@ function keys(lines, days = 7, now = Date.now()) {
134
135
 
135
136
  module.exports.keys = keys;
136
137
 
138
+ /** PURE: the uses of one control in the last `days` days (bet A339: `day-tint` is noted once per page open with the tint on). */
139
+ function controlCount(lines, control, days = 7, now = Date.now()) {
140
+ const from = now - Math.max(1, Number(days) || 7) * DAY;
141
+ return (lines || []).filter((l) => l && l.kind === 'use' && l.control === control && Date.parse(l.at) >= from).length;
142
+ }
143
+ module.exports.controlCount = controlCount;
144
+
137
145
  if (require.main === module) {
138
146
  const cmd = process.argv[2];
139
147
  const usage = 'usage: node lib/use-log.js count (the distinct days with a line in the last ' + KEEP_DAYS + ' days)\n'
140
- + ' node lib/use-log.js keys [--days 7] (actions taken with a key, presses with nothing to act on, and the hit percent)';
141
- if (cmd !== 'count' && cmd !== 'keys') { console.error(usage); process.exit(2); }
148
+ + ' node lib/use-log.js keys [--days 7] (actions taken with a key, presses with nothing to act on, and the hit percent)\n'
149
+ + ' node lib/use-log.js control <id> [--days 7] (the uses of one control, on the last line)';
150
+ if (cmd !== 'count' && cmd !== 'keys' && !(cmd === 'control' && CONTROL_RE.test(process.argv[3] || ''))) { console.error(usage); process.exit(2); }
142
151
  const dir = require('./state-root.js').defaultRoot({ env: process.env });
143
152
  if (cmd === 'count') console.log(String(summary(readLines(dir)).days));
153
+ else if (cmd === 'control') { const i = process.argv.indexOf('--days'); console.log(String(controlCount(readLines(dir), process.argv[3], i > 0 ? process.argv[i + 1] : 7))); }
144
154
  else {
145
155
  const i = process.argv.indexOf('--days'), k = keys(readLines(dir), i > 0 ? process.argv[i + 1] : 7);
146
156
  console.log('[action-keys] used ' + k.used);
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.734.0",
3
+ "version": "0.735.0",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pmos-workspace",
9
- "version": "0.734.0",
9
+ "version": "0.735.0",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@anthropic-ai/sdk": "^1.3.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pmos-workspace",
3
- "version": "0.734.0",
3
+ "version": "0.735.0",
4
4
  "private": true,
5
5
  "description": "PMOS Terminal Workspace — local companion hosting real PTYs beside the library and gates (D62)",
6
6
  "license": "MIT",
@@ -6,3 +6,6 @@
6
6
  :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:#EFE8E3;--ground-morning:#EEF3F8;--ground-afternoon:#F5EEE2;--ground-evening:#EFE8E3;--ground-night:#1B1D21;--card:#FFFFFF;--well:#F4F2EE;--line:rgba(42,46,53,.12);--ink:#2A2E35;--muted:#646A74;--blue:#2F5FB3;--on-blue:#FFFFFF;--blue-tint:#ECF1F8;--leaf:#5F7A45;--leaf-tint:#F2F4F0;--alert:#A4461A;--alert-tint:#F7EEEA}
7
7
  :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds).dark, html.dark :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds), :root[data-theme="dark"] :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:#1B1D21;--card:#24262B;--well:#1B1D21;--line:rgba(236,238,241,.12);--ink:#ECEEF1;--muted:#9EA4AD;--blue:#6AAAF0;--on-blue:#14161A;--blue-tint:#2A323D;--leaf:#A9C48C;--leaf-tint:#2F3333;--alert:#E8A07A;--alert-tint:#363132}
8
8
  :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--duration-quick:120ms;--duration-enter:200ms;--duration-leaf:600ms;--duration-light:20min;--ease-out:cubic-bezier(.2, .7, .2, 1);--ease-drift:cubic-bezier(.4, 0, .2, 1);--font-sans:"Plus Jakarta Sans", system-ui, sans-serif;--font-mono:"IBM Plex Mono", ui-monospace, monospace}
9
+ :root[data-daytint="morning"]:not([data-theme="dark"]) :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:var(--ground-morning)}
10
+ :root[data-daytint="afternoon"]:not([data-theme="dark"]) :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:var(--ground-afternoon)}
11
+ :root[data-daytint="evening"]:not([data-theme="dark"]) :is(.pm-ds,.pmd-ds,.pms-ds,.pmc-ds){--ground:var(--ground-evening)}
@@ -39,6 +39,7 @@
39
39
  * lists the chats by work (pm/phone-ask.js). The page's own ⋯ (the phone chat) opens the same menu; its own rows are not added on a phone.
40
40
  */
41
41
  import { esc, svg, ICON, wsQ, wsParam } from './cozy-evui.js';
42
+ import { startDayTint } from './day-tint.js';
42
43
  import { fabLabel, bannerOf } from './cozy-evmodel.js';
43
44
  import { mountToastFaces, loadPrefs } from './cozy-adler.js';
44
45
  import './draft-keep.js'; // forms-keep-drafts: every text box on every page keeps a draft until sent, saved or cleared
@@ -193,6 +194,7 @@ export function mountNav(here, doc = document, opts = {}) {
193
194
  addCss(doc);
194
195
  { const u = new URLSearchParams(location.search).get('theme'); setTheme(u || themePick(), doc, { keep: false }); } // ?theme= shows that theme and is not kept
195
196
  if (typeof matchMedia === 'function') { const mq = matchMedia('(prefers-color-scheme: dark)'); const f = () => { if (themePick() === 'auto') setTheme('auto', doc); }; if (mq.addEventListener) mq.addEventListener('change', f); }
197
+ startDayTint(doc); // the Light ground follows the clock (bet A339); never in Dark, off in Settings
196
198
  const w = doc.createElement('div'); w.className = 'cz-fabw'; w.id = 'czNav';
197
199
  w.innerHTML = '<div class="ev-scrim" id="czScrim" hidden></div>'
198
200
  + `<nav class="cz-fabm ev-menu" id="czMenu" aria-label="Menu" hidden></nav>`
@@ -63,6 +63,7 @@ import * as AD from './cozy-adler.js';
63
63
  import * as SE from './cozy-seasons.js';
64
64
  import { weeksOf, lineOf, storiesOf } from './upd-weeks.js';
65
65
  import * as SD from './set-ds.js';
66
+ import { tintOn, setDayTint } from './day-tint.js'; // bet A339: the Light ground follows the clock
66
67
  import { relayState, relayLoad, relayHtml, relayClick } from './cozy-relay.js'; // event-relay (D110): Connectors › Listening
67
68
  import { extState, extLoad, extHtml, extClick } from './cozy-ext.js'; // meeting-buddy: Connectors › Google Meet, the Chrome extension set up from here
68
69
  const RL = relayState();
@@ -112,6 +113,7 @@ function general() {
112
113
  const hours = []; for (let h = 13; h <= 23; h++) hours.push(h);
113
114
  const upd = ready() ? `<div class="ev-card ev-upd">${adFace('needs-you')}<span class="pm-badge blue">Update</span><p><b>PMOS ${esc(latest())} is ready.</b> <span class="ev-mut">${esc(firstLine())}</span></p><button type="button" class="ev-btn sm" data-ev-go="updates">What's new</button><button type="button" class="ev-btn sm dark" data-ev-upd="update">${appBehind() ? 'Restart to update' : 'Update'}</button></div>` : '';
114
115
  return trow('Theme', 'Auto follows your computer', seg('Theme', 'theme', theme, [['light', 'Light'], ['dark', 'Dark'], ['auto', 'Auto']]))
116
+ + trow('Light through the day', 'The Light theme’s background moves from cool morning to warm afternoon and dusk. Dark is never changed.', sw(tintOn(), 'data-ev-daytint', 'Light through the day'))
115
117
  + trow('Product', 'Which products Today, Work and Goals read', `<button type="button" class="ev-pick" data-ev-products aria-haspopup="menu">${esc(pname)} ${svg(ICON.down, 14)}</button>`)
116
118
  + trow('New work starts as', 'The kind a new initiative starts as. Project hides Triage, Discover and the product documents. Each initiative can change it.', seg('New work starts as', 'work.role', roleVal(), [['product', 'Product'], ['project', 'Project'], ['sdlc', 'Full SDLC']]))
117
119
  + trow('Your day', 'When the end-of-day card shows', `<label class="ev-vh" for="evDay">Your day ends at</label><select id="evDay" class="ev-inp" data-ev-day>${hours.map((h) => `<option value="${h}"${h === end ? ' selected' : ''}>${pad(h)}:00</option>`).join('')}</select>`)
@@ -709,6 +711,7 @@ async function press(e) {
709
711
  if (t.dataset.evDsw) { const k = t.dataset.evDsw, P = dp(), v = !(k === 'adler.dress.on' || k === 'adler.dress.pmosday' ? P[k] !== false : P[k] === true); await saveDress(k, v); return; }
710
712
  if (t.dataset.evDday) { const P = dp(), x = SE.moreDays(P).find((y) => y.key === t.dataset.evDday); if (x) await saveDress('adler.dress.days', { ...(P['adler.dress.days'] || {}), [x.key]: !x.on }); return; }
711
713
  if (t.dataset.evWear) { const P = dp(), k = t.dataset.evWear, w = P['adler.dress.wear'], worn = !!(w && w.key === k && w.day === SE.wearNow(k, Date.now(), P).value.day); const r = SE.wearNow(worn ? '' : k, Date.now(), P); await saveDress(r.key, r.value, worn ? 'Taken off.' : 'He wears it until midnight.'); return; }
714
+ if ('evDaytint' in t.dataset) { const on = !tintOn(); setDayTint(on); T.msg = on ? 'The background follows the time of day.' : 'The background stays the same all day.'; draw(); return; }
712
715
  if ('evImpact' in t.dataset) {
713
716
  const on = !impactOn(), r = await pmPost('/api/settings', { key: 'impact.on', value: on });
714
717
  if (r && r.ok) { const x = T.set && Array.isArray(T.set.settings) ? T.set.settings.find((y) => y.key === 'impact.on') : null; if (x) x.value = on; window.dispatchEvent(new CustomEvent('pmos:impact', { detail: { on } })); }
@@ -0,0 +1,82 @@
1
+ /* pm/day-tint.js — the workspace ground follows the clock (bet A339, initiative time-of-day-tint).
2
+ *
3
+ * The brand system names a ground for each part of the day (design-system/brand/tokens.json: ground-morning, ground-afternoon,
4
+ * ground-evening). lib/design-system.js writes one rule per part into brand.css:
5
+ * :root[data-daytint="<part>"]:not([data-theme="dark"]) :is(.pm-ds, …) { --ground: var(--ground-<part>) }
6
+ * This module only sets data-daytint on the page root. No colour lives here: a change to a ground token in tokens.json reaches every page.
7
+ *
8
+ * Never in the Dark theme: the theme is the person's choice (Light, Dark, Auto), and the tint only colours the Light ground.
9
+ * Off: pmos.daytint = off in this browser's storage (Settings › General › Light through the day). lib/prefs-sync.js carries the key to
10
+ * the person's other devices. On is the default, so On removes the key.
11
+ *
12
+ * partOf(hour) → 'morning' | 'afternoon' | 'evening' PURE
13
+ * tintOn(store) → boolean
14
+ * applyTint(doc, { now, store }) → the part set, or ''
15
+ * startDayTint(doc, { now, store, every, note }) → stop() applies now, on each theme change, and every 5 minutes
16
+ * setDayTint(on, doc, { store, now }) the Settings switch
17
+ *
18
+ * The health number: each page open with the tint on notes one `day-tint` use in the local use log (pm/use-log.js noteUse);
19
+ * `node lib/use-log.js control day-tint --days 7` counts them. Console lines start with [day-tint]. */
20
+
21
+ export const KEY = 'pmos.daytint';
22
+ const EVERY = 5 * 60e3;
23
+ const EASE_AFTER = 1000; // the first paint takes the ground at once; only a later change moves slowly (--duration-light)
24
+
25
+ const local = () => { try { return globalThis.localStorage || null; } catch { return null; } };
26
+ const get = (s, k) => { try { return s ? s.getItem(k) : null; } catch { return null; } };
27
+
28
+ /** The part of the day for an hour 0-23: 05-11 morning, 12-16 afternoon, every other hour evening. */
29
+ export function partOf(hour) {
30
+ const h = Number(hour);
31
+ if (h >= 5 && h < 12) return 'morning';
32
+ if (h >= 12 && h < 17) return 'afternoon';
33
+ return 'evening';
34
+ }
35
+
36
+ /** On unless the person turned it off on this or another device. */
37
+ export const tintOn = (store = local()) => get(store, KEY) !== 'off';
38
+
39
+ const isDark = (doc) => doc.documentElement.dataset.theme === 'dark';
40
+
41
+ /** Set or clear data-daytint on the page root. Returns the part set, or '' when cleared. */
42
+ export function applyTint(doc = document, { now = new Date(), store = local() } = {}) {
43
+ const ds = doc.documentElement.dataset;
44
+ if (!tintOn(store) || isDark(doc)) { delete ds.daytint; return ''; }
45
+ const part = partOf(now.getHours());
46
+ if (ds.daytint !== part) ds.daytint = part;
47
+ return part;
48
+ }
49
+
50
+ /** The Settings switch: keep the choice and apply it at once. */
51
+ export function setDayTint(on, doc = document, { store = local(), now = new Date() } = {}) {
52
+ try { if (on) store.removeItem(KEY); else store.setItem(KEY, 'off'); } catch { /* storage blocked: applies to this page only */ }
53
+ if (on) return applyTint(doc, { now, store });
54
+ delete doc.documentElement.dataset.daytint;
55
+ return '';
56
+ }
57
+
58
+ async function noteOpen() {
59
+ try { const M = await import('./use-log.js'); return M.noteUse('day-tint'); } catch { return false; }
60
+ }
61
+
62
+ /** Start on a page: apply now, on each theme change (cozy-nav.js setTheme fires cz:theme) and every 5 minutes. Returns stop(). */
63
+ export function startDayTint(doc = document, { now = () => new Date(), store = local(), every = EVERY, note = noteOpen } = {}) {
64
+ const ds = doc.documentElement.dataset;
65
+ let noted = false;
66
+ const run = () => {
67
+ const part = applyTint(doc, { now: now(), store });
68
+ if (part && !noted) {
69
+ noted = true;
70
+ // the use log may start after the menu: one more try a few seconds later
71
+ Promise.resolve(note('day-tint')).then((r) => { if (r === false && every) setTimeout(() => note('day-tint'), 3000); }).catch(() => {});
72
+ try { console.log(`[day-tint] ${part}`); } catch { /* no console */ }
73
+ }
74
+ return part;
75
+ };
76
+ run();
77
+ const onTheme = () => run();
78
+ doc.addEventListener('cz:theme', onTheme);
79
+ const ease = every ? setTimeout(() => { ds.daytintEase = ''; }, EASE_AFTER) : null;
80
+ const tick = every ? setInterval(run, every) : null;
81
+ return () => { doc.removeEventListener('cz:theme', onTheme); if (tick) clearInterval(tick); if (ease) clearTimeout(ease); };
82
+ }
@@ -19,3 +19,5 @@
19
19
  --cz-done: var(--blue); --cz-bubble: var(--blue-tint); --cz-solid: var(--blue); --cz-onsolid: var(--on-blue);
20
20
  }
21
21
  :root body.pm-ds :focus-visible { outline: none; box-shadow: var(--glow); }
22
+ /* the ground follows the clock (pm/day-tint.js, bet A339): after the first paint, a change of part moves slowly */
23
+ :root[data-daytint-ease] body.pm-ds { transition: background-color var(--duration-light) var(--ease-drift); }
@@ -0,0 +1,9 @@
1
+ {
2
+ "_comment": "bet A339 time-of-day-tint: the ground follows the clock through the brand tokens (pm/day-tint.js, lib/design-system.js tint rules), the Settings switch, the follow-the-person key and the use-log health count.",
3
+ "modules": [
4
+ "day-tint.test.js"
5
+ ],
6
+ "seconds": {
7
+ "day-tint.test.js": 1
8
+ }
9
+ }