j-templates 6.0.49 → 6.1.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/DOM/elements.d.ts
CHANGED
|
@@ -7,18 +7,18 @@ export declare function br<T>(nodeDef: ElementNodeFunctionParam<T>): import("../
|
|
|
7
7
|
export declare function b<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
8
8
|
export declare function span<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
9
9
|
export declare function img<T>(nodeDef: ElementNodeFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
10
|
-
export declare function video<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
10
|
+
export declare function video<T>(nodeDef: ElementNodeFunctionParam<T, HTMLVideoElement, HTMLVideoElementEventMap>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
11
11
|
export declare function source<T>(nodeDef: ElementNodeFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
12
|
-
export declare function input<T>(nodeDef: ElementNodeFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
12
|
+
export declare function input<T>(nodeDef: ElementNodeFunctionParam<T, HTMLInputElement>): import("../Node/elementNode.types").IElementNode<T>;
|
|
13
13
|
export declare function textarea<T>(nodeDef: ElementNodeFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
14
|
-
export declare function select<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
15
|
-
export declare function option<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
14
|
+
export declare function select<T>(nodeDef: ElementNodeFunctionParam<T, HTMLSelectElement>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
15
|
+
export declare function option<T>(nodeDef: ElementNodeFunctionParam<T, HTMLOptionElement>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
16
16
|
export declare function h1<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
17
17
|
export declare function h2<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
18
18
|
export declare function h3<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
19
19
|
export declare function p<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
20
|
-
export declare function style<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
21
|
-
export declare function button<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
20
|
+
export declare function style<T>(nodeDef: ElementNodeFunctionParam<T, HTMLStyleElement>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
21
|
+
export declare function button<T>(nodeDef: ElementNodeFunctionParam<T, HTMLButtonElement>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
22
22
|
export declare function table<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
23
23
|
export declare function tbody<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
|
24
24
|
export declare function th<T>(nodeDef: ElementNodeFunctionParam<T>, children?: ElementChildrenFunctionParam<T>): import("../Node/elementNode.types").IElementNode<T>;
|
package/Node/boundNode.js
CHANGED
|
@@ -11,10 +11,10 @@ var BoundNode;
|
|
|
11
11
|
for (let x = 0; x < keys.length; x++) {
|
|
12
12
|
const event = keys[x];
|
|
13
13
|
const eventFunc = events[event];
|
|
14
|
-
ret[event] = function (
|
|
14
|
+
ret[event] = function (event) {
|
|
15
15
|
if (node.destroyed)
|
|
16
16
|
return;
|
|
17
|
-
return eventFunc(
|
|
17
|
+
return eventFunc(event);
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
return ret;
|
|
@@ -5,9 +5,11 @@ import { INodeRefBase } from "./nodeRef.types";
|
|
|
5
5
|
export type FunctionOr<T> = {
|
|
6
6
|
(...args: Array<any>): T | Promise<T>;
|
|
7
7
|
} | T;
|
|
8
|
-
export type NodeRefEvents
|
|
9
|
-
[
|
|
10
|
-
|
|
8
|
+
export type NodeRefEvents<E extends {
|
|
9
|
+
[event: string]: any;
|
|
10
|
+
} = any> = {
|
|
11
|
+
[P in keyof E]?: {
|
|
12
|
+
(events: E[P]): void;
|
|
11
13
|
};
|
|
12
14
|
};
|
|
13
15
|
export interface NodeDefinition<T = any, E = any> {
|
|
@@ -19,15 +21,15 @@ export interface NodeDefinition<T = any, E = any> {
|
|
|
19
21
|
attrs?: FunctionOr<{
|
|
20
22
|
[name: string]: string;
|
|
21
23
|
}>;
|
|
22
|
-
on?: FunctionOr<NodeRefEvents
|
|
24
|
+
on?: FunctionOr<NodeRefEvents<E>>;
|
|
23
25
|
text?: FunctionOr<string>;
|
|
24
26
|
}
|
|
25
|
-
export interface BoundNodeFunctionParam {
|
|
26
|
-
props?: FunctionOr<RecursivePartial<
|
|
27
|
+
export interface BoundNodeFunctionParam<P = HTMLElement, E = HTMLElementEventMap> {
|
|
28
|
+
props?: FunctionOr<RecursivePartial<P>>;
|
|
27
29
|
attrs?: FunctionOr<{
|
|
28
30
|
[name: string]: string;
|
|
29
31
|
}>;
|
|
30
|
-
on?: FunctionOr<NodeRefEvents
|
|
32
|
+
on?: FunctionOr<NodeRefEvents<E>>;
|
|
31
33
|
text?: FunctionOr<string>;
|
|
32
34
|
}
|
|
33
35
|
export interface IBoundNodeBase extends INodeRefBase {
|
|
@@ -2,8 +2,8 @@ import { BoundNodeFunctionParam, IBoundNodeBase, NodeDefinition } from "./boundN
|
|
|
2
2
|
import { Component, ComponentConstructor } from "./component";
|
|
3
3
|
import { NodeRefType } from "./nodeRef";
|
|
4
4
|
export type ComponentNodeEvents<E = void> = {
|
|
5
|
-
[P in keyof E]
|
|
6
|
-
(data
|
|
5
|
+
[P in keyof E]?: {
|
|
6
|
+
(data: E[P]): void;
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
9
|
export interface ComponentNodeDefinition<D = void, E = void> extends NodeDefinition<D> {
|
|
@@ -12,7 +12,7 @@ export interface ComponentNodeDefinition<D = void, E = void> extends NodeDefinit
|
|
|
12
12
|
(): D | Promise<D>;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
export interface ComponentNodeFunctionParam<D = void, E = void> extends BoundNodeFunctionParam {
|
|
15
|
+
export interface ComponentNodeFunctionParam<D = void, E = void, P = HTMLElement> extends BoundNodeFunctionParam<P> {
|
|
16
16
|
on?: ComponentNodeEvents<E>;
|
|
17
17
|
data?: {
|
|
18
18
|
(): D | Promise<D>;
|
|
@@ -15,7 +15,7 @@ export interface ElementNodeDefinition<T> extends NodeDefinition<T> {
|
|
|
15
15
|
};
|
|
16
16
|
children?: ElementChildrenFunction<T>;
|
|
17
17
|
}
|
|
18
|
-
export interface ElementNodeFunctionParam<T> extends BoundNodeFunctionParam {
|
|
18
|
+
export interface ElementNodeFunctionParam<T, P = HTMLElement, E = HTMLElementEventMap> extends BoundNodeFunctionParam<P, E> {
|
|
19
19
|
data?: {
|
|
20
20
|
(): T | Array<T> | Promise<Array<T>> | Promise<T>;
|
|
21
21
|
};
|