umaki 0.2.0 → 0.2.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.
Files changed (97) hide show
  1. package/dist/_virtual/_commonjsHelpers.cjs.js +1 -0
  2. package/dist/_virtual/_commonjsHelpers.es.js +8 -0
  3. package/dist/_virtual/isBetween.cjs.js +1 -0
  4. package/dist/_virtual/isBetween.es.js +4 -0
  5. package/dist/index.cjs.js +1 -0
  6. package/dist/index.es.js +88 -0
  7. package/dist/libs/control/bgScrollStop.cjs.js +1 -0
  8. package/dist/libs/control/bgScrollStop.es.js +7 -0
  9. package/dist/libs/control/pd.cjs.js +1 -0
  10. package/dist/libs/control/pd.es.js +4 -0
  11. package/dist/libs/control/scrollToHash.cjs.js +1 -0
  12. package/dist/libs/control/scrollToHash.es.js +21 -0
  13. package/dist/libs/control/videoPlayControl.cjs.js +1 -0
  14. package/dist/libs/control/videoPlayControl.es.js +19 -0
  15. package/dist/libs/convert/changeDateStringToSpecificFormat.cjs.js +1 -0
  16. package/dist/libs/convert/changeDateStringToSpecificFormat.es.js +5 -0
  17. package/dist/libs/convert/jsonStringToJsonObject.cjs.js +1 -0
  18. package/dist/libs/convert/jsonStringToJsonObject.es.js +9 -0
  19. package/dist/libs/get/getAspectRatio.cjs.js +1 -0
  20. package/dist/libs/get/getAspectRatio.es.js +8 -0
  21. package/dist/libs/get/getClassNames.cjs.js +1 -0
  22. package/dist/libs/get/getClassNames.es.js +4 -0
  23. package/dist/libs/get/getDocumentHeight.cjs.js +1 -0
  24. package/dist/libs/get/getDocumentHeight.es.js +4 -0
  25. package/dist/libs/get/getEventPaths.cjs.js +1 -0
  26. package/dist/libs/get/getEventPaths.es.js +17 -0
  27. package/dist/libs/get/getGcd.cjs.js +1 -0
  28. package/dist/libs/get/getGcd.es.js +8 -0
  29. package/dist/libs/get/getOrientation.cjs.js +1 -0
  30. package/dist/libs/get/getOrientation.es.js +4 -0
  31. package/dist/libs/get/getParentList.cjs.js +1 -0
  32. package/dist/libs/get/getParentList.es.js +7 -0
  33. package/dist/libs/get/getQueryParams.cjs.js +1 -0
  34. package/dist/libs/get/getQueryParams.es.js +16 -0
  35. package/dist/libs/get/getRem.cjs.js +1 -0
  36. package/dist/libs/get/getRem.es.js +4 -0
  37. package/dist/libs/get/getScrollbarWidth.cjs.js +1 -0
  38. package/dist/libs/get/getScrollbarWidth.es.js +4 -0
  39. package/dist/libs/get/getSessionStorage.cjs.js +1 -0
  40. package/dist/libs/get/getSessionStorage.es.js +8 -0
  41. package/dist/libs/get/getStringLength.cjs.js +1 -0
  42. package/dist/libs/get/getStringLength.es.js +5 -0
  43. package/dist/libs/get/getStylePropertyValue.cjs.js +1 -0
  44. package/dist/libs/get/getStylePropertyValue.es.js +4 -0
  45. package/dist/libs/get/getStylePropertyValueToNumber.cjs.js +1 -0
  46. package/dist/libs/get/getStylePropertyValueToNumber.es.js +5 -0
  47. package/dist/libs/get/getUaData.cjs.js +1 -0
  48. package/dist/libs/get/getUaData.es.js +16 -0
  49. package/dist/libs/is/isBetweenDateTime.cjs.js +1 -0
  50. package/dist/libs/is/isBetweenDateTime.es.js +12 -0
  51. package/dist/libs/is/isExistAllElements.cjs.js +1 -0
  52. package/dist/libs/is/isExistAllElements.es.js +4 -0
  53. package/dist/libs/is/isIpad.cjs.js +1 -0
  54. package/dist/libs/is/isIpad.es.js +9 -0
  55. package/dist/libs/is/isKeyExists.cjs.js +1 -0
  56. package/dist/libs/is/isKeyExists.es.js +4 -0
  57. package/dist/libs/is/isSafari.cjs.js +1 -0
  58. package/dist/libs/is/isSafari.es.js +8 -0
  59. package/dist/libs/is/isScrollable.cjs.js +1 -0
  60. package/dist/libs/is/isScrollable.es.js +7 -0
  61. package/dist/libs/is/isTouchSupport.cjs.js +1 -0
  62. package/dist/libs/is/isTouchSupport.es.js +5 -0
  63. package/dist/libs/remove/removeAllHtmlTags.cjs.js +1 -0
  64. package/dist/libs/remove/removeAllHtmlTags.es.js +9 -0
  65. package/dist/libs/remove/removeAttribute.cjs.js +1 -0
  66. package/dist/libs/remove/removeAttribute.es.js +6 -0
  67. package/dist/libs/remove/removeSessionStorage.cjs.js +1 -0
  68. package/dist/libs/remove/removeSessionStorage.es.js +7 -0
  69. package/dist/libs/remove/removeStylePropertyValue.cjs.js +1 -0
  70. package/dist/libs/remove/removeStylePropertyValue.es.js +6 -0
  71. package/dist/libs/set/set100vh.cjs.js +1 -0
  72. package/dist/libs/set/set100vh.es.js +7 -0
  73. package/dist/libs/set/set100vw.cjs.js +1 -0
  74. package/dist/libs/set/set100vw.es.js +7 -0
  75. package/dist/libs/set/setAttribute.cjs.js +1 -0
  76. package/dist/libs/set/setAttribute.es.js +6 -0
  77. package/dist/libs/set/setScrollPositionToCenter.cjs.js +1 -0
  78. package/dist/libs/set/setScrollPositionToCenter.es.js +7 -0
  79. package/dist/libs/set/setSessionStorage.cjs.js +1 -0
  80. package/dist/libs/set/setSessionStorage.es.js +7 -0
  81. package/dist/libs/set/setStylePropertyValue.cjs.js +1 -0
  82. package/dist/libs/set/setStylePropertyValue.es.js +6 -0
  83. package/dist/libs/to/toBoolean.cjs.js +1 -0
  84. package/dist/libs/to/toBoolean.es.js +4 -0
  85. package/dist/libs/to/toPositiveNumber.cjs.js +1 -0
  86. package/dist/libs/to/toPositiveNumber.es.js +4 -0
  87. package/dist/libs/transform/wrapTextWithSpans.cjs.js +1 -0
  88. package/dist/libs/transform/wrapTextWithSpans.es.js +17 -0
  89. package/dist/libs/wait/sleep.cjs.js +1 -0
  90. package/dist/libs/wait/sleep.es.js +4 -0
  91. package/dist/libs/wait/waitForAllMediaLoaded.cjs.js +1 -0
  92. package/dist/libs/wait/waitForAllMediaLoaded.es.js +28 -0
  93. package/dist/node_modules/dayjs/plugin/isBetween.cjs.js +1 -0
  94. package/dist/node_modules/dayjs/plugin/isBetween.es.js +19 -0
  95. package/package.json +8 -5
  96. package/dist/index.js +0 -2873
  97. package/dist/index.umd.cjs +0 -3
