adr-kit 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/README.md +9 -6
  2. package/README.zh.md +7 -5
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +19 -3
  5. package/dist/cli.js.map +1 -1
  6. package/dist/commands/completion.d.ts.map +1 -1
  7. package/dist/commands/completion.js +2 -55
  8. package/dist/commands/completion.js.map +1 -1
  9. package/dist/commands/config.d.ts.map +1 -1
  10. package/dist/commands/config.js +3 -0
  11. package/dist/commands/config.js.map +1 -1
  12. package/dist/commands/graph.d.ts +2 -0
  13. package/dist/commands/graph.d.ts.map +1 -1
  14. package/dist/commands/graph.js +37 -7
  15. package/dist/commands/graph.js.map +1 -1
  16. package/dist/commands/init.d.ts.map +1 -1
  17. package/dist/commands/init.js +3 -0
  18. package/dist/commands/init.js.map +1 -1
  19. package/dist/commands/instructions.d.ts.map +1 -1
  20. package/dist/commands/instructions.js +8 -1
  21. package/dist/commands/instructions.js.map +1 -1
  22. package/dist/commands/list.d.ts.map +1 -1
  23. package/dist/commands/list.js +7 -4
  24. package/dist/commands/list.js.map +1 -1
  25. package/dist/commands/supersede.d.ts.map +1 -1
  26. package/dist/commands/supersede.js +12 -7
  27. package/dist/commands/supersede.js.map +1 -1
  28. package/dist/commands/update.d.ts.map +1 -1
  29. package/dist/commands/update.js +3 -1
  30. package/dist/commands/update.js.map +1 -1
  31. package/dist/core/adr.d.ts +1 -0
  32. package/dist/core/adr.d.ts.map +1 -1
  33. package/dist/core/adr.js.map +1 -1
  34. package/dist/core/canvas-view.d.ts +19 -3
  35. package/dist/core/canvas-view.d.ts.map +1 -1
  36. package/dist/core/canvas-view.js +210 -15
  37. package/dist/core/canvas-view.js.map +1 -1
  38. package/dist/core/cli-options.d.ts +23 -0
  39. package/dist/core/cli-options.d.ts.map +1 -0
  40. package/dist/core/cli-options.js +69 -0
  41. package/dist/core/cli-options.js.map +1 -0
  42. package/dist/core/config.d.ts +29 -0
  43. package/dist/core/config.d.ts.map +1 -1
  44. package/dist/core/config.js +69 -1
  45. package/dist/core/config.js.map +1 -1
  46. package/dist/core/deliberation-html.d.ts.map +1 -1
  47. package/dist/core/deliberation-html.js +89 -24
  48. package/dist/core/deliberation-html.js.map +1 -1
  49. package/dist/core/deliberation-view.d.ts.map +1 -1
  50. package/dist/core/deliberation-view.js +28 -195
  51. package/dist/core/deliberation-view.js.map +1 -1
  52. package/dist/core/deliberation.d.ts +15 -0
  53. package/dist/core/deliberation.d.ts.map +1 -1
  54. package/dist/core/deliberation.js +35 -15
  55. package/dist/core/deliberation.js.map +1 -1
  56. package/dist/core/graph-html.d.ts +1 -1
  57. package/dist/core/graph-html.d.ts.map +1 -1
  58. package/dist/core/graph-html.js +163 -44
  59. package/dist/core/graph-html.js.map +1 -1
  60. package/dist/core/graph-view.d.ts +1 -1
  61. package/dist/core/graph-view.d.ts.map +1 -1
  62. package/dist/core/graph-view.js +9 -187
  63. package/dist/core/graph-view.js.map +1 -1
  64. package/dist/core/relation-focus.d.ts +4 -0
  65. package/dist/core/relation-focus.d.ts.map +1 -0
  66. package/dist/core/relation-focus.js +89 -0
  67. package/dist/core/relation-focus.js.map +1 -0
  68. package/dist/core/share.d.ts +30 -0
  69. package/dist/core/share.d.ts.map +1 -0
  70. package/dist/core/share.js +420 -0
  71. package/dist/core/share.js.map +1 -0
  72. package/dist/core/templates.d.ts +4 -1
  73. package/dist/core/templates.d.ts.map +1 -1
  74. package/dist/core/templates.js +4 -1
  75. package/dist/core/templates.js.map +1 -1
  76. package/dist/core/tool-integrations.d.ts.map +1 -1
  77. package/dist/core/tool-integrations.js +47 -29
  78. package/dist/core/tool-integrations.js.map +1 -1
  79. package/dist/core/validate.d.ts +1 -1
  80. package/dist/core/validate.d.ts.map +1 -1
  81. package/dist/core/validate.js +25 -14
  82. package/dist/core/validate.js.map +1 -1
  83. package/dist/core/view-text.d.ts +7 -0
  84. package/dist/core/view-text.d.ts.map +1 -1
  85. package/dist/core/view-text.js +15 -0
  86. package/dist/core/view-text.js.map +1 -1
  87. package/package.json +1 -1
