dothtml-interfaces 0.4.6 → 1.0.0
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/README.md +3 -3
- package/package.json +6 -4
- package/src/bindings/{i-binding.d.ts → i-binding.ts} +11 -11
- package/src/bindings/{i-observer.d.ts → i-observer.ts} +2 -2
- package/src/bindings/{i-reactive.d.ts → i-reactive.ts} +4 -4
- package/src/bindings/i-ref.ts +5 -0
- package/src/bindings/{i-watcher.d.ts → i-watcher.ts} +52 -38
- package/src/{i-dot-component.d.ts → i-dot-component.ts} +113 -84
- package/src/{i-dot.d.ts → i-dot.ts} +1041 -1047
- package/src/{i-event-bus.d.ts → i-event-bus.ts} +10 -10
- package/src/{index.d.ts → index.ts} +14 -14
- package/src/styles/at-rules/{i-at-color-profile-builder.d.ts → i-at-color-profile-builder.ts} +4 -4
- package/src/styles/at-rules/{i-at-counter-style-builder.d.ts → i-at-counter-style-builder.ts} +14 -14
- package/src/styles/at-rules/{i-at-font-family-builder.d.ts → i-at-font-family-builder.ts} +18 -18
- package/src/styles/at-rules/{i-at-font-palette-values.d.ts → i-at-font-palette-values.ts} +5 -5
- package/src/styles/at-rules/{i-at-keyframes-builder.d.ts → i-at-keyframes-builder.ts} +7 -7
- package/src/styles/at-rules/{i-at-page-builder.d.ts → i-at-page-builder.ts} +19 -19
- package/src/styles/complex-css-types/{i-filter-prop.d.ts → i-filter-prop.ts} +19 -19
- package/src/styles/complex-css-types/{i-shadow-prop.d.ts → i-shadow-prop.ts} +11 -11
- package/src/styles/complex-css-types/{i-transformation-prop.d.ts → i-transformation-prop.ts} +32 -32
- package/src/styles/{css-types.d.ts → css-types.ts} +141 -141
- package/src/styles/{i-css-prop.d.ts → i-css-prop.ts} +295 -295
- package/src/styles/{i-dot-css.d.ts → i-dot-css.ts} +218 -214
- package/src/styles/mapped-types/{angle-prop.d.ts → angle-prop.ts} +15 -15
- package/src/styles/mapped-types/{color-props.d.ts → color-props.ts} +60 -60
- package/src/styles/mapped-types/{length-prop.d.ts → length-prop.ts} +21 -19
- package/src/bindings/i-ref.d.ts +0 -4
|
@@ -1,214 +1,218 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import IAtColorProfileBuilder from "./at-rules/i-at-color-profile-builder";
|
|
4
|
-
import IAtCounterStyleBuilder from "./at-rules/i-at-counter-style-builder";
|
|
5
|
-
import IAtFontPaletteValues from "./at-rules/i-at-font-palette-values";
|
|
6
|
-
import IAtKeyframesBuilder from "./at-rules/i-at-keyframes-builder";
|
|
7
|
-
import IAtPageBuilder from "./at-rules/i-at-page-builder";
|
|
8
|
-
import IDotcssProp from "./i-css-prop";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// EASING FUNCTION
|
|
14
|
-
|
|
15
|
-
// type StepPosition = "jump-start"|"jump-end"|"jump-none"|"jump-both"|"start"|"end";
|
|
16
|
-
// type LinearStopLength = Percentage|`${Percentage} ${Percentage}`;
|
|
17
|
-
// type LinearStop = number|`${number} ${LinearStopLength}`|`${LinearStopLength} ${number}`;
|
|
18
|
-
// type LinearStopList = `${LinearStop}${`, ${LinearStop}${`, ${LinearStop}${`, ${LinearStop}${`, ${LinearStop}${ComplexType}`|""}`|""}`|""}`|""}`;
|
|
19
|
-
|
|
20
|
-
// type StepEasingFunction = "step-start"|"step-end"|`steps(${Int}${`, ${StepPosition}`|""})`;
|
|
21
|
-
// type CubicBezierEasingFunction = "ease"|"ease-in"|"ease-out"|"ease-in-out"|`cubic-bezier(${number}, ${number}, ${number}, ${number})`;
|
|
22
|
-
// type LinearEasingFunction = `linear(${LinearStopList})`;
|
|
23
|
-
// type EasingFunction = "linear"|LinearEasingFunction|CubicBezierEasingFunction|StepEasingFunction;
|
|
24
|
-
|
|
25
|
-
// FILTER FUNCTION
|
|
26
|
-
// TODO: don't forget to provide builders for these. Already put work into some.
|
|
27
|
-
// type SaturateFunction = `saturate(${number|Percentage|""})`;
|
|
28
|
-
// type SepiaFunction = `sepia(${number|Percentage|""})`;
|
|
29
|
-
// type OpacityFunction = `opacity(${number|Percentage|""})`;
|
|
30
|
-
// type InvertFunction = `invert(${number|Percentage|""})`;
|
|
31
|
-
// type GrayscaleFunction = `grayscale(${number|Percentage|""})`;
|
|
32
|
-
// type ContrastFunction = `contrast(${number|Percentage|""})`;
|
|
33
|
-
// type BrightnessFunction = `brightness(${number|Percentage|""})`;
|
|
34
|
-
// type BlurFunction = `blur(${NumericLength|""})`;
|
|
35
|
-
// Regrettably, strong typing for color isn't possible due to the type complexity.
|
|
36
|
-
// Even SimpleColor doesn't work. We use string in place of Color.
|
|
37
|
-
// type DropShadowFunction = `drop-shadow(${`${ComplexType} ${NumericLength} ${NumericLength}`
|
|
38
|
-
// |`${NumericLength} ${NumericLength} ${ComplexType}`
|
|
39
|
-
// |`${NumericLength} ${NumericLength}`
|
|
40
|
-
// |`${ComplexType} ${NumericLength} ${NumericLength} ${NumericLength}`
|
|
41
|
-
// |`${NumericLength} ${NumericLength} ${NumericLength} ${ComplexType}`
|
|
42
|
-
// |`${NumericLength} ${NumericLength} ${NumericLength}`
|
|
43
|
-
// })`;
|
|
44
|
-
// type HueRotateFunction = `hue-rotate(${Angle|""})`;
|
|
45
|
-
// type FilterFunction = SaturateFunction|SepiaFunction|OpacityFunction|InvertFunction|GrayscaleFunction|ContrastFunction|BrightnessFunction|BlurFunction|DropShadowFunction|HueRotateFunction;
|
|
46
|
-
|
|
47
|
-
// FLEX
|
|
48
|
-
type Flex = `${number}fr`;
|
|
49
|
-
|
|
50
|
-
// FONT
|
|
51
|
-
|
|
52
|
-
// type GenericFamily = "serif" | "sans-serif" | "monospace" | "cursive" | "fantasy" | "system-ui" | "ui-serif" | "ui-sans-serif" | "ui-monospace" | "ui-rounded" | "emoji" | "math" | "fangsong";
|
|
53
|
-
|
|
54
|
-
// POSITION
|
|
55
|
-
// type HorizontalPosition = "left" | "center" | "right" | LengthPercentage;
|
|
56
|
-
// type VerticalPosition = "top" | "center" | "bottom" | LengthPercentage;
|
|
57
|
-
|
|
58
|
-
// type Position =
|
|
59
|
-
// | HorizontalPosition
|
|
60
|
-
// | VerticalPosition
|
|
61
|
-
// | `${HorizontalPosition} ${VerticalPosition}`
|
|
62
|
-
// | `${VerticalPosition} ${HorizontalPosition}`
|
|
63
|
-
// | `${"left" | "right"} ${LengthPercentage}`
|
|
64
|
-
// | `${"top" | "bottom"} ${LengthPercentage}`
|
|
65
|
-
// | `${"left" | "right"} ${LengthPercentage} ${"top" | "bottom"} ${LengthPercentage}`
|
|
66
|
-
// | `${"top" | "bottom"} ${LengthPercentage} ${"left" | "right"} ${LengthPercentage}`;
|
|
67
|
-
|
|
68
|
-
// GRADIENT
|
|
69
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/gradient
|
|
70
|
-
// TODO: absolutely need a builder for this.
|
|
71
|
-
|
|
72
|
-
// type RadialShape = "circle"|"ellipse";
|
|
73
|
-
// type RadialExtent = "closest-corner"|"closest-side"|"farthest-corner"|"farthest-side";
|
|
74
|
-
// type SideOrCorner = "left"|"right"|"top"|"bottom"|`${"left" | "right"} ${"top" | "bottom"}`|`${"top" | "bottom"} ${"left" | "right"}`;
|
|
75
|
-
// type RadialSize = `${RadialExtent} ${NumericLength} ${LengthPercentage} ${LengthPercentage}`;
|
|
76
|
-
// type LinearColorStop = Color|`${Color} ${LengthPercentage}`;
|
|
77
|
-
// type LinearColorHint = LengthPercentage;
|
|
78
|
-
// // type LinearColorStopListItem = LinearColorStop|`${LinearColorHint}, ${LinearColorStop}`; // TOO COMPLEX :(
|
|
79
|
-
// type LinearColorStopListItem = LinearColorStop|`${ComplexType}, ${LinearColorStop}`; // TODO: this type got botched due to complexity.
|
|
80
|
-
// type ColorStopList = `${LinearColorStop}${`, ${ComplexType}`}`|`${LinearColorStop}`;
|
|
81
|
-
|
|
82
|
-
// type AngleOrSideOrCorner = Angle | `to ${SideOrCorner}, `;
|
|
83
|
-
// type LinearGradientSyntax = ComplexType; //`${`${AngleOrSideOrCorner} `|""}${ColorStopList}`;
|
|
84
|
-
// // type RadiatShapeOrSize = RadialShape | RadialSize | `${RadialShape} ${RadialSize}` | `${RadialSize} ${RadialShape}`;
|
|
85
|
-
// type RadiatShapeOrSize = RadialShape | RadialSize | ComplexType;//`${RadialShape} ${RadialSize}` | `${RadialSize} ${RadialShape}`;
|
|
86
|
-
// type RadialGradientSyntax = `${`${RadiatShapeOrSize} ` | ""} [ at <position> ]? , <color-stop-list>`;
|
|
87
|
-
// type LinearGradientFunction = `linear-gradient(${LinearGradientSyntax})`;
|
|
88
|
-
// type RepeatingLinearGradientFunction = `linear-gradient(${LinearGradientSyntax})`;
|
|
89
|
-
// type RadialGradientFunction = `radial-gradient(${RadialGradientSyntax})`;
|
|
90
|
-
// type RepeatingRadialGradientFunction = `radial-gradient(${RadialGradientSyntax})`;
|
|
91
|
-
// type Gradient = LinearGradientFunction | RepeatingLinearGradientFunction | RadialGradientFunction | RepeatingRadialGradientFunction;
|
|
92
|
-
|
|
93
|
-
// URL
|
|
94
|
-
// type Url = `${"src"|"url"}(${string})`;
|
|
95
|
-
|
|
96
|
-
// IMAGE
|
|
97
|
-
// type Image = Url|Gradient;
|
|
98
|
-
|
|
99
|
-
// TODO:
|
|
100
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function
|
|
101
|
-
// type TransformFunction = ComplexType;
|
|
102
|
-
|
|
103
|
-
// Building blocks.
|
|
104
|
-
|
|
105
|
-
// type OptionalWhitespace = ""|" ";
|
|
106
|
-
// export type Percentage = number|`${number}%`; // Used for filters.
|
|
107
|
-
|
|
108
|
-
// ts starts complaining about the complexity of the type :(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
// Types
|
|
112
|
-
// TODO: look up types online and correct this.
|
|
113
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/absolute-size
|
|
114
|
-
|
|
115
|
-
// MORE COMPLEX TYPES?
|
|
116
|
-
|
|
117
|
-
// type NumericLengthOrAuto = NumericLength|"auto";
|
|
118
|
-
// type NumericAngle = number|`${number}${AngleUnits}`;
|
|
119
|
-
|
|
120
|
-
// type AppearanceValues = BasicCommonValues|"none"|"menulist-button"|"textfield"|"button"|"searchfield"|"textarea"|"push-button"|"slider-horizontal"|"checkbox"|"radio"|"square-button"|"menulist"|"listbox"|"meter"|"progress-bar"|"scrollbarbutton-up"|"button-bevel"|"media-mute-button"|"caret";
|
|
121
|
-
// type BackgroundAttachmentValues = BasicCommonValues|"scroll"|"fixed"|"local";
|
|
122
|
-
// type BackgroundRepeatValues = GKV|"no-repeat"|"repeat"|"space"|"round";
|
|
123
|
-
// type BackgroundOriginValues = GKV|"padding-box"|"border-box"|"content-box";
|
|
124
|
-
// type BackgroundSizeValues = BasicCommonValues|"auto"|NumericLength|"cover"|"contain";
|
|
125
|
-
// type BackfaceVisibilityValues = BasicCommonValues|"visible"|"hidden";
|
|
126
|
-
// type BorderStyles = GKV|"dotted"|"dashed"|"solid"|"double"|"groove"|"ridge"|"inset"|"outset"|"none"|"hidden";
|
|
127
|
-
|
|
128
|
-
// type DisplayValues = BasicCommonValues|"inline"|"block"|"contents"|"flex"|"grid"|"inline-block"|"inline-flex"|"inline-grid"|"inline-table"|"list-item"|"run-in"|"table"|"table-caption"|"table-column-group"|"table-header-group"|"table-footer-group"|"table-row-group"|"table-cell"|"table-column"|"table-row"|"none";
|
|
129
|
-
// type DirectionValues = BasicCommonValues|"ltr"|"rtl";
|
|
130
|
-
// type FontStyleValues = BasicCommonValues|"normal"|"italic"|"oblique";
|
|
131
|
-
// type FontVariantValues = BasicCommonValues|"normal"|"small-caps";
|
|
132
|
-
// type FontVariantCapsValues = FontVariantValues|"all-small-caps"|"petite-caps"|"all-petite-caps"|"unicase"|"titling-caps";
|
|
133
|
-
// type FontWeightValues = GKV|ValueOrReactive<number>|"normal"|"bold"|"bolder"|"lighter";
|
|
134
|
-
// type OutlineWidthValues = GKV|"medium"|"thin"|"thick"|NumericLength;
|
|
135
|
-
// type PositionNames = BasicCommonValues|"static"|"relative"|"fixed"|"absolute"|"sticky";
|
|
136
|
-
|
|
137
|
-
// type FlexDirectionNames = BasicCommonValues|"row"|"row-reverse"|"column"|"column-reverse";
|
|
138
|
-
// type FlexWrapNames = BasicCommonValues|"nowrap"|"wrap"|"wrap-reverse";
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
// Advanced formatted types.
|
|
142
|
-
|
|
143
|
-
// type BackgroundRepeatValues2d = BackgroundRepeatValues|"repeat-x"|"repeat-y"|`${BackgroundRepeatValues} ${BackgroundRepeatValues}`;
|
|
144
|
-
// type BorderShorthand = BasicCommonValues|`${BorderStyles}`|`${BorderStyles} ${Color}`|ComplexType;//`${number}${AllLengthUnits} ${BorderStyles} ${Color}`;
|
|
145
|
-
// type BackgroundImageFormat = BasicCommonValues|Url|`${Url}, ${Url}`;
|
|
146
|
-
// type BackgroundPositionShorthand2D = BasicCommonValues|`${BasicCommonValues|number} ${BasicCommonValues|number}`|`${number}% ${number}%`|`${"left"|"right"|"center"} ${"top"|"center"|"bottom"}`;
|
|
147
|
-
// type BackgroundShorthand = BasicCommonValues|ComplexType;//`${Color} ${Url} ${BackgroundRepeatValues} ${BackgroundPositionShorthand2D}`;
|
|
148
|
-
// type FlexFlowShorthand = BasicCommonValues|`${FlexDirectionNames} ${FlexWrapNames}`;
|
|
149
|
-
// type FlexShorthand = BasicCommonValues|`${BasicCommonValues|number} ${BasicCommonValues|number} ${BasicCommonValues|`${number}${AllLengthUnits}`}`;
|
|
150
|
-
|
|
151
|
-
export default interface IDotCss extends IDotcssProp{
|
|
152
|
-
// TODO: ensure each of these has test cases.
|
|
153
|
-
// Right now, most of these don't actually work. But they're typed so that they can progressively be added to the librrary.
|
|
154
|
-
(selector: "@charset", charset: string): void;
|
|
155
|
-
(selector: "@color-profile", name: string, styles: IAtColorProfileBuilder): void;
|
|
156
|
-
(selector: "@container", condition: string, styles: IDotcssProp): void;
|
|
157
|
-
(selector: "@counter-style", name: string, styles: IAtCounterStyleBuilder): void;
|
|
158
|
-
// (selector: "@document"): void; // Deprecated. Will not support it. https://developer.mozilla.org/en-US/docs/Web/CSS/@document
|
|
159
|
-
(selector: "@font-face"): void;
|
|
160
|
-
// (selector: "@font-feature-values"): void; // Need more info on declaration rule lists. https://developer.mozilla.org/en-US/docs/Web/CSS/@font-feature-values
|
|
161
|
-
(selector: "@font-palette-values", identifier: string, rules: IAtFontPaletteValues): void;
|
|
162
|
-
(selector: "@import", value: string): void;
|
|
163
|
-
(selector: "@keyframes", name: string, rules: IAtKeyframesBuilder): void;
|
|
164
|
-
(selector: "@layer", layerNames: string|string[]): void;
|
|
165
|
-
(selector: "@layer", rules: Record<string, IDotcssProp>): void;
|
|
166
|
-
(selector: "@layer", layerName: string, rules: Record<string, IDotcssProp>): void;
|
|
167
|
-
(selector: "@media", rules: Record<string, IDotcssProp>): void;
|
|
168
|
-
(selector: "@namespace", value: string): void;
|
|
169
|
-
(selector: "@page", styles: IAtPageBuilder): void;
|
|
170
|
-
(selector: "@page", pseudo: string, styles: IAtPageBuilder): void;
|
|
171
|
-
// (selector: "@property"): void; // This would be great if we could extend dothtml. Until then, there's no point of adding this because it only applies within CSS. Note that this can also be called using javascript. https://developer.mozilla.org/en-US/docs/Web/CSS/@property
|
|
172
|
-
(selector: "@scope", rules: Record<string, IDotcssProp>): void;
|
|
173
|
-
(selector: "@scope", scope: string, rules: Record<string, IDotcssProp>): void;
|
|
174
|
-
// (selector: "@starting-style"): void; // This one can be used as a standalone block or as a nested block. It needs more thought. Not supported yet. https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style
|
|
175
|
-
// (selector: "@supports", condition: string): void; // This needs more thought. Normally the selectors are accepted as params, but here they go inside. Not supported yet. https://developer.mozilla.org/en-US/docs/Web/CSS/@supports
|
|
176
|
-
|
|
177
|
-
(selector: Array<HTMLElement>|HTMLElement|string, styles: IDotcssProp): void;
|
|
178
|
-
(styles: IDotcssProp): void;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
//
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
// (value:
|
|
191
|
-
//
|
|
192
|
-
|
|
193
|
-
//
|
|
194
|
-
//
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
// duration
|
|
198
|
-
//
|
|
199
|
-
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
|
|
207
|
-
//
|
|
208
|
-
//
|
|
209
|
-
//
|
|
210
|
-
//
|
|
211
|
-
//
|
|
212
|
-
//
|
|
213
|
-
|
|
214
|
-
//
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
import IAtColorProfileBuilder from "./at-rules/i-at-color-profile-builder";
|
|
4
|
+
import IAtCounterStyleBuilder from "./at-rules/i-at-counter-style-builder";
|
|
5
|
+
import IAtFontPaletteValues from "./at-rules/i-at-font-palette-values";
|
|
6
|
+
import IAtKeyframesBuilder from "./at-rules/i-at-keyframes-builder";
|
|
7
|
+
import IAtPageBuilder from "./at-rules/i-at-page-builder";
|
|
8
|
+
import IDotcssProp from "./i-css-prop";
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
// EASING FUNCTION
|
|
14
|
+
|
|
15
|
+
// type StepPosition = "jump-start"|"jump-end"|"jump-none"|"jump-both"|"start"|"end";
|
|
16
|
+
// type LinearStopLength = Percentage|`${Percentage} ${Percentage}`;
|
|
17
|
+
// type LinearStop = number|`${number} ${LinearStopLength}`|`${LinearStopLength} ${number}`;
|
|
18
|
+
// type LinearStopList = `${LinearStop}${`, ${LinearStop}${`, ${LinearStop}${`, ${LinearStop}${`, ${LinearStop}${ComplexType}`|""}`|""}`|""}`|""}`;
|
|
19
|
+
|
|
20
|
+
// type StepEasingFunction = "step-start"|"step-end"|`steps(${Int}${`, ${StepPosition}`|""})`;
|
|
21
|
+
// type CubicBezierEasingFunction = "ease"|"ease-in"|"ease-out"|"ease-in-out"|`cubic-bezier(${number}, ${number}, ${number}, ${number})`;
|
|
22
|
+
// type LinearEasingFunction = `linear(${LinearStopList})`;
|
|
23
|
+
// type EasingFunction = "linear"|LinearEasingFunction|CubicBezierEasingFunction|StepEasingFunction;
|
|
24
|
+
|
|
25
|
+
// FILTER FUNCTION
|
|
26
|
+
// TODO: don't forget to provide builders for these. Already put work into some.
|
|
27
|
+
// type SaturateFunction = `saturate(${number|Percentage|""})`;
|
|
28
|
+
// type SepiaFunction = `sepia(${number|Percentage|""})`;
|
|
29
|
+
// type OpacityFunction = `opacity(${number|Percentage|""})`;
|
|
30
|
+
// type InvertFunction = `invert(${number|Percentage|""})`;
|
|
31
|
+
// type GrayscaleFunction = `grayscale(${number|Percentage|""})`;
|
|
32
|
+
// type ContrastFunction = `contrast(${number|Percentage|""})`;
|
|
33
|
+
// type BrightnessFunction = `brightness(${number|Percentage|""})`;
|
|
34
|
+
// type BlurFunction = `blur(${NumericLength|""})`;
|
|
35
|
+
// Regrettably, strong typing for color isn't possible due to the type complexity.
|
|
36
|
+
// Even SimpleColor doesn't work. We use string in place of Color.
|
|
37
|
+
// type DropShadowFunction = `drop-shadow(${`${ComplexType} ${NumericLength} ${NumericLength}`
|
|
38
|
+
// |`${NumericLength} ${NumericLength} ${ComplexType}`
|
|
39
|
+
// |`${NumericLength} ${NumericLength}`
|
|
40
|
+
// |`${ComplexType} ${NumericLength} ${NumericLength} ${NumericLength}`
|
|
41
|
+
// |`${NumericLength} ${NumericLength} ${NumericLength} ${ComplexType}`
|
|
42
|
+
// |`${NumericLength} ${NumericLength} ${NumericLength}`
|
|
43
|
+
// })`;
|
|
44
|
+
// type HueRotateFunction = `hue-rotate(${Angle|""})`;
|
|
45
|
+
// type FilterFunction = SaturateFunction|SepiaFunction|OpacityFunction|InvertFunction|GrayscaleFunction|ContrastFunction|BrightnessFunction|BlurFunction|DropShadowFunction|HueRotateFunction;
|
|
46
|
+
|
|
47
|
+
// FLEX
|
|
48
|
+
type Flex = `${number}fr`;
|
|
49
|
+
|
|
50
|
+
// FONT
|
|
51
|
+
|
|
52
|
+
// type GenericFamily = "serif" | "sans-serif" | "monospace" | "cursive" | "fantasy" | "system-ui" | "ui-serif" | "ui-sans-serif" | "ui-monospace" | "ui-rounded" | "emoji" | "math" | "fangsong";
|
|
53
|
+
|
|
54
|
+
// POSITION
|
|
55
|
+
// type HorizontalPosition = "left" | "center" | "right" | LengthPercentage;
|
|
56
|
+
// type VerticalPosition = "top" | "center" | "bottom" | LengthPercentage;
|
|
57
|
+
|
|
58
|
+
// type Position =
|
|
59
|
+
// | HorizontalPosition
|
|
60
|
+
// | VerticalPosition
|
|
61
|
+
// | `${HorizontalPosition} ${VerticalPosition}`
|
|
62
|
+
// | `${VerticalPosition} ${HorizontalPosition}`
|
|
63
|
+
// | `${"left" | "right"} ${LengthPercentage}`
|
|
64
|
+
// | `${"top" | "bottom"} ${LengthPercentage}`
|
|
65
|
+
// | `${"left" | "right"} ${LengthPercentage} ${"top" | "bottom"} ${LengthPercentage}`
|
|
66
|
+
// | `${"top" | "bottom"} ${LengthPercentage} ${"left" | "right"} ${LengthPercentage}`;
|
|
67
|
+
|
|
68
|
+
// GRADIENT
|
|
69
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/gradient
|
|
70
|
+
// TODO: absolutely need a builder for this.
|
|
71
|
+
|
|
72
|
+
// type RadialShape = "circle"|"ellipse";
|
|
73
|
+
// type RadialExtent = "closest-corner"|"closest-side"|"farthest-corner"|"farthest-side";
|
|
74
|
+
// type SideOrCorner = "left"|"right"|"top"|"bottom"|`${"left" | "right"} ${"top" | "bottom"}`|`${"top" | "bottom"} ${"left" | "right"}`;
|
|
75
|
+
// type RadialSize = `${RadialExtent} ${NumericLength} ${LengthPercentage} ${LengthPercentage}`;
|
|
76
|
+
// type LinearColorStop = Color|`${Color} ${LengthPercentage}`;
|
|
77
|
+
// type LinearColorHint = LengthPercentage;
|
|
78
|
+
// // type LinearColorStopListItem = LinearColorStop|`${LinearColorHint}, ${LinearColorStop}`; // TOO COMPLEX :(
|
|
79
|
+
// type LinearColorStopListItem = LinearColorStop|`${ComplexType}, ${LinearColorStop}`; // TODO: this type got botched due to complexity.
|
|
80
|
+
// type ColorStopList = `${LinearColorStop}${`, ${ComplexType}`}`|`${LinearColorStop}`;
|
|
81
|
+
|
|
82
|
+
// type AngleOrSideOrCorner = Angle | `to ${SideOrCorner}, `;
|
|
83
|
+
// type LinearGradientSyntax = ComplexType; //`${`${AngleOrSideOrCorner} `|""}${ColorStopList}`;
|
|
84
|
+
// // type RadiatShapeOrSize = RadialShape | RadialSize | `${RadialShape} ${RadialSize}` | `${RadialSize} ${RadialShape}`;
|
|
85
|
+
// type RadiatShapeOrSize = RadialShape | RadialSize | ComplexType;//`${RadialShape} ${RadialSize}` | `${RadialSize} ${RadialShape}`;
|
|
86
|
+
// type RadialGradientSyntax = `${`${RadiatShapeOrSize} ` | ""} [ at <position> ]? , <color-stop-list>`;
|
|
87
|
+
// type LinearGradientFunction = `linear-gradient(${LinearGradientSyntax})`;
|
|
88
|
+
// type RepeatingLinearGradientFunction = `linear-gradient(${LinearGradientSyntax})`;
|
|
89
|
+
// type RadialGradientFunction = `radial-gradient(${RadialGradientSyntax})`;
|
|
90
|
+
// type RepeatingRadialGradientFunction = `radial-gradient(${RadialGradientSyntax})`;
|
|
91
|
+
// type Gradient = LinearGradientFunction | RepeatingLinearGradientFunction | RadialGradientFunction | RepeatingRadialGradientFunction;
|
|
92
|
+
|
|
93
|
+
// URL
|
|
94
|
+
// type Url = `${"src"|"url"}(${string})`;
|
|
95
|
+
|
|
96
|
+
// IMAGE
|
|
97
|
+
// type Image = Url|Gradient;
|
|
98
|
+
|
|
99
|
+
// TODO:
|
|
100
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function
|
|
101
|
+
// type TransformFunction = ComplexType;
|
|
102
|
+
|
|
103
|
+
// Building blocks.
|
|
104
|
+
|
|
105
|
+
// type OptionalWhitespace = ""|" ";
|
|
106
|
+
// export type Percentage = number|`${number}%`; // Used for filters.
|
|
107
|
+
|
|
108
|
+
// ts starts complaining about the complexity of the type :(
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
// Types
|
|
112
|
+
// TODO: look up types online and correct this.
|
|
113
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/absolute-size
|
|
114
|
+
|
|
115
|
+
// MORE COMPLEX TYPES?
|
|
116
|
+
|
|
117
|
+
// type NumericLengthOrAuto = NumericLength|"auto";
|
|
118
|
+
// type NumericAngle = number|`${number}${AngleUnits}`;
|
|
119
|
+
|
|
120
|
+
// type AppearanceValues = BasicCommonValues|"none"|"menulist-button"|"textfield"|"button"|"searchfield"|"textarea"|"push-button"|"slider-horizontal"|"checkbox"|"radio"|"square-button"|"menulist"|"listbox"|"meter"|"progress-bar"|"scrollbarbutton-up"|"button-bevel"|"media-mute-button"|"caret";
|
|
121
|
+
// type BackgroundAttachmentValues = BasicCommonValues|"scroll"|"fixed"|"local";
|
|
122
|
+
// type BackgroundRepeatValues = GKV|"no-repeat"|"repeat"|"space"|"round";
|
|
123
|
+
// type BackgroundOriginValues = GKV|"padding-box"|"border-box"|"content-box";
|
|
124
|
+
// type BackgroundSizeValues = BasicCommonValues|"auto"|NumericLength|"cover"|"contain";
|
|
125
|
+
// type BackfaceVisibilityValues = BasicCommonValues|"visible"|"hidden";
|
|
126
|
+
// type BorderStyles = GKV|"dotted"|"dashed"|"solid"|"double"|"groove"|"ridge"|"inset"|"outset"|"none"|"hidden";
|
|
127
|
+
|
|
128
|
+
// type DisplayValues = BasicCommonValues|"inline"|"block"|"contents"|"flex"|"grid"|"inline-block"|"inline-flex"|"inline-grid"|"inline-table"|"list-item"|"run-in"|"table"|"table-caption"|"table-column-group"|"table-header-group"|"table-footer-group"|"table-row-group"|"table-cell"|"table-column"|"table-row"|"none";
|
|
129
|
+
// type DirectionValues = BasicCommonValues|"ltr"|"rtl";
|
|
130
|
+
// type FontStyleValues = BasicCommonValues|"normal"|"italic"|"oblique";
|
|
131
|
+
// type FontVariantValues = BasicCommonValues|"normal"|"small-caps";
|
|
132
|
+
// type FontVariantCapsValues = FontVariantValues|"all-small-caps"|"petite-caps"|"all-petite-caps"|"unicase"|"titling-caps";
|
|
133
|
+
// type FontWeightValues = GKV|ValueOrReactive<number>|"normal"|"bold"|"bolder"|"lighter";
|
|
134
|
+
// type OutlineWidthValues = GKV|"medium"|"thin"|"thick"|NumericLength;
|
|
135
|
+
// type PositionNames = BasicCommonValues|"static"|"relative"|"fixed"|"absolute"|"sticky";
|
|
136
|
+
|
|
137
|
+
// type FlexDirectionNames = BasicCommonValues|"row"|"row-reverse"|"column"|"column-reverse";
|
|
138
|
+
// type FlexWrapNames = BasicCommonValues|"nowrap"|"wrap"|"wrap-reverse";
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
// Advanced formatted types.
|
|
142
|
+
|
|
143
|
+
// type BackgroundRepeatValues2d = BackgroundRepeatValues|"repeat-x"|"repeat-y"|`${BackgroundRepeatValues} ${BackgroundRepeatValues}`;
|
|
144
|
+
// type BorderShorthand = BasicCommonValues|`${BorderStyles}`|`${BorderStyles} ${Color}`|ComplexType;//`${number}${AllLengthUnits} ${BorderStyles} ${Color}`;
|
|
145
|
+
// type BackgroundImageFormat = BasicCommonValues|Url|`${Url}, ${Url}`;
|
|
146
|
+
// type BackgroundPositionShorthand2D = BasicCommonValues|`${BasicCommonValues|number} ${BasicCommonValues|number}`|`${number}% ${number}%`|`${"left"|"right"|"center"} ${"top"|"center"|"bottom"}`;
|
|
147
|
+
// type BackgroundShorthand = BasicCommonValues|ComplexType;//`${Color} ${Url} ${BackgroundRepeatValues} ${BackgroundPositionShorthand2D}`;
|
|
148
|
+
// type FlexFlowShorthand = BasicCommonValues|`${FlexDirectionNames} ${FlexWrapNames}`;
|
|
149
|
+
// type FlexShorthand = BasicCommonValues|`${BasicCommonValues|number} ${BasicCommonValues|number} ${BasicCommonValues|`${number}${AllLengthUnits}`}`;
|
|
150
|
+
|
|
151
|
+
export default interface IDotCss extends IDotcssProp{
|
|
152
|
+
// TODO: ensure each of these has test cases.
|
|
153
|
+
// Right now, most of these don't actually work. But they're typed so that they can progressively be added to the librrary.
|
|
154
|
+
(selector: "@charset", charset: string): void;
|
|
155
|
+
(selector: "@color-profile", name: string, styles: IAtColorProfileBuilder): void;
|
|
156
|
+
(selector: "@container", condition: string, styles: IDotcssProp): void;
|
|
157
|
+
(selector: "@counter-style", name: string, styles: IAtCounterStyleBuilder): void;
|
|
158
|
+
// (selector: "@document"): void; // Deprecated. Will not support it. https://developer.mozilla.org/en-US/docs/Web/CSS/@document
|
|
159
|
+
(selector: "@font-face"): void;
|
|
160
|
+
// (selector: "@font-feature-values"): void; // Need more info on declaration rule lists. https://developer.mozilla.org/en-US/docs/Web/CSS/@font-feature-values
|
|
161
|
+
(selector: "@font-palette-values", identifier: string, rules: IAtFontPaletteValues): void;
|
|
162
|
+
(selector: "@import", value: string): void;
|
|
163
|
+
(selector: "@keyframes", name: string, rules: IAtKeyframesBuilder): void;
|
|
164
|
+
(selector: "@layer", layerNames: string|string[]): void;
|
|
165
|
+
(selector: "@layer", rules: Record<string, IDotcssProp>): void;
|
|
166
|
+
(selector: "@layer", layerName: string, rules: Record<string, IDotcssProp>): void;
|
|
167
|
+
(selector: "@media", rules: Record<string, IDotcssProp>): void;
|
|
168
|
+
(selector: "@namespace", value: string): void;
|
|
169
|
+
(selector: "@page", styles: IAtPageBuilder): void;
|
|
170
|
+
(selector: "@page", pseudo: string, styles: IAtPageBuilder): void;
|
|
171
|
+
// (selector: "@property"): void; // This would be great if we could extend dothtml. Until then, there's no point of adding this because it only applies within CSS. Note that this can also be called using javascript. https://developer.mozilla.org/en-US/docs/Web/CSS/@property
|
|
172
|
+
(selector: "@scope", rules: Record<string, IDotcssProp>): void;
|
|
173
|
+
(selector: "@scope", scope: string, rules: Record<string, IDotcssProp>): void;
|
|
174
|
+
// (selector: "@starting-style"): void; // This one can be used as a standalone block or as a nested block. It needs more thought. Not supported yet. https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style
|
|
175
|
+
// (selector: "@supports", condition: string): void; // This needs more thought. Normally the selectors are accepted as params, but here they go inside. Not supported yet. https://developer.mozilla.org/en-US/docs/Web/CSS/@supports
|
|
176
|
+
|
|
177
|
+
(selector: Array<HTMLElement>|HTMLElement|string, styles: IDotcssProp): void;
|
|
178
|
+
(styles: IDotcssProp): void;
|
|
179
|
+
|
|
180
|
+
variable(name: string, value: any): this;
|
|
181
|
+
v(name: string): string;
|
|
182
|
+
[prop: string]: any;
|
|
183
|
+
|
|
184
|
+
version: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// export interface IDotcssAnimatable<T> extends IDotcssProp{
|
|
188
|
+
// (value: T): IDotcssProp;
|
|
189
|
+
|
|
190
|
+
// animate(value: number|string, duration: number, style: "ease", complete: Function): IDotcssProp;
|
|
191
|
+
// }
|
|
192
|
+
|
|
193
|
+
// export interface IDotcssAnimatableColor extends IDotcssProp{
|
|
194
|
+
// (value: Color|Array<number>): IDotcssProp;
|
|
195
|
+
// (r: number, g: number, b: number, a?: number): IDotcssProp;
|
|
196
|
+
|
|
197
|
+
// animate(value: Color|Array<number>, duration: number, style: "ease", complete: Function): IDotcssProp;
|
|
198
|
+
// }
|
|
199
|
+
|
|
200
|
+
// export interface HideParams{
|
|
201
|
+
// duration?: number,
|
|
202
|
+
// complete?: Function,
|
|
203
|
+
// hideStyle?: "normal"|"fade"|"shrink",
|
|
204
|
+
// animationStyle?: "ease",
|
|
205
|
+
// }
|
|
206
|
+
|
|
207
|
+
// export interface ShowParams{
|
|
208
|
+
// duration?: number,
|
|
209
|
+
// display?: DisplayValues, // TODO: potential to expand this.
|
|
210
|
+
// complete?: Function,
|
|
211
|
+
// opacity?: number,
|
|
212
|
+
// width?: number,
|
|
213
|
+
// height?: number,
|
|
214
|
+
// showStyle?: "normal"|"fade"|"grow",
|
|
215
|
+
// animationStyle?: "ease",
|
|
216
|
+
// }
|
|
217
|
+
|
|
218
|
+
// TODO: add tests for these. Especially the 2-parameter ones.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { IReactive } from "../../bindings/i-reactive";
|
|
2
|
-
|
|
3
|
-
type V = IReactive | number | string;
|
|
4
|
-
|
|
5
|
-
type AngleUnitSuffix = "" | "Deg" | "Grad" | "Rad" | "Turn";
|
|
6
|
-
|
|
7
|
-
type AngleProp<Prefixes extends Array<string>, Qty extends 1|2|3|4 = 1> = {
|
|
8
|
-
[Key in AngleUnitSuffix as `${Prefixes[number]}${Key}`]?: (
|
|
9
|
-
(Qty extends 1 ? V|[V] : void) |
|
|
10
|
-
(Qty extends 2 ? [V, V] : void) |
|
|
11
|
-
(Qty extends 3 ? [V, V, V] : void) |
|
|
12
|
-
(Qty extends 4 ? [V, V, V, V] : void)
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
|
|
1
|
+
import { IReactive } from "../../bindings/i-reactive";
|
|
2
|
+
|
|
3
|
+
type V = IReactive | number | string;
|
|
4
|
+
|
|
5
|
+
type AngleUnitSuffix = "" | "Deg" | "Grad" | "Rad" | "Turn";
|
|
6
|
+
|
|
7
|
+
type AngleProp<Prefixes extends Array<string>, Qty extends 1|2|3|4 = 1> = {
|
|
8
|
+
[Key in AngleUnitSuffix as `${Prefixes[number]}${Key}`]?: (
|
|
9
|
+
(Qty extends 1 ? V|[V] : void) |
|
|
10
|
+
(Qty extends 2 ? [V, V] : void) |
|
|
11
|
+
(Qty extends 3 ? [V, V, V] : void) |
|
|
12
|
+
(Qty extends 4 ? [V, V, V, V] : void)
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
16
|
export default AngleProp;
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { IBinding } from "../../bindings/i-binding";
|
|
2
|
-
import { IWatcher } from "../../bindings/i-watcher";
|
|
3
|
-
|
|
4
|
-
type V = IBinding<any, number|string>| IWatcher<number|string> | number | string;
|
|
5
|
-
|
|
6
|
-
type ColorUnitSuffix = ""
|
|
7
|
-
| "Rgb"
|
|
8
|
-
| "Lab"
|
|
9
|
-
| "Oklab"
|
|
10
|
-
| "Hsl" | "HslDeg" | "HslGrad" | "HslRad" | "HslTurn"
|
|
11
|
-
| "Hwb" | "HwbDeg" | "HwbGrad" | "HwbRad" | "HwbTurn"
|
|
12
|
-
| "Lch" | "LchDeg" | "LchGrad" | "LchRad" | "LchTurn"
|
|
13
|
-
| "Oklch" | "OklchDeg" | "OklchGrad" | "OklchRad" | "OklchTurn"
|
|
14
|
-
| "Color"
|
|
15
|
-
| "Srgb"|"SrgbLinear"|"DisplayP3"|"A98Rgb"|"ProphotoRgb"|"Rec2020"
|
|
16
|
-
| "Xyz"|"XyzD50"|"XyzD65";
|
|
17
|
-
|
|
18
|
-
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";
|
|
19
|
-
type SystemColor = "AccentColor"|"AccentColorText"|"ActiveText"|"ButtonBorder"|"ButtonFace"|"ButtonText"|"Canvas"|"CanvasText"|"Field"|"FieldText"|"GrayText"|"Highlight"|"HighlightText"|"LinkText"|"Mark"|"MarkText"|"SelectedItem"|"SelectedItemText"|"VisitedText";
|
|
20
|
-
type SpecialColors = "currentcolor"|"transparent";
|
|
21
|
-
|
|
22
|
-
type ColorProp<Prefix extends string> = {
|
|
23
|
-
[Key in ColorUnitSuffix as `${Prefix}${Key}`]?: (
|
|
24
|
-
(Key extends "" ? IBinding<any, string> | IWatcher<string> | NamedColor | SystemColor | SpecialColors | `#${string}` | `${"rgb"|"rgba"|"hsl"|"hsla"|"hwb"|"lab"|"lch"|"oklab"|"oklch"|"color"}(${string})` : void) |
|
|
25
|
-
(Key extends "Rgb" | "Hsl" | "HslDeg" | "HslGrad" | "HslRad" | "HslTurn" | "Hwb" | "HwbDeg" | "HwbGrad" | "HwbRad" | "HwbTurn" | "Lab" | "Lch" | "LchDeg" | "LchGrad" | "LchRad" | "LchTurn" | "Oklch" | "OklchDeg" | "OklchGrad" | "OklchRad" | "OklchTurn" ? [V, V, V] | [V, V, V, V] : void) |
|
|
26
|
-
(Key extends "Srgb" | "SrgbLinear" | "DisplayP3" | "A98Rgb" | "ProphotoRgb" | "Rec2020" | "Xyz" | "XyzD50" | "XyzD65" ? [V, V, V] : void)
|
|
27
|
-
);
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export default ColorProp;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
// Color
|
|
36
|
-
|
|
37
|
-
// export type Hue = number|Angle;
|
|
38
|
-
// export type PredefinedRgb = "srgb"|"srgb-linear"|"display-p3"|"a98-rgb"|"prophoto-rgb"|"rec2020";
|
|
39
|
-
// export type XyzSpace = "xyz"|"xyz-d50"|"xyz-d65";
|
|
40
|
-
// export type XyzParams = `${XyzSpace} ${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"}`
|
|
41
|
-
// export type PredefinedRgbParams = `${PredefinedRgb} ${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"}`
|
|
42
|
-
// export type ColorspaceParams = PredefinedRgbParams|XyzParams;
|
|
43
|
-
|
|
44
|
-
// export type LRgba<T extends number|AlphaValue> = `rgb(${T}, ${T}, ${T})` | `rgba(${T}, ${T}, ${T}, ${AlphaValue})`;
|
|
45
|
-
// export type MRgba = `rgb(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"})` | `rgba(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"} / ${AlphaValue})`;
|
|
46
|
-
// export type Rgba = LRgba<number|AlphaValue>|MRgba;
|
|
47
|
-
// export type LHsla = `hsl(${Hue}, ${Percentage}, ${Percentage})` | `hsla(${Hue}, ${Percentage}, ${Percentage}, ${AlphaValue})`;
|
|
48
|
-
// export type MHsla = `hsl(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"})` | `hsla(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"} / ${AlphaValue|"none"})`;
|
|
49
|
-
// export type Hsla = LHsla|MHsla;
|
|
50
|
-
// export type Hwb = `hwb(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"})` | `hwb(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"} / ${AlphaValue|"none"})`;
|
|
51
|
-
// export 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"})`;
|
|
52
|
-
// export type Lch = `${"lch"|"oklch"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${Hue|"none"})` | `${"lch"|"oklch"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${Hue|"none"} / ${AlphaValue|"none"})`;
|
|
53
|
-
// export type ColorFunc = `color(${ColorspaceParams})`| `color(${ColorspaceParams} / ${AlphaValue|"none"})`;
|
|
54
|
-
// export type AbsoluteColorFunction = Rgba|Hsla|Hwb|Lab|Lch|ColorFunc;
|
|
55
|
-
|
|
56
|
-
// export type AbsoluteColorBase = HexColor|AbsoluteColorFunction|NamedColor|"transparent";
|
|
57
|
-
// export type Color = AbsoluteColorBase|SystemColor|"currentcolor";
|
|
58
|
-
// export type SimpleColor =
|
|
59
|
-
// HexColor
|
|
60
|
-
// |`${"rgb"|"rgba"|"hsl"|"hsla"|"hwb"|"lab"|"lch"|"oklab"|"oklch"|"color"}(${ComplexType})`
|
|
1
|
+
import { IBinding } from "../../bindings/i-binding";
|
|
2
|
+
import { IWatcher } from "../../bindings/i-watcher";
|
|
3
|
+
|
|
4
|
+
type V = IBinding<any, number|string>| IWatcher<number|string> | number | string;
|
|
5
|
+
|
|
6
|
+
type ColorUnitSuffix = ""
|
|
7
|
+
| "Rgb"
|
|
8
|
+
| "Lab"
|
|
9
|
+
| "Oklab"
|
|
10
|
+
| "Hsl" | "HslDeg" | "HslGrad" | "HslRad" | "HslTurn"
|
|
11
|
+
| "Hwb" | "HwbDeg" | "HwbGrad" | "HwbRad" | "HwbTurn"
|
|
12
|
+
| "Lch" | "LchDeg" | "LchGrad" | "LchRad" | "LchTurn"
|
|
13
|
+
| "Oklch" | "OklchDeg" | "OklchGrad" | "OklchRad" | "OklchTurn"
|
|
14
|
+
| "Color"
|
|
15
|
+
| "Srgb"|"SrgbLinear"|"DisplayP3"|"A98Rgb"|"ProphotoRgb"|"Rec2020"
|
|
16
|
+
| "Xyz"|"XyzD50"|"XyzD65";
|
|
17
|
+
|
|
18
|
+
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";
|
|
19
|
+
type SystemColor = "AccentColor"|"AccentColorText"|"ActiveText"|"ButtonBorder"|"ButtonFace"|"ButtonText"|"Canvas"|"CanvasText"|"Field"|"FieldText"|"GrayText"|"Highlight"|"HighlightText"|"LinkText"|"Mark"|"MarkText"|"SelectedItem"|"SelectedItemText"|"VisitedText";
|
|
20
|
+
type SpecialColors = "currentcolor"|"transparent";
|
|
21
|
+
|
|
22
|
+
type ColorProp<Prefix extends string> = {
|
|
23
|
+
[Key in ColorUnitSuffix as `${Prefix}${Key}`]?: (
|
|
24
|
+
(Key extends "" ? IBinding<any, string> | IWatcher<string> | NamedColor | SystemColor | SpecialColors | `#${string}` | `${"rgb"|"rgba"|"hsl"|"hsla"|"hwb"|"lab"|"lch"|"oklab"|"oklch"|"color"}(${string})` : void) |
|
|
25
|
+
(Key extends "Rgb" | "Hsl" | "HslDeg" | "HslGrad" | "HslRad" | "HslTurn" | "Hwb" | "HwbDeg" | "HwbGrad" | "HwbRad" | "HwbTurn" | "Lab" | "Lch" | "LchDeg" | "LchGrad" | "LchRad" | "LchTurn" | "Oklch" | "OklchDeg" | "OklchGrad" | "OklchRad" | "OklchTurn" ? [V, V, V] | [V, V, V, V] : void) |
|
|
26
|
+
(Key extends "Srgb" | "SrgbLinear" | "DisplayP3" | "A98Rgb" | "ProphotoRgb" | "Rec2020" | "Xyz" | "XyzD50" | "XyzD65" ? [V, V, V] : void)
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export default ColorProp;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
// Color
|
|
36
|
+
|
|
37
|
+
// export type Hue = number|Angle;
|
|
38
|
+
// export type PredefinedRgb = "srgb"|"srgb-linear"|"display-p3"|"a98-rgb"|"prophoto-rgb"|"rec2020";
|
|
39
|
+
// export type XyzSpace = "xyz"|"xyz-d50"|"xyz-d65";
|
|
40
|
+
// export type XyzParams = `${XyzSpace} ${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"}`
|
|
41
|
+
// export type PredefinedRgbParams = `${PredefinedRgb} ${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"}`
|
|
42
|
+
// export type ColorspaceParams = PredefinedRgbParams|XyzParams;
|
|
43
|
+
|
|
44
|
+
// export type LRgba<T extends number|AlphaValue> = `rgb(${T}, ${T}, ${T})` | `rgba(${T}, ${T}, ${T}, ${AlphaValue})`;
|
|
45
|
+
// export type MRgba = `rgb(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"})` | `rgba(${number|Percentage|"none"} ${number|Percentage|"none"} ${number|Percentage|"none"} / ${AlphaValue})`;
|
|
46
|
+
// export type Rgba = LRgba<number|AlphaValue>|MRgba;
|
|
47
|
+
// export type LHsla = `hsl(${Hue}, ${Percentage}, ${Percentage})` | `hsla(${Hue}, ${Percentage}, ${Percentage}, ${AlphaValue})`;
|
|
48
|
+
// export type MHsla = `hsl(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"})` | `hsla(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"} / ${AlphaValue|"none"})`;
|
|
49
|
+
// export type Hsla = LHsla|MHsla;
|
|
50
|
+
// export type Hwb = `hwb(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"})` | `hwb(${Hue|"none"} ${Percentage|number|"none"} ${Percentage|number|"none"} / ${AlphaValue|"none"})`;
|
|
51
|
+
// export 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"})`;
|
|
52
|
+
// export type Lch = `${"lch"|"oklch"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${Hue|"none"})` | `${"lch"|"oklch"}(${number|Percentage|"none"} ${number|Percentage|"none"} ${Hue|"none"} / ${AlphaValue|"none"})`;
|
|
53
|
+
// export type ColorFunc = `color(${ColorspaceParams})`| `color(${ColorspaceParams} / ${AlphaValue|"none"})`;
|
|
54
|
+
// export type AbsoluteColorFunction = Rgba|Hsla|Hwb|Lab|Lch|ColorFunc;
|
|
55
|
+
|
|
56
|
+
// export type AbsoluteColorBase = HexColor|AbsoluteColorFunction|NamedColor|"transparent";
|
|
57
|
+
// export type Color = AbsoluteColorBase|SystemColor|"currentcolor";
|
|
58
|
+
// export type SimpleColor =
|
|
59
|
+
// HexColor
|
|
60
|
+
// |`${"rgb"|"rgba"|"hsl"|"hsla"|"hwb"|"lab"|"lch"|"oklab"|"oklch"|"color"}(${ComplexType})`
|
|
61
61
|
// |NamedColor|SystemColor|"currentcolor";
|