@ixfx/components 0.2.3 → 0.2.5
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/LICENSE +1 -1
- package/bundle/chunk-pbuEa-1d.js +13 -0
- package/bundle/index.d.ts +4702 -569
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +34929 -2800
- package/bundle/index.js.map +1 -1
- package/bundle/style.css +133 -0
- package/dist/ac-text.d.ts +97 -0
- package/dist/ac-text.d.ts.map +1 -0
- package/dist/ac-text.js +484 -0
- package/dist/ac-text.js.map +1 -0
- package/dist/button-DgKUzE5o.js +121 -0
- package/dist/button-DgKUzE5o.js.map +1 -0
- package/dist/button.d.ts +21 -0
- package/dist/button.d.ts.map +1 -0
- package/dist/button.js +3 -0
- package/dist/checkbox.d.ts +34 -0
- package/dist/checkbox.d.ts.map +1 -0
- package/dist/checkbox.js +251 -0
- package/dist/checkbox.js.map +1 -0
- package/dist/chunk-pbuEa-1d.js +13 -0
- package/dist/colour-C3MQIjFJ-BJV-QC-3.js +4138 -0
- package/dist/colour-C3MQIjFJ-BJV-QC-3.js.map +1 -0
- package/dist/colour-picker-Bw-AZoWx.js +922 -0
- package/dist/colour-picker-Bw-AZoWx.js.map +1 -0
- package/dist/colour-picker.d.ts +2 -0
- package/dist/colour-picker.js +2 -0
- package/dist/crumbs.d.ts +92 -0
- package/dist/crumbs.d.ts.map +1 -0
- package/dist/crumbs.js +789 -0
- package/dist/crumbs.js.map +1 -0
- package/dist/data-display.d.ts +24 -12
- package/dist/data-display.d.ts.map +1 -1
- package/dist/data-display.js +96 -105
- package/dist/data-display.js.map +1 -1
- package/dist/decorate-BZbkqIhA.js +9 -0
- package/dist/defaults-FEZaGiYZ.js +38 -0
- package/dist/defaults-FEZaGiYZ.js.map +1 -0
- package/dist/dist-By5URG0Y.js +1290 -0
- package/dist/dist-By5URG0Y.js.map +1 -0
- package/dist/dist-D7kJgnSE.js +1039 -0
- package/dist/dist-D7kJgnSE.js.map +1 -0
- package/dist/editable-label.d.ts +71 -0
- package/dist/editable-label.d.ts.map +1 -0
- package/dist/editable-label.js +279 -0
- package/dist/editable-label.js.map +1 -0
- package/dist/hex-editor-Gib1Grg2.d.ts +131 -0
- package/dist/hex-editor-Gib1Grg2.d.ts.map +1 -0
- package/dist/hex-editor-Wd6ZtZA2.js +1147 -0
- package/dist/hex-editor-Wd6ZtZA2.js.map +1 -0
- package/dist/hex.d.ts +2 -0
- package/dist/hex.js +2 -0
- package/dist/highlight-CAjwQ4GE.js +50 -0
- package/dist/highlight-CAjwQ4GE.js.map +1 -0
- package/dist/icon-BR5aTIiP.js +100 -0
- package/dist/icon-BR5aTIiP.js.map +1 -0
- package/dist/icon-DQKdfR7U.d.ts +36 -0
- package/dist/icon-DQKdfR7U.d.ts.map +1 -0
- package/dist/icons.d.ts +3 -0
- package/dist/icons.js +9 -0
- package/dist/icons.js.map +1 -0
- package/dist/incr-search-BjCNClnC.js +311 -0
- package/dist/incr-search-BjCNClnC.js.map +1 -0
- package/dist/incr-search.d.ts +2 -0
- package/dist/incr-search.js +3 -0
- package/dist/index-B1hNR7Z9.d.ts +36 -0
- package/dist/index-B1hNR7Z9.d.ts.map +1 -0
- package/dist/index-C5dK8RZa.d.ts +23 -0
- package/dist/index-C5dK8RZa.d.ts.map +1 -0
- package/dist/index-C9iBN908.d.ts +160 -0
- package/dist/index-C9iBN908.d.ts.map +1 -0
- package/dist/index-CPVcTTXo.d.ts +396 -0
- package/dist/index-CPVcTTXo.d.ts.map +1 -0
- package/dist/index-CQxanqXF.d.ts +183 -0
- package/dist/index-CQxanqXF.d.ts.map +1 -0
- package/dist/index-CpbBI3n7.d.ts +1239 -0
- package/dist/index-CpbBI3n7.d.ts.map +1 -0
- package/dist/index.d.ts +422 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5729 -14
- package/dist/index.js.map +1 -1
- package/dist/interaction-CQDQJf2Q.js +1 -0
- package/dist/keyboard-De_vOHLg.js +20 -0
- package/dist/keyboard-De_vOHLg.js.map +1 -0
- package/dist/labelled-input-base-DS6-6C0r.js +155 -0
- package/dist/labelled-input-base-DS6-6C0r.js.map +1 -0
- package/dist/labelled-input-base-DnRh4reU.d.ts +43 -0
- package/dist/labelled-input-base-DnRh4reU.d.ts.map +1 -0
- package/dist/labelled-radial-input.d.ts +34 -0
- package/dist/labelled-radial-input.d.ts.map +1 -0
- package/dist/labelled-radial-input.js +188 -0
- package/dist/labelled-radial-input.js.map +1 -0
- package/dist/labelled-range-input.d.ts +2 -0
- package/dist/labelled-range-input.js +132 -0
- package/dist/labelled-range-input.js.map +1 -0
- package/dist/led.d.ts +25 -0
- package/dist/led.d.ts.map +1 -0
- package/dist/led.js +92 -0
- package/dist/led.js.map +1 -0
- package/dist/menu-BV6UFx_z.js +813 -0
- package/dist/menu-BV6UFx_z.js.map +1 -0
- package/dist/menu-item-Cikacp4F.d.ts +128 -0
- package/dist/menu-item-Cikacp4F.d.ts.map +1 -0
- package/dist/menu-item-DEzL_Yjk.js +766 -0
- package/dist/menu-item-DEzL_Yjk.js.map +1 -0
- package/dist/menu.d.ts +3 -0
- package/dist/menu.js +3 -0
- package/dist/miller.d.ts +324 -0
- package/dist/miller.d.ts.map +1 -0
- package/dist/miller.js +1343 -0
- package/dist/miller.js.map +1 -0
- package/dist/narrowed-text.d.ts +72 -0
- package/dist/narrowed-text.d.ts.map +1 -0
- package/dist/narrowed-text.js +571 -0
- package/dist/narrowed-text.js.map +1 -0
- package/dist/panel.d.ts +43 -0
- package/dist/panel.d.ts.map +1 -0
- package/dist/panel.js +408 -0
- package/dist/panel.js.map +1 -0
- package/dist/plots.d.ts +2 -0
- package/dist/plots.js +2 -0
- package/dist/polar-pad.d.ts +67 -0
- package/dist/polar-pad.d.ts.map +1 -0
- package/dist/polar-pad.js +537 -0
- package/dist/polar-pad.js.map +1 -0
- package/dist/popup-Ddx9LCzY.js +24 -0
- package/dist/popup-Ddx9LCzY.js.map +1 -0
- package/dist/prominence-CreDBdCs.js +98 -0
- package/dist/prominence-CreDBdCs.js.map +1 -0
- package/dist/radial-input-CNJ8asY2.js +849 -0
- package/dist/radial-input-CNJ8asY2.js.map +1 -0
- package/dist/radial-input-xSTd4kEz.d.ts +70 -0
- package/dist/radial-input-xSTd4kEz.d.ts.map +1 -0
- package/dist/radial-input.d.ts +2 -0
- package/dist/radial-input.js +2 -0
- package/dist/range-input.d.ts +43 -0
- package/dist/range-input.d.ts.map +1 -0
- package/dist/range-input.js +459 -0
- package/dist/range-input.js.map +1 -0
- package/dist/range.d.ts +28 -0
- package/dist/range.d.ts.map +1 -0
- package/dist/range.js +136 -0
- package/dist/range.js.map +1 -0
- package/dist/registry-CZEB1YI9.js +21 -0
- package/dist/registry-CZEB1YI9.js.map +1 -0
- package/dist/selecthorizontal.d.ts +13 -8
- package/dist/selecthorizontal.d.ts.map +1 -1
- package/dist/selecthorizontal.js +21 -25
- package/dist/selecthorizontal.js.map +1 -1
- package/dist/snap-container.d.ts +50 -0
- package/dist/snap-container.d.ts.map +1 -0
- package/dist/snap-container.js +297 -0
- package/dist/snap-container.js.map +1 -0
- package/dist/split-layout.d.ts +56 -0
- package/dist/split-layout.d.ts.map +1 -0
- package/dist/split-layout.js +545 -0
- package/dist/split-layout.js.map +1 -0
- package/dist/style.css +133 -0
- package/dist/swipe.d.ts +48 -0
- package/dist/swipe.d.ts.map +1 -0
- package/dist/swipe.js +204 -0
- package/dist/swipe.js.map +1 -0
- package/dist/tab-list-CFF7uSYH.d.ts +66 -0
- package/dist/tab-list-CFF7uSYH.d.ts.map +1 -0
- package/dist/tabs.d.ts +2 -0
- package/dist/tabs.js +203 -0
- package/dist/tabs.js.map +1 -0
- package/dist/tickled-controller-Cq1Va0rR.d.ts +218 -0
- package/dist/tickled-controller-Cq1Va0rR.d.ts.map +1 -0
- package/dist/tickled-styles-Bg3QbcrD.js +327 -0
- package/dist/tickled-styles-Bg3QbcrD.js.map +1 -0
- package/dist/timeline-DBWJsSjd.js +1748 -0
- package/dist/timeline-DBWJsSjd.js.map +1 -0
- package/dist/timeline.d.ts +2 -0
- package/dist/timeline.js +2 -0
- package/dist/tooltip-DMxmBNky.js +104 -0
- package/dist/tooltip-DMxmBNky.js.map +1 -0
- package/dist/tooltip-kfUBWYVB.d.ts +26 -0
- package/dist/tooltip-kfUBWYVB.d.ts.map +1 -0
- package/dist/tree-component-CQpoPo4s.d.ts +326 -0
- package/dist/tree-component-CQpoPo4s.d.ts.map +1 -0
- package/dist/tree-data-model-DGvRVOFY.js +190 -0
- package/dist/tree-data-model-DGvRVOFY.js.map +1 -0
- package/dist/tree.d.ts +100 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +1144 -0
- package/dist/tree.js.map +1 -0
- package/dist/types-BKaqnpwx.d.ts +8 -0
- package/dist/types-BKaqnpwx.d.ts.map +1 -0
- package/dist/xy-axis-BANbgrI5.js +6243 -0
- package/dist/xy-axis-BANbgrI5.js.map +1 -0
- package/dist/xy-axis-CIFok7MF.d.ts +141 -0
- package/dist/xy-axis-CIFok7MF.d.ts.map +1 -0
- package/dist/xy-pad.d.ts +81 -0
- package/dist/xy-pad.d.ts.map +1 -0
- package/dist/xy-pad.js +435 -0
- package/dist/xy-pad.js.map +1 -0
- package/package.json +48 -39
- package/README.md +0 -14
- package/dist/charts/frequency-histogram-plot.d.ts +0 -33
- package/dist/charts/frequency-histogram-plot.d.ts.map +0 -1
- package/dist/charts/frequency-histogram-plot.js +0 -54
- package/dist/charts/frequency-histogram-plot.js.map +0 -1
- package/dist/charts/histogram-vis.d.ts +0 -57
- package/dist/charts/histogram-vis.d.ts.map +0 -1
- package/dist/charts/histogram-vis.js +0 -222
- package/dist/charts/histogram-vis.js.map +0 -1
- package/dist/charts/plot.d.ts +0 -199
- package/dist/charts/plot.d.ts.map +0 -1
- package/dist/charts/plot.js +0 -914
- package/dist/charts/plot.js.map +0 -1
- package/dist/crumb-nav.d.ts +0 -41
- package/dist/crumb-nav.d.ts.map +0 -1
- package/dist/crumb-nav.js +0 -198
- package/dist/crumb-nav.js.map +0 -1
- package/dist/crumb-navigation.d.ts +0 -30
- package/dist/crumb-navigation.d.ts.map +0 -1
- package/dist/crumb-navigation.js +0 -307
- package/dist/crumb-navigation.js.map +0 -1
- package/dist/dial.d.ts +0 -89
- package/dist/dial.d.ts.map +0 -1
- package/dist/dial.js +0 -506
- package/dist/dial.js.map +0 -1
- package/dist/my-element.d.ts +0 -14
- package/dist/my-element.d.ts.map +0 -1
- package/dist/my-element.js +0 -44
- package/dist/my-element.js.map +0 -1
- package/dist/split-layout/split-layout.d.ts +0 -35
- package/dist/split-layout/split-layout.d.ts.map +0 -1
- package/dist/split-layout/split-layout.js +0 -220
- package/dist/split-layout/split-layout.js.map +0 -1
- package/dist/svg-edit-label.d.ts +0 -2
- package/dist/svg-edit-label.d.ts.map +0 -1
- package/dist/svg-edit-label.js +0 -110
- package/dist/svg-edit-label.js.map +0 -1
- package/dist/tabs/tab-layout-item.d.ts +0 -10
- package/dist/tabs/tab-layout-item.d.ts.map +0 -1
- package/dist/tabs/tab-layout-item.js +0 -20
- package/dist/tabs/tab-layout-item.js.map +0 -1
- package/dist/tabs/tab-layout.d.ts +0 -10
- package/dist/tabs/tab-layout.d.ts.map +0 -1
- package/dist/tabs/tab-layout.js +0 -25
- package/dist/tabs/tab-layout.js.map +0 -1
- package/dist/tabs/tab-list-item.d.ts +0 -18
- package/dist/tabs/tab-list-item.d.ts.map +0 -1
- package/dist/tabs/tab-list-item.js +0 -63
- package/dist/tabs/tab-list-item.js.map +0 -1
- package/dist/tabs/tab-list.d.ts +0 -21
- package/dist/tabs/tab-list.d.ts.map +0 -1
- package/dist/tabs/tab-list.js +0 -148
- package/dist/tabs/tab-list.js.map +0 -1
- package/dist/tabs/tab-panel.d.ts +0 -11
- package/dist/tabs/tab-panel.d.ts.map +0 -1
- package/dist/tabs/tab-panel.js +0 -30
- package/dist/tabs/tab-panel.js.map +0 -1
- package/dist/tabs/tab-panels.d.ts +0 -30
- package/dist/tabs/tab-panels.d.ts.map +0 -1
- package/dist/tabs/tab-panels.js +0 -80
- package/dist/tabs/tab-panels.js.map +0 -1
- package/dist/util/circle-arc.d.ts +0 -34
- package/dist/util/circle-arc.d.ts.map +0 -1
- package/dist/util/circle-arc.js +0 -77
- package/dist/util/circle-arc.js.map +0 -1
- package/dist/util/compare.d.ts +0 -53
- package/dist/util/compare.d.ts.map +0 -1
- package/dist/util/compare.js +0 -91
- package/dist/util/compare.js.map +0 -1
- package/dist/util/content-editable.d.ts +0 -2
- package/dist/util/content-editable.d.ts.map +0 -1
- package/dist/util/content-editable.js +0 -13
- package/dist/util/content-editable.js.map +0 -1
- package/dist/util/drag-controller.d.ts +0 -13
- package/dist/util/drag-controller.d.ts.map +0 -1
- package/dist/util/drag-controller.js +0 -21
- package/dist/util/drag-controller.js.map +0 -1
- package/dist/util/key-value.d.ts +0 -5
- package/dist/util/key-value.d.ts.map +0 -1
- package/dist/util/key-value.js +0 -30
- package/dist/util/key-value.js.map +0 -1
- package/dist/util/primitive-types.d.ts +0 -6
- package/dist/util/primitive-types.d.ts.map +0 -1
- package/dist/util/primitive-types.js +0 -2
- package/dist/util/primitive-types.js.map +0 -1
- package/dist/util/svg-editable-text.d.ts +0 -22
- package/dist/util/svg-editable-text.d.ts.map +0 -1
- package/dist/util/svg-editable-text.js +0 -121
- package/dist/util/svg-editable-text.js.map +0 -1
- package/dist/util/time.d.ts +0 -2
- package/dist/util/time.d.ts.map +0 -1
- package/dist/util/time.js +0 -2
- package/dist/util/time.js.map +0 -1
|
@@ -0,0 +1,1239 @@
|
|
|
1
|
+
import * as _$lit from "lit";
|
|
2
|
+
import { CSSResultGroup, LitElement, PropertyValues } from "lit";
|
|
3
|
+
|
|
4
|
+
//#region src/colour-picker/types.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* OKLCH colour value representation
|
|
7
|
+
*/
|
|
8
|
+
type OklchValue = {
|
|
9
|
+
readonly l: number;
|
|
10
|
+
readonly c: number;
|
|
11
|
+
readonly h: number;
|
|
12
|
+
readonly a?: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Event detail for colour picker input/change events
|
|
16
|
+
*/
|
|
17
|
+
type ColourPickerEventDetail = OklchValue;
|
|
18
|
+
/**
|
|
19
|
+
* Colour picker custom events
|
|
20
|
+
*/
|
|
21
|
+
type ColourPickerInputEvent = CustomEvent<ColourPickerEventDetail>;
|
|
22
|
+
type ColourPickerChangeEvent = CustomEvent<ColourPickerEventDetail>;
|
|
23
|
+
type Range = readonly [number, number];
|
|
24
|
+
type RangeInput = readonly [number, number] | readonly number[];
|
|
25
|
+
/**
|
|
26
|
+
* Augment HTMLElementTagNameMap for the custom element
|
|
27
|
+
*/
|
|
28
|
+
declare global {
|
|
29
|
+
interface HTMLElementTagNameMap {
|
|
30
|
+
'ixfx-colour-picker': ColourPicker;
|
|
31
|
+
}
|
|
32
|
+
} //# sourceMappingURL=types.d.ts.map
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region node_modules/.pnpm/@ixfx+random@0.56.12/node_modules/@ixfx/random/dist/index.d.ts
|
|
35
|
+
//#region src/types.d.ts
|
|
36
|
+
/**
|
|
37
|
+
* A random source.
|
|
38
|
+
*
|
|
39
|
+
* Predefined sources: Math.random, {@link gaussianSource}, {@link weightedSource}
|
|
40
|
+
*/
|
|
41
|
+
type RandomSource = () => number;
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region node_modules/.pnpm/@ixfx+geometry@0.56.12/node_modules/@ixfx/geometry/dist/index.d.ts
|
|
44
|
+
type Angle = {
|
|
45
|
+
value: number;
|
|
46
|
+
unit: `deg` | `rad` | `turn` | `grad`;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Parses CSS-style angle strings into an 'Angle' type. By default assumes degrees.
|
|
50
|
+
*
|
|
51
|
+
* ```js
|
|
52
|
+
* angleParse(`100`); // { value: 100, unit: `deg` }
|
|
53
|
+
* angleParse(100); // { value: 100, unit: `deg` }
|
|
54
|
+
* angleParse(`100deg`); // { value: 100, unit: `deg` }
|
|
55
|
+
*
|
|
56
|
+
* // More exotic units:
|
|
57
|
+
* angleParse(`100rad`); // { value: 100, unit: `rad` }
|
|
58
|
+
* angleParse(`100turn`); // { value: 100, unit: `turn` }
|
|
59
|
+
* angleParse(`100grad`); // { value: 100, unit: `grad` }
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* Once parsed in this format, use {@link angleConvert} to convert to
|
|
63
|
+
* a different unit.
|
|
64
|
+
* @param value
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region node_modules/.pnpm/@ixfx+visual@0.56.12/node_modules/@ixfx/visual/dist/index-a3KMyMEu.d.ts
|
|
69
|
+
//#region src/colour/types.d.ts
|
|
70
|
+
type HslBase = {
|
|
71
|
+
/**
|
|
72
|
+
* Hue
|
|
73
|
+
*/
|
|
74
|
+
h: number;
|
|
75
|
+
/**
|
|
76
|
+
* Saturation
|
|
77
|
+
*/
|
|
78
|
+
s: number;
|
|
79
|
+
/**
|
|
80
|
+
* Lightness
|
|
81
|
+
*/
|
|
82
|
+
l: number;
|
|
83
|
+
/**
|
|
84
|
+
* Opacity
|
|
85
|
+
*/
|
|
86
|
+
opacity?: number;
|
|
87
|
+
space?: `hsl`;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* [YCbCr format](https://en.wikipedia.org/wiki/YCbCr)
|
|
91
|
+
*/
|
|
92
|
+
type YCbCrBase = {
|
|
93
|
+
/**
|
|
94
|
+
* Luma
|
|
95
|
+
*/
|
|
96
|
+
y: number;
|
|
97
|
+
/**
|
|
98
|
+
* Blue difference
|
|
99
|
+
*/
|
|
100
|
+
cb: number;
|
|
101
|
+
/**
|
|
102
|
+
* Red difference
|
|
103
|
+
*/
|
|
104
|
+
cr: number;
|
|
105
|
+
/**
|
|
106
|
+
* Opacity
|
|
107
|
+
*/
|
|
108
|
+
opacity?: number;
|
|
109
|
+
space?: `ycbcr`;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* Scalar values use 0..1 for each field
|
|
113
|
+
*/
|
|
114
|
+
type YCbCrScalar = YCbCrBase & {
|
|
115
|
+
unit: `scalar`;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* Absolute colour use 0..255 for each field
|
|
119
|
+
*/
|
|
120
|
+
type YCbCr8bit = YCbCrBase & {
|
|
121
|
+
unit: `8bit`;
|
|
122
|
+
};
|
|
123
|
+
/**
|
|
124
|
+
* [YCbCr format](https://en.wikipedia.org/wiki/YCbCr).
|
|
125
|
+
*
|
|
126
|
+
* By default assumes scalar coordinates (0..1) for each field.
|
|
127
|
+
* Use '8bit' unit for 0..255 ranged values.
|
|
128
|
+
*/
|
|
129
|
+
type YCbCr = YCbCrScalar | YCbCr8bit;
|
|
130
|
+
type ColourSpaces = `srgb` | `hsl` | `oklch` | `ycbcr`;
|
|
131
|
+
/**
|
|
132
|
+
* Scalar values use 0..1 for each field
|
|
133
|
+
*/
|
|
134
|
+
type HslScalar = HslBase & {
|
|
135
|
+
unit: `scalar`;
|
|
136
|
+
};
|
|
137
|
+
/**
|
|
138
|
+
* Absolute values use hue:0..360, all other fields 0..100
|
|
139
|
+
*/
|
|
140
|
+
type HslAbsolute = HslBase & {
|
|
141
|
+
unit: `absolute`;
|
|
142
|
+
};
|
|
143
|
+
/**
|
|
144
|
+
* HSL value.
|
|
145
|
+
* By default assumes scalar coordinates (0..1) for each field.
|
|
146
|
+
* Use 'absolute' unit for hue:0...360, all other fields on 0..100 scale.
|
|
147
|
+
*/
|
|
148
|
+
type Hsl = HslScalar | HslAbsolute;
|
|
149
|
+
/**
|
|
150
|
+
* Rgb.
|
|
151
|
+
* Units determine how to interperet rgb values.
|
|
152
|
+
* 'scalar': 0..1 range for RGB & opacity
|
|
153
|
+
* '8bit': 0..255 range for RGB & opacity
|
|
154
|
+
*/
|
|
155
|
+
type RgbBase = {
|
|
156
|
+
r: number;
|
|
157
|
+
g: number;
|
|
158
|
+
b: number;
|
|
159
|
+
opacity?: number;
|
|
160
|
+
space?: `srgb`;
|
|
161
|
+
};
|
|
162
|
+
type RgbScalar = RgbBase & {
|
|
163
|
+
unit: `scalar`;
|
|
164
|
+
};
|
|
165
|
+
/**
|
|
166
|
+
* RGB in 0...255 range, including opacity.
|
|
167
|
+
*/
|
|
168
|
+
type Rgb8Bit = RgbBase & {
|
|
169
|
+
unit: `8bit`;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Rgb.
|
|
173
|
+
* Units determine how to interperet rgb values.
|
|
174
|
+
* 'scalar': 0..1 range for RGB & opacity
|
|
175
|
+
* '8bit': 0..255 range for RGB & opacity
|
|
176
|
+
*/
|
|
177
|
+
type Rgb = RgbScalar | Rgb8Bit;
|
|
178
|
+
type LchBase = {
|
|
179
|
+
/**
|
|
180
|
+
* Lightness/perceived brightnes
|
|
181
|
+
*/
|
|
182
|
+
l: number;
|
|
183
|
+
/**
|
|
184
|
+
* Chroma ('amount of colour')
|
|
185
|
+
*/
|
|
186
|
+
c: number;
|
|
187
|
+
/**
|
|
188
|
+
* Hue
|
|
189
|
+
*/
|
|
190
|
+
h: number;
|
|
191
|
+
/**
|
|
192
|
+
* Opacity on 0..1 scale
|
|
193
|
+
*/
|
|
194
|
+
opacity?: number;
|
|
195
|
+
space: `lch` | `oklch`;
|
|
196
|
+
};
|
|
197
|
+
type ColourInterpolator<T extends Colour> = (amount: number) => T;
|
|
198
|
+
type OkLchBase = LchBase & {
|
|
199
|
+
space: `oklch`;
|
|
200
|
+
};
|
|
201
|
+
/**
|
|
202
|
+
* Oklch colour expressed in 0..1 scalar values for LCH & opacity
|
|
203
|
+
*/
|
|
204
|
+
type OkLchScalar = OkLchBase & {
|
|
205
|
+
unit: `scalar`;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* Oklch colour expressed with:
|
|
209
|
+
* l: 0..1
|
|
210
|
+
* c: 0..4
|
|
211
|
+
* h: 0..360 degrees
|
|
212
|
+
* opacity: 0..1
|
|
213
|
+
*/
|
|
214
|
+
type OkLchAbsolute = OkLchBase & {
|
|
215
|
+
unit: `absolute`;
|
|
216
|
+
};
|
|
217
|
+
type OkLch = OkLchAbsolute | OkLchScalar;
|
|
218
|
+
type Colour = {
|
|
219
|
+
opacity?: number;
|
|
220
|
+
} & (Hsl | OkLch | Rgb | YCbCr);
|
|
221
|
+
/**
|
|
222
|
+
* A representation of colour. Eg: `blue`, `rgb(255,0,0)`, `hsl(20,100%,50%)`
|
|
223
|
+
*/
|
|
224
|
+
type Colourish = Colour | string;
|
|
225
|
+
/**
|
|
226
|
+
* Options for interpolation
|
|
227
|
+
*/
|
|
228
|
+
type ColourInterpolationOpts = {
|
|
229
|
+
direction: `longer` | `shorter`;
|
|
230
|
+
/**
|
|
231
|
+
* Space to do calculations in
|
|
232
|
+
*/
|
|
233
|
+
space: ColourSpaces;
|
|
234
|
+
/**
|
|
235
|
+
* Destination of calculated colour
|
|
236
|
+
*/
|
|
237
|
+
destination: ConvertDestinations;
|
|
238
|
+
};
|
|
239
|
+
type ColourStepOpts = ColourInterpolationOpts & {
|
|
240
|
+
/**
|
|
241
|
+
* If set, determines total number of steps, including colour stops.
|
|
242
|
+
* Use this _or_ `stepsBetween`.
|
|
243
|
+
*/
|
|
244
|
+
stepsTotal?: number;
|
|
245
|
+
/**
|
|
246
|
+
* If set, determines number of steps between colour stops.
|
|
247
|
+
* Use this _or_ `stepsTotal`.
|
|
248
|
+
*/
|
|
249
|
+
stepsBetween?: number;
|
|
250
|
+
};
|
|
251
|
+
type ParsingOptions<T> = Partial<{
|
|
252
|
+
scalar: boolean;
|
|
253
|
+
ensureSafe: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Value to use if input is invalid
|
|
256
|
+
*/
|
|
257
|
+
fallbackString: string;
|
|
258
|
+
/**
|
|
259
|
+
* Fallback colour to use if value cannot be parsed
|
|
260
|
+
*/
|
|
261
|
+
fallbackColour: T;
|
|
262
|
+
}>;
|
|
263
|
+
type ConvertDestinations = `hsl-scalar` | `hsl-absolute` | `oklch-scalar` | `oklch-absolute` | `srgb-8bit` | `srgb-scalar` | `ycbcr-scalar` | `ycbcr-8bit`; //#endregion
|
|
264
|
+
//#region ../../node_modules/.pnpm/colorizr@4.0.1/node_modules/colorizr/dist/index.d.mts
|
|
265
|
+
type ColorType = 'hex' | 'hsl' | 'oklab' | 'oklch' | 'rgb';
|
|
266
|
+
type HEX = `#${string}`;
|
|
267
|
+
interface Analysis {
|
|
268
|
+
brightnessDifference: number;
|
|
269
|
+
colorDifference: number;
|
|
270
|
+
compliant: number;
|
|
271
|
+
contrast: number;
|
|
272
|
+
largeAA: boolean;
|
|
273
|
+
largeAAA: boolean;
|
|
274
|
+
normalAA: boolean;
|
|
275
|
+
normalAAA: boolean;
|
|
276
|
+
}
|
|
277
|
+
interface HSL {
|
|
278
|
+
/** The alpha/opacity value (0-1). */
|
|
279
|
+
alpha?: number;
|
|
280
|
+
h: number;
|
|
281
|
+
l: number;
|
|
282
|
+
s: number;
|
|
283
|
+
}
|
|
284
|
+
interface LAB {
|
|
285
|
+
a: number;
|
|
286
|
+
/** The alpha/opacity value (0-1). */
|
|
287
|
+
alpha?: number;
|
|
288
|
+
b: number;
|
|
289
|
+
l: number;
|
|
290
|
+
}
|
|
291
|
+
interface LCH {
|
|
292
|
+
/** The alpha/opacity value (0-1). */
|
|
293
|
+
alpha?: number;
|
|
294
|
+
c: number;
|
|
295
|
+
h: number;
|
|
296
|
+
l: number;
|
|
297
|
+
}
|
|
298
|
+
interface RGB {
|
|
299
|
+
/** The alpha/opacity value (0-1). */
|
|
300
|
+
alpha?: number;
|
|
301
|
+
b: number;
|
|
302
|
+
g: number;
|
|
303
|
+
r: number;
|
|
304
|
+
}
|
|
305
|
+
interface ColorizrOptions {
|
|
306
|
+
/**
|
|
307
|
+
* Output color format.
|
|
308
|
+
*
|
|
309
|
+
* If not specified, the output will use the same format as the input color.
|
|
310
|
+
*/
|
|
311
|
+
format?: ColorType;
|
|
312
|
+
}
|
|
313
|
+
declare class Colorizr {
|
|
314
|
+
/** The alpha/opacity value (0-1). */
|
|
315
|
+
alpha: number;
|
|
316
|
+
hex: HEX;
|
|
317
|
+
hsl: HSL;
|
|
318
|
+
oklab: LAB;
|
|
319
|
+
oklch: LCH;
|
|
320
|
+
rgb: RGB;
|
|
321
|
+
type: ColorType;
|
|
322
|
+
constructor(color: string | HSL | LAB | LCH | RGB, options?: ColorizrOptions);
|
|
323
|
+
/**
|
|
324
|
+
* Get CSS string
|
|
325
|
+
*/
|
|
326
|
+
get css(): string;
|
|
327
|
+
/**
|
|
328
|
+
* Get the red value
|
|
329
|
+
*/
|
|
330
|
+
get red(): number;
|
|
331
|
+
/**
|
|
332
|
+
* Get the green value
|
|
333
|
+
*/
|
|
334
|
+
get green(): number;
|
|
335
|
+
/**
|
|
336
|
+
* Get the blue value
|
|
337
|
+
*/
|
|
338
|
+
get blue(): number;
|
|
339
|
+
/**
|
|
340
|
+
* Get the hue value
|
|
341
|
+
*/
|
|
342
|
+
get hue(): number;
|
|
343
|
+
/**
|
|
344
|
+
* Get the saturation value
|
|
345
|
+
*/
|
|
346
|
+
get saturation(): number;
|
|
347
|
+
/**
|
|
348
|
+
* Get the lightness value
|
|
349
|
+
*/
|
|
350
|
+
get lightness(): number;
|
|
351
|
+
/**
|
|
352
|
+
* Get the luminance value
|
|
353
|
+
*/
|
|
354
|
+
get luminance(): number;
|
|
355
|
+
/**
|
|
356
|
+
* Get the chroma value
|
|
357
|
+
*/
|
|
358
|
+
get chroma(): number;
|
|
359
|
+
get opacity(): number;
|
|
360
|
+
/**
|
|
361
|
+
* Get the most readable color (light or dark) for this color as a background.
|
|
362
|
+
*/
|
|
363
|
+
get readableColor(): string;
|
|
364
|
+
private get currentColor();
|
|
365
|
+
/**
|
|
366
|
+
* Get the brightness difference between this color and another.
|
|
367
|
+
*
|
|
368
|
+
* @param input - The color to compare against.
|
|
369
|
+
* @returns The brightness difference value.
|
|
370
|
+
*/
|
|
371
|
+
brightnessDifference(input: string): number;
|
|
372
|
+
/**
|
|
373
|
+
* Get the color difference between this color and another.
|
|
374
|
+
*
|
|
375
|
+
* @param input - The color to compare against.
|
|
376
|
+
* @returns The color difference value.
|
|
377
|
+
*/
|
|
378
|
+
colorDifference(input: string): number;
|
|
379
|
+
/**
|
|
380
|
+
* Test 2 colors for WCAG compliance.
|
|
381
|
+
*
|
|
382
|
+
* @param input - The color to compare against.
|
|
383
|
+
* @returns Analysis object with compliance information.
|
|
384
|
+
*/
|
|
385
|
+
compare(input: string): Analysis;
|
|
386
|
+
/**
|
|
387
|
+
* Get the contrast ratio between this color and another.
|
|
388
|
+
*
|
|
389
|
+
* @param input - The color to compare against.
|
|
390
|
+
* @returns The contrast ratio.
|
|
391
|
+
*/
|
|
392
|
+
contrast(input: string): number;
|
|
393
|
+
/**
|
|
394
|
+
* Format the color to a specific type.
|
|
395
|
+
*
|
|
396
|
+
* @param type - The color format to convert to.
|
|
397
|
+
* @param precision - The decimal precision for the output.
|
|
398
|
+
* @returns The formatted color string.
|
|
399
|
+
*/
|
|
400
|
+
format(type: ColorType, precision?: number): string;
|
|
401
|
+
/**
|
|
402
|
+
* Increase lightness.
|
|
403
|
+
*
|
|
404
|
+
* @param amount - A number between 0 and 100.
|
|
405
|
+
* @returns The lightened color string.
|
|
406
|
+
*/
|
|
407
|
+
lighten(amount: number): string;
|
|
408
|
+
/**
|
|
409
|
+
* Decrease lightness.
|
|
410
|
+
*
|
|
411
|
+
* @param amount - A number between 0 and 100.
|
|
412
|
+
* @returns The darkened color string.
|
|
413
|
+
*/
|
|
414
|
+
darken(amount: number): string;
|
|
415
|
+
/**
|
|
416
|
+
* Increase saturation.
|
|
417
|
+
*
|
|
418
|
+
* @param amount - A number between 0 and 100.
|
|
419
|
+
* @returns The saturated color string.
|
|
420
|
+
*/
|
|
421
|
+
saturate(amount: number): string;
|
|
422
|
+
/**
|
|
423
|
+
* Decrease saturation.
|
|
424
|
+
*
|
|
425
|
+
* @param amount - A number between 0 and 100.
|
|
426
|
+
* @returns The desaturated color string.
|
|
427
|
+
*/
|
|
428
|
+
desaturate(amount: number): string;
|
|
429
|
+
/**
|
|
430
|
+
* Convert to grayscale.
|
|
431
|
+
*
|
|
432
|
+
* @returns The grayscale color string.
|
|
433
|
+
*/
|
|
434
|
+
grayscale(): string;
|
|
435
|
+
/**
|
|
436
|
+
* Invert color.
|
|
437
|
+
*
|
|
438
|
+
* @returns The inverted color string.
|
|
439
|
+
*/
|
|
440
|
+
invert(): string;
|
|
441
|
+
/**
|
|
442
|
+
* Mix with another color.
|
|
443
|
+
*
|
|
444
|
+
* @param color - The color to mix with.
|
|
445
|
+
* @param ratio - A number between 0 and 1 (0 = this color, 1 = input color).
|
|
446
|
+
* @returns The mixed color string.
|
|
447
|
+
*/
|
|
448
|
+
mix(color: string, ratio?: number): string;
|
|
449
|
+
/**
|
|
450
|
+
* Add opacity to the color.
|
|
451
|
+
*
|
|
452
|
+
* @param alpha - A number between 0 and 1.
|
|
453
|
+
* @returns The opacified color string.
|
|
454
|
+
*/
|
|
455
|
+
opacify(alpha?: number): string;
|
|
456
|
+
/**
|
|
457
|
+
* Rotate color hue.
|
|
458
|
+
*
|
|
459
|
+
* @param degrees - A number between -360 and 360.
|
|
460
|
+
* @returns The rotated color string.
|
|
461
|
+
*/
|
|
462
|
+
rotate(degrees: number): string;
|
|
463
|
+
/**
|
|
464
|
+
* Make the color more transparent.
|
|
465
|
+
*
|
|
466
|
+
* @param alpha - A number between -1 and 1.
|
|
467
|
+
* @returns The transparentized color string.
|
|
468
|
+
*/
|
|
469
|
+
transparentize(alpha?: number): string;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Check 2 colors for WCAG compliance.
|
|
473
|
+
*
|
|
474
|
+
* @param left - The first color string.
|
|
475
|
+
* @param right - The second color string.
|
|
476
|
+
* @returns Analysis object with WCAG compliance information.
|
|
477
|
+
*/
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/colour/conversion.d.ts
|
|
480
|
+
declare function convert<T extends ConvertDestinations>(colour: Colourish, destination: T): T extends `oklch-absolute` ? OkLchAbsolute : T extends `oklch-scalar` ? OkLchScalar : T extends `srgb-8bit` ? Rgb8Bit : T extends `srgb-scalar` ? RgbScalar : T extends `hsl-scalar` ? HslScalar : T extends `hsl-absolute` ? HslAbsolute : never;
|
|
481
|
+
/**
|
|
482
|
+
* Like {@link convert}, but result is a CSS colour string
|
|
483
|
+
* @param colour
|
|
484
|
+
* @param destination
|
|
485
|
+
*/
|
|
486
|
+
declare function convertToString(colour: Colourish, destination: ConvertDestinations): string;
|
|
487
|
+
/**
|
|
488
|
+
* Converts some kind of colour into a scalar representation. Supports oklch, hsl and srgb.
|
|
489
|
+
* @param colour Colour to convert
|
|
490
|
+
* @param destination Destination colour format
|
|
491
|
+
*/
|
|
492
|
+
declare function convertScalar<T extends ColourSpaces>(colour: Colourish, destination: T): T extends `oklch` ? OkLchScalar : T extends `hsl` ? HslScalar : T extends `srgb` ? RgbScalar : never;
|
|
493
|
+
declare function toCssColour(colour: Colourish | object): string;
|
|
494
|
+
declare function toHexColour(colour: Colourish | object): string;
|
|
495
|
+
declare function toLibraryColour(colour: Colourish): Colorizr;
|
|
496
|
+
declare function guard$4(colour: Colour): void;
|
|
497
|
+
declare function toColour(colourish: any): Colour;
|
|
498
|
+
/**
|
|
499
|
+
* Returns a CSS-ready string
|
|
500
|
+
* representation.
|
|
501
|
+
* ```js
|
|
502
|
+
* element.style.backgroundColor = resolveToString(`red`);
|
|
503
|
+
* ```
|
|
504
|
+
*
|
|
505
|
+
* Tries each parameter in turn, returning the value
|
|
506
|
+
* for the first that resolves. This can be useful for
|
|
507
|
+
* having fallback values.
|
|
508
|
+
*
|
|
509
|
+
* ```js
|
|
510
|
+
* // Try a CSS variable, a object property or finally fallback to red.
|
|
511
|
+
* element.style.backgroundColor = toStringFirst('--some-var', opts.background, `red`);
|
|
512
|
+
* ```
|
|
513
|
+
* @param colours Array of colours to resolve
|
|
514
|
+
*/
|
|
515
|
+
declare function toStringFirst(...colours: Array<Colourish | undefined>): string;
|
|
516
|
+
declare function rgbToHsl(rgb: Rgb, scalarResult: true): HslScalar;
|
|
517
|
+
declare function rgbToHsl(rgb: Rgb, scalarResult: false): HslAbsolute; //#endregion
|
|
518
|
+
//#region src/colour/css-colours.d.ts
|
|
519
|
+
/**
|
|
520
|
+
* Converts from some kind of colour that is legal in CSS
|
|
521
|
+
* into a structured Colour type.
|
|
522
|
+
*
|
|
523
|
+
* Handles: hex format, CSS variables, colour names
|
|
524
|
+
* ```js
|
|
525
|
+
* fromCssColour(`#ffffff`);
|
|
526
|
+
* fromCssColour(`blue`);
|
|
527
|
+
* fromCssColour(`--some-variable`);
|
|
528
|
+
* fromCssColour(`hsl(50, 50%, 50%)`);
|
|
529
|
+
* fromCssColour(`rgb(50, 100, 100)`);
|
|
530
|
+
* ```
|
|
531
|
+
* @param colour
|
|
532
|
+
* @returns
|
|
533
|
+
*/
|
|
534
|
+
declare const fromCssColour: (colour: string) => Colour;
|
|
535
|
+
/**
|
|
536
|
+
* Resolves a named colour to a colour string.
|
|
537
|
+
*
|
|
538
|
+
* ```js
|
|
539
|
+
* resolveCss(`red`);
|
|
540
|
+
* ```
|
|
541
|
+
* @param colour CSS named colour
|
|
542
|
+
* @returns
|
|
543
|
+
*/
|
|
544
|
+
declare function resolveCss(colour: CssColourNames): string;
|
|
545
|
+
type CssColourNames = keyof typeof cssDefinedHexColours;
|
|
546
|
+
declare const cssDefinedHexColours: Record<string, string>; //#endregion
|
|
547
|
+
//#region src/colour/generate.d.ts
|
|
548
|
+
/**
|
|
549
|
+
* Returns a full HSL colour string (eg `hsl(20,50%,75%)`) based on a index.
|
|
550
|
+
* It's useful for generating perceptually different shades as the index increments.
|
|
551
|
+
*
|
|
552
|
+
* ```
|
|
553
|
+
* el.style.backgroundColor = goldenAgeColour(10);
|
|
554
|
+
* ```
|
|
555
|
+
*
|
|
556
|
+
* Saturation and lightness can be specified, as numeric ranges of 0-1.
|
|
557
|
+
*
|
|
558
|
+
* @param saturation Saturation (0-1), defaults to 0.5
|
|
559
|
+
* @param lightness Lightness (0-1), defaults to 0.75
|
|
560
|
+
* @param alpha Opacity (0-1), defaults to 1.0
|
|
561
|
+
* @returns HSL colour string eg `hsl(20,50%,75%)`
|
|
562
|
+
*/
|
|
563
|
+
declare const goldenAngleColour: (index: number, saturation?: number, lightness?: number, alpha?: number) => string;
|
|
564
|
+
/**
|
|
565
|
+
* Returns a random hue component (0..359)
|
|
566
|
+
*
|
|
567
|
+
* ```
|
|
568
|
+
* // Generate hue
|
|
569
|
+
* const h = randomHue(); // 0-359
|
|
570
|
+
*
|
|
571
|
+
* // Generate hue and assign as part of a HSL string
|
|
572
|
+
* el.style.backgroundColor = `hsl(${randomHue(), 50%, 75%})`;
|
|
573
|
+
* ```
|
|
574
|
+
* @param rand
|
|
575
|
+
* @returns
|
|
576
|
+
*/
|
|
577
|
+
declare const randomHue: (rand?: RandomSource) => number; //#endregion
|
|
578
|
+
//#region src/colour/guards.d.ts
|
|
579
|
+
declare function isHsl(v: any): v is Hsl;
|
|
580
|
+
declare function isRgb(v: any): v is Rgb;
|
|
581
|
+
/**
|
|
582
|
+
* If the input object has r,g&b properties, it will return a fully-
|
|
583
|
+
* formed Rgb type with `unit` and `space` properties.
|
|
584
|
+
*
|
|
585
|
+
* If it lacks these basic three properties or they are out of range,
|
|
586
|
+
* _undefined_ is returned.
|
|
587
|
+
*
|
|
588
|
+
* If RGB values are less than 1 assumes unit:scalar. Otherwise unit:8bit.
|
|
589
|
+
* If RGB values exceed 255, _undefined_ returned.
|
|
590
|
+
* @param v
|
|
591
|
+
* @returns
|
|
592
|
+
*/
|
|
593
|
+
declare function tryParseObjectToRgb(v: any): Rgb | undefined;
|
|
594
|
+
declare function tryParseObjectToHsl(v: any): Hsl | undefined;
|
|
595
|
+
declare function isOkLch(v: any): v is OkLch;
|
|
596
|
+
declare function isColourish(v: any): v is Colourish;
|
|
597
|
+
declare namespace hsl_d_exports {
|
|
598
|
+
export { absolute$1 as absolute, changeLightness$1 as changeLightness, fromCss$3 as fromCss, fromHexString$3 as fromHexString, generateScalar$1 as generateScalar, guard$3 as guard, interpolator$3 as interpolator, parseCssHslFunction, scalar$3 as scalar, toAbsolute$1 as toAbsolute, toCssString$2 as toCssString, toHexString$3 as toHexString, toLibraryRgb, toScalar$3 as toScalar, withOpacity$3 as withOpacity };
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Scales the opacity value of an input HSL value
|
|
602
|
+
* ```js
|
|
603
|
+
* withOpacity()
|
|
604
|
+
* ```
|
|
605
|
+
* @param value Colour
|
|
606
|
+
* @param fn Function that calcules opacity based on input scalar value
|
|
607
|
+
*/
|
|
608
|
+
declare function withOpacity$3<T extends Hsl>(value: T, fn: (opacityScalar: number, value: T) => number): T;
|
|
609
|
+
/**
|
|
610
|
+
* Increases or decreases lightness by this percentage, returning new colour
|
|
611
|
+
*
|
|
612
|
+
* Amount to change:
|
|
613
|
+
* 'fixed': a fixed amount
|
|
614
|
+
* 'delta': increase/decrease by this amount
|
|
615
|
+
* 'pdelta': proportion of current value to change by ('percentage delta')
|
|
616
|
+
*
|
|
617
|
+
* ```
|
|
618
|
+
* const colour = { h: 0.5, s: 0.5, l: 0.5, space: `hsl`, unit: `scalar` };
|
|
619
|
+
* changeLightness(colour, { pdelta: 0.1 }); // l: 0.55
|
|
620
|
+
* changeLightness(colour, { delta: 0.1 }); // l: 0.6
|
|
621
|
+
* changeLightness(colour, { fixed: 0.5 }); // l: 0.5
|
|
622
|
+
* ```
|
|
623
|
+
*
|
|
624
|
+
* Keep in mind the numerical value will depend on the unit of `value`. If it's scalar,
|
|
625
|
+
* lightness is 0..1 scale, otherwise 0..100 scale.
|
|
626
|
+
*
|
|
627
|
+
* Use negative values to decrease (does not apply to 'fixed')
|
|
628
|
+
* @param value Hsl colour
|
|
629
|
+
* @param amount Amount to change
|
|
630
|
+
*/
|
|
631
|
+
declare function changeLightness$1(value: Hsl, amount: Partial<{
|
|
632
|
+
pdelta: number;
|
|
633
|
+
delta: number;
|
|
634
|
+
fixed: number;
|
|
635
|
+
}>): Hsl;
|
|
636
|
+
declare function fromHexString$3<T extends ParsingOptions<Hsl>>(hexString: string, scalar: T): T extends {
|
|
637
|
+
scalar: true;
|
|
638
|
+
} ? HslScalar : HslAbsolute;
|
|
639
|
+
declare function fromCss$3<T extends ParsingOptions<Hsl>>(value: string, options?: T): T extends {
|
|
640
|
+
scalar: true;
|
|
641
|
+
} ? HslScalar : HslAbsolute;
|
|
642
|
+
declare function toCssString$2(hsl: Hsl): string;
|
|
643
|
+
declare function toHexString$3(hsl: Hsl): string;
|
|
644
|
+
declare function toAbsolute$1(hslOrString: Hsl | Rgb | string): HslAbsolute;
|
|
645
|
+
/**
|
|
646
|
+
* Generates a {@link HslScalar} value.
|
|
647
|
+
*
|
|
648
|
+
* ```js
|
|
649
|
+
* generateScaler(10); // 10deg, default to full saturation, half lightness and full opacity
|
|
650
|
+
*
|
|
651
|
+
* // Generate HSL value from radian angle and 50% saturation
|
|
652
|
+
* generateScalar(`10rad`, 0.5);
|
|
653
|
+
*
|
|
654
|
+
* // Generate from numeric CSS variable
|
|
655
|
+
* generateScalar(`--hue`);
|
|
656
|
+
* ```
|
|
657
|
+
* @param absoluteHslOrVariable Hue angle or CSS variable
|
|
658
|
+
* @param saturation
|
|
659
|
+
* @param lightness
|
|
660
|
+
* @param opacity
|
|
661
|
+
*/
|
|
662
|
+
declare function generateScalar$1(absoluteHslOrVariable: string | number | Angle, saturation?: number, lightness?: number, opacity?: number): HslScalar;
|
|
663
|
+
/**
|
|
664
|
+
* Converts a {@link Hsl} value to scalar units, or parses a colour string
|
|
665
|
+
* and converts it.
|
|
666
|
+
*
|
|
667
|
+
* ```js
|
|
668
|
+
* toScalar({ h: 100, s: 50, l: 100, unit: `absolute` });
|
|
669
|
+
* toScalar(`red`);
|
|
670
|
+
* ```
|
|
671
|
+
* @param colour
|
|
672
|
+
*/
|
|
673
|
+
declare function toScalar$3(colour: Rgb | Hsl | string): HslScalar;
|
|
674
|
+
declare function guard$3(hsl: Hsl): void;
|
|
675
|
+
declare function interpolator$3(a: Hsl | string, b: Hsl | string, direction?: `longer` | `shorter`): (amount: number) => HslScalar;
|
|
676
|
+
/**
|
|
677
|
+
* Creates a HslScalar value from scalar (0..1) values
|
|
678
|
+
* @param hue
|
|
679
|
+
* @param sat
|
|
680
|
+
* @param lightness
|
|
681
|
+
* @param opacity
|
|
682
|
+
*/
|
|
683
|
+
declare function scalar$3(hue?: number, sat?: number, lightness?: number, opacity?: number): HslScalar;
|
|
684
|
+
declare function absolute$1(hue?: number, sat?: number, lightness?: number, opacity?: number): HslAbsolute;
|
|
685
|
+
/**
|
|
686
|
+
* It seems Colorizr can't handle 'deg' units
|
|
687
|
+
* @param value
|
|
688
|
+
*/
|
|
689
|
+
declare function parseCssHslFunction(value: string): Hsl;
|
|
690
|
+
/**
|
|
691
|
+
* Converts a Hsl structure (or CSS string) to Colorizr's RGB format
|
|
692
|
+
* @param hsl HSL colour
|
|
693
|
+
*/
|
|
694
|
+
declare function toLibraryRgb(hsl: Hsl | string): RGB; //#endregion
|
|
695
|
+
//#region src/colour/interpolate.d.ts
|
|
696
|
+
/**
|
|
697
|
+
* Returns a function to interpolate between colours, with results as a structured {@link Colour} object.
|
|
698
|
+
* ```js
|
|
699
|
+
* const i = interpolator([`orange`, `yellow`, `red`]);
|
|
700
|
+
*
|
|
701
|
+
* // Get a random colour on the above spectrum
|
|
702
|
+
* i(Math.random());
|
|
703
|
+
* ```
|
|
704
|
+
*
|
|
705
|
+
* Results will vary depending on the colour space used, play with the options.
|
|
706
|
+
* When using a hue-based colour space, the `hue` option sets the logic for how hue values wrap.
|
|
707
|
+
*
|
|
708
|
+
* ```js
|
|
709
|
+
* interpolator([`orange`, `yellow`, `red`], { space: `hsl`, hue: `longer })
|
|
710
|
+
* ```
|
|
711
|
+
*
|
|
712
|
+
* Example: Draw the interpolation as a spectrum on a canvas, where each pixel is one step
|
|
713
|
+
* ```js
|
|
714
|
+
* let v = 0;
|
|
715
|
+
* let incrementBy = 0.01;
|
|
716
|
+
* while (v <= 1) {
|
|
717
|
+
* // Get colour at this interpolation point 0..1
|
|
718
|
+
* const colour = fn(v);
|
|
719
|
+
* // Convert to a CSS string
|
|
720
|
+
* ctx.fillStyle = Colour.toCssColour(colour);
|
|
721
|
+
* // Draw a 1px wide rect, and shuffle along to the next x position
|
|
722
|
+
* ctx.fillRect(x, y, 1, h);
|
|
723
|
+
* x += 1;
|
|
724
|
+
* v += incrementBy;
|
|
725
|
+
* }
|
|
726
|
+
* ```
|
|
727
|
+
* @param colours Colours to interpolate between
|
|
728
|
+
* @param opts Options for interpolation
|
|
729
|
+
* @returns Function that interpolates based on an amount, returning a structured Colour
|
|
730
|
+
*/
|
|
731
|
+
declare function interpolator$2(colours: Colourish[], opts?: Partial<ColourInterpolationOpts>): (amt: number) => Colour;
|
|
732
|
+
/**
|
|
733
|
+
* Returns a CSS `linear-gradient` with stops corresponding to the given list of `colours`.
|
|
734
|
+
* ```js
|
|
735
|
+
* element.style.background = Colour.cssLinearGradient(['red','green','blue']);
|
|
736
|
+
* ```
|
|
737
|
+
* @param colours
|
|
738
|
+
* @returns A 'linear-gradient' string for use in CSS, eg for background.
|
|
739
|
+
*/
|
|
740
|
+
declare function cssLinearGradient(colours: Colourish[]): string;
|
|
741
|
+
/**
|
|
742
|
+
* Returns a function that interpolates between two colours. Returns string colour values.
|
|
743
|
+
* If you want the result as a structured colour, use {@link interpolatorDual} instead.
|
|
744
|
+
*
|
|
745
|
+
* By default takes a shorter direction and uses the OkLCH colourspace.
|
|
746
|
+
* ```js
|
|
747
|
+
* const i = interpolator(`blue`, `red`);
|
|
748
|
+
* i(0.5); // Get the colour at 50%, as a string.
|
|
749
|
+
* ```
|
|
750
|
+
*
|
|
751
|
+
* To work with structured colour values, use one of the space's `interpolate` functions.
|
|
752
|
+
*
|
|
753
|
+
* If you want to create discrete steps, consider {@link createSteps} or {@link scale}.
|
|
754
|
+
*
|
|
755
|
+
* @param colourA First colour
|
|
756
|
+
* @param colourB Second colour
|
|
757
|
+
* @param options Interpolation options. By default uses shorter direction and OkLCH colour space.
|
|
758
|
+
*/
|
|
759
|
+
declare function interpolatorDualToString(colourA: Colourish, colourB: Colourish, options?: Partial<ColourInterpolationOpts>): ((amount: number) => string);
|
|
760
|
+
/**
|
|
761
|
+
* Returns a function that interpolates between two colours. Returns structured colour values.
|
|
762
|
+
* If you want the result as a ready-to-use CSS string, use {@link interpolatorDualToString} instead.
|
|
763
|
+
*
|
|
764
|
+
* By default takes a shorter direction and uses the OkLCH colourspace.
|
|
765
|
+
* ```js
|
|
766
|
+
* const i = interpolator(`blue`, `red`);
|
|
767
|
+
* i(0.5); // Get the colour at 50%, as a Colour structure.
|
|
768
|
+
* ```
|
|
769
|
+
*
|
|
770
|
+
* If you want to create discrete steps, consider {@link createSteps} or {@link scale}.
|
|
771
|
+
* @param colourA First colour
|
|
772
|
+
* @param colourB Second colour
|
|
773
|
+
* @param options Interpolation options. By default uses shorter direction and OkLCH colour space.
|
|
774
|
+
* @returns Function that interpolates between two colours, returning a structured Colour
|
|
775
|
+
*/
|
|
776
|
+
declare function interpolatorDual(colourA: Colourish, colourB: Colourish, options?: Partial<ColourInterpolationOpts>): (amount: number) => Colour;
|
|
777
|
+
/**
|
|
778
|
+
* Produces a stepped scale of colours.
|
|
779
|
+
*
|
|
780
|
+
* Builds off {@link createSteps} which can only step between two colours.
|
|
781
|
+
*
|
|
782
|
+
* ```js
|
|
783
|
+
* // A scale of from red to green, with three colours in-between
|
|
784
|
+
* const steps = Colour.scale([ `red`, `green` ], { stepsBetween: 3 });
|
|
785
|
+
* for (const step of steps) {
|
|
786
|
+
* // A CSS colour string
|
|
787
|
+
* }
|
|
788
|
+
* ```
|
|
789
|
+
*
|
|
790
|
+
* {@link cssLinearGradient} can produce a smooth gradient in CSS on the basis
|
|
791
|
+
* of the stepped colours.
|
|
792
|
+
* @param colours
|
|
793
|
+
* @param opts
|
|
794
|
+
* @returns Array of colours in string form
|
|
795
|
+
*/
|
|
796
|
+
declare function scale(colours: Colourish[], opts?: Partial<ColourStepOpts>): string[];
|
|
797
|
+
type CreateStepsOptions = Partial<{
|
|
798
|
+
space: ColourSpaces;
|
|
799
|
+
steps: number;
|
|
800
|
+
direction: `longer` | `shorter`;
|
|
801
|
+
exclusive: boolean;
|
|
802
|
+
}>;
|
|
803
|
+
/**
|
|
804
|
+
* Creates discrete colour steps between two colours.
|
|
805
|
+
*
|
|
806
|
+
* Use {@link scale} to create steps between any number of colours.
|
|
807
|
+
*
|
|
808
|
+
* Start and end colours are included (and counted as a step) unless `exclusive` is set to _true_
|
|
809
|
+
*
|
|
810
|
+
* ```js
|
|
811
|
+
* // Array of five HslScalar
|
|
812
|
+
* createSteps(`red`,`blue`, { steps: 5 });
|
|
813
|
+
* ```
|
|
814
|
+
*
|
|
815
|
+
* Defaults to the oklch colour space, 5 steps and non-exclusive.
|
|
816
|
+
* @param a Start colour
|
|
817
|
+
* @param b End colour
|
|
818
|
+
* @param options
|
|
819
|
+
* @returns Colour steps
|
|
820
|
+
*/
|
|
821
|
+
declare function createSteps<T extends CreateStepsOptions>(a: Colourish | string, b: Colourish, options: T): T extends {
|
|
822
|
+
space: `oklch`;
|
|
823
|
+
} ? OkLchScalar[] : T extends {
|
|
824
|
+
space: `srgb`;
|
|
825
|
+
} ? RgbScalar[] : T extends {
|
|
826
|
+
space: `hsl`;
|
|
827
|
+
} ? HslScalar[] : OkLchScalar[]; //#endregion
|
|
828
|
+
//#region src/colour/math.d.ts
|
|
829
|
+
declare function multiplyOpacity<T extends Colourish>(colourish: T, amount: number): T extends string ? string : T extends Hsl ? Hsl : T extends OkLch ? OkLch : T extends Rgb ? Rgb : never;
|
|
830
|
+
/**
|
|
831
|
+
* Does a computation with the opacity of a colour, returning colour string
|
|
832
|
+
* @param colourish Colour
|
|
833
|
+
* @param fn Function that takes original opacity as input and returns output opacity
|
|
834
|
+
*/
|
|
835
|
+
/**
|
|
836
|
+
* Does a computation with the opacity of a colour in a HSL structure
|
|
837
|
+
* @param hsl Colour
|
|
838
|
+
* @param fn Function that takes original opacity as input and returns output opacity
|
|
839
|
+
*/
|
|
840
|
+
/**
|
|
841
|
+
* Does a computation with the opacity of a colour in a RGB structure
|
|
842
|
+
* @param colourish Colour
|
|
843
|
+
* @param fn Function that takes original opacity as input and returns output opacity
|
|
844
|
+
*/
|
|
845
|
+
declare function withOpacity$2<T extends Colourish>(colourish: T, fn: (scalarOpacity: number) => number): T extends string ? string : T extends Hsl ? Hsl : T extends OkLch ? OkLch : T extends Rgb ? Rgb : never;
|
|
846
|
+
declare function setOpacity<T extends Colourish>(colourish: T, amount: number): T extends string ? string : T extends Hsl ? Hsl : T extends OkLch ? OkLch : T extends Rgb ? Rgb : never;
|
|
847
|
+
declare namespace oklch_d_exports {
|
|
848
|
+
export { OKLCH_CHROMA_MAX, absolute, fromCss$2 as fromCss, fromHexString$2 as fromHexString, fromLibrary, generateScalar, guard$2 as guard, interpolator$1 as interpolator, scalar$2 as scalar, toAbsolute, toCssString$1 as toCssString, toHexString$2 as toHexString, toScalar$2 as toScalar, withOpacity$1 as withOpacity };
|
|
849
|
+
}
|
|
850
|
+
declare const OKLCH_CHROMA_MAX = .4;
|
|
851
|
+
declare function guard$2(lch: OkLch): void;
|
|
852
|
+
/**
|
|
853
|
+
* Coverts from the Colorizr library
|
|
854
|
+
* Tests ranges:
|
|
855
|
+
* l: 0..1
|
|
856
|
+
* c: 0..1
|
|
857
|
+
* h: 0..360
|
|
858
|
+
* alpha: 0..1
|
|
859
|
+
*
|
|
860
|
+
* Default option: { scalar: true }
|
|
861
|
+
* @param lch LCH value
|
|
862
|
+
* @param parsingOptions Options for parsing
|
|
863
|
+
*/
|
|
864
|
+
declare function fromLibrary<T extends ParsingOptions<OkLch>>(lch: LCH, parsingOptions: T): T extends {
|
|
865
|
+
scalar: true;
|
|
866
|
+
} ? OkLchScalar : OkLchAbsolute;
|
|
867
|
+
/**
|
|
868
|
+
* Parse a HEX-formatted colour into OkLch structured format
|
|
869
|
+
* @param hexString
|
|
870
|
+
* @param options
|
|
871
|
+
*/
|
|
872
|
+
declare function fromHexString$2(hexString: string, options?: ParsingOptions<OkLch>): OkLch;
|
|
873
|
+
/**
|
|
874
|
+
* Converts from some CSS-representation of colour to a structured OkLch format.
|
|
875
|
+
*
|
|
876
|
+
* ```js
|
|
877
|
+
* fromCss(`yellow`);
|
|
878
|
+
* fromCss(`rgb(100,200,90)`);
|
|
879
|
+
* fromCss(`#ff00ff`);
|
|
880
|
+
* ```
|
|
881
|
+
*
|
|
882
|
+
* By default returns a {@link OkLchScalar} (relative) representation. Use the flag 'scalar:true' to get back
|
|
883
|
+
* {@link OkLchAbsolute}.
|
|
884
|
+
* @param value
|
|
885
|
+
* @param options
|
|
886
|
+
*/
|
|
887
|
+
declare function fromCss$2<T extends ParsingOptions<OkLch>>(value: string, options: T): T extends {
|
|
888
|
+
scalar: true;
|
|
889
|
+
} ? OkLchScalar : OkLchAbsolute;
|
|
890
|
+
/**
|
|
891
|
+
* Returns a string or {@link OkLch} value to absolute form.
|
|
892
|
+
*
|
|
893
|
+
* This means ranges are:
|
|
894
|
+
* lightness: 0..1
|
|
895
|
+
* chroma: 0...CHROMA_MAX (0.4)
|
|
896
|
+
* hue: 0..360
|
|
897
|
+
* @param lchOrString
|
|
898
|
+
*/
|
|
899
|
+
declare function toAbsolute(lchOrString: OkLch | string): OkLchAbsolute;
|
|
900
|
+
declare function toScalar$2(lchOrString: OkLch | string): OkLchScalar;
|
|
901
|
+
/**
|
|
902
|
+
* Returns the colour as a CSS colour string: `oklch(l c h / opacity)`.
|
|
903
|
+
*
|
|
904
|
+
* @param lch Colour
|
|
905
|
+
* @param precision Set precision of numbers, defaults to 3
|
|
906
|
+
* @returns CSS colour string
|
|
907
|
+
*/
|
|
908
|
+
declare function toCssString$1(lch: OkLch, precision?: number): string;
|
|
909
|
+
declare function toHexString$2(lch: OkLch): string;
|
|
910
|
+
declare function generateScalar(absoluteHslOrVariable: string | number | Angle, chroma?: number, lightness?: number, opacity?: number): OkLchScalar;
|
|
911
|
+
/**
|
|
912
|
+
* Scales the opacity value of an input Oklch value
|
|
913
|
+
* ```js
|
|
914
|
+
* withOpacity()
|
|
915
|
+
* ```
|
|
916
|
+
* @param value
|
|
917
|
+
* @param fn
|
|
918
|
+
*/
|
|
919
|
+
declare function withOpacity$1<T extends OkLch>(value: T, fn: (opacityScalar: number, value: T) => number): T;
|
|
920
|
+
declare function interpolator$1(a: OkLch | string, b: OkLch | string, direction?: `longer` | `shorter`): (amount: number) => OkLchScalar;
|
|
921
|
+
declare function scalar$2(lightness?: number, chroma?: number, hue?: number, opacity?: number): OkLchScalar;
|
|
922
|
+
/**
|
|
923
|
+
* Create an LCH colour using absolute hue
|
|
924
|
+
* @param l Lightness 0..1
|
|
925
|
+
* @param c Chroma 0..4
|
|
926
|
+
* @param h Hue 0..360
|
|
927
|
+
* @param opacity
|
|
928
|
+
*/
|
|
929
|
+
declare function absolute(l: number, c: number, h: number, opacity?: number): OkLchAbsolute;
|
|
930
|
+
declare namespace srgb_d_exports {
|
|
931
|
+
export { changeLightness, eightBit$1 as eightBit, fromCss$1 as fromCss, fromHexString$1 as fromHexString, guard$1 as guard, interpolator, lightness, parseCssRgbFunction, scalar$1 as scalar, to8bit$1 as to8bit, toCssString, toHexString$1 as toHexString, toLibraryHsl, toScalar$1 as toScalar, withOpacity };
|
|
932
|
+
}
|
|
933
|
+
declare function withOpacity<T extends Rgb>(value: T, fn: (opacityScalar: number, value: T) => number): T;
|
|
934
|
+
declare function fromHexString$1<T extends boolean>(hexString: string, scalar: T): T extends true ? RgbScalar : Rgb8Bit;
|
|
935
|
+
declare function fromCss$1<T extends ParsingOptions<Rgb>>(value: string, options: T): T extends {
|
|
936
|
+
scalar: true;
|
|
937
|
+
} ? RgbScalar : Rgb8Bit;
|
|
938
|
+
declare function toHexString$1(rgb: Rgb): string;
|
|
939
|
+
declare function toCssString(rgb: Rgb): string;
|
|
940
|
+
declare function to8bit$1(rgbOrString: Rgb | string): Rgb8Bit;
|
|
941
|
+
declare function toScalar$1(rgbOrString: Rgb | Hsl | string): RgbScalar;
|
|
942
|
+
declare function guard$1(rgb: Rgb): void;
|
|
943
|
+
/**
|
|
944
|
+
* Sets the lightness value.
|
|
945
|
+
*
|
|
946
|
+
* Amount to change:
|
|
947
|
+
* 'fixed': a fixed amount
|
|
948
|
+
* 'delta': increase/decrease by this amount
|
|
949
|
+
* 'pdelta': proportion of current value to change by ('percentage delta')
|
|
950
|
+
*
|
|
951
|
+
* Use negative values to decrease
|
|
952
|
+
* @param rgb Colour
|
|
953
|
+
* @param amount Amount to change
|
|
954
|
+
*/
|
|
955
|
+
declare function changeLightness(rgb: Rgb, amount: Partial<{
|
|
956
|
+
pdelta: number;
|
|
957
|
+
delta: number;
|
|
958
|
+
fixed: number;
|
|
959
|
+
}>): Rgb;
|
|
960
|
+
/**
|
|
961
|
+
* Returns a lightness value (0..1) for an RGB input
|
|
962
|
+
*
|
|
963
|
+
* Calculates lightness by converting to Oklab and using the 'L' value
|
|
964
|
+
* @param rgb
|
|
965
|
+
*/
|
|
966
|
+
declare function lightness(rgb: Rgb): number;
|
|
967
|
+
/**
|
|
968
|
+
* Creates a Rgb8Bit value from 8bit (0..255) values
|
|
969
|
+
* @param red
|
|
970
|
+
* @param green
|
|
971
|
+
* @param blue
|
|
972
|
+
* @param opacity
|
|
973
|
+
*/
|
|
974
|
+
declare function eightBit$1(red?: number, green?: number, blue?: number, opacity?: number): Rgb8Bit;
|
|
975
|
+
/**
|
|
976
|
+
* Creates a RgbScalar value from scalar (0..1) values
|
|
977
|
+
* @param red
|
|
978
|
+
* @param green
|
|
979
|
+
* @param blue
|
|
980
|
+
* @param opacity
|
|
981
|
+
*/
|
|
982
|
+
declare function scalar$1(red?: number, green?: number, blue?: number, opacity?: number): RgbScalar;
|
|
983
|
+
/**
|
|
984
|
+
* It seems Colorizr can't handle % values properly :'(
|
|
985
|
+
* @param value
|
|
986
|
+
*/
|
|
987
|
+
declare function parseCssRgbFunction(value: string): Rgb;
|
|
988
|
+
/**
|
|
989
|
+
* Interpolates colours in Srgb space. Probably
|
|
990
|
+
* really ugly, use OkLch space isntead.
|
|
991
|
+
*
|
|
992
|
+
* ```js
|
|
993
|
+
* const i = interpolator(`red`, `blue`);
|
|
994
|
+
* i(0.5); // Get 50% between these colours
|
|
995
|
+
* ```
|
|
996
|
+
* @param colourA
|
|
997
|
+
* @param colourB
|
|
998
|
+
*/
|
|
999
|
+
declare function interpolator(colourA: Rgb | string, colourB: Rgb | string): (amount: number) => RgbScalar;
|
|
1000
|
+
/**
|
|
1001
|
+
* Converts a Rgb structure (or CSS string) to Colorizr's HSL format
|
|
1002
|
+
* @param rgb
|
|
1003
|
+
*/
|
|
1004
|
+
declare function toLibraryHsl(rgb: Rgb | string): HSL; //#endregion
|
|
1005
|
+
//#region src/colour/to-integer.d.ts
|
|
1006
|
+
/**
|
|
1007
|
+
* Encode 8-bit RGB values into a 24-bit value (0...16_777_215)
|
|
1008
|
+
*
|
|
1009
|
+
* Assumes RGB values are within 0..255 range
|
|
1010
|
+
* @param rgb
|
|
1011
|
+
* @returns
|
|
1012
|
+
*/
|
|
1013
|
+
declare function encodeRgbTo24Bit(rgb: Rgb8Bit | RgbBase): number;
|
|
1014
|
+
/**
|
|
1015
|
+
* Decode a 24-bit number (0...16_777_215) into 8-bit RGB
|
|
1016
|
+
* @param colour
|
|
1017
|
+
* @returns
|
|
1018
|
+
*/
|
|
1019
|
+
declare function decodeRgbFrom24Bit(colour: number): Rgb8Bit;
|
|
1020
|
+
/**
|
|
1021
|
+
* Encodes 8-bit RGB value into 16-bit RGB565 (0..65_535)
|
|
1022
|
+
* 5-bit are used for R & B channels, 6 bits for G
|
|
1023
|
+
*
|
|
1024
|
+
* Read more: https://rgbcolorpicker.com/565
|
|
1025
|
+
* @param rgb
|
|
1026
|
+
* @returns
|
|
1027
|
+
*/
|
|
1028
|
+
declare function encodeRgbTo16Bit565(rgb: Rgb8Bit | RgbBase): number;
|
|
1029
|
+
/**
|
|
1030
|
+
* Decodes 8-bit RGB value from a 16-bit RGB565 value (0...65_535)
|
|
1031
|
+
* Read more: https://rgbcolorpicker.com/565
|
|
1032
|
+
* @param colour
|
|
1033
|
+
* @returns
|
|
1034
|
+
*/
|
|
1035
|
+
declare function decodeRgbFrom16Bit565(colour: number): Rgb8Bit;
|
|
1036
|
+
declare namespace ycbcr_d_exports {
|
|
1037
|
+
export { eightBit, fromCss, fromHexString, fromSrgTo8bit, guard, scalar, to8bit, toHexString, toScalar, toSrgb8bit };
|
|
1038
|
+
}
|
|
1039
|
+
/**
|
|
1040
|
+
* Creates a YCbCr8bit value from 8bit (0..255) values
|
|
1041
|
+
* @param y Luma 0..255
|
|
1042
|
+
* @param cb Chroma blue 0..255
|
|
1043
|
+
* @param cr Chroma red 0..255
|
|
1044
|
+
* @param opacity 0..255
|
|
1045
|
+
* @returns YCbCr8bit
|
|
1046
|
+
*/
|
|
1047
|
+
declare function eightBit(y?: number, cb?: number, cr?: number, opacity?: number): YCbCr8bit;
|
|
1048
|
+
/**
|
|
1049
|
+
* Creates a YCbCr8bit value from scalar (0..1) values
|
|
1050
|
+
* @param y Luma 0..1
|
|
1051
|
+
* @param cb Chroma blue 0..1
|
|
1052
|
+
* @param cr Chroma red 0..1
|
|
1053
|
+
* @param opacity 0..1
|
|
1054
|
+
* @returns YCbCrScalar
|
|
1055
|
+
*/
|
|
1056
|
+
declare function scalar(y?: number, cb?: number, cr?: number, opacity?: number): YCbCrScalar;
|
|
1057
|
+
/**
|
|
1058
|
+
* Converts from scalar or 8bit RGB to YCbCr8bit
|
|
1059
|
+
* @param rgb
|
|
1060
|
+
* @returns
|
|
1061
|
+
*/
|
|
1062
|
+
declare function fromSrgTo8bit(rgb: Rgb): YCbCr8bit;
|
|
1063
|
+
declare function toSrgb8bit(ycbcr: YCbCr): Rgb8Bit;
|
|
1064
|
+
/**
|
|
1065
|
+
* Returns a YCbCr8bit format from either scalar or 8bit.
|
|
1066
|
+
* If the input is already 8bit, it is returned as-is.
|
|
1067
|
+
* @param ycbcr 8bit or scalar YCbCr value
|
|
1068
|
+
* @returns YCbCr8bit
|
|
1069
|
+
*/
|
|
1070
|
+
declare function to8bit(ycbcr: YCbCr): YCbCr8bit;
|
|
1071
|
+
declare function fromHexString<T extends ParsingOptions<YCbCr>>(hexString: string, scalar: T): T extends {
|
|
1072
|
+
scalar: true;
|
|
1073
|
+
} ? YCbCrScalar : YCbCr8bit;
|
|
1074
|
+
declare function fromCss<T extends ParsingOptions<YCbCr>>(value: string, options: T): T extends {
|
|
1075
|
+
scalar: true;
|
|
1076
|
+
} ? YCbCrScalar : YCbCr8bit;
|
|
1077
|
+
declare function toScalar(colour: YCbCr | Rgb | string): YCbCrScalar;
|
|
1078
|
+
declare function guard(rgb: YCbCr): void;
|
|
1079
|
+
/**
|
|
1080
|
+
* Converts a YCbCr colour to a RGB hex string.
|
|
1081
|
+
* @param ycbcr
|
|
1082
|
+
* @returns
|
|
1083
|
+
*/
|
|
1084
|
+
declare function toHexString(ycbcr: YCbCr): string;
|
|
1085
|
+
declare namespace index_d_exports {
|
|
1086
|
+
export { Colour, ColourInterpolationOpts, ColourInterpolator, ColourSpaces, ColourStepOpts, Colourish, ConvertDestinations, CreateStepsOptions, CssColourNames, Hsl, HslAbsolute, HslBase, HslScalar, hsl_d_exports as HslSpace, LchBase, OkLch, OkLchAbsolute, OkLchBase, OkLchScalar, oklch_d_exports as OklchSpace, ParsingOptions, Rgb, Rgb8Bit, RgbBase, RgbScalar, srgb_d_exports as SrgbSpace, YCbCr, YCbCr8bit, YCbCrBase, YCbCrScalar, ycbcr_d_exports as YCbCrSpace, convert, convertScalar, convertToString, createSteps, cssDefinedHexColours, cssLinearGradient, decodeRgbFrom16Bit565, decodeRgbFrom24Bit, encodeRgbTo16Bit565, encodeRgbTo24Bit, fromCssColour, goldenAngleColour, guard$4 as guard, interpolator$2 as interpolator, interpolatorDual, interpolatorDualToString, isColourish, isHsl, isOkLch, isRgb, multiplyOpacity, randomHue, resolveCss, rgbToHsl, scale, setOpacity, toColour, toCssColour, toHexColour, toLibraryColour, toStringFirst, tryParseObjectToHsl, tryParseObjectToRgb, withOpacity$2 as withOpacity };
|
|
1087
|
+
} //#endregion
|
|
1088
|
+
//#endregion
|
|
1089
|
+
//#region src/colour-picker/colour-picker.d.ts
|
|
1090
|
+
declare class ColourPicker extends LitElement {
|
|
1091
|
+
l: number;
|
|
1092
|
+
c: number;
|
|
1093
|
+
h: number;
|
|
1094
|
+
a: number;
|
|
1095
|
+
hidePreview: boolean;
|
|
1096
|
+
hideH: boolean;
|
|
1097
|
+
hideL: boolean;
|
|
1098
|
+
hideC: boolean;
|
|
1099
|
+
showA: boolean;
|
|
1100
|
+
horizontal: boolean;
|
|
1101
|
+
slidersVertical: boolean;
|
|
1102
|
+
hideTooltips: boolean;
|
|
1103
|
+
private _valueAttr;
|
|
1104
|
+
rangeLAttr: string | null;
|
|
1105
|
+
rangeCAttr: string | null;
|
|
1106
|
+
rangeHAttr: string | null;
|
|
1107
|
+
rangeAAttr: string | null;
|
|
1108
|
+
private _ranges;
|
|
1109
|
+
_sliderL: HTMLElement;
|
|
1110
|
+
_sliderC: HTMLElement;
|
|
1111
|
+
_sliderH: HTMLElement;
|
|
1112
|
+
_sliderA: HTMLElement;
|
|
1113
|
+
_previewEl: HTMLElement;
|
|
1114
|
+
private _defaultL;
|
|
1115
|
+
private _defaultC;
|
|
1116
|
+
private _defaultH;
|
|
1117
|
+
private _defaultA;
|
|
1118
|
+
private readonly _userInitiated;
|
|
1119
|
+
get value(): string;
|
|
1120
|
+
set value(colourString: string);
|
|
1121
|
+
/**
|
|
1122
|
+
* Set the colour from any ixfx-compatible format (CSS string, OkLch object,
|
|
1123
|
+
* HSL object, etc.). Also updates the double-click reset defaults for all
|
|
1124
|
+
* sliders.
|
|
1125
|
+
*/
|
|
1126
|
+
setColour(colour: index_d_exports.Colourish): void;
|
|
1127
|
+
get rangeL(): Range;
|
|
1128
|
+
set rangeL(range: RangeInput);
|
|
1129
|
+
get rangeC(): Range;
|
|
1130
|
+
set rangeC(range: RangeInput);
|
|
1131
|
+
get rangeH(): Range;
|
|
1132
|
+
set rangeH(range: RangeInput);
|
|
1133
|
+
get rangeA(): Range;
|
|
1134
|
+
set rangeA(range: RangeInput);
|
|
1135
|
+
setRangeL(range: RangeInput): void;
|
|
1136
|
+
setRangeC(range: RangeInput): void;
|
|
1137
|
+
setRangeH(range: RangeInput): void;
|
|
1138
|
+
setRangeA(range: RangeInput): void;
|
|
1139
|
+
willUpdate(changedProperties: PropertyValues): void;
|
|
1140
|
+
private _applyRangeInput;
|
|
1141
|
+
private _coerceRangeInput;
|
|
1142
|
+
private _setRangeFromAttribute;
|
|
1143
|
+
private _setRange;
|
|
1144
|
+
private _getRange;
|
|
1145
|
+
private _parseRangeString;
|
|
1146
|
+
private _normalizeRange;
|
|
1147
|
+
private _clampToRange;
|
|
1148
|
+
render(): _$lit.TemplateResult<1>;
|
|
1149
|
+
firstUpdated(changedProperties: PropertyValues): void;
|
|
1150
|
+
updated(changedProperties: PropertyValues): void;
|
|
1151
|
+
_updateGradients(): void;
|
|
1152
|
+
_onInput: (e: Event, channel: `l` | `c` | `h` | `a`) => void;
|
|
1153
|
+
_onChange: (e: Event, channel: `l` | `c` | `h` | `a`) => void;
|
|
1154
|
+
_dispatchInput(): void;
|
|
1155
|
+
_dispatchChange(): void;
|
|
1156
|
+
static styles: CSSResultGroup;
|
|
1157
|
+
}
|
|
1158
|
+
declare global {
|
|
1159
|
+
interface HTMLElementTagNameMap {
|
|
1160
|
+
'ixfx-colour-picker': ColourPicker;
|
|
1161
|
+
}
|
|
1162
|
+
} //# sourceMappingURL=colour-picker.d.ts.map
|
|
1163
|
+
//#endregion
|
|
1164
|
+
//#region src/colour-picker/colour-picker-popup.d.ts
|
|
1165
|
+
declare const PICKER_SIZES: {
|
|
1166
|
+
readonly small: {
|
|
1167
|
+
readonly width: 130;
|
|
1168
|
+
readonly height: 100;
|
|
1169
|
+
};
|
|
1170
|
+
readonly medium: {
|
|
1171
|
+
readonly width: 100;
|
|
1172
|
+
readonly height: 155;
|
|
1173
|
+
};
|
|
1174
|
+
readonly large: {
|
|
1175
|
+
readonly width: 200;
|
|
1176
|
+
readonly height: 180;
|
|
1177
|
+
};
|
|
1178
|
+
readonly huge: {
|
|
1179
|
+
readonly width: 290;
|
|
1180
|
+
readonly height: 240;
|
|
1181
|
+
};
|
|
1182
|
+
};
|
|
1183
|
+
type PickerSize = keyof typeof PICKER_SIZES;
|
|
1184
|
+
declare class ColourPickerPopup extends LitElement {
|
|
1185
|
+
mode: `fluid` | `confirm`;
|
|
1186
|
+
l: number;
|
|
1187
|
+
c: number;
|
|
1188
|
+
h: number;
|
|
1189
|
+
a: number;
|
|
1190
|
+
showPreview: boolean;
|
|
1191
|
+
hideH: boolean;
|
|
1192
|
+
hideL: boolean;
|
|
1193
|
+
hideC: boolean;
|
|
1194
|
+
showA: boolean;
|
|
1195
|
+
horizontal: boolean;
|
|
1196
|
+
size: PickerSize;
|
|
1197
|
+
private _isOpen;
|
|
1198
|
+
private _everOpened;
|
|
1199
|
+
_popupEl: HTMLElement;
|
|
1200
|
+
_pickerEl: ColourPicker;
|
|
1201
|
+
private readonly _uid;
|
|
1202
|
+
private readonly _anchorName;
|
|
1203
|
+
private readonly _popupId;
|
|
1204
|
+
private _pendingL;
|
|
1205
|
+
private _pendingC;
|
|
1206
|
+
private _pendingH;
|
|
1207
|
+
private _pendingA;
|
|
1208
|
+
private _savedL;
|
|
1209
|
+
private _savedC;
|
|
1210
|
+
private _savedH;
|
|
1211
|
+
private _savedA;
|
|
1212
|
+
private _pendingConfirmed;
|
|
1213
|
+
constructor();
|
|
1214
|
+
get value(): string;
|
|
1215
|
+
private get _innerHidePreview();
|
|
1216
|
+
private get _pickerDimensions();
|
|
1217
|
+
setColour(colour: index_d_exports.Colourish): void;
|
|
1218
|
+
firstUpdated(changedProperties: PropertyValues): void;
|
|
1219
|
+
updated(changedProperties: PropertyValues): void;
|
|
1220
|
+
private _applyAnchorPositioning;
|
|
1221
|
+
private _updateSwatchBackground;
|
|
1222
|
+
private _onPopoverToggle;
|
|
1223
|
+
private _onPickerInput;
|
|
1224
|
+
private _onPickerChange;
|
|
1225
|
+
private _onConfirm;
|
|
1226
|
+
private _onSwatchClick;
|
|
1227
|
+
private _dispatchInput;
|
|
1228
|
+
private _dispatchChange;
|
|
1229
|
+
render(): _$lit.TemplateResult<1>;
|
|
1230
|
+
static styles: CSSResultGroup;
|
|
1231
|
+
}
|
|
1232
|
+
declare global {
|
|
1233
|
+
interface HTMLElementTagNameMap {
|
|
1234
|
+
'ixfx-colour-picker-popup': ColourPickerPopup;
|
|
1235
|
+
}
|
|
1236
|
+
}
|
|
1237
|
+
//#endregion
|
|
1238
|
+
export { ColourPickerInputEvent as a, ColourPickerEventDetail as i, ColourPicker as n, OklchValue as o, ColourPickerChangeEvent as r, ColourPickerPopup as t };
|
|
1239
|
+
//# sourceMappingURL=index-CpbBI3n7.d.ts.map
|