wox-gui 0.1.5 → 0.1.8
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/wox-gui.cdn.js +431 -428
- package/dist/wox-gui.js +188 -185
- package/package.json +3 -2
package/dist/wox-gui.cdn.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var s = (p, c, t) =>
|
|
4
|
-
const
|
|
1
|
+
var yt = Object.defineProperty;
|
|
2
|
+
var kt = (p, c, t) => c in p ? yt(p, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[c] = t;
|
|
3
|
+
var s = (p, c, t) => kt(p, typeof c != "symbol" ? c + "" : c, t);
|
|
4
|
+
const T = class T extends HTMLElement {
|
|
5
5
|
constructor() {
|
|
6
6
|
super();
|
|
7
7
|
s(this, "render", (t, e) => {
|
|
8
|
-
this.shadowRoot.innerHTML = `<style>${
|
|
8
|
+
this.shadowRoot.innerHTML = `<style>${T.BASE_STYLES}${t}</style>${e}`;
|
|
9
9
|
});
|
|
10
10
|
s(this, "emit", (t, e) => {
|
|
11
11
|
this.dispatchEvent(new CustomEvent(t, { detail: e, bubbles: !0, composed: !0 }));
|
|
@@ -15,13 +15,13 @@ const O = class O extends HTMLElement {
|
|
|
15
15
|
this.attachShadow({ mode: "open" });
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
s(
|
|
18
|
+
s(T, "BASE_STYLES", `
|
|
19
19
|
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
|
20
20
|
:host { display: inline-block; font-family: var(--wox-font, 'Inter', sans-serif); color: var(--wox-text-primary, #eee); font-size: var(--wox-font-size-base, 12px); }
|
|
21
21
|
:host([hidden]) { display: none !important; }
|
|
22
22
|
`);
|
|
23
|
-
let
|
|
24
|
-
const
|
|
23
|
+
let w = T;
|
|
24
|
+
const M = `
|
|
25
25
|
/* glow: neon glow effect using --wox-fx-color */
|
|
26
26
|
.glow {
|
|
27
27
|
border-color: var(--wox-fx-color);
|
|
@@ -49,18 +49,18 @@ const S = `
|
|
|
49
49
|
to { opacity: 0.4; }
|
|
50
50
|
}
|
|
51
51
|
`;
|
|
52
|
-
class
|
|
52
|
+
class H extends w {
|
|
53
53
|
constructor() {
|
|
54
54
|
super(...arguments);
|
|
55
55
|
s(this, "_render", () => {
|
|
56
|
-
const t = this.getAttribute("name"), e = this.getAttribute("size") || "18", n = this.getAttribute("color") || "", o = this.hasAttribute("glow"), i = this.hasAttribute("pulse"),
|
|
56
|
+
const t = this.getAttribute("name"), e = this.getAttribute("size") || "18", n = this.getAttribute("color") || "", o = this.hasAttribute("glow"), i = this.hasAttribute("pulse"), r = t ? `<span class="material-icons" style="--size:${e}px">${t}</span>` : "<slot></slot>", a = o || i ? `<span class="fx-wrap${o ? " glow" : ""}${i ? " pulse" : ""}" style="--wox-fx-color:${n};color:${n}">${r}</span>` : r;
|
|
57
57
|
this.render(`
|
|
58
58
|
:host { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; }
|
|
59
59
|
.material-icons { font-family: 'Material Icons'; font-weight: normal; font-style: normal; font-size: var(--size, 18px); display: inline-block; line-height: 1; text-transform: none; letter-spacing: normal; word-wrap: normal; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -moz-osx-font-smoothing: grayscale; color: inherit; }
|
|
60
60
|
::slotted(svg) { width: var(--size, 18px); height: var(--size, 18px); }
|
|
61
61
|
slot { display: inline-flex; align-items: center; justify-content: center; }
|
|
62
62
|
.fx-wrap { display: inline-flex; align-items: center; justify-content: center; border-radius: var(--wox-radius-sm, 3px); padding: 4px; }
|
|
63
|
-
${
|
|
63
|
+
${M} :host { --size: ${e}px; }`, a);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
connectedCallback() {
|
|
@@ -70,8 +70,8 @@ class J extends v {
|
|
|
70
70
|
this.isConnected && this._render();
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
s(
|
|
74
|
-
class
|
|
73
|
+
s(H, "observedAttributes", ["name", "size", "color", "glow", "pulse"]);
|
|
74
|
+
class j extends w {
|
|
75
75
|
constructor() {
|
|
76
76
|
super(...arguments);
|
|
77
77
|
s(this, "_render", () => {
|
|
@@ -92,8 +92,8 @@ class K extends v {
|
|
|
92
92
|
this.isConnected && this._render();
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
s(
|
|
96
|
-
class
|
|
95
|
+
s(j, "observedAttributes", ["direction", "spacing"]);
|
|
96
|
+
class G extends w {
|
|
97
97
|
constructor() {
|
|
98
98
|
super(...arguments);
|
|
99
99
|
s(this, "_render", () => {
|
|
@@ -115,27 +115,30 @@ class V extends v {
|
|
|
115
115
|
this.isConnected && this._render();
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
s(
|
|
119
|
-
class
|
|
118
|
+
s(G, "observedAttributes", ["variant", "text", "color"]);
|
|
119
|
+
class Y extends w {
|
|
120
120
|
constructor() {
|
|
121
121
|
super(...arguments);
|
|
122
122
|
s(this, "_render", () => {
|
|
123
|
-
const t = this.getAttribute("variant") || "icon", e = this.getAttribute("icon") || "", n = this.getAttribute("label") || "", o = this.hasAttribute("active"), i = this.hasAttribute("disabled"),
|
|
124
|
-
let
|
|
125
|
-
t === "icon" ?
|
|
126
|
-
const
|
|
123
|
+
const t = this.getAttribute("variant") || "icon", e = this.getAttribute("icon") || "", n = this.getAttribute("label") || "", o = this.hasAttribute("active"), i = this.hasAttribute("disabled"), r = this.getAttribute("dash") || "solid", a = this.getAttribute("color") || "", l = this.hasAttribute("glow"), x = this.hasAttribute("pulse"), d = this.getAttribute("border-color") || "", u = this.getAttribute("border-style") || "", h = this.getAttribute("icon-color") || "", v = this.getAttribute("text-color") || "", b = [`v-${t}`, o ? "active" : "", l ? "glow" : "", x ? "pulse" : ""].filter(Boolean).join(" ");
|
|
124
|
+
let g = "";
|
|
125
|
+
t === "icon" ? g = e ? `<span class="material-icons">${e}</span>` : "<slot></slot>" : t === "text" ? g = (e ? `<span class="material-icons" style="font-size:14px">${e}</span>` : "") + (n || "<slot></slot>") : t === "tile" ? g = (e ? `<span class="material-icons">${e}</span>` : '<slot name="icon"></slot>') + `<span>${n}</span>` : t === "dash" && (g = `<div class="dash-line${r === "solid" ? "" : ` ${r}`}"></div>`);
|
|
126
|
+
const f = [];
|
|
127
|
+
a && f.push(`--wox-fx-color:${a}`), d && f.push(`--wox-btn-border:${d}`), u && f.push(`--wox-btn-border-style:${u}`), h && f.push(`--wox-btn-icon:${h}`), v && f.push(`--wox-btn-text:${v}`);
|
|
128
|
+
const k = a ? " data-color" : "", E = f.length ? ` style="${f.join(";")}"` : "";
|
|
127
129
|
this.render(`
|
|
128
130
|
:host { display: inline-block; }
|
|
129
131
|
button {
|
|
130
132
|
display: flex; align-items: center; justify-content: center; gap: 6px;
|
|
131
|
-
background: transparent; border: 1px solid var(--wox-border); color: var(--wox-text-secondary, #999);
|
|
133
|
+
background: transparent; border: 1px solid var(--wox-btn-border, var(--wox-border)); border-style: var(--wox-btn-border-style, solid); color: var(--wox-btn-text, var(--wox-text-secondary, #999));
|
|
132
134
|
cursor: pointer; font-family: var(--wox-font, sans-serif); font-size: var(--wox-font-size-base, 12px);
|
|
133
135
|
transition: all var(--wox-transition-fast, 0.12s); border-radius: var(--wox-radius-sm, 3px);
|
|
134
136
|
padding: 0; margin: 0; line-height: 1; user-select: none;
|
|
135
137
|
}
|
|
136
|
-
button:hover { background: var(--wox-bg-hover, #2a2a2e); color: var(--wox-text-hi, #fff); }
|
|
138
|
+
button:hover { background: var(--wox-bg-hover, #2a2a2e); color: var(--wox-btn-text, var(--wox-text-hi, #fff)); }
|
|
137
139
|
button:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }
|
|
138
|
-
button.active { background: var(--wox-bg-hover, #2a2a2e); color: var(--wox-accent, #00e5ff); border-color: var(--wox-border-light, #444); }
|
|
140
|
+
button.active { background: var(--wox-bg-hover, #2a2a2e); color: var(--wox-btn-text, var(--wox-accent, #00e5ff)); border-color: var(--wox-btn-border, var(--wox-border-light, #444)); }
|
|
141
|
+
.material-icons { color: var(--wox-btn-icon, inherit); }
|
|
139
142
|
|
|
140
143
|
/* icon variant */
|
|
141
144
|
button.v-icon { width: 34px; height: 32px; border-radius: var(--wox-radius-sm, 3px); }
|
|
@@ -147,13 +150,13 @@ class U extends v {
|
|
|
147
150
|
/* tile variant */
|
|
148
151
|
button.v-tile {
|
|
149
152
|
flex-direction: column; gap: 6px; background: var(--wox-bg-toolbar, #1e1e22);
|
|
150
|
-
border: 1px solid var(--wox-border, #333); border-radius: var(--wox-radius-xl, 10px);
|
|
153
|
+
border: 1px solid var(--wox-border, #333); border-style: var(--wox-btn-border-style, solid); border-radius: var(--wox-radius-xl, 10px);
|
|
151
154
|
padding: 12px 10px; min-width: 68px; font-size: var(--wox-font-size-sm, 10px);
|
|
152
155
|
font-weight: 500; text-transform: uppercase;
|
|
153
156
|
transition: all var(--wox-transition-smooth, 0.25s cubic-bezier(0.4, 0, 0.2, 1));
|
|
154
157
|
position: relative; overflow: hidden;
|
|
155
158
|
}
|
|
156
|
-
button.v-tile:hover { background: var(--wox-bg-hover, #2a2a2e); border-color: var(--wox-border-light, #555); color: var(--wox-text-primary, #eee); transform: translateY(-1px); }
|
|
159
|
+
button.v-tile:hover { background: var(--wox-bg-hover, #2a2a2e); border-color: var(--wox-btn-border, var(--wox-border-light, #555)); color: var(--wox-btn-text, var(--wox-text-primary, #eee)); transform: translateY(-1px); }
|
|
157
160
|
button.v-tile:hover svg, button.v-tile:hover .material-icons { transform: scale(1.05); opacity: 1; }
|
|
158
161
|
button.v-tile svg, button.v-tile .material-icons { display: block; width: 32px; height: 32px; transition: transform 0.2s; opacity: 0.8; font-size: 28px; }
|
|
159
162
|
button.v-tile.delete:hover { border-color: var(--wox-danger, #f72585); color: var(--wox-danger, #f72585); background: rgba(247, 37, 133, 0.05); }
|
|
@@ -162,7 +165,7 @@ class U extends v {
|
|
|
162
165
|
button.v-tile[data-color] { --wox-fx-color: var(--wox-text-secondary, #999); }
|
|
163
166
|
button.v-tile[data-color]:hover {
|
|
164
167
|
background: color-mix(in srgb, var(--wox-fx-color), transparent 92%);
|
|
165
|
-
border-color: var(--wox-fx-color); color: var(--wox-fx-color);
|
|
168
|
+
border-color: var(--wox-btn-border, var(--wox-fx-color)); color: var(--wox-btn-text, var(--wox-fx-color));
|
|
166
169
|
box-shadow: 0 0 15px color-mix(in srgb, var(--wox-fx-color), transparent 80%);
|
|
167
170
|
}
|
|
168
171
|
button.v-tile[data-color]:hover svg { filter: drop-shadow(0 0 4px var(--wox-fx-color)); }
|
|
@@ -170,27 +173,27 @@ class U extends v {
|
|
|
170
173
|
/* dash variant */
|
|
171
174
|
button.v-dash {
|
|
172
175
|
width: 42px; height: 26px; background: var(--wox-bg-panel, #1c1c21);
|
|
173
|
-
border: 1px solid var(--wox-border, #333); border-radius: var(--wox-radius-lg, 8px);
|
|
176
|
+
border: 1px solid var(--wox-border, #333); border-style: var(--wox-btn-border-style, solid); border-radius: var(--wox-radius-lg, 8px);
|
|
174
177
|
transition: all 0.2s;
|
|
175
178
|
}
|
|
176
|
-
button.v-dash:hover { background: var(--wox-bg-hover, #2a2a2e); border-color: var(--wox-border-light, #555); transform: translateY(-1px); }
|
|
177
|
-
button.v-dash.active { border-color: var(--wox-accent, #00e5ff); box-shadow: var(--wox-shadow-accent, 0 0 10px rgba(0, 229, 255, 0.3)); }
|
|
178
|
-
.dash-line { width: 16px; height: 3px; background: var(--wox-text-secondary, #666); border-radius: 1px; }
|
|
179
|
-
button.v-dash.active .dash-line { background: var(--wox-accent, #00e5ff); }
|
|
180
|
-
.dash-line.dotted { background: radial-gradient(circle, currentColor 1px, transparent 1px); background-size: 4px 100%; color: var(--wox-text-secondary, #666); }
|
|
181
|
-
button.v-dash.active .dash-line.dotted { color: var(--wox-accent, #00e5ff); }
|
|
182
|
-
.dash-line.dashed { background: linear-gradient(to right, currentColor 6px, transparent 6px); background-size: 10px 100%; color: var(--wox-text-secondary, #666); }
|
|
183
|
-
button.v-dash.active .dash-line.dashed { color: var(--wox-accent, #00e5ff); }
|
|
184
|
-
.dash-line.longdash { background: linear-gradient(to right, currentColor 12px, transparent 4px); background-size: 16px 100%; color: var(--wox-text-secondary, #666); }
|
|
185
|
-
button.v-dash.active .dash-line.longdash { color: var(--wox-accent, #00e5ff); }
|
|
186
|
-
.dash-line.dotdash { background: linear-gradient(to right, currentColor 8px, transparent 4px, currentColor 2px, transparent 4px); background-size: 18px 100%; color: var(--wox-text-secondary, #666); }
|
|
187
|
-
button.v-dash.active .dash-line.dotdash { color: var(--wox-accent, #00e5ff); }
|
|
188
|
-
.dash-line.zigzag { background: repeating-linear-gradient(45deg, currentColor, currentColor 2px, transparent 2px, transparent 4px); color: var(--wox-text-secondary, #666); }
|
|
189
|
-
button.v-dash.active .dash-line.zigzag { color: var(--wox-accent, #00e5ff); }
|
|
179
|
+
button.v-dash:hover { background: var(--wox-bg-hover, #2a2a2e); border-color: var(--wox-btn-border, var(--wox-border-light, #555)); transform: translateY(-1px); }
|
|
180
|
+
button.v-dash.active { border-color: var(--wox-btn-border, var(--wox-accent, #00e5ff)); box-shadow: var(--wox-shadow-accent, 0 0 10px rgba(0, 229, 255, 0.3)); }
|
|
181
|
+
.dash-line { width: 16px; height: 3px; background: var(--wox-btn-text, var(--wox-text-secondary, #666)); border-radius: 1px; }
|
|
182
|
+
button.v-dash.active .dash-line { background: var(--wox-btn-text, var(--wox-accent, #00e5ff)); }
|
|
183
|
+
.dash-line.dotted { background: radial-gradient(circle, currentColor 1px, transparent 1px); background-size: 4px 100%; color: var(--wox-btn-text, var(--wox-text-secondary, #666)); }
|
|
184
|
+
button.v-dash.active .dash-line.dotted { color: var(--wox-btn-text, var(--wox-accent, #00e5ff)); }
|
|
185
|
+
.dash-line.dashed { background: linear-gradient(to right, currentColor 6px, transparent 6px); background-size: 10px 100%; color: var(--wox-btn-text, var(--wox-text-secondary, #666)); }
|
|
186
|
+
button.v-dash.active .dash-line.dashed { color: var(--wox-btn-text, var(--wox-accent, #00e5ff)); }
|
|
187
|
+
.dash-line.longdash { background: linear-gradient(to right, currentColor 12px, transparent 4px); background-size: 16px 100%; color: var(--wox-btn-text, var(--wox-text-secondary, #666)); }
|
|
188
|
+
button.v-dash.active .dash-line.longdash { color: var(--wox-btn-text, var(--wox-accent, #00e5ff)); }
|
|
189
|
+
.dash-line.dotdash { background: linear-gradient(to right, currentColor 8px, transparent 4px, currentColor 2px, transparent 4px); background-size: 18px 100%; color: var(--wox-btn-text, var(--wox-text-secondary, #666)); }
|
|
190
|
+
button.v-dash.active .dash-line.dotdash { color: var(--wox-btn-text, var(--wox-accent, #00e5ff)); }
|
|
191
|
+
.dash-line.zigzag { background: repeating-linear-gradient(45deg, currentColor, currentColor 2px, transparent 2px, transparent 4px); color: var(--wox-btn-text, var(--wox-text-secondary, #666)); }
|
|
192
|
+
button.v-dash.active .dash-line.zigzag { color: var(--wox-btn-text, var(--wox-accent, #00e5ff)); }
|
|
190
193
|
|
|
191
194
|
.material-icons { font-family: 'Material Icons'; font-weight: normal; font-style: normal; display: inline-block; line-height: 1; text-transform: none; letter-spacing: normal; word-wrap: normal; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; }
|
|
192
|
-
` +
|
|
193
|
-
i || this.emit("wox-click", { originalEvent:
|
|
195
|
+
` + M, `<button class="${b}"${k}${E} ${i ? "disabled" : ""}>${g}</button>`), this.$("button").addEventListener("click", (z) => {
|
|
196
|
+
i || this.emit("wox-click", { originalEvent: z });
|
|
194
197
|
});
|
|
195
198
|
});
|
|
196
199
|
}
|
|
@@ -201,12 +204,12 @@ class U extends v {
|
|
|
201
204
|
this.isConnected && this._render();
|
|
202
205
|
}
|
|
203
206
|
}
|
|
204
|
-
s(
|
|
205
|
-
class
|
|
207
|
+
s(Y, "observedAttributes", ["variant", "icon", "label", "active", "disabled", "color", "size", "dash", "glow", "pulse", "border-color", "border-style", "icon-color", "text-color"]);
|
|
208
|
+
class X extends w {
|
|
206
209
|
constructor() {
|
|
207
210
|
super(...arguments);
|
|
208
211
|
s(this, "_render", () => {
|
|
209
|
-
const t = this.getAttribute("type") || "text", e = this.getAttribute("value") || "", n = this.getAttribute("unit") || "", o = this.getAttribute("label") || "", i = this.getAttribute("min"),
|
|
212
|
+
const t = this.getAttribute("type") || "text", e = this.getAttribute("value") || "", n = this.getAttribute("unit") || "", o = this.getAttribute("label") || "", i = this.getAttribute("min"), r = this.getAttribute("max"), a = this.getAttribute("step"), l = this.getAttribute("placeholder") || "", x = this.hasAttribute("disabled"), d = t === "number", u = d ? `${i !== null ? ` min="${i}"` : ""}${r !== null ? ` max="${r}"` : ""}${a !== null ? ` step="${a}"` : ""}` : "";
|
|
210
213
|
this.render(`
|
|
211
214
|
:host { display: inline-block; }
|
|
212
215
|
.wrapper { display: flex; flex-direction: column; gap: 3px; }
|
|
@@ -233,32 +236,32 @@ class Q extends v {
|
|
|
233
236
|
<div class="wrapper">
|
|
234
237
|
${o ? `<label class="${d ? "scrub" : ""}">${o}${n ? `<span class="unit">${n}</span>` : ""}</label>` : ""}
|
|
235
238
|
<div class="input-wrap">
|
|
236
|
-
<input type="${d ? "number" : "text"}" value="${e}" placeholder="${l}" ${u} ${
|
|
239
|
+
<input type="${d ? "number" : "text"}" value="${e}" placeholder="${l}" ${u} ${x ? "disabled" : ""} class="${n && !o ? "has-unit" : ""}">
|
|
237
240
|
${n && !o ? `<span class="suffix">${n}</span>` : ""}
|
|
238
241
|
</div>
|
|
239
242
|
</div>
|
|
240
243
|
`);
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
const
|
|
244
|
-
this.emit("wox-input", { value:
|
|
245
|
-
}),
|
|
246
|
-
const
|
|
247
|
-
this.emit("wox-change", { value:
|
|
248
|
-
}),
|
|
249
|
-
|
|
244
|
+
const h = this.$("input");
|
|
245
|
+
if (h.addEventListener("input", () => {
|
|
246
|
+
const v = d ? parseFloat(h.value) : h.value;
|
|
247
|
+
this.emit("wox-input", { value: v });
|
|
248
|
+
}), h.addEventListener("change", () => {
|
|
249
|
+
const v = d ? parseFloat(h.value) : h.value;
|
|
250
|
+
this.emit("wox-change", { value: v });
|
|
251
|
+
}), h.addEventListener("keydown", (v) => {
|
|
252
|
+
v.key === "Enter" && h.blur();
|
|
250
253
|
}), d && o) {
|
|
251
|
-
const
|
|
252
|
-
let
|
|
253
|
-
const
|
|
254
|
-
const
|
|
255
|
-
let
|
|
256
|
-
i !== null && (
|
|
257
|
-
},
|
|
258
|
-
document.removeEventListener("mousemove",
|
|
254
|
+
const v = this.$("label");
|
|
255
|
+
let b = 0, g = 0;
|
|
256
|
+
const f = (E) => {
|
|
257
|
+
const z = E.clientX - b, m = parseFloat(a) || 1;
|
|
258
|
+
let y = g + Math.round(z / 2) * m;
|
|
259
|
+
i !== null && (y = Math.max(parseFloat(i), y)), r !== null && (y = Math.min(parseFloat(r), y)), h.value = y, this.emit("wox-input", { value: y });
|
|
260
|
+
}, k = () => {
|
|
261
|
+
document.removeEventListener("mousemove", f), document.removeEventListener("mouseup", k), this.emit("wox-change", { value: parseFloat(h.value) });
|
|
259
262
|
};
|
|
260
|
-
|
|
261
|
-
|
|
263
|
+
v.addEventListener("mousedown", (E) => {
|
|
264
|
+
x || (b = E.clientX, g = parseFloat(h.value) || 0, document.addEventListener("mousemove", f), document.addEventListener("mouseup", k), E.preventDefault());
|
|
262
265
|
});
|
|
263
266
|
}
|
|
264
267
|
});
|
|
@@ -285,9 +288,9 @@ class Q extends v {
|
|
|
285
288
|
e && (e.value = t);
|
|
286
289
|
}
|
|
287
290
|
}
|
|
288
|
-
s(
|
|
289
|
-
const
|
|
290
|
-
class
|
|
291
|
+
s(X, "observedAttributes", ["type", "value", "unit", "label", "min", "max", "step", "placeholder", "disabled"]);
|
|
292
|
+
const $ = (p) => String(p).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
293
|
+
class q extends w {
|
|
291
294
|
constructor() {
|
|
292
295
|
super(...arguments);
|
|
293
296
|
s(this, "_isOpen", !1);
|
|
@@ -317,8 +320,8 @@ class Z extends v {
|
|
|
317
320
|
s(this, "_calculateDropdownPosition", () => {
|
|
318
321
|
const t = this.$(".trigger");
|
|
319
322
|
if (!t) return null;
|
|
320
|
-
const e = t.getBoundingClientRect(), n = window.innerHeight, o = window.innerWidth, i = n - e.bottom,
|
|
321
|
-
return this._openUpward ? { bottom: n - e.top + 2, left: l, width:
|
|
323
|
+
const e = t.getBoundingClientRect(), n = window.innerHeight, o = window.innerWidth, i = n - e.bottom, r = e.top, a = e.width, l = Math.max(0, Math.min(e.left, o - a));
|
|
324
|
+
return this._openUpward ? { bottom: n - e.top + 2, left: l, width: a, maxHeight: Math.max(100, Math.min(200, r - 10)) } : { top: e.bottom + 2, left: l, width: a, maxHeight: Math.max(100, Math.min(200, i - 10)) };
|
|
322
325
|
});
|
|
323
326
|
s(this, "_updateDropdownPosition", () => {
|
|
324
327
|
requestAnimationFrame(() => {
|
|
@@ -368,25 +371,25 @@ class Z extends v {
|
|
|
368
371
|
let e = "";
|
|
369
372
|
if (this.multiple && this._selectedOptions.length > 0) e = this._selectedOptions.map((o) => `
|
|
370
373
|
<span class="tag">
|
|
371
|
-
${o.image ? `<img src="${
|
|
372
|
-
${
|
|
373
|
-
<span class="remove-tag" data-value="${
|
|
374
|
+
${o.image ? `<img src="${$(o.image)}" class="tag-img" alt="">` : ""}
|
|
375
|
+
${$(o.label)}
|
|
376
|
+
<span class="remove-tag" data-value="${$(o.value)}">×</span>
|
|
374
377
|
</span>
|
|
375
378
|
`).join("");
|
|
376
379
|
else if (this._selectedOptions.length > 0) {
|
|
377
380
|
const o = this._selectedOptions[0];
|
|
378
381
|
e = `<span class="single-value">
|
|
379
|
-
${o.image ? `<img src="${
|
|
380
|
-
<span>${
|
|
382
|
+
${o.image ? `<img src="${$(o.image)}" class="single-img" alt="">` : ""}
|
|
383
|
+
<span>${$(o.label)}</span>
|
|
381
384
|
</span>`;
|
|
382
|
-
} else e = `<span class="placeholder">${
|
|
385
|
+
} else e = `<span class="placeholder">${$(this.placeholder)}</span>`;
|
|
383
386
|
let n = "";
|
|
384
|
-
if (this._isOpen && (n = `<div class="dropdown">${this.searchable ? `<input type="text" class="search-input" placeholder="Search..." value="${
|
|
385
|
-
class="option${this._selectedOptions.some((
|
|
386
|
-
data-value="${
|
|
387
|
+
if (this._isOpen && (n = `<div class="dropdown">${this.searchable ? `<input type="text" class="search-input" placeholder="Search..." value="${$(this._searchValue)}">` : ""}${this._filteredOptions.length > 0 ? this._filteredOptions.map((o, i) => `<div
|
|
388
|
+
class="option${this._selectedOptions.some((r) => r.value === o.value) ? " selected" : ""}${i === this._focusedIndex ? " focused" : ""}"
|
|
389
|
+
data-value="${$(o.value)}"
|
|
387
390
|
>
|
|
388
|
-
${o.image ? `<img src="${
|
|
389
|
-
<span>${
|
|
391
|
+
${o.image ? `<img src="${$(o.image)}" class="option-img" alt="">` : ""}
|
|
392
|
+
<span>${$(o.label)}</span>
|
|
390
393
|
</div>`).join("") : '<div class="no-options">No options found</div>'}</div>`), this.render(`
|
|
391
394
|
:host {
|
|
392
395
|
display: inline-block;
|
|
@@ -615,7 +618,7 @@ class Z extends v {
|
|
|
615
618
|
if (t === "options") {
|
|
616
619
|
this._parsedOptions = null;
|
|
617
620
|
const o = this.options;
|
|
618
|
-
this._filteredOptions = [...o], this._selectedOptions = this._selectedOptions.filter((i) => o.some((
|
|
621
|
+
this._filteredOptions = [...o], this._selectedOptions = this._selectedOptions.filter((i) => o.some((r) => r.value === i.value));
|
|
619
622
|
} else if (t === "value" && n !== null) {
|
|
620
623
|
const o = this.options.find((i) => i.value === n);
|
|
621
624
|
this._selectedOptions = o ? [o] : [];
|
|
@@ -706,8 +709,8 @@ class Z extends v {
|
|
|
706
709
|
this._selectedOptions = [], this._filteredOptions = [...t], this._parsedOptions = null, this.setAttribute("options", JSON.stringify(t));
|
|
707
710
|
}
|
|
708
711
|
}
|
|
709
|
-
s(
|
|
710
|
-
class
|
|
712
|
+
s(q, "observedAttributes", ["multiple", "searchable", "placeholder", "disabled", "value", "options"]);
|
|
713
|
+
class J extends w {
|
|
711
714
|
constructor() {
|
|
712
715
|
super();
|
|
713
716
|
s(this, "_getConfig", () => ({ min: parseFloat(this.getAttribute("min") ?? 0), max: parseFloat(this.getAttribute("max") ?? 100), step: parseFloat(this.getAttribute("step") ?? 1), unit: this.getAttribute("unit") || "" }));
|
|
@@ -716,11 +719,11 @@ class tt extends v {
|
|
|
716
719
|
return e === "%" ? Math.round(100 * t) + "%" : n < 1 ? t.toFixed(2) : String(t);
|
|
717
720
|
});
|
|
718
721
|
s(this, "_updateVisuals", () => {
|
|
719
|
-
const { min: t, max: e } = this._getConfig(), n = parseFloat(this.getAttribute("value") ?? t), o = (n - t) / (e - t) * 100, i = this.$(".fill"),
|
|
720
|
-
i && (i.style.width = o + "%"),
|
|
722
|
+
const { min: t, max: e } = this._getConfig(), n = parseFloat(this.getAttribute("value") ?? t), o = (n - t) / (e - t) * 100, i = this.$(".fill"), r = this.$(".thumb"), a = this.$(".value");
|
|
723
|
+
i && (i.style.width = o + "%"), r && (r.style.left = o + "%"), a && (a.textContent = this._formatVal(n));
|
|
721
724
|
});
|
|
722
725
|
s(this, "_build", () => {
|
|
723
|
-
const { min: t, max: e } = this._getConfig(), n = parseFloat(this.getAttribute("value") ?? t), o = this.getAttribute("label") || "", i = this.hasAttribute("show-value"),
|
|
726
|
+
const { min: t, max: e } = this._getConfig(), n = parseFloat(this.getAttribute("value") ?? t), o = this.getAttribute("label") || "", i = this.hasAttribute("show-value"), r = (n - t) / (e - t) * 100, a = this.getAttribute("color") || "", l = [this.hasAttribute("glow") ? "glow" : "", this.hasAttribute("pulse") ? "pulse" : ""].filter(Boolean).join(" "), x = a ? `--wox-fx-color:${a};border-color:${a}` : "", d = a ? " custom-color" : "";
|
|
724
727
|
this.render(`
|
|
725
728
|
:host { display: inline-block; width: 100%; }
|
|
726
729
|
.wrapper { display: flex; align-items: center; gap: var(--wox-space-lg, 12px); }
|
|
@@ -745,38 +748,38 @@ class tt extends v {
|
|
|
745
748
|
}
|
|
746
749
|
.fill.custom-color { background: var(--wox-fx-color); }
|
|
747
750
|
.thumb.glow { width: 16px; height: 16px; }
|
|
748
|
-
` +
|
|
751
|
+
` + M, `
|
|
749
752
|
<div class="wrapper">
|
|
750
753
|
${o ? `<span class="label">${o}</span>` : ""}
|
|
751
754
|
<div class="track-wrap">
|
|
752
|
-
<div class="track"><div class="fill${d}" style="width:${
|
|
753
|
-
<div class="thumb ${l}" style="${
|
|
755
|
+
<div class="track"><div class="fill${d}" style="width:${r}%;${a ? "--wox-fx-color:" + a : ""}"></div></div>
|
|
756
|
+
<div class="thumb ${l}" style="${x};left:${r}%"></div>
|
|
754
757
|
</div>
|
|
755
758
|
${i ? `<span class="value">${this._formatVal(n)}</span>` : ""}
|
|
756
759
|
</div>
|
|
757
760
|
`), this._attachDrag();
|
|
758
761
|
});
|
|
759
762
|
s(this, "_attachDrag", () => {
|
|
760
|
-
const { min: t, max: e, step: n, unit: o } = this._getConfig(), i = this.$(".track-wrap"),
|
|
761
|
-
const
|
|
762
|
-
let
|
|
763
|
-
|
|
764
|
-
let
|
|
765
|
-
|
|
766
|
-
const
|
|
767
|
-
return
|
|
768
|
-
}, d = (
|
|
769
|
-
const
|
|
770
|
-
this.emit("wox-input", { value:
|
|
771
|
-
}, u = (
|
|
772
|
-
this._dragging = !1,
|
|
773
|
-
const
|
|
774
|
-
this.setAttribute("value",
|
|
763
|
+
const { min: t, max: e, step: n, unit: o } = this._getConfig(), i = this.$(".track-wrap"), r = this.$(".fill"), a = this.$(".thumb"), l = this.$(".value"), x = (h) => {
|
|
764
|
+
const v = i.getBoundingClientRect();
|
|
765
|
+
let b = (h - v.left) / v.width;
|
|
766
|
+
b = Math.max(0, Math.min(1, b));
|
|
767
|
+
let g = t + b * (e - t);
|
|
768
|
+
g = Math.round(g / n) * n, g = Math.max(t, Math.min(e, g));
|
|
769
|
+
const f = (g - t) / (e - t) * 100;
|
|
770
|
+
return r.style.width = f + "%", a.style.left = f + "%", l && (l.textContent = o === "%" ? Math.round(100 * g) + "%" : n < 1 ? g.toFixed(2) : String(g)), g;
|
|
771
|
+
}, d = (h) => {
|
|
772
|
+
const v = x(h.clientX);
|
|
773
|
+
this.emit("wox-input", { value: v });
|
|
774
|
+
}, u = (h) => {
|
|
775
|
+
this._dragging = !1, a.classList.remove("dragging"), document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u);
|
|
776
|
+
const v = x(h.clientX);
|
|
777
|
+
this.setAttribute("value", v), this.emit("wox-change", { value: v });
|
|
775
778
|
};
|
|
776
|
-
i.addEventListener("mousedown", (
|
|
777
|
-
this._dragging = !0,
|
|
778
|
-
const
|
|
779
|
-
this.emit("wox-input", { value:
|
|
779
|
+
i.addEventListener("mousedown", (h) => {
|
|
780
|
+
this._dragging = !0, a.classList.add("dragging");
|
|
781
|
+
const v = x(h.clientX);
|
|
782
|
+
this.emit("wox-input", { value: v }), document.addEventListener("mousemove", d), document.addEventListener("mouseup", u), h.preventDefault();
|
|
780
783
|
});
|
|
781
784
|
});
|
|
782
785
|
this._dragging = !1;
|
|
@@ -788,12 +791,12 @@ class tt extends v {
|
|
|
788
791
|
this.isConnected && (this._dragging || (t === "value" ? this._updateVisuals() : this._build()));
|
|
789
792
|
}
|
|
790
793
|
}
|
|
791
|
-
s(
|
|
792
|
-
class
|
|
794
|
+
s(J, "observedAttributes", ["value", "min", "max", "step", "label", "unit", "show-value", "color", "glow", "pulse"]);
|
|
795
|
+
class K extends w {
|
|
793
796
|
constructor() {
|
|
794
797
|
super(...arguments);
|
|
795
798
|
s(this, "_render", () => {
|
|
796
|
-
const t = this.getAttribute("color") || "transparent", e = this.getAttribute("size") || "24", n = this.hasAttribute("selected"), o = this.hasAttribute("glow"), i = this.hasAttribute("pulse"),
|
|
799
|
+
const t = this.getAttribute("color") || "transparent", e = this.getAttribute("size") || "24", n = this.hasAttribute("selected"), o = this.hasAttribute("glow"), i = this.hasAttribute("pulse"), r = [n ? "selected" : "", o ? "glow" : "", i ? "pulse" : ""].filter(Boolean).join(" "), a = o || i ? ` style="--wox-fx-color:${t}"` : "";
|
|
797
800
|
this.render(`
|
|
798
801
|
:host { display: inline-block; }
|
|
799
802
|
.swatch {
|
|
@@ -811,7 +814,7 @@ class et extends v {
|
|
|
811
814
|
background: repeating-conic-gradient(#888 0% 25%, #fff 0% 50%) 0 0 / 8px 8px;
|
|
812
815
|
}
|
|
813
816
|
.color { position: absolute; inset: 0; }
|
|
814
|
-
${
|
|
817
|
+
${M} :host { --size: ${e}px; }`, `<div class="swatch ${r}"${a}>
|
|
815
818
|
<div class="checker"></div>
|
|
816
819
|
<div class="color" style="background:${t}"></div>
|
|
817
820
|
</div>`), this.$(".swatch").addEventListener("click", () => {
|
|
@@ -826,8 +829,8 @@ class et extends v {
|
|
|
826
829
|
this.isConnected && this._render();
|
|
827
830
|
}
|
|
828
831
|
}
|
|
829
|
-
s(
|
|
830
|
-
class
|
|
832
|
+
s(K, "observedAttributes", ["color", "size", "selected", "glow", "pulse"]);
|
|
833
|
+
class V extends w {
|
|
831
834
|
constructor() {
|
|
832
835
|
super(...arguments);
|
|
833
836
|
s(this, "_render", () => {
|
|
@@ -851,9 +854,9 @@ class nt extends v {
|
|
|
851
854
|
s(this, "_position", () => {
|
|
852
855
|
const t = this.shadowRoot.querySelector(".tip");
|
|
853
856
|
if (!t) return;
|
|
854
|
-
const e = this.getAttribute("position") || "top", n = this.getBoundingClientRect(), o = t.getBoundingClientRect(), i = window.innerWidth,
|
|
857
|
+
const e = this.getAttribute("position") || "top", n = this.getBoundingClientRect(), o = t.getBoundingClientRect(), i = window.innerWidth, r = window.innerHeight, a = { top: n.top - 6 - o.height >= 0, bottom: n.bottom + 6 + o.height <= r, left: n.left - 6 - o.width >= 0, right: n.right + 6 + o.width <= i }, l = { top: "bottom", bottom: "top", left: "right", right: "left" }, x = [e, l[e], ...["top", "bottom", "left", "right"].filter((h) => h !== e && h !== l[e])].find((h) => a[h]) || e;
|
|
855
858
|
let d, u;
|
|
856
|
-
|
|
859
|
+
x === "top" ? (d = n.top - 6 - o.height, u = n.left + n.width / 2 - o.width / 2) : x === "bottom" ? (d = n.bottom + 6, u = n.left + n.width / 2 - o.width / 2) : x === "left" ? (d = n.top + n.height / 2 - o.height / 2, u = n.left - 6 - o.width) : (d = n.top + n.height / 2 - o.height / 2, u = n.right + 6), u = Math.max(4, Math.min(u, i - o.width - 4)), d = Math.max(4, Math.min(d, r - o.height - 4)), t.style.top = `${d}px`, t.style.left = `${u}px`;
|
|
857
860
|
});
|
|
858
861
|
}
|
|
859
862
|
connectedCallback() {
|
|
@@ -863,8 +866,8 @@ class nt extends v {
|
|
|
863
866
|
this.isConnected && this._render();
|
|
864
867
|
}
|
|
865
868
|
}
|
|
866
|
-
s(
|
|
867
|
-
class
|
|
869
|
+
s(V, "observedAttributes", ["text", "position", "delay"]);
|
|
870
|
+
class U extends w {
|
|
868
871
|
constructor() {
|
|
869
872
|
super();
|
|
870
873
|
s(this, "_initFromAttrs", () => {
|
|
@@ -973,21 +976,21 @@ class ot extends v {
|
|
|
973
976
|
const t = this._wCtx, e = 220;
|
|
974
977
|
t.clearRect(0, 0, e, e);
|
|
975
978
|
const n = t.createConicGradient(-Math.PI / 2, 110, 110);
|
|
976
|
-
for (let
|
|
979
|
+
for (let h = 0; h <= 36; h++) n.addColorStop(h / 36, `hsl(${10 * h},100%,50%)`);
|
|
977
980
|
t.fillStyle = n, t.beginPath(), t.arc(110, 110, 104, 0, 2 * Math.PI), t.fill(), t.save(), t.globalCompositeOperation = "destination-out", t.beginPath(), t.arc(110, 110, 78, 0, 2 * Math.PI), t.fill(), t.restore(), t.strokeStyle = "rgba(0,0,0,0.25)", t.lineWidth = 1, t.beginPath(), t.arc(110, 110, 103.5, 0, 2 * Math.PI), t.stroke(), t.beginPath(), t.arc(110, 110, 78.5, 0, 2 * Math.PI), t.stroke();
|
|
978
|
-
const o = this._hue * Math.PI * 2 - Math.PI / 2, i = 110 + 91 * Math.cos(o),
|
|
979
|
-
t.strokeStyle = "#fff", t.lineWidth = 2.5, t.beginPath(), t.arc(i,
|
|
980
|
-
const
|
|
981
|
-
l.addColorStop(0, "#fff"), l.addColorStop(1, `hsl(${360 * this._hue},100%,50%)`), t.fillStyle = l, t.fillRect(58, 58,
|
|
982
|
-
const
|
|
983
|
-
|
|
984
|
-
const d = 58 + this._sat *
|
|
981
|
+
const o = this._hue * Math.PI * 2 - Math.PI / 2, i = 110 + 91 * Math.cos(o), r = 110 + 91 * Math.sin(o);
|
|
982
|
+
t.strokeStyle = "#fff", t.lineWidth = 2.5, t.beginPath(), t.arc(i, r, 8, 0, 2 * Math.PI), t.stroke(), t.strokeStyle = "rgba(0,0,0,0.4)", t.lineWidth = 1, t.beginPath(), t.arc(i, r, 8, 0, 2 * Math.PI), t.stroke();
|
|
983
|
+
const a = 104, l = t.createLinearGradient(58, 0, 162, 0);
|
|
984
|
+
l.addColorStop(0, "#fff"), l.addColorStop(1, `hsl(${360 * this._hue},100%,50%)`), t.fillStyle = l, t.fillRect(58, 58, a, a);
|
|
985
|
+
const x = t.createLinearGradient(0, 58, 0, 162);
|
|
986
|
+
x.addColorStop(0, "rgba(0,0,0,0)"), x.addColorStop(1, "rgba(0,0,0,1)"), t.fillStyle = x, t.fillRect(58, 58, a, a);
|
|
987
|
+
const d = 58 + this._sat * a, u = 58 + (1 - this._val) * a;
|
|
985
988
|
t.strokeStyle = "#fff", t.lineWidth = 2.5, t.beginPath(), t.arc(d, u, 7, 0, 2 * Math.PI), t.stroke(), t.strokeStyle = "rgba(0,0,0,0.4)", t.lineWidth = 1, t.beginPath(), t.arc(d, u, 7, 0, 2 * Math.PI), t.stroke();
|
|
986
989
|
});
|
|
987
990
|
s(this, "_drawAlpha", () => {
|
|
988
991
|
const t = this._aCtx;
|
|
989
992
|
t.clearRect(0, 0, 192, 14);
|
|
990
|
-
for (let
|
|
993
|
+
for (let r = 0; r < 192; r += 8) for (let a = 0; a < 14; a += 8) t.fillStyle = (r / 8 + a / 8) % 2 == 0 ? "#aaa" : "#fff", t.fillRect(r, a, 8, 8);
|
|
991
994
|
const [e, n, o] = this._hsvToRgb(this._hue, this._sat, this._val), i = t.createLinearGradient(0, 0, 192, 0);
|
|
992
995
|
i.addColorStop(0, `rgba(${e},${n},${o},0)`), i.addColorStop(1, `rgba(${e},${n},${o},1)`), t.fillStyle = i, t.fillRect(0, 0, 192, 14), this._alphaKnob.style.left = 192 * this._alpha - 7 + "px";
|
|
993
996
|
});
|
|
@@ -1022,16 +1025,16 @@ class ot extends v {
|
|
|
1022
1025
|
});
|
|
1023
1026
|
s(this, "_hsvToRgb", (t, e, n) => {
|
|
1024
1027
|
const o = (i) => {
|
|
1025
|
-
const
|
|
1026
|
-
return n - n * e * Math.max(0, Math.min(
|
|
1028
|
+
const r = (i + 6 * t) % 6;
|
|
1029
|
+
return n - n * e * Math.max(0, Math.min(r, 4 - r, 1));
|
|
1027
1030
|
};
|
|
1028
1031
|
return [Math.round(255 * o(5)), Math.round(255 * o(3)), Math.round(255 * o(1))];
|
|
1029
1032
|
});
|
|
1030
1033
|
s(this, "_rgbToHsv", (t, e, n) => {
|
|
1031
1034
|
t /= 255, e /= 255, n /= 255;
|
|
1032
1035
|
const o = Math.max(t, e, n), i = o - Math.min(t, e, n);
|
|
1033
|
-
let
|
|
1034
|
-
return i && (
|
|
1036
|
+
let r = 0;
|
|
1037
|
+
return i && (r = o === t ? ((e - n) / i % 6 + 6) % 6 : o === e ? (n - t) / i + 2 : (t - e) / i + 4), [r / 6, o ? i / o : 0, o];
|
|
1035
1038
|
});
|
|
1036
1039
|
s(this, "_hexToRgb", (t) => {
|
|
1037
1040
|
const e = parseInt(t.slice(1), 16);
|
|
@@ -1050,8 +1053,8 @@ class ot extends v {
|
|
|
1050
1053
|
} else t !== "color" && t !== "alpha" || (this._initFromAttrs(), this.hasAttribute("open") && this._redraw());
|
|
1051
1054
|
}
|
|
1052
1055
|
}
|
|
1053
|
-
s(
|
|
1054
|
-
const
|
|
1056
|
+
s(U, "observedAttributes", ["color", "alpha", "open"]);
|
|
1057
|
+
const P = `
|
|
1055
1058
|
:host { display: block; }
|
|
1056
1059
|
.item {
|
|
1057
1060
|
color: var(--wox-text-primary, #eee); padding: 8px 12px; display: flex; align-items: center;
|
|
@@ -1072,21 +1075,21 @@ const T = `
|
|
|
1072
1075
|
}
|
|
1073
1076
|
.material-icons { font-family: 'Material Icons'; font-weight: normal; font-style: normal; display: inline-block; line-height: 1; text-transform: none; letter-spacing: normal; word-wrap: normal; white-space: nowrap; direction: ltr; -webkit-font-smoothing: antialiased; }
|
|
1074
1077
|
`;
|
|
1075
|
-
class
|
|
1078
|
+
class Q extends w {
|
|
1076
1079
|
constructor() {
|
|
1077
1080
|
super(...arguments);
|
|
1078
1081
|
s(this, "_render", () => {
|
|
1079
|
-
const t = this.getAttribute("type") || "item", e = this.getAttribute("label") || "", n = this.getAttribute("shortcut") || "", o = this.getAttribute("icon") || "", i = this.hasAttribute("disabled"),
|
|
1080
|
-
t !== "separator" ? t !== "header" ? (this.render(
|
|
1082
|
+
const t = this.getAttribute("type") || "item", e = this.getAttribute("label") || "", n = this.getAttribute("shortcut") || "", o = this.getAttribute("icon") || "", i = this.hasAttribute("disabled"), r = this.hasAttribute("submenu");
|
|
1083
|
+
t !== "separator" ? t !== "header" ? (this.render(P, `
|
|
1081
1084
|
<div class="item ${i ? "disabled" : ""}">
|
|
1082
1085
|
${o ? `<span class="icon material-icons">${o}</span>` : ""}
|
|
1083
1086
|
<span class="label">${e}</span>
|
|
1084
1087
|
${n ? `<span class="shortcut">${n}</span>` : ""}
|
|
1085
|
-
${
|
|
1088
|
+
${r ? '<span class="arrow">▶</span>' : ""}
|
|
1086
1089
|
</div>
|
|
1087
1090
|
`), i || this.$(".item").addEventListener("click", () => {
|
|
1088
1091
|
this.emit("wox-select", { label: e });
|
|
1089
|
-
})) : this.render(
|
|
1092
|
+
})) : this.render(P, `<div class="header">${e}</div>`) : this.render(P, '<div class="separator"></div>');
|
|
1090
1093
|
});
|
|
1091
1094
|
}
|
|
1092
1095
|
connectedCallback() {
|
|
@@ -1096,8 +1099,8 @@ class it extends v {
|
|
|
1096
1099
|
this.isConnected && this._render();
|
|
1097
1100
|
}
|
|
1098
1101
|
}
|
|
1099
|
-
s(
|
|
1100
|
-
class
|
|
1102
|
+
s(Q, "observedAttributes", ["label", "shortcut", "icon", "disabled", "type", "submenu"]);
|
|
1103
|
+
class Z extends w {
|
|
1101
1104
|
constructor() {
|
|
1102
1105
|
super(...arguments);
|
|
1103
1106
|
s(this, "_render", () => {
|
|
@@ -1124,7 +1127,7 @@ class st extends v {
|
|
|
1124
1127
|
`);
|
|
1125
1128
|
const o = this.$(".trigger");
|
|
1126
1129
|
this.$(".dropdown"), n === "click" ? o.addEventListener("click", (i) => {
|
|
1127
|
-
i.stopPropagation(), this._toggle();
|
|
1130
|
+
i.stopPropagation(), this.children.length === 0 ? this.emit("wox-click", { label: this.getAttribute("label") || "" }) : this._toggle();
|
|
1128
1131
|
}) : n === "hover" && (this.addEventListener("mouseenter", () => this._open()), this.addEventListener("mouseleave", () => this._close())), this._outsideClick = (i) => {
|
|
1129
1132
|
!this.contains(i.target) && this.hasAttribute("open") && this._close();
|
|
1130
1133
|
}, document.addEventListener("mousedown", this._outsideClick), this.addEventListener("wox-select", () => this._close());
|
|
@@ -1139,10 +1142,10 @@ class st extends v {
|
|
|
1139
1142
|
requestAnimationFrame(() => {
|
|
1140
1143
|
const t = this.$(".trigger"), e = this.$(".dropdown");
|
|
1141
1144
|
if (!t || !e) return;
|
|
1142
|
-
const n = t.getBoundingClientRect(), o = window.innerWidth, i = window.innerHeight,
|
|
1143
|
-
n.left +
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1145
|
+
const n = t.getBoundingClientRect(), o = window.innerWidth, i = window.innerHeight, r = e.getBoundingClientRect();
|
|
1146
|
+
n.left + r.width > o ? e.style.left = n.right - r.width + "px" : e.style.left = `${n.left}px`;
|
|
1147
|
+
const a = i - n.bottom, l = n.top;
|
|
1148
|
+
a >= r.height || a >= l ? (e.style.top = `${n.bottom}px`, e.style.bottom = "") : (e.style.top = "", e.style.bottom = i - n.top + "px");
|
|
1146
1149
|
});
|
|
1147
1150
|
});
|
|
1148
1151
|
s(this, "_close", () => {
|
|
@@ -1165,13 +1168,13 @@ class st extends v {
|
|
|
1165
1168
|
this._outsideClick && document.removeEventListener("mousedown", this._outsideClick);
|
|
1166
1169
|
}
|
|
1167
1170
|
}
|
|
1168
|
-
s(
|
|
1169
|
-
const
|
|
1170
|
-
class
|
|
1171
|
+
s(Z, "observedAttributes", ["label", "open", "trigger"]);
|
|
1172
|
+
const $t = { rectangle: "crop_square", ellipse: "radio_button_unchecked", path: "timeline", image: "image", text: "text_fields", group: "folder", layer: "layers" };
|
|
1173
|
+
class tt extends w {
|
|
1171
1174
|
constructor() {
|
|
1172
1175
|
super(...arguments);
|
|
1173
1176
|
s(this, "_render", () => {
|
|
1174
|
-
const t = this.getAttribute("name") || "Layer", e = this.getAttribute("type") || "layer", n = this.hasAttribute("visible"), o = this.hasAttribute("locked"), i = this.hasAttribute("selected"),
|
|
1177
|
+
const t = this.getAttribute("name") || "Layer", e = this.getAttribute("type") || "layer", n = this.hasAttribute("visible"), o = this.hasAttribute("locked"), i = this.hasAttribute("selected"), r = $t[e] || "layers";
|
|
1175
1178
|
this.render(`
|
|
1176
1179
|
:host { display: block; }
|
|
1177
1180
|
.layer {
|
|
@@ -1199,19 +1202,19 @@ class at extends v {
|
|
|
1199
1202
|
.toggle:hover, .toggle.on { opacity: 1; color: var(--wox-accent, #00e5ff); }
|
|
1200
1203
|
`, `
|
|
1201
1204
|
<div class="layer ${i ? "selected" : ""}">
|
|
1202
|
-
<span class="type-icon material-icons">${
|
|
1205
|
+
<span class="type-icon material-icons">${r}</span>
|
|
1203
1206
|
<span class="name">${t}</span>
|
|
1204
1207
|
<span class="toggle eye ${n ? "on" : ""} material-icons">${n ? "visibility" : "visibility_off"}</span>
|
|
1205
1208
|
<span class="toggle lock ${o ? "on" : ""} material-icons">${o ? "lock" : "lock_open"}</span>
|
|
1206
1209
|
</div>
|
|
1207
|
-
`), this.$(".layer").addEventListener("click", (
|
|
1208
|
-
|
|
1209
|
-
}), this.$(".name").addEventListener("dblclick", () => this._startEditing()), this.$(".eye").addEventListener("click", (
|
|
1210
|
-
|
|
1210
|
+
`), this.$(".layer").addEventListener("click", (a) => {
|
|
1211
|
+
a.target.closest(".toggle") || this.emit("wox-select", { name: t });
|
|
1212
|
+
}), this.$(".name").addEventListener("dblclick", () => this._startEditing()), this.$(".eye").addEventListener("click", (a) => {
|
|
1213
|
+
a.stopPropagation();
|
|
1211
1214
|
const l = !n;
|
|
1212
1215
|
l ? this.setAttribute("visible", "") : this.removeAttribute("visible"), this.emit("wox-visibility", { visible: l });
|
|
1213
|
-
}), this.$(".lock").addEventListener("click", (
|
|
1214
|
-
|
|
1216
|
+
}), this.$(".lock").addEventListener("click", (a) => {
|
|
1217
|
+
a.stopPropagation();
|
|
1215
1218
|
const l = !o;
|
|
1216
1219
|
l ? this.setAttribute("locked", "") : this.removeAttribute("locked"), this.emit("wox-lock", { locked: l });
|
|
1217
1220
|
});
|
|
@@ -1235,8 +1238,8 @@ class at extends v {
|
|
|
1235
1238
|
this.isConnected && !this._editing && this._render();
|
|
1236
1239
|
}
|
|
1237
1240
|
}
|
|
1238
|
-
s(
|
|
1239
|
-
class
|
|
1241
|
+
s(tt, "observedAttributes", ["name", "type", "visible", "locked", "selected", "depth"]);
|
|
1242
|
+
class et extends w {
|
|
1240
1243
|
constructor() {
|
|
1241
1244
|
super(...arguments);
|
|
1242
1245
|
s(this, "_render", () => {
|
|
@@ -1293,8 +1296,8 @@ class rt extends v {
|
|
|
1293
1296
|
this.isConnected && this._render();
|
|
1294
1297
|
}
|
|
1295
1298
|
}
|
|
1296
|
-
s(
|
|
1297
|
-
class
|
|
1299
|
+
s(et, "observedAttributes", ["title", "collapsed", "icon"]);
|
|
1300
|
+
class nt extends w {
|
|
1298
1301
|
connectedCallback() {
|
|
1299
1302
|
this.render(`
|
|
1300
1303
|
:host { display: none; flex: 1; overflow-y: auto; overflow-x: hidden; flex-direction: column; }
|
|
@@ -1302,8 +1305,8 @@ class dt extends v {
|
|
|
1302
1305
|
`, "<slot></slot>");
|
|
1303
1306
|
}
|
|
1304
1307
|
}
|
|
1305
|
-
s(
|
|
1306
|
-
class
|
|
1308
|
+
s(nt, "observedAttributes", ["name", "label", "icon", "active"]);
|
|
1309
|
+
class ot extends w {
|
|
1307
1310
|
constructor() {
|
|
1308
1311
|
super(...arguments);
|
|
1309
1312
|
s(this, "_render", () => {
|
|
@@ -1359,9 +1362,9 @@ class lt extends v {
|
|
|
1359
1362
|
t.innerHTML = "";
|
|
1360
1363
|
const e = this._getTabs(), n = this.getAttribute("active") || ((o = e[0]) == null ? void 0 : o.getAttribute("name")) || "";
|
|
1361
1364
|
e.forEach((i) => {
|
|
1362
|
-
const
|
|
1363
|
-
l.className = "tab-btn" + (
|
|
1364
|
-
this.setAttribute("active",
|
|
1365
|
+
const r = i.getAttribute("name") || "", a = i.getAttribute("label") || r, l = document.createElement("button");
|
|
1366
|
+
l.className = "tab-btn" + (r === n ? " active" : ""), l.textContent = a, l.addEventListener("click", () => {
|
|
1367
|
+
this.setAttribute("active", r), this.emit("wox-tab-change", { name: r });
|
|
1365
1368
|
}), t.appendChild(l);
|
|
1366
1369
|
}), this._updateActive();
|
|
1367
1370
|
});
|
|
@@ -1371,9 +1374,9 @@ class lt extends v {
|
|
|
1371
1374
|
t.forEach((o) => {
|
|
1372
1375
|
(o.getAttribute("name") || "") === e ? o.setAttribute("active", "") : o.removeAttribute("active");
|
|
1373
1376
|
}), this.$$(".tab-btn").forEach((o, i) => {
|
|
1374
|
-
var
|
|
1375
|
-
const
|
|
1376
|
-
o.classList.toggle("active",
|
|
1377
|
+
var a;
|
|
1378
|
+
const r = ((a = t[i]) == null ? void 0 : a.getAttribute("name")) || "";
|
|
1379
|
+
o.classList.toggle("active", r === e);
|
|
1377
1380
|
});
|
|
1378
1381
|
});
|
|
1379
1382
|
s(this, "_getTabs", () => [...this.querySelectorAll(":scope > wox-tab")]);
|
|
@@ -1385,8 +1388,8 @@ class lt extends v {
|
|
|
1385
1388
|
this.isConnected && this._updateActive();
|
|
1386
1389
|
}
|
|
1387
1390
|
}
|
|
1388
|
-
s(
|
|
1389
|
-
class
|
|
1391
|
+
s(ot, "observedAttributes", ["active", "placement"]);
|
|
1392
|
+
class it extends w {
|
|
1390
1393
|
constructor() {
|
|
1391
1394
|
super(...arguments);
|
|
1392
1395
|
s(this, "_render", () => {
|
|
@@ -1408,8 +1411,8 @@ class ct extends v {
|
|
|
1408
1411
|
this.isConnected && this._render();
|
|
1409
1412
|
}
|
|
1410
1413
|
}
|
|
1411
|
-
s(
|
|
1412
|
-
class
|
|
1414
|
+
s(it, "observedAttributes", ["label"]);
|
|
1415
|
+
class st extends w {
|
|
1413
1416
|
constructor() {
|
|
1414
1417
|
super(...arguments);
|
|
1415
1418
|
s(this, "_render", () => {
|
|
@@ -1433,8 +1436,8 @@ class pt extends v {
|
|
|
1433
1436
|
this.isConnected && this._render();
|
|
1434
1437
|
}
|
|
1435
1438
|
}
|
|
1436
|
-
s(
|
|
1437
|
-
class
|
|
1439
|
+
s(st, "observedAttributes", ["width", "position"]);
|
|
1440
|
+
class rt extends w {
|
|
1438
1441
|
constructor() {
|
|
1439
1442
|
super(...arguments);
|
|
1440
1443
|
s(this, "_render", () => {
|
|
@@ -1460,14 +1463,14 @@ class ht extends v {
|
|
|
1460
1463
|
const n = this.$(".resizer");
|
|
1461
1464
|
if (!n) return;
|
|
1462
1465
|
let o = 0, i = 0;
|
|
1463
|
-
const
|
|
1464
|
-
const d =
|
|
1466
|
+
const r = this.getAttribute("position") === "left", a = (x) => {
|
|
1467
|
+
const d = r ? x.clientX - o : o - x.clientX, u = Math.max(180, Math.min(600, i + d));
|
|
1465
1468
|
this.style.width = u + "px";
|
|
1466
1469
|
}, l = () => {
|
|
1467
|
-
document.removeEventListener("mousemove",
|
|
1470
|
+
document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", l);
|
|
1468
1471
|
};
|
|
1469
|
-
n.addEventListener("mousedown", (
|
|
1470
|
-
o =
|
|
1472
|
+
n.addEventListener("mousedown", (x) => {
|
|
1473
|
+
o = x.clientX, i = this.getBoundingClientRect().width, document.addEventListener("mousemove", a), document.addEventListener("mouseup", l), x.preventDefault();
|
|
1471
1474
|
});
|
|
1472
1475
|
}
|
|
1473
1476
|
});
|
|
@@ -1479,8 +1482,8 @@ class ht extends v {
|
|
|
1479
1482
|
this.isConnected && this._render();
|
|
1480
1483
|
}
|
|
1481
1484
|
}
|
|
1482
|
-
s(
|
|
1483
|
-
class
|
|
1485
|
+
s(rt, "observedAttributes", ["width", "position", "resizable"]);
|
|
1486
|
+
class at extends w {
|
|
1484
1487
|
constructor() {
|
|
1485
1488
|
super(...arguments);
|
|
1486
1489
|
s(this, "_render", () => {
|
|
@@ -1506,8 +1509,8 @@ class xt extends v {
|
|
|
1506
1509
|
this.isConnected && this._render();
|
|
1507
1510
|
}
|
|
1508
1511
|
}
|
|
1509
|
-
s(
|
|
1510
|
-
class
|
|
1512
|
+
s(at, "observedAttributes", ["height"]);
|
|
1513
|
+
class dt extends w {
|
|
1511
1514
|
constructor() {
|
|
1512
1515
|
super(...arguments);
|
|
1513
1516
|
s(this, "_render", () => {
|
|
@@ -1535,12 +1538,12 @@ class ut extends v {
|
|
|
1535
1538
|
this.isConnected && this._render();
|
|
1536
1539
|
}
|
|
1537
1540
|
}
|
|
1538
|
-
s(
|
|
1539
|
-
class
|
|
1541
|
+
s(dt, "observedAttributes", ["height"]);
|
|
1542
|
+
class lt extends w {
|
|
1540
1543
|
constructor() {
|
|
1541
1544
|
super(...arguments);
|
|
1542
1545
|
s(this, "_render", () => {
|
|
1543
|
-
const t = this.getAttribute("title") || "", e = !this.hasAttribute("closable") || this.getAttribute("closable") !== "false", n = this.getAttribute("width") || "400px", o = this.getAttribute("color") || "", i = [this.hasAttribute("glow") ? "glow" : "", this.hasAttribute("pulse") ? "pulse" : ""].filter(Boolean).join(" "),
|
|
1546
|
+
const t = this.getAttribute("title") || "", e = !this.hasAttribute("closable") || this.getAttribute("closable") !== "false", n = this.getAttribute("width") || "400px", o = this.getAttribute("color") || "", i = [this.hasAttribute("glow") ? "glow" : "", this.hasAttribute("pulse") ? "pulse" : ""].filter(Boolean).join(" "), r = o ? ` style="--wox-fx-color:${o}"` : "";
|
|
1544
1547
|
this.render(`
|
|
1545
1548
|
:host { display: none; }
|
|
1546
1549
|
:host([open]) { display: block; }
|
|
@@ -1577,9 +1580,9 @@ class gt extends v {
|
|
|
1577
1580
|
.btn-secondary:hover { background: var(--wox-border-light, #444); }
|
|
1578
1581
|
.btn-primary { background: var(--wox-accent, #00e5ff); color: var(--wox-text-hi, #fff); }
|
|
1579
1582
|
.btn-primary:hover { filter: brightness(0.85); }
|
|
1580
|
-
${
|
|
1583
|
+
${M} .box { --width: ${n}; }`, `
|
|
1581
1584
|
<div class="overlay">
|
|
1582
|
-
<div class="box ${i}"${
|
|
1585
|
+
<div class="box ${i}"${r}>
|
|
1583
1586
|
<div class="header">
|
|
1584
1587
|
<span class="title">${t}</span>
|
|
1585
1588
|
${e ? '<button class="close-btn">✕</button>' : ""}
|
|
@@ -1596,16 +1599,16 @@ class gt extends v {
|
|
|
1596
1599
|
`), this.$(".overlay").addEventListener("click", (d) => {
|
|
1597
1600
|
d.target === this.$(".overlay") && (this.removeAttribute("open"), this.emit("wox-close", {}));
|
|
1598
1601
|
});
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1602
|
+
const a = this.$(".close-btn");
|
|
1603
|
+
a && a.addEventListener("click", () => {
|
|
1601
1604
|
this.removeAttribute("open"), this.emit("wox-close", {});
|
|
1602
1605
|
});
|
|
1603
1606
|
const l = this.$(".cancel-btn");
|
|
1604
1607
|
l && l.addEventListener("click", () => {
|
|
1605
1608
|
this.removeAttribute("open"), this.emit("wox-cancel", {});
|
|
1606
1609
|
});
|
|
1607
|
-
const
|
|
1608
|
-
|
|
1610
|
+
const x = this.$(".ok-btn");
|
|
1611
|
+
x && x.addEventListener("click", () => {
|
|
1609
1612
|
this.removeAttribute("open"), this.emit("wox-confirm", {});
|
|
1610
1613
|
});
|
|
1611
1614
|
});
|
|
@@ -1641,8 +1644,8 @@ class gt extends v {
|
|
|
1641
1644
|
t ? this.setAttribute("open", "") : this.removeAttribute("open");
|
|
1642
1645
|
}
|
|
1643
1646
|
}
|
|
1644
|
-
s(
|
|
1645
|
-
class
|
|
1647
|
+
s(lt, "observedAttributes", ["open", "title", "closable", "width", "color", "glow", "pulse"]);
|
|
1648
|
+
class vt extends w {
|
|
1646
1649
|
constructor() {
|
|
1647
1650
|
super(...arguments);
|
|
1648
1651
|
s(this, "_columns", []);
|
|
@@ -1655,26 +1658,26 @@ class yt extends v {
|
|
|
1655
1658
|
if (!this._sortKey) return this._rows;
|
|
1656
1659
|
const t = this._sortKey, e = this._sortDir === "asc" ? 1 : -1;
|
|
1657
1660
|
return [...this._rows].sort((n, o) => {
|
|
1658
|
-
const i = n[t],
|
|
1659
|
-
return i == null &&
|
|
1661
|
+
const i = n[t], r = o[t];
|
|
1662
|
+
return i == null && r == null ? 0 : i == null ? e : r == null ? -e : typeof i == "number" && typeof r == "number" ? (i - r) * e : String(i).localeCompare(String(r)) * e;
|
|
1660
1663
|
});
|
|
1661
1664
|
});
|
|
1662
1665
|
s(this, "_render", () => {
|
|
1663
1666
|
const t = this._getSortedRows(), e = this._columns.map((o, i) => {
|
|
1664
|
-
const
|
|
1665
|
-
return `<div class="header-cell ${
|
|
1667
|
+
const r = this._sortKey === o.key, a = [r ? "sorted" : "", r && this._sortDir === "desc" ? "desc" : ""].filter(Boolean).join(" "), l = o.sortable !== !1;
|
|
1668
|
+
return `<div class="header-cell ${a}" data-col="${i}" style="width:${this._colWidths[i]}px" draggable="true">
|
|
1666
1669
|
<span class="label-text">${o.label || o.key}</span>
|
|
1667
1670
|
${l ? '<span class="sort-arrow">▲</span>' : ""}
|
|
1668
1671
|
<div class="resize-handle" data-col="${i}"></div>
|
|
1669
1672
|
</div>`;
|
|
1670
1673
|
}).join(""), n = t.length === 0 ? '<div class="empty">No data</div>' : t.map((o, i) => {
|
|
1671
|
-
const
|
|
1672
|
-
const d = l.align ? ` align-${l.align}` : "", u = this._editingCell && this._editingCell.rowIndex === i && this._editingCell.key === l.key,
|
|
1673
|
-
return u ? `<div class="cell${d}" style="width:${this._colWidths[
|
|
1674
|
+
const r = i % 2 == 0 ? "even" : "odd", a = this._columns.map((l, x) => {
|
|
1675
|
+
const d = l.align ? ` align-${l.align}` : "", u = this._editingCell && this._editingCell.rowIndex === i && this._editingCell.key === l.key, h = o[l.key] != null ? o[l.key] : "";
|
|
1676
|
+
return u ? `<div class="cell${d}" style="width:${this._colWidths[x]}px" data-key="${l.key}">
|
|
1674
1677
|
<input class="cell-input" spellcheck="false">
|
|
1675
|
-
</div>` : `<div class="cell${d}" style="width:${this._colWidths[
|
|
1678
|
+
</div>` : `<div class="cell${d}" style="width:${this._colWidths[x]}px" data-key="${l.key}">${h}</div>`;
|
|
1676
1679
|
}).join("");
|
|
1677
|
-
return `<div class="row ${
|
|
1680
|
+
return `<div class="row ${r}" data-row="${i}">${a}</div>`;
|
|
1678
1681
|
}).join("");
|
|
1679
1682
|
if (this.render(`
|
|
1680
1683
|
:host { display: block; overflow: hidden; border: 1px solid var(--wox-border, #333); border-radius: var(--wox-radius-md, 6px); background: var(--wox-bg-panel, #17171a); }
|
|
@@ -1768,11 +1771,11 @@ class yt extends v {
|
|
|
1768
1771
|
`), this._bindEvents(), this._editingCell) {
|
|
1769
1772
|
const o = this.$(".cell-input");
|
|
1770
1773
|
if (o) {
|
|
1771
|
-
const { rowIndex: i, key:
|
|
1772
|
-
let l =
|
|
1773
|
-
const
|
|
1774
|
-
|
|
1775
|
-
const d =
|
|
1774
|
+
const { rowIndex: i, key: r } = this._editingCell, a = this._getSortedRows();
|
|
1775
|
+
let l = a[i][r] != null ? a[i][r] : "";
|
|
1776
|
+
const x = document.createElement("div");
|
|
1777
|
+
x.innerHTML = l;
|
|
1778
|
+
const d = x.textContent || x.innerText || l;
|
|
1776
1779
|
o.value = d, o.dataset.oldValue = d, o.focus(), o.select(), o.addEventListener("keydown", (u) => {
|
|
1777
1780
|
u.key === "Enter" ? this._commitEdit(o.value) : u.key === "Escape" && (this._editingCell = null, this._render());
|
|
1778
1781
|
}), o.addEventListener("blur", () => {
|
|
@@ -1783,8 +1786,8 @@ class yt extends v {
|
|
|
1783
1786
|
});
|
|
1784
1787
|
s(this, "_commitEdit", (t) => {
|
|
1785
1788
|
if (!this._editingCell) return;
|
|
1786
|
-
const { rowIndex: e, key: n } = this._editingCell, o = this.$(".cell-input"), i = o ? o.dataset.oldValue : "",
|
|
1787
|
-
i !== t && (this.emit("wox-cell-change", { row:
|
|
1789
|
+
const { rowIndex: e, key: n } = this._editingCell, o = this.$(".cell-input"), i = o ? o.dataset.oldValue : "", r = this._getSortedRows()[e];
|
|
1790
|
+
i !== t && (this.emit("wox-cell-change", { row: r, key: n, oldValue: i, newValue: t }), r[n] = t), this._editingCell = null, this._render();
|
|
1788
1791
|
});
|
|
1789
1792
|
s(this, "_bindEvents", () => {
|
|
1790
1793
|
this.$$(".header-cell").forEach((t) => {
|
|
@@ -1813,8 +1816,8 @@ class yt extends v {
|
|
|
1813
1816
|
}), t.querySelectorAll(".cell").forEach((e) => {
|
|
1814
1817
|
e.addEventListener("dblclick", (n) => {
|
|
1815
1818
|
n.stopPropagation();
|
|
1816
|
-
const o = Number(t.dataset.row), i = e.dataset.key,
|
|
1817
|
-
this._columns[
|
|
1819
|
+
const o = Number(t.dataset.row), i = e.dataset.key, r = this._columns.findIndex((a) => a.key === i);
|
|
1820
|
+
this._columns[r].editable !== !1 && (this._editingCell = { rowIndex: o, key: i }, this._render());
|
|
1818
1821
|
});
|
|
1819
1822
|
});
|
|
1820
1823
|
}), this.$$(".resize-handle").forEach((t) => {
|
|
@@ -1822,13 +1825,13 @@ class yt extends v {
|
|
|
1822
1825
|
e.preventDefault(), e.stopPropagation();
|
|
1823
1826
|
const n = Number(t.dataset.col), o = e.clientX, i = this._colWidths[n];
|
|
1824
1827
|
t.classList.add("active");
|
|
1825
|
-
const
|
|
1826
|
-
const
|
|
1827
|
-
this._colWidths[n] = Math.max(40, i +
|
|
1828
|
-
},
|
|
1829
|
-
t.classList.remove("active"), document.removeEventListener("mousemove",
|
|
1828
|
+
const r = (l) => {
|
|
1829
|
+
const x = l.clientX - o;
|
|
1830
|
+
this._colWidths[n] = Math.max(40, i + x), this._applyWidths();
|
|
1831
|
+
}, a = () => {
|
|
1832
|
+
t.classList.remove("active"), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", a);
|
|
1830
1833
|
};
|
|
1831
|
-
document.addEventListener("mousemove",
|
|
1834
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", a);
|
|
1832
1835
|
});
|
|
1833
1836
|
});
|
|
1834
1837
|
});
|
|
@@ -1844,8 +1847,8 @@ class yt extends v {
|
|
|
1844
1847
|
s(this, "_swapColumns", (t, e) => {
|
|
1845
1848
|
const n = [...this._columns], o = [...this._colWidths], [i] = n.splice(t, 1);
|
|
1846
1849
|
n.splice(e, 0, i);
|
|
1847
|
-
const [
|
|
1848
|
-
o.splice(e, 0,
|
|
1850
|
+
const [r] = o.splice(t, 1);
|
|
1851
|
+
o.splice(e, 0, r), this._columns = n, this._colWidths = o, this._render();
|
|
1849
1852
|
});
|
|
1850
1853
|
}
|
|
1851
1854
|
connectedCallback() {
|
|
@@ -1864,12 +1867,12 @@ class yt extends v {
|
|
|
1864
1867
|
return this._rows;
|
|
1865
1868
|
}
|
|
1866
1869
|
}
|
|
1867
|
-
const
|
|
1868
|
-
let
|
|
1869
|
-
const
|
|
1870
|
+
const Ct = 4e3, ht = { TL: { top: "16px", left: "16px" }, TC: { top: "16px", left: "50%", transform: "translateX(-50%)" }, TR: { top: "16px", right: "16px" }, BL: { bottom: "16px", left: "16px" }, BC: { bottom: "16px", left: "50%", transform: "translateX(-50%)" }, BR: { bottom: "16px", right: "16px" } }, Et = { TL: "translateX(-120%)", TC: "translateY(-120%)", TR: "translateX(120%)", BL: "translateX(-120%)", BC: "translateY(120%)", BR: "translateX(120%)" }, At = { success: { bg: "#1a2e1a", border: "#4CAF50", icon: "#66BB6A", progress: "#4CAF50", text: "#c8e6c9" }, error: { bg: "#2e1a1a", border: "#f44336", icon: "#ef5350", progress: "#f44336", text: "#ffcdd2" }, warning: { bg: "#2e2a1a", border: "#FF9800", icon: "#FFA726", progress: "#FF9800", text: "#ffe0b2" }, info: { bg: "#1a222e", border: "#2196F3", icon: "#42A5F5", progress: "#2196F3", text: "#bbdefb" } }, zt = { success: { bg: "#e8f5e9", border: "#2e7d32", icon: "#388e3c", progress: "#2e7d32", text: "#1b5e20" }, error: { bg: "#fce4ec", border: "#c62828", icon: "#d32f2f", progress: "#c62828", text: "#b71c1c" }, warning: { bg: "#fff8e1", border: "#e65100", icon: "#ef6c00", progress: "#e65100", text: "#bf360c" }, info: { bg: "#e3f2fd", border: "#1565c0", icon: "#1976d2", progress: "#1565c0", text: "#0d47a1" } }, xt = { success: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M20 6 9 17l-5-5"/></svg>', error: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="15" y1="9" x2="9" y2="15"/><line x1="9" y1="9" x2="15" y2="15"/></svg>', warning: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"/><line x1="12" y1="9" x2="12" y2="13"/><line x1="12" y1="17" x2="12.01" y2="17"/></svg>', info: '<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="16" x2="12" y2="12"/><line x1="12" y1="8" x2="12.01" y2="8"/></svg>' };
|
|
1871
|
+
let ut = !1;
|
|
1872
|
+
const N = /* @__PURE__ */ new Set(), F = {}, D = (p, c, t = {}) => {
|
|
1870
1873
|
(() => {
|
|
1871
|
-
if (
|
|
1872
|
-
|
|
1874
|
+
if (ut) return;
|
|
1875
|
+
ut = !0;
|
|
1873
1876
|
const m = document.createElement("style");
|
|
1874
1877
|
m.textContent = `
|
|
1875
1878
|
.wox-toast-container {
|
|
@@ -1928,63 +1931,63 @@ const P = /* @__PURE__ */ new Set(), N = {}, D = (p, c, t = {}) => {
|
|
|
1928
1931
|
`, document.head.appendChild(m);
|
|
1929
1932
|
})();
|
|
1930
1933
|
const e = `${p}::${c}`;
|
|
1931
|
-
if (
|
|
1932
|
-
|
|
1933
|
-
const { duration: n =
|
|
1934
|
-
const
|
|
1935
|
-
return
|
|
1936
|
-
})(p), l =
|
|
1937
|
-
if (
|
|
1938
|
-
const
|
|
1939
|
-
|
|
1940
|
-
const
|
|
1941
|
-
return Object.assign(
|
|
1934
|
+
if (N.has(e)) return;
|
|
1935
|
+
N.add(e);
|
|
1936
|
+
const { duration: n = Ct, closable: o = !0, position: i = "BR" } = t, r = document.documentElement.dataset.woxTheme === "light", a = ((m) => {
|
|
1937
|
+
const y = document.documentElement.dataset.woxTheme === "light" ? zt : At;
|
|
1938
|
+
return y[m] || y.info;
|
|
1939
|
+
})(p), l = ht[i] ? i : "BR", x = ((m) => {
|
|
1940
|
+
if (F[m]) return F[m];
|
|
1941
|
+
const y = document.createElement("div");
|
|
1942
|
+
y.className = `wox-toast-container wox-toast-container-${m}`;
|
|
1943
|
+
const _t = ht[m];
|
|
1944
|
+
return Object.assign(y.style, _t), m.startsWith("B") && (y.style.flexDirection = "column-reverse"), document.body.appendChild(y), F[m] = y, y;
|
|
1942
1945
|
})(l), d = document.createElement("div");
|
|
1943
|
-
d.className = `wox-toast wox-toast-${p}`, d.style.backgroundColor =
|
|
1946
|
+
d.className = `wox-toast wox-toast-${p}`, d.style.backgroundColor = a.bg, d.style.borderLeftColor = a.border, d.style.color = a.text;
|
|
1944
1947
|
let u = `
|
|
1945
|
-
<span class="wox-toast-icon" style="color:${
|
|
1948
|
+
<span class="wox-toast-icon" style="color:${a.icon}">${xt[p] || xt.info}</span>
|
|
1946
1949
|
<span class="wox-toast-message">${c}</span>
|
|
1947
1950
|
`;
|
|
1948
1951
|
if (o && (u += '<button class="wox-toast-close" aria-label="Close">×</button>'), d.innerHTML = u, o) {
|
|
1949
1952
|
const m = d.querySelector(".wox-toast-close");
|
|
1950
1953
|
m && (m.addEventListener("mouseenter", () => {
|
|
1951
|
-
m.style.color =
|
|
1954
|
+
m.style.color = a.icon;
|
|
1952
1955
|
}), m.addEventListener("mouseleave", () => {
|
|
1953
|
-
m.style.color =
|
|
1956
|
+
m.style.color = r ? "#999" : "#666";
|
|
1954
1957
|
}));
|
|
1955
1958
|
}
|
|
1956
|
-
let
|
|
1957
|
-
n > 0 && (
|
|
1958
|
-
const
|
|
1959
|
-
d.animate([{ transform:
|
|
1960
|
-
let
|
|
1961
|
-
const
|
|
1962
|
-
n <= 0 || (
|
|
1963
|
-
},
|
|
1964
|
-
|
|
1959
|
+
let h = null;
|
|
1960
|
+
n > 0 && (h = document.createElement("div"), h.className = "wox-toast-progress", h.style.backgroundColor = a.progress, h.style.width = "100%", d.appendChild(h));
|
|
1961
|
+
const v = Et[l];
|
|
1962
|
+
d.animate([{ transform: v, opacity: 0 }, { transform: "translateX(0) translateY(0)", opacity: 1 }], { duration: 300, easing: "cubic-bezier(.22,1,.36,1)", fill: "forwards" }), x.appendChild(d);
|
|
1963
|
+
let b = null, g = n, f = 0, k = null;
|
|
1964
|
+
const E = () => {
|
|
1965
|
+
n <= 0 || (f = Date.now(), h && (k = h.animate([{ width: h.style.width }, { width: "0%" }], { duration: g, easing: "linear", fill: "forwards" })), b = setTimeout(() => z(), g));
|
|
1966
|
+
}, z = () => {
|
|
1967
|
+
N.delete(e), b && (clearTimeout(b), b = null), k && k.cancel(), d.animate([{ transform: "translateX(0) translateY(0)", opacity: 1 }, { transform: v, opacity: 0 }], { duration: 300, easing: "cubic-bezier(.22,1,.36,1)", fill: "forwards" }).onfinish = () => {
|
|
1965
1968
|
const m = d.offsetHeight;
|
|
1966
1969
|
d.style.minHeight = "0", d.style.padding = "0", d.style.margin = "0", d.style.overflow = "hidden", d.animate([{ height: `${m}px` }, { height: "0px" }], { duration: 200, easing: "ease" }).onfinish = () => d.remove();
|
|
1967
1970
|
};
|
|
1968
1971
|
};
|
|
1969
1972
|
if (d.addEventListener("mouseenter", () => {
|
|
1970
|
-
|
|
1971
|
-
const m = Date.now() -
|
|
1972
|
-
if (
|
|
1973
|
-
const
|
|
1974
|
-
|
|
1973
|
+
b && (clearTimeout(b), b = null), k && k.pause();
|
|
1974
|
+
const m = Date.now() - f;
|
|
1975
|
+
if (g = Math.max(g - m, 0), h && k) {
|
|
1976
|
+
const y = n > 0 ? g / n * 100 : 0;
|
|
1977
|
+
h.style.width = `${y}%`;
|
|
1975
1978
|
}
|
|
1976
|
-
}), d.addEventListener("mouseleave",
|
|
1979
|
+
}), d.addEventListener("mouseleave", E), o) {
|
|
1977
1980
|
const m = d.querySelector(".wox-toast-close");
|
|
1978
|
-
m && m.addEventListener("click",
|
|
1981
|
+
m && m.addEventListener("click", z);
|
|
1979
1982
|
}
|
|
1980
|
-
|
|
1983
|
+
E();
|
|
1981
1984
|
};
|
|
1982
|
-
class
|
|
1985
|
+
class L extends w {
|
|
1983
1986
|
}
|
|
1984
|
-
s(
|
|
1985
|
-
const
|
|
1987
|
+
s(L, "success", (c, t) => D("success", c, t)), s(L, "error", (c, t) => D("error", c, t)), s(L, "warning", (c, t) => D("warning", c, t)), s(L, "info", (c, t) => D("info", c, t));
|
|
1988
|
+
const _ = class _ extends w {
|
|
1986
1989
|
};
|
|
1987
|
-
s(
|
|
1990
|
+
s(_, "_el", null), s(_, "_listenersReady", !1), s(_, "show", (c, t) => {
|
|
1988
1991
|
if (!c || !t) return;
|
|
1989
1992
|
c.preventDefault(), c.stopPropagation(), (() => {
|
|
1990
1993
|
if (document.getElementById("wox-ctx-menu-styles")) return;
|
|
@@ -2018,55 +2021,55 @@ s(f, "_el", null), s(f, "_listenersReady", !1), s(f, "show", (c, t) => {
|
|
|
2018
2021
|
.wox-ctx-menu-divider { height: 1px; background: var(--wox-border, #333); margin: 4px 8px; }
|
|
2019
2022
|
`, document.head.appendChild(n);
|
|
2020
2023
|
})();
|
|
2021
|
-
let e =
|
|
2022
|
-
e || (e = document.createElement("div"), e.id = "wox-ctx-menu", e.className = "wox-ctx-menu", document.body.appendChild(e),
|
|
2024
|
+
let e = _._el;
|
|
2025
|
+
e || (e = document.createElement("div"), e.id = "wox-ctx-menu", e.className = "wox-ctx-menu", document.body.appendChild(e), _._el = e), e.innerHTML = "", t.forEach((n) => {
|
|
2023
2026
|
if (n.divider) {
|
|
2024
|
-
const
|
|
2025
|
-
return
|
|
2027
|
+
const a = document.createElement("div");
|
|
2028
|
+
return a.className = "wox-ctx-menu-divider", void e.appendChild(a);
|
|
2026
2029
|
}
|
|
2027
2030
|
const o = document.createElement("div");
|
|
2028
2031
|
o.className = "wox-ctx-menu-item", n.disabled && o.classList.add("wox-ctx-menu-item--disabled");
|
|
2029
2032
|
const i = document.createElement("i");
|
|
2030
2033
|
i.className = "material-icons wox-ctx-menu-icon", i.textContent = n.icon || "", o.appendChild(i);
|
|
2031
|
-
const
|
|
2032
|
-
if (
|
|
2033
|
-
const
|
|
2034
|
-
|
|
2034
|
+
const r = document.createElement("span");
|
|
2035
|
+
if (r.className = "wox-ctx-menu-label", r.textContent = n.label || "", o.appendChild(r), n.shortcut) {
|
|
2036
|
+
const a = document.createElement("span");
|
|
2037
|
+
a.className = "wox-ctx-menu-shortcut", a.textContent = n.shortcut, o.appendChild(a);
|
|
2035
2038
|
}
|
|
2036
2039
|
n.disabled || o.addEventListener("click", () => {
|
|
2037
|
-
|
|
2040
|
+
_.hide(), n.action && n.action();
|
|
2038
2041
|
}), e.appendChild(o);
|
|
2039
2042
|
}), e.style.display = "block", e.style.left = `${c.clientX}px`, e.style.top = `${c.clientY}px`, requestAnimationFrame(() => {
|
|
2040
2043
|
const n = e.getBoundingClientRect(), o = window.innerWidth, i = window.innerHeight;
|
|
2041
2044
|
n.right > o && (e.style.left = o - n.width - 4 + "px"), n.bottom > i && (e.style.top = i - n.height - 4 + "px");
|
|
2042
|
-
}),
|
|
2043
|
-
}), s(
|
|
2044
|
-
|
|
2045
|
-
}), s(
|
|
2046
|
-
|
|
2047
|
-
}), s(
|
|
2048
|
-
c.key === "Escape" &&
|
|
2045
|
+
}), _._listenersReady || (document.addEventListener("click", _._onClickOutside, !0), document.addEventListener("contextmenu", _._onClickOutside, !0), document.addEventListener("keydown", _._onKeyDown, !0), _._listenersReady = !0);
|
|
2046
|
+
}), s(_, "hide", () => {
|
|
2047
|
+
_._el && (_._el.style.display = "none");
|
|
2048
|
+
}), s(_, "_onClickOutside", (c) => {
|
|
2049
|
+
_._el && _._el.style.display !== "none" && (_._el.contains(c.target) || _.hide());
|
|
2050
|
+
}), s(_, "_onKeyDown", (c) => {
|
|
2051
|
+
c.key === "Escape" && _.hide();
|
|
2049
2052
|
});
|
|
2050
|
-
let
|
|
2051
|
-
const
|
|
2053
|
+
let O = _;
|
|
2054
|
+
const A = (p) => {
|
|
2052
2055
|
if (!p || !p.stops || p.stops.length < 2) return "";
|
|
2053
2056
|
const c = [...p.stops].sort((t, e) => t.position - e.position).map((t) => `${t.color} ${t.position}%`).join(", ");
|
|
2054
2057
|
return p.type === "linear" ? `linear-gradient(${p.angle}deg, ${c})` : `radial-gradient(circle, ${c})`;
|
|
2055
|
-
},
|
|
2058
|
+
}, gt = (p) => {
|
|
2056
2059
|
if (!p) return null;
|
|
2057
2060
|
let c = null, t = 90, e = null;
|
|
2058
2061
|
const n = p.match(/^linear-gradient\(\s*(\d+)deg\s*,\s*(.+)\)$/i);
|
|
2059
2062
|
if (n && (c = "linear", t = parseInt(n[1], 10), e = n[2]), !c) {
|
|
2060
|
-
const
|
|
2061
|
-
|
|
2063
|
+
const a = p.match(/^radial-gradient\(\s*(?:circle|ellipse)?\s*,?\s*(.+)\)$/i);
|
|
2064
|
+
a && (c = "radial", e = a[1]);
|
|
2062
2065
|
}
|
|
2063
2066
|
if (!c || !e) return null;
|
|
2064
2067
|
const o = [], i = /(#[0-9a-fA-F]{3,8}|rgba?\([^)]+\))\s+(\d+(?:\.\d+)?)%/g;
|
|
2065
|
-
let
|
|
2066
|
-
for (; (
|
|
2068
|
+
let r;
|
|
2069
|
+
for (; (r = i.exec(e)) !== null; ) o.push({ color: r[1], position: parseFloat(r[2]) });
|
|
2067
2070
|
return o.length < 2 ? null : { type: c, angle: t, stops: o };
|
|
2068
2071
|
};
|
|
2069
|
-
class
|
|
2072
|
+
class mt extends w {
|
|
2070
2073
|
constructor() {
|
|
2071
2074
|
super(...arguments);
|
|
2072
2075
|
s(this, "_gradient", null);
|
|
@@ -2074,7 +2077,7 @@ class At extends v {
|
|
|
2074
2077
|
s(this, "_justDragged", !1);
|
|
2075
2078
|
s(this, "_build", () => {
|
|
2076
2079
|
if (!this._gradient) return;
|
|
2077
|
-
const t =
|
|
2080
|
+
const t = A(this._gradient);
|
|
2078
2081
|
this.render(`
|
|
2079
2082
|
:host { display: block; }
|
|
2080
2083
|
.editor { padding: var(--wox-space-md, 8px) 0; }
|
|
@@ -2108,10 +2111,10 @@ class At extends v {
|
|
|
2108
2111
|
});
|
|
2109
2112
|
s(this, "_updatePreview", () => {
|
|
2110
2113
|
const t = this.$(".bar");
|
|
2111
|
-
t && (t.style.background =
|
|
2114
|
+
t && (t.style.background = A(this._gradient));
|
|
2112
2115
|
});
|
|
2113
2116
|
s(this, "_emitGradient", (t) => {
|
|
2114
|
-
this.emit(t, { gradient: this.gradient, css:
|
|
2117
|
+
this.emit(t, { gradient: this.gradient, css: A(this._gradient) });
|
|
2115
2118
|
});
|
|
2116
2119
|
s(this, "_renderStops", () => {
|
|
2117
2120
|
const t = this.$(".stops");
|
|
@@ -2119,30 +2122,30 @@ class At extends v {
|
|
|
2119
2122
|
const n = this._gradient.stops.indexOf(e), o = document.createElement("div");
|
|
2120
2123
|
o.className = "handle", o.style.left = e.position + "%", o.style.backgroundColor = e.color, o.dataset.index = n;
|
|
2121
2124
|
const i = document.createElement("input");
|
|
2122
|
-
i.type = "color", i.value = e.color, i.className = "color-input", o.appendChild(i), o.addEventListener("click", (
|
|
2123
|
-
this._justDragged ? this._justDragged = !1 : (
|
|
2124
|
-
}), i.addEventListener("input", (
|
|
2125
|
-
const
|
|
2126
|
-
this._gradient.stops[
|
|
2125
|
+
i.type = "color", i.value = e.color, i.className = "color-input", o.appendChild(i), o.addEventListener("click", (r) => {
|
|
2126
|
+
this._justDragged ? this._justDragged = !1 : (r.stopPropagation(), i.click());
|
|
2127
|
+
}), i.addEventListener("input", (r) => {
|
|
2128
|
+
const a = parseInt(o.dataset.index, 10);
|
|
2129
|
+
this._gradient.stops[a].color = r.target.value, o.style.backgroundColor = r.target.value, this._updatePreview(), this._emitGradient("wox-gradient-input");
|
|
2127
2130
|
}), i.addEventListener("change", () => {
|
|
2128
2131
|
this._emitGradient("wox-gradient-change");
|
|
2129
|
-
}), i.addEventListener("click", (
|
|
2130
|
-
if (
|
|
2131
|
-
|
|
2132
|
-
const
|
|
2133
|
-
if (!
|
|
2134
|
-
const l =
|
|
2135
|
-
this._dragging = { idx:
|
|
2136
|
-
const d = (
|
|
2137
|
-
const
|
|
2138
|
-
this._gradient.stops[
|
|
2139
|
-
}, u = (
|
|
2140
|
-
var
|
|
2132
|
+
}), i.addEventListener("click", (r) => r.stopPropagation()), o.addEventListener("mousedown", (r) => {
|
|
2133
|
+
if (r.target === i) return;
|
|
2134
|
+
r.preventDefault(), r.stopPropagation();
|
|
2135
|
+
const a = this.$(".bar");
|
|
2136
|
+
if (!a) return;
|
|
2137
|
+
const l = a.getBoundingClientRect(), x = parseInt(o.dataset.index, 10);
|
|
2138
|
+
this._dragging = { idx: x, startY: r.clientY }, o.classList.add("dragging");
|
|
2139
|
+
const d = (h) => {
|
|
2140
|
+
const v = (h.clientX - l.left) / l.width * 100, b = Math.max(0, Math.min(100, Math.round(10 * v) / 10));
|
|
2141
|
+
this._gradient.stops[x].position = b, o.style.left = b + "%", Math.abs(h.clientY - this._dragging.startY) > 40 && this._gradient.stops.length > 2 ? o.classList.add("removing") : o.classList.remove("removing"), this._updatePreview(), this._emitGradient("wox-gradient-input");
|
|
2142
|
+
}, u = (h) => {
|
|
2143
|
+
var g;
|
|
2141
2144
|
document.removeEventListener("mousemove", d), document.removeEventListener("mouseup", u), o.classList.remove("dragging");
|
|
2142
|
-
const
|
|
2143
|
-
|
|
2144
|
-
const
|
|
2145
|
-
(
|
|
2145
|
+
const v = Math.abs(h.clientY - this._dragging.startY);
|
|
2146
|
+
v > 40 && this._gradient.stops.length > 2 ? (this._gradient.stops.splice(x, 1), this._renderStops(), this._updatePreview(), this._emitGradient("wox-gradient-change")) : this._emitGradient("wox-gradient-change");
|
|
2147
|
+
const b = Math.abs(h.clientX - (l.left + (((g = this._gradient.stops[x]) == null ? void 0 : g.position) || 0) * l.width / 100));
|
|
2148
|
+
(v > 3 || b > 3) && (this._justDragged = !0), this._dragging = null;
|
|
2146
2149
|
};
|
|
2147
2150
|
document.addEventListener("mousemove", d), document.addEventListener("mouseup", u);
|
|
2148
2151
|
}), t.appendChild(o);
|
|
@@ -2151,13 +2154,13 @@ class At extends v {
|
|
|
2151
2154
|
s(this, "_bindBarEvents", () => {
|
|
2152
2155
|
const t = this.$(".bar");
|
|
2153
2156
|
t && t.addEventListener("dblclick", (e) => {
|
|
2154
|
-
const n = t.getBoundingClientRect(), o = Math.round((e.clientX - n.left) / n.width * 100), i = Math.max(0, Math.min(100, o)),
|
|
2155
|
-
let
|
|
2156
|
-
for (let l = 0; l <
|
|
2157
|
-
|
|
2157
|
+
const n = t.getBoundingClientRect(), o = Math.round((e.clientX - n.left) / n.width * 100), i = Math.max(0, Math.min(100, o)), r = [...this._gradient.stops].sort((l, x) => l.position - x.position);
|
|
2158
|
+
let a = "#888888";
|
|
2159
|
+
for (let l = 0; l < r.length - 1; l++) if (i >= r[l].position && i <= r[l + 1].position) {
|
|
2160
|
+
a = r[l].color;
|
|
2158
2161
|
break;
|
|
2159
2162
|
}
|
|
2160
|
-
this._gradient.stops.push({ color:
|
|
2163
|
+
this._gradient.stops.push({ color: a, position: i }), this._renderStops(), this._updatePreview(), this._emitGradient("wox-gradient-change");
|
|
2161
2164
|
});
|
|
2162
2165
|
});
|
|
2163
2166
|
}
|
|
@@ -2171,8 +2174,8 @@ class At extends v {
|
|
|
2171
2174
|
return this._gradient ? JSON.parse(JSON.stringify(this._gradient)) : null;
|
|
2172
2175
|
}
|
|
2173
2176
|
}
|
|
2174
|
-
const
|
|
2175
|
-
class
|
|
2177
|
+
const Lt = [{ id: "grad_preset_sunset", name: "Sunset", type: "linear", angle: 135, stops: [{ color: "#ff512f", position: 0 }, { color: "#f09819", position: 100 }] }, { id: "grad_preset_ocean", name: "Ocean", type: "linear", angle: 135, stops: [{ color: "#2193b0", position: 0 }, { color: "#6dd5ed", position: 100 }] }, { id: "grad_preset_forest", name: "Forest", type: "linear", angle: 135, stops: [{ color: "#11998e", position: 0 }, { color: "#38ef7d", position: 100 }] }, { id: "grad_preset_purple_haze", name: "Purple Haze", type: "linear", angle: 135, stops: [{ color: "#7b4397", position: 0 }, { color: "#dc2430", position: 100 }] }, { id: "grad_preset_midnight", name: "Midnight", type: "linear", angle: 135, stops: [{ color: "#232526", position: 0 }, { color: "#414345", position: 100 }] }, { id: "grad_preset_peach", name: "Peach", type: "linear", angle: 135, stops: [{ color: "#ffecd2", position: 0 }, { color: "#fcb69f", position: 100 }] }], R = () => "grad_" + Date.now().toString(36) + "_" + Math.random().toString(36).slice(2, 7), bt = (p) => !!p && (p.startsWith("linear-gradient") || p.startsWith("radial-gradient"));
|
|
2178
|
+
class ct extends w {
|
|
2176
2179
|
constructor() {
|
|
2177
2180
|
super(...arguments);
|
|
2178
2181
|
s(this, "_value", "#ffffff");
|
|
@@ -2185,7 +2188,7 @@ class bt extends v {
|
|
|
2185
2188
|
s(this, "_editingName", "");
|
|
2186
2189
|
s(this, "_syncFromAttributes", () => {
|
|
2187
2190
|
const t = this.getAttribute("value");
|
|
2188
|
-
t && (this._value = t, this._gradient =
|
|
2191
|
+
t && (this._value = t, this._gradient = bt(t) ? gt(t) : null);
|
|
2189
2192
|
const e = this.getAttribute("animation-speed");
|
|
2190
2193
|
e !== null && (this._animationSpeed = parseInt(e, 10) || 0);
|
|
2191
2194
|
const n = this.getAttribute("animation-type");
|
|
@@ -2197,7 +2200,7 @@ class bt extends v {
|
|
|
2197
2200
|
if (t) return void (this._gradients = JSON.parse(t));
|
|
2198
2201
|
} catch {
|
|
2199
2202
|
}
|
|
2200
|
-
this._gradients =
|
|
2203
|
+
this._gradients = Lt.map((t) => ({ ...t, stops: t.stops.map((e) => ({ ...e })) })), this._persistGradients();
|
|
2201
2204
|
});
|
|
2202
2205
|
s(this, "_persistGradients", () => {
|
|
2203
2206
|
try {
|
|
@@ -2215,8 +2218,8 @@ class bt extends v {
|
|
|
2215
2218
|
s(this, "_getById", (t) => this._gradients.find((e) => e.id === t));
|
|
2216
2219
|
s(this, "_labelForValue", (t) => {
|
|
2217
2220
|
if (!t) return "None";
|
|
2218
|
-
if (
|
|
2219
|
-
for (const e of this._gradients) if (
|
|
2221
|
+
if (bt(t)) {
|
|
2222
|
+
for (const e of this._gradients) if (A(e) === t) return e.name;
|
|
2220
2223
|
return "Custom Gradient";
|
|
2221
2224
|
}
|
|
2222
2225
|
return t;
|
|
@@ -2374,10 +2377,10 @@ class bt extends v {
|
|
|
2374
2377
|
o && o.setAttribute("value", this._gradient.angle);
|
|
2375
2378
|
const i = this.$(".speed-row wox-slider");
|
|
2376
2379
|
i && i.setAttribute("value", this._animationSpeed);
|
|
2377
|
-
const
|
|
2378
|
-
|
|
2379
|
-
const
|
|
2380
|
-
|
|
2380
|
+
const r = this.$(".anim-type-row");
|
|
2381
|
+
r && (r.style.display = this._animationSpeed > 0 ? "" : "none");
|
|
2382
|
+
const a = this.$(".anim-select");
|
|
2383
|
+
a && (a.value = this._animationType);
|
|
2381
2384
|
});
|
|
2382
2385
|
s(this, "_bindEvents", () => {
|
|
2383
2386
|
this.$(".current").addEventListener("click", (d) => {
|
|
@@ -2385,7 +2388,7 @@ class bt extends v {
|
|
|
2385
2388
|
}), this.$$(".type-btn").forEach((d) => {
|
|
2386
2389
|
d.addEventListener("click", () => {
|
|
2387
2390
|
if (!this._gradient) return;
|
|
2388
|
-
this.$$(".type-btn").forEach((
|
|
2391
|
+
this.$$(".type-btn").forEach((h) => h.classList.remove("active")), d.classList.add("active"), this._gradient.type = d.dataset.type;
|
|
2389
2392
|
const u = this.$(".angle-row");
|
|
2390
2393
|
u && (u.style.display = d.dataset.type === "linear" ? "" : "none"), this._applyGradient();
|
|
2391
2394
|
});
|
|
@@ -2418,12 +2421,12 @@ class bt extends v {
|
|
|
2418
2421
|
i && i.addEventListener("click", () => {
|
|
2419
2422
|
this._applyFromEditor(!1);
|
|
2420
2423
|
});
|
|
2421
|
-
const
|
|
2422
|
-
|
|
2424
|
+
const r = this.$(".save-btn");
|
|
2425
|
+
r && r.addEventListener("click", () => {
|
|
2423
2426
|
this._applyFromEditor(!0);
|
|
2424
2427
|
});
|
|
2425
|
-
const
|
|
2426
|
-
|
|
2428
|
+
const a = this.$(".name-input");
|
|
2429
|
+
a && a.addEventListener("input", (d) => {
|
|
2427
2430
|
this._editingName = d.target.value.trim();
|
|
2428
2431
|
});
|
|
2429
2432
|
const l = this.$(".modal-editor");
|
|
@@ -2432,8 +2435,8 @@ class bt extends v {
|
|
|
2432
2435
|
}), l.addEventListener("wox-gradient-change", (d) => {
|
|
2433
2436
|
this._editingGradient = d.detail.gradient;
|
|
2434
2437
|
}));
|
|
2435
|
-
const
|
|
2436
|
-
|
|
2438
|
+
const x = this.$(".editor-modal");
|
|
2439
|
+
x && x.addEventListener("wox-close", () => {
|
|
2437
2440
|
this._editingGradient = null, this._editingName = "";
|
|
2438
2441
|
});
|
|
2439
2442
|
});
|
|
@@ -2445,8 +2448,8 @@ class bt extends v {
|
|
|
2445
2448
|
if (!t || !e) return;
|
|
2446
2449
|
const n = t.getBoundingClientRect(), o = window.innerHeight;
|
|
2447
2450
|
e.style.left = `${n.left}px`, e.style.width = `${n.width}px`;
|
|
2448
|
-
const i = o - n.bottom,
|
|
2449
|
-
i >= 280 || i >=
|
|
2451
|
+
const i = o - n.bottom, r = n.top;
|
|
2452
|
+
i >= 280 || i >= r ? (e.style.top = `${n.bottom}px`, e.style.bottom = "", e.style.maxHeight = `${Math.min(280, i - 4)}px`) : (e.style.top = "", e.style.bottom = o - n.top + "px", e.style.maxHeight = `${Math.min(280, r - 4)}px`);
|
|
2450
2453
|
});
|
|
2451
2454
|
s(this, "_closeDropdown", () => {
|
|
2452
2455
|
this._open = !1, this.$(".selector").classList.remove("open");
|
|
@@ -2463,14 +2466,14 @@ class bt extends v {
|
|
|
2463
2466
|
<input type="color" class="solid-input" value="${n}">
|
|
2464
2467
|
</div>
|
|
2465
2468
|
`, this._gradients.forEach((o) => {
|
|
2466
|
-
const i =
|
|
2469
|
+
const i = A(o), r = o.id.startsWith("grad_preset_"), a = r ? `<button class="dropdown-item-btn" data-dup-id="${o.id}" title="Duplicate gradient">⎘</button>` : "", l = r ? "" : `<button class="dropdown-item-btn" data-edit-id="${o.id}" title="Edit gradient">✎</button>`, x = r ? "" : `<button class="dropdown-item-btn delete-btn" data-delete-id="${o.id}" title="Delete gradient">×</button>`;
|
|
2467
2470
|
e += `
|
|
2468
2471
|
<div class="dropdown-item" data-gradient-id="${o.id}">
|
|
2469
2472
|
<div class="dropdown-item-preview" style="background: ${i}"></div>
|
|
2470
2473
|
<span class="dropdown-item-label">${o.name}</span>
|
|
2471
|
-
${
|
|
2474
|
+
${a}
|
|
2472
2475
|
${l}
|
|
2473
|
-
${
|
|
2476
|
+
${x}
|
|
2474
2477
|
</div>
|
|
2475
2478
|
`;
|
|
2476
2479
|
}), e += `
|
|
@@ -2490,28 +2493,28 @@ class bt extends v {
|
|
|
2490
2493
|
}), n.addEventListener("change", () => {
|
|
2491
2494
|
n.style.pointerEvents = "none";
|
|
2492
2495
|
}), n.addEventListener("click", (i) => i.stopPropagation())), t.querySelectorAll("[data-gradient-id]").forEach((i) => {
|
|
2493
|
-
i.addEventListener("click", (
|
|
2494
|
-
if (
|
|
2495
|
-
const
|
|
2496
|
-
|
|
2496
|
+
i.addEventListener("click", (r) => {
|
|
2497
|
+
if (r.target.hasAttribute("data-delete-id") || r.target.hasAttribute("data-edit-id") || r.target.hasAttribute("data-dup-id")) return;
|
|
2498
|
+
const a = this._getById(i.dataset.gradientId);
|
|
2499
|
+
a && (this._gradient = JSON.parse(JSON.stringify(a)), this._value = A(this._gradient), this._updatePreview(), this._syncControls(), this._emitChange(), this._closeDropdown());
|
|
2497
2500
|
});
|
|
2498
2501
|
}), t.querySelectorAll("[data-dup-id]").forEach((i) => {
|
|
2499
|
-
i.addEventListener("click", (
|
|
2500
|
-
|
|
2501
|
-
const
|
|
2502
|
-
if (!
|
|
2503
|
-
const l = { id: R(), name:
|
|
2502
|
+
i.addEventListener("click", (r) => {
|
|
2503
|
+
r.stopPropagation();
|
|
2504
|
+
const a = this._getById(i.dataset.dupId);
|
|
2505
|
+
if (!a) return;
|
|
2506
|
+
const l = { id: R(), name: a.name + " Copy", type: a.type, angle: a.angle, stops: a.stops.map((x) => ({ ...x })) };
|
|
2504
2507
|
this._closeDropdown(), this._openEditorDialog(l);
|
|
2505
2508
|
});
|
|
2506
2509
|
}), t.querySelectorAll("[data-edit-id]").forEach((i) => {
|
|
2507
|
-
i.addEventListener("click", (
|
|
2508
|
-
|
|
2509
|
-
const
|
|
2510
|
-
|
|
2510
|
+
i.addEventListener("click", (r) => {
|
|
2511
|
+
r.stopPropagation();
|
|
2512
|
+
const a = this._getById(i.dataset.editId);
|
|
2513
|
+
a && (this._closeDropdown(), this._openEditorDialog(JSON.parse(JSON.stringify(a))));
|
|
2511
2514
|
});
|
|
2512
2515
|
}), t.querySelectorAll("[data-delete-id]").forEach((i) => {
|
|
2513
|
-
i.addEventListener("click", (
|
|
2514
|
-
|
|
2516
|
+
i.addEventListener("click", (r) => {
|
|
2517
|
+
r.stopPropagation(), this._delete(i.dataset.deleteId), this._populateDropdown();
|
|
2515
2518
|
});
|
|
2516
2519
|
});
|
|
2517
2520
|
const o = t.querySelector('[data-action="custom"]');
|
|
@@ -2521,7 +2524,7 @@ class bt extends v {
|
|
|
2521
2524
|
});
|
|
2522
2525
|
s(this, "_openEditorDialog", (t) => {
|
|
2523
2526
|
let e;
|
|
2524
|
-
t ? e = JSON.parse(JSON.stringify(t)) : (e =
|
|
2527
|
+
t ? e = JSON.parse(JSON.stringify(t)) : (e = gt(this._value), e ? (e.id = e.id || R(), e.name = e.name || "Custom Gradient") : e = { id: R(), name: "Custom Gradient", type: "linear", angle: 90, stops: [{ color: this._value.startsWith("#") ? this._value : "#000000", position: 0 }, { color: "#ffffff", position: 100 }] }), this._editingGradient = JSON.parse(JSON.stringify(e)), this._editingName = e.name;
|
|
2525
2528
|
const n = this.$(".modal-editor");
|
|
2526
2529
|
n && (n.gradient = this._editingGradient);
|
|
2527
2530
|
const o = this.$(".name-input");
|
|
@@ -2532,14 +2535,14 @@ class bt extends v {
|
|
|
2532
2535
|
s(this, "_applyFromEditor", (t) => {
|
|
2533
2536
|
if (!this._editingGradient) return;
|
|
2534
2537
|
const e = JSON.parse(JSON.stringify(this._editingGradient));
|
|
2535
|
-
this._editingName && (e.name = this._editingName), e.id = this._editingOriginalId || e.id || R(), t && this._save(e), this._gradient = JSON.parse(JSON.stringify(e)), this._value =
|
|
2538
|
+
this._editingName && (e.name = this._editingName), e.id = this._editingOriginalId || e.id || R(), t && this._save(e), this._gradient = JSON.parse(JSON.stringify(e)), this._value = A(this._gradient), this._updatePreview(), this._syncControls(), this._emitChange(), this._closeModal();
|
|
2536
2539
|
});
|
|
2537
2540
|
s(this, "_closeModal", () => {
|
|
2538
2541
|
const t = this.$(".editor-modal");
|
|
2539
2542
|
t && t.removeAttribute("open"), this._editingGradient = null, this._editingName = "", this._editingOriginalId = null;
|
|
2540
2543
|
});
|
|
2541
2544
|
s(this, "_applyGradient", () => {
|
|
2542
|
-
this._gradient && (this._value =
|
|
2545
|
+
this._gradient && (this._value = A(this._gradient), this._updatePreview(), this._emitChange());
|
|
2543
2546
|
});
|
|
2544
2547
|
s(this, "_emitChange", () => {
|
|
2545
2548
|
this.emit("wox-gradient-change", { value: this._value, animationSpeed: this._animationSpeed, animationType: this._animationType });
|
|
@@ -2557,9 +2560,9 @@ class bt extends v {
|
|
|
2557
2560
|
this.isConnected && (this._syncFromAttributes(), this._updatePreview(), this._syncControls());
|
|
2558
2561
|
}
|
|
2559
2562
|
}
|
|
2560
|
-
s(
|
|
2561
|
-
const
|
|
2562
|
-
class
|
|
2563
|
+
s(ct, "observedAttributes", ["value", "animation-speed", "animation-type"]);
|
|
2564
|
+
const St = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], Mt = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
2565
|
+
class pt extends w {
|
|
2563
2566
|
constructor() {
|
|
2564
2567
|
super(...arguments);
|
|
2565
2568
|
s(this, "_currentDate", /* @__PURE__ */ new Date());
|
|
@@ -2573,7 +2576,7 @@ class vt extends v {
|
|
|
2573
2576
|
this._currentDate = new Date(t, this._currentDate.getMonth(), 1), this._render();
|
|
2574
2577
|
});
|
|
2575
2578
|
s(this, "_goToday", () => {
|
|
2576
|
-
const t = /* @__PURE__ */ new Date(), e =
|
|
2579
|
+
const t = /* @__PURE__ */ new Date(), e = wt(t);
|
|
2577
2580
|
this._currentDate = new Date(t.getFullYear(), t.getMonth(), 1), this.rangeMode ? this._selectedRange = { start: e, end: null } : (this._selectedDate = e, this.emit("wox-change", { date: e })), this._render();
|
|
2578
2581
|
});
|
|
2579
2582
|
s(this, "_handleDayClick", (t) => {
|
|
@@ -2606,22 +2609,22 @@ class vt extends v {
|
|
|
2606
2609
|
return e;
|
|
2607
2610
|
});
|
|
2608
2611
|
s(this, "_generateGrid", (t, e) => {
|
|
2609
|
-
const n = /* @__PURE__ */ new Date(), o =
|
|
2610
|
-
let
|
|
2611
|
-
const l = e === 0 ? t - 1 : t,
|
|
2612
|
-
for (let
|
|
2613
|
-
const
|
|
2614
|
-
|
|
2612
|
+
const n = /* @__PURE__ */ new Date(), o = wt(n), i = new Date(t, e, 1).getDay(), r = new Date(t, e + 1, 0).getDate();
|
|
2613
|
+
let a = "";
|
|
2614
|
+
const l = e === 0 ? t - 1 : t, x = e === 0 ? 11 : e - 1, d = new Date(l, x + 1, 0).getDate();
|
|
2615
|
+
for (let b = i - 1; b >= 0; b--) {
|
|
2616
|
+
const g = d - b;
|
|
2617
|
+
a += `<div class="day-cell other-month" data-date="${B(l, x, g)}">${g}</div>`;
|
|
2615
2618
|
}
|
|
2616
|
-
for (let
|
|
2617
|
-
const
|
|
2618
|
-
let
|
|
2619
|
-
|
|
2619
|
+
for (let b = 1; b <= r; b++) {
|
|
2620
|
+
const g = B(t, e, b);
|
|
2621
|
+
let f = "day-cell";
|
|
2622
|
+
g === o && (f += " today"), this.rangeMode ? this._selectedRange.start && g === this._selectedRange.start ? f += " range-start" : this._selectedRange.end && g === this._selectedRange.end ? f += " range-end" : Dt(g, this._selectedRange.start, this._selectedRange.end) && (f += " in-range") : this._selectedDate && g === this._selectedDate && (f += " selected"), a += `<div class="${f}" data-date="${g}">${b}</div>`;
|
|
2620
2623
|
}
|
|
2621
|
-
const u = 7 * Math.ceil((i +
|
|
2622
|
-
for (let
|
|
2623
|
-
|
|
2624
|
-
return
|
|
2624
|
+
const u = 7 * Math.ceil((i + r) / 7), h = e === 11 ? t + 1 : t, v = e === 11 ? 0 : e + 1;
|
|
2625
|
+
for (let b = 1; b <= u - i - r; b++)
|
|
2626
|
+
a += `<div class="day-cell other-month" data-date="${B(h, v, b)}">${b}</div>`;
|
|
2627
|
+
return a;
|
|
2625
2628
|
});
|
|
2626
2629
|
s(this, "_getModeHint", () => this.rangeMode ? this._selectedRange.start ? this._selectedRange.end ? `${this._selectedRange.start} → ${this._selectedRange.end}` : "Select end date" : "Select start date" : "Select a date");
|
|
2627
2630
|
s(this, "_render", () => {
|
|
@@ -2829,13 +2832,13 @@ class vt extends v {
|
|
|
2829
2832
|
<div class="header">
|
|
2830
2833
|
<button class="nav-btn" id="prev-month">‹</button>
|
|
2831
2834
|
<div class="month-year">
|
|
2832
|
-
${
|
|
2835
|
+
${St[e]}
|
|
2833
2836
|
<select class="year-select">${this._generateYearOptions(t)}</select>
|
|
2834
2837
|
</div>
|
|
2835
2838
|
<button class="nav-btn" id="next-month">›</button>
|
|
2836
2839
|
</div>
|
|
2837
2840
|
<div class="day-headers">
|
|
2838
|
-
${
|
|
2841
|
+
${Mt.map((n) => `<div class="day-header">${n}</div>`).join("")}
|
|
2839
2842
|
</div>
|
|
2840
2843
|
<div class="calendar-grid">
|
|
2841
2844
|
${this._generateGrid(t, e)}
|
|
@@ -2916,40 +2919,40 @@ class vt extends v {
|
|
|
2916
2919
|
this._selectedDate = null, this._selectedRange = { start: null, end: null }, this._render();
|
|
2917
2920
|
}
|
|
2918
2921
|
}
|
|
2919
|
-
s(
|
|
2920
|
-
const
|
|
2922
|
+
s(pt, "observedAttributes", ["range-mode", "value", "range-start", "range-end", "disabled"]);
|
|
2923
|
+
const wt = (p) => `${p.getFullYear()}-${String(p.getMonth() + 1).padStart(2, "0")}-${String(p.getDate()).padStart(2, "0")}`, I = (p) => {
|
|
2921
2924
|
const [c, t, e] = p.split("-").map(Number);
|
|
2922
2925
|
return new Date(c, t - 1, e);
|
|
2923
|
-
},
|
|
2926
|
+
}, B = (p, c, t) => `${p}-${String(c + 1).padStart(2, "0")}-${String(t).padStart(2, "0")}`, Dt = (p, c, t) => !(!c || !t) && p > c && p < t, W = "woxTheme", C = class C {
|
|
2924
2927
|
};
|
|
2925
|
-
s(
|
|
2928
|
+
s(C, "get", () => document.documentElement.dataset[W] === "light" ? "light" : "dark"), s(C, "set", (c) => {
|
|
2926
2929
|
if (c === "dark" || c === "light") {
|
|
2927
|
-
c === "light" ? document.documentElement.dataset[
|
|
2930
|
+
c === "light" ? document.documentElement.dataset[W] = "light" : delete document.documentElement.dataset[W];
|
|
2928
2931
|
try {
|
|
2929
2932
|
localStorage.setItem("wox-theme", c);
|
|
2930
2933
|
} catch {
|
|
2931
2934
|
}
|
|
2932
2935
|
document.documentElement.dispatchEvent(new CustomEvent("wox-theme-change", { detail: { theme: c }, bubbles: !0, composed: !0 }));
|
|
2933
2936
|
}
|
|
2934
|
-
}), s(
|
|
2935
|
-
|
|
2936
|
-
}), s(
|
|
2937
|
+
}), s(C, "toggle", () => {
|
|
2938
|
+
C.set(C.get() === "dark" ? "light" : "dark");
|
|
2939
|
+
}), s(C, "auto", () => {
|
|
2937
2940
|
try {
|
|
2938
2941
|
const t = localStorage.getItem("wox-theme");
|
|
2939
|
-
if (t === "dark" || t === "light") return void
|
|
2942
|
+
if (t === "dark" || t === "light") return void C.set(t);
|
|
2940
2943
|
} catch {
|
|
2941
2944
|
}
|
|
2942
2945
|
const c = window.matchMedia("(prefers-color-scheme: light)").matches;
|
|
2943
|
-
|
|
2946
|
+
C.set(c ? "light" : "dark");
|
|
2944
2947
|
});
|
|
2945
|
-
let
|
|
2946
|
-
class
|
|
2948
|
+
let S = C;
|
|
2949
|
+
class ft extends w {
|
|
2947
2950
|
constructor() {
|
|
2948
2951
|
super(...arguments);
|
|
2949
2952
|
s(this, "_onThemeChange", null);
|
|
2950
2953
|
}
|
|
2951
2954
|
connectedCallback() {
|
|
2952
|
-
this._render(), this.hasAttribute("auto") &&
|
|
2955
|
+
this._render(), this.hasAttribute("auto") && S.auto(), this._onThemeChange = () => this._updateIcon(), document.documentElement.addEventListener("wox-theme-change", this._onThemeChange), this._updateIcon();
|
|
2953
2956
|
}
|
|
2954
2957
|
disconnectedCallback() {
|
|
2955
2958
|
this._onThemeChange && (document.documentElement.removeEventListener("wox-theme-change", this._onThemeChange), this._onThemeChange = null);
|
|
@@ -2989,16 +2992,16 @@ class Dt extends v {
|
|
|
2989
2992
|
-webkit-font-smoothing: antialiased;
|
|
2990
2993
|
text-rendering: optimizeLegibility;
|
|
2991
2994
|
}
|
|
2992
|
-
`, '<button type="button" title="Toggle theme"><span class="icon">light_mode</span></button>'), this.$("button").addEventListener("click", () =>
|
|
2995
|
+
`, '<button type="button" title="Toggle theme"><span class="icon">light_mode</span></button>'), this.$("button").addEventListener("click", () => S.toggle());
|
|
2993
2996
|
}
|
|
2994
2997
|
_updateIcon() {
|
|
2995
2998
|
const t = this.$(".icon");
|
|
2996
2999
|
if (!t) return;
|
|
2997
|
-
const e =
|
|
3000
|
+
const e = S.get() === "dark";
|
|
2998
3001
|
t.textContent = e ? "light_mode" : "dark_mode", this.$("button").title = e ? "Switch to light mode" : "Switch to dark mode";
|
|
2999
3002
|
}
|
|
3000
3003
|
}
|
|
3001
|
-
customElements.define("wox-icon",
|
|
3004
|
+
customElements.define("wox-icon", H), customElements.define("wox-separator", j), customElements.define("wox-badge", G), customElements.define("wox-button", Y), customElements.define("wox-input", X), customElements.define("wox-select", q), customElements.define("wox-slider", J), customElements.define("wox-color-swatch", K), customElements.define("wox-tooltip", V), customElements.define("wox-color-picker", U), customElements.define("wox-menu-item", Q), customElements.define("wox-menu", Z), customElements.define("wox-layer-item", tt), customElements.define("wox-section", et), customElements.define("wox-tab", nt), customElements.define("wox-tabs", ot), customElements.define("wox-toolbar-group", it), customElements.define("wox-toolbar", st), customElements.define("wox-panel", rt), customElements.define("wox-menubar", at), customElements.define("wox-statusbar", dt), customElements.define("wox-modal", lt), customElements.define("wox-datagrid", vt), customElements.define("wox-toast", L), customElements.define("wox-context-menu", O), customElements.define("wox-gradient-editor", mt), customElements.define("wox-gradient-selector", ct), customElements.define("wox-date-picker", pt), customElements.define("wox-theme-toggle", ft);
|
|
3002
3005
|
const Rt = `/* wox-theme.css — Global CSS custom properties for the WOX component library */
|
|
3003
3006
|
:root {
|
|
3004
3007
|
--wox-bg-app: #121214;
|
|
@@ -3086,40 +3089,40 @@ const Rt = `/* wox-theme.css — Global CSS custom properties for the WOX compon
|
|
|
3086
3089
|
if (document.getElementById("wox-theme")) return;
|
|
3087
3090
|
const p = document.createElement("style");
|
|
3088
3091
|
p.id = "wox-theme", p.textContent = Rt, document.head.appendChild(p);
|
|
3089
|
-
})();
|
|
3092
|
+
})(), window.WoxIcon = H, window.WoxSeparator = j, window.WoxBadge = G, window.WoxButton = Y, window.WoxInput = X, window.WoxSelect = q, window.WoxSlider = J, window.WoxColorSwatch = K, window.WoxTooltip = V, window.WoxColorPicker = U, window.WoxMenuItem = Q, window.WoxMenu = Z, window.WoxLayerItem = tt, window.WoxSection = et, window.WoxTab = nt, window.WoxTabs = ot, window.WoxToolbarGroup = it, window.WoxToolbar = st, window.WoxPanel = rt, window.WoxMenubar = at, window.WoxStatusbar = dt, window.WoxModal = lt, window.WoxDatagrid = vt, window.WoxToast = L, window.WoxContextMenu = O, window.WoxGradientEditor = mt, window.WoxGradientSelector = ct, window.WoxDatePicker = pt, window.WoxThemeToggle = ft;
|
|
3090
3093
|
export {
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3094
|
+
M as FX_STYLES,
|
|
3095
|
+
G as WoxBadge,
|
|
3096
|
+
Y as WoxButton,
|
|
3097
|
+
U as WoxColorPicker,
|
|
3098
|
+
K as WoxColorSwatch,
|
|
3099
|
+
O as WoxContextMenu,
|
|
3100
|
+
vt as WoxDatagrid,
|
|
3101
|
+
pt as WoxDatePicker,
|
|
3102
|
+
w as WoxElement,
|
|
3103
|
+
mt as WoxGradientEditor,
|
|
3104
|
+
ct as WoxGradientSelector,
|
|
3105
|
+
H as WoxIcon,
|
|
3106
|
+
X as WoxInput,
|
|
3107
|
+
tt as WoxLayerItem,
|
|
3108
|
+
Z as WoxMenu,
|
|
3109
|
+
Q as WoxMenuItem,
|
|
3110
|
+
at as WoxMenubar,
|
|
3111
|
+
lt as WoxModal,
|
|
3112
|
+
rt as WoxPanel,
|
|
3113
|
+
et as WoxSection,
|
|
3114
|
+
q as WoxSelect,
|
|
3115
|
+
j as WoxSeparator,
|
|
3116
|
+
J as WoxSlider,
|
|
3117
|
+
dt as WoxStatusbar,
|
|
3118
|
+
nt as WoxTab,
|
|
3119
|
+
ot as WoxTabs,
|
|
3120
|
+
S as WoxTheme,
|
|
3121
|
+
ft as WoxThemeToggle,
|
|
3122
|
+
L as WoxToast,
|
|
3123
|
+
st as WoxToolbar,
|
|
3124
|
+
it as WoxToolbarGroup,
|
|
3125
|
+
V as WoxTooltip,
|
|
3126
|
+
gt as cssToGradient,
|
|
3127
|
+
A as gradientToCSS
|
|
3125
3128
|
};
|