@appartmint/tsm-mint 0.0.1

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.
@@ -0,0 +1 @@
1
+ "use strict";var v=Object.defineProperty;var r=(t,e,s)=>e in t?v(t,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):t[e]=s;var a=(t,e,s)=>r(t,typeof e!="symbol"?e+"":e,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class c{constructor(){a(this,"events",[])}attachEvent(e,s,n){if(e){let h=this.events.find(i=>i.el===e);h?(h.handlers.push(n),h.events.push(s)):this.events.push({el:e,handlers:[n],events:[s]}),e.addEventListener(s,n)}}detachEvents(){this.events.forEach(e=>{e.handlers.forEach((s,n)=>{var h;(h=e.el)==null||h.removeEventListener(e.events[n],s)})}),this.events=[]}}exports.AttachesEvents=c;
@@ -0,0 +1,10 @@
1
+ export interface ElementEvents {
2
+ el: HTMLElement | Window | null;
3
+ handlers: EventListener[];
4
+ events: string[];
5
+ }
6
+ export declare abstract class AttachesEvents {
7
+ events: ElementEvents[];
8
+ attachEvent(element: HTMLElement | Window | null | undefined, event: string, handler: EventListener): void;
9
+ detachEvents(): void;
10
+ }
@@ -0,0 +1,29 @@
1
+ var i = Object.defineProperty;
2
+ var E = (t, s, e) => s in t ? i(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
3
+ var v = (t, s, e) => E(t, typeof s != "symbol" ? s + "" : s, e);
4
+ class c {
5
+ constructor() {
6
+ v(this, "events", []);
7
+ }
8
+ attachEvent(s, e, n) {
9
+ if (s) {
10
+ let h = this.events.find((a) => a.el === s);
11
+ h ? (h.handlers.push(n), h.events.push(e)) : this.events.push({
12
+ el: s,
13
+ handlers: [n],
14
+ events: [e]
15
+ }), s.addEventListener(e, n);
16
+ }
17
+ }
18
+ detachEvents() {
19
+ this.events.forEach((s) => {
20
+ s.handlers.forEach((e, n) => {
21
+ var h;
22
+ (h = s.el) == null || h.removeEventListener(s.events[n], e);
23
+ });
24
+ }), this.events = [];
25
+ }
26
+ }
27
+ export {
28
+ c as AttachesEvents
29
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./attaches-events.cjs.js");exports.AttachesEvents=t.AttachesEvents;
@@ -0,0 +1 @@
1
+ export * from './attaches-events';
@@ -0,0 +1,4 @@
1
+ import { AttachesEvents as o } from "./attaches-events.es.js";
2
+ export {
3
+ o as AttachesEvents
4
+ };
@@ -0,0 +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;
@@ -0,0 +1,3 @@
1
+ export declare const gridNumMin: 1;
2
+ export declare const gridNumMax: 4;
3
+ export declare function gridNum(num?: number): number;
@@ -0,0 +1,10 @@
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);
5
+ }
6
+ export {
7
+ t as gridNum,
8
+ n as gridNumMax,
9
+ m as gridNumMin
10
+ };
@@ -0,0 +1 @@
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;
@@ -0,0 +1,3 @@
1
+ export declare const headerNumMin: 1;
2
+ export declare const headerNumMax: 6;
3
+ export declare function headerNum(num?: number): number;
@@ -0,0 +1,10 @@
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
+ };
@@ -0,0 +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;
@@ -0,0 +1,2 @@
1
+ export * from './grid';
2
+ export * from './header';
@@ -0,0 +1,10 @@
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";
3
+ export {
4
+ m as gridNum,
5
+ d as gridNumMax,
6
+ u as gridNumMin,
7
+ a as headerNum,
8
+ i as headerNumMax,
9
+ o as headerNumMin
10
+ };
@@ -0,0 +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;
@@ -0,0 +1,4 @@
1
+ export * from './abstract';
2
+ export * from './components';
3
+ export * from './types';
4
+ export * from './util';
@@ -0,0 +1,19 @@
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";
7
+ 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
19
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=["top","right","bottom","left"];exports.boxPositions=o;
@@ -0,0 +1,2 @@
1
+ export declare const boxPositions: readonly ["top", "right", "bottom", "left"];
2
+ export type BoxPosition = (typeof boxPositions)[number];
@@ -0,0 +1,9 @@
1
+ const o = [
2
+ "top",
3
+ "right",
4
+ "bottom",
5
+ "left"
6
+ ];
7
+ export {
8
+ o as boxPositions
9
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./box.cjs.js");exports.boxPositions=o.boxPositions;
@@ -0,0 +1 @@
1
+ export * from './box';
@@ -0,0 +1,4 @@
1
+ import { boxPositions as r } from "./box.es.js";
2
+ export {
3
+ r as boxPositions
4
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function i(e){return new Promise(t=>setTimeout(t,e))}exports.wait=i;
@@ -0,0 +1 @@
1
+ export declare function wait(ms: number): Promise<void>;
@@ -0,0 +1,6 @@
1
+ function i(e) {
2
+ return new Promise((t) => setTimeout(t, e));
3
+ }
4
+ export {
5
+ i as wait
6
+ };
@@ -0,0 +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;
@@ -0,0 +1,2 @@
1
+ export * from './async';
2
+ export * from './math';
@@ -0,0 +1,7 @@
1
+ import { wait as m } from "./async.es.js";
2
+ import { clamp as a, randomInt as p } from "./math.es.js";
3
+ export {
4
+ a as clamp,
5
+ p as randomInt,
6
+ m as wait
7
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function a(o,t,r){return Math.max(t,Math.min(o??t,r))}function e(o,t=0){return t=Math.ceil(t),o=Math.floor(o),Math.floor(Math.random()*(o-t)+t)}exports.clamp=a;exports.randomInt=e;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Return a number between min and max
3
+ * @param num - the number to clamp
4
+ * @param min - the minimum value
5
+ * @param max - the maximum value
6
+ * @returns a number between min and max
7
+ */
8
+ export declare function clamp(num: number | null | undefined, min: number, max: number): number;
9
+ /**
10
+ * Get a random integer between min and max
11
+ * @param max Maximum value to return
12
+ * @param min Minimum value to return (default is 0)
13
+ * @returns a random integer between min and max
14
+ */
15
+ export declare function randomInt(max: number, min?: number): number;
@@ -0,0 +1,10 @@
1
+ function a(o, t, r) {
2
+ return Math.max(t, Math.min(o ?? t, r));
3
+ }
4
+ function h(o, t = 0) {
5
+ return t = Math.ceil(t), o = Math.floor(o), Math.floor(Math.random() * (o - t) + t);
6
+ }
7
+ export {
8
+ a as clamp,
9
+ h as randomInt
10
+ };
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@appartmint/tsm-mint",
3
+ "author": "App Art Mint LLC",
4
+ "version": "0.0.1",
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
+ }
69
+ }