umaki 0.2.4 → 0.2.6

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.
Files changed (97) hide show
  1. package/README.md +193 -79
  2. package/dist/LICENSE.txt +32 -0
  3. package/dist/_virtual/_commonjsHelpers.cjs.js +19 -1
  4. package/dist/_virtual/_commonjsHelpers.es.js +16 -5
  5. package/dist/_virtual/isBetween.cjs.js +15 -1
  6. package/dist/_virtual/isBetween.es.js +13 -2
  7. package/dist/index.cjs.js +99 -1
  8. package/dist/index.es.js +97 -86
  9. package/dist/libs/control/bgScrollStop.cjs.js +24 -1
  10. package/dist/libs/control/bgScrollStop.es.js +21 -4
  11. package/dist/libs/control/pd.cjs.js +15 -1
  12. package/dist/libs/control/pd.es.js +13 -2
  13. package/dist/libs/control/scrollToHash.cjs.js +47 -1
  14. package/dist/libs/control/scrollToHash.es.js +42 -16
  15. package/dist/libs/control/videoPlayControl.cjs.js +33 -1
  16. package/dist/libs/control/videoPlayControl.es.js +27 -10
  17. package/dist/libs/convert/changeDateStringToSpecificFormat.cjs.js +16 -1
  18. package/dist/libs/convert/changeDateStringToSpecificFormat.es.js +14 -3
  19. package/dist/libs/convert/jsonStringToJsonObject.cjs.js +20 -1
  20. package/dist/libs/convert/jsonStringToJsonObject.es.js +15 -4
  21. package/dist/libs/get/getAspectRatio.cjs.js +19 -1
  22. package/dist/libs/get/getAspectRatio.es.js +16 -5
  23. package/dist/libs/get/getClassNames.cjs.js +18 -1
  24. package/dist/libs/get/getClassNames.es.js +16 -2
  25. package/dist/libs/get/getDocumentHeight.cjs.js +15 -1
  26. package/dist/libs/get/getDocumentHeight.es.js +13 -2
  27. package/dist/libs/get/getEventPaths.cjs.js +35 -1
  28. package/dist/libs/get/getEventPaths.es.js +30 -12
  29. package/dist/libs/get/getGcd.cjs.js +21 -1
  30. package/dist/libs/get/getGcd.es.js +18 -5
  31. package/dist/libs/get/getOrientation.cjs.js +18 -1
  32. package/dist/libs/get/getOrientation.es.js +16 -2
  33. package/dist/libs/get/getParentList.cjs.js +19 -1
  34. package/dist/libs/get/getParentList.es.js +16 -4
  35. package/dist/libs/get/getQueryParams.cjs.js +30 -1
  36. package/dist/libs/get/getQueryParams.es.js +26 -12
  37. package/dist/libs/get/getRem.cjs.js +18 -1
  38. package/dist/libs/get/getRem.es.js +16 -2
  39. package/dist/libs/get/getScrollbarWidth.cjs.js +15 -1
  40. package/dist/libs/get/getScrollbarWidth.es.js +13 -2
  41. package/dist/libs/get/getSessionStorage.cjs.js +20 -1
  42. package/dist/libs/get/getSessionStorage.es.js +17 -5
  43. package/dist/libs/get/getStringLength.cjs.js +16 -1
  44. package/dist/libs/get/getStringLength.es.js +14 -3
  45. package/dist/libs/get/getStylePropertyValue.cjs.js +15 -1
  46. package/dist/libs/get/getStylePropertyValue.es.js +13 -2
  47. package/dist/libs/get/getStylePropertyValueToNumber.cjs.js +16 -1
  48. package/dist/libs/get/getStylePropertyValueToNumber.es.js +14 -3
  49. package/dist/libs/get/getUaData.cjs.js +34 -1
  50. package/dist/libs/get/getUaData.es.js +30 -12
  51. package/dist/libs/is/isBetweenDateTime.cjs.js +25 -1
  52. package/dist/libs/is/isBetweenDateTime.es.js +21 -8
  53. package/dist/libs/is/isExistAllElements.cjs.js +17 -1
  54. package/dist/libs/is/isExistAllElements.es.js +15 -2
  55. package/dist/libs/is/isIpad.cjs.js +21 -1
  56. package/dist/libs/is/isIpad.es.js +18 -6
  57. package/dist/libs/is/isKeyExists.cjs.js +17 -1
  58. package/dist/libs/is/isKeyExists.es.js +15 -2
  59. package/dist/libs/is/isSafari.cjs.js +22 -1
  60. package/dist/libs/is/isSafari.es.js +19 -5
  61. package/dist/libs/is/isScrollable.cjs.js +19 -1
  62. package/dist/libs/is/isScrollable.es.js +16 -4
  63. package/dist/libs/is/isTouchSupport.cjs.js +16 -1
  64. package/dist/libs/is/isTouchSupport.es.js +14 -3
  65. package/dist/libs/remove/removeAllHtmlTags.cjs.js +23 -1
  66. package/dist/libs/remove/removeAllHtmlTags.es.js +21 -7
  67. package/dist/libs/remove/removeAttribute.cjs.js +17 -1
  68. package/dist/libs/remove/removeAttribute.es.js +14 -3
  69. package/dist/libs/remove/removeSessionStorage.cjs.js +18 -1
  70. package/dist/libs/remove/removeSessionStorage.es.js +15 -4
  71. package/dist/libs/remove/removeStylePropertyValue.cjs.js +17 -1
  72. package/dist/libs/remove/removeStylePropertyValue.es.js +14 -3
  73. package/dist/libs/set/set100vh.cjs.js +18 -1
  74. package/dist/libs/set/set100vh.es.js +15 -4
  75. package/dist/libs/set/set100vw.cjs.js +18 -1
  76. package/dist/libs/set/set100vw.es.js +15 -4
  77. package/dist/libs/set/setAttribute.cjs.js +17 -1
  78. package/dist/libs/set/setAttribute.es.js +14 -3
  79. package/dist/libs/set/setScrollPositionToCenter.cjs.js +21 -1
  80. package/dist/libs/set/setScrollPositionToCenter.es.js +18 -4
  81. package/dist/libs/set/setSessionStorage.cjs.js +18 -1
  82. package/dist/libs/set/setSessionStorage.es.js +15 -4
  83. package/dist/libs/set/setStylePropertyValue.cjs.js +17 -1
  84. package/dist/libs/set/setStylePropertyValue.es.js +14 -3
  85. package/dist/libs/to/toBoolean.cjs.js +17 -1
  86. package/dist/libs/to/toBoolean.es.js +15 -2
  87. package/dist/libs/to/toPositiveNumber.cjs.js +15 -1
  88. package/dist/libs/to/toPositiveNumber.es.js +13 -2
  89. package/dist/libs/transform/wrapTextWithSpans.cjs.js +31 -1
  90. package/dist/libs/transform/wrapTextWithSpans.es.js +27 -13
  91. package/dist/libs/wait/sleep.cjs.js +17 -1
  92. package/dist/libs/wait/sleep.es.js +15 -2
  93. package/dist/libs/wait/waitForAllMediaLoaded.cjs.js +55 -1
  94. package/dist/libs/wait/waitForAllMediaLoaded.es.js +47 -20
  95. package/dist/node_modules/dayjs/plugin/isBetween.cjs.js +30 -1
  96. package/dist/node_modules/dayjs/plugin/isBetween.es.js +25 -14
  97. package/package.json +2 -1