@@ -1,96 +1,5 @@
1
- /** Inline assets for the offline decision map. No network or runtime dependency. */
1
+ /** Map-specific inline styles; the viewer shell is shared with the tree. */
2
2
  export const MAP_STYLE = String.raw `
3
-
4
- :root {
5
- font-family: Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
6
- color: #233c36;
7
- background: #f6f8f5
8
- }
9
- * {
10
- box-sizing: border-box
11
- }
12
- body {
13
- margin: 0
14
- }
15
- a {
16
- color: inherit
17
- }
18
- header {
19
- height: 64px;
20
- background: #fff;
21
- display: flex;
22
- align-items: center;
23
- justify-content: space-between;
24
- padding: 0 28px;
25
- border-bottom: 1px solid #e1e7e1;
26
- gap: 14px
27
- }
28
- .brand {
29
- font-size: 16px;
30
- font-weight: 750;
31
- letter-spacing: -.5px;
32
- display: flex;
33
- align-items: center;
34
- gap: 10px
35
- }
36
- .logo {
37
- background: #284f40;
38
- color: #fff;
39
- border-radius: 8px;
40
- padding: 6px 9px;
41
- font-family: monospace
42
- }
43
- .brand small {
44
- font-size: 11px;
45
- color: #728079;
46
- font-weight: 500;
47
- letter-spacing: 1px;
48
- margin-left: 14px
49
- }
50
- .intro {
51
- padding: 24px 32px 6px
52
- }
53
- .eyebrow {
54
- color: #788b7b;
55
- letter-spacing: 2px;
56
- font: 11px monospace;
57
- margin-bottom: 8px
58
- }
59
- h1 {
60
- font-size: 23px;
61
- letter-spacing: -.6px;
62
- margin: 0;
63
- font-weight: 650
64
- }
65
- .intro p {
66
- font-size: 12px;
67
- color: #718078;
68
- margin: 8px 0 0
69
- }
70
- .stats {
71
- display: flex;
72
- gap: 10px;
73
- flex-wrap: wrap;
74
- margin-top: 16px
75
- }
76
- .stat {
77
- background: #fff;
78
- border: 1px solid #e1e7e1;
79
- border-radius: 10px;
80
- padding: 8px 13px;
81
- font-size: 11px;
82
- color: #728079
83
- }
84
- .stat strong {
85
- color: #233c36;
86
- font-size: 15px;
87
- font-weight: 600;
88
- margin-right: 5px
89
- }
90
- main {
91
- padding: 8px 20px 26px;
92
- overflow-x: auto
93
- }
94
3
  svg {
95
4
  display: block
96
5
  }
@@ -116,9 +25,8 @@ svg {
116
25
  fill: #7c8a80;
117
26
  font-size: 10px
118
27
  }
119
- .node .badge {
120
- fill: #387456;
121
- font-size: 10px
28
+ .node.has-deliberation rect {
29
+ fill: #edf6ef
122
30
  }
123
31
  .node.superseded rect {
124
32
  stroke-dasharray: 5 4
@@ -150,21 +58,6 @@ svg {
150
58
  stroke-width: 1.4;
151
59
  stroke-dasharray: 5 4
152
60
  }
153
- footer {
154
- padding: 16px 32px 30px;
155
- color: #87928a;
156
- font-size: 10px
157
- }
158
- .legend {
159
- display: flex;
160
- gap: 18px;
161
- flex-wrap: wrap
162
- }
163
- .legend span {
164
- display: flex;
165
- align-items: center;
166
- gap: 7px
167
- }
168
61
  .swatch {
169
62
  width: 24px;
170
63
  height: 0;
@@ -174,85 +67,14 @@ footer {
174
67
  border-top: 1.5px dashed #b6c7ba
175
68
  }
176
69
  .swatch.delib {
177
- width: 10px;
178
- height: 10px;
179
- border: 0;
70
+ width: 18px;
71
+ height: 12px;
72
+ border: 1px solid #dce4dc;
180
73
  border-radius: 3px;
181
74
  background: #edf6ef
182
75
  }
183
- #world {
184
- position: relative;
185
- transform-origin: 0 0
186
- }
187
- .controls {
188
- position: absolute;
189
- bottom: 22px;
190
- right: 24px;
191
- display: none;
192
- align-items: center;
193
- padding: 5px;
194
- gap: 3px;
195
- background: #fff;
196
- border: 1px solid #dce4dc;
197
- border-radius: 11px;
198
- box-shadow: 0 4px 20px #294d3e0a
199
- }
200
- .controls button {
201
- border: 0;
202
- background: none;
203
- font: inherit;
204
- color: inherit;
205
- cursor: pointer;
206
- padding: 6px 9px;
207
- border-radius: 7px
208
- }
209
- .controls button:hover {
210
- background: #edf3ef
211
- }
212
- .controls output {
213
- font: 11px monospace;
214
- width: 44px;
215
- text-align: center
216
- }
217
- .hint {
218
- position: absolute;
219
- bottom: 25px;
220
- left: 28px;
221
- display: none;
222
- color: #7a8a7f;
223
- font-size: 11px;
224
- background: #f6f8f5df;
225
- padding: 7px;
226
- border-radius: 5px
227
- }
228
- .interactive main {
229
- height: calc(100dvh - 250px);
230
- min-height: 420px;
231
- padding: 0;
232
- overflow: hidden;
233
- touch-action: none;
234
- cursor: grab;
235
- position: relative
236
- }
237
- .interactive #world {
238
- position: absolute
239
- }
240
- .interactive .controls {
241
- display: flex
242
- }
243
- .interactive .hint {
244
- display: block
245
- }
246
- main.dragging {
247
- cursor: grabbing
248
- }
249
- @media (max-width: 700px) {
250
- .interactive main {
251
- height: calc(100dvh - 240px)
252
- }
253
- .interactive .hint {
254
- display: none
255
- }
256
- }
76
+ #world { position: relative; transform-origin: 0 0; }
77
+ main { overflow: auto; }
78
+ .empty { padding: 24px; }
257
79
  `;
