@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/dist/index.d.ts CHANGED
@@ -1,18 +1,39 @@
1
1
  /**
2
- * @kgdiff/viewer: the drop-in `<kgdiff-viewer>` web component.
2
+ * @kgdiff/viewer: the drop-in `<kgdiff-viewer>` web component, and the elements it is made of.
3
3
  *
4
- * Importing this module defines `<kgdiff-viewer>` (if not yet defined).
5
- * Behaviour: docs/interaction.md. Visuals: docs/visual-language.md.
4
+ * Importing this module defines `<kgdiff-viewer>` and the experimental elements
5
+ * `<kgdiff-root>`, `<kgdiff-stage>`, `<kgdiff-change-list>`, `<kgdiff-change-detail>`,
6
+ * `<kgdiff-search>` and `<kgdiff-filters>` (each not yet defined; each also has a subpath,
7
+ * `@kgdiff/viewer/elements/<name>`, that defines only it). Behaviour: docs/interaction.md.
8
+ * Visuals: docs/visual-language.md. Design: docs/rfcs/0001-viewer-components.md.
6
9
  *
7
- * Modules: `element.ts` (the custom element), `controller.ts` (state, load pipeline, replay
8
- * clock, camera follow), `ui/*` (header, sidebar, detail panel, canvas chrome, popovers),
9
- * `i18n.ts`, `styles.ts`, `review-store.ts`, `hash-sync.ts`, `payload.ts`, `text-diff.ts`,
10
- * `keyboard.ts`.
10
+ * Modules: `session.ts` (the headless diff session), `controller.ts` (its canvas view),
11
+ * `root.ts` / `root-element.ts` (the root: keyboard map, live region, events, tokens,
12
+ * preferences), `element.ts` (the default layout, with `panels.ts` and `layout-store.ts`),
13
+ * `elements/*` (the public elements), `ui/*` (the regions: stage, change list, search, filters,
14
+ * detail panel, header, sidebar, popovers), `context.ts` / `bind.ts` (how they find their root),
15
+ * `i18n.ts`, `styles.ts`, `theme.ts`, `review-store.ts`, `hash-sync.ts`, `payload.ts`,
16
+ * `text-diff.ts`, `keyboard.ts`.
11
17
  */
12
18
  import type { Delta, DiffJSON, DiffOptions, DiffStats, GraphInput, KGraph, Locale, PackedDiffJSON } from '@kgdiff/core';
13
19
  import type { ParseOptions } from '@kgdiff/formats';
14
20
  import type { LayoutJSON, LayoutOptions } from '@kgdiff/layout';
15
21
  import type { PaletteName } from '@kgdiff/scene';
22
+ import type { Keymap } from './keyboard.js';
23
+ import type { ShortcutScope } from './root-element.js';
24
+ import './elements/root.js';
25
+ import './elements/stage.js';
26
+ import './elements/change-list.js';
27
+ import './elements/change-detail.js';
28
+ import './elements/search.js';
29
+ import './elements/filters.js';
30
+ import './elements/view-dock.js';
31
+ import './elements/transport.js';
32
+ import './elements/legend.js';
33
+ import './elements/zoom.js';
34
+ import './elements/minimap.js';
35
+ import './elements/title.js';
36
+ import './elements/actions.js';
16
37
  /** How the two versions are told apart: by color (overlay), side by side (swipe) or over time (replay). */
17
38
  export type ViewerMode = 'overlay' | 'swipe' | 'replay';
18
39
  /** What is drawn, in any mode: the whole graph, or only the changes with a few hops of context. */
@@ -22,6 +43,62 @@ export type ThemePreference = 'auto' | 'light' | 'dark';
22
43
  export type ViewerChrome = 'full' | 'none';
23
44
  /** The legend card, one line of dots, no legend, or `auto` (the card, one line without chrome). */
24
45
  export type ViewerLegend = 'auto' | 'full' | 'mini' | 'none';
