j-templates 7.0.6 → 7.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.
@@ -13,8 +13,9 @@ export declare class Component<D = void, T = void, E = {}> {
13
13
  protected get Data(): D;
14
14
  protected get VNode(): vNodeType;
15
15
  protected get Templates(): T;
16
- constructor(data: D | (() => (D | Promise<D>)), templates: T, vNode: vNodeType, componentEvents: ComponentEvents<E>);
16
+ constructor(data: D | (() => D | Promise<D>), templates: T, vNode: vNodeType, componentEvents: ComponentEvents<E>);
17
17
  Template(): vNodeType | vNodeType[];
18
+ Template(): string;
18
19
  Bound(): void;
19
20
  Fire<P extends keyof E>(event: P, data?: E[P]): void;
20
21
  Destroy(): void;
@@ -25,7 +26,7 @@ type vComponentConfig<D, E, P = HTMLElement> = {
25
26
  on?: ComponentEvents<E> | undefined;
26
27
  };
27
28
  type ComponentConstructor<D, T, E> = {
28
- new (data: D | (() => (D | Promise<D>)), templates: T, vNode: vNodeType, componentEvents: ComponentEvents<E>): Component<D, T, E>;
29
+ new (data: D | (() => D | Promise<D>), templates: T, vNode: vNodeType, componentEvents: ComponentEvents<E>): Component<D, T, E>;
29
30
  };
30
31
  export declare namespace Component {
31
32
  function ToFunction<D, T, E, P = HTMLElement>(type: string, constructor: ComponentConstructor<D, T, E>, namespace?: string): (config: vComponentConfig<D, E, P>, templates?: T) => vNodeType;
package/Node/component.js CHANGED
@@ -26,14 +26,14 @@ class Component {
26
26
  constructor(data, templates, vNode, componentEvents) {
27
27
  this.vNode = vNode;
28
28
  this.componentEvents = componentEvents;
29
- if (typeof data === 'function')
29
+ if (typeof data === "function")
30
30
  this.scope = new observableScope_1.ObservableScope(data);
31
31
  else
32
32
  this.scope = new observableScope_1.ObservableScope(() => data);
33
33
  this.templates = templates || {};
34
34
  }
35
35
  Template() {
36
- return [];
36
+ return "";
37
37
  }
38
38
  Bound() { }
39
39
  Fire(event, data) {
@@ -59,7 +59,7 @@ exports.Component = Component;
59
59
  type,
60
60
  namespace: namespace ?? null,
61
61
  props,
62
- componentConstructor: ConcreteComponent
62
+ componentConstructor: ConcreteComponent,
63
63
  };
64
64
  return vNode_1.vNode.Create(definition);
65
65
  };
@@ -12,10 +12,7 @@ export type vNodeEvents<E extends {
12
12
  (events: E[P]): void;
13
13
  };
14
14
  };
15
- export type vNodeChildrenFunction<T> = {
16
- (data: T): vNode | vNode[];
17
- (data: T): string;
18
- };
15
+ export type vNodeChildrenFunction<T> = ((data: T) => vNode | vNode[]) | ((data: T) => string);
19
16
  export type vNode = {
20
17
  definition: vNodeDefinition<any, any, any>;
21
18
  injector: Injector;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "j-templates",
3
- "version": "7.0.6",
3
+ "version": "7.0.7",
4
4
  "description": "j-templates",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/TypesInCode/jTemplates",