@loudy/lib 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.mjs +17 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# tsdown-starter
|
|
2
|
+
|
|
3
|
+
A starter for creating a TypeScript package.
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
- Install dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- Run the unit tests:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run test
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- Build the library:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm run build
|
|
23
|
+
```
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
2
|
+
declare function $(elementName: string): LoudLibElement;
|
|
3
|
+
declare class LoudLibElement {
|
|
4
|
+
constructor(element: Element);
|
|
5
|
+
element: Element;
|
|
6
|
+
on(event: EventHandlers, fn: (e: Event) => void): this;
|
|
7
|
+
}
|
|
8
|
+
type EventHandlers = { [K in Extract<keyof GlobalEventHandlers, `on${string}`>]: K extends `on${infer E}` ? E : never }[Extract<keyof GlobalEventHandlers, `on${string}`>];
|
|
9
|
+
//#endregion
|
|
10
|
+
export { $ };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/index.ts
|
|
2
|
+
function $(elementName) {
|
|
3
|
+
return new LoudLibElement(document.querySelector(elementName));
|
|
4
|
+
}
|
|
5
|
+
var LoudLibElement = class {
|
|
6
|
+
constructor(element) {
|
|
7
|
+
this.element = element;
|
|
8
|
+
}
|
|
9
|
+
element;
|
|
10
|
+
on(event, fn) {
|
|
11
|
+
this.element.addEventListener(event, fn);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
//#endregion
|
|
17
|
+
export { $ };
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@loudy/lib",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"description": "library for various stuff.",
|
|
6
|
+
"author": "loudsynth",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./dist/index.mjs",
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.mjs",
|
|
13
|
+
"module": "./dist/index.mjs",
|
|
14
|
+
"types": "./dist/index.d.mts",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsdown",
|
|
20
|
+
"dev": "tsdown --watch",
|
|
21
|
+
"test": "vitest",
|
|
22
|
+
"typecheck": "tsc --noEmit",
|
|
23
|
+
"prepublishOnly": "pnpm run build"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/node": "^25.0.3",
|
|
27
|
+
"bumpp": "^10.3.2",
|
|
28
|
+
"tsdown": "^0.18.1",
|
|
29
|
+
"typescript": "^5.9.3",
|
|
30
|
+
"vitest": "^4.0.16"
|
|
31
|
+
}
|
|
32
|
+
}
|