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.
- package/dist/_virtual/_commonjsHelpers.cjs.js +1 -0
- package/dist/_virtual/_commonjsHelpers.es.js +8 -0
- package/dist/_virtual/isBetween.cjs.js +1 -0
- package/dist/_virtual/isBetween.es.js +4 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.es.js +88 -0
- package/dist/libs/control/bgScrollStop.cjs.js +1 -0
- package/dist/libs/control/bgScrollStop.es.js +7 -0
- package/dist/libs/control/pd.cjs.js +1 -0
- package/dist/libs/control/pd.es.js +4 -0
- package/dist/libs/control/scrollToHash.cjs.js +1 -0
- package/dist/libs/control/scrollToHash.es.js +21 -0
- package/dist/libs/control/videoPlayControl.cjs.js +1 -0
- package/dist/libs/control/videoPlayControl.es.js +19 -0
- package/dist/libs/convert/changeDateStringToSpecificFormat.cjs.js +1 -0
- package/dist/libs/convert/changeDateStringToSpecificFormat.es.js +5 -0
- package/dist/libs/convert/jsonStringToJsonObject.cjs.js +1 -0
- package/dist/libs/convert/jsonStringToJsonObject.es.js +9 -0
- package/dist/libs/get/getAspectRatio.cjs.js +1 -0
- package/dist/libs/get/getAspectRatio.es.js +8 -0
- package/dist/libs/get/getClassNames.cjs.js +1 -0
- package/dist/libs/get/getClassNames.es.js +4 -0
- package/dist/libs/get/getDocumentHeight.cjs.js +1 -0
- package/dist/libs/get/getDocumentHeight.es.js +4 -0
- package/dist/libs/get/getEventPaths.cjs.js +1 -0
- package/dist/libs/get/getEventPaths.es.js +17 -0
- package/dist/libs/get/getGcd.cjs.js +1 -0
- package/dist/libs/get/getGcd.es.js +8 -0
- package/dist/libs/get/getOrientation.cjs.js +1 -0
- package/dist/libs/get/getOrientation.es.js +4 -0
- package/dist/libs/get/getParentList.cjs.js +1 -0
- package/dist/libs/get/getParentList.es.js +7 -0
- package/dist/libs/get/getQueryParams.cjs.js +1 -0
- package/dist/libs/get/getQueryParams.es.js +16 -0
- package/dist/libs/get/getRem.cjs.js +1 -0
- package/dist/libs/get/getRem.es.js +4 -0
- package/dist/libs/get/getScrollbarWidth.cjs.js +1 -0
- package/dist/libs/get/getScrollbarWidth.es.js +4 -0
- package/dist/libs/get/getSessionStorage.cjs.js +1 -0
- package/dist/libs/get/getSessionStorage.es.js +8 -0
- package/dist/libs/get/getStringLength.cjs.js +1 -0
- package/dist/libs/get/getStringLength.es.js +5 -0
- package/dist/libs/get/getStylePropertyValue.cjs.js +1 -0
- package/dist/libs/get/getStylePropertyValue.es.js +4 -0
- package/dist/libs/get/getStylePropertyValueToNumber.cjs.js +1 -0
- package/dist/libs/get/getStylePropertyValueToNumber.es.js +5 -0
- package/dist/libs/get/getUaData.cjs.js +1 -0
- package/dist/libs/get/getUaData.es.js +16 -0
- package/dist/libs/is/isBetweenDateTime.cjs.js +1 -0
- package/dist/libs/is/isBetweenDateTime.es.js +12 -0
- package/dist/libs/is/isExistAllElements.cjs.js +1 -0
- package/dist/libs/is/isExistAllElements.es.js +4 -0
- package/dist/libs/is/isIpad.cjs.js +1 -0
- package/dist/libs/is/isIpad.es.js +9 -0
- package/dist/libs/is/isKeyExists.cjs.js +1 -0
- package/dist/libs/is/isKeyExists.es.js +4 -0
- package/dist/libs/is/isSafari.cjs.js +1 -0
- package/dist/libs/is/isSafari.es.js +8 -0
- package/dist/libs/is/isScrollable.cjs.js +1 -0
- package/dist/libs/is/isScrollable.es.js +7 -0
- package/dist/libs/is/isTouchSupport.cjs.js +1 -0
- package/dist/libs/is/isTouchSupport.es.js +5 -0
- package/dist/libs/remove/removeAllHtmlTags.cjs.js +1 -0
- package/dist/libs/remove/removeAllHtmlTags.es.js +9 -0
- package/dist/libs/remove/removeAttribute.cjs.js +1 -0
- package/dist/libs/remove/removeAttribute.es.js +6 -0
- package/dist/libs/remove/removeSessionStorage.cjs.js +1 -0
- package/dist/libs/remove/removeSessionStorage.es.js +7 -0
- package/dist/libs/remove/removeStylePropertyValue.cjs.js +1 -0
- package/dist/libs/remove/removeStylePropertyValue.es.js +6 -0
- package/dist/libs/set/set100vh.cjs.js +1 -0
- package/dist/libs/set/set100vh.es.js +7 -0
- package/dist/libs/set/set100vw.cjs.js +1 -0
- package/dist/libs/set/set100vw.es.js +7 -0
- package/dist/libs/set/setAttribute.cjs.js +1 -0
- package/dist/libs/set/setAttribute.es.js +6 -0
- package/dist/libs/set/setScrollPositionToCenter.cjs.js +1 -0
- package/dist/libs/set/setScrollPositionToCenter.es.js +7 -0
- package/dist/libs/set/setSessionStorage.cjs.js +1 -0
- package/dist/libs/set/setSessionStorage.es.js +7 -0
- package/dist/libs/set/setStylePropertyValue.cjs.js +1 -0
- package/dist/libs/set/setStylePropertyValue.es.js +6 -0
- package/dist/libs/to/toBoolean.cjs.js +1 -0
- package/dist/libs/to/toBoolean.es.js +4 -0
- package/dist/libs/to/toPositiveNumber.cjs.js +1 -0
- package/dist/libs/to/toPositiveNumber.es.js +4 -0
- package/dist/libs/transform/wrapTextWithSpans.cjs.js +1 -0
- package/dist/libs/transform/wrapTextWithSpans.es.js +17 -0
- package/dist/libs/wait/sleep.cjs.js +1 -0
- package/dist/libs/wait/sleep.es.js +4 -0
- package/dist/libs/wait/waitForAllMediaLoaded.cjs.js +1 -0
- package/dist/libs/wait/waitForAllMediaLoaded.es.js +28 -0
- package/dist/node_modules/dayjs/plugin/isBetween.cjs.js +1 -0
- package/dist/node_modules/dayjs/plugin/isBetween.es.js +19 -0
- package/package.json +8 -5
- package/dist/index.js +0 -2873
- package/dist/index.umd.cjs +0 -3
|
@@ -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 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=e=>e?e.toLowerCase()==="true":!1;exports.toBoolean=o;
|
|
@@ -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 @@
|
|
|
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 @@
|
|
|
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.
|
|
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
|
-
"
|
|
22
|
-
"
|
|
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.
|
|
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",
|