@usecapsule/core-components 2.0.2 → 2.0.4-dev.dropdown
Sign up to get free protection for your applications and to get access to all the features.
- package/css/capsule-core.css +12 -0
- package/css/capsule-core.css.map +1 -1
- package/dist/capsule/capsule.esm.js +1 -52
- package/dist/capsule/capsule.esm.js.map +1 -1
- package/dist/capsule/index.esm.js +1 -572
- package/dist/capsule/index.esm.js.map +1 -1
- package/dist/capsule/p-0462f723.js +2 -0
- package/dist/capsule/p-0462f723.js.map +1 -0
- package/dist/capsule/p-0cab90fa.entry.js +2 -0
- package/dist/capsule/p-0cab90fa.entry.js.map +1 -0
- package/dist/capsule/p-193ac141.entry.js +2 -0
- package/dist/capsule/p-193ac141.entry.js.map +1 -0
- package/dist/capsule/p-6fb7c4d1.js +3 -0
- package/dist/capsule/p-6fb7c4d1.js.map +1 -0
- package/dist/capsule/p-a95ec4df.entry.js +2 -0
- package/dist/capsule/p-a95ec4df.entry.js.map +1 -0
- package/dist/capsule/p-c2bf050b.js +2 -0
- package/dist/capsule/p-c2bf050b.js.map +1 -0
- package/dist/capsule/p-cb8dc0a4.entry.js +2 -0
- package/dist/capsule/p-cb8dc0a4.entry.js.map +1 -0
- package/dist/capsule/p-cc052d36.entry.js +29 -0
- package/dist/capsule/p-cc052d36.entry.js.map +1 -0
- package/dist/capsule/p-d7be092d.entry.js +10 -0
- package/dist/capsule/p-d7be092d.entry.js.map +1 -0
- package/dist/capsule/p-e1255160.js +2 -0
- package/dist/capsule/p-e1255160.js.map +1 -0
- package/dist/cjs/_commonjsHelpers-b3309d7b.js +12 -0
- package/dist/cjs/_commonjsHelpers-b3309d7b.js.map +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +7 -0
- package/dist/cjs/app-globals-3a1e7e63.js.map +1 -0
- package/dist/cjs/capsule.cjs.js +27 -0
- package/dist/cjs/capsule.cjs.js.map +1 -0
- package/dist/cjs/constants-4bb85cc5.js +12 -0
- package/dist/cjs/constants-4bb85cc5.js.map +1 -0
- package/dist/cjs/cpsl-alert_18.cjs.entry.js +14798 -0
- package/dist/cjs/cpsl-alert_18.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-animation.cjs.entry.js +20129 -0
- package/dist/cjs/cpsl-animation.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-col.cjs.entry.js +125 -0
- package/dist/cjs/cpsl-col.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-grid.cjs.entry.js +25 -0
- package/dist/cjs/cpsl-grid.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-info-box.cjs.entry.js +22 -0
- package/dist/cjs/cpsl-info-box.cjs.entry.js.map +1 -0
- package/dist/cjs/cpsl-row.cjs.entry.js +22 -0
- package/dist/cjs/cpsl-row.cjs.entry.js.map +1 -0
- package/dist/cjs/index-3fccb5b4.js +2012 -0
- package/dist/cjs/index-3fccb5b4.js.map +1 -0
- package/dist/cjs/index.cjs.js +362 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +17 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/collection/assets/icons/AD.svg +15 -0
- package/dist/collection/assets/icons/AE.svg +13 -0
- package/dist/collection/assets/icons/AF.svg +14 -0
- package/dist/collection/assets/icons/AG.svg +15 -0
- package/dist/collection/assets/icons/AI.svg +19 -0
- package/dist/collection/assets/icons/AL.svg +11 -0
- package/dist/collection/assets/icons/AM.svg +12 -0
- package/dist/collection/assets/icons/AO.svg +14 -0
- package/dist/collection/assets/icons/AR.svg +13 -0
- package/dist/collection/assets/icons/AS.svg +15 -0
- package/dist/collection/assets/icons/AT.svg +12 -0
- package/dist/collection/assets/icons/AU.svg +20 -0
- package/dist/collection/assets/icons/AW.svg +15 -0
- package/dist/collection/assets/icons/AX.svg +15 -0
- package/dist/collection/assets/icons/AZ.svg +14 -0
- package/dist/collection/assets/icons/BA.svg +13 -0
- package/dist/collection/assets/icons/BB.svg +13 -0
- package/dist/collection/assets/icons/BD.svg +11 -0
- package/dist/collection/assets/icons/BE.svg +12 -0
- package/dist/collection/assets/icons/BF.svg +12 -0
- package/dist/collection/assets/icons/BG.svg +12 -0
- package/dist/collection/assets/icons/BH.svg +11 -0
- package/dist/collection/assets/icons/BI.svg +18 -0
- package/dist/collection/assets/icons/BJ.svg +12 -0
- package/dist/collection/assets/icons/BL.svg +16 -0
- package/dist/collection/assets/icons/BM.svg +20 -0
- package/dist/collection/assets/icons/BN.svg +19 -0
- package/dist/collection/assets/icons/BO.svg +12 -0
- package/dist/collection/assets/icons/BQ.svg +14 -0
- package/dist/collection/assets/icons/BQ2.svg +20 -0
- package/dist/collection/assets/icons/BQ3.svg +15 -0
- package/dist/collection/assets/icons/BR.svg +14 -0
- package/dist/collection/assets/icons/BS.svg +13 -0
- package/dist/collection/assets/icons/BT.svg +12 -0
- package/dist/collection/assets/icons/BW.svg +13 -0
- package/dist/collection/assets/icons/BY.svg +18 -0
- package/dist/collection/assets/icons/BZ.svg +17 -0
- package/dist/collection/assets/icons/CA.svg +13 -0
- package/dist/collection/assets/icons/CC.svg +19 -0
- package/dist/collection/assets/icons/CD.svg +12 -0
- package/dist/collection/assets/icons/CD2.svg +14 -0
- package/dist/collection/assets/icons/CF.svg +20 -0
- package/dist/collection/assets/icons/CH.svg +11 -0
- package/dist/collection/assets/icons/CK.svg +22 -0
- package/dist/collection/assets/icons/CL.svg +13 -0
- package/dist/collection/assets/icons/CM.svg +13 -0
- package/dist/collection/assets/icons/CN.svg +15 -0
- package/dist/collection/assets/icons/CO.svg +12 -0
- package/dist/collection/assets/icons/CR.svg +13 -0
- package/dist/collection/assets/icons/CU.svg +15 -0
- package/dist/collection/assets/icons/CW.svg +14 -0
- package/dist/collection/assets/icons/CX.svg +19 -0
- package/dist/collection/assets/icons/CY.svg +12 -0
- package/dist/collection/assets/icons/CZ.svg +12 -0
- package/dist/collection/assets/icons/DE.svg +12 -0
- package/dist/collection/assets/icons/DJ.svg +13 -0
- package/dist/collection/assets/icons/DK.svg +14 -0
- package/dist/collection/assets/icons/DM.svg +34 -0
- package/dist/collection/assets/icons/DO.svg +17 -0
- package/dist/collection/assets/icons/DS.svg +13 -0
- package/dist/collection/assets/icons/DZ.svg +13 -0
- package/dist/collection/assets/icons/EC.svg +15 -0
- package/dist/collection/assets/icons/EE.svg +12 -0
- package/dist/collection/assets/icons/EG.svg +13 -0
- package/dist/collection/assets/icons/EH.svg +15 -0
- package/dist/collection/assets/icons/ER.svg +13 -0
- package/dist/collection/assets/icons/ES.svg +12 -0
- package/dist/collection/assets/icons/ET.svg +15 -0
- package/dist/collection/assets/icons/FI.svg +11 -0
- package/dist/collection/assets/icons/FJ.svg +18 -0
- package/dist/collection/assets/icons/FK.svg +18 -0
- package/dist/collection/assets/icons/FM.svg +14 -0
- package/dist/collection/assets/icons/FO.svg +12 -0
- package/dist/collection/assets/icons/FR.svg +12 -0
- package/dist/collection/assets/icons/GA.svg +12 -0
- package/dist/collection/assets/icons/GB-2.svg +11 -0
- package/dist/collection/assets/icons/GB.svg +23 -0
- package/dist/collection/assets/icons/GD.svg +26 -0
- package/dist/collection/assets/icons/GE.svg +15 -0
- package/dist/collection/assets/icons/GG.svg +12 -0
- package/dist/collection/assets/icons/GH.svg +13 -0
- package/dist/collection/assets/icons/GI.svg +13 -0
- package/dist/collection/assets/icons/GL.svg +13 -0
- package/dist/collection/assets/icons/GM.svg +13 -0
- package/dist/collection/assets/icons/GN.svg +12 -0
- package/dist/collection/assets/icons/GQ.svg +16 -0
- package/dist/collection/assets/icons/GR.svg +15 -0
- package/dist/collection/assets/icons/GT.svg +14 -0
- package/dist/collection/assets/icons/GU.svg +18 -0
- package/dist/collection/assets/icons/GW.svg +14 -0
- package/dist/collection/assets/icons/GY.svg +15 -0
- package/dist/collection/assets/icons/HK.svg +15 -0
- package/dist/collection/assets/icons/HN.svg +17 -0
- package/dist/collection/assets/icons/HR.svg +31 -0
- package/dist/collection/assets/icons/HT.svg +17 -0
- package/dist/collection/assets/icons/HU.svg +12 -0
- package/dist/collection/assets/icons/ID.svg +11 -0
- package/dist/collection/assets/icons/IE.svg +12 -0
- package/dist/collection/assets/icons/IL.svg +13 -0
- package/dist/collection/assets/icons/IM.svg +11 -0
- package/dist/collection/assets/icons/IN.svg +15 -0
- package/dist/collection/assets/icons/IO.svg +29 -0
- package/dist/collection/assets/icons/IQ.svg +15 -0
- package/dist/collection/assets/icons/IR.svg +13 -0
- package/dist/collection/assets/icons/IS.svg +15 -0
- package/dist/collection/assets/icons/IT.svg +12 -0
- package/dist/collection/assets/icons/JE.svg +13 -0
- package/dist/collection/assets/icons/JM.svg +14 -0
- package/dist/collection/assets/icons/JO.svg +14 -0
- package/dist/collection/assets/icons/JP.svg +11 -0
- package/dist/collection/assets/icons/KE.svg +19 -0
- package/dist/collection/assets/icons/KG.svg +16 -0
- package/dist/collection/assets/icons/KH.svg +13 -0
- package/dist/collection/assets/icons/KI.svg +17 -0
- package/dist/collection/assets/icons/KM.svg +19 -0
- package/dist/collection/assets/icons/KN.svg +15 -0
- package/dist/collection/assets/icons/KP.svg +15 -0
- package/dist/collection/assets/icons/KR.svg +30 -0
- package/dist/collection/assets/icons/KW.svg +13 -0
- package/dist/collection/assets/icons/KY.svg +20 -0
- package/dist/collection/assets/icons/KZ.svg +13 -0
- package/dist/collection/assets/icons/LA.svg +13 -0
- package/dist/collection/assets/icons/LB.svg +13 -0
- package/dist/collection/assets/icons/LC.svg +13 -0
- package/dist/collection/assets/icons/LI.svg +12 -0
- package/dist/collection/assets/icons/LK.svg +14 -0
- package/dist/collection/assets/icons/LR.svg +23 -0
- package/dist/collection/assets/icons/LS.svg +13 -0
- package/dist/collection/assets/icons/LT.svg +12 -0
- package/dist/collection/assets/icons/LU.svg +12 -0
- package/dist/collection/assets/icons/LV.svg +12 -0
- package/dist/collection/assets/icons/LY.svg +14 -0
- package/dist/collection/assets/icons/MA.svg +11 -0
- package/dist/collection/assets/icons/MC.svg +11 -0
- package/dist/collection/assets/icons/MD.svg +15 -0
- package/dist/collection/assets/icons/ME.svg +15 -0
- package/dist/collection/assets/icons/MG.svg +12 -0
- package/dist/collection/assets/icons/MH.svg +13 -0
- package/dist/collection/assets/icons/MK.svg +20 -0
- package/dist/collection/assets/icons/ML.svg +12 -0
- package/dist/collection/assets/icons/MM.svg +13 -0
- package/dist/collection/assets/icons/MN.svg +19 -0
- package/dist/collection/assets/icons/MO.svg +18 -0
- package/dist/collection/assets/icons/MP.svg +14 -0
- package/dist/collection/assets/icons/MQ.svg +18 -0
- package/dist/collection/assets/icons/MR.svg +12 -0
- package/dist/collection/assets/icons/MS.svg +17 -0
- package/dist/collection/assets/icons/MT.svg +12 -0
- package/dist/collection/assets/icons/MU.svg +13 -0
- package/dist/collection/assets/icons/MV.svg +12 -0
- package/dist/collection/assets/icons/MW.svg +13 -0
- package/dist/collection/assets/icons/MX.svg +14 -0
- package/dist/collection/assets/icons/MY.svg +17 -0
- package/dist/collection/assets/icons/MZ.svg +17 -0
- package/dist/collection/assets/icons/NA.svg +14 -0
- package/dist/collection/assets/icons/NE.svg +13 -0
- package/dist/collection/assets/icons/NF.svg +13 -0
- package/dist/collection/assets/icons/NG.svg +12 -0
- package/dist/collection/assets/icons/NI.svg +16 -0
- package/dist/collection/assets/icons/NL.svg +12 -0
- package/dist/collection/assets/icons/NO.svg +15 -0
- package/dist/collection/assets/icons/NP.svg +16 -0
- package/dist/collection/assets/icons/NR.svg +14 -0
- package/dist/collection/assets/icons/NU.svg +20 -0
- package/dist/collection/assets/icons/NZ.svg +18 -0
- package/dist/collection/assets/icons/OM.svg +15 -0
- package/dist/collection/assets/icons/PA.svg +14 -0
- package/dist/collection/assets/icons/PE.svg +12 -0
- package/dist/collection/assets/icons/PF.svg +17 -0
- package/dist/collection/assets/icons/PG.svg +17 -0
- package/dist/collection/assets/icons/PH.svg +16 -0
- package/dist/collection/assets/icons/PK.svg +14 -0
- package/dist/collection/assets/icons/PL.svg +11 -0
- package/dist/collection/assets/icons/PN.svg +18 -0
- package/dist/collection/assets/icons/PR.svg +15 -0
- package/dist/collection/assets/icons/PS.svg +13 -0
- package/dist/collection/assets/icons/PT.svg +14 -0
- package/dist/collection/assets/icons/PW.svg +11 -0
- package/dist/collection/assets/icons/PY.svg +14 -0
- package/dist/collection/assets/icons/QA.svg +11 -0
- package/dist/collection/assets/icons/RO.svg +12 -0
- package/dist/collection/assets/icons/RS.svg +16 -0
- package/dist/collection/assets/icons/RU.svg +12 -0
- package/dist/collection/assets/icons/RW.svg +13 -0
- package/dist/collection/assets/icons/SA.svg +16 -0
- package/dist/collection/assets/icons/SB.svg +17 -0
- package/dist/collection/assets/icons/SC.svg +14 -0
- package/dist/collection/assets/icons/SE.svg +14 -0
- package/dist/collection/assets/icons/SG.svg +17 -0
- package/dist/collection/assets/icons/SI.svg +13 -0
- package/dist/collection/assets/icons/SK.svg +16 -0
- package/dist/collection/assets/icons/SL.svg +12 -0
- package/dist/collection/assets/icons/SM.svg +16 -0
- package/dist/collection/assets/icons/SN.svg +13 -0
- package/dist/collection/assets/icons/SO.svg +11 -0
- package/dist/collection/assets/icons/SR.svg +14 -0
- package/dist/collection/assets/icons/SS.svg +15 -0
- package/dist/collection/assets/icons/ST.svg +15 -0
- package/dist/collection/assets/icons/SV.svg +15 -0
- package/dist/collection/assets/icons/SX.svg +17 -0
- package/dist/collection/assets/icons/SY.svg +14 -0
- package/dist/collection/assets/icons/SZ.svg +21 -0
- package/dist/collection/assets/icons/TC.svg +19 -0
- package/dist/collection/assets/icons/TD.svg +12 -0
- package/dist/collection/assets/icons/TG.svg +15 -0
- package/dist/collection/assets/icons/TH.svg +13 -0
- package/dist/collection/assets/icons/TJ.svg +20 -0
- package/dist/collection/assets/icons/TK.svg +15 -0
- package/dist/collection/assets/icons/TL.svg +13 -0
- package/dist/collection/assets/icons/TM.svg +30 -0
- package/dist/collection/assets/icons/TN.svg +13 -0
- package/dist/collection/assets/icons/TO.svg +12 -0
- package/dist/collection/assets/icons/TR.svg +12 -0
- package/dist/collection/assets/icons/TT.svg +13 -0
- package/dist/collection/assets/icons/TV.svg +25 -0
- package/dist/collection/assets/icons/TW.svg +14 -0
- package/dist/collection/assets/icons/TZ.svg +13 -0
- package/dist/collection/assets/icons/UA.svg +11 -0
- package/dist/collection/assets/icons/UG.svg +16 -0
- package/dist/collection/assets/icons/US.svg +15 -0
- package/dist/collection/assets/icons/UY.svg +16 -0
- package/dist/collection/assets/icons/UZ.svg +27 -0
- package/dist/collection/assets/icons/VC.svg +15 -0
- package/dist/collection/assets/icons/VE.svg +20 -0
- package/dist/collection/assets/icons/VG.svg +24 -0
- package/dist/collection/assets/icons/VI.svg +18 -0
- package/dist/collection/assets/icons/VN.svg +11 -0
- package/dist/collection/assets/icons/VU.svg +32 -0
- package/dist/collection/assets/icons/WS.svg +16 -0
- package/dist/collection/assets/icons/YE.svg +12 -0
- package/dist/collection/assets/icons/ZA.svg +15 -0
- package/dist/collection/assets/icons/ZM.svg +14 -0
- package/dist/collection/assets/icons/ZW.svg +20 -0
- package/dist/collection/assets/icons/alert-circle.svg +3 -0
- package/dist/collection/assets/icons/angel-list-brand.svg +3 -0
- package/dist/collection/assets/icons/angel-list.svg +3 -0
- package/dist/collection/assets/icons/apple-brand.svg +3 -0
- package/dist/collection/assets/icons/apple.svg +3 -0
- package/dist/collection/assets/icons/arrow-narrow.svg +3 -0
- package/dist/collection/assets/icons/arrow.svg +3 -0
- package/dist/collection/assets/icons/backup-kit.svg +4 -0
- package/dist/collection/assets/icons/capsule-logo.svg +18 -0
- package/dist/collection/assets/icons/capsule-rings-dark.svg +34 -0
- package/dist/collection/assets/icons/capsule-rings.svg +34 -0
- package/dist/collection/assets/icons/capsule.svg +4 -0
- package/dist/collection/assets/icons/check.svg +3 -0
- package/dist/collection/assets/icons/chevron-up.svg +3 -0
- package/dist/collection/assets/icons/clock.svg +3 -0
- package/dist/collection/assets/icons/close.svg +4 -0
- package/dist/collection/assets/icons/clubhouse-brand.svg +4 -0
- package/dist/collection/assets/icons/clubhouse.svg +4 -0
- package/dist/collection/assets/icons/copy.svg +3 -0
- package/dist/collection/assets/icons/discord-brand.svg +4 -0
- package/dist/collection/assets/icons/discord.svg +4 -0
- package/dist/collection/assets/icons/download-cloud.svg +3 -0
- package/dist/collection/assets/icons/dribbble-brand.svg +4 -0
- package/dist/collection/assets/icons/dribbble.svg +3 -0
- package/dist/collection/assets/icons/earth.svg +11 -0
- package/dist/collection/assets/icons/eye-off.svg +3 -0
- package/dist/collection/assets/icons/eye.svg +4 -0
- package/dist/collection/assets/icons/facebook-brand.svg +11 -0
- package/dist/collection/assets/icons/facebook.svg +10 -0
- package/dist/collection/assets/icons/figma-brand.svg +14 -0
- package/dist/collection/assets/icons/figma.svg +3 -0
- package/dist/collection/assets/icons/github-brand.svg +10 -0
- package/dist/collection/assets/icons/github.svg +10 -0
- package/dist/collection/assets/icons/google-brand.svg +13 -0
- package/dist/collection/assets/icons/google.svg +10 -0
- package/dist/collection/assets/icons/help-circle.svg +3 -0
- package/dist/collection/assets/icons/hero-email.svg +12 -0
- package/dist/collection/assets/icons/hero-lock.svg +4 -0
- package/dist/collection/assets/icons/hero-passkey.svg +12 -0
- package/dist/collection/assets/icons/hero-phone.svg +4 -0
- package/dist/collection/assets/icons/hero-wallet.svg +5 -0
- package/dist/collection/assets/icons/index.js +305 -0
- package/dist/collection/assets/icons/index.js.map +1 -0
- package/dist/collection/assets/icons/info-circle.svg +3 -0
- package/dist/collection/assets/icons/instagram-brand.svg +12 -0
- package/dist/collection/assets/icons/instagram.svg +12 -0
- package/dist/collection/assets/icons/key.svg +3 -0
- package/dist/collection/assets/icons/linkedin-brand.svg +10 -0
- package/dist/collection/assets/icons/linkedin.svg +10 -0
- package/dist/collection/assets/icons/mail.svg +3 -0
- package/dist/collection/assets/icons/more-login-options.svg +13 -0
- package/dist/collection/assets/icons/phone.svg +3 -0
- package/dist/collection/assets/icons/pintrest-brand.svg +11 -0
- package/dist/collection/assets/icons/pintrest.svg +10 -0
- package/dist/collection/assets/icons/plus-circle.svg +5 -0
- package/dist/collection/assets/icons/reddit-brand.svg +11 -0
- package/dist/collection/assets/icons/reddit.svg +3 -0
- package/dist/collection/assets/icons/signal-brand.svg +3 -0
- package/dist/collection/assets/icons/signal.svg +3 -0
- package/dist/collection/assets/icons/snapchat-brand.svg +4 -0
- package/dist/collection/assets/icons/snapchat.svg +3 -0
- package/dist/collection/assets/icons/telegram-brand.svg +15 -0
- package/dist/collection/assets/icons/telegram.svg +10 -0
- package/dist/collection/assets/icons/tik-tok-brand.svg +5 -0
- package/dist/collection/assets/icons/tik-tok.svg +3 -0
- package/dist/collection/assets/icons/tumblr-brand.svg +10 -0
- package/dist/collection/assets/icons/tumblr.svg +10 -0
- package/dist/collection/assets/icons/twitter-brand.svg +3 -0
- package/dist/collection/assets/icons/twitter.svg +3 -0
- package/dist/collection/assets/icons/wallet.svg +5 -0
- package/dist/collection/assets/icons/youtube-brand.svg +11 -0
- package/dist/collection/assets/icons/youtube.svg +3 -0
- package/dist/collection/collection-manifest.json +34 -0
- package/dist/collection/components/cpsl-alert/cpsl-alert.css +98 -0
- package/dist/collection/components/cpsl-alert/cpsl-alert.js +80 -0
- package/dist/collection/components/cpsl-alert/cpsl-alert.js.map +1 -0
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.e2e.js +29 -0
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.spec.js +37 -0
- package/dist/collection/components/cpsl-alert/test/cpsl-alert.spec.js.map +1 -0
- package/dist/collection/components/cpsl-animation/cpsl-animation.css +17 -0
- package/dist/collection/components/cpsl-animation/cpsl-animation.js +102 -0
- package/dist/collection/components/cpsl-animation/cpsl-animation.js.map +1 -0
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.e2e.js +29 -0
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.spec.js +37 -0
- package/dist/collection/components/cpsl-animation/test/cpsl-animation.spec.js.map +1 -0
- package/dist/collection/components/cpsl-button/cpsl-button.css +162 -0
- package/dist/collection/components/cpsl-button/cpsl-button.js +68 -0
- package/dist/collection/components/cpsl-button/cpsl-button.js.map +1 -0
- package/dist/collection/components/cpsl-button/test/cpsl-button.e2e.js +29 -0
- package/dist/collection/components/cpsl-button/test/cpsl-button.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-button/test/cpsl-button.spec.js +37 -0
- package/dist/collection/components/cpsl-button/test/cpsl-button.spec.js.map +1 -0
- package/dist/collection/components/cpsl-code-input/code-change-interface.js +2 -0
- package/dist/collection/components/cpsl-code-input/code-change-interface.js.map +1 -0
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.css +134 -0
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js +223 -0
- package/dist/collection/components/cpsl-code-input/cpsl-code-input.js.map +1 -0
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.e2e.js +29 -0
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.spec.js +37 -0
- package/dist/collection/components/cpsl-code-input/test/cpsl-code-input.spec.js.map +1 -0
- package/dist/collection/components/cpsl-col/cpsl-col.css +200 -0
- package/dist/collection/components/cpsl-col/cpsl-col.js +528 -0
- package/dist/collection/components/cpsl-col/cpsl-col.js.map +1 -0
- package/dist/collection/components/cpsl-col/test/cpsl-col.e2e.js +29 -0
- package/dist/collection/components/cpsl-col/test/cpsl-col.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-col/test/cpsl-col.spec.js +37 -0
- package/dist/collection/components/cpsl-col/test/cpsl-col.spec.js.map +1 -0
- package/dist/collection/components/cpsl-divider/cpsl-divider.css +73 -0
- package/dist/collection/components/cpsl-divider/cpsl-divider.js +19 -0
- package/dist/collection/components/cpsl-divider/cpsl-divider.js.map +1 -0
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.e2e.js +29 -0
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.spec.js +37 -0
- package/dist/collection/components/cpsl-divider/test/cpsl-divider.spec.js.map +1 -0
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.css +88 -0
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js +113 -0
- package/dist/collection/components/cpsl-dropdown/cpsl-dropdown.js.map +1 -0
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.e2e.js +29 -0
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.spec.js +37 -0
- package/dist/collection/components/cpsl-dropdown/test/cpsl-dropdown.spec.js.map +1 -0
- package/dist/collection/components/cpsl-grid/cpsl-grid.css +235 -0
- package/dist/collection/components/cpsl-grid/cpsl-grid.js +46 -0
- package/dist/collection/components/cpsl-grid/cpsl-grid.js.map +1 -0
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.e2e.js +29 -0
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.spec.js +37 -0
- package/dist/collection/components/cpsl-grid/test/cpsl-grid.spec.js.map +1 -0
- package/dist/collection/components/cpsl-icon/cpsl-icon.css +95 -0
- package/dist/collection/components/cpsl-icon/cpsl-icon.js +68 -0
- package/dist/collection/components/cpsl-icon/cpsl-icon.js.map +1 -0
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.e2e.js +29 -0
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.spec.js +37 -0
- package/dist/collection/components/cpsl-icon/test/cpsl-icon.spec.js.map +1 -0
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.css +77 -0
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.js +19 -0
- package/dist/collection/components/cpsl-info-box/cpsl-info-box.js.map +1 -0
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.e2e.js +29 -0
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.spec.js +37 -0
- package/dist/collection/components/cpsl-info-box/test/cpsl-info-box.spec.js.map +1 -0
- package/dist/collection/components/cpsl-input/cpsl-input.css +194 -0
- package/dist/collection/components/cpsl-input/cpsl-input.js +708 -0
- package/dist/collection/components/cpsl-input/cpsl-input.js.map +1 -0
- package/dist/collection/components/cpsl-input/input-interface.js +2 -0
- package/dist/collection/components/cpsl-input/input-interface.js.map +1 -0
- package/dist/collection/components/cpsl-input/test/cpsl-input.e2e.js +29 -0
- package/dist/collection/components/cpsl-input/test/cpsl-input.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-input/test/cpsl-input.spec.js +37 -0
- package/dist/collection/components/cpsl-input/test/cpsl-input.spec.js.map +1 -0
- package/dist/collection/components/cpsl-modal/cpsl-modal.css +172 -0
- package/dist/collection/components/cpsl-modal/cpsl-modal.js +429 -0
- package/dist/collection/components/cpsl-modal/cpsl-modal.js.map +1 -0
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.e2e.js +29 -0
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.spec.js +37 -0
- package/dist/collection/components/cpsl-modal/test/cpsl-modal.spec.js.map +1 -0
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.css +11 -0
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.js +108 -0
- package/dist/collection/components/cpsl-overlay/cpsl-overlay.js.map +1 -0
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.e2e.js +29 -0
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.spec.js +37 -0
- package/dist/collection/components/cpsl-overlay/test/cpsl-overlay.spec.js.map +1 -0
- package/dist/collection/components/cpsl-pill/cpsl-pill.css +92 -0
- package/dist/collection/components/cpsl-pill/cpsl-pill.js +43 -0
- package/dist/collection/components/cpsl-pill/cpsl-pill.js.map +1 -0
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.e2e.js +29 -0
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.spec.js +37 -0
- package/dist/collection/components/cpsl-pill/test/cpsl-pill.spec.js.map +1 -0
- package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.css +82 -0
- package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.js +71 -0
- package/dist/collection/components/cpsl-progress-indicator/cpsl-progress-indicator.js.map +1 -0
- package/dist/collection/components/cpsl-progress-indicator/progress-indicator-interface.js +2 -0
- package/dist/collection/components/cpsl-progress-indicator/progress-indicator-interface.js.map +1 -0
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.e2e.js +29 -0
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.spec.js +37 -0
- package/dist/collection/components/cpsl-progress-indicator/test/cpsl-progress-indicator.spec.js.map +1 -0
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.css +81 -0
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js +107 -0
- package/dist/collection/components/cpsl-qr-code/cpsl-qr-code.js.map +1 -0
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.e2e.js +29 -0
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.spec.js +37 -0
- package/dist/collection/components/cpsl-qr-code/test/cpsl-qr-code.spec.js.map +1 -0
- package/dist/collection/components/cpsl-row/cpsl-row.css +136 -0
- package/dist/collection/components/cpsl-row/cpsl-row.js +19 -0
- package/dist/collection/components/cpsl-row/cpsl-row.js.map +1 -0
- package/dist/collection/components/cpsl-row/test/cpsl-row.e2e.js +29 -0
- package/dist/collection/components/cpsl-row/test/cpsl-row.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-row/test/cpsl-row.spec.js +37 -0
- package/dist/collection/components/cpsl-row/test/cpsl-row.spec.js.map +1 -0
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.css +175 -0
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js +252 -0
- package/dist/collection/components/cpsl-slide-button/cpsl-slide-button.js.map +1 -0
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.e2e.js +29 -0
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.spec.js +37 -0
- package/dist/collection/components/cpsl-slide-button/test/cpsl-slide-button.spec.js.map +1 -0
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.css +68 -0
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.js +69 -0
- package/dist/collection/components/cpsl-spinner/cpsl-spinner.js.map +1 -0
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.e2e.js +29 -0
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.spec.js +37 -0
- package/dist/collection/components/cpsl-spinner/test/cpsl-spinner.spec.js.map +1 -0
- package/dist/collection/components/cpsl-tab/cpsl-tab.css +23 -0
- package/dist/collection/components/cpsl-tab/cpsl-tab.js +121 -0
- package/dist/collection/components/cpsl-tab/cpsl-tab.js.map +1 -0
- package/dist/collection/components/cpsl-tab/tab-interface.js +2 -0
- package/dist/collection/components/cpsl-tab/tab-interface.js.map +1 -0
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.e2e.js +29 -0
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.spec.js +37 -0
- package/dist/collection/components/cpsl-tab/test/cpsl-tab.spec.js.map +1 -0
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.css +111 -0
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.js +170 -0
- package/dist/collection/components/cpsl-tabs/cpsl-tabs.js.map +1 -0
- package/dist/collection/components/cpsl-tabs/tabs-interface.js +2 -0
- package/dist/collection/components/cpsl-tabs/tabs-interface.js.map +1 -0
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.e2e.js +29 -0
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.spec.js +37 -0
- package/dist/collection/components/cpsl-tabs/test/cpsl-tabs.spec.js.map +1 -0
- package/dist/collection/components/cpsl-text/cpsl-text.css +160 -0
- package/dist/collection/components/cpsl-text/cpsl-text.js +128 -0
- package/dist/collection/components/cpsl-text/cpsl-text.js.map +1 -0
- package/dist/collection/components/cpsl-text/test/cpsl-text.e2e.js +29 -0
- package/dist/collection/components/cpsl-text/test/cpsl-text.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-text/test/cpsl-text.spec.js +37 -0
- package/dist/collection/components/cpsl-text/test/cpsl-text.spec.js.map +1 -0
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.css +97 -0
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js +67 -0
- package/dist/collection/components/cpsl-tile-button/cpsl-tile-button.js.map +1 -0
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.e2e.js +29 -0
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.e2e.js.map +1 -0
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.spec.js +37 -0
- package/dist/collection/components/cpsl-tile-button/test/cpsl-tile-button.spec.js.map +1 -0
- package/dist/collection/constants.js +6 -0
- package/dist/collection/constants.js.map +1 -0
- package/dist/collection/index.js +3 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/interface.js +2 -0
- package/dist/collection/interface.js.map +1 -0
- package/dist/collection/utils/media.js +18 -0
- package/dist/collection/utils/media.js.map +1 -0
- package/dist/collection/utils/theme/generateBorderRadii.js +56 -0
- package/dist/collection/utils/theme/generateBorderRadii.js.map +1 -0
- package/dist/collection/utils/theme/generateFont.js +28 -0
- package/dist/collection/utils/theme/generateFont.js.map +1 -0
- package/dist/collection/utils/theme/generatePalette.js +46 -0
- package/dist/collection/utils/theme/generatePalette.js.map +1 -0
- package/dist/collection/utils/theme/generateTheme.js +11 -0
- package/dist/collection/utils/theme/generateTheme.js.map +1 -0
- package/dist/collection/utils/theme/utils.js +21 -0
- package/dist/collection/utils/theme/utils.js.map +1 -0
- package/dist/esm/_commonjsHelpers-1789f0cf.js +9 -0
- package/dist/esm/_commonjsHelpers-1789f0cf.js.map +1 -0
- package/dist/esm/capsule.js +22 -0
- package/dist/esm/capsule.js.map +1 -0
- package/dist/esm/cpsl-alert_18.entry.js +14777 -0
- package/dist/esm/cpsl-alert_18.entry.js.map +1 -0
- package/dist/{capsule → esm}/cpsl-animation.entry.js +20 -114
- package/dist/esm/cpsl-animation.entry.js.map +1 -0
- package/dist/{capsule → esm}/cpsl-col.entry.js +4 -3
- package/dist/esm/cpsl-col.entry.js.map +1 -0
- package/dist/{capsule → esm}/cpsl-grid.entry.js +5 -4
- package/dist/esm/cpsl-grid.entry.js.map +1 -0
- package/dist/{capsule → esm}/cpsl-info-box.entry.js +4 -3
- package/dist/esm/cpsl-info-box.entry.js.map +1 -0
- package/dist/esm/cpsl-row.entry.js +18 -0
- package/dist/esm/cpsl-row.entry.js.map +1 -0
- package/dist/esm/index-f00e090c.js +1982 -0
- package/dist/esm/index-f00e090c.js.map +1 -0
- package/dist/esm/index.js +358 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +13 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/loader/cdn.js +3 -0
- package/dist/loader/index.cjs.js +3 -0
- package/dist/loader/index.d.ts +21 -0
- package/dist/loader/index.es2017.js +3 -0
- package/dist/loader/index.js +4 -0
- package/dist/loader/package.json +11 -0
- package/dist/scripts/buildIconLibrary.js +33 -0
- package/dist/scripts/buildIconLibrary.js.map +1 -0
- package/dist/types/assets/icons/index.d.ts +235 -0
- package/dist/types/components/cpsl-dropdown/cpsl-dropdown.d.ts +25 -0
- package/dist/types/components.d.ts +53 -0
- package/package.json +2 -3
- package/dist/capsule/_commonjsHelpers-bc8ff177.js +0 -36
- package/dist/capsule/_commonjsHelpers-bc8ff177.js.map +0 -1
- package/dist/capsule/cpsl-alert.entry.js +0 -31
- package/dist/capsule/cpsl-alert.entry.js.map +0 -1
- package/dist/capsule/cpsl-animation.entry.js.map +0 -1
- package/dist/capsule/cpsl-button.entry.js +0 -24
- package/dist/capsule/cpsl-button.entry.js.map +0 -1
- package/dist/capsule/cpsl-code-input.entry.js +0 -106
- package/dist/capsule/cpsl-code-input.entry.js.map +0 -1
- package/dist/capsule/cpsl-col.entry.js.map +0 -1
- package/dist/capsule/cpsl-divider.entry.js +0 -17
- package/dist/capsule/cpsl-divider.entry.js.map +0 -1
- package/dist/capsule/cpsl-grid.entry.js.map +0 -1
- package/dist/capsule/cpsl-icon.entry.js +0 -20
- package/dist/capsule/cpsl-icon.entry.js.map +0 -1
- package/dist/capsule/cpsl-info-box.entry.js.map +0 -1
- package/dist/capsule/cpsl-input.entry.js +0 -124
- package/dist/capsule/cpsl-input.entry.js.map +0 -1
- package/dist/capsule/cpsl-modal.entry.js +0 -3338
- package/dist/capsule/cpsl-modal.entry.js.map +0 -1
- package/dist/capsule/cpsl-overlay.entry.js +0 -44
- package/dist/capsule/cpsl-overlay.entry.js.map +0 -1
- package/dist/capsule/cpsl-pill.entry.js +0 -18
- package/dist/capsule/cpsl-pill.entry.js.map +0 -1
- package/dist/capsule/cpsl-progress-indicator.entry.js +0 -29
- package/dist/capsule/cpsl-progress-indicator.entry.js.map +0 -1
- package/dist/capsule/cpsl-qr-code.entry.js +0 -56
- package/dist/capsule/cpsl-qr-code.entry.js.map +0 -1
- package/dist/capsule/cpsl-row.entry.js +0 -17
- package/dist/capsule/cpsl-row.entry.js.map +0 -1
- package/dist/capsule/cpsl-slide-button.entry.js +0 -130
- package/dist/capsule/cpsl-slide-button.entry.js.map +0 -1
- package/dist/capsule/cpsl-spinner.entry.js +0 -25
- package/dist/capsule/cpsl-spinner.entry.js.map +0 -1
- package/dist/capsule/cpsl-tab.entry.js +0 -37
- package/dist/capsule/cpsl-tab.entry.js.map +0 -1
- package/dist/capsule/cpsl-tabs.entry.js +0 -71
- package/dist/capsule/cpsl-tabs.entry.js.map +0 -1
- package/dist/capsule/cpsl-text.entry.js +0 -66
- package/dist/capsule/cpsl-text.entry.js.map +0 -1
- package/dist/capsule/cpsl-tile-button.entry.js +0 -19
- package/dist/capsule/cpsl-tile-button.entry.js.map +0 -1
- package/dist/capsule/index-3ac1b9e9.js +0 -617
- package/dist/capsule/index-3ac1b9e9.js.map +0 -1
- package/dist/capsule/index-3ad00c7e.js +0 -6064
- package/dist/capsule/index-3ad00c7e.js.map +0 -1
- package/dist/capsule/index-f19e63df.js +0 -4148
- package/dist/capsule/index-f19e63df.js.map +0 -1
- package/dist/capsule/shadow-css-bc9e2af8.js +0 -478
- package/dist/capsule/shadow-css-bc9e2af8.js.map +0 -1
- /package/dist/{capsule → esm}/app-globals-0f993ce5.js +0 -0
- /package/dist/{capsule → esm}/app-globals-0f993ce5.js.map +0 -0
- /package/dist/{capsule → esm}/constants-7b49abd5.js +0 -0
- /package/dist/{capsule → esm}/constants-7b49abd5.js.map +0 -0
- /package/dist/types/Users/{taylorbosch → vinay}/Documents/GitHub/Capsule/component-library/core/.stencil/scripts/buildIconLibrary.d.ts +0 -0
@@ -0,0 +1,2012 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
function _interopNamespace(e) {
|
4
|
+
if (e && e.__esModule) return e;
|
5
|
+
var n = Object.create(null);
|
6
|
+
if (e) {
|
7
|
+
Object.keys(e).forEach(function (k) {
|
8
|
+
if (k !== 'default') {
|
9
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
10
|
+
Object.defineProperty(n, k, d.get ? d : {
|
11
|
+
enumerable: true,
|
12
|
+
get: function () {
|
13
|
+
return e[k];
|
14
|
+
}
|
15
|
+
});
|
16
|
+
}
|
17
|
+
});
|
18
|
+
}
|
19
|
+
n['default'] = e;
|
20
|
+
return Object.freeze(n);
|
21
|
+
}
|
22
|
+
|
23
|
+
const NAMESPACE = 'capsule';
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Virtual DOM patching algorithm based on Snabbdom by
|
27
|
+
* Simon Friis Vindum (@paldepind)
|
28
|
+
* Licensed under the MIT License
|
29
|
+
* https://github.com/snabbdom/snabbdom/blob/master/LICENSE
|
30
|
+
*
|
31
|
+
* Modified for Stencil's renderer and slot projection
|
32
|
+
*/
|
33
|
+
let scopeId;
|
34
|
+
let hostTagName;
|
35
|
+
let useNativeShadowDom = false;
|
36
|
+
let isSvgMode = false;
|
37
|
+
let queuePending = false;
|
38
|
+
const createTime = (fnName, tagName = '') => {
|
39
|
+
{
|
40
|
+
return () => {
|
41
|
+
return;
|
42
|
+
};
|
43
|
+
}
|
44
|
+
};
|
45
|
+
const uniqueTime = (key, measureText) => {
|
46
|
+
{
|
47
|
+
return () => {
|
48
|
+
return;
|
49
|
+
};
|
50
|
+
}
|
51
|
+
};
|
52
|
+
const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
|
53
|
+
/**
|
54
|
+
* Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
|
55
|
+
*
|
56
|
+
* Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
|
57
|
+
* support as of Stencil v4.
|
58
|
+
*/
|
59
|
+
const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
|
60
|
+
/**
|
61
|
+
* Default style mode id
|
62
|
+
*/
|
63
|
+
/**
|
64
|
+
* Reusable empty obj/array
|
65
|
+
* Don't add values to these!!
|
66
|
+
*/
|
67
|
+
const EMPTY_OBJ = {};
|
68
|
+
/**
|
69
|
+
* Namespaces
|
70
|
+
*/
|
71
|
+
const SVG_NS = 'http://www.w3.org/2000/svg';
|
72
|
+
const HTML_NS = 'http://www.w3.org/1999/xhtml';
|
73
|
+
const isDef = (v) => v != null;
|
74
|
+
/**
|
75
|
+
* Check whether a value is a 'complex type', defined here as an object or a
|
76
|
+
* function.
|
77
|
+
*
|
78
|
+
* @param o the value to check
|
79
|
+
* @returns whether it's a complex type or not
|
80
|
+
*/
|
81
|
+
const isComplexType = (o) => {
|
82
|
+
// https://jsperf.com/typeof-fn-object/5
|
83
|
+
o = typeof o;
|
84
|
+
return o === 'object' || o === 'function';
|
85
|
+
};
|
86
|
+
/**
|
87
|
+
* Helper method for querying a `meta` tag that contains a nonce value
|
88
|
+
* out of a DOM's head.
|
89
|
+
*
|
90
|
+
* @param doc The DOM containing the `head` to query against
|
91
|
+
* @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
|
92
|
+
* exists or the tag has no content.
|
93
|
+
*/
|
94
|
+
function queryNonceMetaTagContent(doc) {
|
95
|
+
var _a, _b, _c;
|
96
|
+
return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
|
97
|
+
}
|
98
|
+
/**
|
99
|
+
* Production h() function based on Preact by
|
100
|
+
* Jason Miller (@developit)
|
101
|
+
* Licensed under the MIT License
|
102
|
+
* https://github.com/developit/preact/blob/master/LICENSE
|
103
|
+
*
|
104
|
+
* Modified for Stencil's compiler and vdom
|
105
|
+
*/
|
106
|
+
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
|
107
|
+
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
|
108
|
+
const h = (nodeName, vnodeData, ...children) => {
|
109
|
+
let child = null;
|
110
|
+
let key = null;
|
111
|
+
let simple = false;
|
112
|
+
let lastSimple = false;
|
113
|
+
const vNodeChildren = [];
|
114
|
+
const walk = (c) => {
|
115
|
+
for (let i = 0; i < c.length; i++) {
|
116
|
+
child = c[i];
|
117
|
+
if (Array.isArray(child)) {
|
118
|
+
walk(child);
|
119
|
+
}
|
120
|
+
else if (child != null && typeof child !== 'boolean') {
|
121
|
+
if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
|
122
|
+
child = String(child);
|
123
|
+
}
|
124
|
+
if (simple && lastSimple) {
|
125
|
+
// If the previous child was simple (string), we merge both
|
126
|
+
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
127
|
+
}
|
128
|
+
else {
|
129
|
+
// Append a new vNode, if it's text, we create a text vNode
|
130
|
+
vNodeChildren.push(simple ? newVNode(null, child) : child);
|
131
|
+
}
|
132
|
+
lastSimple = simple;
|
133
|
+
}
|
134
|
+
}
|
135
|
+
};
|
136
|
+
walk(children);
|
137
|
+
if (vnodeData) {
|
138
|
+
if (vnodeData.key) {
|
139
|
+
key = vnodeData.key;
|
140
|
+
}
|
141
|
+
// normalize class / className attributes
|
142
|
+
{
|
143
|
+
const classData = vnodeData.className || vnodeData.class;
|
144
|
+
if (classData) {
|
145
|
+
vnodeData.class =
|
146
|
+
typeof classData !== 'object'
|
147
|
+
? classData
|
148
|
+
: Object.keys(classData)
|
149
|
+
.filter((k) => classData[k])
|
150
|
+
.join(' ');
|
151
|
+
}
|
152
|
+
}
|
153
|
+
}
|
154
|
+
const vnode = newVNode(nodeName, null);
|
155
|
+
vnode.$attrs$ = vnodeData;
|
156
|
+
if (vNodeChildren.length > 0) {
|
157
|
+
vnode.$children$ = vNodeChildren;
|
158
|
+
}
|
159
|
+
{
|
160
|
+
vnode.$key$ = key;
|
161
|
+
}
|
162
|
+
return vnode;
|
163
|
+
};
|
164
|
+
/**
|
165
|
+
* A utility function for creating a virtual DOM node from a tag and some
|
166
|
+
* possible text content.
|
167
|
+
*
|
168
|
+
* @param tag the tag for this element
|
169
|
+
* @param text possible text content for the node
|
170
|
+
* @returns a newly-minted virtual DOM node
|
171
|
+
*/
|
172
|
+
const newVNode = (tag, text) => {
|
173
|
+
const vnode = {
|
174
|
+
$flags$: 0,
|
175
|
+
$tag$: tag,
|
176
|
+
$text$: text,
|
177
|
+
$elm$: null,
|
178
|
+
$children$: null,
|
179
|
+
};
|
180
|
+
{
|
181
|
+
vnode.$attrs$ = null;
|
182
|
+
}
|
183
|
+
{
|
184
|
+
vnode.$key$ = null;
|
185
|
+
}
|
186
|
+
return vnode;
|
187
|
+
};
|
188
|
+
const Host = {};
|
189
|
+
/**
|
190
|
+
* Check whether a given node is a Host node or not
|
191
|
+
*
|
192
|
+
* @param node the virtual DOM node to check
|
193
|
+
* @returns whether it's a Host node or not
|
194
|
+
*/
|
195
|
+
const isHost = (node) => node && node.$tag$ === Host;
|
196
|
+
/**
|
197
|
+
* Parse a new property value for a given property type.
|
198
|
+
*
|
199
|
+
* While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
|
200
|
+
* it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
|
201
|
+
* 1. `any`, the type given to `propValue` in the function signature
|
202
|
+
* 2. the type stored from `propType`.
|
203
|
+
*
|
204
|
+
* This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
|
205
|
+
*
|
206
|
+
* Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
|
207
|
+
* a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
|
208
|
+
* based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
|
209
|
+
* ```tsx
|
210
|
+
* <my-cmp prop-val={0}></my-cmp>
|
211
|
+
* ```
|
212
|
+
*
|
213
|
+
* HTML prop values on the other hand, will always a string
|
214
|
+
*
|
215
|
+
* @param propValue the new value to coerce to some type
|
216
|
+
* @param propType the type of the prop, expressed as a binary number
|
217
|
+
* @returns the parsed/coerced value
|
218
|
+
*/
|
219
|
+
const parsePropertyValue = (propValue, propType) => {
|
220
|
+
// ensure this value is of the correct prop type
|
221
|
+
if (propValue != null && !isComplexType(propValue)) {
|
222
|
+
if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
|
223
|
+
// per the HTML spec, any string value means it is a boolean true value
|
224
|
+
// but we'll cheat here and say that the string "false" is the boolean false
|
225
|
+
return propValue === 'false' ? false : propValue === '' || !!propValue;
|
226
|
+
}
|
227
|
+
if (propType & 2 /* MEMBER_FLAGS.Number */) {
|
228
|
+
// force it to be a number
|
229
|
+
return parseFloat(propValue);
|
230
|
+
}
|
231
|
+
if (propType & 1 /* MEMBER_FLAGS.String */) {
|
232
|
+
// could have been passed as a number or boolean
|
233
|
+
// but we still want it as a string
|
234
|
+
return String(propValue);
|
235
|
+
}
|
236
|
+
// redundant return here for better minification
|
237
|
+
return propValue;
|
238
|
+
}
|
239
|
+
// not sure exactly what type we want
|
240
|
+
// so no need to change to a different type
|
241
|
+
return propValue;
|
242
|
+
};
|
243
|
+
const getElement = (ref) => (getHostRef(ref).$hostElement$ );
|
244
|
+
const createEvent = (ref, name, flags) => {
|
245
|
+
const elm = getElement(ref);
|
246
|
+
return {
|
247
|
+
emit: (detail) => {
|
248
|
+
return emitEvent(elm, name, {
|
249
|
+
bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
|
250
|
+
composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
|
251
|
+
cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
|
252
|
+
detail,
|
253
|
+
});
|
254
|
+
},
|
255
|
+
};
|
256
|
+
};
|
257
|
+
/**
|
258
|
+
* Helper function to create & dispatch a custom Event on a provided target
|
259
|
+
* @param elm the target of the Event
|
260
|
+
* @param name the name to give the custom Event
|
261
|
+
* @param opts options for configuring a custom Event
|
262
|
+
* @returns the custom Event
|
263
|
+
*/
|
264
|
+
const emitEvent = (elm, name, opts) => {
|
265
|
+
const ev = plt.ce(name, opts);
|
266
|
+
elm.dispatchEvent(ev);
|
267
|
+
return ev;
|
268
|
+
};
|
269
|
+
const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
|
270
|
+
const registerStyle = (scopeId, cssText, allowCS) => {
|
271
|
+
let style = styles.get(scopeId);
|
272
|
+
if (supportsConstructableStylesheets && allowCS) {
|
273
|
+
style = (style || new CSSStyleSheet());
|
274
|
+
if (typeof style === 'string') {
|
275
|
+
style = cssText;
|
276
|
+
}
|
277
|
+
else {
|
278
|
+
style.replaceSync(cssText);
|
279
|
+
}
|
280
|
+
}
|
281
|
+
else {
|
282
|
+
style = cssText;
|
283
|
+
}
|
284
|
+
styles.set(scopeId, style);
|
285
|
+
};
|
286
|
+
const addStyle = (styleContainerNode, cmpMeta, mode) => {
|
287
|
+
var _a;
|
288
|
+
const scopeId = getScopeId(cmpMeta);
|
289
|
+
const style = styles.get(scopeId);
|
290
|
+
// if an element is NOT connected then getRootNode() will return the wrong root node
|
291
|
+
// so the fallback is to always use the document for the root node in those cases
|
292
|
+
styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
|
293
|
+
if (style) {
|
294
|
+
if (typeof style === 'string') {
|
295
|
+
styleContainerNode = styleContainerNode.head || styleContainerNode;
|
296
|
+
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
|
297
|
+
let styleElm;
|
298
|
+
if (!appliedStyles) {
|
299
|
+
rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
|
300
|
+
}
|
301
|
+
if (!appliedStyles.has(scopeId)) {
|
302
|
+
{
|
303
|
+
styleElm = doc.createElement('style');
|
304
|
+
styleElm.innerHTML = style;
|
305
|
+
// Apply CSP nonce to the style tag if it exists
|
306
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
307
|
+
if (nonce != null) {
|
308
|
+
styleElm.setAttribute('nonce', nonce);
|
309
|
+
}
|
310
|
+
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
|
311
|
+
}
|
312
|
+
// Add styles for `slot-fb` elements if we're using slots outside the Shadow DOM
|
313
|
+
if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
|
314
|
+
styleElm.innerHTML += SLOT_FB_CSS;
|
315
|
+
}
|
316
|
+
if (appliedStyles) {
|
317
|
+
appliedStyles.add(scopeId);
|
318
|
+
}
|
319
|
+
}
|
320
|
+
}
|
321
|
+
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
|
322
|
+
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
|
323
|
+
}
|
324
|
+
}
|
325
|
+
return scopeId;
|
326
|
+
};
|
327
|
+
const attachStyles = (hostRef) => {
|
328
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
329
|
+
const elm = hostRef.$hostElement$;
|
330
|
+
const flags = cmpMeta.$flags$;
|
331
|
+
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
|
332
|
+
const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
|
333
|
+
if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
|
334
|
+
// only required when we're NOT using native shadow dom (slot)
|
335
|
+
// or this browser doesn't support native shadow dom
|
336
|
+
// and this host element was NOT created with SSR
|
337
|
+
// let's pick out the inner content for slot projection
|
338
|
+
// create a node to represent where the original
|
339
|
+
// content was first placed, which is useful later on
|
340
|
+
// DOM WRITE!!
|
341
|
+
elm['s-sc'] = scopeId;
|
342
|
+
elm.classList.add(scopeId + '-h');
|
343
|
+
}
|
344
|
+
endAttachStyles();
|
345
|
+
};
|
346
|
+
const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
|
347
|
+
/**
|
348
|
+
* Production setAccessor() function based on Preact by
|
349
|
+
* Jason Miller (@developit)
|
350
|
+
* Licensed under the MIT License
|
351
|
+
* https://github.com/developit/preact/blob/master/LICENSE
|
352
|
+
*
|
353
|
+
* Modified for Stencil's compiler and vdom
|
354
|
+
*/
|
355
|
+
/**
|
356
|
+
* When running a VDom render set properties present on a VDom node onto the
|
357
|
+
* corresponding HTML element.
|
358
|
+
*
|
359
|
+
* Note that this function has special functionality for the `class`,
|
360
|
+
* `style`, `key`, and `ref` attributes, as well as event handlers (like
|
361
|
+
* `onClick`, etc). All others are just passed through as-is.
|
362
|
+
*
|
363
|
+
* @param elm the HTMLElement onto which attributes should be set
|
364
|
+
* @param memberName the name of the attribute to set
|
365
|
+
* @param oldValue the old value for the attribute
|
366
|
+
* @param newValue the new value for the attribute
|
367
|
+
* @param isSvg whether we're in an svg context or not
|
368
|
+
* @param flags bitflags for Vdom variables
|
369
|
+
*/
|
370
|
+
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
|
371
|
+
if (oldValue !== newValue) {
|
372
|
+
let isProp = isMemberInElement(elm, memberName);
|
373
|
+
let ln = memberName.toLowerCase();
|
374
|
+
if (memberName === 'class') {
|
375
|
+
const classList = elm.classList;
|
376
|
+
const oldClasses = parseClassList(oldValue);
|
377
|
+
const newClasses = parseClassList(newValue);
|
378
|
+
classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
|
379
|
+
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
380
|
+
}
|
381
|
+
else if (memberName === 'style') {
|
382
|
+
// update style attribute, css properties and values
|
383
|
+
{
|
384
|
+
for (const prop in oldValue) {
|
385
|
+
if (!newValue || newValue[prop] == null) {
|
386
|
+
if (prop.includes('-')) {
|
387
|
+
elm.style.removeProperty(prop);
|
388
|
+
}
|
389
|
+
else {
|
390
|
+
elm.style[prop] = '';
|
391
|
+
}
|
392
|
+
}
|
393
|
+
}
|
394
|
+
}
|
395
|
+
for (const prop in newValue) {
|
396
|
+
if (!oldValue || newValue[prop] !== oldValue[prop]) {
|
397
|
+
if (prop.includes('-')) {
|
398
|
+
elm.style.setProperty(prop, newValue[prop]);
|
399
|
+
}
|
400
|
+
else {
|
401
|
+
elm.style[prop] = newValue[prop];
|
402
|
+
}
|
403
|
+
}
|
404
|
+
}
|
405
|
+
}
|
406
|
+
else if (memberName === 'key')
|
407
|
+
;
|
408
|
+
else if ((!isProp ) &&
|
409
|
+
memberName[0] === 'o' &&
|
410
|
+
memberName[1] === 'n') {
|
411
|
+
// Event Handlers
|
412
|
+
// so if the member name starts with "on" and the 3rd characters is
|
413
|
+
// a capital letter, and it's not already a member on the element,
|
414
|
+
// then we're assuming it's an event listener
|
415
|
+
if (memberName[2] === '-') {
|
416
|
+
// on- prefixed events
|
417
|
+
// allows to be explicit about the dom event to listen without any magic
|
418
|
+
// under the hood:
|
419
|
+
// <my-cmp on-click> // listens for "click"
|
420
|
+
// <my-cmp on-Click> // listens for "Click"
|
421
|
+
// <my-cmp on-ionChange> // listens for "ionChange"
|
422
|
+
// <my-cmp on-EVENTS> // listens for "EVENTS"
|
423
|
+
memberName = memberName.slice(3);
|
424
|
+
}
|
425
|
+
else if (isMemberInElement(win, ln)) {
|
426
|
+
// standard event
|
427
|
+
// the JSX attribute could have been "onMouseOver" and the
|
428
|
+
// member name "onmouseover" is on the window's prototype
|
429
|
+
// so let's add the listener "mouseover", which is all lowercased
|
430
|
+
memberName = ln.slice(2);
|
431
|
+
}
|
432
|
+
else {
|
433
|
+
// custom event
|
434
|
+
// the JSX attribute could have been "onMyCustomEvent"
|
435
|
+
// so let's trim off the "on" prefix and lowercase the first character
|
436
|
+
// and add the listener "myCustomEvent"
|
437
|
+
// except for the first character, we keep the event name case
|
438
|
+
memberName = ln[2] + memberName.slice(3);
|
439
|
+
}
|
440
|
+
if (oldValue || newValue) {
|
441
|
+
// Need to account for "capture" events.
|
442
|
+
// If the event name ends with "Capture", we'll update the name to remove
|
443
|
+
// the "Capture" suffix and make sure the event listener is setup to handle the capture event.
|
444
|
+
const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
|
445
|
+
// Make sure we only replace the last instance of "Capture"
|
446
|
+
memberName = memberName.replace(CAPTURE_EVENT_REGEX, '');
|
447
|
+
if (oldValue) {
|
448
|
+
plt.rel(elm, memberName, oldValue, capture);
|
449
|
+
}
|
450
|
+
if (newValue) {
|
451
|
+
plt.ael(elm, memberName, newValue, capture);
|
452
|
+
}
|
453
|
+
}
|
454
|
+
}
|
455
|
+
else {
|
456
|
+
// Set property if it exists and it's not a SVG
|
457
|
+
const isComplex = isComplexType(newValue);
|
458
|
+
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
|
459
|
+
try {
|
460
|
+
if (!elm.tagName.includes('-')) {
|
461
|
+
const n = newValue == null ? '' : newValue;
|
462
|
+
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
|
463
|
+
if (memberName === 'list') {
|
464
|
+
isProp = false;
|
465
|
+
}
|
466
|
+
else if (oldValue == null || elm[memberName] != n) {
|
467
|
+
elm[memberName] = n;
|
468
|
+
}
|
469
|
+
}
|
470
|
+
else {
|
471
|
+
elm[memberName] = newValue;
|
472
|
+
}
|
473
|
+
}
|
474
|
+
catch (e) {
|
475
|
+
/**
|
476
|
+
* in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
|
477
|
+
*/
|
478
|
+
}
|
479
|
+
}
|
480
|
+
if (newValue == null || newValue === false) {
|
481
|
+
if (newValue !== false || elm.getAttribute(memberName) === '') {
|
482
|
+
{
|
483
|
+
elm.removeAttribute(memberName);
|
484
|
+
}
|
485
|
+
}
|
486
|
+
}
|
487
|
+
else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
|
488
|
+
newValue = newValue === true ? '' : newValue;
|
489
|
+
{
|
490
|
+
elm.setAttribute(memberName, newValue);
|
491
|
+
}
|
492
|
+
}
|
493
|
+
}
|
494
|
+
}
|
495
|
+
};
|
496
|
+
const parseClassListRegex = /\s/;
|
497
|
+
/**
|
498
|
+
* Parsed a string of classnames into an array
|
499
|
+
* @param value className string, e.g. "foo bar baz"
|
500
|
+
* @returns list of classes, e.g. ["foo", "bar", "baz"]
|
501
|
+
*/
|
502
|
+
const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
|
503
|
+
const CAPTURE_EVENT_SUFFIX = 'Capture';
|
504
|
+
const CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + '$');
|
505
|
+
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
|
506
|
+
// if the element passed in is a shadow root, which is a document fragment
|
507
|
+
// then we want to be adding attrs/props to the shadow root's "host" element
|
508
|
+
// if it's not a shadow root, then we add attrs/props to the same element
|
509
|
+
const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
|
510
|
+
? newVnode.$elm$.host
|
511
|
+
: newVnode.$elm$;
|
512
|
+
const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
|
513
|
+
const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
|
514
|
+
{
|
515
|
+
// remove attributes no longer present on the vnode by setting them to undefined
|
516
|
+
for (memberName in oldVnodeAttrs) {
|
517
|
+
if (!(memberName in newVnodeAttrs)) {
|
518
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
|
519
|
+
}
|
520
|
+
}
|
521
|
+
}
|
522
|
+
// add new & update changed attributes
|
523
|
+
for (memberName in newVnodeAttrs) {
|
524
|
+
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
|
525
|
+
}
|
526
|
+
};
|
527
|
+
/**
|
528
|
+
* Create a DOM Node corresponding to one of the children of a given VNode.
|
529
|
+
*
|
530
|
+
* @param oldParentVNode the parent VNode from the previous render
|
531
|
+
* @param newParentVNode the parent VNode from the current render
|
532
|
+
* @param childIndex the index of the VNode, in the _new_ parent node's
|
533
|
+
* children, for which we will create a new DOM node
|
534
|
+
* @param parentElm the parent DOM node which our new node will be a child of
|
535
|
+
* @returns the newly created node
|
536
|
+
*/
|
537
|
+
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
|
538
|
+
// tslint:disable-next-line: prefer-const
|
539
|
+
const newVNode = newParentVNode.$children$[childIndex];
|
540
|
+
let i = 0;
|
541
|
+
let elm;
|
542
|
+
let childNode;
|
543
|
+
if (newVNode.$text$ !== null) {
|
544
|
+
// create text node
|
545
|
+
elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
|
546
|
+
}
|
547
|
+
else {
|
548
|
+
if (!isSvgMode) {
|
549
|
+
isSvgMode = newVNode.$tag$ === 'svg';
|
550
|
+
}
|
551
|
+
// create element
|
552
|
+
elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
|
553
|
+
);
|
554
|
+
if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
|
555
|
+
isSvgMode = false;
|
556
|
+
}
|
557
|
+
// add css classes, attrs, props, listeners, etc.
|
558
|
+
{
|
559
|
+
updateElement(null, newVNode, isSvgMode);
|
560
|
+
}
|
561
|
+
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
|
562
|
+
// if there is a scopeId and this is the initial render
|
563
|
+
// then let's add the scopeId as a css class
|
564
|
+
elm.classList.add((elm['s-si'] = scopeId));
|
565
|
+
}
|
566
|
+
if (newVNode.$children$) {
|
567
|
+
for (i = 0; i < newVNode.$children$.length; ++i) {
|
568
|
+
// create the node
|
569
|
+
childNode = createElm(oldParentVNode, newVNode, i);
|
570
|
+
// return node could have been null
|
571
|
+
if (childNode) {
|
572
|
+
// append our new node
|
573
|
+
elm.appendChild(childNode);
|
574
|
+
}
|
575
|
+
}
|
576
|
+
}
|
577
|
+
{
|
578
|
+
if (newVNode.$tag$ === 'svg') {
|
579
|
+
// Only reset the SVG context when we're exiting <svg> element
|
580
|
+
isSvgMode = false;
|
581
|
+
}
|
582
|
+
else if (elm.tagName === 'foreignObject') {
|
583
|
+
// Reenter SVG context when we're exiting <foreignObject> element
|
584
|
+
isSvgMode = true;
|
585
|
+
}
|
586
|
+
}
|
587
|
+
}
|
588
|
+
// This needs to always happen so we can hide nodes that are projected
|
589
|
+
// to another component but don't end up in a slot
|
590
|
+
elm['s-hn'] = hostTagName;
|
591
|
+
return elm;
|
592
|
+
};
|
593
|
+
/**
|
594
|
+
* Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
|
595
|
+
* add them to the DOM in the appropriate place.
|
596
|
+
*
|
597
|
+
* @param parentElm the DOM node which should be used as a parent for the new
|
598
|
+
* DOM nodes
|
599
|
+
* @param before a child of the `parentElm` which the new children should be
|
600
|
+
* inserted before (optional)
|
601
|
+
* @param parentVNode the parent virtual DOM node
|
602
|
+
* @param vnodes the new child virtual DOM nodes to produce DOM nodes for
|
603
|
+
* @param startIdx the index in the child virtual DOM nodes at which to start
|
604
|
+
* creating DOM nodes (inclusive)
|
605
|
+
* @param endIdx the index in the child virtual DOM nodes at which to stop
|
606
|
+
* creating DOM nodes (inclusive)
|
607
|
+
*/
|
608
|
+
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
|
609
|
+
let containerElm = (parentElm);
|
610
|
+
let childNode;
|
611
|
+
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
|
612
|
+
containerElm = containerElm.shadowRoot;
|
613
|
+
}
|
614
|
+
for (; startIdx <= endIdx; ++startIdx) {
|
615
|
+
if (vnodes[startIdx]) {
|
616
|
+
childNode = createElm(null, parentVNode, startIdx);
|
617
|
+
if (childNode) {
|
618
|
+
vnodes[startIdx].$elm$ = childNode;
|
619
|
+
containerElm.insertBefore(childNode, before);
|
620
|
+
}
|
621
|
+
}
|
622
|
+
}
|
623
|
+
};
|
624
|
+
/**
|
625
|
+
* Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
|
626
|
+
* This can be used to, for instance, clean up after a list of children which
|
627
|
+
* should no longer be shown.
|
628
|
+
*
|
629
|
+
* This function also handles some of Stencil's slot relocation logic.
|
630
|
+
*
|
631
|
+
* @param vnodes a list of virtual DOM nodes to remove
|
632
|
+
* @param startIdx the index at which to start removing nodes (inclusive)
|
633
|
+
* @param endIdx the index at which to stop removing nodes (inclusive)
|
634
|
+
*/
|
635
|
+
const removeVnodes = (vnodes, startIdx, endIdx) => {
|
636
|
+
for (let index = startIdx; index <= endIdx; ++index) {
|
637
|
+
const vnode = vnodes[index];
|
638
|
+
if (vnode) {
|
639
|
+
const elm = vnode.$elm$;
|
640
|
+
if (elm) {
|
641
|
+
// remove the vnode's element from the dom
|
642
|
+
elm.remove();
|
643
|
+
}
|
644
|
+
}
|
645
|
+
}
|
646
|
+
};
|
647
|
+
/**
|
648
|
+
* Reconcile the children of a new VNode with the children of an old VNode by
|
649
|
+
* traversing the two collections of children, identifying nodes that are
|
650
|
+
* conserved or changed, calling out to `patch` to make any necessary
|
651
|
+
* updates to the DOM, and rearranging DOM nodes as needed.
|
652
|
+
*
|
653
|
+
* The algorithm for reconciling children works by analyzing two 'windows' onto
|
654
|
+
* the two arrays of children (`oldCh` and `newCh`). We keep track of the
|
655
|
+
* 'windows' by storing start and end indices and references to the
|
656
|
+
* corresponding array entries. Initially the two 'windows' are basically equal
|
657
|
+
* to the entire array, but we progressively narrow the windows until there are
|
658
|
+
* no children left to update by doing the following:
|
659
|
+
*
|
660
|
+
* 1. Skip any `null` entries at the beginning or end of the two arrays, so
|
661
|
+
* that if we have an initial array like the following we'll end up dealing
|
662
|
+
* only with a window bounded by the highlighted elements:
|
663
|
+
*
|
664
|
+
* [null, null, VNode1 , ... , VNode2, null, null]
|
665
|
+
* ^^^^^^ ^^^^^^
|
666
|
+
*
|
667
|
+
* 2. Check to see if the elements at the head and tail positions are equal
|
668
|
+
* across the windows. This will basically detect elements which haven't
|
669
|
+
* been added, removed, or changed position, i.e. if you had the following
|
670
|
+
* VNode elements (represented as HTML):
|
671
|
+
*
|
672
|
+
* oldVNode: `<div><p><span>HEY</span></p></div>`
|
673
|
+
* newVNode: `<div><p><span>THERE</span></p></div>`
|
674
|
+
*
|
675
|
+
* Then when comparing the children of the `<div>` tag we check the equality
|
676
|
+
* of the VNodes corresponding to the `<p>` tags and, since they are the
|
677
|
+
* same tag in the same position, we'd be able to avoid completely
|
678
|
+
* re-rendering the subtree under them with a new DOM element and would just
|
679
|
+
* call out to `patch` to handle reconciling their children and so on.
|
680
|
+
*
|
681
|
+
* 3. Check, for both windows, to see if the element at the beginning of the
|
682
|
+
* window corresponds to the element at the end of the other window. This is
|
683
|
+
* a heuristic which will let us identify _some_ situations in which
|
684
|
+
* elements have changed position, for instance it _should_ detect that the
|
685
|
+
* children nodes themselves have not changed but merely moved in the
|
686
|
+
* following example:
|
687
|
+
*
|
688
|
+
* oldVNode: `<div><element-one /><element-two /></div>`
|
689
|
+
* newVNode: `<div><element-two /><element-one /></div>`
|
690
|
+
*
|
691
|
+
* If we find cases like this then we also need to move the concrete DOM
|
692
|
+
* elements corresponding to the moved children to write the re-order to the
|
693
|
+
* DOM.
|
694
|
+
*
|
695
|
+
* 4. Finally, if VNodes have the `key` attribute set on them we check for any
|
696
|
+
* nodes in the old children which have the same key as the first element in
|
697
|
+
* our window on the new children. If we find such a node we handle calling
|
698
|
+
* out to `patch`, moving relevant DOM nodes, and so on, in accordance with
|
699
|
+
* what we find.
|
700
|
+
*
|
701
|
+
* Finally, once we've narrowed our 'windows' to the point that either of them
|
702
|
+
* collapse (i.e. they have length 0) we then handle any remaining VNode
|
703
|
+
* insertion or deletion that needs to happen to get a DOM state that correctly
|
704
|
+
* reflects the new child VNodes. If, for instance, after our window on the old
|
705
|
+
* children has collapsed we still have more nodes on the new children that
|
706
|
+
* we haven't dealt with yet then we need to add them, or if the new children
|
707
|
+
* collapse but we still have unhandled _old_ children then we need to make
|
708
|
+
* sure the corresponding DOM nodes are removed.
|
709
|
+
*
|
710
|
+
* @param parentElm the node into which the parent VNode is rendered
|
711
|
+
* @param oldCh the old children of the parent node
|
712
|
+
* @param newVNode the new VNode which will replace the parent
|
713
|
+
* @param newCh the new children of the parent node
|
714
|
+
* @param isInitialRender whether or not this is the first render of the vdom
|
715
|
+
*/
|
716
|
+
const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
|
717
|
+
let oldStartIdx = 0;
|
718
|
+
let newStartIdx = 0;
|
719
|
+
let idxInOld = 0;
|
720
|
+
let i = 0;
|
721
|
+
let oldEndIdx = oldCh.length - 1;
|
722
|
+
let oldStartVnode = oldCh[0];
|
723
|
+
let oldEndVnode = oldCh[oldEndIdx];
|
724
|
+
let newEndIdx = newCh.length - 1;
|
725
|
+
let newStartVnode = newCh[0];
|
726
|
+
let newEndVnode = newCh[newEndIdx];
|
727
|
+
let node;
|
728
|
+
let elmToMove;
|
729
|
+
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
|
730
|
+
if (oldStartVnode == null) {
|
731
|
+
// VNode might have been moved left
|
732
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
733
|
+
}
|
734
|
+
else if (oldEndVnode == null) {
|
735
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
736
|
+
}
|
737
|
+
else if (newStartVnode == null) {
|
738
|
+
newStartVnode = newCh[++newStartIdx];
|
739
|
+
}
|
740
|
+
else if (newEndVnode == null) {
|
741
|
+
newEndVnode = newCh[--newEndIdx];
|
742
|
+
}
|
743
|
+
else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
|
744
|
+
// if the start nodes are the same then we should patch the new VNode
|
745
|
+
// onto the old one, and increment our `newStartIdx` and `oldStartIdx`
|
746
|
+
// indices to reflect that. We don't need to move any DOM Nodes around
|
747
|
+
// since things are matched up in order.
|
748
|
+
patch(oldStartVnode, newStartVnode, isInitialRender);
|
749
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
750
|
+
newStartVnode = newCh[++newStartIdx];
|
751
|
+
}
|
752
|
+
else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
|
753
|
+
// likewise, if the end nodes are the same we patch new onto old and
|
754
|
+
// decrement our end indices, and also likewise in this case we don't
|
755
|
+
// need to move any DOM Nodes.
|
756
|
+
patch(oldEndVnode, newEndVnode, isInitialRender);
|
757
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
758
|
+
newEndVnode = newCh[--newEndIdx];
|
759
|
+
}
|
760
|
+
else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
|
761
|
+
patch(oldStartVnode, newEndVnode, isInitialRender);
|
762
|
+
// We need to move the element for `oldStartVnode` into a position which
|
763
|
+
// will be appropriate for `newEndVnode`. For this we can use
|
764
|
+
// `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
|
765
|
+
// sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
|
766
|
+
// `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
|
767
|
+
//
|
768
|
+
// <old-start-node />
|
769
|
+
// <some-intervening-node />
|
770
|
+
// <old-end-node />
|
771
|
+
// <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
|
772
|
+
// <next-sibling />
|
773
|
+
//
|
774
|
+
// If instead `oldEndVnode.$elm$` has no sibling then we just want to put
|
775
|
+
// the node for `oldStartVnode` at the end of the children of
|
776
|
+
// `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
|
777
|
+
// aren't any siblings, and passing `null` to `Node.insertBefore` will
|
778
|
+
// append it to the children of the parent element.
|
779
|
+
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
|
780
|
+
oldStartVnode = oldCh[++oldStartIdx];
|
781
|
+
newEndVnode = newCh[--newEndIdx];
|
782
|
+
}
|
783
|
+
else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
|
784
|
+
patch(oldEndVnode, newStartVnode, isInitialRender);
|
785
|
+
// We've already checked above if `oldStartVnode` and `newStartVnode` are
|
786
|
+
// the same node, so since we're here we know that they are not. Thus we
|
787
|
+
// can move the element for `oldEndVnode` _before_ the element for
|
788
|
+
// `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
|
789
|
+
// future.
|
790
|
+
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
|
791
|
+
oldEndVnode = oldCh[--oldEndIdx];
|
792
|
+
newStartVnode = newCh[++newStartIdx];
|
793
|
+
}
|
794
|
+
else {
|
795
|
+
// Here we do some checks to match up old and new nodes based on the
|
796
|
+
// `$key$` attribute, which is set by putting a `key="my-key"` attribute
|
797
|
+
// in the JSX for a DOM element in the implementation of a Stencil
|
798
|
+
// component.
|
799
|
+
//
|
800
|
+
// First we check to see if there are any nodes in the array of old
|
801
|
+
// children which have the same key as the first node in the new
|
802
|
+
// children.
|
803
|
+
idxInOld = -1;
|
804
|
+
{
|
805
|
+
for (i = oldStartIdx; i <= oldEndIdx; ++i) {
|
806
|
+
if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
|
807
|
+
idxInOld = i;
|
808
|
+
break;
|
809
|
+
}
|
810
|
+
}
|
811
|
+
}
|
812
|
+
if (idxInOld >= 0) {
|
813
|
+
// We found a node in the old children which matches up with the first
|
814
|
+
// node in the new children! So let's deal with that
|
815
|
+
elmToMove = oldCh[idxInOld];
|
816
|
+
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
817
|
+
// the tag doesn't match so we'll need a new DOM element
|
818
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
|
819
|
+
}
|
820
|
+
else {
|
821
|
+
patch(elmToMove, newStartVnode, isInitialRender);
|
822
|
+
// invalidate the matching old node so that we won't try to update it
|
823
|
+
// again later on
|
824
|
+
oldCh[idxInOld] = undefined;
|
825
|
+
node = elmToMove.$elm$;
|
826
|
+
}
|
827
|
+
newStartVnode = newCh[++newStartIdx];
|
828
|
+
}
|
829
|
+
else {
|
830
|
+
// We either didn't find an element in the old children that matches
|
831
|
+
// the key of the first new child OR the build is not using `key`
|
832
|
+
// attributes at all. In either case we need to create a new element
|
833
|
+
// for the new node.
|
834
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
|
835
|
+
newStartVnode = newCh[++newStartIdx];
|
836
|
+
}
|
837
|
+
if (node) {
|
838
|
+
// if we created a new node then handle inserting it to the DOM
|
839
|
+
{
|
840
|
+
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
|
841
|
+
}
|
842
|
+
}
|
843
|
+
}
|
844
|
+
}
|
845
|
+
if (oldStartIdx > oldEndIdx) {
|
846
|
+
// we have some more new nodes to add which don't match up with old nodes
|
847
|
+
addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
|
848
|
+
}
|
849
|
+
else if (newStartIdx > newEndIdx) {
|
850
|
+
// there are nodes in the `oldCh` array which no longer correspond to nodes
|
851
|
+
// in the new array, so lets remove them (which entails cleaning up the
|
852
|
+
// relevant DOM nodes)
|
853
|
+
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
|
854
|
+
}
|
855
|
+
};
|
856
|
+
/**
|
857
|
+
* Compare two VNodes to determine if they are the same
|
858
|
+
*
|
859
|
+
* **NB**: This function is an equality _heuristic_ based on the available
|
860
|
+
* information set on the two VNodes and can be misleading under certain
|
861
|
+
* circumstances. In particular, if the two nodes do not have `key` attrs
|
862
|
+
* (available under `$key$` on VNodes) then the function falls back on merely
|
863
|
+
* checking that they have the same tag.
|
864
|
+
*
|
865
|
+
* So, in other words, if `key` attrs are not set on VNodes which may be
|
866
|
+
* changing order within a `children` array or something along those lines then
|
867
|
+
* we could obtain a false negative and then have to do needless re-rendering
|
868
|
+
* (i.e. we'd say two VNodes aren't equal when in fact they should be).
|
869
|
+
*
|
870
|
+
* @param leftVNode the first VNode to check
|
871
|
+
* @param rightVNode the second VNode to check
|
872
|
+
* @param isInitialRender whether or not this is the first render of the vdom
|
873
|
+
* @returns whether they're equal or not
|
874
|
+
*/
|
875
|
+
const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
|
876
|
+
// compare if two vnode to see if they're "technically" the same
|
877
|
+
// need to have the same element tag, and same key to be the same
|
878
|
+
if (leftVNode.$tag$ === rightVNode.$tag$) {
|
879
|
+
// this will be set if JSX tags in the build have `key` attrs set on them
|
880
|
+
// we only want to check this if we're not on the first render since on
|
881
|
+
// first render `leftVNode.$key$` will always be `null`, so we can be led
|
882
|
+
// astray and, for instance, accidentally delete a DOM node that we want to
|
883
|
+
// keep around.
|
884
|
+
if (!isInitialRender) {
|
885
|
+
return leftVNode.$key$ === rightVNode.$key$;
|
886
|
+
}
|
887
|
+
return true;
|
888
|
+
}
|
889
|
+
return false;
|
890
|
+
};
|
891
|
+
/**
|
892
|
+
* Handle reconciling an outdated VNode with a new one which corresponds to
|
893
|
+
* it. This function handles flushing updates to the DOM and reconciling the
|
894
|
+
* children of the two nodes (if any).
|
895
|
+
*
|
896
|
+
* @param oldVNode an old VNode whose DOM element and children we want to update
|
897
|
+
* @param newVNode a new VNode representing an updated version of the old one
|
898
|
+
* @param isInitialRender whether or not this is the first render of the vdom
|
899
|
+
*/
|
900
|
+
const patch = (oldVNode, newVNode, isInitialRender = false) => {
|
901
|
+
const elm = (newVNode.$elm$ = oldVNode.$elm$);
|
902
|
+
const oldChildren = oldVNode.$children$;
|
903
|
+
const newChildren = newVNode.$children$;
|
904
|
+
const tag = newVNode.$tag$;
|
905
|
+
const text = newVNode.$text$;
|
906
|
+
if (text === null) {
|
907
|
+
{
|
908
|
+
// test if we're rendering an svg element, or still rendering nodes inside of one
|
909
|
+
// only add this to the when the compiler sees we're using an svg somewhere
|
910
|
+
isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
|
911
|
+
}
|
912
|
+
{
|
913
|
+
if (tag === 'slot' && !useNativeShadowDom) ;
|
914
|
+
else {
|
915
|
+
// either this is the first render of an element OR it's an update
|
916
|
+
// AND we already know it's possible it could have changed
|
917
|
+
// this updates the element's css classes, attrs, props, listeners, etc.
|
918
|
+
updateElement(oldVNode, newVNode, isSvgMode);
|
919
|
+
}
|
920
|
+
}
|
921
|
+
if (oldChildren !== null && newChildren !== null) {
|
922
|
+
// looks like there's child vnodes for both the old and new vnodes
|
923
|
+
// so we need to call `updateChildren` to reconcile them
|
924
|
+
updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
|
925
|
+
}
|
926
|
+
else if (newChildren !== null) {
|
927
|
+
// no old child vnodes, but there are new child vnodes to add
|
928
|
+
if (oldVNode.$text$ !== null) {
|
929
|
+
// the old vnode was text, so be sure to clear it out
|
930
|
+
elm.textContent = '';
|
931
|
+
}
|
932
|
+
// add the new vnode children
|
933
|
+
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
|
934
|
+
}
|
935
|
+
else if (oldChildren !== null) {
|
936
|
+
// no new child vnodes, but there are old child vnodes to remove
|
937
|
+
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
938
|
+
}
|
939
|
+
if (isSvgMode && tag === 'svg') {
|
940
|
+
isSvgMode = false;
|
941
|
+
}
|
942
|
+
}
|
943
|
+
else if (oldVNode.$text$ !== text) {
|
944
|
+
// update the text content for the text only vnode
|
945
|
+
// and also only if the text is different than before
|
946
|
+
elm.data = text;
|
947
|
+
}
|
948
|
+
};
|
949
|
+
/**
|
950
|
+
* The main entry point for Stencil's virtual DOM-based rendering engine
|
951
|
+
*
|
952
|
+
* Given a {@link d.HostRef} container and some virtual DOM nodes, this
|
953
|
+
* function will handle creating a virtual DOM tree with a single root, patching
|
954
|
+
* the current virtual DOM tree onto an old one (if any), dealing with slot
|
955
|
+
* relocation, and reflecting attributes.
|
956
|
+
*
|
957
|
+
* @param hostRef data needed to root and render the virtual DOM tree, such as
|
958
|
+
* the DOM node into which it should be rendered.
|
959
|
+
* @param renderFnResults the virtual DOM nodes to be rendered
|
960
|
+
* @param isInitialLoad whether or not this is the first call after page load
|
961
|
+
*/
|
962
|
+
const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
963
|
+
const hostElm = hostRef.$hostElement$;
|
964
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
965
|
+
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
966
|
+
// if `renderFnResults` is a Host node then we can use it directly. If not,
|
967
|
+
// we need to call `h` again to wrap the children of our component in a
|
968
|
+
// 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
|
969
|
+
// implicitly that the top-level vdom node is 1) an only child and 2)
|
970
|
+
// contains attrs that need to be set on the host element.
|
971
|
+
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
972
|
+
hostTagName = hostElm.tagName;
|
973
|
+
if (cmpMeta.$attrsToReflect$) {
|
974
|
+
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
975
|
+
cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
|
976
|
+
}
|
977
|
+
// On the first render and *only* on the first render we want to check for
|
978
|
+
// any attributes set on the host element which are also set on the vdom
|
979
|
+
// node. If we find them, we override the value on the VDom node attrs with
|
980
|
+
// the value from the host element, which allows developers building apps
|
981
|
+
// with Stencil components to override e.g. the `role` attribute on a
|
982
|
+
// component even if it's already set on the `Host`.
|
983
|
+
if (isInitialLoad && rootVnode.$attrs$) {
|
984
|
+
for (const key of Object.keys(rootVnode.$attrs$)) {
|
985
|
+
// We have a special implementation in `setAccessor` for `style` and
|
986
|
+
// `class` which reconciles values coming from the VDom with values
|
987
|
+
// already present on the DOM element, so we don't want to override those
|
988
|
+
// attributes on the VDom tree with values from the host element if they
|
989
|
+
// are present.
|
990
|
+
//
|
991
|
+
// Likewise, `ref` and `key` are special internal values for the Stencil
|
992
|
+
// runtime and we don't want to override those either.
|
993
|
+
if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
|
994
|
+
rootVnode.$attrs$[key] = hostElm[key];
|
995
|
+
}
|
996
|
+
}
|
997
|
+
}
|
998
|
+
rootVnode.$tag$ = null;
|
999
|
+
rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
|
1000
|
+
hostRef.$vnode$ = rootVnode;
|
1001
|
+
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
|
1002
|
+
{
|
1003
|
+
scopeId = hostElm['s-sc'];
|
1004
|
+
}
|
1005
|
+
useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
|
1006
|
+
// synchronous patch
|
1007
|
+
patch(oldVNode, rootVnode, isInitialLoad);
|
1008
|
+
};
|
1009
|
+
const attachToAncestor = (hostRef, ancestorComponent) => {
|
1010
|
+
if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
|
1011
|
+
ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
|
1012
|
+
}
|
1013
|
+
};
|
1014
|
+
const scheduleUpdate = (hostRef, isInitialLoad) => {
|
1015
|
+
{
|
1016
|
+
hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
|
1017
|
+
}
|
1018
|
+
if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
|
1019
|
+
hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
|
1020
|
+
return;
|
1021
|
+
}
|
1022
|
+
attachToAncestor(hostRef, hostRef.$ancestorComponent$);
|
1023
|
+
// there is no ancestor component or the ancestor component
|
1024
|
+
// has already fired off its lifecycle update then
|
1025
|
+
// fire off the initial update
|
1026
|
+
const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
|
1027
|
+
return writeTask(dispatch) ;
|
1028
|
+
};
|
1029
|
+
/**
|
1030
|
+
* Dispatch initial-render and update lifecycle hooks, enqueuing calls to
|
1031
|
+
* component lifecycle methods like `componentWillLoad` as well as
|
1032
|
+
* {@link updateComponent}, which will kick off the virtual DOM re-render.
|
1033
|
+
*
|
1034
|
+
* @param hostRef a reference to a host DOM node
|
1035
|
+
* @param isInitialLoad whether we're on the initial load or not
|
1036
|
+
* @returns an empty Promise which is used to enqueue a series of operations for
|
1037
|
+
* the component
|
1038
|
+
*/
|
1039
|
+
const dispatchHooks = (hostRef, isInitialLoad) => {
|
1040
|
+
const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
|
1041
|
+
const instance = hostRef.$lazyInstance$ ;
|
1042
|
+
// We're going to use this variable together with `enqueue` to implement a
|
1043
|
+
// little promise-based queue. We start out with it `undefined`. When we add
|
1044
|
+
// the first function to the queue we'll set this variable to be that
|
1045
|
+
// function's return value. When we attempt to add subsequent values to the
|
1046
|
+
// queue we'll check that value and, if it was a `Promise`, we'll then chain
|
1047
|
+
// the new function off of that `Promise` using `.then()`. This will give our
|
1048
|
+
// queue two nice properties:
|
1049
|
+
//
|
1050
|
+
// 1. If all functions added to the queue are synchronous they'll be called
|
1051
|
+
// synchronously right away.
|
1052
|
+
// 2. If all functions added to the queue are asynchronous they'll all be
|
1053
|
+
// called in order after `dispatchHooks` exits.
|
1054
|
+
let maybePromise;
|
1055
|
+
if (isInitialLoad) {
|
1056
|
+
{
|
1057
|
+
hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
|
1058
|
+
if (hostRef.$queuedListeners$) {
|
1059
|
+
hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
|
1060
|
+
hostRef.$queuedListeners$ = undefined;
|
1061
|
+
}
|
1062
|
+
}
|
1063
|
+
{
|
1064
|
+
// If `componentWillLoad` returns a `Promise` then we want to wait on
|
1065
|
+
// whatever's going on in that `Promise` before we launch into
|
1066
|
+
// rendering the component, doing other lifecycle stuff, etc. So
|
1067
|
+
// in that case we assign the returned promise to the variable we
|
1068
|
+
// declared above to hold a possible 'queueing' Promise
|
1069
|
+
maybePromise = safeCall(instance, 'componentWillLoad');
|
1070
|
+
}
|
1071
|
+
}
|
1072
|
+
endSchedule();
|
1073
|
+
return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
|
1074
|
+
};
|
1075
|
+
/**
|
1076
|
+
* This function uses a Promise to implement a simple first-in, first-out queue
|
1077
|
+
* of functions to be called.
|
1078
|
+
*
|
1079
|
+
* The queue is ordered on the basis of the first argument. If it's
|
1080
|
+
* `undefined`, then nothing is on the queue yet, so the provided function can
|
1081
|
+
* be called synchronously (although note that this function may return a
|
1082
|
+
* `Promise`). The idea is that then the return value of that enqueueing
|
1083
|
+
* operation is kept around, so that if it was a `Promise` then subsequent
|
1084
|
+
* functions can be enqueued by calling this function again with that `Promise`
|
1085
|
+
* as the first argument.
|
1086
|
+
*
|
1087
|
+
* @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
|
1088
|
+
* @param fn a function to enqueue
|
1089
|
+
* @returns either a `Promise` or the return value of the provided function
|
1090
|
+
*/
|
1091
|
+
const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
|
1092
|
+
/**
|
1093
|
+
* Check that a value is a `Promise`. To check, we first see if the value is an
|
1094
|
+
* instance of the `Promise` global. In a few circumstances, in particular if
|
1095
|
+
* the global has been overwritten, this is could be misleading, so we also do
|
1096
|
+
* a little 'duck typing' check to see if the `.then` property of the value is
|
1097
|
+
* defined and a function.
|
1098
|
+
*
|
1099
|
+
* @param maybePromise it might be a promise!
|
1100
|
+
* @returns whether it is or not
|
1101
|
+
*/
|
1102
|
+
const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
|
1103
|
+
(maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
|
1104
|
+
/**
|
1105
|
+
* Update a component given reference to its host elements and so on.
|
1106
|
+
*
|
1107
|
+
* @param hostRef an object containing references to the element's host node,
|
1108
|
+
* VDom nodes, and other metadata
|
1109
|
+
* @param instance a reference to the underlying host element where it will be
|
1110
|
+
* rendered
|
1111
|
+
* @param isInitialLoad whether or not this function is being called as part of
|
1112
|
+
* the first render cycle
|
1113
|
+
*/
|
1114
|
+
const updateComponent = async (hostRef, instance, isInitialLoad) => {
|
1115
|
+
var _a;
|
1116
|
+
const elm = hostRef.$hostElement$;
|
1117
|
+
const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
|
1118
|
+
const rc = elm['s-rc'];
|
1119
|
+
if (isInitialLoad) {
|
1120
|
+
// DOM WRITE!
|
1121
|
+
attachStyles(hostRef);
|
1122
|
+
}
|
1123
|
+
const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
|
1124
|
+
{
|
1125
|
+
callRender(hostRef, instance, elm, isInitialLoad);
|
1126
|
+
}
|
1127
|
+
if (rc) {
|
1128
|
+
// ok, so turns out there are some child host elements
|
1129
|
+
// waiting on this parent element to load
|
1130
|
+
// let's fire off all update callbacks waiting
|
1131
|
+
rc.map((cb) => cb());
|
1132
|
+
elm['s-rc'] = undefined;
|
1133
|
+
}
|
1134
|
+
endRender();
|
1135
|
+
endUpdate();
|
1136
|
+
{
|
1137
|
+
const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
|
1138
|
+
const postUpdate = () => postUpdateComponent(hostRef);
|
1139
|
+
if (childrenPromises.length === 0) {
|
1140
|
+
postUpdate();
|
1141
|
+
}
|
1142
|
+
else {
|
1143
|
+
Promise.all(childrenPromises).then(postUpdate);
|
1144
|
+
hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
|
1145
|
+
childrenPromises.length = 0;
|
1146
|
+
}
|
1147
|
+
}
|
1148
|
+
};
|
1149
|
+
/**
|
1150
|
+
* Handle making the call to the VDom renderer with the proper context given
|
1151
|
+
* various build variables
|
1152
|
+
*
|
1153
|
+
* @param hostRef an object containing references to the element's host node,
|
1154
|
+
* VDom nodes, and other metadata
|
1155
|
+
* @param instance a reference to the underlying host element where it will be
|
1156
|
+
* rendered
|
1157
|
+
* @param elm the Host element for the component
|
1158
|
+
* @param isInitialLoad whether or not this function is being called as part of
|
1159
|
+
* @returns an empty promise
|
1160
|
+
*/
|
1161
|
+
const callRender = (hostRef, instance, elm, isInitialLoad) => {
|
1162
|
+
try {
|
1163
|
+
/**
|
1164
|
+
* minification optimization: `allRenderFn` is `true` if all components have a `render`
|
1165
|
+
* method, so we can call the method immediately. If not, check before calling it.
|
1166
|
+
*/
|
1167
|
+
instance = instance.render() ;
|
1168
|
+
{
|
1169
|
+
hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
|
1170
|
+
}
|
1171
|
+
{
|
1172
|
+
hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
|
1173
|
+
}
|
1174
|
+
{
|
1175
|
+
{
|
1176
|
+
// looks like we've got child nodes to render into this host element
|
1177
|
+
// or we need to update the css class/attrs on the host element
|
1178
|
+
// DOM WRITE!
|
1179
|
+
{
|
1180
|
+
renderVdom(hostRef, instance, isInitialLoad);
|
1181
|
+
}
|
1182
|
+
}
|
1183
|
+
}
|
1184
|
+
}
|
1185
|
+
catch (e) {
|
1186
|
+
consoleError(e, hostRef.$hostElement$);
|
1187
|
+
}
|
1188
|
+
return null;
|
1189
|
+
};
|
1190
|
+
const postUpdateComponent = (hostRef) => {
|
1191
|
+
const tagName = hostRef.$cmpMeta$.$tagName$;
|
1192
|
+
const elm = hostRef.$hostElement$;
|
1193
|
+
const endPostUpdate = createTime('postUpdate', tagName);
|
1194
|
+
const instance = hostRef.$lazyInstance$ ;
|
1195
|
+
const ancestorComponent = hostRef.$ancestorComponent$;
|
1196
|
+
if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
|
1197
|
+
hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
|
1198
|
+
{
|
1199
|
+
// DOM WRITE!
|
1200
|
+
addHydratedFlag(elm);
|
1201
|
+
}
|
1202
|
+
{
|
1203
|
+
safeCall(instance, 'componentDidLoad');
|
1204
|
+
}
|
1205
|
+
endPostUpdate();
|
1206
|
+
{
|
1207
|
+
hostRef.$onReadyResolve$(elm);
|
1208
|
+
if (!ancestorComponent) {
|
1209
|
+
appDidLoad();
|
1210
|
+
}
|
1211
|
+
}
|
1212
|
+
}
|
1213
|
+
else {
|
1214
|
+
endPostUpdate();
|
1215
|
+
}
|
1216
|
+
{
|
1217
|
+
hostRef.$onInstanceResolve$(elm);
|
1218
|
+
}
|
1219
|
+
// load events fire from bottom to top
|
1220
|
+
// the deepest elements load first then bubbles up
|
1221
|
+
{
|
1222
|
+
if (hostRef.$onRenderResolve$) {
|
1223
|
+
hostRef.$onRenderResolve$();
|
1224
|
+
hostRef.$onRenderResolve$ = undefined;
|
1225
|
+
}
|
1226
|
+
if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
|
1227
|
+
nextTick(() => scheduleUpdate(hostRef, false));
|
1228
|
+
}
|
1229
|
+
hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
|
1230
|
+
}
|
1231
|
+
// ( •_•)
|
1232
|
+
// ( •_•)>⌐■-■
|
1233
|
+
// (⌐■_■)
|
1234
|
+
};
|
1235
|
+
const forceUpdate = (ref) => {
|
1236
|
+
{
|
1237
|
+
const hostRef = getHostRef(ref);
|
1238
|
+
const isConnected = hostRef.$hostElement$.isConnected;
|
1239
|
+
if (isConnected &&
|
1240
|
+
(hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
1241
|
+
scheduleUpdate(hostRef, false);
|
1242
|
+
}
|
1243
|
+
// Returns "true" when the forced update was successfully scheduled
|
1244
|
+
return isConnected;
|
1245
|
+
}
|
1246
|
+
};
|
1247
|
+
const appDidLoad = (who) => {
|
1248
|
+
// on appload
|
1249
|
+
// we have finish the first big initial render
|
1250
|
+
{
|
1251
|
+
addHydratedFlag(doc.documentElement);
|
1252
|
+
}
|
1253
|
+
nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
|
1254
|
+
};
|
1255
|
+
/**
|
1256
|
+
* Allows to safely call a method, e.g. `componentDidLoad`, on an instance,
|
1257
|
+
* e.g. custom element node. If a build figures out that e.g. no component
|
1258
|
+
* has a `componentDidLoad` method, the instance method gets removed from the
|
1259
|
+
* output bundle and this function returns `undefined`.
|
1260
|
+
* @param instance any object that may or may not contain methods
|
1261
|
+
* @param method method name
|
1262
|
+
* @param arg single arbitrary argument
|
1263
|
+
* @returns result of method call if it exists, otherwise `undefined`
|
1264
|
+
*/
|
1265
|
+
const safeCall = (instance, method, arg) => {
|
1266
|
+
if (instance && instance[method]) {
|
1267
|
+
try {
|
1268
|
+
return instance[method](arg);
|
1269
|
+
}
|
1270
|
+
catch (e) {
|
1271
|
+
consoleError(e);
|
1272
|
+
}
|
1273
|
+
}
|
1274
|
+
return undefined;
|
1275
|
+
};
|
1276
|
+
const addHydratedFlag = (elm) => elm.classList.add('hydrated')
|
1277
|
+
;
|
1278
|
+
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
|
1279
|
+
const setValue = (ref, propName, newVal, cmpMeta) => {
|
1280
|
+
// check our new property value against our internal value
|
1281
|
+
const hostRef = getHostRef(ref);
|
1282
|
+
const elm = hostRef.$hostElement$ ;
|
1283
|
+
const oldVal = hostRef.$instanceValues$.get(propName);
|
1284
|
+
const flags = hostRef.$flags$;
|
1285
|
+
const instance = hostRef.$lazyInstance$ ;
|
1286
|
+
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
|
1287
|
+
// explicitly check for NaN on both sides, as `NaN === NaN` is always false
|
1288
|
+
const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
|
1289
|
+
const didValueChange = newVal !== oldVal && !areBothNaN;
|
1290
|
+
if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
|
1291
|
+
// gadzooks! the property's value has changed!!
|
1292
|
+
// set our new value!
|
1293
|
+
hostRef.$instanceValues$.set(propName, newVal);
|
1294
|
+
if (instance) {
|
1295
|
+
// get an array of method names of watch functions to call
|
1296
|
+
if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
|
1297
|
+
const watchMethods = cmpMeta.$watchers$[propName];
|
1298
|
+
if (watchMethods) {
|
1299
|
+
// this instance is watching for when this property changed
|
1300
|
+
watchMethods.map((watchMethodName) => {
|
1301
|
+
try {
|
1302
|
+
// fire off each of the watch methods that are watching this property
|
1303
|
+
instance[watchMethodName](newVal, oldVal, propName);
|
1304
|
+
}
|
1305
|
+
catch (e) {
|
1306
|
+
consoleError(e, elm);
|
1307
|
+
}
|
1308
|
+
});
|
1309
|
+
}
|
1310
|
+
}
|
1311
|
+
if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
|
1312
|
+
// looks like this value actually changed, so we've got work to do!
|
1313
|
+
// but only if we've already rendered, otherwise just chill out
|
1314
|
+
// queue that we need to do an update, but don't worry about queuing
|
1315
|
+
// up millions cuz this function ensures it only runs once
|
1316
|
+
scheduleUpdate(hostRef, false);
|
1317
|
+
}
|
1318
|
+
}
|
1319
|
+
}
|
1320
|
+
};
|
1321
|
+
/**
|
1322
|
+
* Attach a series of runtime constructs to a compiled Stencil component
|
1323
|
+
* constructor, including getters and setters for the `@Prop` and `@State`
|
1324
|
+
* decorators, callbacks for when attributes change, and so on.
|
1325
|
+
*
|
1326
|
+
* @param Cstr the constructor for a component that we need to process
|
1327
|
+
* @param cmpMeta metadata collected previously about the component
|
1328
|
+
* @param flags a number used to store a series of bit flags
|
1329
|
+
* @returns a reference to the same constructor passed in (but now mutated)
|
1330
|
+
*/
|
1331
|
+
const proxyComponent = (Cstr, cmpMeta, flags) => {
|
1332
|
+
var _a;
|
1333
|
+
const prototype = Cstr.prototype;
|
1334
|
+
if (cmpMeta.$members$) {
|
1335
|
+
if (Cstr.watchers) {
|
1336
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
1337
|
+
}
|
1338
|
+
// It's better to have a const than two Object.entries()
|
1339
|
+
const members = Object.entries(cmpMeta.$members$);
|
1340
|
+
members.map(([memberName, [memberFlags]]) => {
|
1341
|
+
if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
|
1342
|
+
((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
|
1343
|
+
// proxyComponent - prop
|
1344
|
+
Object.defineProperty(prototype, memberName, {
|
1345
|
+
get() {
|
1346
|
+
// proxyComponent, get value
|
1347
|
+
return getValue(this, memberName);
|
1348
|
+
},
|
1349
|
+
set(newValue) {
|
1350
|
+
// proxyComponent, set value
|
1351
|
+
setValue(this, memberName, newValue, cmpMeta);
|
1352
|
+
},
|
1353
|
+
configurable: true,
|
1354
|
+
enumerable: true,
|
1355
|
+
});
|
1356
|
+
}
|
1357
|
+
else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
|
1358
|
+
memberFlags & 64 /* MEMBER_FLAGS.Method */) {
|
1359
|
+
// proxyComponent - method
|
1360
|
+
Object.defineProperty(prototype, memberName, {
|
1361
|
+
value(...args) {
|
1362
|
+
var _a;
|
1363
|
+
const ref = getHostRef(this);
|
1364
|
+
return (_a = ref === null || ref === void 0 ? void 0 : ref.$onInstancePromise$) === null || _a === void 0 ? void 0 : _a.then(() => { var _a; return (_a = ref.$lazyInstance$) === null || _a === void 0 ? void 0 : _a[memberName](...args); });
|
1365
|
+
},
|
1366
|
+
});
|
1367
|
+
}
|
1368
|
+
});
|
1369
|
+
if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
|
1370
|
+
const attrNameToPropName = new Map();
|
1371
|
+
prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
|
1372
|
+
plt.jmp(() => {
|
1373
|
+
var _a;
|
1374
|
+
const propName = attrNameToPropName.get(attrName);
|
1375
|
+
// In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
|
1376
|
+
// in the case where an attribute was set inline.
|
1377
|
+
// ```html
|
1378
|
+
// <my-component some-attribute="some-value"></my-component>
|
1379
|
+
// ```
|
1380
|
+
//
|
1381
|
+
// There is an edge case where a developer sets the attribute inline on a custom element and then
|
1382
|
+
// programmatically changes it before it has been upgraded as shown below:
|
1383
|
+
//
|
1384
|
+
// ```html
|
1385
|
+
// <!-- this component has _not_ been upgraded yet -->
|
1386
|
+
// <my-component id="test" some-attribute="some-value"></my-component>
|
1387
|
+
// <script>
|
1388
|
+
// // grab non-upgraded component
|
1389
|
+
// el = document.querySelector("#test");
|
1390
|
+
// el.someAttribute = "another-value";
|
1391
|
+
// // upgrade component
|
1392
|
+
// customElements.define('my-component', MyComponent);
|
1393
|
+
// </script>
|
1394
|
+
// ```
|
1395
|
+
// In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
|
1396
|
+
// will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
|
1397
|
+
// to the value that was set inline i.e. "some-value" from above example. When
|
1398
|
+
// the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
|
1399
|
+
//
|
1400
|
+
// The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
|
1401
|
+
// by connectedCallback as this attributeChangedCallback will not fire.
|
1402
|
+
//
|
1403
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
1404
|
+
//
|
1405
|
+
// TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
|
1406
|
+
// properties here given that this goes against best practices outlined here
|
1407
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
|
1408
|
+
if (this.hasOwnProperty(propName)) {
|
1409
|
+
newValue = this[propName];
|
1410
|
+
delete this[propName];
|
1411
|
+
}
|
1412
|
+
else if (prototype.hasOwnProperty(propName) &&
|
1413
|
+
typeof this[propName] === 'number' &&
|
1414
|
+
this[propName] == newValue) {
|
1415
|
+
// if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
|
1416
|
+
// APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
|
1417
|
+
// `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
|
1418
|
+
return;
|
1419
|
+
}
|
1420
|
+
else if (propName == null) {
|
1421
|
+
// At this point we should know this is not a "member", so we can treat it like watching an attribute
|
1422
|
+
// on a vanilla web component
|
1423
|
+
const hostRef = getHostRef(this);
|
1424
|
+
const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
|
1425
|
+
// We only want to trigger the callback(s) if:
|
1426
|
+
// 1. The instance is ready
|
1427
|
+
// 2. The watchers are ready
|
1428
|
+
// 3. The value has changed
|
1429
|
+
if (flags &&
|
1430
|
+
!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
|
1431
|
+
flags & 128 /* HOST_FLAGS.isWatchReady */ &&
|
1432
|
+
newValue !== oldValue) {
|
1433
|
+
const instance = hostRef.$lazyInstance$ ;
|
1434
|
+
const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
|
1435
|
+
entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
|
1436
|
+
if (instance[callbackName] != null) {
|
1437
|
+
instance[callbackName].call(instance, newValue, oldValue, attrName);
|
1438
|
+
}
|
1439
|
+
});
|
1440
|
+
}
|
1441
|
+
return;
|
1442
|
+
}
|
1443
|
+
this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
|
1444
|
+
});
|
1445
|
+
};
|
1446
|
+
// Create an array of attributes to observe
|
1447
|
+
// This list in comprised of all strings used within a `@Watch()` decorator
|
1448
|
+
// on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
|
1449
|
+
// As such, there is no way to guarantee type-safety here that a user hasn't entered
|
1450
|
+
// an invalid attribute.
|
1451
|
+
Cstr.observedAttributes = Array.from(new Set([
|
1452
|
+
...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
|
1453
|
+
...members
|
1454
|
+
.filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
|
1455
|
+
.map(([propName, m]) => {
|
1456
|
+
var _a;
|
1457
|
+
const attrName = m[1] || propName;
|
1458
|
+
attrNameToPropName.set(attrName, propName);
|
1459
|
+
if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
|
1460
|
+
(_a = cmpMeta.$attrsToReflect$) === null || _a === void 0 ? void 0 : _a.push([propName, attrName]);
|
1461
|
+
}
|
1462
|
+
return attrName;
|
1463
|
+
}),
|
1464
|
+
]));
|
1465
|
+
}
|
1466
|
+
}
|
1467
|
+
return Cstr;
|
1468
|
+
};
|
1469
|
+
/**
|
1470
|
+
* Initialize a Stencil component given a reference to its host element, its
|
1471
|
+
* runtime bookkeeping data structure, runtime metadata about the component,
|
1472
|
+
* and (optionally) an HMR version ID.
|
1473
|
+
*
|
1474
|
+
* @param elm a host element
|
1475
|
+
* @param hostRef the element's runtime bookkeeping object
|
1476
|
+
* @param cmpMeta runtime metadata for the Stencil component
|
1477
|
+
* @param hmrVersionId an (optional) HMR version ID
|
1478
|
+
*/
|
1479
|
+
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
|
1480
|
+
let Cstr;
|
1481
|
+
// initializeComponent
|
1482
|
+
if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
|
1483
|
+
// Let the runtime know that the component has been initialized
|
1484
|
+
hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
|
1485
|
+
const bundleId = cmpMeta.$lazyBundleId$;
|
1486
|
+
if (bundleId) {
|
1487
|
+
// lazy loaded components
|
1488
|
+
// request the component's implementation to be
|
1489
|
+
// wired up with the host element
|
1490
|
+
Cstr = loadModule(cmpMeta);
|
1491
|
+
if (Cstr.then) {
|
1492
|
+
// Await creates a micro-task avoid if possible
|
1493
|
+
const endLoad = uniqueTime();
|
1494
|
+
Cstr = await Cstr;
|
1495
|
+
endLoad();
|
1496
|
+
}
|
1497
|
+
if (!Cstr.isProxied) {
|
1498
|
+
// we've never proxied this Constructor before
|
1499
|
+
// let's add the getters/setters to its prototype before
|
1500
|
+
// the first time we create an instance of the implementation
|
1501
|
+
{
|
1502
|
+
cmpMeta.$watchers$ = Cstr.watchers;
|
1503
|
+
}
|
1504
|
+
proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
|
1505
|
+
Cstr.isProxied = true;
|
1506
|
+
}
|
1507
|
+
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
|
1508
|
+
// ok, time to construct the instance
|
1509
|
+
// but let's keep track of when we start and stop
|
1510
|
+
// so that the getters/setters don't incorrectly step on data
|
1511
|
+
{
|
1512
|
+
hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
|
1513
|
+
}
|
1514
|
+
// construct the lazy-loaded component implementation
|
1515
|
+
// passing the hostRef is very important during
|
1516
|
+
// construction in order to directly wire together the
|
1517
|
+
// host element and the lazy-loaded instance
|
1518
|
+
try {
|
1519
|
+
new Cstr(hostRef);
|
1520
|
+
}
|
1521
|
+
catch (e) {
|
1522
|
+
consoleError(e);
|
1523
|
+
}
|
1524
|
+
{
|
1525
|
+
hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
|
1526
|
+
}
|
1527
|
+
{
|
1528
|
+
hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
|
1529
|
+
}
|
1530
|
+
endNewInstance();
|
1531
|
+
}
|
1532
|
+
else {
|
1533
|
+
// sync constructor component
|
1534
|
+
Cstr = elm.constructor;
|
1535
|
+
// wait for the CustomElementRegistry to mark the component as ready before setting `isWatchReady`. Otherwise,
|
1536
|
+
// watchers may fire prematurely if `customElements.get()`/`customElements.whenDefined()` resolves _before_
|
1537
|
+
// Stencil has completed instantiating the component.
|
1538
|
+
customElements.whenDefined(cmpMeta.$tagName$).then(() => (hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */));
|
1539
|
+
}
|
1540
|
+
if (Cstr.style) {
|
1541
|
+
// this component has styles but we haven't registered them yet
|
1542
|
+
let style = Cstr.style;
|
1543
|
+
const scopeId = getScopeId(cmpMeta);
|
1544
|
+
if (!styles.has(scopeId)) {
|
1545
|
+
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
|
1546
|
+
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
|
1547
|
+
endRegisterStyles();
|
1548
|
+
}
|
1549
|
+
}
|
1550
|
+
}
|
1551
|
+
// we've successfully created a lazy instance
|
1552
|
+
const ancestorComponent = hostRef.$ancestorComponent$;
|
1553
|
+
const schedule = () => scheduleUpdate(hostRef, true);
|
1554
|
+
if (ancestorComponent && ancestorComponent['s-rc']) {
|
1555
|
+
// this is the initial load and this component it has an ancestor component
|
1556
|
+
// but the ancestor component has NOT fired its will update lifecycle yet
|
1557
|
+
// so let's just cool our jets and wait for the ancestor to continue first
|
1558
|
+
// this will get fired off when the ancestor component
|
1559
|
+
// finally gets around to rendering its lazy self
|
1560
|
+
// fire off the initial update
|
1561
|
+
ancestorComponent['s-rc'].push(schedule);
|
1562
|
+
}
|
1563
|
+
else {
|
1564
|
+
schedule();
|
1565
|
+
}
|
1566
|
+
};
|
1567
|
+
const fireConnectedCallback = (instance) => {
|
1568
|
+
};
|
1569
|
+
const connectedCallback = (elm) => {
|
1570
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
1571
|
+
const hostRef = getHostRef(elm);
|
1572
|
+
const cmpMeta = hostRef.$cmpMeta$;
|
1573
|
+
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
|
1574
|
+
if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
|
1575
|
+
// first time this component has connected
|
1576
|
+
hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
|
1577
|
+
{
|
1578
|
+
// find the first ancestor component (if there is one) and register
|
1579
|
+
// this component as one of the actively loading child components for its ancestor
|
1580
|
+
let ancestorComponent = elm;
|
1581
|
+
while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
|
1582
|
+
// climb up the ancestors looking for the first
|
1583
|
+
// component that hasn't finished its lifecycle update yet
|
1584
|
+
if (ancestorComponent['s-p']) {
|
1585
|
+
// we found this components first ancestor component
|
1586
|
+
// keep a reference to this component's ancestor component
|
1587
|
+
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
|
1588
|
+
break;
|
1589
|
+
}
|
1590
|
+
}
|
1591
|
+
}
|
1592
|
+
// Lazy properties
|
1593
|
+
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
|
1594
|
+
if (cmpMeta.$members$) {
|
1595
|
+
Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
|
1596
|
+
if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
|
1597
|
+
const value = elm[memberName];
|
1598
|
+
delete elm[memberName];
|
1599
|
+
elm[memberName] = value;
|
1600
|
+
}
|
1601
|
+
});
|
1602
|
+
}
|
1603
|
+
{
|
1604
|
+
initializeComponent(elm, hostRef, cmpMeta);
|
1605
|
+
}
|
1606
|
+
}
|
1607
|
+
else {
|
1608
|
+
// not the first time this has connected
|
1609
|
+
// reattach any event listeners to the host
|
1610
|
+
// since they would have been removed when disconnected
|
1611
|
+
addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
|
1612
|
+
// fire off connectedCallback() on component instance
|
1613
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
|
1614
|
+
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
1615
|
+
hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
|
1616
|
+
}
|
1617
|
+
}
|
1618
|
+
endConnected();
|
1619
|
+
}
|
1620
|
+
};
|
1621
|
+
const disconnectInstance = (instance) => {
|
1622
|
+
};
|
1623
|
+
const disconnectedCallback = async (elm) => {
|
1624
|
+
if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
|
1625
|
+
const hostRef = getHostRef(elm);
|
1626
|
+
{
|
1627
|
+
if (hostRef.$rmListeners$) {
|
1628
|
+
hostRef.$rmListeners$.map((rmListener) => rmListener());
|
1629
|
+
hostRef.$rmListeners$ = undefined;
|
1630
|
+
}
|
1631
|
+
}
|
1632
|
+
if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
|
1633
|
+
else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
|
1634
|
+
hostRef.$onReadyPromise$.then(() => disconnectInstance());
|
1635
|
+
}
|
1636
|
+
}
|
1637
|
+
};
|
1638
|
+
const bootstrapLazy = (lazyBundles, options = {}) => {
|
1639
|
+
var _a;
|
1640
|
+
const endBootstrap = createTime();
|
1641
|
+
const cmpTags = [];
|
1642
|
+
const exclude = options.exclude || [];
|
1643
|
+
const customElements = win.customElements;
|
1644
|
+
const head = doc.head;
|
1645
|
+
const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
|
1646
|
+
const dataStyles = /*@__PURE__*/ doc.createElement('style');
|
1647
|
+
const deferredConnectedCallbacks = [];
|
1648
|
+
let appLoadFallback;
|
1649
|
+
let isBootstrapping = true;
|
1650
|
+
Object.assign(plt, options);
|
1651
|
+
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
|
1652
|
+
let hasSlotRelocation = false;
|
1653
|
+
lazyBundles.map((lazyBundle) => {
|
1654
|
+
lazyBundle[1].map((compactMeta) => {
|
1655
|
+
var _a;
|
1656
|
+
const cmpMeta = {
|
1657
|
+
$flags$: compactMeta[0],
|
1658
|
+
$tagName$: compactMeta[1],
|
1659
|
+
$members$: compactMeta[2],
|
1660
|
+
$listeners$: compactMeta[3],
|
1661
|
+
};
|
1662
|
+
// Check if we are using slots outside the shadow DOM in this component.
|
1663
|
+
// We'll use this information later to add styles for `slot-fb` elements
|
1664
|
+
if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
|
1665
|
+
hasSlotRelocation = true;
|
1666
|
+
}
|
1667
|
+
{
|
1668
|
+
cmpMeta.$members$ = compactMeta[2];
|
1669
|
+
}
|
1670
|
+
{
|
1671
|
+
cmpMeta.$listeners$ = compactMeta[3];
|
1672
|
+
}
|
1673
|
+
{
|
1674
|
+
cmpMeta.$attrsToReflect$ = [];
|
1675
|
+
}
|
1676
|
+
{
|
1677
|
+
cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
|
1678
|
+
}
|
1679
|
+
const tagName = cmpMeta.$tagName$;
|
1680
|
+
const HostElement = class extends HTMLElement {
|
1681
|
+
// StencilLazyHost
|
1682
|
+
constructor(self) {
|
1683
|
+
// @ts-ignore
|
1684
|
+
super(self);
|
1685
|
+
self = this;
|
1686
|
+
registerHost(self, cmpMeta);
|
1687
|
+
if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
|
1688
|
+
// this component is using shadow dom
|
1689
|
+
// and this browser supports shadow dom
|
1690
|
+
// add the read-only property "shadowRoot" to the host element
|
1691
|
+
// adding the shadow root build conditionals to minimize runtime
|
1692
|
+
{
|
1693
|
+
{
|
1694
|
+
self.attachShadow({ mode: 'open' });
|
1695
|
+
}
|
1696
|
+
}
|
1697
|
+
}
|
1698
|
+
}
|
1699
|
+
connectedCallback() {
|
1700
|
+
if (appLoadFallback) {
|
1701
|
+
clearTimeout(appLoadFallback);
|
1702
|
+
appLoadFallback = null;
|
1703
|
+
}
|
1704
|
+
if (isBootstrapping) {
|
1705
|
+
// connectedCallback will be processed once all components have been registered
|
1706
|
+
deferredConnectedCallbacks.push(this);
|
1707
|
+
}
|
1708
|
+
else {
|
1709
|
+
plt.jmp(() => connectedCallback(this));
|
1710
|
+
}
|
1711
|
+
}
|
1712
|
+
disconnectedCallback() {
|
1713
|
+
plt.jmp(() => disconnectedCallback(this));
|
1714
|
+
}
|
1715
|
+
componentOnReady() {
|
1716
|
+
return getHostRef(this).$onReadyPromise$;
|
1717
|
+
}
|
1718
|
+
};
|
1719
|
+
cmpMeta.$lazyBundleId$ = lazyBundle[0];
|
1720
|
+
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
|
1721
|
+
cmpTags.push(tagName);
|
1722
|
+
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
|
1723
|
+
}
|
1724
|
+
});
|
1725
|
+
});
|
1726
|
+
// Only bother generating CSS if we have components
|
1727
|
+
// TODO(STENCIL-1118): Add test cases for CSS content based on conditionals
|
1728
|
+
if (cmpTags.length > 0) {
|
1729
|
+
// Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
|
1730
|
+
if (hasSlotRelocation) {
|
1731
|
+
dataStyles.textContent += SLOT_FB_CSS;
|
1732
|
+
}
|
1733
|
+
// Add hydration styles
|
1734
|
+
{
|
1735
|
+
dataStyles.textContent += cmpTags + HYDRATED_CSS;
|
1736
|
+
}
|
1737
|
+
// If we have styles, add them to the DOM
|
1738
|
+
if (dataStyles.innerHTML.length) {
|
1739
|
+
dataStyles.setAttribute('data-styles', '');
|
1740
|
+
// Apply CSP nonce to the style tag if it exists
|
1741
|
+
const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
|
1742
|
+
if (nonce != null) {
|
1743
|
+
dataStyles.setAttribute('nonce', nonce);
|
1744
|
+
}
|
1745
|
+
// Insert the styles into the document head
|
1746
|
+
// NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
|
1747
|
+
head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
|
1748
|
+
}
|
1749
|
+
}
|
1750
|
+
// Process deferred connectedCallbacks now all components have been registered
|
1751
|
+
isBootstrapping = false;
|
1752
|
+
if (deferredConnectedCallbacks.length) {
|
1753
|
+
deferredConnectedCallbacks.map((host) => host.connectedCallback());
|
1754
|
+
}
|
1755
|
+
else {
|
1756
|
+
{
|
1757
|
+
plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
|
1758
|
+
}
|
1759
|
+
}
|
1760
|
+
// Fallback appLoad event
|
1761
|
+
endBootstrap();
|
1762
|
+
};
|
1763
|
+
const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
|
1764
|
+
if (listeners) {
|
1765
|
+
listeners.map(([flags, name, method]) => {
|
1766
|
+
const target = getHostListenerTarget(elm, flags) ;
|
1767
|
+
const handler = hostListenerProxy(hostRef, method);
|
1768
|
+
const opts = hostListenerOpts(flags);
|
1769
|
+
plt.ael(target, name, handler, opts);
|
1770
|
+
(hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
|
1771
|
+
});
|
1772
|
+
}
|
1773
|
+
};
|
1774
|
+
const hostListenerProxy = (hostRef, methodName) => (ev) => {
|
1775
|
+
try {
|
1776
|
+
{
|
1777
|
+
if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
|
1778
|
+
// instance is ready, let's call it's member method for this event
|
1779
|
+
hostRef.$lazyInstance$[methodName](ev);
|
1780
|
+
}
|
1781
|
+
else {
|
1782
|
+
(hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
|
1783
|
+
}
|
1784
|
+
}
|
1785
|
+
}
|
1786
|
+
catch (e) {
|
1787
|
+
consoleError(e);
|
1788
|
+
}
|
1789
|
+
};
|
1790
|
+
const getHostListenerTarget = (elm, flags) => {
|
1791
|
+
if (flags & 8 /* LISTENER_FLAGS.TargetWindow */)
|
1792
|
+
return win;
|
1793
|
+
return elm;
|
1794
|
+
};
|
1795
|
+
// prettier-ignore
|
1796
|
+
const hostListenerOpts = (flags) => supportsListenerOptions
|
1797
|
+
? ({
|
1798
|
+
passive: (flags & 1 /* LISTENER_FLAGS.Passive */) !== 0,
|
1799
|
+
capture: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0,
|
1800
|
+
})
|
1801
|
+
: (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
|
1802
|
+
/**
|
1803
|
+
* Assigns the given value to the nonce property on the runtime platform object.
|
1804
|
+
* During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
|
1805
|
+
* @param nonce The value to be assigned to the platform nonce property.
|
1806
|
+
* @returns void
|
1807
|
+
*/
|
1808
|
+
const setNonce = (nonce) => (plt.$nonce$ = nonce);
|
1809
|
+
/**
|
1810
|
+
* A WeakMap mapping runtime component references to their corresponding host reference
|
1811
|
+
* instances.
|
1812
|
+
*
|
1813
|
+
* **Note**: If we're in an HMR context we need to store a reference to this
|
1814
|
+
* value on `window` in order to maintain the mapping of {@link d.RuntimeRef}
|
1815
|
+
* to {@link d.HostRef} across HMR updates.
|
1816
|
+
*
|
1817
|
+
* This is necessary because when HMR updates for a component are processed by
|
1818
|
+
* the browser-side dev server client the JS bundle for that component is
|
1819
|
+
* re-fetched. Since the module containing {@link hostRefs} is included in
|
1820
|
+
* that bundle, if we do not store a reference to it the new iteration of the
|
1821
|
+
* component will not have access to the previous hostRef map, leading to a
|
1822
|
+
* bug where the new version of the component cannot properly initialize.
|
1823
|
+
*/
|
1824
|
+
const hostRefs = new WeakMap();
|
1825
|
+
/**
|
1826
|
+
* Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
|
1827
|
+
*
|
1828
|
+
* @param ref the runtime ref of interest
|
1829
|
+
* @returns the Host reference (if found) or undefined
|
1830
|
+
*/
|
1831
|
+
const getHostRef = (ref) => hostRefs.get(ref);
|
1832
|
+
/**
|
1833
|
+
* Register a lazy instance with the {@link hostRefs} object so it's
|
1834
|
+
* corresponding {@link d.HostRef} can be retrieved later.
|
1835
|
+
*
|
1836
|
+
* @param lazyInstance the lazy instance of interest
|
1837
|
+
* @param hostRef that instances `HostRef` object
|
1838
|
+
* @returns a reference to the host ref WeakMap
|
1839
|
+
*/
|
1840
|
+
const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
|
1841
|
+
/**
|
1842
|
+
* Register a host element for a Stencil component, setting up various metadata
|
1843
|
+
* and callbacks based on {@link BUILD} flags as well as the component's runtime
|
1844
|
+
* metadata.
|
1845
|
+
*
|
1846
|
+
* @param hostElement the host element to register
|
1847
|
+
* @param cmpMeta runtime metadata for that component
|
1848
|
+
* @returns a reference to the host ref WeakMap
|
1849
|
+
*/
|
1850
|
+
const registerHost = (hostElement, cmpMeta) => {
|
1851
|
+
const hostRef = {
|
1852
|
+
$flags$: 0,
|
1853
|
+
$hostElement$: hostElement,
|
1854
|
+
$cmpMeta$: cmpMeta,
|
1855
|
+
$instanceValues$: new Map(),
|
1856
|
+
};
|
1857
|
+
{
|
1858
|
+
hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
|
1859
|
+
}
|
1860
|
+
{
|
1861
|
+
hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
|
1862
|
+
hostElement['s-p'] = [];
|
1863
|
+
hostElement['s-rc'] = [];
|
1864
|
+
}
|
1865
|
+
addHostEventListeners(hostElement, hostRef, cmpMeta.$listeners$);
|
1866
|
+
return hostRefs.set(hostElement, hostRef);
|
1867
|
+
};
|
1868
|
+
const isMemberInElement = (elm, memberName) => memberName in elm;
|
1869
|
+
const consoleError = (e, el) => (0, console.error)(e, el);
|
1870
|
+
const cmpModules = /*@__PURE__*/ new Map();
|
1871
|
+
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
|
1872
|
+
// loadModuleImport
|
1873
|
+
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
|
1874
|
+
const bundleId = cmpMeta.$lazyBundleId$;
|
1875
|
+
const module = cmpModules.get(bundleId) ;
|
1876
|
+
if (module) {
|
1877
|
+
return module[exportName];
|
1878
|
+
}
|
1879
|
+
|
1880
|
+
if (!hmrVersionId || !BUILD.hotModuleReplacement) {
|
1881
|
+
const processMod = importedModule => {
|
1882
|
+
cmpModules.set(bundleId, importedModule);
|
1883
|
+
return importedModule[exportName];
|
1884
|
+
}
|
1885
|
+
switch(bundleId) {
|
1886
|
+
|
1887
|
+
case 'cpsl-alert_18.cjs':
|
1888
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
1889
|
+
/* webpackMode: "lazy" */
|
1890
|
+
'./cpsl-alert_18.cjs.entry.js')); }).then(processMod, consoleError);
|
1891
|
+
case 'cpsl-animation.cjs':
|
1892
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
1893
|
+
/* webpackMode: "lazy" */
|
1894
|
+
'./cpsl-animation.cjs.entry.js')); }).then(processMod, consoleError);
|
1895
|
+
case 'cpsl-col.cjs':
|
1896
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
1897
|
+
/* webpackMode: "lazy" */
|
1898
|
+
'./cpsl-col.cjs.entry.js')); }).then(processMod, consoleError);
|
1899
|
+
case 'cpsl-grid.cjs':
|
1900
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
1901
|
+
/* webpackMode: "lazy" */
|
1902
|
+
'./cpsl-grid.cjs.entry.js')); }).then(processMod, consoleError);
|
1903
|
+
case 'cpsl-info-box.cjs':
|
1904
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
1905
|
+
/* webpackMode: "lazy" */
|
1906
|
+
'./cpsl-info-box.cjs.entry.js')); }).then(processMod, consoleError);
|
1907
|
+
case 'cpsl-row.cjs':
|
1908
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
1909
|
+
/* webpackMode: "lazy" */
|
1910
|
+
'./cpsl-row.cjs.entry.js')); }).then(processMod, consoleError);
|
1911
|
+
}
|
1912
|
+
}
|
1913
|
+
return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
|
1914
|
+
/* @vite-ignore */
|
1915
|
+
/* webpackInclude: /\.entry\.js$/ */
|
1916
|
+
/* webpackExclude: /\.system\.entry\.js$/ */
|
1917
|
+
/* webpackMode: "lazy" */
|
1918
|
+
`./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
|
1919
|
+
{
|
1920
|
+
cmpModules.set(bundleId, importedModule);
|
1921
|
+
}
|
1922
|
+
return importedModule[exportName];
|
1923
|
+
}, consoleError);
|
1924
|
+
};
|
1925
|
+
const styles = /*@__PURE__*/ new Map();
|
1926
|
+
const win = typeof window !== 'undefined' ? window : {};
|
1927
|
+
const doc = win.document || { head: {} };
|
1928
|
+
const plt = {
|
1929
|
+
$flags$: 0,
|
1930
|
+
$resourcesUrl$: '',
|
1931
|
+
jmp: (h) => h(),
|
1932
|
+
raf: (h) => requestAnimationFrame(h),
|
1933
|
+
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
|
1934
|
+
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
|
1935
|
+
ce: (eventName, opts) => new CustomEvent(eventName, opts),
|
1936
|
+
};
|
1937
|
+
const supportsListenerOptions = /*@__PURE__*/ (() => {
|
1938
|
+
let supportsListenerOptions = false;
|
1939
|
+
try {
|
1940
|
+
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
|
1941
|
+
get() {
|
1942
|
+
supportsListenerOptions = true;
|
1943
|
+
},
|
1944
|
+
}));
|
1945
|
+
}
|
1946
|
+
catch (e) { }
|
1947
|
+
return supportsListenerOptions;
|
1948
|
+
})();
|
1949
|
+
const promiseResolve = (v) => Promise.resolve(v);
|
1950
|
+
const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
|
1951
|
+
try {
|
1952
|
+
new CSSStyleSheet();
|
1953
|
+
return typeof new CSSStyleSheet().replaceSync === 'function';
|
1954
|
+
}
|
1955
|
+
catch (e) { }
|
1956
|
+
return false;
|
1957
|
+
})()
|
1958
|
+
;
|
1959
|
+
const queueDomReads = [];
|
1960
|
+
const queueDomWrites = [];
|
1961
|
+
const queueTask = (queue, write) => (cb) => {
|
1962
|
+
queue.push(cb);
|
1963
|
+
if (!queuePending) {
|
1964
|
+
queuePending = true;
|
1965
|
+
if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
|
1966
|
+
nextTick(flush);
|
1967
|
+
}
|
1968
|
+
else {
|
1969
|
+
plt.raf(flush);
|
1970
|
+
}
|
1971
|
+
}
|
1972
|
+
};
|
1973
|
+
const consume = (queue) => {
|
1974
|
+
for (let i = 0; i < queue.length; i++) {
|
1975
|
+
try {
|
1976
|
+
queue[i](performance.now());
|
1977
|
+
}
|
1978
|
+
catch (e) {
|
1979
|
+
consoleError(e);
|
1980
|
+
}
|
1981
|
+
}
|
1982
|
+
queue.length = 0;
|
1983
|
+
};
|
1984
|
+
const flush = () => {
|
1985
|
+
// always force a bunch of medium callbacks to run, but still have
|
1986
|
+
// a throttle on how many can run in a certain time
|
1987
|
+
// DOM READS!!!
|
1988
|
+
consume(queueDomReads);
|
1989
|
+
// DOM WRITES!!!
|
1990
|
+
{
|
1991
|
+
consume(queueDomWrites);
|
1992
|
+
if ((queuePending = queueDomReads.length > 0)) {
|
1993
|
+
// still more to do yet, but we've run out of time
|
1994
|
+
// let's let this thing cool off and try again in the next tick
|
1995
|
+
plt.raf(flush);
|
1996
|
+
}
|
1997
|
+
}
|
1998
|
+
};
|
1999
|
+
const nextTick = (cb) => promiseResolve().then(cb);
|
2000
|
+
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
|
2001
|
+
|
2002
|
+
exports.Host = Host;
|
2003
|
+
exports.bootstrapLazy = bootstrapLazy;
|
2004
|
+
exports.createEvent = createEvent;
|
2005
|
+
exports.forceUpdate = forceUpdate;
|
2006
|
+
exports.getElement = getElement;
|
2007
|
+
exports.h = h;
|
2008
|
+
exports.promiseResolve = promiseResolve;
|
2009
|
+
exports.registerInstance = registerInstance;
|
2010
|
+
exports.setNonce = setNonce;
|
2011
|
+
|
2012
|
+
//# sourceMappingURL=index-3fccb5b4.js.map
|