ranui 0.1.5 → 0.1.7

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.
Files changed (171) hide show
  1. package/dist/add-user-b2bed3e7.js +4 -0
  2. package/dist/book-b11a68eb.js +4 -0
  3. package/dist/build/config.d.ts +3 -0
  4. package/dist/check-circle-74bd09c3.js +4 -0
  5. package/dist/check-circle-fill-dc284144.js +4 -0
  6. package/dist/close-20925345.js +4 -0
  7. package/dist/close-circle-720c18be.js +4 -0
  8. package/dist/close-circle-fill-238a66b1.js +4 -0
  9. package/dist/components/button/index.d.ts +1 -331
  10. package/dist/components/button/index.js +4 -2
  11. package/dist/components/icon/index.js +3 -1
  12. package/dist/components/image/index.js +1 -1
  13. package/dist/components/input/index.d.ts +1 -435
  14. package/dist/components/input/index.js +2 -2
  15. package/dist/components/message/index.d.ts +12 -6
  16. package/dist/components/message/index.js +1 -2
  17. package/dist/components/modal/index.js +4 -0
  18. package/dist/components/option/index.d.ts +2 -0
  19. package/dist/components/option/index.js +95 -0
  20. package/dist/components/{video → player}/index.d.ts +245 -114
  21. package/dist/components/player/index.js +11 -0
  22. package/dist/components/preview/colz.d.ts +1 -1
  23. package/dist/components/preview/excel/excel.d.ts +0 -9
  24. package/dist/components/preview/index.d.ts +4 -0
  25. package/dist/components/preview/index.js +5 -4
  26. package/dist/components/preview/pptx/process_pptx.d.ts +1 -1
  27. package/dist/components/progress/index.d.ts +36 -0
  28. package/dist/components/progress/index.js +8 -0
  29. package/dist/components/radar/index.d.ts +2 -0
  30. package/dist/components/radar/index.js +7 -0
  31. package/dist/components/select/index.d.ts +101 -0
  32. package/dist/components/select/index.js +11 -0
  33. package/dist/components/skeleton/index.js +1 -1
  34. package/dist/components/tab/index.d.ts +47 -27
  35. package/dist/components/tab/index.js +4 -2
  36. package/dist/components/tabpane/index.d.ts +47 -27
  37. package/dist/components/tabpane/index.js +1 -1
  38. package/dist/docx-c5d02d8c.js +21 -0
  39. package/dist/eye-5e742329.js +4 -0
  40. package/dist/eye-close-3874f1ae.js +4 -0
  41. package/dist/hls/5_1700986031916/5.key +1 -0
  42. package/dist/hls/5_1700986031916/5.m3u8 +12 -0
  43. package/dist/hls/5_1700986031916/5_00000.ts +0 -0
  44. package/dist/hls/5_1700986031916/5_00001.ts +0 -0
  45. package/dist/hls/5_1700986031916/5_00002.ts +0 -0
  46. package/dist/hls/5_1700986110178/5.key +1 -0
  47. package/dist/hls/5_1700986110178/5.m3u8 +12 -0
  48. package/dist/hls/5_1700986110178/5_00000.ts +0 -0
  49. package/dist/hls/5_1700986110178/5_00001.ts +0 -0
  50. package/dist/hls/5_1700986110178/5_00002.ts +0 -0
  51. package/dist/hls/example.m3u8 +5 -0
  52. package/dist/home-c4a05e8b.js +4 -0
  53. package/dist/index-0e7229ea.js +328 -0
  54. package/dist/index-183517e7.js +265 -0
  55. package/dist/index-48653b79.js +162 -0
  56. package/dist/index-4d873a42.js +195 -0
  57. package/dist/index-57492b9b.js +48 -0
  58. package/dist/index-5975bbc0.js +126 -0
  59. package/dist/index-7b8840f9.js +18690 -0
  60. package/dist/index-7f513a14.js +175 -0
  61. package/dist/index-8e1e2573.js +19 -0
  62. package/dist/index-a1a53af6.js +354 -0
  63. package/dist/index-a216f328.js +662 -0
  64. package/dist/index-a43b144f.js +232 -0
  65. package/dist/index-aea75a9f.js +78 -0
  66. package/dist/index-b2be6bef.js +10423 -0
  67. package/dist/index-b90299ca.js +43 -0
  68. package/dist/index-d2d69b06.js +225 -0
  69. package/dist/index-ecaed5cc.js +439 -0
  70. package/dist/index-f6d6982d.js +516 -0
  71. package/dist/index.d.ts +5 -0
  72. package/dist/index.js +24 -12
  73. package/dist/info-circle-5826decc.js +4 -0
  74. package/dist/info-circle-fill-90ec9aa9.js +14 -0
  75. package/dist/loading-09ca52df.js +4 -0
  76. package/dist/lock-1d2487c9.js +4 -0
  77. package/dist/message-b2bfdea7.js +4 -0
  78. package/dist/{pdf-bd9a47ff.js → pdf-bdb7818a.js} +1 -2
  79. package/dist/playwright.config.d.ts +0 -2
  80. package/dist/plugins/auto-import-file.d.ts +0 -10
  81. package/dist/power-off-6ade5a91.js +4 -0
  82. package/dist/preview-b291aea8.js +4 -0
  83. package/dist/setting-1e5ccb6d.js +4 -0
  84. package/dist/style.css +1 -1
  85. package/dist/team-ca6a12e1.js +4 -0
  86. package/dist/umd/build/config.d.ts +3 -0
  87. package/dist/umd/components/button/index.d.ts +1 -331
  88. package/dist/umd/components/input/index.d.ts +1 -435
  89. package/dist/umd/components/message/index.d.ts +12 -6
  90. package/dist/umd/components/option/index.d.ts +2 -0
  91. package/dist/umd/components/{video → player}/index.d.ts +245 -114
  92. package/dist/umd/components/preview/colz.d.ts +1 -1
  93. package/dist/umd/components/preview/excel/excel.d.ts +0 -9
  94. package/dist/umd/components/preview/index.d.ts +4 -0
  95. package/dist/umd/components/preview/pptx/process_pptx.d.ts +1 -1
  96. package/dist/umd/components/progress/index.d.ts +36 -0
  97. package/dist/umd/components/radar/index.d.ts +2 -0
  98. package/dist/umd/components/select/index.d.ts +101 -0
  99. package/dist/umd/components/tab/index.d.ts +47 -27
  100. package/dist/umd/components/tabpane/index.d.ts +47 -27
  101. package/dist/umd/hls/5_1700986031916/5.key +1 -0
  102. package/dist/umd/hls/5_1700986031916/5.m3u8 +12 -0
  103. package/dist/umd/hls/5_1700986031916/5_00000.ts +0 -0
  104. package/dist/umd/hls/5_1700986031916/5_00001.ts +0 -0
  105. package/dist/umd/hls/5_1700986031916/5_00002.ts +0 -0
  106. package/dist/umd/hls/5_1700986110178/5.key +1 -0
  107. package/dist/umd/hls/5_1700986110178/5.m3u8 +12 -0
  108. package/dist/umd/hls/5_1700986110178/5_00000.ts +0 -0
  109. package/dist/umd/hls/5_1700986110178/5_00001.ts +0 -0
  110. package/dist/umd/hls/5_1700986110178/5_00002.ts +0 -0
  111. package/dist/umd/hls/example.m3u8 +5 -0
  112. package/dist/umd/index.d.ts +5 -0
  113. package/dist/umd/index.umd.cjs +26 -8
  114. package/dist/umd/playwright.config.d.ts +0 -2
  115. package/dist/umd/plugins/auto-import-file.d.ts +0 -10
  116. package/dist/umd/style.css +1 -1
  117. package/dist/umd/utils/image.d.ts +32 -0
  118. package/dist/umd/utils/index.d.ts +44 -17
  119. package/dist/umd/utils/math.d.ts +26 -0
  120. package/dist/umd/utils/tween.d.ts +21 -0
  121. package/dist/unlock-f56086fd.js +4 -0
  122. package/dist/user-5c01e665.js +4 -0
  123. package/dist/utils/image.d.ts +32 -0
  124. package/dist/utils/index.d.ts +44 -17
  125. package/dist/utils/math.d.ts +26 -0
  126. package/dist/utils/tween.d.ts +21 -0
  127. package/dist/{index-714a1eb8.js → vendor-f71e6f68.js} +7771 -1267
  128. package/dist/warning-circle-035e025c.js +4 -0
  129. package/dist/warning-circle-fill-d17c37c9.js +4 -0
  130. package/package.json +54 -7
  131. package/readme.md +78 -50
  132. package/dist/_commonjs-dynamic-modules-2ceabb0b.js +0 -12
  133. package/dist/add-user-d07564bd.js +0 -4
  134. package/dist/assets/image/failImage.d.ts +0 -2
  135. package/dist/base-bcc748a2.js +0 -1
  136. package/dist/book-2a5a596c.js +0 -4
  137. package/dist/check-circle-2c986969.js +0 -4
  138. package/dist/check-circle-fill-62eaa796.js +0 -4
  139. package/dist/close-circle-2afb6e94.js +0 -4
  140. package/dist/close-circle-fill-b6906239.js +0 -4
  141. package/dist/close-ee3ba1d1.js +0 -4
  142. package/dist/docx-5262a8f1.js +0 -2635
  143. package/dist/eye-bd60afe1.js +0 -4
  144. package/dist/eye-close-bde3c1fc.js +0 -4
  145. package/dist/home-f824d8f4.js +0 -4
  146. package/dist/index-00913cab.js +0 -43
  147. package/dist/index-03e90266.js +0 -455
  148. package/dist/index-105ed089.js +0 -127
  149. package/dist/index-1ffff466.js +0 -23077
  150. package/dist/index-2243317e.js +0 -155
  151. package/dist/index-441da303.js +0 -196
  152. package/dist/index-9861f093.js +0 -215
  153. package/dist/index-ac3f8c4f.js +0 -324
  154. package/dist/index-b580f377.js +0 -78
  155. package/dist/index-c61cbf56.js +0 -74
  156. package/dist/index-db03e134.js +0 -177
  157. package/dist/info-circle-59333e1c.js +0 -4
  158. package/dist/info-circle-fill-3ab7660d.js +0 -4
  159. package/dist/jszip.min-97cf7c6a.js +0 -2655
  160. package/dist/loading-407d8249.js +0 -4
  161. package/dist/lock-6d20715b.js +0 -4
  162. package/dist/message-ee4fe153.js +0 -4
  163. package/dist/power-off-bbec6b5f.js +0 -4
  164. package/dist/preview-164a4944.js +0 -4
  165. package/dist/setting-735a1963.js +0 -4
  166. package/dist/team-42573142.js +0 -4
  167. package/dist/umd/assets/image/failImage.d.ts +0 -2
  168. package/dist/unlock-ae33c6f7.js +0 -4
  169. package/dist/user-b7098183.js +0 -4
  170. package/dist/warning-circle-536d4749.js +0 -4
  171. package/dist/warning-circle-fill-e4be98bc.js +0 -4
