dothtml-interfaces 0.4.5 → 0.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dothtml-interfaces",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "Dependency injection interfaces for DOTHtml.",
5
5
  "main": "src/index.d.ts",
6
6
  "types": "src/index.d.ts",
@@ -1,4 +1,4 @@
1
1
  import { IBinding } from "./i-binding";
2
2
  import { IWatcher } from "./i-watcher";
3
3
 
4
- export type IReactive = IBinding|IWatcher;
4
+ export type IReactive<T = any> = IBinding<any, T>|IWatcher<T>;
package/src/i-dot.d.ts CHANGED
@@ -381,6 +381,7 @@ export interface IDotCore extends IDotDocument {
381
381
  window: IDotWindowBuilder;
382
382
 
383
383
  watch<Ti = IReactive | Array<any> | { [key: string | number]: any } | string | number | boolean>(initValue?: Ti, key?: (Ti extends Array<any> | { [key: string | number]: any } ? string : never)): IWatcher<Ti>;
384
+ ref(): IRef;
384
385
 
385
386
  // Keep these around for a bit to show how it was done before in case I need to change anything prior to the v6 launch.
386
387
  // component<T extends IComponent>(Base: new (...args: Parameters<T['build']>) => T): new (...args: Parameters<T['build']>) => T;
@@ -1,8 +1,9 @@
1
1
  import { IBinding } from "../bindings/i-binding";
2
+ import { IReactive } from "../bindings/i-reactive";
2
3
  import { IWatcher } from "../bindings/i-watcher";
3
4
 
4
5
  // Global keyword values.
5
- export type GKV = IWatcher<string>|IBinding<any, string>|"inherit"|"initial"|"unset"|"revert"|"revert-layer";
6
+ export type GKV<T=string> = IReactive<T>|"inherit"|"initial"|"unset"|"revert"|"revert-layer";
6
7
 
7
8
  export type ComplexType = string;
8
9
 
@@ -5,9 +5,10 @@ import { GKV } from "../css-types";
5
5
 
6
6
  type LengthUnitSuffix = "" | "Cm" | "Ch" | "Em" | "Ex" | "In" | "Mm" | "P" | "Pc" | "Pt" | "Px" | "Rem" | "Vh" | "Vw" | "VMax" | "VMin";
7
7
 
8
- type V<S> = IBinding<any> | number | S;
8
+ // TODO: the typings in this interface are messed up. For example, V<S> could be an IReactive<IReactive>.
9
+ type V<S> = IReactive<S> | number | S;
9
10
 
10
- type LengthProp<Prefix extends string, Qty extends 1|2|3|4 = 1, S extends string|IReactive = GKV> = {
11
+ type LengthProp<Prefix extends string, Qty extends 1|2|3|4 = 1, S extends string|IReactive = GKV<string|number>> = {
11
12
  [Key in LengthUnitSuffix as `${Prefix}${Key}`]?: (
12
13
  (Qty extends 1 ? V<S>|[V<S>] : void) |
13
14
  (Qty extends 2 ? [V<S>, V<S>] : void) |