@tartaguti/ui-components 0.1.0 → 0.3.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 (213) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +12 -0
  3. package/custom-elements.json +2887 -823
  4. package/dist/accordion/tt-accordion-item.d.ts.map +1 -1
  5. package/dist/accordion/tt-accordion-item.js +5 -2
  6. package/dist/accordion/tt-accordion-item.js.map +1 -1
  7. package/dist/bento/tt-bento-item.d.ts.map +1 -1
  8. package/dist/bento/tt-bento-item.js +7 -13
  9. package/dist/bento/tt-bento-item.js.map +1 -1
  10. package/dist/docs.d.ts +7 -0
  11. package/dist/docs.d.ts.map +1 -0
  12. package/dist/docs.js +15 -0
  13. package/dist/docs.js.map +1 -0
  14. package/dist/index.d.ts +4 -6
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +8 -7
  17. package/dist/index.js.map +1 -1
  18. package/dist/sidebar/tt-menu-group.d.ts.map +1 -1
  19. package/dist/sidebar/tt-menu-group.js +16 -5
  20. package/dist/sidebar/tt-menu-group.js.map +1 -1
  21. package/dist/sidebar/tt-menu-item.d.ts.map +1 -1
  22. package/dist/sidebar/tt-menu-item.js +24 -11
  23. package/dist/sidebar/tt-menu-item.js.map +1 -1
  24. package/dist/sidebar/tt-sidebar-footer.d.ts.map +1 -1
  25. package/dist/sidebar/tt-sidebar-footer.js +7 -3
  26. package/dist/sidebar/tt-sidebar-footer.js.map +1 -1
  27. package/dist/sidebar/tt-sidebar.d.ts +8 -3
  28. package/dist/sidebar/tt-sidebar.d.ts.map +1 -1
  29. package/dist/sidebar/tt-sidebar.js +196 -44
  30. package/dist/sidebar/tt-sidebar.js.map +1 -1
  31. package/dist/strings.d.ts +64 -0
  32. package/dist/strings.d.ts.map +1 -0
  33. package/dist/strings.js +68 -0
  34. package/dist/strings.js.map +1 -0
  35. package/dist/tokens.css +30 -6
  36. package/dist/tt-alert.d.ts.map +1 -1
  37. package/dist/tt-alert.js +5 -2
  38. package/dist/tt-alert.js.map +1 -1
  39. package/dist/tt-auth.d.ts +5 -1
  40. package/dist/tt-auth.d.ts.map +1 -1
  41. package/dist/tt-auth.js +72 -10
  42. package/dist/tt-auth.js.map +1 -1
  43. package/dist/tt-breadcrumbs.d.ts.map +1 -1
  44. package/dist/tt-breadcrumbs.js +6 -3
  45. package/dist/tt-breadcrumbs.js.map +1 -1
  46. package/dist/tt-button-group.d.ts.map +1 -1
  47. package/dist/tt-button-group.js +7 -1
  48. package/dist/tt-button-group.js.map +1 -1
  49. package/dist/tt-button.d.ts.map +1 -1
  50. package/dist/tt-button.js +37 -28
  51. package/dist/tt-button.js.map +1 -1
  52. package/dist/tt-card.d.ts.map +1 -1
  53. package/dist/tt-card.js +9 -6
  54. package/dist/tt-card.js.map +1 -1
  55. package/dist/tt-chart.d.ts +10 -2
  56. package/dist/tt-chart.d.ts.map +1 -1
  57. package/dist/tt-chart.js +167 -29
  58. package/dist/tt-chart.js.map +1 -1
  59. package/dist/tt-checkbox.d.ts.map +1 -1
  60. package/dist/tt-checkbox.js +5 -2
  61. package/dist/tt-checkbox.js.map +1 -1
  62. package/dist/tt-code-block.d.ts +4 -5
  63. package/dist/tt-code-block.d.ts.map +1 -1
  64. package/dist/tt-code-block.js +53 -17
  65. package/dist/tt-code-block.js.map +1 -1
  66. package/dist/tt-combobox.d.ts +14 -0
  67. package/dist/tt-combobox.d.ts.map +1 -1
  68. package/dist/tt-combobox.js +234 -31
  69. package/dist/tt-combobox.js.map +1 -1
  70. package/dist/tt-company-card.d.ts +18 -0
  71. package/dist/tt-company-card.d.ts.map +1 -1
  72. package/dist/tt-company-card.js +73 -4
  73. package/dist/tt-company-card.js.map +1 -1
  74. package/dist/tt-comparison-table.d.ts.map +1 -1
  75. package/dist/tt-comparison-table.js +6 -3
  76. package/dist/tt-comparison-table.js.map +1 -1
  77. package/dist/tt-component-doc.d.ts.map +1 -1
  78. package/dist/tt-component-doc.js +6 -3
  79. package/dist/tt-component-doc.js.map +1 -1
  80. package/dist/tt-contact-list.d.ts +17 -2
  81. package/dist/tt-contact-list.d.ts.map +1 -1
  82. package/dist/tt-contact-list.js +68 -10
  83. package/dist/tt-contact-list.js.map +1 -1
  84. package/dist/tt-copy-button.d.ts.map +1 -1
  85. package/dist/tt-copy-button.js +6 -3
  86. package/dist/tt-copy-button.js.map +1 -1
  87. package/dist/tt-data-table.d.ts +32 -1
  88. package/dist/tt-data-table.d.ts.map +1 -1
  89. package/dist/tt-data-table.js +302 -16
  90. package/dist/tt-data-table.js.map +1 -1
  91. package/dist/tt-dock-item.d.ts +53 -0
  92. package/dist/tt-dock-item.d.ts.map +1 -0
  93. package/dist/tt-dock-item.js +270 -0
  94. package/dist/tt-dock-item.js.map +1 -0
  95. package/dist/tt-dock.d.ts +59 -0
  96. package/dist/tt-dock.d.ts.map +1 -0
  97. package/dist/tt-dock.js +337 -0
  98. package/dist/tt-dock.js.map +1 -0
  99. package/dist/tt-drawer.d.ts +4 -0
  100. package/dist/tt-drawer.d.ts.map +1 -1
  101. package/dist/tt-drawer.js +14 -4
  102. package/dist/tt-drawer.js.map +1 -1
  103. package/dist/tt-dropdown-menu.d.ts +5 -0
  104. package/dist/tt-dropdown-menu.d.ts.map +1 -1
  105. package/dist/tt-dropdown-menu.js +34 -8
  106. package/dist/tt-dropdown-menu.js.map +1 -1
  107. package/dist/tt-file-upload.d.ts +35 -0
  108. package/dist/tt-file-upload.d.ts.map +1 -1
  109. package/dist/tt-file-upload.js +210 -21
  110. package/dist/tt-file-upload.js.map +1 -1
  111. package/dist/tt-filter.d.ts.map +1 -1
  112. package/dist/tt-filter.js +10 -5
  113. package/dist/tt-filter.js.map +1 -1
  114. package/dist/tt-form.d.ts +25 -1
  115. package/dist/tt-form.d.ts.map +1 -1
  116. package/dist/tt-form.js +151 -12
  117. package/dist/tt-form.js.map +1 -1
  118. package/dist/tt-grid.d.ts +10 -1
  119. package/dist/tt-grid.d.ts.map +1 -1
  120. package/dist/tt-grid.js +38 -9
  121. package/dist/tt-grid.js.map +1 -1
  122. package/dist/tt-icon.d.ts.map +1 -1
  123. package/dist/tt-icon.js +5 -0
  124. package/dist/tt-icon.js.map +1 -1
  125. package/dist/tt-inbox.d.ts +4 -0
  126. package/dist/tt-inbox.d.ts.map +1 -1
  127. package/dist/tt-inbox.js +13 -3
  128. package/dist/tt-inbox.js.map +1 -1
  129. package/dist/tt-input.d.ts.map +1 -1
  130. package/dist/tt-input.js +15 -5
  131. package/dist/tt-input.js.map +1 -1
  132. package/dist/tt-key-values.d.ts +2 -0
  133. package/dist/tt-key-values.d.ts.map +1 -1
  134. package/dist/tt-key-values.js +45 -2
  135. package/dist/tt-key-values.js.map +1 -1
  136. package/dist/tt-layout.d.ts +53 -2
  137. package/dist/tt-layout.d.ts.map +1 -1
  138. package/dist/tt-layout.js +233 -27
  139. package/dist/tt-layout.js.map +1 -1
  140. package/dist/tt-modal.d.ts +4 -0
  141. package/dist/tt-modal.d.ts.map +1 -1
  142. package/dist/tt-modal.js +14 -4
  143. package/dist/tt-modal.js.map +1 -1
  144. package/dist/tt-navbar.d.ts +4 -0
  145. package/dist/tt-navbar.d.ts.map +1 -1
  146. package/dist/tt-navbar.js +42 -7
  147. package/dist/tt-navbar.js.map +1 -1
  148. package/dist/tt-pagination.d.ts +4 -0
  149. package/dist/tt-pagination.d.ts.map +1 -1
  150. package/dist/tt-pagination.js +8 -1
  151. package/dist/tt-pagination.js.map +1 -1
  152. package/dist/tt-product.d.ts +67 -15
  153. package/dist/tt-product.d.ts.map +1 -1
  154. package/dist/tt-product.js +447 -366
  155. package/dist/tt-product.js.map +1 -1
  156. package/dist/tt-progress.d.ts +1 -0
  157. package/dist/tt-progress.d.ts.map +1 -1
  158. package/dist/tt-progress.js +26 -7
  159. package/dist/tt-progress.js.map +1 -1
  160. package/dist/tt-quantity.d.ts.map +1 -1
  161. package/dist/tt-quantity.js +5 -2
  162. package/dist/tt-quantity.js.map +1 -1
  163. package/dist/tt-radio-group.d.ts.map +1 -1
  164. package/dist/tt-radio-group.js +5 -2
  165. package/dist/tt-radio-group.js.map +1 -1
  166. package/dist/tt-scroller.d.ts +76 -0
  167. package/dist/tt-scroller.d.ts.map +1 -0
  168. package/dist/tt-scroller.js +525 -0
  169. package/dist/tt-scroller.js.map +1 -0
  170. package/dist/tt-search.d.ts.map +1 -1
  171. package/dist/tt-search.js +10 -5
  172. package/dist/tt-search.js.map +1 -1
  173. package/dist/tt-select.d.ts +9 -0
  174. package/dist/tt-select.d.ts.map +1 -1
  175. package/dist/tt-select.js +99 -14
  176. package/dist/tt-select.js.map +1 -1
  177. package/dist/tt-slider.d.ts.map +1 -1
  178. package/dist/tt-slider.js +13 -2
  179. package/dist/tt-slider.js.map +1 -1
  180. package/dist/tt-social-links.d.ts.map +1 -1
  181. package/dist/tt-social-links.js +7 -4
  182. package/dist/tt-social-links.js.map +1 -1
  183. package/dist/tt-switcher.d.ts +2 -0
  184. package/dist/tt-switcher.d.ts.map +1 -1
  185. package/dist/tt-switcher.js +24 -76
  186. package/dist/tt-switcher.js.map +1 -1
  187. package/dist/tt-table-row.d.ts.map +1 -1
  188. package/dist/tt-table-row.js +5 -2
  189. package/dist/tt-table-row.js.map +1 -1
  190. package/dist/tt-table.d.ts.map +1 -1
  191. package/dist/tt-table.js +5 -2
  192. package/dist/tt-table.js.map +1 -1
  193. package/dist/tt-tabs.d.ts.map +1 -1
  194. package/dist/tt-tabs.js +5 -2
  195. package/dist/tt-tabs.js.map +1 -1
  196. package/dist/tt-tag-list.d.ts.map +1 -1
  197. package/dist/tt-tag-list.js +6 -3
  198. package/dist/tt-tag-list.js.map +1 -1
  199. package/dist/tt-textarea.d.ts.map +1 -1
  200. package/dist/tt-textarea.js +5 -2
  201. package/dist/tt-textarea.js.map +1 -1
  202. package/dist/tt-toast.d.ts +4 -1
  203. package/dist/tt-toast.d.ts.map +1 -1
  204. package/dist/tt-toast.js +40 -6
  205. package/dist/tt-toast.js.map +1 -1
  206. package/dist/tt-toggle-group.d.ts.map +1 -1
  207. package/dist/tt-toggle-group.js +7 -1
  208. package/dist/tt-toggle-group.js.map +1 -1
  209. package/dist/tt-toggle.d.ts.map +1 -1
  210. package/dist/tt-toggle.js +14 -9
  211. package/dist/tt-toggle.js.map +1 -1
  212. package/package.json +1 -1
  213. package/vscode.html-custom-data.json +241 -66
