@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,39 @@
|
|
|
1
|
+
export interface AttributeInfo { name: string; property: string; type: string; values: string[] | null; description: string }
|
|
2
|
+
export interface NamedInfo { name: string; description: string }
|
|
3
|
+
export interface ElementInfo {
|
|
4
|
+
tag: string;
|
|
5
|
+
className: string;
|
|
6
|
+
module: string;
|
|
7
|
+
description: string;
|
|
8
|
+
attributes: AttributeInfo[];
|
|
9
|
+
properties: (NamedInfo & { type: string; readonly: boolean })[];
|
|
10
|
+
methods: (NamedInfo & { signature: string })[];
|
|
11
|
+
events: NamedInfo[];
|
|
12
|
+
slots: NamedInfo[];
|
|
13
|
+
parts: NamedInfo[];
|
|
14
|
+
cssProperties: NamedInfo[];
|
|
15
|
+
states: NamedInfo[];
|
|
16
|
+
childAttributes: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface Knowledge {
|
|
19
|
+
elements: Map<string, ElementInfo>;
|
|
20
|
+
tags: string[];
|
|
21
|
+
allEvents: Set<string>;
|
|
22
|
+
icons: string[];
|
|
23
|
+
list(): { tag: string; description: string }[];
|
|
24
|
+
get(tag: string): ElementInfo | null;
|
|
25
|
+
search(query: string, limit?: number): { tag: string; description: string; score: number }[];
|
|
26
|
+
legacy(tag: string): { tag: string; replacement: string | null; message: string } | null;
|
|
27
|
+
formatMarkdown(tag: string): string;
|
|
28
|
+
}
|
|
29
|
+
export interface Finding { line: number; column: number; severity: 'error' | 'warning'; rule: string; message: string; fix?: string }
|
|
30
|
+
export type SourceKind = 'html' | 'jsx' | 'vue' | 'js';
|
|
31
|
+
export declare const DOCS_URL: string;
|
|
32
|
+
export declare function createKnowledge(manifest: unknown): Knowledge;
|
|
33
|
+
export declare function createValidator(knowledge: Knowledge): { validate(source: string, options?: { kind?: SourceKind }): Finding[] };
|
|
34
|
+
export declare function guessKind(source: string): SourceKind;
|
|
35
|
+
export declare function enumValues(type: string | undefined): string[] | null;
|
|
36
|
+
export declare function closest(name: string, names: Iterable<string>): string | null;
|
|
37
|
+
export declare function distance(a: string, b: string): number;
|
|
38
|
+
export declare function normalizeTag(tag: string): string;
|
|
39
|
+
export declare function firstSentence(text: string): string;
|
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
// scripts/codemod-rules.mjs
|
|
2
|
+
var TAGS = {
|
|
3
|
+
"punica-tab": "punica-tabs",
|
|
4
|
+
"punica-tab-item": "punica-tab",
|
|
5
|
+
"punica-select-item": "punica-option",
|
|
6
|
+
"punica-list-view": "punica-list",
|
|
7
|
+
"punica-list-view-item": "punica-list-item",
|
|
8
|
+
"punica-progress-line": "punica-progress-bar",
|
|
9
|
+
"punica-modal": "punica-dialog",
|
|
10
|
+
"punica-modal-header": "punica-dialog-header",
|
|
11
|
+
"punica-modal-content": "punica-dialog-content",
|
|
12
|
+
"punica-modal-footer": "punica-dialog-footer",
|
|
13
|
+
"punica-single-select-list": "punica-listbox",
|
|
14
|
+
"punica-single-select-list-item": "punica-listbox-item",
|
|
15
|
+
"punica-context-menu-separator": "punica-menu-divider"
|
|
16
|
+
};
|
|
17
|
+
var REMOVED = {
|
|
18
|
+
"punica-multi-select-list": "<punica-listbox multiple>",
|
|
19
|
+
"punica-multi-select-list-item": "<punica-listbox-item>",
|
|
20
|
+
"punica-context-menu-item": '<punica-menu-item slot="menu">',
|
|
21
|
+
"punica-accordion-summary": `the accordion's slot="summary" on any element`,
|
|
22
|
+
"punica-accordion-details": "the accordion's default slot",
|
|
23
|
+
"punica-alert-icon": `the alert's slot="icon"`,
|
|
24
|
+
"punica-alert-content": "the alert's default slot",
|
|
25
|
+
"punica-alert-action": `the alert's slot="actions"`,
|
|
26
|
+
"punica-typography": "<punica-heading level> or <punica-text variant>"
|
|
27
|
+
};
|
|
28
|
+
var PALETTES = "primary|secondary|error|warning|info|success|neutral";
|
|
29
|
+
var TOKENS = [
|
|
30
|
+
[new RegExp(`--(${PALETTES})-main\\b`, "g"), "--punica-color-$1"],
|
|
31
|
+
[new RegExp(`--(${PALETTES})-(light|dark)\\b`, "g"), "--punica-color-$1-$2"],
|
|
32
|
+
[/--background-main\b/g, "--punica-color-bg"],
|
|
33
|
+
[/--background-paper\b/g, "--punica-color-surface"],
|
|
34
|
+
[/--background-backdrop\b/g, "--punica-color-backdrop"],
|
|
35
|
+
[/--backdrop-light\b/g, "--punica-color-hover"],
|
|
36
|
+
[/--text-primary\b/g, "--punica-color-text"],
|
|
37
|
+
[/--text-placeholder\b/g, "--punica-color-text-placeholder"],
|
|
38
|
+
[/--highlight\b/g, "--punica-color-focus"],
|
|
39
|
+
[/--disabled-opacity\b/g, "--punica-disabled-opacity"],
|
|
40
|
+
[/--disabled\b/g, "--punica-color-text-muted"],
|
|
41
|
+
[/--white\b/g, "--punica-color-white"],
|
|
42
|
+
[/--black\b/g, "--punica-color-black"],
|
|
43
|
+
[/--root-border-radius\b/g, "--punica-radius"],
|
|
44
|
+
[/--root-padding\b/g, "--punica-padding"],
|
|
45
|
+
[/--spacing-(\d+)\b/g, "--punica-space-$1"],
|
|
46
|
+
[/--box-shadow-(xxs|xs|sm|md|lg|xl)\b/g, "--punica-shadow-$1"],
|
|
47
|
+
[/--weight-([a-z-]+)\b/g, "--punica-font-weight-$1"],
|
|
48
|
+
[/--fontFamily\b/g, "--punica-font-family"]
|
|
49
|
+
];
|
|
50
|
+
var tagPattern = new RegExp(`(?<![\\w-])(${[...Object.keys(TAGS), ...Object.keys(REMOVED)].sort((a, b) => b.length - a.length).join("|")})(?![\\w-])`, "g");
|
|
51
|
+
|
|
52
|
+
// src/core/icons.js
|
|
53
|
+
var svg = (path) => `<svg part="icon" class="icon" viewBox="0 0 24 24" width="1em" height="1em" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false">${path}</svg>`;
|
|
54
|
+
var icons = {
|
|
55
|
+
chevronDown: svg('<path d="m6 9 6 6 6-6"/>'),
|
|
56
|
+
chevronUp: svg('<path d="m6 15 6-6 6 6"/>'),
|
|
57
|
+
/** Points to the inline end; mirror it under `:dir(rtl)`. */
|
|
58
|
+
chevronEnd: svg('<path d="m9 6 6 6-6 6"/>'),
|
|
59
|
+
/** Points to the inline start; mirror it under `:dir(rtl)`. */
|
|
60
|
+
chevronStart: svg('<path d="m15 6-6 6 6 6"/>'),
|
|
61
|
+
close: svg('<path d="M6 6l12 12M18 6 6 18"/>'),
|
|
62
|
+
check: svg('<path d="m5 12 5 5 9-10"/>'),
|
|
63
|
+
minus: svg('<path d="M5 12h14"/>'),
|
|
64
|
+
plus: svg('<path d="M12 5v14M5 12h14"/>'),
|
|
65
|
+
search: svg('<circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/>'),
|
|
66
|
+
calendar: svg('<rect x="3" y="5" width="18" height="16" rx="2"/><path d="M3 10h18M8 3v4M16 3v4"/>'),
|
|
67
|
+
clock: svg('<circle cx="12" cy="12" r="9"/><path d="M12 7v5l3 2"/>'),
|
|
68
|
+
more: svg('<circle cx="5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="19" cy="12" r="1"/>'),
|
|
69
|
+
info: svg('<circle cx="12" cy="12" r="9"/><path d="M12 11v5M12 8h.01"/>'),
|
|
70
|
+
warning: svg('<path d="M12 3 2 20h20L12 3z"/><path d="M12 10v4M12 17h.01"/>'),
|
|
71
|
+
error: svg('<circle cx="12" cy="12" r="9"/><path d="M12 7v6M12 16h.01"/>'),
|
|
72
|
+
success: svg('<circle cx="12" cy="12" r="9"/><path d="m8 12 3 3 5-6"/>'),
|
|
73
|
+
upload: svg('<path d="M12 16V4M7 9l5-5 5 5M4 20h16"/>'),
|
|
74
|
+
externalLink: svg('<path d="M14 4h6v6M20 4l-9 9M18 14v5a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1h5"/>'),
|
|
75
|
+
send: svg('<path d="M12 19V5M6 11l6-6 6 6"/>'),
|
|
76
|
+
menu: svg('<path d="M4 6h16M4 12h16M4 18h16"/>'),
|
|
77
|
+
image: svg('<rect x="3" y="4" width="18" height="16" rx="2"/><circle cx="9" cy="10" r="2"/><path d="m21 17-5-5-9 8"/>'),
|
|
78
|
+
mic: svg('<rect x="9" y="3" width="6" height="11" rx="3"/><path d="M5 11a7 7 0 0 0 14 0M12 18v3"/>'),
|
|
79
|
+
stop: svg('<rect x="6" y="6" width="12" height="12" rx="2"/>'),
|
|
80
|
+
play: svg('<path d="M8 5v14l11-7z"/>'),
|
|
81
|
+
pause: svg('<path d="M9 5v14M15 5v14"/>'),
|
|
82
|
+
copy: svg('<rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V6a2 2 0 0 1 2-2h9"/>')
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// src/ai/knowledge.mjs
|
|
86
|
+
var DOCS_URL = "https://components.punicalab.com";
|
|
87
|
+
var HIDDEN_METHODS = /* @__PURE__ */ new Set(["update", "connected", "disconnected", "firstUpdated", "formReset", "formRestore", "requestUpdate", "emit", "listen", "toggleState"]);
|
|
88
|
+
var SYNONYMS = {
|
|
89
|
+
modal: "dialog",
|
|
90
|
+
popup: "popover dialog",
|
|
91
|
+
dropdown: "select menu",
|
|
92
|
+
combobox: "autocomplete select",
|
|
93
|
+
toggle: "switch toggle",
|
|
94
|
+
checkbox: "checkbox",
|
|
95
|
+
datepicker: "date picker",
|
|
96
|
+
calendar: "calendar date",
|
|
97
|
+
spinner: "progress",
|
|
98
|
+
loader: "progress skeleton",
|
|
99
|
+
snackbar: "toast",
|
|
100
|
+
notification: "toast alert",
|
|
101
|
+
sidebar: "side nav drawer",
|
|
102
|
+
navbar: "app bar top nav",
|
|
103
|
+
header: "app bar",
|
|
104
|
+
grid: "grid table",
|
|
105
|
+
datagrid: "table",
|
|
106
|
+
tooltip: "tooltip",
|
|
107
|
+
tag: "chip tokenizer",
|
|
108
|
+
pill: "chip badge",
|
|
109
|
+
upload: "file",
|
|
110
|
+
typography: "heading text",
|
|
111
|
+
textfield: "input",
|
|
112
|
+
textbox: "input",
|
|
113
|
+
radio: "radio",
|
|
114
|
+
stepper: "stepper",
|
|
115
|
+
wizard: "stepper",
|
|
116
|
+
breadcrumbs: "breadcrumb",
|
|
117
|
+
carousel: "carousel",
|
|
118
|
+
slider: "slider range",
|
|
119
|
+
rating: "rating",
|
|
120
|
+
chat: "chat",
|
|
121
|
+
search: "search"
|
|
122
|
+
};
|
|
123
|
+
var PHRASES = {
|
|
124
|
+
"text field": "input",
|
|
125
|
+
"text input": "input",
|
|
126
|
+
"text box": "input",
|
|
127
|
+
"text area": "textarea",
|
|
128
|
+
"drop down": "dropdown",
|
|
129
|
+
"date picker": "date picker",
|
|
130
|
+
"time picker": "time picker",
|
|
131
|
+
"radio button": "radio",
|
|
132
|
+
"toggle switch": "switch",
|
|
133
|
+
"side bar": "sidebar",
|
|
134
|
+
"nav bar": "navbar",
|
|
135
|
+
"tool tip": "tooltip",
|
|
136
|
+
"progress bar": "progress",
|
|
137
|
+
"tag input": "tokenizer",
|
|
138
|
+
"tags input": "tokenizer",
|
|
139
|
+
"chip input": "tokenizer"
|
|
140
|
+
};
|
|
141
|
+
function enumValues(type) {
|
|
142
|
+
if (!type) return null;
|
|
143
|
+
const parts = type.split("|").map((p) => p.trim());
|
|
144
|
+
if (!parts.every((p) => /^'[^']*'$/.test(p))) return null;
|
|
145
|
+
return parts.map((p) => p.slice(1, -1));
|
|
146
|
+
}
|
|
147
|
+
var camel = (name) => name.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
148
|
+
function normalize(declaration, path) {
|
|
149
|
+
const d = declaration;
|
|
150
|
+
const attributes = (d.attributes || []).map((a) => {
|
|
151
|
+
const type = a.type?.text || "string";
|
|
152
|
+
return { name: a.name, property: a.fieldName || camel(a.name), type, values: enumValues(type), description: a.description || "" };
|
|
153
|
+
});
|
|
154
|
+
const attributeProps = new Set(attributes.map((a) => a.property));
|
|
155
|
+
const members = (d.members || []).filter((m) => m.privacy !== "private" && m.privacy !== "protected" && !m.static && !/^[_#]/.test(m.name));
|
|
156
|
+
return {
|
|
157
|
+
tag: d.tagName,
|
|
158
|
+
className: d.name,
|
|
159
|
+
module: path.replace(/^src\//, ""),
|
|
160
|
+
description: d.description || "",
|
|
161
|
+
attributes,
|
|
162
|
+
properties: members.filter((m) => m.kind === "field" && m.description && !attributeProps.has(m.name)).map((m) => ({ name: m.name, type: m.type?.text || "", description: m.description, readonly: !!m.readonly })),
|
|
163
|
+
methods: members.filter((m) => m.kind === "method" && m.description && !HIDDEN_METHODS.has(m.name)).map((m) => ({
|
|
164
|
+
name: m.name,
|
|
165
|
+
signature: `${m.name}(${(m.parameters || []).map((p) => p.name + (p.optional ? "?" : "")).join(", ")})`,
|
|
166
|
+
description: m.description
|
|
167
|
+
})),
|
|
168
|
+
events: (d.events || []).filter((e) => e.name).map((e) => ({ name: e.name, description: e.description || "" })),
|
|
169
|
+
slots: (d.slots || []).map((s) => ({ name: s.name || "", description: s.description || "" })),
|
|
170
|
+
// Attributes the element reads off its children, as its slot docs say:
|
|
171
|
+
// "Each may carry `span`".
|
|
172
|
+
childAttributes: [...new Set((d.slots || []).flatMap((s) => [...(s.description || "").matchAll(/may carry `([a-z-]+)`/g)].map((m) => m[1])))],
|
|
173
|
+
parts: (d.cssParts || []).map((p) => ({ name: p.name, description: p.description || "" })),
|
|
174
|
+
cssProperties: (d.cssProperties || []).map((p) => ({ name: p.name, description: p.description || "" })),
|
|
175
|
+
states: (d.cssStates || []).map((s) => ({ name: s.name, description: s.description || "" }))
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function distance(a, b) {
|
|
179
|
+
const row = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
180
|
+
for (let i = 1; i <= a.length; i++) {
|
|
181
|
+
let prev = row[0];
|
|
182
|
+
row[0] = i;
|
|
183
|
+
for (let j = 1; j <= b.length; j++) {
|
|
184
|
+
const next = Math.min(row[j] + 1, row[j - 1] + 1, prev + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
185
|
+
prev = row[j];
|
|
186
|
+
row[j] = next;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return row[b.length];
|
|
190
|
+
}
|
|
191
|
+
function closest(name, names) {
|
|
192
|
+
let best = null;
|
|
193
|
+
let bestDistance = Infinity;
|
|
194
|
+
for (const candidate of names) {
|
|
195
|
+
const d = distance(name, candidate);
|
|
196
|
+
if (d < bestDistance) [best, bestDistance] = [candidate, d];
|
|
197
|
+
}
|
|
198
|
+
return best && bestDistance <= Math.max(2, Math.floor(name.length / 3)) ? best : null;
|
|
199
|
+
}
|
|
200
|
+
function createKnowledge(manifest) {
|
|
201
|
+
const elements = /* @__PURE__ */ new Map();
|
|
202
|
+
for (const mod of manifest.modules || []) {
|
|
203
|
+
for (const d of mod.declarations || []) {
|
|
204
|
+
if (d.kind === "class" && d.tagName) elements.set(d.tagName, normalize(d, mod.path));
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
const tags = [...elements.keys()].sort();
|
|
208
|
+
const allEvents = new Set([...elements.values()].flatMap((e) => e.events.map((ev) => ev.name)));
|
|
209
|
+
const icons2 = Object.keys(icons);
|
|
210
|
+
function legacy(tag) {
|
|
211
|
+
if (TAGS[tag]) return { tag, replacement: TAGS[tag], message: `${tag} is the 1.x name: use <${TAGS[tag]}>` };
|
|
212
|
+
if (REMOVED[tag]) return { tag, replacement: null, message: `${tag} was removed in 2.0: use ${REMOVED[tag]}` };
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
function list() {
|
|
216
|
+
return tags.map((tag) => ({ tag, description: firstSentence(elements.get(tag).description) }));
|
|
217
|
+
}
|
|
218
|
+
function get(tag) {
|
|
219
|
+
return elements.get(normalizeTag(tag)) || null;
|
|
220
|
+
}
|
|
221
|
+
function search(query, limit = 10) {
|
|
222
|
+
const words = expand(query);
|
|
223
|
+
if (!words.length) return [];
|
|
224
|
+
const scored = [];
|
|
225
|
+
for (const element of elements.values()) {
|
|
226
|
+
const tagWords = element.tag.replace(/^punica-/, "").split("-");
|
|
227
|
+
const text = element.description.toLowerCase();
|
|
228
|
+
const api = [...element.attributes.map((a) => a.name), ...element.events.map((e) => e.name), ...element.slots.map((s) => s.name)].join(" ");
|
|
229
|
+
let score = 0;
|
|
230
|
+
for (const { word, weight } of words) {
|
|
231
|
+
let s = 0;
|
|
232
|
+
if (tagWords.includes(word)) s += 6;
|
|
233
|
+
else if (tagWords.some((t) => t.startsWith(word) || word.startsWith(t))) s += 3;
|
|
234
|
+
if (new RegExp(`\\b${escape(word)}`).test(text)) s += 2;
|
|
235
|
+
if (api.includes(word)) s += 1;
|
|
236
|
+
score += s * weight;
|
|
237
|
+
}
|
|
238
|
+
if (!score) continue;
|
|
239
|
+
const typed = new Set(words.filter((w) => w.weight === 1).map((w) => w.word.replace(/s$/, "")));
|
|
240
|
+
if (tagWords.every((t) => typed.has(t.replace(/s$/, "")))) score += 5 * tagWords.length;
|
|
241
|
+
const part = /^(?:the |one |a |an )?[^.]*?\b(?:of|in|for|inside) (?:a|an|the) `punica-/i.test(firstSentence(element.description)) ? 4 : 0;
|
|
242
|
+
scored.push({ tag: element.tag, description: firstSentence(element.description), score: score - part - tagWords.length * 0.1 });
|
|
243
|
+
}
|
|
244
|
+
return scored.sort((a, b) => b.score - a.score).slice(0, limit);
|
|
245
|
+
}
|
|
246
|
+
function formatMarkdown(tag) {
|
|
247
|
+
const e = get(tag);
|
|
248
|
+
if (!e) {
|
|
249
|
+
const old = legacy(normalizeTag(tag));
|
|
250
|
+
if (old) return old.message;
|
|
251
|
+
const guess = closest(normalizeTag(tag), tags);
|
|
252
|
+
return `No element ${normalizeTag(tag)}.${guess ? ` Did you mean ${guess}?` : ""}`;
|
|
253
|
+
}
|
|
254
|
+
const lines = [`## <${e.tag}>`, "", e.description, "", `Import: \`import '@punica/components/${e.module}';\` or \`import '@punica/components';\``];
|
|
255
|
+
const table = (title, head, rows) => {
|
|
256
|
+
if (!rows.length) return;
|
|
257
|
+
lines.push("", `### ${title}`, "", `| ${head.join(" | ")} |`, `|${head.map(() => "---").join("|")}|`, ...rows.map((r) => `| ${r.map(cell).join(" | ")} |`));
|
|
258
|
+
};
|
|
259
|
+
table("Attributes", ["Attribute", "Property", "Type", "Description"], e.attributes.map((a) => [`\`${a.name}\``, `\`${a.property}\``, `\`${a.type}\``, a.description]));
|
|
260
|
+
table("Properties (no attribute)", ["Property", "Type", "Description"], e.properties.map((p) => [`\`${p.name}\``, p.type ? `\`${p.type}\`` : "", (p.readonly ? "Read-only. " : "") + p.description]));
|
|
261
|
+
table("Methods", ["Method", "Description"], e.methods.map((m) => [`\`${m.signature}\``, m.description]));
|
|
262
|
+
table("Events", ["Event", "Description"], e.events.map((ev) => [`\`${ev.name}\``, ev.description]));
|
|
263
|
+
table("Slots", ["Slot", "Description"], e.slots.map((s) => [s.name ? `\`${s.name}\`` : "(default)", s.description]));
|
|
264
|
+
table("CSS parts", ["Part", "Description"], e.parts.map((p) => [`\`${p.name}\``, p.description]));
|
|
265
|
+
table("CSS custom properties", ["Property", "Description"], e.cssProperties.map((p) => [`\`${p.name}\``, p.description]));
|
|
266
|
+
if (e.tag === "punica-icon") lines.push("", `### Icon names`, "", icons2.map((i) => `\`${i}\``).join(", ") + ". Any other name draws nothing: slot an `<svg>` instead.");
|
|
267
|
+
table("Custom states", ["State", "Description"], e.states.map((s) => [`\`:state(${s.name})\``, s.description]));
|
|
268
|
+
return lines.join("\n");
|
|
269
|
+
}
|
|
270
|
+
return { elements, tags, allEvents, icons: icons2, list, get, search, legacy, formatMarkdown };
|
|
271
|
+
}
|
|
272
|
+
function normalizeTag(tag) {
|
|
273
|
+
const t = String(tag).trim().toLowerCase().replace(/^<|\/?>$/g, "");
|
|
274
|
+
return t.startsWith("punica-") ? t : `punica-${t}`;
|
|
275
|
+
}
|
|
276
|
+
function firstSentence(text) {
|
|
277
|
+
const match = /^[\s\S]*?[.!?](?=\s|$)/.exec(text || "");
|
|
278
|
+
return (match ? match[0] : text || "").replace(/\s+/g, " ").trim();
|
|
279
|
+
}
|
|
280
|
+
function expand(query) {
|
|
281
|
+
let text = String(query).toLowerCase().replace(/<?punica-/g, "");
|
|
282
|
+
for (const [phrase, word] of Object.entries(PHRASES)) text = text.replaceAll(phrase, ` ${word} `);
|
|
283
|
+
const words = text.split(/[^a-z0-9]+/).filter((w) => w.length > 1);
|
|
284
|
+
const out = new Map(words.map((w) => [w, 1]));
|
|
285
|
+
for (const w of words) (SYNONYMS[w] || "").split(" ").filter(Boolean).forEach((s, i) => !out.has(s) && out.set(s, i === 0 ? 0.6 : 0.5));
|
|
286
|
+
return [...out].map(([word, weight]) => ({ word, weight }));
|
|
287
|
+
}
|
|
288
|
+
function escape(text) {
|
|
289
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
290
|
+
}
|
|
291
|
+
function cell(text) {
|
|
292
|
+
return String(text).replace(/\|/g, "\\|").replace(/\n+/g, " ");
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// src/ai/validate.mjs
|
|
296
|
+
var GLOBAL_ATTRIBUTES = new Set(
|
|
297
|
+
"accesskey autocapitalize autofocus class contenteditable dir draggable enterkeyhint exportparts hidden id inert inputmode is itemid itemprop itemref itemscope itemtype lang nonce part popover popovertarget popovertargetaction role slot spellcheck style tabindex title translate writingsuggestions".split(
|
|
298
|
+
" "
|
|
299
|
+
)
|
|
300
|
+
);
|
|
301
|
+
var JSX_PROPS = new Set("key ref className class htmlFor style children dangerouslySetInnerHTML suppressHydrationWarning suppressContentEditableWarning tabIndex".split(" "));
|
|
302
|
+
var NATIVE_PASS_THROUGH = new Set(
|
|
303
|
+
"click dblclick auxclick contextmenu focus blur focusin focusout keydown keyup keypress pointerdown pointerup pointermove pointerenter pointerleave pointerover pointerout pointercancel mousedown mouseup mousemove mouseenter mouseleave mouseover mouseout wheel touchstart touchend touchmove touchcancel dragstart drag dragend dragenter dragleave dragover drop scroll scrollend copy cut paste animationstart animationend transitionend gotpointercapture lostpointercapture submit reset formdata invalid".split(
|
|
304
|
+
" "
|
|
305
|
+
)
|
|
306
|
+
);
|
|
307
|
+
var SYNTHETIC = /* @__PURE__ */ new Set(["change", "input", "select", "open", "close", "toggle", "dismiss"]);
|
|
308
|
+
var VOID = new Set("area base br col embed hr img input link meta param source track wbr".split(" "));
|
|
309
|
+
var RAW_TEXT = /* @__PURE__ */ new Set(["script", "style", "textarea", "title"]);
|
|
310
|
+
var camelToKebab = (name) => name.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`);
|
|
311
|
+
function createValidator(knowledge) {
|
|
312
|
+
function validate(source, options = {}) {
|
|
313
|
+
const text = String(source);
|
|
314
|
+
const kind = options.kind || guessKind(text);
|
|
315
|
+
const findings = [];
|
|
316
|
+
const lineStarts = [0];
|
|
317
|
+
for (let i = 0; i < text.length; i++) if (text[i] === "\n") lineStarts.push(i + 1);
|
|
318
|
+
const where = (offset) => {
|
|
319
|
+
let lo = 0;
|
|
320
|
+
let hi = lineStarts.length - 1;
|
|
321
|
+
while (lo < hi) {
|
|
322
|
+
const mid = lo + hi + 1 >> 1;
|
|
323
|
+
if (lineStarts[mid] <= offset) lo = mid;
|
|
324
|
+
else hi = mid - 1;
|
|
325
|
+
}
|
|
326
|
+
return { line: lo + 1, column: offset - lineStarts[lo] + 1 };
|
|
327
|
+
};
|
|
328
|
+
const report = (offset, severity, rule, message, fix) => findings.push({ ...where(offset), severity, rule, message, ...fix ? { fix } : {} });
|
|
329
|
+
const usesPunica = /punica-/.test(text);
|
|
330
|
+
if (kind !== "js") scanMarkup(text, kind, report);
|
|
331
|
+
scanScript(text, usesPunica, report);
|
|
332
|
+
return findings.sort((a, b) => a.line - b.line || a.column - b.column);
|
|
333
|
+
}
|
|
334
|
+
function scanMarkup(text, kind, report) {
|
|
335
|
+
const stack = [];
|
|
336
|
+
const tagRe = /<(\/?)([A-Za-z][\w.:-]*)/g;
|
|
337
|
+
let match;
|
|
338
|
+
while (match = tagRe.exec(text)) {
|
|
339
|
+
const offset = match.index;
|
|
340
|
+
const commentStart = text.lastIndexOf("<!--", offset);
|
|
341
|
+
if (commentStart !== -1 && text.indexOf("-->", commentStart) > offset) {
|
|
342
|
+
tagRe.lastIndex = text.indexOf("-->", commentStart) + 3;
|
|
343
|
+
continue;
|
|
344
|
+
}
|
|
345
|
+
const closing = match[1] === "/";
|
|
346
|
+
const rawName = match[2];
|
|
347
|
+
const name = kind === "jsx" ? rawName : rawName.toLowerCase();
|
|
348
|
+
if (closing) {
|
|
349
|
+
const i = findLast(stack, (s) => s.tag === name);
|
|
350
|
+
if (i !== -1) stack.length = i;
|
|
351
|
+
const end2 = text.indexOf(">", tagRe.lastIndex);
|
|
352
|
+
tagRe.lastIndex = end2 === -1 ? text.length : end2 + 1;
|
|
353
|
+
continue;
|
|
354
|
+
}
|
|
355
|
+
const { attributes, end, selfClosing } = readAttributes(text, tagRe.lastIndex, kind);
|
|
356
|
+
tagRe.lastIndex = end;
|
|
357
|
+
const parent = stack[stack.length - 1]?.tag;
|
|
358
|
+
checkElement(name, offset, attributes, parent, kind, report);
|
|
359
|
+
if (RAW_TEXT.has(name.toLowerCase()) && !selfClosing) {
|
|
360
|
+
const close = text.toLowerCase().indexOf(`</${name.toLowerCase()}`, end);
|
|
361
|
+
tagRe.lastIndex = close === -1 ? text.length : close;
|
|
362
|
+
continue;
|
|
363
|
+
}
|
|
364
|
+
if (!selfClosing && !VOID.has(name.toLowerCase())) stack.push({ tag: name });
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function checkElement(name, offset, attributes, parent, kind, report) {
|
|
368
|
+
const tag = name.toLowerCase();
|
|
369
|
+
if (!tag.startsWith("punica-")) {
|
|
370
|
+
checkSlot(attributes, parent, report);
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
const element = knowledge.get(tag);
|
|
374
|
+
if (!element) {
|
|
375
|
+
const old = knowledge.legacy(tag);
|
|
376
|
+
if (old) report(offset, "error", "legacy-tag", old.message, old.replacement || void 0);
|
|
377
|
+
else {
|
|
378
|
+
const guess = closest(tag, knowledge.tags);
|
|
379
|
+
report(offset, "error", "unknown-tag", `<${tag}> is not a punica element.${guess ? ` Did you mean <${guess}>?` : " Search with `punica-components search`."}`, guess || void 0);
|
|
380
|
+
}
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
const byName = new Map(element.attributes.map((a) => [a.name, a]));
|
|
384
|
+
const byProperty = new Map(element.attributes.map((a) => [a.property, a]));
|
|
385
|
+
const properties = /* @__PURE__ */ new Set([...element.properties.map((p) => p.name), ...element.attributes.map((a) => a.property)]);
|
|
386
|
+
const events = new Set(element.events.map((e) => e.name));
|
|
387
|
+
const parentElement = parent ? knowledge.get(parent.toLowerCase()) : null;
|
|
388
|
+
for (const attr of attributes) {
|
|
389
|
+
let attrName = attr.name;
|
|
390
|
+
const at = attr.offset;
|
|
391
|
+
if (kind === "vue" || /^[@:.]|^v-/.test(attrName)) {
|
|
392
|
+
const vueEvent = /^(?:@|v-on:)([\w-]+)/.exec(attrName);
|
|
393
|
+
if (vueEvent) {
|
|
394
|
+
checkEventName(vueEvent[1], element, events, at, report);
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
397
|
+
if (/^v-(?!bind:)/.test(attrName)) continue;
|
|
398
|
+
const bound = /^(?::|v-bind:|\.)([\w-]+)/.exec(attrName);
|
|
399
|
+
if (bound) {
|
|
400
|
+
attrName = bound[1];
|
|
401
|
+
if (properties.has(attrName) || byName.has(attrName) || isGlobal(attrName)) continue;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (kind === "jsx") {
|
|
405
|
+
if (JSX_PROPS.has(attrName)) continue;
|
|
406
|
+
const reactEvent = /^on([A-Z]\w*|-?[a-z][\w-]*)$/.exec(attrName);
|
|
407
|
+
if (reactEvent && !byName.has(attrName)) {
|
|
408
|
+
const raw = reactEvent[1];
|
|
409
|
+
if (/^[A-Z]/.test(raw)) {
|
|
410
|
+
const lower2 = raw.toLowerCase();
|
|
411
|
+
if (NATIVE_PASS_THROUGH.has(lower2) || lower2 === "doubleclick") continue;
|
|
412
|
+
if (SYNTHETIC.has(lower2) || /^punica/.test(lower2)) {
|
|
413
|
+
const real = /^punica/.test(lower2) ? camelToKebab(raw[0].toLowerCase() + raw.slice(1)) : `punica-${lower2}`;
|
|
414
|
+
report(at, "error", "react-event", `${attrName} never fires: <${element.tag}> dispatches \`${real}\`. In React 19 write on${real}={\u2026}; in React 18 add a listener in an effect.`, `on${real}`);
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
417
|
+
report(at, "warning", "react-event", `${attrName}: <${element.tag}> has no such event.`);
|
|
418
|
+
continue;
|
|
419
|
+
}
|
|
420
|
+
checkEventName(raw.replace(/^-/, ""), element, events, at, report);
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
if (byProperty.has(attrName)) {
|
|
424
|
+
checkValue(byProperty.get(attrName), attr, element, report);
|
|
425
|
+
continue;
|
|
426
|
+
}
|
|
427
|
+
if (properties.has(attrName)) continue;
|
|
428
|
+
}
|
|
429
|
+
if (isGlobal(attrName)) continue;
|
|
430
|
+
if (kind !== "jsx" && /^on[a-z]/.test(attrName)) continue;
|
|
431
|
+
if (parentElement?.childAttributes.includes(attrName.toLowerCase())) continue;
|
|
432
|
+
const lower = attrName.toLowerCase();
|
|
433
|
+
const spec = byName.get(lower);
|
|
434
|
+
if (!spec) {
|
|
435
|
+
const kebab = camelToKebab(attrName);
|
|
436
|
+
const byCamel = byProperty.get(attrName) || byName.get(kebab);
|
|
437
|
+
if (byCamel) {
|
|
438
|
+
report(at, "error", "attribute-case", `\`${attrName}\` on <${element.tag}>: the attribute is \`${byCamel.name}\` (HTML lowercases \`${attrName}\` to \`${lower}\`).`, byCamel.name);
|
|
439
|
+
} else if (byName.has(lower.replace(/^(\w+?)(width|height|size|level|label|text|icon|value)$/, "$1-$2"))) {
|
|
440
|
+
const fixed = lower.replace(/^(\w+?)(width|height|size|level|label|text|icon|value)$/, "$1-$2");
|
|
441
|
+
report(at, "error", "attribute-case", `\`${attrName}\` on <${element.tag}>: the attribute is \`${fixed}\`.`, fixed);
|
|
442
|
+
} else if (properties.has(attrName)) {
|
|
443
|
+
report(at, "error", "property-as-attribute", `\`${attrName}\` on <${element.tag}> is a property with no attribute: set it from script (\`el.${attrName} = \u2026\`).`);
|
|
444
|
+
} else {
|
|
445
|
+
const guess = closest(lower, [...byName.keys()]);
|
|
446
|
+
report(at, "error", "unknown-attribute", `<${element.tag}> has no attribute \`${attrName}\`.${guess ? ` Did you mean \`${guess}\`?` : ""} Its attributes: ${[...byName.keys()].join(", ") || "none"}.`, guess || void 0);
|
|
447
|
+
}
|
|
448
|
+
continue;
|
|
449
|
+
}
|
|
450
|
+
checkValue(spec, attr, element, report);
|
|
451
|
+
}
|
|
452
|
+
checkSlot(attributes, parent, report);
|
|
453
|
+
}
|
|
454
|
+
function checkValue(spec, attr, element, report) {
|
|
455
|
+
if (attr.value === null || attr.dynamic) return;
|
|
456
|
+
const value = attr.value;
|
|
457
|
+
if (element.tag === "punica-icon" && spec.name === "name" && !knowledge.icons.includes(value)) {
|
|
458
|
+
const guess = closest(value, knowledge.icons);
|
|
459
|
+
report(attr.offset, "error", "unknown-icon", `<punica-icon name="${value}"> draws nothing: the built-in glyphs are ${knowledge.icons.join(", ")}. For any other icon, slot an <svg> into <punica-icon>.`, guess || void 0);
|
|
460
|
+
}
|
|
461
|
+
if (spec.values) {
|
|
462
|
+
if (!spec.values.includes(value)) {
|
|
463
|
+
const guess = closest(value, spec.values);
|
|
464
|
+
report(attr.offset, "error", "invalid-value", `\`${spec.name}="${value}"\` on <${element.tag}>: one of ${spec.values.map((v) => `\`${v}\``).join(", ")}.`, guess || void 0);
|
|
465
|
+
}
|
|
466
|
+
} else if (spec.type === "boolean") {
|
|
467
|
+
if (value === "false") report(attr.offset, "warning", "boolean-false", `\`${spec.name}="false"\` still means ${spec.name}: a boolean attribute is on when present. Leave it out.`);
|
|
468
|
+
} else if (spec.type === "number" && value.trim() !== "" && Number.isNaN(Number(value))) {
|
|
469
|
+
report(attr.offset, "error", "invalid-value", `\`${spec.name}="${value}"\` on <${element.tag}> should be a number.`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
function checkSlot(attributes, parent, report) {
|
|
473
|
+
const slot = attributes.find((a) => a.name === "slot");
|
|
474
|
+
if (!slot || slot.value === null || slot.dynamic || !parent || !parent.toLowerCase().startsWith("punica-")) return;
|
|
475
|
+
const element = knowledge.get(parent.toLowerCase());
|
|
476
|
+
if (!element || !element.slots.length) return;
|
|
477
|
+
const names = element.slots.map((s) => s.name).filter(Boolean);
|
|
478
|
+
if (names.includes(slot.value)) return;
|
|
479
|
+
const old = { startIcon: "start", endIcon: "end", startAdornment: "start", endAdornment: "end" }[slot.value];
|
|
480
|
+
const guess = old && names.includes(old) ? old : closest(slot.value, names);
|
|
481
|
+
report(slot.offset, "error", "unknown-slot", `<${element.tag}> has no slot \`${slot.value}\`.${guess ? ` Did you mean \`${guess}\`?` : ""} Its named slots: ${names.join(", ") || "none (default slot only)"}.`, guess || void 0);
|
|
482
|
+
}
|
|
483
|
+
function checkEventName(name, element, events, offset, report) {
|
|
484
|
+
if (events.has(name) || NATIVE_PASS_THROUGH.has(name)) return;
|
|
485
|
+
if (SYNTHETIC.has(name) && events.has(`punica-${name}`)) {
|
|
486
|
+
report(offset, "error", "native-event-name", `<${element.tag}> fires \`punica-${name}\`, not \`${name}\`.`, `punica-${name}`);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
const guess = closest(name, [...events]);
|
|
490
|
+
report(offset, events.size || name.startsWith("punica-") ? "error" : "warning", "unknown-event", `<${element.tag}> fires no \`${name}\`.${guess ? ` Did you mean \`${guess}\`?` : ""} Its events: ${[...events].join(", ") || "none of its own"}.`, guess || void 0);
|
|
491
|
+
}
|
|
492
|
+
function scanScript(text, usesPunica, report) {
|
|
493
|
+
const listenerRe = /\b(?:addEventListener|removeEventListener)\(\s*(['"`])([\w:-]+)\1/g;
|
|
494
|
+
let match;
|
|
495
|
+
while (match = listenerRe.exec(text)) {
|
|
496
|
+
const name = match[2];
|
|
497
|
+
const offset = match.index + match[0].indexOf(name);
|
|
498
|
+
if (name.startsWith("punica-")) {
|
|
499
|
+
if (!knowledge.allEvents.has(name)) {
|
|
500
|
+
const guess = closest(name, [...knowledge.allEvents]);
|
|
501
|
+
if (guess) report(offset, "error", "unknown-event", `No punica element fires \`${name}\`. Did you mean \`${guess}\`?`, guess);
|
|
502
|
+
else report(offset, "warning", "unknown-event", `No punica element fires \`${name}\`; fine if it is your own event.`);
|
|
503
|
+
}
|
|
504
|
+
} else if (usesPunica && SYNTHETIC.has(name)) {
|
|
505
|
+
report(offset, "warning", "native-event-name", `Punica elements fire \`punica-${name}\`, never \`${name}\`; a listener for \`${name}\` on one never runs.`, `punica-${name}`);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
const tagInScript = /(?:createElement|querySelector(?:All)?|closest|customElements\.(?:get|whenDefined))\(\s*(['"`])([^'"`]*?)\1/g;
|
|
509
|
+
while (match = tagInScript.exec(text)) {
|
|
510
|
+
for (const found of match[2].matchAll(/punica-[a-z0-9-]+/g)) {
|
|
511
|
+
const tag = found[0];
|
|
512
|
+
if (knowledge.get(tag)) continue;
|
|
513
|
+
const offset = match.index + match[0].indexOf(match[2]) + found.index;
|
|
514
|
+
const old = knowledge.legacy(tag);
|
|
515
|
+
if (old) report(offset, "error", "legacy-tag", old.message, old.replacement || void 0);
|
|
516
|
+
else {
|
|
517
|
+
const guess = closest(tag, knowledge.tags);
|
|
518
|
+
report(offset, "error", "unknown-tag", `${tag} is not a punica element.${guess ? ` Did you mean ${guess}?` : ""}`, guess || void 0);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
const toast = /\bwindow\.Toast\b|\bToast\.(?:show|success|error|info|warning)\(/g;
|
|
523
|
+
while (match = toast.exec(text)) report(match.index, "error", "legacy-api", "The global `Toast` is 1.x: `import { toast } from '@punica/components'`.");
|
|
524
|
+
const bundle = /build\.min\.js/g;
|
|
525
|
+
while (match = bundle.exec(text)) report(match.index, "error", "legacy-api", "`build.min.js` is 1.x: load `@punica/components` or `dist/punica-components.min.js`.");
|
|
526
|
+
}
|
|
527
|
+
return { validate };
|
|
528
|
+
}
|
|
529
|
+
function readAttributes(text, start, kind) {
|
|
530
|
+
const attributes = [];
|
|
531
|
+
let i = start;
|
|
532
|
+
const n = text.length;
|
|
533
|
+
while (i < n) {
|
|
534
|
+
while (i < n && /\s/.test(text[i])) i++;
|
|
535
|
+
if (text[i] === ">") return { attributes, end: i + 1, selfClosing: false };
|
|
536
|
+
if (text[i] === "/" && text[i + 1] === ">") return { attributes, end: i + 2, selfClosing: true };
|
|
537
|
+
if (text[i] === "{") {
|
|
538
|
+
i = skipBraces(text, i);
|
|
539
|
+
continue;
|
|
540
|
+
}
|
|
541
|
+
const nameStart = i;
|
|
542
|
+
while (i < n && !/[\s=>]/.test(text[i]) && !(text[i] === "/" && text[i + 1] === ">")) i++;
|
|
543
|
+
const name = text.slice(nameStart, i);
|
|
544
|
+
if (!name) {
|
|
545
|
+
i++;
|
|
546
|
+
continue;
|
|
547
|
+
}
|
|
548
|
+
while (i < n && /\s/.test(text[i])) i++;
|
|
549
|
+
let value = null;
|
|
550
|
+
let dynamic = false;
|
|
551
|
+
if (text[i] === "=") {
|
|
552
|
+
i++;
|
|
553
|
+
while (i < n && /\s/.test(text[i])) i++;
|
|
554
|
+
const quote = text[i];
|
|
555
|
+
if (quote === '"' || quote === "'") {
|
|
556
|
+
const close = text.indexOf(quote, i + 1);
|
|
557
|
+
value = text.slice(i + 1, close === -1 ? n : close);
|
|
558
|
+
i = close === -1 ? n : close + 1;
|
|
559
|
+
dynamic = /\$\{|\{\{/.test(value);
|
|
560
|
+
} else if (quote === "{" && kind !== "html") {
|
|
561
|
+
const end = skipBraces(text, i);
|
|
562
|
+
const expr = text.slice(i + 1, end - 1).trim();
|
|
563
|
+
const literal = /^(['"`])([^'"`$]*)\1$/.exec(expr);
|
|
564
|
+
if (literal) value = literal[2];
|
|
565
|
+
else dynamic = true;
|
|
566
|
+
i = end;
|
|
567
|
+
} else {
|
|
568
|
+
const valueStart = i;
|
|
569
|
+
while (i < n && !/[\s>]/.test(text[i])) i++;
|
|
570
|
+
value = text.slice(valueStart, i);
|
|
571
|
+
dynamic = /\$\{|\{/.test(value);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
if (!/[${}]/.test(name)) attributes.push({ name, value, dynamic, offset: nameStart });
|
|
575
|
+
}
|
|
576
|
+
return { attributes, end: n, selfClosing: false };
|
|
577
|
+
}
|
|
578
|
+
function skipBraces(text, i) {
|
|
579
|
+
let depth = 0;
|
|
580
|
+
for (; i < text.length; i++) {
|
|
581
|
+
const c = text[i];
|
|
582
|
+
if (c === "{") depth++;
|
|
583
|
+
else if (c === "}" && --depth === 0) return i + 1;
|
|
584
|
+
else if (c === '"' || c === "'" || c === "`") {
|
|
585
|
+
const close = text.indexOf(c, i + 1);
|
|
586
|
+
if (close === -1) return text.length;
|
|
587
|
+
i = close;
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
return text.length;
|
|
591
|
+
}
|
|
592
|
+
function isGlobal(name) {
|
|
593
|
+
return GLOBAL_ATTRIBUTES.has(name) || /^(aria|data)-/.test(name) || name === "xmlns" || name.startsWith("xml:");
|
|
594
|
+
}
|
|
595
|
+
function findLast(array, test) {
|
|
596
|
+
for (let i = array.length - 1; i >= 0; i--) if (test(array[i])) return i;
|
|
597
|
+
return -1;
|
|
598
|
+
}
|
|
599
|
+
function guessKind(text) {
|
|
600
|
+
if (/<template[\s>]/.test(text) && /\s(?:@[\w-]+|v-[\w-]+|:[\w-]+)=/.test(text)) return "vue";
|
|
601
|
+
if (/\bclassName=|=\{|from\s+['"]react['"]|useState\(|useEffect\(/.test(text)) return "jsx";
|
|
602
|
+
if (!/<[a-zA-Z]/.test(text)) return "js";
|
|
603
|
+
return "html";
|
|
604
|
+
}
|
|
605
|
+
export {
|
|
606
|
+
DOCS_URL,
|
|
607
|
+
closest,
|
|
608
|
+
createKnowledge,
|
|
609
|
+
createValidator,
|
|
610
|
+
distance,
|
|
611
|
+
enumValues,
|
|
612
|
+
firstSentence,
|
|
613
|
+
guessKind,
|
|
614
|
+
normalizeTag
|
|
615
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Knowledge, Finding, SourceKind } from './index.js';
|
|
2
|
+
export * from './index.js';
|
|
3
|
+
/** The package's own custom-elements.json, read once. */
|
|
4
|
+
export declare const knowledge: Knowledge;
|
|
5
|
+
export declare function validate(source: string, options?: { kind?: SourceKind }): Finding[];
|