@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,304 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormControl
|
|
3
|
+
} from "./chunk-HW2CN2JV.js";
|
|
4
|
+
import {
|
|
5
|
+
createTypeahead,
|
|
6
|
+
isRtl,
|
|
7
|
+
nextIndex,
|
|
8
|
+
setRovingTabindex
|
|
9
|
+
} from "./chunk-4RURT4SK.js";
|
|
10
|
+
import {
|
|
11
|
+
PunicaElement,
|
|
12
|
+
define
|
|
13
|
+
} from "./chunk-Y7B65FYJ.js";
|
|
14
|
+
|
|
15
|
+
// src/components/listbox/listbox.css
|
|
16
|
+
var listbox_default = ":host {\n --punica-listbox-background: var(--punica-color-surface);\n --punica-listbox-padding: var(--punica-space-8);\n --punica-listbox-radius: var(--punica-radius);\n --punica-listbox-max-height: none;\n --punica-listbox-border-color: var(--punica-color-border);\n\n display: block;\n max-block-size: var(--punica-listbox-max-height);\n padding-block: var(--punica-listbox-padding);\n overflow-y: auto;\n border: var(--punica-border-width) solid var(--punica-listbox-border-color);\n border-radius: var(--punica-listbox-radius);\n background: var(--punica-listbox-background);\n color: var(--punica-color-text);\n font-family: var(--punica-font-family);\n}\n\n:host([orientation='horizontal']) {\n display: flex;\n padding-block: 0;\n padding-inline: var(--punica-listbox-padding);\n overflow: auto hidden;\n}\n\n:host([disabled]),\n:host(:state(disabled)) {\n opacity: var(--punica-disabled-opacity);\n}\n\n:host([disabled]) ::slotted(*),\n:host(:state(disabled)) ::slotted(*) {\n cursor: default;\n pointer-events: none;\n}\n\n@media (forced-colors: active) {\n :host {\n border: var(--punica-border-width) solid CanvasText;\n }\n :host([disabled]),\n :host(:state(disabled)) {\n color: GrayText;\n opacity: 1;\n }\n}\n";
|
|
17
|
+
|
|
18
|
+
// src/components/listbox/listbox.js
|
|
19
|
+
var PunicaListbox = class extends FormControl(PunicaElement) {
|
|
20
|
+
static properties = {
|
|
21
|
+
value: { type: Object, attribute: false },
|
|
22
|
+
defaultValue: { attribute: "value", reflect: false },
|
|
23
|
+
multiple: { type: Boolean },
|
|
24
|
+
label: {},
|
|
25
|
+
orientation: { default: "vertical" }
|
|
26
|
+
};
|
|
27
|
+
static styles = listbox_default;
|
|
28
|
+
static template = `<slot></slot>`;
|
|
29
|
+
#dirty = false;
|
|
30
|
+
/** The value this element last wrote itself. */
|
|
31
|
+
#written = null;
|
|
32
|
+
#first = true;
|
|
33
|
+
/** Default selection read from the items' `selected` attributes. */
|
|
34
|
+
#itemDefault = [];
|
|
35
|
+
/** @type {HTMLElement | null} */
|
|
36
|
+
#anchor = null;
|
|
37
|
+
#typeahead = createTypeahead();
|
|
38
|
+
constructor() {
|
|
39
|
+
super();
|
|
40
|
+
this.internals.role = "listbox";
|
|
41
|
+
this.$("slot").addEventListener("slotchange", () => this.requestUpdate());
|
|
42
|
+
this.addEventListener("click", (event) => {
|
|
43
|
+
if (event.target === this) {
|
|
44
|
+
this.focus();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const item = this.#itemOf(event);
|
|
48
|
+
if (!item || this.isDisabled || item.hasAttribute("disabled")) return;
|
|
49
|
+
this.#setActive(item);
|
|
50
|
+
if (this.multiple && event.shiftKey && this.#anchor) {
|
|
51
|
+
this.#selectRange(this.#anchor, item);
|
|
52
|
+
} else {
|
|
53
|
+
this.#anchor = item;
|
|
54
|
+
if (this.multiple) this.#toggle(item);
|
|
55
|
+
else this.#commit([this.#valueOf(item)]);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
this.addEventListener("keydown", (event) => this.#onKeydown(event));
|
|
59
|
+
this.addEventListener("focusin", (event) => {
|
|
60
|
+
const item = this.#itemOf(event);
|
|
61
|
+
if (item) this.#setActive(item);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** The options, in order. */
|
|
65
|
+
get items() {
|
|
66
|
+
return (
|
|
67
|
+
/** @type {HTMLElement[]} */
|
|
68
|
+
[...this.children].filter((el) => el.localName === "punica-listbox-item")
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
/** The selected options, in order. */
|
|
72
|
+
get selectedItems() {
|
|
73
|
+
const values = this.#values();
|
|
74
|
+
return this.items.filter((item) => values.includes(this.#valueOf(item)));
|
|
75
|
+
}
|
|
76
|
+
/** Moves focus to the active option. */
|
|
77
|
+
focus(options) {
|
|
78
|
+
const enabled = this.#enabled();
|
|
79
|
+
const target = enabled.find((item) => item.tabIndex === 0) || enabled[0];
|
|
80
|
+
target?.focus(options);
|
|
81
|
+
}
|
|
82
|
+
connected() {
|
|
83
|
+
this.#revealed = false;
|
|
84
|
+
this.requestUpdate();
|
|
85
|
+
}
|
|
86
|
+
/** Whether the selection has been scrolled into view since connecting. */
|
|
87
|
+
#revealed = false;
|
|
88
|
+
/** Scrolls the list, and only it, to the first selected option, once. */
|
|
89
|
+
#reveal() {
|
|
90
|
+
if (this.#revealed || !this.isConnected) return;
|
|
91
|
+
const item = this.selectedItems[0];
|
|
92
|
+
if (!item) return;
|
|
93
|
+
const box = this.getBoundingClientRect();
|
|
94
|
+
const rect = item.getBoundingClientRect();
|
|
95
|
+
if (!box.height || !rect.height) return;
|
|
96
|
+
this.#revealed = true;
|
|
97
|
+
if (rect.top < box.top) this.scrollTop -= box.top - rect.top;
|
|
98
|
+
else if (rect.bottom > box.bottom) this.scrollTop += rect.bottom - box.bottom;
|
|
99
|
+
if (rect.left < box.left) this.scrollLeft -= box.left - rect.left;
|
|
100
|
+
else if (rect.right > box.right) this.scrollLeft += rect.right - box.right;
|
|
101
|
+
}
|
|
102
|
+
formReset() {
|
|
103
|
+
this.#dirty = false;
|
|
104
|
+
this.#write(this.#fromArray(this.defaultValue != null ? this.#parse(this.defaultValue) : this.#itemDefault));
|
|
105
|
+
const values = this.#values();
|
|
106
|
+
for (const item of this.items) item.selected = values.includes(this.#valueOf(item));
|
|
107
|
+
if (this.isConnected) this.update(/* @__PURE__ */ new Map());
|
|
108
|
+
}
|
|
109
|
+
/** @param {string | File | FormData | null} state */
|
|
110
|
+
formRestore(state) {
|
|
111
|
+
let values = [];
|
|
112
|
+
if (state instanceof FormData) values = [...state.values()].map(String);
|
|
113
|
+
else if (typeof state === "string") {
|
|
114
|
+
try {
|
|
115
|
+
values = [JSON.parse(state)].flat().map(String);
|
|
116
|
+
} catch {
|
|
117
|
+
values = [state];
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
this.#dirty = true;
|
|
121
|
+
this.#write(this.#fromArray(values));
|
|
122
|
+
this.requestUpdate();
|
|
123
|
+
}
|
|
124
|
+
/* -------------------------------------------------------------- values */
|
|
125
|
+
/** @param {Event} event */
|
|
126
|
+
#itemOf(event) {
|
|
127
|
+
const target = (
|
|
128
|
+
/** @type {Element} */
|
|
129
|
+
event.target
|
|
130
|
+
);
|
|
131
|
+
const item = target.closest?.("punica-listbox-item");
|
|
132
|
+
return item && item.parentElement === this ? (
|
|
133
|
+
/** @type {HTMLElement} */
|
|
134
|
+
item
|
|
135
|
+
) : null;
|
|
136
|
+
}
|
|
137
|
+
#valueOf(item) {
|
|
138
|
+
return item.value ?? item.getAttribute("value") ?? item.textContent.trim();
|
|
139
|
+
}
|
|
140
|
+
#enabled() {
|
|
141
|
+
return this.isDisabled ? [] : this.items.filter((item) => !item.hasAttribute("disabled"));
|
|
142
|
+
}
|
|
143
|
+
/** @param {string} text */
|
|
144
|
+
#parse(text) {
|
|
145
|
+
if (!this.multiple) return [text];
|
|
146
|
+
const trimmed = text.trim();
|
|
147
|
+
if (trimmed.startsWith("[")) {
|
|
148
|
+
try {
|
|
149
|
+
return JSON.parse(trimmed).map(String);
|
|
150
|
+
} catch {
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return trimmed ? trimmed.split(",").map((part) => part.trim()) : [];
|
|
154
|
+
}
|
|
155
|
+
/** The current value as a list. */
|
|
156
|
+
#values() {
|
|
157
|
+
const value = this.value;
|
|
158
|
+
if (value == null) return [];
|
|
159
|
+
const list = [value].flat().map(String);
|
|
160
|
+
return this.multiple ? list : list.slice(0, 1);
|
|
161
|
+
}
|
|
162
|
+
/** @param {string[]} list */
|
|
163
|
+
#fromArray(list) {
|
|
164
|
+
return this.multiple ? [...list] : list[0] ?? null;
|
|
165
|
+
}
|
|
166
|
+
#write(value) {
|
|
167
|
+
const next = value == null ? [] : [value].flat();
|
|
168
|
+
const current = this.#values();
|
|
169
|
+
const same = next.length === current.length && next.every((v, i) => v === current[i]);
|
|
170
|
+
if (same && (this.value != null || value == null)) return;
|
|
171
|
+
this.#written = value;
|
|
172
|
+
this.value = value;
|
|
173
|
+
}
|
|
174
|
+
/** @param {string[]} list values the user chose */
|
|
175
|
+
#commit(list) {
|
|
176
|
+
const order = this.items.map((item) => this.#valueOf(item));
|
|
177
|
+
const next = [...new Set(list)].sort((a, b) => order.indexOf(a) - order.indexOf(b));
|
|
178
|
+
const current = this.#values();
|
|
179
|
+
if (next.length === current.length && next.every((v, i) => v === current[i])) return;
|
|
180
|
+
this.#dirty = true;
|
|
181
|
+
this.#write(this.#fromArray(next));
|
|
182
|
+
this.emit("change", { value: this.value });
|
|
183
|
+
}
|
|
184
|
+
#toggle(item) {
|
|
185
|
+
const value = this.#valueOf(item);
|
|
186
|
+
const current = this.#values();
|
|
187
|
+
this.#commit(current.includes(value) ? current.filter((v) => v !== value) : [...current, value]);
|
|
188
|
+
}
|
|
189
|
+
#selectRange(from, to) {
|
|
190
|
+
const enabled = this.#enabled();
|
|
191
|
+
const a = enabled.indexOf(from);
|
|
192
|
+
const b = enabled.indexOf(to);
|
|
193
|
+
if (a < 0 || b < 0) return;
|
|
194
|
+
const range = enabled.slice(Math.min(a, b), Math.max(a, b) + 1).map((item) => this.#valueOf(item));
|
|
195
|
+
this.#commit([...this.#values(), ...range]);
|
|
196
|
+
}
|
|
197
|
+
#setActive(item) {
|
|
198
|
+
const enabled = this.#enabled();
|
|
199
|
+
if (enabled.includes(item)) setRovingTabindex(enabled, item);
|
|
200
|
+
}
|
|
201
|
+
/** @param {KeyboardEvent} event */
|
|
202
|
+
#onKeydown(event) {
|
|
203
|
+
const item = this.#itemOf(event);
|
|
204
|
+
if (!item || event.target !== item || this.isDisabled) return;
|
|
205
|
+
const enabled = this.#enabled();
|
|
206
|
+
const current = enabled.indexOf(item);
|
|
207
|
+
if (this.multiple && (event.ctrlKey || event.metaKey) && event.key.toLowerCase() === "a") {
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
const all = enabled.map((el) => this.#valueOf(el));
|
|
210
|
+
const selected = this.#values();
|
|
211
|
+
this.#commit(all.every((v) => selected.includes(v)) ? selected.filter((v) => !all.includes(v)) : [...selected, ...all]);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
let index = nextIndex(event, enabled.length, current, {
|
|
215
|
+
orientation: this.orientation === "horizontal" ? "horizontal" : "vertical",
|
|
216
|
+
loop: false,
|
|
217
|
+
rtl: isRtl(this)
|
|
218
|
+
});
|
|
219
|
+
const moved = index >= 0;
|
|
220
|
+
if (!moved) {
|
|
221
|
+
index = this.#typeahead(
|
|
222
|
+
event,
|
|
223
|
+
enabled.map((el) => el.textContent),
|
|
224
|
+
current
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
if (index >= 0) {
|
|
228
|
+
event.preventDefault();
|
|
229
|
+
const next = enabled[index];
|
|
230
|
+
this.#setActive(next);
|
|
231
|
+
next.focus();
|
|
232
|
+
if (!this.multiple) this.#commit([this.#valueOf(next)]);
|
|
233
|
+
else if (moved && event.shiftKey) this.#selectRange(this.#anchor || item, next);
|
|
234
|
+
if (!event.shiftKey) this.#anchor = next;
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (event.key === " " || event.key === "Enter") {
|
|
238
|
+
event.preventDefault();
|
|
239
|
+
if (item.hasAttribute("disabled")) return;
|
|
240
|
+
this.#anchor = item;
|
|
241
|
+
if (this.multiple) this.#toggle(item);
|
|
242
|
+
else this.#commit([this.#valueOf(item)]);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/* -------------------------------------------------------------- render */
|
|
246
|
+
update(changed) {
|
|
247
|
+
const items = this.items;
|
|
248
|
+
if (changed.has("value") && this.value !== this.#written && (this.value != null || !this.#first)) {
|
|
249
|
+
this.#dirty = true;
|
|
250
|
+
}
|
|
251
|
+
this.#first = false;
|
|
252
|
+
if (!this.#dirty) {
|
|
253
|
+
if (this.defaultValue != null) {
|
|
254
|
+
if (changed.has("defaultValue") || changed.has("multiple") || this.value == null) {
|
|
255
|
+
this.#write(this.#fromArray(this.#parse(this.defaultValue)));
|
|
256
|
+
}
|
|
257
|
+
} else {
|
|
258
|
+
const marked = items.filter((item) => item.hasAttribute("selected")).map((item) => this.#valueOf(item));
|
|
259
|
+
this.#itemDefault = this.multiple ? marked : marked.slice(0, 1);
|
|
260
|
+
this.#write(this.#fromArray(this.#itemDefault));
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const values = this.#values();
|
|
264
|
+
for (const item of items) item.selected = values.includes(this.#valueOf(item));
|
|
265
|
+
const internals = this.internals;
|
|
266
|
+
internals.ariaMultiSelectable = this.multiple ? "true" : null;
|
|
267
|
+
internals.ariaLabel = this.label || null;
|
|
268
|
+
internals.ariaOrientation = this.orientation === "horizontal" ? "horizontal" : "vertical";
|
|
269
|
+
internals.ariaDisabled = this.isDisabled ? "true" : null;
|
|
270
|
+
internals.ariaRequired = this.required ? "true" : null;
|
|
271
|
+
this.toggleState("disabled", this.isDisabled);
|
|
272
|
+
const enabled = this.#enabled();
|
|
273
|
+
for (const item of items) if (!enabled.includes(item)) item.tabIndex = -1;
|
|
274
|
+
const focused = enabled.find((item) => item.matches(":focus"));
|
|
275
|
+
const active = focused || enabled.find((item) => item.tabIndex === 0 && item.hasAttribute("tabindex"));
|
|
276
|
+
setRovingTabindex(enabled, active || enabled.find((item) => values.includes(this.#valueOf(item))) || null);
|
|
277
|
+
if (!this.name || !values.length) {
|
|
278
|
+
this.setFormValue(null, JSON.stringify(values));
|
|
279
|
+
} else if (this.multiple) {
|
|
280
|
+
const data = new FormData();
|
|
281
|
+
for (const value of values) data.append(this.name, value);
|
|
282
|
+
this.setFormValue(data, JSON.stringify(values));
|
|
283
|
+
} else {
|
|
284
|
+
this.setFormValue(values[0], JSON.stringify(values));
|
|
285
|
+
}
|
|
286
|
+
const anchor = enabled.find((item) => item.tabIndex === 0) || enabled[0];
|
|
287
|
+
this.setValidity({ valueMissing: this.required && !values.length }, requiredMessage(), anchor);
|
|
288
|
+
if (!this.#revealed) requestAnimationFrame(() => this.#reveal());
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
var message = "";
|
|
292
|
+
function requiredMessage() {
|
|
293
|
+
if (!message) {
|
|
294
|
+
const probe = document.createElement("select");
|
|
295
|
+
probe.required = true;
|
|
296
|
+
message = probe.validationMessage || " ";
|
|
297
|
+
}
|
|
298
|
+
return message;
|
|
299
|
+
}
|
|
300
|
+
define("punica-listbox", PunicaListbox);
|
|
301
|
+
|
|
302
|
+
export {
|
|
303
|
+
PunicaListbox
|
|
304
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
dialog_default
|
|
3
|
+
} from "./chunk-3NHCLXYC.js";
|
|
4
|
+
import {
|
|
5
|
+
ModalSurface
|
|
6
|
+
} from "./chunk-FFH6CIAJ.js";
|
|
7
|
+
import {
|
|
8
|
+
icons
|
|
9
|
+
} from "./chunk-YSGWORUD.js";
|
|
10
|
+
import {
|
|
11
|
+
PunicaElement,
|
|
12
|
+
define
|
|
13
|
+
} from "./chunk-Y7B65FYJ.js";
|
|
14
|
+
|
|
15
|
+
// src/components/dialog/dialog.js
|
|
16
|
+
var PunicaDialog = class extends ModalSurface(PunicaElement) {
|
|
17
|
+
static properties = {
|
|
18
|
+
size: {},
|
|
19
|
+
modeless: { type: Boolean },
|
|
20
|
+
noCloseButton: { type: Boolean },
|
|
21
|
+
labelClose: { default: "Close" }
|
|
22
|
+
};
|
|
23
|
+
static styles = dialog_default;
|
|
24
|
+
static template = `
|
|
25
|
+
<dialog part="dialog">
|
|
26
|
+
<div part="panel" class="panel"><slot></slot></div>
|
|
27
|
+
<button part="close-button" class="close" type="button">${icons.close}</button>
|
|
28
|
+
</dialog>
|
|
29
|
+
`;
|
|
30
|
+
#close = this.$(".close");
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
this.#close.addEventListener("click", () => this.requestClose("close-button"));
|
|
34
|
+
this.$("slot").addEventListener("slotchange", () => this.requestUpdate());
|
|
35
|
+
}
|
|
36
|
+
get labelSources() {
|
|
37
|
+
return [...this.children].filter((el) => el.localName === "punica-dialog-header");
|
|
38
|
+
}
|
|
39
|
+
update(changed) {
|
|
40
|
+
super.update(changed);
|
|
41
|
+
this.#close.setAttribute("aria-label", this.labelClose);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
define("punica-dialog", PunicaDialog);
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
PunicaDialog
|
|
48
|
+
};
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
import {
|
|
2
|
+
prefersReducedMotion
|
|
3
|
+
} from "./chunk-4RURT4SK.js";
|
|
4
|
+
import {
|
|
5
|
+
PunicaElement,
|
|
6
|
+
define
|
|
7
|
+
} from "./chunk-Y7B65FYJ.js";
|
|
8
|
+
|
|
9
|
+
// src/components/outline/outline.css
|
|
10
|
+
var outline_default = ":host {\n --punica-outline-indent: var(--punica-space-12);\n --punica-outline-track-color: var(--punica-color-border);\n --punica-outline-active-color: var(--punica-color-primary);\n --punica-outline-offset: 0px;\n\n display: block;\n color: var(--punica-color-text-muted);\n font-family: var(--punica-font-family);\n font-size: var(--punica-font-size-sm);\n line-height: var(--punica-line-height-heading);\n}\n\n:host(:state(empty)) nav {\n display: none;\n}\n\n.list {\n margin: 0;\n padding: 0;\n list-style: none;\n}\n\nnav > .list {\n border-inline-start: var(--punica-border-width) solid var(--punica-outline-track-color);\n}\n\n.nested {\n padding-inline-start: var(--punica-outline-indent);\n}\n\n.link {\n position: relative;\n display: block;\n padding-block: var(--punica-space-4);\n padding-inline: var(--punica-space-12) var(--punica-space-4);\n border-start-end-radius: var(--punica-radius-sm);\n border-end-end-radius: var(--punica-radius-sm);\n color: inherit;\n text-decoration: none;\n overflow-wrap: anywhere;\n transition: color var(--punica-duration-fast) var(--punica-ease);\n}\n\n.link:hover {\n color: var(--punica-color-text);\n}\n\n.link:focus-visible {\n outline: var(--punica-focus-ring);\n outline-offset: calc(-1 * var(--punica-focus-ring-width));\n}\n\n/* The mark sits on the track, at the start edge of the outer list. */\n.link[aria-current]::before {\n content: '';\n position: absolute;\n inset-block: var(--punica-space-2);\n inset-inline-start: calc(-1 * var(--punica-border-width));\n inline-size: var(--punica-space-2);\n border-radius: var(--punica-radius-full);\n background: var(--punica-outline-active-color);\n}\n\n.nested .link[aria-current]::before {\n inset-inline-start: calc(-1 * var(--punica-border-width) - var(--punica-outline-indent));\n}\n\n.nested .nested .link[aria-current]::before {\n inset-inline-start: calc(-1 * var(--punica-border-width) - 2 * var(--punica-outline-indent));\n}\n\n.nested .nested .nested .link[aria-current]::before {\n inset-inline-start: calc(-1 * var(--punica-border-width) - 3 * var(--punica-outline-indent));\n}\n\n.link[aria-current] {\n color: var(--punica-outline-active-color);\n font-weight: var(--punica-font-weight-semi-bold);\n}\n\n@media (forced-colors: active) {\n nav > .list {\n border-color: CanvasText;\n }\n .link[aria-current]::before {\n background: Highlight;\n }\n}\n";
|
|
11
|
+
|
|
12
|
+
// src/components/outline/outline.js
|
|
13
|
+
var LEVEL = /^h[1-6]$/;
|
|
14
|
+
function scrollerOf(target) {
|
|
15
|
+
for (let n = (
|
|
16
|
+
/** @type {any} */
|
|
17
|
+
target
|
|
18
|
+
); n; n = n.assignedSlot || n.parentNode || n.host || null) {
|
|
19
|
+
if (!(n instanceof Element) || n === document.documentElement || n === document.body) continue;
|
|
20
|
+
if (/^(auto|scroll|overlay)$/.test(getComputedStyle(n).overflowY)) return n;
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
var PunicaOutline = class extends PunicaElement {
|
|
25
|
+
static properties = {
|
|
26
|
+
for: {},
|
|
27
|
+
levels: { default: "h2 h3" },
|
|
28
|
+
label: { default: "On this page" },
|
|
29
|
+
target: { type: Object, attribute: false }
|
|
30
|
+
};
|
|
31
|
+
static styles = outline_default;
|
|
32
|
+
static template = `<nav part="base"><ul part="list" class="list"></ul></nav>`;
|
|
33
|
+
#nav = this.$("nav");
|
|
34
|
+
#list = this.$(".list");
|
|
35
|
+
/** @type {HTMLElement[]} */
|
|
36
|
+
#headings = [];
|
|
37
|
+
/** @type {Map<Element, HTMLAnchorElement>} */
|
|
38
|
+
#links = /* @__PURE__ */ new Map();
|
|
39
|
+
/** @type {Map<Element, boolean>} */
|
|
40
|
+
#visible = /* @__PURE__ */ new Map();
|
|
41
|
+
/** @type {Set<Element>} */
|
|
42
|
+
#above = /* @__PURE__ */ new Set();
|
|
43
|
+
#active = null;
|
|
44
|
+
#signature = "";
|
|
45
|
+
/** @type {Element | null} */
|
|
46
|
+
#observed = null;
|
|
47
|
+
/** @type {IntersectionObserver | null} */
|
|
48
|
+
#intersection = null;
|
|
49
|
+
/** @type {MutationObserver | null} */
|
|
50
|
+
#mutation = null;
|
|
51
|
+
#frame = 0;
|
|
52
|
+
#rescan = false;
|
|
53
|
+
constructor() {
|
|
54
|
+
super();
|
|
55
|
+
this.#list.addEventListener("click", (event) => this.#onClick(
|
|
56
|
+
/** @type {MouseEvent} */
|
|
57
|
+
event
|
|
58
|
+
));
|
|
59
|
+
}
|
|
60
|
+
get active() {
|
|
61
|
+
return this.#active?.id || null;
|
|
62
|
+
}
|
|
63
|
+
get headings() {
|
|
64
|
+
return [...this.#headings];
|
|
65
|
+
}
|
|
66
|
+
/** The element whose headings are listed. */
|
|
67
|
+
get targetElement() {
|
|
68
|
+
if (this.target) return this.target;
|
|
69
|
+
if (!this.for) return null;
|
|
70
|
+
const root = (
|
|
71
|
+
/** @type {Document | ShadowRoot} */
|
|
72
|
+
this.getRootNode()
|
|
73
|
+
);
|
|
74
|
+
return root.getElementById?.(this.for) || null;
|
|
75
|
+
}
|
|
76
|
+
connected() {
|
|
77
|
+
this.#mutation = new MutationObserver(() => this.#schedule());
|
|
78
|
+
if (document.readyState === "loading") {
|
|
79
|
+
this.listen(document, "DOMContentLoaded", () => this.#observe());
|
|
80
|
+
}
|
|
81
|
+
this.#observe();
|
|
82
|
+
}
|
|
83
|
+
disconnected() {
|
|
84
|
+
cancelAnimationFrame(this.#frame);
|
|
85
|
+
this.#frame = 0;
|
|
86
|
+
this.#mutation?.disconnect();
|
|
87
|
+
this.#mutation = null;
|
|
88
|
+
this.#intersection?.disconnect();
|
|
89
|
+
this.#intersection = null;
|
|
90
|
+
this.#observed = null;
|
|
91
|
+
this.#signature = "";
|
|
92
|
+
}
|
|
93
|
+
update(changed) {
|
|
94
|
+
this.#nav.setAttribute("aria-label", this.label);
|
|
95
|
+
if (changed.has("for") || changed.has("target") || changed.has("levels")) this.#observe();
|
|
96
|
+
}
|
|
97
|
+
/** Reads the target's headings again. Call after changing them in a way the element cannot see. */
|
|
98
|
+
refresh() {
|
|
99
|
+
this.#signature = "";
|
|
100
|
+
this.#scan();
|
|
101
|
+
}
|
|
102
|
+
/** Points the observers at the current target and lists its headings. */
|
|
103
|
+
#observe() {
|
|
104
|
+
if (!this.isConnected) return;
|
|
105
|
+
const target = this.targetElement;
|
|
106
|
+
if (target !== this.#observed) {
|
|
107
|
+
this.#mutation?.disconnect();
|
|
108
|
+
this.#observed = target;
|
|
109
|
+
if (target) {
|
|
110
|
+
this.#mutation?.observe(target, {
|
|
111
|
+
childList: true,
|
|
112
|
+
subtree: true,
|
|
113
|
+
characterData: true,
|
|
114
|
+
attributes: true,
|
|
115
|
+
attributeFilter: ["id", "hidden"]
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
this.#signature = "";
|
|
120
|
+
this.#scan();
|
|
121
|
+
}
|
|
122
|
+
#schedule() {
|
|
123
|
+
if (this.#rescan) return;
|
|
124
|
+
this.#rescan = true;
|
|
125
|
+
cancelAnimationFrame(this.#frame);
|
|
126
|
+
this.#frame = requestAnimationFrame(() => {
|
|
127
|
+
this.#rescan = false;
|
|
128
|
+
this.#scan();
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
#tags() {
|
|
132
|
+
const tags = String(this.levels || "").toLowerCase().split(/[\s,]+/).filter((tag) => LEVEL.test(tag));
|
|
133
|
+
return tags.length ? tags : ["h2", "h3"];
|
|
134
|
+
}
|
|
135
|
+
#scan() {
|
|
136
|
+
const target = this.#observed;
|
|
137
|
+
const headings = target ? (
|
|
138
|
+
/** @type {HTMLElement[]} */
|
|
139
|
+
[...target.querySelectorAll(this.#tags().join(","))].filter(
|
|
140
|
+
(h) => !h.closest("[hidden]") && this.#text(h)
|
|
141
|
+
)
|
|
142
|
+
) : [];
|
|
143
|
+
for (const heading of headings) if (!heading.id) heading.id = this.#uniqueId(heading);
|
|
144
|
+
const signature = headings.map((h) => `${h.localName}#${h.id}:${this.#text(h)}`).join("\n");
|
|
145
|
+
if (signature === this.#signature && target) return;
|
|
146
|
+
this.#signature = signature;
|
|
147
|
+
this.#headings = headings;
|
|
148
|
+
this.#build();
|
|
149
|
+
this.#spy();
|
|
150
|
+
}
|
|
151
|
+
/** @param {Element} heading */
|
|
152
|
+
#text(heading) {
|
|
153
|
+
return (heading.textContent || "").replace(/\s+/g, " ").trim();
|
|
154
|
+
}
|
|
155
|
+
/** @param {Element} heading */
|
|
156
|
+
#uniqueId(heading) {
|
|
157
|
+
const base = this.#text(heading).toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g, "").replace(/[^\p{L}\p{N}]+/gu, "-").replace(/^-+|-+$/g, "") || "section";
|
|
158
|
+
const root = (
|
|
159
|
+
/** @type {Document | ShadowRoot} */
|
|
160
|
+
heading.getRootNode()
|
|
161
|
+
);
|
|
162
|
+
let id = base;
|
|
163
|
+
for (let n = 2; root.getElementById?.(id); n++) id = `${base}-${n}`;
|
|
164
|
+
return id;
|
|
165
|
+
}
|
|
166
|
+
#build() {
|
|
167
|
+
const list = this.#list;
|
|
168
|
+
list.replaceChildren();
|
|
169
|
+
this.#links.clear();
|
|
170
|
+
const stack = [{ parentRank: 0, list }];
|
|
171
|
+
let lastItem = null;
|
|
172
|
+
for (const heading of this.#headings) {
|
|
173
|
+
const rank = Number(heading.localName[1]);
|
|
174
|
+
if (lastItem && rank > lastItem.rank) {
|
|
175
|
+
const nested = document.createElement("ul");
|
|
176
|
+
nested.setAttribute("part", "list");
|
|
177
|
+
nested.className = "list nested";
|
|
178
|
+
lastItem.li.append(nested);
|
|
179
|
+
stack.push({ parentRank: lastItem.rank, list: nested });
|
|
180
|
+
} else {
|
|
181
|
+
while (stack.length > 1 && stack.at(-1).parentRank >= rank) stack.pop();
|
|
182
|
+
}
|
|
183
|
+
const li = document.createElement("li");
|
|
184
|
+
li.setAttribute("part", "item");
|
|
185
|
+
li.className = "item";
|
|
186
|
+
const a = document.createElement("a");
|
|
187
|
+
a.setAttribute("part", "link");
|
|
188
|
+
a.className = "link";
|
|
189
|
+
a.href = `#${encodeURIComponent(heading.id)}`;
|
|
190
|
+
a.textContent = this.#text(heading);
|
|
191
|
+
li.append(a);
|
|
192
|
+
stack.at(-1).list.append(li);
|
|
193
|
+
this.#links.set(heading, a);
|
|
194
|
+
lastItem = { li, rank };
|
|
195
|
+
}
|
|
196
|
+
this.toggleState("empty", this.#headings.length === 0);
|
|
197
|
+
this.#active = null;
|
|
198
|
+
this.#mark(null);
|
|
199
|
+
}
|
|
200
|
+
#spy() {
|
|
201
|
+
this.#intersection?.disconnect();
|
|
202
|
+
this.#visible.clear();
|
|
203
|
+
this.#above.clear();
|
|
204
|
+
if (!this.#headings.length) {
|
|
205
|
+
this.#intersection = null;
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const offset = parseFloat(getComputedStyle(this).getPropertyValue("--punica-outline-offset")) || 0;
|
|
209
|
+
this.#intersection = new IntersectionObserver((entries) => this.#onIntersect(entries), {
|
|
210
|
+
root: scrollerOf(this.#observed),
|
|
211
|
+
rootMargin: `${-offset}px 0px -55% 0px`
|
|
212
|
+
});
|
|
213
|
+
for (const heading of this.#headings) this.#intersection.observe(heading);
|
|
214
|
+
}
|
|
215
|
+
/** @param {IntersectionObserverEntry[]} entries */
|
|
216
|
+
#onIntersect(entries) {
|
|
217
|
+
for (const entry of entries) {
|
|
218
|
+
this.#visible.set(entry.target, entry.isIntersecting);
|
|
219
|
+
const top = entry.rootBounds ? entry.rootBounds.top : 0;
|
|
220
|
+
if (!entry.isIntersecting && entry.boundingClientRect.top < top) this.#above.add(entry.target);
|
|
221
|
+
else this.#above.delete(entry.target);
|
|
222
|
+
}
|
|
223
|
+
const headings = this.#headings;
|
|
224
|
+
let active = headings.find((h) => this.#visible.get(h)) || null;
|
|
225
|
+
if (!active) {
|
|
226
|
+
for (const h of headings) if (this.#above.has(h)) active = h;
|
|
227
|
+
}
|
|
228
|
+
if (!active && this.#active && headings.includes(this.#active)) active = this.#active;
|
|
229
|
+
this.#setActive(active);
|
|
230
|
+
}
|
|
231
|
+
/** @param {Element | null} heading */
|
|
232
|
+
#setActive(heading) {
|
|
233
|
+
if (heading === this.#active) return;
|
|
234
|
+
this.#active = heading;
|
|
235
|
+
this.#mark(heading);
|
|
236
|
+
}
|
|
237
|
+
/** @param {Element | null} heading */
|
|
238
|
+
#mark(heading) {
|
|
239
|
+
for (const [h, a] of this.#links) {
|
|
240
|
+
const on = h === heading;
|
|
241
|
+
a.setAttribute("part", on ? "link current" : "link");
|
|
242
|
+
if (on) a.setAttribute("aria-current", "location");
|
|
243
|
+
else a.removeAttribute("aria-current");
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/** @param {MouseEvent} event */
|
|
247
|
+
#onClick(event) {
|
|
248
|
+
const link = (
|
|
249
|
+
/** @type {Element} */
|
|
250
|
+
event.target.closest?.("a")
|
|
251
|
+
);
|
|
252
|
+
if (!link || event.button || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
|
253
|
+
const heading = [...this.#links].find(([, a]) => a === link)?.[0];
|
|
254
|
+
if (!heading) return;
|
|
255
|
+
const selected = this.emit("select", { value: heading.id, item: heading }, { cancelable: true });
|
|
256
|
+
if (selected.defaultPrevented) {
|
|
257
|
+
event.preventDefault();
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
this.#setActive(heading);
|
|
261
|
+
if (heading.getRootNode() !== document) {
|
|
262
|
+
event.preventDefault();
|
|
263
|
+
heading.scrollIntoView({ behavior: prefersReducedMotion() ? "auto" : "smooth", block: "start" });
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
define("punica-outline", PunicaOutline);
|
|
268
|
+
|
|
269
|
+
export {
|
|
270
|
+
PunicaOutline
|
|
271
|
+
};
|