@warlock.js/grimoire 5.57.0 → 5.59.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/CHANGELOG.md +44 -0
- package/esm/apps/check-apps.mjs +11 -5
- package/esm/apps/check-apps.mjs.map +1 -1
- package/esm/book/build.d.mts.map +1 -1
- package/esm/book/build.mjs +2 -1
- package/esm/book/build.mjs.map +1 -1
- package/esm/book/render.mjs +10 -0
- package/esm/book/render.mjs.map +1 -1
- package/esm/bookmap/build.d.mts.map +1 -1
- package/esm/bookmap/build.mjs +7 -5
- package/esm/bookmap/build.mjs.map +1 -1
- package/esm/bookmap/steps.mjs +85 -39
- package/esm/bookmap/steps.mjs.map +1 -1
- package/esm/check/check-grimoire.d.mts.map +1 -1
- package/esm/check/check-grimoire.mjs +4 -1
- package/esm/check/check-grimoire.mjs.map +1 -1
- package/esm/check/rules/criteria.mjs +21 -2
- package/esm/check/rules/criteria.mjs.map +1 -1
- package/esm/check/rules/screenshots.mjs +57 -0
- package/esm/check/rules/screenshots.mjs.map +1 -0
- package/esm/codes/codes.d.mts +12 -0
- package/esm/codes/codes.d.mts.map +1 -1
- package/esm/codes/codes.mjs +6 -0
- package/esm/codes/codes.mjs.map +1 -1
- package/esm/contracts/adapter.d.mts +28 -1
- package/esm/contracts/adapter.d.mts.map +1 -1
- package/esm/contracts/book.d.mts +2 -0
- package/esm/contracts/book.d.mts.map +1 -1
- package/esm/contracts/book.mjs.map +1 -1
- package/esm/contracts/bookmap.d.mts +19 -1
- package/esm/contracts/bookmap.d.mts.map +1 -1
- package/esm/contracts/scry.d.mts +26 -6
- package/esm/contracts/scry.d.mts.map +1 -1
- package/esm/contracts/snapshot.d.mts +14 -1
- package/esm/contracts/snapshot.d.mts.map +1 -1
- package/esm/contracts/test-results.d.mts +34 -0
- package/esm/contracts/test-results.d.mts.map +1 -1
- package/esm/contracts/written.d.mts +44 -0
- package/esm/contracts/written.d.mts.map +1 -1
- package/esm/contracts/written.mjs.map +1 -1
- package/esm/devtools/data.mjs +116 -5
- package/esm/devtools/data.mjs.map +1 -1
- package/esm/devtools/feature-map.mjs +149 -0
- package/esm/devtools/feature-map.mjs.map +1 -0
- package/esm/devtools/index.d.mts +28 -2
- package/esm/devtools/index.d.mts.map +1 -1
- package/esm/devtools/index.mjs +111 -7
- package/esm/devtools/index.mjs.map +1 -1
- package/esm/devtools/product-map.d.mts +14 -0
- package/esm/devtools/product-map.d.mts.map +1 -0
- package/esm/devtools/product-map.mjs +460 -0
- package/esm/devtools/product-map.mjs.map +1 -0
- package/esm/devtools/site.d.mts +43 -1
- package/esm/devtools/site.d.mts.map +1 -1
- package/esm/devtools/site.mjs +190 -22
- package/esm/devtools/site.mjs.map +1 -1
- package/esm/devtools/snapshot-source.mjs +24 -7
- package/esm/devtools/snapshot-source.mjs.map +1 -1
- package/esm/graph/index.d.mts +10 -1
- package/esm/graph/index.d.mts.map +1 -1
- package/esm/graph/index.mjs +3 -2
- package/esm/graph/index.mjs.map +1 -1
- package/esm/index.d.mts +5 -5
- package/esm/ownership/index.d.mts.map +1 -1
- package/esm/ownership/index.mjs +60 -1
- package/esm/ownership/index.mjs.map +1 -1
- package/esm/paths/index.d.mts +2 -0
- package/esm/paths/index.d.mts.map +1 -1
- package/esm/paths/index.mjs +3 -1
- package/esm/paths/index.mjs.map +1 -1
- package/esm/scry/compact.mjs +170 -0
- package/esm/scry/compact.mjs.map +1 -0
- package/esm/scry/format.d.mts.map +1 -1
- package/esm/scry/format.mjs +19 -2
- package/esm/scry/format.mjs.map +1 -1
- package/esm/scry/query.d.mts.map +1 -1
- package/esm/scry/query.mjs +159 -24
- package/esm/scry/query.mjs.map +1 -1
- package/esm/test-results/index.d.mts +7 -2
- package/esm/test-results/index.d.mts.map +1 -1
- package/esm/test-results/index.mjs +79 -12
- package/esm/test-results/index.mjs.map +1 -1
- package/esm/vitest/index.d.mts +6 -0
- package/esm/vitest/index.d.mts.map +1 -1
- package/esm/vitest/index.mjs +22 -6
- package/esm/vitest/index.mjs.map +1 -1
- package/esm/warlock/actions.mjs +15 -7
- package/esm/warlock/actions.mjs.map +1 -1
- package/esm/warlock/adapter.d.mts.map +1 -1
- package/esm/warlock/adapter.mjs +42 -4
- package/esm/warlock/adapter.mjs.map +1 -1
- package/esm/warlock/commands.mjs +7 -2
- package/esm/warlock/commands.mjs.map +1 -1
- package/esm/warlock/logo.mjs +12 -0
- package/esm/warlock/logo.mjs.map +1 -0
- package/esm/warlock/mcp-tools.mjs +51 -15
- package/esm/warlock/mcp-tools.mjs.map +1 -1
- package/esm/workspace/cache.mjs +194 -0
- package/esm/workspace/cache.mjs.map +1 -0
- package/esm/workspace/index.d.mts.map +1 -1
- package/esm/workspace/index.mjs +7 -3
- package/esm/workspace/index.mjs.map +1 -1
- package/esm/written/apps.mjs +4 -2
- package/esm/written/apps.mjs.map +1 -1
- package/esm/written/features.mjs +119 -6
- package/esm/written/features.mjs.map +1 -1
- package/esm/written/markdown.mjs +66 -1
- package/esm/written/markdown.mjs.map +1 -1
- package/esm/written/parse-grimoire.d.mts.map +1 -1
- package/esm/written/parse-grimoire.mjs +1 -1
- package/esm/written/parse-grimoire.mjs.map +1 -1
- package/llms-full.txt +108 -12
- package/package.json +3 -3
- package/skills/backfill-a-grimoire/SKILL.md +5 -0
- package/skills/describe-an-app/SKILL.md +12 -0
- package/skills/record-a-change/SKILL.md +10 -0
- package/skills/use-the-grimoire/SKILL.md +44 -10
- package/skills/write-a-feature/SKILL.md +37 -2
- package/ui/grimoire-static.js +61 -6
- package/ui/grimoire-view.js +2133 -316
- package/ui/grimoire.css +1030 -24
- package/ui/product-map.css +785 -0
- package/ui/product-map.js +1265 -0
|
@@ -0,0 +1,1265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The product map: the Grimoire for readers who do not read code. A browser
|
|
3
|
+
* ES module with two entry points:
|
|
4
|
+
*
|
|
5
|
+
* - `productMapView(ctx, parts)`: the "Product map" section inside the Grimoire
|
|
6
|
+
* tab. `parts` are the hash route segments after `product` (`[]`,
|
|
7
|
+
* `["feature", id]`, `["flow", feature, flow]`). Returns an element.
|
|
8
|
+
* - the default export `renderProductMap(context)`: the page a read-only
|
|
9
|
+
* share link opens (`context.shared === true`), with the same context
|
|
10
|
+
* helpers as a panel view.
|
|
11
|
+
*
|
|
12
|
+
* It builds the DOM with the context's `el()` helper and sets every string
|
|
13
|
+
* from the data as text, never as HTML. Every top-level name starts with
|
|
14
|
+
* `product` or `PRODUCT` because the static export inlines this file next to
|
|
15
|
+
* the Grimoire view.
|
|
16
|
+
*
|
|
17
|
+
* Keep the last line as it is: the static export swaps it out to inline this file.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
const PRODUCT_STATUS = {
|
|
21
|
+
proposed: "Planned",
|
|
22
|
+
building: "Being built",
|
|
23
|
+
shipped: "Live",
|
|
24
|
+
retired: "Retired",
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const PRODUCT_LIGHT = {
|
|
28
|
+
good: { label: "Working well", glyph: "✓" },
|
|
29
|
+
attention: { label: "Needs attention", glyph: "!" },
|
|
30
|
+
problem: { label: "Has problems", glyph: "✕" },
|
|
31
|
+
unknown: { label: "Not checked yet", glyph: "?" },
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const PRODUCT_PROOF = {
|
|
35
|
+
pass: { level: "good", label: "Passing" },
|
|
36
|
+
fail: { level: "problem", label: "Failing" },
|
|
37
|
+
stale: { level: "attention", label: "Needs a new check (the tests changed)" },
|
|
38
|
+
"not-run": { level: "attention", label: "Not checked yet" },
|
|
39
|
+
"no-test": { level: "attention", label: "No test yet" },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const PRODUCT_CHANGE = { added: "Added", changed: "Changed", fixed: "Fixed", removed: "Removed" };
|
|
43
|
+
|
|
44
|
+
const PRODUCT_DEVELOPER_KEY = "grimoire-product-developer";
|
|
45
|
+
|
|
46
|
+
/** The helpers of one render: the context's `el()` made tolerant of nested and empty children. */
|
|
47
|
+
function productKit(ctx) {
|
|
48
|
+
const flat = (children) =>
|
|
49
|
+
Array.isArray(children)
|
|
50
|
+
? children
|
|
51
|
+
.flat(Infinity)
|
|
52
|
+
.filter((child) => child !== null && child !== undefined && child !== false)
|
|
53
|
+
: children;
|
|
54
|
+
const el = (tag, attrs = {}, children = []) => ctx.el(tag, attrs, flat(children));
|
|
55
|
+
const shared = ctx.shared === true;
|
|
56
|
+
const link = (to, text, attrs = {}) =>
|
|
57
|
+
el("a", {
|
|
58
|
+
...attrs,
|
|
59
|
+
// The host's href keeps a link inside its page (`#share/<route>` behind a share link), so it survives a reload or a new tab.
|
|
60
|
+
href: typeof ctx.href === "function" ? ctx.href(to) : `#${to}`,
|
|
61
|
+
text,
|
|
62
|
+
onclick: (event) => {
|
|
63
|
+
if (event && (event.metaKey || event.ctrlKey || event.shiftKey || event.button > 0)) return;
|
|
64
|
+
event?.preventDefault?.();
|
|
65
|
+
ctx.navigate(to);
|
|
66
|
+
},
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
return { el, shared, link };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function productPlural(count, one, many = `${one}s`) {
|
|
73
|
+
return `${count} ${count === 1 ? one : many}`;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function productDecode(text) {
|
|
77
|
+
try {
|
|
78
|
+
return decodeURIComponent(text);
|
|
79
|
+
} catch {
|
|
80
|
+
return text;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function productEncode(text) {
|
|
85
|
+
return encodeURIComponent(text);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function productDate(value) {
|
|
89
|
+
if (!value) return null;
|
|
90
|
+
const date = new Date(value);
|
|
91
|
+
|
|
92
|
+
if (Number.isNaN(date.getTime())) return String(value);
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
return date.toLocaleDateString(undefined, { year: "numeric", month: "short", day: "numeric" });
|
|
96
|
+
} catch {
|
|
97
|
+
return String(value);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function productStatusChip(kit, status) {
|
|
102
|
+
return kit.el("span", {
|
|
103
|
+
class: `pm-chip pm-status pm-status--${status}`,
|
|
104
|
+
text: PRODUCT_STATUS[status] ?? status,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** A traffic light: a shape and words as well as a colour. */
|
|
109
|
+
function productLight(kit, level, label) {
|
|
110
|
+
const light = PRODUCT_LIGHT[level] ?? PRODUCT_LIGHT.unknown;
|
|
111
|
+
|
|
112
|
+
return kit.el(
|
|
113
|
+
"span",
|
|
114
|
+
{ class: `pm-light pm-light--${PRODUCT_LIGHT[level] ? level : "unknown"}` },
|
|
115
|
+
[
|
|
116
|
+
kit.el("span", { class: "pm-light-glyph", "aria-hidden": "true", text: light.glyph }),
|
|
117
|
+
kit.el("span", { text: label ?? light.label }),
|
|
118
|
+
],
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function productHealth(kit, health) {
|
|
123
|
+
return kit.el("div", { class: "pm-health" }, [
|
|
124
|
+
productLight(kit, health.level),
|
|
125
|
+
kit.el("span", { class: "pm-health-reason", text: health.reason }),
|
|
126
|
+
]);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The health strip of a feature card: four thin segments (flows written,
|
|
131
|
+
* criteria proven by tests, screenshots present, open findings) and a legend
|
|
132
|
+
* that says each number in words. Criteria with no recorded results are grey and
|
|
133
|
+
* read "not measured": that is a missing measurement, not a problem.
|
|
134
|
+
*/
|
|
135
|
+
function productStrip(kit, strip) {
|
|
136
|
+
if (!strip) return null;
|
|
137
|
+
|
|
138
|
+
const share = (part, whole) =>
|
|
139
|
+
whole > 0 ? Math.max(0, Math.min(100, Math.round((part / whole) * 100))) : 0;
|
|
140
|
+
const findings = strip.findings.errors + strip.findings.warnings;
|
|
141
|
+
const criteria = strip.criteria;
|
|
142
|
+
const parts = [
|
|
143
|
+
{
|
|
144
|
+
key: "flows",
|
|
145
|
+
fill: share(strip.flows.shipped, strip.flows.total),
|
|
146
|
+
tone: strip.flows.total ? "info" : "none",
|
|
147
|
+
text: `${productPlural(strip.flows.total, "flow")} written, ${strip.flows.shipped} shipped`,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
key: "proof",
|
|
151
|
+
fill: criteria.measured ? share(criteria.proven, criteria.total) : 0,
|
|
152
|
+
tone:
|
|
153
|
+
!criteria.total || !criteria.measured
|
|
154
|
+
? "none"
|
|
155
|
+
: criteria.failing
|
|
156
|
+
? "bad"
|
|
157
|
+
: criteria.proven === criteria.total
|
|
158
|
+
? "good"
|
|
159
|
+
: "warn",
|
|
160
|
+
text: !criteria.total
|
|
161
|
+
? "No criteria written"
|
|
162
|
+
: criteria.measured
|
|
163
|
+
? `${criteria.proven} of ${criteria.total} criteria proven by tests`
|
|
164
|
+
: `${criteria.total} criteria, test results not measured`,
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
key: "shots",
|
|
168
|
+
fill: share(strip.screenshots.present, strip.screenshots.places),
|
|
169
|
+
tone: !strip.screenshots.places
|
|
170
|
+
? "none"
|
|
171
|
+
: strip.screenshots.present === strip.screenshots.places
|
|
172
|
+
? "good"
|
|
173
|
+
: "warn",
|
|
174
|
+
text: strip.screenshots.places
|
|
175
|
+
? `${strip.screenshots.present} of ${productPlural(strip.screenshots.places, "place")} with a screenshot`
|
|
176
|
+
: "No pages show it yet",
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
key: "findings",
|
|
180
|
+
fill: 100,
|
|
181
|
+
tone: strip.findings.errors ? "bad" : findings ? "warn" : "good",
|
|
182
|
+
text: findings ? `${productPlural(findings, "open finding")}` : "No open findings",
|
|
183
|
+
},
|
|
184
|
+
];
|
|
185
|
+
const summary = parts.map((part) => part.text).join("; ");
|
|
186
|
+
|
|
187
|
+
return kit.el(
|
|
188
|
+
"div",
|
|
189
|
+
{ class: "pm-strip", role: "group", "aria-label": "Health", title: summary },
|
|
190
|
+
[
|
|
191
|
+
kit.el(
|
|
192
|
+
"div",
|
|
193
|
+
{ class: "pm-strip-bar", "aria-hidden": "true" },
|
|
194
|
+
parts.map((part) =>
|
|
195
|
+
kit.el("span", { class: `pm-strip-seg is-${part.tone}` }, [
|
|
196
|
+
kit.el("span", { class: "pm-strip-fill", style: `width: ${part.fill}%` }),
|
|
197
|
+
]),
|
|
198
|
+
),
|
|
199
|
+
),
|
|
200
|
+
kit.el(
|
|
201
|
+
"ul",
|
|
202
|
+
{ class: "pm-strip-legend" },
|
|
203
|
+
parts.map((part) =>
|
|
204
|
+
kit.el("li", { class: `pm-strip-item is-${part.tone}` }, [
|
|
205
|
+
kit.el("span", { class: "pm-strip-dot", "aria-hidden": "true" }),
|
|
206
|
+
part.text,
|
|
207
|
+
]),
|
|
208
|
+
),
|
|
209
|
+
),
|
|
210
|
+
],
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function productChips(kit, items, kind) {
|
|
215
|
+
if (!items || items.length === 0) return null;
|
|
216
|
+
|
|
217
|
+
return kit.el(
|
|
218
|
+
"ul",
|
|
219
|
+
{
|
|
220
|
+
class: `pm-chips pm-chips--${kind}`,
|
|
221
|
+
"aria-label": kind === "audience" ? "Who it is for" : "Where it lives",
|
|
222
|
+
},
|
|
223
|
+
items.map((item) => kit.el("li", { class: `pm-chip pm-chip--${kind}`, text: item })),
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
function productSection(kit, title, body, attrs = {}) {
|
|
228
|
+
return kit.el("section", { class: "pm-section", ...attrs }, [
|
|
229
|
+
kit.el("h3", { class: "pm-section-title", text: title }),
|
|
230
|
+
body,
|
|
231
|
+
]);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
function productBreadcrumb(kit, trail) {
|
|
235
|
+
return kit.el("nav", { class: "pm-crumbs", "aria-label": "Breadcrumb" }, [
|
|
236
|
+
kit.el(
|
|
237
|
+
"ol",
|
|
238
|
+
{},
|
|
239
|
+
trail.map((item, index) =>
|
|
240
|
+
kit.el("li", {}, [
|
|
241
|
+
item.to !== undefined && index < trail.length - 1
|
|
242
|
+
? kit.link(item.to, item.text)
|
|
243
|
+
: kit.el("span", { "aria-current": "page", text: item.text }),
|
|
244
|
+
]),
|
|
245
|
+
),
|
|
246
|
+
),
|
|
247
|
+
]);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// ── Screenshots ───────────────────────────────────────────────────────────
|
|
251
|
+
|
|
252
|
+
/** One shared dialog per view; a screenshot button fills it and opens it. */
|
|
253
|
+
function productLightbox(ctx, kit) {
|
|
254
|
+
const image = kit.el("img", { class: "pm-lightbox-image", alt: "" });
|
|
255
|
+
const caption = kit.el("p", { class: "pm-lightbox-caption" });
|
|
256
|
+
const dialog = kit.el(
|
|
257
|
+
"dialog",
|
|
258
|
+
{
|
|
259
|
+
class: "pm-lightbox",
|
|
260
|
+
"aria-label": "Screenshot",
|
|
261
|
+
onclick: (event) => {
|
|
262
|
+
if (event && event.target === dialog) dialog.close?.();
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
[
|
|
266
|
+
kit.el("div", { class: "pm-lightbox-body" }, [
|
|
267
|
+
image,
|
|
268
|
+
caption,
|
|
269
|
+
kit.el("button", {
|
|
270
|
+
type: "button",
|
|
271
|
+
class: "pm-button",
|
|
272
|
+
text: "Close",
|
|
273
|
+
onclick: () => (typeof dialog.close === "function" ? dialog.close() : undefined),
|
|
274
|
+
}),
|
|
275
|
+
]),
|
|
276
|
+
],
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
return {
|
|
280
|
+
dialog,
|
|
281
|
+
open(shot) {
|
|
282
|
+
image.setAttribute("src", ctx.file(shot.src));
|
|
283
|
+
image.setAttribute("alt", shot.alt);
|
|
284
|
+
caption.textContent = shot.alt;
|
|
285
|
+
|
|
286
|
+
if (typeof dialog.showModal === "function") dialog.showModal();
|
|
287
|
+
else dialog.setAttribute("open", "");
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
const PRODUCT_SHOT_EXTENSION = /\.(png|jpe?g|webp|gif)$/i;
|
|
293
|
+
|
|
294
|
+
/**
|
|
295
|
+
* Whether a screenshot path is a plain path inside the screenshots folder: no
|
|
296
|
+
* scheme, no absolute path, no backslash and no empty, `.` or `..` segment, so
|
|
297
|
+
* `ctx.file()` can never point an image outside the folder.
|
|
298
|
+
*/
|
|
299
|
+
function productShotPath(src) {
|
|
300
|
+
if (typeof src !== "string" || src === "" || src.startsWith("/") || /[\\:\0?#]/.test(src))
|
|
301
|
+
return false;
|
|
302
|
+
|
|
303
|
+
const segments = src.split("/");
|
|
304
|
+
|
|
305
|
+
return (
|
|
306
|
+
segments.every((segment) => segment !== "" && segment !== "." && segment !== "..") &&
|
|
307
|
+
PRODUCT_SHOT_EXTENSION.test(src)
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function productShots(ctx, kit, list, lightbox) {
|
|
312
|
+
const shots = (list ?? []).filter((shot) => productShotPath(shot?.src));
|
|
313
|
+
|
|
314
|
+
if (shots.length === 0 || typeof ctx.file !== "function") return null;
|
|
315
|
+
|
|
316
|
+
return kit.el(
|
|
317
|
+
"ul",
|
|
318
|
+
{ class: "pm-shots" },
|
|
319
|
+
shots.map((shot) =>
|
|
320
|
+
kit.el("li", {}, [
|
|
321
|
+
kit.el(
|
|
322
|
+
"button",
|
|
323
|
+
{
|
|
324
|
+
type: "button",
|
|
325
|
+
class: "pm-shot",
|
|
326
|
+
"aria-label": `Enlarge screenshot${shot.alt ? `: ${shot.alt}` : ""}`,
|
|
327
|
+
onclick: () => lightbox.open(shot),
|
|
328
|
+
},
|
|
329
|
+
[kit.el("img", { src: ctx.file(shot.src), alt: shot.alt, loading: "lazy" })],
|
|
330
|
+
),
|
|
331
|
+
]),
|
|
332
|
+
),
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function productAppearances(ctx, kit, appearances, lightbox, withFlowLinks) {
|
|
337
|
+
if (!appearances || appearances.length === 0) return null;
|
|
338
|
+
|
|
339
|
+
const byApp = new Map();
|
|
340
|
+
|
|
341
|
+
for (const item of appearances) {
|
|
342
|
+
if (!byApp.has(item.app)) byApp.set(item.app, []);
|
|
343
|
+
byApp.get(item.app).push(item);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return productSection(
|
|
347
|
+
kit,
|
|
348
|
+
"Where you see it",
|
|
349
|
+
kit.el(
|
|
350
|
+
"div",
|
|
351
|
+
{ class: "pm-apps" },
|
|
352
|
+
[...byApp.entries()].map(([app, items]) =>
|
|
353
|
+
kit.el("div", { class: "pm-app" }, [
|
|
354
|
+
kit.el("h4", { text: app }),
|
|
355
|
+
kit.el(
|
|
356
|
+
"ul",
|
|
357
|
+
{ class: "pm-places" },
|
|
358
|
+
items.map((item) =>
|
|
359
|
+
kit.el("li", { class: "pm-place" }, [
|
|
360
|
+
kit.el("div", { class: "pm-place-head" }, [
|
|
361
|
+
kit.el("strong", { text: item.title ?? item.id }),
|
|
362
|
+
item.route ? kit.el("span", { class: "pm-place-route", text: item.route }) : null,
|
|
363
|
+
withFlowLinks && item.flow
|
|
364
|
+
? kit.link(
|
|
365
|
+
`product/flow/${item.flow.split("/").map(productEncode).join("/")}`,
|
|
366
|
+
"See the story",
|
|
367
|
+
{ class: "pm-place-flow" },
|
|
368
|
+
)
|
|
369
|
+
: null,
|
|
370
|
+
]),
|
|
371
|
+
productShots(ctx, kit, item.screenshots, lightbox),
|
|
372
|
+
]),
|
|
373
|
+
),
|
|
374
|
+
),
|
|
375
|
+
]),
|
|
376
|
+
),
|
|
377
|
+
),
|
|
378
|
+
);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// ── Developer toggle ──────────────────────────────────────────────────────
|
|
382
|
+
|
|
383
|
+
function productDeveloperToggle(kit, body) {
|
|
384
|
+
let on = false;
|
|
385
|
+
|
|
386
|
+
try {
|
|
387
|
+
on = globalThis.localStorage?.getItem(PRODUCT_DEVELOPER_KEY) === "1";
|
|
388
|
+
} catch {
|
|
389
|
+
on = false;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
const button = kit.el("button", {
|
|
393
|
+
type: "button",
|
|
394
|
+
class: "pm-button pm-developer-toggle",
|
|
395
|
+
"aria-pressed": String(on),
|
|
396
|
+
text: "For developers",
|
|
397
|
+
});
|
|
398
|
+
const panel = kit.el(
|
|
399
|
+
"section",
|
|
400
|
+
{ class: "pm-developer", "aria-label": "For developers" },
|
|
401
|
+
on ? body() : [],
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
if (!on) panel.setAttribute("hidden", "");
|
|
405
|
+
|
|
406
|
+
let built = on;
|
|
407
|
+
|
|
408
|
+
button.addEventListener("click", () => {
|
|
409
|
+
on = !on;
|
|
410
|
+
|
|
411
|
+
try {
|
|
412
|
+
globalThis.localStorage?.setItem(PRODUCT_DEVELOPER_KEY, on ? "1" : "0");
|
|
413
|
+
} catch {
|
|
414
|
+
// The choice is only a convenience.
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
button.setAttribute("aria-pressed", String(on));
|
|
418
|
+
|
|
419
|
+
if (on && !built) {
|
|
420
|
+
panel.replaceChildren(...[body()].flat());
|
|
421
|
+
built = true;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
if (on) panel.removeAttribute?.("hidden");
|
|
425
|
+
else panel.setAttribute("hidden", "");
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
return { button, panel };
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// ── Pages ─────────────────────────────────────────────────────────────────
|
|
432
|
+
|
|
433
|
+
function productLoadError(ctx, kit, what, error) {
|
|
434
|
+
return kit.el("div", { class: "pm-error", role: "alert" }, [
|
|
435
|
+
kit.el("h3", { text: `Could not load ${what}` }),
|
|
436
|
+
kit.el("p", { text: error?.message ?? String(error) }),
|
|
437
|
+
kit.el("p", {
|
|
438
|
+
class: "pm-muted",
|
|
439
|
+
text: kit.shared
|
|
440
|
+
? "Reload the page. If it still fails, the link may have expired or been revoked: ask the person who shared it for a new one."
|
|
441
|
+
: "Check that the app is running, then try again.",
|
|
442
|
+
}),
|
|
443
|
+
kit.el("button", {
|
|
444
|
+
type: "button",
|
|
445
|
+
class: "pm-button",
|
|
446
|
+
text: "Try again",
|
|
447
|
+
onclick: () => ctx.refresh?.(),
|
|
448
|
+
}),
|
|
449
|
+
]);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** The sorts of the feature cards. `id` is the written order and the default. */
|
|
453
|
+
const PRODUCT_SORTS = [
|
|
454
|
+
{ value: "id", label: "Feature id" },
|
|
455
|
+
{ value: "name", label: "Name" },
|
|
456
|
+
{ value: "changed", label: "Recently changed" },
|
|
457
|
+
{ value: "health", label: "Health (worst first)" },
|
|
458
|
+
];
|
|
459
|
+
|
|
460
|
+
const PRODUCT_HEALTH_ORDER = { problem: 0, attention: 1, unknown: 2, good: 3 };
|
|
461
|
+
|
|
462
|
+
const productCompareText = (left, right) => (left < right ? -1 : left > right ? 1 : 0);
|
|
463
|
+
|
|
464
|
+
/** The cards in the order `sort` names; the sort is stable, so equal cards keep their written order. */
|
|
465
|
+
export function productSortFeatures(features, sort) {
|
|
466
|
+
const list = features.map((feature, index) => ({ feature, index }));
|
|
467
|
+
const by = {
|
|
468
|
+
id: (a, b) => productCompareText(a.feature.id, b.feature.id),
|
|
469
|
+
name: (a, b) => a.feature.title.localeCompare(b.feature.title),
|
|
470
|
+
changed: (a, b) => productCompareText(b.feature.changedAt ?? "", a.feature.changedAt ?? ""),
|
|
471
|
+
health: (a, b) =>
|
|
472
|
+
(PRODUCT_HEALTH_ORDER[a.feature.health.level] ?? 2) -
|
|
473
|
+
(PRODUCT_HEALTH_ORDER[b.feature.health.level] ?? 2),
|
|
474
|
+
}[sort];
|
|
475
|
+
|
|
476
|
+
if (!by) return features;
|
|
477
|
+
|
|
478
|
+
return list.sort((a, b) => by(a, b) || a.index - b.index).map((item) => item.feature);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
/** The flow cards in the order `sort` names (`written`, `name`, `health`); the sort is stable. */
|
|
482
|
+
export function productSortFlows(flows, sort) {
|
|
483
|
+
const list = flows.map((flow, index) => ({ flow, index }));
|
|
484
|
+
const by = {
|
|
485
|
+
name: (a, b) => (a.flow.title ?? "").localeCompare(b.flow.title ?? ""),
|
|
486
|
+
health: (a, b) =>
|
|
487
|
+
(PRODUCT_HEALTH_ORDER[a.flow.health?.level] ?? 2) -
|
|
488
|
+
(PRODUCT_HEALTH_ORDER[b.flow.health?.level] ?? 2),
|
|
489
|
+
}[sort];
|
|
490
|
+
|
|
491
|
+
if (!by) return flows;
|
|
492
|
+
|
|
493
|
+
return list.sort((a, b) => by(a, b) || a.index - b.index).map((item) => item.flow);
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* The features that changed since a day (`yyyy-mm-dd`) or since a release (the release's own
|
|
498
|
+
* changes included, and anything not yet released). An empty `since` keeps every feature.
|
|
499
|
+
*/
|
|
500
|
+
export function productChangedSince(features, since, releases = []) {
|
|
501
|
+
if (!since) return features;
|
|
502
|
+
|
|
503
|
+
if (since.startsWith("release:")) {
|
|
504
|
+
const name = since.slice("release:".length);
|
|
505
|
+
const position = releases.findIndex((item) => item.release === name);
|
|
506
|
+
|
|
507
|
+
if (position < 0) return features;
|
|
508
|
+
|
|
509
|
+
const later = new Set(releases.slice(position).map((item) => item.release));
|
|
510
|
+
|
|
511
|
+
return features.filter(
|
|
512
|
+
(feature) =>
|
|
513
|
+
feature.unreleased === true ||
|
|
514
|
+
(feature.changedIn ?? []).some((release) => later.has(release)),
|
|
515
|
+
);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
return features.filter((feature) => (feature.changedAt ?? "") >= since);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
/** The "changed since" choices: the last week and month before the newest change, and each written release. */
|
|
522
|
+
function productSinceChoices(features, releases) {
|
|
523
|
+
const validDay = (value) =>
|
|
524
|
+
typeof value === "string" &&
|
|
525
|
+
/^\d{4}-\d{2}-\d{2}$/.test(value) &&
|
|
526
|
+
!Number.isNaN(new Date(`${value}T00:00:00Z`).getTime());
|
|
527
|
+
const newest = features.reduce(
|
|
528
|
+
(max, feature) =>
|
|
529
|
+
validDay(feature.changedAt) && feature.changedAt > max ? feature.changedAt : max,
|
|
530
|
+
"",
|
|
531
|
+
);
|
|
532
|
+
const choices = [];
|
|
533
|
+
|
|
534
|
+
if (newest !== "") {
|
|
535
|
+
for (const [days, label] of [
|
|
536
|
+
[7, "Last 7 days"],
|
|
537
|
+
[30, "Last 30 days"],
|
|
538
|
+
]) {
|
|
539
|
+
const day = new Date(`${newest}T00:00:00Z`);
|
|
540
|
+
|
|
541
|
+
day.setUTCDate(day.getUTCDate() - days);
|
|
542
|
+
choices.push({ value: day.toISOString().slice(0, 10), label: `${label} of activity` });
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
for (const item of [...releases].reverse())
|
|
547
|
+
choices.push({ value: `release:${item.release}`, label: `Release ${item.release} and later` });
|
|
548
|
+
|
|
549
|
+
return choices;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function productMapPage(ctx, kit, answer) {
|
|
553
|
+
const features = answer.features ?? [];
|
|
554
|
+
const live = features.filter((feature) => feature.status === "shipped").length;
|
|
555
|
+
const attention = features.filter(
|
|
556
|
+
(feature) => feature.health.level === "attention" || feature.health.level === "problem",
|
|
557
|
+
).length;
|
|
558
|
+
const share = ctx.share?.enabled ? ctx.share : null;
|
|
559
|
+
|
|
560
|
+
const header = kit.el("header", { class: "pm-hero" }, [
|
|
561
|
+
kit.el("div", {}, [
|
|
562
|
+
kit.el("h2", { text: "Product map" }),
|
|
563
|
+
kit.el("p", {
|
|
564
|
+
class: "pm-lead",
|
|
565
|
+
text: "What the product does, who it is for and how healthy each part is, in plain words.",
|
|
566
|
+
}),
|
|
567
|
+
]),
|
|
568
|
+
share
|
|
569
|
+
? kit.el("a", {
|
|
570
|
+
class: "pm-button pm-button--primary",
|
|
571
|
+
href: share.manageHref,
|
|
572
|
+
text: "Share this map",
|
|
573
|
+
})
|
|
574
|
+
: null,
|
|
575
|
+
]);
|
|
576
|
+
|
|
577
|
+
if (features.length === 0) {
|
|
578
|
+
return kit.el("div", { class: "pm-page" }, [
|
|
579
|
+
header,
|
|
580
|
+
kit.el("div", { class: "pm-empty" }, [
|
|
581
|
+
kit.el("h3", { text: "No features are written yet" }),
|
|
582
|
+
kit.el("p", {
|
|
583
|
+
text: "Ask your agent to describe the product in grimoire/features. Each feature you describe becomes a card here.",
|
|
584
|
+
}),
|
|
585
|
+
]),
|
|
586
|
+
]);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
const apps = [...new Set(features.flatMap((feature) => feature.apps))].sort();
|
|
590
|
+
const audiences = [...new Set(features.flatMap((feature) => feature.audience))].sort();
|
|
591
|
+
const releases = answer.releases ?? [];
|
|
592
|
+
const state = { text: "", app: "", audience: "", sort: "id", since: "" };
|
|
593
|
+
const grid = kit.el("ul", { class: "pm-grid" });
|
|
594
|
+
const count = kit.el("p", { class: "pm-count", role: "status", "aria-live": "polite" });
|
|
595
|
+
const none = kit.el("p", {
|
|
596
|
+
class: "pm-empty pm-empty--inline",
|
|
597
|
+
text: "No feature matches. Clear the search or a filter.",
|
|
598
|
+
});
|
|
599
|
+
|
|
600
|
+
const card = (feature) =>
|
|
601
|
+
kit.el("li", { class: "pm-card" }, [
|
|
602
|
+
kit.el("div", { class: "pm-card-top" }, [
|
|
603
|
+
productStatusChip(kit, feature.status),
|
|
604
|
+
kit.el("span", { class: "pm-muted", text: productPlural(feature.flows, "flow") }),
|
|
605
|
+
]),
|
|
606
|
+
kit.el("h3", { class: "pm-card-title" }, [
|
|
607
|
+
kit.link(`product/feature/${productEncode(feature.id)}`, feature.title, {
|
|
608
|
+
class: "pm-card-link",
|
|
609
|
+
}),
|
|
610
|
+
]),
|
|
611
|
+
kit.el("p", {
|
|
612
|
+
class: "pm-card-summary",
|
|
613
|
+
text: feature.summary ?? "No summary yet.",
|
|
614
|
+
}),
|
|
615
|
+
productChips(kit, feature.audience, "audience"),
|
|
616
|
+
productChips(kit, feature.apps, "app"),
|
|
617
|
+
productStrip(kit, feature.strip),
|
|
618
|
+
productHealth(kit, feature.health),
|
|
619
|
+
]);
|
|
620
|
+
|
|
621
|
+
const show = () => {
|
|
622
|
+
const needle = state.text.trim().toLowerCase();
|
|
623
|
+
const matches = productSortFeatures(
|
|
624
|
+
productChangedSince(features, state.since, releases),
|
|
625
|
+
state.sort,
|
|
626
|
+
).filter(
|
|
627
|
+
(feature) =>
|
|
628
|
+
(state.app === "" || feature.apps.includes(state.app)) &&
|
|
629
|
+
(state.audience === "" || feature.audience.includes(state.audience)) &&
|
|
630
|
+
(needle === "" ||
|
|
631
|
+
feature.title.toLowerCase().includes(needle) ||
|
|
632
|
+
(feature.summary ?? "").toLowerCase().includes(needle)),
|
|
633
|
+
);
|
|
634
|
+
|
|
635
|
+
grid.replaceChildren(...matches.map(card));
|
|
636
|
+
count.textContent = `Showing ${matches.length} of ${features.length} features`;
|
|
637
|
+
if (matches.length === 0) grid.append(none);
|
|
638
|
+
};
|
|
639
|
+
|
|
640
|
+
const select = (label, options, key) =>
|
|
641
|
+
kit.el("label", { class: "pm-field" }, [
|
|
642
|
+
kit.el("span", { text: label }),
|
|
643
|
+
kit.el(
|
|
644
|
+
"select",
|
|
645
|
+
{
|
|
646
|
+
onchange: (event) => {
|
|
647
|
+
state[key] = event?.target?.value ?? "";
|
|
648
|
+
show();
|
|
649
|
+
},
|
|
650
|
+
},
|
|
651
|
+
[
|
|
652
|
+
kit.el("option", { value: "", text: `All ${label.toLowerCase()}s` }),
|
|
653
|
+
...options.map((option) => kit.el("option", { value: option, text: option })),
|
|
654
|
+
],
|
|
655
|
+
),
|
|
656
|
+
]);
|
|
657
|
+
|
|
658
|
+
const filters = kit.el("div", { class: "pm-filters", role: "search" }, [
|
|
659
|
+
kit.el("label", { class: "pm-field pm-field--grow" }, [
|
|
660
|
+
kit.el("span", { text: "Search" }),
|
|
661
|
+
kit.el("input", {
|
|
662
|
+
type: "search",
|
|
663
|
+
placeholder: "Search by name or summary",
|
|
664
|
+
oninput: (event) => {
|
|
665
|
+
state.text = event?.target?.value ?? "";
|
|
666
|
+
show();
|
|
667
|
+
},
|
|
668
|
+
}),
|
|
669
|
+
]),
|
|
670
|
+
apps.length > 1 ? select("App", apps, "app") : null,
|
|
671
|
+
audiences.length > 0 ? select("Audience", audiences, "audience") : null,
|
|
672
|
+
kit.el("label", { class: "pm-field" }, [
|
|
673
|
+
kit.el("span", { text: "Sort by" }),
|
|
674
|
+
kit.el(
|
|
675
|
+
"select",
|
|
676
|
+
{
|
|
677
|
+
"data-pm": "sort",
|
|
678
|
+
onchange: (event) => {
|
|
679
|
+
state.sort = event?.target?.value ?? "id";
|
|
680
|
+
show();
|
|
681
|
+
},
|
|
682
|
+
},
|
|
683
|
+
PRODUCT_SORTS.map((item) => kit.el("option", { value: item.value, text: item.label })),
|
|
684
|
+
),
|
|
685
|
+
]),
|
|
686
|
+
kit.el("label", { class: "pm-field" }, [
|
|
687
|
+
kit.el("span", { text: "Changed since" }),
|
|
688
|
+
kit.el(
|
|
689
|
+
"select",
|
|
690
|
+
{
|
|
691
|
+
"data-pm": "since",
|
|
692
|
+
onchange: (event) => {
|
|
693
|
+
state.since = event?.target?.value ?? "";
|
|
694
|
+
show();
|
|
695
|
+
},
|
|
696
|
+
},
|
|
697
|
+
[
|
|
698
|
+
kit.el("option", { value: "", text: "Any time" }),
|
|
699
|
+
...productSinceChoices(features, releases).map((item) =>
|
|
700
|
+
kit.el("option", { value: item.value, text: item.label }),
|
|
701
|
+
),
|
|
702
|
+
],
|
|
703
|
+
),
|
|
704
|
+
]),
|
|
705
|
+
]);
|
|
706
|
+
|
|
707
|
+
show();
|
|
708
|
+
|
|
709
|
+
return kit.el("div", { class: "pm-page" }, [
|
|
710
|
+
header,
|
|
711
|
+
kit.el("ul", { class: "pm-stats", "aria-label": "At a glance" }, [
|
|
712
|
+
kit.el("li", {}, [
|
|
713
|
+
kit.el("strong", { text: String(features.length) }),
|
|
714
|
+
kit.el("span", { text: "features" }),
|
|
715
|
+
]),
|
|
716
|
+
kit.el("li", {}, [
|
|
717
|
+
kit.el("strong", { text: String(live) }),
|
|
718
|
+
kit.el("span", { text: "live" }),
|
|
719
|
+
]),
|
|
720
|
+
kit.el("li", {}, [
|
|
721
|
+
kit.el("strong", { text: String(attention) }),
|
|
722
|
+
kit.el("span", { text: attention === 1 ? "needs attention" : "need attention" }),
|
|
723
|
+
]),
|
|
724
|
+
]),
|
|
725
|
+
filters,
|
|
726
|
+
count,
|
|
727
|
+
grid,
|
|
728
|
+
]);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
function productFlowCard(kit, flow) {
|
|
732
|
+
return kit.el("li", { class: "pm-card pm-card--flow" }, [
|
|
733
|
+
kit.el("div", { class: "pm-card-top" }, [
|
|
734
|
+
productStatusChip(kit, flow.status),
|
|
735
|
+
kit.el("span", { class: "pm-muted", text: flow.who }),
|
|
736
|
+
]),
|
|
737
|
+
kit.el("h4", { class: "pm-card-title" }, [
|
|
738
|
+
kit.link(`product/flow/${flow.ref.split("/").map(productEncode).join("/")}`, flow.title, {
|
|
739
|
+
class: "pm-card-link",
|
|
740
|
+
}),
|
|
741
|
+
]),
|
|
742
|
+
kit.el("p", { class: "pm-card-summary", text: flow.summary ?? "No summary yet." }),
|
|
743
|
+
productHealth(kit, flow.health),
|
|
744
|
+
]);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/** A reference id: `AC-6`, `T-089`, `QA 1.5.6`. */
|
|
748
|
+
const PRODUCT_REF = /^(?:[A-Z]{1,5}-\d+|QA\s+\d[\w.-]*)$/;
|
|
749
|
+
/** A trailing parenthesised group (optionally followed by one end mark) at the end of a sentence. */
|
|
750
|
+
const PRODUCT_TRAILING_GROUP = /\s*\(([^()]*)\)\s*([.!?]?)\s*$/;
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Split the reference ids off the end of a change sentence: `"Fixed the total (AC-6, T-089)."` gives
|
|
754
|
+
* `{ text: "Fixed the total.", refs: ["AC-6", "T-089"] }`. Only a trailing parenthesised group whose items are
|
|
755
|
+
* all reference ids is taken, so ordinary parentheses in the text stay.
|
|
756
|
+
*/
|
|
757
|
+
export function productSplitRefs(sentence) {
|
|
758
|
+
let text = String(sentence ?? "");
|
|
759
|
+
const refs = [];
|
|
760
|
+
|
|
761
|
+
for (;;) {
|
|
762
|
+
const match = PRODUCT_TRAILING_GROUP.exec(text);
|
|
763
|
+
|
|
764
|
+
if (!match) break;
|
|
765
|
+
|
|
766
|
+
const parts = match[1]
|
|
767
|
+
.split(/[,;]/)
|
|
768
|
+
.map((part) => part.trim())
|
|
769
|
+
.filter(Boolean);
|
|
770
|
+
|
|
771
|
+
if (parts.length === 0 || !parts.every((part) => PRODUCT_REF.test(part))) break;
|
|
772
|
+
|
|
773
|
+
refs.unshift(...parts);
|
|
774
|
+
text = `${text.slice(0, match.index)}${match[2]}`;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
return { text: text.trim(), refs };
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
const PRODUCT_CHANGE_ORDER = ["added", "changed", "fixed", "removed"];
|
|
781
|
+
|
|
782
|
+
function productTimeline(kit, releases) {
|
|
783
|
+
const ordered = [...releases].sort(
|
|
784
|
+
(left, right) => Number(right.release === null) - Number(left.release === null),
|
|
785
|
+
);
|
|
786
|
+
|
|
787
|
+
return kit.el(
|
|
788
|
+
"ol",
|
|
789
|
+
{ class: "pm-timeline" },
|
|
790
|
+
ordered.map((item) => {
|
|
791
|
+
const groups = new Map();
|
|
792
|
+
|
|
793
|
+
for (const change of item.changes)
|
|
794
|
+
groups.set(change.word, [...(groups.get(change.word) ?? []), change]);
|
|
795
|
+
|
|
796
|
+
const words = [
|
|
797
|
+
...PRODUCT_CHANGE_ORDER.filter((word) => groups.has(word)),
|
|
798
|
+
...[...groups.keys()].filter((word) => !PRODUCT_CHANGE_ORDER.includes(word)),
|
|
799
|
+
];
|
|
800
|
+
const date = productDate(item.date);
|
|
801
|
+
|
|
802
|
+
return kit.el("li", { class: `pm-release${item.release === null ? " is-unreleased" : ""}` }, [
|
|
803
|
+
kit.el("div", { class: "pm-release-head" }, [
|
|
804
|
+
kit.el("strong", { class: "pm-release-version", text: `Version ${item.version}` }),
|
|
805
|
+
item.release === null
|
|
806
|
+
? kit.el("span", {
|
|
807
|
+
class: "pm-chip pm-chip--soft pm-release-state",
|
|
808
|
+
text: "Unreleased",
|
|
809
|
+
})
|
|
810
|
+
: kit.el("span", {
|
|
811
|
+
class: "pm-muted pm-release-state",
|
|
812
|
+
text: [`Release ${item.release}`, date].filter(Boolean).join(" · "),
|
|
813
|
+
}),
|
|
814
|
+
]),
|
|
815
|
+
words.length === 0
|
|
816
|
+
? kit.el("p", { class: "pm-muted", text: "No changes are listed for this version." })
|
|
817
|
+
: kit.el(
|
|
818
|
+
"div",
|
|
819
|
+
{ class: "pm-change-groups" },
|
|
820
|
+
words.map((word) =>
|
|
821
|
+
kit.el("section", { class: "pm-change-group" }, [
|
|
822
|
+
kit.el("h4", {
|
|
823
|
+
class: `pm-change-type pm-change--${word}`,
|
|
824
|
+
text: PRODUCT_CHANGE[word] ?? word,
|
|
825
|
+
}),
|
|
826
|
+
kit.el(
|
|
827
|
+
"ul",
|
|
828
|
+
{ class: "pm-changes" },
|
|
829
|
+
groups.get(word).map((change) => {
|
|
830
|
+
const { text, refs } = productSplitRefs(change.text);
|
|
831
|
+
|
|
832
|
+
return kit.el("li", {}, [
|
|
833
|
+
kit.el("span", { class: "pm-change-text", text }),
|
|
834
|
+
!kit.shared && refs.length > 0
|
|
835
|
+
? kit.el(
|
|
836
|
+
"span",
|
|
837
|
+
{ class: "pm-refs" },
|
|
838
|
+
refs.map((ref) => kit.el("code", { class: "pm-ref", text: ref })),
|
|
839
|
+
)
|
|
840
|
+
: null,
|
|
841
|
+
]);
|
|
842
|
+
}),
|
|
843
|
+
),
|
|
844
|
+
]),
|
|
845
|
+
),
|
|
846
|
+
),
|
|
847
|
+
]);
|
|
848
|
+
}),
|
|
849
|
+
);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/** The host the adapter reported, or `null` when there is none. */
|
|
853
|
+
function productHost(host) {
|
|
854
|
+
return host && typeof host === "object" ? host : null;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/** "Warlock.js v5.58.0" with the logo, for the footer of the shared page. */
|
|
858
|
+
function productBrandLine(kit, host) {
|
|
859
|
+
return kit.el("span", { class: "pm-brand" }, [
|
|
860
|
+
host.logo
|
|
861
|
+
? kit.el("img", {
|
|
862
|
+
class: "pm-brand-logo",
|
|
863
|
+
src: host.logo,
|
|
864
|
+
alt: "",
|
|
865
|
+
width: "16",
|
|
866
|
+
height: "16",
|
|
867
|
+
})
|
|
868
|
+
: null,
|
|
869
|
+
kit.el("span", { text: host.version ? `${host.name} v${host.version}` : host.name }),
|
|
870
|
+
]);
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
function productPlanned(kit, planned) {
|
|
874
|
+
return kit.el(
|
|
875
|
+
"ul",
|
|
876
|
+
{ class: "pm-list" },
|
|
877
|
+
planned.map((item) =>
|
|
878
|
+
kit.el("li", {}, [
|
|
879
|
+
kit.el("span", {
|
|
880
|
+
class: "pm-chip",
|
|
881
|
+
text:
|
|
882
|
+
item.type === "bug"
|
|
883
|
+
? "Fix"
|
|
884
|
+
: item.type === "feature"
|
|
885
|
+
? "New"
|
|
886
|
+
: item.type === "decision"
|
|
887
|
+
? "Decision"
|
|
888
|
+
: "Upkeep",
|
|
889
|
+
}),
|
|
890
|
+
kit.el("span", { text: item.title }),
|
|
891
|
+
kit.el("span", { class: "pm-muted", text: item.status }),
|
|
892
|
+
]),
|
|
893
|
+
),
|
|
894
|
+
);
|
|
895
|
+
}
|
|
896
|
+
|
|
897
|
+
function productFeaturePage(ctx, kit, answer, lightbox) {
|
|
898
|
+
const feature = answer.feature;
|
|
899
|
+
const health = answer.health;
|
|
900
|
+
const sections = [];
|
|
901
|
+
|
|
902
|
+
sections.push(
|
|
903
|
+
kit.el("header", { class: "pm-title" }, [
|
|
904
|
+
kit.el("div", { class: "pm-title-row" }, [
|
|
905
|
+
kit.el("h2", { text: feature.title }),
|
|
906
|
+
productStatusChip(kit, feature.status),
|
|
907
|
+
]),
|
|
908
|
+
kit.el("p", { class: "pm-lead", text: feature.summary ?? "No summary yet." }),
|
|
909
|
+
productChips(kit, feature.audience, "audience"),
|
|
910
|
+
productChips(kit, feature.apps, "app"),
|
|
911
|
+
kit.el("p", { class: "pm-muted", text: `Version ${feature.version}` }),
|
|
912
|
+
]),
|
|
913
|
+
);
|
|
914
|
+
|
|
915
|
+
sections.push(
|
|
916
|
+
kit.el("section", { class: "pm-section pm-callout", "aria-label": "Health" }, [
|
|
917
|
+
productHealth(kit, health),
|
|
918
|
+
health.errors && health.errors.count > 0
|
|
919
|
+
? kit.el("p", {
|
|
920
|
+
class: "pm-muted",
|
|
921
|
+
text: `${productPlural(health.errors.count, "error")} in the last hour on the pages and routes this feature uses.`,
|
|
922
|
+
})
|
|
923
|
+
: null,
|
|
924
|
+
]),
|
|
925
|
+
);
|
|
926
|
+
|
|
927
|
+
if (feature.why)
|
|
928
|
+
sections.push(
|
|
929
|
+
productSection(kit, "Why it exists", kit.el("p", { class: "pm-prose", text: feature.why })),
|
|
930
|
+
);
|
|
931
|
+
|
|
932
|
+
if (answer.flows.length > 0) {
|
|
933
|
+
const list = kit.el("ul", { class: "pm-grid pm-grid--flows" });
|
|
934
|
+
const showFlows = (sort) =>
|
|
935
|
+
list.replaceChildren(
|
|
936
|
+
...productSortFlows(answer.flows, sort).map((flow) => productFlowCard(kit, flow)),
|
|
937
|
+
);
|
|
938
|
+
|
|
939
|
+
showFlows("written");
|
|
940
|
+
sections.push(
|
|
941
|
+
productSection(kit, "What people can do", [
|
|
942
|
+
answer.flows.length > 1
|
|
943
|
+
? kit.el("label", { class: "pm-field" }, [
|
|
944
|
+
kit.el("span", { text: "Sort by" }),
|
|
945
|
+
kit.el(
|
|
946
|
+
"select",
|
|
947
|
+
{
|
|
948
|
+
"data-pm": "flow-sort",
|
|
949
|
+
onchange: (event) => showFlows(event?.target?.value ?? "written"),
|
|
950
|
+
},
|
|
951
|
+
[
|
|
952
|
+
kit.el("option", { value: "written", text: "As written" }),
|
|
953
|
+
kit.el("option", { value: "name", text: "Name" }),
|
|
954
|
+
kit.el("option", { value: "health", text: "Health (worst first)" }),
|
|
955
|
+
],
|
|
956
|
+
),
|
|
957
|
+
])
|
|
958
|
+
: null,
|
|
959
|
+
list,
|
|
960
|
+
]),
|
|
961
|
+
);
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
sections.push(productAppearances(ctx, kit, answer.appearances, lightbox, true));
|
|
965
|
+
|
|
966
|
+
sections.push(
|
|
967
|
+
productSection(
|
|
968
|
+
kit,
|
|
969
|
+
"What changed",
|
|
970
|
+
answer.releases.length > 0
|
|
971
|
+
? productTimeline(kit, answer.releases)
|
|
972
|
+
: kit.el("p", { class: "pm-muted", text: "No changes are recorded yet." }),
|
|
973
|
+
),
|
|
974
|
+
);
|
|
975
|
+
|
|
976
|
+
if (answer.planned.length > 0)
|
|
977
|
+
sections.push(productSection(kit, "Coming next", productPlanned(kit, answer.planned)));
|
|
978
|
+
|
|
979
|
+
return sections;
|
|
980
|
+
}
|
|
981
|
+
|
|
982
|
+
function productFeatureDeveloper(kit, developer) {
|
|
983
|
+
return () => [
|
|
984
|
+
kit.el("h3", { class: "pm-section-title", text: "For developers" }),
|
|
985
|
+
kit.el("dl", { class: "pm-facts" }, [
|
|
986
|
+
kit.el("dt", { text: "Folders" }),
|
|
987
|
+
kit.el("dd", { class: "pm-mono", text: developer.folders.join(", ") || "none" }),
|
|
988
|
+
kit.el("dt", { text: "Files it owns" }),
|
|
989
|
+
kit.el("dd", { text: String(developer.files) }),
|
|
990
|
+
kit.el("dt", { text: "Check findings" }),
|
|
991
|
+
kit.el("dd", {
|
|
992
|
+
text: `${productPlural(developer.findings.errors, "error")}, ${productPlural(developer.findings.warnings, "warning")}`,
|
|
993
|
+
}),
|
|
994
|
+
kit.el("dt", { text: "Routes" }),
|
|
995
|
+
kit.el(
|
|
996
|
+
"dd",
|
|
997
|
+
{},
|
|
998
|
+
developer.routes.length === 0
|
|
999
|
+
? "none"
|
|
1000
|
+
: kit.el(
|
|
1001
|
+
"ul",
|
|
1002
|
+
{ class: "pm-mono pm-plain-list" },
|
|
1003
|
+
developer.routes.map((route) =>
|
|
1004
|
+
kit.el("li", { text: `${route.method} ${route.path}` }),
|
|
1005
|
+
),
|
|
1006
|
+
),
|
|
1007
|
+
),
|
|
1008
|
+
]),
|
|
1009
|
+
];
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
function productStory(ctx, kit, story, lightbox) {
|
|
1013
|
+
if (story.length === 0)
|
|
1014
|
+
return kit.el("p", { class: "pm-muted", text: "No steps are written for this flow yet." });
|
|
1015
|
+
|
|
1016
|
+
return kit.el(
|
|
1017
|
+
"ol",
|
|
1018
|
+
{ class: "pm-story" },
|
|
1019
|
+
story.map((step) =>
|
|
1020
|
+
kit.el("li", { class: "pm-step" }, [
|
|
1021
|
+
kit.el("p", { text: step.text }),
|
|
1022
|
+
step.derived
|
|
1023
|
+
? kit.el("span", { class: "pm-chip pm-chip--soft", text: "from the technical steps" })
|
|
1024
|
+
: null,
|
|
1025
|
+
productShots(ctx, kit, step.screenshots, lightbox),
|
|
1026
|
+
]),
|
|
1027
|
+
),
|
|
1028
|
+
);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
function productCases(kit, cases) {
|
|
1032
|
+
const handled = cases.filter((item) => item.handled);
|
|
1033
|
+
const skipped = cases.filter((item) => !item.handled);
|
|
1034
|
+
const item = (entry) =>
|
|
1035
|
+
kit.el("li", {}, [
|
|
1036
|
+
kit.el("strong", { text: entry.question }),
|
|
1037
|
+
kit.el("p", {
|
|
1038
|
+
text: entry.handled ? entry.answer : entry.answer.replace(/^does not apply\b[:\s—-]*/i, ""),
|
|
1039
|
+
}),
|
|
1040
|
+
entry.criteria.length > 0
|
|
1041
|
+
? kit.el("span", {
|
|
1042
|
+
class: "pm-chip pm-chip--soft",
|
|
1043
|
+
text: `Checked by ${entry.criteria.join(", ")}`,
|
|
1044
|
+
})
|
|
1045
|
+
: null,
|
|
1046
|
+
]);
|
|
1047
|
+
|
|
1048
|
+
return [
|
|
1049
|
+
handled.length > 0
|
|
1050
|
+
? kit.el("ul", { class: "pm-cases" }, handled.map(item))
|
|
1051
|
+
: kit.el("p", { class: "pm-muted", text: "No edge cases are written yet." }),
|
|
1052
|
+
skipped.length > 0
|
|
1053
|
+
? kit.el("details", { class: "pm-details" }, [
|
|
1054
|
+
kit.el("summary", { text: `Does not apply (${skipped.length})` }),
|
|
1055
|
+
kit.el("ul", { class: "pm-cases" }, skipped.map(item)),
|
|
1056
|
+
])
|
|
1057
|
+
: null,
|
|
1058
|
+
];
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
function productProof(kit, proof) {
|
|
1062
|
+
return kit.el(
|
|
1063
|
+
"ul",
|
|
1064
|
+
{ class: "pm-proof" },
|
|
1065
|
+
proof.map((item) => {
|
|
1066
|
+
const status = PRODUCT_PROOF[item.status] ?? PRODUCT_PROOF["not-run"];
|
|
1067
|
+
|
|
1068
|
+
return kit.el("li", {}, [
|
|
1069
|
+
productLight(kit, status.level, status.label),
|
|
1070
|
+
kit.el("span", { text: item.text }),
|
|
1071
|
+
]);
|
|
1072
|
+
}),
|
|
1073
|
+
);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
function productFlowPage(ctx, kit, answer, lightbox) {
|
|
1077
|
+
const flow = answer.flow;
|
|
1078
|
+
const neighbour = (item, label) =>
|
|
1079
|
+
item === null
|
|
1080
|
+
? null
|
|
1081
|
+
: kit.link(
|
|
1082
|
+
`product/flow/${productEncode(flow.feature)}/${productEncode(item.id)}`,
|
|
1083
|
+
`${label}: ${item.heading ?? item.id}`,
|
|
1084
|
+
{
|
|
1085
|
+
class: "pm-button",
|
|
1086
|
+
},
|
|
1087
|
+
);
|
|
1088
|
+
const sections = [
|
|
1089
|
+
productBreadcrumb(kit, [
|
|
1090
|
+
{ text: "Product map", to: "product" },
|
|
1091
|
+
{ text: flow.featureTitle, to: `product/feature/${productEncode(flow.feature)}` },
|
|
1092
|
+
{ text: flow.title },
|
|
1093
|
+
]),
|
|
1094
|
+
kit.el("header", { class: "pm-title" }, [
|
|
1095
|
+
kit.el("div", { class: "pm-title-row" }, [
|
|
1096
|
+
kit.el("h2", { text: flow.title }),
|
|
1097
|
+
productStatusChip(kit, flow.status),
|
|
1098
|
+
]),
|
|
1099
|
+
kit.el("p", { class: "pm-lead", text: flow.summary ?? "No summary yet." }),
|
|
1100
|
+
kit.el("p", { class: "pm-muted", text: `For ${flow.who} · since version ${flow.since}` }),
|
|
1101
|
+
]),
|
|
1102
|
+
kit.el("section", { class: "pm-section pm-callout", "aria-label": "Health" }, [
|
|
1103
|
+
productHealth(kit, answer.health),
|
|
1104
|
+
]),
|
|
1105
|
+
productSection(kit, "How it goes", productStory(ctx, kit, answer.story, lightbox)),
|
|
1106
|
+
productSection(
|
|
1107
|
+
kit,
|
|
1108
|
+
"What proves it",
|
|
1109
|
+
answer.proof.length > 0
|
|
1110
|
+
? productProof(kit, answer.proof)
|
|
1111
|
+
: kit.el("p", { class: "pm-muted", text: "No checks are written for this flow yet." }),
|
|
1112
|
+
),
|
|
1113
|
+
productSection(kit, "What if…", kit.el("div", {}, productCases(kit, answer.cases))),
|
|
1114
|
+
productAppearances(ctx, kit, answer.appearances, lightbox, false),
|
|
1115
|
+
kit.el("nav", { class: "pm-neighbours", "aria-label": "Other flows of this feature" }, [
|
|
1116
|
+
neighbour(answer.previous, "Previous"),
|
|
1117
|
+
neighbour(answer.next, "Next"),
|
|
1118
|
+
]),
|
|
1119
|
+
];
|
|
1120
|
+
|
|
1121
|
+
return sections;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
/** A step's file counts, like the technical flow page: the type-only count only when there is one. */
|
|
1125
|
+
function productStepCounts(counts) {
|
|
1126
|
+
const parts = [
|
|
1127
|
+
`${counts.direct} direct`,
|
|
1128
|
+
`${counts.feature} in this feature`,
|
|
1129
|
+
`${counts.reachable} reachable`,
|
|
1130
|
+
];
|
|
1131
|
+
|
|
1132
|
+
if (counts.typeOnly > 0) parts.push(`${counts.typeOnly} type-only`);
|
|
1133
|
+
|
|
1134
|
+
return parts.join(" · ");
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
function productFlowDeveloper(ctx, kit, answer) {
|
|
1138
|
+
return () => [
|
|
1139
|
+
kit.el("h3", { class: "pm-section-title", text: "For developers" }),
|
|
1140
|
+
kit.link(`flows/${answer.flow.ref}`, "Open the technical flow page"),
|
|
1141
|
+
kit.el(
|
|
1142
|
+
"ol",
|
|
1143
|
+
{ class: "pm-tech-steps" },
|
|
1144
|
+
answer.developer.steps.map((step) =>
|
|
1145
|
+
kit.el("li", {}, [
|
|
1146
|
+
kit.el("strong", { text: `${step.type} ` }),
|
|
1147
|
+
kit.el("span", { class: "pm-mono", text: step.target }),
|
|
1148
|
+
step.entry ? kit.el("div", { class: "pm-mono pm-muted", text: step.entry }) : null,
|
|
1149
|
+
kit.el("div", {
|
|
1150
|
+
class: "pm-muted",
|
|
1151
|
+
text: productStepCounts(step.counts),
|
|
1152
|
+
}),
|
|
1153
|
+
]),
|
|
1154
|
+
),
|
|
1155
|
+
),
|
|
1156
|
+
];
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
// ── Entry points ──────────────────────────────────────────────────────────
|
|
1160
|
+
|
|
1161
|
+
/** The product map section for the hash route segments after `product`. */
|
|
1162
|
+
export async function productMapView(ctx, parts = []) {
|
|
1163
|
+
const kit = productKit(ctx);
|
|
1164
|
+
const { el } = kit;
|
|
1165
|
+
const root = el("div", { class: `pm-root${kit.shared ? " pm-shared" : ""}` });
|
|
1166
|
+
const lightbox = productLightbox(ctx, kit);
|
|
1167
|
+
|
|
1168
|
+
if (typeof ctx.asset === "function")
|
|
1169
|
+
root.append(el("link", { rel: "stylesheet", href: ctx.asset("product-map.css") }));
|
|
1170
|
+
|
|
1171
|
+
const main = el("main", { class: "pm-main", "aria-busy": "true" });
|
|
1172
|
+
const [kind, first, second] = parts.map(productDecode);
|
|
1173
|
+
|
|
1174
|
+
let answerHost = null;
|
|
1175
|
+
|
|
1176
|
+
root.append(main);
|
|
1177
|
+
|
|
1178
|
+
try {
|
|
1179
|
+
if (kind === "feature" && first) {
|
|
1180
|
+
const answer = await ctx.api(`product/features/${productEncode(first)}`);
|
|
1181
|
+
|
|
1182
|
+
answerHost = answer.host;
|
|
1183
|
+
const body = [
|
|
1184
|
+
productBreadcrumb(kit, [
|
|
1185
|
+
{ text: "Product map", to: "product" },
|
|
1186
|
+
{ text: answer.feature.title },
|
|
1187
|
+
]),
|
|
1188
|
+
...productFeaturePage(ctx, kit, answer, lightbox),
|
|
1189
|
+
];
|
|
1190
|
+
|
|
1191
|
+
if (!kit.shared && answer.developer) {
|
|
1192
|
+
const toggle = productDeveloperToggle(kit, productFeatureDeveloper(kit, answer.developer));
|
|
1193
|
+
|
|
1194
|
+
body.splice(1, 0, el("div", { class: "pm-toolbar" }, [toggle.button]));
|
|
1195
|
+
body.push(toggle.panel);
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
main.append(el("div", { class: "pm-page" }, body));
|
|
1199
|
+
} else if (kind === "flow" && first && second) {
|
|
1200
|
+
const answer = await ctx.api(
|
|
1201
|
+
`product/flows/${productEncode(first)}/${productEncode(second)}`,
|
|
1202
|
+
);
|
|
1203
|
+
|
|
1204
|
+
answerHost = answer.host;
|
|
1205
|
+
const body = productFlowPage(ctx, kit, answer, lightbox);
|
|
1206
|
+
|
|
1207
|
+
if (!kit.shared && answer.developer) {
|
|
1208
|
+
const toggle = productDeveloperToggle(kit, productFlowDeveloper(ctx, kit, answer));
|
|
1209
|
+
|
|
1210
|
+
body.splice(2, 0, el("div", { class: "pm-toolbar" }, [toggle.button]));
|
|
1211
|
+
body.push(toggle.panel);
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
main.append(el("div", { class: "pm-page" }, body));
|
|
1215
|
+
} else {
|
|
1216
|
+
const answer = await ctx.api("product");
|
|
1217
|
+
|
|
1218
|
+
answerHost = answer.host;
|
|
1219
|
+
main.append(productMapPage(ctx, kit, answer));
|
|
1220
|
+
}
|
|
1221
|
+
} catch (error) {
|
|
1222
|
+
main.append(
|
|
1223
|
+
productLoadError(
|
|
1224
|
+
ctx,
|
|
1225
|
+
kit,
|
|
1226
|
+
kind === "feature" ? "this feature" : kind === "flow" ? "this flow" : "the product map",
|
|
1227
|
+
error,
|
|
1228
|
+
),
|
|
1229
|
+
);
|
|
1230
|
+
}
|
|
1231
|
+
|
|
1232
|
+
main.setAttribute("aria-busy", "false");
|
|
1233
|
+
root.append(lightbox.dialog);
|
|
1234
|
+
|
|
1235
|
+
if (kit.shared) {
|
|
1236
|
+
const host = productHost(answerHost);
|
|
1237
|
+
const app =
|
|
1238
|
+
host && host.app && host.app.name
|
|
1239
|
+
? `${host.app.name}${host.app.version ? ` ${host.app.version}` : ""}`
|
|
1240
|
+
: null;
|
|
1241
|
+
|
|
1242
|
+
root.append(
|
|
1243
|
+
el("footer", { class: "pm-footer" }, [
|
|
1244
|
+
el("span", { text: "Read-only view" }),
|
|
1245
|
+
app ? el("span", { class: "pm-mono", text: app }) : null,
|
|
1246
|
+
host && host.name ? productBrandLine(kit, host) : null,
|
|
1247
|
+
]),
|
|
1248
|
+
);
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1251
|
+
return root;
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/** The shared page: the map with no developer detail and no links into the rest of the tab. */
|
|
1255
|
+
async function renderProductMap(context) {
|
|
1256
|
+
const parts = (context.route ?? "").split("/").filter(Boolean);
|
|
1257
|
+
|
|
1258
|
+
if (parts[0] === "share" && (parts.length === 1 || parts[1] === "feature" || parts[1] === "flow"))
|
|
1259
|
+
parts.shift();
|
|
1260
|
+
if (parts[0] === "product") parts.shift();
|
|
1261
|
+
|
|
1262
|
+
return productMapView({ ...context, shared: true }, parts);
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
export default renderProductMap;
|