@questpie/admin 3.2.3 → 3.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/blocks/block-library-sidebar.mjs +126 -113
- package/dist/client/components/fields/json-field.mjs +114 -118
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +38 -40
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +6 -17
- package/dist/client/components/fields/rich-text-editor/index.mjs +71 -87
- package/dist/client/components/history-sidebar.mjs +25 -10
- package/dist/client/components/media/media-picker-dialog.mjs +237 -254
- package/dist/client/components/preview/live-preview-mode.mjs +230 -203
- package/dist/client/components/primitives/asset-preview.mjs +1 -1
- package/dist/client/contexts/focus-context.d.mts +4 -0
- package/dist/client/contexts/focus-context.mjs +106 -86
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/diff.mjs +110 -0
- package/dist/client/preview/preview-banner.d.mts +2 -2
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +125 -187
- package/dist/client/preview/use-collection-preview.mjs +49 -21
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/reset-password-form.d.mts +2 -2
- package/dist/client/views/auth/setup-form.d.mts +2 -2
- package/dist/client/views/collection/bulk-action-toolbar.mjs +135 -156
- package/dist/client/views/collection/field-renderer.mjs +162 -51
- package/dist/client/views/collection/form-view.mjs +43 -81
- package/dist/client/views/collection/table-view.mjs +12 -10
- package/dist/client/views/common/global-search.mjs +199 -182
- package/dist/client/views/globals/global-form-view.mjs +625 -621
- package/dist/client/views/layout/admin-router.mjs +84 -100
- package/dist/client/views/pages/accept-invite-page.d.mts +2 -2
- package/dist/client/views/pages/dashboard-page.d.mts +2 -2
- package/dist/client/views/pages/forgot-password-page.d.mts +2 -2
- package/dist/client/views/pages/invite-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/server/modules/admin/collections/account.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
- package/dist/server/modules/admin/collections/assets.d.mts +39 -39
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +63 -63
- package/dist/server/modules/admin/collections/verification.d.mts +32 -32
- package/dist/server/modules/admin/index.d.mts +1 -1
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/setup.d.mts +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +41 -41
- package/dist/server/modules/audit/.generated/module.d.mts +6 -6
- package/dist/server/modules/audit/collections/audit-log.d.mts +78 -78
- package/dist/server/modules/audit/jobs/audit-cleanup.d.mts +2 -2
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BlockContent } from "./types.mjs";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime18 from "react/jsx-runtime";
|
|
4
4
|
|
|
5
5
|
//#region src/client/blocks/block-renderer.d.ts
|
|
6
6
|
|
|
@@ -50,6 +50,6 @@ declare function BlockRenderer({
|
|
|
50
50
|
onBlockClick,
|
|
51
51
|
onBlockInsert,
|
|
52
52
|
className
|
|
53
|
-
}: BlockRendererProps):
|
|
53
|
+
}: BlockRendererProps): react_jsx_runtime18.JSX.Element | null;
|
|
54
54
|
//#endregion
|
|
55
55
|
export { BlockRenderer, BlockRendererProps };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CollectionNames, GlobalNames } from "../builder/index.mjs";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import * as
|
|
3
|
+
import * as react_jsx_runtime14 from "react/jsx-runtime";
|
|
4
4
|
import { QuestpieApp } from "questpie/client";
|
|
5
5
|
|
|
6
6
|
//#region src/client/components/admin-link.d.ts
|
|
@@ -61,6 +61,6 @@ declare function AdminLink<TApp extends QuestpieApp>({
|
|
|
61
61
|
children,
|
|
62
62
|
onClick,
|
|
63
63
|
...rest
|
|
64
|
-
}: AdminLinkProps<TApp>):
|
|
64
|
+
}: AdminLinkProps<TApp>): react_jsx_runtime14.JSX.Element;
|
|
65
65
|
//#endregion
|
|
66
66
|
export { AdminLink };
|
|
@@ -19,7 +19,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
* Uses shadcn Sheet component for mobile-friendly sidebar.
|
|
20
20
|
*/
|
|
21
21
|
function BlockLibrarySidebar(t0) {
|
|
22
|
-
const $ = c(
|
|
22
|
+
const $ = c(48);
|
|
23
23
|
const { open, onClose } = t0;
|
|
24
24
|
const { t } = useTranslation();
|
|
25
25
|
const actions = useBlockEditorActions();
|
|
@@ -27,8 +27,22 @@ function BlockLibrarySidebar(t0) {
|
|
|
27
27
|
const allowedBlocks = useAllowedBlockTypes();
|
|
28
28
|
const insertPosition = useBlockInsertPosition();
|
|
29
29
|
const [search, setSearch] = React.useState("");
|
|
30
|
+
let t1;
|
|
31
|
+
if ($[0] !== allowedBlocks) {
|
|
32
|
+
t1 = allowedBlocks ? new Set(allowedBlocks) : null;
|
|
33
|
+
$[0] = allowedBlocks;
|
|
34
|
+
$[1] = t1;
|
|
35
|
+
} else t1 = $[1];
|
|
36
|
+
const allowedBlockSet = t1;
|
|
37
|
+
let t2;
|
|
38
|
+
if ($[2] !== search) {
|
|
39
|
+
t2 = search.trim().toLowerCase();
|
|
40
|
+
$[2] = search;
|
|
41
|
+
$[3] = t2;
|
|
42
|
+
} else t2 = $[3];
|
|
43
|
+
const normalizedSearch = t2;
|
|
30
44
|
let result;
|
|
31
|
-
if ($[
|
|
45
|
+
if ($[4] !== allowedBlockSet || $[5] !== blockRegistry || $[6] !== normalizedSearch) {
|
|
32
46
|
const categoryMap = /* @__PURE__ */ new Map();
|
|
33
47
|
const uncategorizedConfig = {
|
|
34
48
|
label: {
|
|
@@ -38,10 +52,10 @@ function BlockLibrarySidebar(t0) {
|
|
|
38
52
|
order: 999
|
|
39
53
|
};
|
|
40
54
|
for (const [name, def] of Object.entries(blockRegistry)) {
|
|
41
|
-
if (
|
|
55
|
+
if (allowedBlockSet && !allowedBlockSet.has(name)) continue;
|
|
42
56
|
if (def.admin?.hidden) continue;
|
|
43
|
-
if (
|
|
44
|
-
if (!getBlockDisplayLabel(def).toLowerCase().includes(
|
|
57
|
+
if (normalizedSearch) {
|
|
58
|
+
if (!getBlockDisplayLabel(def).toLowerCase().includes(normalizedSearch)) continue;
|
|
45
59
|
}
|
|
46
60
|
const categoryConfig = def.admin?.category;
|
|
47
61
|
let key;
|
|
@@ -63,130 +77,129 @@ function BlockLibrarySidebar(t0) {
|
|
|
63
77
|
name
|
|
64
78
|
});
|
|
65
79
|
}
|
|
66
|
-
result = Array.from(categoryMap.values());
|
|
67
|
-
result.sort(
|
|
68
|
-
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
|
|
73
|
-
} else result = $[3];
|
|
80
|
+
result = Array.from(categoryMap.values()).sort(_temp);
|
|
81
|
+
for (const category of result) category.blocks = category.blocks.slice().sort(_temp2);
|
|
82
|
+
$[4] = allowedBlockSet;
|
|
83
|
+
$[5] = blockRegistry;
|
|
84
|
+
$[6] = normalizedSearch;
|
|
85
|
+
$[7] = result;
|
|
86
|
+
} else result = $[7];
|
|
74
87
|
const categories = result;
|
|
75
88
|
const searchInputRef = React.useRef(null);
|
|
76
|
-
let
|
|
77
|
-
let
|
|
78
|
-
if ($[
|
|
79
|
-
|
|
89
|
+
let t3;
|
|
90
|
+
let t4;
|
|
91
|
+
if ($[8] !== open) {
|
|
92
|
+
t3 = () => {
|
|
80
93
|
if (open) {
|
|
81
94
|
const timer = setTimeout(() => searchInputRef.current?.focus(), 100);
|
|
82
95
|
return () => clearTimeout(timer);
|
|
83
96
|
}
|
|
84
97
|
};
|
|
85
|
-
|
|
86
|
-
$[
|
|
87
|
-
$[
|
|
88
|
-
$[
|
|
98
|
+
t4 = [open];
|
|
99
|
+
$[8] = open;
|
|
100
|
+
$[9] = t3;
|
|
101
|
+
$[10] = t4;
|
|
89
102
|
} else {
|
|
90
|
-
|
|
91
|
-
|
|
103
|
+
t3 = $[9];
|
|
104
|
+
t4 = $[10];
|
|
92
105
|
}
|
|
93
|
-
React.useEffect(
|
|
94
|
-
let
|
|
95
|
-
if ($[
|
|
96
|
-
|
|
106
|
+
React.useEffect(t3, t4);
|
|
107
|
+
let t5;
|
|
108
|
+
if ($[11] !== actions || $[12] !== insertPosition || $[13] !== onClose) {
|
|
109
|
+
t5 = (type) => {
|
|
97
110
|
if (insertPosition) actions.addBlock(type, insertPosition);
|
|
98
111
|
onClose();
|
|
99
112
|
setSearch("");
|
|
100
113
|
};
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
$[
|
|
104
|
-
$[10] = t3;
|
|
105
|
-
} else t3 = $[10];
|
|
106
|
-
const handleSelectBlock = t3;
|
|
107
|
-
let t4;
|
|
108
|
-
if ($[11] !== onClose) {
|
|
109
|
-
t4 = (nextOpen) => {
|
|
110
|
-
if (!nextOpen) onClose();
|
|
111
|
-
};
|
|
112
|
-
$[11] = onClose;
|
|
113
|
-
$[12] = t4;
|
|
114
|
-
} else t4 = $[12];
|
|
115
|
-
let t5;
|
|
116
|
-
if ($[13] !== t) {
|
|
117
|
-
t5 = t("blocks.add");
|
|
118
|
-
$[13] = t;
|
|
114
|
+
$[11] = actions;
|
|
115
|
+
$[12] = insertPosition;
|
|
116
|
+
$[13] = onClose;
|
|
119
117
|
$[14] = t5;
|
|
120
118
|
} else t5 = $[14];
|
|
119
|
+
const handleSelectBlock = t5;
|
|
121
120
|
let t6;
|
|
122
|
-
if ($[15] !==
|
|
123
|
-
t6 =
|
|
124
|
-
|
|
121
|
+
if ($[15] !== onClose) {
|
|
122
|
+
t6 = (nextOpen) => {
|
|
123
|
+
if (!nextOpen) onClose();
|
|
124
|
+
};
|
|
125
|
+
$[15] = onClose;
|
|
125
126
|
$[16] = t6;
|
|
126
127
|
} else t6 = $[16];
|
|
127
128
|
let t7;
|
|
128
129
|
if ($[17] !== t) {
|
|
129
|
-
t7 = t("blocks.
|
|
130
|
+
t7 = t("blocks.add");
|
|
130
131
|
$[17] = t;
|
|
131
132
|
$[18] = t7;
|
|
132
133
|
} else t7 = $[18];
|
|
133
134
|
let t8;
|
|
134
135
|
if ($[19] !== t7) {
|
|
135
|
-
t8 = /* @__PURE__ */ jsx(
|
|
136
|
+
t8 = /* @__PURE__ */ jsx(SheetTitle, { children: t7 });
|
|
136
137
|
$[19] = t7;
|
|
137
138
|
$[20] = t8;
|
|
138
139
|
} else t8 = $[20];
|
|
139
140
|
let t9;
|
|
140
|
-
if ($[21] !==
|
|
141
|
-
t9 =
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
$[21] = t6;
|
|
146
|
-
$[22] = t8;
|
|
147
|
-
$[23] = t9;
|
|
148
|
-
} else t9 = $[23];
|
|
141
|
+
if ($[21] !== t) {
|
|
142
|
+
t9 = t("blocks.libraryDescription");
|
|
143
|
+
$[21] = t;
|
|
144
|
+
$[22] = t9;
|
|
145
|
+
} else t9 = $[22];
|
|
149
146
|
let t10;
|
|
150
|
-
if ($[
|
|
151
|
-
t10 = /* @__PURE__ */ jsx(
|
|
152
|
-
|
|
153
|
-
className: "text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2"
|
|
154
|
-
});
|
|
147
|
+
if ($[23] !== t9) {
|
|
148
|
+
t10 = /* @__PURE__ */ jsx(SheetDescription, { children: t9 });
|
|
149
|
+
$[23] = t9;
|
|
155
150
|
$[24] = t10;
|
|
156
151
|
} else t10 = $[24];
|
|
157
152
|
let t11;
|
|
158
|
-
if ($[25] !==
|
|
159
|
-
t11 =
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
153
|
+
if ($[25] !== t10 || $[26] !== t8) {
|
|
154
|
+
t11 = /* @__PURE__ */ jsxs(SheetHeader, {
|
|
155
|
+
className: "space-y-2",
|
|
156
|
+
children: [t8, t10]
|
|
157
|
+
});
|
|
158
|
+
$[25] = t10;
|
|
159
|
+
$[26] = t8;
|
|
160
|
+
$[27] = t11;
|
|
161
|
+
} else t11 = $[27];
|
|
163
162
|
let t12;
|
|
164
|
-
if ($[
|
|
165
|
-
t12 =
|
|
166
|
-
|
|
167
|
-
|
|
163
|
+
if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
|
|
164
|
+
t12 = /* @__PURE__ */ jsx(Icon, {
|
|
165
|
+
icon: "ph:magnifying-glass",
|
|
166
|
+
className: "text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2"
|
|
167
|
+
});
|
|
168
|
+
$[28] = t12;
|
|
169
|
+
} else t12 = $[28];
|
|
168
170
|
let t13;
|
|
169
|
-
if ($[
|
|
170
|
-
t13 =
|
|
171
|
+
if ($[29] !== t) {
|
|
172
|
+
t13 = t("blocks.searchPlaceholder");
|
|
173
|
+
$[29] = t;
|
|
174
|
+
$[30] = t13;
|
|
175
|
+
} else t13 = $[30];
|
|
176
|
+
let t14;
|
|
177
|
+
if ($[31] === Symbol.for("react.memo_cache_sentinel")) {
|
|
178
|
+
t14 = (e) => setSearch(e.target.value);
|
|
179
|
+
$[31] = t14;
|
|
180
|
+
} else t14 = $[31];
|
|
181
|
+
let t15;
|
|
182
|
+
if ($[32] !== search || $[33] !== t13) {
|
|
183
|
+
t15 = /* @__PURE__ */ jsx("div", {
|
|
171
184
|
className: "px-6 py-4",
|
|
172
185
|
children: /* @__PURE__ */ jsxs("div", {
|
|
173
186
|
className: "relative",
|
|
174
|
-
children: [
|
|
187
|
+
children: [t12, /* @__PURE__ */ jsx(Input, {
|
|
175
188
|
ref: searchInputRef,
|
|
176
|
-
placeholder:
|
|
189
|
+
placeholder: t13,
|
|
177
190
|
value: search,
|
|
178
|
-
onChange:
|
|
191
|
+
onChange: t14,
|
|
179
192
|
className: "pl-9"
|
|
180
193
|
})]
|
|
181
194
|
})
|
|
182
195
|
});
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
} else
|
|
187
|
-
let
|
|
188
|
-
if ($[
|
|
189
|
-
|
|
196
|
+
$[32] = search;
|
|
197
|
+
$[33] = t13;
|
|
198
|
+
$[34] = t15;
|
|
199
|
+
} else t15 = $[34];
|
|
200
|
+
let t16;
|
|
201
|
+
if ($[35] !== categories || $[36] !== handleSelectBlock || $[37] !== search || $[38] !== t) {
|
|
202
|
+
t16 = /* @__PURE__ */ jsx("div", {
|
|
190
203
|
className: "flex-1 overflow-y-auto px-6 pb-6",
|
|
191
204
|
children: categories.length === 0 ? /* @__PURE__ */ jsxs("div", {
|
|
192
205
|
className: "flex flex-col items-center justify-center py-12 text-center",
|
|
@@ -239,41 +252,41 @@ function BlockLibrarySidebar(t0) {
|
|
|
239
252
|
})] }, category_0.key))
|
|
240
253
|
})
|
|
241
254
|
});
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
} else
|
|
248
|
-
let
|
|
249
|
-
if ($[
|
|
250
|
-
|
|
255
|
+
$[35] = categories;
|
|
256
|
+
$[36] = handleSelectBlock;
|
|
257
|
+
$[37] = search;
|
|
258
|
+
$[38] = t;
|
|
259
|
+
$[39] = t16;
|
|
260
|
+
} else t16 = $[39];
|
|
261
|
+
let t17;
|
|
262
|
+
if ($[40] !== t11 || $[41] !== t15 || $[42] !== t16) {
|
|
263
|
+
t17 = /* @__PURE__ */ jsxs(SheetContent, {
|
|
251
264
|
side: "left",
|
|
252
265
|
className: "qa-block-library flex w-full flex-col sm:max-w-md",
|
|
253
266
|
children: [
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
267
|
+
t11,
|
|
268
|
+
t15,
|
|
269
|
+
t16
|
|
257
270
|
]
|
|
258
271
|
});
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
263
|
-
} else
|
|
264
|
-
let
|
|
265
|
-
if ($[
|
|
266
|
-
|
|
272
|
+
$[40] = t11;
|
|
273
|
+
$[41] = t15;
|
|
274
|
+
$[42] = t16;
|
|
275
|
+
$[43] = t17;
|
|
276
|
+
} else t17 = $[43];
|
|
277
|
+
let t18;
|
|
278
|
+
if ($[44] !== open || $[45] !== t17 || $[46] !== t6) {
|
|
279
|
+
t18 = /* @__PURE__ */ jsx(Sheet, {
|
|
267
280
|
open,
|
|
268
|
-
onOpenChange:
|
|
269
|
-
children:
|
|
281
|
+
onOpenChange: t6,
|
|
282
|
+
children: t17
|
|
270
283
|
});
|
|
271
|
-
$[
|
|
272
|
-
$[
|
|
273
|
-
$[
|
|
274
|
-
$[
|
|
275
|
-
} else
|
|
276
|
-
return
|
|
284
|
+
$[44] = open;
|
|
285
|
+
$[45] = t17;
|
|
286
|
+
$[46] = t6;
|
|
287
|
+
$[47] = t18;
|
|
288
|
+
} else t18 = $[47];
|
|
289
|
+
return t18;
|
|
277
290
|
}
|
|
278
291
|
function _temp2(a_0, b_0) {
|
|
279
292
|
return (a_0.admin?.order ?? 999) - (b_0.admin?.order ?? 999);
|
|
@@ -204,51 +204,34 @@ function JsonField(t0) {
|
|
|
204
204
|
* Code editor for JSON (using Textarea for simplicity)
|
|
205
205
|
* Can be replaced with Monaco/CodeMirror in the future
|
|
206
206
|
*/
|
|
207
|
+
function formatJsonEditorValue(value) {
|
|
208
|
+
if (typeof value === "string") return value;
|
|
209
|
+
if (value === null || value === void 0) return "";
|
|
210
|
+
try {
|
|
211
|
+
return JSON.stringify(value, null, 2);
|
|
212
|
+
} catch {
|
|
213
|
+
return "";
|
|
214
|
+
}
|
|
215
|
+
}
|
|
207
216
|
function JsonCodeEditor(t0) {
|
|
208
217
|
const $ = c(40);
|
|
209
218
|
const { value, onChange, disabled, readOnly, placeholder, minHeight, maxHeight, error } = t0;
|
|
210
219
|
let t1;
|
|
211
220
|
if ($[0] !== value) {
|
|
212
|
-
t1 = ()
|
|
213
|
-
if (typeof value === "string") return value;
|
|
214
|
-
if (value === null || value === void 0) return "";
|
|
215
|
-
try {
|
|
216
|
-
return JSON.stringify(value, null, 2);
|
|
217
|
-
} catch {
|
|
218
|
-
return "";
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
+
t1 = formatJsonEditorValue(value);
|
|
221
222
|
$[0] = value;
|
|
222
223
|
$[1] = t1;
|
|
223
224
|
} else t1 = $[1];
|
|
224
|
-
const
|
|
225
|
+
const externalValue = t1;
|
|
226
|
+
const [localValue, setLocalValue] = React.useState(externalValue);
|
|
225
227
|
const [parseError, setParseError] = React.useState(null);
|
|
226
|
-
const
|
|
228
|
+
const [isEditing, setIsEditing] = React.useState(false);
|
|
229
|
+
const displayedValue = isEditing ? localValue : externalValue;
|
|
227
230
|
let t2;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
t2 = () => {
|
|
231
|
-
if (isEditingRef.current) return;
|
|
232
|
-
if (typeof value === "string") setLocalValue(value);
|
|
233
|
-
else if (value !== null && value !== void 0) try {
|
|
234
|
-
setLocalValue(JSON.stringify(value, null, 2));
|
|
235
|
-
} catch {}
|
|
236
|
-
else setLocalValue("");
|
|
237
|
-
};
|
|
238
|
-
t3 = [value];
|
|
239
|
-
$[2] = value;
|
|
240
|
-
$[3] = t2;
|
|
241
|
-
$[4] = t3;
|
|
242
|
-
} else {
|
|
243
|
-
t2 = $[3];
|
|
244
|
-
t3 = $[4];
|
|
245
|
-
}
|
|
246
|
-
React.useEffect(t2, t3);
|
|
247
|
-
let t4;
|
|
248
|
-
if ($[5] !== onChange) {
|
|
249
|
-
t4 = (e) => {
|
|
250
|
-
isEditingRef.current = true;
|
|
231
|
+
if ($[2] !== onChange) {
|
|
232
|
+
t2 = (e) => {
|
|
251
233
|
const newValue = e.target.value;
|
|
234
|
+
setIsEditing(true);
|
|
252
235
|
setLocalValue(newValue);
|
|
253
236
|
if (!newValue.trim()) {
|
|
254
237
|
setParseError(null);
|
|
@@ -259,86 +242,99 @@ function JsonCodeEditor(t0) {
|
|
|
259
242
|
const parsed = JSON.parse(newValue);
|
|
260
243
|
setParseError(null);
|
|
261
244
|
onChange(parsed);
|
|
262
|
-
} catch (
|
|
245
|
+
} catch (t3$1) {
|
|
263
246
|
setParseError("Invalid JSON");
|
|
264
247
|
onChange(newValue);
|
|
265
248
|
}
|
|
266
249
|
};
|
|
267
|
-
$[
|
|
268
|
-
$[
|
|
269
|
-
} else
|
|
270
|
-
const handleChange =
|
|
271
|
-
let
|
|
272
|
-
if ($[
|
|
273
|
-
|
|
250
|
+
$[2] = onChange;
|
|
251
|
+
$[3] = t2;
|
|
252
|
+
} else t2 = $[3];
|
|
253
|
+
const handleChange = t2;
|
|
254
|
+
let t3;
|
|
255
|
+
if ($[4] !== displayedValue || $[5] !== onChange) {
|
|
256
|
+
t3 = () => {
|
|
274
257
|
try {
|
|
275
|
-
const parsed_0 = JSON.parse(
|
|
276
|
-
|
|
258
|
+
const parsed_0 = JSON.parse(displayedValue);
|
|
259
|
+
const formatted = JSON.stringify(parsed_0, null, 2);
|
|
260
|
+
setIsEditing(true);
|
|
261
|
+
setLocalValue(formatted);
|
|
277
262
|
setParseError(null);
|
|
278
263
|
onChange(parsed_0);
|
|
279
264
|
} catch {}
|
|
280
265
|
};
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
266
|
+
$[4] = displayedValue;
|
|
267
|
+
$[5] = onChange;
|
|
268
|
+
$[6] = t3;
|
|
269
|
+
} else t3 = $[6];
|
|
270
|
+
const handleFormat = t3;
|
|
271
|
+
let t4;
|
|
272
|
+
if ($[7] !== externalValue) {
|
|
273
|
+
t4 = () => {
|
|
274
|
+
setLocalValue(externalValue);
|
|
275
|
+
setIsEditing(true);
|
|
276
|
+
};
|
|
277
|
+
$[7] = externalValue;
|
|
278
|
+
$[8] = t4;
|
|
279
|
+
} else t4 = $[8];
|
|
280
|
+
let t5;
|
|
281
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
282
|
+
t5 = () => {
|
|
283
|
+
setIsEditing(false);
|
|
284
|
+
};
|
|
283
285
|
$[9] = t5;
|
|
284
286
|
} else t5 = $[9];
|
|
285
|
-
const
|
|
286
|
-
let
|
|
287
|
-
if ($[10]
|
|
288
|
-
|
|
289
|
-
isEditingRef.current = false;
|
|
290
|
-
};
|
|
287
|
+
const t6 = error || parseError ? "border-destructive" : "";
|
|
288
|
+
let t7;
|
|
289
|
+
if ($[10] !== t6) {
|
|
290
|
+
t7 = cn("font-mono text-xs", t6);
|
|
291
291
|
$[10] = t6;
|
|
292
|
-
} else t6 = $[10];
|
|
293
|
-
const t7 = error || parseError ? "border-destructive" : "";
|
|
294
|
-
let t8;
|
|
295
|
-
if ($[11] !== t7) {
|
|
296
|
-
t8 = cn("font-mono text-xs", t7);
|
|
297
292
|
$[11] = t7;
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
const t9 = `${
|
|
301
|
-
const t10 = maxHeight ?
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
resize: t11
|
|
293
|
+
} else t7 = $[11];
|
|
294
|
+
const t8 = `${minHeight}px`;
|
|
295
|
+
const t9 = maxHeight ? `${maxHeight}px` : void 0;
|
|
296
|
+
const t10 = maxHeight ? "none" : "vertical";
|
|
297
|
+
let t11;
|
|
298
|
+
if ($[12] !== t10 || $[13] !== t8 || $[14] !== t9) {
|
|
299
|
+
t11 = {
|
|
300
|
+
minHeight: t8,
|
|
301
|
+
maxHeight: t9,
|
|
302
|
+
resize: t10
|
|
309
303
|
};
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
} else
|
|
315
|
-
const
|
|
316
|
-
let
|
|
317
|
-
if ($[
|
|
318
|
-
|
|
319
|
-
value:
|
|
304
|
+
$[12] = t10;
|
|
305
|
+
$[13] = t8;
|
|
306
|
+
$[14] = t9;
|
|
307
|
+
$[15] = t11;
|
|
308
|
+
} else t11 = $[15];
|
|
309
|
+
const t12 = !!error || !!parseError;
|
|
310
|
+
let t13;
|
|
311
|
+
if ($[16] !== disabled || $[17] !== displayedValue || $[18] !== handleChange || $[19] !== placeholder || $[20] !== readOnly || $[21] !== t11 || $[22] !== t12 || $[23] !== t4 || $[24] !== t7) {
|
|
312
|
+
t13 = /* @__PURE__ */ jsx(Textarea, {
|
|
313
|
+
value: displayedValue,
|
|
320
314
|
onChange: handleChange,
|
|
321
|
-
|
|
315
|
+
onFocus: t4,
|
|
316
|
+
onBlur: t5,
|
|
322
317
|
disabled,
|
|
323
318
|
readOnly,
|
|
324
319
|
placeholder,
|
|
325
|
-
className:
|
|
326
|
-
style:
|
|
327
|
-
"aria-invalid":
|
|
320
|
+
className: t7,
|
|
321
|
+
style: t11,
|
|
322
|
+
"aria-invalid": t12
|
|
328
323
|
});
|
|
329
|
-
$[
|
|
324
|
+
$[16] = disabled;
|
|
325
|
+
$[17] = displayedValue;
|
|
330
326
|
$[18] = handleChange;
|
|
331
|
-
$[19] =
|
|
332
|
-
$[20] =
|
|
333
|
-
$[21] =
|
|
327
|
+
$[19] = placeholder;
|
|
328
|
+
$[20] = readOnly;
|
|
329
|
+
$[21] = t11;
|
|
334
330
|
$[22] = t12;
|
|
335
|
-
$[23] =
|
|
336
|
-
$[24] =
|
|
337
|
-
$[25] =
|
|
338
|
-
} else
|
|
339
|
-
let
|
|
331
|
+
$[23] = t4;
|
|
332
|
+
$[24] = t7;
|
|
333
|
+
$[25] = t13;
|
|
334
|
+
} else t13 = $[25];
|
|
335
|
+
let t14;
|
|
340
336
|
if ($[26] !== parseError) {
|
|
341
|
-
|
|
337
|
+
t14 = parseError && /* @__PURE__ */ jsxs("div", {
|
|
342
338
|
className: "text-destructive bg-background/80 absolute top-2 right-2 flex items-center gap-1 px-1 text-xs text-pretty backdrop-blur-sm",
|
|
343
339
|
children: [/* @__PURE__ */ jsx(Icon, {
|
|
344
340
|
icon: "ph:warning-circle-fill",
|
|
@@ -346,21 +342,21 @@ function JsonCodeEditor(t0) {
|
|
|
346
342
|
}), parseError]
|
|
347
343
|
});
|
|
348
344
|
$[26] = parseError;
|
|
349
|
-
$[27] =
|
|
350
|
-
} else
|
|
351
|
-
let
|
|
352
|
-
if ($[28] !==
|
|
353
|
-
|
|
345
|
+
$[27] = t14;
|
|
346
|
+
} else t14 = $[27];
|
|
347
|
+
let t15;
|
|
348
|
+
if ($[28] !== t13 || $[29] !== t14) {
|
|
349
|
+
t15 = /* @__PURE__ */ jsxs("div", {
|
|
354
350
|
className: "relative",
|
|
355
|
-
children: [
|
|
351
|
+
children: [t13, t14]
|
|
356
352
|
});
|
|
357
|
-
$[28] =
|
|
358
|
-
$[29] =
|
|
359
|
-
$[30] =
|
|
360
|
-
} else
|
|
361
|
-
let
|
|
362
|
-
if ($[31] !== disabled || $[32] !==
|
|
363
|
-
|
|
353
|
+
$[28] = t13;
|
|
354
|
+
$[29] = t14;
|
|
355
|
+
$[30] = t15;
|
|
356
|
+
} else t15 = $[30];
|
|
357
|
+
let t16;
|
|
358
|
+
if ($[31] !== disabled || $[32] !== displayedValue || $[33] !== handleFormat || $[34] !== parseError || $[35] !== readOnly) {
|
|
359
|
+
t16 = !readOnly && !disabled && displayedValue && /* @__PURE__ */ jsx("div", {
|
|
364
360
|
className: "flex justify-end",
|
|
365
361
|
children: /* @__PURE__ */ jsx(Button, {
|
|
366
362
|
type: "button",
|
|
@@ -372,23 +368,23 @@ function JsonCodeEditor(t0) {
|
|
|
372
368
|
})
|
|
373
369
|
});
|
|
374
370
|
$[31] = disabled;
|
|
375
|
-
$[32] =
|
|
376
|
-
$[33] =
|
|
371
|
+
$[32] = displayedValue;
|
|
372
|
+
$[33] = handleFormat;
|
|
377
373
|
$[34] = parseError;
|
|
378
374
|
$[35] = readOnly;
|
|
379
|
-
$[36] =
|
|
380
|
-
} else
|
|
381
|
-
let
|
|
382
|
-
if ($[37] !==
|
|
383
|
-
|
|
375
|
+
$[36] = t16;
|
|
376
|
+
} else t16 = $[36];
|
|
377
|
+
let t17;
|
|
378
|
+
if ($[37] !== t15 || $[38] !== t16) {
|
|
379
|
+
t17 = /* @__PURE__ */ jsxs("div", {
|
|
384
380
|
className: "space-y-2",
|
|
385
|
-
children: [
|
|
381
|
+
children: [t15, t16]
|
|
386
382
|
});
|
|
387
|
-
$[37] =
|
|
388
|
-
$[38] =
|
|
389
|
-
$[39] =
|
|
390
|
-
} else
|
|
391
|
-
return
|
|
383
|
+
$[37] = t15;
|
|
384
|
+
$[38] = t16;
|
|
385
|
+
$[39] = t17;
|
|
386
|
+
} else t17 = $[39];
|
|
387
|
+
return t17;
|
|
392
388
|
}
|
|
393
389
|
/**
|
|
394
390
|
* Form-based editor wrapper
|