@clarify-labs/renderer 0.11.3 → 0.11.4

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 (51) hide show
  1. package/output/{ClarifyShell-D25PYLE0.cjs → ClarifyShell-Cvb7Nk3A.cjs} +3 -3
  2. package/output/{ClarifyShell-D25PYLE0.cjs.map → ClarifyShell-Cvb7Nk3A.cjs.map} +1 -1
  3. package/output/{ClarifyShell-4hlqrEgp.js → ClarifyShell-gzlibEm8.js} +3 -3
  4. package/output/{ClarifyShell-4hlqrEgp.js.map → ClarifyShell-gzlibEm8.js.map} +1 -1
  5. package/output/{MermaidViewer-kbSVqJ_z.cjs → MermaidViewer-CPuTNujY.cjs} +2 -2
  6. package/output/{MermaidViewer-kbSVqJ_z.cjs.map → MermaidViewer-CPuTNujY.cjs.map} +1 -1
  7. package/output/{MermaidViewer-D4h-WEak.js → MermaidViewer-EVuBmrzA.js} +2 -2
  8. package/output/{MermaidViewer-D4h-WEak.js.map → MermaidViewer-EVuBmrzA.js.map} +1 -1
  9. package/output/{OpenApiOperation-BcJYHwft.js → OpenApiOperation-Ddax6Pen.js} +229 -50
  10. package/output/OpenApiOperation-Ddax6Pen.js.map +1 -0
  11. package/output/{OpenApiOperation-HhSjad7q.cjs → OpenApiOperation-QqYCuqve.cjs} +229 -50
  12. package/output/OpenApiOperation-QqYCuqve.cjs.map +1 -0
  13. package/output/{PageActions-Bnz5Bybt.js → PageActions-BBRz0tJ4.js} +5 -5
  14. package/output/{PageActions-Bnz5Bybt.js.map → PageActions-BBRz0tJ4.js.map} +1 -1
  15. package/output/{PageActions-GVAsO16x.cjs → PageActions-ypH6U0Vc.cjs} +8 -8
  16. package/output/{PageActions-GVAsO16x.cjs.map → PageActions-ypH6U0Vc.cjs.map} +1 -1
  17. package/output/{SearchDialog-CFMl0YAZ.cjs → SearchDialog-DCGBhNnW.cjs} +3 -3
  18. package/output/{SearchDialog-CFMl0YAZ.cjs.map → SearchDialog-DCGBhNnW.cjs.map} +1 -1
  19. package/output/{SearchDialog-DL5Y_bQ0.js → SearchDialog-Df6jknma.js} +3 -3
  20. package/output/{SearchDialog-DL5Y_bQ0.js.map → SearchDialog-Df6jknma.js.map} +1 -1
  21. package/output/app/PageActions.d.ts +1 -1
  22. package/output/client.cjs +3 -3
  23. package/output/client.js +3 -3
  24. package/output/core/i18n.d.ts +2 -1
  25. package/output/{i18n-R08i532P.cjs → i18n-Ds-f-qlT.cjs} +9 -1
  26. package/output/i18n-Ds-f-qlT.cjs.map +1 -0
  27. package/output/{i18n-sJUQQLRZ.js → i18n-LXAq0RIC.js} +9 -1
  28. package/output/i18n-LXAq0RIC.js.map +1 -0
  29. package/output/index.cjs +15 -15
  30. package/output/index.cjs.map +1 -1
  31. package/output/index.js +15 -15
  32. package/output/index.js.map +1 -1
  33. package/output/openapi/components/ExamplePanels.d.ts +3 -1
  34. package/output/openapi/components/OpenApiDocumentSection.d.ts +1 -0
  35. package/output/openapi/components/SchemaProperties.d.ts +8 -0
  36. package/output/openapi/components/SchemaSearch.d.ts +20 -0
  37. package/output/openapi/lib/helpers.d.ts +3 -0
  38. package/output/preview.cjs +3 -3
  39. package/output/preview.js +3 -3
  40. package/output/{render-BuWbLXJW.cjs → render-BQkaRYoY.cjs} +2 -2
  41. package/output/{render-BuWbLXJW.cjs.map → render-BQkaRYoY.cjs.map} +1 -1
  42. package/output/{render-tWo_ruCT.js → render-C2rZuVLy.js} +2 -2
  43. package/output/{render-tWo_ruCT.js.map → render-C2rZuVLy.js.map} +1 -1
  44. package/output/renderer.css +63 -12
  45. package/output/server.cjs +2 -2
  46. package/output/server.js +2 -2
  47. package/package.json +1 -1
  48. package/output/OpenApiOperation-BcJYHwft.js.map +0 -1
  49. package/output/OpenApiOperation-HhSjad7q.cjs.map +0 -1
  50. package/output/i18n-R08i532P.cjs.map +0 -1
  51. package/output/i18n-sJUQQLRZ.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
