dothtml-interfaces 0.2.7 → 0.2.8

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/src/i-dot.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import IComponent, { FrameworkItems } from "./i-component";
3
3
  import IDotCss, { IDotcssProp } from "./i-dot-css";
4
4
  import IEventBus from "./i-event-bus";
5
- import IReactive from "./i-reactive";
5
+ import {IReactive} from "./i-reactive";
6
6
 
7
7
  type DotContentPrimitive = string | number | boolean;
8
8
  type DotContentBasic = DotContentPrimitive | Node | Element | NodeList | IComponent | IDotDocument//typeof DotDocument;
@@ -351,11 +351,11 @@ type Styles = string | IDotcssProp;
351
351
  // hasEvents<T extends IComponent>(styles: Styles | Styles[]): (Base: new () => T) => new () => T;
352
352
  // prop(target: any, propertyKey: string): void;
353
353
 
354
- export type ComponentArgs<TProps extends Array<string>, TEvents extends Array<string>> = {
355
- [key in TProps[number]]: any;
356
- } & {
357
- [key in TEvents[number]]: (...args: any[]) => void;
358
- }
354
+ export type ComponentArgs<TProps extends Array<string> = [], TEvents extends Array<string> = []> = {
355
+ [key in TProps[number]]?: any;
356
+ } & Partial<{
357
+ [key in TEvents[number]]?: (...args: any[]) => void;
358
+ }>;
359
359
 
360
360
  /**
361
361
  * Interface for the dot object.
@@ -441,7 +441,7 @@ export interface IDotGlobalAttrs {
441
441
  areaChecked?: AttrVal<string>;
442
442
  areaSelected?: AttrVal<boolean>;
443
443
  accessKey?: AttrVal<string>; // This could potentially be enumerated. But care should be taken as these types are already quite complex.
444
- class?: AttrVal<string> | Array<AttrVal<string>> | AttrVal<Array<string>> | Record<string, AttrVal<string>>; // Space-separated. TODO: need tests.
444
+ class?: AttrVal<string> | Array<AttrVal<string>> | AttrVal<Array<string>> | Record<string, AttrVal<boolean>>; // Space-separated. TODO: need tests.
445
445
  contentEditable?: AttrVal<"true"> | AttrVal<"false"> | AttrVal<"plaintext-only">;
446
446
  contextMenu?: AttrVal<string>;
447
447
  dir?: AttrVal<string>;
@@ -1,5 +1,5 @@
1
1
 
2
- export default interface IReactive<Ti = any, To = Ti>{
2
+ export interface IReactive<Ti = any, To = Ti>{
3
3
  // The untransformed value.
4
4
  _value: Ti;
5
5
  // Get the value.
@@ -12,10 +12,14 @@ export default interface IReactive<Ti = any, To = Ti>{
12
12
  // If a key is not provided, identification is done automatically by the framework by comparing object references.
13
13
  key: string;
14
14
  // Optional transformer that can transform the input.
15
- transformer?: (input: Ti)=>To;
15
+ transform?: (input: Ti)=>To;
16
16
  // subscribeNode(node: Node): number;
17
17
  // subscribeAttr(node: HTMLElement, attributeName: string): number;
18
18
  subscribeCallback(callback: (value: To)=>void): number;
19
19
  detachBinding(id: number);
20
20
  updateObservers(): void;
21
+ }
22
+
23
+ export interface IReactiveWatcher<T = any>{
24
+ observerUpdate(value: T, obsreverId: number): void;
21
25
  }
package/src/index.d.ts CHANGED
@@ -8,11 +8,5 @@ export * from "./i-dot-css";
8
8
 
9
9
  export { default as IComponent, FrameworkItems } from "./i-component";
10
10
 
11
- export { default as IReactive } from "./i-reactive";
12
- export { default as IEventBus } from "./i-event-bus";
13
-
14
- declare global {
15
- interface Window {
16
- dot: IDotCore;
17
- }
18
- }
11
+ export { IReactive, IReactiveWatcher } from "./i-reactive";
12
+ export { default as IEventBus } from "./i-event-bus";