@appartmint/tsm-mint 0.0.5 → 0.1.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 (52) hide show
  1. package/dist/components/section/grid.cjs.js +1 -0
  2. package/dist/components/{grid.es.js → section/grid.es.js} +1 -1
  3. package/dist/components/ui/text/title.cjs.js +1 -0
  4. package/dist/components/{title.es.js → ui/text/title.es.js} +1 -1
  5. package/dist/components/widget/header.cjs.js +1 -0
  6. package/dist/components/widget/header.d.ts +18 -0
  7. package/dist/components/widget/header.es.js +33 -0
  8. package/dist/components/widget/menu.cjs.js +1 -0
  9. package/dist/components/widget/menu.d.ts +21 -0
  10. package/dist/components/widget/menu.es.js +138 -0
  11. package/dist/components/widget/panel.cjs.js +1 -0
  12. package/dist/components/widget/panel.d.ts +17 -0
  13. package/dist/components/widget/panel.es.js +104 -0
  14. package/dist/types/breakpoints.cjs.js +1 -0
  15. package/dist/types/breakpoints.d.ts +11 -0
  16. package/dist/types/breakpoints.es.js +10 -0
  17. package/dist/types/side.cjs.js +1 -0
  18. package/dist/types/side.d.ts +2 -0
  19. package/dist/types/{box.es.js → side.es.js} +2 -2
  20. package/dist/types/time.cjs.js +1 -1
  21. package/dist/types/time.d.ts +10 -1
  22. package/dist/types/time.es.js +11 -2
  23. package/dist/util/display.cjs.js +1 -1
  24. package/dist/util/display.d.ts +2 -2
  25. package/dist/util/display.es.js +10 -9
  26. package/dist/util/event.cjs.js +1 -1
  27. package/dist/util/event.es.js +13 -13
  28. package/dist/util/selectors.cjs.js +7 -0
  29. package/dist/util/selectors.d.ts +115 -0
  30. package/dist/util/selectors.es.js +69 -0
  31. package/package.json +58 -67
  32. package/dist/abstract/index.cjs.js +0 -1
  33. package/dist/abstract/index.d.ts +0 -1
  34. package/dist/abstract/index.es.js +0 -4
  35. package/dist/components/grid.cjs.js +0 -1
  36. package/dist/components/index.cjs.js +0 -1
  37. package/dist/components/index.d.ts +0 -2
  38. package/dist/components/index.es.js +0 -12
  39. package/dist/components/title.cjs.js +0 -1
  40. package/dist/index.cjs.js +0 -1
  41. package/dist/index.d.ts +0 -4
  42. package/dist/index.es.js +0 -50
  43. package/dist/types/box.cjs.js +0 -1
  44. package/dist/types/box.d.ts +0 -2
  45. package/dist/types/index.cjs.js +0 -1
  46. package/dist/types/index.d.ts +0 -2
  47. package/dist/types/index.es.js +0 -6
  48. package/dist/util/index.cjs.js +0 -1
  49. package/dist/util/index.d.ts +0 -7
  50. package/dist/util/index.es.js +0 -34
  51. /package/dist/components/{grid.d.ts → section/grid.d.ts} +0 -0
  52. /package/dist/components/{title.d.ts → ui/text/title.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../../util/math.cjs.js"),i=[1,2,3,4],r=i[0],t=i[i.length-1];function e(u){return n.clamp(u,r,t)}exports.gridNum=e;exports.gridNumMax=t;exports.gridNumMin=r;exports.gridNums=i;
@@ -1,4 +1,4 @@
1
- import { clamp as t } from "../util/math.es.js";
1
+ import { clamp as t } from "../../util/math.es.js";
2
2
  const r = [1, 2, 3, 4], i = r[0], m = r[r.length - 1];
3
3
  function u(n) {
4
4
  return t(n, i, m);
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../../../util/math.cjs.js"),t=[1,2,3,4,5,6],e=t[0],i=t[t.length-1];function n(u){return l.clamp(u,e,i)}exports.titleNum=n;exports.titleNumMax=i;exports.titleNumMin=e;exports.titleNums=t;
@@ -1,4 +1,4 @@
1
- import { clamp as e } from "../util/math.es.js";
1
+ import { clamp as e } from "../../../util/math.es.js";
2
2
  const t = [1, 2, 3, 4, 5, 6], i = t[0], m = t[t.length - 1];
3
3
  function l(n) {
4
4
  return e(n, i, m);
@@ -0,0 +1 @@
1
+ "use strict";var i=Object.defineProperty;var a=(s,e,t)=>e in s?i(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t;var n=(s,e,t)=>a(s,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./panel.cjs.js"),l=require("./menu.cjs.js");class r{constructor(e){n(this,"settings",{id:"mint-menu",wrapperId:"mint-wrapper",title:"menu",fixed:!0});n(this,"el",{});n(this,"panel");n(this,"menu");this.settings={...this.settings,...e},this.panel=new d.Panel(this.settings),this.menu=new l.Menu(this.settings),this.attachElements(),this.addClasses()}detachEvents(){var e,t;(e=this.panel)==null||e.detachEvents(),(t=this.menu)==null||t.detachEvents()}attachElements(){this.el.body=document.querySelector("body")}addClasses(){var e;this.settings.fixed&&((e=this.el.body)==null||e.classList.add("mint-fixed"))}}exports.Header=r;
@@ -0,0 +1,18 @@
1
+ import { Panel } from './panel';
2
+ import { Menu } from './menu';
3
+ export declare class Header {
4
+ settings: {
5
+ [key: string]: any;
6
+ };
7
+ el: {
8
+ [key: string]: HTMLElement | null;
9
+ };
10
+ panel?: Panel;
11
+ menu?: Menu;
12
+ constructor(settings?: {
13
+ [key: string]: any;
14
+ });
15
+ detachEvents(): void;
16
+ attachElements(): void;
17
+ addClasses(): void;
18
+ }
@@ -0,0 +1,33 @@
1
+ var n = Object.defineProperty;
2
+ var a = (s, t, e) => t in s ? n(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
3
+ var i = (s, t, e) => a(s, typeof t != "symbol" ? t + "" : t, e);
4
+ import { Panel as d } from "./panel.es.js";
5
+ import { Menu as h } from "./menu.es.js";
6
+ class o {
7
+ constructor(t) {
8
+ i(this, "settings", {
9
+ id: "mint-menu",
10
+ wrapperId: "mint-wrapper",
11
+ title: "menu",
12
+ fixed: !0
13
+ });
14
+ i(this, "el", {});
15
+ i(this, "panel");
16
+ i(this, "menu");
17
+ this.settings = { ...this.settings, ...t }, this.panel = new d(this.settings), this.menu = new h(this.settings), this.attachElements(), this.addClasses();
18
+ }
19
+ detachEvents() {
20
+ var t, e;
21
+ (t = this.panel) == null || t.detachEvents(), (e = this.menu) == null || e.detachEvents();
22
+ }
23
+ attachElements() {
24
+ this.el.body = document.querySelector("body");
25
+ }
26
+ addClasses() {
27
+ var t;
28
+ this.settings.fixed && ((t = this.el.body) == null || t.classList.add("mint-fixed"));
29
+ }
30
+ }
31
+ export {
32
+ o as Header
33
+ };
@@ -0,0 +1 @@
1
+ "use strict";var p=Object.defineProperty;var d=(n,i,e)=>i in n?p(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e;var o=(n,i,e)=>d(n,typeof i!="symbol"?i+"":i,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../abstract/attaches-events.cjs.js"),h=require("../../types/time.cjs.js"),u=require("../../util/display.cjs.js"),c=require("../../util/event.cjs.js"),a=require("../../util/selectors.cjs.js");class M extends g.AttachesEvents{constructor(e){super();o(this,"settings",{});o(this,"el",{});if(this.settings={...this.settings,...e},!this.settings.wrapperId)throw new Error("Wrapper ID is required");this.attachElements(),this.attachEvents(),requestAnimationFrame(()=>{this.closeAllMenus()})}attachElements(){this.el.wrapper=document.getElementById(this.settings.wrapperId)}attachEvents(){var t,r;this.attachEvent(window,"scroll",c.throttleEvent(this.eHandleScroll.bind(this),h.delay.default,{trailing:!1}));const e=(t=this.el.wrapper)==null?void 0:t.querySelectorAll(a.focusable);e==null||e.forEach(l=>{this.attachEvent(l,"keydown",c.throttleEvent(this.eHandleKeypress.bind(this)))});const s=(r=this.el.wrapper)==null?void 0:r.querySelectorAll(a.controls());s==null||s.forEach(l=>{this.attachEvent(l,"click",c.throttleEvent(this.eToggleMenu.bind(this),h.delay.slower,{trailing:!1}))})}setMenu(e,s=!1){let t=s?"true":"false",r=e==null?void 0:e.nextElementSibling;e&&r&&(e.setAttribute("aria-expanded",t),s?u.showElement(r):(u.hideElement(r),this.closeSubMenus(e)))}toggleMenu(e){var s;this.setMenu(e,((s=e==null?void 0:e.getAttribute("aria-expanded"))==null?void 0:s.toLowerCase())!=="true")}closeSubMenus(e){let s=e==null?void 0:e.nextElementSibling;(s==null?void 0:s.querySelectorAll(a.subMenuButtons)).forEach(r=>{var l;((l=r.parentElement)==null?void 0:l.parentElement)===s&&this.setMenu(r)})}closeSiblingMenus(e){var r;let s=e==null?void 0:e.parentElement;((r=s==null?void 0:s.parentElement)==null?void 0:r.querySelectorAll(a.subMenuButtons)).forEach(l=>{l!==e&&this.setMenu(l)})}closeAllMenus(){var s;let e=(s=this.el.wrapper)==null?void 0:s.querySelectorAll(a.subMenuButtons);e==null||e.forEach(t=>{this.setMenu(t)})}openClosestMenu(){var r;let e=document.activeElement,s=e==null?void 0:e.nextElementSibling,t=((r=e==null?void 0:e.getAttribute("aria-expanded"))==null?void 0:r.toLowerCase())==="true";if((e==null?void 0:e.getAttribute("aria-controls"))===this.settings.wrapperId&&(s=this.el.wrapper),e!=null&&e.getAttribute("aria-controls")&&s&&!t){e.click();let l=s.querySelector(a.focusable);l==null||l.focus()}}closeClosestMenu(){var r,l;let e=document.activeElement,s=e==null?void 0:e.closest(a.subMenu),t=s==null?void 0:s.previousElementSibling;e!=null&&e.getAttribute("aria-controls")&&((r=e==null?void 0:e.getAttribute("aria-expanded"))==null?void 0:r.toLowerCase())==="true"&&(t=e),((l=t==null?void 0:t.getAttribute("aria-expanded"))==null?void 0:l.toLowerCase())==="true"&&(t==null||t.click(),t==null||t.focus())}toggleClosestMenu(){var e,s;((s=(e=document.activeElement)==null?void 0:e.getAttribute("aria-expanded"))==null?void 0:s.toLowerCase())==="true"?this.closeClosestMenu():this.openClosestMenu()}eHandleScroll(){this.closeAllMenus()}eHandleButtonKeypress(e){let s=e.target,t=s==null?void 0:s.closest("li");switch(e.key.toLowerCase()){case"escape":t!=null&&t.classList.contains("mint-open")&&this.setMenu(t);break;case"arrowleft":this.closeClosestMenu();break;case"arrowright":this.openClosestMenu();break;case"enter":case"space":s==null||s.click();break}}eHandleLinkKeypress(e){let s=e.target;switch(e.key.toLowerCase()){case"escape":case"arrowleft":this.closeClosestMenu();break;case"arrowright":this.openClosestMenu();break;case"enter":case"space":s==null||s.click();break}}eHandleKeypress(e){e.key.toLowerCase()!=="tab"&&e.preventDefault();const s=e.target;switch(s==null?void 0:s.tagName.toLowerCase()){case"a":this.eHandleLinkKeypress(e);break;case"button":this.eHandleButtonKeypress(e);break}}eToggleMenu(e){let s=e.target;this.closeSiblingMenus(s),this.toggleMenu(s)}}exports.Menu=M;
@@ -0,0 +1,21 @@
1
+ import { AttachesEvents } from '../../abstract/attaches-events';
2
+ export declare class Menu extends AttachesEvents {
3
+ settings: Record<string, any>;
4
+ el: Record<string, HTMLElement | null>;
5
+ constructor(settings?: Record<string, any>);
6
+ attachElements(): void;
7
+ attachEvents(): void;
8
+ setMenu(button?: HTMLElement | null, open?: boolean): void;
9
+ toggleMenu(button?: HTMLElement | null): void;
10
+ closeSubMenus(button?: HTMLElement | null): void;
11
+ closeSiblingMenus(button?: HTMLElement | null): void;
12
+ closeAllMenus(): void;
13
+ openClosestMenu(): void;
14
+ closeClosestMenu(): void;
15
+ toggleClosestMenu(): void;
16
+ eHandleScroll(): void;
17
+ eHandleButtonKeypress(e: KeyboardEvent): void;
18
+ eHandleLinkKeypress(e: KeyboardEvent): void;
19
+ eHandleKeypress(e: KeyboardEvent): void;
20
+ eToggleMenu(e: MouseEvent): void;
21
+ }
@@ -0,0 +1,138 @@
1
+ var g = Object.defineProperty;
2
+ var d = (a, i, e) => i in a ? g(a, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[i] = e;
3
+ var n = (a, i, e) => d(a, typeof i != "symbol" ? i + "" : i, e);
4
+ import { AttachesEvents as u } from "../../abstract/attaches-events.es.js";
5
+ import { delay as h } from "../../types/time.es.js";
6
+ import { showElement as w, hideElement as M } from "../../util/display.es.js";
7
+ import { throttleEvent as o } from "../../util/event.es.js";
8
+ import { focusable as p, controls as f, subMenuButtons as c, subMenu as m } from "../../util/selectors.es.js";
9
+ class b extends u {
10
+ constructor(e) {
11
+ super();
12
+ n(this, "settings", {});
13
+ n(this, "el", {});
14
+ if (this.settings = { ...this.settings, ...e }, !this.settings.wrapperId)
15
+ throw new Error("Wrapper ID is required");
16
+ this.attachElements(), this.attachEvents(), requestAnimationFrame(() => {
17
+ this.closeAllMenus();
18
+ });
19
+ }
20
+ attachElements() {
21
+ this.el.wrapper = document.getElementById(this.settings.wrapperId);
22
+ }
23
+ attachEvents() {
24
+ var t, r;
25
+ this.attachEvent(window, "scroll", o(this.eHandleScroll.bind(this), h.default, { trailing: !1 }));
26
+ const e = (t = this.el.wrapper) == null ? void 0 : t.querySelectorAll(p);
27
+ e == null || e.forEach((l) => {
28
+ this.attachEvent(l, "keydown", o(this.eHandleKeypress.bind(this)));
29
+ });
30
+ const s = (r = this.el.wrapper) == null ? void 0 : r.querySelectorAll(f());
31
+ s == null || s.forEach((l) => {
32
+ this.attachEvent(l, "click", o(this.eToggleMenu.bind(this), h.slower, { trailing: !1 }));
33
+ });
34
+ }
35
+ setMenu(e, s = !1) {
36
+ let t = s ? "true" : "false", r = e == null ? void 0 : e.nextElementSibling;
37
+ e && r && (e.setAttribute("aria-expanded", t), s ? w(r) : (M(r), this.closeSubMenus(e)));
38
+ }
39
+ toggleMenu(e) {
40
+ var s;
41
+ this.setMenu(e, ((s = e == null ? void 0 : e.getAttribute("aria-expanded")) == null ? void 0 : s.toLowerCase()) !== "true");
42
+ }
43
+ closeSubMenus(e) {
44
+ let s = e == null ? void 0 : e.nextElementSibling;
45
+ (s == null ? void 0 : s.querySelectorAll(c)).forEach((r) => {
46
+ var l;
47
+ ((l = r.parentElement) == null ? void 0 : l.parentElement) === s && this.setMenu(r);
48
+ });
49
+ }
50
+ closeSiblingMenus(e) {
51
+ var r;
52
+ let s = e == null ? void 0 : e.parentElement;
53
+ ((r = s == null ? void 0 : s.parentElement) == null ? void 0 : r.querySelectorAll(c)).forEach((l) => {
54
+ l !== e && this.setMenu(l);
55
+ });
56
+ }
57
+ closeAllMenus() {
58
+ var s;
59
+ let e = (s = this.el.wrapper) == null ? void 0 : s.querySelectorAll(c);
60
+ e == null || e.forEach((t) => {
61
+ this.setMenu(t);
62
+ });
63
+ }
64
+ openClosestMenu() {
65
+ var r;
66
+ let e = document.activeElement, s = e == null ? void 0 : e.nextElementSibling, t = ((r = e == null ? void 0 : e.getAttribute("aria-expanded")) == null ? void 0 : r.toLowerCase()) === "true";
67
+ if ((e == null ? void 0 : e.getAttribute("aria-controls")) === this.settings.wrapperId && (s = this.el.wrapper), e != null && e.getAttribute("aria-controls") && s && !t) {
68
+ e.click();
69
+ let l = s.querySelector(p);
70
+ l == null || l.focus();
71
+ }
72
+ }
73
+ closeClosestMenu() {
74
+ var r, l;
75
+ let e = document.activeElement, s = e == null ? void 0 : e.closest(m), t = s == null ? void 0 : s.previousElementSibling;
76
+ e != null && e.getAttribute("aria-controls") && ((r = e == null ? void 0 : e.getAttribute("aria-expanded")) == null ? void 0 : r.toLowerCase()) === "true" && (t = e), ((l = t == null ? void 0 : t.getAttribute("aria-expanded")) == null ? void 0 : l.toLowerCase()) === "true" && (t == null || t.click(), t == null || t.focus());
77
+ }
78
+ toggleClosestMenu() {
79
+ var e, s;
80
+ ((s = (e = document.activeElement) == null ? void 0 : e.getAttribute("aria-expanded")) == null ? void 0 : s.toLowerCase()) === "true" ? this.closeClosestMenu() : this.openClosestMenu();
81
+ }
82
+ eHandleScroll() {
83
+ this.closeAllMenus();
84
+ }
85
+ eHandleButtonKeypress(e) {
86
+ let s = e.target, t = s == null ? void 0 : s.closest("li");
87
+ switch (e.key.toLowerCase()) {
88
+ case "escape":
89
+ t != null && t.classList.contains("mint-open") && this.setMenu(t);
90
+ break;
91
+ case "arrowleft":
92
+ this.closeClosestMenu();
93
+ break;
94
+ case "arrowright":
95
+ this.openClosestMenu();
96
+ break;
97
+ case "enter":
98
+ case "space":
99
+ s == null || s.click();
100
+ break;
101
+ }
102
+ }
103
+ eHandleLinkKeypress(e) {
104
+ let s = e.target;
105
+ switch (e.key.toLowerCase()) {
106
+ case "escape":
107
+ case "arrowleft":
108
+ this.closeClosestMenu();
109
+ break;
110
+ case "arrowright":
111
+ this.openClosestMenu();
112
+ break;
113
+ case "enter":
114
+ case "space":
115
+ s == null || s.click();
116
+ break;
117
+ }
118
+ }
119
+ eHandleKeypress(e) {
120
+ e.key.toLowerCase() !== "tab" && e.preventDefault();
121
+ const s = e.target;
122
+ switch (s == null ? void 0 : s.tagName.toLowerCase()) {
123
+ case "a":
124
+ this.eHandleLinkKeypress(e);
125
+ break;
126
+ case "button":
127
+ this.eHandleButtonKeypress(e);
128
+ break;
129
+ }
130
+ }
131
+ eToggleMenu(e) {
132
+ let s = e.target;
133
+ this.closeSiblingMenus(s), this.toggleMenu(s);
134
+ }
135
+ }
136
+ export {
137
+ b as Menu
138
+ };
@@ -0,0 +1 @@
1
+ "use strict";var w=Object.defineProperty;var y=(r,n,t)=>n in r?w(r,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[n]=t;var c=(r,n,t)=>y(r,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../types/breakpoints.cjs.js"),p=require("../../types/side.cjs.js"),o=require("../../types/time.cjs.js"),v=require("../../abstract/attaches-events.cjs.js"),f=require("../../util/window.cjs.js"),h=require("../../util/event.cjs.js"),d=require("../../util/selectors.cjs.js");class E extends v.AttachesEvents{constructor(t){super();c(this,"settings",{title:"panel",from:p.sides[0],fixed:!0});c(this,"el",{});if(this.settings={...this.settings,...t},!this.settings.id||!this.settings.wrapperId)throw new Error("Panel ID and wrapper ID are required");this.attachElements(),this.attachEvents(),this.addClasses(),requestAnimationFrame(()=>{this.setPanel()})}attachElements(){var t;this.el.html=document.querySelector("html"),this.el.main=document.querySelector("main"),this.el.panel=document.getElementById(this.settings.id),this.el.wrapper=document.getElementById(this.settings.wrapperId),this.el.toggleButton=((t=this.el.panel)==null?void 0:t.querySelector(d.controls(this.settings.wrapperId)))||null}attachEvents(){var a;this.attachEvent(window,"resize",h.throttleEvent(this.eHandleResize.bind(this),o.delay.default)),this.attachEvent(this.el.main,"click",h.throttleEvent(this.eClose.bind(this),o.delay.default,{trailing:!1})),this.attachEvent(this.el.wrapper,"transitionend",this.eTransitionEnd.bind(this));const t=d.getFocusables(this.el.panel);t==null||t.forEach(i=>{this.attachEvent(i,"keydown",h.throttleEvent(this.eWrapTab.bind(this)))});const e=(a=this.el.panel)==null?void 0:a.querySelectorAll(d.controls(this.settings.wrapperId));e==null||e.forEach(i=>{this.attachEvent(i,"click",h.throttleEvent(this.eToggle.bind(this),o.delay.slower,{trailing:!1}))})}addClasses(){var t,e,a,i,s,l;(t=this.el.panel)==null||t.classList.add("mint-panel"),(e=this.el.wrapper)==null||e.classList.add("mint-panel-wrapper"),(a=this.el.toggleButton)==null||a.classList.add("mint-panel-toggle"),this.settings.from&&((i=this.el.panel)==null||i.classList.remove("mint-top","mint-right","mint-bottom","mint-left"),(s=this.el.panel)==null||s.classList.add(`mint-${p.sides[this.settings.from].toLowerCase()}`)),this.settings.tray&&((l=this.el.panel)==null||l.classList.add("mint-tray"))}setPanel(t=!1){var i;let e=t?"true":"false",a=t?`close ${this.settings.title}`:`open ${this.settings.title}`;(i=this.el.toggleButton)==null||i.setAttribute("aria-expanded",e),setTimeout(()=>{var s;(s=this.el.toggleButton)==null||s.setAttribute("aria-label",a)},o.delay.faster),t?(this.closeOtherPanels(),this.settings.fixed!==!0&&window.scroll({top:0,left:0,behavior:"smooth"}),setTimeout(()=>{if(this.el.html){let s=f.windowWidth()<=g.breakpoints.sm,l="auto";this.settings.tray?s&&(l="hidden"):l="hidden",this.el.html.style.overflow=l}},this.settings.from===p.sides[3]?o.delay.default:o.delay.instant),this.el.wrapper&&(this.el.wrapper.style.display="flex"),requestAnimationFrame(()=>{var s;(s=this.el.wrapper)==null||s.classList.add("mint-open")})):(this.el.html&&(this.el.html.style.overflow="auto"),requestAnimationFrame(()=>{var s;(s=this.el.wrapper)==null||s.classList.remove("mint-open")}))}togglePanel(){var t,e;this.setPanel(((e=(t=this.el.toggleButton)==null?void 0:t.getAttribute("aria-expanded"))==null?void 0:e.toLowerCase())==="false")}closeOtherPanels(){const t=`.mint-panel-toggle[aria-expanded="true"]:not([aria-controls="${this.settings.wrapperId}"])`,e=document.querySelector(t);e==null||e.click()}eHandleResize(){var s,l,m,u;const t=f.windowWidth()<=g.breakpoints.sm;let e=!0;(s=this.el.panel)!=null&&s.classList.contains("mint-tray")?e=!1:(l=this.el.panel)!=null&&l.classList.contains("mint-expand")||(e=!1),!t&&e&&this.setPanel(!1);const a=((u=(m=this.el.toggleButton)==null?void 0:m.getAttribute("aria-expanded"))==null?void 0:u.toLowerCase())==="true";let i="auto";a&&(this.settings.tray?t&&(i="hidden"):i="hidden"),this.el.html&&(this.el.html.style.overflow=i)}eWrapTab(t){var l;const e=d.getFocusables(this.el.panel),a=e==null?void 0:e[(e==null?void 0:e.length)-1],i=(e==null?void 0:e.length)>1&&document.activeElement===a;t.key.toLowerCase()==="tab"&&!t.shiftKey&&i&&((l=this.el.toggleButton)==null||l.focus(),document.activeElement===this.el.toggleButton&&t.preventDefault())}eToggle(){this.togglePanel()}eClose(){this.setPanel(!1)}eTransitionEnd(){var t;((t=this.el.wrapper)==null?void 0:t.classList.contains("mint-open"))===!1&&(this.el.wrapper.style.display="none")}}exports.Panel=E;
@@ -0,0 +1,17 @@
1
+ import { AttachesEvents } from '../../abstract/attaches-events';
2
+ export declare class Panel extends AttachesEvents {
3
+ settings: Record<string, any>;
4
+ el: Record<string, HTMLElement | null>;
5
+ constructor(settings?: Record<string, any>);
6
+ attachElements(): void;
7
+ attachEvents(): void;
8
+ addClasses(): void;
9
+ setPanel(open?: boolean): void;
10
+ togglePanel(): void;
11
+ closeOtherPanels(): void;
12
+ eHandleResize(): void;
13
+ eWrapTab(e: KeyboardEvent): void;
14
+ eToggle(): void;
15
+ eClose(): void;
16
+ eTransitionEnd(): void;
17
+ }
@@ -0,0 +1,104 @@
1
+ var y = Object.defineProperty;
2
+ var E = (r, n, t) => n in r ? y(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
+ var d = (r, n, t) => E(r, typeof n != "symbol" ? n + "" : n, t);
4
+ import { breakpoints as f } from "../../types/breakpoints.es.js";
5
+ import { sides as p } from "../../types/side.es.js";
6
+ import { delay as o } from "../../types/time.es.js";
7
+ import { AttachesEvents as v } from "../../abstract/attaches-events.es.js";
8
+ import { windowWidth as g } from "../../util/window.es.js";
9
+ import { throttleEvent as h } from "../../util/event.es.js";
10
+ import { controls as u, getFocusables as w } from "../../util/selectors.es.js";
11
+ class B extends v {
12
+ constructor(t) {
13
+ super();
14
+ d(this, "settings", {
15
+ title: "panel",
16
+ from: p[0],
17
+ fixed: !0
18
+ });
19
+ d(this, "el", {});
20
+ if (this.settings = { ...this.settings, ...t }, !this.settings.id || !this.settings.wrapperId)
21
+ throw new Error("Panel ID and wrapper ID are required");
22
+ this.attachElements(), this.attachEvents(), this.addClasses(), requestAnimationFrame(() => {
23
+ this.setPanel();
24
+ });
25
+ }
26
+ attachElements() {
27
+ var t;
28
+ this.el.html = document.querySelector("html"), this.el.main = document.querySelector("main"), this.el.panel = document.getElementById(this.settings.id), this.el.wrapper = document.getElementById(this.settings.wrapperId), this.el.toggleButton = ((t = this.el.panel) == null ? void 0 : t.querySelector(u(this.settings.wrapperId))) || null;
29
+ }
30
+ attachEvents() {
31
+ var a;
32
+ this.attachEvent(window, "resize", h(this.eHandleResize.bind(this), o.default)), this.attachEvent(this.el.main, "click", h(this.eClose.bind(this), o.default, { trailing: !1 })), this.attachEvent(this.el.wrapper, "transitionend", this.eTransitionEnd.bind(this));
33
+ const t = w(this.el.panel);
34
+ t == null || t.forEach((i) => {
35
+ this.attachEvent(i, "keydown", h(this.eWrapTab.bind(this)));
36
+ });
37
+ const e = (a = this.el.panel) == null ? void 0 : a.querySelectorAll(u(this.settings.wrapperId));
38
+ e == null || e.forEach((i) => {
39
+ this.attachEvent(i, "click", h(this.eToggle.bind(this), o.slower, { trailing: !1 }));
40
+ });
41
+ }
42
+ addClasses() {
43
+ var t, e, a, i, s, l;
44
+ (t = this.el.panel) == null || t.classList.add("mint-panel"), (e = this.el.wrapper) == null || e.classList.add("mint-panel-wrapper"), (a = this.el.toggleButton) == null || a.classList.add("mint-panel-toggle"), this.settings.from && ((i = this.el.panel) == null || i.classList.remove("mint-top", "mint-right", "mint-bottom", "mint-left"), (s = this.el.panel) == null || s.classList.add(`mint-${p[this.settings.from].toLowerCase()}`)), this.settings.tray && ((l = this.el.panel) == null || l.classList.add("mint-tray"));
45
+ }
46
+ setPanel(t = !1) {
47
+ var i;
48
+ let e = t ? "true" : "false", a = t ? `close ${this.settings.title}` : `open ${this.settings.title}`;
49
+ (i = this.el.toggleButton) == null || i.setAttribute("aria-expanded", e), setTimeout(() => {
50
+ var s;
51
+ (s = this.el.toggleButton) == null || s.setAttribute("aria-label", a);
52
+ }, o.faster), t ? (this.closeOtherPanels(), this.settings.fixed !== !0 && window.scroll({
53
+ top: 0,
54
+ left: 0,
55
+ behavior: "smooth"
56
+ }), setTimeout(() => {
57
+ if (this.el.html) {
58
+ let s = g() <= f.sm, l = "auto";
59
+ this.settings.tray ? s && (l = "hidden") : l = "hidden", this.el.html.style.overflow = l;
60
+ }
61
+ }, this.settings.from === p[3] ? o.default : o.instant), this.el.wrapper && (this.el.wrapper.style.display = "flex"), requestAnimationFrame(() => {
62
+ var s;
63
+ (s = this.el.wrapper) == null || s.classList.add("mint-open");
64
+ })) : (this.el.html && (this.el.html.style.overflow = "auto"), requestAnimationFrame(() => {
65
+ var s;
66
+ (s = this.el.wrapper) == null || s.classList.remove("mint-open");
67
+ }));
68
+ }
69
+ togglePanel() {
70
+ var t, e;
71
+ this.setPanel(((e = (t = this.el.toggleButton) == null ? void 0 : t.getAttribute("aria-expanded")) == null ? void 0 : e.toLowerCase()) === "false");
72
+ }
73
+ closeOtherPanels() {
74
+ const t = `.mint-panel-toggle[aria-expanded="true"]:not([aria-controls="${this.settings.wrapperId}"])`, e = document.querySelector(t);
75
+ e == null || e.click();
76
+ }
77
+ eHandleResize() {
78
+ var s, l, m, c;
79
+ const t = g() <= f.sm;
80
+ let e = !0;
81
+ (s = this.el.panel) != null && s.classList.contains("mint-tray") ? e = !1 : (l = this.el.panel) != null && l.classList.contains("mint-expand") || (e = !1), !t && e && this.setPanel(!1);
82
+ const a = ((c = (m = this.el.toggleButton) == null ? void 0 : m.getAttribute("aria-expanded")) == null ? void 0 : c.toLowerCase()) === "true";
83
+ let i = "auto";
84
+ a && (this.settings.tray ? t && (i = "hidden") : i = "hidden"), this.el.html && (this.el.html.style.overflow = i);
85
+ }
86
+ eWrapTab(t) {
87
+ var l;
88
+ const e = w(this.el.panel), a = e == null ? void 0 : e[(e == null ? void 0 : e.length) - 1], i = (e == null ? void 0 : e.length) > 1 && document.activeElement === a;
89
+ t.key.toLowerCase() === "tab" && !t.shiftKey && i && ((l = this.el.toggleButton) == null || l.focus(), document.activeElement === this.el.toggleButton && t.preventDefault());
90
+ }
91
+ eToggle() {
92
+ this.togglePanel();
93
+ }
94
+ eClose() {
95
+ this.setPanel(!1);
96
+ }
97
+ eTransitionEnd() {
98
+ var t;
99
+ ((t = this.el.wrapper) == null ? void 0 : t.classList.contains("mint-open")) === !1 && (this.el.wrapper.style.display = "none");
100
+ }
101
+ }
102
+ export {
103
+ B as Panel
104
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={xs:480,sm:768,md:1024,lg:1200,xl:1440};exports.breakpoints=e;
@@ -0,0 +1,11 @@
1
+ export declare const breakpoints: {
2
+ readonly xs: 480;
3
+ readonly sm: 768;
4
+ readonly md: 1024;
5
+ readonly lg: 1200;
6
+ readonly xl: 1440;
7
+ };
8
+ type BP = typeof breakpoints;
9
+ export type BreakpointKey = keyof BP;
10
+ export type Breakpoint = BP[BreakpointKey];
11
+ export {};
@@ -0,0 +1,10 @@
1
+ const s = {
2
+ xs: 480,
3
+ sm: 768,
4
+ md: 1024,
5
+ lg: 1200,
6
+ xl: 1440
7
+ };
8
+ export {
9
+ s as breakpoints
10
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=["top","right","bottom","left"];exports.sides=t;
@@ -0,0 +1,2 @@
1
+ export declare const sides: readonly ["top", "right", "bottom", "left"];
2
+ export type Side = (typeof sides)[number];
@@ -1,9 +1,9 @@
1
- const o = [
1
+ const t = [
2
2
  "top",
3
3
  "right",
4
4
  "bottom",
5
5
  "left"
6
6
  ];
7
7
  export {
8
- o as boxPositions
8
+ t as sides
9
9
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=300;exports.durationDefault=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=0,t=100,a={instant:e+t*0,fastest:e+t*1,faster:e+t*2,default:e+t*3,slower:e+t*4,slowest:e+t*5};exports.delay=a;exports.delayBase=e;exports.delayStep=t;
@@ -1 +1,10 @@
1
- export declare const durationDefault: 300;
1
+ export declare const delayBase: 0;
2
+ export declare const delayStep: 100;
3
+ export declare const delay: {
4
+ readonly instant: number;
5
+ readonly fastest: number;
6
+ readonly faster: number;
7
+ readonly default: number;
8
+ readonly slower: number;
9
+ readonly slowest: number;
10
+ };
@@ -1,4 +1,13 @@
1
- const t = 300;
1
+ const e = 0, a = 100, l = {
2
+ instant: 0,
3
+ fastest: 100,
4
+ faster: 200,
5
+ default: 300,
6
+ slower: 400,
7
+ slowest: 500
8
+ };
2
9
  export {
3
- t as durationDefault
10
+ l as delay,
11
+ e as delayBase,
12
+ a as delayStep
4
13
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../types/box.cjs.js"),l=require("../types/time.cjs.js");function h(t,{duration:s=l.durationDefault,from:e=r.boxPositions[0]}={}){if(!t)return;const i=e==="top"||e==="bottom",{scrollHeight:o,scrollWidth:n}=t;t.style.display="",requestAnimationFrame(()=>{i?t.style.height=`${o}px`:t.style.width=`${n}px`,setTimeout(()=>{i?t.style.height="auto":t.style.width="auto"},s)})}function u(t,{duration:s=l.durationDefault,from:e=r.boxPositions[0]}={}){if(!t)return;const i=e==="top"||e==="bottom",{scrollHeight:o,scrollWidth:n,style:{transition:a}}=t;t.style.transition="",requestAnimationFrame(()=>{i?t.style.height=`${o}px`:t.style.width=`${n}px`,t.style.transition=a,requestAnimationFrame(()=>{i?t.style.height="0":t.style.width="0"})}),setTimeout(()=>{t.style.display="none"},s)}exports.hideElement=u;exports.showElement=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../types/side.cjs.js"),r=require("../types/time.cjs.js");function y(t,{duration:s=r.delay.default,from:e=l.sides[0]}={}){if(!t)return;const i=e==="top"||e==="bottom";t.style.display="",requestAnimationFrame(()=>{const{scrollHeight:o,scrollWidth:n}=t;i?t.style.height=`${o}px`:t.style.width=`${n}px`,setTimeout(()=>{i?t.style.height="auto":t.style.width="auto"},s)})}function h(t,{duration:s=r.delay.default,from:e=l.sides[0]}={}){if(!t)return;const i=e==="top"||e==="bottom",{scrollHeight:o,scrollWidth:n,style:{transition:a}}=t;t.style.transition="",requestAnimationFrame(()=>{i?t.style.height=`${o}px`:t.style.width=`${n}px`,t.style.transition=a,requestAnimationFrame(()=>{i?t.style.height="0":t.style.width="0"})}),setTimeout(()=>{t.style.display="none"},s)}exports.hideElement=h;exports.showElement=y;
@@ -1,7 +1,7 @@
1
- import { BoxPosition } from '../types/box';
1
+ import { Side } from '../types/side';
2
2
  export interface TransitionProps {
3
3
  duration?: number;
4
- from?: BoxPosition;
4
+ from?: Side;
5
5
  }
6
6
  export declare function showElement(el?: HTMLElement | null, { duration, from, }?: TransitionProps): void;
7
7
  export declare function hideElement(el?: HTMLElement | null, { duration, from, }?: TransitionProps): void;
@@ -1,27 +1,28 @@
1
- import { boxPositions as r } from "../types/box.es.js";
2
- import { durationDefault as h } from "../types/time.es.js";
1
+ import { sides as r } from "../types/side.es.js";
2
+ import { delay as l } from "../types/time.es.js";
3
3
  function m(t, {
4
- duration: s = h,
4
+ duration: s = l.default,
5
5
  from: i = r[0]
6
6
  } = {}) {
7
7
  if (!t)
8
8
  return;
9
- const e = i === "top" || i === "bottom", { scrollHeight: o, scrollWidth: n } = t;
9
+ const e = i === "top" || i === "bottom";
10
10
  t.style.display = "", requestAnimationFrame(() => {
11
+ const { scrollHeight: o, scrollWidth: n } = t;
11
12
  e ? t.style.height = `${o}px` : t.style.width = `${n}px`, setTimeout(() => {
12
13
  e ? t.style.height = "auto" : t.style.width = "auto";
13
14
  }, s);
14
15
  });
15
16
  }
16
- function u(t, {
17
- duration: s = h,
17
+ function d(t, {
18
+ duration: s = l.default,
18
19
  from: i = r[0]
19
20
  } = {}) {
20
21
  if (!t)
21
22
  return;
22
- const e = i === "top" || i === "bottom", { scrollHeight: o, scrollWidth: n, style: { transition: l } } = t;
23
+ const e = i === "top" || i === "bottom", { scrollHeight: o, scrollWidth: n, style: { transition: a } } = t;
23
24
  t.style.transition = "", requestAnimationFrame(() => {
24
- e ? t.style.height = `${o}px` : t.style.width = `${n}px`, t.style.transition = l, requestAnimationFrame(() => {
25
+ e ? t.style.height = `${o}px` : t.style.width = `${n}px`, t.style.transition = a, requestAnimationFrame(() => {
25
26
  e ? t.style.height = "0" : t.style.width = "0";
26
27
  });
27
28
  }), setTimeout(() => {
@@ -29,6 +30,6 @@ function u(t, {
29
30
  }, s);
30
31
  }
31
32
  export {
32
- u as hideElement,
33
+ d as hideElement,
33
34
  m as showElement
34
35
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../types/time.cjs.js");function m(t,u=i.durationDefault){let e;return function(...l){e&&clearTimeout(e),e=Number(setTimeout(t,u,...l))}}function h(t,u=i.durationDefault){return m(t,u)}function g(t,u=i.durationDefault,e){let l,n,f,r,a=0,b=function(){a=(e==null?void 0:e.leading)===!1?0:new Date().getTime(),r=0,f=t.apply(l,n),r||(l=n=null)};return function(){let c=new Date().getTime();!a&&(e==null?void 0:e.leading)===!1&&(a=c);let d=u-c+a;return l=this,n=arguments,d<=0||d>u?(r&&(clearTimeout(r),r=0),a=c,f=t.apply(l,n),r||(l=n=null)):!r&&(e==null?void 0:e.trailing)!==!1&&(r=window.setTimeout(b,d)),f}}function o(t,u=i.durationDefault,e){return g(t,u,e)}exports.debounce=m;exports.debounceEvent=h;exports.throttle=g;exports.throttleEvent=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("../types/time.cjs.js");function m(t,l=f.delay.default){let e;return function(...r){e&&clearTimeout(e),e=Number(setTimeout(t,l,...r))}}function b(t,l=f.delay.default){return m(t,l)}function g(t,l=f.delay.default,e){let r,n,i,u,a=0,y=function(){a=(e==null?void 0:e.leading)===!1?0:new Date().getTime(),u=0,i=t.apply(r,n),u||(r=n=null)};return function(){let d=new Date().getTime();!a&&(e==null?void 0:e.leading)===!1&&(a=d);let c=l-d+a;return r=this,n=arguments,c<=0||c>l?(u&&(clearTimeout(u),u=0),a=d,i=t.apply(r,n),u||(r=n=null)):!u&&(e==null?void 0:e.trailing)!==!1&&(u=window.setTimeout(y,c)),i}}function h(t,l=f.delay.default,e){return g(t,l,e)}exports.debounce=m;exports.debounceEvent=b;exports.throttle=g;exports.throttleEvent=h;
@@ -1,26 +1,26 @@
1
- import { durationDefault as i } from "../types/time.es.js";
2
- function g(t, r = i) {
1
+ import { delay as a } from "../types/time.es.js";
2
+ function g(t, l = a.default) {
3
3
  let e;
4
4
  return function(...u) {
5
- e && clearTimeout(e), e = Number(setTimeout(t, r, ...u));
5
+ e && clearTimeout(e), e = Number(setTimeout(t, l, ...u));
6
6
  };
7
7
  }
8
- function b(t, r = i) {
9
- return g(t, r);
8
+ function b(t, l = a.default) {
9
+ return g(t, l);
10
10
  }
11
- function T(t, r = i, e) {
12
- let u, n, a, l, f = 0, d = function() {
13
- f = (e == null ? void 0 : e.leading) === !1 ? 0 : (/* @__PURE__ */ new Date()).getTime(), l = 0, a = t.apply(u, n), l || (u = n = null);
11
+ function T(t, l = a.default, e) {
12
+ let u, f, i, r, n = 0, c = function() {
13
+ n = (e == null ? void 0 : e.leading) === !1 ? 0 : (/* @__PURE__ */ new Date()).getTime(), r = 0, i = t.apply(u, f), r || (u = f = null);
14
14
  };
15
15
  return function() {
16
16
  let m = (/* @__PURE__ */ new Date()).getTime();
17
- !f && (e == null ? void 0 : e.leading) === !1 && (f = m);
18
- let c = r - m + f;
19
- return u = this, n = arguments, c <= 0 || c > r ? (l && (clearTimeout(l), l = 0), f = m, a = t.apply(u, n), l || (u = n = null)) : !l && (e == null ? void 0 : e.trailing) !== !1 && (l = window.setTimeout(d, c)), a;
17
+ !n && (e == null ? void 0 : e.leading) === !1 && (n = m);
18
+ let d = l - m + n;
19
+ return u = this, f = arguments, d <= 0 || d > l ? (r && (clearTimeout(r), r = 0), n = m, i = t.apply(u, f), r || (u = f = null)) : !r && (e == null ? void 0 : e.trailing) !== !1 && (r = window.setTimeout(c, d)), i;
20
20
  };
21
21
  }
22
- function v(t, r = i, e) {
23
- return T(t, r, e);
22
+ function v(t, l = a.default, e) {
23
+ return T(t, l, e);
24
24
  }
25
25
  export {
26
26
  g as debounce,
@@ -0,0 +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;
@@ -0,0 +1,115 @@
1
+ /**
2
+ * The library name that will be added as a prefix
3
+ */
4
+ export declare const lib: "mint";
5
+ /**
6
+ * The prefix built from the library name
7
+ */
8
+ export declare const pre: "mint-";
9
+ /**
10
+ * CSS-selector for disabled elements
11
+ */
12
+ export declare const disabled: "[disabled]";
13
+ /**
14
+ * CSS-selector for elements with an aria-controls attribute
15
+ */
16
+ export declare const hasControls: "[aria-controls]";
17
+ /**
18
+ * CSS-selector for elements with an aria-expanded attribute
19
+ */
20
+ export declare const hasExpanded: "[aria-expanded]";
21
+ /**
22
+ * CSS-selector for elements with an href attribute
23
+ */
24
+ export declare const hasLink: "[href]";
25
+ /**
26
+ * CSS-selector for elements with a routerLink attribute
27
+ * @summary - the routerLink attribute is used in Angular
28
+ */
29
+ export declare const hasRouterLink: "[routerLink]";
30
+ /**
31
+ * CSS-selector for elements with an id attribute
32
+ */
33
+ export declare const hasId: "[id]";
34
+ /**
35
+ * CSS-selector for submenu buttons
36
+ */
37
+ export declare const subMenuButtons: "button[aria-controls]";
38
+ /**
39
+ * CSS-selector for submenus
40
+ */
41
+ export declare const subMenu: "button[aria-controls] + ul[id]";
42
+ /**
43
+ * CSS-selector for elements that aren't tabbable (i.e. tabindex is negative)
44
+ */
45
+ export declare const notTabbable: "[tabindex^=\"-\"]";
46
+ /**
47
+ * CSS-selector for elements that are tabbable (i.e. tabindex isn't negative)
48
+ */
49
+ export declare const tabbable: `[tabindex]${string}`;
50
+ /**
51
+ * CSS-selector for elements that can receive focus
52
+ */
53
+ export declare const focusable: string;
54
+ /**
55
+ * Adds the library prefix to the beginning of the provided string
56
+ * @param base - the string to be prefixed
57
+ * @returns - the provided string prefixed with the library name
58
+ */
59
+ export declare function prefix(base: string): string;
60
+ /**
61
+ * Adds two dashes to the beginning of the provided string
62
+ * @param base - the string to be prefixed
63
+ * @returns - the provided string prefixed with two dashes
64
+ */
65
+ export declare function cssPrefix(base: string): string;
66
+ /**
67
+ * Turns the provided string into a CSS variable call
68
+ * @param base - the name of the CSS variable to call
69
+ * @returns - the CSS variable call for the provided string
70
+ */
71
+ export declare function cssVar(base: string): string;
72
+ /**
73
+ * Negates the provided CSS selector
74
+ * @param base - the CSS selector to negate
75
+ * @returns - the negated CSS selector
76
+ */
77
+ export declare function not(base: string): string;
78
+ /**
79
+ * Generates a class CSS selector
80
+ * @param base - the name of the class to generate
81
+ * @returns - the generated CSS selector
82
+ */
83
+ export declare function className(base: string): string;
84
+ /**
85
+ * Generates an id CSS selector
86
+ * @param base - the name of the id to generate
87
+ * @returns - the generated CSS selector
88
+ */
89
+ export declare function id(base: string): string;
90
+ /**
91
+ * Generates an aria-controls CSS selector
92
+ * @param id - the id of the controlled element
93
+ * @returns - the generated CSS selector
94
+ */
95
+ export declare function controls(id?: string | null): string;
96
+ /**
97
+ * Generates an aria-expanded CSS selector
98
+ * @param bool - whether the element is expanded or not
99
+ * @returns - the generated CSS selector
100
+ */
101
+ export declare function expanded(bool?: boolean | null): string;
102
+ /**
103
+ * Returns a NodeList of HTMLElements within the given element that are focusable
104
+ * @param el - the element whose focusable children will be returned
105
+ * @returns - the elements within the given element that are focusable
106
+ */
107
+ export declare function getFocusables(el?: HTMLElement | null): HTMLElement[];
108
+ /**
109
+ * Returns true if an element is focusable and false if not,
110
+ * based on styles (i.e. a parent has display: none;)
111
+ * NOTE: Still need to determine what other styles may make an element un-focusable
112
+ * @param el - the element
113
+ * @returns - true if the element is focusable; false if not
114
+ */
115
+ export declare function isFocusable(el: HTMLElement): boolean;
@@ -0,0 +1,69 @@
1
+ const $ = "mint", u = `${$}-`, o = "[disabled]", l = "[aria-controls]", d = "[aria-expanded]", c = "[href]", f = "[routerLink]", p = "[id]", b = `button${l}`, m = `${b} + ul${p}`, r = '[tabindex^="-"]', x = `[tabindex]${e(r)}`, i = `input${e(o)}${e(r)},
2
+ select${e(o)}${e(r)},
3
+ textarea${e(o)}${e(r)},
4
+ button${e(o)}${e(r)},
5
+ object${e(o)}${e(r)},
6
+ a${c}, a${f},
7
+ area${c}, ${x}`.replace(/\s/g, "");
8
+ function a(t) {
9
+ return t = t.toLowerCase(), t.startsWith(u) ? t : `${u}${t}`;
10
+ }
11
+ function y(t) {
12
+ return `--${a(t.replace(/^-+/, ""))}`;
13
+ }
14
+ function w(t) {
15
+ return `var(${y(t)})`;
16
+ }
17
+ function e(t) {
18
+ return `:not(${t})`;
19
+ }
20
+ function L(t) {
21
+ return `.${a(t)}`;
22
+ }
23
+ function g(t) {
24
+ return `#${a(t)}`;
25
+ }
26
+ function A(t) {
27
+ return t ? `[aria-controls="${a(t)}"]` : l;
28
+ }
29
+ function C(t) {
30
+ return typeof t == "boolean" ? `[aria-expanded="${t}"]` : d;
31
+ }
32
+ function k(t) {
33
+ let n;
34
+ return t ? n = Array.from(t.querySelectorAll(i)) : n = Array.from(document.querySelectorAll(i)), n.filter((s) => h(s));
35
+ }
36
+ function h(t) {
37
+ let n = t;
38
+ do {
39
+ if (window.getComputedStyle(n).getPropertyValue("display").toLowerCase() === "none")
40
+ return !1;
41
+ n = n.parentElement;
42
+ } while (n);
43
+ return !0;
44
+ }
45
+ export {
46
+ L as className,
47
+ A as controls,
48
+ y as cssPrefix,
49
+ w as cssVar,
50
+ o as disabled,
51
+ C as expanded,
52
+ i as focusable,
53
+ k as getFocusables,
54
+ l as hasControls,
55
+ d as hasExpanded,
56
+ p as hasId,
57
+ c as hasLink,
58
+ f as hasRouterLink,
59
+ g as id,
60
+ h as isFocusable,
61
+ $ as lib,
62
+ e as not,
63
+ r as notTabbable,
64
+ u as pre,
65
+ a as prefix,
66
+ m as subMenu,
67
+ b as subMenuButtons,
68
+ x as tabbable
69
+ };
package/package.json CHANGED
@@ -1,69 +1,60 @@
1
1
  {
2
- "name": "@appartmint/tsm-mint",
3
- "author": "App Art Mint LLC",
4
- "version": "0.0.5",
5
- "license": "MIT",
6
- "description": "TypeScript Modules from App Art Mint LLC",
7
- "keywords": [
8
- "typescript",
9
- "modules",
10
- "app art mint",
11
- "appartmint"
12
- ],
13
- "homepage": "https://github.com/App-Art-Mint/tsm-mint#readme",
14
- "repository": {
15
- "type": "git",
16
- "url": "git+https://github.com/App-Art-Mint/tsm-mint.git"
17
- },
18
- "bugs": {
19
- "url": "https://github.com/App-Art-Mint/tsm-mint/issues"
20
- },
21
- "type": "module",
22
- "module": "dist/index.es.js",
23
- "main": "dist/index.cjs.js",
24
- "types": "dist/index.d.ts",
25
- "exports": {
26
- ".": {
27
- "types": "./dist/index.d.ts",
28
- "import": "./dist/index.es.js",
29
- "require": "./dist/index.cjs.js",
30
- "default": "./dist/index.es.js"
31
- },
32
- "./*": {
33
- "types": "./dist/*.d.ts",
34
- "import": "./dist/*.es.js",
35
- "require": "./dist/*.cjs.js",
36
- "default": "./dist/*.es.js"
37
- }
38
- },
39
- "files": [
40
- "dist/**/*.{js,d.ts}"
41
- ],
42
- "publishConfig": {
43
- "access": "public"
44
- },
45
- "scripts": {
46
- "version": "npm i && git add -A",
47
- "postversion": "git push && git push --tags && cross-replace gh release create \"v$npm_package_version\" --generate-notes",
48
- "prepare": "run-s build",
49
- "build": "run-p test:types build:prod --",
50
- "build:prod": "vite build",
51
- "clean": "rimraf dist",
52
- "test:types": "tsc -b",
53
- "test:circular": "madge --circular --extensions ts .",
54
- "lint": "eslint --fix ."
55
- },
56
- "devDependencies": {
57
- "@types/node": "^24.9.2",
58
- "cross-replace": "^0.2.0",
59
- "eslint": "^9.39.0",
60
- "glob": "^11.0.3",
61
- "madge": "^8.0.0",
62
- "npm-run-all2": "^8.0.4",
63
- "rimraf": "^6.1.0",
64
- "typescript": "^5.9.3",
65
- "typescript-eslint": "^8.46.2",
66
- "vite": "^6.4.1",
67
- "vite-plugin-dts": "^4.5.4"
68
- }
2
+ "name": "@appartmint/tsm-mint",
3
+ "author": "App Art Mint LLC",
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "description": "TypeScript Modules from App Art Mint LLC",
8
+ "keywords": [
9
+ "typescript",
10
+ "modules",
11
+ "app art mint",
12
+ "appartmint"
13
+ ],
14
+ "homepage": "https://github.com/App-Art-Mint/tsm-mint#readme",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/App-Art-Mint/tsm-mint.git"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/App-Art-Mint/tsm-mint/issues"
21
+ },
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "files": [
26
+ "dist/**/*.{js,d.ts}"
27
+ ],
28
+ "exports": {
29
+ "./*": {
30
+ "types": "./dist/*.d.ts",
31
+ "import": "./dist/*.es.js",
32
+ "require": "./dist/*.cjs.js",
33
+ "default": "./dist/*.es.js"
34
+ }
35
+ },
36
+ "scripts": {
37
+ "version": "npm i && git add -A",
38
+ "postversion": "git push && git push --tags && cross-replace gh release create \"v$npm_package_version\" --generate-notes",
39
+ "prepare": "run-s build",
40
+ "build": "run-p test:types build:prod",
41
+ "build:prod": "vite build",
42
+ "clean": "rimraf dist",
43
+ "test:types": "tsc -b",
44
+ "test:circular": "madge --circular --extensions ts .",
45
+ "lint": "eslint --fix ."
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^24.9.2",
49
+ "cross-replace": "^0.2.0",
50
+ "eslint": "^9.39.0",
51
+ "glob": "^11.0.3",
52
+ "madge": "^8.0.0",
53
+ "npm-run-all2": "^8.0.4",
54
+ "rimraf": "^6.1.0",
55
+ "typescript": "^5.9.3",
56
+ "typescript-eslint": "^8.46.2",
57
+ "vite": "^6.4.1",
58
+ "vite-plugin-dts": "^4.5.4"
59
+ }
69
60
  }
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./attaches-events.cjs.js");exports.AttachesEvents=t.AttachesEvents;
@@ -1 +0,0 @@
1
- export * from './attaches-events';
@@ -1,4 +0,0 @@
1
- import { AttachesEvents as o } from "./attaches-events.es.js";
2
- export {
3
- o as AttachesEvents
4
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("../util/math.cjs.js"),i=[1,2,3,4],r=i[0],t=i[i.length-1];function e(u){return n.clamp(u,r,t)}exports.gridNum=e;exports.gridNumMax=t;exports.gridNumMin=r;exports.gridNums=i;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./grid.cjs.js"),i=require("./title.cjs.js");exports.gridNum=t.gridNum;exports.gridNumMax=t.gridNumMax;exports.gridNumMin=t.gridNumMin;exports.gridNums=t.gridNums;exports.titleNum=i.titleNum;exports.titleNumMax=i.titleNumMax;exports.titleNumMin=i.titleNumMin;exports.titleNums=i.titleNums;
@@ -1,2 +0,0 @@
1
- export * from './grid';
2
- export * from './title';
@@ -1,12 +0,0 @@
1
- import { gridNum as t, gridNumMax as r, gridNumMin as u, gridNums as N } from "./grid.es.js";
2
- import { titleNum as d, titleNumMax as g, titleNumMin as l, titleNums as o } from "./title.es.js";
3
- export {
4
- t as gridNum,
5
- r as gridNumMax,
6
- u as gridNumMin,
7
- N as gridNums,
8
- d as titleNum,
9
- g as titleNumMax,
10
- l as titleNumMin,
11
- o as titleNums
12
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../util/math.cjs.js"),t=[1,2,3,4,5,6],e=t[0],i=t[t.length-1];function n(u){return l.clamp(u,e,i)}exports.titleNum=n;exports.titleNumMax=i;exports.titleNumMin=e;exports.titleNums=t;
package/dist/index.cjs.js DELETED
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./abstract/attaches-events.cjs.js"),e=require("./components/grid.cjs.js"),i=require("./components/title.cjs.js"),a=require("./types/box.cjs.js"),m=require("./types/time.cjs.js"),c=require("./util/async.cjs.js"),s=require("./util/display.cjs.js"),n=require("./util/event.cjs.js"),r=require("./util/math.cjs.js"),o=require("./util/scroll.cjs.js"),t=require("./util/text.cjs.js"),l=require("./util/window.cjs.js");exports.AttachesEvents=u.AttachesEvents;exports.gridNum=e.gridNum;exports.gridNumMax=e.gridNumMax;exports.gridNumMin=e.gridNumMin;exports.gridNums=e.gridNums;exports.titleNum=i.titleNum;exports.titleNumMax=i.titleNumMax;exports.titleNumMin=i.titleNumMin;exports.titleNums=i.titleNums;exports.boxPositions=a.boxPositions;exports.durationDefault=m.durationDefault;exports.wait=c.wait;exports.hideElement=s.hideElement;exports.showElement=s.showElement;exports.debounce=n.debounce;exports.debounceEvent=n.debounceEvent;exports.throttle=n.throttle;exports.throttleEvent=n.throttleEvent;exports.clamp=r.clamp;exports.randomInt=r.randomInt;exports.scrollTo=o.scrollTo;exports.showElements=o.showElements;exports.showElementsOnScroll=o.showElementsOnScroll;exports.copyText=t.copyText;exports.formatPhone=t.formatPhone;exports.generateId=t.generateId;exports.isEmail=t.isEmail;exports.isImage=t.isImage;exports.isVideo=t.isVideo;exports.plural=t.plural;exports.slug=t.slug;exports.titleCase=t.titleCase;exports.truncate=t.truncate;exports.unslug=t.unslug;exports.windowHeight=l.windowHeight;exports.windowWidth=l.windowWidth;
package/dist/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './abstract';
2
- export * from './components';
3
- export * from './types';
4
- export * from './util';
package/dist/index.es.js DELETED
@@ -1,50 +0,0 @@
1
- import { AttachesEvents as o } from "./abstract/attaches-events.es.js";
2
- import { gridNum as m, gridNumMax as i, gridNumMin as l, gridNums as n } from "./components/grid.es.js";
3
- import { titleNum as u, titleNumMax as x, titleNumMin as a, titleNums as p } from "./components/title.es.js";
4
- import { boxPositions as f } from "./types/box.es.js";
5
- import { durationDefault as g } from "./types/time.es.js";
6
- import { wait as w } from "./util/async.es.js";
7
- import { hideElement as N, showElement as M } from "./util/display.es.js";
8
- import { debounce as v, debounceEvent as I, throttle as P, throttleEvent as T } from "./util/event.es.js";
9
- import { clamp as A, randomInt as C } from "./util/math.es.js";
10
- import { scrollTo as H, showElements as O, showElementsOnScroll as S } from "./util/scroll.es.js";
11
- import { copyText as W, formatPhone as j, generateId as k, isEmail as q, isImage as z, isVideo as B, plural as F, slug as G, titleCase as J, truncate as K, unslug as L } from "./util/text.es.js";
12
- import { windowHeight as R, windowWidth as U } from "./util/window.es.js";
13
- export {
14
- o as AttachesEvents,
15
- f as boxPositions,
16
- A as clamp,
17
- W as copyText,
18
- v as debounce,
19
- I as debounceEvent,
20
- g as durationDefault,
21
- j as formatPhone,
22
- k as generateId,
23
- m as gridNum,
24
- i as gridNumMax,
25
- l as gridNumMin,
26
- n as gridNums,
27
- N as hideElement,
28
- q as isEmail,
29
- z as isImage,
30
- B as isVideo,
31
- F as plural,
32
- C as randomInt,
33
- H as scrollTo,
34
- M as showElement,
35
- O as showElements,
36
- S as showElementsOnScroll,
37
- G as slug,
38
- P as throttle,
39
- T as throttleEvent,
40
- J as titleCase,
41
- u as titleNum,
42
- x as titleNumMax,
43
- a as titleNumMin,
44
- p as titleNums,
45
- K as truncate,
46
- L as unslug,
47
- w as wait,
48
- R as windowHeight,
49
- U as windowWidth
50
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=["top","right","bottom","left"];exports.boxPositions=o;
@@ -1,2 +0,0 @@
1
- export declare const boxPositions: readonly ["top", "right", "bottom", "left"];
2
- export type BoxPosition = (typeof boxPositions)[number];
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./box.cjs.js"),e=require("./time.cjs.js");exports.boxPositions=t.boxPositions;exports.durationDefault=e.durationDefault;
@@ -1,2 +0,0 @@
1
- export * from './box';
2
- export * from './time';
@@ -1,6 +0,0 @@
1
- import { boxPositions as t } from "./box.es.js";
2
- import { durationDefault as f } from "./time.es.js";
3
- export {
4
- t as boxPositions,
5
- f as durationDefault
6
- };
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./async.cjs.js"),o=require("./display.cjs.js"),t=require("./event.cjs.js"),n=require("./math.cjs.js"),l=require("./scroll.cjs.js"),e=require("./text.cjs.js"),i=require("./window.cjs.js");exports.wait=r.wait;exports.hideElement=o.hideElement;exports.showElement=o.showElement;exports.debounce=t.debounce;exports.debounceEvent=t.debounceEvent;exports.throttle=t.throttle;exports.throttleEvent=t.throttleEvent;exports.clamp=n.clamp;exports.randomInt=n.randomInt;exports.scrollTo=l.scrollTo;exports.showElements=l.showElements;exports.showElementsOnScroll=l.showElementsOnScroll;exports.copyText=e.copyText;exports.formatPhone=e.formatPhone;exports.generateId=e.generateId;exports.isEmail=e.isEmail;exports.isImage=e.isImage;exports.isVideo=e.isVideo;exports.plural=e.plural;exports.slug=e.slug;exports.titleCase=e.titleCase;exports.truncate=e.truncate;exports.unslug=e.unslug;exports.windowHeight=i.windowHeight;exports.windowWidth=i.windowWidth;
@@ -1,7 +0,0 @@
1
- export * from './async';
2
- export * from './display';
3
- export * from './event';
4
- export * from './math';
5
- export * from './scroll';
6
- export * from './text';
7
- export * from './window';
@@ -1,34 +0,0 @@
1
- import { wait as t } from "./async.es.js";
2
- import { hideElement as l, showElement as n } from "./display.es.js";
3
- import { debounce as i, debounceEvent as s, throttle as a, throttleEvent as p } from "./event.es.js";
4
- import { clamp as h, randomInt as f } from "./math.es.js";
5
- import { scrollTo as x, showElements as c, showElementsOnScroll as u } from "./scroll.es.js";
6
- import { copyText as g, formatPhone as I, generateId as b, isEmail as v, isImage as T, isVideo as y, plural as C, slug as H, titleCase as O, truncate as P, unslug as S } from "./text.es.js";
7
- import { windowHeight as W, windowWidth as j } from "./window.es.js";
8
- export {
9
- h as clamp,
10
- g as copyText,
11
- i as debounce,
12
- s as debounceEvent,
13
- I as formatPhone,
14
- b as generateId,
15
- l as hideElement,
16
- v as isEmail,
17
- T as isImage,
18
- y as isVideo,
19
- C as plural,
20
- f as randomInt,
21
- x as scrollTo,
22
- n as showElement,
23
- c as showElements,
24
- u as showElementsOnScroll,
25
- H as slug,
26
- a as throttle,
27
- p as throttleEvent,
28
- O as titleCase,
29
- P as truncate,
30
- S as unslug,
31
- t as wait,
32
- W as windowHeight,
33
- j as windowWidth
34
- };