@clarify-labs/renderer 0.11.8 → 0.11.10

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 (54) hide show
  1. package/output/{ClarifyShell-CGoRrkn1.js → ClarifyShell-DGm_R5Bp.js} +33 -13
  2. package/output/ClarifyShell-DGm_R5Bp.js.map +1 -0
  3. package/output/{ClarifyShell-D8OGIUWq.cjs → ClarifyShell-DLOGS18o.cjs} +33 -13
  4. package/output/ClarifyShell-DLOGS18o.cjs.map +1 -0
  5. package/output/{MermaidViewer-CFqy0BnO.cjs → MermaidViewer-BRR8SGnK.cjs} +2 -2
  6. package/output/{MermaidViewer-CFqy0BnO.cjs.map → MermaidViewer-BRR8SGnK.cjs.map} +1 -1
  7. package/output/{MermaidViewer-TdU3sRfy.js → MermaidViewer-CSbKX396.js} +2 -2
  8. package/output/{MermaidViewer-TdU3sRfy.js.map → MermaidViewer-CSbKX396.js.map} +1 -1
  9. package/output/{OpenApiOperation-Bd68uxXq.cjs → OpenApiOperation-416zAKci.cjs} +148 -16
  10. package/output/OpenApiOperation-416zAKci.cjs.map +1 -0
  11. package/output/{OpenApiOperation-vCuIKI4O.js → OpenApiOperation-bY3wbaJC.js} +138 -18
  12. package/output/OpenApiOperation-bY3wbaJC.js.map +1 -0
  13. package/output/{PageActions-DPYXFL6N.cjs → PageActions-CVOTIuxh.cjs} +205 -86
  14. package/output/PageActions-CVOTIuxh.cjs.map +1 -0
  15. package/output/{PageActions-CqXr0SyW.js → PageActions-D52u18C8.js} +201 -88
  16. package/output/PageActions-D52u18C8.js.map +1 -0
  17. package/output/{SearchDialog-CExM6Bxd.cjs → SearchDialog--OLp05za.cjs} +3 -3
  18. package/output/{SearchDialog-CExM6Bxd.cjs.map → SearchDialog--OLp05za.cjs.map} +1 -1
  19. package/output/{SearchDialog-BQcbGNvl.js → SearchDialog-Cq7w-uc7.js} +3 -3
  20. package/output/{SearchDialog-BQcbGNvl.js.map → SearchDialog-Cq7w-uc7.js.map} +1 -1
  21. package/output/app/AppShell.d.ts +2 -1
  22. package/output/app/PageActions.d.ts +6 -0
  23. package/output/app/PageUpdatedAt.d.ts +6 -0
  24. package/output/client.cjs +3 -3
  25. package/output/client.js +3 -3
  26. package/output/core/types.d.ts +21 -5
  27. package/output/{i18n-Dw4Jlho-.cjs → i18n-BMNCgF9o.cjs} +4 -2
  28. package/output/i18n-BMNCgF9o.cjs.map +1 -0
  29. package/output/{i18n-D4O3z-sP.js → i18n-Zmmhz7FF.js} +4 -2
  30. package/output/i18n-Zmmhz7FF.js.map +1 -0
  31. package/output/index.cjs +7 -5
  32. package/output/index.d.ts +2 -1
  33. package/output/index.js +6 -6
  34. package/output/mdx/components.d.ts +9 -0
  35. package/output/mdx/primitives.d.ts +11 -0
  36. package/output/openapi/lib/api-exchange.d.ts +2 -0
  37. package/output/preview.cjs +3 -3
  38. package/output/preview.js +3 -3
  39. package/output/{render-DQRifjrn.js → render-D_QvIv7Z.js} +2 -2
  40. package/output/{render-DQRifjrn.js.map → render-D_QvIv7Z.js.map} +1 -1
  41. package/output/{render-CqBz1q82.cjs → render-TErh9x_2.cjs} +2 -2
  42. package/output/{render-CqBz1q82.cjs.map → render-TErh9x_2.cjs.map} +1 -1
  43. package/output/renderer.css +86 -0
  44. package/output/server.cjs +2 -2
  45. package/output/server.js +2 -2
  46. package/package.json +1 -1
  47. package/output/ClarifyShell-CGoRrkn1.js.map +0 -1
  48. package/output/ClarifyShell-D8OGIUWq.cjs.map +0 -1
  49. package/output/OpenApiOperation-Bd68uxXq.cjs.map +0 -1
  50. package/output/OpenApiOperation-vCuIKI4O.js.map +0 -1
  51. package/output/PageActions-CqXr0SyW.js.map +0 -1
  52. package/output/PageActions-DPYXFL6N.cjs.map +0 -1
  53. package/output/i18n-D4O3z-sP.js.map +0 -1
  54. package/output/i18n-Dw4Jlho-.cjs.map +0 -1
