@djangocfg/ui-tools 2.1.289 → 2.1.291

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 (98) hide show
  1. package/README.md +14 -3
  2. package/dist/{DocsLayout-YDR7DSMM.cjs → DocsLayout-IKH7BLSU.cjs} +1537 -682
  3. package/dist/DocsLayout-IKH7BLSU.cjs.map +1 -0
  4. package/dist/{DocsLayout-TKJQ5W5E.mjs → DocsLayout-JPXFUKAR.mjs} +1429 -574
  5. package/dist/DocsLayout-JPXFUKAR.mjs.map +1 -0
  6. package/dist/{PrettyCode.client-5GABIN2I.cjs → PrettyCode.client-RPDIE5CH.cjs} +104 -3
  7. package/dist/PrettyCode.client-RPDIE5CH.cjs.map +1 -0
  8. package/dist/{PrettyCode.client-IZTXXYHG.mjs → PrettyCode.client-SPMTQEG4.mjs} +106 -5
  9. package/dist/PrettyCode.client-SPMTQEG4.mjs.map +1 -0
  10. package/dist/{chunk-IULI4XII.cjs → chunk-5Q4UMSWB.cjs} +355 -9
  11. package/dist/chunk-5Q4UMSWB.cjs.map +1 -0
  12. package/dist/{chunk-VZGQC3NG.mjs → chunk-EFWOJPA6.mjs} +349 -9
  13. package/dist/chunk-EFWOJPA6.mjs.map +1 -0
  14. package/dist/index.cjs +18 -10
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.cts +35 -1
  17. package/dist/index.d.ts +35 -1
  18. package/dist/index.mjs +13 -5
  19. package/dist/index.mjs.map +1 -1
  20. package/package.json +20 -15
  21. package/src/components/markdown/MarkdownMessage.tsx +46 -0
  22. package/src/tools/MarkdownEditor/MarkdownEditor.tsx +42 -1
  23. package/src/tools/OpenapiViewer/OpenapiViewer.story.tsx +87 -178
  24. package/src/tools/OpenapiViewer/README.md +114 -6
  25. package/src/tools/OpenapiViewer/components/DocsLayout/ApiIntroSection.tsx +20 -6
  26. package/src/tools/OpenapiViewer/components/DocsLayout/DocsView.tsx +6 -0
  27. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/CodeSamples/LanguageTabs.tsx +36 -0
  28. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/CodeSamples/index.tsx +56 -0
  29. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/CodeSamples/useCodeSnippet.ts +77 -0
  30. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Header/MetaActions.tsx +146 -0
  31. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Header/MethodBadge.tsx +6 -0
  32. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Header/PathDisplay.tsx +26 -0
  33. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Header/index.tsx +87 -0
  34. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Parameters/ParamGroup.tsx +30 -0
  35. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Parameters/ParamRow.tsx +36 -0
  36. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Parameters/index.tsx +22 -0
  37. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/RequestBody/index.tsx +33 -0
  38. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Responses/ResponseBody.tsx +76 -0
  39. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Responses/ResponseRow.tsx +80 -0
  40. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Responses/StatusTag.tsx +32 -0
  41. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Responses/index.tsx +21 -0
  42. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/SchemaFields/FieldRow.tsx +106 -0
  43. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/SchemaFields/buildTree.ts +127 -0
  44. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/SchemaFields/index.tsx +31 -0
  45. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/SchemaFields/types.ts +28 -0
  46. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Section/SectionHeader.tsx +87 -0
  47. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Section/defaults.ts +27 -0
  48. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/Section/index.tsx +45 -0
  49. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/context.tsx +56 -0
  50. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/hooks/useSectionHash.ts +63 -0
  51. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/index.tsx +96 -0
  52. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/store/index.ts +133 -0
  53. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/store/selectors.ts +40 -0
  54. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc/types.ts +17 -0
  55. package/src/tools/OpenapiViewer/components/DocsLayout/SchemaCopyMenu.tsx +8 -2
  56. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/BrandHeader.tsx +48 -0
  57. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/CategoryBlock.tsx +33 -0
  58. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/EndpointRow.tsx +73 -0
  59. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/MethodChips.tsx +43 -0
  60. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/SchemaSection.tsx +27 -0
  61. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/SearchInput.tsx +45 -0
  62. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/SidebarBody.tsx +50 -0
  63. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/Toolbar.tsx +64 -0
  64. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/buildVM.ts +126 -0
  65. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/index.tsx +112 -0
  66. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/types.ts +42 -0
  67. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar/useDebouncedValue.ts +14 -0
  68. package/src/tools/OpenapiViewer/components/DocsLayout/SlideInPlayground.tsx +10 -7
  69. package/src/tools/OpenapiViewer/components/DocsLayout/TryItSheet.tsx +9 -6
  70. package/src/tools/OpenapiViewer/components/shared/ResponsePanel/PrettyView.tsx +55 -0
  71. package/src/tools/OpenapiViewer/components/shared/ResponsePanel/PreviewView.tsx +115 -0
  72. package/src/tools/OpenapiViewer/components/shared/ResponsePanel/RawView.tsx +24 -0
  73. package/src/tools/OpenapiViewer/components/shared/ResponsePanel/StatusBar.tsx +63 -0
  74. package/src/tools/OpenapiViewer/components/shared/ResponsePanel/ViewTabs.tsx +45 -0
  75. package/src/tools/OpenapiViewer/components/shared/ResponsePanel/detectContent.ts +97 -0
  76. package/src/tools/OpenapiViewer/components/shared/ResponsePanel/index.tsx +93 -0
  77. package/src/tools/OpenapiViewer/components/shared/ResponsePanel/types.ts +26 -0
  78. package/src/tools/OpenapiViewer/components/shared/ResponsePanel/useResponseView.ts +62 -0
  79. package/src/tools/OpenapiViewer/hooks/useOpenApiSchema.ts +41 -71
  80. package/src/tools/OpenapiViewer/types.ts +10 -0
  81. package/src/tools/OpenapiViewer/utils/codeSamples.ts +287 -0
  82. package/src/tools/OpenapiViewer/utils/index.ts +3 -0
  83. package/src/tools/OpenapiViewer/utils/operationToHar.ts +119 -0
  84. package/src/tools/OpenapiViewer/utils/sampler.ts +72 -0
  85. package/src/tools/PrettyCode/PrettyCode.client.tsx +88 -1
  86. package/src/tools/PrettyCode/PrettyCode.story.tsx +114 -361
  87. package/src/tools/PrettyCode/index.tsx +13 -0
  88. package/src/tools/PrettyCode/lazy.tsx +5 -0
  89. package/src/tools/PrettyCode/registerPrismLanguages.ts +111 -0
  90. package/dist/DocsLayout-TKJQ5W5E.mjs.map +0 -1
  91. package/dist/DocsLayout-YDR7DSMM.cjs.map +0 -1
  92. package/dist/PrettyCode.client-5GABIN2I.cjs.map +0 -1
  93. package/dist/PrettyCode.client-IZTXXYHG.mjs.map +0 -1
  94. package/dist/chunk-IULI4XII.cjs.map +0 -1
  95. package/dist/chunk-VZGQC3NG.mjs.map +0 -1
  96. package/src/tools/OpenapiViewer/components/DocsLayout/EndpointDoc.tsx +0 -273
  97. package/src/tools/OpenapiViewer/components/DocsLayout/Sidebar.tsx +0 -439
  98. package/src/tools/OpenapiViewer/components/shared/ResponsePanel.tsx +0 -127
