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
@@ -0,0 +1,511 @@
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 { f as range } from "./plus-DgJxWGlo.js";
5
+ import { c as createCustomError, H as HTMLElementSSR, a as createSignal } from "./index-hdtEL8P_.js";
6
+ import "./index-CiA5qRK3.js";
7
+ import "./index-jVKJoKXA.js";
8
+ import "./selectShadowless.js";
9
+ import "./index-CUZna268.js";
10
+ const hex2hsv = (hex) => {
11
+ const { r, g, b } = hex2rgb(hex);
12
+ return rgb2hsv(r, g, b);
13
+ };
14
+ const hex2rgb = (hex) => {
15
+ if (hex[0] === "#") hex = hex.substr(1);
16
+ if (hex.length === 3) {
17
+ return {
18
+ r: parseInt(hex[0] + hex[0], 16),
19
+ g: parseInt(hex[1] + hex[1], 16),
20
+ b: parseInt(hex[2] + hex[2], 16)
21
+ };
22
+ }
23
+ return {
24
+ r: parseInt(hex.substr(0, 2), 16),
25
+ g: parseInt(hex.substr(2, 2), 16),
26
+ b: parseInt(hex.substr(4, 2), 16)
27
+ };
28
+ };
29
+ const rgb2hsv = (r, g, b) => {
30
+ let h;
31
+ const max = Math.max(r, g, b);
32
+ const min = Math.min(r, g, b);
33
+ const delta = max - min;
34
+ if (delta === 0) {
35
+ h = 0;
36
+ } else if (r === max) {
37
+ h = (g - b) / delta % 6;
38
+ } else if (g === max) {
39
+ h = (b - r) / delta + 2;
40
+ } else {
41
+ h = (r - g) / delta + 4;
42
+ }
43
+ h = Math.round(h * 60);
44
+ if (h < 0) h += 360;
45
+ const s = Math.round((max === 0 ? 0 : delta / max) * 100);
46
+ const v = Math.round(max / 255 * 100);
47
+ return { h, s, v };
48
+ };
49
+ const hsv2rgb = (h, s, v) => {
50
+ s = s / 100;
51
+ v = v / 100;
52
+ let rgb = [];
53
+ const c = v * s;
54
+ const hh = h / 60;
55
+ const x = c * (1 - Math.abs(hh % 2 - 1));
56
+ const m = v - c;
57
+ if (hh >= 0 && hh < 1) {
58
+ rgb = [c, x, 0];
59
+ } else if (hh >= 1 && hh < 2) {
60
+ rgb = [x, c, 0];
61
+ } else if (hh >= 2 && hh < 3) {
62
+ rgb = [0, c, x];
63
+ } else if (h >= 3 && hh < 4) {
64
+ rgb = [0, x, c];
65
+ } else if (h >= 4 && hh < 5) {
66
+ rgb = [x, 0, c];
67
+ } else if (h >= 5 && hh <= 6) {
68
+ rgb = [c, 0, x];
69
+ } else {
70
+ rgb = [0, 0, 0];
71
+ }
72
+ return {
73
+ r: Math.round(255 * (rgb[0] + m)),
74
+ g: Math.round(255 * (rgb[1] + m)),
75
+ b: Math.round(255 * (rgb[2] + m))
76
+ };
77
+ };
78
+ const HEX_COLOR_REGEX = /^#([\da-f]{6}|[\da-f]{3})$/i;
79
+ const RGB_REGEX = /^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/;
80
+ const RGBA_REGEX = /^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d{1,3}(\.\d+)?)\)$/;
81
+ const BOT_WIDTH = 8;
82
+ const HUE = 360;
83
+ class ColorPicker extends HTMLElementSSR() {
84
+ constructor() {
85
+ super();
86
+ __publicField(this, "colorpicker");
87
+ __publicField(this, "colorpickerInner");
88
+ __publicField(this, "context");
89
+ __publicField(this, "popoverBlock");
90
+ __publicField(this, "popoverContent");
91
+ __publicField(this, "colorPickerInner");
92
+ __publicField(this, "colorPickerInnerContent");
93
+ __publicField(this, "colorPickerPanel");
94
+ __publicField(this, "colorPickerInputContainer");
95
+ __publicField(this, "colorPickerPanelDot");
96
+ __publicField(this, "colorPickerPanelSliderContainer");
97
+ __publicField(this, "colorPickerPanelSliderGroup");
98
+ __publicField(this, "colorPickerPanelSliderHue");
99
+ __publicField(this, "colorPickerPanelSliderAlpha");
100
+ __publicField(this, "colorPickerColorBlockInner");
101
+ __publicField(this, "colorPickerColorBlock");
102
+ __publicField(this, "colorPickerInnerContentSelect");
103
+ __publicField(this, "colorPickerPanelPalette");
104
+ __publicField(this, "colorPickerPanelSaturation");
105
+ __publicField(this, "colorPickerInputContainerSelect");
106
+ __publicField(this, "colorPickerInputContainerInputColor");
107
+ __publicField(this, "colorPickerInputContainerInputNumber");
108
+ __publicField(this, "colorPickerInputContainerSelectItem");
109
+ __publicField(this, "colorPickerPaletteSelect");
110
+ __publicField(this, "colorPickerPanelDotInner");
111
+ __publicField(this, "createContext", () => {
112
+ this.context = {
113
+ value: this.createColorValueSignal(),
114
+ disabled: this.createColorDisabled(),
115
+ hue: this.createColorHue(),
116
+ saturation: this.createColorSaturation(),
117
+ lightness: this.createColorLightness(),
118
+ transparency: this.createColorTransparency()
119
+ };
120
+ });
121
+ /**
122
+ * @description: 0 - 360 色相 hue
123
+ * @param {*} Signal
124
+ * @return {*}
125
+ */
126
+ __publicField(this, "createColorHue", () => {
127
+ const [getter, setter] = createSignal(0, {
128
+ subscriber: [
129
+ this.updateColorPickerPanelSaturationBackground,
130
+ this.updateColorPickerPanelSliderHueProgressPercent,
131
+ this.updateColorPickerPanelSliderAlphaProgressWrap,
132
+ this.updateColorPickerPanelSliderAlphaProgressDot,
133
+ this.updateColorPickerColorBlockInnerBackground,
134
+ this.updateColorPickerPanelSliderHueProgressDot
135
+ ]
136
+ });
137
+ return { getter, setter };
138
+ });
139
+ /**
140
+ * @description: 0 - 100 饱和度 x
141
+ * @param {*} Signal
142
+ * @return {*}
143
+ */
144
+ __publicField(this, "createColorSaturation", () => {
145
+ const [getter, setter] = createSignal(100, {
146
+ subscriber: [
147
+ this.updateColorPickerPanelSliderAlphaProgressWrap,
148
+ this.updateColorPickerPanelSliderAlphaProgressDot,
149
+ this.updateColorPickerColorBlockInnerBackground
150
+ ]
151
+ });
152
+ return { getter, setter };
153
+ });
154
+ /**
155
+ * @description: 0 - 100 亮度 y
156
+ * @param {*} Signal
157
+ * @return {*}
158
+ */
159
+ __publicField(this, "createColorLightness", () => {
160
+ const [getter, setter] = createSignal(100, {
161
+ subscriber: [
162
+ this.updateColorPickerPanelSliderAlphaProgressWrap,
163
+ this.updateColorPickerPanelSliderAlphaProgressDot,
164
+ this.updateColorPickerColorBlockInnerBackground
165
+ ]
166
+ });
167
+ return { getter, setter };
168
+ });
169
+ /**
170
+ * @description: 0 - 100 透明度
171
+ * @param {*} Signal
172
+ * @return {*}
173
+ */
174
+ __publicField(this, "createColorTransparency", () => {
175
+ const [getter, setter] = createSignal(80, {
176
+ subscriber: [
177
+ this.updateColorPickerPanelSliderAlphaProgressPercent,
178
+ this.updateColorPickerColorBlockInnerBackground,
179
+ this.updateColorPickerPanelSliderAlphaProgressDot
180
+ ]
181
+ });
182
+ return { getter, setter };
183
+ });
184
+ __publicField(this, "createColorDisabled", () => {
185
+ const [getter, setter] = createSignal(true, { subscriber: [] });
186
+ return { getter, setter };
187
+ });
188
+ __publicField(this, "createColorValueSignal", () => {
189
+ const [getter, setter] = createSignal("", {
190
+ subscriber: [this.updateColorValue]
191
+ });
192
+ return { getter, setter };
193
+ });
194
+ __publicField(this, "generateHue2rgb", () => {
195
+ const { hue } = this.context;
196
+ const { r, g, b } = hsv2rgb(hue.getter(), 100, 100);
197
+ return `rgb(${r}, ${g}, ${b})`;
198
+ });
199
+ __publicField(this, "generateHsv2Rgb", () => {
200
+ const { r, g, b } = this.generateHsv2Rgba();
201
+ return `rgb(${r}, ${g}, ${b})`;
202
+ });
203
+ __publicField(this, "generateHsv2Rgba", () => {
204
+ const { hue, saturation, lightness, transparency } = this.context;
205
+ const { r, g, b } = hsv2rgb(hue.getter(), saturation.getter(), lightness.getter());
206
+ return { r, g, b, a: transparency.getter() / 100 };
207
+ });
208
+ __publicField(this, "generateHsv2RgbaValue", () => {
209
+ const { r, g, b, a } = this.generateHsv2Rgba();
210
+ return `rgb(${r}, ${g}, ${b}, ${a})`;
211
+ });
212
+ __publicField(this, "generateColorPickerProgress", () => {
213
+ const { r, g, b } = this.generateHsv2Rgba();
214
+ return `linear-gradient(to right, rgba(255, 0, 4, 0), rgba(${r}, ${g}, ${b}, 1))`;
215
+ });
216
+ __publicField(this, "updateColorValue", (value) => {
217
+ var _a, _b;
218
+ if (value !== ((_a = this.context) == null ? void 0 : _a.value.getter())) {
219
+ const hex = HEX_COLOR_REGEX.exec(value);
220
+ const rga = RGB_REGEX.exec(value.replace(/\s+/g, ""));
221
+ const rgba = RGBA_REGEX.exec(value.replace(/\s+/g, ""));
222
+ if (hex) {
223
+ const { h, s, v } = hex2hsv(hex[0]);
224
+ this.context.hue.setter(h);
225
+ this.context.saturation.setter(s);
226
+ this.context.lightness.setter(v);
227
+ this.context.transparency.setter(100);
228
+ } else if (rgba) {
229
+ const { h, s, v } = rgb2hsv(Number(rgba[1]), Number(rgba[2]), Number(rgba[3]));
230
+ this.context.hue.setter(h);
231
+ this.context.saturation.setter(s);
232
+ this.context.lightness.setter(v);
233
+ this.context.transparency.setter(Number(rgba[4]));
234
+ } else if (rga) {
235
+ const { h, s, v } = rgb2hsv(Number(rga[1]), Number(rga[2]), Number(rga[3]));
236
+ this.context.hue.setter(h);
237
+ this.context.saturation.setter(s);
238
+ this.context.lightness.setter(v);
239
+ this.context.transparency.setter(100);
240
+ } else {
241
+ return;
242
+ }
243
+ this.setAttribute("value", value);
244
+ this.colorpickerInner.style.setProperty("background", value);
245
+ (_b = this.context) == null ? void 0 : _b.value.setter(value);
246
+ }
247
+ });
248
+ __publicField(this, "updateColorPickerPanelSliderHueProgressPercent", (hue) => {
249
+ var _a;
250
+ (_a = this.colorPickerPanelSliderHue) == null ? void 0 : _a.setAttribute("percent", `${hue / 360}`);
251
+ });
252
+ __publicField(this, "updateColorPickerPanelSliderAlphaProgressPercent", (alpha) => {
253
+ var _a;
254
+ (_a = this.colorPickerPanelSliderAlpha) == null ? void 0 : _a.setAttribute("percent", `${alpha / 100}`);
255
+ });
256
+ __publicField(this, "updateColorPickerPanelSliderAlphaProgressWrap", () => {
257
+ var _a;
258
+ (_a = this.colorPickerPanelSliderAlpha) == null ? void 0 : _a.style.setProperty(
259
+ "--ran-progress-wrap-background",
260
+ this.generateColorPickerProgress()
261
+ );
262
+ });
263
+ __publicField(this, "updateColorPickerPanelSliderAlphaProgressDot", () => {
264
+ var _a;
265
+ (_a = this.colorPickerPanelSliderAlpha) == null ? void 0 : _a.style.setProperty("--ran-progress-dot-background", this.generateHsv2RgbaValue());
266
+ });
267
+ __publicField(this, "updateColorPickerPanelSliderHueProgressDot", () => {
268
+ var _a;
269
+ (_a = this.colorPickerPanelSliderHue) == null ? void 0 : _a.style.setProperty("--ran-progress-dot-background", this.generateHue2rgb());
270
+ });
271
+ __publicField(this, "updateColorPickerColorBlockInnerBackground", () => {
272
+ var _a;
273
+ (_a = this.colorPickerColorBlockInner) == null ? void 0 : _a.style.setProperty("background", this.generateHsv2RgbaValue());
274
+ });
275
+ __publicField(this, "updateColorPickerPanelSaturationBackground", () => {
276
+ var _a;
277
+ (_a = this.colorPickerPanelSaturation) == null ? void 0 : _a.style.setProperty("background-color", this.generateHue2rgb());
278
+ });
279
+ __publicField(this, "clickStop", (e) => {
280
+ e.stopPropagation();
281
+ e.preventDefault();
282
+ });
283
+ __publicField(this, "changeColorPalettePositionByContext", () => {
284
+ window.requestAnimationFrame(() => {
285
+ var _a, _b, _c, _d, _e;
286
+ this.updateColorValue(this.value);
287
+ if (!this.colorPickerPanelPalette) return;
288
+ if (!((_a = this.context) == null ? void 0 : _a.lightness.getter) || !((_b = this.context) == null ? void 0 : _b.saturation.getter)) return;
289
+ const { width, height } = ((_c = this.colorPickerPanelPalette) == null ? void 0 : _c.getBoundingClientRect()) || {};
290
+ const limitY = height - this.context.lightness.getter() / 100 * height;
291
+ const limitX = this.context.saturation.getter() / 100 * width;
292
+ (_d = this.colorPickerPanelDot) == null ? void 0 : _d.style.setProperty("top", `${limitY - BOT_WIDTH}px`);
293
+ (_e = this.colorPickerPanelDot) == null ? void 0 : _e.style.setProperty("left", `${limitX - BOT_WIDTH}px`);
294
+ });
295
+ });
296
+ __publicField(this, "changeColorPalettePosition", (offsetX, offsetY) => {
297
+ var _a, _b, _c;
298
+ if (!this.colorPickerPanelPalette) return;
299
+ if (!((_a = this.context) == null ? void 0 : _a.lightness.getter) || !((_b = this.context) == null ? void 0 : _b.saturation.getter)) return;
300
+ const { width, height } = ((_c = this.colorPickerPanelPalette) == null ? void 0 : _c.getBoundingClientRect()) || {};
301
+ const limitY = height - range(offsetY, 0, height);
302
+ const limitX = range(offsetX, 0, width);
303
+ this.context.saturation.setter(limitX / width * 100);
304
+ this.context.lightness.setter(limitY / height * 100);
305
+ window.requestAnimationFrame(() => {
306
+ var _a2, _b2;
307
+ (_a2 = this.colorPickerPanelDot) == null ? void 0 : _a2.style.setProperty("top", `${offsetY - BOT_WIDTH}px`);
308
+ (_b2 = this.colorPickerPanelDot) == null ? void 0 : _b2.style.setProperty("left", `${offsetX - BOT_WIDTH}px`);
309
+ });
310
+ });
311
+ __publicField(this, "clickColorPalette", (e) => {
312
+ const { offsetX, offsetY } = e;
313
+ this.changeColorPalettePosition(offsetX, offsetY);
314
+ });
315
+ __publicField(this, "createColorPickerProgress", () => {
316
+ this.colorPickerPanelSliderContainer = document.createElement("div");
317
+ this.colorPickerPanelSliderContainer.setAttribute("class", "ran-color-picker-slider-container");
318
+ this.colorPickerPanelSliderGroup = document.createElement("div");
319
+ this.colorPickerPanelSliderGroup.setAttribute("class", "ran-color-picker-slider-container-group");
320
+ this.colorPickerPanelSliderHue = document.createElement("r-progress");
321
+ this.updateColorPickerPanelSliderHueProgressDot();
322
+ this.colorPickerPanelSliderHue.style.setProperty(
323
+ "--ran-progress-wrap-background",
324
+ "linear-gradient(to right, #ff0000, #ffff00, #00ff00, #00ffff, #0000ff, #ff00ff, #ff0000)"
325
+ );
326
+ this.colorPickerPanelSliderHue.setAttribute("percent", `${this.context.hue.getter() / 360}`);
327
+ this.colorPickerPanelSliderHue.addEventListener("change", this.changeColorPickerHue);
328
+ this.colorPickerPanelSliderHue.setAttribute("type", "drag");
329
+ this.colorPickerPanelSliderHue.setAttribute("class", "ran-color-picker-slider-container-group-hue");
330
+ this.colorPickerPanelSliderAlpha = document.createElement("r-progress");
331
+ this.updateColorPickerPanelSliderAlphaProgressDot();
332
+ this.colorPickerPanelSliderAlpha.setAttribute("percent", `${this.context.transparency.getter() / 100}`);
333
+ this.updateColorPickerPanelSliderAlphaProgressWrap();
334
+ this.colorPickerPanelSliderAlpha.addEventListener("change", this.changeColorPickerAlpha);
335
+ this.colorPickerPanelSliderAlpha.setAttribute("type", "drag");
336
+ this.colorPickerPanelSliderAlpha.setAttribute("class", "ran-color-picker-slider-container-group-alpha");
337
+ this.colorPickerPanelSliderGroup.appendChild(this.colorPickerPanelSliderHue);
338
+ this.colorPickerPanelSliderGroup.appendChild(this.colorPickerPanelSliderAlpha);
339
+ this.colorPickerPanelSliderContainer.appendChild(this.colorPickerPanelSliderGroup);
340
+ this.colorPickerColorBlock = document.createElement("div");
341
+ this.colorPickerColorBlock.setAttribute("class", "ran-color-picker-slider-container-color-block");
342
+ this.colorPickerColorBlockInner = document.createElement("div");
343
+ this.colorPickerColorBlockInner.setAttribute("class", "ran-color-picker-slider-container-color-block-inner");
344
+ this.updateColorPickerColorBlockInnerBackground();
345
+ this.colorPickerColorBlock.appendChild(this.colorPickerColorBlockInner);
346
+ this.colorPickerPanelSliderContainer.appendChild(this.colorPickerColorBlock);
347
+ });
348
+ __publicField(this, "changeColorPickerHue", (e) => {
349
+ this.context.hue.setter(e.detail.value * HUE);
350
+ });
351
+ __publicField(this, "changeColorPickerAlpha", (e) => {
352
+ this.context.transparency.setter(e.detail.value * 100);
353
+ });
354
+ __publicField(this, "createColorPickerSelect", () => {
355
+ this.colorPickerPanel = document.createElement("div");
356
+ this.colorPickerPanel.setAttribute("class", "ran-color-picker-panel");
357
+ this.colorPickerInnerContentSelect = document.createElement("div");
358
+ this.colorPickerInnerContentSelect.setAttribute("class", "ran-color-picker-select");
359
+ this.colorPickerPanel.appendChild(this.colorPickerInnerContentSelect);
360
+ this.colorPickerPanelPalette = document.createElement("div");
361
+ this.colorPickerPanelPalette.setAttribute("class", "ran-color-picker-palette");
362
+ this.colorPickerInnerContentSelect.appendChild(this.colorPickerPanelPalette);
363
+ this.colorPickerPanelSaturation = document.createElement("div");
364
+ this.colorPickerPanelSaturation.setAttribute("class", "ran-color-picker-saturation");
365
+ this.updateColorPickerPanelSaturationBackground();
366
+ this.colorPickerPanelDot = document.createElement("div");
367
+ this.colorPickerPanelDotInner = document.createElement("div");
368
+ this.colorPickerPanelDotInner.setAttribute("class", "ran-color-picker-palette-dot-inner");
369
+ this.colorPickerPanelDot.setAttribute("class", "ran-color-picker-palette-dot");
370
+ this.colorPickerPanelDot.addEventListener("mousedown", this.mouseDownColorPickerPalette);
371
+ document.body.addEventListener("mousemove", this.mouseMoveColorPickerPalette);
372
+ this.colorPickerPanelDot.addEventListener("mouseup", this.mouseUpColorPickerPalette);
373
+ this.colorPickerPanelDot.appendChild(this.colorPickerPanelDotInner);
374
+ this.colorPickerPanelPalette.appendChild(this.colorPickerPanelDot);
375
+ this.colorPickerPanelPalette.appendChild(this.colorPickerPanelSaturation);
376
+ this.colorPickerPanelPalette.addEventListener("mousedown", this.clickColorPalette);
377
+ });
378
+ __publicField(this, "createColorPickerInput", () => {
379
+ this.colorPickerInputContainer = document.createElement("div");
380
+ this.colorPickerInputContainer.setAttribute("class", "ran-color-picker-input-container");
381
+ const colorPickerInputContainerId = `${performance.now()}`.replace(".", "");
382
+ this.colorPickerInputContainerSelect = document.createElement("div");
383
+ this.colorPickerInputContainerSelect.setAttribute("class", "ran-color-picker-input-container-select");
384
+ this.colorPickerInputContainerSelect.setAttribute("id", colorPickerInputContainerId);
385
+ this.colorPickerInputContainerSelectItem = document.createElement("ra-select");
386
+ this.colorPickerInputContainerSelectItem.setAttribute("value", "HEX");
387
+ this.colorPickerInputContainerSelectItem.setAttribute("class", "ran-color-picker-input-container-select-item");
388
+ this.colorPickerInputContainerSelectItem.setAttribute("type", "text");
389
+ this.colorPickerInputContainerSelectItem.setAttribute("getPopupContainerId", colorPickerInputContainerId);
390
+ const colorSelectOption = ["HEX", "HSB", "RGB"];
391
+ const Fragment = document.createDocumentFragment();
392
+ colorSelectOption.forEach((item) => {
393
+ const Option = document.createElement("r-option");
394
+ Option.setAttribute("value", item);
395
+ Option.innerText = item;
396
+ Fragment.appendChild(Option);
397
+ });
398
+ this.colorPickerInputContainerSelectItem.appendChild(Fragment);
399
+ this.colorPickerInputContainerSelect.appendChild(this.colorPickerInputContainerSelectItem);
400
+ this.colorPickerInputContainer.appendChild(this.colorPickerInputContainerSelect);
401
+ this.colorPickerInputContainerInputColor = document.createElement("ra-input");
402
+ this.colorPickerInputContainerInputColor.setAttribute("class", "ran-color-picker-input-container-input-color");
403
+ this.colorPickerInputContainerInputNumber = document.createElement("ra-input");
404
+ this.colorPickerInputContainerInputNumber.setAttribute("class", "ran-color-picker-input-container-input-number");
405
+ this.colorPickerInputContainer.appendChild(this.colorPickerInputContainerInputColor);
406
+ this.colorPickerInputContainer.appendChild(this.colorPickerInputContainerInputNumber);
407
+ });
408
+ __publicField(this, "openColorPicker", () => {
409
+ if (this.colorPickerInner) return;
410
+ this.colorPickerInner = document.createElement("div");
411
+ this.colorPickerInner.setAttribute("class", "ran-color-picker-inner");
412
+ this.colorPickerInnerContent = document.createElement("div");
413
+ this.colorPickerInnerContent.setAttribute("class", "ran-color-picker-inner-content");
414
+ this.createColorPickerProgress();
415
+ this.createColorPickerSelect();
416
+ this.createColorPickerInput();
417
+ this.colorPickerPanel && this.colorPickerInnerContent.appendChild(this.colorPickerPanel);
418
+ this.colorPickerPanelSliderContainer && this.colorPickerInnerContent.appendChild(this.colorPickerPanelSliderContainer);
419
+ this.colorPickerInputContainer && this.colorPickerInnerContent.appendChild(this.colorPickerInputContainer);
420
+ this.colorPickerInner.appendChild(this.colorPickerInnerContent);
421
+ this.popoverContent.appendChild(this.colorPickerInner);
422
+ this.changeColorPalettePositionByContext();
423
+ });
424
+ __publicField(this, "mouseMoveColorPickerPalette", (e) => {
425
+ var _a;
426
+ if (!this.colorPickerPanelPalette || !this.colorPickerPaletteSelect) return;
427
+ const { pageX, pageY } = e;
428
+ const { top = 0, left = 0, width, height } = ((_a = this.colorPickerPanelPalette) == null ? void 0 : _a.getBoundingClientRect()) || {};
429
+ const limitY = range(pageY - top - BOT_WIDTH, -8, height - BOT_WIDTH);
430
+ const limitX = range(pageX - left - BOT_WIDTH, -8, width - BOT_WIDTH);
431
+ this.context.saturation.setter(limitX / width * 100);
432
+ this.context.lightness.setter(limitY / height * 100);
433
+ window.requestAnimationFrame(() => {
434
+ var _a2, _b;
435
+ (_a2 = this.colorPickerPanelDot) == null ? void 0 : _a2.style.setProperty("top", `${limitY}px`);
436
+ (_b = this.colorPickerPanelDot) == null ? void 0 : _b.style.setProperty("left", `${limitX}px`);
437
+ });
438
+ });
439
+ __publicField(this, "mouseDownColorPickerPalette", (e) => {
440
+ e.stopPropagation();
441
+ e.preventDefault();
442
+ this.colorPickerPaletteSelect = true;
443
+ });
444
+ __publicField(this, "mouseUpColorPickerPalette", () => {
445
+ this.colorPickerPaletteSelect = false;
446
+ });
447
+ this.setAttribute("class", "ran-colorpicker");
448
+ this.popoverBlock = document.createElement("r-popover");
449
+ this.popoverBlock.setAttribute("class", "ran-popover");
450
+ this.popoverContent = document.createElement("r-content");
451
+ this.popoverContent.setAttribute("class", "ran-content");
452
+ this.colorpicker = document.createElement("div");
453
+ this.colorpicker.setAttribute("class", "ran-colorpicker-block");
454
+ this.colorpickerInner = document.createElement("div");
455
+ this.colorpickerInner.setAttribute("class", "ran-colorpicker-inner");
456
+ this.popoverBlock.appendChild(this.colorpicker);
457
+ this.popoverBlock.appendChild(this.popoverContent);
458
+ this.colorpicker.appendChild(this.colorpickerInner);
459
+ this.appendChild(this.popoverBlock);
460
+ this.colorPickerPaletteSelect = false;
461
+ this.createContext();
462
+ }
463
+ static get observedAttributes() {
464
+ return ["disabled", "value"];
465
+ }
466
+ get value() {
467
+ var _a;
468
+ return ((_a = this.context) == null ? void 0 : _a.value.getter()) || "";
469
+ }
470
+ set value(value) {
471
+ this.setAttribute("value", value);
472
+ this.updateColorValue(value);
473
+ }
474
+ connectedCallback() {
475
+ this.popoverBlock.addEventListener("click", this.openColorPicker);
476
+ }
477
+ disconnectCallback() {
478
+ var _a, _b, _c;
479
+ this.popoverBlock.removeEventListener("click", this.openColorPicker);
480
+ (_a = this.colorPickerPanelDot) == null ? void 0 : _a.removeEventListener("mousedown", this.mouseDownColorPickerPalette);
481
+ document.body.removeEventListener("mousemove", this.mouseMoveColorPickerPalette);
482
+ (_b = this.colorPickerPanelDot) == null ? void 0 : _b.removeEventListener("mouseup", this.mouseUpColorPickerPalette);
483
+ (_c = this.colorPickerPanelPalette) == null ? void 0 : _c.removeEventListener("mousedown", this.clickColorPalette);
484
+ }
485
+ attributeChangedCallback(n, o, v) {
486
+ if (o !== v) {
487
+ if (n === "value") {
488
+ this.updateColorValue(v);
489
+ }
490
+ }
491
+ }
492
+ }
493
+ function Custom() {
494
+ if (typeof document !== "undefined" && !customElements.get("r-colorpicker")) {
495
+ customElements.define("r-colorpicker", ColorPicker);
496
+ return ColorPicker;
497
+ } else {
498
+ return createCustomError("document is undefined or r-colorpicker is exist");
499
+ }
500
+ }
501
+ const index = Custom();
502
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
503
+ __proto__: null,
504
+ ColorPicker,
505
+ default: index
506
+ }, Symbol.toStringTag, { value: "Module" }));
507
+ export {
508
+ ColorPicker as C,
509
+ index as a,
510
+ index$1 as i
511
+ };
@@ -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}\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}";
8
5
  function CustomElement() {
9
6
  if (typeof window !== "undefined" && !customElements.get("r-tab")) {
10
7
  class TabPane extends HTMLElement {
@@ -100,14 +97,10 @@ function CustomElement() {
100
97
  attributeChangedCallback(name, oldValue, newValue) {
101
98
  var _a, _b, _c, _d, _e;
102
99
  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);
100
+ if (name === "icon") (_b = this.parent) == null ? void 0 : _b.updateAttribute(this.key, "icon", newValue);
101
+ if (name === "iconSize") (_c = this.parent) == null ? void 0 : _c.updateAttribute(this.key, "iconSize", newValue);
102
+ if (name === "effect") (_d = this.parent) == null ? void 0 : _d.updateAttribute(this.key, "effect", newValue);
103
+ if (name === "disabled") (_e = this.parent) == null ? void 0 : _e.updateAttribute(this.key, "disabled", newValue);
111
104
  }
112
105
  }
113
106
  }
@@ -0,0 +1,70 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
+ import { c as create } from "./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{position:var(--ran-math-position, relative)}.ran-math{display:var(--ran-math-display, flex);justify-content:var(--ran-math-justify-content, space-around);align-items:var(--ran-math-align-items, center)}.katex-html{display:var(--ran-math-katex-display, none)}";
7
+ class Math2 extends HTMLElementSSR() {
8
+ constructor() {
9
+ super();
10
+ __publicField(this, "contain");
11
+ this.contain = create("div").setAttribute("class", "ran-math").element;
12
+ const shadowRoot = this.attachShadow({ mode: "closed" });
13
+ const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement("style");
14
+ F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
15
+ shadowRoot.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);
16
+ shadowRoot.appendChild(this.contain);
17
+ }
18
+ static get observedAttributes() {
19
+ return ["latex"];
20
+ }
21
+ get latex() {
22
+ const latex = this.getAttribute("latex") || "";
23
+ return decodeURIComponent(latex);
24
+ }
25
+ set latex(value) {
26
+ this.setAttribute("latex", value || "");
27
+ }
28
+ render() {
29
+ if (!this.latex) return;
30
+ import("./katex-es-CGqSCDjs.js").then((katex) => {
31
+ this.contain.innerHTML = "";
32
+ const span = create("span").setTextContent(`$$${this.latex}$$`).element;
33
+ this.contain.appendChild(span);
34
+ if (!katex) return;
35
+ katex.renderMathInElement(this.contain);
36
+ }).catch(function(err) {
37
+ console.warn(`ranui math component warning: ${err.message}
38
+ ${err}`);
39
+ });
40
+ }
41
+ connectedCallback() {
42
+ this.render();
43
+ }
44
+ attributeChangedCallback(k, o, n) {
45
+ if (o !== n) {
46
+ if (k === "latex") {
47
+ this.render();
48
+ }
49
+ }
50
+ }
51
+ }
52
+ async function Custom() {
53
+ if (typeof document !== "undefined" && !customElements.get("r-math")) {
54
+ customElements.define("r-math", Math2);
55
+ return Math2;
56
+ } else {
57
+ return createCustomError("document is undefined or r-math is exist");
58
+ }
59
+ }
60
+ const index = Custom();
61
+ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
62
+ __proto__: null,
63
+ Math: Math2,
64
+ default: index
65
+ }, Symbol.toStringTag, { value: "Module" }));
66
+ export {
67
+ Math2 as M,
68
+ index as a,
69
+ index$1 as i
70
+ };