@@ -1,12 +1,12 @@
1
- import { a as useConfig, l as useLocale, o as useConfigOptional, t as useBuiltInText } from "./i18n-D4O3z-sP.js";
2
- import { C as isExternalHref, D as copyTextToClipboard, c as lucideIconRegistry, h as useTheme, l as resolveLucideIconName, o as useSectionStore, s as remToPx, t as PageActions, w as localizeHref } from "./PageActions-CqXr0SyW.js";
1
+ import { a as useConfig, l as useLocale, o as useConfigOptional, t as useBuiltInText } from "./i18n-Zmmhz7FF.js";
2
+ import { O as copyTextToClipboard, T as localizeHref, c as remToPx, g as useTheme, l as lucideIconRegistry, s as useSectionStore, t as PageActions, u as resolveLucideIconName, w as isExternalHref } from "./PageActions-D52u18C8.js";
3
3
  import { t as markdownRemarkPlugins } from "./remark-C9iRQM0R.js";
4
4
  import clsx from "clsx";
5
5
  import { Children, Suspense, cloneElement, createContext, createElement, forwardRef, isValidElement, lazy, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
6
6
  import { Link } from "react-router-dom";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { Dialog, DialogBackdrop, DialogPanel, DialogTitle, Listbox, ListboxButton, ListboxOption, ListboxOptions, Tab, TabGroup, TabList, TabPanel, TabPanels, Transition } from "@headlessui/react";
9
- import { AlertTriangle, ArrowRight, ArrowUpRight, Check, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, CircleAlertIcon, CircleCheck, Clipboard, ClipboardIcon, CodeIcon, CopyIcon, DownloadIcon, EraserIcon, File, FileX2Icon, Folder, FolderOpen, Info, InfoIcon, Lightbulb, LinkIcon, LoaderCircleIcon, Maximize2, PackageIcon, RotateCcwIcon, SearchIcon, SendIcon, ServerIcon, X, XCircle, XIcon } from "lucide-react";
9
+ import { AlertTriangle, ArrowRight, ArrowUpRight, CalendarDays, Check, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, CircleAlertIcon, CircleCheck, Clipboard, ClipboardIcon, CodeIcon, CopyIcon, DownloadIcon, EraserIcon, File, FileX2Icon, Folder, FolderOpen, Info, InfoIcon, Lightbulb, LinkIcon, LoaderCircleIcon, Maximize2, PackageIcon, RotateCcwIcon, SearchIcon, SendIcon, ServerIcon, X, XCircle, XIcon } from "lucide-react";
10
10
  import { motion, useInView } from "framer-motion";
11
11
  import { create } from "zustand";
12
12
  import ReactMarkdown from "react-markdown";
@@ -253,7 +253,7 @@ function Card(arg0) {
253
253
  }
254
254
  //#endregion
255
255
  //#region source/components/Mermaid.tsx
256
- var MermaidViewer = lazy(() => import("./MermaidViewer-TdU3sRfy.js"));
256
+ var MermaidViewer = lazy(() => import("./MermaidViewer-CSbKX396.js"));
257
257
  var mermaidModulePromise;
258
258
  async function loadMermaid() {
259
259
  mermaidModulePromise = mermaidModulePromise ?? import("mermaid").then((module) => module.default);
@@ -1251,6 +1251,8 @@ var primitives_exports = /* @__PURE__ */ __exportAll({
1251
1251
  Note: () => Note,
1252
1252
  Properties: () => Properties,
1253
1253
  Property: () => Property,
1254
+ Release: () => Release,
1255
+ ReleaseItem: () => ReleaseItem,
1254
1256
  Row: () => Row,
1255
1257
  Step: () => Step,
1256
1258
  Steps: () => Steps,
@@ -1268,6 +1270,43 @@ var primitives_exports = /* @__PURE__ */ __exportAll({
1268
1270
  table: () => table,
1269
1271
  wrapper: () => wrapper
1270
1272
  });
1273
+ function Release(arg0) {
1274
+ const { version, date, children } = arg0;
1275
+ return /* @__PURE__ */ jsxs("section", {
1276
+ id: version,
1277
+ className: "clarify-release my-14 grid gap-7 border-t border-(--clarify-theme-tokens-colors-border) pt-8 sm:grid-cols-[8.5rem_minmax(0,1fr)] sm:gap-12",
1278
+ children: [/* @__PURE__ */ jsxs("header", {
1279
+ className: "self-start sm:sticky sm:top-24",
1280
+ children: [/* @__PURE__ */ jsx("h2", {
1281
+ className: "m-0! inline-flex rounded-(--clarify-theme-tokens-radius-md) bg-(--clarify-ui-accent-background) px-2.5 py-1 text-sm font-semibold text-(--clarify-ui-accent-text)",
1282
+ children: version
1283
+ }), date ? /* @__PURE__ */ jsxs("time", {
1284
+ dateTime: date,
1285
+ className: "mt-3 flex items-center gap-1.5 text-xs text-(--clarify-ui-text-faint)",
1286
+ children: [/* @__PURE__ */ jsx(CalendarDays, {
1287
+ className: "size-3.5",
1288
+ "aria-hidden": "true"
1289
+ }), date]
1290
+ }) : null]
1291
+ }), /* @__PURE__ */ jsx("div", {
1292
+ className: "min-w-0 space-y-10",
1293
+ children
1294
+ })]
1295
+ });
1296
+ }
1297
+ function ReleaseItem(arg0) {
1298
+ const { title, children } = arg0;
1299
+ return /* @__PURE__ */ jsxs("div", {
1300
+ className: "clarify-release-item min-w-0",
1301
+ children: [/* @__PURE__ */ jsx("h3", {
1302
+ className: "m-0! text-lg font-semibold text-(--clarify-ui-text)",
1303
+ children: title
1304
+ }), /* @__PURE__ */ jsx("div", {
1305
+ className: "mt-3 min-w-0 text-sm/6 text-(--clarify-ui-text-soft) *:first:mt-0 *:last:mb-0",
1306
+ children
1307
+ })]
1308
+ });
1309
+ }
1271
1310
  function wrapper(arg0) {
1272
1311
  const { children } = arg0;
1273
1312
  return /* @__PURE__ */ jsxs("article", {
@@ -3064,22 +3103,22 @@ function getRootSchemaNode(spec, schema, defaultExpanded) {
3064
3103
  })
3065
3104
  };
3066
3105
  }
3067
- function EnumValueNode(arg0) {
3106
+ function EnumValueWithDescription(arg0) {
3068
3107
  const { node } = arg0;
3069
3108
  return /* @__PURE__ */ jsx("li", {
3070
3109
  className: clsx("clarify-schema-node m-0 p-0", node.visible === false && "hidden"),
3071
3110
  children: /* @__PURE__ */ jsx("div", {
3072
- className: "flex min-w-0 items-start rounded-(--clarify-theme-tokens-radius-md) px-2 py-2 text-left",
3111
+ className: "flex min-w-0 items-start gap-3 rounded-(--clarify-theme-tokens-radius-md) px-2 py-2 text-left",
3073
3112
  children: /* @__PURE__ */ jsxs("div", {
3074
3113
  className: "min-w-0 flex-1",
3075
3114
  children: [/* @__PURE__ */ jsx("div", {
3076
3115
  className: "flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5",
3077
- children: /* @__PURE__ */ jsx("span", {
3078
- className: "text-sm/5 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
3116
+ children: /* @__PURE__ */ jsx("code", {
3117
+ className: "break-all font-mono text-xs/5 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
3079
3118
  children: node.name
3080
3119
  })
3081
- }), node.description || node.details ? /* @__PURE__ */ jsxs("div", {
3082
- className: "mt-0.5 text-sm/5 text-(--clarify-ui-text-soft) *:first:mt-0 *:last:mb-0",
3120
+ }), /* @__PURE__ */ jsxs("div", {
3121
+ className: "mt-1 text-sm/5 text-(--clarify-ui-text-soft) *:first:mt-0 *:last:mb-0",
3083
3122
  children: [node.description ? /* @__PURE__ */ jsx(Markdown, {
3084
3123
  className: "*:first:mt-0 *:last:mb-0",
3085
3124
  children: node.description
@@ -3087,11 +3126,28 @@ function EnumValueNode(arg0) {
3087
3126
  className: "text-xs text-(--clarify-ui-text-faint)",
3088
3127
  children: node.details
3089
3128
  }) : null]
3090
- }) : null]
3129
+ })]
3091
3130
  })
3092
3131
  })
3093
3132
  });
3094
3133
  }
3134
+ function CompactEnumValue(arg0) {
3135
+ const { node } = arg0;
3136
+ return /* @__PURE__ */ jsx("li", {
3137
+ className: clsx("clarify-schema-node inline-flex m-0 p-0", node.visible === false && "hidden"),
3138
+ children: /* @__PURE__ */ jsx("div", {
3139
+ className: "flex min-w-0 items-start rounded-(--clarify-theme-tokens-radius-md) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-ui-subtle-background) px-2 py-1 text-left",
3140
+ children: /* @__PURE__ */ jsx("code", {
3141
+ className: "break-all font-mono text-xs/5 text-(--clarify-theme-tokens-colors-foreground)",
3142
+ children: node.name
3143
+ })
3144
+ })
3145
+ });
3146
+ }
3147
+ function EnumValueNode(arg0) {
3148
+ const { node } = arg0;
3149
+ return node.description || node.details ? /* @__PURE__ */ jsx(EnumValueWithDescription, { node }) : /* @__PURE__ */ jsx(CompactEnumValue, { node });
3150
+ }
3095
3151
  function SchemaNode(arg0) {
3096
3152
  const { node, depth = 0, defaultExpanded, forceExpanded = false } = arg0;
3097
3153
  const t = useBuiltInText();
@@ -3158,7 +3214,7 @@ function SchemaTree(arg0) {
3158
3214
  if (nodes.length === 0) return null;
3159
3215
  return /* @__PURE__ */ jsx("ul", {
3160
3216
  role: "list",
3161
- className: clsx("m-0 list-none p-0", depth === 0 ? "divide-y divide-(--clarify-theme-tokens-colors-border)" : "ml-2 border-l border-(--clarify-theme-tokens-colors-border) pl-2"),
3217
+ className: clsx("m-0 list-none p-0", nodes.every((node) => node.kind === "enum") && nodes.every((node) => !node.description && !node.details) ? "flex flex-wrap gap-1.5 py-1" : depth === 0 ? "divide-y divide-(--clarify-theme-tokens-colors-border)" : "ml-2 border-l border-(--clarify-theme-tokens-colors-border) pl-2"),
3162
3218
  children: nodes.map((node) => /* @__PURE__ */ jsx(SchemaNode, {
3163
3219
  node,
3164
3220
  depth,
@@ -4257,6 +4313,7 @@ var textLanguages = {
4257
4313
  "application/xhtml+xml": "html",
4258
4314
  "application/x-www-form-urlencoded": "http",
4259
4315
  "text/css": "css",
4316
+ "text/event-stream": "text",
4260
4317
  "text/csv": "csv",
4261
4318
  "text/html": "html",
4262
4319
  "text/javascript": "javascript",
@@ -4550,6 +4607,10 @@ function OpenApiResponseViewer(arg0) {
4550
4607
  className: "text-xs text-(--clarify-code-faint)",
4551
4608
  children: formatBytes(exchange.size)
4552
4609
  }),
4610
+ exchange.streaming ? /* @__PURE__ */ jsx("span", {
4611
+ className: "text-xs font-semibold text-(--clarify-code-success)",
4612
+ children: t("openapi.streaming")
4613
+ }) : null,
4553
4614
  /* @__PURE__ */ jsx("span", { className: clsx("size-2 rounded-full", exchange.status < 400 ? "bg-(--clarify-code-success)" : "bg-(--clarify-code-danger)") }),
4554
4615
  /* @__PURE__ */ jsxs("span", {
4555
4616
  className: clsx("text-xs font-semibold", exchange.status < 400 ? "text-(--clarify-code-success)" : "text-(--clarify-code-danger)"),
@@ -4677,9 +4738,13 @@ function requestSnapshot(request) {
4677
4738
  body: requestBodySnapshot(request.init.body)
4678
4739
  };
4679
4740
  }
4741
+ function isEventStream(contentType) {
4742
+ return contentType.split(";", 1)[0].trim().toLowerCase() === "text/event-stream";
4743
+ }
4680
4744
  async function executeApiRequest(request, options = {}) {
4681
4745
  const fetchRequest = options.fetch ?? fetch;
4682
4746
  const now = options.now ?? (() => performance.now());
4747
+ const onProgress = options.onProgress;
4683
4748
  const startedAt = now();
4684
4749
  let response;
4685
4750
  try {
@@ -4691,17 +4756,69 @@ async function executeApiRequest(request, options = {}) {
4691
4756
  if (cause instanceof DOMException && cause.name === "AbortError") throw cause;
4692
4757
  throw new ApiRequestError(cause instanceof Error ? cause.message : String(cause), { cause });
4693
4758
  }
4759
+ const contentType = response.headers.get("content-type") ?? "";
4760
+ const headers = Array.from(response.headers.entries());
4761
+ const requestSnapshotValue = requestSnapshot(request);
4762
+ if (isEventStream(contentType) && response.body) {
4763
+ const reader = response.body.getReader();
4764
+ const decoder = new TextDecoder();
4765
+ let body = "";
4766
+ let totalSize = 0;
4767
+ const emit = (streaming) => {
4768
+ const blob = new Blob([body], { type: contentType });
4769
+ onProgress?.({
4770
+ request: requestSnapshotValue,
4771
+ status: response.status,
4772
+ statusText: response.statusText,
4773
+ url: response.url || request.url,
4774
+ redirected: response.redirected,
4775
+ duration: Math.round(now() - startedAt),
4776
+ size: totalSize,
4777
+ headers,
4778
+ contentType,
4779
+ body,
4780
+ blob,
4781
+ streaming
4782
+ });
4783
+ };
4784
+ emit(true);
4785
+ while (true) {
4786
+ const result = await reader.read();
4787
+ if (result.done) break;
4788
+ totalSize += result.value.byteLength;
4789
+ body += decoder.decode(result.value, { stream: true });
4790
+ emit(true);
4791
+ }
4792
+ body += decoder.decode();
4793
+ const blob = new Blob([body], { type: contentType });
4794
+ const exchange = {
4795
+ request: requestSnapshotValue,
4796
+ status: response.status,
4797
+ statusText: response.statusText,
4798
+ url: response.url || request.url,
4799
+ redirected: response.redirected,
4800
+ duration: Math.round(now() - startedAt),
4801
+ size: totalSize,
4802
+ headers,
4803
+ contentType,
4804
+ body,
4805
+ blob,
4806
+ streaming: false
4807
+ };
4808
+ onProgress?.(exchange);
4809
+ return exchange;
4810
+ }
4694
4811
  const blob = await response.blob();
4695
4812
  return {
4696
- request: requestSnapshot(request),
4813
+ request: requestSnapshotValue,
4697
4814
  status: response.status,
4698
4815
  statusText: response.statusText,
4699
4816
  url: response.url || request.url,
4700
4817
  redirected: response.redirected,
4701
4818
  duration: Math.round(now() - startedAt),
4702
4819
  size: blob.size,
4703
- headers: Array.from(response.headers.entries()),
4704
- contentType: response.headers.get("content-type") ?? blob.type,
4820
+ headers,
4821
+ contentType: contentType || blob.type,
4705
4822
  body: await blob.text(),
4706
4823
  blob
4707
4824
  };
@@ -4902,7 +5019,10 @@ function useOpenApiRequestExecution() {
4902
5019
  setError("");
4903
5020
  setExchange(void 0);
4904
5021
  try {
4905
- setExchange(await executeApiRequest(request, { signal: controller.signal }));
5022
+ setExchange(await executeApiRequest(request, {
5023
+ signal: controller.signal,
5024
+ onProgress: (progress) => setExchange(progress)
5025
+ }));
4906
5026
  } catch (cause) {
4907
5027
  if (cause instanceof DOMException && cause.name === "AbortError") return;
4908
5028
  const message = cause instanceof Error ? cause.message : String(cause);
@@ -5572,6 +5692,6 @@ function OpenApiOperation(arg0) {
5572
5692
  });
5573
5693
  }
5574
5694
  //#endregion
5575
- export { Feedback as A, LocalizedLink as B, Steps as C, Logo as D, HeroPattern as E, Mermaid as F, Card as I, CardGroup as L, Code as M, CodeGroup as N, Heading as O, Pre as P, Callout as R, Step as S, GridPattern as T, Markdown as _, ResponseExamplesPanel as a, TabItem as b, getAuthOptions as c, EndpointMethodBadge as d, getOpenApiOperationEntryById as f, getRequestBody$1 as g, getMediaTypeEntries as h, RequestExamplesPanel as i, Collapse as j, Tag as k, getServerKey as l, listOpenApiOperations as m, OpenApiOperation as n, authPlaceholder as o, getOpenApiOperationSectionId as p, OpenApiRequestWorkbench as r, defaultServerVariables as s, EndpointIdentity as t, getServers as u, primitives_exports as v, Prose as w, Tabs as x, WebFrame as y, Button as z };
5695
+ export { Heading as A, Callout as B, Tabs as C, GridPattern as D, Prose as E, CodeGroup as F, LocalizedLink as H, Pre as I, Mermaid as L, Feedback as M, Collapse as N, HeroPattern as O, Code as P, Card as R, TabItem as S, Steps as T, Button as V, Markdown as _, ResponseExamplesPanel as a, primitives_exports as b, getAuthOptions as c, EndpointMethodBadge as d, getOpenApiOperationEntryById as f, getRequestBody$1 as g, getMediaTypeEntries as h, RequestExamplesPanel as i, Tag as j, Logo as k, getServerKey as l, listOpenApiOperations as m, OpenApiOperation as n, authPlaceholder as o, getOpenApiOperationSectionId as p, OpenApiRequestWorkbench as r, defaultServerVariables as s, EndpointIdentity as t, getServers as u, Release as v, Step as w, WebFrame as x, ReleaseItem as y, CardGroup as z };
5576
5696
 
5577
- //# sourceMappingURL=OpenApiOperation-vCuIKI4O.js.map
5697
+ //# sourceMappingURL=OpenApiOperation-bY3wbaJC.js.map