- const require_i18n = require("./i18n-R08i532P.cjs");
3
- const require_PageActions = require("./PageActions-GVAsO16x.cjs");
2
+ const require_i18n = require("./i18n-Ds-f-qlT.cjs");
3
+ const require_PageActions = require("./PageActions-ypH6U0Vc.cjs");
4
4
  const require_remark = require("./remark-DTLbG8PK.cjs");
5
5
  let clsx = require("clsx");
6
6
  clsx = require_rolldown_runtime.__toESM(clsx, 1);
@@ -245,7 +245,7 @@ function Card(arg0) {
245
245
  }
246
246
  //#endregion
247
247
  //#region source/components/Mermaid.tsx
248
- var MermaidViewer = (0, react.lazy)(() => Promise.resolve().then(() => require("./MermaidViewer-kbSVqJ_z.cjs")));
248
+ var MermaidViewer = (0, react.lazy)(() => Promise.resolve().then(() => require("./MermaidViewer-CPuTNujY.cjs")));
249
249
  var mermaidModulePromise;
250
250
  async function loadMermaid() {
251
251
  mermaidModulePromise = mermaidModulePromise ?? import("mermaid").then((module) => module.default);
@@ -1257,12 +1257,15 @@ var primitives_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
1257
1257
  });
1258
1258
  function wrapper(arg0) {
1259
1259
  const { children } = arg0;
1260
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("article", {
1261
- className: "clarify-mdx-page flex h-full min-w-0 flex-col pt-14 pb-10",
1262
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Prose, {
1260
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("article", {
1261
+ className: "clarify-mdx-page relative flex h-full min-w-0 flex-col pt-14 pb-10",
1262
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1263
+ className: "clarify-page-actions mb-4 flex justify-end sm:absolute sm:top-14 sm:right-0 sm:mb-0",
1264
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.PageActions, {})
1265
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Prose, {
1263
1266
  className: "flex-auto",
1264
1267
  children
1265
- })
1268
+ })]
1266
1269
  });
1267
1270
  }
1268
1271
  function table(arg0) {
@@ -1284,13 +1287,10 @@ function a(arg0) {
1284
1287
  }
1285
1288
  function h1(arg0) {
1286
1289
  const { children, className, ...props } = arg0;
1287
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1288
- className: "clarify-page-title-row flex flex-col gap-4 pb-4 sm:flex-row sm:items-start sm:justify-between",
1289
- children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
1290
- className: (0, clsx.default)("clarify-page-title min-w-0 flex-1", className),
1291
- ...props,
1292
- children
1293
- }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_PageActions.PageTitleActions, {})]
1290
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h1", {
1291
+ className: (0, clsx.default)("clarify-page-title min-w-0 flex-1", className),
1292
+ ...props,
1293
+ children
1294
1294
  });
1295
1295
  }
1296
1296
  var code = Code;
@@ -1475,6 +1475,57 @@ function resolveRequestSchema(spec, schema) {
1475
1475
  delete ownSchema.allOf;
1476
1476
  return mergeAllOfSchemas(spec, [...allOf, ownSchema]);
1477
1477
  }
