@usecapsule/core-components 2.0.2 → 2.0.4-dev.1
Sign up to get free protection for your applications and to get access to all the features.
- 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-68c73705.entry.js +2 -0
- package/dist/capsule/p-68c73705.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-91412151.entry.js +2 -0
- package/dist/capsule/p-91412151.entry.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-cacdef26.entry.js +29 -0
- package/dist/capsule/p-cacdef26.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/capsule/p-f604b591.entry.js +2 -0
- package/dist/capsule/p-f604b591.entry.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_17.cjs.entry.js +10737 -0
- package/dist/cjs/cpsl-alert_17.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 +342 -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/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/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/decent-brand.svg +3 -0
- package/dist/collection/assets/icons/decent.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/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 +75 -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/lightning.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/ramp-network-brand.svg +3 -0
- package/dist/collection/assets/icons/ramp-network.svg +3 -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 +33 -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-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 +431 -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 +59 -0
- package/dist/collection/components/cpsl-text/cpsl-text.js +19 -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 +7 -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 +12 -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_17.entry.js +10717 -0
- package/dist/esm/cpsl-alert_17.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 +338 -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 +5 -0
- package/dist/types/components/cpsl-text/cpsl-text.d.ts +0 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interface.d.ts +0 -15
- package/dist/types/utils/theme/generateFont.d.ts +1 -1
- package/dist/types/utils/theme/generateTheme.d.ts +2 -1
- package/package.json +2 -2
- 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
@@ -1,573 +1,2 @@
|
|
1
|
-
import
|
2
|
-
|
3
|
-
const generateBorderRadii = ({ borderRadius }) => {
|
4
|
-
if (!Boolean(borderRadius)) {
|
5
|
-
return;
|
6
|
-
}
|
7
|
-
let smallRadius = 8;
|
8
|
-
let mediumRadius = 16;
|
9
|
-
let largeRadius = 24;
|
10
|
-
const fullRadius = 1000;
|
11
|
-
let isFull = false;
|
12
|
-
let isNone = false;
|
13
|
-
switch (borderRadius) {
|
14
|
-
case 'none': {
|
15
|
-
isNone = true;
|
16
|
-
smallRadius = 0;
|
17
|
-
mediumRadius = 0;
|
18
|
-
largeRadius = 0;
|
19
|
-
break;
|
20
|
-
}
|
21
|
-
case 'xs': {
|
22
|
-
smallRadius = 4;
|
23
|
-
mediumRadius = 12;
|
24
|
-
largeRadius = 20;
|
25
|
-
break;
|
26
|
-
}
|
27
|
-
case 'md': {
|
28
|
-
smallRadius = 12;
|
29
|
-
mediumRadius = 20;
|
30
|
-
largeRadius = 28;
|
31
|
-
break;
|
32
|
-
}
|
33
|
-
case 'lg': {
|
34
|
-
smallRadius = 16;
|
35
|
-
mediumRadius = 24;
|
36
|
-
largeRadius = 32;
|
37
|
-
break;
|
38
|
-
}
|
39
|
-
case 'full': {
|
40
|
-
smallRadius = 16;
|
41
|
-
mediumRadius = 24;
|
42
|
-
largeRadius = 32;
|
43
|
-
isFull = true;
|
44
|
-
break;
|
45
|
-
}
|
46
|
-
}
|
47
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-input', `${isFull ? fullRadius : smallRadius}px`);
|
48
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-alert', `${smallRadius}px`);
|
49
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-tabs', `${isFull ? fullRadius : smallRadius}px`);
|
50
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-primary-button', `${isFull ? fullRadius : smallRadius}px`);
|
51
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-secondary-button', `${isFull ? fullRadius : smallRadius}px`);
|
52
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-tile-button', `${smallRadius}px`);
|
53
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-modal', `${mediumRadius}px`);
|
54
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-pill', `${isNone ? 0 : fullRadius}px`);
|
55
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-qr-code', `${largeRadius}px`);
|
56
|
-
document.documentElement.style.setProperty('--cpsl-border-radius-info-box', `${smallRadius}px`);
|
57
|
-
};
|
58
|
-
|
59
|
-
const FONT_NAME_MAP = {
|
60
|
-
body2XS: 'body-2xs',
|
61
|
-
bodyXS: 'body-xs',
|
62
|
-
bodyS: 'body-s',
|
63
|
-
bodyM: 'body-m',
|
64
|
-
bodyL: 'body-l',
|
65
|
-
bodyXL: 'body-xl',
|
66
|
-
headingXS: 'heading-xs',
|
67
|
-
headingS: 'heading-s',
|
68
|
-
headingM: 'heading-m',
|
69
|
-
headingL: 'heading-l',
|
70
|
-
headingXL: 'heading-xl',
|
71
|
-
heading2XL: 'heading-2xl',
|
72
|
-
};
|
73
|
-
const generateFont = ({ font, customFontSizes }) => {
|
74
|
-
if (Boolean(font)) {
|
75
|
-
document.documentElement.style.setProperty('--cpsl-default-font', font);
|
76
|
-
}
|
77
|
-
Object.entries(FONT_NAME_MAP).forEach(([key, value]) => {
|
78
|
-
if (customFontSizes === null || customFontSizes === void 0 ? void 0 : customFontSizes[key]) {
|
79
|
-
document.documentElement.style.setProperty(`--cpsl-font-size-${value}`, customFontSizes[key]);
|
80
|
-
}
|
81
|
-
else {
|
82
|
-
document.documentElement.style.removeProperty(`--cpsl-font-size-${value}`);
|
83
|
-
}
|
84
|
-
});
|
85
|
-
};
|
86
|
-
|
87
|
-
/**
|
88
|
-
* A simple guard function:
|
89
|
-
*
|
90
|
-
* ```js
|
91
|
-
* Math.min(Math.max(low, value), high)
|
92
|
-
* ```
|
93
|
-
*/
|
94
|
-
function guard(low, high, value) {
|
95
|
-
return Math.min(Math.max(low, value), high);
|
96
|
-
}
|
97
|
-
|
98
|
-
class ColorError extends Error {
|
99
|
-
constructor(color) {
|
100
|
-
super(`Failed to parse color: "${color}"`);
|
101
|
-
}
|
102
|
-
}
|
103
|
-
var ColorError$1 = ColorError;
|
104
|
-
|
105
|
-
/**
|
106
|
-
* Parses a color into red, gree, blue, alpha parts
|
107
|
-
*
|
108
|
-
* @param color the input color. Can be a RGB, RBGA, HSL, HSLA, or named color
|
109
|
-
*/
|
110
|
-
function parseToRgba(color) {
|
111
|
-
if (typeof color !== 'string') throw new ColorError$1(color);
|
112
|
-
if (color.trim().toLowerCase() === 'transparent') return [0, 0, 0, 0];
|
113
|
-
let normalizedColor = color.trim();
|
114
|
-
normalizedColor = namedColorRegex.test(color) ? nameToHex(color) : color;
|
115
|
-
const reducedHexMatch = reducedHexRegex.exec(normalizedColor);
|
116
|
-
if (reducedHexMatch) {
|
117
|
-
const arr = Array.from(reducedHexMatch).slice(1);
|
118
|
-
return [...arr.slice(0, 3).map(x => parseInt(r(x, 2), 16)), parseInt(r(arr[3] || 'f', 2), 16) / 255];
|
119
|
-
}
|
120
|
-
const hexMatch = hexRegex.exec(normalizedColor);
|
121
|
-
if (hexMatch) {
|
122
|
-
const arr = Array.from(hexMatch).slice(1);
|
123
|
-
return [...arr.slice(0, 3).map(x => parseInt(x, 16)), parseInt(arr[3] || 'ff', 16) / 255];
|
124
|
-
}
|
125
|
-
const rgbaMatch = rgbaRegex.exec(normalizedColor);
|
126
|
-
if (rgbaMatch) {
|
127
|
-
const arr = Array.from(rgbaMatch).slice(1);
|
128
|
-
return [...arr.slice(0, 3).map(x => parseInt(x, 10)), parseFloat(arr[3] || '1')];
|
129
|
-
}
|
130
|
-
const hslaMatch = hslaRegex.exec(normalizedColor);
|
131
|
-
if (hslaMatch) {
|
132
|
-
const [h, s, l, a] = Array.from(hslaMatch).slice(1).map(parseFloat);
|
133
|
-
if (guard(0, 100, s) !== s) throw new ColorError$1(color);
|
134
|
-
if (guard(0, 100, l) !== l) throw new ColorError$1(color);
|
135
|
-
return [...hslToRgb(h, s, l), Number.isNaN(a) ? 1 : a];
|
136
|
-
}
|
137
|
-
throw new ColorError$1(color);
|
138
|
-
}
|
139
|
-
function hash(str) {
|
140
|
-
let hash = 5381;
|
141
|
-
let i = str.length;
|
142
|
-
while (i) {
|
143
|
-
hash = hash * 33 ^ str.charCodeAt(--i);
|
144
|
-
}
|
145
|
-
|
146
|
-
/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
|
147
|
-
* integers. Since we want the results to be always positive, convert the
|
148
|
-
* signed int to an unsigned by doing an unsigned bitshift. */
|
149
|
-
return (hash >>> 0) % 2341;
|
150
|
-
}
|
151
|
-
const colorToInt = x => parseInt(x.replace(/_/g, ''), 36);
|
152
|
-
const compressedColorMap = '1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm'.split(' ').reduce((acc, next) => {
|
153
|
-
const key = colorToInt(next.substring(0, 3));
|
154
|
-
const hex = colorToInt(next.substring(3)).toString(16);
|
155
|
-
|
156
|
-
// NOTE: padStart could be used here but it breaks Node 6 compat
|
157
|
-
// https://github.com/ricokahler/color2k/issues/351
|
158
|
-
let prefix = '';
|
159
|
-
for (let i = 0; i < 6 - hex.length; i++) {
|
160
|
-
prefix += '0';
|
161
|
-
}
|
162
|
-
acc[key] = `${prefix}${hex}`;
|
163
|
-
return acc;
|
164
|
-
}, {});
|
165
|
-
|
166
|
-
/**
|
167
|
-
* Checks if a string is a CSS named color and returns its equivalent hex value, otherwise returns the original color.
|
168
|
-
*/
|
169
|
-
function nameToHex(color) {
|
170
|
-
const normalizedColorName = color.toLowerCase().trim();
|
171
|
-
const result = compressedColorMap[hash(normalizedColorName)];
|
172
|
-
if (!result) throw new ColorError$1(color);
|
173
|
-
return `#${result}`;
|
174
|
-
}
|
175
|
-
const r = (str, amount) => Array.from(Array(amount)).map(() => str).join('');
|
176
|
-
const reducedHexRegex = new RegExp(`^#${r('([a-f0-9])', 3)}([a-f0-9])?$`, 'i');
|
177
|
-
const hexRegex = new RegExp(`^#${r('([a-f0-9]{2})', 3)}([a-f0-9]{2})?$`, 'i');
|
178
|
-
const rgbaRegex = new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${r(',\\s*(\\d+)\\s*', 2)}(?:,\\s*([\\d.]+))?\\s*\\)$`, 'i');
|
179
|
-
const hslaRegex = /^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i;
|
180
|
-
const namedColorRegex = /^[a-z]+$/i;
|
181
|
-
const roundColor = color => {
|
182
|
-
return Math.round(color * 255);
|
183
|
-
};
|
184
|
-
const hslToRgb = (hue, saturation, lightness) => {
|
185
|
-
let l = lightness / 100;
|
186
|
-
if (saturation === 0) {
|
187
|
-
// achromatic
|
188
|
-
return [l, l, l].map(roundColor);
|
189
|
-
}
|
190
|
-
|
191
|
-
// formulae from https://en.wikipedia.org/wiki/HSL_and_HSV
|
192
|
-
const huePrime = (hue % 360 + 360) % 360 / 60;
|
193
|
-
const chroma = (1 - Math.abs(2 * l - 1)) * (saturation / 100);
|
194
|
-
const secondComponent = chroma * (1 - Math.abs(huePrime % 2 - 1));
|
195
|
-
let red = 0;
|
196
|
-
let green = 0;
|
197
|
-
let blue = 0;
|
198
|
-
if (huePrime >= 0 && huePrime < 1) {
|
199
|
-
red = chroma;
|
200
|
-
green = secondComponent;
|
201
|
-
} else if (huePrime >= 1 && huePrime < 2) {
|
202
|
-
red = secondComponent;
|
203
|
-
green = chroma;
|
204
|
-
} else if (huePrime >= 2 && huePrime < 3) {
|
205
|
-
green = chroma;
|
206
|
-
blue = secondComponent;
|
207
|
-
} else if (huePrime >= 3 && huePrime < 4) {
|
208
|
-
green = secondComponent;
|
209
|
-
blue = chroma;
|
210
|
-
} else if (huePrime >= 4 && huePrime < 5) {
|
211
|
-
red = secondComponent;
|
212
|
-
blue = chroma;
|
213
|
-
} else if (huePrime >= 5 && huePrime < 6) {
|
214
|
-
red = chroma;
|
215
|
-
blue = secondComponent;
|
216
|
-
}
|
217
|
-
const lightnessModification = l - chroma / 2;
|
218
|
-
const finalRed = red + lightnessModification;
|
219
|
-
const finalGreen = green + lightnessModification;
|
220
|
-
const finalBlue = blue + lightnessModification;
|
221
|
-
return [finalRed, finalGreen, finalBlue].map(roundColor);
|
222
|
-
};
|
223
|
-
|
224
|
-
// taken from:
|
225
|
-
// https://github.com/styled-components/polished/blob/a23a6a2bb26802b3d922d9c3b67bac3f3a54a310/src/internalHelpers/_rgbToHsl.js
|
226
|
-
|
227
|
-
/**
|
228
|
-
* Parses a color in hue, saturation, lightness, and the alpha channel.
|
229
|
-
*
|
230
|
-
* Hue is a number between 0 and 360, saturation, lightness, and alpha are
|
231
|
-
* decimal percentages between 0 and 1
|
232
|
-
*/
|
233
|
-
function parseToHsla(color) {
|
234
|
-
const [red, green, blue, alpha] = parseToRgba(color).map((value, index) =>
|
235
|
-
// 3rd index is alpha channel which is already normalized
|
236
|
-
index === 3 ? value : value / 255);
|
237
|
-
const max = Math.max(red, green, blue);
|
238
|
-
const min = Math.min(red, green, blue);
|
239
|
-
const lightness = (max + min) / 2;
|
240
|
-
|
241
|
-
// achromatic
|
242
|
-
if (max === min) return [0, 0, lightness, alpha];
|
243
|
-
const delta = max - min;
|
244
|
-
const saturation = lightness > 0.5 ? delta / (2 - max - min) : delta / (max + min);
|
245
|
-
const hue = 60 * (red === max ? (green - blue) / delta + (green < blue ? 6 : 0) : green === max ? (blue - red) / delta + 2 : (red - green) / delta + 4);
|
246
|
-
return [hue, saturation, lightness, alpha];
|
247
|
-
}
|
248
|
-
|
249
|
-
/**
|
250
|
-
* Takes in hsla parts and constructs an hsla string
|
251
|
-
*
|
252
|
-
* @param hue The color circle (from 0 to 360) - 0 (or 360) is red, 120 is green, 240 is blue
|
253
|
-
* @param saturation Percentage of saturation, given as a decimal between 0 and 1
|
254
|
-
* @param lightness Percentage of lightness, given as a decimal between 0 and 1
|
255
|
-
* @param alpha Percentage of opacity, given as a decimal between 0 and 1
|
256
|
-
*/
|
257
|
-
function hsla(hue, saturation, lightness, alpha) {
|
258
|
-
return `hsla(${(hue % 360).toFixed()}, ${guard(0, 100, saturation * 100).toFixed()}%, ${guard(0, 100, lightness * 100).toFixed()}%, ${parseFloat(guard(0, 1, alpha).toFixed(3))})`;
|
259
|
-
}
|
260
|
-
|
261
|
-
/**
|
262
|
-
* Adjusts the current hue of the color by the given degrees. Wraps around when
|
263
|
-
* over 360.
|
264
|
-
*
|
265
|
-
* @param color input color
|
266
|
-
* @param degrees degrees to adjust the input color, accepts degree integers
|
267
|
-
* (0 - 360) and wraps around on overflow
|
268
|
-
*/
|
269
|
-
function adjustHue(color, degrees) {
|
270
|
-
const [h, s, l, a] = parseToHsla(color);
|
271
|
-
return hsla(h + degrees, s, l, a);
|
272
|
-
}
|
273
|
-
|
274
|
-
/**
|
275
|
-
* Darkens using lightness. This is equivalent to subtracting the lightness
|
276
|
-
* from the L in HSL.
|
277
|
-
*
|
278
|
-
* @param amount The amount to darken, given as a decimal between 0 and 1
|
279
|
-
*/
|
280
|
-
function darken(color, amount) {
|
281
|
-
const [hue, saturation, lightness, alpha] = parseToHsla(color);
|
282
|
-
return hsla(hue, saturation, lightness - amount, alpha);
|
283
|
-
}
|
284
|
-
|
285
|
-
/**
|
286
|
-
* Desaturates the input color by the given amount via subtracting from the `s`
|
287
|
-
* in `hsla`.
|
288
|
-
*
|
289
|
-
* @param amount The amount to desaturate, given as a decimal between 0 and 1
|
290
|
-
*/
|
291
|
-
function desaturate(color, amount) {
|
292
|
-
const [h, s, l, a] = parseToHsla(color);
|
293
|
-
return hsla(h, s - amount, l, a);
|
294
|
-
}
|
295
|
-
|
296
|
-
// taken from:
|
297
|
-
// https://github.com/styled-components/polished/blob/0764c982551b487469043acb56281b0358b3107b/src/color/getLuminance.js
|
298
|
-
|
299
|
-
/**
|
300
|
-
* Returns a number (float) representing the luminance of a color.
|
301
|
-
*/
|
302
|
-
function getLuminance(color) {
|
303
|
-
if (color === 'transparent') return 0;
|
304
|
-
function f(x) {
|
305
|
-
const channel = x / 255;
|
306
|
-
return channel <= 0.04045 ? channel / 12.92 : Math.pow((channel + 0.055) / 1.055, 2.4);
|
307
|
-
}
|
308
|
-
const [r, g, b] = parseToRgba(color);
|
309
|
-
return 0.2126 * f(r) + 0.7152 * f(g) + 0.0722 * f(b);
|
310
|
-
}
|
311
|
-
|
312
|
-
// taken from:
|
313
|
-
// https://github.com/styled-components/polished/blob/0764c982551b487469043acb56281b0358b3107b/src/color/getContrast.js
|
314
|
-
|
315
|
-
/**
|
316
|
-
* Returns the contrast ratio between two colors based on
|
317
|
-
* [W3's recommended equation for calculating contrast](http://www.w3.org/TR/WCAG20/#contrast-ratiodef).
|
318
|
-
*/
|
319
|
-
function getContrast(color1, color2) {
|
320
|
-
const luminance1 = getLuminance(color1);
|
321
|
-
const luminance2 = getLuminance(color2);
|
322
|
-
return luminance1 > luminance2 ? (luminance1 + 0.05) / (luminance2 + 0.05) : (luminance2 + 0.05) / (luminance1 + 0.05);
|
323
|
-
}
|
324
|
-
|
325
|
-
/**
|
326
|
-
* Takes in rgba parts and returns an rgba string
|
327
|
-
*
|
328
|
-
* @param red The amount of red in the red channel, given in a number between 0 and 255 inclusive
|
329
|
-
* @param green The amount of green in the red channel, given in a number between 0 and 255 inclusive
|
330
|
-
* @param blue The amount of blue in the red channel, given in a number between 0 and 255 inclusive
|
331
|
-
* @param alpha Percentage of opacity, given as a decimal between 0 and 1
|
332
|
-
*/
|
333
|
-
function rgba(red, green, blue, alpha) {
|
334
|
-
return `rgba(${guard(0, 255, red).toFixed()}, ${guard(0, 255, green).toFixed()}, ${guard(0, 255, blue).toFixed()}, ${parseFloat(guard(0, 1, alpha).toFixed(3))})`;
|
335
|
-
}
|
336
|
-
|
337
|
-
/**
|
338
|
-
* Mixes two colors together. Taken from sass's implementation.
|
339
|
-
*/
|
340
|
-
function mix(color1, color2, weight) {
|
341
|
-
const normalize = (n, index) =>
|
342
|
-
// 3rd index is alpha channel which is already normalized
|
343
|
-
index === 3 ? n : n / 255;
|
344
|
-
const [r1, g1, b1, a1] = parseToRgba(color1).map(normalize);
|
345
|
-
const [r2, g2, b2, a2] = parseToRgba(color2).map(normalize);
|
346
|
-
|
347
|
-
// The formula is copied from the original Sass implementation:
|
348
|
-
// http://sass-lang.com/documentation/Sass/Script/Functions.html#mix-instance_method
|
349
|
-
const alphaDelta = a2 - a1;
|
350
|
-
const normalizedWeight = weight * 2 - 1;
|
351
|
-
const combinedWeight = normalizedWeight * alphaDelta === -1 ? normalizedWeight : normalizedWeight + alphaDelta / (1 + normalizedWeight * alphaDelta);
|
352
|
-
const weight2 = (combinedWeight + 1) / 2;
|
353
|
-
const weight1 = 1 - weight2;
|
354
|
-
const r = (r1 * weight1 + r2 * weight2) * 255;
|
355
|
-
const g = (g1 * weight1 + g2 * weight2) * 255;
|
356
|
-
const b = (b1 * weight1 + b2 * weight2) * 255;
|
357
|
-
const a = a2 * weight + a1 * (1 - weight);
|
358
|
-
return rgba(r, g, b, a);
|
359
|
-
}
|
360
|
-
|
361
|
-
/**
|
362
|
-
* Given a series colors, this function will return a `scale(x)` function that
|
363
|
-
* accepts a percentage as a decimal between 0 and 1 and returns the color at
|
364
|
-
* that percentage in the scale.
|
365
|
-
*
|
366
|
-
* ```js
|
367
|
-
* const scale = getScale('red', 'yellow', 'green');
|
368
|
-
* console.log(scale(0)); // rgba(255, 0, 0, 1)
|
369
|
-
* console.log(scale(0.5)); // rgba(255, 255, 0, 1)
|
370
|
-
* console.log(scale(1)); // rgba(0, 128, 0, 1)
|
371
|
-
* ```
|
372
|
-
*
|
373
|
-
* If you'd like to limit the domain and range like chroma-js, we recommend
|
374
|
-
* wrapping scale again.
|
375
|
-
*
|
376
|
-
* ```js
|
377
|
-
* const _scale = getScale('red', 'yellow', 'green');
|
378
|
-
* const scale = x => _scale(x / 100);
|
379
|
-
*
|
380
|
-
* console.log(scale(0)); // rgba(255, 0, 0, 1)
|
381
|
-
* console.log(scale(50)); // rgba(255, 255, 0, 1)
|
382
|
-
* console.log(scale(100)); // rgba(0, 128, 0, 1)
|
383
|
-
* ```
|
384
|
-
*/
|
385
|
-
function getScale(...colors) {
|
386
|
-
return n => {
|
387
|
-
const lastIndex = colors.length - 1;
|
388
|
-
const lowIndex = guard(0, lastIndex, Math.floor(n * lastIndex));
|
389
|
-
const highIndex = guard(0, lastIndex, Math.ceil(n * lastIndex));
|
390
|
-
const color1 = colors[lowIndex];
|
391
|
-
const color2 = colors[highIndex];
|
392
|
-
const unit = 1 / lastIndex;
|
393
|
-
const weight = (n - unit * lowIndex) / unit;
|
394
|
-
return mix(color1, color2, weight);
|
395
|
-
};
|
396
|
-
}
|
397
|
-
|
398
|
-
const guidelines = {
|
399
|
-
decorative: 1.5,
|
400
|
-
readable: 3,
|
401
|
-
aa: 4.5,
|
402
|
-
aaa: 7
|
403
|
-
};
|
404
|
-
|
405
|
-
/**
|
406
|
-
* Returns whether or not a color has bad contrast against a background
|
407
|
-
* according to a given standard.
|
408
|
-
*/
|
409
|
-
function hasBadContrast(color, standard = 'aa', background = '#fff') {
|
410
|
-
return getContrast(color, background) < guidelines[standard];
|
411
|
-
}
|
412
|
-
|
413
|
-
/**
|
414
|
-
* Lightens a color by a given amount. This is equivalent to
|
415
|
-
* `darken(color, -amount)`
|
416
|
-
*
|
417
|
-
* @param amount The amount to darken, given as a decimal between 0 and 1
|
418
|
-
*/
|
419
|
-
function lighten(color, amount) {
|
420
|
-
return darken(color, -amount);
|
421
|
-
}
|
422
|
-
|
423
|
-
/**
|
424
|
-
* Takes in a color and makes it more transparent by convert to `rgba` and
|
425
|
-
* decreasing the amount in the alpha channel.
|
426
|
-
*
|
427
|
-
* @param amount The amount to increase the transparency by, given as a decimal between 0 and 1
|
428
|
-
*/
|
429
|
-
function transparentize(color, amount) {
|
430
|
-
const [r, g, b, a] = parseToRgba(color);
|
431
|
-
return rgba(r, g, b, a - amount);
|
432
|
-
}
|
433
|
-
|
434
|
-
/**
|
435
|
-
* Takes a color and un-transparentizes it. Equivalent to
|
436
|
-
* `transparentize(color, -amount)`
|
437
|
-
*
|
438
|
-
* @param amount The amount to increase the opacity by, given as a decimal between 0 and 1
|
439
|
-
*/
|
440
|
-
function opacify(color, amount) {
|
441
|
-
return transparentize(color, -amount);
|
442
|
-
}
|
443
|
-
|
444
|
-
/**
|
445
|
-
* An alternative function to `readableColor`. Returns whether or not the
|
446
|
-
* readable color (i.e. the color to be place on top the input color) should be
|
447
|
-
* black.
|
448
|
-
*/
|
449
|
-
function readableColorIsBlack(color) {
|
450
|
-
return getLuminance(color) > 0.179;
|
451
|
-
}
|
452
|
-
|
453
|
-
/**
|
454
|
-
* Returns black or white for best contrast depending on the luminosity of the
|
455
|
-
* given color.
|
456
|
-
*/
|
457
|
-
function readableColor(color) {
|
458
|
-
return readableColorIsBlack(color) ? '#000' : '#fff';
|
459
|
-
}
|
460
|
-
|
461
|
-
/**
|
462
|
-
* Saturates a color by converting it to `hsl` and increasing the saturation
|
463
|
-
* amount. Equivalent to `desaturate(color, -amount)`
|
464
|
-
*
|
465
|
-
* @param color Input color
|
466
|
-
* @param amount The amount to darken, given as a decimal between 0 and 1
|
467
|
-
*/
|
468
|
-
function saturate(color, amount) {
|
469
|
-
return desaturate(color, -amount);
|
470
|
-
}
|
471
|
-
|
472
|
-
/**
|
473
|
-
* Takes in any color and returns it as a hex code.
|
474
|
-
*/
|
475
|
-
function toHex(color) {
|
476
|
-
const [r, g, b, a] = parseToRgba(color);
|
477
|
-
let hex = x => {
|
478
|
-
const h = guard(0, 255, x).toString(16);
|
479
|
-
// NOTE: padStart could be used here but it breaks Node 6 compat
|
480
|
-
// https://github.com/ricokahler/color2k/issues/351
|
481
|
-
return h.length === 1 ? `0${h}` : h;
|
482
|
-
};
|
483
|
-
return `#${hex(r)}${hex(g)}${hex(b)}${a < 1 ? hex(Math.round(a * 255)) : ''}`;
|
484
|
-
}
|
485
|
-
|
486
|
-
/**
|
487
|
-
* Takes in any color and returns it as an rgba string.
|
488
|
-
*/
|
489
|
-
function toRgba(color) {
|
490
|
-
return rgba(...parseToRgba(color));
|
491
|
-
}
|
492
|
-
|
493
|
-
/**
|
494
|
-
* Takes in any color and returns it as an hsla string.
|
495
|
-
*/
|
496
|
-
function toHsla(color) {
|
497
|
-
return hsla(...parseToHsla(color));
|
498
|
-
}
|
499
|
-
|
500
|
-
const isColor = strColor => {
|
501
|
-
const s = new Option().style;
|
502
|
-
s.color = strColor;
|
503
|
-
return s.color !== '';
|
504
|
-
};
|
505
|
-
const toKebabCase = (pascal) => pascal.replace(/([a-z0–9])([A-Z])/g, '$1-$2').toLowerCase();
|
506
|
-
const buildVars = (prev, obj) => {
|
507
|
-
let resp = {};
|
508
|
-
for (const k in obj) {
|
509
|
-
const name = `${prev}-${toKebabCase(k)}`;
|
510
|
-
if (typeof obj[k] === 'object' && obj[k] !== null) {
|
511
|
-
resp = Object.assign(Object.assign({}, resp), buildVars(name, obj[k]));
|
512
|
-
}
|
513
|
-
else {
|
514
|
-
resp[name] = obj[k];
|
515
|
-
}
|
516
|
-
}
|
517
|
-
return resp;
|
518
|
-
};
|
519
|
-
const getCssColors = (customPalette) => buildVars('--cpsl-color', customPalette);
|
520
|
-
|
521
|
-
const MIXES = [0, 0.08, 0.16, 0.32, 0.48, 0.64, 0.8, 0.96];
|
522
|
-
const generatePalette = ({ foregroundColor, backgroundColor, customPalette }) => {
|
523
|
-
if (!Boolean(foregroundColor) || !isColor(foregroundColor)) {
|
524
|
-
foregroundColor = DEFAULT_THEME.foregroundColor;
|
525
|
-
}
|
526
|
-
if (!Boolean(backgroundColor) || !isColor(backgroundColor)) {
|
527
|
-
backgroundColor = DEFAULT_THEME.backgroundColor;
|
528
|
-
}
|
529
|
-
const isDarkBackground = !readableColorIsBlack(backgroundColor);
|
530
|
-
const palette = {
|
531
|
-
foregroundColors: [],
|
532
|
-
backgroundColors: [],
|
533
|
-
isDarkBackground,
|
534
|
-
};
|
535
|
-
const backgroundMixColor = isDarkBackground ? '#FFFFFF' : '#000000';
|
536
|
-
const foregroundMixColor = isDarkBackground ? '#000000' : '#FFFFFF';
|
537
|
-
MIXES.forEach(value => {
|
538
|
-
palette.foregroundColors.push(mix(foregroundColor, foregroundMixColor, value));
|
539
|
-
palette.backgroundColors.push(mix(backgroundColor, backgroundMixColor, value));
|
540
|
-
});
|
541
|
-
document.documentElement.style.setProperty('--cpsl-color-background-0', palette.backgroundColors[0]);
|
542
|
-
document.documentElement.style.setProperty('--cpsl-color-background-8', palette.backgroundColors[1]);
|
543
|
-
document.documentElement.style.setProperty('--cpsl-color-background-16', palette.backgroundColors[2]);
|
544
|
-
document.documentElement.style.setProperty('--cpsl-color-background-32', palette.backgroundColors[3]);
|
545
|
-
document.documentElement.style.setProperty('--cpsl-color-background-48', palette.backgroundColors[4]);
|
546
|
-
document.documentElement.style.setProperty('--cpsl-color-background-64', palette.backgroundColors[5]);
|
547
|
-
document.documentElement.style.setProperty('--cpsl-color-background-80', palette.backgroundColors[6]);
|
548
|
-
document.documentElement.style.setProperty('--cpsl-color-background-96', palette.backgroundColors[7]);
|
549
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-0', palette.foregroundColors[0]);
|
550
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-8', palette.foregroundColors[1]);
|
551
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-16', palette.foregroundColors[2]);
|
552
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-32', palette.foregroundColors[3]);
|
553
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-48', palette.foregroundColors[4]);
|
554
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-64', palette.foregroundColors[5]);
|
555
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-80', palette.foregroundColors[6]);
|
556
|
-
document.documentElement.style.setProperty('--cpsl-color-foreground-96', palette.foregroundColors[7]);
|
557
|
-
if (Boolean(customPalette)) {
|
558
|
-
const cssColorVars = getCssColors(customPalette);
|
559
|
-
Object.entries(cssColorVars).forEach(([k, v]) => document.documentElement.style.setProperty(k, v));
|
560
|
-
}
|
561
|
-
return palette;
|
562
|
-
};
|
563
|
-
|
564
|
-
const generateTheme = ({ foregroundColor = DEFAULT_THEME.foregroundColor, backgroundColor = DEFAULT_THEME.backgroundColor, font, customPalette, borderRadius, customFontSizes, }) => {
|
565
|
-
const palette = generatePalette({ foregroundColor, backgroundColor, customPalette });
|
566
|
-
generateFont({ font, customFontSizes });
|
567
|
-
generateBorderRadii({ borderRadius });
|
568
|
-
return palette.isDarkBackground;
|
569
|
-
};
|
570
|
-
|
571
|
-
export { generateTheme };
|
572
|
-
|
1
|
+
import{D as o}from"./p-c2bf050b.js";const t=({borderRadius:o})=>{if(!Boolean(o)){return}let t=8;let r=16;let n=24;const e=1e3;let c=false;let s=false;switch(o){case"none":{s=true;t=0;r=0;n=0;break}case"xs":{t=4;r=12;n=20;break}case"md":{t=12;r=20;n=28;break}case"lg":{t=16;r=24;n=32;break}case"full":{t=16;r=24;n=32;c=true;break}}document.documentElement.style.setProperty("--cpsl-border-radius-input",`${c?e:t}px`);document.documentElement.style.setProperty("--cpsl-border-radius-alert",`${t}px`);document.documentElement.style.setProperty("--cpsl-border-radius-tabs",`${c?e:t}px`);document.documentElement.style.setProperty("--cpsl-border-radius-primary-button",`${c?e:t}px`);document.documentElement.style.setProperty("--cpsl-border-radius-secondary-button",`${c?e:t}px`);document.documentElement.style.setProperty("--cpsl-border-radius-tile-button",`${t}px`);document.documentElement.style.setProperty("--cpsl-border-radius-modal",`${r}px`);document.documentElement.style.setProperty("--cpsl-border-radius-pill",`${s?0:e}px`);document.documentElement.style.setProperty("--cpsl-border-radius-qr-code",`${n}px`);document.documentElement.style.setProperty("--cpsl-border-radius-info-box",`${t}px`)};const r=({font:o})=>{if(!Boolean(o)){return}document.documentElement.style.setProperty("--cpsl-default-font",o)};function n(o,t,r){return Math.min(Math.max(o,r),t)}class e extends Error{constructor(o){super(`Failed to parse color: "${o}"`)}}var c=e;function s(o){if(typeof o!=="string")throw new c(o);if(o.trim().toLowerCase()==="transparent")return[0,0,0,0];let t=o.trim();t=g.test(o)?_(o):o;const r=i.exec(t);if(r){const o=Array.from(r).slice(1);return[...o.slice(0,3).map((o=>parseInt(d(o,2),16))),parseInt(d(o[3]||"f",2),16)/255]}const e=f.exec(t);if(e){const o=Array.from(e).slice(1);return[...o.slice(0,3).map((o=>parseInt(o,16))),parseInt(o[3]||"ff",16)/255]}const s=p.exec(t);if(s){const o=Array.from(s).slice(1);return[...o.slice(0,3).map((o=>parseInt(o,10))),parseFloat(o[3]||"1")]}const u=b.exec(t);if(u){const[t,r,e,s]=Array.from(u).slice(1).map(parseFloat);if(n(0,100,r)!==r)throw new c(o);if(n(0,100,e)!==e)throw new c(o);return[...m(t,r,e),Number.isNaN(s)?1:s]}throw new c(o)}function u(o){let t=5381;let r=o.length;while(r){t=t*33^o.charCodeAt(--r)}return(t>>>0)%2341}const l=o=>parseInt(o.replace(/_/g,""),36);const a="1q29ehhb 1n09sgk7 1kl1ekf_ _yl4zsno 16z9eiv3 1p29lhp8 _bd9zg04 17u0____ _iw9zhe5 _to73___ _r45e31e _7l6g016 _jh8ouiv _zn3qba8 1jy4zshs 11u87k0u 1ro9yvyo 1aj3xael 1gz9zjz0 _3w8l4xo 1bf1ekf_ _ke3v___ _4rrkb__ 13j776yz _646mbhl _nrjr4__ _le6mbhl 1n37ehkb _m75f91n _qj3bzfz 1939yygw 11i5z6x8 _1k5f8xs 1509441m 15t5lwgf _ae2th1n _tg1ugcv 1lp1ugcv 16e14up_ _h55rw7n _ny9yavn _7a11xb_ 1ih442g9 _pv442g9 1mv16xof 14e6y7tu 1oo9zkds 17d1cisi _4v9y70f _y98m8kc 1019pq0v 12o9zda8 _348j4f4 1et50i2o _8epa8__ _ts6senj 1o350i2o 1mi9eiuo 1259yrp0 1ln80gnw _632xcoy 1cn9zldc _f29edu4 1n490c8q _9f9ziet 1b94vk74 _m49zkct 1kz6s73a 1eu9dtog _q58s1rz 1dy9sjiq __u89jo3 _aj5nkwg _ld89jo3 13h9z6wx _qa9z2ii _l119xgq _bs5arju 1hj4nwk9 1qt4nwk9 1ge6wau6 14j9zlcw 11p1edc_ _ms1zcxe _439shk6 _jt9y70f _754zsow 1la40eju _oq5p___ _x279qkz 1fa5r3rv _yd2d9ip _424tcku _8y1di2_ _zi2uabw _yy7rn9h 12yz980_ __39ljp6 1b59zg0x _n39zfzp 1fy9zest _b33k___ _hp9wq92 1il50hz4 _io472ub _lj9z3eo 19z9ykg0 _8t8iu3a 12b9bl4a 1ak5yw0o _896v4ku _tb8k8lv _s59zi6t _c09ze0p 1lg80oqn 1id9z8wb _238nba5 1kq6wgdi _154zssg _tn3zk49 _da9y6tc 1sg7cv4f _r12jvtt 1gq5fmkz 1cs9rvci _lp9jn1c _xw1tdnb 13f9zje6 16f6973h _vo7ir40 _bt5arjf _rc45e4t _hr4e100 10v4e100 _hc9zke2 _w91egv_ _sj2r1kk 13c87yx8 _vqpds__ _ni8ggk8 _tj9yqfb 1ia2j4r4 _7x9b10u 1fc9ld4j 1eq9zldr _5j9lhpx _ez9zl6o _md61fzm".split(" ").reduce(((o,t)=>{const r=l(t.substring(0,3));const n=l(t.substring(3)).toString(16);let e="";for(let o=0;o<6-n.length;o++){e+="0"}o[r]=`${e}${n}`;return o}),{});function _(o){const t=o.toLowerCase().trim();const r=a[u(t)];if(!r)throw new c(o);return`#${r}`}const d=(o,t)=>Array.from(Array(t)).map((()=>o)).join("");const i=new RegExp(`^#${d("([a-f0-9])",3)}([a-f0-9])?$`,"i");const f=new RegExp(`^#${d("([a-f0-9]{2})",3)}([a-f0-9]{2})?$`,"i");const p=new RegExp(`^rgba?\\(\\s*(\\d+)\\s*${d(",\\s*(\\d+)\\s*",2)}(?:,\\s*([\\d.]+))?\\s*\\)$`,"i");const b=/^hsla?\(\s*([\d.]+)\s*,\s*([\d.]+)%\s*,\s*([\d.]+)%(?:\s*,\s*([\d.]+))?\s*\)$/i;const g=/^[a-z]+$/i;const k=o=>Math.round(o*255);const m=(o,t,r)=>{let n=r/100;if(t===0){return[n,n,n].map(k)}const e=(o%360+360)%360/60;const c=(1-Math.abs(2*n-1))*(t/100);const s=c*(1-Math.abs(e%2-1));let u=0;let l=0;let a=0;if(e>=0&&e<1){u=c;l=s}else if(e>=1&&e<2){u=s;l=c}else if(e>=2&&e<3){l=c;a=s}else if(e>=3&&e<4){l=s;a=c}else if(e>=4&&e<5){u=s;a=c}else if(e>=5&&e<6){u=c;a=s}const _=n-c/2;const d=u+_;const i=l+_;const f=a+_;return[d,i,f].map(k)};function z(o){if(o==="transparent")return 0;function t(o){const t=o/255;return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}const[r,n,e]=s(o);return.2126*t(r)+.7152*t(n)+.0722*t(e)}function h(o,t,r,e){return`rgba(${n(0,255,o).toFixed()}, ${n(0,255,t).toFixed()}, ${n(0,255,r).toFixed()}, ${parseFloat(n(0,1,e).toFixed(3))})`}function y(o,t,r){const n=(o,t)=>t===3?o:o/255;const[e,c,u,l]=s(o).map(n);const[a,_,d,i]=s(t).map(n);const f=i-l;const p=r*2-1;const b=p*f===-1?p:p+f/(1+p*f);const g=(b+1)/2;const k=1-g;const m=(e*k+a*g)*255;const z=(c*k+_*g)*255;const y=(u*k+d*g)*255;const w=i*r+l*(1-r);return h(m,z,y,w)}function w(o){return z(o)>.179}const j=o=>{const t=(new Option).style;t.color=o;return t.color!==""};const x=o=>o.replace(/([a-z0–9])([A-Z])/g,"$1-$2").toLowerCase();const $=(o,t)=>{let r={};for(const n in t){const e=`${o}-${x(n)}`;if(typeof t[n]==="object"&&t[n]!==null){r=Object.assign(Object.assign({},r),$(e,t[n]))}else{r[e]=t[n]}}return r};const v=o=>$("--cpsl-color",o);const q=[0,.08,.16,.32,.48,.64,.8,.96];const F=({foregroundColor:t,backgroundColor:r,customPalette:n})=>{if(!Boolean(t)||!j(t)){t=o.foregroundColor}if(!Boolean(r)||!j(r)){r=o.backgroundColor}const e=!w(r);const c={foregroundColors:[],backgroundColors:[],isDarkBackground:e};const s=e?"#FFFFFF":"#000000";const u=e?"#000000":"#FFFFFF";q.forEach((o=>{c.foregroundColors.push(y(t,u,o));c.backgroundColors.push(y(r,s,o))}));document.documentElement.style.setProperty("--cpsl-color-background-0",c.backgroundColors[0]);document.documentElement.style.setProperty("--cpsl-color-background-8",c.backgroundColors[1]);document.documentElement.style.setProperty("--cpsl-color-background-16",c.backgroundColors[2]);document.documentElement.style.setProperty("--cpsl-color-background-32",c.backgroundColors[3]);document.documentElement.style.setProperty("--cpsl-color-background-48",c.backgroundColors[4]);document.documentElement.style.setProperty("--cpsl-color-background-64",c.backgroundColors[5]);document.documentElement.style.setProperty("--cpsl-color-background-80",c.backgroundColors[6]);document.documentElement.style.setProperty("--cpsl-color-background-96",c.backgroundColors[7]);document.documentElement.style.setProperty("--cpsl-color-foreground-0",c.foregroundColors[0]);document.documentElement.style.setProperty("--cpsl-color-foreground-8",c.foregroundColors[1]);document.documentElement.style.setProperty("--cpsl-color-foreground-16",c.foregroundColors[2]);document.documentElement.style.setProperty("--cpsl-color-foreground-32",c.foregroundColors[3]);document.documentElement.style.setProperty("--cpsl-color-foreground-48",c.foregroundColors[4]);document.documentElement.style.setProperty("--cpsl-color-foreground-64",c.foregroundColors[5]);document.documentElement.style.setProperty("--cpsl-color-foreground-80",c.foregroundColors[6]);document.documentElement.style.setProperty("--cpsl-color-foreground-96",c.foregroundColors[7]);if(Boolean(n)){const o=v(n);Object.entries(o).forEach((([o,t])=>document.documentElement.style.setProperty(o,t)))}return c};const C=({foregroundColor:n=o.foregroundColor,backgroundColor:e=o.backgroundColor,font:c,customPalette:s,borderRadius:u})=>{const l=F({foregroundColor:n,backgroundColor:e,customPalette:s});r({font:c});t({borderRadius:u});return l.isDarkBackground};const A=C;export{A as generateTheme};
|
573
2
|
//# sourceMappingURL=index.esm.js.map
|