@cloudparse/up-backoffice-sdk 0.0.0-stage → 0.1.1
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/README.md +59 -2
- package/claude-plugin/.claude-plugin/marketplace.json +17 -0
- package/claude-plugin/.claude-plugin/plugin.json +21 -0
- package/claude-plugin/README.md +44 -0
- package/claude-plugin/commands/new-backoffice-plugin.md +18 -0
- package/claude-plugin/scripts/scaffold.mjs +186 -0
- package/claude-plugin/sdk-version.json +1 -0
- package/claude-plugin/skills/up-backoffice-plugin-builder/SKILL.md +40 -0
- package/claude-plugin/skills/up-backoffice-plugin-builder/references/plugin-checklist.md +14 -0
- package/claude-plugin/skills/up-backoffice-plugin-builder/references/recipes.md +147 -0
- package/claude-plugin/skills/up-backoffice-plugin-builder/references/rules-and-pitfalls.md +25 -0
- package/claude-plugin/skills/up-backoffice-plugin-builder/references/sdk-api.md +91 -0
- package/claude-plugin/templates/plugin/AGENTS.md +9 -0
- package/claude-plugin/templates/plugin/CLAUDE.md +1 -0
- package/claude-plugin/templates/plugin/biome.json +64 -0
- package/claude-plugin/templates/plugin/gitignore +2 -0
- package/claude-plugin/templates/plugin/package.json +31 -0
- package/claude-plugin/templates/plugin/src/features/__PLUGIN_ID__/components/AdminPage.tsx +143 -0
- package/claude-plugin/templates/plugin/src/features/__PLUGIN_ID__/types.ts +17 -0
- package/claude-plugin/templates/plugin/src/index.tsx +22 -0
- package/claude-plugin/templates/plugin/src/services/__PLUGIN_ID__.ts +26 -0
- package/claude-plugin/templates/plugin/src/styles.css +1 -0
- package/claude-plugin/templates/plugin/tsconfig.json +18 -0
- package/claude-plugin/templates/plugin/vite.config.ts +12 -0
- package/dist/chunk-PSBYWSHV.js +17 -0
- package/dist/chunk-PSBYWSHV.js.map +1 -0
- package/dist/contract-88aU9QZl.d.ts +122 -0
- package/dist/host.d.ts +33 -0
- package/dist/host.js +140 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +564 -0
- package/dist/index.js +2549 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.css +9 -0
- package/dist/theme.css +41 -0
- package/dist/vite.d.ts +15 -0
- package/dist/vite.js +74 -0
- package/package.json +96 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,2549 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
PLUGIN_CONTRACT_VERSION
|
|
4
|
+
} from "./chunk-PSBYWSHV.js";
|
|
5
|
+
|
|
6
|
+
// src/api/ApiError.ts
|
|
7
|
+
var ApiError = class _ApiError extends Error {
|
|
8
|
+
constructor(status, message, data) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.status = status;
|
|
11
|
+
this.data = data;
|
|
12
|
+
this.name = "ApiError";
|
|
13
|
+
Object.setPrototypeOf(this, _ApiError.prototype);
|
|
14
|
+
}
|
|
15
|
+
status;
|
|
16
|
+
data;
|
|
17
|
+
};
|
|
18
|
+
function isApiError(value) {
|
|
19
|
+
if (!(value instanceof Error) || value.name !== "ApiError") return false;
|
|
20
|
+
return typeof value.status === "number";
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/api/ApiService.ts
|
|
24
|
+
function serializeBody(body) {
|
|
25
|
+
if (body instanceof FormData) return body;
|
|
26
|
+
return body ? JSON.stringify(body) : void 0;
|
|
27
|
+
}
|
|
28
|
+
var ApiService = class {
|
|
29
|
+
constructor(baseUrl) {
|
|
30
|
+
this.baseUrl = baseUrl;
|
|
31
|
+
}
|
|
32
|
+
baseUrl;
|
|
33
|
+
token = null;
|
|
34
|
+
tokenLoader = null;
|
|
35
|
+
onUnauthorized = null;
|
|
36
|
+
setToken(token) {
|
|
37
|
+
this.token = token;
|
|
38
|
+
}
|
|
39
|
+
setTokenLoader(loader) {
|
|
40
|
+
this.tokenLoader = loader;
|
|
41
|
+
}
|
|
42
|
+
setUnauthorizedCallback(callback) {
|
|
43
|
+
this.onUnauthorized = callback;
|
|
44
|
+
}
|
|
45
|
+
get(endpoint, options) {
|
|
46
|
+
return this.request(endpoint, { ...options, method: "GET" });
|
|
47
|
+
}
|
|
48
|
+
post(endpoint, body, options) {
|
|
49
|
+
return this.request(endpoint, {
|
|
50
|
+
...options,
|
|
51
|
+
body: serializeBody(body),
|
|
52
|
+
method: "POST"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
put(endpoint, body, options) {
|
|
56
|
+
return this.request(endpoint, {
|
|
57
|
+
...options,
|
|
58
|
+
body: serializeBody(body),
|
|
59
|
+
method: "PUT"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
patch(endpoint, body, options) {
|
|
63
|
+
return this.request(endpoint, {
|
|
64
|
+
...options,
|
|
65
|
+
body: serializeBody(body),
|
|
66
|
+
method: "PATCH"
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
delete(endpoint, options) {
|
|
70
|
+
return this.request(endpoint, { ...options, method: "DELETE" });
|
|
71
|
+
}
|
|
72
|
+
async getBlob(endpoint, options = {}) {
|
|
73
|
+
const response = await this.send(endpoint, options);
|
|
74
|
+
if (!response.ok) {
|
|
75
|
+
throw new ApiError(response.status, `Failed to fetch ${endpoint}`);
|
|
76
|
+
}
|
|
77
|
+
return response.blob();
|
|
78
|
+
}
|
|
79
|
+
async getText(endpoint, options = {}) {
|
|
80
|
+
const response = await this.send(endpoint, options);
|
|
81
|
+
if (!response.ok) {
|
|
82
|
+
throw new ApiError(response.status, `Failed to fetch ${endpoint}`);
|
|
83
|
+
}
|
|
84
|
+
return response.text();
|
|
85
|
+
}
|
|
86
|
+
async request(endpoint, options = {}) {
|
|
87
|
+
const headers = new Headers(options.headers);
|
|
88
|
+
if (!(options.body instanceof FormData)) {
|
|
89
|
+
headers.set("Content-Type", "application/json");
|
|
90
|
+
}
|
|
91
|
+
const response = await this.send(endpoint, { ...options, headers });
|
|
92
|
+
if (!response.ok) {
|
|
93
|
+
const errorData = await response.json().catch(() => ({}));
|
|
94
|
+
throw new ApiError(
|
|
95
|
+
response.status,
|
|
96
|
+
errorData.message || response.statusText,
|
|
97
|
+
errorData
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
if (response.status === 204) {
|
|
101
|
+
return {};
|
|
102
|
+
}
|
|
103
|
+
const contentType = response.headers.get("content-type");
|
|
104
|
+
if (contentType?.includes("application/json")) {
|
|
105
|
+
return response.json();
|
|
106
|
+
}
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Builds the URL, attaches the bearer token (only for URLs on this client's own
|
|
111
|
+
* base URL, never for absolute third-party URLs) and reports 401s.
|
|
112
|
+
*/
|
|
113
|
+
async send(endpoint, options) {
|
|
114
|
+
const { params, ...fetchOptions } = options;
|
|
115
|
+
if (this.tokenLoader) {
|
|
116
|
+
try {
|
|
117
|
+
this.token = await this.tokenLoader();
|
|
118
|
+
} catch (err) {
|
|
119
|
+
console.error("ApiService: Failed to load token dynamically", err);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const isAbsolute = /^https?:\/\//.test(endpoint);
|
|
123
|
+
const url = new URL(isAbsolute ? endpoint : `${this.baseUrl}${endpoint}`);
|
|
124
|
+
for (const [key, value] of Object.entries(params ?? {})) {
|
|
125
|
+
if (value !== void 0 && value !== null) {
|
|
126
|
+
url.searchParams.append(key, String(value));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const headers = new Headers(fetchOptions.headers);
|
|
130
|
+
const isOwnOrigin = !isAbsolute || endpoint.startsWith(this.baseUrl);
|
|
131
|
+
if (this.token && isOwnOrigin) {
|
|
132
|
+
headers.set(
|
|
133
|
+
"Authorization",
|
|
134
|
+
this.token.startsWith("Bearer ") ? this.token : `Bearer ${this.token}`
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
const response = await fetch(url, { ...fetchOptions, headers });
|
|
138
|
+
if (response.status === 401) {
|
|
139
|
+
this.onUnauthorized?.();
|
|
140
|
+
}
|
|
141
|
+
return response;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// src/hooks/useCopyToClipboard.ts
|
|
146
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
147
|
+
function useCopyToClipboard(resetMs = 2e3) {
|
|
148
|
+
const [copied, setCopied] = useState(false);
|
|
149
|
+
const timer = useRef(null);
|
|
150
|
+
useEffect(
|
|
151
|
+
() => () => {
|
|
152
|
+
if (timer.current) clearTimeout(timer.current);
|
|
153
|
+
},
|
|
154
|
+
[]
|
|
155
|
+
);
|
|
156
|
+
const copy = useCallback(
|
|
157
|
+
async (text) => {
|
|
158
|
+
try {
|
|
159
|
+
await navigator.clipboard.writeText(text);
|
|
160
|
+
} catch {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
setCopied(true);
|
|
164
|
+
if (timer.current) clearTimeout(timer.current);
|
|
165
|
+
timer.current = setTimeout(() => setCopied(false), resetMs);
|
|
166
|
+
return true;
|
|
167
|
+
},
|
|
168
|
+
[resetMs]
|
|
169
|
+
);
|
|
170
|
+
return { copied, copy };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// src/hooks/useDangerZoneDelete.tsx
|
|
174
|
+
import { useCallback as useCallback3, useState as useState3 } from "react";
|
|
175
|
+
|
|
176
|
+
// src/ui/ConfirmModal.tsx
|
|
177
|
+
import { AlertTriangle } from "lucide-react";
|
|
178
|
+
import { useId } from "react";
|
|
179
|
+
|
|
180
|
+
// src/ui/Button.tsx
|
|
181
|
+
import { Loader2 } from "lucide-react";
|
|
182
|
+
import { forwardRef } from "react";
|
|
183
|
+
|
|
184
|
+
// src/utils/cn.ts
|
|
185
|
+
import { clsx } from "clsx";
|
|
186
|
+
import { twMerge } from "tailwind-merge";
|
|
187
|
+
function cn(...inputs) {
|
|
188
|
+
return twMerge(clsx(inputs));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// src/ui/Button.tsx
|
|
192
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
193
|
+
var Button = forwardRef(
|
|
194
|
+
({
|
|
195
|
+
className,
|
|
196
|
+
isLoading,
|
|
197
|
+
variant = "primary",
|
|
198
|
+
size = "md",
|
|
199
|
+
children,
|
|
200
|
+
disabled,
|
|
201
|
+
...props
|
|
202
|
+
}, ref) => {
|
|
203
|
+
const variants = {
|
|
204
|
+
danger: "bg-error text-white hover:bg-error/90",
|
|
205
|
+
ghost: "bg-transparent hover:bg-muted/10 text-foreground",
|
|
206
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
207
|
+
secondary: "bg-card text-card-foreground hover:bg-card/80 border border-muted/20"
|
|
208
|
+
};
|
|
209
|
+
const sizes = {
|
|
210
|
+
lg: "h-12 px-8 gap-2",
|
|
211
|
+
md: "h-10 px-4 gap-2",
|
|
212
|
+
sm: "h-8 px-3 gap-1.5"
|
|
213
|
+
};
|
|
214
|
+
return /* @__PURE__ */ jsxs(
|
|
215
|
+
"button",
|
|
216
|
+
{
|
|
217
|
+
className: cn(
|
|
218
|
+
"inline-flex items-center justify-center rounded-xl text-xs font-black uppercase tracking-widest transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:pointer-events-none disabled:opacity-50",
|
|
219
|
+
variants[variant],
|
|
220
|
+
sizes[size],
|
|
221
|
+
className
|
|
222
|
+
),
|
|
223
|
+
disabled: isLoading || disabled,
|
|
224
|
+
ref,
|
|
225
|
+
...props,
|
|
226
|
+
children: [
|
|
227
|
+
isLoading && /* @__PURE__ */ jsx(Loader2, { className: "mr-2 h-4 w-4 animate-spin" }),
|
|
228
|
+
children
|
|
229
|
+
]
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
);
|
|
234
|
+
Button.displayName = "Button";
|
|
235
|
+
|
|
236
|
+
// src/ui/useModalLock.ts
|
|
237
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
238
|
+
var FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
239
|
+
var PORTAL_CONTENT_SELECTOR = "[data-modal-portal-content]";
|
|
240
|
+
function getFocusableElements(container) {
|
|
241
|
+
const inContainer = Array.from(
|
|
242
|
+
container.querySelectorAll(FOCUSABLE_SELECTOR)
|
|
243
|
+
);
|
|
244
|
+
const inPortals = Array.from(
|
|
245
|
+
document.querySelectorAll(
|
|
246
|
+
`${PORTAL_CONTENT_SELECTOR} ${FOCUSABLE_SELECTOR}`
|
|
247
|
+
)
|
|
248
|
+
);
|
|
249
|
+
return [...inContainer, ...inPortals].filter(
|
|
250
|
+
(el) => el.offsetParent !== null
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
var openLocks = [];
|
|
254
|
+
function isTopmost(id) {
|
|
255
|
+
const leaves = openLocks.filter(
|
|
256
|
+
(lock) => !openLocks.some(
|
|
257
|
+
(other) => other !== lock && lock.container.contains(other.container)
|
|
258
|
+
)
|
|
259
|
+
);
|
|
260
|
+
return leaves[leaves.length - 1]?.id === id;
|
|
261
|
+
}
|
|
262
|
+
function useModalLock(options = {}) {
|
|
263
|
+
const [container, setContainer] = useState2(null);
|
|
264
|
+
const containerRef = useCallback2((node) => {
|
|
265
|
+
setContainer(node);
|
|
266
|
+
}, []);
|
|
267
|
+
const onEscapeRef = useRef2(options.onEscape);
|
|
268
|
+
onEscapeRef.current = options.onEscape;
|
|
269
|
+
useEffect2(() => {
|
|
270
|
+
const previousOverflow = document.body.style.overflow;
|
|
271
|
+
document.body.style.overflow = "hidden";
|
|
272
|
+
return () => {
|
|
273
|
+
document.body.style.overflow = previousOverflow;
|
|
274
|
+
};
|
|
275
|
+
}, []);
|
|
276
|
+
useEffect2(() => {
|
|
277
|
+
if (!container) return;
|
|
278
|
+
const previouslyFocused = document.activeElement;
|
|
279
|
+
const body = container.querySelector("[data-modal-body]");
|
|
280
|
+
const [first] = getFocusableElements(body ?? container);
|
|
281
|
+
const [fallback] = getFocusableElements(container);
|
|
282
|
+
(first ?? fallback ?? container).focus();
|
|
283
|
+
return () => {
|
|
284
|
+
previouslyFocused?.focus();
|
|
285
|
+
};
|
|
286
|
+
}, [container]);
|
|
287
|
+
useEffect2(() => {
|
|
288
|
+
if (!container) return;
|
|
289
|
+
const lock = /* @__PURE__ */ Symbol("modal-lock");
|
|
290
|
+
const entry = { container, id: lock };
|
|
291
|
+
openLocks.push(entry);
|
|
292
|
+
const handleKeyDown = (e) => {
|
|
293
|
+
if (!isTopmost(lock)) return;
|
|
294
|
+
if (e.key === "Escape") {
|
|
295
|
+
if (!e.defaultPrevented && onEscapeRef.current) {
|
|
296
|
+
e.preventDefault();
|
|
297
|
+
onEscapeRef.current();
|
|
298
|
+
}
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
if (e.key !== "Tab") return;
|
|
302
|
+
const elements = getFocusableElements(container);
|
|
303
|
+
if (elements.length === 0) return;
|
|
304
|
+
const first = elements[0];
|
|
305
|
+
const last = elements[elements.length - 1];
|
|
306
|
+
const focusInside = elements.includes(
|
|
307
|
+
document.activeElement
|
|
308
|
+
);
|
|
309
|
+
if (!focusInside) {
|
|
310
|
+
e.preventDefault();
|
|
311
|
+
first.focus();
|
|
312
|
+
} else if (e.shiftKey && document.activeElement === first) {
|
|
313
|
+
e.preventDefault();
|
|
314
|
+
last.focus();
|
|
315
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
316
|
+
e.preventDefault();
|
|
317
|
+
first.focus();
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
321
|
+
return () => {
|
|
322
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
323
|
+
openLocks.splice(openLocks.indexOf(entry), 1);
|
|
324
|
+
};
|
|
325
|
+
}, [container]);
|
|
326
|
+
return containerRef;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// src/ui/ConfirmModal.tsx
|
|
330
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
331
|
+
function ConfirmModal({
|
|
332
|
+
title,
|
|
333
|
+
description,
|
|
334
|
+
confirmLabel = "Confirm",
|
|
335
|
+
cancelLabel = "Cancel",
|
|
336
|
+
isConfirming = false,
|
|
337
|
+
variant = "danger",
|
|
338
|
+
onConfirm,
|
|
339
|
+
onCancel
|
|
340
|
+
}) {
|
|
341
|
+
const titleId = useId();
|
|
342
|
+
const descriptionId = useId();
|
|
343
|
+
const modalRef = useModalLock({
|
|
344
|
+
onEscape: isConfirming ? void 0 : onCancel
|
|
345
|
+
});
|
|
346
|
+
return /* @__PURE__ */ jsx2("div", { className: "fixed inset-0 z-60 flex items-center justify-center p-4 bg-background/90 backdrop-blur-md animate-in fade-in duration-300", children: /* @__PURE__ */ jsxs2(
|
|
347
|
+
"div",
|
|
348
|
+
{
|
|
349
|
+
"aria-describedby": descriptionId,
|
|
350
|
+
"aria-labelledby": titleId,
|
|
351
|
+
"aria-modal": "true",
|
|
352
|
+
className: "bg-card border border-white/5 w-full max-w-md rounded-3xl shadow-2xl overflow-hidden animate-in zoom-in-95 duration-300 p-8 space-y-6",
|
|
353
|
+
ref: modalRef,
|
|
354
|
+
role: "alertdialog",
|
|
355
|
+
tabIndex: -1,
|
|
356
|
+
children: [
|
|
357
|
+
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
358
|
+
/* @__PURE__ */ jsxs2(
|
|
359
|
+
"h2",
|
|
360
|
+
{
|
|
361
|
+
className: "text-2xl font-black tracking-tight uppercase flex items-center gap-3",
|
|
362
|
+
id: titleId,
|
|
363
|
+
children: [
|
|
364
|
+
/* @__PURE__ */ jsx2(
|
|
365
|
+
AlertTriangle,
|
|
366
|
+
{
|
|
367
|
+
className: variant === "danger" ? "w-6 h-6 text-error shrink-0" : "w-6 h-6 text-primary shrink-0"
|
|
368
|
+
}
|
|
369
|
+
),
|
|
370
|
+
title
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
),
|
|
374
|
+
/* @__PURE__ */ jsx2(
|
|
375
|
+
"p",
|
|
376
|
+
{
|
|
377
|
+
className: "text-sm text-muted-foreground font-medium",
|
|
378
|
+
id: descriptionId,
|
|
379
|
+
children: description
|
|
380
|
+
}
|
|
381
|
+
)
|
|
382
|
+
] }),
|
|
383
|
+
/* @__PURE__ */ jsxs2("div", { className: "flex gap-4", children: [
|
|
384
|
+
/* @__PURE__ */ jsx2(
|
|
385
|
+
Button,
|
|
386
|
+
{
|
|
387
|
+
className: "flex-1 h-12 rounded-2xl",
|
|
388
|
+
disabled: isConfirming,
|
|
389
|
+
onClick: onCancel,
|
|
390
|
+
type: "button",
|
|
391
|
+
variant: "secondary",
|
|
392
|
+
children: cancelLabel
|
|
393
|
+
}
|
|
394
|
+
),
|
|
395
|
+
/* @__PURE__ */ jsx2(
|
|
396
|
+
Button,
|
|
397
|
+
{
|
|
398
|
+
className: "flex-2 h-12 rounded-2xl",
|
|
399
|
+
isLoading: isConfirming,
|
|
400
|
+
onClick: onConfirm,
|
|
401
|
+
type: "button",
|
|
402
|
+
variant: variant === "danger" ? "danger" : "primary",
|
|
403
|
+
children: confirmLabel
|
|
404
|
+
}
|
|
405
|
+
)
|
|
406
|
+
] })
|
|
407
|
+
]
|
|
408
|
+
}
|
|
409
|
+
) });
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// src/hooks/useDangerZoneDelete.tsx
|
|
413
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
414
|
+
function useDangerZoneDelete({
|
|
415
|
+
onDelete,
|
|
416
|
+
resolveName,
|
|
417
|
+
entityLabel,
|
|
418
|
+
id = "danger-zone"
|
|
419
|
+
}) {
|
|
420
|
+
const [inputValue, setInputValue] = useState3("");
|
|
421
|
+
const [pending, setPending] = useState3(
|
|
422
|
+
null
|
|
423
|
+
);
|
|
424
|
+
const [isDeleting, setIsDeleting] = useState3(false);
|
|
425
|
+
const [error, setError] = useState3(null);
|
|
426
|
+
const request = useCallback3(
|
|
427
|
+
(uuid) => {
|
|
428
|
+
setInputValue(uuid);
|
|
429
|
+
setError(null);
|
|
430
|
+
document.getElementById(id)?.scrollIntoView({ behavior: "smooth" });
|
|
431
|
+
},
|
|
432
|
+
[id]
|
|
433
|
+
);
|
|
434
|
+
const handleConfirmDelete = () => {
|
|
435
|
+
const uuid = inputValue.trim();
|
|
436
|
+
const name = uuid ? resolveName(uuid) : null;
|
|
437
|
+
if (!name) {
|
|
438
|
+
setError(
|
|
439
|
+
`No ${entityLabel.replace(/^(an?|the) /, "")} matches this UUID.`
|
|
440
|
+
);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
setError(null);
|
|
444
|
+
setPending({ name, uuid });
|
|
445
|
+
};
|
|
446
|
+
const confirmDelete = async () => {
|
|
447
|
+
if (!pending) return;
|
|
448
|
+
setIsDeleting(true);
|
|
449
|
+
try {
|
|
450
|
+
await onDelete(pending.uuid);
|
|
451
|
+
setInputValue("");
|
|
452
|
+
setPending(null);
|
|
453
|
+
} catch (err) {
|
|
454
|
+
setError(err.message || `Failed to delete ${entityLabel}.`);
|
|
455
|
+
setPending(null);
|
|
456
|
+
} finally {
|
|
457
|
+
setIsDeleting(false);
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
return {
|
|
461
|
+
clearError: () => setError(null),
|
|
462
|
+
confirmModal: pending ? /* @__PURE__ */ jsx3(
|
|
463
|
+
ConfirmModal,
|
|
464
|
+
{
|
|
465
|
+
confirmLabel: "Permanently delete",
|
|
466
|
+
description: `"${pending.name}" will be permanently deleted. This action is irreversible.`,
|
|
467
|
+
isConfirming: isDeleting,
|
|
468
|
+
onCancel: () => setPending(null),
|
|
469
|
+
onConfirm: confirmDelete,
|
|
470
|
+
title: "Delete permanently?"
|
|
471
|
+
}
|
|
472
|
+
) : null,
|
|
473
|
+
dangerZoneProps: {
|
|
474
|
+
entityLabel,
|
|
475
|
+
id,
|
|
476
|
+
inputValue,
|
|
477
|
+
isDeleting,
|
|
478
|
+
onConfirmDelete: handleConfirmDelete,
|
|
479
|
+
onInputChange: setInputValue
|
|
480
|
+
},
|
|
481
|
+
error,
|
|
482
|
+
request
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
// src/plugin/boundClients.ts
|
|
487
|
+
var boundHost = null;
|
|
488
|
+
function bindHost(host) {
|
|
489
|
+
boundHost = host;
|
|
490
|
+
}
|
|
491
|
+
function requireHost() {
|
|
492
|
+
if (!boundHost) {
|
|
493
|
+
throw new Error(
|
|
494
|
+
"The plugin is not mounted yet: its API clients are bound by the backoffice host"
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
return boundHost;
|
|
498
|
+
}
|
|
499
|
+
function lazyClient(pick) {
|
|
500
|
+
return {
|
|
501
|
+
get baseUrl() {
|
|
502
|
+
return pick(requireHost()).baseUrl;
|
|
503
|
+
},
|
|
504
|
+
delete: (endpoint, options) => pick(requireHost()).delete(endpoint, options),
|
|
505
|
+
get: (endpoint, options) => pick(requireHost()).get(endpoint, options),
|
|
506
|
+
getBlob: (endpoint, options) => pick(requireHost()).getBlob(endpoint, options),
|
|
507
|
+
getText: (endpoint, options) => pick(requireHost()).getText(endpoint, options),
|
|
508
|
+
patch: (endpoint, body, options) => pick(requireHost()).patch(endpoint, body, options),
|
|
509
|
+
post: (endpoint, body, options) => pick(requireHost()).post(endpoint, body, options),
|
|
510
|
+
put: (endpoint, body, options) => pick(requireHost()).put(endpoint, body, options)
|
|
511
|
+
};
|
|
512
|
+
}
|
|
513
|
+
var miniappApi = lazyClient((host) => host.miniappApi);
|
|
514
|
+
var hubApi = lazyClient((host) => host.hubApi);
|
|
515
|
+
function getScopeToken() {
|
|
516
|
+
return requireHost().getScopeToken();
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// src/plugin/context.tsx
|
|
520
|
+
import { createContext, useContext } from "react";
|
|
521
|
+
var PluginHostContext = createContext(null);
|
|
522
|
+
function usePluginHost() {
|
|
523
|
+
const host = useContext(PluginHostContext);
|
|
524
|
+
if (!host) {
|
|
525
|
+
throw new Error(
|
|
526
|
+
"usePluginHost() must be called inside a page rendered by the backoffice host"
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
return host;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// src/plugin/definePlugin.tsx
|
|
533
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
534
|
+
var PLUGIN_ID_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
535
|
+
function definePlugin(definition) {
|
|
536
|
+
if (!PLUGIN_ID_PATTERN.test(definition.id)) {
|
|
537
|
+
throw new Error(
|
|
538
|
+
`Invalid plugin id "${definition.id}": lowercase letters, digits and dashes only`
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
const paths = /* @__PURE__ */ new Set();
|
|
542
|
+
for (const page of definition.pages) {
|
|
543
|
+
if (page.path.startsWith("/") || paths.has(page.path)) {
|
|
544
|
+
throw new Error(
|
|
545
|
+
`Invalid or duplicate page path "${page.path}" in plugin "${definition.id}"`
|
|
546
|
+
);
|
|
547
|
+
}
|
|
548
|
+
paths.add(page.path);
|
|
549
|
+
}
|
|
550
|
+
const { pages, ...rest } = definition;
|
|
551
|
+
return {
|
|
552
|
+
...rest,
|
|
553
|
+
contractVersion: PLUGIN_CONTRACT_VERSION,
|
|
554
|
+
pages: pages.map(({ component: _component, ...page }) => page),
|
|
555
|
+
renderPage(pagePath, host) {
|
|
556
|
+
const page = pages.find((candidate) => candidate.path === pagePath);
|
|
557
|
+
if (!page) return null;
|
|
558
|
+
bindHost(host);
|
|
559
|
+
const Page = page.component;
|
|
560
|
+
return /* @__PURE__ */ jsx4(PluginHostContext.Provider, { value: host, children: /* @__PURE__ */ jsx4(Page, {}) });
|
|
561
|
+
},
|
|
562
|
+
sdkVersion: "0.1.1"
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// src/ui/AuthStatusBadge.tsx
|
|
567
|
+
import { ShieldAlert, ShieldCheck } from "lucide-react";
|
|
568
|
+
|
|
569
|
+
// src/ui/Badge.tsx
|
|
570
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
571
|
+
var VARIANTS = {
|
|
572
|
+
accent: "bg-accent/15 text-accent border-accent/20",
|
|
573
|
+
error: "bg-error/15 text-error border-error/20",
|
|
574
|
+
muted: "bg-muted/10 text-muted-foreground border-muted/20",
|
|
575
|
+
outline: "bg-transparent text-muted-foreground border-muted/30",
|
|
576
|
+
primary: "bg-primary/15 text-primary border-primary/20",
|
|
577
|
+
success: "bg-success/15 text-success border-success/20",
|
|
578
|
+
warning: "bg-warning/15 text-warning border-warning/20"
|
|
579
|
+
};
|
|
580
|
+
function Badge({ variant = "muted", className, ...props }) {
|
|
581
|
+
return /* @__PURE__ */ jsx5(
|
|
582
|
+
"span",
|
|
583
|
+
{
|
|
584
|
+
className: cn(
|
|
585
|
+
"inline-flex items-center gap-1.5 text-xs font-bold uppercase tracking-widest px-2.5 py-1 rounded-full border whitespace-nowrap",
|
|
586
|
+
VARIANTS[variant],
|
|
587
|
+
className
|
|
588
|
+
),
|
|
589
|
+
...props
|
|
590
|
+
}
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
// src/ui/AuthStatusBadge.tsx
|
|
595
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
596
|
+
function AuthStatusBadge({ authError }) {
|
|
597
|
+
return authError ? /* @__PURE__ */ jsxs3(Badge, { className: "flex items-center gap-1.5", variant: "error", children: [
|
|
598
|
+
/* @__PURE__ */ jsx6(ShieldAlert, { className: "w-3.5 h-3.5 animate-pulse" }),
|
|
599
|
+
"Auth error"
|
|
600
|
+
] }) : /* @__PURE__ */ jsxs3(Badge, { className: "flex items-center gap-1.5", variant: "success", children: [
|
|
601
|
+
/* @__PURE__ */ jsx6(ShieldCheck, { className: "w-3.5 h-3.5" }),
|
|
602
|
+
"Active token"
|
|
603
|
+
] });
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
// src/ui/Banner.tsx
|
|
607
|
+
import { AlertCircle, AlertTriangle as AlertTriangle2, CheckCircle2, X } from "lucide-react";
|
|
608
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
609
|
+
function Banner({ message, variant, onClose, className }) {
|
|
610
|
+
const variants = {
|
|
611
|
+
error: {
|
|
612
|
+
bg: "bg-error/10 border-error/20",
|
|
613
|
+
icon: /* @__PURE__ */ jsx7(AlertCircle, { className: "h-5 w-5" }),
|
|
614
|
+
text: "text-error"
|
|
615
|
+
},
|
|
616
|
+
success: {
|
|
617
|
+
bg: "bg-success/10 border-success/20",
|
|
618
|
+
icon: /* @__PURE__ */ jsx7(CheckCircle2, { className: "h-5 w-5" }),
|
|
619
|
+
text: "text-success"
|
|
620
|
+
},
|
|
621
|
+
warning: {
|
|
622
|
+
bg: "bg-warning/10 border-warning/20",
|
|
623
|
+
icon: /* @__PURE__ */ jsx7(AlertTriangle2, { className: "h-5 w-5" }),
|
|
624
|
+
text: "text-warning"
|
|
625
|
+
}
|
|
626
|
+
};
|
|
627
|
+
const current = variants[variant];
|
|
628
|
+
return /* @__PURE__ */ jsxs4(
|
|
629
|
+
"div",
|
|
630
|
+
{
|
|
631
|
+
className: cn(
|
|
632
|
+
"flex items-center gap-3 p-4 rounded-2xl border animate-in fade-in slide-in-from-top-2 duration-300",
|
|
633
|
+
current.bg,
|
|
634
|
+
current.text,
|
|
635
|
+
className
|
|
636
|
+
),
|
|
637
|
+
children: [
|
|
638
|
+
current.icon,
|
|
639
|
+
/* @__PURE__ */ jsx7("span", { className: "text-sm font-bold leading-relaxed flex-1", children: message }),
|
|
640
|
+
onClose && /* @__PURE__ */ jsx7(
|
|
641
|
+
"button",
|
|
642
|
+
{
|
|
643
|
+
className: "hover:opacity-70 transition-opacity p-1 rounded-full",
|
|
644
|
+
onClick: onClose,
|
|
645
|
+
type: "button",
|
|
646
|
+
children: /* @__PURE__ */ jsx7(X, { className: "h-4 w-4" })
|
|
647
|
+
}
|
|
648
|
+
)
|
|
649
|
+
]
|
|
650
|
+
}
|
|
651
|
+
);
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
// src/ui/Card.tsx
|
|
655
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
656
|
+
var PADDINGS = { lg: "p-8", md: "p-6", none: "" };
|
|
657
|
+
function Card({
|
|
658
|
+
padding = "lg",
|
|
659
|
+
interactive = false,
|
|
660
|
+
variant = "glass",
|
|
661
|
+
className,
|
|
662
|
+
...props
|
|
663
|
+
}) {
|
|
664
|
+
return /* @__PURE__ */ jsx8(
|
|
665
|
+
"div",
|
|
666
|
+
{
|
|
667
|
+
className: cn(
|
|
668
|
+
"rounded-3xl border border-white/5 shadow-2xl",
|
|
669
|
+
variant === "glass" ? "bg-card/50 backdrop-blur-sm" : "bg-card",
|
|
670
|
+
PADDINGS[padding],
|
|
671
|
+
interactive && "hover:border-primary/20 transition-all duration-300",
|
|
672
|
+
className
|
|
673
|
+
),
|
|
674
|
+
...props
|
|
675
|
+
}
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// src/ui/CopyableUuid.tsx
|
|
680
|
+
import { Check, Copy } from "lucide-react";
|
|
681
|
+
import { useState as useState4 } from "react";
|
|
682
|
+
import { jsx as jsx9, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
683
|
+
function CopyableUuid({ uuid }) {
|
|
684
|
+
const [copied, setCopied] = useState4(false);
|
|
685
|
+
const handleCopy = () => {
|
|
686
|
+
navigator.clipboard.writeText(uuid);
|
|
687
|
+
setCopied(true);
|
|
688
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
689
|
+
};
|
|
690
|
+
return /* @__PURE__ */ jsxs5("div", { className: "flex items-center gap-1.5", children: [
|
|
691
|
+
/* @__PURE__ */ jsx9("span", { className: "text-xs font-mono text-muted-foreground break-all", children: uuid }),
|
|
692
|
+
/* @__PURE__ */ jsx9(
|
|
693
|
+
"button",
|
|
694
|
+
{
|
|
695
|
+
className: `p-1 rounded-md transition-all flex items-center justify-center shrink-0 ${copied ? "bg-success/20 text-success" : "text-muted-foreground hover:text-primary hover:bg-white/5"}`,
|
|
696
|
+
onClick: handleCopy,
|
|
697
|
+
title: "Copy UUID",
|
|
698
|
+
type: "button",
|
|
699
|
+
children: copied ? /* @__PURE__ */ jsx9(Check, { className: "w-3 h-3" }) : /* @__PURE__ */ jsx9(Copy, { className: "w-3 h-3" })
|
|
700
|
+
}
|
|
701
|
+
)
|
|
702
|
+
] });
|
|
703
|
+
}
|
|
704
|
+
|
|
705
|
+
// src/ui/DangerZone.tsx
|
|
706
|
+
import { AlertTriangle as AlertTriangle3 } from "lucide-react";
|
|
707
|
+
|
|
708
|
+
// src/ui/Input.tsx
|
|
709
|
+
import { forwardRef as forwardRef2, useId as useId2 } from "react";
|
|
710
|
+
|
|
711
|
+
// src/ui/FieldLabel.tsx
|
|
712
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
713
|
+
function FieldLabel({ className, ...props }) {
|
|
714
|
+
return /* @__PURE__ */ jsx10(
|
|
715
|
+
"label",
|
|
716
|
+
{
|
|
717
|
+
className: cn(
|
|
718
|
+
"text-xs font-black uppercase tracking-widest text-muted-foreground ml-1",
|
|
719
|
+
className
|
|
720
|
+
),
|
|
721
|
+
...props
|
|
722
|
+
}
|
|
723
|
+
);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// src/ui/Input.tsx
|
|
727
|
+
import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
728
|
+
var Input = forwardRef2(
|
|
729
|
+
({ className, label, error, icon: Icon, id, ...props }, ref) => {
|
|
730
|
+
const generatedId = useId2();
|
|
731
|
+
const inputId = id ?? generatedId;
|
|
732
|
+
return /* @__PURE__ */ jsxs6("div", { className: "flex flex-col gap-1.5 w-full", children: [
|
|
733
|
+
label && /* @__PURE__ */ jsx11(FieldLabel, { htmlFor: inputId, children: label }),
|
|
734
|
+
/* @__PURE__ */ jsxs6("div", { className: "relative group", children: [
|
|
735
|
+
Icon && /* @__PURE__ */ jsx11(Icon, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground group-focus-within:text-primary transition-colors pointer-events-none" }),
|
|
736
|
+
/* @__PURE__ */ jsx11(
|
|
737
|
+
"input",
|
|
738
|
+
{
|
|
739
|
+
className: cn(
|
|
740
|
+
"flex h-10 w-full rounded-md border border-muted/20 bg-card px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-0 disabled:cursor-not-allowed disabled:opacity-50 transition-colors",
|
|
741
|
+
Icon && "pl-9",
|
|
742
|
+
error && "border-error focus-visible:ring-error",
|
|
743
|
+
className
|
|
744
|
+
),
|
|
745
|
+
id: inputId,
|
|
746
|
+
ref,
|
|
747
|
+
...props
|
|
748
|
+
}
|
|
749
|
+
)
|
|
750
|
+
] }),
|
|
751
|
+
error && /* @__PURE__ */ jsx11("span", { className: "text-xs text-error ml-1", children: error })
|
|
752
|
+
] });
|
|
753
|
+
}
|
|
754
|
+
);
|
|
755
|
+
Input.displayName = "Input";
|
|
756
|
+
|
|
757
|
+
// src/ui/DangerZone.tsx
|
|
758
|
+
import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
759
|
+
function DangerZone({
|
|
760
|
+
inputValue,
|
|
761
|
+
onInputChange,
|
|
762
|
+
onConfirmDelete,
|
|
763
|
+
isDeleting,
|
|
764
|
+
entityLabel = "an entity",
|
|
765
|
+
customDescription,
|
|
766
|
+
id = "danger-zone",
|
|
767
|
+
inputLabel = "Enter the UUID of the entity to delete",
|
|
768
|
+
inputPlaceholder = "Ex: 550e8400-e29b-41d4-a716-446655440000"
|
|
769
|
+
}) {
|
|
770
|
+
const formattedDescription = customDescription ? customDescription : `Deleting ${entityLabel} permanently removes it from the system along with all associated data if necessary. This action is irreversible.`;
|
|
771
|
+
return /* @__PURE__ */ jsxs7(
|
|
772
|
+
"section",
|
|
773
|
+
{
|
|
774
|
+
className: "border border-error/20 bg-error/5 p-8 rounded-3xl space-y-6 animate-in fade-in duration-300",
|
|
775
|
+
id,
|
|
776
|
+
children: [
|
|
777
|
+
/* @__PURE__ */ jsxs7("div", { className: "space-y-1", children: [
|
|
778
|
+
/* @__PURE__ */ jsxs7("h2", { className: "text-lg font-bold flex items-center gap-2.5 text-error", children: [
|
|
779
|
+
/* @__PURE__ */ jsx12(AlertTriangle3, { className: "w-5 h-5 shrink-0" }),
|
|
780
|
+
"Danger Zone \u2014 Definitive Deletion"
|
|
781
|
+
] }),
|
|
782
|
+
/* @__PURE__ */ jsx12("p", { className: "text-muted-foreground text-sm font-medium", children: formattedDescription })
|
|
783
|
+
] }),
|
|
784
|
+
/* @__PURE__ */ jsxs7("div", { className: "flex flex-col sm:flex-row gap-4 items-end max-w-xl", children: [
|
|
785
|
+
/* @__PURE__ */ jsx12("div", { className: "flex-1 w-full", children: /* @__PURE__ */ jsx12(
|
|
786
|
+
Input,
|
|
787
|
+
{
|
|
788
|
+
label: inputLabel,
|
|
789
|
+
onChange: (e) => onInputChange(e.target.value),
|
|
790
|
+
placeholder: inputPlaceholder,
|
|
791
|
+
value: inputValue
|
|
792
|
+
}
|
|
793
|
+
) }),
|
|
794
|
+
/* @__PURE__ */ jsx12(
|
|
795
|
+
Button,
|
|
796
|
+
{
|
|
797
|
+
className: "bg-error/10 hover:bg-error/20 border-error/20 text-error h-12 rounded-2xl px-6 w-full sm:w-auto shrink-0",
|
|
798
|
+
disabled: !inputValue.trim() || isDeleting,
|
|
799
|
+
isLoading: isDeleting,
|
|
800
|
+
onClick: onConfirmDelete,
|
|
801
|
+
variant: "secondary",
|
|
802
|
+
children: "Permanently delete"
|
|
803
|
+
}
|
|
804
|
+
)
|
|
805
|
+
] })
|
|
806
|
+
]
|
|
807
|
+
}
|
|
808
|
+
);
|
|
809
|
+
}
|
|
810
|
+
|
|
811
|
+
// src/ui/EmptyState.tsx
|
|
812
|
+
import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
813
|
+
function EmptyState({
|
|
814
|
+
icon: Icon,
|
|
815
|
+
title,
|
|
816
|
+
description,
|
|
817
|
+
action,
|
|
818
|
+
className = ""
|
|
819
|
+
}) {
|
|
820
|
+
return /* @__PURE__ */ jsxs8(
|
|
821
|
+
"div",
|
|
822
|
+
{
|
|
823
|
+
className: `flex flex-col items-center justify-center text-center gap-2 py-12 ${className}`,
|
|
824
|
+
children: [
|
|
825
|
+
/* @__PURE__ */ jsx13(Icon, { className: "w-8 h-8 text-muted-foreground mb-2" }),
|
|
826
|
+
/* @__PURE__ */ jsx13("h3", { className: "text-lg font-bold", children: title }),
|
|
827
|
+
description && /* @__PURE__ */ jsx13("p", { className: "text-sm text-muted-foreground max-w-xs", children: description }),
|
|
828
|
+
action && /* @__PURE__ */ jsx13("div", { className: "mt-3", children: action })
|
|
829
|
+
]
|
|
830
|
+
}
|
|
831
|
+
);
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
// src/ui/GraphQLPlayground.tsx
|
|
835
|
+
import {
|
|
836
|
+
Check as Check2,
|
|
837
|
+
Code2,
|
|
838
|
+
Copy as Copy2,
|
|
839
|
+
Database,
|
|
840
|
+
Key,
|
|
841
|
+
Play,
|
|
842
|
+
RotateCcw,
|
|
843
|
+
ShieldAlert as ShieldAlert2,
|
|
844
|
+
ShieldCheck as ShieldCheck2,
|
|
845
|
+
Sparkles,
|
|
846
|
+
Terminal
|
|
847
|
+
} from "lucide-react";
|
|
848
|
+
import { useState as useState5 } from "react";
|
|
849
|
+
import { Fragment, jsx as jsx14, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
850
|
+
function GraphQLPlayground({
|
|
851
|
+
title = "GraphQL API Playground",
|
|
852
|
+
description = "Query the database in real-time. Choose a preset below or write custom queries to validate your scoped permissions.",
|
|
853
|
+
presets,
|
|
854
|
+
onExecute,
|
|
855
|
+
hasToken = false,
|
|
856
|
+
authError = false,
|
|
857
|
+
onConfigureToken
|
|
858
|
+
}) {
|
|
859
|
+
const [query, setQuery] = useState5(presets[0]?.query || "");
|
|
860
|
+
const [variables, setVariables] = useState5(presets[0]?.variables || "");
|
|
861
|
+
const [response, setResponse] = useState5(null);
|
|
862
|
+
const [loading, setLoading] = useState5(false);
|
|
863
|
+
const [error, setError] = useState5(null);
|
|
864
|
+
const [latency, setLatency] = useState5(null);
|
|
865
|
+
const [copied, setCopied] = useState5(false);
|
|
866
|
+
const handleApplyPreset = (preset) => {
|
|
867
|
+
setQuery(preset.query);
|
|
868
|
+
setVariables(preset.variables || "");
|
|
869
|
+
setError(null);
|
|
870
|
+
};
|
|
871
|
+
const handleRunQuery = async () => {
|
|
872
|
+
setLoading(true);
|
|
873
|
+
setError(null);
|
|
874
|
+
setResponse(null);
|
|
875
|
+
setLatency(null);
|
|
876
|
+
const startTime = performance.now();
|
|
877
|
+
try {
|
|
878
|
+
let parsedVariables;
|
|
879
|
+
if (variables.trim()) {
|
|
880
|
+
try {
|
|
881
|
+
parsedVariables = JSON.parse(variables.trim());
|
|
882
|
+
} catch (jsonErr) {
|
|
883
|
+
throw new Error(
|
|
884
|
+
`Invalid JSON in Variables: ${jsonErr.message}`
|
|
885
|
+
);
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
const res = await onExecute(query, parsedVariables);
|
|
889
|
+
const endTime = performance.now();
|
|
890
|
+
setLatency(Math.round(endTime - startTime));
|
|
891
|
+
if (res?.errors && res.errors.length > 0) {
|
|
892
|
+
setResponse(res);
|
|
893
|
+
setError(res.errors[0].message || "GraphQL Error returned");
|
|
894
|
+
} else if (res?.data) {
|
|
895
|
+
setResponse(res.data);
|
|
896
|
+
} else {
|
|
897
|
+
setResponse(res);
|
|
898
|
+
}
|
|
899
|
+
} catch (err) {
|
|
900
|
+
const endTime = performance.now();
|
|
901
|
+
setLatency(Math.round(endTime - startTime));
|
|
902
|
+
setError(err.message || "An unexpected error occurred");
|
|
903
|
+
} finally {
|
|
904
|
+
setLoading(false);
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
const handleCopyResponse = () => {
|
|
908
|
+
if (!response) return;
|
|
909
|
+
navigator.clipboard.writeText(JSON.stringify(response, null, 2));
|
|
910
|
+
setCopied(true);
|
|
911
|
+
setTimeout(() => setCopied(false), 2e3);
|
|
912
|
+
};
|
|
913
|
+
const handleReset = () => {
|
|
914
|
+
setQuery(presets[0]?.query || "");
|
|
915
|
+
setVariables(presets[0]?.variables || "");
|
|
916
|
+
setResponse(null);
|
|
917
|
+
setError(null);
|
|
918
|
+
setLatency(null);
|
|
919
|
+
};
|
|
920
|
+
return /* @__PURE__ */ jsxs9("section", { className: "bg-card/30 backdrop-blur-md border border-white/5 rounded-3xl p-8 shadow-2xl relative overflow-hidden space-y-8", children: [
|
|
921
|
+
/* @__PURE__ */ jsx14("div", { className: "absolute top-0 right-0 w-80 h-80 bg-primary/5 rounded-full blur-3xl -mr-20 -mt-20 pointer-events-none" }),
|
|
922
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center justify-between gap-4 border-b border-white/5 pb-6", children: [
|
|
923
|
+
/* @__PURE__ */ jsxs9("div", { className: "space-y-1", children: [
|
|
924
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-2", children: [
|
|
925
|
+
/* @__PURE__ */ jsx14("span", { className: "p-2 bg-primary/10 rounded-xl text-primary shrink-0", children: /* @__PURE__ */ jsx14(Terminal, { className: "w-5 h-5" }) }),
|
|
926
|
+
/* @__PURE__ */ jsx14("h2", { className: "text-2xl font-black tracking-tight uppercase", children: title })
|
|
927
|
+
] }),
|
|
928
|
+
/* @__PURE__ */ jsx14("p", { className: "text-muted-foreground text-xs font-medium max-w-xl", children: description })
|
|
929
|
+
] }),
|
|
930
|
+
onConfigureToken && /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-3", children: hasToken ? /* @__PURE__ */ jsx14("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsx14("button", { onClick: onConfigureToken, type: "button", children: /* @__PURE__ */ jsx14(
|
|
931
|
+
Badge,
|
|
932
|
+
{
|
|
933
|
+
className: authError ? "hover:bg-error/25" : "hover:bg-success/25",
|
|
934
|
+
variant: authError ? "error" : "success",
|
|
935
|
+
children: authError ? /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
936
|
+
/* @__PURE__ */ jsx14(ShieldAlert2, { className: "w-3.5 h-3.5 text-error animate-pulse" }),
|
|
937
|
+
"Auth Error"
|
|
938
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
939
|
+
/* @__PURE__ */ jsx14(ShieldCheck2, { className: "w-3.5 h-3.5 text-success" }),
|
|
940
|
+
"Active Token"
|
|
941
|
+
] })
|
|
942
|
+
}
|
|
943
|
+
) }) }) : /* @__PURE__ */ jsxs9(
|
|
944
|
+
Button,
|
|
945
|
+
{
|
|
946
|
+
className: "h-9 px-4 rounded-xl bg-warning/10 border border-warning/20 hover:bg-warning/20 text-warning transition-all shadow-lg shadow-warning/5 animate-pulse",
|
|
947
|
+
onClick: onConfigureToken,
|
|
948
|
+
children: [
|
|
949
|
+
/* @__PURE__ */ jsx14(Key, { className: "w-3.5 h-3.5 mr-2" }),
|
|
950
|
+
"Configure Token"
|
|
951
|
+
]
|
|
952
|
+
}
|
|
953
|
+
) })
|
|
954
|
+
] }),
|
|
955
|
+
presets && presets.length > 0 && /* @__PURE__ */ jsxs9("div", { className: "space-y-3", children: [
|
|
956
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-1 text-primary", children: [
|
|
957
|
+
/* @__PURE__ */ jsx14(Sparkles, { className: "w-3.5 h-3.5" }),
|
|
958
|
+
/* @__PURE__ */ jsx14("p", { className: "text-xs font-black uppercase tracking-widest text-muted-foreground", children: "Interactive Presets" })
|
|
959
|
+
] }),
|
|
960
|
+
/* @__PURE__ */ jsx14("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: presets.map((preset) => /* @__PURE__ */ jsxs9(
|
|
961
|
+
"button",
|
|
962
|
+
{
|
|
963
|
+
className: "bg-card/50 hover:bg-card border border-white/5 hover:border-primary/30 p-4 rounded-2xl text-left transition-all group relative overflow-hidden",
|
|
964
|
+
onClick: () => handleApplyPreset(preset),
|
|
965
|
+
type: "button",
|
|
966
|
+
children: [
|
|
967
|
+
/* @__PURE__ */ jsx14("h4", { className: "text-xs font-black uppercase tracking-wider text-foreground group-hover:text-primary transition-colors", children: preset.name }),
|
|
968
|
+
/* @__PURE__ */ jsx14("p", { className: "text-xs text-muted-foreground/80 font-medium leading-relaxed mt-1", children: preset.description })
|
|
969
|
+
]
|
|
970
|
+
},
|
|
971
|
+
preset.name
|
|
972
|
+
)) })
|
|
973
|
+
] }),
|
|
974
|
+
/* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-1 xl:grid-cols-2 gap-8", children: [
|
|
975
|
+
/* @__PURE__ */ jsxs9("div", { className: "space-y-4 flex flex-col h-full", children: [
|
|
976
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between px-1", children: [
|
|
977
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-xs font-black uppercase tracking-widest text-muted-foreground flex items-center gap-1.5", children: [
|
|
978
|
+
/* @__PURE__ */ jsx14(Code2, { className: "w-4 h-4 text-primary" }),
|
|
979
|
+
" Query Editor"
|
|
980
|
+
] }),
|
|
981
|
+
/* @__PURE__ */ jsxs9(
|
|
982
|
+
"button",
|
|
983
|
+
{
|
|
984
|
+
className: "text-xs font-black uppercase tracking-widest text-muted-foreground/60 hover:text-foreground transition-colors flex items-center gap-1",
|
|
985
|
+
onClick: handleReset,
|
|
986
|
+
type: "button",
|
|
987
|
+
children: [
|
|
988
|
+
/* @__PURE__ */ jsx14(RotateCcw, { className: "w-3 h-3" }),
|
|
989
|
+
" Reset"
|
|
990
|
+
]
|
|
991
|
+
}
|
|
992
|
+
)
|
|
993
|
+
] }),
|
|
994
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex-1 flex flex-col space-y-4", children: [
|
|
995
|
+
/* @__PURE__ */ jsx14(
|
|
996
|
+
"textarea",
|
|
997
|
+
{
|
|
998
|
+
className: "w-full flex-1 min-h-64 bg-black/40 border border-white/5 focus:border-primary/50 rounded-2xl p-4 font-mono text-xs text-emerald-400 placeholder-white/20 select-all outline-none resize-y shadow-inner leading-relaxed",
|
|
999
|
+
onChange: (e) => setQuery(e.target.value),
|
|
1000
|
+
placeholder: "# Write your GraphQL query here...",
|
|
1001
|
+
spellCheck: "false",
|
|
1002
|
+
value: query
|
|
1003
|
+
}
|
|
1004
|
+
),
|
|
1005
|
+
/* @__PURE__ */ jsxs9("div", { className: "space-y-2", children: [
|
|
1006
|
+
/* @__PURE__ */ jsx14("span", { className: "text-xs font-black uppercase tracking-widest text-muted-foreground block px-1", children: "Variables (JSON Optional)" }),
|
|
1007
|
+
/* @__PURE__ */ jsx14(
|
|
1008
|
+
"textarea",
|
|
1009
|
+
{
|
|
1010
|
+
className: "w-full h-24 bg-black/40 border border-white/5 focus:border-primary/50 rounded-2xl p-4 font-mono text-xs text-cyan-400 placeholder-white/20 select-all outline-none resize-none shadow-inner leading-relaxed",
|
|
1011
|
+
onChange: (e) => setVariables(e.target.value),
|
|
1012
|
+
placeholder: "{}",
|
|
1013
|
+
spellCheck: "false",
|
|
1014
|
+
value: variables
|
|
1015
|
+
}
|
|
1016
|
+
)
|
|
1017
|
+
] })
|
|
1018
|
+
] }),
|
|
1019
|
+
/* @__PURE__ */ jsx14(
|
|
1020
|
+
Button,
|
|
1021
|
+
{
|
|
1022
|
+
className: "w-full h-12 rounded-xl shadow-xl shadow-primary/20 hover:scale-101 active:scale-99 transition-transform duration-200",
|
|
1023
|
+
isLoading: loading,
|
|
1024
|
+
onClick: handleRunQuery,
|
|
1025
|
+
children: loading ? "Executing Query..." : /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
1026
|
+
/* @__PURE__ */ jsx14(Play, { className: "w-4 h-4 mr-2" }),
|
|
1027
|
+
" Execute Query"
|
|
1028
|
+
] })
|
|
1029
|
+
}
|
|
1030
|
+
)
|
|
1031
|
+
] }),
|
|
1032
|
+
/* @__PURE__ */ jsxs9("div", { className: "space-y-4 flex flex-col h-full", children: [
|
|
1033
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between px-1", children: [
|
|
1034
|
+
/* @__PURE__ */ jsxs9("span", { className: "text-xs font-black uppercase tracking-widest text-muted-foreground flex items-center gap-1.5", children: [
|
|
1035
|
+
/* @__PURE__ */ jsx14(Database, { className: "w-4 h-4 text-primary" }),
|
|
1036
|
+
" Response Output"
|
|
1037
|
+
] }),
|
|
1038
|
+
latency !== null && /* @__PURE__ */ jsxs9("span", { className: "text-xs font-mono text-muted-foreground font-black", children: [
|
|
1039
|
+
latency,
|
|
1040
|
+
"ms"
|
|
1041
|
+
] })
|
|
1042
|
+
] }),
|
|
1043
|
+
/* @__PURE__ */ jsxs9("div", { className: "flex-1 bg-black/50 border border-white/5 rounded-2xl p-4 min-h-88 relative overflow-hidden flex flex-col", children: [
|
|
1044
|
+
error && /* @__PURE__ */ jsx14("div", { className: "absolute top-4 left-4 right-4 z-10", children: /* @__PURE__ */ jsx14(Banner, { message: error, variant: "error" }) }),
|
|
1045
|
+
/* @__PURE__ */ jsx14("div", { className: "flex-1 overflow-auto max-h-112 font-mono text-xs text-white/90 leading-relaxed pr-2", children: response ? /* @__PURE__ */ jsx14("pre", { children: JSON.stringify(response, null, 2) }) : /* @__PURE__ */ jsxs9("div", { className: "h-full flex flex-col items-center justify-center text-center text-muted-foreground/30 italic text-xs font-semibold py-20", children: [
|
|
1046
|
+
/* @__PURE__ */ jsx14(Terminal, { className: "w-12 h-12 mb-3 opacity-20" }),
|
|
1047
|
+
"Ready to listen. Run a query!"
|
|
1048
|
+
] }) }),
|
|
1049
|
+
response !== null && /* @__PURE__ */ jsx14("div", { className: "absolute bottom-4 right-4", children: /* @__PURE__ */ jsx14(
|
|
1050
|
+
"button",
|
|
1051
|
+
{
|
|
1052
|
+
className: `flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-xs font-black uppercase tracking-widest shadow-lg transition-all ${copied ? "bg-success/20 text-success border border-success/30" : "bg-primary/20 text-primary border border-primary/30 hover:bg-primary/35"}`,
|
|
1053
|
+
onClick: handleCopyResponse,
|
|
1054
|
+
type: "button",
|
|
1055
|
+
children: copied ? /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
1056
|
+
/* @__PURE__ */ jsx14(Check2, { className: "w-3.5 h-3.5" }),
|
|
1057
|
+
" Copied!"
|
|
1058
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment, { children: [
|
|
1059
|
+
/* @__PURE__ */ jsx14(Copy2, { className: "w-3.5 h-3.5" }),
|
|
1060
|
+
" Copy JSON"
|
|
1061
|
+
] })
|
|
1062
|
+
}
|
|
1063
|
+
) })
|
|
1064
|
+
] })
|
|
1065
|
+
] })
|
|
1066
|
+
] })
|
|
1067
|
+
] });
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
// src/ui/IconButton.tsx
|
|
1071
|
+
import { Loader2 as Loader22 } from "lucide-react";
|
|
1072
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
1073
|
+
import { jsx as jsx15 } from "react/jsx-runtime";
|
|
1074
|
+
var VARIANTS2 = {
|
|
1075
|
+
danger: "hover:bg-error/10 hover:text-error",
|
|
1076
|
+
default: "hover:bg-primary/10 hover:text-primary",
|
|
1077
|
+
success: "hover:bg-success/10 hover:text-success"
|
|
1078
|
+
};
|
|
1079
|
+
var IconButton = forwardRef3(
|
|
1080
|
+
({
|
|
1081
|
+
icon: Icon,
|
|
1082
|
+
label,
|
|
1083
|
+
variant = "default",
|
|
1084
|
+
isLoading = false,
|
|
1085
|
+
spin = false,
|
|
1086
|
+
className,
|
|
1087
|
+
disabled,
|
|
1088
|
+
type = "button",
|
|
1089
|
+
...props
|
|
1090
|
+
}, ref) => /* @__PURE__ */ jsx15(
|
|
1091
|
+
"button",
|
|
1092
|
+
{
|
|
1093
|
+
"aria-label": label,
|
|
1094
|
+
className: cn(
|
|
1095
|
+
"p-2 rounded-lg transition-all text-muted-foreground disabled:opacity-50 disabled:pointer-events-none",
|
|
1096
|
+
VARIANTS2[variant],
|
|
1097
|
+
className
|
|
1098
|
+
),
|
|
1099
|
+
disabled: disabled || isLoading,
|
|
1100
|
+
ref,
|
|
1101
|
+
title: label,
|
|
1102
|
+
type,
|
|
1103
|
+
...props,
|
|
1104
|
+
children: isLoading ? /* @__PURE__ */ jsx15(Loader22, { className: "w-4 h-4 animate-spin" }) : /* @__PURE__ */ jsx15(Icon, { className: cn("w-4 h-4", spin && "animate-spin") })
|
|
1105
|
+
}
|
|
1106
|
+
)
|
|
1107
|
+
);
|
|
1108
|
+
IconButton.displayName = "IconButton";
|
|
1109
|
+
function RowActions({ children, className }) {
|
|
1110
|
+
return /* @__PURE__ */ jsx15("div", { className: cn("flex items-center justify-end gap-2", className), children });
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
// src/ui/ImageUpload.tsx
|
|
1114
|
+
import { ImageIcon as ImageIcon2, Loader2 as Loader23, Trash2, Upload } from "lucide-react";
|
|
1115
|
+
import { useId as useId3, useRef as useRef3, useState as useState7 } from "react";
|
|
1116
|
+
|
|
1117
|
+
// src/utils/image.ts
|
|
1118
|
+
var WEBP_ERROR_MESSAGE = "Only .webp images are allowed. Please select a WebP image.";
|
|
1119
|
+
function isWebp(file) {
|
|
1120
|
+
return file.type === "image/webp" || file.name.toLowerCase().endsWith(".webp");
|
|
1121
|
+
}
|
|
1122
|
+
function assertWebp(file) {
|
|
1123
|
+
if (!isWebp(file)) throw new Error(WEBP_ERROR_MESSAGE);
|
|
1124
|
+
}
|
|
1125
|
+
var WEBP_OR_SVG_ERROR_MESSAGE = "Only .webp or .svg images are allowed. Please select a WebP or SVG image.";
|
|
1126
|
+
function isSvg(file) {
|
|
1127
|
+
return file.type === "image/svg+xml" || file.name.toLowerCase().endsWith(".svg");
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
// src/ui/RemoteImage.tsx
|
|
1131
|
+
import { ImageIcon } from "lucide-react";
|
|
1132
|
+
import { useState as useState6 } from "react";
|
|
1133
|
+
import { jsx as jsx16, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1134
|
+
function RemoteImage({
|
|
1135
|
+
src,
|
|
1136
|
+
alt,
|
|
1137
|
+
className,
|
|
1138
|
+
...props
|
|
1139
|
+
}) {
|
|
1140
|
+
const [error, setError] = useState6(false);
|
|
1141
|
+
if (error || !src) {
|
|
1142
|
+
return /* @__PURE__ */ jsxs10(
|
|
1143
|
+
"div",
|
|
1144
|
+
{
|
|
1145
|
+
className: cn(
|
|
1146
|
+
"flex flex-col items-center justify-center bg-white/5 gap-2 text-muted-foreground",
|
|
1147
|
+
className
|
|
1148
|
+
),
|
|
1149
|
+
children: [
|
|
1150
|
+
/* @__PURE__ */ jsx16(ImageIcon, { className: "w-6 h-6 opacity-20" }),
|
|
1151
|
+
/* @__PURE__ */ jsx16("span", { className: "text-xs font-bold uppercase tracking-widest opacity-40", children: "Error" })
|
|
1152
|
+
]
|
|
1153
|
+
}
|
|
1154
|
+
);
|
|
1155
|
+
}
|
|
1156
|
+
return /* @__PURE__ */ jsx16(
|
|
1157
|
+
"img",
|
|
1158
|
+
{
|
|
1159
|
+
alt,
|
|
1160
|
+
className,
|
|
1161
|
+
onError: () => setError(true),
|
|
1162
|
+
src,
|
|
1163
|
+
...props
|
|
1164
|
+
}
|
|
1165
|
+
);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
// src/ui/ImageUpload.tsx
|
|
1169
|
+
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1170
|
+
var ASPECTS = {
|
|
1171
|
+
banner: "aspect-3/1",
|
|
1172
|
+
compact: "h-24 w-24",
|
|
1173
|
+
square: "aspect-square",
|
|
1174
|
+
wide: "h-40"
|
|
1175
|
+
};
|
|
1176
|
+
function ImageUpload({
|
|
1177
|
+
previewUrl,
|
|
1178
|
+
onFile,
|
|
1179
|
+
onError,
|
|
1180
|
+
label,
|
|
1181
|
+
uploading = false,
|
|
1182
|
+
readOnly = false,
|
|
1183
|
+
aspect = "wide",
|
|
1184
|
+
readOnlyHint,
|
|
1185
|
+
allowSvg = false,
|
|
1186
|
+
onRemove,
|
|
1187
|
+
fit = "cover",
|
|
1188
|
+
className
|
|
1189
|
+
}) {
|
|
1190
|
+
const compact = aspect === "compact";
|
|
1191
|
+
const imageClass = cn(
|
|
1192
|
+
"w-full h-full",
|
|
1193
|
+
fit === "cover" ? "object-cover" : "object-contain p-2"
|
|
1194
|
+
);
|
|
1195
|
+
const inputRef = useRef3(null);
|
|
1196
|
+
const inputId = useId3();
|
|
1197
|
+
const [localError, setLocalError] = useState7(null);
|
|
1198
|
+
const handleChange = (event) => {
|
|
1199
|
+
const file = event.target.files?.[0];
|
|
1200
|
+
event.target.value = "";
|
|
1201
|
+
if (!file) return;
|
|
1202
|
+
if (!isWebp(file) && !(allowSvg && isSvg(file))) {
|
|
1203
|
+
const message = allowSvg ? WEBP_OR_SVG_ERROR_MESSAGE : WEBP_ERROR_MESSAGE;
|
|
1204
|
+
setLocalError(message);
|
|
1205
|
+
onError?.(message);
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
setLocalError(null);
|
|
1209
|
+
onFile(file);
|
|
1210
|
+
};
|
|
1211
|
+
const frame = cn(
|
|
1212
|
+
"relative w-full rounded-3xl overflow-hidden bg-white/5",
|
|
1213
|
+
ASPECTS[aspect]
|
|
1214
|
+
);
|
|
1215
|
+
return /* @__PURE__ */ jsxs11("div", { className: cn("space-y-3", className), children: [
|
|
1216
|
+
label && /* @__PURE__ */ jsx17(FieldLabel, { htmlFor: inputId, children: label }),
|
|
1217
|
+
readOnly ? /* @__PURE__ */ jsxs11("div", { className: cn(frame, "border border-white/5"), children: [
|
|
1218
|
+
previewUrl && /* @__PURE__ */ jsx17(
|
|
1219
|
+
RemoteImage,
|
|
1220
|
+
{
|
|
1221
|
+
alt: label ?? "Image",
|
|
1222
|
+
className: imageClass,
|
|
1223
|
+
src: previewUrl
|
|
1224
|
+
}
|
|
1225
|
+
),
|
|
1226
|
+
readOnlyHint && /* @__PURE__ */ jsx17("div", { className: "absolute inset-0 bg-black/50 flex items-center justify-center", children: /* @__PURE__ */ jsx17("p", { className: "text-white text-xs font-black uppercase tracking-widest", children: readOnlyHint }) })
|
|
1227
|
+
] }) : /* @__PURE__ */ jsxs11(
|
|
1228
|
+
"button",
|
|
1229
|
+
{
|
|
1230
|
+
className: cn(
|
|
1231
|
+
frame,
|
|
1232
|
+
"border-2 border-dashed border-white/10 cursor-pointer group hover:border-primary/50 hover:bg-white/10 transition-all"
|
|
1233
|
+
),
|
|
1234
|
+
disabled: uploading,
|
|
1235
|
+
onClick: () => inputRef.current?.click(),
|
|
1236
|
+
type: "button",
|
|
1237
|
+
children: [
|
|
1238
|
+
previewUrl ? /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
1239
|
+
/* @__PURE__ */ jsx17(
|
|
1240
|
+
RemoteImage,
|
|
1241
|
+
{
|
|
1242
|
+
alt: label ?? "Preview",
|
|
1243
|
+
className: imageClass,
|
|
1244
|
+
src: previewUrl
|
|
1245
|
+
}
|
|
1246
|
+
),
|
|
1247
|
+
/* @__PURE__ */ jsx17("div", { className: "absolute inset-0 bg-black/60 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center backdrop-blur-sm", children: compact ? /* @__PURE__ */ jsx17(
|
|
1248
|
+
Upload,
|
|
1249
|
+
{
|
|
1250
|
+
"aria-label": "Change image",
|
|
1251
|
+
className: "w-5 h-5 text-white"
|
|
1252
|
+
}
|
|
1253
|
+
) : /* @__PURE__ */ jsxs11("p", { className: "text-white text-xs font-black uppercase tracking-widest flex items-center gap-2 bg-primary px-4 py-2 rounded-full", children: [
|
|
1254
|
+
/* @__PURE__ */ jsx17(Upload, { className: "w-4 h-4" }),
|
|
1255
|
+
" Change image"
|
|
1256
|
+
] }) })
|
|
1257
|
+
] }) : /* @__PURE__ */ jsxs11("div", { className: "w-full h-full flex flex-col items-center justify-center gap-3 text-muted-foreground group-hover:text-primary transition-all", children: [
|
|
1258
|
+
/* @__PURE__ */ jsx17(
|
|
1259
|
+
"div",
|
|
1260
|
+
{
|
|
1261
|
+
className: cn(
|
|
1262
|
+
"bg-white/5 rounded-2xl group-hover:scale-110 transition-transform",
|
|
1263
|
+
compact ? "p-2" : "p-4"
|
|
1264
|
+
),
|
|
1265
|
+
children: /* @__PURE__ */ jsx17(ImageIcon2, { className: compact ? "w-5 h-5" : "w-8 h-8" })
|
|
1266
|
+
}
|
|
1267
|
+
),
|
|
1268
|
+
/* @__PURE__ */ jsx17(
|
|
1269
|
+
"p",
|
|
1270
|
+
{
|
|
1271
|
+
className: cn(
|
|
1272
|
+
"text-xs font-bold uppercase tracking-widest",
|
|
1273
|
+
compact && "sr-only"
|
|
1274
|
+
),
|
|
1275
|
+
children: allowSvg ? "Click to upload (.webp, .svg)" : "Click to upload (.webp)"
|
|
1276
|
+
}
|
|
1277
|
+
)
|
|
1278
|
+
] }),
|
|
1279
|
+
uploading && /* @__PURE__ */ jsx17("div", { className: "absolute inset-0 bg-black/40 flex items-center justify-center backdrop-blur-sm", children: /* @__PURE__ */ jsx17(Loader23, { className: "w-8 h-8 animate-spin text-white" }) })
|
|
1280
|
+
]
|
|
1281
|
+
}
|
|
1282
|
+
),
|
|
1283
|
+
onRemove && previewUrl && /* @__PURE__ */ jsxs11(
|
|
1284
|
+
"button",
|
|
1285
|
+
{
|
|
1286
|
+
className: "flex items-center gap-2 text-xs font-bold uppercase tracking-widest text-muted-foreground hover:text-error transition-colors",
|
|
1287
|
+
onClick: onRemove,
|
|
1288
|
+
type: "button",
|
|
1289
|
+
children: [
|
|
1290
|
+
/* @__PURE__ */ jsx17(Trash2, { className: "w-4 h-4" }),
|
|
1291
|
+
" Remove image"
|
|
1292
|
+
]
|
|
1293
|
+
}
|
|
1294
|
+
),
|
|
1295
|
+
/* @__PURE__ */ jsx17(
|
|
1296
|
+
"input",
|
|
1297
|
+
{
|
|
1298
|
+
accept: allowSvg ? "image/webp,image/svg+xml" : "image/webp",
|
|
1299
|
+
className: "hidden",
|
|
1300
|
+
id: inputId,
|
|
1301
|
+
onChange: handleChange,
|
|
1302
|
+
ref: inputRef,
|
|
1303
|
+
type: "file"
|
|
1304
|
+
}
|
|
1305
|
+
),
|
|
1306
|
+
localError && !onError && /* @__PURE__ */ jsx17("p", { className: "text-xs text-error font-bold", children: localError })
|
|
1307
|
+
] });
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
// src/ui/LoadingState.tsx
|
|
1311
|
+
import { Loader2 as Loader24 } from "lucide-react";
|
|
1312
|
+
import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1313
|
+
var SIZES = { lg: "w-10 h-10", md: "w-8 h-8", sm: "w-5 h-5" };
|
|
1314
|
+
var PADDINGS2 = { lg: "py-24", md: "py-16", none: "", sm: "py-6" };
|
|
1315
|
+
function LoadingState({
|
|
1316
|
+
size = "md",
|
|
1317
|
+
padding = "md",
|
|
1318
|
+
label,
|
|
1319
|
+
className
|
|
1320
|
+
}) {
|
|
1321
|
+
return /* @__PURE__ */ jsxs12(
|
|
1322
|
+
"div",
|
|
1323
|
+
{
|
|
1324
|
+
"aria-busy": "true",
|
|
1325
|
+
className: cn(
|
|
1326
|
+
"flex flex-col items-center justify-center gap-3",
|
|
1327
|
+
PADDINGS2[padding],
|
|
1328
|
+
className
|
|
1329
|
+
),
|
|
1330
|
+
role: "status",
|
|
1331
|
+
children: [
|
|
1332
|
+
/* @__PURE__ */ jsx18(Loader24, { className: cn("animate-spin text-primary", SIZES[size]) }),
|
|
1333
|
+
label ? /* @__PURE__ */ jsx18("p", { className: "text-xs text-muted-foreground font-medium", children: label }) : /* @__PURE__ */ jsx18("span", { className: "sr-only", children: "Loading" })
|
|
1334
|
+
]
|
|
1335
|
+
}
|
|
1336
|
+
);
|
|
1337
|
+
}
|
|
1338
|
+
|
|
1339
|
+
// src/ui/LoadMoreButton.tsx
|
|
1340
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
1341
|
+
function LoadMoreButton({
|
|
1342
|
+
onClick,
|
|
1343
|
+
loading = false,
|
|
1344
|
+
label = "Load more"
|
|
1345
|
+
}) {
|
|
1346
|
+
return /* @__PURE__ */ jsx19("div", { className: "flex justify-center pt-4", children: /* @__PURE__ */ jsx19(
|
|
1347
|
+
Button,
|
|
1348
|
+
{
|
|
1349
|
+
className: "h-12 px-10 rounded-2xl bg-white/5 border-white/5 hover:bg-white/10",
|
|
1350
|
+
isLoading: loading,
|
|
1351
|
+
onClick,
|
|
1352
|
+
type: "button",
|
|
1353
|
+
variant: "secondary",
|
|
1354
|
+
children: loading ? "Loading..." : label
|
|
1355
|
+
}
|
|
1356
|
+
) });
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
// src/ui/MarkdownEditor.tsx
|
|
1360
|
+
import { Bold, Code, Edit3, Eye, Heading, Italic, List } from "lucide-react";
|
|
1361
|
+
import { useRef as useRef4, useState as useState8 } from "react";
|
|
1362
|
+
|
|
1363
|
+
// src/utils/markdown.ts
|
|
1364
|
+
import DOMPurify from "dompurify";
|
|
1365
|
+
var MARKDOWN_ALLOWED_TAGS = [
|
|
1366
|
+
"p",
|
|
1367
|
+
"strong",
|
|
1368
|
+
"em",
|
|
1369
|
+
"code",
|
|
1370
|
+
"pre",
|
|
1371
|
+
"h1",
|
|
1372
|
+
"h2",
|
|
1373
|
+
"h3",
|
|
1374
|
+
"ul",
|
|
1375
|
+
"li",
|
|
1376
|
+
"a",
|
|
1377
|
+
"br"
|
|
1378
|
+
];
|
|
1379
|
+
var MARKDOWN_ALLOWED_ATTR = ["class", "href", "target", "rel"];
|
|
1380
|
+
var encodeBase64 = (str) => {
|
|
1381
|
+
if (!str) return "";
|
|
1382
|
+
try {
|
|
1383
|
+
return btoa(
|
|
1384
|
+
encodeURIComponent(str).replace(
|
|
1385
|
+
/%([0-9A-F]{2})/g,
|
|
1386
|
+
(_, p1) => String.fromCharCode(parseInt(p1, 16))
|
|
1387
|
+
)
|
|
1388
|
+
);
|
|
1389
|
+
} catch (e) {
|
|
1390
|
+
console.error("Failed to encode base64:", e);
|
|
1391
|
+
return str;
|
|
1392
|
+
}
|
|
1393
|
+
};
|
|
1394
|
+
var decodeBase64 = (str) => {
|
|
1395
|
+
if (!str) return "";
|
|
1396
|
+
try {
|
|
1397
|
+
return decodeURIComponent(
|
|
1398
|
+
atob(str).split("").map((c) => `%${`00${c.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")
|
|
1399
|
+
);
|
|
1400
|
+
} catch {
|
|
1401
|
+
return str;
|
|
1402
|
+
}
|
|
1403
|
+
};
|
|
1404
|
+
function parseMarkdown(md) {
|
|
1405
|
+
if (!md) return "";
|
|
1406
|
+
let html = md.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
1407
|
+
html = html.replace(/```([\s\S]*?)```/g, (_, code) => {
|
|
1408
|
+
const cleanCode = code.replace(/^[a-zA-Z0-9_-]+\n/, "");
|
|
1409
|
+
return `<pre class="bg-white/5 p-4 rounded-xl font-mono text-xs my-3 overflow-x-auto border border-white/10 text-muted-foreground"><code>${cleanCode.trim()}</code></pre>`;
|
|
1410
|
+
});
|
|
1411
|
+
html = html.replace(
|
|
1412
|
+
/`([^`]+)`/g,
|
|
1413
|
+
'<code class="bg-white/10 px-1.5 py-0.5 rounded font-mono text-xs text-primary">$1</code>'
|
|
1414
|
+
);
|
|
1415
|
+
html = html.replace(
|
|
1416
|
+
/^### (.*$)/gim,
|
|
1417
|
+
'<h3 class="text-sm font-bold mt-4 mb-2 text-white">$1</h3>'
|
|
1418
|
+
);
|
|
1419
|
+
html = html.replace(
|
|
1420
|
+
/^## (.*$)/gim,
|
|
1421
|
+
'<h2 class="text-base font-black mt-5 mb-2 text-white border-b border-white/5 pb-1">$1</h2>'
|
|
1422
|
+
);
|
|
1423
|
+
html = html.replace(
|
|
1424
|
+
/^# (.*$)/gim,
|
|
1425
|
+
'<h1 class="text-lg font-black mt-6 mb-3 text-primary">$1</h1>'
|
|
1426
|
+
);
|
|
1427
|
+
html = html.replace(
|
|
1428
|
+
/\*\*([^*]+)\*\*/g,
|
|
1429
|
+
'<strong class="font-bold text-white">$1</strong>'
|
|
1430
|
+
);
|
|
1431
|
+
html = html.replace(/\*([^*]+)\*/g, '<em class="italic">$1</em>');
|
|
1432
|
+
const sanitizeUrl = (urlStr) => {
|
|
1433
|
+
const trimmed = urlStr.trim();
|
|
1434
|
+
if (/^(https?:\/\/|\/|#|mailto:|tel:)/i.test(trimmed)) {
|
|
1435
|
+
return trimmed.replace(/"/g, """);
|
|
1436
|
+
}
|
|
1437
|
+
return "";
|
|
1438
|
+
};
|
|
1439
|
+
html = html.replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, text, url) => {
|
|
1440
|
+
const sanitized = sanitizeUrl(url);
|
|
1441
|
+
if (!sanitized) {
|
|
1442
|
+
return text;
|
|
1443
|
+
}
|
|
1444
|
+
return `<a href="${sanitized}" target="_blank" rel="noopener noreferrer" class="text-primary hover:underline">${text}</a>`;
|
|
1445
|
+
});
|
|
1446
|
+
const lines = html.split("\n");
|
|
1447
|
+
let inList = false;
|
|
1448
|
+
const processedLines = [];
|
|
1449
|
+
for (let i = 0; i < lines.length; i++) {
|
|
1450
|
+
const line = lines[i];
|
|
1451
|
+
const listMatch = line.match(/^\s*[-*]\s+(.*)$/);
|
|
1452
|
+
if (listMatch) {
|
|
1453
|
+
if (!inList) {
|
|
1454
|
+
processedLines.push('<ul class="list-disc pl-5 my-2 space-y-1">');
|
|
1455
|
+
inList = true;
|
|
1456
|
+
}
|
|
1457
|
+
processedLines.push(
|
|
1458
|
+
`<li class="text-sm text-muted-foreground">${listMatch[1]}</li>`
|
|
1459
|
+
);
|
|
1460
|
+
} else {
|
|
1461
|
+
if (inList) {
|
|
1462
|
+
processedLines.push("</ul>");
|
|
1463
|
+
inList = false;
|
|
1464
|
+
}
|
|
1465
|
+
const trimmed = line.trim();
|
|
1466
|
+
if (trimmed === "") {
|
|
1467
|
+
continue;
|
|
1468
|
+
}
|
|
1469
|
+
if (trimmed.startsWith("<h") || trimmed.startsWith("<pre") || trimmed.startsWith("<ul") || trimmed.startsWith("</ul") || trimmed.startsWith("<li") || trimmed.startsWith("<a")) {
|
|
1470
|
+
processedLines.push(line);
|
|
1471
|
+
} else {
|
|
1472
|
+
processedLines.push(
|
|
1473
|
+
`<p class="text-sm text-muted-foreground leading-relaxed my-2">${line}</p>`
|
|
1474
|
+
);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
if (inList) {
|
|
1479
|
+
processedLines.push("</ul>");
|
|
1480
|
+
}
|
|
1481
|
+
return DOMPurify.sanitize(processedLines.join("\n"), {
|
|
1482
|
+
ALLOWED_ATTR: MARKDOWN_ALLOWED_ATTR,
|
|
1483
|
+
ALLOWED_TAGS: MARKDOWN_ALLOWED_TAGS
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
function stripMarkdown(md) {
|
|
1487
|
+
if (!md) return "";
|
|
1488
|
+
return md.replace(/```[\s\S]*?```/g, "").replace(/`([^`]+)`/g, "$1").replace(/^#+\s+/gm, "").replace(/^\s*[-*]\s+/gm, "").replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1").replace(/\[([^\]]+)\]\(([^)]+)\)/g, "$1").replace(/\n+/g, " ").trim();
|
|
1489
|
+
}
|
|
1490
|
+
function insertMarkdown(textarea, syntax, setValue, placeholder = "") {
|
|
1491
|
+
if (!textarea) return;
|
|
1492
|
+
const start = textarea.selectionStart;
|
|
1493
|
+
const end = textarea.selectionEnd;
|
|
1494
|
+
const text = textarea.value;
|
|
1495
|
+
const selectedText = text.substring(start, end);
|
|
1496
|
+
let replacement = "";
|
|
1497
|
+
if (syntax === "bold") {
|
|
1498
|
+
replacement = `**${selectedText || placeholder || "bold text"}**`;
|
|
1499
|
+
} else if (syntax === "italic") {
|
|
1500
|
+
replacement = `*${selectedText || placeholder || "italic text"}*`;
|
|
1501
|
+
} else if (syntax === "header") {
|
|
1502
|
+
replacement = `### ${selectedText || placeholder || "Heading"}`;
|
|
1503
|
+
} else if (syntax === "code") {
|
|
1504
|
+
replacement = `\`\`\`
|
|
1505
|
+
${selectedText || placeholder || "code"}
|
|
1506
|
+
\`\`\``;
|
|
1507
|
+
} else if (syntax === "list") {
|
|
1508
|
+
replacement = `- ${selectedText || placeholder || "list item"}`;
|
|
1509
|
+
}
|
|
1510
|
+
const newValue = text.substring(0, start) + replacement + text.substring(end);
|
|
1511
|
+
setValue(newValue);
|
|
1512
|
+
setTimeout(() => {
|
|
1513
|
+
textarea.focus();
|
|
1514
|
+
const newCursorPos = start + replacement.length;
|
|
1515
|
+
textarea.setSelectionRange(newCursorPos, newCursorPos);
|
|
1516
|
+
}, 0);
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
// src/ui/MarkdownEditor.tsx
|
|
1520
|
+
import { jsx as jsx20, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1521
|
+
function MarkdownEditor({
|
|
1522
|
+
label,
|
|
1523
|
+
value,
|
|
1524
|
+
onChange,
|
|
1525
|
+
placeholder = "Write something...",
|
|
1526
|
+
description,
|
|
1527
|
+
minHeight = "min-h-36",
|
|
1528
|
+
maxHeight = "max-h-75",
|
|
1529
|
+
required = false
|
|
1530
|
+
}) {
|
|
1531
|
+
const [activeTab, setActiveTab] = useState8("edit");
|
|
1532
|
+
const textareaRef = useRef4(null);
|
|
1533
|
+
const handleInsertMarkdown = (syntax, placeholderText = "") => {
|
|
1534
|
+
insertMarkdown(textareaRef.current, syntax, onChange, placeholderText);
|
|
1535
|
+
};
|
|
1536
|
+
return /* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
|
|
1537
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between ml-1", children: [
|
|
1538
|
+
/* @__PURE__ */ jsxs13("div", { className: "space-y-1", children: [
|
|
1539
|
+
/* @__PURE__ */ jsxs13("label", { className: "text-xs font-black uppercase tracking-widest text-muted-foreground", children: [
|
|
1540
|
+
label,
|
|
1541
|
+
" ",
|
|
1542
|
+
required && "*"
|
|
1543
|
+
] }),
|
|
1544
|
+
description && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground/60 font-medium leading-tight", children: description })
|
|
1545
|
+
] }),
|
|
1546
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex bg-white/5 border border-white/5 rounded-xl p-0.5", children: [
|
|
1547
|
+
/* @__PURE__ */ jsxs13(
|
|
1548
|
+
"button",
|
|
1549
|
+
{
|
|
1550
|
+
className: `flex items-center gap-1.5 px-3 py-1 text-xs font-black uppercase tracking-wider rounded-lg transition-all ${activeTab === "edit" ? "bg-primary text-white shadow-md shadow-primary/20" : "text-muted-foreground hover:text-white"}`,
|
|
1551
|
+
onClick: () => setActiveTab("edit"),
|
|
1552
|
+
type: "button",
|
|
1553
|
+
children: [
|
|
1554
|
+
/* @__PURE__ */ jsx20(Edit3, { className: "w-3 h-3" }),
|
|
1555
|
+
"Write"
|
|
1556
|
+
]
|
|
1557
|
+
}
|
|
1558
|
+
),
|
|
1559
|
+
/* @__PURE__ */ jsxs13(
|
|
1560
|
+
"button",
|
|
1561
|
+
{
|
|
1562
|
+
className: `flex items-center gap-1.5 px-3 py-1 text-xs font-black uppercase tracking-wider rounded-lg transition-all ${activeTab === "preview" ? "bg-primary text-white shadow-md shadow-primary/20" : "text-muted-foreground hover:text-white"}`,
|
|
1563
|
+
onClick: () => setActiveTab("preview"),
|
|
1564
|
+
type: "button",
|
|
1565
|
+
children: [
|
|
1566
|
+
/* @__PURE__ */ jsx20(Eye, { className: "w-3 h-3" }),
|
|
1567
|
+
"Preview"
|
|
1568
|
+
]
|
|
1569
|
+
}
|
|
1570
|
+
)
|
|
1571
|
+
] })
|
|
1572
|
+
] }),
|
|
1573
|
+
activeTab === "edit" ? /* @__PURE__ */ jsxs13("div", { className: "space-y-1.5 animate-in fade-in duration-200", children: [
|
|
1574
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1 bg-white/2 border border-white/10 rounded-xl p-1.5", children: [
|
|
1575
|
+
/* @__PURE__ */ jsx20(
|
|
1576
|
+
"button",
|
|
1577
|
+
{
|
|
1578
|
+
className: "p-1.5 hover:bg-white/5 rounded-lg text-muted-foreground hover:text-foreground transition-colors",
|
|
1579
|
+
onClick: () => handleInsertMarkdown("bold"),
|
|
1580
|
+
title: "Bold",
|
|
1581
|
+
type: "button",
|
|
1582
|
+
children: /* @__PURE__ */ jsx20(Bold, { className: "w-4 h-4" })
|
|
1583
|
+
}
|
|
1584
|
+
),
|
|
1585
|
+
/* @__PURE__ */ jsx20(
|
|
1586
|
+
"button",
|
|
1587
|
+
{
|
|
1588
|
+
className: "p-1.5 hover:bg-white/5 rounded-lg text-muted-foreground hover:text-foreground transition-colors",
|
|
1589
|
+
onClick: () => handleInsertMarkdown("italic"),
|
|
1590
|
+
title: "Italic",
|
|
1591
|
+
type: "button",
|
|
1592
|
+
children: /* @__PURE__ */ jsx20(Italic, { className: "w-4 h-4" })
|
|
1593
|
+
}
|
|
1594
|
+
),
|
|
1595
|
+
/* @__PURE__ */ jsx20(
|
|
1596
|
+
"button",
|
|
1597
|
+
{
|
|
1598
|
+
className: "p-1.5 hover:bg-white/5 rounded-lg text-muted-foreground hover:text-foreground transition-colors",
|
|
1599
|
+
onClick: () => handleInsertMarkdown("header"),
|
|
1600
|
+
title: "Heading",
|
|
1601
|
+
type: "button",
|
|
1602
|
+
children: /* @__PURE__ */ jsx20(Heading, { className: "w-4 h-4" })
|
|
1603
|
+
}
|
|
1604
|
+
),
|
|
1605
|
+
/* @__PURE__ */ jsx20(
|
|
1606
|
+
"button",
|
|
1607
|
+
{
|
|
1608
|
+
className: "p-1.5 hover:bg-white/5 rounded-lg text-muted-foreground hover:text-foreground transition-colors",
|
|
1609
|
+
onClick: () => handleInsertMarkdown("code"),
|
|
1610
|
+
title: "Code Block",
|
|
1611
|
+
type: "button",
|
|
1612
|
+
children: /* @__PURE__ */ jsx20(Code, { className: "w-4 h-4" })
|
|
1613
|
+
}
|
|
1614
|
+
),
|
|
1615
|
+
/* @__PURE__ */ jsx20(
|
|
1616
|
+
"button",
|
|
1617
|
+
{
|
|
1618
|
+
className: "p-1.5 hover:bg-white/5 rounded-lg text-muted-foreground hover:text-foreground transition-colors",
|
|
1619
|
+
onClick: () => handleInsertMarkdown("list"),
|
|
1620
|
+
title: "Bullet List",
|
|
1621
|
+
type: "button",
|
|
1622
|
+
children: /* @__PURE__ */ jsx20(List, { className: "w-4 h-4" })
|
|
1623
|
+
}
|
|
1624
|
+
)
|
|
1625
|
+
] }),
|
|
1626
|
+
/* @__PURE__ */ jsx20(
|
|
1627
|
+
"textarea",
|
|
1628
|
+
{
|
|
1629
|
+
className: `w-full bg-white/3 border border-white/10 rounded-2xl p-4 text-sm focus:outline-none focus:border-primary/50 transition-all ${minHeight} resize-none font-mono placeholder:font-sans`,
|
|
1630
|
+
onChange: (e) => onChange(e.target.value),
|
|
1631
|
+
placeholder,
|
|
1632
|
+
ref: textareaRef,
|
|
1633
|
+
required,
|
|
1634
|
+
value
|
|
1635
|
+
}
|
|
1636
|
+
)
|
|
1637
|
+
] }) : /* @__PURE__ */ jsx20(
|
|
1638
|
+
"div",
|
|
1639
|
+
{
|
|
1640
|
+
className: `w-full bg-white/1 border border-white/5 rounded-2xl p-4 text-sm ${minHeight} overflow-y-auto ${maxHeight} animate-in fade-in duration-200`,
|
|
1641
|
+
children: value.trim() ? /* @__PURE__ */ jsx20(
|
|
1642
|
+
"div",
|
|
1643
|
+
{
|
|
1644
|
+
className: "prose prose-invert max-w-none space-y-1.5",
|
|
1645
|
+
dangerouslySetInnerHTML: {
|
|
1646
|
+
__html: parseMarkdown(value)
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
) : /* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center justify-center h-full text-muted-foreground/30 font-medium", children: [
|
|
1650
|
+
/* @__PURE__ */ jsx20(Eye, { className: "w-8 h-8 mb-2 opacity-50" }),
|
|
1651
|
+
/* @__PURE__ */ jsx20("p", { className: "text-xs uppercase tracking-wider", children: "Nothing to preview yet" })
|
|
1652
|
+
] })
|
|
1653
|
+
}
|
|
1654
|
+
)
|
|
1655
|
+
] });
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
// src/ui/Modal.tsx
|
|
1659
|
+
import { X as X2 } from "lucide-react";
|
|
1660
|
+
import { useId as useId4 } from "react";
|
|
1661
|
+
import { jsx as jsx21, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
1662
|
+
var SIZES2 = {
|
|
1663
|
+
"2xl": "max-w-2xl",
|
|
1664
|
+
"4xl": "max-w-4xl",
|
|
1665
|
+
"5xl": "max-w-5xl",
|
|
1666
|
+
"6xl": "max-w-6xl",
|
|
1667
|
+
lg: "max-w-lg",
|
|
1668
|
+
md: "max-w-md",
|
|
1669
|
+
xl: "max-w-xl"
|
|
1670
|
+
};
|
|
1671
|
+
function Modal({
|
|
1672
|
+
title,
|
|
1673
|
+
description,
|
|
1674
|
+
icon: Icon,
|
|
1675
|
+
onClose,
|
|
1676
|
+
size = "lg",
|
|
1677
|
+
align = "center",
|
|
1678
|
+
footer,
|
|
1679
|
+
children,
|
|
1680
|
+
className,
|
|
1681
|
+
closeOnBackdrop = false,
|
|
1682
|
+
dismissible = true
|
|
1683
|
+
}) {
|
|
1684
|
+
const titleId = useId4();
|
|
1685
|
+
const descriptionId = useId4();
|
|
1686
|
+
const modalRef = useModalLock({
|
|
1687
|
+
onEscape: dismissible ? onClose : void 0
|
|
1688
|
+
});
|
|
1689
|
+
return /* @__PURE__ */ jsx21(
|
|
1690
|
+
"div",
|
|
1691
|
+
{
|
|
1692
|
+
className: cn(
|
|
1693
|
+
"fixed inset-0 z-50 flex justify-center p-4 bg-background/90 backdrop-blur-md",
|
|
1694
|
+
align === "center" ? "items-center" : "items-start py-16 overflow-y-auto"
|
|
1695
|
+
),
|
|
1696
|
+
onMouseDown: (event) => {
|
|
1697
|
+
if (closeOnBackdrop && dismissible && event.target === event.currentTarget) {
|
|
1698
|
+
onClose();
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1701
|
+
children: /* @__PURE__ */ jsxs14(
|
|
1702
|
+
"div",
|
|
1703
|
+
{
|
|
1704
|
+
"aria-describedby": description ? descriptionId : void 0,
|
|
1705
|
+
"aria-labelledby": titleId,
|
|
1706
|
+
"aria-modal": "true",
|
|
1707
|
+
className: cn(
|
|
1708
|
+
"relative bg-card border border-white/5 w-full rounded-3xl shadow-2xl overflow-hidden",
|
|
1709
|
+
SIZES2[size],
|
|
1710
|
+
className
|
|
1711
|
+
),
|
|
1712
|
+
ref: modalRef,
|
|
1713
|
+
role: "dialog",
|
|
1714
|
+
tabIndex: -1,
|
|
1715
|
+
children: [
|
|
1716
|
+
/* @__PURE__ */ jsxs14("div", { className: "p-8 border-b border-white/5 flex items-center justify-between gap-4 bg-white/5", children: [
|
|
1717
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-4 min-w-0", children: [
|
|
1718
|
+
Icon && /* @__PURE__ */ jsx21("div", { className: "p-3 rounded-2xl bg-primary/10 text-primary shrink-0", children: /* @__PURE__ */ jsx21(Icon, { className: "w-6 h-6" }) }),
|
|
1719
|
+
/* @__PURE__ */ jsxs14("div", { className: "min-w-0", children: [
|
|
1720
|
+
/* @__PURE__ */ jsx21(
|
|
1721
|
+
"h2",
|
|
1722
|
+
{
|
|
1723
|
+
className: "text-2xl font-black tracking-tight uppercase",
|
|
1724
|
+
id: titleId,
|
|
1725
|
+
children: title
|
|
1726
|
+
}
|
|
1727
|
+
),
|
|
1728
|
+
description && /* @__PURE__ */ jsx21(
|
|
1729
|
+
"p",
|
|
1730
|
+
{
|
|
1731
|
+
className: "text-sm text-muted-foreground font-medium mt-1",
|
|
1732
|
+
id: descriptionId,
|
|
1733
|
+
children: description
|
|
1734
|
+
}
|
|
1735
|
+
)
|
|
1736
|
+
] })
|
|
1737
|
+
] }),
|
|
1738
|
+
/* @__PURE__ */ jsx21(
|
|
1739
|
+
"button",
|
|
1740
|
+
{
|
|
1741
|
+
"aria-label": "Close",
|
|
1742
|
+
className: "p-3 hover:bg-white/10 rounded-full transition-all text-muted-foreground hover:text-foreground shrink-0 disabled:opacity-50",
|
|
1743
|
+
disabled: !dismissible,
|
|
1744
|
+
onClick: onClose,
|
|
1745
|
+
type: "button",
|
|
1746
|
+
children: /* @__PURE__ */ jsx21(X2, { className: "w-5 h-5" })
|
|
1747
|
+
}
|
|
1748
|
+
)
|
|
1749
|
+
] }),
|
|
1750
|
+
/* @__PURE__ */ jsxs14("div", { className: "p-8 space-y-6", "data-modal-body": true, children: [
|
|
1751
|
+
children,
|
|
1752
|
+
footer
|
|
1753
|
+
] })
|
|
1754
|
+
]
|
|
1755
|
+
}
|
|
1756
|
+
)
|
|
1757
|
+
}
|
|
1758
|
+
);
|
|
1759
|
+
}
|
|
1760
|
+
function ModalActions({
|
|
1761
|
+
onCancel,
|
|
1762
|
+
submitLabel,
|
|
1763
|
+
cancelLabel = "Cancel",
|
|
1764
|
+
isSubmitting = false,
|
|
1765
|
+
submitDisabled = false,
|
|
1766
|
+
submitType = "submit",
|
|
1767
|
+
onSubmit,
|
|
1768
|
+
variant = "primary"
|
|
1769
|
+
}) {
|
|
1770
|
+
return /* @__PURE__ */ jsxs14("div", { className: "pt-6 flex gap-4", children: [
|
|
1771
|
+
/* @__PURE__ */ jsx21(
|
|
1772
|
+
Button,
|
|
1773
|
+
{
|
|
1774
|
+
className: "flex-1 h-12 rounded-2xl",
|
|
1775
|
+
disabled: isSubmitting,
|
|
1776
|
+
onClick: onCancel,
|
|
1777
|
+
type: "button",
|
|
1778
|
+
variant: "secondary",
|
|
1779
|
+
children: cancelLabel
|
|
1780
|
+
}
|
|
1781
|
+
),
|
|
1782
|
+
/* @__PURE__ */ jsx21(
|
|
1783
|
+
Button,
|
|
1784
|
+
{
|
|
1785
|
+
className: "flex-1 h-12 rounded-2xl shadow-xl shadow-primary/30",
|
|
1786
|
+
disabled: submitDisabled,
|
|
1787
|
+
isLoading: isSubmitting,
|
|
1788
|
+
onClick: submitType === "button" ? onSubmit : void 0,
|
|
1789
|
+
type: submitType,
|
|
1790
|
+
variant,
|
|
1791
|
+
children: submitLabel
|
|
1792
|
+
}
|
|
1793
|
+
)
|
|
1794
|
+
] });
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
// src/ui/PageHeader.tsx
|
|
1798
|
+
import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
1799
|
+
function PageHeader({
|
|
1800
|
+
title,
|
|
1801
|
+
icon: Icon,
|
|
1802
|
+
description,
|
|
1803
|
+
eyebrow,
|
|
1804
|
+
actions,
|
|
1805
|
+
bordered = false,
|
|
1806
|
+
className
|
|
1807
|
+
}) {
|
|
1808
|
+
return /* @__PURE__ */ jsxs15(
|
|
1809
|
+
"header",
|
|
1810
|
+
{
|
|
1811
|
+
className: cn(
|
|
1812
|
+
"flex flex-col md:flex-row md:items-center justify-between gap-4",
|
|
1813
|
+
bordered && "border-b border-white/5 pb-6",
|
|
1814
|
+
className
|
|
1815
|
+
),
|
|
1816
|
+
children: [
|
|
1817
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2 min-w-0", children: [
|
|
1818
|
+
eyebrow && /* @__PURE__ */ jsx22("p", { className: "text-xs font-black uppercase tracking-widest text-primary", children: eyebrow }),
|
|
1819
|
+
/* @__PURE__ */ jsxs15("h1", { className: "text-3xl font-black tracking-tight uppercase flex items-center gap-3", children: [
|
|
1820
|
+
Icon && /* @__PURE__ */ jsx22(Icon, { className: "w-8 h-8 text-primary shrink-0" }),
|
|
1821
|
+
title
|
|
1822
|
+
] }),
|
|
1823
|
+
description && /* @__PURE__ */ jsx22("p", { className: "text-sm text-muted-foreground font-medium", children: description })
|
|
1824
|
+
] }),
|
|
1825
|
+
actions && /* @__PURE__ */ jsx22("div", { className: "flex flex-wrap items-center gap-3", children: actions })
|
|
1826
|
+
]
|
|
1827
|
+
}
|
|
1828
|
+
);
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
// src/ui/Pagination.tsx
|
|
1832
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
1833
|
+
import { jsx as jsx23, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
1834
|
+
function Pagination({
|
|
1835
|
+
page,
|
|
1836
|
+
totalPages,
|
|
1837
|
+
onPageChange,
|
|
1838
|
+
className = ""
|
|
1839
|
+
}) {
|
|
1840
|
+
if (totalPages <= 1) return null;
|
|
1841
|
+
return /* @__PURE__ */ jsxs16(
|
|
1842
|
+
"div",
|
|
1843
|
+
{
|
|
1844
|
+
className: `flex items-center justify-between gap-4 px-1 ${className}`,
|
|
1845
|
+
children: [
|
|
1846
|
+
/* @__PURE__ */ jsxs16(
|
|
1847
|
+
Button,
|
|
1848
|
+
{
|
|
1849
|
+
disabled: page <= 1,
|
|
1850
|
+
onClick: () => onPageChange(page - 1),
|
|
1851
|
+
size: "sm",
|
|
1852
|
+
type: "button",
|
|
1853
|
+
variant: "secondary",
|
|
1854
|
+
children: [
|
|
1855
|
+
/* @__PURE__ */ jsx23(ChevronLeft, { className: "w-4 h-4" }),
|
|
1856
|
+
"Previous"
|
|
1857
|
+
]
|
|
1858
|
+
}
|
|
1859
|
+
),
|
|
1860
|
+
/* @__PURE__ */ jsxs16("span", { className: "text-xs text-muted-foreground font-medium", children: [
|
|
1861
|
+
"Page ",
|
|
1862
|
+
page,
|
|
1863
|
+
" of ",
|
|
1864
|
+
totalPages
|
|
1865
|
+
] }),
|
|
1866
|
+
/* @__PURE__ */ jsxs16(
|
|
1867
|
+
Button,
|
|
1868
|
+
{
|
|
1869
|
+
disabled: page >= totalPages,
|
|
1870
|
+
onClick: () => onPageChange(page + 1),
|
|
1871
|
+
size: "sm",
|
|
1872
|
+
type: "button",
|
|
1873
|
+
variant: "secondary",
|
|
1874
|
+
children: [
|
|
1875
|
+
"Next",
|
|
1876
|
+
/* @__PURE__ */ jsx23(ChevronRight, { className: "w-4 h-4" })
|
|
1877
|
+
]
|
|
1878
|
+
}
|
|
1879
|
+
)
|
|
1880
|
+
]
|
|
1881
|
+
}
|
|
1882
|
+
);
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
// src/ui/SearchInput.tsx
|
|
1886
|
+
import { Search, X as X3 } from "lucide-react";
|
|
1887
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
1888
|
+
import { jsx as jsx24, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1889
|
+
var SearchInput = forwardRef4(
|
|
1890
|
+
({
|
|
1891
|
+
value,
|
|
1892
|
+
onChange,
|
|
1893
|
+
className,
|
|
1894
|
+
placeholder = "Search...",
|
|
1895
|
+
"aria-label": ariaLabel,
|
|
1896
|
+
...props
|
|
1897
|
+
}, ref) => /* @__PURE__ */ jsxs17("div", { className: cn("relative group", className), children: [
|
|
1898
|
+
/* @__PURE__ */ jsx24(Search, { className: "absolute left-4 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground group-focus-within:text-primary transition-colors" }),
|
|
1899
|
+
/* @__PURE__ */ jsx24(
|
|
1900
|
+
"input",
|
|
1901
|
+
{
|
|
1902
|
+
"aria-label": ariaLabel ?? placeholder,
|
|
1903
|
+
className: "w-full bg-white/5 border border-white/5 rounded-2xl py-3 pl-11 pr-11 text-sm font-medium focus:outline-none focus:border-primary/50 transition-all",
|
|
1904
|
+
onChange: (event) => onChange(event.target.value),
|
|
1905
|
+
placeholder,
|
|
1906
|
+
ref,
|
|
1907
|
+
type: "search",
|
|
1908
|
+
value,
|
|
1909
|
+
...props
|
|
1910
|
+
}
|
|
1911
|
+
),
|
|
1912
|
+
value && /* @__PURE__ */ jsx24(
|
|
1913
|
+
"button",
|
|
1914
|
+
{
|
|
1915
|
+
"aria-label": "Clear search",
|
|
1916
|
+
className: "absolute right-3 top-1/2 -translate-y-1/2 p-1 rounded-lg text-muted-foreground hover:text-foreground",
|
|
1917
|
+
onClick: () => onChange(""),
|
|
1918
|
+
type: "button",
|
|
1919
|
+
children: /* @__PURE__ */ jsx24(X3, { className: "w-4 h-4" })
|
|
1920
|
+
}
|
|
1921
|
+
)
|
|
1922
|
+
] })
|
|
1923
|
+
);
|
|
1924
|
+
SearchInput.displayName = "SearchInput";
|
|
1925
|
+
|
|
1926
|
+
// src/ui/SectionHeader.tsx
|
|
1927
|
+
import { jsx as jsx25, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
1928
|
+
function SectionHeader({
|
|
1929
|
+
title,
|
|
1930
|
+
icon: Icon,
|
|
1931
|
+
description,
|
|
1932
|
+
actions,
|
|
1933
|
+
variant = "section",
|
|
1934
|
+
className
|
|
1935
|
+
}) {
|
|
1936
|
+
return /* @__PURE__ */ jsxs18(
|
|
1937
|
+
"div",
|
|
1938
|
+
{
|
|
1939
|
+
className: cn(
|
|
1940
|
+
"flex flex-col md:flex-row md:items-center justify-between gap-4",
|
|
1941
|
+
className
|
|
1942
|
+
),
|
|
1943
|
+
children: [
|
|
1944
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-col gap-1 min-w-0", children: [
|
|
1945
|
+
/* @__PURE__ */ jsxs18(
|
|
1946
|
+
"h2",
|
|
1947
|
+
{
|
|
1948
|
+
className: cn(
|
|
1949
|
+
"flex items-center gap-2",
|
|
1950
|
+
variant === "section" ? "text-2xl font-black tracking-tight uppercase" : "text-xs font-black uppercase tracking-widest text-muted-foreground"
|
|
1951
|
+
),
|
|
1952
|
+
children: [
|
|
1953
|
+
Icon && /* @__PURE__ */ jsx25(
|
|
1954
|
+
Icon,
|
|
1955
|
+
{
|
|
1956
|
+
className: variant === "section" ? "w-6 h-6 text-primary" : "w-4 h-4"
|
|
1957
|
+
}
|
|
1958
|
+
),
|
|
1959
|
+
title
|
|
1960
|
+
]
|
|
1961
|
+
}
|
|
1962
|
+
),
|
|
1963
|
+
description && /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground font-medium", children: description })
|
|
1964
|
+
] }),
|
|
1965
|
+
actions && /* @__PURE__ */ jsx25("div", { className: "flex flex-wrap items-center gap-3", children: actions })
|
|
1966
|
+
]
|
|
1967
|
+
}
|
|
1968
|
+
);
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
// src/ui/Select.tsx
|
|
1972
|
+
import { ChevronDown, Search as Search2 } from "lucide-react";
|
|
1973
|
+
import { useEffect as useEffect3, useId as useId5, useLayoutEffect, useRef as useRef5, useState as useState9 } from "react";
|
|
1974
|
+
import { createPortal } from "react-dom";
|
|
1975
|
+
import { jsx as jsx26, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
1976
|
+
function Select({
|
|
1977
|
+
value,
|
|
1978
|
+
onChange,
|
|
1979
|
+
options,
|
|
1980
|
+
placeholder,
|
|
1981
|
+
disabled,
|
|
1982
|
+
className,
|
|
1983
|
+
id
|
|
1984
|
+
}) {
|
|
1985
|
+
const [open, setOpen] = useState9(false);
|
|
1986
|
+
const [mounted, setMounted] = useState9(false);
|
|
1987
|
+
const [search, setSearch] = useState9("");
|
|
1988
|
+
const [menuRect, setMenuRect] = useState9(null);
|
|
1989
|
+
const rootRef = useRef5(null);
|
|
1990
|
+
const menuRef = useRef5(null);
|
|
1991
|
+
const triggerRef = useRef5(null);
|
|
1992
|
+
const searchInputRef = useRef5(null);
|
|
1993
|
+
const generatedId = useId5();
|
|
1994
|
+
const triggerId = id ?? generatedId;
|
|
1995
|
+
useEffect3(() => {
|
|
1996
|
+
setMounted(true);
|
|
1997
|
+
}, []);
|
|
1998
|
+
useEffect3(() => {
|
|
1999
|
+
if (open) {
|
|
2000
|
+
searchInputRef.current?.focus();
|
|
2001
|
+
} else {
|
|
2002
|
+
setSearch("");
|
|
2003
|
+
}
|
|
2004
|
+
}, [open]);
|
|
2005
|
+
useLayoutEffect(() => {
|
|
2006
|
+
if (!open) return;
|
|
2007
|
+
const updatePosition = () => {
|
|
2008
|
+
const rect = rootRef.current?.getBoundingClientRect();
|
|
2009
|
+
if (!rect) return;
|
|
2010
|
+
setMenuRect({ left: rect.left, top: rect.bottom + 8, width: rect.width });
|
|
2011
|
+
};
|
|
2012
|
+
updatePosition();
|
|
2013
|
+
window.addEventListener("resize", updatePosition);
|
|
2014
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
2015
|
+
return () => {
|
|
2016
|
+
window.removeEventListener("resize", updatePosition);
|
|
2017
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
2018
|
+
};
|
|
2019
|
+
}, [open]);
|
|
2020
|
+
useEffect3(() => {
|
|
2021
|
+
if (!open) return;
|
|
2022
|
+
const handlePointerDown = (e) => {
|
|
2023
|
+
const target = e.target;
|
|
2024
|
+
if (!rootRef.current?.contains(target) && !menuRef.current?.contains(target)) {
|
|
2025
|
+
setOpen(false);
|
|
2026
|
+
}
|
|
2027
|
+
};
|
|
2028
|
+
const handleKeyDown = (e) => {
|
|
2029
|
+
if (e.key === "Escape") {
|
|
2030
|
+
e.preventDefault();
|
|
2031
|
+
e.stopPropagation();
|
|
2032
|
+
setOpen(false);
|
|
2033
|
+
triggerRef.current?.focus();
|
|
2034
|
+
}
|
|
2035
|
+
};
|
|
2036
|
+
document.addEventListener("mousedown", handlePointerDown);
|
|
2037
|
+
document.addEventListener("keydown", handleKeyDown, true);
|
|
2038
|
+
return () => {
|
|
2039
|
+
document.removeEventListener("mousedown", handlePointerDown);
|
|
2040
|
+
document.removeEventListener("keydown", handleKeyDown, true);
|
|
2041
|
+
};
|
|
2042
|
+
}, [open]);
|
|
2043
|
+
const selected = options.find((option) => option.value === value);
|
|
2044
|
+
const query = search.trim().toLowerCase();
|
|
2045
|
+
const filteredOptions = query ? options.filter((option) => option.label.toLowerCase().includes(query)) : options;
|
|
2046
|
+
return /* @__PURE__ */ jsxs19("div", { className: "relative", ref: rootRef, children: [
|
|
2047
|
+
/* @__PURE__ */ jsxs19(
|
|
2048
|
+
"button",
|
|
2049
|
+
{
|
|
2050
|
+
"aria-expanded": open,
|
|
2051
|
+
"aria-haspopup": "listbox",
|
|
2052
|
+
className: cn(
|
|
2053
|
+
"flex items-center justify-between gap-2 disabled:cursor-not-allowed disabled:opacity-50",
|
|
2054
|
+
className
|
|
2055
|
+
),
|
|
2056
|
+
disabled,
|
|
2057
|
+
id: triggerId,
|
|
2058
|
+
onClick: () => setOpen((prev) => !prev),
|
|
2059
|
+
ref: triggerRef,
|
|
2060
|
+
type: "button",
|
|
2061
|
+
children: [
|
|
2062
|
+
/* @__PURE__ */ jsx26(
|
|
2063
|
+
"span",
|
|
2064
|
+
{
|
|
2065
|
+
className: cn(
|
|
2066
|
+
"truncate text-left",
|
|
2067
|
+
!selected && "text-muted-foreground/60"
|
|
2068
|
+
),
|
|
2069
|
+
children: selected ? selected.label : placeholder ?? "Select..."
|
|
2070
|
+
}
|
|
2071
|
+
),
|
|
2072
|
+
/* @__PURE__ */ jsx26(
|
|
2073
|
+
ChevronDown,
|
|
2074
|
+
{
|
|
2075
|
+
className: cn(
|
|
2076
|
+
"w-4 h-4 shrink-0 text-muted-foreground transition-transform",
|
|
2077
|
+
open && "rotate-180"
|
|
2078
|
+
)
|
|
2079
|
+
}
|
|
2080
|
+
)
|
|
2081
|
+
]
|
|
2082
|
+
}
|
|
2083
|
+
),
|
|
2084
|
+
open && mounted && menuRect && createPortal(
|
|
2085
|
+
/* @__PURE__ */ jsxs19(
|
|
2086
|
+
"div",
|
|
2087
|
+
{
|
|
2088
|
+
className: "fixed z-100 flex max-h-80 flex-col overflow-hidden rounded-2xl border border-white/10 bg-card shadow-xl shadow-black/40",
|
|
2089
|
+
"data-modal-portal-content": "",
|
|
2090
|
+
ref: menuRef,
|
|
2091
|
+
style: {
|
|
2092
|
+
left: menuRect.left,
|
|
2093
|
+
top: menuRect.top,
|
|
2094
|
+
width: menuRect.width
|
|
2095
|
+
},
|
|
2096
|
+
children: [
|
|
2097
|
+
/* @__PURE__ */ jsx26("div", { className: "shrink-0 border-b border-white/10 p-2", children: /* @__PURE__ */ jsxs19("div", { className: "relative", children: [
|
|
2098
|
+
/* @__PURE__ */ jsx26(Search2, { className: "pointer-events-none absolute left-3 top-1/2 w-4 h-4 -translate-y-1/2 text-muted-foreground/60" }),
|
|
2099
|
+
/* @__PURE__ */ jsx26(
|
|
2100
|
+
Input,
|
|
2101
|
+
{
|
|
2102
|
+
"aria-label": "Search options",
|
|
2103
|
+
autoComplete: "off",
|
|
2104
|
+
className: "h-9 pl-9 text-sm",
|
|
2105
|
+
onChange: (e) => setSearch(e.target.value),
|
|
2106
|
+
placeholder: "Search...",
|
|
2107
|
+
ref: searchInputRef,
|
|
2108
|
+
value: search
|
|
2109
|
+
}
|
|
2110
|
+
)
|
|
2111
|
+
] }) }),
|
|
2112
|
+
/* @__PURE__ */ jsxs19("div", { className: "min-h-0 overflow-y-auto py-1.5", role: "listbox", children: [
|
|
2113
|
+
filteredOptions.map((option) => /* @__PURE__ */ jsx26(
|
|
2114
|
+
"button",
|
|
2115
|
+
{
|
|
2116
|
+
"aria-selected": option.value === value,
|
|
2117
|
+
className: cn(
|
|
2118
|
+
"w-full flex items-center px-4 py-2.5 text-sm text-left transition-colors",
|
|
2119
|
+
option.value === value ? "bg-primary/15 text-foreground font-bold" : "text-foreground/90 hover:bg-white/5",
|
|
2120
|
+
option.disabled && "opacity-50 pointer-events-none"
|
|
2121
|
+
),
|
|
2122
|
+
disabled: option.disabled,
|
|
2123
|
+
onClick: () => {
|
|
2124
|
+
onChange(option.value);
|
|
2125
|
+
setOpen(false);
|
|
2126
|
+
triggerRef.current?.focus();
|
|
2127
|
+
},
|
|
2128
|
+
role: "option",
|
|
2129
|
+
type: "button",
|
|
2130
|
+
children: option.label
|
|
2131
|
+
},
|
|
2132
|
+
option.value
|
|
2133
|
+
)),
|
|
2134
|
+
filteredOptions.length === 0 && /* @__PURE__ */ jsx26(
|
|
2135
|
+
"div",
|
|
2136
|
+
{
|
|
2137
|
+
className: "px-4 py-3 text-center text-sm text-muted-foreground font-medium",
|
|
2138
|
+
role: "status",
|
|
2139
|
+
children: "No results."
|
|
2140
|
+
}
|
|
2141
|
+
)
|
|
2142
|
+
] })
|
|
2143
|
+
]
|
|
2144
|
+
}
|
|
2145
|
+
),
|
|
2146
|
+
document.body
|
|
2147
|
+
)
|
|
2148
|
+
] });
|
|
2149
|
+
}
|
|
2150
|
+
|
|
2151
|
+
// src/ui/StatTile.tsx
|
|
2152
|
+
import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2153
|
+
function StatTile({
|
|
2154
|
+
icon: Icon,
|
|
2155
|
+
label,
|
|
2156
|
+
value,
|
|
2157
|
+
hint,
|
|
2158
|
+
onClick,
|
|
2159
|
+
active = false,
|
|
2160
|
+
className
|
|
2161
|
+
}) {
|
|
2162
|
+
const content = /* @__PURE__ */ jsxs20(Fragment3, { children: [
|
|
2163
|
+
/* @__PURE__ */ jsx27("div", { className: "p-4 bg-primary/10 rounded-2xl text-primary group-hover:scale-110 transition-transform", children: /* @__PURE__ */ jsx27(Icon, { className: "w-6 h-6" }) }),
|
|
2164
|
+
/* @__PURE__ */ jsxs20("div", { className: "min-w-0 text-left", children: [
|
|
2165
|
+
/* @__PURE__ */ jsx27("p", { className: "text-xs font-black uppercase tracking-widest text-muted-foreground", children: label }),
|
|
2166
|
+
/* @__PURE__ */ jsx27("p", { className: "text-2xl font-black", children: value }),
|
|
2167
|
+
hint && /* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground font-medium", children: hint })
|
|
2168
|
+
] })
|
|
2169
|
+
] });
|
|
2170
|
+
const classes = cn(
|
|
2171
|
+
"flex items-center gap-4 bg-card border border-white/5 p-6 rounded-3xl shadow-xl hover:border-primary/20 transition-all group",
|
|
2172
|
+
active && "border-primary/30 bg-white/5",
|
|
2173
|
+
onClick && "cursor-pointer w-full",
|
|
2174
|
+
className
|
|
2175
|
+
);
|
|
2176
|
+
return onClick ? /* @__PURE__ */ jsx27(
|
|
2177
|
+
"button",
|
|
2178
|
+
{
|
|
2179
|
+
"aria-pressed": active,
|
|
2180
|
+
className: classes,
|
|
2181
|
+
onClick,
|
|
2182
|
+
type: "button",
|
|
2183
|
+
children: content
|
|
2184
|
+
}
|
|
2185
|
+
) : /* @__PURE__ */ jsx27("div", { className: classes, children: content });
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
// src/ui/Switch.tsx
|
|
2189
|
+
import { jsx as jsx28, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2190
|
+
var TONES = {
|
|
2191
|
+
error: "bg-error",
|
|
2192
|
+
primary: "bg-primary",
|
|
2193
|
+
success: "bg-success"
|
|
2194
|
+
};
|
|
2195
|
+
function Switch({
|
|
2196
|
+
checked,
|
|
2197
|
+
onChange,
|
|
2198
|
+
label,
|
|
2199
|
+
disabled = false,
|
|
2200
|
+
tone = "primary",
|
|
2201
|
+
id
|
|
2202
|
+
}) {
|
|
2203
|
+
return /* @__PURE__ */ jsx28(
|
|
2204
|
+
"button",
|
|
2205
|
+
{
|
|
2206
|
+
"aria-checked": checked,
|
|
2207
|
+
"aria-label": label,
|
|
2208
|
+
className: cn(
|
|
2209
|
+
"relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50",
|
|
2210
|
+
checked ? TONES[tone] : "bg-white/10"
|
|
2211
|
+
),
|
|
2212
|
+
disabled,
|
|
2213
|
+
id,
|
|
2214
|
+
onClick: () => onChange(!checked),
|
|
2215
|
+
role: "switch",
|
|
2216
|
+
type: "button",
|
|
2217
|
+
children: /* @__PURE__ */ jsx28(
|
|
2218
|
+
"span",
|
|
2219
|
+
{
|
|
2220
|
+
className: cn(
|
|
2221
|
+
"pointer-events-none inline-block h-5 w-5 transform rounded-full bg-white shadow transition duration-200 ease-in-out",
|
|
2222
|
+
checked ? "translate-x-5" : "translate-x-0"
|
|
2223
|
+
)
|
|
2224
|
+
}
|
|
2225
|
+
)
|
|
2226
|
+
}
|
|
2227
|
+
);
|
|
2228
|
+
}
|
|
2229
|
+
function SettingRow({
|
|
2230
|
+
label,
|
|
2231
|
+
description,
|
|
2232
|
+
control,
|
|
2233
|
+
className
|
|
2234
|
+
}) {
|
|
2235
|
+
return /* @__PURE__ */ jsxs21(
|
|
2236
|
+
"div",
|
|
2237
|
+
{
|
|
2238
|
+
className: cn(
|
|
2239
|
+
"flex items-center justify-between gap-4 p-4 bg-white/5 border border-white/10 rounded-2xl",
|
|
2240
|
+
className
|
|
2241
|
+
),
|
|
2242
|
+
children: [
|
|
2243
|
+
/* @__PURE__ */ jsxs21("div", { className: "min-w-0", children: [
|
|
2244
|
+
/* @__PURE__ */ jsx28("p", { className: "text-sm font-bold", children: label }),
|
|
2245
|
+
description && /* @__PURE__ */ jsx28("p", { className: "text-xs text-muted-foreground font-medium", children: description })
|
|
2246
|
+
] }),
|
|
2247
|
+
control
|
|
2248
|
+
]
|
|
2249
|
+
}
|
|
2250
|
+
);
|
|
2251
|
+
}
|
|
2252
|
+
|
|
2253
|
+
// src/ui/Table.tsx
|
|
2254
|
+
import { jsx as jsx29 } from "react/jsx-runtime";
|
|
2255
|
+
var ALIGN = {
|
|
2256
|
+
center: "text-center",
|
|
2257
|
+
left: "text-left",
|
|
2258
|
+
right: "text-right"
|
|
2259
|
+
};
|
|
2260
|
+
function TableContainer({
|
|
2261
|
+
className,
|
|
2262
|
+
...props
|
|
2263
|
+
}) {
|
|
2264
|
+
return /* @__PURE__ */ jsx29(
|
|
2265
|
+
"div",
|
|
2266
|
+
{
|
|
2267
|
+
className: cn(
|
|
2268
|
+
"bg-card border border-white/5 rounded-3xl overflow-x-auto shadow-xl",
|
|
2269
|
+
className
|
|
2270
|
+
),
|
|
2271
|
+
...props
|
|
2272
|
+
}
|
|
2273
|
+
);
|
|
2274
|
+
}
|
|
2275
|
+
function Table({
|
|
2276
|
+
className,
|
|
2277
|
+
...props
|
|
2278
|
+
}) {
|
|
2279
|
+
return /* @__PURE__ */ jsx29(
|
|
2280
|
+
"table",
|
|
2281
|
+
{
|
|
2282
|
+
className: cn("w-full text-left border-collapse", className),
|
|
2283
|
+
...props
|
|
2284
|
+
}
|
|
2285
|
+
);
|
|
2286
|
+
}
|
|
2287
|
+
function TableHead({
|
|
2288
|
+
className,
|
|
2289
|
+
...props
|
|
2290
|
+
}) {
|
|
2291
|
+
return /* @__PURE__ */ jsx29(
|
|
2292
|
+
"thead",
|
|
2293
|
+
{
|
|
2294
|
+
className: cn("bg-white/5 border-b border-white/5", className),
|
|
2295
|
+
...props
|
|
2296
|
+
}
|
|
2297
|
+
);
|
|
2298
|
+
}
|
|
2299
|
+
function TableBody({
|
|
2300
|
+
className,
|
|
2301
|
+
...props
|
|
2302
|
+
}) {
|
|
2303
|
+
return /* @__PURE__ */ jsx29("tbody", { className: cn("divide-y divide-white/5", className), ...props });
|
|
2304
|
+
}
|
|
2305
|
+
function TableHeaderCell({
|
|
2306
|
+
align = "left",
|
|
2307
|
+
className,
|
|
2308
|
+
...props
|
|
2309
|
+
}) {
|
|
2310
|
+
return /* @__PURE__ */ jsx29(
|
|
2311
|
+
"th",
|
|
2312
|
+
{
|
|
2313
|
+
className: cn(
|
|
2314
|
+
"px-6 py-4 text-xs font-black uppercase tracking-widest text-muted-foreground",
|
|
2315
|
+
ALIGN[align],
|
|
2316
|
+
className
|
|
2317
|
+
),
|
|
2318
|
+
...props
|
|
2319
|
+
}
|
|
2320
|
+
);
|
|
2321
|
+
}
|
|
2322
|
+
function TableRow({
|
|
2323
|
+
className,
|
|
2324
|
+
...props
|
|
2325
|
+
}) {
|
|
2326
|
+
return /* @__PURE__ */ jsx29(
|
|
2327
|
+
"tr",
|
|
2328
|
+
{
|
|
2329
|
+
className: cn("hover:bg-white/5 transition-colors group", className),
|
|
2330
|
+
...props
|
|
2331
|
+
}
|
|
2332
|
+
);
|
|
2333
|
+
}
|
|
2334
|
+
function TableCell({
|
|
2335
|
+
align = "left",
|
|
2336
|
+
className,
|
|
2337
|
+
...props
|
|
2338
|
+
}) {
|
|
2339
|
+
return /* @__PURE__ */ jsx29(
|
|
2340
|
+
"td",
|
|
2341
|
+
{
|
|
2342
|
+
className: cn("px-6 py-4 text-sm", ALIGN[align], className),
|
|
2343
|
+
...props
|
|
2344
|
+
}
|
|
2345
|
+
);
|
|
2346
|
+
}
|
|
2347
|
+
function TableEmpty({
|
|
2348
|
+
colSpan,
|
|
2349
|
+
icon,
|
|
2350
|
+
title,
|
|
2351
|
+
description,
|
|
2352
|
+
action
|
|
2353
|
+
}) {
|
|
2354
|
+
return /* @__PURE__ */ jsx29("tr", { children: /* @__PURE__ */ jsx29("td", { colSpan, children: /* @__PURE__ */ jsx29(
|
|
2355
|
+
EmptyState,
|
|
2356
|
+
{
|
|
2357
|
+
action,
|
|
2358
|
+
description,
|
|
2359
|
+
icon,
|
|
2360
|
+
title
|
|
2361
|
+
}
|
|
2362
|
+
) }) });
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
// src/ui/Tabs.tsx
|
|
2366
|
+
import { useRef as useRef6 } from "react";
|
|
2367
|
+
import { jsx as jsx30, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2368
|
+
function Tabs({
|
|
2369
|
+
items,
|
|
2370
|
+
value,
|
|
2371
|
+
onChange,
|
|
2372
|
+
variant = "underline",
|
|
2373
|
+
panelIdPrefix,
|
|
2374
|
+
label,
|
|
2375
|
+
className
|
|
2376
|
+
}) {
|
|
2377
|
+
const tabRefs = useRef6([]);
|
|
2378
|
+
const select = (index) => {
|
|
2379
|
+
const item = items[(index + items.length) % items.length];
|
|
2380
|
+
onChange(item.value);
|
|
2381
|
+
tabRefs.current[(index + items.length) % items.length]?.focus();
|
|
2382
|
+
};
|
|
2383
|
+
const handleKeyDown = (event, index) => {
|
|
2384
|
+
const moves = {
|
|
2385
|
+
ArrowLeft: index - 1,
|
|
2386
|
+
ArrowRight: index + 1,
|
|
2387
|
+
End: items.length - 1,
|
|
2388
|
+
Home: 0
|
|
2389
|
+
};
|
|
2390
|
+
if (event.key in moves) {
|
|
2391
|
+
event.preventDefault();
|
|
2392
|
+
select(moves[event.key]);
|
|
2393
|
+
}
|
|
2394
|
+
};
|
|
2395
|
+
return /* @__PURE__ */ jsx30(
|
|
2396
|
+
"div",
|
|
2397
|
+
{
|
|
2398
|
+
"aria-label": label,
|
|
2399
|
+
className: cn(
|
|
2400
|
+
"flex flex-wrap gap-2",
|
|
2401
|
+
variant === "underline" && "border-b border-white/5 gap-6",
|
|
2402
|
+
className
|
|
2403
|
+
),
|
|
2404
|
+
role: "tablist",
|
|
2405
|
+
children: items.map((item, index) => {
|
|
2406
|
+
const active = item.value === value;
|
|
2407
|
+
const Icon = item.icon;
|
|
2408
|
+
return /* @__PURE__ */ jsxs22(
|
|
2409
|
+
"button",
|
|
2410
|
+
{
|
|
2411
|
+
"aria-controls": panelIdPrefix ? `${panelIdPrefix}-${item.value}` : void 0,
|
|
2412
|
+
"aria-selected": active,
|
|
2413
|
+
className: cn(
|
|
2414
|
+
"flex items-center gap-2 text-xs font-black uppercase tracking-widest transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",
|
|
2415
|
+
variant === "underline" ? cn(
|
|
2416
|
+
"pb-3 -mb-px border-b-2",
|
|
2417
|
+
active ? "border-primary text-primary" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
2418
|
+
) : cn(
|
|
2419
|
+
"px-4 py-2 rounded-xl",
|
|
2420
|
+
active ? "bg-primary/10 text-primary" : "bg-white/5 text-muted-foreground hover:text-foreground"
|
|
2421
|
+
)
|
|
2422
|
+
),
|
|
2423
|
+
id: panelIdPrefix ? `${panelIdPrefix}-tab-${item.value}` : void 0,
|
|
2424
|
+
onClick: () => onChange(item.value),
|
|
2425
|
+
onKeyDown: (event) => handleKeyDown(event, index),
|
|
2426
|
+
ref: (node) => {
|
|
2427
|
+
tabRefs.current[index] = node;
|
|
2428
|
+
},
|
|
2429
|
+
role: "tab",
|
|
2430
|
+
tabIndex: active ? 0 : -1,
|
|
2431
|
+
type: "button",
|
|
2432
|
+
children: [
|
|
2433
|
+
Icon && /* @__PURE__ */ jsx30(Icon, { className: "w-4 h-4" }),
|
|
2434
|
+
item.label,
|
|
2435
|
+
item.count !== void 0 && /* @__PURE__ */ jsxs22("span", { className: "text-muted-foreground", children: [
|
|
2436
|
+
"(",
|
|
2437
|
+
item.count,
|
|
2438
|
+
")"
|
|
2439
|
+
] })
|
|
2440
|
+
]
|
|
2441
|
+
},
|
|
2442
|
+
item.value
|
|
2443
|
+
);
|
|
2444
|
+
})
|
|
2445
|
+
}
|
|
2446
|
+
);
|
|
2447
|
+
}
|
|
2448
|
+
|
|
2449
|
+
// src/ui/Textarea.tsx
|
|
2450
|
+
import { forwardRef as forwardRef5, useId as useId6 } from "react";
|
|
2451
|
+
import { jsx as jsx31, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2452
|
+
var Textarea = forwardRef5(
|
|
2453
|
+
({ label, error, className, id, ...props }, ref) => {
|
|
2454
|
+
const generatedId = useId6();
|
|
2455
|
+
const textareaId = id ?? generatedId;
|
|
2456
|
+
return /* @__PURE__ */ jsxs23("div", { className: "space-y-2", children: [
|
|
2457
|
+
label && /* @__PURE__ */ jsx31(FieldLabel, { htmlFor: textareaId, children: label }),
|
|
2458
|
+
/* @__PURE__ */ jsx31(
|
|
2459
|
+
"textarea",
|
|
2460
|
+
{
|
|
2461
|
+
className: cn(
|
|
2462
|
+
"w-full min-h-28 bg-white/5 border border-white/10 rounded-2xl p-4 text-sm font-medium focus:outline-none focus:border-primary/50 transition-all resize-y",
|
|
2463
|
+
error && "border-error",
|
|
2464
|
+
className
|
|
2465
|
+
),
|
|
2466
|
+
id: textareaId,
|
|
2467
|
+
ref,
|
|
2468
|
+
...props
|
|
2469
|
+
}
|
|
2470
|
+
),
|
|
2471
|
+
error && /* @__PURE__ */ jsx31("span", { className: "text-xs text-error ml-1", children: error })
|
|
2472
|
+
] });
|
|
2473
|
+
}
|
|
2474
|
+
);
|
|
2475
|
+
Textarea.displayName = "Textarea";
|
|
2476
|
+
|
|
2477
|
+
// src/utils/date.ts
|
|
2478
|
+
import dayjs from "dayjs";
|
|
2479
|
+
import localizedFormat from "dayjs/plugin/localizedFormat";
|
|
2480
|
+
import relativeTime from "dayjs/plugin/relativeTime";
|
|
2481
|
+
dayjs.extend(localizedFormat);
|
|
2482
|
+
dayjs.extend(relativeTime);
|
|
2483
|
+
var date_default = dayjs;
|
|
2484
|
+
export {
|
|
2485
|
+
ApiError,
|
|
2486
|
+
ApiService,
|
|
2487
|
+
AuthStatusBadge,
|
|
2488
|
+
Badge,
|
|
2489
|
+
Banner,
|
|
2490
|
+
Button,
|
|
2491
|
+
Card,
|
|
2492
|
+
ConfirmModal,
|
|
2493
|
+
CopyableUuid,
|
|
2494
|
+
DangerZone,
|
|
2495
|
+
EmptyState,
|
|
2496
|
+
FieldLabel,
|
|
2497
|
+
GraphQLPlayground,
|
|
2498
|
+
IconButton,
|
|
2499
|
+
ImageUpload,
|
|
2500
|
+
Input,
|
|
2501
|
+
LoadMoreButton,
|
|
2502
|
+
LoadingState,
|
|
2503
|
+
MarkdownEditor,
|
|
2504
|
+
Modal,
|
|
2505
|
+
ModalActions,
|
|
2506
|
+
PLUGIN_CONTRACT_VERSION,
|
|
2507
|
+
PageHeader,
|
|
2508
|
+
Pagination,
|
|
2509
|
+
RemoteImage,
|
|
2510
|
+
RowActions,
|
|
2511
|
+
SearchInput,
|
|
2512
|
+
SectionHeader,
|
|
2513
|
+
Select,
|
|
2514
|
+
SettingRow,
|
|
2515
|
+
StatTile,
|
|
2516
|
+
Switch,
|
|
2517
|
+
Table,
|
|
2518
|
+
TableBody,
|
|
2519
|
+
TableCell,
|
|
2520
|
+
TableContainer,
|
|
2521
|
+
TableEmpty,
|
|
2522
|
+
TableHead,
|
|
2523
|
+
TableHeaderCell,
|
|
2524
|
+
TableRow,
|
|
2525
|
+
Tabs,
|
|
2526
|
+
Textarea,
|
|
2527
|
+
WEBP_ERROR_MESSAGE,
|
|
2528
|
+
WEBP_OR_SVG_ERROR_MESSAGE,
|
|
2529
|
+
assertWebp,
|
|
2530
|
+
cn,
|
|
2531
|
+
date_default as dayjs,
|
|
2532
|
+
decodeBase64,
|
|
2533
|
+
definePlugin,
|
|
2534
|
+
encodeBase64,
|
|
2535
|
+
getScopeToken,
|
|
2536
|
+
hubApi,
|
|
2537
|
+
insertMarkdown,
|
|
2538
|
+
isApiError,
|
|
2539
|
+
isSvg,
|
|
2540
|
+
isWebp,
|
|
2541
|
+
miniappApi,
|
|
2542
|
+
parseMarkdown,
|
|
2543
|
+
stripMarkdown,
|
|
2544
|
+
useCopyToClipboard,
|
|
2545
|
+
useDangerZoneDelete,
|
|
2546
|
+
useModalLock,
|
|
2547
|
+
usePluginHost
|
|
2548
|
+
};
|
|
2549
|
+
//# sourceMappingURL=index.js.map
|