1478
+ function fuzzyMatch(value, query) {
1479
+ const candidate = value.toLocaleLowerCase();
1480
+ const needle = query.trim().toLocaleLowerCase();
1481
+ let candidateIndex = 0;
1482
+ for (const character of needle) {
1483
+ candidateIndex = candidate.indexOf(character, candidateIndex);
1484
+ if (candidateIndex === -1) return false;
1485
+ candidateIndex += 1;
1486
+ }
1487
+ return true;
1488
+ }
1489
+ var noExampleMatch = Symbol("no-example-match");
1490
+ function getSchemaSearchText(name, schema) {
1491
+ if (!isRecord$1(schema)) return name;
1492
+ return [
1493
+ name,
1494
+ schema.type,
1495
+ schema.description,
1496
+ schema.pattern,
1497
+ schema.const,
1498
+ schema.default,
1499
+ schema.minimum,
1500
+ schema.maximum,
1501
+ schema.additionalProperties
1502
+ ].filter((value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean").join(" ");
1503
+ }
1504
+ function filterExampleValue(spec, schema, value, query) {
1505
+ const resolved = resolveRequestSchema(spec, schema);
1506
+ if (Array.isArray(value)) {
1507
+ const itemSchema = isRecord$1(resolved) ? resolved.items : void 0;
1508
+ const items = value.map((item) => filterExampleValue(spec, itemSchema, item, query)).filter((item) => item !== noExampleMatch);
1509
+ return items.length > 0 ? items : noExampleMatch;
1510
+ }
1511
+ if (isRecord$1(value)) {
1512
+ const properties = isRecord$1(resolved) && isRecord$1(resolved.properties) ? resolved.properties : {};
1513
+ const filtered = Object.entries(value).flatMap(([name, propertyValue]) => {
1514
+ const propertySchema = properties[name] ?? (isRecord$1(resolved) && isRecord$1(resolved.additionalProperties) ? resolved.additionalProperties : void 0);
1515
+ if (fuzzyMatch(getSchemaSearchText(name, resolveRequestSchema(spec, propertySchema)), query)) return [[name, propertyValue]];
1516
+ const child = filterExampleValue(spec, propertySchema, propertyValue, query);
1517
+ return child === noExampleMatch ? [] : [[name, child]];
1518
+ });
1519
+ return filtered.length > 0 ? Object.fromEntries(filtered) : noExampleMatch;
1520
+ }
1521
+ return fuzzyMatch(getSchemaSearchText("", resolved), query) ? value : noExampleMatch;
1522
+ }
1523
+ function filterExampleBySchema(spec, schema, value, query) {
1524
+ if (!query.trim()) return value;
1525
+ const filtered = filterExampleValue(spec, schema, value, query);
1526
+ if (filtered !== noExampleMatch) return filtered;
1527
+ return Array.isArray(value) ? [] : isRecord$1(value) ? {} : value;
1528
+ }
1478
1529
  function getPathItem$1(spec, path) {
1479
1530
  return resolveObjectRef(spec, spec.paths?.[path]);
1480
1531
  }
@@ -2522,8 +2573,11 @@ function ApiExampleCodeGroup(arg0) {
2522
2573
  function firstExampleKeyForMediaType(requestContents, mediaType, spec) {
2523
2574
  return getExampleEntries(requestContents.find((content) => content.mediaType === mediaType)?.value, spec)[0]?.key ?? "";
2524
2575
  }
2576
+ function isStructuredMediaType(mediaType) {
2577
+ return mediaType.includes("json") || mediaType.includes("yaml") || mediaType.includes("yml");
2578
+ }
2525
2579
  function useRequestExamplesState(arg0) {
2526
- const { spec, path, method, parameters, requestContents, selectedMediaType, onSelectMediaType, selectedServer, serverVariables, auth, operationSource, sharedExampleKey, onSelectExampleKey } = arg0;
2580
+ const { spec, path, method, parameters, requestContents, selectedMediaType, onSelectMediaType, selectedServer, serverVariables, auth, operationSource, sharedExampleKey, onSelectExampleKey, query = "" } = arg0;
2527
2581
  const selectedContent = requestContents.find((content) => content.mediaType === selectedMediaType) ?? requestContents[0];
2528
2582
  const examples = getExampleEntries(selectedContent?.value, spec);
2529
2583
  const [selectedExampleKey, setSelectedExampleKey] = (0, react.useState)(examples[0]?.key ?? "");
@@ -2531,6 +2585,7 @@ function useRequestExamplesState(arg0) {
2531
2585
  const [selectedClientKey, setSelectedClientKey] = (0, react.useState)("curl");
2532
2586
  const currentExampleKey = (sharedExampleKey && examples.some((example) => example.key === sharedExampleKey) ? sharedExampleKey : void 0) ?? selectedExampleKey;
2533
2587
  const selectedExample = examples.find((example) => example.key === currentExampleKey) ?? examples[0];
2588
+ const requestExample = selectedContent && isStructuredMediaType(selectedContent.mediaType) ? filterExampleBySchema(spec, selectedContent.value.schema, selectedExample?.value, query) : selectedExample?.value;
2534
2589
  const codeOptions = buildRequestCodeExamples({
2535
2590
  spec,
2536
2591
  path,
@@ -2540,7 +2595,7 @@ function useRequestExamplesState(arg0) {
2540
2595
  ...selectedContent,
2541
2596
  value: {
2542
2597
  ...selectedContent.value,
2543
- example: selectedExample?.value,
2598
+ example: requestExample,
2544
2599
  examples: void 0
2545
2600
  }
2546
2601
  } : void 0,
@@ -2575,7 +2630,7 @@ function useRequestExamplesState(arg0) {
2575
2630
  };
2576
2631
  }
2577
2632
  function RequestExamplesPanel(arg0) {
2578
- const { spec, path, method, parameters, requestContents, selectedMediaType, onSelectMediaType, selectedServer, serverVariables, auth, operationSource, sharedExampleKey, onSelectExampleKey } = arg0;
2633
+ const { spec, path, method, parameters, requestContents, selectedMediaType, onSelectMediaType, selectedServer, serverVariables, auth, operationSource, sharedExampleKey, onSelectExampleKey, query } = arg0;
2579
2634
  const t = require_i18n.useBuiltInText();
2580
2635
  const state = useRequestExamplesState({
2581
2636
  spec,
@@ -2590,7 +2645,8 @@ function RequestExamplesPanel(arg0) {
2590
2645
  auth,
2591
2646
  operationSource,
2592
2647
  sharedExampleKey,
2593
- onSelectExampleKey
2648
+ onSelectExampleKey,
2649
+ query
2594
2650
  });
2595
2651
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ApiExampleCodeGroup, {
2596
2652
  title: t("openapi.request"),
@@ -2615,11 +2671,12 @@ function RequestExamplesPanel(arg0) {
2615
2671
  function firstExampleKeyForResponseContent(content, spec) {
2616
2672
  return getExampleEntries(content?.value, spec)[0]?.key ?? "";
2617
2673
  }
2618
- function getResponseExampleBody(content, example) {
2619
- return content ? stringifyExample(example?.value) : "";
2674
+ function getResponseExampleBody(content, example, spec, query = "") {
2675
+ if (!content) return "";
2676
+ return stringifyExample(spec && isStructuredMediaType(content.mediaType) ? filterExampleBySchema(spec, content.value.schema, example?.value, query) : example?.value);
2620
2677
  }
2621
2678
  function useResponseExamplesState(arg0) {
2622
- const { operation, spec, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
2679
+ const { operation, spec, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus, query = "" } = arg0;
2623
2680
  const orderedResponses = [...getResponseEntries(operation, spec)].sort((left, right) => {
2624
2681
  if (left.status === "default") return -1;
2625
2682
  if (right.status === "default") return 1;
@@ -2654,7 +2711,7 @@ function useResponseExamplesState(arg0) {
2654
2711
  selectedContent,
2655
2712
  examples,
2656
2713
  selectedExample,
2657
- responseBody: getResponseExampleBody(selectedContent, selectedExample),
2714
+ responseBody: getResponseExampleBody(selectedContent, selectedExample, spec, query),
2658
2715
  onSelectStatus: (value) => {
2659
2716
  const nextContents = getMediaTypeEntries(orderedResponses.find(({ status }) => status === value)?.response.content, spec);
2660
2717
  if (typeof selectedStatus === "undefined") setInternalSelectedStatus(value);
@@ -2683,7 +2740,7 @@ function useResponseExamplesState(arg0) {
2683
2740
  };
2684
2741
  }
2685
2742
  function ResponseExamplesPanel(arg0) {
2686
- const { operation, spec, title, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
2743
+ const { operation, spec, title, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus, query } = arg0;
2687
2744
  const t = require_i18n.useBuiltInText();
2688
2745
  const state = useResponseExamplesState({
2689
2746
  operation,
@@ -2691,7 +2748,8 @@ function ResponseExamplesPanel(arg0) {
2691
2748
  sharedExampleKey,
2692
2749
  onSelectExampleKey,
2693
2750
  selectedStatus,
2694
- onSelectStatus
2751
+ onSelectStatus,
2752
+ query
2695
2753
  });
2696
2754
  if (!state.selectedContent || !state.responseBody) return null;
2697
2755
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ApiExampleCodeGroup, {
@@ -2713,7 +2771,7 @@ function ResponseExamplesPanel(arg0) {
2713
2771
  //#endregion
2714
2772
  //#region source/openapi/components/OpenApiDocumentSection.tsx
2715
2773
  function OpenApiDocumentSection(props) {
2716
- const { title, children, className, bodyClassName, level = 3 } = props;
2774
+ const { title, children, action, className, bodyClassName, level = 3 } = props;
2717
2775
  const heading = level === 3 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
2718
2776
  className: "!m-0 text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
2719
2777
  children: title
@@ -2723,7 +2781,10 @@ function OpenApiDocumentSection(props) {
2723
2781
  });
2724
2782
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
2725
2783
  className: (0, clsx.default)("clarify-openapi-document-section", className),
2726
- children: [heading, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2784
+ children: [action ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
2785
+ className: "flex min-w-0 items-center justify-between gap-2",
2786
+ children: [heading, action]
2787
+ }) : heading, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2727
2788
  className: (0, clsx.default)("mt-2", bodyClassName),
2728
2789
  children
2729
2790
  })]
@@ -3032,10 +3093,11 @@ function EnumValueNode(arg0) {
3032
3093
  });
3033
3094
  }
3034
3095
  function SchemaNode(arg0) {
3035
- const { node, depth = 0, defaultExpanded } = arg0;
3096
+ const { node, depth = 0, defaultExpanded, forceExpanded = false } = arg0;
3036
3097
  const t = require_i18n.useBuiltInText();
3037
- const [expanded, setExpanded] = (0, react.useState)(defaultExpanded ?? depth < 1);
3098
+ const [locallyExpanded, setLocallyExpanded] = (0, react.useState)(defaultExpanded ?? depth < 1);
3038
3099
  const hasChildren = node.children.length > 0;
3100
+ const expanded = forceExpanded || locallyExpanded;
3039
3101
  if (node.kind === "enum") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EnumValueNode, {
3040
3102
  node,
3041
3103
  depth
@@ -3075,7 +3137,7 @@ function SchemaNode(arg0) {
3075
3137
  type: "button",
3076
3138
  "aria-label": expanded ? t("openapi.collapse") : t("openapi.expand"),
3077
3139
  "aria-expanded": expanded,
3078
- onClick: () => setExpanded((value) => !value),
3140
+ onClick: () => setLocallyExpanded((value) => !value),
3079
3141
  className: (0, clsx.default)(rowClassName, "cursor-pointer transition hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)"),
3080
3142
  children: content
3081
3143
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
@@ -3083,12 +3145,13 @@ function SchemaNode(arg0) {
3083
3145
  children: content
3084
3146
  }), hasChildren && expanded ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaTree, {
3085
3147
  nodes: node.children,
3086
- depth: depth + 1
3148
+ depth: depth + 1,
3149
+ forceExpanded
3087
3150
  }) : null]
3088
3151
  });
3089
3152
  }
3090
3153
  function SchemaTree(arg0) {
3091
- const { nodes, depth = 0 } = arg0;
3154
+ const { nodes, depth = 0, forceExpanded = false } = arg0;
3092
3155
  if (nodes.length === 0) return null;
3093
3156
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
3094
3157
  role: "list",
@@ -3096,19 +3159,44 @@ function SchemaTree(arg0) {
3096
3159
  children: nodes.map((node) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaNode, {
3097
3160
  node,
3098
3161
  depth,
3099
- defaultExpanded: node.defaultExpanded
3162
+ defaultExpanded: node.defaultExpanded,
3163
+ forceExpanded
3100
3164
  }, node.key))
3101
3165
  });
3102
3166
  }
3167
+ function filterSchemaNodes(nodes, query) {
3168
+ if (!query.trim()) return nodes;
3169
+ return nodes.flatMap((node) => {
3170
+ const children = filterSchemaNodes(node.children, query);
3171
+ return fuzzyMatch(getSchemaSearchText(node.name, {
3172
+ type: node.type,
3173
+ description: node.description,
3174
+ pattern: node.details
3175
+ }), query) || children.length > 0 ? [{
3176
+ ...node,
3177
+ children
3178
+ }] : [];
3179
+ });
3180
+ }
3103
3181
  function SchemaProperties(arg0) {
3104
- const { title, schema, spec, defaultExpanded } = arg0;
3182
+ const { title, schema, spec, defaultExpanded, query = "", emptyText } = arg0;
3183
+ const t = require_i18n.useBuiltInText();
3105
3184
  const root = getRootSchemaNode(spec, schema, defaultExpanded);
3106
3185
  if (!root || root.children.length === 0) return null;
3186
+ const filteredNodes = filterSchemaNodes(root.children, query);
3187
+ const hasQuery = Boolean(query.trim());
3188
+ const resolvedEmptyText = emptyText ?? t("openapi.noBodyProperties");
3107
3189
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiDocumentSection, {
3108
3190
  title,
3109
3191
  level: 4,
3110
3192
  bodyClassName: "clarify-schema-properties not-prose",
3111
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaTree, { nodes: root.children })
3193
+ children: filteredNodes.length > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaTree, {
3194
+ nodes: filteredNodes,
3195
+ forceExpanded: hasQuery
3196
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
3197
+ className: "m-0 py-2 text-sm/5 text-(--clarify-ui-text-soft)",
3198
+ children: resolvedEmptyText
3199
+ })
3112
3200
  });
3113
3201
  }
3114
3202
  function ParameterList(arg0) {
@@ -3132,7 +3220,7 @@ function ParameterList(arg0) {
3132
3220
  });
3133
3221
  }
3134
3222
  function ResponseList(arg0) {
3135
- const { title, operation, spec, selectedStatus, onSelectStatus } = arg0;
3223
+ const { title, operation, spec, selectedStatus, onSelectStatus, query = "", search } = arg0;
3136
3224
  const t = require_i18n.useBuiltInText();
3137
3225
  const orderedResponses = [...getResponseEntries(operation, spec)].sort((left, right) => {
3138
3226
  if (left.status === "default") return -1;
@@ -3173,7 +3261,9 @@ function ResponseList(arg0) {
3173
3261
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
3174
3262
  title: t("openapi.responseBodyProperties"),
3175
3263
  schema: responseSchema,
3176
- spec
3264
+ spec,
3265
+ query,
3266
+ emptyText: t("openapi.noResponseBodyProperties")
3177
3267
  })
3178
3268
  }) : null
3179
3269
  ]
@@ -3181,18 +3271,20 @@ function ResponseList(arg0) {
3181
3271
  };
3182
3272
  if (orderedResponses.length === 1) {
3183
3273
  const [{ status, response }] = orderedResponses;
3184
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiDocumentSection, {
3274
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(OpenApiDocumentSection, {
3185
3275
  title: title ?? t("openapi.responses"),
3186
- children: renderResponsePanel({
3276
+ action: search?.action,
3277
+ children: [search?.open ? search.input : null, renderResponsePanel({
3187
3278
  status,
3188
3279
  response
3189
- })
3280
+ })]
3190
3281
  });
3191
3282
  }
3192
- return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiDocumentSection, {
3283
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(OpenApiDocumentSection, {
3193
3284
  title: title ?? t("openapi.responses"),
3285
+ action: search?.action,
3194
3286
  bodyClassName: "not-prose",
3195
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tabs, {
3287
+ children: [search?.open ? search.input : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tabs, {
3196
3288
  selectedIndex,
3197
3289
  onChange: (index) => {
3198
3290
  onSelectStatus?.(orderedResponses[index]?.status ?? "");
@@ -3207,15 +3299,71 @@ function ResponseList(arg0) {
3207
3299
  })),
3208
3300
  spacingClassName: "m-0",
3209
3301
  panelsClassName: "mt-2"
3302
+ })]
3303
+ });
3304
+ }
3305
+ //#endregion
3306
+ //#region source/openapi/components/SchemaSearch.tsx
3307
+ function useSchemaSearch() {
3308
+ const [open, setOpen] = (0, react.useState)(false);
3309
+ const [query, setQuery] = (0, react.useState)("");
3310
+ return {
3311
+ open,
3312
+ query,
3313
+ onChange: (event) => setQuery(event.target.value),
3314
+ toggle: () => {
3315
+ setOpen((current) => {
3316
+ if (current) setQuery("");
3317
+ return !current;
3318
+ });
3319
+ }
3320
+ };
3321
+ }
3322
+ function SchemaSearchButton(arg0) {
3323
+ const { label, open, onClick } = arg0;
3324
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
3325
+ type: "button",
3326
+ "aria-label": label,
3327
+ "aria-pressed": open,
3328
+ onClick,
3329
+ className: (0, clsx.default)("flex size-7 shrink-0 cursor-pointer items-center justify-center rounded-(--clarify-theme-tokens-radius-md) transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)", open ? "bg-(--clarify-ui-hover-background) text-(--clarify-theme-tokens-colors-primary)" : "text-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground)"),
3330
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SearchIcon, {
3331
+ className: "size-4",
3332
+ "aria-hidden": "true"
3210
3333
  })
3211
3334
  });
3212
3335
  }
3336
+ function SchemaSearchInput(arg0) {
3337
+ const { label, value, onChange } = arg0;
3338
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("label", {
3339
+ className: "not-prose mb-3 flex h-9 items-center gap-2 rounded-(--clarify-theme-tokens-radius-md) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-3 transition focus-within:border-(--clarify-theme-tokens-colors-primary) focus-within:ring-2 focus-within:ring-(--clarify-theme-tokens-colors-primary)/15",
3340
+ children: [
3341
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.SearchIcon, {
3342
+ className: "size-4 shrink-0 text-(--clarify-ui-text-faint)",
3343
+ "aria-hidden": "true"
3344
+ }),
3345
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
3346
+ className: "sr-only",
3347
+ children: label
3348
+ }),
3349
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
3350
+ type: "search",
3351
+ value,
3352
+ onChange,
3353
+ placeholder: label,
3354
+ autoFocus: true,
3355
+ className: "min-w-0 flex-1 bg-transparent text-sm text-(--clarify-theme-tokens-colors-foreground) outline-none placeholder:text-(--clarify-ui-text-faint)"
3356
+ })
3357
+ ]
3358
+ });
3359
+ }
3213
3360
  //#endregion
