ranui 0.1.10-alpha.9 → 0.2.0-alpha.1

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 (326) hide show
  1. package/README.md +397 -0
  2. package/README.zh-CN.md +216 -37
  3. package/dist/assets/image/failImage.d.ts +2 -0
  4. package/dist/bin/generate-component-api.d.ts +1 -0
  5. package/dist/bin/generate-style-docs.d.ts +1 -0
  6. package/dist/build/config.bundle.d.ts +2 -0
  7. package/dist/build/config.d.ts +3 -0
  8. package/dist/build/config.es.d.ts +2 -0
  9. package/dist/build/config.umd.d.ts +1 -0
  10. package/dist/builder.d.ts +11 -0
  11. package/dist/builder.js +39 -0
  12. package/dist/button-BstLjXNe.js +117 -0
  13. package/dist/button.js +3 -5
  14. package/dist/card-DQUJoDUQ.js +60 -0
  15. package/dist/card.js +5 -0
  16. package/dist/checkbox-iHZQb-yQ.js +94 -0
  17. package/dist/checkbox.js +3 -5
  18. package/dist/colorpicker-CGh8pRqo.js +315 -0
  19. package/dist/colorpicker.js +3 -9
  20. package/dist/components/button/index.d.ts +44 -0
  21. package/dist/components/card/index.d.ts +21 -0
  22. package/dist/components/checkbox/index.d.ts +35 -0
  23. package/dist/components/colorpicker/index.d.ts +99 -0
  24. package/dist/components/dropdown/index.d.ts +30 -0
  25. package/dist/components/form/index.d.ts +15 -0
  26. package/dist/components/icon/index.d.ts +58 -0
  27. package/dist/components/image/index.d.ts +31 -0
  28. package/dist/components/input/index.d.ts +222 -0
  29. package/dist/components/link/index.d.ts +21 -0
  30. package/dist/components/loading/index.d.ts +76 -0
  31. package/dist/components/math/index.d.ts +16 -0
  32. package/dist/components/message/container.d.ts +8 -0
  33. package/dist/components/message/index.d.ts +32 -0
  34. package/dist/components/modal/index.d.ts +100 -0
  35. package/dist/components/player/core/constants.d.ts +5 -0
  36. package/dist/components/player/core/controller.d.ts +33 -0
  37. package/dist/components/player/core/events.d.ts +10 -0
  38. package/dist/components/player/core/fullscreen.d.ts +5 -0
  39. package/dist/components/player/core/levels.d.ts +20 -0
  40. package/dist/components/player/core/media.d.ts +50 -0
  41. package/dist/components/player/core/playback.d.ts +14 -0
  42. package/dist/components/player/core/progress.d.ts +2 -0
  43. package/dist/components/player/core/state.d.ts +27 -0
  44. package/dist/components/player/core/view.d.ts +38 -0
  45. package/dist/components/player/index.d.ts +276 -0
  46. package/dist/components/popover/content/index.d.ts +12 -0
  47. package/dist/components/popover/index.d.ts +93 -0
  48. package/dist/components/progress/index.d.ts +40 -0
  49. package/dist/components/radar/index.d.ts +52 -0
  50. package/dist/components/route/index.d.ts +26 -0
  51. package/dist/components/router/index.d.ts +24 -0
  52. package/dist/components/scratch/index.d.ts +19 -0
  53. package/dist/components/section/index.d.ts +23 -0
  54. package/dist/components/select/dropdown-item/index.d.ts +21 -0
  55. package/dist/components/select/index.d.ts +150 -0
  56. package/dist/components/select/option/index.d.ts +19 -0
  57. package/dist/components/skeleton/index.d.ts +13 -0
  58. package/dist/components/tab/index.d.ts +58 -0
  59. package/dist/components/tabpane/index.d.ts +33 -0
  60. package/dist/demo/i18n.d.ts +4 -0
  61. package/dist/demo/index.d.ts +3 -0
  62. package/dist/demo/register-icons.d.ts +1 -0
  63. package/dist/dropdown-RqHMRhFE.js +76 -0
  64. package/dist/dropdown.js +6 -0
  65. package/dist/events-C59wGdni.js +30 -0
  66. package/dist/factory-BdsO0dEW.js +165 -0
  67. package/dist/form-05Lxxl3D.js +44 -0
  68. package/dist/form.js +5 -0
  69. package/dist/icon-Blm7AbyY.js +167 -0
  70. package/dist/icon.js +4 -4
  71. package/dist/{index-KS2nvVcO.js → image-DKm6z7YQ.js} +60 -71
  72. package/dist/image.js +3 -2
  73. package/dist/index.cjs +35 -0
  74. package/dist/index.d.ts +277 -114
  75. package/dist/index.iife.js +306 -0
  76. package/dist/index.js +78 -38
  77. package/dist/input-Dskw1bAl.js +186 -0
  78. package/dist/input.js +2 -3
  79. package/dist/katex-es-BTpuCxxV.cjs +261 -0
  80. package/dist/katex-es-CKRwcaiU.js +23682 -0
  81. package/dist/link-BW-gvrpN.js +77 -0
  82. package/dist/link.js +6 -0
  83. package/dist/loading-C4QUpm70.js +206 -0
  84. package/dist/loading.js +4 -6
  85. package/dist/math-Dv4nXSoI.js +52 -0
  86. package/dist/math.js +2 -4
  87. package/dist/message-De5e1txT.js +137 -0
  88. package/dist/message.js +3 -4
  89. package/dist/mocks-CMGoftIc.js +179 -0
  90. package/dist/modal-DruDj3AB.js +350 -0
  91. package/dist/modal.js +3 -2
  92. package/dist/player-CqTAmg_E.js +13534 -0
  93. package/dist/player.js +3 -6
  94. package/dist/playwright.config.d.ts +2 -0
  95. package/dist/plugins/load-svg.d.ts +9 -0
  96. package/dist/popover-BY32HNMl.js +206 -0
  97. package/dist/popover.js +3 -5
  98. package/dist/progress-gZo0knzu.js +123 -0
  99. package/dist/progress.js +3 -5
  100. package/dist/radar-19P5Mtld.js +181 -0
  101. package/dist/radar.js +3 -4
  102. package/dist/ranui.css +1 -0
  103. package/dist/route-BY_E6-2C.js +88 -0
  104. package/dist/route.js +6 -0
  105. package/dist/router-BDcv4F-2.js +79 -0
  106. package/dist/router.js +6 -0
  107. package/dist/scratch-Dbd9G6Q6.js +60 -0
  108. package/dist/scratch.js +4 -0
  109. package/dist/section-CNTvgdQ-.js +63 -0
  110. package/dist/section.js +5 -0
  111. package/dist/select-BVdUtQX5.js +454 -0
  112. package/dist/select.js +3 -8
  113. package/dist/signal-XHfNsQNW.js +57 -0
  114. package/dist/skeleton-BAdJ6vyA.js +32 -0
  115. package/dist/skeleton.js +3 -2
  116. package/dist/ssg.js +21 -0
  117. package/dist/ssr-DSGwPtEd.js +34 -0
  118. package/dist/ssr-stream.d.ts +1 -0
  119. package/dist/ssr-stream.js +87 -0
  120. package/dist/ssr.d.ts +1 -0
  121. package/dist/ssr.js +7 -0
  122. package/dist/style.d.ts +1 -0
  123. package/dist/style.js +0 -0
  124. package/dist/tab-DH2owP2V.js +184 -0
  125. package/dist/tab.js +3 -4
  126. package/dist/tabpane-B_M-Jokw.js +87 -0
  127. package/dist/tabpane.js +3 -2
  128. package/dist/test/e2e/button.spec.d.ts +1 -0
  129. package/dist/test/e2e/checkbox.spec.d.ts +1 -0
  130. package/dist/test/e2e/helpers.d.ts +13 -0
  131. package/dist/test/e2e/icon.spec.d.ts +1 -0
  132. package/dist/test/e2e/image.spec.d.ts +1 -0
  133. package/dist/test/e2e/input.spec.d.ts +1 -0
  134. package/dist/test/e2e/loading.spec.d.ts +1 -0
  135. package/dist/test/e2e/message.spec.d.ts +1 -0
  136. package/dist/test/e2e/modal.spec.d.ts +1 -0
  137. package/dist/test/e2e/popover.spec.d.ts +1 -0
  138. package/dist/test/e2e/progress.spec.d.ts +1 -0
  139. package/dist/test/e2e/radar.spec.d.ts +1 -0
  140. package/dist/test/e2e/select.spec.d.ts +1 -0
  141. package/dist/test/e2e/skeleton.spec.d.ts +1 -0
  142. package/dist/test/e2e/tab.spec.d.ts +1 -0
  143. package/dist/test/e2e/visual/colorpicker.spec.d.ts +1 -0
  144. package/dist/test/e2e/visual/components.spec.d.ts +1 -0
  145. package/dist/test/e2e/visual/player.spec.d.ts +1 -0
  146. package/dist/test/integration/composition.test.d.ts +23 -0
  147. package/dist/test/setup.d.ts +0 -0
  148. package/dist/test/ssr/builder.core.ssr.test.d.ts +1 -0
  149. package/dist/test/ssr/builder.factory.ssr.test.d.ts +1 -0
  150. package/dist/test/ssr/builder.mocks.test.d.ts +1 -0
  151. package/dist/test/ssr/components/button.test.d.ts +1 -0
  152. package/dist/test/ssr/css-vars.test.d.ts +1 -0
  153. package/dist/test/ssr/registry.test.d.ts +1 -0
  154. package/dist/test/ssr/router.ssg.test.d.ts +2 -0
  155. package/dist/test/ssr/snapshots/button.test.d.ts +1 -0
  156. package/dist/test/ssr/stream.test.d.ts +2 -0
  157. package/dist/test/ssr/theme.tokens.ssr.test.d.ts +1 -0
  158. package/dist/test/unit/builder.core.browser.test.d.ts +1 -0
  159. package/dist/test/unit/builder.escape.test.d.ts +1 -0
  160. package/dist/test/unit/builder.selectors.test.d.ts +1 -0
  161. package/dist/test/unit/button.contract.test.d.ts +1 -0
  162. package/dist/test/unit/card.contract.test.d.ts +1 -0
  163. package/dist/test/unit/checkbox.contract.test.d.ts +1 -0
  164. package/dist/test/unit/colorpicker.color.utils.test.d.ts +1 -0
  165. package/dist/test/unit/colorpicker.contract.test.d.ts +1 -0
  166. package/dist/test/unit/colorpicker.methods.test.d.ts +1 -0
  167. package/dist/test/unit/component.helpers.test.d.ts +1 -0
  168. package/dist/test/unit/dropdown-item.contract.test.d.ts +1 -0
  169. package/dist/test/unit/dropdown.contract.test.d.ts +1 -0
  170. package/dist/test/unit/form.contract.test.d.ts +1 -0
  171. package/dist/test/unit/helpers/component.d.ts +3 -0
  172. package/dist/test/unit/helpers/dom.d.ts +2 -0
  173. package/dist/test/unit/icon.contract.test.d.ts +1 -0
  174. package/dist/test/unit/image.contract.test.d.ts +1 -0
  175. package/dist/test/unit/input.contract.test.d.ts +1 -0
  176. package/dist/test/unit/link.contract.test.d.ts +1 -0
  177. package/dist/test/unit/loading.contract.test.d.ts +1 -0
  178. package/dist/test/unit/math.contract.test.d.ts +1 -0
  179. package/dist/test/unit/message.component.test.d.ts +1 -0
  180. package/dist/test/unit/message.container.test.d.ts +1 -0
  181. package/dist/test/unit/modal.contract.test.d.ts +1 -0
  182. package/dist/test/unit/option.contract.test.d.ts +1 -0
  183. package/dist/test/unit/package-exports.source.test.d.ts +1 -0
  184. package/dist/test/unit/player-controls.test.d.ts +1 -0
  185. package/dist/test/unit/player-core.test.d.ts +1 -0
  186. package/dist/test/unit/player-event-handlers.test.d.ts +1 -0
  187. package/dist/test/unit/player-events.test.d.ts +1 -0
  188. package/dist/test/unit/player-fullscreen.test.d.ts +1 -0
  189. package/dist/test/unit/player-interactions.test.d.ts +1 -0
  190. package/dist/test/unit/player-levels.test.d.ts +1 -0
  191. package/dist/test/unit/player-media.test.d.ts +1 -0
  192. package/dist/test/unit/player-playback.test.d.ts +1 -0
  193. package/dist/test/unit/player.contract.test.d.ts +1 -0
  194. package/dist/test/unit/popover-accessibility.test.d.ts +1 -0
  195. package/dist/test/unit/popover.contract.test.d.ts +2 -0
  196. package/dist/test/unit/progress.contract.test.d.ts +1 -0
  197. package/dist/test/unit/radar.contract.test.d.ts +1 -0
  198. package/dist/test/unit/route.contract.test.d.ts +1 -0
  199. package/dist/test/unit/router.contract.test.d.ts +2 -0
  200. package/dist/test/unit/scratch.contract.test.d.ts +1 -0
  201. package/dist/test/unit/select-accessibility.test.d.ts +1 -0
  202. package/dist/test/unit/select-option.contract.test.d.ts +1 -0
  203. package/dist/test/unit/select.contract.test.d.ts +1 -0
  204. package/dist/test/unit/skeleton.contract.test.d.ts +1 -0
  205. package/dist/test/unit/ssr.test.d.ts +1 -0
  206. package/dist/test/unit/tab.contract.test.d.ts +2 -0
  207. package/dist/test/unit/theme.semantic-tokens.test.d.ts +1 -0
  208. package/dist/test/unit/theme.skin-tokens.test.d.ts +1 -0
  209. package/dist/test/unit/utils.dom.test.d.ts +1 -0
  210. package/dist/test/unit/utils.error.test.d.ts +1 -0
  211. package/dist/test/unit/utils.i18n.test.d.ts +1 -0
  212. package/dist/test/unit/utils.image.test.d.ts +1 -0
  213. package/dist/test/unit/utils.math.test.d.ts +1 -0
  214. package/dist/test/unit/utils.router.test.d.ts +1 -0
  215. package/dist/test/unit/utils.signal.test.d.ts +1 -0
  216. package/dist/test/unit/utils.ssr-stream.test.d.ts +1 -0
  217. package/dist/test/unit/utils.style.test.d.ts +1 -0
  218. package/dist/test/unit/utils.theme.test.d.ts +1 -0
  219. package/dist/test/unit/utils.tween.test.d.ts +1 -0
  220. package/dist/tsconfig.json +8 -8
  221. package/dist/typings.d.ts +163 -114
  222. package/dist/utils/builder/core.d.ts +70 -0
  223. package/dist/utils/builder/env.d.ts +1 -0
  224. package/dist/utils/builder/escape.d.ts +2 -0
  225. package/dist/utils/builder/events.d.ts +55 -0
  226. package/dist/utils/builder/factory.d.ts +18 -0
  227. package/dist/utils/builder/index.d.ts +9 -0
  228. package/dist/utils/builder/mocks.d.ts +62 -0
  229. package/dist/utils/builder/selectors.d.ts +4 -0
  230. package/dist/utils/builder/signal.d.ts +87 -0
  231. package/dist/utils/color.d.ts +52 -0
  232. package/dist/utils/component.d.ts +16 -0
  233. package/dist/utils/dom.d.ts +39 -0
  234. package/dist/utils/error.d.ts +6 -0
  235. package/dist/utils/i18n/index.d.ts +53 -0
  236. package/dist/utils/i18n.js +88 -0
  237. package/dist/utils/image.d.ts +39 -0
  238. package/dist/utils/index.d.ts +8 -0
  239. package/dist/utils/math.d.ts +26 -0
  240. package/dist/utils/router/index.d.ts +128 -0
  241. package/dist/utils/router.js +197 -0
  242. package/dist/utils/ssg.d.ts +49 -0
  243. package/dist/utils/ssr-registry.d.ts +8 -0
  244. package/dist/utils/ssr-stream.d.ts +23 -0
  245. package/dist/utils/ssr.d.ts +17 -0
  246. package/dist/utils/style.d.ts +12 -0
  247. package/dist/utils/theme.d.ts +9 -0
  248. package/dist/utils/tween.d.ts +21 -0
  249. package/dist/utils/video.d.ts +40 -0
  250. package/dist/utils-D4pPF77E.js +689 -0
  251. package/dist/vite.config.d.ts +6 -0
  252. package/dist/vitest.config.d.ts +2 -0
  253. package/dist/vitest.config.ssr.d.ts +2 -0
  254. package/docs/COMPONENTS.md +324 -0
  255. package/docs/DESIGN.md +198 -0
  256. package/docs/style-tokens-public.md +880 -0
  257. package/package.json +137 -78
  258. package/typings.d.ts +163 -114
  259. package/dist/_commonjs-dynamic-modules-DLbDWi6a.js +0 -12
  260. package/dist/add-user-BN1JlY7e.js +0 -4
  261. package/dist/arrow-down-B_hCY3Wt.js +0 -662
  262. package/dist/book-nTEFXU2x.js +0 -4
  263. package/dist/check-circle-fill-B_pd8ZSs.js +0 -4
  264. package/dist/check-circle-szyAJiap.js +0 -4
  265. package/dist/close-CFnkhudp.js +0 -4
  266. package/dist/close-circle-CwmuN2C6.js +0 -4
  267. package/dist/close-circle-fill-jSqPPw9i.js +0 -4
  268. package/dist/colz-DJZvo_8B.js +0 -232
  269. package/dist/docx-CHkPTdGU.js +0 -3665
  270. package/dist/drop-4j4abxje.js +0 -36
  271. package/dist/eye-D_mEt17f.js +0 -4
  272. package/dist/eye-close-BVr3NJtg.js +0 -4
  273. package/dist/home-BUQ4USMk.js +0 -4
  274. package/dist/iconShadowless.js +0 -6
  275. package/dist/index-15M0olqa.js +0 -204
  276. package/dist/index-1v568_nq.js +0 -140
  277. package/dist/index-B897keW5.js +0 -279
  278. package/dist/index-BZR0HaP2.js +0 -40
  279. package/dist/index-B_GuEcTd.js +0 -9575
  280. package/dist/index-Bc2Bcl8D.js +0 -63701
  281. package/dist/index-C4Sv0T51.js +0 -495
  282. package/dist/index-C6RcMHoH.js +0 -187
  283. package/dist/index-C9z10IgG.js +0 -103
  284. package/dist/index-CFjEuvBW.js +0 -308
  285. package/dist/index-CGEx9VOA.js +0 -17106
  286. package/dist/index-CGYfjKUV.js +0 -72
  287. package/dist/index-CQTJoWhb.js +0 -19
  288. package/dist/index-CiWwvEMM.js +0 -511
  289. package/dist/index-CkM9ENTf.js +0 -496
  290. package/dist/index-CtVOgBDk.js +0 -659
  291. package/dist/index-D4qUro5V.js +0 -279
  292. package/dist/index-D4y9c1Dj.js +0 -310
  293. package/dist/index-DAxs7Dd2.js +0 -119
  294. package/dist/index-DC5EA657.js +0 -91
  295. package/dist/index-DJZmDHz-.js +0 -146
  296. package/dist/index-D_CA5VDZ.js +0 -158
  297. package/dist/index-WfFw4LJT.js +0 -490
  298. package/dist/index-mhFL9MJp.js +0 -320
  299. package/dist/info-circle-COnL5bTJ.js +0 -4
  300. package/dist/info-circle-fill-CFeVMdci.js +0 -4
  301. package/dist/inputShadowless.js +0 -6
  302. package/dist/jszip.min-Dhs3nUkD.js +0 -2346
  303. package/dist/katex-es-B5r5vt3m.js +0 -14628
  304. package/dist/loading-Dcc5RApI.js +0 -4
  305. package/dist/loading-scene-BMc2wqKm.js +0 -4
  306. package/dist/lock-Cr7BnmWN.js +0 -4
  307. package/dist/message-D36_Zo2l.js +0 -4
  308. package/dist/pdf-Cx0VWKFo.js +0 -118
  309. package/dist/power-off-lQRbiBak.js +0 -4
  310. package/dist/preview-CJbz9GjO.js +0 -4
  311. package/dist/preview.js +0 -7
  312. package/dist/selectShadowless.js +0 -564
  313. package/dist/setting-DemlgzVC.js +0 -4
  314. package/dist/shadowless.js +0 -8
  315. package/dist/sprite-CH2zLtZy.js +0 -141
  316. package/dist/style.css +0 -1
  317. package/dist/team-tl4NJXPC.js +0 -4
  318. package/dist/umd/index.umd.cjs +0 -60
  319. package/dist/umd/shadowless/shadowless.umd.cjs +0 -1
  320. package/dist/umd/shadowless/style.css +0 -1
  321. package/dist/umd/style.css +0 -1
  322. package/dist/unlock-CeU74z9n.js +0 -4
  323. package/dist/user-B-eVXwuk.js +0 -4
  324. package/dist/warning-circle-DDUgEDIv.js +0 -4
  325. package/dist/warning-circle-fill-lODUKz0i.js +0 -4
  326. package/readme.md +0 -195
