@alegendstale/holly-components 0.2.8 → 0.2.10
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/components/absolute-container/absolute-container.js +113 -91
- package/dist/components/absolute-container/absolute-container.stories.js +36 -0
- package/dist/components/absolute-container/index.js +1 -1
- package/dist/components/bottom-sheet/bottom-sheet.js +415 -308
- package/dist/components/bottom-sheet/bottom-sheet.stories.js +43 -0
- package/dist/components/bottom-sheet/bottom-sheet.test.js +15 -0
- package/dist/components/bottom-sheet/index.js +1 -1
- package/dist/components/canvas/canvas-base.d.ts +2 -1
- package/dist/components/canvas/canvas-base.d.ts.map +1 -1
- package/dist/components/canvas/canvas-base.js +56 -44
- package/dist/components/canvas/canvas-gradient.d.ts.map +1 -1
- package/dist/components/canvas/canvas-gradient.js +61 -45
- package/dist/components/canvas/canvas-image.js +158 -111
- package/dist/components/canvas/index.js +2 -2
- package/dist/components/carousel-scroller/carousel-scroller.js +133 -121
- package/dist/components/carousel-scroller/carousel-scroller.stories.js +40 -0
- package/dist/components/carousel-scroller/index.js +1 -1
- package/dist/components/color-palette/color-palette-utils.d.ts.map +1 -1
- package/dist/components/color-palette/color-palette-utils.js +105 -40
- package/dist/components/color-palette/color-palette.js +429 -337
- package/dist/components/color-palette/component/color-palette-component.js +184 -142
- package/dist/components/color-palette/component/color-palette-component.stories.js +74 -0
- package/dist/components/color-palette/component/index.js +1 -0
- package/dist/components/color-palette/editor/color-palette-editor.js +702 -591
- package/dist/components/color-palette/editor/color-palette-editor.stories.js +39 -0
- package/dist/components/color-palette/editor/index.js +1 -0
- package/dist/components/color-palette/index.js +5 -7
- package/dist/components/color-palette/item/color-palette-item-edit.js +114 -87
- package/dist/components/color-palette/item/color-palette-item.js +155 -140
- package/dist/components/color-palette/item/index.js +2 -0
- package/dist/components/color-palette/menu/color-palette-menu.js +241 -217
- package/dist/components/color-palette/menu/color-palette-reorder.js +117 -103
- package/dist/components/color-palette/menu/index.js +2 -0
- package/dist/components/color-palette/storybook/color-palette-invalid.stories.js +90 -0
- package/dist/components/color-palette/storybook/color-palette-valid.stories.js +295 -0
- package/dist/components/color-palette/storybook/color-palette.stories.js +76 -0
- package/dist/components/tool-tip/Tooltip2.js +103 -0
- package/dist/components/tool-tip/index.js +1 -1
- package/dist/components/tool-tip/tool-tip.d.ts +1 -0
- package/dist/components/tool-tip/tool-tip.d.ts.map +1 -1
- package/dist/components/tool-tip/tool-tip.js +125 -102
- package/dist/components/tool-tip/tool-tip.stories.js +30 -0
- package/dist/index.js +6 -14
- package/dist/utils/EventEmitter.js +23 -23
- package/dist/utils/basicUtils.d.ts +2 -0
- package/dist/utils/basicUtils.d.ts.map +1 -1
- package/dist/utils/basicUtils.js +149 -23
- package/dist/utils/dragDropUtils.js +121 -0
- package/dist/utils/generateUtils.js +73 -39
- package/dist/utils/types.d.ts +1 -1
- package/dist/utils/types.d.ts.map +1 -1
- package/dist/utils/types.js +1 -0
- package/package.json +2 -3
|
@@ -1,611 +1,722 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import y from "colorsea";
|
|
7
|
-
import { parseUrl as B, copyToClipboard as F } from "../../../utils/basicUtils.js";
|
|
8
|
-
import { CanvasImage as E } from "../../canvas/canvas-image.js";
|
|
9
|
-
import { ref as f, createRef as $ } from "lit/directives/ref.js";
|
|
10
|
-
import { EventEmitter as W } from "../../../utils/EventEmitter.js";
|
|
11
|
-
import { ColorPalette as q } from "../color-palette.js";
|
|
12
|
-
var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, s = (t, i, n, a) => {
|
|
13
|
-
for (var r = a > 1 ? void 0 : a ? Y(i, n) : i, l = t.length - 1, p; l >= 0; l--)
|
|
14
|
-
(p = t[l]) && (r = (a ? p(i, n, r) : p(r)) || r);
|
|
15
|
-
return a && r && X(i, n, r), r;
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16
6
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
7
|
+
import { LitElement, html, css } from 'lit';
|
|
8
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
9
|
+
import { ArrowUpToLine, createElement, Image, Link, Pipette, Shuffle } from 'lucide';
|
|
10
|
+
import { defaultSettings, Direction } from '../color-palette-utils';
|
|
11
|
+
import { Combination, generateColors } from '../../../utils/generateUtils';
|
|
12
|
+
import colorsea from 'colorsea';
|
|
13
|
+
import { copyToClipboard, parseUrl } from '../../../utils/basicUtils';
|
|
14
|
+
import { CopyFormat, urlRegex } from '../color-palette-utils';
|
|
15
|
+
import { CanvasImage } from '../../canvas/canvas-image';
|
|
16
|
+
import { ref, createRef } from 'lit/directives/ref.js';
|
|
17
|
+
import { EventEmitter } from '../../../utils/EventEmitter';
|
|
18
|
+
import { ColorPalette } from '../color-palette';
|
|
19
|
+
var SelectedInput;
|
|
20
|
+
(function (SelectedInput) {
|
|
21
|
+
SelectedInput["Color_Picker"] = "Color Picker";
|
|
22
|
+
SelectedInput["Generate"] = "Generate";
|
|
23
|
+
SelectedInput["Image"] = "Image";
|
|
24
|
+
SelectedInput["URL"] = "URL";
|
|
25
|
+
})(SelectedInput || (SelectedInput = {}));
|
|
26
|
+
let ColorPaletteEditor = class ColorPaletteEditor extends LitElement {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
this.colors = [];
|
|
30
|
+
this.settings = {
|
|
31
|
+
height: defaultSettings.height,
|
|
32
|
+
width: defaultSettings.width,
|
|
33
|
+
direction: defaultSettings.direction,
|
|
34
|
+
gradient: defaultSettings.gradient,
|
|
35
|
+
preventHover: defaultSettings.preventHover,
|
|
36
|
+
override: defaultSettings.override,
|
|
37
|
+
aliases: []
|
|
38
|
+
};
|
|
39
|
+
this.selectedInput = SelectedInput.Color_Picker;
|
|
40
|
+
this.combination = Combination.Random;
|
|
41
|
+
this.colorPickerDisabled = false;
|
|
42
|
+
this.emitter = new EventEmitter();
|
|
43
|
+
}
|
|
44
|
+
disconnectedCallback() {
|
|
45
|
+
this.emitter.clear();
|
|
46
|
+
}
|
|
47
|
+
render() {
|
|
48
|
+
const chooseControl = () => {
|
|
49
|
+
switch (this.selectedInput) {
|
|
50
|
+
case SelectedInput.Color_Picker:
|
|
51
|
+
return this.pickerOption();
|
|
52
|
+
case SelectedInput.Generate:
|
|
53
|
+
return this.generateOption();
|
|
54
|
+
case SelectedInput.Image:
|
|
55
|
+
return this.imageOption();
|
|
56
|
+
case SelectedInput.URL:
|
|
57
|
+
return this.urlOption();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const paletteRef = (palette) => {
|
|
61
|
+
if (!(palette instanceof ColorPalette))
|
|
62
|
+
return;
|
|
63
|
+
palette.emitter.on('changed', (colors, settings) => {
|
|
64
|
+
this.colors = colors;
|
|
65
|
+
this.settings = settings;
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
return html `
|
|
69
|
+
<div id="color-palette-editor">
|
|
70
|
+
<h1>Editor</h1>
|
|
71
|
+
<section id='colors'>
|
|
72
|
+
<h3>Colors</h3>
|
|
73
|
+
<div id="control-container">
|
|
74
|
+
<button
|
|
75
|
+
title="Color Picker"
|
|
76
|
+
@click=${() => this.selectedInput = SelectedInput.Color_Picker}
|
|
77
|
+
>
|
|
78
|
+
${createElement(Pipette)}
|
|
79
|
+
</button>
|
|
80
|
+
<button
|
|
81
|
+
title="Generate"
|
|
82
|
+
@click=${() => this.selectedInput = SelectedInput.Generate}
|
|
83
|
+
>
|
|
84
|
+
${createElement(Shuffle)}
|
|
85
|
+
</button>
|
|
86
|
+
<button
|
|
87
|
+
title="Image"
|
|
88
|
+
@click=${() => this.selectedInput = SelectedInput.Image}
|
|
89
|
+
>
|
|
90
|
+
${createElement(Image)}
|
|
91
|
+
</button>
|
|
92
|
+
<button
|
|
93
|
+
title="URL"
|
|
94
|
+
@click=${() => this.selectedInput = SelectedInput.URL}
|
|
95
|
+
>
|
|
96
|
+
${createElement(Link)}
|
|
97
|
+
</button>
|
|
98
|
+
</div>
|
|
99
|
+
<div id='colors-container'>
|
|
100
|
+
${chooseControl()}
|
|
101
|
+
</div>
|
|
102
|
+
</section>
|
|
103
|
+
<section id='preview'>
|
|
104
|
+
<color-palette
|
|
105
|
+
.colors=${this.colors}
|
|
106
|
+
height=${this.settings.height}
|
|
107
|
+
width=${this.settings.width}
|
|
108
|
+
direction=${this.settings.direction}
|
|
109
|
+
?gradient=${this.settings.gradient}
|
|
110
|
+
?preventHover=${this.settings.preventHover}
|
|
111
|
+
?override=${this.settings.override}
|
|
112
|
+
.aliases=${this.settings.aliases}
|
|
113
|
+
?editMode=${true}
|
|
114
|
+
maxWidth=${560}
|
|
115
|
+
${ref(paletteRef)}
|
|
116
|
+
>
|
|
117
|
+
</color-palette>
|
|
118
|
+
</section>
|
|
119
|
+
<section id='settings'>
|
|
120
|
+
<h3>Settings</h3>
|
|
121
|
+
${this.renderSettings()}
|
|
122
|
+
<button
|
|
123
|
+
id='create-btn'
|
|
105
124
|
@click=${() => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
125
|
+
try {
|
|
126
|
+
// Generate random colors if none are provided
|
|
127
|
+
if (this.colors.length === 0)
|
|
128
|
+
this.colors = generateColors(Combination.Random).colors;
|
|
129
|
+
this.emitter.emit('submit', this.colors, this.settings);
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
// new Notice(e);
|
|
133
|
+
}
|
|
134
|
+
}}
|
|
135
|
+
>
|
|
136
|
+
Create
|
|
137
|
+
</button>
|
|
138
|
+
</section>
|
|
139
|
+
</div>
|
|
116
140
|
`;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
<setting-item
|
|
121
|
-
name='Height'
|
|
122
|
-
>
|
|
123
|
-
<input
|
|
124
|
-
type='number'
|
|
125
|
-
value=${this.settings.height}
|
|
126
|
-
step=${5}
|
|
127
|
-
@input=${(
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
>
|
|
190
|
-
</setting-item>
|
|
141
|
+
}
|
|
142
|
+
renderSettings() {
|
|
143
|
+
return html `
|
|
144
|
+
<setting-item
|
|
145
|
+
name='Height'
|
|
146
|
+
>
|
|
147
|
+
<input
|
|
148
|
+
type='number'
|
|
149
|
+
value=${this.settings.height}
|
|
150
|
+
step=${5}
|
|
151
|
+
@input=${(e) => {
|
|
152
|
+
if (!(e.target instanceof HTMLInputElement))
|
|
153
|
+
return;
|
|
154
|
+
this.settings = { ...this.settings, height: +e.target.value };
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
</setting-item>
|
|
158
|
+
<setting-item
|
|
159
|
+
name='Width'
|
|
160
|
+
description='Caution - Might cause palette to display incorrectly.'
|
|
161
|
+
>
|
|
162
|
+
<input
|
|
163
|
+
type='number'
|
|
164
|
+
value=${this.settings.width}
|
|
165
|
+
step=${10}
|
|
166
|
+
@input=${(e) => {
|
|
167
|
+
if (!(e.target instanceof HTMLInputElement))
|
|
168
|
+
return;
|
|
169
|
+
this.settings = { ...this.settings, width: +e.target.value };
|
|
170
|
+
}}
|
|
171
|
+
>
|
|
172
|
+
</setting-item>
|
|
173
|
+
<setting-item
|
|
174
|
+
name='Direction'
|
|
175
|
+
>
|
|
176
|
+
<select
|
|
177
|
+
@change=${(e) => {
|
|
178
|
+
if (!(e.target instanceof HTMLSelectElement))
|
|
179
|
+
return;
|
|
180
|
+
this.settings = { ...this.settings, direction: e.target.value };
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
${Object.values(Direction).map((val) => {
|
|
184
|
+
return html `<option ?selected=${this.settings.direction === val}>${val}</option>`;
|
|
185
|
+
})}
|
|
186
|
+
</select>
|
|
187
|
+
</setting-item>
|
|
188
|
+
<setting-item
|
|
189
|
+
name='Gradient'
|
|
190
|
+
>
|
|
191
|
+
<input
|
|
192
|
+
type='checkbox'
|
|
193
|
+
?checked=${this.settings.gradient}
|
|
194
|
+
@change=${(e) => {
|
|
195
|
+
if (!(e.target instanceof HTMLInputElement))
|
|
196
|
+
return;
|
|
197
|
+
this.settings = { ...this.settings, gradient: e.target.checked };
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
</setting-item>
|
|
201
|
+
<setting-item
|
|
202
|
+
name='Prevent Hover'
|
|
203
|
+
description='Toggles whether palettes can be hovered'
|
|
204
|
+
>
|
|
205
|
+
<input
|
|
206
|
+
type='checkbox'
|
|
207
|
+
?checked=${this.settings.preventHover}
|
|
208
|
+
@change=${(e) => {
|
|
209
|
+
if (!(e.target instanceof HTMLInputElement))
|
|
210
|
+
return;
|
|
211
|
+
this.settings = { ...this.settings, preventHover: e.target.checked };
|
|
212
|
+
}}
|
|
213
|
+
>
|
|
214
|
+
</setting-item>
|
|
215
|
+
<setting-item
|
|
216
|
+
name='Override'
|
|
217
|
+
description='Disables color validation for full control (advanced)'
|
|
218
|
+
>
|
|
219
|
+
<input
|
|
220
|
+
type='checkbox'
|
|
221
|
+
?checked=${this.settings.override}
|
|
222
|
+
@change=${(e) => {
|
|
223
|
+
if (!(e.target instanceof HTMLInputElement))
|
|
224
|
+
return;
|
|
225
|
+
this.settings = { ...this.settings, override: e.target.checked };
|
|
226
|
+
}}
|
|
227
|
+
>
|
|
228
|
+
</setting-item>
|
|
191
229
|
`;
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
<setting-item
|
|
196
|
-
name='Color Picker'
|
|
197
|
-
description='Use handpicked colors'
|
|
198
|
-
>
|
|
199
|
-
<input
|
|
200
|
-
type='color'
|
|
201
|
-
@change=${(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
230
|
+
}
|
|
231
|
+
pickerOption() {
|
|
232
|
+
return html `
|
|
233
|
+
<setting-item
|
|
234
|
+
name='Color Picker'
|
|
235
|
+
description='Use handpicked colors'
|
|
236
|
+
>
|
|
237
|
+
<input
|
|
238
|
+
type='color'
|
|
239
|
+
@change=${(e) => {
|
|
240
|
+
if (!(e.target instanceof HTMLInputElement))
|
|
241
|
+
return;
|
|
242
|
+
this.colors = [...this.colors, e.target.value];
|
|
243
|
+
this.settings.aliases.push('');
|
|
244
|
+
}}
|
|
245
|
+
>
|
|
246
|
+
</setting-item>
|
|
206
247
|
`;
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
248
|
+
}
|
|
249
|
+
generateOption() {
|
|
250
|
+
this.colorPickerDisabled = this.combination === Combination.Random;
|
|
251
|
+
return html `
|
|
252
|
+
<setting-item
|
|
253
|
+
name='Generate'
|
|
254
|
+
description='Generate colors based on color theory'
|
|
255
|
+
>
|
|
256
|
+
<select
|
|
257
|
+
@change=${(e) => {
|
|
258
|
+
if (!(e.target instanceof HTMLSelectElement))
|
|
259
|
+
return;
|
|
260
|
+
this.combination = e.target.value;
|
|
261
|
+
this.colorPickerDisabled = this.combination === Combination.Random;
|
|
262
|
+
}}
|
|
263
|
+
>
|
|
264
|
+
${Object.values(Combination).map((val) => {
|
|
265
|
+
return html `<option ?selected=${this.combination === val}>${val}</option>`;
|
|
266
|
+
})}
|
|
267
|
+
</select>
|
|
268
|
+
<input
|
|
269
|
+
type='color'
|
|
270
|
+
?disabled=${this.colorPickerDisabled}
|
|
271
|
+
@change=${(e) => {
|
|
272
|
+
if (!(e.target instanceof HTMLInputElement))
|
|
273
|
+
return;
|
|
274
|
+
this.baseColor = colorsea(e.target.value);
|
|
275
|
+
}}
|
|
276
|
+
@contextmenu=${(e) => {
|
|
277
|
+
e.preventDefault();
|
|
278
|
+
if (!(e.target instanceof HTMLInputElement))
|
|
279
|
+
return;
|
|
280
|
+
e.target.value = colorsea('#000').hex();
|
|
281
|
+
this.baseColor = undefined;
|
|
282
|
+
}}
|
|
283
|
+
>
|
|
284
|
+
<button
|
|
285
|
+
title='Loads the generated colors'
|
|
286
|
+
@click=${(e) => {
|
|
287
|
+
const generated = generateColors(this.combination, { baseColor: this.baseColor, settings: this.settings });
|
|
288
|
+
this.colors = generated.colors;
|
|
289
|
+
if (generated.settings)
|
|
290
|
+
this.settings = generated.settings;
|
|
291
|
+
}}
|
|
292
|
+
>
|
|
293
|
+
${createElement(Shuffle)}
|
|
294
|
+
</button>
|
|
295
|
+
</setting-item>
|
|
241
296
|
`;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
let
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
297
|
+
}
|
|
298
|
+
imageOption() {
|
|
299
|
+
let hex = '';
|
|
300
|
+
let urlRef = createRef();
|
|
301
|
+
let sliderRef = createRef();
|
|
302
|
+
let fileRef = createRef();
|
|
303
|
+
let fileUrl = urlRef.value?.value || '';
|
|
304
|
+
let canvasEl;
|
|
305
|
+
let tooltipRef = createRef();
|
|
306
|
+
let canvasRef = (canvas) => {
|
|
307
|
+
if (!(canvas instanceof CanvasImage))
|
|
308
|
+
return;
|
|
309
|
+
canvasEl = canvas;
|
|
310
|
+
canvas.emitter.clear();
|
|
311
|
+
canvas.emitter.on('click', async (color) => await copyToClipboard(color.toUpperCase(), CopyFormat.Raw));
|
|
312
|
+
canvas.emitter.on('move', (pos) => {
|
|
313
|
+
if (!tooltipRef.value)
|
|
314
|
+
return;
|
|
315
|
+
let tooltip = tooltipRef.value;
|
|
316
|
+
// Set tooltip text
|
|
317
|
+
tooltip.text = canvas.getCanvasHex(pos.x, pos.y).toUpperCase();
|
|
318
|
+
// Set tooltip position
|
|
319
|
+
tooltip.setClampedPosition(pos, canvas.getBoundingClientRect());
|
|
320
|
+
});
|
|
321
|
+
};
|
|
322
|
+
const getColors = async () => {
|
|
323
|
+
if (!sliderRef.value || !canvasEl)
|
|
324
|
+
return;
|
|
325
|
+
const sliderInput = sliderRef.value;
|
|
326
|
+
const canvasImage = canvasEl;
|
|
327
|
+
return await canvasImage.getPalette(+sliderInput.value);
|
|
328
|
+
};
|
|
329
|
+
const updateColors = async () => {
|
|
330
|
+
const colors = await getColors();
|
|
331
|
+
if (colors) {
|
|
332
|
+
this.colors = colors.map((color) => colorsea(color).hex(0));
|
|
333
|
+
this.settings.aliases = [];
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
const updateImagePreview = async (url) => {
|
|
337
|
+
if (!URL.canParse(url) || !canvasEl)
|
|
338
|
+
return;
|
|
339
|
+
const canvasImage = canvasEl;
|
|
340
|
+
canvasImage.updateImage(url, this.palette.getBoundingClientRect().width, this.palette.getBoundingClientRect().height);
|
|
341
|
+
await updateColors();
|
|
342
|
+
};
|
|
343
|
+
return html `
|
|
344
|
+
<setting-item
|
|
345
|
+
name='Image'
|
|
346
|
+
description='Convert image into palette'
|
|
347
|
+
>
|
|
348
|
+
<input
|
|
349
|
+
type='url'
|
|
350
|
+
placeholder='Enter URL or select file'
|
|
351
|
+
${ref(urlRef)}
|
|
352
|
+
>
|
|
353
|
+
<button
|
|
354
|
+
title='Right click to clear URL'
|
|
275
355
|
@click=${async (e) => {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
356
|
+
try {
|
|
357
|
+
if (!fileRef.value)
|
|
358
|
+
return;
|
|
359
|
+
let fileInput = fileRef.value;
|
|
360
|
+
// Check if any text is present, otherwise prompt user to select image
|
|
361
|
+
if (fileUrl !== '') {
|
|
362
|
+
// Check if URL is valid
|
|
363
|
+
if (URL.canParse(fileUrl))
|
|
364
|
+
await updateImagePreview(fileUrl);
|
|
365
|
+
else
|
|
366
|
+
throw new Error('URL provided is not valid.');
|
|
367
|
+
}
|
|
368
|
+
else
|
|
369
|
+
fileInput.click();
|
|
370
|
+
}
|
|
371
|
+
catch (e) {
|
|
372
|
+
// new Notice(e);
|
|
373
|
+
}
|
|
374
|
+
}}
|
|
286
375
|
@contextmenu=${() => {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
376
|
+
if (!urlRef.value)
|
|
377
|
+
return;
|
|
378
|
+
const urlInput = urlRef.value;
|
|
379
|
+
urlInput.value = '';
|
|
380
|
+
}}
|
|
381
|
+
>
|
|
382
|
+
${createElement(ArrowUpToLine)}
|
|
383
|
+
</button>
|
|
384
|
+
<input
|
|
385
|
+
type ='file'
|
|
386
|
+
accept = 'image/*'
|
|
297
387
|
@change=${(e) => {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
388
|
+
try {
|
|
389
|
+
const reader = new FileReader();
|
|
390
|
+
const file = e.target.files?.[0];
|
|
391
|
+
if (file)
|
|
392
|
+
reader.readAsDataURL(file);
|
|
393
|
+
reader.addEventListener('load', async () => {
|
|
394
|
+
if (typeof reader.result === 'string') {
|
|
395
|
+
fileUrl = reader.result;
|
|
396
|
+
await updateImagePreview(fileUrl);
|
|
397
|
+
}
|
|
398
|
+
});
|
|
399
|
+
reader.addEventListener('error', () => {
|
|
400
|
+
throw new Error('Error processing image');
|
|
401
|
+
});
|
|
402
|
+
}
|
|
403
|
+
catch (e) {
|
|
404
|
+
// new Notice(e);
|
|
405
|
+
}
|
|
406
|
+
}}
|
|
407
|
+
${ref(fileRef)}
|
|
408
|
+
>
|
|
409
|
+
</setting-item>
|
|
410
|
+
<setting-item
|
|
411
|
+
name='Count'
|
|
412
|
+
description='Set the number of colors to generate from the image'
|
|
413
|
+
>
|
|
414
|
+
<input
|
|
415
|
+
id='range-slider'
|
|
416
|
+
type='range'
|
|
417
|
+
min='4'
|
|
418
|
+
max='12'
|
|
419
|
+
value='8'
|
|
322
420
|
@change=${async () => {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
${
|
|
326
|
-
>
|
|
327
|
-
</setting-item>
|
|
328
|
-
<tool-tip
|
|
329
|
-
trigger='hover'
|
|
330
|
-
${
|
|
331
|
-
>
|
|
332
|
-
<canvas-image
|
|
421
|
+
await updateColors();
|
|
422
|
+
}}
|
|
423
|
+
${ref(sliderRef)}
|
|
424
|
+
>
|
|
425
|
+
</setting-item>
|
|
426
|
+
<tool-tip
|
|
427
|
+
trigger='hover'
|
|
428
|
+
${ref(tooltipRef)}
|
|
429
|
+
>
|
|
430
|
+
<canvas-image
|
|
333
431
|
@mousemove=${(e) => {
|
|
334
|
-
|
|
335
|
-
|
|
432
|
+
if (!(e.target instanceof CanvasImage))
|
|
433
|
+
return;
|
|
434
|
+
hex = e.target.getCanvasHex(e.clientX, e.clientY);
|
|
435
|
+
}}
|
|
336
436
|
@click=${(e) => {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
437
|
+
if (!hex)
|
|
438
|
+
return;
|
|
439
|
+
this.colors = [...this.colors, hex];
|
|
440
|
+
this.settings.aliases = [...this.settings.aliases, ''];
|
|
441
|
+
}}
|
|
442
|
+
${ref(canvasRef)}
|
|
443
|
+
>
|
|
444
|
+
</canvas-image>
|
|
445
|
+
</tool-tip>
|
|
343
446
|
`;
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
<setting-item
|
|
349
|
-
name='URL'
|
|
350
|
-
description='Only coolors.co & colorhunt.co are currently supported'
|
|
351
|
-
>
|
|
352
|
-
<input
|
|
353
|
-
type='url'
|
|
354
|
-
placeholder='Enter URL'
|
|
355
|
-
@change=${(
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
447
|
+
}
|
|
448
|
+
urlOption() {
|
|
449
|
+
let input;
|
|
450
|
+
return html `
|
|
451
|
+
<setting-item
|
|
452
|
+
name='URL'
|
|
453
|
+
description='Only coolors.co & colorhunt.co are currently supported'
|
|
454
|
+
>
|
|
455
|
+
<input
|
|
456
|
+
type='url'
|
|
457
|
+
placeholder='Enter URL'
|
|
458
|
+
@change=${(e) => {
|
|
459
|
+
if (!(e.target instanceof HTMLInputElement))
|
|
460
|
+
return;
|
|
461
|
+
input = e.target;
|
|
462
|
+
}}
|
|
463
|
+
>
|
|
464
|
+
<button
|
|
465
|
+
title='Right click to clear URL'
|
|
466
|
+
@click=${(e) => {
|
|
467
|
+
try {
|
|
468
|
+
if (!input.value.match(urlRegex))
|
|
469
|
+
throw new Error('URL provided is not valid.');
|
|
470
|
+
this.colors = parseUrl(input.value);
|
|
471
|
+
this.settings.aliases = [];
|
|
472
|
+
}
|
|
473
|
+
catch (e) {
|
|
474
|
+
// new Notice(e)
|
|
475
|
+
}
|
|
476
|
+
}}
|
|
477
|
+
@contextmenu=${(e) => {
|
|
478
|
+
e.preventDefault();
|
|
479
|
+
if (input)
|
|
480
|
+
input.value = '';
|
|
481
|
+
}}
|
|
482
|
+
>
|
|
483
|
+
${createElement(Link)}
|
|
484
|
+
</button>
|
|
485
|
+
</setting-item>
|
|
375
486
|
`;
|
|
376
|
-
|
|
487
|
+
}
|
|
377
488
|
};
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
:host {
|
|
381
|
-
display: block;
|
|
382
|
-
contain: content;
|
|
383
|
-
width: 560px;
|
|
384
|
-
padding: 16px;
|
|
385
|
-
background-color: rgb(27, 27, 27);
|
|
386
|
-
color: rgba(245, 245, 245, .9);
|
|
387
|
-
border-radius: 5px;
|
|
388
|
-
|
|
389
|
-
--cta-background: hsl(262, 83%, 69%);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
input[type='file'] {
|
|
393
|
-
display: none;
|
|
394
|
-
}
|
|
395
|
-
|
|
396
|
-
:host([selectedInput="Color Picker"]) {
|
|
397
|
-
#color-palette-editor #colors {
|
|
398
|
-
div:nth-of-type(1) {
|
|
399
|
-
button[title="Color Picker"] {
|
|
400
|
-
background-color: var(--cta-background);
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
div:nth-of-type(2) {
|
|
404
|
-
canvas {
|
|
405
|
-
max-width: 100%;
|
|
406
|
-
max-height: fit-content;
|
|
407
|
-
object-fit: cover;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
:host([selectedInput="Generate"]) {
|
|
414
|
-
#color-palette-editor #colors div {
|
|
415
|
-
button[title="Generate"] {
|
|
416
|
-
background-color: var(--cta-background);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
:host([selectedInput="Image"]) {
|
|
422
|
-
#color-palette-editor #colors div {
|
|
423
|
-
button[title="Image"] {
|
|
424
|
-
background-color: var(--cta-background);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
:host([selectedInput="URL"]) {
|
|
430
|
-
#color-palette-editor #colors div {
|
|
431
|
-
button[title="URL"] {
|
|
432
|
-
background-color: var(--cta-background);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
#color-palette-editor {
|
|
438
|
-
display: flex;
|
|
439
|
-
flex-direction: column;
|
|
440
|
-
gap: .5rem;
|
|
441
|
-
|
|
442
|
-
h1 {
|
|
443
|
-
font-size: 2.25rem;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
button {
|
|
447
|
-
cursor: pointer;
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
#colors {
|
|
451
|
-
div {
|
|
452
|
-
input:not([type='color']) {
|
|
453
|
-
color: rgb(245, 245, 245);
|
|
454
|
-
background-color: rgb(38, 38, 38);
|
|
455
|
-
border: none;
|
|
456
|
-
border-radius: 5px;
|
|
457
|
-
height: fit-content;
|
|
458
|
-
width: fit-content;
|
|
459
|
-
padding: .5rem;
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
select {
|
|
463
|
-
color: rgb(245, 245, 245);
|
|
464
|
-
background-color: rgb(38, 38, 38);
|
|
465
|
-
border: none;
|
|
466
|
-
border-radius: 5px;
|
|
467
|
-
height: fit-content;
|
|
468
|
-
width: fit-content;
|
|
469
|
-
padding: .5rem;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
button {
|
|
473
|
-
color: rgb(245, 245, 245);
|
|
474
|
-
background-color: rgb(38, 38, 38);
|
|
475
|
-
border: none;
|
|
476
|
-
border-radius: 5px;
|
|
477
|
-
height: fit-content;
|
|
478
|
-
width: fit-content;
|
|
479
|
-
padding: 4px 12px;
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
#settings {
|
|
485
|
-
display: flex;
|
|
486
|
-
flex-direction: column;
|
|
487
|
-
|
|
488
|
-
input {
|
|
489
|
-
color: rgb(245, 245, 245);
|
|
490
|
-
background-color: rgb(38, 38, 38);
|
|
491
|
-
border: none;
|
|
492
|
-
border-radius: 5px;
|
|
493
|
-
height: fit-content;
|
|
494
|
-
width: fit-content;
|
|
495
|
-
padding: .5rem;
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
select {
|
|
499
|
-
color: rgb(245, 245, 245);
|
|
500
|
-
background-color: rgb(38, 38, 38);
|
|
501
|
-
border: none;
|
|
502
|
-
border-radius: 5px;
|
|
503
|
-
height: fit-content;
|
|
504
|
-
width: fit-content;
|
|
505
|
-
padding: .5rem;
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
#create-btn {
|
|
509
|
-
background-color: var(--cta-background);
|
|
510
|
-
color: white;
|
|
511
|
-
border-radius: 5px;
|
|
512
|
-
padding: 4px 12px;
|
|
513
|
-
user-select: none;
|
|
514
|
-
border: none;
|
|
515
|
-
width: fit-content;
|
|
516
|
-
align-self: flex-end;
|
|
517
|
-
|
|
518
|
-
&:hover {
|
|
519
|
-
background-color: hsl(calc( 262 - 3), calc( 83% * 1.02), calc( 69% * 1.15));
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
|
|
489
|
+
ColorPaletteEditor.styles = [
|
|
490
|
+
css `
|
|
491
|
+
:host {
|
|
492
|
+
display: block;
|
|
493
|
+
contain: content;
|
|
494
|
+
width: 560px;
|
|
495
|
+
padding: 16px;
|
|
496
|
+
background-color: rgb(27, 27, 27);
|
|
497
|
+
color: rgba(245, 245, 245, .9);
|
|
498
|
+
border-radius: 5px;
|
|
499
|
+
|
|
500
|
+
--cta-background: hsl(262, 83%, 69%);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
input[type='file'] {
|
|
504
|
+
display: none;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
:host([selectedInput="Color Picker"]) {
|
|
508
|
+
#color-palette-editor #colors {
|
|
509
|
+
div:nth-of-type(1) {
|
|
510
|
+
button[title="Color Picker"] {
|
|
511
|
+
background-color: var(--cta-background);
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
div:nth-of-type(2) {
|
|
515
|
+
canvas {
|
|
516
|
+
max-width: 100%;
|
|
517
|
+
max-height: fit-content;
|
|
518
|
+
object-fit: cover;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
:host([selectedInput="Generate"]) {
|
|
525
|
+
#color-palette-editor #colors div {
|
|
526
|
+
button[title="Generate"] {
|
|
527
|
+
background-color: var(--cta-background);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
:host([selectedInput="Image"]) {
|
|
533
|
+
#color-palette-editor #colors div {
|
|
534
|
+
button[title="Image"] {
|
|
535
|
+
background-color: var(--cta-background);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
:host([selectedInput="URL"]) {
|
|
541
|
+
#color-palette-editor #colors div {
|
|
542
|
+
button[title="URL"] {
|
|
543
|
+
background-color: var(--cta-background);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
#color-palette-editor {
|
|
549
|
+
display: flex;
|
|
550
|
+
flex-direction: column;
|
|
551
|
+
gap: .5rem;
|
|
552
|
+
|
|
553
|
+
h1 {
|
|
554
|
+
font-size: 2.25rem;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
button {
|
|
558
|
+
cursor: pointer;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
#colors {
|
|
562
|
+
div {
|
|
563
|
+
input:not([type='color']) {
|
|
564
|
+
color: rgb(245, 245, 245);
|
|
565
|
+
background-color: rgb(38, 38, 38);
|
|
566
|
+
border: none;
|
|
567
|
+
border-radius: 5px;
|
|
568
|
+
height: fit-content;
|
|
569
|
+
width: fit-content;
|
|
570
|
+
padding: .5rem;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
select {
|
|
574
|
+
color: rgb(245, 245, 245);
|
|
575
|
+
background-color: rgb(38, 38, 38);
|
|
576
|
+
border: none;
|
|
577
|
+
border-radius: 5px;
|
|
578
|
+
height: fit-content;
|
|
579
|
+
width: fit-content;
|
|
580
|
+
padding: .5rem;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
button {
|
|
584
|
+
color: rgb(245, 245, 245);
|
|
585
|
+
background-color: rgb(38, 38, 38);
|
|
586
|
+
border: none;
|
|
587
|
+
border-radius: 5px;
|
|
588
|
+
height: fit-content;
|
|
589
|
+
width: fit-content;
|
|
590
|
+
padding: 4px 12px;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
#settings {
|
|
596
|
+
display: flex;
|
|
597
|
+
flex-direction: column;
|
|
598
|
+
|
|
599
|
+
input {
|
|
600
|
+
color: rgb(245, 245, 245);
|
|
601
|
+
background-color: rgb(38, 38, 38);
|
|
602
|
+
border: none;
|
|
603
|
+
border-radius: 5px;
|
|
604
|
+
height: fit-content;
|
|
605
|
+
width: fit-content;
|
|
606
|
+
padding: .5rem;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
select {
|
|
610
|
+
color: rgb(245, 245, 245);
|
|
611
|
+
background-color: rgb(38, 38, 38);
|
|
612
|
+
border: none;
|
|
613
|
+
border-radius: 5px;
|
|
614
|
+
height: fit-content;
|
|
615
|
+
width: fit-content;
|
|
616
|
+
padding: .5rem;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
#create-btn {
|
|
620
|
+
background-color: var(--cta-background);
|
|
621
|
+
color: white;
|
|
622
|
+
border-radius: 5px;
|
|
623
|
+
padding: 4px 12px;
|
|
624
|
+
user-select: none;
|
|
625
|
+
border: none;
|
|
626
|
+
width: fit-content;
|
|
627
|
+
align-self: flex-end;
|
|
628
|
+
|
|
629
|
+
&:hover {
|
|
630
|
+
background-color: hsl(calc( 262 - 3), calc( 83% * 1.02), calc( 69% * 1.15));
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
`,
|
|
525
636
|
];
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
],
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
],
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
],
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
],
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
],
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
],
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
],
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
],
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
637
|
+
__decorate([
|
|
638
|
+
query('#color-palette-editor')
|
|
639
|
+
], ColorPaletteEditor.prototype, "palette", void 0);
|
|
640
|
+
__decorate([
|
|
641
|
+
property({ type: Array })
|
|
642
|
+
], ColorPaletteEditor.prototype, "colors", void 0);
|
|
643
|
+
__decorate([
|
|
644
|
+
property({ type: Object })
|
|
645
|
+
], ColorPaletteEditor.prototype, "settings", void 0);
|
|
646
|
+
__decorate([
|
|
647
|
+
property({ type: String, reflect: true })
|
|
648
|
+
], ColorPaletteEditor.prototype, "selectedInput", void 0);
|
|
649
|
+
__decorate([
|
|
650
|
+
property({ type: String })
|
|
651
|
+
], ColorPaletteEditor.prototype, "combination", void 0);
|
|
652
|
+
__decorate([
|
|
653
|
+
property({ type: Object })
|
|
654
|
+
], ColorPaletteEditor.prototype, "baseColor", void 0);
|
|
655
|
+
__decorate([
|
|
656
|
+
state()
|
|
657
|
+
], ColorPaletteEditor.prototype, "colorPickerDisabled", void 0);
|
|
658
|
+
ColorPaletteEditor = __decorate([
|
|
659
|
+
customElement('color-palette-editor')
|
|
660
|
+
], ColorPaletteEditor);
|
|
661
|
+
export { ColorPaletteEditor };
|
|
662
|
+
let SettingItem = class SettingItem extends LitElement {
|
|
663
|
+
constructor() {
|
|
664
|
+
super(...arguments);
|
|
665
|
+
this.name = '';
|
|
666
|
+
this.description = '';
|
|
667
|
+
}
|
|
668
|
+
render() {
|
|
669
|
+
return html `
|
|
670
|
+
<div>
|
|
671
|
+
<h3>${this.name}</h3>
|
|
672
|
+
<p>${this.description}</p>
|
|
673
|
+
</div>
|
|
674
|
+
<slot></slot>
|
|
561
675
|
`;
|
|
562
|
-
|
|
676
|
+
}
|
|
563
677
|
};
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
:host {
|
|
567
|
-
display: grid;
|
|
568
|
-
grid-template-columns: 1fr 1fr;
|
|
569
|
-
padding-block: 2%;
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
:host(:not([description])) p {
|
|
573
|
-
display: none;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
h3 {
|
|
577
|
-
margin: 0;
|
|
578
|
-
font-size: 15px;
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
p {
|
|
582
|
-
margin: 0;
|
|
583
|
-
padding-top: 4px;
|
|
584
|
-
font-size: 12px;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
slot {
|
|
588
|
-
display: flex;
|
|
589
|
-
justify-self: flex-end;
|
|
590
|
-
align-items: center;
|
|
591
|
-
gap: 5%;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
::slotted(input[type="color"]) {
|
|
595
|
-
border: none;
|
|
596
|
-
}
|
|
678
|
+
SettingItem.styles = [
|
|
679
|
+
css `
|
|
680
|
+
:host {
|
|
681
|
+
display: grid;
|
|
682
|
+
grid-template-columns: 1fr 1fr;
|
|
683
|
+
padding-block: 2%;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
:host(:not([description])) p {
|
|
687
|
+
display: none;
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
h3 {
|
|
691
|
+
margin: 0;
|
|
692
|
+
font-size: 15px;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
p {
|
|
696
|
+
margin: 0;
|
|
697
|
+
padding-top: 4px;
|
|
698
|
+
font-size: 12px;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
slot {
|
|
702
|
+
display: flex;
|
|
703
|
+
justify-self: flex-end;
|
|
704
|
+
align-items: center;
|
|
705
|
+
gap: 5%;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
::slotted(input[type="color"]) {
|
|
709
|
+
border: none;
|
|
710
|
+
}
|
|
597
711
|
`
|
|
598
712
|
];
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
],
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
],
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
],
|
|
608
|
-
export {
|
|
609
|
-
c as ColorPaletteEditor,
|
|
610
|
-
v as SettingItem
|
|
611
|
-
};
|
|
713
|
+
__decorate([
|
|
714
|
+
property({ type: String })
|
|
715
|
+
], SettingItem.prototype, "name", void 0);
|
|
716
|
+
__decorate([
|
|
717
|
+
property({ type: String })
|
|
718
|
+
], SettingItem.prototype, "description", void 0);
|
|
719
|
+
SettingItem = __decorate([
|
|
720
|
+
customElement('setting-item')
|
|
721
|
+
], SettingItem);
|
|
722
|
+
export { SettingItem };
|