umaki 0.4.0 → 0.4.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 +46 -21
- 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 +3 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +3 -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 +5 -2
- package/dist/libs/convert/changeDateStringToSpecificFormat.d.ts +5 -1
- package/dist/libs/convert/changeDateStringToSpecificFormat.es.js +5 -2
- package/dist/libs/convert/changeDateStringToSpecificFormat.test.d.ts +0 -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 +1 -1
- package/dist/libs/eventControl/debounce.es.js +1 -1
- package/dist/libs/eventControl/throttle.cjs.js +1 -1
- package/dist/libs/eventControl/throttle.es.js +1 -1
- 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/security/htmlSanitize.cjs.js +18 -0
- package/dist/libs/security/htmlSanitize.d.ts +1 -1
- package/dist/libs/security/htmlSanitize.es.js +18 -0
- package/dist/libs/security/index.d.ts +4 -0
- 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/README.md
CHANGED
|
@@ -73,6 +73,8 @@ import { foo } from "umaki";
|
|
|
73
73
|
- [Wait](#wait)
|
|
74
74
|
- [sleep](#sleep)
|
|
75
75
|
- [waitForAllMediaLoaded](#waitforallmedialoaded)
|
|
76
|
+
- [Security](#security)
|
|
77
|
+
- [sanitizeHtml](#sanitizehtml)
|
|
76
78
|
|
|
77
79
|
## Control
|
|
78
80
|
|
|
@@ -147,11 +149,34 @@ A function that converts a date string to a specific format.
|
|
|
147
149
|
```ts
|
|
148
150
|
import { changeDateStringToSpecificFormat } from "umaki";
|
|
149
151
|
|
|
152
|
+
// Basic usage
|
|
150
153
|
const date = "2023-10-05";
|
|
151
154
|
const formattedDate = changeDateStringToSpecificFormat(date, "MM/DD/YYYY");
|
|
152
155
|
console.log(formattedDate); // '10/05/2023'
|
|
156
|
+
|
|
157
|
+
// With locale
|
|
158
|
+
import "dayjs/locale/ja";
|
|
159
|
+
const dateWithLocale = "2025-04-25T00:00:00.000Z";
|
|
160
|
+
const formattedDateWithLocale = changeDateStringToSpecificFormat(
|
|
161
|
+
dateWithLocale,
|
|
162
|
+
"YYYY年MM月DD日 (ddd)",
|
|
163
|
+
"ja"
|
|
164
|
+
);
|
|
165
|
+
console.log(formattedDateWithLocale); // '2025年04月25日 (金)'
|
|
166
|
+
|
|
167
|
+
// With different locale
|
|
168
|
+
import "dayjs/locale/en";
|
|
169
|
+
const formattedDateWithEnLocale = changeDateStringToSpecificFormat(
|
|
170
|
+
dateWithLocale,
|
|
171
|
+
"YYYY年MM月DD日 (ddd)",
|
|
172
|
+
"en"
|
|
173
|
+
);
|
|
174
|
+
console.log(formattedDateWithEnLocale); // '2025年04月25日 (Fri)'
|
|
153
175
|
```
|
|
154
176
|
|
|
177
|
+
Note: To use specific locales, you need to import the corresponding locale file in your project.
|
|
178
|
+
Example: `import 'dayjs/locale/ja'`
|
|
179
|
+
|
|
155
180
|
[View file →](src/libs/convert/changeDateStringToSpecificFormat.ts)
|
|
156
181
|
|
|
157
182
|
### jsonStringToJsonObject
|
|
@@ -756,27 +781,6 @@ import { waitForAllMediaLoaded } from "umaki";
|
|
|
756
781
|
|
|
757
782
|
[View file →](src/libs/wait/waitForAllMediaLoaded.ts)
|
|
758
783
|
|
|
759
|
-
## Using for framework and tools
|
|
760
|
-
|
|
761
|
-
Specific usage for frameworks or various tools is described below.
|
|
762
|
-
|
|
763
|
-
### Astro or Vite
|
|
764
|
-
|
|
765
|
-
When using with Astro for SSR, add `umaki` to `vite.ssr.noExternal.`
|
|
766
|
-
|
|
767
|
-
```ts
|
|
768
|
-
// astro.config.ts
|
|
769
|
-
export default defineConfig(({ mode }) => {
|
|
770
|
-
return {
|
|
771
|
-
vite: {
|
|
772
|
-
ssr: {
|
|
773
|
-
noExternal: ["umaki"],
|
|
774
|
-
},
|
|
775
|
-
},
|
|
776
|
-
};
|
|
777
|
-
});
|
|
778
|
-
```
|
|
779
|
-
|
|
780
784
|
## Security
|
|
781
785
|
|
|
782
786
|
### sanitizeHtml
|
|
@@ -805,3 +809,24 @@ This function uses `isomorphic-dompurify` and has the following features:
|
|
|
805
809
|
- Can be used on both server-side and client-side
|
|
806
810
|
|
|
807
811
|
[View file →](src/libs/security/htmlSanitize.ts)
|
|
812
|
+
|
|
813
|
+
## Using for framework and tools
|
|
814
|
+
|
|
815
|
+
Specific usage for frameworks or various tools is described below.
|
|
816
|
+
|
|
817
|
+
### Astro or Vite
|
|
818
|
+
|
|
819
|
+
When using with Astro for SSR, add `umaki` to `vite.ssr.noExternal.`
|
|
820
|
+
|
|
821
|
+
```ts
|
|
822
|
+
// astro.config.ts
|
|
823
|
+
export default defineConfig(({ mode }) => {
|
|
824
|
+
return {
|
|
825
|
+
vite: {
|
|
826
|
+
ssr: {
|
|
827
|
+
noExternal: ["umaki"],
|
|
828
|
+
},
|
|
829
|
+
},
|
|
830
|
+
};
|
|
831
|
+
});
|
|
832
|
+
```
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
3
|
* name: umaki
|
|
4
|
-
* version: v0.4.
|
|
4
|
+
* version: v0.4.2
|
|
5
5
|
* description: A utility that is often used in web production.
|
|
6
6
|
* author: TsubasaHiga
|
|
7
7
|
* homepage: https://github.com/TsubasaHiga/umaki
|
|
@@ -45,6 +45,7 @@ const removeAllHtmlTags = require("./libs/remove/removeAllHtmlTags.cjs.js");
|
|
|
45
45
|
const removeAttribute = require("./libs/remove/removeAttribute.cjs.js");
|
|
46
46
|
const removeSessionStorage = require("./libs/remove/removeSessionStorage.cjs.js");
|
|
47
47
|
const removeStylePropertyValue = require("./libs/remove/removeStylePropertyValue.cjs.js");
|
|
48
|
+
const htmlSanitize = require("./libs/security/htmlSanitize.cjs.js");
|
|
48
49
|
const set100vh = require("./libs/set/set100vh.cjs.js");
|
|
49
50
|
const set100vw = require("./libs/set/set100vw.cjs.js");
|
|
50
51
|
const setAttribute = require("./libs/set/setAttribute.cjs.js");
|
|
@@ -90,6 +91,7 @@ exports.removeAllHtmlTags = removeAllHtmlTags.removeAllHtmlTags;
|
|
|
90
91
|
exports.removeAttribute = removeAttribute.removeAttribute;
|
|
91
92
|
exports.removeSessionStorage = removeSessionStorage.removeSessionStorage;
|
|
92
93
|
exports.removeStylePropertyValue = removeStylePropertyValue.removeStylePropertyValue;
|
|
94
|
+
exports.htmlSanitize = htmlSanitize.htmlSanitize;
|
|
93
95
|
exports.set100vh = set100vh.set100vh;
|
|
94
96
|
exports.set100vw = set100vw.set100vw;
|
|
95
97
|
exports.setAttribute = setAttribute.setAttribute;
|
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.4.
|
|
3
|
+
* version: v0.4.2
|
|
4
4
|
* description: A utility that is often used in web production.
|
|
5
5
|
* author: TsubasaHiga
|
|
6
6
|
* homepage: https://github.com/TsubasaHiga/umaki
|
|
@@ -43,6 +43,7 @@ import { removeAllHtmlTags } from "./libs/remove/removeAllHtmlTags.es.js";
|
|
|
43
43
|
import { removeAttribute } from "./libs/remove/removeAttribute.es.js";
|
|
44
44
|
import { removeSessionStorage } from "./libs/remove/removeSessionStorage.es.js";
|
|
45
45
|
import { removeStylePropertyValue } from "./libs/remove/removeStylePropertyValue.es.js";
|
|
46
|
+
import { htmlSanitize } from "./libs/security/htmlSanitize.es.js";
|
|
46
47
|
import { set100vh } from "./libs/set/set100vh.es.js";
|
|
47
48
|
import { set100vw } from "./libs/set/set100vw.es.js";
|
|
48
49
|
import { setAttribute } from "./libs/set/setAttribute.es.js";
|
|
@@ -73,6 +74,7 @@ export {
|
|
|
73
74
|
getStylePropertyValue,
|
|
74
75
|
getStylePropertyValueToNumber,
|
|
75
76
|
getUaData,
|
|
77
|
+
htmlSanitize,
|
|
76
78
|
isBetweenDateTime,
|
|
77
79
|
isExistAllElements,
|
|
78
80
|
isIpad,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*!
|
|
3
3
|
* name: umaki
|
|
4
|
-
* version: v0.4.
|
|
4
|
+
* version: v0.4.2
|
|
5
5
|
* description: A utility that is often used in web production.
|
|
6
6
|
* author: TsubasaHiga
|
|
7
7
|
* homepage: https://github.com/TsubasaHiga/umaki
|
|
@@ -12,5 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
14
14
|
const dayjs = require("dayjs");
|
|
15
|
-
const changeDateStringToSpecificFormat = (date, format = "YYYY年MM月DD日") =>
|
|
15
|
+
const changeDateStringToSpecificFormat = (date, format = "YYYY年MM月DD日", locale = "ja") => {
|
|
16
|
+
dayjs.locale(locale);
|
|
17
|
+
return dayjs(date).format(format);
|
|
18
|
+
};
|
|
16
19
|
exports.changeDateStringToSpecificFormat = changeDateStringToSpecificFormat;
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Converts a date string to a specific format using the dayjs library.
|
|
3
3
|
*
|
|
4
|
+
* Note: To use specific locales, you need to import the corresponding locale file in your project.
|
|
5
|
+
* Example: import 'dayjs/locale/ja'
|
|
6
|
+
*
|
|
4
7
|
* @param date - The date string to be converted.
|
|
5
8
|
* @param format - The format to convert the date string to. Defaults to 'YYYY年MM月DD日'.
|
|
9
|
+
* @param locale - The locale to use for formatting. Defaults to 'ja'.
|
|
6
10
|
* @returns The formatted date string.
|
|
7
11
|
*/
|
|
8
|
-
export declare const changeDateStringToSpecificFormat: (date: string, format?: string) => string;
|
|
12
|
+
export declare const changeDateStringToSpecificFormat: (date: string, format?: string, locale?: string) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* name: umaki
|
|
3
|
-
* version: v0.4.
|
|
3
|
+
* version: v0.4.2
|
|
4
4
|
* description: A utility that is often used in web production.
|
|
5
5
|
* author: TsubasaHiga
|
|
6
6
|
* homepage: https://github.com/TsubasaHiga/umaki
|
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
* For license information, please see LICENSE.txt
|
|
11
11
|
*/
|
|
12
12
|
import dayjs from "dayjs";
|
|
13
|
-
const changeDateStringToSpecificFormat = (date, format = "YYYY年MM月DD日") =>
|
|
13
|
+
const changeDateStringToSpecificFormat = (date, format = "YYYY年MM月DD日", locale = "ja") => {
|
|
14
|
+
dayjs.locale(locale);
|
|
15
|
+
return dayjs(date).format(format);
|
|
16
|
+
};
|
|
14
17
|
export {
|
|
15
18
|
changeDateStringToSpecificFormat
|
|
16
19
|
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|