@@ -1,72 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { c as create } from "./arrow-down-B_hCY3Wt.js";
5
- import { H as HTMLElementSSR, c as createCustomError } from "./index-DC5EA657.js";
6
- const f7170ee498e0dd32cbdcb63fba8f75cc = ".remove-wap-active-focus{outline:0;-webkit-tap-highlight-color:transparent}.remove-wap-active-focus:active,.remove-wap-active-focus:focus{outline:0;-webkit-tap-highlight-color:transparent}: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-B5r5vt3m.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
- disconnectCallback() {
45
- }
46
- attributeChangedCallback(k, o, n) {
47
- if (o !== n) {
48
- if (k === "latex") {
49
- this.render();
50
- }
51
- }
52
- }
53
- }
54
- async function Custom() {
55
- if (typeof document !== "undefined" && !customElements.get("r-math")) {
56
- customElements.define("r-math", Math2);
57
- return Math2;
58
- } else {
59
- return createCustomError("document is undefined or r-math is exist");
60
- }
61
- }
62
- const index = Custom();
63
- const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
64
- __proto__: null,
65
- Math: Math2,
66
- default: index
67
- }, Symbol.toStringTag, { value: "Module" }));
68
- export {
69
- Math2 as M,
70
- index as a,
71
- index$1 as i
72
- };
@@ -1,19 +0,0 @@
1
- function Custom() {
2
- if (typeof window !== "undefined" && !customElements.get("r-modal")) {
3
- class CustomModal extends HTMLElement {
4
- constructor() {
5
- super();
6
- }
7
- }
8
- customElements.define("r-modal", CustomModal);
9
- }
10
- }
11
- const index = Custom();
12
- const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
13
- __proto__: null,
14
- default: index
15
- }, Symbol.toStringTag, { value: "Module" }));
16
- export {
17
- index as a,
18
- index$1 as i
19
- };
@@ -1,511 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { e as range } from "./arrow-down-B_hCY3Wt.js";
5
- import { H as HTMLElementSSR, a as createSignal, c as createCustomError } from "./index-DC5EA657.js";
6
- import "./index-D4y9c1Dj.js";
7
- import "./index-WfFw4LJT.js";
8
- import "./selectShadowless.js";
9
- import "./index-15M0olqa.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, -BOT_WIDTH, height - BOT_WIDTH);
430
- const limitX = range(pageX - left - BOT_WIDTH, -BOT_WIDTH, 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", (e) => {
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
- };