@alegendstale/holly-components 2.0.2 → 2.0.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.
- package/dist/components/absolute-container/absolute-container.js +79 -113
- package/dist/components/absolute-container/absolute-container.styles.js +20 -17
- package/dist/components/bottom-sheet/bottom-sheet.js +189 -319
- package/dist/components/bottom-sheet/bottom-sheet.styles.js +117 -114
- package/dist/components/canvas/canvas-base.d.ts +4 -1
- package/dist/components/canvas/canvas-base.d.ts.map +1 -1
- package/dist/components/canvas/canvas-base.js +51 -67
- package/dist/components/canvas/canvas-gradient.js +44 -69
- package/dist/components/canvas/canvas-image.js +112 -177
- package/dist/components/canvas/canvas-image.styles.js +23 -20
- package/dist/components/carousel-scroller/carousel-scroller.js +63 -87
- package/dist/components/carousel-scroller/carousel-scroller.styles.js +68 -65
- package/dist/components/color-palette/color-palette-utils.js +55 -104
- package/dist/components/color-palette/color-palette.js +250 -384
- package/dist/components/color-palette/color-palette.styles.js +92 -89
- package/dist/components/color-palette/component/color-palette-component.js +134 -188
- package/dist/components/color-palette/component/color-palette-component.styles.js +12 -9
- package/dist/components/color-palette/editor/color-palette-editor.js +413 -539
- package/dist/components/color-palette/editor/color-palette-editor.styles.js +149 -146
- package/dist/components/color-palette/editor/settings-item.js +32 -40
- package/dist/components/color-palette/editor/settings-item.styles.js +36 -33
- package/dist/components/color-palette/item/color-palette-item-edit.js +50 -84
- package/dist/components/color-palette/item/color-palette-item-edit.styles.js +53 -50
- package/dist/components/color-palette/item/color-palette-item.js +72 -107
- package/dist/components/color-palette/item/color-palette-item.styles.js +85 -82
- package/dist/components/color-palette/menu/color-palette-menu.js +162 -200
- package/dist/components/color-palette/menu/color-palette-menu.styles.js +51 -48
- package/dist/components/color-palette/menu/color-palette-reorder.js +76 -95
- package/dist/components/color-palette/menu/color-palette-reorder.styles.js +33 -30
- package/dist/components/draw-svg/draw-svg.js +35 -52
- package/dist/components/draw-svg/draw-svg.styles.js +41 -38
- package/dist/components/responsive-svg/responsive-svg.d.ts +2 -2
- package/dist/components/responsive-svg/responsive-svg.d.ts.map +1 -1
- package/dist/components/responsive-svg/responsive-svg.js +122 -174
- package/dist/components/responsive-svg/responsive-svg.styles.js +48 -45
- package/dist/components/tool-tip/tool-tip.d.ts +5 -1
- package/dist/components/tool-tip/tool-tip.d.ts.map +1 -1
- package/dist/components/tool-tip/tool-tip.js +64 -100
- package/dist/components/tool-tip/tool-tip.styles.js +60 -57
- package/dist/decorators/condCustomElement.js +8 -11
- package/dist/utils/EventEmitter.js +23 -23
- package/dist/utils/ResponsiveController.js +15 -18
- package/dist/utils/basicUtils.js +98 -146
- package/dist/utils/colorsea-wrapper.js +162 -166
- package/dist/utils/dragDropUtils.js +75 -119
- package/dist/utils/generateUtils.js +39 -73
- package/package.json +34 -64
- package/dist/components/absolute-container/absolute-container.stories.d.ts +0 -11
- package/dist/components/absolute-container/absolute-container.stories.d.ts.map +0 -1
- package/dist/components/absolute-container/absolute-container.stories.js +0 -64
- package/dist/components/absolute-container/index.d.ts +0 -2
- package/dist/components/absolute-container/index.d.ts.map +0 -1
- package/dist/components/absolute-container/index.js +0 -1
- package/dist/components/bottom-sheet/bottom-sheet.stories.d.ts +0 -17
- package/dist/components/bottom-sheet/bottom-sheet.stories.d.ts.map +0 -1
- package/dist/components/bottom-sheet/bottom-sheet.stories.js +0 -67
- package/dist/components/bottom-sheet/index.d.ts +0 -2
- package/dist/components/bottom-sheet/index.d.ts.map +0 -1
- package/dist/components/bottom-sheet/index.js +0 -1
- package/dist/components/canvas/canvas-base.stories.d.ts +0 -7
- package/dist/components/canvas/canvas-base.stories.d.ts.map +0 -1
- package/dist/components/canvas/canvas-base.stories.js +0 -24
- package/dist/components/canvas/canvas-gradient.stories.d.ts +0 -14
- package/dist/components/canvas/canvas-gradient.stories.d.ts.map +0 -1
- package/dist/components/canvas/canvas-gradient.stories.js +0 -46
- package/dist/components/canvas/canvas-image.stories.d.ts +0 -13
- package/dist/components/canvas/canvas-image.stories.d.ts.map +0 -1
- package/dist/components/canvas/canvas-image.stories.js +0 -49
- package/dist/components/canvas/index.d.ts +0 -3
- package/dist/components/canvas/index.d.ts.map +0 -1
- package/dist/components/canvas/index.js +0 -2
- package/dist/components/carousel-scroller/carousel-scroller.stories.d.ts +0 -13
- package/dist/components/carousel-scroller/carousel-scroller.stories.d.ts.map +0 -1
- package/dist/components/carousel-scroller/carousel-scroller.stories.js +0 -56
- package/dist/components/carousel-scroller/index.d.ts +0 -2
- package/dist/components/carousel-scroller/index.d.ts.map +0 -1
- package/dist/components/carousel-scroller/index.js +0 -1
- package/dist/components/color-palette/component/color-palette-component.stories.d.ts +0 -13
- package/dist/components/color-palette/component/color-palette-component.stories.d.ts.map +0 -1
- package/dist/components/color-palette/component/color-palette-component.stories.js +0 -75
- package/dist/components/color-palette/component/index.d.ts +0 -2
- package/dist/components/color-palette/component/index.d.ts.map +0 -1
- package/dist/components/color-palette/component/index.js +0 -1
- package/dist/components/color-palette/editor/color-palette-editor.stories.d.ts +0 -18
- package/dist/components/color-palette/editor/color-palette-editor.stories.d.ts.map +0 -1
- package/dist/components/color-palette/editor/color-palette-editor.stories.js +0 -67
- package/dist/components/color-palette/editor/index.d.ts +0 -2
- package/dist/components/color-palette/editor/index.d.ts.map +0 -1
- package/dist/components/color-palette/editor/index.js +0 -1
- package/dist/components/color-palette/index.d.ts +0 -6
- package/dist/components/color-palette/index.d.ts.map +0 -1
- package/dist/components/color-palette/index.js +0 -5
- package/dist/components/color-palette/item/index.d.ts +0 -3
- package/dist/components/color-palette/item/index.d.ts.map +0 -1
- package/dist/components/color-palette/item/index.js +0 -2
- package/dist/components/color-palette/menu/index.d.ts +0 -3
- package/dist/components/color-palette/menu/index.d.ts.map +0 -1
- package/dist/components/color-palette/menu/index.js +0 -2
- package/dist/components/color-palette/storybook/color-palette-invalid.stories.d.ts +0 -33
- package/dist/components/color-palette/storybook/color-palette-invalid.stories.d.ts.map +0 -1
- package/dist/components/color-palette/storybook/color-palette-invalid.stories.js +0 -62
- package/dist/components/color-palette/storybook/color-palette-valid.stories.d.ts +0 -52
- package/dist/components/color-palette/storybook/color-palette-valid.stories.d.ts.map +0 -1
- package/dist/components/color-palette/storybook/color-palette-valid.stories.js +0 -268
- package/dist/components/color-palette/storybook/color-palette.stories.d.ts +0 -27
- package/dist/components/color-palette/storybook/color-palette.stories.d.ts.map +0 -1
- package/dist/components/color-palette/storybook/color-palette.stories.js +0 -129
- package/dist/components/draw-svg/draw-svg.stories.d.ts +0 -7
- package/dist/components/draw-svg/draw-svg.stories.d.ts.map +0 -1
- package/dist/components/draw-svg/draw-svg.stories.js +0 -61
- package/dist/components/draw-svg/index.d.ts +0 -2
- package/dist/components/draw-svg/index.d.ts.map +0 -1
- package/dist/components/draw-svg/index.js +0 -1
- package/dist/components/responsive-svg/index.d.ts +0 -2
- package/dist/components/responsive-svg/index.d.ts.map +0 -1
- package/dist/components/responsive-svg/index.js +0 -1
- package/dist/components/responsive-svg/responsive-svg.stories.d.ts +0 -26
- package/dist/components/responsive-svg/responsive-svg.stories.d.ts.map +0 -1
- package/dist/components/responsive-svg/responsive-svg.stories.js +0 -194
- package/dist/components/tool-tip/index.d.ts +0 -2
- package/dist/components/tool-tip/index.d.ts.map +0 -1
- package/dist/components/tool-tip/index.js +0 -1
- package/dist/components/tool-tip/tool-tip.stories.d.ts +0 -16
- package/dist/components/tool-tip/tool-tip.stories.d.ts.map +0 -1
- package/dist/components/tool-tip/tool-tip.stories.js +0 -62
- package/dist/decorators/index.d.ts +0 -2
- package/dist/decorators/index.d.ts.map +0 -1
- package/dist/decorators/index.js +0 -1
- package/dist/index.d.ts +0 -11
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -10
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -4
- package/dist/utils/types.d.ts +0 -5
- package/dist/utils/types.d.ts.map +0 -1
- package/dist/utils/types.js +0 -1
|
@@ -1,553 +1,427 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
</button>
|
|
109
|
-
<button
|
|
110
|
-
title="URL"
|
|
111
|
-
@click=${() => this.selectedInput = SelectedInput.URL}
|
|
112
|
-
>
|
|
113
|
-
${createElement(Link)}
|
|
114
|
-
</button>
|
|
115
|
-
</div>
|
|
116
|
-
<div id='colors-container'>
|
|
117
|
-
${chooseControl()}
|
|
118
|
-
</div>
|
|
119
|
-
</section>
|
|
120
|
-
<section id='preview'>
|
|
121
|
-
<color-palette
|
|
122
|
-
.colors=${this.colors}
|
|
123
|
-
height=${this.settings.height}
|
|
124
|
-
width=${this.settings.width}
|
|
125
|
-
direction=${this.settings.direction}
|
|
126
|
-
?gradient=${this.settings.gradient}
|
|
127
|
-
?preventHover=${this.settings.preventHover}
|
|
128
|
-
?hideText=${this.settings.hideText}
|
|
129
|
-
?override=${this.settings.override}
|
|
130
|
-
.aliases=${this.settings.aliases}
|
|
131
|
-
?editMode=${true}
|
|
132
|
-
maxWidth=${560}
|
|
133
|
-
${ref(paletteRef)}
|
|
134
|
-
>
|
|
135
|
-
</color-palette>
|
|
136
|
-
</section>
|
|
137
|
-
<section id='settings'>
|
|
138
|
-
<h3>Settings</h3>
|
|
139
|
-
${this.renderSettings()}
|
|
140
|
-
<button
|
|
141
|
-
id='create-btn'
|
|
1
|
+
import { LitElement as x, html as l } from "lit";
|
|
2
|
+
import { query as P, property as v, state as H, customElement as T } from "lit/decorators.js";
|
|
3
|
+
import { createElement as p, Pipette as U, Shuffle as C, Image as O, Link as R, ArrowUpToLine as D } from "lucide";
|
|
4
|
+
import { defaultSettings as u, Direction as M, urlRegex as G, CopyFormat as S } from "../color-palette-utils.js";
|
|
5
|
+
import { Combination as f, generateColors as L } from "../../../utils/generateUtils.js";
|
|
6
|
+
import b from "../../../utils/colorsea-wrapper.js";
|
|
7
|
+
import { parseUrl as _, copyToClipboard as j } from "../../../utils/basicUtils.js";
|
|
8
|
+
import { CanvasImage as w } from "../../canvas/canvas-image.js";
|
|
9
|
+
import { ref as m, createRef as $ } from "lit/directives/ref.js";
|
|
10
|
+
import { EventEmitter as A } from "../../../utils/EventEmitter.js";
|
|
11
|
+
import { ColorPalette as B } from "../color-palette.js";
|
|
12
|
+
import F from "./color-palette-editor.styles.js";
|
|
13
|
+
var W = Object.defineProperty, q = Object.getOwnPropertyDescriptor, g = (t, n, s, o) => {
|
|
14
|
+
for (var r = o > 1 ? void 0 : o ? q(n, s) : n, c = t.length - 1, h; c >= 0; c--)
|
|
15
|
+
(h = t[c]) && (r = (o ? h(n, s, r) : h(r)) || r);
|
|
16
|
+
return o && r && W(n, s, r), r;
|
|
17
|
+
}, X = /* @__PURE__ */ ((t) => (t.Color_Picker = "Color Picker", t.Generate = "Generate", t.Image = "Image", t.URL = "URL", t))(X || {});
|
|
18
|
+
let a = class extends x {
|
|
19
|
+
constructor() {
|
|
20
|
+
super(...arguments), this.colors = [], this.settings = {
|
|
21
|
+
height: u.height,
|
|
22
|
+
width: u.width,
|
|
23
|
+
direction: u.direction,
|
|
24
|
+
gradient: u.gradient,
|
|
25
|
+
preventHover: u.preventHover,
|
|
26
|
+
hideText: u.hideText,
|
|
27
|
+
override: u.override,
|
|
28
|
+
aliases: []
|
|
29
|
+
}, this.selectedInput = "Color Picker", this.combination = f.Random, this.colorPickerDisabled = !1, this.emitter = new A();
|
|
30
|
+
}
|
|
31
|
+
disconnectedCallback() {
|
|
32
|
+
this.emitter.clear();
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
const t = () => {
|
|
36
|
+
switch (this.selectedInput) {
|
|
37
|
+
case "Color Picker":
|
|
38
|
+
return this.pickerOption();
|
|
39
|
+
case "Generate":
|
|
40
|
+
return this.generateOption();
|
|
41
|
+
case "Image":
|
|
42
|
+
return this.imageOption();
|
|
43
|
+
case "URL":
|
|
44
|
+
return this.urlOption();
|
|
45
|
+
}
|
|
46
|
+
}, n = (s) => {
|
|
47
|
+
s instanceof B && s.emitter.on("changed", (o, r) => {
|
|
48
|
+
this.colors = o, this.settings = r;
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
return l`
|
|
52
|
+
<div id="color-palette-editor">
|
|
53
|
+
<h1>Editor</h1>
|
|
54
|
+
<section id='colors'>
|
|
55
|
+
<h3>Colors</h3>
|
|
56
|
+
<div id="control-container">
|
|
57
|
+
<button
|
|
58
|
+
title="Color Picker"
|
|
59
|
+
@click=${() => this.selectedInput = "Color Picker"}
|
|
60
|
+
>
|
|
61
|
+
${p(U)}
|
|
62
|
+
</button>
|
|
63
|
+
<button
|
|
64
|
+
title="Generate"
|
|
65
|
+
@click=${() => this.selectedInput = "Generate"}
|
|
66
|
+
>
|
|
67
|
+
${p(C)}
|
|
68
|
+
</button>
|
|
69
|
+
<button
|
|
70
|
+
title="Image"
|
|
71
|
+
@click=${() => this.selectedInput = "Image"}
|
|
72
|
+
>
|
|
73
|
+
${p(O)}
|
|
74
|
+
</button>
|
|
75
|
+
<button
|
|
76
|
+
title="URL"
|
|
77
|
+
@click=${() => this.selectedInput = "URL"}
|
|
78
|
+
>
|
|
79
|
+
${p(R)}
|
|
80
|
+
</button>
|
|
81
|
+
</div>
|
|
82
|
+
<div id='colors-container'>
|
|
83
|
+
${t()}
|
|
84
|
+
</div>
|
|
85
|
+
</section>
|
|
86
|
+
<section id='preview'>
|
|
87
|
+
<color-palette
|
|
88
|
+
.colors=${this.colors}
|
|
89
|
+
height=${this.settings.height}
|
|
90
|
+
width=${this.settings.width}
|
|
91
|
+
direction=${this.settings.direction}
|
|
92
|
+
?gradient=${this.settings.gradient}
|
|
93
|
+
?preventHover=${this.settings.preventHover}
|
|
94
|
+
?hideText=${this.settings.hideText}
|
|
95
|
+
?override=${this.settings.override}
|
|
96
|
+
.aliases=${this.settings.aliases}
|
|
97
|
+
?editMode=${!0}
|
|
98
|
+
maxWidth=${560}
|
|
99
|
+
${m(n)}
|
|
100
|
+
>
|
|
101
|
+
</color-palette>
|
|
102
|
+
</section>
|
|
103
|
+
<section id='settings'>
|
|
104
|
+
<h3>Settings</h3>
|
|
105
|
+
${this.renderSettings()}
|
|
106
|
+
<button
|
|
107
|
+
id='create-btn'
|
|
142
108
|
@click=${() => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
>
|
|
154
|
-
Create
|
|
155
|
-
</button>
|
|
156
|
-
</section>
|
|
157
|
-
</div>
|
|
109
|
+
try {
|
|
110
|
+
this.colors.length === 0 && (this.colors = L(f.Random).colors), this.emitter.emit("submit", this.colors, this.settings);
|
|
111
|
+
} catch {
|
|
112
|
+
}
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
Create
|
|
116
|
+
</button>
|
|
117
|
+
</section>
|
|
118
|
+
</div>
|
|
158
119
|
`;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
<setting-item
|
|
164
|
-
name='Height'
|
|
165
|
-
>
|
|
166
|
-
<input
|
|
167
|
-
type='number'
|
|
168
|
-
value=${this.settings.height}
|
|
169
|
-
step=${5}
|
|
170
|
-
@input=${(
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
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
|
-
</setting-item>
|
|
234
|
-
<setting-item
|
|
235
|
-
name='
|
|
236
|
-
description='Disables color
|
|
237
|
-
>
|
|
238
|
-
<input
|
|
239
|
-
type='checkbox'
|
|
240
|
-
?checked=${this.settings.
|
|
241
|
-
@change=${(
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
>
|
|
247
|
-
</setting-item>
|
|
248
|
-
<setting-item
|
|
249
|
-
name='Override'
|
|
250
|
-
description='Disables color validation for full control (advanced)'
|
|
251
|
-
>
|
|
252
|
-
<input
|
|
253
|
-
type='checkbox'
|
|
254
|
-
?checked=${this.settings.override}
|
|
255
|
-
@change=${(e) => {
|
|
256
|
-
if (!(e.target instanceof HTMLInputElement))
|
|
257
|
-
return;
|
|
258
|
-
this.settings = { ...this.settings, override: e.target.checked };
|
|
259
|
-
}}
|
|
260
|
-
>
|
|
261
|
-
</setting-item>
|
|
120
|
+
}
|
|
121
|
+
/** Renders the settings fields. */
|
|
122
|
+
renderSettings() {
|
|
123
|
+
return l`
|
|
124
|
+
<setting-item
|
|
125
|
+
name='Height'
|
|
126
|
+
>
|
|
127
|
+
<input
|
|
128
|
+
type='number'
|
|
129
|
+
value=${this.settings.height}
|
|
130
|
+
step=${5}
|
|
131
|
+
@input=${(t) => {
|
|
132
|
+
t.target instanceof HTMLInputElement && (this.settings = { ...this.settings, height: +t.target.value });
|
|
133
|
+
}}
|
|
134
|
+
>
|
|
135
|
+
</setting-item>
|
|
136
|
+
<setting-item
|
|
137
|
+
name='Width'
|
|
138
|
+
description='Caution - Might cause palette to display incorrectly.'
|
|
139
|
+
>
|
|
140
|
+
<input
|
|
141
|
+
type='number'
|
|
142
|
+
value=${this.settings.width}
|
|
143
|
+
step=${10}
|
|
144
|
+
@input=${(t) => {
|
|
145
|
+
t.target instanceof HTMLInputElement && (this.settings = { ...this.settings, width: +t.target.value });
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
</setting-item>
|
|
149
|
+
<setting-item
|
|
150
|
+
name='Direction'
|
|
151
|
+
>
|
|
152
|
+
<select
|
|
153
|
+
@change=${(t) => {
|
|
154
|
+
t.target instanceof HTMLSelectElement && (this.settings = { ...this.settings, direction: t.target.value });
|
|
155
|
+
}}
|
|
156
|
+
>
|
|
157
|
+
${Object.values(M).map((t) => l`<option ?selected=${this.settings.direction === t}>${t}</option>`)}
|
|
158
|
+
</select>
|
|
159
|
+
</setting-item>
|
|
160
|
+
<setting-item
|
|
161
|
+
name='Gradient'
|
|
162
|
+
>
|
|
163
|
+
<input
|
|
164
|
+
type='checkbox'
|
|
165
|
+
?checked=${this.settings.gradient}
|
|
166
|
+
@change=${(t) => {
|
|
167
|
+
t.target instanceof HTMLInputElement && (this.settings = { ...this.settings, gradient: t.target.checked });
|
|
168
|
+
}}
|
|
169
|
+
>
|
|
170
|
+
</setting-item>
|
|
171
|
+
<setting-item
|
|
172
|
+
name='Prevent Hover'
|
|
173
|
+
description='Toggles whether palettes can be hovered'
|
|
174
|
+
>
|
|
175
|
+
<input
|
|
176
|
+
type='checkbox'
|
|
177
|
+
?checked=${this.settings.preventHover}
|
|
178
|
+
@change=${(t) => {
|
|
179
|
+
t.target instanceof HTMLInputElement && (this.settings = { ...this.settings, preventHover: t.target.checked });
|
|
180
|
+
}}
|
|
181
|
+
>
|
|
182
|
+
</setting-item>
|
|
183
|
+
<setting-item
|
|
184
|
+
name='Hide Text'
|
|
185
|
+
description='Disables color and alias visibility'
|
|
186
|
+
>
|
|
187
|
+
<input
|
|
188
|
+
type='checkbox'
|
|
189
|
+
?checked=${this.settings.hideText}
|
|
190
|
+
@change=${(t) => {
|
|
191
|
+
t.target instanceof HTMLInputElement && (this.settings = { ...this.settings, hideText: t.target.checked });
|
|
192
|
+
}}
|
|
193
|
+
>
|
|
194
|
+
</setting-item>
|
|
195
|
+
<setting-item
|
|
196
|
+
name='Override'
|
|
197
|
+
description='Disables color validation for full control (advanced)'
|
|
198
|
+
>
|
|
199
|
+
<input
|
|
200
|
+
type='checkbox'
|
|
201
|
+
?checked=${this.settings.override}
|
|
202
|
+
@change=${(t) => {
|
|
203
|
+
t.target instanceof HTMLInputElement && (this.settings = { ...this.settings, override: t.target.checked });
|
|
204
|
+
}}
|
|
205
|
+
>
|
|
206
|
+
</setting-item>
|
|
262
207
|
`;
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
<setting-item
|
|
268
|
-
name='Color Picker'
|
|
269
|
-
description='Use handpicked colors'
|
|
270
|
-
>
|
|
271
|
-
<input
|
|
272
|
-
type='color'
|
|
273
|
-
@change=${(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
}}
|
|
279
|
-
>
|
|
280
|
-
</setting-item>
|
|
208
|
+
}
|
|
209
|
+
/** Renders the picker option. */
|
|
210
|
+
pickerOption() {
|
|
211
|
+
return l`
|
|
212
|
+
<setting-item
|
|
213
|
+
name='Color Picker'
|
|
214
|
+
description='Use handpicked colors'
|
|
215
|
+
>
|
|
216
|
+
<input
|
|
217
|
+
type='color'
|
|
218
|
+
@change=${(t) => {
|
|
219
|
+
t.target instanceof HTMLInputElement && (this.colors = [...this.colors, t.target.value], this.settings.aliases.push(""));
|
|
220
|
+
}}
|
|
221
|
+
>
|
|
222
|
+
</setting-item>
|
|
281
223
|
`;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
}}
|
|
318
|
-
>
|
|
319
|
-
<button
|
|
320
|
-
title='Loads the generated colors'
|
|
321
|
-
@click=${(e) => {
|
|
322
|
-
const generated = generateColors(this.combination, { baseColor: this.baseColor, settings: this.settings });
|
|
323
|
-
this.colors = generated.colors;
|
|
324
|
-
if (generated.settings)
|
|
325
|
-
this.settings = generated.settings;
|
|
326
|
-
}}
|
|
327
|
-
>
|
|
328
|
-
${createElement(Shuffle)}
|
|
329
|
-
</button>
|
|
330
|
-
</setting-item>
|
|
224
|
+
}
|
|
225
|
+
/** Renders the generate option. */
|
|
226
|
+
generateOption() {
|
|
227
|
+
return this.colorPickerDisabled = this.combination === f.Random, l`
|
|
228
|
+
<setting-item
|
|
229
|
+
name='Generate'
|
|
230
|
+
description='Generate colors based on color theory'
|
|
231
|
+
>
|
|
232
|
+
<select
|
|
233
|
+
@change=${(t) => {
|
|
234
|
+
t.target instanceof HTMLSelectElement && (this.combination = t.target.value, this.colorPickerDisabled = this.combination === f.Random);
|
|
235
|
+
}}
|
|
236
|
+
>
|
|
237
|
+
${Object.values(f).map((t) => l`<option ?selected=${this.combination === t}>${t}</option>`)}
|
|
238
|
+
</select>
|
|
239
|
+
<input
|
|
240
|
+
type='color'
|
|
241
|
+
?disabled=${this.colorPickerDisabled}
|
|
242
|
+
@change=${(t) => {
|
|
243
|
+
t.target instanceof HTMLInputElement && (this.baseColor = b(t.target.value));
|
|
244
|
+
}}
|
|
245
|
+
@contextmenu=${(t) => {
|
|
246
|
+
t.preventDefault(), t.target instanceof HTMLInputElement && (t.target.value = b("#000").hex(), this.baseColor = void 0);
|
|
247
|
+
}}
|
|
248
|
+
>
|
|
249
|
+
<button
|
|
250
|
+
title='Loads the generated colors'
|
|
251
|
+
@click=${(t) => {
|
|
252
|
+
const n = L(this.combination, { baseColor: this.baseColor, settings: this.settings });
|
|
253
|
+
this.colors = n.colors, n.settings && (this.settings = n.settings);
|
|
254
|
+
}}
|
|
255
|
+
>
|
|
256
|
+
${p(C)}
|
|
257
|
+
</button>
|
|
258
|
+
</setting-item>
|
|
331
259
|
`;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
let
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
const colors = await getColors();
|
|
367
|
-
if (colors) {
|
|
368
|
-
this.colors = colors.map((color) => colorsea(color).hex(0));
|
|
369
|
-
this.settings.aliases = [];
|
|
370
|
-
}
|
|
371
|
-
};
|
|
372
|
-
const updateImagePreview = async (url) => {
|
|
373
|
-
if (!URL.canParse(url) || !canvasEl)
|
|
374
|
-
return;
|
|
375
|
-
const canvasImage = canvasEl;
|
|
376
|
-
canvasImage.imageURL = url;
|
|
377
|
-
await updateColors();
|
|
378
|
-
};
|
|
379
|
-
return html `
|
|
380
|
-
<setting-item
|
|
381
|
-
name='Image'
|
|
382
|
-
description='Convert image into palette'
|
|
383
|
-
>
|
|
384
|
-
<input
|
|
385
|
-
type='url'
|
|
386
|
-
placeholder='Enter URL or select file'
|
|
387
|
-
${ref(urlRef)}
|
|
388
|
-
>
|
|
389
|
-
<button
|
|
390
|
-
title='Right click to clear URL'
|
|
260
|
+
}
|
|
261
|
+
/** Renders the image option. */
|
|
262
|
+
imageOption() {
|
|
263
|
+
let t = "", n = $(), s = $(), o = $(), r = n.value?.value || "", c, h = $(), I = (e) => {
|
|
264
|
+
e instanceof w && (c = e, e.emitter.clear(), e.emitter.on("click", async (i) => await j(i.toUpperCase(), S.Raw)), e.emitter.on("move", (i) => {
|
|
265
|
+
if (!h.value) return;
|
|
266
|
+
let d = h.value;
|
|
267
|
+
d.text = e.getCanvasHex(i.x, i.y).toUpperCase(), d.setClampedPosition(i, e.getBoundingClientRect());
|
|
268
|
+
}));
|
|
269
|
+
};
|
|
270
|
+
const E = async () => {
|
|
271
|
+
if (!s.value || !c) return;
|
|
272
|
+
const e = s.value;
|
|
273
|
+
return await c.getPalette(+e.value);
|
|
274
|
+
}, y = async () => {
|
|
275
|
+
const e = await E();
|
|
276
|
+
e && (this.colors = e.map((i) => b(i).hex(0)), this.settings.aliases = []);
|
|
277
|
+
}, k = async (e) => {
|
|
278
|
+
if (!URL.canParse(e) || !c) return;
|
|
279
|
+
const i = c;
|
|
280
|
+
i.imageURL = e, await y();
|
|
281
|
+
};
|
|
282
|
+
return l`
|
|
283
|
+
<setting-item
|
|
284
|
+
name='Image'
|
|
285
|
+
description='Convert image into palette'
|
|
286
|
+
>
|
|
287
|
+
<input
|
|
288
|
+
type='url'
|
|
289
|
+
placeholder='Enter URL or select file'
|
|
290
|
+
${m(n)}
|
|
291
|
+
>
|
|
292
|
+
<button
|
|
293
|
+
title='Right click to clear URL'
|
|
391
294
|
@click=${async (e) => {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
throw new Error('URL provided is not valid.');
|
|
403
|
-
}
|
|
404
|
-
else
|
|
405
|
-
fileInput.click();
|
|
406
|
-
}
|
|
407
|
-
catch (e) {
|
|
408
|
-
// new Notice(e);
|
|
409
|
-
}
|
|
410
|
-
}}
|
|
295
|
+
try {
|
|
296
|
+
if (!o.value) return;
|
|
297
|
+
let i = o.value;
|
|
298
|
+
if (r !== "")
|
|
299
|
+
if (URL.canParse(r)) await k(r);
|
|
300
|
+
else throw new Error("URL provided is not valid.");
|
|
301
|
+
else i.click();
|
|
302
|
+
} catch {
|
|
303
|
+
}
|
|
304
|
+
}}
|
|
411
305
|
@contextmenu=${(e) => {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
>
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
type ='file'
|
|
423
|
-
accept = 'image/*'
|
|
306
|
+
if (e.preventDefault(), !n.value) return;
|
|
307
|
+
const i = n.value;
|
|
308
|
+
i.value = "";
|
|
309
|
+
}}
|
|
310
|
+
>
|
|
311
|
+
${p(D)}
|
|
312
|
+
</button>
|
|
313
|
+
<input
|
|
314
|
+
type ='file'
|
|
315
|
+
accept = 'image/*'
|
|
424
316
|
@change=${(e) => {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
name='Count'
|
|
449
|
-
description='Set the number of colors to generate from the image'
|
|
450
|
-
>
|
|
451
|
-
<input
|
|
452
|
-
id='range-slider'
|
|
453
|
-
type='range'
|
|
454
|
-
min='4'
|
|
455
|
-
max='12'
|
|
456
|
-
value='8'
|
|
317
|
+
try {
|
|
318
|
+
const i = new FileReader(), d = e.target.files?.[0];
|
|
319
|
+
d && i.readAsDataURL(d), i.addEventListener("load", async () => {
|
|
320
|
+
typeof i.result == "string" && (r = i.result, await k(r));
|
|
321
|
+
}), i.addEventListener("error", () => {
|
|
322
|
+
throw new Error("Error processing image");
|
|
323
|
+
});
|
|
324
|
+
} catch {
|
|
325
|
+
}
|
|
326
|
+
}}
|
|
327
|
+
${m(o)}
|
|
328
|
+
>
|
|
329
|
+
</setting-item>
|
|
330
|
+
<setting-item
|
|
331
|
+
name='Count'
|
|
332
|
+
description='Set the number of colors to generate from the image'
|
|
333
|
+
>
|
|
334
|
+
<input
|
|
335
|
+
id='range-slider'
|
|
336
|
+
type='range'
|
|
337
|
+
min='4'
|
|
338
|
+
max='12'
|
|
339
|
+
value='8'
|
|
457
340
|
@change=${async () => {
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
${
|
|
461
|
-
>
|
|
462
|
-
</setting-item>
|
|
463
|
-
<tool-tip
|
|
464
|
-
trigger='hover'
|
|
465
|
-
${
|
|
466
|
-
>
|
|
467
|
-
<canvas-image
|
|
468
|
-
width=${this.palette.getBoundingClientRect().width}
|
|
469
|
-
height=${this.palette.getBoundingClientRect().height}
|
|
341
|
+
await y();
|
|
342
|
+
}}
|
|
343
|
+
${m(s)}
|
|
344
|
+
>
|
|
345
|
+
</setting-item>
|
|
346
|
+
<tool-tip
|
|
347
|
+
trigger='hover'
|
|
348
|
+
${m(h)}
|
|
349
|
+
>
|
|
350
|
+
<canvas-image
|
|
351
|
+
width=${this.palette.getBoundingClientRect().width}
|
|
352
|
+
height=${this.palette.getBoundingClientRect().height}
|
|
470
353
|
@mousemove=${(e) => {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
hex = e.target.getCanvasHex(e.clientX, e.clientY);
|
|
474
|
-
}}
|
|
354
|
+
e.target instanceof w && (t = e.target.getCanvasHex(e.clientX, e.clientY));
|
|
355
|
+
}}
|
|
475
356
|
@click=${(e) => {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
>
|
|
483
|
-
</canvas-image>
|
|
484
|
-
</tool-tip>
|
|
357
|
+
t && (this.colors = [...this.colors, t], this.settings.aliases = [...this.settings.aliases, ""]);
|
|
358
|
+
}}
|
|
359
|
+
${m(I)}
|
|
360
|
+
>
|
|
361
|
+
</canvas-image>
|
|
362
|
+
</tool-tip>
|
|
485
363
|
`;
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
<setting-item
|
|
492
|
-
name='URL'
|
|
493
|
-
description='Only coolors.co & colorhunt.co are currently supported'
|
|
494
|
-
>
|
|
495
|
-
<input
|
|
496
|
-
type='url'
|
|
497
|
-
placeholder='Enter URL'
|
|
498
|
-
@change=${(
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
e.preventDefault();
|
|
519
|
-
if (input)
|
|
520
|
-
input.value = '';
|
|
521
|
-
}}
|
|
522
|
-
>
|
|
523
|
-
${createElement(Link)}
|
|
524
|
-
</button>
|
|
525
|
-
</setting-item>
|
|
364
|
+
}
|
|
365
|
+
/** Renders the URL option. */
|
|
366
|
+
urlOption() {
|
|
367
|
+
let t;
|
|
368
|
+
return l`
|
|
369
|
+
<setting-item
|
|
370
|
+
name='URL'
|
|
371
|
+
description='Only coolors.co & colorhunt.co are currently supported'
|
|
372
|
+
>
|
|
373
|
+
<input
|
|
374
|
+
type='url'
|
|
375
|
+
placeholder='Enter URL'
|
|
376
|
+
@change=${(n) => {
|
|
377
|
+
n.target instanceof HTMLInputElement && (t = n.target);
|
|
378
|
+
}}
|
|
379
|
+
>
|
|
380
|
+
<button
|
|
381
|
+
title='Right click to clear URL'
|
|
382
|
+
@click=${(n) => {
|
|
383
|
+
try {
|
|
384
|
+
if (!t.value.match(G)) throw new Error("URL provided is not valid.");
|
|
385
|
+
this.colors = _(t.value), this.settings.aliases = [];
|
|
386
|
+
} catch {
|
|
387
|
+
}
|
|
388
|
+
}}
|
|
389
|
+
@contextmenu=${(n) => {
|
|
390
|
+
n.preventDefault(), t && (t.value = "");
|
|
391
|
+
}}
|
|
392
|
+
>
|
|
393
|
+
${p(R)}
|
|
394
|
+
</button>
|
|
395
|
+
</setting-item>
|
|
526
396
|
`;
|
|
527
|
-
|
|
397
|
+
}
|
|
398
|
+
};
|
|
399
|
+
a.styles = [F];
|
|
400
|
+
g([
|
|
401
|
+
P("#color-palette-editor")
|
|
402
|
+
], a.prototype, "palette", 2);
|
|
403
|
+
g([
|
|
404
|
+
v({ type: Array })
|
|
405
|
+
], a.prototype, "colors", 2);
|
|
406
|
+
g([
|
|
407
|
+
v({ type: Object })
|
|
408
|
+
], a.prototype, "settings", 2);
|
|
409
|
+
g([
|
|
410
|
+
v({ type: String, reflect: !0 })
|
|
411
|
+
], a.prototype, "selectedInput", 2);
|
|
412
|
+
g([
|
|
413
|
+
v({ type: String })
|
|
414
|
+
], a.prototype, "combination", 2);
|
|
415
|
+
g([
|
|
416
|
+
v({ type: Object })
|
|
417
|
+
], a.prototype, "baseColor", 2);
|
|
418
|
+
g([
|
|
419
|
+
H()
|
|
420
|
+
], a.prototype, "colorPickerDisabled", 2);
|
|
421
|
+
a = g([
|
|
422
|
+
T("color-palette-editor")
|
|
423
|
+
], a);
|
|
424
|
+
export {
|
|
425
|
+
a as ColorPaletteEditor,
|
|
426
|
+
X as SelectedInput
|
|
528
427
|
};
|
|
529
|
-
__decorate([
|
|
530
|
-
query('#color-palette-editor')
|
|
531
|
-
], ColorPaletteEditor.prototype, "palette", void 0);
|
|
532
|
-
__decorate([
|
|
533
|
-
property({ type: Array })
|
|
534
|
-
], ColorPaletteEditor.prototype, "colors", void 0);
|
|
535
|
-
__decorate([
|
|
536
|
-
property({ type: Object })
|
|
537
|
-
], ColorPaletteEditor.prototype, "settings", void 0);
|
|
538
|
-
__decorate([
|
|
539
|
-
property({ type: String, reflect: true })
|
|
540
|
-
], ColorPaletteEditor.prototype, "selectedInput", void 0);
|
|
541
|
-
__decorate([
|
|
542
|
-
property({ type: String })
|
|
543
|
-
], ColorPaletteEditor.prototype, "combination", void 0);
|
|
544
|
-
__decorate([
|
|
545
|
-
property({ type: Object })
|
|
546
|
-
], ColorPaletteEditor.prototype, "baseColor", void 0);
|
|
547
|
-
__decorate([
|
|
548
|
-
state()
|
|
549
|
-
], ColorPaletteEditor.prototype, "colorPickerDisabled", void 0);
|
|
550
|
-
ColorPaletteEditor = __decorate([
|
|
551
|
-
customElement('color-palette-editor')
|
|
552
|
-
], ColorPaletteEditor);
|
|
553
|
-
export { ColorPaletteEditor };
|