@djangocfg/ui-tools 2.1.169 → 2.1.171
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/{PlaygroundLayout-DFVQDA5G.cjs → PlaygroundLayout-LICYATAF.cjs} +23 -23
- package/dist/{PlaygroundLayout-DFVQDA5G.cjs.map → PlaygroundLayout-LICYATAF.cjs.map} +1 -1
- package/dist/{PlaygroundLayout-P4J6YXCE.mjs → PlaygroundLayout-YH77POI4.mjs} +3 -3
- package/dist/{PlaygroundLayout-P4J6YXCE.mjs.map → PlaygroundLayout-YH77POI4.mjs.map} +1 -1
- package/dist/{PrettyCode.client-RS5ZTNBT.mjs → PrettyCode.client-RHOS5D6V.mjs} +30 -26
- package/dist/PrettyCode.client-RHOS5D6V.mjs.map +1 -0
- package/dist/{PrettyCode.client-DANYYQYO.cjs → PrettyCode.client-TCVEDDCJ.cjs} +30 -26
- package/dist/PrettyCode.client-TCVEDDCJ.cjs.map +1 -0
- package/dist/{chunk-OYLQZT62.cjs → chunk-GX62WYEV.cjs} +3 -3
- package/dist/{chunk-OYLQZT62.cjs.map → chunk-GX62WYEV.cjs.map} +1 -1
- package/dist/{chunk-XZZ22EHP.mjs → chunk-UX2MCSN5.mjs} +3 -3
- package/dist/{chunk-XZZ22EHP.mjs.map → chunk-UX2MCSN5.mjs.map} +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.mjs +5 -5
- package/package.json +6 -6
- package/src/tools/PrettyCode/PrettyCode.client.tsx +17 -11
- package/dist/PrettyCode.client-DANYYQYO.cjs.map +0 -1
- package/dist/PrettyCode.client-RS5ZTNBT.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkGX62WYEV_cjs = require('./chunk-GX62WYEV.cjs');
|
|
4
4
|
var chunkDFWXRCIC_cjs = require('./chunk-DFWXRCIC.cjs');
|
|
5
5
|
var chunkWGEGR3DF_cjs = require('./chunk-WGEGR3DF.cjs');
|
|
6
6
|
var lucideReact = require('lucide-react');
|
|
@@ -162,13 +162,13 @@ function useOpenApiSchema({
|
|
|
162
162
|
}
|
|
163
163
|
chunkWGEGR3DF_cjs.__name(useOpenApiSchema, "useOpenApiSchema");
|
|
164
164
|
var VersionSelector = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
165
|
-
const { state, config, setSelectedVersion } =
|
|
165
|
+
const { state, config, setSelectedVersion } = chunkGX62WYEV_cjs.usePlaygroundContext();
|
|
166
166
|
const { endpoints } = useOpenApiSchema({
|
|
167
167
|
schemas: config.schemas,
|
|
168
168
|
defaultSchemaId: config.defaultSchemaId
|
|
169
169
|
});
|
|
170
|
-
const currentVersion =
|
|
171
|
-
const versionStats =
|
|
170
|
+
const currentVersion = chunkGX62WYEV_cjs.getVersionById(state.selectedVersion);
|
|
171
|
+
const versionStats = chunkGX62WYEV_cjs.getVersionStats(endpoints);
|
|
172
172
|
const handleVersionChange = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name((versionId) => {
|
|
173
173
|
setSelectedVersion(versionId);
|
|
174
174
|
}, "handleVersionChange");
|
|
@@ -179,7 +179,7 @@ var VersionSelector = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
179
179
|
] }),
|
|
180
180
|
/* @__PURE__ */ jsxRuntime.jsxs(components.Select, { value: state.selectedVersion, onValueChange: handleVersionChange, children: [
|
|
181
181
|
/* @__PURE__ */ jsxRuntime.jsx(components.SelectTrigger, { className: "w-48", children: /* @__PURE__ */ jsxRuntime.jsx(components.SelectValue, {}) }),
|
|
182
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.SelectContent, { children:
|
|
182
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.SelectContent, { children: chunkGX62WYEV_cjs.API_VERSIONS.map((version) => /* @__PURE__ */ jsxRuntime.jsx(components.SelectItem, { value: version.id, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between w-full", children: [
|
|
183
183
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2", children: [
|
|
184
184
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-medium", children: version.name }),
|
|
185
185
|
version.isDefault && /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: "secondary", className: "text-xs", children: "Default" })
|
|
@@ -206,7 +206,7 @@ var categoryIcons = {
|
|
|
206
206
|
"Other": /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Code, { className: "h-4 w-4" })
|
|
207
207
|
};
|
|
208
208
|
var EndpointsLibrary = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
209
|
-
const { state, config, setSelectedEndpoint, setSelectedCategory, setSearchTerm } =
|
|
209
|
+
const { state, config, setSelectedEndpoint, setSelectedCategory, setSearchTerm } = chunkGX62WYEV_cjs.usePlaygroundContext();
|
|
210
210
|
const { endpoints, categories, loading, error } = useOpenApiSchema({
|
|
211
211
|
schemas: config.schemas,
|
|
212
212
|
defaultSchemaId: config.defaultSchemaId
|
|
@@ -221,7 +221,7 @@ var EndpointsLibrary = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
221
221
|
}
|
|
222
222
|
}, "getRelativePath");
|
|
223
223
|
const filteredEndpoints = React.useMemo(() => {
|
|
224
|
-
let filtered =
|
|
224
|
+
let filtered = chunkGX62WYEV_cjs.deduplicateEndpoints(endpoints, state.selectedVersion);
|
|
225
225
|
if (state.selectedCategory && state.selectedCategory !== "All") {
|
|
226
226
|
filtered = filtered.filter((endpoint) => endpoint.category === state.selectedCategory);
|
|
227
227
|
}
|
|
@@ -237,7 +237,7 @@ var EndpointsLibrary = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
237
237
|
setSelectedEndpoint(endpoint);
|
|
238
238
|
}, "handleEndpointSelect");
|
|
239
239
|
const getMethodBadges = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name((methods) => {
|
|
240
|
-
return methods.split(", ").map((method) => /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant:
|
|
240
|
+
return methods.split(", ").map((method) => /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: chunkGX62WYEV_cjs.getMethodColor(method) === "success" ? "default" : "secondary", className: "text-xs", children: method }, method));
|
|
241
241
|
}, "getMethodBadges");
|
|
242
242
|
if (loading) {
|
|
243
243
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
@@ -373,7 +373,7 @@ var stepConfig = {
|
|
|
373
373
|
}
|
|
374
374
|
};
|
|
375
375
|
var PlaygroundStepper = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
376
|
-
const { state, setCurrentStep, goToNextStep, goToPreviousStep } =
|
|
376
|
+
const { state, setCurrentStep, goToNextStep, goToPreviousStep } = chunkGX62WYEV_cjs.usePlaygroundContext();
|
|
377
377
|
const { currentStep, steps } = state;
|
|
378
378
|
const currentIndex = steps.indexOf(currentStep);
|
|
379
379
|
const canGoNext = currentIndex < steps.length - 1;
|
|
@@ -436,7 +436,7 @@ var PlaygroundStepper = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
436
436
|
] });
|
|
437
437
|
}, "PlaygroundStepper");
|
|
438
438
|
var EndpointInfo = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
439
|
-
const { state } =
|
|
439
|
+
const { state } = chunkGX62WYEV_cjs.usePlaygroundContext();
|
|
440
440
|
const { selectedEndpoint } = state;
|
|
441
441
|
const endpointJson = React.useMemo(() => {
|
|
442
442
|
if (!selectedEndpoint) return "";
|
|
@@ -454,7 +454,7 @@ var EndpointInfo = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
454
454
|
return null;
|
|
455
455
|
}
|
|
456
456
|
const getMethodBadges = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name((methods) => {
|
|
457
|
-
return methods.split(", ").map((method) => /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant:
|
|
457
|
+
return methods.split(", ").map((method) => /* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: chunkGX62WYEV_cjs.getMethodColor(method) === "success" ? "default" : "secondary", className: "text-xs", children: method }, method));
|
|
458
458
|
}, "getMethodBadges");
|
|
459
459
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "space-y-4", children: [
|
|
460
460
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
@@ -522,7 +522,7 @@ var EndpointInfo = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
522
522
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { className: "h-4 w-4" })
|
|
523
523
|
] }),
|
|
524
524
|
/* @__PURE__ */ jsxRuntime.jsx(components.CollapsibleContent, { className: "mt-2 space-y-2", children: selectedEndpoint.responses.map((response, index) => {
|
|
525
|
-
const statusColor =
|
|
525
|
+
const statusColor = chunkGX62WYEV_cjs.getStatusColor(parseInt(response.code));
|
|
526
526
|
const badgeVariant = statusColor === "success" ? "default" : statusColor === "error" ? "destructive" : "secondary";
|
|
527
527
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center space-x-2 text-xs", children: [
|
|
528
528
|
/* @__PURE__ */ jsxRuntime.jsx(components.Badge, { variant: badgeVariant, className: "text-xs", children: response.code }),
|
|
@@ -535,7 +535,7 @@ var EndpointInfo = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
535
535
|
] });
|
|
536
536
|
}, "EndpointInfo");
|
|
537
537
|
var RequestParametersForm = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
538
|
-
const { state, setParameters } =
|
|
538
|
+
const { state, setParameters } = chunkGX62WYEV_cjs.usePlaygroundContext();
|
|
539
539
|
const [formData, setFormData] = React.useState({});
|
|
540
540
|
const [activeTab, setActiveTab] = React.useState("required");
|
|
541
541
|
React.useEffect(() => {
|
|
@@ -716,12 +716,12 @@ var RequestBuilder = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
716
716
|
setRequestBody,
|
|
717
717
|
setManualApiToken,
|
|
718
718
|
sendRequest
|
|
719
|
-
} =
|
|
720
|
-
const isJsonValid = state.requestBody ?
|
|
719
|
+
} = chunkGX62WYEV_cjs.usePlaygroundContext();
|
|
720
|
+
const isJsonValid = state.requestBody ? chunkGX62WYEV_cjs.isValidJson(state.requestBody) : true;
|
|
721
721
|
const generateCurlCommand = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
722
722
|
if (!state.requestUrl) return "";
|
|
723
|
-
const apiKey = state.selectedApiKey ?
|
|
724
|
-
const headers =
|
|
723
|
+
const apiKey = state.selectedApiKey ? chunkGX62WYEV_cjs.findApiKeyById(apiKeys, state.selectedApiKey) : null;
|
|
724
|
+
const headers = chunkGX62WYEV_cjs.parseRequestHeaders(state.requestHeaders);
|
|
725
725
|
if (apiKey) {
|
|
726
726
|
headers["X-API-Key"] = apiKey.id || "";
|
|
727
727
|
}
|
|
@@ -808,12 +808,12 @@ var RequestBuilder = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
808
808
|
}
|
|
809
809
|
)
|
|
810
810
|
] }) }),
|
|
811
|
-
/* @__PURE__ */ jsxRuntime.jsx(components.CardContent, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
811
|
+
/* @__PURE__ */ jsxRuntime.jsx(components.CardContent, { children: /* @__PURE__ */ jsxRuntime.jsx(chunkGX62WYEV_cjs.PrettyCode_default, { data: curlCommand, language: "bash" }) })
|
|
812
812
|
] })
|
|
813
813
|
] });
|
|
814
814
|
}, "RequestBuilder");
|
|
815
815
|
var ResponseViewer = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
816
|
-
const { state } =
|
|
816
|
+
const { state } = chunkGX62WYEV_cjs.usePlaygroundContext();
|
|
817
817
|
const { response } = state;
|
|
818
818
|
const responseText = React.useMemo(() => {
|
|
819
819
|
if (!response?.data) return "";
|
|
@@ -858,7 +858,7 @@ var ResponseViewer = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
858
858
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
859
859
|
components.Badge,
|
|
860
860
|
{
|
|
861
|
-
variant:
|
|
861
|
+
variant: chunkGX62WYEV_cjs.getStatusColor(response.status || 0) === "success" ? "default" : chunkGX62WYEV_cjs.getStatusColor(response.status || 0) === "error" ? "destructive" : "secondary",
|
|
862
862
|
className: "text-xs",
|
|
863
863
|
children: response.status
|
|
864
864
|
}
|
|
@@ -923,7 +923,7 @@ var ResponseViewer = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
923
923
|
] });
|
|
924
924
|
}, "ResponseViewer");
|
|
925
925
|
var PlaygroundLayout = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
926
|
-
const { state, setSidebarOpen } =
|
|
926
|
+
const { state, setSidebarOpen } = chunkGX62WYEV_cjs.usePlaygroundContext();
|
|
927
927
|
const { isMobile } = useMobile();
|
|
928
928
|
const renderStepContent = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
929
929
|
switch (state.currentStep) {
|
|
@@ -1000,5 +1000,5 @@ var PlaygroundLayout = /* @__PURE__ */ chunkWGEGR3DF_cjs.__name(() => {
|
|
|
1000
1000
|
}, "PlaygroundLayout");
|
|
1001
1001
|
|
|
1002
1002
|
exports.PlaygroundLayout = PlaygroundLayout;
|
|
1003
|
-
//# sourceMappingURL=PlaygroundLayout-
|
|
1004
|
-
//# sourceMappingURL=PlaygroundLayout-
|
|
1003
|
+
//# sourceMappingURL=PlaygroundLayout-LICYATAF.cjs.map
|
|
1004
|
+
//# sourceMappingURL=PlaygroundLayout-LICYATAF.cjs.map
|