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
package/dist/index-CILRcFIV.js
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { a as addClassToElement, r as removeClassToElement } from "./arrow-down-Beig7FXI.js";
|
|
5
|
-
import { H as HTMLElementSSR, f as falseList, c as createCustomError } from "./index-DC5EA657.js";
|
|
6
|
-
class Checkbox extends HTMLElementSSR() {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
__publicField(this, "checkInput");
|
|
10
|
-
__publicField(this, "checkInner");
|
|
11
|
-
__publicField(this, "context");
|
|
12
|
-
__publicField(this, "updateChecked", () => {
|
|
13
|
-
const { checked } = this.context;
|
|
14
|
-
if (checked) {
|
|
15
|
-
addClassToElement(this, "ran-checkbox-checked");
|
|
16
|
-
} else {
|
|
17
|
-
removeClassToElement(this, "ran-checkbox-checked");
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
__publicField(this, "update", () => {
|
|
21
|
-
this.updateChecked();
|
|
22
|
-
});
|
|
23
|
-
__publicField(this, "onChange", () => {
|
|
24
|
-
const { checked } = this.context;
|
|
25
|
-
this.context.checked = !checked;
|
|
26
|
-
this.dispatchEvent(
|
|
27
|
-
new CustomEvent("change", {
|
|
28
|
-
detail: {
|
|
29
|
-
checked: this.context.checked
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
);
|
|
33
|
-
this.update();
|
|
34
|
-
});
|
|
35
|
-
this.checkInput = document.createElement("input");
|
|
36
|
-
this.checkInput.setAttribute("class", "ran-checkbox-input");
|
|
37
|
-
this.checkInput.setAttribute("type", "checkbox");
|
|
38
|
-
this.checkInner = document.createElement("span");
|
|
39
|
-
this.checkInner.setAttribute("class", "ran-checkbox-inner");
|
|
40
|
-
this.context = {
|
|
41
|
-
checked: false
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
static get observedAttributes() {
|
|
45
|
-
return ["disabled", "checked"];
|
|
46
|
-
}
|
|
47
|
-
get disabled() {
|
|
48
|
-
return this.getAttribute("disabled") || "";
|
|
49
|
-
}
|
|
50
|
-
set disabled(value) {
|
|
51
|
-
this.setAttribute("disabled", value);
|
|
52
|
-
}
|
|
53
|
-
get checked() {
|
|
54
|
-
const checked = this.getAttribute("checked");
|
|
55
|
-
if (falseList.includes(checked)) {
|
|
56
|
-
this.context.checked = false;
|
|
57
|
-
}
|
|
58
|
-
return `${this.context.checked}`;
|
|
59
|
-
}
|
|
60
|
-
set checked(value) {
|
|
61
|
-
if (falseList.includes(value)) {
|
|
62
|
-
this.setAttribute("checked", "false");
|
|
63
|
-
this.context.checked = false;
|
|
64
|
-
} else {
|
|
65
|
-
this.setAttribute("checked", "true");
|
|
66
|
-
this.context.checked = true;
|
|
67
|
-
}
|
|
68
|
-
this.updateChecked();
|
|
69
|
-
}
|
|
70
|
-
connectedCallback() {
|
|
71
|
-
this.setAttribute("class", "ran-checkbox");
|
|
72
|
-
this.appendChild(this.checkInput);
|
|
73
|
-
this.appendChild(this.checkInner);
|
|
74
|
-
this.addEventListener("click", this.onChange);
|
|
75
|
-
}
|
|
76
|
-
disconnectCallback() {
|
|
77
|
-
this.removeEventListener("click", this.onChange);
|
|
78
|
-
}
|
|
79
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function Custom() {
|
|
83
|
-
if (typeof document !== "undefined" && !customElements.get("r-checkbox")) {
|
|
84
|
-
customElements.define("r-checkbox", Checkbox);
|
|
85
|
-
return Checkbox;
|
|
86
|
-
} else {
|
|
87
|
-
return createCustomError("document is undefined or r-checkbox is exist");
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const index = Custom();
|
|
91
|
-
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
92
|
-
__proto__: null,
|
|
93
|
-
Checkbox,
|
|
94
|
-
default: index
|
|
95
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
96
|
-
export {
|
|
97
|
-
Checkbox as C,
|
|
98
|
-
index as a,
|
|
99
|
-
index$1 as i
|
|
100
|
-
};
|
package/dist/index-CQTJoWhb.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
function Custom() {
|
|
2
|
-
if (typeof window !== "undefined" && !customElements.get("r-modal")) {
|
|
3
|
-
class CustomModal extends HTMLElement {
|
|
4
|
-
constructor() {
|
|
5
|
-
super();
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
customElements.define("r-modal", CustomModal);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
const index = Custom();
|
|
12
|
-
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
13
|
-
__proto__: null,
|
|
14
|
-
default: index
|
|
15
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
16
|
-
export {
|
|
17
|
-
index as a,
|
|
18
|
-
index$1 as i
|
|
19
|
-
};
|
package/dist/index-CWNtaUwu.js
DELETED
|
@@ -1,308 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { d as createDocumentFragment, a as addClassToElement } from "./arrow-down-Beig7FXI.js";
|
|
5
|
-
import { i as isDisabled, r as removeClassToElementChild } from "./index-DC5EA657.js";
|
|
6
|
-
const f7170ee498e0dd32cbdcb63fba8f75cc = '.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-tab ::slotted(r-tab){box-sizing:border-box;width:100%;height:100%;padding:10px;flex-shrink:0;overflow:auto;text-align:start}.ran-tab-header{position:relative;overflow:hidden;scroll-behavior:smooth}.ran-tab-header-nav{display:flex;flex-flow:row nowrap;justify-content:flex-start;align-items:center}.ran-tab-header-nav::-webkit-scrollbar{display:none}.ran-tab-header-nav-item{flex-shrink:0}.ran-tab-header-nav .active{color:var(--active-color, #1890ff)}.ran-tab-header-line{position:absolute;width:0;margin-top:-2px;height:2px;border-radius:2px;background:var(--line-color, #1890ff);transition:.2s}.ran-tab-content{overflow:hidden}.ran-tab-content-wrap{display:flex;width:100%;height:100%;transition:.2s}:host([type="line"]) .ran-tab-header-nav-item{border:solid 1px transparent}:host([type="line"]) .ran-tab-header-nav .active{color:var(--line-color, #1890ff);border:solid 1px transparent;border-color:var(--border-color, rgba(0, 0, 0, .2)) var(--border-color, rgba(0, 0, 0, .2)) transparent;border-radius:var(--border-radius, .25em) var(--border-radius, .25em) 0 0}:host([type="line"]) .ran-tab-header-line{transition:none;visibility:hidden}:host([type="line"]) .ran-tab-header-line:after,:host([type="line"]) .ran-tab-header-line:before{content:"";position:absolute;visibility:visible;width:9999px;height:1px;bottom:0;background:var(--border-color, rgba(0, 0, 0, .2))}:host([type="line"]) .ran-tab-header-line:after{left:100%}:host([type="line"]) .ran-tab-header-line:before{right:100%}:host([align="center"]) .ran-tab-header-nav{justify-content:center}:host([align="center"]) .ran-tab-header-line{left:50%}:host([align="end"]) .ran-tab-header-nav{justify-content:flex-end}';
|
|
7
|
-
function CustomElement() {
|
|
8
|
-
if (typeof window !== "undefined" && !customElements.get("r-tabs")) {
|
|
9
|
-
class Tabs extends HTMLElement {
|
|
10
|
-
constructor() {
|
|
11
|
-
super();
|
|
12
|
-
__publicField(this, "_container");
|
|
13
|
-
__publicField(this, "_header");
|
|
14
|
-
__publicField(this, "_nav");
|
|
15
|
-
__publicField(this, "_line");
|
|
16
|
-
__publicField(this, "_content");
|
|
17
|
-
__publicField(this, "_wrap");
|
|
18
|
-
__publicField(this, "_slot");
|
|
19
|
-
__publicField(this, "tabHeaderKeyMapIndex");
|
|
20
|
-
/**
|
|
21
|
-
* @description: 构建 tabPane 组件 key 值和 index 的映射,同时判断一个 tabs 下的 tabPane key 值不能重复
|
|
22
|
-
* @param {string} key
|
|
23
|
-
* @param {number} index
|
|
24
|
-
*/
|
|
25
|
-
__publicField(this, "initTabHeaderKeyMapIndex", (key, index2) => {
|
|
26
|
-
const value = this.tabHeaderKeyMapIndex[key];
|
|
27
|
-
if (value) {
|
|
28
|
-
throw new Error("tab 组件的 key 值存在重复,或者某个 tab 组件缺少 key 属性");
|
|
29
|
-
} else {
|
|
30
|
-
this.tabHeaderKeyMapIndex[key] = index2;
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
/**
|
|
34
|
-
* @description: 初始化 tabLine 的位置,主要是当 tabs 的 align 属性为 center 时需要处理
|
|
35
|
-
*/
|
|
36
|
-
__publicField(this, "initTabLineAlignCenter", () => {
|
|
37
|
-
const { length } = this._nav.children;
|
|
38
|
-
let left = 0;
|
|
39
|
-
for (let i = 0; i < length; i++) {
|
|
40
|
-
const { width = 0 } = this._nav.children[i].getBoundingClientRect();
|
|
41
|
-
left += width;
|
|
42
|
-
}
|
|
43
|
-
this._line.style.setProperty("left", `calc(50% - ${left / 2}px)`);
|
|
44
|
-
});
|
|
45
|
-
/**
|
|
46
|
-
* @description: 初始化tabLine的位置,主要是当tabs的align属性为end时需要处理
|
|
47
|
-
*/
|
|
48
|
-
__publicField(this, "initTabLineAlignEnd", () => {
|
|
49
|
-
const { length } = this._nav.children;
|
|
50
|
-
let left = 0;
|
|
51
|
-
for (let i = 0; i < length; i++) {
|
|
52
|
-
const { width = 0 } = this._nav.children[i].getBoundingClientRect();
|
|
53
|
-
left += width;
|
|
54
|
-
}
|
|
55
|
-
this._line.style.setProperty("left", `calc(100% - ${left}px)`);
|
|
56
|
-
});
|
|
57
|
-
/**
|
|
58
|
-
* @description: 通过key值设置tabLine的位置
|
|
59
|
-
* @param {string} key
|
|
60
|
-
*/
|
|
61
|
-
__publicField(this, "setTabLine", (key) => {
|
|
62
|
-
if (key) {
|
|
63
|
-
const index2 = this.tabHeaderKeyMapIndex[key];
|
|
64
|
-
const TabHeader = this._nav.children[index2];
|
|
65
|
-
const { width = 0 } = TabHeader.getBoundingClientRect();
|
|
66
|
-
this._line.style.setProperty("width", `${width}px`);
|
|
67
|
-
let distance = 0;
|
|
68
|
-
for (let i = 0; i < index2; i++) {
|
|
69
|
-
const item = this._nav.children[i];
|
|
70
|
-
const { width: width2 = 0 } = item.getBoundingClientRect();
|
|
71
|
-
distance += width2;
|
|
72
|
-
}
|
|
73
|
-
this._line.style.setProperty("transform", `translateX(${distance}px)`);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
/**
|
|
77
|
-
* @description: 通过传入的key值设置tabContent
|
|
78
|
-
*/
|
|
79
|
-
__publicField(this, "setTabContent", (key) => {
|
|
80
|
-
if (key) {
|
|
81
|
-
const index2 = this.tabHeaderKeyMapIndex[key];
|
|
82
|
-
this._wrap.style.setProperty("transform", `translateX(${index2 * -100}%)`);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
/**
|
|
86
|
-
* @description: 根据点击设置 tabLine 的位置
|
|
87
|
-
* @param {Event} e
|
|
88
|
-
* @param {number} index
|
|
89
|
-
* @param {number} width
|
|
90
|
-
*/
|
|
91
|
-
__publicField(this, "clickTabHead", (e) => {
|
|
92
|
-
const tabHeader = e.target;
|
|
93
|
-
const key = tabHeader.getAttribute("r-key");
|
|
94
|
-
const disabled = isDisabled(tabHeader);
|
|
95
|
-
if (!disabled && key) {
|
|
96
|
-
this.setAttribute("active", key);
|
|
97
|
-
this.setTabLine(key);
|
|
98
|
-
this.setTabContent(key);
|
|
99
|
-
removeClassToElementChild(this._nav, "active");
|
|
100
|
-
addClassToElement(tabHeader, "active");
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
/**
|
|
104
|
-
* @description: tabPane 设置属性,需要在 tabs 上展示时触发
|
|
105
|
-
* @param {string} key
|
|
106
|
-
* @param {string} value
|
|
107
|
-
*/
|
|
108
|
-
__publicField(this, "updateAttribute", (key, attribute, value = "") => {
|
|
109
|
-
var _a, _b;
|
|
110
|
-
const index2 = this.tabHeaderKeyMapIndex[key];
|
|
111
|
-
if (key && value && this._nav.children[index2]) {
|
|
112
|
-
(_a = this._nav.children[index2]) == null ? void 0 : _a.setAttribute(attribute, value);
|
|
113
|
-
} else {
|
|
114
|
-
(_b = this._nav.children[index2]) == null ? void 0 : _b.removeAttribute(attribute);
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
/**
|
|
118
|
-
* @description: 初始化 tabs 的 active 属性和 tabLine,tabContent
|
|
119
|
-
*/
|
|
120
|
-
__publicField(this, "initActive", () => {
|
|
121
|
-
const tabHeaderList = [...this._nav.children];
|
|
122
|
-
const initTabList = tabHeaderList.filter((item) => !isDisabled(item));
|
|
123
|
-
let initTabHeader;
|
|
124
|
-
if (this.active != null) {
|
|
125
|
-
initTabHeader = initTabList.find((item) => item.getAttribute("r-key") === this.active);
|
|
126
|
-
initTabHeader == null ? void 0 : initTabHeader.setAttribute("r-key", this.active);
|
|
127
|
-
}
|
|
128
|
-
if (!initTabHeader) {
|
|
129
|
-
initTabHeader = initTabList.shift();
|
|
130
|
-
}
|
|
131
|
-
if (!initTabHeader) return;
|
|
132
|
-
const index2 = tabHeaderList.findIndex((item) => item === initTabHeader);
|
|
133
|
-
const key = (initTabHeader == null ? void 0 : initTabHeader.getAttribute("r-key")) || `${index2}`;
|
|
134
|
-
if (key != null) {
|
|
135
|
-
this.setAttribute("active", `${key}`);
|
|
136
|
-
addClassToElement(initTabHeader, "active");
|
|
137
|
-
this.setTabContent(key);
|
|
138
|
-
setTimeout(() => {
|
|
139
|
-
this.setTabLine(key);
|
|
140
|
-
}, 200);
|
|
141
|
-
}
|
|
142
|
-
});
|
|
143
|
-
/**
|
|
144
|
-
* @description: 监听 slot 组件的添加/删除/替换操作,进行 tabs 初始化
|
|
145
|
-
* @return {*}
|
|
146
|
-
*/
|
|
147
|
-
__publicField(this, "listenSlotChange", () => {
|
|
148
|
-
const slots = this._slot.assignedElements();
|
|
149
|
-
slots.forEach((item, index2) => {
|
|
150
|
-
const tabPane = this.createTabHeader(item, index2);
|
|
151
|
-
this._nav.appendChild(tabPane);
|
|
152
|
-
tabPane.addEventListener("click", this.clickTabHead);
|
|
153
|
-
});
|
|
154
|
-
this.initActive();
|
|
155
|
-
if (this.align) {
|
|
156
|
-
if (this.align === "center") this.initTabLineAlignCenter();
|
|
157
|
-
if (this.align === "end") this.initTabLineAlignEnd();
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
/**
|
|
161
|
-
* @description: 初始化 tab
|
|
162
|
-
*/
|
|
163
|
-
__publicField(this, "initTab", () => {
|
|
164
|
-
this._slot.addEventListener("slotchange", this.listenSlotChange);
|
|
165
|
-
});
|
|
166
|
-
/**
|
|
167
|
-
* @description: 卸载 tab
|
|
168
|
-
*/
|
|
169
|
-
__publicField(this, "unloadTab", () => {
|
|
170
|
-
this._slot.removeEventListener("slotchange", this.listenSlotChange);
|
|
171
|
-
});
|
|
172
|
-
this._container = document.createElement("div");
|
|
173
|
-
this._container.setAttribute("class", "ran-tab");
|
|
174
|
-
this._header = document.createElement("div");
|
|
175
|
-
this._header.setAttribute("class", "ran-tab-header");
|
|
176
|
-
this._nav = document.createElement("div");
|
|
177
|
-
this._nav.setAttribute("class", "ran-tab-header-nav");
|
|
178
|
-
this._line = document.createElement("div");
|
|
179
|
-
this._line.setAttribute("class", "ran-tab-header-line");
|
|
180
|
-
this._content = document.createElement("div");
|
|
181
|
-
this._content.setAttribute("class", "ran-tab-content");
|
|
182
|
-
this._wrap = document.createElement("div");
|
|
183
|
-
this._wrap.setAttribute("class", "ran-tab-content-wrap");
|
|
184
|
-
this._slot = document.createElement("slot");
|
|
185
|
-
this._wrap.appendChild(this._slot);
|
|
186
|
-
this._content.appendChild(this._wrap);
|
|
187
|
-
this._header.appendChild(createDocumentFragment([this._nav, this._line]));
|
|
188
|
-
this._container.appendChild(createDocumentFragment([this._header, this._content]));
|
|
189
|
-
this.tabHeaderKeyMapIndex = {};
|
|
190
|
-
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
191
|
-
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
192
|
-
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
193
|
-
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
194
|
-
shadowRoot.appendChild(this._container);
|
|
195
|
-
}
|
|
196
|
-
static get observedAttributes() {
|
|
197
|
-
return ["active", "forceRender", "type", "align", "effect"];
|
|
198
|
-
}
|
|
199
|
-
get align() {
|
|
200
|
-
return this.getAttribute("align") || "start";
|
|
201
|
-
}
|
|
202
|
-
set align(value) {
|
|
203
|
-
this.setAttribute("align", value);
|
|
204
|
-
}
|
|
205
|
-
set type(value) {
|
|
206
|
-
this.setAttribute("type", value);
|
|
207
|
-
}
|
|
208
|
-
get type() {
|
|
209
|
-
return this.getAttribute("type") || "flat";
|
|
210
|
-
}
|
|
211
|
-
get active() {
|
|
212
|
-
return this.getAttribute("active");
|
|
213
|
-
}
|
|
214
|
-
set active(value) {
|
|
215
|
-
if (value) {
|
|
216
|
-
this.setAttribute("active", value);
|
|
217
|
-
this.setTabLine(value);
|
|
218
|
-
this.setTabContent(value);
|
|
219
|
-
} else {
|
|
220
|
-
this.removeAttribute("active");
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
get effect() {
|
|
224
|
-
return this.getAttribute("effect");
|
|
225
|
-
}
|
|
226
|
-
set effect(value) {
|
|
227
|
-
if (!value || value === "false") {
|
|
228
|
-
this.removeAttribute("effect");
|
|
229
|
-
} else {
|
|
230
|
-
this.setAttribute("effect", value);
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* @description: 根据传入的 tabPane 生成 tabs 的头部
|
|
235
|
-
* @param {Element} tabPane
|
|
236
|
-
* @param {number} index
|
|
237
|
-
* @return {Element}
|
|
238
|
-
*/
|
|
239
|
-
createTabHeader(tabPane, index2) {
|
|
240
|
-
const label = tabPane.getAttribute("label") || "";
|
|
241
|
-
const icon = tabPane.getAttribute("icon") || "";
|
|
242
|
-
const iconSize = tabPane.getAttribute("iconSize") || "";
|
|
243
|
-
const key = tabPane.getAttribute("r-key") || `${index2}`;
|
|
244
|
-
const type = tabPane.getAttribute("type") || "text";
|
|
245
|
-
this.initTabHeaderKeyMapIndex(key, index2);
|
|
246
|
-
const tabHeader = document.createElement("r-button");
|
|
247
|
-
tabHeader.setAttribute("class", "tab-header-nav-item");
|
|
248
|
-
tabHeader.setAttribute("type", type);
|
|
249
|
-
icon && tabHeader.setAttribute("icon", icon);
|
|
250
|
-
iconSize && tabHeader.setAttribute("iconSize", iconSize);
|
|
251
|
-
isDisabled(tabPane) && tabHeader.setAttribute("disabled", "");
|
|
252
|
-
tabHeader.setAttribute("r-key", key);
|
|
253
|
-
if (this.effect) {
|
|
254
|
-
tabPane.setAttribute("effect", this.effect);
|
|
255
|
-
this._line.style.setProperty("display", "none");
|
|
256
|
-
}
|
|
257
|
-
tabPane.setAttribute("r-key", key);
|
|
258
|
-
tabHeader.innerHTML = label;
|
|
259
|
-
return tabHeader;
|
|
260
|
-
}
|
|
261
|
-
connectedCallback() {
|
|
262
|
-
this.initTab();
|
|
263
|
-
}
|
|
264
|
-
disconnectCallback() {
|
|
265
|
-
this.unloadTab();
|
|
266
|
-
}
|
|
267
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
268
|
-
if (oldValue !== newValue) {
|
|
269
|
-
this.dispatchEvent(
|
|
270
|
-
new CustomEvent("change", {
|
|
271
|
-
detail: {
|
|
272
|
-
active: this.active
|
|
273
|
-
}
|
|
274
|
-
})
|
|
275
|
-
);
|
|
276
|
-
if (name === "align") {
|
|
277
|
-
if (newValue === "center") this.initTabLineAlignCenter();
|
|
278
|
-
if (newValue === "end") this.initTabLineAlignEnd();
|
|
279
|
-
}
|
|
280
|
-
if (name === "effect") {
|
|
281
|
-
const tabHeaderList = [...this._nav.children];
|
|
282
|
-
tabHeaderList.forEach((item) => {
|
|
283
|
-
if (!this.effect || this.effect === "false") {
|
|
284
|
-
item.removeAttribute("effect");
|
|
285
|
-
} else {
|
|
286
|
-
item.setAttribute("effect", newValue);
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
}
|
|
290
|
-
if (name === "active") {
|
|
291
|
-
this.setAttribute(name, newValue);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
customElements.define("r-tabs", Tabs);
|
|
297
|
-
return Tabs;
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
const index = CustomElement();
|
|
301
|
-
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
302
|
-
__proto__: null,
|
|
303
|
-
default: index
|
|
304
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
305
|
-
export {
|
|
306
|
-
index as a,
|
|
307
|
-
index$1 as i
|
|
308
|
-
};
|
package/dist/index-CjSKJE6S.js
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import { c as create } from "./arrow-down-Beig7FXI.js";
|
|
5
|
-
import "./index-Ck9TOxFh.js";
|
|
6
|
-
const less = '.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([type="toast"]) .ran-message-notice{padding:8px;text-align:center;max-width:90%;margin:0 auto;word-break:break-all}:host([type="toast"]) .ran-message-notice-content{display:inline-block;padding:10px 16px;background:#000000b3;border-radius:7px;pointer-events:all}:host([type="toast"]) .ran-message-notice-content-info{align-items:center;display:flex}:host([type="toast"]) .ran-message-notice-content-info span{margin:0;padding:0;font-size:14px;font-variant:tabular-nums;list-style:none;font-feature-settings:"tnum";z-index:1010;width:100%;pointer-events:none;color:#fff}.ran-message-notice{padding:var(--ran-message-notice-padding, 8px);text-align:var(--ran-message-notice-text-align, center);max-width:var(--ran-message-notice-max-width, 90%);margin:var(--ran-message-notice-margin, 0 auto);word-break:var(--ran-message-notice-word-break, break-all)}.ran-message-notice-content{display:var(--ran-message-notice-content-display, inline-block);padding:var(--ran-message-notice-content-padding, 10px 16px);background:var(--ran-message-notice-content-background, #fff);border-radius:var(--ran-message-notice-content-border-radius, 8px);box-shadow:var(--ran-message-notice-content-box-shadow, 0 3px 6px -4px #0000001f, 0 6px 16px #00000014, 0 9px 28px 8px #0000000d);pointer-events:var(--ran-message-notice-content-pointer-events, all)}.ran-message-notice-content-info{align-items:var(--ran-message-notice-content-info-align-items, center);display:var(--ran-message-notice-content-info-display, flex)}.ran-message-notice-content-info span{margin:var(--ran-message-notice-content-info-span-margin, 0);padding:var(--ran-message-notice-content-info-span-padding, 0);color:var(--ran-message-notice-content-info-span-color, #000000d9);font-size:var(--ran-message-notice-content-info-span-font-size, 14px);font-variant:var(--ran-message-notice-content-info-span-font-variant, tabular-nums);list-style:var(--ran-message-notice-content-info-span-list-style, none);font-feature-settings:var(--ran-message-notice-content-info-span-font-feature-settings, "tnum");z-index:var(--ran-message-notice-content-info-span-z-index, 1010);width:var(--ran-message-notice-content-info-span-width, 100%);pointer-events:var(--ran-message-notice-content-info-span-pointer-events, none)}@keyframes rotate{to{transform:rotate(360deg)}}@keyframes MessageMoveIn{0%{padding:0;transform:translateY(-100%);opacity:0}to{padding:8px;transform:translateY(0);opacity:1}}@keyframes MessageMoveOut{0%{max-height:150px;padding:8px;opacity:1}to{max-height:0;padding:0;opacity:0}}.ranui-message{box-sizing:var(--ran-message-box-sizing, border-box);margin:var(--ran-message-margin, 0);padding:var(--ran-message-padding, 0);color:var(--ran-message-color, #000000d9);font-size:var(--ran-message-font-size, 14px);font-variant:var(--ran-message-font-variant, tabular-nums);line-height:var(--ran-message-line-height, 1.5715);list-style:var(--ran-message-ist-style, none);font-feature-settings:var(--ran-message-font-feature-settings, "tnum");position:var(--ran-message-position, fixed);top:var(--ran-message-top, 8px);left:var(--ran-message-left, 0);z-index:var(--ran-message-z-index, 1010);width:var(--ran-message-width, 100%);pointer-events:var(--ran-message-pointer-events, none)}.ranui-message .message-in{animation-name:var(--ran-message-in-animation-name, MessageMoveIn);animation-duration:var(--ran-message-in-animation-duration, .3s);animation-timing-function:var(--ran-message-in-animation-timing-function, cubic-bezier(.78, .14, .15, .86))}.ranui-message .message-leave{animation-name:var(--ran-message-leave-animation-name, MessageMoveOut);animation-duration:var(--ran-message-leave-animation-duration, .3s);animation-timing-function:var(--ran-message-leave-animation-timing-function, cubic-bezier(.78, .14, .15, .86))}';
|
|
7
|
-
const AnimationTime = 300;
|
|
8
|
-
const defaultDuration = 3e3;
|
|
9
|
-
const typeMapIcon = /* @__PURE__ */ new Map([
|
|
10
|
-
["success", "check-circle-fill"],
|
|
11
|
-
["warning", "warning-circle-fill"],
|
|
12
|
-
["error", "close-circle-fill"],
|
|
13
|
-
["info", "info-circle-fill"],
|
|
14
|
-
["toast", null]
|
|
15
|
-
]);
|
|
16
|
-
const typeMapColor = /* @__PURE__ */ new Map([
|
|
17
|
-
["success", "#52c41a"],
|
|
18
|
-
["warning", "#faad14"],
|
|
19
|
-
["error", "#ff4d4f"],
|
|
20
|
-
["info", "#1890ff"],
|
|
21
|
-
["toast", "rgba(0, 0, 0, 0.7)"]
|
|
22
|
-
]);
|
|
23
|
-
function Custom() {
|
|
24
|
-
if (typeof window !== "undefined" && !customElements.get("r-message")) {
|
|
25
|
-
class CustomMessage extends HTMLElement {
|
|
26
|
-
constructor() {
|
|
27
|
-
super();
|
|
28
|
-
__publicField(this, "_info");
|
|
29
|
-
__publicField(this, "_notice");
|
|
30
|
-
__publicField(this, "_content");
|
|
31
|
-
__publicField(this, "_icon");
|
|
32
|
-
__publicField(this, "_span");
|
|
33
|
-
__publicField(this, "timeId");
|
|
34
|
-
__publicField(this, "close");
|
|
35
|
-
/**
|
|
36
|
-
* @description: 设置图标
|
|
37
|
-
* @param {string} value
|
|
38
|
-
*/
|
|
39
|
-
__publicField(this, "setIcon", (value) => {
|
|
40
|
-
var _a, _b, _c, _d;
|
|
41
|
-
const icon = typeMapIcon.get(value);
|
|
42
|
-
const color = typeMapColor.get(value);
|
|
43
|
-
if (icon) {
|
|
44
|
-
(_a = this._icon) == null ? void 0 : _a.setAttribute("name", icon);
|
|
45
|
-
(_b = this._icon) == null ? void 0 : _b.style.setProperty("margin-right", "8px");
|
|
46
|
-
(_c = this._icon) == null ? void 0 : _c.setAttribute("size", "18");
|
|
47
|
-
color && ((_d = this._icon) == null ? void 0 : _d.setAttribute("color", color));
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
this._notice = document.createElement("div");
|
|
51
|
-
this._notice.setAttribute("class", "ran-message-notice");
|
|
52
|
-
this._content = document.createElement("div");
|
|
53
|
-
this._content.setAttribute("class", "ran-message-notice-content");
|
|
54
|
-
this._info = document.createElement("div");
|
|
55
|
-
this._info.setAttribute("class", "ran-message-notice-content-info");
|
|
56
|
-
this._icon = document.createElement("r-icon");
|
|
57
|
-
this._span = document.createElement("span");
|
|
58
|
-
this._info.appendChild(this._icon);
|
|
59
|
-
this._info.appendChild(this._span);
|
|
60
|
-
this._content.appendChild(this._info);
|
|
61
|
-
this._notice.appendChild(this._content);
|
|
62
|
-
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
63
|
-
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
64
|
-
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = less;
|
|
65
|
-
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
66
|
-
shadowRoot.appendChild(this._notice);
|
|
67
|
-
}
|
|
68
|
-
static get observedAttributes() {
|
|
69
|
-
return ["type", "content"];
|
|
70
|
-
}
|
|
71
|
-
get type() {
|
|
72
|
-
return this.getAttribute("type");
|
|
73
|
-
}
|
|
74
|
-
set type(value) {
|
|
75
|
-
if (value) this.setAttribute("type", value);
|
|
76
|
-
}
|
|
77
|
-
get content() {
|
|
78
|
-
return this.getAttribute("content");
|
|
79
|
-
}
|
|
80
|
-
set content(value) {
|
|
81
|
-
if (value) this.setAttribute("content", value);
|
|
82
|
-
}
|
|
83
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
|
84
|
-
if (name === "content" && oldValue !== newValue) {
|
|
85
|
-
this._span.textContent = newValue;
|
|
86
|
-
}
|
|
87
|
-
if (name === "type" && oldValue !== newValue) {
|
|
88
|
-
this.setIcon(newValue);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
customElements.define("r-message", CustomMessage);
|
|
93
|
-
const container = document.createElement("div");
|
|
94
|
-
const style = create("style").setTextContent(less);
|
|
95
|
-
const div = document.createElement("div");
|
|
96
|
-
div.setAttribute("class", "ranui-message");
|
|
97
|
-
document.body.appendChild(container);
|
|
98
|
-
container.appendChild(style.element);
|
|
99
|
-
container.appendChild(div);
|
|
100
|
-
const commonPrompt = (type) => {
|
|
101
|
-
return (options) => {
|
|
102
|
-
const message2 = new CustomMessage();
|
|
103
|
-
message2.setAttribute("class", "message");
|
|
104
|
-
message2.timeId && clearTimeout(message2.timeId);
|
|
105
|
-
message2.setAttribute("type", type);
|
|
106
|
-
let duration = defaultDuration;
|
|
107
|
-
let close;
|
|
108
|
-
if (!options) return;
|
|
109
|
-
if (typeof options === "string") {
|
|
110
|
-
message2.setAttribute("content", options);
|
|
111
|
-
} else {
|
|
112
|
-
message2.setAttribute("content", options.content);
|
|
113
|
-
close = options.close;
|
|
114
|
-
duration = options.duration || defaultDuration;
|
|
115
|
-
}
|
|
116
|
-
const time = setTimeout(() => {
|
|
117
|
-
message2.classList.remove("message-in");
|
|
118
|
-
message2.classList.add("message-leave");
|
|
119
|
-
clearTimeout(time);
|
|
120
|
-
}, duration - AnimationTime);
|
|
121
|
-
message2.timeId = setTimeout(() => {
|
|
122
|
-
message2.classList.remove("message-leave");
|
|
123
|
-
div.removeChild(message2);
|
|
124
|
-
if (close) close();
|
|
125
|
-
}, duration);
|
|
126
|
-
div.appendChild(message2);
|
|
127
|
-
message2.classList.add("message-in");
|
|
128
|
-
setTimeout(() => {
|
|
129
|
-
message2.classList.remove("message-in");
|
|
130
|
-
}, AnimationTime);
|
|
131
|
-
};
|
|
132
|
-
};
|
|
133
|
-
return {
|
|
134
|
-
info: commonPrompt("info"),
|
|
135
|
-
success: commonPrompt("success"),
|
|
136
|
-
error: commonPrompt("error"),
|
|
137
|
-
warning: commonPrompt("warning"),
|
|
138
|
-
toast: commonPrompt("toast")
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
return {};
|
|
142
|
-
}
|
|
143
|
-
const message = Custom();
|
|
144
|
-
if (typeof window !== "undefined" && message) {
|
|
145
|
-
window.message = message;
|
|
146
|
-
if (!window.ranui) {
|
|
147
|
-
window.ranui = {};
|
|
148
|
-
}
|
|
149
|
-
window.ranui.message = message;
|
|
150
|
-
}
|
|
151
|
-
const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
152
|
-
__proto__: null,
|
|
153
|
-
default: message
|
|
154
|
-
}, Symbol.toStringTag, { value: "Module" }));
|
|
155
|
-
export {
|
|
156
|
-
index as i,
|
|
157
|
-
message as m
|
|
158
|
-
};
|