@wsxjs/wsx-base-components 0.0.5
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/LICENSE +21 -0
- package/README.md +204 -0
- package/dist/index.cjs +6 -0
- package/dist/index.js +1085 -0
- package/package.json +57 -0
- package/src/ColorPicker.css +188 -0
- package/src/ColorPicker.wsx +416 -0
- package/src/ColorPickerUtils.ts +116 -0
- package/src/ReactiveCounter.css +304 -0
- package/src/ReactiveCounter.wsx +244 -0
- package/src/SimpleReactiveDemo.wsx +58 -0
- package/src/SvgDemo.wsx +241 -0
- package/src/SvgIcon.wsx +88 -0
- package/src/ThemeSwitcher.css +91 -0
- package/src/ThemeSwitcher.wsx +97 -0
- package/src/XyButton.css +257 -0
- package/src/XyButton.wsx +356 -0
- package/src/XyButtonGroup.css +30 -0
- package/src/XyButtonGroup.wsx +124 -0
- package/src/index.ts +17 -0
- package/src/jsx-inject.ts +2 -0
- package/src/types/wsx.d.ts +6 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1085 @@
|
|
|
1
|
+
import { autoRegister as x, WebComponent as y, jsx as i, createLogger as C, ReactiveWebComponent as ot } from "@wsxjs/wsx-core";
|
|
2
|
+
const Qt = ':host{position:relative;display:inline-flex;padding:.25em .625em;box-sizing:border-box;vertical-align:middle;line-height:1.8;overflow:hidden;align-items:center;justify-content:center;font-size:14px;color:var(--fontColor, #333);border-radius:var(--borderRadius, .25em);background:var(--fontColor, #333);transition:background .3s,box-shadow .3s,border-color .3s,color .3s}:host([size="xxxs"]){padding:.03125em .0625em;font-size:6px;line-height:1;min-width:10px;min-height:8px;border-radius:1px}:host([size="xxs"]){padding:.0625em .125em;font-size:8px;line-height:1.1;min-width:14px;min-height:12px;border-radius:2px}:host([size="xs"]){padding:.125em .25em;font-size:10px;line-height:1.2;min-width:18px;min-height:16px;border-radius:3px}:host([size="sm"]){padding:.25em .5em;font-size:12px;line-height:1.4;min-width:24px;min-height:20px;border-radius:4px}:host([size="md"]){padding:.375em .75em;font-size:14px;line-height:1.5;min-width:32px;min-height:28px;border-radius:6px}:host([size="lg"]){padding:.5em 1em;font-size:14px;line-height:1.6;min-width:40px;min-height:32px;border-radius:6px}:host([size="xl"]){padding:.625em 1.25em;font-size:16px;line-height:1.6;min-width:48px;min-height:40px;border-radius:8px}:host([shape="circle"]){border-radius:50%}:host([disabled]),:host([loading]){pointer-events:none;opacity:.6}:host([block]){display:flex}:host([disabled]:not([variant])){background:#0000001a}:host([disabled]) .btn,:host([loading]) .btn{cursor:not-allowed;pointer-events:all}:host(:not([variant="primary"]):not([variant="danger"]):not([disabled]):hover),:host(:not([variant="primary"]):not([variant="danger"]):focus-within),:host([variant="flat"][focus]){color:var(--themeColor, #42b983);border-color:var(--themeColor, #42b983)}:host(:not([variant="primary"]):not([variant="danger"])) .btn:after{background-image:radial-gradient(circle,var(--themeColor, #42b983) 10%,transparent 10.01%)}:host([variant="primary"]){color:#fff;background:var(--themeBackground, var(--themeColor, #42b983))}:host([variant="danger"]){color:#fff;background:var(--themeBackground, var(--dangerColor, #ff7875))}:host([variant="dashed"]){border-style:dashed}:host([variant="flat"]),:host([variant="primary"]),:host([variant="danger"]){border:0;padding:calc(.25em + 1px) calc(.625em + 1px)}:host([variant="flat"]) .btn:before{content:"";position:absolute;background:var(--themeColor, #42b983);pointer-events:none;left:0;right:0;top:0;bottom:0;opacity:0;transition:.3s}:host([variant="flat"]:not([disabled]):hover) .btn:before{opacity:.1}:host(:not([disabled]):hover){z-index:1}:host([variant="flat"]:focus-within) .btn:before,:host([variant="flat"][focus]) .btn:before{opacity:.2}.btn{background:none;outline:0;border:0;position:absolute;left:0;top:0;width:100%;height:100%;padding:0;-webkit-user-select:none;user-select:none;cursor:unset}.loading{margin-right:.35em}::-moz-focus-inner{border:0}.btn:before{content:"";display:block;position:absolute;width:100%;height:100%;left:0;top:0;transition:.2s;background:#fff;opacity:0}:host(:not([disabled]):active) .btn:before{opacity:.2}.btn:after{content:"";display:block;position:absolute;width:100%;height:100%;left:var(--x, 0);top:var(--y, 0);pointer-events:none;background-image:radial-gradient(circle,#fff 10%,transparent 10.01%);background-repeat:no-repeat;background-position:50%;transform:translate(-50%,-50%) scale(10);opacity:0;transition:transform .3s,opacity .8s}.btn:not([disabled]):active:after{transform:translate(-50%,-50%) scale(0);opacity:.3;transition:0s}.icon{margin-right:.35em;transition:none}:host(:empty) .icon{margin:auto}:host(:empty){padding:.65em}:host([type="flat"]:empty),:host([type="primary"]:empty){padding:calc(.65em + 1px)}::slotted(.icon){transition:none}:host([href]){cursor:pointer}';
|
|
3
|
+
var Vt = Object.create, L = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, rt = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), it = (e) => {
|
|
4
|
+
throw TypeError(e);
|
|
5
|
+
}, st = (e, t, o) => t in e ? L(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, te = (e, t) => L(e, "name", { value: t, configurable: !0 }), ee = (e) => [, , , Vt((e == null ? void 0 : e[rt("metadata")]) ?? null)], oe = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], nt = (e) => e !== void 0 && typeof e != "function" ? it("Function expected") : e, re = (e, t, o, s, r) => ({ kind: oe[e], name: t, metadata: s, addInitializer: (n) => o._ ? it("Already initialized") : r.push(nt(n || null)) }), ie = (e, t) => st(t, rt("metadata"), e[3]), se = (e, t, o, s) => {
|
|
6
|
+
for (var r = 0, n = e[t >> 1], a = n && n.length; r < a; r++) n[r].call(o);
|
|
7
|
+
return s;
|
|
8
|
+
}, ne = (e, t, o, s, r, n) => {
|
|
9
|
+
var a, h, u, l = t & 7, p = !1, m = 0, g = e[m] || (e[m] = []), c = l && (r = r.prototype, l < 5 && (l > 3 || !p) && Zt(r, o));
|
|
10
|
+
te(r, o);
|
|
11
|
+
for (var d = s.length - 1; d >= 0; d--)
|
|
12
|
+
u = re(l, o, h = {}, e[3], g), a = (0, s[d])(r, u), h._ = 1, nt(a) && (r = a);
|
|
13
|
+
return ie(e, r), c && L(r, o, c), p ? l ^ 4 ? n : c : r;
|
|
14
|
+
}, b = (e, t, o) => st(e, typeof t != "symbol" ? t + "" : t, o), at, N, lt;
|
|
15
|
+
at = [x({ tagName: "xy-button" })];
|
|
16
|
+
class D extends (lt = y) {
|
|
17
|
+
constructor(t = {}) {
|
|
18
|
+
super({
|
|
19
|
+
styles: Qt,
|
|
20
|
+
styleName: "xy-button",
|
|
21
|
+
...t
|
|
22
|
+
}), b(this, "disabled", !1), b(this, "loading", !1), b(this, "toggle", !1), b(this, "checked", !1), b(this, "icon", null), b(this, "href", null), b(this, "type", null), b(this, "target", "_blank"), b(this, "rel", null), b(this, "download", null), b(this, "variant", "flat"), b(this, "size", "md"), b(this, "btnElement"), b(this, "iconElement"), b(this, "loadingElement"), b(this, "handleMouseDown", (o) => {
|
|
23
|
+
if (this.disabled) return;
|
|
24
|
+
const s = this.getBoundingClientRect(), r = o.clientX - s.left, n = o.clientY - s.top;
|
|
25
|
+
this.style.setProperty("--x", `${r}px`), this.style.setProperty("--y", `${n}px`);
|
|
26
|
+
}), b(this, "handleKeyDown", (o) => {
|
|
27
|
+
(o.code === "Enter" || o.code === "Space") && o.stopPropagation();
|
|
28
|
+
}), b(this, "handleClick", () => {
|
|
29
|
+
this.toggle && !this.disabled && (this.checked = !this.checked, this.checked ? this.setAttr("checked", "") : this.removeAttr("checked"));
|
|
30
|
+
}), this.disabled = t.disabled || !1, this.loading = t.loading || !1, this.toggle = t.toggle || !1, this.checked = t.checked || !1, this.icon = t.icon || null, this.href = t.href || null, this.type = t.type || null, this.target = t.target || "_blank", this.rel = t.rel || null, this.download = t.download || null, this.variant = t.variant || "flat", this.size = t.size || "md";
|
|
31
|
+
}
|
|
32
|
+
static get observedAttributes() {
|
|
33
|
+
return [
|
|
34
|
+
"disabled",
|
|
35
|
+
"icon",
|
|
36
|
+
"loading",
|
|
37
|
+
"href",
|
|
38
|
+
"type",
|
|
39
|
+
"target",
|
|
40
|
+
"rel",
|
|
41
|
+
"download",
|
|
42
|
+
"toggle",
|
|
43
|
+
"checked",
|
|
44
|
+
"variant",
|
|
45
|
+
"shape",
|
|
46
|
+
"block",
|
|
47
|
+
"size"
|
|
48
|
+
];
|
|
49
|
+
}
|
|
50
|
+
render() {
|
|
51
|
+
const t = !!this.href, o = /* @__PURE__ */ i(
|
|
52
|
+
"a",
|
|
53
|
+
{
|
|
54
|
+
href: this.href,
|
|
55
|
+
target: this.target,
|
|
56
|
+
rel: this.rel || void 0,
|
|
57
|
+
download: this.download || void 0,
|
|
58
|
+
className: "btn",
|
|
59
|
+
onMouseDown: this.handleMouseDown,
|
|
60
|
+
onKeyDown: this.handleKeyDown,
|
|
61
|
+
ref: (r) => {
|
|
62
|
+
this.btnElement = r;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
this.renderContent()
|
|
66
|
+
), s = /* @__PURE__ */ i(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: this.type || "button",
|
|
70
|
+
disabled: this.disabled,
|
|
71
|
+
className: "btn",
|
|
72
|
+
onMouseDown: this.handleMouseDown,
|
|
73
|
+
onKeyDown: this.handleKeyDown,
|
|
74
|
+
ref: (r) => {
|
|
75
|
+
this.btnElement = r;
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
this.renderContent()
|
|
79
|
+
);
|
|
80
|
+
return /* @__PURE__ */ i("div", { className: "xy-button-container" }, t ? o : s);
|
|
81
|
+
}
|
|
82
|
+
renderContent() {
|
|
83
|
+
const t = [];
|
|
84
|
+
return this.loading && t.push(
|
|
85
|
+
/* @__PURE__ */ i(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: "loading",
|
|
89
|
+
ref: (o) => {
|
|
90
|
+
this.loadingElement = o;
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
"Loading..."
|
|
94
|
+
)
|
|
95
|
+
), !this.loading && this.icon && this.icon !== "null" && t.push(
|
|
96
|
+
/* @__PURE__ */ i(
|
|
97
|
+
"div",
|
|
98
|
+
{
|
|
99
|
+
className: "icon",
|
|
100
|
+
"data-icon": this.icon,
|
|
101
|
+
ref: (o) => {
|
|
102
|
+
this.iconElement = o;
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
this.icon
|
|
106
|
+
)
|
|
107
|
+
), t.push(/* @__PURE__ */ i("slot", null)), t;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* 组件连接到DOM后的初始化
|
|
111
|
+
*/
|
|
112
|
+
onConnected() {
|
|
113
|
+
this.addEventListener("click", this.handleClick);
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* 组件从DOM断开时的清理
|
|
117
|
+
*/
|
|
118
|
+
onDisconnected() {
|
|
119
|
+
this.removeEventListener("click", this.handleClick);
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* 属性变化处理
|
|
123
|
+
*/
|
|
124
|
+
onAttributeChanged(t, o, s) {
|
|
125
|
+
switch (t) {
|
|
126
|
+
case "disabled":
|
|
127
|
+
this.disabled = s !== null, this.updateButtonState();
|
|
128
|
+
break;
|
|
129
|
+
case "loading":
|
|
130
|
+
this.loading = s !== null, this.updateButtonState(), this.rerender();
|
|
131
|
+
break;
|
|
132
|
+
case "icon":
|
|
133
|
+
this.icon = s, this.rerender();
|
|
134
|
+
break;
|
|
135
|
+
case "href":
|
|
136
|
+
this.href = s, this.rerender();
|
|
137
|
+
break;
|
|
138
|
+
case "type":
|
|
139
|
+
this.type = s, this.updateButtonState();
|
|
140
|
+
break;
|
|
141
|
+
case "target":
|
|
142
|
+
this.target = s || "_blank";
|
|
143
|
+
break;
|
|
144
|
+
case "rel":
|
|
145
|
+
this.rel = s;
|
|
146
|
+
break;
|
|
147
|
+
case "download":
|
|
148
|
+
this.download = s;
|
|
149
|
+
break;
|
|
150
|
+
case "toggle":
|
|
151
|
+
this.toggle = s !== null;
|
|
152
|
+
break;
|
|
153
|
+
case "checked":
|
|
154
|
+
this.checked = s !== null;
|
|
155
|
+
break;
|
|
156
|
+
case "variant":
|
|
157
|
+
this.variant = s || "flat";
|
|
158
|
+
break;
|
|
159
|
+
case "size":
|
|
160
|
+
this.size = s || "md";
|
|
161
|
+
break;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* 更新按钮状态
|
|
166
|
+
*/
|
|
167
|
+
updateButtonState() {
|
|
168
|
+
this.btnElement && (this.disabled || this.loading ? (this.btnElement.setAttribute("disabled", "disabled"), this.href && this.btnElement instanceof HTMLAnchorElement && this.btnElement.removeAttribute("href")) : (this.btnElement.removeAttribute("disabled"), this.href && this.btnElement instanceof HTMLAnchorElement && (this.btnElement.href = this.href)), this.type && this.btnElement instanceof HTMLButtonElement && (this.btnElement.type = this.type));
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* 公共API:聚焦按钮
|
|
172
|
+
*/
|
|
173
|
+
focus() {
|
|
174
|
+
var t;
|
|
175
|
+
(t = this.btnElement) == null || t.focus();
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 公共API:获取/设置属性
|
|
179
|
+
*/
|
|
180
|
+
get isDisabled() {
|
|
181
|
+
return this.disabled;
|
|
182
|
+
}
|
|
183
|
+
set isDisabled(t) {
|
|
184
|
+
t ? this.setAttr("disabled", "") : this.removeAttr("disabled");
|
|
185
|
+
}
|
|
186
|
+
get isLoading() {
|
|
187
|
+
return this.loading;
|
|
188
|
+
}
|
|
189
|
+
set isLoading(t) {
|
|
190
|
+
t ? this.setAttr("loading", "") : this.removeAttr("loading");
|
|
191
|
+
}
|
|
192
|
+
get isChecked() {
|
|
193
|
+
return this.checked;
|
|
194
|
+
}
|
|
195
|
+
set isChecked(t) {
|
|
196
|
+
t ? this.setAttr("checked", "") : this.removeAttr("checked");
|
|
197
|
+
}
|
|
198
|
+
get buttonIcon() {
|
|
199
|
+
return this.icon;
|
|
200
|
+
}
|
|
201
|
+
set buttonIcon(t) {
|
|
202
|
+
t ? this.setAttr("icon", t) : this.removeAttr("icon");
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
N = ee(lt);
|
|
206
|
+
D = ne(N, 0, "XyButton", at, D);
|
|
207
|
+
se(N, 1, D);
|
|
208
|
+
const ae = ':host{display:inline-flex}::slotted(xy-button:not(:first-of-type):not(:last-of-type)){border-radius:0}::slotted(xy-button){margin:0!important}::slotted(xy-button:not(:first-of-type)){margin-left:-1px!important}::slotted(xy-button[type]:not([type="dashed"]):not(:first-of-type)){margin-left:1px!important}::slotted(xy-button:first-of-type){border-top-right-radius:0;border-bottom-right-radius:0}::slotted(xy-button:last-of-type){border-top-left-radius:0;border-bottom-left-radius:0}';
|
|
209
|
+
var le = Object.create, H = Object.defineProperty, ce = Object.getOwnPropertyDescriptor, ct = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), dt = (e) => {
|
|
210
|
+
throw TypeError(e);
|
|
211
|
+
}, ht = (e, t, o) => t in e ? H(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, de = (e, t) => H(e, "name", { value: t, configurable: !0 }), he = (e) => [, , , le((e == null ? void 0 : e[ct("metadata")]) ?? null)], ue = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], ut = (e) => e !== void 0 && typeof e != "function" ? dt("Function expected") : e, pe = (e, t, o, s, r) => ({ kind: ue[e], name: t, metadata: s, addInitializer: (n) => o._ ? dt("Already initialized") : r.push(ut(n || null)) }), me = (e, t) => ht(t, ct("metadata"), e[3]), be = (e, t, o, s) => {
|
|
212
|
+
for (var r = 0, n = e[t >> 1], a = n && n.length; r < a; r++) n[r].call(o);
|
|
213
|
+
return s;
|
|
214
|
+
}, ge = (e, t, o, s, r, n) => {
|
|
215
|
+
var a, h, u, l = t & 7, p = !1, m = 0, g = e[m] || (e[m] = []), c = l && (r = r.prototype, l < 5 && (l > 3 || !p) && ce(r, o));
|
|
216
|
+
de(r, o);
|
|
217
|
+
for (var d = s.length - 1; d >= 0; d--)
|
|
218
|
+
u = pe(l, o, h = {}, e[3], g), a = (0, s[d])(r, u), h._ = 1, ut(a) && (r = a);
|
|
219
|
+
return me(e, r), c && H(r, o, c), p ? l ^ 4 ? n : c : r;
|
|
220
|
+
}, fe = (e, t, o) => ht(e, t + "", o), pt, j, mt;
|
|
221
|
+
pt = [x({ tagName: "xy-button-group" })];
|
|
222
|
+
class T extends (mt = y) {
|
|
223
|
+
constructor(t = {}) {
|
|
224
|
+
super({
|
|
225
|
+
styles: ae,
|
|
226
|
+
styleName: "xy-button-group",
|
|
227
|
+
...t
|
|
228
|
+
}), fe(this, "disabled", !1), this.disabled = t.disabled || !1;
|
|
229
|
+
}
|
|
230
|
+
static get observedAttributes() {
|
|
231
|
+
return ["disabled"];
|
|
232
|
+
}
|
|
233
|
+
render() {
|
|
234
|
+
return /* @__PURE__ */ i("div", { class: "button-group-container" }, /* @__PURE__ */ i("slot", null));
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* 属性变化处理
|
|
238
|
+
*/
|
|
239
|
+
onAttributeChanged(t, o, s) {
|
|
240
|
+
switch (t) {
|
|
241
|
+
case "disabled":
|
|
242
|
+
this.disabled = s !== null, this.updateChildrenDisabledState();
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* 组件连接到DOM后的初始化
|
|
248
|
+
*/
|
|
249
|
+
onConnected() {
|
|
250
|
+
this.updateChildrenDisabledState();
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* 更新所有子按钮的disabled状态
|
|
254
|
+
*/
|
|
255
|
+
updateChildrenDisabledState() {
|
|
256
|
+
if (!this.disabled) return;
|
|
257
|
+
this.querySelectorAll("xy-button").forEach((o) => {
|
|
258
|
+
this.disabled ? o.setAttribute("disabled", "") : o.removeAttribute("disabled");
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* 公共API:获取/设置disabled状态
|
|
263
|
+
*/
|
|
264
|
+
get isDisabled() {
|
|
265
|
+
return this.disabled;
|
|
266
|
+
}
|
|
267
|
+
set isDisabled(t) {
|
|
268
|
+
t ? this.setAttr("disabled", "") : this.removeAttr("disabled");
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* 公共API:获取组内的所有按钮
|
|
272
|
+
*/
|
|
273
|
+
getButtons() {
|
|
274
|
+
return this.querySelectorAll("xy-button");
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* 公共API:启用所有按钮
|
|
278
|
+
*/
|
|
279
|
+
enableAll() {
|
|
280
|
+
this.getButtons().forEach((o) => {
|
|
281
|
+
o.removeAttribute("disabled");
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* 公共API:禁用所有按钮
|
|
286
|
+
*/
|
|
287
|
+
disableAll() {
|
|
288
|
+
this.getButtons().forEach((o) => {
|
|
289
|
+
o.setAttribute("disabled", "");
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
j = he(mt);
|
|
294
|
+
T = ge(j, 0, "XyButtonGroup", pt, T);
|
|
295
|
+
be(j, 1, T);
|
|
296
|
+
const ve = '.color-section{display:inline-block;position:relative}.color-popover{display:inline-block;position:relative;overflow:visible}.color-btn{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;border:1px solid #e1e5e9;border-radius:3px;background:var(--theme-color, #000);color:transparent;cursor:pointer;transition:all .2s ease;box-sizing:border-box}.color-btn:hover:not(.disabled){border-color:#3f51b5;box-shadow:0 2px 8px #3f51b54d}.color-btn.disabled{opacity:.5;cursor:not-allowed}.color-indicator{font-size:12px;line-height:1;-webkit-user-select:none;user-select:none}.color-panel{position:absolute;top:100%;left:0;z-index:10000;background:#fff;border:1px solid #e1e5e9;border-radius:6px;box-shadow:0 4px 20px #00000026;padding:8px;margin-top:4px;box-sizing:border-box;transform-origin:top left;animation:colorPanelShow .2s ease-out}@keyframes colorPanelShow{0%{opacity:0;transform:scale(.9) translateY(-4px)}to{opacity:1;transform:scale(1) translateY(0)}}.color-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:4px;min-width:160px}.color-cube{width:20px;height:20px;border:1px solid #e1e5e9;border-radius:3px;cursor:pointer;transition:all .2s ease;box-sizing:border-box;background-color:var(--cube-color, #000)}.color-cube:hover{border-color:#3f51b5;transform:scale(1.1);box-shadow:0 2px 8px #3f51b566;z-index:1}.color-cube:active{transform:scale(.95)}.color-cube.custom-picker{background:linear-gradient(45deg,red,#ff8000,#ff0,#80ff00 42%,#0f0 57%,#00ff80,#0ff 85%,#0080ff);position:relative}.color-cube.custom-picker:after{content:"+";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:#fff;font-size:12px;font-weight:700;text-shadow:0 0 2px rgba(0,0,0,.8);pointer-events:none}:host([disabled]) .color-btn{opacity:.5;cursor:not-allowed}:host([open]) .color-panel{display:block}:host(:not([open])) .color-panel{display:none}@media (max-width: 768px){.color-panel{position:fixed;top:auto;left:50%;bottom:10px;transform:translate(-50%);width:90vw;max-width:300px}.color-grid{grid-template-columns:repeat(8,1fr);gap:6px}.color-cube{width:24px;height:24px}}@media (prefers-color-scheme: dark){.color-panel{background:#2d2d2d;border-color:#404040;color:#fff}.color-btn,.color-cube{border-color:#404040}}', S = "editor-js-text-color-cache";
|
|
297
|
+
function xe(e) {
|
|
298
|
+
return e.startsWith("var(") && e.endsWith(")");
|
|
299
|
+
}
|
|
300
|
+
function _e(e) {
|
|
301
|
+
return e.slice(4, -1).trim();
|
|
302
|
+
}
|
|
303
|
+
function ye(e) {
|
|
304
|
+
return getComputedStyle(document.documentElement).getPropertyValue(e).trim() || e;
|
|
305
|
+
}
|
|
306
|
+
function w(e) {
|
|
307
|
+
if (xe(e)) {
|
|
308
|
+
const t = _e(e);
|
|
309
|
+
return ye(t);
|
|
310
|
+
}
|
|
311
|
+
return e;
|
|
312
|
+
}
|
|
313
|
+
function ke(e, t) {
|
|
314
|
+
return sessionStorage.setItem(`${S}-${t}`, JSON.stringify(e)), e;
|
|
315
|
+
}
|
|
316
|
+
function Ce(e, t) {
|
|
317
|
+
sessionStorage.setItem(`${S}-${t}-custom`, JSON.stringify(e));
|
|
318
|
+
}
|
|
319
|
+
function we(e) {
|
|
320
|
+
const t = sessionStorage.getItem(`${S}-${e}-custom`);
|
|
321
|
+
return t ? JSON.parse(t) : null;
|
|
322
|
+
}
|
|
323
|
+
function $e(e, t) {
|
|
324
|
+
let o = null;
|
|
325
|
+
return (...s) => {
|
|
326
|
+
o || (o = setTimeout(() => {
|
|
327
|
+
e(...s), o = null;
|
|
328
|
+
}, t));
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
function To(e, t) {
|
|
332
|
+
const o = sessionStorage.getItem(`${S}-${t}`);
|
|
333
|
+
return o ? JSON.parse(o) : e;
|
|
334
|
+
}
|
|
335
|
+
const Oo = "ce-inline-toolbar__dropdown", Io = "ce-conversion-toolbar--showed";
|
|
336
|
+
var Se = Object.create, W = Object.defineProperty, ze = Object.getOwnPropertyDescriptor, bt = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), gt = (e) => {
|
|
337
|
+
throw TypeError(e);
|
|
338
|
+
}, ft = (e, t, o) => t in e ? W(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, Ae = (e, t) => W(e, "name", { value: t, configurable: !0 }), Ee = (e) => [, , , Se((e == null ? void 0 : e[bt("metadata")]) ?? null)], Pe = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], vt = (e) => e !== void 0 && typeof e != "function" ? gt("Function expected") : e, De = (e, t, o, s, r) => ({ kind: Pe[e], name: t, metadata: s, addInitializer: (n) => o._ ? gt("Already initialized") : r.push(vt(n || null)) }), Te = (e, t) => ft(t, bt("metadata"), e[3]), Oe = (e, t, o, s) => {
|
|
339
|
+
for (var r = 0, n = e[t >> 1], a = n && n.length; r < a; r++) n[r].call(o);
|
|
340
|
+
return s;
|
|
341
|
+
}, Ie = (e, t, o, s, r, n) => {
|
|
342
|
+
var a, h, u, l = t & 7, p = !1, m = 0, g = e[m] || (e[m] = []), c = l && (r = r.prototype, l < 5 && (l > 3 || !p) && ze(r, o));
|
|
343
|
+
Ae(r, o);
|
|
344
|
+
for (var d = s.length - 1; d >= 0; d--)
|
|
345
|
+
u = De(l, o, h = {}, e[3], g), a = (0, s[d])(r, u), h._ = 1, vt(a) && (r = a);
|
|
346
|
+
return Te(e, r), c && W(r, o, c), p ? l ^ 4 ? n : c : r;
|
|
347
|
+
}, f = (e, t, o) => ft(e, typeof t != "symbol" ? t + "" : t, o), xt, G, _t;
|
|
348
|
+
const k = C("ColorPicker"), Fe = [
|
|
349
|
+
"#ff1300",
|
|
350
|
+
"#EC7878",
|
|
351
|
+
"#9C27B0",
|
|
352
|
+
"#673AB7",
|
|
353
|
+
"#3F51B5",
|
|
354
|
+
"#0070FF",
|
|
355
|
+
"#03A9F4",
|
|
356
|
+
"#00BCD4",
|
|
357
|
+
"#4CAF50",
|
|
358
|
+
"#8BC34A",
|
|
359
|
+
"#CDDC39",
|
|
360
|
+
"#FFE500",
|
|
361
|
+
"#FFBF00",
|
|
362
|
+
"#FF9800",
|
|
363
|
+
"#795548",
|
|
364
|
+
"#9E9E9E",
|
|
365
|
+
"#5A5A5A",
|
|
366
|
+
"#FFF"
|
|
367
|
+
];
|
|
368
|
+
xt = [x({ tagName: "color-picker" })];
|
|
369
|
+
class O extends (_t = y) {
|
|
370
|
+
constructor(t = {}) {
|
|
371
|
+
super({
|
|
372
|
+
styles: ve,
|
|
373
|
+
styleName: "base-color-picker",
|
|
374
|
+
...t
|
|
375
|
+
}), f(this, "colorCollections"), f(this, "onColorPicked"), f(this, "hasCustomPicker"), f(this, "defaultColor"), f(this, "pluginType"), f(this, "disabled"), f(this, "selectedColor"), f(this, "customColor"), f(this, "isOpen"), f(this, "colorBtn"), f(this, "colorPanel"), f(this, "handleButtonClick", (o) => {
|
|
376
|
+
o.stopPropagation(), this.togglePanel();
|
|
377
|
+
}), f(this, "handlePanelClick", (o) => {
|
|
378
|
+
o.stopPropagation();
|
|
379
|
+
}), f(this, "handleColorSelect", (o) => {
|
|
380
|
+
var r;
|
|
381
|
+
const s = w(o);
|
|
382
|
+
this.setSelectedColor(s), this.closePanel(), ke(s, this.pluginType), (r = this.onColorPicked) == null || r.call(this, s), this.dispatchEvent(
|
|
383
|
+
new CustomEvent("colorchange", {
|
|
384
|
+
detail: { color: s },
|
|
385
|
+
bubbles: !0,
|
|
386
|
+
composed: !0
|
|
387
|
+
})
|
|
388
|
+
), k.debug("Color selected", { color: s });
|
|
389
|
+
}), f(this, "handleCustomPickerClick", () => {
|
|
390
|
+
const o = document.createElement("input");
|
|
391
|
+
o.type = "color", o.value = this.customColor, o.style.cssText = `
|
|
392
|
+
position: fixed;
|
|
393
|
+
left: -9999px;
|
|
394
|
+
opacity: 0;
|
|
395
|
+
pointer-events: none;
|
|
396
|
+
`;
|
|
397
|
+
const s = $e((r) => {
|
|
398
|
+
var h;
|
|
399
|
+
const n = r.target, a = w(n.value);
|
|
400
|
+
this.setSelectedColor(a), this.setCustomColor(a), document.body.removeChild(o), (h = this.onColorPicked) == null || h.call(this, a), this.dispatchEvent(
|
|
401
|
+
new CustomEvent("colorchange", {
|
|
402
|
+
detail: { color: a },
|
|
403
|
+
bubbles: !0,
|
|
404
|
+
composed: !0
|
|
405
|
+
})
|
|
406
|
+
), k.debug("Custom color selected", { color: a });
|
|
407
|
+
}, 30);
|
|
408
|
+
o.addEventListener("input", s), document.body.appendChild(o), requestAnimationFrame(() => {
|
|
409
|
+
o.focus(), o.click();
|
|
410
|
+
});
|
|
411
|
+
}), f(this, "handleDocumentClick", (o) => {
|
|
412
|
+
this.isOpen && !this.contains(o.target) && this.closePanel();
|
|
413
|
+
}), this.colorCollections = t.colorCollections || Fe, this.onColorPicked = t.onColorPicked, this.hasCustomPicker = t.hasCustomPicker || !1, this.pluginType = t.pluginType || "text", this.disabled = t.disabled || !1, this.defaultColor = w(t.defaultColor || this.colorCollections[0]), this.selectedColor = this.defaultColor, this.customColor = we(this.pluginType) || "", this.isOpen = !1, k.debug("ColorPicker initialized", {
|
|
414
|
+
colorCollections: this.colorCollections.length,
|
|
415
|
+
hasCustomPicker: this.hasCustomPicker,
|
|
416
|
+
pluginType: this.pluginType
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
static get observedAttributes() {
|
|
420
|
+
return ["disabled", "selected-color", "open"];
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* 实现抽象方法:真正的JSX渲染!🎉
|
|
424
|
+
*/
|
|
425
|
+
render() {
|
|
426
|
+
const t = this.renderColorButton(), o = this.isOpen ? this.renderColorPanel() : null;
|
|
427
|
+
return /* @__PURE__ */ i("section", { class: "color-section" }, /* @__PURE__ */ i("div", { class: "color-popover" }, t, o));
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* 渲染颜色按钮 - 真正的JSX!
|
|
431
|
+
*/
|
|
432
|
+
renderColorButton() {
|
|
433
|
+
return /* @__PURE__ */ i(
|
|
434
|
+
"xy-button",
|
|
435
|
+
{
|
|
436
|
+
type: "button",
|
|
437
|
+
class: `color-btn ${this.disabled ? "disabled" : ""}`,
|
|
438
|
+
style: `--theme-color: ${this.selectedColor}`,
|
|
439
|
+
disabled: this.disabled,
|
|
440
|
+
onClick: this.handleButtonClick,
|
|
441
|
+
ref: (t) => {
|
|
442
|
+
this.colorBtn = t;
|
|
443
|
+
}
|
|
444
|
+
},
|
|
445
|
+
/* @__PURE__ */ i("span", { class: "color-indicator" }, "_")
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* 渲染颜色面板 - 真正的JSX!
|
|
450
|
+
*/
|
|
451
|
+
renderColorPanel() {
|
|
452
|
+
return /* @__PURE__ */ i(
|
|
453
|
+
"div",
|
|
454
|
+
{
|
|
455
|
+
class: "color-panel",
|
|
456
|
+
onClick: this.handlePanelClick,
|
|
457
|
+
ref: (t) => {
|
|
458
|
+
this.colorPanel = t;
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
/* @__PURE__ */ i("div", { class: "color-grid" }, this.hasCustomPicker ? this.renderCustomPicker() : null, this.renderColorButtons())
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* 渲染自定义颜色选择器 - 真正的JSX!
|
|
466
|
+
*/
|
|
467
|
+
renderCustomPicker() {
|
|
468
|
+
return /* @__PURE__ */ i(
|
|
469
|
+
"xy-button",
|
|
470
|
+
{
|
|
471
|
+
type: "button",
|
|
472
|
+
class: "color-cube custom-picker",
|
|
473
|
+
style: { backgroundColor: this.customColor },
|
|
474
|
+
onClick: this.handleCustomPickerClick,
|
|
475
|
+
title: "自定义颜色"
|
|
476
|
+
}
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* 渲染颜色按钮组 - 真正的JSX!
|
|
481
|
+
*/
|
|
482
|
+
renderColorButtons() {
|
|
483
|
+
return this.colorCollections.map((t) => /* @__PURE__ */ i(
|
|
484
|
+
"xy-button",
|
|
485
|
+
{
|
|
486
|
+
key: t,
|
|
487
|
+
type: "button",
|
|
488
|
+
class: "color-cube",
|
|
489
|
+
style: `background-color: ${t}`,
|
|
490
|
+
"data-color": t,
|
|
491
|
+
title: t,
|
|
492
|
+
onClick: () => this.handleColorSelect(t)
|
|
493
|
+
}
|
|
494
|
+
));
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* 切换面板显示状态
|
|
498
|
+
*/
|
|
499
|
+
togglePanel() {
|
|
500
|
+
this.setOpen(!this.isOpen);
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* 关闭面板
|
|
504
|
+
*/
|
|
505
|
+
closePanel() {
|
|
506
|
+
this.setOpen(!1);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* 设置选中的颜色
|
|
510
|
+
*/
|
|
511
|
+
setSelectedColor(t) {
|
|
512
|
+
this.selectedColor = t, this.setAttr("selected-color", t), this.updateColorButton();
|
|
513
|
+
}
|
|
514
|
+
/**
|
|
515
|
+
* 设置自定义颜色
|
|
516
|
+
*/
|
|
517
|
+
setCustomColor(t) {
|
|
518
|
+
this.customColor = t, Ce(t, this.pluginType);
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* 设置面板开关状态
|
|
522
|
+
*/
|
|
523
|
+
setOpen(t) {
|
|
524
|
+
this.isOpen = t, t ? this.setAttr("open", "") : this.removeAttr("open"), this.rerender();
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* 更新颜色按钮样式
|
|
528
|
+
*/
|
|
529
|
+
updateColorButton() {
|
|
530
|
+
this.colorBtn && this.colorBtn.style.setProperty("--theme-color", this.selectedColor);
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* 组件连接到DOM后的初始化
|
|
534
|
+
*/
|
|
535
|
+
onConnected() {
|
|
536
|
+
document.addEventListener("click", this.handleDocumentClick), k.info("ColorPicker connected to DOM");
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* 组件从DOM断开时的清理
|
|
540
|
+
*/
|
|
541
|
+
onDisconnected() {
|
|
542
|
+
document.removeEventListener("click", this.handleDocumentClick), k.info("ColorPicker disconnected from DOM");
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* 属性变化处理
|
|
546
|
+
*/
|
|
547
|
+
onAttributeChanged(t, o, s) {
|
|
548
|
+
switch (t) {
|
|
549
|
+
case "disabled":
|
|
550
|
+
this.disabled = s !== null, this.rerender();
|
|
551
|
+
break;
|
|
552
|
+
case "selected-color":
|
|
553
|
+
s && s !== this.selectedColor && (this.selectedColor = s, this.updateColorButton());
|
|
554
|
+
break;
|
|
555
|
+
case "open":
|
|
556
|
+
this.isOpen = s !== null;
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* 公共API:获取当前选中的颜色
|
|
562
|
+
*/
|
|
563
|
+
getSelectedColor() {
|
|
564
|
+
return this.selectedColor;
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* 公共API:设置颜色
|
|
568
|
+
*/
|
|
569
|
+
setColor(t) {
|
|
570
|
+
this.setSelectedColor(w(t));
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* 公共API:聚焦组件
|
|
574
|
+
*/
|
|
575
|
+
focus() {
|
|
576
|
+
var t;
|
|
577
|
+
(t = this.colorBtn) == null || t.focus();
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
G = Ee(_t);
|
|
581
|
+
O = Ie(G, 0, "ColorPicker", xt, O);
|
|
582
|
+
Oe(G, 1, O);
|
|
583
|
+
const Be = ".reactive-counter{max-width:500px;margin:20px auto;padding:24px;border-radius:12px;box-shadow:0 4px 12px #0000001a;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;transition:all .3s ease}.theme-light{background:#fff;color:#333;border:1px solid #e1e5e9}.theme-dark{background:#1a1a1a;color:#fff;border:1px solid #333333}.theme-blue{background:linear-gradient(135deg,#667eea,#764ba2);color:#fff;border:1px solid #5a67d8}.header{text-align:center;margin-bottom:24px}.header h3{margin:0 0 8px;font-size:24px;font-weight:600}.subtitle{margin:0;opacity:.8;font-size:14px}.counter-display{text-align:center;margin-bottom:32px}.count-value{font-size:48px;font-weight:700;line-height:1;margin-bottom:8px;font-variant-numeric:tabular-nums}.step-info{font-size:14px;opacity:.7}.controls{display:flex;gap:12px;justify-content:center;margin-bottom:24px;flex-wrap:wrap}.btn{padding:10px 20px;border:none;border-radius:8px;font-size:16px;font-weight:500;cursor:pointer;transition:all .2s ease;min-width:60px}.btn:disabled{opacity:.5;cursor:not-allowed}.btn-primary{background:#4299e1;color:#fff}.btn-primary:hover:not(:disabled){background:#3182ce;transform:translateY(-1px)}.btn-secondary{background:#718096;color:#fff}.btn-secondary:hover:not(:disabled){background:#4a5568;transform:translateY(-1px)}.btn-warning{background:#ed8936;color:#fff}.btn-warning:hover:not(:disabled){background:#dd6b20;transform:translateY(-1px)}.btn-success{background:#48bb78;color:#fff}.btn-success:hover:not(:disabled){background:#38a169;transform:translateY(-1px)}.btn-danger{background:#f56565;color:#fff}.btn-danger:hover:not(:disabled){background:#e53e3e;transform:translateY(-1px)}.btn-sm{padding:6px 12px;font-size:14px;min-width:auto}.step-controls,.auto-controls,.theme-controls,.message-controls{margin-bottom:20px;text-align:center}.step-controls label{display:flex;align-items:center;justify-content:center;gap:12px;font-size:14px}.step-controls input[type=range]{flex:0 0 150px}.step-controls span{font-weight:700;min-width:20px}.theme-controls select,.message-controls input{padding:8px 12px;border:1px solid #cbd5e0;border-radius:6px;font-size:14px;margin-left:8px}.theme-dark .theme-controls select,.theme-dark .message-controls input{background:#2d3748;border-color:#4a5568;color:#fff}.theme-blue .theme-controls select,.theme-blue .message-controls input{background:#ffffff1a;border-color:#fff3;color:#fff}.message-controls input{width:250px;max-width:100%}.history{margin-top:24px;padding:16px;background:#0000000d;border-radius:8px}.theme-dark .history{background:#ffffff0d}.theme-blue .history{background:#ffffff1a}.history h4{margin:0 0 12px;font-size:16px}.history-list{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}.history-item{padding:4px 8px;background:#4299e11a;border:1px solid rgba(66,153,225,.2);border-radius:4px;font-size:12px;font-weight:500}.debug-info{margin-top:24px;font-size:12px}.debug-info details{border:1px solid #e2e8f0;border-radius:6px;padding:8px}.theme-dark .debug-info details{border-color:#4a5568}.theme-blue .debug-info details{border-color:#fff3}.debug-info summary{cursor:pointer;font-weight:500;margin-bottom:8px}.debug-info pre{margin:0;padding:8px;background:#0000000d;border-radius:4px;overflow-x:auto;font-size:11px;line-height:1.4}.theme-dark .debug-info pre{background:#ffffff0d}.theme-blue .debug-info pre{background:#ffffff1a}@media (max-width: 600px){.reactive-counter{margin:10px;padding:16px}.count-value{font-size:36px}.controls{flex-direction:column;align-items:center}.btn{width:200px}.step-controls label{flex-direction:column;gap:8px}.message-controls input{width:100%}}";
|
|
584
|
+
var Me = Object.create, Y = Object.defineProperty, Re = Object.getOwnPropertyDescriptor, yt = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), kt = (e) => {
|
|
585
|
+
throw TypeError(e);
|
|
586
|
+
}, Ct = (e, t, o) => t in e ? Y(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, Le = (e, t) => Y(e, "name", { value: t, configurable: !0 }), Ne = (e) => [, , , Me((e == null ? void 0 : e[yt("metadata")]) ?? null)], He = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], wt = (e) => e !== void 0 && typeof e != "function" ? kt("Function expected") : e, je = (e, t, o, s, r) => ({ kind: He[e], name: t, metadata: s, addInitializer: (n) => o._ ? kt("Already initialized") : r.push(wt(n || null)) }), We = (e, t) => Ct(t, yt("metadata"), e[3]), Ge = (e, t, o, s) => {
|
|
587
|
+
for (var r = 0, n = e[t >> 1], a = n && n.length; r < a; r++) n[r].call(o);
|
|
588
|
+
return s;
|
|
589
|
+
}, Ye = (e, t, o, s, r, n) => {
|
|
590
|
+
var a, h, u, l = t & 7, p = !1, m = 0, g = e[m] || (e[m] = []), c = l && (r = r.prototype, l < 5 && (l > 3 || !p) && Re(r, o));
|
|
591
|
+
Le(r, o);
|
|
592
|
+
for (var d = s.length - 1; d >= 0; d--)
|
|
593
|
+
u = je(l, o, h = {}, e[3], g), a = (0, s[d])(r, u), h._ = 1, wt(a) && (r = a);
|
|
594
|
+
return We(e, r), c && Y(r, o, c), p ? l ^ 4 ? n : c : r;
|
|
595
|
+
}, v = (e, t, o) => Ct(e, typeof t != "symbol" ? t + "" : t, o), $t, X, St;
|
|
596
|
+
const z = C("ReactiveCounter");
|
|
597
|
+
$t = [x({ tagName: "reactive-counter" })];
|
|
598
|
+
class I extends (St = ot) {
|
|
599
|
+
constructor() {
|
|
600
|
+
super({
|
|
601
|
+
styles: Be,
|
|
602
|
+
debug: !0
|
|
603
|
+
// 启用调试模式
|
|
604
|
+
}), v(this, "state", this.reactive({
|
|
605
|
+
count: 0,
|
|
606
|
+
step: 1,
|
|
607
|
+
message: "Hello WSX Reactive!",
|
|
608
|
+
isRunning: !1
|
|
609
|
+
})), v(this, "themeState", this.useState("theme", "light")), v(this, "historyState", this.useState("history", [])), v(this, "getTheme", this.themeState[0]), v(this, "setTheme", this.themeState[1]), v(this, "getHistory", this.historyState[0]), v(this, "setHistory", this.historyState[1]), v(this, "increment", () => {
|
|
610
|
+
this.state.count += this.state.step, this.addToHistory(this.state.count);
|
|
611
|
+
}), v(this, "decrement", () => {
|
|
612
|
+
this.state.count -= this.state.step, this.addToHistory(this.state.count);
|
|
613
|
+
}), v(this, "reset", () => {
|
|
614
|
+
this.state.count = 0, this.addToHistory(0);
|
|
615
|
+
}), v(this, "handleStepChange", (t) => {
|
|
616
|
+
const o = t.target;
|
|
617
|
+
this.state.step = parseInt(o.value);
|
|
618
|
+
}), v(this, "handleThemeChange", (t) => {
|
|
619
|
+
const o = t.target;
|
|
620
|
+
this.setTheme(o.value);
|
|
621
|
+
}), v(this, "handleMessageChange", (t) => {
|
|
622
|
+
const o = t.target;
|
|
623
|
+
this.state.message = o.value;
|
|
624
|
+
}), v(this, "toggleAutoIncrement", () => {
|
|
625
|
+
this.state.isRunning = !this.state.isRunning, this.state.isRunning && this.startAutoIncrement();
|
|
626
|
+
}), v(this, "clearHistory", () => {
|
|
627
|
+
this.setHistory([]);
|
|
628
|
+
}), z.info("ReactiveCounter initialized");
|
|
629
|
+
}
|
|
630
|
+
render() {
|
|
631
|
+
const t = this.getTheme(), o = this.getHistory();
|
|
632
|
+
return /* @__PURE__ */ i("div", { class: `reactive-counter theme-${t}` }, /* @__PURE__ */ i("div", { class: "header" }, /* @__PURE__ */ i("h3", null, "🔄 Reactive Counter"), /* @__PURE__ */ i("p", { class: "subtitle" }, this.state.message)), /* @__PURE__ */ i("div", { class: "counter-display" }, /* @__PURE__ */ i("div", { class: "count-value" }, this.state.count), /* @__PURE__ */ i("div", { class: "step-info" }, "Step: ", this.state.step)), /* @__PURE__ */ i("div", { class: "controls" }, /* @__PURE__ */ i(
|
|
633
|
+
"button",
|
|
634
|
+
{
|
|
635
|
+
class: "btn btn-primary",
|
|
636
|
+
onClick: this.increment,
|
|
637
|
+
disabled: this.state.isRunning
|
|
638
|
+
},
|
|
639
|
+
"+",
|
|
640
|
+
this.state.step
|
|
641
|
+
), /* @__PURE__ */ i(
|
|
642
|
+
"button",
|
|
643
|
+
{
|
|
644
|
+
class: "btn btn-secondary",
|
|
645
|
+
onClick: this.decrement,
|
|
646
|
+
disabled: this.state.isRunning
|
|
647
|
+
},
|
|
648
|
+
"-",
|
|
649
|
+
this.state.step
|
|
650
|
+
), /* @__PURE__ */ i(
|
|
651
|
+
"button",
|
|
652
|
+
{
|
|
653
|
+
class: "btn btn-warning",
|
|
654
|
+
onClick: this.reset,
|
|
655
|
+
disabled: this.state.isRunning
|
|
656
|
+
},
|
|
657
|
+
"Reset"
|
|
658
|
+
)), /* @__PURE__ */ i("div", { class: "step-controls" }, /* @__PURE__ */ i("label", null, "Step Size:", /* @__PURE__ */ i(
|
|
659
|
+
"input",
|
|
660
|
+
{
|
|
661
|
+
type: "range",
|
|
662
|
+
min: "1",
|
|
663
|
+
max: "10",
|
|
664
|
+
value: this.state.step,
|
|
665
|
+
onInput: this.handleStepChange
|
|
666
|
+
}
|
|
667
|
+
), /* @__PURE__ */ i("span", null, this.state.step))), /* @__PURE__ */ i("div", { class: "auto-controls" }, /* @__PURE__ */ i(
|
|
668
|
+
"button",
|
|
669
|
+
{
|
|
670
|
+
class: `btn ${this.state.isRunning ? "btn-danger" : "btn-success"}`,
|
|
671
|
+
onClick: this.toggleAutoIncrement
|
|
672
|
+
},
|
|
673
|
+
this.state.isRunning ? "Stop" : "Start",
|
|
674
|
+
" Auto Increment"
|
|
675
|
+
)), /* @__PURE__ */ i("div", { class: "theme-controls" }, /* @__PURE__ */ i("label", null, "Theme:", /* @__PURE__ */ i("select", { value: t, onChange: this.handleThemeChange }, /* @__PURE__ */ i("option", { value: "light" }, "Light"), /* @__PURE__ */ i("option", { value: "dark" }, "Dark"), /* @__PURE__ */ i("option", { value: "blue" }, "Blue")))), /* @__PURE__ */ i("div", { class: "message-controls" }, /* @__PURE__ */ i(
|
|
676
|
+
"input",
|
|
677
|
+
{
|
|
678
|
+
type: "text",
|
|
679
|
+
value: this.state.message,
|
|
680
|
+
onInput: this.handleMessageChange,
|
|
681
|
+
placeholder: "Enter a message..."
|
|
682
|
+
}
|
|
683
|
+
)), o.length > 0 && /* @__PURE__ */ i("div", { class: "history" }, /* @__PURE__ */ i("h4", null, "History (last 10):"), /* @__PURE__ */ i("div", { class: "history-list" }, o.slice(-10).map((s, r) => /* @__PURE__ */ i("span", { key: r, class: "history-item" }, s))), /* @__PURE__ */ i("button", { class: "btn btn-sm", onClick: this.clearHistory }, "Clear History")), /* @__PURE__ */ i("div", { class: "debug-info" }, /* @__PURE__ */ i("details", null, /* @__PURE__ */ i("summary", null, "Debug Info"), /* @__PURE__ */ i("pre", null, JSON.stringify(
|
|
684
|
+
{
|
|
685
|
+
state: this.state,
|
|
686
|
+
theme: this.getTheme(),
|
|
687
|
+
historyLength: this.getHistory().length,
|
|
688
|
+
stateSnapshot: this.getStateSnapshot()
|
|
689
|
+
},
|
|
690
|
+
null,
|
|
691
|
+
2
|
|
692
|
+
)))));
|
|
693
|
+
}
|
|
694
|
+
startAutoIncrement() {
|
|
695
|
+
const t = setInterval(() => {
|
|
696
|
+
if (!this.state.isRunning) {
|
|
697
|
+
clearInterval(t);
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
this.increment(), this.state.count % 5 === 0 && (this.state.message = `Count reached ${this.state.count}!`);
|
|
701
|
+
}, 200);
|
|
702
|
+
}
|
|
703
|
+
addToHistory(t) {
|
|
704
|
+
const o = this.getHistory();
|
|
705
|
+
this.setHistory([...o, t]);
|
|
706
|
+
}
|
|
707
|
+
onConnected() {
|
|
708
|
+
z.info("ReactiveCounter connected to DOM"), setTimeout(() => {
|
|
709
|
+
this.state.message = "Ready to count! 🚀";
|
|
710
|
+
}, 500);
|
|
711
|
+
}
|
|
712
|
+
onDisconnected() {
|
|
713
|
+
z.info("ReactiveCounter disconnected from DOM"), this.state.isRunning = !1;
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
X = Ne(St);
|
|
717
|
+
I = Ye(X, 0, "ReactiveCounter", $t, I);
|
|
718
|
+
Ge(X, 1, I);
|
|
719
|
+
const Xe = ":host{display:block}.theme-switcher-container{position:relative;display:flex;align-items:center}.theme-switcher-btn{width:var(--theme-switcher-width, 2.5rem);height:var(--theme-switcher-height, 2.5rem);padding:var(--theme-switcher-padding, .5rem);border-radius:var(--theme-switcher-border-radius, 8px);background:var(--theme-switcher-bg, #dc2626);border:var(--theme-switcher-border, none);color:var(--theme-switcher-color, white);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all var(--theme-switcher-transition, .3s ease);box-shadow:var(--theme-switcher-shadow, 0 4px 15px rgba(220, 38, 38, .4));font-weight:var(--theme-switcher-font-weight, 600);font-family:var(--theme-switcher-font-family, inherit)}.theme-switcher-btn:hover{background:var(--theme-switcher-hover-bg, #b91c1c);transform:var(--theme-switcher-hover-transform, translateY(-2px));box-shadow:var(--theme-switcher-hover-shadow, 0 8px 25px rgba(220, 38, 38, .5))}.theme-switcher-btn:active{transform:var(--theme-switcher-active-transform, translateY(0))}.theme-switcher-icon{font-size:var(--theme-switcher-icon-size, 1rem);line-height:1;transition:transform var(--theme-switcher-icon-transition, .3s ease)}.theme-switcher-btn:hover .theme-switcher-icon{transform:var(--theme-switcher-icon-hover-transform, rotate(360deg))}.theme-switcher-btn[data-theme=light]{background:var(--theme-switcher-light-bg, #dc2626);color:var(--theme-switcher-light-color, white)}.theme-switcher-btn[data-theme=light]:hover{background:var(--theme-switcher-light-hover-bg, #b91c1c)}.theme-switcher-btn[data-theme=dark]{background:var(--theme-switcher-dark-bg, #dc2626);color:var(--theme-switcher-dark-color, white)}.theme-switcher-btn[data-theme=dark]:hover{background:var(--theme-switcher-dark-hover-bg, #b91c1c)}.theme-switcher-btn[data-theme=auto]{background:var(--theme-switcher-auto-bg, linear-gradient(135deg, #dc2626, #b91c1c));color:var(--theme-switcher-auto-color, white)}.theme-switcher-btn[data-theme=auto]:hover{background:var(--theme-switcher-auto-hover-bg, linear-gradient(135deg, #b91c1c, #991b1b))}@media (max-width: 768px){.theme-switcher-btn{width:var(--theme-switcher-mobile-width, 2rem);height:var(--theme-switcher-mobile-height, 2rem)}.theme-switcher-icon{font-size:var(--theme-switcher-mobile-icon-size, .9rem)}}";
|
|
720
|
+
var qe = Object.create, q = Object.defineProperty, Je = Object.getOwnPropertyDescriptor, zt = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), At = (e) => {
|
|
721
|
+
throw TypeError(e);
|
|
722
|
+
}, Et = (e, t, o) => t in e ? q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, Ke = (e, t) => q(e, "name", { value: t, configurable: !0 }), Ue = (e) => [, , , qe((e == null ? void 0 : e[zt("metadata")]) ?? null)], Qe = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Pt = (e) => e !== void 0 && typeof e != "function" ? At("Function expected") : e, Ve = (e, t, o, s, r) => ({ kind: Qe[e], name: t, metadata: s, addInitializer: (n) => o._ ? At("Already initialized") : r.push(Pt(n || null)) }), Ze = (e, t) => Et(t, zt("metadata"), e[3]), to = (e, t, o, s) => {
|
|
723
|
+
for (var r = 0, n = e[t >> 1], a = n && n.length; r < a; r++) n[r].call(o);
|
|
724
|
+
return s;
|
|
725
|
+
}, eo = (e, t, o, s, r, n) => {
|
|
726
|
+
var a, h, u, l = t & 7, p = !1, m = 0, g = e[m] || (e[m] = []), c = l && (r = r.prototype, l < 5 && (l > 3 || !p) && Je(r, o));
|
|
727
|
+
Ke(r, o);
|
|
728
|
+
for (var d = s.length - 1; d >= 0; d--)
|
|
729
|
+
u = Ve(l, o, h = {}, e[3], g), a = (0, s[d])(r, u), h._ = 1, Pt(a) && (r = a);
|
|
730
|
+
return Ze(e, r), c && q(r, o, c), p ? l ^ 4 ? n : c : r;
|
|
731
|
+
}, et = (e, t, o) => Et(e, typeof t != "symbol" ? t + "" : t, o), Dt, J, Tt;
|
|
732
|
+
Dt = [x({ tagName: "theme-switcher" })];
|
|
733
|
+
class F extends (Tt = y) {
|
|
734
|
+
constructor() {
|
|
735
|
+
super({
|
|
736
|
+
styles: Xe,
|
|
737
|
+
styleName: "theme-switcher"
|
|
738
|
+
}), et(this, "currentTheme", "auto"), et(this, "toggleTheme", () => {
|
|
739
|
+
const t = ["auto", "light", "dark"], s = (t.indexOf(this.currentTheme) + 1) % t.length;
|
|
740
|
+
this.setTheme(t[s]);
|
|
741
|
+
}), this.initTheme();
|
|
742
|
+
}
|
|
743
|
+
render() {
|
|
744
|
+
return /* @__PURE__ */ i("div", { class: "theme-switcher-container" }, /* @__PURE__ */ i(
|
|
745
|
+
"button",
|
|
746
|
+
{
|
|
747
|
+
class: "theme-switcher-btn",
|
|
748
|
+
"data-theme": this.currentTheme,
|
|
749
|
+
onClick: this.toggleTheme,
|
|
750
|
+
title: `当前主题: ${this.getThemeLabel()}`
|
|
751
|
+
},
|
|
752
|
+
/* @__PURE__ */ i("span", { class: "theme-switcher-icon" }, this.getThemeIcon())
|
|
753
|
+
));
|
|
754
|
+
}
|
|
755
|
+
getThemeIcon() {
|
|
756
|
+
const o = document.documentElement.classList.contains("dark");
|
|
757
|
+
return this.currentTheme === "auto" ? o ? "🌙" : "☀️" : this.currentTheme === "light" ? "☀️" : "🌙";
|
|
758
|
+
}
|
|
759
|
+
getThemeLabel() {
|
|
760
|
+
return {
|
|
761
|
+
light: "浅色",
|
|
762
|
+
dark: "深色",
|
|
763
|
+
auto: "自动"
|
|
764
|
+
}[this.currentTheme];
|
|
765
|
+
}
|
|
766
|
+
setTheme(t) {
|
|
767
|
+
this.currentTheme = t;
|
|
768
|
+
const o = document.documentElement;
|
|
769
|
+
t === "auto" ? (o.removeAttribute("class"), this.checkSystemTheme()) : o.className = t, localStorage.setItem("wsx-theme", t), this.rerender();
|
|
770
|
+
}
|
|
771
|
+
checkSystemTheme() {
|
|
772
|
+
const t = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
773
|
+
document.documentElement.className = t ? "dark" : "";
|
|
774
|
+
}
|
|
775
|
+
initTheme() {
|
|
776
|
+
const t = localStorage.getItem("wsx-theme") || "auto";
|
|
777
|
+
this.setTheme(t), window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", (o) => {
|
|
778
|
+
this.currentTheme === "auto" && (document.documentElement.className = o.matches ? "dark" : "");
|
|
779
|
+
});
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
J = Ue(Tt);
|
|
783
|
+
F = eo(J, 0, "ThemeSwitcher", Dt, F);
|
|
784
|
+
to(J, 1, F);
|
|
785
|
+
var oo = Object.create, K = Object.defineProperty, ro = Object.getOwnPropertyDescriptor, Ot = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), It = (e) => {
|
|
786
|
+
throw TypeError(e);
|
|
787
|
+
}, Ft = (e, t, o) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, io = (e, t) => K(e, "name", { value: t, configurable: !0 }), so = (e) => [, , , oo((e == null ? void 0 : e[Ot("metadata")]) ?? null)], no = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Bt = (e) => e !== void 0 && typeof e != "function" ? It("Function expected") : e, ao = (e, t, o, s, r) => ({ kind: no[e], name: t, metadata: s, addInitializer: (n) => o._ ? It("Already initialized") : r.push(Bt(n || null)) }), lo = (e, t) => Ft(t, Ot("metadata"), e[3]), co = (e, t, o, s) => {
|
|
788
|
+
for (var r = 0, n = e[t >> 1], a = n && n.length; r < a; r++) n[r].call(o);
|
|
789
|
+
return s;
|
|
790
|
+
}, ho = (e, t, o, s, r, n) => {
|
|
791
|
+
var a, h, u, l = t & 7, p = !1, m = 0, g = e[m] || (e[m] = []), c = l && (r = r.prototype, l < 5 && (l > 3 || !p) && ro(r, o));
|
|
792
|
+
io(r, o);
|
|
793
|
+
for (var d = s.length - 1; d >= 0; d--)
|
|
794
|
+
u = ao(l, o, h = {}, e[3], g), a = (0, s[d])(r, u), h._ = 1, Bt(a) && (r = a);
|
|
795
|
+
return lo(e, r), c && K(r, o, c), p ? l ^ 4 ? n : c : r;
|
|
796
|
+
}, A = (e, t, o) => Ft(e, typeof t != "symbol" ? t + "" : t, o), Mt, U, Rt;
|
|
797
|
+
const E = C("SvgIcon");
|
|
798
|
+
Mt = [x({ tagName: "svg-icon" })];
|
|
799
|
+
class B extends (Rt = y) {
|
|
800
|
+
constructor() {
|
|
801
|
+
super(), A(this, "handleClick", (t) => {
|
|
802
|
+
E.debug("SVG icon clicked", { name: this.getAttribute("name") }), this.dispatchEvent(
|
|
803
|
+
new CustomEvent("icon-click", {
|
|
804
|
+
detail: {
|
|
805
|
+
name: this.getAttribute("name"),
|
|
806
|
+
originalEvent: t
|
|
807
|
+
},
|
|
808
|
+
bubbles: !0
|
|
809
|
+
})
|
|
810
|
+
);
|
|
811
|
+
}), A(this, "handleMouseEnter", (t) => {
|
|
812
|
+
const o = t.target;
|
|
813
|
+
o.style.transform = "scale(1.1)";
|
|
814
|
+
}), A(this, "handleMouseLeave", (t) => {
|
|
815
|
+
const o = t.target;
|
|
816
|
+
o.style.transform = "scale(1)";
|
|
817
|
+
}), E.info("SvgIcon component initialized");
|
|
818
|
+
}
|
|
819
|
+
render() {
|
|
820
|
+
const t = this.getAttribute("size") || "24", o = this.getAttribute("color") || "currentColor", s = this.getAttribute("name") || "star", r = {
|
|
821
|
+
star: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",
|
|
822
|
+
heart: "M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z",
|
|
823
|
+
check: "M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z",
|
|
824
|
+
close: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",
|
|
825
|
+
github: "M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22",
|
|
826
|
+
play: "M8 5v14l11-7z",
|
|
827
|
+
settings: "M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1 1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"
|
|
828
|
+
}, n = r[s] || r.star;
|
|
829
|
+
return /* @__PURE__ */ i(
|
|
830
|
+
"svg",
|
|
831
|
+
{
|
|
832
|
+
width: t,
|
|
833
|
+
height: t,
|
|
834
|
+
viewBox: "0 0 24 24",
|
|
835
|
+
fill: "none",
|
|
836
|
+
stroke: o,
|
|
837
|
+
strokeWidth: "2",
|
|
838
|
+
strokeLinecap: "round",
|
|
839
|
+
strokeLinejoin: "round",
|
|
840
|
+
className: "svg-icon",
|
|
841
|
+
onClick: this.handleClick,
|
|
842
|
+
style: "cursor: pointer; transition: transform 0.2s ease; display: inline-block;",
|
|
843
|
+
onMouseEnter: this.handleMouseEnter,
|
|
844
|
+
onMouseLeave: this.handleMouseLeave
|
|
845
|
+
},
|
|
846
|
+
/* @__PURE__ */ i("path", { d: n, fill: o })
|
|
847
|
+
);
|
|
848
|
+
}
|
|
849
|
+
static get observedAttributes() {
|
|
850
|
+
return ["name", "size", "color"];
|
|
851
|
+
}
|
|
852
|
+
onAttributeChanged(t, o, s) {
|
|
853
|
+
E.debug(`Attribute ${t} changed from ${o} to ${s}`), this.connected && this.rerender();
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
U = so(Rt);
|
|
857
|
+
B = ho(U, 0, "SvgIcon", Mt, B);
|
|
858
|
+
co(U, 1, B);
|
|
859
|
+
var uo = Object.create, Q = Object.defineProperty, po = Object.getOwnPropertyDescriptor, Lt = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), Nt = (e) => {
|
|
860
|
+
throw TypeError(e);
|
|
861
|
+
}, Ht = (e, t, o) => t in e ? Q(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, mo = (e, t) => Q(e, "name", { value: t, configurable: !0 }), bo = (e) => [, , , uo((e == null ? void 0 : e[Lt("metadata")]) ?? null)], go = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], jt = (e) => e !== void 0 && typeof e != "function" ? Nt("Function expected") : e, fo = (e, t, o, s, r) => ({ kind: go[e], name: t, metadata: s, addInitializer: (n) => o._ ? Nt("Already initialized") : r.push(jt(n || null)) }), vo = (e, t) => Ht(t, Lt("metadata"), e[3]), xo = (e, t, o, s) => {
|
|
862
|
+
for (var r = 0, n = e[t >> 1], a = n && n.length; r < a; r++) n[r].call(o);
|
|
863
|
+
return s;
|
|
864
|
+
}, _o = (e, t, o, s, r, n) => {
|
|
865
|
+
var a, h, u, l = t & 7, p = !1, m = 0, g = e[m] || (e[m] = []), c = l && (r = r.prototype, l < 5 && (l > 3 || !p) && po(r, o));
|
|
866
|
+
mo(r, o);
|
|
867
|
+
for (var d = s.length - 1; d >= 0; d--)
|
|
868
|
+
u = fo(l, o, h = {}, e[3], g), a = (0, s[d])(r, u), h._ = 1, jt(a) && (r = a);
|
|
869
|
+
return vo(e, r), c && Q(r, o, c), p ? l ^ 4 ? n : c : r;
|
|
870
|
+
}, _ = (e, t, o) => Ht(e, typeof t != "symbol" ? t + "" : t, o), Wt, V, Gt;
|
|
871
|
+
const $ = C("SvgDemo");
|
|
872
|
+
Wt = [x({ tagName: "svg-demo" })];
|
|
873
|
+
class M extends (Gt = y) {
|
|
874
|
+
constructor() {
|
|
875
|
+
super(), _(this, "animationId", null), _(this, "rotationAngle", 0), _(this, "showTooltip", (t, o) => {
|
|
876
|
+
t.target.setAttribute("fill", "#e74c3c"), $.debug(`Tooltip value: ${o}`);
|
|
877
|
+
}), _(this, "hideTooltip", (t) => {
|
|
878
|
+
t.target.setAttribute("fill", "#3498db");
|
|
879
|
+
}), _(this, "startAnimation", () => {
|
|
880
|
+
if (this.animationId) return;
|
|
881
|
+
const t = () => {
|
|
882
|
+
this.rotationAngle += 2, this.rotationAngle >= 360 && (this.rotationAngle = 0), this.rerender(), this.animationId = requestAnimationFrame(t);
|
|
883
|
+
};
|
|
884
|
+
this.animationId = requestAnimationFrame(t);
|
|
885
|
+
}), _(this, "stopAnimation", () => {
|
|
886
|
+
this.animationId && (cancelAnimationFrame(this.animationId), this.animationId = null);
|
|
887
|
+
}), $.info("SvgDemo component initialized");
|
|
888
|
+
}
|
|
889
|
+
render() {
|
|
890
|
+
return /* @__PURE__ */ i("div", { style: "padding: 20px; background: #f5f5f5; border-radius: 8px; margin: 10px 0;" }, /* @__PURE__ */ i("h3", { style: "margin-top: 0; color: #333;" }, "SVG Showcase"), /* @__PURE__ */ i("div", { style: "margin-bottom: 20px;" }, /* @__PURE__ */ i("h4", { style: "margin: 10px 0; color: #666;" }, "Basic Shapes"), /* @__PURE__ */ i(
|
|
891
|
+
"svg",
|
|
892
|
+
{
|
|
893
|
+
width: "300",
|
|
894
|
+
height: "100",
|
|
895
|
+
style: "border: 1px solid #ddd; background: white;"
|
|
896
|
+
},
|
|
897
|
+
/* @__PURE__ */ i(
|
|
898
|
+
"circle",
|
|
899
|
+
{
|
|
900
|
+
cx: "50",
|
|
901
|
+
cy: "50",
|
|
902
|
+
r: "30",
|
|
903
|
+
fill: "#e74c3c",
|
|
904
|
+
stroke: "#c0392b",
|
|
905
|
+
strokeWidth: "2"
|
|
906
|
+
}
|
|
907
|
+
),
|
|
908
|
+
/* @__PURE__ */ i(
|
|
909
|
+
"rect",
|
|
910
|
+
{
|
|
911
|
+
x: "100",
|
|
912
|
+
y: "20",
|
|
913
|
+
width: "60",
|
|
914
|
+
height: "60",
|
|
915
|
+
fill: "#3498db",
|
|
916
|
+
stroke: "#2980b9",
|
|
917
|
+
strokeWidth: "2",
|
|
918
|
+
rx: "5"
|
|
919
|
+
}
|
|
920
|
+
),
|
|
921
|
+
/* @__PURE__ */ i(
|
|
922
|
+
"polygon",
|
|
923
|
+
{
|
|
924
|
+
points: "200,20 230,80 170,80",
|
|
925
|
+
fill: "#2ecc71",
|
|
926
|
+
stroke: "#27ae60",
|
|
927
|
+
strokeWidth: "2"
|
|
928
|
+
}
|
|
929
|
+
),
|
|
930
|
+
/* @__PURE__ */ i(
|
|
931
|
+
"line",
|
|
932
|
+
{
|
|
933
|
+
x1: "250",
|
|
934
|
+
y1: "20",
|
|
935
|
+
x2: "290",
|
|
936
|
+
y2: "80",
|
|
937
|
+
stroke: "#9b59b6",
|
|
938
|
+
strokeWidth: "3",
|
|
939
|
+
strokeLinecap: "round"
|
|
940
|
+
}
|
|
941
|
+
)
|
|
942
|
+
)), /* @__PURE__ */ i("div", { style: "margin-bottom: 20px;" }, /* @__PURE__ */ i("h4", { style: "margin: 10px 0; color: #666;" }, "Gradients & Effects"), /* @__PURE__ */ i(
|
|
943
|
+
"svg",
|
|
944
|
+
{
|
|
945
|
+
width: "300",
|
|
946
|
+
height: "100",
|
|
947
|
+
style: "border: 1px solid #ddd; background: white;"
|
|
948
|
+
},
|
|
949
|
+
/* @__PURE__ */ i("defs", null, /* @__PURE__ */ i("linearGradient", { id: "blueGradient", x1: "0%", y1: "0%", x2: "100%", y2: "0%" }, /* @__PURE__ */ i("stop", { offset: "0%", stopColor: "#3498db" }), /* @__PURE__ */ i("stop", { offset: "100%", stopColor: "#9b59b6" })), /* @__PURE__ */ i("radialGradient", { id: "redGradient", cx: "50%", cy: "50%", r: "50%" }, /* @__PURE__ */ i("stop", { offset: "0%", stopColor: "#e74c3c" }), /* @__PURE__ */ i("stop", { offset: "100%", stopColor: "#c0392b" }))),
|
|
950
|
+
/* @__PURE__ */ i(
|
|
951
|
+
"rect",
|
|
952
|
+
{
|
|
953
|
+
x: "20",
|
|
954
|
+
y: "20",
|
|
955
|
+
width: "120",
|
|
956
|
+
height: "60",
|
|
957
|
+
fill: "url(#blueGradient)",
|
|
958
|
+
rx: "10"
|
|
959
|
+
}
|
|
960
|
+
),
|
|
961
|
+
/* @__PURE__ */ i("circle", { cx: "200", cy: "50", r: "35", fill: "url(#redGradient)" })
|
|
962
|
+
)), /* @__PURE__ */ i("div", { style: "margin-bottom: 20px;" }, /* @__PURE__ */ i("h4", { style: "margin: 10px 0; color: #666;" }, "Animation"), /* @__PURE__ */ i(
|
|
963
|
+
"svg",
|
|
964
|
+
{
|
|
965
|
+
width: "300",
|
|
966
|
+
height: "100",
|
|
967
|
+
style: "border: 1px solid #ddd; background: white;"
|
|
968
|
+
},
|
|
969
|
+
/* @__PURE__ */ i("g", { transform: `translate(150, 50) rotate(${this.rotationAngle})` }, /* @__PURE__ */ i(
|
|
970
|
+
"polygon",
|
|
971
|
+
{
|
|
972
|
+
points: "-30,0 0,-40 30,0 0,40",
|
|
973
|
+
fill: "#f39c12",
|
|
974
|
+
stroke: "#e67e22",
|
|
975
|
+
strokeWidth: "2"
|
|
976
|
+
}
|
|
977
|
+
), /* @__PURE__ */ i("circle", { cx: "0", cy: "0", r: "8", fill: "#2c3e50" }))
|
|
978
|
+
), /* @__PURE__ */ i("div", { style: "margin-top: 10px;" }, /* @__PURE__ */ i(
|
|
979
|
+
"button",
|
|
980
|
+
{
|
|
981
|
+
onClick: this.startAnimation,
|
|
982
|
+
style: "margin-right: 10px; padding: 5px 10px;"
|
|
983
|
+
},
|
|
984
|
+
"Start Animation"
|
|
985
|
+
), /* @__PURE__ */ i("button", { onClick: this.stopAnimation, style: "padding: 5px 10px;" }, "Stop Animation"))), /* @__PURE__ */ i("div", { style: "margin-bottom: 20px;" }, /* @__PURE__ */ i("h4", { style: "margin: 10px 0; color: #666;" }, "Interactive Chart"), this.renderChart()), /* @__PURE__ */ i("div", null, /* @__PURE__ */ i("h4", { style: "margin: 10px 0; color: #666;" }, "Icon Components"), /* @__PURE__ */ i("div", { style: "display: flex; gap: 15px; align-items: center;" }, /* @__PURE__ */ i("svg-icon", { name: "star", size: "32", color: "#f39c12" }), /* @__PURE__ */ i("svg-icon", { name: "heart", size: "32", color: "#e74c3c" }), /* @__PURE__ */ i("svg-icon", { name: "check", size: "32", color: "#27ae60" }), /* @__PURE__ */ i("svg-icon", { name: "github", size: "32", color: "#333" }), /* @__PURE__ */ i("svg-icon", { name: "play", size: "32", color: "#3498db" }), /* @__PURE__ */ i("svg-icon", { name: "settings", size: "32", color: "#9b59b6" }))));
|
|
986
|
+
}
|
|
987
|
+
renderChart() {
|
|
988
|
+
const t = [30, 80, 45, 60, 20, 90, 55], o = Math.max(...t), s = 30, r = 40, n = 120, a = t.length * r + 40;
|
|
989
|
+
return /* @__PURE__ */ i(
|
|
990
|
+
"svg",
|
|
991
|
+
{
|
|
992
|
+
width: a,
|
|
993
|
+
height: n + 40,
|
|
994
|
+
style: "border: 1px solid #ddd; background: white;"
|
|
995
|
+
},
|
|
996
|
+
t.map((h, u) => {
|
|
997
|
+
const l = h / o * n, p = u * r + 20, m = n - l + 20;
|
|
998
|
+
return /* @__PURE__ */ i("g", { key: u }, /* @__PURE__ */ i(
|
|
999
|
+
"rect",
|
|
1000
|
+
{
|
|
1001
|
+
x: p,
|
|
1002
|
+
y: m,
|
|
1003
|
+
width: s,
|
|
1004
|
+
height: l,
|
|
1005
|
+
fill: "#3498db",
|
|
1006
|
+
stroke: "#2980b9",
|
|
1007
|
+
strokeWidth: "1",
|
|
1008
|
+
onMouseEnter: (g) => this.showTooltip(g, h),
|
|
1009
|
+
onMouseLeave: this.hideTooltip,
|
|
1010
|
+
style: "cursor: pointer; transition: fill 0.2s;"
|
|
1011
|
+
}
|
|
1012
|
+
), /* @__PURE__ */ i(
|
|
1013
|
+
"text",
|
|
1014
|
+
{
|
|
1015
|
+
x: p + s / 2,
|
|
1016
|
+
y: n + 35,
|
|
1017
|
+
textAnchor: "middle",
|
|
1018
|
+
fontSize: "12",
|
|
1019
|
+
fill: "#666"
|
|
1020
|
+
},
|
|
1021
|
+
u + 1
|
|
1022
|
+
));
|
|
1023
|
+
})
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
onConnected() {
|
|
1027
|
+
$.info("SvgDemo connected to DOM");
|
|
1028
|
+
}
|
|
1029
|
+
onDisconnected() {
|
|
1030
|
+
$.info("SvgDemo disconnected from DOM"), this.stopAnimation();
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
V = bo(Gt);
|
|
1034
|
+
M = _o(V, 0, "SvgDemo", Wt, M);
|
|
1035
|
+
xo(V, 1, M);
|
|
1036
|
+
var yo = Object.create, Z = Object.defineProperty, ko = Object.getOwnPropertyDescriptor, Yt = (e, t) => (t = Symbol[e]) ? t : Symbol.for("Symbol." + e), Xt = (e) => {
|
|
1037
|
+
throw TypeError(e);
|
|
1038
|
+
}, qt = (e, t, o) => t in e ? Z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, Co = (e, t) => Z(e, "name", { value: t, configurable: !0 }), wo = (e) => [, , , yo((e == null ? void 0 : e[Yt("metadata")]) ?? null)], $o = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"], Jt = (e) => e !== void 0 && typeof e != "function" ? Xt("Function expected") : e, So = (e, t, o, s, r) => ({ kind: $o[e], name: t, metadata: s, addInitializer: (n) => o._ ? Xt("Already initialized") : r.push(Jt(n || null)) }), zo = (e, t) => qt(t, Yt("metadata"), e[3]), Ao = (e, t, o, s) => {
|
|
1039
|
+
for (var r = 0, n = e[t >> 1], a = n && n.length; r < a; r++) n[r].call(o);
|
|
1040
|
+
return s;
|
|
1041
|
+
}, Eo = (e, t, o, s, r, n) => {
|
|
1042
|
+
var a, h, u, l = t & 7, p = !1, m = 0, g = e[m] || (e[m] = []), c = l && (r = r.prototype, l < 5 && (l > 3 || !p) && ko(r, o));
|
|
1043
|
+
Co(r, o);
|
|
1044
|
+
for (var d = s.length - 1; d >= 0; d--)
|
|
1045
|
+
u = So(l, o, h = {}, e[3], g), a = (0, s[d])(r, u), h._ = 1, Jt(a) && (r = a);
|
|
1046
|
+
return zo(e, r), c && Z(r, o, c), p ? l ^ 4 ? n : c : r;
|
|
1047
|
+
}, P = (e, t, o) => qt(e, typeof t != "symbol" ? t + "" : t, o), Kt, tt, Ut;
|
|
1048
|
+
const Po = C("SimpleReactiveDemo");
|
|
1049
|
+
Kt = [x({ tagName: "simple-reactive-demo" })];
|
|
1050
|
+
class R extends (Ut = ot) {
|
|
1051
|
+
constructor() {
|
|
1052
|
+
super(), P(this, "state", this.reactive({
|
|
1053
|
+
count: 0,
|
|
1054
|
+
message: "Click the button!"
|
|
1055
|
+
})), P(this, "increment", () => {
|
|
1056
|
+
this.state.count++, this.state.message = `Clicked ${this.state.count} time${this.state.count === 1 ? "" : "s"}!`;
|
|
1057
|
+
}), P(this, "reset", () => {
|
|
1058
|
+
this.state.count = 0, this.state.message = "Reset! Click again!";
|
|
1059
|
+
}), Po.info("SimpleReactiveDemo initialized");
|
|
1060
|
+
}
|
|
1061
|
+
render() {
|
|
1062
|
+
return /* @__PURE__ */ i("div", { style: "padding: 20px; border: 1px solid #ccc; border-radius: 8px; margin: 20px;" }, /* @__PURE__ */ i("h3", null, "📱 Simple Reactive Demo"), /* @__PURE__ */ i("p", null, this.state.message), /* @__PURE__ */ i("div", { style: "font-size: 24px; margin: 16px 0;" }, "Count: ", /* @__PURE__ */ i("strong", null, this.state.count)), /* @__PURE__ */ i("div", null, /* @__PURE__ */ i("button", { onClick: this.increment, style: "margin-right: 8px; padding: 8px 16px;" }, "+ Increment"), /* @__PURE__ */ i("button", { onClick: this.reset, style: "padding: 8px 16px;" }, "🔄 Reset")), /* @__PURE__ */ i("div", { style: "margin-top: 16px; font-size: 12px; color: #666;" }, "💡 State changes automatically trigger re-renders!"));
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
tt = wo(Ut);
|
|
1066
|
+
R = Eo(tt, 0, "SimpleReactiveDemo", Kt, R);
|
|
1067
|
+
Ao(tt, 1, R);
|
|
1068
|
+
export {
|
|
1069
|
+
Oo as CONVERTER_BTN,
|
|
1070
|
+
Io as CONVERTER_PANEL,
|
|
1071
|
+
O as ColorPicker,
|
|
1072
|
+
I as ReactiveCounter,
|
|
1073
|
+
R as SimpleReactiveDemo,
|
|
1074
|
+
M as SvgDemo,
|
|
1075
|
+
B as SvgIcon,
|
|
1076
|
+
F as ThemeSwitcher,
|
|
1077
|
+
D as XyButton,
|
|
1078
|
+
T as XyButtonGroup,
|
|
1079
|
+
we as getCustomColorCache,
|
|
1080
|
+
To as getDefaultColorCache,
|
|
1081
|
+
w as handleCSSVariables,
|
|
1082
|
+
Ce as setCustomColorCache,
|
|
1083
|
+
ke as setDefaultColorCache,
|
|
1084
|
+
$e as throttle
|
|
1085
|
+
};
|