ranui 0.1.9 → 0.1.10-alpha.2
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/dist/_commonjs-dynamic-modules-DLbDWi6a.js +12 -0
- package/dist/arrow-down-D4qr4m33.js +30 -0
- package/dist/button.js +7 -0
- package/dist/checkbox.js +7 -0
- package/dist/colorpicker.js +13 -0
- package/dist/{colz-746223ab.js → colz-CRDozfZA.js} +1 -5
- package/dist/content.js +6 -0
- package/dist/docx-CChZ5Ycr.js +3665 -0
- package/dist/global-DOOKQmNv.js +4 -0
- package/dist/icon.js +6 -0
- package/dist/iconShadowless.js +6 -0
- package/dist/image.js +4 -0
- package/dist/index-01Qfd9QI.js +207 -0
- package/dist/{index-2d16a084.js → index-B2yRe66F.js} +8 -10
- package/dist/{index-3cf72afd.js → index-B4bfIbdI.js} +9 -23
- package/dist/{index-458debf7.js → index-BF8tJ6rR.js} +7 -31
- package/dist/{index-7b8840f9.js → index-BHmWrPCW.js} +223 -1011
- package/dist/{index-e03d23e7.js → index-BpOERe9M.js} +1 -1
- package/dist/{index-e2e5d725.js → index-ByBbFhvo.js} +123 -323
- package/dist/index-C-p_Wpit.js +103 -0
- package/dist/{index-b7790662.js → index-C1x9Popy.js} +1 -1
- package/dist/index-C6wPL-2Y.js +298 -0
- package/dist/{index-1048a998.js → index-CFnsLnrb.js} +68 -19
- package/dist/{index-57492b9b.js → index-CSnBqUsQ.js} +48 -1
- package/dist/index-CWWI8SHO.js +206 -0
- package/dist/index-Cbp6LrE5.js +501 -0
- package/dist/index-CbyMC6Yz.js +59 -0
- package/dist/index-Cr9AYoGT.js +498 -0
- package/dist/index-DLB8VOy7.js +281 -0
- package/dist/index-DRWOSfdF.js +521 -0
- package/dist/{index-4443363f.js → index-DRi1ylHx.js} +29 -50
- package/dist/index-Dapt713u.js +65624 -0
- package/dist/{index-7216d6b0.js → index-DqtzBqPN.js} +11 -29
- package/dist/{index-1b73beee.js → index-DsIUhdNt.js} +55 -90
- package/dist/{index-01b17e26.js → index-Du-Biu-I.js} +1 -1
- package/dist/{index-0d5b9435.js → index-DytfjwBV.js} +2 -2
- package/dist/index.js +25 -19
- package/dist/info-circle-fill-CFeVMdci.js +4 -0
- package/dist/input.js +6 -0
- package/dist/inputShadowless.js +6 -0
- package/dist/jszip.min-DD9Dc6z4.js +2674 -0
- package/dist/loading.js +6 -0
- package/dist/message.js +5 -0
- package/dist/modal.js +4 -0
- package/dist/{components/option/index.js → option.js} +3 -6
- package/dist/{pdf-bdb7818a.js → pdf-DpNqCylD.js} +12 -4
- package/dist/player.js +8 -0
- package/dist/popover.js +6 -0
- package/dist/preview.js +7 -0
- package/dist/progress.js +7 -0
- package/dist/radar.js +6 -0
- package/dist/select.js +10 -0
- package/dist/selectShadowless.js +10 -0
- package/dist/shadowless/shadowless/index.js +14 -0
- package/dist/skeleton.js +4 -0
- package/dist/sprite-CH2zLtZy.js +141 -0
- package/dist/style.css +1 -1
- package/dist/tab.js +6 -0
- package/dist/tabpane.js +4 -0
- package/dist/tsconfig.json +29 -0
- package/dist/umd/index.umd.cjs +21 -32
- package/dist/umd/shadowless/shadowless.umd.cjs +1 -0
- package/dist/umd/shadowless/style.css +1 -0
- package/dist/umd/style.css +1 -1
- package/dist/utils-74Icp-PI.js +541 -0
- package/package.json +54 -24
- package/readme.md +18 -14
- package/typings.d.ts +101 -0
- package/dist/build/config.d.ts +0 -3
- package/dist/build/config.es.d.ts +0 -2
- package/dist/build/config.umd.d.ts +0 -2
- package/dist/components/button/index.d.ts +0 -35
- package/dist/components/button/index.js +0 -8
- package/dist/components/form/index.d.ts +0 -2
- package/dist/components/icon/index.d.ts +0 -2
- package/dist/components/icon/index.js +0 -6
- package/dist/components/image/index.d.ts +0 -2
- package/dist/components/image/index.js +0 -4
- package/dist/components/input/index.d.ts +0 -185
- package/dist/components/input/index.js +0 -6
- package/dist/components/message/index.d.ts +0 -14
- package/dist/components/message/index.js +0 -4
- package/dist/components/modal/index.d.ts +0 -2
- package/dist/components/modal/index.js +0 -4
- package/dist/components/option/index.d.ts +0 -2
- package/dist/components/player/index.d.ts +0 -213
- package/dist/components/player/index.js +0 -12
- package/dist/components/preview/colz.d.ts +0 -72
- package/dist/components/preview/docx.d.ts +0 -8
- package/dist/components/preview/excel/excel.d.ts +0 -2
- package/dist/components/preview/excel/index.d.ts +0 -1
- package/dist/components/preview/excel/media.d.ts +0 -37
- package/dist/components/preview/index.d.ts +0 -6
- package/dist/components/preview/index.js +0 -8
- package/dist/components/preview/pdf.d.ts +0 -1
- package/dist/components/preview/pptx/index.d.ts +0 -16
- package/dist/components/preview/pptx/process_pptx.d.ts +0 -23
- package/dist/components/preview/pptx/t_xml.d.ts +0 -1
- package/dist/components/preview/pptx/worker.d.ts +0 -1
- package/dist/components/progress/index.d.ts +0 -36
- package/dist/components/progress/index.js +0 -8
- package/dist/components/radar/index.d.ts +0 -2
- package/dist/components/radar/index.js +0 -7
- package/dist/components/scratch/index.d.ts +0 -19
- package/dist/components/select/index.d.ts +0 -105
- package/dist/components/select/index.js +0 -11
- package/dist/components/skeleton/index.d.ts +0 -2
- package/dist/components/skeleton/index.js +0 -4
- package/dist/components/tab/index.d.ts +0 -408
- package/dist/components/tab/index.js +0 -7
- package/dist/components/tabpane/index.d.ts +0 -352
- package/dist/components/tabpane/index.js +0 -4
- package/dist/docx-c5d02d8c.js +0 -21
- package/dist/index-73ce455b.js +0 -264
- package/dist/index-7913ec46.js +0 -239
- package/dist/index-c14450a9.js +0 -662
- package/dist/index.d.ts +0 -14
- package/dist/info-circle-fill-90ec9aa9.js +0 -14
- package/dist/playwright.config.d.ts +0 -9
- package/dist/plugins/auto-import-file.d.ts +0 -0
- package/dist/plugins/load-style.d.ts +0 -6
- package/dist/plugins/load-svg.d.ts +0 -9
- package/dist/tests/button.spec.d.ts +0 -1
- package/dist/umd/build/config.d.ts +0 -3
- package/dist/umd/build/config.es.d.ts +0 -2
- package/dist/umd/build/config.umd.d.ts +0 -2
- package/dist/umd/components/button/index.d.ts +0 -35
- package/dist/umd/components/form/index.d.ts +0 -2
- package/dist/umd/components/icon/index.d.ts +0 -2
- package/dist/umd/components/image/index.d.ts +0 -2
- package/dist/umd/components/input/index.d.ts +0 -185
- package/dist/umd/components/message/index.d.ts +0 -14
- package/dist/umd/components/modal/index.d.ts +0 -2
- package/dist/umd/components/option/index.d.ts +0 -2
- package/dist/umd/components/player/index.d.ts +0 -213
- package/dist/umd/components/preview/colz.d.ts +0 -72
- package/dist/umd/components/preview/docx.d.ts +0 -8
- package/dist/umd/components/preview/excel/excel.d.ts +0 -2
- package/dist/umd/components/preview/excel/index.d.ts +0 -1
- package/dist/umd/components/preview/excel/media.d.ts +0 -37
- package/dist/umd/components/preview/index.d.ts +0 -6
- package/dist/umd/components/preview/pdf.d.ts +0 -1
- package/dist/umd/components/preview/pptx/index.d.ts +0 -16
- package/dist/umd/components/preview/pptx/process_pptx.d.ts +0 -23
- package/dist/umd/components/preview/pptx/t_xml.d.ts +0 -1
- package/dist/umd/components/preview/pptx/worker.d.ts +0 -1
- package/dist/umd/components/progress/index.d.ts +0 -36
- package/dist/umd/components/radar/index.d.ts +0 -2
- package/dist/umd/components/scratch/index.d.ts +0 -19
- package/dist/umd/components/select/index.d.ts +0 -105
- package/dist/umd/components/skeleton/index.d.ts +0 -2
- package/dist/umd/components/tab/index.d.ts +0 -408
- package/dist/umd/components/tabpane/index.d.ts +0 -352
- package/dist/umd/index.d.ts +0 -14
- package/dist/umd/playwright.config.d.ts +0 -9
- package/dist/umd/plugins/auto-import-file.d.ts +0 -0
- package/dist/umd/plugins/load-style.d.ts +0 -6
- package/dist/umd/plugins/load-svg.d.ts +0 -9
- package/dist/umd/tests/button.spec.d.ts +0 -1
- package/dist/umd/utils/image.d.ts +0 -32
- package/dist/umd/utils/index.d.ts +0 -64
- package/dist/umd/utils/math.d.ts +0 -26
- package/dist/umd/utils/tween.d.ts +0 -21
- package/dist/umd/vite.config.d.ts +0 -6
- package/dist/utils/image.d.ts +0 -32
- package/dist/utils/index.d.ts +0 -64
- package/dist/utils/math.d.ts +0 -26
- package/dist/utils/tween.d.ts +0 -21
- package/dist/vendor-f71e6f68.js +0 -92126
- package/dist/vite.config.d.ts +0 -6
- /package/dist/{add-user-b2bed3e7.js → add-user-BN1JlY7e.js} +0 -0
- /package/dist/{book-b11a68eb.js → book-nTEFXU2x.js} +0 -0
- /package/dist/{check-circle-fill-dc284144.js → check-circle-fill-B_pd8ZSs.js} +0 -0
- /package/dist/{check-circle-74bd09c3.js → check-circle-szyAJiap.js} +0 -0
- /package/dist/{close-20925345.js → close-CFnkhudp.js} +0 -0
- /package/dist/{close-circle-720c18be.js → close-circle-CwmuN2C6.js} +0 -0
- /package/dist/{close-circle-fill-238a66b1.js → close-circle-fill-jSqPPw9i.js} +0 -0
- /package/dist/{eye-5e742329.js → eye-D_mEt17f.js} +0 -0
- /package/dist/{eye-close-3874f1ae.js → eye-close-BVr3NJtg.js} +0 -0
- /package/dist/{home-c4a05e8b.js → home-BUQ4USMk.js} +0 -0
- /package/dist/{index-8e1e2573.js → index-CQTJoWhb.js} +0 -0
- /package/dist/{info-circle-5826decc.js → info-circle-COnL5bTJ.js} +0 -0
- /package/dist/{loading-09ca52df.js → loading-Dcc5RApI.js} +0 -0
- /package/dist/{lock-1d2487c9.js → lock-Cr7BnmWN.js} +0 -0
- /package/dist/{message-b2bfdea7.js → message-D36_Zo2l.js} +0 -0
- /package/dist/{power-off-6ade5a91.js → power-off-lQRbiBak.js} +0 -0
- /package/dist/{preview-b291aea8.js → preview-CJbz9GjO.js} +0 -0
- /package/dist/{setting-1e5ccb6d.js → setting-DemlgzVC.js} +0 -0
- /package/dist/{team-ca6a12e1.js → team-tl4NJXPC.js} +0 -0
- /package/dist/{unlock-f56086fd.js → unlock-CeU74z9n.js} +0 -0
- /package/dist/{user-5c01e665.js → user-B-eVXwuk.js} +0 -0
- /package/dist/{warning-circle-035e025c.js → warning-circle-DDUgEDIv.js} +0 -0
- /package/dist/{warning-circle-fill-d17c37c9.js → warning-circle-fill-lODUKz0i.js} +0 -0
|
@@ -0,0 +1,103 @@
|
|
|
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) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { a as addClassToElement, r as removeClassToElement } from "./utils-74Icp-PI.js";
|
|
8
|
+
import { H as HTMLElementSSR, f as falseList, c as createCustomError } from "./index-CSnBqUsQ.js";
|
|
9
|
+
class Checkbox extends HTMLElementSSR() {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
__publicField(this, "checkInput");
|
|
13
|
+
__publicField(this, "checkInner");
|
|
14
|
+
__publicField(this, "context");
|
|
15
|
+
__publicField(this, "updateChecked", () => {
|
|
16
|
+
const { checked } = this.context;
|
|
17
|
+
if (checked) {
|
|
18
|
+
addClassToElement(this, "ran-checkbox-checked");
|
|
19
|
+
} else {
|
|
20
|
+
removeClassToElement(this, "ran-checkbox-checked");
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
__publicField(this, "update", () => {
|
|
24
|
+
this.updateChecked();
|
|
25
|
+
});
|
|
26
|
+
__publicField(this, "onChange", () => {
|
|
27
|
+
const { checked } = this.context;
|
|
28
|
+
this.context.checked = !checked;
|
|
29
|
+
this.dispatchEvent(
|
|
30
|
+
new CustomEvent("change", {
|
|
31
|
+
detail: {
|
|
32
|
+
checked: this.context.checked
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
);
|
|
36
|
+
this.update();
|
|
37
|
+
});
|
|
38
|
+
this.checkInput = document.createElement("input");
|
|
39
|
+
this.checkInput.setAttribute("class", "ran-checkbox-input");
|
|
40
|
+
this.checkInput.setAttribute("type", "checkbox");
|
|
41
|
+
this.checkInner = document.createElement("span");
|
|
42
|
+
this.checkInner.setAttribute("class", "ran-checkbox-inner");
|
|
43
|
+
this.context = {
|
|
44
|
+
checked: false
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
static get observedAttributes() {
|
|
48
|
+
return ["disabled", "checked"];
|
|
49
|
+
}
|
|
50
|
+
get disabled() {
|
|
51
|
+
return this.getAttribute("disabled") || "";
|
|
52
|
+
}
|
|
53
|
+
set disabled(value) {
|
|
54
|
+
this.setAttribute("disabled", value);
|
|
55
|
+
}
|
|
56
|
+
get checked() {
|
|
57
|
+
const checked = this.getAttribute("checked");
|
|
58
|
+
if (falseList.includes(checked)) {
|
|
59
|
+
this.context.checked = false;
|
|
60
|
+
}
|
|
61
|
+
return `${this.context.checked}`;
|
|
62
|
+
}
|
|
63
|
+
set checked(value) {
|
|
64
|
+
if (falseList.includes(value)) {
|
|
65
|
+
this.setAttribute("checked", "false");
|
|
66
|
+
this.context.checked = false;
|
|
67
|
+
} else {
|
|
68
|
+
this.setAttribute("checked", "true");
|
|
69
|
+
this.context.checked = true;
|
|
70
|
+
}
|
|
71
|
+
this.updateChecked();
|
|
72
|
+
}
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
this.setAttribute("class", "ran-checkbox");
|
|
75
|
+
this.appendChild(this.checkInput);
|
|
76
|
+
this.appendChild(this.checkInner);
|
|
77
|
+
this.addEventListener("click", this.onChange);
|
|
78
|
+
}
|
|
79
|
+
disconnectCallback() {
|
|
80
|
+
this.removeEventListener("click", this.onChange);
|
|
81
|
+
}
|
|
82
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function Custom() {
|
|
86
|
+
if (typeof document !== "undefined" && !customElements.get("r-checkbox")) {
|
|
87
|
+
customElements.define("r-checkbox", Checkbox);
|
|
88
|
+
return Checkbox;
|
|
89
|
+
} else {
|
|
90
|
+
return createCustomError("document is undefined or r-checkbox is exist");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const index = Custom();
|
|
94
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
95
|
+
__proto__: null,
|
|
96
|
+
Checkbox,
|
|
97
|
+
default: index
|
|
98
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
99
|
+
export {
|
|
100
|
+
Checkbox as C,
|
|
101
|
+
index as a,
|
|
102
|
+
index$1 as i
|
|
103
|
+
};
|
|
@@ -4,7 +4,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
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}
|
|
7
|
+
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}";
|
|
8
8
|
function CustomElement() {
|
|
9
9
|
if (typeof window !== "undefined" && !customElements.get("r-tab")) {
|
|
10
10
|
class TabPane extends HTMLElement {
|
|
@@ -0,0 +1,298 @@
|
|
|
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) => {
|
|
4
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
return value;
|
|
6
|
+
};
|
|
7
|
+
import { _ as __variableDynamicImportRuntimeHelper, s as str2Xml } from "./arrow-down-D4qr4m33.js";
|
|
8
|
+
import "./utils-74Icp-PI.js";
|
|
9
|
+
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}:host{display:inline-flex}:host([spin]){animation-name:rotate;animation-duration:1.4s;animation-timing-function:linear;animation-iteration-count:infinite}.ran-icon{display:flex;align-items:center;justify-content:center}@keyframes rotate{to{transform:rotate(360deg)}}";
|
|
10
|
+
const X_LINKS_NS = "http://www.w3.org/1999/xlink";
|
|
11
|
+
const X_LINK_HREF = "xlink:href";
|
|
12
|
+
function Custom() {
|
|
13
|
+
if (typeof window !== "undefined" && !customElements.get("r-icon")) {
|
|
14
|
+
class RIcon extends HTMLElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
__publicField(this, "_icon");
|
|
18
|
+
__publicField(this, "_div");
|
|
19
|
+
/**
|
|
20
|
+
* @description: 本地加载 icon
|
|
21
|
+
*/
|
|
22
|
+
__publicField(this, "loadLocal", () => {
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
__variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../assets/icons/add-user.svg": () => import("./add-user-BN1JlY7e.js"), "../../assets/icons/arrow-down.svg": () => import("./arrow-down-D4qr4m33.js").then((n) => n.a), "../../assets/icons/book.svg": () => import("./book-nTEFXU2x.js"), "../../assets/icons/check-circle-fill.svg": () => import("./check-circle-fill-B_pd8ZSs.js"), "../../assets/icons/check-circle.svg": () => import("./check-circle-szyAJiap.js"), "../../assets/icons/close-circle-fill.svg": () => import("./close-circle-fill-jSqPPw9i.js"), "../../assets/icons/close-circle.svg": () => import("./close-circle-CwmuN2C6.js"), "../../assets/icons/close.svg": () => import("./close-CFnkhudp.js"), "../../assets/icons/eye-close.svg": () => import("./eye-close-BVr3NJtg.js"), "../../assets/icons/eye.svg": () => import("./eye-D_mEt17f.js"), "../../assets/icons/home.svg": () => import("./home-BUQ4USMk.js"), "../../assets/icons/info-circle-fill.svg": () => import("./info-circle-fill-CFeVMdci.js"), "../../assets/icons/info-circle.svg": () => import("./info-circle-COnL5bTJ.js"), "../../assets/icons/loading.svg": () => import("./loading-Dcc5RApI.js"), "../../assets/icons/lock.svg": () => import("./lock-Cr7BnmWN.js"), "../../assets/icons/message.svg": () => import("./message-D36_Zo2l.js"), "../../assets/icons/power-off.svg": () => import("./power-off-lQRbiBak.js"), "../../assets/icons/preview.svg": () => import("./preview-CJbz9GjO.js"), "../../assets/icons/setting.svg": () => import("./setting-DemlgzVC.js"), "../../assets/icons/sprite.svg": () => import("./sprite-CH2zLtZy.js"), "../../assets/icons/team.svg": () => import("./team-tl4NJXPC.js"), "../../assets/icons/unlock.svg": () => import("./unlock-CeU74z9n.js"), "../../assets/icons/user.svg": () => import("./user-B-eVXwuk.js"), "../../assets/icons/warning-circle-fill.svg": () => import("./warning-circle-fill-lODUKz0i.js"), "../../assets/icons/warning-circle.svg": () => import("./warning-circle-DDUgEDIv.js") }), `../../assets/icons/${this.name}.svg`, 5).then((result) => {
|
|
25
|
+
if (result && result.default && result.default._identification) {
|
|
26
|
+
const { data } = result.default;
|
|
27
|
+
this._icon && this._div.removeChild(this._icon);
|
|
28
|
+
this._icon = str2Xml(data, "image/svg+xml");
|
|
29
|
+
if (this._icon) {
|
|
30
|
+
this._div.appendChild(this._icon);
|
|
31
|
+
this.setSize();
|
|
32
|
+
this.setColor();
|
|
33
|
+
resolve();
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
this.loadNs();
|
|
37
|
+
reject(`
|
|
38
|
+
couldn't be loaded by r-icon, message: ${this.name} icon is undefined`);
|
|
39
|
+
}
|
|
40
|
+
}).catch((error) => {
|
|
41
|
+
this.loadNs();
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* @description: NS 加载 icon
|
|
47
|
+
*/
|
|
48
|
+
__publicField(this, "loadNs", () => {
|
|
49
|
+
if (this._icon && this._div) {
|
|
50
|
+
this._div.removeChild(this._icon);
|
|
51
|
+
}
|
|
52
|
+
this._icon = document.createElement("svg");
|
|
53
|
+
this._icon.setAttribute("class", "icon");
|
|
54
|
+
this._icon.setAttribute("viewBox", "0 0 1024 1024");
|
|
55
|
+
this._icon.setAttribute("width", "100");
|
|
56
|
+
this._icon.setAttribute("height", "100");
|
|
57
|
+
const use = document.createElementNS(X_LINKS_NS, "use");
|
|
58
|
+
use.setAttributeNS(X_LINKS_NS, X_LINK_HREF, `../../assets/iconfont/icon.svg#icon-${this.name}`);
|
|
59
|
+
this._icon.appendChild(use);
|
|
60
|
+
this._div.appendChild(this._icon);
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* @description: 根据 name 属性加载对应的 svg
|
|
64
|
+
*/
|
|
65
|
+
__publicField(this, "setIcon", async () => {
|
|
66
|
+
if (this.name) {
|
|
67
|
+
this.loadLocal();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* @description: 设置 icon 的大小
|
|
72
|
+
*/
|
|
73
|
+
__publicField(this, "setSize", () => {
|
|
74
|
+
if (this._icon && this.size) {
|
|
75
|
+
this._icon.setAttribute("width", this.size);
|
|
76
|
+
this._icon.setAttribute("height", this.size);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
/**
|
|
80
|
+
* @description: 设置 icon 的颜色
|
|
81
|
+
*/
|
|
82
|
+
__publicField(this, "setColor", () => {
|
|
83
|
+
if (this._icon) {
|
|
84
|
+
this.color ? this._icon.setAttribute("fill", this.color) : this._icon.setAttribute("fill", "currentColor");
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
/**
|
|
88
|
+
* @description: 设置是否旋转和旋转的速度
|
|
89
|
+
*/
|
|
90
|
+
__publicField(this, "setSpin", () => {
|
|
91
|
+
if (this.spin) {
|
|
92
|
+
this.style.setProperty("animation-duration", `${this.spin}s`);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
this._div = document.createElement("div");
|
|
96
|
+
this._div.setAttribute("class", "ran-icon");
|
|
97
|
+
this._div.setAttribute("part", "ran-icon");
|
|
98
|
+
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
99
|
+
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
100
|
+
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
101
|
+
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
102
|
+
shadowRoot.appendChild(this._div);
|
|
103
|
+
}
|
|
104
|
+
static get observedAttributes() {
|
|
105
|
+
return ["name", "size", "color", "spin"];
|
|
106
|
+
}
|
|
107
|
+
get name() {
|
|
108
|
+
return this.getAttribute("name");
|
|
109
|
+
}
|
|
110
|
+
set name(value) {
|
|
111
|
+
if (value)
|
|
112
|
+
this.setAttribute("name", value);
|
|
113
|
+
}
|
|
114
|
+
get size() {
|
|
115
|
+
return this.getAttribute("size");
|
|
116
|
+
}
|
|
117
|
+
set size(value) {
|
|
118
|
+
if (value)
|
|
119
|
+
this.setAttribute("size", value);
|
|
120
|
+
}
|
|
121
|
+
get color() {
|
|
122
|
+
return this.getAttribute("color");
|
|
123
|
+
}
|
|
124
|
+
set color(value) {
|
|
125
|
+
if (value)
|
|
126
|
+
this.setAttribute("color", value);
|
|
127
|
+
}
|
|
128
|
+
get spin() {
|
|
129
|
+
return this.getAttribute("spin");
|
|
130
|
+
}
|
|
131
|
+
set spin(value) {
|
|
132
|
+
if (value != null)
|
|
133
|
+
this.setAttribute("spin", value);
|
|
134
|
+
}
|
|
135
|
+
connectedCallback() {
|
|
136
|
+
this.setIcon();
|
|
137
|
+
}
|
|
138
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
139
|
+
if (newValue !== oldValue) {
|
|
140
|
+
if (name === "name")
|
|
141
|
+
this.setIcon();
|
|
142
|
+
if (name === "size")
|
|
143
|
+
this.setSize();
|
|
144
|
+
if (name === "color")
|
|
145
|
+
this.setColor();
|
|
146
|
+
if (name === "spin")
|
|
147
|
+
this.setSpin();
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
customElements.define("r-icon", RIcon);
|
|
152
|
+
}
|
|
153
|
+
if (typeof window !== "undefined" && !customElements.get("ra-icon")) {
|
|
154
|
+
class RaIcon extends HTMLElement {
|
|
155
|
+
constructor() {
|
|
156
|
+
super();
|
|
157
|
+
__publicField(this, "_icon");
|
|
158
|
+
__publicField(this, "_div");
|
|
159
|
+
/**
|
|
160
|
+
* @description: 本地加载 icon
|
|
161
|
+
*/
|
|
162
|
+
__publicField(this, "loadLocal", () => {
|
|
163
|
+
return new Promise((resolve, reject) => {
|
|
164
|
+
__variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "../../assets/icons/add-user.svg": () => import("./add-user-BN1JlY7e.js"), "../../assets/icons/arrow-down.svg": () => import("./arrow-down-D4qr4m33.js").then((n) => n.a), "../../assets/icons/book.svg": () => import("./book-nTEFXU2x.js"), "../../assets/icons/check-circle-fill.svg": () => import("./check-circle-fill-B_pd8ZSs.js"), "../../assets/icons/check-circle.svg": () => import("./check-circle-szyAJiap.js"), "../../assets/icons/close-circle-fill.svg": () => import("./close-circle-fill-jSqPPw9i.js"), "../../assets/icons/close-circle.svg": () => import("./close-circle-CwmuN2C6.js"), "../../assets/icons/close.svg": () => import("./close-CFnkhudp.js"), "../../assets/icons/eye-close.svg": () => import("./eye-close-BVr3NJtg.js"), "../../assets/icons/eye.svg": () => import("./eye-D_mEt17f.js"), "../../assets/icons/home.svg": () => import("./home-BUQ4USMk.js"), "../../assets/icons/info-circle-fill.svg": () => import("./info-circle-fill-CFeVMdci.js"), "../../assets/icons/info-circle.svg": () => import("./info-circle-COnL5bTJ.js"), "../../assets/icons/loading.svg": () => import("./loading-Dcc5RApI.js"), "../../assets/icons/lock.svg": () => import("./lock-Cr7BnmWN.js"), "../../assets/icons/message.svg": () => import("./message-D36_Zo2l.js"), "../../assets/icons/power-off.svg": () => import("./power-off-lQRbiBak.js"), "../../assets/icons/preview.svg": () => import("./preview-CJbz9GjO.js"), "../../assets/icons/setting.svg": () => import("./setting-DemlgzVC.js"), "../../assets/icons/sprite.svg": () => import("./sprite-CH2zLtZy.js"), "../../assets/icons/team.svg": () => import("./team-tl4NJXPC.js"), "../../assets/icons/unlock.svg": () => import("./unlock-CeU74z9n.js"), "../../assets/icons/user.svg": () => import("./user-B-eVXwuk.js"), "../../assets/icons/warning-circle-fill.svg": () => import("./warning-circle-fill-lODUKz0i.js"), "../../assets/icons/warning-circle.svg": () => import("./warning-circle-DDUgEDIv.js") }), `../../assets/icons/${this.name}.svg`, 5).then((result) => {
|
|
165
|
+
if (result && result.default && result.default._identification) {
|
|
166
|
+
const { data } = result.default;
|
|
167
|
+
this._icon && this._div.removeChild(this._icon);
|
|
168
|
+
this._icon = str2Xml(data, "image/svg+xml");
|
|
169
|
+
if (this._icon) {
|
|
170
|
+
this._div.appendChild(this._icon);
|
|
171
|
+
this.setSize();
|
|
172
|
+
this.setColor();
|
|
173
|
+
resolve();
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
this.loadNs();
|
|
177
|
+
reject(`
|
|
178
|
+
couldn't be loaded by r-icon, message: ${this.name} icon is undefined`);
|
|
179
|
+
}
|
|
180
|
+
}).catch((error) => {
|
|
181
|
+
this.loadNs();
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
/**
|
|
186
|
+
* @description: NS 加载 icon
|
|
187
|
+
*/
|
|
188
|
+
__publicField(this, "loadNs", () => {
|
|
189
|
+
if (this._icon && this._div) {
|
|
190
|
+
this._div.removeChild(this._icon);
|
|
191
|
+
}
|
|
192
|
+
this._icon = document.createElement("svg");
|
|
193
|
+
this._icon.setAttribute("class", "icon");
|
|
194
|
+
this._icon.setAttribute("viewBox", "0 0 1024 1024");
|
|
195
|
+
this._icon.setAttribute("width", "100");
|
|
196
|
+
this._icon.setAttribute("height", "100");
|
|
197
|
+
const use = document.createElementNS(X_LINKS_NS, "use");
|
|
198
|
+
use.setAttributeNS(X_LINKS_NS, X_LINK_HREF, `../../assets/iconfont/icon.svg#icon-${this.name}`);
|
|
199
|
+
this._icon.appendChild(use);
|
|
200
|
+
this._div.appendChild(this._icon);
|
|
201
|
+
});
|
|
202
|
+
/**
|
|
203
|
+
* @description: 根据 name 属性加载对应的 svg
|
|
204
|
+
*/
|
|
205
|
+
__publicField(this, "setIcon", async () => {
|
|
206
|
+
if (this.name) {
|
|
207
|
+
this.loadLocal();
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
/**
|
|
211
|
+
* @description: 设置 icon 的大小
|
|
212
|
+
*/
|
|
213
|
+
__publicField(this, "setSize", () => {
|
|
214
|
+
if (this._icon && this.size) {
|
|
215
|
+
this._icon.setAttribute("width", this.size);
|
|
216
|
+
this._icon.setAttribute("height", this.size);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
/**
|
|
220
|
+
* @description: 设置 icon 的颜色
|
|
221
|
+
*/
|
|
222
|
+
__publicField(this, "setColor", () => {
|
|
223
|
+
if (this._icon) {
|
|
224
|
+
this.color ? this._icon.setAttribute("fill", this.color) : this._icon.setAttribute("fill", "currentColor");
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
/**
|
|
228
|
+
* @description: 设置是否旋转和旋转的速度
|
|
229
|
+
*/
|
|
230
|
+
__publicField(this, "setSpin", () => {
|
|
231
|
+
if (this.spin) {
|
|
232
|
+
this.style.setProperty("animation-duration", `${this.spin}s`);
|
|
233
|
+
}
|
|
234
|
+
});
|
|
235
|
+
this._div = document.createElement("div");
|
|
236
|
+
this._div.setAttribute("class", "ran-icon");
|
|
237
|
+
this._div.setAttribute("part", "ran-icon");
|
|
238
|
+
}
|
|
239
|
+
static get observedAttributes() {
|
|
240
|
+
return ["name", "size", "color", "spin"];
|
|
241
|
+
}
|
|
242
|
+
get name() {
|
|
243
|
+
return this.getAttribute("name");
|
|
244
|
+
}
|
|
245
|
+
set name(value) {
|
|
246
|
+
if (value)
|
|
247
|
+
this.setAttribute("name", value);
|
|
248
|
+
}
|
|
249
|
+
get size() {
|
|
250
|
+
return this.getAttribute("size");
|
|
251
|
+
}
|
|
252
|
+
set size(value) {
|
|
253
|
+
if (value)
|
|
254
|
+
this.setAttribute("size", value);
|
|
255
|
+
}
|
|
256
|
+
get color() {
|
|
257
|
+
return this.getAttribute("color");
|
|
258
|
+
}
|
|
259
|
+
set color(value) {
|
|
260
|
+
if (value)
|
|
261
|
+
this.setAttribute("color", value);
|
|
262
|
+
}
|
|
263
|
+
get spin() {
|
|
264
|
+
return this.getAttribute("spin");
|
|
265
|
+
}
|
|
266
|
+
set spin(value) {
|
|
267
|
+
if (value != null)
|
|
268
|
+
this.setAttribute("spin", value);
|
|
269
|
+
}
|
|
270
|
+
connectedCallback() {
|
|
271
|
+
this.appendChild(this._div);
|
|
272
|
+
this.setIcon();
|
|
273
|
+
}
|
|
274
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
275
|
+
if (newValue !== oldValue) {
|
|
276
|
+
if (name === "name")
|
|
277
|
+
this.setIcon();
|
|
278
|
+
if (name === "size")
|
|
279
|
+
this.setSize();
|
|
280
|
+
if (name === "color")
|
|
281
|
+
this.setColor();
|
|
282
|
+
if (name === "spin")
|
|
283
|
+
this.setSpin();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
customElements.define("ra-icon", RaIcon);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
const index = Custom();
|
|
291
|
+
const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
292
|
+
__proto__: null,
|
|
293
|
+
default: index
|
|
294
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
295
|
+
export {
|
|
296
|
+
index as a,
|
|
297
|
+
index$1 as i
|
|
298
|
+
};
|
|
@@ -4,9 +4,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
import { i as isDisabled, f as falseList, c as createCustomError } from "./index-
|
|
8
|
-
|
|
9
|
-
class Input extends HTMLElement {
|
|
7
|
+
import { H as HTMLElementSSR, i as isDisabled, f as falseList, c as createCustomError } from "./index-CSnBqUsQ.js";
|
|
8
|
+
class Input extends HTMLElementSSR() {
|
|
10
9
|
constructor() {
|
|
11
10
|
super();
|
|
12
11
|
__publicField(this, "_input");
|
|
@@ -146,7 +145,7 @@ class Input extends HTMLElement {
|
|
|
146
145
|
*/
|
|
147
146
|
__publicField(this, "dealIcon", () => {
|
|
148
147
|
if (!this._icon) {
|
|
149
|
-
this._icon = document.createElement("
|
|
148
|
+
this._icon = document.createElement("ra-icon");
|
|
150
149
|
const { width, height } = this._inputContent.getBoundingClientRect();
|
|
151
150
|
const size = Math.min(width, height);
|
|
152
151
|
this._icon.setAttribute("size", `${size}`);
|
|
@@ -171,10 +170,6 @@ class Input extends HTMLElement {
|
|
|
171
170
|
this._input.setAttribute("value", newValue);
|
|
172
171
|
}
|
|
173
172
|
});
|
|
174
|
-
const shadowRoot = this.attachShadow({ mode: "closed" });
|
|
175
|
-
const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
|
|
176
|
-
F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
|
|
177
|
-
shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
|
|
178
173
|
this._input = document.createElement("div");
|
|
179
174
|
this._input.setAttribute("class", "ran-input");
|
|
180
175
|
this._input.setAttribute("part", "ran-input");
|
|
@@ -182,7 +177,6 @@ class Input extends HTMLElement {
|
|
|
182
177
|
this._inputContent.setAttribute("class", "ran-input-content");
|
|
183
178
|
this._inputContent.setAttribute("part", "ran-input-content");
|
|
184
179
|
this._input.appendChild(this._inputContent);
|
|
185
|
-
shadowRoot.appendChild(this._input);
|
|
186
180
|
}
|
|
187
181
|
static get observedAttributes() {
|
|
188
182
|
return [
|
|
@@ -193,7 +187,25 @@ class Input extends HTMLElement {
|
|
|
193
187
|
"type",
|
|
194
188
|
"icon",
|
|
195
189
|
"value",
|
|
196
|
-
"status"
|
|
190
|
+
"status",
|
|
191
|
+
// error warning
|
|
192
|
+
"prefix",
|
|
193
|
+
// 前缀
|
|
194
|
+
"suffix",
|
|
195
|
+
// 后缀
|
|
196
|
+
"allowclear",
|
|
197
|
+
// 清除 icon
|
|
198
|
+
"count",
|
|
199
|
+
// 计算输入的数量
|
|
200
|
+
"maxlength",
|
|
201
|
+
"showcount",
|
|
202
|
+
"onPressEnter",
|
|
203
|
+
// 按下回车的回调
|
|
204
|
+
"variant",
|
|
205
|
+
// filled borderless
|
|
206
|
+
"minrows",
|
|
207
|
+
// 当 type 等于 TextArea 时
|
|
208
|
+
"maxrows"
|
|
197
209
|
];
|
|
198
210
|
}
|
|
199
211
|
/**
|
|
@@ -201,7 +213,7 @@ class Input extends HTMLElement {
|
|
|
201
213
|
* @return {String}
|
|
202
214
|
*/
|
|
203
215
|
get value() {
|
|
204
|
-
return this.getAttribute("value");
|
|
216
|
+
return this.getAttribute("value") || "";
|
|
205
217
|
}
|
|
206
218
|
/**
|
|
207
219
|
* @description: 设置input的值
|
|
@@ -221,7 +233,7 @@ class Input extends HTMLElement {
|
|
|
221
233
|
* @return {String}
|
|
222
234
|
*/
|
|
223
235
|
get placeholder() {
|
|
224
|
-
return this.getAttribute("placeholder");
|
|
236
|
+
return this.getAttribute("placeholder") || "";
|
|
225
237
|
}
|
|
226
238
|
/**
|
|
227
239
|
* @description: 设置input的占位字符
|
|
@@ -239,7 +251,7 @@ class Input extends HTMLElement {
|
|
|
239
251
|
* @return {String}
|
|
240
252
|
*/
|
|
241
253
|
get required() {
|
|
242
|
-
return this.getAttribute("required");
|
|
254
|
+
return this.getAttribute("required") || "";
|
|
243
255
|
}
|
|
244
256
|
/**
|
|
245
257
|
* @description: 设置input是否为必选,除非设置成false,否则都是必填
|
|
@@ -257,7 +269,7 @@ class Input extends HTMLElement {
|
|
|
257
269
|
* @return {String | null}
|
|
258
270
|
*/
|
|
259
271
|
get disabled() {
|
|
260
|
-
return isDisabled(this)
|
|
272
|
+
return `${isDisabled(this)}`;
|
|
261
273
|
}
|
|
262
274
|
/**
|
|
263
275
|
* @description: 设置input的disabled属性
|
|
@@ -368,7 +380,7 @@ class Input extends HTMLElement {
|
|
|
368
380
|
* @return {String}
|
|
369
381
|
*/
|
|
370
382
|
get icon() {
|
|
371
|
-
return this.getAttribute("icon");
|
|
383
|
+
return this.getAttribute("icon") || "";
|
|
372
384
|
}
|
|
373
385
|
/**
|
|
374
386
|
* @description: 设置icon来表示标识
|
|
@@ -381,12 +393,48 @@ class Input extends HTMLElement {
|
|
|
381
393
|
this.removeAttribute("icon");
|
|
382
394
|
}
|
|
383
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* @description: 获取前面的icon
|
|
398
|
+
* @return {String}
|
|
399
|
+
*/
|
|
400
|
+
get prefix() {
|
|
401
|
+
return this.getAttribute("prefix") || "";
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* @description: 设置前面的icon来表示标识
|
|
405
|
+
* @param {string|null} value
|
|
406
|
+
*/
|
|
407
|
+
set prefix(value) {
|
|
408
|
+
if (value) {
|
|
409
|
+
this.setAttribute("prefix", value);
|
|
410
|
+
} else {
|
|
411
|
+
this.removeAttribute("prefix");
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* @description: 获取后面的icon
|
|
416
|
+
* @return {String}
|
|
417
|
+
*/
|
|
418
|
+
get suffix() {
|
|
419
|
+
return this.getAttribute("suffix") || "";
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* @description: 设置后面的icon来表示标识
|
|
423
|
+
* @param {string|null} value
|
|
424
|
+
*/
|
|
425
|
+
set suffix(value) {
|
|
426
|
+
if (value) {
|
|
427
|
+
this.setAttribute("suffix", value);
|
|
428
|
+
} else {
|
|
429
|
+
this.removeAttribute("suffix");
|
|
430
|
+
}
|
|
431
|
+
}
|
|
384
432
|
/**
|
|
385
433
|
* @description: 获取input的类型
|
|
386
434
|
* @return {string|null}
|
|
387
435
|
*/
|
|
388
436
|
get type() {
|
|
389
|
-
return this.getAttribute("type");
|
|
437
|
+
return this.getAttribute("type") || "";
|
|
390
438
|
}
|
|
391
439
|
/**
|
|
392
440
|
* @description: 设置input的类型
|
|
@@ -418,6 +466,7 @@ class Input extends HTMLElement {
|
|
|
418
466
|
if (document.readyState === "complete") {
|
|
419
467
|
this.dealIcon();
|
|
420
468
|
}
|
|
469
|
+
this.appendChild(this._input);
|
|
421
470
|
}
|
|
422
471
|
disconnectCallback() {
|
|
423
472
|
this._inputContent.removeEventListener("input", this.customInput);
|
|
@@ -427,11 +476,11 @@ class Input extends HTMLElement {
|
|
|
427
476
|
}
|
|
428
477
|
}
|
|
429
478
|
function Custom() {
|
|
430
|
-
if (typeof window !== "undefined" && !customElements.get("
|
|
431
|
-
customElements.define("
|
|
479
|
+
if (typeof window !== "undefined" && !customElements.get("ra-input")) {
|
|
480
|
+
customElements.define("ra-input", Input);
|
|
432
481
|
return Input;
|
|
433
482
|
} else {
|
|
434
|
-
return createCustomError("document is undefined or
|
|
483
|
+
return createCustomError("document is undefined or ra-input is exist");
|
|
435
484
|
}
|
|
436
485
|
}
|
|
437
486
|
const index = Custom();
|
|
@@ -31,7 +31,7 @@ const loadScript = (src) => {
|
|
|
31
31
|
document.body.append(script);
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
function createCustomError(msg) {
|
|
34
|
+
function createCustomError(msg = "") {
|
|
35
35
|
return class CustomError {
|
|
36
36
|
constructor(message = msg) {
|
|
37
37
|
__publicField(this, "message");
|
|
@@ -39,7 +39,54 @@ function createCustomError(msg) {
|
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
|
+
const HTMLElementSSR = () => {
|
|
43
|
+
if (typeof document !== "undefined") {
|
|
44
|
+
return HTMLElement;
|
|
45
|
+
}
|
|
46
|
+
return null;
|
|
47
|
+
};
|
|
48
|
+
const createSignal = (value, options) => {
|
|
49
|
+
const signal = {
|
|
50
|
+
value,
|
|
51
|
+
// 订阅者
|
|
52
|
+
subscribers: /* @__PURE__ */ new Set(),
|
|
53
|
+
comparator: options == null ? void 0 : options.equals
|
|
54
|
+
};
|
|
55
|
+
const { subscriber } = options || {};
|
|
56
|
+
if (subscriber && Array.isArray(subscriber)) {
|
|
57
|
+
subscriber.forEach((item) => {
|
|
58
|
+
if (typeof item === "function" && !signal.subscribers.has(item)) {
|
|
59
|
+
signal.subscribers.add(item);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
const getter = () => {
|
|
64
|
+
return signal.value;
|
|
65
|
+
};
|
|
66
|
+
const updateSignal = (newValue) => {
|
|
67
|
+
if (signal.value !== newValue) {
|
|
68
|
+
signal.value = newValue;
|
|
69
|
+
signal.subscribers.forEach((subscriber2) => subscriber2(newValue));
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const setter = (newValue) => {
|
|
73
|
+
const { comparator } = signal;
|
|
74
|
+
if (comparator instanceof Function) {
|
|
75
|
+
return !comparator(signal.value, newValue) && updateSignal(newValue);
|
|
76
|
+
}
|
|
77
|
+
if (comparator === void 0) {
|
|
78
|
+
if (signal.value !== newValue) {
|
|
79
|
+
updateSignal(newValue);
|
|
80
|
+
}
|
|
81
|
+
} else {
|
|
82
|
+
!comparator && updateSignal(newValue);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
return [getter, setter];
|
|
86
|
+
};
|
|
42
87
|
export {
|
|
88
|
+
HTMLElementSSR as H,
|
|
89
|
+
createSignal as a,
|
|
43
90
|
createCustomError as c,
|
|
44
91
|
falseList as f,
|
|
45
92
|
isDisabled as i,
|