@punica/components 0.0.0-stage → 2.1.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 (382) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/LICENSE +21 -0
  3. package/README.md +139 -2
  4. package/bin/punica-components.mjs +138 -0
  5. package/custom-elements.json +38745 -0
  6. package/dist/ai/index.d.ts +39 -0
  7. package/dist/ai/index.mjs +615 -0
  8. package/dist/ai/node.d.ts +5 -0
  9. package/dist/ai/node.mjs +625 -0
  10. package/dist/esm/chunks/chunk-25RFU6B5.js +25 -0
  11. package/dist/esm/chunks/chunk-2EK3PZFT.js +179 -0
  12. package/dist/esm/chunks/chunk-2KBDCVUH.js +20 -0
  13. package/dist/esm/chunks/chunk-2NCRRDPI.js +151 -0
  14. package/dist/esm/chunks/chunk-33GO7Z32.js +40 -0
  15. package/dist/esm/chunks/chunk-36BKRO3B.js +281 -0
  16. package/dist/esm/chunks/chunk-3DWJAU5S.js +607 -0
  17. package/dist/esm/chunks/chunk-3GOFXBR7.js +61 -0
  18. package/dist/esm/chunks/chunk-3H5QEUFO.js +21 -0
  19. package/dist/esm/chunks/chunk-3NHCLXYC.js +6 -0
  20. package/dist/esm/chunks/chunk-3NQ2RVWE.js +36 -0
  21. package/dist/esm/chunks/chunk-3SYFLID6.js +20 -0
  22. package/dist/esm/chunks/chunk-3TK5BG5K.js +322 -0
  23. package/dist/esm/chunks/chunk-3WLKVJO4.js +36 -0
  24. package/dist/esm/chunks/chunk-427DCAZS.js +49 -0
  25. package/dist/esm/chunks/chunk-4446KGJH.js +67 -0
  26. package/dist/esm/chunks/chunk-45UR4HAQ.js +128 -0
  27. package/dist/esm/chunks/chunk-46P3CPXM.js +81 -0
  28. package/dist/esm/chunks/chunk-4C3AUANN.js +271 -0
  29. package/dist/esm/chunks/chunk-4RURT4SK.js +142 -0
  30. package/dist/esm/chunks/chunk-4XJKCJQG.js +166 -0
  31. package/dist/esm/chunks/chunk-5PKJV3JP.js +61 -0
  32. package/dist/esm/chunks/chunk-5SSKNOUZ.js +141 -0
  33. package/dist/esm/chunks/chunk-5XB5CUJU.js +18 -0
  34. package/dist/esm/chunks/chunk-5XQX7D2B.js +27 -0
  35. package/dist/esm/chunks/chunk-6A5Q3TR2.js +73 -0
  36. package/dist/esm/chunks/chunk-6HE2DQS5.js +29 -0
  37. package/dist/esm/chunks/chunk-6IWDX7AR.js +32 -0
  38. package/dist/esm/chunks/chunk-6LO2ITXI.js +138 -0
  39. package/dist/esm/chunks/chunk-6NSNMUZE.js +36 -0
  40. package/dist/esm/chunks/chunk-6UQOC4YG.js +61 -0
  41. package/dist/esm/chunks/chunk-72ANEBJJ.js +138 -0
  42. package/dist/esm/chunks/chunk-7JTOYPC7.js +24 -0
  43. package/dist/esm/chunks/chunk-7O3D52ZO.js +27 -0
  44. package/dist/esm/chunks/chunk-7UN7TAOI.js +39 -0
  45. package/dist/esm/chunks/chunk-7WEISIJL.js +123 -0
  46. package/dist/esm/chunks/chunk-7YAUHJR2.js +225 -0
  47. package/dist/esm/chunks/chunk-7ZT7WUEL.js +35 -0
  48. package/dist/esm/chunks/chunk-ALU2KZWS.js +177 -0
  49. package/dist/esm/chunks/chunk-AMVMOCUW.js +81 -0
  50. package/dist/esm/chunks/chunk-APPQS53K.js +81 -0
  51. package/dist/esm/chunks/chunk-AVTATVAG.js +410 -0
  52. package/dist/esm/chunks/chunk-AZMUP33Z.js +56 -0
  53. package/dist/esm/chunks/chunk-B32J3O2V.js +21 -0
  54. package/dist/esm/chunks/chunk-B7YCX5VB.js +38 -0
  55. package/dist/esm/chunks/chunk-BBSDD7DS.js +55 -0
  56. package/dist/esm/chunks/chunk-BC657356.js +93 -0
  57. package/dist/esm/chunks/chunk-BFRWXGP4.js +44 -0
  58. package/dist/esm/chunks/chunk-BYZADSVQ.js +49 -0
  59. package/dist/esm/chunks/chunk-CDXX27FL.js +28 -0
  60. package/dist/esm/chunks/chunk-CKI34FQL.js +166 -0
  61. package/dist/esm/chunks/chunk-CNT47W5N.js +60 -0
  62. package/dist/esm/chunks/chunk-CU3RW3AS.js +515 -0
  63. package/dist/esm/chunks/chunk-CZ3R7GRW.js +73 -0
  64. package/dist/esm/chunks/chunk-DLEJ74RA.js +18 -0
  65. package/dist/esm/chunks/chunk-DPOPZQ7A.js +150 -0
  66. package/dist/esm/chunks/chunk-DYXHKPQU.js +18 -0
  67. package/dist/esm/chunks/chunk-E3XOZZSK.js +77 -0
  68. package/dist/esm/chunks/chunk-EJLQD3FS.js +89 -0
  69. package/dist/esm/chunks/chunk-ELY5HYAI.js +45 -0
  70. package/dist/esm/chunks/chunk-ELY5NJBV.js +152 -0
  71. package/dist/esm/chunks/chunk-EWIF3VBH.js +45 -0
  72. package/dist/esm/chunks/chunk-F2OASWR4.js +79 -0
  73. package/dist/esm/chunks/chunk-F4ODKLNS.js +62 -0
  74. package/dist/esm/chunks/chunk-F5HKSUTX.js +127 -0
  75. package/dist/esm/chunks/chunk-FFH6CIAJ.js +208 -0
  76. package/dist/esm/chunks/chunk-FFLBSXWE.js +21 -0
  77. package/dist/esm/chunks/chunk-FNTBMCUQ.js +184 -0
  78. package/dist/esm/chunks/chunk-FYSNICNC.js +71 -0
  79. package/dist/esm/chunks/chunk-G2QRQLP5.js +18 -0
  80. package/dist/esm/chunks/chunk-G36PG2LK.js +27 -0
  81. package/dist/esm/chunks/chunk-G5LARXMF.js +73 -0
  82. package/dist/esm/chunks/chunk-GQLNLUQX.js +42 -0
  83. package/dist/esm/chunks/chunk-GRWYCZQZ.js +73 -0
  84. package/dist/esm/chunks/chunk-GSXWSHYU.js +304 -0
  85. package/dist/esm/chunks/chunk-GVH32USX.js +48 -0
  86. package/dist/esm/chunks/chunk-GW3IYQNO.js +271 -0
  87. package/dist/esm/chunks/chunk-H4Q2HHZA.js +151 -0
  88. package/dist/esm/chunks/chunk-HDHVTBGS.js +330 -0
  89. package/dist/esm/chunks/chunk-HK6DEJO3.js +74 -0
  90. package/dist/esm/chunks/chunk-HUMTZKOD.js +114 -0
  91. package/dist/esm/chunks/chunk-HW2CN2JV.js +118 -0
  92. package/dist/esm/chunks/chunk-I6WGYC6M.js +50 -0
  93. package/dist/esm/chunks/chunk-ICGI6UOP.js +28 -0
  94. package/dist/esm/chunks/chunk-IYZKVVEX.js +285 -0
  95. package/dist/esm/chunks/chunk-J4HTWL4Q.js +34 -0
  96. package/dist/esm/chunks/chunk-J6FXZP6E.js +99 -0
  97. package/dist/esm/chunks/chunk-JTIBDZBU.js +392 -0
  98. package/dist/esm/chunks/chunk-K2OIQJ36.js +23 -0
  99. package/dist/esm/chunks/chunk-K5D5UHVI.js +99 -0
  100. package/dist/esm/chunks/chunk-K753LIJX.js +157 -0
  101. package/dist/esm/chunks/chunk-KV4Y5ZP5.js +105 -0
  102. package/dist/esm/chunks/chunk-KVWZQINH.js +44 -0
  103. package/dist/esm/chunks/chunk-LKKKFYM4.js +106 -0
  104. package/dist/esm/chunks/chunk-LKPOFLSP.js +337 -0
  105. package/dist/esm/chunks/chunk-LSDTMST7.js +6 -0
  106. package/dist/esm/chunks/chunk-LUASZ5NH.js +271 -0
  107. package/dist/esm/chunks/chunk-LUPYODQN.js +54 -0
  108. package/dist/esm/chunks/chunk-M3HQENQG.js +93 -0
  109. package/dist/esm/chunks/chunk-MCHPBSW4.js +155 -0
  110. package/dist/esm/chunks/chunk-MDEV5WIN.js +25 -0
  111. package/dist/esm/chunks/chunk-MF2ASALV.js +194 -0
  112. package/dist/esm/chunks/chunk-MIUSZNAX.js +62 -0
  113. package/dist/esm/chunks/chunk-NINGLTB2.js +194 -0
  114. package/dist/esm/chunks/chunk-NLFUTVKG.js +158 -0
  115. package/dist/esm/chunks/chunk-NNCGUKTM.js +44 -0
  116. package/dist/esm/chunks/chunk-NSCGX5GB.js +408 -0
  117. package/dist/esm/chunks/chunk-NTIMVMDT.js +51 -0
  118. package/dist/esm/chunks/chunk-OBUW2HDW.js +99 -0
  119. package/dist/esm/chunks/chunk-OKRRNW3E.js +202 -0
  120. package/dist/esm/chunks/chunk-PGWADMK3.js +198 -0
  121. package/dist/esm/chunks/chunk-PMGKVE2V.js +30 -0
  122. package/dist/esm/chunks/chunk-PMLVGWVZ.js +80 -0
  123. package/dist/esm/chunks/chunk-PXECURYJ.js +78 -0
  124. package/dist/esm/chunks/chunk-Q2766HFS.js +34 -0
  125. package/dist/esm/chunks/chunk-Q62K7757.js +22 -0
  126. package/dist/esm/chunks/chunk-Q7JNV3UN.js +192 -0
  127. package/dist/esm/chunks/chunk-QRJKBLYH.js +43 -0
  128. package/dist/esm/chunks/chunk-QRZWLIUQ.js +551 -0
  129. package/dist/esm/chunks/chunk-RKF3ZNBC.js +25 -0
  130. package/dist/esm/chunks/chunk-RMJM6NWT.js +58 -0
  131. package/dist/esm/chunks/chunk-ROTG34TD.js +81 -0
  132. package/dist/esm/chunks/chunk-RQ2NYS2W.js +51 -0
  133. package/dist/esm/chunks/chunk-RX5HOB7L.js +187 -0
  134. package/dist/esm/chunks/chunk-RYOY6CGB.js +174 -0
  135. package/dist/esm/chunks/chunk-S2P6I4PF.js +191 -0
  136. package/dist/esm/chunks/chunk-SCSGRIQM.js +27 -0
  137. package/dist/esm/chunks/chunk-SENDWPHS.js +115 -0
  138. package/dist/esm/chunks/chunk-SFY6NIVM.js +106 -0
  139. package/dist/esm/chunks/chunk-SHEACXCO.js +67 -0
  140. package/dist/esm/chunks/chunk-SII4GAN2.js +302 -0
  141. package/dist/esm/chunks/chunk-SIUUXS2M.js +172 -0
  142. package/dist/esm/chunks/chunk-SLXOGLX4.js +39 -0
  143. package/dist/esm/chunks/chunk-ST7UASSS.js +43 -0
  144. package/dist/esm/chunks/chunk-SUNHM3W2.js +211 -0
  145. package/dist/esm/chunks/chunk-SWTIN4AS.js +43 -0
  146. package/dist/esm/chunks/chunk-T2FH4DTZ.js +163 -0
  147. package/dist/esm/chunks/chunk-TK5H2DLW.js +157 -0
  148. package/dist/esm/chunks/chunk-U3SSEG6P.js +31 -0
  149. package/dist/esm/chunks/chunk-UNQEQ3F2.js +118 -0
  150. package/dist/esm/chunks/chunk-UP3ZQ5S6.js +155 -0
  151. package/dist/esm/chunks/chunk-UQFS4FAE.js +80 -0
  152. package/dist/esm/chunks/chunk-UZXXUKV6.js +124 -0
  153. package/dist/esm/chunks/chunk-VF4NHXZG.js +33 -0
  154. package/dist/esm/chunks/chunk-VIGFMBQW.js +337 -0
  155. package/dist/esm/chunks/chunk-VJBXT6L2.js +86 -0
  156. package/dist/esm/chunks/chunk-VM4IKZDR.js +211 -0
  157. package/dist/esm/chunks/chunk-VPCWI2SH.js +18 -0
  158. package/dist/esm/chunks/chunk-VR225VA6.js +29 -0
  159. package/dist/esm/chunks/chunk-WEGQW4SS.js +285 -0
  160. package/dist/esm/chunks/chunk-WHXEETCS.js +80 -0
  161. package/dist/esm/chunks/chunk-X2XT4SYI.js +71 -0
  162. package/dist/esm/chunks/chunk-X6Y3S66P.js +91 -0
  163. package/dist/esm/chunks/chunk-XBFOPEHZ.js +86 -0
  164. package/dist/esm/chunks/chunk-XE74KQOC.js +18 -0
  165. package/dist/esm/chunks/chunk-XNMQ4SC7.js +95 -0
  166. package/dist/esm/chunks/chunk-XWPDELI6.js +53 -0
  167. package/dist/esm/chunks/chunk-XWZPKK2I.js +6 -0
  168. package/dist/esm/chunks/chunk-XZSAOJUV.js +83 -0
  169. package/dist/esm/chunks/chunk-Y5BQXWLM.js +58 -0
  170. package/dist/esm/chunks/chunk-Y5HOTHVK.js +22 -0
  171. package/dist/esm/chunks/chunk-Y7B65FYJ.js +336 -0
  172. package/dist/esm/chunks/chunk-YIAEOUGS.js +46 -0
  173. package/dist/esm/chunks/chunk-YKL6MAIV.js +208 -0
  174. package/dist/esm/chunks/chunk-YPH3G6P7.js +125 -0
  175. package/dist/esm/chunks/chunk-YSGWORUD.js +36 -0
  176. package/dist/esm/chunks/chunk-ZB7DQSJK.js +204 -0
  177. package/dist/esm/chunks/chunk-ZC7JPIL7.js +182 -0
  178. package/dist/esm/chunks/chunk-ZGBBW7U4.js +35 -0
  179. package/dist/esm/chunks/chunk-ZIQREEEI.js +210 -0
  180. package/dist/esm/chunks/chunk-ZJ3UIJ46.js +30 -0
  181. package/dist/esm/chunks/chunk-ZK6JTE6K.js +826 -0
  182. package/dist/esm/chunks/chunk-ZPIJWNFB.js +150 -0
  183. package/dist/esm/chunks/chunk-ZQVI42RW.js +136 -0
  184. package/dist/esm/chunks/chunk-ZWP6KATC.js +25 -0
  185. package/dist/esm/chunks/chunk-ZY5YHMTQ.js +88 -0
  186. package/dist/esm/components/accordion/accordion.js +8 -0
  187. package/dist/esm/components/accordion/accordionGroup.js +7 -0
  188. package/dist/esm/components/agenda/agenda.js +9 -0
  189. package/dist/esm/components/alert/alert.js +8 -0
  190. package/dist/esm/components/alertDialog/alertDialog.js +14 -0
  191. package/dist/esm/components/appBar/appBar.js +7 -0
  192. package/dist/esm/components/appShell/appShell.js +11 -0
  193. package/dist/esm/components/aspectRatio/aspectRatio.js +7 -0
  194. package/dist/esm/components/autocomplete/autocomplete.js +14 -0
  195. package/dist/esm/components/avatar/avatar.js +7 -0
  196. package/dist/esm/components/avatarGroup/avatarGroup.js +11 -0
  197. package/dist/esm/components/badge/badge.js +7 -0
  198. package/dist/esm/components/banner/banner.js +9 -0
  199. package/dist/esm/components/blockquote/blockquote.js +7 -0
  200. package/dist/esm/components/bottomSheet/bottomSheet.js +9 -0
  201. package/dist/esm/components/box/box.js +7 -0
  202. package/dist/esm/components/breadcrumbs/breadcrumbItem.js +8 -0
  203. package/dist/esm/components/breadcrumbs/breadcrumbs.js +11 -0
  204. package/dist/esm/components/button/button.js +8 -0
  205. package/dist/esm/components/buttonGroup/buttonGroup.js +7 -0
  206. package/dist/esm/components/calendar/calendar.js +12 -0
  207. package/dist/esm/components/calendar/dates.js +44 -0
  208. package/dist/esm/components/card/card.js +7 -0
  209. package/dist/esm/components/card/cardActions.js +7 -0
  210. package/dist/esm/components/card/cardContent.js +7 -0
  211. package/dist/esm/components/card/cardHeader.js +7 -0
  212. package/dist/esm/components/card/cardMedia.js +7 -0
  213. package/dist/esm/components/carousel/carousel.js +9 -0
  214. package/dist/esm/components/carousel/carouselItem.js +7 -0
  215. package/dist/esm/components/center/center.js +7 -0
  216. package/dist/esm/components/chat/chatComposer.js +9 -0
  217. package/dist/esm/components/chat/chatDictationButton.js +8 -0
  218. package/dist/esm/components/chat/chatLayout.js +9 -0
  219. package/dist/esm/components/chat/chatMessage.js +9 -0
  220. package/dist/esm/components/chat/chatMessageBubble.js +7 -0
  221. package/dist/esm/components/chat/chatMessageList.js +8 -0
  222. package/dist/esm/components/chat/chatMessageMetadata.js +7 -0
  223. package/dist/esm/components/chat/chatSystemMessage.js +7 -0
  224. package/dist/esm/components/chat/chatToolCall.js +9 -0
  225. package/dist/esm/components/chat/chatToolCalls.js +8 -0
  226. package/dist/esm/components/chat/slots.js +6 -0
  227. package/dist/esm/components/checkbox/checkbox.js +9 -0
  228. package/dist/esm/components/checkboxGroup/checkboxGroup.js +10 -0
  229. package/dist/esm/components/chip/chip.js +8 -0
  230. package/dist/esm/components/citation/citation.js +11 -0
  231. package/dist/esm/components/code/code.js +7 -0
  232. package/dist/esm/components/codeBlock/codeBlock.js +8 -0
  233. package/dist/esm/components/collapsible/collapsible.js +7 -0
  234. package/dist/esm/components/commandPalette/commandGroup.js +7 -0
  235. package/dist/esm/components/commandPalette/commandItem.js +7 -0
  236. package/dist/esm/components/commandPalette/commandPalette.js +10 -0
  237. package/dist/esm/components/complexSelector/complexOption.js +9 -0
  238. package/dist/esm/components/complexSelector/complexSelector.js +16 -0
  239. package/dist/esm/components/complexSelector/optionGroup.js +7 -0
  240. package/dist/esm/components/container/container.js +7 -0
  241. package/dist/esm/components/contextMenu/contextMenu.js +12 -0
  242. package/dist/esm/components/datePicker/datePicker.js +15 -0
  243. package/dist/esm/components/dateRangeInput/dateRangeInput.js +15 -0
  244. package/dist/esm/components/dateTimeInput/dateTimeInput.js +18 -0
  245. package/dist/esm/components/dialog/dialog.js +11 -0
  246. package/dist/esm/components/dialog/dialogContent.js +7 -0
  247. package/dist/esm/components/dialog/dialogFooter.js +7 -0
  248. package/dist/esm/components/dialog/dialogHeader.js +7 -0
  249. package/dist/esm/components/dialog/modalSurface.js +8 -0
  250. package/dist/esm/components/divider/divider.js +7 -0
  251. package/dist/esm/components/drawer/drawer.js +10 -0
  252. package/dist/esm/components/emptyState/emptyState.js +7 -0
  253. package/dist/esm/components/field/field.js +7 -0
  254. package/dist/esm/components/fileInput/fileInput.js +9 -0
  255. package/dist/esm/components/formLayout/formLayout.js +7 -0
  256. package/dist/esm/components/grid/col.js +7 -0
  257. package/dist/esm/components/grid/row.js +7 -0
  258. package/dist/esm/components/heading/heading.js +7 -0
  259. package/dist/esm/components/hidden/hidden.js +7 -0
  260. package/dist/esm/components/hoverCard/hoverCard.js +9 -0
  261. package/dist/esm/components/icon/icon.js +8 -0
  262. package/dist/esm/components/iconButton/iconButton.js +8 -0
  263. package/dist/esm/components/infoTip/infoTip.js +10 -0
  264. package/dist/esm/components/input/input.js +9 -0
  265. package/dist/esm/components/inputGroup/inputGroup.js +9 -0
  266. package/dist/esm/components/inputGroup/inputGroupText.js +7 -0
  267. package/dist/esm/components/kbd/kbd.js +7 -0
  268. package/dist/esm/components/lightbox/lightbox.js +10 -0
  269. package/dist/esm/components/link/link.js +8 -0
  270. package/dist/esm/components/listView/list.js +7 -0
  271. package/dist/esm/components/listView/listItem.js +7 -0
  272. package/dist/esm/components/listbox/listbox.js +9 -0
  273. package/dist/esm/components/listbox/listboxItem.js +8 -0
  274. package/dist/esm/components/markdown/markdown.js +9 -0
  275. package/dist/esm/components/markdown/parser.js +9 -0
  276. package/dist/esm/components/markdown/url.js +6 -0
  277. package/dist/esm/components/menu/menu.js +11 -0
  278. package/dist/esm/components/menu/menuCheckboxItem.js +9 -0
  279. package/dist/esm/components/menu/menuDivider.js +7 -0
  280. package/dist/esm/components/menu/menuGroup.js +7 -0
  281. package/dist/esm/components/menu/menuItem.js +8 -0
  282. package/dist/esm/components/menu/menuRadioGroup.js +7 -0
  283. package/dist/esm/components/menu/menuRadioItem.js +9 -0
  284. package/dist/esm/components/metadataList/metadataList.js +9 -0
  285. package/dist/esm/components/metadataList/metadataListItem.js +8 -0
  286. package/dist/esm/components/mobileNav/mobileNav.js +10 -0
  287. package/dist/esm/components/numberInput/numberInput.js +9 -0
  288. package/dist/esm/components/outline/outline.js +8 -0
  289. package/dist/esm/components/overflowList/overflowList.js +11 -0
  290. package/dist/esm/components/pagination/pagination.js +8 -0
  291. package/dist/esm/components/paper/paper.js +7 -0
  292. package/dist/esm/components/popover/popover.js +9 -0
  293. package/dist/esm/components/powerSearch/powerSearch.js +14 -0
  294. package/dist/esm/components/progressBar/progressBar.js +7 -0
  295. package/dist/esm/components/qrCode/qrCode.js +9 -0
  296. package/dist/esm/components/radio/radio.js +7 -0
  297. package/dist/esm/components/radio/radioGroup.js +10 -0
  298. package/dist/esm/components/scrollArea/scrollArea.js +8 -0
  299. package/dist/esm/components/section/section.js +8 -0
  300. package/dist/esm/components/segmentedControl/segmentedControl.js +12 -0
  301. package/dist/esm/components/segmentedControl/segmentedControlItem.js +7 -0
  302. package/dist/esm/components/select/field.js +18 -0
  303. package/dist/esm/components/select/option.js +8 -0
  304. package/dist/esm/components/select/select.js +14 -0
  305. package/dist/esm/components/selectableCard/selectableCard.js +9 -0
  306. package/dist/esm/components/selectableCard/selectableCardGroup.js +13 -0
  307. package/dist/esm/components/sideNav/sideNav.js +9 -0
  308. package/dist/esm/components/sideNav/sideNavItem.js +9 -0
  309. package/dist/esm/components/sideNav/sideNavSection.js +8 -0
  310. package/dist/esm/components/skeleton/skeleton.js +7 -0
  311. package/dist/esm/components/slider/slider.js +9 -0
  312. package/dist/esm/components/spinner/spinner.js +7 -0
  313. package/dist/esm/components/split/split.js +8 -0
  314. package/dist/esm/components/splitButton/splitButton.js +12 -0
  315. package/dist/esm/components/stack/stack.js +7 -0
  316. package/dist/esm/components/statusDot/statusDot.js +7 -0
  317. package/dist/esm/components/stepper/step.js +8 -0
  318. package/dist/esm/components/stepper/stepper.js +7 -0
  319. package/dist/esm/components/switch/switch.js +8 -0
  320. package/dist/esm/components/tab/tab.js +7 -0
  321. package/dist/esm/components/tab/tabPanel.js +7 -0
  322. package/dist/esm/components/tab/tabs.js +8 -0
  323. package/dist/esm/components/table/table.js +7 -0
  324. package/dist/esm/components/table/tableBody.js +7 -0
  325. package/dist/esm/components/table/tableCell.js +7 -0
  326. package/dist/esm/components/table/tableFooter.js +7 -0
  327. package/dist/esm/components/table/tableHeader.js +7 -0
  328. package/dist/esm/components/table/tableHeaderCell.js +8 -0
  329. package/dist/esm/components/table/tableRow.js +7 -0
  330. package/dist/esm/components/table/tableSelectionToolbar.js +8 -0
  331. package/dist/esm/components/text/text.js +7 -0
  332. package/dist/esm/components/textarea/textarea.js +8 -0
  333. package/dist/esm/components/thumbnail/thumbnail.js +8 -0
  334. package/dist/esm/components/timePicker/timePicker.js +15 -0
  335. package/dist/esm/components/timer/timer.js +7 -0
  336. package/dist/esm/components/timestamp/timestamp.js +7 -0
  337. package/dist/esm/components/toast/toast.js +8 -0
  338. package/dist/esm/components/toast/toaster.js +12 -0
  339. package/dist/esm/components/toggleButton/toggleButton.js +8 -0
  340. package/dist/esm/components/toggleButtonGroup/toggleButtonGroup.js +10 -0
  341. package/dist/esm/components/tokenizer/tokenizer.js +14 -0
  342. package/dist/esm/components/toolbar/toolbar.js +8 -0
  343. package/dist/esm/components/tooltip/tooltip.js +9 -0
  344. package/dist/esm/components/topNav/topNav.js +11 -0
  345. package/dist/esm/components/topNav/topNavItem.js +11 -0
  346. package/dist/esm/components/topNav/topNavMegaMenu.js +7 -0
  347. package/dist/esm/components/topNav/topNavMegaMenuCard.js +8 -0
  348. package/dist/esm/components/topNav/topNavMegaMenuGroup.js +7 -0
  349. package/dist/esm/components/topNav/topNavMegaMenuItem.js +7 -0
  350. package/dist/esm/components/tree/tree.js +8 -0
  351. package/dist/esm/components/tree/treeItem.js +8 -0
  352. package/dist/esm/components/virtualList/virtualList.js +7 -0
  353. package/dist/esm/components/virtualTable/virtualTable.js +9 -0
  354. package/dist/esm/components/visuallyHidden/visuallyHidden.js +7 -0
  355. package/dist/esm/core/a11y.js +22 -0
  356. package/dist/esm/core/element.js +14 -0
  357. package/dist/esm/core/form.js +6 -0
  358. package/dist/esm/core/overlay.js +8 -0
  359. package/dist/esm/index.js +779 -0
  360. package/dist/llms-full.txt +8890 -0
  361. package/dist/llms.txt +275 -0
  362. package/dist/punica-components.min.js +14283 -0
  363. package/dist/tokens.css +158 -0
  364. package/dist/types/index.d.ts +6753 -0
  365. package/dist/types/react.d.ts +1914 -0
  366. package/dist/vscode.css-custom-data.json +3892 -0
  367. package/dist/vscode.html-custom-data.json +6912 -0
  368. package/dist/web-types.json +12404 -0
  369. package/docs/MIGRATION-2.0.md +112 -0
  370. package/docs/contract.md +130 -0
  371. package/docs/migration/chat.md +309 -0
  372. package/docs/migration/content.md +806 -0
  373. package/docs/migration/data.md +140 -0
  374. package/docs/migration/display.md +625 -0
  375. package/docs/migration/form-basic.md +262 -0
  376. package/docs/migration/navigation.md +368 -0
  377. package/docs/migration/overlays.md +261 -0
  378. package/docs/migration/pickers.md +194 -0
  379. package/package.json +131 -4
  380. package/scripts/codemod-2.0.mjs +50 -0
  381. package/scripts/codemod-rules.mjs +102 -0
  382. package/skills/punica-components/SKILL.md +48 -0
