wox-gui 0.1.7 → 0.1.9
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 +489 -468
- package/dist/wox-gui.js +385 -364
- package/package.json +1 -1
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 $t = Object.defineProperty;
|
|
2
|
+
var Et = (p, c, t) => c in p ? $t(p, c, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[c] = t;
|
|
3
|
+
var s = (p, c, t) => Et(p, typeof c != "symbol" ? c + "" : c, t);
|
|
4
|
+
const P = class P 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>${P.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 T = class T extends HTMLElement {
|
|
|
15
15
|
this.attachShadow({ mode: "open" });
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
s(
|
|
18
|
+
s(P, "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 w =
|
|
24
|
-
const
|
|
23
|
+
let w = P;
|
|
24
|
+
const D = `
|
|
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 G 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
|
+
${D} :host { --size: ${e}px; }`, a);
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
connectedCallback() {
|
|
@@ -70,8 +70,8 @@ class H extends w {
|
|
|
70
70
|
this.isConnected && this._render();
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
s(
|
|
74
|
-
class
|
|
73
|
+
s(G, "observedAttributes", ["name", "size", "color", "glow", "pulse"]);
|
|
74
|
+
class Y extends w {
|
|
75
75
|
constructor() {
|
|
76
76
|
super(...arguments);
|
|
77
77
|
s(this, "_render", () => {
|
|
@@ -92,8 +92,8 @@ class G extends w {
|
|
|
92
92
|
this.isConnected && this._render();
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
s(
|
|
96
|
-
class
|
|
95
|
+
s(Y, "observedAttributes", ["direction", "spacing"]);
|
|
96
|
+
class X extends w {
|
|
97
97
|
constructor() {
|
|
98
98
|
super(...arguments);
|
|
99
99
|
s(this, "_render", () => {
|
|
@@ -115,27 +115,30 @@ class j extends w {
|
|
|
115
115
|
this.isConnected && this._render();
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
|
-
s(
|
|
119
|
-
class
|
|
118
|
+
s(X, "observedAttributes", ["variant", "text", "color"]);
|
|
119
|
+
class q 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") || "", d = this.hasAttribute("glow"), h = this.hasAttribute("pulse"), l = this.getAttribute("border-color") || "", g = this.getAttribute("border-style") || "", x = this.getAttribute("icon-color") || "", f = this.getAttribute("text-color") || "", b = [`v-${t}`, o ? "active" : "", d ? "glow" : "", h ? "pulse" : ""].filter(Boolean).join(" ");
|
|
124
|
+
let u = "";
|
|
125
|
+
t === "icon" ? u = e ? `<span class="material-icons">${e}</span>` : "<slot></slot>" : t === "text" ? u = (e ? `<span class="material-icons" style="font-size:14px">${e}</span>` : "") + (n || "<slot></slot>") : t === "tile" ? u = (e ? `<span class="material-icons">${e}</span>` : '<slot name="icon"></slot>') + `<span>${n}</span>` : t === "dash" && (u = `<div class="dash-line${r === "solid" ? "" : ` ${r}`}"></div>`);
|
|
126
|
+
const v = [];
|
|
127
|
+
a && v.push(`--wox-fx-color:${a}`), l && v.push(`--wox-btn-border:${l}`), g && v.push(`--wox-btn-border-style:${g}`), x && v.push(`--wox-btn-icon:${x}`), f && v.push(`--wox-btn-text:${f}`);
|
|
128
|
+
const k = a ? " data-color" : "", A = v.length ? ` style="${v.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 Y extends w {
|
|
|
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 Y extends w {
|
|
|
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 Y extends w {
|
|
|
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
|
+
` + D, `<button class="${b}"${k}${A} ${i ? "disabled" : ""}>${u}</button>`), this.$("button").addEventListener("click", (z) => {
|
|
196
|
+
i || this.emit("wox-click", { originalEvent: z });
|
|
194
197
|
});
|
|
195
198
|
});
|
|
196
199
|
}
|
|
@@ -201,12 +204,13 @@ class Y extends w {
|
|
|
201
204
|
this.isConnected && this._render();
|
|
202
205
|
}
|
|
203
206
|
}
|
|
204
|
-
s(
|
|
205
|
-
|
|
207
|
+
s(q, "observedAttributes", ["variant", "icon", "label", "active", "disabled", "color", "size", "dash", "glow", "pulse", "border-color", "border-style", "icon-color", "text-color"]);
|
|
208
|
+
const Ct = ["text", "number", "password", "email", "url", "tel", "search", "color", "date", "time", "datetime-local", "range"], At = ["number", "range"];
|
|
209
|
+
class J extends w {
|
|
206
210
|
constructor() {
|
|
207
211
|
super(...arguments);
|
|
208
212
|
s(this, "_render", () => {
|
|
209
|
-
const t = this.getAttribute("type") || "text", e = this.getAttribute("value") || "",
|
|
213
|
+
const t = this.getAttribute("type") || "text", e = Ct.includes(t) ? t : "text", n = this.getAttribute("value") || "", o = this.getAttribute("unit") || "", i = this.getAttribute("label") || "", r = this.getAttribute("min"), a = this.getAttribute("max"), d = this.getAttribute("step"), h = this.getAttribute("placeholder") || "", l = this.hasAttribute("disabled"), g = At.includes(e), x = e === "number", f = g ? `${r !== null ? ` min="${r}"` : ""}${a !== null ? ` max="${a}"` : ""}${d !== null ? ` step="${d}"` : ""}` : "", b = o && e !== "color" && e !== "range";
|
|
210
214
|
this.render(`
|
|
211
215
|
:host { display: inline-block; }
|
|
212
216
|
.wrapper { display: flex; flex-direction: column; gap: 3px; }
|
|
@@ -229,36 +233,53 @@ class X extends w {
|
|
|
229
233
|
input:disabled { opacity: 0.4; cursor: not-allowed; }
|
|
230
234
|
input.has-unit { padding-right: 28px; }
|
|
231
235
|
.suffix { position: absolute; right: 8px; font-size: var(--wox-font-size-sm, 10px); color: var(--wox-text-secondary, #999); pointer-events: none; }
|
|
236
|
+
input[type="color"] {
|
|
237
|
+
padding: 2px; height: 32px; cursor: pointer;
|
|
238
|
+
border-radius: var(--wox-radius-md, 6px);
|
|
239
|
+
}
|
|
240
|
+
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
|
|
241
|
+
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 3px; }
|
|
242
|
+
input[type="color"]::-moz-color-swatch { border: none; border-radius: 3px; }
|
|
243
|
+
input[type="date"], input[type="time"], input[type="datetime-local"] {
|
|
244
|
+
color-scheme: dark;
|
|
245
|
+
}
|
|
246
|
+
input[type="search"]::-webkit-search-cancel-button { filter: invert(0.7); }
|
|
247
|
+
input[type="range"] {
|
|
248
|
+
padding: 0; background: transparent; border: none; box-shadow: none;
|
|
249
|
+
accent-color: var(--wox-accent, #00e5ff);
|
|
250
|
+
height: 20px; cursor: pointer;
|
|
251
|
+
}
|
|
252
|
+
input[type="range"]:focus { box-shadow: none; border: none; }
|
|
232
253
|
`, `
|
|
233
254
|
<div class="wrapper">
|
|
234
|
-
${
|
|
255
|
+
${i ? `<label class="${x ? "scrub" : ""}">${i}${b ? `<span class="unit">${o}</span>` : ""}</label>` : ""}
|
|
235
256
|
<div class="input-wrap">
|
|
236
|
-
<input type="${
|
|
237
|
-
${
|
|
257
|
+
<input type="${e}" value="${n}" placeholder="${h}" ${f} ${l ? "disabled" : ""} class="${b && !i ? "has-unit" : ""}">
|
|
258
|
+
${b && !i ? `<span class="suffix">${o}</span>` : ""}
|
|
238
259
|
</div>
|
|
239
260
|
</div>
|
|
240
261
|
`);
|
|
241
|
-
const
|
|
242
|
-
if (
|
|
243
|
-
const v =
|
|
262
|
+
const u = this.$("input");
|
|
263
|
+
if (u.addEventListener("input", () => {
|
|
264
|
+
const v = g ? parseFloat(u.value) : u.value;
|
|
244
265
|
this.emit("wox-input", { value: v });
|
|
245
|
-
}),
|
|
246
|
-
const v =
|
|
266
|
+
}), u.addEventListener("change", () => {
|
|
267
|
+
const v = g ? parseFloat(u.value) : u.value;
|
|
247
268
|
this.emit("wox-change", { value: v });
|
|
248
|
-
}),
|
|
249
|
-
v.key === "Enter" &&
|
|
250
|
-
}),
|
|
269
|
+
}), u.addEventListener("keydown", (v) => {
|
|
270
|
+
v.key === "Enter" && u.blur();
|
|
271
|
+
}), x && i) {
|
|
251
272
|
const v = this.$("label");
|
|
252
|
-
let
|
|
253
|
-
const
|
|
254
|
-
const
|
|
255
|
-
let
|
|
256
|
-
|
|
257
|
-
},
|
|
258
|
-
document.removeEventListener("mousemove",
|
|
273
|
+
let k = 0, A = 0;
|
|
274
|
+
const z = (y) => {
|
|
275
|
+
const N = y.clientX - k, kt = parseFloat(d) || 1;
|
|
276
|
+
let L = A + Math.round(N / 2) * kt;
|
|
277
|
+
r !== null && (L = Math.max(parseFloat(r), L)), a !== null && (L = Math.min(parseFloat(a), L)), u.value = L, this.emit("wox-input", { value: L });
|
|
278
|
+
}, m = () => {
|
|
279
|
+
document.removeEventListener("mousemove", z), document.removeEventListener("mouseup", m), this.emit("wox-change", { value: parseFloat(u.value) });
|
|
259
280
|
};
|
|
260
|
-
v.addEventListener("mousedown", (
|
|
261
|
-
|
|
281
|
+
v.addEventListener("mousedown", (y) => {
|
|
282
|
+
l || (k = y.clientX, A = parseFloat(u.value) || 0, document.addEventListener("mousemove", z), document.addEventListener("mouseup", m), y.preventDefault());
|
|
262
283
|
});
|
|
263
284
|
}
|
|
264
285
|
});
|
|
@@ -285,9 +306,9 @@ class X extends w {
|
|
|
285
306
|
e && (e.value = t);
|
|
286
307
|
}
|
|
287
308
|
}
|
|
288
|
-
s(
|
|
289
|
-
const
|
|
290
|
-
class
|
|
309
|
+
s(J, "observedAttributes", ["type", "value", "unit", "label", "min", "max", "step", "placeholder", "disabled"]);
|
|
310
|
+
const $ = (p) => String(p).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
311
|
+
class K extends w {
|
|
291
312
|
constructor() {
|
|
292
313
|
super(...arguments);
|
|
293
314
|
s(this, "_isOpen", !1);
|
|
@@ -317,8 +338,8 @@ class q extends w {
|
|
|
317
338
|
s(this, "_calculateDropdownPosition", () => {
|
|
318
339
|
const t = this.$(".trigger");
|
|
319
340
|
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:
|
|
341
|
+
const e = t.getBoundingClientRect(), n = window.innerHeight, o = window.innerWidth, i = n - e.bottom, r = e.top, a = e.width, d = Math.max(0, Math.min(e.left, o - a));
|
|
342
|
+
return this._openUpward ? { bottom: n - e.top + 2, left: d, width: a, maxHeight: Math.max(100, Math.min(200, r - 10)) } : { top: e.bottom + 2, left: d, width: a, maxHeight: Math.max(100, Math.min(200, i - 10)) };
|
|
322
343
|
});
|
|
323
344
|
s(this, "_updateDropdownPosition", () => {
|
|
324
345
|
requestAnimationFrame(() => {
|
|
@@ -368,25 +389,25 @@ class q extends w {
|
|
|
368
389
|
let e = "";
|
|
369
390
|
if (this.multiple && this._selectedOptions.length > 0) e = this._selectedOptions.map((o) => `
|
|
370
391
|
<span class="tag">
|
|
371
|
-
${o.image ? `<img src="${
|
|
372
|
-
${
|
|
373
|
-
<span class="remove-tag" data-value="${
|
|
392
|
+
${o.image ? `<img src="${$(o.image)}" class="tag-img" alt="">` : ""}
|
|
393
|
+
${$(o.label)}
|
|
394
|
+
<span class="remove-tag" data-value="${$(o.value)}">×</span>
|
|
374
395
|
</span>
|
|
375
396
|
`).join("");
|
|
376
397
|
else if (this._selectedOptions.length > 0) {
|
|
377
398
|
const o = this._selectedOptions[0];
|
|
378
399
|
e = `<span class="single-value">
|
|
379
|
-
${o.image ? `<img src="${
|
|
380
|
-
<span>${
|
|
400
|
+
${o.image ? `<img src="${$(o.image)}" class="single-img" alt="">` : ""}
|
|
401
|
+
<span>${$(o.label)}</span>
|
|
381
402
|
</span>`;
|
|
382
|
-
} else e = `<span class="placeholder">${
|
|
403
|
+
} else e = `<span class="placeholder">${$(this.placeholder)}</span>`;
|
|
383
404
|
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="${
|
|
405
|
+
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
|
|
406
|
+
class="option${this._selectedOptions.some((r) => r.value === o.value) ? " selected" : ""}${i === this._focusedIndex ? " focused" : ""}"
|
|
407
|
+
data-value="${$(o.value)}"
|
|
387
408
|
>
|
|
388
|
-
${o.image ? `<img src="${
|
|
389
|
-
<span>${
|
|
409
|
+
${o.image ? `<img src="${$(o.image)}" class="option-img" alt="">` : ""}
|
|
410
|
+
<span>${$(o.label)}</span>
|
|
390
411
|
</div>`).join("") : '<div class="no-options">No options found</div>'}</div>`), this.render(`
|
|
391
412
|
:host {
|
|
392
413
|
display: inline-block;
|
|
@@ -615,7 +636,7 @@ class q extends w {
|
|
|
615
636
|
if (t === "options") {
|
|
616
637
|
this._parsedOptions = null;
|
|
617
638
|
const o = this.options;
|
|
618
|
-
this._filteredOptions = [...o], this._selectedOptions = this._selectedOptions.filter((i) => o.some((
|
|
639
|
+
this._filteredOptions = [...o], this._selectedOptions = this._selectedOptions.filter((i) => o.some((r) => r.value === i.value));
|
|
619
640
|
} else if (t === "value" && n !== null) {
|
|
620
641
|
const o = this.options.find((i) => i.value === n);
|
|
621
642
|
this._selectedOptions = o ? [o] : [];
|
|
@@ -706,8 +727,8 @@ class q extends w {
|
|
|
706
727
|
this._selectedOptions = [], this._filteredOptions = [...t], this._parsedOptions = null, this.setAttribute("options", JSON.stringify(t));
|
|
707
728
|
}
|
|
708
729
|
}
|
|
709
|
-
s(
|
|
710
|
-
class
|
|
730
|
+
s(K, "observedAttributes", ["multiple", "searchable", "placeholder", "disabled", "value", "options"]);
|
|
731
|
+
class V extends w {
|
|
711
732
|
constructor() {
|
|
712
733
|
super();
|
|
713
734
|
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 +737,11 @@ class J extends w {
|
|
|
716
737
|
return e === "%" ? Math.round(100 * t) + "%" : n < 1 ? t.toFixed(2) : String(t);
|
|
717
738
|
});
|
|
718
739
|
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 + "%"),
|
|
740
|
+
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");
|
|
741
|
+
i && (i.style.width = o + "%"), r && (r.style.left = o + "%"), a && (a.textContent = this._formatVal(n));
|
|
721
742
|
});
|
|
722
743
|
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"),
|
|
744
|
+
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") || "", d = [this.hasAttribute("glow") ? "glow" : "", this.hasAttribute("pulse") ? "pulse" : ""].filter(Boolean).join(" "), h = a ? `--wox-fx-color:${a};border-color:${a}` : "", l = a ? " custom-color" : "";
|
|
724
745
|
this.render(`
|
|
725
746
|
:host { display: inline-block; width: 100%; }
|
|
726
747
|
.wrapper { display: flex; align-items: center; gap: var(--wox-space-lg, 12px); }
|
|
@@ -745,38 +766,38 @@ class J extends w {
|
|
|
745
766
|
}
|
|
746
767
|
.fill.custom-color { background: var(--wox-fx-color); }
|
|
747
768
|
.thumb.glow { width: 16px; height: 16px; }
|
|
748
|
-
` +
|
|
769
|
+
` + D, `
|
|
749
770
|
<div class="wrapper">
|
|
750
771
|
${o ? `<span class="label">${o}</span>` : ""}
|
|
751
772
|
<div class="track-wrap">
|
|
752
|
-
<div class="track"><div class="fill${
|
|
753
|
-
<div class="thumb ${
|
|
773
|
+
<div class="track"><div class="fill${l}" style="width:${r}%;${a ? "--wox-fx-color:" + a : ""}"></div></div>
|
|
774
|
+
<div class="thumb ${d}" style="${h};left:${r}%"></div>
|
|
754
775
|
</div>
|
|
755
776
|
${i ? `<span class="value">${this._formatVal(n)}</span>` : ""}
|
|
756
777
|
</div>
|
|
757
778
|
`), this._attachDrag();
|
|
758
779
|
});
|
|
759
780
|
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
|
-
},
|
|
769
|
-
const
|
|
770
|
-
this.emit("wox-input", { value:
|
|
771
|
-
},
|
|
772
|
-
this._dragging = !1,
|
|
773
|
-
const
|
|
774
|
-
this.setAttribute("value",
|
|
781
|
+
const { min: t, max: e, step: n, unit: o } = this._getConfig(), i = this.$(".track-wrap"), r = this.$(".fill"), a = this.$(".thumb"), d = this.$(".value"), h = (x) => {
|
|
782
|
+
const f = i.getBoundingClientRect();
|
|
783
|
+
let b = (x - f.left) / f.width;
|
|
784
|
+
b = Math.max(0, Math.min(1, b));
|
|
785
|
+
let u = t + b * (e - t);
|
|
786
|
+
u = Math.round(u / n) * n, u = Math.max(t, Math.min(e, u));
|
|
787
|
+
const v = (u - t) / (e - t) * 100;
|
|
788
|
+
return r.style.width = v + "%", a.style.left = v + "%", d && (d.textContent = o === "%" ? Math.round(100 * u) + "%" : n < 1 ? u.toFixed(2) : String(u)), u;
|
|
789
|
+
}, l = (x) => {
|
|
790
|
+
const f = h(x.clientX);
|
|
791
|
+
this.emit("wox-input", { value: f });
|
|
792
|
+
}, g = (x) => {
|
|
793
|
+
this._dragging = !1, a.classList.remove("dragging"), document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", g);
|
|
794
|
+
const f = h(x.clientX);
|
|
795
|
+
this.setAttribute("value", f), this.emit("wox-change", { value: f });
|
|
775
796
|
};
|
|
776
797
|
i.addEventListener("mousedown", (x) => {
|
|
777
|
-
this._dragging = !0,
|
|
778
|
-
const
|
|
779
|
-
this.emit("wox-input", { value:
|
|
798
|
+
this._dragging = !0, a.classList.add("dragging");
|
|
799
|
+
const f = h(x.clientX);
|
|
800
|
+
this.emit("wox-input", { value: f }), document.addEventListener("mousemove", l), document.addEventListener("mouseup", g), x.preventDefault();
|
|
780
801
|
});
|
|
781
802
|
});
|
|
782
803
|
this._dragging = !1;
|
|
@@ -788,12 +809,12 @@ class J extends w {
|
|
|
788
809
|
this.isConnected && (this._dragging || (t === "value" ? this._updateVisuals() : this._build()));
|
|
789
810
|
}
|
|
790
811
|
}
|
|
791
|
-
s(
|
|
792
|
-
class
|
|
812
|
+
s(V, "observedAttributes", ["value", "min", "max", "step", "label", "unit", "show-value", "color", "glow", "pulse"]);
|
|
813
|
+
class U extends w {
|
|
793
814
|
constructor() {
|
|
794
815
|
super(...arguments);
|
|
795
816
|
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"),
|
|
817
|
+
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
818
|
this.render(`
|
|
798
819
|
:host { display: inline-block; }
|
|
799
820
|
.swatch {
|
|
@@ -811,7 +832,7 @@ class K extends w {
|
|
|
811
832
|
background: repeating-conic-gradient(#888 0% 25%, #fff 0% 50%) 0 0 / 8px 8px;
|
|
812
833
|
}
|
|
813
834
|
.color { position: absolute; inset: 0; }
|
|
814
|
-
${
|
|
835
|
+
${D} :host { --size: ${e}px; }`, `<div class="swatch ${r}"${a}>
|
|
815
836
|
<div class="checker"></div>
|
|
816
837
|
<div class="color" style="background:${t}"></div>
|
|
817
838
|
</div>`), this.$(".swatch").addEventListener("click", () => {
|
|
@@ -826,8 +847,8 @@ class K extends w {
|
|
|
826
847
|
this.isConnected && this._render();
|
|
827
848
|
}
|
|
828
849
|
}
|
|
829
|
-
s(
|
|
830
|
-
class
|
|
850
|
+
s(U, "observedAttributes", ["color", "size", "selected", "glow", "pulse"]);
|
|
851
|
+
class Q extends w {
|
|
831
852
|
constructor() {
|
|
832
853
|
super(...arguments);
|
|
833
854
|
s(this, "_render", () => {
|
|
@@ -851,9 +872,9 @@ class V extends w {
|
|
|
851
872
|
s(this, "_position", () => {
|
|
852
873
|
const t = this.shadowRoot.querySelector(".tip");
|
|
853
874
|
if (!t) return;
|
|
854
|
-
const e = this.getAttribute("position") || "top", n = this.getBoundingClientRect(), o = t.getBoundingClientRect(), i = window.innerWidth,
|
|
855
|
-
let
|
|
856
|
-
h === "top" ? (
|
|
875
|
+
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 }, d = { top: "bottom", bottom: "top", left: "right", right: "left" }, h = [e, d[e], ...["top", "bottom", "left", "right"].filter((x) => x !== e && x !== d[e])].find((x) => a[x]) || e;
|
|
876
|
+
let l, g;
|
|
877
|
+
h === "top" ? (l = n.top - 6 - o.height, g = n.left + n.width / 2 - o.width / 2) : h === "bottom" ? (l = n.bottom + 6, g = n.left + n.width / 2 - o.width / 2) : h === "left" ? (l = n.top + n.height / 2 - o.height / 2, g = n.left - 6 - o.width) : (l = n.top + n.height / 2 - o.height / 2, g = n.right + 6), g = Math.max(4, Math.min(g, i - o.width - 4)), l = Math.max(4, Math.min(l, r - o.height - 4)), t.style.top = `${l}px`, t.style.left = `${g}px`;
|
|
857
878
|
});
|
|
858
879
|
}
|
|
859
880
|
connectedCallback() {
|
|
@@ -863,8 +884,8 @@ class V extends w {
|
|
|
863
884
|
this.isConnected && this._render();
|
|
864
885
|
}
|
|
865
886
|
}
|
|
866
|
-
s(
|
|
867
|
-
class
|
|
887
|
+
s(Q, "observedAttributes", ["text", "position", "delay"]);
|
|
888
|
+
class Z extends w {
|
|
868
889
|
constructor() {
|
|
869
890
|
super();
|
|
870
891
|
s(this, "_initFromAttrs", () => {
|
|
@@ -975,19 +996,19 @@ class U extends w {
|
|
|
975
996
|
const n = t.createConicGradient(-Math.PI / 2, 110, 110);
|
|
976
997
|
for (let x = 0; x <= 36; x++) n.addColorStop(x / 36, `hsl(${10 * x},100%,50%)`);
|
|
977
998
|
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
|
-
|
|
999
|
+
const o = this._hue * Math.PI * 2 - Math.PI / 2, i = 110 + 91 * Math.cos(o), r = 110 + 91 * Math.sin(o);
|
|
1000
|
+
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();
|
|
1001
|
+
const a = 104, d = t.createLinearGradient(58, 0, 162, 0);
|
|
1002
|
+
d.addColorStop(0, "#fff"), d.addColorStop(1, `hsl(${360 * this._hue},100%,50%)`), t.fillStyle = d, t.fillRect(58, 58, a, a);
|
|
982
1003
|
const h = t.createLinearGradient(0, 58, 0, 162);
|
|
983
|
-
h.addColorStop(0, "rgba(0,0,0,0)"), h.addColorStop(1, "rgba(0,0,0,1)"), t.fillStyle = h, t.fillRect(58, 58,
|
|
984
|
-
const
|
|
985
|
-
t.strokeStyle = "#fff", t.lineWidth = 2.5, t.beginPath(), t.arc(
|
|
1004
|
+
h.addColorStop(0, "rgba(0,0,0,0)"), h.addColorStop(1, "rgba(0,0,0,1)"), t.fillStyle = h, t.fillRect(58, 58, a, a);
|
|
1005
|
+
const l = 58 + this._sat * a, g = 58 + (1 - this._val) * a;
|
|
1006
|
+
t.strokeStyle = "#fff", t.lineWidth = 2.5, t.beginPath(), t.arc(l, g, 7, 0, 2 * Math.PI), t.stroke(), t.strokeStyle = "rgba(0,0,0,0.4)", t.lineWidth = 1, t.beginPath(), t.arc(l, g, 7, 0, 2 * Math.PI), t.stroke();
|
|
986
1007
|
});
|
|
987
1008
|
s(this, "_drawAlpha", () => {
|
|
988
1009
|
const t = this._aCtx;
|
|
989
1010
|
t.clearRect(0, 0, 192, 14);
|
|
990
|
-
for (let
|
|
1011
|
+
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
1012
|
const [e, n, o] = this._hsvToRgb(this._hue, this._sat, this._val), i = t.createLinearGradient(0, 0, 192, 0);
|
|
992
1013
|
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
1014
|
});
|
|
@@ -1022,16 +1043,16 @@ class U extends w {
|
|
|
1022
1043
|
});
|
|
1023
1044
|
s(this, "_hsvToRgb", (t, e, n) => {
|
|
1024
1045
|
const o = (i) => {
|
|
1025
|
-
const
|
|
1026
|
-
return n - n * e * Math.max(0, Math.min(
|
|
1046
|
+
const r = (i + 6 * t) % 6;
|
|
1047
|
+
return n - n * e * Math.max(0, Math.min(r, 4 - r, 1));
|
|
1027
1048
|
};
|
|
1028
1049
|
return [Math.round(255 * o(5)), Math.round(255 * o(3)), Math.round(255 * o(1))];
|
|
1029
1050
|
});
|
|
1030
1051
|
s(this, "_rgbToHsv", (t, e, n) => {
|
|
1031
1052
|
t /= 255, e /= 255, n /= 255;
|
|
1032
1053
|
const o = Math.max(t, e, n), i = o - Math.min(t, e, n);
|
|
1033
|
-
let
|
|
1034
|
-
return i && (
|
|
1054
|
+
let r = 0;
|
|
1055
|
+
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
1056
|
});
|
|
1036
1057
|
s(this, "_hexToRgb", (t) => {
|
|
1037
1058
|
const e = parseInt(t.slice(1), 16);
|
|
@@ -1050,8 +1071,8 @@ class U extends w {
|
|
|
1050
1071
|
} else t !== "color" && t !== "alpha" || (this._initFromAttrs(), this.hasAttribute("open") && this._redraw());
|
|
1051
1072
|
}
|
|
1052
1073
|
}
|
|
1053
|
-
s(
|
|
1054
|
-
const
|
|
1074
|
+
s(Z, "observedAttributes", ["color", "alpha", "open"]);
|
|
1075
|
+
const F = `
|
|
1055
1076
|
:host { display: block; }
|
|
1056
1077
|
.item {
|
|
1057
1078
|
color: var(--wox-text-primary, #eee); padding: 8px 12px; display: flex; align-items: center;
|
|
@@ -1072,21 +1093,21 @@ const P = `
|
|
|
1072
1093
|
}
|
|
1073
1094
|
.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
1095
|
`;
|
|
1075
|
-
class
|
|
1096
|
+
class tt extends w {
|
|
1076
1097
|
constructor() {
|
|
1077
1098
|
super(...arguments);
|
|
1078
1099
|
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(
|
|
1100
|
+
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");
|
|
1101
|
+
t !== "separator" ? t !== "header" ? (this.render(F, `
|
|
1081
1102
|
<div class="item ${i ? "disabled" : ""}">
|
|
1082
1103
|
${o ? `<span class="icon material-icons">${o}</span>` : ""}
|
|
1083
1104
|
<span class="label">${e}</span>
|
|
1084
1105
|
${n ? `<span class="shortcut">${n}</span>` : ""}
|
|
1085
|
-
${
|
|
1106
|
+
${r ? '<span class="arrow">▶</span>' : ""}
|
|
1086
1107
|
</div>
|
|
1087
1108
|
`), i || this.$(".item").addEventListener("click", () => {
|
|
1088
1109
|
this.emit("wox-select", { label: e });
|
|
1089
|
-
})) : this.render(
|
|
1110
|
+
})) : this.render(F, `<div class="header">${e}</div>`) : this.render(F, '<div class="separator"></div>');
|
|
1090
1111
|
});
|
|
1091
1112
|
}
|
|
1092
1113
|
connectedCallback() {
|
|
@@ -1096,8 +1117,8 @@ class Q extends w {
|
|
|
1096
1117
|
this.isConnected && this._render();
|
|
1097
1118
|
}
|
|
1098
1119
|
}
|
|
1099
|
-
s(
|
|
1100
|
-
class
|
|
1120
|
+
s(tt, "observedAttributes", ["label", "shortcut", "icon", "disabled", "type", "submenu"]);
|
|
1121
|
+
class et extends w {
|
|
1101
1122
|
constructor() {
|
|
1102
1123
|
super(...arguments);
|
|
1103
1124
|
s(this, "_render", () => {
|
|
@@ -1124,7 +1145,7 @@ class Z extends w {
|
|
|
1124
1145
|
`);
|
|
1125
1146
|
const o = this.$(".trigger");
|
|
1126
1147
|
this.$(".dropdown"), n === "click" ? o.addEventListener("click", (i) => {
|
|
1127
|
-
i.stopPropagation(), this._toggle();
|
|
1148
|
+
i.stopPropagation(), this.children.length === 0 ? this.emit("wox-click", { label: this.getAttribute("label") || "" }) : this._toggle();
|
|
1128
1149
|
}) : n === "hover" && (this.addEventListener("mouseenter", () => this._open()), this.addEventListener("mouseleave", () => this._close())), this._outsideClick = (i) => {
|
|
1129
1150
|
!this.contains(i.target) && this.hasAttribute("open") && this._close();
|
|
1130
1151
|
}, document.addEventListener("mousedown", this._outsideClick), this.addEventListener("wox-select", () => this._close());
|
|
@@ -1139,10 +1160,10 @@ class Z extends w {
|
|
|
1139
1160
|
requestAnimationFrame(() => {
|
|
1140
1161
|
const t = this.$(".trigger"), e = this.$(".dropdown");
|
|
1141
1162
|
if (!t || !e) return;
|
|
1142
|
-
const n = t.getBoundingClientRect(), o = window.innerWidth, i = window.innerHeight,
|
|
1143
|
-
n.left +
|
|
1144
|
-
const
|
|
1145
|
-
|
|
1163
|
+
const n = t.getBoundingClientRect(), o = window.innerWidth, i = window.innerHeight, r = e.getBoundingClientRect();
|
|
1164
|
+
n.left + r.width > o ? e.style.left = n.right - r.width + "px" : e.style.left = `${n.left}px`;
|
|
1165
|
+
const a = i - n.bottom, d = n.top;
|
|
1166
|
+
a >= r.height || a >= d ? (e.style.top = `${n.bottom}px`, e.style.bottom = "") : (e.style.top = "", e.style.bottom = i - n.top + "px");
|
|
1146
1167
|
});
|
|
1147
1168
|
});
|
|
1148
1169
|
s(this, "_close", () => {
|
|
@@ -1165,13 +1186,13 @@ class Z extends w {
|
|
|
1165
1186
|
this._outsideClick && document.removeEventListener("mousedown", this._outsideClick);
|
|
1166
1187
|
}
|
|
1167
1188
|
}
|
|
1168
|
-
s(
|
|
1169
|
-
const
|
|
1170
|
-
class
|
|
1189
|
+
s(et, "observedAttributes", ["label", "open", "trigger"]);
|
|
1190
|
+
const zt = { rectangle: "crop_square", ellipse: "radio_button_unchecked", path: "timeline", image: "image", text: "text_fields", group: "folder", layer: "layers" };
|
|
1191
|
+
class nt extends w {
|
|
1171
1192
|
constructor() {
|
|
1172
1193
|
super(...arguments);
|
|
1173
1194
|
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"),
|
|
1195
|
+
const t = this.getAttribute("name") || "Layer", e = this.getAttribute("type") || "layer", n = this.hasAttribute("visible"), o = this.hasAttribute("locked"), i = this.hasAttribute("selected"), r = zt[e] || "layers";
|
|
1175
1196
|
this.render(`
|
|
1176
1197
|
:host { display: block; }
|
|
1177
1198
|
.layer {
|
|
@@ -1199,21 +1220,21 @@ class tt extends w {
|
|
|
1199
1220
|
.toggle:hover, .toggle.on { opacity: 1; color: var(--wox-accent, #00e5ff); }
|
|
1200
1221
|
`, `
|
|
1201
1222
|
<div class="layer ${i ? "selected" : ""}">
|
|
1202
|
-
<span class="type-icon material-icons">${
|
|
1223
|
+
<span class="type-icon material-icons">${r}</span>
|
|
1203
1224
|
<span class="name">${t}</span>
|
|
1204
1225
|
<span class="toggle eye ${n ? "on" : ""} material-icons">${n ? "visibility" : "visibility_off"}</span>
|
|
1205
1226
|
<span class="toggle lock ${o ? "on" : ""} material-icons">${o ? "lock" : "lock_open"}</span>
|
|
1206
1227
|
</div>
|
|
1207
|
-
`), this.$(".layer").addEventListener("click", (
|
|
1208
|
-
|
|
1209
|
-
}), this.$(".name").addEventListener("dblclick", () => this._startEditing()), this.$(".eye").addEventListener("click", (
|
|
1210
|
-
|
|
1211
|
-
const
|
|
1212
|
-
|
|
1213
|
-
}), this.$(".lock").addEventListener("click", (
|
|
1214
|
-
|
|
1215
|
-
const
|
|
1216
|
-
|
|
1228
|
+
`), this.$(".layer").addEventListener("click", (a) => {
|
|
1229
|
+
a.target.closest(".toggle") || this.emit("wox-select", { name: t });
|
|
1230
|
+
}), this.$(".name").addEventListener("dblclick", () => this._startEditing()), this.$(".eye").addEventListener("click", (a) => {
|
|
1231
|
+
a.stopPropagation();
|
|
1232
|
+
const d = !n;
|
|
1233
|
+
d ? this.setAttribute("visible", "") : this.removeAttribute("visible"), this.emit("wox-visibility", { visible: d });
|
|
1234
|
+
}), this.$(".lock").addEventListener("click", (a) => {
|
|
1235
|
+
a.stopPropagation();
|
|
1236
|
+
const d = !o;
|
|
1237
|
+
d ? this.setAttribute("locked", "") : this.removeAttribute("locked"), this.emit("wox-lock", { locked: d });
|
|
1217
1238
|
});
|
|
1218
1239
|
});
|
|
1219
1240
|
s(this, "_startEditing", () => {
|
|
@@ -1235,8 +1256,8 @@ class tt extends w {
|
|
|
1235
1256
|
this.isConnected && !this._editing && this._render();
|
|
1236
1257
|
}
|
|
1237
1258
|
}
|
|
1238
|
-
s(
|
|
1239
|
-
class
|
|
1259
|
+
s(nt, "observedAttributes", ["name", "type", "visible", "locked", "selected", "depth"]);
|
|
1260
|
+
class ot extends w {
|
|
1240
1261
|
constructor() {
|
|
1241
1262
|
super(...arguments);
|
|
1242
1263
|
s(this, "_render", () => {
|
|
@@ -1293,8 +1314,8 @@ class et extends w {
|
|
|
1293
1314
|
this.isConnected && this._render();
|
|
1294
1315
|
}
|
|
1295
1316
|
}
|
|
1296
|
-
s(
|
|
1297
|
-
class
|
|
1317
|
+
s(ot, "observedAttributes", ["title", "collapsed", "icon"]);
|
|
1318
|
+
class it extends w {
|
|
1298
1319
|
connectedCallback() {
|
|
1299
1320
|
this.render(`
|
|
1300
1321
|
:host { display: none; flex: 1; overflow-y: auto; overflow-x: hidden; flex-direction: column; }
|
|
@@ -1302,8 +1323,8 @@ class nt extends w {
|
|
|
1302
1323
|
`, "<slot></slot>");
|
|
1303
1324
|
}
|
|
1304
1325
|
}
|
|
1305
|
-
s(
|
|
1306
|
-
class
|
|
1326
|
+
s(it, "observedAttributes", ["name", "label", "icon", "active"]);
|
|
1327
|
+
class st extends w {
|
|
1307
1328
|
constructor() {
|
|
1308
1329
|
super(...arguments);
|
|
1309
1330
|
s(this, "_render", () => {
|
|
@@ -1359,10 +1380,10 @@ class ot extends w {
|
|
|
1359
1380
|
t.innerHTML = "";
|
|
1360
1381
|
const e = this._getTabs(), n = this.getAttribute("active") || ((o = e[0]) == null ? void 0 : o.getAttribute("name")) || "";
|
|
1361
1382
|
e.forEach((i) => {
|
|
1362
|
-
const
|
|
1363
|
-
|
|
1364
|
-
this.setAttribute("active",
|
|
1365
|
-
}), t.appendChild(
|
|
1383
|
+
const r = i.getAttribute("name") || "", a = i.getAttribute("label") || r, d = document.createElement("button");
|
|
1384
|
+
d.className = "tab-btn" + (r === n ? " active" : ""), d.textContent = a, d.addEventListener("click", () => {
|
|
1385
|
+
this.setAttribute("active", r), this.emit("wox-tab-change", { name: r });
|
|
1386
|
+
}), t.appendChild(d);
|
|
1366
1387
|
}), this._updateActive();
|
|
1367
1388
|
});
|
|
1368
1389
|
s(this, "_updateActive", () => {
|
|
@@ -1371,9 +1392,9 @@ class ot extends w {
|
|
|
1371
1392
|
t.forEach((o) => {
|
|
1372
1393
|
(o.getAttribute("name") || "") === e ? o.setAttribute("active", "") : o.removeAttribute("active");
|
|
1373
1394
|
}), this.$$(".tab-btn").forEach((o, i) => {
|
|
1374
|
-
var
|
|
1375
|
-
const
|
|
1376
|
-
o.classList.toggle("active",
|
|
1395
|
+
var a;
|
|
1396
|
+
const r = ((a = t[i]) == null ? void 0 : a.getAttribute("name")) || "";
|
|
1397
|
+
o.classList.toggle("active", r === e);
|
|
1377
1398
|
});
|
|
1378
1399
|
});
|
|
1379
1400
|
s(this, "_getTabs", () => [...this.querySelectorAll(":scope > wox-tab")]);
|
|
@@ -1385,8 +1406,8 @@ class ot extends w {
|
|
|
1385
1406
|
this.isConnected && this._updateActive();
|
|
1386
1407
|
}
|
|
1387
1408
|
}
|
|
1388
|
-
s(
|
|
1389
|
-
class
|
|
1409
|
+
s(st, "observedAttributes", ["active", "placement"]);
|
|
1410
|
+
class rt extends w {
|
|
1390
1411
|
constructor() {
|
|
1391
1412
|
super(...arguments);
|
|
1392
1413
|
s(this, "_render", () => {
|
|
@@ -1408,8 +1429,8 @@ class it extends w {
|
|
|
1408
1429
|
this.isConnected && this._render();
|
|
1409
1430
|
}
|
|
1410
1431
|
}
|
|
1411
|
-
s(
|
|
1412
|
-
class
|
|
1432
|
+
s(rt, "observedAttributes", ["label"]);
|
|
1433
|
+
class at extends w {
|
|
1413
1434
|
constructor() {
|
|
1414
1435
|
super(...arguments);
|
|
1415
1436
|
s(this, "_render", () => {
|
|
@@ -1433,8 +1454,8 @@ class st extends w {
|
|
|
1433
1454
|
this.isConnected && this._render();
|
|
1434
1455
|
}
|
|
1435
1456
|
}
|
|
1436
|
-
s(
|
|
1437
|
-
class
|
|
1457
|
+
s(at, "observedAttributes", ["width", "position"]);
|
|
1458
|
+
class dt extends w {
|
|
1438
1459
|
constructor() {
|
|
1439
1460
|
super(...arguments);
|
|
1440
1461
|
s(this, "_render", () => {
|
|
@@ -1460,14 +1481,14 @@ class at extends w {
|
|
|
1460
1481
|
const n = this.$(".resizer");
|
|
1461
1482
|
if (!n) return;
|
|
1462
1483
|
let o = 0, i = 0;
|
|
1463
|
-
const
|
|
1464
|
-
const
|
|
1465
|
-
this.style.width =
|
|
1466
|
-
},
|
|
1467
|
-
document.removeEventListener("mousemove",
|
|
1484
|
+
const r = this.getAttribute("position") === "left", a = (h) => {
|
|
1485
|
+
const l = r ? h.clientX - o : o - h.clientX, g = Math.max(180, Math.min(600, i + l));
|
|
1486
|
+
this.style.width = g + "px";
|
|
1487
|
+
}, d = () => {
|
|
1488
|
+
document.removeEventListener("mousemove", a), document.removeEventListener("mouseup", d);
|
|
1468
1489
|
};
|
|
1469
1490
|
n.addEventListener("mousedown", (h) => {
|
|
1470
|
-
o = h.clientX, i = this.getBoundingClientRect().width, document.addEventListener("mousemove",
|
|
1491
|
+
o = h.clientX, i = this.getBoundingClientRect().width, document.addEventListener("mousemove", a), document.addEventListener("mouseup", d), h.preventDefault();
|
|
1471
1492
|
});
|
|
1472
1493
|
}
|
|
1473
1494
|
});
|
|
@@ -1479,8 +1500,8 @@ class at extends w {
|
|
|
1479
1500
|
this.isConnected && this._render();
|
|
1480
1501
|
}
|
|
1481
1502
|
}
|
|
1482
|
-
s(
|
|
1483
|
-
class
|
|
1503
|
+
s(dt, "observedAttributes", ["width", "position", "resizable"]);
|
|
1504
|
+
class lt extends w {
|
|
1484
1505
|
constructor() {
|
|
1485
1506
|
super(...arguments);
|
|
1486
1507
|
s(this, "_render", () => {
|
|
@@ -1506,8 +1527,8 @@ class rt extends w {
|
|
|
1506
1527
|
this.isConnected && this._render();
|
|
1507
1528
|
}
|
|
1508
1529
|
}
|
|
1509
|
-
s(
|
|
1510
|
-
class
|
|
1530
|
+
s(lt, "observedAttributes", ["height"]);
|
|
1531
|
+
class ct extends w {
|
|
1511
1532
|
constructor() {
|
|
1512
1533
|
super(...arguments);
|
|
1513
1534
|
s(this, "_render", () => {
|
|
@@ -1535,12 +1556,12 @@ class dt extends w {
|
|
|
1535
1556
|
this.isConnected && this._render();
|
|
1536
1557
|
}
|
|
1537
1558
|
}
|
|
1538
|
-
s(
|
|
1539
|
-
class
|
|
1559
|
+
s(ct, "observedAttributes", ["height"]);
|
|
1560
|
+
class pt extends w {
|
|
1540
1561
|
constructor() {
|
|
1541
1562
|
super(...arguments);
|
|
1542
1563
|
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(" "),
|
|
1564
|
+
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
1565
|
this.render(`
|
|
1545
1566
|
:host { display: none; }
|
|
1546
1567
|
:host([open]) { display: block; }
|
|
@@ -1577,9 +1598,9 @@ class lt extends w {
|
|
|
1577
1598
|
.btn-secondary:hover { background: var(--wox-border-light, #444); }
|
|
1578
1599
|
.btn-primary { background: var(--wox-accent, #00e5ff); color: var(--wox-text-hi, #fff); }
|
|
1579
1600
|
.btn-primary:hover { filter: brightness(0.85); }
|
|
1580
|
-
${
|
|
1601
|
+
${D} .box { --width: ${n}; }`, `
|
|
1581
1602
|
<div class="overlay">
|
|
1582
|
-
<div class="box ${i}"${
|
|
1603
|
+
<div class="box ${i}"${r}>
|
|
1583
1604
|
<div class="header">
|
|
1584
1605
|
<span class="title">${t}</span>
|
|
1585
1606
|
${e ? '<button class="close-btn">✕</button>' : ""}
|
|
@@ -1593,15 +1614,15 @@ class lt extends w {
|
|
|
1593
1614
|
</div>
|
|
1594
1615
|
</div>
|
|
1595
1616
|
</div>
|
|
1596
|
-
`), this.$(".overlay").addEventListener("click", (
|
|
1597
|
-
|
|
1617
|
+
`), this.$(".overlay").addEventListener("click", (l) => {
|
|
1618
|
+
l.target === this.$(".overlay") && (this.removeAttribute("open"), this.emit("wox-close", {}));
|
|
1598
1619
|
});
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1620
|
+
const a = this.$(".close-btn");
|
|
1621
|
+
a && a.addEventListener("click", () => {
|
|
1601
1622
|
this.removeAttribute("open"), this.emit("wox-close", {});
|
|
1602
1623
|
});
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1624
|
+
const d = this.$(".cancel-btn");
|
|
1625
|
+
d && d.addEventListener("click", () => {
|
|
1605
1626
|
this.removeAttribute("open"), this.emit("wox-cancel", {});
|
|
1606
1627
|
});
|
|
1607
1628
|
const h = this.$(".ok-btn");
|
|
@@ -1641,8 +1662,8 @@ class lt extends w {
|
|
|
1641
1662
|
t ? this.setAttribute("open", "") : this.removeAttribute("open");
|
|
1642
1663
|
}
|
|
1643
1664
|
}
|
|
1644
|
-
s(
|
|
1645
|
-
class
|
|
1665
|
+
s(pt, "observedAttributes", ["open", "title", "closable", "width", "color", "glow", "pulse"]);
|
|
1666
|
+
class ft extends w {
|
|
1646
1667
|
constructor() {
|
|
1647
1668
|
super(...arguments);
|
|
1648
1669
|
s(this, "_columns", []);
|
|
@@ -1655,26 +1676,26 @@ class vt extends w {
|
|
|
1655
1676
|
if (!this._sortKey) return this._rows;
|
|
1656
1677
|
const t = this._sortKey, e = this._sortDir === "asc" ? 1 : -1;
|
|
1657
1678
|
return [...this._rows].sort((n, o) => {
|
|
1658
|
-
const i = n[t],
|
|
1659
|
-
return i == null &&
|
|
1679
|
+
const i = n[t], r = o[t];
|
|
1680
|
+
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
1681
|
});
|
|
1661
1682
|
});
|
|
1662
1683
|
s(this, "_render", () => {
|
|
1663
1684
|
const t = this._getSortedRows(), e = this._columns.map((o, i) => {
|
|
1664
|
-
const
|
|
1665
|
-
return `<div class="header-cell ${
|
|
1685
|
+
const r = this._sortKey === o.key, a = [r ? "sorted" : "", r && this._sortDir === "desc" ? "desc" : ""].filter(Boolean).join(" "), d = o.sortable !== !1;
|
|
1686
|
+
return `<div class="header-cell ${a}" data-col="${i}" style="width:${this._colWidths[i]}px" draggable="true">
|
|
1666
1687
|
<span class="label-text">${o.label || o.key}</span>
|
|
1667
|
-
${
|
|
1688
|
+
${d ? '<span class="sort-arrow">▲</span>' : ""}
|
|
1668
1689
|
<div class="resize-handle" data-col="${i}"></div>
|
|
1669
1690
|
</div>`;
|
|
1670
1691
|
}).join(""), n = t.length === 0 ? '<div class="empty">No data</div>' : t.map((o, i) => {
|
|
1671
|
-
const
|
|
1672
|
-
const
|
|
1673
|
-
return
|
|
1692
|
+
const r = i % 2 == 0 ? "even" : "odd", a = this._columns.map((d, h) => {
|
|
1693
|
+
const l = d.align ? ` align-${d.align}` : "", g = this._editingCell && this._editingCell.rowIndex === i && this._editingCell.key === d.key, x = o[d.key] != null ? o[d.key] : "";
|
|
1694
|
+
return g ? `<div class="cell${l}" style="width:${this._colWidths[h]}px" data-key="${d.key}">
|
|
1674
1695
|
<input class="cell-input" spellcheck="false">
|
|
1675
|
-
</div>` : `<div class="cell${
|
|
1696
|
+
</div>` : `<div class="cell${l}" style="width:${this._colWidths[h]}px" data-key="${d.key}">${x}</div>`;
|
|
1676
1697
|
}).join("");
|
|
1677
|
-
return `<div class="row ${
|
|
1698
|
+
return `<div class="row ${r}" data-row="${i}">${a}</div>`;
|
|
1678
1699
|
}).join("");
|
|
1679
1700
|
if (this.render(`
|
|
1680
1701
|
: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,13 +1789,13 @@ class vt extends w {
|
|
|
1768
1789
|
`), this._bindEvents(), this._editingCell) {
|
|
1769
1790
|
const o = this.$(".cell-input");
|
|
1770
1791
|
if (o) {
|
|
1771
|
-
const { rowIndex: i, key:
|
|
1772
|
-
let
|
|
1792
|
+
const { rowIndex: i, key: r } = this._editingCell, a = this._getSortedRows();
|
|
1793
|
+
let d = a[i][r] != null ? a[i][r] : "";
|
|
1773
1794
|
const h = document.createElement("div");
|
|
1774
|
-
h.innerHTML =
|
|
1775
|
-
const
|
|
1776
|
-
o.value =
|
|
1777
|
-
|
|
1795
|
+
h.innerHTML = d;
|
|
1796
|
+
const l = h.textContent || h.innerText || d;
|
|
1797
|
+
o.value = l, o.dataset.oldValue = l, o.focus(), o.select(), o.addEventListener("keydown", (g) => {
|
|
1798
|
+
g.key === "Enter" ? this._commitEdit(o.value) : g.key === "Escape" && (this._editingCell = null, this._render());
|
|
1778
1799
|
}), o.addEventListener("blur", () => {
|
|
1779
1800
|
this._commitEdit(o.value);
|
|
1780
1801
|
});
|
|
@@ -1783,8 +1804,8 @@ class vt extends w {
|
|
|
1783
1804
|
});
|
|
1784
1805
|
s(this, "_commitEdit", (t) => {
|
|
1785
1806
|
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:
|
|
1807
|
+
const { rowIndex: e, key: n } = this._editingCell, o = this.$(".cell-input"), i = o ? o.dataset.oldValue : "", r = this._getSortedRows()[e];
|
|
1808
|
+
i !== t && (this.emit("wox-cell-change", { row: r, key: n, oldValue: i, newValue: t }), r[n] = t), this._editingCell = null, this._render();
|
|
1788
1809
|
});
|
|
1789
1810
|
s(this, "_bindEvents", () => {
|
|
1790
1811
|
this.$$(".header-cell").forEach((t) => {
|
|
@@ -1813,8 +1834,8 @@ class vt extends w {
|
|
|
1813
1834
|
}), t.querySelectorAll(".cell").forEach((e) => {
|
|
1814
1835
|
e.addEventListener("dblclick", (n) => {
|
|
1815
1836
|
n.stopPropagation();
|
|
1816
|
-
const o = Number(t.dataset.row), i = e.dataset.key,
|
|
1817
|
-
this._columns[
|
|
1837
|
+
const o = Number(t.dataset.row), i = e.dataset.key, r = this._columns.findIndex((a) => a.key === i);
|
|
1838
|
+
this._columns[r].editable !== !1 && (this._editingCell = { rowIndex: o, key: i }, this._render());
|
|
1818
1839
|
});
|
|
1819
1840
|
});
|
|
1820
1841
|
}), this.$$(".resize-handle").forEach((t) => {
|
|
@@ -1822,13 +1843,13 @@ class vt extends w {
|
|
|
1822
1843
|
e.preventDefault(), e.stopPropagation();
|
|
1823
1844
|
const n = Number(t.dataset.col), o = e.clientX, i = this._colWidths[n];
|
|
1824
1845
|
t.classList.add("active");
|
|
1825
|
-
const
|
|
1826
|
-
const h =
|
|
1846
|
+
const r = (d) => {
|
|
1847
|
+
const h = d.clientX - o;
|
|
1827
1848
|
this._colWidths[n] = Math.max(40, i + h), this._applyWidths();
|
|
1828
|
-
},
|
|
1829
|
-
t.classList.remove("active"), document.removeEventListener("mousemove",
|
|
1849
|
+
}, a = () => {
|
|
1850
|
+
t.classList.remove("active"), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", a);
|
|
1830
1851
|
};
|
|
1831
|
-
document.addEventListener("mousemove",
|
|
1852
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", a);
|
|
1832
1853
|
});
|
|
1833
1854
|
});
|
|
1834
1855
|
});
|
|
@@ -1844,8 +1865,8 @@ class vt extends w {
|
|
|
1844
1865
|
s(this, "_swapColumns", (t, e) => {
|
|
1845
1866
|
const n = [...this._columns], o = [...this._colWidths], [i] = n.splice(t, 1);
|
|
1846
1867
|
n.splice(e, 0, i);
|
|
1847
|
-
const [
|
|
1848
|
-
o.splice(e, 0,
|
|
1868
|
+
const [r] = o.splice(t, 1);
|
|
1869
|
+
o.splice(e, 0, r), this._columns = n, this._colWidths = o, this._render();
|
|
1849
1870
|
});
|
|
1850
1871
|
}
|
|
1851
1872
|
connectedCallback() {
|
|
@@ -1864,12 +1885,12 @@ class vt extends w {
|
|
|
1864
1885
|
return this._rows;
|
|
1865
1886
|
}
|
|
1866
1887
|
}
|
|
1867
|
-
const
|
|
1868
|
-
let
|
|
1869
|
-
const
|
|
1888
|
+
const Lt = 4e3, ut = { 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" } }, St = { TL: "translateX(-120%)", TC: "translateY(-120%)", TR: "translateX(120%)", BL: "translateX(-120%)", BC: "translateY(120%)", BR: "translateX(120%)" }, Mt = { 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" } }, Dt = { 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" } }, gt = { 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>' };
|
|
1889
|
+
let bt = !1;
|
|
1890
|
+
const B = /* @__PURE__ */ new Set(), W = {}, R = (p, c, t = {}) => {
|
|
1870
1891
|
(() => {
|
|
1871
|
-
if (
|
|
1872
|
-
|
|
1892
|
+
if (bt) return;
|
|
1893
|
+
bt = !0;
|
|
1873
1894
|
const m = document.createElement("style");
|
|
1874
1895
|
m.textContent = `
|
|
1875
1896
|
.wox-toast-container {
|
|
@@ -1928,63 +1949,63 @@ const N = /* @__PURE__ */ new Set(), F = {}, D = (p, c, t = {}) => {
|
|
|
1928
1949
|
`, document.head.appendChild(m);
|
|
1929
1950
|
})();
|
|
1930
1951
|
const e = `${p}::${c}`;
|
|
1931
|
-
if (
|
|
1932
|
-
|
|
1933
|
-
const { duration: n =
|
|
1934
|
-
const
|
|
1935
|
-
return
|
|
1936
|
-
})(p),
|
|
1937
|
-
if (
|
|
1938
|
-
const
|
|
1939
|
-
|
|
1940
|
-
const
|
|
1941
|
-
return Object.assign(
|
|
1942
|
-
})(
|
|
1943
|
-
|
|
1944
|
-
let
|
|
1945
|
-
<span class="wox-toast-icon" style="color:${
|
|
1952
|
+
if (B.has(e)) return;
|
|
1953
|
+
B.add(e);
|
|
1954
|
+
const { duration: n = Lt, closable: o = !0, position: i = "BR" } = t, r = document.documentElement.dataset.woxTheme === "light", a = ((m) => {
|
|
1955
|
+
const y = document.documentElement.dataset.woxTheme === "light" ? Dt : Mt;
|
|
1956
|
+
return y[m] || y.info;
|
|
1957
|
+
})(p), d = ut[i] ? i : "BR", h = ((m) => {
|
|
1958
|
+
if (W[m]) return W[m];
|
|
1959
|
+
const y = document.createElement("div");
|
|
1960
|
+
y.className = `wox-toast-container wox-toast-container-${m}`;
|
|
1961
|
+
const N = ut[m];
|
|
1962
|
+
return Object.assign(y.style, N), m.startsWith("B") && (y.style.flexDirection = "column-reverse"), document.body.appendChild(y), W[m] = y, y;
|
|
1963
|
+
})(d), l = document.createElement("div");
|
|
1964
|
+
l.className = `wox-toast wox-toast-${p}`, l.style.backgroundColor = a.bg, l.style.borderLeftColor = a.border, l.style.color = a.text;
|
|
1965
|
+
let g = `
|
|
1966
|
+
<span class="wox-toast-icon" style="color:${a.icon}">${gt[p] || gt.info}</span>
|
|
1946
1967
|
<span class="wox-toast-message">${c}</span>
|
|
1947
1968
|
`;
|
|
1948
|
-
if (o && (
|
|
1949
|
-
const m =
|
|
1969
|
+
if (o && (g += '<button class="wox-toast-close" aria-label="Close">×</button>'), l.innerHTML = g, o) {
|
|
1970
|
+
const m = l.querySelector(".wox-toast-close");
|
|
1950
1971
|
m && (m.addEventListener("mouseenter", () => {
|
|
1951
|
-
m.style.color =
|
|
1972
|
+
m.style.color = a.icon;
|
|
1952
1973
|
}), m.addEventListener("mouseleave", () => {
|
|
1953
|
-
m.style.color =
|
|
1974
|
+
m.style.color = r ? "#999" : "#666";
|
|
1954
1975
|
}));
|
|
1955
1976
|
}
|
|
1956
1977
|
let x = null;
|
|
1957
|
-
n > 0 && (x = document.createElement("div"), x.className = "wox-toast-progress", x.style.backgroundColor =
|
|
1958
|
-
const
|
|
1959
|
-
|
|
1960
|
-
let
|
|
1978
|
+
n > 0 && (x = document.createElement("div"), x.className = "wox-toast-progress", x.style.backgroundColor = a.progress, x.style.width = "100%", l.appendChild(x));
|
|
1979
|
+
const f = St[d];
|
|
1980
|
+
l.animate([{ transform: f, opacity: 0 }, { transform: "translateX(0) translateY(0)", opacity: 1 }], { duration: 300, easing: "cubic-bezier(.22,1,.36,1)", fill: "forwards" }), h.appendChild(l);
|
|
1981
|
+
let b = null, u = n, v = 0, k = null;
|
|
1961
1982
|
const A = () => {
|
|
1962
|
-
n <= 0 || (
|
|
1963
|
-
},
|
|
1964
|
-
|
|
1965
|
-
const m =
|
|
1966
|
-
|
|
1983
|
+
n <= 0 || (v = Date.now(), x && (k = x.animate([{ width: x.style.width }, { width: "0%" }], { duration: u, easing: "linear", fill: "forwards" })), b = setTimeout(() => z(), u));
|
|
1984
|
+
}, z = () => {
|
|
1985
|
+
B.delete(e), b && (clearTimeout(b), b = null), k && k.cancel(), l.animate([{ transform: "translateX(0) translateY(0)", opacity: 1 }, { transform: f, opacity: 0 }], { duration: 300, easing: "cubic-bezier(.22,1,.36,1)", fill: "forwards" }).onfinish = () => {
|
|
1986
|
+
const m = l.offsetHeight;
|
|
1987
|
+
l.style.minHeight = "0", l.style.padding = "0", l.style.margin = "0", l.style.overflow = "hidden", l.animate([{ height: `${m}px` }, { height: "0px" }], { duration: 200, easing: "ease" }).onfinish = () => l.remove();
|
|
1967
1988
|
};
|
|
1968
1989
|
};
|
|
1969
|
-
if (
|
|
1970
|
-
|
|
1971
|
-
const m = Date.now() -
|
|
1972
|
-
if (
|
|
1973
|
-
const
|
|
1974
|
-
x.style.width = `${
|
|
1990
|
+
if (l.addEventListener("mouseenter", () => {
|
|
1991
|
+
b && (clearTimeout(b), b = null), k && k.pause();
|
|
1992
|
+
const m = Date.now() - v;
|
|
1993
|
+
if (u = Math.max(u - m, 0), x && k) {
|
|
1994
|
+
const y = n > 0 ? u / n * 100 : 0;
|
|
1995
|
+
x.style.width = `${y}%`;
|
|
1975
1996
|
}
|
|
1976
|
-
}),
|
|
1977
|
-
const m =
|
|
1978
|
-
m && m.addEventListener("click",
|
|
1997
|
+
}), l.addEventListener("mouseleave", A), o) {
|
|
1998
|
+
const m = l.querySelector(".wox-toast-close");
|
|
1999
|
+
m && m.addEventListener("click", z);
|
|
1979
2000
|
}
|
|
1980
2001
|
A();
|
|
1981
2002
|
};
|
|
1982
|
-
class
|
|
2003
|
+
class S extends w {
|
|
1983
2004
|
}
|
|
1984
|
-
s(
|
|
1985
|
-
const
|
|
2005
|
+
s(S, "success", (c, t) => R("success", c, t)), s(S, "error", (c, t) => R("error", c, t)), s(S, "warning", (c, t) => R("warning", c, t)), s(S, "info", (c, t) => R("info", c, t));
|
|
2006
|
+
const _ = class _ extends w {
|
|
1986
2007
|
};
|
|
1987
|
-
s(
|
|
2008
|
+
s(_, "_el", null), s(_, "_listenersReady", !1), s(_, "show", (c, t) => {
|
|
1988
2009
|
if (!c || !t) return;
|
|
1989
2010
|
c.preventDefault(), c.stopPropagation(), (() => {
|
|
1990
2011
|
if (document.getElementById("wox-ctx-menu-styles")) return;
|
|
@@ -2018,55 +2039,55 @@ s(f, "_el", null), s(f, "_listenersReady", !1), s(f, "show", (c, t) => {
|
|
|
2018
2039
|
.wox-ctx-menu-divider { height: 1px; background: var(--wox-border, #333); margin: 4px 8px; }
|
|
2019
2040
|
`, document.head.appendChild(n);
|
|
2020
2041
|
})();
|
|
2021
|
-
let e =
|
|
2022
|
-
e || (e = document.createElement("div"), e.id = "wox-ctx-menu", e.className = "wox-ctx-menu", document.body.appendChild(e),
|
|
2042
|
+
let e = _._el;
|
|
2043
|
+
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
2044
|
if (n.divider) {
|
|
2024
|
-
const
|
|
2025
|
-
return
|
|
2045
|
+
const a = document.createElement("div");
|
|
2046
|
+
return a.className = "wox-ctx-menu-divider", void e.appendChild(a);
|
|
2026
2047
|
}
|
|
2027
2048
|
const o = document.createElement("div");
|
|
2028
2049
|
o.className = "wox-ctx-menu-item", n.disabled && o.classList.add("wox-ctx-menu-item--disabled");
|
|
2029
2050
|
const i = document.createElement("i");
|
|
2030
2051
|
i.className = "material-icons wox-ctx-menu-icon", i.textContent = n.icon || "", o.appendChild(i);
|
|
2031
|
-
const
|
|
2032
|
-
if (
|
|
2033
|
-
const
|
|
2034
|
-
|
|
2052
|
+
const r = document.createElement("span");
|
|
2053
|
+
if (r.className = "wox-ctx-menu-label", r.textContent = n.label || "", o.appendChild(r), n.shortcut) {
|
|
2054
|
+
const a = document.createElement("span");
|
|
2055
|
+
a.className = "wox-ctx-menu-shortcut", a.textContent = n.shortcut, o.appendChild(a);
|
|
2035
2056
|
}
|
|
2036
2057
|
n.disabled || o.addEventListener("click", () => {
|
|
2037
|
-
|
|
2058
|
+
_.hide(), n.action && n.action();
|
|
2038
2059
|
}), e.appendChild(o);
|
|
2039
2060
|
}), e.style.display = "block", e.style.left = `${c.clientX}px`, e.style.top = `${c.clientY}px`, requestAnimationFrame(() => {
|
|
2040
2061
|
const n = e.getBoundingClientRect(), o = window.innerWidth, i = window.innerHeight;
|
|
2041
2062
|
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" &&
|
|
2063
|
+
}), _._listenersReady || (document.addEventListener("click", _._onClickOutside, !0), document.addEventListener("contextmenu", _._onClickOutside, !0), document.addEventListener("keydown", _._onKeyDown, !0), _._listenersReady = !0);
|
|
2064
|
+
}), s(_, "hide", () => {
|
|
2065
|
+
_._el && (_._el.style.display = "none");
|
|
2066
|
+
}), s(_, "_onClickOutside", (c) => {
|
|
2067
|
+
_._el && _._el.style.display !== "none" && (_._el.contains(c.target) || _.hide());
|
|
2068
|
+
}), s(_, "_onKeyDown", (c) => {
|
|
2069
|
+
c.key === "Escape" && _.hide();
|
|
2049
2070
|
});
|
|
2050
|
-
let
|
|
2071
|
+
let T = _;
|
|
2051
2072
|
const C = (p) => {
|
|
2052
2073
|
if (!p || !p.stops || p.stops.length < 2) return "";
|
|
2053
2074
|
const c = [...p.stops].sort((t, e) => t.position - e.position).map((t) => `${t.color} ${t.position}%`).join(", ");
|
|
2054
2075
|
return p.type === "linear" ? `linear-gradient(${p.angle}deg, ${c})` : `radial-gradient(circle, ${c})`;
|
|
2055
|
-
},
|
|
2076
|
+
}, wt = (p) => {
|
|
2056
2077
|
if (!p) return null;
|
|
2057
2078
|
let c = null, t = 90, e = null;
|
|
2058
2079
|
const n = p.match(/^linear-gradient\(\s*(\d+)deg\s*,\s*(.+)\)$/i);
|
|
2059
2080
|
if (n && (c = "linear", t = parseInt(n[1], 10), e = n[2]), !c) {
|
|
2060
|
-
const
|
|
2061
|
-
|
|
2081
|
+
const a = p.match(/^radial-gradient\(\s*(?:circle|ellipse)?\s*,?\s*(.+)\)$/i);
|
|
2082
|
+
a && (c = "radial", e = a[1]);
|
|
2062
2083
|
}
|
|
2063
2084
|
if (!c || !e) return null;
|
|
2064
2085
|
const o = [], i = /(#[0-9a-fA-F]{3,8}|rgba?\([^)]+\))\s+(\d+(?:\.\d+)?)%/g;
|
|
2065
|
-
let
|
|
2066
|
-
for (; (
|
|
2086
|
+
let r;
|
|
2087
|
+
for (; (r = i.exec(e)) !== null; ) o.push({ color: r[1], position: parseFloat(r[2]) });
|
|
2067
2088
|
return o.length < 2 ? null : { type: c, angle: t, stops: o };
|
|
2068
2089
|
};
|
|
2069
|
-
class
|
|
2090
|
+
class _t extends w {
|
|
2070
2091
|
constructor() {
|
|
2071
2092
|
super(...arguments);
|
|
2072
2093
|
s(this, "_gradient", null);
|
|
@@ -2119,45 +2140,45 @@ class mt extends w {
|
|
|
2119
2140
|
const n = this._gradient.stops.indexOf(e), o = document.createElement("div");
|
|
2120
2141
|
o.className = "handle", o.style.left = e.position + "%", o.style.backgroundColor = e.color, o.dataset.index = n;
|
|
2121
2142
|
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[
|
|
2143
|
+
i.type = "color", i.value = e.color, i.className = "color-input", o.appendChild(i), o.addEventListener("click", (r) => {
|
|
2144
|
+
this._justDragged ? this._justDragged = !1 : (r.stopPropagation(), i.click());
|
|
2145
|
+
}), i.addEventListener("input", (r) => {
|
|
2146
|
+
const a = parseInt(o.dataset.index, 10);
|
|
2147
|
+
this._gradient.stops[a].color = r.target.value, o.style.backgroundColor = r.target.value, this._updatePreview(), this._emitGradient("wox-gradient-input");
|
|
2127
2148
|
}), i.addEventListener("change", () => {
|
|
2128
2149
|
this._emitGradient("wox-gradient-change");
|
|
2129
|
-
}), i.addEventListener("click", (
|
|
2130
|
-
if (
|
|
2131
|
-
|
|
2132
|
-
const
|
|
2133
|
-
if (!
|
|
2134
|
-
const
|
|
2135
|
-
this._dragging = { idx: h, startY:
|
|
2136
|
-
const
|
|
2137
|
-
const
|
|
2138
|
-
this._gradient.stops[h].position =
|
|
2139
|
-
},
|
|
2140
|
-
var
|
|
2141
|
-
document.removeEventListener("mousemove",
|
|
2142
|
-
const
|
|
2143
|
-
|
|
2144
|
-
const
|
|
2145
|
-
(
|
|
2150
|
+
}), i.addEventListener("click", (r) => r.stopPropagation()), o.addEventListener("mousedown", (r) => {
|
|
2151
|
+
if (r.target === i) return;
|
|
2152
|
+
r.preventDefault(), r.stopPropagation();
|
|
2153
|
+
const a = this.$(".bar");
|
|
2154
|
+
if (!a) return;
|
|
2155
|
+
const d = a.getBoundingClientRect(), h = parseInt(o.dataset.index, 10);
|
|
2156
|
+
this._dragging = { idx: h, startY: r.clientY }, o.classList.add("dragging");
|
|
2157
|
+
const l = (x) => {
|
|
2158
|
+
const f = (x.clientX - d.left) / d.width * 100, b = Math.max(0, Math.min(100, Math.round(10 * f) / 10));
|
|
2159
|
+
this._gradient.stops[h].position = b, o.style.left = b + "%", Math.abs(x.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");
|
|
2160
|
+
}, g = (x) => {
|
|
2161
|
+
var u;
|
|
2162
|
+
document.removeEventListener("mousemove", l), document.removeEventListener("mouseup", g), o.classList.remove("dragging");
|
|
2163
|
+
const f = Math.abs(x.clientY - this._dragging.startY);
|
|
2164
|
+
f > 40 && this._gradient.stops.length > 2 ? (this._gradient.stops.splice(h, 1), this._renderStops(), this._updatePreview(), this._emitGradient("wox-gradient-change")) : this._emitGradient("wox-gradient-change");
|
|
2165
|
+
const b = Math.abs(x.clientX - (d.left + (((u = this._gradient.stops[h]) == null ? void 0 : u.position) || 0) * d.width / 100));
|
|
2166
|
+
(f > 3 || b > 3) && (this._justDragged = !0), this._dragging = null;
|
|
2146
2167
|
};
|
|
2147
|
-
document.addEventListener("mousemove",
|
|
2168
|
+
document.addEventListener("mousemove", l), document.addEventListener("mouseup", g);
|
|
2148
2169
|
}), t.appendChild(o);
|
|
2149
2170
|
}));
|
|
2150
2171
|
});
|
|
2151
2172
|
s(this, "_bindBarEvents", () => {
|
|
2152
2173
|
const t = this.$(".bar");
|
|
2153
2174
|
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
|
|
2157
|
-
|
|
2175
|
+
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((d, h) => d.position - h.position);
|
|
2176
|
+
let a = "#888888";
|
|
2177
|
+
for (let d = 0; d < r.length - 1; d++) if (i >= r[d].position && i <= r[d + 1].position) {
|
|
2178
|
+
a = r[d].color;
|
|
2158
2179
|
break;
|
|
2159
2180
|
}
|
|
2160
|
-
this._gradient.stops.push({ color:
|
|
2181
|
+
this._gradient.stops.push({ color: a, position: i }), this._renderStops(), this._updatePreview(), this._emitGradient("wox-gradient-change");
|
|
2161
2182
|
});
|
|
2162
2183
|
});
|
|
2163
2184
|
}
|
|
@@ -2171,8 +2192,8 @@ class mt extends w {
|
|
|
2171
2192
|
return this._gradient ? JSON.parse(JSON.stringify(this._gradient)) : null;
|
|
2172
2193
|
}
|
|
2173
2194
|
}
|
|
2174
|
-
const
|
|
2175
|
-
class
|
|
2195
|
+
const Rt = [{ 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 }] }], I = () => "grad_" + Date.now().toString(36) + "_" + Math.random().toString(36).slice(2, 7), vt = (p) => !!p && (p.startsWith("linear-gradient") || p.startsWith("radial-gradient"));
|
|
2196
|
+
class ht extends w {
|
|
2176
2197
|
constructor() {
|
|
2177
2198
|
super(...arguments);
|
|
2178
2199
|
s(this, "_value", "#ffffff");
|
|
@@ -2185,7 +2206,7 @@ class ct extends w {
|
|
|
2185
2206
|
s(this, "_editingName", "");
|
|
2186
2207
|
s(this, "_syncFromAttributes", () => {
|
|
2187
2208
|
const t = this.getAttribute("value");
|
|
2188
|
-
t && (this._value = t, this._gradient =
|
|
2209
|
+
t && (this._value = t, this._gradient = vt(t) ? wt(t) : null);
|
|
2189
2210
|
const e = this.getAttribute("animation-speed");
|
|
2190
2211
|
e !== null && (this._animationSpeed = parseInt(e, 10) || 0);
|
|
2191
2212
|
const n = this.getAttribute("animation-type");
|
|
@@ -2197,7 +2218,7 @@ class ct extends w {
|
|
|
2197
2218
|
if (t) return void (this._gradients = JSON.parse(t));
|
|
2198
2219
|
} catch {
|
|
2199
2220
|
}
|
|
2200
|
-
this._gradients =
|
|
2221
|
+
this._gradients = Rt.map((t) => ({ ...t, stops: t.stops.map((e) => ({ ...e })) })), this._persistGradients();
|
|
2201
2222
|
});
|
|
2202
2223
|
s(this, "_persistGradients", () => {
|
|
2203
2224
|
try {
|
|
@@ -2215,7 +2236,7 @@ class ct extends w {
|
|
|
2215
2236
|
s(this, "_getById", (t) => this._gradients.find((e) => e.id === t));
|
|
2216
2237
|
s(this, "_labelForValue", (t) => {
|
|
2217
2238
|
if (!t) return "None";
|
|
2218
|
-
if (
|
|
2239
|
+
if (vt(t)) {
|
|
2219
2240
|
for (const e of this._gradients) if (C(e) === t) return e.name;
|
|
2220
2241
|
return "Custom Gradient";
|
|
2221
2242
|
}
|
|
@@ -2365,8 +2386,8 @@ class ct extends w {
|
|
|
2365
2386
|
if (!this._gradient) return void t.classList.remove("visible");
|
|
2366
2387
|
t.classList.add("visible");
|
|
2367
2388
|
const e = this._gradient.type !== "radial";
|
|
2368
|
-
this.$$(".type-btn").forEach((
|
|
2369
|
-
|
|
2389
|
+
this.$$(".type-btn").forEach((d) => {
|
|
2390
|
+
d.classList.toggle("active", d.dataset.type === this._gradient.type);
|
|
2370
2391
|
});
|
|
2371
2392
|
const n = this.$(".angle-row");
|
|
2372
2393
|
n && (n.style.display = e ? "" : "none");
|
|
@@ -2374,41 +2395,41 @@ class ct extends w {
|
|
|
2374
2395
|
o && o.setAttribute("value", this._gradient.angle);
|
|
2375
2396
|
const i = this.$(".speed-row wox-slider");
|
|
2376
2397
|
i && i.setAttribute("value", this._animationSpeed);
|
|
2377
|
-
const
|
|
2378
|
-
|
|
2379
|
-
const
|
|
2380
|
-
|
|
2398
|
+
const r = this.$(".anim-type-row");
|
|
2399
|
+
r && (r.style.display = this._animationSpeed > 0 ? "" : "none");
|
|
2400
|
+
const a = this.$(".anim-select");
|
|
2401
|
+
a && (a.value = this._animationType);
|
|
2381
2402
|
});
|
|
2382
2403
|
s(this, "_bindEvents", () => {
|
|
2383
|
-
this.$(".current").addEventListener("click", (
|
|
2384
|
-
|
|
2385
|
-
}), this.$$(".type-btn").forEach((
|
|
2386
|
-
|
|
2404
|
+
this.$(".current").addEventListener("click", (l) => {
|
|
2405
|
+
l.stopPropagation(), this._open ? this._closeDropdown() : this._openDropdown();
|
|
2406
|
+
}), this.$$(".type-btn").forEach((l) => {
|
|
2407
|
+
l.addEventListener("click", () => {
|
|
2387
2408
|
if (!this._gradient) return;
|
|
2388
|
-
this.$$(".type-btn").forEach((x) => x.classList.remove("active")),
|
|
2389
|
-
const
|
|
2390
|
-
|
|
2409
|
+
this.$$(".type-btn").forEach((x) => x.classList.remove("active")), l.classList.add("active"), this._gradient.type = l.dataset.type;
|
|
2410
|
+
const g = this.$(".angle-row");
|
|
2411
|
+
g && (g.style.display = l.dataset.type === "linear" ? "" : "none"), this._applyGradient();
|
|
2391
2412
|
});
|
|
2392
2413
|
});
|
|
2393
2414
|
const t = this.$(".angle-row wox-slider");
|
|
2394
|
-
t && (t.addEventListener("wox-input", (
|
|
2395
|
-
this._gradient && (this._gradient.angle =
|
|
2396
|
-
}), t.addEventListener("wox-change", (
|
|
2397
|
-
this._gradient && (this._gradient.angle =
|
|
2415
|
+
t && (t.addEventListener("wox-input", (l) => {
|
|
2416
|
+
this._gradient && (this._gradient.angle = l.detail.value, this._applyGradient());
|
|
2417
|
+
}), t.addEventListener("wox-change", (l) => {
|
|
2418
|
+
this._gradient && (this._gradient.angle = l.detail.value, this._applyGradient());
|
|
2398
2419
|
}));
|
|
2399
2420
|
const e = this.$(".speed-row wox-slider");
|
|
2400
|
-
e && (e.addEventListener("wox-input", (
|
|
2401
|
-
this._animationSpeed =
|
|
2402
|
-
const
|
|
2403
|
-
|
|
2404
|
-
}), e.addEventListener("wox-change", (
|
|
2405
|
-
this._animationSpeed =
|
|
2406
|
-
const
|
|
2407
|
-
|
|
2421
|
+
e && (e.addEventListener("wox-input", (l) => {
|
|
2422
|
+
this._animationSpeed = l.detail.value;
|
|
2423
|
+
const g = this.$(".anim-type-row");
|
|
2424
|
+
g && (g.style.display = this._animationSpeed > 0 ? "" : "none"), this._emitChange();
|
|
2425
|
+
}), e.addEventListener("wox-change", (l) => {
|
|
2426
|
+
this._animationSpeed = l.detail.value;
|
|
2427
|
+
const g = this.$(".anim-type-row");
|
|
2428
|
+
g && (g.style.display = this._animationSpeed > 0 ? "" : "none"), this._emitChange();
|
|
2408
2429
|
}));
|
|
2409
2430
|
const n = this.$(".anim-select");
|
|
2410
|
-
n && n.addEventListener("change", (
|
|
2411
|
-
this._animationType =
|
|
2431
|
+
n && n.addEventListener("change", (l) => {
|
|
2432
|
+
this._animationType = l.target.value, this._emitChange();
|
|
2412
2433
|
});
|
|
2413
2434
|
const o = this.$(".cancel-btn");
|
|
2414
2435
|
o && o.addEventListener("click", () => {
|
|
@@ -2418,19 +2439,19 @@ class ct extends w {
|
|
|
2418
2439
|
i && i.addEventListener("click", () => {
|
|
2419
2440
|
this._applyFromEditor(!1);
|
|
2420
2441
|
});
|
|
2421
|
-
const
|
|
2422
|
-
|
|
2442
|
+
const r = this.$(".save-btn");
|
|
2443
|
+
r && r.addEventListener("click", () => {
|
|
2423
2444
|
this._applyFromEditor(!0);
|
|
2424
2445
|
});
|
|
2425
|
-
const
|
|
2426
|
-
|
|
2427
|
-
this._editingName =
|
|
2446
|
+
const a = this.$(".name-input");
|
|
2447
|
+
a && a.addEventListener("input", (l) => {
|
|
2448
|
+
this._editingName = l.target.value.trim();
|
|
2428
2449
|
});
|
|
2429
|
-
const
|
|
2430
|
-
|
|
2431
|
-
this._editingGradient =
|
|
2432
|
-
}),
|
|
2433
|
-
this._editingGradient =
|
|
2450
|
+
const d = this.$(".modal-editor");
|
|
2451
|
+
d && (d.addEventListener("wox-gradient-input", (l) => {
|
|
2452
|
+
this._editingGradient = l.detail.gradient;
|
|
2453
|
+
}), d.addEventListener("wox-gradient-change", (l) => {
|
|
2454
|
+
this._editingGradient = l.detail.gradient;
|
|
2434
2455
|
}));
|
|
2435
2456
|
const h = this.$(".editor-modal");
|
|
2436
2457
|
h && h.addEventListener("wox-close", () => {
|
|
@@ -2445,8 +2466,8 @@ class ct extends w {
|
|
|
2445
2466
|
if (!t || !e) return;
|
|
2446
2467
|
const n = t.getBoundingClientRect(), o = window.innerHeight;
|
|
2447
2468
|
e.style.left = `${n.left}px`, e.style.width = `${n.width}px`;
|
|
2448
|
-
const i = o - n.bottom,
|
|
2449
|
-
i >= 280 || i >=
|
|
2469
|
+
const i = o - n.bottom, r = n.top;
|
|
2470
|
+
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
2471
|
});
|
|
2451
2472
|
s(this, "_closeDropdown", () => {
|
|
2452
2473
|
this._open = !1, this.$(".selector").classList.remove("open");
|
|
@@ -2463,13 +2484,13 @@ class ct extends w {
|
|
|
2463
2484
|
<input type="color" class="solid-input" value="${n}">
|
|
2464
2485
|
</div>
|
|
2465
2486
|
`, this._gradients.forEach((o) => {
|
|
2466
|
-
const i = C(o),
|
|
2487
|
+
const i = C(o), r = o.id.startsWith("grad_preset_"), a = r ? `<button class="dropdown-item-btn" data-dup-id="${o.id}" title="Duplicate gradient">⎘</button>` : "", d = r ? "" : `<button class="dropdown-item-btn" data-edit-id="${o.id}" title="Edit gradient">✎</button>`, h = r ? "" : `<button class="dropdown-item-btn delete-btn" data-delete-id="${o.id}" title="Delete gradient">×</button>`;
|
|
2467
2488
|
e += `
|
|
2468
2489
|
<div class="dropdown-item" data-gradient-id="${o.id}">
|
|
2469
2490
|
<div class="dropdown-item-preview" style="background: ${i}"></div>
|
|
2470
2491
|
<span class="dropdown-item-label">${o.name}</span>
|
|
2471
|
-
${
|
|
2472
|
-
${
|
|
2492
|
+
${a}
|
|
2493
|
+
${d}
|
|
2473
2494
|
${h}
|
|
2474
2495
|
</div>
|
|
2475
2496
|
`;
|
|
@@ -2490,28 +2511,28 @@ class ct extends w {
|
|
|
2490
2511
|
}), n.addEventListener("change", () => {
|
|
2491
2512
|
n.style.pointerEvents = "none";
|
|
2492
2513
|
}), n.addEventListener("click", (i) => i.stopPropagation())), t.querySelectorAll("[data-gradient-id]").forEach((i) => {
|
|
2493
|
-
i.addEventListener("click", (
|
|
2494
|
-
if (
|
|
2495
|
-
const
|
|
2496
|
-
|
|
2514
|
+
i.addEventListener("click", (r) => {
|
|
2515
|
+
if (r.target.hasAttribute("data-delete-id") || r.target.hasAttribute("data-edit-id") || r.target.hasAttribute("data-dup-id")) return;
|
|
2516
|
+
const a = this._getById(i.dataset.gradientId);
|
|
2517
|
+
a && (this._gradient = JSON.parse(JSON.stringify(a)), this._value = C(this._gradient), this._updatePreview(), this._syncControls(), this._emitChange(), this._closeDropdown());
|
|
2497
2518
|
});
|
|
2498
2519
|
}), t.querySelectorAll("[data-dup-id]").forEach((i) => {
|
|
2499
|
-
i.addEventListener("click", (
|
|
2500
|
-
|
|
2501
|
-
const
|
|
2502
|
-
if (!
|
|
2503
|
-
const
|
|
2504
|
-
this._closeDropdown(), this._openEditorDialog(
|
|
2520
|
+
i.addEventListener("click", (r) => {
|
|
2521
|
+
r.stopPropagation();
|
|
2522
|
+
const a = this._getById(i.dataset.dupId);
|
|
2523
|
+
if (!a) return;
|
|
2524
|
+
const d = { id: I(), name: a.name + " Copy", type: a.type, angle: a.angle, stops: a.stops.map((h) => ({ ...h })) };
|
|
2525
|
+
this._closeDropdown(), this._openEditorDialog(d);
|
|
2505
2526
|
});
|
|
2506
2527
|
}), t.querySelectorAll("[data-edit-id]").forEach((i) => {
|
|
2507
|
-
i.addEventListener("click", (
|
|
2508
|
-
|
|
2509
|
-
const
|
|
2510
|
-
|
|
2528
|
+
i.addEventListener("click", (r) => {
|
|
2529
|
+
r.stopPropagation();
|
|
2530
|
+
const a = this._getById(i.dataset.editId);
|
|
2531
|
+
a && (this._closeDropdown(), this._openEditorDialog(JSON.parse(JSON.stringify(a))));
|
|
2511
2532
|
});
|
|
2512
2533
|
}), t.querySelectorAll("[data-delete-id]").forEach((i) => {
|
|
2513
|
-
i.addEventListener("click", (
|
|
2514
|
-
|
|
2534
|
+
i.addEventListener("click", (r) => {
|
|
2535
|
+
r.stopPropagation(), this._delete(i.dataset.deleteId), this._populateDropdown();
|
|
2515
2536
|
});
|
|
2516
2537
|
});
|
|
2517
2538
|
const o = t.querySelector('[data-action="custom"]');
|
|
@@ -2521,7 +2542,7 @@ class ct extends w {
|
|
|
2521
2542
|
});
|
|
2522
2543
|
s(this, "_openEditorDialog", (t) => {
|
|
2523
2544
|
let e;
|
|
2524
|
-
t ? e = JSON.parse(JSON.stringify(t)) : (e =
|
|
2545
|
+
t ? e = JSON.parse(JSON.stringify(t)) : (e = wt(this._value), e ? (e.id = e.id || I(), e.name = e.name || "Custom Gradient") : e = { id: I(), 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
2546
|
const n = this.$(".modal-editor");
|
|
2526
2547
|
n && (n.gradient = this._editingGradient);
|
|
2527
2548
|
const o = this.$(".name-input");
|
|
@@ -2532,7 +2553,7 @@ class ct extends w {
|
|
|
2532
2553
|
s(this, "_applyFromEditor", (t) => {
|
|
2533
2554
|
if (!this._editingGradient) return;
|
|
2534
2555
|
const e = JSON.parse(JSON.stringify(this._editingGradient));
|
|
2535
|
-
this._editingName && (e.name = this._editingName), e.id = this._editingOriginalId || e.id ||
|
|
2556
|
+
this._editingName && (e.name = this._editingName), e.id = this._editingOriginalId || e.id || I(), t && this._save(e), this._gradient = JSON.parse(JSON.stringify(e)), this._value = C(this._gradient), this._updatePreview(), this._syncControls(), this._emitChange(), this._closeModal();
|
|
2536
2557
|
});
|
|
2537
2558
|
s(this, "_closeModal", () => {
|
|
2538
2559
|
const t = this.$(".editor-modal");
|
|
@@ -2557,9 +2578,9 @@ class ct extends w {
|
|
|
2557
2578
|
this.isConnected && (this._syncFromAttributes(), this._updatePreview(), this._syncControls());
|
|
2558
2579
|
}
|
|
2559
2580
|
}
|
|
2560
|
-
s(
|
|
2561
|
-
const
|
|
2562
|
-
class
|
|
2581
|
+
s(ht, "observedAttributes", ["value", "animation-speed", "animation-type"]);
|
|
2582
|
+
const It = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], Ot = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
2583
|
+
class xt extends w {
|
|
2563
2584
|
constructor() {
|
|
2564
2585
|
super(...arguments);
|
|
2565
2586
|
s(this, "_currentDate", /* @__PURE__ */ new Date());
|
|
@@ -2573,14 +2594,14 @@ class pt extends w {
|
|
|
2573
2594
|
this._currentDate = new Date(t, this._currentDate.getMonth(), 1), this._render();
|
|
2574
2595
|
});
|
|
2575
2596
|
s(this, "_goToday", () => {
|
|
2576
|
-
const t = /* @__PURE__ */ new Date(), e =
|
|
2597
|
+
const t = /* @__PURE__ */ new Date(), e = mt(t);
|
|
2577
2598
|
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
2599
|
});
|
|
2579
2600
|
s(this, "_handleDayClick", (t) => {
|
|
2580
2601
|
const e = t.dataset.date;
|
|
2581
2602
|
if (e) {
|
|
2582
2603
|
if (t.classList.contains("other-month")) {
|
|
2583
|
-
const n =
|
|
2604
|
+
const n = O(e);
|
|
2584
2605
|
this._currentDate = new Date(n.getFullYear(), n.getMonth(), 1);
|
|
2585
2606
|
}
|
|
2586
2607
|
this.rangeMode ? this._handleRangeSelection(e) : (this._selectedDate = e, this.emit("wox-change", { date: e }), this._render());
|
|
@@ -2606,22 +2627,22 @@ class pt extends w {
|
|
|
2606
2627
|
return e;
|
|
2607
2628
|
});
|
|
2608
2629
|
s(this, "_generateGrid", (t, e) => {
|
|
2609
|
-
const n = /* @__PURE__ */ new Date(), o =
|
|
2610
|
-
let
|
|
2611
|
-
const
|
|
2612
|
-
for (let
|
|
2613
|
-
const
|
|
2614
|
-
|
|
2630
|
+
const n = /* @__PURE__ */ new Date(), o = mt(n), i = new Date(t, e, 1).getDay(), r = new Date(t, e + 1, 0).getDate();
|
|
2631
|
+
let a = "";
|
|
2632
|
+
const d = e === 0 ? t - 1 : t, h = e === 0 ? 11 : e - 1, l = new Date(d, h + 1, 0).getDate();
|
|
2633
|
+
for (let b = i - 1; b >= 0; b--) {
|
|
2634
|
+
const u = l - b;
|
|
2635
|
+
a += `<div class="day-cell other-month" data-date="${H(d, h, u)}">${u}</div>`;
|
|
2615
2636
|
}
|
|
2616
|
-
for (let
|
|
2617
|
-
const
|
|
2618
|
-
let
|
|
2619
|
-
|
|
2637
|
+
for (let b = 1; b <= r; b++) {
|
|
2638
|
+
const u = H(t, e, b);
|
|
2639
|
+
let v = "day-cell";
|
|
2640
|
+
u === o && (v += " today"), this.rangeMode ? this._selectedRange.start && u === this._selectedRange.start ? v += " range-start" : this._selectedRange.end && u === this._selectedRange.end ? v += " range-end" : Tt(u, this._selectedRange.start, this._selectedRange.end) && (v += " in-range") : this._selectedDate && u === this._selectedDate && (v += " selected"), a += `<div class="${v}" data-date="${u}">${b}</div>`;
|
|
2620
2641
|
}
|
|
2621
|
-
const
|
|
2622
|
-
for (let
|
|
2623
|
-
|
|
2624
|
-
return
|
|
2642
|
+
const g = 7 * Math.ceil((i + r) / 7), x = e === 11 ? t + 1 : t, f = e === 11 ? 0 : e + 1;
|
|
2643
|
+
for (let b = 1; b <= g - i - r; b++)
|
|
2644
|
+
a += `<div class="day-cell other-month" data-date="${H(x, f, b)}">${b}</div>`;
|
|
2645
|
+
return a;
|
|
2625
2646
|
});
|
|
2626
2647
|
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
2648
|
s(this, "_render", () => {
|
|
@@ -2829,13 +2850,13 @@ class pt extends w {
|
|
|
2829
2850
|
<div class="header">
|
|
2830
2851
|
<button class="nav-btn" id="prev-month">‹</button>
|
|
2831
2852
|
<div class="month-year">
|
|
2832
|
-
${
|
|
2853
|
+
${It[e]}
|
|
2833
2854
|
<select class="year-select">${this._generateYearOptions(t)}</select>
|
|
2834
2855
|
</div>
|
|
2835
2856
|
<button class="nav-btn" id="next-month">›</button>
|
|
2836
2857
|
</div>
|
|
2837
2858
|
<div class="day-headers">
|
|
2838
|
-
${
|
|
2859
|
+
${Ot.map((n) => `<div class="day-header">${n}</div>`).join("")}
|
|
2839
2860
|
</div>
|
|
2840
2861
|
<div class="calendar-grid">
|
|
2841
2862
|
${this._generateGrid(t, e)}
|
|
@@ -2876,7 +2897,7 @@ class pt extends w {
|
|
|
2876
2897
|
if (t === "range-mode") this._selectedDate = null, this._selectedRange = { start: null, end: null };
|
|
2877
2898
|
else if (t === "value" && n !== null) {
|
|
2878
2899
|
this._selectedDate = n;
|
|
2879
|
-
const o =
|
|
2900
|
+
const o = O(n);
|
|
2880
2901
|
isNaN(o) || (this._currentDate = new Date(o.getFullYear(), o.getMonth(), 1));
|
|
2881
2902
|
} else t === "range-start" ? this._selectedRange.start = n : t === "range-end" && (this._selectedRange.end = n);
|
|
2882
2903
|
this._render();
|
|
@@ -2897,13 +2918,13 @@ class pt extends w {
|
|
|
2897
2918
|
setDate(t) {
|
|
2898
2919
|
if (this.rangeMode) return;
|
|
2899
2920
|
this._selectedDate = t;
|
|
2900
|
-
const e =
|
|
2921
|
+
const e = O(t);
|
|
2901
2922
|
isNaN(e) || (this._currentDate = new Date(e.getFullYear(), e.getMonth(), 1)), this._render();
|
|
2902
2923
|
}
|
|
2903
2924
|
setRange(t, e) {
|
|
2904
2925
|
if (!this.rangeMode) return;
|
|
2905
2926
|
this._selectedRange = { start: t, end: e };
|
|
2906
|
-
const n =
|
|
2927
|
+
const n = O(t);
|
|
2907
2928
|
this._currentDate = new Date(n.getFullYear(), n.getMonth(), 1), this._render();
|
|
2908
2929
|
}
|
|
2909
2930
|
getSelectedDate() {
|
|
@@ -2916,40 +2937,40 @@ class pt extends w {
|
|
|
2916
2937
|
this._selectedDate = null, this._selectedRange = { start: null, end: null }, this._render();
|
|
2917
2938
|
}
|
|
2918
2939
|
}
|
|
2919
|
-
s(
|
|
2920
|
-
const
|
|
2940
|
+
s(xt, "observedAttributes", ["range-mode", "value", "range-start", "range-end", "disabled"]);
|
|
2941
|
+
const mt = (p) => `${p.getFullYear()}-${String(p.getMonth() + 1).padStart(2, "0")}-${String(p.getDate()).padStart(2, "0")}`, O = (p) => {
|
|
2921
2942
|
const [c, t, e] = p.split("-").map(Number);
|
|
2922
2943
|
return new Date(c, t - 1, e);
|
|
2923
|
-
},
|
|
2944
|
+
}, H = (p, c, t) => `${p}-${String(c + 1).padStart(2, "0")}-${String(t).padStart(2, "0")}`, Tt = (p, c, t) => !(!c || !t) && p > c && p < t, j = "woxTheme", E = class E {
|
|
2924
2945
|
};
|
|
2925
|
-
s(
|
|
2946
|
+
s(E, "get", () => document.documentElement.dataset[j] === "light" ? "light" : "dark"), s(E, "set", (c) => {
|
|
2926
2947
|
if (c === "dark" || c === "light") {
|
|
2927
|
-
c === "light" ? document.documentElement.dataset[
|
|
2948
|
+
c === "light" ? document.documentElement.dataset[j] = "light" : delete document.documentElement.dataset[j];
|
|
2928
2949
|
try {
|
|
2929
2950
|
localStorage.setItem("wox-theme", c);
|
|
2930
2951
|
} catch {
|
|
2931
2952
|
}
|
|
2932
2953
|
document.documentElement.dispatchEvent(new CustomEvent("wox-theme-change", { detail: { theme: c }, bubbles: !0, composed: !0 }));
|
|
2933
2954
|
}
|
|
2934
|
-
}), s(
|
|
2935
|
-
|
|
2936
|
-
}), s(
|
|
2955
|
+
}), s(E, "toggle", () => {
|
|
2956
|
+
E.set(E.get() === "dark" ? "light" : "dark");
|
|
2957
|
+
}), s(E, "auto", () => {
|
|
2937
2958
|
try {
|
|
2938
2959
|
const t = localStorage.getItem("wox-theme");
|
|
2939
|
-
if (t === "dark" || t === "light") return void
|
|
2960
|
+
if (t === "dark" || t === "light") return void E.set(t);
|
|
2940
2961
|
} catch {
|
|
2941
2962
|
}
|
|
2942
2963
|
const c = window.matchMedia("(prefers-color-scheme: light)").matches;
|
|
2943
|
-
|
|
2964
|
+
E.set(c ? "light" : "dark");
|
|
2944
2965
|
});
|
|
2945
|
-
let
|
|
2946
|
-
class
|
|
2966
|
+
let M = E;
|
|
2967
|
+
class yt extends w {
|
|
2947
2968
|
constructor() {
|
|
2948
2969
|
super(...arguments);
|
|
2949
2970
|
s(this, "_onThemeChange", null);
|
|
2950
2971
|
}
|
|
2951
2972
|
connectedCallback() {
|
|
2952
|
-
this._render(), this.hasAttribute("auto") &&
|
|
2973
|
+
this._render(), this.hasAttribute("auto") && M.auto(), this._onThemeChange = () => this._updateIcon(), document.documentElement.addEventListener("wox-theme-change", this._onThemeChange), this._updateIcon();
|
|
2953
2974
|
}
|
|
2954
2975
|
disconnectedCallback() {
|
|
2955
2976
|
this._onThemeChange && (document.documentElement.removeEventListener("wox-theme-change", this._onThemeChange), this._onThemeChange = null);
|
|
@@ -2989,17 +3010,17 @@ class ft extends w {
|
|
|
2989
3010
|
-webkit-font-smoothing: antialiased;
|
|
2990
3011
|
text-rendering: optimizeLegibility;
|
|
2991
3012
|
}
|
|
2992
|
-
`, '<button type="button" title="Toggle theme"><span class="icon">light_mode</span></button>'), this.$("button").addEventListener("click", () =>
|
|
3013
|
+
`, '<button type="button" title="Toggle theme"><span class="icon">light_mode</span></button>'), this.$("button").addEventListener("click", () => M.toggle());
|
|
2993
3014
|
}
|
|
2994
3015
|
_updateIcon() {
|
|
2995
3016
|
const t = this.$(".icon");
|
|
2996
3017
|
if (!t) return;
|
|
2997
|
-
const e =
|
|
3018
|
+
const e = M.get() === "dark";
|
|
2998
3019
|
t.textContent = e ? "light_mode" : "dark_mode", this.$("button").title = e ? "Switch to light mode" : "Switch to dark mode";
|
|
2999
3020
|
}
|
|
3000
3021
|
}
|
|
3001
|
-
customElements.define("wox-icon",
|
|
3002
|
-
const
|
|
3022
|
+
customElements.define("wox-icon", G), customElements.define("wox-separator", Y), customElements.define("wox-badge", X), customElements.define("wox-button", q), customElements.define("wox-input", J), customElements.define("wox-select", K), customElements.define("wox-slider", V), customElements.define("wox-color-swatch", U), customElements.define("wox-tooltip", Q), customElements.define("wox-color-picker", Z), customElements.define("wox-menu-item", tt), customElements.define("wox-menu", et), customElements.define("wox-layer-item", nt), customElements.define("wox-section", ot), customElements.define("wox-tab", it), customElements.define("wox-tabs", st), customElements.define("wox-toolbar-group", rt), customElements.define("wox-toolbar", at), customElements.define("wox-panel", dt), customElements.define("wox-menubar", lt), customElements.define("wox-statusbar", ct), customElements.define("wox-modal", pt), customElements.define("wox-datagrid", ft), customElements.define("wox-toast", S), customElements.define("wox-context-menu", T), customElements.define("wox-gradient-editor", _t), customElements.define("wox-gradient-selector", ht), customElements.define("wox-date-picker", xt), customElements.define("wox-theme-toggle", yt);
|
|
3023
|
+
const Pt = `/* wox-theme.css — Global CSS custom properties for the WOX component library */
|
|
3003
3024
|
:root {
|
|
3004
3025
|
--wox-bg-app: #121214;
|
|
3005
3026
|
--wox-bg-panel: #17171a;
|
|
@@ -3085,41 +3106,41 @@ const Rt = `/* wox-theme.css — Global CSS custom properties for the WOX compon
|
|
|
3085
3106
|
(() => {
|
|
3086
3107
|
if (document.getElementById("wox-theme")) return;
|
|
3087
3108
|
const p = document.createElement("style");
|
|
3088
|
-
p.id = "wox-theme", p.textContent =
|
|
3089
|
-
})(), window.WoxIcon =
|
|
3109
|
+
p.id = "wox-theme", p.textContent = Pt, document.head.appendChild(p);
|
|
3110
|
+
})(), window.WoxIcon = G, window.WoxSeparator = Y, window.WoxBadge = X, window.WoxButton = q, window.WoxInput = J, window.WoxSelect = K, window.WoxSlider = V, window.WoxColorSwatch = U, window.WoxTooltip = Q, window.WoxColorPicker = Z, window.WoxMenuItem = tt, window.WoxMenu = et, window.WoxLayerItem = nt, window.WoxSection = ot, window.WoxTab = it, window.WoxTabs = st, window.WoxToolbarGroup = rt, window.WoxToolbar = at, window.WoxPanel = dt, window.WoxMenubar = lt, window.WoxStatusbar = ct, window.WoxModal = pt, window.WoxDatagrid = ft, window.WoxToast = S, window.WoxContextMenu = T, window.WoxGradientEditor = _t, window.WoxGradientSelector = ht, window.WoxDatePicker = xt, window.WoxThemeToggle = yt;
|
|
3090
3111
|
export {
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3112
|
+
D as FX_STYLES,
|
|
3113
|
+
X as WoxBadge,
|
|
3114
|
+
q as WoxButton,
|
|
3115
|
+
Z as WoxColorPicker,
|
|
3116
|
+
U as WoxColorSwatch,
|
|
3117
|
+
T as WoxContextMenu,
|
|
3118
|
+
ft as WoxDatagrid,
|
|
3119
|
+
xt as WoxDatePicker,
|
|
3099
3120
|
w as WoxElement,
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3121
|
+
_t as WoxGradientEditor,
|
|
3122
|
+
ht as WoxGradientSelector,
|
|
3123
|
+
G as WoxIcon,
|
|
3124
|
+
J as WoxInput,
|
|
3125
|
+
nt as WoxLayerItem,
|
|
3126
|
+
et as WoxMenu,
|
|
3127
|
+
tt as WoxMenuItem,
|
|
3128
|
+
lt as WoxMenubar,
|
|
3129
|
+
pt as WoxModal,
|
|
3130
|
+
dt as WoxPanel,
|
|
3131
|
+
ot as WoxSection,
|
|
3132
|
+
K as WoxSelect,
|
|
3133
|
+
Y as WoxSeparator,
|
|
3134
|
+
V as WoxSlider,
|
|
3135
|
+
ct as WoxStatusbar,
|
|
3136
|
+
it as WoxTab,
|
|
3137
|
+
st as WoxTabs,
|
|
3138
|
+
M as WoxTheme,
|
|
3139
|
+
yt as WoxThemeToggle,
|
|
3140
|
+
S as WoxToast,
|
|
3141
|
+
at as WoxToolbar,
|
|
3142
|
+
rt as WoxToolbarGroup,
|
|
3143
|
+
Q as WoxTooltip,
|
|
3144
|
+
wt as cssToGradient,
|
|
3124
3145
|
C as gradientToCSS
|
|
3125
3146
|
};
|