crelt 1.0.5 → 1.0.7

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 CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (C) 2020 by Marijn Haverbeke <marijnh@gmail.com>
1
+ Copyright (C) 2020 by Marijn Haverbeke <marijn@haverbeke.berlin>
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,8 @@
1
+ type Child = string | Node | null | undefined | readonly Child[]
2
+
3
+ type EltType<N extends string> = N extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[N] : HTMLElement
4
+
5
+ export default function crelt<N extends string>(elt: N, attrs: {[attr: string]: any}, ...children: Child[]): EltType<N>
6
+ export default function crelt<N extends string>(elt: N, ...children: Child[]): EltType<N>
7
+ export default function crelt(elt: HTMLElement, attrs: {[attr: string]: any}, ...children: Child[]): HTMLElement
8
+ export default function crelt(elt: HTMLElement, ...children: Child[]): HTMLElement
package/index.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  type Child = string | Node | null | undefined | readonly Child[]
2
2
 
3
- export default function crelt(elt: string | HTMLElement, attrs: {[attr: string]: any}, ...children: Child[]): HTMLElement
4
- export default function crelt(elt: string | HTMLElement, ...children: Child[]): HTMLElement
3
+ type EltType<N extends string> = N extends keyof HTMLElementTagNameMap ? HTMLElementTagNameMap[N] : HTMLElement
4
+
5
+ export default function crelt<N extends string>(elt: N, attrs: {[attr: string]: any}, ...children: Child[]): EltType<N>
6
+ export default function crelt<N extends string>(elt: N, ...children: Child[]): EltType<N>
7
+ export default function crelt(elt: HTMLElement, attrs: {[attr: string]: any}, ...children: Child[]): HTMLElement
8
+ export default function crelt(elt: HTMLElement, ...children: Child[]): HTMLElement
package/package.json CHANGED
@@ -1,34 +1,35 @@
1
1
  {
2
2
  "name": "crelt",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Tiny DOM-element-creation utility",
5
5
  "main": "dist/index.cjs",
6
6
  "type": "module",
7
7
  "exports": {
8
- "import": "./index.es.js",
8
+ "import": "./index.js",
9
9
  "require": "./dist/index.cjs"
10
10
  },
11
- "module": "index.es.js",
11
+ "module": "index.js",
12
12
  "types": "index.d.ts",
13
13
  "scripts": {
14
14
  "prepare": "rollup -c"
15
15
  },
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+https://github.com/marijnh/crelt.git"
18
+ "url": "git+https://code.haverbeke.berlin/marijn/crelt.git"
19
19
  },
20
20
  "keywords": [
21
21
  "dom",
22
22
  "creation",
23
23
  "crel"
24
24
  ],
25
- "author": "Marijn Haverbeke <marijnh@gmail.com>",
25
+ "author": "Marijn Haverbeke <marijn@haverbeke.berlin>",
26
26
  "license": "MIT",
27
27
  "bugs": {
28
- "url": "https://github.com/marijnh/crelt/issues"
28
+ "url": "https://code.haverbeke.berlin/marijn/crelt/issues"
29
29
  },
30
- "homepage": "https://github.com/marijnh/crelt#readme",
30
+ "homepage": "https://code.haverbeke.berlin/marijn/crelt",
31
31
  "devDependencies": {
32
- "rollup": "^2.0.5"
32
+ "rollup": "^2.0.5",
33
+ "rollup-plugin-copy": "^3.4.0"
33
34
  }
34
35
  }
package/rollup.config.js CHANGED
@@ -1,7 +1,13 @@
1
+ import copy from "rollup-plugin-copy"
2
+
1
3
  export default {
2
- input: "index.es.js",
4
+ input: "index.js",
3
5
  output: {
4
6
  file: "dist/index.cjs",
5
- format: "cjs"
6
- }
7
+ format: "cjs",
8
+ exports: "default"
9
+ },
10
+ plugins: [
11
+ copy({targets: [{src: "index.d.ts", dest: "dist", rename: () => "index.d.cts"}]})
12
+ ]
7
13
  }
File without changes