umaki 0.1.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/LICENSE +21 -0
- package/README.md +592 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +2871 -0
- package/dist/index.umd.cjs +3 -0
- package/dist/libs/control/bgScrollStop.d.ts +15 -0
- package/dist/libs/control/index.d.ts +7 -0
- package/dist/libs/control/pd.d.ts +6 -0
- package/dist/libs/control/pd.test.d.ts +1 -0
- package/dist/libs/control/scrollToHash.d.ts +9 -0
- package/dist/libs/control/scrollToHash.test.d.ts +1 -0
- package/dist/libs/control/videoPlayControl.d.ts +14 -0
- package/dist/libs/control/videoPlayControl.test.d.ts +1 -0
- package/dist/libs/convert/changeDateStringToSpecificFormat.d.ts +8 -0
- package/dist/libs/convert/changeDateStringToSpecificFormat.test.d.ts +1 -0
- package/dist/libs/convert/index.d.ts +5 -0
- package/dist/libs/convert/jsonStringToJsonObject.d.ts +7 -0
- package/dist/libs/convert/jsonStringToJsonObject.test.d.ts +1 -0
- package/dist/libs/get/getAspectRatio.d.ts +11 -0
- package/dist/libs/get/getAspectRatio.test.d.ts +1 -0
- package/dist/libs/get/getClassNames.d.ts +7 -0
- package/dist/libs/get/getClassNames.test.d.ts +1 -0
- package/dist/libs/get/getDocumentHeight.d.ts +6 -0
- package/dist/libs/get/getDocumentHeight.test.d.ts +1 -0
- package/dist/libs/get/getEventPaths.d.ts +6 -0
- package/dist/libs/get/getGcd.d.ts +11 -0
- package/dist/libs/get/getGcd.test.d.ts +1 -0
- package/dist/libs/get/getImageSize.d.ts +7 -0
- package/dist/libs/get/getOrientation.d.ts +6 -0
- package/dist/libs/get/getOrientation.test.d.ts +1 -0
- package/dist/libs/get/getParentList.d.ts +7 -0
- package/dist/libs/get/getParentList.test.d.ts +1 -0
- package/dist/libs/get/getPath.d.ts +7 -0
- package/dist/libs/get/getPath.test.d.ts +1 -0
- package/dist/libs/get/getPathFromLocalPublic.d.ts +7 -0
- package/dist/libs/get/getPathFromLocalPublic.test.d.ts +1 -0
- package/dist/libs/get/getQueryParams.d.ts +10 -0
- package/dist/libs/get/getQueryParams.test.d.ts +1 -0
- package/dist/libs/get/getRem.d.ts +7 -0
- package/dist/libs/get/getRem.test.d.ts +1 -0
- package/dist/libs/get/getScrollbarWidth.d.ts +6 -0
- package/dist/libs/get/getScrollbarWidth.test.d.ts +1 -0
- package/dist/libs/get/getSessionStorage.d.ts +7 -0
- package/dist/libs/get/getSessionStorage.test.d.ts +1 -0
- package/dist/libs/get/getStringLength.d.ts +10 -0
- package/dist/libs/get/getStringLength.test.d.ts +1 -0
- package/dist/libs/get/getStylePropertyValue.d.ts +7 -0
- package/dist/libs/get/getStylePropertyValue.test.d.ts +1 -0
- package/dist/libs/get/getStylePropertyValueToNumber.d.ts +7 -0
- package/dist/libs/get/getStylePropertyValueToNumber.test.d.ts +1 -0
- package/dist/libs/get/getUaData.d.ts +24 -0
- package/dist/libs/get/getUaData.test.d.ts +1 -0
- package/dist/libs/get/index.d.ts +18 -0
- package/dist/libs/is/index.d.ts +10 -0
- package/dist/libs/is/isBetweenDateTime.d.ts +11 -0
- package/dist/libs/is/isBetweenDateTime.test.d.ts +1 -0
- package/dist/libs/is/isExistAllElements.d.ts +7 -0
- package/dist/libs/is/isExistAllElements.test.d.ts +1 -0
- package/dist/libs/is/isIpad.d.ts +7 -0
- package/dist/libs/is/isIpad.test.d.ts +1 -0
- package/dist/libs/is/isKeyExists.d.ts +10 -0
- package/dist/libs/is/isKeyExists.test.d.ts +1 -0
- package/dist/libs/is/isProduction.d.ts +1 -0
- package/dist/libs/is/isProduction.test.d.ts +1 -0
- package/dist/libs/is/isSafari.d.ts +7 -0
- package/dist/libs/is/isSafari.test.d.ts +1 -0
- package/dist/libs/is/isScrollable.d.ts +7 -0
- package/dist/libs/is/isScrollable.test.d.ts +1 -0
- package/dist/libs/is/isTouchSupport.d.ts +6 -0
- package/dist/libs/remove/index.d.ts +7 -0
- package/dist/libs/remove/removeAllHtmlTags.d.ts +7 -0
- package/dist/libs/remove/removeAllHtmlTags.test.d.ts +1 -0
- package/dist/libs/remove/removeAttribute.d.ts +7 -0
- package/dist/libs/remove/removeAttribute.test.d.ts +1 -0
- package/dist/libs/remove/removeSessionStorage.d.ts +6 -0
- package/dist/libs/remove/removeSessionStorage.test.d.ts +1 -0
- package/dist/libs/remove/removeStylePropertyValue.d.ts +6 -0
- package/dist/libs/remove/removeStylePropertyValue.test.d.ts +1 -0
- package/dist/libs/set/index.d.ts +9 -0
- package/dist/libs/set/set100vh.d.ts +11 -0
- package/dist/libs/set/set100vh.test.d.ts +1 -0
- package/dist/libs/set/set100vw.d.ts +6 -0
- package/dist/libs/set/set100vw.test.d.ts +1 -0
- package/dist/libs/set/setAttribute.d.ts +8 -0
- package/dist/libs/set/setAttribute.test.d.ts +1 -0
- package/dist/libs/set/setScrollPositionToCenter.d.ts +8 -0
- package/dist/libs/set/setScrollPositionToCenter.test.d.ts +1 -0
- package/dist/libs/set/setSessionStorage.d.ts +7 -0
- package/dist/libs/set/setSessionStorage.test.d.ts +1 -0
- package/dist/libs/set/setStylePropertyValue.d.ts +7 -0
- package/dist/libs/set/setStylePropertyValue.test.d.ts +1 -0
- package/dist/libs/to/index.d.ts +5 -0
- package/dist/libs/to/toBoolean.d.ts +7 -0
- package/dist/libs/to/toBoolean.test.d.ts +1 -0
- package/dist/libs/to/toPositiveNumber.d.ts +7 -0
- package/dist/libs/to/toPositiveNumber.test.d.ts +1 -0
- package/dist/libs/transform/index.d.ts +4 -0
- package/dist/libs/transform/wrapTextWithSpans.d.ts +10 -0
- package/dist/libs/transform/wrapTextWithSpans.test.d.ts +1 -0
- package/dist/libs/wait/index.d.ts +5 -0
- package/dist/libs/wait/sleep.d.ts +7 -0
- package/dist/libs/wait/sleep.test.d.ts +1 -0
- package/dist/libs/wait/waitForAllMediaLoaded.d.ts +7 -0
- package/dist/libs/wait/waitForAllMediaLoaded.test.d.ts +1 -0
- package/dist/vite.svg +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines if the device is an iPad.
|
|
3
|
+
*
|
|
4
|
+
* @param orientation - The desired screen orientation ('portrait' or 'landscape'). Defaults to 'portrait'.
|
|
5
|
+
* @returns `true` if the device is an iPad with the specified orientation, otherwise `false`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isIpad: (orientation?: string) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a specific key exists in an object.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the object.
|
|
5
|
+
* @template U - The type of the key.
|
|
6
|
+
* @param {T} obj - The object to check.
|
|
7
|
+
* @param {U} key - The key to check for.
|
|
8
|
+
* @returns {obj is T & Record<U, unknown>} - Returns true if the key exists in the object, otherwise false.
|
|
9
|
+
*/
|
|
10
|
+
export declare const isKeyExists: <T extends Record<string, unknown>, U extends string>(obj: T, key: U) => obj is T & Record<U, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isProduction: () => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines if the browser is Safari.
|
|
3
|
+
*
|
|
4
|
+
* @param includeMobileSafari - A boolean indicating whether to include Mobile Safari in the check. Defaults to true.
|
|
5
|
+
* @returns A boolean indicating if the browser is Safari or Mobile Safari (if includeMobileSafari is true).
|
|
6
|
+
*/
|
|
7
|
+
export declare const isSafari: (includeMobileSafari?: boolean) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Determines if an element is scrollable.
|
|
3
|
+
*
|
|
4
|
+
* @param element - The HTML element to check for scrollability.
|
|
5
|
+
* @returns `true` if the element is scrollable either horizontally or vertically, otherwise `false`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isScrollable: (element: HTMLElement) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Remove functions
|
|
3
|
+
*/
|
|
4
|
+
export { removeAllHtmlTags } from './removeAllHtmlTags';
|
|
5
|
+
export { removeAttribute } from './removeAttribute';
|
|
6
|
+
export { removeSessionStorage } from './removeSessionStorage';
|
|
7
|
+
export { removeStylePropertyValue } from './removeStylePropertyValue';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes all HTML tags from the given string.
|
|
3
|
+
*
|
|
4
|
+
* @param string - The input string from which HTML tags should be removed.
|
|
5
|
+
* @returns The sanitized string with all HTML tags removed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const removeAllHtmlTags: (string: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Removes the specified attribute from the given HTML element.
|
|
3
|
+
*
|
|
4
|
+
* @param element - The HTML element from which the attribute will be removed.
|
|
5
|
+
* @param attribute - The name of the attribute to be removed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const removeAttribute: (element: HTMLElement, attribute: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Set functions
|
|
3
|
+
*/
|
|
4
|
+
export { set100vh } from './set100vh';
|
|
5
|
+
export { set100vw } from './set100vw';
|
|
6
|
+
export { setAttribute } from './setAttribute';
|
|
7
|
+
export { setScrollPositionToCenter } from './setScrollPositionToCenter';
|
|
8
|
+
export { setSessionStorage } from './setSessionStorage';
|
|
9
|
+
export { setStylePropertyValue } from './setStylePropertyValue';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets a CSS variable to 100vh to handle viewport units on mobile devices.
|
|
3
|
+
*
|
|
4
|
+
* This function calculates 1% of the viewport height and sets it as a CSS variable.
|
|
5
|
+
* This is useful for handling issues with viewport units on mobile devices.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} [setProperty='--vh'] - The name of the CSS variable to set.
|
|
8
|
+
*
|
|
9
|
+
* @link https://css-tricks.com/the-trick-to-viewport-units-on-mobile/
|
|
10
|
+
*/
|
|
11
|
+
export declare const set100vh: (setProperty?: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets an attribute on a given HTML element.
|
|
3
|
+
*
|
|
4
|
+
* @param element - The HTML element on which the attribute will be set.
|
|
5
|
+
* @param attribute - The name of the attribute to set.
|
|
6
|
+
* @param value - The value of the attribute to set.
|
|
7
|
+
*/
|
|
8
|
+
export declare const setAttribute: (element: HTMLElement, attribute: string, value: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets the horizontal scroll position of a root element to center a target element within it.
|
|
3
|
+
*
|
|
4
|
+
* @param rootElement - The root HTML element whose scroll position will be adjusted.
|
|
5
|
+
* @param targetElement - The target HTML element that should be centered within the root element.
|
|
6
|
+
* @param behavior - The scrolling behavior, either 'auto' or 'smooth'. Defaults to 'smooth'.
|
|
7
|
+
*/
|
|
8
|
+
export declare const setScrollPositionToCenter: (rootElement: HTMLElement, targetElement: HTMLElement, behavior?: "auto" | "smooth") => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets a CSS custom property on the root element.
|
|
3
|
+
*
|
|
4
|
+
* @param key - The name of the CSS custom property to set.
|
|
5
|
+
* @param value - The value to set for the CSS custom property.
|
|
6
|
+
*/
|
|
7
|
+
export declare const setStylePropertyValue: (key: string, value: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a string to a boolean value.
|
|
3
|
+
*
|
|
4
|
+
* @param booleanStr - The string to convert to a boolean. If the string is 'true' (case insensitive), it returns true. For any other value, it returns false. If the input is null, it also returns false.
|
|
5
|
+
* @returns A boolean value based on the input string.
|
|
6
|
+
*/
|
|
7
|
+
export declare const toBoolean: (booleanStr: string | null) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts a given number to a positive number.
|
|
3
|
+
*
|
|
4
|
+
* @param n - The number to be converted. If the number is negative or zero, it will be converted to its absolute value.
|
|
5
|
+
* @returns The positive number.
|
|
6
|
+
*/
|
|
7
|
+
export declare const toPositiveNumber: (n: number) => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps each character of the text content of an HTML element with individual <span> elements.
|
|
3
|
+
*
|
|
4
|
+
* @param element - The HTML element whose text content will be wrapped with <span> elements.
|
|
5
|
+
*
|
|
6
|
+
* This function recursively processes the given element and its child nodes. If the node is a text node,
|
|
7
|
+
* it replaces the text content with a series of <span> elements, each containing a single character from the text.
|
|
8
|
+
* If the node is an element node, it recursively processes its child nodes.
|
|
9
|
+
*/
|
|
10
|
+
export declare const wrapTextWithSpans: (element: HTMLElement) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Waits for all images and videos in the document to be fully loaded.
|
|
3
|
+
*
|
|
4
|
+
* @param firstViewOnly - If true, only considers media elements within the first view (viewport height).
|
|
5
|
+
* @returns A promise that resolves to true when all media elements are loaded.
|
|
6
|
+
*/
|
|
7
|
+
export declare const waitForAllMediaLoaded: (firstViewOnly?: boolean) => Promise<boolean>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/vite.svg
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "umaki",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A utility that is often used in web production.",
|
|
5
|
+
"author": "TsubasaHiga",
|
|
6
|
+
"homepage": "https://github.com/TsubasaHiga/umaki",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"utility",
|
|
10
|
+
"web"
|
|
11
|
+
],
|
|
12
|
+
"packageManager": "yarn@4.1.1",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/TsubasaHiga/umaki"
|
|
16
|
+
},
|
|
17
|
+
"type": "module",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"main": "./dist/index.umd.cjs",
|
|
22
|
+
"module": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"exports": {
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"import": "./dist/index.js",
|
|
27
|
+
"require": "./dist/index.umd.cjs"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"dev": "vite",
|
|
31
|
+
"build": "tsc && vite build",
|
|
32
|
+
"test": "vitest",
|
|
33
|
+
"coverage": "vitest run --coverage",
|
|
34
|
+
"lint": "biome lint",
|
|
35
|
+
"format": "biome format"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"dayjs": "^1.11.13",
|
|
39
|
+
"image-size": "^1.1.1",
|
|
40
|
+
"is-touch-device": "^1.0.1",
|
|
41
|
+
"isomorphic-dompurify": "^2.16.0",
|
|
42
|
+
"query-string": "^9.1.1",
|
|
43
|
+
"runes2": "^1.1.4",
|
|
44
|
+
"store2": "^2.14.3",
|
|
45
|
+
"ua-parser-js": "^1.0.39"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@biomejs/biome": "1.9.4",
|
|
49
|
+
"@types/is-touch-device": "^1",
|
|
50
|
+
"@types/node": "^22.8.6",
|
|
51
|
+
"@types/ua-parser-js": "^0.7.39",
|
|
52
|
+
"@vitest/coverage-v8": "2.1.4",
|
|
53
|
+
"happy-dom": "^15.7.4",
|
|
54
|
+
"typescript": "~5.6.3",
|
|
55
|
+
"vite": "^5.4.10",
|
|
56
|
+
"vite-plugin-dts": "^4.3.0",
|
|
57
|
+
"vite-tsconfig-paths": "^5.0.1",
|
|
58
|
+
"vitest": "^2.1.4"
|
|
59
|
+
}
|
|
60
|
+
}
|