@venizia/vulcan 0.4.10-2 → 0.4.10-21
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/README.md +30 -23
- package/base/checks/wiki-source-links.ts +17 -1
- package/base/claude/events.json +1 -11
- package/base/claude/settings.json +5 -76
- package/base/extensions/vulcan-guards.ts +81 -18
- package/base/hooks/guard-git.ts +95 -19
- package/base/hooks/guard-outside.ts +163 -43
- package/base/hooks/guard-writes.ts +15 -36
- package/base/hooks/session-start.ts +1 -1
- package/base/make/vulcan.mk +8 -5
- package/base/packs/venizia.md +16 -0
- package/base/references/delegation-brief.md +3 -5
- package/base/references/testing.md +1 -9
- package/base/rules.md +33 -38
- package/base/skills/build-a-feature/SKILL.md +4 -4
- package/base/skills/docs-update/SKILL.md +19 -8
- package/base/skills/fix-a-bug/SKILL.md +4 -2
- package/base/skills/plan-a-change/SKILL.md +1 -1
- package/base/skills/research/SKILL.md +1 -1
- package/base/skills/retro/SKILL.md +2 -2
- package/base/skills/review-a-change/SKILL.md +1 -1
- package/base/skills/visualize-work/SKILL.md +3 -3
- package/base/skills/visualize-work/references/spec.md +6 -3
- package/base/templates/AGENTS.md +9 -7
- package/base/templates/board.html +10 -110
- package/package.json +3 -3
- package/src/agents/atlas-block.ts +8 -31
- package/src/agents/codex-hooks.ts +1 -1
- package/src/agents/generated-block.ts +52 -0
- package/src/agents/hooks-json.ts +22 -3
- package/src/agents/index.ts +2 -0
- package/src/agents/render.ts +15 -2
- package/src/agents/resolve.ts +1 -0
- package/src/agents/rules-block.ts +92 -0
- package/src/board/command.ts +92 -30
- package/src/board/common/constants.ts +26 -0
- package/src/board/common/types.ts +10 -3
- package/src/board/fold.ts +1 -1
- package/src/board/github.ts +1 -2
- package/src/board/gitlab.ts +436 -0
- package/src/board/index.ts +1 -0
- package/src/board/logo.ts +49 -0
- package/src/board/open-file.ts +110 -0
- package/src/board/page.ts +57 -5
- package/src/board/schema.ts +4 -1
- package/src/board/server.ts +87 -3
- package/src/board/settings.ts +21 -24
- package/src/commands/changelog.command.ts +40 -0
- package/src/commands/clean.command.ts +6 -1
- package/src/commands/help.command.ts +2 -63
- package/src/commands/index.ts +6 -1
- package/src/commands/migrate.command.ts +71 -0
- package/src/commands/profile.command.ts +1 -1
- package/src/commands/runners.command.ts +43 -0
- package/src/commands/sync.command.ts +8 -4
- package/src/commands/table.ts +362 -0
- package/src/commit/check.ts +1 -0
- package/src/commit/common/constants.ts +4 -0
- package/src/commit/hook.ts +112 -8
- package/src/common/constants.ts +11 -9
- package/src/common/env-variables.ts +41 -0
- package/src/common/index.ts +1 -0
- package/src/common/layout-folder.ts +3 -4
- package/src/common/record.ts +5 -0
- package/src/config/common/constants.ts +28 -22
- package/src/config/loader.ts +22 -0
- package/src/config/schema.ts +330 -146
- package/src/create/add-app.ts +7 -2
- package/src/create/add-lib.ts +2 -4
- package/src/create/common/constants.ts +5 -3
- package/src/create/preset.ts +1 -0
- package/src/create/scratch.ts +2 -1
- package/src/doctor/checks.ts +277 -448
- package/src/doctor/common/constants.ts +27 -19
- package/src/doctor/private-values.ts +4 -1
- package/src/doctor/runner.ts +5 -12
- package/src/doctor/schema.ts +4 -0
- package/src/events/common/actor-names.ts +12 -0
- package/src/events/common/constants.ts +65 -38
- package/src/events/common/index.ts +1 -0
- package/src/events/hook.ts +5 -56
- package/src/events/text.ts +41 -6
- package/src/hooks/command-view.ts +80 -19
- package/src/hooks/common/constants.ts +26 -17
- package/src/hooks/common/types.ts +13 -24
- package/src/hooks/decision.ts +30 -12
- package/src/hooks/git-queries.ts +113 -0
- package/src/hooks/guard-git.ts +76 -24
- package/src/hooks/guard-outside.ts +334 -311
- package/src/hooks/guard-runner.ts +206 -0
- package/src/hooks/guard-writes.ts +87 -184
- package/src/hooks/hook-input.ts +57 -0
- package/src/hooks/index.ts +3 -6
- package/src/hooks/link-makers.ts +315 -0
- package/src/hooks/package-runners.ts +268 -0
- package/src/hooks/project-guards.ts +81 -44
- package/src/hooks/project-tmp.ts +39 -4
- package/src/hooks/runner-scan.ts +257 -0
- package/src/hooks/script-runners.ts +400 -0
- package/src/hooks/session-digest.ts +27 -117
- package/src/hooks/shell-folders.ts +760 -0
- package/src/hooks/shell-writes.ts +646 -0
- package/src/hooks/shell.ts +1421 -194
- package/src/hooks/subagent-card.ts +2 -2
- package/src/hooks/write-commands.ts +898 -0
- package/src/init/scaffold.ts +2 -3
- package/src/local/auto-clean.ts +2 -1
- package/src/local/browser-socket.ts +33 -0
- package/src/local/clean.ts +37 -6
- package/src/local/constants.ts +15 -1
- package/src/local/index.ts +1 -0
- package/src/local/scan.ts +41 -10
- package/src/manifest/render.ts +84 -30
- package/src/owner/constants.ts +4 -5
- package/src/owner/index.ts +0 -2
- package/src/owner/profile.ts +1 -0
- package/src/owner/schema.ts +51 -27
- package/src/owner/survey.ts +0 -3
- package/src/owner/view.ts +0 -9
- package/src/router.ts +8 -132
- package/src/rules/base.ts +12 -7
- package/src/rules/index.ts +1 -0
- package/src/rules/packs.ts +44 -0
- package/src/runners/check.ts +130 -0
- package/src/skills/frontmatter.ts +1 -0
- package/src/sync/agents-block.ts +104 -0
- package/src/sync/base-rules.ts +3 -3
- package/src/sync/claude-launch.ts +12 -12
- package/src/sync/common/constants.ts +0 -2
- package/src/sync/index.ts +1 -1
- package/src/sync/local-choice.ts +32 -3
- package/src/sync/planner.ts +2 -15
- package/src/sync/settings.ts +0 -17
- package/src/theme/index.ts +1 -0
- package/src/theme/tokens.ts +410 -0
- package/src/ui/prompt.ts +1 -0
- package/src/visualize/architecture.ts +504 -0
- package/src/visualize/assets.ts +41 -30
- package/src/visualize/compare-render.ts +22 -24
- package/src/visualize/constants.ts +27 -0
- package/src/visualize/diagrams.ts +13 -121
- package/src/visualize/kinds-render.ts +2 -2
- package/src/visualize/kinds-schema.ts +49 -0
- package/src/visualize/labels-vi.ts +25 -0
- package/src/visualize/labels.ts +2 -0
- package/src/visualize/layout.ts +415 -66
- package/src/visualize/page.ts +82 -15
- package/src/visualize/render.ts +2 -1
- package/src/visualize/schema.ts +29 -1
- package/src/visualize/sections.ts +78 -9
- package/src/visualize/theme.ts +49 -18
- package/src/wiki/anchors.ts +1 -0
- package/src/wiki/command.ts +10 -3
- package/src/wiki/source-links.ts +57 -18
- package/base/ci-global.json +0 -13
- package/base/claude/remote-hosts.json +0 -15
- package/base/hooks/guard-manifest.ts +0 -27
- package/base/hooks/guard-package.ts +0 -30
- package/base/hooks/guard-remote-hosts.ts +0 -70
- package/base/hooks/guard-scripting.ts +0 -32
- package/base/hooks/post-tool.ts +0 -37
- package/base/hooks/prompt-submit.ts +0 -54
- package/base/hooks/stop.ts +0 -40
- package/base/skills/build-a-feature/evals/evals.json +0 -29
- package/base/skills/docs-update/evals/evals.json +0 -23
- package/base/skills/docs-writing/evals/evals.json +0 -17
- package/base/skills/fix-a-bug/evals/evals.json +0 -17
- package/base/skills/knowledge-sync/SKILL.md +0 -81
- package/base/skills/knowledge-sync/knowledge-sync.workflow.js +0 -291
- package/base/skills/knowledge-sync/references/workflow.md +0 -44
- package/base/skills/plan-a-change/evals/evals.json +0 -47
- package/base/skills/report-back/evals/evals.json +0 -23
- package/base/skills/research/evals/evals.json +0 -17
- package/base/skills/retro/evals/evals.json +0 -17
- package/base/skills/review-a-change/evals/evals.json +0 -17
- package/base/skills/ship/evals/evals.json +0 -23
- package/base/skills/visualize-work/evals/evals.json +0 -17
- package/base/templates/ci/github-actions.yml +0 -75
- package/base/templates/ci/gitlab-ci.yml +0 -52
- package/base/templates/trusted-hosts.local.example +0 -11
- package/src/ci/affected.ts +0 -176
- package/src/ci/command.ts +0 -166
- package/src/ci/common/constants.ts +0 -76
- package/src/ci/common/index.ts +0 -2
- package/src/ci/common/types.ts +0 -37
- package/src/ci/git.ts +0 -72
- package/src/ci/global.ts +0 -48
- package/src/ci/graph.ts +0 -43
- package/src/ci/index.ts +0 -7
- package/src/ci/workspace.ts +0 -119
- package/src/commands/ci.command.ts +0 -4
- package/src/hooks/guard-manifest.ts +0 -109
- package/src/hooks/guard-package.ts +0 -226
- package/src/hooks/guard-scripting.ts +0 -36
- package/src/hooks/host-pattern.ts +0 -17
- package/src/hooks/owner-reply.ts +0 -162
- package/src/hooks/post-tool.ts +0 -138
- package/src/hooks/remote-hosts.ts +0 -1013
- package/src/hooks/trusted-scripts.ts +0 -212
- package/src/owner/shape.ts +0 -496
- package/src/owner/violations.ts +0 -332
- package/src/signals/claims.ts +0 -73
- package/src/signals/classify.ts +0 -137
- package/src/signals/constants.ts +0 -88
- package/src/signals/index.ts +0 -5
- package/src/signals/loop.ts +0 -48
- package/src/signals/state.ts +0 -271
- package/src/sync/atlas-block.ts +0 -56
package/src/visualize/assets.ts
CHANGED
|
@@ -58,10 +58,10 @@ const declarations = (opts: { palette: IStatePalette }): string => {
|
|
|
58
58
|
return `--ok:${p.ok};--ok-bg:${p.okBg};--warn:${p.warn};--warn-bg:${p.warnBg};--bad:${p.bad};--bad-bg:${p.badBg};--info:${p.info};--info-bg:${p.infoBg};--s1:${p.s1};--s2:${p.s2};--s3:${p.s3};--s4:${p.s4};--s5:${p.s5}`;
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
/** The state colours in the same three-block form as the project tokens:
|
|
62
|
-
const STATE_CSS = `:root{${declarations({ palette: STATE_PALETTE.
|
|
63
|
-
@media (prefers-color-scheme:
|
|
64
|
-
:root[data-theme=
|
|
61
|
+
/** The state colours in the same three-block form as the project tokens: dark, system light, explicit light. */
|
|
62
|
+
const STATE_CSS = `:root{${declarations({ palette: STATE_PALETTE.dark })}}
|
|
63
|
+
@media (prefers-color-scheme:light){:root:not([data-theme=dark]){${declarations({ palette: STATE_PALETTE.light })}}}
|
|
64
|
+
:root[data-theme=light]{${declarations({ palette: STATE_PALETTE.light })}}`;
|
|
65
65
|
|
|
66
66
|
/** The dark values, set again on everything that sits on the always-dark slab. */
|
|
67
67
|
const SLAB_STATES = declarations({ palette: STATE_PALETTE.dark });
|
|
@@ -90,8 +90,9 @@ const BASE_CSS = [
|
|
|
90
90
|
`.c-ok{--c:var(--ok);--cb:var(--ok-bg)}.c-warn{--c:var(--accent);--cb:var(--accent-soft)}.c-bad{--c:var(--bad);--cb:var(--bad-bg)}.c-info{--c:var(--info);--cb:var(--info-bg)}.c-mut{--c:var(--muted);--cb:var(--bg-soft)}`,
|
|
91
91
|
`.chip{display:inline-flex;align-items:center;gap:8px;color:var(--c);font:600 13.5px/1.2 var(--font);letter-spacing:.02em;white-space:nowrap}`,
|
|
92
92
|
`.lab{font:600 13.5px/1.3 var(--font);color:var(--muted)}`,
|
|
93
|
-
`.inl{display:inline-flex;margin-right:6px;color:var(--c)}`,
|
|
93
|
+
`.inl{display:inline-flex;margin-right:6px;color:var(--c)}.nb{white-space:nowrap}`,
|
|
94
94
|
`.btn{font:600 13.5px/1.2 var(--font);color:var(--body);background:transparent;border:1px solid var(--line);border-radius:var(--radius);padding:8px 12px;cursor:pointer;transition:color .2s,background-color .2s,border-color .2s}`,
|
|
95
|
+
`.top .btn{white-space:nowrap;flex:none}`,
|
|
95
96
|
`.btn:hover{color:var(--ink);border-color:var(--muted)}`,
|
|
96
97
|
`.btn:focus-visible{outline:2px solid var(--accent)}`,
|
|
97
98
|
`.btn[aria-pressed=true]{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}`,
|
|
@@ -103,10 +104,9 @@ const BASE_CSS = [
|
|
|
103
104
|
`.top .wrap{height:64px;display:flex;align-items:center;gap:14px}`,
|
|
104
105
|
`.mark{width:13px;height:17px;fill:var(--hot);flex:none}`,
|
|
105
106
|
`.top .ttl{color:var(--ink);font-weight:650;font-size:16px;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0;max-width:36ch}`,
|
|
106
|
-
`.top nav{margin-left:auto;display:flex;align-items:center;gap:6px;min-width:0}`,
|
|
107
|
-
`.top .links{display:flex;gap:2px;
|
|
108
|
-
`.top .links
|
|
109
|
-
`.top .links a{color:var(--body);text-decoration:none;font-size:14.5px;font-weight:500;padding:8px 10px;border-radius:var(--radius);white-space:nowrap;transition:color .2s,background-color .2s}`,
|
|
107
|
+
`.top nav{margin-left:auto;flex:1 1 auto;justify-content:flex-end;display:flex;align-items:center;gap:6px;min-width:0}`,
|
|
108
|
+
`.top .links{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:2px;height:36px;overflow:hidden;min-width:0}`,
|
|
109
|
+
`.top .links a{color:var(--body);text-decoration:none;font-size:14.5px;font-weight:500;line-height:20px;padding:8px 10px;border-radius:var(--radius);white-space:nowrap;transition:color .2s,background-color .2s}`,
|
|
110
110
|
`.top .links a:hover{color:var(--ink);background:#ffffff0d}`,
|
|
111
111
|
`.top .sep{width:1px;height:20px;background:#ffffff1f;margin:0 8px;flex:none}`,
|
|
112
112
|
`.top .stamp{color:var(--muted);font-size:13.5px;white-space:nowrap}`,
|
|
@@ -114,9 +114,9 @@ const BASE_CSS = [
|
|
|
114
114
|
`.theme:hover{color:var(--ink);background:#ffffff0d}`,
|
|
115
115
|
`.theme:focus-visible{outline:2px solid var(--hot);outline-offset:1px}`,
|
|
116
116
|
`.theme svg{position:absolute;top:8px;left:8px;width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;transition:transform .4s cubic-bezier(.22,1,.36,1),opacity .25s ease}`,
|
|
117
|
-
`.theme .
|
|
118
|
-
`:root[data-theme=
|
|
119
|
-
`@media (prefers-color-scheme:
|
|
117
|
+
`.theme .sun{opacity:0;transform:rotate(90deg) scale(.6)}`,
|
|
118
|
+
`:root[data-theme=light] .theme .sun{opacity:1;transform:none}:root[data-theme=light] .theme .moon{opacity:0;transform:rotate(-90deg) scale(.6)}`,
|
|
119
|
+
`@media (prefers-color-scheme:light){:root:not([data-theme=dark]) .theme .sun{opacity:1;transform:none}:root:not([data-theme=dark]) .theme .moon{opacity:0;transform:rotate(-90deg) scale(.6)}}`,
|
|
120
120
|
`.theme .tip{position:absolute;top:calc(100% + 8px);right:0;white-space:nowrap;background:var(--slab-2);color:var(--slab-ink);font-size:13px;padding:6px 10px;border-radius:var(--radius);opacity:0;transform:translateY(-4px);pointer-events:none;transition:opacity .15s,transform .15s;box-shadow:0 8px 24px #0006}`,
|
|
121
121
|
`.theme:hover .tip,.theme:focus-visible .tip{opacity:1;transform:none}`,
|
|
122
122
|
`::view-transition-old(root),::view-transition-new(root){animation-duration:200ms;animation-timing-function:ease}`,
|
|
@@ -124,22 +124,33 @@ const BASE_CSS = [
|
|
|
124
124
|
// The hero slab: the state, the title, the verdict, and the flow when the spec has one.
|
|
125
125
|
`.hero{padding-block:56px}`,
|
|
126
126
|
`.hero .state{display:inline-flex;align-items:center;gap:10px;margin-bottom:28px;color:var(--c);font:650 14.5px/1 var(--font);text-transform:uppercase;letter-spacing:.07em}`,
|
|
127
|
-
`.hero h1{font-size:clamp(32px,5vw,72px);line-height:1.
|
|
127
|
+
`.hero h1{font-size:clamp(32px,5vw,72px);line-height:1.14;max-width:30ch;letter-spacing:-.045em;color:var(--ink);overflow-wrap:anywhere}`,
|
|
128
128
|
`.hero .lede{margin-top:28px;font-size:clamp(18px,1.6vw,22px);max-width:46ch;color:var(--body)}`,
|
|
129
129
|
`.hero .cap{margin-top:14px;max-width:60ch;color:var(--muted)}`,
|
|
130
|
-
`.hero .meta{margin-top:22px;display:flex;flex-wrap:wrap;gap:4px 20px;font:500 13px/1.4 var(--
|
|
130
|
+
`.hero .meta{margin-top:22px;display:flex;flex-wrap:wrap;gap:4px 20px;font:500 13px/1.4 var(--font);color:var(--muted)}`,
|
|
131
131
|
// Sections: each a part with its title; the compositions below differ from neighbour to neighbour.
|
|
132
132
|
`.part{padding-top:88px}`,
|
|
133
133
|
`.sh{font-size:clamp(26px,3vw,40px);line-height:1.05;margin-bottom:36px;max-width:30ch}`,
|
|
134
134
|
`.panels{display:grid;gap:2px;border-radius:var(--radius);overflow:hidden}`,
|
|
135
135
|
// Tiles: fields of colour with a big number.
|
|
136
136
|
`.slide-tiles{padding-top:56px}`,
|
|
137
|
-
`.tiles{display:
|
|
138
|
-
`.tile{position:relative;display:grid;align-content:start;padding:28px 26px 30px;background:var(--bg-soft)}`,
|
|
139
|
-
`.tile.
|
|
140
|
-
`.tile .n
|
|
141
|
-
`.tile .l{color:var(--body);font-size:
|
|
137
|
+
`.tiles{display:flex;flex-wrap:wrap;gap:1px;background:color-mix(in srgb,var(--ink) 14%,transparent);border:1px solid color-mix(in srgb,var(--ink) 14%,transparent);border-radius:var(--radius);overflow:hidden}`,
|
|
138
|
+
`.tile{flex:1 1 220px;position:relative;display:grid;align-content:start;padding:28px 26px 30px;background:var(--bg-soft)}`,
|
|
139
|
+
`.tile .n{font-size:clamp(36px,4.4vw,60px);line-height:.95;font-weight:650;letter-spacing:-.05em;color:var(--ink);white-space:nowrap;margin-bottom:10px}`,
|
|
140
|
+
`.tile.c-ok .n,.tile.c-warn .n,.tile.c-bad .n,.tile.c-info .n{padding-right:36px}`,
|
|
141
|
+
`.tile .l{color:var(--body);font-size:13px;letter-spacing:.06em;text-transform:uppercase}`,
|
|
142
142
|
`.tile .ic{position:absolute;top:22px;right:22px;color:var(--c)}`,
|
|
143
|
+
`.kick{display:flex;align-items:center;gap:8px;margin:0 0 14px;color:var(--accent);font-size:12px;font-weight:650;letter-spacing:.14em;text-transform:uppercase}.kick:before{content:'';width:6px;height:6px;background:currentColor}`,
|
|
144
|
+
`h1 .mute{color:var(--slab-muted)}`,
|
|
145
|
+
`.grades,.metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:1px;margin:0;padding:0;list-style:none;background:color-mix(in srgb,var(--ink) 14%,transparent);border:1px solid color-mix(in srgb,var(--ink) 14%,transparent);border-radius:var(--radius);overflow:hidden}`,
|
|
146
|
+
`.grades li,.metrics li.mc{display:grid;align-content:start;gap:8px;padding:20px 22px;background:var(--bg-soft)}`,
|
|
147
|
+
`.gn{color:var(--ink);font-weight:650}.gt{color:var(--body);font-size:15px}`,
|
|
148
|
+
`.gr{display:inline-flex;align-items:center;gap:8px;justify-self:start;padding:3px 10px;border-radius:var(--radius);color:var(--c);background:var(--cb);font-size:14px}.gr b{font-size:16px}`,
|
|
149
|
+
`.mv{margin:0;color:var(--ink);font-size:clamp(30px,3.4vw,44px);line-height:1;font-weight:650;letter-spacing:-.04em}.mv small{margin-left:6px;color:var(--muted);font-size:.45em;font-weight:500;letter-spacing:0}`,
|
|
150
|
+
`.ml{margin:0;color:var(--ink);font-weight:650}.mt{margin:0;color:var(--body);font-size:15px}`,
|
|
151
|
+
`.mb{display:block;width:100%;height:8px;border-radius:2px;overflow:hidden;background:color-mix(in srgb,var(--ink) 10%,transparent)}.mb rect{fill:var(--tc)}`,
|
|
152
|
+
`.t-ok{--tc:var(--ok)}.t-warn{--tc:var(--accent)}.t-bad{--tc:var(--bad)}.t-info{--tc:var(--info)}`,
|
|
153
|
+
`.mlg{display:flex;flex-wrap:wrap;gap:4px 16px;margin:0;padding:0;list-style:none;color:var(--body);font-size:13px}.mlg .sw{display:inline-block;width:8px;height:8px;margin-right:6px;background:var(--tc)}`,
|
|
143
154
|
// The minimap: a track, a stripe and a word per task.
|
|
144
155
|
`.strip{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:2px;border-radius:var(--radius);overflow:hidden}`,
|
|
145
156
|
`.seg{display:grid;align-content:start;padding:0 20px 22px;background:var(--bg-soft)}`,
|
|
@@ -192,7 +203,7 @@ const BASE_CSS = [
|
|
|
192
203
|
`.path{display:none;margin:0}`,
|
|
193
204
|
`.path li{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;padding:14px 16px;background:var(--bg-soft);margin-top:2px;color:var(--body);font-size:15px}.path li:first-child{margin-top:0;border-radius:var(--radius) var(--radius) 0 0}.path li:last-child{border-radius:0 0 var(--radius) var(--radius)}`,
|
|
194
205
|
`.path b{font-weight:600;color:var(--ink)}`,
|
|
195
|
-
`.verb{display:inline-block;border:1px solid var(--line);border-radius:var(--radius);padding:0 8px;font:13px/1.7 var(--
|
|
206
|
+
`.verb{display:inline-block;border:1px solid var(--line);border-radius:var(--radius);padding:0 8px;font:13px/1.7 var(--font);color:var(--muted)}.verb.error{color:var(--bad);border-color:var(--bad)}.verb.branch,.verb.return{border-style:dashed}`,
|
|
196
207
|
`.path-detail{display:none;margin-top:12px;color:var(--body)}.path-detail li{padding:10px 0;border-top:1px solid var(--line)}.path-detail b{display:block;color:var(--ink)}`,
|
|
197
208
|
// The steps: panels to press; the line below says what is picked.
|
|
198
209
|
`.steps{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:2px;margin-top:36px;border-radius:var(--radius);overflow:hidden}`,
|
|
@@ -249,7 +260,7 @@ const BASE_CSS = [
|
|
|
249
260
|
`.chips{display:flex;flex-wrap:wrap;align-content:flex-start;align-items:flex-start;gap:6px;margin-bottom:12px}.chips li{padding:3px 10px;border-radius:var(--radius);background:var(--bg);color:var(--ink);font-size:15px}`,
|
|
250
261
|
// Explainer: a big numeral, the words, then the drawing.
|
|
251
262
|
`.ex{display:grid;gap:60px}`,
|
|
252
|
-
`.estep{display:grid;grid-template-columns:96px minmax(0,1fr)
|
|
263
|
+
`.estep{display:grid;grid-template-columns:96px minmax(0,1fr);gap:10px 32px;align-items:start}.estep .dg{grid-column:2/-1;min-width:0}.estep .dg .win{width:fit-content;max-width:100%}.estep .dg .fig svg{margin-inline:0}`,
|
|
253
264
|
`.estep .no{font-size:72px;line-height:.8;font-weight:650;letter-spacing:-.05em;color:var(--ink)}`,
|
|
254
265
|
`.estep h3{font-size:24px;line-height:1.2}.estep .sb p{margin-top:10px;max-width:44ch;color:var(--body)}`,
|
|
255
266
|
// Timeline: a rule with a ring per date.
|
|
@@ -258,7 +269,7 @@ const BASE_CSS = [
|
|
|
258
269
|
`.tl li{position:relative;display:grid;gap:3px}`,
|
|
259
270
|
`.tl .dot{position:absolute;left:-46px;top:0;display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--bg);color:var(--c);border:2px solid var(--c)}`,
|
|
260
271
|
`.tl .dot .ic{width:15px;height:15px}.tl li.c-mut .dot{border-style:dashed}`,
|
|
261
|
-
`.tl time{font:600 14px/1.4 var(--
|
|
272
|
+
`.tl time{font:600 14px/1.4 var(--font);color:var(--muted)}.tl h3{font-size:20px;line-height:1.25}.tl p{color:var(--body);max-width:60ch}`,
|
|
262
273
|
// Findings: tiles, panels with a chart each, and callouts with a stripe.
|
|
263
274
|
`.charts{display:grid;grid-template-columns:repeat(auto-fit,minmax(340px,1fr));gap:2px;margin-top:2px;border-radius:var(--radius);overflow:hidden}`,
|
|
264
275
|
`.tiles+.charts{margin-top:2px}`,
|
|
@@ -300,10 +311,10 @@ const BASE_CSS = [
|
|
|
300
311
|
// Evidence and log: ledgers, a rule between rows.
|
|
301
312
|
`.ledger,.log{display:grid}`,
|
|
302
313
|
`.ev{display:grid;grid-template-columns:160px minmax(0,1.6fr) minmax(0,1fr);gap:8px 28px;align-items:baseline;padding:22px 0;border-top:1px solid var(--line)}.ev:first-child,.log li:first-child{border-top:0}`,
|
|
303
|
-
`.ev b{color:var(--ink);font-weight:600;line-height:1.35}.ev .cl{display:grid;gap:4px}.ev .pr{color:var(--muted);font-size:15px}.ev .rs{font:600 15px/1.4 var(--
|
|
314
|
+
`.ev b{color:var(--ink);font-weight:600;line-height:1.35}.ev .cl{display:grid;gap:4px}.ev .pr{color:var(--muted);font-size:15px}.ev .rs{font:600 15px/1.4 var(--font);color:var(--ink)}`,
|
|
304
315
|
`.badge{display:inline-flex;align-items:center;gap:8px;justify-self:start;color:var(--c);font:600 13.5px/1.3 var(--font)}`,
|
|
305
316
|
`.ev-verified{--c:var(--ok);--cb:var(--ok-bg)}.ev-inferred{--c:var(--warn);--cb:var(--warn-bg)}.ev-guess{--c:var(--muted);--cb:var(--bg-soft)}`,
|
|
306
|
-
`.log li{display:grid;grid-template-columns:160px minmax(0,1fr);gap:8px 28px;padding:18px 0;border-top:1px solid var(--line)}.log time{font:600 14px/1.6 var(--
|
|
317
|
+
`.log li{display:grid;grid-template-columns:160px minmax(0,1fr);gap:8px 28px;padding:18px 0;border-top:1px solid var(--line)}.log time{font:600 14px/1.6 var(--font);color:var(--muted)}.log li>span{color:var(--ink)}`,
|
|
307
318
|
// Risks: a table.
|
|
308
319
|
`.tw{overflow-x:auto}table{border-collapse:collapse;width:100%;font-size:16.5px}`,
|
|
309
320
|
`th{font:600 13.5px/1.3 var(--font);color:var(--muted);text-align:left;padding:0 20px 12px 0;border-bottom:1px solid var(--ink)}`,
|
|
@@ -325,14 +336,14 @@ const BASE_CSS = [
|
|
|
325
336
|
`html.present .deck{display:flex;position:fixed;left:0;right:0;bottom:0;z-index:30;gap:12px;align-items:center;justify-content:center;padding:10px;border-top:1px solid var(--line)}`,
|
|
326
337
|
`html.present .deck span{font:600 14px var(--font);color:var(--muted)}`,
|
|
327
338
|
// A phone: panels stack, the bar keeps only the title, the state, present and the switch.
|
|
328
|
-
`@media (max-width:860px){.own,.facts,.q,.estep,.diff,.ev,.log li,.idea{grid-template-columns:minmax(0,1fr)}.q{gap:18px}.idea .centre{order:-1;grid-column:1;grid-row:auto}.idea .branch:nth-child(n){grid-column:1}.estep{gap:12px}.estep .no{font-size:56px}`,
|
|
339
|
+
`@media (max-width:860px){.own,.facts,.q,.estep,.diff,.ev,.log li,.idea{grid-template-columns:minmax(0,1fr)}.estep .dg{grid-column:auto}.estep .no{line-height:1}.hero h1{line-height:1.24}.q{gap:18px}.idea .centre{order:-1;grid-column:1;grid-row:auto}.idea .branch:nth-child(n){grid-column:1}.estep{gap:12px}.estep .no{font-size:56px}`,
|
|
329
340
|
`.part{padding-top:64px}.hero{padding-block:40px}.figure{margin-top:36px}.foot{margin-top:80px}.sh{margin-bottom:26px}.own .nx,.own .stop{padding:26px 22px}.opt{padding:26px 22px 28px}.q{padding:24px 22px 26px}.ba{padding:24px 22px}`,
|
|
330
|
-
`.top .links,.top .sep,.top .stamp{display:none}.top .wrap{gap:10px}.top .ttl{max-width:none;flex:1 1 auto}.top nav{margin-left:0}`,
|
|
341
|
+
`.top .links,.top .sep,.top .stamp{display:none}.top .wrap{gap:10px}.top .ttl{max-width:none;flex:1 1 auto}.top nav{margin-left:0;flex:none}`,
|
|
331
342
|
`.stack thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}.stack,.stack tbody,.stack tr,.stack td{display:block;width:100%}.stack tr{padding:14px 0;border-top:1px solid var(--line)}.stack tbody tr:first-child{border-top:0;padding-top:0}.stack td{border:0;padding:3px 0}`,
|
|
332
343
|
`.stack td[data-label]::before{content:attr(data-label);display:block;font:600 13px/1.3 var(--font);color:var(--muted);margin-bottom:2px}}`,
|
|
333
|
-
`@media (max-width:520px){body{font-size:16px}#present{display:none}.tile{padding:22px 20px}.steps{grid-template-columns:minmax(0,1fr)}.say{grid-template-columns:minmax(0,1fr)}}`,
|
|
344
|
+
`@media (max-width:520px){body{font-size:16px}#present{display:none}.tile{padding:22px 20px}.tile .n{font-size:30px}.steps{grid-template-columns:minmax(0,1fr)}.say{grid-template-columns:minmax(0,1fr)}}`,
|
|
334
345
|
// Motion is an extra: the hero rises and the owner's gate glows only when the reader has not asked for less.
|
|
335
|
-
`@media (prefers-reduced-motion:no-preference){.gate .halo{animation:heat 2.6s ease-in-out infinite;transform-origin:center;transform-box:fill-box}@keyframes heat{0%,100%{opacity:.55;transform:scale(.9)}50%{opacity:1;transform:scale(1.12)}}.hero h1,.hero .lede,.figure{animation:rise .7s cubic-bezier(.22,1,.36,1) both}.hero .lede{animation-delay:.08s}.figure{animation-delay:.16s}@keyframes rise{from{
|
|
346
|
+
`@media (prefers-reduced-motion:no-preference){.gate .halo{animation:heat 2.6s ease-in-out infinite;transform-origin:center;transform-box:fill-box}@keyframes heat{0%,100%{opacity:.55;transform:scale(.9)}50%{opacity:1;transform:scale(1.12)}}.hero h1,.hero .lede,.figure{animation:rise .7s cubic-bezier(.22,1,.36,1) both}.hero .lede{animation-delay:.08s}.figure{animation-delay:.16s}@keyframes rise{from{transform:translateY(14px)}}}`,
|
|
336
347
|
`@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}::view-transition-group(*),::view-transition-old(*),::view-transition-new(*){animation:none!important}}`,
|
|
337
348
|
// Print: the final state, light on paper, one slide after another.
|
|
338
349
|
`@media print{body{background:#fff;color:#000}.top,.deck,.js-only,.say{display:none}.slab,.win,.pull{--slab:#fff;--slab-2:#f1f1f1;--slab-3:#e6e6e6;--slab-ink:#000;--slab-body:#222;--slab-muted:#444;--hot:#5a3600;--hot-ink:#fff;--hot-glow:transparent;--ok:#0f5c2a;--warn:#7a4504;--bad:#9a1d17;--info:#164a9e;background-image:none}`,
|
|
@@ -357,8 +368,8 @@ export const PAGE_JS = `(()=>{
|
|
|
357
368
|
const d=document,q=(s,r=d)=>r.querySelector(s),qa=(s,r=d)=>[...r.querySelectorAll(s)],root=d.documentElement;
|
|
358
369
|
const tb=q('#theme');
|
|
359
370
|
if(tb){
|
|
360
|
-
const mq=matchMedia('(prefers-color-scheme:
|
|
361
|
-
const dark=()=>{const t=root.dataset.theme;return t?t==='dark'
|
|
371
|
+
const mq=matchMedia('(prefers-color-scheme: light)'),tip=q('.tip',tb);
|
|
372
|
+
const dark=()=>{const t=root.dataset.theme;return t?t==='dark':!mq.matches};
|
|
362
373
|
const paint=()=>{const w=dark()?tb.dataset.toLight:tb.dataset.toDark;tb.setAttribute('aria-label',w);if(tip)tip.textContent=w};
|
|
363
374
|
const flip=()=>{const n=dark()?'light':'dark';root.dataset.theme=n;try{localStorage.setItem('vz-theme',n)}catch(e){}paint()};
|
|
364
375
|
paint();
|
|
@@ -54,23 +54,30 @@ export class CompareView {
|
|
|
54
54
|
return `<svg class="lg" viewBox="0 0 44 12" aria-hidden="true"><g class="edge ${opts.variant}"><path d="M0 6H44"/></g></svg>`;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
/** The compare view as a flow: the same boxes, and every arrow with its sign. */
|
|
58
|
+
private static flowOf(opts: {
|
|
59
|
+
compare: TCompare;
|
|
60
|
+
}): Parameters<typeof FigureLayout.render>[0]['flow'] {
|
|
61
|
+
const { compare } = opts;
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
nodes: compare.nodes,
|
|
65
|
+
edges: compare.edges.map((edge) => ({
|
|
66
|
+
from: edge.from,
|
|
67
|
+
to: edge.to,
|
|
68
|
+
label: CompareView.signedLabel({ edge }),
|
|
69
|
+
...(CompareView.variantOf({ edge }) === undefined
|
|
70
|
+
? {}
|
|
71
|
+
: { variant: CompareView.variantOf({ edge }) }),
|
|
72
|
+
})),
|
|
73
|
+
steps: [],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
57
77
|
/** The figure: the flow's own grid drawing with the added and removed arrows as their own classes. */
|
|
58
78
|
private static svgOf(opts: { compare: TCompare; chrome: TChrome }): string {
|
|
59
79
|
const { compare, chrome } = opts;
|
|
60
|
-
const svg = FigureLayout.render({
|
|
61
|
-
flow: {
|
|
62
|
-
nodes: compare.nodes,
|
|
63
|
-
edges: compare.edges.map((edge) => ({
|
|
64
|
-
from: edge.from,
|
|
65
|
-
to: edge.to,
|
|
66
|
-
label: CompareView.signedLabel({ edge }),
|
|
67
|
-
...(CompareView.variantOf({ edge }) === undefined
|
|
68
|
-
? {}
|
|
69
|
-
: { variant: CompareView.variantOf({ edge }) }),
|
|
70
|
-
})),
|
|
71
|
-
steps: [],
|
|
72
|
-
},
|
|
73
|
-
});
|
|
80
|
+
const svg = FigureLayout.render({ flow: CompareView.flowOf({ compare }) });
|
|
74
81
|
// A function as the replacement: a string would read `$&`, `$'` and `` $` `` in the spec's text as patterns.
|
|
75
82
|
let named = svg.replace(
|
|
76
83
|
'aria-label="flow"',
|
|
@@ -92,13 +99,6 @@ export class CompareView {
|
|
|
92
99
|
}
|
|
93
100
|
}
|
|
94
101
|
|
|
95
|
-
// The label of an arrow that runs straight down or up sits on the line, and a heavy line would run through it: beside it.
|
|
96
|
-
named = named.replace(
|
|
97
|
-
/(<path d="M(-?[\d.]+) -?[\d.]+L\2 -?[\d.]+"[^>]*\/><text x=")-?[\d.]+(" y="-?[\d.]+" )text-anchor="middle"/g,
|
|
98
|
-
(_match, before: string, x: string, after: string) =>
|
|
99
|
-
`${before}${Number(x) + 10}${after}text-anchor="start"`,
|
|
100
|
-
);
|
|
101
|
-
|
|
102
102
|
// The page script highlights and describes the flow's boxes by these names: the compare view is its own thing.
|
|
103
103
|
return named
|
|
104
104
|
.replaceAll(' data-node="', ' data-cn="')
|
|
@@ -165,9 +165,7 @@ export class CompareView {
|
|
|
165
165
|
|
|
166
166
|
return {
|
|
167
167
|
svg: CompareView.svgOf(opts),
|
|
168
|
-
width: FigureLayout.
|
|
169
|
-
cols: Math.max(...compare.nodes.map((node) => node.col)) + 1,
|
|
170
|
-
}),
|
|
168
|
+
width: FigureLayout.widthOf(CompareView.flowOf({ compare })),
|
|
171
169
|
fallback: `<ul class="legend cmp-key">${key}</ul>${CompareView.listOf(opts)}`,
|
|
172
170
|
};
|
|
173
171
|
}
|
|
@@ -189,6 +189,21 @@ export const DEFAULT_CHROME = {
|
|
|
189
189
|
result: 'Result',
|
|
190
190
|
label: 'Basis',
|
|
191
191
|
evidenceLabels: { verified: 'verified', inferred: 'inferred', guess: 'guess' },
|
|
192
|
+
/** The words of the flow legend: what a box is, and how an arrow reads. */
|
|
193
|
+
nodeKinds: {
|
|
194
|
+
step: 'step',
|
|
195
|
+
service: 'service',
|
|
196
|
+
store: 'store',
|
|
197
|
+
actor: 'actor',
|
|
198
|
+
external: 'external',
|
|
199
|
+
},
|
|
200
|
+
edgeVariants: {
|
|
201
|
+
main: 'main',
|
|
202
|
+
branch: 'branch',
|
|
203
|
+
return: 'return',
|
|
204
|
+
fanout: 'fan-out',
|
|
205
|
+
error: 'error',
|
|
206
|
+
},
|
|
192
207
|
risks: 'Risks',
|
|
193
208
|
risk: 'Risk',
|
|
194
209
|
impact: 'Impact',
|
|
@@ -231,6 +246,18 @@ export const DEFAULT_CHROME = {
|
|
|
231
246
|
inBoth: 'in both',
|
|
232
247
|
sources: 'Sources',
|
|
233
248
|
terms: 'Words in this page',
|
|
249
|
+
grades: 'Grades',
|
|
250
|
+
gradeA: 'good',
|
|
251
|
+
gradeB: 'has gaps',
|
|
252
|
+
gradeC: 'weak',
|
|
253
|
+
metrics: 'Numbers',
|
|
254
|
+
/** The small label above a section: the group its part of the page belongs to. */
|
|
255
|
+
kickOverview: 'Overview',
|
|
256
|
+
kickStructure: 'Structure',
|
|
257
|
+
kickDecision: 'Decision',
|
|
258
|
+
kickEvidence: 'Evidence',
|
|
259
|
+
kickPlan: 'Plan',
|
|
260
|
+
kickReference: 'Reference',
|
|
234
261
|
/** The words that tell an added arrow from a removed one: never colour alone. */
|
|
235
262
|
onlyHere: 'only here',
|
|
236
263
|
addedEdge: 'added',
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { NodeStates } from './constants.ts';
|
|
2
1
|
import type { TChrome } from './constants.ts';
|
|
3
|
-
import {
|
|
2
|
+
import { SpecArchitecture } from './architecture.ts';
|
|
4
3
|
import { GridSpans } from './grid-span.ts';
|
|
5
4
|
import { IconSet } from './icons.ts';
|
|
6
5
|
import { FigureLayout } from './layout.ts';
|
|
@@ -45,12 +44,18 @@ export class SpecDiagrams {
|
|
|
45
44
|
if (diagram.type === 'row') {
|
|
46
45
|
const longest = Math.max(
|
|
47
46
|
...diagram.nodes.flatMap((node) => [
|
|
48
|
-
node.label
|
|
49
|
-
|
|
47
|
+
FigureLayout.textWidth({ text: node.label, size: 14, isBold: true }),
|
|
48
|
+
node.sub === undefined ? 0 : FigureLayout.textWidth({ text: node.sub, size: 12.5 }),
|
|
50
49
|
]),
|
|
51
50
|
);
|
|
52
51
|
const bw = Math.max(124, Math.ceil(longest) + 24);
|
|
53
|
-
const
|
|
52
|
+
const arrowWidth = Math.max(
|
|
53
|
+
0,
|
|
54
|
+
...(diagram.arrows ?? []).map((label) =>
|
|
55
|
+
FigureLayout.textWidth({ text: label, size: 12.5 }),
|
|
56
|
+
),
|
|
57
|
+
);
|
|
58
|
+
const gap = Math.max(78, Math.ceil(arrowWidth) + 24);
|
|
54
59
|
const width = diagram.nodes.length * bw + (diagram.nodes.length - 1) * gap + 16;
|
|
55
60
|
const parts = diagram.nodes
|
|
56
61
|
.map((node, index) => {
|
|
@@ -100,126 +105,13 @@ export class SpecDiagrams {
|
|
|
100
105
|
return {
|
|
101
106
|
svg: `<svg width="${width}" viewBox="0 0 ${width} ${diagram.layers.length * 62 + 12}" role="group" aria-label="layers">${parts}</svg>`,
|
|
102
107
|
width,
|
|
103
|
-
fallback: `<ul class="path">${diagram.layers.map((layer) => `<li><b>${escaped(layer.label)}
|
|
108
|
+
fallback: `<ul class="path">${diagram.layers.map((layer) => `<li><b>${escaped(layer.label)}:</b> <span>${layer.items.map(escaped).join(', ')}</span></li>`).join('')}</ul>`,
|
|
104
109
|
};
|
|
105
110
|
}
|
|
106
111
|
|
|
107
|
-
/** The layered view: bands from top to bottom, boxes in each, and
|
|
112
|
+
/** The layered view: bands from top to bottom, boxes in each, and a line for every link that never crosses a box. */
|
|
108
113
|
static renderArchitecture(opts: { architecture: TArchitecture; chrome: TChrome }): IDrawing {
|
|
109
|
-
|
|
110
|
-
const most = Math.max(...architecture.layers.map((layer) => layer.boxes.length));
|
|
111
|
-
const label = 120;
|
|
112
|
-
const bw = 176;
|
|
113
|
-
const bh = 68;
|
|
114
|
-
const gap = 64;
|
|
115
|
-
const rowHeight = 190;
|
|
116
|
-
const width = label + most * (bw + gap) + 4;
|
|
117
|
-
const height = architecture.layers.length * rowHeight + 8;
|
|
118
|
-
const positions = new Map<string, { x: number; y: number; row: number }>();
|
|
119
|
-
|
|
120
|
-
architecture.layers.forEach((layer, row) => {
|
|
121
|
-
const total = layer.boxes.length * (bw + gap) - gap;
|
|
122
|
-
const start = label + (most * (bw + gap) - gap - total) / 2;
|
|
123
|
-
|
|
124
|
-
layer.boxes.forEach((boxSpec, col) =>
|
|
125
|
-
positions.set(boxSpec.id, {
|
|
126
|
-
x: start + col * (bw + gap),
|
|
127
|
-
y: 4 + row * rowHeight + 34,
|
|
128
|
-
row,
|
|
129
|
-
}),
|
|
130
|
-
);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
const bands = architecture.layers
|
|
134
|
-
.map(
|
|
135
|
-
(layer, row) =>
|
|
136
|
-
`<rect x="2" y="${4 + row * rowHeight}" width="${width - 4}" height="${rowHeight - 14}" rx="4" class="dband"/><text class="dlab" x="14" y="${4 + row * rowHeight + 24}">${escaped(layer.label)}</text>`,
|
|
137
|
-
)
|
|
138
|
-
.join('');
|
|
139
|
-
// Links that cross the same gap between two layers get their own horizontal run, so no two lines share one.
|
|
140
|
-
const lanes = new Map<number, number>();
|
|
141
|
-
const across = new Map<number, number>();
|
|
142
|
-
|
|
143
|
-
for (const link of architecture.links) {
|
|
144
|
-
const from = positions.get(link.from);
|
|
145
|
-
const to = positions.get(link.to);
|
|
146
|
-
|
|
147
|
-
if (from !== undefined && to !== undefined && from.row !== to.row) {
|
|
148
|
-
across.set(Math.min(from.row, to.row), (across.get(Math.min(from.row, to.row)) ?? 0) + 1);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const links = architecture.links
|
|
153
|
-
.map((link) => {
|
|
154
|
-
const a = positions.get(link.from);
|
|
155
|
-
const b = positions.get(link.to);
|
|
156
|
-
|
|
157
|
-
if (a === undefined || b === undefined) {
|
|
158
|
-
return '';
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
if (a.row === b.row) {
|
|
162
|
-
const sign = a.x < b.x ? 1 : -1;
|
|
163
|
-
const x1 = sign === 1 ? a.x + bw : a.x;
|
|
164
|
-
const x2 = sign === 1 ? b.x : b.x + bw;
|
|
165
|
-
const y = a.y + bh / 2;
|
|
166
|
-
|
|
167
|
-
return `<g class="dlink"><path d="M${x1} ${y}H${x2}" class="dline"/><path d="M${x2 - sign * 7} ${y - 5}L${x2} ${y}L${x2 - sign * 7} ${y + 5}" fill="none" class="dline"/>${link.label === undefined ? '' : `<text class="dl" x="${(x1 + x2) / 2}" y="${y - 8}" text-anchor="middle">${escaped(link.label)}</text>`}</g>`;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const down = a.row < b.row;
|
|
171
|
-
const gapIndex = Math.min(a.row, b.row);
|
|
172
|
-
const lane = lanes.get(gapIndex) ?? 0;
|
|
173
|
-
|
|
174
|
-
lanes.set(gapIndex, lane + 1);
|
|
175
|
-
|
|
176
|
-
const top = 4 + gapIndex * rowHeight + 34 + bh;
|
|
177
|
-
const bottom = 4 + (gapIndex + 1) * rowHeight + 34;
|
|
178
|
-
const ym =
|
|
179
|
-
top + 14 + ((bottom - top - 28) * (lane + 1)) / ((across.get(gapIndex) ?? 1) + 1);
|
|
180
|
-
const shift = lane % 3 === 1 ? 10 : lane % 3 === 2 ? -10 : 0;
|
|
181
|
-
const x1 = a.x + bw / 2 + shift;
|
|
182
|
-
const x2 = b.x + bw / 2 + shift;
|
|
183
|
-
const y1 = down ? a.y + bh : a.y;
|
|
184
|
-
const y2 = down ? b.y : b.y + bh;
|
|
185
|
-
const tip = down ? -7 : 7;
|
|
186
|
-
|
|
187
|
-
return `<g class="dlink"><path d="M${x1} ${y1}V${ym}H${x2}V${y2}" class="dline"/><path d="M${x2 - 5} ${y2 + tip}L${x2} ${y2}L${x2 + 5} ${y2 + tip}" fill="none" class="dline"/>${link.label === undefined ? '' : `<text class="dl" x="${(x1 + x2) / 2}" y="${ym - 5}" text-anchor="middle">${escaped(link.label)}</text>`}</g>`;
|
|
188
|
-
})
|
|
189
|
-
.join('');
|
|
190
|
-
const boxes = architecture.layers
|
|
191
|
-
.flatMap((layer) => layer.boxes)
|
|
192
|
-
.map((spec) => {
|
|
193
|
-
const p = positions.get(spec.id);
|
|
194
|
-
|
|
195
|
-
return p === undefined
|
|
196
|
-
? ''
|
|
197
|
-
: box({
|
|
198
|
-
x: p.x,
|
|
199
|
-
y: p.y,
|
|
200
|
-
width: bw,
|
|
201
|
-
height: bh,
|
|
202
|
-
label: spec.label,
|
|
203
|
-
sub: spec.sub,
|
|
204
|
-
tone: spec.state === undefined ? undefined : NodeStates.toneOf(spec.state),
|
|
205
|
-
icon:
|
|
206
|
-
spec.state === undefined
|
|
207
|
-
? undefined
|
|
208
|
-
: SpecCharts.stateIcon({ state: spec.state, size: 20 }),
|
|
209
|
-
});
|
|
210
|
-
})
|
|
211
|
-
.join('');
|
|
212
|
-
const names = new Map(
|
|
213
|
-
architecture.layers.flatMap((layer) =>
|
|
214
|
-
layer.boxes.map((spec) => [spec.id, spec.label] as const),
|
|
215
|
-
),
|
|
216
|
-
);
|
|
217
|
-
|
|
218
|
-
return {
|
|
219
|
-
svg: `<svg width="${width}" viewBox="0 0 ${width} ${height}" role="group" aria-label="${escaped(opts.chrome.architecture)}">${bands}${links}${boxes}</svg>`,
|
|
220
|
-
width,
|
|
221
|
-
fallback: `<ul class="path">${architecture.layers.map((layer) => `<li><b>${escaped(layer.label)}</b>: ${layer.boxes.map((spec) => `${spec.state === undefined ? '' : `<span class="c-${NodeStates.toneOf(spec.state)} inl">${SpecCharts.stateIcon({ state: spec.state, size: 16 })}</span>`}${escaped(spec.label)}`).join(', ')}</li>`).join('')}${architecture.links.map((link) => `<li>${escaped(names.get(link.from) ?? link.from)} <span class="verb">${escaped(link.label ?? opts.chrome.uses)}</span> ${escaped(names.get(link.to) ?? link.to)}</li>`).join('')}</ul>`,
|
|
222
|
-
};
|
|
114
|
+
return SpecArchitecture.render(opts);
|
|
223
115
|
}
|
|
224
116
|
|
|
225
117
|
/** The idea map: the centre between two columns of branches, each branch a cluster of ideas. */
|
|
@@ -10,7 +10,7 @@ import { SpecSections } from './sections.ts';
|
|
|
10
10
|
export interface INewKindsContext {
|
|
11
11
|
spec: INewKindsSpec;
|
|
12
12
|
chrome: TChrome;
|
|
13
|
-
fits: Set<
|
|
13
|
+
fits: Set<string>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/** A figure, the width it needs to keep its text readable, the list that replaces it on a phone, and its sentences. */
|
|
@@ -648,7 +648,7 @@ const renderTree = (opts: { tree: TTree; chrome: TChrome }): IKindDrawing => {
|
|
|
648
648
|
const frame = (opts: { ctx: INewKindsContext; drawing: IKindDrawing }): string => {
|
|
649
649
|
const width = Math.round(opts.drawing.width);
|
|
650
650
|
|
|
651
|
-
opts.ctx.fits.add(width);
|
|
651
|
+
opts.ctx.fits.add(`${width}`);
|
|
652
652
|
|
|
653
653
|
return `<figure class="kfig"><div class="fig f${width}">${opts.drawing.svg}</div>${opts.drawing.list}<figcaption>${escaped(opts.drawing.caption)}</figcaption></figure>`;
|
|
654
654
|
};
|
|
@@ -135,6 +135,55 @@ export const TREE_SCHEMA = z.strictObject({
|
|
|
135
135
|
caption: text(VisualizeLimits.MAX_SENTENCE).optional(),
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
+
/** The letter of a grade: A is good, B has gaps, C is weak. */
|
|
139
|
+
export class GradeLetters {
|
|
140
|
+
static readonly A = 'A';
|
|
141
|
+
static readonly B = 'B';
|
|
142
|
+
static readonly C = 'C';
|
|
143
|
+
static readonly SCHEME_SET = new Set<string>([this.A, this.B, this.C]);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** The colour of a part of a bar: the page's state tones. */
|
|
147
|
+
const PART_TONE = choice({ set: new Set(['ok', 'warn', 'bad', 'info']) });
|
|
148
|
+
|
|
149
|
+
/** A grade for each area, as a chip that always shows its letter. */
|
|
150
|
+
export const GRADES_SCHEMA = z
|
|
151
|
+
.array(
|
|
152
|
+
z.strictObject({
|
|
153
|
+
label: text(VisualizeLimits.MAX_LABEL),
|
|
154
|
+
grade: choice({ set: GradeLetters.SCHEME_SET }),
|
|
155
|
+
note: text(VisualizeLimits.MAX_SENTENCE).optional(),
|
|
156
|
+
}),
|
|
157
|
+
)
|
|
158
|
+
.min(1)
|
|
159
|
+
.max(12);
|
|
160
|
+
|
|
161
|
+
/** Numbers as cards: a value, what it is of, and a bar split into its parts. */
|
|
162
|
+
export const METRICS_SCHEMA = z
|
|
163
|
+
.array(
|
|
164
|
+
z.strictObject({
|
|
165
|
+
value: text(16),
|
|
166
|
+
of: text(16).optional(),
|
|
167
|
+
label: text(VisualizeLimits.MAX_LABEL),
|
|
168
|
+
note: text(VisualizeLimits.MAX_SENTENCE).optional(),
|
|
169
|
+
parts: z
|
|
170
|
+
.array(
|
|
171
|
+
z.strictObject({
|
|
172
|
+
label: text(VisualizeLimits.MAX_LABEL),
|
|
173
|
+
value: z.number().min(0).max(1_000_000_000),
|
|
174
|
+
tone: PART_TONE.default('info'),
|
|
175
|
+
}),
|
|
176
|
+
)
|
|
177
|
+
.min(2)
|
|
178
|
+
.max(6)
|
|
179
|
+
.refine((parts) => parts.some((part) => part.value > 0), 'at least one part is above zero'),
|
|
180
|
+
}),
|
|
181
|
+
)
|
|
182
|
+
.min(1)
|
|
183
|
+
.max(6);
|
|
184
|
+
|
|
138
185
|
export type TSequence = z.output<typeof SEQUENCE_SCHEMA>;
|
|
139
186
|
export type TLifecycle = z.output<typeof LIFECYCLE_SCHEMA>;
|
|
140
187
|
export type TTree = z.output<typeof TREE_SCHEMA>;
|
|
188
|
+
export type TGrades = z.output<typeof GRADES_SCHEMA>;
|
|
189
|
+
export type TMetrics = z.output<typeof METRICS_SCHEMA>;
|
|
@@ -54,6 +54,20 @@ export const VI_CHROME: TChrome = {
|
|
|
54
54
|
result: 'Kết quả',
|
|
55
55
|
label: 'Căn cứ',
|
|
56
56
|
evidenceLabels: { verified: 'đã kiểm', inferred: 'suy ra', guess: 'đoán' },
|
|
57
|
+
nodeKinds: {
|
|
58
|
+
step: 'bước',
|
|
59
|
+
service: 'dịch vụ',
|
|
60
|
+
store: 'kho dữ liệu',
|
|
61
|
+
actor: 'tác nhân',
|
|
62
|
+
external: 'bên ngoài',
|
|
63
|
+
},
|
|
64
|
+
edgeVariants: {
|
|
65
|
+
main: 'luồng chính',
|
|
66
|
+
branch: 'nhánh',
|
|
67
|
+
return: 'trả về',
|
|
68
|
+
fanout: 'chia nhiều hướng',
|
|
69
|
+
error: 'lỗi',
|
|
70
|
+
},
|
|
57
71
|
risks: 'Rủi ro',
|
|
58
72
|
risk: 'Rủi ro',
|
|
59
73
|
impact: 'Ảnh hưởng',
|
|
@@ -94,6 +108,17 @@ export const VI_CHROME: TChrome = {
|
|
|
94
108
|
inBoth: 'ở cả hai',
|
|
95
109
|
sources: 'Nguồn',
|
|
96
110
|
terms: 'Các từ trong trang',
|
|
111
|
+
grades: 'Xếp hạng',
|
|
112
|
+
gradeA: 'tốt',
|
|
113
|
+
gradeB: 'còn chỗ hở',
|
|
114
|
+
gradeC: 'yếu',
|
|
115
|
+
metrics: 'Số liệu',
|
|
116
|
+
kickOverview: 'Tổng quan',
|
|
117
|
+
kickStructure: 'Cấu trúc',
|
|
118
|
+
kickDecision: 'Quyết định',
|
|
119
|
+
kickEvidence: 'Bằng chứng',
|
|
120
|
+
kickPlan: 'Kế hoạch',
|
|
121
|
+
kickReference: 'Tham chiếu',
|
|
97
122
|
onlyHere: 'chỉ ở đây',
|
|
98
123
|
addedEdge: 'thêm',
|
|
99
124
|
removedEdge: 'bỏ',
|
package/src/visualize/labels.ts
CHANGED
|
@@ -48,6 +48,8 @@ export class Labels {
|
|
|
48
48
|
statusStates: { ...base.statusStates, ...definedOnly({ value: given.statusStates }) },
|
|
49
49
|
minimapStates: { ...base.minimapStates, ...definedOnly({ value: given.minimapStates }) },
|
|
50
50
|
evidenceLabels: { ...base.evidenceLabels, ...definedOnly({ value: given.evidenceLabels }) },
|
|
51
|
+
nodeKinds: { ...base.nodeKinds, ...definedOnly({ value: given.nodeKinds }) },
|
|
52
|
+
edgeVariants: { ...base.edgeVariants, ...definedOnly({ value: given.edgeVariants }) },
|
|
51
53
|
};
|
|
52
54
|
}
|
|
53
55
|
}
|