@@ -0,0 +1,162 @@
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
+ const f7170ee498e0dd32cbdcb63fba8f75cc = ':host([type="toast"]){--ranui-message-background: rgba(0, 0, 0, .7);--ranui-message-color: #fff;--ranui-message-border-radius: 7px}.ran-message-notice{padding:8px;text-align:center;max-width:90%;margin:0 auto;word-break:break-all}.ran-message-notice-content{display:inline-block;padding:10px 16px;background:var(--ranui-message-background, #fff);border-radius:var(--ranui-message-border-radius, 8px);box-shadow:0 3px 6px -4px #0000001f,0 6px 16px #00000014,0 9px 28px 8px #0000000d;pointer-events:all}.ran-message-notice-content-info{align-items:center;display:flex}.ran-message-notice-content-info span{margin:0;padding:0;color:var(--ranui-message-color, #000000d9);font-size:14px;font-variant:tabular-nums;list-style:none;font-feature-settings:"tnum";z-index:1010;width:100%;pointer-events:none}@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:border-box;margin:0;padding:0;color:#000000d9;font-size:14px;font-variant:tabular-nums;line-height:1.5715;list-style:none;font-feature-settings:"tnum";position:fixed;top:8px;left:0;z-index:1010;width:100%;pointer-events:none}.ranui-message .message-in{animation-name:MessageMoveIn;animation-duration:.3s;animation-timing-function:cubic-bezier(.78,.14,.15,.86)}.ranui-message .message-leave{animation-name:MessageMoveOut;animation-duration:.3s;animation-timing-function:cubic-bezier(.78,.14,.15,.86)}\n';
8
+ const index$1 = "";
9
+ const AnimationTime = 300;
10
+ const defaultDuration = 3e3;
11
+ const typeMapIcon = /* @__PURE__ */ new Map([
12
+ ["success", "check-circle-fill"],
13
+ ["warning", "warning-circle-fill"],
14
+ ["error", "close-circle-fill"],
15
+ ["info", "info-circle-fill"],
16
+ ["toast", null]
17
+ ]);
18
+ const typeMapColor = /* @__PURE__ */ new Map([
19
+ ["success", "#52c41a"],
20
+ ["warning", "#faad14"],
21
+ ["error", "#ff4d4f"],
22
+ ["info", "#1890ff"],
23
+ ["toast", "rgba(0, 0, 0, 0.7)"]
24
+ ]);
25
+ function Custom() {
26
+ if (typeof window !== "undefined" && !customElements.get("r-message")) {
27
+ class CustomMessage extends HTMLElement {
28
+ constructor() {
29
+ super();
30
+ __publicField(this, "_info");
31
+ __publicField(this, "_notice");
32
+ __publicField(this, "_content");
33
+ __publicField(this, "_icon");
34
+ __publicField(this, "_span");
35
+ __publicField(this, "timeId");
36
+ __publicField(this, "close");
37
+ /**
38
+ * @description: 设置图标
39
+ * @param {string} value
40
+ */
41
+ __publicField(this, "setIcon", (value) => {
42
+ var _a, _b, _c, _d;
43
+ const icon = typeMapIcon.get(value);
44
+ const color = typeMapColor.get(value);
45
+ if (icon) {
46
+ (_a = this._icon) == null ? void 0 : _a.setAttribute("name", icon);
47
+ (_b = this._icon) == null ? void 0 : _b.style.setProperty("margin-right", "8px");
48
+ (_c = this._icon) == null ? void 0 : _c.setAttribute("size", "18");
49
+ color && ((_d = this._icon) == null ? void 0 : _d.setAttribute("color", color));
50
+ }
51
+ });
52
+ this._notice = document.createElement("div");
53
+ this._notice.setAttribute("class", "ran-message-notice");
54
+ this._content = document.createElement("div");
55
+ this._content.setAttribute("class", "ran-message-notice-content");
56
+ this._info = document.createElement("div");
57
+ this._info.setAttribute("class", "ran-message-notice-content-info");
58
+ this._icon = document.createElement("r-icon");
59
+ this._span = document.createElement("span");
60
+ this._info.appendChild(this._icon);
61
+ this._info.appendChild(this._span);
62
+ this._content.appendChild(this._info);
63
+ this._notice.appendChild(this._content);
64
+ const shadowRoot = this.attachShadow({ mode: "closed" });
65
+ const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
66
+ F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
67
+ shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
68
+ shadowRoot.appendChild(this._notice);
69
+ }
70
+ static get observedAttributes() {
71
+ return ["type", "content"];
72
+ }
73
+ get type() {
74
+ return this.getAttribute("type");
75
+ }
76
+ set type(value) {
77
+ if (value)
78
+ this.setAttribute("type", value);
79
+ }
80
+ get content() {
81
+ return this.getAttribute("content");
82
+ }
83
+ set content(value) {
84
+ if (value)
85
+ this.setAttribute("content", value);
86
+ }
87
+ attributeChangedCallback(name, oldValue, newValue) {
88
+ if (name === "content" && oldValue !== newValue) {
89
+ this._span.textContent = newValue;
90
+ }
91
+ if (name === "type" && oldValue !== newValue) {
92
+ this.setIcon(newValue);
93
+ }
94
+ }
95
+ }
96
+ customElements.define("r-message", CustomMessage);
97
+ const container = document.createElement("div");
98
+ const div = document.createElement("div");
99
+ div.setAttribute("class", "ranui-message");
100
+ document.body.appendChild(container);
101
+ container.appendChild(div);
102
+ const commonPrompt = (type) => {
103
+ return (options) => {
104
+ const message2 = new CustomMessage();
105
+ message2.setAttribute("class", "message");
106
+ message2.timeId && clearTimeout(message2.timeId);
107
+ message2.setAttribute("type", type);
108
+ let duration = defaultDuration;
109
+ let close;
110
+ if (!options)
111
+ return;
112
+ if (typeof options === "string") {
113
+ message2.setAttribute("content", options);
114
+ } else {
115
+ message2.setAttribute("content", options.content);
116
+ close = options.close;
117
+ duration = options.duration || defaultDuration;
118
+ }
119
+ const time = setTimeout(() => {
120
+ message2.classList.remove("message-in");
121
+ message2.classList.add("message-leave");
122
+ clearTimeout(time);
123
+ }, duration - AnimationTime);
124
+ message2.timeId = setTimeout(() => {
125
+ message2.classList.remove("message-leave");
126
+ div.removeChild(message2);
127
+ if (close)
128
+ close();
129
+ }, duration);
130
+ div.appendChild(message2);
131
+ message2.classList.add("message-in");
132
+ setTimeout(() => {
133
+ message2.classList.remove("message-in");
134
+ }, AnimationTime);
135
+ };
136
+ };
137
+ return {
138
+ info: commonPrompt("info"),
139
+ success: commonPrompt("success"),
140
+ error: commonPrompt("error"),
141
+ warning: commonPrompt("warning"),
142
+ toast: commonPrompt("toast")
143
+ };
144
+ }
145
+ return {};
146
+ }
147
+ const message = Custom();
148
+ if (typeof window !== "undefined" && message) {
149
+ window.message = message;
150
+ if (!window.ranui) {
151
+ window.ranui = {};
152
+ }
153
+ window.ranui.message = message;
154
+ }
155
+ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
156
+ __proto__: null,
157
+ default: message
158
+ }, Symbol.toStringTag, { value: "Module" }));
159
+ export {
160
+ index as i,
161
+ message as m
162
+ };
@@ -0,0 +1,195 @@
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 { j as judgeDevice } from "./index-d2d69b06.js";
8
+ import { c as createCustomError, i as isDisabled, f as falseList } from "./index-57492b9b.js";
9
+ const f7170ee498e0dd32cbdcb63fba8f75cc = ':host{position:relative;display:inline-block;background-image:none;box-shadow:0 2px #00000004;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;touch-action:manipulation;overflow:hidden;pointer-events:auto}:host .ran-btn{position:relative;display:inline-block;background-image:none;cursor:pointer;transition:all .3s cubic-bezier(.645,.045,.355,1);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;touch-action:manipulation;background:#fff}:host,:host(:active),:host(:focus){outline:0}:host .ran-btn,:host(:active) .ran-btn,:host(:focus) .ran-btn{outline:0}:host(:not([disabled]):hover) .ran-btn-content{border-color:#1890ff;color:#1890ff}:host([type="primary"]) .ran-btn-content{border-color:#1890ff;background-color:#1890ff;color:#fff}:host([type="primary"]:not([disabled])) .ran-btn:after{background-image:radial-gradient(circle,#fff 10%,transparent 10.01%)}:host([type="primary"]:not([disabled]):hover) .ran-btn-content{background-color:#40a9ff;color:#fff}:host([type="warning"]) .ran-btn-content{border-color:#ff4d4f;background-color:#ff4d4f;color:#fff}:host([type="warning"]:not([disabled])) .ran-btn:after{background-image:radial-gradient(circle,#fff 10%,transparent 10.01%)}:host([type="warning"]:not([disabled]):hover) .ran-btn-content{border-color:#ff4d4f;background-color:#ff4d4f;color:#fff}:host([type="text"]) .ran-btn-content{border:none}:host([disabled]){cursor:not-allowed;pointer-events:all;opacity:.6}:host([disabled]) .ran-btn{cursor:not-allowed;pointer-events:all;opacity:.6}:host(:not([disabled]):active) .ran-btn:after{transform:translate(-50%,-50%) scale(0);opacity:.3;transition:0s}@media (min-width: 1024px){:host(:not([disabled],[effect])) .ran-btn:after{content:"";display:block;position:absolute;width:100%;height:100%;left:var(--ran-x, 0);top:var(--ran-y, 0);pointer-events:none;background-image:radial-gradient(circle,#1890ff 10%,transparent 10.01%);background-repeat:no-repeat;background-position:50%;transform:translate(-50%,-50%) scale(10);opacity:0;transition:transform .3s,opacity .8s}}:host .slot{display:block}.ran-btn-content{display:flex;justify-content:space-between;align-items:center;padding:4px 15px;border:1px solid transparent;border-radius:2px;border-color:#d9d9d9;color:#000000d9;line-height:22px;font-size:14px;font-weight:400;white-space:nowrap;text-align:center}.ran-btn-content .icon{margin-right:2px}\n';
10
+ function Custom() {
11
+ if (typeof document !== "undefined" && !customElements.get("r-button")) {
12
+ class Button extends HTMLElement {
13
+ constructor() {
14
+ super();
15
+ __publicField(this, "_btn");
16
+ __publicField(this, "_btnContent");
17
+ __publicField(this, "_iconElement");
18
+ __publicField(this, "_slot");
19
+ __publicField(this, "_shadowDom");
20
+ __publicField(this, "debounceTimeId");
21
+ /**
22
+ * @description: 设置button的icon
23
+ * @return {*}
24
+ */
25
+ __publicField(this, "setIcon", () => {
26
+ if (this.icon) {
27
+ const { width, height } = this._slot.getBoundingClientRect();
28
+ const size = Math.min(width, height);
29
+ if (this._iconElement) {
30
+ this._iconElement.setAttribute("name", this.icon);
31
+ } else {
32
+ this._iconElement = document.createElement("r-icon");
33
+ this._iconElement.setAttribute("name", this.icon);
34
+ this._iconElement.setAttribute("color", "currentColor");
35
+ this._iconElement.setAttribute("class", "icon");
36
+ this._slot.insertAdjacentElement("beforebegin", this._iconElement);
37
+ }
38
+ if (this.iconSize) {
39
+ this._iconElement.setAttribute("size", this.iconSize);
40
+ } else {
41
+ this._iconElement.setAttribute("size", `${size - 5}`);
42
+ }
43
+ }
44
+ });
45
+ __publicField(this, "mousedown", (event) => {
46
+ if (judgeDevice() !== "pc")
47
+ return;
48
+ if (!this.disabled || this.disabled === "false") {
49
+ this.debounceMouseEvent();
50
+ const { left, top } = this.getBoundingClientRect();
51
+ this._btn.style.setProperty("--ran-x", event.clientX - left + "px");
52
+ this._btn.style.setProperty("--ran-y", event.clientY - top + "px");
53
+ }
54
+ });
55
+ __publicField(this, "mouseup", (event) => {
56
+ if (judgeDevice() !== "pc")
57
+ return;
58
+ if (this.debounceTimeId)
59
+ return;
60
+ this.debounceTimeId = setTimeout(() => {
61
+ this._btn.style.removeProperty("--ran-x");
62
+ this._btn.style.removeProperty("--ran-y");
63
+ this.debounceMouseEvent();
64
+ }, 600);
65
+ });
66
+ __publicField(this, "debounceMouseEvent", () => {
67
+ clearTimeout(this.debounceTimeId);
68
+ this.debounceTimeId = void 0;
69
+ });
70
+ this._slot = document.createElement("slot");
71
+ this._btnContent = document.createElement("div");
72
+ this._btn = document.createElement("div");
73
+ this._btn.setAttribute("class", "ran-btn");
74
+ this._btn.setAttribute("part", "ran-btn");
75
+ this._btnContent.setAttribute("class", "ran-btn-content");
76
+ this._btnContent.setAttribute("part", "ran-btn-content");
77
+ this._btnContent.appendChild(this._slot);
78
+ this._slot.setAttribute("class", "slot");
79
+ const shadowRoot = this.attachShadow({ mode: "closed" });
80
+ const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
81
+ F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
82
+ shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
83
+ this._shadowDom = shadowRoot;
84
+ this._btn.appendChild(this._btnContent);
85
+ shadowRoot.appendChild(this._btn);
86
+ }
87
+ static get observedAttributes() {
88
+ return ["disabled", "icon", "effect", "iconSize", "sheet"];
89
+ }
90
+ get sheet() {
91
+ return this.getAttribute("sheet");
92
+ }
93
+ set sheet(value) {
94
+ this.setAttribute("sheet", value || "");
95
+ }
96
+ get disabled() {
97
+ return isDisabled(this);
98
+ }
99
+ set disabled(value) {
100
+ if (!value || value === "false") {
101
+ this.removeAttribute("disabled");
102
+ this.removeAttribute("aria-disabled");
103
+ } else {
104
+ this.setAttribute("disabled", "");
105
+ this.setAttribute("aria-disabled", "true");
106
+ }
107
+ }
108
+ get iconSize() {
109
+ return this.getAttribute("iconSize");
110
+ }
111
+ set iconSize(value) {
112
+ if (!value || value === "false") {
113
+ this.removeAttribute("iconSize");
114
+ } else {
115
+ this.setAttribute("iconSize", value);
116
+ this.setIcon();
117
+ }
118
+ }
119
+ get icon() {
120
+ return this.getAttribute("icon");
121
+ }
122
+ set icon(value) {
123
+ if (!value || value === "false") {
124
+ this.removeAttribute("icon");
125
+ } else {
126
+ this.setAttribute("icon", value);
127
+ this.setIcon();
128
+ }
129
+ }
130
+ get effect() {
131
+ return this.getAttribute("effect");
132
+ }
133
+ set effect(value) {
134
+ if (falseList.includes(value) || !value) {
135
+ this.removeAttribute("effect");
136
+ } else {
137
+ this.setAttribute("effect", value);
138
+ }
139
+ }
140
+ handlerExternalCss() {
141
+ if (this.sheet) {
142
+ try {
143
+ const sheet = new CSSStyleSheet();
144
+ sheet.insertRule(this.sheet);
145
+ this._shadowDom.adoptedStyleSheets = [sheet];
146
+ } catch (error) {
147
+ console.error(
148
+ `Failed to parse the rule in CSSStyleSheet: ${this.sheet}`
149
+ );
150
+ }
151
+ }
152
+ }
153
+ connectedCallback() {
154
+ this._btn.addEventListener("mousedown", this.mousedown);
155
+ this._btn.addEventListener("mouseup", this.mouseup);
156
+ this.handlerExternalCss();
157
+ this.setIcon();
158
+ this.setAttribute("role", "button");
159
+ this.setAttribute("tabindex", "0");
160
+ }
161
+ disconnectCallback() {
162
+ this._btn.removeEventListener("mousedown", this.mousedown);
163
+ this._btn.removeEventListener("mouseup", this.mouseup);
164
+ }
165
+ attributeChangedCallback(name, oldValue, newValue) {
166
+ if (name === "disabled" && this._btnContent) {
167
+ if (!newValue || newValue === "false") {
168
+ this._btnContent.setAttribute("disabled", "");
169
+ } else {
170
+ this._btnContent.removeAttribute("disabled");
171
+ }
172
+ }
173
+ if (name === "icon" && this._btnContent && oldValue !== newValue)
174
+ this.setIcon();
175
+ if (name === "iconSize" && this._btnContent && oldValue !== newValue)
176
+ this._btnContent.setAttribute("iconSize", newValue);
177
+ if (name === "sheet" && this._shadowDom && oldValue !== newValue)
178
+ this.handlerExternalCss();
179
+ }
180
+ }
181
+ customElements.define("r-button", Button);
182
+ return Button;
183
+ } else {
184
+ return createCustomError("document is undefined or r-button is exist");
185
+ }
186
+ }
187
+ const index = Custom();
188
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
189
+ __proto__: null,
190
+ default: index
191
+ }, Symbol.toStringTag, { value: "Module" }));
192
+ export {
193
+ index as a,
194
+ index$1 as i
195
+ };
@@ -0,0 +1,48 @@
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
+ const falseList = [false, "false", null, void 0];
8
+ const isDisabled = (element) => {
9
+ const status = element.hasAttribute("disabled");
10
+ const value = element.getAttribute("disabled");
11
+ if (status && !falseList.includes(value))
12
+ return true;
13
+ return false;
14
+ };
15
+ const removeClassToElementChild = (parent, deleteClass) => {
16
+ const pre = parent.querySelectorAll(`.${deleteClass}`);
17
+ if (pre.length > 0) {
18
+ pre.forEach((item) => item.classList.remove(deleteClass));
19
+ }
20
+ };
21
+ const loadScript = (src) => {
22
+ return new Promise((resolve, reject) => {
23
+ const script = document.createElement("script");
24
+ script.src = src;
25
+ script.onload = function() {
26
+ resolve({ success: true });
27
+ };
28
+ script.onerror = function(error) {
29
+ reject({ success: false, error });
30
+ };
31
+ document.body.append(script);
32
+ });
33
+ };
34
+ function createCustomError(msg) {
35
+ return class CustomError {
36
+ constructor(message = msg) {
37
+ __publicField(this, "message");
38
+ this.message = message;
39
+ }
40
+ };
41
+ }
42
+ export {
43
+ createCustomError as c,
44
+ falseList as f,
45
+ isDisabled as i,
46
+ loadScript as l,
47
+ removeClassToElementChild as r
48
+ };
@@ -0,0 +1,126 @@
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
+ const f7170ee498e0dd32cbdcb63fba8f75cc = "";
8
+ function CustomElement() {
9
+ if (typeof window !== "undefined" && !customElements.get("r-tab")) {
10
+ class TabPane extends HTMLElement {
11
+ constructor() {
12
+ super();
13
+ __publicField(this, "_div");
14
+ __publicField(this, "parent");
15
+ /**
16
+ * @description: 在页面元素都加载完毕后,设置 tab 上的图标
17
+ */
18
+ __publicField(this, "initAttribute", () => {
19
+ var _a, _b, _c;
20
+ this.parent = this.parentNode;
21
+ this.key && ((_a = this.parent) == null ? void 0 : _a.updateAttribute(this.key, "icon", this.icon));
22
+ this.key && ((_b = this.parent) == null ? void 0 : _b.updateAttribute(this.key, "iconSize", this.iconSize));
23
+ this.key && ((_c = this.parent) == null ? void 0 : _c.updateAttribute(this.key, "effect", this.effect));
24
+ });
25
+ this._div = document.createElement("slot");
26
+ const shadowRoot = this.attachShadow({ mode: "closed" });
27
+ const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
28
+ F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
29
+ shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
30
+ shadowRoot.appendChild(this._div);
31
+ }
32
+ static get observedAttributes() {
33
+ return ["label", "key", "disabled", "icon", "effect", "iconSize"];
34
+ }
35
+ get label() {
36
+ return this.getAttribute("label") || "";
37
+ }
38
+ set label(value) {
39
+ this.setAttribute("label", value);
40
+ }
41
+ get icon() {
42
+ return this.getAttribute("icon");
43
+ }
44
+ set icon(value) {
45
+ if (!value || value === "false") {
46
+ this.removeAttribute("icon");
47
+ } else {
48
+ this.setAttribute("icon", value);
49
+ }
50
+ }
51
+ get iconSize() {
52
+ return this.getAttribute("iconSize");
53
+ }
54
+ set iconSize(value) {
55
+ if (!value || value === "false") {
56
+ this.removeAttribute("iconSize");
57
+ } else {
58
+ this.setAttribute("iconSize", value);
59
+ }
60
+ }
61
+ get key() {
62
+ return this.getAttribute("r-key");
63
+ }
64
+ set key(value) {
65
+ if (value) {
66
+ this.setAttribute("r-key", value);
67
+ } else {
68
+ this.removeAttribute("r-key");
69
+ }
70
+ }
71
+ get disabled() {
72
+ return this.getAttribute("disabled");
73
+ }
74
+ set disabled(value) {
75
+ if (!value || value === "false") {
76
+ this.removeAttribute("disabled");
77
+ } else {
78
+ this.setAttribute("disabled", value);
79
+ }
80
+ }
81
+ get effect() {
82
+ return this.getAttribute("effect");
83
+ }
84
+ set effect(value) {
85
+ if (!value || value === "false") {
86
+ this.removeAttribute("effect");
87
+ } else {
88
+ this.setAttribute("effect", value);
89
+ }
90
+ }
91
+ onClick(e) {
92
+ }
93
+ connectedCallback() {
94
+ this._div.addEventListener("click", this.onClick);
95
+ document.addEventListener("DOMContentLoaded", this.initAttribute);
96
+ }
97
+ disconnectCallback() {
98
+ document.removeEventListener("DOMContentLoaded", this.initAttribute);
99
+ }
100
+ attributeChangedCallback(name, oldValue, newValue) {
101
+ var _a, _b, _c, _d, _e;
102
+ if (oldValue !== newValue && this.key && ((_a = this.parent) == null ? void 0 : _a.updateAttribute)) {
103
+ if (name === "icon")
104
+ (_b = this.parent) == null ? void 0 : _b.updateAttribute(this.key, "icon", newValue);
105
+ if (name === "iconSize")
106
+ (_c = this.parent) == null ? void 0 : _c.updateAttribute(this.key, "iconSize", newValue);
107
+ if (name === "effect")
108
+ (_d = this.parent) == null ? void 0 : _d.updateAttribute(this.key, "effect", newValue);
109
+ if (name === "disabled")
110
+ (_e = this.parent) == null ? void 0 : _e.updateAttribute(this.key, "disabled", newValue);
111
+ }
112
+ }
113
+ }
114
+ customElements.define("r-tab", TabPane);
115
+ return TabPane;
116
+ }
117
+ }
118
+ const index = CustomElement();
119
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
120
+ __proto__: null,
121
+ default: index
122
+ }, Symbol.toStringTag, { value: "Module" }));
123
+ export {
124
+ index as a,
125
+ index$1 as i
126
+ };