@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,231 +1,255 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { copyToClipboard as b } from "../../../utils/basicUtils.js";
|
|
7
|
-
import d from "colorsea";
|
|
8
|
-
import { AbsoluteContainer as S } from "../../absolute-container/absolute-container.js";
|
|
9
|
-
import { ref as g } from "lit/directives/ref.js";
|
|
10
|
-
import { ColorPaletteReorder as _ } from "./color-palette-reorder.js";
|
|
11
|
-
var F = Object.defineProperty, j = Object.getOwnPropertyDescriptor, l = (n, e, r, o) => {
|
|
12
|
-
for (var t = o > 1 ? void 0 : o ? j(e, r) : e, p = n.length - 1, m; p >= 0; p--)
|
|
13
|
-
(m = n[p]) && (t = (o ? m(e, r, t) : m(t)) || t);
|
|
14
|
-
return o && t && F(e, r, t), t;
|
|
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;
|
|
15
6
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
this.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
7
|
+
import { LitElement, html, css, nothing } from 'lit';
|
|
8
|
+
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
9
|
+
import { EventEmitter } from '../../../utils/EventEmitter';
|
|
10
|
+
import { defaultSettings } from '../color-palette-utils';
|
|
11
|
+
import { ArrowLeftRight, Brush, Check, Copy, createElement, Droplets, Palette, Scissors } from 'lucide';
|
|
12
|
+
import { copyToClipboard } from '../../../utils/basicUtils';
|
|
13
|
+
import colorsea from 'colorsea';
|
|
14
|
+
import { AbsoluteContainer } from '../../absolute-container/absolute-container';
|
|
15
|
+
import { ref } from 'lit/directives/ref.js';
|
|
16
|
+
import { ColorPaletteReorder } from './color-palette-reorder';
|
|
17
|
+
let ColorPaletteMenu = class ColorPaletteMenu extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.colors = [];
|
|
21
|
+
this.editMode = false;
|
|
22
|
+
this.copyFormat = defaultSettings.copyFormat;
|
|
23
|
+
this.reorder = false;
|
|
24
|
+
this.emitter = new EventEmitter();
|
|
25
|
+
}
|
|
26
|
+
disconnectedCallback() {
|
|
27
|
+
super.disconnectedCallback();
|
|
28
|
+
this.emitter.clear();
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
const absoluteRef = (absolute) => {
|
|
32
|
+
if (!(absolute instanceof AbsoluteContainer))
|
|
33
|
+
return;
|
|
34
|
+
absolute.emitter.on('visibility', (open) => {
|
|
35
|
+
this.reorder = false;
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
return html `
|
|
39
|
+
<absolute-container
|
|
40
|
+
disableContextEvent
|
|
41
|
+
${ref(absoluteRef)}
|
|
42
|
+
>
|
|
43
|
+
${this.reorder
|
|
44
|
+
? this.reorderItems()
|
|
45
|
+
: this.menuItems()}
|
|
46
|
+
</absolute-container>
|
|
35
47
|
`;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
>
|
|
51
|
-
${
|
|
52
|
-
<span>Reorder</span>
|
|
53
|
-
</button>
|
|
54
|
-
</li>
|
|
55
|
-
<li>
|
|
56
|
-
<button
|
|
48
|
+
}
|
|
49
|
+
menuItems() {
|
|
50
|
+
const palette = {
|
|
51
|
+
colors: this.colors,
|
|
52
|
+
settings: this.settings
|
|
53
|
+
};
|
|
54
|
+
return html `
|
|
55
|
+
<menu>
|
|
56
|
+
<li>
|
|
57
|
+
<button
|
|
58
|
+
@click=${(e) => {
|
|
59
|
+
e.stopPropagation();
|
|
60
|
+
this.reorder = !this.reorder;
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
63
|
+
${createElement(ArrowLeftRight)}
|
|
64
|
+
<span>Reorder</span>
|
|
65
|
+
</button>
|
|
66
|
+
</li>
|
|
67
|
+
<li>
|
|
68
|
+
<button
|
|
57
69
|
@click=${() => {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
>
|
|
61
|
-
${
|
|
62
|
-
<span>Edit Mode</span>
|
|
63
|
-
</button>
|
|
64
|
-
</li>
|
|
65
|
-
${
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
this.emitter.emit('openEditor');
|
|
71
|
+
}}
|
|
72
|
+
>
|
|
73
|
+
${createElement(Palette)}
|
|
74
|
+
<span>Edit Mode</span>
|
|
75
|
+
</button>
|
|
76
|
+
</li>
|
|
77
|
+
${
|
|
78
|
+
// Only show toggle edit mode option when palette is not a gradient
|
|
79
|
+
!this.settings?.gradient
|
|
80
|
+
? html `
|
|
81
|
+
<li>
|
|
82
|
+
<button
|
|
69
83
|
@click=${() => {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
// Toggle palette edit mode
|
|
85
|
+
this.emitter.emit('editMode', !this.editMode);
|
|
86
|
+
}}
|
|
87
|
+
>
|
|
88
|
+
${createElement(Brush)}
|
|
89
|
+
<span>Quick Edit</span>
|
|
90
|
+
${this.editMode ? createElement(Check) : nothing}
|
|
91
|
+
</button>
|
|
92
|
+
</li>
|
|
93
|
+
`
|
|
94
|
+
: nothing}
|
|
95
|
+
<hr>
|
|
96
|
+
<li>
|
|
97
|
+
<button
|
|
82
98
|
@click=${() => {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
>
|
|
90
|
-
${
|
|
91
|
-
<span>Convert to RGB</span>
|
|
92
|
-
</button>
|
|
93
|
-
</li>
|
|
94
|
-
<li>
|
|
95
|
-
<button
|
|
99
|
+
const colors = this.colors.map((color) => {
|
|
100
|
+
const rgbColor = colorsea(color).rgb();
|
|
101
|
+
return `rgb(${rgbColor[0]}, ${rgbColor[1]}, ${rgbColor[2]})`;
|
|
102
|
+
});
|
|
103
|
+
this.emitter.emit('change', colors);
|
|
104
|
+
}}
|
|
105
|
+
>
|
|
106
|
+
${createElement(Droplets)}
|
|
107
|
+
<span>Convert to RGB</span>
|
|
108
|
+
</button>
|
|
109
|
+
</li>
|
|
110
|
+
<li>
|
|
111
|
+
<button
|
|
96
112
|
@click=${() => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
>
|
|
104
|
-
${
|
|
105
|
-
<span>Convert to HSL</span>
|
|
106
|
-
</button>
|
|
107
|
-
</li>
|
|
108
|
-
<li>
|
|
109
|
-
<button
|
|
113
|
+
const colors = this.colors.map((color) => {
|
|
114
|
+
const hslColor = colorsea(color).hsl();
|
|
115
|
+
return `hsl(${hslColor[0]} ${hslColor[1]}% ${hslColor[2]}%)`;
|
|
116
|
+
});
|
|
117
|
+
this.emitter.emit('change', colors);
|
|
118
|
+
}}
|
|
119
|
+
>
|
|
120
|
+
${createElement(Droplets)}
|
|
121
|
+
<span>Convert to HSL</span>
|
|
122
|
+
</button>
|
|
123
|
+
</li>
|
|
124
|
+
<li>
|
|
125
|
+
<button
|
|
110
126
|
@click=${() => {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
const colors = this.colors.map((color) => {
|
|
128
|
+
return colorsea(color).hex(2);
|
|
129
|
+
});
|
|
130
|
+
this.emitter.emit('change', colors);
|
|
131
|
+
}}
|
|
132
|
+
>
|
|
133
|
+
${createElement(Droplets)}
|
|
134
|
+
<span>Convert to HEX</span>
|
|
135
|
+
</button>
|
|
136
|
+
</li>
|
|
137
|
+
<hr>
|
|
138
|
+
<li>
|
|
139
|
+
<button
|
|
122
140
|
@click=${async () => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
141
|
+
// Copy palette to clipboard
|
|
142
|
+
await copyToClipboard(JSON.stringify(palette), this.copyFormat);
|
|
143
|
+
// Remove palette
|
|
144
|
+
this.emitter.emit('change', []);
|
|
145
|
+
}}
|
|
146
|
+
>
|
|
147
|
+
${createElement(Scissors)}
|
|
148
|
+
<span>Cut</span>
|
|
149
|
+
</button>
|
|
150
|
+
</li>
|
|
151
|
+
<li>
|
|
152
|
+
<button
|
|
132
153
|
@click=${async () => {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
154
|
+
// Copy palette to clipboard
|
|
155
|
+
await copyToClipboard(JSON.stringify(palette), this.copyFormat);
|
|
156
|
+
}}
|
|
157
|
+
>
|
|
158
|
+
${createElement(Copy)}
|
|
159
|
+
<span>Copy</span>
|
|
160
|
+
</button>
|
|
161
|
+
</li>
|
|
162
|
+
</menu>
|
|
141
163
|
`;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
164
|
+
}
|
|
165
|
+
reorderItems() {
|
|
166
|
+
const reorderRef = (reorder) => {
|
|
167
|
+
if (!(reorder instanceof ColorPaletteReorder))
|
|
168
|
+
return;
|
|
169
|
+
reorder.emitter.clear();
|
|
170
|
+
reorder.emitter.on('submit', (colors) => {
|
|
171
|
+
this.emitter.emit('change', colors);
|
|
172
|
+
this.reorder = false;
|
|
173
|
+
});
|
|
174
|
+
};
|
|
175
|
+
return html `
|
|
176
|
+
<color-palette-reorder
|
|
177
|
+
.colors=${this.colors}
|
|
178
|
+
${ref(reorderRef)}
|
|
179
|
+
>
|
|
180
|
+
</color-palette-reorder>
|
|
155
181
|
`;
|
|
156
|
-
|
|
182
|
+
}
|
|
157
183
|
};
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
:host {
|
|
161
|
-
display: block;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
menu {
|
|
165
|
-
display: grid;
|
|
166
|
-
grid-template-columns: 1fr;
|
|
167
|
-
padding: .5rem;
|
|
168
|
-
margin: 0;
|
|
169
|
-
border-radius: 5px;
|
|
170
|
-
color: rgb(245, 245, 245);
|
|
171
|
-
background-color: #222222;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
li {
|
|
175
|
-
display: grid;
|
|
176
|
-
grid-template-columns: subgrid;
|
|
177
|
-
list-style: none;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
button {
|
|
181
|
-
display: grid;
|
|
182
|
-
grid-template-columns: auto 1fr 1fr;
|
|
183
|
-
align-items: center;
|
|
184
|
-
justify-items: flex-start;
|
|
185
|
-
column-gap: .5rem;
|
|
186
|
-
background-color: inherit;
|
|
187
|
-
color: inherit;
|
|
188
|
-
border: none;
|
|
189
|
-
cursor: pointer;
|
|
190
|
-
padding: 4px 8px;
|
|
191
|
-
text-wrap: nowrap;
|
|
192
|
-
|
|
193
|
-
&:hover {
|
|
194
|
-
background-color: #323232;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
span {
|
|
198
|
-
font-size: 14px;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
hr {
|
|
203
|
-
width: 95%;
|
|
204
|
-
border-color: rgb(45, 45, 45);
|
|
205
|
-
}
|
|
184
|
+
ColorPaletteMenu.styles = [
|
|
185
|
+
css `
|
|
186
|
+
:host {
|
|
187
|
+
display: block;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
menu {
|
|
191
|
+
display: grid;
|
|
192
|
+
grid-template-columns: 1fr;
|
|
193
|
+
padding: .5rem;
|
|
194
|
+
margin: 0;
|
|
195
|
+
border-radius: 5px;
|
|
196
|
+
color: rgb(245, 245, 245);
|
|
197
|
+
background-color: #222222;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
li {
|
|
201
|
+
display: grid;
|
|
202
|
+
grid-template-columns: subgrid;
|
|
203
|
+
list-style: none;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
button {
|
|
207
|
+
display: grid;
|
|
208
|
+
grid-template-columns: auto 1fr 1fr;
|
|
209
|
+
align-items: center;
|
|
210
|
+
justify-items: flex-start;
|
|
211
|
+
column-gap: .5rem;
|
|
212
|
+
background-color: inherit;
|
|
213
|
+
color: inherit;
|
|
214
|
+
border: none;
|
|
215
|
+
cursor: pointer;
|
|
216
|
+
padding: 4px 8px;
|
|
217
|
+
text-wrap: nowrap;
|
|
218
|
+
|
|
219
|
+
&:hover {
|
|
220
|
+
background-color: #323232;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
span {
|
|
224
|
+
font-size: 14px;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
hr {
|
|
229
|
+
width: 95%;
|
|
230
|
+
border-color: rgb(45, 45, 45);
|
|
231
|
+
}
|
|
206
232
|
`
|
|
207
233
|
];
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
],
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
],
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
],
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
],
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
],
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
],
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
],
|
|
229
|
-
export {
|
|
230
|
-
s as ColorPaletteMenu
|
|
231
|
-
};
|
|
234
|
+
__decorate([
|
|
235
|
+
query('absolute-container')
|
|
236
|
+
], ColorPaletteMenu.prototype, "absolute", void 0);
|
|
237
|
+
__decorate([
|
|
238
|
+
property({ type: Array })
|
|
239
|
+
], ColorPaletteMenu.prototype, "colors", void 0);
|
|
240
|
+
__decorate([
|
|
241
|
+
property({ type: Object })
|
|
242
|
+
], ColorPaletteMenu.prototype, "settings", void 0);
|
|
243
|
+
__decorate([
|
|
244
|
+
property({ type: Boolean })
|
|
245
|
+
], ColorPaletteMenu.prototype, "editMode", void 0);
|
|
246
|
+
__decorate([
|
|
247
|
+
property({ type: String })
|
|
248
|
+
], ColorPaletteMenu.prototype, "copyFormat", void 0);
|
|
249
|
+
__decorate([
|
|
250
|
+
state()
|
|
251
|
+
], ColorPaletteMenu.prototype, "reorder", void 0);
|
|
252
|
+
ColorPaletteMenu = __decorate([
|
|
253
|
+
customElement('color-palette-menu')
|
|
254
|
+
], ColorPaletteMenu);
|
|
255
|
+
export { ColorPaletteMenu };
|