@kgdiff/viewer 0.5.0 → 0.6.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 (232) hide show
  1. package/README.md +43 -16
  2. package/custom-elements.json +2347 -0
  3. package/dist/bind.d.ts +41 -0
  4. package/dist/bind.d.ts.map +1 -0
  5. package/dist/bind.js +47 -0
  6. package/dist/bind.js.map +1 -0
  7. package/dist/controller.d.ts +22 -74
  8. package/dist/controller.d.ts.map +1 -1
  9. package/dist/controller.js +35 -376
  10. package/dist/controller.js.map +1 -1
  11. package/dist/dom.d.ts +10 -0
  12. package/dist/dom.d.ts.map +1 -1
  13. package/dist/dom.js +29 -0
  14. package/dist/dom.js.map +1 -1
  15. package/dist/element.d.ts +52 -46
  16. package/dist/element.d.ts.map +1 -1
  17. package/dist/element.js +362 -403
  18. package/dist/element.js.map +1 -1
  19. package/dist/elements/actions.d.ts +27 -0
  20. package/dist/elements/actions.d.ts.map +1 -0
  21. package/dist/elements/actions.js +81 -0
  22. package/dist/elements/actions.js.map +1 -0
  23. package/dist/elements/bound.d.ts +63 -0
  24. package/dist/elements/bound.d.ts.map +1 -0
  25. package/dist/elements/bound.js +213 -0
  26. package/dist/elements/bound.js.map +1 -0
  27. package/dist/elements/change-detail.d.ts +25 -0
  28. package/dist/elements/change-detail.d.ts.map +1 -0
  29. package/dist/elements/change-detail.js +19 -0
  30. package/dist/elements/change-detail.js.map +1 -0
  31. package/dist/elements/change-list.d.ts +27 -0
  32. package/dist/elements/change-list.d.ts.map +1 -0
  33. package/dist/elements/change-list.js +29 -0
  34. package/dist/elements/change-list.js.map +1 -0
  35. package/dist/elements/filters.d.ts +25 -0
  36. package/dist/elements/filters.d.ts.map +1 -0
  37. package/dist/elements/filters.js +19 -0
  38. package/dist/elements/filters.js.map +1 -0
  39. package/dist/elements/legend.d.ts +40 -0
  40. package/dist/elements/legend.d.ts.map +1 -0
  41. package/dist/elements/legend.js +87 -0
  42. package/dist/elements/legend.js.map +1 -0
  43. package/dist/elements/minimap.d.ts +38 -0
  44. package/dist/elements/minimap.d.ts.map +1 -0
  45. package/dist/elements/minimap.js +59 -0
  46. package/dist/elements/minimap.js.map +1 -0
  47. package/dist/elements/root.d.ts +40 -0
  48. package/dist/elements/root.d.ts.map +1 -0
  49. package/dist/elements/root.js +67 -0
  50. package/dist/elements/root.js.map +1 -0
  51. package/dist/elements/search.d.ts +29 -0
  52. package/dist/elements/search.d.ts.map +1 -0
  53. package/dist/elements/search.js +23 -0
  54. package/dist/elements/search.js.map +1 -0
  55. package/dist/elements/stage-context.d.ts +31 -0
  56. package/dist/elements/stage-context.d.ts.map +1 -0
  57. package/dist/elements/stage-context.js +4 -0
  58. package/dist/elements/stage-context.js.map +1 -0
  59. package/dist/elements/stage.d.ts +65 -0
  60. package/dist/elements/stage.d.ts.map +1 -0
  61. package/dist/elements/stage.js +259 -0
  62. package/dist/elements/stage.js.map +1 -0
  63. package/dist/elements/title.d.ts +25 -0
  64. package/dist/elements/title.d.ts.map +1 -0
  65. package/dist/elements/title.js +19 -0
  66. package/dist/elements/title.js.map +1 -0
  67. package/dist/elements/transport.d.ts +29 -0
  68. package/dist/elements/transport.d.ts.map +1 -0
  69. package/dist/elements/transport.js +24 -0
  70. package/dist/elements/transport.js.map +1 -0
  71. package/dist/elements/view-bound.d.ts +39 -0
  72. package/dist/elements/view-bound.d.ts.map +1 -0
  73. package/dist/elements/view-bound.js +88 -0
  74. package/dist/elements/view-bound.js.map +1 -0
  75. package/dist/elements/view-dock.d.ts +28 -0
  76. package/dist/elements/view-dock.d.ts.map +1 -0
  77. package/dist/elements/view-dock.js +28 -0
  78. package/dist/elements/view-dock.js.map +1 -0
  79. package/dist/elements/zoom.d.ts +28 -0
  80. package/dist/elements/zoom.d.ts.map +1 -0
  81. package/dist/elements/zoom.js +22 -0
  82. package/dist/elements/zoom.js.map +1 -0
  83. package/dist/i18n.d.ts +10 -0
  84. package/dist/i18n.d.ts.map +1 -1
  85. package/dist/i18n.js +20 -0
  86. package/dist/i18n.js.map +1 -1
  87. package/dist/icons.d.ts +1 -0
  88. package/dist/icons.d.ts.map +1 -1
  89. package/dist/icons.js +1 -0
  90. package/dist/icons.js.map +1 -1
  91. package/dist/index.d.ts +328 -34
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +13 -0
  94. package/dist/index.js.map +1 -1
  95. package/dist/keyboard.d.ts +39 -2
  96. package/dist/keyboard.d.ts.map +1 -1
  97. package/dist/keyboard.js +145 -62
  98. package/dist/keyboard.js.map +1 -1
  99. package/dist/layout-store.d.ts +26 -0
  100. package/dist/layout-store.d.ts.map +1 -0
  101. package/dist/layout-store.js +46 -0
  102. package/dist/layout-store.js.map +1 -0
  103. package/dist/panel-levels.d.ts +18 -0
  104. package/dist/panel-levels.d.ts.map +1 -0
  105. package/dist/panel-levels.js +41 -0
  106. package/dist/panel-levels.js.map +1 -0
  107. package/dist/panels.d.ts +28 -0
  108. package/dist/panels.d.ts.map +1 -0
  109. package/dist/panels.js +73 -0
  110. package/dist/panels.js.map +1 -0
  111. package/dist/prefs.d.ts +5 -2
  112. package/dist/prefs.d.ts.map +1 -1
  113. package/dist/prefs.js +12 -3
  114. package/dist/prefs.js.map +1 -1
  115. package/dist/react.d.ts +460 -0
  116. package/dist/react.d.ts.map +1 -0
  117. package/dist/react.js +2 -0
  118. package/dist/react.js.map +1 -0
  119. package/dist/root-element.d.ts +122 -0
  120. package/dist/root-element.d.ts.map +1 -0
  121. package/dist/root-element.js +541 -0
  122. package/dist/root-element.js.map +1 -0
  123. package/dist/root.d.ts +30 -30
  124. package/dist/root.d.ts.map +1 -1
  125. package/dist/root.js +65 -42
  126. package/dist/root.js.map +1 -1
  127. package/dist/session.d.ts +19 -3
  128. package/dist/session.d.ts.map +1 -1
  129. package/dist/session.js +15 -17
  130. package/dist/session.js.map +1 -1
  131. package/dist/standalone/kgdiff-viewer.js +4 -4
  132. package/dist/styles.d.ts +4 -0
  133. package/dist/styles.d.ts.map +1 -1
  134. package/dist/styles.js +224 -84
  135. package/dist/styles.js.map +1 -1
  136. package/dist/theme.d.ts +7 -0
  137. package/dist/theme.d.ts.map +1 -1
  138. package/dist/theme.js +10 -7
  139. package/dist/theme.js.map +1 -1
  140. package/dist/topics.d.ts +8 -0
  141. package/dist/topics.d.ts.map +1 -0
  142. package/dist/topics.js +18 -0
  143. package/dist/topics.js.map +1 -0
  144. package/dist/ui/change-list.d.ts.map +1 -1
  145. package/dist/ui/change-list.js +2 -2
  146. package/dist/ui/change-list.js.map +1 -1
  147. package/dist/ui/context.d.ts +20 -7
  148. package/dist/ui/context.d.ts.map +1 -1
  149. package/dist/ui/context.js.map +1 -1
  150. package/dist/ui/header.d.ts +41 -3
  151. package/dist/ui/header.d.ts.map +1 -1
  152. package/dist/ui/header.js +99 -34
  153. package/dist/ui/header.js.map +1 -1
  154. package/dist/ui/legend.d.ts +15 -0
  155. package/dist/ui/legend.d.ts.map +1 -0
  156. package/dist/ui/legend.js +68 -0
  157. package/dist/ui/legend.js.map +1 -0
  158. package/dist/ui/popovers.d.ts +3 -1
  159. package/dist/ui/popovers.d.ts.map +1 -1
  160. package/dist/ui/popovers.js +62 -23
  161. package/dist/ui/popovers.js.map +1 -1
  162. package/dist/ui/search.d.ts.map +1 -1
  163. package/dist/ui/search.js +3 -2
  164. package/dist/ui/search.js.map +1 -1
  165. package/dist/ui/sidebar.d.ts +26 -3
  166. package/dist/ui/sidebar.d.ts.map +1 -1
  167. package/dist/ui/sidebar.js +344 -12
  168. package/dist/ui/sidebar.js.map +1 -1
  169. package/dist/ui/stage.d.ts +56 -1
  170. package/dist/ui/stage.d.ts.map +1 -1
  171. package/dist/ui/stage.js +244 -256
  172. package/dist/ui/stage.js.map +1 -1
  173. package/dist/ui/transport.d.ts +12 -0
  174. package/dist/ui/transport.d.ts.map +1 -0
  175. package/dist/ui/transport.js +198 -0
  176. package/dist/ui/transport.js.map +1 -0
  177. package/dist/ui/zoom.d.ts +15 -0
  178. package/dist/ui/zoom.d.ts.map +1 -0
  179. package/dist/ui/zoom.js +30 -0
  180. package/dist/ui/zoom.js.map +1 -0
  181. package/dist/view.d.ts +94 -0
  182. package/dist/view.d.ts.map +1 -0
  183. package/dist/view.js +441 -0
  184. package/dist/view.js.map +1 -0
  185. package/package.json +95 -12
  186. package/src/bind.ts +80 -0
  187. package/src/controller.ts +51 -442
  188. package/src/dom.ts +30 -0
  189. package/src/element.ts +364 -406
  190. package/src/elements/actions.ts +94 -0
  191. package/src/elements/bound.ts +247 -0
  192. package/src/elements/change-detail.ts +34 -0
  193. package/src/elements/change-list.ts +51 -0
  194. package/src/elements/filters.ts +34 -0
  195. package/src/elements/legend.ts +103 -0
  196. package/src/elements/minimap.ts +75 -0
  197. package/src/elements/root.ts +86 -0
  198. package/src/elements/search.ts +38 -0
  199. package/src/elements/stage-context.ts +34 -0
  200. package/src/elements/stage.ts +285 -0
  201. package/src/elements/title.ts +34 -0
  202. package/src/elements/transport.ts +39 -0
  203. package/src/elements/view-bound.ts +118 -0
  204. package/src/elements/view-dock.ts +43 -0
  205. package/src/elements/zoom.ts +38 -0
  206. package/src/i18n.ts +20 -0
  207. package/src/icons.ts +1 -0
  208. package/src/index.ts +347 -34
  209. package/src/keyboard.ts +188 -61
  210. package/src/layout-store.ts +71 -0
  211. package/src/panel-levels.ts +53 -0
  212. package/src/panels.ts +81 -0
  213. package/src/prefs.ts +12 -4
  214. package/src/react.ts +459 -0
  215. package/src/root-element.ts +624 -0
  216. package/src/root.ts +92 -65
  217. package/src/session.ts +22 -33
  218. package/src/styles.ts +245 -84
  219. package/src/theme.ts +10 -7
  220. package/src/topics.ts +37 -0
  221. package/src/ui/change-list.ts +6 -2
  222. package/src/ui/context.ts +20 -7
  223. package/src/ui/header.ts +127 -56
  224. package/src/ui/legend.ts +112 -0
  225. package/src/ui/popovers.ts +68 -25
  226. package/src/ui/search.ts +10 -5
  227. package/src/ui/sidebar.ts +386 -23
  228. package/src/ui/stage.ts +267 -331
  229. package/src/ui/transport.ts +240 -0
  230. package/src/ui/zoom.ts +45 -0
  231. package/src/view.ts +516 -0
  232. package/vscode.html-custom-data.json +726 -0
