umaki 0.8.1 → 0.9.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 CHANGED
@@ -1136,6 +1136,42 @@ tap(bgScrollStop(true), () => {
1136
1136
 
1137
1137
  Specific usage for frameworks or various tools is described below.
1138
1138
 
1139
+ ### Subpath Exports (Selective Module Imports)
1140
+
1141
+ Umaki supports subpath exports, allowing you to import only the modules you need. This is particularly useful for avoiding unnecessary dependencies and reducing bundle size.
1142
+
1143
+ ```ts
1144
+ // Import only the 'get' module (does not load isomorphic-dompurify)
1145
+ import { getUaData, getScrollbarWidth } from "umaki/get";
1146
+
1147
+ // Import only the 'is' module
1148
+ import { isIpad, isSafari } from "umaki/is";
1149
+
1150
+ // Import only the 'security' module (loads isomorphic-dompurify)
1151
+ import { sanitizeHtml } from "umaki/security";
1152
+
1153
+ // Traditional import (loads all modules)
1154
+ import { getUaData, sanitizeHtml } from "umaki";
1155
+ ```
1156
+
1157
+ #### Available Subpath Exports
1158
+
1159
+ | Path | Description |
1160
+ |------|-------------|
1161
+ | `umaki/callback` | Callback utilities (tap, tapAsync) |
1162
+ | `umaki/config` | Configuration (setConfig, getConfig) |
1163
+ | `umaki/control` | Scroll control, video playback, etc. |
1164
+ | `umaki/convert` | Data conversion (dates, JSON) |
1165
+ | `umaki/eventControl` | debounce, throttle |
1166
+ | `umaki/get` | Value retrieval (DOM, UA, etc.) |
1167
+ | `umaki/is` | Boolean checks (device detection, etc.) |
1168
+ | `umaki/remove` | DOM/storage removal utilities |
1169
+ | `umaki/security` | HTML sanitization |
1170
+ | `umaki/set` | DOM/storage setters |
1171
+ | `umaki/to` | Type conversions |
1172
+ | `umaki/transform` | DOM transformations |
1173
+ | `umaki/wait` | Async utilities (sleep, media loading) |
1174
+
1139
1175
  ### Astro or Vite
1140
1176
 
1141
1177
  When using with Astro for SSR, add `umaki` to `vite.ssr.noExternal.`
@@ -1152,3 +1188,20 @@ export default defineConfig(({ mode }) => {
1152
1188
  };
1153
1189
  });
1154
1190
  ```
1191
+
1192
+ ### Next.js
1193
+
1194
+ When using umaki with Next.js, you may encounter ESM compatibility issues during SSR if you import from the main entry point. This is because `isomorphic-dompurify` (used by the security module) has dependencies that can cause issues in SSR environments.
1195
+
1196
+ **Recommended: Use subpath exports to import only the modules you need:**
1197
+
1198
+ ```ts
1199
+ // ✅ Safe for Next.js SSR (does not load isomorphic-dompurify)
1200
+ import { getUaData } from "umaki/get";
1201
+ import { debounce } from "umaki/eventControl";
1202
+
1203
+ // ⚠️ Only import security module if you need HTML sanitization
1204
+ import { sanitizeHtml } from "umaki/security";
1205
+ ```
1206
+
1207
+ This approach avoids loading `isomorphic-dompurify` and its dependencies unless you specifically need the `sanitizeHtml` function.
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const tap = require("./tap.cjs.js");
4
+ const tapAsync = require("./tap-async.cjs.js");
5
+ exports.tap = tap.tap;
6
+ exports.tapAsync = tapAsync.tapAsync;
@@ -0,0 +1,6 @@
1
+ import { tap } from "./tap.es.js";
2
+ import { tapAsync } from "./tap-async.es.js";
3
+ export {
4
+ tap,
5
+ tapAsync
6
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const defaultConfig = require("./default-config.cjs.js");
4
+ const getConfig = require("./get-config.cjs.js");
5
+ const setConfig = require("./set-config.cjs.js");
6
+ exports.defaultConfig = defaultConfig.defaultConfig;
7
+ exports.getConfig = getConfig.getConfig;
8
+ exports.getConfigValue = getConfig.getConfigValue;
9
+ exports.setConfig = setConfig.setConfig;
@@ -0,0 +1,9 @@
1
+ import { defaultConfig } from "./default-config.es.js";
2
+ import { getConfig, getConfigValue } from "./get-config.es.js";
3
+ import { setConfig } from "./set-config.es.js";
4
+ export {
5
+ defaultConfig,
6
+ getConfig,
7
+ getConfigValue,
8
+ setConfig
9
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const bgScrollStop = require("./bg-scroll-stop.cjs.js");
4
+ const pd = require("./pd.cjs.js");
5
+ const scrollToHash = require("./scroll-to-hash.cjs.js");
6
+ const videoPlayControl = require("./video-play-control.cjs.js");
7
+ exports.bgScrollStop = bgScrollStop.bgScrollStop;
8
+ exports.pd = pd.pd;
9
+ exports.scrollToHash = scrollToHash.scrollToHash;
10
+ exports.videoPlayControl = videoPlayControl.videoPlayControl;
@@ -0,0 +1,10 @@
1
+ import { bgScrollStop } from "./bg-scroll-stop.es.js";
2
+ import { pd } from "./pd.es.js";
3
+ import { scrollToHash } from "./scroll-to-hash.es.js";
4
+ import { videoPlayControl } from "./video-play-control.es.js";
5
+ export {
6
+ bgScrollStop,
7
+ pd,
8
+ scrollToHash,
9
+ videoPlayControl
10
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const changeDateStringToSpecificFormat = require("./change-date-string-to-specific-format.cjs.js");
4
+ const jsonStringToJsonObject = require("./json-string-to-json-object.cjs.js");
5
+ exports.changeDateStringToSpecificFormat = changeDateStringToSpecificFormat.changeDateStringToSpecificFormat;
6
+ exports.jsonStringToJsonObject = jsonStringToJsonObject.jsonStringToJsonObject;
@@ -0,0 +1,6 @@
1
+ import { changeDateStringToSpecificFormat } from "./change-date-string-to-specific-format.es.js";
2
+ import { jsonStringToJsonObject } from "./json-string-to-json-object.es.js";
3
+ export {
4
+ changeDateStringToSpecificFormat,
5
+ jsonStringToJsonObject
6
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const debounce = require("./debounce.cjs.js");
4
+ const throttle = require("./throttle.cjs.js");
5
+ exports.debounce = debounce.debounce;
6
+ exports.throttle = throttle.throttle;
@@ -0,0 +1,6 @@
1
+ import { debounce } from "./debounce.es.js";
2
+ import { throttle } from "./throttle.es.js";
3
+ export {
4
+ debounce,
5
+ throttle
6
+ };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const getAspectRatio = require("./get-aspect-ratio.cjs.js");
4
+ const getClassNames = require("./get-class-names.cjs.js");
5
+ const getDocumentHeight = require("./get-document-height.cjs.js");
6
+ const getEventPaths = require("./get-event-paths.cjs.js");
7
+ const getGcd = require("./get-gcd.cjs.js");
8
+ const getGravatarUrl = require("./get-gravatar-url.cjs.js");
9
+ const getOrientation = require("./get-orientation.cjs.js");
10
+ const getParentList = require("./get-parent-list.cjs.js");
11
+ const getQueryParams = require("./get-query-params.cjs.js");
12
+ const getRem = require("./get-rem.cjs.js");
13
+ const getScrollbarWidth = require("./get-scrollbar-width.cjs.js");
14
+ const getSessionStorage = require("./get-session-storage.cjs.js");
15
+ const getStringLength = require("./get-string-length.cjs.js");
16
+ const getStylePropertyValue = require("./get-style-property-value.cjs.js");
17
+ const getStylePropertyValueToNumber = require("./get-style-property-value-to-number.cjs.js");
18
+ const getUaData = require("./get-ua-data.cjs.js");
19
+ exports.getAspectRatio = getAspectRatio.getAspectRatio;
20
+ exports.getClassNames = getClassNames.getClassNames;
21
+ exports.getDocumentHeight = getDocumentHeight.getDocumentHeight;
22
+ exports.getEventPaths = getEventPaths.getEventPaths;
23
+ exports.getGcd = getGcd.getGcd;
24
+ exports.getGravatarUrl = getGravatarUrl.getGravatarUrl;
25
+ exports.getOrientation = getOrientation.getOrientation;
26
+ exports.getParentList = getParentList.getParentList;
27
+ exports.getQueryParams = getQueryParams.getQueryParams;
28
+ exports.getRem = getRem.getRem;
29
+ exports.getScrollbarWidth = getScrollbarWidth.getScrollbarWidth;
30
+ exports.getSessionStorage = getSessionStorage.getSessionStorage;
31
+ exports.getStringLength = getStringLength.getStringLength;
32
+ exports.getStylePropertyValue = getStylePropertyValue.getStylePropertyValue;
33
+ exports.getStylePropertyValueToNumber = getStylePropertyValueToNumber.getStylePropertyValueToNumber;
34
+ exports.getUaData = getUaData.getUaData;
@@ -0,0 +1,34 @@
1
+ import { getAspectRatio } from "./get-aspect-ratio.es.js";
2
+ import { getClassNames } from "./get-class-names.es.js";
3
+ import { getDocumentHeight } from "./get-document-height.es.js";
4
+ import { getEventPaths } from "./get-event-paths.es.js";
5
+ import { getGcd } from "./get-gcd.es.js";
6
+ import { getGravatarUrl } from "./get-gravatar-url.es.js";
7
+ import { getOrientation } from "./get-orientation.es.js";
8
+ import { getParentList } from "./get-parent-list.es.js";
9
+ import { getQueryParams } from "./get-query-params.es.js";
10
+ import { getRem } from "./get-rem.es.js";
11
+ import { getScrollbarWidth } from "./get-scrollbar-width.es.js";
12
+ import { getSessionStorage } from "./get-session-storage.es.js";
13
+ import { getStringLength } from "./get-string-length.es.js";
14
+ import { getStylePropertyValue } from "./get-style-property-value.es.js";
15
+ import { getStylePropertyValueToNumber } from "./get-style-property-value-to-number.es.js";
16
+ import { getUaData } from "./get-ua-data.es.js";
17
+ export {
18
+ getAspectRatio,
19
+ getClassNames,
20
+ getDocumentHeight,
21
+ getEventPaths,
22
+ getGcd,
23
+ getGravatarUrl,
24
+ getOrientation,
25
+ getParentList,
26
+ getQueryParams,
27
+ getRem,
28
+ getScrollbarWidth,
29
+ getSessionStorage,
30
+ getStringLength,
31
+ getStylePropertyValue,
32
+ getStylePropertyValueToNumber,
33
+ getUaData
34
+ };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const checkDeviceSize = require("./check-device-size.cjs.js");
4
+ const isAfterDateTime = require("./is-after-date-time.cjs.js");
5
+ const isBetweenDateTime = require("./is-between-date-time.cjs.js");
6
+ const isExistAllElements = require("./is-exist-all-elements.cjs.js");
7
+ const isIpad = require("./is-ipad.cjs.js");
8
+ const isKeyExists = require("./is-key-exists.cjs.js");
9
+ const isSafari = require("./is-safari.cjs.js");
10
+ const isScrollable = require("./is-scrollable.cjs.js");
11
+ const isTouchSupport = require("./is-touch-support.cjs.js");
12
+ exports.checkDeviceSize = checkDeviceSize.checkDeviceSize;
13
+ exports.isAfterDateTime = isAfterDateTime.isAfterDateTime;
14
+ exports.isBetweenDateTime = isBetweenDateTime.isBetweenDateTime;
15
+ exports.isExistAllElements = isExistAllElements.isExistAllElements;
16
+ exports.isIpad = isIpad.isIpad;
17
+ exports.isKeyExists = isKeyExists.isKeyExists;
18
+ exports.isSafari = isSafari.isSafari;
19
+ exports.isScrollable = isScrollable.isScrollable;
20
+ exports.isTouchSupport = isTouchSupport.isTouchSupport;
@@ -0,0 +1,20 @@
1
+ import { checkDeviceSize } from "./check-device-size.es.js";
2
+ import { isAfterDateTime } from "./is-after-date-time.es.js";
3
+ import { isBetweenDateTime } from "./is-between-date-time.es.js";
4
+ import { isExistAllElements } from "./is-exist-all-elements.es.js";
5
+ import { isIpad } from "./is-ipad.es.js";
6
+ import { isKeyExists } from "./is-key-exists.es.js";
7
+ import { isSafari } from "./is-safari.es.js";
8
+ import { isScrollable } from "./is-scrollable.es.js";
9
+ import { isTouchSupport } from "./is-touch-support.es.js";
10
+ export {
11
+ checkDeviceSize,
12
+ isAfterDateTime,
13
+ isBetweenDateTime,
14
+ isExistAllElements,
15
+ isIpad,
16
+ isKeyExists,
17
+ isSafari,
18
+ isScrollable,
19
+ isTouchSupport
20
+ };
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const removeAllHtmlTags = require("./remove-all-html-tags.cjs.js");
4
+ const removeAttribute = require("./remove-attribute.cjs.js");
5
+ const removeSessionStorage = require("./remove-session-storage.cjs.js");
6
+ const removeStylePropertyValue = require("./remove-style-property-value.cjs.js");
7
+ exports.removeAllHtmlTags = removeAllHtmlTags.removeAllHtmlTags;
8
+ exports.removeAttribute = removeAttribute.removeAttribute;
9
+ exports.removeSessionStorage = removeSessionStorage.removeSessionStorage;
10
+ exports.removeStylePropertyValue = removeStylePropertyValue.removeStylePropertyValue;
@@ -0,0 +1,10 @@
1
+ import { removeAllHtmlTags } from "./remove-all-html-tags.es.js";
2
+ import { removeAttribute } from "./remove-attribute.es.js";
3
+ import { removeSessionStorage } from "./remove-session-storage.es.js";
4
+ import { removeStylePropertyValue } from "./remove-style-property-value.es.js";
5
+ export {
6
+ removeAllHtmlTags,
7
+ removeAttribute,
8
+ removeSessionStorage,
9
+ removeStylePropertyValue
10
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const htmlSanitize = require("./html-sanitize.cjs.js");
4
+ exports.htmlSanitize = htmlSanitize.htmlSanitize;
@@ -0,0 +1,4 @@
1
+ import { htmlSanitize } from "./html-sanitize.es.js";
2
+ export {
3
+ htmlSanitize
4
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const set100vh = require("./set-100vh.cjs.js");
4
+ const set100vw = require("./set-100vw.cjs.js");
5
+ const setAttribute = require("./set-attribute.cjs.js");
6
+ const setScrollPositionToCenter = require("./set-scroll-position-to-center.cjs.js");
7
+ const setSessionStorage = require("./set-session-storage.cjs.js");
8
+ const setStylePropertyValue = require("./set-style-property-value.cjs.js");
9
+ exports.set100vh = set100vh.set100vh;
10
+ exports.set100vw = set100vw.set100vw;
11
+ exports.setAttribute = setAttribute.setAttribute;
12
+ exports.setScrollPositionToCenter = setScrollPositionToCenter.setScrollPositionToCenter;
13
+ exports.setSessionStorage = setSessionStorage.setSessionStorage;
14
+ exports.setStylePropertyValue = setStylePropertyValue.setStylePropertyValue;
@@ -0,0 +1,14 @@
1
+ import { set100vh } from "./set-100vh.es.js";
2
+ import { set100vw } from "./set-100vw.es.js";
3
+ import { setAttribute } from "./set-attribute.es.js";
4
+ import { setScrollPositionToCenter } from "./set-scroll-position-to-center.es.js";
5
+ import { setSessionStorage } from "./set-session-storage.es.js";
6
+ import { setStylePropertyValue } from "./set-style-property-value.es.js";
7
+ export {
8
+ set100vh,
9
+ set100vw,
10
+ setAttribute,
11
+ setScrollPositionToCenter,
12
+ setSessionStorage,
13
+ setStylePropertyValue
14
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const toBoolean = require("./to-boolean.cjs.js");
4
+ const toPositiveNumber = require("./to-positive-number.cjs.js");
5
+ exports.toBoolean = toBoolean.toBoolean;
6
+ exports.toPositiveNumber = toPositiveNumber.toPositiveNumber;
@@ -0,0 +1,6 @@
1
+ import { toBoolean } from "./to-boolean.es.js";
2
+ import { toPositiveNumber } from "./to-positive-number.es.js";
3
+ export {
4
+ toBoolean,
5
+ toPositiveNumber
6
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const wrapTextWithSpans = require("./wrap-text-with-spans.cjs.js");
4
+ exports.wrapTextWithSpans = wrapTextWithSpans.wrapTextWithSpans;
@@ -0,0 +1,4 @@
1
+ import { wrapTextWithSpans } from "./wrap-text-with-spans.es.js";
2
+ export {
3
+ wrapTextWithSpans
4
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const sleep = require("./sleep.cjs.js");
4
+ const waitForAllMediaLoaded = require("./wait-for-all-media-loaded.cjs.js");
5
+ exports.sleep = sleep.sleep;
6
+ exports.waitForAllMediaLoaded = waitForAllMediaLoaded.waitForAllMediaLoaded;
@@ -0,0 +1,6 @@
1
+ import { sleep } from "./sleep.es.js";
2
+ import { waitForAllMediaLoaded } from "./wait-for-all-media-loaded.es.js";
3
+ export {
4
+ sleep,
5
+ waitForAllMediaLoaded
6
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umaki",
3
- "version": "0.8.1",
3
+ "version": "0.9.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",
@@ -23,9 +23,76 @@
23
23
  "module": "./dist/index.es.js",
24
24
  "types": "./dist/index.d.ts",
25
25
  "exports": {
26
- "types": "./dist/index.d.ts",
27
- "import": "./dist/index.es.js",
28
- "require": "./dist/index.cjs.js"
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.es.js",
29
+ "require": "./dist/index.cjs.js"
30
+ },
31
+ "./callback": {
32
+ "types": "./dist/libs/callback/index.d.ts",
33
+ "import": "./dist/libs/callback/index.es.js",
34
+ "require": "./dist/libs/callback/index.cjs.js"
35
+ },
36
+ "./config": {
37
+ "types": "./dist/libs/config/index.d.ts",
38
+ "import": "./dist/libs/config/index.es.js",
39
+ "require": "./dist/libs/config/index.cjs.js"
40
+ },
41
+ "./control": {
42
+ "types": "./dist/libs/control/index.d.ts",
43
+ "import": "./dist/libs/control/index.es.js",
44
+ "require": "./dist/libs/control/index.cjs.js"
45
+ },
46
+ "./convert": {
47
+ "types": "./dist/libs/convert/index.d.ts",
48
+ "import": "./dist/libs/convert/index.es.js",
49
+ "require": "./dist/libs/convert/index.cjs.js"
50
+ },
51
+ "./eventControl": {
52
+ "types": "./dist/libs/eventControl/index.d.ts",
53
+ "import": "./dist/libs/eventControl/index.es.js",
54
+ "require": "./dist/libs/eventControl/index.cjs.js"
55
+ },
56
+ "./get": {
57
+ "types": "./dist/libs/get/index.d.ts",
58
+ "import": "./dist/libs/get/index.es.js",
59
+ "require": "./dist/libs/get/index.cjs.js"
60
+ },
61
+ "./is": {
62
+ "types": "./dist/libs/is/index.d.ts",
63
+ "import": "./dist/libs/is/index.es.js",
64
+ "require": "./dist/libs/is/index.cjs.js"
65
+ },
66
+ "./remove": {
67
+ "types": "./dist/libs/remove/index.d.ts",
68
+ "import": "./dist/libs/remove/index.es.js",
69
+ "require": "./dist/libs/remove/index.cjs.js"
70
+ },
71
+ "./security": {
72
+ "types": "./dist/libs/security/index.d.ts",
73
+ "import": "./dist/libs/security/index.es.js",
74
+ "require": "./dist/libs/security/index.cjs.js"
75
+ },
76
+ "./set": {
77
+ "types": "./dist/libs/set/index.d.ts",
78
+ "import": "./dist/libs/set/index.es.js",
79
+ "require": "./dist/libs/set/index.cjs.js"
80
+ },
81
+ "./to": {
82
+ "types": "./dist/libs/to/index.d.ts",
83
+ "import": "./dist/libs/to/index.es.js",
84
+ "require": "./dist/libs/to/index.cjs.js"
85
+ },
86
+ "./transform": {
87
+ "types": "./dist/libs/transform/index.d.ts",
88
+ "import": "./dist/libs/transform/index.es.js",
89
+ "require": "./dist/libs/transform/index.cjs.js"
90
+ },
91
+ "./wait": {
92
+ "types": "./dist/libs/wait/index.d.ts",
93
+ "import": "./dist/libs/wait/index.es.js",
94
+ "require": "./dist/libs/wait/index.cjs.js"
95
+ }
29
96
  },
30
97
  "scripts": {
31
98
  "dev": "vite",