ranui 0.1.9 → 0.1.10-alpha-24

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 (199) hide show
  1. package/README.zh-CN.md +192 -0
  2. package/dist/assets/image/failImage.d.ts +2 -0
  3. package/dist/button.js +7 -0
  4. package/dist/checkbox.js +7 -0
  5. package/dist/colorpicker.js +11 -0
  6. package/dist/components/button/index.d.ts +8 -5
  7. package/dist/components/checkbox/index.d.ts +30 -0
  8. package/dist/components/colorpicker/index.d.ts +120 -0
  9. package/dist/components/dropdown/index.d.ts +34 -0
  10. package/dist/components/input/index.d.ts +66 -41
  11. package/dist/components/loading/index.d.ts +76 -0
  12. package/dist/components/math/index.d.ts +16 -0
  13. package/dist/components/message/index.d.ts +10 -7
  14. package/dist/components/player/index.d.ts +46 -9
  15. package/dist/components/popover/content/index.d.ts +16 -0
  16. package/dist/components/popover/index.d.ts +91 -0
  17. package/dist/components/preview/constant.d.ts +5 -0
  18. package/dist/components/preview/index.d.ts +1 -4
  19. package/dist/components/preview/pdf.d.ts +51 -1
  20. package/dist/components/preview/types.d.ts +11 -0
  21. package/dist/components/progress/index.d.ts +12 -7
  22. package/dist/components/radar/index.d.ts +1 -1
  23. package/dist/components/scratch/index.d.ts +7 -5
  24. package/dist/components/select/dropdown-item/index.d.ts +23 -0
  25. package/dist/components/select/index.d.ts +22 -13
  26. package/dist/components/select/option/index.d.ts +2 -0
  27. package/dist/components/tab/index.d.ts +80 -64
  28. package/dist/components/tabpane/index.d.ts +73 -57
  29. package/dist/icon.js +6 -0
  30. package/dist/iconShadowless.js +6 -0
  31. package/dist/image.js +4 -0
  32. package/dist/{index-01b17e26.js → index-BEm1a2pr.js} +3 -6
  33. package/dist/{index-e2e5d725.js → index-BSyn-jmY.js} +4734 -2976
  34. package/dist/index-BVD0qcjJ.js +656 -0
  35. package/dist/{index-e03d23e7.js → index-Bb55l8nf.js} +2 -11
  36. package/dist/{index-0d5b9435.js → index-BbW0dxzy.js} +12 -16
  37. package/dist/index-BgUpm4LA.js +103 -0
  38. package/dist/{index-458debf7.js → index-C841uRgZ.js} +16 -51
  39. package/dist/{index-4443363f.js → index-CUZna268.js} +41 -69
  40. package/dist/index-CiA5qRK3.js +381 -0
  41. package/dist/index-CoJMn8Jm.js +511 -0
  42. package/dist/{index-b7790662.js → index-DAxs7Dd2.js} +6 -13
  43. package/dist/index-D_cD4u43.js +70 -0
  44. package/dist/index-DgVgxN1s.js +309 -0
  45. package/dist/index-DghvN1MU.js +710 -0
  46. package/dist/index-DvSe_Ms7.js +494 -0
  47. package/dist/{index-7216d6b0.js → index-W52VzrXL.js} +20 -49
  48. package/dist/index-gBy2cXLV.js +140 -0
  49. package/dist/index-hdtEL8P_.js +101 -0
  50. package/dist/{index-1048a998.js → index-jVKJoKXA.js} +105 -62
  51. package/dist/{index-2d16a084.js → index-ltt3w4zP.js} +13 -23
  52. package/dist/index-n4X6wdwJ.js +156 -0
  53. package/dist/{index-3cf72afd.js → index-s0ioL3L2.js} +23 -45
  54. package/dist/index.d.ts +276 -14
  55. package/dist/index.js +24 -24
  56. package/dist/input.js +7 -0
  57. package/dist/inputShadowless.js +6 -0
  58. package/dist/katex-es-CGqSCDjs.js +14634 -0
  59. package/dist/loading-scene-BMc2wqKm.js +4 -0
  60. package/dist/loading.js +8 -0
  61. package/dist/math.js +7 -0
  62. package/dist/message.js +6 -0
  63. package/dist/modal.js +4 -0
  64. package/dist/more-2vsTDpcc.js +31 -0
  65. package/dist/pdf-Bis_tkvj.js +134 -0
  66. package/dist/player.js +8 -0
  67. package/dist/plus-DgJxWGlo.js +56799 -0
  68. package/dist/popover.js +9 -0
  69. package/dist/preview.js +7 -0
  70. package/dist/progress.js +7 -0
  71. package/dist/radar.js +6 -0
  72. package/dist/ranui.css +1 -0
  73. package/dist/search-BWdfjyP8.js +4 -0
  74. package/dist/select.js +10 -0
  75. package/dist/{index-1b73beee.js → selectShadowless.js} +159 -167
  76. package/dist/{umd/components → shadowless}/icon/index.d.ts +1 -0
  77. package/dist/{umd/components → shadowless}/input/index.d.ts +66 -41
  78. package/dist/{umd/components → shadowless}/select/index.d.ts +19 -16
  79. package/dist/shadowless/select/option/index.d.ts +2 -0
  80. package/dist/shadowless.d.ts +3 -0
  81. package/dist/shadowless.js +8 -0
  82. package/dist/skeleton.js +4 -0
  83. package/dist/sort-DWqiUONr.js +4 -0
  84. package/dist/sprite-CH2zLtZy.js +141 -0
  85. package/dist/tab.js +6 -0
  86. package/dist/tabpane.js +4 -0
  87. package/dist/tsconfig.json +31 -0
  88. package/dist/typings.d.ts +257 -0
  89. package/dist/umd/index.css +1 -0
  90. package/dist/umd/index.umd.cjs +1 -71
  91. package/dist/umd/shadowless/shadowless.css +1 -0
  92. package/dist/umd/shadowless/shadowless.umd.cjs +1 -0
  93. package/dist/utils/color.d.ts +52 -0
  94. package/dist/utils/image.d.ts +8 -1
  95. package/dist/utils/index.d.ts +20 -5
  96. package/dist/utils/math.d.ts +3 -3
  97. package/dist/vite.config.d.ts +1 -0
  98. package/dist/without-content-CdJw7vHM.js +4 -0
  99. package/package.json +115 -64
  100. package/readme.md +41 -57
  101. package/typings.d.ts +257 -0
  102. package/dist/colz-746223ab.js +0 -241
  103. package/dist/components/button/index.js +0 -8
  104. package/dist/components/icon/index.js +0 -6
  105. package/dist/components/image/index.js +0 -4
  106. package/dist/components/input/index.js +0 -6
  107. package/dist/components/message/index.js +0 -4
  108. package/dist/components/modal/index.js +0 -4
  109. package/dist/components/option/index.d.ts +0 -2
  110. package/dist/components/option/index.js +0 -95
  111. package/dist/components/player/index.js +0 -12
  112. package/dist/components/preview/colz.d.ts +0 -72
  113. package/dist/components/preview/docx.d.ts +0 -8
  114. package/dist/components/preview/excel/excel.d.ts +0 -2
  115. package/dist/components/preview/excel/index.d.ts +0 -1
  116. package/dist/components/preview/excel/media.d.ts +0 -37
  117. package/dist/components/preview/index.js +0 -8
  118. package/dist/components/preview/pptx/index.d.ts +0 -16
  119. package/dist/components/preview/pptx/process_pptx.d.ts +0 -23
  120. package/dist/components/preview/pptx/t_xml.d.ts +0 -1
  121. package/dist/components/preview/pptx/worker.d.ts +0 -1
  122. package/dist/components/progress/index.js +0 -8
  123. package/dist/components/radar/index.js +0 -7
  124. package/dist/components/select/index.js +0 -11
  125. package/dist/components/skeleton/index.js +0 -4
  126. package/dist/components/tab/index.js +0 -7
  127. package/dist/components/tabpane/index.js +0 -4
  128. package/dist/docx-c5d02d8c.js +0 -21
  129. package/dist/index-57492b9b.js +0 -48
  130. package/dist/index-73ce455b.js +0 -264
  131. package/dist/index-7913ec46.js +0 -239
  132. package/dist/index-7b8840f9.js +0 -18690
  133. package/dist/index-c14450a9.js +0 -662
  134. package/dist/pdf-bdb7818a.js +0 -113
  135. package/dist/style.css +0 -1
  136. package/dist/umd/build/config.d.ts +0 -3
  137. package/dist/umd/build/config.umd.d.ts +0 -2
  138. package/dist/umd/components/button/index.d.ts +0 -35
  139. package/dist/umd/components/form/index.d.ts +0 -2
  140. package/dist/umd/components/image/index.d.ts +0 -2
  141. package/dist/umd/components/message/index.d.ts +0 -14
  142. package/dist/umd/components/modal/index.d.ts +0 -2
  143. package/dist/umd/components/option/index.d.ts +0 -2
  144. package/dist/umd/components/player/index.d.ts +0 -213
  145. package/dist/umd/components/preview/colz.d.ts +0 -72
  146. package/dist/umd/components/preview/docx.d.ts +0 -8
  147. package/dist/umd/components/preview/excel/excel.d.ts +0 -2
  148. package/dist/umd/components/preview/excel/index.d.ts +0 -1
  149. package/dist/umd/components/preview/excel/media.d.ts +0 -37
  150. package/dist/umd/components/preview/index.d.ts +0 -6
  151. package/dist/umd/components/preview/pdf.d.ts +0 -1
  152. package/dist/umd/components/preview/pptx/index.d.ts +0 -16
  153. package/dist/umd/components/preview/pptx/process_pptx.d.ts +0 -23
  154. package/dist/umd/components/preview/pptx/t_xml.d.ts +0 -1
  155. package/dist/umd/components/preview/pptx/worker.d.ts +0 -1
  156. package/dist/umd/components/progress/index.d.ts +0 -36
  157. package/dist/umd/components/radar/index.d.ts +0 -2
  158. package/dist/umd/components/scratch/index.d.ts +0 -19
  159. package/dist/umd/components/skeleton/index.d.ts +0 -2
  160. package/dist/umd/components/tab/index.d.ts +0 -408
  161. package/dist/umd/components/tabpane/index.d.ts +0 -352
  162. package/dist/umd/index.d.ts +0 -14
  163. package/dist/umd/playwright.config.d.ts +0 -9
  164. package/dist/umd/plugins/auto-import-file.d.ts +0 -0
  165. package/dist/umd/plugins/load-style.d.ts +0 -6
  166. package/dist/umd/plugins/load-svg.d.ts +0 -9
  167. package/dist/umd/style.css +0 -1
  168. package/dist/umd/tests/button.spec.d.ts +0 -1
  169. package/dist/umd/utils/image.d.ts +0 -32
  170. package/dist/umd/utils/index.d.ts +0 -64
  171. package/dist/umd/utils/math.d.ts +0 -26
  172. package/dist/umd/utils/tween.d.ts +0 -21
  173. package/dist/umd/vite.config.d.ts +0 -6
  174. package/dist/vendor-f71e6f68.js +0 -92126
  175. /package/dist/{add-user-b2bed3e7.js → add-user-BN1JlY7e.js} +0 -0
  176. /package/dist/{book-b11a68eb.js → book-nTEFXU2x.js} +0 -0
  177. /package/dist/{umd/build/config.es.d.ts → build/config.sha.d.ts} +0 -0
  178. /package/dist/{check-circle-fill-dc284144.js → check-circle-fill-B_pd8ZSs.js} +0 -0
  179. /package/dist/{check-circle-74bd09c3.js → check-circle-szyAJiap.js} +0 -0
  180. /package/dist/{close-20925345.js → close-CFnkhudp.js} +0 -0
  181. /package/dist/{close-circle-720c18be.js → close-circle-CwmuN2C6.js} +0 -0
  182. /package/dist/{close-circle-fill-238a66b1.js → close-circle-fill-jSqPPw9i.js} +0 -0
  183. /package/dist/{eye-5e742329.js → eye-D_mEt17f.js} +0 -0
  184. /package/dist/{eye-close-3874f1ae.js → eye-close-BVr3NJtg.js} +0 -0
  185. /package/dist/{home-c4a05e8b.js → home-BUQ4USMk.js} +0 -0
  186. /package/dist/{index-8e1e2573.js → index-CQTJoWhb.js} +0 -0
  187. /package/dist/{info-circle-5826decc.js → info-circle-COnL5bTJ.js} +0 -0
  188. /package/dist/{info-circle-fill-90ec9aa9.js → info-circle-fill-DjI8gXS3.js} +0 -0
  189. /package/dist/{loading-09ca52df.js → loading-Dcc5RApI.js} +0 -0
  190. /package/dist/{lock-1d2487c9.js → lock-Cr7BnmWN.js} +0 -0
  191. /package/dist/{message-b2bfdea7.js → message-D36_Zo2l.js} +0 -0
  192. /package/dist/{power-off-6ade5a91.js → power-off-lQRbiBak.js} +0 -0
  193. /package/dist/{preview-b291aea8.js → preview-CJbz9GjO.js} +0 -0
  194. /package/dist/{setting-1e5ccb6d.js → setting-DemlgzVC.js} +0 -0
  195. /package/dist/{team-ca6a12e1.js → team-tl4NJXPC.js} +0 -0
  196. /package/dist/{unlock-f56086fd.js → unlock-CeU74z9n.js} +0 -0
  197. /package/dist/{user-5c01e665.js → user-B-eVXwuk.js} +0 -0
  198. /package/dist/{warning-circle-035e025c.js → warning-circle-DDUgEDIv.js} +0 -0
  199. /package/dist/{warning-circle-fill-d17c37c9.js → warning-circle-fill-lODUKz0i.js} +0 -0
