ranui 0.1.10-alpha.7 → 0.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +397 -0
- package/README.zh-CN.md +369 -0
- package/dist/assets/image/failImage.d.ts +2 -0
- package/dist/bin/generate-component-api.d.ts +1 -0
- package/dist/bin/generate-style-docs.d.ts +1 -0
- package/dist/build/config.bundle.d.ts +2 -0
- package/dist/build/config.d.ts +3 -0
- package/dist/build/config.es.d.ts +2 -0
- package/dist/build/config.umd.d.ts +1 -0
- package/dist/builder.d.ts +11 -0
- package/dist/builder.js +39 -0
- package/dist/button-DukaD6uL.js +117 -0
- package/dist/button.js +3 -5
- package/dist/card-DQUJoDUQ.js +60 -0
- package/dist/card.js +5 -0
- package/dist/checkbox-iHZQb-yQ.js +94 -0
- package/dist/checkbox.js +3 -5
- package/dist/colorpicker-Ch67dWa_.js +302 -0
- package/dist/colorpicker.js +3 -9
- package/dist/components/button/index.d.ts +44 -0
- package/dist/components/card/index.d.ts +21 -0
- package/dist/components/checkbox/index.d.ts +35 -0
- package/dist/components/colorpicker/index.d.ts +88 -0
- package/dist/components/dropdown/index.d.ts +32 -0
- package/dist/components/form/index.d.ts +15 -0
- package/dist/components/icon/index.d.ts +58 -0
- package/dist/components/image/index.d.ts +25 -0
- package/dist/components/input/index.d.ts +229 -0
- package/dist/components/link/index.d.ts +21 -0
- package/dist/components/loading/index.d.ts +76 -0
- package/dist/components/math/index.d.ts +16 -0
- package/dist/components/message/container.d.ts +8 -0
- package/dist/components/message/index.d.ts +32 -0
- package/dist/components/modal/index.d.ts +100 -0
- package/dist/components/player/core/constants.d.ts +5 -0
- package/dist/components/player/core/controller.d.ts +33 -0
- package/dist/components/player/core/events.d.ts +10 -0
- package/dist/components/player/core/fullscreen.d.ts +5 -0
- package/dist/components/player/core/levels.d.ts +20 -0
- package/dist/components/player/core/media.d.ts +50 -0
- package/dist/components/player/core/playback.d.ts +14 -0
- package/dist/components/player/core/progress.d.ts +2 -0
- package/dist/components/player/core/state.d.ts +27 -0
- package/dist/components/player/core/view.d.ts +39 -0
- package/dist/components/player/index.d.ts +277 -0
- package/dist/components/popover/content/index.d.ts +12 -0
- package/dist/components/popover/index.d.ts +95 -0
- package/dist/components/progress/index.d.ts +40 -0
- package/dist/components/radar/index.d.ts +52 -0
- package/dist/components/route/index.d.ts +26 -0
- package/dist/components/router/index.d.ts +24 -0
- package/dist/components/scratch/index.d.ts +19 -0
- package/dist/components/section/index.d.ts +23 -0
- package/dist/components/select/dropdown-item/index.d.ts +21 -0
- package/dist/components/select/index.d.ts +135 -0
- package/dist/components/select/option/index.d.ts +19 -0
- package/dist/components/skeleton/index.d.ts +13 -0
- package/dist/components/tab/index.d.ts +58 -0
- package/dist/components/tabpane/index.d.ts +33 -0
- package/dist/demo/i18n.d.ts +4 -0
- package/dist/demo/index.d.ts +3 -0
- package/dist/demo/register-icons.d.ts +1 -0
- package/dist/dropdown-C5362qTy.js +82 -0
- package/dist/dropdown.js +6 -0
- package/dist/events-C59wGdni.js +30 -0
- package/dist/factory-BdsO0dEW.js +165 -0
- package/dist/form-05Lxxl3D.js +44 -0
- package/dist/form.js +5 -0
- package/dist/icon-DmoEnao5.js +165 -0
- package/dist/icon.js +4 -4
- package/dist/{index-KS2nvVcO.js → image-6GayFDqX.js} +58 -71
- package/dist/image.js +3 -2
- package/dist/index.cjs +35 -0
- package/dist/index.d.ts +277 -116
- package/dist/index.iife.js +306 -0
- package/dist/index.js +78 -38
- package/dist/input-DoraIb3x.js +198 -0
- package/dist/input.js +2 -3
- package/dist/katex-es-Bpesphgp.js +23682 -0
- package/dist/katex-es-Cnq5Pk8K.cjs +261 -0
- package/dist/link-BW-gvrpN.js +77 -0
- package/dist/link.js +6 -0
- package/dist/loading-Mko22ncl.js +206 -0
- package/dist/loading.js +4 -6
- package/dist/math-B5PpSnFR.js +52 -0
- package/dist/math.js +2 -4
- package/dist/message-CQENvkoi.js +137 -0
- package/dist/message.js +3 -4
- package/dist/mocks-CMGoftIc.js +179 -0
- package/dist/modal-DruDj3AB.js +350 -0
- package/dist/modal.js +3 -2
- package/dist/player-CvfmwWUa.js +13536 -0
- package/dist/player.js +3 -6
- package/dist/playwright.config.d.ts +2 -0
- package/dist/plugins/load-svg.d.ts +9 -0
- package/dist/popover-BCvHwLZb.js +213 -0
- package/dist/popover.js +3 -5
- package/dist/progress-BWkNf2J5.js +123 -0
- package/dist/progress.js +3 -5
- package/dist/radar-CWsawt2g.js +181 -0
- package/dist/radar.js +3 -4
- package/dist/ranui.css +1 -0
- package/dist/route-BY_E6-2C.js +88 -0
- package/dist/route.js +6 -0
- package/dist/router-BDcv4F-2.js +79 -0
- package/dist/router.js +6 -0
- package/dist/scratch-Dbd9G6Q6.js +60 -0
- package/dist/scratch.js +4 -0
- package/dist/section-CNTvgdQ-.js +63 -0
- package/dist/section.js +5 -0
- package/dist/select-BmhCUTLb.js +433 -0
- package/dist/select.js +3 -8
- package/dist/signal-XHfNsQNW.js +57 -0
- package/dist/skeleton-DPv9nFhL.js +32 -0
- package/dist/skeleton.js +3 -2
- package/dist/ssg.js +21 -0
- package/dist/ssr-DSGwPtEd.js +34 -0
- package/dist/ssr-stream.d.ts +1 -0
- package/dist/ssr-stream.js +87 -0
- package/dist/ssr.d.ts +1 -0
- package/dist/ssr.js +7 -0
- package/dist/style.d.ts +1 -0
- package/dist/style.js +0 -0
- package/dist/tab-C9swK-hm.js +185 -0
- package/dist/tab.js +3 -4
- package/dist/tabpane-B_M-Jokw.js +87 -0
- package/dist/tabpane.js +3 -2
- package/dist/test/e2e/button.spec.d.ts +1 -0
- package/dist/test/e2e/checkbox.spec.d.ts +1 -0
- package/dist/test/e2e/helpers.d.ts +13 -0
- package/dist/test/e2e/icon.spec.d.ts +1 -0
- package/dist/test/e2e/image.spec.d.ts +1 -0
- package/dist/test/e2e/input.spec.d.ts +1 -0
- package/dist/test/e2e/loading.spec.d.ts +1 -0
- package/dist/test/e2e/message.spec.d.ts +1 -0
- package/dist/test/e2e/modal.spec.d.ts +1 -0
- package/dist/test/e2e/popover.spec.d.ts +1 -0
- package/dist/test/e2e/progress.spec.d.ts +1 -0
- package/dist/test/e2e/radar.spec.d.ts +1 -0
- package/dist/test/e2e/select.spec.d.ts +1 -0
- package/dist/test/e2e/skeleton.spec.d.ts +1 -0
- package/dist/test/e2e/tab.spec.d.ts +1 -0
- package/dist/test/e2e/visual/colorpicker.spec.d.ts +1 -0
- package/dist/test/e2e/visual/components.spec.d.ts +1 -0
- package/dist/test/e2e/visual/player.spec.d.ts +1 -0
- package/dist/test/integration/composition.test.d.ts +23 -0
- package/dist/test/setup.d.ts +0 -0
- package/dist/test/ssr/builder.core.ssr.test.d.ts +1 -0
- package/dist/test/ssr/builder.factory.ssr.test.d.ts +1 -0
- package/dist/test/ssr/builder.mocks.test.d.ts +1 -0
- package/dist/test/ssr/components/button.test.d.ts +1 -0
- package/dist/test/ssr/css-vars.test.d.ts +1 -0
- package/dist/test/ssr/registry.test.d.ts +1 -0
- package/dist/test/ssr/router.ssg.test.d.ts +2 -0
- package/dist/test/ssr/snapshots/button.test.d.ts +1 -0
- package/dist/test/ssr/stream.test.d.ts +2 -0
- package/dist/test/ssr/theme.tokens.ssr.test.d.ts +1 -0
- package/dist/test/unit/builder.core.browser.test.d.ts +1 -0
- package/dist/test/unit/builder.escape.test.d.ts +1 -0
- package/dist/test/unit/builder.selectors.test.d.ts +1 -0
- package/dist/test/unit/button.contract.test.d.ts +1 -0
- package/dist/test/unit/card.contract.test.d.ts +1 -0
- package/dist/test/unit/checkbox.contract.test.d.ts +1 -0
- package/dist/test/unit/colorpicker.color.utils.test.d.ts +1 -0
- package/dist/test/unit/colorpicker.contract.test.d.ts +1 -0
- package/dist/test/unit/colorpicker.methods.test.d.ts +1 -0
- package/dist/test/unit/component.helpers.test.d.ts +1 -0
- package/dist/test/unit/dropdown-item.contract.test.d.ts +1 -0
- package/dist/test/unit/dropdown.contract.test.d.ts +1 -0
- package/dist/test/unit/form.contract.test.d.ts +1 -0
- package/dist/test/unit/helpers/component.d.ts +3 -0
- package/dist/test/unit/helpers/dom.d.ts +2 -0
- package/dist/test/unit/icon.contract.test.d.ts +1 -0
- package/dist/test/unit/image.contract.test.d.ts +1 -0
- package/dist/test/unit/input.contract.test.d.ts +1 -0
- package/dist/test/unit/link.contract.test.d.ts +1 -0
- package/dist/test/unit/loading.contract.test.d.ts +1 -0
- package/dist/test/unit/math.contract.test.d.ts +1 -0
- package/dist/test/unit/message.component.test.d.ts +1 -0
- package/dist/test/unit/message.container.test.d.ts +1 -0
- package/dist/test/unit/modal.contract.test.d.ts +1 -0
- package/dist/test/unit/option.contract.test.d.ts +1 -0
- package/dist/test/unit/package-exports.source.test.d.ts +1 -0
- package/dist/test/unit/player-controls.test.d.ts +1 -0
- package/dist/test/unit/player-core.test.d.ts +1 -0
- package/dist/test/unit/player-event-handlers.test.d.ts +1 -0
- package/dist/test/unit/player-events.test.d.ts +1 -0
- package/dist/test/unit/player-fullscreen.test.d.ts +1 -0
- package/dist/test/unit/player-interactions.test.d.ts +1 -0
- package/dist/test/unit/player-levels.test.d.ts +1 -0
- package/dist/test/unit/player-media.test.d.ts +1 -0
- package/dist/test/unit/player-playback.test.d.ts +1 -0
- package/dist/test/unit/player.contract.test.d.ts +1 -0
- package/dist/test/unit/popover-accessibility.test.d.ts +1 -0
- package/dist/test/unit/popover.contract.test.d.ts +2 -0
- package/dist/test/unit/progress.contract.test.d.ts +1 -0
- package/dist/test/unit/radar.contract.test.d.ts +1 -0
- package/dist/test/unit/route.contract.test.d.ts +1 -0
- package/dist/test/unit/router.contract.test.d.ts +2 -0
- package/dist/test/unit/scratch.contract.test.d.ts +1 -0
- package/dist/test/unit/select-accessibility.test.d.ts +1 -0
- package/dist/test/unit/select-option.contract.test.d.ts +1 -0
- package/dist/test/unit/select.contract.test.d.ts +1 -0
- package/dist/test/unit/skeleton.contract.test.d.ts +1 -0
- package/dist/test/unit/ssr.test.d.ts +1 -0
- package/dist/test/unit/tab.contract.test.d.ts +2 -0
- package/dist/test/unit/theme.semantic-tokens.test.d.ts +1 -0
- package/dist/test/unit/theme.skin-tokens.test.d.ts +1 -0
- package/dist/test/unit/utils.dom.test.d.ts +1 -0
- package/dist/test/unit/utils.error.test.d.ts +1 -0
- package/dist/test/unit/utils.i18n.test.d.ts +1 -0
- package/dist/test/unit/utils.image.test.d.ts +1 -0
- package/dist/test/unit/utils.math.test.d.ts +1 -0
- package/dist/test/unit/utils.router.test.d.ts +1 -0
- package/dist/test/unit/utils.signal.test.d.ts +1 -0
- package/dist/test/unit/utils.ssr-stream.test.d.ts +1 -0
- package/dist/test/unit/utils.style.test.d.ts +1 -0
- package/dist/test/unit/utils.theme.test.d.ts +1 -0
- package/dist/test/unit/utils.tween.test.d.ts +1 -0
- package/dist/tsconfig.json +9 -9
- package/dist/typings.d.ts +163 -116
- package/dist/utils/builder/core.d.ts +70 -0
- package/dist/utils/builder/env.d.ts +1 -0
- package/dist/utils/builder/escape.d.ts +2 -0
- package/dist/utils/builder/events.d.ts +55 -0
- package/dist/utils/builder/factory.d.ts +18 -0
- package/dist/utils/builder/index.d.ts +9 -0
- package/dist/utils/builder/mocks.d.ts +62 -0
- package/dist/utils/builder/selectors.d.ts +4 -0
- package/dist/utils/builder/signal.d.ts +87 -0
- package/dist/utils/color.d.ts +52 -0
- package/dist/utils/component.d.ts +16 -0
- package/dist/utils/dom.d.ts +39 -0
- package/dist/utils/error.d.ts +6 -0
- package/dist/utils/i18n/index.d.ts +53 -0
- package/dist/utils/i18n.js +88 -0
- package/dist/utils/image.d.ts +39 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/math.d.ts +26 -0
- package/dist/utils/router/index.d.ts +128 -0
- package/dist/utils/router.js +197 -0
- package/dist/utils/ssg.d.ts +49 -0
- package/dist/utils/ssr-registry.d.ts +8 -0
- package/dist/utils/ssr-stream.d.ts +23 -0
- package/dist/utils/ssr.d.ts +17 -0
- package/dist/utils/style.d.ts +12 -0
- package/dist/utils/theme.d.ts +9 -0
- package/dist/utils/tween.d.ts +21 -0
- package/dist/utils/video.d.ts +40 -0
- package/dist/utils-D4pPF77E.js +689 -0
- package/dist/vite.config.d.ts +6 -0
- package/dist/vitest.config.d.ts +2 -0
- package/dist/vitest.config.ssr.d.ts +2 -0
- package/docs/COMPONENTS.md +326 -0
- package/docs/DESIGN.md +182 -0
- package/docs/style-tokens-public.md +880 -0
- package/package.json +138 -74
- package/typings.d.ts +163 -116
- package/dist/_commonjs-dynamic-modules-DLbDWi6a.js +0 -12
- package/dist/add-user-BN1JlY7e.js +0 -4
- package/dist/arrow-down-Beig7FXI.js +0 -652
- package/dist/book-nTEFXU2x.js +0 -4
- package/dist/check-circle-fill-B_pd8ZSs.js +0 -4
- package/dist/check-circle-szyAJiap.js +0 -4
- package/dist/close-CFnkhudp.js +0 -4
- package/dist/close-circle-CwmuN2C6.js +0 -4
- package/dist/close-circle-fill-jSqPPw9i.js +0 -4
- package/dist/colz-DJZvo_8B.js +0 -232
- package/dist/docx-CHkPTdGU.js +0 -3665
- package/dist/drop-4j4abxje.js +0 -36
- package/dist/eye-D_mEt17f.js +0 -4
- package/dist/eye-close-BVr3NJtg.js +0 -4
- package/dist/home-BUQ4USMk.js +0 -4
- package/dist/iconShadowless.js +0 -6
- package/dist/index-BZR0HaP2.js +0 -40
- package/dist/index-Bl6-5Hp8.js +0 -63701
- package/dist/index-C0Xh8vJ3.js +0 -146
- package/dist/index-C4Sv0T51.js +0 -495
- package/dist/index-CGEx9VOA.js +0 -17106
- package/dist/index-CILRcFIV.js +0 -100
- package/dist/index-CQTJoWhb.js +0 -19
- package/dist/index-CWNtaUwu.js +0 -308
- package/dist/index-CjSKJE6S.js +0 -158
- package/dist/index-Ck9TOxFh.js +0 -279
- package/dist/index-CryFK9u4.js +0 -320
- package/dist/index-D4twPONc.js +0 -187
- package/dist/index-D83djTVa.js +0 -659
- package/dist/index-DAxs7Dd2.js +0 -119
- package/dist/index-DBecKjmY.js +0 -279
- package/dist/index-DC5EA657.js +0 -91
- package/dist/index-DHTzB_6b.js +0 -9575
- package/dist/index-DL-1C2RQ.js +0 -496
- package/dist/index-DN-kAx-A.js +0 -72
- package/dist/index-TlwIh-o2.js +0 -306
- package/dist/index-WfFw4LJT.js +0 -490
- package/dist/index-lLO-8KJ1.js +0 -204
- package/dist/index-oD-_YELB.js +0 -511
- package/dist/index-qvcQTV5_.js +0 -105
- package/dist/info-circle-COnL5bTJ.js +0 -4
- package/dist/info-circle-fill-CFeVMdci.js +0 -4
- package/dist/inputShadowless.js +0 -6
- package/dist/jszip.min-Dhs3nUkD.js +0 -2346
- package/dist/katex-es-B5r5vt3m.js +0 -14628
- package/dist/loading-Dcc5RApI.js +0 -4
- package/dist/loading-scene-BMc2wqKm.js +0 -4
- package/dist/lock-Cr7BnmWN.js +0 -4
- package/dist/message-D36_Zo2l.js +0 -4
- package/dist/pdf-Cx0VWKFo.js +0 -118
- package/dist/power-off-lQRbiBak.js +0 -4
- package/dist/preview-CJbz9GjO.js +0 -4
- package/dist/preview.js +0 -7
- package/dist/selectShadowless.js +0 -564
- package/dist/setting-DemlgzVC.js +0 -4
- package/dist/shadowless.js +0 -8
- package/dist/sprite-CH2zLtZy.js +0 -141
- package/dist/style.css +0 -1
- package/dist/team-tl4NJXPC.js +0 -4
- package/dist/umd/index.umd.cjs +0 -60
- package/dist/umd/shadowless/shadowless.umd.cjs +0 -1
- package/dist/umd/shadowless/style.css +0 -1
- package/dist/umd/style.css +0 -1
- package/dist/unlock-CeU74z9n.js +0 -4
- package/dist/user-B-eVXwuk.js +0 -4
- package/dist/warning-circle-DDUgEDIv.js +0 -4
- package/dist/warning-circle-fill-lODUKz0i.js +0 -4
- package/readme.md +0 -176
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { c as o, d as i, f as t, l as s, m as h, p as b, s as d, u as l, v as k } from "./utils-D4pPF77E.js";
|
|
2
|
+
import { t as x } from "./events-C59wGdni.js";
|
|
3
|
+
import { i as a, m as c, p as u, s as p } from "./factory-BdsO0dEW.js";
|
|
4
|
+
import { a as v, n as f } from "./ssr-DSGwPtEd.js";
|
|
5
|
+
var g = '.remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}:host{position:var(--ran-checkbox-host-position, relative);display:var(--ran-checkbox-host-display, inline-flex);margin:var(--ran-checkbox-host-margin, 0);padding:var(--ran-checkbox-host-padding, 0);box-sizing:var(--ran-checkbox-host-box-sizing, border-box);list-style:var(--ran-checkbox-host-list-style, none)}:host([disabled]){opacity:var(--ran-checkbox-disabled-opacity, .6)}:host([disabled]) .ran-checkbox-input{cursor:var(--ran-checkbox-disabled-cursor, not-allowed);pointer-events:var(--ran-checkbox-disabled-pointer-events, all)}:host([disabled]) .ran-checkbox-inner{background-color:var(--ran-checkbox-checked-background-color, var(--ran-color-bg-muted, #d9d9d9));border:1px solid var(--ran-color-border, #d9d9d9)}:host([disabled]) .ran-checkbox-inner:after{cursor:not-allowed;pointer-events:none;opacity:var(--ran-checkbox-checked-after-opacity, 1)}:host([disabled]) .ran-checkbox-checked .ran-checkbox-inner{background-color:var(--ran-checkbox-checked-background-color, var(--ran-color-bg-muted, #d9d9d9))}:host([disabled]) .ran-checkbox-checked .ran-checkbox-inner:after{opacity:var(--ran-checkbox-checked-after-opacity, 0)}.ran-checkbox-wrapper{display:inline-flex;align-items:center;gap:var(--ran-checkbox-label-gap, 8px);cursor:pointer;line-height:1}.ran-checkbox-label{color:var(--ran-checkbox-label-color, var(--ran-color-text, rgba(0, 0, 0, .88)));font-size:var(--ran-checkbox-label-font-size, 14px);font-family:var(--ran-checkbox-label-font-family, var(--ran-skin-font-family, inherit));line-height:var(--ran-checkbox-label-line-height, 1.5);-webkit-user-select:none;user-select:none}.ran-checkbox{position:var(--ran-checkbox-position, relative);display:var(--ran-checkbox-display, block);box-sizing:var(--ran-checkbox-box-sizing, border-box);margin:var(--ran-checkbox-margin, 0);width:var(--ran-checkbox-width, 16px);height:var(--ran-checkbox-height, 16px);padding:var(--ran-checkbox-padding, 0);color:var(--ran-checkbox-color, var(--ran-color-text, rgba(0, 0, 0, .88)));font-size:var(--ran-checkbox-font-size, 14px);line-height:var(--ran-checkbox-line-height, 1);list-style:var(--ran-checkbox-list-style, none);font-family:var(--ran-checkbox-font-family, var(--ran-skin-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"));white-space:var(--ran-checkbox-white-space, nowrap);cursor:var(--ran-checkbox-cursor, pointer);border-radius:var(--ran-checkbox-border-radius, 4px)}.ran-checkbox-input{position:var(--ran-checkbox-input-position, absolute);inset:var(--ran-checkbox-input-inset, 0);z-index:var(--ran-checkbox-input-z-index, 1);cursor:var(--ran-checkbox-input-cursor, pointer);opacity:var(--ran-checkbox-input-opacity, 0);margin:var(--ran-checkbox-input-margin, 0)}.ran-checkbox-inner{box-sizing:var(--ran-checkbox-inner-box-sizing, border-box);display:var(--ran-checkbox-inner-display, block);width:var(--ran-checkbox-inner-width, 16px);height:var(--ran-checkbox-inner-height, 16px);direction:var(--ran-checkbox-inner-direction, ltr);background-color:var(--ran-checkbox-inner-background-color, var(--ran-color-bg-elevated, #fff));border:var(--ran-checkbox-inner-border, 1px solid var(--ran-color-border, #d9d9d9));border-image-source:var(--ran-checkbox-inner-border-image-source, none);border-image-slice:var(--ran-checkbox-inner-border-image-slice, 8);border-image-width:var(--ran-checkbox-inner-border-image-width, 4px);border-image-outset:0;border-image-repeat:stretch;border-radius:var(--ran-checkbox-inner-border-radius, 4px);border-collapse:var(--ran-checkbox-inner-border-collapse, separate)}.ran-checkbox-inner:after{box-sizing:var(--ran-checkbox-inner-after-box-sizing, border-box);position:var(--ran-checkbox-inner-after-position, absolute);top:var(--ran-checkbox-inner-after-top, 50%);inset-inline-start:var(--ran-checkbox-inner-after-inset-inline-start, 25%);display:var(--ran-checkbox-inner-after-display, table);width:var(--ran-checkbox-inner-after-width, calc(16px / 14 * 5));height:var(--ran-checkbox-inner-after-height, calc(16px / 14 * 8));border:var(--ran-checkbox-inner-after-border, 2px solid #fff);border-top:var(--ran-checkbox-inner-after-border-top, 0);border-inline-start:var(--ran-checkbox-inner-after-border-inline-start, 0);opacity:var(--ran-checkbox-inner-after-opacity, 0);content:var(--ran-checkbox-inner-after-content, "");transition:var(--ran-checkbox-inner-after-transition, all .1s cubic-bezier(.71, -.46, .88, .6), opacity .1s);transform:var(--ran-checkbox-inner-after-transform, rotate(45deg) scale(1) translate(-50%, -50%))}.ran-checkbox-checked .ran-checkbox-inner{background-color:var(--ran-checkbox-checked-background-color, var(--ran-color-primary, #006bff));background-image:var(--ran-checkbox-checked-background-image, none);border:var(--ran-checkbox-checked-border, 1px solid var(--ran-color-primary, #006bff))}.ran-checkbox-checked .ran-checkbox-inner:after{opacity:var(--ran-checkbox-checked-after-opacity, 1)}.ran-checkbox:focus-within .ran-checkbox-inner{box-shadow:var(--ran-checkbox-focus-box-shadow, 0 0 0 2px var(--ran-blue-400, #cae7ff));border-color:var(--ran-checkbox-focus-border-color, var(--ran-color-primary, #006bff))}', m = class extends f {
|
|
6
|
+
static formAssociated = !0;
|
|
7
|
+
_events = new x();
|
|
8
|
+
_internals;
|
|
9
|
+
checkInput;
|
|
10
|
+
checkInner;
|
|
11
|
+
context;
|
|
12
|
+
container;
|
|
13
|
+
_shadowDom;
|
|
14
|
+
static get observedAttributes() {
|
|
15
|
+
return [
|
|
16
|
+
"disabled",
|
|
17
|
+
"checked",
|
|
18
|
+
"value",
|
|
19
|
+
"sheet"
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
constructor() {
|
|
23
|
+
super();
|
|
24
|
+
try {
|
|
25
|
+
this._internals = this.attachInternals();
|
|
26
|
+
} catch {
|
|
27
|
+
this._internals = void 0;
|
|
28
|
+
}
|
|
29
|
+
this._shadowDom = o(this, g);
|
|
30
|
+
const e = d(this._shadowDom, ".ran-checkbox-wrapper", () => a().class("ran-checkbox-wrapper").part("wrapper").children(a().class("ran-checkbox").part("checkbox").children(p().class("ran-checkbox-input").part("input").attr("type", "checkbox"), c().class("ran-checkbox-inner").part("inner")), c().class("ran-checkbox-label").part("label").children(u())).build());
|
|
31
|
+
this.container = e.querySelector(".ran-checkbox"), this.checkInput = e.querySelector(".ran-checkbox-input"), this.checkInner = e.querySelector(".ran-checkbox-inner"), this.checkInput.setAttribute("aria-hidden", "true"), this.checkInput.tabIndex = -1, this.context = { checked: !1 };
|
|
32
|
+
}
|
|
33
|
+
get disabled() {
|
|
34
|
+
return b(this);
|
|
35
|
+
}
|
|
36
|
+
set disabled(e) {
|
|
37
|
+
t.includes(e) ? this.removeAttribute("disabled") : this.setAttribute("disabled", "");
|
|
38
|
+
}
|
|
39
|
+
get value() {
|
|
40
|
+
const e = this.getAttribute("value");
|
|
41
|
+
return t.includes(e) && (this.context.checked = !1), `${this.context.checked}`;
|
|
42
|
+
}
|
|
43
|
+
set value(e) {
|
|
44
|
+
t.includes(e) ? (this.setAttribute("value", "false"), this.context.checked = !1) : (this.setAttribute("value", "true"), this.context.checked = !0), this.updateChecked();
|
|
45
|
+
}
|
|
46
|
+
get checked() {
|
|
47
|
+
const e = this.getAttribute("checked");
|
|
48
|
+
return t.includes(e) && (this.context.checked = !1), this.context.checked;
|
|
49
|
+
}
|
|
50
|
+
set checked(e) {
|
|
51
|
+
t.includes(e) ? (this.setAttribute("checked", "false"), this.context.checked = !1) : (this.setAttribute("checked", "true"), this.context.checked = !0), this.updateChecked();
|
|
52
|
+
}
|
|
53
|
+
get sheet() {
|
|
54
|
+
return s(this, "sheet");
|
|
55
|
+
}
|
|
56
|
+
set sheet(e) {
|
|
57
|
+
l(this, "sheet", e);
|
|
58
|
+
}
|
|
59
|
+
handlerExternalCss = () => {
|
|
60
|
+
i(this, this._shadowDom, "sheet", null, this.sheet);
|
|
61
|
+
};
|
|
62
|
+
updateChecked = () => {
|
|
63
|
+
const { checked: e } = this.context;
|
|
64
|
+
e ? (this.setAttribute("checked", "true"), this.setAttribute("value", "true"), h(this.container, "ran-checkbox-checked")) : (this.setAttribute("checked", "false"), this.setAttribute("value", "false"), k(this.container, "ran-checkbox-checked")), this.syncA11yAndForm();
|
|
65
|
+
};
|
|
66
|
+
syncA11yAndForm = () => {
|
|
67
|
+
const { checked: e } = this.context;
|
|
68
|
+
this.setAttribute("role", "checkbox"), this.setAttribute("aria-checked", e ? "true" : "false"), this.disabled ? (this.setAttribute("aria-disabled", "true"), this.tabIndex = -1) : (this.removeAttribute("aria-disabled"), (this.tabIndex < 0 || !this.hasAttribute("tabindex")) && (this.tabIndex = 0)), this._internals?.setFormValue?.(e ? this.getAttribute("value") || "true" : null);
|
|
69
|
+
};
|
|
70
|
+
update = () => {
|
|
71
|
+
this.updateChecked();
|
|
72
|
+
};
|
|
73
|
+
onChange = () => {
|
|
74
|
+
if (this.disabled) return;
|
|
75
|
+
const { checked: e } = this.context;
|
|
76
|
+
this.context.checked = !e, this.dispatchEvent(new CustomEvent("change", { detail: { checked: this.context.checked } })), this.update();
|
|
77
|
+
};
|
|
78
|
+
onKeydown = (e) => {
|
|
79
|
+
(e.key === " " || e.key === "Spacebar" || e.key === "Enter") && (e.preventDefault(), this.onChange());
|
|
80
|
+
};
|
|
81
|
+
connectedCallback() {
|
|
82
|
+
this.handlerExternalCss(), this._events.on(this, "click", this.onChange), this._events.on(this, "keydown", this.onKeydown), this.syncA11yAndForm();
|
|
83
|
+
}
|
|
84
|
+
disconnectedCallback() {
|
|
85
|
+
this._events.abort();
|
|
86
|
+
}
|
|
87
|
+
attributeChangedCallback(e, n, r) {
|
|
88
|
+
n !== r && (e === "checked" && (this.checked = r, this.value = r), e === "value" && (this.checked = r, this.value = r), e === "sheet" && this.handlerExternalCss());
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
v("r-checkbox", m);
|
|
92
|
+
export {
|
|
93
|
+
m as t
|
|
94
|
+
};
|
package/dist/checkbox.js
CHANGED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import { c as f, d as v, l as x, s as m, u as P, x as l } from "./utils-D4pPF77E.js";
|
|
2
|
+
import { t as w } from "./events-C59wGdni.js";
|
|
3
|
+
import { i as y, r as u } from "./signal-XHfNsQNW.js";
|
|
4
|
+
import { _ as h, h as S, i as s } from "./factory-BdsO0dEW.js";
|
|
5
|
+
import { a as A, n as $ } from "./ssr-DSGwPtEd.js";
|
|
6
|
+
import "./input-DoraIb3x.js";
|
|
7
|
+
import "./select-BmhCUTLb.js";
|
|
8
|
+
import "./popover-BCvHwLZb.js";
|
|
9
|
+
var _ = (e) => {
|
|
10
|
+
const { r, g: o, b: t } = C(e);
|
|
11
|
+
return g(r, o, t);
|
|
12
|
+
}, C = (e) => (e[0] === "#" && (e = e.substr(1)), e.length === 3 ? {
|
|
13
|
+
r: parseInt(e[0] + e[0], 16),
|
|
14
|
+
g: parseInt(e[1] + e[1], 16),
|
|
15
|
+
b: parseInt(e[2] + e[2], 16)
|
|
16
|
+
} : {
|
|
17
|
+
r: parseInt(e.substr(0, 2), 16),
|
|
18
|
+
g: parseInt(e.substr(2, 2), 16),
|
|
19
|
+
b: parseInt(e.substr(4, 2), 16)
|
|
20
|
+
}), g = (e, r, o) => {
|
|
21
|
+
let t;
|
|
22
|
+
const i = Math.max(e, r, o), a = i - Math.min(e, r, o);
|
|
23
|
+
a === 0 ? t = 0 : e === i ? t = (r - o) / a % 6 : r === i ? t = (o - e) / a + 2 : t = (e - r) / a + 4, t = Math.round(t * 60), t < 0 && (t += 360);
|
|
24
|
+
const n = Math.round((i === 0 ? 0 : a / i) * 100), c = Math.round(i / 255 * 100);
|
|
25
|
+
return {
|
|
26
|
+
h: t,
|
|
27
|
+
s: n,
|
|
28
|
+
v: c
|
|
29
|
+
};
|
|
30
|
+
}, d = (e, r, o) => {
|
|
31
|
+
r = r / 100, o = o / 100;
|
|
32
|
+
let t = [];
|
|
33
|
+
const i = o * r, a = e / 60, n = i * (1 - Math.abs(a % 2 - 1)), c = o - i;
|
|
34
|
+
return a >= 0 && a < 1 ? t = [
|
|
35
|
+
i,
|
|
36
|
+
n,
|
|
37
|
+
0
|
|
38
|
+
] : a >= 1 && a < 2 ? t = [
|
|
39
|
+
n,
|
|
40
|
+
i,
|
|
41
|
+
0
|
|
42
|
+
] : a >= 2 && a < 3 ? t = [
|
|
43
|
+
0,
|
|
44
|
+
i,
|
|
45
|
+
n
|
|
46
|
+
] : e >= 3 && a < 4 ? t = [
|
|
47
|
+
0,
|
|
48
|
+
n,
|
|
49
|
+
i
|
|
50
|
+
] : e >= 4 && a < 5 ? t = [
|
|
51
|
+
n,
|
|
52
|
+
0,
|
|
53
|
+
i
|
|
54
|
+
] : e >= 5 && a <= 6 ? t = [
|
|
55
|
+
i,
|
|
56
|
+
0,
|
|
57
|
+
n
|
|
58
|
+
] : t = [
|
|
59
|
+
0,
|
|
60
|
+
0,
|
|
61
|
+
0
|
|
62
|
+
], {
|
|
63
|
+
r: Math.round(255 * (t[0] + c)),
|
|
64
|
+
g: Math.round(255 * (t[1] + c)),
|
|
65
|
+
b: Math.round(255 * (t[2] + c))
|
|
66
|
+
};
|
|
67
|
+
}, b = (e) => {
|
|
68
|
+
const r = e.toString(16);
|
|
69
|
+
return r.length === 1 ? "0" + r : r;
|
|
70
|
+
}, k = (e, r, o) => "#" + [
|
|
71
|
+
b(e),
|
|
72
|
+
b(r),
|
|
73
|
+
b(o)
|
|
74
|
+
].join(""), I = /^#([\da-f]{6}|[\da-f]{3})$/i, E = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/, D = /^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d{1,3}(\.\d+)?)\)$/, R = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}.ran-colorpicker{box-sizing:border-box;min-width:32px;height:32px;border-radius:var(--ran-colorpicker-border-radius, var(--ran-radius-md, 8px));border:var(--ran-colorpicker-border, 1px solid var(--ran-color-border, #d9d9d9));cursor:pointer;display:inline-flex;align-items:center;justify-content:center;transition:var(--ran-colorpicker-transition, border-color .2s, box-shadow .2s);background:var(--ran-colorpicker-background, var(--ran-color-bg-elevated, #ffffff));padding:3px}.ran-colorpicker:hover{border-color:var(--ran-colorpicker-border-hover, var(--ran-color-border-hover, var(--ran-gray-500)))}.ran-colorpicker-block{position:relative;border-radius:var(--ran-colorpicker-block-border-radius, var(--ran-radius-sm, 4px));width:24px;height:24px;box-shadow:inset 0 0 0 1px var(--ran-gray-alpha-200, rgba(0, 0, 0, .09));background-image:conic-gradient(var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 25%,transparent 0 50%,var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 75%,transparent 0);background-size:50% 50%}.ran-colorpicker-inner{width:100%;height:100%;border-radius:inherit}", V = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}.ran-color-picker-inner{box-sizing:border-box}.ran-color-picker-inner-content{box-sizing:border-box;display:flex;flex-direction:column;gap:12px;width:224px;padding:12px;font-family:var(--ran-font-family, inherit)}.ran-color-picker-inner-content *,.ran-color-picker-inner-content *:before,.ran-color-picker-inner-content *:after{box-sizing:border-box}.ran-color-picker-palette{position:relative;width:100%;height:160px;border-radius:var(--ran-radius-sm, 6px);overflow:hidden;cursor:crosshair;box-shadow:inset 0 0 0 1px var(--ran-gray-alpha-200, rgba(0, 0, 0, .09));touch-action:none}.ran-color-picker-saturation{position:absolute;inset:0;border-radius:inherit;background-image:linear-gradient(to top,#000,#0000),linear-gradient(to right,#fff,#fff0)}.ran-color-picker-palette-dot{position:absolute;top:0;left:0;z-index:2;width:14px;height:14px;transform:translate(-50%,-50%);border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px #0003,0 1px 3px #00000059;pointer-events:none}.ran-color-picker-controls{display:flex;align-items:center;gap:12px}.ran-color-picker-preview{position:relative;flex:none;width:28px;height:28px;border-radius:50%;overflow:hidden;box-shadow:inset 0 0 0 1px var(--ran-gray-alpha-200, rgba(0, 0, 0, .09));background-image:conic-gradient(var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 25%,transparent 0 50%,var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 75%,transparent 0);background-size:12px 12px}.ran-color-picker-preview-inner{position:absolute;inset:0;border-radius:inherit}.ran-color-picker-sliders{flex:1;min-width:0;display:flex;flex-direction:column;gap:12px}.ran-color-picker-slider{position:relative;height:10px;border-radius:999px;cursor:pointer;box-shadow:inset 0 0 0 1px var(--ran-gray-alpha-200, rgba(0, 0, 0, .09));touch-action:none}.ran-color-picker-slider-hue{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red)}.ran-color-picker-slider-alpha{background-image:conic-gradient(var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 25%,transparent 0 50%,var(--ran-gray-alpha-100, rgba(0, 0, 0, .06)) 0 75%,transparent 0);background-size:8px 8px}.ran-color-picker-slider-alpha-track{position:absolute;inset:0;border-radius:inherit}.ran-color-picker-slider-thumb{position:absolute;top:50%;left:0;z-index:1;width:14px;height:14px;transform:translate(-50%,-50%);border-radius:50%;border:2px solid #fff;box-shadow:0 0 0 1px #0003,0 1px 3px #00000059;pointer-events:none}.ran-color-picker-input-container{display:flex;align-items:center;gap:8px}.ran-color-picker-format{flex:none;width:68px}.ran-color-picker-value{flex:1;min-width:0}", p = 360, H = class extends $ {
|
|
75
|
+
colorpicker;
|
|
76
|
+
colorpickerInner;
|
|
77
|
+
context;
|
|
78
|
+
_shadowDom;
|
|
79
|
+
_events = new w();
|
|
80
|
+
_effectDisposers = [];
|
|
81
|
+
popoverBlock;
|
|
82
|
+
popoverContent;
|
|
83
|
+
colorPickerInner;
|
|
84
|
+
colorPickerPalette;
|
|
85
|
+
colorPickerSaturation;
|
|
86
|
+
colorPickerPaletteDot;
|
|
87
|
+
colorPickerHueSlider;
|
|
88
|
+
colorPickerHueThumb;
|
|
89
|
+
colorPickerAlphaSlider;
|
|
90
|
+
colorPickerAlphaTrack;
|
|
91
|
+
colorPickerAlphaThumb;
|
|
92
|
+
colorPickerPreviewInner;
|
|
93
|
+
colorPickerValueInput;
|
|
94
|
+
colorPickerFormatSelect;
|
|
95
|
+
colorPickerPaletteSelect;
|
|
96
|
+
_activeSlider = null;
|
|
97
|
+
_format = "HEX";
|
|
98
|
+
_editingInput = !1;
|
|
99
|
+
static get observedAttributes() {
|
|
100
|
+
return [
|
|
101
|
+
"disabled",
|
|
102
|
+
"value",
|
|
103
|
+
"sheet"
|
|
104
|
+
];
|
|
105
|
+
}
|
|
106
|
+
constructor() {
|
|
107
|
+
super(), this._shadowDom = f(this, R);
|
|
108
|
+
const e = m(this._shadowDom, "r-popover", () => {
|
|
109
|
+
const r = s().class("ran-colorpicker-inner").part("swatch").build(), o = s().class("ran-colorpicker-block").part("block").children(r).build(), t = h("r-content").class("ran-content").build();
|
|
110
|
+
return h("r-popover").class("ran-popover").attr("trigger", "click").children(o, t).build();
|
|
111
|
+
});
|
|
112
|
+
this.popoverBlock = e, this.popoverContent = e.querySelector("r-content"), this.colorpicker = e.querySelector(".ran-colorpicker-block"), this.colorpickerInner = e.querySelector(".ran-colorpicker-inner"), this.colorpicker.setAttribute("role", "button"), this.colorpicker.setAttribute("tabindex", "0"), this.colorpicker.setAttribute("aria-haspopup", "dialog"), this.colorpicker.setAttribute("aria-label", "Choose color"), this.colorPickerPaletteSelect = !1, this.createContext();
|
|
113
|
+
}
|
|
114
|
+
get value() {
|
|
115
|
+
return this.context?.value.getter() || "";
|
|
116
|
+
}
|
|
117
|
+
set value(e) {
|
|
118
|
+
this.setAttribute("value", e);
|
|
119
|
+
}
|
|
120
|
+
get sheet() {
|
|
121
|
+
return x(this, "sheet");
|
|
122
|
+
}
|
|
123
|
+
set sheet(e) {
|
|
124
|
+
P(this, "sheet", e);
|
|
125
|
+
}
|
|
126
|
+
handlerExternalCss = () => {
|
|
127
|
+
v(this, this._shadowDom, "sheet", null, this.sheet);
|
|
128
|
+
};
|
|
129
|
+
createContext = () => {
|
|
130
|
+
const e = (r) => {
|
|
131
|
+
const [o, t] = y(r);
|
|
132
|
+
return {
|
|
133
|
+
getter: o,
|
|
134
|
+
setter: t
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
this.context = {
|
|
138
|
+
value: e(""),
|
|
139
|
+
disabled: e(!1),
|
|
140
|
+
hue: e(0),
|
|
141
|
+
saturation: e(0),
|
|
142
|
+
lightness: e(100),
|
|
143
|
+
transparency: e(100)
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
currentRgba = () => {
|
|
147
|
+
const { hue: e, saturation: r, lightness: o, transparency: t } = this.context, { r: i, g: a, b: n } = d(e.getter(), r.getter(), o.getter());
|
|
148
|
+
return {
|
|
149
|
+
r: i,
|
|
150
|
+
g: a,
|
|
151
|
+
b: n,
|
|
152
|
+
a: t.getter() / 100
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
currentValue = () => {
|
|
156
|
+
const { r: e, g: r, b: o, a: t } = this.currentRgba();
|
|
157
|
+
return t < 1 ? `rgba(${e}, ${r}, ${o}, ${Number(t.toFixed(2))})` : k(e, r, o);
|
|
158
|
+
};
|
|
159
|
+
currentDisplay = () => {
|
|
160
|
+
const { r: e, g: r, b: o, a: t } = this.currentRgba();
|
|
161
|
+
return this._format === "RGB" ? t < 1 ? `rgba(${e}, ${r}, ${o}, ${Number(t.toFixed(2))})` : `rgb(${e}, ${r}, ${o})` : k(e, r, o);
|
|
162
|
+
};
|
|
163
|
+
updateColorValue = (e) => {
|
|
164
|
+
if (e === this.context?.value.getter()) return;
|
|
165
|
+
const r = e.replace(/\s+/g, ""), o = I.exec(e), t = D.exec(r), i = E.exec(r);
|
|
166
|
+
if (o) {
|
|
167
|
+
const { h: a, s: n, v: c } = _(o[0]);
|
|
168
|
+
this.context.hue.setter(a), this.context.saturation.setter(n), this.context.lightness.setter(c), this.context.transparency.setter(100);
|
|
169
|
+
} else if (t) {
|
|
170
|
+
const { h: a, s: n, v: c } = g(Number(t[1]), Number(t[2]), Number(t[3]));
|
|
171
|
+
this.context.hue.setter(a), this.context.saturation.setter(n), this.context.lightness.setter(c), this.context.transparency.setter(Number(t[4]) * 100);
|
|
172
|
+
} else if (i) {
|
|
173
|
+
const { h: a, s: n, v: c } = g(Number(i[1]), Number(i[2]), Number(i[3]));
|
|
174
|
+
this.context.hue.setter(a), this.context.saturation.setter(n), this.context.lightness.setter(c), this.context.transparency.setter(100);
|
|
175
|
+
} else return;
|
|
176
|
+
this.setAttribute("value", e), this.context?.value.setter(e);
|
|
177
|
+
};
|
|
178
|
+
emitChange = () => {
|
|
179
|
+
const e = this.currentValue(), { r, g: o, b: t, a: i } = this.currentRgba();
|
|
180
|
+
this.context?.value.setter(e), this.setAttribute("value", e), this.dispatchEvent(new CustomEvent("change", {
|
|
181
|
+
detail: {
|
|
182
|
+
value: e,
|
|
183
|
+
hex: k(r, o, t),
|
|
184
|
+
rgb: `rgb(${r}, ${o}, ${t})`,
|
|
185
|
+
rgba: `rgba(${r}, ${o}, ${t}, ${Number(i.toFixed(2))})`,
|
|
186
|
+
alpha: Number(i.toFixed(2))
|
|
187
|
+
},
|
|
188
|
+
bubbles: !0,
|
|
189
|
+
composed: !0
|
|
190
|
+
}));
|
|
191
|
+
};
|
|
192
|
+
palettePointerDown = (e) => {
|
|
193
|
+
e.preventDefault(), this.colorPickerPaletteSelect = !0, this.updatePaletteFromEvent(e);
|
|
194
|
+
};
|
|
195
|
+
updatePaletteFromEvent = (e) => {
|
|
196
|
+
if (!this.colorPickerPalette) return;
|
|
197
|
+
const { left: r, top: o, width: t, height: i } = this.colorPickerPalette.getBoundingClientRect();
|
|
198
|
+
if (!t || !i) return;
|
|
199
|
+
const a = l(e.clientX - r, 0, t), n = l(e.clientY - o, 0, i);
|
|
200
|
+
this.context.saturation.setter(a / t * 100), this.context.lightness.setter((1 - n / i) * 100), this.emitChange();
|
|
201
|
+
};
|
|
202
|
+
sliderPointerDown = (e) => (r) => {
|
|
203
|
+
r.preventDefault(), this._activeSlider = e, this.updateSliderFromEvent(e, r);
|
|
204
|
+
};
|
|
205
|
+
updateSliderFromEvent = (e, r) => {
|
|
206
|
+
const o = e === "hue" ? this.colorPickerHueSlider : this.colorPickerAlphaSlider;
|
|
207
|
+
if (!o) return;
|
|
208
|
+
const { left: t, width: i } = o.getBoundingClientRect();
|
|
209
|
+
if (!i) return;
|
|
210
|
+
const a = l(r.clientX - t, 0, i) / i;
|
|
211
|
+
e === "hue" ? this.context.hue.setter(a * p) : this.context.transparency.setter(a * 100), this.emitChange();
|
|
212
|
+
};
|
|
213
|
+
onPointerMove = (e) => {
|
|
214
|
+
const r = e;
|
|
215
|
+
this.colorPickerPaletteSelect ? this.updatePaletteFromEvent(r) : this._activeSlider && this.updateSliderFromEvent(this._activeSlider, r);
|
|
216
|
+
};
|
|
217
|
+
initSliderA11y = (e, r, o) => {
|
|
218
|
+
e.setAttribute("role", "slider"), e.setAttribute("tabindex", "0"), e.setAttribute("aria-label", r), e.setAttribute("aria-orientation", "horizontal"), e.setAttribute("aria-valuemin", "0"), e.setAttribute("aria-valuemax", String(o));
|
|
219
|
+
};
|
|
220
|
+
sliderKeydown = (e) => (r) => {
|
|
221
|
+
const o = e === "hue" ? p : 100, t = e === "hue" ? this.context.hue : this.context.transparency, i = r.shiftKey ? 10 : 1, a = t.getter();
|
|
222
|
+
let n = a;
|
|
223
|
+
switch (r.key) {
|
|
224
|
+
case "ArrowRight":
|
|
225
|
+
case "ArrowUp":
|
|
226
|
+
n = a + i;
|
|
227
|
+
break;
|
|
228
|
+
case "ArrowLeft":
|
|
229
|
+
case "ArrowDown":
|
|
230
|
+
n = a - i;
|
|
231
|
+
break;
|
|
232
|
+
case "Home":
|
|
233
|
+
n = 0;
|
|
234
|
+
break;
|
|
235
|
+
case "End":
|
|
236
|
+
n = o;
|
|
237
|
+
break;
|
|
238
|
+
default:
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
r.preventDefault(), t.setter(l(n, 0, o)), this.emitChange();
|
|
242
|
+
};
|
|
243
|
+
onPointerUp = () => {
|
|
244
|
+
this.colorPickerPaletteSelect = !1, this._activeSlider = null;
|
|
245
|
+
};
|
|
246
|
+
onSwatchKeydown = (e) => {
|
|
247
|
+
(e.key === "Enter" || e.key === " " || e.key === "Spacebar") && (e.preventDefault(), this.colorpicker?.click());
|
|
248
|
+
};
|
|
249
|
+
onValueInput = (e) => {
|
|
250
|
+
const r = e.target, o = e.detail?.value ?? r?.value;
|
|
251
|
+
typeof o == "string" && (this._editingInput = !0, this.updateColorValue(o.trim()), this._editingInput = !1, this.emitChange());
|
|
252
|
+
};
|
|
253
|
+
onFormatChange = (e) => {
|
|
254
|
+
const r = e.detail?.value;
|
|
255
|
+
this._format = r === "RGB" ? "RGB" : "HEX", this.syncValueInput();
|
|
256
|
+
};
|
|
257
|
+
syncValueInput = () => {
|
|
258
|
+
this._editingInput || !this.colorPickerValueInput || (this.colorPickerValueInput.value = this.currentDisplay());
|
|
259
|
+
};
|
|
260
|
+
setupEffects = () => {
|
|
261
|
+
this._effectDisposers.push(u(() => {
|
|
262
|
+
const { r: e, g: r, b: o } = d(this.context.hue.getter(), 100, 100);
|
|
263
|
+
this.colorPickerSaturation?.style.setProperty("background-color", `rgb(${e}, ${r}, ${o})`);
|
|
264
|
+
}), u(() => {
|
|
265
|
+
const e = l(this.context.saturation.getter(), 0, 100), r = l(this.context.lightness.getter(), 0, 100);
|
|
266
|
+
this.colorPickerPaletteDot?.style.setProperty("left", `${e}%`), this.colorPickerPaletteDot?.style.setProperty("top", `${100 - r}%`);
|
|
267
|
+
}), u(() => {
|
|
268
|
+
const e = this.context.hue.getter(), { r, g: o, b: t } = d(e, 100, 100);
|
|
269
|
+
this.colorPickerHueThumb?.style.setProperty("left", `${e / p * 100}%`), this.colorPickerHueThumb?.style.setProperty("background", `rgb(${r}, ${o}, ${t})`), this.colorPickerHueSlider?.setAttribute("aria-valuenow", String(Math.round(e)));
|
|
270
|
+
}), u(() => {
|
|
271
|
+
const { r: e, g: r, b: o, a: t } = this.currentRgba(), i = `rgb(${e}, ${r}, ${o})`, a = `rgba(${e}, ${r}, ${o}, ${Number(t.toFixed(3))})`;
|
|
272
|
+
this.colorPickerAlphaTrack?.style.setProperty("background", `linear-gradient(to right, rgba(${e}, ${r}, ${o}, 0), ${i})`), this.colorPickerAlphaThumb?.style.setProperty("left", `${t * 100}%`), this.colorPickerAlphaThumb?.style.setProperty("background", a), this.colorPickerPreviewInner?.style.setProperty("background", a), this.colorpickerInner?.style.setProperty("background", a), this.colorPickerAlphaSlider?.setAttribute("aria-valuenow", String(Math.round(t * 100))), this.colorPickerAlphaSlider?.setAttribute("aria-valuetext", `${Math.round(t * 100)}%`), this.syncValueInput();
|
|
273
|
+
}));
|
|
274
|
+
};
|
|
275
|
+
disposeEffects = () => {
|
|
276
|
+
for (const e of this._effectDisposers) e();
|
|
277
|
+
this._effectDisposers = [];
|
|
278
|
+
};
|
|
279
|
+
openColorPicker = () => {
|
|
280
|
+
if (this.colorPickerInner) return;
|
|
281
|
+
this.colorPickerSaturation = s().class("ran-color-picker-saturation").build(), this.colorPickerPaletteDot = s().class("ran-color-picker-palette-dot").build(), this.colorPickerPalette = s().class("ran-color-picker-palette").on("mousedown", this.palettePointerDown).children(this.colorPickerSaturation, this.colorPickerPaletteDot).build(), this.colorPickerPreviewInner = s().class("ran-color-picker-preview-inner").build();
|
|
282
|
+
const e = s().class("ran-color-picker-preview").children(this.colorPickerPreviewInner).build();
|
|
283
|
+
this.colorPickerHueThumb = s().class("ran-color-picker-slider-thumb").build(), this.colorPickerHueSlider = s().class("ran-color-picker-slider ran-color-picker-slider-hue").on("mousedown", this.sliderPointerDown("hue")).on("keydown", this.sliderKeydown("hue")).children(this.colorPickerHueThumb).build(), this.initSliderA11y(this.colorPickerHueSlider, "Hue", p), this.colorPickerAlphaTrack = s().class("ran-color-picker-slider-alpha-track").build(), this.colorPickerAlphaThumb = s().class("ran-color-picker-slider-thumb").build(), this.colorPickerAlphaSlider = s().class("ran-color-picker-slider ran-color-picker-slider-alpha").on("mousedown", this.sliderPointerDown("alpha")).on("keydown", this.sliderKeydown("alpha")).children(this.colorPickerAlphaTrack, this.colorPickerAlphaThumb).build(), this.initSliderA11y(this.colorPickerAlphaSlider, "Alpha opacity", 100);
|
|
284
|
+
const r = s().class("ran-color-picker-sliders").children(this.colorPickerHueSlider, this.colorPickerAlphaSlider).build(), o = s().class("ran-color-picker-controls").children(e, r).build();
|
|
285
|
+
this.colorPickerFormatSelect = h("r-select").class("ran-color-picker-format").attr("value", this._format).attr("defaultValue", this._format).attr("trigger", "click").children(...["HEX", "RGB"].map((a) => h("r-option").attr("value", a).text(a).build())).on("change", this.onFormatChange).build(), this.colorPickerValueInput = h("r-input").class("ran-color-picker-value").on("change", this.onValueInput).build();
|
|
286
|
+
const t = s().class("ran-color-picker-input-container").children(this.colorPickerFormatSelect, this.colorPickerValueInput).build(), i = s().class("ran-color-picker-inner-content").children(this.colorPickerPalette, o, t).build();
|
|
287
|
+
this.colorPickerInner = s().class("ran-color-picker-inner").children(S().text(V).build(), i).build(), this.popoverContent.appendChild(this.colorPickerInner), this.setupEffects(), this.syncValueInput();
|
|
288
|
+
};
|
|
289
|
+
connectedCallback() {
|
|
290
|
+
this.handlerExternalCss(), this.setAttribute("class", "ran-colorpicker"), this._events.on(this.popoverBlock, "click", this.openColorPicker), this._events.on(this.colorpicker, "keydown", this.onSwatchKeydown), this._events.on(document, "mousemove", this.onPointerMove), this._events.on(document, "mouseup", this.onPointerUp), this.value && this.updateColorValue(this.value);
|
|
291
|
+
}
|
|
292
|
+
disconnectedCallback() {
|
|
293
|
+
this._events.abort(), this.disposeEffects();
|
|
294
|
+
}
|
|
295
|
+
attributeChangedCallback(e, r, o) {
|
|
296
|
+
r !== o && (e === "value" && this.updateColorValue(o), e === "sheet" && this.handlerExternalCss());
|
|
297
|
+
}
|
|
298
|
+
};
|
|
299
|
+
A("r-colorpicker", H);
|
|
300
|
+
export {
|
|
301
|
+
H as t
|
|
302
|
+
};
|
package/dist/colorpicker.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./index-DC5EA657.js";
|
|
3
|
-
import { C, a } from "./index-oD-_YELB.js";
|
|
4
|
-
import "./index-TlwIh-o2.js";
|
|
5
|
-
import "./index-WfFw4LJT.js";
|
|
6
|
-
import "./selectShadowless.js";
|
|
7
|
-
import "./index-lLO-8KJ1.js";
|
|
1
|
+
import { t as r } from "./colorpicker-Ch67dWa_.js";
|
|
8
2
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
r as ColorPicker,
|
|
4
|
+
r as default
|
|
11
5
|
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { RanElement } from '@/utils/index';
|
|
2
|
+
import { EventManager } from '@/utils/builder';
|
|
3
|
+
export declare class Button extends RanElement {
|
|
4
|
+
_btn: HTMLDivElement;
|
|
5
|
+
_btnContent: HTMLDivElement;
|
|
6
|
+
_iconElement?: HTMLElement;
|
|
7
|
+
_slot: HTMLSlotElement;
|
|
8
|
+
_shadowDom: ShadowRoot;
|
|
9
|
+
_events: EventManager;
|
|
10
|
+
debounceTimeId?: NodeJS.Timeout;
|
|
11
|
+
static get observedAttributes(): string[];
|
|
12
|
+
constructor();
|
|
13
|
+
get sheet(): string;
|
|
14
|
+
set sheet(value: string);
|
|
15
|
+
get disabled(): boolean | string;
|
|
16
|
+
set disabled(value: boolean | string | undefined | null);
|
|
17
|
+
get iconSize(): string;
|
|
18
|
+
set iconSize(value: string | undefined | null);
|
|
19
|
+
get icon(): string;
|
|
20
|
+
set icon(value: string | null);
|
|
21
|
+
get effect(): string;
|
|
22
|
+
set effect(value: string | null);
|
|
23
|
+
/** Visual variant: `''` (default) | `'primary'` | `'warning'` | `'text'`. Drives the `:host([type=...])` styles. */
|
|
24
|
+
get type(): string;
|
|
25
|
+
set type(value: string | null);
|
|
26
|
+
/**
|
|
27
|
+
* @description: 设置 button 的 icon
|
|
28
|
+
*/
|
|
29
|
+
setIcon: () => void;
|
|
30
|
+
mousedown: (event: MouseEvent) => void;
|
|
31
|
+
mouseup: () => void;
|
|
32
|
+
keydown: (event: KeyboardEvent) => void;
|
|
33
|
+
debounceMouseEvent: () => void;
|
|
34
|
+
handlerExternalCss: () => void;
|
|
35
|
+
syncA11yState: () => void;
|
|
36
|
+
connectedCallback(): void;
|
|
37
|
+
/**
|
|
38
|
+
* @description: FIX: 修正拼写错误 disconnectCallback -> disconnectedCallback
|
|
39
|
+
* 确保组件销毁时正确移除事件监听,彻底杜绝内存泄漏。
|
|
40
|
+
*/
|
|
41
|
+
disconnectedCallback(): void;
|
|
42
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
43
|
+
}
|
|
44
|
+
export default Button;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RanElement } from '@/utils/index';
|
|
2
|
+
export declare class Card extends RanElement {
|
|
3
|
+
_shadowDom: ShadowRoot;
|
|
4
|
+
_titleEl: HTMLElement;
|
|
5
|
+
_descriptionEl: HTMLElement;
|
|
6
|
+
_headerEl: HTMLElement;
|
|
7
|
+
_footerEl: HTMLElement;
|
|
8
|
+
static get observedAttributes(): string[];
|
|
9
|
+
constructor();
|
|
10
|
+
get title(): string;
|
|
11
|
+
set title(value: string);
|
|
12
|
+
get description(): string;
|
|
13
|
+
set description(value: string);
|
|
14
|
+
get sheet(): string;
|
|
15
|
+
set sheet(value: string);
|
|
16
|
+
private _syncTitle;
|
|
17
|
+
private _syncDescription;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
20
|
+
}
|
|
21
|
+
export default Card;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { RanElement } from '@/utils/index';
|
|
2
|
+
import { EventManager } from '@/utils/builder';
|
|
3
|
+
export interface Context {
|
|
4
|
+
checked: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare class Checkbox extends RanElement {
|
|
7
|
+
static formAssociated: boolean;
|
|
8
|
+
_events: EventManager;
|
|
9
|
+
_internals?: ElementInternals;
|
|
10
|
+
checkInput: HTMLInputElement;
|
|
11
|
+
checkInner: HTMLSpanElement;
|
|
12
|
+
context: Context;
|
|
13
|
+
container: HTMLElement;
|
|
14
|
+
_shadowDom: ShadowRoot;
|
|
15
|
+
static get observedAttributes(): string[];
|
|
16
|
+
constructor();
|
|
17
|
+
get disabled(): boolean;
|
|
18
|
+
set disabled(value: boolean | string);
|
|
19
|
+
get value(): string;
|
|
20
|
+
set value(value: string);
|
|
21
|
+
get checked(): boolean;
|
|
22
|
+
set checked(value: boolean | string);
|
|
23
|
+
get sheet(): string;
|
|
24
|
+
set sheet(value: string);
|
|
25
|
+
handlerExternalCss: () => void;
|
|
26
|
+
updateChecked: () => void;
|
|
27
|
+
syncA11yAndForm: () => void;
|
|
28
|
+
update: () => void;
|
|
29
|
+
onChange: () => void;
|
|
30
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
31
|
+
connectedCallback(): void;
|
|
32
|
+
disconnectedCallback(): void;
|
|
33
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
34
|
+
}
|
|
35
|
+
export default Checkbox;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { RanElement } from '@/utils/index';
|
|
2
|
+
import { EventManager } from '@/utils/builder';
|
|
3
|
+
import '@/components/popover';
|
|
4
|
+
import '@/components/input';
|
|
5
|
+
import '@/components/select';
|
|
6
|
+
export interface Context {
|
|
7
|
+
disabled: Signal<boolean>;
|
|
8
|
+
value: Signal<string>;
|
|
9
|
+
hue: Signal<number>;
|
|
10
|
+
saturation: Signal<number>;
|
|
11
|
+
lightness: Signal<number>;
|
|
12
|
+
transparency: Signal<number>;
|
|
13
|
+
}
|
|
14
|
+
export interface RGBA {
|
|
15
|
+
r: number;
|
|
16
|
+
g: number;
|
|
17
|
+
b: number;
|
|
18
|
+
a: number;
|
|
19
|
+
}
|
|
20
|
+
export interface Signal<T> {
|
|
21
|
+
getter: () => T;
|
|
22
|
+
setter: (newValue: T | ((prev: T) => T)) => void;
|
|
23
|
+
}
|
|
24
|
+
type ColorFormat = 'HEX' | 'RGB';
|
|
25
|
+
export declare class ColorPicker extends RanElement {
|
|
26
|
+
colorpicker: HTMLDivElement;
|
|
27
|
+
colorpickerInner: HTMLDivElement;
|
|
28
|
+
context: Context;
|
|
29
|
+
_shadowDom: ShadowRoot;
|
|
30
|
+
_events: EventManager;
|
|
31
|
+
_effectDisposers: Array<() => void>;
|
|
32
|
+
popoverBlock: HTMLElement;
|
|
33
|
+
popoverContent: HTMLElement;
|
|
34
|
+
colorPickerInner?: HTMLDivElement;
|
|
35
|
+
colorPickerPalette?: HTMLElement;
|
|
36
|
+
colorPickerSaturation?: HTMLElement;
|
|
37
|
+
colorPickerPaletteDot?: HTMLElement;
|
|
38
|
+
colorPickerHueSlider?: HTMLElement;
|
|
39
|
+
colorPickerHueThumb?: HTMLElement;
|
|
40
|
+
colorPickerAlphaSlider?: HTMLElement;
|
|
41
|
+
colorPickerAlphaTrack?: HTMLElement;
|
|
42
|
+
colorPickerAlphaThumb?: HTMLElement;
|
|
43
|
+
colorPickerPreviewInner?: HTMLElement;
|
|
44
|
+
colorPickerValueInput?: HTMLElement;
|
|
45
|
+
colorPickerFormatSelect?: HTMLElement;
|
|
46
|
+
colorPickerPaletteSelect: boolean;
|
|
47
|
+
_activeSlider: 'hue' | 'alpha' | null;
|
|
48
|
+
_format: ColorFormat;
|
|
49
|
+
_editingInput: boolean;
|
|
50
|
+
static get observedAttributes(): string[];
|
|
51
|
+
constructor();
|
|
52
|
+
get value(): string;
|
|
53
|
+
set value(value: string);
|
|
54
|
+
get sheet(): string;
|
|
55
|
+
set sheet(value: string);
|
|
56
|
+
handlerExternalCss: () => void;
|
|
57
|
+
createContext: () => void;
|
|
58
|
+
currentRgba: () => RGBA;
|
|
59
|
+
/** Canonical string used for the `value` attribute and `change` events. */
|
|
60
|
+
currentValue: () => string;
|
|
61
|
+
/** String shown in the value input, depending on the selected format. */
|
|
62
|
+
currentDisplay: () => string;
|
|
63
|
+
updateColorValue: (value: string) => void;
|
|
64
|
+
/** Sync the `value` attribute to the live color and emit a `change` event. */
|
|
65
|
+
emitChange: () => void;
|
|
66
|
+
palettePointerDown: (e: MouseEvent) => void;
|
|
67
|
+
updatePaletteFromEvent: (e: MouseEvent) => void;
|
|
68
|
+
sliderPointerDown: (kind: "hue" | "alpha") => (e: MouseEvent) => void;
|
|
69
|
+
updateSliderFromEvent: (kind: "hue" | "alpha", e: MouseEvent) => void;
|
|
70
|
+
onPointerMove: (e: Event) => void;
|
|
71
|
+
/** Make a slider a focusable, described `role="slider"`; valuenow is kept live in setupEffects. */
|
|
72
|
+
initSliderA11y: (el: HTMLElement, label: string, max: number) => void;
|
|
73
|
+
/** Arrow keys adjust the hue/alpha slider (Shift = coarse step, Home/End = ends). */
|
|
74
|
+
sliderKeydown: (kind: "hue" | "alpha") => (e: KeyboardEvent) => void;
|
|
75
|
+
onPointerUp: () => void;
|
|
76
|
+
/** Open the picker from the keyboard: Enter/Space act like a click on the swatch. */
|
|
77
|
+
onSwatchKeydown: (e: KeyboardEvent) => void;
|
|
78
|
+
onValueInput: (e: Event) => void;
|
|
79
|
+
onFormatChange: (e: Event) => void;
|
|
80
|
+
syncValueInput: () => void;
|
|
81
|
+
setupEffects: () => void;
|
|
82
|
+
disposeEffects: () => void;
|
|
83
|
+
openColorPicker: () => void;
|
|
84
|
+
connectedCallback(): void;
|
|
85
|
+
disconnectedCallback(): void;
|
|
86
|
+
attributeChangedCallback(name: string, old: string, next: string): void;
|
|
87
|
+
}
|
|
88
|
+
export default ColorPicker;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RanElement } from '@/utils/index';
|
|
2
|
+
export declare enum ARROW_TYPE {
|
|
3
|
+
TOP = "top",
|
|
4
|
+
BOTTOM = "bottom",
|
|
5
|
+
LEFT = "left",
|
|
6
|
+
RIGHT = "right"
|
|
7
|
+
}
|
|
8
|
+
export declare class Dropdown extends RanElement {
|
|
9
|
+
dropdown: HTMLElement;
|
|
10
|
+
_slot: HTMLSlotElement;
|
|
11
|
+
_shadowDom: ShadowRoot;
|
|
12
|
+
arrowIcon?: HTMLElement;
|
|
13
|
+
container: HTMLElement;
|
|
14
|
+
static get observedAttributes(): string[];
|
|
15
|
+
constructor();
|
|
16
|
+
get transit(): string;
|
|
17
|
+
set transit(value: string);
|
|
18
|
+
get arrow(): string;
|
|
19
|
+
set arrow(value: string);
|
|
20
|
+
get show(): string;
|
|
21
|
+
set show(value: string);
|
|
22
|
+
get sheet(): string;
|
|
23
|
+
set sheet(value: string);
|
|
24
|
+
handlerExternalCss: () => void;
|
|
25
|
+
handlerTransit: () => void;
|
|
26
|
+
handlerArrow: () => void;
|
|
27
|
+
stopPropagation: (e: Event) => void;
|
|
28
|
+
connectedCallback(): void;
|
|
29
|
+
disconnectedCallback(): void;
|
|
30
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
31
|
+
}
|
|
32
|
+
export default Dropdown;
|