umaki 0.13.0 → 0.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/README.md +15 -0
  2. package/dist/LICENSE.txt +1 -32
  3. package/dist/_virtual/_rolldown/runtime.cjs +22 -0
  4. package/dist/index.cjs +138 -0
  5. package/dist/index.es.js +17 -71
  6. package/dist/libs/callback/index.cjs +16 -0
  7. package/dist/libs/callback/index.es.js +12 -4
  8. package/dist/libs/callback/tap-async.cjs +7 -0
  9. package/dist/libs/callback/tap-async.es.js +6 -7
  10. package/dist/libs/callback/tap.cjs +6 -0
  11. package/dist/libs/callback/tap.es.js +5 -6
  12. package/dist/libs/config/_internal.cjs +3 -0
  13. package/dist/libs/config/_internal.es.js +3 -4
  14. package/dist/libs/config/default-config.cjs +3 -0
  15. package/dist/libs/config/default-config.es.js +3 -6
  16. package/dist/libs/config/get-config.cjs +10 -0
  17. package/dist/libs/config/get-config.es.js +6 -8
  18. package/dist/libs/config/index.cjs +19 -0
  19. package/dist/libs/config/index.es.js +12 -6
  20. package/dist/libs/config/set-config.cjs +15 -0
  21. package/dist/libs/config/set-config.d.ts +1 -0
  22. package/dist/libs/config/set-config.es.js +13 -6
  23. package/dist/libs/control/bg-scroll-stop.cjs +8 -0
  24. package/dist/libs/control/bg-scroll-stop.d.ts +1 -0
  25. package/dist/libs/control/bg-scroll-stop.es.js +6 -6
  26. package/dist/libs/control/copy-to-clipboard.cjs +11 -0
  27. package/dist/libs/control/copy-to-clipboard.es.js +10 -13
  28. package/dist/libs/control/index.cjs +22 -0
  29. package/dist/libs/control/index.es.js +12 -7
  30. package/dist/libs/control/pd.cjs +3 -0
  31. package/dist/libs/control/pd.es.js +3 -4
  32. package/dist/libs/control/scroll-to-hash.cjs +30 -0
  33. package/dist/libs/control/scroll-to-hash.d.ts +1 -0
  34. package/dist/libs/control/scroll-to-hash.es.js +29 -35
  35. package/dist/libs/control/video-play-control.cjs +19 -0
  36. package/dist/libs/control/video-play-control.es.js +17 -20
  37. package/dist/libs/convert/change-date-string-to-specific-format.cjs +15 -0
  38. package/dist/libs/convert/change-date-string-to-specific-format.es.js +7 -10
  39. package/dist/libs/convert/hex-to-rgb.cjs +17 -0
  40. package/dist/libs/convert/hex-to-rgb.es.js +16 -21
  41. package/dist/libs/convert/index.cjs +20 -0
  42. package/dist/libs/convert/index.es.js +12 -6
  43. package/dist/libs/convert/json-string-to-json-object.cjs +9 -0
  44. package/dist/libs/convert/json-string-to-json-object.es.js +8 -9
  45. package/dist/libs/convert/rgb-to-hex.cjs +8 -0
  46. package/dist/libs/convert/rgb-to-hex.es.js +7 -8
  47. package/dist/libs/eventControl/debounce.cjs +13 -0
  48. package/dist/libs/eventControl/debounce.es.js +12 -15
  49. package/dist/libs/eventControl/index.cjs +16 -0
  50. package/dist/libs/eventControl/index.es.js +12 -4
  51. package/dist/libs/eventControl/throttle.cjs +13 -0
  52. package/dist/libs/eventControl/throttle.es.js +12 -15
  53. package/dist/libs/get/get-aspect-ratio.cjs +11 -0
  54. package/dist/libs/get/get-aspect-ratio.es.js +9 -9
  55. package/dist/libs/get/get-class-names.cjs +5 -0
  56. package/dist/libs/get/get-class-names.es.js +4 -6
  57. package/dist/libs/get/get-document-height.cjs +6 -0
  58. package/dist/libs/get/get-document-height.d.ts +1 -0
  59. package/dist/libs/get/get-document-height.es.js +5 -3
  60. package/dist/libs/get/get-event-paths.cjs +18 -0
  61. package/dist/libs/get/get-event-paths.es.js +17 -22
  62. package/dist/libs/get/get-gcd.cjs +10 -0
  63. package/dist/libs/get/get-gcd.d.ts +1 -0
  64. package/dist/libs/get/get-gcd.es.js +8 -8
  65. package/dist/libs/get/get-gravatar-url.cjs +10 -0
  66. package/dist/libs/get/get-gravatar-url.d.ts +4 -0
  67. package/dist/libs/get/get-gravatar-url.es.js +6 -7
  68. package/dist/libs/get/get-orientation.cjs +6 -0
  69. package/dist/libs/get/get-orientation.es.js +5 -9
  70. package/dist/libs/get/get-parent-list.cjs +7 -0
  71. package/dist/libs/get/get-parent-list.es.js +6 -7
  72. package/dist/libs/get/get-query-params.cjs +22 -0
  73. package/dist/libs/get/get-query-params.d.ts +1 -0
  74. package/dist/libs/get/get-query-params.es.js +18 -18
  75. package/dist/libs/get/get-random-int.cjs +10 -0
  76. package/dist/libs/get/get-random-int.d.ts +5 -1
  77. package/dist/libs/get/get-random-int.es.js +9 -10
  78. package/dist/libs/get/get-relative-time.cjs +44 -0
  79. package/dist/libs/get/get-relative-time.es.js +42 -26
  80. package/dist/libs/get/get-rem.cjs +6 -0
  81. package/dist/libs/get/get-rem.d.ts +1 -0
  82. package/dist/libs/get/get-rem.es.js +5 -8
  83. package/dist/libs/get/get-rendered-line-height.cjs +52 -0
  84. package/dist/libs/get/get-rendered-line-height.es.js +50 -55
  85. package/dist/libs/get/get-scrollbar-width.cjs +6 -0
  86. package/dist/libs/get/get-scrollbar-width.d.ts +1 -0
  87. package/dist/libs/get/get-scrollbar-width.es.js +5 -3
  88. package/dist/libs/get/get-session-storage.cjs +10 -0
  89. package/dist/libs/get/get-session-storage.es.js +6 -7
  90. package/dist/libs/get/get-string-length.cjs +4 -0
  91. package/dist/libs/get/get-string-length.es.js +3 -4
  92. package/dist/libs/get/get-style-property-value-to-number.cjs +4 -0
  93. package/dist/libs/get/get-style-property-value-to-number.es.js +3 -4
  94. package/dist/libs/get/get-style-property-value.cjs +6 -0
  95. package/dist/libs/get/get-style-property-value.d.ts +1 -0
  96. package/dist/libs/get/get-style-property-value.es.js +5 -3
  97. package/dist/libs/get/get-ua-data.cjs +22 -0
  98. package/dist/libs/get/get-ua-data.es.js +17 -20
  99. package/dist/libs/get/index.cjs +50 -0
  100. package/dist/libs/get/index.es.js +14 -23
  101. package/dist/libs/is/check-device-size.cjs +8 -0
  102. package/dist/libs/is/check-device-size.es.js +6 -9
  103. package/dist/libs/is/index.cjs +34 -0
  104. package/dist/libs/is/index.es.js +13 -14
  105. package/dist/libs/is/is-after-date-time.cjs +9 -0
  106. package/dist/libs/is/is-after-date-time.es.js +5 -8
  107. package/dist/libs/is/is-between-date-time.cjs +14 -0
  108. package/dist/libs/is/is-between-date-time.es.js +8 -11
  109. package/dist/libs/is/is-exist-all-elements.cjs +5 -0
  110. package/dist/libs/is/is-exist-all-elements.es.js +4 -5
  111. package/dist/libs/is/is-in-viewport.cjs +63 -0
  112. package/dist/libs/is/is-in-viewport.es.js +61 -64
  113. package/dist/libs/is/is-ipad.cjs +10 -0
  114. package/dist/libs/is/is-ipad.es.js +7 -10
  115. package/dist/libs/is/is-key-exists.cjs +5 -0
  116. package/dist/libs/is/is-key-exists.es.js +4 -5
  117. package/dist/libs/is/is-online.cjs +6 -0
  118. package/dist/libs/is/is-online.es.js +5 -8
  119. package/dist/libs/is/is-safari.cjs +8 -0
  120. package/dist/libs/is/is-safari.es.js +6 -9
  121. package/dist/libs/is/is-scrollable.cjs +7 -0
  122. package/dist/libs/is/is-scrollable.es.js +6 -7
  123. package/dist/libs/is/is-touch-support.cjs +9 -0
  124. package/dist/libs/is/is-touch-support.es.js +8 -10
  125. package/dist/libs/remove/index.cjs +20 -0
  126. package/dist/libs/remove/index.es.js +12 -6
  127. package/dist/libs/remove/remove-all-html-tags.cjs +12 -0
  128. package/dist/libs/remove/remove-all-html-tags.d.ts +7 -1
  129. package/dist/libs/remove/remove-all-html-tags.es.js +8 -10
  130. package/dist/libs/remove/remove-attribute.cjs +5 -0
  131. package/dist/libs/remove/remove-attribute.es.js +4 -5
  132. package/dist/libs/remove/remove-session-storage.cjs +8 -0
  133. package/dist/libs/remove/remove-session-storage.es.js +4 -5
  134. package/dist/libs/remove/remove-style-property-value.cjs +6 -0
  135. package/dist/libs/remove/remove-style-property-value.d.ts +1 -0
  136. package/dist/libs/remove/remove-style-property-value.es.js +5 -5
  137. package/dist/libs/security/html-sanitize.cjs +19 -0
  138. package/dist/libs/security/html-sanitize.d.ts +8 -0
  139. package/dist/libs/security/html-sanitize.es.js +13 -6
  140. package/dist/libs/security/index.cjs +15 -0
  141. package/dist/libs/security/index.es.js +12 -5
  142. package/dist/libs/set/index.cjs +24 -0
  143. package/dist/libs/set/index.es.js +12 -8
  144. package/dist/libs/set/set-100vh.cjs +7 -0
  145. package/dist/libs/set/set-100vh.d.ts +1 -0
  146. package/dist/libs/set/set-100vh.es.js +6 -6
  147. package/dist/libs/set/set-100vw.cjs +7 -0
  148. package/dist/libs/set/set-100vw.d.ts +1 -0
  149. package/dist/libs/set/set-100vw.es.js +6 -6
  150. package/dist/libs/set/set-attribute.cjs +5 -0
  151. package/dist/libs/set/set-attribute.es.js +4 -5
  152. package/dist/libs/set/set-scroll-position-to-center.cjs +11 -0
  153. package/dist/libs/set/set-scroll-position-to-center.es.js +10 -9
  154. package/dist/libs/set/set-session-storage.cjs +8 -0
  155. package/dist/libs/set/set-session-storage.es.js +4 -5
  156. package/dist/libs/set/set-style-property-value.cjs +6 -0
  157. package/dist/libs/set/set-style-property-value.d.ts +1 -0
  158. package/dist/libs/set/set-style-property-value.es.js +5 -5
  159. package/dist/libs/to/index.cjs +16 -0
  160. package/dist/libs/to/index.es.js +12 -4
  161. package/dist/libs/to/to-boolean.cjs +5 -0
  162. package/dist/libs/to/to-boolean.es.js +4 -5
  163. package/dist/libs/to/to-positive-number.cjs +3 -0
  164. package/dist/libs/to/to-positive-number.es.js +3 -4
  165. package/dist/libs/transform/index.cjs +14 -0
  166. package/dist/libs/transform/index.es.js +12 -4
  167. package/dist/libs/transform/wrap-text-with-spans.cjs +17 -0
  168. package/dist/libs/transform/wrap-text-with-spans.es.js +15 -20
  169. package/dist/libs/wait/index.cjs +16 -0
  170. package/dist/libs/wait/index.es.js +12 -4
  171. package/dist/libs/wait/sleep.cjs +5 -0
  172. package/dist/libs/wait/sleep.es.js +4 -5
  173. package/dist/libs/wait/wait-for-all-media-loaded.cjs +31 -0
  174. package/dist/libs/wait/wait-for-all-media-loaded.d.ts +1 -0
  175. package/dist/libs/wait/wait-for-all-media-loaded.es.js +30 -43
  176. package/package.json +38 -36
  177. package/dist/_virtual/_commonjsHelpers.cjs.js +0 -6
  178. package/dist/_virtual/_commonjsHelpers.es.js +0 -6
  179. package/dist/_virtual/isBetween.cjs.js +0 -7
  180. package/dist/_virtual/isBetween.cjs2.js +0 -4
  181. package/dist/_virtual/isBetween.es.js +0 -7
  182. package/dist/_virtual/isBetween.es2.js +0 -4
  183. package/dist/_virtual/timezone.cjs.js +0 -7
  184. package/dist/_virtual/timezone.cjs2.js +0 -4
  185. package/dist/_virtual/timezone.es.js +0 -7
  186. package/dist/_virtual/timezone.es2.js +0 -4
  187. package/dist/_virtual/utc.cjs.js +0 -7
  188. package/dist/_virtual/utc.cjs2.js +0 -4
  189. package/dist/_virtual/utc.es.js +0 -7
  190. package/dist/_virtual/utc.es2.js +0 -4
  191. package/dist/index.cjs.js +0 -128
  192. package/dist/libs/callback/index.cjs.js +0 -6
  193. package/dist/libs/callback/tap-async.cjs.js +0 -8
  194. package/dist/libs/callback/tap.cjs.js +0 -7
  195. package/dist/libs/config/_internal.cjs.js +0 -5
  196. package/dist/libs/config/default-config.cjs.js +0 -6
  197. package/dist/libs/config/get-config.cjs.js +0 -11
  198. package/dist/libs/config/index.cjs.js +0 -9
  199. package/dist/libs/config/set-config.cjs.js +0 -8
  200. package/dist/libs/control/bg-scroll-stop.cjs.js +0 -8
  201. package/dist/libs/control/copy-to-clipboard.cjs.js +0 -14
  202. package/dist/libs/control/index.cjs.js +0 -12
  203. package/dist/libs/control/pd.cjs.js +0 -4
  204. package/dist/libs/control/scroll-to-hash.cjs.js +0 -36
  205. package/dist/libs/control/video-play-control.cjs.js +0 -22
  206. package/dist/libs/convert/change-date-string-to-specific-format.cjs.js +0 -14
  207. package/dist/libs/convert/hex-to-rgb.cjs.js +0 -22
  208. package/dist/libs/convert/index.cjs.js +0 -10
  209. package/dist/libs/convert/json-string-to-json-object.cjs.js +0 -10
  210. package/dist/libs/convert/rgb-to-hex.cjs.js +0 -9
  211. package/dist/libs/eventControl/debounce.cjs.js +0 -16
  212. package/dist/libs/eventControl/index.cjs.js +0 -6
  213. package/dist/libs/eventControl/throttle.cjs.js +0 -16
  214. package/dist/libs/get/get-aspect-ratio.cjs.js +0 -11
  215. package/dist/libs/get/get-class-names.cjs.js +0 -7
  216. package/dist/libs/get/get-document-height.cjs.js +0 -4
  217. package/dist/libs/get/get-event-paths.cjs.js +0 -23
  218. package/dist/libs/get/get-gcd.cjs.js +0 -10
  219. package/dist/libs/get/get-gravatar-url.cjs.js +0 -9
  220. package/dist/libs/get/get-orientation.cjs.js +0 -10
  221. package/dist/libs/get/get-parent-list.cjs.js +0 -8
  222. package/dist/libs/get/get-query-params.cjs.js +0 -20
  223. package/dist/libs/get/get-random-int.cjs.js +0 -11
  224. package/dist/libs/get/get-relative-time.cjs.js +0 -28
  225. package/dist/libs/get/get-rem.cjs.js +0 -9
  226. package/dist/libs/get/get-rendered-line-height.cjs.js +0 -57
  227. package/dist/libs/get/get-scrollbar-width.cjs.js +0 -4
  228. package/dist/libs/get/get-session-storage.cjs.js +0 -9
  229. package/dist/libs/get/get-string-length.cjs.js +0 -5
  230. package/dist/libs/get/get-style-property-value-to-number.cjs.js +0 -5
  231. package/dist/libs/get/get-style-property-value.cjs.js +0 -4
  232. package/dist/libs/get/get-ua-data.cjs.js +0 -23
  233. package/dist/libs/get/index.cjs.js +0 -40
  234. package/dist/libs/is/check-device-size.cjs.js +0 -11
  235. package/dist/libs/is/index.cjs.js +0 -24
  236. package/dist/libs/is/is-after-date-time.cjs.js +0 -10
  237. package/dist/libs/is/is-between-date-time.cjs.js +0 -14
  238. package/dist/libs/is/is-exist-all-elements.cjs.js +0 -6
  239. package/dist/libs/is/is-in-viewport.cjs.js +0 -66
  240. package/dist/libs/is/is-ipad.cjs.js +0 -13
  241. package/dist/libs/is/is-key-exists.cjs.js +0 -6
  242. package/dist/libs/is/is-online.cjs.js +0 -9
  243. package/dist/libs/is/is-safari.cjs.js +0 -11
  244. package/dist/libs/is/is-scrollable.cjs.js +0 -8
  245. package/dist/libs/is/is-touch-support.cjs.js +0 -11
  246. package/dist/libs/remove/index.cjs.js +0 -10
  247. package/dist/libs/remove/remove-all-html-tags.cjs.js +0 -12
  248. package/dist/libs/remove/remove-attribute.cjs.js +0 -6
  249. package/dist/libs/remove/remove-session-storage.cjs.js +0 -7
  250. package/dist/libs/remove/remove-style-property-value.cjs.js +0 -6
  251. package/dist/libs/security/html-sanitize.cjs.js +0 -9
  252. package/dist/libs/security/index.cjs.js +0 -5
  253. package/dist/libs/set/index.cjs.js +0 -14
  254. package/dist/libs/set/set-100vh.cjs.js +0 -7
  255. package/dist/libs/set/set-100vw.cjs.js +0 -7
  256. package/dist/libs/set/set-attribute.cjs.js +0 -6
  257. package/dist/libs/set/set-scroll-position-to-center.cjs.js +0 -10
  258. package/dist/libs/set/set-session-storage.cjs.js +0 -7
  259. package/dist/libs/set/set-style-property-value.cjs.js +0 -6
  260. package/dist/libs/to/index.cjs.js +0 -6
  261. package/dist/libs/to/to-boolean.cjs.js +0 -6
  262. package/dist/libs/to/to-positive-number.cjs.js +0 -4
  263. package/dist/libs/transform/index.cjs.js +0 -4
  264. package/dist/libs/transform/wrap-text-with-spans.cjs.js +0 -22
  265. package/dist/libs/wait/index.cjs.js +0 -6
  266. package/dist/libs/wait/sleep.cjs.js +0 -6
  267. package/dist/libs/wait/wait-for-all-media-loaded.cjs.js +0 -44
  268. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isBetween.cjs.js +0 -23
  269. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isBetween.es.js +0 -23
  270. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/timezone.cjs.js +0 -71
  271. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/timezone.es.js +0 -71
  272. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/utc.cjs.js +0 -83
  273. package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/utc.es.js +0 -83
