@appartmint/tsm-mint 0.0.1 → 0.0.3

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 (39) hide show
  1. package/dist/components/grid.cjs.js +1 -1
  2. package/dist/components/grid.d.ts +5 -3
  3. package/dist/components/grid.es.js +8 -7
  4. package/dist/components/index.cjs.js +1 -1
  5. package/dist/components/index.d.ts +1 -1
  6. package/dist/components/index.es.js +9 -7
  7. package/dist/components/title.cjs.js +1 -0
  8. package/dist/components/title.d.ts +5 -0
  9. package/dist/components/title.es.js +11 -0
  10. package/dist/index.cjs.js +1 -1
  11. package/dist/index.es.js +48 -17
  12. package/dist/types/index.cjs.js +1 -1
  13. package/dist/types/index.d.ts +1 -0
  14. package/dist/types/index.es.js +4 -2
  15. package/dist/types/time.cjs.js +1 -0
  16. package/dist/types/time.d.ts +1 -0
  17. package/dist/types/time.es.js +4 -0
  18. package/dist/util/display.cjs.js +1 -0
  19. package/dist/util/display.d.ts +8 -0
  20. package/dist/util/display.es.js +36 -0
  21. package/dist/util/event.cjs.js +1 -0
  22. package/dist/util/event.d.ts +8 -0
  23. package/dist/util/event.es.js +30 -0
  24. package/dist/util/index.cjs.js +1 -1
  25. package/dist/util/index.d.ts +5 -0
  26. package/dist/util/index.es.js +32 -5
  27. package/dist/util/scroll.cjs.js +1 -0
  28. package/dist/util/scroll.d.ts +12 -0
  29. package/dist/util/scroll.es.js +31 -0
  30. package/dist/util/text.cjs.js +8 -0
  31. package/dist/util/text.d.ts +55 -0
  32. package/dist/util/text.es.js +81 -0
  33. package/dist/util/window.cjs.js +1 -0
  34. package/dist/util/window.d.ts +10 -0
  35. package/dist/util/window.es.js +12 -0
  36. package/package.json +1 -1
  37. package/dist/components/header.cjs.js +0 -1
  38. package/dist/components/header.d.ts +0 -3
  39. package/dist/components/header.es.js +0 -10
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../util/math.cjs.js"),i=1,r=4;function e(t){return u.clamp(t,i,r)}exports.gridNum=e;exports.gridNumMax=r;exports.gridNumMin=i;
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,3 +1,5 @@
1
- export declare const gridNumMin: 1;
2
- export declare const gridNumMax: 4;
3
- export declare function gridNum(num?: number): number;
1
+ export declare const gridNums: readonly [1, 2, 3, 4];
2
+ export type GridNum = typeof gridNums[number];
3
+ export declare const gridNumMin: GridNum;
4
+ export declare const gridNumMax: GridNum;
5
+ export declare function gridNum(num?: number): GridNum;
@@ -1,10 +1,11 @@
1
- import { clamp as i } from "../util/math.es.js";
2
- const m = 1, n = 4;
3
- function t(r) {
4
- return i(r, m, n);
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
5
  }
