@punica/components 0.0.0-stage → 2.1.1
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.
- package/CHANGELOG.md +48 -0
- package/LICENSE +21 -0
- package/README.md +139 -2
- package/bin/punica-components.mjs +138 -0
- package/custom-elements.json +38745 -0
- package/dist/ai/index.d.ts +39 -0
- package/dist/ai/index.mjs +615 -0
- package/dist/ai/node.d.ts +5 -0
- package/dist/ai/node.mjs +625 -0
- package/dist/esm/chunks/chunk-25RFU6B5.js +25 -0
- package/dist/esm/chunks/chunk-2EK3PZFT.js +179 -0
- package/dist/esm/chunks/chunk-2KBDCVUH.js +20 -0
- package/dist/esm/chunks/chunk-2NCRRDPI.js +151 -0
- package/dist/esm/chunks/chunk-33GO7Z32.js +40 -0
- package/dist/esm/chunks/chunk-36BKRO3B.js +281 -0
- package/dist/esm/chunks/chunk-3DWJAU5S.js +607 -0
- package/dist/esm/chunks/chunk-3GOFXBR7.js +61 -0
- package/dist/esm/chunks/chunk-3H5QEUFO.js +21 -0
- package/dist/esm/chunks/chunk-3NHCLXYC.js +6 -0
- package/dist/esm/chunks/chunk-3NQ2RVWE.js +36 -0
- package/dist/esm/chunks/chunk-3SYFLID6.js +20 -0
- package/dist/esm/chunks/chunk-3TK5BG5K.js +322 -0
- package/dist/esm/chunks/chunk-3WLKVJO4.js +36 -0
- package/dist/esm/chunks/chunk-427DCAZS.js +49 -0
- package/dist/esm/chunks/chunk-4446KGJH.js +67 -0
- package/dist/esm/chunks/chunk-45UR4HAQ.js +128 -0
- package/dist/esm/chunks/chunk-46P3CPXM.js +81 -0
- package/dist/esm/chunks/chunk-4C3AUANN.js +271 -0
- package/dist/esm/chunks/chunk-4RURT4SK.js +142 -0
- package/dist/esm/chunks/chunk-4XJKCJQG.js +166 -0
- package/dist/esm/chunks/chunk-5PKJV3JP.js +61 -0
- package/dist/esm/chunks/chunk-5SSKNOUZ.js +141 -0
- package/dist/esm/chunks/chunk-5XB5CUJU.js +18 -0
- package/dist/esm/chunks/chunk-5XQX7D2B.js +27 -0
- package/dist/esm/chunks/chunk-6A5Q3TR2.js +73 -0
- package/dist/esm/chunks/chunk-6HE2DQS5.js +29 -0
- package/dist/esm/chunks/chunk-6IWDX7AR.js +32 -0
- package/dist/esm/chunks/chunk-6LO2ITXI.js +138 -0
- package/dist/esm/chunks/chunk-6NSNMUZE.js +36 -0
- package/dist/esm/chunks/chunk-6UQOC4YG.js +61 -0
- package/dist/esm/chunks/chunk-72ANEBJJ.js +138 -0
- package/dist/esm/chunks/chunk-7JTOYPC7.js +24 -0
- package/dist/esm/chunks/chunk-7O3D52ZO.js +27 -0
- package/dist/esm/chunks/chunk-7UN7TAOI.js +39 -0
- package/dist/esm/chunks/chunk-7WEISIJL.js +123 -0
- package/dist/esm/chunks/chunk-7YAUHJR2.js +225 -0
- package/dist/esm/chunks/chunk-7ZT7WUEL.js +35 -0
- package/dist/esm/chunks/chunk-ALU2KZWS.js +177 -0
- package/dist/esm/chunks/chunk-AMVMOCUW.js +81 -0
- package/dist/esm/chunks/chunk-APPQS53K.js +81 -0
- package/dist/esm/chunks/chunk-AVTATVAG.js +410 -0
- package/dist/esm/chunks/chunk-AZMUP33Z.js +56 -0
- package/dist/esm/chunks/chunk-B32J3O2V.js +21 -0
- package/dist/esm/chunks/chunk-B7YCX5VB.js +38 -0
- package/dist/esm/chunks/chunk-BBSDD7DS.js +55 -0
- package/dist/esm/chunks/chunk-BC657356.js +93 -0
- package/dist/esm/chunks/chunk-BFRWXGP4.js +44 -0
- package/dist/esm/chunks/chunk-BYZADSVQ.js +49 -0
- package/dist/esm/chunks/chunk-CDXX27FL.js +28 -0
- package/dist/esm/chunks/chunk-CKI34FQL.js +166 -0
- package/dist/esm/chunks/chunk-CNT47W5N.js +60 -0
- package/dist/esm/chunks/chunk-CU3RW3AS.js +515 -0
- package/dist/esm/chunks/chunk-CZ3R7GRW.js +73 -0
- package/dist/esm/chunks/chunk-DLEJ74RA.js +18 -0
- package/dist/esm/chunks/chunk-DPOPZQ7A.js +150 -0
- package/dist/esm/chunks/chunk-DYXHKPQU.js +18 -0
- package/dist/esm/chunks/chunk-E3XOZZSK.js +77 -0
- package/dist/esm/chunks/chunk-EJLQD3FS.js +89 -0
- package/dist/esm/chunks/chunk-ELY5HYAI.js +45 -0
- package/dist/esm/chunks/chunk-ELY5NJBV.js +152 -0
- package/dist/esm/chunks/chunk-EWIF3VBH.js +45 -0
- package/dist/esm/chunks/chunk-F2OASWR4.js +79 -0
- package/dist/esm/chunks/chunk-F4ODKLNS.js +62 -0
- package/dist/esm/chunks/chunk-F5HKSUTX.js +127 -0
- package/dist/esm/chunks/chunk-FFH6CIAJ.js +208 -0
- package/dist/esm/chunks/chunk-FFLBSXWE.js +21 -0
- package/dist/esm/chunks/chunk-FNTBMCUQ.js +184 -0
- package/dist/esm/chunks/chunk-FYSNICNC.js +71 -0
- package/dist/esm/chunks/chunk-G2QRQLP5.js +18 -0
- package/dist/esm/chunks/chunk-G36PG2LK.js +27 -0
- package/dist/esm/chunks/chunk-G5LARXMF.js +73 -0
- package/dist/esm/chunks/chunk-GQLNLUQX.js +42 -0
- package/dist/esm/chunks/chunk-GRWYCZQZ.js +73 -0
- package/dist/esm/chunks/chunk-GSXWSHYU.js +304 -0
- package/dist/esm/chunks/chunk-GVH32USX.js +48 -0
- package/dist/esm/chunks/chunk-GW3IYQNO.js +271 -0
- package/dist/esm/chunks/chunk-H4Q2HHZA.js +151 -0
- package/dist/esm/chunks/chunk-HDHVTBGS.js +330 -0
- package/dist/esm/chunks/chunk-HK6DEJO3.js +74 -0
- package/dist/esm/chunks/chunk-HUMTZKOD.js +114 -0
- package/dist/esm/chunks/chunk-HW2CN2JV.js +118 -0
- package/dist/esm/chunks/chunk-I6WGYC6M.js +50 -0
- package/dist/esm/chunks/chunk-ICGI6UOP.js +28 -0
- package/dist/esm/chunks/chunk-IYZKVVEX.js +285 -0
- package/dist/esm/chunks/chunk-J4HTWL4Q.js +34 -0
- package/dist/esm/chunks/chunk-J6FXZP6E.js +99 -0
- package/dist/esm/chunks/chunk-JTIBDZBU.js +392 -0
- package/dist/esm/chunks/chunk-K2OIQJ36.js +23 -0
- package/dist/esm/chunks/chunk-K5D5UHVI.js +99 -0
- package/dist/esm/chunks/chunk-K753LIJX.js +157 -0
- package/dist/esm/chunks/chunk-KV4Y5ZP5.js +105 -0
- package/dist/esm/chunks/chunk-KVWZQINH.js +44 -0
- package/dist/esm/chunks/chunk-LKKKFYM4.js +106 -0
- package/dist/esm/chunks/chunk-LKPOFLSP.js +337 -0
- package/dist/esm/chunks/chunk-LSDTMST7.js +6 -0
- package/dist/esm/chunks/chunk-LUASZ5NH.js +271 -0
- package/dist/esm/chunks/chunk-LUPYODQN.js +54 -0
- package/dist/esm/chunks/chunk-M3HQENQG.js +93 -0
- package/dist/esm/chunks/chunk-MCHPBSW4.js +155 -0
- package/dist/esm/chunks/chunk-MDEV5WIN.js +25 -0
- package/dist/esm/chunks/chunk-MF2ASALV.js +194 -0
- package/dist/esm/chunks/chunk-MIUSZNAX.js +62 -0
- package/dist/esm/chunks/chunk-NINGLTB2.js +194 -0
- package/dist/esm/chunks/chunk-NLFUTVKG.js +158 -0
- package/dist/esm/chunks/chunk-NNCGUKTM.js +44 -0
- package/dist/esm/chunks/chunk-NSCGX5GB.js +408 -0
- package/dist/esm/chunks/chunk-NTIMVMDT.js +51 -0
- package/dist/esm/chunks/chunk-OBUW2HDW.js +99 -0
- package/dist/esm/chunks/chunk-OKRRNW3E.js +202 -0
- package/dist/esm/chunks/chunk-PGWADMK3.js +198 -0
- package/dist/esm/chunks/chunk-PMGKVE2V.js +30 -0
- package/dist/esm/chunks/chunk-PMLVGWVZ.js +80 -0
- package/dist/esm/chunks/chunk-PXECURYJ.js +78 -0
- package/dist/esm/chunks/chunk-Q2766HFS.js +34 -0
- package/dist/esm/chunks/chunk-Q62K7757.js +22 -0
- package/dist/esm/chunks/chunk-Q7JNV3UN.js +192 -0
- package/dist/esm/chunks/chunk-QRJKBLYH.js +43 -0
- package/dist/esm/chunks/chunk-QRZWLIUQ.js +551 -0
- package/dist/esm/chunks/chunk-RKF3ZNBC.js +25 -0
- package/dist/esm/chunks/chunk-RMJM6NWT.js +58 -0
- package/dist/esm/chunks/chunk-ROTG34TD.js +81 -0
- package/dist/esm/chunks/chunk-RQ2NYS2W.js +51 -0
- package/dist/esm/chunks/chunk-RX5HOB7L.js +187 -0
- package/dist/esm/chunks/chunk-RYOY6CGB.js +174 -0
- package/dist/esm/chunks/chunk-S2P6I4PF.js +191 -0
- package/dist/esm/chunks/chunk-SCSGRIQM.js +27 -0
- package/dist/esm/chunks/chunk-SENDWPHS.js +115 -0
- package/dist/esm/chunks/chunk-SFY6NIVM.js +106 -0
- package/dist/esm/chunks/chunk-SHEACXCO.js +67 -0
- package/dist/esm/chunks/chunk-SII4GAN2.js +302 -0
- package/dist/esm/chunks/chunk-SIUUXS2M.js +172 -0
- package/dist/esm/chunks/chunk-SLXOGLX4.js +39 -0
- package/dist/esm/chunks/chunk-ST7UASSS.js +43 -0
- package/dist/esm/chunks/chunk-SUNHM3W2.js +211 -0
- package/dist/esm/chunks/chunk-SWTIN4AS.js +43 -0
- package/dist/esm/chunks/chunk-T2FH4DTZ.js +163 -0
- package/dist/esm/chunks/chunk-TK5H2DLW.js +157 -0
- package/dist/esm/chunks/chunk-U3SSEG6P.js +31 -0
- package/dist/esm/chunks/chunk-UNQEQ3F2.js +118 -0
- package/dist/esm/chunks/chunk-UP3ZQ5S6.js +155 -0
- package/dist/esm/chunks/chunk-UQFS4FAE.js +80 -0
- package/dist/esm/chunks/chunk-UZXXUKV6.js +124 -0
- package/dist/esm/chunks/chunk-VF4NHXZG.js +33 -0
- package/dist/esm/chunks/chunk-VIGFMBQW.js +337 -0
- package/dist/esm/chunks/chunk-VJBXT6L2.js +86 -0
- package/dist/esm/chunks/chunk-VM4IKZDR.js +211 -0
- package/dist/esm/chunks/chunk-VPCWI2SH.js +18 -0
- package/dist/esm/chunks/chunk-VR225VA6.js +29 -0
- package/dist/esm/chunks/chunk-WEGQW4SS.js +285 -0
- package/dist/esm/chunks/chunk-WHXEETCS.js +80 -0
- package/dist/esm/chunks/chunk-X2XT4SYI.js +71 -0
- package/dist/esm/chunks/chunk-X6Y3S66P.js +91 -0
- package/dist/esm/chunks/chunk-XBFOPEHZ.js +86 -0
- package/dist/esm/chunks/chunk-XE74KQOC.js +18 -0
- package/dist/esm/chunks/chunk-XNMQ4SC7.js +95 -0
- package/dist/esm/chunks/chunk-XWPDELI6.js +53 -0
- package/dist/esm/chunks/chunk-XWZPKK2I.js +6 -0
- package/dist/esm/chunks/chunk-XZSAOJUV.js +83 -0
- package/dist/esm/chunks/chunk-Y5BQXWLM.js +58 -0
- package/dist/esm/chunks/chunk-Y5HOTHVK.js +22 -0
- package/dist/esm/chunks/chunk-Y7B65FYJ.js +336 -0
- package/dist/esm/chunks/chunk-YIAEOUGS.js +46 -0
- package/dist/esm/chunks/chunk-YKL6MAIV.js +208 -0
- package/dist/esm/chunks/chunk-YPH3G6P7.js +125 -0
- package/dist/esm/chunks/chunk-YSGWORUD.js +36 -0
- package/dist/esm/chunks/chunk-ZB7DQSJK.js +204 -0
- package/dist/esm/chunks/chunk-ZC7JPIL7.js +182 -0
- package/dist/esm/chunks/chunk-ZGBBW7U4.js +35 -0
- package/dist/esm/chunks/chunk-ZIQREEEI.js +210 -0
- package/dist/esm/chunks/chunk-ZJ3UIJ46.js +30 -0
- package/dist/esm/chunks/chunk-ZK6JTE6K.js +826 -0
- package/dist/esm/chunks/chunk-ZPIJWNFB.js +150 -0
- package/dist/esm/chunks/chunk-ZQVI42RW.js +136 -0
- package/dist/esm/chunks/chunk-ZWP6KATC.js +25 -0
- package/dist/esm/chunks/chunk-ZY5YHMTQ.js +88 -0
- package/dist/esm/components/accordion/accordion.js +8 -0
- package/dist/esm/components/accordion/accordionGroup.js +7 -0
- package/dist/esm/components/agenda/agenda.js +9 -0
- package/dist/esm/components/alert/alert.js +8 -0
- package/dist/esm/components/alertDialog/alertDialog.js +14 -0
- package/dist/esm/components/appBar/appBar.js +7 -0
- package/dist/esm/components/appShell/appShell.js +11 -0
- package/dist/esm/components/aspectRatio/aspectRatio.js +7 -0
- package/dist/esm/components/autocomplete/autocomplete.js +14 -0
- package/dist/esm/components/avatar/avatar.js +7 -0
- package/dist/esm/components/avatarGroup/avatarGroup.js +11 -0
- package/dist/esm/components/badge/badge.js +7 -0
- package/dist/esm/components/banner/banner.js +9 -0
- package/dist/esm/components/blockquote/blockquote.js +7 -0
- package/dist/esm/components/bottomSheet/bottomSheet.js +9 -0
- package/dist/esm/components/box/box.js +7 -0
- package/dist/esm/components/breadcrumbs/breadcrumbItem.js +8 -0
- package/dist/esm/components/breadcrumbs/breadcrumbs.js +11 -0
- package/dist/esm/components/button/button.js +8 -0
- package/dist/esm/components/buttonGroup/buttonGroup.js +7 -0
- package/dist/esm/components/calendar/calendar.js +12 -0
- package/dist/esm/components/calendar/dates.js +44 -0
- package/dist/esm/components/card/card.js +7 -0
- package/dist/esm/components/card/cardActions.js +7 -0
- package/dist/esm/components/card/cardContent.js +7 -0
- package/dist/esm/components/card/cardHeader.js +7 -0
- package/dist/esm/components/card/cardMedia.js +7 -0
- package/dist/esm/components/carousel/carousel.js +9 -0
- package/dist/esm/components/carousel/carouselItem.js +7 -0
- package/dist/esm/components/center/center.js +7 -0
- package/dist/esm/components/chat/chatComposer.js +9 -0
- package/dist/esm/components/chat/chatDictationButton.js +8 -0
- package/dist/esm/components/chat/chatLayout.js +9 -0
- package/dist/esm/components/chat/chatMessage.js +9 -0
- package/dist/esm/components/chat/chatMessageBubble.js +7 -0
- package/dist/esm/components/chat/chatMessageList.js +8 -0
- package/dist/esm/components/chat/chatMessageMetadata.js +7 -0
- package/dist/esm/components/chat/chatSystemMessage.js +7 -0
- package/dist/esm/components/chat/chatToolCall.js +9 -0
- package/dist/esm/components/chat/chatToolCalls.js +8 -0
- package/dist/esm/components/chat/slots.js +6 -0
- package/dist/esm/components/checkbox/checkbox.js +9 -0
- package/dist/esm/components/checkboxGroup/checkboxGroup.js +10 -0
- package/dist/esm/components/chip/chip.js +8 -0
- package/dist/esm/components/citation/citation.js +11 -0
- package/dist/esm/components/code/code.js +7 -0
- package/dist/esm/components/codeBlock/codeBlock.js +8 -0
- package/dist/esm/components/collapsible/collapsible.js +7 -0
- package/dist/esm/components/commandPalette/commandGroup.js +7 -0
- package/dist/esm/components/commandPalette/commandItem.js +7 -0
- package/dist/esm/components/commandPalette/commandPalette.js +10 -0
- package/dist/esm/components/complexSelector/complexOption.js +9 -0
- package/dist/esm/components/complexSelector/complexSelector.js +16 -0
- package/dist/esm/components/complexSelector/optionGroup.js +7 -0
- package/dist/esm/components/container/container.js +7 -0
- package/dist/esm/components/contextMenu/contextMenu.js +12 -0
- package/dist/esm/components/datePicker/datePicker.js +15 -0
- package/dist/esm/components/dateRangeInput/dateRangeInput.js +15 -0
- package/dist/esm/components/dateTimeInput/dateTimeInput.js +18 -0
- package/dist/esm/components/dialog/dialog.js +11 -0
- package/dist/esm/components/dialog/dialogContent.js +7 -0
- package/dist/esm/components/dialog/dialogFooter.js +7 -0
- package/dist/esm/components/dialog/dialogHeader.js +7 -0
- package/dist/esm/components/dialog/modalSurface.js +8 -0
- package/dist/esm/components/divider/divider.js +7 -0
- package/dist/esm/components/drawer/drawer.js +10 -0
- package/dist/esm/components/emptyState/emptyState.js +7 -0
- package/dist/esm/components/field/field.js +7 -0
- package/dist/esm/components/fileInput/fileInput.js +9 -0
- package/dist/esm/components/formLayout/formLayout.js +7 -0
- package/dist/esm/components/grid/col.js +7 -0
- package/dist/esm/components/grid/row.js +7 -0
- package/dist/esm/components/heading/heading.js +7 -0
- package/dist/esm/components/hidden/hidden.js +7 -0
- package/dist/esm/components/hoverCard/hoverCard.js +9 -0
- package/dist/esm/components/icon/icon.js +8 -0
- package/dist/esm/components/iconButton/iconButton.js +8 -0
- package/dist/esm/components/infoTip/infoTip.js +10 -0
- package/dist/esm/components/input/input.js +9 -0
- package/dist/esm/components/inputGroup/inputGroup.js +9 -0
- package/dist/esm/components/inputGroup/inputGroupText.js +7 -0
- package/dist/esm/components/kbd/kbd.js +7 -0
- package/dist/esm/components/lightbox/lightbox.js +10 -0
- package/dist/esm/components/link/link.js +8 -0
- package/dist/esm/components/listView/list.js +7 -0
- package/dist/esm/components/listView/listItem.js +7 -0
- package/dist/esm/components/listbox/listbox.js +9 -0
- package/dist/esm/components/listbox/listboxItem.js +8 -0
- package/dist/esm/components/markdown/markdown.js +9 -0
- package/dist/esm/components/markdown/parser.js +9 -0
- package/dist/esm/components/markdown/url.js +6 -0
- package/dist/esm/components/menu/menu.js +11 -0
- package/dist/esm/components/menu/menuCheckboxItem.js +9 -0
- package/dist/esm/components/menu/menuDivider.js +7 -0
- package/dist/esm/components/menu/menuGroup.js +7 -0
- package/dist/esm/components/menu/menuItem.js +8 -0
- package/dist/esm/components/menu/menuRadioGroup.js +7 -0
- package/dist/esm/components/menu/menuRadioItem.js +9 -0
- package/dist/esm/components/metadataList/metadataList.js +9 -0
- package/dist/esm/components/metadataList/metadataListItem.js +8 -0
- package/dist/esm/components/mobileNav/mobileNav.js +10 -0
- package/dist/esm/components/numberInput/numberInput.js +9 -0
- package/dist/esm/components/outline/outline.js +8 -0
- package/dist/esm/components/overflowList/overflowList.js +11 -0
- package/dist/esm/components/pagination/pagination.js +8 -0
- package/dist/esm/components/paper/paper.js +7 -0
- package/dist/esm/components/popover/popover.js +9 -0
- package/dist/esm/components/powerSearch/powerSearch.js +14 -0
- package/dist/esm/components/progressBar/progressBar.js +7 -0
- package/dist/esm/components/qrCode/qrCode.js +9 -0
- package/dist/esm/components/radio/radio.js +7 -0
- package/dist/esm/components/radio/radioGroup.js +10 -0
- package/dist/esm/components/scrollArea/scrollArea.js +8 -0
- package/dist/esm/components/section/section.js +8 -0
- package/dist/esm/components/segmentedControl/segmentedControl.js +12 -0
- package/dist/esm/components/segmentedControl/segmentedControlItem.js +7 -0
- package/dist/esm/components/select/field.js +18 -0
- package/dist/esm/components/select/option.js +8 -0
- package/dist/esm/components/select/select.js +14 -0
- package/dist/esm/components/selectableCard/selectableCard.js +9 -0
- package/dist/esm/components/selectableCard/selectableCardGroup.js +13 -0
- package/dist/esm/components/sideNav/sideNav.js +9 -0
- package/dist/esm/components/sideNav/sideNavItem.js +9 -0
- package/dist/esm/components/sideNav/sideNavSection.js +8 -0
- package/dist/esm/components/skeleton/skeleton.js +7 -0
- package/dist/esm/components/slider/slider.js +9 -0
- package/dist/esm/components/spinner/spinner.js +7 -0
- package/dist/esm/components/split/split.js +8 -0
- package/dist/esm/components/splitButton/splitButton.js +12 -0
- package/dist/esm/components/stack/stack.js +7 -0
- package/dist/esm/components/statusDot/statusDot.js +7 -0
- package/dist/esm/components/stepper/step.js +8 -0
- package/dist/esm/components/stepper/stepper.js +7 -0
- package/dist/esm/components/switch/switch.js +8 -0
- package/dist/esm/components/tab/tab.js +7 -0
- package/dist/esm/components/tab/tabPanel.js +7 -0
- package/dist/esm/components/tab/tabs.js +8 -0
- package/dist/esm/components/table/table.js +7 -0
- package/dist/esm/components/table/tableBody.js +7 -0
- package/dist/esm/components/table/tableCell.js +7 -0
- package/dist/esm/components/table/tableFooter.js +7 -0
- package/dist/esm/components/table/tableHeader.js +7 -0
- package/dist/esm/components/table/tableHeaderCell.js +8 -0
- package/dist/esm/components/table/tableRow.js +7 -0
- package/dist/esm/components/table/tableSelectionToolbar.js +8 -0
- package/dist/esm/components/text/text.js +7 -0
- package/dist/esm/components/textarea/textarea.js +8 -0
- package/dist/esm/components/thumbnail/thumbnail.js +8 -0
- package/dist/esm/components/timePicker/timePicker.js +15 -0
- package/dist/esm/components/timer/timer.js +7 -0
- package/dist/esm/components/timestamp/timestamp.js +7 -0
- package/dist/esm/components/toast/toast.js +8 -0
- package/dist/esm/components/toast/toaster.js +12 -0
- package/dist/esm/components/toggleButton/toggleButton.js +8 -0
- package/dist/esm/components/toggleButtonGroup/toggleButtonGroup.js +10 -0
- package/dist/esm/components/tokenizer/tokenizer.js +14 -0
- package/dist/esm/components/toolbar/toolbar.js +8 -0
- package/dist/esm/components/tooltip/tooltip.js +9 -0
- package/dist/esm/components/topNav/topNav.js +11 -0
- package/dist/esm/components/topNav/topNavItem.js +11 -0
- package/dist/esm/components/topNav/topNavMegaMenu.js +7 -0
- package/dist/esm/components/topNav/topNavMegaMenuCard.js +8 -0
- package/dist/esm/components/topNav/topNavMegaMenuGroup.js +7 -0
- package/dist/esm/components/topNav/topNavMegaMenuItem.js +7 -0
- package/dist/esm/components/tree/tree.js +8 -0
- package/dist/esm/components/tree/treeItem.js +8 -0
- package/dist/esm/components/virtualList/virtualList.js +7 -0
- package/dist/esm/components/virtualTable/virtualTable.js +9 -0
- package/dist/esm/components/visuallyHidden/visuallyHidden.js +7 -0
- package/dist/esm/core/a11y.js +22 -0
- package/dist/esm/core/element.js +14 -0
- package/dist/esm/core/form.js +6 -0
- package/dist/esm/core/overlay.js +8 -0
- package/dist/esm/index.js +779 -0
- package/dist/llms-full.txt +8903 -0
- package/dist/llms.txt +288 -0
- package/dist/punica-components.min.js +14283 -0
- package/dist/tokens.css +158 -0
- package/dist/types/index.d.ts +6762 -0
- package/dist/types/react.d.ts +1914 -0
- package/dist/vscode.css-custom-data.json +3892 -0
- package/dist/vscode.html-custom-data.json +6912 -0
- package/dist/web-types.json +12404 -0
- package/docs/MIGRATION-2.0.md +112 -0
- package/docs/contract.md +130 -0
- package/docs/migration/chat.md +309 -0
- package/docs/migration/content.md +806 -0
- package/docs/migration/data.md +140 -0
- package/docs/migration/display.md +625 -0
- package/docs/migration/form-basic.md +262 -0
- package/docs/migration/navigation.md +368 -0
- package/docs/migration/overlays.md +261 -0
- package/docs/migration/pickers.md +194 -0
- package/package.json +135 -4
- package/scripts/codemod-2.0.mjs +50 -0
- package/scripts/codemod-rules.mjs +102 -0
- package/skills/punica-components/SKILL.md +48 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Migrating from 1.x to 2.0
|
|
2
|
+
|
|
3
|
+
2.0 is a clean break. Tags, attributes, events, slots and tokens were all
|
|
4
|
+
brought to one contract ([`contract.md`](contract.md)), so a page written for 1.x needs
|
|
5
|
+
changes. `node scripts/codemod-2.0.mjs <dir>` lists what it would rewrite
|
|
6
|
+
and what a person has to move; `--write` applies the rewrites.
|
|
7
|
+
|
|
8
|
+
## What the codemod does
|
|
9
|
+
|
|
10
|
+
| | |
|
|
11
|
+
|---|---|
|
|
12
|
+
| Rewrites | Design tokens, and the tags renamed one to one (below) |
|
|
13
|
+
| Reports | Removed tags, 1.x event names, 1.x attribute and slot spellings, the global `Toast`, the `build.min.js` script, z-index and breakpoint tokens |
|
|
14
|
+
| Leaves alone | Everything already in 2.0 form; running it twice changes nothing |
|
|
15
|
+
|
|
16
|
+
## Loading
|
|
17
|
+
|
|
18
|
+
| 1.x | 2.0 |
|
|
19
|
+
|---|---|
|
|
20
|
+
| `<script src="build.min.js">` (a concatenation, global `PunicaBase`) | `import '@punica/components'` (every element), or `import '@punica/components/components/button/button.js'` (one), or `<script src="dist/punica-components.min.js">` (global `Punica`) |
|
|
21
|
+
| Tokens from the host's own `light.css` / `dark.css` on `:root` | Built in: the first element adopts the token sheet in `@layer punica.tokens`. Override any `--punica-*` with an ordinary rule; set `color-scheme` on `:root` or a subtree for light and dark. `data-punica-no-tokens` on `<html>` skips the built-in sheet; `@punica/components/tokens.css` is the same sheet as a file |
|
|
22
|
+
| Hand-written `src/types/*.d.ts` | Generated from `custom-elements.json`: `@punica/components` (elements, `HTMLElementTagNameMap`) and `@punica/components/react` (JSX) |
|
|
23
|
+
| Loading the bundle twice throws | Every `define` is guarded |
|
|
24
|
+
|
|
25
|
+
## What changed everywhere
|
|
26
|
+
|
|
27
|
+
- **Events are `punica-*`**, bubbling and composed, through one vocabulary:
|
|
28
|
+
`punica-input`, `punica-change`, `punica-select`, `punica-open`,
|
|
29
|
+
`punica-close`, `punica-toggle`, `punica-dismiss`. No element fires a
|
|
30
|
+
synthetic `change`, `input`, `focus`, `blur`, `close` or `select`. A change
|
|
31
|
+
made from script fires nothing.
|
|
32
|
+
- **Booleans follow HTML**: `disabled="false"` is disabled. `null` removes an
|
|
33
|
+
attribute; 1.x wrote the string `"null"`.
|
|
34
|
+
- **Multi-word attributes are kebab-case** (`fullwidth` → `full-width`).
|
|
35
|
+
- **Slots** `startIcon` / `endIcon` / `startAdornment` / `endAdornment` are
|
|
36
|
+
`start` / `end`.
|
|
37
|
+
- **Every value control is a form control**: in `FormData`, reset, validated,
|
|
38
|
+
disabled by a fieldset. The `value` attribute is the default; the property
|
|
39
|
+
is the current value.
|
|
40
|
+
- **Overlays open in the top layer.** Nothing is appended to `<body>`, no
|
|
41
|
+
`--zindex-*` token exists.
|
|
42
|
+
- **Text is text.** No attribute or data value is parsed as HTML.
|
|
43
|
+
- **`label`** is the accessible name; visible strings a component draws
|
|
44
|
+
itself are `label-*` attributes with English defaults.
|
|
45
|
+
|
|
46
|
+
## Tags
|
|
47
|
+
|
|
48
|
+
| 1.x | 2.0 |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `punica-tab`, `punica-tab-item` | `punica-tabs`, `punica-tab` |
|
|
51
|
+
| `punica-select-item` | `punica-option` |
|
|
52
|
+
| `punica-list-view`, `punica-list-view-item` | `punica-list`, `punica-list-item` |
|
|
53
|
+
| `punica-progress-line` | `punica-progress-bar` |
|
|
54
|
+
| `punica-modal`, `-header`, `-content`, `-footer` | `punica-dialog`, `-header`, `-content`, `-footer` |
|
|
55
|
+
| `punica-single-select-list`, `-item` | `punica-listbox`, `punica-listbox-item` |
|
|
56
|
+
| `punica-multi-select-list`, `-item` | `punica-listbox multiple`, `punica-listbox-item` |
|
|
57
|
+
| `punica-context-menu-item`, `-separator` | `punica-menu-item slot="menu"`, `punica-menu-divider` |
|
|
58
|
+
| `punica-accordion-summary`, `-details` | the accordion's `summary` slot and default slot |
|
|
59
|
+
| `punica-alert-icon`, `-content`, `-action` | the alert's `icon` slot, default slot, `actions` slot |
|
|
60
|
+
| `punica-typography` | `punica-heading` (with `level`) or `punica-text` (with `variant`) |
|
|
61
|
+
| `window.Toast` | `import { toast } from '@punica/components'` |
|
|
62
|
+
|
|
63
|
+
## Tokens
|
|
64
|
+
|
|
65
|
+
Colours are `light-dark()` pairs. Every 1.x token and its 2.0 name:
|
|
66
|
+
|
|
67
|
+
| 1.x | 2.0 |
|
|
68
|
+
|---|---|
|
|
69
|
+
| `--<palette>-main` / `-light` / `-dark` | `--punica-color-<palette>` / `-light` / `-dark` |
|
|
70
|
+
| `--background-main`, `--background-paper` | `--punica-color-bg`, `--punica-color-surface` |
|
|
71
|
+
| `--backdrop-light`, `--background-backdrop` | `--punica-color-hover`, `--punica-color-backdrop` |
|
|
72
|
+
| `--text-primary`, `--text-placeholder` | `--punica-color-text`, `--punica-color-text-placeholder` |
|
|
73
|
+
| `--neutral-main` as a border | `--punica-color-border` |
|
|
74
|
+
| `--disabled`, `--highlight` | `--punica-color-text-muted` with `--punica-disabled-opacity`, `--punica-color-focus` |
|
|
75
|
+
| `--white`, `--black` | `--punica-color-on-accent` on an accent, else `--punica-color-white` / `-black` |
|
|
76
|
+
| `--root-border-radius`, `--root-padding` | `--punica-radius`, `--punica-padding` |
|
|
77
|
+
| `--spacing-N` | `--punica-space-N` |
|
|
78
|
+
| `--box-shadow-S` | `--punica-shadow-S` |
|
|
79
|
+
| `--weight-W` | `--punica-font-weight-W` |
|
|
80
|
+
| `--fontFamily` | `--punica-font-family` |
|
|
81
|
+
| `--disabled-opacity` | `--punica-disabled-opacity` |
|
|
82
|
+
| `--zindex-*` | gone: overlays use the top layer |
|
|
83
|
+
| `--break-points-*` | container queries, or the literal widths 600 / 900 / 1200 / 1536 px in `@media` |
|
|
84
|
+
|
|
85
|
+
## Per element
|
|
86
|
+
|
|
87
|
+
One table per element, 1.x beside 2.0, with every attribute, property,
|
|
88
|
+
event, slot, part and custom property:
|
|
89
|
+
|
|
90
|
+
| Family | Document |
|
|
91
|
+
|---|---|
|
|
92
|
+
| Button, input, textarea, checkbox, switch, toggle button, radio, slider, number input, file input, field, segmented control | [`migration/form-basic.md`](migration/form-basic.md) |
|
|
93
|
+
| Select, option, calendar, date and time pickers, range and date-time inputs, autocomplete, tokenizer | [`migration/pickers.md`](migration/pickers.md) |
|
|
94
|
+
| Popover, tooltip, menu, context menu, dialog, drawer, toast, split button, hover card, bottom sheet, lightbox, command palette | [`migration/overlays.md`](migration/overlays.md) |
|
|
95
|
+
| Tabs, accordion, collapsible, listbox, list, pagination, button group, split, breadcrumbs, stepper, tree, carousel, overflow list | [`migration/navigation.md`](migration/navigation.md) |
|
|
96
|
+
| Alert, banner, avatar, badge, box, card, chip, container, divider, grid, hidden, icon, paper, progress bar, QR code, skeleton, toolbar, app bar, heading, text, spinner, link, kbd, status dot, empty state, stack, center, aspect ratio, scroll area, visually hidden | [`migration/display.md`](migration/display.md) |
|
|
97
|
+
| Agenda, virtual list, virtual table | [`migration/data.md`](migration/data.md) |
|
|
98
|
+
| Side nav, top nav, table, code, code block, timestamp, timer (new) | [`migration/content.md`](migration/content.md) |
|
|
99
|
+
| Chat family, markdown, citation (new) | [`migration/chat.md`](migration/chat.md) |
|
|
100
|
+
|
|
101
|
+
`punica-button` and `punica-popover`:
|
|
102
|
+
|
|
103
|
+
| | 1.x | 2.0 |
|
|
104
|
+
|---|---|---|
|
|
105
|
+
| Button slots | `startIcon`, `endIcon` | `start`, `end` |
|
|
106
|
+
| Button attributes | `rounded` (has a radius), `fullwidth`, `underline` | radius by default, `pill`, `full-width`; `underline` is gone (use `punica-link`) |
|
|
107
|
+
| Button defaults | none: an unstyled host without `variant`, `color` and `size` | `filled`, `primary`, `medium` |
|
|
108
|
+
| Button colour | `ghost` | `variant="text"` |
|
|
109
|
+
| Button in a form | `type` did nothing | `type="submit"` / `reset` act on the form, with `name` and `value` |
|
|
110
|
+
| Button keyboard | not focusable | a native button inside, `delegatesFocus` |
|
|
111
|
+
| Popover position | `top` / `left` attributes measured once by the caller | `side`, `align`, `offset`, anchored to the `trigger` slot, `for`, or the `anchor` property; follows scroll and resize |
|
|
112
|
+
| Popover open | caller shows and hides it and owns dismissal | `open`, `show()`, `hide()`; outside press and Escape close it unless `manual`; `punica-open`, `punica-close` |
|
package/docs/contract.md
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# The 2.0 contract
|
|
2
|
+
|
|
3
|
+
`@punica/components` is a library of framework-free custom elements. Every
|
|
4
|
+
element is `punica-<name>`, extends `PunicaElement` and follows the one
|
|
5
|
+
contract below. `npm run audit` and the shared contract test hold it; the
|
|
6
|
+
1.x token names are mapped in [`MIGRATION-2.0.md`](MIGRATION-2.0.md#tokens).
|
|
7
|
+
|
|
8
|
+
## Layout
|
|
9
|
+
|
|
10
|
+
| Path | What it is |
|
|
11
|
+
|---|---|
|
|
12
|
+
| `src/core/element.js` | `PunicaElement`, `define`, `sheet`, `uid`, `installTokens` |
|
|
13
|
+
| `src/core/form.js` | `FormControl(Base)` mixin: a real form control through ElementInternals |
|
|
14
|
+
| `src/core/a11y.js` | `nextIndex`, `setRovingTabindex`, `createTypeahead`, `firstFocusable`, `deepActiveElement`, `isRtl` |
|
|
15
|
+
| `src/core/overlay.js` | `Overlay` (top layer + anchoring) and `overlayCss` |
|
|
16
|
+
| `src/core/icons.js` | The glyphs components draw themselves, as static SVG markup |
|
|
17
|
+
| `src/tokens/tokens.css` | Every `--punica-*` design token, light-dark pairs, in `@layer punica.tokens` |
|
|
18
|
+
| `src/components/<dir>/<name>.js` + `.css` | One element per file, its styles beside it |
|
|
19
|
+
| `src/components/<dir>/<dir>.test.js` | Contract and behaviour tests, run in Chromium |
|
|
20
|
+
| `test/contract.js` | `contract(tag, options)`, `fixture`, `settle`, `once`, `a11y`, `cleanup` |
|
|
21
|
+
| `scripts/build.mjs` | `dist/esm` (per component), `dist/punica-components.min.js` (global `Punica`), `dist/tokens.css` |
|
|
22
|
+
| `src/index.js` | Generated barrel; never edit |
|
|
23
|
+
|
|
24
|
+
References to read before writing a component: `src/components/button/`
|
|
25
|
+
(a form-associated control over a native element) and
|
|
26
|
+
`src/components/popover/` (a top-layer panel).
|
|
27
|
+
|
|
28
|
+
## The contract
|
|
29
|
+
|
|
30
|
+
**Module.** An ES module that exports `class Punica<Name> extends
|
|
31
|
+
PunicaElement` and ends with `define('punica-<name>', Punica<Name>)`.
|
|
32
|
+
Nothing at module top level touches `document` or `window`. No globals.
|
|
33
|
+
A `.css` import is the file's text: `import styles from './x.css'`.
|
|
34
|
+
|
|
35
|
+
**Declarations.** `static properties`, `static styles`, `static template`
|
|
36
|
+
(static author-written markup; data never goes into it), `static
|
|
37
|
+
shadowOptions` (`{ delegatesFocus: true }` when the element wraps a
|
|
38
|
+
focusable control). A light-DOM element sets `static shadow = false`.
|
|
39
|
+
|
|
40
|
+
**Lifecycle.** The constructor may only build and wire its own shadow tree:
|
|
41
|
+
it never reads or writes attributes or light-DOM children. `connected()`
|
|
42
|
+
runs on every connect; anything attached outside the shadow tree (window,
|
|
43
|
+
document, observers, timers) is attached there with `this.listen(...)` or
|
|
44
|
+
`{ signal: this.signal }` and observers/timers are undone in
|
|
45
|
+
`disconnected()`. `update(changed)` runs once per microtask and brings the
|
|
46
|
+
shadow tree in line with the properties; on the first run `changed` holds
|
|
47
|
+
every property. An element that is removed and appended again works exactly
|
|
48
|
+
as before. Never override `connectedCallback`, `disconnectedCallback` or
|
|
49
|
+
`attributeChangedCallback`.
|
|
50
|
+
|
|
51
|
+
**Properties and attributes.** Declared in `static properties`; never
|
|
52
|
+
hand-written accessors for attribute-backed state. Multi-word attributes
|
|
53
|
+
are kebab-case (`fullWidth` ↔ `full-width`). Booleans follow HTML: present
|
|
54
|
+
is true, `disabled="false"` is still disabled. `null` removes the
|
|
55
|
+
attribute. Data (arrays, objects, functions) is a property with
|
|
56
|
+
`attribute: false`. The shared names, used wherever the concept occurs:
|
|
57
|
+
`value`, `checked`, `open`, `selected`, `disabled`, `readonly`, `required`,
|
|
58
|
+
`name`, `label` (accessible name), `placeholder`, `orientation`
|
|
59
|
+
(`horizontal | vertical`), `size` (`small | medium | large`), `variant`,
|
|
60
|
+
`color` (`primary | secondary | error | warning | info | success |
|
|
61
|
+
neutral`), `multiple`, `min`, `max`, `step`.
|
|
62
|
+
|
|
63
|
+
**Events.** Only through `this.emit(name, detail)`, which dispatches
|
|
64
|
+
`punica-<name>`, bubbling and composed. No element fires a synthetic event
|
|
65
|
+
under a native name; native `click`, `focus`, `keydown` pass through on
|
|
66
|
+
their own. The vocabulary:
|
|
67
|
+
|
|
68
|
+
| Event | When | `detail` |
|
|
69
|
+
|---|---|---|
|
|
70
|
+
| `punica-input` | the value changes while the user is still editing | `{ value }` |
|
|
71
|
+
| `punica-change` | the user committed a new value | `{ value }`, plus `{ checked }` for a toggle |
|
|
72
|
+
| `punica-select` | the user picked an item of a list or menu | `{ value, item }` |
|
|
73
|
+
| `punica-open` / `punica-close` | a surface opened / closed | close: `{ reason }` |
|
|
74
|
+
| `punica-toggle` | a disclosure expanded or collapsed | `{ open }` |
|
|
75
|
+
| `punica-dismiss` | the user dismissed a chip, alert, toast | `{}` |
|
|
76
|
+
|
|
77
|
+
A programmatic property change fires nothing. A `cancelable` event that is
|
|
78
|
+
prevented stops the default action.
|
|
79
|
+
|
|
80
|
+
**Forms.** Anything a person enters a value into extends
|
|
81
|
+
`FormControl(PunicaElement)`: it calls `setFormValue` and `setValidity`
|
|
82
|
+
from `update()`, implements `formReset()` and `formRestore(state)`, and
|
|
83
|
+
reads `isDisabled`. The `value` attribute is the default value and the
|
|
84
|
+
`value` property is the current one (`reflect: false`). Enter in a
|
|
85
|
+
single-line text control calls `this.form?.requestSubmit()`.
|
|
86
|
+
|
|
87
|
+
**Accessibility.** A real native element inside the shadow root when one
|
|
88
|
+
exists for the job (`<button>`, `<input>`, `<dialog>`), with
|
|
89
|
+
`delegatesFocus`. Otherwise role and ARIA state through `this.internals`
|
|
90
|
+
(`internals.role`, `internals.ariaChecked`) and the WAI-ARIA APG keyboard
|
|
91
|
+
pattern, with Home and End, from `src/core/a11y.js`. Every interactive
|
|
92
|
+
element is reachable and operable by keyboard, shows `:focus-visible`
|
|
93
|
+
with `outline: var(--punica-focus-ring)`, and has an accessible name from
|
|
94
|
+
its content or `label`. No English strings in a component: a string a
|
|
95
|
+
person may read or hear is an attribute with an English default
|
|
96
|
+
(`label-close="Close"`). Dates and numbers through `Intl` with the
|
|
97
|
+
element's language (`this.closest('[lang]')?.lang || navigator.language`).
|
|
98
|
+
|
|
99
|
+
**Surfaces.** A floating surface is a `popover="manual"` element in the
|
|
100
|
+
component's own shadow root placed by `Overlay`, or a `<punica-popover>`
|
|
101
|
+
the component composes. A modal surface is a native `<dialog>` opened with
|
|
102
|
+
`showModal()`. Nothing is appended to `document.body`, nothing uses a
|
|
103
|
+
global id or a z-index token.
|
|
104
|
+
|
|
105
|
+
**Styles.** `:host` sets `display` and declares the component's public
|
|
106
|
+
custom properties as `--punica-<component>-<property>`, each defaulting to
|
|
107
|
+
a token. Private working values are `--_name`. Every colour, space, radius,
|
|
108
|
+
shadow, duration and font comes from a `--punica-*` token in
|
|
109
|
+
`src/tokens/tokens.css`; a hex or rgb literal is a defect. Variants read
|
|
110
|
+
attributes (`:host([variant='outlined'])`), states read
|
|
111
|
+
`:state(checked)` set by `this.toggleState('checked', on)`. Every element a
|
|
112
|
+
consumer may restyle carries `part="..."`. Logical properties only
|
|
113
|
+
(`inline-size`, `padding-inline`, `inset-inline-start`); no `left`/`right`.
|
|
114
|
+
Motion uses the duration tokens, which are zero under
|
|
115
|
+
`prefers-reduced-motion`; a `@media (forced-colors: active)` block keeps
|
|
116
|
+
borders and focus visible. No `!important` except `[hidden]`. The host
|
|
117
|
+
never receives inline styles from its own code.
|
|
118
|
+
|
|
119
|
+
**Text.** Data reaches the DOM through `textContent`, attributes or DOM
|
|
120
|
+
construction. `innerHTML` is assigned only in `static template`.
|
|
121
|
+
|
|
122
|
+
**Docs.** A JSDoc block on the class with `@element`, one `@attr` per
|
|
123
|
+
attribute, `@prop` for property-only state, `@slot`, `@fires`, `@csspart`,
|
|
124
|
+
`@cssprop`, `@cssstate`; every public method documented. Slot names are
|
|
125
|
+
kebab-case; `start` and `end` name leading and trailing content.
|
|
126
|
+
|
|
127
|
+
**Tests.** `<dir>.test.js` calls `contract('punica-<name>', { html })` for
|
|
128
|
+
every element in the folder, then tests behaviour: keyboard, events with
|
|
129
|
+
their `detail`, form submission and reset for a form control, each defect
|
|
130
|
+
of the 1.x element the audit named. Run `npx vitest run src/components/<dir>`.
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
# Chat, citation and markdown
|
|
2
|
+
|
|
3
|
+
New in 2.0; there is no 1.x element to migrate from. Eleven elements for an
|
|
4
|
+
AI assistant conversation: nine in `src/components/chat/`, `punica-citation`
|
|
5
|
+
in `src/components/citation/` and `punica-markdown` in
|
|
6
|
+
`src/components/markdown/`.
|
|
7
|
+
|
|
8
|
+
```html
|
|
9
|
+
<punica-chat-layout>
|
|
10
|
+
<h2 slot="header">Assistant</h2>
|
|
11
|
+
<punica-chat-message-list>
|
|
12
|
+
<punica-chat-message sender="user" name="You">
|
|
13
|
+
<punica-chat-message-bubble>How hot does water boil at altitude?</punica-chat-message-bubble>
|
|
14
|
+
</punica-chat-message>
|
|
15
|
+
<punica-chat-message sender="assistant" name="Ivy" status="streaming">
|
|
16
|
+
<punica-chat-tool-calls>
|
|
17
|
+
<punica-chat-tool-call name="web.search" status="success" duration="420">
|
|
18
|
+
<pre slot="input">{ "q": "boiling point altitude" }</pre>
|
|
19
|
+
</punica-chat-tool-call>
|
|
20
|
+
</punica-chat-tool-calls>
|
|
21
|
+
<punica-chat-message-bubble variant="plain">
|
|
22
|
+
<punica-markdown streaming></punica-markdown>
|
|
23
|
+
</punica-chat-message-bubble>
|
|
24
|
+
<punica-chat-message-metadata slot="metadata">
|
|
25
|
+
<time slot="time" datetime="2026-11-18T10:10">10:10</time>
|
|
26
|
+
</punica-chat-message-metadata>
|
|
27
|
+
<button slot="actions" type="button">Copy</button>
|
|
28
|
+
</punica-chat-message>
|
|
29
|
+
</punica-chat-message-list>
|
|
30
|
+
<punica-chat-composer slot="composer" placeholder="Ask anything"></punica-chat-composer>
|
|
31
|
+
</punica-chat-layout>
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Every string a person may read or hear is an attribute with an English
|
|
35
|
+
default (`label-*`); set it to translate.
|
|
36
|
+
|
|
37
|
+
## punica-chat-layout
|
|
38
|
+
|
|
39
|
+
`chat/chatLayout.js`. The frame: header, scrolling messages, composer. It
|
|
40
|
+
follows new content while the reader is at the end and stops when they scroll
|
|
41
|
+
up. Give it a block size (it is `block-size: 100%` of its container).
|
|
42
|
+
|
|
43
|
+
| | Name | Notes |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| Attribute | `label` | Accessible name of the scrolling area. Default `Messages`. |
|
|
46
|
+
| Attribute | `label-scroll-to-latest` | Accessible name of the jump button. Default `Jump to latest`. |
|
|
47
|
+
| Property | `atBottom` | Read-only boolean: the view is following the latest content. |
|
|
48
|
+
| Method | `scrollToLatest()` | Scrolls to the end and follows again. |
|
|
49
|
+
| Event | `punica-scroll-state` | `{ atBottom }`, when following starts or stops. |
|
|
50
|
+
| Slot | (default) | The messages, usually one `punica-chat-message-list`. |
|
|
51
|
+
| Slot | `header` | A title bar; its wrapper is hidden while empty. |
|
|
52
|
+
| Slot | `composer` | The input area; its wrapper is hidden while empty. |
|
|
53
|
+
| Part | `header`, `body`, `scroller`, `content`, `scroll-button`, `composer` | |
|
|
54
|
+
| Custom property | `--punica-chat-layout-background` | Default `--punica-color-bg`. |
|
|
55
|
+
| Custom property | `--punica-chat-layout-padding` | Default `--punica-space-16`. |
|
|
56
|
+
| Custom property | `--punica-chat-layout-max-width` | Width of the message column and the composer. Default `48rem`. |
|
|
57
|
+
| State | `:state(at-bottom)` | |
|
|
58
|
+
|
|
59
|
+
## punica-chat-message-list
|
|
60
|
+
|
|
61
|
+
`chat/chatMessageList.js`. `role="log"`, `aria-live="polite"`.
|
|
62
|
+
|
|
63
|
+
| | Name | Notes |
|
|
64
|
+
|---|---|---|
|
|
65
|
+
| Attribute | `label` | Accessible name of the log. Default `Conversation`. |
|
|
66
|
+
| Slot | (default) | The messages. |
|
|
67
|
+
| Slot | `empty` | Shown while there is no message. |
|
|
68
|
+
| Part | `base`, `empty` | |
|
|
69
|
+
| Custom property | `--punica-chat-message-list-gap` | Space between messages. Default `--punica-space-24`. |
|
|
70
|
+
| State | `:state(empty)` | |
|
|
71
|
+
|
|
72
|
+
## punica-chat-message
|
|
73
|
+
|
|
74
|
+
`chat/chatMessage.js`. One turn; `role="article"`, `aria-busy` while
|
|
75
|
+
streaming.
|
|
76
|
+
|
|
77
|
+
| | Name | Notes |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| Attribute | `sender` | `user` \| `assistant` \| `system` \| `tool`. Default `assistant`. A `user` turn sits at the inline end. |
|
|
80
|
+
| Attribute | `name` | The sender's display name; shown above the content and used as the accessible name. |
|
|
81
|
+
| Attribute | `status` | `streaming` \| `complete` \| `error`. Default `complete`. |
|
|
82
|
+
| Attribute | `label` | Accessible name, when `name` is not enough. |
|
|
83
|
+
| Attribute | `label-streaming` | Announced while streaming (the dots are what is seen). Default `Writing`. |
|
|
84
|
+
| Attribute | `label-error` | Shown beside the error icon. Default `Error`. |
|
|
85
|
+
| Slot | (default) | Bubbles, tool calls, markdown. |
|
|
86
|
+
| Slot | `avatar` | The sender's picture. |
|
|
87
|
+
| Slot | `metadata` | A `punica-chat-message-metadata`. |
|
|
88
|
+
| Slot | `actions` | Buttons; faded out until hover or focus inside the message, always in the tab order. |
|
|
89
|
+
| Part | `avatar`, `body`, `name`, `content`, `status`, `footer`, `metadata`, `actions` | |
|
|
90
|
+
| Custom property | `--punica-chat-message-surface` | Background its bubbles take. Set per sender. |
|
|
91
|
+
| Custom property | `--punica-chat-message-on-surface` | Text colour its bubbles take. |
|
|
92
|
+
| Custom property | `--punica-chat-message-border` | Border colour its bubbles take; the error colour for `status="error"`. |
|
|
93
|
+
| Custom property | `--punica-chat-message-gap` | Space between avatar and body. |
|
|
94
|
+
| Custom property | `--punica-chat-message-max-width` | Largest inline size of the body. `80%` for `user`, else `100%`. |
|
|
95
|
+
| State | `:state(has-avatar)` | |
|
|
96
|
+
|
|
97
|
+
## punica-chat-message-bubble
|
|
98
|
+
|
|
99
|
+
`chat/chatMessageBubble.js`. The content surface. Inside a message it needs no
|
|
100
|
+
attribute: its custom properties default to the message's three
|
|
101
|
+
`--punica-chat-message-*` colours, which inherit. To restyle every bubble of a
|
|
102
|
+
sender, set those on the message; to restyle one bubble, set `variant` or the
|
|
103
|
+
bubble's own properties.
|
|
104
|
+
|
|
105
|
+
| | Name | Notes |
|
|
106
|
+
|---|---|---|
|
|
107
|
+
| Attribute | `variant` | `filled` (default: the sender's surface) \| `outlined` (border, no fill) \| `plain` (no surface, no padding). |
|
|
108
|
+
| Slot | (default) | The content. |
|
|
109
|
+
| Part | `base` | |
|
|
110
|
+
| Custom property | `--punica-chat-message-bubble-background` | Default: the message's surface, else `--punica-color-surface`. |
|
|
111
|
+
| Custom property | `--punica-chat-message-bubble-color` | Default: the message's on-surface colour, else `--punica-color-text`. |
|
|
112
|
+
| Custom property | `--punica-chat-message-bubble-border-color` | Default: the message's border, else `--punica-color-border`. |
|
|
113
|
+
| Custom property | `--punica-chat-message-bubble-radius` | Default `--punica-radius-lg`. |
|
|
114
|
+
| Custom property | `--punica-chat-message-bubble-padding` | |
|
|
115
|
+
|
|
116
|
+
## punica-chat-message-metadata
|
|
117
|
+
|
|
118
|
+
`chat/chatMessageMetadata.js`. A small muted row.
|
|
119
|
+
|
|
120
|
+
| | Name | Notes |
|
|
121
|
+
|---|---|---|
|
|
122
|
+
| Slot | `time` | When the turn was sent; a `<time>`. |
|
|
123
|
+
| Slot | `model` | The model's name. |
|
|
124
|
+
| Slot | `tokens` | Token counts. |
|
|
125
|
+
| Slot | (default) | Anything else. |
|
|
126
|
+
| Part | `base` | |
|
|
127
|
+
| Custom property | `--punica-chat-message-metadata-color` | |
|
|
128
|
+
| Custom property | `--punica-chat-message-metadata-gap` | |
|
|
129
|
+
|
|
130
|
+
## punica-chat-system-message
|
|
131
|
+
|
|
132
|
+
`chat/chatSystemMessage.js`. A centred notice between turns; `role="note"`.
|
|
133
|
+
|
|
134
|
+
| | Name | Notes |
|
|
135
|
+
|---|---|---|
|
|
136
|
+
| Attribute | `color` | `primary` \| `secondary` \| `error` \| `warning` \| `info` \| `success` \| `neutral`. Default `neutral`. |
|
|
137
|
+
| Slot | (default) | The notice. |
|
|
138
|
+
| Slot | `icon` | A glyph before the notice. |
|
|
139
|
+
| Part | `base`, `label` | |
|
|
140
|
+
| Custom property | `--punica-chat-system-message-color` | |
|
|
141
|
+
| Custom property | `--punica-chat-system-message-background` | |
|
|
142
|
+
| Custom property | `--punica-chat-system-message-line-color` | The rule on each side. |
|
|
143
|
+
|
|
144
|
+
## punica-chat-composer
|
|
145
|
+
|
|
146
|
+
`chat/chatComposer.js`. Form-associated message input over a native
|
|
147
|
+
`<textarea>` that grows with its text (`field-sizing: content`, measured in
|
|
148
|
+
script where that is missing).
|
|
149
|
+
|
|
150
|
+
Enter sends, Shift+Enter starts a new line, and Enter that confirms an IME
|
|
151
|
+
composition is left alone. Sending fires `punica-submit`; unless it is
|
|
152
|
+
prevented, the owning form (if there is one) is asked to submit with the text
|
|
153
|
+
in its data, and the field is cleared. While `busy`, Enter sends nothing and
|
|
154
|
+
the button stops.
|
|
155
|
+
|
|
156
|
+
| | Name | Notes |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| Attribute | `value` | The default text. The `value` property is the current text and is not reflected. |
|
|
159
|
+
| Attribute | `placeholder` | |
|
|
160
|
+
| Attribute | `label` | Accessible name of the field. Default `Message`. |
|
|
161
|
+
| Attribute | `name` | Name the text is submitted under. |
|
|
162
|
+
| Attribute | `disabled` | Also disabled by a `<fieldset disabled>`. |
|
|
163
|
+
| Attribute | `required` | `valueMissing` while empty. |
|
|
164
|
+
| Attribute | `busy` | A response is streaming: the send button is a stop button. |
|
|
165
|
+
| Attribute | `max-rows` | Lines the field grows to before it scrolls. Default `8`. |
|
|
166
|
+
| Attribute | `label-send` | Default `Send`. |
|
|
167
|
+
| Attribute | `label-stop` | Default `Stop`. |
|
|
168
|
+
| Method | `focus(options?)` | Focuses the text area. |
|
|
169
|
+
| Method | `checkValidity()`, `reportValidity()`, `setCustomValidity(message)` | From `FormControl`. |
|
|
170
|
+
| Event | `punica-input` | `{ value }`, while typing. |
|
|
171
|
+
| Event | `punica-submit` | `{ value }`, cancelable. Prevent it to keep the text and not submit the form. |
|
|
172
|
+
| Event | `punica-stop` | `{}`, the stop button was pressed while `busy`. |
|
|
173
|
+
| Event | `punica-attach` | `{ files: File[] }`, files were pasted or dropped. Nothing is uploaded. |
|
|
174
|
+
| Slot | `start` | Controls before the field: attach buttons. |
|
|
175
|
+
| Slot | `end` | Controls between the field and the send button. |
|
|
176
|
+
| Slot | `footer` | A line under the field. |
|
|
177
|
+
| Part | `base`, `field`, `textarea`, `send-button`, `footer` | |
|
|
178
|
+
| Custom property | `--punica-chat-composer-background` | |
|
|
179
|
+
| Custom property | `--punica-chat-composer-border-color` | |
|
|
180
|
+
| Custom property | `--punica-chat-composer-radius` | |
|
|
181
|
+
| Custom property | `--punica-chat-composer-padding` | |
|
|
182
|
+
| State | `:state(busy)`, `:state(empty)`, `:state(dragover)`, `:state(disabled)`, `:state(invalid)`, `:state(valid)` | |
|
|
183
|
+
|
|
184
|
+
The send button is disabled while the field is empty or holds only white
|
|
185
|
+
space.
|
|
186
|
+
|
|
187
|
+
## punica-chat-tool-calls
|
|
188
|
+
|
|
189
|
+
`chat/chatToolCalls.js`. The tools a turn called, folded under one native
|
|
190
|
+
button.
|
|
191
|
+
|
|
192
|
+
| | Name | Notes |
|
|
193
|
+
|---|---|---|
|
|
194
|
+
| Attribute | `open` | The list is showing. Collapsed by default. |
|
|
195
|
+
| Attribute | `label` | Text of the header. Default `Tool calls`. |
|
|
196
|
+
| Event | `punica-toggle` | `{ open }`, when a person folds or unfolds it. |
|
|
197
|
+
| Slot | (default) | `punica-chat-tool-call` items; their count is shown in the header. |
|
|
198
|
+
| Part | `header`, `label`, `count`, `panel` | |
|
|
199
|
+
| Custom property | `--punica-chat-tool-calls-gap` | |
|
|
200
|
+
| Custom property | `--punica-chat-tool-calls-color` | Colour of the header. |
|
|
201
|
+
|
|
202
|
+
## punica-chat-tool-call
|
|
203
|
+
|
|
204
|
+
`chat/chatToolCall.js`. One invocation: a disclosure (native button,
|
|
205
|
+
`aria-expanded`) over its input and output. Status is an icon and a word.
|
|
206
|
+
|
|
207
|
+
| | Name | Notes |
|
|
208
|
+
|---|---|---|
|
|
209
|
+
| Attribute | `name` | The tool's name. |
|
|
210
|
+
| Attribute | `status` | `pending` \| `running` \| `success` \| `error`. Default `pending`. |
|
|
211
|
+
| Attribute | `duration` | Milliseconds; shown through `Intl.NumberFormat` in the element's language (`420ms`, `1.5s`). |
|
|
212
|
+
| Attribute | `open` | Input and output are showing. |
|
|
213
|
+
| Attribute | `label-pending`, `label-running`, `label-success`, `label-error` | Status words. Defaults `Pending`, `Running`, `Done`, `Failed`. |
|
|
214
|
+
| Attribute | `label-input`, `label-output` | Section headings. Defaults `Input`, `Output`. |
|
|
215
|
+
| Event | `punica-toggle` | `{ open }`. |
|
|
216
|
+
| Slot | `input` | What the tool was called with: a `punica-code-block` or a `<pre>`. Its section is hidden while empty. |
|
|
217
|
+
| Slot | `output` | What it returned. Its section is hidden while empty. |
|
|
218
|
+
| Slot | (default) | Anything else shown when open. |
|
|
219
|
+
| Part | `base`, `header`, `name`, `status`, `status-text`, `duration`, `panel`, `section`, `section-label` | |
|
|
220
|
+
| Custom property | `--punica-chat-tool-call-background` | |
|
|
221
|
+
| Custom property | `--punica-chat-tool-call-border-color` | |
|
|
222
|
+
| Custom property | `--punica-chat-tool-call-radius` | |
|
|
223
|
+
|
|
224
|
+
## punica-citation
|
|
225
|
+
|
|
226
|
+
`citation/citation.js`. An inline numbered source marker. With an `href` it is
|
|
227
|
+
a native link; with none, or with one that is not `http:`, `https:`,
|
|
228
|
+
`mailto:` or relative, it is a native button that toggles the card. The card
|
|
229
|
+
is a composed `punica-popover`; it opens on hover and on focus, focus stays on
|
|
230
|
+
the marker, and Escape closes it.
|
|
231
|
+
|
|
232
|
+
| | Name | Notes |
|
|
233
|
+
|---|---|---|
|
|
234
|
+
| Attribute | `index` | The number shown. |
|
|
235
|
+
| Attribute | `href` | The source's address. An external one gets `rel="noopener noreferrer"`. |
|
|
236
|
+
| Attribute | `heading` | The source's title, shown in the card. (Not the global `title`, which would also show the browser's tooltip.) |
|
|
237
|
+
| Attribute | `source` | The site or publication, shown in the card. |
|
|
238
|
+
| Attribute | `target` | As on `<a>`. |
|
|
239
|
+
| Attribute | `open` | The card is showing. |
|
|
240
|
+
| Attribute | `label` | The whole accessible name of the marker. |
|
|
241
|
+
| Attribute | `label-citation` | The word before the number in the default name (`Source 1: Title`). Default `Source`. |
|
|
242
|
+
| Method | `show()`, `hide()` | Open and close the card. |
|
|
243
|
+
| Event | `punica-open` | The card opened. |
|
|
244
|
+
| Event | `punica-close` | `{ reason }`: `escape`, `outside` or `api`. |
|
|
245
|
+
| Slot | (default), `snippet` | A snippet of the source, shown in the card. |
|
|
246
|
+
| Part | `marker`, `index`, `popover`, `card`, `title`, `source`, `snippet` | |
|
|
247
|
+
| Custom property | `--punica-citation-color` | |
|
|
248
|
+
| Custom property | `--punica-citation-background` | |
|
|
249
|
+
| Custom property | `--punica-citation-radius` | |
|
|
250
|
+
| Custom property | `--punica-citation-card-width` | Largest inline size of the card. Default `20rem`. |
|
|
251
|
+
|
|
252
|
+
## punica-markdown
|
|
253
|
+
|
|
254
|
+
`markdown/markdown.js`, with its parser in `markdown/parser.js` and its URL
|
|
255
|
+
filter in `markdown/url.js`. No dependency.
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
const md = document.querySelector('punica-markdown');
|
|
259
|
+
md.renderCodeBlock = (code, language) => {
|
|
260
|
+
const block = document.createElement('punica-code-block');
|
|
261
|
+
block.language = language;
|
|
262
|
+
block.code = code;
|
|
263
|
+
return block;
|
|
264
|
+
};
|
|
265
|
+
md.streaming = true;
|
|
266
|
+
for await (const chunk of stream) md.value = (md.value ?? '') + chunk;
|
|
267
|
+
md.streaming = false;
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
| | Name | Notes |
|
|
271
|
+
|---|---|---|
|
|
272
|
+
| Attribute | `value` | The Markdown source; not reflected. While unset, the element's own text content is the source (dedented, and watched for changes). |
|
|
273
|
+
| Attribute | `streaming` | The source is still growing: `aria-busy`, and a caret after the last block. |
|
|
274
|
+
| Attribute | `no-images` | Images render as links, so nothing is fetched until a person asks. |
|
|
275
|
+
| Property | `renderCodeBlock` | `(code, language) => Node \| null`. Called for every code block; a returned node is used as the block, `null` gives the built-in `<pre><code class="language-…">`. |
|
|
276
|
+
| Part | `base`, `heading`, `paragraph`, `link`, `image`, `inline-code`, `code-block`, `code`, `blockquote`, `list`, `list-item`, `checkbox`, `table-wrap`, `table`, `hr` | |
|
|
277
|
+
| Custom property | `--punica-markdown-gap` | Space between blocks. |
|
|
278
|
+
| Custom property | `--punica-markdown-link-color` | |
|
|
279
|
+
| Custom property | `--punica-markdown-code-background` | |
|
|
280
|
+
| Custom property | `--punica-markdown-code-font-family` | |
|
|
281
|
+
| Custom property | `--punica-markdown-border-color` | Table lines, rules, the quote bar. |
|
|
282
|
+
| State | `:state(streaming)` | |
|
|
283
|
+
|
|
284
|
+
It fires no events and has no slots: the light DOM is read, never shown.
|
|
285
|
+
|
|
286
|
+
**What it renders.** ATX headings, paragraphs, emphasis, strong,
|
|
287
|
+
strikethrough (`~~`), inline code, fenced code (backticks or tildes) and
|
|
288
|
+
indented code, block quotes, bullet, ordered and nested lists, task lists
|
|
289
|
+
(disabled checkboxes named after their item), links, `<…>` and bare
|
|
290
|
+
`http(s)://` autolinks, images, GFM tables with column alignment, thematic
|
|
291
|
+
breaks, hard line breaks (two trailing spaces or a backslash), backslash
|
|
292
|
+
escapes and character references. Not supported: setext headings (`===`
|
|
293
|
+
underlines), reference-style links, footnotes.
|
|
294
|
+
|
|
295
|
+
**What it refuses.** The tree is built with `createElement` and `textContent`
|
|
296
|
+
only. Raw HTML in the source is shown as the text that was written. A link or
|
|
297
|
+
image is made only for an `http:`, `https:`, `mailto:` or relative URL; for
|
|
298
|
+
anything else (`javascript:`, `data:`, `vbscript:`, `file:` …, however the
|
|
299
|
+
scheme is disguised) the Markdown that was written is shown as text. An
|
|
300
|
+
external link gets `target="_blank" rel="noopener noreferrer"`. An image with
|
|
301
|
+
no alt text is not shown.
|
|
302
|
+
|
|
303
|
+
**Streaming.** Every change to `value` is applied as a patch: a block whose
|
|
304
|
+
source text did not change keeps its DOM node, a list or quote that only grew
|
|
305
|
+
keeps the items it had, and a built-in code block that grew keeps its
|
|
306
|
+
`<code>` and only takes new text. So finished blocks do not flicker and a
|
|
307
|
+
selection inside them survives. Only the last block, the one still being
|
|
308
|
+
written, is rebuilt. A node returned by `renderCodeBlock` is replaced each
|
|
309
|
+
time its code grows.
|