258
80
  //# sourceMappingURL=graph-view.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"graph-view.js","sourceRoot":"","sources":["../../src/core/graph-view.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+PlC,CAAC"}
1
+ {"version":3,"file":"graph-view.js","sourceRoot":"","sources":["../../src/core/graph-view.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ElC,CAAC"}
@@ -0,0 +1,4 @@
1
+ /** Shared hover/keyboard emphasis for both offline views (ADR 11). */
2
+ export declare const RELATION_STYLE: string;
3
+ export declare const RELATION_SCRIPT: string;
4
+ //# sourceMappingURL=relation-focus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relation-focus.d.ts","sourceRoot":"","sources":["../../src/core/relation-focus.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,eAAO,MAAM,cAAc,QAQ1B,CAAC;AAEF,eAAO,MAAM,eAAe,QA6E3B,CAAC"}
@@ -0,0 +1,89 @@
1
+ /** Shared hover/keyboard emphasis for both offline views (ADR 11). */
2
+ export const RELATION_STYLE = String.raw `
3
+ .node, .card, .edge, #edges path { transition: opacity .16s ease; }
4
+ .node.relation-dim, .card.relation-dim { opacity: .25; }
5
+ .edge.relation-dim, #edges path.relation-dim { opacity: .12; }
6
+ .card:focus-visible { outline: 2px solid #7750a5; outline-offset: 3px; }
7
+ @media (prefers-reduced-motion: reduce) {
8
+ .node, .card, .edge, #edges path { transition: none; }
9
+ }
10
+ `;
11
+ export const RELATION_SCRIPT = String.raw `
12
+ (() => {
13
+ const world = document.getElementById('world');
14
+ const viewport = document.getElementById('viewport');
15
+ if (!world || !viewport) return;
16
+ const isTree = !!document.getElementById('edges');
17
+ const nodes = Array.from(world.querySelectorAll(isTree ? '.card' : '.node'));
18
+ const key = node => isTree ? node.id : node.dataset.adr;
19
+ let active = null;
20
+
21
+ // For a map, only incident edges count. For a tree, walk upstream and
22
+ // downstream separately: walking both ways in one pass would pull in siblings.
23
+ function relatedNodes(id, links, tree) {
24
+ const lit = new Set([id]);
25
+ if (!tree) {
26
+ for (const link of links) {
27
+ if (link.from === id) lit.add(link.to);
28
+ if (link.to === id) lit.add(link.from);
29
+ }
30
+ return lit;
31
+ }
32
+ for (const direction of ['from', 'to']) {
33
+ const seen = new Set([id]), queue = [id];
34
+ for (let i = 0; i < queue.length; i++) {
35
+ for (const link of links) {
36
+ const next = direction === 'from' ? link.to : link.from;
37
+ if (link[direction] !== queue[i] || seen.has(next)) continue;
38
+ seen.add(next);
39
+ lit.add(next);
40
+ queue.push(next);
41
+ }
42
+ }
43
+ }
44
+ return lit;
45
+ }
46
+
47
+ function nodeFor(target) {
48
+ if (!target || !world.contains(target)) return null;
49
+ return target.closest('.card, .node') || target.closest('a')?.querySelector('.node') || null;
50
+ }
51
+
52
+ function paint() {
53
+ if (active && active.hidden) active = null;
54
+ const paths = Array.from(world.querySelectorAll(isTree ? '#edges path' : '.edge'));
55
+ const links = paths.map(path => ({
56
+ path,
57
+ // Tree edges may start at an answer within a card, not the card itself.
58
+ from: isTree ? document.getElementById(path.dataset.from).closest('.card').id : path.dataset.from,
59
+ to: path.dataset.to,
60
+ }));
61
+ const id = active && key(active);
62
+ const lit = id ? relatedNodes(id, links, isTree) : null;
63
+ nodes.forEach(node => node.classList.toggle('relation-dim', !!lit && !lit.has(key(node))));
64
+ links.forEach(link => {
65
+ const related = !lit || (isTree ? lit.has(link.from) && lit.has(link.to) : link.from === id || link.to === id);
66
+ link.path.classList.toggle('relation-dim', !related);
67
+ });
68
+ }
69
+
70
+ function select(node) {
71
+ if (active === node) return;
72
+ active = node;
73
+ paint();
74
+ }
75
+ viewport.addEventListener('pointermove', event => {
76
+ if (event.buttons || event.pointerType === 'touch') return;
77
+ select(nodeFor(event.target));
78
+ });
79
+ viewport.addEventListener('pointerleave', () => select(null));
80
+ viewport.addEventListener('pointerdown', () => select(null));
81
+ world.addEventListener('focusin', event => select(nodeFor(event.target)));
82
+ world.addEventListener('focusout', event => select(nodeFor(event.relatedTarget)));
83
+ viewport.addEventListener('keydown', event => { if (event.key === 'Escape') select(null); });
84
+ window.addEventListener('blur', () => select(null));
85
+ // Folding recreates the tree's edges; apply emphasis to the new paths too.
86
+ world.addEventListener('adr-layout', paint);
87
+ })();
88
+ `;
89
+ //# sourceMappingURL=relation-focus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relation-focus.js","sourceRoot":"","sources":["../../src/core/relation-focus.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;CAQvC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6ExC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * The Save-as-image action: renders the current view into a branded,
3
+ * self-contained PNG entirely on the client — serializes the diagram,
4
+ * rasterizes it, and composes the frame around it. No network, no third-party
5
+ * renderer, no runtime dependency (ADR 8/9): the only inputs are the live DOM
6
+ * and the page's own stylesheet text. Nothing is uploaded, and the browser
7
+ * decides where the download lands: a page cannot write to a chosen folder.
8
+ */
9
+ /** The credit line every shared image carries. */
10
+ export declare const SHARE_WATERMARK = "luochang212/adr-kit";
11
+ /**
12
+ * The button is a camera, because that is what it does: it makes a picture of
13
+ * the view. A share glyph would promise sending it somewhere, a download glyph
14
+ * would promise only a file, and neither is what happens.
15
+ *
16
+ * The glyph is Lucide's `camera` (ISC), the same icon skill-zoo uses, at 24
17
+ * units in a 24 box and stroke 2 — 1.33px on screen at 16px, matching the
18
+ * Info glyph's 1.4.
19
+ */
20
+ export declare const CAMERA_ICON: string;
21
+ export declare const SHARE_BUTTON_HTML: string;
22
+ /**
23
+ * The button carries no text, so its feedback is a status line: what was saved,
24
+ * whether the copy worked, and nothing it cannot know (a page cannot tell which
25
+ * folder the download reached).
26
+ */
27
+ export declare const SHARE_STYLE: string;
28
+ export declare const GITHUB_MARK_PATH: string;
29
+ export declare const SHARE_SCRIPT: string;
30
+ //# sourceMappingURL=share.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"share.d.ts","sourceRoot":"","sources":["../../src/core/share.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,kDAAkD;AAClD,eAAO,MAAM,eAAe,wBAAwB,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,QAGZ,CAAC;AAEb,eAAO,MAAM,iBAAiB,QACD,CAAC;AAE9B;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAGvB,CAAC;AAIF,eAAO,MAAM,gBAAgB,QAK2D,CAAC;AAIzF,eAAO,MAAM,YAAY,QAuXxB,CAAC"}