@electrovir/color 1.7.12 → 2.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/demo/all-book-pages.js +1 -10
- package/dist/demo/top-level-pages.d.ts +0 -1
- package/dist/demo/top-level-pages.js +0 -4
- package/dist/demo/vir-demo.element.js +2 -2
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -10
- package/package.json +16 -18
- package/dist/data/local-storage.client.d.ts +0 -4
- package/dist/data/local-storage.client.js +0 -6
- package/dist/elements/vir-all-color-space-sliders.element.d.ts +0 -11
- package/dist/elements/vir-all-color-space-sliders.element.js +0 -53
- package/dist/elements/vir-all-spaces-color-picker.element.d.ts +0 -15
- package/dist/elements/vir-all-spaces-color-picker.element.js +0 -69
- package/dist/elements/vir-color-details.element.d.ts +0 -14
- package/dist/elements/vir-color-details.element.js +0 -151
- package/dist/elements/vir-color-format-sliders.element.d.ts +0 -14
- package/dist/elements/vir-color-format-sliders.element.js +0 -58
- package/dist/elements/vir-color-pair-contrast-summary.element.d.ts +0 -9
- package/dist/elements/vir-color-pair-contrast-summary.element.js +0 -307
- package/dist/elements/vir-color-pair.element.d.ts +0 -17
- package/dist/elements/vir-color-pair.element.js +0 -201
- package/dist/elements/vir-color-picker.element.d.ts +0 -20
- package/dist/elements/vir-color-picker.element.js +0 -272
- package/dist/elements/vir-color-slider.element.d.ts +0 -14
- package/dist/elements/vir-color-slider.element.js +0 -120
- package/dist/elements/vir-color-swatch.element.d.ts +0 -20
- package/dist/elements/vir-color-swatch.element.js +0 -48
- package/dist/elements/vir-contrast-indicator.element.d.ts +0 -10
- package/dist/elements/vir-contrast-indicator.element.js +0 -96
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
/* node:coverage disable */
|
|
2
|
-
import { assertWrap } from '@augment-vir/assert';
|
|
3
|
-
import { getObjectTypedEntries, round } from '@augment-vir/common';
|
|
4
|
-
import { classMap, css, defineElement, html, unsafeCSS } from 'element-vir';
|
|
5
|
-
import { ViraBoldText } from 'vira/dist/elements/vira-bold-text.element.js';
|
|
6
|
-
import { viraFontCssVars } from 'vira/dist/styles/font.js';
|
|
7
|
-
import { noNativeSpacing } from 'vira/dist/styles/native-styles.js';
|
|
8
|
-
import { defineTable } from 'vira/dist/util/define-table.js';
|
|
9
|
-
import { Color } from '../data/color-class/color.js';
|
|
10
|
-
import { calculateContrast, calculateFontSizes, contrastLevelLabel, contrastLevels, fontWeightByName, } from '../data/contrast/contrast.js';
|
|
11
|
-
import { VirColorSwatch } from './vir-color-swatch.element.js';
|
|
12
|
-
import { VirContrastIndicator } from './vir-contrast-indicator.element.js';
|
|
13
|
-
/**
|
|
14
|
-
* A huge summary of a color pair's contrast levels, font sizes, font weights, etc.
|
|
15
|
-
*
|
|
16
|
-
* @category Elements
|
|
17
|
-
*/
|
|
18
|
-
export const VirColorPairContrastSummary = defineElement()({
|
|
19
|
-
tagName: 'vir-color-pair-contrast-summary',
|
|
20
|
-
styles: css `
|
|
21
|
-
:host {
|
|
22
|
-
display: flex;
|
|
23
|
-
justify-content: center;
|
|
24
|
-
align-items: center;
|
|
25
|
-
gap: 32px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/* Color overlay styles */
|
|
29
|
-
.color-overlay {
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: center;
|
|
32
|
-
max-width: 100%;
|
|
33
|
-
gap: 8px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.constant-size-wrapper {
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: baseline;
|
|
39
|
-
gap: 5cqmin;
|
|
40
|
-
font-size: 20cqmin;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.square {
|
|
44
|
-
margin: 12px 0;
|
|
45
|
-
width: 20cqmin;
|
|
46
|
-
height: 20cqmin;
|
|
47
|
-
background-color: currentColor;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.foreground-content {
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
position: relative;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.needed-size {
|
|
57
|
-
display: flex;
|
|
58
|
-
justify-content: center;
|
|
59
|
-
top: 100%;
|
|
60
|
-
left: 0;
|
|
61
|
-
text-align: center;
|
|
62
|
-
position: absolute;
|
|
63
|
-
width: 100%;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
${VirContrastIndicator} {
|
|
67
|
-
width: 100%;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.color-overlay td {
|
|
71
|
-
padding: 4px 8px;
|
|
72
|
-
font-weight: bold;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.color-overlay th {
|
|
76
|
-
padding: 4px 8px;
|
|
77
|
-
text-align: end;
|
|
78
|
-
font-weight: normal;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/* Text weights styles */
|
|
82
|
-
.text-weights td {
|
|
83
|
-
padding: 4px;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
.size-display {
|
|
87
|
-
height: 50px;
|
|
88
|
-
width: 100px;
|
|
89
|
-
overflow: hidden;
|
|
90
|
-
display: flex;
|
|
91
|
-
align-items: center;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.cell-size {
|
|
95
|
-
width: 5em;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/* Contrast levels styles */
|
|
99
|
-
.contrast-levels td {
|
|
100
|
-
padding: 4px;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.contrast-levels tr {
|
|
104
|
-
opacity: 0.4;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.contrast-levels .selected-row {
|
|
108
|
-
opacity: 1;
|
|
109
|
-
font-weight: bold;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
pre {
|
|
113
|
-
${noNativeSpacing};
|
|
114
|
-
font-family: ${viraFontCssVars['vira-monospace'].value};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.monospace-font {
|
|
118
|
-
font-family: ${viraFontCssVars['vira-monospace'].value};
|
|
119
|
-
}
|
|
120
|
-
`,
|
|
121
|
-
render({ inputs }) {
|
|
122
|
-
const contrast = calculateContrast({
|
|
123
|
-
background: new Color(inputs.backgroundColor).toCss().rgb,
|
|
124
|
-
foreground: new Color(inputs.foregroundColor).toCss().rgb,
|
|
125
|
-
});
|
|
126
|
-
const { rows: colorPairRows } = defineTable({
|
|
127
|
-
headers: [
|
|
128
|
-
{
|
|
129
|
-
key: 'colorLayer',
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
key: 'colorValue',
|
|
133
|
-
},
|
|
134
|
-
],
|
|
135
|
-
originalData: getObjectTypedEntries({
|
|
136
|
-
'Foreground:': new Color(inputs.foregroundColor).toFormattedStrings().hexString,
|
|
137
|
-
'Background:': new Color(inputs.backgroundColor).toFormattedStrings().hexString,
|
|
138
|
-
'Contrast:': `${contrast.contrast} Lc`.padEnd(9, ' '),
|
|
139
|
-
}),
|
|
140
|
-
dataMap: ([colorLayer, value,]) => {
|
|
141
|
-
return {
|
|
142
|
-
colorLayer,
|
|
143
|
-
colorValue: html `
|
|
144
|
-
<pre>${value}</pre>
|
|
145
|
-
`,
|
|
146
|
-
};
|
|
147
|
-
},
|
|
148
|
-
});
|
|
149
|
-
const { rows: weightRows } = defineTable({
|
|
150
|
-
headers: [
|
|
151
|
-
{
|
|
152
|
-
key: 'weight',
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
key: 'size',
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
originalData: Object.entries(contrast.fontSizes).map(([weight, size,]) => {
|
|
159
|
-
return {
|
|
160
|
-
weight: Number(weight),
|
|
161
|
-
size,
|
|
162
|
-
};
|
|
163
|
-
}),
|
|
164
|
-
dataMap: ({ size, weight }) => {
|
|
165
|
-
return {
|
|
166
|
-
size: `${round(size, {
|
|
167
|
-
digits: 1,
|
|
168
|
-
})}px`,
|
|
169
|
-
weight: html `
|
|
170
|
-
<span
|
|
171
|
-
style=${css `
|
|
172
|
-
font-weight: ${weight};
|
|
173
|
-
`}
|
|
174
|
-
>
|
|
175
|
-
${weight}
|
|
176
|
-
</span>
|
|
177
|
-
`,
|
|
178
|
-
};
|
|
179
|
-
},
|
|
180
|
-
});
|
|
181
|
-
const { rows: levelRows } = defineTable({
|
|
182
|
-
headers: [
|
|
183
|
-
{
|
|
184
|
-
key: 'boundaryLc',
|
|
185
|
-
},
|
|
186
|
-
{
|
|
187
|
-
key: 'levelName',
|
|
188
|
-
},
|
|
189
|
-
],
|
|
190
|
-
originalData: contrastLevels,
|
|
191
|
-
dataMap: (contrastLevel) => {
|
|
192
|
-
return {
|
|
193
|
-
boundaryLc: `${contrastLevel.min} Lc`,
|
|
194
|
-
levelName: contrastLevelLabel[contrastLevel.name],
|
|
195
|
-
};
|
|
196
|
-
},
|
|
197
|
-
});
|
|
198
|
-
return html `
|
|
199
|
-
<div class="color-overlay">
|
|
200
|
-
<${VirColorSwatch.assign({
|
|
201
|
-
backgroundColor: inputs.backgroundColor,
|
|
202
|
-
foregroundColor: inputs.foregroundColor,
|
|
203
|
-
})}>
|
|
204
|
-
<div class="foreground-content">
|
|
205
|
-
<div class="constant-size-wrapper">
|
|
206
|
-
<div class="square"></div>
|
|
207
|
-
<b>Aa</b>
|
|
208
|
-
</div>
|
|
209
|
-
<div class="needed-size">
|
|
210
|
-
<span
|
|
211
|
-
style=${css `
|
|
212
|
-
font-size: ${contrast.fontSizes[fontWeightByName.Normal]}px;
|
|
213
|
-
line-height: ${contrast.fontSizes[fontWeightByName.Normal] *
|
|
214
|
-
0.77}px;
|
|
215
|
-
visibility: ${unsafeCSS(contrast.fontSizes[fontWeightByName.Normal] > 900
|
|
216
|
-
? 'hidden'
|
|
217
|
-
: 'visible')};
|
|
218
|
-
`}
|
|
219
|
-
>
|
|
220
|
-
Min Size
|
|
221
|
-
</span>
|
|
222
|
-
</div>
|
|
223
|
-
</div>
|
|
224
|
-
</${VirColorSwatch}>
|
|
225
|
-
<div class="details">
|
|
226
|
-
<table>
|
|
227
|
-
<tbody>
|
|
228
|
-
${colorPairRows.map((row) => {
|
|
229
|
-
const cells = row.cells.map((cell, index) => {
|
|
230
|
-
const element = index ? 'td' : 'th';
|
|
231
|
-
return html `
|
|
232
|
-
<${element}>${cell.content}</${element}>
|
|
233
|
-
`;
|
|
234
|
-
});
|
|
235
|
-
return html `
|
|
236
|
-
<tr>${cells}</tr>
|
|
237
|
-
`;
|
|
238
|
-
})}
|
|
239
|
-
</tbody>
|
|
240
|
-
</table>
|
|
241
|
-
|
|
242
|
-
<${VirContrastIndicator.assign({
|
|
243
|
-
contrast,
|
|
244
|
-
fontWeight: fontWeightByName.Normal,
|
|
245
|
-
})}></${VirContrastIndicator}>
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
|
|
249
|
-
<table class="text-weights">
|
|
250
|
-
${weightRows.map((row) => {
|
|
251
|
-
const cells = row.cells.map((cell) => {
|
|
252
|
-
return html `
|
|
253
|
-
<td class="cell-${cell.key} monospace-font">${cell.content}</td>
|
|
254
|
-
`;
|
|
255
|
-
});
|
|
256
|
-
return html `
|
|
257
|
-
<tr>
|
|
258
|
-
${cells}
|
|
259
|
-
<td>
|
|
260
|
-
<div
|
|
261
|
-
class="size-display"
|
|
262
|
-
style=${css `
|
|
263
|
-
background-color: ${unsafeCSS(inputs.backgroundColor)};
|
|
264
|
-
color: ${unsafeCSS(inputs.foregroundColor)};
|
|
265
|
-
font-weight: ${row.data.weight};
|
|
266
|
-
font-size: ${row.data.size}px;
|
|
267
|
-
`}
|
|
268
|
-
>
|
|
269
|
-
<span>Text</span>
|
|
270
|
-
</div>
|
|
271
|
-
</td>
|
|
272
|
-
</tr>
|
|
273
|
-
`;
|
|
274
|
-
})}
|
|
275
|
-
</table>
|
|
276
|
-
|
|
277
|
-
<table class="contrast-levels">
|
|
278
|
-
${levelRows.map((row) => {
|
|
279
|
-
const isSelectedRow = contrast.contrastLevel.name === row.data.name;
|
|
280
|
-
const cells = row.cells.map((cell) => {
|
|
281
|
-
return html `
|
|
282
|
-
<td><${ViraBoldText.assign({
|
|
283
|
-
bold: isSelectedRow,
|
|
284
|
-
text: assertWrap.isString(cell.content),
|
|
285
|
-
})}><${ViraBoldText}></td>
|
|
286
|
-
`;
|
|
287
|
-
});
|
|
288
|
-
const title = [
|
|
289
|
-
row.data.description,
|
|
290
|
-
'\nFont weights to font sizes:',
|
|
291
|
-
JSON.stringify(calculateFontSizes(row.data.min), null, 4),
|
|
292
|
-
].join('\n');
|
|
293
|
-
return html `
|
|
294
|
-
<tr
|
|
295
|
-
title=${title}
|
|
296
|
-
class=${classMap({
|
|
297
|
-
'selected-row': isSelectedRow,
|
|
298
|
-
})}
|
|
299
|
-
>
|
|
300
|
-
${cells}
|
|
301
|
-
</tr>
|
|
302
|
-
`;
|
|
303
|
-
})}
|
|
304
|
-
</table>
|
|
305
|
-
`;
|
|
306
|
-
},
|
|
307
|
-
});
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type ColorPair } from '../data/color-css.js';
|
|
2
|
-
import { type FontWeight } from '../data/contrast/contrast.js';
|
|
3
|
-
/**
|
|
4
|
-
* Showcase a foreground/backend color pair.
|
|
5
|
-
*
|
|
6
|
-
* @category Elements
|
|
7
|
-
*/
|
|
8
|
-
export declare const VirColorPair: import("element-vir").DeclarativeElementDefinition<"vir-color-pair", {
|
|
9
|
-
color: Readonly<ColorPair>;
|
|
10
|
-
showVarValues: boolean;
|
|
11
|
-
showVarNames: boolean;
|
|
12
|
-
showContrast: boolean;
|
|
13
|
-
fontWeight: FontWeight;
|
|
14
|
-
}, {
|
|
15
|
-
previewElement: undefined | HTMLElement;
|
|
16
|
-
forceShowEverything: boolean;
|
|
17
|
-
}, {}, "vir-color-pair-no-contrast-tips", "vir-color-pair-", readonly [], readonly []>;
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
/* node:coverage disable */
|
|
2
|
-
import { assertWrap, check } from '@augment-vir/assert';
|
|
3
|
-
import { css, defineElement, html, listen, nothing, onDomCreated, unsafeCSS } from 'element-vir';
|
|
4
|
-
import { viraFontCssVars } from 'vira/dist/styles/font.js';
|
|
5
|
-
import { noNativeFormStyles, noNativeSpacing } from 'vira/dist/styles/native-styles.js';
|
|
6
|
-
import { calculateContrast } from '../data/contrast/contrast.js';
|
|
7
|
-
import { VirContrastIndicator } from './vir-contrast-indicator.element.js';
|
|
8
|
-
/**
|
|
9
|
-
* Showcase a foreground/backend color pair.
|
|
10
|
-
*
|
|
11
|
-
* @category Elements
|
|
12
|
-
*/
|
|
13
|
-
export const VirColorPair = defineElement()({
|
|
14
|
-
tagName: 'vir-color-pair',
|
|
15
|
-
state() {
|
|
16
|
-
return {
|
|
17
|
-
previewElement: undefined,
|
|
18
|
-
forceShowEverything: false,
|
|
19
|
-
};
|
|
20
|
-
},
|
|
21
|
-
hostClasses: {
|
|
22
|
-
'vir-color-pair-no-contrast-tips': ({ inputs, state }) => {
|
|
23
|
-
return !inputs.showContrast && !state.forceShowEverything;
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
styles: ({ hostClasses }) => {
|
|
27
|
-
return css `
|
|
28
|
-
:host {
|
|
29
|
-
display: flex;
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
align-items: center;
|
|
32
|
-
max-width: 100%;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.color-preview {
|
|
36
|
-
${noNativeFormStyles};
|
|
37
|
-
cursor: pointer;
|
|
38
|
-
font-size: 32px;
|
|
39
|
-
padding-left: 12px;
|
|
40
|
-
padding-right: 0;
|
|
41
|
-
border: 1px solid #ccc;
|
|
42
|
-
border-radius: 8px;
|
|
43
|
-
display: flex;
|
|
44
|
-
gap: 8px;
|
|
45
|
-
align-items: baseline;
|
|
46
|
-
|
|
47
|
-
& b {
|
|
48
|
-
margin: 12px 0;
|
|
49
|
-
font-weight: bold;
|
|
50
|
-
text-decoration: underline;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
& .square {
|
|
54
|
-
margin: 12px 0;
|
|
55
|
-
width: 24px;
|
|
56
|
-
height: 24px;
|
|
57
|
-
background-color: currentColor;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
${hostClasses['vir-color-pair-no-contrast-tips'].selector} {
|
|
61
|
-
& .needed-size-wrapper {
|
|
62
|
-
display: none;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
& .color-preview {
|
|
66
|
-
padding: 4px 24px;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.needed-size-wrapper {
|
|
71
|
-
align-self: stretch;
|
|
72
|
-
width: 56px;
|
|
73
|
-
position: relative;
|
|
74
|
-
overflow: hidden;
|
|
75
|
-
border-left: 1px solid #ccc;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.needed-size {
|
|
79
|
-
top: 0;
|
|
80
|
-
height: 100%;
|
|
81
|
-
display: flex;
|
|
82
|
-
align-items: center;
|
|
83
|
-
left: 6px;
|
|
84
|
-
position: absolute;
|
|
85
|
-
|
|
86
|
-
& span {
|
|
87
|
-
margin: 0 auto;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.css-var-names {
|
|
92
|
-
font-family: ${viraFontCssVars['vira-monospace'].value};
|
|
93
|
-
display: flex;
|
|
94
|
-
max-width: 100%;
|
|
95
|
-
flex-direction: column;
|
|
96
|
-
opacity: 0.6;
|
|
97
|
-
margin-top: 4px;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
p {
|
|
101
|
-
${noNativeSpacing};
|
|
102
|
-
display: flex;
|
|
103
|
-
gap: 0;
|
|
104
|
-
flex-wrap: wrap;
|
|
105
|
-
|
|
106
|
-
& span:last-child {
|
|
107
|
-
margin-left: 1ex;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
${VirContrastIndicator} {
|
|
112
|
-
margin-top: 1px;
|
|
113
|
-
}
|
|
114
|
-
`;
|
|
115
|
-
},
|
|
116
|
-
render({ state, updateState, inputs }) {
|
|
117
|
-
const colorRows = [
|
|
118
|
-
'foreground',
|
|
119
|
-
'background',
|
|
120
|
-
].map((layerKey) => {
|
|
121
|
-
const keyString = [
|
|
122
|
-
inputs.color[layerKey].name,
|
|
123
|
-
inputs.showVarValues || state.forceShowEverything ? ':' : '',
|
|
124
|
-
]
|
|
125
|
-
.filter(check.isTruthy)
|
|
126
|
-
.join('');
|
|
127
|
-
const valueTemplate = inputs.showVarValues || state.forceShowEverything
|
|
128
|
-
? html `
|
|
129
|
-
<span>${inputs.color[layerKey].default}</span>
|
|
130
|
-
`
|
|
131
|
-
: nothing;
|
|
132
|
-
return html `
|
|
133
|
-
<p>
|
|
134
|
-
<span>${keyString}</span>
|
|
135
|
-
${valueTemplate}
|
|
136
|
-
</p>
|
|
137
|
-
`;
|
|
138
|
-
});
|
|
139
|
-
const cssVarNamesTemplate = inputs.showVarNames || state.forceShowEverything
|
|
140
|
-
? html `
|
|
141
|
-
<div class="css-var-names">${colorRows}</div>
|
|
142
|
-
`
|
|
143
|
-
: nothing;
|
|
144
|
-
const contrast = state.previewElement
|
|
145
|
-
? calculateContrast({
|
|
146
|
-
foreground: globalThis
|
|
147
|
-
.getComputedStyle(state.previewElement)
|
|
148
|
-
.getPropertyValue('color'),
|
|
149
|
-
background: globalThis
|
|
150
|
-
.getComputedStyle(state.previewElement)
|
|
151
|
-
.getPropertyValue('background-color'),
|
|
152
|
-
})
|
|
153
|
-
: undefined;
|
|
154
|
-
const contrastTemplate = contrast && (inputs.showContrast || state.forceShowEverything)
|
|
155
|
-
? html `
|
|
156
|
-
<${VirContrastIndicator.assign({
|
|
157
|
-
contrast,
|
|
158
|
-
fontWeight: inputs.fontWeight,
|
|
159
|
-
})}></${VirContrastIndicator}>
|
|
160
|
-
`
|
|
161
|
-
: nothing;
|
|
162
|
-
return html `
|
|
163
|
-
<button
|
|
164
|
-
${listen('click', () => {
|
|
165
|
-
updateState({
|
|
166
|
-
forceShowEverything: !state.forceShowEverything,
|
|
167
|
-
});
|
|
168
|
-
})}
|
|
169
|
-
${onDomCreated((element) => {
|
|
170
|
-
updateState({
|
|
171
|
-
previewElement: assertWrap.instanceOf(element, HTMLElement),
|
|
172
|
-
});
|
|
173
|
-
})}
|
|
174
|
-
class="color-preview"
|
|
175
|
-
style=${css `
|
|
176
|
-
color: ${unsafeCSS(inputs.color.foreground.default)};
|
|
177
|
-
background: ${unsafeCSS(inputs.color.background.default)};
|
|
178
|
-
`}
|
|
179
|
-
>
|
|
180
|
-
<div class="square"></div>
|
|
181
|
-
<b>Aa</b>
|
|
182
|
-
<div class="needed-size-wrapper">
|
|
183
|
-
<span class="needed-size">
|
|
184
|
-
<span
|
|
185
|
-
style=${css `
|
|
186
|
-
visibility: ${unsafeCSS((contrast?.fontSizes[400] || Infinity) > 150
|
|
187
|
-
? 'hidden'
|
|
188
|
-
: 'visible')};
|
|
189
|
-
font-weight: ${inputs.fontWeight};
|
|
190
|
-
font-size: ${contrast ? contrast.fontSizes[400] : 14}px;
|
|
191
|
-
`}
|
|
192
|
-
>
|
|
193
|
-
Min
|
|
194
|
-
</span>
|
|
195
|
-
</span>
|
|
196
|
-
</div>
|
|
197
|
-
</button>
|
|
198
|
-
${contrastTemplate} ${cssVarNamesTemplate}
|
|
199
|
-
`;
|
|
200
|
-
},
|
|
201
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { type PartialWithUndefined } from '@augment-vir/common';
|
|
2
|
-
import { Color } from '../data/color-class/color.js';
|
|
3
|
-
/**
|
|
4
|
-
* A color picker element with a swatch that opens a popup with color format sliders.
|
|
5
|
-
*
|
|
6
|
-
* Set the width and height of the swatch using the provided CSS variables.
|
|
7
|
-
*
|
|
8
|
-
* @category Elements
|
|
9
|
-
*/
|
|
10
|
-
export declare const VirColorPicker: import("element-vir").DeclarativeElementDefinition<"vir-color-picker", Readonly<{
|
|
11
|
-
color: string | Readonly<Color> | undefined;
|
|
12
|
-
} & PartialWithUndefined<{
|
|
13
|
-
alwaysShowPicker: boolean;
|
|
14
|
-
showHexValue: boolean;
|
|
15
|
-
}>>, {
|
|
16
|
-
selectedFormatName: "hsl" | "hwb" | "lab" | "lch" | "oklab" | "oklch" | "rgb" | "hex";
|
|
17
|
-
rawInput: undefined | string;
|
|
18
|
-
}, {
|
|
19
|
-
colorChange: import("element-vir").DefineEvent<string>;
|
|
20
|
-
}, "vir-color-picker-always-show", "vir-color-picker-swatch-width" | "vir-color-picker-swatch-height", readonly [], readonly []>;
|