@djangocfg/ui-tools 2.1.284 → 2.1.286

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.
Files changed (71) hide show
  1. package/dist/DocsLayout-BCVU6TTX.cjs +2027 -0
  2. package/dist/DocsLayout-BCVU6TTX.cjs.map +1 -0
  3. package/dist/DocsLayout-ERETJLLV.mjs +2020 -0
  4. package/dist/DocsLayout-ERETJLLV.mjs.map +1 -0
  5. package/dist/{PlaygroundLayout-O52C6HK5.css → DocsLayout-MBFIB4NO.css} +1 -1
  6. package/dist/{PrettyCode.client-SGDGQTYT.cjs → PrettyCode.client-5GABIN2I.cjs} +57 -35
  7. package/dist/PrettyCode.client-5GABIN2I.cjs.map +1 -0
  8. package/dist/{PrettyCode.client-DW5LTG47.mjs → PrettyCode.client-IZTXXYHG.mjs} +57 -35
  9. package/dist/PrettyCode.client-IZTXXYHG.mjs.map +1 -0
  10. package/dist/chunk-IULI4XII.cjs +1129 -0
  11. package/dist/chunk-IULI4XII.cjs.map +1 -0
  12. package/dist/chunk-VZGQC3NG.mjs +1100 -0
  13. package/dist/chunk-VZGQC3NG.mjs.map +1 -0
  14. package/dist/index.cjs +88 -552
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +18 -6
  17. package/dist/index.d.ts +18 -6
  18. package/dist/index.mjs +25 -496
  19. package/dist/index.mjs.map +1 -1
  20. package/package.json +6 -6
  21. package/src/tools/OpenapiViewer/.claude/.sidecar/activity.jsonl +4 -0
  22. package/src/tools/OpenapiViewer/.claude/.sidecar/map_cache.json +30 -0
  23. package/src/tools/OpenapiViewer/.claude/.sidecar/usage.json +5 -0
  24. package/src/tools/OpenapiViewer/.claude/project-map.md +23 -0
  25. package/src/tools/OpenapiViewer/OpenapiViewer.story.tsx +28 -2
  26. package/src/tools/OpenapiViewer/README.md +104 -51
  27. package/src/tools/OpenapiViewer/components/DocsLayout/ApiIntroSection.tsx +64 -0
  28. package/src/tools/OpenapiViewer/components/DocsLayout/DocsView.tsx +137 -0
  29. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc.tsx +268 -0
  30. package/src/tools/OpenapiViewer/components/DocsLayout/SchemaCopyMenu.tsx +139 -0
  31. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar.tsx +211 -0
  32. package/src/tools/OpenapiViewer/components/DocsLayout/SlideInPlayground.tsx +101 -0
  33. package/src/tools/OpenapiViewer/components/DocsLayout/TryItSheet.tsx +57 -0
  34. package/src/tools/OpenapiViewer/components/DocsLayout/anchor.ts +11 -0
  35. package/src/tools/OpenapiViewer/components/DocsLayout/grouping.ts +71 -0
  36. package/src/tools/OpenapiViewer/components/DocsLayout/index.tsx +166 -0
  37. package/src/tools/OpenapiViewer/components/DocsLayout/schemaFields.ts +121 -0
  38. package/src/tools/OpenapiViewer/components/DocsLayout/sidebarLabel.ts +60 -0
  39. package/src/tools/OpenapiViewer/components/index.ts +5 -2
  40. package/src/tools/OpenapiViewer/components/shared/BodyFormEditor.tsx +422 -0
  41. package/src/tools/OpenapiViewer/components/shared/EndpointDraftSync.tsx +108 -0
  42. package/src/tools/OpenapiViewer/components/shared/EndpointResetButton.tsx +50 -0
  43. package/src/tools/OpenapiViewer/components/{PlaygroundLayout → shared}/RequestPanel.tsx +174 -87
  44. package/src/tools/OpenapiViewer/components/shared/SendButton.tsx +91 -0
  45. package/src/tools/OpenapiViewer/components/{PlaygroundLayout → shared}/ui.tsx +5 -4
  46. package/src/tools/OpenapiViewer/context/PlaygroundContext.tsx +82 -8
  47. package/src/tools/OpenapiViewer/hooks/useEndpointDraft.ts +142 -0
  48. package/src/tools/OpenapiViewer/hooks/useOpenApiSchema.ts +126 -13
  49. package/src/tools/OpenapiViewer/index.tsx +3 -7
  50. package/src/tools/OpenapiViewer/lazy.tsx +6 -27
  51. package/src/tools/OpenapiViewer/types.ts +44 -0
  52. package/src/tools/OpenapiViewer/utils/formatters.ts +2 -23
  53. package/src/tools/OpenapiViewer/utils/index.ts +3 -1
  54. package/src/tools/OpenapiViewer/utils/schemaExport.ts +206 -0
  55. package/src/tools/OpenapiViewer/utils/url.ts +202 -0
  56. package/src/tools/PrettyCode/PrettyCode.client.tsx +42 -8
  57. package/src/tools/PrettyCode/index.tsx +6 -0
  58. package/dist/PlaygroundLayout-DHUATCHB.cjs +0 -798
  59. package/dist/PlaygroundLayout-DHUATCHB.cjs.map +0 -1
  60. package/dist/PlaygroundLayout-NONWOVQR.mjs +0 -791
  61. package/dist/PlaygroundLayout-NONWOVQR.mjs.map +0 -1
  62. package/dist/PrettyCode.client-DW5LTG47.mjs.map +0 -1
  63. package/dist/PrettyCode.client-SGDGQTYT.cjs.map +0 -1
  64. package/dist/chunk-5FKE7OME.cjs +0 -369
  65. package/dist/chunk-5FKE7OME.cjs.map +0 -1
  66. package/dist/chunk-BKWDHJKF.mjs +0 -356
  67. package/dist/chunk-BKWDHJKF.mjs.map +0 -1
  68. package/src/tools/OpenapiViewer/components/PlaygroundLayout/EndpointList.tsx +0 -228
  69. package/src/tools/OpenapiViewer/components/PlaygroundLayout/index.tsx +0 -107
  70. /package/dist/{PlaygroundLayout-O52C6HK5.css.map → DocsLayout-MBFIB4NO.css.map} +0 -0
  71. /package/src/tools/OpenapiViewer/components/{PlaygroundLayout → shared}/ResponsePanel.tsx +0 -0