@@ -1,10 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
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 = '.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}@keyframes skeleton{0%{transform:translate(-37.5%)}to{transform:translate(37.5%)}}.ran-skeleton{position:relative;z-index:0;overflow:hidden;background:0 0;width:100%;height:16px;background:rgba(0,0,0,.06);border-radius:4px}.ran-skeleton:after{position:absolute;top:0;inset-inline-end:-150%;bottom:0;inset-inline-start:-150%;background:linear-gradient(90deg,rgba(0,0,0,.06) 25%,rgba(0,0,0,.15) 37%,rgba(0,0,0,.06) 63%);animation-name:skeleton;animation-duration:1.4s;animation-timing-function:ease;animation-iteration-count:infinite;content:""}\n';
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ 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}@keyframes skeleton{0%{transform:translate(-37.5%)}to{transform:translate(37.5%)}}.ran-skeleton{position:relative;z-index:0;overflow:hidden;background:0 0;width:100%;height:16px;background:#0000000f;border-radius:4px}.ran-skeleton:after{position:absolute;top:0;inset-inline-end:-150%;bottom:0;inset-inline-start:-150%;background:linear-gradient(90deg,#0000000f 25%,#00000026 37%,#0000000f 63%);animation-name:skeleton;animation-duration:1.4s;animation-timing-function:ease;animation-iteration-count:infinite;content:""}';
8
5
  function Skeleton() {
9
6
  if (typeof window !== "undefined" && !customElements.get("r-skeleton")) {
10
7
  class CustomElement extends HTMLElement {
@@ -22,12 +19,6 @@ function Skeleton() {
22
19
  static get observedAttributes() {
23
20
  return ["disabled"];
24
21
  }
25
- connectedCallback() {
26
- }
27
- disconnectCallback() {
28
- }
29
- attributeChangedCallback(name, oldValue, newValue) {
30
- }
31
22
  }
32
23
  window.customElements.define("r-skeleton", CustomElement);
33
24
  }
@@ -1,11 +1,9 @@
1
1
  var __defProp = Object.defineProperty;
2
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 = '.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"]){--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 = "";
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { c as create } from "./plus-DgJxWGlo.js";
5
+ import "./index-n4X6wdwJ.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))}';
9
7
  const AnimationTime = 300;
10
8
  const defaultDuration = 3e3;
11
9
  const typeMapIcon = /* @__PURE__ */ new Map([
@@ -63,7 +61,7 @@ function Custom() {
63
61
  this._notice.appendChild(this._content);
64
62
  const shadowRoot = this.attachShadow({ mode: "closed" });
65
63
  const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
66
- F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
64
+ F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = less;
67
65
  shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
68
66
  shadowRoot.appendChild(this._notice);
69
67
  }
@@ -74,15 +72,13 @@ function Custom() {
74
72
  return this.getAttribute("type");
75
73
  }
76
74
  set type(value) {
77
- if (value)
78
- this.setAttribute("type", value);
75
+ if (value) this.setAttribute("type", value);
79
76
  }
80
77
  get content() {
81
78
  return this.getAttribute("content");
82
79
  }
83
80
  set content(value) {
84
- if (value)
85
- this.setAttribute("content", value);
81
+ if (value) this.setAttribute("content", value);
86
82
  }
87
83
  attributeChangedCallback(name, oldValue, newValue) {
88
84
  if (name === "content" && oldValue !== newValue) {
@@ -95,9 +91,11 @@ function Custom() {
95
91
  }
96
92
  customElements.define("r-message", CustomMessage);
97
93
  const container = document.createElement("div");
94
+ const style = create("style").setTextContent(less);
98
95
  const div = document.createElement("div");
99
96
  div.setAttribute("class", "ranui-message");
100
97
  document.body.appendChild(container);
98
+ container.appendChild(style.element);
101
99
  container.appendChild(div);
102
100
  const commonPrompt = (type) => {
103
101
  return (options) => {
@@ -107,8 +105,7 @@ function Custom() {
107
105
  message2.setAttribute("type", type);
108
106
  let duration = defaultDuration;
109
107
  let close;
110
- if (!options)
111
- return;
108
+ if (!options) return;
112
109
  if (typeof options === "string") {
113
110
  message2.setAttribute("content", options);
114
111
  } else {
@@ -124,8 +121,7 @@ function Custom() {
124
121
  message2.timeId = setTimeout(() => {
125
122
  message2.classList.remove("message-leave");
126
123
  div.removeChild(message2);
127
- if (close)
128
- close();
124
+ if (close) close();
129
125
  }, duration);
130
126
  div.appendChild(message2);
131
127
  message2.classList.add("message-in");
@@ -142,7 +138,7 @@ function Custom() {
142
138
  toast: commonPrompt("toast")
143
139
  };
144
140
  }
145
- return {};
141
+ return null;
146
142
  }
147
143
  const message = Custom();
148
144
  if (typeof window !== "undefined" && message) {
@@ -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) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { c as create, a as addClassToElement, r as removeClassToElement } from "./plus-DgJxWGlo.js";
5
+ import { c as createCustomError, H as HTMLElementSSR } from "./index-hdtEL8P_.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}@keyframes ranui-dropdown-up-in{0%{transform:scaleY(.8);transform-origin:100% 100%;opacity:0}to{transform:scaleY(1);transform-origin:100% 100%;opacity:1}}@keyframes ranui-dropdown-up-out{0%{transform:scaleY(1);transform-origin:100% 100%;opacity:1}to{transform:scaleY(.8);transform-origin:100% 100%;opacity:0}}@keyframes ranui-dropdown-down-in{0%{transform:scaleY(.8);transform-origin:0% 0%;opacity:0}to{transform:scaleY(1);transform-origin:0% 0%;opacity:1}}@keyframes ranui-dropdown-down-out{0%{transform:scaleY(1);transform-origin:0% 0%;opacity:1}to{transform:scaleY(.8);transform-origin:0% 0%;opacity:0}}@keyframes ranui-dropdown-left-in{0%{transform:scaleX(.8);transform-origin:100% 0%;opacity:0}to{transform:scaleX(1);transform-origin:100% 0%;opacity:1}}@keyframes ranui-dropdown-left-out{0%{transform:scaleX(1);transform-origin:100% 0%;opacity:1}to{transform:scaleX(.8);transform-origin:100% 0%;opacity:0}}@keyframes ranui-dropdown-right-in{0%{transform:scaleX(.8);transform-origin:0% 0%;opacity:0}to{transform:scaleX(1);transform-origin:0% 0%;opacity:1}}@keyframes ranui-dropdown-right-out{0%{transform:scaleX(1);transform-origin:0% 0%;opacity:1}to{transform:scaleX(.8);transform-origin:0% 0%;opacity:0}}.ran-dropdown-down-in{animation:ranui-dropdown-down-in .1s;animation-fill-mode:forwards}.ran-dropdown-down-out{animation:ranui-dropdown-down-out .1s;animation-fill-mode:forwards}.ran-dropdown-up-in{animation:ranui-dropdown-up-in .1s;animation-fill-mode:forwards}.ran-dropdown-up-out{animation:ranui-dropdown-up-out .1s;animation-fill-mode:forwards}.ran-dropdown-left-in{animation:ranui-dropdown-left-in .1s;animation-fill-mode:forwards}.ran-dropdown-left-out{animation:ranui-dropdown-left-out .1s;animation-fill-mode:forwards}.ran-dropdown-right-in{animation:ranui-dropdown-right-in .1s;animation-fill-mode:forwards}.ran-dropdown-right-out{animation:ranui-dropdown-right-out .1s;animation-fill-mode:forwards}:host{text-align:var(--ran-dropdown-host-text-align, left);z-index:10}.ranui-dropdown{transform-origin:var(--ran-x, 50%) var(--ran-y, 50%);box-sizing:var(--ran-dropdown-box-sizing, border-box);margin:var(--ran-dropdown-margin, 0);padding:var(--ran-dropdown-padding, 0);color:var(--ran-dropdown-color, rgba(0, 0, 0, .88));font-size:var(--ran-dropdown-font-size, 14px);list-style:var(--ran-dropdown-list-style, none);font-family:var(--ran-dropdown-font-family, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");z-index:var(--ran-dropdown-z-index, 1050);overflow:var(--ran-dropdown-overflow, hidden);font-variant:var(--ran-dropdown-font-variant, initial);background:var(--ran-dropdown-background, #ffffff);border-radius:var(--ran-dropdown-border-radius, 8px);outline:var(--ran-dropdown-outline, none);box-shadow:var(--ran-dropdown-box-shadow, 0 6px 16px 0 rgba(0, 0, 0, .08), 0 3px 6px -4px rgba(0, 0, 0, .12), 0 9px 28px 8px rgba(0, 0, 0, .05));cursor:var(--ran-dropdown-cursor, auto);width:var(--ran-dropdown-width, 100%);height:var(--ran-dropdown-height, 100%);min-height:var(--ran-popover-height, 100%);min-width:var(--ran-popover-width, 100%)}.ranui-dropdown-container{position:var(--ran-dropdown-container-position, relative);display:var(--ran-dropdown-container-display, block);width:var(--ran-dropdown-container-width, 100%);height:var(--ran-dropdown-container-height, 100%);box-sizing:var(--ran-dropdown-container-box-sizing, border-box)}.ranui-dropdown-container .top{transform:translate(calc(var(--ran-popover-width) / 2 - calc(var(--ran-dropdown-arrow-width, 16px) / 2))) translateY(-16px) rotate(0);top:0}.ranui-dropdown-container .bottom{transform:translate(calc(var(--ran-popover-width) / 2 - calc(var(--ran-dropdown-arrow-width, 16px) / 2))) translateY(0) rotate(180deg);top:calc(var(--ran-popover-height) - calc(var(--ran-dropdown-arrow-width, 16px) / 4),0px)}.ranui-dropdown-container .left{transform:translate(calc(0px - var(--ran-dropdown-arrow-width, 16px))) translateY(calc(var(--ran-dropdown-arrow-width, 16px) / 2)) rotate(270deg);top:max(0px,calc(var(--ran-popover-height) / 2 - calc(var(--ran-dropdown-arrow-width, 16px))))}.ranui-dropdown-container .right{left:100%;transform:translate(0) translateY(calc(var(--ran-popover-height) / 2 - calc(var(--ran-dropdown-arrow-width, 16px) / 2))) rotate(90deg);top:0}.ranui-dropdown-arrow{position:var(--ran-dropdown-arrow-position, absolute);box-sizing:var(--ran-dropdown-arrow-box-sizing, border-box);z-index:var(--ran-dropdown-arrow-z-index, 1);display:var(--ran-dropdown-arrow-display, block);pointer-events:var(--ran-dropdown-arrow-pointer-events, none);width:var(--ran-dropdown-arrow-width, var(--ran-dropdown-arrow-width, 16px));height:var(--ran-dropdown-arrow-height, var(--ran-dropdown-arrow-width, 16px));overflow:var(--ran-dropdown-arrow-overflow, hidden)}.ranui-dropdown-arrow:before{background:var(--ran-dropdown-arrow-before-background, #fff);position:var(--ran-dropdown-arrow-before-position, absolute);bottom:var(--ran-dropdown-arrow-before-bottom, 0);inset-inline-start:0;width:var(--ran-dropdown-arrow-before-width, var(--ran-dropdown-arrow-width, 16px));height:var(--ran-dropdown-arrow-before-height, calc(var(--ran-dropdown-arrow-width, 16px) / 2));clip-path:path("M 0 8 A 4 4 0 0 0 2.82842712474619 6.82842712474619 L 6.585786437626905 3.0710678118654755 A 2 2 0 0 1 9.414213562373096 3.0710678118654755 L 13.17157287525381 6.82842712474619 A 4 4 0 0 0 16 8 Z");content:var(--ran-dropdown-arrow-before-content, "")}.ranui-dropdown-arrow:after{content:var(--ran-dropdown-arrow-after-content, "");position:var(--ran-dropdown-arrow-after-position, absolute);width:var(--ran-dropdown-arrow-after-width, 9px);height:var(--ran-dropdown-arrow-after-height, 9px);bottom:var(--ran-dropdown-arrow-after-bottom, 0);inset-inline:0;margin:var(--ran-dropdown-arrow-after-margin, auto);border-radius:var(--ran-dropdown-arrow-after-border-radius, 0 0 2px 0);transform:var(--ran-dropdown-arrow-after-transform, translateY(50%) rotate(-135deg));box-shadow:var(--ran-dropdown-arrow-after-box-shadow, 2px 2px 5px rgba(0, 0, 0, .05));z-index:var(--ran-dropdown-arrow-after-z-index, 0);background:var(--ran-dropdown-arrow-after-background, transparent)}';
7
+ const animationTime = 300;
8
+ class Dropdown extends HTMLElementSSR() {
9
+ constructor() {
10
+ super();
11
+ __publicField(this, "dropdown");
12
+ __publicField(this, "_slot");
13
+ __publicField(this, "_shadowDom");
14
+ __publicField(this, "arrowIcon");
15
+ __publicField(this, "container");
16
+ __publicField(this, "handlerTransit", () => {
17
+ if (this.transit) {
18
+ addClassToElement(this.dropdown.element, this.transit);
19
+ setTimeout(() => {
20
+ removeClassToElement(this.dropdown.element, this.transit);
21
+ }, animationTime);
22
+ }
23
+ });
24
+ __publicField(this, "handlerArrow", () => {
25
+ if (!this.arrow) return;
26
+ if (!this.arrowIcon) {
27
+ this.arrowIcon = create("div").setAttribute("class", `ranui-dropdown-arrow ${this.arrow}`);
28
+ this.container.addChild([this.arrowIcon]);
29
+ }
30
+ });
31
+ __publicField(this, "stopPropagation", (e) => {
32
+ e.stopPropagation();
33
+ });
34
+ this._slot = create("slot").setAttribute("class", "slot");
35
+ this.dropdown = create("div").setStyle("-webkit-tap-highlight-color", "transparent").setStyle("outline", "0").setAttribute("class", "ranui-dropdown").setAttribute("part", "ranui-dropdown").addChild([this._slot]);
36
+ this.container = create("div").setAttribute("class", "ranui-dropdown-container").addChild([this.dropdown]);
37
+ const shadowRoot = this.attachShadow({ mode: "closed" });
38
+ const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
39
+ F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
40
+ shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
41
+ this._shadowDom = shadowRoot;
42
+ shadowRoot.appendChild(this.container.element);
43
+ }
44
+ static get observedAttributes() {
45
+ return ["transit", "arrow"];
46
+ }
47
+ get transit() {
48
+ return this.getAttribute("transit") || "";
49
+ }
50
+ set transit(value) {
51
+ if (value) {
52
+ this.setAttribute("transit", value);
53
+ } else {
54
+ this.removeAttribute("transit");
55
+ }
56
+ }
57
+ get arrow() {
58
+ return this.getAttribute("arrow") || "";
59
+ }
60
+ set arrow(value) {
61
+ if (value) {
62
+ this.setAttribute("arrow", value);
63
+ } else {
64
+ this.removeAttribute("arrow");
65
+ }
66
+ }
67
+ get show() {
68
+ return this.getAttribute("show") || "";
69
+ }
70
+ set show(value) {
71
+ if (value) {
72
+ this.setAttribute("show", value);
73
+ } else {
74
+ this.removeAttribute("show");
75
+ }
76
+ }
77
+ connectedCallback() {
78
+ this.handlerTransit();
79
+ this.handlerArrow();
80
+ }
81
+ disconnectedCallback() {
82
+ }
83
+ attributeChangedCallback(name, _, newValue) {
84
+ if (name === "transit" && newValue) {
85
+ addClassToElement(this.dropdown.element, this.transit);
86
+ setTimeout(() => {
87
+ removeClassToElement(this.dropdown.element, this.transit);
88
+ }, animationTime);
89
+ }
90
+ if (name === "arrow") {
91
+ this.handlerArrow();
92
+ }
93
+ }
94
+ }
95
+ function Custom() {
96
+ if (typeof document !== "undefined" && !customElements.get("r-dropdown")) {
97
+ customElements.define("r-dropdown", Dropdown);
98
+ return Dropdown;
99
+ } else {
100
+ return createCustomError("document is undefined or r-dropdown is exist");
101
+ }
102
+ }
103
+ Custom();
@@ -1,12 +1,9 @@
1
1
  var __defProp = Object.defineProperty;
2
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 { g as getPixelRatio } from "./index-7913ec46.js";
8
- import { c as createCustomError } from "./index-57492b9b.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}.ran-radar{position:relative;width:100%;height:100%;display:block}\n";
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { g as getPixelRatio } from "./plus-DgJxWGlo.js";
5
+ import { c as createCustomError } from "./index-hdtEL8P_.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-radar{position:var(--ran-radar-position, relative);width:var(--ran-radar-width, 100%);height:var(--ran-radar-height, 100%);display:var(--ran-radar-display, block)}";
10
7
  const BACKGROUND_COLOR = "rgba(0,0,0,0)";
11
8
  const FONT_COLOR = "rgba(0,0,0,1)";
12
9
  const POLYGON_COLOR = "#e6e6e6";
@@ -43,13 +40,7 @@ function Custom() {
43
40
  shadowRoot.appendChild(this.abilityRadarChartContainer);
44
41
  }
45
42
  static get observedAttributes() {
46
- return [
47
- "abilitys",
48
- "colorPolygon",
49
- "colorLine",
50
- "fillColor",
51
- "strokeColor"
52
- ];
43
+ return ["abilitys", "colorPolygon", "colorLine", "fillColor", "strokeColor"];
53
44
  }
54
45
  get abilitys() {
55
46
  const item = this.getAttribute("abilitys");
@@ -58,6 +49,7 @@ function Custom() {
58
49
  const result = JSON.parse(item);
59
50
  return result;
60
51
  } catch (error) {
52
+ console.error(`Failed to parse the rule in JSON.parse: ${item}, error: ${error}`);
61
53
  return item;
62
54
  }
63
55
  }
@@ -101,8 +93,7 @@ function Custom() {
101
93
  refreshData() {
102
94
  var _a;
103
95
  const ctx = this.abilityRadarChart.getContext("2d");
104
- if (!this.abilityRadarChartContainer || !ctx)
105
- return;
96
+ if (!this.abilityRadarChartContainer || !ctx) return;
106
97
  const radio = getPixelRatio(ctx);
107
98
  const width = this.abilityRadarChartContainer.clientWidth * radio;
108
99
  const height = this.abilityRadarChartContainer.clientHeight * radio;
@@ -122,8 +113,7 @@ function Custom() {
122
113
  this.drawCircle(ctx);
123
114
  }
124
115
  drawSide(ctx) {
125
- if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle)
126
- return;
116
+ if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle) return;
127
117
  ctx.save();
128
118
  ctx.strokeStyle = this.colorLine;
129
119
  const r = this.mRadius;
@@ -137,8 +127,7 @@ function Custom() {
137
127
  }
138
128
  // 绘制多边形边
139
129
  drawPolygon(ctx) {
140
- if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle)
141
- return;
130
+ if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle) return;
142
131
  ctx.save();
143
132
  ctx.strokeStyle = this.colorPolygon;
144
133
  const r = this.mRadius / 4;
@@ -158,8 +147,7 @@ function Custom() {
158
147
  }
159
148
  // 顶点连线
160
149
  drawLines(ctx) {
161
- if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle)
162
- return;
150
+ if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle) return;
163
151
  ctx.save();
164
152
  ctx.beginPath();
165
153
  ctx.strokeStyle = this.colorLine;
@@ -175,8 +163,7 @@ function Custom() {
175
163
  // 绘制文本
176
164
  drawText(ctx) {
177
165
  var _a, _b, _c, _d;
178
- if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle || !this.mData)
179
- return;
166
+ if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle || !this.mData) return;
180
167
  ctx.save();
181
168
  const radio = getPixelRatio(ctx);
182
169
  const defaultFontSize = this.mCenter / 12;
@@ -254,21 +241,9 @@ function Custom() {
254
241
  ctx.fillStyle = color;
255
242
  ctx.moveTo(x + radius, y);
256
243
  ctx.lineTo(x + width - radius, y);
257
- ctx.arc(
258
- x + width - radius,
259
- y + radius,
260
- radius,
261
- Math.PI * 3 / 2,
262
- Math.PI * 2
263
- );
244
+ ctx.arc(x + width - radius, y + radius, radius, Math.PI * 3 / 2, Math.PI * 2);
264
245
  ctx.lineTo(x + width, y + height - radius);
265
- ctx.arc(
266
- x + width - radius,
267
- y + height - radius,
268
- radius,
269
- Math.PI,
270
- Math.PI / 2
271
- );
246
+ ctx.arc(x + width - radius, y + height - radius, radius, Math.PI, Math.PI / 2);
272
247
  ctx.lineTo(x + radius, y + height);
273
248
  ctx.arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
274
249
  ctx.lineTo(x, y + radius);
@@ -284,8 +259,7 @@ function Custom() {
284
259
  }
285
260
  // 绘制数据区域
286
261
  drawRegion(ctx) {
287
- if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle || !this.mData)
288
- return;
262
+ if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle || !this.mData) return;
289
263
  const radio = getPixelRatio(ctx);
290
264
  ctx.save();
291
265
  ctx.beginPath();
@@ -304,8 +278,7 @@ function Custom() {
304
278
  }
305
279
  // 画点
306
280
  drawCircle(ctx) {
307
- if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle || !this.mData)
308
- return;
281
+ if (!this.mRadius || !this.mCount || !this.mCenter || !this.mAngle || !this.mData) return;
309
282
  const radio = getPixelRatio(ctx);
310
283
  ctx.save();
311
284
  for (let i = 0; i < this.mCount; i++) {
@@ -322,16 +295,8 @@ function Custom() {
322
295
  connectedCallback() {
323
296
  this.refreshData();
324
297
  }
325
- disconnectCallback() {
326
- }
327
298
  attributeChangedCallback(name, oldValue, newValue) {
328
- const attribute = [
329
- "abilitys",
330
- "colorPolygon",
331
- "colorLine",
332
- "fillColor",
333
- "strokeColor"
334
- ];
299
+ const attribute = ["abilitys", "colorPolygon", "colorLine", "fillColor", "strokeColor"];
335
300
  if (attribute.includes(name) && this.abilityRadarChartContainer && oldValue !== newValue) {
336
301
  this.refreshData();
337
302
  }
@@ -1,14 +1,11 @@
1
1
  var __defProp = Object.defineProperty;
2
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 { p as perToNum } from "./index-7913ec46.js";
8
- import { c as createCustomError } from "./index-57492b9b.js";
9
- const index$2 = "";
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { p as perToNum } from "./plus-DgJxWGlo.js";
5
+ import { c as createCustomError, H as HTMLElementSSR } from "./index-hdtEL8P_.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}:host:active,:host:focus{outline:0;-webkit-tap-highlight-color:transparent}.ran-progress{position:var(--ran-progress-position, relative);cursor:var(--ran-progress-cursor, pointer);width:var(--ran-progress-width, 100%);height:var(--ran-progress-height, 100%)}.ran-progress:active,.ran-progress:focus{outline:0;-webkit-tap-highlight-color:transparent}.ran-progress-wrap{width:var(--ran-progress-wrap-width, 100%);height:var(--ran-progress-wrap-height, 8px);border-radius:var(--ran-progress-wrap-border-radius, 20px);background:var(--ran-progress-wrap-background, #5b5b5b);position:var(--ran-progress-wrap-position, relative);overflow:var(--ran-progress-wrap-overflow, hidden)}.ran-progress-wrap-value{position:var(--ran-progress-wrap-value-position, absolute);top:var(--ran-progress-wrap-value-top, 0);left:var(--ran-progress-wrap-value-left, 0);height:var(--ran-progress-wrap-value-height, 100%);width:var(--ran-progress-wrap-value-width, 100%);transform:var(--ran-progress-wrap-value-transform, scaleX(0));transform-origin:var(--ran-progress-wrap-value-transform-origin, 0 0);will-change:var(--ran-progress-wrap-value-will-change, transform);background:var(--ran-progress-wrap-value-background, linear-gradient(90deg, #0bc8bb 2.42%, #00d297 98.79%));border-radius:var(--ran-progress-wrap-value-border-radius, 20px)}.ran-progress-dot{position:var(--ran-progress-dot-position, absolute);top:var(--ran-progress-dot-top, -5px);left:var(--ran-progress-dot-left, -9px);border-radius:var(--ran-progress-dot-border-radius, 50%);width:var(--ran-progress-dot-width, 18px);height:var(--ran-progress-dot-height, 18px);background:var(--ran-progress-dot-background, linear-gradient(90deg, #0bc8bb 2.42%, #00d297 98.79%));cursor:var(--ran-progress-dot-cursor, pointer)}";
10
7
  const attributes = ["percent", "type", "total", "dot"];
11
- class Progress extends HTMLElement {
8
+ class Progress extends HTMLElementSSR() {
12
9
  constructor() {
13
10
  super();
14
11
  __publicField(this, "_progress");
@@ -16,50 +13,31 @@ class Progress extends HTMLElement {
16
13
  __publicField(this, "_progressWrapValue");
17
14
  __publicField(this, "_progressDot");
18
15
  __publicField(this, "moveProgress");
16
+ __publicField(this, "_shadowDom");
19
17
  __publicField(this, "progressClick", (e) => {
20
18
  const rect = this._progress.getBoundingClientRect();
21
19
  const offsetX = e.clientX - rect.left;
22
- const percentage = Math.min(
23
- 1,
24
- Math.max(0, offsetX / this._progress.offsetWidth)
25
- );
26
- this.percent = percentage * this.total;
27
- this._progressWrapValue.style.setProperty(
28
- "transform",
29
- `scaleX(${percentage})`
30
- );
31
- this._progressDot.style.setProperty(
32
- "transform",
33
- `translateX(${percentage * this._progress.offsetWidth}px)`
34
- );
20
+ const percentage = Math.min(1, Math.max(0, offsetX / this._progress.offsetWidth));
21
+ this.percent = `${percentage * Number(this.total)}`;
22
+ this._progressWrapValue.style.setProperty("transform", `scaleX(${percentage})`);
23
+ this._progressDot.style.setProperty("transform", `translateX(${percentage * this._progress.offsetWidth}px)`);
35
24
  this.change();
36
25
  });
37
26
  __publicField(this, "progressDotMouseDown", () => {
38
27
  this.moveProgress.mouseDown = true;
39
28
  });
40
29
  __publicField(this, "progressDotMouseMove", (e) => {
41
- if (!this.moveProgress.mouseDown)
42
- return;
30
+ if (!this.moveProgress.mouseDown) return;
43
31
  const rect = this._progress.getBoundingClientRect();
44
32
  const offsetX = e.clientX - rect.left;
45
- const percentage = Math.min(
46
- 1,
47
- Math.max(0, offsetX / this._progress.offsetWidth)
48
- );
49
- this.percent = percentage * this.total;
50
- this._progressWrapValue.style.setProperty(
51
- "transform",
52
- `scaleX(${percentage})`
53
- );
54
- this._progressDot.style.setProperty(
55
- "transform",
56
- `translateX(${percentage * this._progress.offsetWidth}px)`
57
- );
33
+ const percentage = Math.min(1, Math.max(0, offsetX / this._progress.offsetWidth));
34
+ this.percent = `${percentage * Number(this.total)}`;
35
+ this._progressWrapValue.style.setProperty("transform", `scaleX(${percentage})`);
36
+ this._progressDot.style.setProperty("transform", `translateX(${percentage * this._progress.offsetWidth}px)`);
58
37
  this.change();
59
38
  });
60
- __publicField(this, "progressDotMouseUp", (e) => {
61
- if (!this.moveProgress.mouseDown)
62
- return;
39
+ __publicField(this, "progressDotMouseUp", () => {
40
+ if (!this.moveProgress.mouseDown) return;
63
41
  this.moveProgress.mouseDown = false;
64
42
  });
65
43
  __publicField(this, "change", () => {
@@ -82,35 +60,23 @@ class Progress extends HTMLElement {
82
60
  }
83
61
  });
84
62
  __publicField(this, "updateCurrentProgress", () => {
85
- const percent = this.percent / this.total;
86
- this._progressWrapValue.style.setProperty(
87
- "transform",
88
- `scaleX(${percent})`
89
- );
90
- this._progressDot.style.setProperty(
91
- "transform",
92
- `translateX(${percent * this._progress.offsetWidth}px)`
93
- );
63
+ const percent = Number(this.percent) / Number(this.total);
64
+ this._progressWrapValue.style.setProperty("transform", `scaleX(${percent})`);
65
+ this._progressDot.style.setProperty("transform", `translateX(${percent * this._progress.offsetWidth}px)`);
94
66
  });
95
67
  __publicField(this, "dragEvent", () => {
96
- if (this.type !== "drag")
97
- return;
68
+ if (this.type !== "drag") return;
98
69
  this._progress.addEventListener("click", this.progressClick);
99
70
  this._progressDot.addEventListener("mousedown", this.progressDotMouseDown);
100
71
  document.addEventListener("mousemove", this.progressDotMouseMove);
101
72
  document.addEventListener("mouseup", this.progressDotMouseUp);
102
73
  });
103
- __publicField(this, "createProgress", () => {
104
- if (!this.contains(this._progress)) {
105
- this.appendChild(this._progress);
106
- this._progress.appendChild(this._progressDot);
107
- }
108
- });
109
74
  __publicField(this, "resize", () => {
110
75
  this.updateCurrentProgress();
111
76
  });
112
77
  this._progress = document.createElement("div");
113
78
  this._progress.setAttribute("class", "ran-progress");
79
+ this._progress.setAttribute("role", "progressbar");
114
80
  this._progressWrap = document.createElement("div");
115
81
  this._progressWrap.setAttribute("class", "ran-progress-wrap");
116
82
  this._progress.appendChild(this._progressWrap);
@@ -122,6 +88,13 @@ class Progress extends HTMLElement {
122
88
  this.moveProgress = {
123
89
  mouseDown: false
124
90
  };
91
+ this._progress.appendChild(this._progressDot);
92
+ const shadowRoot = this.attachShadow({ mode: "closed" });
93
+ const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
94
+ F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
95
+ shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
96
+ this._shadowDom = shadowRoot;
97
+ shadowRoot.appendChild(this._progress);
125
98
  }
126
99
  static get observedAttributes() {
127
100
  return attributes;
@@ -129,20 +102,20 @@ class Progress extends HTMLElement {
129
102
  get percent() {
130
103
  const percent = this.getAttribute("percent") || "";
131
104
  const num = perToNum(percent);
132
- if (num > this.total) {
105
+ if (Number(num) > Number(this.total)) {
133
106
  console.error("percent must be < total");
134
107
  return this.total;
135
108
  }
136
- return perToNum(percent);
109
+ return `${perToNum(percent)}`;
137
110
  }
138
111
  set percent(value) {
139
112
  this.setAttribute("percent", `${value || 0}`);
113
+ this.setAttribute("aria-valuenow", `${value || 0}`);
140
114
  }
141
115
  get total() {
142
116
  const total = this.getAttribute("total");
143
- if (!total)
144
- return 1;
145
- return perToNum(total);
117
+ if (!total) return "1";
118
+ return `${perToNum(total)}`;
146
119
  }
147
120
  set total(value) {
148
121
  this.setAttribute("total", value || "");
@@ -184,25 +157,23 @@ class Progress extends HTMLElement {
184
157
  this.setAttribute("dot", value || "true");
185
158
  }
186
159
  connectedCallback() {
160
+ const type = this.getAttribute("type");
161
+ if (!type) {
162
+ this.setAttribute("type", "primary");
163
+ }
187
164
  this.dragEvent();
188
165
  this.updateCurrentProgress();
189
166
  window.addEventListener("resize", this.resize);
190
167
  }
191
168
  disconnectCallback() {
192
169
  this._progress.removeEventListener("click", this.progressClick);
193
- this._progressDot.removeEventListener(
194
- "mousedown",
195
- this.progressDotMouseDown
196
- );
170
+ this._progressDot.removeEventListener("mousedown", this.progressDotMouseDown);
197
171
  document.removeEventListener("mousemove", this.progressDotMouseMove);
198
172
  document.removeEventListener("mouseup", this.progressDotMouseUp);
199
173
  window.removeEventListener("resize", this.resize);
200
174
  }
201
175
  attributeChangedCallback(k, o, n) {
202
176
  if (o !== n) {
203
- if (k === "type") {
204
- this.createProgress();
205
- }
206
177
  if (k === "dot") {
207
178
  this.appendProgressDot();
208
179
  }
@@ -214,7 +185,8 @@ class Progress extends HTMLElement {
214
185
  }
215
186
  function Custom() {
216
187
  if (typeof document !== "undefined" && !customElements.get("r-progress")) {
217
- customElements.define("r-progress", Progress);
188
+ Progress && customElements.define("r-progress", Progress);
189
+ return Progress;
218
190
  } else {
219
191
  return createCustomError("document is undefined or r-progress is exist");
220
192
  }