@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,1801 @@
1
+ import { LitElement, html, nothing } from 'lit';
2
+ import { ifDefined } from 'lit/directives/if-defined.js';
3
+ import { html as staticHtml, literal } from 'lit/static-html.js';
4
+ import { AvailabilityController, FollowController, GlyphDrawnController, KeptLengths, GlyphMirrorController, LinkController, NativeTextController, PressController, SHORTCUT_UPDATE, SystemWatchController, ambientConvention, assignSlot, chordsConverter, chordsOf, deepActive, focusWithin, holdPageScroll, hostAria, linkAttributes, markGlyph, modalLayer, naturalHeight, notifyItemUpdate, platformConvention, report, syncFocusStyle, trapFocus, WordsController, } from '../../primitives/index.js';
5
+ import '../button/button.js';
6
+ // SRC-37: the shortcut hint is drawn by the keyboard shortcut; SRC-47: the status row's indicator is the loading indicator.
7
+ import '../keyboard-shortcut/keyboard-shortcut.js';
8
+ import '../loading-indicator/loading-indicator.js';
9
+ import { placeMenu } from '../menu/menu.js';
10
+ import { pressDefaultButton } from '../../primitives/default-button.js';
11
+ import { takeFormDisabled } from '../../primitives/form-disabled.js';
12
+ import { groupStyles, rowStyles, styles, suggestionStyles } from './search.styles.js';
13
+ import { ownDirection } from '../../styles/product-text.js';
14
+ import { disabledWaitsWhileFocused } from '../../primitives/disabled-while-focused.js';
15
+ import { focusedAtFirst } from '../../primitives/autofocus.js';
16
+ /**
17
+ * The glyphs of the system's icon set the search draws — the spec's names, not values; it draws no mark of
18
+ * its own: the leading magnifier (SRC-2, not mirrored), the clear button's close (SRC-10, not mirrored) and the back
19
+ * button's arrow (SRC-11, mirrored in right-to-left by the styles).
20
+ */
21
+ const SEARCH_GLYPH = 'search';
22
+ const CLOSE_GLYPH = 'close';
23
+ const BACK_GLYPH = 'arrow_back';
24
+ const PRESENTATIONS = ['docked', 'dialog', 'full-screen'];
25
+ const BARS = ['field', 'button', 'icon'];
26
+ const STATUSES = ['idle', 'loading', 'error'];
27
+ /**
28
+ * A suggestion the search offers while the person types — the spec's item kind `suggestion`: a query they searched
29
+ * before, or a completion. Choosing it fires `select` and the product sets the value; a thing the product opens is a
30
+ * `<tanrei-search-result>`. It is data, as an `<option>` in a `<datalist>`: the search draws the row, names it and
31
+ * answers it; the element itself draws nothing.
32
+ *
33
+ * @tag tanrei-search-suggestion
34
+ */
35
+ export class TanreiSearchSuggestion extends LitElement {
36
+ constructor() {
37
+ super(...arguments);
38
+ /** Identifies the suggestion; `select` carries it. Unique among the suggestions. */
39
+ this.value = '';
40
+ /** The suggestion's text, and its accessible name. */
41
+ this.headline = '';
42
+ /** A second line under the headline ("Folder · 24 messages"), and its description (`supporting-text`). */
43
+ this.supportingText = '';
44
+ /** The name of a glyph of the system's icon set at the row's start (history, folder); empty draws none (`leading-icon`). A glyph the icon set flags as showing a direction (`arrow_forward`, `send`) is drawn mirrored in a right-to-left layout. */
45
+ this.leadingIcon = '';
46
+ }
47
+ static { this.styles = suggestionStyles; }
48
+ static { this.properties = {
49
+ value: { type: String },
50
+ headline: { type: String },
51
+ supportingText: { type: String, attribute: 'supporting-text' },
52
+ leadingIcon: { type: String, attribute: 'leading-icon' },
53
+ }; }
54
+ updated() {
55
+ // The search re-reads its suggestions whenever one changes; an internal event, kept out of the suggestion's public API.
56
+ notifyItemUpdate(this, 'tanrei-search-suggestion-update');
57
+ }
58
+ render() {
59
+ return nothing;
60
+ }
61
+ }
62
+ const SUGGESTION = 'tanrei-search-suggestion';
63
+ const RESULT = 'tanrei-search-result';
64
+ const RESULT_GROUP = 'tanrei-search-result-group';
65
+ /** The search's slot for its results and result groups: the search puts them there itself (SRC-46). */
66
+ const RESULT_SLOT = 'result';
67
+ /** A result tells its search that a prop the search reads changed; an internal event, kept out of the public API. */
68
+ const RESULT_UPDATE = 'tanrei-search-result-update';
69
+ /**
70
+ * SRC-43: an excerpt as runs of text in order — the second, fourth and every further even run is a match. An array is
71
+ * the runs; a string is the attribute: a JSON array of them, or one run (a passage without marks).
72
+ */
73
+ function runsOf(value) {
74
+ if (Array.isArray(value))
75
+ return value.map((run) => String(run ?? ''));
76
+ if (typeof value !== 'string' || value === '')
77
+ return [];
78
+ if (value.trimStart().startsWith('[')) {
79
+ try {
80
+ const parsed = JSON.parse(value);
81
+ if (Array.isArray(parsed))
82
+ return parsed.map((run) => String(run ?? ''));
83
+ }
84
+ catch {
85
+ // Not JSON: a passage that begins with a bracket.
86
+ }
87
+ }
88
+ return [value];
89
+ }
90
+ const runsConverter = {
91
+ fromAttribute: (value) => runsOf(value),
92
+ toAttribute: (value) => JSON.stringify(runsOf(value)),
93
+ };
94
+ /** The child nodes of `host` that hold something: an element, or text that is not white space alone. */
95
+ const contentNodes = (host) => [...host.childNodes].filter((node) => node instanceof Element || (node instanceof Text && !!node.data.trim()));
96
+ /**
97
+ * What a result and a linked group heading share (SRC-42 … SRC-45): the destination props of a link, the row — a
98
+ * suggestion's row, drawn by the element because the row is its own `<a>` — and the excerpt with its marks. It holds no
99
+ * listener of its own: the search it is in answers its press, its keys and its activation.
100
+ */
101
+ export class TanreiSearchRow extends LitElement {
102
+ constructor() {
103
+ super(...arguments);
104
+ /** Identifies it; `select` carries it. Unique among the search's suggestions, results and result groups. */
105
+ this.value = '';
106
+ /** Its title, and its accessible name. */
107
+ this.headline = '';
108
+ /**
109
+ * A passage of the thing found, as runs of text in order: the first, third, fifth… run is plain text and the second,
110
+ * fourth… is a match, drawn marked (`["Tokens are ", "design", " decisions"]` marks "design"; a passage that begins
111
+ * with a match begins with an empty run). The attribute holds a JSON array of the runs, or one run as plain text. It is
112
+ * used only while the element has no excerpt as child content. The search never looks for the query in the text.
113
+ */
114
+ this.excerpt = [];
115
+ /** The name of a glyph of the system's icon set at the row's start (article, tag); empty draws none (`leading-icon`). A glyph the icon set flags as showing a direction is drawn mirrored in a right-to-left layout. */
116
+ this.leadingIcon = '';
117
+ /**
118
+ * Where it goes: a URL, a path or a fragment. Not empty, it makes the row an `<a>`, which the browser
119
+ * opens as it opens any link — a new tab by a modifier key or the middle button, the context menu, the address shown
120
+ * before it is followed. Empty, or naming a script, the row is a `<button>` and `select` is all that happens.
121
+ */
122
+ this.href = '';
123
+ /** Where the destination opens: `same` — where the person is — or `new`, a new tab or window, which `targetLabel` says. Ignored without `href`. */
124
+ this.target = 'same';
125
+ /** What assistive technology reads after the excerpt while `target` is `new` ("opens in a new tab"; `target-label`). */
126
+ this.targetLabel = '';
127
+ /** Web only: forwarded to the anchor's `rel`; `noopener` is added for a new context. */
128
+ this.rel = null;
129
+ /** Web only: forwarded to the anchor's `download`. */
130
+ this.download = null;
131
+ /** @internal SRC-42: the search keeps the leading icon column in every row while any suggestion or result has an icon. */
132
+ this.iconColumn = false;
133
+ /** SRC-45: the link the row is while it has a destination, and what a debug build is told (src/primitives/link.ts). */
134
+ this.link = new LinkController(this, { ids: { refused: 'SRC-45', newContext: 'SRC-45' }, disabled: () => false });
135
+ }
136
+ static { this.properties = {
137
+ value: { type: String },
138
+ headline: { type: String },
139
+ excerpt: { converter: runsConverter },
140
+ leadingIcon: { type: String, attribute: 'leading-icon' },
141
+ href: { type: String },
142
+ target: { type: String },
143
+ targetLabel: { type: String, attribute: 'target-label' },
144
+ rel: { type: String },
145
+ download: { type: String },
146
+ iconColumn: { attribute: false },
147
+ }; }
148
+ /** @internal The row: the `<a>` of a result with a destination, the `<button>` of one without; null where none is drawn. */
149
+ get row() {
150
+ return this.renderRoot?.querySelector('.row') ?? null;
151
+ }
152
+ /** @internal SRC-45: the link the row is now, or null: it is a button. */
153
+ get destination() {
154
+ return this.link.form;
155
+ }
156
+ /** SRC-43: the excerpt as one text — the result's description, with no word about the marks. */
157
+ get excerptText() {
158
+ const nodes = this.excerptNodes();
159
+ const text = nodes.length ? nodes.map((node) => node.textContent ?? '').join('') : runsOf(this.excerpt).join('');
160
+ return text.replace(/\s+/g, ' ').trim();
161
+ }
162
+ /** `element.focus()` focuses the row. */
163
+ focus(options) {
164
+ this.row?.focus(options);
165
+ }
166
+ /** @internal SRC-32: marks the leading glyph for mirroring, by its name and the active icon set. */
167
+ markIcon() {
168
+ const icon = this.renderRoot?.querySelector('.icon');
169
+ if (icon)
170
+ markGlyph(icon);
171
+ }
172
+ updated(changed) {
173
+ this.markIcon();
174
+ // The search re-reads its results when a prop it depends on changes.
175
+ if (['value', 'headline', 'leadingIcon', 'href'].some((key) => changed.has(key)))
176
+ notifyItemUpdate(this, RESULT_UPDATE);
177
+ }
178
+ /**
179
+ * SRC-42, SRC-43, SRC-45, SRC-50: the row — an anchor to `href`, or a button — named by the headline and described by
180
+ * the excerpt and, for a new context, `targetLabel`. `slot` is where the product's own excerpt (child content) goes;
181
+ * null draws the `excerpt` runs.
182
+ */
183
+ renderRow(slot) {
184
+ const link = this.link.form;
185
+ const tag = link ? literal `a` : literal `button`;
186
+ const runs = runsOf(this.excerpt);
187
+ const excerpt = slot ?? (runs.some(Boolean) ? runs.map((run, index) => (index % 2 ? html `<mark>${run}</mark>` : run)) : null);
188
+ const description = this.link.describe(this.excerptText);
189
+ return staticHtml `<${tag}
190
+ part="row"
191
+ class="row"
192
+ data-tanrei-shape
193
+ type=${link ? nothing : 'button'}
194
+ ${linkAttributes(link)}
195
+ aria-label=${this.headline || nothing}
196
+ aria-description=${description ?? nothing}
197
+ >${this.iconColumn ? html `<span class=${this.leadingIcon ? 'icon' : 'icon empty'} aria-hidden="true">${this.leadingIcon}</span>` : nothing}<span class="text"
198
+ ><span part="headline" class="headline">${this.headline}</span>${excerpt === null ? nothing : html `<span part="excerpt" class="excerpt">${excerpt}</span>`}</span
199
+ ></${tag}
200
+ >`;
201
+ }
202
+ }
203
+ /**
204
+ * A thing the search found that the person can go to — the spec's item kind `result`: a page, a section of a page, a
205
+ * message, a file. It is a link, never an option: with `href` its row is an `<a>` in its shadow root, which the browser
206
+ * follows as it follows any link; without one it is a `<button>`, and `select` is all that happens.
207
+ *
208
+ * The excerpt is its child content — text with `<mark>` elements around the matches, which is what search engines hand
209
+ * back (`<tanrei-search-result headline="Layers" href="/tokens/#layers">A layer changes a <mark>token</mark>.</tanrei-search-result>`)
210
+ * — or, while it has no child content, the `excerpt` runs. Putting an engine's HTML there is the product's act: the
211
+ * element never parses a string as markup.
212
+ *
213
+ * Place it in a `<tanrei-search>` or a `<tanrei-search-result-group>`: the search answers its press and its keys (Down
214
+ * and Up Arrow move through the results; typing returns to the input) and fires `select` when it is activated in place.
215
+ *
216
+ * @tag tanrei-search-result
217
+ * @slot - The excerpt: text, with `<mark>` elements for the matches.
218
+ * @csspart row - The row: the `<a>` (or `<button>`), its container color, corners and every state.
219
+ * @csspart headline - The title.
220
+ * @csspart excerpt - The passage under it.
221
+ */
222
+ export class TanreiSearchResult extends TanreiSearchRow {
223
+ static { this.styles = rowStyles; }
224
+ connectedCallback() {
225
+ super.connectedCallback();
226
+ // SRC-50: a result is an item of the results' list.
227
+ hostAria(this, { role: 'listitem' });
228
+ }
229
+ excerptNodes() {
230
+ return contentNodes(this);
231
+ }
232
+ render() {
233
+ return this.renderRow(this.excerptNodes().length ? html `<slot></slot>` : null);
234
+ }
235
+ }
236
+ /**
237
+ * Results that belong together, under one heading — the spec's item kind `result-group`: the sections found in one
238
+ * page, or the results of one kind. With `href` its heading is itself a result (the page), drawn as a result's row, and
239
+ * its `<tanrei-search-result>` children are inset under it as its parts; without one its heading is a quiet title.
240
+ *
241
+ * A linked heading's excerpt is the group's own child content besides its results — text with `<mark>` elements — or the
242
+ * `excerpt` runs while it has none. A group holds results only, and no group.
243
+ *
244
+ * @tag tanrei-search-result-group
245
+ * @slot - The group's `<tanrei-search-result>` children and, while `href` is set, the heading's excerpt (text with `<mark>`).
246
+ * @csspart title - The heading of a group without a destination.
247
+ * @csspart row - The heading of a group with a destination: a result's row.
248
+ * @csspart headline - The linked heading's title.
249
+ * @csspart excerpt - The linked heading's passage.
250
+ */
251
+ export class TanreiSearchResultGroup extends TanreiSearchRow {
252
+ constructor() {
253
+ super(...arguments);
254
+ /** @internal SRC-44: something stands above the group in the view, so it stands group.gap below it. */
255
+ this.gapBefore = false;
256
+ /** @internal SRC-44: something that is not a group follows it, so it stands group.gap above it. */
257
+ this.gapAfter = false;
258
+ }
259
+ static { this.styles = [rowStyles, groupStyles]; }
260
+ // The results and the heading's excerpt are both child content: each is assigned to its own slot by hand.
261
+ static { this.shadowRootOptions = { ...LitElement.shadowRootOptions, slotAssignment: 'manual' }; }
262
+ static { this.properties = {
263
+ ...TanreiSearchRow.properties,
264
+ gapBefore: { attribute: false },
265
+ gapAfter: { attribute: false },
266
+ }; }
267
+ connectedCallback() {
268
+ super.connectedCallback();
269
+ hostAria(this, { role: 'listitem' });
270
+ }
271
+ /** @internal The group's results, in order. */
272
+ get results() {
273
+ return [...this.children].filter((child) => child instanceof TanreiSearchResult);
274
+ }
275
+ /** @internal SRC-44: the heading is a result's row — the group has a destination. */
276
+ get linked() {
277
+ return this.link.form !== null;
278
+ }
279
+ excerptNodes() {
280
+ return contentNodes(this).filter((node) => !(node instanceof Element && node.localName.includes('-')));
281
+ }
282
+ updated(changed) {
283
+ super.updated(changed);
284
+ const root = this.renderRoot;
285
+ assignSlot(root.querySelector('slot.excerpt-slot'), this.linked ? this.excerptNodes() : []);
286
+ assignSlot(root.querySelector('slot.results-slot'), this.results);
287
+ }
288
+ render() {
289
+ const linked = this.linked;
290
+ const results = this.results.length > 0;
291
+ // SRC-50: a group named by its headline, holding the linked heading and then its own list of its results.
292
+ return html `<div
293
+ class="group${linked ? ' linked' : ''}${this.gapBefore ? ' before' : ''}${this.gapAfter ? ' after' : ''}"
294
+ role="group"
295
+ aria-label=${this.headline || nothing}
296
+ >
297
+ ${linked
298
+ ? this.renderRow(this.excerptNodes().length ? html `<slot class="excerpt-slot"></slot>` : null)
299
+ : this.headline
300
+ ? html `<div part="title" class="title" aria-hidden="true">${this.headline}</div>`
301
+ : nothing}
302
+ <div class="list" role=${results ? 'list' : nothing}><slot class="results-slot"></slot></div>
303
+ </div>`;
304
+ }
305
+ }
306
+ /** A result or a linked group heading in `event`'s path whose own row the event came from, or null. */
307
+ function rowOf(event, within) {
308
+ const path = event.composedPath();
309
+ for (const node of path) {
310
+ if (node === within)
311
+ return null;
312
+ if (node instanceof TanreiSearchRow) {
313
+ const row = node.row;
314
+ return row && path.includes(row) ? node : null;
315
+ }
316
+ }
317
+ return null;
318
+ }
319
+ /** KBS-1: the named keys, as `KeyboardEvent.key` reports them. */
320
+ const EVENT_KEYS = {
321
+ enter: 'Enter',
322
+ escape: 'Escape',
323
+ tab: 'Tab',
324
+ backspace: 'Backspace',
325
+ delete: 'Delete',
326
+ space: ' ',
327
+ 'arrow-up': 'ArrowUp',
328
+ 'arrow-down': 'ArrowDown',
329
+ 'arrow-left': 'ArrowLeft',
330
+ 'arrow-right': 'ArrowRight',
331
+ home: 'Home',
332
+ end: 'End',
333
+ 'page-up': 'PageUp',
334
+ 'page-down': 'PageDown',
335
+ 'caps-lock': 'CapsLock',
336
+ plus: '+',
337
+ ...Object.fromEntries(Array.from({ length: 24 }, (_, i) => [`f${i + 1}`, `F${i + 1}`])),
338
+ };
339
+ /** SRC-38: a chord in the keyboard shortcut's key names (`mod+k`, `/`) as a binding, or null where it is not one chord of modifiers and one key. */
340
+ function readBinding(chord) {
341
+ const modifiers = new Set();
342
+ const others = [];
343
+ for (const name of chord.split('+').map((each) => each.trim().toLowerCase())) {
344
+ if (!name)
345
+ continue;
346
+ if (name === 'mod' || name === 'ctrl' || name === 'alt' || name === 'shift')
347
+ modifiers.add(name);
348
+ else
349
+ others.push(name);
350
+ }
351
+ if (others.length !== 1)
352
+ return null;
353
+ const key = EVENT_KEYS[others[0]] ?? ([...others[0]].length === 1 ? others[0] : null);
354
+ if (key === null)
355
+ return null;
356
+ const [mod, ctrl, alt, shift] = ['mod', 'ctrl', 'alt', 'shift'].map((name) => modifiers.has(name));
357
+ return { id: [...['mod', 'ctrl', 'alt', 'shift'].filter((name) => modifiers.has(name)), key].join('+'), key, mod, ctrl, alt, shift };
358
+ }
359
+ /** SRC-38: whether `event` is that chord, read as KBS-1 reads it: mod is Command under the apple convention and Control otherwise. */
360
+ function chordPressed(event, binding, convention) {
361
+ const meta = binding.mod && convention === 'apple';
362
+ const ctrl = binding.ctrl || (binding.mod && convention !== 'apple');
363
+ if (event.metaKey !== meta || event.ctrlKey !== ctrl || event.altKey !== binding.alt)
364
+ return false;
365
+ const character = [...binding.key].length === 1 && binding.key !== ' ';
366
+ const letter = character && /[\p{L}\p{N}]/u.test(binding.key);
367
+ // A named key or a letter is pressed with Shift exactly when the chord names it; a sign that a layout writes with
368
+ // Shift (?) is what `key` says it is.
369
+ if (!character || letter ? event.shiftKey !== binding.shift : binding.shift && !event.shiftKey)
370
+ return false;
371
+ if (event.key.toLowerCase() === binding.key.toLowerCase())
372
+ return true;
373
+ // Option on a Mac writes another character for the same key: with alt, the key's place decides.
374
+ return letter && binding.alt && (event.code === `Key${binding.key.toUpperCase()}` || event.code === `Digit${binding.key}`);
375
+ }
376
+ /** SRC-38: whether `element` takes text, so that a key without a modifier types there. */
377
+ function takesText(element) {
378
+ if (!element)
379
+ return false;
380
+ if (element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement)
381
+ return true;
382
+ if (element instanceof HTMLInputElement)
383
+ return !['button', 'checkbox', 'color', 'file', 'image', 'radio', 'range', 'reset', 'submit'].includes(element.type);
384
+ return element instanceof HTMLElement && element.isContentEditable;
385
+ }
386
+ /** SRC-39: the chord each shown search has bound, and the searches that wait for one another search holds. */
387
+ const BOUND = new Map();
388
+ const WAITING = new Set();
389
+ /**
390
+ * Lets people search the product from a bar or a compact trigger, and offers suggestions and results while they type in
391
+ * a view under the bar, in a dialog or over the whole screen.
392
+ *
393
+ * Contract: specs/search.spec.json. The value is edited in a native `<input type="search" enterkeyhint="search">` in the
394
+ * shadow root, as the text field's, with the browser's own cancel button hidden: the search draws its own
395
+ * clear button. Every visual value comes from `--tanrei-comp-search-*` tokens, its one condition's parts by state.
396
+ *
397
+ * Opening and closing: a press on the bar, typing or Down Arrow opens the view (focus alone never does); Escape, a
398
+ * chosen suggestion, submitting, the back button, and — docked — a press outside, Tab and focus leaving close it. The
399
+ * element sets its own `expanded` and then fires `toggle`, whose `detail` holds `expanded` and, when closing, `reason`.
400
+ * Set `expanded` yourself to open or close it without an event.
401
+ *
402
+ * `docked` (the default) opens a view under the bar: a manual popover in the top layer, placed by script (flipped above
403
+ * the bar when there is more room there), following the bar. Focus stays in the input — the WAI-ARIA combobox pattern:
404
+ * the input controls the suggestions' listbox and names the active suggestion as its active descendant. A press outside
405
+ * closes it AND reaches the element under it. `full-screen` opens a modal `<dialog>` over the whole window with its own
406
+ * header (a back button, the input, the clear button); it takes focus, keeps it, and gives it back to the bar's input.
407
+ *
408
+ * A site search. `bar="button"` draws a trigger shaped like the bar — the search glyph, the placeholder
409
+ * and the shortcut hint — and `bar="icon"` an icon-only Button; a trigger opens a modal view, where the input is
410
+ * (`presentation="dialog"`: a `<dialog>` hung from the top of the window over a scrim, a press on which closes it,
411
+ * its header starting with the same back button as the full-screen view's, so it can be left by Tab and Enter alone;
412
+ * `docked` with a trigger opens as `dialog`). `shortcut` (chords separated by spaces, as the keyboard shortcut's `keys`)
413
+ * is written as a hint — a line of text, no keycaps — and exposed as `aria-keyshortcuts`; it makes the keys work only with `bind-shortcut`, which adds one
414
+ * `keydown` listener on the window while the element is connected and enabled. The results are
415
+ * `<tanrei-search-result>` and `<tanrei-search-result-group>` children: links, never options, reached from the input
416
+ * with Down Arrow (real focus), left with Up Arrow or by typing. `status` and `status-text` draw the status row — a
417
+ * `role="status"` element that exists from the first render (`role="alert"` while `status="error"`). The search never
418
+ * runs a query: listen to `input`, then set the results, `status` and `status-text`.
419
+ *
420
+ * Form-associated: with a `name` it submits `value`, and Enter (with no suggestion active) requests its form's
421
+ * submission after `submit`, unless `submit` was cancelled. The `inline` attribute, for tests and documentation, draws
422
+ * the open view in place: the docked view under the bar, the full-screen view filling the element.
423
+ *
424
+ * @tag tanrei-search
425
+ * @slot leading - An icon button at the bar's start (a menu or back button), drawn in place of the search glyph.
426
+ * @slot trailing - Up to two icon buttons at the bar's end, after the clear button (voice input, account). The bar's action buttons — the clear button and these — stand `container.button-gap` apart (0 in the default system), each keeping a touch target's length along the row: two medium Buttons stand 8 apart, the small clear button and a medium one 12 (SRC-34).
427
+ * @slot - The product's own content in the view, after the suggestions, the status row and the results (a button that loads more results, a link to the full results page, richer content for an empty query); and the item children: `<tanrei-search-suggestion>`, which the search draws as rows, and `<tanrei-search-result>` and `<tanrei-search-result-group>`, which it places after the status row.
428
+ * @csspart container - The bar, or the button trigger: its color, corners, elevation and every state.
429
+ * @csspart input - The native `<input>` (the bar's, and a modal view's header's).
430
+ * @csspart view - The docked view's surface.
431
+ * @csspart dialog - The dialog view's container, or the full-screen view.
432
+ * @csspart listbox - The suggestions.
433
+ * @csspart status - The status row.
434
+ * @csspart results - The list of the results and result groups.
435
+ * @attr {string} form - The id of the form the search belongs to, where it stands outside it: the platform's own attribute, which then wins over a form around it. The `form` property is read-only and returns the form element.
436
+ * @fires input - The person changed the value (typing, deleting, pasting, dictating, the clear button, Escape); `value` is already the new one. Never fired when the product sets `value`.
437
+ * @fires {CustomEvent<TanreiSearchSubmitDetail>} submit - The action key (Enter, Search) was pressed with no suggestion active: `detail.value`. Cancelable: cancelling it keeps an enclosing form from being submitted.
438
+ * @fires {CustomEvent<TanreiSearchSelectDetail>} select - The person chose a suggestion, or activated a result in place (without a modifier key, in the same window): `detail.value` is its value. The search does not change `value`; set the value you want. For a result it is fired before the browser follows the link and is cancelable: cancelling it keeps the link from being followed, so that a router can take it. A result opened in a new tab (a modifier key, the middle button, `target="new"`) fires nothing.
439
+ * @fires {CustomEvent<TanreiSearchToggleDetail>} toggle - The search opened or closed its view: `detail.expanded` (and the element's `expanded`) is the new value, and `detail.reason` says why it closed (`escape`, `back`, `select`, `submit`, `outside`, `tab`, `focus-out`, `shortcut`), or `null` when it opened.
440
+ */
441
+ export class TanreiSearch extends LitElement {
442
+ static { this.styles = styles; }
443
+ static { this.formAssociated = true; }
444
+ static { this.shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true }; }
445
+ static { this.properties = {
446
+ presentation: { type: String, reflect: true },
447
+ bar: { type: String, reflect: true },
448
+ value: { type: String },
449
+ label: { type: String },
450
+ placeholder: { type: String },
451
+ expanded: { type: Boolean, reflect: true },
452
+ disabled: { type: Boolean, reflect: true },
453
+ clearLabel: { type: String, attribute: 'clear-label' },
454
+ backLabel: { type: String, attribute: 'back-label' },
455
+ shortcut: { converter: chordsConverter },
456
+ bindShortcut: { type: Boolean, attribute: 'bind-shortcut' },
457
+ status: { type: String, reflect: true },
458
+ statusText: { type: String, attribute: 'status-text' },
459
+ inline: { type: Boolean, reflect: true },
460
+ name: { type: String, reflect: true },
461
+ suggestions: { state: true },
462
+ entries: { state: true },
463
+ iconColumn: { state: true },
464
+ active: { state: true },
465
+ hasLeading: { state: true },
466
+ trailingCount: { state: true },
467
+ hasContent: { state: true },
468
+ formDisabled: { state: true },
469
+ }; }
470
+ constructor() {
471
+ super();
472
+ this.availability = new AvailabilityController(this, 'search');
473
+ /** The product's words, read where the instance gives none (src/primitives/words.ts). */
474
+ this.words = new WordsController(this);
475
+ /** SRC-30: each of the search's glyphs is drawn only while the icon set can draw it (src/primitives/glyph.ts). */
476
+ this.glyphs = new GlyphDrawnController(this, () => this.renderRoot.querySelectorAll('.glyph, .button-glyph'));
477
+ /**
478
+ * SRC-34: the bar's action buttons — the clear button while it is shown, then the trailing slot's — each keep a touch
479
+ * target's length along the row; their lengths are measured for the styles (src/primitives/kept-length.ts).
480
+ */
481
+ this.kept = new KeptLengths();
482
+ /**
483
+ * SRC-32: a suggestion's leading glyph is marked when the icon set mirrors its name in right-to-left
484
+ * (src/primitives/glyph-mirror.ts); `iconGlyph()` draws the mark. The search glyph (SRC-2) is not named here, and the
485
+ * back and clear Buttons mark their own glyphs (BTN-19: `arrow_back` is flagged, `close` is not).
486
+ */
487
+ this.mirror = new GlyphMirrorController(this, { drawn: '.option-icon' });
488
+ /** SRC-32: a switch of the design system changes the icon set; the results' glyphs are marked again (`updated()`). */
489
+ this.system = new SystemWatchController(this);
490
+ /**
491
+ * Where the view opens: `docked` under the bar, without taking focus from it; `dialog`, a modal surface near the top
492
+ * of the window with its own header (a large screen, opened from a trigger); or `full-screen`, over the whole window
493
+ * with its own header (a small screen).
494
+ */
495
+ this.presentation = 'docked';
496
+ /**
497
+ * What stands where the search is placed. `field`: the bar with its input. `button`: a trigger shaped like the bar
498
+ * that holds no input — the search glyph, the placeholder and the shortcut hint — for an app bar with room. `icon`: an
499
+ * icon-only Button showing the search glyph, for an app bar without. A trigger opens a modal view (`dialog` or
500
+ * `full-screen`), where the input is; `docked` with a trigger opens as `dialog`.
501
+ */
502
+ this.bar = 'field';
503
+ /** The query. Setting it shows it and fires nothing. The `value` attribute is what a form reset returns to. */
504
+ this.value = '';
505
+ /** Names the search field, the trigger, the view, the suggestions and the results for assistive technology ("Search mail"). Drawn only as a button trigger's text while `placeholder` is empty. Required. */
506
+ this.label = '';
507
+ /** A hint shown while the value is empty, and the text of a button trigger. Never a replacement for `label`. */
508
+ this.placeholder = '';
509
+ /** Whether the view is open. The search sets it itself (and fires `toggle`); set it to open or close the view yourself. */
510
+ this.expanded = false;
511
+ /** Prevents focus, editing and opening the view. */
512
+ this.disabled = false;
513
+ /** The clear button's accessible name, in the product's language ("Clear search"; `clear-label`). */
514
+ this.clearLabel = '';
515
+ /** The accessible name of the back button in a modal view's header — dialog or full-screen ("Back"; `back-label`). */
516
+ this.backLabel = '';
517
+ /**
518
+ * The keyboard shortcut that opens the search, in the keyboard shortcut component's key names: one chord per string
519
+ * (`["mod+k"]`, `["/"]`; the attribute holds the chords separated by spaces, `shortcut="mod+k"`). The search writes it
520
+ * as a hint, a line of text with no keycaps — at the end of a button trigger, and in the bar while the value is empty and the input is not focused —
521
+ * and exposes it as `aria-keyshortcuts` of its trigger or its input. It makes the keys work only with `bindShortcut`;
522
+ * otherwise the product binds them and sets `expanded`.
523
+ */
524
+ this.shortcut = [];
525
+ /**
526
+ * Makes the search itself listen for `shortcut`, anywhere in the window, while it is connected and enabled: the keys
527
+ * open it, and close it again while it is open (`bind-shortcut`). One chord; a press something else cancelled, a key
528
+ * repeating while held, an input-method composition and — for a chord without mod, ctrl or alt — a press while focus
529
+ * is in an element that takes text are left alone. Off by default.
530
+ */
531
+ this.bindShortcut = false;
532
+ /**
533
+ * What the product's search is doing, which the product sets: `idle` (results, or none, are final), `loading` (a
534
+ * query is running: the status row shows a loading indicator after its delay, and the results are marked busy) or
535
+ * `error` (the query failed: `statusText` is drawn as an error and announced at once). The search never runs a query.
536
+ */
537
+ this.status = 'idle';
538
+ /**
539
+ * The status row's text, in the product's language, announced to assistive technology when it changes
540
+ * (`status-text`): the count ("12 results for tokens"), that nothing was found, the failure; while loading, the
541
+ * loading indicator's name ("Searching"). Empty draws no status row unless `status` is `loading`.
542
+ */
543
+ this.statusText = '';
544
+ /** For tests and documentation: draws the open view in place, without the overlay's behaviour. */
545
+ this.inline = false;
546
+ /** Web only: the name it is submitted under. */
547
+ this.name = '';
548
+ this.suggestions = [];
549
+ /** The results and result groups (children), in the product's order. */
550
+ this.entries = [];
551
+ /** SRC-16, SRC-42: any suggestion or result has a leading icon, so every row keeps the column. */
552
+ this.iconColumn = false;
553
+ /** The active suggestion's index (the input's active descendant), or -1. */
554
+ this.active = -1;
555
+ this.hasLeading = false;
556
+ this.trailingCount = 0;
557
+ /** The default slot holds the product's own content (anything but the suggestions). */
558
+ this.hasContent = false;
559
+ /** Set by an ancestor `<fieldset disabled>`. */
560
+ this.formDisabled = false;
561
+ this.children$ = new MutationObserver((records) => this.readChildren(records));
562
+ /** SRC-4: the bar's input and the header's, each kept in step with `value` around an input method (TXF-1, TXF-4). */
563
+ this.barText = new NativeTextController({ input: () => this.barInput, value: () => this.value, setValue: (value) => (this.value = value) });
564
+ this.headerText = new NativeTextController({ input: () => this.headerInput, value: () => this.value, setValue: (value) => (this.value = value) });
565
+ /**
566
+ * SRC-19, SRC-20: the bar's press — by pointer or touch only: Enter and Space in the input type and submit. SRC-36: a
567
+ * button trigger is pressed as the bar is, and by Enter and Space as a button.
568
+ */
569
+ this.barPress = new PressController(this, {
570
+ container: () => this.triggerButton ?? this.barElement,
571
+ holdCarrier: () => this.renderRoot.querySelector('.hold'),
572
+ disabled: () => this.inert_,
573
+ keys: () => (this.triggerButton ? undefined : []),
574
+ });
575
+ /** SRC-19, SRC-20, SRC-42: a suggestion's or a result's press — by pointer, touch or Enter; the row being pressed is `pressedRow`. */
576
+ this.pressedRow = null;
577
+ this.rowPress = new PressController(this, {
578
+ container: () => this.pressedRow,
579
+ holdCarrier: () => this.renderRoot.querySelector('.hold'),
580
+ disabled: () => false,
581
+ keys: [],
582
+ });
583
+ this.viewShown = false;
584
+ this.fullShown = false;
585
+ this.lastLayout = '';
586
+ this.listening = false;
587
+ /** SRC-42: the result whose row is pressed by a pointer now. */
588
+ this.pressedResult = null;
589
+ /** SRC-51: the result that took focus last, for the moment the product removes it. */
590
+ this.focusedResult = null;
591
+ /** SRC-40: a press began on the dialog view's scrim. */
592
+ this.scrimPressed = false;
593
+ /** SRC-38: the chord this search listens for now, or null. */
594
+ this.binding = null;
595
+ this.readQueued = false;
596
+ // ── The inputs ─────────────────────────────────────────────────────────────────────────────────────────
597
+ /**
598
+ * SRC-4 (TXF-1): the person changed the value. The native `input` is composed, so it leaves the shadow root by itself —
599
+ * after the element has taken the new value. SRC-5: typing opens the view; SRC-14: it leaves no suggestion active.
600
+ */
601
+ this.onInput = (event) => {
602
+ const input = event.target;
603
+ const text = input === this.headerInput ? this.headerText : this.barText;
604
+ if (!text.composingInput(event))
605
+ this.value = input.value;
606
+ this.active = -1;
607
+ if (!this.expanded) {
608
+ input.focus();
609
+ this.expand();
610
+ }
611
+ };
612
+ /** SRC-5, SRC-12, SRC-13, SRC-14: the keys the input answers. Escape while open and Tab are the host's (below). */
613
+ this.onInputKeyDown = (event) => {
614
+ if (this.inert_ || event.altKey || event.ctrlKey || event.metaKey)
615
+ return;
616
+ const input = event.target;
617
+ const composing = event.isComposing || event.keyCode === 229 || this.barText.composing || this.headerText.composing;
618
+ if (composing)
619
+ return;
620
+ const count = this.suggestions.length;
621
+ switch (event.key) {
622
+ case 'ArrowDown':
623
+ event.preventDefault();
624
+ if (!this.expanded)
625
+ this.expand();
626
+ else if (this.active < count - 1)
627
+ this.setActive(this.active + 1);
628
+ // SRC-14, SRC-49: with no suggestion to go to — none in the view, or the last one active — on to the first result.
629
+ else
630
+ this.focusResult(0);
631
+ return;
632
+ case 'ArrowUp':
633
+ if (this.expanded && this.active >= 0) {
634
+ event.preventDefault();
635
+ this.setActive(this.active - 1);
636
+ }
637
+ return;
638
+ case 'Enter': {
639
+ if (event.shiftKey)
640
+ return;
641
+ event.preventDefault();
642
+ if (event.repeat)
643
+ return;
644
+ const index = this.expanded ? this.active : -1;
645
+ if (index >= 0 && index < count) {
646
+ // SRC-19: the chosen row shows its press.
647
+ const row = this.renderRoot.querySelector(`#option-${index}`);
648
+ if (row) {
649
+ this.pressRow(row);
650
+ this.rowPress.press(null);
651
+ this.rowPress.release();
652
+ }
653
+ this.choose(index);
654
+ }
655
+ else
656
+ this.submit();
657
+ return;
658
+ }
659
+ case 'Escape':
660
+ // SRC-12: collapsed, Escape empties a value, as a native search input does; with none it passes on.
661
+ if (!this.expanded && this.value !== '') {
662
+ event.preventDefault();
663
+ this.clearValue();
664
+ }
665
+ return;
666
+ case 'ArrowLeft':
667
+ case 'ArrowRight':
668
+ case 'Home':
669
+ case 'End':
670
+ // SRC-14: moving the caret leaves no suggestion active.
671
+ this.active = -1;
672
+ return;
673
+ default:
674
+ void input;
675
+ }
676
+ };
677
+ /** SRC-6, SRC-9: Escape anywhere in the search closes an open view; Tab closes the docked one and stays in the full-screen one. */
678
+ this.onHostKeyDown = (event) => {
679
+ if (!this.expanded || this.inert_ || event.defaultPrevented)
680
+ return;
681
+ if (event.key === 'Escape') {
682
+ event.preventDefault();
683
+ event.stopPropagation();
684
+ this.collapse('escape');
685
+ return;
686
+ }
687
+ const row = rowOf(event, this);
688
+ if (row && this.onResultKeyDown(event, row))
689
+ return;
690
+ if (event.key !== 'Tab' || this.inline)
691
+ return;
692
+ const dialog = this.dialog;
693
+ if (this.modal && dialog && this.fullShown) {
694
+ // SRC-49: in a modal view Tab goes through the header's controls, the results and the product's content.
695
+ trapFocus(event, dialog);
696
+ return;
697
+ }
698
+ // Docked: the Tab's own move goes on from where it was, as it would have (from the input, for a result: `collapse()`).
699
+ if (!this.modal)
700
+ this.collapse('tab');
701
+ };
702
+ /** SRC-42, SRC-51: the result that takes focus — its ring's focus style (SRC-21), and which one to miss when it is removed. */
703
+ this.onFocusIn = (event) => {
704
+ const row = rowOf(event, this);
705
+ this.focusedResult = row;
706
+ if (row)
707
+ syncFocusStyle(row, row.row);
708
+ };
709
+ /**
710
+ * SRC-45: a result was activated. In place — a primary press, a touch or Enter, without a modifier key, in the same
711
+ * window — `select` with its value, then the browser follows the link unless `select` was cancelled (a router took
712
+ * it), then the view closes. Any other way (a modifier key, `target: new`; the middle button fires no click) nothing
713
+ * is emitted and the view stays, so that a person can open several results from one search. Never Space on a link.
714
+ */
715
+ this.onResultClick = (event) => {
716
+ const row = rowOf(event, this);
717
+ if (!row || this.inert_)
718
+ return;
719
+ const link = row.destination;
720
+ if (link && (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || link.opensNew))
721
+ return;
722
+ const proceed = this.dispatchEvent(new CustomEvent('select', { cancelable: true, detail: { value: row.value } }));
723
+ if (!proceed)
724
+ event.preventDefault();
725
+ this.collapse('select');
726
+ };
727
+ /** SRC-42, SRC-19: a result's row shows its press, from the point of contact. */
728
+ this.onResultPointerDown = (event) => {
729
+ const row = rowOf(event, this);
730
+ const target = row?.row;
731
+ if (!row || !target || this.inert_)
732
+ return;
733
+ this.pressedResult = row;
734
+ this.pressRow(target);
735
+ this.rowPress.onPointerDown(event);
736
+ };
737
+ this.onResultPointerEnd = () => {
738
+ if (!this.pressedResult)
739
+ return;
740
+ this.pressedResult = null;
741
+ this.rowPress.release();
742
+ };
743
+ /** The pointer left the pressed result (its row fills it), as a row's own `pointerleave`. */
744
+ this.onResultPointerOut = (event) => {
745
+ if (this.pressedResult && event.relatedTarget !== this.pressedResult)
746
+ this.onResultPointerEnd();
747
+ };
748
+ /** SRC-6: focus moving out of the search closes the docked view. */
749
+ this.onFocusOut = (event) => {
750
+ if (!this.expanded || this.inline || this.modal)
751
+ return;
752
+ const to = event.relatedTarget;
753
+ // Focus that goes nowhere (a press on the page) is the press's to answer; a window switch keeps the view.
754
+ if (!to || to === this || this.contains(to) || this.renderRoot.contains(to))
755
+ return;
756
+ this.collapse('focus-out');
757
+ };
758
+ /** SRC-6: a press outside the bar and the view closes the docked view; the press also reaches what is under it. */
759
+ this.onOutsidePress = (event) => {
760
+ if (event.composedPath().includes(this))
761
+ return;
762
+ this.collapse('outside');
763
+ };
764
+ this.onInputFocus = (event) => {
765
+ // SRC-18: where style queries are missing, the focus style is read when focus arrives (the glow).
766
+ if (event.target === this.barInput)
767
+ syncFocusStyle(this, this.barElement);
768
+ };
769
+ /** SRC-14: a press in the input moves the caret, which leaves no suggestion active. */
770
+ this.onInputPointerDown = () => {
771
+ this.active = -1;
772
+ };
773
+ this.onBarPointerDown = (event) => {
774
+ if (this.inert_ || !this.fromBar(event))
775
+ return;
776
+ this.barPress.onPointerDown(event);
777
+ };
778
+ /** A press on the bar outside the input focuses the input without leaving it first (as the text field's TXF-8). */
779
+ this.onBarMouseDown = (event) => {
780
+ const input = this.barInput;
781
+ if (this.inert_ || !input || event.button !== 0 || !this.fromBar(event) || event.composedPath().includes(input))
782
+ return;
783
+ event.preventDefault();
784
+ input.focus();
785
+ };
786
+ /** SRC-5: a press on the bar — outside its slots and the clear button — focuses the input and opens the view. */
787
+ this.onBarClick = (event) => {
788
+ if (this.inert_ || !this.fromBar(event))
789
+ return;
790
+ const input = this.barInput;
791
+ if (input && this.renderRoot.activeElement !== input)
792
+ input.focus();
793
+ this.expand();
794
+ };
795
+ /** SRC-10: the clear button empties the value and gives focus back to the input it belongs to; nothing opens or closes. */
796
+ this.onClear = (event) => {
797
+ const header = event.currentTarget.closest('.header');
798
+ this.clearValue();
799
+ (header ? this.headerInput : this.barInput)?.focus();
800
+ };
801
+ /** SRC-11, SRC-40: the back button closes the modal view it stands in — full-screen or dialog. */
802
+ this.onBack = () => this.collapse('back');
803
+ /** SRC-36: the trigger was activated (by pointer, touch, Enter or Space — a button's own click): the modal view opens. */
804
+ this.onTriggerClick = () => {
805
+ if (!this.inert_)
806
+ this.expand();
807
+ };
808
+ /** SRC-36: where style queries are missing, the trigger's focus style is read when focus arrives (the glow). */
809
+ this.onTriggerFocus = () => syncFocusStyle(this, this.triggerButton);
810
+ this.onDialogPointerDown = (event) => {
811
+ this.scrimPressed = this.outsideDialog(event);
812
+ };
813
+ this.onDialogClick = (event) => {
814
+ const pressed = this.scrimPressed;
815
+ this.scrimPressed = false;
816
+ if (pressed && this.outsideDialog(event))
817
+ this.collapse('outside');
818
+ };
819
+ /** The scrim of a dialog view drawn in place (tests and documentation) answers as the backdrop does. */
820
+ this.onScrimClick = () => this.collapse('outside');
821
+ /** SRC-6: the browser's own close request without a key (Android's back) arrives as the dialog's cancel. */
822
+ this.onNativeCancel = (event) => {
823
+ event.preventDefault();
824
+ this.collapse('back');
825
+ };
826
+ this.onRowPointerDown = (event) => {
827
+ this.pressRow(event.currentTarget);
828
+ this.rowPress.onPointerDown(event);
829
+ };
830
+ /**
831
+ * SRC-8: a press on a suggestion, on the status row or on the docked view's surface never takes focus from the input.
832
+ * SRC-9, SRC-40: in a modal view a press on anything that takes no focus of its own keeps focus inside (on the header,
833
+ * it goes to the input).
834
+ */
835
+ this.onViewMouseDown = (event) => {
836
+ if (!this.modal) {
837
+ // SRC-8: a result is a link and takes focus when the person presses it, which is still focus inside the search.
838
+ if (!rowOf(event, this))
839
+ event.preventDefault();
840
+ return;
841
+ }
842
+ const path = event.composedPath();
843
+ const focusable = path.some((node) => node instanceof HTMLElement && node.matches('input, textarea, select, button, a[href], [contenteditable], [tabindex]:not([tabindex="-1"])'));
844
+ if (focusable)
845
+ return;
846
+ event.preventDefault();
847
+ if (path.some((node) => node instanceof HTMLElement && node.classList.contains('header')))
848
+ this.headerInput?.focus();
849
+ };
850
+ this.onRowClick = (event) => {
851
+ const index = Number(event.currentTarget.dataset.index);
852
+ this.choose(index);
853
+ };
854
+ /** SRC-7: follows the bar while it moves (scrolling, layout, the viewport, the keyboard) — asked by FollowController, frame by frame only while something moves. */
855
+ this.follow = () => {
856
+ const box = this.barElement?.getBoundingClientRect();
857
+ const scroll = this.view?.querySelector('.scroll');
858
+ const visual = window.visualViewport;
859
+ const layout = `${box?.x},${box?.y},${box?.width},${box?.height},${document.documentElement.clientWidth},${document.documentElement.clientHeight},${visual?.height},${visual?.offsetTop},${scroll?.scrollHeight}`;
860
+ if (layout === this.lastLayout)
861
+ return false;
862
+ this.lastLayout = layout;
863
+ this.place();
864
+ return true;
865
+ };
866
+ this.following = new FollowController(this, {
867
+ followed: () => [this.barElement],
868
+ sized: () => [this.view, this.view?.querySelector('.scroll')],
869
+ check: this.follow,
870
+ });
871
+ /** SRC-9: the full-screen view above the on-screen keyboard. */
872
+ this.onViewport = () => {
873
+ const visual = window.visualViewport;
874
+ const dialog = this.dialog;
875
+ if (!visual || !dialog)
876
+ return;
877
+ dialog.style.setProperty('--_keyboard', `${Math.max(0, document.documentElement.clientHeight - (visual.offsetTop + visual.height))}px`);
878
+ };
879
+ /**
880
+ * SRC-38: the bound chord, pressed anywhere in the window, opens the search — as its trigger does, or by focusing its
881
+ * input — and closes it again with the reason shortcut, and does nothing else. Left alone: a press something else has
882
+ * taken, a key repeating while held, an input-method composition, and a chord without mod, ctrl or alt while focus is
883
+ * in an element that takes text (the search's own input included), so that such a key types there.
884
+ */
885
+ this.onWindowKeyDown = (event) => {
886
+ const binding = this.binding;
887
+ if (!binding || this.inert_ || event.defaultPrevented || event.repeat || event.isComposing || event.keyCode === 229)
888
+ return;
889
+ if (!chordPressed(event, binding, this.convention))
890
+ return;
891
+ if (!binding.mod && !binding.ctrl && !binding.alt && takesText(deepActive()))
892
+ return;
893
+ event.preventDefault();
894
+ if (this.expanded) {
895
+ this.collapse('shortcut');
896
+ return;
897
+ }
898
+ if (!this.triggered)
899
+ this.barInput?.focus();
900
+ this.expand();
901
+ };
902
+ this.internals = this.attachInternals();
903
+ this.addEventListener('keydown', this.onHostKeyDown);
904
+ this.addEventListener('focusout', this.onFocusOut);
905
+ this.addEventListener('focusin', this.onFocusIn);
906
+ this.addEventListener('tanrei-search-suggestion-update', () => this.readChildren());
907
+ // The results draw themselves and hold no listener: the search answers every one of them from here, however many.
908
+ this.addEventListener('click', this.onResultClick);
909
+ this.addEventListener('pointerdown', this.onResultPointerDown);
910
+ this.addEventListener('pointerup', this.onResultPointerEnd);
911
+ this.addEventListener('pointercancel', this.onResultPointerEnd);
912
+ this.addEventListener('pointerout', this.onResultPointerOut);
913
+ // A page of results tells the search about each of its rows; they are read once.
914
+ this.addEventListener(RESULT_UPDATE, () => {
915
+ if (this.readQueued)
916
+ return;
917
+ this.readQueued = true;
918
+ queueMicrotask(() => {
919
+ this.readQueued = false;
920
+ if (this.isConnected)
921
+ this.readChildren();
922
+ });
923
+ });
924
+ }
925
+ connectedCallback() {
926
+ super.connectedCallback();
927
+ this.children$.observe(this, { childList: true, characterData: true, subtree: true, attributes: true, attributeFilter: ['slot'] });
928
+ this.readChildren();
929
+ // SRC-34: back in the page, the action buttons are measured again.
930
+ if (this.hasUpdated)
931
+ this.keepActions();
932
+ // SRC-38: shown again, it listens again.
933
+ if (this.hasUpdated)
934
+ this.syncShortcut();
935
+ }
936
+ disconnectedCallback() {
937
+ super.disconnectedCallback();
938
+ this.kept.clear();
939
+ this.children$.disconnect();
940
+ this.stopFollowing();
941
+ this.listen(false);
942
+ if (this.fullShown)
943
+ this.withdrawFull(false);
944
+ // SRC-38: removed, it stops listening.
945
+ this.syncShortcut();
946
+ }
947
+ createRenderRoot() {
948
+ const root = super.createRenderRoot();
949
+ // KBS-12: the hint's keys changed without the search (an ancestor's keyboard convention): expose them again.
950
+ root.addEventListener(SHORTCUT_UPDATE, () => this.requestUpdate());
951
+ return root;
952
+ }
953
+ // ── What the element holds ───────────────────────────────────────────────────────────────────────────────
954
+ get barElement() {
955
+ return this.renderRoot?.querySelector('.bar') ?? null;
956
+ }
957
+ get barInput() {
958
+ return this.renderRoot?.querySelector('.bar .input') ?? null;
959
+ }
960
+ get headerInput() {
961
+ return this.renderRoot?.querySelector('.header .input') ?? null;
962
+ }
963
+ get view() {
964
+ return this.renderRoot?.querySelector('.view') ?? null;
965
+ }
966
+ get dialog() {
967
+ return this.renderRoot?.querySelector('.full') ?? null;
968
+ }
969
+ get inert_() {
970
+ return this.disabled || this.formDisabled;
971
+ }
972
+ /** SRC-27: a bar the search does not define is drawn as the field. */
973
+ get barForm() {
974
+ return BARS.includes(this.bar) ? this.bar : 'field';
975
+ }
976
+ /** SRC-35: a trigger stands in the bar's place. */
977
+ get triggered() {
978
+ return this.barForm !== 'field';
979
+ }
980
+ /** SRC-35: the trigger — the native button of a button trigger, the Button of an icon one — or null. */
981
+ get trigger() {
982
+ return this.renderRoot?.querySelector('.trigger, .trigger-icon') ?? null;
983
+ }
984
+ get triggerButton() {
985
+ return this.renderRoot?.querySelector('.trigger') ?? null;
986
+ }
987
+ /**
988
+ * Where the view opens now. SRC-27: a presentation the search does not define is drawn as docked. SRC-36: a trigger
989
+ * opens a modal view — a docked view has no input of its own — so docked with a trigger is the dialog.
990
+ */
991
+ get mode() {
992
+ if (this.presentation === 'full-screen')
993
+ return 'full-screen';
994
+ return this.presentation === 'dialog' || this.triggered ? 'dialog' : 'docked';
995
+ }
996
+ /** SRC-9, SRC-40: the view is a modal one, with a header of its own. */
997
+ get modal() {
998
+ return this.mode !== 'docked';
999
+ }
1000
+ /** SRC-27: a status the search does not define is idle. */
1001
+ get statusNow() {
1002
+ return STATUSES.includes(this.status) ? this.status : 'idle';
1003
+ }
1004
+ /** SRC-47: the status row is drawn. */
1005
+ get statusShown() {
1006
+ return this.statusNow === 'loading' || this.statusText !== '';
1007
+ }
1008
+ /** The view has content: a suggestion, a status row, a result, a result group, or something in the default slot (SRC-7). */
1009
+ get viewHasContent() {
1010
+ return this.suggestions.length > 0 || this.statusShown || this.entries.length > 0 || this.hasContent;
1011
+ }
1012
+ /** SRC-49: the results in view order, across groups — a linked group heading counts as one, a title does not. */
1013
+ get rows() {
1014
+ return this.entries.flatMap((entry) => (entry instanceof TanreiSearchResultGroup ? [...(entry.linked ? [entry] : []), ...entry.results] : [entry]));
1015
+ }
1016
+ /** The input focus belongs to now: the header's while a modal view is open, else the bar's. */
1017
+ get currentInput() {
1018
+ return this.modal && this.expanded && !this.inert_ ? (this.headerInput ?? this.barInput) : this.barInput;
1019
+ }
1020
+ /**
1021
+ * Sends focus to the input it belongs to now: the header's while a modal view (dialog or full-screen) is open, the
1022
+ * bar's while the view is docked or closed — and, while the bar is a button or an icon and the view is closed, to
1023
+ * that trigger, as the platform's own delegation does. It opens and closes nothing (SRC-5), and a disabled search
1024
+ * takes no focus (SRC-25). This is how the product's own content in the view (SRC-46) gives focus back when it
1025
+ * removes the element that held it, as the search's own clear button does (SRC-10): behind an open modal view the
1026
+ * platform's delegation alone would land on the dialog, where nothing can be typed.
1027
+ */
1028
+ focus(options) {
1029
+ const input = this.inert_ ? null : this.currentInput;
1030
+ if (input)
1031
+ input.focus(options);
1032
+ else
1033
+ super.focus(options);
1034
+ }
1035
+ /** The form it belongs to, if any. */
1036
+ get form() {
1037
+ return this.internals.form;
1038
+ }
1039
+ formResetCallback() {
1040
+ this.value = this.getAttribute('value') ?? '';
1041
+ }
1042
+ formStateRestoreCallback(state) {
1043
+ this.value = state ?? '';
1044
+ }
1045
+ formDisabledCallback(disabled) {
1046
+ takeFormDisabled(this, disabled, (value) => (this.formDisabled = value));
1047
+ }
1048
+ /** The suggestions, the results and the result groups (children), and whether anything else is the view's content. */
1049
+ readChildren(records) {
1050
+ // SRC-43: a result's excerpt is its child content; the one observer tells each result whose content changed.
1051
+ if (records) {
1052
+ const touched = new Set();
1053
+ for (const record of records) {
1054
+ const element = record.target instanceof Element ? record.target : record.target.parentElement;
1055
+ const row = element?.closest(`${RESULT}, ${RESULT_GROUP}`);
1056
+ if (row instanceof TanreiSearchRow)
1057
+ touched.add(row);
1058
+ }
1059
+ for (const row of touched)
1060
+ row.requestUpdate();
1061
+ }
1062
+ const suggestions = [...this.children].filter((child) => child instanceof TanreiSearchSuggestion);
1063
+ const changed = suggestions.length !== this.suggestions.length || suggestions.some((s, i) => s !== this.suggestions[i]);
1064
+ // SRC-14: a change of the suggestions leaves none active.
1065
+ if (changed) {
1066
+ this.suggestions = suggestions;
1067
+ this.active = -1;
1068
+ }
1069
+ const entries = [...this.children].filter((child) => child instanceof TanreiSearchResult || child instanceof TanreiSearchResultGroup);
1070
+ if (entries.length !== this.entries.length || entries.some((entry, i) => entry !== this.entries[i]))
1071
+ this.entries = entries;
1072
+ // SRC-46: the results stand after the status row and before the product's own content, whatever the children's order.
1073
+ for (const entry of entries)
1074
+ if (entry.slot !== RESULT_SLOT)
1075
+ entry.slot = RESULT_SLOT;
1076
+ const content = [...this.childNodes].some((node) => node instanceof Element
1077
+ ? node.localName !== SUGGESTION && node.localName !== RESULT && node.localName !== RESULT_GROUP && !node.getAttribute('slot')
1078
+ : node.nodeType === Node.TEXT_NODE && !!node.textContent?.trim());
1079
+ if (content !== this.hasContent)
1080
+ this.hasContent = content;
1081
+ // SRC-16, SRC-42: the leading icon column is kept in every row of the view while any suggestion or result has an icon.
1082
+ const rows = this.entries.flatMap((entry) => (entry instanceof TanreiSearchResultGroup ? [entry, ...entry.results] : [entry]));
1083
+ const icons = suggestions.some((s) => !!s.leadingIcon) || rows.some((row) => !!row.leadingIcon && (!(row instanceof TanreiSearchResultGroup) || row.linked));
1084
+ if (icons !== this.iconColumn)
1085
+ this.iconColumn = icons;
1086
+ for (const row of rows)
1087
+ if (row.iconColumn !== icons)
1088
+ row.iconColumn = icons;
1089
+ this.checkSuggestions();
1090
+ this.checkResults();
1091
+ // SRC-51: the result that had focus was removed or replaced: focus goes to the input rather than out of the view.
1092
+ const focused = this.focusedResult;
1093
+ if (focused && !this.contains(focused)) {
1094
+ this.focusedResult = null;
1095
+ const active = deepActive();
1096
+ if (this.expanded && !this.inert_ && (!active || active === document.body || active === this.dialog))
1097
+ this.currentInput?.focus();
1098
+ }
1099
+ this.requestUpdate();
1100
+ }
1101
+ /** SRC-27: what a debug build reports about the results and the result groups. */
1102
+ checkResults() {
1103
+ const seen = new Set(this.suggestions.map((suggestion) => suggestion.value).filter(Boolean));
1104
+ const check = (row, what) => {
1105
+ if (!row.value)
1106
+ report(row, 'SRC-27', `the ${what} "${row.headline}" has an empty value; select cannot tell it apart`);
1107
+ else if (seen.has(row.value))
1108
+ report(row, 'SRC-27', `the value "${row.value}" of the ${what} "${row.headline}" repeats that of another suggestion, result or group; give each its own`);
1109
+ seen.add(row.value);
1110
+ };
1111
+ for (const entry of this.entries) {
1112
+ if (entry instanceof TanreiSearchResultGroup) {
1113
+ if (entry.linked)
1114
+ check(entry, 'linked group heading');
1115
+ const strangers = [...entry.children].filter((child) => child.localName.includes('-') && !(child instanceof TanreiSearchResult));
1116
+ if (strangers.length)
1117
+ report(entry, 'SRC-27', `the result group "${entry.headline}" holds <${strangers[0].localName}>; a group holds results only, and no group`);
1118
+ }
1119
+ for (const result of entry instanceof TanreiSearchResultGroup ? entry.results : [entry]) {
1120
+ if (!result.headline?.trim())
1121
+ report(result, 'SRC-27', `the result "${result.value}" has an empty headline, so it has no text and no accessible name`);
1122
+ check(result, 'result');
1123
+ }
1124
+ }
1125
+ }
1126
+ /** SRC-27: what a debug build reports about the suggestions. */
1127
+ checkSuggestions() {
1128
+ const seen = new Set();
1129
+ for (const suggestion of this.suggestions) {
1130
+ if (!suggestion.value)
1131
+ report(this, 'SRC-27', `the suggestion "${suggestion.headline}" has an empty value; select cannot tell it apart`);
1132
+ else if (seen.has(suggestion.value))
1133
+ report(this, 'SRC-27', `two suggestions share the value "${suggestion.value}"; give each its own`);
1134
+ seen.add(suggestion.value);
1135
+ if (!suggestion.headline?.trim())
1136
+ report(this, 'SRC-27', `the suggestion "${suggestion.value}" has an empty headline, so it has no text and no accessible name`);
1137
+ }
1138
+ }
1139
+ onSlotChange(event) {
1140
+ const slot = event.target;
1141
+ const elements = slot.assignedElements({ flatten: true });
1142
+ if (slot.name === 'leading')
1143
+ this.hasLeading = elements.length > 0;
1144
+ else if (slot.name === 'trailing') {
1145
+ this.trailingCount = elements.length;
1146
+ // SRC-34: another button in the same place is measured too, though nothing renders again.
1147
+ this.keepActions();
1148
+ // SRC-27: more than two trailing buttons are still laid out, and reported.
1149
+ if (elements.length > 2)
1150
+ report(this, 'SRC-27', `the trailing slot holds ${elements.length} elements; a search bar has room for two icon buttons`);
1151
+ }
1152
+ }
1153
+ // ── Opening and closing (SRC-5, SRC-6) ─────────────────────────────────────────────────────────────────
1154
+ /** SRC-5: the search opens its view — its own `expanded`, then `toggle` — once. */
1155
+ expand() {
1156
+ if (this.expanded || this.inert_)
1157
+ return;
1158
+ this.expanded = true;
1159
+ this.dispatchEvent(new CustomEvent('toggle', { detail: { expanded: true, reason: null } }));
1160
+ }
1161
+ /** SRC-6: the search closes its view with a reason, once; the value stays as it is. */
1162
+ collapse(reason) {
1163
+ if (!this.expanded || this.inert_)
1164
+ return;
1165
+ // SRC-6, SRC-49: the docked view closes under a focused result: focus goes back to the input it belongs to (which
1166
+ // does not reopen it), and Tab moves on from there as it would have.
1167
+ if (!this.modal && this.resultFocused)
1168
+ this.barInput?.focus();
1169
+ this.expanded = false;
1170
+ this.active = -1;
1171
+ this.dispatchEvent(new CustomEvent('toggle', { detail: { expanded: false, reason } }));
1172
+ }
1173
+ /** SRC-15: a suggestion was chosen: `select` with its value, then the view closes. The value is the product's to set. */
1174
+ choose(index) {
1175
+ const suggestion = this.suggestions[index];
1176
+ if (!suggestion || this.inert_)
1177
+ return;
1178
+ this.dispatchEvent(new CustomEvent('select', { detail: { value: suggestion.value } }));
1179
+ this.collapse('select');
1180
+ }
1181
+ /**
1182
+ * SRC-13: the action key: `submit`, then the view closes — unless it shows a result, a result group or a status row:
1183
+ * what the person asked for is already in front of them — then, in a form, unless cancelled, the form is submitted.
1184
+ */
1185
+ submit() {
1186
+ const proceed = this.dispatchEvent(new CustomEvent('submit', { cancelable: true, detail: { value: this.value } }));
1187
+ if (this.entries.length === 0 && !this.statusShown)
1188
+ this.collapse('submit');
1189
+ if (proceed && this.form)
1190
+ pressDefaultButton(this.form);
1191
+ }
1192
+ /** SRC-10, SRC-12: the value emptied by the person (the clear button, Escape): `input` once, never a toggle. */
1193
+ clearValue() {
1194
+ this.value = '';
1195
+ this.active = -1;
1196
+ for (const input of [this.barInput, this.headerInput])
1197
+ if (input && !(input === this.barInput ? this.barText : this.headerText).composing)
1198
+ input.value = '';
1199
+ this.dispatchEvent(new InputEvent('input', { bubbles: true, composed: true, inputType: 'deleteContentBackward' }));
1200
+ }
1201
+ /** SRC-14: the active suggestion, scrolled into view inside the view's scrolling box, and its ring's focus style (SRC-21). */
1202
+ setActive(index) {
1203
+ this.active = index;
1204
+ void this.updateComplete.then(() => {
1205
+ const row = this.renderRoot.querySelector(`#option-${index}`);
1206
+ if (!row)
1207
+ return;
1208
+ syncFocusStyle(this, row);
1209
+ const scroll = row.closest('.scroll');
1210
+ if (!scroll)
1211
+ return;
1212
+ const [box, room] = [row.getBoundingClientRect(), scroll.getBoundingClientRect()];
1213
+ const style = getComputedStyle(scroll);
1214
+ const top = room.top + (Number.parseFloat(style.paddingTop) || 0);
1215
+ const bottom = room.bottom - (Number.parseFloat(style.paddingBottom) || 0);
1216
+ if (box.top < top)
1217
+ scroll.scrollTop -= top - box.top;
1218
+ else if (box.bottom > bottom)
1219
+ scroll.scrollTop += box.bottom - bottom;
1220
+ });
1221
+ }
1222
+ /**
1223
+ * SRC-49: the keys a focused result answers. Down and Up Arrow move real focus through the results in view order,
1224
+ * across groups, staying on the last and going from the first back to the input (the last suggestion active, where
1225
+ * there is one). Typing, deleting or pasting moves focus to the input, so that the key edits the value there. Enter is
1226
+ * the browser's own activation of the link; the row only shows its press (SRC-19). Returns whether the key was taken.
1227
+ */
1228
+ onResultKeyDown(event, row) {
1229
+ const plain = !event.altKey && !event.ctrlKey && !event.metaKey;
1230
+ if (plain && !event.shiftKey && (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
1231
+ event.preventDefault();
1232
+ const rows = this.rows;
1233
+ const at = rows.indexOf(row);
1234
+ if (event.key === 'ArrowDown')
1235
+ this.focusResult(Math.min(at + 1, rows.length - 1));
1236
+ else if (at > 0)
1237
+ this.focusResult(at - 1);
1238
+ else {
1239
+ this.currentInput?.focus();
1240
+ if (this.suggestions.length > 0)
1241
+ this.setActive(this.suggestions.length - 1);
1242
+ }
1243
+ return true;
1244
+ }
1245
+ if (event.key === 'Enter') {
1246
+ const target = row.row;
1247
+ if (!event.repeat && target) {
1248
+ this.pressRow(target);
1249
+ this.rowPress.press(null);
1250
+ this.rowPress.release();
1251
+ }
1252
+ return true;
1253
+ }
1254
+ const types = plain && [...event.key].length === 1 && event.key !== ' ';
1255
+ const deletes = plain && (event.key === 'Backspace' || event.key === 'Delete');
1256
+ const pastes = (event.ctrlKey || event.metaKey) && !event.altKey && event.key.toLowerCase() === 'v';
1257
+ if (types || deletes || pastes) {
1258
+ this.currentInput?.focus();
1259
+ return true;
1260
+ }
1261
+ return false;
1262
+ }
1263
+ /** SRC-49: real focus on the result at `index` in view order (the browser scrolls it into view); none is active meanwhile. */
1264
+ focusResult(index) {
1265
+ const row = this.rows[index];
1266
+ if (!row)
1267
+ return;
1268
+ this.active = -1;
1269
+ row.focus();
1270
+ }
1271
+ /** Whether focus is in a result's row now. */
1272
+ get resultFocused() {
1273
+ const root = deepActive()?.getRootNode();
1274
+ return root instanceof ShadowRoot && root.host instanceof TanreiSearchRow && this.contains(root.host);
1275
+ }
1276
+ listen(on) {
1277
+ if (on === this.listening)
1278
+ return;
1279
+ this.listening = on;
1280
+ if (on)
1281
+ document.addEventListener('pointerdown', this.onOutsidePress, true);
1282
+ else
1283
+ document.removeEventListener('pointerdown', this.onOutsidePress, true);
1284
+ }
1285
+ // ── The bar (SRC-5, SRC-19) ────────────────────────────────────────────────────────────────────────────
1286
+ /** Whether an event came from the bar's own elements rather than a slot's icon button or the clear button. */
1287
+ fromBar(event) {
1288
+ for (const node of event.composedPath()) {
1289
+ if (node === this.barElement)
1290
+ return true;
1291
+ if (node instanceof HTMLElement && (node.classList.contains('leading') || node.classList.contains('trailing') || node.classList.contains('clear')))
1292
+ return false;
1293
+ }
1294
+ return false;
1295
+ }
1296
+ /** SRC-40, SRC-6: a press on the dialog view's scrim — outside its container, begun and ended there — closes it. */
1297
+ outsideDialog(event) {
1298
+ const dialog = this.dialog;
1299
+ if (!dialog || event.target !== dialog || this.mode !== 'dialog')
1300
+ return false;
1301
+ const box = dialog.getBoundingClientRect();
1302
+ return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
1303
+ }
1304
+ // ── The suggestions (SRC-14 … SRC-17) ──────────────────────────────────────────────────────────────────
1305
+ /** The row that is pressed now; a new press ends the last one's at once. */
1306
+ pressRow(row) {
1307
+ if (this.pressedRow && this.pressedRow !== row)
1308
+ delete this.pressedRow.dataset.pressed;
1309
+ this.pressedRow = row;
1310
+ }
1311
+ // ── Presenting the views (SRC-7, SRC-9, SRC-23) ────────────────────────────────────────────────────────
1312
+ /** SRC-7: the docked view, placed under the bar (or above it when there is more room there), as wide as it. */
1313
+ place() {
1314
+ const view = this.view;
1315
+ const bar = this.barElement;
1316
+ if (!view || !bar || !this.viewShown)
1317
+ return;
1318
+ const style = getComputedStyle(view);
1319
+ const offset = Number.parseFloat(style.scrollMarginBlockStart) || 0;
1320
+ const margin = Number.parseFloat(style.scrollMarginBlockEnd) || 0;
1321
+ const box = bar.getBoundingClientRect();
1322
+ view.style.inlineSize = `${box.width}px`;
1323
+ // The on-screen keyboard: the part of the layout viewport the visual viewport no longer covers.
1324
+ const visual = window.visualViewport;
1325
+ const height = Math.min(document.documentElement.clientHeight, visual ? visual.offsetTop + visual.height : Number.POSITIVE_INFINITY);
1326
+ const at = placeMenu({
1327
+ anchor: box,
1328
+ // SRC-14: measured capped, so following the bar never loses the active suggestion.
1329
+ surface: { width: box.width, height: naturalHeight(view, view.querySelector('.scroll')) },
1330
+ viewport: { width: document.documentElement.clientWidth, height },
1331
+ placement: 'bottom-start',
1332
+ offset,
1333
+ margin,
1334
+ rtl: false,
1335
+ });
1336
+ view.style.top = `${at.top}px`;
1337
+ view.style.left = `${box.left}px`;
1338
+ view.style.maxBlockSize = `${at.maxHeight}px`;
1339
+ view.classList.toggle('side-top', at.side === 'top');
1340
+ }
1341
+ stopFollowing() {
1342
+ this.following.stop();
1343
+ this.lastLayout = '';
1344
+ }
1345
+ /** SRC-7, SRC-23: the docked view is drawn while expanded, docked and holding content; it grows in and fades out. */
1346
+ syncView() {
1347
+ const view = this.view;
1348
+ if (!view)
1349
+ return;
1350
+ const wanted = this.expanded && !this.inert_ && !this.modal && this.viewHasContent;
1351
+ view.classList.toggle('inline', wanted && this.inline);
1352
+ // SRC-6: a view that is fading out holds nothing Tab could stop at.
1353
+ view.inert = !wanted && !this.inline;
1354
+ if (this.inline) {
1355
+ this.stopFollowing();
1356
+ this.viewShown = false;
1357
+ if (view.matches(':popover-open'))
1358
+ view.hidePopover();
1359
+ return;
1360
+ }
1361
+ if (wanted && !this.viewShown) {
1362
+ view.classList.remove('leaving');
1363
+ if (!view.matches(':popover-open'))
1364
+ view.showPopover();
1365
+ this.viewShown = true;
1366
+ this.place();
1367
+ this.following.start();
1368
+ view.classList.remove('entering');
1369
+ void view.offsetWidth; // restart the animation
1370
+ view.classList.add('entering');
1371
+ }
1372
+ else if (!wanted && this.viewShown) {
1373
+ this.viewShown = false;
1374
+ this.stopFollowing();
1375
+ view.classList.remove('entering');
1376
+ view.classList.add('leaving');
1377
+ const finish = () => {
1378
+ if (this.viewShown || !view.classList.contains('leaving'))
1379
+ return;
1380
+ view.classList.remove('leaving');
1381
+ if (view.matches(':popover-open'))
1382
+ view.hidePopover();
1383
+ };
1384
+ const running = view.getAnimations();
1385
+ if (running.length === 0)
1386
+ finish();
1387
+ else
1388
+ void Promise.allSettled(running.map((animation) => animation.finished)).then(finish);
1389
+ }
1390
+ }
1391
+ /** SRC-9: modal over the whole window, the page held, focus to the header's input with the caret at the end. */
1392
+ presentFull() {
1393
+ const dialog = this.dialog;
1394
+ if (!dialog || this.fullShown || !this.isConnected)
1395
+ return;
1396
+ if (!dialog.open)
1397
+ dialog.showModal();
1398
+ this.fullShown = true;
1399
+ modalLayer.add(this);
1400
+ holdPageScroll(this, true);
1401
+ window.visualViewport?.addEventListener('resize', this.onViewport);
1402
+ this.onViewport();
1403
+ const input = this.headerInput;
1404
+ if (input) {
1405
+ input.focus();
1406
+ const end = input.value.length;
1407
+ input.setSelectionRange(end, end);
1408
+ }
1409
+ }
1410
+ /** SRC-9: out of the top layer (fading), the page given back, focus back to the bar's input — which does not reopen it. */
1411
+ withdrawFull(restoreFocus = true) {
1412
+ const dialog = this.dialog;
1413
+ if (!this.fullShown)
1414
+ return;
1415
+ this.fullShown = false;
1416
+ modalLayer.delete(this);
1417
+ holdPageScroll(this, false);
1418
+ window.visualViewport?.removeEventListener('resize', this.onViewport);
1419
+ const active = deepActive();
1420
+ const inside = !!active && (dialog?.contains(active) || focusWithin(this) || active === document.body);
1421
+ if (dialog?.open)
1422
+ dialog.close();
1423
+ // SRC-9, SRC-40: focus back to the bar's input — which does not reopen it — or to the trigger.
1424
+ if (restoreFocus && inside && !this.inert_)
1425
+ (this.triggered ? this.trigger : this.barInput)?.focus();
1426
+ }
1427
+ syncFull() {
1428
+ const dialog = this.dialog;
1429
+ if (!dialog)
1430
+ return;
1431
+ const wanted = this.expanded && !this.inert_ && this.modal;
1432
+ dialog.classList.toggle('inline', this.inline);
1433
+ if (this.inline) {
1434
+ if (this.fullShown)
1435
+ this.withdrawFull(false);
1436
+ // Drawn in place, the view is marked open and takes no focus of its own (`show()` would run the dialog's
1437
+ // focusing steps, in a view the page drew and nobody opened): the input keeps it where the person's act put it.
1438
+ if (wanted && !dialog.open)
1439
+ dialog.open = true;
1440
+ else if (!wanted && dialog.open)
1441
+ dialog.open = false;
1442
+ return;
1443
+ }
1444
+ if (wanted)
1445
+ this.presentFull();
1446
+ else
1447
+ this.withdrawFull();
1448
+ }
1449
+ // ── Updates ────────────────────────────────────────────────────────────────────────────────────────────
1450
+ willUpdate(changed) {
1451
+ // SRC-27: an unknown presentation is drawn as docked, an unknown bar as the field and an unknown status as idle, and reported.
1452
+ if (changed.has('presentation') && !PRESENTATIONS.includes(this.presentation)) {
1453
+ report(this, 'SRC-27', `presentation "${this.presentation}" is not a value the search defines; it is drawn as "docked"`);
1454
+ }
1455
+ if (changed.has('bar') && !BARS.includes(this.bar))
1456
+ report(this, 'SRC-27', `bar "${this.bar}" is not a value the search defines; it is drawn as "field"`);
1457
+ if (changed.has('status') && !STATUSES.includes(this.status))
1458
+ report(this, 'SRC-27', `status "${this.status}" is not a value the search defines; it is read as "idle"`);
1459
+ if (this.active >= this.suggestions.length || !this.expanded)
1460
+ this.active = -1;
1461
+ // SRC-44: a group stands group.gap below whatever stands above it in the view and above whatever follows it; two
1462
+ // groups that follow each other stand one gap apart.
1463
+ let above = (this.expanded && !this.inert_ && this.suggestions.length > 0) || this.statusShown;
1464
+ this.entries.forEach((entry, index) => {
1465
+ if (entry instanceof TanreiSearchResultGroup) {
1466
+ const next = this.entries[index + 1];
1467
+ const [before, after] = [above, next ? !(next instanceof TanreiSearchResultGroup) : this.hasContent];
1468
+ if (entry.gapBefore !== before)
1469
+ entry.gapBefore = before;
1470
+ if (entry.gapAfter !== after)
1471
+ entry.gapAfter = after;
1472
+ }
1473
+ above = true;
1474
+ });
1475
+ }
1476
+ /**
1477
+ * SRC-38, SRC-39: the one `keydown` listener on the window, held only while the search is connected, enabled and told
1478
+ * to bind exactly one chord that no search shown before it has bound.
1479
+ * @internal
1480
+ */
1481
+ syncShortcut() {
1482
+ const chords = chordsOf(this.shortcut);
1483
+ let next = null;
1484
+ WAITING.delete(this);
1485
+ if (this.isConnected && this.bindShortcut && !this.inert_) {
1486
+ if (chords.length !== 1) {
1487
+ report(this, 'SRC-39', chords.length ? `bindShortcut is set and shortcut holds ${chords.length} chords; a sequence is not bound, so the search listens for nothing` : 'bindShortcut is set and shortcut is empty, so the search listens for nothing');
1488
+ }
1489
+ else {
1490
+ next = readBinding(chords[0]);
1491
+ const owner = next ? BOUND.get(next.id) : undefined;
1492
+ if (!next)
1493
+ report(this, 'SRC-39', `the chord "${chords[0]}" is not modifiers and one key; the search listens for nothing`);
1494
+ else if (owner && owner !== this) {
1495
+ report(this, 'SRC-39', `another search shown before this one binds the chord "${chords[0]}"; this one binds nothing`);
1496
+ WAITING.add(this);
1497
+ next = null;
1498
+ }
1499
+ }
1500
+ }
1501
+ if ((next?.id ?? null) === (this.binding?.id ?? null))
1502
+ return;
1503
+ if (this.binding) {
1504
+ BOUND.delete(this.binding.id);
1505
+ window.removeEventListener('keydown', this.onWindowKeyDown);
1506
+ this.binding = null;
1507
+ // The chord is free: a search that waited for it takes it.
1508
+ for (const waiting of [...WAITING])
1509
+ waiting.syncShortcut();
1510
+ }
1511
+ if (next) {
1512
+ BOUND.set(next.id, this);
1513
+ window.addEventListener('keydown', this.onWindowKeyDown);
1514
+ this.binding = next;
1515
+ }
1516
+ }
1517
+ /**
1518
+ * SRC-38, KBS-2: whose keyboard the chord is read for — the one the hint is written for: the nearest ancestor's
1519
+ * `data-tanrei-keyboard-convention` (the search's own included), else the platform's.
1520
+ */
1521
+ get convention() {
1522
+ return ambientConvention(this.renderRoot.firstElementChild ?? this) ?? platformConvention();
1523
+ }
1524
+ /**
1525
+ * SRC-36, SRC-37: what the trigger or the bar's input carries for assistive technology besides its name — the
1526
+ * shortcut as `aria-keyshortcuts`, in the form the keyboard shortcut it draws gives (KBS-12), and for a trigger that
1527
+ * it opens a dialog and whether that is open. An icon trigger is a Tanrei Button: they go on its native button.
1528
+ */
1529
+ expose() {
1530
+ const drawn = this.renderRoot.querySelector('tanrei-keyboard-shortcut');
1531
+ const keys = drawn?.ariaKeyShortcuts ?? null;
1532
+ const form = this.barForm;
1533
+ if (form !== 'icon') {
1534
+ const target = form === 'button' ? this.triggerButton : this.barInput;
1535
+ if (target)
1536
+ hostAria(target, { 'aria-keyshortcuts': keys });
1537
+ return;
1538
+ }
1539
+ const button = this.trigger;
1540
+ const expanded = String(this.expanded && !this.inert_);
1541
+ void button?.updateComplete?.then(() => {
1542
+ const native = button.shadowRoot?.querySelector('button');
1543
+ if (native)
1544
+ hostAria(native, { 'aria-haspopup': 'dialog', 'aria-expanded': expanded, 'aria-keyshortcuts': keys });
1545
+ });
1546
+ }
1547
+ updated(changed) {
1548
+ // TXF-4: never written into a composition; a value set meanwhile waits for its end.
1549
+ this.barText.show();
1550
+ this.headerText.show();
1551
+ // Disabled, it submits nothing: said here too, since its attribute waits a frame where it holds focus.
1552
+ this.internals.setFormValue(this.disabled ? null : this.value, this.value);
1553
+ this.syncView();
1554
+ this.syncFull();
1555
+ this.listen(this.expanded && !this.inert_ && !this.modal && !this.inline);
1556
+ this.keepActions();
1557
+ this.syncShortcut();
1558
+ this.expose();
1559
+ // SRC-32: the results' leading glyphs are marked for the icon set that is active now (a design system was switched).
1560
+ if (changed.size === 0)
1561
+ for (const row of this.rows)
1562
+ row.markIcon();
1563
+ // SRC-36: a docked view has no input of its own, so a trigger opens the dialog view instead.
1564
+ if (this.expanded && this.triggered && this.presentation !== 'dialog' && this.presentation !== 'full-screen') {
1565
+ report(this, 'SRC-36', `presentation "${this.presentation}" with a trigger (bar "${this.barForm}") has no input to type in; the view opens as "dialog"`);
1566
+ }
1567
+ // SRC-27, SRC-10, SRC-11: what a debug build reports.
1568
+ if (changed.has('label') && !this.label.trim())
1569
+ report(this, 'SRC-27', 'label is empty, so the search field has no accessible name; give it a label');
1570
+ if (this.clearShown && this.words.lacks('clearLabel', this.clearLabel))
1571
+ report(this, 'SRC-10', 'clearLabel is empty, so the clear button has no accessible name; give it one in the product’s language');
1572
+ if (this.modal && this.expanded && !this.inert_ && this.words.lacks('backLabel', this.backLabel))
1573
+ report(this, 'SRC-11', 'backLabel is empty, so the back button has no accessible name; give it one in the product’s language');
1574
+ }
1575
+ get clearShown() {
1576
+ return this.value !== '' && !this.inert_;
1577
+ }
1578
+ /** SRC-34: the bar's action buttons in reading order — the clear button while it is shown, then the trailing slot's elements. */
1579
+ keepActions() {
1580
+ const bar = this.renderRoot.querySelector('.bar');
1581
+ const clear = bar?.querySelector(':scope > .clear') ?? null;
1582
+ const trailing = bar?.querySelector('slot[name="trailing"]')?.assignedElements({ flatten: true }) ?? [];
1583
+ this.kept.set([...(clear ? [clear] : []), ...trailing.filter((element) => element instanceof HTMLElement)]);
1584
+ }
1585
+ /**
1586
+ * SRC-4, TXF-24: typed text is laid out by its own direction (`dir="auto"`) once it has a letter to tell it by; an
1587
+ * empty or letterless value keeps the layout's direction, so the caret and the placeholder stand at the bar's start
1588
+ * edge (an empty `dir="auto"` input is left to right in every layout).
1589
+ */
1590
+ /** SRC-24: the input's semantics — a search field named by label; a combobox while its view shows the suggestions. */
1591
+ renderInput(place, listed) {
1592
+ const activeId = listed && this.active >= 0 ? `option-${this.active}` : undefined;
1593
+ return html `<input
1594
+ part="input"
1595
+ class="input"
1596
+ type="search"
1597
+ enterkeyhint="search"
1598
+ dir=${/\p{L}/u.test(this.value) ? 'auto' : nothing}
1599
+ autocomplete="off"
1600
+ role=${listed ? 'combobox' : nothing}
1601
+ aria-autocomplete=${listed ? 'list' : nothing}
1602
+ aria-expanded=${listed ? 'true' : nothing}
1603
+ aria-controls=${listed ? 'listbox' : nothing}
1604
+ aria-activedescendant=${ifDefined(activeId)}
1605
+ aria-label=${ifDefined(this.label || undefined)}
1606
+ .placeholder=${this.placeholder}
1607
+ ?disabled=${this.inert_}
1608
+ @input=${this.onInput}
1609
+ @keydown=${this.onInputKeyDown}
1610
+ @focus=${this.onInputFocus}
1611
+ @pointerdown=${this.onInputPointerDown}
1612
+ @compositionstart=${place === 'bar' ? this.barText.onCompositionStart : this.headerText.onCompositionStart}
1613
+ @compositionend=${place === 'bar' ? this.barText.onCompositionEnd : this.headerText.onCompositionEnd}
1614
+ />`;
1615
+ }
1616
+ /** SRC-10: an icon-only text Button showing close, small in the bar and medium in the header. */
1617
+ renderClear(size) {
1618
+ return this.clearShown ? html `<tanrei-button class="clear" variant="text" size=${size} label=${this.words.get('clearLabel', this.clearLabel)} @click=${this.onClear}><span slot="icon" class="button-glyph"><span class="ink">${CLOSE_GLYPH}</span></span></tanrei-button>` : nothing;
1619
+ }
1620
+ /**
1621
+ * SRC-7, SRC-9, SRC-16, SRC-24, SRC-29, SRC-46: what a view holds, from top to bottom — the suggestions' listbox, the
1622
+ * status row, the results and result groups, then the product's content; a part that is absent takes no room.
1623
+ *
1624
+ * SRC-47, SRC-48: the status row's two live regions exist from the moment the view opens — the polite one holds
1625
+ * statusText while idle, the assertive one while the query failed; while loading both are empty, so nothing is
1626
+ * announced, and the loading indicator, named by statusText, stands in the text's place. SRC-50: the results are links
1627
+ * in one list named by label, outside the listbox, marked busy while loading.
1628
+ */
1629
+ renderBody(listed) {
1630
+ const icons = this.iconColumn;
1631
+ const status = this.statusNow;
1632
+ const label = this.label || undefined;
1633
+ return html `<div class=${this.viewHasContent ? 'scroll' : 'scroll empty'}>
1634
+ ${listed
1635
+ ? html `<div part="listbox" class="listbox" id="listbox" role="listbox" aria-label=${ifDefined(this.label || undefined)}>
1636
+ ${this.suggestions.map((s, i) => html `<div
1637
+ class="option"
1638
+ id="option-${i}"
1639
+ role="option"
1640
+ aria-selected=${i === this.active ? 'true' : 'false'}
1641
+ aria-labelledby="headline-${i}"
1642
+ aria-describedby=${ifDefined(s.supportingText ? `supporting-${i}` : undefined)}
1643
+ data-index=${i}
1644
+ ?data-active=${i === this.active}
1645
+ data-tanrei-shape
1646
+ @pointerdown=${this.onRowPointerDown}
1647
+ @pointerup=${this.rowPress.release}
1648
+ @pointercancel=${this.rowPress.release}
1649
+ @pointerleave=${this.rowPress.release}
1650
+ @click=${this.onRowClick}
1651
+ >
1652
+ ${icons ? html `<span class="option-icon ${s.leadingIcon ? '' : 'empty'}" aria-hidden="true">${s.leadingIcon}</span>` : nothing}
1653
+ <span class="text">
1654
+ <span class="headline" id="headline-${i}">${s.headline}</span>
1655
+ ${s.supportingText ? html `<span class="supporting" id="supporting-${i}">${s.supportingText}</span>` : nothing}
1656
+ </span>
1657
+ </div>`)}
1658
+ </div>`
1659
+ : nothing}
1660
+ <div part="status" class=${status === 'error' ? 'status error' : 'status'} ?data-shown=${this.statusShown}>
1661
+ ${status === 'loading' ? html `<tanrei-loading-indicator class="spinner" size="small" label=${this.statusText}></tanrei-loading-indicator>` : nothing}<span class="said" role="status"
1662
+ >${status === 'idle' ? this.statusText : ''}</span
1663
+ ><span class="said" role="alert">${status === 'error' ? this.statusText : ''}</span>
1664
+ </div>
1665
+ <div part="results" class="results" role="list" aria-label=${ifDefined(label)} aria-busy=${status === 'loading' ? 'true' : nothing} ?hidden=${this.entries.length === 0}>
1666
+ <slot name=${RESULT_SLOT}></slot>
1667
+ </div>
1668
+ <div class="content" ?hidden=${!this.hasContent}><slot></slot></div>
1669
+ </div>`;
1670
+ }
1671
+ /** SRC-37: the hint — the keyboard shortcut, hosted (KBS-13): its plain form (a line of text, no cap), small, the ambient convention, faded with the search. */
1672
+ renderHint(hidden) {
1673
+ const keys = chordsOf(this.shortcut);
1674
+ return keys.length
1675
+ ? html `<tanrei-keyboard-shortcut class="hint" .keys=${keys} .hosted=${true} variant="plain" size="small" ?disabled=${this.inert_} ?hidden=${hidden}></tanrei-keyboard-shortcut>`
1676
+ : nothing;
1677
+ }
1678
+ /**
1679
+ * SRC-35, SRC-36: what stands in the bar's place while bar is button or icon — one button that opens a modal view.
1680
+ * As a button: the bar's container at the trigger's height, holding the search glyph, the placeholder (or the label)
1681
+ * and the hint. As an icon: an icon-only text Button showing the search glyph, from the Button's own tokens, and no
1682
+ * drawn hint (its keys are still exposed).
1683
+ */
1684
+ renderTrigger(open, hidden) {
1685
+ const label = this.label || undefined;
1686
+ if (this.barForm === 'icon') {
1687
+ return html `<tanrei-button class="trigger-icon" variant="text" label=${ifDefined(label)} ?disabled=${this.inert_} ?hidden=${hidden} @click=${this.onTriggerClick}
1688
+ ><span slot="icon" class="button-glyph"><span class="ink">${SEARCH_GLYPH}</span></span></tanrei-button
1689
+ >${this.renderHint(true)}`;
1690
+ }
1691
+ return html `<button
1692
+ part="container"
1693
+ class="trigger"
1694
+ type="button"
1695
+ data-tanrei-shape
1696
+ aria-label=${ifDefined(label)}
1697
+ aria-haspopup="dialog"
1698
+ aria-expanded=${open ? 'true' : 'false'}
1699
+ ?disabled=${this.inert_}
1700
+ ?hidden=${hidden}
1701
+ @click=${this.onTriggerClick}
1702
+ @focus=${this.onTriggerFocus}
1703
+ @pointerdown=${this.barPress.onPointerDown}
1704
+ @pointerup=${this.barPress.release}
1705
+ @pointercancel=${this.barPress.release}
1706
+ @pointerleave=${this.barPress.release}
1707
+ @keydown=${this.barPress.onKeyDown}
1708
+ @keyup=${this.barPress.onKeyUp}
1709
+ @blur=${this.barPress.onBlur}
1710
+ >
1711
+ <span class="outline" aria-hidden="true"></span>
1712
+ <span class="hold" aria-hidden="true"></span>
1713
+ <span class="glyph" aria-hidden="true"><span class="ink">${SEARCH_GLYPH}</span></span>
1714
+ <span class="trigger-text" dir=${ownDirection(this.placeholder || this.label)} aria-hidden="true">${this.placeholder || this.label}</span>
1715
+ ${this.renderHint(false)}
1716
+ </button>`;
1717
+ }
1718
+ render() {
1719
+ const open = this.expanded && !this.inert_;
1720
+ const mode = this.mode;
1721
+ const modal = mode !== 'docked';
1722
+ const hung = mode === 'dialog';
1723
+ const listed = open && this.suggestions.length > 0;
1724
+ const endButton = this.clearShown || this.trailingCount > 0;
1725
+ const body = this.renderBody(listed);
1726
+ // The <dialog> is never a Tab stop of its own view: Firefox reports `tabIndex` 0 for it, so the focus trap would
1727
+ // count it as the first one (SRC-9, SRC-49). `tabindex="-1"` says what every other engine assumes.
1728
+ // For tests and documentation, a modal view drawn in place stands for the window: what opened it is not drawn.
1729
+ const covered = this.inline && modal && open;
1730
+ const glyph = html `<span class="glyph" aria-hidden="true"><span class="ink">${SEARCH_GLYPH}</span></span>`;
1731
+ return html `
1732
+ ${this.triggered
1733
+ ? this.renderTrigger(open, covered)
1734
+ : html `<div
1735
+ part="container"
1736
+ class="bar"
1737
+ data-tanrei-shape
1738
+ ?data-leading=${this.hasLeading}
1739
+ ?data-end-button=${endButton}
1740
+ ?hidden=${covered}
1741
+ @pointerdown=${this.onBarPointerDown}
1742
+ @pointerup=${this.barPress.release}
1743
+ @pointercancel=${this.barPress.release}
1744
+ @pointerleave=${this.barPress.release}
1745
+ @mousedown=${this.onBarMouseDown}
1746
+ @click=${this.onBarClick}
1747
+ >
1748
+ <span class="outline" aria-hidden="true"></span>
1749
+ <span class="hold" aria-hidden="true"></span>
1750
+ <span class="leading" ?hidden=${!this.hasLeading}><slot name="leading" @slotchange=${this.onSlotChange}></slot></span>
1751
+ ${this.hasLeading ? nothing : glyph} ${this.renderInput('bar', listed && !modal)} ${this.renderHint(this.value !== '')} ${this.renderClear('small')}
1752
+ <span class="trailing" ?hidden=${this.trailingCount === 0}><slot name="trailing" @slotchange=${this.onSlotChange}></slot></span>
1753
+ </div>`}
1754
+ <div part="view" class="view" data-tanrei-shape popover=${this.inline ? nothing : 'manual'} role="none" @mousedown=${this.onViewMouseDown}>${modal ? nothing : body}</div>
1755
+ ${hung && covered ? html `<div class="scrim" @click=${this.onScrimClick}></div>` : nothing}
1756
+ <dialog
1757
+ part="dialog"
1758
+ class=${hung ? 'full hung' : 'full'}
1759
+ ?data-tanrei-shape=${hung}
1760
+ tabindex="-1"
1761
+ aria-label=${ifDefined(this.label || undefined)}
1762
+ @cancel=${this.onNativeCancel}
1763
+ @mousedown=${this.onViewMouseDown}
1764
+ @pointerdown=${this.onDialogPointerDown}
1765
+ @click=${this.onDialogClick}
1766
+ >
1767
+ ${modal
1768
+ ? html `<div class="header" ?data-end-button=${this.clearShown}>
1769
+ <tanrei-button
1770
+ class="back"
1771
+ variant="text"
1772
+ label=${this.words.get('backLabel', this.backLabel)}
1773
+ aria-hidden=${
1774
+ // SRC-11: in a view that is not open the button is in no one's reach, and a name it lacks is not
1775
+ // missed yet — the search reports it when the view opens, as its own (the Button reports none for a
1776
+ // button its host keeps from assistive technology, BTN-16).
1777
+ ifDefined(this.expanded ? undefined : 'true')}
1778
+ @click=${this.onBack}
1779
+ ><span slot="icon" class="button-glyph"><span class="ink">${BACK_GLYPH}</span></span></tanrei-button
1780
+ >
1781
+ ${this.renderInput('header', listed)} ${this.renderClear('medium')}
1782
+ </div>
1783
+ ${hung && !this.viewHasContent ? nothing : html `<div class="divider" aria-hidden="true"></div>`} ${body}`
1784
+ : nothing}
1785
+ </dialog>
1786
+ `;
1787
+ }
1788
+ }
1789
+ if (!customElements.get(RESULT))
1790
+ customElements.define(RESULT, TanreiSearchResult);
1791
+ if (!customElements.get(RESULT_GROUP))
1792
+ customElements.define(RESULT_GROUP, TanreiSearchResultGroup);
1793
+ if (!customElements.get('tanrei-search-suggestion'))
1794
+ customElements.define('tanrei-search-suggestion', TanreiSearchSuggestion);
1795
+ // Its `disabled` attribute, written while it holds focus, waits until focus has left: a frame at most.
1796
+ disabledWaitsWhileFocused(TanreiSearch);
1797
+ // `autofocus` on it gives it focus when the page first loads too (src/primitives/autofocus.ts).
1798
+ focusedAtFirst(TanreiSearch);
1799
+ if (!customElements.get('tanrei-search'))
1800
+ customElements.define('tanrei-search', TanreiSearch);
1801
+ //# sourceMappingURL=search.js.map