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.
- package/README.md +15 -0
- package/dist/LICENSE.txt +1 -32
- package/dist/_virtual/_rolldown/runtime.cjs +22 -0
- package/dist/index.cjs +138 -0
- package/dist/index.es.js +17 -71
- package/dist/libs/callback/index.cjs +16 -0
- package/dist/libs/callback/index.es.js +12 -4
- package/dist/libs/callback/tap-async.cjs +7 -0
- package/dist/libs/callback/tap-async.es.js +6 -7
- package/dist/libs/callback/tap.cjs +6 -0
- package/dist/libs/callback/tap.es.js +5 -6
- package/dist/libs/config/_internal.cjs +3 -0
- package/dist/libs/config/_internal.es.js +3 -4
- package/dist/libs/config/default-config.cjs +3 -0
- package/dist/libs/config/default-config.es.js +3 -6
- package/dist/libs/config/get-config.cjs +10 -0
- package/dist/libs/config/get-config.es.js +6 -8
- package/dist/libs/config/index.cjs +19 -0
- package/dist/libs/config/index.es.js +12 -6
- package/dist/libs/config/set-config.cjs +15 -0
- package/dist/libs/config/set-config.d.ts +1 -0
- package/dist/libs/config/set-config.es.js +13 -6
- package/dist/libs/control/bg-scroll-stop.cjs +8 -0
- package/dist/libs/control/bg-scroll-stop.d.ts +1 -0
- package/dist/libs/control/bg-scroll-stop.es.js +6 -6
- package/dist/libs/control/copy-to-clipboard.cjs +11 -0
- package/dist/libs/control/copy-to-clipboard.es.js +10 -13
- package/dist/libs/control/index.cjs +22 -0
- package/dist/libs/control/index.es.js +12 -7
- package/dist/libs/control/pd.cjs +3 -0
- package/dist/libs/control/pd.es.js +3 -4
- package/dist/libs/control/scroll-to-hash.cjs +30 -0
- package/dist/libs/control/scroll-to-hash.d.ts +1 -0
- package/dist/libs/control/scroll-to-hash.es.js +29 -35
- package/dist/libs/control/video-play-control.cjs +19 -0
- package/dist/libs/control/video-play-control.es.js +17 -20
- package/dist/libs/convert/change-date-string-to-specific-format.cjs +15 -0
- package/dist/libs/convert/change-date-string-to-specific-format.es.js +7 -10
- package/dist/libs/convert/hex-to-rgb.cjs +17 -0
- package/dist/libs/convert/hex-to-rgb.es.js +16 -21
- package/dist/libs/convert/index.cjs +20 -0
- package/dist/libs/convert/index.es.js +12 -6
- package/dist/libs/convert/json-string-to-json-object.cjs +9 -0
- package/dist/libs/convert/json-string-to-json-object.es.js +8 -9
- package/dist/libs/convert/rgb-to-hex.cjs +8 -0
- package/dist/libs/convert/rgb-to-hex.es.js +7 -8
- package/dist/libs/eventControl/debounce.cjs +13 -0
- package/dist/libs/eventControl/debounce.es.js +12 -15
- package/dist/libs/eventControl/index.cjs +16 -0
- package/dist/libs/eventControl/index.es.js +12 -4
- package/dist/libs/eventControl/throttle.cjs +13 -0
- package/dist/libs/eventControl/throttle.es.js +12 -15
- package/dist/libs/get/get-aspect-ratio.cjs +11 -0
- package/dist/libs/get/get-aspect-ratio.es.js +9 -9
- package/dist/libs/get/get-class-names.cjs +5 -0
- package/dist/libs/get/get-class-names.es.js +4 -6
- package/dist/libs/get/get-document-height.cjs +6 -0
- package/dist/libs/get/get-document-height.d.ts +1 -0
- package/dist/libs/get/get-document-height.es.js +5 -3
- package/dist/libs/get/get-event-paths.cjs +18 -0
- package/dist/libs/get/get-event-paths.es.js +17 -22
- package/dist/libs/get/get-gcd.cjs +10 -0
- package/dist/libs/get/get-gcd.d.ts +1 -0
- package/dist/libs/get/get-gcd.es.js +8 -8
- package/dist/libs/get/get-gravatar-url.cjs +10 -0
- package/dist/libs/get/get-gravatar-url.d.ts +4 -0
- package/dist/libs/get/get-gravatar-url.es.js +6 -7
- package/dist/libs/get/get-orientation.cjs +6 -0
- package/dist/libs/get/get-orientation.es.js +5 -9
- package/dist/libs/get/get-parent-list.cjs +7 -0
- package/dist/libs/get/get-parent-list.es.js +6 -7
- package/dist/libs/get/get-query-params.cjs +22 -0
- package/dist/libs/get/get-query-params.d.ts +1 -0
- package/dist/libs/get/get-query-params.es.js +18 -18
- package/dist/libs/get/get-random-int.cjs +10 -0
- package/dist/libs/get/get-random-int.d.ts +5 -1
- package/dist/libs/get/get-random-int.es.js +9 -10
- package/dist/libs/get/get-relative-time.cjs +44 -0
- package/dist/libs/get/get-relative-time.es.js +42 -26
- package/dist/libs/get/get-rem.cjs +6 -0
- package/dist/libs/get/get-rem.d.ts +1 -0
- package/dist/libs/get/get-rem.es.js +5 -8
- package/dist/libs/get/get-rendered-line-height.cjs +52 -0
- package/dist/libs/get/get-rendered-line-height.es.js +50 -55
- package/dist/libs/get/get-scrollbar-width.cjs +6 -0
- package/dist/libs/get/get-scrollbar-width.d.ts +1 -0
- package/dist/libs/get/get-scrollbar-width.es.js +5 -3
- package/dist/libs/get/get-session-storage.cjs +10 -0
- package/dist/libs/get/get-session-storage.es.js +6 -7
- package/dist/libs/get/get-string-length.cjs +4 -0
- package/dist/libs/get/get-string-length.es.js +3 -4
- package/dist/libs/get/get-style-property-value-to-number.cjs +4 -0
- package/dist/libs/get/get-style-property-value-to-number.es.js +3 -4
- package/dist/libs/get/get-style-property-value.cjs +6 -0
- package/dist/libs/get/get-style-property-value.d.ts +1 -0
- package/dist/libs/get/get-style-property-value.es.js +5 -3
- package/dist/libs/get/get-ua-data.cjs +22 -0
- package/dist/libs/get/get-ua-data.es.js +17 -20
- package/dist/libs/get/index.cjs +50 -0
- package/dist/libs/get/index.es.js +14 -23
- package/dist/libs/is/check-device-size.cjs +8 -0
- package/dist/libs/is/check-device-size.es.js +6 -9
- package/dist/libs/is/index.cjs +34 -0
- package/dist/libs/is/index.es.js +13 -14
- package/dist/libs/is/is-after-date-time.cjs +9 -0
- package/dist/libs/is/is-after-date-time.es.js +5 -8
- package/dist/libs/is/is-between-date-time.cjs +14 -0
- package/dist/libs/is/is-between-date-time.es.js +8 -11
- package/dist/libs/is/is-exist-all-elements.cjs +5 -0
- package/dist/libs/is/is-exist-all-elements.es.js +4 -5
- package/dist/libs/is/is-in-viewport.cjs +63 -0
- package/dist/libs/is/is-in-viewport.es.js +61 -64
- package/dist/libs/is/is-ipad.cjs +10 -0
- package/dist/libs/is/is-ipad.es.js +7 -10
- package/dist/libs/is/is-key-exists.cjs +5 -0
- package/dist/libs/is/is-key-exists.es.js +4 -5
- package/dist/libs/is/is-online.cjs +6 -0
- package/dist/libs/is/is-online.es.js +5 -8
- package/dist/libs/is/is-safari.cjs +8 -0
- package/dist/libs/is/is-safari.es.js +6 -9
- package/dist/libs/is/is-scrollable.cjs +7 -0
- package/dist/libs/is/is-scrollable.es.js +6 -7
- package/dist/libs/is/is-touch-support.cjs +9 -0
- package/dist/libs/is/is-touch-support.es.js +8 -10
- package/dist/libs/remove/index.cjs +20 -0
- package/dist/libs/remove/index.es.js +12 -6
- package/dist/libs/remove/remove-all-html-tags.cjs +12 -0
- package/dist/libs/remove/remove-all-html-tags.d.ts +7 -1
- package/dist/libs/remove/remove-all-html-tags.es.js +8 -10
- package/dist/libs/remove/remove-attribute.cjs +5 -0
- package/dist/libs/remove/remove-attribute.es.js +4 -5
- package/dist/libs/remove/remove-session-storage.cjs +8 -0
- package/dist/libs/remove/remove-session-storage.es.js +4 -5
- package/dist/libs/remove/remove-style-property-value.cjs +6 -0
- package/dist/libs/remove/remove-style-property-value.d.ts +1 -0
- package/dist/libs/remove/remove-style-property-value.es.js +5 -5
- package/dist/libs/security/html-sanitize.cjs +19 -0
- package/dist/libs/security/html-sanitize.d.ts +8 -0
- package/dist/libs/security/html-sanitize.es.js +13 -6
- package/dist/libs/security/index.cjs +15 -0
- package/dist/libs/security/index.es.js +12 -5
- package/dist/libs/set/index.cjs +24 -0
- package/dist/libs/set/index.es.js +12 -8
- package/dist/libs/set/set-100vh.cjs +7 -0
- package/dist/libs/set/set-100vh.d.ts +1 -0
- package/dist/libs/set/set-100vh.es.js +6 -6
- package/dist/libs/set/set-100vw.cjs +7 -0
- package/dist/libs/set/set-100vw.d.ts +1 -0
- package/dist/libs/set/set-100vw.es.js +6 -6
- package/dist/libs/set/set-attribute.cjs +5 -0
- package/dist/libs/set/set-attribute.es.js +4 -5
- package/dist/libs/set/set-scroll-position-to-center.cjs +11 -0
- package/dist/libs/set/set-scroll-position-to-center.es.js +10 -9
- package/dist/libs/set/set-session-storage.cjs +8 -0
- package/dist/libs/set/set-session-storage.es.js +4 -5
- package/dist/libs/set/set-style-property-value.cjs +6 -0
- package/dist/libs/set/set-style-property-value.d.ts +1 -0
- package/dist/libs/set/set-style-property-value.es.js +5 -5
- package/dist/libs/to/index.cjs +16 -0
- package/dist/libs/to/index.es.js +12 -4
- package/dist/libs/to/to-boolean.cjs +5 -0
- package/dist/libs/to/to-boolean.es.js +4 -5
- package/dist/libs/to/to-positive-number.cjs +3 -0
- package/dist/libs/to/to-positive-number.es.js +3 -4
- package/dist/libs/transform/index.cjs +14 -0
- package/dist/libs/transform/index.es.js +12 -4
- package/dist/libs/transform/wrap-text-with-spans.cjs +17 -0
- package/dist/libs/transform/wrap-text-with-spans.es.js +15 -20
- package/dist/libs/wait/index.cjs +16 -0
- package/dist/libs/wait/index.es.js +12 -4
- package/dist/libs/wait/sleep.cjs +5 -0
- package/dist/libs/wait/sleep.es.js +4 -5
- package/dist/libs/wait/wait-for-all-media-loaded.cjs +31 -0
- package/dist/libs/wait/wait-for-all-media-loaded.d.ts +1 -0
- package/dist/libs/wait/wait-for-all-media-loaded.es.js +30 -43
- package/package.json +38 -36
- package/dist/_virtual/_commonjsHelpers.cjs.js +0 -6
- package/dist/_virtual/_commonjsHelpers.es.js +0 -6
- package/dist/_virtual/isBetween.cjs.js +0 -7
- package/dist/_virtual/isBetween.cjs2.js +0 -4
- package/dist/_virtual/isBetween.es.js +0 -7
- package/dist/_virtual/isBetween.es2.js +0 -4
- package/dist/_virtual/timezone.cjs.js +0 -7
- package/dist/_virtual/timezone.cjs2.js +0 -4
- package/dist/_virtual/timezone.es.js +0 -7
- package/dist/_virtual/timezone.es2.js +0 -4
- package/dist/_virtual/utc.cjs.js +0 -7
- package/dist/_virtual/utc.cjs2.js +0 -4
- package/dist/_virtual/utc.es.js +0 -7
- package/dist/_virtual/utc.es2.js +0 -4
- package/dist/index.cjs.js +0 -128
- package/dist/libs/callback/index.cjs.js +0 -6
- package/dist/libs/callback/tap-async.cjs.js +0 -8
- package/dist/libs/callback/tap.cjs.js +0 -7
- package/dist/libs/config/_internal.cjs.js +0 -5
- package/dist/libs/config/default-config.cjs.js +0 -6
- package/dist/libs/config/get-config.cjs.js +0 -11
- package/dist/libs/config/index.cjs.js +0 -9
- package/dist/libs/config/set-config.cjs.js +0 -8
- package/dist/libs/control/bg-scroll-stop.cjs.js +0 -8
- package/dist/libs/control/copy-to-clipboard.cjs.js +0 -14
- package/dist/libs/control/index.cjs.js +0 -12
- package/dist/libs/control/pd.cjs.js +0 -4
- package/dist/libs/control/scroll-to-hash.cjs.js +0 -36
- package/dist/libs/control/video-play-control.cjs.js +0 -22
- package/dist/libs/convert/change-date-string-to-specific-format.cjs.js +0 -14
- package/dist/libs/convert/hex-to-rgb.cjs.js +0 -22
- package/dist/libs/convert/index.cjs.js +0 -10
- package/dist/libs/convert/json-string-to-json-object.cjs.js +0 -10
- package/dist/libs/convert/rgb-to-hex.cjs.js +0 -9
- package/dist/libs/eventControl/debounce.cjs.js +0 -16
- package/dist/libs/eventControl/index.cjs.js +0 -6
- package/dist/libs/eventControl/throttle.cjs.js +0 -16
- package/dist/libs/get/get-aspect-ratio.cjs.js +0 -11
- package/dist/libs/get/get-class-names.cjs.js +0 -7
- package/dist/libs/get/get-document-height.cjs.js +0 -4
- package/dist/libs/get/get-event-paths.cjs.js +0 -23
- package/dist/libs/get/get-gcd.cjs.js +0 -10
- package/dist/libs/get/get-gravatar-url.cjs.js +0 -9
- package/dist/libs/get/get-orientation.cjs.js +0 -10
- package/dist/libs/get/get-parent-list.cjs.js +0 -8
- package/dist/libs/get/get-query-params.cjs.js +0 -20
- package/dist/libs/get/get-random-int.cjs.js +0 -11
- package/dist/libs/get/get-relative-time.cjs.js +0 -28
- package/dist/libs/get/get-rem.cjs.js +0 -9
- package/dist/libs/get/get-rendered-line-height.cjs.js +0 -57
- package/dist/libs/get/get-scrollbar-width.cjs.js +0 -4
- package/dist/libs/get/get-session-storage.cjs.js +0 -9
- package/dist/libs/get/get-string-length.cjs.js +0 -5
- package/dist/libs/get/get-style-property-value-to-number.cjs.js +0 -5
- package/dist/libs/get/get-style-property-value.cjs.js +0 -4
- package/dist/libs/get/get-ua-data.cjs.js +0 -23
- package/dist/libs/get/index.cjs.js +0 -40
- package/dist/libs/is/check-device-size.cjs.js +0 -11
- package/dist/libs/is/index.cjs.js +0 -24
- package/dist/libs/is/is-after-date-time.cjs.js +0 -10
- package/dist/libs/is/is-between-date-time.cjs.js +0 -14
- package/dist/libs/is/is-exist-all-elements.cjs.js +0 -6
- package/dist/libs/is/is-in-viewport.cjs.js +0 -66
- package/dist/libs/is/is-ipad.cjs.js +0 -13
- package/dist/libs/is/is-key-exists.cjs.js +0 -6
- package/dist/libs/is/is-online.cjs.js +0 -9
- package/dist/libs/is/is-safari.cjs.js +0 -11
- package/dist/libs/is/is-scrollable.cjs.js +0 -8
- package/dist/libs/is/is-touch-support.cjs.js +0 -11
- package/dist/libs/remove/index.cjs.js +0 -10
- package/dist/libs/remove/remove-all-html-tags.cjs.js +0 -12
- package/dist/libs/remove/remove-attribute.cjs.js +0 -6
- package/dist/libs/remove/remove-session-storage.cjs.js +0 -7
- package/dist/libs/remove/remove-style-property-value.cjs.js +0 -6
- package/dist/libs/security/html-sanitize.cjs.js +0 -9
- package/dist/libs/security/index.cjs.js +0 -5
- package/dist/libs/set/index.cjs.js +0 -14
- package/dist/libs/set/set-100vh.cjs.js +0 -7
- package/dist/libs/set/set-100vw.cjs.js +0 -7
- package/dist/libs/set/set-attribute.cjs.js +0 -6
- package/dist/libs/set/set-scroll-position-to-center.cjs.js +0 -10
- package/dist/libs/set/set-session-storage.cjs.js +0 -7
- package/dist/libs/set/set-style-property-value.cjs.js +0 -6
- package/dist/libs/to/index.cjs.js +0 -6
- package/dist/libs/to/to-boolean.cjs.js +0 -6
- package/dist/libs/to/to-positive-number.cjs.js +0 -4
- package/dist/libs/transform/index.cjs.js +0 -4
- package/dist/libs/transform/wrap-text-with-spans.cjs.js +0 -22
- package/dist/libs/wait/index.cjs.js +0 -6
- package/dist/libs/wait/sleep.cjs.js +0 -6
- package/dist/libs/wait/wait-for-all-media-loaded.cjs.js +0 -44
- package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isBetween.cjs.js +0 -23
- package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/isBetween.es.js +0 -23
- package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/timezone.cjs.js +0 -71
- package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/timezone.es.js +0 -71
- package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/utc.cjs.js +0 -83
- package/dist/node_modules/.pnpm/dayjs@1.11.19/node_modules/dayjs/plugin/utc.es.js +0 -83
|
@@ -0,0 +1,24 @@
|
|
|
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_set_100vh = require("./set-100vh.cjs");
|
|
14
|
+
const require_set_100vw = require("./set-100vw.cjs");
|
|
15
|
+
const require_set_attribute = require("./set-attribute.cjs");
|
|
16
|
+
const require_set_scroll_position_to_center = require("./set-scroll-position-to-center.cjs");
|
|
17
|
+
const require_set_session_storage = require("./set-session-storage.cjs");
|
|
18
|
+
const require_set_style_property_value = require("./set-style-property-value.cjs");
|
|
19
|
+
exports.set100vh = require_set_100vh.set100vh;
|
|
20
|
+
exports.set100vw = require_set_100vw.set100vw;
|
|
21
|
+
exports.setAttribute = require_set_attribute.setAttribute;
|
|
22
|
+
exports.setScrollPositionToCenter = require_set_scroll_position_to_center.setScrollPositionToCenter;
|
|
23
|
+
exports.setSessionStorage = require_set_session_storage.setSessionStorage;
|
|
24
|
+
exports.setStylePropertyValue = require_set_style_property_value.setStylePropertyValue;
|
|
@@ -1,14 +1,18 @@
|
|
|
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 { set100vh } from "./set-100vh.es.js";
|
|
2
13
|
import { set100vw } from "./set-100vw.es.js";
|
|
3
14
|
import { setAttribute } from "./set-attribute.es.js";
|
|
4
15
|
import { setScrollPositionToCenter } from "./set-scroll-position-to-center.es.js";
|
|
5
16
|
import { setSessionStorage } from "./set-session-storage.es.js";
|
|
6
17
|
import { setStylePropertyValue } from "./set-style-property-value.es.js";
|
|
7
|
-
export {
|
|
8
|
-
set100vh,
|
|
9
|
-
set100vw,
|
|
10
|
-
setAttribute,
|
|
11
|
-
setScrollPositionToCenter,
|
|
12
|
-
setSessionStorage,
|
|
13
|
-
setStylePropertyValue
|
|
14
|
-
};
|
|
18
|
+
export { set100vh, set100vw, setAttribute, setScrollPositionToCenter, setSessionStorage, setStylePropertyValue };
|
|
@@ -7,5 +7,6 @@
|
|
|
7
7
|
* @param {string} [setProperty='--vh'] - The name of the CSS variable to set.
|
|
8
8
|
*
|
|
9
9
|
* @link https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
10
|
+
* Does nothing in SSR environments where window is undefined.
|
|
10
11
|
*/
|
|
11
12
|
export declare const set100vh: (setProperty?: string) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
set100vh
|
|
1
|
+
// src/libs/set/set-100vh.ts
|
|
2
|
+
var set100vh = (setProperty = "--vh") => {
|
|
3
|
+
if (typeof window === "undefined") return;
|
|
4
|
+
const vh = window.innerHeight * .01;
|
|
5
|
+
document.documentElement.style.setProperty(setProperty, `${vh}px`);
|
|
7
6
|
};
|
|
7
|
+
export { set100vh };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// src/libs/set/set-100vw.ts
|
|
2
|
+
var set100vw = (setProperty = "--vw") => {
|
|
3
|
+
if (typeof window === "undefined") return;
|
|
4
|
+
const vw = document.documentElement.clientWidth;
|
|
5
|
+
document.documentElement.style.setProperty(setProperty, `${vw}px`);
|
|
6
|
+
};
|
|
7
|
+
exports.set100vw = set100vw;
|
|
@@ -2,5 +2,6 @@
|
|
|
2
2
|
* Sets a CSS variable to the value of 100vw (excluding the scrollbar width).
|
|
3
3
|
*
|
|
4
4
|
* @param setProperty - The name of the CSS variable to set. Defaults to '--vw'.
|
|
5
|
+
* Does nothing in SSR environments where window is undefined.
|
|
5
6
|
*/
|
|
6
7
|
export declare const set100vw: (setProperty?: string) => void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
set100vw
|
|
1
|
+
// src/libs/set/set-100vw.ts
|
|
2
|
+
var set100vw = (setProperty = "--vw") => {
|
|
3
|
+
if (typeof window === "undefined") return;
|
|
4
|
+
const vw = document.documentElement.clientWidth;
|
|
5
|
+
document.documentElement.style.setProperty(setProperty, `${vw}px`);
|
|
7
6
|
};
|
|
7
|
+
export { set100vw };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
setAttribute
|
|
1
|
+
// src/libs/set/set-attribute.ts
|
|
2
|
+
var setAttribute = (element, attribute, value) => {
|
|
3
|
+
element.setAttribute(attribute, value);
|
|
6
4
|
};
|
|
5
|
+
export { setAttribute };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// src/libs/set/set-scroll-position-to-center.ts
|
|
2
|
+
var setScrollPositionToCenter = (rootElement, targetElement, behavior = "smooth") => {
|
|
3
|
+
const rootHalfW = rootElement.getBoundingClientRect().width / 2;
|
|
4
|
+
const targetHalfW = targetElement.getBoundingClientRect().width / 2;
|
|
5
|
+
const posLeft = targetElement.offsetLeft + targetHalfW - rootHalfW;
|
|
6
|
+
rootElement.scrollTo({
|
|
7
|
+
left: posLeft,
|
|
8
|
+
behavior
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
exports.setScrollPositionToCenter = setScrollPositionToCenter;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
// src/libs/set/set-scroll-position-to-center.ts
|
|
2
|
+
var setScrollPositionToCenter = (rootElement, targetElement, behavior = "smooth") => {
|
|
3
|
+
const rootHalfW = rootElement.getBoundingClientRect().width / 2;
|
|
4
|
+
const targetHalfW = targetElement.getBoundingClientRect().width / 2;
|
|
5
|
+
const posLeft = targetElement.offsetLeft + targetHalfW - rootHalfW;
|
|
6
|
+
rootElement.scrollTo({
|
|
7
|
+
left: posLeft,
|
|
8
|
+
behavior
|
|
9
|
+
});
|
|
10
10
|
};
|
|
11
|
+
export { setScrollPositionToCenter };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let store2 = require("store2");
|
|
3
|
+
store2 = require_runtime.__toESM(store2, 1);
|
|
4
|
+
// src/libs/set/set-session-storage.ts
|
|
5
|
+
var setSessionStorage = (key, value) => {
|
|
6
|
+
store2.default.session.set(key, value);
|
|
7
|
+
};
|
|
8
|
+
exports.setSessionStorage = setSessionStorage;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import store from "store2";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
setSessionStorage
|
|
2
|
+
// src/libs/set/set-session-storage.ts
|
|
3
|
+
var setSessionStorage = (key, value) => {
|
|
4
|
+
store.session.set(key, value);
|
|
7
5
|
};
|
|
6
|
+
export { setSessionStorage };
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param key - The name of the CSS custom property to set.
|
|
5
5
|
* @param value - The value to set for the CSS custom property.
|
|
6
|
+
* Does nothing in SSR environments where window is undefined.
|
|
6
7
|
*/
|
|
7
8
|
export declare const setStylePropertyValue: (key: string, value: string) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
setStylePropertyValue
|
|
1
|
+
// src/libs/set/set-style-property-value.ts
|
|
2
|
+
var setStylePropertyValue = (key, value) => {
|
|
3
|
+
if (typeof window === "undefined") return;
|
|
4
|
+
document.documentElement.style.setProperty(key, value);
|
|
6
5
|
};
|
|
6
|
+
export { setStylePropertyValue };
|
|
@@ -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_to_boolean = require("./to-boolean.cjs");
|
|
14
|
+
const require_to_positive_number = require("./to-positive-number.cjs");
|
|
15
|
+
exports.toBoolean = require_to_boolean.toBoolean;
|
|
16
|
+
exports.toPositiveNumber = require_to_positive_number.toPositiveNumber;
|
package/dist/libs/to/index.es.js
CHANGED
|
@@ -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 { toBoolean } from "./to-boolean.es.js";
|
|
2
13
|
import { toPositiveNumber } from "./to-positive-number.es.js";
|
|
3
|
-
export {
|
|
4
|
-
toBoolean,
|
|
5
|
-
toPositiveNumber
|
|
6
|
-
};
|
|
14
|
+
export { toBoolean, toPositiveNumber };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
toBoolean
|
|
1
|
+
// src/libs/to/to-boolean.ts
|
|
2
|
+
var toBoolean = (booleanStr) => {
|
|
3
|
+
return booleanStr ? booleanStr.toLowerCase() === "true" : false;
|
|
6
4
|
};
|
|
5
|
+
export { toBoolean };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
1
|
+
// src/libs/to/to-positive-number.ts
|
|
2
|
+
var toPositiveNumber = (n) => Math.abs(n);
|
|
3
|
+
export { toPositiveNumber };
|
|
@@ -0,0 +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
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
13
|
+
const require_wrap_text_with_spans = require("./wrap-text-with-spans.cjs");
|
|
14
|
+
exports.wrapTextWithSpans = require_wrap_text_with_spans.wrapTextWithSpans;
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
export { wrapTextWithSpans } from "./wrap-text-with-spans.es.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
let runes2 = require("runes2");
|
|
2
|
+
// src/libs/transform/wrap-text-with-spans.ts
|
|
3
|
+
var wrapTextWithSpans = (element) => {
|
|
4
|
+
if (!element) return;
|
|
5
|
+
if (element.nodeType === Node.TEXT_NODE) {
|
|
6
|
+
const textContent = (element.textContent || "").trim();
|
|
7
|
+
const fragment = document.createDocumentFragment();
|
|
8
|
+
const graphemes = (0, runes2.runes)(textContent);
|
|
9
|
+
for (const grapheme of graphemes) {
|
|
10
|
+
const span = document.createElement("span");
|
|
11
|
+
span.textContent = grapheme;
|
|
12
|
+
fragment.appendChild(span);
|
|
13
|
+
}
|
|
14
|
+
element.replaceWith(fragment);
|
|
15
|
+
} else if (element.nodeType === Node.ELEMENT_NODE) for (const child of Array.from(element.childNodes)) wrapTextWithSpans(child);
|
|
16
|
+
};
|
|
17
|
+
exports.wrapTextWithSpans = wrapTextWithSpans;
|
|
@@ -1,22 +1,17 @@
|
|
|
1
1
|
import { runes } from "runes2";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
wrapTextWithSpans(child);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
wrapTextWithSpans
|
|
2
|
+
// src/libs/transform/wrap-text-with-spans.ts
|
|
3
|
+
var wrapTextWithSpans = (element) => {
|
|
4
|
+
if (!element) return;
|
|
5
|
+
if (element.nodeType === Node.TEXT_NODE) {
|
|
6
|
+
const textContent = (element.textContent || "").trim();
|
|
7
|
+
const fragment = document.createDocumentFragment();
|
|
8
|
+
const graphemes = runes(textContent);
|
|
9
|
+
for (const grapheme of graphemes) {
|
|
10
|
+
const span = document.createElement("span");
|
|
11
|
+
span.textContent = grapheme;
|
|
12
|
+
fragment.appendChild(span);
|
|
13
|
+
}
|
|
14
|
+
element.replaceWith(fragment);
|
|
15
|
+
} else if (element.nodeType === Node.ELEMENT_NODE) for (const child of Array.from(element.childNodes)) wrapTextWithSpans(child);
|
|
22
16
|
};
|
|
17
|
+
export { wrapTextWithSpans };
|
|
@@ -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_sleep = require("./sleep.cjs");
|
|
14
|
+
const require_wait_for_all_media_loaded = require("./wait-for-all-media-loaded.cjs");
|
|
15
|
+
exports.sleep = require_sleep.sleep;
|
|
16
|
+
exports.waitForAllMediaLoaded = require_wait_for_all_media_loaded.waitForAllMediaLoaded;
|
|
@@ -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 { sleep } from "./sleep.es.js";
|
|
2
13
|
import { waitForAllMediaLoaded } from "./wait-for-all-media-loaded.es.js";
|
|
3
|
-
export {
|
|
4
|
-
sleep,
|
|
5
|
-
waitForAllMediaLoaded
|
|
6
|
-
};
|
|
14
|
+
export { sleep, waitForAllMediaLoaded };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
sleep
|
|
1
|
+
// src/libs/wait/sleep.ts
|
|
2
|
+
var sleep = (time) => {
|
|
3
|
+
return new Promise((resolve) => setTimeout(resolve, time * 1e3));
|
|
6
4
|
};
|
|
5
|
+
export { sleep };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/libs/wait/wait-for-all-media-loaded.ts
|
|
2
|
+
var waitForAllMediaLoaded = async (firstViewOnly = false) => {
|
|
3
|
+
if (typeof window === "undefined") return true;
|
|
4
|
+
const images = Array.from(document.getElementsByTagName("img")).filter((img) => img.getAttribute("loading") !== "lazy");
|
|
5
|
+
const videos = Array.from(document.getElementsByTagName("video"));
|
|
6
|
+
let mediaElements = [...images, ...videos];
|
|
7
|
+
if (firstViewOnly) {
|
|
8
|
+
const firstViewHeight = window.innerHeight;
|
|
9
|
+
mediaElements = mediaElements.filter((media) => {
|
|
10
|
+
const rect = media.getBoundingClientRect();
|
|
11
|
+
return rect.top < firstViewHeight && rect.bottom > 0;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
if (mediaElements.length === 0) return true;
|
|
15
|
+
await Promise.all(mediaElements.map((media) => {
|
|
16
|
+
if (media instanceof HTMLImageElement && media.complete) return Promise.resolve();
|
|
17
|
+
if (media instanceof HTMLVideoElement && media.readyState >= 3) return Promise.resolve();
|
|
18
|
+
return new Promise((resolve) => {
|
|
19
|
+
const eventHandler = () => resolve();
|
|
20
|
+
if (media instanceof HTMLImageElement) {
|
|
21
|
+
media.addEventListener("load", eventHandler, { once: true });
|
|
22
|
+
media.addEventListener("error", eventHandler, { once: true });
|
|
23
|
+
} else if (media instanceof HTMLVideoElement) {
|
|
24
|
+
media.addEventListener("loadeddata", eventHandler, { once: true });
|
|
25
|
+
media.addEventListener("error", eventHandler, { once: true });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}));
|
|
29
|
+
return true;
|
|
30
|
+
};
|
|
31
|
+
exports.waitForAllMediaLoaded = waitForAllMediaLoaded;
|
|
@@ -3,5 +3,6 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param firstViewOnly - If true, only considers media elements within the first view (viewport height).
|
|
5
5
|
* @returns A promise that resolves to true when all media elements are loaded.
|
|
6
|
+
* Resolves to true immediately in SSR environments where window is undefined.
|
|
6
7
|
*/
|
|
7
8
|
export declare const waitForAllMediaLoaded: (firstViewOnly?: boolean) => Promise<boolean>;
|
|
@@ -1,44 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (media instanceof HTMLImageElement) {
|
|
31
|
-
media.addEventListener("load", eventHandler, { once: true });
|
|
32
|
-
media.addEventListener("error", eventHandler, { once: true });
|
|
33
|
-
} else if (media instanceof HTMLVideoElement) {
|
|
34
|
-
media.addEventListener("loadeddata", eventHandler, { once: true });
|
|
35
|
-
media.addEventListener("error", eventHandler, { once: true });
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
})
|
|
39
|
-
);
|
|
40
|
-
return true;
|
|
41
|
-
};
|
|
42
|
-
export {
|
|
43
|
-
waitForAllMediaLoaded
|
|
1
|
+
// src/libs/wait/wait-for-all-media-loaded.ts
|
|
2
|
+
var waitForAllMediaLoaded = async (firstViewOnly = false) => {
|
|
3
|
+
if (typeof window === "undefined") return true;
|
|
4
|
+
const images = Array.from(document.getElementsByTagName("img")).filter((img) => img.getAttribute("loading") !== "lazy");
|
|
5
|
+
const videos = Array.from(document.getElementsByTagName("video"));
|
|
6
|
+
let mediaElements = [...images, ...videos];
|
|
7
|
+
if (firstViewOnly) {
|
|
8
|
+
const firstViewHeight = window.innerHeight;
|
|
9
|
+
mediaElements = mediaElements.filter((media) => {
|
|
10
|
+
const rect = media.getBoundingClientRect();
|
|
11
|
+
return rect.top < firstViewHeight && rect.bottom > 0;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
if (mediaElements.length === 0) return true;
|
|
15
|
+
await Promise.all(mediaElements.map((media) => {
|
|
16
|
+
if (media instanceof HTMLImageElement && media.complete) return Promise.resolve();
|
|
17
|
+
if (media instanceof HTMLVideoElement && media.readyState >= 3) return Promise.resolve();
|
|
18
|
+
return new Promise((resolve) => {
|
|
19
|
+
const eventHandler = () => resolve();
|
|
20
|
+
if (media instanceof HTMLImageElement) {
|
|
21
|
+
media.addEventListener("load", eventHandler, { once: true });
|
|
22
|
+
media.addEventListener("error", eventHandler, { once: true });
|
|
23
|
+
} else if (media instanceof HTMLVideoElement) {
|
|
24
|
+
media.addEventListener("loadeddata", eventHandler, { once: true });
|
|
25
|
+
media.addEventListener("error", eventHandler, { once: true });
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}));
|
|
29
|
+
return true;
|
|
44
30
|
};
|
|
31
|
+
export { waitForAllMediaLoaded };
|