listpage-next 0.0.236 → 0.0.238
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/components/Card/index.d.ts +1 -1
- package/dist/features/ChatClient/ui/Bubble/Bubble.d.ts +2 -1
- package/dist/features/ChatClient/ui/Bubble/Bubble.js +5 -4
- package/dist/features/ChatClient/ui/ConversationDropdownMenu/index.js +2 -38
- package/dist/features/ChatClient/ui/ConversationDropdownMenu/utils.d.ts +1 -0
- package/dist/features/ChatClient/ui/ConversationDropdownMenu/utils.js +36 -0
- package/dist/features/JsonEditor/CodeEditor.d.ts +6 -0
- package/dist/features/JsonEditor/CodeEditor.js +122 -0
- package/dist/features/JsonEditor/ErrorMessage.d.ts +3 -0
- package/dist/features/JsonEditor/ErrorMessage.js +67 -0
- package/dist/features/JsonEditor/JsonEditor.d.ts +10 -0
- package/dist/features/JsonEditor/JsonEditor.js +146 -0
- package/dist/features/JsonEditor/Toolbar.d.ts +9 -0
- package/dist/features/JsonEditor/Toolbar.js +79 -0
- package/dist/features/JsonEditor/index.d.ts +1 -1
- package/dist/features/JsonEditor/index.js +1 -1
- package/dist/features/JsonEditor/types.d.ts +8 -0
- package/dist/features/JsonEditor/types.js +0 -0
- package/dist/features/JsonEditor/utils.d.ts +6 -2
- package/dist/features/JsonEditor/utils.js +47 -10
- package/dist/ui/PromptEditor/index.d.ts +8 -0
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui.css +366 -0
- package/package.json +20 -5
- package/dist/features/JsonEditor/Container.d.ts +0 -12
- package/dist/features/JsonEditor/Container.js +0 -122
- package/dist/features/JsonEditor/LineNumberEditor.d.ts +0 -10
- package/dist/features/JsonEditor/LineNumberEditor.js +0 -186
- package/dist/features/JsonEditor/style.d.ts +0 -13
- package/dist/features/JsonEditor/style.js +0 -185
|
@@ -1,15 +1,52 @@
|
|
|
1
|
-
const
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const validateJson = (jsonString)=>{
|
|
2
|
+
if (!jsonString.trim()) return {
|
|
3
|
+
isValid: true,
|
|
4
|
+
data: null
|
|
5
|
+
};
|
|
4
6
|
try {
|
|
5
|
-
|
|
7
|
+
const data = JSON.parse(jsonString);
|
|
8
|
+
return {
|
|
9
|
+
isValid: true,
|
|
10
|
+
data
|
|
11
|
+
};
|
|
6
12
|
} catch (e) {
|
|
7
|
-
|
|
13
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
14
|
+
return {
|
|
15
|
+
isValid: false,
|
|
16
|
+
error: message
|
|
17
|
+
};
|
|
8
18
|
}
|
|
9
19
|
};
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
20
|
+
const formatJson = (jsonString)=>{
|
|
21
|
+
try {
|
|
22
|
+
const obj = JSON.parse(jsonString);
|
|
23
|
+
return JSON.stringify(obj, null, 2);
|
|
24
|
+
} catch (_) {
|
|
25
|
+
return jsonString;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const minifyJson = (jsonString)=>{
|
|
29
|
+
try {
|
|
30
|
+
const obj = JSON.parse(jsonString);
|
|
31
|
+
return JSON.stringify(obj);
|
|
32
|
+
} catch (_) {
|
|
33
|
+
return jsonString;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const getType = (value)=>{
|
|
37
|
+
if (null === value) return 'null';
|
|
38
|
+
if (Array.isArray(value)) return 'array';
|
|
39
|
+
return typeof value;
|
|
40
|
+
};
|
|
41
|
+
const highlightJson = (json)=>{
|
|
42
|
+
if (!json) return '';
|
|
43
|
+
const htmlEscaped = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
44
|
+
return htmlEscaped.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, (match)=>{
|
|
45
|
+
let cls = 'json-token number';
|
|
46
|
+
if (/^"/.test(match)) cls = /:$/.test(match) ? 'json-token key' : 'json-token string';
|
|
47
|
+
else if (/true|false/.test(match)) cls = 'json-token boolean';
|
|
48
|
+
else if (/null/.test(match)) cls = 'json-token null';
|
|
49
|
+
return `<span class="${cls}">${match}</span>`;
|
|
50
|
+
});
|
|
14
51
|
};
|
|
15
|
-
export {
|
|
52
|
+
export { formatJson, getType, highlightJson, minifyJson, validateJson };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import 'prismjs/components/prism-markdown';
|
|
2
|
+
export interface PromptEditorProps {
|
|
3
|
+
value: string;
|
|
4
|
+
onChange: (value: string) => void;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const PromptEditor: ({ value, onChange, placeholder, className, }: PromptEditorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PromptEditor, type PromptEditorProps } from './PromptEditor';
|
package/dist/ui.css
ADDED
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/*! tailwindcss v4.1.17 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties;
|
|
3
|
+
@layer theme, base, components, utilities;
|
|
4
|
+
@layer theme {
|
|
5
|
+
:root, :host {
|
|
6
|
+
--font-sans: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
|
|
7
|
+
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
8
|
+
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
|
|
9
|
+
"Courier New", monospace;
|
|
10
|
+
--color-slate-300: oklch(86.9% 0.022 252.894);
|
|
11
|
+
--text-sm: 0.875rem;
|
|
12
|
+
--text-sm--line-height: calc(1.25 / 0.875);
|
|
13
|
+
--default-transition-duration: 150ms;
|
|
14
|
+
--default-transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
15
|
+
--default-font-family: var(--font-sans);
|
|
16
|
+
--default-mono-font-family: var(--font-mono);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
@layer base {
|
|
20
|
+
*, ::after, ::before, ::backdrop, ::file-selector-button {
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
margin: 0;
|
|
23
|
+
padding: 0;
|
|
24
|
+
border: 0 solid;
|
|
25
|
+
}
|
|
26
|
+
html, :host {
|
|
27
|
+
line-height: 1.5;
|
|
28
|
+
-webkit-text-size-adjust: 100%;
|
|
29
|
+
tab-size: 4;
|
|
30
|
+
font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");
|
|
31
|
+
font-feature-settings: var(--default-font-feature-settings, normal);
|
|
32
|
+
font-variation-settings: var(--default-font-variation-settings, normal);
|
|
33
|
+
-webkit-tap-highlight-color: transparent;
|
|
34
|
+
}
|
|
35
|
+
hr {
|
|
36
|
+
height: 0;
|
|
37
|
+
color: inherit;
|
|
38
|
+
border-top-width: 1px;
|
|
39
|
+
}
|
|
40
|
+
abbr:where([title]) {
|
|
41
|
+
-webkit-text-decoration: underline dotted;
|
|
42
|
+
text-decoration: underline dotted;
|
|
43
|
+
}
|
|
44
|
+
h1, h2, h3, h4, h5, h6 {
|
|
45
|
+
font-size: inherit;
|
|
46
|
+
font-weight: inherit;
|
|
47
|
+
}
|
|
48
|
+
a {
|
|
49
|
+
color: inherit;
|
|
50
|
+
-webkit-text-decoration: inherit;
|
|
51
|
+
text-decoration: inherit;
|
|
52
|
+
}
|
|
53
|
+
b, strong {
|
|
54
|
+
font-weight: bolder;
|
|
55
|
+
}
|
|
56
|
+
code, kbd, samp, pre {
|
|
57
|
+
font-family: var(--default-mono-font-family, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);
|
|
58
|
+
font-feature-settings: var(--default-mono-font-feature-settings, normal);
|
|
59
|
+
font-variation-settings: var(--default-mono-font-variation-settings, normal);
|
|
60
|
+
font-size: 1em;
|
|
61
|
+
}
|
|
62
|
+
small {
|
|
63
|
+
font-size: 80%;
|
|
64
|
+
}
|
|
65
|
+
sub, sup {
|
|
66
|
+
font-size: 75%;
|
|
67
|
+
line-height: 0;
|
|
68
|
+
position: relative;
|
|
69
|
+
vertical-align: baseline;
|
|
70
|
+
}
|
|
71
|
+
sub {
|
|
72
|
+
bottom: -0.25em;
|
|
73
|
+
}
|
|
74
|
+
sup {
|
|
75
|
+
top: -0.5em;
|
|
76
|
+
}
|
|
77
|
+
table {
|
|
78
|
+
text-indent: 0;
|
|
79
|
+
border-color: inherit;
|
|
80
|
+
border-collapse: collapse;
|
|
81
|
+
}
|
|
82
|
+
:-moz-focusring {
|
|
83
|
+
outline: auto;
|
|
84
|
+
}
|
|
85
|
+
progress {
|
|
86
|
+
vertical-align: baseline;
|
|
87
|
+
}
|
|
88
|
+
summary {
|
|
89
|
+
display: list-item;
|
|
90
|
+
}
|
|
91
|
+
ol, ul, menu {
|
|
92
|
+
list-style: none;
|
|
93
|
+
}
|
|
94
|
+
img, svg, video, canvas, audio, iframe, embed, object {
|
|
95
|
+
display: block;
|
|
96
|
+
vertical-align: middle;
|
|
97
|
+
}
|
|
98
|
+
img, video {
|
|
99
|
+
max-width: 100%;
|
|
100
|
+
height: auto;
|
|
101
|
+
}
|
|
102
|
+
button, input, select, optgroup, textarea, ::file-selector-button {
|
|
103
|
+
font: inherit;
|
|
104
|
+
font-feature-settings: inherit;
|
|
105
|
+
font-variation-settings: inherit;
|
|
106
|
+
letter-spacing: inherit;
|
|
107
|
+
color: inherit;
|
|
108
|
+
border-radius: 0;
|
|
109
|
+
background-color: transparent;
|
|
110
|
+
opacity: 1;
|
|
111
|
+
}
|
|
112
|
+
:where(select:is([multiple], [size])) optgroup {
|
|
113
|
+
font-weight: bolder;
|
|
114
|
+
}
|
|
115
|
+
:where(select:is([multiple], [size])) optgroup option {
|
|
116
|
+
padding-inline-start: 20px;
|
|
117
|
+
}
|
|
118
|
+
::file-selector-button {
|
|
119
|
+
margin-inline-end: 4px;
|
|
120
|
+
}
|
|
121
|
+
::placeholder {
|
|
122
|
+
opacity: 1;
|
|
123
|
+
}
|
|
124
|
+
@supports (not (-webkit-appearance: -apple-pay-button)) or (contain-intrinsic-size: 1px) {
|
|
125
|
+
::placeholder {
|
|
126
|
+
color: currentcolor;
|
|
127
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
128
|
+
color: color-mix(in oklab, currentcolor 50%, transparent);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
textarea {
|
|
133
|
+
resize: vertical;
|
|
134
|
+
}
|
|
135
|
+
::-webkit-search-decoration {
|
|
136
|
+
-webkit-appearance: none;
|
|
137
|
+
}
|
|
138
|
+
::-webkit-date-and-time-value {
|
|
139
|
+
min-height: 1lh;
|
|
140
|
+
text-align: inherit;
|
|
141
|
+
}
|
|
142
|
+
::-webkit-datetime-edit {
|
|
143
|
+
display: inline-flex;
|
|
144
|
+
}
|
|
145
|
+
::-webkit-datetime-edit-fields-wrapper {
|
|
146
|
+
padding: 0;
|
|
147
|
+
}
|
|
148
|
+
::-webkit-datetime-edit, ::-webkit-datetime-edit-year-field, ::-webkit-datetime-edit-month-field, ::-webkit-datetime-edit-day-field, ::-webkit-datetime-edit-hour-field, ::-webkit-datetime-edit-minute-field, ::-webkit-datetime-edit-second-field, ::-webkit-datetime-edit-millisecond-field, ::-webkit-datetime-edit-meridiem-field {
|
|
149
|
+
padding-block: 0;
|
|
150
|
+
}
|
|
151
|
+
::-webkit-calendar-picker-indicator {
|
|
152
|
+
line-height: 1;
|
|
153
|
+
}
|
|
154
|
+
:-moz-ui-invalid {
|
|
155
|
+
box-shadow: none;
|
|
156
|
+
}
|
|
157
|
+
button, input:where([type="button"], [type="reset"], [type="submit"]), ::file-selector-button {
|
|
158
|
+
appearance: button;
|
|
159
|
+
}
|
|
160
|
+
::-webkit-inner-spin-button, ::-webkit-outer-spin-button {
|
|
161
|
+
height: auto;
|
|
162
|
+
}
|
|
163
|
+
[hidden]:where(:not([hidden="until-found"])) {
|
|
164
|
+
display: none !important;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
@layer utilities {
|
|
168
|
+
.visible {
|
|
169
|
+
visibility: visible;
|
|
170
|
+
}
|
|
171
|
+
.absolute {
|
|
172
|
+
position: absolute;
|
|
173
|
+
}
|
|
174
|
+
.relative {
|
|
175
|
+
position: relative;
|
|
176
|
+
}
|
|
177
|
+
.block {
|
|
178
|
+
display: block;
|
|
179
|
+
}
|
|
180
|
+
.flex {
|
|
181
|
+
display: flex;
|
|
182
|
+
}
|
|
183
|
+
.inline {
|
|
184
|
+
display: inline;
|
|
185
|
+
}
|
|
186
|
+
.inline-flex {
|
|
187
|
+
display: inline-flex;
|
|
188
|
+
}
|
|
189
|
+
.table {
|
|
190
|
+
display: table;
|
|
191
|
+
}
|
|
192
|
+
.h-full {
|
|
193
|
+
height: 100%;
|
|
194
|
+
}
|
|
195
|
+
.flex-1 {
|
|
196
|
+
flex: 1;
|
|
197
|
+
}
|
|
198
|
+
.flex-shrink {
|
|
199
|
+
flex-shrink: 1;
|
|
200
|
+
}
|
|
201
|
+
.flex-grow {
|
|
202
|
+
flex-grow: 1;
|
|
203
|
+
}
|
|
204
|
+
.border-collapse {
|
|
205
|
+
border-collapse: collapse;
|
|
206
|
+
}
|
|
207
|
+
.transform {
|
|
208
|
+
transform: var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,);
|
|
209
|
+
}
|
|
210
|
+
.resize {
|
|
211
|
+
resize: both;
|
|
212
|
+
}
|
|
213
|
+
.flex-col {
|
|
214
|
+
flex-direction: column;
|
|
215
|
+
}
|
|
216
|
+
.overflow-auto {
|
|
217
|
+
overflow: auto;
|
|
218
|
+
}
|
|
219
|
+
.overflow-hidden {
|
|
220
|
+
overflow: hidden;
|
|
221
|
+
}
|
|
222
|
+
.border {
|
|
223
|
+
border-style: var(--tw-border-style);
|
|
224
|
+
border-width: 1px;
|
|
225
|
+
}
|
|
226
|
+
.bg-\[\#0B1120\] {
|
|
227
|
+
background-color: #0B1120;
|
|
228
|
+
}
|
|
229
|
+
.font-mono {
|
|
230
|
+
font-family: var(--font-mono);
|
|
231
|
+
}
|
|
232
|
+
.text-sm {
|
|
233
|
+
font-size: var(--text-sm);
|
|
234
|
+
line-height: var(--tw-leading, var(--text-sm--line-height));
|
|
235
|
+
}
|
|
236
|
+
.text-slate-300 {
|
|
237
|
+
color: var(--color-slate-300);
|
|
238
|
+
}
|
|
239
|
+
.outline {
|
|
240
|
+
outline-style: var(--tw-outline-style);
|
|
241
|
+
outline-width: 1px;
|
|
242
|
+
}
|
|
243
|
+
.filter {
|
|
244
|
+
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
245
|
+
}
|
|
246
|
+
.transition {
|
|
247
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
|
|
248
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
249
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
250
|
+
}
|
|
251
|
+
.focus\:outline-none {
|
|
252
|
+
&:focus {
|
|
253
|
+
--tw-outline-style: none;
|
|
254
|
+
outline-style: none;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
@property --tw-rotate-x {
|
|
259
|
+
syntax: "*";
|
|
260
|
+
inherits: false;
|
|
261
|
+
}
|
|
262
|
+
@property --tw-rotate-y {
|
|
263
|
+
syntax: "*";
|
|
264
|
+
inherits: false;
|
|
265
|
+
}
|
|
266
|
+
@property --tw-rotate-z {
|
|
267
|
+
syntax: "*";
|
|
268
|
+
inherits: false;
|
|
269
|
+
}
|
|
270
|
+
@property --tw-skew-x {
|
|
271
|
+
syntax: "*";
|
|
272
|
+
inherits: false;
|
|
273
|
+
}
|
|
274
|
+
@property --tw-skew-y {
|
|
275
|
+
syntax: "*";
|
|
276
|
+
inherits: false;
|
|
277
|
+
}
|
|
278
|
+
@property --tw-border-style {
|
|
279
|
+
syntax: "*";
|
|
280
|
+
inherits: false;
|
|
281
|
+
initial-value: solid;
|
|
282
|
+
}
|
|
283
|
+
@property --tw-outline-style {
|
|
284
|
+
syntax: "*";
|
|
285
|
+
inherits: false;
|
|
286
|
+
initial-value: solid;
|
|
287
|
+
}
|
|
288
|
+
@property --tw-blur {
|
|
289
|
+
syntax: "*";
|
|
290
|
+
inherits: false;
|
|
291
|
+
}
|
|
292
|
+
@property --tw-brightness {
|
|
293
|
+
syntax: "*";
|
|
294
|
+
inherits: false;
|
|
295
|
+
}
|
|
296
|
+
@property --tw-contrast {
|
|
297
|
+
syntax: "*";
|
|
298
|
+
inherits: false;
|
|
299
|
+
}
|
|
300
|
+
@property --tw-grayscale {
|
|
301
|
+
syntax: "*";
|
|
302
|
+
inherits: false;
|
|
303
|
+
}
|
|
304
|
+
@property --tw-hue-rotate {
|
|
305
|
+
syntax: "*";
|
|
306
|
+
inherits: false;
|
|
307
|
+
}
|
|
308
|
+
@property --tw-invert {
|
|
309
|
+
syntax: "*";
|
|
310
|
+
inherits: false;
|
|
311
|
+
}
|
|
312
|
+
@property --tw-opacity {
|
|
313
|
+
syntax: "*";
|
|
314
|
+
inherits: false;
|
|
315
|
+
}
|
|
316
|
+
@property --tw-saturate {
|
|
317
|
+
syntax: "*";
|
|
318
|
+
inherits: false;
|
|
319
|
+
}
|
|
320
|
+
@property --tw-sepia {
|
|
321
|
+
syntax: "*";
|
|
322
|
+
inherits: false;
|
|
323
|
+
}
|
|
324
|
+
@property --tw-drop-shadow {
|
|
325
|
+
syntax: "*";
|
|
326
|
+
inherits: false;
|
|
327
|
+
}
|
|
328
|
+
@property --tw-drop-shadow-color {
|
|
329
|
+
syntax: "*";
|
|
330
|
+
inherits: false;
|
|
331
|
+
}
|
|
332
|
+
@property --tw-drop-shadow-alpha {
|
|
333
|
+
syntax: "<percentage>";
|
|
334
|
+
inherits: false;
|
|
335
|
+
initial-value: 100%;
|
|
336
|
+
}
|
|
337
|
+
@property --tw-drop-shadow-size {
|
|
338
|
+
syntax: "*";
|
|
339
|
+
inherits: false;
|
|
340
|
+
}
|
|
341
|
+
@layer properties {
|
|
342
|
+
@supports ((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b)))) {
|
|
343
|
+
*, ::before, ::after, ::backdrop {
|
|
344
|
+
--tw-rotate-x: initial;
|
|
345
|
+
--tw-rotate-y: initial;
|
|
346
|
+
--tw-rotate-z: initial;
|
|
347
|
+
--tw-skew-x: initial;
|
|
348
|
+
--tw-skew-y: initial;
|
|
349
|
+
--tw-border-style: solid;
|
|
350
|
+
--tw-outline-style: solid;
|
|
351
|
+
--tw-blur: initial;
|
|
352
|
+
--tw-brightness: initial;
|
|
353
|
+
--tw-contrast: initial;
|
|
354
|
+
--tw-grayscale: initial;
|
|
355
|
+
--tw-hue-rotate: initial;
|
|
356
|
+
--tw-invert: initial;
|
|
357
|
+
--tw-opacity: initial;
|
|
358
|
+
--tw-saturate: initial;
|
|
359
|
+
--tw-sepia: initial;
|
|
360
|
+
--tw-drop-shadow: initial;
|
|
361
|
+
--tw-drop-shadow-color: initial;
|
|
362
|
+
--tw-drop-shadow-alpha: 100%;
|
|
363
|
+
--tw-drop-shadow-size: initial;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "listpage-next",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.238",
|
|
4
4
|
"description": "A React component library for creating filter forms with Ant Design",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -9,7 +9,12 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
|
-
}
|
|
12
|
+
},
|
|
13
|
+
"./ui": {
|
|
14
|
+
"types": "./dist/ui/ui.d.ts",
|
|
15
|
+
"import": "./dist/ui/ui.js"
|
|
16
|
+
},
|
|
17
|
+
"./ui.css": "./dist/ui.css"
|
|
13
18
|
},
|
|
14
19
|
"types": "./dist/index.d.ts",
|
|
15
20
|
"files": [
|
|
@@ -25,7 +30,8 @@
|
|
|
25
30
|
],
|
|
26
31
|
"license": "MIT",
|
|
27
32
|
"scripts": {
|
|
28
|
-
"build": "rslib build",
|
|
33
|
+
"build": "rslib build && npm run build:css || true",
|
|
34
|
+
"build:css": "npx -p @tailwindcss/cli@4.1.17 -p tailwindcss@4.1.17 tailwindcss -c tailwind.config.cjs -i ./src/ui/tailwind.css -o ./dist/ui.css --min",
|
|
29
35
|
"format": "prettier --write .",
|
|
30
36
|
"prepublishOnly": "npm run build"
|
|
31
37
|
},
|
|
@@ -41,7 +47,11 @@
|
|
|
41
47
|
"typescript": "^5.9.2",
|
|
42
48
|
"react": "^19.1.1",
|
|
43
49
|
"react-router-dom": ">=6.0.0",
|
|
44
|
-
"@types/markdown-it": "~14.1.2"
|
|
50
|
+
"@types/markdown-it": "~14.1.2",
|
|
51
|
+
"tailwindcss": "~4.1.17",
|
|
52
|
+
"@tailwindcss/cli": "^4.1.0",
|
|
53
|
+
"postcss": "^8.4.49",
|
|
54
|
+
"autoprefixer": "^10.4.20"
|
|
45
55
|
},
|
|
46
56
|
"peerDependencies": {
|
|
47
57
|
"react": ">=16.9.0",
|
|
@@ -69,6 +79,11 @@
|
|
|
69
79
|
"@tiptap/extension-hard-break": "~3.10.7",
|
|
70
80
|
"@tiptap/core": "~3.10.7",
|
|
71
81
|
"@tiptap/pm": "~3.10.7",
|
|
72
|
-
"prosemirror-state": "~1.4.4"
|
|
82
|
+
"prosemirror-state": "~1.4.4",
|
|
83
|
+
"lucide-react": "~0.555.0",
|
|
84
|
+
"react-simple-code-editor": "~0.14.1",
|
|
85
|
+
"prismjs": "~1.30.0",
|
|
86
|
+
"@types/prismjs": "~1.26.5",
|
|
87
|
+
"json-schema-faker": "~0.5.9"
|
|
73
88
|
}
|
|
74
89
|
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
export interface JsonEditorProps {
|
|
3
|
-
value?: any;
|
|
4
|
-
onChange?: (value: any) => void;
|
|
5
|
-
placeholder?: string;
|
|
6
|
-
readOnly?: boolean;
|
|
7
|
-
style?: React.CSSProperties;
|
|
8
|
-
className?: string;
|
|
9
|
-
height?: number | string;
|
|
10
|
-
}
|
|
11
|
-
export declare const JsonEditor: React.FC<JsonEditorProps>;
|
|
12
|
-
export default JsonEditor;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
3
|
-
import { Button } from "antd";
|
|
4
|
-
import { CompressOutlined, FormatPainterOutlined } from "@ant-design/icons";
|
|
5
|
-
import { LineNumberEditor } from "./LineNumberEditor.js";
|
|
6
|
-
import { CardHeader, EditorWrapper, ErrorMessage, HeaderActions, HeaderTitle, JsonEditorContainer } from "./style.js";
|
|
7
|
-
const JsonEditor = ({ value, onChange, placeholder = 'Enter JSON here...', readOnly = false, style, className, height })=>{
|
|
8
|
-
const [textValue, setTextValue] = useState('');
|
|
9
|
-
const [error, setError] = useState(null);
|
|
10
|
-
useEffect(()=>{
|
|
11
|
-
if (void 0 !== value) if ('string' == typeof value) {
|
|
12
|
-
setTextValue(value);
|
|
13
|
-
setError(null);
|
|
14
|
-
} else try {
|
|
15
|
-
const jsonString = JSON.stringify(value, null, 2);
|
|
16
|
-
setTextValue(jsonString);
|
|
17
|
-
setError(null);
|
|
18
|
-
} catch (err) {
|
|
19
|
-
setTextValue('');
|
|
20
|
-
setError('Invalid JSON value provided');
|
|
21
|
-
}
|
|
22
|
-
else setTextValue('');
|
|
23
|
-
}, [
|
|
24
|
-
value
|
|
25
|
-
]);
|
|
26
|
-
const handleChange = (newText)=>{
|
|
27
|
-
setTextValue(newText);
|
|
28
|
-
if (readOnly) return;
|
|
29
|
-
if ('' === newText.trim() || !newText.startsWith('{') && !newText.startsWith('[')) {
|
|
30
|
-
onChange?.(newText);
|
|
31
|
-
setError(null);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
try {
|
|
35
|
-
if ('' === newText.trim()) {
|
|
36
|
-
onChange?.(void 0);
|
|
37
|
-
setError(null);
|
|
38
|
-
} else {
|
|
39
|
-
let parsed;
|
|
40
|
-
try {
|
|
41
|
-
parsed = JSON.parse(newText);
|
|
42
|
-
} catch (parseError) {
|
|
43
|
-
parsed = newText;
|
|
44
|
-
}
|
|
45
|
-
onChange?.(parsed);
|
|
46
|
-
setError(null);
|
|
47
|
-
}
|
|
48
|
-
} catch (err) {
|
|
49
|
-
setError('Invalid JSON format');
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
const handleFormat = ()=>{
|
|
53
|
-
if ('' === textValue.trim() || !textValue.startsWith('{') && !textValue.startsWith('[')) return void setError(null);
|
|
54
|
-
try {
|
|
55
|
-
const parsed = JSON.parse(textValue);
|
|
56
|
-
const formatted = JSON.stringify(parsed, null, 2);
|
|
57
|
-
setTextValue(formatted);
|
|
58
|
-
setError(null);
|
|
59
|
-
} catch (err) {
|
|
60
|
-
setError('Cannot format: Invalid JSON');
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
const handleCompress = ()=>{
|
|
64
|
-
if ('' === textValue.trim() || !textValue.startsWith('{') && !textValue.startsWith('[')) return void setError(null);
|
|
65
|
-
try {
|
|
66
|
-
const parsed = JSON.parse(textValue);
|
|
67
|
-
const compressed = JSON.stringify(parsed);
|
|
68
|
-
setTextValue(compressed);
|
|
69
|
-
setError(null);
|
|
70
|
-
} catch (err) {
|
|
71
|
-
setError('Cannot compress: Invalid JSON');
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
return /*#__PURE__*/ jsxs(JsonEditorContainer, {
|
|
75
|
-
className: className,
|
|
76
|
-
style: {
|
|
77
|
-
...style,
|
|
78
|
-
height: height || style?.height
|
|
79
|
-
},
|
|
80
|
-
children: [
|
|
81
|
-
/*#__PURE__*/ jsxs(CardHeader, {
|
|
82
|
-
children: [
|
|
83
|
-
/*#__PURE__*/ jsx(HeaderTitle, {
|
|
84
|
-
children: "JSON"
|
|
85
|
-
}),
|
|
86
|
-
/*#__PURE__*/ jsxs(HeaderActions, {
|
|
87
|
-
children: [
|
|
88
|
-
/*#__PURE__*/ jsx(Button, {
|
|
89
|
-
onClick: handleFormat,
|
|
90
|
-
disabled: readOnly,
|
|
91
|
-
size: "small",
|
|
92
|
-
icon: /*#__PURE__*/ jsx(FormatPainterOutlined, {}),
|
|
93
|
-
title: "Format JSON"
|
|
94
|
-
}),
|
|
95
|
-
/*#__PURE__*/ jsx(Button, {
|
|
96
|
-
onClick: handleCompress,
|
|
97
|
-
disabled: readOnly,
|
|
98
|
-
size: "small",
|
|
99
|
-
icon: /*#__PURE__*/ jsx(CompressOutlined, {}),
|
|
100
|
-
title: "Compress JSON"
|
|
101
|
-
})
|
|
102
|
-
]
|
|
103
|
-
})
|
|
104
|
-
]
|
|
105
|
-
}),
|
|
106
|
-
/*#__PURE__*/ jsx(EditorWrapper, {
|
|
107
|
-
children: /*#__PURE__*/ jsx(LineNumberEditor, {
|
|
108
|
-
value: textValue,
|
|
109
|
-
onChange: handleChange,
|
|
110
|
-
placeholder: placeholder,
|
|
111
|
-
readOnly: readOnly,
|
|
112
|
-
hasError: !!error
|
|
113
|
-
})
|
|
114
|
-
}),
|
|
115
|
-
error && /*#__PURE__*/ jsx(ErrorMessage, {
|
|
116
|
-
children: error
|
|
117
|
-
})
|
|
118
|
-
]
|
|
119
|
-
});
|
|
120
|
-
};
|
|
121
|
-
const Container = JsonEditor;
|
|
122
|
-
export { JsonEditor, Container as default };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface LineNumberEditorProps {
|
|
3
|
-
value: string;
|
|
4
|
-
onChange: (value: string) => void;
|
|
5
|
-
readOnly?: boolean;
|
|
6
|
-
hasError?: boolean;
|
|
7
|
-
placeholder?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare const LineNumberEditor: React.FC<LineNumberEditorProps>;
|
|
10
|
-
export {};
|