@@ -6,6 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  };
7
7
  import { LitElement, html, css, nothing } from "lit";
8
8
  import { property, state, customElement } from "lit/decorators.js";
9
+ import { afterTransitions } from "../motion.js";
9
10
  import "../tt-icon.js";
10
11
  /**
11
12
  * The navigation column of an app shell.
@@ -37,11 +38,11 @@ import "../tt-icon.js";
37
38
  * as --tt-radius-nested in tokens.css.
38
39
  *
39
40
  * They are declared in the stylesheet under :host([collapsed]) rather
40
- * than written from JavaScript, and that matters: a media query can
41
+ * than written from JavaScript, and that matters: a container query can
41
42
  * override a stylesheet rule, and cannot override an inline style. It is
42
43
  * what lets the block at the bottom of this file switch the whole rail
43
- * off on a phone, where the sidebar is a drawer and a rail would be an
44
- * unusable 64px strip sliding over the page.
44
+ * off in tt-layout's drawer on a phone, where a rail would be an unusable
45
+ * 64px strip sliding over the page.
45
46
  *
46
47
  * ---------------------------------------------------------------------
47
48
  * WHO OWNS `collapsed`.
@@ -61,6 +62,18 @@ let TTSidebar = class TTSidebar extends LitElement {
61
62
  // Shows the collapse control. Without it the sidebar cannot be shrunk.
62
63
  this.collapsible = false;
63
64
  this.collapsed = false;
65
+ /*
66
+ Pinned to the screen, the way an app's sidebar behaves: exactly one
67
+ screen tall, it stays put while the page scrolls beside it, and its
68
+ own menu scrolls when it is longer than the screen. So the footer
69
+ sits at the bottom and the collapse arrow is always in reach.
70
+
71
+ Without it the sidebar is as tall as whatever holds it, and in a row
72
+ beside a page that is the page: a long page pushed the footer and
73
+ the arrow below the fold, and a short one ended the column halfway
74
+ down. Reflected, because the styles match on it.
75
+ */
76
+ this.sticky = false;
64
77
  /*
65
78
  The name of the navigation landmark. A screen reader lists landmarks,
66
79
  and "navigation" repeated twice on a page with a navbar tells the
@@ -71,6 +84,13 @@ let TTSidebar = class TTSidebar extends LitElement {
71
84
  this.expandLabel = "Expand sidebar";
72
85
  this.hasHeader = false;
73
86
  this.hasFooter = false;
87
+ /*
88
+ True while the panel widens from the rail, and only then. See the pin
89
+ in the styles: it holds the content at its final width during the
90
+ slide, and holding it any longer clipped a sidebar with less room
91
+ than its width.
92
+ */
93
+ this.sliding = false;
74
94
  }
