@itrocks/modal 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.
package/LICENSE ADDED
@@ -0,0 +1,14 @@
1
+ ISC License
2
+ Copyright (C) 2024, Baptiste Pillot <baptiste@pillot.fr>
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted, provided that the above
6
+ copyright notice and this permission notice appear in all copies.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
13
+ OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
14
+ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ [![npm version](https://img.shields.io/npm/v/@itrocks/modal?logo=npm)](https://www.npmjs.org/package/@itrocks/modal)
2
+ [![npm downloads](https://img.shields.io/npm/dm/@itrocks/modal)](https://www.npmjs.org/package/@itrocks/modal)
3
+ [![GitHub](https://img.shields.io/github/last-commit/itrocks-ts/modal?color=2dba4e&label=commit&logo=github)](https://github.com/itrocks-ts/modal)
4
+ [![issues](https://img.shields.io/github/issues/itrocks-ts/modal)](https://github.com/itrocks-ts/modal/issues)
5
+ [![discord](https://img.shields.io/discord/1314141024020467782?color=7289da&label=discord&logo=discord&logoColor=white)](https://25.re/ditr)
6
+
7
+ # modal
package/modal.d.ts ADDED
@@ -0,0 +1 @@
1
+ export default function modalForm(form: HTMLFormElement): void;
package/modal.js ADDED
@@ -0,0 +1,9 @@
1
+ export default function modalForm(form) {
2
+ const modal = form.closest('#modal');
3
+ if (!modal)
4
+ return;
5
+ form.addEventListener('submit', () => modal.remove());
6
+ form.querySelectorAll('a[href="about:blank"]').forEach(anchor => {
7
+ anchor.addEventListener('click', () => { anchor.closest('#modal')?.remove(); });
8
+ });
9
+ }
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "author": {
3
+ "name": "Baptiste Pillot",
4
+ "email": "baptiste@pillot.fr"
5
+ },
6
+ "description": "Respectful modal: avoids <div>, respects white-space: pre* styles line breaks",
7
+ "devDependencies": {
8
+ "@types/node": "^22.9",
9
+ "typescript": "5.6"
10
+ },
11
+ "files": [
12
+ "LICENSE",
13
+ "README.md",
14
+ "*.d.ts",
15
+ "*.js"
16
+ ],
17
+ "homepage": "https://it.rocks",
18
+ "keywords": [
19
+ "carriage return",
20
+ "modal",
21
+ "fix",
22
+ "fixed",
23
+ "front-end",
24
+ "it.rocks",
25
+ "line feed",
26
+ "line break",
27
+ "pre",
28
+ "raw",
29
+ "style",
30
+ "text",
31
+ "white-space"
32
+ ],
33
+ "license": "ISC",
34
+ "module": "./modal.js",
35
+ "name": "@itrocks/modal",
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "git+https://github.com/itrocks-ts/modal.git"
39
+ },
40
+ "scripts": {
41
+ "build": "tsc"
42
+ },
43
+ "type": "module",
44
+ "types": "./modal.d.ts",
45
+ "version": "0.0.1"
46
+ }