6
6
  export {
7
- t as gridNum,
8
- n as gridNumMax,
9
- m as gridNumMin
7
+ u as gridNum,
8
+ m as gridNumMax,
9
+ i as gridNumMin,
10
+ r as gridNums
10
11
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./grid.cjs.js"),r=require("./header.cjs.js");exports.gridNum=e.gridNum;exports.gridNumMax=e.gridNumMax;exports.gridNumMin=e.gridNumMin;exports.headerNum=r.headerNum;exports.headerNumMax=r.headerNumMax;exports.headerNumMin=r.headerNumMin;
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 +1,2 @@
1
1
  export * from './grid';
2
- export * from './header';
2
+ export * from './title';
@@ -1,10 +1,12 @@
1
- import { gridNum as m, gridNumMax as d, gridNumMin as u } from "./grid.es.js";
2
- import { headerNum as a, headerNumMax as i, headerNumMin as o } from "./header.es.js";
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
3
  export {
4
- m as gridNum,
5
- d as gridNumMax,
4
+ t as gridNum,
5
+ r as gridNumMax,
6
6
  u as gridNumMin,
7
- a as headerNum,
8
- i as headerNumMax,
9
- o as headerNumMin
7
+ N as gridNums,
8
+ d as titleNum,
9
+ g as titleNumMax,
10
+ l as titleNumMin,
11
+ o as titleNums
10
12
  };
@@ -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;
@@ -0,0 +1,5 @@
1
+ export declare const titleNums: readonly [1, 2, 3, 4, 5, 6];
2
+ export type TitleNum = typeof titleNums[number];
3
+ export declare const titleNumMin: TitleNum;
4
+ export declare const titleNumMax: TitleNum;
5
+ export declare function titleNum(num?: number): TitleNum;
@@ -0,0 +1,11 @@
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
+ };
package/dist/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./abstract/attaches-events.cjs.js"),e=require("./components/grid.cjs.js"),t=require("./components/header.cjs.js"),a=require("./types/box.cjs.js"),n=require("./util/async.cjs.js"),r=require("./util/math.cjs.js");exports.AttachesEvents=i.AttachesEvents;exports.gridNum=e.gridNum;exports.gridNumMax=e.gridNumMax;exports.gridNumMin=e.gridNumMin;exports.headerNum=t.headerNum;exports.headerNumMax=t.headerNumMax;exports.headerNumMin=t.headerNumMin;exports.boxPositions=a.boxPositions;exports.wait=n.wait;exports.clamp=r.clamp;exports.randomInt=r.randomInt;
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.es.js CHANGED
@@ -1,19 +1,50 @@
1
- import { AttachesEvents as e } from "./abstract/attaches-events.es.js";
2
- import { gridNum as t, gridNumMax as a, gridNumMin as x } from "./components/grid.es.js";
3
- import { headerNum as d, headerNumMax as p, headerNumMin as f } from "./components/header.es.js";
4
- import { boxPositions as u } from "./types/box.es.js";
5
- import { wait as h } from "./util/async.es.js";
6
- import { clamp as M, randomInt as g } from "./util/math.es.js";
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";
7
13
  export {
8
- e as AttachesEvents,
9
- u as boxPositions,
10
- M as clamp,
11
- t as gridNum,
12
- a as gridNumMax,
13
- x as gridNumMin,
14
- d as headerNum,
15
- p as headerNumMax,
16
- f as headerNumMin,
17
- g as randomInt,
18
- h as wait
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
19
50
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./box.cjs.js");exports.boxPositions=o.boxPositions;
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 +1,2 @@
1
1
  export * from './box';
2
+ export * from './time';
@@ -1,4 +1,6 @@
1
- import { boxPositions as r } from "./box.es.js";
1
+ import { boxPositions as t } from "./box.es.js";
2
+ import { durationDefault as f } from "./time.es.js";
2
3
  export {
3
- r as boxPositions
4
+ t as boxPositions,
5
+ f as durationDefault
4
6
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=300;exports.durationDefault=t;
@@ -0,0 +1 @@
1
+ export declare const durationDefault: 300;
@@ -0,0 +1,4 @@
1
+ const t = 300;
2
+ export {
3
+ t as durationDefault
4
+ };
@@ -0,0 +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({el: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({el: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;
@@ -0,0 +1,8 @@
1
+ import { BoxPosition } from '../types/box';
2
+ export interface TransitionProps {
3
+ el?: HTMLElement | null;
4
+ duration: number;
5
+ from: BoxPosition;
6
+ }
7
+ export declare function showElement({ el, duration, from, }: TransitionProps): void;
8
+ export declare function hideElement({ el, duration, from, }: TransitionProps): void;
@@ -0,0 +1,36 @@
1
+ import { boxPositions as r } from "../types/box.es.js";
2
+ import { durationDefault as h } from "../types/time.es.js";
3
+ function m({
4
+ el: t,
5
+ duration: s = h,
6
+ from: i = r[0]
7
+ }) {
8
+ if (!t)
9
+ return;
10
+ const e = i === "top" || i === "bottom", { scrollHeight: o, scrollWidth: n } = t;
11
+ t.style.display = "", requestAnimationFrame(() => {
12
+ e ? t.style.height = `${o}px` : t.style.width = `${n}px`, setTimeout(() => {
13
+ e ? t.style.height = "auto" : t.style.width = "auto";
14
+ }, s);
15
+ });
16
+ }
17
+ function u({
18
+ el: t,
19
+ duration: s = h,
20
+ from: i = r[0]
21
+ }) {
22
+ if (!t)
23
+ return;
24
+ const e = i === "top" || i === "bottom", { scrollHeight: o, scrollWidth: n, style: { transition: l } } = t;
25
+ t.style.transition = "", requestAnimationFrame(() => {
26
+ e ? t.style.height = `${o}px` : t.style.width = `${n}px`, t.style.transition = l, requestAnimationFrame(() => {
27
+ e ? t.style.height = "0" : t.style.width = "0";
28
+ });
29
+ }), setTimeout(() => {
30
+ t.style.display = "none";
31
+ }, s);
32
+ }
33
+ export {
34
+ u as hideElement,
35
+ m as showElement
36
+ };
@@ -0,0 +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;
@@ -0,0 +1,8 @@
1
+ export declare function debounce<T extends (...args: Parameters<T>) => ReturnType<T>>(func: T, wait?: number): (...args: Parameters<T>) => void;
2
+ export declare function debounceEvent<T extends (e: Event) => ReturnType<T>>(func: T, wait?: number): EventListener;
3
+ export declare function throttle(func: Function, wait?: number, options?: {
4
+ [key: string]: boolean;
5
+ }): Function;
6
+ export declare function throttleEvent(func: Function, wait?: number, options?: {
7
+ [key: string]: boolean;
8
+ }): EventListener;
@@ -0,0 +1,30 @@
1
+ import { durationDefault as i } from "../types/time.es.js";
2
+ function g(t, r = i) {
3
+ let e;
4
+ return function(...u) {
5
+ e && clearTimeout(e), e = Number(setTimeout(t, r, ...u));
6
+ };
7
+ }
8
+ function b(t, r = i) {
9
+ return g(t, r);
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);
14
+ };
15
+ return function() {
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;
20
+ };
21
+ }
22
+ function v(t, r = i, e) {
23
+ return T(t, r, e);
24
+ }
25
+ export {
26
+ g as debounce,
27
+ b as debounceEvent,
28
+ T as throttle,
29
+ v as throttleEvent
30
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./async.cjs.js"),t=require("./math.cjs.js");exports.wait=e.wait;exports.clamp=t.clamp;exports.randomInt=t.randomInt;
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,2 +1,7 @@
1
1
  export * from './async';
2
+ export * from './display';
3
+ export * from './event';
2
4
  export * from './math';
5
+ export * from './scroll';
6
+ export * from './text';
7
+ export * from './window';
@@ -1,7 +1,34 @@
1
- import { wait as m } from "./async.es.js";
2
- import { clamp as a, randomInt as p } from "./math.es.js";
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";
3
8
  export {
4
- a as clamp,
5
- p as randomInt,
6
- m as wait
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
7
34
  };
@@ -0,0 +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(()=>{let 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;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Scroll to the top of the page
3
+ */
4
+ export declare function scrollTo(to: number | 'top' | 'bottom'): void;
5
+ /**
6
+ * Show visible elements
7
+ */
8
+ export declare function showElements(): void;
9
+ /**
10
+ * Show visible elements on scroll
11
+ */
12
+ export declare function showElementsOnScroll(): void;
@@ -0,0 +1,31 @@
1
+ import { throttleEvent as o } from "./event.es.js";
2
+ function s(t) {
3
+ switch (t) {
4
+ case "top":
5
+ t = 0;
6
+ break;
7
+ case "bottom":
8
+ t = document.body.scrollHeight;
9
+ break;
10
+ }
11
+ window.scrollTo(0, t);
12
+ }
13
+ function i() {
14
+ requestAnimationFrame(() => {
15
+ let t = document.querySelectorAll(".mint-fall-in:not(.mint-show)"), n = [];
16
+ for (let e = 0; e < t.length; e++)
17
+ t[e].getBoundingClientRect().top < 0 ? t[e].classList.add("mint-show") : t[e].getBoundingClientRect().top < window.innerHeight * 3 / 4 && n.push(t[e]);
18
+ for (let e = 0; e < n.length; e++)
19
+ setTimeout(() => {
20
+ n[e].classList.add("mint-show");
21
+ }, e * 100);
22
+ });
23
+ }
24
+ function r() {
25
+ window.addEventListener("scroll", o(i, 200));
26
+ }
27
+ export {
28
+ s as scrollTo,
29
+ i as showElements,
30
+ r as showElementsOnScroll
31
+ };
@@ -0,0 +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 u(e){return(e==null?void 0:e.trim().toLowerCase().replace(/'/g,"").replace(/[^\w/-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").replace(/^\/+|\/+$/g,""))??""}function l(e){return s(e.replace(/[-/]+/g," "))}function c(e){const t=(e==null?void 0:e.toString().trim())??"";if(t==="("||t==="")return t;let n=t.replace(/\D/g,"")??"",a="";n.length>10&&(a+=`+${n.slice(0,n.length-10)} `,n=n.slice(n.length-10));for(var i=0;i<n.length;i++){switch(i){case 0:a+="(";break;case 3:a+=") ";break;case 6:a+="-";break}a+=n[i]}switch(t[t.length-1]){case")":i===3&&(a+=") ");break;case"-":i===6&&(a+="-");break}return a}function g(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 f(e){let t=document.createElement("textarea");return!e||!t?!1:(t.value=e,t.style.cssText=`
2
+ position: fixed;
3
+ top: 0;
4
+ left: 0;
5
+ transform: translate(-100%, -100%);
6
+ opacity: 0;
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 x(e){return e.match(/(?:[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])+)\])/)!==null}function o(e=10){return Math.random().toString(36).substring(2,e+2)}function h(e){return!!(e!=null&&e.match(/\.(jpe?g|png|webp|gif|svg)$/i))}function m(e){return!!(e!=null&&e.match(/\.(mp4|webm|ogg)$/i))}exports.copyText=f;exports.formatPhone=c;exports.generateId=o;exports.isEmail=x;exports.isImage=h;exports.isVideo=m;exports.plural=g;exports.slug=u;exports.titleCase=s;exports.truncate=r;exports.unslug=l;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Shorten a string to the given length
3
+ */
4
+ export declare function truncate(text: string, length?: number): string;
5
+ /**
6
+ * Generate a slug from a string
7
+ * @param text - The string to slugify
8
+ * @returns The slugified string
9
+ */
10
+ export declare function slug(text?: string): string;
11
+ /**
12
+ * Generate a title from a slug
13
+ * @param slug - The slug to generate a title from
14
+ * @returns The title
15
+ */
16
+ export declare function unslug(slug: string): string;
17
+ /**
18
+ * Format a phone number
19
+ * @param phone - The phone number to format
20
+ * @returns The formatted phone number
21
+ */
22
+ export declare function formatPhone(phone?: string | number): string;
23
+ /**
24
+ * Pluralize the given word
25
+ */
26
+ export declare function plural(word: string): string;
27
+ /**
28
+ * Capitalize the first letter of the given word
29
+ */
30
+ export declare function titleCase(text: string): string;
31
+ /**
32
+ * Copies the provided text to the clipboard
33
+ * @param text - the text to copy
34
+ * @returns - true if the text was successfully copied to the clipboard; else false
35
+ */
36
+ export declare function copyText(text: string): boolean;
37
+ /**
38
+ * Tests the validity of an email address
39
+ * @see {@link https://stackoverflow.com/questions/201323/how-can-i-validate-an-email-address-using-a-regular-expression}
40
+ * @param text - the string to test
41
+ * @returns - true if the given string is an email address; false if not
42
+ */
43
+ export declare function isEmail(text: string): boolean;
44
+ /**
45
+ * Generate a random string [a-z0-9]
46
+ */
47
+ export declare function generateId(length?: number): string;
48
+ /**
49
+ * Check if the given string is an image url
50
+ */
51
+ export declare function isImage(src?: string): boolean;
52
+ /**
53
+ * Check if the given string is a video url
54
+ */
55
+ export declare function isVideo(src?: string): boolean;
@@ -0,0 +1,81 @@
1
+ function r(e, t = 100) {
2
+ return e.length > t ? e.slice(0, t).trim() + "..." : e;
3
+ }
4
+ function c(e) {
5
+ return (e == null ? void 0 : e.trim().toLowerCase().replace(/'/g, "").replace(/[^\w/-]+/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "").replace(/^\/+|\/+$/g, "")) ?? "";
6
+ }
7
+ function u(e) {
8
+ return s(e.replace(/[-/]+/g, " "));
9
+ }
10
+ function l(e) {
11
+ const t = (e == null ? void 0 : e.toString().trim()) ?? "";
12
+ if (t === "(" || t === "")
13
+ return t;
14
+ let n = t.replace(/\D/g, "") ?? "", a = "";
15
+ n.length > 10 && (a += `+${n.slice(0, n.length - 10)} `, n = n.slice(n.length - 10));
16
+ for (var i = 0; i < n.length; i++) {
17
+ switch (i) {
18
+ case 0:
19
+ a += "(";
20
+ break;
21
+ case 3:
22
+ a += ") ";
23
+ break;
24
+ case 6:
25
+ a += "-";
26
+ break;
27
+ }
28
+ a += n[i];
29
+ }
30
+ switch (t[t.length - 1]) {
31
+ case ")":
32
+ i === 3 && (a += ") ");
33
+ break;
34
+ case "-":
35
+ i === 6 && (a += "-");
36
+ break;
37
+ }
38
+ return a;
39
+ }
40
+ function x(e) {
41
+ 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";
42
+ }
43
+ function s(e) {
44
+ return e.toLowerCase().replace(/(?:^|\s)\S/g, (t) => t.toUpperCase());
45
+ }
46
+ function f(e) {
47
+ let t = document.createElement("textarea");
48
+ return !e || !t ? !1 : (t.value = e, t.style.cssText = `
49
+ position: fixed;
50
+ top: 0;
51
+ left: 0;
52
+ transform: translate(-100%, -100%);
53
+ opacity: 0;
54
+ z-index: -1;
55
+ `, document.body.appendChild(t), t.select(), t.setSelectionRange(0, 99999), navigator.clipboard.writeText(t.value), document.body.removeChild(t), !0);
56
+ }
57
+ function g(e) {
58
+ return e.match(/(?:[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])+)\])/) !== null;
59
+ }
60
+ function h(e = 10) {
61
+ return Math.random().toString(36).substring(2, e + 2);
62
+ }
63
+ function o(e) {
64
+ return !!(e != null && e.match(/\.(jpe?g|png|webp|gif|svg)$/i));
65
+ }
66
+ function m(e) {
67
+ return !!(e != null && e.match(/\.(mp4|webm|ogg)$/i));
68
+ }
69
+ export {
70
+ f as copyText,
71
+ l as formatPhone,
72
+ h as generateId,
73
+ g as isEmail,
74
+ o as isImage,
75
+ m as isVideo,
76
+ x as plural,
77
+ c as slug,
78
+ s as titleCase,
79
+ r as truncate,
80
+ u as unslug
81
+ };
@@ -0,0 +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;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Returns the width of the window, including fractional pixels
3
+ * @returns the width of the window
4
+ */
5
+ export declare function windowWidth(): number;
6
+ /**
7
+ * Returns the height of the window, including fractional pixels
8
+ * @returns the height of the window
9
+ */
10
+ export declare function windowHeight(): number;
@@ -0,0 +1,12 @@
1
+ function t() {
2
+ const n = document.body.getBoundingClientRect().width % 1;
3
+ return window.innerWidth + n;
4
+ }
5
+ function i() {
6
+ const n = document.body.getBoundingClientRect().height % 1;
7
+ return window.innerHeight + n;
8
+ }
9
+ export {
10
+ i as windowHeight,
11
+ t as windowWidth
12
+ };
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.0.1",
4
+ "version": "0.0.3",
5
5
  "license": "MIT",
6
6
  "description": "TypeScript Modules from App Art Mint LLC",
7
7
  "keywords": [
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../util/math.cjs.js"),e=1,r=6;function a(t){return u.clamp(t,e,r)}exports.headerNum=a;exports.headerNumMax=r;exports.headerNumMin=e;
@@ -1,3 +0,0 @@
1
- export declare const headerNumMin: 1;
2
- export declare const headerNumMax: 6;
3
- export declare function headerNum(num?: number): number;
@@ -1,10 +0,0 @@
1
- import { clamp as r } from "../util/math.es.js";
2
- const m = 1, n = 6;
3
- function t(e) {
4
- return r(e, m, n);
5
- }
6
- export {
7
- t as headerNum,
8
- n as headerNumMax,
9
- m as headerNumMin
10
- };