flowpilot 0.0.2

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.
@@ -0,0 +1,356 @@
1
+ import { n as instance, o as useState, r as useEffect, s as render, t as jsxDEV } from "./jsx-dev-runtime-DGBfem3G.js";
2
+ //#region src/commands/config/client.tsx
3
+ const initPromise = typeof window !== "undefined" && window.__I18N_LOCALE__ && window.__I18N_RESOURCES__ ? instance.init({
4
+ lng: window.__I18N_LOCALE__,
5
+ fallbackLng: "zh-CN",
6
+ resources: window.__I18N_RESOURCES__,
7
+ interpolation: { escapeValue: false }
8
+ }) : Promise.resolve();
9
+ const t = instance.t;
10
+ const EYE_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z"/><circle cx="12" cy="12" r="3"/></svg>`;
11
+ const EYE_OFF_SVG = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94"/><path d="M9.9 5.06A9.68 9.68 0 0 1 12 4c7 0 11 8 11 8a18.45 18.45 0 0 1-3.06 4.94"/><line x1="1" y1="1" x2="23" y2="23"/></svg>`;
12
+ const configStyle = `
13
+ .page-header {
14
+ margin-bottom: 32px;
15
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
16
+ }
17
+ .page-header h2 {
18
+ font-size: 22px;
19
+ font-weight: 600;
20
+ letter-spacing: -0.02em;
21
+ margin-bottom: 6px;
22
+ }
23
+ .page-header p {
24
+ font-size: 13px;
25
+ color: var(--text-2);
26
+ font-weight: 300;
27
+ line-height: 1.5;
28
+ }
29
+
30
+ .toast {
31
+ display: none;
32
+ align-items: center;
33
+ gap: 8px;
34
+ padding: 8px 14px;
35
+ margin-bottom: 24px;
36
+ border-radius: 6px;
37
+ background: var(--success-soft);
38
+ border: 1px solid rgba(0,255,136,0.12);
39
+ color: var(--neon);
40
+ font-size: 12px;
41
+ font-weight: 500;
42
+ }
43
+ .toast.visible {
44
+ display: inline-flex;
45
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
46
+ }
47
+ .toast-dot {
48
+ width: 6px; height: 6px;
49
+ border-radius: 50%;
50
+ background: var(--neon);
51
+ animation: neon-pulse 2s ease infinite;
52
+ }
53
+
54
+ .section {
55
+ background: var(--bg-card);
56
+ border: 1px solid var(--border);
57
+ border-radius: 10px;
58
+ margin-bottom: 16px;
59
+ overflow: hidden;
60
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
61
+ transition: border-color 0.2s;
62
+ }
63
+ .section:nth-of-type(2) { animation-delay: 0.06s; }
64
+ .section:hover { border-color: var(--border-active); }
65
+
66
+ .section-head {
67
+ padding: 16px 20px;
68
+ border-bottom: 1px solid var(--border);
69
+ display: flex;
70
+ align-items: center;
71
+ gap: 10px;
72
+ }
73
+ .section-dot {
74
+ width: 8px; height: 8px;
75
+ border-radius: 50%;
76
+ flex-shrink: 0;
77
+ }
78
+ .section-dot.jira { background: var(--cyan); box-shadow: 0 0 6px var(--cyan-glow); }
79
+ .section-dot.gitlab { background: var(--neon); box-shadow: 0 0 6px var(--neon-glow); }
80
+ .section-head h3 {
81
+ font-size: 13px;
82
+ font-weight: 600;
83
+ }
84
+
85
+ .section-body { padding: 20px; }
86
+
87
+ .field { margin-bottom: 18px; }
88
+ .field:last-child { margin-bottom: 0; }
89
+
90
+ .field-label {
91
+ display: block;
92
+ font-size: 12px;
93
+ font-weight: 500;
94
+ color: var(--text-2);
95
+ margin-bottom: 6px;
96
+ }
97
+ .field-label .hint {
98
+ font-weight: 300;
99
+ color: var(--text-3);
100
+ font-size: 11px;
101
+ margin-left: 4px;
102
+ }
103
+
104
+ .field-input-wrap { position: relative; }
105
+
106
+ .field input {
107
+ width: 100%;
108
+ padding: 10px 12px;
109
+ font-size: 13px;
110
+ font-family: var(--mono);
111
+ color: var(--text-1);
112
+ background: var(--bg-input);
113
+ border: 1px solid var(--border);
114
+ border-radius: 6px;
115
+ outline: none;
116
+ transition: border-color 0.2s, box-shadow 0.2s;
117
+ }
118
+ .field input.password-input { padding-right: 40px; }
119
+ .field input::placeholder { color: var(--text-3); font-weight: 400; }
120
+ .field input:hover { border-color: var(--border-active); }
121
+ .field input:focus {
122
+ border-color: var(--neon);
123
+ box-shadow: 0 0 0 2px var(--neon-soft), 0 0 8px var(--neon-glow);
124
+ }
125
+
126
+ .password-toggle {
127
+ position: absolute;
128
+ right: 8px;
129
+ top: 50%;
130
+ transform: translateY(-50%);
131
+ width: 28px; height: 28px;
132
+ display: flex; align-items: center; justify-content: center;
133
+ background: none;
134
+ border: none;
135
+ cursor: pointer;
136
+ color: var(--text-3);
137
+ padding: 0;
138
+ transition: color 0.15s;
139
+ }
140
+ .password-toggle:hover { color: var(--text-2); }
141
+ .password-toggle svg {
142
+ width: 18px; height: 18px;
143
+ stroke: currentColor;
144
+ stroke-width: 1.5;
145
+ fill: none;
146
+ stroke-linecap: round;
147
+ stroke-linejoin: round;
148
+ }
149
+
150
+ .save-bar {
151
+ display: flex;
152
+ align-items: center;
153
+ gap: 12px;
154
+ margin-top: 24px;
155
+ animation: slide-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
156
+ }
157
+
158
+ .btn {
159
+ min-height: 44px;
160
+ padding: 10px 22px;
161
+ font-size: 13px;
162
+ font-family: var(--sans);
163
+ font-weight: 500;
164
+ color: var(--bg-void);
165
+ background: var(--neon);
166
+ border: none;
167
+ border-radius: 6px;
168
+ cursor: pointer;
169
+ transition: background 0.15s, box-shadow 0.2s;
170
+ }
171
+ .btn:hover {
172
+ background: var(--neon-hover);
173
+ box-shadow: 0 0 12px var(--neon-glow), 0 2px 12px rgba(0,255,136,0.2);
174
+ }
175
+ .btn:active { background: #00DD77; }
176
+
177
+ .save-note {
178
+ font-size: 11px;
179
+ color: var(--text-3);
180
+ font-family: var(--mono);
181
+ }
182
+
183
+ .loading {
184
+ color: var(--text-3);
185
+ font-size: 13px;
186
+ }
187
+ `;
188
+ const ConfigClient = () => {
189
+ const [config, setConfig] = useState({});
190
+ const [loading, setLoading] = useState(true);
191
+ const [toast, setToast] = useState(false);
192
+ const [showPassword, setShowPassword] = useState(false);
193
+ useEffect(() => {
194
+ fetch("/config/api/config").then((r) => r.json()).then((data) => {
195
+ setConfig(data);
196
+ setLoading(false);
197
+ });
198
+ }, []);
199
+ const handleSubmit = async (e) => {
200
+ e.preventDefault();
201
+ const form = e.target;
202
+ const data = Object.fromEntries(new FormData(form));
203
+ if ((await fetch("/config/api/config", {
204
+ method: "POST",
205
+ headers: { "Content-Type": "application/json" },
206
+ body: JSON.stringify(data)
207
+ })).ok) {
208
+ setToast(true);
209
+ setTimeout(() => setToast(false), 3e3);
210
+ }
211
+ };
212
+ if (loading) return /* @__PURE__ */ jsxDEV("div", { children: [/* @__PURE__ */ jsxDEV("style", { children: configStyle }), /* @__PURE__ */ jsxDEV("div", {
213
+ class: "loading",
214
+ children: t("web.loading")
215
+ })] });
216
+ return /* @__PURE__ */ jsxDEV("div", { children: [
217
+ /* @__PURE__ */ jsxDEV("style", { children: configStyle }),
218
+ /* @__PURE__ */ jsxDEV("div", {
219
+ class: "page-header",
220
+ children: [/* @__PURE__ */ jsxDEV("h2", { children: t("web.settingsTitle") }), /* @__PURE__ */ jsxDEV("p", { children: t("web.settingsDesc") })]
221
+ }),
222
+ toast && /* @__PURE__ */ jsxDEV("div", {
223
+ class: "toast visible",
224
+ role: "status",
225
+ "aria-live": "polite",
226
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "toast-dot" }), t("web.savedToast")]
227
+ }),
228
+ /* @__PURE__ */ jsxDEV("form", {
229
+ onSubmit: handleSubmit,
230
+ children: [
231
+ /* @__PURE__ */ jsxDEV("div", {
232
+ class: "section",
233
+ children: [/* @__PURE__ */ jsxDEV("div", {
234
+ class: "section-head",
235
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "section-dot jira" }), /* @__PURE__ */ jsxDEV("h3", { children: t("web.jiraSection") })]
236
+ }), /* @__PURE__ */ jsxDEV("div", {
237
+ class: "section-body",
238
+ children: [
239
+ /* @__PURE__ */ jsxDEV("div", {
240
+ class: "field",
241
+ children: [/* @__PURE__ */ jsxDEV("label", {
242
+ class: "field-label",
243
+ for: "jiraHost",
244
+ children: [t("web.hostLabel"), /* @__PURE__ */ jsxDEV("span", {
245
+ class: "hint",
246
+ children: t("web.hostHintJira")
247
+ })]
248
+ }), /* @__PURE__ */ jsxDEV("input", {
249
+ id: "jiraHost",
250
+ name: "jiraHost",
251
+ type: "text",
252
+ placeholder: t("web.placeholderJiraHost"),
253
+ value: config.jiraHost ?? ""
254
+ })]
255
+ }),
256
+ /* @__PURE__ */ jsxDEV("div", {
257
+ class: "field",
258
+ children: [/* @__PURE__ */ jsxDEV("label", {
259
+ class: "field-label",
260
+ for: "jiraName",
261
+ children: t("web.accountLabel")
262
+ }), /* @__PURE__ */ jsxDEV("input", {
263
+ id: "jiraName",
264
+ name: "jiraName",
265
+ type: "text",
266
+ placeholder: t("web.placeholderUsername"),
267
+ value: config.jiraName ?? ""
268
+ })]
269
+ }),
270
+ /* @__PURE__ */ jsxDEV("div", {
271
+ class: "field",
272
+ children: [/* @__PURE__ */ jsxDEV("label", {
273
+ class: "field-label",
274
+ for: "jiraPassword",
275
+ children: t("web.passwordLabel")
276
+ }), /* @__PURE__ */ jsxDEV("div", {
277
+ class: "field-input-wrap",
278
+ children: [/* @__PURE__ */ jsxDEV("input", {
279
+ id: "jiraPassword",
280
+ name: "jiraPassword",
281
+ type: showPassword ? "text" : "password",
282
+ class: "password-input",
283
+ placeholder: t("web.placeholderPassword"),
284
+ value: config.jiraPassword ?? ""
285
+ }), /* @__PURE__ */ jsxDEV("button", {
286
+ class: "password-toggle",
287
+ type: "button",
288
+ "aria-label": showPassword ? "Hide password" : "Show password",
289
+ onClick: () => setShowPassword(!showPassword),
290
+ dangerouslySetInnerHTML: { __html: showPassword ? EYE_OFF_SVG : EYE_SVG }
291
+ })]
292
+ })]
293
+ })
294
+ ]
295
+ })]
296
+ }),
297
+ /* @__PURE__ */ jsxDEV("div", {
298
+ class: "section",
299
+ children: [/* @__PURE__ */ jsxDEV("div", {
300
+ class: "section-head",
301
+ children: [/* @__PURE__ */ jsxDEV("span", { class: "section-dot gitlab" }), /* @__PURE__ */ jsxDEV("h3", { children: t("web.gitlabSection") })]
302
+ }), /* @__PURE__ */ jsxDEV("div", {
303
+ class: "section-body",
304
+ children: [/* @__PURE__ */ jsxDEV("div", {
305
+ class: "field",
306
+ children: [/* @__PURE__ */ jsxDEV("label", {
307
+ class: "field-label",
308
+ for: "gitlabHost",
309
+ children: [t("web.hostLabel"), /* @__PURE__ */ jsxDEV("span", {
310
+ class: "hint",
311
+ children: t("web.hostHintGitlab")
312
+ })]
313
+ }), /* @__PURE__ */ jsxDEV("input", {
314
+ id: "gitlabHost",
315
+ name: "gitlabHost",
316
+ type: "text",
317
+ placeholder: t("web.placeholderGitlabHost"),
318
+ value: config.gitlabHost ?? ""
319
+ })]
320
+ }), /* @__PURE__ */ jsxDEV("div", {
321
+ class: "field",
322
+ children: [/* @__PURE__ */ jsxDEV("label", {
323
+ class: "field-label",
324
+ for: "gitlabKey",
325
+ children: t("web.tokenLabel")
326
+ }), /* @__PURE__ */ jsxDEV("input", {
327
+ id: "gitlabKey",
328
+ name: "gitlabKey",
329
+ type: "text",
330
+ placeholder: t("web.placeholderToken"),
331
+ value: config.gitlabKey ?? ""
332
+ })]
333
+ })]
334
+ })]
335
+ }),
336
+ /* @__PURE__ */ jsxDEV("div", {
337
+ class: "save-bar",
338
+ children: [/* @__PURE__ */ jsxDEV("button", {
339
+ class: "btn",
340
+ type: "submit",
341
+ children: t("web.saveBtn")
342
+ }), /* @__PURE__ */ jsxDEV("span", {
343
+ class: "save-note",
344
+ children: t("web.saveNote")
345
+ })]
346
+ })
347
+ ]
348
+ })
349
+ ] });
350
+ };
351
+ const mount = async (el) => {
352
+ await initPromise;
353
+ render(/* @__PURE__ */ jsxDEV(ConfigClient, {}), el);
354
+ };
355
+ //#endregion
356
+ export { mount };