@tanrei/web 0.0.0-stage → 0.1.0-next.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 (781) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +58 -0
  3. package/README.md +9743 -2
  4. package/custom-elements.json +86072 -0
  5. package/dist/THIRD_PARTY_LICENSES.md +136 -0
  6. package/dist/accordion.css +812 -0
  7. package/dist/app-shell.css +493 -0
  8. package/dist/avatar.css +80 -0
  9. package/dist/breadcrumbs.css +511 -0
  10. package/dist/callout.css +65 -0
  11. package/dist/code.css +595 -0
  12. package/dist/components/accordion/accordion.d.ts +197 -0
  13. package/dist/components/accordion/accordion.js +763 -0
  14. package/dist/components/accordion/accordion.js.map +1 -0
  15. package/dist/components/app-bar/app-bar.d.ts +107 -0
  16. package/dist/components/app-bar/app-bar.js +295 -0
  17. package/dist/components/app-bar/app-bar.js.map +1 -0
  18. package/dist/components/app-bar/app-bar.styles.d.ts +12 -0
  19. package/dist/components/app-bar/app-bar.styles.js +223 -0
  20. package/dist/components/app-bar/app-bar.styles.js.map +1 -0
  21. package/dist/components/app-shell/app-shell.d.ts +220 -0
  22. package/dist/components/app-shell/app-shell.js +677 -0
  23. package/dist/components/app-shell/app-shell.js.map +1 -0
  24. package/dist/components/avatar/avatar.d.ts +162 -0
  25. package/dist/components/avatar/avatar.js +390 -0
  26. package/dist/components/avatar/avatar.js.map +1 -0
  27. package/dist/components/avatar/avatar.styles.d.ts +9 -0
  28. package/dist/components/avatar/avatar.styles.js +258 -0
  29. package/dist/components/avatar/avatar.styles.js.map +1 -0
  30. package/dist/components/badge/badge.d.ts +59 -0
  31. package/dist/components/badge/badge.js +176 -0
  32. package/dist/components/badge/badge.js.map +1 -0
  33. package/dist/components/badge/badge.styles.d.ts +1 -0
  34. package/dist/components/badge/badge.styles.js +106 -0
  35. package/dist/components/badge/badge.styles.js.map +1 -0
  36. package/dist/components/bottom-sheet/bottom-sheet.d.ts +207 -0
  37. package/dist/components/bottom-sheet/bottom-sheet.js +724 -0
  38. package/dist/components/bottom-sheet/bottom-sheet.js.map +1 -0
  39. package/dist/components/bottom-sheet/bottom-sheet.styles.d.ts +1 -0
  40. package/dist/components/bottom-sheet/bottom-sheet.styles.js +393 -0
  41. package/dist/components/bottom-sheet/bottom-sheet.styles.js.map +1 -0
  42. package/dist/components/breadcrumbs/breadcrumbs.d.ts +176 -0
  43. package/dist/components/breadcrumbs/breadcrumbs.js +638 -0
  44. package/dist/components/breadcrumbs/breadcrumbs.js.map +1 -0
  45. package/dist/components/breadcrumbs/breadcrumbs.styles.d.ts +1 -0
  46. package/dist/components/breadcrumbs/breadcrumbs.styles.js +225 -0
  47. package/dist/components/breadcrumbs/breadcrumbs.styles.js.map +1 -0
  48. package/dist/components/button/button.d.ts +280 -0
  49. package/dist/components/button/button.js +530 -0
  50. package/dist/components/button/button.js.map +1 -0
  51. package/dist/components/button/button.styles.d.ts +20 -0
  52. package/dist/components/button/button.styles.js +328 -0
  53. package/dist/components/button/button.styles.js.map +1 -0
  54. package/dist/components/button-group/button-group.d.ts +124 -0
  55. package/dist/components/button-group/button-group.js +287 -0
  56. package/dist/components/button-group/button-group.js.map +1 -0
  57. package/dist/components/button-group/button-group.styles.d.ts +1 -0
  58. package/dist/components/button-group/button-group.styles.js +220 -0
  59. package/dist/components/button-group/button-group.styles.js.map +1 -0
  60. package/dist/components/button-with-menu/button-with-menu.d.ts +224 -0
  61. package/dist/components/button-with-menu/button-with-menu.js +635 -0
  62. package/dist/components/button-with-menu/button-with-menu.js.map +1 -0
  63. package/dist/components/button-with-menu/button-with-menu.styles.d.ts +15 -0
  64. package/dist/components/button-with-menu/button-with-menu.styles.js +418 -0
  65. package/dist/components/button-with-menu/button-with-menu.styles.js.map +1 -0
  66. package/dist/components/calendar/calendar.d.ts +380 -0
  67. package/dist/components/calendar/calendar.js +1619 -0
  68. package/dist/components/calendar/calendar.js.map +1 -0
  69. package/dist/components/calendar/calendar.styles.d.ts +11 -0
  70. package/dist/components/calendar/calendar.styles.js +412 -0
  71. package/dist/components/calendar/calendar.styles.js.map +1 -0
  72. package/dist/components/callout/callout.d.ts +157 -0
  73. package/dist/components/callout/callout.js +436 -0
  74. package/dist/components/callout/callout.js.map +1 -0
  75. package/dist/components/callout/callout.styles.d.ts +13 -0
  76. package/dist/components/callout/callout.styles.js +383 -0
  77. package/dist/components/callout/callout.styles.js.map +1 -0
  78. package/dist/components/card/card.d.ts +108 -0
  79. package/dist/components/card/card.js +235 -0
  80. package/dist/components/card/card.js.map +1 -0
  81. package/dist/components/card/card.styles.d.ts +9 -0
  82. package/dist/components/card/card.styles.js +170 -0
  83. package/dist/components/card/card.styles.js.map +1 -0
  84. package/dist/components/carousel/carousel-geometry.d.ts +178 -0
  85. package/dist/components/carousel/carousel-geometry.js +356 -0
  86. package/dist/components/carousel/carousel-geometry.js.map +1 -0
  87. package/dist/components/carousel/carousel.d.ts +401 -0
  88. package/dist/components/carousel/carousel.js +1352 -0
  89. package/dist/components/carousel/carousel.js.map +1 -0
  90. package/dist/components/carousel/carousel.styles.d.ts +4 -0
  91. package/dist/components/carousel/carousel.styles.js +475 -0
  92. package/dist/components/carousel/carousel.styles.js.map +1 -0
  93. package/dist/components/chat-composer/chat-composer.d.ts +482 -0
  94. package/dist/components/chat-composer/chat-composer.js +1374 -0
  95. package/dist/components/chat-composer/chat-composer.js.map +1 -0
  96. package/dist/components/chat-composer/chat-composer.styles.d.ts +9 -0
  97. package/dist/components/chat-composer/chat-composer.styles.js +308 -0
  98. package/dist/components/chat-composer/chat-composer.styles.js.map +1 -0
  99. package/dist/components/checkbox/checkbox.d.ts +135 -0
  100. package/dist/components/checkbox/checkbox.js +296 -0
  101. package/dist/components/checkbox/checkbox.js.map +1 -0
  102. package/dist/components/checkbox/checkbox.styles.d.ts +13 -0
  103. package/dist/components/checkbox/checkbox.styles.js +226 -0
  104. package/dist/components/checkbox/checkbox.styles.js.map +1 -0
  105. package/dist/components/checkbox-group/checkbox-group.d.ts +199 -0
  106. package/dist/components/checkbox-group/checkbox-group.js +500 -0
  107. package/dist/components/checkbox-group/checkbox-group.js.map +1 -0
  108. package/dist/components/chip/chip.d.ts +176 -0
  109. package/dist/components/chip/chip.js +376 -0
  110. package/dist/components/chip/chip.js.map +1 -0
  111. package/dist/components/chip/chip.styles.d.ts +10 -0
  112. package/dist/components/chip/chip.styles.js +465 -0
  113. package/dist/components/chip/chip.styles.js.map +1 -0
  114. package/dist/components/chip-field/chip-field.d.ts +315 -0
  115. package/dist/components/chip-field/chip-field.js +887 -0
  116. package/dist/components/chip-field/chip-field.js.map +1 -0
  117. package/dist/components/code-block/code-block.before.d.ts +2 -0
  118. package/dist/components/code-block/code-block.before.js +193 -0
  119. package/dist/components/code-block/code-block.before.js.map +1 -0
  120. package/dist/components/code-block/code-block.d.ts +268 -0
  121. package/dist/components/code-block/code-block.js +1009 -0
  122. package/dist/components/code-block/code-block.js.map +1 -0
  123. package/dist/components/code-block/code-block.light.d.ts +50 -0
  124. package/dist/components/code-block/code-block.light.js +287 -0
  125. package/dist/components/code-block/code-block.light.js.map +1 -0
  126. package/dist/components/code-block/code-block.lines.d.ts +49 -0
  127. package/dist/components/code-block/code-block.lines.js +75 -0
  128. package/dist/components/code-block/code-block.lines.js.map +1 -0
  129. package/dist/components/code-block/code-block.styles.d.ts +8 -0
  130. package/dist/components/code-block/code-block.styles.js +212 -0
  131. package/dist/components/code-block/code-block.styles.js.map +1 -0
  132. package/dist/components/color-field/color-field.d.ts +120 -0
  133. package/dist/components/color-field/color-field.js +182 -0
  134. package/dist/components/color-field/color-field.js.map +1 -0
  135. package/dist/components/color-input/color-input.d.ts +302 -0
  136. package/dist/components/color-input/color-input.js +748 -0
  137. package/dist/components/color-input/color-input.js.map +1 -0
  138. package/dist/components/color-input/color-input.styles.d.ts +22 -0
  139. package/dist/components/color-input/color-input.styles.js +373 -0
  140. package/dist/components/color-input/color-input.styles.js.map +1 -0
  141. package/dist/components/color-input/color-text.d.ts +48 -0
  142. package/dist/components/color-input/color-text.js +77 -0
  143. package/dist/components/color-input/color-text.js.map +1 -0
  144. package/dist/components/combobox/combobox.d.ts +387 -0
  145. package/dist/components/combobox/combobox.js +1108 -0
  146. package/dist/components/combobox/combobox.js.map +1 -0
  147. package/dist/components/combobox/combobox.styles.d.ts +26 -0
  148. package/dist/components/combobox/combobox.styles.js +497 -0
  149. package/dist/components/combobox/combobox.styles.js.map +1 -0
  150. package/dist/components/combobox-field/combobox-field.d.ts +159 -0
  151. package/dist/components/combobox-field/combobox-field.js +280 -0
  152. package/dist/components/combobox-field/combobox-field.js.map +1 -0
  153. package/dist/components/copy-button/copy-button.d.ts +112 -0
  154. package/dist/components/copy-button/copy-button.js +237 -0
  155. package/dist/components/copy-button/copy-button.js.map +1 -0
  156. package/dist/components/copy-button/copy-button.styles.d.ts +1 -0
  157. package/dist/components/copy-button/copy-button.styles.js +62 -0
  158. package/dist/components/copy-button/copy-button.styles.js.map +1 -0
  159. package/dist/components/date-time-picker/date-time-picker.d.ts +603 -0
  160. package/dist/components/date-time-picker/date-time-picker.js +2537 -0
  161. package/dist/components/date-time-picker/date-time-picker.js.map +1 -0
  162. package/dist/components/date-time-picker/date-time-picker.styles.d.ts +1 -0
  163. package/dist/components/date-time-picker/date-time-picker.styles.js +842 -0
  164. package/dist/components/date-time-picker/date-time-picker.styles.js.map +1 -0
  165. package/dist/components/description-list/description-list.d.ts +133 -0
  166. package/dist/components/description-list/description-list.js +395 -0
  167. package/dist/components/description-list/description-list.js.map +1 -0
  168. package/dist/components/dialog/dialog.d.ts +140 -0
  169. package/dist/components/dialog/dialog.js +440 -0
  170. package/dist/components/dialog/dialog.js.map +1 -0
  171. package/dist/components/dialog/dialog.styles.d.ts +1 -0
  172. package/dist/components/dialog/dialog.styles.js +306 -0
  173. package/dist/components/dialog/dialog.styles.js.map +1 -0
  174. package/dist/components/divider/divider.d.ts +112 -0
  175. package/dist/components/divider/divider.js +331 -0
  176. package/dist/components/divider/divider.js.map +1 -0
  177. package/dist/components/divider/divider.styles.d.ts +6 -0
  178. package/dist/components/divider/divider.styles.js +183 -0
  179. package/dist/components/divider/divider.styles.js.map +1 -0
  180. package/dist/components/embedded-text-input/embedded-text-input.d.ts +246 -0
  181. package/dist/components/embedded-text-input/embedded-text-input.js +673 -0
  182. package/dist/components/embedded-text-input/embedded-text-input.js.map +1 -0
  183. package/dist/components/embedded-text-input/embedded-text-input.styles.d.ts +1 -0
  184. package/dist/components/embedded-text-input/embedded-text-input.styles.js +204 -0
  185. package/dist/components/embedded-text-input/embedded-text-input.styles.js.map +1 -0
  186. package/dist/components/empty-state/empty-state.d.ts +132 -0
  187. package/dist/components/empty-state/empty-state.js +333 -0
  188. package/dist/components/empty-state/empty-state.js.map +1 -0
  189. package/dist/components/empty-state/empty-state.styles.d.ts +11 -0
  190. package/dist/components/empty-state/empty-state.styles.js +218 -0
  191. package/dist/components/empty-state/empty-state.styles.js.map +1 -0
  192. package/dist/components/fab-menu/fab-menu.d.ts +240 -0
  193. package/dist/components/fab-menu/fab-menu.js +605 -0
  194. package/dist/components/fab-menu/fab-menu.js.map +1 -0
  195. package/dist/components/fab-menu/fab-menu.styles.d.ts +21 -0
  196. package/dist/components/fab-menu/fab-menu.styles.js +427 -0
  197. package/dist/components/fab-menu/fab-menu.styles.js.map +1 -0
  198. package/dist/components/field/field.d.ts +165 -0
  199. package/dist/components/field/field.js +399 -0
  200. package/dist/components/field/field.js.map +1 -0
  201. package/dist/components/field/field.styles.d.ts +2 -0
  202. package/dist/components/field/field.styles.js +177 -0
  203. package/dist/components/field/field.styles.js.map +1 -0
  204. package/dist/components/field-group/field-group.d.ts +122 -0
  205. package/dist/components/field-group/field-group.js +246 -0
  206. package/dist/components/field-group/field-group.js.map +1 -0
  207. package/dist/components/field-group/field-group.styles.d.ts +7 -0
  208. package/dist/components/field-group/field-group.styles.js +28 -0
  209. package/dist/components/field-group/field-group.styles.js.map +1 -0
  210. package/dist/components/figure/figure.d.ts +152 -0
  211. package/dist/components/figure/figure.js +435 -0
  212. package/dist/components/figure/figure.js.map +1 -0
  213. package/dist/components/file-item/file-item.d.ts +232 -0
  214. package/dist/components/file-item/file-item.js +665 -0
  215. package/dist/components/file-item/file-item.js.map +1 -0
  216. package/dist/components/file-item/file-item.styles.d.ts +2 -0
  217. package/dist/components/file-item/file-item.styles.js +582 -0
  218. package/dist/components/file-item/file-item.styles.js.map +1 -0
  219. package/dist/components/file-picker/file-picker.d.ts +221 -0
  220. package/dist/components/file-picker/file-picker.js +588 -0
  221. package/dist/components/file-picker/file-picker.js.map +1 -0
  222. package/dist/components/file-picker/file-picker.styles.d.ts +2 -0
  223. package/dist/components/file-picker/file-picker.styles.js +303 -0
  224. package/dist/components/file-picker/file-picker.styles.js.map +1 -0
  225. package/dist/components/file-upload/file-upload.d.ts +353 -0
  226. package/dist/components/file-upload/file-upload.js +939 -0
  227. package/dist/components/file-upload/file-upload.js.map +1 -0
  228. package/dist/components/file-upload/file-upload.styles.d.ts +1 -0
  229. package/dist/components/file-upload/file-upload.styles.js +91 -0
  230. package/dist/components/file-upload/file-upload.styles.js.map +1 -0
  231. package/dist/components/image-preview/image-preview.d.ts +336 -0
  232. package/dist/components/image-preview/image-preview.js +1510 -0
  233. package/dist/components/image-preview/image-preview.js.map +1 -0
  234. package/dist/components/image-preview/image-preview.styles.d.ts +1 -0
  235. package/dist/components/image-preview/image-preview.styles.js +418 -0
  236. package/dist/components/image-preview/image-preview.styles.js.map +1 -0
  237. package/dist/components/keyboard-shortcut/keyboard-shortcut.d.ts +94 -0
  238. package/dist/components/keyboard-shortcut/keyboard-shortcut.js +285 -0
  239. package/dist/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -0
  240. package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.d.ts +11 -0
  241. package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.js +155 -0
  242. package/dist/components/keyboard-shortcut/keyboard-shortcut.styles.js.map +1 -0
  243. package/dist/components/link-card/link-card.d.ts +156 -0
  244. package/dist/components/link-card/link-card.js +713 -0
  245. package/dist/components/link-card/link-card.js.map +1 -0
  246. package/dist/components/list/list.d.ts +430 -0
  247. package/dist/components/list/list.js +1230 -0
  248. package/dist/components/list/list.js.map +1 -0
  249. package/dist/components/list/list.styles.d.ts +3 -0
  250. package/dist/components/list/list.styles.js +334 -0
  251. package/dist/components/list/list.styles.js.map +1 -0
  252. package/dist/components/loading-indicator/loading-indicator.d.ts +83 -0
  253. package/dist/components/loading-indicator/loading-indicator.js +195 -0
  254. package/dist/components/loading-indicator/loading-indicator.js.map +1 -0
  255. package/dist/components/loading-indicator/loading-indicator.styles.d.ts +6 -0
  256. package/dist/components/loading-indicator/loading-indicator.styles.js +124 -0
  257. package/dist/components/loading-indicator/loading-indicator.styles.js.map +1 -0
  258. package/dist/components/main-action-button/main-action-button.d.ts +95 -0
  259. package/dist/components/main-action-button/main-action-button.js +202 -0
  260. package/dist/components/main-action-button/main-action-button.js.map +1 -0
  261. package/dist/components/main-action-button/main-action-button.styles.d.ts +10 -0
  262. package/dist/components/main-action-button/main-action-button.styles.js +285 -0
  263. package/dist/components/main-action-button/main-action-button.styles.js.map +1 -0
  264. package/dist/components/menu/menu.d.ts +813 -0
  265. package/dist/components/menu/menu.js +2061 -0
  266. package/dist/components/menu/menu.js.map +1 -0
  267. package/dist/components/menu/menu.styles.d.ts +18 -0
  268. package/dist/components/menu/menu.styles.js +587 -0
  269. package/dist/components/menu/menu.styles.js.map +1 -0
  270. package/dist/components/menubar/menubar.d.ts +477 -0
  271. package/dist/components/menubar/menubar.js +1677 -0
  272. package/dist/components/menubar/menubar.js.map +1 -0
  273. package/dist/components/menubar/menubar.styles.d.ts +43 -0
  274. package/dist/components/menubar/menubar.styles.js +379 -0
  275. package/dist/components/menubar/menubar.styles.js.map +1 -0
  276. package/dist/components/navigation-bar/navigation-bar.d.ts +239 -0
  277. package/dist/components/navigation-bar/navigation-bar.js +544 -0
  278. package/dist/components/navigation-bar/navigation-bar.js.map +1 -0
  279. package/dist/components/navigation-bar/navigation-bar.styles.d.ts +21 -0
  280. package/dist/components/navigation-bar/navigation-bar.styles.js +320 -0
  281. package/dist/components/navigation-bar/navigation-bar.styles.js.map +1 -0
  282. package/dist/components/navigation-drawer/navigation-drawer.d.ts +627 -0
  283. package/dist/components/navigation-drawer/navigation-drawer.js +1917 -0
  284. package/dist/components/navigation-drawer/navigation-drawer.js.map +1 -0
  285. package/dist/components/navigation-drawer/navigation-drawer.styles.d.ts +40 -0
  286. package/dist/components/navigation-drawer/navigation-drawer.styles.js +934 -0
  287. package/dist/components/navigation-drawer/navigation-drawer.styles.js.map +1 -0
  288. package/dist/components/number-field/number-field.d.ts +147 -0
  289. package/dist/components/number-field/number-field.js +252 -0
  290. package/dist/components/number-field/number-field.js.map +1 -0
  291. package/dist/components/number-input/number-input.d.ts +347 -0
  292. package/dist/components/number-input/number-input.js +929 -0
  293. package/dist/components/number-input/number-input.js.map +1 -0
  294. package/dist/components/number-input/number-input.styles.d.ts +22 -0
  295. package/dist/components/number-input/number-input.styles.js +395 -0
  296. package/dist/components/number-input/number-input.styles.js.map +1 -0
  297. package/dist/components/number-input/number-text.d.ts +74 -0
  298. package/dist/components/number-input/number-text.js +230 -0
  299. package/dist/components/number-input/number-text.js.map +1 -0
  300. package/dist/components/one-time-code-field/one-time-code-field.d.ts +94 -0
  301. package/dist/components/one-time-code-field/one-time-code-field.js +135 -0
  302. package/dist/components/one-time-code-field/one-time-code-field.js.map +1 -0
  303. package/dist/components/one-time-code-input/code-text.d.ts +51 -0
  304. package/dist/components/one-time-code-input/code-text.js +145 -0
  305. package/dist/components/one-time-code-input/code-text.js.map +1 -0
  306. package/dist/components/one-time-code-input/one-time-code-input.d.ts +219 -0
  307. package/dist/components/one-time-code-input/one-time-code-input.js +710 -0
  308. package/dist/components/one-time-code-input/one-time-code-input.js.map +1 -0
  309. package/dist/components/one-time-code-input/one-time-code-input.styles.d.ts +8 -0
  310. package/dist/components/one-time-code-input/one-time-code-input.styles.js +323 -0
  311. package/dist/components/one-time-code-input/one-time-code-input.styles.js.map +1 -0
  312. package/dist/components/option/option.d.ts +51 -0
  313. package/dist/components/option/option.js +75 -0
  314. package/dist/components/option/option.js.map +1 -0
  315. package/dist/components/page-header/page-header.d.ts +97 -0
  316. package/dist/components/page-header/page-header.js +258 -0
  317. package/dist/components/page-header/page-header.js.map +1 -0
  318. package/dist/components/popover/popover.d.ts +217 -0
  319. package/dist/components/popover/popover.js +616 -0
  320. package/dist/components/popover/popover.js.map +1 -0
  321. package/dist/components/popover/popover.styles.d.ts +8 -0
  322. package/dist/components/popover/popover.styles.js +299 -0
  323. package/dist/components/popover/popover.styles.js.map +1 -0
  324. package/dist/components/progress-indicator/progress-indicator.d.ts +76 -0
  325. package/dist/components/progress-indicator/progress-indicator.js +165 -0
  326. package/dist/components/progress-indicator/progress-indicator.js.map +1 -0
  327. package/dist/components/progress-indicator/progress-indicator.styles.d.ts +7 -0
  328. package/dist/components/progress-indicator/progress-indicator.styles.js +271 -0
  329. package/dist/components/progress-indicator/progress-indicator.styles.js.map +1 -0
  330. package/dist/components/radio-button/radio-button.d.ts +149 -0
  331. package/dist/components/radio-button/radio-button.js +370 -0
  332. package/dist/components/radio-button/radio-button.js.map +1 -0
  333. package/dist/components/radio-button/radio-button.styles.d.ts +8 -0
  334. package/dist/components/radio-button/radio-button.styles.js +190 -0
  335. package/dist/components/radio-button/radio-button.styles.js.map +1 -0
  336. package/dist/components/radio-group/radio-group.d.ts +188 -0
  337. package/dist/components/radio-group/radio-group.js +380 -0
  338. package/dist/components/radio-group/radio-group.js.map +1 -0
  339. package/dist/components/search/search.d.ts +569 -0
  340. package/dist/components/search/search.js +1801 -0
  341. package/dist/components/search/search.js.map +1 -0
  342. package/dist/components/search/search.styles.d.ts +15 -0
  343. package/dist/components/search/search.styles.js +967 -0
  344. package/dist/components/search/search.styles.js.map +1 -0
  345. package/dist/components/segmented-button/segmented-button.d.ts +183 -0
  346. package/dist/components/segmented-button/segmented-button.js +483 -0
  347. package/dist/components/segmented-button/segmented-button.js.map +1 -0
  348. package/dist/components/segmented-button/segmented-button.styles.d.ts +19 -0
  349. package/dist/components/segmented-button/segmented-button.styles.js +400 -0
  350. package/dist/components/segmented-button/segmented-button.styles.js.map +1 -0
  351. package/dist/components/select/select.d.ts +259 -0
  352. package/dist/components/select/select.js +702 -0
  353. package/dist/components/select/select.js.map +1 -0
  354. package/dist/components/select/select.styles.d.ts +27 -0
  355. package/dist/components/select/select.styles.js +359 -0
  356. package/dist/components/select/select.styles.js.map +1 -0
  357. package/dist/components/select-field/select-field.d.ts +141 -0
  358. package/dist/components/select-field/select-field.js +234 -0
  359. package/dist/components/select-field/select-field.js.map +1 -0
  360. package/dist/components/side-sheet/side-sheet.d.ts +190 -0
  361. package/dist/components/side-sheet/side-sheet.js +592 -0
  362. package/dist/components/side-sheet/side-sheet.js.map +1 -0
  363. package/dist/components/side-sheet/side-sheet.styles.d.ts +9 -0
  364. package/dist/components/side-sheet/side-sheet.styles.js +352 -0
  365. package/dist/components/side-sheet/side-sheet.styles.js.map +1 -0
  366. package/dist/components/skeleton/skeleton.d.ts +157 -0
  367. package/dist/components/skeleton/skeleton.js +550 -0
  368. package/dist/components/skeleton/skeleton.js.map +1 -0
  369. package/dist/components/slider/slider.d.ts +235 -0
  370. package/dist/components/slider/slider.js +792 -0
  371. package/dist/components/slider/slider.js.map +1 -0
  372. package/dist/components/slider/slider.styles.d.ts +6 -0
  373. package/dist/components/slider/slider.styles.js +492 -0
  374. package/dist/components/slider/slider.styles.js.map +1 -0
  375. package/dist/components/slider-field/slider-field.d.ts +150 -0
  376. package/dist/components/slider-field/slider-field.js +269 -0
  377. package/dist/components/slider-field/slider-field.js.map +1 -0
  378. package/dist/components/snackbar/snackbar.d.ts +237 -0
  379. package/dist/components/snackbar/snackbar.js +607 -0
  380. package/dist/components/snackbar/snackbar.js.map +1 -0
  381. package/dist/components/snackbar/snackbar.styles.d.ts +10 -0
  382. package/dist/components/snackbar/snackbar.styles.js +510 -0
  383. package/dist/components/snackbar/snackbar.styles.js.map +1 -0
  384. package/dist/components/switch/switch.d.ts +161 -0
  385. package/dist/components/switch/switch.js +470 -0
  386. package/dist/components/switch/switch.js.map +1 -0
  387. package/dist/components/switch/switch.styles.d.ts +3 -0
  388. package/dist/components/switch/switch.styles.js +440 -0
  389. package/dist/components/switch/switch.styles.js.map +1 -0
  390. package/dist/components/tab-view/tab-view.d.ts +303 -0
  391. package/dist/components/tab-view/tab-view.js +917 -0
  392. package/dist/components/tab-view/tab-view.js.map +1 -0
  393. package/dist/components/tab-view/tab-view.styles.d.ts +19 -0
  394. package/dist/components/tab-view/tab-view.styles.js +85 -0
  395. package/dist/components/tab-view/tab-view.styles.js.map +1 -0
  396. package/dist/components/table/table.d.ts +386 -0
  397. package/dist/components/table/table.js +1320 -0
  398. package/dist/components/table/table.js.map +1 -0
  399. package/dist/components/table-of-contents/table-of-contents.d.ts +227 -0
  400. package/dist/components/table-of-contents/table-of-contents.js +963 -0
  401. package/dist/components/table-of-contents/table-of-contents.js.map +1 -0
  402. package/dist/components/table-of-contents/table-of-contents.styles.d.ts +1 -0
  403. package/dist/components/table-of-contents/table-of-contents.styles.js +243 -0
  404. package/dist/components/table-of-contents/table-of-contents.styles.js.map +1 -0
  405. package/dist/components/tabs/tabs.d.ts +800 -0
  406. package/dist/components/tabs/tabs.js +2183 -0
  407. package/dist/components/tabs/tabs.js.map +1 -0
  408. package/dist/components/tabs/tabs.styles.d.ts +47 -0
  409. package/dist/components/tabs/tabs.styles.js +595 -0
  410. package/dist/components/tabs/tabs.styles.js.map +1 -0
  411. package/dist/components/tag/tag.d.ts +77 -0
  412. package/dist/components/tag/tag.js +143 -0
  413. package/dist/components/tag/tag.js.map +1 -0
  414. package/dist/components/tag/tag.styles.d.ts +13 -0
  415. package/dist/components/tag/tag.styles.js +215 -0
  416. package/dist/components/tag/tag.styles.js.map +1 -0
  417. package/dist/components/tag-group/tag-group.d.ts +110 -0
  418. package/dist/components/tag-group/tag-group.js +298 -0
  419. package/dist/components/tag-group/tag-group.js.map +1 -0
  420. package/dist/components/tag-group/tag-group.styles.d.ts +8 -0
  421. package/dist/components/tag-group/tag-group.styles.js +66 -0
  422. package/dist/components/tag-group/tag-group.styles.js.map +1 -0
  423. package/dist/components/text-field/text-field.d.ts +159 -0
  424. package/dist/components/text-field/text-field.js +272 -0
  425. package/dist/components/text-field/text-field.js.map +1 -0
  426. package/dist/components/text-input/text-input-segments.d.ts +93 -0
  427. package/dist/components/text-input/text-input-segments.js +233 -0
  428. package/dist/components/text-input/text-input-segments.js.map +1 -0
  429. package/dist/components/text-input/text-input.d.ts +683 -0
  430. package/dist/components/text-input/text-input.js +2120 -0
  431. package/dist/components/text-input/text-input.js.map +1 -0
  432. package/dist/components/text-input/text-input.styles.d.ts +27 -0
  433. package/dist/components/text-input/text-input.styles.js +1071 -0
  434. package/dist/components/text-input/text-input.styles.js.map +1 -0
  435. package/dist/components/toolbar/toolbar.d.ts +123 -0
  436. package/dist/components/toolbar/toolbar.js +336 -0
  437. package/dist/components/toolbar/toolbar.js.map +1 -0
  438. package/dist/components/toolbar/toolbar.styles.d.ts +10 -0
  439. package/dist/components/toolbar/toolbar.styles.js +156 -0
  440. package/dist/components/toolbar/toolbar.styles.js.map +1 -0
  441. package/dist/components/tooltip/tooltip-placement.d.ts +22 -0
  442. package/dist/components/tooltip/tooltip-placement.js +15 -0
  443. package/dist/components/tooltip/tooltip-placement.js.map +1 -0
  444. package/dist/components/tooltip/tooltip.d.ts +267 -0
  445. package/dist/components/tooltip/tooltip.js +902 -0
  446. package/dist/components/tooltip/tooltip.js.map +1 -0
  447. package/dist/components/tooltip/tooltip.styles.d.ts +7 -0
  448. package/dist/components/tooltip/tooltip.styles.js +240 -0
  449. package/dist/components/tooltip/tooltip.styles.js.map +1 -0
  450. package/dist/components/tree-view/tree-view.d.ts +264 -0
  451. package/dist/components/tree-view/tree-view.js +1228 -0
  452. package/dist/components/tree-view/tree-view.js.map +1 -0
  453. package/dist/description-list.css +337 -0
  454. package/dist/empty-state.css +70 -0
  455. package/dist/figure.css +381 -0
  456. package/dist/generated/icon-sets.d.ts +9 -0
  457. package/dist/generated/icon-sets.js +18 -0
  458. package/dist/generated/icon-sets.js.map +1 -0
  459. package/dist/generated/words.d.ts +161 -0
  460. package/dist/generated/words.js +91 -0
  461. package/dist/generated/words.js.map +1 -0
  462. package/dist/highlight/grammars/css.d.ts +3 -0
  463. package/dist/highlight/grammars/css.js +56 -0
  464. package/dist/highlight/grammars/css.js.map +1 -0
  465. package/dist/highlight/grammars/dart.d.ts +3 -0
  466. package/dist/highlight/grammars/dart.js +53 -0
  467. package/dist/highlight/grammars/dart.js.map +1 -0
  468. package/dist/highlight/grammars/javascript.d.ts +4 -0
  469. package/dist/highlight/grammars/javascript.js +119 -0
  470. package/dist/highlight/grammars/javascript.js.map +1 -0
  471. package/dist/highlight/grammars/json.d.ts +3 -0
  472. package/dist/highlight/grammars/json.js +19 -0
  473. package/dist/highlight/grammars/json.js.map +1 -0
  474. package/dist/highlight/grammars/kotlin.d.ts +3 -0
  475. package/dist/highlight/grammars/kotlin.js +46 -0
  476. package/dist/highlight/grammars/kotlin.js.map +1 -0
  477. package/dist/highlight/grammars/markup.d.ts +3 -0
  478. package/dist/highlight/grammars/markup.js +45 -0
  479. package/dist/highlight/grammars/markup.js.map +1 -0
  480. package/dist/highlight/grammars/shared.d.ts +25 -0
  481. package/dist/highlight/grammars/shared.js +37 -0
  482. package/dist/highlight/grammars/shared.js.map +1 -0
  483. package/dist/highlight/grammars/shell.d.ts +3 -0
  484. package/dist/highlight/grammars/shell.js +48 -0
  485. package/dist/highlight/grammars/shell.js.map +1 -0
  486. package/dist/highlight/grammars/swift.d.ts +3 -0
  487. package/dist/highlight/grammars/swift.js +46 -0
  488. package/dist/highlight/grammars/swift.js.map +1 -0
  489. package/dist/highlight/grammars/typescript.d.ts +2 -0
  490. package/dist/highlight/grammars/typescript.js +5 -0
  491. package/dist/highlight/grammars/typescript.js.map +1 -0
  492. package/dist/highlight/index.d.ts +104 -0
  493. package/dist/highlight/index.js +331 -0
  494. package/dist/highlight/index.js.map +1 -0
  495. package/dist/icons.css +107 -0
  496. package/dist/icons.d.ts +2 -0
  497. package/dist/icons.js +10 -0
  498. package/dist/icons.js.map +1 -0
  499. package/dist/index.d.ts +85 -0
  500. package/dist/index.js +100 -0
  501. package/dist/index.js.map +1 -0
  502. package/dist/link-card.css +678 -0
  503. package/dist/link.css +728 -0
  504. package/dist/link.d.ts +21 -0
  505. package/dist/link.js +594 -0
  506. package/dist/link.js.map +1 -0
  507. package/dist/links/index.d.ts +136 -0
  508. package/dist/links/index.js +404 -0
  509. package/dist/links/index.js.map +1 -0
  510. package/dist/links/node/address.js +154 -0
  511. package/dist/links/node/cli.js +102 -0
  512. package/dist/links/node/fetcher.js +267 -0
  513. package/dist/links/node/head.js +278 -0
  514. package/dist/links/node/index.d.ts +164 -0
  515. package/dist/links/node/index.js +26 -0
  516. package/dist/links/node/links.js +275 -0
  517. package/dist/links/node/lock.js +86 -0
  518. package/dist/links/node/mark.js +71 -0
  519. package/dist/links/node/options.js +120 -0
  520. package/dist/links/node/pictures.js +265 -0
  521. package/dist/links/node/refresh.js +28 -0
  522. package/dist/menu.css +97 -0
  523. package/dist/menubar.css +69 -0
  524. package/dist/page-header.css +324 -0
  525. package/dist/pagination.css +410 -0
  526. package/dist/pagination.d.ts +6 -0
  527. package/dist/pagination.js +256 -0
  528. package/dist/pagination.js.map +1 -0
  529. package/dist/primitives/actions.d.ts +75 -0
  530. package/dist/primitives/actions.js +142 -0
  531. package/dist/primitives/actions.js.map +1 -0
  532. package/dist/primitives/after-click.d.ts +8 -0
  533. package/dist/primitives/after-click.js +21 -0
  534. package/dist/primitives/after-click.js.map +1 -0
  535. package/dist/primitives/anchored.d.ts +134 -0
  536. package/dist/primitives/anchored.js +425 -0
  537. package/dist/primitives/anchored.js.map +1 -0
  538. package/dist/primitives/arc.d.ts +13 -0
  539. package/dist/primitives/arc.js +49 -0
  540. package/dist/primitives/arc.js.map +1 -0
  541. package/dist/primitives/arrow.d.ts +47 -0
  542. package/dist/primitives/arrow.js +159 -0
  543. package/dist/primitives/arrow.js.map +1 -0
  544. package/dist/primitives/auto-height.d.ts +56 -0
  545. package/dist/primitives/auto-height.js +150 -0
  546. package/dist/primitives/auto-height.js.map +1 -0
  547. package/dist/primitives/autofocus.d.ts +11 -0
  548. package/dist/primitives/autofocus.js +26 -0
  549. package/dist/primitives/autofocus.js.map +1 -0
  550. package/dist/primitives/availability.d.ts +32 -0
  551. package/dist/primitives/availability.js +122 -0
  552. package/dist/primitives/availability.js.map +1 -0
  553. package/dist/primitives/axes.d.ts +45 -0
  554. package/dist/primitives/axes.js +72 -0
  555. package/dist/primitives/axes.js.map +1 -0
  556. package/dist/primitives/behavior.d.ts +14 -0
  557. package/dist/primitives/behavior.js +19 -0
  558. package/dist/primitives/behavior.js.map +1 -0
  559. package/dist/primitives/calendar-date.d.ts +79 -0
  560. package/dist/primitives/calendar-date.js +135 -0
  561. package/dist/primitives/calendar-date.js.map +1 -0
  562. package/dist/primitives/composed.d.ts +144 -0
  563. package/dist/primitives/composed.js +303 -0
  564. package/dist/primitives/composed.js.map +1 -0
  565. package/dist/primitives/default-button.d.ts +49 -0
  566. package/dist/primitives/default-button.js +270 -0
  567. package/dist/primitives/default-button.js.map +1 -0
  568. package/dist/primitives/description.d.ts +18 -0
  569. package/dist/primitives/description.js +18 -0
  570. package/dist/primitives/description.js.map +1 -0
  571. package/dist/primitives/destination.d.ts +259 -0
  572. package/dist/primitives/destination.js +651 -0
  573. package/dist/primitives/destination.js.map +1 -0
  574. package/dist/primitives/direction.d.ts +23 -0
  575. package/dist/primitives/direction.js +90 -0
  576. package/dist/primitives/direction.js.map +1 -0
  577. package/dist/primitives/disabled-while-focused.d.ts +46 -0
  578. package/dist/primitives/disabled-while-focused.js +126 -0
  579. package/dist/primitives/disabled-while-focused.js.map +1 -0
  580. package/dist/primitives/disclosure.d.ts +9 -0
  581. package/dist/primitives/disclosure.js +15 -0
  582. package/dist/primitives/disclosure.js.map +1 -0
  583. package/dist/primitives/dismiss.d.ts +88 -0
  584. package/dist/primitives/dismiss.js +232 -0
  585. package/dist/primitives/dismiss.js.map +1 -0
  586. package/dist/primitives/field-frame.d.ts +166 -0
  587. package/dist/primitives/field-frame.js +358 -0
  588. package/dist/primitives/field-frame.js.map +1 -0
  589. package/dist/primitives/field-group-frame.d.ts +59 -0
  590. package/dist/primitives/field-group-frame.js +174 -0
  591. package/dist/primitives/field-group-frame.js.map +1 -0
  592. package/dist/primitives/field-trigger.d.ts +117 -0
  593. package/dist/primitives/field-trigger.js +387 -0
  594. package/dist/primitives/field-trigger.js.map +1 -0
  595. package/dist/primitives/field.d.ts +186 -0
  596. package/dist/primitives/field.js +349 -0
  597. package/dist/primitives/field.js.map +1 -0
  598. package/dist/primitives/file-format.d.ts +23 -0
  599. package/dist/primitives/file-format.js +185 -0
  600. package/dist/primitives/file-format.js.map +1 -0
  601. package/dist/primitives/file-item-holder.d.ts +45 -0
  602. package/dist/primitives/file-item-holder.js +39 -0
  603. package/dist/primitives/file-item-holder.js.map +1 -0
  604. package/dist/primitives/focus-order.d.ts +11 -0
  605. package/dist/primitives/focus-order.js +11 -0
  606. package/dist/primitives/focus-order.js.map +1 -0
  607. package/dist/primitives/focus-ring.d.ts +76 -0
  608. package/dist/primitives/focus-ring.js +230 -0
  609. package/dist/primitives/focus-ring.js.map +1 -0
  610. package/dist/primitives/follow.d.ts +65 -0
  611. package/dist/primitives/follow.js +283 -0
  612. package/dist/primitives/follow.js.map +1 -0
  613. package/dist/primitives/form-disabled.d.ts +20 -0
  614. package/dist/primitives/form-disabled.js +46 -0
  615. package/dist/primitives/form-disabled.js.map +1 -0
  616. package/dist/primitives/form-says.d.ts +33 -0
  617. package/dist/primitives/form-says.js +45 -0
  618. package/dist/primitives/form-says.js.map +1 -0
  619. package/dist/primitives/forward.d.ts +13 -0
  620. package/dist/primitives/forward.js +28 -0
  621. package/dist/primitives/forward.js.map +1 -0
  622. package/dist/primitives/glyph-mirror.d.ts +77 -0
  623. package/dist/primitives/glyph-mirror.js +211 -0
  624. package/dist/primitives/glyph-mirror.js.map +1 -0
  625. package/dist/primitives/glyph-pending.d.ts +17 -0
  626. package/dist/primitives/glyph-pending.js +91 -0
  627. package/dist/primitives/glyph-pending.js.map +1 -0
  628. package/dist/primitives/glyph.d.ts +53 -0
  629. package/dist/primitives/glyph.js +161 -0
  630. package/dist/primitives/glyph.js.map +1 -0
  631. package/dist/primitives/group-item.d.ts +128 -0
  632. package/dist/primitives/group-item.js +334 -0
  633. package/dist/primitives/group-item.js.map +1 -0
  634. package/dist/primitives/hidden.d.ts +2 -0
  635. package/dist/primitives/hidden.js +23 -0
  636. package/dist/primitives/hidden.js.map +1 -0
  637. package/dist/primitives/host-aria.d.ts +8 -0
  638. package/dist/primitives/host-aria.js +18 -0
  639. package/dist/primitives/host-aria.js.map +1 -0
  640. package/dist/primitives/index.d.ts +59 -0
  641. package/dist/primitives/index.js +189 -0
  642. package/dist/primitives/index.js.map +1 -0
  643. package/dist/primitives/indicator-drag.d.ts +90 -0
  644. package/dist/primitives/indicator-drag.js +207 -0
  645. package/dist/primitives/indicator-drag.js.map +1 -0
  646. package/dist/primitives/interactive.d.ts +13 -0
  647. package/dist/primitives/interactive.js +67 -0
  648. package/dist/primitives/interactive.js.map +1 -0
  649. package/dist/primitives/item-row.d.ts +34 -0
  650. package/dist/primitives/item-row.js +76 -0
  651. package/dist/primitives/item-row.js.map +1 -0
  652. package/dist/primitives/item-update.d.ts +2 -0
  653. package/dist/primitives/item-update.js +12 -0
  654. package/dist/primitives/item-update.js.map +1 -0
  655. package/dist/primitives/kept-length.d.ts +34 -0
  656. package/dist/primitives/kept-length.js +154 -0
  657. package/dist/primitives/kept-length.js.map +1 -0
  658. package/dist/primitives/keyboard-convention.d.ts +30 -0
  659. package/dist/primitives/keyboard-convention.js +88 -0
  660. package/dist/primitives/keyboard-convention.js.map +1 -0
  661. package/dist/primitives/label-lines.d.ts +12 -0
  662. package/dist/primitives/label-lines.js +34 -0
  663. package/dist/primitives/label-lines.js.map +1 -0
  664. package/dist/primitives/layout-scale.d.ts +18 -0
  665. package/dist/primitives/layout-scale.js +35 -0
  666. package/dist/primitives/layout-scale.js.map +1 -0
  667. package/dist/primitives/link.d.ts +147 -0
  668. package/dist/primitives/link.js +204 -0
  669. package/dist/primitives/link.js.map +1 -0
  670. package/dist/primitives/locale-date.d.ts +132 -0
  671. package/dist/primitives/locale-date.js +508 -0
  672. package/dist/primitives/locale-date.js.map +1 -0
  673. package/dist/primitives/missing-value.d.ts +16 -0
  674. package/dist/primitives/missing-value.js +31 -0
  675. package/dist/primitives/missing-value.js.map +1 -0
  676. package/dist/primitives/modal.d.ts +38 -0
  677. package/dist/primitives/modal.js +175 -0
  678. package/dist/primitives/modal.js.map +1 -0
  679. package/dist/primitives/native-text.d.ts +51 -0
  680. package/dist/primitives/native-text.js +77 -0
  681. package/dist/primitives/native-text.js.map +1 -0
  682. package/dist/primitives/natural-height.d.ts +21 -0
  683. package/dist/primitives/natural-height.js +36 -0
  684. package/dist/primitives/natural-height.js.map +1 -0
  685. package/dist/primitives/option-list.d.ts +314 -0
  686. package/dist/primitives/option-list.js +1098 -0
  687. package/dist/primitives/option-list.js.map +1 -0
  688. package/dist/primitives/overlay-focus.d.ts +48 -0
  689. package/dist/primitives/overlay-focus.js +152 -0
  690. package/dist/primitives/overlay-focus.js.map +1 -0
  691. package/dist/primitives/placement.d.ts +131 -0
  692. package/dist/primitives/placement.js +144 -0
  693. package/dist/primitives/placement.js.map +1 -0
  694. package/dist/primitives/places.d.ts +44 -0
  695. package/dist/primitives/places.js +98 -0
  696. package/dist/primitives/places.js.map +1 -0
  697. package/dist/primitives/press.d.ts +90 -0
  698. package/dist/primitives/press.js +153 -0
  699. package/dist/primitives/press.js.map +1 -0
  700. package/dist/primitives/report.d.ts +17 -0
  701. package/dist/primitives/report.js +34 -0
  702. package/dist/primitives/report.js.map +1 -0
  703. package/dist/primitives/ripple.d.ts +40 -0
  704. package/dist/primitives/ripple.js +70 -0
  705. package/dist/primitives/ripple.js.map +1 -0
  706. package/dist/primitives/roving.d.ts +41 -0
  707. package/dist/primitives/roving.js +71 -0
  708. package/dist/primitives/roving.js.map +1 -0
  709. package/dist/primitives/selection.d.ts +134 -0
  710. package/dist/primitives/selection.js +287 -0
  711. package/dist/primitives/selection.js.map +1 -0
  712. package/dist/primitives/separation.d.ts +28 -0
  713. package/dist/primitives/separation.js +96 -0
  714. package/dist/primitives/separation.js.map +1 -0
  715. package/dist/primitives/shared-choice.d.ts +33 -0
  716. package/dist/primitives/shared-choice.js +110 -0
  717. package/dist/primitives/shared-choice.js.map +1 -0
  718. package/dist/primitives/sheet.d.ts +63 -0
  719. package/dist/primitives/sheet.js +139 -0
  720. package/dist/primitives/sheet.js.map +1 -0
  721. package/dist/primitives/sheets.d.ts +8 -0
  722. package/dist/primitives/sheets.js +96 -0
  723. package/dist/primitives/sheets.js.map +1 -0
  724. package/dist/primitives/states.d.ts +33 -0
  725. package/dist/primitives/states.js +30 -0
  726. package/dist/primitives/states.js.map +1 -0
  727. package/dist/primitives/system-watch.d.ts +9 -0
  728. package/dist/primitives/system-watch.js +29 -0
  729. package/dist/primitives/system-watch.js.map +1 -0
  730. package/dist/primitives/target.d.ts +21 -0
  731. package/dist/primitives/target.js +79 -0
  732. package/dist/primitives/target.js.map +1 -0
  733. package/dist/primitives/values.d.ts +6 -0
  734. package/dist/primitives/values.js +22 -0
  735. package/dist/primitives/values.js.map +1 -0
  736. package/dist/primitives/visibility.d.ts +12 -0
  737. package/dist/primitives/visibility.js +50 -0
  738. package/dist/primitives/visibility.js.map +1 -0
  739. package/dist/primitives/words.d.ts +81 -0
  740. package/dist/primitives/words.js +236 -0
  741. package/dist/primitives/words.js.map +1 -0
  742. package/dist/prose.css +1917 -0
  743. package/dist/registry.d.ts +182 -0
  744. package/dist/registry.js +2 -0
  745. package/dist/registry.js.map +1 -0
  746. package/dist/shape.css +21 -0
  747. package/dist/skeleton.css +428 -0
  748. package/dist/steps.css +231 -0
  749. package/dist/steps.d.ts +6 -0
  750. package/dist/steps.js +156 -0
  751. package/dist/steps.js.map +1 -0
  752. package/dist/styles/icons.d.ts +62 -0
  753. package/dist/styles/icons.js +237 -0
  754. package/dist/styles/icons.js.map +1 -0
  755. package/dist/styles/product-text.d.ts +66 -0
  756. package/dist/styles/product-text.js +114 -0
  757. package/dist/styles/product-text.js.map +1 -0
  758. package/dist/styles/registered-properties.d.ts +6 -0
  759. package/dist/styles/registered-properties.js +68 -0
  760. package/dist/styles/registered-properties.js.map +1 -0
  761. package/dist/styles/shape.d.ts +59 -0
  762. package/dist/styles/shape.js +95 -0
  763. package/dist/styles/shape.js.map +1 -0
  764. package/dist/systems/cupertino.css +8793 -0
  765. package/dist/systems/m3-expressive-like.css +8786 -0
  766. package/dist/systems/m3-like.css +8748 -0
  767. package/dist/table-of-contents.css +482 -0
  768. package/dist/table.css +902 -0
  769. package/dist/tanrei.bundle.js +26644 -0
  770. package/dist/tanrei.bundle.js.map +7 -0
  771. package/dist/text.css +104 -0
  772. package/dist/timeline.css +410 -0
  773. package/dist/timeline.d.ts +6 -0
  774. package/dist/timeline.js +176 -0
  775. package/dist/timeline.js.map +1 -0
  776. package/dist/tokens.css +8801 -0
  777. package/dist/tree-view.css +797 -0
  778. package/dist/words.d.ts +2 -0
  779. package/dist/words.js +6 -0
  780. package/dist/words.js.map +1 -0
  781. package/package.json +132 -3