package/dist/index.d.cts CHANGED
@@ -318,6 +318,11 @@ interface PrettyCodeProps$1 {
318
318
  inline?: boolean;
319
319
  customBg?: string;
320
320
  isCompact?: boolean;
321
+ scrollIsolation?: boolean;
322
+ maxLines?: number;
323
+ /** ``'card'`` (default) ships the full chrome. ``'plain'`` is
324
+ * chrome-less — for embedding inside another scroll container. */
325
+ variant?: 'card' | 'plain';
321
326
  }
322
327
 
323
328
  /**
@@ -1486,6 +1491,19 @@ interface PrettyCodeProps {
1486
1491
  * to inline short snippets and cap long ones.
1487
1492
  */
1488
1493
  maxLines?: number;
1494
+ /**
1495
+ * Visual variant:
1496
+ * - ``"card"`` (default) — full chrome: border, background, hover
1497
+ * toolbar (Copy + language tag), optional internal scroll. Suits
1498
+ * a standalone code block in documentation prose where the block
1499
+ * is its own surface.
1500
+ * - ``"plain"`` — chrome-less: no border, no background, no toolbar,
1501
+ * no internal scroll. Grows to fit its content. Use when
1502
+ * embedding inside another scroll container (e.g. the Response
1503
+ * panel) — avoids double-scroll surfaces and lets the parent
1504
+ * manage copy/language affordances.
1505
+ */
1506
+ variant?: 'card' | 'plain';
1489
1507
  }
1490
1508
  declare const PrettyCode: React__default.FC<PrettyCodeProps>;
1491
1509
 
