@issuegraph/viewer 0.3.0 → 0.9.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.
Files changed (59) hide show
  1. package/dist/clusters.d.ts +116 -0
  2. package/dist/clusters.d.ts.map +1 -1
  3. package/dist/clusters.js +85 -2
  4. package/dist/clusters.js.map +1 -1
  5. package/dist/document.d.ts +228 -5
  6. package/dist/document.d.ts.map +1 -1
  7. package/dist/document.js +204 -3
  8. package/dist/document.js.map +1 -1
  9. package/dist/element.d.ts +11 -0
  10. package/dist/element.d.ts.map +1 -1
  11. package/dist/element.js.map +1 -1
  12. package/dist/index.d.ts +17 -6
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +31 -4
  15. package/dist/index.js.map +1 -1
  16. package/dist/layout.d.ts +79 -50
  17. package/dist/layout.d.ts.map +1 -1
  18. package/dist/layout.js +371 -170
  19. package/dist/layout.js.map +1 -1
  20. package/dist/marks.d.ts +105 -0
  21. package/dist/marks.d.ts.map +1 -0
  22. package/dist/marks.js +430 -0
  23. package/dist/marks.js.map +1 -0
  24. package/dist/mount.d.ts +13 -0
  25. package/dist/mount.d.ts.map +1 -1
  26. package/dist/mount.js +69 -1
  27. package/dist/mount.js.map +1 -1
  28. package/dist/navigation.d.ts +14 -0
  29. package/dist/navigation.d.ts.map +1 -1
  30. package/dist/navigation.js +51 -0
  31. package/dist/navigation.js.map +1 -1
  32. package/dist/parts.d.ts +308 -2
  33. package/dist/parts.d.ts.map +1 -1
  34. package/dist/parts.js +845 -65
  35. package/dist/parts.js.map +1 -1
  36. package/dist/projections/graph.d.ts +25 -0
  37. package/dist/projections/graph.d.ts.map +1 -1
  38. package/dist/projections/graph.js +476 -335
  39. package/dist/projections/graph.js.map +1 -1
  40. package/dist/projections/linear.d.ts +135 -0
  41. package/dist/projections/linear.d.ts.map +1 -1
  42. package/dist/projections/linear.js +266 -31
  43. package/dist/projections/linear.js.map +1 -1
  44. package/dist/projections/tree.d.ts.map +1 -1
  45. package/dist/projections/tree.js +29 -3
  46. package/dist/projections/tree.js.map +1 -1
  47. package/dist/styles.d.ts +10 -1
  48. package/dist/styles.d.ts.map +1 -1
  49. package/dist/styles.js +1275 -132
  50. package/dist/styles.js.map +1 -1
  51. package/dist/theme.d.ts +5 -6
  52. package/dist/theme.d.ts.map +1 -1
  53. package/dist/theme.js +119 -7
  54. package/dist/theme.js.map +1 -1
  55. package/dist/vocabulary.d.ts +39 -0
  56. package/dist/vocabulary.d.ts.map +1 -1
  57. package/dist/vocabulary.js +27 -0
  58. package/dist/vocabulary.js.map +1 -1
  59. package/package.json +2 -2
package/dist/layout.d.ts CHANGED
@@ -46,6 +46,15 @@ export interface NodeBox {
46
46
  /** The slot this node belongs to, when it is on the spine. */
47
47
  readonly rank: number | null;
48
48
  readonly held: boolean;
49
+ /**
50
+ * The runner is working this one NOW.
51
+ *
52
+ * §16b gives it the top station on the spine, above rank 1, because "what is
53
+ * running" and "what is next" are the same question asked one step apart —
54
+ * and a NOW row rendered above the canvas, which is what shipped, is off the
55
+ * one line the whole sequence is supposed to read down.
56
+ */
57
+ readonly now?: boolean;
49
58
  }
