dothtml-interfaces 0.2.2 → 0.2.4

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.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Dependency injection interfaces for DOTHtml.",
5
5
  "main": "src/index.d.ts",
6
6
  "types": "src/index.d.ts",
@@ -26,13 +26,23 @@ export interface FrameworkItems {
26
26
  // html: IDotGenericElement;
27
27
  }
28
28
 
29
+ export type ComponentArgs<TProps extends Array<string>, TEvents extends Array<string>> = {
30
+ [key in TProps[number]]: any;
31
+ } & {
32
+ [key in TEvents[number]]: (...args: any[]) => void;
33
+ }
34
+
35
+
29
36
  // TODO: there's a weird problem where if a constructor is not provided, it's not possible have a custom builder.
30
37
  // It should be the contsructor that depends on the builder, not the other way around. If we can't get this working,
31
38
  // it might just be better to rethink how stuff gets passed into components.
32
- export default interface IComponent {
39
+ export default interface IComponent<TProps extends Array<string> = [], TEvents extends Array<string> = []> {
33
40
 
34
41
  readonly _?: FrameworkItems;
35
42
 
43
+ new (attrs: ComponentArgs<TProps, TEvents>): IComponent<TProps, TEvents>;
44
+ new (): IComponent<TProps, TEvents>;
45
+
36
46
  // Lifecycle hooks
37
47
 
38
48
  /**
@@ -116,30 +116,32 @@ type HueInterpolationMethod = `${"shorter"|"longer"|"increasing"|"decreasing"} h
116
116
  type ColorInterpolationMethod = RectangularColorSpace|PolarColorSpace|`${PolarColorSpace} ${HueInterpolationMethod}`;
117
117
 
118
118
  // Color
119
- type NamedColor = "aliceblue"|"antiquewhite"|"aqua"|"aquamarine"|"azure"|"beige"|"bisque"|"black"|"blanchedalmond"|"blue"|"blueviolet"|"brown"|"burlywood"|"cadetblue"|"chartreuse"|"chocolate"|"coral"|"cornflowerblue"|"cornsilk"|"crimson"|"cyan"|"darkblue"|"darkcyan"|"darkgoldenrod"|"darkgray"|"darkgrey"|"darkgreen"|"darkkhaki"|"darkmagenta"|"darkolivegreen"|"darkorange"|"darkorchid"|"darkred"|"darksalmon"|"darkseagreen"|"darkslateblue"|"darkslategray"|"darkslategrey"|"darkturquoise"|"darkviolet"|"deeppink"|"deepskyblue"|"dimgray"|"dimgrey"|"dodgerblue"|"firebrick"|"floralwhite"|"forestgreen"|"fuchsia"|"gainsboro"|"ghostwhite"|"gold"|"goldenrod"|"gray"|"grey"|"green"|"greenyellow"|"honeydew"|"hotpink"|"indianred"|"indigo"|"ivory"|"khaki"|"lavender"|"lavenderblush"|"lawngreen"|"lemonchiffon"|"lightblue"|"lightcoral"|"lightcyan"|"lightgoldenrodyellow"|"lightgray"|"lightgrey"|"lightgreen"|"lightpink"|"lightsalmon"|"lightseagreen"|"lightskyblue"|"lightslategray"|"lightslategrey"|"lightsteelblue"|"lightyellow"|"lime"|"limegreen"|"linen"|"magenta"|"maroon"|"mediumaquamarine"|"mediumblue"|"mediumorchid"|"mediumpurple"|"mediumseagreen"|"mediumslateblue"|"mediumspringgreen"|"mediumturquoise"|"mediumvioletred"|"midnightblue"|"mintcream"|"mistyrose"|"moccasin"|"navajowhite"|"navy"|"oldlace"|"olive"|"olivedrab"|"orange"|"orangered"|"orchid"|"palegoldenrod"|"palegreen"|"paleturquoise"|"palevioletred"|"papayawhip"|"peachpuff"|"peru"|"pink"|"plum"|"powderblue"|"purple"|"rebeccapurple"|"red"|"rosybrown"|"royalblue"|"saddlebrown"|"salmon"|"sandybrown"|"seagreen"|"seashell"|"sienna"|"silver"|"skyblue"|"slateblue"|"slategray"|"slategrey"|"snow"|"springgreen"|"steelblue"|"tan"|"teal"|"thistle"|"tomato"|"turquoise"|"violet"|"wheat"|"white"|"whitesmoke"|"yellow"|"yellowgreen";
120
- type SystemColor = "AccentColor"|"AccentColorText"|"ActiveText"|"ButtonBorder"|"ButtonFace"|"ButtonText"|"Canvas"|"CanvasText"|"Field"|"FieldText"|"GrayText"|"Highlight"|"HighlightText"|"LinkText"|"Mark"|"MarkText"|"SelectedItem"|"SelectedItemText"|"VisitedText";
121
- type Hue = number|Angle;
122
- type PredefinedRgb = "srgb"|"srgb-linear"|"display-p3"|"a98-rgb"|"prophoto-rgb"|"rec2020";
123
- type XyzSpace = "xyz"|"xyz-d50"|"xyz-d65";
124
- type XyzParams = `${XyzSpace} ${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"}`
125
- type PredefinedRgbParams = `${PredefinedRgb} ${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"}`
126
- type ColorspaceParams = PredefinedRgbParams|XyzParams;
127
-
128
- type LRgba<T extends number|AlphaValue> = `rgb(${T}, ${T}, ${T})` | `rgba(${T}, ${T}, ${T}, ${AlphaValue})`;
129
- type MRgba = `rgb(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"})` | `rgba(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"} / ${AlphaValue})`;
130
- type Rgba = LRgba<number|AlphaValue>|MRgba;
131
- type LHsla = `hsl(${Hue}, ${Percentage}, ${Percentage})` | `hsla(${Hue}, ${Percentage}, ${Percentage}, ${AlphaValue})`;
132
- type MHsla = `hsl(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"})` | `hsla(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"} / ${AlphaValue|"none"})`;
133
- type Hsla = LHsla|MHsla;
134
- type Hwb = `hwb(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"})` | `hwb(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"} / ${AlphaValue|"none"})`;
135
- type Lab = `${"lab"|"oklab"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"})` | `${"lab"|"oklab"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"} / ${AlphaValue|"none"})`;
136
- type Lch = `${"lch"|"oklch"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${Hue|"none"})` | `${"lch"|"oklch"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${Hue|"none"} / ${AlphaValue|"none"})`;
137
- type ColorFunc = `color(${ColorspaceParams})`| `color(${ColorspaceParams} / ${AlphaValue|"none"})`;
138
- type AbsoluteColorFunction = Rgba|Hsla|Hwb|Lab|Lch|ColorFunc;
139
-
140
- type AbsoluteColorBase = HexColor|AbsoluteColorFunction|NamedColor|"transparent";
141
- type Color = AbsoluteColorBase|SystemColor|"currentcolor";
142
- type SimpleColor = HexColor|`${"rgb"|"rgba"|"hsl"|"hsla"|"hwb"|"lab"|"lch"|"oklab"|"oklch"|"color"}(${ComplexType})`|NamedColor|SystemColor|"currentcolor";
119
+ // type NamedColor = "aliceblue"|"antiquewhite"|"aqua"|"aquamarine"|"azure"|"beige"|"bisque"|"black"|"blanchedalmond"|"blue"|"blueviolet"|"brown"|"burlywood"|"cadetblue"|"chartreuse"|"chocolate"|"coral"|"cornflowerblue"|"cornsilk"|"crimson"|"cyan"|"darkblue"|"darkcyan"|"darkgoldenrod"|"darkgray"|"darkgrey"|"darkgreen"|"darkkhaki"|"darkmagenta"|"darkolivegreen"|"darkorange"|"darkorchid"|"darkred"|"darksalmon"|"darkseagreen"|"darkslateblue"|"darkslategray"|"darkslategrey"|"darkturquoise"|"darkviolet"|"deeppink"|"deepskyblue"|"dimgray"|"dimgrey"|"dodgerblue"|"firebrick"|"floralwhite"|"forestgreen"|"fuchsia"|"gainsboro"|"ghostwhite"|"gold"|"goldenrod"|"gray"|"grey"|"green"|"greenyellow"|"honeydew"|"hotpink"|"indianred"|"indigo"|"ivory"|"khaki"|"lavender"|"lavenderblush"|"lawngreen"|"lemonchiffon"|"lightblue"|"lightcoral"|"lightcyan"|"lightgoldenrodyellow"|"lightgray"|"lightgrey"|"lightgreen"|"lightpink"|"lightsalmon"|"lightseagreen"|"lightskyblue"|"lightslategray"|"lightslategrey"|"lightsteelblue"|"lightyellow"|"lime"|"limegreen"|"linen"|"magenta"|"maroon"|"mediumaquamarine"|"mediumblue"|"mediumorchid"|"mediumpurple"|"mediumseagreen"|"mediumslateblue"|"mediumspringgreen"|"mediumturquoise"|"mediumvioletred"|"midnightblue"|"mintcream"|"mistyrose"|"moccasin"|"navajowhite"|"navy"|"oldlace"|"olive"|"olivedrab"|"orange"|"orangered"|"orchid"|"palegoldenrod"|"palegreen"|"paleturquoise"|"palevioletred"|"papayawhip"|"peachpuff"|"peru"|"pink"|"plum"|"powderblue"|"purple"|"rebeccapurple"|"red"|"rosybrown"|"royalblue"|"saddlebrown"|"salmon"|"sandybrown"|"seagreen"|"seashell"|"sienna"|"silver"|"skyblue"|"slateblue"|"slategray"|"slategrey"|"snow"|"springgreen"|"steelblue"|"tan"|"teal"|"thistle"|"tomato"|"turquoise"|"violet"|"wheat"|"white"|"whitesmoke"|"yellow"|"yellowgreen";
120
+ // type SystemColor = "AccentColor"|"AccentColorText"|"ActiveText"|"ButtonBorder"|"ButtonFace"|"ButtonText"|"Canvas"|"CanvasText"|"Field"|"FieldText"|"GrayText"|"Highlight"|"HighlightText"|"LinkText"|"Mark"|"MarkText"|"SelectedItem"|"SelectedItemText"|"VisitedText";
121
+ // type Hue = number|Angle;
122
+ // type PredefinedRgb = "srgb"|"srgb-linear"|"display-p3"|"a98-rgb"|"prophoto-rgb"|"rec2020";
123
+ // type XyzSpace = "xyz"|"xyz-d50"|"xyz-d65";
124
+ // type XyzParams = `${XyzSpace} ${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"}`
125
+ // type PredefinedRgbParams = `${PredefinedRgb} ${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"}`
126
+ // type ColorspaceParams = PredefinedRgbParams|XyzParams;
127
+
128
+ // type LRgba<T extends number|AlphaValue> = `rgb(${T}, ${T}, ${T})` | `rgba(${T}, ${T}, ${T}, ${AlphaValue})`;
129
+ // type MRgba = `rgb(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"})` | `rgba(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"} / ${AlphaValue})`;
130
+ // type Rgba = LRgba<number|AlphaValue>|MRgba;
131
+ // type LHsla = `hsl(${Hue}, ${Percentage}, ${Percentage})` | `hsla(${Hue}, ${Percentage}, ${Percentage}, ${AlphaValue})`;
132
+ // type MHsla = `hsl(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"})` | `hsla(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"} / ${AlphaValue|"none"})`;
133
+ // type Hsla = LHsla|MHsla;
134
+ // type Hwb = `hwb(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"})` | `hwb(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"} / ${AlphaValue|"none"})`;
135
+ // type Lab = `${"lab"|"oklab"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"})` | `${"lab"|"oklab"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"} / ${AlphaValue|"none"})`;
136
+ // type Lch = `${"lch"|"oklch"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${Hue|"none"})` | `${"lch"|"oklch"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${Hue|"none"} / ${AlphaValue|"none"})`;
137
+ // type ColorFunc = `color(${ColorspaceParams})`| `color(${ColorspaceParams} / ${AlphaValue|"none"})`;
138
+ // type AbsoluteColorFunction = Rgba|Hsla|Hwb|Lab|Lch|ColorFunc;
139
+
140
+ // type AbsoluteColorBase = HexColor|AbsoluteColorFunction|NamedColor|"transparent";
141
+ // type Color = AbsoluteColorBase|SystemColor|"currentcolor";
142
+ // type SimpleColor = HexColor|`${"rgb"|"rgba"|"hsl"|"hsla"|"hwb"|"lab"|"lch"|"oklab"|"oklch"|"color"}(${ComplexType})`|NamedColor|SystemColor|"currentcolor";
143
+
144
+ type Color = string;
143
145
 
144
146
  // Display List Item
145
147
 
@@ -1021,21 +1023,21 @@ interface IDotcssProp{
1021
1023
  flexBasisVMax?: number;
1022
1024
  flexBasisVMin?: number;
1023
1025
 
1024
- //url?:
1026
+ //url:
1025
1027
  backgroundImage?: BackgroundImageFormat;
1026
1028
  borderImage?: BackgroundImageFormat;
1027
1029
  listStyleImage?: BackgroundImageFormat;
1028
1030
  content?: BasicCommonValues|Url;
1029
1031
 
1030
- //complex?:
1031
- transform?: BasicCommonValues|TransformationBuilder;
1032
- filter?: FilterBuilder;
1033
- backdropFilter?: FilterBuilder;
1032
+ //complex:
1033
+ transform?: BasicCommonValues|ITransformationContext;
1034
+ filter?: IFilterContext;
1035
+ backdropFilter?: IFilterContext;
1034
1036
 
1035
1037
  //misc numeric:
1036
1038
  opacity?: number|string;
1037
1039
 
1038
- //misc?:
1040
+ //misc:
1039
1041
  all?: BasicCommonValues;
1040
1042
  appearance?: AppearanceValues;
1041
1043
  aspectRatio?: string; // TODO?: better typing on this. Low priority.
@@ -1284,11 +1286,6 @@ export interface ShowParams{
1284
1286
  animationStyle?: "ease",
1285
1287
  }
1286
1288
 
1287
- export interface TransformationBuilder {
1288
- // TODO: it would be cool if this didn't have to return anything, and the trns parameter that's passed in would just retain a memory of the transformations.
1289
- (trns: ITransformationContext): ITransformationContext|string;
1290
- }
1291
-
1292
1289
  // TODO: add tests for these. Especially the 2-parameter ones.
1293
1290
  export type ITransformationContext = {
1294
1291
  // a, b, c, d, tx, ty
@@ -1448,10 +1445,6 @@ export type ITransformationContext = {
1448
1445
  perspectiveVMin?: number;
1449
1446
  }
1450
1447
 
1451
- export interface FilterBuilder{
1452
- (filtCtx: IFilterContext): IFilterContext|string;
1453
- }
1454
-
1455
1448
  type IFilterContext = {
1456
1449
  // url(commonfilters.svg#filter); // Don't know how this works yet.
1457
1450
  blur?: NumericLength;
package/src/i-dot.d.ts CHANGED
@@ -54,8 +54,8 @@ export interface IDotDocument {
54
54
  * Mounts a component.
55
55
  * TODO: add second arg.
56
56
  */
57
- mount<T extends IComponent>(component: T, init?: (e: IMountedComponent<T>) => IMountedComponent<T> | void): IDotDocument;
58
- mount<T extends IComponent>(init: (c: IMountedComponent<T>) => IMountedComponent<T> | void, component: T): IDotDocument;
57
+ mount<T extends IComponent>(component: T): IDotDocument;
58
+ // mount<T extends IComponent>(init: (c: IMountedComponent<T>) => IMountedComponent<T> | void, component: T): IDotDocument;
59
59
  // mount(component: IComponent, init: (init=>IMountedComponent): IMountedComponent|void): IDotDocument;
60
60
  /**
61
61
  * Iterates n times, appending the result of each iteration to the VDBO.
@@ -509,10 +509,10 @@ export interface IDotGlobalAttrs {
509
509
 
510
510
  // Interface for specific elements:
511
511
 
512
- interface IMountedComponent<T extends IComponent> {
513
- on(event: string, callback: (...args: Array<any>) => void): IMountedComponent<T>;
514
- prop(name: string, value: any): IMountedComponent<T>;
515
- }
512
+ // interface IMountedComponent<T extends IComponent> {
513
+ // on(event: string, callback: (...args: Array<any>) => void): IMountedComponent<T>;
514
+ // prop(name: string, value: any): IMountedComponent<T>;
515
+ // }
516
516
 
517
517
  interface IDotA extends IDotGlobalAttrs {
518
518
  download?: AttrVal<boolean>;