@@ -2455,7 +2473,23 @@ interface MarkdownEditorProps {
2455
2473
  className?: string;
2456
2474
  disabled?: boolean;
2457
2475
  showToolbar?: boolean;
2458
- /** @mention autocomplete config */
2476
+ /**
2477
+ * `@`-mention autocomplete config.
2478
+ *
2479
+ * IMPORTANT: Tiptap's `useEditor` initialises the editor exactly once.
2480
+ * The `Mention` extension is only registered when `mentions` is truthy
2481
+ * on the FIRST render — handing in a real config later (e.g. after an
2482
+ * async items fetch) silently does nothing, and typing `@` will not
2483
+ * open the popover.
2484
+ *
2485
+ * If you want mentions even with async-loaded items, pass
2486
+ * `{ items: [] }` from the very first render and update the array
2487
+ * when data arrives. Either keep the `MentionConfig` object identity
2488
+ * stable across renders and mutate `items` in place (the suggestion
2489
+ * plugin captures the config by closure and reads `items` on each
2490
+ * query), or accept that swapping the whole object reference is a
2491
+ * no-op for the live editor.
2492
+ */
2459
2493
  mentions?: MentionConfig;
2460
2494
  /** Called when mentioned IDs change */
2461
2495
  onMentionIdsChange?: (ids: string[]) => void;
package/dist/index.d.ts CHANGED
@@ -318,6 +318,11 @@ interface PrettyCodeProps$1 {
318
318
  inline?: boolean;
319
319
  customBg?: string;
320
320
  isCompact?: boolean;
321
+ scrollIsolation?: boolean;
322
+ maxLines?: number;
323
+ /** ``'card'`` (default) ships the full chrome. ``'plain'`` is
324
+ * chrome-less — for embedding inside another scroll container. */
325
+ variant?: 'card' | 'plain';
321
326
  }
322
327
 
323
328
  /**
@@ -1486,6 +1491,19 @@ interface PrettyCodeProps {
1486
1491
  * to inline short snippets and cap long ones.
1487
1492
  */
1488
1493
  maxLines?: number;
1494
+ /**
1495
+ * Visual variant:
1496
+ * - ``"card"`` (default) — full chrome: border, background, hover
1497
+ * toolbar (Copy + language tag), optional internal scroll. Suits
1498
+ * a standalone code block in documentation prose where the block
1499
+ * is its own surface.
1500
+ * - ``"plain"`` — chrome-less: no border, no background, no toolbar,
1501
+ * no internal scroll. Grows to fit its content. Use when
1502
+ * embedding inside another scroll container (e.g. the Response
1503
+ * panel) — avoids double-scroll surfaces and lets the parent
1504
+ * manage copy/language affordances.
1505
+ */
1506
+ variant?: 'card' | 'plain';
1489
1507
  }
1490
1508
  declare const PrettyCode: React__default.FC<PrettyCodeProps>;
1491
1509
 
