dothtml-interfaces 0.1.9 → 0.1.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dothtml-interfaces",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Dependency injection interfaces for DOTHtml.",
5
5
  "main": "src/index.d.ts",
6
6
  "types": "src/index.d.ts",
package/src/i-dot.d.ts CHANGED
@@ -52,7 +52,7 @@ export interface IDotDocument
52
52
  * @param callback The markup-generating callback.
53
53
  */
54
54
  iterate(n: number, callback: (i: number)=>DotContent): IDotDocument;
55
- each<T>(a: Array<T>|(()=>Array<T>)|{[key: string]: T}, callback: (x: T, i: number|string)=>DotContent): IDotDocument;
55
+ each<T>(a: Array<T>|{[key: string|number]: T}|IObservable<any, Array<T>|{[key: string|number]: T}>, callback: (x: T, i: string|number, k: string|number)=>DotContent): IDotDocument;
56
56
 
57
57
  /**
58
58
  * Removes the targeted document and everything in it.
@@ -234,6 +234,8 @@ export interface IDotCore extends IDotDocument
234
234
  css: IDotCss;
235
235
  bus: IEventBus;
236
236
  window: IDotWindowBuilder;
237
+
238
+ observe<Ti extends IObservable|Array<any>|{[key: string|number]: any}|string|number|boolean = any, To = Ti>(props?: {value: Ti, key?: string, transformer?: (value: Ti)=>To}): IObservable<Ti, To>;
237
239
 
238
240
  component<T extends {new(...args: any[]): (IComponent)}>(ComponentClass: T): T&{new(...args: any[]): ({$: FrameworkItems})};
239
241
  }
@@ -577,9 +579,8 @@ interface IDotInput extends IDotElementDocument<IDotInput>{
577
579
  width(value: unknown): IDotInput;
578
580
 
579
581
  // Special functions:
580
- bindTo(value: unknown): IDotInput;
581
- getVal(): string
582
- setVal(value: unknown): IDotInput;
582
+ // getVal(): string
583
+ // setVal(value: unknown): IDotInput;
583
584
 
584
585
  // Input-specific events:
585
586
  onSearch(callback: (e: Event)=>void): IDotInput;
@@ -642,9 +643,8 @@ interface IDotOption extends IDotElementDocument<IDotOption>{
642
643
  value(value: unknown): IDotOption;
643
644
 
644
645
  // Special functions:
645
- bindTo(value: unknown): IDotOption;
646
- getVal(): string;
647
- setVal(value: unknown): IDotOption;
646
+ // getVal(): string;
647
+ // setVal(value: unknown): IDotOption;
648
648
  }
649
649
  interface IDotOutput extends IDotElementDocument<IDotOutput>{
650
650
  for(value: unknown): IDotOutput;
@@ -673,9 +673,8 @@ interface IDotSelect extends IDotElementDocument<IDotSelect>{
673
673
  whichForm(value: unknown): IDotSelect; // form
674
674
 
675
675
  // Special functions:
676
- bindTo(value: unknown): IDotSelect;
677
- getVal(): string;
678
- setVal(value: unknown): IDotSelect;
676
+ // getVal(): string;
677
+ // setVal(value: unknown): IDotSelect;
679
678
  }
680
679
  interface IDotSource extends IDotElementDocument<IDotSource>{
681
680
  media(value: unknown): IDotSource;
@@ -713,9 +712,8 @@ interface IDotTextArea extends IDotElementDocument<IDotTextArea>{
713
712
  wrap(value: unknown): IDotTextArea;
714
713
 
715
714
  // Special functions:
716
- bindTo(value: unknown): IDotTextArea;
717
- getVal(): string;
718
- setVal(value: unknown): IDotTextArea;
715
+ // getVal(): string;
716
+ // setVal(value: unknown): IDotTextArea;
719
717
  }
720
718
  interface IDotTBody extends IDotElementDocument<IDotTBody>{
721
719
  /** @deprecated Deprecated in HTML5. Use CSS. */
@@ -8,7 +8,12 @@ export default interface IObservable<Ti = any, To = Ti>{
8
8
  getValue(): To;
9
9
  // Set the value.
10
10
  setValue(v: Ti);
11
- // Optional transformer that can .
11
+
12
+ // Key is used for observable array proxy bindings.
13
+ // If a key is provided, it's used to uniquely identify array elements.
14
+ // If a key is not provided, identification is done automatically by the framework by comparing object references.
15
+ key: string;
16
+ // Optional transformer that can transform the input.
12
17
  transformer?: (input: Ti)=>To;
13
18
  subscribeNode(node: IDotDocument): number;
14
19
  subscribeAttr(node: IDotDocument, attributeName: string): number;