create-pmos 0.691.0 → 0.693.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 +20 -14
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/adler-moments-test.js +3 -35
- package/workspace/adler-seasons-test.js +1 -1
- package/workspace/briefing-premium-adddoc-test.js +1 -1
- package/workspace/briefing-premium-board-test.js +1 -1
- package/workspace/briefing-premium-doc-edit-test.js +1 -1
- package/workspace/briefing-premium-work-test.js +2 -2
- package/workspace/changelog.json +19 -0
- package/workspace/chat-asks-test.js +1 -1
- package/workspace/core-docs-workflow-test.js +1 -1
- package/workspace/ev-everywhere-test.js +3 -14
- package/workspace/guide/cli.md +3 -1
- package/workspace/guide/home.md +1 -1
- package/workspace/guide/layout.md +2 -2
- package/workspace/guide/settings-and-switches.md +0 -1
- package/workspace/impact-screens-test.js +2 -47
- package/workspace/ini-workflow-test.js +1 -1
- package/workspace/lib/board-premium.js +10 -2
- package/workspace/lib/initiative-cli.js +31 -4
- package/workspace/lib/initiative-origin.js +131 -0
- package/workspace/lib/initiative-writer.js +35 -2
- package/workspace/lib/routes-boards.js +4 -1
- package/workspace/live-pill-round-test.js +6 -18
- package/workspace/milestone-suggest-test.js +4 -28
- package/workspace/news-viewers-test.js +3 -29
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/premium-board-actions-test.js +2 -2
- package/workspace/premium-briefing-depth-test.js +4 -4
- package/workspace/premium-chat-attach-test.js +3 -2
- package/workspace/premium-chat-chart-tab-test.js +8 -7
- package/workspace/premium-chat-context-test.js +3 -1
- package/workspace/premium-chat-goal-view-test.js +3 -1
- package/workspace/premium-chat-line-test.js +8 -6
- package/workspace/premium-chat-report-tab-test.js +13 -5
- package/workspace/premium-chat-term-test.js +2 -2
- package/workspace/premium-chat-viewer-test.js +10 -16
- package/workspace/premium-core-doc-issue-test.js +7 -2
- package/workspace/premium-discuss-landing-test.js +9 -5
- package/workspace/premium-html-viewer-test.js +7 -3
- package/workspace/premium-link-suggest-test.js +6 -10
- package/workspace/premium-phone-card-test.js +2 -2
- package/workspace/premium-viewer-download-test.js +1 -1
- package/workspace/premium-viewer-flicker-test.js +1 -1
- package/workspace/premium-viewer-share-test.js +2 -2
- package/workspace/premium-viewer-test.js +1 -1
- package/workspace/premium-vw-cal-test.js +1 -1
- package/workspace/premium-vw-copy-test.js +3 -3
- package/workspace/premium-vw-doc-test.js +1 -1
- package/workspace/premium-vw-item-test.js +1 -1
- package/workspace/premium-work-depth-test.js +2 -2
- package/workspace/program-charter-test.js +1 -12
- package/workspace/program-leave-test.js +2 -2
- package/workspace/program-order-test.js +3 -65
- package/workspace/project-onboard-flow-test.js +5 -5
- package/workspace/public/pm/bd-work.js +24 -5
- package/workspace/public/pm/cozy-home.css +0 -6
- package/workspace/public/pm/cozy-panels.js +2 -6
- package/workspace/public/pm/cozy-popup.css +1 -0
- package/workspace/public/pm/cozy-popup.js +15 -2
- package/workspace/public/pm/cozy-today-page.css +1 -1
- package/workspace/public/pm/cozy-today.css +0 -14
- package/workspace/public/pm/cozy-viewer.js +14 -38
- package/workspace/public/pm/goal-chat.js +2 -2
- package/workspace/public/pm/home-app.js +8 -67
- package/workspace/public/pm/home-chat.js +1 -1
- package/workspace/public/pm/home-ses-name.js +3 -2
- package/workspace/public/pm/home-today.js +4 -18
- package/workspace/public/premium-intelligence.html +1 -1
- package/workspace/public/premium-viewer.html +1 -1
- package/workspace/public/premium-workflows.html +1 -1
- package/workspace/ready-dash-ui-test.js +1 -1
- package/workspace/rename-test.js +2 -2
- package/workspace/server.js +11 -12
- package/workspace/session-names-test.js +34 -56
- package/workspace/sort-order-test.js +2 -71
- package/workspace/split-merge-ui-test.js +1 -1
- package/workspace/stage-card-tasks-test.js +1 -1
- package/workspace/stage-card-test.js +1 -1
- package/workspace/task-card-test.js +1 -1
- package/workspace/task-press-test.js +1 -1
- package/workspace/task-views-test.js +1 -1
- package/workspace/test-lists/adler-seasons-art.json +3 -6
- package/workspace/test-lists/batch18-asks.json +1 -1
- package/workspace/test-lists/briefing-premium.json +1 -11
- package/workspace/test-lists/premium-agreed-viewer.json +1 -1
- package/workspace/test-lists/who-raised-each-idea.json +5 -0
- package/workspace/test-run.js +0 -2
- package/workspace/test-timings.json +0 -4
- package/workspace/tk-tasks-test.js +3 -17
- package/workspace/viewer-trail-test.js +2 -2
- package/workspace/workflows-setup-test.js +4 -2
- package/workspace/adler-seasons-art-test.js +0 -116
- package/workspace/briefing-premium-initiative-test.js +0 -289
- package/workspace/briefing-premium-products-test.js +0 -209
- package/workspace/briefing-premium-sources-test.js +0 -250
- package/workspace/briefing-premium-test.js +0 -282
- package/workspace/home-other-product-test.js +0 -197
- package/workspace/home-pill-test.js +0 -138
- package/workspace/home-railcard-test.js +0 -196
- package/workspace/home-rows-test.js +0 -389
- package/workspace/panels-test.js +0 -454
- package/workspace/public/premium.html +0 -48
- package/workspace/test-lists/batch18-panels.json +0 -9
- package/workspace/test-lists/home-railcard.json +0 -9
- package/workspace/test-lists/home-sessions-pill.json +0 -6
- package/workspace/test-lists/viewer-home-rows.json +0 -9
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
|
-
/* program-order-test.js — the order of a program's initiatives on the Board
|
|
3
|
+
/* program-order-test.js — the order of a program's initiatives on the Board (feedback batch 3 item 5, option A agreed 2026-10-25;
|
|
4
4
|
* canvas RoADrag, RoASuggest, RoAApplied, RoAPhone). Serves the real pages from the real server; GET /api/programs answers Project Ascent
|
|
5
5
|
* (fixtures/program-ascent.js) and POST /api/programs/order is answered here, from the order the page sent, so a reload reads it back.
|
|
6
6
|
* B Board: the program's rows follow its order; ✦ shows (with its dot) only while the dates disagree; the suggestion lists the date order with a
|
|
7
7
|
* reason per row; ✓ applies it, Undo puts the order back; ✕ is "not now" until a date changes; drag by the grip; Alt + ↓ moves a row
|
|
8
|
-
* (the programs, products and a product's initiatives are
|
|
9
|
-
*
|
|
8
|
+
* (the programs, products and a product's initiatives are the Board's own lists, [data-po-list^="@"]: sort-order-test.js)
|
|
9
|
+
* Home's program group read the same order; its checks went with Home's page (home-desk-layout-delete). */
|
|
10
10
|
const path = require('path');
|
|
11
11
|
const { classicBoard } = require('./lib/classic-board'); // these checks are about the four Board views, not Work (work-one-view)
|
|
12
12
|
const { spawn } = require('child_process');
|
|
@@ -119,67 +119,5 @@ const routePrograms = async (page) => {
|
|
|
119
119
|
await ctx.close();
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
/* H — Home: the same order, the grip, and a phone's hold-then-drag */
|
|
123
|
-
const home = async (o = {}) => {
|
|
124
|
-
const ctx = await browser.newContext({ viewport: { width: o.w || 1440, height: o.h || 900 }, hasTouch: !!o.touch, isMobile: !!o.touch });
|
|
125
|
-
const page = await ctx.newPage();
|
|
126
|
-
const errors = [];
|
|
127
|
-
page.on('pageerror', (e) => errors.push(String((e && e.message) || e)));
|
|
128
|
-
const json = (body) => (r) => r.fulfill({ contentType: 'application/json', body: JSON.stringify(body) });
|
|
129
|
-
await page.route(/\/api\/briefing-premium(\?.*)?$/, json({ ok: true, state: 'ready', model: B.build(HF.facts()), as_of: Date.now() }));
|
|
130
|
-
await page.route('**/api/briefing-premium/thread**', json({ ok: true, turns: [], working: false }));
|
|
131
|
-
await page.route('**/api/board-premium*', (r) => { const q = new URL(r.request().url()).searchParams; r.fulfill({ contentType: 'application/json', body: JSON.stringify({ ok: true, state: 'ready', model: BP.build(F.programFacts(q.get('ws') || 'idpf')), as_of: Date.now() }) }); });
|
|
132
|
-
await page.route('**/api/board-trail*', (r) => r.fulfill({ status: 500, contentType: 'application/json', body: JSON.stringify({ ok: false, error: 'not in this check' }) }));
|
|
133
|
-
await routePrograms(page);
|
|
134
|
-
const am = new Date(); am.setHours(10, 0, 0, 0); await page.clock.setFixedTime(am);
|
|
135
|
-
await page.goto(BASE + '/premium.html?theme=light');
|
|
136
|
-
// Home shows only the rows with a call (home-nav-rows-with-a-call): open the program's "N more" so every row of its order shows
|
|
137
|
-
await until(() => page.evaluate(() => { document.querySelectorAll('#hmList .hv-g.prg .hv-fold[aria-expanded="false"]').forEach((b) => b.click()); return !!document.querySelector('#hmList .hv-g.prg [data-po-id]') && document.body.dataset.hmTop === '1'; }), 20000);
|
|
138
|
-
return { ctx, page, errors };
|
|
139
|
-
};
|
|
140
|
-
const hkids = (p) => p.evaluate(() => [...document.querySelectorAll('#hmList .hv-g.prg [data-po-id]')].map((r) => r.dataset.poId));
|
|
141
|
-
{
|
|
142
|
-
ORDER = ['legacy-idp-sunset', 'descope-parity'];
|
|
143
|
-
const n0 = posts.length;
|
|
144
|
-
const { ctx, page: p, errors } = await home();
|
|
145
|
-
ok('H Home\'s program group lists the program\'s order (not your turn first)', (await hkids(p)).join() === 'legacy-idp-sunset,descope-parity', JSON.stringify(await hkids(p)));
|
|
146
|
-
ok('H ✦ sits in the open program header', !!(await p.$('#hmList .hv-g.prg .hv-gh [data-po-sug]')));
|
|
147
|
-
if (process.env.SHOTS) { await p.hover('#hmList [data-po-id="descope-parity"]'); await p.screenshot({ path: process.env.SHOTS + '/home-desk.png' }); }
|
|
148
|
-
await p.hover('#hmList [data-po-id="descope-parity"]');
|
|
149
|
-
const g = await p.locator('#hmList [data-po-id="descope-parity"] [data-po-grip]').boundingBox();
|
|
150
|
-
const top = await p.locator('#hmList [data-po-id="legacy-idp-sunset"]').boundingBox();
|
|
151
|
-
await p.mouse.move(g.x + g.width / 2, g.y + g.height / 2); await p.mouse.down();
|
|
152
|
-
await p.mouse.move(g.x + g.width / 2, top.y + 6, { steps: 6 }); await p.mouse.up();
|
|
153
|
-
await until(async () => (await hkids(p))[0] === 'descope-parity');
|
|
154
|
-
ok('H the grip moves a row on Home too: one write, and the list follows it', posts.length === n0 + 1 && (await hkids(p)).join() === 'descope-parity,legacy-idp-sunset', JSON.stringify({ k: await hkids(p), posts: posts.slice(n0) }));
|
|
155
|
-
ok('H no page error', !errors.length, errors.join(' | '));
|
|
156
|
-
await ctx.close();
|
|
157
|
-
}
|
|
158
|
-
{
|
|
159
|
-
ORDER = ['legacy-idp-sunset', 'descope-parity'];
|
|
160
|
-
const n0 = posts.length;
|
|
161
|
-
const { ctx, page: p, errors } = await home({ w: 390, h: 844, touch: true });
|
|
162
|
-
const grips = await p.evaluate(() => [...document.querySelectorAll('#hmList [data-po-grip]')].filter((g) => getComputedStyle(g).display !== 'none').length);
|
|
163
|
-
ok('H phone: no grip shows (hold the row instead)', grips === 0, String(grips));
|
|
164
|
-
// a hold, then a drag, through the touch events the page reads (CDP touch input)
|
|
165
|
-
// the top of Home (Your move, Waiting on others) sits above the groups: bring the rows into view first
|
|
166
|
-
await p.evaluate(() => document.querySelector('#hmList [data-po-id="descope-parity"]').scrollIntoView({ block: 'center' }));
|
|
167
|
-
const s = await p.locator('#hmList [data-po-id="descope-parity"]').boundingBox();
|
|
168
|
-
const t = await p.locator('#hmList [data-po-id="legacy-idp-sunset"]').boundingBox();
|
|
169
|
-
const cdp = await ctx.newCDPSession(p);
|
|
170
|
-
const pt = (y) => [{ x: s.x + s.width / 2, y }];
|
|
171
|
-
await cdp.send('Input.dispatchTouchEvent', { type: 'touchStart', touchPoints: pt(s.y + s.height / 2) });
|
|
172
|
-
await sleep(600);
|
|
173
|
-
const lifted = await p.evaluate(() => !!document.querySelector('[data-po-id="descope-parity"].po-lift'));
|
|
174
|
-
if (process.env.SHOTS) await p.screenshot({ path: process.env.SHOTS + '/home-phone-hold.png' });
|
|
175
|
-
for (let k = 1; k <= 6; k++) await cdp.send('Input.dispatchTouchEvent', { type: 'touchMove', touchPoints: pt(s.y + s.height / 2 - ((s.y + s.height / 2 - (t.y + 6)) * k) / 6) });
|
|
176
|
-
await cdp.send('Input.dispatchTouchEvent', { type: 'touchEnd', touchPoints: [] });
|
|
177
|
-
await until(async () => (await hkids(p))[0] === 'descope-parity');
|
|
178
|
-
ok('H phone: hold the row, it lifts; drag it up and the order saves', lifted && posts.length === n0 + 1 && (await hkids(p)).join() === 'descope-parity,legacy-idp-sunset', JSON.stringify({ lifted, k: await hkids(p), posts: posts.slice(n0) }));
|
|
179
|
-
const wide = await p.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth + 1);
|
|
180
|
-
ok('H phone: no sideways scroll', wide);
|
|
181
|
-
ok('H phone: no page error', !errors.length, errors.join(' | '));
|
|
182
|
-
await ctx.close();
|
|
183
|
-
}
|
|
184
122
|
finish();
|
|
185
123
|
})();
|
|
@@ -38,11 +38,11 @@ const shot = async (p, name) => { if (SHOTS) { fs.mkdirSync(SHOTS, { recursive:
|
|
|
38
38
|
const press = (act) => p.locator(`#obChat [data-ob="${act}"]`).last().click();
|
|
39
39
|
const say = async (pg, text) => { await pg.fill('#obChat textarea', text); await pg.keyboard.press('Enter'); };
|
|
40
40
|
|
|
41
|
-
await step('The old Welcome page opens the
|
|
41
|
+
await step('The old Welcome page opens the setup conversation on Today; the login is checked by itself and the composer is open', async () => {
|
|
42
42
|
await p.goto(T.BASE + '/premium-welcome.html?ws=x&step=sources');
|
|
43
|
-
assert.match(p.url(), /\/
|
|
43
|
+
assert.match(p.url(), /\/today\.html\?onboard=1$/);
|
|
44
44
|
await p.waitForSelector('#obChat .ob-prop');
|
|
45
|
-
assert(await p.locator('#hmChat').isHidden(), 'one chat at a time'); assert(await p.locator('#
|
|
45
|
+
assert(await p.locator('#hmChat').isHidden(), 'one chat at a time'); assert(await p.locator('#tdPage').isVisible(), 'Today stays behind the popup');
|
|
46
46
|
assert.match(await p.locator('#obChat .ob-prop').innerText(), /Sign in to Claude Code/, 'only a failed check asks');
|
|
47
47
|
assert(!(await p.locator('#obChat input[name="ob-login"]').count()), 'no login picker on the first screen');
|
|
48
48
|
assert(await p.locator('#obChat textarea').isEnabled(), 'the composer is open from the first screen');
|
|
@@ -116,7 +116,7 @@ const shot = async (p, name) => { if (SHOTS) { fs.mkdirSync(SHOTS, { recursive:
|
|
|
116
116
|
await p.waitForSelector('#rvChat .rv-ticks'); await p.waitForSelector('#rvChat .rv-draft'); // B2: Home opens on the reveal, with the drafted initiative
|
|
117
117
|
await p.waitForFunction(() => /Checkout redesign/i.test(document.querySelector('#hmList').innerText), null, { timeout: 15000 });
|
|
118
118
|
const ph = await (await browser.newContext({ viewport: { width: 390, height: 844 } })).newPage();
|
|
119
|
-
await ph.goto(T.BASE + '/
|
|
119
|
+
await ph.goto(T.BASE + '/today.html?onboard=1'); await ph.waitForSelector('#obChat .ob-fund'); await shot(ph, 'onboard-5-fundamentals-phone');
|
|
120
120
|
assert(await ph.locator('#obChat').isVisible()); await ph.close();
|
|
121
121
|
});
|
|
122
122
|
await step('The same folder again is reused as existing PMOS, never reinstalled', async () => {
|
|
@@ -125,7 +125,7 @@ const shot = async (p, name) => { if (SHOTS) { fs.mkdirSync(SHOTS, { recursive:
|
|
|
125
125
|
const h = await T.pressHeaders(T.BASE);
|
|
126
126
|
await fetch(T.BASE + '/api/onboard/reset', { method: 'POST', headers: h, body: '{}' });
|
|
127
127
|
const ph = await (await browser.newContext({ viewport: { width: 390, height: 844 } })).newPage();
|
|
128
|
-
await ph.goto(T.BASE + '/
|
|
128
|
+
await ph.goto(T.BASE + '/today.html?onboard=1');
|
|
129
129
|
await ph.waitForSelector('#obChat .ob-good', { timeout: 15000 });
|
|
130
130
|
await say(ph, `Checkout redesign. The folder is ${root}`);
|
|
131
131
|
await ph.waitForSelector('#obChat [data-ob="plan-yes"]', { timeout: 15000 });
|
|
@@ -34,9 +34,10 @@ export const COLS = [
|
|
|
34
34
|
{ k: 'program', n: 'Program', w: 150, on: false },
|
|
35
35
|
{ k: 'goal', n: 'Goal', w: 170, on: false },
|
|
36
36
|
{ k: 'wf', n: 'Workflow', w: 140, on: false },
|
|
37
|
+
{ k: 'origin', n: 'Raised by', w: 150, on: false }, // who raised it (who-raised-each-idea, bet A445): lib/initiative-origin.js on the row
|
|
37
38
|
];
|
|
38
39
|
const byK = Object.fromEntries(COLS.map((c) => [c.k, c]));
|
|
39
|
-
export const GROUPS = [['goal', 'Goal'], ['product', 'Product'], ['stage', 'Stage'], ['status', 'Status'], ['program', 'Program'], ['none', 'No groups']];
|
|
40
|
+
export const GROUPS = [['goal', 'Goal'], ['product', 'Product'], ['stage', 'Stage'], ['status', 'Status'], ['program', 'Program'], ['origin', 'Raised by'], ['none', 'No groups']];
|
|
40
41
|
// the scale tabs (WorkDS, 2026-11-20): Week, Month, Quarter, Year and Full; the number is the window's length in days (Full fits the rows)
|
|
41
42
|
export const SPANS = [['week', 'Week', 42], ['month', 'Month', 152], ['quarter', 'Quarter', 456], ['year', 'Year', 1096], ['full', 'Full', 0]];
|
|
42
43
|
const OLD_SPAN = { half: 'quarter', y2: 'year', y5: 'year' }; // a view kept before the scale tabs
|
|
@@ -94,6 +95,16 @@ export function moveCol(k, before) {
|
|
|
94
95
|
/** The columns to draw beside Initiative: the ones switched on, in their order; Product leaves by itself with one product. */
|
|
95
96
|
export const colsShown = (v, o = {}) => v.cols.filter((c) => c.on && !(c.k === 'product' && !o.many)).map((c) => c.k);
|
|
96
97
|
|
|
98
|
+
/* ── who raised it (who-raised-each-idea) ── the server reads it (lib/initiative-origin.js) and the row carries { kind, name, label, group }:
|
|
99
|
+
* "You", "Dana · teammate", "Acme · customer", "PMOS", "From the tracker". A row with none shows nothing and falls in "Not recorded". A copy
|
|
100
|
+
* never says "You" to a reader: it says "The PM". */
|
|
101
|
+
export const NO_ORIGIN = 'Not recorded';
|
|
102
|
+
const ORIGIN_ORDER = ['You', 'Teammates', 'Customers', 'PMOS', 'From the tracker'];
|
|
103
|
+
const roYou = (s) => (RO && s === 'You' ? 'The PM' : s);
|
|
104
|
+
export const originText = (r) => (r && r.origin && r.origin.label ? roYou(r.origin.label) : '');
|
|
105
|
+
export const originGroup = (r) => (r && r.origin && r.origin.group ? roYou(r.origin.group) : '');
|
|
106
|
+
const originPos = (g) => { const i = ORIGIN_ORDER.indexOf(g === 'The PM' ? 'You' : g); return i < 0 ? ORIGIN_ORDER.length : i; };
|
|
107
|
+
|
|
97
108
|
/* ── dates ───────────────────────────────────────────────────────────────────────────────────────────────────── */
|
|
98
109
|
export const day = (v) => { if (v instanceof Date) return new Date(v.getFullYear(), v.getMonth(), v.getDate()); const m = /^(\d{4})-(\d{2})-(\d{2})/.exec(String(v || '')); return m ? new Date(+m[1], +m[2] - 1, +m[3]) : null; };
|
|
99
110
|
const today = (now) => day(now || new Date());
|
|
@@ -149,14 +160,16 @@ export function groupsOf(rows, by, o = {}) {
|
|
|
149
160
|
stage: (r) => stageText(r),
|
|
150
161
|
status: (r) => statusText(r),
|
|
151
162
|
program: (r) => (o.programOf && o.programOf(r)) || '',
|
|
163
|
+
origin: (r) => originGroup(r),
|
|
152
164
|
}[by];
|
|
153
165
|
if (!keyOf) return null;
|
|
154
|
-
const none = { goal: 'No goal yet', product: 'No product', stage: 'No stage', status: 'No status', program: 'No program' }[by];
|
|
166
|
+
const none = { goal: 'No goal yet', product: 'No product', stage: 'No stage', status: 'No status', program: 'No program', origin: NO_ORIGIN }[by];
|
|
155
167
|
const m = new Map();
|
|
156
168
|
for (const r of rows) { const k = keyOf(r) || ''; if (!m.has(k)) m.set(k, []); m.get(k).push(r); }
|
|
157
169
|
let G = [...m.entries()].map(([k, rs]) => ({ key: by + ':' + (k || '-'), name: k || none, rows: rs, empty: !k }));
|
|
158
170
|
if (by === 'stage') G.sort((a, b) => (a.empty - b.empty) || (Math.min(...a.rows.map(posOf)) - Math.min(...b.rows.map(posOf))));
|
|
159
171
|
else if (by === 'status') { const O = { 'To do': 0, 'In progress': 1, Done: 2 }; G.sort((a, b) => (O[a.name] ?? 9) - (O[b.name] ?? 9)); }
|
|
172
|
+
else if (by === 'origin') G.sort((a, b) => (a.empty - b.empty) || originPos(a.name) - originPos(b.name));
|
|
160
173
|
else G.sort((a, b) => a.empty - b.empty);
|
|
161
174
|
// one group that holds every row and names nothing (no goal yet anywhere) says nothing: the list is flat (zero is silence)
|
|
162
175
|
return G.length === 1 && G[0].empty ? null : G;
|
|
@@ -182,7 +195,7 @@ export function addSort(k) {
|
|
|
182
195
|
return write({ ...read(), sorts: S });
|
|
183
196
|
}
|
|
184
197
|
export const dropSort = (k) => write({ ...read(), sorts: read().sorts.filter((x) => x.k !== k) });
|
|
185
|
-
export const SORT_KEYS = [['title', 'Initiative'], ['stage', 'Stage'], ['date', 'Date'], ['ms', 'Next milestone'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program']];
|
|
198
|
+
export const SORT_KEYS = [['title', 'Initiative'], ['stage', 'Stage'], ['date', 'Date'], ['ms', 'Next milestone'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program'], ['origin', 'Raised by']];
|
|
186
199
|
const str = (v) => String(v || '~');
|
|
187
200
|
/** Stage order: the row's own workflow's place, else (no workflow on record) the lifecycle's order by name, so Discover comes before Build. */
|
|
188
201
|
const LIFE = ['triage', 'discover', 'discovery', 'plan', 'prioritize', 'build', 'deliver', 'monitor', 'evaluate', 'completed', 'closed'];
|
|
@@ -198,6 +211,7 @@ const SORTS = {
|
|
|
198
211
|
program: (a, b, o) => str(o.programOf && o.programOf(a)).localeCompare(str(o.programOf && o.programOf(b))),
|
|
199
212
|
goal: (a, b, o) => str(o.goalOf && o.goalOf(a)).localeCompare(str(o.goalOf && o.goalOf(b))),
|
|
200
213
|
wf: (a, b) => String(wfOf(a).name).localeCompare(String(wfOf(b).name)),
|
|
214
|
+
origin: (a, b) => originPos(originGroup(a) || '~') - originPos(originGroup(b) || '~') || str(originText(a)).localeCompare(str(originText(b))),
|
|
201
215
|
};
|
|
202
216
|
const sortRows = (rows, o) => {
|
|
203
217
|
const S = read().sorts.filter((x) => SORTS[x.k]); if (!S.length) return rows;
|
|
@@ -206,7 +220,7 @@ const sortRows = (rows, o) => {
|
|
|
206
220
|
|
|
207
221
|
/* ── filter (round 3): every facet takes several values; each value says how many rows it holds, and one that holds none is not shown.
|
|
208
222
|
* The filter lives for this page (the view is what PMOS remembers). ── */
|
|
209
|
-
const FACETS = [['need', 'Needs'], ['stage', 'Stage'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program'], ['owner', 'Owner'], ['sprint', 'Sprint']];
|
|
223
|
+
const FACETS = [['need', 'Needs'], ['stage', 'Stage'], ['status', 'Status'], ['product', 'Product'], ['program', 'Program'], ['owner', 'Owner'], ['origin', 'Raised by'], ['sprint', 'Sprint']];
|
|
210
224
|
const NEEDS = [['you', 'Waits on you'], ['late', 'Late'], ['risk', 'At risk'], ['blocked', 'Blocked']];
|
|
211
225
|
const FL = Object.fromEntries(FACETS.map(([k]) => [k, new Set()]));
|
|
212
226
|
const RO_FACETS = new Set(['need', 'stage', 'status', 'product', 'program']); // a copy filters on what its table draws; never owner, sprint or "waits on you"
|
|
@@ -223,6 +237,7 @@ function valuesOf(r, k, o) {
|
|
|
223
237
|
if (k === 'product') { const v = o.product ? o.product(r) : r.product; return v ? [v] : []; }
|
|
224
238
|
if (k === 'program') return [(o.programOf && o.programOf(r)) || 'No program'];
|
|
225
239
|
if (k === 'owner') return [r.owner || 'No owner'];
|
|
240
|
+
if (k === 'origin') return [originGroup(r) || NO_ORIGIN];
|
|
226
241
|
if (k === 'sprint') return [...new Set((t.tickets || []).map((x) => x.sprint).filter(Boolean))];
|
|
227
242
|
return [];
|
|
228
243
|
}
|
|
@@ -238,6 +253,7 @@ export function facetsOf(rows, o = {}) {
|
|
|
238
253
|
if (k === 'need') vals = NEEDS.map(([x]) => vals.find((y) => y.v === x)).filter(Boolean);
|
|
239
254
|
else if (k === 'stage') { const rep = (v) => rows.find((r) => stageText(r) === v); vals.sort((a, b) => stageCmp(rep(a.v), rep(b.v))); }
|
|
240
255
|
else if (k === 'sprint') vals.sort((a, b) => String(b.v).localeCompare(String(a.v), undefined, { numeric: true }));
|
|
256
|
+
else if (k === 'origin') vals.sort((a, b) => originPos(a.v) - originPos(b.v));
|
|
241
257
|
else vals.sort((a, b) => b.n - a.n || String(a.v).localeCompare(String(b.v)));
|
|
242
258
|
// a value that is on but holds no row now stays, so it can be taken off
|
|
243
259
|
for (const v of FL[k]) if (!vals.some((y) => y.v === v)) vals.push({ v, word: k === 'need' ? needWord(v) : v, n: 0, on: true });
|
|
@@ -260,7 +276,8 @@ export function showingHtml(hidden) {
|
|
|
260
276
|
const and = (k) => [...FL[k]].map((v) => (k === 'need' ? needWord(v) : v)).join(k === 'need' ? ' or ' : ' and ');
|
|
261
277
|
const what = ['need', 'stage', 'status', 'sprint'].filter((k) => FL[k].size).map(and).join(' · ') || (Q ? 'the initiatives named “' + Q + '”' : 'the initiatives');
|
|
262
278
|
const of = ['product', 'program'].filter((k) => FL[k].size).map(and).join(' · '), by = FL.owner.size ? and('owner') : '';
|
|
263
|
-
|
|
279
|
+
const from = FL.origin.size ? [...FL.origin].map((v) => (v === NO_ORIGIN ? 'nobody on record' : v === 'You' ? 'you' : v)).join(' or ') : '';
|
|
280
|
+
return `<div class="wk-showing" role="status"><span>Showing ${esc(what)}${of ? ' of ' + esc(of) : ''}${by ? ' owned by ' + esc(by) : ''}${from ? ' raised by ' + esc(from) : ''}</span>${hidden ? `<span class="q">· ${hidden} hidden</span>` : ''}<span class="q">·</span><button type="button" class="wk-sa" data-wkclear>Show all</button></div>`;
|
|
264
281
|
}
|
|
265
282
|
|
|
266
283
|
/* ── the timeline's window ───────────────────────────────────────────────────────────────────────────────────── */
|
|
@@ -323,6 +340,7 @@ function cellHtml(r, k, o) {
|
|
|
323
340
|
if (k === 'program') return `<td>${esc((o.programOf && o.programOf(r)) || '')}</td>`;
|
|
324
341
|
if (k === 'goal') return `<td>${esc((o.goalOf && o.goalOf(r)) || '')}</td>`;
|
|
325
342
|
if (k === 'wf') return `<td>${esc(wfOf(r).name)}</td>`;
|
|
343
|
+
if (k === 'origin') return `<td>${esc(originText(r))}</td>`; // none: an empty cell (zero is silence)
|
|
326
344
|
return '<td></td>';
|
|
327
345
|
}
|
|
328
346
|
const words = (r, keys, o) => keys.map((k) => {
|
|
@@ -334,6 +352,7 @@ const words = (r, keys, o) => keys.map((k) => {
|
|
|
334
352
|
if (k === 'program') return (o.programOf && o.programOf(r)) || '';
|
|
335
353
|
if (k === 'goal') return (o.goalOf && o.goalOf(r)) || '';
|
|
336
354
|
if (k === 'wf') return wfOf(r).name;
|
|
355
|
+
if (k === 'origin') return originText(r) ? 'raised by ' + originText(r) : '';
|
|
337
356
|
return '';
|
|
338
357
|
}).filter(Boolean).join(', ');
|
|
339
358
|
|
|
@@ -23,13 +23,8 @@ body.cz-home { min-height: 100vh; overflow: hidden; }
|
|
|
23
23
|
/* batch 26 item 2 (NpBw): the chat sits on the same soft gradient as on a phone */
|
|
24
24
|
body.cz-home .hm-chat { background: var(--cz-ground); border-radius: var(--radius-panel, 24px); padding: 16px 24px 20px; box-shadow: 0 10px 30px -24px var(--cz-c-9da3ac); }
|
|
25
25
|
body.cz-home .hm-vw .cz-vw { flex-basis: min(500px, max(380px, calc(100vw - 852px))); width: min(500px, max(380px, calc(100vw - 852px))); }
|
|
26
|
-
body.cz-home.hm-folded:not(.cz-vw-rail) .hm-desk { padding-left: 56px; }
|
|
27
26
|
body.cz-home .hm-reopen { top: 12px; right: 12px; }
|
|
28
27
|
}
|
|
29
|
-
.hm-folded:not(.cz-vw-rail) .hm-list { display: none; } /* with a Viewer open, the folded list is the rail (batch 20 item 6) */
|
|
30
|
-
.hm-unfold { display: none; }
|
|
31
|
-
.hm-folded:not(.cz-vw-rail) .hm-unfold { display: grid; place-items: center; position: absolute; left: 10px; top: 24px; z-index: 2; width: 36px; height: 36px; border-radius: var(--radius-md, 12px); border: 0; background: var(--cz-well); color: var(--cz-ink2); cursor: pointer; }
|
|
32
|
-
.hm-folded:not(.cz-vw-rail) .hm-desk { padding-left: 56px; }
|
|
33
28
|
.hm-desk button { font-family: var(--cz-sans); }
|
|
34
29
|
.hm-ib { width: 36px; height: 36px; border-radius: var(--radius-md, 12px); display: grid; place-items: center; border: 0; background: none; color: var(--cz-ink2); cursor: pointer; padding: 0; flex: none; }
|
|
35
30
|
.hm-ib:hover { background: var(--cz-well2); }
|
|
@@ -493,7 +488,6 @@ form.hm-box textarea { min-height: 48px; border: 0; background: none; resize: no
|
|
|
493
488
|
* where the phone chat has no button */
|
|
494
489
|
body.cz-home #hmFoot::before { content: ''; position: absolute; left: 0; right: 0; bottom: 100%; height: 72px; pointer-events: none; background: var(--cz-ground); background-size: 100% 1000px; -webkit-mask-image: linear-gradient(to bottom, transparent, black 40%); mask-image: linear-gradient(to bottom, transparent, black 40%); } /* the ground is a gradient: its first colours meet the composer's top */
|
|
495
490
|
.hm-x { opacity: 1; }
|
|
496
|
-
.hm-unfold, .hm-folded .hm-unfold { display: none; }
|
|
497
491
|
.hm-reopen { display: none; }
|
|
498
492
|
.hm-bub, .hm-qb { max-width: 88%; }
|
|
499
493
|
.hm-sheet .cz-fabw { z-index: 45; }
|
|
@@ -157,7 +157,7 @@ function layout() {
|
|
|
157
157
|
sync();
|
|
158
158
|
const B = document.body, phone = isPhone(), man = managed(), ids = [C, ...vs().map((p) => p.id)];
|
|
159
159
|
const back = S.man && !man; // back to today's split: cozy-viewer.js decides the width and the rail again
|
|
160
|
-
if (back) { S.keepList = false; P.rail(
|
|
160
|
+
if (back) { S.keepList = false; P.rail(false); }
|
|
161
161
|
S.man = man;
|
|
162
162
|
B.classList.toggle('cz-pn', !phone);
|
|
163
163
|
B.classList.toggle('cz-pn-man', man);
|
|
@@ -184,11 +184,7 @@ function layout() {
|
|
|
184
184
|
if (man && !phone && !S.page) {
|
|
185
185
|
const room = S.desk.clientWidth - 64 - (S.row.length - 1) * 22; // the desk less its padding and the gaps
|
|
186
186
|
const list = document.getElementById('hmList'), lw = list ? list.offsetWidth || 316 : 0;
|
|
187
|
-
|
|
188
|
-
// unfold (remembered), and not after the rail's "Show the list" in this layout (batch 25 item 12: the PM can always open or close it)
|
|
189
|
-
const own = P.owned ? P.owned() : null;
|
|
190
|
-
const startFold = !S.keepList && !(P.chosen && P.chosen()) && S.row.length === 1 && S.row[0] !== C;
|
|
191
|
-
const fold = own !== null ? own || startFold : !S.keepList && (!S.row.includes(C) || room - lw < S.row.length * PANEL);
|
|
187
|
+
const fold = !S.keepList && (!S.row.includes(C) || room - lw < S.row.length * PANEL);
|
|
192
188
|
if (fold !== P.railOn()) P.rail(fold);
|
|
193
189
|
}
|
|
194
190
|
if (back) P.rest(); else P.relayout();
|
|
@@ -38,6 +38,7 @@ body.cz-pop-drag, body.cz-pop-drag * { cursor: col-resize !important; user-selec
|
|
|
38
38
|
.cz-pop-t span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
39
39
|
.cz-pop-go:focus-visible, .cz-pop-t:focus-visible, .cz-pop-ib:focus-visible, .cz-pop-x:focus-visible, .cz-pop-sr:focus-visible, .cz-pop-f:focus-visible { outline: 2px solid var(--cz-blue); outline-offset: 2px; }
|
|
40
40
|
.cz-pop-tw { flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 0; }
|
|
41
|
+
.cz-pop-tw .hm-ren { flex: 1 1 100%; } /* renaming: the field fills the title */
|
|
41
42
|
/* the context line under the session (round 3 point 19a): one quiet line, cut with … */
|
|
42
43
|
.cz-pop-cx { flex: 1 0 100%; min-width: 0; padding-left: 10px; font-size: var(--fs-meta); color: var(--cz-ink3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
|
43
44
|
.cz-pop-mm { left: auto; right: 12px; width: 260px; }
|
|
@@ -37,7 +37,7 @@ const I = {
|
|
|
37
37
|
chat: 'M5 6.5A2.5 2.5 0 0 1 7.5 4h9A2.5 2.5 0 0 1 19 6.5v7a2.5 2.5 0 0 1-2.5 2.5H11l-4 3.5V16h.5A2.5 2.5 0 0 1 5 13.5z',
|
|
38
38
|
hide: 'M4 5h16v14H4zM14.5 5v14M9 10l2 2-2 2', close: 'M6 6l12 12M18 6L6 18', down: 'M7 10l5 5 5-5', back: 'M15 6l-6 6 6 6',
|
|
39
39
|
plus: 'M12 5v14M5 12h14', list: 'M5 7h14M5 12h14M5 17h14', find: 'M11 4.5a6.5 6.5 0 1 0 0 13a6.5 6.5 0 1 0 0-13M16 16l4 4', flag: 'M5 21V4h11l-2 4 2 4H5',
|
|
40
|
-
side: 'M3.5 5h17v14h-17zM12 5v14', more: 'M5 12h.01M12 12h.01M19 12h.01',
|
|
40
|
+
side: 'M3.5 5h17v14h-17zM12 5v14', more: 'M5 12h.01M12 12h.01M19 12h.01', pen: 'M4 20h4L19 9l-4-4L4 16zM13.5 6.5l4 4',
|
|
41
41
|
};
|
|
42
42
|
const CLAUDE = { key: 'claude', name: 'PMOS', initial: 'P' };
|
|
43
43
|
const MIN_WORK = 480, MIN_CHAT = 320, DEF_CHAT = 460, DAY_MS = 864e5, POLL = 6000, UNDO = 6000, CHOOSER = 5;
|
|
@@ -56,6 +56,8 @@ const S = {
|
|
|
56
56
|
};
|
|
57
57
|
|
|
58
58
|
/* ── the page's hooks ── */
|
|
59
|
+
/** The page's chat changed a session (a rename): the title draws again now, and the sessions are read again. */
|
|
60
|
+
export function refresh() { if (!S.open) return; drawTitle(); read(); }
|
|
59
61
|
export function useChat(p) { S.home = p && p.el && typeof p.open === 'function' ? p : null; }
|
|
60
62
|
export function setTitles(fn) { S.titles = typeof fn === 'function' ? fn : null; }
|
|
61
63
|
export function setOpener(fn) { S.opener = typeof fn === 'function' ? fn : null; }
|
|
@@ -312,10 +314,19 @@ function rowHtml(r, sel) {
|
|
|
312
314
|
function drawTitle() {
|
|
313
315
|
if (!S.title || !S.open) return;
|
|
314
316
|
if (S.view === 'all') {
|
|
317
|
+
delete S.title.dataset.ren;
|
|
315
318
|
S.title.innerHTML = `<button type="button" class="cz-pop-ib" data-pop="unall" aria-label="Back to the session you were in" title="Back to the session you were in">${svg(I.back)}</button><b class="t-row">All sessions</b>`;
|
|
316
319
|
return;
|
|
317
320
|
}
|
|
318
|
-
|
|
321
|
+
// a chat with no session yet (an address's ?about, Discuss in chat) is named by what it is about, not "Ask PMOS"
|
|
322
|
+
const ct = !curRow() && S.chat && S.chat.current ? S.chat.current() : null;
|
|
323
|
+
const r = curRow(), name = r ? r.name : (ct && ct.title) || 'Ask PMOS', on = !!S.menu && S.menu.dataset.kind !== 'more';
|
|
324
|
+
// a rename in progress: the title is the name field (home-ses-name.js draws it; Enter saves, Esc cancels)
|
|
325
|
+
if (r && S.home && S.home.renaming && S.home.renaming(r.id)) {
|
|
326
|
+
// the sessions' poll draws the title again: the same field stays as it is, so the typing and the focus stay in it
|
|
327
|
+
const h = S.home.nameHtml(r.id, r.name); if (S.title.dataset.ren !== h) { S.title.innerHTML = h; S.title.dataset.ren = h; } return;
|
|
328
|
+
}
|
|
329
|
+
delete S.title.dataset.ren;
|
|
319
330
|
// one quiet context line under the session (round 3 point 19a, the phone chat's line): what the chat is about, said once
|
|
320
331
|
const a = S.about, cx = a && a.title ? (a.kind === 'initiative' ? 'Initiative' : a.kind === 'program' ? 'Program' : 'About') + ' · ' + a.title : '';
|
|
321
332
|
S.title.innerHTML = `<button type="button" class="cz-pop-t" data-pop="pick" aria-haspopup="menu" aria-expanded="${on}" title="Change session" aria-label="${esc(name + '. Change session')}"><span>${esc(name)}</span>${svg(I.down, 16)}</button>`
|
|
@@ -352,6 +363,7 @@ function openMore() {
|
|
|
352
363
|
m.innerHTML = `<button type="button" class="cz-pop-f" role="menuitem" data-pop="where">${svg(I.side, 16)}${beside() ? 'Open work in this popup' : 'Open work beside the page'}</button>`
|
|
353
364
|
+ `<button type="button" class="cz-pop-f" role="menuitem" data-pop="hide">${svg(I.hide, 16)}Hide the chat<span>Ctrl J</span></button>`
|
|
354
365
|
+ `<button type="button" class="cz-pop-f" role="menuitem" data-pop="pick">${svg(I.list, 16)}Sessions</button>`
|
|
366
|
+
+ (r && S.home && S.home.nameHtml ? `<button type="button" class="cz-pop-f" role="menuitem" data-hm-rn="${esc(r.id)}">${svg(I.pen, 16)}Rename session</button>` : '')
|
|
355
367
|
+ (r && r.live ? `<hr><button type="button" class="cz-pop-f" role="menuitem" data-end="${esc(r.id)}">${svg(I.close, 16)}End session</button>` : '');
|
|
356
368
|
S.right.appendChild(m); S.menu = m;
|
|
357
369
|
const mb = S.card.querySelector('[data-pop="more"]'); if (mb) mb.setAttribute('aria-expanded', 'true');
|
|
@@ -441,6 +453,7 @@ async function newSession() {
|
|
|
441
453
|
}
|
|
442
454
|
|
|
443
455
|
function onClick(e) {
|
|
456
|
+
if (e.target.closest('[data-hm-rn]')) { closeMenu(); return; } // Rename session: home-ses-name.js takes the press from here
|
|
444
457
|
const end1 = e.target.closest('[data-end]'); if (end1) { e.preventDefault(); end(end1.dataset.end); return; }
|
|
445
458
|
const row = e.target.closest('[data-sid]'); if (row) { e.preventDefault(); pick(row.dataset.sid); return; }
|
|
446
459
|
const b = e.target.closest('[data-pop]'); if (!b) return;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* end of this file) in place of Home's list. */
|
|
9
9
|
|
|
10
10
|
@media (min-width: 761px) {
|
|
11
|
-
body.cz-today #hmDesk > .hm-list, body.cz-today #hmDesk > .hm-chat, body.cz-today #hmDesk > .cz-pn-div, body.cz-today
|
|
11
|
+
body.cz-today #hmDesk > .hm-list, body.cz-today #hmDesk > .hm-chat, body.cz-today #hmDesk > .cz-pn-div, body.cz-today .hm-top { display: none !important; }
|
|
12
12
|
/* the white page panel: the only big container, beside the rail (as the Board's) */
|
|
13
13
|
body.cz-home.cz-today #hmDesk { display: block; overflow: auto; top: 16px; right: 16px; bottom: 16px; left: var(--cz-railx, 16px); padding: 28px 32px 32px; background: var(--cz-card); border-radius: 28px; box-shadow: var(--cz-lift); }
|
|
14
14
|
/* the page starts at the left edge of the panel, like Work and Library; on a wide screen the log stops at about 1100 px */
|
|
@@ -530,20 +530,6 @@ body.cz-home .hm-hd.hv-bar > .hv-hi { flex: 1 0 auto; max-width: 100%; }
|
|
|
530
530
|
/* the weekly review done for the week (batch 17 item 4-B, AdM1): Adler calm beside the words */
|
|
531
531
|
.rv-done { display: flex; align-items: center; gap: 10px; }
|
|
532
532
|
|
|
533
|
-
/* The folded rail's card (batch 18 item 14, FlA1–FlA5): beside the pressed tile, Home's popover look, Home's own rows inside. The pill's
|
|
534
|
-
* sessions open in place under the row (.hv-rcs), not as a second popover. Its left and top are set from the tile (home-app.js). */
|
|
535
|
-
.hv-rc { position: fixed; z-index: 60; width: 372px; max-width: calc(100vw - 96px); max-height: calc(100vh - 24px); overflow-y: auto; background: var(--cz-card); border-radius: 20px; padding: 6px; box-shadow: 0 24px 50px -20px rgba(42,46,53,.4), 0 0 0 1px var(--cz-hair); box-sizing: border-box; text-align: left; }
|
|
536
|
-
.hv-rch { display: flex; align-items: center; gap: 6px; min-height: 44px; }
|
|
537
|
-
.hv-rch .hv-pt { flex: 0 1 auto; gap: 8px; }
|
|
538
|
-
.hv-rch .hv-pt .hv-tl { width: 26px; height: 26px; border-radius: 8px; }
|
|
539
|
-
.hv-rch .hv-pt > svg { color: var(--cz-ink3); flex: none; }
|
|
540
|
-
.hv-rch .hv-msd { margin-left: auto; }
|
|
541
|
-
.hv-rch .hv-ib { margin-left: auto; flex: none; }
|
|
542
|
-
.hv-rch .hv-msd + .hv-ib { margin-left: 2px; }
|
|
543
|
-
.hv-rcb .hm-none { margin: 6px 10px 10px; }
|
|
544
|
-
.hv-rcs { margin: 0 0 4px; padding: 4px; background: color-mix(in srgb, var(--cz-well) 55%, var(--cz-card)); border-radius: 14px; }
|
|
545
|
-
.hv-rcs .hv-r::before { display: none; }
|
|
546
|
-
.hv-rcs .hv-r.safe { background: var(--cz-bluebg); border-radius: 14px; }
|
|
547
533
|
/* Home's one grill line (canvas FcPhone, Home): quiet, with ✦ at its end */
|
|
548
534
|
.hv-gn { display: flex; align-items: center; gap: 8px; color: var(--cz-ink2); }
|
|
549
535
|
.hv-gn span { flex: 1; min-width: 0; }
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
* word press, only where a decision has two answers (Return it | Keep it as is).
|
|
79
79
|
* czSections([{ id, title, count, open, render | html, tail? }], { key }) → the folding rows. A row folds and unfolds in place, and the fold
|
|
80
80
|
* is remembered per key and id (localStorage, a private window forgets it). render(): a string of markup, called once when drawn.
|
|
81
|
-
* widthOf(kind) · setWidth(px) · wide(on?) · railOn() for the page and the tests;
|
|
81
|
+
* widthOf(kind) · setWidth(px) · wide(on?) · railOn() for the page and the tests; railSync(key?) for a page
|
|
82
82
|
* that draws a card for a rail tile (Home).
|
|
83
83
|
* The look is in cozy-vw-shell.css (loaded here once) over cozy.css (.cz-vw…). The old #dlg path (premium-viewer.js) is separate. */
|
|
84
84
|
import { czPlaceholder } from './cozy-placeholder.js';
|
|
@@ -128,13 +128,7 @@ const kindKey = (k) => String(k || 'item').trim().toLowerCase().replace(/^file
|
|
|
128
128
|
* key or the last open() went to, so the exported API always speaks of the Viewer used last. G is what the page has once: its list's rail,
|
|
129
129
|
* the listeners, the rail's card. Only the first instance (#czViewer) writes the browser history; another keeps its own ← → trail.
|
|
130
130
|
* Without cozy-panels.js (Board, Intelligence) the limit stays 1 and there is one Viewer, as before. */
|
|
131
|
-
const G = { chat: null, subs: [],
|
|
132
|
-
/** The list's fold, when the page owns it (Home, batch 20 item 6): { folded() → bool, show() }. Then only the list's own icon folds or unfolds it:
|
|
133
|
-
* a Viewer's width, its reset, open wide and its close never do. null: the Viewer folds the list to a rail as it needs (a page without one). */
|
|
134
|
-
export function listFold(o) { G.own = o && typeof o.folded === 'function' ? o : null; }
|
|
135
|
-
const owned = () => (G.own ? !!G.own.folded() : null);
|
|
136
|
-
/** true: the PM has pressed the list's fold or unfold, so a full Viewer keeps the list as the PM left it (no starting fold). */
|
|
137
|
-
const chosen = () => !!(G.own && typeof G.own.chosen === 'function' && G.own.chosen());
|
|
131
|
+
const G = { chat: null, subs: [], railKey: null, rail: false, lw: 0, tick: 0, limit: 1, beside: null, place: null, managed: null, popH: null, popNext: null };
|
|
138
132
|
const mk = (i) => ({ i, el: null, cur: null, back: null, stack: [], fwd: [], wide: false, w: 0, drill: false, over: false, used: 0, ph: false, via: '', pop: false });
|
|
139
133
|
let V = mk(0);
|
|
140
134
|
const ALL = [V];
|
|
@@ -211,7 +205,9 @@ export function headHtml(it) {
|
|
|
211
205
|
const from = o.pop && o.from ? `<button type="button" data-cz-vw-path="from">${esc(o.from)}</button><span aria-hidden="true">›</span>` : '';
|
|
212
206
|
const pth = o.pop && ((o.path || []).length || from) ? `<nav class="cz-vw-path" aria-label="Path">${from}${(o.path || []).map((t, i, a) => `<button type="button" data-cz-vw-path="${i - a.length}">${esc(t || 'Back')}</button><span aria-hidden="true">›</span>`).join('')}</nav>` : '';
|
|
213
207
|
// kindChip: the small kind chip after the title in the popup (Meeting notes, Report, Prototype)
|
|
214
|
-
|
|
208
|
+
// a read-only item (an ended session's terminal) says so in the popup too, where the kind line is not drawn (honest state)
|
|
209
|
+
const kc = o.kindChip || (o.pop && /\bread only\b/i.test(o.kind || '') ? 'Read only' : '');
|
|
210
|
+
const kchip = o.pop && kc ? `<span class="cz-vw-kchip">${esc(kc)}</span>` : '';
|
|
215
211
|
const chip = o.chip && (o.chip.n > 0 || o.chip.looking) ? `<button type="button" class="cz-vw-chip${o.chip.looking ? ' live' : ''}" data-cz-vw="chip" aria-haspopup="dialog" aria-label="${esc(o.chip.label || 'PMOS proposes ' + o.chip.n + '. Open')}" title="${esc(o.chip.label || 'PMOS proposes')}">${svg(ICONS.spark, 13, 2)}${o.chip.n > 0 && !o.chip.quiet ? `<b>${esc(o.chip.n)}</b>` : ''}</button>` : '';
|
|
216
212
|
const canBack = o.canBack || !!from;
|
|
217
213
|
return (canBack || phone ? ib('back', o.canBack ? (o.backTo ? 'Back to ' + o.backTo : 'Back') : from ? 'Back to ' + o.from : 'Close the viewer', P.back) : '')
|
|
@@ -319,12 +315,9 @@ function setRail(on) {
|
|
|
319
315
|
bar.innerHTML = `<button type="button" class="cz-vw-ib" data-cz-vw-rail="show" aria-label="Show the list" title="Show the list">${svg(P.list, 18)}</button><div class="cz-vw-railtiles"></div>`;
|
|
320
316
|
bar.addEventListener('click', (e) => {
|
|
321
317
|
const b = e.target.closest('[data-cz-vw-rail]'); if (!b) return;
|
|
322
|
-
if (b.dataset.czVwRail === 'show' && G.own) { if (G.own.show) G.own.show(); if (G.rail) setRail(false); return; } // the page unfolds its own list; a layout that folded it never holds it folded
|
|
323
318
|
if (b.dataset.czVwRail === 'show' && G.managed && ALL.some((x) => shown(x) && G.managed('v' + x.i))) { setRail(false); return; } // cozy-panels.js lays it out
|
|
324
319
|
if (b.dataset.czVwRail === 'show') { V.wide = false; apply(Math.min(V.w, sideMax())); redraw(); return; }
|
|
325
|
-
// a group's tile: the
|
|
326
|
-
if (G.card) { G.card(b.dataset.czVwRail, b, e.detail === 0); return; }
|
|
327
|
-
// a page without a card: the list comes back, at that group
|
|
320
|
+
// a group's tile: the list comes back, at that group
|
|
328
321
|
const src = list.querySelector('[data-cz-rail-tile="' + CSS.escape(b.dataset.czVwRail) + '"]');
|
|
329
322
|
V.wide = false; apply(Math.min(V.w, sideMax())); redraw();
|
|
330
323
|
if (src && src.scrollIntoView) src.scrollIntoView({ block: 'nearest' });
|
|
@@ -338,21 +331,18 @@ function setRail(on) {
|
|
|
338
331
|
function railTiles(list, bar) {
|
|
339
332
|
const tiles = [...list.querySelectorAll('[data-cz-rail-tile]')].slice(0, 8);
|
|
340
333
|
const box = bar.querySelector('.cz-vw-railtiles');
|
|
341
|
-
const sig = tiles.map((t) => t.outerHTML).join('')
|
|
334
|
+
const sig = tiles.map((t) => t.outerHTML).join('');
|
|
342
335
|
if (box.__sig !== sig) {
|
|
343
336
|
box.__sig = sig; box.innerHTML = '';
|
|
344
337
|
tiles.forEach((t) => { // a copy of the tile itself (its tint, initials and dot), in a press that names the group
|
|
345
338
|
const nm = t.dataset.czRailName || t.textContent.trim(), here = t.hasAttribute('data-cz-rail-here');
|
|
346
339
|
const btn = document.createElement('button'); btn.type = 'button'; btn.className = 'cz-vw-railtile' + (here ? ' here' : ''); btn.dataset.czVwRail = t.dataset.czRailTile;
|
|
347
|
-
btn.setAttribute('aria-label',
|
|
348
|
-
if (G.card) btn.setAttribute('aria-haspopup', 'dialog');
|
|
340
|
+
btn.setAttribute('aria-label', 'Show the list at ' + nm); btn.title = nm;
|
|
349
341
|
const c = t.cloneNode(true); c.removeAttribute('data-cz-rail-tile'); c.removeAttribute('data-cz-rail-name'); c.removeAttribute('data-cz-rail-here'); btn.appendChild(c); box.appendChild(btn);
|
|
350
342
|
});
|
|
351
343
|
}
|
|
352
|
-
box.querySelectorAll('.cz-vw-railtile').forEach((b) => { const on = b.dataset.czVwRail === G.railKey; b.classList.toggle('on', on);
|
|
344
|
+
box.querySelectorAll('.cz-vw-railtile').forEach((b) => { const on = b.dataset.czVwRail === G.railKey; b.classList.toggle('on', on); });
|
|
353
345
|
}
|
|
354
|
-
/** A page that draws a card for a rail tile (Home): fn(key, tile, byKey) on a tile's press, in place of bringing the list back. */
|
|
355
|
-
export function railCard(fn) { G.card = typeof fn === 'function' ? fn : null; railSync(); }
|
|
356
346
|
/** The tile whose card is open (null: none): its ring and aria-expanded. The page calls it after a redraw of its list, so the rail's tiles
|
|
357
347
|
* follow the list (a new "here" bar, a dot). */
|
|
358
348
|
export function railSync(key) {
|
|
@@ -360,8 +350,6 @@ export function railSync(key) {
|
|
|
360
350
|
const list = listEl(), bar = G.rail && list && list.querySelector(':scope > .cz-vw-railbar');
|
|
361
351
|
if (bar) railTiles(list, bar);
|
|
362
352
|
}
|
|
363
|
-
/** The next open() keeps the Viewer as wide as it is and the rail folded (a pick from the rail's card, FlA4After). */
|
|
364
|
-
export function keepWide() { G.hold = Date.now() + 2000; }
|
|
365
353
|
const sideMax = () => { const r = room(); return r.float ? r.side : Math.max(MIN, r.side); };
|
|
366
354
|
/** Set the width in px: past what the chat leaves, the list folds to a rail first; never under 420 or over about 70%. */
|
|
367
355
|
function apply(px) {
|
|
@@ -372,17 +360,6 @@ function apply(px) {
|
|
|
372
360
|
// cozy-panels.js lays the panels out itself (two Viewers, a Viewer full or sliding over): it sizes this one, the rail is its own call
|
|
373
361
|
if (G.managed && G.managed('v' + V.i)) { el.style.width = ''; el.classList.toggle('cz-vw-w2', el.offsetWidth >= W2); return; } // its flex is the engine's; V.w keeps the width beside the chat
|
|
374
362
|
let r = room();
|
|
375
|
-
if (G.own) {
|
|
376
|
-
// the page owns the fold: the rail is its choice, and the Viewer takes only the room beside it (batch 20 item 6)
|
|
377
|
-
setRail(owned()); r = room();
|
|
378
|
-
const over = !r.float && r.hasList && r.side < MIN && !!(el.parentNode && el.parentNode.hasAttribute('data-cz-vw-overlay'));
|
|
379
|
-
if (over !== V.over) { V.over = over; document.body.classList.toggle('cz-vw-over', over); }
|
|
380
|
-
const cap = r.float ? r.wideMax : over ? r.right : Math.max(MIN, G.rail ? r.wideMax : r.side);
|
|
381
|
-
const w = Math.max(Math.min(MIN, cap), Math.min(Math.round(px || r.def), cap));
|
|
382
|
-
V.w = w; el.style.width = w + 'px'; el.style.flexBasis = w + 'px'; el.classList.toggle('cz-vw-w2', w >= W2);
|
|
383
|
-
const g = el.querySelector('.cz-vw-grip'); if (g) { g.setAttribute('aria-valuenow', String(w)); g.setAttribute('aria-valuemin', String(MIN)); g.setAttribute('aria-valuemax', String(cap)); }
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
363
|
// a host that keeps its list (Home, HbCNarrow): with no room beside the chat the Viewer lies over the chat, at most the room right of the list
|
|
387
364
|
const over = !r.float && r.hasList && r.side < MIN && !V.wide && !!(el.parentNode && el.parentNode.hasAttribute('data-cz-vw-overlay'));
|
|
388
365
|
if (over !== V.over) { V.over = over; document.body.classList.toggle('cz-vw-over', over); }
|
|
@@ -413,7 +390,7 @@ export function wide(on) {
|
|
|
413
390
|
redraw();
|
|
414
391
|
return V.wide;
|
|
415
392
|
}
|
|
416
|
-
function resetW() { if (!V.cur) return; store.set('cz-vw-w:' + kindKey(V.cur.kind), null); V.wide = false;
|
|
393
|
+
function resetW() { if (!V.cur) return; store.set('cz-vw-w:' + kindKey(V.cur.kind), null); V.wide = false; setRail(false); apply(room().def); redraw(); }
|
|
417
394
|
function grip(el) {
|
|
418
395
|
const g = document.createElement('div'), x = V;
|
|
419
396
|
g.className = 'cz-vw-grip'; g.setAttribute('role', 'separator'); g.setAttribute('aria-orientation', 'vertical'); g.tabIndex = 0;
|
|
@@ -688,8 +665,7 @@ export function open(it) {
|
|
|
688
665
|
body.className = 'cz-vw-body'; body.onclick = null; body.oninput = null; body.onchange = null; body.onkeydown = null; // what one item's render added to the body does not reach the next
|
|
689
666
|
const wasHidden = el.hidden;
|
|
690
667
|
el.hidden = false;
|
|
691
|
-
|
|
692
|
-
if (!hold && !(sameKind && !wasHidden && (V.wide || G.rail))) { const k = widthOf(o.kind); V.wide = false; apply(k || room().def); redraw(); }
|
|
668
|
+
if (!(sameKind && !wasHidden && (V.wide || G.rail))) { const k = widthOf(o.kind); V.wide = false; apply(k || room().def); redraw(); }
|
|
693
669
|
if (typeof o.render === 'function') o.render(body); else if (o.html) body.innerHTML = o.html;
|
|
694
670
|
emit();
|
|
695
671
|
if (isPhone()) el.focus();
|
|
@@ -823,7 +799,7 @@ function holdable(el, x) {
|
|
|
823
799
|
}
|
|
824
800
|
/** A hold that opened the trail list is not also a press. */
|
|
825
801
|
function held() { if (HOLD.fired && Date.now() - HOLD.fired < 800) { HOLD.fired = 0; return true; } return false; }
|
|
826
|
-
const PAGES = { '/
|
|
802
|
+
const PAGES = { '/': 'Today', '/today.html': 'Today', '/premium-board.html': 'Board', '/premium-intelligence.html': 'Intelligence', '/premium-insights.html': 'Intelligence' };
|
|
827
803
|
function trailMenu(b, x) {
|
|
828
804
|
if (!V.cur || !V.el) return;
|
|
829
805
|
const old = V.el.querySelector('.cz-vw-trail'); if (old) old.remove();
|
|
@@ -881,7 +857,7 @@ export const panels = {
|
|
|
881
857
|
relayout() { ALL.filter(shown).forEach((x) => on(x, () => { apply(V.wide ? room().wideMax : V.w || room().def); redraw(); })); },
|
|
882
858
|
/** Back beside the chat after the engine laid it out: the width its kind keeps, else the default. */
|
|
883
859
|
rest() { ALL.filter(shown).forEach((x) => on(x, () => { const k = widthOf(V.cur.kind); V.wide = false; apply(k || room().def); redraw(); })); },
|
|
884
|
-
rail(v) { setRail(!!v); }, railOn: () => G.rail,
|
|
860
|
+
rail(v) { setRail(!!v); }, railOn: () => G.rail,
|
|
885
861
|
};
|
|
886
862
|
/* ── the popup (slice 2, pm/cozy-popup.js) ── */
|
|
887
863
|
/** cozy-popup.js registers { host() → the popup's left element, show(pop) → the popup is shown with the chat about pop }. */
|
|
@@ -895,4 +871,4 @@ const popShown = () => ALL.some((y) => y.pop && shown(y));
|
|
|
895
871
|
export function popNext(pop) { G.popNext = pop ? { pop, t: Date.now() } : null; }
|
|
896
872
|
/** Close the popup's Viewer (an item with unsaved changes asks first). */
|
|
897
873
|
export function closePop() { const x = ALL.find((y) => y.pop && shown(y)); if (x) { use(x); guarded(close); } }
|
|
898
|
-
if (typeof window !== 'undefined') window.czViewer = { open, close, closeOf, bodyOf, back, forward, trail, replaceUrl, drill, setPresses, setChip, setCheck, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn,
|
|
874
|
+
if (typeof window !== 'undefined') window.czViewer = { open, close, closeOf, bodyOf, back, forward, trail, replaceUrl, drill, setPresses, setChip, setCheck, isOpen, current, body, onChange, placeholder, retitle, czSummary, czSections, widthOf, setWidth, wide, railOn, railSync, ICONS };
|
|
@@ -100,7 +100,7 @@ export function methodHtml(block, { live = false, open = false } = {}) {
|
|
|
100
100
|
const why = block.why ? String(block.why) : m ? m.fits : '';
|
|
101
101
|
const inner = `Method: <b>${esc(name)}</b>${live ? P(ICON.down, 14) : ''}${why ? `<em>${esc(why)}</em>` : ''}`;
|
|
102
102
|
if (!live) return `<p class="gmeth">${inner}</p>`;
|
|
103
|
-
const menu = `<span class="gmenu" role="menu" aria-label="Ask with another method"${open ? '' : ' hidden'}>${METHODS.filter((x) => !m || x.id !== m.id).map((x) => `<button type="button" role="menuitem" data-goal-method="${esc(x.id)}"><b>${esc(x.name)}</b><em>${esc(x.fits)}</em></button>`).join('')}</span>`;
|
|
103
|
+
const menu = `<span class="gmenu" role="menu" aria-label="Ask with another method"${open ? ' data-esc-layer' : ' hidden'}>${METHODS.filter((x) => !m || x.id !== m.id).map((x) => `<button type="button" role="menuitem" data-goal-method="${esc(x.id)}"><b>${esc(x.name)}</b><em>${esc(x.fits)}</em></button>`).join('')}</span>`;
|
|
104
104
|
return `<span class="gmw"><button type="button" class="gmeth" data-goal-meth aria-haspopup="menu" aria-expanded="${open}" title="Change the method">${inner}</button>${menu}</span>`;
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -183,7 +183,7 @@ export function editedDraft(base, fields) {
|
|
|
183
183
|
/** The choice when /goal is typed while a goal works here: one goal runs in a chat at a time. here: the working goal's sentence.
|
|
184
184
|
* newChat: false where this page cannot open a new chat (then only "Here" is offered). Esc or another message closes it (home-chat.js). */
|
|
185
185
|
export function goalChoiceHtml(here, { newChat = true } = {}) {
|
|
186
|
-
return `<div class="hm-a gchoice"><div class="hm-ab"><div class="askc" role="group" aria-label="Where should the new goal go?"><p class="k">One goal runs in a chat at a time</p><b>Where should the new goal go?</b><div class="gchips">`
|
|
186
|
+
return `<div class="hm-a gchoice" data-esc-layer><div class="hm-ab"><div class="askc" role="group" aria-label="Where should the new goal go?"><p class="k">One goal runs in a chat at a time</p><b>Where should the new goal go?</b><div class="gchips">`
|
|
187
187
|
+ (newChat ? `<button type="button" class="gchip rec" data-goal-where="new">In a new chat<small>recommended · this goal keeps going</small></button>` : '')
|
|
188
188
|
+ `<button type="button" class="gchip" data-goal-where="here">Here, instead of this goal<small class="warn">stops “${esc(here || 'the goal')}”</small></button>`
|
|
189
189
|
+ '</div></div></div></div>';
|