@djangocfg/ui-tools 2.1.360 → 2.1.362
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/{DocsLayout-HGYIJTF3.mjs → DocsLayout-2YKPXZYO.mjs} +20 -4
- package/dist/DocsLayout-2YKPXZYO.mjs.map +1 -0
- package/dist/{DocsLayout-OQHDNKZE.cjs → DocsLayout-Q4KS3QWW.cjs} +62 -46
- package/dist/DocsLayout-Q4KS3QWW.cjs.map +1 -0
- package/dist/{chunk-QW4RBGHN.cjs → chunk-7EYHNP3E.cjs} +9 -5
- package/dist/chunk-7EYHNP3E.cjs.map +1 -0
- package/dist/{chunk-ZUFTH5IR.mjs → chunk-Y6UTOBF6.mjs} +9 -5
- package/dist/chunk-Y6UTOBF6.mjs.map +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +23 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.mjs +3 -3
- package/package.json +6 -6
- package/src/tools/OpenapiViewer/hooks/useOpenApiSchema.ts +26 -1
- package/src/tools/OpenapiViewer/types.ts +8 -2
- package/src/tools/OpenapiViewer/utils/url.ts +9 -4
- package/dist/DocsLayout-HGYIJTF3.mjs.map +0 -1
- package/dist/DocsLayout-OQHDNKZE.cjs.map +0 -1
- package/dist/chunk-QW4RBGHN.cjs.map +0 -1
- package/dist/chunk-ZUFTH5IR.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@ var chunk76NNDZH6_cjs = require('./chunk-76NNDZH6.cjs');
|
|
|
10
10
|
var chunkOPKFKTIN_cjs = require('./chunk-OPKFKTIN.cjs');
|
|
11
11
|
var chunkYXZ6GU7H_cjs = require('./chunk-YXZ6GU7H.cjs');
|
|
12
12
|
var chunkFVVF7VCD_cjs = require('./chunk-FVVF7VCD.cjs');
|
|
13
|
-
var
|
|
13
|
+
var chunk7EYHNP3E_cjs = require('./chunk-7EYHNP3E.cjs');
|
|
14
14
|
var chunkXACCHZH2_cjs = require('./chunk-XACCHZH2.cjs');
|
|
15
15
|
var chunkT3MWM23F_cjs = require('./chunk-T3MWM23F.cjs');
|
|
16
16
|
require('./chunk-FP2RLYQZ.cjs');
|
|
@@ -267,14 +267,14 @@ function OpenapiLoadingFallback() {
|
|
|
267
267
|
}
|
|
268
268
|
chunkOLISEQHS_cjs.__name(OpenapiLoadingFallback, "OpenapiLoadingFallback");
|
|
269
269
|
var LazyDocsLayout = createLazyComponent(
|
|
270
|
-
() => import('./DocsLayout-
|
|
270
|
+
() => import('./DocsLayout-Q4KS3QWW.cjs').then((mod) => ({ default: mod.DocsLayout })),
|
|
271
271
|
{
|
|
272
272
|
displayName: "LazyDocsLayout",
|
|
273
273
|
fallback: /* @__PURE__ */ jsxRuntime.jsx(OpenapiLoadingFallback, {})
|
|
274
274
|
}
|
|
275
275
|
);
|
|
276
276
|
var LazyOpenapiViewer = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(({ config }) => {
|
|
277
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
277
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunk7EYHNP3E_cjs.PlaygroundProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(LazyDocsLayout, {}) });
|
|
278
278
|
}, "LazyOpenapiViewer");
|
|
279
279
|
LazyOpenapiViewer.displayName = "LazyOpenapiViewer";
|
|
280
280
|
var LazyJsonSchemaForm = createLazyComponent(
|
|
@@ -766,11 +766,11 @@ function LottiePlayer(props) {
|
|
|
766
766
|
}
|
|
767
767
|
chunkOLISEQHS_cjs.__name(LottiePlayer, "LottiePlayer");
|
|
768
768
|
var DocsLayout = React.lazy(
|
|
769
|
-
() => import('./DocsLayout-
|
|
769
|
+
() => import('./DocsLayout-Q4KS3QWW.cjs').then((mod) => ({ default: mod.DocsLayout }))
|
|
770
770
|
);
|
|
771
771
|
var LoadingFallback6 = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(() => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "text-muted-foreground", children: "Loading API Playground..." }) }), "LoadingFallback");
|
|
772
772
|
var Playground = /* @__PURE__ */ chunkOLISEQHS_cjs.__name(({ config }) => {
|
|
773
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
773
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunk7EYHNP3E_cjs.PlaygroundProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(LoadingFallback6, {}), children: /* @__PURE__ */ jsxRuntime.jsx(DocsLayout, {}) }) });
|
|
774
774
|
}, "Playground");
|
|
775
775
|
var OpenapiViewer_default = Playground;
|
|
776
776
|
var CronSchedulerClient = React.lazy(() => import('./CronScheduler.client-WEJF4PWQ.cjs'));
|
package/dist/index.d.cts
CHANGED
|
@@ -436,10 +436,32 @@ interface ApiKey {
|
|
|
436
436
|
created_at?: string;
|
|
437
437
|
last_used_at?: string | null;
|
|
438
438
|
}
|
|
439
|
+
interface OpenApiSchema {
|
|
440
|
+
openapi: string;
|
|
441
|
+
info: {
|
|
442
|
+
title: string;
|
|
443
|
+
version: string;
|
|
444
|
+
description?: string;
|
|
445
|
+
};
|
|
446
|
+
servers?: Array<{
|
|
447
|
+
url: string;
|
|
448
|
+
description?: string;
|
|
449
|
+
}>;
|
|
450
|
+
paths: Record<string, Record<string, any>>;
|
|
451
|
+
components?: {
|
|
452
|
+
schemas?: Record<string, any>;
|
|
453
|
+
};
|
|
454
|
+
}
|
|
439
455
|
interface SchemaSource {
|
|
440
456
|
id: string;
|
|
441
457
|
name: string;
|
|
442
|
-
|
|
458
|
+
/** URL to fetch the OpenAPI schema from. Required when ``data`` is not
|
|
459
|
+
* provided; ignored when ``data`` is present. */
|
|
460
|
+
url?: string;
|
|
461
|
+
/** Pre-loaded OpenAPI schema object. When provided the viewer uses it
|
|
462
|
+
* directly and never makes a network request — ideal for statically
|
|
463
|
+
* imported JSON files. Either ``url`` or ``data`` must be set. */
|
|
464
|
+
data?: OpenApiSchema;
|
|
443
465
|
/** Per-schema override for the request base URL. Wins over the
|
|
444
466
|
* global ``PlaygroundConfig.baseUrl`` and over ``schema.servers[0].url``
|
|
445
467
|
* from the OpenAPI document. Use when a single playground hosts
|
package/dist/index.d.ts
CHANGED
|
@@ -436,10 +436,32 @@ interface ApiKey {
|
|
|
436
436
|
created_at?: string;
|
|
437
437
|
last_used_at?: string | null;
|
|
438
438
|
}
|
|
439
|
+
interface OpenApiSchema {
|
|
440
|
+
openapi: string;
|
|
441
|
+
info: {
|
|
442
|
+
title: string;
|
|
443
|
+
version: string;
|
|
444
|
+
description?: string;
|
|
445
|
+
};
|
|
446
|
+
servers?: Array<{
|
|
447
|
+
url: string;
|
|
448
|
+
description?: string;
|
|
449
|
+
}>;
|
|
450
|
+
paths: Record<string, Record<string, any>>;
|
|
451
|
+
components?: {
|
|
452
|
+
schemas?: Record<string, any>;
|
|
453
|
+
};
|
|
454
|
+
}
|
|
439
455
|
interface SchemaSource {
|
|
440
456
|
id: string;
|
|
441
457
|
name: string;
|
|
442
|
-
|
|
458
|
+
/** URL to fetch the OpenAPI schema from. Required when ``data`` is not
|
|
459
|
+
* provided; ignored when ``data`` is present. */
|
|
460
|
+
url?: string;
|
|
461
|
+
/** Pre-loaded OpenAPI schema object. When provided the viewer uses it
|
|
462
|
+
* directly and never makes a network request — ideal for statically
|
|
463
|
+
* imported JSON files. Either ``url`` or ``data`` must be set. */
|
|
464
|
+
data?: OpenApiSchema;
|
|
443
465
|
/** Per-schema override for the request base URL. Wins over the
|
|
444
466
|
* global ``PlaygroundConfig.baseUrl`` and over ``schema.servers[0].url``
|
|
445
467
|
* from the OpenAPI document. Use when a single playground hosts
|
package/dist/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { LIMITS, createId, useChatAudioPrefs, useChatContextOptional } from './c
|
|
|
9
9
|
export { Attachments, AttachmentsGrid, AttachmentsList, CHAT_EVENT_NAME, CSS_VARS, ChatProvider, ChatRoot, Composer, DEFAULT_LABELS, DEFAULT_SIDEBAR, DEFAULT_Z_INDEX, EmptyState, ErrorBanner, HOTKEYS, JumpToLatest, LIMITS, MessageActions, MessageBubble, MessageList, STORAGE_KEYS, Sources, StreamingIndicator, ToolCalls, createId, createTokenBuffer, deriveInitials, getChatLogger, initialState, reducer, resolvePersona, useChat, useChatAudio, useChatAudioPrefs, useChatComposer, useChatContext, useChatContextOptional, useChatHistory, useChatLayout, useChatScroll } from './chunk-WGU5BEZX.mjs';
|
|
10
10
|
export { TreeError, TreeSkeleton, createDemoTree } from './chunk-B6IR5KSC.mjs';
|
|
11
11
|
export { DEFAULT_TREE_APPEARANCE, DEFAULT_TREE_LABELS, TreeRoot as Tree, TreeChevron, TreeContent, TreeEmpty, TreeIcon, TreeIndentGuides, TreeLabel, TreeProvider, TreeRoot, TreeRow, TreeSearchInput, appearanceToStyle, clearTreeState, createChildCache, flattenTree, loadTreeState, resolveAppearance, resolveChildren, saveTreeState, useTreeActions, useTreeContext, useTreeExpansion, useTreeFocus, useTreeKeyboard, useTreeLabels, useTreeRows, useTreeSearch, useTreeSelection, useTreeTypeAhead } from './chunk-ZL7FH4NW.mjs';
|
|
12
|
-
import { PlaygroundProvider } from './chunk-
|
|
12
|
+
import { PlaygroundProvider } from './chunk-Y6UTOBF6.mjs';
|
|
13
13
|
export { MarkdownMessage, Mermaid_default as Mermaid, PrettyCode_default as PrettyCode, extractTextFromChildren, useCollapsibleContent } from './chunk-NWUT327A.mjs';
|
|
14
14
|
export { JsonTree_default as JsonTree } from './chunk-ECONRHIG.mjs';
|
|
15
15
|
import './chunk-KNEQRUBA.mjs';
|
|
@@ -242,7 +242,7 @@ function OpenapiLoadingFallback() {
|
|
|
242
242
|
}
|
|
243
243
|
__name(OpenapiLoadingFallback, "OpenapiLoadingFallback");
|
|
244
244
|
var LazyDocsLayout = createLazyComponent(
|
|
245
|
-
() => import('./DocsLayout-
|
|
245
|
+
() => import('./DocsLayout-2YKPXZYO.mjs').then((mod) => ({ default: mod.DocsLayout })),
|
|
246
246
|
{
|
|
247
247
|
displayName: "LazyDocsLayout",
|
|
248
248
|
fallback: /* @__PURE__ */ jsx(OpenapiLoadingFallback, {})
|
|
@@ -741,7 +741,7 @@ function LottiePlayer(props) {
|
|
|
741
741
|
}
|
|
742
742
|
__name(LottiePlayer, "LottiePlayer");
|
|
743
743
|
var DocsLayout = lazy(
|
|
744
|
-
() => import('./DocsLayout-
|
|
744
|
+
() => import('./DocsLayout-2YKPXZYO.mjs').then((mod) => ({ default: mod.DocsLayout }))
|
|
745
745
|
);
|
|
746
746
|
var LoadingFallback6 = /* @__PURE__ */ __name(() => /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-[400px]", children: /* @__PURE__ */ jsx("div", { className: "text-muted-foreground", children: "Loading API Playground..." }) }), "LoadingFallback");
|
|
747
747
|
var Playground = /* @__PURE__ */ __name(({ config }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@djangocfg/ui-tools",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.362",
|
|
4
4
|
"description": "Heavy React tools with lazy loading - for Electron, Vite, CRA, Next.js apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ui-tools",
|
|
@@ -101,8 +101,8 @@
|
|
|
101
101
|
"check": "tsc --noEmit"
|
|
102
102
|
},
|
|
103
103
|
"peerDependencies": {
|
|
104
|
-
"@djangocfg/i18n": "^2.1.
|
|
105
|
-
"@djangocfg/ui-core": "^2.1.
|
|
104
|
+
"@djangocfg/i18n": "^2.1.362",
|
|
105
|
+
"@djangocfg/ui-core": "^2.1.362",
|
|
106
106
|
"consola": "^3.4.2",
|
|
107
107
|
"lodash-es": "^4.18.1",
|
|
108
108
|
"lucide-react": "^0.545.0",
|
|
@@ -155,10 +155,10 @@
|
|
|
155
155
|
"material-file-icons": "^2.4.0"
|
|
156
156
|
},
|
|
157
157
|
"devDependencies": {
|
|
158
|
-
"@djangocfg/i18n": "^2.1.
|
|
158
|
+
"@djangocfg/i18n": "^2.1.362",
|
|
159
159
|
"@djangocfg/playground": "workspace:*",
|
|
160
|
-
"@djangocfg/typescript-config": "^2.1.
|
|
161
|
-
"@djangocfg/ui-core": "^2.1.
|
|
160
|
+
"@djangocfg/typescript-config": "^2.1.362",
|
|
161
|
+
"@djangocfg/ui-core": "^2.1.362",
|
|
162
162
|
"@types/lodash-es": "^4.17.12",
|
|
163
163
|
"@types/mapbox__mapbox-gl-draw": "^1.4.8",
|
|
164
164
|
"@types/node": "^24.7.2",
|
|
@@ -256,6 +256,19 @@ export default function useOpenApiSchema({
|
|
|
256
256
|
setLoading(true);
|
|
257
257
|
setError(null);
|
|
258
258
|
|
|
259
|
+
if (currentSchema.data) {
|
|
260
|
+
setLoadedSchemas((prev) => new Map(prev).set(currentSchema.id, currentSchema.data!));
|
|
261
|
+
consola.success(`Schema loaded (static): ${currentSchema.name}`);
|
|
262
|
+
setLoading(false);
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (!currentSchema.url) {
|
|
267
|
+
setError('SchemaSource requires either url or data');
|
|
268
|
+
setLoading(false);
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
259
272
|
fetchSchema(currentSchema.url)
|
|
260
273
|
.then((schema) => {
|
|
261
274
|
setLoadedSchemas((prev) => new Map(prev).set(currentSchema.id, schema));
|
|
@@ -294,7 +307,11 @@ export default function useOpenApiSchema({
|
|
|
294
307
|
|
|
295
308
|
Promise.allSettled(
|
|
296
309
|
pending.map((s) =>
|
|
297
|
-
|
|
310
|
+
s.data
|
|
311
|
+
? Promise.resolve({ id: s.id, name: s.name, schema: s.data })
|
|
312
|
+
: s.url
|
|
313
|
+
? fetchSchema(s.url).then((schema) => ({ id: s.id, name: s.name, schema }))
|
|
314
|
+
: Promise.reject(new Error('SchemaSource requires either url or data')),
|
|
298
315
|
),
|
|
299
316
|
).then((results) => {
|
|
300
317
|
if (cancelled) return;
|
|
@@ -372,6 +389,14 @@ export default function useOpenApiSchema({
|
|
|
372
389
|
const refresh = useCallback(() => {
|
|
373
390
|
if (!currentSchema) return;
|
|
374
391
|
|
|
392
|
+
if (currentSchema.data) {
|
|
393
|
+
// Static data — nothing to re-fetch, just re-trigger a render cycle.
|
|
394
|
+
setLoadedSchemas((prev) => new Map(prev).set(currentSchema.id, currentSchema.data!));
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
if (!currentSchema.url) return;
|
|
399
|
+
|
|
375
400
|
setLoading(true);
|
|
376
401
|
setError(null);
|
|
377
402
|
|
|
@@ -77,11 +77,17 @@ export interface OpenApiSchema {
|
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
// Schema source configuration
|
|
80
|
+
// Schema source configuration
|
|
81
81
|
export interface SchemaSource {
|
|
82
82
|
id: string;
|
|
83
83
|
name: string;
|
|
84
|
-
|
|
84
|
+
/** URL to fetch the OpenAPI schema from. Required when ``data`` is not
|
|
85
|
+
* provided; ignored when ``data`` is present. */
|
|
86
|
+
url?: string;
|
|
87
|
+
/** Pre-loaded OpenAPI schema object. When provided the viewer uses it
|
|
88
|
+
* directly and never makes a network request — ideal for statically
|
|
89
|
+
* imported JSON files. Either ``url`` or ``data`` must be set. */
|
|
90
|
+
data?: OpenApiSchema;
|
|
85
91
|
/** Per-schema override for the request base URL. Wins over the
|
|
86
92
|
* global ``PlaygroundConfig.baseUrl`` and over ``schema.servers[0].url``
|
|
87
93
|
* from the OpenAPI document. Use when a single playground hosts
|
|
@@ -137,11 +137,16 @@ export function relativePath(url: string): string {
|
|
|
137
137
|
* joinUrl('https://api.example.com/', '/v3', 'pet') → 'https://api.example.com/v3/pet'
|
|
138
138
|
*/
|
|
139
139
|
export function joinUrl(...parts: string[]): string {
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
const filtered = parts.filter((p) => p !== undefined && p !== null && p !== '');
|
|
141
|
+
return filtered
|
|
142
142
|
.map((p, i) => {
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
const s = String(p);
|
|
144
|
+
if (i === 0) return s.replace(/\/+$/, '');
|
|
145
|
+
// Strip leading slashes; preserve trailing slash on the last segment
|
|
146
|
+
// so Django path conventions (/apix/foo/) round-trip correctly.
|
|
147
|
+
const stripped = s.replace(/^\/+/, '');
|
|
148
|
+
if (i === filtered.length - 1) return stripped;
|
|
149
|
+
return stripped.replace(/\/+$/, '');
|
|
145
150
|
})
|
|
146
151
|
.filter((p) => p !== '')
|
|
147
152
|
.join('/');
|