3214
3361
  //#region source/openapi/components/EndpointSections.tsx
3215
3362
  function EndpointRequest(arg0) {
3216
3363
  const { spec, path, method, operationSource = "path", description, groupedParameters, parameters, requestBody, requestContents, requestSchema, selectedRequestMediaType, onSelectRequestMediaType, selectedServer, serverVariables, authOptions, auth, sharedExampleKey, onSelectExampleKey } = arg0;
3217
3364
  const t = require_i18n.useBuiltInText();
3218
3365
  const hasRequestBody = Boolean(requestBody && requestContents.length > 0);
3366
+ const requestBodySearch = useSchemaSearch();
3219
3367
  const renderDescription = () => {
3220
3368
  if (!description) return null;
3221
3369
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: description });
@@ -3225,11 +3373,20 @@ function EndpointRequest(arg0) {
3225
3373
  className: "text-sm/5 text-(--clarify-ui-text-soft)",
3226
3374
  children: t("openapi.requestBodyEmpty")
3227
3375
  });
3228
- return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [typeof requestBody?.description === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: requestBody.description }) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
3229
- title: t("openapi.bodyProperties"),
3230
- schema: requestSchema,
3231
- spec
3232
- })] });
3376
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
3377
+ requestBodySearch.open ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaSearchInput, {
3378
+ label: t("openapi.searchBodyProperties"),
3379
+ value: requestBodySearch.query,
3380
+ onChange: requestBodySearch.onChange
3381
+ }) : null,
3382
+ typeof requestBody?.description === "string" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Markdown, { children: requestBody.description }) : null,
3383
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaProperties, {
3384
+ title: t("openapi.bodyProperties"),
3385
+ schema: requestSchema,
3386
+ spec,
3387
+ query: requestBodySearch.query
3388
+ })
3389
+ ] });
3233
3390
  };
