@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.
Files changed (73) hide show
  1. package/dist/abstract/attaches-events.cjs.js +1 -1
  2. package/dist/abstract/attaches-events.esm.js +23 -0
  3. package/dist/components/section/grid.cjs.js +1 -1
  4. package/dist/components/section/grid.esm.js +13 -0
  5. package/dist/components/ui/text/title.cjs.js +1 -1
  6. package/dist/components/ui/text/title.esm.js +15 -0
  7. package/dist/components/widget/header.cjs.js +1 -1
  8. package/dist/components/widget/header.d.ts +2 -2
  9. package/dist/components/widget/header.esm.js +31 -0
  10. package/dist/components/widget/menu.cjs.js +1 -1
  11. package/dist/components/widget/menu.d.ts +4 -4
  12. package/dist/components/widget/menu.esm.js +117 -0
  13. package/dist/components/widget/panel.cjs.js +1 -1
  14. package/dist/components/widget/panel.d.ts +3 -3
  15. package/dist/components/widget/panel.esm.js +90 -0
  16. package/dist/types/breakpoints.cjs.js +1 -1
  17. package/dist/types/breakpoints.esm.js +10 -0
  18. package/dist/types/components/form/input.cjs.js +1 -1
  19. package/dist/types/components/form/input.esm.js +0 -0
  20. package/dist/types/side.cjs.js +1 -1
  21. package/dist/types/side.esm.js +9 -0
  22. package/dist/types/time.cjs.js +1 -1
  23. package/dist/types/time.esm.js +11 -0
  24. package/dist/types/util.cjs.js +1 -1
  25. package/dist/types/util.esm.js +0 -0
  26. package/dist/util/async.cjs.js +1 -1
  27. package/dist/util/async.esm.js +10 -0
  28. package/dist/util/color.cjs.js +1 -1
  29. package/dist/util/color.esm.js +24 -0
  30. package/dist/util/date.cjs.js +1 -1
  31. package/dist/util/date.esm.js +7 -0
  32. package/dist/util/display.cjs.js +1 -1
  33. package/dist/util/display.esm.js +26 -0
  34. package/dist/util/event.cjs.js +1 -1
  35. package/dist/util/event.d.ts +2 -2
  36. package/dist/util/event.esm.js +29 -0
  37. package/dist/util/math.cjs.js +1 -1
  38. package/dist/util/math.esm.js +9 -0
  39. package/dist/util/object.cjs.js +1 -1
  40. package/dist/util/object.d.ts +11 -11
  41. package/dist/util/object.esm.js +105 -0
  42. package/dist/util/scroll.cjs.js +1 -1
  43. package/dist/util/scroll.esm.js +27 -0
  44. package/dist/util/selectors.cjs.js +7 -7
  45. package/dist/util/selectors.esm.js +46 -0
  46. package/dist/util/text.cjs.js +2 -2
  47. package/dist/util/text.d.ts +1 -1
  48. package/dist/util/text.esm.js +70 -0
  49. package/dist/util/window.cjs.js +1 -1
  50. package/dist/util/window.esm.js +11 -0
  51. package/package.json +16 -15
  52. package/dist/abstract/attaches-events.es.js +0 -23
  53. package/dist/components/section/grid.es.js +0 -11
  54. package/dist/components/ui/text/title.es.js +0 -11
  55. package/dist/components/widget/header.es.js +0 -28
  56. package/dist/components/widget/menu.es.js +0 -114
  57. package/dist/components/widget/panel.es.js +0 -86
  58. package/dist/types/breakpoints.es.js +0 -10
  59. package/dist/types/components/form/input.es.js +0 -1
  60. package/dist/types/side.es.js +0 -9
  61. package/dist/types/time.es.js +0 -13
  62. package/dist/types/util.es.js +0 -1
  63. package/dist/util/async.es.js +0 -11
  64. package/dist/util/color.es.js +0 -22
  65. package/dist/util/date.es.js +0 -7
  66. package/dist/util/display.es.js +0 -35
  67. package/dist/util/event.es.js +0 -30
  68. package/dist/util/math.es.js +0 -10
  69. package/dist/util/object.es.js +0 -109
  70. package/dist/util/scroll.es.js +0 -31
  71. package/dist/util/selectors.es.js +0 -69
  72. package/dist/util/text.es.js +0 -81
  73. 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 };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(o,t,r){return Math.max(t,Math.min(o??t,r))}function e(o,t=0){return t=Math.ceil(t),o=Math.floor(o),Math.floor(Math.random()*(o-t)+t)}exports.clamp=a;exports.randomInt=e;
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 };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function f(e,n){const t=Object.keys(e);if(t.length!==Object.keys(n).length)return!1;let r=!0;return t.forEach(s=>{e[s]!==n[s]&&(r=!1)}),r}function o(e,n){let t=!0;if(e===n)return t;try{if(Object.keys(n).length===0)return!t}catch{return!t}return Object.keys(n).forEach(r=>{t=t&&o(e[r],n[r])}),t}function l(e,n){return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}function a(e,n){return Object.keys(e).reduce((t,r)=>(n.includes(e[r])||(t[r]=e[r]),t),{})}function y(e,n){return Object.keys(e).sort(n).reduce((t,r)=>(t[r]=e[r],t),{})}function h(e,n){return Object.keys(e).sort((t,r)=>n(e[t],e[r])).reduce((t,r)=>(t[r]=e[r],t),{})}function O(e,n){return n.reduce((t,r)=>(t[r]=e[r],t),{})}function d(e,n){return Object.keys(e).reduce((t,r)=>(n.includes(e[r])&&(t[r]=e[r]),t),{})}function p(e,n,t="id"){if(!n?.length)n?.forEach(s=>e.push(s));else{const s=n.reduce((c,i)=>({...c,[i?.[t]??""]:i}),{});e.filter(c=>!s[c?.[t]??""])?.forEach(c=>{const i=e.indexOf(c);typeof i=="number"&&i!==-1&&e.splice(i,1)}),e.forEach(c=>{s[c?.[t]??""]&&Object.assign(c,s[c?.[t]??""])})}n?.filter(s=>!e.some(u=>u?.[t]===s?.[t]))?.forEach(s=>e.push(s))}function b(e,n){return Object.keys(e).find(t=>e[t]===n)}function j(e){if(typeof e!="object"||e===null)return e;const n=new WeakMap,t=[[e,Array.isArray(e)?[]:{}]];for(;t.length;){const[r,s,u]=t.pop();if(u!==void 0){const c=r[u];if(typeof c=="function"){s[u]=c.bind(s);continue}if(typeof c!="object"||c===null){s[u]=c;continue}if(n.has(c)){s[u]=n.get(c);continue}s[u]=Array.isArray(c)?[]:{},n.set(c,s[u]),t.push([c,s[u]])}else{if(n.set(r,s),Array.isArray(r)){r.forEach((c,i)=>{t.push([r,s,i])});continue}Object.keys(r).forEach(c=>{t.push([r,s,c])})}}return n.get(e)}exports.objectDeepClone=j;exports.objectFilterKeys=O;exports.objectFilterValues=d;exports.objectGetKeyByValue=b;exports.objectIsSuperset=o;exports.objectRemoveValues=a;exports.objectSameKeys=f;exports.objectSortKeys=y;exports.objectSortValues=h;exports.objectUpdateArray=p;exports.removeKeys=l;
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;
@@ -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: any, obj2: any): boolean;
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: any, subset: any): boolean;
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: any, keys: string[]): any;
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: any, values: any[]): any;
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: any, compareFn?: (a: string, b: string) => number): any;
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: any, compareFn: (a: any, b: any) => number): any;
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: any, keys: string[]): 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: any, values: any[]): 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: any[], update?: any[], key?: string): any;
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: any, value: any): string | undefined;
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>(object: T): 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 };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./event.cjs.js");function s(t){switch(t){case"top":t=0;break;case"bottom":t=document.body.scrollHeight;break}window.scrollTo(0,t)}function o(){requestAnimationFrame(()=>{const t=document.querySelectorAll(".mint-fall-in:not(.mint-show)"),n=[];for(let e=0;e<t.length;e++)t[e].getBoundingClientRect().top<0?t[e].classList.add("mint-show"):t[e].getBoundingClientRect().top<window.innerHeight*3/4&&n.push(t[e]);for(let e=0;e<n.length;e++)setTimeout(()=>{n[e].classList.add("mint-show")},e*100)})}function i(){window.addEventListener("scroll",l.throttleEvent(o,200))}exports.scrollTo=s;exports.showElements=o;exports.showElementsOnScroll=i;
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
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d="mint",a=`${d}-`,r="[disabled]",i="[aria-controls]",b="[aria-expanded]",u="[href]",$="[routerLink]",f="[id]",p=`button${i}`,m=`${p} + ul${f}`,o='[tabindex^="-"]',h=`[tabindex]${t(o)}`,c=`input${t(r)}${t(o)},
2
- select${t(r)}${t(o)},
3
- textarea${t(r)}${t(o)},
4
- button${t(r)}${t(o)},
5
- object${t(r)}${t(o)},
6
- a${u}, a${$},
7
- area${u}, ${h}`.replace(/\s/g,"");function s(e){return e=e.toLowerCase(),e.startsWith(a)?e:`${a}${e}`}function x(e){return`--${s(e.replace(/^-+/,""))}`}function g(e){return`var(${x(e)})`}function t(e){return`:not(${e})`}function L(e){return`.${s(e)}`}function k(e){return`#${s(e)}`}function w(e){return e?`[aria-controls="${s(e)}"]`:i}function C(e){return typeof e=="boolean"?`[aria-expanded="${e}"]`:b}function M(e){let n;return e?n=Array.from(e.querySelectorAll(c)):n=Array.from(document.querySelectorAll(c)),n.filter(l=>y(l))}function y(e){let n=e;do{if(window.getComputedStyle(n).getPropertyValue("display").toLowerCase()==="none")return!1;n=n.parentElement}while(n);return!0}exports.className=L;exports.controls=w;exports.cssPrefix=x;exports.cssVar=g;exports.disabled=r;exports.expanded=C;exports.focusable=c;exports.getFocusables=M;exports.hasControls=i;exports.hasExpanded=b;exports.hasId=f;exports.hasLink=u;exports.hasRouterLink=$;exports.id=k;exports.isFocusable=y;exports.lib=d;exports.not=t;exports.notTabbable=o;exports.pre=a;exports.prefix=s;exports.subMenu=m;exports.subMenuButtons=p;exports.tabbable=h;
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 };
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function r(e,t=100){return e.length>t?e.slice(0,t).trim()+"...":e}function c(e){return e?.trim().toLowerCase().replace(/'/g,"").replace(/[^\w/-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^\/+|\/+$/g,"")??""}function u(e){return s(e.replace(/[-/]+/g," "))}function l(e){const t=e?.toString().trim()??"";if(t==="("||t==="")return t;let n=t.replace(/\D/g,"")??"",i="";n.length>10&&(i+=`+${n.slice(0,n.length-10)} `,n=n.slice(n.length-10));for(var a=0;a<n.length;a++){switch(a){case 0:i+="(";break;case 3:i+=") ";break;case 6:i+="-";break}i+=n[a]}switch(t[t.length-1]){case")":a===3&&(i+=") ");break;case"-":a===6&&(i+="-");break}return i}function x(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 s(e){return e.toLowerCase().replace(/(?:^|\s)\S/g,t=>t.toUpperCase())}function g(e){const t=document.createElement("textarea");return!e||!t?!1:(t.value=e,t.style.cssText=`
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 f(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 o(e=10){return Math.random().toString(36).substring(2,e+2)}function h(e){return!!e?.match(/\.(jpe?g|png|webp|gif|svg)$/i)}function p(e){return!!e?.match(/\.(mp4|webm|ogg)$/i)}exports.copyText=g;exports.formatPhone=l;exports.generateId=o;exports.isEmail=f;exports.isImage=h;exports.isVideo=p;exports.plural=x;exports.slug=c;exports.titleCase=s;exports.truncate=r;exports.unslug=u;
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;
@@ -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 };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function t(){const n=document.body.getBoundingClientRect().width%1;return window.innerWidth+n}function i(){const n=document.body.getBoundingClientRect().height%1;return window.innerHeight+n}exports.windowHeight=i;exports.windowWidth=t;
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.3.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
- "clean": "rimraf dist",
43
+ "test": "run-p test:*",
43
44
  "test:types": "tsc -b",
44
- "test:circular": "madge --circular --extensions ts .",
45
+ "test:deps": "depcruise src",
45
46
  "lint": "eslint --fix .",
46
- "publish:link": "yalc 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": "^25.4.0",
52
+ "@types/node": "^26.1.1",
52
53
  "cross-replace": "^0.2.0",
53
- "eslint": "^10.0.3",
54
+ "dependency-cruiser": "^18.0.0",
55
+ "eslint": "^10.7.0",
54
56
  "glob": "^13.0.6",
55
- "globals": "^17.4.0",
56
- "jiti": "^2.6.1",
57
- "madge": "^8.0.0",
58
- "npm-check-updates": "^19.6.3",
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": "^5.9.3",
62
- "typescript-eslint": "^8.57.0",
63
- "vite": "^7.3.1",
64
- "vite-plugin-dts": "^4.5.4",
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,11 +0,0 @@
1
- import { clamp as t } from "../../util/math.es.js";
2
- const r = [1, 2, 3, 4], i = r[0], m = r[r.length - 1];
3
- function u(n) {
4
- return t(n, i, m);
5
- }
6
- export {
7
- u as gridNum,
8
- m as gridNumMax,
9
- i as gridNumMin,
10
- r as gridNums
11
- };
@@ -1,11 +0,0 @@
1
- import { clamp as e } from "../../../util/math.es.js";
2
- const t = [1, 2, 3, 4, 5, 6], i = t[0], m = t[t.length - 1];
3
- function l(n) {
4
- return e(n, i, m);
5
- }
6
- export {
7
- l as titleNum,
8
- m as titleNumMax,
9
- i as titleNumMin,
10
- t as titleNums
11
- };
@@ -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
- };