@@ -0,0 +1,7 @@
1
+ import e from "store2";
2
+ const r = (s, o) => {
3
+ e.session.set(s, o);
4
+ };
5
+ export {
6
+ r as setSessionStorage
7
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(e,t)=>{document.documentElement.style.setProperty(e,t)};exports.setStylePropertyValue=o;
@@ -0,0 +1,6 @@
1
+ const o = (e, t) => {
2
+ document.documentElement.style.setProperty(e, t);
3
+ };
4
+ export {
5
+ o as setStylePropertyValue
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>e?e.toLowerCase()==="true":!1;exports.toBoolean=o;
@@ -0,0 +1,4 @@
1
+ const o = (e) => e ? e.toLowerCase() === "true" : !1;
2
+ export {
3
+ o as toBoolean
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=t=>Math.abs(t);exports.toPositiveNumber=e;
@@ -0,0 +1,4 @@
1
+ const o = (t) => Math.abs(t);
2
+ export {
3
+ o as toPositiveNumber
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=t=>{if(t){if(t.nodeType===Node.TEXT_NODE){const o=(t.textContent||"").trim(),e=document.createDocumentFragment();for(const c of o){const n=document.createElement("span");n.textContent=c,e.appendChild(n)}t.replaceWith(e)}else if(t.nodeType===Node.ELEMENT_NODE)for(const o of Array.from(t.childNodes))r(o)}};exports.wrapTextWithSpans=r;
@@ -0,0 +1,17 @@
1
+ const c = (t) => {
2
+ if (t) {
3
+ if (t.nodeType === Node.TEXT_NODE) {
4
+ const o = (t.textContent || "").trim(), n = document.createDocumentFragment();
5
+ for (const r of o) {
6
+ const e = document.createElement("span");
7
+ e.textContent = r, n.appendChild(e);
8
+ }
9
+ t.replaceWith(n);
10
+ } else if (t.nodeType === Node.ELEMENT_NODE)
11
+ for (const o of Array.from(t.childNodes))
12
+ c(o);
13
+ }
14
+ };
15
+ export {
16
+ c as wrapTextWithSpans
17
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>new Promise(t=>setTimeout(t,e*1e3,"foo"));exports.sleep=o;
@@ -0,0 +1,4 @@
1
+ const t = (e) => new Promise((o) => setTimeout(o, e * 1e3, "foo"));
2
+ export {
3
+ t as sleep
4
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1,28 @@
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(
6
+ document.getElementsByTagName("video")
7
+ );
8
+ let r = [
9
+ ...i,
10
+ ...s
11
+ ];
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;
17
+ });
18
+ }
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);
25
+ };
26
+ export {
27
+ l as waitForAllMediaLoaded
28
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1,19 @@
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));
11
+ };
12
+ };
13
+ });
14
+ })(u);
15
+ var x = u.exports;
16
+ const d = /* @__PURE__ */ c(x);
17
+ export {
18
+ d as default
19
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umaki",
3
- "version": "0.2.0",
3
+ "version": "0.2.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",
@@ -18,17 +18,19 @@
18
18
  "files": [
19
19
  "dist"
20
20
  ],
21
- "main": "./dist/index.umd.cjs",
22
- "module": "./dist/index.js",
21
+ "sideEffects": false,
22
+ "main": "./dist/index.cjs.js",
23
+ "module": "./dist/index.es.js",
23
24
  "types": "./dist/index.d.ts",
24
25
  "exports": {
25
26
  "types": "./dist/index.d.ts",
26
- "import": "./dist/index.js",
27
- "require": "./dist/index.umd.cjs"
27
+ "import": "./dist/index.es.js",
28
+ "require": "./dist/index.cjs.js"
28
29
  },
29
30
  "scripts": {
30
31
  "dev": "vite",
31
32
  "build": "tsc && vite build",
33
+ "analyze": "tsc && vite build --mode analyze",
32
34
  "test": "vitest",
33
35
  "coverage": "vitest run --coverage",
34
36
  "lint": "biome lint",
@@ -51,6 +53,7 @@
51
53
  "@types/ua-parser-js": "^0.7.39",
52
54
  "@vitest/coverage-v8": "2.1.4",
53
55
  "happy-dom": "^15.7.4",
56
+ "rollup-plugin-visualizer": "^5.12.0",
54
57
  "typescript": "~5.6.3",
55
58
  "vite": "^5.4.10",
56
59
  "vite-plugin-dts": "^4.3.0",