@@ -1 +1,55 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=async(o=!1)=>{if(!document.images||document.images.length===0)return Promise.resolve(!0);const i=Array.from(document.images).filter(e=>e.getAttribute("loading")!=="lazy"),s=Array.from(document.getElementsByTagName("video"));let r=[...i,...s];if(o){const e=window.innerHeight;r=r.filter(n=>{const t=n.getBoundingClientRect();return t.top<e&&t.bottom>0})}return r.length===0?Promise.resolve(!0):(await Promise.all(r.map(e=>e instanceof HTMLImageElement&&e.complete||e instanceof HTMLVideoElement&&e.readyState>=3?Promise.resolve():new Promise(n=>{const t=()=>n();e instanceof HTMLImageElement?(e.addEventListener("load",t,{once:!0}),e.addEventListener("error",t,{once:!0})):e instanceof HTMLVideoElement&&(e.addEventListener("loadeddata",t,{once:!0}),e.addEventListener("error",t,{once:!0}))}))),!0)};exports.waitForAllMediaLoaded=l;
1
+ "use strict";
2
+ /*!
3
+ * name: umaki
4
+ * version: v0.2.6
5
+ * description: A utility that is often used in web production.
6
+ * author: TsubasaHiga
7
+ * homepage: https://github.com/TsubasaHiga/umaki
8
+ * Released under the MIT License
9
+ *
10
+ * This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
11
+ * For license information, please see LICENSE.txt
12
+ */
13
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
14
+ const waitForAllMediaLoaded = async (firstViewOnly = false) => {
15
+ if (!document.images) return Promise.resolve(true);
16
+ if (document.images.length === 0) return Promise.resolve(true);
17
+ const images = Array.from(document.images).filter(
18
+ (img) => img.getAttribute("loading") !== "lazy"
19
+ );
20
+ const videos = Array.from(
21
+ document.getElementsByTagName("video")
22
+ );
23
+ let mediaElements = [
24
+ ...images,
25
+ ...videos
26
+ ];
27
+ if (firstViewOnly) {
28
+ const firstViewHeight = window.innerHeight;
29
+ mediaElements = mediaElements.filter((media) => {
30
+ const rect = media.getBoundingClientRect();
31
+ return rect.top < firstViewHeight && rect.bottom > 0;
32
+ });
33
+ }
34
+ if (mediaElements.length === 0) return Promise.resolve(true);
35
+ await Promise.all(
36
+ mediaElements.map((media) => {
37
+ if (media instanceof HTMLImageElement && media.complete)
38
+ return Promise.resolve();
39
+ if (media instanceof HTMLVideoElement && media.readyState >= 3)
40
+ return Promise.resolve();
41
+ return new Promise((resolve) => {
42
+ const eventHandler = () => resolve();
43
+ if (media instanceof HTMLImageElement) {
44
+ media.addEventListener("load", eventHandler, { once: true });
45
+ media.addEventListener("error", eventHandler, { once: true });
46
+ } else if (media instanceof HTMLVideoElement) {
47
+ media.addEventListener("loadeddata", eventHandler, { once: true });
48
+ media.addEventListener("error", eventHandler, { once: true });
49
+ }
50
+ });
51
+ })
52
+ );
53
+ return true;
54
+ };
55
+ exports.waitForAllMediaLoaded = waitForAllMediaLoaded;
@@ -1,28 +1,55 @@
1
- const l = async (o = !1) => {
2
- if (!document.images || document.images.length === 0) return Promise.resolve(!0);
3
- const i = Array.from(document.images).filter(
4
- (e) => e.getAttribute("loading") !== "lazy"
5
- ), s = Array.from(
1
+ /*!
2
+ * name: umaki
3
+ * version: v0.2.6
4
+ * description: A utility that is often used in web production.
5
+ * author: TsubasaHiga
6
+ * homepage: https://github.com/TsubasaHiga/umaki
7
+ * Released under the MIT License
8
+ *
9
+ * This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
10
+ * For license information, please see LICENSE.txt
11
+ */
12
+ const waitForAllMediaLoaded = async (firstViewOnly = false) => {
13
+ if (!document.images) return Promise.resolve(true);
14
+ if (document.images.length === 0) return Promise.resolve(true);
15
+ const images = Array.from(document.images).filter(
16
+ (img) => img.getAttribute("loading") !== "lazy"
17
+ );
18
+ const videos = Array.from(
6
19
  document.getElementsByTagName("video")
7
20
  );
8
- let r = [
9
- ...i,
10
- ...s
21
+ let mediaElements = [
22
+ ...images,
23
+ ...videos
11
24
  ];
12
- if (o) {
13
- const e = window.innerHeight;
14
- r = r.filter((n) => {
15
- const t = n.getBoundingClientRect();
16
- return t.top < e && t.bottom > 0;
25
+ if (firstViewOnly) {
26
+ const firstViewHeight = window.innerHeight;
27
+ mediaElements = mediaElements.filter((media) => {
28
+ const rect = media.getBoundingClientRect();
29
+ return rect.top < firstViewHeight && rect.bottom > 0;
17
30
  });
18
31
  }
19
- return r.length === 0 ? Promise.resolve(!0) : (await Promise.all(
20
- r.map((e) => e instanceof HTMLImageElement && e.complete || e instanceof HTMLVideoElement && e.readyState >= 3 ? Promise.resolve() : new Promise((n) => {
21
- const t = () => n();
22
- e instanceof HTMLImageElement ? (e.addEventListener("load", t, { once: !0 }), e.addEventListener("error", t, { once: !0 })) : e instanceof HTMLVideoElement && (e.addEventListener("loadeddata", t, { once: !0 }), e.addEventListener("error", t, { once: !0 }));
23
- }))
24
- ), !0);
32
+ if (mediaElements.length === 0) return Promise.resolve(true);
33
+ await Promise.all(
34
+ mediaElements.map((media) => {
35
+ if (media instanceof HTMLImageElement && media.complete)
36
+ return Promise.resolve();
37
+ if (media instanceof HTMLVideoElement && media.readyState >= 3)
38
+ return Promise.resolve();
39
+ return new Promise((resolve) => {
40
+ const eventHandler = () => resolve();
41
+ if (media instanceof HTMLImageElement) {
42
+ media.addEventListener("load", eventHandler, { once: true });
43
+ media.addEventListener("error", eventHandler, { once: true });
44
+ } else if (media instanceof HTMLVideoElement) {
45
+ media.addEventListener("loadeddata", eventHandler, { once: true });
46
+ media.addEventListener("error", eventHandler, { once: true });
47
+ }
48
+ });
49
+ })
50
+ );
51
+ return true;
25
52
  };
26
53
  export {
27
- l as waitForAllMediaLoaded
54
+ waitForAllMediaLoaded
28
55
  };
@@ -1 +1,30 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const f=require("../../../_virtual/_commonjsHelpers.cjs.js"),c=require("../../../_virtual/isBetween.cjs.js");(function(l,_){(function(p,r){l.exports=r()})(f.commonjsGlobal,function(){return function(p,r,s){r.prototype.isBetween=function(a,h,e,i){var t=s(a),o=s(h),n=(i=i||"()")[0]==="(",u=i[1]===")";return(n?this.isAfter(t,e):!this.isBefore(t,e))&&(u?this.isBefore(o,e):!this.isAfter(o,e))||(n?this.isBefore(t,e):!this.isAfter(t,e))&&(u?this.isAfter(o,e):!this.isBefore(o,e))}}})})(c.__module);var m=c.__module.exports;const B=f.getDefaultExportFromCjs(m);exports.default=B;
1
+ "use strict";
2
+ /*!
3
+ * name: umaki
4
+ * version: v0.2.6
5
+ * description: A utility that is often used in web production.
6
+ * author: TsubasaHiga
7
+ * homepage: https://github.com/TsubasaHiga/umaki
8
+ * Released under the MIT License
9
+ *
10
+ * This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
11
+ * For license information, please see LICENSE.txt
12
+ */
13
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
14
+ const _commonjsHelpers = require("../../../_virtual/_commonjsHelpers.cjs.js");
15
+ const isBetween$1 = require("../../../_virtual/isBetween.cjs.js");
16
+ (function(module2, exports2) {
17
+ !function(e, i) {
18
+ module2.exports = i();
19
+ }(_commonjsHelpers.commonjsGlobal, function() {
20
+ return function(e, i, t) {
21
+ i.prototype.isBetween = function(e2, i2, s, f) {
22
+ var n = t(e2), o = t(i2), r = "(" === (f = f || "()")[0], u = ")" === f[1];
23
+ return (r ? this.isAfter(n, s) : !this.isBefore(n, s)) && (u ? this.isBefore(o, s) : !this.isAfter(o, s)) || (r ? this.isBefore(n, s) : !this.isAfter(n, s)) && (u ? this.isAfter(o, s) : !this.isBefore(o, s));
24
+ };
25
+ };
26
+ });
27
+ })(isBetween$1.__module);
28
+ var isBetweenExports = isBetween$1.__module.exports;
29
+ const isBetween = /* @__PURE__ */ _commonjsHelpers.getDefaultExportFromCjs(isBetweenExports);
30
+ exports.default = isBetween;
@@ -1,19 +1,30 @@
1
- import { commonjsGlobal as a, getDefaultExportFromCjs as c } from "../../../_virtual/_commonjsHelpers.es.js";
2
- import { __module as u } from "../../../_virtual/isBetween.es.js";
3
- (function(p, l) {
4
- (function(h, i) {
5
- p.exports = i();
6
- })(a, function() {
7
- return function(h, i, s) {
8
- i.prototype.isBetween = function(m, B, e, r) {
9
- var t = s(m), o = s(B), n = (r = r || "()")[0] === "(", f = r[1] === ")";
10
- return (n ? this.isAfter(t, e) : !this.isBefore(t, e)) && (f ? this.isBefore(o, e) : !this.isAfter(o, e)) || (n ? this.isBefore(t, e) : !this.isAfter(t, e)) && (f ? this.isAfter(o, e) : !this.isBefore(o, e));
1
+ /*!
2
+ * name: umaki
3
+ * version: v0.2.6
4
+ * description: A utility that is often used in web production.
5
+ * author: TsubasaHiga
6
+ * homepage: https://github.com/TsubasaHiga/umaki
7
+ * Released under the MIT License
8
+ *
9
+ * This software includes dependencies licensed under MIT, ISC, BSD-3-Clause, and Apache-2.0.
10
+ * For license information, please see LICENSE.txt
11
+ */
12
+ import { commonjsGlobal, getDefaultExportFromCjs } from "../../../_virtual/_commonjsHelpers.es.js";
13
+ import { __module as isBetween$1 } from "../../../_virtual/isBetween.es.js";
14
+ (function(module, exports) {
15
+ !function(e, i) {
16
+ module.exports = i();
17
+ }(commonjsGlobal, function() {
18
+ return function(e, i, t) {
19
+ i.prototype.isBetween = function(e2, i2, s, f) {
20
+ var n = t(e2), o = t(i2), r = "(" === (f = f || "()")[0], u = ")" === f[1];
21
+ return (r ? this.isAfter(n, s) : !this.isBefore(n, s)) && (u ? this.isBefore(o, s) : !this.isAfter(o, s)) || (r ? this.isBefore(n, s) : !this.isAfter(n, s)) && (u ? this.isAfter(o, s) : !this.isBefore(o, s));
11
22
  };
12
23
  };
13
24
  });
14
- })(u);
15
- var x = u.exports;
16
- const d = /* @__PURE__ */ c(x);
25
+ })(isBetween$1);
26
+ var isBetweenExports = isBetween$1.exports;
27
+ const isBetween = /* @__PURE__ */ getDefaultExportFromCjs(isBetweenExports);
17
28
  export {
18
- d as default
29
+ isBetween as default
19
30
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umaki",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
4
4
  "description": "A utility that is often used in web production.",
5
5
  "author": "TsubasaHiga",
6
6
  "homepage": "https://github.com/TsubasaHiga/umaki",
@@ -53,6 +53,7 @@
53
53
  "@types/ua-parser-js": "^0.7.39",
54
54
  "@vitest/coverage-v8": "2.1.4",
55
55
  "happy-dom": "^15.7.4",
56
+ "rollup-plugin-license": "^3.5.3",
56
57
  "rollup-plugin-visualizer": "^5.12.0",
57
58
  "typescript": "~5.6.3",
58
59
  "vite": "^5.4.10",