@@ -0,0 +1,11 @@
1
+ // src/libs/control/copy-to-clipboard.ts
2
+ var copyToClipboard = async (text) => {
3
+ if (typeof navigator === "undefined" || !navigator.clipboard) return false;
4
+ try {
5
+ await navigator.clipboard.writeText(text);
6
+ return true;
7
+ } catch {
8
+ return false;
9
+ }
10
+ };
11
+ exports.copyToClipboard = copyToClipboard;
@@ -1,14 +1,11 @@
1
- const copyToClipboard = async (text) => {
2
- if (typeof navigator === "undefined" || !navigator.clipboard) {
3
- return false;
4
- }
5
- try {
6
- await navigator.clipboard.writeText(text);
7
- return true;
8
- } catch {
9
- return false;
10
- }
11
- };
12
- export {
13
- copyToClipboard
1
+ // src/libs/control/copy-to-clipboard.ts
2
+ var copyToClipboard = async (text) => {
3
+ if (typeof navigator === "undefined" || !navigator.clipboard) return false;
4
+ try {
5
+ await navigator.clipboard.writeText(text);
6
+ return true;
7
+ } catch {
8
+ return false;
9
+ }
14
10
  };
11
+ export { copyToClipboard };
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * name: umaki
3
+ * version: v0.13.2
4
+ * description: A utility that is often used in web production.
5
+ * author: TsubasaHiga
6
+ * homepage: https://github.com/TsubasaHiga/umaki
7
+ * Released under the MIT License
8
+ *
9
+ * This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
10
+ * For license information, please see LICENSE.txt
11
+ */
12
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
13
+ const require_bg_scroll_stop = require("./bg-scroll-stop.cjs");
14
+ const require_copy_to_clipboard = require("./copy-to-clipboard.cjs");
15
+ const require_pd = require("./pd.cjs");
16
+ const require_scroll_to_hash = require("./scroll-to-hash.cjs");
17
+ const require_video_play_control = require("./video-play-control.cjs");
18
+ exports.bgScrollStop = require_bg_scroll_stop.bgScrollStop;
19
+ exports.copyToClipboard = require_copy_to_clipboard.copyToClipboard;
20
+ exports.pd = require_pd.pd;
21
+ exports.scrollToHash = require_scroll_to_hash.scrollToHash;
22
+ exports.videoPlayControl = require_video_play_control.videoPlayControl;
@@ -1,12 +1,17 @@
1
+ /*!
2
+ * name: umaki
3
+ * version: v0.13.2
4
+ * description: A utility that is often used in web production.
5
+ * author: TsubasaHiga
6
+ * homepage: https://github.com/TsubasaHiga/umaki
7
+ * Released under the MIT License
8
+ *
9
+ * This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
10
+ * For license information, please see LICENSE.txt
11
+ */
1
12
  import { bgScrollStop } from "./bg-scroll-stop.es.js";
2
13
  import { copyToClipboard } from "./copy-to-clipboard.es.js";
3
14
  import { pd } from "./pd.es.js";
4
15
  import { scrollToHash } from "./scroll-to-hash.es.js";
5
16
  import { videoPlayControl } from "./video-play-control.es.js";
6
- export {
7
- bgScrollStop,
8
- copyToClipboard,
9
- pd,
10
- scrollToHash,
11
- videoPlayControl
12
- };
17
+ export { bgScrollStop, copyToClipboard, pd, scrollToHash, videoPlayControl };
@@ -0,0 +1,3 @@
1
+ // src/libs/control/pd.ts
2
+ var pd = (e) => e.preventDefault();
3
+ exports.pd = pd;
@@ -1,4 +1,3 @@
1
- const pd = (e) => e.preventDefault();
2
- export {
3
- pd
4
- };
1
+ // src/libs/control/pd.ts
2
+ var pd = (e) => e.preventDefault();
3
+ export { pd };
@@ -0,0 +1,30 @@
1
+ // src/libs/control/scroll-to-hash.ts
2
+ var scrollToHash = async (hash, isSmooth = true, manualOffset) => {
3
+ if (typeof window === "undefined") return false;
4
+ const hashWithoutSharp = hash.replace("#", "");
5
+ const targetElement = document.getElementById(hashWithoutSharp);
6
+ if (!targetElement) return false;
7
+ const posY = Math.floor(targetElement.getBoundingClientRect().top + window.scrollY) - (manualOffset ? manualOffset : 0);
8
+ window.scrollTo({
9
+ top: posY,
10
+ behavior: isSmooth ? "smooth" : "instant"
11
+ });
12
+ return new Promise((resolve) => {
13
+ const rejectTimer = setTimeout(() => {
14
+ window.removeEventListener("scroll", scrollHandler);
15
+ resolve(false);
16
+ }, 1e3);
17
+ const scrollHandler = () => {
18
+ if (window.scrollY !== posY) return;
19
+ window.removeEventListener("scroll", scrollHandler);
20
+ clearTimeout(rejectTimer);
21
+ resolve(true);
22
+ };
23
+ if (window.scrollY === posY) {
24
+ clearTimeout(rejectTimer);
25
+ resolve(true);
26
+ }
27
+ if (window.scrollY !== posY) window.addEventListener("scroll", scrollHandler, false);
28
+ });
29
+ };
30
+ exports.scrollToHash = scrollToHash;
@@ -5,5 +5,6 @@
5
5
  * @param isSmooth - Determines if the scroll behavior should be smooth. Defaults to true.
6
6
  * @param manualOffset - An optional manual offset to adjust the scroll position.
7
7
  * @returns A Promise that resolves to true if the scroll was successful, or false if the target element was not found or the scroll did not complete within the timeout.
8
+ * Resolves to false in SSR environments where window is undefined.
8
9
  */
9
10
  export declare const scrollToHash: (hash: string, isSmooth?: boolean, manualOffset?: number) => Promise<boolean>;
@@ -1,36 +1,30 @@
1
- const scrollToHash = async (hash, isSmooth = true, manualOffset) => {
2
- const hashWithoutSharp = hash.replace("#", "");
3
- const targetElement = document.getElementById(hashWithoutSharp);
4
- if (!targetElement) return false;
5
- const elementPosY = Math.floor(
6
- targetElement.getBoundingClientRect().top + window.scrollY
7
- );
8
- const offset = manualOffset ? manualOffset : 0;
9
- const posY = elementPosY - offset;
10
- window.scrollTo({
11
- top: posY,
12
- behavior: isSmooth ? "smooth" : "instant"
13
- });
14
- return new Promise((resolve) => {
15
- const rejectTimer = setTimeout(() => {
16
- window.removeEventListener("scroll", scrollHandler);
17
- resolve(false);
18
- }, 1e3);
19
- const scrollHandler = () => {
20
- if (window.scrollY !== posY) return;
21
- window.removeEventListener("scroll", scrollHandler);
22
- clearTimeout(rejectTimer);
23
- resolve(true);
24
- };
25
- if (window.scrollY === posY) {
26
- clearTimeout(rejectTimer);
27
- resolve(true);
28
- }
29
- if (window.scrollY !== posY) {
30
- window.addEventListener("scroll", scrollHandler, false);
31
- }
32
- });
33
- };
34
- export {
35
- scrollToHash
1
+ // src/libs/control/scroll-to-hash.ts
2
+ var scrollToHash = async (hash, isSmooth = true, manualOffset) => {
3
+ if (typeof window === "undefined") return false;
4
+ const hashWithoutSharp = hash.replace("#", "");
5
+ const targetElement = document.getElementById(hashWithoutSharp);
6
+ if (!targetElement) return false;
7
+ const posY = Math.floor(targetElement.getBoundingClientRect().top + window.scrollY) - (manualOffset ? manualOffset : 0);
8
+ window.scrollTo({
9
+ top: posY,
10
+ behavior: isSmooth ? "smooth" : "instant"
11
+ });
12
+ return new Promise((resolve) => {
13
+ const rejectTimer = setTimeout(() => {
14
+ window.removeEventListener("scroll", scrollHandler);
15
+ resolve(false);
16
+ }, 1e3);
17
+ const scrollHandler = () => {
18
+ if (window.scrollY !== posY) return;
19
+ window.removeEventListener("scroll", scrollHandler);
20
+ clearTimeout(rejectTimer);
21
+ resolve(true);
22
+ };
23
+ if (window.scrollY === posY) {
24
+ clearTimeout(rejectTimer);
25
+ resolve(true);
26
+ }
27
+ if (window.scrollY !== posY) window.addEventListener("scroll", scrollHandler, false);
28
+ });
36
29
  };
30
+ export { scrollToHash };
@@ -0,0 +1,19 @@
1
+ const require_to_boolean = require("../to/to-boolean.cjs");
2
+ // src/libs/control/video-play-control.ts
3
+ var videoPlayControl = async (videoElement, state, currentTime) => {
4
+ if (state && videoElement.paused) {
5
+ if (require_to_boolean.toBoolean(videoElement.dataset.playing ?? "")) return;
6
+ const playPromise = videoElement.play();
7
+ if (playPromise === void 0) return;
8
+ try {
9
+ await playPromise;
10
+ videoElement.currentTime = currentTime || 0;
11
+ videoElement.dataset.playing = "true";
12
+ } catch {}
13
+ }
14
+ if (!state) {
15
+ videoElement.pause();
16
+ videoElement.dataset.playing = "false";
17
+ }
18
+ };
19
+ exports.videoPlayControl = videoPlayControl;
@@ -1,22 +1,19 @@
1
1
  import { toBoolean } from "../to/to-boolean.es.js";
2
- const videoPlayControl = async (videoElement, state, currentTime) => {
3
- if (state && videoElement.paused) {
4
- const isPlaying = toBoolean(videoElement.dataset.playing ?? "");
5
- if (isPlaying) return;
6
- const playPromise = videoElement.play();
7
- if (playPromise === void 0) return;
8
- try {
9
- await playPromise;
10
- videoElement.currentTime = currentTime || 0;
11
- videoElement.dataset.playing = "true";
12
- } catch {
13
- }
14
- }
15
- if (!state) {
16
- videoElement.pause();
17
- videoElement.dataset.playing = "false";
18
- }
19
- };
20
- export {
21
- videoPlayControl
2
+ // src/libs/control/video-play-control.ts
3
+ var videoPlayControl = async (videoElement, state, currentTime) => {
4
+ if (state && videoElement.paused) {
5
+ if (toBoolean(videoElement.dataset.playing ?? "")) return;
6
+ const playPromise = videoElement.play();
7
+ if (playPromise === void 0) return;
8
+ try {
9
+ await playPromise;
10
+ videoElement.currentTime = currentTime || 0;
11
+ videoElement.dataset.playing = "true";
12
+ } catch {}
13
+ }
14
+ if (!state) {
15
+ videoElement.pause();
16
+ videoElement.dataset.playing = "false";
17
+ }
22
18
  };
19
+ export { videoPlayControl };
@@ -0,0 +1,15 @@
1
+ const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
2
+ let dayjs = require("dayjs");
3
+ dayjs = require_runtime.__toESM(dayjs, 1);
4
+ let dayjs_plugin_timezone_js = require("dayjs/plugin/timezone.js");
5
+ dayjs_plugin_timezone_js = require_runtime.__toESM(dayjs_plugin_timezone_js, 1);
6
+ let dayjs_plugin_utc_js = require("dayjs/plugin/utc.js");
7
+ dayjs_plugin_utc_js = require_runtime.__toESM(dayjs_plugin_utc_js, 1);
8
+ // src/libs/convert/change-date-string-to-specific-format.ts
9
+ dayjs.default.extend(dayjs_plugin_utc_js.default);
10
+ dayjs.default.extend(dayjs_plugin_timezone_js.default);
11
+ var changeDateStringToSpecificFormat = (date, format = "YYYY年MM月DD日", tz) => {
12
+ if (tz) return (0, dayjs.default)(date).tz(tz).format(format);
13
+ return (0, dayjs.default)(date).format(format);
14
+ };
15
+ exports.changeDateStringToSpecificFormat = changeDateStringToSpecificFormat;
@@ -1,14 +1,11 @@
1
1
  import dayjs from "dayjs";
2
- import timezone from "../../_virtual/timezone.es.js";
3
- import utc from "../../_virtual/utc.es.js";
2
+ import timezone from "dayjs/plugin/timezone.js";
3
+ import utc from "dayjs/plugin/utc.js";
4
+ // src/libs/convert/change-date-string-to-specific-format.ts
4
5
  dayjs.extend(utc);
5
6
  dayjs.extend(timezone);
6
- const changeDateStringToSpecificFormat = (date, format = "YYYY年MM月DD日", tz) => {
7
- if (tz) {
8
- return dayjs(date).tz(tz).format(format);
9
- }
10
- return dayjs(date).format(format);
11
- };
12
- export {
13
- changeDateStringToSpecificFormat
7
+ var changeDateStringToSpecificFormat = (date, format = "YYYY年MM月DD日", tz) => {
8
+ if (tz) return dayjs(date).tz(tz).format(format);
9
+ return dayjs(date).format(format);
14
10
  };
11
+ export { changeDateStringToSpecificFormat };
@@ -0,0 +1,17 @@
1
+ // src/libs/convert/hex-to-rgb.ts
2
+ var HEX_PATTERN = /^[0-9a-fA-F]+$/;
3
+ var hexToRgb = (hex) => {
4
+ const trimmed = hex.trim();
5
+ const normalized = trimmed.startsWith("#") ? trimmed.slice(1) : trimmed;
6
+ if (!HEX_PATTERN.test(normalized)) return void 0;
7
+ let expanded;
8
+ if (normalized.length === 3) expanded = `${normalized[0]}${normalized[0]}${normalized[1]}${normalized[1]}${normalized[2]}${normalized[2]}`;
9
+ else if (normalized.length === 6) expanded = normalized;
10
+ else return;
11
+ return {
12
+ r: Number.parseInt(expanded.slice(0, 2), 16),
13
+ g: Number.parseInt(expanded.slice(2, 4), 16),
14
+ b: Number.parseInt(expanded.slice(4, 6), 16)
15
+ };
16
+ };
17
+ exports.hexToRgb = hexToRgb;
@@ -1,22 +1,17 @@
1
- const HEX_PATTERN = /^[0-9a-fA-F]+$/;
2
- const hexToRgb = (hex) => {
3
- const trimmed = hex.trim();
4
- const normalized = trimmed.startsWith("#") ? trimmed.slice(1) : trimmed;
5
- if (!HEX_PATTERN.test(normalized)) return void 0;
6
- let expanded;
7
- if (normalized.length === 3) {
8
- expanded = `${normalized[0]}${normalized[0]}${normalized[1]}${normalized[1]}${normalized[2]}${normalized[2]}`;
9
- } else if (normalized.length === 6) {
10
- expanded = normalized;
11
- } else {
12
- return void 0;
13
- }
14
- return {
15
- r: Number.parseInt(expanded.slice(0, 2), 16),
16
- g: Number.parseInt(expanded.slice(2, 4), 16),
17
- b: Number.parseInt(expanded.slice(4, 6), 16)
18
- };
19
- };
20
- export {
21
- hexToRgb
1
+ // src/libs/convert/hex-to-rgb.ts
2
+ var HEX_PATTERN = /^[0-9a-fA-F]+$/;
3
+ var hexToRgb = (hex) => {
4
+ const trimmed = hex.trim();
5
+ const normalized = trimmed.startsWith("#") ? trimmed.slice(1) : trimmed;
6
+ if (!HEX_PATTERN.test(normalized)) return void 0;
7
+ let expanded;
8
+ if (normalized.length === 3) expanded = `${normalized[0]}${normalized[0]}${normalized[1]}${normalized[1]}${normalized[2]}${normalized[2]}`;
9
+ else if (normalized.length === 6) expanded = normalized;
10
+ else return;
11
+ return {
12
+ r: Number.parseInt(expanded.slice(0, 2), 16),
13
+ g: Number.parseInt(expanded.slice(2, 4), 16),
14
+ b: Number.parseInt(expanded.slice(4, 6), 16)
15
+ };
22
16
  };
17
+ export { hexToRgb };
@@ -0,0 +1,20 @@
1
+ /*!
2
+ * name: umaki
3
+ * version: v0.13.2
4
+ * description: A utility that is often used in web production.
5
+ * author: TsubasaHiga
6
+ * homepage: https://github.com/TsubasaHiga/umaki
7
+ * Released under the MIT License
8
+ *
9
+ * This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
10
+ * For license information, please see LICENSE.txt
11
+ */
12
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
13
+ const require_change_date_string_to_specific_format = require("./change-date-string-to-specific-format.cjs");
14
+ const require_hex_to_rgb = require("./hex-to-rgb.cjs");
15
+ const require_json_string_to_json_object = require("./json-string-to-json-object.cjs");
16
+ const require_rgb_to_hex = require("./rgb-to-hex.cjs");
17
+ exports.changeDateStringToSpecificFormat = require_change_date_string_to_specific_format.changeDateStringToSpecificFormat;
18
+ exports.hexToRgb = require_hex_to_rgb.hexToRgb;
19
+ exports.jsonStringToJsonObject = require_json_string_to_json_object.jsonStringToJsonObject;
20
+ exports.rgbToHex = require_rgb_to_hex.rgbToHex;
@@ -1,10 +1,16 @@
1
+ /*!
2
+ * name: umaki
3
+ * version: v0.13.2
4
+ * description: A utility that is often used in web production.
5
+ * author: TsubasaHiga
6
+ * homepage: https://github.com/TsubasaHiga/umaki
7
+ * Released under the MIT License
8
+ *
9
+ * This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
10
+ * For license information, please see LICENSE.txt
11
+ */
1
12
  import { changeDateStringToSpecificFormat } from "./change-date-string-to-specific-format.es.js";
2
13
  import { hexToRgb } from "./hex-to-rgb.es.js";
3
14
  import { jsonStringToJsonObject } from "./json-string-to-json-object.es.js";
4
15
  import { rgbToHex } from "./rgb-to-hex.es.js";
5
- export {
6
- changeDateStringToSpecificFormat,
7
- hexToRgb,
8
- jsonStringToJsonObject,
9
- rgbToHex
10
- };
16
+ export { changeDateStringToSpecificFormat, hexToRgb, jsonStringToJsonObject, rgbToHex };
@@ -0,0 +1,9 @@
1
+ // src/libs/convert/json-string-to-json-object.ts
2
+ var jsonStringToJsonObject = (string) => {
3
+ try {
4
+ return JSON.parse(string);
5
+ } catch {
6
+ return;
7
+ }
8
+ };
9
+ exports.jsonStringToJsonObject = jsonStringToJsonObject;
@@ -1,10 +1,9 @@
1
- const jsonStringToJsonObject = (string) => {
2
- try {
3
- return JSON.parse(string);
4
- } catch {
5
- return void 0;
6
- }
7
- };
8
- export {
9
- jsonStringToJsonObject
1
+ // src/libs/convert/json-string-to-json-object.ts
2
+ var jsonStringToJsonObject = (string) => {
3
+ try {
4
+ return JSON.parse(string);
5
+ } catch {
6
+ return;
7
+ }
10
8
  };
9
+ export { jsonStringToJsonObject };
@@ -0,0 +1,8 @@
1
+ // src/libs/convert/rgb-to-hex.ts
2
+ var sanitizeComponent = (value) => {
3
+ if (!Number.isFinite(value)) return 0;
4
+ return Math.max(0, Math.min(255, Math.round(value)));
5
+ };
6
+ var toHexPair = (value) => sanitizeComponent(value).toString(16).padStart(2, "0");
7
+ var rgbToHex = (r, g, b) => `#${toHexPair(r)}${toHexPair(g)}${toHexPair(b)}`;
8
+ exports.rgbToHex = rgbToHex;
@@ -1,9 +1,8 @@
1
- const sanitizeComponent = (value) => {
2
- if (!Number.isFinite(value)) return 0;
3
- return Math.max(0, Math.min(255, Math.round(value)));
4
- };
5
- const toHexPair = (value) => sanitizeComponent(value).toString(16).padStart(2, "0");
6
- const rgbToHex = (r, g, b) => `#${toHexPair(r)}${toHexPair(g)}${toHexPair(b)}`;
7
- export {
8
- rgbToHex
1
+ // src/libs/convert/rgb-to-hex.ts
2
+ var sanitizeComponent = (value) => {
3
+ if (!Number.isFinite(value)) return 0;
4
+ return Math.max(0, Math.min(255, Math.round(value)));
9
5
  };
6
+ var toHexPair = (value) => sanitizeComponent(value).toString(16).padStart(2, "0");
7
+ var rgbToHex = (r, g, b) => `#${toHexPair(r)}${toHexPair(g)}${toHexPair(b)}`;
8
+ export { rgbToHex };
@@ -0,0 +1,13 @@
1
+ // src/libs/eventControl/debounce.ts
2
+ var debounce = (fn, delay) => {
3
+ if (delay < 0 || !Number.isFinite(delay)) throw new Error("delay must be a non-negative finite number");
4
+ let timeoutId = null;
5
+ return (...args) => {
6
+ timeoutId && clearTimeout(timeoutId);
7
+ timeoutId = setTimeout(() => {
8
+ fn(...args);
9
+ timeoutId = null;
10
+ }, delay);
11
+ };
12
+ };
13
+ exports.debounce = debounce;
@@ -1,16 +1,13 @@
1
- const debounce = (fn, delay) => {
2
- if (delay < 0 || !Number.isFinite(delay)) {
3
- throw new Error("delay must be a non-negative finite number");
4
- }
5
- let timeoutId = null;
6
- return (...args) => {
7
- timeoutId && clearTimeout(timeoutId);
8
- timeoutId = setTimeout(() => {
9
- fn(...args);
10
- timeoutId = null;
11
- }, delay);
12
- };
13
- };
14
- export {
15
- debounce
1
+ // src/libs/eventControl/debounce.ts
2
+ var debounce = (fn, delay) => {
3
+ if (delay < 0 || !Number.isFinite(delay)) throw new Error("delay must be a non-negative finite number");
4
+ let timeoutId = null;
5
+ return (...args) => {
6
+ timeoutId && clearTimeout(timeoutId);
7
+ timeoutId = setTimeout(() => {
8
+ fn(...args);
9
+ timeoutId = null;
10
+ }, delay);
11
+ };
16
12
  };
13
+ export { debounce };
@@ -0,0 +1,16 @@
1
+ /*!
2
+ * name: umaki
3
+ * version: v0.13.2
4
+ * description: A utility that is often used in web production.
5
+ * author: TsubasaHiga
6
+ * homepage: https://github.com/TsubasaHiga/umaki
7
+ * Released under the MIT License
8
+ *
9
+ * This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
10
+ * For license information, please see LICENSE.txt
11
+ */
12
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
13
+ const require_debounce = require("./debounce.cjs");
14
+ const require_throttle = require("./throttle.cjs");
15
+ exports.debounce = require_debounce.debounce;
16
+ exports.throttle = require_throttle.throttle;
@@ -1,6 +1,14 @@
1
+ /*!
2
+ * name: umaki
3
+ * version: v0.13.2
4
+ * description: A utility that is often used in web production.
5
+ * author: TsubasaHiga
6
+ * homepage: https://github.com/TsubasaHiga/umaki
7
+ * Released under the MIT License
8
+ *
9
+ * This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
10
+ * For license information, please see LICENSE.txt
11
+ */
1
12
  import { debounce } from "./debounce.es.js";
2
13
  import { throttle } from "./throttle.es.js";
3
- export {
4
- debounce,
5
- throttle
6
- };
14
+ export { debounce, throttle };
@@ -0,0 +1,13 @@
1
+ // src/libs/eventControl/throttle.ts
2
+ var throttle = (fn, wait) => {
3
+ if (wait < 0 || !Number.isFinite(wait)) throw new Error("wait must be a non-negative finite number");
4
+ let lastCallTime = 0;
5
+ return (...args) => {
6
+ const currentTime = Date.now();
7
+ if (currentTime - lastCallTime >= wait) {
8
+ fn(...args);
9
+ lastCallTime = currentTime;
10
+ }
11
+ };
12
+ };
13
+ exports.throttle = throttle;
@@ -1,16 +1,13 @@
1
- const throttle = (fn, wait) => {
2
- if (wait < 0 || !Number.isFinite(wait)) {
3
- throw new Error("wait must be a non-negative finite number");
4
- }
5
- let lastCallTime = 0;
6
- return (...args) => {
7
- const currentTime = Date.now();
8
- if (currentTime - lastCallTime >= wait) {
9
- fn(...args);
10
- lastCallTime = currentTime;
11
- }
12
- };
13
- };
14
- export {
15
- throttle
1
+ // src/libs/eventControl/throttle.ts
2
+ var throttle = (fn, wait) => {
3
+ if (wait < 0 || !Number.isFinite(wait)) throw new Error("wait must be a non-negative finite number");
4
+ let lastCallTime = 0;
5
+ return (...args) => {
6
+ const currentTime = Date.now();
7
+ if (currentTime - lastCallTime >= wait) {
8
+ fn(...args);
9
+ lastCallTime = currentTime;
10
+ }
11
+ };
16
12
  };
13
+ export { throttle };
@@ -0,0 +1,11 @@
1
+ const require_get_gcd = require("./get-gcd.cjs");
2
+ // src/libs/get/get-aspect-ratio.ts
3
+ var getAspectRatio = (w, h) => {
4
+ if (w <= 0 || h <= 0 || !Number.isFinite(w) || !Number.isFinite(h)) throw new Error("Width and height must be positive finite numbers");
5
+ const gcd = require_get_gcd.getGcd(w, h);
6
+ return {
7
+ w: w / gcd,
8
+ h: h / gcd
9
+ };
10
+ };
11
+ exports.getAspectRatio = getAspectRatio;
@@ -1,11 +1,11 @@
1
1
  import { getGcd } from "./get-gcd.es.js";
2
- const getAspectRatio = (w, h) => {
3
- if (w <= 0 || h <= 0 || !Number.isFinite(w) || !Number.isFinite(h)) {
4
- throw new Error("Width and height must be positive finite numbers");
5
- }
6
- const gcd = getGcd(w, h);
7
- return { w: w / gcd, h: h / gcd };
8
- };
9
- export {
10
- getAspectRatio
2
+ // src/libs/get/get-aspect-ratio.ts
3
+ var getAspectRatio = (w, h) => {
4
+ if (w <= 0 || h <= 0 || !Number.isFinite(w) || !Number.isFinite(h)) throw new Error("Width and height must be positive finite numbers");
5
+ const gcd = getGcd(w, h);
6
+ return {
7
+ w: w / gcd,
8
+ h: h / gcd
9
+ };
11
10
  };
11
+ export { getAspectRatio };
@@ -0,0 +1,5 @@
1
+ // src/libs/get/get-class-names.ts
2
+ var getClassNames = (target) => {
3
+ return String(target.classList).split(" ").filter((v) => v);
4
+ };
5
+ exports.getClassNames = getClassNames;