@appartmint/tsm-mint 0.1.0 → 0.1.2

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.
@@ -1 +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;
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 u=require("../../types/breakpoints.cjs.js"),g=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:g.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-${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()<=u.breakpoints.sm,l="auto";this.settings.tray?s&&(l="hidden"):l="hidden",this.el.html.style.overflow=l}},this.settings.from===g.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,p,m;const t=f.windowWidth()<=u.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=((m=(p=this.el.toggleButton)==null?void 0:p.getAttribute("aria-expanded"))==null?void 0:m.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;
@@ -1,8 +1,8 @@
1
1
  var y = Object.defineProperty;
2
2
  var E = (r, n, t) => n in r ? y(r, n, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[n] = t;
3
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";
4
+ import { breakpoints as c } from "../../types/breakpoints.es.js";
5
+ import { sides as f } from "../../types/side.es.js";
6
6
  import { delay as o } from "../../types/time.es.js";
7
7
  import { AttachesEvents as v } from "../../abstract/attaches-events.es.js";
8
8
  import { windowWidth as g } from "../../util/window.es.js";
@@ -13,7 +13,7 @@ class B extends v {
13
13
  super();
14
14
  d(this, "settings", {
15
15
  title: "panel",
16
- from: p[0],
16
+ from: f[0],
17
17
  fixed: !0
18
18
  });
19
19
  d(this, "el", {});
@@ -41,7 +41,7 @@ class B extends v {
41
41
  }
42
42
  addClasses() {
43
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"));
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-${this.settings.from.toLowerCase()}`)), this.settings.tray && ((l = this.el.panel) == null || l.classList.add("mint-tray"));
45
45
  }
46
46
  setPanel(t = !1) {
47
47
  var i;
@@ -55,10 +55,10 @@ class B extends v {
55
55
  behavior: "smooth"
56
56
  }), setTimeout(() => {
57
57
  if (this.el.html) {
58
- let s = g() <= f.sm, l = "auto";
58
+ let s = g() <= c.sm, l = "auto";
59
59
  this.settings.tray ? s && (l = "hidden") : l = "hidden", this.el.html.style.overflow = l;
60
60
  }
61
- }, this.settings.from === p[3] ? o.default : o.instant), this.el.wrapper && (this.el.wrapper.style.display = "flex"), requestAnimationFrame(() => {
61
+ }, this.settings.from === f[3] ? o.default : o.instant), this.el.wrapper && (this.el.wrapper.style.display = "flex"), requestAnimationFrame(() => {
62
62
  var s;
63
63
  (s = this.el.wrapper) == null || s.classList.add("mint-open");
64
64
  })) : (this.el.html && (this.el.html.style.overflow = "auto"), requestAnimationFrame(() => {
@@ -75,11 +75,11 @@ class B extends v {
75
75
  e == null || e.click();
76
76
  }
77
77
  eHandleResize() {
78
- var s, l, m, c;
79
- const t = g() <= f.sm;
78
+ var s, l, p, m;
79
+ const t = g() <= c.sm;
80
80
  let e = !0;
81
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";
82
+ const a = ((m = (p = this.el.toggleButton) == null ? void 0 : p.getAttribute("aria-expanded")) == null ? void 0 : m.toLowerCase()) === "true";
83
83
  let i = "auto";
84
84
  a && (this.settings.tray ? t && (i = "hidden") : i = "hidden"), this.el.html && (this.el.html.style.overflow = i);
85
85
  }
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.1.0",
4
+ "version": "0.1.2",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "description": "TypeScript Modules from App Art Mint LLC",