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.
Files changed (67) hide show
  1. package/dist/_virtual/_commonjsHelpers.js +8 -0
  2. package/dist/_virtual/dayjs.min.js +4 -0
  3. package/dist/_virtual/index.js +4 -0
  4. package/dist/_virtual/isBetween.js +4 -0
  5. package/dist/_virtual/purify.js +4 -0
  6. package/dist/_virtual/store2.js +4 -0
  7. package/dist/_virtual/ua-parser.js +4 -0
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.js +86 -2869
  10. package/dist/libs/control/bgScrollStop.js +7 -0
  11. package/dist/libs/control/pd.js +4 -0
  12. package/dist/libs/control/scrollToHash.js +21 -0
  13. package/dist/libs/control/videoPlayControl.js +19 -0
  14. package/dist/libs/convert/changeDateStringToSpecificFormat.js +5 -0
  15. package/dist/libs/convert/jsonStringToJsonObject.js +9 -0
  16. package/dist/libs/get/getAspectRatio.js +8 -0
  17. package/dist/libs/get/getClassNames.js +4 -0
  18. package/dist/libs/get/getDocumentHeight.js +4 -0
  19. package/dist/libs/get/getEventPaths.js +17 -0
  20. package/dist/libs/get/getGcd.js +8 -0
  21. package/dist/libs/get/getOrientation.js +4 -0
  22. package/dist/libs/get/getParentList.js +7 -0
  23. package/dist/libs/get/getQueryParams.js +16 -0
  24. package/dist/libs/get/getRem.js +4 -0
  25. package/dist/libs/get/getScrollbarWidth.js +4 -0
  26. package/dist/libs/get/getSessionStorage.js +8 -0
  27. package/dist/libs/get/getStringLength.js +5 -0
  28. package/dist/libs/get/getStylePropertyValue.js +4 -0
  29. package/dist/libs/get/getStylePropertyValueToNumber.js +5 -0
  30. package/dist/libs/get/getUaData.js +16 -0
  31. package/dist/libs/is/isBetweenDateTime.js +12 -0
  32. package/dist/libs/is/isExistAllElements.js +4 -0
  33. package/dist/libs/is/isIpad.js +9 -0
  34. package/dist/libs/is/isKeyExists.js +4 -0
  35. package/dist/libs/is/isSafari.js +8 -0
  36. package/dist/libs/is/isScrollable.js +7 -0
  37. package/dist/libs/is/isTouchSupport.js +5 -0
  38. package/dist/libs/remove/removeAllHtmlTags.js +9 -0
  39. package/dist/libs/remove/removeAttribute.js +6 -0
  40. package/dist/libs/remove/removeSessionStorage.js +7 -0
  41. package/dist/libs/remove/removeStylePropertyValue.js +6 -0
  42. package/dist/libs/set/set100vh.js +7 -0
  43. package/dist/libs/set/set100vw.js +7 -0
  44. package/dist/libs/set/setAttribute.js +6 -0
  45. package/dist/libs/set/setScrollPositionToCenter.js +7 -0
  46. package/dist/libs/set/setSessionStorage.js +7 -0
  47. package/dist/libs/set/setStylePropertyValue.js +6 -0
  48. package/dist/libs/to/toBoolean.js +4 -0
  49. package/dist/libs/to/toPositiveNumber.js +4 -0
  50. package/dist/libs/transform/wrapTextWithSpans.js +17 -0
  51. package/dist/libs/wait/sleep.js +4 -0
  52. package/dist/libs/wait/waitForAllMediaLoaded.js +28 -0
  53. package/dist/node_modules/dayjs/dayjs.min.js +282 -0
  54. package/dist/node_modules/dayjs/plugin/isBetween.js +19 -0
  55. package/dist/node_modules/decode-uri-component/index.js +55 -0
  56. package/dist/node_modules/dompurify/dist/purify.js +531 -0
  57. package/dist/node_modules/filter-obj/index.js +20 -0
  58. package/dist/node_modules/is-touch-device/build/index.js +16 -0
  59. package/dist/node_modules/isomorphic-dompurify/browser.js +7 -0
  60. package/dist/node_modules/query-string/base.js +257 -0
  61. package/dist/node_modules/query-string/index.js +4 -0
  62. package/dist/node_modules/runes2/dist/index.esm.js +76 -0
  63. package/dist/node_modules/split-on-first/index.js +14 -0
  64. package/dist/node_modules/store2/dist/store2.js +225 -0
  65. package/dist/node_modules/ua-parser-js/src/ua-parser.js +1218 -0
  66. package/package.json +4 -1
  67. 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,4 @@
