@brunosouzas/stackledger 0.0.0-stage → 0.4.1
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/LICENSE +202 -0
- package/README.md +260 -2
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +97 -0
- package/dist/cli.js.map +1 -0
- package/dist/control.d.ts +2 -0
- package/dist/control.js +22 -0
- package/dist/control.js.map +1 -0
- package/dist/discover-command.d.ts +7 -0
- package/dist/discover-command.js +60 -0
- package/dist/discover-command.js.map +1 -0
- package/dist/discovery/annotations.d.ts +24 -0
- package/dist/discovery/annotations.js +37 -0
- package/dist/discovery/annotations.js.map +1 -0
- package/dist/discovery/host.d.ts +47 -0
- package/dist/discovery/host.js +56 -0
- package/dist/discovery/host.js.map +1 -0
- package/dist/discovery/index.d.ts +15 -0
- package/dist/discovery/index.js +30 -0
- package/dist/discovery/index.js.map +1 -0
- package/dist/discovery/machine.d.ts +14 -0
- package/dist/discovery/machine.js +17 -0
- package/dist/discovery/machine.js.map +1 -0
- package/dist/discovery/run.d.ts +39 -0
- package/dist/discovery/run.js +130 -0
- package/dist/discovery/run.js.map +1 -0
- package/dist/discovery/snapshot.d.ts +60 -0
- package/dist/discovery/snapshot.js +161 -0
- package/dist/discovery/snapshot.js.map +1 -0
- package/dist/discovery/sources/apps.d.ts +3 -0
- package/dist/discovery/sources/apps.js +136 -0
- package/dist/discovery/sources/apps.js.map +1 -0
- package/dist/discovery/sources/brew.d.ts +15 -0
- package/dist/discovery/sources/brew.js +69 -0
- package/dist/discovery/sources/brew.js.map +1 -0
- package/dist/discovery/sources/common.d.ts +39 -0
- package/dist/discovery/sources/common.js +70 -0
- package/dist/discovery/sources/common.js.map +1 -0
- package/dist/discovery/sources/index.d.ts +8 -0
- package/dist/discovery/sources/index.js +12 -0
- package/dist/discovery/sources/index.js.map +1 -0
- package/dist/discovery/sources/launchd.d.ts +3 -0
- package/dist/discovery/sources/launchd.js +65 -0
- package/dist/discovery/sources/launchd.js.map +1 -0
- package/dist/discovery/sources/mas.d.ts +9 -0
- package/dist/discovery/sources/mas.js +25 -0
- package/dist/discovery/sources/mas.js.map +1 -0
- package/dist/discovery/sources/mise.d.ts +5 -0
- package/dist/discovery/sources/mise.js +64 -0
- package/dist/discovery/sources/mise.js.map +1 -0
- package/dist/discovery/sources/npm.d.ts +12 -0
- package/dist/discovery/sources/npm.js +34 -0
- package/dist/discovery/sources/npm.js.map +1 -0
- package/dist/discovery/sources/pipx.d.ts +4 -0
- package/dist/discovery/sources/pipx.js +82 -0
- package/dist/discovery/sources/pipx.js.map +1 -0
- package/dist/discovery/types.d.ts +73 -0
- package/dist/discovery/types.js +10 -0
- package/dist/discovery/types.js.map +1 -0
- package/dist/discovery/write.d.ts +50 -0
- package/dist/discovery/write.js +196 -0
- package/dist/discovery/write.js.map +1 -0
- package/dist/drift-command.d.ts +62 -0
- package/dist/drift-command.js +375 -0
- package/dist/drift-command.js.map +1 -0
- package/dist/drift-formats.d.ts +3 -0
- package/dist/drift-formats.js +54 -0
- package/dist/drift-formats.js.map +1 -0
- package/dist/drift.d.ts +95 -0
- package/dist/drift.js +206 -0
- package/dist/drift.js.map +1 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +26 -0
- package/dist/errors.js.map +1 -0
- package/dist/graph.d.ts +103 -0
- package/dist/graph.js +181 -0
- package/dist/graph.js.map +1 -0
- package/dist/ics.d.ts +18 -0
- package/dist/ics.js +103 -0
- package/dist/ics.js.map +1 -0
- package/dist/identity.d.ts +18 -0
- package/dist/identity.js +36 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/map/badges.d.ts +20 -0
- package/dist/map/badges.js +95 -0
- package/dist/map/badges.js.map +1 -0
- package/dist/map/command.d.ts +8 -0
- package/dist/map/command.js +86 -0
- package/dist/map/command.js.map +1 -0
- package/dist/map/heap.d.ts +15 -0
- package/dist/map/heap.js +57 -0
- package/dist/map/heap.js.map +1 -0
- package/dist/map/ink.d.ts +11 -0
- package/dist/map/ink.js +10 -0
- package/dist/map/ink.js.map +1 -0
- package/dist/map/labels.d.ts +43 -0
- package/dist/map/labels.js +172 -0
- package/dist/map/labels.js.map +1 -0
- package/dist/map/layout.d.ts +59 -0
- package/dist/map/layout.js +197 -0
- package/dist/map/layout.js.map +1 -0
- package/dist/map/model.d.ts +46 -0
- package/dist/map/model.js +84 -0
- package/dist/map/model.js.map +1 -0
- package/dist/map/neighbourhood.d.ts +18 -0
- package/dist/map/neighbourhood.js +138 -0
- package/dist/map/neighbourhood.js.map +1 -0
- package/dist/map/parallel.d.ts +21 -0
- package/dist/map/parallel.js +174 -0
- package/dist/map/parallel.js.map +1 -0
- package/dist/map/relations.d.ts +39 -0
- package/dist/map/relations.js +127 -0
- package/dist/map/relations.js.map +1 -0
- package/dist/map/route.d.ts +25 -0
- package/dist/map/route.js +165 -0
- package/dist/map/route.js.map +1 -0
- package/dist/map/strip.d.ts +29 -0
- package/dist/map/strip.js +122 -0
- package/dist/map/strip.js.map +1 -0
- package/dist/map/suggest.d.ts +21 -0
- package/dist/map/suggest.js +97 -0
- package/dist/map/suggest.js.map +1 -0
- package/dist/map/svg.d.ts +22 -0
- package/dist/map/svg.js +232 -0
- package/dist/map/svg.js.map +1 -0
- package/dist/map/themes.d.ts +61 -0
- package/dist/map/themes.js +78 -0
- package/dist/map/themes.js.map +1 -0
- package/dist/map/xml.d.ts +8 -0
- package/dist/map/xml.js +68 -0
- package/dist/map/xml.js.map +1 -0
- package/dist/map/zones.d.ts +19 -0
- package/dist/map/zones.js +46 -0
- package/dist/map/zones.js.map +1 -0
- package/dist/mcp.d.ts +2 -0
- package/dist/mcp.js +145 -0
- package/dist/mcp.js.map +1 -0
- package/dist/money.d.ts +32 -0
- package/dist/money.js +91 -0
- package/dist/money.js.map +1 -0
- package/dist/report-command.d.ts +3 -0
- package/dist/report-command.js +85 -0
- package/dist/report-command.js.map +1 -0
- package/dist/report-formats.d.ts +11 -0
- package/dist/report-formats.js +157 -0
- package/dist/report-formats.js.map +1 -0
- package/dist/reports.d.ts +105 -0
- package/dist/reports.js +247 -0
- package/dist/reports.js.map +1 -0
- package/dist/scaffold.d.ts +30 -0
- package/dist/scaffold.js +140 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/schema.d.ts +330 -0
- package/dist/schema.js +116 -0
- package/dist/schema.js.map +1 -0
- package/dist/secrets.d.ts +7 -0
- package/dist/secrets.js +68 -0
- package/dist/secrets.js.map +1 -0
- package/dist/site/build.d.ts +22 -0
- package/dist/site/build.js +196 -0
- package/dist/site/build.js.map +1 -0
- package/dist/site/command.d.ts +2 -0
- package/dist/site/command.js +221 -0
- package/dist/site/command.js.map +1 -0
- package/dist/site/data.d.ts +205 -0
- package/dist/site/data.js +241 -0
- package/dist/site/data.js.map +1 -0
- package/dist/site/fs-ops.d.ts +35 -0
- package/dist/site/fs-ops.js +26 -0
- package/dist/site/fs-ops.js.map +1 -0
- package/dist/site/owners.d.ts +5 -0
- package/dist/site/owners.js +50 -0
- package/dist/site/owners.js.map +1 -0
- package/dist/site/paths.d.ts +34 -0
- package/dist/site/paths.js +48 -0
- package/dist/site/paths.js.map +1 -0
- package/dist/site/policy.d.ts +17 -0
- package/dist/site/policy.js +26 -0
- package/dist/site/policy.js.map +1 -0
- package/dist/site/publish.d.ts +14 -0
- package/dist/site/publish.js +90 -0
- package/dist/site/publish.js.map +1 -0
- package/dist/site/relative.d.ts +14 -0
- package/dist/site/relative.js +265 -0
- package/dist/site/relative.js.map +1 -0
- package/dist/site/skills-build.d.ts +22 -0
- package/dist/site/skills-build.js +126 -0
- package/dist/site/skills-build.js.map +1 -0
- package/dist/site/skills-data.d.ts +89 -0
- package/dist/site/skills-data.js +94 -0
- package/dist/site/skills-data.js.map +1 -0
- package/dist/site/staging.d.ts +19 -0
- package/dist/site/staging.js +76 -0
- package/dist/site/staging.js.map +1 -0
- package/dist/skills/command.d.ts +8 -0
- package/dist/skills/command.js +64 -0
- package/dist/skills/command.js.map +1 -0
- package/dist/skills/frontmatter.d.ts +37 -0
- package/dist/skills/frontmatter.js +219 -0
- package/dist/skills/frontmatter.js.map +1 -0
- package/dist/skills/graph.d.ts +39 -0
- package/dist/skills/graph.js +100 -0
- package/dist/skills/graph.js.map +1 -0
- package/dist/skills/ignore.d.ts +34 -0
- package/dist/skills/ignore.js +138 -0
- package/dist/skills/ignore.js.map +1 -0
- package/dist/skills/lines.d.ts +53 -0
- package/dist/skills/lines.js +221 -0
- package/dist/skills/lines.js.map +1 -0
- package/dist/skills/map-command.d.ts +28 -0
- package/dist/skills/map-command.js +533 -0
- package/dist/skills/map-command.js.map +1 -0
- package/dist/skills/mermaid.d.ts +29 -0
- package/dist/skills/mermaid.js +261 -0
- package/dist/skills/mermaid.js.map +1 -0
- package/dist/skills/metro.d.ts +8 -0
- package/dist/skills/metro.js +93 -0
- package/dist/skills/metro.js.map +1 -0
- package/dist/skills/read.d.ts +17 -0
- package/dist/skills/read.js +54 -0
- package/dist/skills/read.js.map +1 -0
- package/dist/skills/rules.d.ts +28 -0
- package/dist/skills/rules.js +57 -0
- package/dist/skills/rules.js.map +1 -0
- package/dist/skills/source.d.ts +66 -0
- package/dist/skills/source.js +281 -0
- package/dist/skills/source.js.map +1 -0
- package/dist/skills/walk.d.ts +64 -0
- package/dist/skills/walk.js +281 -0
- package/dist/skills/walk.js.map +1 -0
- package/dist/source.d.ts +40 -0
- package/dist/source.js +199 -0
- package/dist/source.js.map +1 -0
- package/dist/stdout.d.ts +2 -0
- package/dist/stdout.js +24 -0
- package/dist/stdout.js.map +1 -0
- package/dist/validate.d.ts +45 -0
- package/dist/validate.js +321 -0
- package/dist/validate.js.map +1 -0
- package/dist/views.d.ts +25 -0
- package/dist/views.js +58 -0
- package/dist/views.js.map +1 -0
- package/examples/catalogue-repository/.github/workflows/stackledger.yml +122 -0
- package/examples/catalogue-repository/README.md +96 -0
- package/examples/catalogue-repository/catalog/catalog-info.yaml +12 -0
- package/examples/hosting/Caddyfile +69 -0
- package/examples/northwind/catalog-info.yaml +680 -0
- package/examples/northwind/stackledger.yaml +16 -0
- package/examples/northwind-machine/snapshot.json +309 -0
- package/examples/northwind-skills/agents/builder.md +10 -0
- package/examples/northwind-skills/agents/reviewer.md +10 -0
- package/examples/northwind-skills/designer/SKILL.md +8 -0
- package/examples/northwind-skills/editor/SKILL.md +8 -0
- package/examples/northwind-skills/engineering/SKILL.md +12 -0
- package/examples/northwind-skills/linter/SKILL.md +8 -0
- package/examples/northwind-skills/linter/rules.md +5 -0
- package/examples/northwind-skills/publishing/SKILL.md +12 -0
- package/examples/northwind-skills/publishing/rules.md +5 -0
- package/examples/northwind-skills/spec-writer/SKILL.md +8 -0
- package/examples/northwind-skills/stackledger-skills.yaml +51 -0
- package/examples/northwind-skills/tester/SKILL.md +10 -0
- package/examples/northwind-skills/writer/SKILL.md +8 -0
- package/examples/northwind-skills/writer/rules.md +6 -0
- package/npm-shrinkwrap.json +4995 -0
- package/package.json +51 -4
- package/site/LICENSE-astroplate +21 -0
- package/site/README.md +18 -0
- package/site/package.json +6 -0
- package/site/public/favicon.svg +1 -0
- package/site/src/components/Footer.astro +25 -0
- package/site/src/components/Header.astro +35 -0
- package/site/src/components/Impact.astro +55 -0
- package/site/src/components/LinkOrText.astro +12 -0
- package/site/src/components/SkillItem.astro +141 -0
- package/site/src/components/SubNav.astro +40 -0
- package/site/src/components/ThemeSwitch.astro +16 -0
- package/site/src/components/Themed.astro +14 -0
- package/site/src/layouts/Base.astro +52 -0
- package/site/src/lib/site.ts +25 -0
- package/site/src/pages/[reports].astro +222 -0
- package/site/src/pages/agents/[file].astro +14 -0
- package/site/src/pages/index.astro +71 -0
- package/site/src/pages/journeys/[name].astro +50 -0
- package/site/src/pages/journeys/index.astro +37 -0
- package/site/src/pages/licences/[name].astro +56 -0
- package/site/src/pages/map/index.astro +78 -0
- package/site/src/pages/playbooks/[file].astro +14 -0
- package/site/src/pages/rules/[...rules].astro +61 -0
- package/site/src/pages/skill-map/[...map].astro +101 -0
- package/site/src/pages/skills/[...list].astro +75 -0
- package/site/src/pages/skills/[file].astro +14 -0
- package/site/src/pages/software/[name].astro +155 -0
- package/site/src/pages/software/index.astro +71 -0
- package/site/src/scripts/diagram.ts +8 -0
- package/site/src/scripts/links.ts +31 -0
- package/site/src/scripts/map.ts +133 -0
- package/site/src/scripts/software.ts +32 -0
- package/site/src/scripts/theme.ts +52 -0
- package/site/src/styles/base.css +470 -0
- package/site/src/styles/fonts.css +60 -0
- package/site/src/styles/override.css +1 -0
- package/site/src/styles/pages.css +299 -0
- package/site/src/styles/tokens.css +71 -0
- package/skills/stackledger/SKILL.md +155 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/** Strip diagram of one journey: its served stops in order on a straight line in the line's colour,
|
|
2
|
+
* with a badge for every other drawn line at each stop; plus the small badge SVG used in lists.
|
|
3
|
+
*
|
|
4
|
+
* Why: the site's journey pages (catalogue-site, "Journey pages"). Call strip(model, line) for the
|
|
5
|
+
* plain input, then renderStrip(input, themes.light); renderLineBadge(line) draws one badge.
|
|
6
|
+
* Pure functions, no I/O. Stops come from the map model, so they match the map exactly. The line
|
|
7
|
+
* is a pipe and the stops and badges are ink-style stickers (src/map/ink.ts), as on the map.
|
|
8
|
+
*
|
|
9
|
+
* Safety: every element goes through tag() and every catalogue text through escapeXml
|
|
10
|
+
* (src/map/xml.ts); colours must be #RRGGBB or tag() throws. Stops and interchange badges carry
|
|
11
|
+
* data-ref, which the page script turns into links; the page also lists them as text links.
|
|
12
|
+
*/
|
|
13
|
+
import { badgeWidth } from './badges.js';
|
|
14
|
+
import { sticker } from './ink.js';
|
|
15
|
+
import { textWidth } from './labels.js';
|
|
16
|
+
import { themes } from './themes.js';
|
|
17
|
+
import { escapeXml, SVG_NAMESPACE, tag } from './xml.js';
|
|
18
|
+
const PADDING = 32;
|
|
19
|
+
const LINE_Y = 56;
|
|
20
|
+
const MIN_SPACING = 150;
|
|
21
|
+
const LABEL_WIDTH = 170;
|
|
22
|
+
const BADGE_HEIGHT = 20;
|
|
23
|
+
// Wide enough that a badge's shadow and rim do not touch the next badge.
|
|
24
|
+
const BADGE_GAP = 11;
|
|
25
|
+
const STOP_HIT_MIN_WIDTH = 32;
|
|
26
|
+
/** Plain input for one drawn line: its stops with the other drawn lines that stop there, in line order. */
|
|
27
|
+
export function strip(model, line) {
|
|
28
|
+
const stations = new Map(model.stations.map(station => [station.ref, station]));
|
|
29
|
+
const byRef = new Map(model.lines.map(other => [other.ref, other]));
|
|
30
|
+
const badge = (other) => ({ ref: other.ref, badge: other.badge, color: other.color, title: other.title });
|
|
31
|
+
return {
|
|
32
|
+
ref: line.ref,
|
|
33
|
+
title: line.title,
|
|
34
|
+
badge: line.badge,
|
|
35
|
+
color: line.color,
|
|
36
|
+
stops: line.stops.map(ref => {
|
|
37
|
+
const station = stations.get(ref);
|
|
38
|
+
const interchanges = station.lines.filter(other => other !== line.ref).map(other => badge(byRef.get(other)));
|
|
39
|
+
return { ref, title: station.title, interchanges };
|
|
40
|
+
}),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/** Cut a label so it fits under its stop, ending with an ellipsis. */
|
|
44
|
+
function fit(title) {
|
|
45
|
+
if (textWidth(title) <= LABEL_WIDTH)
|
|
46
|
+
return title;
|
|
47
|
+
const chars = Array.from(title);
|
|
48
|
+
while (chars.length > 1 && textWidth(chars.join('') + '…') > LABEL_WIDTH)
|
|
49
|
+
chars.pop();
|
|
50
|
+
return chars.join('') + '…';
|
|
51
|
+
}
|
|
52
|
+
/** A badge as an ink-style sticker; `flat` leaves out the shadow and rim and keeps the outline inside the box. */
|
|
53
|
+
function badgeShape(item, x, y, theme, flat = false) {
|
|
54
|
+
const width = badgeWidth(item.badge);
|
|
55
|
+
const inset = flat ? theme.outlineWidth / 2 : 0;
|
|
56
|
+
const shape = (by, attrs) => tag('rect', { x: x + inset + by[0], y: y + inset + by[1], width: width - inset * 2, height: BADGE_HEIGHT - inset * 2, rx: BADGE_HEIGHT / 2 - inset, ...attrs });
|
|
57
|
+
const face = flat ? shape([0, 0], { fill: item.color, stroke: theme.outline, 'stroke-width': theme.outlineWidth }) : sticker(theme, shape, item.color);
|
|
58
|
+
return face
|
|
59
|
+
+ tag('text', { x: x + width / 2, y: y + 14.5, fill: theme.badgeText, 'font-size': 12, 'font-weight': 700, 'text-anchor': 'middle' }, escapeXml(item.badge));
|
|
60
|
+
}
|
|
61
|
+
/** One row of interchange badges centred under a stop; each badge links to its journey. */
|
|
62
|
+
function interchangeRow(stop, centre, y, theme) {
|
|
63
|
+
const total = stop.interchanges.reduce((sum, item) => sum + badgeWidth(item.badge), 0) + (stop.interchanges.length - 1) * BADGE_GAP;
|
|
64
|
+
let x = centre - total / 2;
|
|
65
|
+
return stop.interchanges.map(item => {
|
|
66
|
+
const shape = tag('title', {}, escapeXml(item.title)) + badgeShape(item, x, y, theme);
|
|
67
|
+
x += badgeWidth(item.badge) + BADGE_GAP;
|
|
68
|
+
return tag('g', { 'data-ref': item.ref, 'data-line': item.ref }, shape);
|
|
69
|
+
}).join('');
|
|
70
|
+
}
|
|
71
|
+
function stopGroup(input, stop, x, theme) {
|
|
72
|
+
const interchange = stop.interchanges.length > 0;
|
|
73
|
+
const disc = (r) => (by, attrs) => tag('circle', { cx: x + by[0], cy: LINE_Y + by[1], r, ...attrs });
|
|
74
|
+
// Every stop is a white circle sticker on the pipe, as on the map; an interchange is larger.
|
|
75
|
+
const marker = interchange
|
|
76
|
+
? sticker(theme, disc(stopRadius(theme) + 3), theme.station)
|
|
77
|
+
: sticker(theme, disc(stopRadius(theme)), theme.station);
|
|
78
|
+
const title = fit(stop.title);
|
|
79
|
+
const label = tag('text', { x, y: LINE_Y + 36, fill: theme.text, 'font-size': 13, 'font-weight': interchange ? 900 : 700, 'text-anchor': 'middle' }, escapeXml(title));
|
|
80
|
+
// An invisible area over the marker and its label, so a click between them still opens the stop.
|
|
81
|
+
const hitWidth = Math.max(STOP_HIT_MIN_WIDTH, textWidth(title) + 16);
|
|
82
|
+
const hit = tag('rect', { x: x - hitWidth / 2, y: LINE_Y - 18, width: hitWidth, height: 60, fill: theme.background, 'fill-opacity': 0 });
|
|
83
|
+
const lines = [input.ref, ...stop.interchanges.map(item => item.ref)].join(' ');
|
|
84
|
+
return tag('g', { 'data-ref': stop.ref, 'data-line': lines }, tag('title', {}, escapeXml(stop.title)) + hit + marker + label);
|
|
85
|
+
}
|
|
86
|
+
/** A stop circle a little wider than the pipe, as on the map. */
|
|
87
|
+
const stopRadius = (theme) => (theme.lineWidth + (theme.casing.enabled ? theme.casing.extraWidth : 0)) / 2 + 3;
|
|
88
|
+
/** The journey's line as a pipe: the ink casing, then the line's colour. */
|
|
89
|
+
function pipe(from, to, color, theme) {
|
|
90
|
+
const stroke = (paint, width) => tag('line', { x1: from, y1: LINE_Y, x2: to, y2: LINE_Y, stroke: paint, 'stroke-width': width, 'stroke-linecap': 'round' });
|
|
91
|
+
return (theme.casing.enabled ? stroke(theme.casing.color, theme.lineWidth + theme.casing.extraWidth) : '') + stroke(color, theme.lineWidth);
|
|
92
|
+
}
|
|
93
|
+
export function renderStrip(input, theme) {
|
|
94
|
+
const widest = input.stops.reduce((most, stop) => Math.max(most, textWidth(fit(stop.title))), 0);
|
|
95
|
+
const spacing = Math.max(MIN_SPACING, widest + 28);
|
|
96
|
+
const first = PADDING + spacing / 2;
|
|
97
|
+
const xs = input.stops.map((_, i) => first + i * spacing);
|
|
98
|
+
const last = xs.at(-1) ?? first;
|
|
99
|
+
const hasInterchanges = input.stops.some(stop => stop.interchanges.length > 0);
|
|
100
|
+
const width = last + spacing / 2 + PADDING;
|
|
101
|
+
const height = LINE_Y + (hasInterchanges ? 92 : 60);
|
|
102
|
+
// High enough that the badge's shadow clears the rim of an interchange at the end of the line.
|
|
103
|
+
const terminal = (x) => badgeShape(input, x - badgeWidth(input.badge) / 2, LINE_Y - 48, theme);
|
|
104
|
+
const body = [
|
|
105
|
+
tag('rect', { x: 0, y: 0, width, height, fill: theme.background }),
|
|
106
|
+
tag('g', { 'data-line': input.ref }, pipe(first, last, input.color, theme) + terminal(first) + terminal(last)),
|
|
107
|
+
...input.stops.map((stop, i) => stopGroup(input, stop, xs[i], theme)),
|
|
108
|
+
...input.stops.map((stop, i) => interchangeRow(stop, xs[i], LINE_Y + 50, theme)),
|
|
109
|
+
].join('');
|
|
110
|
+
const attrs = { xmlns: SVG_NAMESPACE, role: 'img', viewBox: `0 0 ${width} ${height}`, width, height, 'font-family': theme.font };
|
|
111
|
+
const head = tag('title', {}, escapeXml(`Stops of ${input.title}`))
|
|
112
|
+
+ tag('desc', {}, 'Stops in order, with the other journeys that stop at each.');
|
|
113
|
+
return tag('svg', attrs, head + body);
|
|
114
|
+
}
|
|
115
|
+
/** A badge on its own, for the journeys list and legends: the line's code on its colour. */
|
|
116
|
+
export function renderLineBadge(line) {
|
|
117
|
+
const width = badgeWidth(line.badge);
|
|
118
|
+
const attrs = { xmlns: SVG_NAMESPACE, role: 'img', viewBox: `0 0 ${width} ${BADGE_HEIGHT}`, width, height: BADGE_HEIGHT, 'font-family': themes.light.font };
|
|
119
|
+
// Badge text is white on the line colour in every theme, so one SVG serves both.
|
|
120
|
+
return tag('svg', attrs, tag('title', {}, escapeXml(line.title)) + badgeShape(line, 0, 0, themes.light, true));
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=strip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strip.js","sourceRoot":"","sources":["../../src/map/strip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAc,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,MAAM,EAAc,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,GA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AC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC;AACjH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Assign missing stations without moving stored points. Call suggestPositions(model).
|
|
2
|
+
* Local octile search expands only around the target, including far-away stored coordinates.
|
|
3
|
+
* All stored cells stay reserved; suggestions never modify the model or catalogue.
|
|
4
|
+
*/
|
|
5
|
+
import type { MapModel, Point } from './model.js';
|
|
6
|
+
export interface Suggestion {
|
|
7
|
+
ref: string;
|
|
8
|
+
point: Point;
|
|
9
|
+
}
|
|
10
|
+
export declare const pointKey: (point: Point) => string;
|
|
11
|
+
export declare const octile: (a: Point, b: Point) => number;
|
|
12
|
+
/**
|
|
13
|
+
* Rings searched around a target. With n taken cells, any window of side 2R+2 around a target, even
|
|
14
|
+
* clipped at column or row 0, holds more than n cells when R >= ceil(sqrt(n)) + 2, so a free cell
|
|
15
|
+
* always lies within R and the nearest-cell rule stays exact; only unsafe coordinates use the fallback.
|
|
16
|
+
*/
|
|
17
|
+
export declare const searchRadius: (taken: number) => number;
|
|
18
|
+
export declare function suggestPositions(model: MapModel): {
|
|
19
|
+
positions: Map<string, Point>;
|
|
20
|
+
suggestions: Suggestion[];
|
|
21
|
+
};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export const pointKey = (point) => point.join(',');
|
|
2
|
+
export const octile = (a, b) => {
|
|
3
|
+
const dx = Math.abs(a[0] - b[0]);
|
|
4
|
+
const dy = Math.abs(a[1] - b[1]);
|
|
5
|
+
return Math.max(dx, dy) + (Math.SQRT2 - 1) * Math.min(dx, dy);
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Rings searched around a target. With n taken cells, any window of side 2R+2 around a target, even
|
|
9
|
+
* clipped at column or row 0, holds more than n cells when R >= ceil(sqrt(n)) + 2, so a free cell
|
|
10
|
+
* always lies within R and the nearest-cell rule stays exact; only unsafe coordinates use the fallback.
|
|
11
|
+
*/
|
|
12
|
+
export const searchRadius = (taken) => Math.max(64, Math.ceil(Math.sqrt(taken)) + 2);
|
|
13
|
+
const usable = (x, y) => Number.isSafeInteger(x) && Number.isSafeInteger(y) && x >= 0 && y >= 0;
|
|
14
|
+
/** Placed or already-suggested stops right before or after any occurrence of `ref` on any line, each once. */
|
|
15
|
+
function neighbourPoints(model, ref, positions) {
|
|
16
|
+
const neighbours = new Set();
|
|
17
|
+
for (const line of model.lines) {
|
|
18
|
+
line.stops.forEach((stop, index) => {
|
|
19
|
+
if (stop !== ref)
|
|
20
|
+
return;
|
|
21
|
+
for (const neighbour of [line.stops[index - 1], line.stops[index + 1]]) {
|
|
22
|
+
if (neighbour && neighbour !== ref && positions.has(neighbour))
|
|
23
|
+
neighbours.add(neighbour);
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return [...neighbours].map(neighbour => positions.get(neighbour));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Free cell nearest the target by octile distance, ties by smaller row then smaller column.
|
|
31
|
+
* Only cells within searchRadius(taken.size) rings of the target with safe-integer, nonnegative
|
|
32
|
+
* coordinates are tried, so the search always ends; undefined when none is free.
|
|
33
|
+
*/
|
|
34
|
+
function nearestFreeCell(target, taken) {
|
|
35
|
+
let chosen;
|
|
36
|
+
let best = Infinity;
|
|
37
|
+
const column = Math.floor(target[0]);
|
|
38
|
+
const row = Math.floor(target[1]);
|
|
39
|
+
// A cell outside the visited square is at least radius units from the target.
|
|
40
|
+
const limit = searchRadius(taken.size);
|
|
41
|
+
for (let radius = 0; radius <= limit && radius <= best; radius++) {
|
|
42
|
+
for (let dy = -radius; dy <= radius + 1; dy++) {
|
|
43
|
+
for (let dx = -radius; dx <= radius + 1; dx++) {
|
|
44
|
+
const inner = dx > -radius && dx < radius + 1 && dy > -radius && dy < radius + 1;
|
|
45
|
+
if (radius && inner)
|
|
46
|
+
continue;
|
|
47
|
+
const x = column + dx;
|
|
48
|
+
const y = row + dy;
|
|
49
|
+
if (!usable(x, y) || taken.has(pointKey([x, y])))
|
|
50
|
+
continue;
|
|
51
|
+
const distance = octile([x, y], target);
|
|
52
|
+
const tie = chosen && Math.abs(distance - best) < 1e-9 && (y < chosen[1] || (y === chosen[1] && x < chosen[0]));
|
|
53
|
+
if (distance < best - 1e-9 || tie) {
|
|
54
|
+
best = distance;
|
|
55
|
+
chosen = [x, y];
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return chosen;
|
|
61
|
+
}
|
|
62
|
+
/** Fallback: the free cell in row 0 with the smallest column. Ends because `taken` is finite. */
|
|
63
|
+
function firstFreeInRowZero(taken) {
|
|
64
|
+
let column = 0;
|
|
65
|
+
while (taken.has(`${column},0`))
|
|
66
|
+
column++;
|
|
67
|
+
return [column, 0];
|
|
68
|
+
}
|
|
69
|
+
export function suggestPositions(model) {
|
|
70
|
+
const positions = new Map([...model.positions].map(([ref, point]) => [ref, [...point]]));
|
|
71
|
+
const taken = new Set(model.occupied.map(pointKey));
|
|
72
|
+
const suggestions = [];
|
|
73
|
+
let maxColumn = model.occupied.reduce((largest, point) => Math.max(largest, point[0]), -1);
|
|
74
|
+
for (const station of model.stations) {
|
|
75
|
+
if (positions.has(station.ref))
|
|
76
|
+
continue;
|
|
77
|
+
const neighbours = neighbourPoints(model, station.ref, positions);
|
|
78
|
+
let chosen;
|
|
79
|
+
if (neighbours.length) {
|
|
80
|
+
const target = [
|
|
81
|
+
neighbours.reduce((sum, point) => sum + point[0], 0) / neighbours.length,
|
|
82
|
+
neighbours.reduce((sum, point) => sum + point[1], 0) / neighbours.length,
|
|
83
|
+
];
|
|
84
|
+
chosen = nearestFreeCell(target, taken);
|
|
85
|
+
}
|
|
86
|
+
else if (usable(maxColumn + 1, 0) && !taken.has(`${maxColumn + 1},0`)) {
|
|
87
|
+
chosen = [maxColumn + 1, 0];
|
|
88
|
+
}
|
|
89
|
+
chosen ??= firstFreeInRowZero(taken);
|
|
90
|
+
taken.add(pointKey(chosen));
|
|
91
|
+
positions.set(station.ref, chosen);
|
|
92
|
+
maxColumn = Math.max(maxColumn, chosen[0]);
|
|
93
|
+
suggestions.push({ ref: station.ref, point: chosen });
|
|
94
|
+
}
|
|
95
|
+
return { positions, suggestions };
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=suggest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"suggest.js","sourceRoot":"","sources":["../../src/map/suggest.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAY,EAAU,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAElE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAQ,EAAE,CAAQ,EAAU,EAAE;IACnD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAErG,MAAM,MAAM,GAAG,CAAC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,22 @@
|
|
|
1
|
+
/** Render plain geometry as a self-contained, safe SVG. Call renderSvg(geometry, themes.light).
|
|
2
|
+
* Text has one escaping path; geometry has no external resources, IDs, links or CSS.
|
|
3
|
+
* Every visual choice comes from Theme data. Invalid colours/nonfinite geometry throw.
|
|
4
|
+
* Ink style (theme casing, outline, shadow, rim): lines are pipes, an ink casing under the line
|
|
5
|
+
* colour; interchanges, badges, licence markers, renewal rings and the legend panel get an ink
|
|
6
|
+
* outline, and their hard shadow is a copy moved by the theme offset, drawn first in the same group.
|
|
7
|
+
* Strokes, stations, labels, terminal badges and legend entries carry data-line (and stations
|
|
8
|
+
* and labels data-zone) for the site's map script; those values are escaped like text.
|
|
9
|
+
* renderSvg(geometry, theme, { chrome: false }) leaves out the title band and the legend panel and
|
|
10
|
+
* crops to the map frame: the site's map page shows the title, the line legend and the symbols in
|
|
11
|
+
* HTML (renderSymbol draws one symbol). The default output is what `stackledger map` writes.
|
|
12
|
+
*/
|
|
13
|
+
import { type MapGeometry } from './layout.js';
|
|
14
|
+
import type { Theme } from './themes.js';
|
|
15
|
+
export { escapeXml } from './xml.js';
|
|
16
|
+
/** chrome (default true): draw the title band and the legend panel around the map. */
|
|
17
|
+
export interface RenderOptions {
|
|
18
|
+
chrome?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** One legend symbol on its own (24 x 24), for the HTML legend under the site's map. */
|
|
21
|
+
export declare function renderSymbol(symbol: string, theme: Theme): string;
|
|
22
|
+
export declare function renderSvg(geometry: MapGeometry, theme: Theme, options?: RenderOptions): string;
|
package/dist/map/svg.js
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/** Render plain geometry as a self-contained, safe SVG. Call renderSvg(geometry, themes.light).
|
|
2
|
+
* Text has one escaping path; geometry has no external resources, IDs, links or CSS.
|
|
3
|
+
* Every visual choice comes from Theme data. Invalid colours/nonfinite geometry throw.
|
|
4
|
+
* Ink style (theme casing, outline, shadow, rim): lines are pipes, an ink casing under the line
|
|
5
|
+
* colour; interchanges, badges, licence markers, renewal rings and the legend panel get an ink
|
|
6
|
+
* outline, and their hard shadow is a copy moved by the theme offset, drawn first in the same group.
|
|
7
|
+
* Strokes, stations, labels, terminal badges and legend entries carry data-line (and stations
|
|
8
|
+
* and labels data-zone) for the site's map script; those values are escaped like text.
|
|
9
|
+
* renderSvg(geometry, theme, { chrome: false }) leaves out the title band and the legend panel and
|
|
10
|
+
* crops to the map frame: the site's map page shows the title, the line legend and the symbols in
|
|
11
|
+
* HTML (renderSymbol draws one symbol). The default output is what `stackledger map` writes.
|
|
12
|
+
*/
|
|
13
|
+
import { RULE_COUNT_FONT_SIZE } from './layout.js';
|
|
14
|
+
import { badgeWidth } from './badges.js';
|
|
15
|
+
import { sticker } from './ink.js';
|
|
16
|
+
import { tag, escapeXml, number, color, tint, SVG_NAMESPACE } from './xml.js';
|
|
17
|
+
export { escapeXml } from './xml.js';
|
|
18
|
+
const HEADER_HEIGHT = 64;
|
|
19
|
+
const FRAME_MARGIN = 16;
|
|
20
|
+
/** A capsule (stadium) path: every point within r of the segment a-b, with half circles at both ends. */
|
|
21
|
+
function capsulePath(a, b, r) {
|
|
22
|
+
const length = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
23
|
+
const n = [-(b[1] - a[1]) / length * r, (b[0] - a[0]) / length * r];
|
|
24
|
+
const p = (point, sign) => `${number(point[0] + n[0] * sign)},${number(point[1] + n[1] * sign)}`;
|
|
25
|
+
const radius = number(r);
|
|
26
|
+
return `M${p(a, 1)} L${p(b, 1)} A${radius},${radius} 0 0 0 ${p(b, -1)} L${p(a, -1)} A${radius},${radius} 0 0 0 ${p(a, 1)} Z`;
|
|
27
|
+
}
|
|
28
|
+
/** Element builders bound to one theme. Catalogue text only ever passes through `text` or `title`. */
|
|
29
|
+
function painter(theme) {
|
|
30
|
+
const text = (value, x, y, attrs = {}) => tag('text', { x, y, fill: theme.text, 'font-size': 13, ...attrs }, escapeXml(value));
|
|
31
|
+
const title = (value) => tag('title', {}, escapeXml(value));
|
|
32
|
+
const rect = (box, attrs = {}) => tag('rect', { x: box.x, y: box.y, width: box.w, height: box.h, ...attrs });
|
|
33
|
+
const line = (a, b, attrs) => tag('line', { x1: a[0], y1: a[1], x2: b[0], y2: b[1], ...attrs });
|
|
34
|
+
const circle = (centre, r, attrs) => tag('circle', { cx: centre[0], cy: centre[1], r, ...attrs });
|
|
35
|
+
const add = (point, by, scale = 1) => [point[0] + by[0] * scale, point[1] + by[1] * scale];
|
|
36
|
+
const rimmed = (width) => width + (theme.rim.enabled ? theme.rim.width * 2 : 0);
|
|
37
|
+
const boxSticker = (box, rx, fill) => sticker(theme, (by, attrs) => rect({ ...box, x: box.x + by[0], y: box.y + by[1] }, { ...attrs, rx }), fill);
|
|
38
|
+
const discSticker = (centre, r, fill) => sticker(theme, (by, attrs) => circle(add(centre, by), r, attrs), fill);
|
|
39
|
+
/** A ring (renewal) drawn like a pipe bent round: rim and ink bands, then its colour. No shadow:
|
|
40
|
+
* around an interchange and its licence marker a second shadow only darkens the station. */
|
|
41
|
+
const ring = (centre, r, colour, width) => {
|
|
42
|
+
const ink = width + theme.outlineWidth;
|
|
43
|
+
const band = (stroke, strokeWidth) => circle(centre, r, { fill: 'none', stroke, 'stroke-width': strokeWidth });
|
|
44
|
+
return [
|
|
45
|
+
theme.rim.enabled ? band(theme.rim.color, rimmed(ink)) : '',
|
|
46
|
+
band(theme.outline, ink),
|
|
47
|
+
band(colour, width),
|
|
48
|
+
].join('');
|
|
49
|
+
};
|
|
50
|
+
/** Terminal badges are pill stickers, like the banner's labels. */
|
|
51
|
+
const badge = (item) => boxSticker(item.box, item.box.h / 2, item.color)
|
|
52
|
+
+ text(item.text, item.point[0], item.point[1] + 4.5, { fill: theme.badgeText, 'font-size': 12, 'font-weight': 700, 'text-anchor': 'middle' });
|
|
53
|
+
/** A stop is a circle sticker on its pipe; an interchange a capsule over all its lines. */
|
|
54
|
+
const marker = (item, muted) => {
|
|
55
|
+
const fill = muted ? theme.muted : theme.station;
|
|
56
|
+
const [a, b] = item.ends;
|
|
57
|
+
const length = Math.hypot(b[0] - a[0], b[1] - a[1]);
|
|
58
|
+
if (length < 1e-9)
|
|
59
|
+
return discSticker(a, item.radius, fill);
|
|
60
|
+
return sticker(theme, (by, attrs) => tag('path', { d: capsulePath(add(a, by), add(b, by), item.radius), ...attrs }), fill);
|
|
61
|
+
};
|
|
62
|
+
const licence = (centre, hollow) => discSticker(centre, 5, hollow ? theme.station : theme.licence);
|
|
63
|
+
/** A rule count: a circle for one digit, a pill for more, in the panel colour, with the number. */
|
|
64
|
+
const ruleCount = (item) => {
|
|
65
|
+
const { box } = item;
|
|
66
|
+
const shape = box.w === box.h ? discSticker([box.x + box.w / 2, box.y + box.h / 2], box.h / 2, theme.panel) : boxSticker(box, box.h / 2, theme.panel);
|
|
67
|
+
return shape + text(item.text, box.x + box.w / 2, box.y + box.h / 2 + 4, { 'font-size': RULE_COUNT_FONT_SIZE, 'font-weight': 700, 'text-anchor': 'middle' });
|
|
68
|
+
};
|
|
69
|
+
/** A line sample for the legend, drawn as a pipe like the lines on the map. */
|
|
70
|
+
const pipe = (a, b, colour) => (theme.casing.enabled ? line(a, b, { stroke: theme.casing.color, 'stroke-width': theme.lineWidth + theme.casing.extraWidth, 'stroke-linecap': 'round' }) : '')
|
|
71
|
+
+ line(a, b, { stroke: colour, 'stroke-width': theme.lineWidth, 'stroke-linecap': 'round' });
|
|
72
|
+
return { text, title, rect, line, circle, boxSticker, discSticker, ring, badge, marker, licence, ruleCount, pipe };
|
|
73
|
+
}
|
|
74
|
+
function gridLayer(frame, theme, paint) {
|
|
75
|
+
const parts = [paint.rect(frame, { fill: 'none', stroke: theme.grid, 'stroke-width': 1 })];
|
|
76
|
+
for (let i = 1; i < 6; i++) {
|
|
77
|
+
const x = frame.x + frame.w * i / 6;
|
|
78
|
+
parts.push(paint.line([x, frame.y], [x, frame.y + frame.h], { stroke: theme.grid, 'stroke-width': 1 }));
|
|
79
|
+
}
|
|
80
|
+
for (let i = 1; i < 4; i++) {
|
|
81
|
+
const y = frame.y + frame.h * i / 4;
|
|
82
|
+
parts.push(paint.line([frame.x, y], [frame.x + frame.w, y], { stroke: theme.grid, 'stroke-width': 1 }));
|
|
83
|
+
}
|
|
84
|
+
return parts.join('');
|
|
85
|
+
}
|
|
86
|
+
function zoneShape(zone, paint) {
|
|
87
|
+
color(zone.color);
|
|
88
|
+
if (zone.hull.length === 1)
|
|
89
|
+
return paint.circle(zone.hull[0], zone.padding, { fill: zone.color });
|
|
90
|
+
if (zone.hull.length === 2) {
|
|
91
|
+
return paint.line(zone.hull[0], zone.hull[1], { stroke: zone.color, 'stroke-width': zone.padding * 2, 'stroke-linecap': 'round' });
|
|
92
|
+
}
|
|
93
|
+
const points = zone.hull.map(point => point.map(number).join(',')).join(' ');
|
|
94
|
+
return tag('polygon', { points, fill: zone.color, stroke: zone.color, 'stroke-width': zone.padding * 2, 'stroke-linejoin': 'round' });
|
|
95
|
+
}
|
|
96
|
+
function zonesLayer(zones, theme, paint) {
|
|
97
|
+
return zones.map(zone => {
|
|
98
|
+
const titleColor = tint(zone.color, theme.zoneTitleTint);
|
|
99
|
+
const title = paint.text(zone.title, zone.titleBox.x, zone.titleBox.y + 13, { fill: titleColor, 'font-weight': 700 });
|
|
100
|
+
return tag('g', { opacity: theme.zoneOpacity }, zoneShape(zone, paint)) + title;
|
|
101
|
+
}).join('');
|
|
102
|
+
}
|
|
103
|
+
function lineGroup(stroke, theme, paint) {
|
|
104
|
+
const d = stroke.points.map((point, i) => `${i ? 'L' : 'M'}${number(point[0])},${number(point[1])}`).join(' ');
|
|
105
|
+
const path = (paintColor, width) => tag('path', { d, fill: 'none', stroke: paintColor, 'stroke-width': width, 'stroke-linejoin': 'round', 'stroke-linecap': 'round' });
|
|
106
|
+
const casing = theme.casing.enabled ? path(theme.casing.color, theme.lineWidth + theme.casing.extraWidth) : '';
|
|
107
|
+
return tag('g', { 'data-ref': stroke.ref, 'data-line': stroke.ref }, paint.title(stroke.title) + casing + path(stroke.color, theme.lineWidth));
|
|
108
|
+
}
|
|
109
|
+
/** data-line (the station's lines, in line order) and data-zone (only for a drawn zone), shared by a station and its label. */
|
|
110
|
+
function stationData(station, drawnZones) {
|
|
111
|
+
const attrs = { 'data-line': station.lines.join(' ') };
|
|
112
|
+
const zones = station.zones.filter(zone => drawnZones.has(zone));
|
|
113
|
+
if (zones.length)
|
|
114
|
+
attrs['data-zone'] = zones.join(' ');
|
|
115
|
+
return attrs;
|
|
116
|
+
}
|
|
117
|
+
function stationGroup(station, data, theme, paint) {
|
|
118
|
+
const { box, halo } = station.marker;
|
|
119
|
+
const centre = [box.x + box.w / 2, box.y + box.h / 2];
|
|
120
|
+
const mark = paint.marker(station.marker, station.deprecated);
|
|
121
|
+
const suggested = station.suggested
|
|
122
|
+
? paint.circle(centre, halo + 3, { fill: 'none', stroke: theme.muted, 'stroke-width': 1.5, 'stroke-dasharray': '4 3' })
|
|
123
|
+
: '';
|
|
124
|
+
const ring = station.renewal ? paint.ring(centre, halo, theme.renewal, 3) : '';
|
|
125
|
+
const licence = station.licencePoint ? paint.licence(station.licencePoint, station.licence === 'hollow') : '';
|
|
126
|
+
const rules = station.ruleCount ? paint.ruleCount(station.ruleCount) : '';
|
|
127
|
+
return tag('g', { 'data-ref': station.ref, ...data }, paint.title(station.title) + suggested + ring + mark + licence + rules);
|
|
128
|
+
}
|
|
129
|
+
function labelsLayer(geometry, drawnZones, theme, paint) {
|
|
130
|
+
return geometry.labels.map(label => {
|
|
131
|
+
const station = geometry.stations.find(item => item.ref === label.ref);
|
|
132
|
+
const attrs = { fill: station.deprecated ? theme.muted : theme.text, 'font-weight': station.lines.length > 1 ? 900 : 700, ...stationData(station, drawnZones) };
|
|
133
|
+
return label.rows.map((row, i) => paint.text(row, label.box.x, label.box.y + 13 + i * 17, attrs)).join('');
|
|
134
|
+
}).join('');
|
|
135
|
+
}
|
|
136
|
+
/** The fixed texts of each kind of map; a skills map depends on no view (metro-map, Skills map drawing). */
|
|
137
|
+
function texts(geometry) {
|
|
138
|
+
return geometry.kind === 'skills'
|
|
139
|
+
? { title: 'Skills map', subtitle: 'stackledger · skill set', empty: 'No skill lines yet', description: 'Skill lines, stations and playbook zones.' }
|
|
140
|
+
: { title: 'Software map', subtitle: `stackledger · ${geometry.view} view`, empty: 'No journeys yet', description: 'Software journeys, stations, licences and zones.' };
|
|
141
|
+
}
|
|
142
|
+
function headerLayer(geometry, theme, paint) {
|
|
143
|
+
const { viewBox } = geometry;
|
|
144
|
+
return paint.rect({ x: viewBox.x, y: viewBox.y, w: viewBox.w, h: HEADER_HEIGHT }, { fill: theme.header })
|
|
145
|
+
+ paint.text(texts(geometry).title, viewBox.x + 32, viewBox.y + 42, { fill: theme.headerText, 'font-size': 29, 'font-weight': 700 })
|
|
146
|
+
+ paint.text(texts(geometry).subtitle, viewBox.x + 320, viewBox.y + 40, { fill: theme.headerText });
|
|
147
|
+
}
|
|
148
|
+
function legendSymbol(symbol, centre, theme, paint) {
|
|
149
|
+
if (symbol === 'interchange')
|
|
150
|
+
return paint.discSticker(centre, 6, theme.station);
|
|
151
|
+
if (symbol === 'licence' || symbol === 'licence to buy')
|
|
152
|
+
return paint.licence(centre, symbol === 'licence to buy');
|
|
153
|
+
// A little smaller than on the map, so the dark theme's rim and shadow stay inside the 24 x 24 symbol.
|
|
154
|
+
if (symbol === 'number of rules')
|
|
155
|
+
return paint.ruleCount({ text: '3', box: { x: centre[0] - 7.5, y: centre[1] - 7.5, w: 15, h: 15 } });
|
|
156
|
+
if (symbol === 'suggested position') {
|
|
157
|
+
return paint.circle(centre, 9, { fill: 'none', stroke: theme.muted, 'stroke-width': 1.5, 'stroke-dasharray': '4 3' });
|
|
158
|
+
}
|
|
159
|
+
return paint.ring(centre, 6.5, theme.renewal, 3);
|
|
160
|
+
}
|
|
161
|
+
function legendLayer(geometry, theme, paint) {
|
|
162
|
+
const panel = geometry.legend.box;
|
|
163
|
+
const parts = [];
|
|
164
|
+
let y = panel.y + 28;
|
|
165
|
+
parts.push(paint.boxSticker(panel, 12, theme.panel));
|
|
166
|
+
parts.push(paint.text('Lines (journeys)', panel.x + 18, y, { 'font-size': 16, 'font-weight': 700 }));
|
|
167
|
+
y += 30;
|
|
168
|
+
for (const item of geometry.legend.lines) {
|
|
169
|
+
// The same badge width as on the map; the sample and title move right of wider badges.
|
|
170
|
+
const box = { x: panel.x + 18, y: y - 15, w: badgeWidth(item.badge), h: 20 };
|
|
171
|
+
const right = box.x + box.w;
|
|
172
|
+
const entry = paint.badge({ point: [box.x + box.w / 2, y - 5], box, text: item.badge, color: item.color })
|
|
173
|
+
+ paint.pipe([right + 21, y - 5], [right + 44, y - 5], item.color)
|
|
174
|
+
+ paint.text(item.title, right + 60, y);
|
|
175
|
+
parts.push(tag('g', { 'data-line': item.ref }, entry));
|
|
176
|
+
y += 30;
|
|
177
|
+
}
|
|
178
|
+
y += 18;
|
|
179
|
+
parts.push(paint.text('Symbols', panel.x + 18, y, { 'font-size': 16, 'font-weight': 700 }));
|
|
180
|
+
y += 30;
|
|
181
|
+
for (const symbol of geometry.legend.symbols) {
|
|
182
|
+
parts.push(legendSymbol(symbol, [panel.x + 28, y - 4], theme, paint));
|
|
183
|
+
parts.push(paint.text(symbol[0].toUpperCase() + symbol.slice(1), panel.x + 52, y));
|
|
184
|
+
y += 32;
|
|
185
|
+
}
|
|
186
|
+
return parts.join('');
|
|
187
|
+
}
|
|
188
|
+
/** The frame with a small margin: the viewBox of a map drawn without title band and legend. */
|
|
189
|
+
function frameView(geometry) {
|
|
190
|
+
const { frame } = geometry;
|
|
191
|
+
return { x: frame.x - FRAME_MARGIN, y: frame.y - FRAME_MARGIN, w: frame.w + FRAME_MARGIN * 2, h: frame.h + FRAME_MARGIN * 2 };
|
|
192
|
+
}
|
|
193
|
+
/** One legend symbol on its own (24 x 24), for the HTML legend under the site's map. */
|
|
194
|
+
export function renderSymbol(symbol, theme) {
|
|
195
|
+
const size = 24;
|
|
196
|
+
const attrs = { xmlns: SVG_NAMESPACE, role: 'img', viewBox: `0 0 ${size} ${size}`, width: size, height: size };
|
|
197
|
+
// Up and left of the centre, so the shadow down and to the right stays inside the square.
|
|
198
|
+
return tag('svg', attrs, legendSymbol(symbol, [size / 2 - 1.5, size / 2 - 1.5], theme, painter(theme)));
|
|
199
|
+
}
|
|
200
|
+
export function renderSvg(geometry, theme, options = {}) {
|
|
201
|
+
const chrome = options.chrome ?? true;
|
|
202
|
+
const viewBox = chrome ? geometry.viewBox : frameView(geometry);
|
|
203
|
+
const paint = painter(theme);
|
|
204
|
+
const background = paint.rect(viewBox, { fill: theme.background });
|
|
205
|
+
const drawnZones = new Set(geometry.zones.map(zone => zone.name.toLowerCase()));
|
|
206
|
+
const badges = geometry.badges.map(badge => tag('g', { 'data-line': badge.line }, paint.badge(badge))).join('');
|
|
207
|
+
const lines = geometry.lines.map(stroke => lineGroup(stroke, theme, paint)).join('') + badges;
|
|
208
|
+
const stations = geometry.stations
|
|
209
|
+
.map(station => stationGroup(station, stationData(station, drawnZones), theme, paint))
|
|
210
|
+
.join('');
|
|
211
|
+
const empty = geometry.lines.length ? '' : paint.text(texts(geometry).empty, geometry.frame.x + 32, geometry.frame.y + 64, { 'font-size': 22 });
|
|
212
|
+
const layers = [
|
|
213
|
+
background,
|
|
214
|
+
gridLayer(geometry.frame, theme, paint),
|
|
215
|
+
zonesLayer(geometry.zones, theme, paint),
|
|
216
|
+
lines,
|
|
217
|
+
stations,
|
|
218
|
+
labelsLayer(geometry, drawnZones, theme, paint) + empty,
|
|
219
|
+
...(chrome ? [headerLayer(geometry, theme, paint), legendLayer(geometry, theme, paint)] : []),
|
|
220
|
+
].map(content => tag('g', {}, content)).join('\n');
|
|
221
|
+
const attrs = {
|
|
222
|
+
xmlns: SVG_NAMESPACE,
|
|
223
|
+
role: 'img',
|
|
224
|
+
viewBox: [viewBox.x, viewBox.y, viewBox.w, viewBox.h].map(number).join(' '),
|
|
225
|
+
width: viewBox.w,
|
|
226
|
+
height: viewBox.h,
|
|
227
|
+
'font-family': theme.font,
|
|
228
|
+
};
|
|
229
|
+
const head = tag('title', {}, texts(geometry).title) + tag('desc', {}, texts(geometry).description);
|
|
230
|
+
return tag('svg', attrs, head + '\n' + layers);
|
|
231
|
+
}
|
|
232
|
+
//# sourceMappingURL=svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg.js","sourceRoot":"","sources":["../../src/map/svg.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,oBAAoB,EAAmF,MAAM,aAAa,CAAC;AAMpI,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,aAAa,EAAmB,MAAM,UAAU,CAAC;AAE/F,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,yGAAyG;AACzG,SAAS,WAAW,CAAC,CAAQ,EAAE,CAAQ,EAAE,CAAS;IAChD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,MAAM,CAAC,GAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,CAAC,CAAC,CAAC;IAC3E,MAAM,CAAC,GAAG,CAAC,KAAY,EAAE,IAAY,EAAE,EAAE,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Ae;QACxB,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,KAAK;QACX,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAC3E,KAAK,EAAE,OAAO,CAAC,CAAC;QAChB,MAAM,EAAE,OAAO,CAAC,CAAC;QACjB,aAAa,EAAE,KAAK,CAAC,IAAI;KAC1B,CAAC;IACF,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC;IACpG,OAAO,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/** All visual constants for the two supported themes. The renderers consume only Theme data.
|
|
2
|
+
* Both themes follow the illustrated diagrams of brunosouzas.com: ink outlines, pipe lines with an
|
|
3
|
+
* ink casing, hard offset shadows (indigo with a light rim on the dark navy) and the Lato font stack.
|
|
4
|
+
* Extend data for later styles; no name-based renderer branches. No fonts or other assets are
|
|
5
|
+
* fetched at render time: the stack names Lato, which the site ships, then system fonts.
|
|
6
|
+
*/
|
|
7
|
+
import type { Box } from './labels.js';
|
|
8
|
+
export interface Theme {
|
|
9
|
+
background: string;
|
|
10
|
+
text: string;
|
|
11
|
+
muted: string;
|
|
12
|
+
grid: string;
|
|
13
|
+
header: string;
|
|
14
|
+
headerText: string;
|
|
15
|
+
station: string;
|
|
16
|
+
/** Ink of outlines, casings and the text on light fills (badges keep `badgeText`). */
|
|
17
|
+
outline: string;
|
|
18
|
+
/** Stroke width of the ink outline around markers, badges and panels, in map units. */
|
|
19
|
+
outlineWidth: number;
|
|
20
|
+
licence: string;
|
|
21
|
+
renewal: string;
|
|
22
|
+
badgeText: string;
|
|
23
|
+
panel: string;
|
|
24
|
+
/** Fill of the item in the centre of the neighbourhood diagram. */
|
|
25
|
+
accent: string;
|
|
26
|
+
font: string;
|
|
27
|
+
lineWidth: number;
|
|
28
|
+
zoneOpacity: number;
|
|
29
|
+
/** Zone titles mix the zone colour with white by this amount (0 keeps the catalogue colour). */
|
|
30
|
+
zoneTitleTint: number;
|
|
31
|
+
casing: {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
color: string;
|
|
34
|
+
extraWidth: number;
|
|
35
|
+
};
|
|
36
|
+
shadow: {
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
color: string;
|
|
39
|
+
dx: number;
|
|
40
|
+
dy: number;
|
|
41
|
+
};
|
|
42
|
+
/** A light band around the ink outline of stickers, so the outline reads on a dark background. */
|
|
43
|
+
rim: {
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
color: string;
|
|
46
|
+
width: number;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export declare const themes: Readonly<Record<'light' | 'dark', Theme>>;
|
|
50
|
+
/** How far a theme's ink reaches beyond plain geometry: the extra width of a line's casing, the
|
|
51
|
+
* full width of an outline with its rim, and the shadow offset. Layout grows obstacles by it. */
|
|
52
|
+
export interface Ink {
|
|
53
|
+
casing: number;
|
|
54
|
+
outline: number;
|
|
55
|
+
shadow: [number, number];
|
|
56
|
+
}
|
|
57
|
+
export declare function inkOf(theme: Theme): Ink;
|
|
58
|
+
/** The ink that covers every given one, so one layout serves several themes. */
|
|
59
|
+
export declare function widestInk(...inks: Ink[]): Ink;
|
|
60
|
+
/** A box as drawn with the ink: the outline (with its rim) on every side, the shadow offset beyond it. */
|
|
61
|
+
export declare function inkBox(box: Box, ink: Ink): Box;
|