3234
3391
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [renderDescription(), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
3235
3392
  className: "clarify-openapi-request-workspace relative mt-8 pt-6",
@@ -3251,6 +3408,11 @@ function EndpointRequest(arg0) {
3251
3408
  }),
3252
3409
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiDocumentSection, {
3253
3410
  title: t("openapi.requestBody"),
3411
+ action: hasRequestBody ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaSearchButton, {
3412
+ label: t("openapi.searchBodyProperties"),
3413
+ open: requestBodySearch.open,
3414
+ onClick: requestBodySearch.toggle
3415
+ }) : null,
3254
3416
  children: renderRequestBody()
3255
3417
  })
3256
3418
  ]
@@ -3271,7 +3433,8 @@ function EndpointRequest(arg0) {
3271
3433
  auth,
3272
3434
  operationSource,
3273
3435
  sharedExampleKey,
3274
- onSelectExampleKey
3436
+ onSelectExampleKey,
3437
+ query: requestBodySearch.query
3275
3438
  })
3276
3439
  })
3277
3440
  })]
@@ -3282,6 +3445,7 @@ function EndpointResponse(arg0) {
3282
3445
  const t = require_i18n.useBuiltInText();
3283
3446
  const responseTitle = operationSource === "webhook" ? t("openapi.webhookResponses") : t("openapi.responses");
3284
3447
  const responseExampleTitle = operationSource === "webhook" ? t("openapi.webhookResponse") : t("openapi.response");
3448
+ const responseBodySearch = useSchemaSearch();
3285
3449
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
3286
3450
  className: "mt-10 pt-6",
3287
3451
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(Row, {
@@ -3293,7 +3457,21 @@ function EndpointResponse(arg0) {
3293
3457
  operation,
3294
3458
  spec,
3295
3459
  selectedStatus,
3296
- onSelectStatus
3460
+ onSelectStatus,
3461
+ query: responseBodySearch.query,
3462
+ search: {
3463
+ open: responseBodySearch.open,
3464
+ action: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaSearchButton, {
3465
+ label: t("openapi.searchResponseBodyProperties"),
3466
+ open: responseBodySearch.open,
3467
+ onClick: responseBodySearch.toggle
3468
+ }),
3469
+ input: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SchemaSearchInput, {
3470
+ label: t("openapi.searchResponseBodyProperties"),
3471
+ value: responseBodySearch.query,
3472
+ onChange: responseBodySearch.onChange
3473
+ })
3474
+ }
3297
3475
  })
3298
3476
  }) }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Col, {
3299
3477
  sticky: true,
@@ -3306,7 +3484,8 @@ function EndpointResponse(arg0) {
3306
3484
  sharedExampleKey,
3307
3485
  onSelectExampleKey,
3308
3486
  selectedStatus,
3309
- onSelectStatus
3487
+ onSelectStatus,
3488
+ query: responseBodySearch.query
3310
3489
  })
3311
3490
  })
3312
3491
  })]
@@ -5603,4 +5782,4 @@ Object.defineProperty(exports, "primitives_exports", {
5603
5782
  }
5604
5783
  });
5605
5784
 
5606
- //# sourceMappingURL=OpenApiOperation-HhSjad7q.cjs.map
5785
+ //# sourceMappingURL=OpenApiOperation-QqYCuqve.cjs.map