@ws-ui/http-handlers-editor 1.11.3-rc1 → 1.11.3-rc3
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/Portal.d.ts +4 -0
- package/dist/Standalone/Modals.d.ts +2 -0
- package/dist/Standalone/index.d.ts +1 -1
- package/dist/Standalone/style.css +1 -0
- package/dist/common.cjs.js +2 -0
- package/dist/common.cjs.js.map +1 -0
- package/dist/common.d.ts +1 -0
- package/dist/common.es.js +5 -0
- package/dist/common.es.js.map +1 -0
- package/dist/http-handlers-editor.css +1 -1
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +215 -198
- package/dist/index.es.js.map +1 -1
- package/package.json +5 -5
package/dist/index.es.js
CHANGED
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import { jsx as e, jsxs as o, Fragment as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { Combobox as S, Transition as le } from "@headlessui/react";
|
|
13
|
-
import { Tooltip as E, ModalColor as ie, ModalType as oe, useHotkeys as Me, ControlledSwitch as Ve, HTTP_HANDLERS_TAB_PATH as Ke } from "@ws-ui/shared";
|
|
1
|
+
import { jsx as e, jsxs as o, Fragment as F } from "react/jsx-runtime";
|
|
2
|
+
import { useSensors as he, useSensor as X, PointerSensor as me, KeyboardSensor as ge, DndContext as xe, closestCenter as fe, DragOverlay as ye } from "@dnd-kit/core";
|
|
3
|
+
import { useSortable as be, sortableKeyboardCoordinates as ve, SortableContext as Ne, verticalListSortingStrategy as we, arrayMove as Ee } from "@dnd-kit/sortable";
|
|
4
|
+
import { FdWarningDanger as q, FdRegex as Ce, FdUnRegex as De, FdDuplicate as te, FdPen as Te, FdTrash as He, FdCloseNaked as M, FdInfoCircle as ne, FdCheckCircle as Re, FdClose as Se, FdDragHandle as Pe, FdDown as J, FdEmpty as W, FdCode as Ie, FdPlus as Y } from "@ws-ui/icons";
|
|
5
|
+
import { useAppDispatch as G, switchEditor as Ae, useAppSelector as B, selectCatalog as re, openModal as ae, selectTabByPath as ke, setContent as _e, selectModals as Le, editModal as Oe, closeModal as Fe, ReduxProvider as $e, getStore as je } from "@ws-ui/store";
|
|
6
|
+
import { createContext as Ge, useReducer as qe, useEffect as $, useContext as Me, useState as _, Fragment as se, useMemo as Be } from "react";
|
|
7
|
+
import { generate as K } from "short-uuid";
|
|
8
|
+
import { z as k } from "zod";
|
|
9
|
+
import { ToolbarIcon as Ue, Tooltip as E, ModalColor as le, ModalType as ie, useHotkeys as ze, ControlledSwitch as Ve, Modal as Ke, HTTP_HANDLERS_TAB_PATH as Je } from "@ws-ui/shared";
|
|
10
|
+
import { CSS as We } from "@dnd-kit/utilities";
|
|
11
|
+
import { Combobox as P, Transition as oe } from "@headlessui/react";
|
|
14
12
|
import C from "classnames";
|
|
15
|
-
import { useMultipleSelection as
|
|
16
|
-
import { omit as de, isEqual as
|
|
17
|
-
import { Subject as
|
|
13
|
+
import { useMultipleSelection as O, useCombobox as L } from "downshift";
|
|
14
|
+
import { omit as de, isEqual as Qe } from "lodash";
|
|
15
|
+
import { Subject as Xe } from "rxjs";
|
|
18
16
|
import Z from "randexp";
|
|
19
|
-
|
|
17
|
+
import { HTTP_HANDLERS_EDITOR_SCOPE_CLASS as Ye } from "./common.es.js";
|
|
18
|
+
const Ze = ({
|
|
20
19
|
label: t,
|
|
21
20
|
Icon: a,
|
|
22
21
|
tab: r,
|
|
23
22
|
editor: i,
|
|
24
|
-
onBeforeClick:
|
|
23
|
+
onBeforeClick: d
|
|
25
24
|
}) => {
|
|
26
|
-
const x =
|
|
25
|
+
const x = G();
|
|
27
26
|
return /* @__PURE__ */ e(
|
|
28
|
-
|
|
27
|
+
Ue,
|
|
29
28
|
{
|
|
30
29
|
label: t,
|
|
31
30
|
Icon: a,
|
|
32
31
|
as: "button",
|
|
33
32
|
onClick: () => {
|
|
34
|
-
|
|
33
|
+
d == null || d(), x(
|
|
35
34
|
Ae({
|
|
36
35
|
tab: r,
|
|
37
36
|
editor: i
|
|
@@ -40,7 +39,7 @@ const Qe = ({
|
|
|
40
39
|
}
|
|
41
40
|
}
|
|
42
41
|
);
|
|
43
|
-
}, ce = Ge(void 0),
|
|
42
|
+
}, ce = Ge(void 0), j = new Xe(), et = (t, a) => {
|
|
44
43
|
switch (a.type) {
|
|
45
44
|
case "UPDATE_HANDLERS":
|
|
46
45
|
return {
|
|
@@ -57,7 +56,7 @@ const Qe = ({
|
|
|
57
56
|
).some(Boolean) && r.verbs.length === 0)
|
|
58
57
|
return {
|
|
59
58
|
...t,
|
|
60
|
-
content: t.content.filter((
|
|
59
|
+
content: t.content.filter((d) => d.id !== r.id),
|
|
61
60
|
editing: a.payload
|
|
62
61
|
};
|
|
63
62
|
}
|
|
@@ -67,7 +66,7 @@ const Qe = ({
|
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
68
|
case "ADD_HANDLER": {
|
|
70
|
-
const r =
|
|
69
|
+
const r = K();
|
|
71
70
|
return {
|
|
72
71
|
...t,
|
|
73
72
|
content: [...t.content, { ...a.payload, id: r }],
|
|
@@ -103,7 +102,7 @@ const Qe = ({
|
|
|
103
102
|
...t,
|
|
104
103
|
content: [
|
|
105
104
|
...t.content,
|
|
106
|
-
{ ...r, id:
|
|
105
|
+
{ ...r, id: K(), isExpanded: !0 }
|
|
107
106
|
]
|
|
108
107
|
} : t;
|
|
109
108
|
}
|
|
@@ -119,7 +118,7 @@ const Qe = ({
|
|
|
119
118
|
return {
|
|
120
119
|
...t,
|
|
121
120
|
content: a.payload.map((r) => {
|
|
122
|
-
const i = t.content.find((
|
|
121
|
+
const i = t.content.find((d) => d.id === r.id);
|
|
123
122
|
return i ? {
|
|
124
123
|
...r,
|
|
125
124
|
...i
|
|
@@ -129,7 +128,7 @@ const Qe = ({
|
|
|
129
128
|
default:
|
|
130
129
|
throw new Error("Unknown action type");
|
|
131
130
|
}
|
|
132
|
-
},
|
|
131
|
+
}, tt = ({
|
|
133
132
|
children: t,
|
|
134
133
|
content: a
|
|
135
134
|
}) => {
|
|
@@ -137,41 +136,41 @@ const Qe = ({
|
|
|
137
136
|
content: a,
|
|
138
137
|
editing: null,
|
|
139
138
|
newlyCreatedHandlerID: null
|
|
140
|
-
}, [i,
|
|
141
|
-
return
|
|
142
|
-
|
|
139
|
+
}, [i, d] = qe(et, r);
|
|
140
|
+
return $(() => {
|
|
141
|
+
d({
|
|
143
142
|
type: "SYNC_DATA",
|
|
144
143
|
payload: a
|
|
145
144
|
});
|
|
146
|
-
}, [a]), /* @__PURE__ */ e(ce.Provider, { value: { state: i, dispatch:
|
|
145
|
+
}, [a]), /* @__PURE__ */ e(ce.Provider, { value: { state: i, dispatch: d }, children: t });
|
|
147
146
|
}, Q = () => {
|
|
148
|
-
const t =
|
|
147
|
+
const t = Me(ce);
|
|
149
148
|
if (!t)
|
|
150
149
|
throw new Error("useHTTPHandlers must be used within a HandlerProvider");
|
|
151
150
|
return t;
|
|
152
|
-
},
|
|
153
|
-
const
|
|
151
|
+
}, nt = ({ initialSelectedItems: t, onChange: a, touched: r, onBlur: i }) => {
|
|
152
|
+
const d = ["GET", "POST", "PUT", "DELETE"];
|
|
154
153
|
function x(h, u) {
|
|
155
154
|
const N = u.toLowerCase();
|
|
156
|
-
return
|
|
155
|
+
return d.filter(function(s) {
|
|
157
156
|
return !h.includes(s) && s.toLowerCase().includes(N);
|
|
158
157
|
});
|
|
159
158
|
}
|
|
160
|
-
const [f, g] = _(""), [
|
|
161
|
-
|
|
159
|
+
const [f, g] = _(""), [c, n] = _(t);
|
|
160
|
+
$(() => {
|
|
162
161
|
n(t);
|
|
163
162
|
}, [t]);
|
|
164
|
-
const l =
|
|
165
|
-
() => x(
|
|
166
|
-
[
|
|
167
|
-
), { getSelectedItemProps: p, getDropdownProps: b, removeSelectedItem: v } =
|
|
168
|
-
selectedItems:
|
|
163
|
+
const l = Be(
|
|
164
|
+
() => x(c, f),
|
|
165
|
+
[c, f]
|
|
166
|
+
), { getSelectedItemProps: p, getDropdownProps: b, removeSelectedItem: v } = O({
|
|
167
|
+
selectedItems: c,
|
|
169
168
|
onStateChange({ selectedItems: h = [], type: u }) {
|
|
170
169
|
switch (u) {
|
|
171
|
-
case
|
|
172
|
-
case
|
|
173
|
-
case
|
|
174
|
-
case
|
|
170
|
+
case O.stateChangeTypes.SelectedItemKeyDownBackspace:
|
|
171
|
+
case O.stateChangeTypes.SelectedItemKeyDownDelete:
|
|
172
|
+
case O.stateChangeTypes.DropdownKeyDownBackspace:
|
|
173
|
+
case O.stateChangeTypes.FunctionRemoveSelectedItem:
|
|
175
174
|
n(h);
|
|
176
175
|
break;
|
|
177
176
|
}
|
|
@@ -179,7 +178,7 @@ const Qe = ({
|
|
|
179
178
|
}), {
|
|
180
179
|
isOpen: y,
|
|
181
180
|
getToggleButtonProps: w,
|
|
182
|
-
getMenuProps:
|
|
181
|
+
getMenuProps: I,
|
|
183
182
|
getInputProps: D,
|
|
184
183
|
highlightedIndex: T,
|
|
185
184
|
getItemProps: H,
|
|
@@ -194,8 +193,8 @@ const Qe = ({
|
|
|
194
193
|
selectedItem: null,
|
|
195
194
|
inputValue: f,
|
|
196
195
|
stateReducer(h, u) {
|
|
197
|
-
const { changes: N, type:
|
|
198
|
-
switch (
|
|
196
|
+
const { changes: N, type: S } = u;
|
|
197
|
+
switch (S) {
|
|
199
198
|
case L.stateChangeTypes.InputKeyDownEnter:
|
|
200
199
|
case L.stateChangeTypes.ItemClick:
|
|
201
200
|
return {
|
|
@@ -218,7 +217,7 @@ const Qe = ({
|
|
|
218
217
|
case L.stateChangeTypes.InputKeyDownEnter:
|
|
219
218
|
case L.stateChangeTypes.ItemClick:
|
|
220
219
|
case L.stateChangeTypes.InputBlur:
|
|
221
|
-
N && (n([...
|
|
220
|
+
N && (n([...c, N]), g(""));
|
|
222
221
|
break;
|
|
223
222
|
case L.stateChangeTypes.InputChange:
|
|
224
223
|
g(h);
|
|
@@ -226,9 +225,9 @@ const Qe = ({
|
|
|
226
225
|
}
|
|
227
226
|
}
|
|
228
227
|
});
|
|
229
|
-
return
|
|
230
|
-
a(
|
|
231
|
-
}, [
|
|
228
|
+
return $(() => {
|
|
229
|
+
a(c);
|
|
230
|
+
}, [c]), /* @__PURE__ */ o("div", { className: "relative flex-1", children: [
|
|
232
231
|
/* @__PURE__ */ o(
|
|
233
232
|
"div",
|
|
234
233
|
{
|
|
@@ -236,13 +235,13 @@ const Qe = ({
|
|
|
236
235
|
"bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative flex items-center w-full cursor-default overflow-hidden rounded p-px text-left focus:outline-none",
|
|
237
236
|
{
|
|
238
237
|
"ring-1 ring-primary-dark rounded-b-none": y && l.length,
|
|
239
|
-
"ring-1 ring-red-400 overflow-visible":
|
|
238
|
+
"ring-1 ring-red-400 overflow-visible": c.length === 0 && r
|
|
240
239
|
}
|
|
241
240
|
),
|
|
242
241
|
onBlur: i,
|
|
243
242
|
children: [
|
|
244
|
-
|
|
245
|
-
|
|
243
|
+
c.length === 0 && !y && r && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: c.length === 0 && "At least one HTTP verb is required" }),
|
|
244
|
+
c.map(
|
|
246
245
|
function(u, N) {
|
|
247
246
|
return /* @__PURE__ */ o(
|
|
248
247
|
"span",
|
|
@@ -250,7 +249,7 @@ const Qe = ({
|
|
|
250
249
|
className: C(
|
|
251
250
|
"bg-grey-600 text-s mr-1 flex items-center rounded px-1 py-0.5 uppercase",
|
|
252
251
|
{
|
|
253
|
-
"bg-red-400": !
|
|
252
|
+
"bg-red-400": !d.includes(u)
|
|
254
253
|
}
|
|
255
254
|
),
|
|
256
255
|
...p({
|
|
@@ -262,11 +261,11 @@ const Qe = ({
|
|
|
262
261
|
/* @__PURE__ */ e(
|
|
263
262
|
"span",
|
|
264
263
|
{
|
|
265
|
-
onClick: (
|
|
266
|
-
|
|
264
|
+
onClick: (S) => {
|
|
265
|
+
S.stopPropagation(), v(u);
|
|
267
266
|
},
|
|
268
267
|
className: "hover:bg-primary-hover ml-2 inline-block cursor-pointer rounded p-0.5 text-gray-100 hover:text-white active:outline-none",
|
|
269
|
-
children: /* @__PURE__ */ e(
|
|
268
|
+
children: /* @__PURE__ */ e(M, {})
|
|
270
269
|
}
|
|
271
270
|
)
|
|
272
271
|
]
|
|
@@ -285,7 +284,7 @@ const Qe = ({
|
|
|
285
284
|
)
|
|
286
285
|
),
|
|
287
286
|
className: "flex-grow border-none bg-transparent px-1 py-1 text-xs outline-none",
|
|
288
|
-
placeholder:
|
|
287
|
+
placeholder: c.length === 0 ? "Select HTTP verbs" : "",
|
|
289
288
|
size: 1
|
|
290
289
|
}
|
|
291
290
|
),
|
|
@@ -295,7 +294,7 @@ const Qe = ({
|
|
|
295
294
|
className: "absolute inset-y-0 right-0 flex items-center pr-2",
|
|
296
295
|
type: "button",
|
|
297
296
|
...w(),
|
|
298
|
-
children: /* @__PURE__ */ e(
|
|
297
|
+
children: /* @__PURE__ */ e(J, { className: "h-3 w-3 text-gray-50", "aria-hidden": "true" })
|
|
299
298
|
}
|
|
300
299
|
)
|
|
301
300
|
]
|
|
@@ -305,7 +304,7 @@ const Qe = ({
|
|
|
305
304
|
"ul",
|
|
306
305
|
{
|
|
307
306
|
className: `ring-primary-dark bg-grey-900 text-s absolute z-10 w-full rounded-b ring-1 p-1 text-white ${!(y && l.length) && "hidden"}`,
|
|
308
|
-
...
|
|
307
|
+
...I(),
|
|
309
308
|
children: y && l.map((h, u) => /* @__PURE__ */ e(
|
|
310
309
|
"li",
|
|
311
310
|
{
|
|
@@ -322,16 +321,16 @@ const Qe = ({
|
|
|
322
321
|
}
|
|
323
322
|
)
|
|
324
323
|
] });
|
|
325
|
-
},
|
|
324
|
+
}, rt = ({
|
|
326
325
|
value: t,
|
|
327
326
|
options: a,
|
|
328
327
|
errorMessage: r = "",
|
|
329
328
|
onChange: i,
|
|
330
|
-
onBlur:
|
|
329
|
+
onBlur: d
|
|
331
330
|
}) => {
|
|
332
|
-
const [x, f] = _(""), g = a.find((n) => n.name === t),
|
|
331
|
+
const [x, f] = _(""), g = a.find((n) => n.name === t), c = x === "" ? a : a.filter((n) => n.name.toLowerCase().includes(x.toLowerCase()));
|
|
333
332
|
return /* @__PURE__ */ e(
|
|
334
|
-
|
|
333
|
+
P,
|
|
335
334
|
{
|
|
336
335
|
value: { name: t },
|
|
337
336
|
onChange: (n) => i(n.name),
|
|
@@ -349,7 +348,7 @@ const Qe = ({
|
|
|
349
348
|
),
|
|
350
349
|
children: [
|
|
351
350
|
/* @__PURE__ */ e(
|
|
352
|
-
|
|
351
|
+
P.Input,
|
|
353
352
|
{
|
|
354
353
|
className: C(
|
|
355
354
|
"bg-grey-300 text-s w-full border-none py-1 px-2 focus:outline-none rounded",
|
|
@@ -360,12 +359,12 @@ const Qe = ({
|
|
|
360
359
|
displayValue: (l) => l.name,
|
|
361
360
|
onChange: (l) => f(l.target.value),
|
|
362
361
|
style: { caretColor: "white" },
|
|
363
|
-
onBlur:
|
|
362
|
+
onBlur: d
|
|
364
363
|
}
|
|
365
364
|
),
|
|
366
365
|
/* @__PURE__ */ o("span", { className: "inset-y-0 right-0 flex items-center gap-1 pr-2", children: [
|
|
367
366
|
!g && !n && r && /* @__PURE__ */ e("div", { className: "absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600", children: r }),
|
|
368
|
-
t ? /* @__PURE__ */ o(
|
|
367
|
+
t ? /* @__PURE__ */ o(F, { children: [
|
|
369
368
|
/* @__PURE__ */ e(
|
|
370
369
|
"button",
|
|
371
370
|
{
|
|
@@ -373,7 +372,7 @@ const Qe = ({
|
|
|
373
372
|
f(""), i("");
|
|
374
373
|
},
|
|
375
374
|
children: /* @__PURE__ */ e(
|
|
376
|
-
|
|
375
|
+
M,
|
|
377
376
|
{
|
|
378
377
|
className: "text-grey-50 h-3 w-3",
|
|
379
378
|
"aria-hidden": "true"
|
|
@@ -383,28 +382,28 @@ const Qe = ({
|
|
|
383
382
|
),
|
|
384
383
|
/* @__PURE__ */ e("span", { className: "bg-grey-50 h-3 w-[1px] rounded-full" })
|
|
385
384
|
] }) : null,
|
|
386
|
-
/* @__PURE__ */ e(
|
|
385
|
+
/* @__PURE__ */ e(P.Button, { children: /* @__PURE__ */ e(J, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
|
|
387
386
|
] })
|
|
388
387
|
]
|
|
389
388
|
}
|
|
390
389
|
),
|
|
391
390
|
/* @__PURE__ */ e(
|
|
392
|
-
|
|
391
|
+
oe,
|
|
393
392
|
{
|
|
394
393
|
as: se,
|
|
395
394
|
leave: "transition ease-in durati pb-0.5on-100",
|
|
396
395
|
leaveFrom: "opacity-100",
|
|
397
396
|
leaveTo: "opacity-0",
|
|
398
397
|
afterLeave: () => f(""),
|
|
399
|
-
children: /* @__PURE__ */ e(
|
|
400
|
-
/* @__PURE__ */ e(
|
|
398
|
+
children: /* @__PURE__ */ e(P.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: c.length === 0 ? /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5 ", children: [
|
|
399
|
+
/* @__PURE__ */ e(W, { className: "inline h-4 w-4" }),
|
|
401
400
|
" Nothing found."
|
|
402
|
-
] }) :
|
|
403
|
-
|
|
401
|
+
] }) : c.map((l, p) => /* @__PURE__ */ e(
|
|
402
|
+
P.Option,
|
|
404
403
|
{
|
|
405
404
|
className: ({ active: b }) => `relative cursor-default select-none ${b ? "bg-primary-hover" : ""}`,
|
|
406
405
|
value: l,
|
|
407
|
-
children: ({ selected: b }) => /* @__PURE__ */ e(
|
|
406
|
+
children: ({ selected: b }) => /* @__PURE__ */ e(F, { children: /* @__PURE__ */ e(
|
|
408
407
|
"span",
|
|
409
408
|
{
|
|
410
409
|
className: `block truncate p-2 py-1 ${b ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
|
|
@@ -420,15 +419,15 @@ const Qe = ({
|
|
|
420
419
|
},
|
|
421
420
|
t
|
|
422
421
|
);
|
|
423
|
-
},
|
|
422
|
+
}, at = ({
|
|
424
423
|
value: t,
|
|
425
424
|
options: a,
|
|
426
425
|
onChange: r,
|
|
427
426
|
errorMessage: i,
|
|
428
|
-
onBlur:
|
|
427
|
+
onBlur: d
|
|
429
428
|
}) => {
|
|
430
|
-
const [x, f] = _(""), g = a.find((l) => l.name === t),
|
|
431
|
-
return /* @__PURE__ */ e(
|
|
429
|
+
const [x, f] = _(""), g = a.find((l) => l.name === t), c = g && g.exposed, n = x === "" ? a : a.filter((l) => l.name.toLowerCase().includes(x.toLowerCase()));
|
|
430
|
+
return /* @__PURE__ */ e(P, { value: { name: t }, onChange: (l) => r(l.name), children: ({ open: l }) => /* @__PURE__ */ o("div", { className: "relative", children: [
|
|
432
431
|
/* @__PURE__ */ o(
|
|
433
432
|
"div",
|
|
434
433
|
{
|
|
@@ -436,26 +435,26 @@ const Qe = ({
|
|
|
436
435
|
"bg-grey-300 focus-within:ring-1 focus-within:ring-primary-dark relative w-full cursor-default overflow-hidden rounded text-left inline-flex",
|
|
437
436
|
{
|
|
438
437
|
"ring-1 ring-red-400": i,
|
|
439
|
-
"ring-1 ring-yellow-500":
|
|
438
|
+
"ring-1 ring-yellow-500": c,
|
|
440
439
|
"ring-1 ring-primary-dark rounded-b-none": l,
|
|
441
440
|
"overflow-visible": !l && i
|
|
442
441
|
}
|
|
443
442
|
),
|
|
444
443
|
children: [
|
|
445
444
|
/* @__PURE__ */ e(
|
|
446
|
-
|
|
445
|
+
P.Input,
|
|
447
446
|
{
|
|
448
447
|
className: C(
|
|
449
448
|
"bg-grey-300 text-s w-full border-none py-1 px-2 focus:outline-none truncate rounded",
|
|
450
449
|
{
|
|
451
450
|
"!text-red-400": i,
|
|
452
|
-
"!text-yellow-500":
|
|
451
|
+
"!text-yellow-500": c
|
|
453
452
|
}
|
|
454
453
|
),
|
|
455
454
|
style: { caretColor: "white" },
|
|
456
455
|
displayValue: (p) => p.name,
|
|
457
456
|
onChange: (p) => f(p.target.value),
|
|
458
|
-
onBlur:
|
|
457
|
+
onBlur: d
|
|
459
458
|
}
|
|
460
459
|
),
|
|
461
460
|
!l && i && /* @__PURE__ */ e(
|
|
@@ -463,13 +462,13 @@ const Qe = ({
|
|
|
463
462
|
{
|
|
464
463
|
className: C(
|
|
465
464
|
"absolute inset-x-0 top-[25px] z-[1] rounded-b-sm bg-red-200 px-1 text-xs text-red-600 ring-1 ring-red-600",
|
|
466
|
-
{ "!text-yellow-500 ring-yellow-500 bg-white":
|
|
465
|
+
{ "!text-yellow-500 ring-yellow-500 bg-white": c }
|
|
467
466
|
),
|
|
468
467
|
children: i
|
|
469
468
|
}
|
|
470
469
|
),
|
|
471
470
|
/* @__PURE__ */ o("span", { className: "inset-y-0 right-0 flex items-center gap-1 pr-2", children: [
|
|
472
|
-
t ? /* @__PURE__ */ o(
|
|
471
|
+
t ? /* @__PURE__ */ o(F, { children: [
|
|
473
472
|
/* @__PURE__ */ e(
|
|
474
473
|
"button",
|
|
475
474
|
{
|
|
@@ -477,7 +476,7 @@ const Qe = ({
|
|
|
477
476
|
f(""), r("");
|
|
478
477
|
},
|
|
479
478
|
children: /* @__PURE__ */ e(
|
|
480
|
-
|
|
479
|
+
M,
|
|
481
480
|
{
|
|
482
481
|
className: "text-grey-50 h-3 w-3",
|
|
483
482
|
"aria-hidden": "true"
|
|
@@ -487,30 +486,30 @@ const Qe = ({
|
|
|
487
486
|
),
|
|
488
487
|
/* @__PURE__ */ e("span", { className: "bg-grey-50 h-3 w-[1px] rounded-full" })
|
|
489
488
|
] }) : null,
|
|
490
|
-
/* @__PURE__ */ e(
|
|
489
|
+
/* @__PURE__ */ e(P.Button, { children: /* @__PURE__ */ e(J, { className: "text-grey-50 h-3 w-3", "aria-hidden": "true" }) })
|
|
491
490
|
] })
|
|
492
491
|
]
|
|
493
492
|
}
|
|
494
493
|
),
|
|
495
494
|
/* @__PURE__ */ e(
|
|
496
|
-
|
|
495
|
+
oe,
|
|
497
496
|
{
|
|
498
497
|
as: se,
|
|
499
498
|
leave: "transition ease-in duration-100",
|
|
500
499
|
leaveFrom: "opacity-100",
|
|
501
500
|
leaveTo: "opacity-0",
|
|
502
501
|
afterLeave: () => f(""),
|
|
503
|
-
children: /* @__PURE__ */ e(
|
|
504
|
-
|
|
502
|
+
children: /* @__PURE__ */ e(P.Options, { className: "bg-grey-900 text-s text-grey-100 sm:text-s absolute z-50 max-h-60 w-full overflow-auto rounded-b ring-1 ring-primary-dark p-1 focus:outline-none", children: n.length ? n.map((p, b) => /* @__PURE__ */ e(
|
|
503
|
+
P.Option,
|
|
505
504
|
{
|
|
506
505
|
className: ({ active: v }) => `relative cursor-default select-none ${v ? "bg-primary-hover" : ""}`,
|
|
507
506
|
value: p,
|
|
508
|
-
children: ({ selected: v }) => /* @__PURE__ */ e(
|
|
507
|
+
children: ({ selected: v }) => /* @__PURE__ */ e(F, { children: /* @__PURE__ */ o(
|
|
509
508
|
"span",
|
|
510
509
|
{
|
|
511
510
|
className: `text-s flex items-center gap-2 truncate p-2 py-1 ${v ? "bg-primary-dark font-medium text-white" : "font-normal"}`,
|
|
512
511
|
children: [
|
|
513
|
-
p.exposed && /* @__PURE__ */ e(
|
|
512
|
+
p.exposed && /* @__PURE__ */ e(q, { className: "text-yellow-500" }),
|
|
514
513
|
/* @__PURE__ */ e("span", { className: "flex-1 truncate", title: p.name, children: p.name })
|
|
515
514
|
]
|
|
516
515
|
}
|
|
@@ -518,13 +517,13 @@ const Qe = ({
|
|
|
518
517
|
},
|
|
519
518
|
b
|
|
520
519
|
)) : /* @__PURE__ */ o("div", { className: "text-s text-grey-200 relative cursor-default select-none px-0.5 py-0.5", children: [
|
|
521
|
-
/* @__PURE__ */ e(
|
|
520
|
+
/* @__PURE__ */ e(W, { className: "inline h-4 w-4" }),
|
|
522
521
|
" Nothing found."
|
|
523
522
|
] }) })
|
|
524
523
|
}
|
|
525
524
|
)
|
|
526
525
|
] }) });
|
|
527
|
-
}, pe = ({ listeners: t, attributes: a }) => /* @__PURE__ */ e("button", { ...a, ...t, children: /* @__PURE__ */ e(
|
|
526
|
+
}, pe = ({ listeners: t, attributes: a }) => /* @__PURE__ */ e("button", { ...a, ...t, children: /* @__PURE__ */ e(Pe, {}) }), ue = (t) => {
|
|
528
527
|
var r;
|
|
529
528
|
if (!t) return "";
|
|
530
529
|
let a;
|
|
@@ -535,45 +534,45 @@ const Qe = ({
|
|
|
535
534
|
a = "";
|
|
536
535
|
}
|
|
537
536
|
return `Requests matching regex will be handled example: ${a}`;
|
|
538
|
-
},
|
|
537
|
+
}, st = ({
|
|
539
538
|
id: t,
|
|
540
539
|
class: a,
|
|
541
540
|
method: r,
|
|
542
541
|
pattern: i,
|
|
543
|
-
verbs:
|
|
542
|
+
verbs: d,
|
|
544
543
|
regexPattern: x,
|
|
545
544
|
asRegex: f,
|
|
546
545
|
listeners: g,
|
|
547
|
-
attributes:
|
|
546
|
+
attributes: c
|
|
548
547
|
}) => {
|
|
549
|
-
var
|
|
548
|
+
var S;
|
|
550
549
|
const [n, l] = _({
|
|
551
550
|
className: a,
|
|
552
551
|
method: r,
|
|
553
552
|
pattern: i,
|
|
554
|
-
verbs:
|
|
553
|
+
verbs: d,
|
|
555
554
|
asRegex: f,
|
|
556
555
|
regexPattern: x
|
|
557
|
-
}), p =
|
|
556
|
+
}), p = B(re), b = Object.values((p == null ? void 0 : p.singletons) || {}), v = (S = b.find((s) => s.name === n.className)) == null ? void 0 : S.methods.map(({ name: s, exposed: m }) => ({ name: s, exposed: m })), {
|
|
558
557
|
dispatch: y,
|
|
559
558
|
state: { newlyCreatedHandlerID: w }
|
|
560
|
-
} = Q(),
|
|
559
|
+
} = Q(), I = G();
|
|
561
560
|
function D() {
|
|
562
|
-
const { className: s, method: m, asRegex:
|
|
563
|
-
return !!(s && m && (
|
|
561
|
+
const { className: s, method: m, asRegex: A, regexPattern: U, pattern: z, verbs: V } = n;
|
|
562
|
+
return !!(s && m && (A ? U : !z.endsWith("/")) && V.length);
|
|
564
563
|
}
|
|
565
564
|
function T() {
|
|
566
565
|
if (D()) {
|
|
567
|
-
const { className: s, method: m, asRegex:
|
|
566
|
+
const { className: s, method: m, asRegex: A, regexPattern: U, pattern: z, verbs: V } = n;
|
|
568
567
|
y({
|
|
569
568
|
type: "UPDATE_HANDLER",
|
|
570
569
|
id: t,
|
|
571
570
|
payload: {
|
|
572
571
|
class: s,
|
|
573
572
|
method: m,
|
|
574
|
-
verbs:
|
|
575
|
-
asRegex:
|
|
576
|
-
...
|
|
573
|
+
verbs: V,
|
|
574
|
+
asRegex: A,
|
|
575
|
+
...A ? { regexPattern: U } : { pattern: z }
|
|
577
576
|
}
|
|
578
577
|
}), y({ type: "SET_EDITING_HANDLER", payload: null });
|
|
579
578
|
}
|
|
@@ -584,29 +583,29 @@ const Qe = ({
|
|
|
584
583
|
method: r,
|
|
585
584
|
pattern: i,
|
|
586
585
|
regexPattern: x,
|
|
587
|
-
verbs:
|
|
586
|
+
verbs: d
|
|
588
587
|
}, m = de(n, ["id", "isExpanded"]);
|
|
589
588
|
if (!D()) {
|
|
590
589
|
y({ type: "DELETE_HANDLER", id: `${w}` }), y({ type: "SET_EDITING_HANDLER", payload: null });
|
|
591
590
|
return;
|
|
592
591
|
}
|
|
593
|
-
if (!
|
|
594
|
-
const { confirmed:
|
|
592
|
+
if (!Qe(s, m)) {
|
|
593
|
+
const { confirmed: A } = await I(
|
|
595
594
|
ae({
|
|
596
595
|
title: "Cancel Changes",
|
|
597
|
-
type:
|
|
598
|
-
color:
|
|
596
|
+
type: ie.CONFIRM,
|
|
597
|
+
color: le.DANGER,
|
|
599
598
|
message: "Are you sure you want to cancel changes made to this Handler?",
|
|
600
599
|
icon: "FdWarningDanger"
|
|
601
600
|
})
|
|
602
601
|
).unwrap();
|
|
603
|
-
if (
|
|
602
|
+
if (A) {
|
|
604
603
|
w === t && y({ type: "DELETE_HANDLER", id: t }), y({ type: "SET_EDITING_HANDLER", payload: null });
|
|
605
604
|
return;
|
|
606
605
|
}
|
|
607
606
|
}
|
|
608
607
|
};
|
|
609
|
-
|
|
608
|
+
ze(
|
|
610
609
|
"esc",
|
|
611
610
|
() => {
|
|
612
611
|
setTimeout(() => {
|
|
@@ -614,8 +613,8 @@ const Qe = ({
|
|
|
614
613
|
}, 100);
|
|
615
614
|
},
|
|
616
615
|
[]
|
|
617
|
-
),
|
|
618
|
-
|
|
616
|
+
), $(() => {
|
|
617
|
+
j.subscribe((s) => {
|
|
619
618
|
s === t && T();
|
|
620
619
|
});
|
|
621
620
|
}, [n, t]);
|
|
@@ -645,12 +644,12 @@ const Qe = ({
|
|
|
645
644
|
pe,
|
|
646
645
|
{
|
|
647
646
|
listeners: g,
|
|
648
|
-
attributes:
|
|
647
|
+
attributes: c
|
|
649
648
|
},
|
|
650
649
|
"grab-handle"
|
|
651
650
|
),
|
|
652
651
|
/* @__PURE__ */ e(
|
|
653
|
-
|
|
652
|
+
rt,
|
|
654
653
|
{
|
|
655
654
|
value: n.className,
|
|
656
655
|
onChange: (s) => {
|
|
@@ -664,7 +663,7 @@ const Qe = ({
|
|
|
664
663
|
)
|
|
665
664
|
] }),
|
|
666
665
|
/* @__PURE__ */ e("div", { className: "w-60 flex-shrink-0", children: /* @__PURE__ */ e(
|
|
667
|
-
|
|
666
|
+
at,
|
|
668
667
|
{
|
|
669
668
|
value: n.method,
|
|
670
669
|
onChange: (s) => {
|
|
@@ -718,7 +717,7 @@ const Qe = ({
|
|
|
718
717
|
},
|
|
719
718
|
className: "absolute inset-y-0 right-6 flex items-center gap-2 pr-2",
|
|
720
719
|
children: /* @__PURE__ */ e(
|
|
721
|
-
|
|
720
|
+
M,
|
|
722
721
|
{
|
|
723
722
|
className: "text-grey-200 h-3 w-3",
|
|
724
723
|
"aria-hidden": "true"
|
|
@@ -742,7 +741,7 @@ const Qe = ({
|
|
|
742
741
|
value: !!n.asRegex,
|
|
743
742
|
onChange: (s) => {
|
|
744
743
|
const m = s ? { regexPattern: i, asRegex: s } : { pattern: x, asRegex: s };
|
|
745
|
-
l((
|
|
744
|
+
l((A) => ({ ...A, ...m }));
|
|
746
745
|
},
|
|
747
746
|
className: `${n.asRegex ? "bg-primary-dark" : "bg-grey-300"}
|
|
748
747
|
relative inline-flex h-5 w-8 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,
|
|
@@ -758,7 +757,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
758
757
|
) }),
|
|
759
758
|
/* @__PURE__ */ o("div", { className: "flex flex-1 items-center", children: [
|
|
760
759
|
/* @__PURE__ */ e(
|
|
761
|
-
|
|
760
|
+
nt,
|
|
762
761
|
{
|
|
763
762
|
initialSelectedItems: n.verbs || [],
|
|
764
763
|
onChange: (s) => {
|
|
@@ -788,7 +787,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
788
787
|
}
|
|
789
788
|
),
|
|
790
789
|
onClick: T,
|
|
791
|
-
children: /* @__PURE__ */ e(
|
|
790
|
+
children: /* @__PURE__ */ e(Re, {})
|
|
792
791
|
}
|
|
793
792
|
) }),
|
|
794
793
|
/* @__PURE__ */ e(E, { label: "Cancel Changes", className: "px-1 py-3", children: /* @__PURE__ */ e(
|
|
@@ -807,41 +806,41 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
807
806
|
class: a,
|
|
808
807
|
method: r,
|
|
809
808
|
pattern: i,
|
|
810
|
-
verbs:
|
|
809
|
+
verbs: d,
|
|
811
810
|
isExpanded: x,
|
|
812
811
|
regexPattern: f,
|
|
813
812
|
asRegex: g
|
|
814
813
|
}) => {
|
|
815
|
-
var
|
|
816
|
-
const { attributes:
|
|
817
|
-
transform:
|
|
814
|
+
var S;
|
|
815
|
+
const { attributes: c, listeners: n, setNodeRef: l, transform: p, transition: b } = be({ id: t }), v = {
|
|
816
|
+
transform: We.Transform.toString(p),
|
|
818
817
|
transition: b
|
|
819
818
|
}, {
|
|
820
819
|
dispatch: y,
|
|
821
820
|
state: { editing: w }
|
|
822
|
-
} = Q(),
|
|
821
|
+
} = Q(), I = G(), D = g ? f : i, T = B(re), H = Object.values((T == null ? void 0 : T.singletons) || {}), R = (S = H == null ? void 0 : H.find((s) => s.name === a)) == null ? void 0 : S.methods.map(({ name: s, exposed: m }) => ({ name: s, exposed: m })), h = H == null ? void 0 : H.find(
|
|
823
822
|
(s) => s.name === a
|
|
824
823
|
), u = R == null ? void 0 : R.find((s) => s.name === r), N = u && u.exposed;
|
|
825
824
|
return /* @__PURE__ */ e("div", { className: "odd:bg-grey-500", ref: l, style: v, children: w === t ? /* @__PURE__ */ e(
|
|
826
|
-
|
|
825
|
+
st,
|
|
827
826
|
{
|
|
828
827
|
id: t,
|
|
829
828
|
class: a,
|
|
830
829
|
method: r,
|
|
831
830
|
pattern: i,
|
|
832
|
-
verbs:
|
|
831
|
+
verbs: d,
|
|
833
832
|
isExpanded: x,
|
|
834
833
|
regexPattern: f,
|
|
835
834
|
asRegex: g,
|
|
836
835
|
listeners: n,
|
|
837
|
-
attributes:
|
|
836
|
+
attributes: c
|
|
838
837
|
}
|
|
839
838
|
) : /* @__PURE__ */ o(
|
|
840
839
|
"div",
|
|
841
840
|
{
|
|
842
841
|
className: "flex items-center gap-2 rounded-b py-2.5 text-grey-50",
|
|
843
842
|
onDoubleClick: () => {
|
|
844
|
-
|
|
843
|
+
j.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
|
|
845
844
|
},
|
|
846
845
|
children: [
|
|
847
846
|
/* @__PURE__ */ o("div", { className: "flex w-60 flex-shrink-0 items-center gap-1 ", children: [
|
|
@@ -849,7 +848,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
849
848
|
pe,
|
|
850
849
|
{
|
|
851
850
|
listeners: n,
|
|
852
|
-
attributes:
|
|
851
|
+
attributes: c
|
|
853
852
|
},
|
|
854
853
|
"grab-handle"
|
|
855
854
|
),
|
|
@@ -866,7 +865,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
866
865
|
{
|
|
867
866
|
label: `The singleton "${a}" doesn't exist.`,
|
|
868
867
|
className: "!bg-red-300 !text-red-400",
|
|
869
|
-
children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(
|
|
868
|
+
children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(q, { className: "inline h-4 w-4 pb-0.5 text-red-400" }) })
|
|
870
869
|
}
|
|
871
870
|
),
|
|
872
871
|
" ",
|
|
@@ -889,7 +888,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
889
888
|
{
|
|
890
889
|
label: `The method "${r}" doesn't exist.`,
|
|
891
890
|
className: "!bg-red-300 !text-red-400",
|
|
892
|
-
children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(
|
|
891
|
+
children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(q, { className: "inline h-4 w-4 pb-0.5 text-red-400" }) })
|
|
893
892
|
}
|
|
894
893
|
),
|
|
895
894
|
" ",
|
|
@@ -898,7 +897,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
898
897
|
{
|
|
899
898
|
label: `Method "${r}" is already exposed`,
|
|
900
899
|
className: "!bg-yellow-100 !text-yellow-500",
|
|
901
|
-
children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(
|
|
900
|
+
children: /* @__PURE__ */ e("span", { className: "rounded p-0.5 hover:bg-red-400/30 pt-0.5 h-5 w-5 flex justify-center content-center", children: /* @__PURE__ */ e(q, { className: "inline h-4 w-4 pb-0.5 text-yellow-500" }) })
|
|
902
901
|
}
|
|
903
902
|
),
|
|
904
903
|
" ",
|
|
@@ -913,9 +912,9 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
913
912
|
children: /* @__PURE__ */ e("span", { children: D })
|
|
914
913
|
}
|
|
915
914
|
) : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "/" }) }),
|
|
916
|
-
/* @__PURE__ */ e("div", { className: "px-5 w-20 flex justify-center text-grey-200", children: g ? /* @__PURE__ */ e(
|
|
915
|
+
/* @__PURE__ */ e("div", { className: "px-5 w-20 flex justify-center text-grey-200", children: g ? /* @__PURE__ */ e(Ce, {}) : /* @__PURE__ */ e(De, {}) }),
|
|
917
916
|
/* @__PURE__ */ o("div", { className: "flex flex-1 items-center", children: [
|
|
918
|
-
/* @__PURE__ */ e("div", { className: "text-s w-full", children:
|
|
917
|
+
/* @__PURE__ */ e("div", { className: "text-s w-full", children: d.length ? d.join(",") : /* @__PURE__ */ e("span", { className: "text-grey-200 italic", children: "undefined" }) }),
|
|
919
918
|
/* @__PURE__ */ o("div", { className: "flex items-center gap-0.5 px-2", children: [
|
|
920
919
|
/* @__PURE__ */ e(E, { label: "Duplicate Handler", className: "px-1 py-3", children: /* @__PURE__ */ e(
|
|
921
920
|
"button",
|
|
@@ -930,9 +929,9 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
930
929
|
{
|
|
931
930
|
className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
|
|
932
931
|
onClick: () => {
|
|
933
|
-
|
|
932
|
+
j.next(w), y({ type: "SET_EDITING_HANDLER", payload: t });
|
|
934
933
|
},
|
|
935
|
-
children: /* @__PURE__ */ e(
|
|
934
|
+
children: /* @__PURE__ */ e(Te, {})
|
|
936
935
|
}
|
|
937
936
|
) }),
|
|
938
937
|
/* @__PURE__ */ e(E, { label: "Delete Handler", className: "px-1 py-3", placement: "top-end", children: /* @__PURE__ */ e(
|
|
@@ -940,18 +939,18 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
940
939
|
{
|
|
941
940
|
className: "hover:bg-primary-hover rounded p-1 text-gray-100 hover:text-white active:outline-none",
|
|
942
941
|
onClick: async () => {
|
|
943
|
-
const { confirmed: s } = await
|
|
942
|
+
const { confirmed: s } = await I(
|
|
944
943
|
ae({
|
|
945
944
|
title: "Delete Handler",
|
|
946
|
-
type:
|
|
947
|
-
color:
|
|
945
|
+
type: ie.CONFIRM,
|
|
946
|
+
color: le.DANGER,
|
|
948
947
|
message: "Are you sure you want to remove this Handler?",
|
|
949
948
|
icon: "FdWarningDanger"
|
|
950
949
|
})
|
|
951
950
|
).unwrap();
|
|
952
951
|
s && y({ type: "DELETE_HANDLER", id: t });
|
|
953
952
|
},
|
|
954
|
-
children: /* @__PURE__ */ e(
|
|
953
|
+
children: /* @__PURE__ */ e(He, {})
|
|
955
954
|
}
|
|
956
955
|
) })
|
|
957
956
|
] })
|
|
@@ -959,32 +958,32 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
959
958
|
]
|
|
960
959
|
}
|
|
961
960
|
) });
|
|
962
|
-
},
|
|
963
|
-
class:
|
|
964
|
-
method:
|
|
965
|
-
verbs:
|
|
966
|
-
id:
|
|
967
|
-
pattern:
|
|
968
|
-
regexPattern:
|
|
969
|
-
}),
|
|
970
|
-
const a =
|
|
961
|
+
}, lt = k.object({
|
|
962
|
+
class: k.string().optional(),
|
|
963
|
+
method: k.string().optional(),
|
|
964
|
+
verbs: k.string().optional(),
|
|
965
|
+
id: k.string().optional(),
|
|
966
|
+
pattern: k.string().optional(),
|
|
967
|
+
regexPattern: k.string().optional()
|
|
968
|
+
}), it = k.array(lt), ot = ({ path: t }) => {
|
|
969
|
+
const a = B(ke(t)), {
|
|
971
970
|
dispatch: r,
|
|
972
|
-
state: { content: i, editing:
|
|
973
|
-
} = Q(), x =
|
|
974
|
-
X(
|
|
975
|
-
X(
|
|
976
|
-
coordinateGetter:
|
|
971
|
+
state: { content: i, editing: d }
|
|
972
|
+
} = Q(), x = he(
|
|
973
|
+
X(me),
|
|
974
|
+
X(ge, {
|
|
975
|
+
coordinateGetter: ve
|
|
977
976
|
})
|
|
978
|
-
), [f, g] = _(null),
|
|
979
|
-
return
|
|
977
|
+
), [f, g] = _(null), c = i.find((l) => l.id === f), n = G();
|
|
978
|
+
return $(() => {
|
|
980
979
|
const l = JSON.stringify(
|
|
981
980
|
i.map(
|
|
982
|
-
({ isExpanded: b, asRegex: v, pattern: y, regexPattern: w, ...
|
|
981
|
+
({ isExpanded: b, asRegex: v, pattern: y, regexPattern: w, ...I }) => {
|
|
983
982
|
var T;
|
|
984
983
|
const D = v ? { regexPattern: w } : { pattern: y };
|
|
985
984
|
return {
|
|
986
|
-
...
|
|
987
|
-
verbs: (T =
|
|
985
|
+
...I,
|
|
986
|
+
verbs: (T = I.verbs) == null ? void 0 : T.join(","),
|
|
988
987
|
...D
|
|
989
988
|
};
|
|
990
989
|
}
|
|
@@ -993,7 +992,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
993
992
|
2
|
|
994
993
|
), p = typeof (a == null ? void 0 : a.content) == "string" ? a.content : JSON.stringify(a == null ? void 0 : a.content, null, 2);
|
|
995
994
|
l !== p && n(
|
|
996
|
-
|
|
995
|
+
_e({
|
|
997
996
|
path: t,
|
|
998
997
|
content: l
|
|
999
998
|
})
|
|
@@ -1001,7 +1000,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1001
1000
|
}, [i]), /* @__PURE__ */ o("div", { className: "bg-grey-700 flex h-full w-full flex-col text-white", children: [
|
|
1002
1001
|
/* @__PURE__ */ o("div", { className: "flex items-center justify-between border-b border-black p-2", children: [
|
|
1003
1002
|
a && /* @__PURE__ */ e(
|
|
1004
|
-
|
|
1003
|
+
Ze,
|
|
1005
1004
|
{
|
|
1006
1005
|
label: "Switch to text Editor",
|
|
1007
1006
|
Icon: Ie,
|
|
@@ -1028,9 +1027,9 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1028
1027
|
/* @__PURE__ */ e("div", { className: "flex items-center gap-2 text-2xl", children: /* @__PURE__ */ e(E, { label: "Add a new HTTP Handler", children: /* @__PURE__ */ e(
|
|
1029
1028
|
"button",
|
|
1030
1029
|
{
|
|
1031
|
-
disabled: !!
|
|
1030
|
+
disabled: !!d,
|
|
1032
1031
|
onClick: () => {
|
|
1033
|
-
|
|
1032
|
+
j.next(d), r({
|
|
1034
1033
|
type: "ADD_HANDLER",
|
|
1035
1034
|
payload: {
|
|
1036
1035
|
class: "",
|
|
@@ -1049,10 +1048,10 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1049
1048
|
] })
|
|
1050
1049
|
] }),
|
|
1051
1050
|
/* @__PURE__ */ e("div", { className: "py-3", children: /* @__PURE__ */ o(
|
|
1052
|
-
|
|
1051
|
+
xe,
|
|
1053
1052
|
{
|
|
1054
1053
|
sensors: x,
|
|
1055
|
-
collisionDetection:
|
|
1054
|
+
collisionDetection: fe,
|
|
1056
1055
|
onDragStart: (l) => {
|
|
1057
1056
|
g(l.active.id);
|
|
1058
1057
|
},
|
|
@@ -1062,25 +1061,25 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1062
1061
|
const v = i.map((w) => w.id).indexOf(p.id), y = i.map((w) => w.id).indexOf(b.id);
|
|
1063
1062
|
r({
|
|
1064
1063
|
type: "UPDATE_HANDLERS",
|
|
1065
|
-
payload:
|
|
1064
|
+
payload: Ee(i, v, y)
|
|
1066
1065
|
});
|
|
1067
1066
|
}
|
|
1068
1067
|
},
|
|
1069
1068
|
children: [
|
|
1070
1069
|
/* @__PURE__ */ e(
|
|
1071
|
-
|
|
1070
|
+
Ne,
|
|
1072
1071
|
{
|
|
1073
1072
|
items: i,
|
|
1074
|
-
strategy:
|
|
1073
|
+
strategy: we,
|
|
1075
1074
|
children: i.map(({ id: l, ...p }) => /* @__PURE__ */ e(ee, { id: l, ...p }, l))
|
|
1076
1075
|
}
|
|
1077
1076
|
),
|
|
1078
|
-
/* @__PURE__ */ e(
|
|
1077
|
+
/* @__PURE__ */ e(ye, { children: f && c ? /* @__PURE__ */ e("div", { className: "opacity-10", children: /* @__PURE__ */ e(ee, { ...c }) }) : null })
|
|
1079
1078
|
]
|
|
1080
1079
|
}
|
|
1081
1080
|
) })
|
|
1082
1081
|
] }) : /* @__PURE__ */ o("div", { className: "mt-6", children: [
|
|
1083
|
-
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
1082
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(W, { className: "text-grey-200 mx-auto h-9 w-9" }) }),
|
|
1084
1083
|
/* @__PURE__ */ o("div", { className: "text-s text-grey-200 mx-auto mt-3 max-w-sm text-center", children: [
|
|
1085
1084
|
"There are no http handlers configured yet ",
|
|
1086
1085
|
/* @__PURE__ */ e("br", {}),
|
|
@@ -1090,7 +1089,7 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1090
1089
|
"button",
|
|
1091
1090
|
{
|
|
1092
1091
|
onClick: () => {
|
|
1093
|
-
|
|
1092
|
+
j.next(d), r({
|
|
1094
1093
|
type: "ADD_HANDLER",
|
|
1095
1094
|
payload: {
|
|
1096
1095
|
class: "",
|
|
@@ -1111,40 +1110,58 @@ pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white ring-0
|
|
|
1111
1110
|
) })
|
|
1112
1111
|
] }) })
|
|
1113
1112
|
] });
|
|
1114
|
-
},
|
|
1113
|
+
}, dt = ({ content: t, path: a }) => {
|
|
1115
1114
|
const [r, i] = _(null);
|
|
1116
|
-
function c
|
|
1115
|
+
function d(c) {
|
|
1117
1116
|
let n;
|
|
1118
1117
|
try {
|
|
1119
|
-
n = JSON.parse(
|
|
1118
|
+
n = JSON.parse(c);
|
|
1120
1119
|
} catch {
|
|
1121
1120
|
i("HTTP Handler JSON is invalid"), n = [];
|
|
1122
1121
|
}
|
|
1123
1122
|
return n;
|
|
1124
1123
|
}
|
|
1125
|
-
const x = typeof t == "string" ?
|
|
1126
|
-
if (!
|
|
1124
|
+
const x = typeof t == "string" ? d(t) : t;
|
|
1125
|
+
if (!it.safeParse(x).success || r)
|
|
1127
1126
|
throw new Error("Invalid JSON");
|
|
1128
|
-
const g = x.map((
|
|
1127
|
+
const g = x.map((c) => {
|
|
1129
1128
|
var l;
|
|
1130
|
-
const n = !!
|
|
1129
|
+
const n = !!c.regexPattern;
|
|
1131
1130
|
return {
|
|
1132
|
-
...
|
|
1133
|
-
id:
|
|
1134
|
-
verbs: (l =
|
|
1131
|
+
...c,
|
|
1132
|
+
id: c.id ?? K(),
|
|
1133
|
+
verbs: (l = c.verbs) == null ? void 0 : l.split(",").map((p) => p.toLocaleUpperCase()).filter(Boolean),
|
|
1135
1134
|
asRegex: n
|
|
1136
1135
|
};
|
|
1137
1136
|
});
|
|
1138
|
-
return /* @__PURE__ */ e(
|
|
1139
|
-
},
|
|
1140
|
-
|
|
1141
|
-
{
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1137
|
+
return /* @__PURE__ */ e(tt, { content: g, children: /* @__PURE__ */ e(ot, { path: a }) });
|
|
1138
|
+
}, ct = () => document.querySelector(`.${Ye}`) || document.body, pt = () => {
|
|
1139
|
+
const t = B(Le), a = G();
|
|
1140
|
+
return /* @__PURE__ */ e(F, { children: t.map((r, i) => /* @__PURE__ */ e(
|
|
1141
|
+
Ke,
|
|
1142
|
+
{
|
|
1143
|
+
hasOverlay: i === 0,
|
|
1144
|
+
...r,
|
|
1145
|
+
onClose: (d) => a(Fe(d)),
|
|
1146
|
+
onEdit: (d) => a(Oe(d)),
|
|
1147
|
+
container: ct()
|
|
1148
|
+
},
|
|
1149
|
+
r.id
|
|
1150
|
+
)) });
|
|
1151
|
+
}, Pt = ({ content: t = [], ...a }) => /* @__PURE__ */ o($e, { store: je(), children: [
|
|
1152
|
+
/* @__PURE__ */ e("div", { className: "h-screen bg-grey-900", children: /* @__PURE__ */ e(
|
|
1153
|
+
dt,
|
|
1154
|
+
{
|
|
1155
|
+
path: Je,
|
|
1156
|
+
content: t,
|
|
1157
|
+
...a
|
|
1158
|
+
}
|
|
1159
|
+
) }),
|
|
1160
|
+
/* @__PURE__ */ e(pt, {})
|
|
1161
|
+
] });
|
|
1146
1162
|
export {
|
|
1147
|
-
|
|
1148
|
-
|
|
1163
|
+
dt as HTTPHandlersEditor,
|
|
1164
|
+
Ye as HTTP_HANDLERS_EDITOR_SCOPE_CLASS,
|
|
1165
|
+
Pt as Standalone
|
|
1149
1166
|
};
|
|
1150
1167
|
//# sourceMappingURL=index.es.js.map
|