create-pmos 0.605.0 → 0.606.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 +14 -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/changelog.json +13 -0
- package/workspace/guide/agent-capabilities.md +3 -3
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-proto.css +23 -14
- package/workspace/public/pm/cozy-proto.js +106 -88
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.606.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,19 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.606.0",
|
|
38
|
+
"at": "2026-11-18T11:27:58.320Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1348,
|
|
43
|
+
"t": "Readable flow and who does what panels, copy panel width, tweaks in the inspector",
|
|
44
|
+
"s": "Readable flow and who does what panels, copy panel width, tweaks in the inspector",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
36
49
|
{
|
|
37
50
|
"v": "0.605.0",
|
|
38
51
|
"at": "2026-11-18T10:51:31.052Z",
|
|
@@ -303,19 +316,6 @@
|
|
|
303
316
|
"k": "fix"
|
|
304
317
|
}
|
|
305
318
|
]
|
|
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:27:55Z"}
|
|
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:27:55Z"}
|
|
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:27:55Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.606.0",
|
|
4
|
+
"at": "2026-11-18T11:27:58.320Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1348,
|
|
9
|
+
"t": "Readable flow and who does what panels, copy panel width, tweaks in the inspector",
|
|
10
|
+
"s": "Readable flow and who does what panels, copy panel width, tweaks in the inspector",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
2
15
|
{
|
|
3
16
|
"v": "0.605.0",
|
|
4
17
|
"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
|
|
@@ -198,10 +198,10 @@ You can ask to see an idea at any moment: alone while you work on an initiative,
|
|
|
198
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:
|
|
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.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.606.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.606.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -93,10 +93,10 @@
|
|
|
93
93
|
.pc-sel { margin: 0; display: flex; align-items: center; gap: 6px; font-size: var(--fs-meta); color: var(--cz-ink2); max-width: 300px; }
|
|
94
94
|
.pc-sel b { color: var(--cz-blueink); font-weight: var(--fw-strong); white-space: nowrap; }
|
|
95
95
|
.pc-sel .pc-ib { width: 26px; height: 26px; margin-left: auto; }
|
|
96
|
-
|
|
97
|
-
.pc-
|
|
98
|
-
.pc-
|
|
99
|
-
.pc-
|
|
96
|
+
/* the run's tweaks, in the inspector (Page, or This layer) */
|
|
97
|
+
.pc-rng { display: grid; grid-template-columns: 1fr 44px; align-items: center; gap: 6px; }
|
|
98
|
+
.pc-ir .pc-rng input { height: auto; padding: 0; border: 0; accent-color: var(--cz-blueink); }
|
|
99
|
+
.pc-rng em { font-style: normal; text-align: right; color: var(--cz-ink3); }
|
|
100
100
|
.pc-cdraft { display: flex; flex-direction: column; gap: 6px; max-width: 300px; }
|
|
101
101
|
.pc-cdraft label { font-size: var(--fs-meta); color: var(--cz-ink2); }
|
|
102
102
|
.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 +111,45 @@
|
|
|
111
111
|
.pc-star { color: var(--cz-blueink); font-weight: var(--fw-strong); }
|
|
112
112
|
|
|
113
113
|
/* the flow and the swimlane (SVG) */
|
|
114
|
-
|
|
115
|
-
.pc-
|
|
116
|
-
.pc-flow
|
|
114
|
+
/* drawn at their real size, top to bottom; a big one scrolls inside the panel, never shrinks (Wawan 2026-11-18) */
|
|
115
|
+
.pc-svgw { overflow: auto; min-height: 0; flex: 0 1 auto; overscroll-behavior: contain; }
|
|
116
|
+
.pc-flow, .pc-lanes { display: block; max-width: none; color: var(--cz-ink3); font-family: var(--cz-sans); }
|
|
117
|
+
.pc-flow text, .pc-lanes text { font-size: 13px; fill: var(--cz-ink); }
|
|
117
118
|
.pc-sn { cursor: pointer; }
|
|
118
119
|
.pc-sn rect { fill: var(--cz-card); stroke: var(--cz-hair); stroke-width: 1.2; }
|
|
119
120
|
.pc-sn.br rect { stroke: var(--cz-ok); stroke-dasharray: 4 3; }
|
|
120
121
|
.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:
|
|
122
|
+
.pc-sn .k { font-size: 10px; font-weight: var(--fw-strong); letter-spacing: .06em; fill: var(--cz-ink3); }
|
|
122
123
|
.pc-dn path { fill: var(--cz-bluebg); stroke: var(--cz-blueink); stroke-width: 1.2; }
|
|
123
|
-
.pc-dn text { font-size:
|
|
124
|
+
.pc-dn text { font-size: 12px; }
|
|
124
125
|
.pc-e path { fill: none; stroke: currentColor; stroke-width: 1.3; }
|
|
125
126
|
.pc-e.br path { stroke-dasharray: 4 3; }
|
|
126
127
|
.pc-e .hit { stroke: transparent; stroke-width: 12; stroke-dasharray: none; cursor: pointer; }
|
|
127
128
|
.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:
|
|
129
|
+
.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
130
|
.pc-ln rect { fill: var(--cz-card); }
|
|
130
131
|
.pc-ln.alt rect { fill: var(--cz-well); }
|
|
131
|
-
.pc-
|
|
132
|
+
.pc-lhd { position: sticky; top: 0; z-index: 1; display: flex; }
|
|
133
|
+
.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); }
|
|
134
|
+
.pc-lhd b.alt { background: var(--cz-well); }
|
|
135
|
+
.pc-ln text { font-weight: var(--fw-strong); font-size: 12px; fill: var(--cz-ink2); }
|
|
132
136
|
.pc-ar { fill: none; stroke: currentColor; stroke-width: 1.3; }
|
|
133
137
|
.pc-bx rect { fill: var(--cz-bluebg); stroke: transparent; }
|
|
134
138
|
.pc-bx[data-pc-screen] { cursor: pointer; }
|
|
135
139
|
.pc-bx[data-pc-screen]:hover rect, .pc-bx:focus-visible rect { stroke: var(--cz-blue); stroke-width: 1.5; }
|
|
136
140
|
.pc-bx.ch rect { stroke: var(--cz-ok); stroke-width: 1.5; stroke-dasharray: 4 3; }
|
|
137
141
|
.pc-bx circle { fill: var(--cz-blueink); }
|
|
138
|
-
.pc-bx .n { fill: var(--cz-onsolid); font-size:
|
|
142
|
+
.pc-bx .n { fill: var(--cz-onsolid); font-size: 11px; font-weight: var(--fw-strong); }
|
|
139
143
|
.pc-scens { display: flex; flex-wrap: wrap; gap: 6px; }
|
|
140
144
|
.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
145
|
.pc-chip[aria-pressed="true"] { background: var(--cz-bluebg); color: var(--cz-blueink); border-color: transparent; }
|
|
142
146
|
|
|
143
147
|
/* the page copy: a side panel over the canvas, behind the toolbar's Page copy press (closed by default) */
|
|
144
|
-
.pc-
|
|
148
|
+
.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) */
|
|
149
|
+
.pc-side { box-sizing: border-box; width: 420px; max-width: 46vw; padding: 14px; gap: 8px; }
|
|
150
|
+
.pc-side.wide { width: 760px; max-width: 62vw; }
|
|
151
|
+
.pc-side > h3 { flex: none; }
|
|
152
|
+
.pc-side > .pc-copy { flex: none; }
|
|
145
153
|
.pc-side h3 { display: flex; align-items: center; gap: 8px; }
|
|
146
154
|
.pc-side h3 .pc-ib { margin-left: auto; width: 28px; height: 28px; }
|
|
147
155
|
.pc .pc-ib.upd { position: relative; }
|
|
@@ -190,7 +198,8 @@
|
|
|
190
198
|
|
|
191
199
|
@media (max-width: 760px) {
|
|
192
200
|
.pc-dbody { flex-direction: column; }
|
|
193
|
-
.pc-
|
|
201
|
+
.pc-rightw { display: block; }
|
|
202
|
+
.pc-left, .pc-insp, .pc-side, .pc-side.wide { width: 100%; max-width: none; max-height: none; }
|
|
194
203
|
.pc-pmain { flex-direction: column; }
|
|
195
204
|
.pc-pflow { width: 100%; }
|
|
196
205
|
.pc .pc-ib { width: 44px; height: 44px; }
|
|
@@ -10,7 +10,7 @@
|
|
|
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 in a phone or desktop frame (
|
|
13
|
+
* The cards, which update together: the prototype in a phone or desktop frame (the comments,
|
|
14
14
|
* the ✦ test-link suggestion); the flow (screens as cards, decisions as diamonds, drawn as SVG from flow.json: a screen shows that moment
|
|
15
15
|
* 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
16
|
* 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 +37,7 @@ const I = {
|
|
|
37
37
|
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
38
|
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
39
|
text: 'M4 7V5h16v2M12 5v14M9 19h6', flow: 'M3 4h6v5H3zM15 4h6v5h-6zM9 15h6v5H9zM9 6.5h6M18 9v3h-6v3', lanes: 'M3 6h18M3 12h18M3 18h18M6 4h4v4H6zM13 10h4v4h-4z',
|
|
40
|
+
wide: 'M15 4h5v5M9 20H4v-5M20 4l-6 6M4 20l6-6', narrow: 'M14 10h5M14 10V5M10 14H5M10 14v5M14 10l6-6M10 14l-6 6',
|
|
40
41
|
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
42
|
trash: 'M5 7h14M10 11v6M14 11v6M7 7l1 13h8l1-13M9 7V4h6v3',
|
|
42
43
|
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 +45,12 @@ const I = {
|
|
|
44
45
|
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
46
|
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
47
|
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 =
|
|
48
|
+
/** A label in up to m lines (two by default) of about n characters each (the last one cut with …), as SVG tspans. */
|
|
49
|
+
function lines(text, x, y, n, dy = 14, m = 2) {
|
|
50
|
+
const w = String(text || '').split(/\s+/), out = Array(m).fill('');
|
|
50
51
|
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) + '…';
|
|
52
|
+
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; }
|
|
53
|
+
for (let k = 0; k < m; k += 1) if (out[k].length > n) out[k] = out[k].slice(0, n - 1).trimEnd() + '…';
|
|
54
54
|
return out.filter(Boolean).map((t, k) => `<tspan x="${x}" y="${y + k * dy}">${esc(t)}</tspan>`).join('');
|
|
55
55
|
}
|
|
56
56
|
const fire = (name, detail) => { try { window.dispatchEvent(new CustomEvent(name, { detail })); } catch { /* old browser */ } };
|
|
@@ -61,92 +61,99 @@ if (typeof document !== 'undefined' && typeof document.createElement === 'functi
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/* ── layout (PURE) ── */
|
|
64
|
-
|
|
64
|
+
/* 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
|
|
65
|
+
* (Wawan 2026-11-18: "who does what so tiny user can't even read it", "the flow too small and still have overlap component"). */
|
|
66
|
+
const SW = 156, SH = 56, DH = 76, GX = 28, PAD = 16, TR = 20, GT = 18, GB = 12, GY = 30, CHX = 14;
|
|
65
67
|
/** 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(
|
|
68
|
+
const diaW = (t) => Math.max(140, Math.min(220, Math.ceil(String(t || '').length / 2) * 7 / 0.55 + 16));
|
|
69
|
+
/** Where a line leaves (bottom) or enters (top) a box at x: on the edge of the shape, a diamond's slanted side included. */
|
|
70
|
+
const portY = (n, x, bottom) => {
|
|
71
|
+
if (n.kind !== 'decision') return bottom ? n.y + n.h : n.y;
|
|
72
|
+
const k = Math.abs(x - (n.x + n.w / 2)) / (n.w / 2), half = (n.h / 2) * (1 - k);
|
|
73
|
+
return n.y + n.h / 2 + (bottom ? half : -half);
|
|
74
|
+
};
|
|
67
75
|
/** 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
|
-
*
|
|
76
|
+
* 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
|
|
77
|
+
* 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
|
|
78
|
+
* 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
|
|
79
|
+
* labels never sit on each other (Wawan 2026-11-18: "still have overlap component"). */
|
|
71
80
|
export function flowLayout(flow) {
|
|
72
81
|
const f = flow || {}, nodes = [...(f.screens || []).map((s) => ({ ...s, kind: 'screen' })), ...(f.decisions || []).map((d) => ({ ...d, kind: 'decision' }))];
|
|
73
82
|
if (!nodes.length) return { w: 0, h: 0, nodes: [], edges: [] };
|
|
74
83
|
const by = new Map(nodes.map((n) => [n.id, n])), out = new Map(nodes.map((n) => [n.id, []]));
|
|
75
84
|
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
|
|
85
|
+
// 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
|
|
86
|
+
// 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
|
|
87
|
+
const seen = [], state = new Map(), backE = new Set();
|
|
88
|
+
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); };
|
|
89
|
+
walk(nodes[0].id);
|
|
90
|
+
for (const n of nodes) if (!state.has(n.id)) walk(n.id);
|
|
91
|
+
const lay = new Map(seen.map((id) => [id, 0])), indeg = new Map(seen.map((id) => [id, 0]));
|
|
92
|
+
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);
|
|
93
|
+
const topo = seen.filter((id) => !indeg.get(id));
|
|
94
|
+
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
95
|
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
96
|
const onMain = new Set();
|
|
83
97
|
if (steps.size) {
|
|
84
98
|
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;
|
|
99
|
+
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
100
|
}
|
|
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
|
|
101
|
+
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); }
|
|
102
|
+
const nl = Math.max(...nodes.map((n) => n.l)) + 1, layers = [];
|
|
103
|
+
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));
|
|
104
|
+
const lw = layers.map((L) => L.reduce((s, n) => s + n.w, 0) + GX * Math.max(0, L.length - 1)), maxW = Math.max(...lw);
|
|
105
|
+
// the lines: one layer down goes straight across the gap between; anything else takes a channel at the side
|
|
101
106
|
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
|
-
|
|
107
|
+
for (const x of raw) x.kind = x.b.l === x.a.l + 1 ? 'down' : x.b.l > x.a.l ? 'left' : 'right';
|
|
108
|
+
const left = raw.filter((x) => x.kind === 'left'), right = raw.filter((x) => x.kind === 'right');
|
|
109
|
+
const x0 = PAD + (left.length ? left.length * CHX + 10 : 0);
|
|
110
|
+
layers.forEach((L, k) => { let x = x0 + (maxW - lw[k]) / 2; for (const n of L) { n.x = x; x += n.w + GX; } });
|
|
111
|
+
const cxOf = (n) => n.x + n.w / 2;
|
|
112
|
+
left.forEach((x, i) => { x.cx = x0 - 10 - i * CHX; });
|
|
113
|
+
right.forEach((x, i) => { x.cx = x0 + maxW + 10 + i * CHX; });
|
|
114
|
+
// ports: the lines leaving (or entering) one box spread along its edge in the order of where they go (or come from)
|
|
115
|
+
const toward = (x, from) => (x.kind === 'left' ? -1e6 : x.kind === 'right' ? 1e6 + x.cx : cxOf(from ? x.a : x.b));
|
|
116
|
+
for (const n of nodes) {
|
|
117
|
+
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); }); };
|
|
118
|
+
spread(raw.filter((x) => x.a === n).map((x) => Object.assign(x, { o: toward(x, false) })), 'x1');
|
|
119
|
+
spread(raw.filter((x) => x.b === n).map((x) => Object.assign(x, { o: toward(x, true) })), 'x2');
|
|
120
|
+
}
|
|
121
|
+
// 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
|
|
122
|
+
const gaps = Array.from({ length: nl + 1 }, () => []);
|
|
123
|
+
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); } }
|
|
124
|
+
const gh = gaps.map((g, k) => (g.length ? GT + (g.length - 1) * TR + GB : k === 0 || k === nl ? 0 : GY));
|
|
125
|
+
const lh = layers.map((L) => Math.max(...L.map((n) => n.h)));
|
|
126
|
+
let y = PAD; const gy = [];
|
|
127
|
+
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]; } }
|
|
128
|
+
const track = (x, g) => gy[g] + GT + gaps[g].indexOf(x) * TR;
|
|
129
|
+
const edges = raw.map((x) => {
|
|
130
|
+
const { e, a, b } = x, y1 = portY(a, x.x1, true), y2 = portY(b, x.x2, false), t1 = track(x, x.g1);
|
|
131
|
+
let d;
|
|
132
|
+
if (x.kind === 'down') d = `M${x.x1} ${y1}V${t1}H${x.x2}V${y2 - 2}`;
|
|
133
|
+
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}`; }
|
|
134
|
+
// the label sits on the line's first track, beside where it leaves the box, toward where it goes
|
|
135
|
+
const nx = x.kind === 'down' ? x.x2 : x.cx, dir = nx < x.x1 - 1 ? -1 : 1;
|
|
136
|
+
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
137
|
});
|
|
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) /
|
|
138
|
+
const w = (right.length ? x0 + maxW + 10 + right.length * CHX : x0 + maxW) + PAD;
|
|
139
|
+
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
140
|
}
|
|
135
|
-
const
|
|
136
|
-
/** PURE. lanes → { w, h, lanes: [{ id, name,
|
|
137
|
-
* the order of n; an arrow from each step to the next.
|
|
141
|
+
const LCW = 132, BW = 116, BH = 58, LHH = 0, BG = 22;
|
|
142
|
+
/** PURE. lanes → { w, h, bw, bh, lanes: [{ id, name, x }], boxes: [{ n, title, screen, x, y, lane }], arrows: [{ d }] }: one COLUMN per lane
|
|
143
|
+
* (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
|
|
144
|
+
* panel at the normal text size; more lanes scroll sideways. */
|
|
138
145
|
export function lanesLayout(lanes) {
|
|
139
146
|
const L = (lanes && lanes.lanes) || [];
|
|
140
147
|
const steps = [];
|
|
141
148
|
L.forEach((l, i) => { for (const s of l.steps || []) steps.push({ ...s, lane: i }); });
|
|
142
149
|
steps.sort((a, b) => a.n - b.n);
|
|
143
|
-
const boxes = steps.map((s,
|
|
150
|
+
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
151
|
const arrows = [];
|
|
145
152
|
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}
|
|
153
|
+
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;
|
|
154
|
+
arrows.push({ d: a.lane === b.lane ? `M${x1} ${y1}V${y2 - 2}` : `M${x1} ${y1}V${my}H${x2}V${y2 - 2}` });
|
|
148
155
|
}
|
|
149
|
-
return { w:
|
|
156
|
+
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
157
|
}
|
|
151
158
|
|
|
152
159
|
/* ── state ── */
|
|
@@ -155,7 +162,7 @@ export function lanesLayout(lanes) {
|
|
|
155
162
|
* presses, closed by default; one shows at a time, in the inspector's place. The device switch is only for Play. */
|
|
156
163
|
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,
|
|
157
164
|
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 };
|
|
165
|
+
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
166
|
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
167
|
const frameUrl = (c) => (c && c.url ? c.url + '&rt=1' : '');
|
|
161
168
|
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 +221,6 @@ function progressHtml(c) {
|
|
|
214
221
|
}
|
|
215
222
|
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
223
|
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
224
|
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
225
|
const cm = (c.comments || []).filter((x) => !x.send);
|
|
221
226
|
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 +228,7 @@ function protoCard(c, v, making) {
|
|
|
223
228
|
const sug = suggestion(c);
|
|
224
229
|
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
230
|
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 +
|
|
231
|
+
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 };
|
|
227
232
|
}
|
|
228
233
|
function suggestion(c) {
|
|
229
234
|
// the design sprint runs silently: PMOS recommends good practice as ONE ✦ (canvas PbcChat), here: test it with people once it settles
|
|
@@ -232,19 +237,21 @@ function suggestion(c) {
|
|
|
232
237
|
if (N < 3 || c.working || store.get(key)) return '';
|
|
233
238
|
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
239
|
}
|
|
240
|
+
/** 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. */
|
|
241
|
+
const wideIb = () => ib('data-pc-wide', V.wide ? 'Narrower panel' : 'Wider panel', V.wide ? I.narrow : I.wide);
|
|
235
242
|
function flowCard(c, v) {
|
|
236
243
|
if (V.side !== 'flow') return '';
|
|
237
|
-
const close = ib('data-pc-side="flow"', 'Close the flow', I.x);
|
|
244
|
+
const close = wideIb() + ib('data-pc-side="flow"', 'Close the flow', I.x);
|
|
238
245
|
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>`;
|
|
246
|
+
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
247
|
const L = flowLayout(f), scen = f.scenarios || [];
|
|
241
248
|
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
249
|
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 +
|
|
250
|
+
? `<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>`
|
|
251
|
+
: `<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
252
|
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
253
|
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="
|
|
254
|
+
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
255
|
+ `<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
256
|
}
|
|
250
257
|
function copyCard(c, v) {
|
|
@@ -258,14 +265,15 @@ function copyCard(c, v) {
|
|
|
258
265
|
}
|
|
259
266
|
function lanesCard(c, v) {
|
|
260
267
|
if (V.side !== 'lanes') return '';
|
|
261
|
-
const close = ib('data-pc-side="lanes"', 'Close who does what', I.x);
|
|
268
|
+
const close = wideIb() + ib('data-pc-side="lanes"', 'Close who does what', I.x);
|
|
262
269
|
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>`;
|
|
270
|
+
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
271
|
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
|
|
272
|
+
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('');
|
|
273
|
+
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>`;
|
|
274
|
+
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
275
|
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"
|
|
276
|
+
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
277
|
}
|
|
270
278
|
|
|
271
279
|
|
|
@@ -298,10 +306,18 @@ export function styleWords(ps) {
|
|
|
298
306
|
const W = Object.fromEntries(WEIGHTS);
|
|
299
307
|
return Object.entries(ps || {}).map(([k, v]) => (k === 'weight' ? W[v] || v : k === 'size' || k === 'color' ? v : k + ' ' + v)).join(' · ');
|
|
300
308
|
}
|
|
301
|
-
|
|
309
|
+
/** 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.
|
|
310
|
+
* They sit in the inspector, not under the prototype (Wawan 2026-11-18: the Spacing slider under the canvas, "remove this things"). */
|
|
311
|
+
function tweakRows(v) {
|
|
312
|
+
const tw = (((v && v.data) || {}).tweaks || {}).tweaks || [], el = V.sel ? V.sel.el : '';
|
|
313
|
+
const mine = tw.filter((t) => (el ? t.el === el : !t.el));
|
|
314
|
+
if (!mine.length) return '';
|
|
315
|
+
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>`;
|
|
316
|
+
}
|
|
317
|
+
function inspHtml(v) {
|
|
302
318
|
if (V.side || !V.insp) return '';
|
|
303
319
|
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
|
|
320
|
+
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
321
|
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
322
|
const num = (v) => String(parseFloat(v) || 0), colr = (v) => (/^#[0-9a-f]{6}$/i.test(v) ? v : lk.fillPick || '');
|
|
307
323
|
const id = (k) => 'pcS-' + k;
|
|
@@ -321,10 +337,11 @@ function inspHtml() {
|
|
|
321
337
|
+ `${fld('corner', 'Corner', nIn('corner', 'px', '1', '0', '200'))}`
|
|
322
338
|
+ `<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
339
|
+ `${fld('align', 'Align', sel('align', [['left', 'Left'], ['center', 'Centre'], ['right', 'Right']], val('align', 'left')))}</div>`
|
|
340
|
+
+ tweakRows(v)
|
|
324
341
|
+ `<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
342
|
+ '</aside>';
|
|
326
343
|
}
|
|
327
|
-
function rightHtml(c, v) { return copyCard(c, v) + flowCard(c, v) + lanesCard(c, v) + inspHtml(); }
|
|
344
|
+
function rightHtml(c, v) { return copyCard(c, v) + flowCard(c, v) + lanesCard(c, v) + inspHtml(v); }
|
|
328
345
|
|
|
329
346
|
/* ── draw ── */
|
|
330
347
|
/** Draw or update the canvas. body: the Viewer's body; c: GET /api/lab/compare's compare (live); o: { at, H } */
|
|
@@ -340,7 +357,7 @@ export function draw(body, c, o = {}) {
|
|
|
340
357
|
if (!root) { body.innerHTML = '<div class="pc"></div>'; root = body.querySelector('.pc'); wire(root); }
|
|
341
358
|
V.body = body;
|
|
342
359
|
// 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]);
|
|
360
|
+
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
361
|
const focus = document.activeElement && root.contains(document.activeElement) && document.activeElement.matches('[data-pc-copy],textarea,input,select');
|
|
345
362
|
if (sig === V.sig && root.firstChild) return;
|
|
346
363
|
if (focus && prevFile === v.file) return; // the PM is typing in this version: draw on a later read
|
|
@@ -423,6 +440,7 @@ function wire(root) {
|
|
|
423
440
|
const d = b.dataset;
|
|
424
441
|
if (d.pcMode) { setMode(V.mode === d.pcMode ? 'view' : d.pcMode); return; }
|
|
425
442
|
if (d.pcSide) { V.side = V.side === d.pcSide ? null : d.pcSide; V.sig = ''; draw(V.body, V.c); return; }
|
|
443
|
+
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
444
|
if ('pcLeft' in d) { panel('left'); return; }
|
|
427
445
|
if ('pcInsp' in d) { panel('insp'); return; }
|
|
428
446
|
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; }
|