@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
@@ -0,0 +1,460 @@
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
+ /** The element of a tag: a prop's type is its property's. */
19
+ type Tag<T extends keyof HTMLElementTagNameMap> = HTMLElementTagNameMap[T];
20
+ /** What every element takes: React's HTML attributes and a ref to the element. */
21
+ type Props<T extends keyof HTMLElementTagNameMap> = HTMLAttributes<Tag<T>> & {
22
+ ref?: Ref<Tag<T>>;
23
+ };
24
+ declare module 'react' {
25
+ namespace JSX {
26
+ interface IntrinsicElements {
27
+ /**
28
+ * `<kgdiff-viewer>`:
29
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-viewer
30
+ */
31
+ 'kgdiff-viewer': Props<'kgdiff-viewer'> & {
32
+ /**
33
+ * Reflected to the `chrome` attribute. `none` shows the graph alone: no title, actions,
34
+ * view dock (with the step caption and playback bar), change list, zoom buttons, minimap or
35
+ * legend card; the hover tooltip and a one-line legend stay. Clicks and keyboard shortcuts
36
+ * do nothing, the minimum height drops from 420px to 120px, and the view stays fitted: when
37
+ * the canvas is resized (unless the user panned or zoomed since) and at the start of every
38
+ * loop. Labels are never cut at the edge: one pushed from its spot by a neighbour moves
39
+ * inside or is left out. Default `full`.
40
+ */
41
+ chrome?: Tag<'kgdiff-viewer'>['chrome'];
42
+ /**
43
+ * Reflected to the `legend` attribute: `full` (the card), `mini` (one line: the families
44
+ * this diff has, then unchanged), `none`. Default `auto`: `full`, or `mini` with
45
+ * `chrome="none"`.
46
+ */
47
+ legend?: Tag<'kgdiff-viewer'>['legend'];
48
+ /**
49
+ * The page's declaration of panel states, reflected to the `panels` attribute: a string
50
+ * (`"detail:collapsed minimap:hidden"`) or an object (`{ detail: 'collapsed' }`); reading
51
+ * it gives the object. Regions not named keep their state; entries that name no region or
52
+ * state are ignored with a warning. It wins over what the user chose before (remembered)
53
+ * and a report's `view.panels`; the user can still open and close collapsed regions, and
54
+ * declaring the same again keeps what they did. The presets `sidebar="closed"` (list,
55
+ * detail, search and filters collapsed), `header="compact"` (title hidden) and
56
+ * `chrome="none"` (everything but the canvas and the legend hidden) are panel states too;
57
+ * `panels` wins over them for the regions it names. The states every region has now are in
58
+ * `layout`.
59
+ */
60
+ panels?: Tag<'kgdiff-viewer'>['panels'] | string;
61
+ /**
62
+ * Reflected to the `persist` attribute. `local` (the default): the layout remembers the
63
+ * user's panel states, sizes, theme, palette and language in `localStorage` (under
64
+ * `persistKey`, shared by the viewers of the origin with the same key). `none`: it
65
+ * remembers nothing.
66
+ */
67
+ persist?: Tag<'kgdiff-viewer'>['persist'];
68
+ /**
69
+ * Reflected to the `persist-key` attribute: the `localStorage` key the layout remembers
70
+ * under. Viewers with the same key share what they remember; give each app on a shared
71
+ * origin (a GitHub Pages user site, say) a key of its own. Default `kgdiff:viewer`.
72
+ */
73
+ persistKey?: Tag<'kgdiff-viewer'>['persistKey'];
74
+ /**
75
+ * Reflected to the `mode` attribute. Default `overlay`.
76
+ */
77
+ mode?: Tag<'kgdiff-viewer'>['mode'];
78
+ /**
79
+ * Reflected to the `scope` attribute. Default `all` (`changes` for large graphs). Fixed to
80
+ * `changes` when the layout covers only the changes.
81
+ */
82
+ scope?: Tag<'kgdiff-viewer'>['scope'];
83
+ /**
84
+ * Reflected to the `theme` attribute. Default `auto`.
85
+ */
86
+ theme?: Tag<'kgdiff-viewer'>['theme'];
87
+ /**
88
+ * Reflected to the `palette` attribute. Default `default`.
89
+ */
90
+ palette?: Tag<'kgdiff-viewer'>['palette'];
91
+ /**
92
+ * Reflected to the `locale` attribute. Default from `navigator.language`.
93
+ */
94
+ locale?: Tag<'kgdiff-viewer'>['locale'];
95
+ /**
96
+ * Reflected to the boolean `loop` attribute. In `replay` mode the replay plays by itself
97
+ * and starts again `loopDelay` ms after it ends. `pause()` stops it until `play()`. Default
98
+ * false.
99
+ */
100
+ loop?: Tag<'kgdiff-viewer'>['loop'];
101
+ /**
102
+ * Reflected to `loop-delay`: ms between the end of a looping replay and its restart.
103
+ * Default 1200.
104
+ */
105
+ loopDelay?: Tag<'kgdiff-viewer'>['loopDelay'];
106
+ /**
107
+ * With `loop`, the replay pauses while the pointer is over the graph and continues when it
108
+ * leaves (a mouse or pen; not touch). Reflected as `pause-on-hover="false"` when off.
109
+ * Default true.
110
+ */
111
+ pauseOnHover?: Tag<'kgdiff-viewer'>['pauseOnHover'];
112
+ /**
113
+ * Reflected to the `shortcuts` attribute: where the keyboard shortcuts apply. `scoped` (the
114
+ * default): while focus is inside the root, or in an element bound to it with `for` (those
115
+ * forward their keys). `global`: also when nothing on the page has focus (for full-page
116
+ * viewers such as HTML reports), for the first such root, except the keys pages scroll with
117
+ * (arrows, Home / End, Page Up / Down, Space); the boolean `global-shortcuts` attribute is
118
+ * an alias. `none`: no shortcuts (a focused change list keeps its arrow keys, Home / End
119
+ * and Enter).
120
+ */
121
+ shortcuts?: Tag<'kgdiff-viewer'>['shortcuts'];
122
+ /**
123
+ * **Experimental:** The shortcut names (`ShortcutName`) are new in 0.6. Single keys of the
124
+ * keyboard map bound to another shortcut, or unbound with `null`: `{ x: null, r: 'review'
125
+ * }`. The `keymap` attribute takes the same as text, `"x:none r:review"` (`Space` names the
126
+ * space bar). Keys are `KeyboardEvent.key` values; a letter stands for both its cases
127
+ * unless the other case is named too; keys not named keep the default map; entries naming
128
+ * no shortcut are ignored with a warning.
129
+ */
130
+ keymap?: Tag<'kgdiff-viewer'>['keymap'] | string;
131
+ /**
132
+ * Set a precomputed report (no diff / layout work in the browser).
133
+ */
134
+ payload?: Tag<'kgdiff-viewer'>['payload'];
135
+ /**
136
+ * Keep the selection, mode and scope in the page's URL hash
137
+ * (`#kgdiff=hunk:<id>;mode:<mode>;scope:<scope>`) and follow it: deep links.
138
+ */
139
+ 'sync-hash'?: boolean;
140
+ /**
141
+ * A preset: `closed` starts with the sidebar folded (`\` and the sidebar button open it),
142
+ * `open` with its four regions open. Reflects the sidebar's state once the user toggles it.
143
+ */
144
+ sidebar?: 'open' | 'closed';
145
+ /**
146
+ * A preset: `compact` leaves the brand and the compared names out of the canvas, for hosts
147
+ * that show their own (`panels="title:hidden"`).
148
+ */
149
+ header?: 'compact';
150
+ /**
151
+ * The same as `shortcuts="global"`.
152
+ */
153
+ 'global-shortcuts'?: boolean;
154
+ /**
155
+ * A diff is shown, from `load()` or a `payload`; `stats` counts its nodes, edges and
156
+ * changes.
157
+ */
158
+ 'onkgdiff-ready'?: (event: KgdiffEventMap['kgdiff-ready']) => void;
159
+ /**
160
+ * The selection changed: a change (`hunk`, its id, with the node chosen in it if any), a
161
+ * node alone (`hunk` null), or nothing (both null).
162
+ */
163
+ 'onkgdiff-select'?: (event: KgdiffEventMap['kgdiff-select']) => void;
164
+ /**
165
+ * The mode or the scope changed, by the user, a key or the host.
166
+ */
167
+ 'onkgdiff-mode'?: (event: KgdiffEventMap['kgdiff-mode']) => void;
168
+ /**
169
+ * A change was marked reviewed, or not; `progress` is the review state after it.
170
+ */
171
+ 'onkgdiff-review'?: (event: KgdiffEventMap['kgdiff-review']) => void;
172
+ /**
173
+ * Loading or showing a diff failed; `error` is a `KgdiffError` for bad input.
174
+ */
175
+ 'onkgdiff-error'?: (event: KgdiffEventMap['kgdiff-error']) => void;
176
+ /**
177
+ * Playback reached the end of the replay (not fired for seeking or stepping there). `loop`:
178
+ * it starts again after `loopDelay` ms; set `loop = false` or call `pause()` to stop it.
179
+ */
180
+ 'onkgdiff-replay-end'?: (event: KgdiffEventMap['kgdiff-replay-end']) => void;
181
+ /**
182
+ * The default layout changed: a panel opened, collapsed or was hidden, or a size changed
183
+ * (once a drag ends). `source`: the user did it in the viewer, or the host (attributes,
184
+ * properties, a report's `view.panels`).
185
+ */
186
+ 'onkgdiff-layout'?: (event: KgdiffEventMap['kgdiff-layout']) => void;
187
+ };
188
+ /**
189
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-root>`:
190
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-root
191
+ */
192
+ 'kgdiff-root': Props<'kgdiff-root'> & {
193
+ /**
194
+ * Reflected to the `mode` attribute. Default `overlay`.
195
+ */
196
+ mode?: Tag<'kgdiff-root'>['mode'];
197
+ /**
198
+ * Reflected to the `scope` attribute. Default `all` (`changes` for large graphs). Fixed to
199
+ * `changes` when the layout covers only the changes.
200
+ */
201
+ scope?: Tag<'kgdiff-root'>['scope'];
202
+ /**
203
+ * Reflected to the `theme` attribute. Default `auto`.
204
+ */
205
+ theme?: Tag<'kgdiff-root'>['theme'];
206
+ /**
207
+ * Reflected to the `palette` attribute. Default `default`.
208
+ */
209
+ palette?: Tag<'kgdiff-root'>['palette'];
210
+ /**
211
+ * Reflected to the `locale` attribute. Default from `navigator.language`.
212
+ */
213
+ locale?: Tag<'kgdiff-root'>['locale'];
214
+ /**
215
+ * Reflected to the boolean `loop` attribute. In `replay` mode the replay plays by itself
216
+ * and starts again `loopDelay` ms after it ends. `pause()` stops it until `play()`. Default
217
+ * false.
218
+ */
219
+ loop?: Tag<'kgdiff-root'>['loop'];
220
+ /**
221
+ * Reflected to `loop-delay`: ms between the end of a looping replay and its restart.
222
+ * Default 1200.
223
+ */
224
+ loopDelay?: Tag<'kgdiff-root'>['loopDelay'];
225
+ /**
226
+ * With `loop`, the replay pauses while the pointer is over the graph and continues when it
227
+ * leaves (a mouse or pen; not touch). Reflected as `pause-on-hover="false"` when off.
228
+ * Default true.
229
+ */
230
+ pauseOnHover?: Tag<'kgdiff-root'>['pauseOnHover'];
231
+ /**
232
+ * Reflected to the `shortcuts` attribute: where the keyboard shortcuts apply. `scoped` (the
233
+ * default): while focus is inside the root, or in an element bound to it with `for` (those
234
+ * forward their keys). `global`: also when nothing on the page has focus (for full-page
235
+ * viewers such as HTML reports), for the first such root, except the keys pages scroll with
236
+ * (arrows, Home / End, Page Up / Down, Space); the boolean `global-shortcuts` attribute is
237
+ * an alias. `none`: no shortcuts (a focused change list keeps its arrow keys, Home / End
238
+ * and Enter).
239
+ */
240
+ shortcuts?: Tag<'kgdiff-root'>['shortcuts'];
241
+ /**
242
+ * **Experimental:** The shortcut names (`ShortcutName`) are new in 0.6. Single keys of the
243
+ * keyboard map bound to another shortcut, or unbound with `null`: `{ x: null, r: 'review'
244
+ * }`. The `keymap` attribute takes the same as text, `"x:none r:review"` (`Space` names the
245
+ * space bar). Keys are `KeyboardEvent.key` values; a letter stands for both its cases
246
+ * unless the other case is named too; keys not named keep the default map; entries naming
247
+ * no shortcut are ignored with a warning.
248
+ */
249
+ keymap?: Tag<'kgdiff-root'>['keymap'] | string;
250
+ /**
251
+ * Set a precomputed report (no diff / layout work in the browser).
252
+ */
253
+ payload?: Tag<'kgdiff-root'>['payload'];
254
+ /**
255
+ * Keep the selection, mode and scope in the page's URL hash
256
+ * (`#kgdiff=hunk:<id>;mode:<mode>;scope:<scope>`) and follow it: deep links.
257
+ */
258
+ 'sync-hash'?: boolean;
259
+ /**
260
+ * The same as `shortcuts="global"`.
261
+ */
262
+ 'global-shortcuts'?: boolean;
263
+ /**
264
+ * A diff is shown, from `load()` or a `payload`; `stats` counts its nodes, edges and
265
+ * changes.
266
+ */
267
+ 'onkgdiff-ready'?: (event: KgdiffEventMap['kgdiff-ready']) => void;
268
+ /**
269
+ * The selection changed: a change (`hunk`, its id, with the node chosen in it if any), a
270
+ * node alone (`hunk` null), or nothing (both null).
271
+ */
272
+ 'onkgdiff-select'?: (event: KgdiffEventMap['kgdiff-select']) => void;
273
+ /**
274
+ * The mode or the scope changed, by the user, a key or the host.
275
+ */
276
+ 'onkgdiff-mode'?: (event: KgdiffEventMap['kgdiff-mode']) => void;
277
+ /**
278
+ * A change was marked reviewed, or not; `progress` is the review state after it.
279
+ */
280
+ 'onkgdiff-review'?: (event: KgdiffEventMap['kgdiff-review']) => void;
281
+ /**
282
+ * Loading or showing a diff failed; `error` is a `KgdiffError` for bad input.
283
+ */
284
+ 'onkgdiff-error'?: (event: KgdiffEventMap['kgdiff-error']) => void;
285
+ /**
286
+ * Playback reached the end of the replay (not fired for seeking or stepping there). `loop`:
287
+ * it starts again after `loopDelay` ms; set `loop = false` or call `pause()` to stop it.
288
+ */
289
+ 'onkgdiff-replay-end'?: (event: KgdiffEventMap['kgdiff-replay-end']) => void;
290
+ };
291
+ /**
292
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-stage>`:
293
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-stage
294
+ */
295
+ 'kgdiff-stage': Props<'kgdiff-stage'> & {
296
+ /**
297
+ * The states of the built-in chrome (`dock`, `transport`, `legend`, `zoom`, `minimap`),
298
+ * reflected to the `panels` attribute, in the syntax of `<kgdiff-viewer>`'s `panels`:
299
+ * `"minimap:hidden zoom:hidden"` or `{ minimap: 'hidden' }`; reading it gives the object.
300
+ * Other regions are ignored with a warning. Default: all open, the legend collapsed.
301
+ */
302
+ panels?: Tag<'kgdiff-stage'>['panels'] | string;
303
+ /**
304
+ * Reflected to the `version` attribute: the version this stage draws whatever the root's
305
+ * mode, `before` or `after` (two stages of one root side by side), or null to follow the
306
+ * mode. Another value is ignored with a warning. Each stage has its own camera; the
307
+ * selection, hover, filters and search are the root's, so both bring the same change into
308
+ * view.
309
+ */
310
+ version?: Tag<'kgdiff-stage'>['version'];
311
+ /**
312
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
313
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
314
+ * Changing it binds again.
315
+ */
316
+ htmlFor?: Tag<'kgdiff-stage'>['htmlFor'];
317
+ };
318
+ /**
319
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-change-list>`:
320
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-change-list
321
+ */
322
+ 'kgdiff-change-list': Props<'kgdiff-change-list'> & {
323
+ /**
324
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
325
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
326
+ * Changing it binds again.
327
+ */
328
+ htmlFor?: Tag<'kgdiff-change-list'>['htmlFor'];
329
+ };
330
+ /**
331
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-change-detail>`:
332
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-change-detail
333
+ */
334
+ 'kgdiff-change-detail': Props<'kgdiff-change-detail'> & {
335
+ /**
336
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
337
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
338
+ * Changing it binds again.
339
+ */
340
+ htmlFor?: Tag<'kgdiff-change-detail'>['htmlFor'];
341
+ };
342
+ /**
343
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-search>`:
344
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-search
345
+ */
346
+ 'kgdiff-search': Props<'kgdiff-search'> & {
347
+ /**
348
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
349
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
350
+ * Changing it binds again.
351
+ */
352
+ htmlFor?: Tag<'kgdiff-search'>['htmlFor'];
353
+ };
354
+ /**
355
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-filters>`:
356
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-filters
357
+ */
358
+ 'kgdiff-filters': Props<'kgdiff-filters'> & {
359
+ /**
360
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
361
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
362
+ * Changing it binds again.
363
+ */
364
+ htmlFor?: Tag<'kgdiff-filters'>['htmlFor'];
365
+ };
366
+ /**
367
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-view-dock>`:
368
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-view-dock
369
+ */
370
+ 'kgdiff-view-dock': Props<'kgdiff-view-dock'> & {
371
+ /**
372
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
373
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
374
+ * Changing it binds again.
375
+ */
376
+ htmlFor?: Tag<'kgdiff-view-dock'>['htmlFor'];
377
+ };
378
+ /**
379
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-transport>`:
380
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-transport
381
+ */
382
+ 'kgdiff-transport': Props<'kgdiff-transport'> & {
383
+ /**
384
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
385
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
386
+ * Changing it binds again.
387
+ */
388
+ htmlFor?: Tag<'kgdiff-transport'>['htmlFor'];
389
+ };
390
+ /**
391
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-legend>`:
392
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-legend
393
+ */
394
+ 'kgdiff-legend': Props<'kgdiff-legend'> & {
395
+ /**
396
+ * Reflected to `variant`: `full` (default) or `mini`; another value reads `full`.
397
+ */
398
+ variant?: Tag<'kgdiff-legend'>['variant'];
399
+ /**
400
+ * Reflected to the boolean `open`: whether the card is open (the user's toggle too).
401
+ */
402
+ open?: Tag<'kgdiff-legend'>['open'];
403
+ /**
404
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
405
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
406
+ * Changing it binds again.
407
+ */
408
+ htmlFor?: Tag<'kgdiff-legend'>['htmlFor'];
409
+ };
410
+ /**
411
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-zoom>`:
412
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-zoom
413
+ */
414
+ 'kgdiff-zoom': Props<'kgdiff-zoom'> & {
415
+ /**
416
+ * Reflects the `stage` attribute: the id of the stage to act on, or '' (no attribute;
417
+ * setting '' removes it) for the nearest one around the element. Changing it binds again.
418
+ */
419
+ stage?: Tag<'kgdiff-zoom'>['stage'];
420
+ };
421
+ /**
422
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-minimap>`:
423
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-minimap
424
+ */
425
+ 'kgdiff-minimap': Props<'kgdiff-minimap'> & {
426
+ /**
427
+ * Reflects the `stage` attribute: the id of the stage to act on, or '' (no attribute;
428
+ * setting '' removes it) for the nearest one around the element. Changing it binds again.
429
+ */
430
+ stage?: Tag<'kgdiff-minimap'>['stage'];
431
+ };
432
+ /**
433
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-title>`:
434
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-title
435
+ */
436
+ 'kgdiff-title': Props<'kgdiff-title'> & {
437
+ /**
438
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
439
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
440
+ * Changing it binds again.
441
+ */
442
+ htmlFor?: Tag<'kgdiff-title'>['htmlFor'];
443
+ };
444
+ /**
445
+ * **Experimental:** In 0.6; stable from 0.7 (RFC 0001, decision 7). `<kgdiff-actions>`:
446
+ * https://github.com/iiwish/kgdiff/blob/main/docs/viewer-elements.md#kgdiff-actions
447
+ */
448
+ 'kgdiff-actions': Props<'kgdiff-actions'> & {
449
+ /**
450
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
451
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
452
+ * Changing it binds again.
453
+ */
454
+ htmlFor?: Tag<'kgdiff-actions'>['htmlFor'];
455
+ };
456
+ }
457
+ }
458
+ }
459
+ export {};
460
+ //# sourceMappingURL=react.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,6DAA6D;AAC7D,KAAK,GAAG,CAAC,CAAC,SAAS,MAAM,qBAAqB,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC;AAE3E,kFAAkF;AAClF,KAAK,KAAK,CAAC,CAAC,SAAS,MAAM,qBAAqB,IAAI,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC;AAEnG,OAAO,QAAQ,OAAO,CAAC;IACrB,UAAU,GAAG,CAAC;QACZ,UAAU,iBAAiB;YACzB;;;eAGG;YACH,eAAe,EAAE,KAAK,CAAC,eAAe,CAAC,GAAG;gBACxC;;;;;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AK,CAAC,gBAAgB,CAAC,GAAG;gBAC1C;;;mBAGG;gBACH,KAAK,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC;aACxC,CAAC;YACF;;;eAGG;YACH,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,GAAG;gBACtC;;;;mBAIG;gBACH,OAAO,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC;aAC1C,CAAC;YACF;;;eAGG;YACH,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG;gBAC1C;;;;mBAIG;gBACH,OAAO,CAAC,EAAE,GAAG,CAAC,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC;aAC5C,CAAC;SACH;KACF;CACF"}
package/dist/react.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=react.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"react.js","sourceRoot":"","sources":["../src/react.ts"],"names":[],"mappings":""}
@@ -0,0 +1,122 @@
1
+ /**
2
+ * What `<kgdiff-viewer>` (the default layout) and `<kgdiff-root>` share (RFC 0001 §2–§5): an
3
+ * element that is a root. It owns the session (`ViewerRoot`) and provides it to the regions and
4
+ * elements bound to it, and carries everything about the session the host sets or reads: the
5
+ * preferences as attributes and properties, the payload, the public methods, the events, the
6
+ * keyboard map and its scope, deep links and the hover hold of a looping replay.
7
+ */
8
+ import { type Delta, type Locale } from '@kgdiff/core';
9
+ import type { PaletteName } from '@kgdiff/scene';
10
+ import type { FitOptions, LoadOptions, ReportPayload, ReviewState, ThemePreference, ViewerMode, ViewerScope } from './index.js';
11
+ import { type Keymap } from './keyboard.js';
12
+ import { LEGACY_CHANGES_MODE } from './prefs.js';
13
+ import { ViewerRoot } from './root.js';
14
+ import { type DiffSession, type SessionDeps, type SessionHost, type Topic } from './session.js';
15
+ import type { UiActions } from './ui/context.js';
16
+ /** Attributes every root observes. */
17
+ export declare const ROOT_ATTRIBUTES: readonly ['mode', 'scope', 'theme', 'palette', 'locale', 'sync-hash', 'loop', 'loop-delay', 'pause-on-hover', 'shortcuts', 'keymap'];
18
+ /** Where keyboard shortcuts apply (`shortcuts`). */
19
+ export type ShortcutScope = 'scoped' | 'global' | 'none';
20
+ /**
21
+ * @attr {boolean} sync-hash - Keep the selection, mode and scope in the page's URL hash
22
+ * (`#kgdiff=hunk:<id>;mode:<mode>;scope:<scope>`) and follow it: deep links.
23
+ * @attr {boolean} global-shortcuts - The same as `shortcuts="global"`.
24
+ */
25
+ export declare abstract class RootElement<S extends DiffSession = DiffSession> extends HTMLElement {
26
+ #private;
27
+ /** @internal */
28
+ readonly controller: S;
29
+ /** @internal The root: session, keyboard map, live region, events, tokens. */
30
+ protected readonly root: ViewerRoot<S>;
31
+ protected readonly shadow: ShadowRoot;
32
+ constructor();
33
+ /** What the layout does for the regions (`UiActions`); its closures run later. */
34
+ protected abstract actions(): UiActions;
35
+ /** Connected: build and attach what the element shows (before the first render). */
36
+ protected abstract connected(): void;
37
+ /** Disconnected (after the root stopped providing). */
38
+ protected abstract disconnected(): void;
39
+ /** An observed attribute that is not a root attribute changed (from `_old`). */
40
+ protected attributeChanged(_name: string, _value: string | null, _old: string | null): void;
41
+ /** The session this root holds (the default layout's has its canvas built in). */
42
+ protected abstract createSession(host: SessionHost, deps: SessionDeps): S;
43
+ /** The sheets the shadow root adopts before the token set. */
44
+ protected abstract sheets(doc: Document): readonly CSSStyleSheet[];
45
+ /** Properties of the subclass a page may set before the element is defined. */
46
+ protected upgradedProperties(): readonly string[];
47
+ /** Whether keys do anything at all (`chrome="none"` turns them off in the default layout). */
48
+ protected keysEnabled(): boolean;
49
+ /** A key reached the root: return true when the layout took it (an open popover). */
50
+ protected interceptKey(_e: KeyboardEvent): boolean;
51
+ connectedCallback(): void;
52
+ disconnectedCallback(): void;
53
+ attributeChangedCallback(name: string, old: string | null, value: string | null): void;
54
+ /**
55
+ * Apply a preference from an attribute or a property. Valid values are explicit (a report's
56
+ * `view` does not override them); invalid ones fall back to the default (`overlay`, `all`,
57
+ * `auto`, `default`, the browser's language). Properties reflect the normalized value; the
58
+ * legacy mode `changes` reflects as `overlay` + scope `changes`.
59
+ */
60
+ protected applyPreference(name: 'mode' | 'scope' | 'theme' | 'palette' | 'locale', raw: unknown, reflect: boolean): void;
61
+ get mode(): ViewerMode;
62
+ set mode(value: ViewerMode | typeof LEGACY_CHANGES_MODE);
63
+ get scope(): ViewerScope;
64
+ set scope(value: ViewerScope);
65
+ get theme(): ThemePreference;
66
+ set theme(value: ThemePreference);
67
+ get palette(): PaletteName;
68
+ set palette(value: PaletteName);
69
+ get locale(): Locale;
70
+ set locale(value: Locale);
71
+ get loop(): boolean;
72
+ set loop(value: boolean);
73
+ get loopDelay(): number;
74
+ set loopDelay(value: number);
75
+ get pauseOnHover(): boolean;
76
+ set pauseOnHover(value: boolean);
77
+ /**
78
+ * Where the keyboard shortcuts apply. `scoped` (the default): while focus is inside the root
79
+ * (keys of elements bound with `for` are forwarded to it). `global`: also when nothing on the
80
+ * page has focus, for the first such root, except the keys pages scroll with; the boolean
81
+ * `global-shortcuts` attribute is an alias. `none`: no shortcuts (a focused change list keeps
82
+ * its arrow keys).
83
+ */
84
+ get shortcuts(): ShortcutScope;
85
+ set shortcuts(value: ShortcutScope);
86
+ /**
87
+ * Keys bound to other shortcuts, or unbound with null: `{ x: null, r: 'review' }`, or as the
88
+ * `keymap` attribute `"x:none r:review"`. Keys not named keep the default map.
89
+ */
90
+ get keymap(): Keymap | null;
91
+ set keymap(value: Keymap | string | null);
92
+ get payload(): ReportPayload | null;
93
+ set payload(value: ReportPayload | null);
94
+ /** A valid payload was set, before it loads. */
95
+ protected payloadSet(_payload: ReportPayload): void;
96
+ load(options: LoadOptions): Promise<void>;
97
+ selectHunk(id: string | null): void;
98
+ next(): void;
99
+ prev(): void;
100
+ play(): void;
101
+ pause(): void;
102
+ fit(options?: FitOptions): Promise<void>;
103
+ exportDelta(): Delta;
104
+ reviewState(): ReviewState;
105
+ setReviewed(hunkId: string, reviewed: boolean): void;
106
+ /** Show an error state (used for undecodable embedded payloads). */
107
+ showError(error: Error): void;
108
+ /**
109
+ * Draw the canvas with the `--kgdiff-*` tokens as computed now. Call it after changing tokens
110
+ * in a way the root cannot observe (a class on an ancestor, a stylesheet); theme, palette and
111
+ * system color scheme changes are followed by themselves.
112
+ */
113
+ refreshTheme(): void;
114
+ protected reflect(name: string, value: string | null): void;
115
+ /** The actions every root has: preferences reflect as attributes. */
116
+ protected baseActions(): Pick<UiActions, 'tr' | 'setMode' | 'toggleScope' | 'setThemePreference' | 'setPalette' | 'setLocale'>;
117
+ /** The pointer entered or left the graph (holds a looping replay with `pause-on-hover`). */
118
+ protected pointerOver(over: boolean): void;
119
+ /** Reflect what the session changed (mode, scope, theme) back to the attributes. */
120
+ protected reflectSession(topics: ReadonlySet<Topic>): void;
121
+ }
122
+ //# sourceMappingURL=root-element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-element.d.ts","sourceRoot":"","sources":["../src/root-element.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,KAAK,EAAe,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,eAAe,EACf,UAAU,EACV,WAAW,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,KAAK,MAAM,EAAY,MAAM,eAAe,CAAC;AAEtD,OAAO,EAEL,mBAAmB,EAQpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAU,UAAU,EAAgB,MAAM,WAAW,CAAC;AAC7D,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,KAAK,EACX,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,SAA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