umaki 0.2.5 → 0.3.0
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 +230 -79
- package/dist/_virtual/_commonjsHelpers.cjs.js +1 -1
- package/dist/_virtual/_commonjsHelpers.es.js +1 -1
- package/dist/_virtual/isBetween.cjs.js +1 -1
- package/dist/_virtual/isBetween.es.js +1 -1
- package/dist/index.cjs.js +5 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +5 -1
- package/dist/libs/control/bgScrollStop.cjs.js +1 -1
- package/dist/libs/control/bgScrollStop.es.js +1 -1
- package/dist/libs/control/pd.cjs.js +1 -1
- package/dist/libs/control/pd.es.js +1 -1
- package/dist/libs/control/scrollToHash.cjs.js +1 -1
- package/dist/libs/control/scrollToHash.es.js +1 -1
- package/dist/libs/control/videoPlayControl.cjs.js +1 -1
- package/dist/libs/control/videoPlayControl.es.js +1 -1
- package/dist/libs/convert/changeDateStringToSpecificFormat.cjs.js +1 -1
- package/dist/libs/convert/changeDateStringToSpecificFormat.es.js +1 -1
- package/dist/libs/convert/jsonStringToJsonObject.cjs.js +1 -1
- package/dist/libs/convert/jsonStringToJsonObject.es.js +1 -1
- package/dist/libs/eventControl/debounce.cjs.js +24 -0
- package/dist/libs/eventControl/debounce.d.ts +11 -0
- package/dist/libs/eventControl/debounce.es.js +24 -0
- package/dist/libs/eventControl/debounce.test.d.ts +1 -0
- package/dist/libs/eventControl/index.d.ts +5 -0
- package/dist/libs/eventControl/throttle.cjs.js +24 -0
- package/dist/libs/eventControl/throttle.d.ts +12 -0
- package/dist/libs/eventControl/throttle.es.js +24 -0
- package/dist/libs/eventControl/throttle.test.d.ts +1 -0
- package/dist/libs/get/getAspectRatio.cjs.js +1 -1
- package/dist/libs/get/getAspectRatio.es.js +1 -1
- package/dist/libs/get/getClassNames.cjs.js +1 -1
- package/dist/libs/get/getClassNames.es.js +1 -1
- package/dist/libs/get/getDocumentHeight.cjs.js +1 -1
- package/dist/libs/get/getDocumentHeight.es.js +1 -1
- package/dist/libs/get/getEventPaths.cjs.js +1 -1
- package/dist/libs/get/getEventPaths.es.js +1 -1
- package/dist/libs/get/getGcd.cjs.js +1 -1
- package/dist/libs/get/getGcd.es.js +1 -1
- package/dist/libs/get/getOrientation.cjs.js +1 -1
- package/dist/libs/get/getOrientation.es.js +1 -1
- package/dist/libs/get/getParentList.cjs.js +1 -1
- package/dist/libs/get/getParentList.es.js +1 -1
- package/dist/libs/get/getQueryParams.cjs.js +1 -1
- package/dist/libs/get/getQueryParams.es.js +1 -1
- package/dist/libs/get/getRem.cjs.js +1 -1
- package/dist/libs/get/getRem.es.js +1 -1
- package/dist/libs/get/getScrollbarWidth.cjs.js +1 -1
- package/dist/libs/get/getScrollbarWidth.es.js +1 -1
- package/dist/libs/get/getSessionStorage.cjs.js +1 -1
- package/dist/libs/get/getSessionStorage.es.js +1 -1
- package/dist/libs/get/getStringLength.cjs.js +1 -1
- package/dist/libs/get/getStringLength.es.js +1 -1
- package/dist/libs/get/getStylePropertyValue.cjs.js +1 -1
- package/dist/libs/get/getStylePropertyValue.es.js +1 -1
- package/dist/libs/get/getStylePropertyValueToNumber.cjs.js +1 -1
- package/dist/libs/get/getStylePropertyValueToNumber.es.js +1 -1
- package/dist/libs/get/getUaData.cjs.js +1 -1
- package/dist/libs/get/getUaData.es.js +1 -1
- package/dist/libs/is/isBetweenDateTime.cjs.js +1 -1
- package/dist/libs/is/isBetweenDateTime.es.js +1 -1
- package/dist/libs/is/isExistAllElements.cjs.js +1 -1
- package/dist/libs/is/isExistAllElements.es.js +1 -1
- package/dist/libs/is/isIpad.cjs.js +1 -1
- package/dist/libs/is/isIpad.es.js +1 -1
- package/dist/libs/is/isKeyExists.cjs.js +1 -1
- package/dist/libs/is/isKeyExists.es.js +1 -1
- package/dist/libs/is/isSafari.cjs.js +1 -1
- package/dist/libs/is/isSafari.es.js +1 -1
- package/dist/libs/is/isScrollable.cjs.js +1 -1
- package/dist/libs/is/isScrollable.es.js +1 -1
- package/dist/libs/is/isTouchSupport.cjs.js +1 -1
- package/dist/libs/is/isTouchSupport.es.js +1 -1
- package/dist/libs/remove/removeAllHtmlTags.cjs.js +1 -1
- package/dist/libs/remove/removeAllHtmlTags.es.js +1 -1
- package/dist/libs/remove/removeAttribute.cjs.js +1 -1
- package/dist/libs/remove/removeAttribute.es.js +1 -1
- package/dist/libs/remove/removeSessionStorage.cjs.js +1 -1
- package/dist/libs/remove/removeSessionStorage.es.js +1 -1
- package/dist/libs/remove/removeStylePropertyValue.cjs.js +1 -1
- package/dist/libs/remove/removeStylePropertyValue.es.js +1 -1
- package/dist/libs/set/set100vh.cjs.js +1 -1
- package/dist/libs/set/set100vh.es.js +1 -1
- package/dist/libs/set/set100vw.cjs.js +1 -1
- package/dist/libs/set/set100vw.es.js +1 -1
- package/dist/libs/set/setAttribute.cjs.js +1 -1
- package/dist/libs/set/setAttribute.es.js +1 -1
- package/dist/libs/set/setScrollPositionToCenter.cjs.js +1 -1
- package/dist/libs/set/setScrollPositionToCenter.es.js +1 -1
- package/dist/libs/set/setSessionStorage.cjs.js +1 -1
- package/dist/libs/set/setSessionStorage.es.js +1 -1
- package/dist/libs/set/setStylePropertyValue.cjs.js +1 -1
- package/dist/libs/set/setStylePropertyValue.es.js +1 -1
- package/dist/libs/to/toBoolean.cjs.js +1 -1
- package/dist/libs/to/toBoolean.es.js +1 -1
- package/dist/libs/to/toPositiveNumber.cjs.js +1 -1
- package/dist/libs/to/toPositiveNumber.es.js +1 -1
- package/dist/libs/transform/wrapTextWithSpans.cjs.js +1 -1
- package/dist/libs/transform/wrapTextWithSpans.es.js +1 -1
- package/dist/libs/wait/sleep.cjs.js +1 -1
- package/dist/libs/wait/sleep.es.js +1 -1
- package/dist/libs/wait/waitForAllMediaLoaded.cjs.js +1 -1
- package/dist/libs/wait/waitForAllMediaLoaded.es.js +1 -1
- package/dist/node_modules/dayjs/plugin/isBetween.cjs.js +1 -1
- package/dist/node_modules/dayjs/plugin/isBetween.es.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
3
|
* name: umaki
|
|
4
|
-
* version: v0.
|
|
4
|
+
* version: v0.3.0
|
|
5
5
|
* description: A utility that is often used in web production.
|
|
6
6
|
* author: TsubasaHiga
|
|
7
7
|
* homepage: https://github.com/TsubasaHiga/umaki
|
|
@@ -17,6 +17,8 @@ const scrollToHash = require("./libs/control/scrollToHash.cjs.js");
|
|
|
17
17
|
const videoPlayControl = require("./libs/control/videoPlayControl.cjs.js");
|
|
18
18
|
const changeDateStringToSpecificFormat = require("./libs/convert/changeDateStringToSpecificFormat.cjs.js");
|
|
19
19
|
const jsonStringToJsonObject = require("./libs/convert/jsonStringToJsonObject.cjs.js");
|
|
20
|
+
const debounce = require("./libs/eventControl/debounce.cjs.js");
|
|
21
|
+
const throttle = require("./libs/eventControl/throttle.cjs.js");
|
|
20
22
|
const getAspectRatio = require("./libs/get/getAspectRatio.cjs.js");
|
|
21
23
|
const getClassNames = require("./libs/get/getClassNames.cjs.js");
|
|
22
24
|
const getDocumentHeight = require("./libs/get/getDocumentHeight.cjs.js");
|
|
@@ -60,6 +62,8 @@ exports.scrollToHash = scrollToHash.scrollToHash;
|
|
|
60
62
|
exports.videoPlayControl = videoPlayControl.videoPlayControl;
|
|
61
63
|
exports.changeDateStringToSpecificFormat = changeDateStringToSpecificFormat.changeDateStringToSpecificFormat;
|
|
62
64
|
exports.jsonStringToJsonObject = jsonStringToJsonObject.jsonStringToJsonObject;
|
|
65
|
+
exports.debounce = debounce.debounce;
|
|
66
|
+
exports.throttle = throttle.throttle;
|
|
63
67
|
exports.getAspectRatio = getAspectRatio.getAspectRatio;
|
|
64
68
|
exports.getClassNames = getClassNames.getClassNames;
|
|
65
69
|
exports.getDocumentHeight = getDocumentHeight.getDocumentHeight;
|
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: umaki
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.3.0
|
|
4
4
|
* description: A utility that is often used in web production.
|
|
5
5
|
* author: TsubasaHiga
|
|
6
6
|
* homepage: https://github.com/TsubasaHiga/umaki
|
|
@@ -15,6 +15,8 @@ import { scrollToHash } from "./libs/control/scrollToHash.es.js";
|
|
|
15
15
|
import { videoPlayControl } from "./libs/control/videoPlayControl.es.js";
|
|
16
16
|
import { changeDateStringToSpecificFormat } from "./libs/convert/changeDateStringToSpecificFormat.es.js";
|
|
17
17
|
import { jsonStringToJsonObject } from "./libs/convert/jsonStringToJsonObject.es.js";
|
|
18
|
+
import { debounce } from "./libs/eventControl/debounce.es.js";
|
|
19
|
+
import { throttle } from "./libs/eventControl/throttle.es.js";
|
|
18
20
|
import { getAspectRatio } from "./libs/get/getAspectRatio.es.js";
|
|
19
21
|
import { getClassNames } from "./libs/get/getClassNames.es.js";
|
|
20
22
|
import { getDocumentHeight } from "./libs/get/getDocumentHeight.es.js";
|
|
@@ -55,6 +57,7 @@ import { waitForAllMediaLoaded } from "./libs/wait/waitForAllMediaLoaded.es.js";
|
|
|
55
57
|
export {
|
|
56
58
|
bgScrollStop,
|
|
57
59
|
changeDateStringToSpecificFormat,
|
|
60
|
+
debounce,
|
|
58
61
|
getAspectRatio,
|
|
59
62
|
getClassNames,
|
|
60
63
|
getDocumentHeight,
|
|
@@ -91,6 +94,7 @@ export {
|
|
|
91
94
|
setSessionStorage,
|
|
92
95
|
setStylePropertyValue,
|
|
93
96
|
sleep,
|
|
97
|
+
throttle,
|
|
94
98
|
toBoolean,
|
|
95
99
|
toPositiveNumber,
|
|
96
100
|
videoPlayControl,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* name: umaki
|
|
4
|
+
* version: v0.3.0
|
|
5
|
+
* description: A utility that is often used in web production.
|
|
6
|
+
* author: TsubasaHiga
|
|
7
|
+
* homepage: https://github.com/TsubasaHiga/umaki
|
|
8
|
+
* Released under the MIT License
|
|
9
|
+
*
|
|
10
|
+
* This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
|
|
11
|
+
* For license information, please see LICENSE.txt
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
const debounce = (fn, delay) => {
|
|
15
|
+
let timeoutId = null;
|
|
16
|
+
return (...args) => {
|
|
17
|
+
timeoutId && clearTimeout(timeoutId);
|
|
18
|
+
timeoutId = setTimeout(() => {
|
|
19
|
+
fn(...args);
|
|
20
|
+
timeoutId = null;
|
|
21
|
+
}, delay);
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.debounce = debounce;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type DebounceProcedure = (...args: unknown[]) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Creates a debounced function that delays invoking the provided function until after the specified delay.
|
|
4
|
+
*
|
|
5
|
+
* @template F - The type of the function to debounce.
|
|
6
|
+
* @param {F} fn - The function to debounce.
|
|
7
|
+
* @param {number} delay - The number of milliseconds to delay.
|
|
8
|
+
* @returns {(...args: Parameters<F>) => void} - A debounced version of the provided function.
|
|
9
|
+
*/
|
|
10
|
+
export declare const debounce: <F extends DebounceProcedure>(fn: F, delay: number) => ((...args: Parameters<F>) => void);
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: umaki
|
|
3
|
+
* version: v0.3.0
|
|
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
|
+
const debounce = (fn, delay) => {
|
|
13
|
+
let timeoutId = null;
|
|
14
|
+
return (...args) => {
|
|
15
|
+
timeoutId && clearTimeout(timeoutId);
|
|
16
|
+
timeoutId = setTimeout(() => {
|
|
17
|
+
fn(...args);
|
|
18
|
+
timeoutId = null;
|
|
19
|
+
}, delay);
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
debounce
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* name: umaki
|
|
4
|
+
* version: v0.3.0
|
|
5
|
+
* description: A utility that is often used in web production.
|
|
6
|
+
* author: TsubasaHiga
|
|
7
|
+
* homepage: https://github.com/TsubasaHiga/umaki
|
|
8
|
+
* Released under the MIT License
|
|
9
|
+
*
|
|
10
|
+
* This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
|
|
11
|
+
* For license information, please see LICENSE.txt
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
14
|
+
const throttle = (fn, wait) => {
|
|
15
|
+
let lastCallTime = 0;
|
|
16
|
+
return (...args) => {
|
|
17
|
+
const currentTime = Date.now();
|
|
18
|
+
if (currentTime - lastCallTime >= wait) {
|
|
19
|
+
fn(...args);
|
|
20
|
+
lastCallTime = currentTime;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.throttle = throttle;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type ThrottleFunction = (...args: unknown[]) => void;
|
|
2
|
+
/**
|
|
3
|
+
* Creates a throttled version of the provided function that will only execute
|
|
4
|
+
* at most once in the specified wait period.
|
|
5
|
+
*
|
|
6
|
+
* @template F - The type of the function to be throttled.
|
|
7
|
+
* @param fn - The function to throttle.
|
|
8
|
+
* @param wait - The number of milliseconds to wait before allowing the next execution.
|
|
9
|
+
* @returns A throttled version of the provided function.
|
|
10
|
+
*/
|
|
11
|
+
export declare const throttle: <F extends ThrottleFunction>(fn: F, wait: number) => ((...args: Parameters<F>) => void);
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* name: umaki
|
|
3
|
+
* version: v0.3.0
|
|
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
|
+
const throttle = (fn, wait) => {
|
|
13
|
+
let lastCallTime = 0;
|
|
14
|
+
return (...args) => {
|
|
15
|
+
const currentTime = Date.now();
|
|
16
|
+
if (currentTime - lastCallTime >= wait) {
|
|
17
|
+
fn(...args);
|
|
18
|
+
lastCallTime = currentTime;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
throttle
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|