@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,1228 @@
1
+ import { ReactiveElement } from 'lit';
2
+ import { AvailabilityController, PressController, RovingKeys, findInteractive, lineArrow, report, styleQueries, syncFocusStyle } from '../../primitives/index.js';
3
+ import { PendingGlyphs, isGlyphProbe } from '../../primitives/glyph-pending.js';
4
+ import { debugBuild } from '../../primitives/report.js';
5
+ import { WordsController } from '../../primitives/words.js';
6
+ import '../loading-indicator/loading-indicator.js';
7
+ import { adopt, adoptUnlessDrawn } from '../../primitives/sheets.js';
8
+ const TREE_VIEW_CSS = (() => {
9
+ try {
10
+ return "@layer tanrei.components {\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::after {\n--tanrei-corner-pill: 0;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::after {\n--_corner-scale: 1;\nborder-radius: calc(var(--tanrei-corner-radius) * var(--_corner-scale));\n}\n@supports (corner-shape: superellipse(log(2, 2))) {\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::after {\n--_corner-smoothing: calc(var(--tanrei-sys-shape-corner-smoothing, 0) * (1 - var(--tanrei-corner-pill, 0)));\n--_corner-scale: calc(1 + 0.4 * var(--_corner-smoothing));\ncorner-shape: superellipse(log(calc(2 + var(--_corner-smoothing)), 2));\n}\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where(.ripple) {\n--tanrei-corner-pill: 0;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where(.ripple) {\n--_corner-scale: 1;\nborder-radius: calc(var(--tanrei-corner-radius) * var(--_corner-scale));\n}\n@supports (corner-shape: superellipse(log(2, 2))) {\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where(.ripple) {\n--_corner-smoothing: calc(var(--tanrei-sys-shape-corner-smoothing, 0) * (1 - var(--tanrei-corner-pill, 0)));\n--_corner-scale: calc(1 + 0.4 * var(--_corner-smoothing));\ncorner-shape: superellipse(log(calc(2 + var(--_corner-smoothing)), 2));\n}\n}\n:where(tanrei-tree-view) {\n--_trv-height: var(--tanrei-comp-tree-view-container-height-regular);\n--_trv-pad-block: var(--tanrei-comp-tree-view-container-padding-block-regular);\n--_trv-pad-inline: var(--tanrei-comp-tree-view-container-padding-inline-regular);\n--_trv-gap: var(--tanrei-comp-tree-view-container-gap-regular);\n--_trv-indent: var(--tanrei-comp-tree-view-level-indent-regular);\n--_trv-label-font: var(--tanrei-comp-tree-view-label-typescale-regular-font);\n--_trv-label-tracking: var(--tanrei-comp-tree-view-label-typescale-regular-letter-spacing);\n--_trv-icon-size: var(--tanrei-comp-tree-view-icon-size-regular);\n--_trv-chevron-size: var(--tanrei-comp-tree-view-chevron-size-regular);\n--_trv-min: max(var(--_trv-height), var(--tanrei-sys-target-pointer));\n--_trv-target: var(--tanrei-sys-target-pointer);\n--_trv-from: calc(var(--_trv-indent) * -1);\n--_trv-start: left;\n--_trv-after-left: 0px;\n--_trv-after-right: var(--_trv-gap);\n--_trv-rtl: 0;\n--_trv-turn: 0.25turn;\n--_trv-mirror: none;\n--_trv-guide-color: var(--tanrei-comp-tree-view-guide-color);\ndisplay: block;\nbox-sizing: border-box;\nmargin: 0;\npadding: 0;\nobject-position: var(--_trv-indent) var(--_trv-target);\n}\n:where(tanrei-tree-view[hidden]) {\ndisplay: none;\n}\n:where(tanrei-tree-view):dir(rtl) {\n--_trv-start: right;\n--_trv-after-left: var(--_trv-gap);\n--_trv-after-right: 0px;\n--_trv-rtl: 1;\n--_trv-turn: -0.25turn;\n--_trv-mirror: -1 1;\n}\n:where(tanrei-tree-view[density='compact']) {\n--_trv-height: var(--tanrei-comp-tree-view-container-height-compact);\n--_trv-pad-block: var(--tanrei-comp-tree-view-container-padding-block-compact);\n--_trv-pad-inline: var(--tanrei-comp-tree-view-container-padding-inline-compact);\n--_trv-gap: var(--tanrei-comp-tree-view-container-gap-compact);\n--_trv-indent: var(--tanrei-comp-tree-view-level-indent-compact);\n--_trv-label-font: var(--tanrei-comp-tree-view-label-typescale-compact-font);\n--_trv-label-tracking: var(--tanrei-comp-tree-view-label-typescale-compact-letter-spacing);\n--_trv-icon-size: var(--tanrei-comp-tree-view-icon-size-compact);\n--_trv-chevron-size: var(--tanrei-comp-tree-view-chevron-size-compact);\n--_trv-min: var(--_trv-height);\n}\n@media (pointer: coarse) {\n:where(tanrei-tree-view) {\n--_trv-min: max(var(--_trv-height), var(--tanrei-sys-target-touch));\n--_trv-target: var(--tanrei-sys-target-touch);\n}\n}\n:where(tanrei-tree-view) :where(ul, ol) {\n--_trv-in: calc(var(--_trv-from) + var(--_trv-indent));\ndisplay: block;\nbox-sizing: border-box;\nmargin: 0;\npadding: 0;\nlist-style: none;\ntransition: --_trv-disclosure var(--tanrei-comp-tree-view-motion-disclosure-duration) var(--tanrei-comp-tree-view-motion-disclosure-easing);\n}\n:where(tanrei-tree-view) :where(li) {\n--_trv-from: var(--_trv-in);\n--_trv-at: min(var(--_trv-in), 50%);\ndisplay: block;\nbox-sizing: border-box;\nmargin: 0;\npadding: 0;\n}\n@supports (inline-size: round(down, 50%, 1px)) {\n:where(tanrei-tree-view) :where(li) {\n--_trv-at: min(var(--_trv-in), round(down, 50%, var(--_trv-indent)));\n}\n}\n:where(tanrei-tree-view) :where(li:not([data-open])) > :where(ul, ol) {\ndisplay: none;\n}\n:where(tanrei-tree-view) :where(li:not([data-open])) > :where(ul[hidden='until-found'], ol[hidden='until-found']) {\ndisplay: block;\ncontent-visibility: hidden;\n}\n:where(tanrei-tree-view) :where(li) > :where(ul[data-tanrei-moving], ol[data-tanrei-moving]) {\ndisplay: block;\noverflow: clip;\ncontent-visibility: visible;\n}\n:where(tanrei-tree-view:not(:defined)) :where(li[data-loading][data-open]:is([data-expandable], :has(> ul, > ol)))::after {\ncontent: '';\ndisplay: block;\nblock-size: var(--_trv-min);\n}\n:where(tanrei-tree-view[guides]) :where(li) > :where(ul, ol) {\nposition: relative;\n}\n:where(tanrei-tree-view[guides]) :where(li) > :where(ul, ol)::before {\ncontent: '';\nposition: absolute;\nz-index: 1;\ninset-block: 0;\ninset-inline-start: calc(var(--_trv-at) + var(--_trv-pad-inline) + (var(--_trv-chevron-size) - var(--tanrei-comp-tree-view-guide-width)) / 2);\nborder-inline-start: var(--tanrei-comp-tree-view-guide-width) solid var(--_trv-guide-color);\npointer-events: none;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) {\n--_trv-container: var(--tanrei-comp-tree-view-unselected-container-color);\n--_trv-label: var(--tanrei-comp-tree-view-unselected-label-color);\n--_trv-supporting: var(--tanrei-comp-tree-view-unselected-supporting-text-color);\n--_trv-trailing: var(--tanrei-comp-tree-view-unselected-trailing-text-color);\n--_trv-icon: var(--tanrei-comp-tree-view-unselected-icon-color);\n--_trv-chevron: var(--tanrei-comp-tree-view-unselected-chevron-color);\n--_trv-hovered-container: var(--tanrei-comp-tree-view-unselected-hovered-container-color);\n--_trv-hovered-label: var(--tanrei-comp-tree-view-unselected-hovered-label-color);\n--_trv-hovered-supporting: var(--tanrei-comp-tree-view-unselected-hovered-supporting-text-color);\n--_trv-hovered-trailing: var(--tanrei-comp-tree-view-unselected-hovered-trailing-text-color);\n--_trv-hovered-icon: var(--tanrei-comp-tree-view-unselected-hovered-icon-color);\n--_trv-hovered-chevron: var(--tanrei-comp-tree-view-unselected-hovered-chevron-color);\n--_trv-focused-container: var(--tanrei-comp-tree-view-unselected-focused-container-color);\n--_trv-focused-label: var(--tanrei-comp-tree-view-unselected-focused-label-color);\n--_trv-focused-supporting: var(--tanrei-comp-tree-view-unselected-focused-supporting-text-color);\n--_trv-focused-trailing: var(--tanrei-comp-tree-view-unselected-focused-trailing-text-color);\n--_trv-focused-icon: var(--tanrei-comp-tree-view-unselected-focused-icon-color);\n--_trv-focused-chevron: var(--tanrei-comp-tree-view-unselected-focused-chevron-color);\n--_trv-pressed-container: var(--tanrei-comp-tree-view-unselected-pressed-container-color);\n--_trv-pressed-label: var(--tanrei-comp-tree-view-unselected-pressed-label-color);\n--_trv-pressed-supporting: var(--tanrei-comp-tree-view-unselected-pressed-supporting-text-color);\n--_trv-pressed-trailing: var(--tanrei-comp-tree-view-unselected-pressed-trailing-text-color);\n--_trv-pressed-icon: var(--tanrei-comp-tree-view-unselected-pressed-icon-color);\n--_trv-pressed-chevron: var(--tanrei-comp-tree-view-unselected-pressed-chevron-color);\n--_trv-disabled-container: var(--tanrei-comp-tree-view-unselected-disabled-container-color);\n--_trv-disabled-label: var(--tanrei-comp-tree-view-unselected-disabled-label-color);\n--_trv-disabled-supporting: var(--tanrei-comp-tree-view-unselected-disabled-supporting-text-color);\n--_trv-disabled-trailing: var(--tanrei-comp-tree-view-unselected-disabled-trailing-text-color);\n--_trv-disabled-icon: var(--tanrei-comp-tree-view-unselected-disabled-icon-color);\n--_trv-disabled-chevron: var(--tanrei-comp-tree-view-unselected-disabled-chevron-color);\n--_trv-icon-fill: var(--tanrei-sys-icon-fill-unselected);\n--_trv-icon-family: var(--tanrei-sys-icon-family-unselected);\n--_trv-now-container: var(--_trv-container);\n--_trv-now-label: var(--_trv-label);\n--_trv-now-supporting: var(--_trv-supporting);\n--_trv-now-trailing: var(--_trv-trailing);\n--_trv-now-icon: var(--_trv-icon);\n--_trv-now-chevron: var(--_trv-chevron);\nposition: relative;\nisolation: isolate;\ndisplay: grid;\n--_trv-lead: calc(var(--_trv-chevron-size) + var(--_trv-gap));\ngrid-template-columns: [lead] auto [text] minmax(0, 1fr) [trailing] auto [value] fit-content(calc((100% - var(--_trv-lead)) / 2));\nalign-content: center;\nalign-items: start;\nbox-sizing: border-box;\nmin-block-size: var(--_trv-min);\nmargin: 0;\npadding-block: var(--_trv-pad-block);\npadding-inline: calc(var(--_trv-at) + var(--_trv-pad-inline)) var(--_trv-pad-inline);\nfont: var(--_trv-label-font);\nletter-spacing: var(--_trv-label-tracking);\ncolor: var(--_trv-now-label);\ntext-align: var(--_trv-start);\noverflow-wrap: anywhere;\nunicode-bidi: plaintext;\ncursor: default;\n-webkit-tap-highlight-color: transparent;\ntransition:\n--_trv-hold 0s linear var(--tanrei-sys-motion-duration-press-hold),\ncolor var(--tanrei-comp-tree-view-motion-state-duration) var(--tanrei-comp-tree-view-motion-state-easing),\nopacity var(--tanrei-comp-tree-view-motion-state-duration) var(--tanrei-comp-tree-view-motion-state-easing);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol):has(> .tanrei-icon)) {\n--_trv-lead: calc(var(--_trv-chevron-size) + var(--_trv-icon-size) + var(--_trv-gap) * 2);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)[aria-selected='true']) {\n--_trv-container: var(--tanrei-comp-tree-view-selected-container-color);\n--_trv-label: var(--tanrei-comp-tree-view-selected-label-color);\n--_trv-supporting: var(--tanrei-comp-tree-view-selected-supporting-text-color);\n--_trv-trailing: var(--tanrei-comp-tree-view-selected-trailing-text-color);\n--_trv-icon: var(--tanrei-comp-tree-view-selected-icon-color);\n--_trv-chevron: var(--tanrei-comp-tree-view-selected-chevron-color);\n--_trv-hovered-container: var(--tanrei-comp-tree-view-selected-hovered-container-color);\n--_trv-hovered-label: var(--tanrei-comp-tree-view-selected-hovered-label-color);\n--_trv-hovered-supporting: var(--tanrei-comp-tree-view-selected-hovered-supporting-text-color);\n--_trv-hovered-trailing: var(--tanrei-comp-tree-view-selected-hovered-trailing-text-color);\n--_trv-hovered-icon: var(--tanrei-comp-tree-view-selected-hovered-icon-color);\n--_trv-hovered-chevron: var(--tanrei-comp-tree-view-selected-hovered-chevron-color);\n--_trv-focused-container: var(--tanrei-comp-tree-view-selected-focused-container-color);\n--_trv-focused-label: var(--tanrei-comp-tree-view-selected-focused-label-color);\n--_trv-focused-supporting: var(--tanrei-comp-tree-view-selected-focused-supporting-text-color);\n--_trv-focused-trailing: var(--tanrei-comp-tree-view-selected-focused-trailing-text-color);\n--_trv-focused-icon: var(--tanrei-comp-tree-view-selected-focused-icon-color);\n--_trv-focused-chevron: var(--tanrei-comp-tree-view-selected-focused-chevron-color);\n--_trv-pressed-container: var(--tanrei-comp-tree-view-selected-pressed-container-color);\n--_trv-pressed-label: var(--tanrei-comp-tree-view-selected-pressed-label-color);\n--_trv-pressed-supporting: var(--tanrei-comp-tree-view-selected-pressed-supporting-text-color);\n--_trv-pressed-trailing: var(--tanrei-comp-tree-view-selected-pressed-trailing-text-color);\n--_trv-pressed-icon: var(--tanrei-comp-tree-view-selected-pressed-icon-color);\n--_trv-pressed-chevron: var(--tanrei-comp-tree-view-selected-pressed-chevron-color);\n--_trv-disabled-container: var(--tanrei-comp-tree-view-selected-disabled-container-color);\n--_trv-disabled-label: var(--tanrei-comp-tree-view-selected-disabled-label-color);\n--_trv-disabled-supporting: var(--tanrei-comp-tree-view-selected-disabled-supporting-text-color);\n--_trv-disabled-trailing: var(--tanrei-comp-tree-view-selected-disabled-trailing-text-color);\n--_trv-disabled-icon: var(--tanrei-comp-tree-view-selected-disabled-icon-color);\n--_trv-disabled-chevron: var(--tanrei-comp-tree-view-selected-disabled-chevron-color);\n--_trv-icon-fill: var(--tanrei-sys-icon-fill-selected);\n--_trv-icon-family: var(--tanrei-sys-icon-family-selected);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::after {\n--tanrei-corner-radius: var(--tanrei-comp-tree-view-container-shape);\n--tanrei-corner-pill: var(--tanrei-comp-tree-view-container-shape-pill, 0);\ncontent: '';\nposition: absolute;\nz-index: -1;\ninset: 0;\ninset-inline-start: var(--_trv-at);\nbox-sizing: border-box;\nbackground-color: var(--_trv-now-container);\npointer-events: none;\ntransition: background-color var(--tanrei-comp-tree-view-motion-state-duration) var(--tanrei-comp-tree-view-motion-state-easing);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::before {\ncontent: '';\ngrid-column: lead;\ngrid-row: 1;\ndisplay: flex;\nalign-items: center;\noverflow: hidden;\ninline-size: var(--_trv-chevron-size);\nblock-size: var(--_trv-chevron-size);\nmargin-block: calc((1lh - var(--_trv-chevron-size)) / 2) 0;\nmargin-left: var(--_trv-after-left);\nmargin-right: var(--_trv-after-right);\nfont-family: var(--tanrei-sys-icon-family-unselected);\nfont-size: var(--_trv-chevron-size);\nfont-style: normal;\nfont-weight: normal;\nline-height: 1lh;\nletter-spacing: normal;\ntext-transform: none;\nwhite-space: nowrap;\nword-wrap: normal;\ndirection: ltr;\ncolor: var(--_trv-now-chevron);\npointer-events: none;\nfont-feature-settings: 'liga';\n-webkit-font-smoothing: antialiased;\nfont-optical-sizing: auto;\nfont-variation-settings:\n'FILL' var(--tanrei-sys-icon-fill-unselected),\n'wght' var(--tanrei-sys-icon-weight),\n'GRAD' 0;\nopacity: var(--tanrei-icons, 0);\nscale: var(--_trv-mirror);\ntransition:\nrotate var(--tanrei-comp-tree-view-motion-disclosure-duration) var(--tanrei-comp-tree-view-motion-disclosure-easing),\ncolor var(--tanrei-comp-tree-view-motion-state-duration) var(--tanrei-comp-tree-view-motion-state-easing);\n}\n@supports (font-variation-settings: 'opsz' tan(atan2(1em, 1px))) {\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::before {\nfont-variation-settings: 'FILL' var(--tanrei-sys-icon-fill-unselected), 'wght' var(--tanrei-sys-icon-weight), 'GRAD' 0, 'opsz' clamp(var(--tanrei-sys-icon-optical-size-min), tan(atan2(var(--_trv-chevron-size), 1px)), var(--tanrei-sys-icon-optical-size-max));\n}\n}\n:where(tanrei-tree-view) :where(li:not([data-tanrei-leaf])) > :where(:first-child:not(ul, ol, :only-child))::before,\n:where(tanrei-tree-view) :where(li[data-expandable]) > :where(:first-child:not(ul, ol))::before {\ncontent: 'chevron_right';\ncontent: 'chevron_right' / '';\n}\n:where(tanrei-tree-view) :where(li[data-open]) > :where(:first-child:not(ul, ol))::before {\nrotate: var(--_trv-turn);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where(:not(.tanrei-icon, [data-supporting-text], [data-trailing], [data-trailing-text], [data-tanrei-loading-box], .ripple)) {\ngrid-column: text;\ngrid-row: 1;\nmin-inline-size: 0;\nmargin: 0;\npadding: 0;\nfont: inherit;\nletter-spacing: inherit;\ncolor: inherit;\ntext-align: inherit;\nunicode-bidi: plaintext;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where(:not(.tanrei-icon, [data-supporting-text], [data-trailing], [data-trailing-text], [data-tanrei-loading-box], .ripple):has(> bdi, > [dir])) {\nunicode-bidi: isolate;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) :where([data-supporting-text]) {\nmargin-inline-start: var(--_trv-gap);\nfont: var(--tanrei-comp-tree-view-supporting-text-typescale-font);\nletter-spacing: var(--tanrei-comp-tree-view-supporting-text-typescale-letter-spacing);\ncolor: var(--_trv-now-supporting);\nunicode-bidi: plaintext;\ntransition: color var(--tanrei-comp-tree-view-motion-state-duration) var(--tanrei-comp-tree-view-motion-state-easing);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where(*) :where([data-supporting-text])::before {\ncontent: '\\200B';\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where([data-supporting-text]) {\ndisplay: contents;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where([data-trailing]) {\ngrid-column: trailing;\ngrid-row: 1;\ndisplay: flex;\nalign-items: center;\nmin-inline-size: 0;\nline-height: 1lh;\nblock-size: 1lh;\nmargin-left: var(--_trv-after-right);\nmargin-right: var(--_trv-after-left);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where([data-trailing-text]) {\ngrid-column: value;\ngrid-row: 1;\nmin-inline-size: 0;\nmargin-left: var(--_trv-after-right);\nmargin-right: var(--_trv-after-left);\noverflow: hidden;\nfont: var(--tanrei-comp-tree-view-trailing-text-typescale-font);\nline-height: 1lh;\nletter-spacing: var(--tanrei-comp-tree-view-trailing-text-typescale-letter-spacing);\ncolor: var(--_trv-now-trailing);\ntext-align: start;\ntext-overflow: ellipsis;\nwhite-space: nowrap;\nunicode-bidi: plaintext;\ntransition: color var(--tanrei-comp-tree-view-motion-state-duration) var(--tanrei-comp-tree-view-motion-state-easing);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > .tanrei-icon.tanrei-icon {\n--_size: var(--_trv-icon-size);\n--_fill: var(--_trv-icon-fill);\n--_family: var(--_trv-icon-family);\ngrid-column: lead;\ngrid-row: 1;\ndisplay: flex;\nalign-items: center;\nline-height: 1lh;\nmargin-block-start: calc((1lh - var(--_trv-icon-size)) / 2);\nmargin-left: calc(var(--_trv-gap) + var(--_trv-chevron-size) * (1 - var(--_trv-rtl)));\nmargin-right: calc(var(--_trv-gap) + var(--_trv-chevron-size) * var(--_trv-rtl));\ncolor: var(--_trv-now-icon);\nvertical-align: baseline;\n}\n:where(tanrei-tree-view[data-glyphs='pending']) :where(li) > :where(:first-child:not(ul, ol))::before,\n:where(tanrei-tree-view[data-glyphs='pending']) :where(li) > :where(:first-child:not(ul, ol)) > :where(.tanrei-icon) {\nvisibility: hidden;\n}\n:where(tanrei-tree-view) :where(li[data-tanrei-loading]) > :where(:first-child)::before {\ncontent: none;\n}\n:where(tanrei-tree-view) :where(li[data-tanrei-loading]) > :where(:first-child) > :where([data-tanrei-loading-box]) {\ngrid-column: lead;\ngrid-row: 1;\ndisplay: grid;\nplace-items: center;\ninline-size: var(--_trv-chevron-size);\nblock-size: 1lh;\nmargin-inline-end: var(--_trv-gap);\n}\n:where(tanrei-tree-view) :where(li[data-tanrei-loading]) > :where(:first-child) > :where([data-tanrei-loading-label]) {\nfont: var(--tanrei-comp-tree-view-supporting-text-typescale-font);\nletter-spacing: var(--tanrei-comp-tree-view-supporting-text-typescale-letter-spacing);\ncolor: var(--tanrei-comp-tree-view-unselected-supporting-text-color);\n}\n:where(tanrei-tree-view) :where(li:not([data-disabled], [data-tanrei-leaf])) > :where(:first-child:not(ul, ol, :only-child)),\n:where(tanrei-tree-view) :where(li[data-expandable]:not([data-disabled])) > :where(:first-child:not(ul, ol)),\n:where(tanrei-tree-view:is([selection='single'], [selection='multiple'])) :where(li[data-value]:not([data-value=''], [data-disabled])) > :where(:first-child:not(ul, ol)) {\ncursor: pointer;\n-webkit-user-select: none;\nuser-select: none;\n}\n@media (hover: hover) {\n:where(tanrei-tree-view) :where(li:not([data-disabled], [data-tanrei-leaf])) > :where(:first-child:not(ul, ol, :only-child):hover),\n:where(tanrei-tree-view) :where(li[data-expandable]:not([data-disabled])) > :where(:first-child:not(ul, ol):hover),\n:where(tanrei-tree-view:is([selection='single'], [selection='multiple'])) :where(li[data-value]:not([data-value=''], [data-disabled])) > :where(:first-child:not(ul, ol):hover) {\n--_trv-now-container: var(--_trv-hovered-container);\n--_trv-now-label: var(--_trv-hovered-label);\n--_trv-now-supporting: var(--_trv-hovered-supporting);\n--_trv-now-trailing: var(--_trv-hovered-trailing);\n--_trv-now-icon: var(--_trv-hovered-icon);\n--_trv-now-chevron: var(--_trv-hovered-chevron);\nopacity: var(--tanrei-comp-tree-view-hovered-opacity);\n}\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol):focus-visible) {\n--_trv-now-container: var(--_trv-focused-container);\n--_trv-now-label: var(--_trv-focused-label);\n--_trv-now-supporting: var(--_trv-focused-supporting);\n--_trv-now-trailing: var(--_trv-focused-trailing);\n--_trv-now-icon: var(--_trv-focused-icon);\n--_trv-now-chevron: var(--_trv-focused-chevron);\nopacity: var(--tanrei-comp-tree-view-focused-opacity);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol):focus-visible)::after {\nborder: var(--tanrei-sys-focus-outer-width) solid var(--tanrei-sys-color-focus-ring);\noutline: var(--tanrei-sys-focus-inner-width) solid var(--tanrei-sys-color-focus-ring-inner);\noutline-offset: calc((var(--tanrei-sys-focus-outer-width) + var(--tanrei-sys-focus-inner-width)) * -1);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol):focus) {\noutline: none;\n}\n@container style(--tanrei-sys-behavior-focus-style: glow) {\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol):focus-visible)::after {\n--_trv-glow: calc((var(--tanrei-sys-focus-inner-width) + var(--tanrei-sys-focus-outer-width)) * 2);\ninset: var(--_trv-glow);\ninset-inline-start: calc(var(--_trv-at) + var(--_trv-glow));\nborder: 0;\nborder-radius: max(0px, calc(var(--tanrei-corner-radius) * var(--_corner-scale) - var(--_trv-glow)));\noutline-color: transparent;\nbox-shadow:\n0 0 var(--tanrei-sys-focus-inner-width) var(--tanrei-sys-focus-inner-width) var(--tanrei-sys-color-focus-ring-inner),\n0 0 var(--tanrei-sys-focus-outer-width) calc(var(--tanrei-sys-focus-inner-width) + var(--tanrei-sys-focus-outer-width)) var(--tanrei-sys-color-focus-ring),\n0 0 0 var(--_trv-glow) var(--_trv-now-container);\n}\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)[data-focus-style='glow']:focus-visible)::after {\n--_trv-glow: calc((var(--tanrei-sys-focus-inner-width) + var(--tanrei-sys-focus-outer-width)) * 2);\ninset: var(--_trv-glow);\ninset-inline-start: calc(var(--_trv-at) + var(--_trv-glow));\nborder: 0;\nborder-radius: max(0px, calc(var(--tanrei-corner-radius) * var(--_corner-scale) - var(--_trv-glow)));\noutline-color: transparent;\nbox-shadow:\n0 0 var(--tanrei-sys-focus-inner-width) var(--tanrei-sys-focus-inner-width) var(--tanrei-sys-color-focus-ring-inner),\n0 0 var(--tanrei-sys-focus-outer-width) calc(var(--tanrei-sys-focus-inner-width) + var(--tanrei-sys-focus-outer-width)) var(--tanrei-sys-color-focus-ring),\n0 0 0 var(--_trv-glow) var(--_trv-now-container);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child[data-pressed]:not([data-pressed='none'])),\n:where(tanrei-tree-view) :where(li) > :where(:first-child[data-pressed]:not([data-pressed='none']))::after,\n:where(tanrei-tree-view) :where(li) > :where(:first-child[data-pressed]:not([data-pressed='none'])) > :where([data-supporting-text], [data-trailing-text]) {\ntransition-duration: 0s;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child[data-pressed='overlay']) {\n--_trv-now-container: var(--_trv-pressed-container);\n--_trv-now-label: var(--_trv-pressed-label);\n--_trv-now-supporting: var(--_trv-pressed-supporting);\n--_trv-now-trailing: var(--_trv-pressed-trailing);\n--_trv-now-icon: var(--_trv-pressed-icon);\n--_trv-now-chevron: var(--_trv-pressed-chevron);\nopacity: var(--tanrei-comp-tree-view-pressed-opacity);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child[data-pressed='ripple'], :first-child[data-pressed='dim']) {\n--_trv-now-label: var(--_trv-pressed-label);\n--_trv-now-supporting: var(--_trv-pressed-supporting);\n--_trv-now-trailing: var(--_trv-pressed-trailing);\n--_trv-now-icon: var(--_trv-pressed-icon);\n--_trv-now-chevron: var(--_trv-pressed-chevron);\nopacity: var(--tanrei-comp-tree-view-pressed-opacity);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where(.ripple) {\nposition: absolute;\nz-index: -1;\ninset: 0;\n--tanrei-corner-radius: var(--tanrei-comp-tree-view-container-shape);\n--tanrei-corner-pill: var(--tanrei-comp-tree-view-container-shape-pill, 0);\ninset-inline-start: var(--_trv-at);\nbackground: var(--_trv-pressed-container);\npointer-events: none;\nclip-path: circle(var(--_r) at var(--_x) var(--_y));\nanimation: tanrei-tree-view-ripple var(--tanrei-comp-tree-view-motion-feedback-duration) var(--tanrei-comp-tree-view-motion-state-easing) both;\ntransition: opacity var(--tanrei-comp-tree-view-motion-state-duration) var(--tanrei-comp-tree-view-motion-state-easing);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where(.ripple.leaving) {\nopacity: 0;\n}\n@keyframes tanrei-tree-view-ripple {\nfrom {\nclip-path: circle(0 at var(--_x) var(--_y));\n}\n}\n:where(tanrei-tree-view) :where(li[data-disabled]) > :where(:first-child:not(ul, ol)) {\n--_trv-now-container: var(--_trv-disabled-container);\n--_trv-now-label: var(--_trv-disabled-label);\n--_trv-now-supporting: var(--_trv-disabled-supporting);\n--_trv-now-trailing: var(--_trv-disabled-trailing);\n--_trv-now-icon: var(--_trv-disabled-icon);\n--_trv-now-chevron: var(--_trv-disabled-chevron);\nopacity: var(--tanrei-comp-tree-view-disabled-opacity);\ncursor: default;\n}\n@media (scripting: none) {\n:where(tanrei-tree-view) :where(li:not([data-open])) > :where(ul, ol) {\ndisplay: block;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::before {\ncontent: '';\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) {\ncursor: auto;\n-webkit-user-select: auto;\nuser-select: auto;\n}\n}\n:where(tanrei-tree-view) :where(li[data-tanrei-at-once]) > :where(:first-child:not(ul, ol))::before {\ntransition: none;\n}\n@media (prefers-reduced-motion: reduce) {\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) {\ntransition: --_trv-hold 0s linear var(--tanrei-sys-motion-duration-press-hold);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::before,\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::after,\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) :where([data-supporting-text], [data-trailing-text]) {\ntransition: none;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where(.ripple) {\nanimation: none;\ntransition: none;\n}\n:where(tanrei-tree-view) :where(li) > :where(ul, ol) {\ntransition-duration: 0s;\n}\n}\n@media (forced-colors: active) {\n:where(tanrei-tree-view) {\n--_trv-guide-color: CanvasText;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) {\n--_trv-forced: CanvasText;\n--_trv-forced-fill: transparent;\ncolor: var(--_trv-forced);\nforced-color-adjust: none;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > :where([data-trailing]) {\nforced-color-adjust: auto;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) :where([data-supporting-text], [data-trailing-text], [data-tanrei-loading-label]),\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)) > .tanrei-icon.tanrei-icon,\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::before {\ncolor: var(--_trv-forced);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol))::after {\nbackground-color: var(--_trv-forced-fill);\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)[aria-selected='true']) {\n--_trv-forced: SelectedItemText;\n--_trv-forced-fill: SelectedItem;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol)[aria-selected='true'])::after {\nborder: var(--tanrei-comp-tree-view-guide-width) solid CanvasText;\n}\n:where(tanrei-tree-view) :where(li:not([data-disabled], [data-tanrei-leaf])) > :where(:first-child:not(ul, ol, :only-child):hover),\n:where(tanrei-tree-view) :where(li[data-expandable]:not([data-disabled])) > :where(:first-child:not(ul, ol):hover),\n:where(tanrei-tree-view:is([selection='single'], [selection='multiple'])) :where(li[data-value]:not([data-value=''], [data-disabled])) > :where(:first-child:not(ul, ol):hover),\n:where(tanrei-tree-view) :where(li) > :where(:first-child[data-pressed]:not([data-pressed='none'])) {\n--_trv-forced: ButtonText;\n--_trv-forced-fill: ButtonFace;\n}\n:where(tanrei-tree-view) :where(li[data-disabled]) > :where(:first-child:not(ul, ol)) {\n--_trv-forced: GrayText;\nopacity: 1;\n}\n:where(tanrei-tree-view) :where(li) > :where(:first-child:not(ul, ol):focus-visible)::after {\ninset: 0;\ninset-inline-start: var(--_trv-at);\nborder: var(--tanrei-sys-focus-outer-width) solid Highlight;\noutline: var(--tanrei-sys-focus-inner-width) solid Highlight;\nbox-shadow: none;\n}\n}\n}";
11
+ }
12
+ catch {
13
+ return '';
14
+ }
15
+ })();
16
+ const TAG = 'tanrei-tree-view';
17
+ const PREFIX = '--tanrei-comp-tree-view';
18
+ const SELECTIONS = ['none', 'single', 'multiple'];
19
+ const CORE_DENSITIES = ['regular', 'compact'];
20
+ const DEFAULT_DENSITY = 'regular';
21
+ /** The members of the density axis (`dev.tanrei.axes.density.members`) as tree-view.css names them. */
22
+ const DENSITY_MEMBERS = [
23
+ ['--_trv-height', 'container-height-*'],
24
+ ['--_trv-pad-block', 'container-padding-block-*'],
25
+ ['--_trv-pad-inline', 'container-padding-inline-*'],
26
+ ['--_trv-gap', 'container-gap-*'],
27
+ ['--_trv-indent', 'level-indent-*'],
28
+ ['--_trv-label-font', 'label-typescale-*-font'],
29
+ ['--_trv-label-tracking', 'label-typescale-*-letter-spacing'],
30
+ ['--_trv-icon-size', 'icon-size-*'],
31
+ ['--_trv-chevron-size', 'chevron-size-*'],
32
+ ];
33
+ /** Attribute values are interpolated into CSS: only token-name characters are accepted. */
34
+ const KEY = /^[a-z0-9][a-z0-9-]*$/;
35
+ /** What the element writes on the product's lists and items (tree-view.css reads each). */
36
+ const MOVING = 'data-tanrei-moving';
37
+ const AT_ONCE = 'data-tanrei-at-once';
38
+ const LEAF = 'data-tanrei-leaf';
39
+ const LOADING = 'data-tanrei-loading';
40
+ const OWN_LIST = 'data-tanrei-loading-list';
41
+ /** The parts of a row that are not its label. */
42
+ const PARTS = '.tanrei-icon, [data-supporting-text], [data-trailing], [data-trailing-text], [data-tanrei-loading-box], .ripple';
43
+ /** What an item says: a change of any is read again. */
44
+ const ITEM_ATTRIBUTES = ['data-open', 'data-value', 'data-disabled', 'data-loading', 'data-expandable'];
45
+ const sheets = new Map();
46
+ /** A stylesheet of the page, made once and shared by every root that needs it. */
47
+ function sheet(id, text) {
48
+ if (typeof CSSStyleSheet === 'undefined')
49
+ return null;
50
+ let made = sheets.get(id);
51
+ if (!made) {
52
+ made = new CSSStyleSheet();
53
+ try {
54
+ made.replaceSync(text());
55
+ }
56
+ catch {
57
+ // A browser that cannot construct it: the page's own copy of tree-view.css draws the tree.
58
+ }
59
+ sheets.set(id, made);
60
+ }
61
+ return made;
62
+ }
63
+ /**
64
+ * The two lengths the element reads as the cascade computes them: tree-view.css says them in `object-position` on
65
+ * the tree — a real property, which computes a token's expression to a length and draws nothing on an element that
66
+ * is not a replaced one — the indent of one level first, the least width of a chevron's hit area second. (No custom property
67
+ * of the stylesheet is registered: src/styles/registered-properties.ts.)
68
+ */
69
+ function treeLengths(tree) {
70
+ const [indent, target] = getComputedStyle(tree)
71
+ .objectPosition.split(/\s+/)
72
+ .map((length) => (length.endsWith('px') ? Number.parseFloat(length) : Number.NaN));
73
+ return { indent: indent ?? Number.NaN, target: target ?? Number.NaN };
74
+ }
75
+ /** TRV-41: a density a design system added — the default's rules, read from that density's tokens. */
76
+ const densityRules = (density) => `@layer tanrei.components { :where(${TAG}[density='${density}']) { ${DENSITY_MEMBERS.map(([name, token]) => `${name}: var(${PREFIX}-${token.replace('*', density)}, var(${PREFIX}-${token.replace('*', DEFAULT_DENSITY)}));`).join(' ')} } }`;
77
+ /** Writes an attribute only when it differs: what is written here may be observed, and must settle. */
78
+ function mark(element, name, value) {
79
+ if (value === null) {
80
+ if (element.hasAttribute(name))
81
+ element.removeAttribute(name);
82
+ }
83
+ else if (element.getAttribute(name) !== value)
84
+ element.setAttribute(name, value);
85
+ }
86
+ /** Whether the browser's find-in-page looks into a closed list and says so (`hidden="until-found"`, TRV-14). */
87
+ const UNTIL_FOUND = typeof HTMLElement !== 'undefined' && 'onbeforematch' in HTMLElement.prototype;
88
+ const isList = (node) => node instanceof HTMLElement && (node.localName === 'ul' || node.localName === 'ol');
89
+ /** An item: an `<li>` of the product's. The loading row is an `<li>` of the element's own and is not one (TRV-13). */
90
+ const isItem = (node) => node instanceof HTMLLIElement && !node.hasAttribute(LOADING);
91
+ /** An item's row: its first child element, where that is not a list. */
92
+ const rowOf = (item) => {
93
+ const first = item.firstElementChild;
94
+ return first instanceof HTMLElement && !isList(first) ? first : null;
95
+ };
96
+ /** The list an item holds: the product's own, or else the one the element made for a loading row. */
97
+ function listOf(item) {
98
+ let own = null;
99
+ for (let child = item.firstElementChild; child; child = child.nextElementSibling) {
100
+ if (!isList(child))
101
+ continue;
102
+ if (!child.hasAttribute(OWN_LIST))
103
+ return child;
104
+ own = child;
105
+ }
106
+ return own;
107
+ }
108
+ const firstItem = (list) => {
109
+ for (let child = list?.firstElementChild; child; child = child.nextElementSibling)
110
+ if (isItem(child))
111
+ return child;
112
+ return null;
113
+ };
114
+ const lastItem = (list) => {
115
+ for (let child = list?.lastElementChild; child; child = child.previousElementSibling)
116
+ if (isItem(child))
117
+ return child;
118
+ return null;
119
+ };
120
+ const nextItem = (item) => {
121
+ for (let sibling = item.nextElementSibling; sibling; sibling = sibling.nextElementSibling)
122
+ if (isItem(sibling))
123
+ return sibling;
124
+ return null;
125
+ };
126
+ const previousItem = (item) => {
127
+ for (let sibling = item.previousElementSibling; sibling; sibling = sibling.previousElementSibling)
128
+ if (isItem(sibling))
129
+ return sibling;
130
+ return null;
131
+ };
132
+ /** An item that holds items, or says it will, is a parent; every other item is a leaf (TRV-4, TRV-42). */
133
+ const isParent = (item) => item.hasAttribute('data-expandable') || !!firstItem(listOf(item));
134
+ const isOpen = (item) => item.hasAttribute('data-open') && isParent(item);
135
+ const isDisabled = (item) => item.hasAttribute('data-disabled');
136
+ const valueOf = (item) => item.getAttribute('data-value') ?? '';
137
+ /** The text of `node` without the supporting text a label's own element may hold. */
138
+ function textOf(node) {
139
+ if (node.nodeType === Node.TEXT_NODE)
140
+ return node.nodeValue ?? '';
141
+ if (!(node instanceof Element) || node.matches(PARTS))
142
+ return '';
143
+ let text = '';
144
+ for (const child of node.childNodes)
145
+ text += textOf(child);
146
+ return text;
147
+ }
148
+ /** An item's label: the text of its row that is not one of the row's other parts (TRV-6, TRV-23, TRV-32). */
149
+ function labelOf(item) {
150
+ const row = rowOf(item);
151
+ let text = '';
152
+ if (row)
153
+ for (const child of row.childNodes)
154
+ text += textOf(child);
155
+ return text.replace(/\s+/g, ' ').trim();
156
+ }
157
+ let descriptions = 0;
158
+ /**
159
+ * A hierarchy of items that open and close: rows that begin further in at each level, a chevron at the start of every
160
+ * row that holds others; read and opened only, or with one item or several chosen. One stop in the focus order, moved
161
+ * through with the arrow keys. A file tree in a page, the tokens of a design system, the folders of a product.
162
+ *
163
+ * Contract: specs/tree-view.spec.json. The element has **no shadow root**: its items are the product's own nested
164
+ * lists, which stay in the document. Without script the page shows the whole hierarchy as the nested list
165
+ * it is.
166
+ *
167
+ * ```html
168
+ * <tanrei-tree-view label="Project files" selection="single" value="src/index.ts">
169
+ * <ul>
170
+ * <li data-value="src" data-open>
171
+ * <span>
172
+ * <i class="tanrei-icon">folder</i>
173
+ * <bdi>src<small data-supporting-text>what is published</small></bdi>
174
+ * <span data-trailing-text>12 files</span>
175
+ * </span>
176
+ * <ul>
177
+ * <li data-value="src/index.ts"><span>index.ts</span></li>
178
+ * </ul>
179
+ * </li>
180
+ * <li data-expandable><span>node_modules</span></li>
181
+ * </ul>
182
+ * </tanrei-tree-view>
183
+ * ```
184
+ *
185
+ * An item is an `<li>` whose FIRST child element is its row and whose `<ul>` holds its items. In the row, a
186
+ * `.tanrei-icon` is the icon, an element with `data-trailing` the trailing content, one with `data-trailing-text` the
187
+ * trailing text, and the rest is the label: the row's own text, or ONE element around it (a `<bdi>`: text with inline
188
+ * content, a name whose direction is not the layout's). An element with `data-supporting-text` is the supporting text,
189
+ * inside the label's element or directly in the row. On the `<li>`: `data-value` (what identifies it; without one it
190
+ * cannot be chosen), `data-open`, `data-expandable` (it will hold items: give them at `toggle`), `data-loading`,
191
+ * `data-disabled`. The element sets and removes `data-open` itself when the user opens or closes a parent.
192
+ *
193
+ * Everything drawn is `@tanrei/web/tree-view.css` — every value a `--tanrei-comp-tree-view-*` token — which draws the
194
+ * whole look before this script runs; the element adds the same sheet to the root it is connected to. The script adds
195
+ * what a stylesheet cannot: the tree's roles and states, the single tab stop and the keys, the selection, `change` and
196
+ * `toggle`, the answer to a press, the motion of a list that is revealed or hidden, the loading row, opening for the
197
+ * browser's find-in-page, and the debug reports. Only the rows that are shown are read: a closed parent's items are
198
+ * read when it first opens, so a tree costs what it shows.
199
+ *
200
+ * The ROW is the tree item (`role="treeitem"`, `aria-selected`, `aria-expanded`, the tab stop and the focus); its
201
+ * `<li>` has no role and a nested list is a `group`, so the level comes from the nesting. An `<li>` holds every row
202
+ * under it, so what changes while the tree is used is said on the row: one row's change styles that row alone. A
203
+ * server that draws the selection in the first frame writes `aria-selected="true"` on the row.
204
+ *
205
+ * @tag tanrei-tree-view
206
+ * @slot - The items: the product's own nested lists (`<ul>` of `<li>`). They are children in the document, not slotted nodes: the element has no shadow root.
207
+ * @fires {CustomEvent<TanreiTreeViewChangeDetail>} change - The user changed the selection: `detail.value` (single) or `detail.values` (multiple) after the change.
208
+ * @fires {CustomEvent<TanreiTreeViewToggleDetail>} toggle - Dispatched on an item's `<li>` (it bubbles): the user, or the browser's find-in-page, opened or closed it; `detail.open` is its new state. The moment to give the items of an `data-expandable` parent.
209
+ */
210
+ export class TanreiTreeView extends ReactiveElement {
211
+ constructor() {
212
+ super(...arguments);
213
+ this.availability = new AvailabilityController(this, 'tree-view');
214
+ /** The product's words, read where the instance gives none (src/primitives/words.ts). */
215
+ this.words = new WordsController(this);
216
+ /** The accessible name of the tree: what the hierarchy is ("Project files"). Required. */
217
+ this.label = '';
218
+ /** Whether people choose items: none (a tree that is read and opened), single (one item), multiple (any number, each by itself). */
219
+ this.selection = 'none';
220
+ /** The value of the selected item while selection is single; null selects none. Set by the tree when an item is chosen, with `change`. */
221
+ this.value = null;
222
+ /** The values of the selected items while selection is multiple. The attribute is a JSON array (a value may hold a space). */
223
+ this.values = [];
224
+ /** How much room a row takes: regular for a product used by touch as well, compact for a tool and for a small tree inside text. A design system may add values. */
225
+ this.density = 'regular';
226
+ /** Draws a hairline down from each open parent beside the rows it holds. Decorative. */
227
+ this.guides = false;
228
+ /** The words of a loading row ("Loading…"), and the name of its indicator. Tanrei ships none. */
229
+ this.loadingLabel = '';
230
+ this.mutations = typeof MutationObserver === 'undefined' ? null : new MutationObserver((records) => this.mutated(records));
231
+ /** The lists whose items are read: the ones that are shown, or were. */
232
+ this.live = new WeakSet();
233
+ /** Each read item's `open` as it was last drawn: a change from it is what opens and closes. */
234
+ this.opens = new WeakMap();
235
+ /** What this element wrote on the product's elements: only that is taken off again. */
236
+ this.hiddenParts = new WeakSet();
237
+ this.described = new WeakSet();
238
+ this.labelled = new WeakSet();
239
+ this.inerted = new WeakSet();
240
+ this.loaders = new WeakMap();
241
+ this.motions = new WeakMap();
242
+ this.presses = new WeakMap();
243
+ this.pressControllers = new Set();
244
+ this.held = null;
245
+ this.heldRow = null;
246
+ /** The items drawn as selected. */
247
+ this.selected = new Set();
248
+ /** The one item in the focus order (TRV-19), the row that had focus last, and the one that has it now. */
249
+ this.stop = null;
250
+ this.last = null;
251
+ this.active = null;
252
+ /** The row that lost focus in this task: taken away in the same task, it is the row that had focus (TRV-12). */
253
+ this.left = null;
254
+ this.keys = new RovingKeys({ wrap: false, repeat: true });
255
+ this.glyphs = new PendingGlyphs(this, 'chevron_right');
256
+ this.named = false;
257
+ this.checking = false;
258
+ this.depthChecked = false;
259
+ /** Where the focused row stands, noted when focus arrives: what is beside it when it is taken away. */
260
+ this.places = new WeakMap();
261
+ this.onFocusIn = (event) => {
262
+ const item = this.rowItem(event.target);
263
+ if (!item)
264
+ return;
265
+ this.active = item;
266
+ this.last = item;
267
+ this.places.set(item, { next: nextItem(item), previous: previousItem(item), parent: this.parentOf(item) });
268
+ this.readStop();
269
+ // TRV-30: where the browser has no style queries, the focus style is read when focus arrives.
270
+ if (!styleQueries())
271
+ syncFocusStyle(this, event.target);
272
+ };
273
+ this.onFocusOut = (event) => {
274
+ const item = this.rowItem(event.target) ?? event.target?.parentElement;
275
+ if (!isItem(item))
276
+ return;
277
+ this.presses.get(event.target)?.onBlur();
278
+ // (A row that is taken away while it has focus is still the one that had it: see refocus().)
279
+ if (!item.isConnected || !this.contains(item))
280
+ return;
281
+ this.active = null;
282
+ this.left = item;
283
+ clearTimeout(this.leftTimer);
284
+ this.leftTimer = setTimeout(() => (this.left = null));
285
+ };
286
+ // ── Keys (TRV-20 to TRV-23) ───────────────────────────────────────────────────────────────────────────────────
287
+ this.onKeyDown = (event) => {
288
+ const key = event;
289
+ const item = this.rowItem(key.target);
290
+ // TRV-20: the keys are the tree's only while focus is on one of its rows.
291
+ if (!item)
292
+ return;
293
+ // TRV-22: a key pressed with a modifier is the platform's (Shift alone types a character).
294
+ if (key.altKey || key.ctrlKey || key.metaKey || key.isComposing)
295
+ return;
296
+ this.checkDepth();
297
+ const move = (to) => {
298
+ key.preventDefault();
299
+ if (to && to !== item)
300
+ this.focusRow(to);
301
+ };
302
+ if (!key.shiftKey) {
303
+ switch (key.key) {
304
+ case 'ArrowDown':
305
+ return move(this.nextShown(item));
306
+ case 'ArrowUp':
307
+ return move(this.previousShown(item));
308
+ case 'Home':
309
+ return move(this.firstShown());
310
+ case 'End':
311
+ return move(this.lastShown());
312
+ }
313
+ // TRV-21: the arrow toward the end of the line opens, then steps in; the one toward its start closes, then steps out.
314
+ const arrow = lineArrow(key.key, item);
315
+ if (arrow) {
316
+ key.preventDefault();
317
+ const open = isOpen(item);
318
+ if (arrow === 'end') {
319
+ if (open) {
320
+ const inner = firstItem(listOf(item));
321
+ if (inner)
322
+ this.focusRow(inner);
323
+ }
324
+ else if (isParent(item) && !isDisabled(item))
325
+ this.toggle(item, true);
326
+ }
327
+ else if (open && !isDisabled(item))
328
+ this.toggle(item, false);
329
+ else {
330
+ const parent = this.parentOf(item);
331
+ if (parent)
332
+ this.focusRow(parent);
333
+ }
334
+ return;
335
+ }
336
+ // TRV-22: Enter, and a Space that is not part of a typed search, do what a press on the row does.
337
+ if (key.key === 'Enter' || (key.key === ' ' && !this.keys.searching())) {
338
+ key.preventDefault();
339
+ if (key.repeat || !this.answers(item))
340
+ return;
341
+ const row = rowOf(item);
342
+ if (row)
343
+ this.pressOf(item, row).press(null);
344
+ this.activate(item, false);
345
+ return;
346
+ }
347
+ }
348
+ // TRV-22: the asterisk opens every closed parent among the focused row's siblings, itself included.
349
+ if (key.key === '*') {
350
+ key.preventDefault();
351
+ for (let sibling = firstItem(item.parentElement); sibling; sibling = nextItem(sibling))
352
+ if (isParent(sibling) && !isDisabled(sibling))
353
+ this.toggle(sibling, true);
354
+ return;
355
+ }
356
+ // TRV-23: printable characters move focus to the next shown row whose label begins with them.
357
+ if ([...key.key].length !== 1)
358
+ return;
359
+ const rows = [];
360
+ for (let at = this.firstShown(); at; at = this.nextShown(at))
361
+ rows.push(at);
362
+ const to = this.keys.target(key.key, rows.indexOf(item), rows.map((row) => ({
363
+ focusable: true,
364
+ get label() {
365
+ return labelOf(row);
366
+ },
367
+ })));
368
+ if (to === null)
369
+ return;
370
+ key.preventDefault();
371
+ if (rows[to] !== item)
372
+ this.focusRow(rows[to]);
373
+ };
374
+ this.onKeyUp = (event) => {
375
+ if (event.target instanceof HTMLElement)
376
+ this.presses.get(event.target)?.onKeyUp(event);
377
+ };
378
+ this.releasePress = () => {
379
+ this.held?.release();
380
+ this.held = null;
381
+ this.heldRow = null;
382
+ };
383
+ this.onPointerDown = (event) => {
384
+ const pointer = event;
385
+ const item = this.itemOf(event.target);
386
+ const row = item ? rowOf(item) : null;
387
+ if (!item || !row || (pointer.button !== 0 && pointer.pointerType === 'mouse'))
388
+ return;
389
+ this.checkDepth();
390
+ if (!this.answers(item))
391
+ return;
392
+ this.held = this.pressOf(item, row);
393
+ this.heldRow = row;
394
+ this.held.onPointerDown(pointer);
395
+ };
396
+ // `pointerleave` is not seen from here: the press ends when the pointer goes out of the row it holds.
397
+ this.onPointerOut = (event) => {
398
+ const to = event.relatedTarget;
399
+ if (this.heldRow && !(to instanceof Node && this.heldRow.contains(to)))
400
+ this.releasePress();
401
+ };
402
+ this.onClick = (event) => {
403
+ const click = event;
404
+ const item = this.itemOf(event.target);
405
+ const row = item ? rowOf(item) : null;
406
+ if (!item || !row || click.button !== 0 || !this.answers(item))
407
+ return;
408
+ // (A click that names no place — one made by script — is a press on the row.)
409
+ const placed = click.detail > 0 || click.clientX !== 0 || click.clientY !== 0;
410
+ this.activate(item, placed && isParent(item) && this.canChoose(item) && this.onChevron(row, click.clientX));
411
+ };
412
+ // TRV-14: the browser's find-in-page found text in a closed list — that parent opens, at once, with its toggle.
413
+ // (The browser asks each closed list above it in turn, and brings the match into view itself.)
414
+ this.onBeforeMatch = (event) => {
415
+ const list = event.target;
416
+ const item = isList(list) ? list.parentElement : null;
417
+ if (isItem(item) && item.closest(TAG) === this && isParent(item))
418
+ this.toggle(item, true, true);
419
+ };
420
+ this.listeners = [
421
+ ['pointerdown', this.onPointerDown],
422
+ ['pointerup', this.releasePress],
423
+ ['pointercancel', this.releasePress],
424
+ ['pointerout', this.onPointerOut],
425
+ ['dragstart', this.releasePress],
426
+ ['click', this.onClick],
427
+ ['keydown', this.onKeyDown],
428
+ ['keyup', this.onKeyUp],
429
+ ['focusin', this.onFocusIn],
430
+ ['focusout', this.onFocusOut],
431
+ ['beforematch', this.onBeforeMatch],
432
+ ];
433
+ }
434
+ static { this.properties = {
435
+ label: { type: String },
436
+ // The defaults are not reflected: a tree that is defined is the tree that was written.
437
+ selection: { type: String, reflect: true, useDefault: true },
438
+ value: { type: String },
439
+ values: {
440
+ converter: {
441
+ fromAttribute: (text) => {
442
+ try {
443
+ const parsed = JSON.parse(text ?? '[]');
444
+ return Array.isArray(parsed) ? parsed.map(String) : [];
445
+ }
446
+ catch {
447
+ return [];
448
+ }
449
+ },
450
+ },
451
+ },
452
+ density: { type: String, reflect: true, useDefault: true },
453
+ guides: { type: Boolean, reflect: true },
454
+ loadingLabel: { type: String, attribute: 'loading-label' },
455
+ }; }
456
+ /** No shadow root: the lists are the document's. */
457
+ createRenderRoot() {
458
+ return this;
459
+ }
460
+ connectedCallback() {
461
+ super.connectedCallback();
462
+ this.adoptSheet();
463
+ for (const [type, listener] of this.listeners)
464
+ this.addEventListener(type, listener);
465
+ this.mutations?.observe(this, { subtree: true, childList: true, characterData: true, attributes: true, attributeFilter: ITEM_ATTRIBUTES });
466
+ this.glyphs.connect();
467
+ if (this.hasUpdated)
468
+ this.read();
469
+ }
470
+ disconnectedCallback() {
471
+ super.disconnectedCallback();
472
+ for (const [type, listener] of this.listeners)
473
+ this.removeEventListener(type, listener);
474
+ this.mutations?.disconnect();
475
+ this.glyphs.disconnect();
476
+ for (const press of this.pressControllers)
477
+ press.hostDisconnected();
478
+ this.held = null;
479
+ this.heldRow = null;
480
+ clearTimeout(this.leftTimer);
481
+ this.left = null;
482
+ }
483
+ /**
484
+ * The stylesheet is added to the root the tree stands in — unless that root draws the tree already: a page that
485
+ * loads `@tanrei/web/tree-view.css` (as it must, to draw the tree before this script runs) has every rule of it, and
486
+ * a second copy would only have the browser style every row of the tree again. Asked of the tree itself: a name the
487
+ * stylesheet sets on it (src/primitives/sheets.ts).
488
+ */
489
+ adoptSheet() {
490
+ adoptUnlessDrawn(this, sheet('tree-view', () => TREE_VIEW_CSS), '--_trv-gap');
491
+ }
492
+ updated(changed) {
493
+ // TRV-41: a selection the tree does not define is none (no rule matches the attribute); a debug build says so.
494
+ if (changed.has('selection') && !SELECTIONS.includes(this.selection)) {
495
+ report(this, 'TRV-41', `selection "${this.selection}" is not a value the tree view defines; it is drawn as "none"`);
496
+ }
497
+ if (changed.has('density'))
498
+ this.readDensity(String(this.density ?? ''));
499
+ if (changed.has('label') || !this.named) {
500
+ this.named = true;
501
+ mark(this, 'aria-label', this.label || null);
502
+ // TRV-32: still rendered; a debug build says that the tree has no accessible name.
503
+ if (!this.label && !this.hasAttribute('aria-labelledby'))
504
+ report(this, 'TRV-32', 'the tree has no accessible name; give it a label');
505
+ }
506
+ // (No property changed: the product's words did — src/primitives/words.ts.)
507
+ if (changed.has('loadingLabel') || changed.size === 0)
508
+ for (const loader of this.querySelectorAll(`li[${LOADING}]`))
509
+ this.writeLoader(loader);
510
+ // TRV-41: the new form at once, every parent's open and the focus kept, and no change for it.
511
+ if (changed.has('selection'))
512
+ this.restate();
513
+ this.read();
514
+ if (changed.has('selection') || changed.has('value') || changed.has('values'))
515
+ this.readSelection();
516
+ }
517
+ /** How the tree chooses now: an unknown selection is none (TRV-41). */
518
+ get mode() {
519
+ return this.selection === 'single' || this.selection === 'multiple' ? this.selection : 'none';
520
+ }
521
+ /**
522
+ * The item whose row a pointer's event is in: this tree's own, never a tree's inside one of its rows. (A press that
523
+ * began in one row and ended in another reaches the list around both, which is no row.)
524
+ */
525
+ itemOf(node) {
526
+ const item = node instanceof Element ? node.closest('li') : null;
527
+ if (!isItem(item) || item.closest(TAG) !== this)
528
+ return null;
529
+ return rowOf(item)?.contains(node) ? item : null;
530
+ }
531
+ /** The parent of an item, where it has one. */
532
+ parentOf(item) {
533
+ const above = item.parentElement?.parentElement;
534
+ return isItem(above) && this.contains(above) ? above : null;
535
+ }
536
+ /** The lists directly in the tree. */
537
+ roots() {
538
+ return [...this.children].filter(isList);
539
+ }
540
+ /** TRV-15: an item can be chosen while the tree chooses, it has a value and it is not disabled. */
541
+ canChoose(item) {
542
+ return this.mode !== 'none' && valueOf(item) !== '' && !isDisabled(item);
543
+ }
544
+ /** TRV-18: a row answers where its item can be chosen, or opens and closes. */
545
+ answers(item) {
546
+ return !isDisabled(item) && (this.canChoose(item) || isParent(item));
547
+ }
548
+ // ── The rows that are shown, in the order they are drawn (TRV-20) ─────────────────────────────────────────────
549
+ firstShown() {
550
+ for (const root of this.roots()) {
551
+ const item = firstItem(root);
552
+ if (item)
553
+ return item;
554
+ }
555
+ return null;
556
+ }
557
+ /** The last row shown in the subtree of `item`: itself, or the last under its last open descendant. */
558
+ lastUnder(item) {
559
+ let at = item;
560
+ for (let inner = isOpen(at) ? lastItem(listOf(at)) : null; inner; inner = isOpen(at) ? lastItem(listOf(at)) : null)
561
+ at = inner;
562
+ return at;
563
+ }
564
+ lastShown() {
565
+ const roots = this.roots();
566
+ for (let index = roots.length - 1; index >= 0; index -= 1) {
567
+ const item = lastItem(roots[index]);
568
+ if (item)
569
+ return this.lastUnder(item);
570
+ }
571
+ return null;
572
+ }
573
+ nextShown(item) {
574
+ const inner = isOpen(item) ? firstItem(listOf(item)) : null;
575
+ if (inner)
576
+ return inner;
577
+ for (let at = item; at; at = this.parentOf(at)) {
578
+ const sibling = nextItem(at);
579
+ if (sibling)
580
+ return sibling;
581
+ }
582
+ return null;
583
+ }
584
+ previousShown(item) {
585
+ const sibling = previousItem(item);
586
+ return sibling ? this.lastUnder(sibling) : this.parentOf(item);
587
+ }
588
+ /** Whether an item's row is drawn: every parent above it is open. */
589
+ shown(item) {
590
+ if (!isItem(item) || !this.contains(item))
591
+ return false;
592
+ for (let above = this.parentOf(item); above; above = this.parentOf(above))
593
+ if (!above.hasAttribute('data-open'))
594
+ return false;
595
+ return true;
596
+ }
597
+ // ── Reading the lists: roles, states and the tab stop ─────────────────────────────────────────────────────────
598
+ /**
599
+ * Reads what the tree shows and writes what follows from it. Called when a property changes and when the lists do; it
600
+ * writes only what differs, so it settles.
601
+ */
602
+ read() {
603
+ if (!this.isConnected)
604
+ return;
605
+ const roots = this.roots();
606
+ // TRV-42: a tree with no items exposes nothing.
607
+ const any = roots.some((root) => !!firstItem(root));
608
+ mark(this, 'role', any ? 'tree' : null);
609
+ mark(this, 'aria-multiselectable', any && this.mode === 'multiple' ? 'true' : null);
610
+ for (const root of roots)
611
+ this.readList(root, false);
612
+ this.readStop();
613
+ this.glyphs.read();
614
+ this.check();
615
+ }
616
+ /** A list that is shown: its role, and each of its items. */
617
+ readList(list, nested) {
618
+ mark(list, 'role', nested ? 'group' : 'none');
619
+ if (this.live.has(list))
620
+ return;
621
+ this.live.add(list);
622
+ for (let child = list.firstElementChild; child; child = child.nextElementSibling)
623
+ if (isItem(child))
624
+ this.readItem(child);
625
+ }
626
+ /** One item, read for the first time: its role, its states, its row's parts, and the list it holds. */
627
+ readItem(item) {
628
+ // The row is the tree item: what an item says of itself — selected, focused, expanded — is written on its row, so
629
+ // that a change of it styles that row again and not the rows under the item (they are inside the `<li>`).
630
+ mark(item, 'role', 'none');
631
+ const row = rowOf(item);
632
+ if (row) {
633
+ mark(row, 'role', 'treeitem');
634
+ if (item !== this.stop)
635
+ mark(row, 'tabindex', '-1');
636
+ }
637
+ if (!this.opens.has(item))
638
+ this.opens.set(item, item.hasAttribute('data-open'));
639
+ this.readState(item);
640
+ this.readRow(item);
641
+ this.readLoading(item);
642
+ const list = listOf(item);
643
+ if (!list)
644
+ return;
645
+ mark(list, 'role', 'group');
646
+ // TRV-9: every parent is drawn as its open says, in the first frame; a closed one's items are read when it opens.
647
+ if (isOpen(item))
648
+ this.readList(list, true);
649
+ else
650
+ this.rest(list, false);
651
+ }
652
+ /** An item's states (TRV-32): expanded or collapsed for a parent, disabled, busy, and — in a tree that chooses — selected. */
653
+ readState(item) {
654
+ const parent = isParent(item);
655
+ const row = rowOf(item);
656
+ if (row) {
657
+ mark(row, 'aria-expanded', parent ? String(item.hasAttribute('data-open')) : null);
658
+ mark(row, 'aria-disabled', isDisabled(item) ? 'true' : null);
659
+ // TRV-13: busy while it is loading, open or closed.
660
+ mark(row, 'aria-busy', parent && item.hasAttribute('data-loading') ? 'true' : null);
661
+ }
662
+ // TRV-42: an item that holds a list with no item in it is a leaf.
663
+ mark(item, LEAF, !parent && listOf(item) ? '' : null);
664
+ this.readSelected(item);
665
+ }
666
+ /** TRV-15, TRV-32: selected or not for an item that can be chosen, no state for one that cannot; a selected item is drawn so even while disabled (TRV-27). */
667
+ readSelected(item) {
668
+ const value = valueOf(item);
669
+ const chosen = value !== '' && (this.mode === 'single' ? this.value === value : this.mode === 'multiple' && this.values.includes(value));
670
+ const row = rowOf(item);
671
+ if (row)
672
+ mark(row, 'aria-selected', chosen ? 'true' : this.canChoose(item) ? 'false' : null);
673
+ if (chosen)
674
+ this.selected.add(item);
675
+ else
676
+ this.selected.delete(item);
677
+ }
678
+ /**
679
+ * A row's parts (TRV-32). The label is the item's name. The supporting text, the trailing content and the trailing
680
+ * text are its description, in that order: each is hidden from the name and named by `aria-describedby`, which reads
681
+ * what it points to even where that is hidden. The trailing text is text of its own direction (TRV-39): `dir="auto"`,
682
+ * unless the product named one, so that it is cut at its own end. The icon is decorative.
683
+ *
684
+ * A supporting text that stands directly in the row has no box of its own (tree-view.css), and an engine does not
685
+ * hide such an element from a name: the item is then named by its label in words (`aria-label`), written again when
686
+ * the row changes.
687
+ */
688
+ readRow(item) {
689
+ const row = rowOf(item);
690
+ if (!row) {
691
+ report(item, 'TRV-32', 'the item has no row: its first child element is its row, with its label; wrap the item’s own text in a <span>');
692
+ return;
693
+ }
694
+ const ids = [];
695
+ const parts = row.querySelectorAll('.tanrei-icon, [data-supporting-text], [data-trailing], [data-trailing-text]');
696
+ const ordered = [...parts].sort((a, b) => order(a) - order(b));
697
+ for (const part of ordered) {
698
+ if (!part.hasAttribute('aria-hidden')) {
699
+ part.setAttribute('aria-hidden', 'true');
700
+ this.hiddenParts.add(part);
701
+ }
702
+ if (part.classList.contains('tanrei-icon'))
703
+ continue;
704
+ if (part.hasAttribute('data-trailing-text') && !part.hasAttribute('dir'))
705
+ part.setAttribute('dir', 'auto');
706
+ if (!this.hiddenParts.has(part) || !part.textContent?.trim())
707
+ continue;
708
+ if (!part.id)
709
+ part.id = `tanrei-tree-view-description-${++descriptions}`;
710
+ ids.push(part.id);
711
+ }
712
+ if (ids.length && (!row.hasAttribute('aria-describedby') || this.described.has(row))) {
713
+ this.described.add(row);
714
+ mark(row, 'aria-describedby', ids.join(' '));
715
+ }
716
+ else if (!ids.length && this.described.has(row)) {
717
+ this.described.delete(row);
718
+ row.removeAttribute('aria-describedby');
719
+ }
720
+ const boxless = [...row.children].some((part) => part.hasAttribute('data-supporting-text'));
721
+ if (boxless && (!row.hasAttribute('aria-label') || this.labelled.has(row)) && !row.hasAttribute('aria-labelledby')) {
722
+ this.labelled.add(row);
723
+ mark(row, 'aria-label', labelOf(item));
724
+ }
725
+ else if (!boxless && this.labelled.has(row)) {
726
+ this.labelled.delete(row);
727
+ row.removeAttribute('aria-label');
728
+ }
729
+ if (!debugBuild())
730
+ return;
731
+ // TRV-32: an item with no label. TRV-6: a row holds no control.
732
+ if (!labelOf(item) && !row.getAttribute('aria-label') && !row.hasAttribute('aria-labelledby'))
733
+ report(item, 'TRV-32', 'the item has no accessible name; give its row a label');
734
+ let control = null;
735
+ for (const child of row.children)
736
+ control ??= child.classList.contains('ripple') ? null : findInteractive(child);
737
+ if (control)
738
+ report(item, 'TRV-6', `the row holds a control (<${control.localName}>): a row is one item of the tree and holds no control; answer change, or put the action beside the tree`);
739
+ }
740
+ /**
741
+ * TRV-19: the one row in the focus order — the row that had focus last, or else the first selected item that is
742
+ * shown, or else the first row. None while the tree shows no row.
743
+ */
744
+ readStop() {
745
+ let stop = this.shown(this.last) ? this.last : null;
746
+ if (!stop) {
747
+ for (const item of this.selected) {
748
+ if (!this.shown(item))
749
+ continue;
750
+ if (!stop || item.compareDocumentPosition(stop) & Node.DOCUMENT_POSITION_FOLLOWING)
751
+ stop = item;
752
+ }
753
+ }
754
+ stop ??= this.firstShown();
755
+ const row = stop ? rowOf(stop) : null;
756
+ if (stop === this.stop && (!row || row.tabIndex === 0))
757
+ return;
758
+ const before = this.stop && this.stop !== stop && this.stop.isConnected ? rowOf(this.stop) : null;
759
+ this.stop = stop;
760
+ if (before)
761
+ mark(before, 'tabindex', '-1');
762
+ if (row)
763
+ mark(row, 'tabindex', '0');
764
+ }
765
+ /** TRV-41: the selection's form changed — every read item says again whether it is selected. */
766
+ restate() {
767
+ this.selected = new Set();
768
+ for (const item of this.querySelectorAll('li[role="none"]'))
769
+ if (isItem(item) && item.closest(TAG) === this)
770
+ this.readSelected(item);
771
+ }
772
+ /**
773
+ * TRV-15: the items the tree's value or values name are drawn as selected — the row of each, and no other. The
774
+ * items are found by their value in the document, read or not: one that is under a closed parent is selected all the
775
+ * same, and is not shown for it.
776
+ */
777
+ readSelection() {
778
+ const mode = this.mode;
779
+ const names = mode === 'single' ? (this.value === null || this.value === '' ? [] : [this.value]) : mode === 'multiple' ? this.values.filter((value) => value !== '') : [];
780
+ const now = new Set();
781
+ if (names.length > 8) {
782
+ const wanted = new Set(names);
783
+ const found = new Map();
784
+ for (const item of this.querySelectorAll('li[data-value]')) {
785
+ const value = valueOf(item);
786
+ if (!wanted.has(value) || item.closest(TAG) !== this)
787
+ continue;
788
+ now.add(item);
789
+ found.set(value, (found.get(value) ?? 0) + 1);
790
+ }
791
+ for (const name of names)
792
+ this.reportNamed(name, found.get(name) ?? 0);
793
+ }
794
+ else {
795
+ for (const name of names) {
796
+ const items = [...this.querySelectorAll(`li[data-value="${CSS.escape(name)}"]`)].filter((item) => isItem(item) && item.closest(TAG) === this);
797
+ for (const item of items)
798
+ now.add(item);
799
+ this.reportNamed(name, items.length);
800
+ }
801
+ }
802
+ const before = this.selected;
803
+ this.selected = new Set();
804
+ for (const item of before)
805
+ if (!now.has(item) && item.isConnected)
806
+ this.readSelected(item);
807
+ for (const item of now)
808
+ this.readSelected(item);
809
+ this.readStop();
810
+ }
811
+ /** TRV-15: a value that names no item selects nothing; two items with one value are both selected. A debug build says each. */
812
+ reportNamed(name, count) {
813
+ // (A tree that is still being parsed may not hold the item yet: it is selected when it arrives.)
814
+ if (count === 0 && document.readyState !== 'loading')
815
+ report(this, 'TRV-15', `the selection names "${name}", which is the value of no item; nothing is selected for it`);
816
+ if (count > 1)
817
+ report(this, 'TRV-15', `${count} items carry the value "${name}"; each is drawn as selected, and a value should be unique within the tree`);
818
+ }
819
+ /** TRV-41: a density the core does not have was added by a design system, or is unknown to the active one. */
820
+ readDensity(value) {
821
+ if (CORE_DENSITIES.includes(value))
822
+ return;
823
+ const known = KEY.test(value);
824
+ if (known)
825
+ adopt(this.getRootNode(), sheet(`density:${value}`, () => densityRules(value)));
826
+ if (!known || getComputedStyle(this).getPropertyValue(`${PREFIX}-container-height-${value}`).trim() === '') {
827
+ report(this, 'TRV-41', `density "${value}" is not a value of the active design system; it is drawn as "${DEFAULT_DENSITY}"`);
828
+ }
829
+ }
830
+ /** What a debug build says about a tree it still draws, once what changed has settled (TRV-13). */
831
+ check() {
832
+ if (!debugBuild() || this.checking)
833
+ return;
834
+ this.checking = true;
835
+ queueMicrotask(() => {
836
+ this.checking = false;
837
+ if (!this.isConnected)
838
+ return;
839
+ if (this.querySelector(`li[${LOADING}]`) && this.words.lacks('loadingLabel', this.loadingLabel))
840
+ report(this, 'TRV-13', 'an item is loading and the tree has no loading-label: the loading indicator has no name');
841
+ });
842
+ }
843
+ /** TRV-3: a level whose indent takes more than half of the tree's width is drawn where the deepest one that fits begins; a debug build says the depth, once. Read when the user first acts: it reads the layout. */
844
+ checkDepth() {
845
+ if (this.depthChecked || !debugBuild())
846
+ return;
847
+ this.depthChecked = true;
848
+ const step = treeLengths(this).indent;
849
+ const width = this.clientWidth;
850
+ if (!(step > 0) || !(width > 0))
851
+ return;
852
+ let deepest = 0;
853
+ for (const list of this.querySelectorAll('ul[role="group"], ol[role="group"]')) {
854
+ let depth = 1;
855
+ for (let above = list.parentElement?.closest('ul, ol'); above && this.contains(above); above = above.parentElement?.closest('ul, ol'))
856
+ depth += 1;
857
+ deepest = Math.max(deepest, depth);
858
+ }
859
+ if (deepest * step > width / 2)
860
+ report(this, 'TRV-3', `the tree is ${deepest + 1} levels deep and ${Math.round(width)} wide: the levels past ${Math.floor(width / 2 / step) + 1} begin where that one does, so that names keep half of the width`);
861
+ }
862
+ // ── What the observer saw ─────────────────────────────────────────────────────────────────────────────────────
863
+ mutated(records) {
864
+ const own = (node) => isGlyphProbe(node) || (node instanceof Element && (node.classList.contains('ripple') || node.hasAttribute(LOADING) || node.hasAttribute(OWN_LIST)));
865
+ const items = new Set();
866
+ let structure = false;
867
+ for (const record of records) {
868
+ if (record.type === 'attributes') {
869
+ const item = record.target;
870
+ if (!isItem(item) || !this.opens.has(item) || item.closest(TAG) !== this)
871
+ continue;
872
+ if (record.attributeName === 'data-open')
873
+ this.opened(item);
874
+ else
875
+ items.add(item);
876
+ continue;
877
+ }
878
+ if (record.type === 'characterData') {
879
+ // A row's text changed: its item is read again (its name, where the element wrote one).
880
+ const item = record.target.parentElement?.closest('li');
881
+ if (isItem(item) && this.opens.has(item) && item.closest(TAG) === this)
882
+ items.add(item);
883
+ continue;
884
+ }
885
+ if ([...record.addedNodes, ...record.removedNodes].every(own))
886
+ continue;
887
+ structure = true;
888
+ const target = record.target;
889
+ if (target === this)
890
+ continue;
891
+ if (isList(target)) {
892
+ // Items came or went: the item that holds the list may have become a parent or a leaf, and new items are read.
893
+ const holder = target.parentElement;
894
+ if (isItem(holder) && this.opens.has(holder))
895
+ items.add(holder);
896
+ if (this.live.has(target))
897
+ for (const node of record.addedNodes)
898
+ if (isItem(node))
899
+ this.readItem(node);
900
+ }
901
+ else {
902
+ // A row, a part of one, or an item that was given its row or its list.
903
+ const item = target instanceof HTMLLIElement ? target : target.closest('li');
904
+ if (isItem(item) && this.opens.has(item) && item.closest(TAG) === this)
905
+ items.add(item);
906
+ }
907
+ }
908
+ for (const item of items) {
909
+ if (!item.isConnected)
910
+ continue;
911
+ this.readState(item);
912
+ this.readRow(item);
913
+ this.readLoading(item);
914
+ const list = listOf(item);
915
+ if (list) {
916
+ mark(list, 'role', 'group');
917
+ if (isOpen(item)) {
918
+ if (!this.motions.has(list))
919
+ this.rest(list, true);
920
+ this.readList(list, true);
921
+ }
922
+ else if (!this.motions.has(list))
923
+ this.rest(list, false);
924
+ }
925
+ }
926
+ if (!structure && !items.size)
927
+ return;
928
+ if (structure) {
929
+ this.depthChecked = false;
930
+ this.refocus();
931
+ this.read();
932
+ if (this.mode !== 'none')
933
+ this.readSelection();
934
+ }
935
+ else
936
+ this.readStop();
937
+ }
938
+ /**
939
+ * TRV-12: the row that had focus was taken away. Focus goes to the row that follows where it was or, where none
940
+ * does, the one before it — the parent's row where its items are gone.
941
+ */
942
+ refocus() {
943
+ // (An engine may tell the row that it lost focus as it is taken away: that row is the one that left in this task.)
944
+ const gone = this.active ?? this.left;
945
+ this.left = null;
946
+ if (this.last && !this.contains(this.last))
947
+ this.last = null;
948
+ if (this.stop && !this.contains(this.stop))
949
+ this.stop = null;
950
+ if (!gone || this.contains(gone))
951
+ return;
952
+ this.active = null;
953
+ const focused = document.activeElement;
954
+ if (focused && focused !== document.body && focused.isConnected)
955
+ return;
956
+ const place = this.places.get(gone);
957
+ this.places.delete(gone);
958
+ const next = [place?.next, place?.previous && this.shown(place.previous) ? this.lastUnder(place.previous) : null, place?.parent].find((item) => this.shown(item ?? null)) ?? this.firstShown();
959
+ if (next)
960
+ this.focusRow(next);
961
+ }
962
+ // ── Opening and closing (TRV-9 to TRV-12, TRV-14) ─────────────────────────────────────────────────────────────
963
+ /** The product set or removed `data-open` on a read item: it is drawn, with the motion, and nothing is emitted. */
964
+ opened(item) {
965
+ const open = item.hasAttribute('data-open');
966
+ if (this.opens.get(item) === open)
967
+ return;
968
+ this.opens.set(item, open);
969
+ this.draw(item, open, false);
970
+ }
971
+ /** The user (or the browser's search) opens or closes a parent: its `data-open`, its drawing, and its `toggle`, once. */
972
+ toggle(item, open, atOnce = false) {
973
+ if (item.hasAttribute('data-open') === open)
974
+ return;
975
+ this.opens.set(item, open);
976
+ item.toggleAttribute('data-open', open);
977
+ this.draw(item, open, atOnce);
978
+ // TRV-11: when the change begins, not when the motion ends.
979
+ item.dispatchEvent(new CustomEvent('toggle', { bubbles: true, detail: { open } }));
980
+ }
981
+ /** Draws a change of an item's open: its state, its list revealed or hidden, and the focus kept (TRV-12). */
982
+ draw(item, open, atOnce) {
983
+ this.readState(item);
984
+ const list = listOf(item);
985
+ if (open && list)
986
+ this.readList(list, true);
987
+ // TRV-12: a parent that closes around the focus takes it.
988
+ if (!open && list) {
989
+ if (this.active && this.active !== item && item.contains(this.active))
990
+ this.focusRow(item, false);
991
+ if (this.last && this.last !== item && item.contains(this.last))
992
+ this.last = item;
993
+ }
994
+ if (atOnce) {
995
+ // The chevron's turn is drawn at once too: its style is computed with the transition off.
996
+ const row = rowOf(item);
997
+ item.setAttribute(AT_ONCE, '');
998
+ if (row)
999
+ void getComputedStyle(row, '::before').rotate;
1000
+ }
1001
+ if (list)
1002
+ this.move(list, open, atOnce);
1003
+ if (atOnce) {
1004
+ const row = rowOf(item);
1005
+ if (row)
1006
+ void getComputedStyle(row, '::before').rotate;
1007
+ item.removeAttribute(AT_ONCE);
1008
+ }
1009
+ this.readStop();
1010
+ }
1011
+ /** A list at rest: shown, or closed — where the browser can, still searched by its find-in-page (TRV-14). */
1012
+ rest(list, open) {
1013
+ list.removeAttribute(MOVING);
1014
+ if (this.inerted.has(list)) {
1015
+ this.inerted.delete(list);
1016
+ list.inert = false;
1017
+ }
1018
+ if (open) {
1019
+ if (list.getAttribute('hidden') === 'until-found')
1020
+ list.removeAttribute('hidden');
1021
+ }
1022
+ else if (UNTIL_FOUND && !list.hasAttribute('hidden'))
1023
+ list.setAttribute('hidden', 'until-found');
1024
+ }
1025
+ /**
1026
+ * TRV-11: the list is revealed from its item's row downward, or hidden toward it. Its rows are laid out once, at
1027
+ * their size, and one animation moves the height it is seen through, between nothing and that size — measured once,
1028
+ * when the change begins. A list that is being hidden stays drawn until the end and leaves the keys and assistive
1029
+ * technology at once. A change on the way goes on from where the height is.
1030
+ */
1031
+ move(list, open, atOnce) {
1032
+ const running = this.motions.get(list);
1033
+ const from = running ? list.getBoundingClientRect().height : null;
1034
+ if (running) {
1035
+ this.motions.delete(list);
1036
+ running.cancel();
1037
+ }
1038
+ if (atOnce || typeof list.animate !== 'function' || !list.isConnected) {
1039
+ this.rest(list, open);
1040
+ return;
1041
+ }
1042
+ // (The list's own transition holds the disclosure's time and curve as the cascade computes them.)
1043
+ const style = getComputedStyle(list);
1044
+ const duration = Number.parseFloat(style.transitionDuration) * 1000;
1045
+ if (!(duration > 0)) {
1046
+ this.rest(list, open);
1047
+ return;
1048
+ }
1049
+ if (list.getAttribute('hidden') === 'until-found')
1050
+ list.removeAttribute('hidden');
1051
+ list.setAttribute(MOVING, open ? 'opening' : 'closing');
1052
+ if (!open && !list.inert) {
1053
+ list.inert = true;
1054
+ this.inerted.add(list);
1055
+ }
1056
+ else if (open && this.inerted.has(list)) {
1057
+ this.inerted.delete(list);
1058
+ list.inert = false;
1059
+ }
1060
+ const size = list.getBoundingClientRect().height;
1061
+ const frames = { blockSize: [`${from ?? (open ? 0 : size)}px`, `${open ? size : 0}px`] };
1062
+ let motion;
1063
+ try {
1064
+ motion = list.animate(frames, { duration, fill: 'forwards', easing: style.transitionTimingFunction.split(/,(?![^(]*\))/)[0].trim() || 'ease' });
1065
+ }
1066
+ catch {
1067
+ motion = list.animate(frames, { duration, fill: 'forwards', easing: 'ease' });
1068
+ }
1069
+ this.motions.set(list, motion);
1070
+ // (Held at its end until the list is at rest, so that no frame shows it between the two.)
1071
+ const done = () => {
1072
+ if (this.motions.get(list) !== motion)
1073
+ return;
1074
+ this.motions.delete(list);
1075
+ this.rest(list, open);
1076
+ motion.cancel();
1077
+ };
1078
+ motion.finished.then(done, () => { });
1079
+ }
1080
+ // ── The loading row (TRV-13) ──────────────────────────────────────────────────────────────────────────────────
1081
+ /**
1082
+ * A loading parent holds one loading row, the last thing in its list — after the rows it already holds, one level
1083
+ * further in, shown and hidden with them. A parent that holds no list yet is given one of the element's own for it.
1084
+ * It is an `<li>` that is not an item: no role, no focus, not counted.
1085
+ */
1086
+ readLoading(item) {
1087
+ const want = isParent(item) && item.hasAttribute('data-loading');
1088
+ let loader = this.loaders.get(item) ?? null;
1089
+ const made = item.querySelector(`:scope > [${OWN_LIST}]`);
1090
+ if (!want) {
1091
+ if (loader) {
1092
+ this.loaders.delete(item);
1093
+ loader.remove();
1094
+ }
1095
+ made?.remove();
1096
+ return;
1097
+ }
1098
+ let list = listOf(item);
1099
+ if (!list) {
1100
+ list = document.createElement('ul');
1101
+ list.setAttribute(OWN_LIST, '');
1102
+ list.setAttribute('role', 'group');
1103
+ item.append(list);
1104
+ this.live.add(list);
1105
+ this.rest(list, isOpen(item));
1106
+ }
1107
+ else if (made && list !== made)
1108
+ made.remove();
1109
+ if (!loader) {
1110
+ loader = document.createElement('li');
1111
+ loader.setAttribute(LOADING, '');
1112
+ // A tree holds tree items and their groups, and nothing else: the row is kept from assistive technology, which
1113
+ // is told that the parent is busy (TRV-13, TRV-32). The indicator is still named, as the component asks.
1114
+ loader.setAttribute('role', 'none');
1115
+ loader.setAttribute('aria-hidden', 'true');
1116
+ const row = document.createElement('span');
1117
+ const box = document.createElement('span');
1118
+ box.setAttribute('data-tanrei-loading-box', '');
1119
+ const indicator = document.createElement('tanrei-loading-indicator');
1120
+ indicator.setAttribute('size', 'small');
1121
+ box.append(indicator);
1122
+ const words = document.createElement('span');
1123
+ words.setAttribute('data-tanrei-loading-label', '');
1124
+ words.setAttribute('dir', 'auto');
1125
+ row.append(box, words);
1126
+ loader.append(row);
1127
+ this.loaders.set(item, loader);
1128
+ this.writeLoader(loader);
1129
+ }
1130
+ if (list.lastElementChild !== loader)
1131
+ list.append(loader);
1132
+ this.check();
1133
+ }
1134
+ /** The words of a loading row, and the name of its indicator: the tree's `loadingLabel`. */
1135
+ writeLoader(loader) {
1136
+ const indicator = loader.querySelector('tanrei-loading-indicator');
1137
+ const words = loader.querySelector('[data-tanrei-loading-label]');
1138
+ // The tree's own `loadingLabel`, else the product's words.
1139
+ const loading = this.words.get('loadingLabel', this.loadingLabel);
1140
+ if (indicator && indicator.getAttribute('label') !== loading)
1141
+ indicator.setAttribute('label', loading);
1142
+ if (words && words.textContent !== loading)
1143
+ words.textContent = loading;
1144
+ }
1145
+ // ── Focus (TRV-12, TRV-19) ────────────────────────────────────────────────────────────────────────────────────
1146
+ /** Moves focus to an item's row, and brings the row into view by the least distance that shows it whole (TRV-12). */
1147
+ focusRow(item, reveal = true) {
1148
+ this.last = item;
1149
+ this.readStop();
1150
+ const row = rowOf(item);
1151
+ row?.focus({ preventScroll: true });
1152
+ if (reveal)
1153
+ row?.scrollIntoView({ block: 'nearest', inline: 'nearest' });
1154
+ }
1155
+ /** The item whose row has an event of the keyboard or of focus: the row is what takes focus. */
1156
+ rowItem(row) {
1157
+ const item = row instanceof HTMLElement ? row.parentElement : null;
1158
+ return isItem(item) && rowOf(item) === row && item.closest(TAG) === this ? item : null;
1159
+ }
1160
+ // ── Presses (TRV-10, TRV-16, TRV-17, TRV-26, TRV-28, TRV-29) ──────────────────────────────────────────────────
1161
+ /**
1162
+ * What a press on a row does (TRV-10, TRV-22): the chevron of a parent opens and closes it; the row of an item that
1163
+ * can be chosen chooses it; the row of a parent that cannot opens and closes it; a leaf that cannot be chosen, and a
1164
+ * disabled item, answer nothing. One press never does two things.
1165
+ */
1166
+ activate(item, chevron) {
1167
+ if (isDisabled(item))
1168
+ return;
1169
+ if (!chevron && this.canChoose(item))
1170
+ this.choose(item);
1171
+ else if (isParent(item))
1172
+ this.toggle(item, !item.hasAttribute('data-open'));
1173
+ }
1174
+ /** TRV-16, TRV-17: the user chooses an item; `change`, exactly once, where the selection changed. */
1175
+ choose(item) {
1176
+ const value = valueOf(item);
1177
+ if (this.mode === 'single') {
1178
+ // A single choice is never cleared by its own item.
1179
+ if (this.value === value)
1180
+ return;
1181
+ this.value = value;
1182
+ this.readSelection();
1183
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { value } }));
1184
+ }
1185
+ else {
1186
+ this.values = this.values.includes(value) ? this.values.filter((held) => held !== value) : [...this.values, value];
1187
+ this.readSelection();
1188
+ this.dispatchEvent(new CustomEvent('change', { bubbles: true, detail: { values: [...this.values] } }));
1189
+ }
1190
+ }
1191
+ /**
1192
+ * TRV-26: whether a press at `x` is on the chevron of a parent that can be chosen — from the tree's start edge to
1193
+ * the middle of the gap after the chevron's box, and at least the target wide. The lengths are the row's own, as the
1194
+ * cascade computes them.
1195
+ */
1196
+ onChevron(row, x) {
1197
+ const style = getComputedStyle(row);
1198
+ const chevron = getComputedStyle(row, '::before');
1199
+ const rtl = style.direction === 'rtl';
1200
+ const box = row.getBoundingClientRect();
1201
+ // The least width is the tree's own, read where the stylesheet has a real property compute it.
1202
+ const { target } = treeLengths(this);
1203
+ const reach = Math.max(Number.parseFloat(rtl ? style.paddingRight : style.paddingLeft) + Number.parseFloat(chevron.width) + (Number.parseFloat(chevron.marginLeft) + Number.parseFloat(chevron.marginRight)) / 2, target > 0 ? target : 0);
1204
+ return (rtl ? box.right - x : x - box.left) <= reach;
1205
+ }
1206
+ /** The press of one row (the shared primitive), made when it is first pressed. */
1207
+ pressOf(item, row) {
1208
+ let press = this.presses.get(row);
1209
+ if (!press) {
1210
+ press = new PressController(row, {
1211
+ container: () => row,
1212
+ // The row's first transition is the hold (tree-view.css), so its delay is press-hold as a time.
1213
+ holdCarrier: () => row,
1214
+ disabled: () => !this.answers(item),
1215
+ });
1216
+ this.presses.set(row, press);
1217
+ this.pressControllers.add(press);
1218
+ }
1219
+ return press;
1220
+ }
1221
+ }
1222
+ /** The order a row's parts are read in as its description (TRV-32): supporting text, trailing content, trailing text. */
1223
+ function order(part) {
1224
+ return part.hasAttribute('data-supporting-text') ? 0 : part.hasAttribute('data-trailing') ? 1 : part.hasAttribute('data-trailing-text') ? 2 : 3;
1225
+ }
1226
+ if (!customElements.get('tanrei-tree-view'))
1227
+ customElements.define('tanrei-tree-view', TanreiTreeView);
1228
+ //# sourceMappingURL=tree-view.js.map