package/dist/index.d.cts CHANGED
@@ -339,10 +339,21 @@ interface SchemaSource {
339
339
  id: string;
340
340
  name: string;
341
341
  url: string;
342
+ /** Per-schema override for the request base URL. Wins over the
343
+ * global ``PlaygroundConfig.baseUrl`` and over ``schema.servers[0].url``
344
+ * from the OpenAPI document. Use when a single playground hosts
345
+ * several APIs that live on different domains. */
346
+ baseUrl?: string;
342
347
  }
343
348
  interface PlaygroundConfig {
344
349
  schemas: SchemaSource[];
345
350
  defaultSchemaId?: string;
351
+ /** Global override for the request base URL. Used when the OpenAPI
352
+ * document has no ``servers`` entry, or when docs are hosted on a
353
+ * different origin than the API. Resolution order (highest wins):
354
+ * ``SchemaSource.baseUrl`` → ``PlaygroundConfig.baseUrl`` →
355
+ * ``schema.servers[0].url`` → empty string (relative paths). */
356
+ baseUrl?: string;
346
357
  /** Optional API keys the user can pick from in the request panel.
347
358
  * When provided, the playground auto-selects the first one and
348
359
  * syncs the ``X-API-Key`` header from ``ApiKey.secret``. Pass
@@ -359,18 +370,13 @@ interface PlaygroundConfig {
359
370
  * Use this for automatic code-splitting with Suspense fallback.
360
371
  *
361
372
  * For direct imports without lazy loading, use:
362
- * import OpenapiViewer from '@djangocfg/ui-tools/openapi'
373
+ * import OpenapiViewer from '@djangocfg/ui-tools/openapi'
363
374
  */
364
375
 
365
376
  interface PlaygroundProps$1 {
366
377
  config: PlaygroundConfig;
367
378
  }
368
379
 
369
- /**
370
- * LazyOpenapiViewer - Lazy-loaded OpenAPI schema viewer & playground
371
- *
372
- * Automatically shows loading state while OpenAPI components load (~400KB)
373
- */
374
380
  declare const LazyOpenapiViewer: React$1.FC<PlaygroundProps$1>;
375
381
 
376
382
  /**
@@ -1458,6 +1464,12 @@ interface PrettyCodeProps {
1458
1464
  isCompact?: boolean;
1459
1465
  /** Block scroll capture until user clicks (default: true) */
1460
1466
  scrollIsolation?: boolean;
1467
+ /**
1468
+ * Line count above which the block starts scrolling instead of growing.
1469
+ * ``undefined`` (default) = no cap, block grows to fit. Set e.g. ``50``
1470
+ * to inline short snippets and cap long ones.
1471
+ */
1472
+ maxLines?: number;
1461
1473
  }