50
59
  export interface Point {
51
60
  readonly x: number;
@@ -62,68 +71,88 @@ export interface GraphLayout {
62
71
  /** The free vertical channels arcs route through. */
63
72
  readonly leftChannel: number;
64
73
  readonly rightChannel: number;
74
+ /**
75
+ * The x of the spine LINE — the one vertical the whole sequence reads off.
76
+ * Stations are centred on it and the cards sit to its right.
77
+ */
78
+ readonly spineLineX: number;
79
+ /** Where the spine line starts and ends, so it spans the stations and no more. */
80
+ readonly spineTop: number;
81
+ readonly spineBottom: number;
82
+ /** The x each of the three column headings is set at. */
83
+ readonly columnX: Readonly<Record<Column, number>>;
84
+ /**
85
+ * The slot leads the canvas draws NOWHERE — runner-held, and blocking nothing
86
+ * on the spine, so they explain nothing about the order. They are the graph's
87
+ * half of §16a's footer group, and the projection renders them beneath the
88
+ * stage as that group rather than on a column.
89
+ */
90
+ readonly footer: readonly string[];
91
+ /** Whether this layout is the in-column preview or the full-width picture. */
92
+ readonly compact: boolean;
65
93
  }
66
94
  /**
67
- * How wide a drawn label runs, under the same model {@link fitLabel} truncates
68
- * with.
95
+ * How wide a drawn label runs.
69
96
  *
70
- * EXPORTED SO A TEST CAN CHECK THE GEOMETRY WITHOUT RESTATING THE MODEL. The
71
- * overflow invariant used to be asserted with `text.length * --ig-char-width`,
72
- * which is the mono advance at the wrong size and the very assumption #44
73
- * named — so the guard shared the defect it was guarding against. Measuring
74
- * with this checks that the right box got the right label; the wide-glyph
75
- * bound is what checks the model itself, against a number stated outside it.
97
+ * NOTHING TRUNCATES ANY MORE, and this is what replaced the function that did.
98
+ * A node is an HTML card whose title wraps, so the question stopped being "how
99
+ * much of this fits on one line" and became "how many lines does this need" —
100
+ * which is what {@link layoutGraph} asks it, to give a card a height before
101
+ * anything is rendered. `fitLabel` went with the truncation it existed to
102
+ * perform: §16b's acceptance is that nothing truncates that the design draws in
103
+ * full, and a helper that shortens a title had no caller left.
104
+ *
105
+ * IT IS A CEILING, per character class rather than a flat average — see
106
+ * `labelWidth`. A card that reserves slightly too much leaves a gap; one that
107
+ * reserves too little is overlapped by the next rank.
76
108
  */
77
109
  export declare function measureLabel(theme: Theme, label: string): number;
78
- export declare function fitLabel(theme: Theme, label: string, width: number): string;
79
- /** Lay a document out. Pure: coordinates depend only on the document and the theme. */
80
- export declare function layoutGraph(document: NormalizedDocument, theme: Theme): GraphLayout;
110
+ /**
111
+ * Lay a document out. Pure: coordinates depend only on the document, the theme
112
+ * and the size.
113
+ *
114
+ * COMPACT IS A SIZE, NOT A DEGRADED MODE. §16b is explicit that at a settings
115
+ * column's width the arcs and both gutters cannot be drawn legibly, so the
116
+ * in-column case is a spine-only preview with an expand affordance rather than
117
+ * the same picture squeezed. Expressed as a zero-width gutter, so exactly one
118
+ * layout computes both and the spine's own geometry cannot differ between them.
119
+ */
120
+ export declare function layoutGraph(document: NormalizedDocument, theme: Theme, compact?: boolean): GraphLayout;
81
121
  export interface EdgeGeometry {
82
122
  /** The SVG path. Always a quadratic through one of the free channels. */
83
123
  readonly d: string;
84
124
  readonly start: Point;
85
125
  readonly end: Point;
126
+ /**
127
+ * The quadratic's control point — the one `d` bows through.
128
+ *
129
+ * Published so a caller that needs a point ON the curve can solve for one
130
+ * rather than estimate it from the chord. The midpoint of a quadratic is
131
+ * `¼P₀ + ½C + ¼P₂`, which is a different point from the chord's midpoint
132
+ * wherever the curve actually bows, and the difference is the whole width of
133
+ * a channel.
134
+ */
135
+ readonly control: Point;
136
+ /**
137
+ * Which bound of its own box each endpoint sits on.
138
+ *
139
+ * PUBLISHED BECAUSE "OUTSIDE THE CARD" IS NOT DERIVABLE FROM THE LINE, and
140
+ * three separate attempts to derive it proved that the hard way. A caller
141
+ * placing a mark beside an endpoint must know which way is away from the card,
142
+ * and the chord's direction, the arriving tangent and the routing channel each
143
+ * answer a different question — so each of them was right for some edges and
144
+ * put marks inside a card for others.
145
+ *
146
+ * `facingSide` already decides this, per endpoint, and used to discard it. A
147
+ * `left` anchor is cleared by moving further left; a `right` one by moving
148
+ * right. The two ends genuinely differ: an arc between a gutter card and a
149
+ * spine card leaves one box's right face and arrives on the other's left, so
150
+ * one shared direction cannot clear both.
151
+ */
152
+ readonly startSide: 'left' | 'right';
153
+ readonly endSide: 'left' | 'right';
86
154
  /** Radians. Orients the terminal marker along the path's own tangent. */
87
155
  readonly endAngle: number;
88
156
  }
89
- /**
90
- * The geometry for one edge, derived entirely from the two boxes' bounds.
91
- *
92
- * Returns `null` when either end has no box — which `normalizeDocument` has
93
- * already made impossible for a kept edge, so a `null` here means a caller
94
- * built a layout from a different document than the edge came from. Refusing is
95
- * better than drawing at coordinates nobody computed.
96
- */
97
157
  export declare function edgeGeometry(layout: GraphLayout, edge: ViewerEdge): EdgeGeometry | null;
98
- /**
99
- * The path joining two members of one together unit, clear of every member box.
100
- *
101
- * ONE CONNECTOR PER DECLARED EDGE, which is why this takes two keys rather than
102
- * a position in the member list. A group is joined by pointing at any existing
103
- * member (§4.3.7), so `2 together-with 1` plus `3 together-with 1` is an
104
- * ordinary STAR whose members lay out as three consecutive rows — and a
105
- * connector drawn between adjacent rows would claim a `2`–`3` relationship the
106
- * document never declares while leaving the real `1`–`3` edge undrawable.
107
- *
108
- * TWO ROUTES, and the branch is the whole of it. Members of a slot are placed
109
- * consecutively in one column, so an edge between NEIGHBOURING rows crosses
110
- * only the gap between them and is drawn straight. An edge that spans a row —
111
- * which only a star can produce — would run through the node between them, so
112
- * it is routed out to a lane in the enclosure's own padding. The lane sits left
113
- * of `x`, and every member box in a column starts at exactly `x`, so the
114
- * vertical run is provably outside every occupied x-range rather than merely
115
- * looking clear.
116
- *
117
- * Endpoints come from measured bounds on both routes, per the kit's
118
- * implementation note: a hit target derived from an eyeballed offset drifts the
119
- * first time the type scale moves.
120
- */
121
- export declare function connectorPath(layout: GraphLayout, members: readonly string[], from: string, to: string, theme: Theme): string | null;
122
- /** The box enclosing a together unit's members, padded clear of their bounds. */
123
- export declare function enclosureBounds(layout: GraphLayout, members: readonly string[], theme: Theme): {
124
- x: number;
125
- y: number;
126
- width: number;
127
- height: number;
128
- } | null;
129
158
  //# sourceMappingURL=layout.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.d.ts","sourceRoot":"","sources":["../src/layout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AACpE,OAAO,EAAoB,KAAK,KAAK,EAAgB,MAAM,YAAY,CAAC;AAExE;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,SAAS,MAAM,EAO7C,CAAC;AAEH,mCAAmC;AACnC,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;AAEhD,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,C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