46
+ export type { Keymap, ShortcutName } from './keyboard.js';
47
+ export type { ShortcutScope } from './root-element.js';
48
+ /**
49
+ * A region of the default layout (`KgdiffViewerElement.panels`): the change list, the detail
50
+ * panel, the search, the family filters (the sidebar's four), the view dock, the replay
51
+ * transport, the legend, the zoom buttons, the minimap, the title and the actions.
52
+ */
53
+ export type PanelRegion = 'list' | 'detail' | 'search' | 'filters' | 'dock' | 'transport' | 'legend' | 'zoom' | 'minimap' | 'title' | 'actions';
54
+ /**
55
+ * `open`; `collapsed`: folded to the control that opens it again (the list to its title, the
56
+ * detail panel to its bar, the search to a button, the filters to a button, the legend to its
57
+ * head; the sidebar folds away when all four of its regions are collapsed) and inert; `hidden`:
58
+ * not shown, and no control brings it back. Regions without a fold of their own (dock,
59
+ * transport, zoom, minimap, title, actions) are not shown while collapsed.
60
+ */
61
+ export type PanelState = 'open' | 'collapsed' | 'hidden';
62
+ /** The state of every region. */
63
+ export type PanelStates = {
64
+ readonly [R in PanelRegion]: PanelState;
65
+ };
66
+ /** The states of some regions; the others keep theirs. */
67
+ export type ViewerPanels = {
68
+ readonly [R in PanelRegion]?: PanelState;
69
+ };
70
+ /**
71
+ * The version a `<kgdiff-stage>` draws whatever the mode (`version`): `before` or `after`, for
72
+ * side-by-side canvases of one session.
73
+ *
74
+ * @experimental Like the elements, in 0.6.
75
+ */
76
+ export type StageVersion = 'before' | 'after';
77
+ /**
78
+ * The regions of `<kgdiff-stage>`'s built-in chrome (its `panels`).
79
+ *
80
+ * @experimental Like the elements, in 0.6.
81
+ */
82
+ export type StageRegion = 'dock' | 'transport' | 'legend' | 'zoom' | 'minimap';
83
+ /**
84
+ * The states of some of the stage's chrome regions; the others keep theirs.
85
+ *
86
+ * @experimental Like the elements, in 0.6.
87
+ */
88
+ export type StagePanels = {
89
+ readonly [R in StageRegion]?: PanelState;
90
+ };
91
+ /** The default layout's panel states and sizes (`kgdiff-layout`). */
92
+ export interface ViewerLayout {
93
+ readonly panels: PanelStates;
94
+ /** The sidebar's width, px (360 by default). */
95
+ readonly sidebarWidth: number;
96
+ /**
97
+ * The detail panel's share of the sidebar's height (0–1), once the user dragged the split
98
+ * between it and the change list; null while it takes its content's height (up to 58%).
99
+ */
100
+ readonly detailShare: number | null;
101
+ }
25
102
  /** A precomputed diff + layout: what the CLI embeds in HTML reports. Deterministic. */
26
103
  export interface ReportPayload {
27
104
  readonly format: 'kgdiff.report';
@@ -52,6 +129,11 @@ export interface ReportPayload {
52
129
  readonly theme?: ThemePreference;
53
130
  readonly palette?: PaletteName;
54
131
  readonly locale?: Locale;
132
+ /**
133
+ * Initial panel states of the default layout (`panels`). A choice the user made in the
134
+ * viewer before, or a `panels` attribute the page sets, wins over these.
135
+ */
136
+ readonly panels?: ViewerPanels;
55
137
  };
56
138
  }
57
139
  /** A graph to load: already structured, or text to parse with @kgdiff/formats. */
@@ -76,23 +158,36 @@ export interface ReviewState {
76
158
  readonly reviewed: readonly string[];
77
159
  readonly total: number;
78
160
  }