@@ -2455,7 +2473,23 @@ interface MarkdownEditorProps {
2455
2473
  className?: string;
2456
2474
  disabled?: boolean;
2457
2475
  showToolbar?: boolean;
2458
- /** @mention autocomplete config */
2476
+ /**
2477
+ * `@`-mention autocomplete config.
2478
+ *
2479
+ * IMPORTANT: Tiptap's `useEditor` initialises the editor exactly once.
2480
+ * The `Mention` extension is only registered when `mentions` is truthy
2481
+ * on the FIRST render — handing in a real config later (e.g. after an
2482
+ * async items fetch) silently does nothing, and typing `@` will not
2483
+ * open the popover.
2484
+ *
2485
+ * If you want mentions even with async-loaded items, pass
2486
+ * `{ items: [] }` from the very first render and update the array
2487
+ * when data arrives. Either keep the `MentionConfig` object identity
2488
+ * stable across renders and mutate `items` in place (the suggestion
2489
+ * plugin captures the config by closure and reads `items` on each
2490
+ * query), or accept that swapping the whole object reference is a
2491
+ * no-op for the live editor.
2492
+ */
2459
2493
  mentions?: MentionConfig;
2460
2494
  /** Called when mentioned IDs change */
2461
2495
  onMentionIdsChange?: (ids: string[]) => void;
package/dist/index.mjs CHANGED
@@ -4,8 +4,8 @@ import './chunk-JWB2EWQO.mjs';
4
4
  export { ImageViewer } from './chunk-GGKGH5PM.mjs';
5
5
  export { generateContentKey, useAudioCache, useBlobUrlCleanup, useImageCache, useMediaCacheStore, useVideoCache, useVideoPlayerSettings } from './chunk-5LBDYFWH.mjs';
6
6
  export { CronSchedulerProvider, CustomInput, DayChips, MonthDayGrid, SchedulePreview, ScheduleTypeSelector, TimeSelector, buildCron, humanizeCron, isValidCron, parseCron, useCronCustom, useCronMonthDays, useCronPreview, useCronScheduler, useCronSchedulerContext, useCronTime, useCronType, useCronWeekDays } from './chunk-PZKAH7WQ.mjs';
7
- import { PlaygroundProvider } from './chunk-VZGQC3NG.mjs';
8
- export { MarkdownMessage, Mermaid_default as Mermaid, PrettyCode_default as PrettyCode, useCollapsibleContent } from './chunk-VZGQC3NG.mjs';
7
+ import { PlaygroundProvider } from './chunk-EFWOJPA6.mjs';
8
+ export { MarkdownMessage, Mermaid_default as Mermaid, PrettyCode_default as PrettyCode, useCollapsibleContent } from './chunk-EFWOJPA6.mjs';
9
9
  export { JsonTree_default as JsonTree } from './chunk-LFWQ36LJ.mjs';
10
10
  import './chunk-SSUOENAZ.mjs';
11
11
  export { ArrayFieldItemTemplate, ArrayFieldTemplate, BaseInputTemplate, CheckboxWidget, ColorWidget, ErrorListTemplate, FieldTemplate, JsonSchemaForm, NumberWidget, ObjectFieldTemplate, SelectWidget, SliderWidget, SwitchWidget, TextWidget, getRequiredFields, hasRequiredFields, mergeDefaults, normalizeFormData, safeJsonParse, safeJsonStringify, validateRequiredFields, validateSchema } from './chunk-JUGQNNDC.mjs';
@@ -223,7 +223,7 @@ function CodeLoadingFallback() {
223
223
  }
224
224
  __name(CodeLoadingFallback, "CodeLoadingFallback");
225
225
  var LazyPrettyCode = createLazyComponent(
226
- () => import('./PrettyCode.client-IZTXXYHG.mjs'),
226
+ () => import('./PrettyCode.client-SPMTQEG4.mjs'),
227
227
  {
228
228
  displayName: "LazyPrettyCode",
229
229
  fallback: /* @__PURE__ */ jsx(CodeLoadingFallback, {})
@@ -237,7 +237,7 @@ function OpenapiLoadingFallback() {
237
237
  }
238
238
  __name(OpenapiLoadingFallback, "OpenapiLoadingFallback");
239
239
  var LazyDocsLayout = createLazyComponent(
240
- () => import('./DocsLayout-TKJQ5W5E.mjs').then((mod) => ({ default: mod.DocsLayout })),
240
+ () => import('./DocsLayout-JPXFUKAR.mjs').then((mod) => ({ default: mod.DocsLayout })),
241
241
  {
242
242
  displayName: "LazyDocsLayout",
243
243
  fallback: /* @__PURE__ */ jsx(OpenapiLoadingFallback, {})
@@ -392,7 +392,7 @@ function LottiePlayer(props) {
392
392
  }
393
393
  __name(LottiePlayer, "LottiePlayer");
394
394
  var DocsLayout = lazy(
395
- () => import('./DocsLayout-TKJQ5W5E.mjs').then((mod) => ({ default: mod.DocsLayout }))
395
+ () => import('./DocsLayout-JPXFUKAR.mjs').then((mod) => ({ default: mod.DocsLayout }))
396
396
  );
397
397
  var LoadingFallback7 = /* @__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");
398
398
  var Playground = /* @__PURE__ */ __name(({ config }) => {
@@ -1274,6 +1274,14 @@ function MarkdownEditor({
1274
1274
  onMentionIdsChange
1275
1275
  }) {
1276
1276
  const isExternalUpdate = useRef(false);
1277
+ const initialMentionsDefinedRef = useRef(mentions !== void 0);
1278
+ const warnedRef = useRef(false);
1279
+ if (process.env.NODE_ENV !== "production" && !initialMentionsDefinedRef.current && mentions !== void 0 && !warnedRef.current) {
1280
+ warnedRef.current = true;
1281
+ console.warn(
1282
+ "[MarkdownEditor] `mentions` flipped from undefined to a config after mount. Tiptap only installs the Mention extension on first render \u2014 the @-popover will NOT work for this editor instance. Pass `{ items: [] }` from the very first render and mutate `.items` in place instead."
1283
+ );
1284
+ }
1277
1285
  const extensions = useMemo(() => {
1278
1286
  const exts = [
1279
1287
  StarterKit.configure({ heading: { levels: [1, 2, 3] } }),