create-pmos 0.605.0 → 0.607.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 +27 -27
- 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/changelog.json +26 -0
- package/workspace/guide/agent-capabilities.md +4 -4
- package/workspace/lib/live-round.js +25 -6
- package/workspace/lib/proto-runtime.js +35 -2
- package/workspace/lib/routes-lab.js +1 -1
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-proto.css +40 -14
- package/workspace/public/pm/cozy-proto.js +140 -92
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.607.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": {
|
|
@@ -33,6 +33,32 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.607.0",
|
|
38
|
+
"at": "2026-11-18T11:44:39.758Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1351,
|
|
43
|
+
"t": "Prototype Design shows only the design, with the run's notes as annotations beside it",
|
|
44
|
+
"s": "Prototype Design shows only the design, with the run's notes as annotations beside it",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"v": "0.606.0",
|
|
51
|
+
"at": "2026-11-18T11:27:58.320Z",
|
|
52
|
+
"f": 4,
|
|
53
|
+
"prs": [
|
|
54
|
+
{
|
|
55
|
+
"n": 1348,
|
|
56
|
+
"t": "Readable flow and who does what panels, copy panel width, tweaks in the inspector",
|
|
57
|
+
"s": "Readable flow and who does what panels, copy panel width, tweaks in the inspector",
|
|
58
|
+
"k": "fix"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
36
62
|
{
|
|
37
63
|
"v": "0.605.0",
|
|
38
64
|
"at": "2026-11-18T10:51:31.052Z",
|
|
@@ -290,32 +316,6 @@
|
|
|
290
316
|
"k": "new"
|
|
291
317
|
}
|
|
292
318
|
]
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
"v": "0.587.0",
|
|
296
|
-
"at": "2026-11-17T10:24:56.955Z",
|
|
297
|
-
"f": 4,
|
|
298
|
-
"prs": [
|
|
299
|
-
{
|
|
300
|
-
"n": 1322,
|
|
301
|
-
"t": "The live round's compare view is always reachable: no early ✓, Specimens line opens it",
|
|
302
|
-
"s": "The live round's compare view is always reachable: no early ✓, Specimens line opens it",
|
|
303
|
-
"k": "fix"
|
|
304
|
-
}
|
|
305
|
-
]
|
|
306
|
-
},
|
|
307
|
-
{
|
|
308
|
-
"v": "0.586.0",
|
|
309
|
-
"at": "2026-11-17T09:31:31.443Z",
|
|
310
|
-
"f": 4,
|
|
311
|
-
"prs": [
|
|
312
|
-
{
|
|
313
|
-
"n": 1321,
|
|
314
|
-
"t": "A headless prototype run may write in a folder whose path has a space",
|
|
315
|
-
"s": "A headless prototype run may write in a folder whose path has a space",
|
|
316
|
-
"k": "fix"
|
|
317
|
-
}
|
|
318
|
-
]
|
|
319
319
|
}
|
|
320
320
|
]
|
|
321
321
|
}
|
package/payload/KIT-VERSION
CHANGED
|
@@ -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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T11:44:35Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T11:44:35Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-18T11:44:35Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.607.0",
|
|
4
|
+
"at": "2026-11-18T11:44:39.758Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1351,
|
|
9
|
+
"t": "Prototype Design shows only the design, with the run's notes as annotations beside it",
|
|
10
|
+
"s": "Prototype Design shows only the design, with the run's notes as annotations beside it",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.606.0",
|
|
17
|
+
"at": "2026-11-18T11:27:58.320Z",
|
|
18
|
+
"f": 4,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1348,
|
|
22
|
+
"t": "Readable flow and who does what panels, copy panel width, tweaks in the inspector",
|
|
23
|
+
"s": "Readable flow and who does what panels, copy panel width, tweaks in the inspector",
|
|
24
|
+
"k": "fix"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.605.0",
|
|
4
30
|
"at": "2026-11-18T10:51:31.052Z",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "What PMOS does behind the scenes, and what stays yours"
|
|
4
4
|
description: "Every job PMOS runs by itself, what agents apply by themselves with Undo (D106), long-running goals, the team of role agents, the live round, the idle lab, and the PM-only acts."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-18
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# What PMOS does behind the scenes
|
|
@@ -195,13 +195,13 @@ Not proven yet: the compare view's Production and Design columns stay left out u
|
|
|
195
195
|
You can ask to see an idea at any moment: alone while you work on an initiative, or with stakeholders in the room. It works like design work with Claude Code: you say what you want, PMOS makes or changes the one prototype, the Viewer shows it, and the chat says what changed.
|
|
196
196
|
|
|
197
197
|
1. **Ask in the initiative's chat.** Say, for example, "prototype this" or "mock this up". PMOS starts one prototype at once. Nothing to press. It opens in the Viewer beside the chat as soon as it opens and renders in a headless browser, in about a minute. The chat answers with a **Version 1** tag and says what was made and for whom. Tap a Version tag to show that version again.
|
|
198
|
-
2. **The Viewer is one canvas, like a design tool.** The prototype is in the middle, at its own size. Three panels sit around it:
|
|
198
|
+
2. **The Viewer is one canvas, like a design tool.** The prototype is in the middle, at its own size. Only the design shows: there is no browser frame around it, and the canvas is cut to the design itself. A version puts no notes on its screens (a format's name and size, "sample data", the other option to compare). It writes them as notes instead, and the notes sit beside the design as numbered annotations for the screen shown. Tap a note about one block to flash that block on the design. Three panels sit around it:
|
|
199
199
|
- **Pages, screens and layers** (left). A page is one format or page of the prototype, for example "One Raffles Place LED". A page has screens: its states, for example "Default" and "Sponsor sold". Layers lists the blocks of the screen shown. Tap a screen to show it, or tap a layer to select it. Press [ to hide or show this panel.
|
|
200
200
|
- **Exact values** (right): the inspector for the selected layer. Set its text, font, size, weight, line height, letter spacing, colour, fill, corner, padding and alignment. The prototype changes at once. PMOS keeps the change with the version, and the next version keeps it. The chat shows one quiet line, for example "You set Temperature to 56px · Bold. Kept as yours." The undo press in the panel clears that layer's changes. Press ] to hide or show the inspector.
|
|
201
|
-
- **Page copy, The flow and Who does what**: one press each in the toolbar, closed by default. One opens at a time, in the inspector's place. Page copy lists every word on the screen: edit a line in place. The flow shows screens as cards, decisions as diamonds and branches to the other scenarios: tap a screen to see it, or a side branch to play that scenario. Who does what
|
|
201
|
+
- **Page copy, The flow and Who does what**: one press each in the toolbar, closed by default. One opens at a time, in the inspector's place. Page copy lists every word on the screen: edit a line in place. The flow shows screens as cards, decisions as diamonds and branches to the other scenarios: tap a screen to see it, or a side branch to play that scenario. Who does what has one column for each role, with the steps going down in order. The role names stay at the top when you scroll. Both diagrams show at the normal text size. A long one scrolls in the panel. Press the arrows at the top of the panel to make it wider. A press with a dot, or a panel that says **Updated**, is what the last version changed.
|
|
202
202
|
- Zoom out, zoom in and fit are in the toolbar. The design opens on the latest version: the toolbar says **Latest · version n**.
|
|
203
203
|
3. **Change it in one sentence.** For example, "make the alert orange". PMOS makes the next version of the prototype and its flow, swimlane and copy, and the chat says what changed, then "Also updated: step 3, the swimlane and the copy". ‹ › in the toolbar walks the versions. On an older version, **Back to latest** returns, and **Continue from version n** makes your next change start from that version.
|
|
204
|
-
4. **Select, then say.** Select (V) is on when the Viewer opens. Tap a block in the prototype, or a layer in the list. It is selected in both places, its exact values show in the inspector, and it goes into the chat box as a chip, for example "Temperature". Your next sentence changes that block. Sliders that the version offers
|
|
204
|
+
4. **Select, then say.** Select (V) is on when the Viewer opens. Tap a block in the prototype, or a layer in the list. It is selected in both places, its exact values show in the inspector, and it goes into the chat box as a chip, for example "Temperature". Your next sentence changes that block. Sliders that the version offers (spacing, corner radius, colour) show in the inspector: under **Page** when no layer is selected, and under **This layer** for the selected one. Nothing shows under the prototype.
|
|
205
205
|
5. **Comment.** Press Comment (C) and tap an element. Write the comment, then send it to PMOS as the next change, or keep it for the team. A kept comment stays pinned, with **Make this change** beside it.
|
|
206
206
|
6. **Draw or attach an image.** Press Draw (D), sketch over the prototype, then attach the sketch. It goes with your next message. An image you attach does the same. PMOS builds from it (its layout, hierarchy and colours) unless your words say otherwise, for example "only the colours".
|
|
207
207
|
7. **Play.** Press Play to run the prototype through a path of the flow. It shows only the prototype, with no design notes. Pick where it plays: on a phone, on a desktop, or at its own size. The flow sits beside it: pick a path, and tap a step to go there. ← and → move a step, and so do the arrows under the prototype. On a screen with taps, tap where the user would tap; a tap that misses shows where to tap. Restart is under the prototype. Stop (Esc) goes back to the design.
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* as it renders, and the chat says in one line what was made (deps.tell: the version's own <meta name="pmos-changed"> sentence goes to the
|
|
10
10
|
* chat's session). Any change sentence while that one version is open ("make the alert orange") is the next round of it, the same way.
|
|
11
11
|
* PROTOTYPE BY CHATTING (design agreed 2026-11-17 23:31, https://claude.ai/artifact/9fxuukKr3XixwkGFMTfeba): the run that makes a version
|
|
12
|
-
* also writes its companions as DATA next to it (PARTS: flow.json, lanes.json, tweaks.json; PMOS writes copy.json from the prototype's
|
|
12
|
+
* also writes its companions as DATA next to it (PARTS: flow.json, lanes.json, tweaks.json, notes.json; PMOS writes copy.json from the prototype's
|
|
13
13
|
* data-copy text), and the Viewer draws them as one canvas (pm/cozy-proto.js). The chat is told once per round, "Version n" first, with
|
|
14
14
|
* what the version changed beside the prototype (changesOf: "Also updated: step 3, the swimlane and the copy"). The canvas's marks before
|
|
15
15
|
* the PM's words (marksOf: the element pointed at, Continue from version n) and the PM's in-place edits (edits.json) reach the next run.
|
|
@@ -83,6 +83,9 @@ const PARTS = Object.freeze([
|
|
|
83
83
|
Object.freeze({ kind: 'flow', title: 'The flow', name: 'flow.json' }),
|
|
84
84
|
Object.freeze({ kind: 'lanes', title: 'Who does what', name: 'lanes.json' }),
|
|
85
85
|
Object.freeze({ kind: 'tweaks', title: 'Tweaks', name: 'tweaks.json', optional: true }),
|
|
86
|
+
// the notes beside the design (Wawan 2026-11-18, batch 31: "the design part should only show the actual design, without any
|
|
87
|
+
// instruction. In case of instruction, it should be put as comment or annotation"): what the run wants the PM to know, never on a screen
|
|
88
|
+
Object.freeze({ kind: 'notes', title: 'Notes', name: 'notes.json', optional: true }),
|
|
86
89
|
]);
|
|
87
90
|
const SCAFFOLD_MAX = 12000;
|
|
88
91
|
const FROM = Object.freeze({ chat: 'Your ask in the initiative chat', cli: 'pmos lab round', meeting: 'Said in the meeting' });
|
|
@@ -247,7 +250,7 @@ function promptOf(o) {
|
|
|
247
250
|
for (const r of o.refs || []) L.push(`The PM attached a reference (an image, a sketch or a file): ${r}. Read it first with the Read tool. Build from it (its layout, hierarchy and colours) unless the PM's words above say otherwise ("only the colours", "ignore the layout"). In your pmos-changed line, say what you took from it.`);
|
|
248
251
|
if (o.base) {
|
|
249
252
|
L.push('', `This is a new version of prototype ${o.key} (${one(o.base.title, 140)}). Read the last version first: ${o.base.abs}`,
|
|
250
|
-
`and its companions next to it (flow.json, lanes.json, tweaks.json in ${path.dirname(o.base.abs)}). Change what the PM asked for in the idea above, usually one thing, and keep the rest as it was, ids and copy keys included.`);
|
|
253
|
+
`and its companions next to it (flow.json, lanes.json, tweaks.json, notes.json in ${path.dirname(o.base.abs)}). Change what the PM asked for in the idea above, usually one thing, and keep the rest as it was, ids and copy keys included.`);
|
|
251
254
|
} else if (o.alone) L.push('', 'This is the one version the PM sees: make the plainest honest version of the idea, not a showcase.');
|
|
252
255
|
else L.push('', `Your direction, ${o.key}: ${one(o.title, 200)}. Other runs take the other directions: keep yours clearly different.`);
|
|
253
256
|
if (o.point && (o.point.el || o.point.label)) L.push('', `The PM pointed at one element: ${o.point.el ? 'data-el="' + one(o.point.el, 60) + '"' : ''}${o.point.label ? ' ("' + one(o.point.label, 80) + '")' : ''}. Their words are about that element: change it, and only what must follow from it.`);
|
|
@@ -266,6 +269,8 @@ function promptOf(o) {
|
|
|
266
269
|
`1. ${o.file}: the prototype. Write it FIRST: the PM sees it as soon as it lands.`,
|
|
267
270
|
' - One self-contained HTML page: inline CSS only, no script, no network, no image files. Real draft copy, never lorem ipsum or a placeholder.',
|
|
268
271
|
` - In <head>, one line for the PM: <meta name="pmos-changed" content="…"> with ONE short sentence of what ${o.base ? 'you changed' : 'you made and for whom'}, in plain words, under 140 characters.`,
|
|
272
|
+
' - Show ONLY the design: each screen is the product exactly as its user sees it. Nothing about the prototype on a screen: no format names or sizes ("Format 1 · 7680 × 1550"), no headings that name the option ("One view: …"), no "sample data" or "placeholder" notes, no notes to the PM, and no buttons that only move between your own options or formats ("See the two-panel option", "All formats"): PMOS lists the pages and screens. Write each such note in notes.json instead.',
|
|
273
|
+
' - No frame around the design: no browser bar, no device, no extra page or card behind it. Body margin 0; the page background is the design\'s own background.',
|
|
269
274
|
' - Each screen is a <section data-screen="<id>" data-label="<screen name>">; the first one is where the user starts. PMOS shows one screen at a time.',
|
|
270
275
|
' - When several screens are states of one page or format (default, sponsor sold, rain alert), give each data-page="<that page\'s name>": the PM sees them as one page with its screens.',
|
|
271
276
|
' - What the user taps to move on carries data-go="<screen id>" (a button, a row, a link with href="#<screen id>").',
|
|
@@ -279,6 +284,7 @@ function promptOf(o) {
|
|
|
279
284
|
' - Scenarios: the main path first, then one per branch (2 to 4 in all). Each step names its screen and the data-el the user taps there to move on ("tap"); the last step has no tap.',
|
|
280
285
|
`3. ${path.join(dir, 'lanes.json')}: who does what. JSON: { "lanes": [{ "id", "name", "steps": [{ "n", "title", "screen"? }] }] }. One lane per actor (the user, the product, and the people or systems the initiative names). n numbers the steps across all lanes in the order they happen (1, 2, 3 …); "screen" is the data-screen the step shows, when it shows one.`,
|
|
281
286
|
`4. ${path.join(dir, 'tweaks.json')} (optional): { "tweaks": [{ "var": "--gap", "label": "Spacing", "min": 4, "max": 32, "step": 1, "unit": "px", "value": 16, "el"? }] }, at most 6, for the custom properties the prototype reads. "el" is the data-el a tweak belongs to; without it, it is for the whole screen.`,
|
|
287
|
+
`5. ${path.join(dir, 'notes.json')} (optional): { "notes": [{ "text", "screen"?, "el"? }] }, at most 8: what the PM should know that is not part of the design (the format and its size, that the data is sample data, what a placeholder stands for, the other option to compare). PMOS shows them as annotations beside the design. "screen" is the data-screen a note is about, "el" the data-el it points at; without them, it is for the whole prototype.`,
|
|
282
288
|
'Write nothing else and do not read anything else' + (o.base || (o.refs || []).length ? ' but what is named above.' : '.'));
|
|
283
289
|
if (o.scaffold && o.scaffold.css) L.push('', 'The stylesheet:', '```css', o.scaffold.css, '```');
|
|
284
290
|
return L.join('\n');
|
|
@@ -326,6 +332,18 @@ function lanesOf(j, { screens = null } = {}) {
|
|
|
326
332
|
if (!lanes.length || !ns.size) return { error: 'lanes.json has no lanes with steps' };
|
|
327
333
|
return { lanes };
|
|
328
334
|
}
|
|
335
|
+
/** PURE. notes.json → { notes: [{ text, screen?, el? }] } | { error }: the annotations beside the design, at most 8, each text once. */
|
|
336
|
+
function notesOf(j) {
|
|
337
|
+
if (!isObj(j)) return { error: 'notes.json is not a JSON object' };
|
|
338
|
+
const seen = new Set();
|
|
339
|
+
const notes = arr(j.notes, 12).map((n) => {
|
|
340
|
+
const text = isObj(n) ? one(n.text, 240) : '';
|
|
341
|
+
if (!text || seen.has(text)) return null;
|
|
342
|
+
seen.add(text);
|
|
343
|
+
return { text, ...(ID.test(str(n.screen)) ? { screen: n.screen } : {}), ...(ID.test(str(n.el)) ? { el: n.el } : {}) };
|
|
344
|
+
}).filter(Boolean).slice(0, 8);
|
|
345
|
+
return { notes };
|
|
346
|
+
}
|
|
329
347
|
/** PURE. tweaks.json → { tweaks: [{ var, label, min, max, step, unit, value, el? }] } | { error }. */
|
|
330
348
|
function tweaksOf(j) {
|
|
331
349
|
if (!isObj(j)) return { error: 'tweaks.json is not a JSON object' };
|
|
@@ -377,6 +395,7 @@ function partsAt(abs) {
|
|
|
377
395
|
const f = flowOf(rd('flow.json')); if (!f.error) out.flow = f;
|
|
378
396
|
const l = lanesOf(rd('lanes.json'), { screens: out.flow ? new Set(out.flow.screens.map((x) => x.id)) : null }); if (!l.error) out.lanes = l;
|
|
379
397
|
const t = tweaksOf(rd('tweaks.json')); if (!t.error && t.tweaks.length) out.tweaks = t;
|
|
398
|
+
const nt = notesOf(rd('notes.json')); if (!nt.error && nt.notes.length) out.notes = nt;
|
|
380
399
|
const c = rd('copy.json'); if (isObj(c)) out.copy = c;
|
|
381
400
|
const e = editsOf(rd('edits.json')); if (Object.keys(e.copy).length || Object.keys(e.vars).length || Object.keys(e.styles).length) out.edits = e;
|
|
382
401
|
return out;
|
|
@@ -440,7 +459,7 @@ function contextOf(cur, { ini, ws = '', rt = null, versions = [] } = {}) {
|
|
|
440
459
|
+ 'never delete the folder by hand, and say in one line what was deleted and that "undo" brings it back (`pmos lab undo <batch>`, the batch it prints). ';
|
|
441
460
|
const abs = (rt && LAB.specimenPath(rt, cur.file)) || cur.file, dir = path.dirname(abs);
|
|
442
461
|
return `[PMOS] This initiative's prototype is Version ${cur.n} (${cur.key}${cur.said ? ': "' + one(cur.said, 140) + '"' : ''}), open in the Viewer beside this chat. `
|
|
443
|
-
+ `Its files are in ${dir}: ${path.basename(abs)} (the prototype), flow.json, lanes.json, copy.json, tweaks.json, and edits.json (the PM's own edits in the Viewer). Read them to answer questions about it. `
|
|
462
|
+
+ `Its files are in ${dir}: ${path.basename(abs)} (the prototype), flow.json, lanes.json, copy.json, tweaks.json, notes.json, and edits.json (the PM's own edits in the Viewer). Read them to answer questions about it. `
|
|
444
463
|
+ `To change, improve or rebuild it, in any words, run exactly: \`pmos lab round ${ini}${wsf} --base ${cur.key} --chat --brief "<what to change, with the PM's words and anything you read, under 600 characters>"\` `
|
|
445
464
|
+ `and say in one line what will change: PMOS makes Version ${cur.n + 1} in about a minute and tells you when it is in the Viewer. ` + del(cur) + never;
|
|
446
465
|
}
|
|
@@ -631,12 +650,12 @@ function create(deps) {
|
|
|
631
650
|
if (deps.artefact && R.slots.length === 1 && R.from !== 'cli') try { deps.artefact(R.dir, { scope: 'experiment:' + R.ini, artefact: 'specimens', field: 'kept', text: one(`Version ${R.n}: ${s.said || s.title} (${LAB.specimenUrl(s.file)})`, 600), sources: [{ label: 'live round', ref: LAB.specimenUrl(s.file) }] }, 'agent:live-round'); } catch (e) { warn('live round kept', e); }
|
|
632
651
|
write(R); settle(R);
|
|
633
652
|
}
|
|
634
|
-
/** A companion lands: it must parse and be well formed (flowOf, lanesOf, tweaksOf), else it is "not made" with the reason. */
|
|
653
|
+
/** A companion lands: it must parse and be well formed (flowOf, lanesOf, tweaksOf, notesOf), else it is "not made" with the reason. */
|
|
635
654
|
function provePart(R, s, x) {
|
|
636
655
|
if (x.state !== 'working') return;
|
|
637
656
|
let j = null, err = '';
|
|
638
657
|
try { j = JSON.parse(fs.readFileSync(x.abs, 'utf8')); } catch (e) { err = x.name + ' is not JSON'; }
|
|
639
|
-
if (!err) { const v = x.kind === 'flow' ? flowOf(j) : x.kind === 'lanes' ? lanesOf(j) : tweaksOf(j); if (v.error) err = v.error; }
|
|
658
|
+
if (!err) { const v = x.kind === 'flow' ? flowOf(j) : x.kind === 'lanes' ? lanesOf(j) : x.kind === 'notes' ? notesOf(j) : tweaksOf(j); if (v.error) err = v.error; }
|
|
640
659
|
if (err) return partNotMade(R, s, x, err);
|
|
641
660
|
x.state = 'ok';
|
|
642
661
|
write(R); settle(R);
|
|
@@ -751,5 +770,5 @@ function stopRound(id) { return inst ? inst.stop(id) : { ok: false, error: NOT_R
|
|
|
751
770
|
function status() { return inst ? inst.status() : []; }
|
|
752
771
|
|
|
753
772
|
module.exports = { DELETE_RE, JOB, ORIGIN, STALL_MS, progressOf, KEYS, DEFAULT_DIRECTIONS, ONE_DIRECTION, PARTS, FROM, marksOf, intentOf, parseDirs, askOf, waiting, baseOf, currentOf: PR.currentOf, contextOf, scaffoldOf, promptOf, saidOf, roundLine,
|
|
754
|
-
flowOf, lanesOf, tweaksOf, copyOf, changesOf, partsAt, editsOf, styleWords, STYLE_OK,
|
|
773
|
+
flowOf, lanesOf, tweaksOf, notesOf, copyOf, changesOf, partsAt, editsOf, styleWords, STYLE_OK,
|
|
755
774
|
create, install, round, startNow, proposeNow, cancel, stopRound, dropCard, running, status };
|
|
@@ -7,8 +7,9 @@
|
|
|
7
7
|
* data-screen one screen shows at a time; the first is the start data-go a tap moves to that screen
|
|
8
8
|
* data-el what the PM can point at, comment on or tap in Play data-label its name in plain words
|
|
9
9
|
* data-copy text the Page copy card edits in place :root vars what Tweaks change
|
|
10
|
-
* Parent → frame { pmos: 1, t }: mode (view | point | comment | play), screen, copy, copyAll, vars, styles (the inspector's, all of them), hint, sel, pins.
|
|
11
|
-
* Frame → parent { pmos: 1, t }: ready (screens with their data-page, els with their screen and copy key, copy), screen,
|
|
10
|
+
* Parent → frame { pmos: 1, t }: mode (view | point | comment | play), screen, copy, copyAll, vars, styles (the inspector's, all of them), hint, sel, pins, box (measure again).
|
|
11
|
+
* Frame → parent { pmos: 1, t }: ready (screens with their data-page, els with their screen and copy key, copy), screen, box (the design's
|
|
12
|
+
* own box on the screen shown, and the page's size: Design crops the frame to it), point (with looks: the
|
|
12
13
|
* selected element's current styles), looks (after styles), pin, tap.
|
|
13
14
|
*
|
|
14
15
|
* withRuntime(html) → html with the runtime's <script> before </body> (or at the end) */
|
|
@@ -31,6 +32,32 @@ function runtime() {
|
|
|
31
32
|
all.forEach(function (s) { s.classList.toggle('pmos-on', s === on); });
|
|
32
33
|
window.scrollTo(0, 0);
|
|
33
34
|
post({ t: 'screen', id: on.getAttribute('data-screen') });
|
|
35
|
+
box();
|
|
36
|
+
};
|
|
37
|
+
// the design's own box on the screen shown (Wawan 2026-11-18: Design shows only the actual design): the union of what draws something
|
|
38
|
+
// (text, a fill, a border, an image or a control), so the canvas can crop the frame to it. The page's own background does not count.
|
|
39
|
+
var drawn = function (e, cs) {
|
|
40
|
+
if (/^(IMG|SVG|CANVAS|VIDEO|INPUT|BUTTON|SELECT|TEXTAREA|HR)$/i.test(e.tagName)) return true;
|
|
41
|
+
if (cs.backgroundImage !== 'none' || (cs.backgroundColor && !/^(transparent|rgba\(0, 0, 0, 0\))$/.test(cs.backgroundColor))) return true;
|
|
42
|
+
if (parseFloat(cs.borderTopWidth) || parseFloat(cs.borderLeftWidth) || parseFloat(cs.borderBottomWidth) || parseFloat(cs.borderRightWidth)) return true;
|
|
43
|
+
for (var n = e.firstChild; n; n = n.nextSibling) if (n.nodeType === 3 && /\S/.test(n.nodeValue)) return true;
|
|
44
|
+
return false;
|
|
45
|
+
};
|
|
46
|
+
var lastBox = '', box = function () {
|
|
47
|
+
var on = document.querySelector('[data-screen].pmos-on') || document.body; if (!on) return;
|
|
48
|
+
var x0 = Infinity, y0 = Infinity, x1 = -Infinity, y1 = -Infinity;
|
|
49
|
+
var list = [on].concat(Array.prototype.slice.call(on.querySelectorAll('*')));
|
|
50
|
+
list.forEach(function (e) {
|
|
51
|
+
if (e.closest && e.closest('.pmos-pin')) return;
|
|
52
|
+
var cs = window.getComputedStyle(e); if (cs.display === 'none' || cs.visibility === 'hidden' || !drawn(e, cs)) return;
|
|
53
|
+
var r = e.getBoundingClientRect(); if (r.width < 1 || r.height < 1) return;
|
|
54
|
+
x0 = Math.min(x0, r.left + window.scrollX); y0 = Math.min(y0, r.top + window.scrollY);
|
|
55
|
+
x1 = Math.max(x1, r.right + window.scrollX); y1 = Math.max(y1, r.bottom + window.scrollY);
|
|
56
|
+
});
|
|
57
|
+
var W = document.documentElement.scrollWidth, H = document.documentElement.scrollHeight;
|
|
58
|
+
var m = { t: 'box', docW: W, docH: H };
|
|
59
|
+
if (x0 !== Infinity) { var pad = 12; m.x = Math.max(0, Math.floor(x0 - pad)); m.y = Math.max(0, Math.floor(y0 - pad)); m.w = Math.min(W, Math.ceil(x1 + pad)) - m.x; m.h = Math.min(H, Math.ceil(y1 + pad)) - m.y; }
|
|
60
|
+
var k = JSON.stringify(m); if (k === lastBox) return; lastBox = k; post(m);
|
|
34
61
|
};
|
|
35
62
|
var elOf = function (n) { return n && n.closest ? n.closest('[data-el]') : null; };
|
|
36
63
|
var info = function (e) {
|
|
@@ -120,12 +147,18 @@ function runtime() {
|
|
|
120
147
|
var se = document.querySelector('.pmos-sel'); if (se) post({ t: 'looks', el: se.getAttribute('data-el') || '', looks: looks(se) });
|
|
121
148
|
}
|
|
122
149
|
else if (m.t === 'pins') pins(m.pins);
|
|
150
|
+
else if (m.t === 'box') { lastBox = ''; box(); }
|
|
151
|
+
if (m.t === 'copy' || m.t === 'copyAll' || m.t === 'vars' || m.t === 'styles') box();
|
|
123
152
|
});
|
|
124
153
|
var start = function () {
|
|
125
154
|
var all = screens(); if (all.length) all[0].classList.add('pmos-on');
|
|
126
155
|
var copy = {}; Array.prototype.forEach.call(document.querySelectorAll('[data-copy]'), function (x) { var k = x.getAttribute('data-copy'); if (!(k in copy)) copy[k] = (x.textContent || '').trim(); });
|
|
127
156
|
post({ t: 'ready', screens: all.map(function (s) { return { id: s.getAttribute('data-screen'), label: s.getAttribute('data-label') || '', page: s.getAttribute('data-page') || '' }; }),
|
|
128
157
|
els: Array.prototype.map.call(document.querySelectorAll('[data-el]'), function (e) { return info(e); }), copy: copy });
|
|
158
|
+
box();
|
|
159
|
+
// fonts, images and the PM's own edits can move the design: measure again when the page settles or changes size
|
|
160
|
+
window.addEventListener('load', box); window.addEventListener('resize', box);
|
|
161
|
+
if (window.ResizeObserver) try { new ResizeObserver(function () { box(); }).observe(document.body); } catch (e) { /* old browser */ }
|
|
129
162
|
};
|
|
130
163
|
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start); else start();
|
|
131
164
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* POST /api/lab/round { ws?, board?, ini, brief, base?, dirs?, propose? } → the live round (lib/live-round.js): `pmos lab round` starts one,
|
|
17
17
|
* or with propose: true files its ✦ ask. No page press needed (D98); it writes no record.
|
|
18
18
|
* Prototype by chatting (initiative live-round-iterative): the compare view of a live round carries its version's companions as data
|
|
19
|
-
* (data: { flow, lanes, copy, tweaks, edits }, lib/live-round.js partsAt) and the initiative's comments; GET /api/lab/specimen with rt=1
|
|
19
|
+
* (data: { flow, lanes, copy, tweaks, notes, edits }, lib/live-round.js partsAt) and the initiative's comments; GET /api/lab/specimen with rt=1
|
|
20
20
|
* adds the canvas runtime (lib/proto-runtime.js) inside the same sandbox, so the canvas can point, pin, play and edit through postMessage.
|
|
21
21
|
* POST /api/lab/edit { ws, file, copy?: { key: text }, vars?: { --var: value }, styles?: { el: { prop: value } | null } } → { ok } the PM's in-place copy edits, tweaks and inspector styles,
|
|
22
22
|
* kept with the version (edits.json next to it); the next version reads them
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.607.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pmos-workspace",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "0.607.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -86,6 +86,21 @@
|
|
|
86
86
|
.pc-dev.desktop::before { content: ''; position: absolute; left: 12px; top: 10px; width: 36px; height: 8px; border-radius: 4px; background: radial-gradient(circle at 4px 4px, var(--cz-hair) 3.5px, transparent 4px) 0 0 / 14px 8px repeat-x; }
|
|
87
87
|
.pc-dev.desktop .pc-frame { height: 560px; border-radius: 0 0 12px 12px; }
|
|
88
88
|
.pc-frame { position: relative; overflow: hidden; background: var(--cz-c-ffffff); }
|
|
89
|
+
/* Design: only the design (Wawan 2026-11-18). No bar, no device, no card behind it: the frame is cut to the design's own box (cozy-proto.js
|
|
90
|
+
cropTo), and the notes sit beside it as annotations. */
|
|
91
|
+
.pc-proto:has(.pc-dev.design) { padding: 0; border: 0; background: transparent; }
|
|
92
|
+
.pc-drow { display: flex; align-items: flex-start; gap: 20px; }
|
|
93
|
+
.pc-dev.design { flex: none; }
|
|
94
|
+
.pc-dev.design .pc-frame { width: 900px; height: 560px; background: transparent; }
|
|
95
|
+
.pc-dev.design .pc-frame iframe { background: transparent; }
|
|
96
|
+
.pc-notes { width: 240px; flex: none; }
|
|
97
|
+
.pc-notes ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
|
|
98
|
+
.pc-note { box-sizing: border-box; display: flex; align-items: flex-start; gap: 8px; width: 100%; padding: 10px 12px; border: 0; border-left: 3px solid var(--cz-risk); border-radius: 4px 12px 12px 4px; background: var(--cz-riskbg); color: var(--cz-ink2); font: inherit; font-size: var(--fs-meta); line-height: var(--lh-meta); text-align: left; }
|
|
99
|
+
button.pc-note { cursor: pointer; }
|
|
100
|
+
button.pc-note:hover, button.pc-note:focus-visible { color: var(--cz-ink); }
|
|
101
|
+
.pc-note .w { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
|
|
102
|
+
.pc-note small { color: var(--cz-ink3); }
|
|
103
|
+
.pc-nn { width: 18px; height: 18px; flex: none; border-radius: 50%; background: var(--cz-risk); color: var(--cz-onsolid); display: inline-flex; align-items: center; justify-content: center; font-size: var(--fs-badge); font-weight: var(--fw-strong); }
|
|
89
104
|
.pc-frame iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--cz-c-ffffff); }
|
|
90
105
|
.pc-frame .pc-none { padding: 20px; }
|
|
91
106
|
.pc-ink { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; border-radius: inherit; }
|
|
@@ -93,10 +108,10 @@
|
|
|
93
108
|
.pc-sel { margin: 0; display: flex; align-items: center; gap: 6px; font-size: var(--fs-meta); color: var(--cz-ink2); max-width: 300px; }
|
|
94
109
|
.pc-sel b { color: var(--cz-blueink); font-weight: var(--fw-strong); white-space: nowrap; }
|
|
95
110
|
.pc-sel .pc-ib { width: 26px; height: 26px; margin-left: auto; }
|
|
96
|
-
|
|
97
|
-
.pc-
|
|
98
|
-
.pc-
|
|
99
|
-
.pc-
|
|
111
|
+
/* the run's tweaks, in the inspector (Page, or This layer) */
|
|
112
|
+
.pc-rng { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 6px; }
|
|
113
|
+
.pc-ir .pc-rng input { height: auto; padding: 0; border: 0; accent-color: var(--cz-blueink); }
|
|
114
|
+
.pc-rng em { font-style: normal; text-align: right; color: var(--cz-ink3); }
|
|
100
115
|
.pc-cdraft { display: flex; flex-direction: column; gap: 6px; max-width: 300px; }
|
|
101
116
|
.pc-cdraft label { font-size: var(--fs-meta); color: var(--cz-ink2); }
|
|
102
117
|
.pc-cdraft textarea { font: inherit; font-size: var(--fs-body); padding: 8px 10px; border-radius: 10px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink); resize: vertical; }
|
|
@@ -111,37 +126,45 @@
|
|
|
111
126
|
.pc-star { color: var(--cz-blueink); font-weight: var(--fw-strong); }
|
|
112
127
|
|
|
113
128
|
/* the flow and the swimlane (SVG) */
|
|
114
|
-
|
|
115
|
-
.pc-
|
|
116
|
-
.pc-flow
|
|
129
|
+
/* drawn at their real size, top to bottom; a big one scrolls inside the panel, never shrinks (Wawan 2026-11-18) */
|
|
130
|
+
.pc-svgw { overflow: auto; min-height: 0; flex: 0 1 auto; overscroll-behavior: contain; }
|
|
131
|
+
.pc-flow, .pc-lanes { display: block; max-width: none; color: var(--cz-ink3); font-family: var(--cz-sans); }
|
|
132
|
+
.pc-flow text, .pc-lanes text { font-size: 13px; fill: var(--cz-ink); }
|
|
117
133
|
.pc-sn { cursor: pointer; }
|
|
118
134
|
.pc-sn rect { fill: var(--cz-card); stroke: var(--cz-hair); stroke-width: 1.2; }
|
|
119
135
|
.pc-sn.br rect { stroke: var(--cz-ok); stroke-dasharray: 4 3; }
|
|
120
136
|
.pc-sn.on rect, .pc-sn:hover rect, .pc-sn:focus-visible rect { stroke: var(--cz-blue); stroke-width: 2; }
|
|
121
|
-
.pc-sn .k { font-size:
|
|
137
|
+
.pc-sn .k { font-size: 10px; font-weight: var(--fw-strong); letter-spacing: .06em; fill: var(--cz-ink3); }
|
|
122
138
|
.pc-dn path { fill: var(--cz-bluebg); stroke: var(--cz-blueink); stroke-width: 1.2; }
|
|
123
|
-
.pc-dn text { font-size:
|
|
139
|
+
.pc-dn text { font-size: 12px; }
|
|
124
140
|
.pc-e path { fill: none; stroke: currentColor; stroke-width: 1.3; }
|
|
125
141
|
.pc-e.br path { stroke-dasharray: 4 3; }
|
|
126
142
|
.pc-e .hit { stroke: transparent; stroke-width: 12; stroke-dasharray: none; cursor: pointer; }
|
|
127
143
|
.pc-e[data-pc-scen]:hover path:not(.hit), .pc-e[data-pc-scen]:focus-visible path:not(.hit) { stroke: var(--cz-blue); }
|
|
128
|
-
.pc-e text { font-size:
|
|
144
|
+
.pc-e text { font-size: 11px; fill: var(--cz-ink3); paint-order: stroke; stroke: var(--cz-card); stroke-width: 4px; stroke-linejoin: round; } /* a label is never drawn over a line */
|
|
129
145
|
.pc-ln rect { fill: var(--cz-card); }
|
|
130
146
|
.pc-ln.alt rect { fill: var(--cz-well); }
|
|
131
|
-
.pc-
|
|
147
|
+
.pc-lhd { position: sticky; top: 0; z-index: 1; display: flex; }
|
|
148
|
+
.pc-lhd b { flex: none; box-sizing: border-box; padding: 8px 6px; background: var(--cz-card); border-bottom: 1px solid var(--cz-hair); text-align: center; font-size: var(--fs-meta); line-height: var(--lh-label); font-weight: var(--fw-strong); color: var(--cz-ink2); }
|
|
149
|
+
.pc-lhd b.alt { background: var(--cz-well); }
|
|
150
|
+
.pc-ln text { font-weight: var(--fw-strong); font-size: 12px; fill: var(--cz-ink2); }
|
|
132
151
|
.pc-ar { fill: none; stroke: currentColor; stroke-width: 1.3; }
|
|
133
152
|
.pc-bx rect { fill: var(--cz-bluebg); stroke: transparent; }
|
|
134
153
|
.pc-bx[data-pc-screen] { cursor: pointer; }
|
|
135
154
|
.pc-bx[data-pc-screen]:hover rect, .pc-bx:focus-visible rect { stroke: var(--cz-blue); stroke-width: 1.5; }
|
|
136
155
|
.pc-bx.ch rect { stroke: var(--cz-ok); stroke-width: 1.5; stroke-dasharray: 4 3; }
|
|
137
156
|
.pc-bx circle { fill: var(--cz-blueink); }
|
|
138
|
-
.pc-bx .n { fill: var(--cz-onsolid); font-size:
|
|
157
|
+
.pc-bx .n { fill: var(--cz-onsolid); font-size: 11px; font-weight: var(--fw-strong); }
|
|
139
158
|
.pc-scens { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
140
159
|
.pc-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--cz-hair); background: var(--cz-card); color: var(--cz-ink2); font: inherit; font-size: var(--fs-meta); cursor: pointer; }
|
|
141
160
|
.pc-chip[aria-pressed="true"] { background: var(--cz-bluebg); color: var(--cz-blueink); border-color: transparent; }
|
|
142
161
|
|
|
143
162
|
/* the page copy: a side panel over the canvas, behind the toolbar's Page copy press (closed by default) */
|
|
144
|
-
.pc-
|
|
163
|
+
.pc-rightw { flex: none; display: flex; min-width: 0; } /* sized by its panel, never by the longest line of copy in it (Wawan 2026-11-18) */
|
|
164
|
+
.pc-side { box-sizing: border-box; width: 420px; max-width: 46vw; padding: 14px; gap: 8px; }
|
|
165
|
+
.pc-side.wide { width: 760px; max-width: 62vw; }
|
|
166
|
+
.pc-side > h3 { flex: none; }
|
|
167
|
+
.pc-side > .pc-copy { flex: none; }
|
|
145
168
|
.pc-side h3 { display: flex; align-items: center; gap: 8px; }
|
|
146
169
|
.pc-side h3 .pc-ib { margin-left: auto; width: 28px; height: 28px; }
|
|
147
170
|
.pc .pc-ib.upd { position: relative; }
|
|
@@ -190,10 +213,13 @@
|
|
|
190
213
|
|
|
191
214
|
@media (max-width: 760px) {
|
|
192
215
|
.pc-dbody { flex-direction: column; }
|
|
193
|
-
.pc-
|
|
216
|
+
.pc-rightw { display: block; }
|
|
217
|
+
.pc-left, .pc-insp, .pc-side, .pc-side.wide { width: 100%; max-width: none; max-height: none; }
|
|
194
218
|
.pc-pmain { flex-direction: column; }
|
|
195
219
|
.pc-pflow { width: 100%; }
|
|
196
220
|
.pc .pc-ib { width: 44px; height: 44px; }
|
|
197
221
|
.pc-dev.desktop { width: 100%; }
|
|
222
|
+
.pc-drow { flex-direction: column; }
|
|
223
|
+
.pc-notes { width: 100%; }
|
|
198
224
|
.pc-pframe.phone iframe { width: 100%; box-shadow: none; margin: 0; }
|
|
199
225
|
}
|
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
* page is a data-page, its screens are its states, its layers are the data-el blocks of the screen shown); the inspector on the right
|
|
11
11
|
* (Exact values: text, font, size, weight, line height, spacing, colour, fill, corner, padding, align), saved with the version in
|
|
12
12
|
* edits.json (styles) and kept by the next version; a change says "You set … Kept as yours." once in the chat ('pmos:note').
|
|
13
|
-
* The cards, which update together: the prototype
|
|
13
|
+
* The cards, which update together: the prototype bare, cut to the design itself, with its notes beside it as annotations (notes.json;
|
|
14
|
+
* Wawan 2026-11-18: no frame, no instructions on a screen) (the comments,
|
|
14
15
|
* the ✦ test-link suggestion); the flow (screens as cards, decisions as diamonds, drawn as SVG from flow.json: a screen shows that moment
|
|
15
16
|
* on the prototype, a branch plays its scenario); the page copy, in its side panel (copy.json, edited in place: the prototype changes as the PM types and
|
|
16
17
|
* the edit is kept with the version, POST /api/lab/edit); who does what (lanes.json as a swimlane with arrows: a step shows its screen).
|
|
@@ -37,6 +38,7 @@ const I = {
|
|
|
37
38
|
restart: 'M4 12a8 8 0 1 0 2.3-5.6L4 9M4 4v5h5', x: 'M6 6l12 12M18 6L6 18', check: 'M5 12l5 5 9-10', send: 'M12 19V5M6 11l6-6 6 6',
|
|
38
39
|
keep: 'M6 4h12v16l-6-4-6 4z', link: 'M10 14a4 4 0 0 0 5.7 0l3-3a4 4 0 0 0-5.7-5.7l-1 1M14 10a4 4 0 0 0-5.7 0l-3 3a4 4 0 0 0 5.7 5.7l1-1',
|
|
39
40
|
text: 'M4 7V5h16v2M12 5v14M9 19h6', flow: 'M3 4h6v5H3zM15 4h6v5h-6zM9 15h6v5H9zM9 6.5h6M18 9v3h-6v3', lanes: 'M3 6h18M3 12h18M3 18h18M6 4h4v4H6zM13 10h4v4h-4z',
|
|
41
|
+
wide: 'M15 4h5v5M9 20H4v-5M20 4l-6 6M4 20l6-6', narrow: 'M14 10h5M14 10V5M10 14H5M10 14v5M14 10l6-6M10 14l-6 6',
|
|
40
42
|
left: 'M3 4h18v16H3zM9 4v16', right: 'M3 4h18v16H3zM15 4v16', own: 'M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5', undo: 'M3 7v6h6M21 17a9 9 0 0 0-15-6.7L3 13', select: 'M4 3l7 18 2.5-7.5L21 11z',
|
|
41
43
|
trash: 'M5 7h14M10 11v6M14 11v6M7 7l1 13h8l1-13M9 7V4h6v3',
|
|
42
44
|
attach: 'M20 11l-8.5 8.5a5 5 0 0 1-7-7L13 4a3.5 3.5 0 0 1 5 5l-8.5 8.5a2 2 0 0 1-3-3L14 7', star: 'M12 3l2.2 6.3H21l-5.4 4 2 6.4L12 15.8 6.4 19.7l2-6.4L3 9.3h6.8z',
|
|
@@ -44,13 +46,12 @@ const I = {
|
|
|
44
46
|
const ib = (attr, label, icon, cls = '') => `<button type="button" class="pc-ib${cls ? ' ' + cls : ''}" ${attr} aria-label="${esc(label)}" title="${esc(label)}">${SVG(icon, 16)}</button>`;
|
|
45
47
|
const store = { get: (k) => { try { return localStorage.getItem(k); } catch { return null; } }, set: (k, v) => { try { if (v == null) localStorage.removeItem(k); else localStorage.setItem(k, v); } catch { /* private window */ } } };
|
|
46
48
|
const human = (k) => String(k || '').replace(/[-_.]+/g, ' ').replace(/^./, (c) => c.toUpperCase());
|
|
47
|
-
/** A label in
|
|
48
|
-
function lines(text, x, y, n, dy = 14) {
|
|
49
|
-
const w = String(text || '').split(/\s+/), out =
|
|
49
|
+
/** A label in up to m lines (two by default) of about n characters each (the last one cut with …), as SVG tspans. */
|
|
50
|
+
function lines(text, x, y, n, dy = 14, m = 2) {
|
|
51
|
+
const w = String(text || '').split(/\s+/), out = Array(m).fill('');
|
|
50
52
|
let i = 0;
|
|
51
|
-
for (const word of w) { if (i
|
|
52
|
-
if (out[
|
|
53
|
-
if (out[0].length > n) out[0] = out[0].slice(0, n - 1) + '…';
|
|
53
|
+
for (const word of w) { if (i < m - 1 && out[i] && (out[i] + ' ' + word).length > n) i += 1; out[i] = out[i] ? out[i] + ' ' + word : word; }
|
|
54
|
+
for (let k = 0; k < m; k += 1) if (out[k].length > n) out[k] = out[k].slice(0, n - 1).trimEnd() + '…';
|
|
54
55
|
return out.filter(Boolean).map((t, k) => `<tspan x="${x}" y="${y + k * dy}">${esc(t)}</tspan>`).join('');
|
|
55
56
|
}
|
|
56
57
|
const fire = (name, detail) => { try { window.dispatchEvent(new CustomEvent(name, { detail })); } catch { /* old browser */ } };
|
|
@@ -61,101 +62,108 @@ if (typeof document !== 'undefined' && typeof document.createElement === 'functi
|
|
|
61
62
|
}
|
|
62
63
|
|
|
63
64
|
/* ── layout (PURE) ── */
|
|
64
|
-
|
|
65
|
+
/* Both diagrams are drawn TOP TO BOTTOM at their real size, so they fit a side panel at the normal text size and scroll when long
|
|
66
|
+
* (Wawan 2026-11-18: "who does what so tiny user can't even read it", "the flow too small and still have overlap component"). */
|
|
67
|
+
const SW = 156, SH = 56, DH = 76, GX = 28, PAD = 16, TR = 20, GT = 18, GB = 12, GY = 30, CHX = 14;
|
|
65
68
|
/** The width of a decision diamond: wide enough for its words in two lines inside the shape (2026-11-18: "What does th" was cut). */
|
|
66
|
-
const diaW = (t) => Math.max(
|
|
69
|
+
const diaW = (t) => Math.max(140, Math.min(220, Math.ceil(String(t || '').length / 2) * 7 / 0.55 + 16));
|
|
70
|
+
/** Where a line leaves (bottom) or enters (top) a box at x: on the edge of the shape, a diamond's slanted side included. */
|
|
71
|
+
const portY = (n, x, bottom) => {
|
|
72
|
+
if (n.kind !== 'decision') return bottom ? n.y + n.h : n.y;
|
|
73
|
+
const k = Math.abs(x - (n.x + n.w / 2)) / (n.w / 2), half = (n.h / 2) * (1 - k);
|
|
74
|
+
return n.y + n.h / 2 + (bottom ? half : -half);
|
|
75
|
+
};
|
|
67
76
|
/** PURE. flow → { w, h, nodes: [{ id, kind, title, x, y, w, h, main, chars }], edges: [{ from, to, label, d, lx, ly, main, anchor }] }.
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
77
|
+
* Layers top to bottom (a box one layer below the deepest one that leads to it); the main scenario first in its layer. Every line runs only in the
|
|
78
|
+
* gaps between layers (each line its own track, so no two share a segment and a label sits on its own track) and, when it skips a
|
|
79
|
+
* layer or goes back, in its own channel at the side: forward on the left, back on the right. So a line never runs through a box, and
|
|
80
|
+
* labels never sit on each other (Wawan 2026-11-18: "still have overlap component"). */
|
|
71
81
|
export function flowLayout(flow) {
|
|
72
82
|
const f = flow || {}, nodes = [...(f.screens || []).map((s) => ({ ...s, kind: 'screen' })), ...(f.decisions || []).map((d) => ({ ...d, kind: 'decision' }))];
|
|
73
83
|
if (!nodes.length) return { w: 0, h: 0, nodes: [], edges: [] };
|
|
74
84
|
const by = new Map(nodes.map((n) => [n.id, n])), out = new Map(nodes.map((n) => [n.id, []]));
|
|
75
85
|
for (const e of f.edges || []) if (by.has(e.from) && by.has(e.to)) out.get(e.from).push(e);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
for (const
|
|
86
|
+
// a line back to a screen already on the way (found walking from the first screen) goes back; the rest go forward, and each box sits one
|
|
87
|
+
// layer below the deepest box that leads to it, so a walk through the screens is one column down and a skip is a side line
|
|
88
|
+
const seen = [], state = new Map(), backE = new Set();
|
|
89
|
+
const walk = (u) => { state.set(u, 1); seen.push(u); for (const e of out.get(u)) { const s2 = state.get(e.to); if (s2 === 1) backE.add(e); else if (!s2) walk(e.to); } state.set(u, 2); };
|
|
90
|
+
walk(nodes[0].id);
|
|
91
|
+
for (const n of nodes) if (!state.has(n.id)) walk(n.id);
|
|
92
|
+
const lay = new Map(seen.map((id) => [id, 0])), indeg = new Map(seen.map((id) => [id, 0]));
|
|
93
|
+
for (const id of seen) for (const e of out.get(id)) if (!backE.has(e)) indeg.set(e.to, indeg.get(e.to) + 1);
|
|
94
|
+
const topo = seen.filter((id) => !indeg.get(id));
|
|
95
|
+
for (let i = 0; i < topo.length; i += 1) for (const e of out.get(topo[i])) if (!backE.has(e)) { lay.set(e.to, Math.max(lay.get(e.to), lay.get(topo[i]) + 1)); indeg.set(e.to, indeg.get(e.to) - 1); if (!indeg.get(e.to)) topo.push(e.to); }
|
|
80
96
|
const steps = new Set(((f.scenarios || [])[0] || { steps: [] }).steps.map((s) => s.screen));
|
|
81
|
-
// the main row: the first scenario's screens and the decisions between them (no scenario: the first node of each column)
|
|
82
97
|
const onMain = new Set();
|
|
83
98
|
if (steps.size) {
|
|
84
99
|
for (const n of nodes) if (steps.has(n.id)) onMain.add(n.id);
|
|
85
|
-
for (const n of nodes) if (n.kind === 'decision' &&
|
|
86
|
-
}
|
|
87
|
-
const rowsUsed = new Map(); // column → next free row
|
|
88
|
-
const taken = new Set();
|
|
89
|
-
for (const n of [...nodes].sort((x, y) => (onMain.has(y.id) ? 1 : 0) - (onMain.has(x.id) ? 1 : 0))) {
|
|
90
|
-
const c = col.get(n.id);
|
|
91
|
-
let r = onMain.has(n.id) || (!steps.size && !taken.has(c + ':0')) ? 0 : Math.max(1, rowsUsed.get(c) || 1);
|
|
92
|
-
while (taken.has(c + ':' + r)) r += 1;
|
|
93
|
-
taken.add(c + ':' + r); rowsUsed.set(c, Math.max(rowsUsed.get(c) || 1, r + 1));
|
|
94
|
-
n.c = c; n.r = r;
|
|
100
|
+
for (const n of nodes) if (n.kind === 'decision' && out.get(n.id).some((e) => steps.has(e.to)) && (f.edges || []).some((e) => e.to === n.id && steps.has(e.from))) onMain.add(n.id);
|
|
95
101
|
}
|
|
96
|
-
for (const n of nodes) { n.w = n.kind === 'decision' ? diaW(n.title) : SW; n.h = n.kind === 'decision' ? DH : SH; }
|
|
97
|
-
const
|
|
98
|
-
for (let
|
|
99
|
-
const
|
|
100
|
-
// the
|
|
102
|
+
for (const n of nodes) { n.l = lay.get(n.id); n.w = n.kind === 'decision' ? diaW(n.title) : SW; n.h = n.kind === 'decision' ? DH : SH; n.main = !steps.size || onMain.has(n.id); }
|
|
103
|
+
const nl = Math.max(...nodes.map((n) => n.l)) + 1, layers = [];
|
|
104
|
+
for (let k = 0; k < nl; k += 1) layers[k] = seen.map((id) => by.get(id)).filter((n) => n.l === k).sort((a, b) => (onMain.has(b.id) ? 1 : 0) - (onMain.has(a.id) ? 1 : 0));
|
|
105
|
+
const lw = layers.map((L) => L.reduce((s, n) => s + n.w, 0) + GX * Math.max(0, L.length - 1)), maxW = Math.max(...lw);
|
|
106
|
+
// the lines: one layer down goes straight across the gap between; anything else takes a channel at the side
|
|
101
107
|
const raw = (f.edges || []).map((e) => ({ e, a: by.get(e.from), b: by.get(e.to) })).filter((x) => x.a && x.b);
|
|
102
|
-
const
|
|
103
|
-
const
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
108
|
+
for (const x of raw) x.kind = x.b.l === x.a.l + 1 ? 'down' : x.b.l > x.a.l ? 'left' : 'right';
|
|
109
|
+
const left = raw.filter((x) => x.kind === 'left'), right = raw.filter((x) => x.kind === 'right');
|
|
110
|
+
const x0 = PAD + (left.length ? left.length * CHX + 10 : 0);
|
|
111
|
+
layers.forEach((L, k) => { let x = x0 + (maxW - lw[k]) / 2; for (const n of L) { n.x = x; x += n.w + GX; } });
|
|
112
|
+
const cxOf = (n) => n.x + n.w / 2;
|
|
113
|
+
left.forEach((x, i) => { x.cx = x0 - 10 - i * CHX; });
|
|
114
|
+
right.forEach((x, i) => { x.cx = x0 + maxW + 10 + i * CHX; });
|
|
115
|
+
// ports: the lines leaving (or entering) one box spread along its edge in the order of where they go (or come from)
|
|
116
|
+
const toward = (x, from) => (x.kind === 'left' ? -1e6 : x.kind === 'right' ? 1e6 + x.cx : cxOf(from ? x.a : x.b));
|
|
117
|
+
for (const n of nodes) {
|
|
118
|
+
const spread = (list, key) => { const span = n.kind === 'decision' ? n.w * 0.4 : n.w * 0.7; list.sort((p, r) => p.o - r.o).forEach((x, i) => { x[key] = cxOf(n) + (list.length > 1 ? -span / 2 + (span * i) / (list.length - 1) : 0); }); };
|
|
119
|
+
spread(raw.filter((x) => x.a === n).map((x) => Object.assign(x, { o: toward(x, false) })), 'x1');
|
|
120
|
+
spread(raw.filter((x) => x.b === n).map((x) => Object.assign(x, { o: toward(x, true) })), 'x2');
|
|
121
|
+
}
|
|
122
|
+
// tracks: gap k is the one above layer k (gap nl is under the last); each line takes one track in each gap it crosses
|
|
123
|
+
const gaps = Array.from({ length: nl + 1 }, () => []);
|
|
124
|
+
for (const x of [...raw].sort((p, r) => p.x1 - r.x1 || p.x2 - r.x2)) { x.g1 = x.a.l + 1; gaps[x.g1].push(x); if (x.kind !== 'down') { x.g2 = x.b.l; gaps[x.g2].push(x); } }
|
|
125
|
+
const gh = gaps.map((g, k) => (g.length ? GT + (g.length - 1) * TR + GB : k === 0 || k === nl ? 0 : GY));
|
|
126
|
+
const lh = layers.map((L) => Math.max(...L.map((n) => n.h)));
|
|
127
|
+
let y = PAD; const gy = [];
|
|
128
|
+
for (let k = 0; k <= nl; k += 1) { gy[k] = y; y += gh[k]; if (k < nl) { for (const n of layers[k]) n.y = y + (lh[k] - n.h) / 2; y += lh[k]; } }
|
|
129
|
+
const track = (x, g) => gy[g] + GT + gaps[g].indexOf(x) * TR;
|
|
130
|
+
const edges = raw.map((x) => {
|
|
131
|
+
const { e, a, b } = x, y1 = portY(a, x.x1, true), y2 = portY(b, x.x2, false), t1 = track(x, x.g1);
|
|
132
|
+
let d;
|
|
133
|
+
if (x.kind === 'down') d = `M${x.x1} ${y1}V${t1}H${x.x2}V${y2 - 2}`;
|
|
134
|
+
else { const t2 = track(x, x.g2); d = `M${x.x1} ${y1}V${t1}H${x.cx}V${t2}H${x.x2}V${y2 - 2}`; }
|
|
135
|
+
// the label sits on the line's first track, beside where it leaves the box, toward where it goes
|
|
136
|
+
const nx = x.kind === 'down' ? x.x2 : x.cx, dir = nx < x.x1 - 1 ? -1 : 1;
|
|
137
|
+
return { from: e.from, to: e.to, label: e.label || '', d, lx: x.x1 + dir * 6, ly: t1 - 5, anchor: dir < 0 ? 'end' : 'start', main: a.main && b.main && x.kind === 'down' };
|
|
131
138
|
});
|
|
132
|
-
const w =
|
|
133
|
-
return { w, h, nodes: nodes.map(({ id, kind, title, x, y, w: nw, h: nh, main: m }) => ({ id, kind, title, x, y, w: nw, h: nh, main: m, chars: kind === 'decision' ? Math.floor((nw * 0.55) /
|
|
139
|
+
const w = (right.length ? x0 + maxW + 10 + right.length * CHX : x0 + maxW) + PAD;
|
|
140
|
+
return { w, h: y + PAD, nodes: nodes.map(({ id, kind, title, x: nx, y: ny, w: nw, h: nh, main: m }) => ({ id, kind, title, x: nx, y: ny, w: nw, h: nh, main: m, chars: kind === 'decision' ? Math.floor((nw * 0.55) / 7) : 22 })), edges };
|
|
134
141
|
}
|
|
135
|
-
const
|
|
136
|
-
/** PURE. lanes → { w, h, lanes: [{ id, name,
|
|
137
|
-
* the order of n; an arrow from each step to the next.
|
|
142
|
+
const LCW = 132, BW = 116, BH = 58, LHH = 0, BG = 22;
|
|
143
|
+
/** PURE. lanes → { w, h, bw, bh, lanes: [{ id, name, x }], boxes: [{ n, title, screen, x, y, lane }], arrows: [{ d }] }: one COLUMN per lane
|
|
144
|
+
* (its name in a header that stays on top while the steps scroll), one row per step in the order of n, going down; an arrow from each step to the next. Narrow enough for a side
|
|
145
|
+
* panel at the normal text size; more lanes scroll sideways. */
|
|
138
146
|
export function lanesLayout(lanes) {
|
|
139
147
|
const L = (lanes && lanes.lanes) || [];
|
|
140
148
|
const steps = [];
|
|
141
149
|
L.forEach((l, i) => { for (const s of l.steps || []) steps.push({ ...s, lane: i }); });
|
|
142
150
|
steps.sort((a, b) => a.n - b.n);
|
|
143
|
-
const boxes = steps.map((s,
|
|
151
|
+
const boxes = steps.map((s, r) => ({ n: s.n, title: s.title, screen: s.screen || '', lane: s.lane, x: s.lane * LCW + (LCW - BW) / 2, y: LHH + 12 + r * (BH + BG) }));
|
|
144
152
|
const arrows = [];
|
|
145
153
|
for (let i = 0; i + 1 < boxes.length; i += 1) {
|
|
146
|
-
const a = boxes[i], b = boxes[i + 1], x1 = a.x + BW, y1 = a.y + BH
|
|
147
|
-
arrows.push({ d: a.lane === b.lane ? `M${x1} ${y1}
|
|
154
|
+
const a = boxes[i], b = boxes[i + 1], x1 = a.x + BW / 2, y1 = a.y + BH, x2 = b.x + BW / 2, y2 = b.y, my = y1 + BG / 2;
|
|
155
|
+
arrows.push({ d: a.lane === b.lane ? `M${x1} ${y1}V${y2 - 2}` : `M${x1} ${y1}V${my}H${x2}V${y2 - 2}` });
|
|
148
156
|
}
|
|
149
|
-
return { w:
|
|
157
|
+
return { w: L.length * LCW, h: LHH + 12 + boxes.length * (BH + BG), bw: BW, bh: BH, lanes: L.map((l, i) => ({ id: l.id, name: l.name, x: i * LCW })), boxes, arrows };
|
|
150
158
|
}
|
|
151
159
|
|
|
152
160
|
/* ── state ── */
|
|
153
161
|
/* Design mode is the default (design "Prototype like Figma", Wawan "build" 2026-11-18): Select is on, Pages > Screens > Layers on the left,
|
|
154
162
|
* the inspector (Exact values) on the right; both hide ([ and ]). Page copy, The flow and Who does what are side panels behind toolbar
|
|
155
163
|
* presses, closed by default; one shows at a time, in the inspector's place. The device switch is only for Play. */
|
|
156
|
-
const V = { body: null, c: null, at: null, H: null, last: null, mode: 'point', pdev: store.get('pmos.pc.pdev') || 'own', zoom: Number(store.get('pmos.pc.zoom')) || 0,
|
|
164
|
+
const V = { body: null, box: null, c: null, at: null, H: null, last: null, mode: 'point', pdev: store.get('pmos.pc.pdev') || 'own', zoom: Number(store.get('pmos.pc.zoom')) || 0,
|
|
157
165
|
sel: null, looks: null, screen: '', frameUrl: '', ready: null, edits: { copy: {}, vars: {}, styles: {} }, pend: null, saveT: null, draft: null, drawing: false, strokes: 0,
|
|
158
|
-
play: null, sig: '', side: null, left: store.get('pmos.pc.left') !== '0', insp: store.get('pmos.pc.insp') !== '0', noteT: null };
|
|
166
|
+
play: null, sig: '', side: null, wide: store.get('pmos.pc.wide') === '1', left: store.get('pmos.pc.left') !== '0', insp: store.get('pmos.pc.insp') !== '0', noteT: null };
|
|
159
167
|
const ARROW = '<marker id="pcArr" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse"><path d="M0 0L10 5L0 10z" fill="currentColor"/></marker>';
|
|
160
168
|
const frameUrl = (c) => (c && c.url ? c.url + '&rt=1' : '');
|
|
161
169
|
const toFrame = (m, f) => { const fr = f || (V.body && V.body.querySelector('.pc-frame iframe')); if (fr && fr.contentWindow) fr.contentWindow.postMessage({ pmos: 1, ...m }, '*'); };
|
|
@@ -214,8 +222,6 @@ function progressHtml(c) {
|
|
|
214
222
|
}
|
|
215
223
|
if (typeof document !== 'undefined' && typeof setInterval === 'function') setInterval(() => { for (const el of document.querySelectorAll('[data-pc-clock]')) el.textContent = clock(el.dataset.pcClock); }, 1000);
|
|
216
224
|
function protoCard(c, v, making) {
|
|
217
|
-
const data = v.data || {}, tw = ((data.tweaks && data.tweaks.tweaks) || []).filter((t) => !t.el || (V.sel && t.el === V.sel.el));
|
|
218
|
-
const tweaks = tw.length ? `<div class="pc-tw" aria-label="Tweaks">${tw.map((t) => { const val = parseFloat(V.edits.vars[t.var]) || t.value; return `<label><span>${esc(t.label)}</span><input type="range" min="${t.min}" max="${t.max}" step="${t.step}" value="${val}" data-pc-var="${esc(t.var)}" data-pc-unit="${esc(t.unit)}"><em>${esc(val + t.unit)}</em></label>`; }).join('')}</div>` : '';
|
|
219
225
|
const sel = V.sel && !(V.insp && !V.side) ? `<p class="pc-sel">${SVG(I.point, 14)}<b>${esc(V.sel.label || V.sel.el)}</b> is in the chat box: say the change.${ib('data-pc-unsel', 'Clear the element', I.x)}</p>` : '';
|
|
220
226
|
const cm = (c.comments || []).filter((x) => !x.send);
|
|
221
227
|
const draft = V.draft ? `<div class="pc-cdraft"><label for="pcCm">Comment${V.draft.label ? ' on ' + esc(V.draft.label) : ''}</label><textarea id="pcCm" rows="2" maxlength="500" placeholder="Say what should change"></textarea><span>${ib('data-pc-cm="send"', 'Send to PMOS as the next change', I.send, 'blue')}${ib('data-pc-cm="keep"', 'Keep for the team', I.keep)}${ib('data-pc-cm="x"', 'Cancel', I.x)}</span></div>` : '';
|
|
@@ -223,7 +229,20 @@ function protoCard(c, v, making) {
|
|
|
223
229
|
const sug = suggestion(c);
|
|
224
230
|
const draw = V.mode === 'draw' ? `<canvas class="pc-ink" aria-label="Sketch over the prototype"></canvas><span class="pc-inkacts">${ib('data-pc-ink="attach"', 'Attach the sketch to your next message', I.attach, 'blue')}${ib('data-pc-ink="clear"', 'Clear the sketch', I.x)}</span>` : '';
|
|
225
231
|
const lost = c.notMade ? `<p class="pc-making pc-lost">Version ${c.round} was not made: ${esc(c.notMade)}.${c.fallbackN ? ` This is version ${c.fallbackN}.` : ''} Ask in the chat for it in smaller steps, one screen or format at a time.</p>` : '';
|
|
226
|
-
return { pre: lost + (making ? progressHtml(c) : ''), dev: `<div class="pc-frame" data-pc-frame>${v.url ? '' : '<p class="pc-none">PMOS is making it.</p>'}</div>${draw}`, post: sel +
|
|
232
|
+
return { pre: lost + (making ? progressHtml(c) : ''), dev: `<div class="pc-frame" data-pc-frame>${v.url ? '' : '<p class="pc-none">PMOS is making it.</p>'}</div>${draw}`, post: sel + draft + list + sug };
|
|
233
|
+
}
|
|
234
|
+
/** The notes beside the design (notes.json): what the run wants the PM to know, kept off the screens (Wawan 2026-11-18). Only the notes for
|
|
235
|
+
* the screen shown and the ones for the whole prototype; none at all is silence. A note on a layer flashes it on the design. */
|
|
236
|
+
export function notesFor(notes, screen) { return ((notes && notes.notes) || []).filter((n) => !n.screen || !screen || n.screen === screen); }
|
|
237
|
+
function notesHtml(v) {
|
|
238
|
+
const L = layersOf(V.ready, V.screen), list = notesFor((v.data || {}).notes, L.screen);
|
|
239
|
+
if (!list.length) return '';
|
|
240
|
+
const lab = (el) => { const e = ((V.ready && V.ready.els) || []).find((x) => x.el === el); return e ? e.label || human(el) : ''; };
|
|
241
|
+
return `<aside class="pc-notes" aria-label="Notes on the design"><ol>${list.map((n, i) => {
|
|
242
|
+
const on = n.el ? lab(n.el) : '';
|
|
243
|
+
const inner = `<span class="pc-nn" aria-hidden="true">${i + 1}</span><span class="w">${esc(n.text)}${on ? `<small>on ${esc(on)}</small>` : ''}</span>`;
|
|
244
|
+
return `<li>${n.el ? `<button type="button" class="pc-note" data-pc-note="${esc(n.el)}" aria-label="${esc('Show ' + (on || n.el) + ' on the design: ' + n.text)}">${inner}</button>` : `<div class="pc-note">${inner}</div>`}</li>`;
|
|
245
|
+
}).join('')}</ol></aside>`;
|
|
227
246
|
}
|
|
228
247
|
function suggestion(c) {
|
|
229
248
|
// the design sprint runs silently: PMOS recommends good practice as ONE ✦ (canvas PbcChat), here: test it with people once it settles
|
|
@@ -232,19 +251,21 @@ function suggestion(c) {
|
|
|
232
251
|
if (N < 3 || c.working || store.get(key)) return '';
|
|
233
252
|
return `<div class="pc-sug"><span class="pc-star" aria-hidden="true">✦</span><p>Version ${c.round} answers the brief. Try it on 3 to 5 people it is for before more polish.</p>${ib(`data-pc-sug="link" data-pc-sugk="${esc(key)}"`, 'Get a test link', I.link, 'blue')}${ib(`data-pc-sug="no" data-pc-sugk="${esc(key)}"`, 'Not now', I.x)}</div>`;
|
|
234
253
|
}
|
|
254
|
+
/** The press that makes the flow or who does what panel wider (or back), so a big diagram shows more at the same text size. */
|
|
255
|
+
const wideIb = () => ib('data-pc-wide', V.wide ? 'Narrower panel' : 'Wider panel', V.wide ? I.narrow : I.wide);
|
|
235
256
|
function flowCard(c, v) {
|
|
236
257
|
if (V.side !== 'flow') return '';
|
|
237
|
-
const close = ib('data-pc-side="flow"', 'Close the flow', I.x);
|
|
258
|
+
const close = wideIb() + ib('data-pc-side="flow"', 'Close the flow', I.x);
|
|
238
259
|
const f = (v.data || {}).flow, st = (c.parts || {}).flow;
|
|
239
|
-
if (!f) return `<section class="pc-card pc-flowc pc-side" aria-label="The flow"><h3>The flow ${close}</h3><p class="pc-none">${esc(st === 'working' ? 'PMOS is drawing it.' : st && st !== 'ok' ? 'Not made this time: ' + st.replace(/^not made: /, '') : 'No flow for this version.')}</p></section>`;
|
|
260
|
+
if (!f) return `<section class="pc-card pc-flowc pc-side${V.wide ? ' wide' : ''}" aria-label="The flow"><h3>The flow ${close}</h3><p class="pc-none">${esc(st === 'working' ? 'PMOS is drawing it.' : st && st !== 'ok' ? 'Not made this time: ' + st.replace(/^not made: /, '') : 'No flow for this version.')}</p></section>`;
|
|
240
261
|
const L = flowLayout(f), scen = f.scenarios || [];
|
|
241
262
|
const branchOf = (to) => { for (let i = 1; i < scen.length; i += 1) if (scen[i].steps.some((s) => s.screen === to)) return scen[i].id; return ''; };
|
|
242
263
|
const nodes = L.nodes.map((n) => n.kind === 'decision'
|
|
243
|
-
? `<g class="pc-dn"><path d="M${n.x + n.w / 2} ${n.y}L${n.x + n.w} ${n.y + n.h / 2}L${n.x + n.w / 2} ${n.y + n.h}L${n.x} ${n.y + n.h / 2}Z"/><text text-anchor="middle">${lines(n.title, n.x + n.w / 2, n.y + n.h / 2 + (String(n.title).length > n.chars ? -
|
|
244
|
-
: `<g class="pc-sn${n.main ? '' : ' br'}${V.screen === n.id ? ' on' : ''}" data-pc-screen="${esc(n.id)}" role="button" tabindex="0" aria-label="${esc('Show ' + n.title + ' on the prototype')}"><rect x="${n.x}" y="${n.y}" width="${n.w}" height="${n.h}" rx="8"/><text x="${n.x + 10}" y="${n.y +
|
|
264
|
+
? `<g class="pc-dn"><path d="M${n.x + n.w / 2} ${n.y}L${n.x + n.w} ${n.y + n.h / 2}L${n.x + n.w / 2} ${n.y + n.h}L${n.x} ${n.y + n.h / 2}Z"/><text text-anchor="middle">${lines(n.title, n.x + n.w / 2, n.y + n.h / 2 + (String(n.title).length > n.chars ? -3 : 4), n.chars, 14)}</text></g>`
|
|
265
|
+
: `<g class="pc-sn${n.main ? '' : ' br'}${V.screen === n.id ? ' on' : ''}" data-pc-screen="${esc(n.id)}" role="button" tabindex="0" aria-label="${esc('Show ' + n.title + ' on the prototype')}"><rect x="${n.x}" y="${n.y}" width="${n.w}" height="${n.h}" rx="8"/><text x="${n.x + 10}" y="${n.y + 16}" class="k">SCREEN</text><text>${lines(n.title, n.x + 10, n.y + 33, n.chars, 15)}</text></g>`).join('');
|
|
245
266
|
const edges = L.edges.map((e) => { const sc = e.main ? '' : branchOf(e.to); return `<g class="pc-e${e.main ? '' : ' br'}"${sc ? ` data-pc-scen="${esc(sc)}" role="button" tabindex="0" aria-label="${esc('Play ' + (scen.find((x) => x.id === sc) || {}).name)}"` : ''}><path d="${e.d}" marker-end="url(#pcArr)"/>${sc ? `<path class="hit" d="${e.d}"/>` : ''}${e.label ? `<text x="${e.lx}" y="${e.ly}" text-anchor="${e.anchor || 'middle'}">${esc(e.label)}</text>` : ''}</g>`; }).join('');
|
|
246
267
|
const chips = scen.length ? `<div class="pc-scens">${scen.map((s, i) => `<button type="button" class="pc-chip" data-pc-scen="${esc(s.id)}" title="${esc(s.description || '')}">${SVG(I.play, 12)}${esc(i === 0 ? s.name : s.name)}</button>`).join('')}</div>` : '';
|
|
247
|
-
return `<section class="pc-card pc-flowc pc-side" aria-label="The flow"><h3>The flow ${upd(c, 'flow')}${close}</h3><div class="pc-svgw"><svg class="pc-flow" width="
|
|
268
|
+
return `<section class="pc-card pc-flowc pc-side${V.wide ? ' wide' : ''}" aria-label="The flow"><h3>The flow ${upd(c, 'flow')}${close}</h3><div class="pc-svgw"><svg class="pc-flow" width="${L.w}" height="${L.h}" viewBox="0 0 ${L.w} ${L.h}"><defs>${ARROW}</defs>${edges}${nodes}</svg></div>`
|
|
248
269
|
+ `<p class="pc-hint">Tap a screen to see it on the prototype. Tap a side branch to play that scenario.</p>${chips}</section>`;
|
|
249
270
|
}
|
|
250
271
|
function copyCard(c, v) {
|
|
@@ -258,14 +279,15 @@ function copyCard(c, v) {
|
|
|
258
279
|
}
|
|
259
280
|
function lanesCard(c, v) {
|
|
260
281
|
if (V.side !== 'lanes') return '';
|
|
261
|
-
const close = ib('data-pc-side="lanes"', 'Close who does what', I.x);
|
|
282
|
+
const close = wideIb() + ib('data-pc-side="lanes"', 'Close who does what', I.x);
|
|
262
283
|
const l = (v.data || {}).lanes, st = (c.parts || {}).lanes;
|
|
263
|
-
if (!l) return `<section class="pc-card pc-lanesc pc-side" aria-label="Who does what"><h3>Who does what ${close}</h3><p class="pc-none">${esc(st === 'working' ? 'PMOS is drawing it.' : st && st !== 'ok' ? 'Not made this time: ' + st.replace(/^not made: /, '') : 'No swimlane for this version.')}</p></section>`;
|
|
284
|
+
if (!l) return `<section class="pc-card pc-lanesc pc-side${V.wide ? ' wide' : ''}" aria-label="Who does what"><h3>Who does what ${close}</h3><p class="pc-none">${esc(st === 'working' ? 'PMOS is drawing it.' : st && st !== 'ok' ? 'Not made this time: ' + st.replace(/^not made: /, '') : 'No swimlane for this version.')}</p></section>`;
|
|
264
285
|
const L = lanesLayout(l), chg = new Set((c.updated && c.updated.steps) || []);
|
|
265
|
-
const lanes = L.lanes.map((x, i) => `<g class="pc-ln${i % 2 ? ' alt' : ''}"><rect x="
|
|
266
|
-
const
|
|
286
|
+
const lanes = L.lanes.map((x, i) => `<g class="pc-ln${i % 2 ? ' alt' : ''}"><rect x="${x.x}" y="0" width="${LCW}" height="${L.h}"/></g>`).join('');
|
|
287
|
+
const heads = `<div class="pc-lhd" style="width:${L.w}px">${L.lanes.map((x, i) => `<b class="${i % 2 ? 'alt' : ''}" style="width:${LCW}px">${esc(x.name)}</b>`).join('')}</div>`;
|
|
288
|
+
const boxes = L.boxes.map((b) => `<g class="pc-bx${chg.has(b.n) ? ' ch' : ''}${b.screen ? '' : ' ns'}"${b.screen ? ` data-pc-screen="${esc(b.screen)}" role="button" tabindex="0" aria-label="${esc('Show step ' + b.n + ' on the prototype')}"` : ''}><rect x="${b.x}" y="${b.y}" width="${L.bw}" height="${L.bh}" rx="8"/><text text-anchor="middle">${lines(b.title, b.x + L.bw / 2, b.y + (b.title.length > 30 ? 18 : b.title.length > 15 ? 25 : 33), 15, 15, 3)}</text><circle cx="${b.x}" cy="${b.y}" r="9"/><text class="n" x="${b.x}" y="${b.y + 3.5}" text-anchor="middle">${b.n}</text></g>`).join('');
|
|
267
289
|
const arrows = L.arrows.map((a) => `<path class="pc-ar" d="${a.d}" marker-end="url(#pcArr)"/>`).join('');
|
|
268
|
-
return `<section class="pc-card pc-lanesc pc-side" aria-label="Who does what"><h3>Who does what ${upd(c, 'lanes')}${close}</h3><div class="pc-svgw"
|
|
290
|
+
return `<section class="pc-card pc-lanesc pc-side${V.wide ? ' wide' : ''}" aria-label="Who does what"><h3>Who does what ${upd(c, 'lanes')}${close}</h3><div class="pc-svgw">${heads}<svg class="pc-lanes" width="${L.w}" height="${L.h}" viewBox="0 0 ${L.w} ${L.h}"><defs>${ARROW}</defs>${lanes}${arrows}${boxes}</svg></div><p class="pc-hint">Tap a step to see it on the prototype.</p></section>`;
|
|
269
291
|
}
|
|
270
292
|
|
|
271
293
|
|
|
@@ -298,10 +320,18 @@ export function styleWords(ps) {
|
|
|
298
320
|
const W = Object.fromEntries(WEIGHTS);
|
|
299
321
|
return Object.entries(ps || {}).map(([k, v]) => (k === 'weight' ? W[v] || v : k === 'size' || k === 'color' ? v : k + ' ' + v)).join(' · ');
|
|
300
322
|
}
|
|
301
|
-
|
|
323
|
+
/** The run's tweaks (tweaks.json: a CSS variable with a range) as inspector rows: the page's with no layer selected, a layer's with it.
|
|
324
|
+
* They sit in the inspector, not under the prototype (Wawan 2026-11-18: the Spacing slider under the canvas, "remove this things"). */
|
|
325
|
+
function tweakRows(v) {
|
|
326
|
+
const tw = (((v && v.data) || {}).tweaks || {}).tweaks || [], el = V.sel ? V.sel.el : '';
|
|
327
|
+
const mine = tw.filter((t) => (el ? t.el === el : !t.el));
|
|
328
|
+
if (!mine.length) return '';
|
|
329
|
+
return `<div class="pc-isec pc-tw"><b>${el ? 'This layer' : 'Page'}</b>${mine.map((t) => { const val = parseFloat(V.edits.vars[t.var]) || t.value; return `<label class="pc-ir"><span>${esc(t.label)}</span><span class="pc-rng"><input type="range" min="${t.min}" max="${t.max}" step="${t.step || 1}" value="${val}" data-pc-var="${esc(t.var)}" data-pc-unit="${esc(t.unit || '')}" aria-label="${esc(t.label)}"><em>${esc(val + (t.unit || ''))}</em></span></label>`; }).join('')}</div>`;
|
|
330
|
+
}
|
|
331
|
+
function inspHtml(v) {
|
|
302
332
|
if (V.side || !V.insp) return '';
|
|
303
333
|
const hide = ib('data-pc-insp', 'Hide the inspector', I.right);
|
|
304
|
-
if (!V.sel) return `<aside class="pc-insp" aria-label="Exact values"><div class="pc-lh"><span>Exact values</span>${hide}</div><p class="pc-hint">Select a layer on the prototype, or in Layers, to set its exact values. For anything else, say it in the chat.</p
|
|
334
|
+
if (!V.sel) return `<aside class="pc-insp" aria-label="Exact values"><div class="pc-lh"><span>Exact values</span>${hide}</div><p class="pc-hint">Select a layer on the prototype, or in Layers, to set its exact values. For anything else, say it in the chat.</p>${tweakRows(v)}</aside>`;
|
|
305
335
|
const el = V.sel.el, mine = V.edits.styles[el] || {}, lk = V.looks || {}, val = (k, d = '') => (k in mine ? mine[k] : k in lk ? lk[k] : d);
|
|
306
336
|
const num = (v) => String(parseFloat(v) || 0), colr = (v) => (/^#[0-9a-f]{6}$/i.test(v) ? v : lk.fillPick || '');
|
|
307
337
|
const id = (k) => 'pcS-' + k;
|
|
@@ -321,10 +351,11 @@ function inspHtml() {
|
|
|
321
351
|
+ `${fld('corner', 'Corner', nIn('corner', 'px', '1', '0', '200'))}`
|
|
322
352
|
+ `<div class="pc-ir"><span>Padding</span><span class="pc-two">${nIn('padding', 'px', '1', '0', '200', '0')}${nIn('padding', 'px', '1', '0', '200', '1')}</span></div>`
|
|
323
353
|
+ `${fld('align', 'Align', sel('align', [['left', 'Left'], ['center', 'Centre'], ['right', 'Right']], val('align', 'left')))}</div>`
|
|
354
|
+
+ tweakRows(v)
|
|
324
355
|
+ `<p class="pc-ifoot">${changed ? `Saved with version ${esc((V.v && V.v.round) || (V.c && V.c.round) || 1)}. The next version keeps it.` : 'Your changes are saved with this version.'}${changed ? ib(`data-pc-unstyle="${esc(el)}"`, 'Undo this layer\'s changes', I.undo) : ''}</p>`
|
|
325
356
|
+ '</aside>';
|
|
326
357
|
}
|
|
327
|
-
function rightHtml(c, v) { return copyCard(c, v) + flowCard(c, v) + lanesCard(c, v) + inspHtml(); }
|
|
358
|
+
function rightHtml(c, v) { return copyCard(c, v) + flowCard(c, v) + lanesCard(c, v) + inspHtml(v); }
|
|
328
359
|
|
|
329
360
|
/* ── draw ── */
|
|
330
361
|
/** Draw or update the canvas. body: the Viewer's body; c: GET /api/lab/compare's compare (live); o: { at, H } */
|
|
@@ -340,7 +371,7 @@ export function draw(body, c, o = {}) {
|
|
|
340
371
|
if (!root) { body.innerHTML = '<div class="pc"></div>'; root = body.querySelector('.pc'); wire(root); }
|
|
341
372
|
V.body = body;
|
|
342
373
|
// keep the frame (and what the PM typed) while the canvas reads again every 2 seconds
|
|
343
|
-
const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.progress, c.notMade, c.updated, c.parts, (c.comments || []).length, V.mode, V.sel && V.sel.el, V.looks, !!V.ready, V.screen, V.left, V.insp, V.side, !!V.draft, (c.history || []).length, c.state]);
|
|
374
|
+
const sig = JSON.stringify([c.id, c.key, c.round, c.file, v.file, c.working, c.progress, c.notMade, c.updated, c.parts, (c.comments || []).length, V.mode, V.sel && V.sel.el, V.looks, !!V.ready, V.screen, V.left, V.insp, V.side, V.wide, !!V.draft, (c.history || []).length, c.state]);
|
|
344
375
|
const focus = document.activeElement && root.contains(document.activeElement) && document.activeElement.matches('[data-pc-copy],textarea,input,select');
|
|
345
376
|
if (sig === V.sig && root.firstChild) return;
|
|
346
377
|
if (focus && prevFile === v.file) return; // the PM is typing in this version: draw on a later read
|
|
@@ -352,24 +383,35 @@ export function draw(body, c, o = {}) {
|
|
|
352
383
|
// everything around the frame is drawn again; the frame stays where it is (moving an iframe reloads it)
|
|
353
384
|
const put = (sel, html) => { const n = root.querySelector(sel); if (n) n.innerHTML = html; };
|
|
354
385
|
put('.pc-barw', barHtml(c, v)); put('.pc-trayw', trayHtml(c)); put('.pc-leftw', leftHtml()); put('.pc-rightw', rightHtml(c, v));
|
|
355
|
-
put('.pc-pre', P.pre); put('.pc-post', P.post);
|
|
386
|
+
put('.pc-pre', P.pre); put('.pc-post', P.post); put('.pc-notesw', notesHtml(v));
|
|
356
387
|
root.querySelectorAll('.pc-dev > :not(.pc-frame)').forEach((n) => n.remove());
|
|
357
388
|
const dv = root.querySelector('.pc-dev'); if (dv) dv.insertAdjacentHTML('beforeend', P.dev.slice(P.dev.indexOf('</div>') + 6));
|
|
358
389
|
} else {
|
|
359
390
|
root.innerHTML = `<div class="pc-barw">${barHtml(c, v)}</div><div class="pc-trayw">${trayHtml(c)}</div><div class="pc-dbody"><div class="pc-leftw">${leftHtml()}</div>`
|
|
360
|
-
+ `<div class="pc-vp"><div class="pc-board"><section class="pc-card pc-proto" aria-label="The prototype"><div class="pc-pre">${P.pre}</div><div class="pc-dev
|
|
391
|
+
+ `<div class="pc-vp"><div class="pc-board"><section class="pc-card pc-proto" aria-label="The prototype"><div class="pc-pre">${P.pre}</div><div class="pc-drow"><div class="pc-dev design">${P.dev}</div><div class="pc-notesw">${notesHtml(v)}</div></div><div class="pc-post">${P.post}</div></section></div></div>`
|
|
361
392
|
+ `<div class="pc-rightw">${rightHtml(c, v)}</div></div>`;
|
|
362
393
|
const slot = root.querySelector('[data-pc-frame]');
|
|
363
|
-
if (slot && v.url) { V.frameUrl = frameUrl(v); V.ready = null; slot.innerHTML = `<iframe src="${esc(V.frameUrl)}" sandbox="allow-scripts" title="${esc('The prototype, version ' + (v.round || 1))}"></iframe>`; }
|
|
394
|
+
if (slot && v.url) { V.frameUrl = frameUrl(v); V.ready = null; V.box = null; slot.innerHTML = `<iframe src="${esc(V.frameUrl)}" sandbox="allow-scripts" title="${esc('The prototype, version ' + (v.round || 1))}"></iframe>`; }
|
|
364
395
|
}
|
|
365
396
|
if (!V.play) { const op = root.querySelector('.pc-play'); if (op) op.remove(); }
|
|
366
397
|
if (draftText && root.querySelector('#pcCm')) root.querySelector('#pcCm').value = draftText;
|
|
398
|
+
cropTo(root);
|
|
367
399
|
applyZoom(root);
|
|
368
400
|
if (V.mode === 'draw') ink(root);
|
|
369
401
|
if (keepFrame) { toFrame({ t: 'mode', mode: V.play ? 'view' : V.mode === 'draw' ? 'view' : V.mode }); pins(); }
|
|
370
402
|
if (V.play) startPlay(V.play.id, V.play.i);
|
|
371
403
|
if (V.draft && root.querySelector('#pcCm')) root.querySelector('#pcCm').focus();
|
|
372
404
|
}
|
|
405
|
+
/** Design shows only the design (Wawan 2026-11-18): no browser bar, no device, no page around it. The frame is cut to the design's own box
|
|
406
|
+
* on the screen shown (the runtime's 'box' message); the page stays full size inside, so a tap, a comment pin or a layer lands where it is. */
|
|
407
|
+
function cropTo(root) {
|
|
408
|
+
const f = root && root.querySelector('.pc-dev.design .pc-frame'), fr = f && f.querySelector('iframe'); if (!f || !fr) return;
|
|
409
|
+
const b = V.box;
|
|
410
|
+
if (!b || !(b.w > 0 && b.h > 0)) { f.style.width = ''; f.style.height = ''; fr.style.cssText = ''; return; }
|
|
411
|
+
f.style.width = b.w + 'px'; f.style.height = b.h + 'px';
|
|
412
|
+
fr.style.cssText = `position:absolute;left:${-b.x}px;top:${-b.y}px;width:${FRAME_W}px;height:${Math.max(b.docH || 0, b.y + b.h)}px`;
|
|
413
|
+
}
|
|
414
|
+
const FRAME_W = 900;
|
|
373
415
|
function applyZoom(root) {
|
|
374
416
|
const b = root.querySelector('.pc-board'), vp = root.querySelector('.pc-vp'); if (!b || !vp) return;
|
|
375
417
|
let z = V.zoom;
|
|
@@ -398,6 +440,10 @@ if (typeof window !== 'undefined') window.addEventListener('message', (e) => {
|
|
|
398
440
|
if (V.sel) toFrame({ t: 'sel', el: V.sel.el });
|
|
399
441
|
pins();
|
|
400
442
|
V.sig = ''; draw(V.body, V.c);
|
|
443
|
+
} else if (m.t === 'box') {
|
|
444
|
+
const n = (k) => Math.max(0, Math.round(Number(m[k]) || 0));
|
|
445
|
+
V.box = { x: n('x'), y: n('y'), w: n('w'), h: n('h'), docH: n('docH') };
|
|
446
|
+
cropTo(V.body.querySelector('.pc')); applyZoom(V.body.querySelector('.pc'));
|
|
401
447
|
} else if (m.t === 'screen') {
|
|
402
448
|
V.screen = String(m.id || '');
|
|
403
449
|
V.sig = ''; draw(V.body, V.c);
|
|
@@ -423,6 +469,7 @@ function wire(root) {
|
|
|
423
469
|
const d = b.dataset;
|
|
424
470
|
if (d.pcMode) { setMode(V.mode === d.pcMode ? 'view' : d.pcMode); return; }
|
|
425
471
|
if (d.pcSide) { V.side = V.side === d.pcSide ? null : d.pcSide; V.sig = ''; draw(V.body, V.c); return; }
|
|
472
|
+
if ('pcWide' in d) { V.wide = !V.wide; store.set('pmos.pc.wide', V.wide ? '1' : null); V.sig = ''; draw(V.body, V.c); return; }
|
|
426
473
|
if ('pcLeft' in d) { panel('left'); return; }
|
|
427
474
|
if ('pcInsp' in d) { panel('insp'); return; }
|
|
428
475
|
if (d.pcPage) { const L = layersOf(V.ready, V.screen), first = ((V.ready && V.ready.screens) || []).find((x) => x.page === d.pcPage); if (first && first.id !== L.screen) { V.screen = first.id; toFrame({ t: 'screen', id: first.id }); } return; }
|
|
@@ -435,6 +482,7 @@ function wire(root) {
|
|
|
435
482
|
if (d.pcZoom != null) { const k = Number(d.pcZoom); V.zoom = k === 0 ? 0 : Math.max(0.4, Math.min(1.6, Math.round(((V.zoom || currentZoom()) + k * 0.1) * 10) / 10)); store.set('pmos.pc.zoom', V.zoom ? String(V.zoom) : null); applyZoom(root); return; }
|
|
436
483
|
if ('pcPlay' in d) { const sc = ((V.v.data || {}).flow || {}).scenarios || []; startPlay(sc.length ? sc[0].id : '', 0, true); return; }
|
|
437
484
|
if (d.pcFrom) { fire('pmos:from', { ini: V.c.ini, n: Number(d.pcFrom) }); say('The next change you send continues from version ' + d.pcFrom + '.'); return; }
|
|
485
|
+
if (d.pcNote) { toFrame({ t: 'hint', els: [d.pcNote] }); return; }
|
|
438
486
|
if (d.pcScreen) { V.screen = d.pcScreen; toFrame({ t: 'screen', id: d.pcScreen }); V.sig = ''; draw(V.body, V.c); return; }
|
|
439
487
|
if (d.pcScen) { startPlay(d.pcScen, 0, true); return; }
|
|
440
488
|
if ('pcStop' in d) { pmPost('/api/lab/stop', { ws: (V.at || {}).ws, run: d.pcStop }).then((r) => { if (!r || !r.ok) say((r && r.error) || 'It did not stop.'); }).catch(() => say('It did not stop.')); return; }
|