@@ -0,0 +1,1230 @@
1
+ import { LitElement, nothing } from 'lit';
2
+ import { classMap } from 'lit/directives/class-map.js';
3
+ import { styleMap } from 'lit/directives/style-map.js';
4
+ import { html, literal } from 'lit/static-html.js';
5
+ import { wordPlaces } from '../../generated/words.js';
6
+ import { hiddenHost } from '../../primitives/hidden.js';
7
+ import { AvailabilityController, GlyphDrawnController, GlyphMirrorController, KeptLengths, LINK_MARK, LinkController, PressController, RovingKeys, WordsController, deepActive, fillPlaces, reportPlaces, focusWithin, hostAria, linkAttributes, notifyItemUpdate, parseValues, isDisabledControl, report, linkForm, slottedInteractive, syncFocusStyle, } from '../../primitives/index.js';
8
+ import { ambientLocale } from '../../primitives/locale-date.js';
9
+ import '../button/button.js';
10
+ import { ownDirection } from '../../styles/product-text.js';
11
+ import { itemStyles, listStyles } from './list.styles.js';
12
+ /** LST-21: the glyph of the icon set a selected option draws — the spec's name, not a value. */
13
+ const CHECK_GLYPH = 'check';
14
+ const SELECTIONS = ['none', 'single', 'multiple'];
15
+ const LEADING_MEDIA = ['none', 'avatar', 'image'];
16
+ /** The spec's values (LST-7): `drag` is known, and drawn as `buttons` until its handle is built. TODO: build the drag handle. */
17
+ const REORDERS = ['none', 'buttons', 'drag'];
18
+ /** LST-37: the glyphs of the icon set the two move buttons draw — the spec's names, not values. */
19
+ const MOVE_GLYPHS = { up: 'arrow_upward', down: 'arrow_downward' };
20
+ const CONTROL_PLACES = ['up', 'down', 'trailing'];
21
+ /** The item of `list` an event came from: the first list item on its composed path whose list is `list`. */
22
+ function itemOf(list, event) {
23
+ for (const node of event.composedPath()) {
24
+ if (node === list)
25
+ return null;
26
+ if (node instanceof TanreiListItem && node.parentElement === list)
27
+ return node;
28
+ }
29
+ return null;
30
+ }
31
+ /**
32
+ * One row of a list — the spec's item kind `list-item`: a headline with an optional overline, supporting
33
+ * text, leading icon or media and trailing text, icon or control. Placed as a child of `<tanrei-list>`, which decides
34
+ * whether it is an option; otherwise it is static, one action with `interactive`, or a link with `href`.
35
+ *
36
+ * Contract: specs/list.spec.json. Every visual value comes from `--tanrei-comp-list-*` tokens, one set per condition
37
+ * (unselected, selected) and state. How a press is answered and how keyboard focus is drawn are the system's choices of
38
+ * kind (`--tanrei-sys-behavior-*`), read from the cascade.
39
+ *
40
+ * Semantics: the host is a `listitem` — or, in a selectable list, an `option` with its selected state, named by the
41
+ * headline and described by the overline, supporting text and trailing text, which takes focus itself. An interactive
42
+ * item draws one element with the button role inside its list item, named and described the same way. The list sets
43
+ * each item's position and the list's size (`aria-posinset`, `aria-setsize`) and which one is the tab stop.
44
+ *
45
+ * With `href` (and outside a selectable list) the item is a link item (LST-31): an `<a href>` in place of the
46
+ * element with the button role, inside the host's list item, in the list's one tab stop and arrow-key order, drawn as an
47
+ * interactive item is. Enter follows it and Space does not; `click` fires first and cancelling it cancels the
48
+ * navigation. `target="new"` opens a new tab, safely (`noopener`), draws the icon set's `open_in_new` as the trailing
49
+ * icon unless `trailing-icon` names one, and reads `target-label` at the end of the item's description.
50
+ *
51
+ * @tag tanrei-list-item
52
+ * @slot leading - The avatar's or the image's content (an `<img>`, or a monogram for an avatar), drawn only while `leading-media` is `avatar` or `image`. Hidden from assistive technology unless it is named (an `alt`, an `aria-label`).
53
+ * @slot trailing - A control of your own at the end of a static item: a switch, a checkbox, an icon button. It keeps its own tokens, semantics and focus stop. An interactive item or an option must hold no interactive element (reported in debug builds). In a reorderable list it stands after the two move buttons: one control, typically the button that removes the item.
54
+ * @csspart container - The row: its color, corners, every state, the ripple and the focus ring; an interactive item's button, a link item's anchor.
55
+ * @csspart leading-icon - The leading glyph.
56
+ * @csspart leading-media - The avatar's or the image's box.
57
+ * @csspart overline - The line above the headline.
58
+ * @csspart headline - The item's main text.
59
+ * @csspart supporting-text - The text below the headline.
60
+ * @csspart trailing-text - The short value at the end of the row.
61
+ * @csspart trailing-icon - The trailing glyph; the mark of a link item that opens a new context while `trailing-icon` is empty.
62
+ * @csspart move-button - One of the two move buttons of an item of a reorderable list, a `<tanrei-button>`: first the one that moves the item up, then the one that moves it down.
63
+ * @csspart mark - The check at the end of an option: the icon set's `check` glyph in a box reserved in every option.
64
+ * @csspart divider - The hairline along the bottom of the item.
65
+ * @fires click - An interactive item or a link item was activated by pointer, touch, keyboard or assistive technology. A link item fires it before the browser follows the address; `preventDefault()` cancels the navigation.
66
+ */
67
+ export class TanreiListItem extends LitElement {
68
+ static { this.styles = [itemStyles, hiddenHost]; }
69
+ static { this.properties = {
70
+ headline: { type: String },
71
+ overline: { type: String },
72
+ supportingText: { type: String, attribute: 'supporting-text' },
73
+ supportingMaxLines: { type: Number, attribute: 'supporting-max-lines' },
74
+ trailingText: { type: String, attribute: 'trailing-text' },
75
+ leadingIcon: { type: String, attribute: 'leading-icon' },
76
+ trailingIcon: { type: String, attribute: 'trailing-icon' },
77
+ leadingMedia: { type: String, attribute: 'leading-media', reflect: true },
78
+ interactive: { type: Boolean, reflect: true },
79
+ value: { type: String },
80
+ disabled: { type: Boolean, reflect: true },
81
+ divider: { type: Boolean, reflect: true },
82
+ href: { type: String },
83
+ target: { type: String },
84
+ targetLabel: { type: String, attribute: 'target-label' },
85
+ rel: { type: String },
86
+ download: { type: String },
87
+ context: { state: true },
88
+ supportingLines: { state: true },
89
+ }; }
90
+ constructor() {
91
+ super();
92
+ /** The item's main text, and its accessible name. Required. */
93
+ this.headline = '';
94
+ /** A short line above the headline: a category, a source. */
95
+ this.overline = '';
96
+ /** Text below the headline. One line of it makes a two-line item; two or more make a three-line item. */
97
+ this.supportingText = '';
98
+ /** The lines of supporting text shown before it ends with an ellipsis; 0 shows all of it. The full text is still the item's description. */
99
+ this.supportingMaxLines = 0;
100
+ /** A short value at the end of the row: a count, a time, a size. */
101
+ this.trailingText = '';
102
+ /** The name of a glyph of the system's icon set at the start of the row. Empty: nothing, and no space. A glyph the icon set flags as showing a direction (`arrow_forward`, `send`) is drawn mirrored in a right-to-left layout. */
103
+ this.leadingIcon = '';
104
+ /** The name of a glyph at the end of the row, such as `chevron_right` (which the icon set flags: it points to the left in a right-to-left layout). */
105
+ this.trailingIcon = '';
106
+ /** How the `leading` slot is framed: `avatar` (a round box) or `image` (a rounded square); it replaces the leading icon. */
107
+ this.leadingMedia = 'none';
108
+ /** Makes the item one pressable action that emits `click`. Ignored in a selectable list, where every item is an option. */
109
+ this.interactive = false;
110
+ /** Identifies the option: the list's `value` or `values` select it, and `change` carries it. Unique within the list. */
111
+ this.value = '';
112
+ /** Prevents activation; the arrow keys still reach it. Ignored for a static item. */
113
+ this.disabled = false;
114
+ /** Draws a hairline along the bottom of the item. Set it on every item but the last, or at the end of a group. */
115
+ this.divider = false;
116
+ /**
117
+ * The destination: a URL, a path or a fragment. Not empty, the item is a link item (LST-31) whether `interactive` is
118
+ * set or not: one link inside its list item, in the list's arrow-key order, followed by Enter and not by Space.
119
+ * Ignored in a selectable list, where every item is an option; white space is no destination, and a `javascript:`
120
+ * address or one that cannot be read is refused and reported in debug builds (LST-35).
121
+ */
122
+ this.href = '';
123
+ /**
124
+ * Where the destination opens: `same` (here) or `new` (a new tab or window, with `noopener`), which the item marks
125
+ * with the glyph `open_in_new` as its trailing icon — unless `trailingIcon` names one — and says through `targetLabel`
126
+ * (LST-33). HTML's `_self` and `_blank` are read as those two; anything else is `same` and reported. Ignored without `href`.
127
+ */
128
+ this.target = 'same';
129
+ /** What assistive technology reads at the end of the link's description while `target` is `new` ("opens in a new tab"): your words, in your language. Required then; ignored otherwise. */
130
+ this.targetLabel = '';
131
+ /** Web only: forwarded to the anchor's `rel`; `target="new"` adds `noopener` to it. Ignored without `href`. */
132
+ this.rel = null;
133
+ /** Web only: forwarded to the anchor's `download` (the file name; empty for the address's own). Ignored without `href`. */
134
+ this.download = null;
135
+ /** What the list says about this item. */
136
+ this.context = { selectable: false, selected: false, tabStop: false, position: 0, size: 0, reorder: false, stacked: false, moveUp: '', moveDown: '' };
137
+ /** The lines the supporting text takes as laid out (LST-17). */
138
+ this.supportingLines = 1;
139
+ /**
140
+ * LST-31 … LST-35: the link the item is while it has a destination and is no option, what its anchor carries, and
141
+ * what a debug build is told (src/primitives/link.ts). An option holds a state and takes none (LST-35).
142
+ */
143
+ this.link = new LinkController(this, {
144
+ ids: { refused: 'LST-35', newContext: 'LST-33' },
145
+ disabled: () => this.disabled,
146
+ holds: () => (this.context.selectable ? 'an option of a selectable list' : this.context.reorder ? 'an item of a reorderable list' : null),
147
+ });
148
+ /**
149
+ * LST-8 / LST-9: the pressed state, press-hold and the answer the system chooses (src/primitives/press.ts). LST-32: a
150
+ * link item is pressed by Enter alone; Space is the browser's.
151
+ */
152
+ this.press = new PressController(this, {
153
+ container: () => this.row,
154
+ holdCarrier: () => this.renderRoot.querySelector('.text'),
155
+ disabled: () => !this.active,
156
+ keys: () => this.link.pressKeys,
157
+ });
158
+ /** LST-27: the check is drawn only while the icon set can draw it (src/primitives/glyph.ts). */
159
+ this.glyphs = new GlyphDrawnController(this, () => this.renderRoot.querySelectorAll('.mark, .move-glyph'));
160
+ /**
161
+ * LST-37: the two move buttons each keep a touch target's length along the row — two narrower than that stand apart
162
+ * by what is missing (src/primitives/kept-length.ts). LST-51: the list is told when their lengths arrive.
163
+ */
164
+ this.kept = new KeptLengths(() => this.drawn());
165
+ /**
166
+ * LST-29: the leading and trailing glyphs are marked when the icon set mirrors their names in right-to-left
167
+ * (`chevron_right`, `arrow_forward`; never `check`), and `iconGlyph()` draws the mark. The mark (LST-21) is not named.
168
+ */
169
+ this.mirror = new GlyphMirrorController(this, { drawn: '.leading-icon, .trailing-icon' });
170
+ /** Space activates on key-up, as a native button does, and only when the key went down on the item. */
171
+ this.spaceDown = false;
172
+ this.observed = null;
173
+ /** LST-1: Enter activates on key-down and Space on key-up, as a native button does. */
174
+ this.onKeyDown = (event) => {
175
+ const mode = this.mode;
176
+ if (mode === 'static' || event.composedPath()[0] !== this.focusTarget)
177
+ return;
178
+ // LST-32: a link item's keys are the anchor's own — Enter fires its click and follows it, Space scrolls the page as
179
+ // on any link — so nothing is prevented and no click is made here. A disabled one has no address to follow.
180
+ if (mode === 'link') {
181
+ if (this.active)
182
+ this.press.onKeyDown(event);
183
+ return;
184
+ }
185
+ if (event.key === ' ')
186
+ event.preventDefault(); // Space would scroll the page.
187
+ if (!this.active)
188
+ return;
189
+ this.press.onKeyDown(event);
190
+ if (event.key === 'Enter') {
191
+ if (!event.repeat)
192
+ this.activate();
193
+ }
194
+ else if (event.key === ' ')
195
+ this.spaceDown = true;
196
+ };
197
+ this.onKeyUp = (event) => {
198
+ if (this.mode === 'static' || event.composedPath()[0] !== this.focusTarget)
199
+ return;
200
+ this.press.onKeyUp(event);
201
+ if (event.key !== ' ' || !this.spaceDown)
202
+ return;
203
+ this.spaceDown = false;
204
+ if (this.active)
205
+ this.activate();
206
+ };
207
+ /** LST-10: where style queries are missing, the focus style is read when focus arrives. */
208
+ this.onFocusIn = (event) => {
209
+ if (event.composedPath()[0] === this.focusTarget)
210
+ syncFocusStyle(this, this.focusTarget);
211
+ };
212
+ this.onFocusOut = (event) => {
213
+ if (event.composedPath()[0] !== this.focusTarget)
214
+ return;
215
+ // A Space whose key-up arrives somewhere else does not activate, as on a native button.
216
+ this.spaceDown = false;
217
+ this.press.onBlur();
218
+ };
219
+ /** LST-23: media holding content the product named (an `alt`, an `aria-label`) is read; any other is hidden. */
220
+ this.mediaNamed = false;
221
+ // LST-2: a disabled action or option swallows every click that reaches it, from its content or dispatched on it.
222
+ this.addEventListener('click', (event) => {
223
+ if (this.mode !== 'static' && this.disabled) {
224
+ event.preventDefault();
225
+ event.stopImmediatePropagation();
226
+ }
227
+ }, { capture: true });
228
+ this.addEventListener('keydown', this.onKeyDown);
229
+ this.addEventListener('keyup', this.onKeyUp);
230
+ this.addEventListener('focusin', this.onFocusIn);
231
+ this.addEventListener('focusout', this.onFocusOut);
232
+ }
233
+ /** @internal The list's side: whether the item is an option, selected, the tab stop, and where it stands. */
234
+ setListContext(context) {
235
+ const now = this.context;
236
+ if (Object.keys(context).every((key) => context[key] === now[key]))
237
+ return;
238
+ this.context = context;
239
+ }
240
+ /** @internal Whether the item takes focus in its list: an action or an option — a disabled one too (LST-2). */
241
+ get takesFocus() {
242
+ return this.mode !== 'static';
243
+ }
244
+ /** @internal Whether the item is a selected option. */
245
+ get selected() {
246
+ return this.context.selectable && this.context.selected;
247
+ }
248
+ /**
249
+ * @internal Whether the item is one pressable thing outside a selectable list — an action (`interactive`) or a link
250
+ * (LST-31) — and so takes its place in the list's arrow-key order (LST-15). What the list asks before it tells the item
251
+ * anything.
252
+ */
253
+ get pressable() {
254
+ return this.interactive || linkForm(this, this.disabled) !== null;
255
+ }
256
+ /** @internal LST-37: one of the item's two move buttons, while the list is reorderable. */
257
+ moveButton(which) {
258
+ return this.renderRoot?.querySelector(`.move.${which}`) ?? null;
259
+ }
260
+ /** @internal LST-52: the product's control in the trailing slot — the first element it placed there. */
261
+ get trailingControl() {
262
+ return [...this.children].find((child) => child instanceof HTMLElement && child.slot === 'trailing') ?? null;
263
+ }
264
+ /** @internal The control of the item at `place`. */
265
+ control(place) {
266
+ return place === 'trailing' ? this.trailingControl : this.moveButton(place);
267
+ }
268
+ /** @internal Which of the item's controls an event came from: a move button, or what the trailing slot holds. */
269
+ placeOf(event) {
270
+ const path = event.composedPath();
271
+ for (const which of ['up', 'down']) {
272
+ const button = this.moveButton(which);
273
+ if (button && path.includes(button))
274
+ return which;
275
+ }
276
+ const trailing = this.trailingControl;
277
+ return trailing && path.includes(trailing) ? 'trailing' : null;
278
+ }
279
+ /**
280
+ * @internal LST-51: whether the item's controls, standing in the row, would leave its text column less than half
281
+ * the row's width. Counted from what stands beside the text — the leading element, the trailing text and icon, the
282
+ * move buttons and the trailing control, each at the width it has, and the gaps between them — so the answer is the
283
+ * same whichever way the controls are placed now.
284
+ */
285
+ get squeezed() {
286
+ const row = this.row;
287
+ const controls = this.renderRoot?.querySelector('.controls');
288
+ if (!row || !controls)
289
+ return false;
290
+ const width = (element) => element.getBoundingClientRect().width;
291
+ const style = getComputedStyle(row);
292
+ const gap = Number.parseFloat(style.columnGap) || 0;
293
+ const held = [...controls.children].flatMap((child) => (child instanceof HTMLSlotElement ? child.assignedElements({ flatten: true }) : [child])).map(width).filter((each) => each > 0);
294
+ const between = Number.parseFloat(getComputedStyle(controls).columnGap) || 0;
295
+ let beside = held.reduce((sum, each) => sum + each, 0) + between * Math.max(0, held.length - 1);
296
+ let parts = held.length ? 2 : 1;
297
+ for (const child of row.children) {
298
+ if (child === controls || child.classList.contains('text'))
299
+ continue;
300
+ const taken = width(child);
301
+ if (taken <= 0)
302
+ continue;
303
+ beside += taken;
304
+ parts++;
305
+ }
306
+ const whole = width(row);
307
+ const text = whole - (Number.parseFloat(style.paddingLeft) || 0) - (Number.parseFloat(style.paddingRight) || 0) - beside - gap * (parts - 1);
308
+ return text < whole / 2;
309
+ }
310
+ /** LST-51: what the list measures has been drawn, or has changed its size. */
311
+ drawn() {
312
+ const list = this.parentElement;
313
+ if (this.context.reorder && list instanceof TanreiList)
314
+ list.itemDrawn();
315
+ }
316
+ /**
317
+ * LST-41, LST-52: which move button holds focus. Focus that goes from one button to the other never leaves this
318
+ * shadow root, so the list — outside it — is told from here.
319
+ */
320
+ onMovesFocus(event) {
321
+ const list = this.parentElement;
322
+ const place = this.placeOf(event);
323
+ if (place && list instanceof TanreiList)
324
+ list.controlFocused(this, place);
325
+ }
326
+ /** LST-39: a move button was activated — by pointer, touch, Enter, Space or assistive technology, as a Button is. */
327
+ onMove(which) {
328
+ const list = this.parentElement;
329
+ if (list instanceof TanreiList)
330
+ list.requestMove(this, which);
331
+ }
332
+ /** @internal The element that takes focus: an interactive item's row, a link item's anchor, an option's host. */
333
+ get focusTarget() {
334
+ const mode = this.mode;
335
+ return mode === 'interactive' || mode === 'link' ? this.row : mode === 'option' ? this : null;
336
+ }
337
+ /**
338
+ * LST-12, LST-31: an option in a selectable list, else a link while it has a destination, else an action while
339
+ * `interactive`, else static. LST-36: every item of a reorderable list is static, whatever it asks to be — a row that
340
+ * is itself one button or one link cannot hold the buttons that move it.
341
+ */
342
+ get mode() {
343
+ if (this.context.selectable)
344
+ return 'option';
345
+ if (this.context.reorder)
346
+ return 'static';
347
+ return this.link.form ? 'link' : this.interactive ? 'interactive' : 'static';
348
+ }
349
+ /** Whether the item can be activated now. */
350
+ get active() {
351
+ return this.mode !== 'static' && !this.disabled;
352
+ }
353
+ get row() {
354
+ return this.renderRoot?.querySelector('.row') ?? null;
355
+ }
356
+ /** LST-7: a leading media the list does not define is drawn as `none`. */
357
+ get media() {
358
+ return LEADING_MEDIA.includes(this.leadingMedia) ? this.leadingMedia : 'none';
359
+ }
360
+ /**
361
+ * LST-23: the overline, supporting text and trailing text, in reading order — the full text, even when it is cut.
362
+ * LST-33: a link item that opens a new context ends it with `targetLabel`.
363
+ */
364
+ get description() {
365
+ return this.link.describe(this.overline, this.supportingText, this.trailingText) ?? '';
366
+ }
367
+ /** `element.focus()` focuses an action's row, or an option; a static item has nothing to focus (LST-11). */
368
+ focus(options) {
369
+ const target = this.focusTarget;
370
+ if (target === this)
371
+ super.focus(options);
372
+ else
373
+ target?.focus(options);
374
+ }
375
+ /** `element.click()` activates an action or an option as a person would, and follows a link item; a static or disabled item does nothing (LST-2, LST-11). */
376
+ click() {
377
+ if (!this.active)
378
+ return;
379
+ if (this.mode === 'option')
380
+ super.click();
381
+ else
382
+ this.row?.click();
383
+ }
384
+ /** LST-1 / LST-13 / LST-14: an action's click comes from its row; an option's from its host, which the list answers. */
385
+ activate() {
386
+ if (this.mode === 'interactive')
387
+ this.row?.click();
388
+ else if (this.mode === 'option')
389
+ super.click();
390
+ }
391
+ /** LST-2: a press on a disabled item does not focus it (as on a native disabled control); the arrow keys still reach it. */
392
+ onMouseDown(event) {
393
+ if (this.mode !== 'static' && this.disabled)
394
+ event.preventDefault();
395
+ }
396
+ /** LST-24: an action's or an option's slots hold nothing interactive; a debug build names what it found, on every slot change. */
397
+ async inspectSlots() {
398
+ if (this.mode === 'static')
399
+ return;
400
+ for (const slot of this.renderRoot.querySelectorAll('slot')) {
401
+ const found = await slottedInteractive(slot);
402
+ if (found) {
403
+ report(this, 'LST-24', `${this.mode === 'option' ? 'an option' : this.mode === 'link' ? 'a link item' : 'an interactive item'} holds an interactive element (<${found.localName}>) in its ${slot.name} slot, which assistive technology cannot reach and whose press would also activate the item; make the item static and let that element be its control`);
404
+ return;
405
+ }
406
+ }
407
+ }
408
+ /** LST-24: what the trailing slot holds is inspected; LST-51: and, in a reorderable list, measured again. */
409
+ onTrailingChange() {
410
+ void this.inspectSlots();
411
+ this.drawn();
412
+ }
413
+ onLeadingChange(event) {
414
+ const assigned = event.target.assignedElements({ flatten: true });
415
+ const named = assigned.some((element) => !!(element.getAttribute('alt')?.trim() || element.getAttribute('aria-label')?.trim() || element.getAttribute('aria-labelledby')?.trim()));
416
+ if (named !== this.mediaNamed) {
417
+ this.mediaNamed = named;
418
+ this.requestUpdate();
419
+ }
420
+ void this.inspectSlots();
421
+ }
422
+ /** LST-17: count the supporting text's lines as laid out, whenever its box changes. */
423
+ observeLines() {
424
+ const supporting = this.renderRoot.querySelector('.supporting');
425
+ if (supporting === this.observed)
426
+ return;
427
+ this.lines?.disconnect();
428
+ this.observed = supporting;
429
+ if (!supporting) {
430
+ this.supportingLines = 1;
431
+ return;
432
+ }
433
+ this.lines ??= new ResizeObserver(() => {
434
+ const element = this.observed;
435
+ if (!element)
436
+ return;
437
+ const lineHeight = Number.parseFloat(getComputedStyle(element).lineHeight);
438
+ const lines = lineHeight > 0 ? Math.max(1, Math.round(element.getBoundingClientRect().height / lineHeight)) : 1;
439
+ if (lines !== this.supportingLines)
440
+ this.supportingLines = lines;
441
+ });
442
+ this.lines.observe(supporting);
443
+ }
444
+ connectedCallback() {
445
+ super.connectedCallback();
446
+ if (this.observed)
447
+ this.lines?.observe(this.observed);
448
+ }
449
+ disconnectedCallback() {
450
+ super.disconnectedCallback();
451
+ this.lines?.disconnect();
452
+ this.kept.clear();
453
+ }
454
+ willUpdate(changed) {
455
+ // LST-7: a leading media the list does not define is drawn as none; a debug build says so.
456
+ if (changed.has('leadingMedia') && !LEADING_MEDIA.includes(this.leadingMedia)) {
457
+ report(this, 'LST-7', `leadingMedia "${this.leadingMedia}" is not a value the list defines; it is drawn as "none"`);
458
+ }
459
+ }
460
+ updated(changed) {
461
+ const { position, size, tabStop } = this.context;
462
+ const mode = this.mode;
463
+ const option = mode === 'option';
464
+ // LST-12, LST-23: a list item — or an option with its selected state, named by the headline and described by the
465
+ // rest — with its position and the list's size.
466
+ hostAria(this, {
467
+ role: option ? 'option' : 'listitem',
468
+ 'aria-selected': option ? String(this.selected) : null,
469
+ 'aria-disabled': option && this.disabled ? 'true' : null,
470
+ 'aria-label': option && this.headline ? this.headline : null,
471
+ 'aria-description': option && this.description ? this.description : null,
472
+ 'aria-posinset': position ? String(position) : null,
473
+ 'aria-setsize': size ? String(size) : null,
474
+ // LST-15: an option takes focus itself; only the list's tab stop is in the tab order.
475
+ tabindex: option ? (tabStop ? '0' : '-1') : null,
476
+ });
477
+ // LST-23: an item without a headline has no accessible name; a debug build says so.
478
+ if (changed.has('headline') && !this.headline.trim())
479
+ report(this, 'LST-23', 'headline is empty, so the item has no accessible name; give it a headline');
480
+ if (changed.has('interactive') || changed.has('href') || changed.has('context'))
481
+ void this.inspectSlots();
482
+ if (changed.has('disabled') && this.disabled)
483
+ this.spaceDown = false;
484
+ this.observeLines();
485
+ // LST-36: a reorderable list's item that asks to be a button or a link is drawn static; a debug build says so.
486
+ if (this.context.reorder && (this.interactive || this.href.trim())) {
487
+ report(this, 'LST-36', `an item of a reorderable list is static: its ${this.interactive ? 'interactive' : 'href'} is ignored, because a row that is itself one ${this.interactive ? 'button' : 'link'} cannot hold the buttons that move it`);
488
+ }
489
+ // LST-37: the two move buttons, measured while they are drawn.
490
+ this.kept.set(this.context.reorder ? [...this.renderRoot.querySelectorAll('.move')] : []);
491
+ if (this.context.reorder)
492
+ this.drawn();
493
+ // The list re-reads its items when one of the props it depends on changes; an internal event, kept out of the item's
494
+ // public API.
495
+ if (['headline', 'value', 'disabled', 'interactive', 'href'].some((key) => changed.has(key)) && this.hasUpdated) {
496
+ notifyItemUpdate(this, 'tanrei-list-item-update');
497
+ }
498
+ }
499
+ render() {
500
+ const mode = this.mode;
501
+ const interactive = mode === 'interactive';
502
+ // LST-31: a link item's row is an anchor in place of the element with the button role — the same classes, part and
503
+ // listeners, in the list's roving tab stop — whose address and disabled form are the link primitive's (LST-34: a
504
+ // disabled one is the anchor without `href`, still reached by the arrow keys through its tabindex).
505
+ const link = this.link.form;
506
+ const tag = link ? literal `a` : literal `div`;
507
+ const action = interactive || !!link;
508
+ // LST-33: a new context is marked where the trailing icon is drawn, unless the product named its own.
509
+ const trailingIcon = this.trailingIcon || (link?.opensNew ? LINK_MARK : '');
510
+ const media = this.media;
511
+ const lead = media !== 'none' ? media : this.leadingIcon ? 'icon' : 'none';
512
+ // LST-17: one line for the headline, one for an overline, and the supporting text's lines as laid out.
513
+ const lines = Math.min(3, 1 + (this.overline ? 1 : 0) + (this.supportingText ? this.supportingLines : 0));
514
+ const clamp = this.supportingMaxLines > 0;
515
+ const { reorder, position, size } = this.context;
516
+ // LST-37, LST-38, LST-40: one move button — an icon-only text Button, named by the product's word and described by
517
+ // the item's headline, disabled and still drawn where the item cannot go that way. Its glyph is never mirrored:
518
+ // up is up in every layout.
519
+ const move = (which, name, disabled) => html `<tanrei-button
520
+ part="move-button"
521
+ class="move ${which}"
522
+ variant="text"
523
+ label=${name}
524
+ aria-description=${this.headline || nothing}
525
+ ?disabled=${disabled}
526
+ @click=${() => this.onMove(which)}
527
+ ><span slot="icon" class="move-glyph" data-mirror="never"><span class="ink">${MOVE_GLYPHS[which]}</span></span></tanrei-button
528
+ >`;
529
+ const trailing = html `<slot name="trailing" @slotchange=${this.onTrailingChange}></slot>`;
530
+ return html `
531
+ <${tag}
532
+ part="container"
533
+ class=${classMap({ row: true, p: mode !== 'static', d: mode !== 'static' && this.disabled, selected: this.selected, stacked: reorder && this.context.stacked, [`lines-${lines}`]: true })}
534
+ data-tanrei-shape
535
+ role=${interactive ? 'button' : nothing}
536
+ ${linkAttributes(link)}
537
+ tabindex=${action ? (this.context.tabStop ? '0' : '-1') : nothing}
538
+ aria-label=${action && this.headline ? this.headline : nothing}
539
+ aria-description=${action && this.description ? this.description : nothing}
540
+ aria-disabled=${interactive && this.disabled ? 'true' : nothing}
541
+ @pointerdown=${this.press.onPointerDown}
542
+ @pointerup=${this.press.release}
543
+ @pointercancel=${this.press.release}
544
+ @pointerleave=${this.press.release}
545
+ @mousedown=${this.onMouseDown}
546
+ >
547
+ ${lead === 'icon' ? html `<span part="leading-icon" class="leading-icon" aria-hidden="true">${this.leadingIcon}</span>` : nothing}
548
+ ${media !== 'none'
549
+ ? html `<span part="leading-media" class="media ${media}" data-tanrei-shape aria-hidden=${this.mediaNamed ? nothing : 'true'}
550
+ ><slot name="leading" @slotchange=${this.onLeadingChange}></slot
551
+ ></span>`
552
+ : nothing}
553
+ <span class="text">
554
+ ${this.overline ? html `<span part="overline" class="overline">${this.overline}</span>` : nothing}
555
+ <span part="headline" class="headline">${this.headline}</span>
556
+ ${this.supportingText
557
+ ? html `<span part="supporting-text" class=${classMap({ supporting: true, clamped: clamp })} dir=${clamp ? ownDirection(this.supportingText) : nothing} style=${styleMap(clamp ? { '--_max-lines': String(this.supportingMaxLines) } : {})}>${this.supportingText}</span>`
558
+ : nothing}
559
+ </span>
560
+ ${this.trailingText ? html `<span part="trailing-text" class="trailing-text">${this.trailingText}</span>` : nothing}
561
+ ${trailingIcon ? html `<span part="trailing-icon" class="trailing-icon" aria-hidden="true">${trailingIcon}</span>` : nothing}
562
+ ${reorder
563
+ ? html `<span class="controls"
564
+ ><span class="moves" @focusin=${this.onMovesFocus}>${move('up', this.context.moveUp, position <= 1)}${move('down', this.context.moveDown, position >= size)}</span>${trailing}</span
565
+ >`
566
+ : trailing}
567
+ ${this.context.selectable
568
+ ? html `<span part="mark" class="mark" aria-hidden="true"><span class="ink">${CHECK_GLYPH}</span></span>`
569
+ : nothing}
570
+ </${tag}>
571
+ ${this.divider ? html `<span part="divider" class="divider lead-${lead}" aria-hidden="true"></span>` : nothing}
572
+ `;
573
+ }
574
+ }
575
+ /**
576
+ * Shows a column of related items that people read, open one by one, choose from, or put in another order.
577
+ *
578
+ * Contract: specs/list.spec.json. The list draws nothing and adds no space around its `<tanrei-list-item>` children;
579
+ * it carries the semantics — a `list`, or a `listbox` named by `label` while `selection` is `single` or `multiple` — and
580
+ * moves keyboard focus among the items: one tab stop (a roving tabindex), Up and Down Arrow without wrapping, Home, End
581
+ * and typeahead. Moving focus never changes the selection; Space or Enter chooses.
582
+ *
583
+ * The selection is the list's: `value` names the selected option of a single-select list, `values` those
584
+ * of a multiple-select list, each by the options' `value`. The list sets them before firing `change`, as a native
585
+ * control does; set them yourself to select from script (a new array for `values`).
586
+ *
587
+ * With `reorder="buttons"` (and `selection` none) the list is reorderable (LST-36): every item is static and draws two
588
+ * move buttons — Tanrei Buttons, each a focus stop of its own in reading order, before the item's trailing control —
589
+ * and the list is not one tab stop and handles no key. A press fires `move` with `from` and `to` and changes nothing:
590
+ * the order is your data. Reorder your items in answer (move the elements, or let your framework render the new
591
+ * order) and the list draws the two rows changing place, keeps focus on the same button of the moved item — on its
592
+ * other button once it is first or last — and says `moved-text` once through its one polite live region, with
593
+ * `{headline}`, `{position}` (from 1) and `{count}` filled. A move you have not made within
594
+ * `--tanrei-comp-list-motion-reorder-duration` is taken as refused: nothing is announced. The three words are yours
595
+ * (`move-up-label`, `move-down-label`, `moved-text`, or once with `setWords()`): without them the buttons work unnamed
596
+ * and nothing is announced, and a debug build says so. The spec's `reorder="drag"` (a handle a pointer drags) is not
597
+ * built yet and is read as `buttons`.
598
+ *
599
+ * @tag tanrei-list
600
+ * @slot - The items: `<tanrei-list-item>` children.
601
+ * @fires {CustomEvent<TanreiListChangeDetail>} change - The user changed the selection: `detail.value` (single) or `detail.values` (multiple) after the change, which the list already holds.
602
+ * @fires {CustomEvent<TanreiListMoveDetail>} move - The user asked for an item to stand in another place, by a move button: `detail.from` is the item's index and `detail.to` the index it is to have, both from 0. Fired once per move; it bubbles and cannot be cancelled. The list has moved nothing: reorder your items.
603
+ */
604
+ export class TanreiList extends LitElement {
605
+ static { this.styles = [listStyles, hiddenHost]; }
606
+ static { this.properties = {
607
+ selection: { type: String, reflect: true },
608
+ label: { type: String },
609
+ value: { type: String },
610
+ values: { attribute: 'values', converter: { fromAttribute: parseValues } },
611
+ reorder: { type: String, reflect: true },
612
+ moveUpLabel: { type: String, attribute: 'move-up-label' },
613
+ moveDownLabel: { type: String, attribute: 'move-down-label' },
614
+ movedText: { type: String, attribute: 'moved-text' },
615
+ }; }
616
+ constructor() {
617
+ super();
618
+ this.availability = new AvailabilityController(this, 'list');
619
+ /** Whether people choose items: `none` shows or opens things; `single` chooses one; `multiple` any number. */
620
+ this.selection = 'none';
621
+ /** The accessible name of the list: what the items are. Required while `selection` is `single` or `multiple`. */
622
+ this.label = '';
623
+ /** The value of the selected option while `selection` is `single`; `null` selects none. */
624
+ this.value = null;
625
+ /** The values of the selected options while `selection` is `multiple`. Assign a new array to change it. */
626
+ this.values = [];
627
+ /**
628
+ * Whether people can put the items in another order: `none` fixes it; `buttons` draws in every item a button that
629
+ * moves it up and one that moves it down. The list fires `move` and never changes the order itself: the items are
630
+ * your data. Read only while `selection` is `none`, and every item of a reorderable list is static (LST-36). The
631
+ * spec's `drag` is not built yet: it is read as `buttons` and reported in debug builds.
632
+ */
633
+ this.reorder = 'none';
634
+ /** The accessible name of the button that moves an item up by one place, in your language. The item's headline is its description, so the words need not name the item. Empty reads the product's words (`setWords({ moveUpLabel })`); Tanrei has none, and without them the button works unnamed (LST-38). */
635
+ this.moveUpLabel = '';
636
+ /** The accessible name of the button that moves an item down by one place. As `moveUpLabel`. */
637
+ this.moveDownLabel = '';
638
+ /**
639
+ * The sentence assistive technology is told once an item stands in its new place. Write the whole sentence in your
640
+ * language and mark three places, which the list fills: `{headline}` with the moved item's headline, `{position}`
641
+ * with the place it now has, counted from 1, and `{count}` with the number of items. Empty reads the product's words
642
+ * (`setWords({ movedText })`); Tanrei has no sentence, and without one nothing is announced (LST-38).
643
+ */
644
+ this.movedText = '';
645
+ /** LST-15: the item that had focus last, which stays the tab stop. */
646
+ this.lastFocused = null;
647
+ this.keys = new RovingKeys({ wrap: false });
648
+ /** LST-38: the three words are the product's — this list's props, else the product's words, else nothing. */
649
+ this.words = new WordsController(this);
650
+ /** LST-38: the names of the two move buttons as found at the last render. */
651
+ this.upName = '';
652
+ this.downName = '';
653
+ /** LST-51: whether the controls of every item stand below its text. */
654
+ this.stacked = false;
655
+ /** LST-41: the move that was emitted and is not answered yet. */
656
+ this.pending = null;
657
+ /** LST-41, LST-52: where keyboard focus stands among the items' controls. */
658
+ this.held = null;
659
+ /** The record `keepFocus()` is returning focus to, until it has: a loss of focus meanwhile does not drop it. */
660
+ this.returning = null;
661
+ this.focusTurn = 0;
662
+ /** LST-43: where each item was drawn (its top, from the list's), and the motions that are running. */
663
+ this.places = new Map();
664
+ this.motions = new Map();
665
+ /** LST-43: the item the last move was asked for, drawn above the one it passes. */
666
+ this.raised = null;
667
+ /** Tells every item what it is now (LST-12, LST-15, LST-26, LST-36) and reports what a debug build should (LST-23, LST-26, LST-38). */
668
+ this.sync = () => {
669
+ // Before its first render the list has not read its own props — which words name the move buttons, whether it is
670
+ // reorderable — and its first render tells the items.
671
+ if (!this.hasUpdated)
672
+ return;
673
+ const items = this.items;
674
+ const selectable = this.mode !== 'none';
675
+ const reorder = this.reorderable;
676
+ const chosen = this.chosen;
677
+ const isSelected = (item) => selectable && chosen.has(item.value);
678
+ // LST-37: a reorderable list is not one tab stop — its items are static, and each button is a stop of its own.
679
+ const focusable = (item) => selectable || (!reorder && item.pressable);
680
+ // LST-15: the tab stop is the item focused last, else the first selected option, else the first enabled item (else
681
+ // the first that takes focus, so that a column of disabled items is still reached).
682
+ const candidates = items.filter(focusable);
683
+ const tabStop = (this.lastFocused && candidates.includes(this.lastFocused) ? this.lastFocused : null) ??
684
+ candidates.find(isSelected) ??
685
+ candidates.find((item) => !item.disabled) ??
686
+ candidates[0] ??
687
+ null;
688
+ const stacked = reorder && this.stacked;
689
+ items.forEach((item, index) => item.setListContext({ selectable, selected: isSelected(item), tabStop: item === tabStop, position: index + 1, size: items.length, reorder, stacked, moveUp: reorder ? this.upName : '', moveDown: reorder ? this.downName : '' }));
690
+ // LST-38: a word nobody gave, where the part that needs it is drawn — once per word and page.
691
+ if (reorder && items.length && this.isConnected) {
692
+ if (!this.upName)
693
+ this.words.missing('moveUpLabel', { id: 'LST-38', effect: 'the button that moves an item up is drawn and works, and has no accessible name' });
694
+ if (!this.downName)
695
+ this.words.missing('moveDownLabel', { id: 'LST-38', effect: 'the button that moves an item down is drawn and works, and has no accessible name' });
696
+ if (!this.words.get('movedText', this.movedText))
697
+ this.words.missing('movedText', { id: 'LST-38', effect: 'nothing is announced after an item was moved' });
698
+ }
699
+ this.settle(items);
700
+ this.scheduleReports();
701
+ };
702
+ this.reportFrame = 0;
703
+ /** The list's children changed: what each item is, where each is drawn, and where focus stands. */
704
+ this.onSlotChange = () => {
705
+ this.sync();
706
+ if (!this.reorderable)
707
+ return;
708
+ const items = this.items;
709
+ void this.placesChanged();
710
+ this.keepFocus(items);
711
+ this.itemDrawn();
712
+ };
713
+ /** LST-15: arrows, Home, End and typeahead move focus among the items that take it, without wrapping. */
714
+ this.onKeyDown = (event) => {
715
+ if (event.altKey || event.ctrlKey || event.metaKey)
716
+ return;
717
+ const item = itemOf(this, event);
718
+ if (!item || event.composedPath()[0] !== item.focusTarget)
719
+ return;
720
+ const items = this.items;
721
+ const current = items.indexOf(item);
722
+ const target = this.keys.target(event.key, current, items.map((each) => ({ focusable: this.mode !== 'none' || each.pressable, label: each.headline })));
723
+ if (target === null)
724
+ return;
725
+ // The key is the list's: it scrolls nothing and does not reach the item (a Space that continues a search is typed).
726
+ event.preventDefault();
727
+ event.stopPropagation();
728
+ if (target !== current)
729
+ items[target].focus();
730
+ };
731
+ this.onFocusIn = (event) => {
732
+ const item = itemOf(this, event);
733
+ // LST-41, LST-52: which control of which item holds focus in a reorderable list (a move button says so itself).
734
+ if (this.reorderable) {
735
+ const place = item?.placeOf(event) ?? null;
736
+ this.held = item && place ? { item, index: this.items.indexOf(item), place } : null;
737
+ return;
738
+ }
739
+ if (!item || event.composedPath()[0] !== item.focusTarget || item === this.lastFocused)
740
+ return;
741
+ this.lastFocused = item;
742
+ this.sync();
743
+ };
744
+ /**
745
+ * Focus left a control of a reorderable item. Where it went somewhere — another control, the page — the list holds
746
+ * nothing any more, and its live region is at rest (LST-42). Where the item was taken out of its place by the
747
+ * product, nothing took focus: the record stays, and `keepFocus()` reads it when the children have changed.
748
+ */
749
+ this.onFocusOut = (event) => {
750
+ const held = this.held;
751
+ if (!held)
752
+ return;
753
+ const next = event.relatedTarget;
754
+ if (next instanceof Node && this.contains(next))
755
+ return;
756
+ queueMicrotask(() => {
757
+ if (this.held !== held || this.items[held.index] !== held.item || focusWithin(this))
758
+ return;
759
+ // Focus is on its way back to this control (`keepFocus()`): the button it stood on was disabled under it at the
760
+ // end of the list, and a Button — one of its form's controls (BTN-29) — loses focus the moment it is disabled in
761
+ // one engine, before the control that takes it has drawn. The record stays until that turn is over.
762
+ if (this.returning === held)
763
+ return;
764
+ this.held = null;
765
+ this.announcer?.replaceChildren();
766
+ });
767
+ };
768
+ /** LST-13 / LST-14: activating an enabled option changes the selection and emits `change` once. */
769
+ this.onClick = (event) => {
770
+ const mode = this.mode;
771
+ if (mode === 'none')
772
+ return;
773
+ const item = itemOf(this, event);
774
+ // A disabled option swallows its clicks (LST-2); a click from inside its slots is its own.
775
+ if (!item || item.disabled)
776
+ return;
777
+ if (mode === 'single') {
778
+ // A single choice is never cleared by its own option.
779
+ if (this.value === item.value)
780
+ return;
781
+ this.value = item.value;
782
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value: this.value } }));
783
+ }
784
+ else {
785
+ const values = this.values ?? [];
786
+ this.values = values.includes(item.value) ? values.filter((each) => each !== item.value) : [...values, item.value];
787
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { values: [...this.values] } }));
788
+ }
789
+ };
790
+ this.addEventListener('keydown', this.onKeyDown, { capture: true });
791
+ this.addEventListener('click', this.onClick);
792
+ this.addEventListener('focusin', this.onFocusIn);
793
+ this.addEventListener('focusout', this.onFocusOut);
794
+ this.addEventListener('tanrei-list-item-update', this.sync);
795
+ }
796
+ /** The items, in order: the list's `<tanrei-list-item>` children. */
797
+ get items() {
798
+ return [...this.children].filter((child) => child instanceof TanreiListItem);
799
+ }
800
+ /** LST-7: a selection the list does not define is drawn as `none`. */
801
+ get mode() {
802
+ return SELECTIONS.includes(this.selection) ? this.selection : 'none';
803
+ }
804
+ /** LST-36: reorderable while nothing is chosen from it and `reorder` asks for the buttons (`drag` is read as them, until its handle is built). */
805
+ get reorderable() {
806
+ return this.mode === 'none' && (this.reorder === 'buttons' || this.reorder === 'drag');
807
+ }
808
+ /** LST-42: the one live region, while the list is reorderable. */
809
+ get announcer() {
810
+ return this.renderRoot?.querySelector('.announcer') ?? null;
811
+ }
812
+ /** LST-26: which values are selected now. */
813
+ get chosen() {
814
+ const mode = this.mode;
815
+ if (mode === 'single')
816
+ return new Set(this.value === null || this.value === undefined ? [] : [this.value]);
817
+ if (mode === 'multiple')
818
+ return new Set(this.values ?? []);
819
+ return new Set();
820
+ }
821
+ /**
822
+ * LST-26: an option without a value, a value two options share, and a selected value that names no option — reported a
823
+ * frame after the list changed, against what it holds then: while the page is still being parsed, or an item is still
824
+ * upgrading, the list is briefly without items or values it is about to have.
825
+ */
826
+ scheduleReports() {
827
+ if (this.reportFrame || this.mode === 'none')
828
+ return;
829
+ this.reportFrame = requestAnimationFrame(() => {
830
+ this.reportFrame = 0;
831
+ const items = this.items;
832
+ if (this.mode === 'none' || !this.isConnected)
833
+ return;
834
+ const seen = new Set();
835
+ items.forEach((item, index) => {
836
+ if (!item.value)
837
+ report(this, 'LST-26', `option ${index + 1} ("${item.headline}") has no value, so it can never be selected`);
838
+ else if (seen.has(item.value))
839
+ report(this, 'LST-26', `option ${index + 1} ("${item.headline}") repeats the value "${item.value}"; values must be unique within the list`);
840
+ seen.add(item.value);
841
+ });
842
+ for (const named of this.chosen)
843
+ if (!items.some((item) => item.value === named))
844
+ report(this, 'LST-26', `the selection names "${named}", which no option has as its value`);
845
+ });
846
+ }
847
+ /**
848
+ * @internal LST-39: a move button of `item` was activated. The list emits `move` once, with the index the item has
849
+ * and the one it is to have, and moves nothing: it waits for the product's order (LST-41).
850
+ */
851
+ requestMove(item, which) {
852
+ if (!this.reorderable)
853
+ return;
854
+ const items = this.items;
855
+ const from = items.indexOf(item);
856
+ const to = from + (which === 'up' ? -1 : 1);
857
+ if (from < 0 || to < 0 || to >= items.length)
858
+ return;
859
+ const button = item.moveButton(which);
860
+ const active = deepActive();
861
+ const focused = !!button && !!active && (active === button || !!button.shadowRoot?.contains(active));
862
+ // LST-43: where every item is drawn now, before the product gives another order.
863
+ this.recordPlaces(items);
864
+ this.raised = item;
865
+ if (this.pending)
866
+ clearTimeout(this.pending.timer);
867
+ const pending = { item, headline: item.headline, from, to, which, focused, before: items, headlines: items.map((each) => each.headline), timer: 0 };
868
+ this.pending = pending;
869
+ // LST-41: an order the product has not given within the reorder motion's time is a move it refused.
870
+ pending.timer = window.setTimeout(() => {
871
+ if (this.pending === pending)
872
+ this.pending = null;
873
+ }, this.motion().duration);
874
+ this.dispatchEvent(new CustomEvent('move', { bubbles: true, detail: { from, to } }));
875
+ // A product that reordered in its handler has answered already.
876
+ this.sync();
877
+ }
878
+ /**
879
+ * LST-41: whether the product has given the order that was asked for — the moved item stands at `to`, as the element
880
+ * it was or as a new one for the same content — and, if so, what follows: the announcement and the focus.
881
+ */
882
+ settle(items) {
883
+ const pending = this.pending;
884
+ if (!pending)
885
+ return;
886
+ if (!this.reorderable) {
887
+ clearTimeout(pending.timer);
888
+ this.pending = null;
889
+ return;
890
+ }
891
+ const at = items[pending.to];
892
+ if (!at)
893
+ return;
894
+ // A new element for the same content: the moved item's headline, on an element that did not stand there with it.
895
+ const again = at.headline === pending.headline && (at !== pending.before[pending.to] || pending.headlines[pending.to] !== pending.headline);
896
+ if (at !== pending.item && !again)
897
+ return;
898
+ clearTimeout(pending.timer);
899
+ this.pending = null;
900
+ if (this.raised === pending.item)
901
+ this.raised = at;
902
+ this.announce(at.headline, pending.to + 1, items.length);
903
+ if (!pending.focused)
904
+ return;
905
+ // The product may have taken focus for itself in its handler: then it is the product's.
906
+ const active = deepActive();
907
+ if (active && active !== document.body && active !== document.documentElement && !focusWithin(this))
908
+ return;
909
+ this.held = { item: at, index: pending.to, place: pending.which };
910
+ this.keepFocus(items, true);
911
+ }
912
+ /** The reorder motion's time (in milliseconds) and curve as the cascade computes them: a duration token is an expression (LST-41, LST-43). */
913
+ motion() {
914
+ const carrier = this.announcer;
915
+ if (!carrier)
916
+ return { duration: 0, easing: 'ease' };
917
+ const style = getComputedStyle(carrier);
918
+ const duration = Number.parseFloat(style.transitionDuration) * 1000;
919
+ return { duration: duration > 0 ? duration : 0, easing: style.transitionTimingFunction.split(/,(?![^(]*\))/)[0].trim() || 'ease' };
920
+ }
921
+ /**
922
+ * LST-42: the product's sentence with its places filled, put into the live region in place of what it held. The
923
+ * headline is a run of its own direction, isolated from the sentence (LST-30); the two numbers are written as the
924
+ * list's language writes a whole number. LST-38: without the sentence nothing is announced.
925
+ */
926
+ announce(headline, position, count) {
927
+ const region = this.announcer;
928
+ if (!region)
929
+ return;
930
+ const sentence = this.words.get('movedText', this.movedText);
931
+ if (!sentence) {
932
+ region.replaceChildren();
933
+ return;
934
+ }
935
+ const number = new Intl.NumberFormat(ambientLocale(this), { maximumFractionDigits: 0 });
936
+ // (A word with places is read in one place: src/primitives/places.ts.) Another text between braces and a
937
+ // brace that opens or closes nothing stay as they are written, and are reported.
938
+ const { runs } = fillPlaces(sentence, { headline, position: number.format(position), count: number.format(count) });
939
+ reportPlaces(this, 'LST-42', 'movedText', sentence, wordPlaces.movedText ?? [], 'it is announced as it is written');
940
+ region.replaceChildren(...runs.map((run) => {
941
+ if (run.place !== 'headline')
942
+ return run.text;
943
+ const name = document.createElement('bdi');
944
+ name.textContent = run.text;
945
+ return name;
946
+ }));
947
+ }
948
+ /**
949
+ * LST-41, LST-52: puts keyboard focus back on the control it was on. An element the product moves in the document, or
950
+ * replaces, loses focus without anything having taken it: the same control of the same item gets it back, or — the
951
+ * item gone — the control in the same place of the item that now stands where it stood, else of the one before it.
952
+ * Where that control is absent or disabled, the first control of that item that can take focus; where the list is
953
+ * empty or the item has none, focus is left to the product. `moved`: a move took effect, so focus goes to the moved
954
+ * item wherever the browser left it.
955
+ */
956
+ keepFocus(items, moved = false) {
957
+ const held = this.held;
958
+ if (!held || !this.reorderable)
959
+ return;
960
+ if (!moved) {
961
+ // Focus that stands somewhere was not lost: it is the person's, or the product's.
962
+ const active = deepActive();
963
+ if (active && active !== document.body && active !== document.documentElement && active.isConnected)
964
+ return;
965
+ }
966
+ let item = held.item;
967
+ let index = items.indexOf(item);
968
+ if (index < 0) {
969
+ if (!items.length) {
970
+ this.held = null;
971
+ return;
972
+ }
973
+ index = Math.min(held.index, items.length - 1);
974
+ item = items[index];
975
+ }
976
+ // LST-40: which controls can take focus is read from the item's place, not from a button that is still to be drawn.
977
+ const usable = (place) => {
978
+ if (place === 'up')
979
+ return index > 0;
980
+ if (place === 'down')
981
+ return index < items.length - 1;
982
+ const control = item.trailingControl;
983
+ return !!control && !isDisabledControl(control);
984
+ };
985
+ const place = [held.place, ...CONTROL_PLACES.filter((each) => each !== held.place)].find(usable);
986
+ if (!place)
987
+ return;
988
+ const returning = (this.held = { item, index, place });
989
+ this.returning = returning;
990
+ const turn = ++this.focusTurn;
991
+ void (async () => {
992
+ // The item draws its buttons for its new place, and the button enables itself, before it can take focus.
993
+ await item.updateComplete;
994
+ const control = item.control(place);
995
+ await control?.updateComplete;
996
+ if (this.returning === returning)
997
+ this.returning = null;
998
+ if (turn !== this.focusTurn || !control?.isConnected || this.held?.item !== item)
999
+ return;
1000
+ control.focus();
1001
+ })();
1002
+ }
1003
+ /** An item's top as it is laid out, from the window's: without what a running motion adds to it. */
1004
+ laidOut(item) {
1005
+ const top = item.getBoundingClientRect().top;
1006
+ if (!this.motions.has(item))
1007
+ return { top, offset: 0 };
1008
+ const transform = getComputedStyle(item).transform;
1009
+ const offset = transform && transform !== 'none' ? new DOMMatrixReadOnly(transform).m42 : 0;
1010
+ return { top: top - offset, offset };
1011
+ }
1012
+ /** LST-43: where every item is drawn now. Read when the list's box changes and when a move is asked for, never at rest. */
1013
+ recordPlaces(items = this.items) {
1014
+ if (!this.reorderable || !this.isConnected) {
1015
+ this.places.clear();
1016
+ return;
1017
+ }
1018
+ const origin = this.getBoundingClientRect().top;
1019
+ this.places = new Map(items.map((item) => [item, { top: this.laidOut(item).top - origin, headline: item.headline }]));
1020
+ }
1021
+ /**
1022
+ * LST-43: the order changed — every item whose place changed moves from where it was drawn to its new place, along
1023
+ * the list's axis, without fading or scaling, the focus ring with the item that holds it. An element the product
1024
+ * gave anew for an item it had is moved as that item; an item that is new or gone appears or leaves at once. Where
1025
+ * motion is reduced the new order is drawn at once.
1026
+ */
1027
+ async placesChanged() {
1028
+ let items = this.items;
1029
+ // A new element is measured once it has drawn itself (still before the frame is painted).
1030
+ const unfinished = items.filter((item) => !item.hasUpdated);
1031
+ if (unfinished.length) {
1032
+ await Promise.all(unfinished.map((item) => item.updateComplete));
1033
+ items = this.items;
1034
+ }
1035
+ if (!this.reorderable || !this.isConnected)
1036
+ return;
1037
+ const before = this.places;
1038
+ const origin = this.getBoundingClientRect().top;
1039
+ const gone = [...before].filter(([item]) => !items.includes(item));
1040
+ const next = new Map();
1041
+ const moving = [];
1042
+ for (const item of items) {
1043
+ const { top: absolute, offset } = this.laidOut(item);
1044
+ const top = absolute - origin;
1045
+ next.set(item, { top, headline: item.headline });
1046
+ let was = before.get(item)?.top;
1047
+ if (was === undefined) {
1048
+ // The same content on a new element: the one item that is gone and had this headline.
1049
+ const same = gone.filter(([, place]) => place.headline === item.headline);
1050
+ if (same.length !== 1)
1051
+ continue;
1052
+ was = same[0][1].top;
1053
+ if (this.raised === same[0][0])
1054
+ this.raised = item;
1055
+ }
1056
+ if (Math.abs(was - top) >= 0.5)
1057
+ moving.push([item, was + offset - top]);
1058
+ }
1059
+ this.places = next;
1060
+ for (const [item, motion] of this.motions) {
1061
+ if (items.includes(item))
1062
+ continue;
1063
+ this.motions.delete(item);
1064
+ motion.cancel();
1065
+ }
1066
+ if (!moving.length)
1067
+ return;
1068
+ const { duration, easing } = this.motion();
1069
+ const still = !duration || (typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches);
1070
+ for (const [item, from] of moving) {
1071
+ const running = this.motions.get(item);
1072
+ if (running) {
1073
+ this.motions.delete(item);
1074
+ running.cancel();
1075
+ }
1076
+ if (still || typeof item.animate !== 'function')
1077
+ continue;
1078
+ const lift = item === this.raised ? { zIndex: 1 } : {};
1079
+ const frames = [
1080
+ { transform: `translateY(${from}px)`, ...lift },
1081
+ { transform: 'translateY(0)', ...lift },
1082
+ ];
1083
+ let motion;
1084
+ try {
1085
+ motion = item.animate(frames, { duration, easing });
1086
+ }
1087
+ catch {
1088
+ motion = item.animate(frames, { duration, easing: 'ease' });
1089
+ }
1090
+ this.motions.set(item, motion);
1091
+ const done = () => {
1092
+ if (this.motions.get(item) === motion)
1093
+ this.motions.delete(item);
1094
+ };
1095
+ motion.finished.then(done, done);
1096
+ }
1097
+ }
1098
+ /**
1099
+ * @internal LST-51: an item drew its controls, or they changed size: the list measures once, after all of them — and
1100
+ * with every other list that was told in this turn (`measureTogether`).
1101
+ */
1102
+ itemDrawn() {
1103
+ measureTogether(this);
1104
+ }
1105
+ /** @internal LST-51: whether the controls of any item would leave its text less than half its row — a reading of the layout; null where there is nothing to ask. */
1106
+ readStacked() {
1107
+ return this.isConnected ? this.reorderable && this.items.some((item) => item.squeezed) : null;
1108
+ }
1109
+ /** @internal LST-51: the controls of every item stand on a line of their own, or beside the text — all rows at once, so that the buttons stand under each other. */
1110
+ showStacked(stacked) {
1111
+ if (stacked === null || stacked === this.stacked)
1112
+ return;
1113
+ this.stacked = stacked;
1114
+ this.sync();
1115
+ }
1116
+ /**
1117
+ * LST-51: where the controls of any item would leave its text less than half its row, the controls of every item
1118
+ * stand on a line of their own.
1119
+ */
1120
+ measureStacked() {
1121
+ this.showStacked(this.readStacked());
1122
+ }
1123
+ /** @internal LST-41, LST-52: a control of `item` took keyboard focus. */
1124
+ controlFocused(item, place) {
1125
+ if (this.reorderable)
1126
+ this.held = { item, index: this.items.indexOf(item), place };
1127
+ }
1128
+ connectedCallback() {
1129
+ super.connectedCallback();
1130
+ if (this.hasUpdated && this.reorderable)
1131
+ this.resize?.observe(this);
1132
+ }
1133
+ disconnectedCallback() {
1134
+ super.disconnectedCallback();
1135
+ this.resize?.disconnect();
1136
+ if (this.pending)
1137
+ clearTimeout(this.pending.timer);
1138
+ this.pending = null;
1139
+ this.held = null;
1140
+ for (const motion of this.motions.values())
1141
+ motion.cancel();
1142
+ this.motions.clear();
1143
+ this.places.clear();
1144
+ }
1145
+ willUpdate(changed) {
1146
+ // LST-7: a selection the list does not define is drawn as none; a debug build says so.
1147
+ if (changed.has('selection') && !SELECTIONS.includes(this.selection)) {
1148
+ report(this, 'LST-7', `selection "${this.selection}" is not a value the list defines; it is drawn as "none"`);
1149
+ }
1150
+ // LST-7: and so is a reorder it does not define.
1151
+ if (changed.has('reorder') && !REORDERS.includes(this.reorder)) {
1152
+ report(this, 'LST-7', `reorder "${this.reorder}" is not a value the list defines; it is drawn as "none"`);
1153
+ }
1154
+ // The spec's third value waits for its handle: the two buttons, which are complete by themselves, are drawn (LST-36).
1155
+ if (changed.has('reorder') && this.reorder === 'drag') {
1156
+ report(this, 'LST-44', 'reorder "drag" is not built on the web yet: the two move buttons are drawn and no handle, as for "buttons"');
1157
+ }
1158
+ // LST-38: the names of the move buttons — this list's props, else the product's words, else none.
1159
+ this.upName = this.words.get('moveUpLabel', this.moveUpLabel);
1160
+ this.downName = this.words.get('moveDownLabel', this.moveDownLabel);
1161
+ }
1162
+ updated(changed) {
1163
+ const mode = this.mode;
1164
+ // LST-12: a list, or a listbox named by label (multi-selectable while selection is multiple). LST-42: a reorderable
1165
+ // list is a list inside the host, beside its live region (render()), and the host has no role of its own.
1166
+ hostAria(this, {
1167
+ role: this.reorderable ? null : mode === 'none' ? 'list' : 'listbox',
1168
+ 'aria-label': this.reorderable ? null : this.label || null,
1169
+ 'aria-multiselectable': mode === 'multiple' ? 'true' : null,
1170
+ });
1171
+ // LST-23: a listbox without a name; a debug build says so.
1172
+ if ((changed.has('label') || changed.has('selection')) && mode !== 'none' && !this.label.trim()) {
1173
+ report(this, 'LST-23', 'a selectable list has no label, so the listbox has no accessible name; say what the options are');
1174
+ }
1175
+ // LST-36: an option cannot hold a button, so a selectable list is never reorderable; a debug build says so.
1176
+ if ((changed.has('reorder') || changed.has('selection')) && mode !== 'none' && REORDERS.includes(this.reorder) && this.reorder !== 'none') {
1177
+ report(this, 'LST-36', `reorder "${this.reorder}" is ignored while selection is "${mode}": an option cannot hold the buttons that move it`);
1178
+ }
1179
+ // LST-43, LST-51: the list's own box is watched only while it is reorderable — where its items are drawn, and
1180
+ // whether their controls still fit beside their text.
1181
+ if (this.reorderable) {
1182
+ if (!this.resize && typeof ResizeObserver !== 'undefined') {
1183
+ this.resize = new ResizeObserver(() => {
1184
+ this.recordPlaces();
1185
+ this.measureStacked();
1186
+ });
1187
+ }
1188
+ this.resize?.observe(this);
1189
+ }
1190
+ else {
1191
+ this.resize?.disconnect();
1192
+ this.places.clear();
1193
+ this.held = null;
1194
+ this.stacked = false;
1195
+ }
1196
+ this.sync();
1197
+ }
1198
+ render() {
1199
+ if (!this.reorderable)
1200
+ return html `<slot @slotchange=${this.onSlotChange}></slot>`;
1201
+ // LST-42: one live region of the list's own while it is reorderable — a status: polite, announced whole, empty at
1202
+ // rest, drawn nowhere. A list's children are list items and nothing else, so the list role is then carried by a box
1203
+ // of the shadow root around the items, and the region stands beside it. The region also carries the reorder
1204
+ // motion's time and curve for the script to read (a duration token is an expression).
1205
+ return html `<div class="items" role="list" aria-label=${this.label || nothing}><slot @slotchange=${this.onSlotChange}></slot></div
1206
+ ><span class="quiet"><span class="announcer" role="status" aria-live="polite"></span></span>`;
1207
+ }
1208
+ }
1209
+ /**
1210
+ * LST-51: the lists that measure in this turn, read together and then written. A list measured in a microtask of its
1211
+ * own, between the renders of the other lists' items, would have the page styled and laid out for itself. One
1212
+ * microtask reads them all — one layout — and only then does any of them change how its rows stand.
1213
+ */
1214
+ const toMeasure = new Set();
1215
+ function measureTogether(list) {
1216
+ if (!toMeasure.size) {
1217
+ queueMicrotask(() => {
1218
+ const lists = [...toMeasure];
1219
+ toMeasure.clear();
1220
+ const stacked = lists.map((each) => each.readStacked());
1221
+ lists.forEach((each, n) => each.showStacked(stacked[n]));
1222
+ });
1223
+ }
1224
+ toMeasure.add(list);
1225
+ }
1226
+ if (!customElements.get('tanrei-list-item'))
1227
+ customElements.define('tanrei-list-item', TanreiListItem);
1228
+ if (!customElements.get('tanrei-list'))
1229
+ customElements.define('tanrei-list', TanreiList);
1230
+ //# sourceMappingURL=list.js.map