@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,963 @@
1
+ import { LitElement, html, nothing } from 'lit';
2
+ import { classMap } from 'lit/directives/class-map.js';
3
+ import { AvailabilityController, GlyphDrawnController, PressController, report, styleQueries, syncFocusStyle } from '../../primitives/index.js';
4
+ import { LINK_KEYS } from '../../primitives/link.js';
5
+ import { debugBuild } from '../../primitives/report.js';
6
+ import { ownDirection } from '../../styles/product-text.js';
7
+ import { styles } from './table-of-contents.styles.js';
8
+ import { adopt, adoptUnlessDrawn } from '../../primitives/sheets.js';
9
+ const LIST_CSS = (() => {
10
+ try {
11
+ return "@layer tanrei.components {\n:where(tanrei-table-of-contents) :where(li) > :where(a) {\n& {\n--tanrei-corner-pill: 0;\n}\n& {\n--_corner-scale: 1;\nborder-radius: calc(var(--tanrei-corner-radius) * var(--_corner-scale));\n}\n@supports (corner-shape: superellipse(log(2, 2))) {\n& {\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&::before,\n&::after {\ncorner-shape: inherit;\n}\n}\n:where(tanrei-table-of-contents) {\n--_toc-row-height: var(--tanrei-comp-table-of-contents-row-height-regular);\n--_toc-row-pad: var(--tanrei-comp-table-of-contents-row-padding-block-regular);\n--_toc-row-floor: var(--tanrei-sys-target-pointer);\n--_toc-next: 0px;\n--_toc-start: left;\n--_toc-left: 1;\n--_toc-right: 0;\ndisplay: block;\nbox-sizing: border-box;\nmin-inline-size: 0;\nmargin: 0;\npadding: 0;\n}\n:where(tanrei-table-of-contents):dir(rtl) {\n--_toc-start: right;\n--_toc-left: 0;\n--_toc-right: 1;\n}\n:where(tanrei-table-of-contents[density='compact']) {\n--_toc-row-height: var(--tanrei-comp-table-of-contents-row-height-compact);\n--_toc-row-pad: var(--tanrei-comp-table-of-contents-row-padding-block-compact);\n--_toc-row-floor: 0px;\n}\n@media (pointer: coarse) {\n:where(tanrei-table-of-contents),\n:where(tanrei-table-of-contents[density='compact']) {\n--_toc-row-floor: var(--tanrei-sys-target-touch);\n}\n}\n:where(tanrei-table-of-contents[presentation='compact']:defined) {\ndisplay: flex;\nflex-direction: column;\n}\n:where(tanrei-table-of-contents[hidden], tanrei-table-of-contents[data-empty], tanrei-table-of-contents:not(:has(li > a))) {\ndisplay: none;\n}\n:where(tanrei-table-of-contents[label]:not([label=''], [label-hidden], :defined, :has(> [slot='title'])))::before {\ncontent: attr(label);\ndisplay: block;\nmargin-block-end: var(--tanrei-comp-table-of-contents-container-gap);\nfont: var(--tanrei-comp-table-of-contents-title-typescale-font);\nletter-spacing: var(--tanrei-comp-table-of-contents-title-typescale-letter-spacing);\ncolor: var(--tanrei-comp-table-of-contents-title-color);\ntext-align: var(--_toc-start);\noverflow-wrap: anywhere;\nunicode-bidi: plaintext;\n}\n:where(tanrei-table-of-contents) > :where([slot='title']) {\nmargin: 0;\npadding: 0;\nfont: var(--tanrei-comp-table-of-contents-title-typescale-font);\nletter-spacing: var(--tanrei-comp-table-of-contents-title-typescale-letter-spacing);\ncolor: var(--tanrei-comp-table-of-contents-title-color);\ntext-align: var(--_toc-start);\noverflow-wrap: anywhere;\nunicode-bidi: plaintext;\n}\n:where(tanrei-table-of-contents:not(:defined)) > :where([slot='title']) {\nmargin-block-end: var(--tanrei-comp-table-of-contents-container-gap);\n}\n:where(tanrei-table-of-contents[label-hidden]:not(:defined)) > :where([slot='title']) {\ndisplay: none;\n}\n:where(tanrei-table-of-contents) :where(ul, ol) {\n--_toc-inset: var(--_toc-next);\ndisplay: block;\nbox-sizing: border-box;\nmin-inline-size: 0;\nmargin: 0;\npadding: 0;\nlist-style: none;\n}\n:where(tanrei-table-of-contents) :where(li) {\n--_toc-next: calc(var(--_toc-inset) + var(--tanrei-comp-table-of-contents-row-indent));\ndisplay: grid;\ngrid-template-columns: minmax(0, 1fr);\nbox-sizing: border-box;\nmin-inline-size: 0;\nmargin: 0;\npadding: 0;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(ul, ol) {\ngrid-column: 1;\ngrid-row: 2;\n}\n:where(tanrei-table-of-contents) :where(li:has(> a:empty), li[data-tanrei-empty]) {\ndisplay: none;\n}\n:where(tanrei-table-of-contents) > :where(ul, ol) {\nposition: relative;\n}\n:where(tanrei-table-of-contents) > :where(ul, ol)::before {\ncontent: '';\nposition: absolute;\ninset-block: 0;\ninset-inline-start: 0;\nborder-inline-start: var(--tanrei-comp-table-of-contents-rail-width) solid var(--tanrei-comp-table-of-contents-rail-color);\npointer-events: none;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a) {\n--_toc-container: var(--tanrei-comp-table-of-contents-item-container-color);\n--_toc-label: var(--tanrei-comp-table-of-contents-item-label-color);\n--_toc-hovered-container: var(--tanrei-comp-table-of-contents-item-hovered-container-color);\n--_toc-hovered-label: var(--tanrei-comp-table-of-contents-item-hovered-label-color);\n--_toc-focused-container: var(--tanrei-comp-table-of-contents-item-focused-container-color);\n--_toc-focused-label: var(--tanrei-comp-table-of-contents-item-focused-label-color);\n--_toc-pressed-container: var(--tanrei-comp-table-of-contents-item-pressed-container-color);\n--_toc-pressed-label: var(--tanrei-comp-table-of-contents-item-pressed-label-color);\n--_toc-now-container: var(--_toc-container);\n--_toc-now-label: var(--_toc-label);\n--tanrei-corner-radius: var(--tanrei-comp-table-of-contents-row-shape);\n--tanrei-corner-pill: var(--tanrei-comp-table-of-contents-row-shape-pill, 0);\ngrid-column: 1;\ngrid-row: 1;\nposition: relative;\nisolation: isolate;\ndisplay: block;\nbox-sizing: border-box;\nmin-inline-size: 0;\nmin-block-size: max(var(--_toc-row-height), var(--_toc-row-floor));\nmargin: 0;\npadding-block: var(--_toc-row-pad);\npadding-left: calc(var(--tanrei-comp-table-of-contents-row-padding-inline) + var(--_toc-inset) * var(--_toc-left));\npadding-right: calc(var(--tanrei-comp-table-of-contents-row-padding-inline) + var(--_toc-inset) * var(--_toc-right));\nalign-content: center;\nfont: var(--tanrei-comp-table-of-contents-label-typescale-font);\nletter-spacing: var(--tanrei-comp-table-of-contents-label-typescale-letter-spacing);\ncolor: var(--_toc-now-label);\ntext-decoration: none;\noverflow-wrap: anywhere;\ntext-align: var(--_toc-start);\nunicode-bidi: plaintext;\nbackground-color: var(--_toc-now-container);\nbackground-image: var(--_toc-held-image);\nbackground-clip: var(--_toc-held-clip);\ncursor: pointer;\n-webkit-tap-highlight-color: transparent;\n--_toc-held-image: none;\n--_toc-held-clip: border-box;\ntransition:\n--_toc-held-image 0s linear var(--tanrei-sys-motion-duration-press-hold),\n--_toc-held-clip 0s linear var(--tanrei-sys-motion-duration-press-hold),\nbackground-color var(--tanrei-comp-table-of-contents-motion-state-duration) var(--tanrei-comp-table-of-contents-motion-state-easing),\ncolor var(--tanrei-comp-table-of-contents-motion-state-duration) var(--tanrei-comp-table-of-contents-motion-state-easing),\nopacity var(--tanrei-comp-table-of-contents-motion-state-duration) var(--tanrei-comp-table-of-contents-motion-state-easing);\ntransition-behavior: allow-discrete;\n}\n:where(tanrei-table-of-contents) :where(li[data-tanrei-label])::before {\ncontent: attr(data-tanrei-label);\ncontent: attr(data-tanrei-label) / '';\ngrid-column: 1;\ngrid-row: 1;\nbox-sizing: border-box;\nmin-inline-size: 0;\npadding-block: var(--_toc-row-pad);\npadding-left: calc(var(--tanrei-comp-table-of-contents-row-padding-inline) + var(--_toc-inset) * var(--_toc-left));\npadding-right: calc(var(--tanrei-comp-table-of-contents-row-padding-inline) + var(--_toc-inset) * var(--_toc-right));\nfont: var(--tanrei-comp-table-of-contents-label-typescale-font);\nfont-weight: var(--tanrei-comp-table-of-contents-label-typescale-font-weight-emphasized);\nletter-spacing: var(--tanrei-comp-table-of-contents-label-typescale-letter-spacing);\noverflow-wrap: anywhere;\nunicode-bidi: plaintext;\nvisibility: hidden;\npointer-events: none;\n}\n:where(tanrei-table-of-contents) :where(li[data-tanrei-neutral]) > :where(a),\n:where(tanrei-table-of-contents) :where(li[data-tanrei-neutral])::before {\nunicode-bidi: normal;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a)::before {\ncontent: '';\nposition: absolute;\ninset-block: 0;\nleft: 0;\nright: 0;\nborder: 0 solid var(--tanrei-comp-table-of-contents-marker-color);\nborder-left-width: calc(var(--tanrei-comp-table-of-contents-marker-width) * var(--_toc-left));\nborder-right-width: calc(var(--tanrei-comp-table-of-contents-marker-width) * var(--_toc-right));\nopacity: 0;\npointer-events: none;\ntransition: opacity var(--tanrei-comp-table-of-contents-motion-state-duration) var(--tanrei-comp-table-of-contents-motion-state-easing);\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a[aria-current]:not([aria-current='false'])) {\n--_toc-container: var(--tanrei-comp-table-of-contents-current-container-color);\n--_toc-label: var(--tanrei-comp-table-of-contents-current-label-color);\n--_toc-hovered-container: var(--tanrei-comp-table-of-contents-current-hovered-container-color);\n--_toc-hovered-label: var(--tanrei-comp-table-of-contents-current-hovered-label-color);\n--_toc-focused-container: var(--tanrei-comp-table-of-contents-current-focused-container-color);\n--_toc-focused-label: var(--tanrei-comp-table-of-contents-current-focused-label-color);\n--_toc-pressed-container: var(--tanrei-comp-table-of-contents-current-pressed-container-color);\n--_toc-pressed-label: var(--tanrei-comp-table-of-contents-current-pressed-label-color);\nfont-weight: var(--tanrei-comp-table-of-contents-label-typescale-font-weight-emphasized);\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a[aria-current]:not([aria-current='false']))::before {\nopacity: 1;\n}\n@media (hover: hover) {\n:where(tanrei-table-of-contents) :where(li) > :where(a:hover) {\n--_toc-now-container: var(--_toc-hovered-container);\n--_toc-now-label: var(--_toc-hovered-label);\nopacity: var(--tanrei-comp-table-of-contents-hovered-opacity);\n}\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a:focus-visible) {\n--_toc-now-container: var(--_toc-focused-container);\n--_toc-now-label: var(--_toc-focused-label);\nopacity: var(--tanrei-comp-table-of-contents-focused-opacity);\noutline: var(--tanrei-sys-focus-outer-width) solid var(--tanrei-sys-color-focus-ring);\noutline-offset: calc(var(--tanrei-sys-focus-outer-width) * -1);\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a:focus-visible)::after {\ncontent: '';\nposition: absolute;\ninset: var(--tanrei-sys-focus-outer-width);\nborder: var(--tanrei-sys-focus-inner-width) solid var(--tanrei-sys-color-focus-ring-inner);\nborder-radius: max(0px, calc(var(--tanrei-corner-radius) * var(--_corner-scale) - var(--tanrei-sys-focus-outer-width)));\npointer-events: none;\n}\n@container style(--tanrei-sys-behavior-focus-style: glow) {\n:where(tanrei-table-of-contents) :where(li) > :where(a:focus-visible) {\noutline-color: transparent;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a:focus-visible)::after {\n--_toc-glow-inset: calc((var(--tanrei-sys-focus-inner-width) + var(--tanrei-sys-focus-outer-width)) * 2);\ninset: var(--_toc-glow-inset);\nborder: 0;\nborder-radius: max(0px, calc(var(--tanrei-corner-radius) * var(--_corner-scale) - var(--_toc-glow-inset)));\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);\n}\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a[data-focus-style='glow']:focus-visible) {\noutline-color: transparent;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a[data-focus-style='glow']:focus-visible)::after {\n--_toc-glow-inset: calc((var(--tanrei-sys-focus-inner-width) + var(--tanrei-sys-focus-outer-width)) * 2);\ninset: var(--_toc-glow-inset);\nborder: 0;\nborder-radius: max(0px, calc(var(--tanrei-corner-radius) * var(--_corner-scale) - var(--_toc-glow-inset)));\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);\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a:active:not([data-pressed])) {\n--_toc-held-image: linear-gradient(var(--_toc-pressed-container), var(--_toc-pressed-container)), none;\n--_toc-held-clip: border-box, text;\n--_toc-now-label: var(--_toc-pressed-label);\nopacity: var(--tanrei-comp-table-of-contents-pressed-opacity);\ntransition-duration: 0s;\ntransition-delay: 0s;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a[data-pressed]:not([data-pressed='none'])) {\ntransition-duration: 0s;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a[data-pressed='overlay']) {\n--_toc-now-container: var(--_toc-pressed-container);\n--_toc-now-label: var(--_toc-pressed-label);\nopacity: var(--tanrei-comp-table-of-contents-pressed-opacity);\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a[data-pressed='ripple'], a[data-pressed='dim']) {\n--_toc-now-label: var(--_toc-pressed-label);\nopacity: var(--tanrei-comp-table-of-contents-pressed-opacity);\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a) > :where(.ripple) {\nposition: absolute;\nz-index: -1;\ninset: 0;\nborder-radius: inherit;\ncorner-shape: inherit;\nbackground: var(--_toc-pressed-container);\npointer-events: none;\nclip-path: circle(var(--_r) at var(--_x) var(--_y));\nanimation: tanrei-table-of-contents-ripple var(--tanrei-comp-table-of-contents-motion-feedback-duration) var(--tanrei-comp-table-of-contents-motion-state-easing) both;\ntransition: opacity var(--tanrei-comp-table-of-contents-motion-state-duration) var(--tanrei-comp-table-of-contents-motion-state-easing);\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a) > :where(.ripple.leaving) {\nopacity: 0;\n}\n@keyframes tanrei-table-of-contents-ripple {\nfrom {\nclip-path: circle(0 at var(--_x) var(--_y));\n}\n}\n@media (prefers-reduced-motion: reduce) {\n:where(tanrei-table-of-contents) :where(li) > :where(a) {\ntransition:\n--_toc-held-image 0s linear var(--tanrei-sys-motion-duration-press-hold),\n--_toc-held-clip 0s linear var(--tanrei-sys-motion-duration-press-hold);\ntransition-behavior: allow-discrete;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a)::before {\ntransition: none;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a) > :where(.ripple) {\nanimation: none;\ntransition: none;\n}\n}\n@media (forced-colors: active) {\n:where(tanrei-table-of-contents[label])::before,\n:where(tanrei-table-of-contents) > :where([slot='title']) {\ncolor: CanvasText;\n}\n:where(tanrei-table-of-contents) > :where(ul, ol)::before {\nborder-inline-start-color: CanvasText;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a) {\nbackground-image: none;\nbackground-clip: border-box;\ncolor: LinkText;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a[aria-current]:not([aria-current='false'])) {\ncolor: CanvasText;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a)::before {\nborder-color: CanvasText;\n}\n:where(tanrei-table-of-contents) :where(li) > :where(a:focus-visible) {\noutline-color: Highlight;\n}\n}\n}";
12
+ }
13
+ catch {
14
+ return '';
15
+ }
16
+ })();
17
+ const TAG = 'tanrei-table-of-contents';
18
+ const PREFIX = '--tanrei-comp-table-of-contents';
19
+ const PRESENTATIONS = ['list', 'compact'];
20
+ const TRACKINGS = ['auto', 'manual'];
21
+ const CORE_DENSITIES = ['regular', 'compact'];
22
+ const DEFAULT_DENSITY = 'regular';
23
+ /** The members of the density axis (`dev.tanrei.axes.density.members`) as table-of-contents.css names them. */
24
+ const DENSITY_MEMBERS = [
25
+ ['--_toc-row-height', 'row-height-*'],
26
+ ['--_toc-row-pad', 'row-padding-block-*'],
27
+ ];
28
+ /** Attribute values are interpolated into CSS: only token-name characters are accepted. */
29
+ const KEY = /^[a-z0-9][a-z0-9-]*$/;
30
+ /** What the element wrote on the product's elements (see table-of-contents.css). */
31
+ const LABEL = 'data-tanrei-label';
32
+ const EMPTY = 'data-tanrei-empty';
33
+ const NEUTRAL = 'data-tanrei-neutral';
34
+ /** A character with a direction of its own: a letter of any script (digits, signs and spaces have none). */
35
+ const STRONG = /\p{L}/u;
36
+ /** TOC-39: deeper than this is reported. */
37
+ const MAX_DEPTH = 3;
38
+ /** TOC-9: a target has reached the line when it is less than one unit of layout short of it. */
39
+ const UNIT = 1;
40
+ /** A row moved by less than this has not moved: boxes are laid out on fractions of a pixel. */
41
+ const SLACK = 0.5;
42
+ /**
43
+ * TOC-12: how long the view must have been still, after an item was chosen or the address named one, before the move
44
+ * to the target is taken to be over — from then on the person's next scrolling ends the hold. Not a design value: the
45
+ * time between two `scroll` events of one glide is a frame, and this is several.
46
+ */
47
+ const STILL_MS = 150;
48
+ /** The keys that scroll a view (TOC-12: "a key"). */
49
+ const SCROLL_KEYS = ['ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End', ' '];
50
+ const sheets = new Map();
51
+ /** A stylesheet of the page, made once and shared by every root that needs it. */
52
+ function sheet(id, text) {
53
+ if (typeof CSSStyleSheet === 'undefined')
54
+ return null;
55
+ let made = sheets.get(id);
56
+ if (!made) {
57
+ made = new CSSStyleSheet();
58
+ try {
59
+ made.replaceSync(text());
60
+ }
61
+ catch {
62
+ // A browser that cannot construct it: the page's own copy of table-of-contents.css draws the list.
63
+ }
64
+ sheets.set(id, made);
65
+ }
66
+ return made;
67
+ }
68
+ /** TOC-39: a density a design system added — the default's rules, read from that density's tokens. */
69
+ 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(' ')} } }`;
70
+ /** Writes an attribute only when it differs: what is written here may be observed, and must settle. */
71
+ function mark(element, name, value) {
72
+ if (value === null) {
73
+ if (element.hasAttribute(name))
74
+ element.removeAttribute(name);
75
+ }
76
+ else if (element.getAttribute(name) !== value)
77
+ element.setAttribute(name, value);
78
+ }
79
+ const decoded = (fragment) => {
80
+ try {
81
+ return decodeURIComponent(fragment);
82
+ }
83
+ catch {
84
+ return fragment;
85
+ }
86
+ };
87
+ /** The fragment an anchor names on the page it is on (`#install` → `install`), or null where it leads elsewhere. */
88
+ function fragmentOf(a) {
89
+ const address = a.href;
90
+ const at = address.indexOf('#');
91
+ if (at < 0 || address.slice(0, at) !== location.href.split('#')[0])
92
+ return null;
93
+ return decoded(address.slice(at + 1));
94
+ }
95
+ /**
96
+ * Where a fragment leads, as the browser reads it: the element with that id, else the anchor with that name, else —
97
+ * for the empty fragment and for `top` — the top of the document (TOC-10); nothing otherwise (TOC-16).
98
+ */
99
+ function targetOf(fragment) {
100
+ if (fragment === null)
101
+ return null;
102
+ if (fragment === '')
103
+ return 'top';
104
+ const named = document.getElementById(fragment) ?? [...document.getElementsByName(fragment)].find((element) => element.localName === 'a') ?? null;
105
+ return named ?? (fragment.toLowerCase() === 'top' ? 'top' : null);
106
+ }
107
+ /** A length of a computed style in pixels: `auto` and anything unreadable are 0, a percentage is of `whole`. */
108
+ function pixels(value, whole) {
109
+ const number = Number.parseFloat(value);
110
+ if (!Number.isFinite(number))
111
+ return 0;
112
+ return value.trim().endsWith('%') ? (number / 100) * whole : number;
113
+ }
114
+ const scrolls = (element) => /^(auto|scroll|overlay)$/.test(getComputedStyle(element).overflowY) && element.scrollHeight - element.clientHeight > UNIT;
115
+ const isPage = (element) => element === document.documentElement || element === document.body;
116
+ /** The element's parent as it is drawn: the slot it is assigned to, its parent, or the host of the root it is in. */
117
+ const flatParent = (element) => {
118
+ if (element.assignedSlot)
119
+ return element.assignedSlot;
120
+ if (element.parentElement)
121
+ return element.parentElement;
122
+ const root = element.getRootNode();
123
+ return root instanceof ShadowRoot ? root.host : null;
124
+ };
125
+ const reducedMotion = () => typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion: reduce)').matches;
126
+ /**
127
+ * Lists the headings of the page being read as links to them and marks the one whose section is being read.
128
+ *
129
+ * Sub-headings are set in under their heading; where there is no room beside the text, the compact presentation is one
130
+ * row that names the current section and opens the same list.
131
+ *
132
+ * Contract: specs/table-of-contents.spec.json. The items are the product's own nested list of anchors, which stay in
133
+ * the document (TOC-6): before the element is defined, and with scripting off, the page holds a plain list of links
134
+ * that work.
135
+ *
136
+ * ```html
137
+ * <tanrei-table-of-contents label="On this page">
138
+ * <ul>
139
+ * <li><a href="#install">Install</a>
140
+ * <ul>
141
+ * <li><a href="#npm">npm</a></li>
142
+ * </ul>
143
+ * </li>
144
+ * <li><a href="#configure">Configure</a></li>
145
+ * </ul>
146
+ * </tanrei-table-of-contents>
147
+ * ```
148
+ *
149
+ * An item is an `<li>` whose first child is its anchor — `href` is the anchor's own attribute and the label its text —
150
+ * and the item's own items are a list after the anchor, inside the same `<li>`. Everything drawn on the list is
151
+ * `@tanrei/web/table-of-contents.css` (every value a `--tanrei-comp-table-of-contents-*` token), which draws it before
152
+ * and without this script; the element adds the same sheet to the root it is connected to. The shadow root holds only
153
+ * what the product did not write: a `<nav>` named by `label`, the title, and the compact presentation's block and row.
154
+ *
155
+ * Which item is current (`tracking="auto"`, TOC-9 to TOC-16): the last item, in the page's order, whose target has
156
+ * reached the line — where the browser itself rests a target it is sent to: the top of the view that scrolls the
157
+ * targets, plus that view's `scroll-padding-block-start`, plus the target's own `scroll-margin-block-start`. So a
158
+ * fixed header and the space a heading keeps above itself are declared once, in CSS, and never passed to the element.
159
+ * It reads the view on `scroll` (one passive listener, coalesced to a frame), on `resize` and when what it holds
160
+ * changes size; at rest it runs nothing. It never scrolls the view that holds the targets, never writes the address
161
+ * and never focuses anything in the content.
162
+ *
163
+ * @tag tanrei-table-of-contents
164
+ * @slot - The items: the product's own nested list (`<ul>` of `<li>`, each with its `<a href>` first). It stays in the document.
165
+ * @slot title - The product's own title in place of the label's text: a heading of the level the page's outline needs. Drawn in the title's text style whatever its level; `label` still names the landmark and the compact row.
166
+ * @csspart nav - The navigation landmark; in the compact presentation the filled block.
167
+ * @csspart title - The title above the list (list presentation).
168
+ * @csspart disclosure-row - The compact presentation's row: a button that shows and hides the list.
169
+ * @csspart icon - The row's chevron (hidden from assistive technology).
170
+ * @csspart list - The box that holds the list; in the compact presentation the part that scrolls where the block is held to less than the list needs.
171
+ * @fires {CustomEvent<TanreiTableOfContentsCurrentChangeDetail>} currentchange - The current item changed while tracking is auto; `detail.href` is the new item's href, or an empty string. Never for a value the product set, never while tracking is manual.
172
+ * @fires {CustomEvent<TanreiTableOfContentsSelectDetail>} select - An item was activated; `detail.href` is its href. Dispatched from the anchor's click, before the browser follows the link; cancelable, cancelling the click with it.
173
+ * @fires {CustomEvent<TanreiTableOfContentsToggleDetail>} toggle - The compact presentation's list was shown or hidden by the user (the row, an item chosen, Escape); `detail.open` is the new state.
174
+ */
175
+ export class TanreiTableOfContents extends LitElement {
176
+ constructor() {
177
+ super(...arguments);
178
+ this.availability = new AvailabilityController(this, 'table-of-contents');
179
+ /** The title, in the product's language ("On this page"): drawn above the list and in the compact row, and the accessible name of the navigation landmark. Required. */
180
+ this.label = '';
181
+ /** Draws no title above the list and keeps `label` as the landmark's name. The compact row always shows the title. */
182
+ this.labelHidden = false;
183
+ /** How it stands: `list` is the title and the whole list; `compact` is one row that names the current section and opens the list below it. Which one a window gets is the layout's that places it. */
184
+ this.presentation = 'list';
185
+ /** How tall a row of the list is: `regular` holds the pointer target; `compact` is lower, for a long list beside the text of a product read with a pointer. For touch a row is the touch target in both. A design system may add values. */
186
+ this.density = 'regular';
187
+ /** In the compact presentation, whether the list is shown below the row. The element sets it when the user opens, closes or chooses. Ignored in the list presentation. */
188
+ this.open = false;
189
+ /** The `href` of the item whose section the person is in; empty while none is. Set by the element while `tracking` is `auto`, by the product while it is `manual`. */
190
+ this.current = '';
191
+ /** Who decides which item is current: `auto` — the element, from where the items' targets are in the view that scrolls them; `manual` — the product, through `current`. */
192
+ this.tracking = 'auto';
193
+ this.glyphs = new GlyphDrawnController(this, () => this.renderRoot?.querySelectorAll('.chevron') ?? []);
194
+ this.rowPress = new PressController(this, {
195
+ container: () => this.row,
196
+ holdCarrier: () => this.renderRoot?.querySelector('.row-current') ?? null,
197
+ disabled: () => false,
198
+ });
199
+ this.mutations = typeof MutationObserver === 'undefined' ? null : new MutationObserver((records) => this.mutated(records));
200
+ /** The items, in the page's order; and those that can be current — the first of each href (TOC-39). */
201
+ this.items = [];
202
+ this.trackable = [];
203
+ this.itemsStale = true;
204
+ /** The anchors whose `aria-current` this element wrote: only that is taken off again while the product decides. */
205
+ this.wrote = new WeakSet();
206
+ /** The anchors this element gave their text's direction. */
207
+ this.directed = new WeakSet();
208
+ /** The lists this element gave the list role. */
209
+ this.listed = new WeakSet();
210
+ this.presses = new WeakMap();
211
+ this.pressControllers = new Set();
212
+ this.heldPress = null;
213
+ this.heldAnchor = null;
214
+ /** What the rule last gave: a `current` that differs from it was set by the product (TOC-15). */
215
+ this.given = '';
216
+ /** TOC-12, TOC-13: the item that is kept current — chosen, or named by the address — until the person next scrolls. */
217
+ this.held = null;
218
+ /** Whether the move to the held item's target is over: from then on the person's own scrolling ends the hold. */
219
+ this.arrived = false;
220
+ this.frame = 0;
221
+ /** What is listened to and observed while the rule runs: the view that scrolls the targets (null: the window's). */
222
+ this.watching = null;
223
+ /** Each target's `scroll-margin-block-start`, until something is resized or the items change. */
224
+ this.margins = new WeakMap();
225
+ /** TOC-27: the list is being shown, and its current row is kept in its visible part until its height has settled. */
226
+ this.opening = null;
227
+ /** TOC-30: where focus was when the presentation changed. */
228
+ this.focusWasInList = false;
229
+ this.drawAtOnce = false;
230
+ this.onParsed = () => {
231
+ if (!this.isConnected)
232
+ return;
233
+ this.readItems();
234
+ this.addressed();
235
+ this.decide();
236
+ this.requestUpdate();
237
+ };
238
+ /** The view has stopped: from here the person's own scrolling ends the hold. */
239
+ this.still = () => {
240
+ if (this.held === null || this.arrived)
241
+ return;
242
+ this.arrived = true;
243
+ for (const type of ['wheel', 'touchmove', 'keydown', 'pointerdown', 'mousedown'])
244
+ window.addEventListener(type, this.onOwnScrolling, { capture: true, passive: true });
245
+ };
246
+ /** A wheel, a drag, a scrolling key or a press on the scroll bar: the person moves the view by their own hand (TOC-12). */
247
+ this.onOwnScrolling = (event) => {
248
+ if (event instanceof KeyboardEvent) {
249
+ const on = event.target instanceof Element ? event.target : null;
250
+ // Space on a control is that control's; a key in a field is the field's.
251
+ if (!SCROLL_KEYS.includes(event.key) || event.altKey || event.ctrlKey || event.metaKey)
252
+ return;
253
+ if (on?.closest('input, textarea, select, [contenteditable]:not([contenteditable="false"])') || (event.key === ' ' && on?.closest('button, summary, [role="button"]')))
254
+ return;
255
+ }
256
+ else if (event.type === 'pointerdown' || event.type === 'mousedown') {
257
+ // A press that is on the scroll bar: on the view itself, outside the box its content is laid out in.
258
+ const pointer = event;
259
+ const view = this.watching?.view ?? null;
260
+ if (view) {
261
+ const box = view.getBoundingClientRect();
262
+ const inside = pointer.clientX - box.left - view.clientLeft < view.clientWidth && pointer.clientY - box.top - view.clientTop < view.clientHeight;
263
+ if (event.target !== view || inside)
264
+ return;
265
+ }
266
+ else if (pointer.clientX < document.documentElement.clientWidth && pointer.clientY < document.documentElement.clientHeight)
267
+ return;
268
+ }
269
+ else if (event.composedPath().includes(this)) {
270
+ // A wheel or a drag over the list moves the list's own region, not the view that holds the targets.
271
+ return;
272
+ }
273
+ this.release();
274
+ };
275
+ this.onScroll = () => {
276
+ if (this.held !== null) {
277
+ // The view is still on its way to the target: the items it passes are not marked.
278
+ if (!this.arrived)
279
+ this.stillSoon();
280
+ return;
281
+ }
282
+ this.schedule();
283
+ };
284
+ /** TOC-16: the place of a target may have changed without the person scrolling. */
285
+ this.onMoved = () => {
286
+ this.margins = new WeakMap();
287
+ this.schedule();
288
+ };
289
+ this.onAddress = () => {
290
+ if (this.addressed())
291
+ this.decide();
292
+ };
293
+ this.onRowClick = () => this.setOpen(!this.open);
294
+ // TOC-22: where the browser has no style queries, the focus style is read when focus arrives.
295
+ this.onRowFocus = () => {
296
+ if (!styleQueries())
297
+ syncFocusStyle(this, this.row);
298
+ };
299
+ this.onKeyDown = (event) => {
300
+ // TOC-29: Escape hides the shown list, and focus that was inside it goes to the row.
301
+ if (event.key !== 'Escape' || !this.compact || !this.open || event.defaultPrevented)
302
+ return;
303
+ const active = this.getRootNode().activeElement;
304
+ const inList = !!active && active !== this && this.contains(active);
305
+ event.preventDefault();
306
+ this.setOpen(false);
307
+ if (inList)
308
+ this.row?.focus();
309
+ };
310
+ /**
311
+ * TOC-12, TOC-28: an item was activated. `select` is dispatched from the anchor's own click, before the browser
312
+ * follows the link, and cancels the click with it; the item is current at once and held; the compact list is hidden
313
+ * once the browser has taken the navigation — which is what leaves the next Tab at the chosen section. A click that
314
+ * opens the link elsewhere (a modifier, another button) is the browser's alone.
315
+ */
316
+ this.onClick = (event) => {
317
+ const item = this.itemOf(event);
318
+ if (!item || event.defaultPrevented || event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
319
+ return;
320
+ const select = new CustomEvent('select', { bubbles: true, cancelable: true, detail: { href: item.href } });
321
+ if (!this.dispatchEvent(select))
322
+ event.preventDefault();
323
+ if (this.auto) {
324
+ this.hold(item.href);
325
+ this.give(item.href);
326
+ }
327
+ if (this.compact && this.open) {
328
+ clearTimeout(this.closeTimer);
329
+ this.closeTimer = setTimeout(() => {
330
+ if (this.isConnected && this.compact)
331
+ this.setOpen(false);
332
+ });
333
+ }
334
+ };
335
+ this.releasePress = () => {
336
+ this.heldPress?.release();
337
+ this.heldPress = null;
338
+ this.heldAnchor = null;
339
+ };
340
+ this.onPointerDown = (event) => {
341
+ const item = this.itemOf(event);
342
+ const pointer = event;
343
+ if (!item || (pointer.button !== 0 && pointer.pointerType === 'mouse'))
344
+ return;
345
+ this.answered(item.a);
346
+ this.heldPress = this.pressOf(item.a);
347
+ this.heldAnchor = item.a;
348
+ this.heldPress.onPointerDown(pointer);
349
+ };
350
+ // `pointerleave` is not seen from here: the press ends when the pointer goes out of the row it holds.
351
+ this.onPointerOut = (event) => {
352
+ const to = event.relatedTarget;
353
+ if (this.heldAnchor && !(to instanceof Node && this.heldAnchor.contains(to)))
354
+ this.releasePress();
355
+ };
356
+ this.onRowKeyDown = (event) => {
357
+ const item = this.itemOf(event);
358
+ const key = event;
359
+ if (!item || key.repeat || key.key !== 'Enter')
360
+ return;
361
+ this.answered(item.a);
362
+ this.pressOf(item.a).onKeyDown(key);
363
+ };
364
+ this.onRowKeyUp = (event) => {
365
+ const item = this.itemOf(event);
366
+ if (item)
367
+ this.presses.get(item.a)?.onKeyUp(event);
368
+ };
369
+ this.onFocusIn = (event) => {
370
+ const item = this.itemOf(event);
371
+ if (item && !styleQueries())
372
+ syncFocusStyle(item.a, item.a);
373
+ };
374
+ this.onFocusOut = (event) => {
375
+ const item = this.itemOf(event);
376
+ if (item)
377
+ this.presses.get(item.a)?.onBlur();
378
+ };
379
+ this.pressListeners = [
380
+ ['pointerdown', this.onPointerDown],
381
+ ['pointerup', this.releasePress],
382
+ ['pointercancel', this.releasePress],
383
+ ['pointerout', this.onPointerOut],
384
+ ['dragstart', this.releasePress],
385
+ ['keydown', this.onRowKeyDown],
386
+ ['keyup', this.onRowKeyUp],
387
+ ['focusin', this.onFocusIn],
388
+ ['focusout', this.onFocusOut],
389
+ ];
390
+ }
391
+ static { this.styles = styles; }
392
+ static { this.properties = {
393
+ label: { type: String },
394
+ labelHidden: { type: Boolean, attribute: 'label-hidden', reflect: true },
395
+ // The defaults are not reflected: a table of contents that is defined is the one that was written.
396
+ presentation: { type: String, reflect: true, useDefault: true },
397
+ density: { type: String, reflect: true, useDefault: true },
398
+ open: { type: Boolean, reflect: true },
399
+ current: { type: String },
400
+ tracking: { type: String, reflect: true, useDefault: true },
401
+ }; }
402
+ get row() {
403
+ return this.renderRoot?.querySelector('.row') ?? null;
404
+ }
405
+ get compact() {
406
+ return this.presentation === 'compact';
407
+ }
408
+ /** TOC-39: a tracking it does not have is auto. */
409
+ get auto() {
410
+ return this.tracking !== 'manual';
411
+ }
412
+ connectedCallback() {
413
+ super.connectedCallback();
414
+ adoptUnlessDrawn(this, sheet('table-of-contents', () => LIST_CSS), '--_toc-row-height');
415
+ this.addEventListener('click', this.onClick);
416
+ this.addEventListener('keydown', this.onKeyDown);
417
+ for (const [type, listener] of this.pressListeners)
418
+ this.addEventListener(type, listener, true);
419
+ this.mutations?.observe(this, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ['href'] });
420
+ this.itemsStale = true;
421
+ if (this.hasUpdated)
422
+ this.requestUpdate();
423
+ }
424
+ disconnectedCallback() {
425
+ super.disconnectedCallback();
426
+ this.removeEventListener('click', this.onClick);
427
+ this.removeEventListener('keydown', this.onKeyDown);
428
+ for (const [type, listener] of this.pressListeners)
429
+ this.removeEventListener(type, listener, true);
430
+ this.mutations?.disconnect();
431
+ this.unwatch();
432
+ this.release({ decide: false });
433
+ clearTimeout(this.closeTimer);
434
+ cancelAnimationFrame(this.frame);
435
+ this.frame = 0;
436
+ this.opening?.disconnect();
437
+ this.opening = null;
438
+ for (const press of this.pressControllers)
439
+ press.hostDisconnected();
440
+ this.heldPress = null;
441
+ this.heldAnchor = null;
442
+ }
443
+ // ── The items ─────────────────────────────────────────────────────────────────────────────────────────────────────
444
+ /** What the observer saw. The ripple's layer is this package's own: its coming and going is not a change of the items. */
445
+ mutated(records) {
446
+ const ripple = (node) => node instanceof Element && node.classList.contains('ripple');
447
+ if (records.every((record) => record.type === 'childList' && [...record.addedNodes, ...record.removedNodes].every(ripple)))
448
+ return;
449
+ this.itemsStale = true;
450
+ this.margins = new WeakMap();
451
+ this.requestUpdate();
452
+ }
453
+ /**
454
+ * Reads the product's list: every `<li>` of this element whose first anchor is its label. Writes what the stylesheet
455
+ * needs of them (the label's text, an item without one) and the list role on a list that has none; only what
456
+ * differs, so it settles.
457
+ */
458
+ readItems() {
459
+ this.itemsStale = false;
460
+ const items = [];
461
+ const empty = [];
462
+ for (const a of this.querySelectorAll('li > a')) {
463
+ const li = a.parentElement;
464
+ if (a.closest(TAG) !== this || li.querySelector(':scope > a') !== a)
465
+ continue;
466
+ // TOC-40: an item without a label is not drawn, and neither are its items.
467
+ if (empty.some((outer) => outer.contains(li)))
468
+ continue;
469
+ const label = (a.textContent ?? '').replace(/\s+/g, ' ').trim();
470
+ mark(li, EMPTY, label ? null : '');
471
+ mark(li, LABEL, label || null);
472
+ // TOC-37: a label is text of its own direction. With a letter in it the anchor takes that direction as its own
473
+ // (`dir="auto"`, unless the product named one), so that every engine lays its lines out alike; without one it
474
+ // has no direction of its own, and is laid out in the layout's.
475
+ const strong = STRONG.test(label);
476
+ mark(li, NEUTRAL, label && !strong ? '' : null);
477
+ if (strong && !a.hasAttribute('dir')) {
478
+ a.setAttribute('dir', 'auto');
479
+ this.directed.add(a);
480
+ }
481
+ else if (!strong && this.directed.has(a)) {
482
+ this.directed.delete(a);
483
+ a.removeAttribute('dir');
484
+ }
485
+ if (!label) {
486
+ empty.push(li);
487
+ report(this, 'TOC-40', `the item for "${a.getAttribute('href') ?? ''}" has no label; it is not drawn, and neither are its items`);
488
+ continue;
489
+ }
490
+ let depth = 1;
491
+ for (let outer = li.parentElement?.closest('li'); outer && this.contains(outer); outer = outer.parentElement?.closest('li'))
492
+ depth++;
493
+ items.push({ li, a, href: a.getAttribute('href') ?? '', label, depth });
494
+ }
495
+ // TOC-31: a list without markers is still a list to every engine's assistive technology.
496
+ for (const list of this.querySelectorAll('ul, ol')) {
497
+ if (list.closest(TAG) !== this || list.hasAttribute('role'))
498
+ continue;
499
+ list.setAttribute('role', 'list');
500
+ this.listed.add(list);
501
+ }
502
+ this.items = items;
503
+ // TOC-39: of two items with one href, the first is the one that can be current.
504
+ const seen = new Set();
505
+ this.trackable = items.filter((item) => !seen.has(item.href) && !!seen.add(item.href));
506
+ if (debugBuild())
507
+ this.check();
508
+ }
509
+ /** What a debug build says about a table of contents it still draws (TOC-39, TOC-40). */
510
+ check() {
511
+ // A list that is still being parsed is read again when it is whole.
512
+ if (document.readyState === 'loading')
513
+ return;
514
+ if (this.items.length && !this.label.trim())
515
+ report(this, 'TOC-40', 'label is empty: the navigation landmark and the compact row have no name; give it the words ("On this page")');
516
+ const seen = new Set();
517
+ for (const item of this.items) {
518
+ if (seen.has(item.href))
519
+ report(this, 'TOC-39', `two items have the href "${item.href}"; both are drawn, and the first is the one that can be current`);
520
+ seen.add(item.href);
521
+ }
522
+ const depth = Math.max(0, ...this.items.map((item) => item.depth));
523
+ if (depth > MAX_DEPTH)
524
+ report(this, 'TOC-39', `the items are nested ${depth} levels deep; more than ${MAX_DEPTH} is hard to follow in a narrow column`);
525
+ }
526
+ /** The item that is drawn as current: `current`'s, or — while the product decides and names none — the anchor it marked itself. */
527
+ currentItem() {
528
+ if (this.current)
529
+ return this.trackable.find((item) => item.href === this.current) ?? null;
530
+ if (this.auto)
531
+ return null;
532
+ return this.items.find((item) => !this.wrote.has(item.a) && item.a.hasAttribute('aria-current') && item.a.getAttribute('aria-current') !== 'false') ?? null;
533
+ }
534
+ itemOf(event) {
535
+ const path = event.composedPath();
536
+ return this.items.find((item) => path.includes(item.a)) ?? null;
537
+ }
538
+ // ── The rule (TOC-9 to TOC-16) ────────────────────────────────────────────────────────────────────────────────────
539
+ /** The view that scrolls the targets: the nearest ancestor of the first target that scrolls, else the window's (null). */
540
+ findView() {
541
+ for (const item of this.trackable) {
542
+ const target = targetOf(fragmentOf(item.a));
543
+ if (!(target instanceof Element))
544
+ continue;
545
+ for (let outer = target.parentElement; outer && !isPage(outer); outer = outer.parentElement)
546
+ if (scrolls(outer))
547
+ return outer;
548
+ return null;
549
+ }
550
+ return null;
551
+ }
552
+ /**
553
+ * TOC-9 to TOC-11: the last item, in the page's order, whose target has reached the line; the item for the top of
554
+ * the page has always reached it; at the end of a view that has room to scroll, the last item. The line is where the
555
+ * browser rests a target: the view's start edge, its scroll padding, and the target's own scroll margin.
556
+ */
557
+ byRule() {
558
+ const view = this.watching?.view ?? this.findView();
559
+ const page = document.scrollingElement ?? document.documentElement;
560
+ const scroller = view ?? page;
561
+ const styled = getComputedStyle(view ?? document.documentElement);
562
+ const edge = view ? view.getBoundingClientRect().top + view.clientTop : 0;
563
+ const line = edge + pixels(styled.scrollPaddingTop, scroller.clientHeight);
564
+ const room = scroller.scrollHeight - scroller.clientHeight;
565
+ const atEnd = room > UNIT && scroller.scrollTop >= room - UNIT;
566
+ const loaded = document.readyState === 'complete';
567
+ for (let index = this.trackable.length - 1; index >= 0; index--) {
568
+ const item = this.trackable[index];
569
+ const target = targetOf(fragmentOf(item.a));
570
+ if (!target) {
571
+ // TOC-16: an item whose href leads to no place is still a link, and is never current by the rule.
572
+ if (loaded)
573
+ report(this, 'TOC-16', `the href "${item.href}" leads to no place on this page; the item is still a link, and is never current`);
574
+ continue;
575
+ }
576
+ if (target === 'top')
577
+ return item.href;
578
+ // A target that is not drawn — in a fold that is closed, a tab that is not shown — is at no place: never reached.
579
+ const box = target.getBoundingClientRect();
580
+ if (!box.width && !box.height && !target.getClientRects().length)
581
+ continue;
582
+ // TOC-11: a last section shorter than the view can never reach the line.
583
+ if (atEnd)
584
+ return item.href;
585
+ let margin = this.margins.get(target);
586
+ if (margin === undefined) {
587
+ margin = pixels(getComputedStyle(target).scrollMarginTop, 0);
588
+ this.margins.set(target, margin);
589
+ }
590
+ if (box.top - (line + margin) < UNIT)
591
+ return item.href;
592
+ }
593
+ return '';
594
+ }
595
+ /** Decides the current item again (TOC-16), keeping an item that is held (TOC-12, TOC-13). */
596
+ decide() {
597
+ if (!this.isConnected || !this.auto)
598
+ return;
599
+ if (this.held !== null) {
600
+ if (this.items.some((item) => item.href === this.held)) {
601
+ this.give(this.held);
602
+ return;
603
+ }
604
+ this.release({ decide: false });
605
+ }
606
+ // TOC-13: while the page is still arriving and its address names a place, no other item is shown first.
607
+ if (document.readyState === 'loading' && location.hash.length > 1) {
608
+ document.addEventListener('DOMContentLoaded', this.onParsed, { once: true });
609
+ return;
610
+ }
611
+ this.give(this.byRule());
612
+ }
613
+ /** The elements whose rule is read in this turn (`decideTogether`). */
614
+ static { this.deciding = new Set(); }
615
+ /** Whether deciding now reads the page: not while an item is held, nor while the page is still arriving at an address (`decide`). */
616
+ get reads() {
617
+ return this.isConnected && this.auto && this.held === null && !(document.readyState === 'loading' && location.hash.length > 1);
618
+ }
619
+ /**
620
+ * `decide()` as an update asks for it — the first drawing, `tracking`, the items. A decision that reads nothing
621
+ * (an item is held: TOC-13's, in the first drawing) is made at once. One that reads where the targets are is made
622
+ * in ONE microtask after the updates of the turn, for every element that asked: the rule is read for them all —
623
+ * one layout — and only then is each given its item, which it draws in an update of its own, still in the task
624
+ * that drew it and before any frame. Read in its own update, between the writes of the one before it and its own,
625
+ * each element had the page styled and laid out for itself (fifty at once: 51 style passes and 51 layouts).
626
+ */
627
+ decideTogether() {
628
+ if (!this.reads) {
629
+ this.decide();
630
+ return;
631
+ }
632
+ const due = TanreiTableOfContents.deciding;
633
+ if (!due.size) {
634
+ queueMicrotask(() => {
635
+ const all = [...due];
636
+ due.clear();
637
+ const ruled = all.map((each) => (each.reads ? each.byRule() : null));
638
+ all.forEach((each, index) => {
639
+ const href = ruled[index];
640
+ // What changed in between (an item held, the element gone) decides as it always does.
641
+ if (href !== null && each.reads)
642
+ each.give(href);
643
+ else
644
+ each.decide();
645
+ });
646
+ });
647
+ }
648
+ due.add(this);
649
+ }
650
+ /** The rule's answer becomes `current`, and the product is told — once per change (TOC-9). */
651
+ give(href) {
652
+ this.given = href;
653
+ if (this.current === href)
654
+ return;
655
+ this.current = href;
656
+ this.dispatchEvent(new CustomEvent('currentchange', { bubbles: true, detail: { href } }));
657
+ }
658
+ /** One decision in the next frame, however many events asked for it. Nothing is asked for at rest. */
659
+ schedule() {
660
+ if (this.frame || !this.isConnected)
661
+ return;
662
+ this.frame = requestAnimationFrame(() => {
663
+ this.frame = 0;
664
+ this.watch();
665
+ this.decide();
666
+ });
667
+ }
668
+ /** TOC-13: the address names the target of one of the items — that item is held as a chosen one is. */
669
+ addressed() {
670
+ if (!this.auto || location.hash.length <= 1)
671
+ return false;
672
+ const fragment = decoded(location.hash.slice(1));
673
+ const item = this.trackable.find((candidate) => fragmentOf(candidate.a) === fragment && targetOf(fragment) !== null);
674
+ if (!item)
675
+ return false;
676
+ this.hold(item.href);
677
+ return true;
678
+ }
679
+ /** TOC-12: `href` stays current while the view moves to its target and after, until the person next scrolls. */
680
+ hold(href) {
681
+ this.unlistenForScrolling();
682
+ this.held = href;
683
+ this.arrived = false;
684
+ this.stillSoon();
685
+ }
686
+ stillSoon() {
687
+ clearTimeout(this.stillTimer);
688
+ this.stillTimer = setTimeout(this.still, STILL_MS);
689
+ }
690
+ unlistenForScrolling() {
691
+ clearTimeout(this.stillTimer);
692
+ for (const type of ['wheel', 'touchmove', 'keydown', 'pointerdown', 'mousedown'])
693
+ window.removeEventListener(type, this.onOwnScrolling, { capture: true });
694
+ }
695
+ release({ decide = true } = {}) {
696
+ this.unlistenForScrolling();
697
+ this.held = null;
698
+ this.arrived = false;
699
+ if (decide)
700
+ this.schedule();
701
+ }
702
+ /** Listens to the view that scrolls the targets, and to what may move them, while the rule runs. */
703
+ watch() {
704
+ if (!this.isConnected || !this.auto || !this.trackable.length) {
705
+ this.unwatch();
706
+ return;
707
+ }
708
+ const view = this.findView();
709
+ if (this.watching && this.watching.view === view)
710
+ return;
711
+ this.unwatch();
712
+ const source = view ?? document;
713
+ source.addEventListener('scroll', this.onScroll, { passive: true });
714
+ window.addEventListener('resize', this.onMoved, { passive: true });
715
+ window.addEventListener('hashchange', this.onAddress);
716
+ window.addEventListener('popstate', this.onAddress);
717
+ const sizes = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(this.onMoved);
718
+ if (sizes) {
719
+ // What the view scrolls, and the boxes the targets stand in: content that loads or folds changes their size.
720
+ const boxes = new Set(view ? [view, ...view.children] : [document.documentElement, ...(document.body ? [document.body] : [])]);
721
+ for (const item of this.trackable) {
722
+ const target = targetOf(fragmentOf(item.a));
723
+ if (target instanceof Element && target.parentElement)
724
+ boxes.add(target.parentElement);
725
+ }
726
+ for (const box of boxes)
727
+ sizes.observe(box);
728
+ }
729
+ this.watching = { view, source, sizes };
730
+ }
731
+ unwatch() {
732
+ if (!this.watching)
733
+ return;
734
+ this.watching.source.removeEventListener('scroll', this.onScroll);
735
+ window.removeEventListener('resize', this.onMoved);
736
+ window.removeEventListener('hashchange', this.onAddress);
737
+ window.removeEventListener('popstate', this.onAddress);
738
+ this.watching.sizes?.disconnect();
739
+ this.watching = null;
740
+ }
741
+ // ── The current row kept in view (TOC-17, TOC-27) ─────────────────────────────────────────────────────────────────
742
+ /** The scrolling region that holds the list: the element's own in the compact presentation, else the layout's — never the view that holds the targets, never the page. */
743
+ listRegion() {
744
+ const own = this.compact ? (this.renderRoot?.querySelector('.scroller') ?? null) : null;
745
+ if (own && scrolls(own))
746
+ return own;
747
+ const view = this.watching?.view ?? null;
748
+ for (let outer = flatParent(this); outer; outer = flatParent(outer)) {
749
+ if (isPage(outer) || outer === view)
750
+ return null;
751
+ if (scrolls(outer))
752
+ return view && outer.contains(view) ? null : outer;
753
+ }
754
+ return null;
755
+ }
756
+ /** Scrolls the list's region, and no other, by the least distance that shows `row` whole. */
757
+ showRow(row, { atOnce = false } = {}) {
758
+ const region = this.listRegion();
759
+ if (!region)
760
+ return;
761
+ const [box, around] = [row.getBoundingClientRect(), region.getBoundingClientRect()];
762
+ const top = around.top + region.clientTop;
763
+ const bottom = top + region.clientHeight;
764
+ // A row taller than the region is shown from its start.
765
+ const by = box.top < top || box.height > region.clientHeight ? box.top - top : box.bottom > bottom ? box.bottom - bottom : 0;
766
+ if (Math.abs(by) < SLACK)
767
+ return;
768
+ region.scrollTo({ top: region.scrollTop + by, behavior: atOnce || reducedMotion() ? 'instant' : 'smooth' });
769
+ }
770
+ /** TOC-27: the list is shown — its current row is brought into its visible part without a motion, and kept there while the list's height moves. */
771
+ revealOnOpen() {
772
+ this.opening?.disconnect();
773
+ this.opening = null;
774
+ const clip = this.renderRoot?.querySelector('.clip');
775
+ const reveal = () => {
776
+ const item = this.currentItem();
777
+ if (item)
778
+ this.showRow(item.a, { atOnce: true });
779
+ };
780
+ reveal();
781
+ if (!clip || typeof ResizeObserver === 'undefined')
782
+ return;
783
+ // Heard only while the height moves: once no motion of the list runs, the observer is gone.
784
+ const observer = new ResizeObserver(() => {
785
+ reveal();
786
+ if (!clip.getAnimations().length) {
787
+ observer.disconnect();
788
+ if (this.opening === observer)
789
+ this.opening = null;
790
+ }
791
+ });
792
+ this.opening = observer;
793
+ observer.observe(clip);
794
+ }
795
+ // ── The compact presentation (TOC-26, TOC-28, TOC-29) ─────────────────────────────────────────────────────────────
796
+ /** The user shows or hides the list: `open` changes, and `toggle` says so once, as the change begins. */
797
+ setOpen(open) {
798
+ if (this.open === open)
799
+ return;
800
+ this.open = open;
801
+ this.dispatchEvent(new CustomEvent('toggle', { bubbles: true, detail: { open } }));
802
+ }
803
+ // ── A row's press and focus (TOC-20 to TOC-22): the shared primitives, on the product's anchors ───────────────────
804
+ pressOf(a) {
805
+ let press = this.presses.get(a);
806
+ if (!press) {
807
+ press = new PressController(a, {
808
+ container: () => a,
809
+ // The anchor's first transition is the hold (table-of-contents.css), so its delay is press-hold as a time.
810
+ holdCarrier: () => a,
811
+ disabled: () => false,
812
+ // TOC-20: Enter presses a link; Space does what it does on any link and shows no pressed state.
813
+ keys: LINK_KEYS,
814
+ });
815
+ this.presses.set(a, press);
816
+ this.pressControllers.add(press);
817
+ }
818
+ return press;
819
+ }
820
+ /** The press is this script's from here: the stylesheet's own answer to `:active` stands down for an anchor that carries `data-pressed`. */
821
+ answered(a) {
822
+ if (!a.hasAttribute('data-pressed'))
823
+ a.dataset.pressed = 'none';
824
+ }
825
+ // ── Drawing ───────────────────────────────────────────────────────────────────────────────────────────────────────
826
+ willUpdate(changed) {
827
+ const first = !this.hasUpdated;
828
+ const itemsChanged = this.itemsStale;
829
+ if (itemsChanged)
830
+ this.readItems();
831
+ // TOC-15: a `current` the rule did not give was set by the product — it is drawn until the rule next gives another.
832
+ if (changed.has('current') && this.current !== this.given && !first)
833
+ this.release({ decide: false });
834
+ // TOC-30: a change of presentation keeps the current item, is drawn at once, and closes the list without `toggle`.
835
+ if (changed.has('presentation') && !first) {
836
+ const active = this.getRootNode().activeElement;
837
+ this.focusWasInList = !!active && active !== this && this.contains(active);
838
+ this.drawAtOnce = true;
839
+ this.open = false;
840
+ clearTimeout(this.closeTimer);
841
+ }
842
+ if (!this.auto) {
843
+ if (changed.has('tracking'))
844
+ this.release({ decide: false });
845
+ }
846
+ else if (first || changed.has('tracking')) {
847
+ // TOC-13: an item the address names is current in the first drawing, and no other is shown first.
848
+ this.addressed();
849
+ this.decideTogether();
850
+ }
851
+ else if (itemsChanged) {
852
+ // TOC-16: an item was added or removed.
853
+ this.decideTogether();
854
+ }
855
+ }
856
+ updated(changed) {
857
+ const item = this.currentItem();
858
+ // TOC-7, TOC-8: the current item carries the current-location state, and no other does.
859
+ for (const other of this.items) {
860
+ if (other === item && this.current) {
861
+ if (other.a.getAttribute('aria-current') !== 'location') {
862
+ other.a.setAttribute('aria-current', 'location');
863
+ this.wrote.add(other.a);
864
+ }
865
+ }
866
+ else if (other.a.hasAttribute('aria-current') && (this.auto || this.current || this.wrote.has(other.a))) {
867
+ other.a.removeAttribute('aria-current');
868
+ this.wrote.delete(other.a);
869
+ }
870
+ }
871
+ // TOC-32: no items — nothing is drawn and nothing is exposed.
872
+ mark(this, 'data-empty', this.items.length ? null : '');
873
+ if (changed.has('density'))
874
+ this.readDensity();
875
+ if (changed.has('presentation') && !PRESENTATIONS.includes(this.presentation)) {
876
+ report(this, 'TOC-39', `presentation "${this.presentation}" is not a value it defines ("list" or "compact"); it is drawn as "list"`);
877
+ }
878
+ if (changed.has('tracking') && !TRACKINGS.includes(this.tracking)) {
879
+ report(this, 'TOC-39', `tracking "${this.tracking}" is not a value it defines ("auto" or "manual"); it behaves as "auto"`);
880
+ }
881
+ if (!this.auto && this.current && !item && document.readyState !== 'loading') {
882
+ report(this, 'TOC-39', `current "${this.current}" is no item's href; no item is drawn as current`);
883
+ }
884
+ if (this.drawAtOnce) {
885
+ // TOC-30: the new presentation at once — its styles are computed once with their transitions off — and focus
886
+ // that was on an item which is no longer shown goes to the row.
887
+ this.drawAtOnce = false;
888
+ const nav = this.renderRoot.querySelector('nav');
889
+ if (nav) {
890
+ nav.setAttribute('data-at-once', '');
891
+ void getComputedStyle(this.renderRoot.querySelector('.clip') ?? nav).visibility;
892
+ nav.removeAttribute('data-at-once');
893
+ }
894
+ if (this.focusWasInList && this.compact)
895
+ this.row?.focus();
896
+ this.focusWasInList = false;
897
+ }
898
+ if (this.compact && this.open && (changed.has('open') || changed.has('presentation')))
899
+ this.revealOnOpen();
900
+ else if (changed.has('current') && item && !(this.compact && !this.open)) {
901
+ // TOC-17: the new current row is shown whole in a scrolling region that holds the list — but a row is never
902
+ // moved from under a hand: not while the pointer is over the list, nor while keyboard focus is inside it.
903
+ if (!this.matches(':hover') && !this.matches(':focus-within'))
904
+ this.showRow(item.a);
905
+ }
906
+ this.watch();
907
+ }
908
+ /** TOC-39: a density the core does not have was added by a design system — its rules are added to the root — or is unknown to the active one, which a debug build says. */
909
+ readDensity() {
910
+ const density = String(this.density ?? '');
911
+ if (CORE_DENSITIES.includes(density))
912
+ return;
913
+ const known = KEY.test(density);
914
+ if (known)
915
+ adopt(this.getRootNode(), sheet(`table-of-contents:density:${density}`, () => densityRules(density)));
916
+ if (!known || getComputedStyle(this).getPropertyValue(`${PREFIX}-row-height-${density}`).trim() === '') {
917
+ report(this, 'TOC-39', `density "${density}" is not a value of the active design system; it is drawn as "${DEFAULT_DENSITY}"`);
918
+ }
919
+ }
920
+ render() {
921
+ const compact = this.compact;
922
+ const open = compact && this.open;
923
+ const label = this.label ?? '';
924
+ const name = this.currentItem()?.label ?? '';
925
+ const titled = !!label.trim() || !!this.querySelector(':scope > [slot="title"]');
926
+ return html `
927
+ <nav part="nav" class=${classMap({ compact, open })} aria-label=${label.trim() ? label : nothing} ?data-tanrei-shape=${compact}>
928
+ ${compact
929
+ ? html `<button
930
+ part="disclosure-row"
931
+ class="row"
932
+ type="button"
933
+ data-tanrei-shape
934
+ aria-expanded=${open ? 'true' : 'false'}
935
+ aria-controls="list"
936
+ aria-describedby=${label.trim() && name ? 'current' : nothing}
937
+ @click=${this.onRowClick}
938
+ @pointerdown=${this.rowPress.onPointerDown}
939
+ @pointerup=${this.rowPress.release}
940
+ @pointercancel=${this.rowPress.release}
941
+ @pointerleave=${this.rowPress.release}
942
+ @keydown=${this.rowPress.onKeyDown}
943
+ @keyup=${this.rowPress.onKeyUp}
944
+ @blur=${this.rowPress.onBlur}
945
+ @focus=${this.onRowFocus}
946
+ >
947
+ ${label.trim() ? html `<span class="row-title">${label}</span>` : nothing}
948
+ <span id="current" class="row-current" aria-hidden=${label.trim() ? 'true' : nothing} dir=${ownDirection(name)}>${name}</span>
949
+ <span part="icon" class="chevron" aria-hidden="true"><span class="ink">expand_more</span></span>
950
+ </button>`
951
+ : this.labelHidden || !titled
952
+ ? nothing
953
+ : html `<div part="title" class="title"><slot name="title"><span aria-hidden="true">${label}</span></slot></div>`}
954
+ <div part="list" id="list" class="scroller" ?inert=${compact && !open}>
955
+ <div class="clip"><div class="inner"><slot></slot></div></div>
956
+ </div>
957
+ </nav>
958
+ `;
959
+ }
960
+ }
961
+ if (!customElements.get('tanrei-table-of-contents'))
962
+ customElements.define('tanrei-table-of-contents', TanreiTableOfContents);
963
+ //# sourceMappingURL=table-of-contents.js.map