79
- export interface KgdiffViewerEventMap {
161
+ /**
162
+ * The events of `<kgdiff-viewer>` and `<kgdiff-root>` (`CustomEvent`s that bubble and are
163
+ * composed). Merged into the global event maps, so `addEventListener('kgdiff-select', …)` on
164
+ * any element, the document or the window types `event.detail`.
165
+ */
166
+ export interface KgdiffEventMap {
167
+ /** A diff is shown, from `load()` or a `payload`; `stats` counts its nodes, edges and changes. */
80
168
  'kgdiff-ready': CustomEvent<{
81
169
  readonly stats: DiffStats;
82
170
  }>;
171
+ /**
172
+ * The selection changed: a change (`hunk`, its id, with the node chosen in it if any), a node
173
+ * alone (`hunk` null), or nothing (both null).
174
+ */
83
175
  'kgdiff-select': CustomEvent<{
84
176
  readonly hunk: string | null;
85
177
  readonly node: string | null;
86
178
  }>;
179
+ /** The mode or the scope changed, by the user, a key or the host. */
87
180
  'kgdiff-mode': CustomEvent<{
88
181
  readonly mode: ViewerMode;
89
182
  readonly scope: ViewerScope;
90
183
  }>;
184
+ /** A change was marked reviewed, or not; `progress` is the review state after it. */
91
185
  'kgdiff-review': CustomEvent<{
92
186
  readonly hunk: string;
93
187
  readonly reviewed: boolean;
94
188
  readonly progress: ReviewState;
95
189
  }>;
190
+ /** Loading or showing a diff failed; `error` is a `KgdiffError` for bad input. */
96
191
  'kgdiff-error': CustomEvent<{
97
192
  readonly error: Error;
98
193
  }>;
@@ -103,6 +198,16 @@ export interface KgdiffViewerEventMap {
103
198
  'kgdiff-replay-end': CustomEvent<{
104
199
  readonly loop: boolean;
105
200
  }>;
201
+ /**
202
+ * The default layout changed: a panel opened, collapsed or was hidden, or a size changed (once
203
+ * a drag ends). `source`: the user did it in the viewer, or the host (attributes, properties,
204
+ * a report's `view.panels`).
205
+ *
206
+ * @defaultLayout `<kgdiff-viewer>` fires it; `<kgdiff-root>` has no layout of its own.
207
+ */
208
+ 'kgdiff-layout': CustomEvent<ViewerLayout & {
209
+ readonly source: 'user' | 'host';
210
+ }>;
106
211
  }
107
212
  export interface FitOptions {
108
213
  /** Default true (false with reduced motion). */
@@ -111,21 +216,15 @@ export interface FitOptions {
111
216
  readonly padding?: number;
112
217
  }
113
218
  /**
114
- * Public surface of the `<kgdiff-viewer>` element.
219
+ * What `<kgdiff-viewer>` and `<kgdiff-root>` share: a root of a diff session, its preferences,
220
+ * methods and events (`KgdiffEventMap`, but `kgdiff-layout`).
115
221
  *
116
- * Boolean attributes: `sync-hash` (deep links `#kgdiff=hunk:<id>;mode:<mode>;scope:<scope>`) and
117
- * `global-shortcuts`: keyboard shortcuts normally apply only while focus is inside the viewer;
118
- * with this attribute they also apply when nothing on the page has focus (for full-page
119
- * viewers such as HTML reports), except the keys pages scroll with (arrows, Home / End, Page
120
- * Up / Down, Space).
222
+ * Boolean attribute `sync-hash`: deep links `#kgdiff=hunk:<id>;mode:<mode>;scope:<scope>`.
121
223
  *
122
- * `header="compact"` leaves the brand and the compared names out of the canvas, for hosts that
123
- * show their own (such as the playground).
124
- *
125
- * A small looping replay for another page: `mode="replay" chrome="none" loop` (with a height of
126
- * your choosing, such as 320px).
224
+ * `<kgdiff-viewer>` is stable; `<kgdiff-root>`, the element of this type on its own, is
225
+ * experimental in 0.6 (its tag name map entry says so).
127
226
  */
128
- export interface KgdiffViewerElement extends HTMLElement {
227
+ export interface KgdiffRootElement extends HTMLElement {
129
228
  /** Reflected to the `mode` attribute. Default `overlay`. */
130
229
  get mode(): ViewerMode;
131
230
  /** The legacy `changes` mode sets `overlay` + scope `changes`. */
@@ -141,20 +240,6 @@ export interface KgdiffViewerElement extends HTMLElement {
141
240
  palette: PaletteName;
142
241
  /** Reflected to the `locale` attribute. Default from `navigator.language`. */
143
242
  locale: Locale;
144
- /**
145
- * Reflected to the `chrome` attribute. `none` shows the graph alone: no title, actions, view
146
- * dock (with the step caption and playback bar), change list, zoom buttons, minimap or legend
147
- * card; the hover tooltip and a one-line legend stay. Clicks and keyboard shortcuts do nothing, the minimum height drops
148
- * from 420px to 120px, and the view stays fitted: when the canvas is resized (unless the user
149
- * panned or zoomed since) and at the start of every loop. Labels are never cut at the edge:
150
- * one pushed from its spot by a neighbour moves inside or is left out. Default `full`.
151
- */
152
- chrome: ViewerChrome;
153
- /**
154
- * Reflected to the `legend` attribute: `full` (the card), `mini` (one line: the families this
155
- * diff has, then unchanged), `none`. Default `auto`: `full`, or `mini` with `chrome="none"`.
156
- */
157
- legend: ViewerLegend;
158
243
  /**
159
244
  * Reflected to the boolean `loop` attribute. In `replay` mode the replay plays by itself and
160
245
  * starts again `loopDelay` ms after it ends. `pause()` stops it until `play()`. Default false.
@@ -173,16 +258,221 @@ export interface KgdiffViewerElement extends HTMLElement {
173
258
  load(options: LoadOptions): Promise<void>;
174
259
  /** Select a hunk by id (null clears) and bring it into view. */
175
260
  selectHunk(id: string | null): void;
261
+ /** Select the next change (`j`), in the list's order, and bring it into view. */
176
262
  next(): void;
263
+ /** Select the previous change (`k`). */
177
264
  prev(): void;
265
+ /** Play the replay (in `replay` mode), from where it is. */
178
266
  play(): void;
267
+ /** Pause the replay; a looping one stays paused until `play()`. */
179
268
  pause(): void;
180
269
  /** Fit the whole graph, labels included, into view. */
181
270
  fit(options?: FitOptions): Promise<void>;
182
271
  /** The full delta of the current diff. */
183
272
  exportDelta(): Delta;
273
+ /** Which changes are reviewed, and how many of all. */
184
274
  reviewState(): ReviewState;
275
+ /** Mark a change (by its id) reviewed or not; saved per diff, as the reader's `x` is. */
185
276
  setReviewed(hunkId: string, reviewed: boolean): void;
277
+ /**
278
+ * Reflected to the `shortcuts` attribute: where the keyboard shortcuts apply. `scoped` (the
279
+ * default): while focus is inside the root, or in an element bound to it with `for` (those
280
+ * forward their keys). `global`: also when nothing on the page has focus (for full-page
281
+ * viewers such as HTML reports), for the first such root, except the keys pages scroll with
282
+ * (arrows, Home / End, Page Up / Down, Space); the boolean `global-shortcuts` attribute is an
283
+ * alias. `none`: no shortcuts (a focused change list keeps its arrow keys, Home / End and
284
+ * Enter).
285
+ */
286
+ shortcuts: ShortcutScope;
287
+ /**
288
+ * Single keys of the keyboard map bound to another shortcut, or unbound with `null`:
289
+ * `{ x: null, r: 'review' }`. The `keymap` attribute takes the same as text,
290
+ * `"x:none r:review"` (`Space` names the space bar). Keys are `KeyboardEvent.key` values; a
291
+ * letter stands for both its cases unless the other case is named too; keys not named keep the
292
+ * default map; entries naming no shortcut are ignored with a warning.
293
+ *
294
+ * @experimental The shortcut names (`ShortcutName`) are new in 0.6.
295
+ */
296
+ get keymap(): Keymap | null;
297
+ set keymap(value: Keymap | string | null);
298
+ /**
299
+ * Draw the canvas with the `--kgdiff-*` tokens as computed now: after the page changed
300
+ * tokens in a way the root cannot observe (a class on an ancestor, a new stylesheet). Theme,
301
+ * palette and system color scheme changes are followed by themselves.
302
+ */
303
+ refreshTheme(): void;
304
+ }
305
+ /**
306
+ * The drop-in viewer: a root (`KgdiffRootElement`) with the default layout, the canvas with its
307
+ * chrome, the change list, the search, the filters and the detail panel.
308
+ *
309
+ * `header="compact"` leaves the brand and the compared names out of the canvas, for hosts that
310
+ * show their own (such as the playground): the preset `panels="title:hidden"`.
311
+ * `sidebar="closed"` starts with the sidebar folded (`\` and the sidebar button open it).
312
+ *
313
+ * A small looping replay for another page: `mode="replay" chrome="none" loop` (with a height of
314
+ * your choosing, such as 320px).
315
+ *
316
+ * The canvas has the slots of `<kgdiff-stage>` (`top-start`, `top-end`, `bottom-start`,
317
+ * `bottom-center`, `bottom-end`; the top ones under the title and the actions while those
318
+ * show): a child with `slot="top-end"` goes over the canvas, kept clear of fits and flights. A
319
+ * chrome element slotted in replaces the built-in region of its kind, the title and the
320
+ * actions included; `<kgdiff-zoom>` and `<kgdiff-minimap>` inside the viewer act on its canvas.
321
+ */
322
+ export interface KgdiffViewerElement extends KgdiffRootElement {
323
+ /**
324
+ * Reflected to the `chrome` attribute. `none` shows the graph alone: no title, actions, view
325
+ * dock (with the step caption and playback bar), change list, zoom buttons, minimap or legend
326
+ * card; the hover tooltip and a one-line legend stay. Clicks and keyboard shortcuts do nothing, the minimum height drops
327
+ * from 420px to 120px, and the view stays fitted: when the canvas is resized (unless the user
328
+ * panned or zoomed since) and at the start of every loop. Labels are never cut at the edge:
329
+ * one pushed from its spot by a neighbour moves inside or is left out. Default `full`.
330
+ */
331
+ chrome: ViewerChrome;
332
+ /**
333
+ * The page's declaration of panel states, reflected to the `panels` attribute: a string
334
+ * (`"detail:collapsed minimap:hidden"`) or an object (`{ detail: 'collapsed' }`); reading it
335
+ * gives the object. Regions not named keep their state; entries that name no region or
336
+ * state are ignored with a warning. It wins over what the user chose before (remembered) and
337
+ * a report's `view.panels`; the user can still open and close collapsed regions, and
338
+ * declaring the same again keeps what they did. The presets `sidebar="closed"` (list,
339
+ * detail, search and filters collapsed), `header="compact"` (title hidden) and
340
+ * `chrome="none"` (everything but the canvas and the legend hidden) are panel states too;
341
+ * `panels` wins over them for the regions it names. The states every region has now are in
342
+ * `layout`.
343
+ */
344
+ get panels(): ViewerPanels;
345
+ set panels(value: ViewerPanels | string | null);
346
+ /** Every region's state and the sizes now (what `kgdiff-layout` reports, without `source`). */
347
+ readonly layout: ViewerLayout;
348
+ /**
349
+ * Reflected to the `persist` attribute. `local` (the default): the layout remembers the
350
+ * user's panel states, sizes, theme, palette and language in `localStorage` (under
351
+ * `persistKey`, shared by the viewers of the origin with the same key). `none`: it remembers
352
+ * nothing.
353
+ */
354
+ persist: 'local' | 'none';
355
+ /**
356
+ * Reflected to the `persist-key` attribute: the `localStorage` key the layout remembers
357
+ * under. Viewers with the same key share what they remember; give each app on a shared origin
358
+ * (a GitHub Pages user site, say) a key of its own. Default `kgdiff:viewer`.
359
+ */
360
+ persistKey: string;
361
+ /**
362
+ * Reflected to the `legend` attribute: `full` (the card), `mini` (one line: the families this
363
+ * diff has, then unchanged), `none`. Default `auto`: `full`, or `mini` with `chrome="none"`.
364
+ */
365
+ legend: ViewerLegend;
366
+ }
367
+ /**
368
+ * An element bound to a root (experimental): `<kgdiff-stage>`, `<kgdiff-change-list>`,
369
+ * `<kgdiff-change-detail>`, `<kgdiff-search>`, `<kgdiff-filters>`. It shows the session of the
370
+ * nearest `<kgdiff-root>` or `<kgdiff-viewer>` around it (across shadow roots), or of the one
371
+ * named by its `for` attribute (an element id) anywhere on the page; a root defined or
372
+ * connected later is found then.
373
+ *
374
+ * @experimental The elements are experimental in 0.6: names, attributes and markup may change
375
+ * in a minor release before they are stable.
376
+ */
377
+ export interface KgdiffBoundElement extends HTMLElement {
378
+ /**
379
+ * Reflects the `for` attribute, as on `<label>` and `<output>`: the id of the root to show,
380
+ * or '' (no attribute; setting '' removes it) for the nearest one around the element.
381
+ * Changing it binds again.
382
+ */
383
+ htmlFor: string;
384
+ /** The root this element shows, or null while it waits for one (`for`'s element, resolved). */
385
+ readonly rootElement: KgdiffRootElement | null;
386
+ }
387
+ /**
388
+ * `<kgdiff-legend>`'s `variant`: `full` (the card of every family) or `mini` (one line).
389
+ *
390
+ * @experimental Like the elements, in 0.6.
391
+ */
392
+ export type LegendVariant = 'full' | 'mini';
393
+ /**
394
+ * `<kgdiff-legend>` (experimental): what the colors mean, bound to a root.
395
+ *
396
+ * @experimental The elements are experimental in 0.6: names, attributes and markup may change
397
+ * in a minor release before they are stable.
398
+ */
399
+ export interface KgdiffLegendElement extends KgdiffBoundElement {
400
+ /** Reflected to `variant`: `full` (default) or `mini`; another value reads `full`. */
401
+ variant: LegendVariant;
402
+ /** Reflected to the boolean `open`: whether the card is open (the user's toggle too). */
403
+ open: boolean;
404
+ }
405
+ /**
406
+ * An element that acts on one stage's view (experimental): `<kgdiff-zoom>`,
407
+ * `<kgdiff-minimap>`. It binds to the nearest `<kgdiff-stage>` around it, or to the one its
408
+ * `stage` attribute (an element id) names anywhere on the page.
409
+ *
410
+ * @experimental The elements are experimental in 0.6: names, attributes and markup may change
411
+ * in a minor release before they are stable.
412
+ */
413
+ export interface KgdiffStageBoundElement extends HTMLElement {
414
+ /**
415
+ * Reflects the `stage` attribute: the id of the stage to act on, or '' (no attribute;
416
+ * setting '' removes it) for the nearest one around the element. Changing it binds again.
417
+ */
418
+ stage: string;
419
+ /**
420
+ * The stage this element acts on, or null while it waits for one. Inside a `<kgdiff-viewer>`
421
+ * (or naming one) it is the viewer, whose built-in stage it acts on.
422
+ */
423
+ readonly stageElement: KgdiffStageElement | KgdiffViewerElement | null;
424
+ /** The root whose session the stage shows, or null while the element or the stage waits. */
425
+ readonly rootElement: KgdiffRootElement | null;
426
+ }
427
+ /**
428
+ * `<kgdiff-minimap>` (experimental): an overview of one stage's view.
429
+ *
430
+ * @experimental The elements are experimental in 0.6: names, attributes and markup may change
431
+ * in a minor release before they are stable.
432
+ */
433
+ export interface KgdiffMinimapElement extends KgdiffStageBoundElement {
434
+ /**
435
+ * Whether the whole graph is in view: the element is in the custom state `overview` then
436
+ * (`kgdiff-minimap:state(overview)`). Placed by the page it stays shown
437
+ * (`kgdiff-minimap:state(overview) { visibility: hidden }` hides it in place); slotted into a
438
+ * stage it replaces the stage's own minimap and hides as that one does.
439
+ */
440
+ readonly overview: boolean;
441
+ }
442
+ /**
443
+ * `<kgdiff-stage>` (experimental): the canvas, with five named slots for the page's content
444
+ * over it (`top-start`, `top-end`, `bottom-start`, `bottom-center`, `bottom-end`). Every
445
+ * slotted element is kept clear of fits and flights. A chrome element slotted in
446
+ * (`<kgdiff-view-dock>`, `<kgdiff-transport>`, `<kgdiff-legend>`, `<kgdiff-zoom>`,
447
+ * `<kgdiff-minimap>`) replaces the built-in region; `panels` keeps applying to the rest. Content
448
+ * placed anywhere else over the canvas is no obstacle unless registered (`registerObstacle`).
449
+ *
450
+ * @experimental The elements are experimental in 0.6: names, attributes and markup may change
451
+ * in a minor release before they are stable.
452
+ */
453
+ export interface KgdiffStageElement extends KgdiffBoundElement {
454
+ /**
455
+ * The states of the built-in chrome (`dock`, `transport`, `legend`, `zoom`, `minimap`),
456
+ * reflected to the `panels` attribute, in the syntax of `<kgdiff-viewer>`'s `panels`:
457
+ * `"minimap:hidden zoom:hidden"` or `{ minimap: 'hidden' }`; reading it gives the object.
458
+ * Other regions are ignored with a warning. Default: all open, the legend collapsed.
459
+ */
460
+ get panels(): StagePanels;
461
+ set panels(value: StagePanels | string | null);
462
+ /**
463
+ * Reflected to the `version` attribute: the version this stage draws whatever the root's
464
+ * mode, `before` or `after` (two stages of one root side by side), or null to follow the
465
+ * mode. Another value is ignored with a warning. Each stage has its own camera; the
466
+ * selection, hover, filters and search are the root's, so both bring the same change into
467
+ * view.
468
+ */
469
+ version: StageVersion | null;
470
+ /**
471
+ * Keep `element` (content over the canvas the stage does not place) clear of fits and
472
+ * flights; returns the function that stops it. Also on the stage context descendants can
473
+ * request (`Symbol.for('kgdiff.stage/1')`).
474
+ */
475
+ registerObstacle(element: Element): () => void;
186
476
  }
187
477
  /**
188
478
  * Global through which the optional compute add-on (`@kgdiff/viewer/standalone/compute`, i.e.
@@ -204,9 +494,13 @@ export declare function defineViewer(tagName?: string): void;
204
494
  * (`data-for="<element id>"`, else the first viewer in the document).
205
495
  */
206
496
  export declare function hydrateEmbeddedPayloads(root?: ParentNode): Promise<void>;
497
+ /** @deprecated Use `KgdiffEventMap` (the same map, for the viewer and its elements). */
498
+ export type KgdiffViewerEventMap = KgdiffEventMap;
207
499
  declare global {
208
500
  interface HTMLElementTagNameMap {
209
501
  'kgdiff-viewer': KgdiffViewerElement;
210
502
  }
503
+ interface GlobalEventHandlersEventMap extends KgdiffEventMap {
504
+ }
211
505
  }
212
506
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EACV,KAAK,EACL,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,MAAM,EACN,MAAM,EACN,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,Y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OAAO,SAAkB,GAAG,IAAI,CAU5D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAGxE;AAED,wFAAwF;AACxF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAElD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,eAAe,EAAE,mBAAmB,CAAC;KACtC;IAED,UAAU,2BAA4B,SAAQ,cAAc;KAAG;CAChE"}
package/dist/index.js CHANGED
@@ -1,4 +1,17 @@
1
1
  import { KgdiffViewer } from './element.js';
2
+ import './elements/root.js';
3
+ import './elements/stage.js';
4
+ import './elements/change-list.js';
5
+ import './elements/change-detail.js';
6
+ import './elements/search.js';
7
+ import './elements/filters.js';
8
+ import './elements/view-dock.js';
9
+ import './elements/transport.js';
10
+ import './elements/legend.js';
11
+ import './elements/zoom.js';
12
+ import './elements/minimap.js';
13
+ import './elements/title.js';
14
+ import './elements/actions.js';
2
15
  import { hydrate } from './payload.js';
3
16
  import { viewerTags } from './registry.js';
4
17
  /**
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA+J3C;;;;;;;;GAQG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAE7D,IAAI,eAAe,GAAG,KAAK,CAAC;AAE5B,8FAA8F;AAC9F,MAAM,UAAU,YAAY,CAAC,OAAO,GAAG,eAAe;IACpD,IAAI,OAAO,cAAc,KAAK,WAAW;QAAE,OAAO;IAClD,MAA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cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AA8b3C;;;;;;;;GAQG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,mFAAmF;AACnF,MAAM,CAAC,MAAM,mBAAmB,GAAG,yBAAyB,CAAC;AAE7D,IAAI,eAAe,GAAG,KAAK,CAAC;AAE5B,8FAA8F;AAC9F,MAAM,UAAU,YAAY,CAAC,OAAO,GAAG,eAAe;IACpD,IAAI,OAAO,cAAc,KAAK,WAAW;QAAE,OAAO;IAClD,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IACnC,IAAI,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;QAC3C,8EAA8E;QAC9E,MAAM,IAAI,GAAG,eAAe,CAAC,CAAC,CAAC,KAAM,SAAQ,YAAY;SAAG,CAAC,CAAC,CAAC,YAAY,CAAC;QAC5E,cAAc,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClC,eAAe,GAAG,IAAI,CAAC;IACzB,CAAC;IACD,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAiB;IACvD,MAAM,KAAK,GAAG,IAAI,IAAI,CAAC,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAC/E,OAAO,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;AACpD,CAAC;AAaD,YAAY,EAAE,CAAC"}
@@ -56,11 +56,48 @@ export interface KeyLike {
56
56
  /** Divider steps for swipe, as a fraction of the width. */
57
57
  export declare const DIVIDER_STEP = 0.02;
58
58
  export declare const DIVIDER_STEP_LARGE = 0.1;
59
+ /**
60
+ * The shortcuts a key can be bound to (`keymap`). `left` / `right` step the replay, or move the
61
+ * swipe divider (further with Shift); `play-pause` acts in replay, `expand` with the `changes`
62
+ * scope.
63
+ *
64
+ * @experimental New in 0.6: the list may grow as the canvas chrome becomes elements.
65
+ */
66
+ export type ShortcutName = 'overlay' | 'swipe' | 'replay' | 'scope' | 'expand' | 'next' | 'prev' | 'first' | 'last' | 'fly' | 'escape' | 'play-pause' | 'left' | 'right' | 'fit' | 'zoom-in' | 'zoom-out' | 'search' | 'review' | 'sidebar' | 'theme' | 'help';
67
+ /**
68
+ * Keys (as `KeyboardEvent.key`) bound to a shortcut, or to `null` to leave the key unbound. A
69
+ * letter stands for both its cases (`x` also binds Shift+x, `X`) unless the other case is named
70
+ * too.
71
+ *
72
+ * @experimental New in 0.6, with `ShortcutName`.
73
+ */
74
+ export type Keymap = Readonly<Record<string, ShortcutName | null>>;
75
+ /** The default keyboard map (docs/interaction.md §Keyboard map); each letter once. */
76
+ export declare const DEFAULT_KEYMAP: Keymap;
77
+ /** Every shortcut (each is bound to a key by default). */
78
+ export declare const SHORTCUT_NAMES: ReadonlySet<string>;
59
79
  /**
60
80
  * Map a key press to an action in `mode` and `scope`, or null when the key means nothing here.
61
- * Chords with Ctrl / Meta / Alt are never handled (they belong to the browser and the host page).
81
+ * `keymap` overrides single keys of the default map (null unbinds one); a letter in either map
82
+ * stands for both its cases unless the other case is named too. Chords with Ctrl / Meta / Alt
83
+ * are never handled (they belong to the browser and the host page).
62
84
  */
63
- export declare function keyAction(e: KeyLike, mode: ViewerMode, scope?: ViewerScope): KeyAction | null;
85
+ export declare function keyAction(e: KeyLike, mode: ViewerMode, scope?: ViewerScope, keymap?: Keymap | null): KeyAction | null;
86
+ /**
87
+ * The keys bound to each shortcut with `keymap` over the default map, in the default map's
88
+ * order then `keymap`'s (what the shortcuts dialog lists). A letter is listed once for both its
89
+ * cases; a shortcut no key is bound to is absent.
90
+ */
91
+ export declare function shortcutKeys(keymap: Keymap | null): ReadonlyMap<ShortcutName, readonly string[]>;
92
+ /**
93
+ * A keymap from an attribute (`"x:none r:review"`: `key:shortcut` pairs separated by spaces,
94
+ * `none` unbinds a key, `Space` is the space bar) or a property (an object of the same pairs).
95
+ * Pairs that name no shortcut are left out and returned in `invalid`.
96
+ */
97
+ export declare function toKeymap(value: unknown): {
98
+ keymap: Keymap | null;
99
+ invalid: string[];
100
+ };
64
101
  /** Whether a key event comes from a place where the user types (shortcuts must not fire). */
65
102
  export declare function isTypingTarget(target: EventTarget | null): boolean;
66
103
  //# sourceMappingURL=keyboard.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../src/keyboard.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE1D,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAE,GAC1B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GACxB;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAE,GAC/B;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,SAAS,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;CAAE,GACrD;IAAE,QAAQ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