umaki 0.1.1 → 0.2.1
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.js +8 -0
- package/dist/_virtual/dayjs.min.js +4 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/isBetween.js +4 -0
- package/dist/_virtual/purify.js +4 -0
- package/dist/_virtual/store2.js +4 -0
- package/dist/_virtual/ua-parser.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +86 -2869
- package/dist/libs/control/bgScrollStop.js +7 -0
- package/dist/libs/control/pd.js +4 -0
- package/dist/libs/control/scrollToHash.js +21 -0
- package/dist/libs/control/videoPlayControl.js +19 -0
- package/dist/libs/convert/changeDateStringToSpecificFormat.js +5 -0
- package/dist/libs/convert/jsonStringToJsonObject.js +9 -0
- package/dist/libs/get/getAspectRatio.js +8 -0
- package/dist/libs/get/getClassNames.js +4 -0
- package/dist/libs/get/getDocumentHeight.js +4 -0
- package/dist/libs/get/getEventPaths.js +17 -0
- package/dist/libs/get/getGcd.js +8 -0
- package/dist/libs/get/getOrientation.js +4 -0
- package/dist/libs/get/getParentList.js +7 -0
- package/dist/libs/get/getQueryParams.js +16 -0
- package/dist/libs/get/getRem.js +4 -0
- package/dist/libs/get/getScrollbarWidth.js +4 -0
- package/dist/libs/get/getSessionStorage.js +8 -0
- package/dist/libs/get/getStringLength.js +5 -0
- package/dist/libs/get/getStylePropertyValue.js +4 -0
- package/dist/libs/get/getStylePropertyValueToNumber.js +5 -0
- package/dist/libs/get/getUaData.js +16 -0
- package/dist/libs/is/isBetweenDateTime.js +12 -0
- package/dist/libs/is/isExistAllElements.js +4 -0
- package/dist/libs/is/isIpad.js +9 -0
- package/dist/libs/is/isKeyExists.js +4 -0
- package/dist/libs/is/isSafari.js +8 -0
- package/dist/libs/is/isScrollable.js +7 -0
- package/dist/libs/is/isTouchSupport.js +5 -0
- package/dist/libs/remove/removeAllHtmlTags.js +9 -0
- package/dist/libs/remove/removeAttribute.js +6 -0
- package/dist/libs/remove/removeSessionStorage.js +7 -0
- package/dist/libs/remove/removeStylePropertyValue.js +6 -0
- package/dist/libs/set/set100vh.js +7 -0
- package/dist/libs/set/set100vw.js +7 -0
- package/dist/libs/set/setAttribute.js +6 -0
- package/dist/libs/set/setScrollPositionToCenter.js +7 -0
- package/dist/libs/set/setSessionStorage.js +7 -0
- package/dist/libs/set/setStylePropertyValue.js +6 -0
- package/dist/libs/to/toBoolean.js +4 -0
- package/dist/libs/to/toPositiveNumber.js +4 -0
- package/dist/libs/transform/wrapTextWithSpans.js +17 -0
- package/dist/libs/wait/sleep.js +4 -0
- package/dist/libs/wait/waitForAllMediaLoaded.js +28 -0
- package/dist/node_modules/dayjs/dayjs.min.js +282 -0
- package/dist/node_modules/dayjs/plugin/isBetween.js +19 -0
- package/dist/node_modules/decode-uri-component/index.js +55 -0
- package/dist/node_modules/dompurify/dist/purify.js +531 -0
- package/dist/node_modules/filter-obj/index.js +20 -0
- package/dist/node_modules/is-touch-device/build/index.js +16 -0
- package/dist/node_modules/isomorphic-dompurify/browser.js +7 -0
- package/dist/node_modules/query-string/base.js +257 -0
- package/dist/node_modules/query-string/index.js +4 -0
- package/dist/node_modules/runes2/dist/index.esm.js +76 -0
- package/dist/node_modules/split-on-first/index.js +14 -0
- package/dist/node_modules/store2/dist/store2.js +225 -0
- package/dist/node_modules/ua-parser-js/src/ua-parser.js +1218 -0
- package/package.json +4 -1
- package/dist/index.umd.cjs +0 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getScrollbarWidth as e } from "../get/getScrollbarWidth.js";
|
|
2
|
+
const d = (o = !0) => {
|
|
3
|
+
document.body.style.paddingRight = o ? `${e()}px` : "", o && (document.body.style.overflow = "hidden"), o || (document.body.style.overflow = "");
|
|
4
|
+
};
|
|
5
|
+
export {
|
|
6
|
+
d as bgScrollStop
|
|
7
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const d = async (l, c = !0, n) => {
|
|
2
|
+
const i = l.replace("#", ""), r = document.getElementById(i);
|
|
3
|
+
if (!r) return !1;
|
|
4
|
+
const e = Math.floor(
|
|
5
|
+
r.getBoundingClientRect().top + window.scrollY
|
|
6
|
+
) - (n || 0);
|
|
7
|
+
return window.scrollTo({
|
|
8
|
+
top: e,
|
|
9
|
+
behavior: c ? "smooth" : "instant"
|
|
10
|
+
}), new Promise((o) => {
|
|
11
|
+
const s = setTimeout(() => {
|
|
12
|
+
window.removeEventListener("scroll", t), o(!1);
|
|
13
|
+
}, 1e3), t = () => {
|
|
14
|
+
window.scrollY === e && (window.removeEventListener("scroll", t), clearTimeout(s), o(!0));
|
|
15
|
+
};
|
|
16
|
+
window.scrollY === e && (clearTimeout(s), o(!0)), window.scrollY !== e && window.addEventListener("scroll", t, !1);
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
d as scrollToHash
|
|
21
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { toBoolean as i } from "../to/toBoolean.js";
|
|
2
|
+
const p = async (a, r) => {
|
|
3
|
+
if (r && a.paused) {
|
|
4
|
+
if (i(a.dataset.playing)) return;
|
|
5
|
+
const s = a.play();
|
|
6
|
+
if (s === void 0) return;
|
|
7
|
+
try {
|
|
8
|
+
await s, a.currentTime = 0, a.dataset.playing = "true";
|
|
9
|
+
} catch {
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (!r && !a.paused) {
|
|
13
|
+
if (!i(a.dataset.playing)) return;
|
|
14
|
+
a.pause(), a.dataset.playing = "false";
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
p as videoPlayControl
|
|
19
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const s = (t) => {
|
|
2
|
+
var c;
|
|
3
|
+
let n = ((c = t.composedPath) == null ? void 0 : c.call(t)) || null;
|
|
4
|
+
const o = t.target;
|
|
5
|
+
if (n != null)
|
|
6
|
+
return n = n.indexOf(window) < 0 ? n.concat([window]) : n, n;
|
|
7
|
+
if (o instanceof Window)
|
|
8
|
+
return [window];
|
|
9
|
+
const r = (d, a) => {
|
|
10
|
+
const i = a || [], e = d.parentNode;
|
|
11
|
+
return e ? r(e, i.concat([e])) : a;
|
|
12
|
+
};
|
|
13
|
+
return [o].concat(r(o, [])).concat([window]);
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
s as getEventPaths
|
|
17
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as a from "../../node_modules/query-string/base.js";
|
|
2
|
+
const e = {
|
|
3
|
+
arrayFormat: "comma",
|
|
4
|
+
parseNumbers: !0
|
|
5
|
+
}, u = (t, n) => {
|
|
6
|
+
const s = {
|
|
7
|
+
...e,
|
|
8
|
+
...n
|
|
9
|
+
}, o = a.parse(window.location.search, s);
|
|
10
|
+
if (!o) return null;
|
|
11
|
+
const r = o[t];
|
|
12
|
+
return r ?? null;
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
u as getQueryParams
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import a from "../../node_modules/ua-parser-js/src/ua-parser.js";
|
|
2
|
+
import { isTouchSupport as p } from "../is/isTouchSupport.js";
|
|
3
|
+
const u = () => {
|
|
4
|
+
const e = new a().getResult(), r = e.browser.name, o = e.browser.version, s = e.engine.name, t = e.os.name, n = e.device.type;
|
|
5
|
+
return {
|
|
6
|
+
browserName: r ? r.toLowerCase().replace(" ", "-") : "",
|
|
7
|
+
browserVersion: o || "",
|
|
8
|
+
browserEngine: s ? s.toLowerCase().replace(" ", "-") : "",
|
|
9
|
+
osName: t ? t.toLowerCase().replace(" ", "-") : "",
|
|
10
|
+
type: typeof n < "u" ? n.toLowerCase().replace(" ", "-") : "laptop",
|
|
11
|
+
touchSupport: p()
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
u as getUaData
|
|
16
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import e from "../../node_modules/dayjs/dayjs.min.js";
|
|
2
|
+
import s from "../../node_modules/dayjs/plugin/isBetween.js";
|
|
3
|
+
e.extend(s);
|
|
4
|
+
const m = (i, t, o = e()) => {
|
|
5
|
+
if (!e(i).isValid() || !e(t).isValid())
|
|
6
|
+
throw new Error("dateA or dateB is not valid date");
|
|
7
|
+
const r = e(i), n = e(t);
|
|
8
|
+
return o.isBetween(r, n, "millisecond");
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
m as isBetweenDateTime
|
|
12
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { getOrientation as r } from "../get/getOrientation.js";
|
|
2
|
+
import { getUaData as a } from "../get/getUaData.js";
|
|
3
|
+
const i = (o = "portrait") => {
|
|
4
|
+
const t = a();
|
|
5
|
+
return t.touchSupport ? t.type === "laptop" && t.osName === "mac-os" && t.browserName === "safari" && t.touchSupport && r() === o : !1;
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
i as isIpad
|
|
9
|
+
};
|
|
@@ -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,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
|
+
};
|