@chronocide/hyper 0.3.2 → 0.4.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/dist/hyper.d.ts +2 -3
- package/dist/hyper.js +2 -2
- package/package.json +2 -2
package/dist/hyper.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
type Attributes = Record<string, unknown>;
|
|
2
2
|
type Child = Node | string;
|
|
3
3
|
type HTMLVoidElementTagName = 'area' | 'base' | 'br' | 'col' | 'embed' | 'hr' | 'img' | 'input' | 'link' | 'meta' | 'source' | 'track' | 'wbr';
|
|
4
|
-
type Component<T> = (data: T) => Element;
|
|
5
4
|
|
|
6
5
|
declare class Env {
|
|
7
6
|
private _document;
|
|
@@ -16,7 +15,7 @@ declare const _default: <T extends keyof HTMLElementTagNameMap>(tag: T) => <P ex
|
|
|
16
15
|
declare const svg: <T extends keyof SVGElementTagNameMap>(tag: T) => <P extends Attributes>(attributes?: P | undefined) => (...children: Child[]) => SVGElementTagNameMap[T];
|
|
17
16
|
declare const mathml: <T extends keyof MathMLElementEventMap>(tag: T) => <P extends Attributes>(attributes?: P | undefined) => (...children: Child[]) => MathMLElement;
|
|
18
17
|
declare const xml: (tag: string) => <P extends Attributes>(attributes?: P) => (...children: Child[]) => HTMLElement;
|
|
19
|
-
declare const list: <T>(
|
|
18
|
+
declare const list: <T>(render: (data: T, i: number) => Element) => (root: Element) => (next: T[]) => void;
|
|
20
19
|
|
|
21
20
|
export { _default as default, env, list, mathml, svg, xml };
|
|
22
|
-
export type { Attributes, Child,
|
|
21
|
+
export type { Attributes, Child, HTMLVoidElementTagName };
|
package/dist/hyper.js
CHANGED
|
@@ -17,7 +17,7 @@ const html = (document) => (tag) => (attributes) => (...children) => create(docu
|
|
|
17
17
|
const svg$1 = (document) => (tag) => (attributes) => (...children) => create(document.createElementNS("http://www.w3.org/2000/svg", tag))(attributes)(children);
|
|
18
18
|
const mathml$1 = (document) => (tag) => (attributes) => (...children) => create(document.createElementNS("http://www.w3.org/1998/Math/MathML", tag))(attributes)(children);
|
|
19
19
|
const xml$1 = (document) => (tag) => (attributes) => (...children) => create(document.createElementNS("http://www.w3.org/1999/xhtml", tag))(attributes)(children);
|
|
20
|
-
const list$1 = (
|
|
20
|
+
const list$1 = (render) => (root) => {
|
|
21
21
|
const cache = /* @__PURE__ */ new Map();
|
|
22
22
|
return (next) => {
|
|
23
23
|
const refs = /* @__PURE__ */ new WeakSet();
|
|
@@ -27,7 +27,7 @@ const list$1 = (component) => (root) => {
|
|
|
27
27
|
let element = cache.get(data);
|
|
28
28
|
if (element === child) return;
|
|
29
29
|
if (!element) {
|
|
30
|
-
element =
|
|
30
|
+
element = render(data, i);
|
|
31
31
|
cache.set(data, element);
|
|
32
32
|
}
|
|
33
33
|
if (refs.has(element)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chronocide/hyper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "dist/hyper.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"license": "AGPL-3.0-only",
|
|
18
18
|
"scripts": {
|
|
19
19
|
"env": "node scripts/env.ts",
|
|
20
|
-
"test": "node --env-file=.env --test src/**/*.spec.ts",
|
|
20
|
+
"test": "node --env-file=.env --test src/**/*.spec.ts && tsc --noEmit",
|
|
21
21
|
"build": "rollup -c",
|
|
22
22
|
"preversion": "npm run test",
|
|
23
23
|
"version": "npm run build && git add -A dist",
|