package/src/react.ts ADDED
@@ -0,0 +1,459 @@
1
+ /**
2
+ * React 19's JSX types for the viewer's elements (RFC 0001 §8). Generated from
3
+ * custom-elements.json by scripts/manifest.ts: do not edit; run
4
+ * `pnpm --filter @kgdiff/viewer manifest` after changing the sources.
5
+ *
6
+ * A TypeScript project with React 19 enables them once, anywhere:
7
+ *
8
+ * import type {} from '@kgdiff/viewer/react';
9
+ *
10
+ * Props are the elements' properties (React 19 sets a prop as the property the element has,
11
+ * and as an attribute otherwise), their attributes without a property, and the roots' events
12
+ * as React 19 listens to them: `onkgdiff-select`. Methods go through a `ref`.
13
+ *
14
+ * @experimental In 0.6; stable from 0.7 (RFC 0001, decision 7), as the elements it describes.
15
+ */
16
+ import type { HTMLAttributes, Ref } from 'react';
17
+ import type { KgdiffEventMap } from './index.js';
18
+
19
+ /** The element of a tag: a prop's type is its property's. */
20
+ type Tag<T extends keyof HTMLElementTagNameMap> = HTMLElementTagNameMap[T];
21
+
22
+ /** What every element takes: React's HTML attributes and a ref to the element. */
23
+ type Props<T extends keyof HTMLElementTagNameMap> = HTMLAttributes<Tag<T>> & { ref?: Ref<Tag<T>> };
24
+
25
+ declare module 'react' {
26
+ namespace JSX {
27
+ interface IntrinsicElements {
28
+ /**
29
+ * `<kgdiff-viewer>`:
30
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-viewer
31
+ */
32
+ 'kgdiff-viewer': Props<'kgdiff-viewer'> & {
33
+ /**
34
+ * Reflected to the `chrome` attribute. `none` shows the graph alone: no title, actions,
35
+ * view dock (with the step caption and playback bar), change list, zoom buttons, minimap or
36
+ * legend card; the hover tooltip and a one-line legend stay. Clicks and keyboard shortcuts
37
+ * do nothing, the minimum height drops from 420px to 120px, and the view stays fitted: when
38
+ * the canvas is resized (unless the user panned or zoomed since) and at the start of every
39
+ * loop. Labels are never cut at the edge: one pushed from its spot by a neighbour moves
40
+ * inside or is left out. Default `full`.
41
+ */
42
+ chrome?: Tag<'kgdiff-viewer'>['chrome'];
43
+ /**
44
+ * Reflected to the `legend` attribute: `full` (the card), `mini` (one line: the families
45
+ * this diff has, then unchanged), `none`. Default `auto`: `full`, or `mini` with
46
+ * `chrome="none"`.
47
+ */
48
+ legend?: Tag<'kgdiff-viewer'>['legend'];
49
+ /**
50
+ * The page's declaration of panel states, reflected to the `panels` attribute: a string
51
+ * (`"detail:collapsed minimap:hidden"`) or an object (`{ detail: 'collapsed' }`); reading
52
+ * it gives the object. Regions not named keep their state; entries that name no region or
53
+ * state are ignored with a warning. It wins over what the user chose before (remembered)
54
+ * and a report's `view.panels`; the user can still open and close collapsed regions, and
55
+ * declaring the same again keeps what they did. The presets `sidebar="closed"` (list,
56
+ * detail, search and filters collapsed), `header="compact"` (title hidden) and
57
+ * `chrome="none"` (everything but the canvas and the legend hidden) are panel states too;
58
+ * `panels` wins over them for the regions it names. The states every region has now are in
59
+ * `layout`.
60
+ */
61
+ panels?: Tag<'kgdiff-viewer'>['panels'] | string;
62
+ /**
63
+ * Reflected to the `persist` attribute. `local` (the default): the layout remembers the
64
+ * user's panel states, sizes, theme, palette and language in `localStorage` (under
65
+ * `persistKey`, shared by the viewers of the origin with the same key). `none`: it
66
+ * remembers nothing.
67
+ */
68
+ persist?: Tag<'kgdiff-viewer'>['persist'];
69
+ /**
70
+ * Reflected to the `persist-key` attribute: the `localStorage` key the layout remembers
71
+ * under. Viewers with the same key share what they remember; give each app on a shared
72
+ * origin (a GitHub Pages user site, say) a key of its own. Default `kgdiff:viewer`.
73
+ */
74
+ persistKey?: Tag<'kgdiff-viewer'>['persistKey'];
75
+ /**
76
+ * Reflected to the `mode` attribute. Default `overlay`.
77
+ */
78
+ mode?: Tag<'kgdiff-viewer'>['mode'];
79
+ /**
80
+ * Reflected to the `scope` attribute. Default `all` (`changes` for large graphs). Fixed to
81
+ * `changes` when the layout covers only the changes.
82
+ */
83
+ scope?: Tag<'kgdiff-viewer'>['scope'];
84
+ /**
85
+ * Reflected to the `theme` attribute. Default `auto`.
86
+ */
87
+ theme?: Tag<'kgdiff-viewer'>['theme'];
88
+ /**
89
+ * Reflected to the `palette` attribute. Default `default`.
90
+ */
91
+ palette?: Tag<'kgdiff-viewer'>['palette'];
92
+ /**
93
+ * Reflected to the `locale` attribute. Default from `navigator.language`.
94
+ */
95
+ locale?: Tag<'kgdiff-viewer'>['locale'];
96
+ /**
97
+ * Reflected to the boolean `loop` attribute. In `replay` mode the replay plays by itself
98
+ * and starts again `loopDelay` ms after it ends. `pause()` stops it until `play()`. Default
99
+ * false.
100
+ */
101
+ loop?: Tag<'kgdiff-viewer'>['loop'];
102
+ /**
103
+ * Reflected to `loop-delay`: ms between the end of a looping replay and its restart.
104
+ * Default 1200.
105
+ */
106
+ loopDelay?: Tag<'kgdiff-viewer'>['loopDelay'];
107
+ /**
108
+ * With `loop`, the replay pauses while the pointer is over the graph and continues when it
109
+ * leaves (a mouse or pen; not touch). Reflected as `pause-on-hover="false"` when off.
110
+ * Default true.
111
+ */
112
+ pauseOnHover?: Tag<'kgdiff-viewer'>['pauseOnHover'];
113
+ /**
114
+ * Reflected to the `shortcuts` attribute: where the keyboard shortcuts apply. `scoped` (the
115
+ * default): while focus is inside the root, or in an element bound to it with `for` (those
116
+ * forward their keys). `global`: also when nothing on the page has focus (for full-page
117
+ * viewers such as HTML reports), for the first such root, except the keys pages scroll with
118
+ * (arrows, Home / End, Page Up / Down, Space); the boolean `global-shortcuts` attribute is
119
+ * an alias. `none`: no shortcuts (a focused change list keeps its arrow keys, Home / End
120
+ * and Enter).
121
+ */
122
+ shortcuts?: Tag<'kgdiff-viewer'>['shortcuts'];
123
+ /**
124
+ * **Experimental:** The shortcut names (`ShortcutName`) are new in 0.6. Single keys of the
125
+ * keyboard map bound to another shortcut, or unbound with `null`: `{ x: null, r: 'review'
126
+ * }`. The `keymap` attribute takes the same as text, `"x:none r:review"` (`Space` names the
127
+ * space bar). Keys are `KeyboardEvent.key` values; a letter stands for both its cases
128
+ * unless the other case is named too; keys not named keep the default map; entries naming
129
+ * no shortcut are ignored with a warning.
130
+ */
131
+ keymap?: Tag<'kgdiff-viewer'>['keymap'] | string;
132
+ /**
133
+ * Set a precomputed report (no diff / layout work in the browser).
134
+ */
135
+ payload?: Tag<'kgdiff-viewer'>['payload'];
136
+ /**
137
+ * Keep the selection, mode and scope in the page's URL hash
138
+ * (`#kgdiff=hunk:<id>;mode:<mode>;scope:<scope>`) and follow it: deep links.
139
+ */
140
+ 'sync-hash'?: boolean;
141
+ /**
142
+ * A preset: `closed` starts with the sidebar folded (`\` and the sidebar button open it),
143
+ * `open` with its four regions open. Reflects the sidebar's state once the user toggles it.
144
+ */
145
+ sidebar?: 'open' | 'closed';
146
+ /**
147
+ * A preset: `compact` leaves the brand and the compared names out of the canvas, for hosts
148
+ * that show their own (`panels="title:hidden"`).
149
+ */
150
+ header?: 'compact';
151
+ /**
152
+ * The same as `shortcuts="global"`.
153
+ */
154
+ 'global-shortcuts'?: boolean;
155
+ /**
156
+ * A diff is shown, from `load()` or a `payload`; `stats` counts its nodes, edges and
157
+ * changes.
158
+ */
159
+ 'onkgdiff-ready'?: (event: KgdiffEventMap['kgdiff-ready']) => void;
160
+ /**
161
+ * The selection changed: a change (`hunk`, its id, with the node chosen in it if any), a
162
+ * node alone (`hunk` null), or nothing (both null).
163
+ */
164
+ 'onkgdiff-select'?: (event: KgdiffEventMap['kgdiff-select']) => void;
165
+ /**
166
+ * The mode or the scope changed, by the user, a key or the host.
167
+ */
168
+ 'onkgdiff-mode'?: (event: KgdiffEventMap['kgdiff-mode']) => void;
169
+ /**
170
+ * A change was marked reviewed, or not; `progress` is the review state after it.
171
+ */
172
+ 'onkgdiff-review'?: (event: KgdiffEventMap['kgdiff-review']) => void;
173
+ /**
174
+ * Loading or showing a diff failed; `error` is a `KgdiffError` for bad input.
175
+ */
176
+ 'onkgdiff-error'?: (event: KgdiffEventMap['kgdiff-error']) => void;
177
+ /**
178
+ * Playback reached the end of the replay (not fired for seeking or stepping there). `loop`:
179
+ * it starts again after `loopDelay` ms; set `loop = false` or call `pause()` to stop it.
180
+ */
181
+ 'onkgdiff-replay-end'?: (event: KgdiffEventMap['kgdiff-replay-end']) => void;
182
+ /**
183
+ * The default layout changed: a panel opened, collapsed or was hidden, or a size changed
184
+ * (once a drag ends). `source`: the user did it in the viewer, or the host (attributes,
185
+ * properties, a report's `view.panels`).
186
+ */
187
+ 'onkgdiff-layout'?: (event: KgdiffEventMap['kgdiff-layout']) => void;
188
+ };
189
+ /**
190
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-root>`:
191
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-root
192
+ */
193
+ 'kgdiff-root': Props<'kgdiff-root'> & {
194
+ /**
195
+ * Reflected to the `mode` attribute. Default `overlay`.
196
+ */
197
+ mode?: Tag<'kgdiff-root'>['mode'];
198
+ /**
199
+ * Reflected to the `scope` attribute. Default `all` (`changes` for large graphs). Fixed to
200
+ * `changes` when the layout covers only the changes.
201
+ */
202
+ scope?: Tag<'kgdiff-root'>['scope'];
203
+ /**
204
+ * Reflected to the `theme` attribute. Default `auto`.
205
+ */
206
+ theme?: Tag<'kgdiff-root'>['theme'];
207
+ /**
208
+ * Reflected to the `palette` attribute. Default `default`.
209
+ */
210
+ palette?: Tag<'kgdiff-root'>['palette'];
211
+ /**
212
+ * Reflected to the `locale` attribute. Default from `navigator.language`.
213
+ */
214
+ locale?: Tag<'kgdiff-root'>['locale'];
215
+ /**
216
+ * Reflected to the boolean `loop` attribute. In `replay` mode the replay plays by itself
217
+ * and starts again `loopDelay` ms after it ends. `pause()` stops it until `play()`. Default
218
+ * false.
219
+ */
220
+ loop?: Tag<'kgdiff-root'>['loop'];
221
+ /**
222
+ * Reflected to `loop-delay`: ms between the end of a looping replay and its restart.
223
+ * Default 1200.
224
+ */
225
+ loopDelay?: Tag<'kgdiff-root'>['loopDelay'];
226
+ /**
227
+ * With `loop`, the replay pauses while the pointer is over the graph and continues when it
228
+ * leaves (a mouse or pen; not touch). Reflected as `pause-on-hover="false"` when off.
229
+ * Default true.
230
+ */
231
+ pauseOnHover?: Tag<'kgdiff-root'>['pauseOnHover'];
232
+ /**
233
+ * Reflected to the `shortcuts` attribute: where the keyboard shortcuts apply. `scoped` (the
234
+ * default): while focus is inside the root, or in an element bound to it with `for` (those
235
+ * forward their keys). `global`: also when nothing on the page has focus (for full-page
236
+ * viewers such as HTML reports), for the first such root, except the keys pages scroll with
237
+ * (arrows, Home / End, Page Up / Down, Space); the boolean `global-shortcuts` attribute is
238
+ * an alias. `none`: no shortcuts (a focused change list keeps its arrow keys, Home / End
239
+ * and Enter).
240
+ */
241
+ shortcuts?: Tag<'kgdiff-root'>['shortcuts'];
242
+ /**
243
+ * **Experimental:** The shortcut names (`ShortcutName`) are new in 0.6. Single keys of the
244
+ * keyboard map bound to another shortcut, or unbound with `null`: `{ x: null, r: 'review'
245
+ * }`. The `keymap` attribute takes the same as text, `"x:none r:review"` (`Space` names the
246
+ * space bar). Keys are `KeyboardEvent.key` values; a letter stands for both its cases
247
+ * unless the other case is named too; keys not named keep the default map; entries naming
248
+ * no shortcut are ignored with a warning.
249
+ */
250
+ keymap?: Tag<'kgdiff-root'>['keymap'] | string;
251
+ /**
252
+ * Set a precomputed report (no diff / layout work in the browser).
253
+ */
254
+ payload?: Tag<'kgdiff-root'>['payload'];
255
+ /**
256
+ * Keep the selection, mode and scope in the page's URL hash
257
+ * (`#kgdiff=hunk:<id>;mode:<mode>;scope:<scope>`) and follow it: deep links.
258
+ */
259
+ 'sync-hash'?: boolean;
260
+ /**
261
+ * The same as `shortcuts="global"`.
262
+ */
263
+ 'global-shortcuts'?: boolean;
264
+ /**
265
+ * A diff is shown, from `load()` or a `payload`; `stats` counts its nodes, edges and
266
+ * changes.
267
+ */
268
+ 'onkgdiff-ready'?: (event: KgdiffEventMap['kgdiff-ready']) => void;
269
+ /**
270
+ * The selection changed: a change (`hunk`, its id, with the node chosen in it if any), a
271
+ * node alone (`hunk` null), or nothing (both null).
272
+ */
273
+ 'onkgdiff-select'?: (event: KgdiffEventMap['kgdiff-select']) => void;
274
+ /**
275
+ * The mode or the scope changed, by the user, a key or the host.
276
+ */
277
+ 'onkgdiff-mode'?: (event: KgdiffEventMap['kgdiff-mode']) => void;
278
+ /**
279
+ * A change was marked reviewed, or not; `progress` is the review state after it.
280
+ */
281
+ 'onkgdiff-review'?: (event: KgdiffEventMap['kgdiff-review']) => void;
282
+ /**
283
+ * Loading or showing a diff failed; `error` is a `KgdiffError` for bad input.
284
+ */
285
+ 'onkgdiff-error'?: (event: KgdiffEventMap['kgdiff-error']) => void;
286
+ /**
287
+ * Playback reached the end of the replay (not fired for seeking or stepping there). `loop`:
288
+ * it starts again after `loopDelay` ms; set `loop = false` or call `pause()` to stop it.
289
+ */
290
+ 'onkgdiff-replay-end'?: (event: KgdiffEventMap['kgdiff-replay-end']) => void;
291
+ };
292
+ /**
293
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-stage>`:
294
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-stage
295
+ */
296
+ 'kgdiff-stage': Props<'kgdiff-stage'> & {
297
+ /**
298
+ * The states of the built-in chrome (`dock`, `transport`, `legend`, `zoom`, `minimap`),
299
+ * reflected to the `panels` attribute, in the syntax of `<kgdiff-viewer>`'s `panels`:
300
+ * `"minimap:hidden zoom:hidden"` or `{ minimap: 'hidden' }`; reading it gives the object.
301
+ * Other regions are ignored with a warning. Default: all open, the legend collapsed.
302
+ */
303
+ panels?: Tag<'kgdiff-stage'>['panels'] | string;
304
+ /**
305
+ * Reflected to the `version` attribute: the version this stage draws whatever the root's
306
+ * mode, `before` or `after` (two stages of one root side by side), or null to follow the
307
+ * mode. Another value is ignored with a warning. Each stage has its own camera; the
308
+ * selection, hover, filters and search are the root's, so both bring the same change into
309
+ * view.
310
+ */
311
+ version?: Tag<'kgdiff-stage'>['version'];
312
+ /**
313
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
314
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
315
+ * Changing it binds again.
316
+ */
317
+ htmlFor?: Tag<'kgdiff-stage'>['htmlFor'];
318
+ };
319
+ /**
320
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-change-list>`:
321
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-change-list
322
+ */
323
+ 'kgdiff-change-list': Props<'kgdiff-change-list'> & {
324
+ /**
325
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
326
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
327
+ * Changing it binds again.
328
+ */
329
+ htmlFor?: Tag<'kgdiff-change-list'>['htmlFor'];
330
+ };
331
+ /**
332
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-change-detail>`:
333
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-change-detail
334
+ */
335
+ 'kgdiff-change-detail': Props<'kgdiff-change-detail'> & {
336
+ /**
337
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
338
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
339
+ * Changing it binds again.
340
+ */
341
+ htmlFor?: Tag<'kgdiff-change-detail'>['htmlFor'];
342
+ };
343
+ /**
344
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-search>`:
345
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-search
346
+ */
347
+ 'kgdiff-search': Props<'kgdiff-search'> & {
348
+ /**
349
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
350
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
351
+ * Changing it binds again.
352
+ */
353
+ htmlFor?: Tag<'kgdiff-search'>['htmlFor'];
354
+ };
355
+ /**
356
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-filters>`:
357
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-filters
358
+ */
359
+ 'kgdiff-filters': Props<'kgdiff-filters'> & {
360
+ /**
361
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
362
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
363
+ * Changing it binds again.
364
+ */
365
+ htmlFor?: Tag<'kgdiff-filters'>['htmlFor'];
366
+ };
367
+ /**
368
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-view-dock>`:
369
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-view-dock
370
+ */
371
+ 'kgdiff-view-dock': Props<'kgdiff-view-dock'> & {
372
+ /**
373
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
374
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
375
+ * Changing it binds again.
376
+ */
377
+ htmlFor?: Tag<'kgdiff-view-dock'>['htmlFor'];
378
+ };
379
+ /**
380
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-transport>`:
381
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-transport
382
+ */
383
+ 'kgdiff-transport': Props<'kgdiff-transport'> & {
384
+ /**
385
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
386
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
387
+ * Changing it binds again.
388
+ */
389
+ htmlFor?: Tag<'kgdiff-transport'>['htmlFor'];
390
+ };
391
+ /**
392
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-legend>`:
393
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-legend
394
+ */
395
+ 'kgdiff-legend': Props<'kgdiff-legend'> & {
396
+ /**
397
+ * Reflected to `variant`: `full` (default) or `mini`; another value reads `full`.
398
+ */
399
+ variant?: Tag<'kgdiff-legend'>['variant'];
400
+ /**
401
+ * Reflected to the boolean `open`: whether the card is open (the user's toggle too).
402
+ */
403
+ open?: Tag<'kgdiff-legend'>['open'];
404
+ /**
405
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
406
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
407
+ * Changing it binds again.
408
+ */
409
+ htmlFor?: Tag<'kgdiff-legend'>['htmlFor'];
410
+ };
411
+ /**
412
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-zoom>`:
413
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-zoom
414
+ */
415
+ 'kgdiff-zoom': Props<'kgdiff-zoom'> & {
416
+ /**
417
+ * Reflects the `stage` attribute: the id of the stage to act on, or '' (no attribute;
418
+ * setting '' removes it) for the nearest one around the element. Changing it binds again.
419
+ */
420
+ stage?: Tag<'kgdiff-zoom'>['stage'];
421
+ };
422
+ /**
423
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-minimap>`:
424
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-minimap
425
+ */
426
+ 'kgdiff-minimap': Props<'kgdiff-minimap'> & {
427
+ /**
428
+ * Reflects the `stage` attribute: the id of the stage to act on, or '' (no attribute;
429
+ * setting '' removes it) for the nearest one around the element. Changing it binds again.
430
+ */
431
+ stage?: Tag<'kgdiff-minimap'>['stage'];
432
+ };
433
+ /**
434
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-title>`:
435
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-title
436
+ */
437
+ 'kgdiff-title': Props<'kgdiff-title'> & {
438
+ /**
439
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
440
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
441
+ * Changing it binds again.
442
+ */
443
+ htmlFor?: Tag<'kgdiff-title'>['htmlFor'];
444
+ };
445
+ /**
446
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-actions>`:
447
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-actions
448
+ */
449
+ 'kgdiff-actions': Props<'kgdiff-actions'> & {
450
+ /**
451
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
452
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
453
+ * Changing it binds again.
454
+ */
455
+ htmlFor?: Tag<'kgdiff-actions'>['htmlFor'];
456
+ };
457
+ }
458
+ }
459
+ }