@appartmint/tsm-mint 0.3.0 → 1.0.0
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.d.ts +2 -2
- package/dist/components/widget/header.esm.js +31 -0
- package/dist/components/widget/menu.cjs.js +1 -1
- package/dist/components/widget/menu.d.ts +4 -4
- package/dist/components/widget/menu.esm.js +117 -0
- package/dist/components/widget/panel.cjs.js +1 -1
- package/dist/components/widget/panel.d.ts +3 -3
- 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/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/util/display.esm.js +26 -0
- package/dist/util/event.cjs.js +1 -1
- package/dist/util/event.d.ts +2 -2
- 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.d.ts +11 -11
- 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.d.ts +1 -1
- 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 +16 -15
- 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 -114
- package/dist/components/widget/panel.es.js +0 -86
- 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 -30
- package/dist/util/math.es.js +0 -10
- package/dist/util/object.es.js +0 -109
- package/dist/util/scroll.es.js +0 -31
- package/dist/util/selectors.es.js +0 -69
- package/dist/util/text.es.js +0 -81
- package/dist/util/window.es.js +0 -12
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { delay as e } from "../types/time.esm.js";
|
|
2
|
+
//#region src/util/event.ts
|
|
3
|
+
function t(t, n = e.default) {
|
|
4
|
+
let r;
|
|
5
|
+
return function(...e) {
|
|
6
|
+
r && clearTimeout(r), r = window.setTimeout(() => {
|
|
7
|
+
t(...e);
|
|
8
|
+
}, n);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
function n(n, r = e.default) {
|
|
12
|
+
return t(n, r);
|
|
13
|
+
}
|
|
14
|
+
function r(t, n = e.default, r) {
|
|
15
|
+
let i, a = 0, o = 0, s = null, c = () => {
|
|
16
|
+
o = r?.leading === !1 ? 0 : (/* @__PURE__ */ new Date()).getTime(), a = 0, s && (i = s()), a || (s = null);
|
|
17
|
+
};
|
|
18
|
+
return function(...e) {
|
|
19
|
+
let l = (/* @__PURE__ */ new Date()).getTime();
|
|
20
|
+
!o && r?.leading === !1 && (o = l);
|
|
21
|
+
let u = n - l + o;
|
|
22
|
+
return s = () => t.apply(this, e), u <= 0 || u > n ? (a &&= (clearTimeout(a), 0), o = l, i = s(), a || (s = null)) : !a && r?.trailing !== !1 && (a = window.setTimeout(c, u)), i;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function i(t, n = e.default, i) {
|
|
26
|
+
return r(t, n, i);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { t as debounce, n as debounceEvent, r as throttle, i as throttleEvent };
|
package/dist/util/math.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e,t,n){return Math.max(t,Math.min(e??t,n))}function t(e,t=0){return t=Math.ceil(t),e=Math.floor(e),Math.floor(Math.random()*(e-t)+t)}exports.clamp=e,exports.randomInt=t;
|
|
@@ -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;
|
package/dist/util/object.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Returns true if the provided objects have the same keys
|
|
3
3
|
*/
|
|
4
|
-
export declare function objectSameKeys(obj1:
|
|
4
|
+
export declare function objectSameKeys(obj1: Record<string, unknown>, obj2: Record<string, unknown>): boolean;
|
|
5
5
|
/**
|
|
6
6
|
* Returns true if the first object has at least the same
|
|
7
7
|
* entries as the second object
|
|
@@ -9,51 +9,51 @@ export declare function objectSameKeys(obj1: any, obj2: any): boolean;
|
|
|
9
9
|
* @param subset - the object whose entries are required
|
|
10
10
|
* @returns - true if the first object is a superset of the second
|
|
11
11
|
*/
|
|
12
|
-
export declare function objectIsSuperset(superset:
|
|
12
|
+
export declare function objectIsSuperset(superset: unknown, subset: unknown): boolean;
|
|
13
13
|
/**
|
|
14
14
|
* Removes object entries by key
|
|
15
15
|
* @param object - the object to remove entries from
|
|
16
16
|
* @param keys - the keys to remove
|
|
17
17
|
*/
|
|
18
|
-
export declare function removeKeys(object:
|
|
18
|
+
export declare function removeKeys(object: Record<string, unknown>, keys: string[]): Record<string, unknown>;
|
|
19
19
|
/**
|
|
20
20
|
* Removes object entries by value
|
|
21
21
|
*/
|
|
22
|
-
export declare function objectRemoveValues(object:
|
|
22
|
+
export declare function objectRemoveValues(object: Record<string, unknown>, values: unknown[]): Record<string, unknown>;
|
|
23
23
|
/**
|
|
24
24
|
* Sorts an object's entries alphabetically by key
|
|
25
25
|
*/
|
|
26
|
-
export declare function objectSortKeys(object:
|
|
26
|
+
export declare function objectSortKeys(object: Record<string, unknown>, compareFn?: (a: string, b: string) => number): Record<string, unknown>;
|
|
27
27
|
/**
|
|
28
28
|
* Sorts an object's entries alphabetically by value
|
|
29
29
|
*/
|
|
30
|
-
export declare function objectSortValues(object:
|
|
30
|
+
export declare function objectSortValues(object: Record<string, unknown>, compareFn: (a: unknown, b: unknown) => number): Record<string, unknown>;
|
|
31
31
|
/**
|
|
32
32
|
* Filters an object by its keys
|
|
33
33
|
* @param object - the object to filter
|
|
34
34
|
* @param keys - the keys to keep
|
|
35
35
|
* @returns - the filtered object
|
|
36
36
|
*/
|
|
37
|
-
export declare function objectFilterKeys(object:
|
|
37
|
+
export declare function objectFilterKeys(object: Record<string, unknown>, keys: string[]): Record<string, unknown>;
|
|
38
38
|
/**
|
|
39
39
|
* Filters an object by its values
|
|
40
40
|
* @param object - the object to filter
|
|
41
41
|
* @param values - the values to keep
|
|
42
42
|
* @returns - the filtered object
|
|
43
43
|
*/
|
|
44
|
-
export declare function objectFilterValues(object:
|
|
44
|
+
export declare function objectFilterValues(object: Record<string, unknown>, values: unknown[]): Record<string, unknown>;
|
|
45
45
|
/**
|
|
46
46
|
* Update two sets of objects
|
|
47
47
|
* @param original - the original object
|
|
48
48
|
* @param update - the object to update the original with
|
|
49
49
|
* @returns - the original objects with updated data from the update
|
|
50
50
|
*/
|
|
51
|
-
export declare function objectUpdateArray(original:
|
|
51
|
+
export declare function objectUpdateArray(original: Record<string, unknown>[], update?: Record<string, unknown>[], key?: string): void;
|
|
52
52
|
/**
|
|
53
53
|
* Get an object's key by value
|
|
54
54
|
*/
|
|
55
|
-
export declare function objectGetKeyByValue(object:
|
|
55
|
+
export declare function objectGetKeyByValue(object: Record<string, unknown>, value: unknown): string | undefined;
|
|
56
56
|
/**
|
|
57
57
|
* Create a deep copy of an object
|
|
58
58
|
*/
|
|
59
|
-
export declare function objectDeepClone<T
|
|
59
|
+
export declare function objectDeepClone<T extends Record<string, unknown>>(object: T): T;
|
|
@@ -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),navigator.clipboard.writeText(t.value),document.body.removeChild(t),!0)}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;
|
package/dist/util/text.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export declare function titleCase(text: string): string;
|
|
|
33
33
|
* @param text - the text to copy
|
|
34
34
|
* @returns - true if the text was successfully copied to the clipboard; else false
|
|
35
35
|
*/
|
|
36
|
-
export declare function copyText(text: string): boolean
|
|
36
|
+
export declare function copyText(text: string): Promise<boolean>;
|
|
37
37
|
/**
|
|
38
38
|
* Tests the validity of an email address
|
|
39
39
|
* @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
|
|
@@ -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.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"description": "TypeScript Modules from App Art Mint LLC",
|
|
@@ -37,31 +37,32 @@
|
|
|
37
37
|
"version": "npm i && git add -A",
|
|
38
38
|
"postversion": "git push && git push --tags && cross-replace gh release create \"v$npm_package_version\" --generate-notes",
|
|
39
39
|
"prepare": "run-s build",
|
|
40
|
+
"clean": "rimraf dist",
|
|
40
41
|
"build": "run-p test:types build:prod",
|
|
41
42
|
"build:prod": "vite build",
|
|
42
|
-
"
|
|
43
|
+
"test": "run-p test:*",
|
|
43
44
|
"test:types": "tsc -b",
|
|
44
|
-
"test:
|
|
45
|
+
"test:deps": "depcruise src",
|
|
45
46
|
"lint": "eslint --fix .",
|
|
46
|
-
"publish
|
|
47
|
+
"yalc:publish": "yalc publish",
|
|
47
48
|
"check:updates": "npm-check-updates"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@eslint/js": "^10.0.1",
|
|
51
|
-
"@types/node": "^
|
|
52
|
+
"@types/node": "^26.1.1",
|
|
52
53
|
"cross-replace": "^0.2.0",
|
|
53
|
-
"
|
|
54
|
+
"dependency-cruiser": "^18.0.0",
|
|
55
|
+
"eslint": "^10.7.0",
|
|
54
56
|
"glob": "^13.0.6",
|
|
55
|
-
"globals": "^17.
|
|
56
|
-
"jiti": "^2.
|
|
57
|
-
"
|
|
58
|
-
"npm-
|
|
59
|
-
"npm-run-all2": "^8.0.4",
|
|
57
|
+
"globals": "^17.7.0",
|
|
58
|
+
"jiti": "^2.7.0",
|
|
59
|
+
"npm-check-updates": "^22.2.9",
|
|
60
|
+
"npm-run-all2": "^9.0.2",
|
|
60
61
|
"rimraf": "^6.1.3",
|
|
61
|
-
"typescript": "^
|
|
62
|
-
"typescript-eslint": "^8.
|
|
63
|
-
"vite": "^
|
|
64
|
-
"vite-plugin-dts": "^
|
|
62
|
+
"typescript": "^6.0.3",
|
|
63
|
+
"typescript-eslint": "^8.63.0",
|
|
64
|
+
"vite": "^8.1.4",
|
|
65
|
+
"vite-plugin-dts": "^5.0.3",
|
|
65
66
|
"yalc": "^1.0.0-pre.53"
|
|
66
67
|
}
|
|
67
68
|
}
|
|
@@ -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
|
-
};
|