@appartmint/tsm-mint 0.3.2 → 1.0.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/abstract/attaches-events.cjs.js +1 -1
- package/dist/abstract/attaches-events.esm.js +23 -0
- package/dist/components/section/grid.cjs.js +1 -1
- package/dist/components/section/grid.esm.js +13 -0
- package/dist/components/ui/text/title.cjs.js +1 -1
- package/dist/components/ui/text/title.esm.js +15 -0
- package/dist/components/widget/header.cjs.js +1 -1
- package/dist/components/widget/header.esm.js +31 -0
- package/dist/components/widget/menu.cjs.js +1 -1
- package/dist/{src/components → components}/widget/menu.d.ts +1 -1
- package/dist/components/widget/menu.esm.js +117 -0
- package/dist/components/widget/panel.cjs.js +1 -1
- package/dist/{src/components → components}/widget/panel.d.ts +1 -1
- package/dist/components/widget/panel.esm.js +90 -0
- package/dist/types/breakpoints.cjs.js +1 -1
- package/dist/types/breakpoints.esm.js +10 -0
- package/dist/types/components/form/input.cjs.js +1 -1
- package/dist/{src/types → types}/components/form/input.d.ts +1 -1
- package/dist/types/components/form/input.esm.js +0 -0
- package/dist/types/side.cjs.js +1 -1
- package/dist/types/side.esm.js +9 -0
- package/dist/types/time.cjs.js +1 -1
- package/dist/types/time.esm.js +11 -0
- package/dist/types/util.cjs.js +1 -1
- package/dist/types/util.esm.js +0 -0
- package/dist/util/async.cjs.js +1 -1
- package/dist/util/async.esm.js +10 -0
- package/dist/util/color.cjs.js +1 -1
- package/dist/util/color.esm.js +24 -0
- package/dist/util/date.cjs.js +1 -1
- package/dist/util/date.esm.js +7 -0
- package/dist/util/display.cjs.js +1 -1
- package/dist/{src/util → util}/display.d.ts +1 -1
- package/dist/util/display.esm.js +26 -0
- package/dist/util/event.cjs.js +1 -1
- package/dist/util/event.esm.js +29 -0
- package/dist/util/math.cjs.js +1 -1
- package/dist/util/math.esm.js +9 -0
- package/dist/util/object.cjs.js +1 -1
- package/dist/util/object.esm.js +105 -0
- package/dist/util/scroll.cjs.js +1 -1
- package/dist/util/scroll.esm.js +27 -0
- package/dist/util/selectors.cjs.js +7 -7
- package/dist/util/selectors.esm.js +46 -0
- package/dist/util/text.cjs.js +2 -2
- package/dist/util/text.esm.js +70 -0
- package/dist/util/window.cjs.js +1 -1
- package/dist/util/window.esm.js +11 -0
- package/package.json +13 -9
- package/dist/abstract/attaches-events.es.js +0 -23
- package/dist/components/section/grid.es.js +0 -11
- package/dist/components/ui/text/title.es.js +0 -11
- package/dist/components/widget/header.es.js +0 -28
- package/dist/components/widget/menu.es.js +0 -120
- package/dist/components/widget/panel.es.js +0 -94
- package/dist/types/breakpoints.es.js +0 -10
- package/dist/types/components/form/input.es.js +0 -1
- package/dist/types/side.es.js +0 -9
- package/dist/types/time.es.js +0 -13
- package/dist/types/util.es.js +0 -1
- package/dist/util/async.es.js +0 -11
- package/dist/util/color.es.js +0 -22
- package/dist/util/date.es.js +0 -7
- package/dist/util/display.es.js +0 -35
- package/dist/util/event.es.js +0 -33
- package/dist/util/math.es.js +0 -10
- package/dist/util/object.es.js +0 -116
- package/dist/util/scroll.es.js +0 -31
- package/dist/util/selectors.es.js +0 -69
- package/dist/util/text.es.js +0 -82
- package/dist/util/window.es.js +0 -12
- package/dist/{src/abstract → abstract}/attaches-events.d.ts +0 -0
- package/dist/{src/components → components}/section/grid.d.ts +0 -0
- package/dist/{src/components → components}/ui/text/title.d.ts +0 -0
- package/dist/{src/components → components}/widget/header.d.ts +1 -1
- /package/dist/{src/types → types}/breakpoints.d.ts +0 -0
- /package/dist/{src/types → types}/side.d.ts +0 -0
- /package/dist/{src/types → types}/time.d.ts +0 -0
- /package/dist/{src/types → types}/util.d.ts +0 -0
- /package/dist/{src/util → util}/async.d.ts +0 -0
- /package/dist/{src/util → util}/color.d.ts +0 -0
- /package/dist/{src/util → util}/date.d.ts +0 -0
- /package/dist/{src/util → util}/event.d.ts +0 -0
- /package/dist/{src/util → util}/math.d.ts +0 -0
- /package/dist/{src/util → util}/object.d.ts +0 -0
- /package/dist/{src/util → util}/scroll.d.ts +0 -0
- /package/dist/{src/util → util}/selectors.d.ts +0 -0
- /package/dist/{src/util → util}/text.d.ts +0 -0
- /package/dist/{src/util → util}/window.d.ts +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/util/math.ts
|
|
2
|
+
function e(e, t, n) {
|
|
3
|
+
return Math.max(t, Math.min(e ?? t, n));
|
|
4
|
+
}
|
|
5
|
+
function t(e, t = 0) {
|
|
6
|
+
return t = Math.ceil(t), e = Math.floor(e), Math.floor(Math.random() * (e - t) + t);
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { e as clamp, t as randomInt };
|
package/dist/util/object.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t){let n=Object.keys(e);if(n.length!==Object.keys(t).length)return!1;let r=!0;return n.forEach(n=>{e[n]!==t[n]&&(r=!1)}),r}function t(e,n){let r=!0;if(e===n)return r;try{if(typeof n==`object`&&n&&Object.keys(n).length===0)return!r}catch{return!r}return Object.keys(n).forEach(i=>{r&&=t(e[i],n[i])}),r}function n(e,t){return Object.keys(e).reduce((n,r)=>(t.includes(r)||(n[r]=e[r]),n),{})}function r(e,t){return Object.keys(e).reduce((n,r)=>(t.includes(e[r])||(n[r]=e[r]),n),{})}function i(e,t){return Object.keys(e).sort(t).reduce((t,n)=>(t[n]=e[n],t),{})}function a(e,t){return Object.keys(e).sort((n,r)=>t(e[n],e[r])).reduce((t,n)=>(t[n]=e[n],t),{})}function o(e,t){return t.reduce((t,n)=>(t[n]=e[n],t),{})}function s(e,t){return Object.keys(e).reduce((n,r)=>(t.includes(e[r])&&(n[r]=e[r]),n),{})}function c(e,t,n=`id`){if(!t?.length)t?.forEach(t=>e.push(t));else{let r=t.reduce((e,t)=>({...e,[t[n]??``]:t}),{});e.filter(e=>!r[e[n]??``]).forEach(t=>{let n=e.indexOf(t);typeof n==`number`&&n!==-1&&e.splice(n,1)}),e.forEach(e=>{r[e[n]??``]&&Object.assign(e,r[e[n]??``])})}(t?.filter(t=>!e.some(e=>e[n]===t[n])))?.forEach(t=>e.push(t))}function l(e,t){return Object.keys(e).find(n=>e[n]===t)}function u(e){if(typeof e!=`object`)return e;let t=new WeakMap,n=[[e,{}]];for(;n.length;){let e=n.pop();if(!e)continue;let[r,i,a]=e;if(a!==void 0){let e=r[a];if(typeof e==`function`){i[a]=e.bind(i);continue}if(typeof e!=`object`||!e){i[a]=e;continue}if(t.has(e)){i[a]=t.get(e);continue}let o=Array.isArray(e)?[]:{};i[a]=o,t.set(e,o),n.push([e,o])}else{if(t.set(r,i),Array.isArray(r)){r.forEach((e,t)=>{n.push([r,i,t])});continue}Object.keys(r).forEach(e=>{n.push([r,i,e])})}}return t.get(e)}exports.objectDeepClone=u,exports.objectFilterKeys=o,exports.objectFilterValues=s,exports.objectGetKeyByValue=l,exports.objectIsSuperset=t,exports.objectRemoveValues=r,exports.objectSameKeys=e,exports.objectSortKeys=i,exports.objectSortValues=a,exports.objectUpdateArray=c,exports.removeKeys=n;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
//#region src/util/object.ts
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
let n = Object.keys(e);
|
|
4
|
+
if (n.length !== Object.keys(t).length) return !1;
|
|
5
|
+
let r = !0;
|
|
6
|
+
return n.forEach((n) => {
|
|
7
|
+
e[n] !== t[n] && (r = !1);
|
|
8
|
+
}), r;
|
|
9
|
+
}
|
|
10
|
+
function t(e, n) {
|
|
11
|
+
let r = !0;
|
|
12
|
+
if (e === n) return r;
|
|
13
|
+
try {
|
|
14
|
+
if (typeof n == "object" && n && Object.keys(n).length === 0) return !r;
|
|
15
|
+
} catch {
|
|
16
|
+
return !r;
|
|
17
|
+
}
|
|
18
|
+
return Object.keys(n).forEach((i) => {
|
|
19
|
+
r &&= t(e[i], n[i]);
|
|
20
|
+
}), r;
|
|
21
|
+
}
|
|
22
|
+
function n(e, t) {
|
|
23
|
+
return Object.keys(e).reduce((n, r) => (t.includes(r) || (n[r] = e[r]), n), {});
|
|
24
|
+
}
|
|
25
|
+
function r(e, t) {
|
|
26
|
+
return Object.keys(e).reduce((n, r) => (t.includes(e[r]) || (n[r] = e[r]), n), {});
|
|
27
|
+
}
|
|
28
|
+
function i(e, t) {
|
|
29
|
+
return Object.keys(e).sort(t).reduce((t, n) => (t[n] = e[n], t), {});
|
|
30
|
+
}
|
|
31
|
+
function a(e, t) {
|
|
32
|
+
return Object.keys(e).sort((n, r) => t(e[n], e[r])).reduce((t, n) => (t[n] = e[n], t), {});
|
|
33
|
+
}
|
|
34
|
+
function o(e, t) {
|
|
35
|
+
return t.reduce((t, n) => (t[n] = e[n], t), {});
|
|
36
|
+
}
|
|
37
|
+
function s(e, t) {
|
|
38
|
+
return Object.keys(e).reduce((n, r) => (t.includes(e[r]) && (n[r] = e[r]), n), {});
|
|
39
|
+
}
|
|
40
|
+
function c(e, t, n = "id") {
|
|
41
|
+
if (!t?.length) t?.forEach((t) => e.push(t));
|
|
42
|
+
else {
|
|
43
|
+
let r = t.reduce((e, t) => ({
|
|
44
|
+
...e,
|
|
45
|
+
[t[n] ?? ""]: t
|
|
46
|
+
}), {});
|
|
47
|
+
e.filter((e) => !r[e[n] ?? ""]).forEach((t) => {
|
|
48
|
+
let n = e.indexOf(t);
|
|
49
|
+
typeof n == "number" && n !== -1 && e.splice(n, 1);
|
|
50
|
+
}), e.forEach((e) => {
|
|
51
|
+
r[e[n] ?? ""] && Object.assign(e, r[e[n] ?? ""]);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
(t?.filter((t) => !e.some((e) => e[n] === t[n])))?.forEach((t) => e.push(t));
|
|
55
|
+
}
|
|
56
|
+
function l(e, t) {
|
|
57
|
+
return Object.keys(e).find((n) => e[n] === t);
|
|
58
|
+
}
|
|
59
|
+
function u(e) {
|
|
60
|
+
if (typeof e != "object") return e;
|
|
61
|
+
let t = /* @__PURE__ */ new WeakMap(), n = [[e, {}]];
|
|
62
|
+
for (; n.length;) {
|
|
63
|
+
let e = n.pop();
|
|
64
|
+
if (!e) continue;
|
|
65
|
+
let [r, i, a] = e;
|
|
66
|
+
if (a !== void 0) {
|
|
67
|
+
let e = r[a];
|
|
68
|
+
if (typeof e == "function") {
|
|
69
|
+
i[a] = e.bind(i);
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (typeof e != "object" || !e) {
|
|
73
|
+
i[a] = e;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (t.has(e)) {
|
|
77
|
+
i[a] = t.get(e);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
let o = Array.isArray(e) ? [] : {};
|
|
81
|
+
i[a] = o, t.set(e, o), n.push([e, o]);
|
|
82
|
+
} else {
|
|
83
|
+
if (t.set(r, i), Array.isArray(r)) {
|
|
84
|
+
r.forEach((e, t) => {
|
|
85
|
+
n.push([
|
|
86
|
+
r,
|
|
87
|
+
i,
|
|
88
|
+
t
|
|
89
|
+
]);
|
|
90
|
+
});
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
Object.keys(r).forEach((e) => {
|
|
94
|
+
n.push([
|
|
95
|
+
r,
|
|
96
|
+
i,
|
|
97
|
+
e
|
|
98
|
+
]);
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return t.get(e);
|
|
103
|
+
}
|
|
104
|
+
//#endregion
|
|
105
|
+
export { u as objectDeepClone, o as objectFilterKeys, s as objectFilterValues, l as objectGetKeyByValue, t as objectIsSuperset, r as objectRemoveValues, e as objectSameKeys, i as objectSortKeys, a as objectSortValues, c as objectUpdateArray, n as removeKeys };
|
package/dist/util/scroll.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./event.cjs.js");function t(e){switch(e){case`top`:e=0;break;case`bottom`:e=document.body.scrollHeight;break}window.scrollTo(0,e)}function n(){requestAnimationFrame(()=>{let e=document.querySelectorAll(`.mint-fall-in:not(.mint-show)`),t=[];for(let n of e)n.getBoundingClientRect().top<0?n.classList.add(`mint-show`):n.getBoundingClientRect().top<window.innerHeight*3/4&&t.push(n);for(let e=0;e<t.length;e++)setTimeout(()=>{t[e].classList.add(`mint-show`)},e*100)})}function r(){window.addEventListener(`scroll`,e.throttleEvent(n,200))}exports.scrollTo=t,exports.showElements=n,exports.showElementsOnScroll=r;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { throttleEvent as e } from "./event.esm.js";
|
|
2
|
+
//#region src/util/scroll.ts
|
|
3
|
+
function t(e) {
|
|
4
|
+
switch (e) {
|
|
5
|
+
case "top":
|
|
6
|
+
e = 0;
|
|
7
|
+
break;
|
|
8
|
+
case "bottom":
|
|
9
|
+
e = document.body.scrollHeight;
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
|
+
window.scrollTo(0, e);
|
|
13
|
+
}
|
|
14
|
+
function n() {
|
|
15
|
+
requestAnimationFrame(() => {
|
|
16
|
+
let e = document.querySelectorAll(".mint-fall-in:not(.mint-show)"), t = [];
|
|
17
|
+
for (let n of e) n.getBoundingClientRect().top < 0 ? n.classList.add("mint-show") : n.getBoundingClientRect().top < window.innerHeight * 3 / 4 && t.push(n);
|
|
18
|
+
for (let e = 0; e < t.length; e++) setTimeout(() => {
|
|
19
|
+
t[e].classList.add("mint-show");
|
|
20
|
+
}, e * 100);
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function r() {
|
|
24
|
+
window.addEventListener("scroll", e(n, 200));
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { t as scrollTo, n as showElements, r as showElementsOnScroll };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
select${
|
|
3
|
-
textarea${
|
|
4
|
-
button${
|
|
5
|
-
object${
|
|
6
|
-
a${
|
|
7
|
-
area${
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=`mint`,t=`${e}-`,n=`[disabled]`,r=`[aria-controls]`,i=`[aria-expanded]`,a=`[href]`,o=`[routerLink]`,s=`[id]`,c=`button${r}`,l=`${c} + ul${s}`,u=`[tabindex^="-"]`,d=`[tabindex]${g(u)}`,f=`input${g(n)}${g(u)},
|
|
2
|
+
select${g(n)}${g(u)},
|
|
3
|
+
textarea${g(n)}${g(u)},
|
|
4
|
+
button${g(n)}${g(u)},
|
|
5
|
+
object${g(n)}${g(u)},
|
|
6
|
+
a${a}, a${o},
|
|
7
|
+
area${a}, ${d}`.replace(/\s/g,``);function p(e){return e=e.toLowerCase(),e.startsWith(t)?e:`${t}${e}`}function m(e){return`--${p(e.replace(/^-+/,``))}`}function h(e){return`var(${m(e)})`}function g(e){return`:not(${e})`}function _(e){return`.${p(e)}`}function v(e){return`#${p(e)}`}function y(e){return e?`[aria-controls="${p(e)}"]`:r}function b(e){return typeof e==`boolean`?`[aria-expanded="${e?`true`:`false`}"]`:i}function x(e){let t;return t=e?Array.from(e.querySelectorAll(f)):Array.from(document.querySelectorAll(f)),t.filter(e=>S(e))}function S(e){let t=e;do{if(window.getComputedStyle(t).getPropertyValue(`display`).toLowerCase()===`none`)return!1;t=t.parentElement}while(t);return!0}exports.className=_,exports.controls=y,exports.cssPrefix=m,exports.cssVar=h,exports.disabled=n,exports.expanded=b,exports.focusable=f,exports.getFocusables=x,exports.hasControls=r,exports.hasExpanded=i,exports.hasId=s,exports.hasLink=a,exports.hasRouterLink=o,exports.id=v,exports.isFocusable=S,exports.lib=e,exports.not=g,exports.notTabbable=u,exports.pre=t,exports.prefix=p,exports.subMenu=l,exports.subMenuButtons=c,exports.tabbable=d;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region src/util/selectors.ts
|
|
2
|
+
var e = "mint", t = `${e}-`, n = "[disabled]", r = "[aria-controls]", i = "[aria-expanded]", a = "[href]", o = "[routerLink]", s = "[id]", c = `button${r}`, l = `${c} + ul${s}`, u = "[tabindex^=\"-\"]", d = `[tabindex]${g(u)}`, f = `input${g(n)}${g(u)},
|
|
3
|
+
select${g(n)}${g(u)},
|
|
4
|
+
textarea${g(n)}${g(u)},
|
|
5
|
+
button${g(n)}${g(u)},
|
|
6
|
+
object${g(n)}${g(u)},
|
|
7
|
+
a${a}, a${o},
|
|
8
|
+
area${a}, ${d}`.replace(/\s/g, "");
|
|
9
|
+
function p(e) {
|
|
10
|
+
return e = e.toLowerCase(), e.startsWith(t) ? e : `${t}${e}`;
|
|
11
|
+
}
|
|
12
|
+
function m(e) {
|
|
13
|
+
return `--${p(e.replace(/^-+/, ""))}`;
|
|
14
|
+
}
|
|
15
|
+
function h(e) {
|
|
16
|
+
return `var(${m(e)})`;
|
|
17
|
+
}
|
|
18
|
+
function g(e) {
|
|
19
|
+
return `:not(${e})`;
|
|
20
|
+
}
|
|
21
|
+
function _(e) {
|
|
22
|
+
return `.${p(e)}`;
|
|
23
|
+
}
|
|
24
|
+
function v(e) {
|
|
25
|
+
return `#${p(e)}`;
|
|
26
|
+
}
|
|
27
|
+
function y(e) {
|
|
28
|
+
return e ? `[aria-controls="${p(e)}"]` : r;
|
|
29
|
+
}
|
|
30
|
+
function b(e) {
|
|
31
|
+
return typeof e == "boolean" ? `[aria-expanded="${e ? "true" : "false"}"]` : i;
|
|
32
|
+
}
|
|
33
|
+
function x(e) {
|
|
34
|
+
let t;
|
|
35
|
+
return t = e ? Array.from(e.querySelectorAll(f)) : Array.from(document.querySelectorAll(f)), t.filter((e) => S(e));
|
|
36
|
+
}
|
|
37
|
+
function S(e) {
|
|
38
|
+
let t = e;
|
|
39
|
+
do {
|
|
40
|
+
if (window.getComputedStyle(t).getPropertyValue("display").toLowerCase() === "none") return !1;
|
|
41
|
+
t = t.parentElement;
|
|
42
|
+
} while (t);
|
|
43
|
+
return !0;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { _ as className, y as controls, m as cssPrefix, h as cssVar, n as disabled, b as expanded, f as focusable, x as getFocusables, r as hasControls, i as hasExpanded, s as hasId, a as hasLink, o as hasRouterLink, v as id, S as isFocusable, e as lib, g as not, u as notTabbable, t as pre, p as prefix, l as subMenu, c as subMenuButtons, d as tabbable };
|
package/dist/util/text.cjs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t=100){return e.length>t?e.slice(0,t).trim()+`...`:e}function t(e){return e?.trim().toLowerCase().replace(/'/g,``).replace(/[^\w/-]+/g,`-`).replace(/-+/g,`-`).replace(/^-+|-+$/g,``).replace(/^\/+|\/+$/g,``)??``}function n(e){return a(e.replace(/[-/]+/g,` `))}function r(e){let t=e?.toString().trim()??``;if(t===`(`||t===``)return t;let n=t.replace(/\D/g,``),r=``;n.length>10&&(r+=`+${n.slice(0,n.length-10)} `,n=n.slice(n.length-10));let i=0;for(;i<n.length;i++){switch(i){case 0:r+=`(`;break;case 3:r+=`) `;break;case 6:r+=`-`;break}r+=n[i]}switch(t[t.length-1]){case`)`:i===3&&(r+=`) `);break;case`-`:i===6&&(r+=`-`);break}return r}function i(e){return e.endsWith(`ies`)||e.endsWith(`es`)||e.endsWith(`s`)&&!e.endsWith(`us`)&&!e.endsWith(`is`)&&!e.endsWith(`ss`)?e:e.endsWith(`y`)&&![`a`,`e`,`i`,`o`,`u`].includes(e.charAt(e.length-2))?e.slice(0,-1)+`ies`:e.endsWith(`s`)||e.endsWith(`sh`)||e.endsWith(`ch`)||e.endsWith(`x`)||e.endsWith(`z`)?e+`es`:e+`s`}function a(e){return e.toLowerCase().replace(/(?:^|\s)\S/g,e=>e.toUpperCase())}async function o(e){let t=document.createElement(`textarea`);return e?(t.value=e,t.style.cssText=`
|
|
2
2
|
position: fixed;
|
|
3
3
|
top: 0;
|
|
4
4
|
left: 0;
|
|
5
5
|
transform: translate(-100%, -100%);
|
|
6
6
|
opacity: 0;
|
|
7
7
|
z-index: -1;
|
|
8
|
-
`,document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999),await navigator.clipboard.writeText(t.value),document.body.removeChild(t),!0):!1}function
|
|
8
|
+
`,document.body.appendChild(t),t.select(),t.setSelectionRange(0,99999),await navigator.clipboard.writeText(t.value),document.body.removeChild(t),!0):!1}function s(e){return/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.exec(e)!==null}function c(e=10){return Math.random().toString(36).substring(2,e+2)}function l(e){return!!e?.match(/\.(jpe?g|png|webp|gif|svg)$/i)}function u(e){return!!e?.match(/\.(mp4|webm|ogg)$/i)}exports.copyText=o,exports.formatPhone=r,exports.generateId=c,exports.isEmail=s,exports.isImage=l,exports.isVideo=u,exports.plural=i,exports.slug=t,exports.titleCase=a,exports.truncate=e,exports.unslug=n;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
//#region src/util/text.ts
|
|
2
|
+
function e(e, t = 100) {
|
|
3
|
+
return e.length > t ? e.slice(0, t).trim() + "..." : e;
|
|
4
|
+
}
|
|
5
|
+
function t(e) {
|
|
6
|
+
return e?.trim().toLowerCase().replace(/'/g, "").replace(/[^\w/-]+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "").replace(/^\/+|\/+$/g, "") ?? "";
|
|
7
|
+
}
|
|
8
|
+
function n(e) {
|
|
9
|
+
return a(e.replace(/[-/]+/g, " "));
|
|
10
|
+
}
|
|
11
|
+
function r(e) {
|
|
12
|
+
let t = e?.toString().trim() ?? "";
|
|
13
|
+
if (t === "(" || t === "") return t;
|
|
14
|
+
let n = t.replace(/\D/g, ""), r = "";
|
|
15
|
+
n.length > 10 && (r += `+${n.slice(0, n.length - 10)} `, n = n.slice(n.length - 10));
|
|
16
|
+
let i = 0;
|
|
17
|
+
for (; i < n.length; i++) {
|
|
18
|
+
switch (i) {
|
|
19
|
+
case 0:
|
|
20
|
+
r += "(";
|
|
21
|
+
break;
|
|
22
|
+
case 3:
|
|
23
|
+
r += ") ";
|
|
24
|
+
break;
|
|
25
|
+
case 6:
|
|
26
|
+
r += "-";
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
r += n[i];
|
|
30
|
+
}
|
|
31
|
+
switch (t[t.length - 1]) {
|
|
32
|
+
case ")":
|
|
33
|
+
i === 3 && (r += ") ");
|
|
34
|
+
break;
|
|
35
|
+
case "-":
|
|
36
|
+
i === 6 && (r += "-");
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
return r;
|
|
40
|
+
}
|
|
41
|
+
function i(e) {
|
|
42
|
+
return e.endsWith("ies") || e.endsWith("es") || e.endsWith("s") && !e.endsWith("us") && !e.endsWith("is") && !e.endsWith("ss") ? e : e.endsWith("y") && ![
|
|
43
|
+
"a",
|
|
44
|
+
"e",
|
|
45
|
+
"i",
|
|
46
|
+
"o",
|
|
47
|
+
"u"
|
|
48
|
+
].includes(e.charAt(e.length - 2)) ? e.slice(0, -1) + "ies" : e.endsWith("s") || e.endsWith("sh") || e.endsWith("ch") || e.endsWith("x") || e.endsWith("z") ? e + "es" : e + "s";
|
|
49
|
+
}
|
|
50
|
+
function a(e) {
|
|
51
|
+
return e.toLowerCase().replace(/(?:^|\s)\S/g, (e) => e.toUpperCase());
|
|
52
|
+
}
|
|
53
|
+
async function o(e) {
|
|
54
|
+
let t = document.createElement("textarea");
|
|
55
|
+
return e ? (t.value = e, t.style.cssText = "\n position: fixed;\n top: 0;\n left: 0;\n transform: translate(-100%, -100%);\n opacity: 0;\n z-index: -1;\n ", document.body.appendChild(t), t.select(), t.setSelectionRange(0, 99999), await navigator.clipboard.writeText(t.value), document.body.removeChild(t), !0) : !1;
|
|
56
|
+
}
|
|
57
|
+
function s(e) {
|
|
58
|
+
return /(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/.exec(e) !== null;
|
|
59
|
+
}
|
|
60
|
+
function c(e = 10) {
|
|
61
|
+
return Math.random().toString(36).substring(2, e + 2);
|
|
62
|
+
}
|
|
63
|
+
function l(e) {
|
|
64
|
+
return !!e?.match(/\.(jpe?g|png|webp|gif|svg)$/i);
|
|
65
|
+
}
|
|
66
|
+
function u(e) {
|
|
67
|
+
return !!e?.match(/\.(mp4|webm|ogg)$/i);
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { o as copyText, r as formatPhone, c as generateId, s as isEmail, l as isImage, u as isVideo, i as plural, t as slug, a as titleCase, e as truncate, n as unslug };
|
package/dist/util/window.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(){let e=document.body.getBoundingClientRect().width%1;return window.innerWidth+e}function t(){let e=document.body.getBoundingClientRect().height%1;return window.innerHeight+e}exports.windowHeight=t,exports.windowWidth=e;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/util/window.ts
|
|
2
|
+
function e() {
|
|
3
|
+
let e = document.body.getBoundingClientRect().width % 1;
|
|
4
|
+
return window.innerWidth + e;
|
|
5
|
+
}
|
|
6
|
+
function t() {
|
|
7
|
+
let e = document.body.getBoundingClientRect().height % 1;
|
|
8
|
+
return window.innerHeight + e;
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { t as windowHeight, e as windowWidth };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appartmint/tsm-mint",
|
|
3
3
|
"author": "App Art Mint LLC",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "TypeScript Modules from App Art Mint LLC",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"exports": {
|
|
29
29
|
"./*": {
|
|
30
30
|
"types": "./dist/*.d.ts",
|
|
31
|
-
"import": "./dist/*.
|
|
31
|
+
"import": "./dist/*.esm.js",
|
|
32
32
|
"require": "./dist/*.cjs.js",
|
|
33
|
-
"default": "./dist/*.
|
|
33
|
+
"default": "./dist/*.esm.js"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
@@ -44,25 +44,29 @@
|
|
|
44
44
|
"test:types": "tsc -b",
|
|
45
45
|
"test:deps": "depcruise src",
|
|
46
46
|
"lint": "eslint --fix .",
|
|
47
|
+
"format": "run-s format:**",
|
|
48
|
+
"format:imports": "npm run format:imports --prefix ./node_modules/@appartmint/tsm-scripts",
|
|
47
49
|
"yalc:publish": "yalc publish",
|
|
48
50
|
"check:updates": "npm-check-updates"
|
|
49
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
53
|
+
"@appartmint/tsm-scripts": "^0.3.2",
|
|
51
54
|
"@eslint/js": "^10.0.1",
|
|
52
55
|
"@types/node": "^26.1.1",
|
|
53
56
|
"cross-replace": "^0.2.0",
|
|
57
|
+
"dependency-cruiser": "^18.0.0",
|
|
54
58
|
"eslint": "^10.7.0",
|
|
55
59
|
"glob": "^13.0.6",
|
|
56
|
-
"globals": "^17.
|
|
57
|
-
"jiti": "^2.
|
|
58
|
-
"
|
|
59
|
-
"npm-check-updates": "^19.6.3",
|
|
60
|
+
"globals": "^17.7.0",
|
|
61
|
+
"jiti": "^2.7.0",
|
|
62
|
+
"npm-check-updates": "^22.2.9",
|
|
60
63
|
"npm-run-all2": "^9.0.2",
|
|
61
64
|
"rimraf": "^6.1.3",
|
|
65
|
+
"tsx": "^4.23.0",
|
|
62
66
|
"typescript": "^6.0.3",
|
|
63
67
|
"typescript-eslint": "^8.63.0",
|
|
64
|
-
"vite": "^
|
|
65
|
-
"vite-plugin-dts": "^
|
|
68
|
+
"vite": "^8.1.4",
|
|
69
|
+
"vite-plugin-dts": "^5.0.3",
|
|
66
70
|
"yalc": "^1.0.0-pre.53"
|
|
67
71
|
}
|
|
68
72
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
class a {
|
|
2
|
-
events = [];
|
|
3
|
-
attachEvent(s, e, t) {
|
|
4
|
-
if (s) {
|
|
5
|
-
const h = this.events.find((n) => n.el === s);
|
|
6
|
-
h ? (h.handlers.push(t), h.events.push(e)) : this.events.push({
|
|
7
|
-
el: s,
|
|
8
|
-
handlers: [t],
|
|
9
|
-
events: [e]
|
|
10
|
-
}), s.addEventListener(e, t);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
detachEvents() {
|
|
14
|
-
this.events.forEach((s) => {
|
|
15
|
-
s.handlers.forEach((e, t) => {
|
|
16
|
-
s.el?.removeEventListener(s.events[t], e);
|
|
17
|
-
});
|
|
18
|
-
}), this.events = [];
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export {
|
|
22
|
-
a as AttachesEvents
|
|
23
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Panel as e } from "./panel.es.js";
|
|
2
|
-
import { Menu as s } from "./menu.es.js";
|
|
3
|
-
class d {
|
|
4
|
-
settings = {
|
|
5
|
-
id: "mint-menu",
|
|
6
|
-
wrapperId: "mint-wrapper",
|
|
7
|
-
title: "menu",
|
|
8
|
-
fixed: !0
|
|
9
|
-
};
|
|
10
|
-
el = {};
|
|
11
|
-
panel;
|
|
12
|
-
menu;
|
|
13
|
-
constructor(t) {
|
|
14
|
-
this.settings = { ...this.settings, ...t }, this.panel = new e(this.settings), this.menu = new s(this.settings), this.attachElements(), this.addClasses();
|
|
15
|
-
}
|
|
16
|
-
detachEvents() {
|
|
17
|
-
this.panel?.detachEvents(), this.menu?.detachEvents();
|
|
18
|
-
}
|
|
19
|
-
attachElements() {
|
|
20
|
-
this.el.body = document.querySelector("body");
|
|
21
|
-
}
|
|
22
|
-
addClasses() {
|
|
23
|
-
this.settings.fixed && this.el.body?.classList.add("mint-fixed");
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export {
|
|
27
|
-
d as Header
|
|
28
|
-
};
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { AttachesEvents as l } from "../../abstract/attaches-events.es.js";
|
|
2
|
-
import { delay as i } from "../../types/time.es.js";
|
|
3
|
-
import { showElement as c, hideElement as u } from "../../util/display.es.js";
|
|
4
|
-
import { throttleEvent as r } from "../../util/event.es.js";
|
|
5
|
-
import { focusable as o, controls as h, subMenuButtons as a, subMenu as p } from "../../util/selectors.es.js";
|
|
6
|
-
class E extends l {
|
|
7
|
-
settings = {};
|
|
8
|
-
el = {};
|
|
9
|
-
constructor(e) {
|
|
10
|
-
if (super(), this.settings = { ...this.settings, ...e }, !this.settings.wrapperId)
|
|
11
|
-
throw new Error("Wrapper ID is required");
|
|
12
|
-
this.attachElements(), this.attachEvents(), requestAnimationFrame(() => {
|
|
13
|
-
this.closeAllMenus();
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
attachElements() {
|
|
17
|
-
this.el.wrapper = document.getElementById(this.settings.wrapperId);
|
|
18
|
-
}
|
|
19
|
-
attachEvents() {
|
|
20
|
-
this.attachEvent(window, "scroll", r(this.eHandleScroll.bind(this), i.default, { trailing: !1 })), this.el.wrapper?.querySelectorAll(o)?.forEach((s) => {
|
|
21
|
-
this.attachEvent(s, "keydown", r(this.eHandleKeypress.bind(this)));
|
|
22
|
-
}), this.el.wrapper?.querySelectorAll(h())?.forEach((s) => {
|
|
23
|
-
this.attachEvent(s, "click", r(this.eToggleMenu.bind(this), i.slower, { trailing: !1 }));
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
setMenu(e, t = !1) {
|
|
27
|
-
const s = t ? "true" : "false", n = e?.nextElementSibling;
|
|
28
|
-
e && n && (e.setAttribute("aria-expanded", s), t ? c(n) : (u(n), this.closeSubMenus(e)));
|
|
29
|
-
}
|
|
30
|
-
toggleMenu(e) {
|
|
31
|
-
this.setMenu(e, e?.getAttribute("aria-expanded")?.toLowerCase() !== "true");
|
|
32
|
-
}
|
|
33
|
-
closeSubMenus(e) {
|
|
34
|
-
const t = e?.nextElementSibling;
|
|
35
|
-
t.querySelectorAll(a).forEach((n) => {
|
|
36
|
-
n.parentElement?.parentElement === t && this.setMenu(n);
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
closeSiblingMenus(e) {
|
|
40
|
-
e?.parentElement?.parentElement?.querySelectorAll(a)?.forEach((n) => {
|
|
41
|
-
n !== e && this.setMenu(n);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
closeAllMenus() {
|
|
45
|
-
this.el.wrapper?.querySelectorAll(a)?.forEach((t) => {
|
|
46
|
-
this.setMenu(t);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
openClosestMenu() {
|
|
50
|
-
const e = document.activeElement, t = e?.getAttribute("aria-expanded")?.toLowerCase() === "true";
|
|
51
|
-
let s = e?.nextElementSibling;
|
|
52
|
-
e?.getAttribute("aria-controls") === this.settings.wrapperId && (s = this.el.wrapper), e?.getAttribute("aria-controls") && s && !t && (e.click(), s.querySelector(o)?.focus());
|
|
53
|
-
}
|
|
54
|
-
closeClosestMenu() {
|
|
55
|
-
const e = document.activeElement;
|
|
56
|
-
let s = e?.closest(p)?.previousElementSibling;
|
|
57
|
-
e?.getAttribute("aria-controls") && e.getAttribute("aria-expanded")?.toLowerCase() === "true" && (s = e), s?.getAttribute("aria-expanded")?.toLowerCase() === "true" && (s.click(), s.focus());
|
|
58
|
-
}
|
|
59
|
-
toggleClosestMenu() {
|
|
60
|
-
document.activeElement?.getAttribute("aria-expanded")?.toLowerCase() === "true" ? this.closeClosestMenu() : this.openClosestMenu();
|
|
61
|
-
}
|
|
62
|
-
eHandleScroll() {
|
|
63
|
-
this.closeAllMenus();
|
|
64
|
-
}
|
|
65
|
-
eHandleButtonKeypress(e) {
|
|
66
|
-
const t = e.target, s = t?.closest("li");
|
|
67
|
-
switch (e.key.toLowerCase()) {
|
|
68
|
-
case "escape":
|
|
69
|
-
s?.classList.contains("mint-open") && this.setMenu(s);
|
|
70
|
-
break;
|
|
71
|
-
case "arrowleft":
|
|
72
|
-
this.closeClosestMenu();
|
|
73
|
-
break;
|
|
74
|
-
case "arrowright":
|
|
75
|
-
this.openClosestMenu();
|
|
76
|
-
break;
|
|
77
|
-
case "enter":
|
|
78
|
-
case "space":
|
|
79
|
-
t?.click();
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
eHandleLinkKeypress(e) {
|
|
84
|
-
const t = e.target;
|
|
85
|
-
switch (e.key.toLowerCase()) {
|
|
86
|
-
case "escape":
|
|
87
|
-
case "arrowleft":
|
|
88
|
-
this.closeClosestMenu();
|
|
89
|
-
break;
|
|
90
|
-
case "arrowright":
|
|
91
|
-
this.openClosestMenu();
|
|
92
|
-
break;
|
|
93
|
-
case "enter":
|
|
94
|
-
case "space":
|
|
95
|
-
t?.click();
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
eHandleKeypress(e) {
|
|
100
|
-
if (!(e instanceof KeyboardEvent))
|
|
101
|
-
return;
|
|
102
|
-
switch (e.key.toLowerCase() !== "tab" && e.preventDefault(), e.target?.tagName.toLowerCase()) {
|
|
103
|
-
case "a":
|
|
104
|
-
this.eHandleLinkKeypress(e);
|
|
105
|
-
break;
|
|
106
|
-
case "button":
|
|
107
|
-
this.eHandleButtonKeypress(e);
|
|
108
|
-
break;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
eToggleMenu(e) {
|
|
112
|
-
if (!(e instanceof MouseEvent))
|
|
113
|
-
return;
|
|
114
|
-
const t = e.target;
|
|
115
|
-
this.closeSiblingMenus(t), this.toggleMenu(t);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
export {
|
|
119
|
-
E as Menu
|
|
120
|
-
};
|