1462
1474
  declare const PrettyCode: React__default.FC<PrettyCodeProps>;
1463
1475
 
package/dist/index.d.ts CHANGED
@@ -339,10 +339,21 @@ interface SchemaSource {
339
339
  id: string;
340
340
  name: string;
341
341
  url: string;
342
+ /** Per-schema override for the request base URL. Wins over the
343
+ * global ``PlaygroundConfig.baseUrl`` and over ``schema.servers[0].url``
344
+ * from the OpenAPI document. Use when a single playground hosts
345
+ * several APIs that live on different domains. */
346
+ baseUrl?: string;
342
347
  }
343
348
  interface PlaygroundConfig {
344
349
  schemas: SchemaSource[];
345
350
  defaultSchemaId?: string;
351
+ /** Global override for the request base URL. Used when the OpenAPI
352
+ * document has no ``servers`` entry, or when docs are hosted on a
353
+ * different origin than the API. Resolution order (highest wins):
354
+ * ``SchemaSource.baseUrl`` → ``PlaygroundConfig.baseUrl`` →
355
+ * ``schema.servers[0].url`` → empty string (relative paths). */
356
+ baseUrl?: string;
346
357
  /** Optional API keys the user can pick from in the request panel.
347
358
  * When provided, the playground auto-selects the first one and
348
359
  * syncs the ``X-API-Key`` header from ``ApiKey.secret``. Pass
@@ -359,18 +370,13 @@ interface PlaygroundConfig {
359
370
  * Use this for automatic code-splitting with Suspense fallback.
360
371
  *
361
372
  * For direct imports without lazy loading, use:
362
- * import OpenapiViewer from '@djangocfg/ui-tools/openapi'
373
+ * import OpenapiViewer from '@djangocfg/ui-tools/openapi'
363
374
  */
364
375
 
365
376
  interface PlaygroundProps$1 {
366
377
  config: PlaygroundConfig;
367
378
  }
368
379
 
369
- /**
370
- * LazyOpenapiViewer - Lazy-loaded OpenAPI schema viewer & playground
371
- *
372
- * Automatically shows loading state while OpenAPI components load (~400KB)
373
- */
374
380
  declare const LazyOpenapiViewer: React$1.FC<PlaygroundProps$1>;
375
381
 
376
382
  /**
@@ -1458,6 +1464,12 @@ interface PrettyCodeProps {
1458
1464
  isCompact?: boolean;
1459
1465
  /** Block scroll capture until user clicks (default: true) */
1460
1466
  scrollIsolation?: boolean;
1467
+ /**
1468
+ * Line count above which the block starts scrolling instead of growing.
1469
+ * ``undefined`` (default) = no cap, block grows to fit. Set e.g. ``50``
1470
+ * to inline short snippets and cap long ones.
1471
+ */
1472
+ maxLines?: number;
1461
1473
  }
1462
1474
  declare const PrettyCode: React__default.FC<PrettyCodeProps>;
1463
1475