75
95
  /** Flips the rail open or shut, and announces it. */
76
96
  toggle() {
@@ -82,6 +102,12 @@ let TTSidebar = class TTSidebar extends LitElement {
82
102
  }));
83
103
  }
84
104
  willUpdate(changed) {
105
+ // Not on the first render: a sidebar that arrives open has nothing
106
+ // to slide from.
107
+ if (changed.has("collapsed") && this.hasUpdated) {
108
+ this.stopSliding?.();
109
+ this.sliding = !this.collapsed;
110
+ }
85
111
  if (changed.has("width")) {
86
112
  this.style.setProperty("--tt-sidebar-width", `${this.width}px`);
87
113
  }
@@ -89,6 +115,24 @@ let TTSidebar = class TTSidebar extends LitElement {
89
115
  this.style.setProperty("--tt-sidebar-rail-width", `${this.railWidth}px`);
90
116
  }
91
117
  }
118
+ updated(changed) {
119
+ /*
120
+ A timer read from the transition's own duration rather than
121
+ transitionend, which never fires for a slide that never starts (a
122
+ width capped the same open and shut, or a tab in the background).
123
+ Reduced motion makes the duration 1ms, so the pin goes at once.
124
+ */
125
+ if (changed.has("collapsed") && this.sliding) {
126
+ this.stopSliding = afterTransitions([this], () => {
127
+ this.sliding = false;
128
+ });
129
+ }
130
+ }
131
+ disconnectedCallback() {
132
+ this.stopSliding?.();
133
+ this.sliding = false;
134
+ super.disconnectedCallback();
135
+ }
92
136
  updateSlot(prop, event) {
93
137
  const slot = event.target;
94
138
  this[prop] = slot
@@ -112,6 +156,13 @@ let TTSidebar = class TTSidebar extends LitElement {
112
156
  box-sizing: border-box;
113
157
  overflow: hidden;
114
158
 
159
+ /* The width it was given is the width it wants. In a row a flex
160
+ item shrinks by default, and overflow: hidden lets it shrink to
161
+ a sliver with every label cut to an ellipsis, so the content
162
+ beside it gives way instead. max-width still keeps it inside a
163
+ column narrower than it. */
164
+ flex-shrink: 0;
165
+
115
166
  font-family: var(--tt-font-sans);
116
167
  -webkit-font-smoothing: antialiased;
117
168
 
@@ -123,6 +174,47 @@ let TTSidebar = class TTSidebar extends LitElement {
123
174
  transition: width var(--tt-duration-normal) var(--tt-ease-out);
124
175
  }
125
176
 
177
+ /* ---- sticky ----
178
+
179
+ One screen tall and pinned to the top of it. The screen is 100dvh,
180
+ the height that follows a phone's address bar as it comes and
181
+ goes, unless --tt-viewport-height says otherwise: a builder canvas
182
+ draws a screen smaller than its own window, and sets it to that.
183
+
184
+ align-self keeps a row from stretching it to the row's height,
185
+ which is the page's height, so it cannot grow past the screen.
186
+ Not in tt-layout's sidebar slot: the layout pins its own column,
187
+ and a second pin inside it would be taller than the column.
188
+
189
+ Not on a phone either. There a sidebar that is shown at all sits
190
+ above the page, and a screen-tall pinned block above the page
191
+ covers the page. A phone is a window under 768px, or a box under
192
+ 768px around it (a container query, so a builder canvas drawing
193
+ a phone in a wide window gets it right too). */
194
+
195
+ :host([sticky]:not([slot="sidebar"])) {
196
+ position: sticky;
197
+ top: 0;
198
+ align-self: flex-start;
199
+ height: var(--tt-viewport-height, 100dvh);
200
+ }
201
+
202
+ @media (width < 768px) {
203
+ :host([sticky]:not([slot="sidebar"])) {
204
+ position: static;
205
+ align-self: auto;
206
+ height: 100%;
207
+ }
208
+ }
209
+
210
+ @container (width < 768px) {
211
+ :host([sticky]:not([slot="sidebar"])) {
212
+ position: static;
213
+ align-self: auto;
214
+ height: 100%;
215
+ }
216
+ }
217
+
126
218
  /* ---- the collapsed channel ----
127
219
 
128
220
  See the note at the top of this file. Values here, fallbacks in the
@@ -181,18 +273,27 @@ let TTSidebar = class TTSidebar extends LitElement {
181
273
  has to ellipsis its way in: D..., Dash..., Dashboa..., Dashboard.
182
274
  Same chewing as before, just at full opacity.
183
275
 
184
- So while a collapsible sidebar is open, the content is pinned to the
185
- width it will end at, and the host's overflow:hidden clips it. The
186
- text is laid out ONCE, at its real size, and the panel slides off it
187
- rather than squeezing it.
276
+ So while a collapsible sidebar slides open, the content is pinned to
277
+ the width it will end at, and the host's overflow:hidden clips it.
278
+ The text is laid out ONCE, at its real size, and the panel slides
279
+ off it rather than squeezing it.
188
280
 
189
- Only on a collapsible sidebar, and only while it is open, so a
190
- sidebar in a container narrower than its own width is unaffected.
281
+ Only DURING the slide (.sliding, set by willUpdate and cleared when
282
+ the transition has run). It used to stay for as long as the sidebar
283
+ was open, and wherever the sidebar had less room than its width (a
284
+ narrow column, a phone, the floating inset) the right-hand side of
285
+ every row and the collapse arrow were clipped for good.
191
286
  */
192
- :host([collapsible]:not([collapsed])) nav {
287
+ :host([collapsible]:not([collapsed])) nav.sliding {
193
288
  min-width: var(--tt-sidebar-width, 240px);
194
289
  }
195
290
 
291
+ /* The floating panel is inset on both sides, so its final width is
292
+ the sidebar's less the two margins. */
293
+ :host([collapsible]:not([collapsed])) nav.floating.sliding {
294
+ min-width: calc(var(--tt-sidebar-width, 240px) - var(--tt-space-4));
295
+ }
296
+
196
297
  /* A rail is mostly padding if it keeps the full gutter, and the icons
197
298
  stop looking centred. */
198
299
  :host([collapsed]) nav {
@@ -259,7 +360,6 @@ let TTSidebar = class TTSidebar extends LitElement {
259
360
  scrollbar-color: transparent transparent;
260
361
  }
261
362
 
262
- :host(:hover) .content,
263
363
  .content:focus-within {
264
364
  scrollbar-color: color-mix(
265
365
  in oklab,
@@ -269,6 +369,18 @@ let TTSidebar = class TTSidebar extends LitElement {
269
369
  transparent;
270
370
  }
271
371
 
372
+ /* Hover only where there is a pointer to hover with. */
373
+ @media (hover: hover) {
374
+ :host(:hover) .content {
375
+ scrollbar-color: color-mix(
376
+ in oklab,
377
+ var(--tt-sidebar-foreground) 25%,
378
+ transparent
379
+ )
380
+ transparent;
381
+ }
382
+ }
383
+
272
384
  .content::-webkit-scrollbar {
273
385
  width: 6px;
274
386
  }
@@ -280,7 +392,6 @@ let TTSidebar = class TTSidebar extends LitElement {
280
392
  transition: background var(--tt-duration-fast) var(--tt-ease-out);
281
393
  }
282
394
 
283
- :host(:hover) .content::-webkit-scrollbar-thumb,
284
395
  .content:focus-within::-webkit-scrollbar-thumb {
285
396
  background: color-mix(
286
397
  in oklab,
@@ -289,6 +400,16 @@ let TTSidebar = class TTSidebar extends LitElement {
289
400
  );
290
401
  }
291
402
 
403
+ @media (hover: hover) {
404
+ :host(:hover) .content::-webkit-scrollbar-thumb {
405
+ background: color-mix(
406
+ in oklab,
407
+ var(--tt-sidebar-foreground) 22%,
408
+ transparent
409
+ );
410
+ }
411
+ }
412
+
292
413
  .content::-webkit-scrollbar-track {
293
414
  background: transparent;
294
415
  }
@@ -351,22 +472,33 @@ let TTSidebar = class TTSidebar extends LitElement {
351
472
  Collapsed is unconditional: once the labels are gone this button is
352
473
  the only route back, so hiding it would be a trap.
353
474
  */
354
- :host(:hover) .rail,
355
475
  :host(:focus-within) .rail,
356
476
  :host([collapsed]) .rail {
357
477
  opacity: 1;
358
478
  }
359
479
 
480
+ @media (hover: hover) {
481
+ :host(:hover) .rail {
482
+ opacity: 1;
483
+ }
484
+ }
485
+
360
486
  @media (hover: none) {
361
487
  .rail {
362
488
  opacity: 1;
363
489
  }
364
490
  }
365
491
 
366
- .rail:hover {
367
- border-color: var(--tt-sidebar-border);
368
- background: var(--tt-sidebar-accent);
369
- color: var(--tt-sidebar-accent-foreground);
492
+ /* Only where there is a real pointer. A tap on a touch screen leaves
493
+ :hover on whatever was tapped until the next tap elsewhere, so the
494
+ arrow kept its filled circle after it was pressed and looked stuck
495
+ down. */
496
+ @media (hover: hover) {
497
+ .rail:hover {
498
+ border-color: var(--tt-sidebar-border);
499
+ background: var(--tt-sidebar-accent);
500
+ color: var(--tt-sidebar-accent-foreground);
501
+ }
370
502
  }
371
503
 
372
504
  .rail:focus-visible {
@@ -393,18 +525,39 @@ let TTSidebar = class TTSidebar extends LitElement {
393
525
  display: none;
394
526
  }
395
527
 
396
- /* ---- mobile ----
397
-
398
- On a phone this element is not a column beside the page, it is a
399
- drawer sliding over it (see tt-layout). A rail there would be a
400
- 64px strip covering the screen with no labels, so the whole
401
- collapsed state is switched off and the drawer is always full
402
- width. This works only because the channel above is declared in a
403
- stylesheet: an inline style written from JavaScript could not be
404
- overridden here. */
528
+ /* ---- in tt-layout's drawer ----
529
+
530
+ tt-layout shows its sidebar slot as a drawer sliding over the page
531
+ at 768px and below. A rail there would be a 64px strip covering the
532
+ screen with no labels, so in that drawer the whole collapsed state
533
+ is switched off and the drawer is always full width. This works
534
+ only because the channel above is declared in a stylesheet: an
535
+ inline style written from JavaScript could not be overridden here.
536
+ The breakpoint is tt-layout's own (below 768px of its width).
537
+
538
+ Only in that slot. This block used to apply to every window up to
539
+ 768px, as if every sidebar were a drawer there, and anywhere else
540
+ (a column beside the content, the component builder, a generated
541
+ page) a phone lost the arrow and the rail, which is where a rail
542
+ saves the most room.
543
+
544
+ A container query, not a media query, and the container is
545
+ tt-layout itself: the drawer is the LAYOUT's decision, made on its
546
+ own width, so the sidebar has to ask the same question or the two
547
+ disagree. They did, inside the component builder, where a phone is
548
+ drawn in a window as wide as a desktop's. Below 768px, so a 768px
549
+ tablet keeps the column. */
550
+
551
+ @container (width < 768px) {
552
+ /* Nothing to animate in a drawer, and Firefox styles a new layout
553
+ once without the container query and once with it, then slid
554
+ the width from the rail's to the drawer's as the page loaded. */
555
+ :host([slot="sidebar"]),
556
+ :host([slot="sidebar"]) nav {
557
+ transition: none;
558
+ }
405
559
 
406
- @media (max-width: 768px) {
407
- :host([collapsed]) {
560
+ :host([slot="sidebar"][collapsed]) {
408
561
  width: var(--tt-sidebar-width, 240px);
409
562
 
410
563
  --tt-menu-label-cols: 1fr;
@@ -423,28 +576,20 @@ let TTSidebar = class TTSidebar extends LitElement {
423
576
  --tt-rail-justify: initial;
424
577
  }
425
578
 
426
- /*
427
- The pin above exists to stop the content reflowing DURING a width
428
- animation, and on a phone there is no width animation: the drawer
429
- is always full width. Left in, it would push the content past a
430
- drawer narrower than 240px and clip the right-hand side of every
431
- row.
432
- */
433
- :host([collapsible]:not([collapsed])) nav {
434
- min-width: 0;
435
- }
436
-
437
- :host([collapsed]) nav {
579
+ :host([slot="sidebar"][collapsed]) nav {
438
580
  padding: var(--tt-space-4);
439
581
  }
440
582
 
441
- :host([collapsed]) .rail tt-icon {
442
- transform: none;
583
+ /* No slide to pin for: the drawer is the same width open or shut,
584
+ and the pin would push the rows past a drawer narrower than the
585
+ sidebar's width until the timer ran out. */
586
+ :host([slot="sidebar"][collapsible]:not([collapsed])) nav.sliding {
587
+ min-width: 0;
443
588
  }
444
589
 
445
590
  /* The drawer is already the full width it can be, so there is
446
591
  nothing for this button to do. */
447
- .rail {
592
+ :host([slot="sidebar"]) .rail-row {
448
593
  display: none;
449
594
  }
450
595
  }
@@ -455,6 +600,7 @@ let TTSidebar = class TTSidebar extends LitElement {
455
600
  : this.variant === "floating"
456
601
  ? "floating"
457
602
  : "";
603
+ const classes = [variant, this.sliding ? "sliding" : ""].join(" ").trim();
458
604
  /*
459
605
  The name is the whole control now that the text is gone, so it does
460
606
  double duty: the accessible name AND the tooltip. An arrow with no
@@ -462,7 +608,7 @@ let TTSidebar = class TTSidebar extends LitElement {
462
608
  */
463
609
  const railName = this.collapsed ? this.expandLabel : this.collapseLabel;
464
610
  return html `
465
- <nav class=${variant} aria-label=${this.label}>
611
+ <nav class=${classes} aria-label=${this.label}>
466
612
  <div class="header" ?hidden=${!this.hasHeader}>
467
613
  <slot
468
614
  name="header"
@@ -517,6 +663,9 @@ __decorate([
517
663
  __decorate([
518
664
  property({ type: Boolean, reflect: true })
519
665
  ], TTSidebar.prototype, "collapsed", void 0);
666
+ __decorate([
667
+ property({ type: Boolean, reflect: true })
668
+ ], TTSidebar.prototype, "sticky", void 0);
520
669
  __decorate([
521
670
  property({ type: String })
522
671
  ], TTSidebar.prototype, "label", void 0);
@@ -532,6 +681,9 @@ __decorate([
532
681
  __decorate([
533
682
  state()
534
683
  ], TTSidebar.prototype, "hasFooter", void 0);
684
+ __decorate([
685
+ state()
686
+ ], TTSidebar.prototype, "sliding", void 0);
535
687
  TTSidebar = __decorate([
536
688
  customElement("tt-sidebar")
537
689
  ], TTSidebar);
@@ -1 +1 @@
1
- {"version":3,"file":"tt-sidebar.js","sourceRoot":"","sources":["../../src/sidebar/tt-sidebar.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAErD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,eAAe,CAAC;AAIvB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEI,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,UAAU;IAAlC;;QAEL,YAAO,GAAmB,SAAS,CAAC;QAGpC,UAAK,GAAG,GAAG,CAAC;QAEZ,6CAA6C;QAE7C,cAAS,GAAG,EAAE,CAAC;QAEf,uEAAuE;QAEvE,gBAAW,GAAG,KAAK,CAAC;QAGpB,cAAS,GAAG,KAAK,CAAC;QAElB;;;;UAIE;QAEF,UAAK,GAAG,MAAM,CAAC;QAGf,kBAAa,GAAG,kBAAkB,CAAC;QAGnC,gBAAW,GAAG,gBAAgB,CAAC;QAGvB,cAAS,GAAG,KAAK,CAAC;QAGlB,cAAS,GAAG,KAAK,CAAC;IAgc5B,CAAC;IA9bC,qDAAqD;IACrD,MAAM;QACJ,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC;QAEjC,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,mBAAmB,EAAE;YACnC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI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AAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;4CACrC;AAIf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CACvB;AAGpB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CACzB;AAclB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAC5B;AAQf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wCACZ;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;gDACrB;AAGnC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;8CACvB;AAGvB;IADP,KAAK,EAAE;4CACkB;AAGlB;IADP,KAAK,EAAE;4CACkB;AASlB;IADP,KAAK,EAAE;0CACgB;AA3Db,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAgoBrB"}
@@ -0,0 +1,64 @@
1
+ import type { ReactiveController, ReactiveControllerHost } from "lit";
2
+ export interface TTStrings {
3
+ /** tt-company-card's verified mark. */
4
+ verified: string;
5
+ /** Close buttons: tt-modal, tt-drawer. */
6
+ close: string;
7
+ /** tt-navbar's menu button. */
8
+ openMenu: string;
9
+ closeMenu: string;
10
+ /** tt-pagination's landmark name. */
11
+ pagination: string;
12
+ /** tt-combobox's clear button. */
13
+ clearSelection: string;
14
+ /** tt-combobox and tt-select with several chosen, "3 selected". */
15
+ selectedCount: string;
16
+ /** Removes one chosen value in a multiple tt-combobox. */
17
+ removeValue: string;
18
+ /** tt-file-upload. */
19
+ chosenFiles: string;
20
+ removeFile: string;
21
+ uploading: string;
22
+ uploaded: string;
23
+ uploadFailed: string;
24
+ retry: string;
25
+ /** tt-dropdown-menu's default label, and a data-table row's menu. */
26
+ actions: string;
27
+ actionsFor: string;
28
+ /** tt-contact-list. */
29
+ primaryContact: string;
30
+ whatsapp: string;
31
+ /** tt-inbox, read by screen readers next to an unread message. */
32
+ unread: string;
33
+ /** What tt-form puts on a control that fails a check. */
34
+ required: string;
35
+ requiredCheck: string;
36
+ requiredChoice: string;
37
+ requiredFile: string;
38
+ invalid: string;
39
+ }
40
+ export declare const DEFAULT_STRINGS: Readonly<TTStrings>;
41
+ /** Replaces some of the library's own text, for every component on the page. */
42
+ export declare function setStrings(overrides: Partial<TTStrings>): void;
43
+ /** Back to the English defaults. */
44
+ export declare function resetStrings(): void;
45
+ export declare function getStrings(): Readonly<TTStrings>;
46
+ /** "Remove {name}" with { name: "a.pdf" } gives "Remove a.pdf". */
47
+ export declare function fillIn(text: string, values: Record<string, string | number>): string;
48
+ /** A component that shows library text, and may override it per instance. */
49
+ export interface StringsHost extends ReactiveControllerHost {
50
+ strings?: Partial<TTStrings>;
51
+ }
52
+ /**
53
+ * Gives a component its text: its own `strings` first, then setStrings(),
54
+ * then English. Re-renders the component when setStrings() is called.
55
+ */
56
+ export declare class StringsController implements ReactiveController {
57
+ private host;
58
+ constructor(host: StringsHost);
59
+ private changed;
60
+ hostConnected(): void;
61
+ hostDisconnected(): void;
62
+ get(key: keyof TTStrings, values?: Record<string, string | number>): string;
63
+ }
64
+ //# sourceMappingURL=strings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAkBtE,MAAM,WAAW,SAAS;IACxB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAA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,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;CAC9B;AAED;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,kBAAkB;IAC9C,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,WAAW;IAIrC,OAAO,CAAC,OAAO,CAAmC;IAElD,aAAa;IAIb,gBAAgB;IAIhB,GAAG,CAAC,GAAG,EAAE,MAAM,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM;CAI5E"}
@@ -0,0 +1,68 @@
1
+ export const DEFAULT_STRINGS = Object.freeze({
2
+ verified: "Verified",
3
+ close: "Close",
4
+ openMenu: "Open menu",
5
+ closeMenu: "Close menu",
6
+ pagination: "Pagination",
7
+ clearSelection: "Clear selection",
8
+ selectedCount: "{count} selected",
9
+ removeValue: "Remove {name}",
10
+ chosenFiles: "Chosen files",
11
+ removeFile: "Remove {name}",
12
+ uploading: "Uploading",
13
+ uploaded: "Uploaded",
14
+ uploadFailed: "Upload failed",
15
+ retry: "Retry",
16
+ actions: "Actions",
17
+ actionsFor: "Actions for {name}",
18
+ primaryContact: "Main contact",
19
+ whatsapp: "WhatsApp",
20
+ unread: "Unread",
21
+ required: "Please fill in this field.",
22
+ requiredCheck: "Please tick this box.",
23
+ requiredChoice: "Please choose an option.",
24
+ requiredFile: "Please choose a file.",
25
+ invalid: "Please check this field.",
26
+ });
27
+ let current = { ...DEFAULT_STRINGS };
28
+ // One per connected component that shows library text: told to re-render.
29
+ const listeners = new Set();
30
+ /** Replaces some of the library's own text, for every component on the page. */
31
+ export function setStrings(overrides) {
32
+ current = { ...current, ...overrides };
33
+ for (const listener of listeners)
34
+ listener();
35
+ }
36
+ /** Back to the English defaults. */
37
+ export function resetStrings() {
38
+ setStrings(DEFAULT_STRINGS);
39
+ }
40
+ export function getStrings() {
41
+ return current;
42
+ }
43
+ /** "Remove {name}" with { name: "a.pdf" } gives "Remove a.pdf". */
44
+ export function fillIn(text, values) {
45
+ return text.replace(/\{(\w+)\}/g, (whole, key) => key in values ? String(values[key]) : whole);
46
+ }
47
+ /**
48
+ * Gives a component its text: its own `strings` first, then setStrings(),
49
+ * then English. Re-renders the component when setStrings() is called.
50
+ */
51
+ export class StringsController {
52
+ constructor(host) {
53
+ this.host = host;
54
+ this.changed = () => this.host.requestUpdate();
55
+ host.addController(this);
56
+ }
57
+ hostConnected() {
58
+ listeners.add(this.changed);
59
+ }
60
+ hostDisconnected() {
61
+ listeners.delete(this.changed);
62
+ }
63
+ get(key, values) {
64
+ const text = this.host.strings?.[key] ?? current[key];
65
+ return values ? fillIn(text, values) : text;
66
+ }
67
+ }
68
+ //# sourceMappingURL=strings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strings.js","sourceRoot":"","sources":["../src/strings.ts"],"names":[],"mappings":"AAyDA,MAAM,CAAC,MAAM,eAAe,GAAwB,MAAM,CAAC,MAAM,CAAC;IAChE,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,WAAW;IACrB,SAAS,EAAE,YAAY;IACvB,UAAU,EAAE,YAAY;IACxB,cAAc,EAAE,iBAAiB;IACjC,aAAa,EAAE,kBAAkB;IACjC,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,cAAc;IAC3B,UAAU,EAAE,eAAe;IAC3B,SAAS,EAAE,WAAW;IACtB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,eAAe;IAC7B,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,UAAU,EAAE,oBAAoB;IAChC,cAAc,EAAE,cAAc;IAC9B,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,4BAA4B;IACtC,aAAa,EAAE,uBAAuB;IACtC,cAAc,EAAE,0BAA0B;IAC1C,YAAY,EAAE,uBAAuB;IACrC,OAAO,EAAE,0BAA0B;CACpC,CAAC,CAAC;AAEH,IAAI,OAAO,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AG,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC;QACtD,OAAO,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9C,CAAC;CACF"}
package/dist/tokens.css CHANGED
@@ -169,12 +169,28 @@
169
169
  --tt-sidebar-border: oklch(0.922 0 0);
170
170
  --tt-sidebar-ring: var(--tt-brand);
171
171
 
172
- /* ---- Charts ---- */
173
- --tt-chart-1: oklch(0.87 0 0);
174
- --tt-chart-2: oklch(0.556 0 0);
175
- --tt-chart-3: oklch(0.439 0 0);
176
- --tt-chart-4: oklch(0.371 0 0);
177
- --tt-chart-5: oklch(0.269 0 0);
172
+ /* ---- Charts ----
173
+ The series colours tt-chart draws with, in order (a pie's slices
174
+ too). Colourful by default: five greys, as before, were hard to tell
175
+ apart in a pie, and the lightest one failed 3:1 on a white card.
176
+
177
+ They are the content hues plus amber, so a teal series is the same
178
+ teal as a teal badge. Neighbours are far apart round the colour
179
+ wheel, so a pie's touching slices differ most: blue, amber, purple,
180
+ teal, pink. Every one passes 4.5:1 on the card in both themes (3:1
181
+ is what a chart mark needs), and styles.test.ts recomputes it.
182
+
183
+ Aliases, so they follow their hue into dark mode. .dark declares
184
+ them again, because a var() resolves where it is declared: without
185
+ that, a .dark subtree inside a light page would keep the light ones.
186
+
187
+ To change them for one chart or a subtree, re-point them there. The
188
+ builder's chart Palette does exactly that (styles.ts). */
189
+ --tt-chart-1: var(--tt-blue);
190
+ --tt-chart-2: var(--tt-warning);
191
+ --tt-chart-3: var(--tt-purple);
192
+ --tt-chart-4: var(--tt-teal);
193
+ --tt-chart-5: var(--tt-pink);
178
194
 
179
195
  /* ---- Radius ----
180
196
 
@@ -734,6 +750,14 @@
734
750
  --tt-pink: oklch(0.76 0.13 350);
735
751
  --tt-pink-foreground: oklch(0.145 0 0);
736
752
  --tt-pink-subtle: oklch(0.3 0.045 350);
753
+
754
+ /* The same aliases as on :root, declared again so they resolve to the
755
+ dark hues on any .dark element, not only on <html>. */
756
+ --tt-chart-1: var(--tt-blue);
757
+ --tt-chart-2: var(--tt-warning);
758
+ --tt-chart-3: var(--tt-purple);
759
+ --tt-chart-4: var(--tt-teal);
760
+ --tt-chart-5: var(--tt-pink);
737
761
  }
738
762
 
739
763
  /* =========================================
@@ -1 +1 @@
1
- {"version":3,"file":"tt-alert.d.ts","sourceRoot":"","sources":["../src/tt-alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,cAAc,CAAC;AAEtB,2DAA2D;AAC3D,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEjF;;;;;;;GAOG;AACH,qBACa,OAAQ,SAAQ,UAAU;IAIrC,OAAO,EAAE,YAAY,CAAa;IAEN,OAAO,SAAM;IAEZ,QAAQ,UAAS;IAE9C,OAAO,CAAC,KAAK;IAMb,MAAM,CAAC,MAAM,0BA2FX;IAEF,MAAM;CA6BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
1
+ {"version":3,"file":"tt-alert.d.ts","sourceRoot":"","sources":["../src/tt-alert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,OAAO,cAAc,CAAC;AAEtB,2DAA2D;AAC3D,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEjF;;;;;;;GAOG;AACH,qBACa,OAAQ,SAAQ,UAAU;IAIrC,OAAO,EAAE,YAAY,CAAa;IAEN,OAAO,SAAM;IAEZ,QAAQ,UAAS;IAE9C,OAAO,CAAC,KAAK;IAMb,MAAM,CAAC,MAAM,0BA8FX;IAEF,MAAM;CA6BP;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,OAAO,CAAC;KACrB;CACF"}
package/dist/tt-alert.js CHANGED
@@ -110,8 +110,11 @@ let TTAlert = class TTAlert extends LitElement {
110
110
  border-radius: var(--tt-radius-sm);
111
111
  }
112
112
 
113
- .close:hover {
114
- color: var(--tt-foreground);
113
+ /* Only where a pointer can hover: a tap would leave this on. */
114
+ @media (hover: hover) {
115
+ .close:hover {
116
+ color: var(--tt-foreground);
117
+ }
115
118
  }
116
119
 
117
120
  .close:focus-visible {
@@ -1 +1 @@
1
- {"version":3,"file":"tt-alert.js","sourceRoot":"","sources":["../src/tt-alert.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,cAAc,CAAC;AAKtB;;;;;;;GAOG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QACL,mEAAmE;QACnE,mEAAmE;QAEnE,YAAO,GAAiB,SAAS,CAAC;QAEN,YAAO,GAAG,EAAE,CAAC;QAEZ,aAAQ,GAAG,KAAK,CAAC;IAkIhD,CAAC;IAhIS,KAAK;QACX,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAC/D,CAAC;IACJ,CAAC;aAEM,WAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2FlB,AA3FY,CA2FX;IAEF,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;eAQA,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,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