1
+ const t = (e) => e.preventDefault();
2
+ export {
3
+ t as pd
4
+ };
@@ -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,5 @@
1
+ import r from "../../node_modules/dayjs/dayjs.min.js";
2
+ const c = (o, t = "YYYY年MM月DD日") => r(o).format(t);
3
+ export {
4
+ c as changeDateStringToSpecificFormat
5
+ };
@@ -0,0 +1,9 @@
1
+ const o = (r) => {
2
+ try {
3
+ return JSON.parse(r);
4
+ } catch {
5
+ }
6
+ };
7
+ export {
8
+ o as jsonStringToJsonObject
9
+ };
@@ -0,0 +1,8 @@
1
+ import { getGcd as e } from "./getGcd.js";
2
+ const g = (t, o) => {
3
+ const c = e(t, o);
4
+ return { w: t / c, h: o / c };
5
+ };
6
+ export {
7
+ g as getAspectRatio
8
+ };
@@ -0,0 +1,4 @@
1
+ const l = (s) => String(s.classList).split(" ").filter((t) => t);
2
+ export {
3
+ l as getClassNames
4
+ };
@@ -0,0 +1,4 @@
1
+ const e = () => document.body.clientHeight - window.innerHeight;
2
+ export {
3
+ e as getDocumentHeight
4
+ };
@@ -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,8 @@
1
+ import { toPositiveNumber as e } from "../to/toPositiveNumber.js";
2
+ const s = (i, r) => {
3
+ const o = e(Math.abs(i)), t = e(Math.abs(r));
4
+ return t === 0 ? o : s(t, o % t);
5
+ };
6
+ export {
7
+ s as getGcd
8
+ };
@@ -0,0 +1,4 @@
1
+ const t = () => window.matchMedia("(orientation: landscape)").matches ? "landscape" : "portrait";
2
+ export {
3
+ t as getOrientation
4
+ };
@@ -0,0 +1,7 @@
1
+ const r = (t) => {
2
+ const n = t.parentElement;
3
+ return n ? [t].concat(r(n)) : [t];
4
+ };
5
+ export {
6
+ r as getParentList
7
+ };
@@ -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,4 @@
1
+ const n = (e) => `${e / 16}rem`;
2
+ export {
3
+ n as getRem
4
+ };
@@ -0,0 +1,4 @@
1
+ const t = () => window.innerWidth - document.body.clientWidth;
2
+ export {
3
+ t as getScrollbarWidth
4
+ };
@@ -0,0 +1,8 @@
1
+ import t from "../../node_modules/store2/dist/store2.js";
2
+ const s = (o) => {
3
+ const e = t.session.get(o);
4
+ return e === void 0 ? null : e;
5
+ };
6
+ export {
7
+ s as getSessionStorage
8
+ };
@@ -0,0 +1,5 @@
1
+ import e from "../../node_modules/runes2/dist/index.esm.js";
2
+ const r = (t) => e(t).length;
3
+ export {
4
+ r as getStringLength
5
+ };
@@ -0,0 +1,4 @@
1
+ const t = (e) => getComputedStyle(document.documentElement).getPropertyValue(e);
2
+ export {
3
+ t as getStylePropertyValue
4
+ };
@@ -0,0 +1,5 @@
1
+ import { getStylePropertyValue as r } from "./getStylePropertyValue.js";
2
+ const o = (e) => Number.parseInt(r(e)) || 0;
3
+ export {
4
+ o as getStylePropertyValueToNumber
5
+ };
@@ -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,4 @@
1
+ const e = (l) => l.length > 0 && l.every((t) => t !== null);
2
+ export {
3
+ e as isExistAllElements
4
+ };
@@ -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,4 @@
1
+ const r = (t, e) => !!t && Object.prototype.hasOwnProperty.call(t, e);
2
+ export {
3
+ r as isKeyExists
4
+ };
@@ -0,0 +1,8 @@
1
+ import { getUaData as e } from "../get/getUaData.js";
2
+ const i = (a = !0) => {
3
+ const r = e();
4
+ return a ? r.browserName === "safari" || r.browserName === "mobile-safari" : r.browserName === "safari";
5
+ };
6
+ export {
7
+ i as isSafari
8
+ };
@@ -0,0 +1,7 @@
1
+ const o = (l) => {
2
+ const c = l.scrollWidth > l.clientWidth, i = l.scrollHeight > l.clientHeight;
3
+ return c || i;
4
+ };
5
+ export {
6
+ o as isScrollable
7
+ };
@@ -0,0 +1,5 @@
1
+ import o from "../../node_modules/is-touch-device/build/index.js";
2
+ const i = () => o();
3
+ export {
4
+ i as isTouchSupport
5
+ };
@@ -0,0 +1,9 @@
1
+ import e from "../../node_modules/isomorphic-dompurify/browser.js";
2
+ const n = (t) => e.sanitize(t, {
3
+ ALLOWED_TAGS: [],
4
+ KEEP_CONTENT: !0,
5
+ USE_PROFILES: { html: !1 }
6
+ }).replace(/<\/?[^>]+(>|$)/g, "");
7
+ export {
8
+ n as removeAllHtmlTags
9
+ };
@@ -0,0 +1,6 @@
1
+ const r = (t, e) => {
2
+ t.removeAttribute(e);
3
+ };
4
+ export {
5
+ r as removeAttribute
6
+ };
@@ -0,0 +1,7 @@
1
+ import e from "../../node_modules/store2/dist/store2.js";
2
+ const s = (o) => {
3
+ e.session.remove(o);
4
+ };
5
+ export {
6
+ s as removeSessionStorage
7
+ };
@@ -0,0 +1,6 @@
1
+ const t = (e) => {
2
+ document.documentElement.style.removeProperty(e);
3
+ };
4
+ export {
5
+ t as removeStylePropertyValue
6
+ };
@@ -0,0 +1,7 @@
1
+ const n = (e = "--vh") => {
2
+ const t = window.innerHeight * 0.01;
3
+ document.documentElement.style.setProperty(e, `${t}px`);
4
+ };
5
+ export {
6
+ n as set100vh
7
+ };
@@ -0,0 +1,7 @@
1
+ const n = (t = "--vw") => {
2
+ const e = document.documentElement.clientWidth;
3
+ document.documentElement.style.setProperty(t, `${e}px`);
4
+ };
5
+ export {
6
+ n as set100vw
7
+ };
@@ -0,0 +1,6 @@
1
+ const s = (t, e, r) => {
2
+ t.setAttribute(e, r);
3
+ };
4
+ export {
5
+ s as setAttribute
6
+ };
@@ -0,0 +1,7 @@
1
+ const i = (t, o, n = "smooth") => {
2
+ const e = t.getBoundingClientRect().width / 2, s = o.getBoundingClientRect().width / 2, c = o.offsetLeft + s - e;
3
+ t.scrollTo({ left: c, behavior: n });
4
+ };
5
+ export {
6
+ i as setScrollPositionToCenter
7
+ };
@@ -0,0 +1,7 @@
1
+ import e from "../../node_modules/store2/dist/store2.js";
2
+ const r = (s, o) => {
3
+ e.session.set(s, o);
4
+ };
5
+ export {
6
+ r as setSessionStorage
7
+ };
@@ -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,4 @@
1
+ const o = (e) => e ? e.toLowerCase() === "true" : !1;
2
+ export {
3
+ o as toBoolean
4
+ };
@@ -0,0 +1,4 @@
1
+ const o = (t) => Math.abs(t);
2
+ export {
3
+ o as toPositiveNumber
4
+ };
@@ -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,4 @@
1
+ const t = (e) => new Promise((o) => setTimeout(o, e * 1e3, "foo"));
2
+ export {
3
+ t as sleep
4
+ };
@@ -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
+ };