umaki 0.7.5 → 0.8.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 +216 -0
- package/dist/index.cjs.js +52 -48
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +52 -48
- package/dist/libs/callback/index.d.ts +5 -0
- package/dist/libs/callback/tap-async.cjs.js +8 -0
- package/dist/libs/callback/tap-async.d.ts +47 -0
- package/dist/libs/callback/tap-async.es.js +8 -0
- package/dist/libs/callback/tap.cjs.js +7 -0
- package/dist/libs/callback/tap.d.ts +35 -0
- package/dist/libs/callback/tap.es.js +7 -0
- package/dist/libs/config/{getConfig.cjs.js → get-config.cjs.js} +1 -1
- package/dist/libs/config/{getConfig.es.js → get-config.es.js} +1 -1
- package/dist/libs/config/index.d.ts +3 -3
- package/dist/libs/config/{setConfig.cjs.js → set-config.cjs.js} +1 -1
- package/dist/libs/config/{setConfig.es.js → set-config.es.js} +1 -1
- package/dist/libs/control/{bgScrollStop.cjs.js → bg-scroll-stop.cjs.js} +1 -1
- package/dist/libs/control/{bgScrollStop.es.js → bg-scroll-stop.es.js} +1 -1
- package/dist/libs/control/index.d.ts +3 -3
- package/dist/libs/control/{videoPlayControl.cjs.js → video-play-control.cjs.js} +1 -1
- package/dist/libs/control/{videoPlayControl.es.js → video-play-control.es.js} +1 -1
- package/dist/libs/convert/index.d.ts +2 -2
- package/dist/libs/get/{getAspectRatio.cjs.js → get-aspect-ratio.cjs.js} +1 -1
- package/dist/libs/get/{getAspectRatio.es.js → get-aspect-ratio.es.js} +1 -1
- package/dist/libs/get/{getGcd.cjs.js → get-gcd.cjs.js} +1 -1
- package/dist/libs/get/{getGcd.es.js → get-gcd.es.js} +1 -1
- package/dist/libs/get/{getStylePropertyValueToNumber.cjs.js → get-style-property-value-to-number.cjs.js} +1 -1
- package/dist/libs/get/{getStylePropertyValueToNumber.es.js → get-style-property-value-to-number.es.js} +1 -1
- package/dist/libs/get/{getUaData.cjs.js → get-ua-data.cjs.js} +1 -1
- package/dist/libs/get/{getUaData.es.js → get-ua-data.es.js} +1 -1
- package/dist/libs/get/index.d.ts +16 -16
- package/dist/libs/is/{checkDeviceSize.cjs.js → check-device-size.cjs.js} +1 -1
- package/dist/libs/is/{checkDeviceSize.es.js → check-device-size.es.js} +1 -1
- package/dist/libs/is/index.d.ts +9 -9
- package/dist/libs/is/{isIpad.cjs.js → is-ipad.cjs.js} +2 -2
- package/dist/libs/is/{isIpad.es.js → is-ipad.es.js} +2 -2
- package/dist/libs/is/{isSafari.cjs.js → is-safari.cjs.js} +1 -1
- package/dist/libs/is/{isSafari.es.js → is-safari.es.js} +1 -1
- package/dist/libs/remove/index.d.ts +4 -4
- package/dist/libs/security/index.d.ts +1 -1
- package/dist/libs/set/index.d.ts +6 -6
- package/dist/libs/to/index.d.ts +2 -2
- package/dist/libs/transform/index.d.ts +1 -1
- package/dist/libs/transform/wrap-text-with-spans.test.d.ts +1 -0
- package/dist/libs/wait/index.d.ts +1 -1
- package/dist/libs/wait/wait-for-all-media-loaded.test.d.ts +1 -0
- package/package.json +1 -1
- /package/dist/libs/{control/scrollToHash.test.d.ts → callback/tap-async.test.d.ts} +0 -0
- /package/dist/libs/{control/videoPlayControl.test.d.ts → callback/tap.test.d.ts} +0 -0
- /package/dist/libs/config/{defaultConfig.cjs.js → default-config.cjs.js} +0 -0
- /package/dist/libs/config/{defaultConfig.d.ts → default-config.d.ts} +0 -0
- /package/dist/libs/config/{defaultConfig.es.js → default-config.es.js} +0 -0
- /package/dist/libs/config/{getConfig.d.ts → get-config.d.ts} +0 -0
- /package/dist/libs/config/{setConfig.d.ts → set-config.d.ts} +0 -0
- /package/dist/libs/control/{bgScrollStop.d.ts → bg-scroll-stop.d.ts} +0 -0
- /package/dist/libs/control/{scrollToHash.cjs.js → scroll-to-hash.cjs.js} +0 -0
- /package/dist/libs/control/{scrollToHash.d.ts → scroll-to-hash.d.ts} +0 -0
- /package/dist/libs/control/{scrollToHash.es.js → scroll-to-hash.es.js} +0 -0
- /package/dist/libs/{convert/changeDateStringToSpecificFormat.test.d.ts → control/scroll-to-hash.test.d.ts} +0 -0
- /package/dist/libs/control/{videoPlayControl.d.ts → video-play-control.d.ts} +0 -0
- /package/dist/libs/{convert/jsonStringToJsonObject.test.d.ts → control/video-play-control.test.d.ts} +0 -0
- /package/dist/libs/convert/{changeDateStringToSpecificFormat.cjs.js → change-date-string-to-specific-format.cjs.js} +0 -0
- /package/dist/libs/convert/{changeDateStringToSpecificFormat.d.ts → change-date-string-to-specific-format.d.ts} +0 -0
- /package/dist/libs/convert/{changeDateStringToSpecificFormat.es.js → change-date-string-to-specific-format.es.js} +0 -0
- /package/dist/libs/{get/getAspectRatio.test.d.ts → convert/change-date-string-to-specific-format.test.d.ts} +0 -0
- /package/dist/libs/convert/{jsonStringToJsonObject.cjs.js → json-string-to-json-object.cjs.js} +0 -0
- /package/dist/libs/convert/{jsonStringToJsonObject.d.ts → json-string-to-json-object.d.ts} +0 -0
- /package/dist/libs/convert/{jsonStringToJsonObject.es.js → json-string-to-json-object.es.js} +0 -0
- /package/dist/libs/{get/getClassNames.test.d.ts → convert/json-string-to-json-object.test.d.ts} +0 -0
- /package/dist/libs/get/{getAspectRatio.d.ts → get-aspect-ratio.d.ts} +0 -0
- /package/dist/libs/get/{getDocumentHeight.test.d.ts → get-aspect-ratio.test.d.ts} +0 -0
- /package/dist/libs/get/{getClassNames.cjs.js → get-class-names.cjs.js} +0 -0
- /package/dist/libs/get/{getClassNames.d.ts → get-class-names.d.ts} +0 -0
- /package/dist/libs/get/{getClassNames.es.js → get-class-names.es.js} +0 -0
- /package/dist/libs/get/{getGcd.test.d.ts → get-class-names.test.d.ts} +0 -0
- /package/dist/libs/get/{getDocumentHeight.cjs.js → get-document-height.cjs.js} +0 -0
- /package/dist/libs/get/{getDocumentHeight.d.ts → get-document-height.d.ts} +0 -0
- /package/dist/libs/get/{getDocumentHeight.es.js → get-document-height.es.js} +0 -0
- /package/dist/libs/get/{getGravatarUrl.test.d.ts → get-document-height.test.d.ts} +0 -0
- /package/dist/libs/get/{getEventPaths.cjs.js → get-event-paths.cjs.js} +0 -0
- /package/dist/libs/get/{getEventPaths.d.ts → get-event-paths.d.ts} +0 -0
- /package/dist/libs/get/{getEventPaths.es.js → get-event-paths.es.js} +0 -0
- /package/dist/libs/get/{getGcd.d.ts → get-gcd.d.ts} +0 -0
- /package/dist/libs/get/{getOrientation.test.d.ts → get-gcd.test.d.ts} +0 -0
- /package/dist/libs/get/{getGravatarUrl.cjs.js → get-gravatar-url.cjs.js} +0 -0
- /package/dist/libs/get/{getGravatarUrl.d.ts → get-gravatar-url.d.ts} +0 -0
- /package/dist/libs/get/{getGravatarUrl.es.js → get-gravatar-url.es.js} +0 -0
- /package/dist/libs/get/{getParentList.test.d.ts → get-gravatar-url.test.d.ts} +0 -0
- /package/dist/libs/get/{getImageSize.d.ts → get-image-size.d.ts} +0 -0
- /package/dist/libs/get/{getOrientation.cjs.js → get-orientation.cjs.js} +0 -0
- /package/dist/libs/get/{getOrientation.d.ts → get-orientation.d.ts} +0 -0
- /package/dist/libs/get/{getOrientation.es.js → get-orientation.es.js} +0 -0
- /package/dist/libs/get/{getPath.test.d.ts → get-orientation.test.d.ts} +0 -0
- /package/dist/libs/get/{getParentList.cjs.js → get-parent-list.cjs.js} +0 -0
- /package/dist/libs/get/{getParentList.d.ts → get-parent-list.d.ts} +0 -0
- /package/dist/libs/get/{getParentList.es.js → get-parent-list.es.js} +0 -0
- /package/dist/libs/get/{getPathFromLocalPublic.test.d.ts → get-parent-list.test.d.ts} +0 -0
- /package/dist/libs/get/{getPathFromLocalPublic.d.ts → get-path-from-local-public.d.ts} +0 -0
- /package/dist/libs/get/{getQueryParams.test.d.ts → get-path-from-local-public.test.d.ts} +0 -0
- /package/dist/libs/get/{getPath.d.ts → get-path.d.ts} +0 -0
- /package/dist/libs/get/{getRem.test.d.ts → get-path.test.d.ts} +0 -0
- /package/dist/libs/get/{getQueryParams.cjs.js → get-query-params.cjs.js} +0 -0
- /package/dist/libs/get/{getQueryParams.d.ts → get-query-params.d.ts} +0 -0
- /package/dist/libs/get/{getQueryParams.es.js → get-query-params.es.js} +0 -0
- /package/dist/libs/get/{getScrollbarWidth.test.d.ts → get-query-params.test.d.ts} +0 -0
- /package/dist/libs/get/{getRem.cjs.js → get-rem.cjs.js} +0 -0
- /package/dist/libs/get/{getRem.d.ts → get-rem.d.ts} +0 -0
- /package/dist/libs/get/{getRem.es.js → get-rem.es.js} +0 -0
- /package/dist/libs/get/{getSessionStorage.test.d.ts → get-rem.test.d.ts} +0 -0
- /package/dist/libs/get/{getScrollbarWidth.cjs.js → get-scrollbar-width.cjs.js} +0 -0
- /package/dist/libs/get/{getScrollbarWidth.d.ts → get-scrollbar-width.d.ts} +0 -0
- /package/dist/libs/get/{getScrollbarWidth.es.js → get-scrollbar-width.es.js} +0 -0
- /package/dist/libs/get/{getStringLength.test.d.ts → get-scrollbar-width.test.d.ts} +0 -0
- /package/dist/libs/get/{getSessionStorage.cjs.js → get-session-storage.cjs.js} +0 -0
- /package/dist/libs/get/{getSessionStorage.d.ts → get-session-storage.d.ts} +0 -0
- /package/dist/libs/get/{getSessionStorage.es.js → get-session-storage.es.js} +0 -0
- /package/dist/libs/get/{getStylePropertyValue.test.d.ts → get-session-storage.test.d.ts} +0 -0
- /package/dist/libs/get/{getStringLength.cjs.js → get-string-length.cjs.js} +0 -0
- /package/dist/libs/get/{getStringLength.d.ts → get-string-length.d.ts} +0 -0
- /package/dist/libs/get/{getStringLength.es.js → get-string-length.es.js} +0 -0
- /package/dist/libs/get/{getStylePropertyValueToNumber.test.d.ts → get-string-length.test.d.ts} +0 -0
- /package/dist/libs/get/{getStylePropertyValueToNumber.d.ts → get-style-property-value-to-number.d.ts} +0 -0
- /package/dist/libs/get/{getUaData.test.d.ts → get-style-property-value-to-number.test.d.ts} +0 -0
- /package/dist/libs/get/{getStylePropertyValue.cjs.js → get-style-property-value.cjs.js} +0 -0
- /package/dist/libs/get/{getStylePropertyValue.d.ts → get-style-property-value.d.ts} +0 -0
- /package/dist/libs/get/{getStylePropertyValue.es.js → get-style-property-value.es.js} +0 -0
- /package/dist/libs/{is/checkDeviceSize.test.d.ts → get/get-style-property-value.test.d.ts} +0 -0
- /package/dist/libs/get/{getUaData.d.ts → get-ua-data.d.ts} +0 -0
- /package/dist/libs/{is/isAfterDateTime.test.d.ts → get/get-ua-data.test.d.ts} +0 -0
- /package/dist/libs/is/{checkDeviceSize.d.ts → check-device-size.d.ts} +0 -0
- /package/dist/libs/is/{isBetweenDateTime.test.d.ts → check-device-size.test.d.ts} +0 -0
- /package/dist/libs/is/{isAfterDateTime.cjs.js → is-after-date-time.cjs.js} +0 -0
- /package/dist/libs/is/{isAfterDateTime.d.ts → is-after-date-time.d.ts} +0 -0
- /package/dist/libs/is/{isAfterDateTime.es.js → is-after-date-time.es.js} +0 -0
- /package/dist/libs/is/{isExistAllElements.test.d.ts → is-after-date-time.test.d.ts} +0 -0
- /package/dist/libs/is/{isBetweenDateTime.cjs.js → is-between-date-time.cjs.js} +0 -0
- /package/dist/libs/is/{isBetweenDateTime.d.ts → is-between-date-time.d.ts} +0 -0
- /package/dist/libs/is/{isBetweenDateTime.es.js → is-between-date-time.es.js} +0 -0
- /package/dist/libs/is/{isIpad.test.d.ts → is-between-date-time.test.d.ts} +0 -0
- /package/dist/libs/is/{isExistAllElements.cjs.js → is-exist-all-elements.cjs.js} +0 -0
- /package/dist/libs/is/{isExistAllElements.d.ts → is-exist-all-elements.d.ts} +0 -0
- /package/dist/libs/is/{isExistAllElements.es.js → is-exist-all-elements.es.js} +0 -0
- /package/dist/libs/is/{isKeyExists.test.d.ts → is-exist-all-elements.test.d.ts} +0 -0
- /package/dist/libs/is/{isIpad.d.ts → is-ipad.d.ts} +0 -0
- /package/dist/libs/is/{isProduction.test.d.ts → is-ipad.test.d.ts} +0 -0
- /package/dist/libs/is/{isKeyExists.cjs.js → is-key-exists.cjs.js} +0 -0
- /package/dist/libs/is/{isKeyExists.d.ts → is-key-exists.d.ts} +0 -0
- /package/dist/libs/is/{isKeyExists.es.js → is-key-exists.es.js} +0 -0
- /package/dist/libs/is/{isSafari.test.d.ts → is-key-exists.test.d.ts} +0 -0
- /package/dist/libs/is/{isProduction.d.ts → is-production.d.ts} +0 -0
- /package/dist/libs/is/{isScrollable.test.d.ts → is-production.test.d.ts} +0 -0
- /package/dist/libs/is/{isSafari.d.ts → is-safari.d.ts} +0 -0
- /package/dist/libs/is/{isTouchSupport.test.d.ts → is-safari.test.d.ts} +0 -0
- /package/dist/libs/is/{isScrollable.cjs.js → is-scrollable.cjs.js} +0 -0
- /package/dist/libs/is/{isScrollable.d.ts → is-scrollable.d.ts} +0 -0
- /package/dist/libs/is/{isScrollable.es.js → is-scrollable.es.js} +0 -0
- /package/dist/libs/{remove/removeAllHtmlTags.test.d.ts → is/is-scrollable.test.d.ts} +0 -0
- /package/dist/libs/is/{isTouchSupport.cjs.js → is-touch-support.cjs.js} +0 -0
- /package/dist/libs/is/{isTouchSupport.d.ts → is-touch-support.d.ts} +0 -0
- /package/dist/libs/is/{isTouchSupport.es.js → is-touch-support.es.js} +0 -0
- /package/dist/libs/{remove/removeAttribute.test.d.ts → is/is-touch-support.test.d.ts} +0 -0
- /package/dist/libs/remove/{removeAllHtmlTags.cjs.js → remove-all-html-tags.cjs.js} +0 -0
- /package/dist/libs/remove/{removeAllHtmlTags.d.ts → remove-all-html-tags.d.ts} +0 -0
- /package/dist/libs/remove/{removeAllHtmlTags.es.js → remove-all-html-tags.es.js} +0 -0
- /package/dist/libs/remove/{removeSessionStorage.test.d.ts → remove-all-html-tags.test.d.ts} +0 -0
- /package/dist/libs/remove/{removeAttribute.cjs.js → remove-attribute.cjs.js} +0 -0
- /package/dist/libs/remove/{removeAttribute.d.ts → remove-attribute.d.ts} +0 -0
- /package/dist/libs/remove/{removeAttribute.es.js → remove-attribute.es.js} +0 -0
- /package/dist/libs/remove/{removeStylePropertyValue.test.d.ts → remove-attribute.test.d.ts} +0 -0
- /package/dist/libs/remove/{removeSessionStorage.cjs.js → remove-session-storage.cjs.js} +0 -0
- /package/dist/libs/remove/{removeSessionStorage.d.ts → remove-session-storage.d.ts} +0 -0
- /package/dist/libs/remove/{removeSessionStorage.es.js → remove-session-storage.es.js} +0 -0
- /package/dist/libs/{security/htmlSanitize.test.d.ts → remove/remove-session-storage.test.d.ts} +0 -0
- /package/dist/libs/remove/{removeStylePropertyValue.cjs.js → remove-style-property-value.cjs.js} +0 -0
- /package/dist/libs/remove/{removeStylePropertyValue.d.ts → remove-style-property-value.d.ts} +0 -0
- /package/dist/libs/remove/{removeStylePropertyValue.es.js → remove-style-property-value.es.js} +0 -0
- /package/dist/libs/{set/set100vh.test.d.ts → remove/remove-style-property-value.test.d.ts} +0 -0
- /package/dist/libs/security/{htmlSanitize.cjs.js → html-sanitize.cjs.js} +0 -0
- /package/dist/libs/security/{htmlSanitize.d.ts → html-sanitize.d.ts} +0 -0
- /package/dist/libs/security/{htmlSanitize.es.js → html-sanitize.es.js} +0 -0
- /package/dist/libs/{set/set100vw.test.d.ts → security/html-sanitize.test.d.ts} +0 -0
- /package/dist/libs/set/{set100vh.cjs.js → set-100vh.cjs.js} +0 -0
- /package/dist/libs/set/{set100vh.d.ts → set-100vh.d.ts} +0 -0
- /package/dist/libs/set/{set100vh.es.js → set-100vh.es.js} +0 -0
- /package/dist/libs/set/{setAttribute.test.d.ts → set-100vh.test.d.ts} +0 -0
- /package/dist/libs/set/{set100vw.cjs.js → set-100vw.cjs.js} +0 -0
- /package/dist/libs/set/{set100vw.d.ts → set-100vw.d.ts} +0 -0
- /package/dist/libs/set/{set100vw.es.js → set-100vw.es.js} +0 -0
- /package/dist/libs/set/{setScrollPositionToCenter.test.d.ts → set-100vw.test.d.ts} +0 -0
- /package/dist/libs/set/{setAttribute.cjs.js → set-attribute.cjs.js} +0 -0
- /package/dist/libs/set/{setAttribute.d.ts → set-attribute.d.ts} +0 -0
- /package/dist/libs/set/{setAttribute.es.js → set-attribute.es.js} +0 -0
- /package/dist/libs/set/{setSessionStorage.test.d.ts → set-attribute.test.d.ts} +0 -0
- /package/dist/libs/set/{setScrollPositionToCenter.cjs.js → set-scroll-position-to-center.cjs.js} +0 -0
- /package/dist/libs/set/{setScrollPositionToCenter.d.ts → set-scroll-position-to-center.d.ts} +0 -0
- /package/dist/libs/set/{setScrollPositionToCenter.es.js → set-scroll-position-to-center.es.js} +0 -0
- /package/dist/libs/set/{setStylePropertyValue.test.d.ts → set-scroll-position-to-center.test.d.ts} +0 -0
- /package/dist/libs/set/{setSessionStorage.cjs.js → set-session-storage.cjs.js} +0 -0
- /package/dist/libs/set/{setSessionStorage.d.ts → set-session-storage.d.ts} +0 -0
- /package/dist/libs/set/{setSessionStorage.es.js → set-session-storage.es.js} +0 -0
- /package/dist/libs/{to/toBoolean.test.d.ts → set/set-session-storage.test.d.ts} +0 -0
- /package/dist/libs/set/{setStylePropertyValue.cjs.js → set-style-property-value.cjs.js} +0 -0
- /package/dist/libs/set/{setStylePropertyValue.d.ts → set-style-property-value.d.ts} +0 -0
- /package/dist/libs/set/{setStylePropertyValue.es.js → set-style-property-value.es.js} +0 -0
- /package/dist/libs/{to/toPositiveNumber.test.d.ts → set/set-style-property-value.test.d.ts} +0 -0
- /package/dist/libs/to/{toBoolean.cjs.js → to-boolean.cjs.js} +0 -0
- /package/dist/libs/to/{toBoolean.d.ts → to-boolean.d.ts} +0 -0
- /package/dist/libs/to/{toBoolean.es.js → to-boolean.es.js} +0 -0
- /package/dist/libs/{transform/wrapTextWithSpans.test.d.ts → to/to-boolean.test.d.ts} +0 -0
- /package/dist/libs/to/{toPositiveNumber.cjs.js → to-positive-number.cjs.js} +0 -0
- /package/dist/libs/to/{toPositiveNumber.d.ts → to-positive-number.d.ts} +0 -0
- /package/dist/libs/to/{toPositiveNumber.es.js → to-positive-number.es.js} +0 -0
- /package/dist/libs/{wait/waitForAllMediaLoaded.test.d.ts → to/to-positive-number.test.d.ts} +0 -0
- /package/dist/libs/transform/{wrapTextWithSpans.cjs.js → wrap-text-with-spans.cjs.js} +0 -0
- /package/dist/libs/transform/{wrapTextWithSpans.d.ts → wrap-text-with-spans.d.ts} +0 -0
- /package/dist/libs/transform/{wrapTextWithSpans.es.js → wrap-text-with-spans.es.js} +0 -0
- /package/dist/libs/wait/{waitForAllMediaLoaded.cjs.js → wait-for-all-media-loaded.cjs.js} +0 -0
- /package/dist/libs/wait/{waitForAllMediaLoaded.d.ts → wait-for-all-media-loaded.d.ts} +0 -0
- /package/dist/libs/wait/{waitForAllMediaLoaded.es.js → wait-for-all-media-loaded.es.js} +0 -0
package/README.md
CHANGED
|
@@ -18,6 +18,18 @@
|
|
|
18
18
|
|
|
19
19
|
Umaki is your one-stop solution for web development utilities, bringing together a carefully curated collection of powerful tools in a single, easy-to-use package. Crafted from real-world development experience, these utilities solve common challenges and streamline your workflow. Have a utility in mind that would make your development easier? Feel free to open an issue—I'm actively expanding this collection!
|
|
20
20
|
|
|
21
|
+
**👨💻 Related Projects**
|
|
22
|
+
|
|
23
|
+
| Project | Description | Use Case |
|
|
24
|
+
| ------------------------------------------------- | --------------------------------------------- | ----------------------------- |
|
|
25
|
+
| [piiiQcy](https://github.com/TsubasaHiga/piiiqcy) | WordPress theme development boilerplate | WordPress site development |
|
|
26
|
+
| [Acty](https://github.com/TsubasaHiga/acty) | Static site boilerplate | Static HTML/CSS site creation |
|
|
27
|
+
| [Quicint](https://github.com/TsubasaHiga/Quicint) | EJS-based static HTML5 boilerplate | Mass-production static pages |
|
|
28
|
+
| [vnl](https://github.com/TsubasaHiga/vnl) | Vite-based npm library development boilerplate | npm package development |
|
|
29
|
+
| [umaki](https://github.com/TsubasaHiga/umaki) | Web development utility library | Common utility functions |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
21
33
|
## Usage
|
|
22
34
|
|
|
23
35
|
```ts
|
|
@@ -64,6 +76,9 @@ console.log(breakpoint); // e.g. 768 (default) or custom value if set
|
|
|
64
76
|
|
|
65
77
|
## List of Utilities
|
|
66
78
|
|
|
79
|
+
- [Callback](#callback)
|
|
80
|
+
- [tap](#tap)
|
|
81
|
+
- [tapAsync](#tapasync)
|
|
67
82
|
- [Control](#control)
|
|
68
83
|
- [bgScrollStop](#bgscrollstop)
|
|
69
84
|
- [pd](#pd)
|
|
@@ -124,6 +139,69 @@ console.log(breakpoint); // e.g. 768 (default) or custom value if set
|
|
|
124
139
|
- [waitForAllMediaLoaded](#waitforallmedialoaded)
|
|
125
140
|
- [Security](#security)
|
|
126
141
|
- [sanitizeHtml](#sanitizehtml)
|
|
142
|
+
- [Advanced Usage](#advanced-usage)
|
|
143
|
+
- [Using tap / tapAsync with umaki functions](#using-tap--tapasync-with-umaki-functions)
|
|
144
|
+
|
|
145
|
+
## Callback
|
|
146
|
+
|
|
147
|
+
### tap
|
|
148
|
+
|
|
149
|
+
A function that executes a callback with the given value and returns the original value unchanged. Useful for performing side effects (logging, caching, analytics, etc.) without modifying the value.
|
|
150
|
+
|
|
151
|
+
**Note:** This function does not accept Promise values. For async operations, use `tapAsync` instead.
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import { tap, removeAllHtmlTags } from "umaki";
|
|
155
|
+
|
|
156
|
+
const input = "<p>Hello <strong>World</strong>!</p>";
|
|
157
|
+
const output = tap(removeAllHtmlTags(input), (result) => {
|
|
158
|
+
console.log("Sanitized:", result);
|
|
159
|
+
});
|
|
160
|
+
// Logs: 'Sanitized: Hello World!'
|
|
161
|
+
// output = 'Hello World!'
|
|
162
|
+
|
|
163
|
+
// Caching example
|
|
164
|
+
const data = tap(processData(raw), (result) => {
|
|
165
|
+
cache.set("processed", result);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
// Works with higher-order functions
|
|
169
|
+
const debouncedFn = tap(debounce(handler, 100), () => {
|
|
170
|
+
console.log("Debounced function created");
|
|
171
|
+
});
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
[View file →](src/libs/callback/tap.ts)
|
|
175
|
+
|
|
176
|
+
### tapAsync (Promise)
|
|
177
|
+
|
|
178
|
+
A function that awaits a Promise, executes a callback with the resolved value, and returns the original value. Useful for performing side effects on async values without modifying them.
|
|
179
|
+
|
|
180
|
+
```ts
|
|
181
|
+
import { tapAsync } from "umaki";
|
|
182
|
+
|
|
183
|
+
// Logging async results
|
|
184
|
+
const data = await tapAsync(fetchData(), (result) => {
|
|
185
|
+
console.log("Fetched:", result);
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
// Caching async results
|
|
189
|
+
const getData = () =>
|
|
190
|
+
tapAsync(fetchFromServer(), (data) => cache.set("data", data));
|
|
191
|
+
|
|
192
|
+
// Parallel execution with individual completion tracking
|
|
193
|
+
await Promise.all([
|
|
194
|
+
tapAsync(fetchUserData(), (user) => console.log("user loaded")),
|
|
195
|
+
tapAsync(fetchProductData(), (products) => console.log("products loaded")),
|
|
196
|
+
tapAsync(fetchOrderData(), (orders) => console.log("orders loaded")),
|
|
197
|
+
]);
|
|
198
|
+
|
|
199
|
+
// Event emission on async completion
|
|
200
|
+
const loadUser = () =>
|
|
201
|
+
tapAsync(fetchUser(), (user) => eventEmitter.emit("userLoaded", user));
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
[View file →](src/libs/callback/tap-async.ts)
|
|
127
205
|
|
|
128
206
|
## Control
|
|
129
207
|
|
|
@@ -916,6 +994,144 @@ This function uses `isomorphic-dompurify` and has the following features:
|
|
|
916
994
|
|
|
917
995
|
[View file →](src/libs/security/htmlSanitize.ts)
|
|
918
996
|
|
|
997
|
+
## Advanced Usage
|
|
998
|
+
|
|
999
|
+
This section provides tips and patterns for getting the most out of umaki utilities.
|
|
1000
|
+
|
|
1001
|
+
### Using `tap` / `tapAsync` with umaki functions
|
|
1002
|
+
|
|
1003
|
+
The `tap` and `tapAsync` functions allow you to add callbacks to any umaki function without modifying its behavior. This is useful for logging, analytics, caching, and more.
|
|
1004
|
+
|
|
1005
|
+
#### Basic Pattern
|
|
1006
|
+
|
|
1007
|
+
| Function Type | Use | Example |
|
|
1008
|
+
|---------------|-----|---------|
|
|
1009
|
+
| Sync (returns value) | `tap` | `tap(removeAllHtmlTags(input), callback)` |
|
|
1010
|
+
| Sync (returns void) | `tap` | `tap(set100vh(), callback)` |
|
|
1011
|
+
| Async (returns Promise) | `tapAsync` | `tapAsync(sleep(1), callback)` |
|
|
1012
|
+
|
|
1013
|
+
> [!TIP]
|
|
1014
|
+
> `tap` prevents Promise values at the type level. If you accidentally pass a Promise, TypeScript will show an error.
|
|
1015
|
+
|
|
1016
|
+
#### Examples with umaki functions
|
|
1017
|
+
|
|
1018
|
+
<details>
|
|
1019
|
+
<summary><strong>📝 Logging & Debugging</strong></summary>
|
|
1020
|
+
|
|
1021
|
+
```ts
|
|
1022
|
+
import { tap, removeAllHtmlTags, getUaData } from "umaki";
|
|
1023
|
+
|
|
1024
|
+
// Log sanitized HTML output
|
|
1025
|
+
const clean = tap(removeAllHtmlTags(dirtyHtml), (result) => {
|
|
1026
|
+
console.log("[DEBUG] Sanitized HTML:", result);
|
|
1027
|
+
});
|
|
1028
|
+
|
|
1029
|
+
// Log user agent data
|
|
1030
|
+
const ua = tap(getUaData(), (data) => {
|
|
1031
|
+
console.log("[DEBUG] UA:", data.browserName, data.osName);
|
|
1032
|
+
});
|
|
1033
|
+
```
|
|
1034
|
+
|
|
1035
|
+
</details>
|
|
1036
|
+
|
|
1037
|
+
<details>
|
|
1038
|
+
<summary><strong>📊 Analytics & Tracking</strong></summary>
|
|
1039
|
+
|
|
1040
|
+
```ts
|
|
1041
|
+
import { tap, tapAsync, getUaData, waitForAllMediaLoaded } from "umaki";
|
|
1042
|
+
|
|
1043
|
+
// Track device information
|
|
1044
|
+
const uaData = tap(getUaData(), (data) => {
|
|
1045
|
+
analytics.track("device_detected", {
|
|
1046
|
+
browser: data.browserName,
|
|
1047
|
+
os: data.osName,
|
|
1048
|
+
type: data.type,
|
|
1049
|
+
});
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
// Track media load completion
|
|
1053
|
+
await tapAsync(waitForAllMediaLoaded(), (success) => {
|
|
1054
|
+
analytics.track("media_loaded", { success, timestamp: Date.now() });
|
|
1055
|
+
});
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
</details>
|
|
1059
|
+
|
|
1060
|
+
<details>
|
|
1061
|
+
<summary><strong>💾 Caching</strong></summary>
|
|
1062
|
+
|
|
1063
|
+
```ts
|
|
1064
|
+
import { tap, tapAsync, getScrollbarWidth } from "umaki";
|
|
1065
|
+
|
|
1066
|
+
// Cache scrollbar width (useful for repeated access)
|
|
1067
|
+
const scrollbarWidth = tap(getScrollbarWidth(), (width) => {
|
|
1068
|
+
sessionStorage.setItem("scrollbarWidth", String(width));
|
|
1069
|
+
});
|
|
1070
|
+
|
|
1071
|
+
// Cache async fetch results
|
|
1072
|
+
const getData = () =>
|
|
1073
|
+
tapAsync(fetchFromAPI(), (data) => {
|
|
1074
|
+
localStorage.setItem("cachedData", JSON.stringify(data));
|
|
1075
|
+
});
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
</details>
|
|
1079
|
+
|
|
1080
|
+
<details>
|
|
1081
|
+
<summary><strong>🎯 Event Emission</strong></summary>
|
|
1082
|
+
|
|
1083
|
+
```ts
|
|
1084
|
+
import { tap, tapAsync, checkDeviceSize, waitForAllMediaLoaded } from "umaki";
|
|
1085
|
+
|
|
1086
|
+
// Emit event on device size check
|
|
1087
|
+
const deviceSize = tap(checkDeviceSize(), (size) => {
|
|
1088
|
+
window.dispatchEvent(new CustomEvent("deviceSizeChecked", { detail: size }));
|
|
1089
|
+
});
|
|
1090
|
+
|
|
1091
|
+
// Emit event when all media is loaded
|
|
1092
|
+
await tapAsync(waitForAllMediaLoaded(true), () => {
|
|
1093
|
+
window.dispatchEvent(new CustomEvent("firstViewMediaReady"));
|
|
1094
|
+
});
|
|
1095
|
+
```
|
|
1096
|
+
|
|
1097
|
+
</details>
|
|
1098
|
+
|
|
1099
|
+
<details>
|
|
1100
|
+
<summary><strong>⚡ Parallel Async Operations</strong></summary>
|
|
1101
|
+
|
|
1102
|
+
```ts
|
|
1103
|
+
import { tapAsync, sleep, waitForAllMediaLoaded } from "umaki";
|
|
1104
|
+
|
|
1105
|
+
// Track multiple async operations independently
|
|
1106
|
+
const [_, mediaLoaded] = await Promise.all([
|
|
1107
|
+
tapAsync(sleep(1), () => console.log("⏱️ 1 second elapsed")),
|
|
1108
|
+
tapAsync(waitForAllMediaLoaded(), (ok) => console.log("🖼️ Media:", ok ? "ready" : "failed")),
|
|
1109
|
+
]);
|
|
1110
|
+
```
|
|
1111
|
+
|
|
1112
|
+
</details>
|
|
1113
|
+
|
|
1114
|
+
#### Working with void functions
|
|
1115
|
+
|
|
1116
|
+
> [!NOTE]
|
|
1117
|
+
> When using `tap` with functions that return `void` (like `set100vh`, `bgScrollStop`), the callback receives `undefined`. This is still useful for completion notifications.
|
|
1118
|
+
|
|
1119
|
+
```ts
|
|
1120
|
+
import { tap, set100vh, bgScrollStop } from "umaki";
|
|
1121
|
+
|
|
1122
|
+
// Notification when viewport units are set
|
|
1123
|
+
tap(set100vh(), () => {
|
|
1124
|
+
console.log("✅ 100vh CSS variable has been set");
|
|
1125
|
+
});
|
|
1126
|
+
|
|
1127
|
+
// Notification when scroll is stopped
|
|
1128
|
+
tap(bgScrollStop(true), () => {
|
|
1129
|
+
console.log("🔒 Background scroll locked");
|
|
1130
|
+
});
|
|
1131
|
+
```
|
|
1132
|
+
|
|
1133
|
+
---
|
|
1134
|
+
|
|
919
1135
|
## Using for framework and tools
|
|
920
1136
|
|
|
921
1137
|
Specific usage for frameworks or various tools is described below.
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,57 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
3
|
+
const tap = require("./libs/callback/tap.cjs.js");
|
|
4
|
+
const tapAsync = require("./libs/callback/tap-async.cjs.js");
|
|
5
|
+
const defaultConfig = require("./libs/config/default-config.cjs.js");
|
|
6
|
+
const getConfig = require("./libs/config/get-config.cjs.js");
|
|
7
|
+
const setConfig = require("./libs/config/set-config.cjs.js");
|
|
8
|
+
const bgScrollStop = require("./libs/control/bg-scroll-stop.cjs.js");
|
|
7
9
|
const pd = require("./libs/control/pd.cjs.js");
|
|
8
|
-
const scrollToHash = require("./libs/control/
|
|
9
|
-
const videoPlayControl = require("./libs/control/
|
|
10
|
-
const changeDateStringToSpecificFormat = require("./libs/convert/
|
|
11
|
-
const jsonStringToJsonObject = require("./libs/convert/
|
|
10
|
+
const scrollToHash = require("./libs/control/scroll-to-hash.cjs.js");
|
|
11
|
+
const videoPlayControl = require("./libs/control/video-play-control.cjs.js");
|
|
12
|
+
const changeDateStringToSpecificFormat = require("./libs/convert/change-date-string-to-specific-format.cjs.js");
|
|
13
|
+
const jsonStringToJsonObject = require("./libs/convert/json-string-to-json-object.cjs.js");
|
|
12
14
|
const debounce = require("./libs/eventControl/debounce.cjs.js");
|
|
13
15
|
const throttle = require("./libs/eventControl/throttle.cjs.js");
|
|
14
|
-
const getAspectRatio = require("./libs/get/
|
|
15
|
-
const getClassNames = require("./libs/get/
|
|
16
|
-
const getDocumentHeight = require("./libs/get/
|
|
17
|
-
const getEventPaths = require("./libs/get/
|
|
18
|
-
const getGcd = require("./libs/get/
|
|
19
|
-
const getGravatarUrl = require("./libs/get/
|
|
20
|
-
const getOrientation = require("./libs/get/
|
|
21
|
-
const getParentList = require("./libs/get/
|
|
22
|
-
const getQueryParams = require("./libs/get/
|
|
23
|
-
const getRem = require("./libs/get/
|
|
24
|
-
const getScrollbarWidth = require("./libs/get/
|
|
25
|
-
const getSessionStorage = require("./libs/get/
|
|
26
|
-
const getStringLength = require("./libs/get/
|
|
27
|
-
const getStylePropertyValue = require("./libs/get/
|
|
28
|
-
const getStylePropertyValueToNumber = require("./libs/get/
|
|
29
|
-
const getUaData = require("./libs/get/
|
|
30
|
-
const checkDeviceSize = require("./libs/is/
|
|
31
|
-
const isAfterDateTime = require("./libs/is/
|
|
32
|
-
const isBetweenDateTime = require("./libs/is/
|
|
33
|
-
const isExistAllElements = require("./libs/is/
|
|
34
|
-
const isIpad = require("./libs/is/
|
|
35
|
-
const isKeyExists = require("./libs/is/
|
|
36
|
-
const isSafari = require("./libs/is/
|
|
37
|
-
const isScrollable = require("./libs/is/
|
|
38
|
-
const isTouchSupport = require("./libs/is/
|
|
39
|
-
const removeAllHtmlTags = require("./libs/remove/
|
|
40
|
-
const removeAttribute = require("./libs/remove/
|
|
41
|
-
const removeSessionStorage = require("./libs/remove/
|
|
42
|
-
const removeStylePropertyValue = require("./libs/remove/
|
|
43
|
-
const htmlSanitize = require("./libs/security/
|
|
44
|
-
const set100vh = require("./libs/set/
|
|
45
|
-
const set100vw = require("./libs/set/
|
|
46
|
-
const setAttribute = require("./libs/set/
|
|
47
|
-
const setScrollPositionToCenter = require("./libs/set/
|
|
48
|
-
const setSessionStorage = require("./libs/set/
|
|
49
|
-
const setStylePropertyValue = require("./libs/set/
|
|
50
|
-
const toBoolean = require("./libs/to/
|
|
51
|
-
const toPositiveNumber = require("./libs/to/
|
|
52
|
-
const wrapTextWithSpans = require("./libs/transform/
|
|
16
|
+
const getAspectRatio = require("./libs/get/get-aspect-ratio.cjs.js");
|
|
17
|
+
const getClassNames = require("./libs/get/get-class-names.cjs.js");
|
|
18
|
+
const getDocumentHeight = require("./libs/get/get-document-height.cjs.js");
|
|
19
|
+
const getEventPaths = require("./libs/get/get-event-paths.cjs.js");
|
|
20
|
+
const getGcd = require("./libs/get/get-gcd.cjs.js");
|
|
21
|
+
const getGravatarUrl = require("./libs/get/get-gravatar-url.cjs.js");
|
|
22
|
+
const getOrientation = require("./libs/get/get-orientation.cjs.js");
|
|
23
|
+
const getParentList = require("./libs/get/get-parent-list.cjs.js");
|
|
24
|
+
const getQueryParams = require("./libs/get/get-query-params.cjs.js");
|
|
25
|
+
const getRem = require("./libs/get/get-rem.cjs.js");
|
|
26
|
+
const getScrollbarWidth = require("./libs/get/get-scrollbar-width.cjs.js");
|
|
27
|
+
const getSessionStorage = require("./libs/get/get-session-storage.cjs.js");
|
|
28
|
+
const getStringLength = require("./libs/get/get-string-length.cjs.js");
|
|
29
|
+
const getStylePropertyValue = require("./libs/get/get-style-property-value.cjs.js");
|
|
30
|
+
const getStylePropertyValueToNumber = require("./libs/get/get-style-property-value-to-number.cjs.js");
|
|
31
|
+
const getUaData = require("./libs/get/get-ua-data.cjs.js");
|
|
32
|
+
const checkDeviceSize = require("./libs/is/check-device-size.cjs.js");
|
|
33
|
+
const isAfterDateTime = require("./libs/is/is-after-date-time.cjs.js");
|
|
34
|
+
const isBetweenDateTime = require("./libs/is/is-between-date-time.cjs.js");
|
|
35
|
+
const isExistAllElements = require("./libs/is/is-exist-all-elements.cjs.js");
|
|
36
|
+
const isIpad = require("./libs/is/is-ipad.cjs.js");
|
|
37
|
+
const isKeyExists = require("./libs/is/is-key-exists.cjs.js");
|
|
38
|
+
const isSafari = require("./libs/is/is-safari.cjs.js");
|
|
39
|
+
const isScrollable = require("./libs/is/is-scrollable.cjs.js");
|
|
40
|
+
const isTouchSupport = require("./libs/is/is-touch-support.cjs.js");
|
|
41
|
+
const removeAllHtmlTags = require("./libs/remove/remove-all-html-tags.cjs.js");
|
|
42
|
+
const removeAttribute = require("./libs/remove/remove-attribute.cjs.js");
|
|
43
|
+
const removeSessionStorage = require("./libs/remove/remove-session-storage.cjs.js");
|
|
44
|
+
const removeStylePropertyValue = require("./libs/remove/remove-style-property-value.cjs.js");
|
|
45
|
+
const htmlSanitize = require("./libs/security/html-sanitize.cjs.js");
|
|
46
|
+
const set100vh = require("./libs/set/set-100vh.cjs.js");
|
|
47
|
+
const set100vw = require("./libs/set/set-100vw.cjs.js");
|
|
48
|
+
const setAttribute = require("./libs/set/set-attribute.cjs.js");
|
|
49
|
+
const setScrollPositionToCenter = require("./libs/set/set-scroll-position-to-center.cjs.js");
|
|
50
|
+
const setSessionStorage = require("./libs/set/set-session-storage.cjs.js");
|
|
51
|
+
const setStylePropertyValue = require("./libs/set/set-style-property-value.cjs.js");
|
|
52
|
+
const toBoolean = require("./libs/to/to-boolean.cjs.js");
|
|
53
|
+
const toPositiveNumber = require("./libs/to/to-positive-number.cjs.js");
|
|
54
|
+
const wrapTextWithSpans = require("./libs/transform/wrap-text-with-spans.cjs.js");
|
|
53
55
|
const sleep = require("./libs/wait/sleep.cjs.js");
|
|
54
|
-
const waitForAllMediaLoaded = require("./libs/wait/
|
|
56
|
+
const waitForAllMediaLoaded = require("./libs/wait/wait-for-all-media-loaded.cjs.js");
|
|
57
|
+
exports.tap = tap.tap;
|
|
58
|
+
exports.tapAsync = tapAsync.tapAsync;
|
|
55
59
|
exports.defaultConfig = defaultConfig.defaultConfig;
|
|
56
60
|
exports.getConfig = getConfig.getConfig;
|
|
57
61
|
exports.getConfigValue = getConfig.getConfigValue;
|
package/dist/index.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,55 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { tap } from "./libs/callback/tap.es.js";
|
|
2
|
+
import { tapAsync } from "./libs/callback/tap-async.es.js";
|
|
3
|
+
import { defaultConfig } from "./libs/config/default-config.es.js";
|
|
4
|
+
import { getConfig, getConfigValue } from "./libs/config/get-config.es.js";
|
|
5
|
+
import { setConfig } from "./libs/config/set-config.es.js";
|
|
6
|
+
import { bgScrollStop } from "./libs/control/bg-scroll-stop.es.js";
|
|
5
7
|
import { pd } from "./libs/control/pd.es.js";
|
|
6
|
-
import { scrollToHash } from "./libs/control/
|
|
7
|
-
import { videoPlayControl } from "./libs/control/
|
|
8
|
-
import { changeDateStringToSpecificFormat } from "./libs/convert/
|
|
9
|
-
import { jsonStringToJsonObject } from "./libs/convert/
|
|
8
|
+
import { scrollToHash } from "./libs/control/scroll-to-hash.es.js";
|
|
9
|
+
import { videoPlayControl } from "./libs/control/video-play-control.es.js";
|
|
10
|
+
import { changeDateStringToSpecificFormat } from "./libs/convert/change-date-string-to-specific-format.es.js";
|
|
11
|
+
import { jsonStringToJsonObject } from "./libs/convert/json-string-to-json-object.es.js";
|
|
10
12
|
import { debounce } from "./libs/eventControl/debounce.es.js";
|
|
11
13
|
import { throttle } from "./libs/eventControl/throttle.es.js";
|
|
12
|
-
import { getAspectRatio } from "./libs/get/
|
|
13
|
-
import { getClassNames } from "./libs/get/
|
|
14
|
-
import { getDocumentHeight } from "./libs/get/
|
|
15
|
-
import { getEventPaths } from "./libs/get/
|
|
16
|
-
import { getGcd } from "./libs/get/
|
|
17
|
-
import { getGravatarUrl } from "./libs/get/
|
|
18
|
-
import { getOrientation } from "./libs/get/
|
|
19
|
-
import { getParentList } from "./libs/get/
|
|
20
|
-
import { getQueryParams } from "./libs/get/
|
|
21
|
-
import { getRem } from "./libs/get/
|
|
22
|
-
import { getScrollbarWidth } from "./libs/get/
|
|
23
|
-
import { getSessionStorage } from "./libs/get/
|
|
24
|
-
import { getStringLength } from "./libs/get/
|
|
25
|
-
import { getStylePropertyValue } from "./libs/get/
|
|
26
|
-
import { getStylePropertyValueToNumber } from "./libs/get/
|
|
27
|
-
import { getUaData } from "./libs/get/
|
|
28
|
-
import { checkDeviceSize } from "./libs/is/
|
|
29
|
-
import { isAfterDateTime } from "./libs/is/
|
|
30
|
-
import { isBetweenDateTime } from "./libs/is/
|
|
31
|
-
import { isExistAllElements } from "./libs/is/
|
|
32
|
-
import { isIpad } from "./libs/is/
|
|
33
|
-
import { isKeyExists } from "./libs/is/
|
|
34
|
-
import { isSafari } from "./libs/is/
|
|
35
|
-
import { isScrollable } from "./libs/is/
|
|
36
|
-
import { isTouchSupport } from "./libs/is/
|
|
37
|
-
import { removeAllHtmlTags } from "./libs/remove/
|
|
38
|
-
import { removeAttribute } from "./libs/remove/
|
|
39
|
-
import { removeSessionStorage } from "./libs/remove/
|
|
40
|
-
import { removeStylePropertyValue } from "./libs/remove/
|
|
41
|
-
import { htmlSanitize } from "./libs/security/
|
|
42
|
-
import { set100vh } from "./libs/set/
|
|
43
|
-
import { set100vw } from "./libs/set/
|
|
44
|
-
import { setAttribute } from "./libs/set/
|
|
45
|
-
import { setScrollPositionToCenter } from "./libs/set/
|
|
46
|
-
import { setSessionStorage } from "./libs/set/
|
|
47
|
-
import { setStylePropertyValue } from "./libs/set/
|
|
48
|
-
import { toBoolean } from "./libs/to/
|
|
49
|
-
import { toPositiveNumber } from "./libs/to/
|
|
50
|
-
import { wrapTextWithSpans } from "./libs/transform/
|
|
14
|
+
import { getAspectRatio } from "./libs/get/get-aspect-ratio.es.js";
|
|
15
|
+
import { getClassNames } from "./libs/get/get-class-names.es.js";
|
|
16
|
+
import { getDocumentHeight } from "./libs/get/get-document-height.es.js";
|
|
17
|
+
import { getEventPaths } from "./libs/get/get-event-paths.es.js";
|
|
18
|
+
import { getGcd } from "./libs/get/get-gcd.es.js";
|
|
19
|
+
import { getGravatarUrl } from "./libs/get/get-gravatar-url.es.js";
|
|
20
|
+
import { getOrientation } from "./libs/get/get-orientation.es.js";
|
|
21
|
+
import { getParentList } from "./libs/get/get-parent-list.es.js";
|
|
22
|
+
import { getQueryParams } from "./libs/get/get-query-params.es.js";
|
|
23
|
+
import { getRem } from "./libs/get/get-rem.es.js";
|
|
24
|
+
import { getScrollbarWidth } from "./libs/get/get-scrollbar-width.es.js";
|
|
25
|
+
import { getSessionStorage } from "./libs/get/get-session-storage.es.js";
|
|
26
|
+
import { getStringLength } from "./libs/get/get-string-length.es.js";
|
|
27
|
+
import { getStylePropertyValue } from "./libs/get/get-style-property-value.es.js";
|
|
28
|
+
import { getStylePropertyValueToNumber } from "./libs/get/get-style-property-value-to-number.es.js";
|
|
29
|
+
import { getUaData } from "./libs/get/get-ua-data.es.js";
|
|
30
|
+
import { checkDeviceSize } from "./libs/is/check-device-size.es.js";
|
|
31
|
+
import { isAfterDateTime } from "./libs/is/is-after-date-time.es.js";
|
|
32
|
+
import { isBetweenDateTime } from "./libs/is/is-between-date-time.es.js";
|
|
33
|
+
import { isExistAllElements } from "./libs/is/is-exist-all-elements.es.js";
|
|
34
|
+
import { isIpad } from "./libs/is/is-ipad.es.js";
|
|
35
|
+
import { isKeyExists } from "./libs/is/is-key-exists.es.js";
|
|
36
|
+
import { isSafari } from "./libs/is/is-safari.es.js";
|
|
37
|
+
import { isScrollable } from "./libs/is/is-scrollable.es.js";
|
|
38
|
+
import { isTouchSupport } from "./libs/is/is-touch-support.es.js";
|
|
39
|
+
import { removeAllHtmlTags } from "./libs/remove/remove-all-html-tags.es.js";
|
|
40
|
+
import { removeAttribute } from "./libs/remove/remove-attribute.es.js";
|
|
41
|
+
import { removeSessionStorage } from "./libs/remove/remove-session-storage.es.js";
|
|
42
|
+
import { removeStylePropertyValue } from "./libs/remove/remove-style-property-value.es.js";
|
|
43
|
+
import { htmlSanitize } from "./libs/security/html-sanitize.es.js";
|
|
44
|
+
import { set100vh } from "./libs/set/set-100vh.es.js";
|
|
45
|
+
import { set100vw } from "./libs/set/set-100vw.es.js";
|
|
46
|
+
import { setAttribute } from "./libs/set/set-attribute.es.js";
|
|
47
|
+
import { setScrollPositionToCenter } from "./libs/set/set-scroll-position-to-center.es.js";
|
|
48
|
+
import { setSessionStorage } from "./libs/set/set-session-storage.es.js";
|
|
49
|
+
import { setStylePropertyValue } from "./libs/set/set-style-property-value.es.js";
|
|
50
|
+
import { toBoolean } from "./libs/to/to-boolean.es.js";
|
|
51
|
+
import { toPositiveNumber } from "./libs/to/to-positive-number.es.js";
|
|
52
|
+
import { wrapTextWithSpans } from "./libs/transform/wrap-text-with-spans.es.js";
|
|
51
53
|
import { sleep } from "./libs/wait/sleep.es.js";
|
|
52
|
-
import { waitForAllMediaLoaded } from "./libs/wait/
|
|
54
|
+
import { waitForAllMediaLoaded } from "./libs/wait/wait-for-all-media-loaded.es.js";
|
|
53
55
|
export {
|
|
54
56
|
bgScrollStop,
|
|
55
57
|
changeDateStringToSpecificFormat,
|
|
@@ -98,6 +100,8 @@ export {
|
|
|
98
100
|
setSessionStorage,
|
|
99
101
|
setStylePropertyValue,
|
|
100
102
|
sleep,
|
|
103
|
+
tap,
|
|
104
|
+
tapAsync,
|
|
101
105
|
throttle,
|
|
102
106
|
toBoolean,
|
|
103
107
|
toPositiveNumber,
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Awaits a Promise, executes a callback with the resolved value, and returns the original value.
|
|
3
|
+
* Useful for performing side effects (logging, caching, analytics, etc.) on async values without modifying them.
|
|
4
|
+
*
|
|
5
|
+
* @param promise - The Promise to await.
|
|
6
|
+
* @param callback - A function that receives the resolved value. Its return value is ignored.
|
|
7
|
+
* @returns A Promise that resolves to the original value.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* import { tapAsync } from 'umaki'
|
|
12
|
+
*
|
|
13
|
+
* // Logging async results
|
|
14
|
+
* const data = await tapAsync(fetchData(), (result) => {
|
|
15
|
+
* console.log('Fetched:', result)
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* // Caching async results
|
|
22
|
+
* const getData = () => tapAsync(
|
|
23
|
+
* fetchFromServer(),
|
|
24
|
+
* (data) => cache.set('data', data)
|
|
25
|
+
* )
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* // Parallel execution with individual completion tracking
|
|
31
|
+
* await Promise.all([
|
|
32
|
+
* tapAsync(fetchUserData(), (user) => console.log('user loaded')),
|
|
33
|
+
* tapAsync(fetchProductData(), (products) => console.log('products loaded')),
|
|
34
|
+
* tapAsync(fetchOrderData(), (orders) => console.log('orders loaded'))
|
|
35
|
+
* ])
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* // Event emission on async completion
|
|
41
|
+
* const loadUser = () => tapAsync(
|
|
42
|
+
* fetchUser(),
|
|
43
|
+
* (user) => eventEmitter.emit('userLoaded', user)
|
|
44
|
+
* )
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare const tapAsync: <T>(promise: Promise<T>, callback: (value: T) => void) => Promise<T>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type that excludes Promise types.
|
|
3
|
+
* Used to prevent passing async values to synchronous tap function.
|
|
4
|
+
*/
|
|
5
|
+
type NotPromise<T> = T extends Promise<unknown> ? never : T;
|
|
6
|
+
/**
|
|
7
|
+
* Executes a callback with the given value and returns the original value unchanged.
|
|
8
|
+
* Useful for performing side effects (logging, analytics, etc.) in a pipeline without modifying the value.
|
|
9
|
+
*
|
|
10
|
+
* @param value - The value to pass to the callback. Must not be a Promise (use tapAsync for async values).
|
|
11
|
+
* @param callback - A function that receives the value. Its return value is ignored.
|
|
12
|
+
* @returns The original value unchanged.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { tap, removeAllHtmlTags } from 'umaki'
|
|
17
|
+
*
|
|
18
|
+
* const input = '<p>Hello <strong>World</strong>!</p>'
|
|
19
|
+
* const output = tap(removeAllHtmlTags(input), (result) => {
|
|
20
|
+
* console.log('Sanitized:', result)
|
|
21
|
+
* })
|
|
22
|
+
* // Logs: 'Sanitized: Hello World!'
|
|
23
|
+
* // output = 'Hello World!'
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* // Caching example
|
|
29
|
+
* const data = tap(processData(raw), (result) => {
|
|
30
|
+
* cache.set('processed', result)
|
|
31
|
+
* })
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export declare const tap: <T>(value: NotPromise<T>, callback: (value: T) => void) => T;
|
|
35
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const defaultConfig = require("./
|
|
3
|
+
const defaultConfig = require("./default-config.cjs.js");
|
|
4
4
|
const currentConfig = { ...defaultConfig.defaultConfig };
|
|
5
5
|
const getConfig = () => {
|
|
6
6
|
return { ...currentConfig };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Configuration functions
|
|
3
3
|
*/
|
|
4
|
-
export { defaultConfig } from './
|
|
5
|
-
export { getConfig, getConfigValue } from './
|
|
6
|
-
export { setConfig } from './
|
|
4
|
+
export { defaultConfig } from './default-config';
|
|
5
|
+
export { getConfig, getConfigValue } from './get-config';
|
|
6
|
+
export { setConfig } from './set-config';
|
|
7
7
|
export type { UmakiConfig } from './types';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const getConfig = require("./
|
|
3
|
+
const getConfig = require("./get-config.cjs.js");
|
|
4
4
|
const setConfig = (config) => {
|
|
5
5
|
Object.assign(getConfig.currentConfig, config);
|
|
6
6
|
return { ...getConfig.currentConfig };
|