@@ -0,0 +1,27 @@
1
+ import {
2
+ PunicaElement,
3
+ define
4
+ } from "./chunk-Y7B65FYJ.js";
5
+
6
+ // src/components/table/tableHeader.css
7
+ var tableHeader_default = ":host {\n display: table-header-group;\n}\n";
8
+
9
+ // src/components/table/tableHeader.js
10
+ var PunicaTableHeader = class extends PunicaElement {
11
+ static styles = tableHeader_default;
12
+ static template = `<slot></slot>`;
13
+ constructor() {
14
+ super();
15
+ this.internals.role = "rowgroup";
16
+ this.shadowRoot.addEventListener("slotchange", () => this.#table?.refresh?.());
17
+ }
18
+ /** @returns {any} */
19
+ get #table() {
20
+ return this.closest("punica-table");
21
+ }
22
+ };
23
+ define("punica-table-header", PunicaTableHeader);
24
+
25
+ export {
26
+ PunicaTableHeader
27
+ };
@@ -0,0 +1,115 @@
1
+ import {
2
+ PunicaElement,
3
+ define
4
+ } from "./chunk-Y7B65FYJ.js";
5
+
6
+ // src/components/timestamp/timestamp.css
7
+ var timestamp_default = ":host {\n --punica-timestamp-color: inherit;\n\n display: inline;\n}\n\ntime {\n color: var(--punica-timestamp-color);\n font-variant-numeric: tabular-nums;\n}\n";
8
+
9
+ // src/components/timestamp/timestamp.js
10
+ var UNITS = (
11
+ /** @type {[Intl.RelativeTimeFormatUnit, number][]} */
12
+ [
13
+ ["year", 31536e6],
14
+ ["month", 2592e6],
15
+ ["week", 6048e5],
16
+ ["day", 864e5],
17
+ ["hour", 36e5],
18
+ ["minute", 6e4],
19
+ ["second", 1e3]
20
+ ]
21
+ );
22
+ var MAX_DELAY = 2 ** 31 - 1;
23
+ var PunicaTimestamp = class extends PunicaElement {
24
+ static properties = {
25
+ value: {},
26
+ format: { default: "datetime" },
27
+ dateStyle: { default: "medium" },
28
+ timeStyle: { default: "short" },
29
+ locale: {}
30
+ };
31
+ static styles = timestamp_default;
32
+ static template = `<time part="base"></time>`;
33
+ #time = this.$("time");
34
+ #timer = 0;
35
+ #ready = false;
36
+ /** The moment as a Date, or null while `value` names none. */
37
+ get date() {
38
+ const raw = this.value;
39
+ if (raw == null || raw.trim() === "") return null;
40
+ const ms = /^-?\d+(\.\d+)?$/.test(raw.trim()) ? Number(raw) : Date.parse(raw);
41
+ return Number.isNaN(ms) ? null : new Date(ms);
42
+ }
43
+ connected() {
44
+ if (this.#ready) this.#render();
45
+ }
46
+ disconnected() {
47
+ clearTimeout(this.#timer);
48
+ this.#timer = 0;
49
+ }
50
+ update() {
51
+ this.#ready = true;
52
+ this.#render();
53
+ }
54
+ get #language() {
55
+ const tag = this.locale || this.closest("[lang]")?.lang || navigator.language;
56
+ try {
57
+ return Intl.getCanonicalLocales(tag)[0];
58
+ } catch {
59
+ return void 0;
60
+ }
61
+ }
62
+ #render() {
63
+ clearTimeout(this.#timer);
64
+ this.#timer = 0;
65
+ const time = this.#time;
66
+ const date = this.date;
67
+ if (!date) {
68
+ time.textContent = "";
69
+ time.removeAttribute("datetime");
70
+ time.removeAttribute("title");
71
+ return;
72
+ }
73
+ const language = this.#language;
74
+ time.dateTime = date.toISOString();
75
+ time.title = new Intl.DateTimeFormat(language, { dateStyle: "full", timeStyle: "long" }).format(date);
76
+ if (this.format === "relative") {
77
+ time.textContent = this.#relative(date, language);
78
+ return;
79
+ }
80
+ const options = {};
81
+ if (this.format !== "time") options.dateStyle = /** @type {any} */
82
+ this.dateStyle;
83
+ if (this.format !== "date") options.timeStyle = /** @type {any} */
84
+ this.timeStyle;
85
+ let text;
86
+ try {
87
+ text = new Intl.DateTimeFormat(language, options).format(date);
88
+ } catch {
89
+ text = new Intl.DateTimeFormat(language).format(date);
90
+ }
91
+ time.textContent = text;
92
+ }
93
+ /**
94
+ * Writes the distance from now and arms the timer for the moment the
95
+ * wording changes.
96
+ * @param {Date} date
97
+ * @param {string | undefined} language
98
+ */
99
+ #relative(date, language) {
100
+ const diff = date.getTime() - Date.now();
101
+ const abs = Math.abs(diff);
102
+ const [unit, size] = UNITS.find(([, ms]) => abs >= ms) || UNITS[UNITS.length - 1];
103
+ const text = new Intl.RelativeTimeFormat(language, { numeric: "auto" }).format(Math.trunc(diff / size), unit);
104
+ if (this.isConnected) {
105
+ const next = diff <= 0 ? size - abs % size : abs % size + 1;
106
+ this.#timer = setTimeout(() => this.#render(), Math.min(Math.max(next, 250), MAX_DELAY));
107
+ }
108
+ return text;
109
+ }
110
+ };
111
+ define("punica-timestamp", PunicaTimestamp);
112
+
113
+ export {
114
+ PunicaTimestamp
115
+ };
@@ -0,0 +1,106 @@
1
+ import {
2
+ dialog_default
3
+ } from "./chunk-3NHCLXYC.js";
4
+ import {
5
+ ModalSurface
6
+ } from "./chunk-FFH6CIAJ.js";
7
+ import {
8
+ PunicaElement,
9
+ define
10
+ } from "./chunk-Y7B65FYJ.js";
11
+
12
+ // src/components/alertDialog/alertDialog.css
13
+ var alertDialog_default = "/* Layered over the dialog's own stylesheet (dialog.css): the surface, the\n backdrop and the motion are the dialog's; this file lays out the panel. */\n:host {\n --punica-alert-dialog-width: 400px;\n --punica-dialog-width: var(--punica-alert-dialog-width);\n}\n\n.panel {\n display: flex;\n flex-direction: column;\n gap: var(--punica-space-12);\n}\n\n.heading {\n margin: 0;\n color: var(--punica-color-text);\n font-family: var(--punica-font-family);\n font-size: var(--punica-font-size-lg);\n font-weight: var(--punica-font-weight-semi-bold);\n line-height: var(--punica-line-height-heading);\n}\n\n.description {\n min-block-size: 0;\n overflow: auto;\n overscroll-behavior: contain;\n color: var(--punica-color-text-muted);\n font-family: var(--punica-font-family);\n font-size: var(--punica-font-size-sm);\n line-height: var(--punica-line-height);\n}\n\n::slotted(p) {\n margin-block: 0 var(--punica-space-8);\n}\n::slotted(p:last-child) {\n margin-block-end: 0;\n}\n\n.actions {\n display: flex;\n flex-wrap: wrap;\n justify-content: flex-end;\n gap: var(--punica-space-8);\n margin-block-start: var(--punica-space-12);\n}\n\n/* On a phone the confirming action sits above Cancel and both fill the row;\n Cancel still takes focus first. */\n@media (max-width: 600px) {\n .actions {\n flex-direction: column-reverse;\n align-items: stretch;\n }\n}\n";
14
+
15
+ // src/components/alertDialog/alertDialog.js
16
+ var PunicaAlertDialog = class extends ModalSurface(PunicaElement) {
17
+ static properties = {
18
+ heading: {},
19
+ confirmLabel: { default: "Confirm" },
20
+ cancelLabel: { default: "Cancel" },
21
+ color: {},
22
+ loading: { type: Boolean }
23
+ };
24
+ static styles = [dialog_default, alertDialog_default];
25
+ static template = `
26
+ <dialog part="dialog" role="alertdialog" aria-describedby="description">
27
+ <div part="panel" class="panel">
28
+ <h2 part="heading" class="heading" id="heading"></h2>
29
+ <div part="description" class="description" id="description"><slot></slot></div>
30
+ <div part="actions" class="actions">
31
+ <punica-button part="cancel-button" class="cancel" variant="outlined" color="neutral"></punica-button>
32
+ <punica-button part="confirm-button" class="confirm"></punica-button>
33
+ </div>
34
+ </div>
35
+ </dialog>
36
+ `;
37
+ #heading = this.$(".heading");
38
+ #cancel = this.$(".cancel");
39
+ #confirm = this.$(".confirm");
40
+ constructor() {
41
+ super();
42
+ this.#cancel.addEventListener("click", () => this.requestClose("cancel", "cancel"));
43
+ this.#confirm.addEventListener("click", () => {
44
+ if (!this.loading) this.requestClose("confirm", "confirm");
45
+ });
46
+ }
47
+ get labelSources() {
48
+ return this.#heading.textContent.trim() ? [this.#heading] : [];
49
+ }
50
+ /** The backdrop never closes an alert dialog: the user must choose. */
51
+ isBackdropHit() {
52
+ return false;
53
+ }
54
+ /**
55
+ * Opens the dialog and waits for the user's answer.
56
+ * @returns {Promise<boolean>} true when the user confirmed; false on cancel, Escape or any other close
57
+ */
58
+ ask() {
59
+ return new Promise((resolve) => {
60
+ const onClose = (event) => {
61
+ if (event.target !== this) return;
62
+ this.removeEventListener("punica-close", onClose);
63
+ resolve(event.detail?.reason === "confirm");
64
+ };
65
+ this.addEventListener("punica-close", onClose);
66
+ this.show();
67
+ });
68
+ }
69
+ update(changed) {
70
+ this.#heading.textContent = this.heading ?? "";
71
+ this.#heading.hidden = !this.heading;
72
+ this.#cancel.textContent = this.cancelLabel ?? "";
73
+ this.#confirm.textContent = this.confirmLabel ?? "";
74
+ if (this.color) this.#confirm.setAttribute("color", this.color);
75
+ else this.#confirm.removeAttribute("color");
76
+ this.#confirm.loading = this.loading;
77
+ super.update(changed);
78
+ }
79
+ surfaceOpened() {
80
+ this.#cancel.focus({ preventScroll: true });
81
+ }
82
+ };
83
+ define("punica-alert-dialog", PunicaAlertDialog);
84
+ async function confirm(options = {}) {
85
+ const el = (
86
+ /** @type {PunicaAlertDialog} */
87
+ document.createElement("punica-alert-dialog")
88
+ );
89
+ if (options.heading != null) el.heading = String(options.heading);
90
+ if (options.message != null) el.textContent = String(options.message);
91
+ if (options.confirmLabel != null) el.confirmLabel = String(options.confirmLabel);
92
+ if (options.cancelLabel != null) el.cancelLabel = String(options.cancelLabel);
93
+ if (options.color != null) el.color = String(options.color);
94
+ const container = options.container || document.body;
95
+ container.appendChild(el);
96
+ try {
97
+ return await el.ask();
98
+ } finally {
99
+ el.remove();
100
+ }
101
+ }
102
+
103
+ export {
104
+ PunicaAlertDialog,
105
+ confirm
106
+ };
@@ -0,0 +1,67 @@
1
+ import {
2
+ slotHasContent
3
+ } from "./chunk-XWZPKK2I.js";
4
+ import {
5
+ icons
6
+ } from "./chunk-YSGWORUD.js";
7
+ import {
8
+ PunicaElement,
9
+ define
10
+ } from "./chunk-Y7B65FYJ.js";
11
+
12
+ // src/components/chat/chatMessage.css
13
+ var chatMessage_default = ":host {\n --punica-chat-message-surface: var(--punica-color-surface);\n --punica-chat-message-on-surface: var(--punica-color-text);\n --punica-chat-message-border: var(--punica-color-border);\n --punica-chat-message-gap: var(--punica-space-12);\n --punica-chat-message-max-width: 100%;\n\n display: flex;\n align-items: flex-start;\n gap: var(--punica-chat-message-gap);\n color: var(--punica-color-text);\n font-family: var(--punica-font-family);\n font-size: var(--punica-font-size);\n line-height: var(--punica-line-height);\n}\n\n:host([sender='user']) {\n --punica-chat-message-surface: var(--punica-color-primary);\n --punica-chat-message-on-surface: var(--punica-color-on-accent);\n --punica-chat-message-border: transparent;\n --punica-chat-message-max-width: 80%;\n\n flex-direction: row-reverse;\n}\n\n:host([sender='system']),\n:host([sender='tool']) {\n --punica-chat-message-surface: var(--punica-color-neutral-light);\n}\n\n:host([status='error']) {\n --punica-chat-message-border: var(--punica-color-error);\n}\n\n.avatar {\n display: none;\n flex: none;\n}\n\n:host(:state(has-avatar)) .avatar {\n display: block;\n}\n\n.body {\n display: flex;\n flex: 0 1 auto;\n flex-direction: column;\n align-items: flex-start;\n gap: var(--punica-space-4);\n min-inline-size: 0;\n max-inline-size: var(--punica-chat-message-max-width);\n}\n\n:host([sender='user']) .body {\n align-items: flex-end;\n}\n\n.name {\n color: var(--punica-color-text-muted);\n font-size: var(--punica-font-size-sm);\n font-weight: var(--punica-font-weight-semi-bold);\n}\n\n.content {\n display: flex;\n flex-direction: column;\n align-items: inherit;\n gap: var(--punica-space-8);\n max-inline-size: 100%;\n min-inline-size: 0;\n}\n\n.status {\n display: inline-flex;\n align-items: center;\n gap: var(--punica-space-6);\n font-size: var(--punica-font-size-sm);\n}\n\n.status[hidden],\n.name[hidden] {\n display: none;\n}\n\n.error-icon {\n display: none;\n}\n\n:host([status='error']) .status {\n color: var(--punica-color-error);\n}\n\n:host([status='error']) .error-icon {\n display: inline-flex;\n}\n\n:host([status='error']) .dots {\n display: none;\n}\n\n/* While streaming the text is for assistive technology; the dots are seen. */\n:host([status='streaming']) .status-text {\n position: absolute;\n inline-size: 1px;\n block-size: 1px;\n overflow: hidden;\n clip-path: inset(50%);\n white-space: nowrap;\n}\n\n.dots {\n display: inline-flex;\n gap: var(--punica-space-4);\n padding-block: var(--punica-space-6);\n}\n\n.dots i {\n inline-size: var(--punica-space-6);\n block-size: var(--punica-space-6);\n border-radius: var(--punica-radius-full);\n background: currentColor;\n opacity: 0.3;\n animation: pulse 1.2s ease-in-out infinite;\n}\n\n.dots i:nth-child(2) {\n animation-delay: 0.2s;\n}\n\n.dots i:nth-child(3) {\n animation-delay: 0.4s;\n}\n\n@keyframes pulse {\n 40% {\n opacity: 1;\n }\n}\n\n@media (prefers-reduced-motion: reduce) {\n .dots i {\n animation: none;\n opacity: 0.6;\n }\n}\n\n.footer {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: var(--punica-space-8);\n}\n\n:host([sender='user']) .footer {\n flex-direction: row-reverse;\n}\n\n.actions {\n display: inline-flex;\n align-items: center;\n gap: var(--punica-space-4);\n opacity: 0;\n transition: opacity var(--punica-duration-fast) var(--punica-ease);\n}\n\n:host(:hover) .actions,\n:host(:focus-within) .actions {\n opacity: 1;\n}\n\n@media (hover: none) {\n .actions {\n opacity: 1;\n }\n}\n\n@media (forced-colors: active) {\n :host([status='error']) .status {\n color: CanvasText;\n }\n}\n";
14
+
15
+ // src/components/chat/chatMessage.js
16
+ var PunicaChatMessage = class extends PunicaElement {
17
+ static properties = {
18
+ sender: { default: "assistant" },
19
+ name: {},
20
+ status: { default: "complete" },
21
+ label: {},
22
+ labelStreaming: { default: "Writing" },
23
+ labelError: { default: "Error" }
24
+ };
25
+ static styles = chatMessage_default;
26
+ static template = `
27
+ <div part="avatar" class="avatar"><slot name="avatar"></slot></div>
28
+ <div part="body" class="body">
29
+ <div part="name" class="name" hidden></div>
30
+ <div part="content" class="content"><slot></slot></div>
31
+ <div part="status" class="status" hidden>
32
+ <span class="dots" aria-hidden="true"><i></i><i></i><i></i></span>
33
+ <span class="error-icon">${icons.error}</span>
34
+ <span class="status-text"></span>
35
+ </div>
36
+ <div part="footer" class="footer">
37
+ <div part="metadata" class="metadata"><slot name="metadata"></slot></div>
38
+ <div part="actions" class="actions"><slot name="actions"></slot></div>
39
+ </div>
40
+ </div>
41
+ `;
42
+ constructor() {
43
+ super();
44
+ const avatar = this.$('slot[name="avatar"]');
45
+ avatar.addEventListener("slotchange", () => this.toggleState("has-avatar", slotHasContent(avatar)));
46
+ }
47
+ connected() {
48
+ this.internals.role = "article";
49
+ }
50
+ update() {
51
+ const streaming = this.status === "streaming";
52
+ const error = this.status === "error";
53
+ this.internals.ariaLabel = this.label || this.name || null;
54
+ this.internals.ariaBusy = streaming ? "true" : null;
55
+ const name = this.$(".name");
56
+ name.textContent = this.name || "";
57
+ name.hidden = !this.name;
58
+ const status = this.$(".status");
59
+ status.hidden = !streaming && !error;
60
+ this.$(".status-text").textContent = streaming ? this.labelStreaming : error ? this.labelError : "";
61
+ }
62
+ };
63
+ define("punica-chat-message", PunicaChatMessage);
64
+
65
+ export {
66
+ PunicaChatMessage
67
+ };
@@ -0,0 +1,302 @@
1
+ import {
2
+ field_default
3
+ } from "./chunk-LSDTMST7.js";
4
+ import {
5
+ FieldSurface,
6
+ OptionNavigator,
7
+ fieldLanguage,
8
+ fieldName,
9
+ nativeMessage,
10
+ setAttr
11
+ } from "./chunk-H4Q2HHZA.js";
12
+ import {
13
+ FormControl
14
+ } from "./chunk-HW2CN2JV.js";
15
+ import {
16
+ overlayCss
17
+ } from "./chunk-FNTBMCUQ.js";
18
+ import {
19
+ icons
20
+ } from "./chunk-YSGWORUD.js";
21
+ import {
22
+ PunicaElement,
23
+ define
24
+ } from "./chunk-Y7B65FYJ.js";
25
+
26
+ // src/components/autocomplete/autocomplete.css
27
+ var autocomplete_default = ":host {\n --punica-autocomplete-radius: var(--punica-radius);\n --punica-autocomplete-height: var(--punica-size-md);\n --punica-autocomplete-padding: var(--punica-space-12);\n --punica-autocomplete-border-color: var(--punica-color-border);\n --punica-autocomplete-background: transparent;\n --punica-autocomplete-min-width: 200px;\n --punica-autocomplete-listbox-max-height: 250px;\n\n --_height: var(--punica-autocomplete-height);\n --_pad: var(--punica-autocomplete-padding);\n --_radius: var(--punica-autocomplete-radius);\n --_border: var(--punica-autocomplete-border-color);\n --_bg: var(--punica-autocomplete-background);\n --_list-max-height: var(--punica-autocomplete-listbox-max-height);\n\n display: inline-flex;\n vertical-align: middle;\n min-inline-size: var(--punica-autocomplete-min-width);\n}\n\n:host([size='small']) {\n --punica-autocomplete-height: var(--punica-size-sm);\n --punica-autocomplete-padding: var(--punica-space-8);\n}\n:host([size='large']) {\n --punica-autocomplete-height: var(--punica-size-lg);\n --punica-autocomplete-padding: var(--punica-space-16);\n}\n:host([full-width]) {\n display: flex;\n inline-size: 100%;\n}\n";
28
+
29
+ // src/components/autocomplete/autocomplete.js
30
+ var valueOf = (option) => option.optionValue ?? option.getAttribute("value") ?? option.textContent.trim();
31
+ var textOf = (option) => option.text ?? option.getAttribute("label") ?? option.textContent.trim();
32
+ var PunicaAutocomplete = class extends FormControl(PunicaElement) {
33
+ static properties = {
34
+ value: { reflect: false },
35
+ placeholder: {},
36
+ label: {},
37
+ open: { type: Boolean },
38
+ freeText: { type: Boolean },
39
+ noFilter: { type: Boolean },
40
+ clearable: { type: Boolean },
41
+ readonly: { type: Boolean },
42
+ size: {},
43
+ fullWidth: { type: Boolean },
44
+ labelClear: { default: "Clear" },
45
+ options: { type: Array, attribute: false }
46
+ };
47
+ static styles = [overlayCss, field_default, autocomplete_default];
48
+ static shadowOptions = { delegatesFocus: true };
49
+ static template = `
50
+ <div part="field" class="field">
51
+ <slot name="start"></slot>
52
+ <input part="input" class="control" type="text" role="combobox" aria-autocomplete="list" aria-haspopup="listbox" aria-controls="listbox" aria-expanded="false" autocomplete="off" autocapitalize="off" spellcheck="false">
53
+ <button part="clear" class="icon-button" type="button" hidden>${icons.close}</button>
54
+ <slot name="end"></slot>
55
+ </div>
56
+ <div part="listbox" id="listbox" class="panel listbox" role="listbox" popover="manual"><slot></slot></div>
57
+ `;
58
+ #field = this.$(".field");
59
+ #input = this.$("input");
60
+ #clear = this.$('[part="clear"]');
61
+ #listbox = this.$("#listbox");
62
+ #slot = this.$("slot:not([name])");
63
+ #surface = new FieldSurface(this, this.#listbox);
64
+ #nav = new OptionNavigator(this.#input, () => this.#rows());
65
+ /** Rows made from the `options` property. @type {any[]} */
66
+ #generated = [];
67
+ /** The array those rows were made from. @type {unknown} */
68
+ #generatedFrom = null;
69
+ /** What the user typed since the last commit; null while the text is the value's own. @type {string | null} */
70
+ #typed = null;
71
+ /** What the input's text was last written from. @type {string | null} */
72
+ #textKey = null;
73
+ #touched = false;
74
+ #reason = "api";
75
+ constructor() {
76
+ super();
77
+ const input = this.#input;
78
+ input.addEventListener("input", () => {
79
+ if (this.isDisabled || this.readonly) return;
80
+ this.#typed = input.value;
81
+ this.#nav.set(null);
82
+ this.open = true;
83
+ this.update(/* @__PURE__ */ new Map());
84
+ this.emit("input", { value: input.value });
85
+ });
86
+ input.addEventListener("keydown", (event) => this.#onKeydown(event));
87
+ this.#clear.addEventListener("click", () => {
88
+ if (this.isDisabled || this.readonly) return;
89
+ this.#commit(null);
90
+ input.focus();
91
+ });
92
+ this.#slot.addEventListener("slotchange", () => this.requestUpdate());
93
+ this.#listbox.addEventListener("mousedown", (event) => event.preventDefault());
94
+ this.#listbox.addEventListener("click", (event) => {
95
+ const option = this.#rowFrom(event);
96
+ if (option && !option.disabled) this.#pick(option);
97
+ });
98
+ this.#listbox.addEventListener("pointermove", (event) => {
99
+ const option = this.#rowFrom(event);
100
+ if (option && !option.disabled && option !== this.#nav.active) this.#nav.set(option);
101
+ });
102
+ this.shadowRoot.addEventListener("focusout", (event) => {
103
+ const next = (
104
+ /** @type {FocusEvent} */
105
+ event.relatedTarget
106
+ );
107
+ if (next instanceof Node && (this.shadowRoot.contains(next) || this.contains(next))) return;
108
+ this.#touched = true;
109
+ this.#commitText();
110
+ this.#close("blur");
111
+ this.requestUpdate();
112
+ });
113
+ }
114
+ /** Opens the list. */
115
+ show() {
116
+ this.open = true;
117
+ }
118
+ /** Closes the list. */
119
+ hide() {
120
+ this.#close("api");
121
+ }
122
+ /** Moves focus to the text input. */
123
+ focus(options) {
124
+ this.#input.focus(options);
125
+ }
126
+ connected() {
127
+ queueMicrotask(() => this.isConnected && this.update(/* @__PURE__ */ new Map()));
128
+ }
129
+ disconnected() {
130
+ this.#surface.hide();
131
+ this.#nav.set(null);
132
+ }
133
+ formReset() {
134
+ this.#touched = false;
135
+ this.#typed = null;
136
+ this.#textKey = null;
137
+ this.value = this.getAttribute("value");
138
+ this.requestUpdate();
139
+ }
140
+ formRestore(state) {
141
+ if (typeof state === "string") this.value = state;
142
+ }
143
+ /** Every row: the generated ones, then the `punica-option` children. @returns {any[]} */
144
+ #rows() {
145
+ return [...this.#generated, ...[...this.children].filter((child) => child.localName === "punica-option")];
146
+ }
147
+ #rowFrom(event) {
148
+ const rows = this.#rows();
149
+ return event.composedPath().find((node) => rows.includes(node)) || null;
150
+ }
151
+ /** The text shown for a value: its option's label, else the value itself. */
152
+ #textFor(value) {
153
+ if (value == null) return "";
154
+ const option = this.#rows().find((row) => valueOf(row) === value);
155
+ return option ? textOf(option) : value;
156
+ }
157
+ update() {
158
+ const language = fieldLanguage(this);
159
+ const input = this.#input;
160
+ const disabled = this.isDisabled;
161
+ const name = fieldName(this);
162
+ const value = this.value == null || this.value === "" ? null : this.value;
163
+ if (this.options !== this.#generatedFrom) {
164
+ this.#generatedFrom = this.options;
165
+ for (const row of this.#generated) row.remove();
166
+ this.#generated = (Array.isArray(this.options) ? this.options : []).map((item) => {
167
+ const data = typeof item === "object" && item !== null ? item : { value: String(item) };
168
+ const option = (
169
+ /** @type {any} */
170
+ document.createElement("punica-option")
171
+ );
172
+ option.setAttribute("part", "option");
173
+ option.value = String(data.value);
174
+ option.textContent = String(data.label ?? data.value);
175
+ option.disabled = !!data.disabled;
176
+ return option;
177
+ });
178
+ this.#slot.before(...this.#generated);
179
+ }
180
+ const rows = this.#rows();
181
+ const text = this.#textFor(value);
182
+ const key = `${value}|${text}`;
183
+ if (this.#typed === null && key !== this.#textKey) {
184
+ this.#textKey = key;
185
+ input.value = text;
186
+ }
187
+ const needle = (this.#typed ?? "").trim().toLocaleLowerCase(language);
188
+ let visible = 0;
189
+ for (const row of rows) {
190
+ const match = this.noFilter || !needle || textOf(row).toLocaleLowerCase(language).includes(needle);
191
+ row.hidden = !match;
192
+ row.selected = value != null && valueOf(row) === value;
193
+ if (match) visible++;
194
+ }
195
+ input.disabled = disabled;
196
+ input.readOnly = this.readonly;
197
+ input.required = this.required;
198
+ input.placeholder = this.placeholder || "";
199
+ setAttr(input, "aria-label", name);
200
+ setAttr(this.#listbox, "aria-label", name);
201
+ setAttr(this.#clear, "aria-label", this.labelClear);
202
+ this.#clear.hidden = !this.clearable || value == null || disabled || this.readonly;
203
+ this.toggleState("disabled", disabled);
204
+ this.setFormValue(value);
205
+ this.setValidity(this.required && value == null ? { valueMissing: true } : {}, nativeMessage("required"), input);
206
+ const invalid = this.#touched && !this.validity.valid;
207
+ setAttr(input, "aria-invalid", invalid ? "true" : null);
208
+ this.toggleState("user-invalid", invalid);
209
+ const want = this.open && !disabled && !this.readonly && visible > 0;
210
+ if (want && !this.#surface.open) {
211
+ this.#surface.show(this.#field, { matchWidth: true }, () => this.#close("outside"));
212
+ this.toggleState("open", true);
213
+ input.setAttribute("aria-expanded", "true");
214
+ this.emit("open");
215
+ } else if (!want && this.#surface.open) {
216
+ this.#surface.hide();
217
+ this.#nav.set(null);
218
+ this.toggleState("open", false);
219
+ input.setAttribute("aria-expanded", "false");
220
+ const reason = this.open ? "empty" : this.#reason;
221
+ this.#reason = "api";
222
+ this.emit("close", { reason });
223
+ }
224
+ if (this.#nav.active?.hidden) this.#nav.set(null);
225
+ }
226
+ /** @param {string} reason */
227
+ #close(reason) {
228
+ if (!this.open) return;
229
+ this.#reason = reason;
230
+ this.open = false;
231
+ }
232
+ /** @param {string | null} value */
233
+ #commit(value) {
234
+ const before = this.value == null || this.value === "" ? null : this.value;
235
+ this.#touched = true;
236
+ this.#typed = null;
237
+ this.#textKey = null;
238
+ this.value = value;
239
+ this.update(/* @__PURE__ */ new Map());
240
+ if (value !== before) this.emit("change", { value });
241
+ }
242
+ /** @param {any} option */
243
+ #pick(option) {
244
+ this.#commit(valueOf(option));
245
+ this.#close("select");
246
+ }
247
+ /** Takes what was typed: an option with that label, free text, or nothing. */
248
+ #commitText() {
249
+ if (this.#typed === null || this.isDisabled || this.readonly) return;
250
+ const language = fieldLanguage(this);
251
+ const text = this.#input.value.trim();
252
+ if (!text) {
253
+ this.#commit(null);
254
+ return;
255
+ }
256
+ const lower = text.toLocaleLowerCase(language);
257
+ const match = this.#rows().find((row) => !row.disabled && textOf(row).toLocaleLowerCase(language) === lower);
258
+ if (match) this.#commit(valueOf(match));
259
+ else if (this.freeText) this.#commit(text);
260
+ else this.#commit(this.value);
261
+ }
262
+ /** @param {KeyboardEvent} event */
263
+ #onKeydown(event) {
264
+ if (this.isDisabled || this.readonly) return;
265
+ const nav = this.#nav;
266
+ const showing = this.#surface.open;
267
+ if (event.key === "Enter") {
268
+ if (showing && nav.active) {
269
+ event.preventDefault();
270
+ this.#pick(nav.active);
271
+ return;
272
+ }
273
+ this.#commitText();
274
+ this.#close("select");
275
+ this.update(/* @__PURE__ */ new Map());
276
+ this.form?.requestSubmit();
277
+ } else if (event.key === "Escape") {
278
+ if (!showing) return;
279
+ event.preventDefault();
280
+ event.stopPropagation();
281
+ this.#close("escape");
282
+ } else if (event.key === "ArrowDown" || event.key === "ArrowUp") {
283
+ event.preventDefault();
284
+ if (!showing) {
285
+ this.open = true;
286
+ this.update(/* @__PURE__ */ new Map());
287
+ if (!event.altKey) nav.set(event.key === "ArrowDown" ? nav.items[0] : nav.items.at(-1) || null);
288
+ } else if (event.altKey && event.key === "ArrowUp") {
289
+ this.#close("api");
290
+ } else {
291
+ nav.move(event, { homeEnd: false });
292
+ }
293
+ } else if (showing && nav.move(event, { homeEnd: false })) {
294
+ event.preventDefault();
295
+ }
296
+ }
297
+ };
298
+ define("punica-autocomplete", PunicaAutocomplete);
299
+
300
+ export {
301
+ PunicaAutocomplete
302
+ };