@ixfx/components 0.4.3 → 0.4.4

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