@clarify-labs/renderer 0.11.8 → 0.11.9

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 (40) hide show
  1. package/output/{ClarifyShell-D8OGIUWq.cjs → ClarifyShell-GCXbb_AF.cjs} +3 -3
  2. package/output/{ClarifyShell-D8OGIUWq.cjs.map → ClarifyShell-GCXbb_AF.cjs.map} +1 -1
  3. package/output/{ClarifyShell-CGoRrkn1.js → ClarifyShell-nV23Fn7m.js} +3 -3
  4. package/output/{ClarifyShell-CGoRrkn1.js.map → ClarifyShell-nV23Fn7m.js.map} +1 -1
  5. package/output/{MermaidViewer-CFqy0BnO.cjs → MermaidViewer-DEKNDG7K.cjs} +2 -2
  6. package/output/{MermaidViewer-CFqy0BnO.cjs.map → MermaidViewer-DEKNDG7K.cjs.map} +1 -1
  7. package/output/{MermaidViewer-TdU3sRfy.js → MermaidViewer-Ssxr00dy.js} +2 -2
  8. package/output/{MermaidViewer-TdU3sRfy.js.map → MermaidViewer-Ssxr00dy.js.map} +1 -1
  9. package/output/{OpenApiOperation-vCuIKI4O.js → OpenApiOperation-B26v2y44.js} +72 -8
  10. package/output/{OpenApiOperation-vCuIKI4O.js.map → OpenApiOperation-B26v2y44.js.map} +1 -1
  11. package/output/{OpenApiOperation-Bd68uxXq.cjs → OpenApiOperation-DIgbzvk5.cjs} +72 -8
  12. package/output/{OpenApiOperation-Bd68uxXq.cjs.map → OpenApiOperation-DIgbzvk5.cjs.map} +1 -1
  13. package/output/{PageActions-CqXr0SyW.js → PageActions-BbmyFeSk.js} +10 -9
  14. package/output/{PageActions-CqXr0SyW.js.map → PageActions-BbmyFeSk.js.map} +1 -1
  15. package/output/{PageActions-DPYXFL6N.cjs → PageActions-DxGK-444.cjs} +10 -9
  16. package/output/{PageActions-DPYXFL6N.cjs.map → PageActions-DxGK-444.cjs.map} +1 -1
  17. package/output/{SearchDialog-BQcbGNvl.js → SearchDialog-4oEbmVMR.js} +3 -3
  18. package/output/{SearchDialog-BQcbGNvl.js.map → SearchDialog-4oEbmVMR.js.map} +1 -1
  19. package/output/{SearchDialog-CExM6Bxd.cjs → SearchDialog-DexOW8E4.cjs} +3 -3
  20. package/output/{SearchDialog-CExM6Bxd.cjs.map → SearchDialog-DexOW8E4.cjs.map} +1 -1
  21. package/output/client.cjs +3 -3
  22. package/output/client.js +3 -3
  23. package/output/{i18n-Dw4Jlho-.cjs → i18n-BuvwT5W9.cjs} +3 -1
  24. package/output/i18n-BuvwT5W9.cjs.map +1 -0
  25. package/output/{i18n-D4O3z-sP.js → i18n-C6tIP-nl.js} +3 -1
  26. package/output/i18n-C6tIP-nl.js.map +1 -0
  27. package/output/index.cjs +5 -5
  28. package/output/index.js +5 -5
  29. package/output/openapi/lib/api-exchange.d.ts +2 -0
  30. package/output/preview.cjs +3 -3
  31. package/output/preview.js +3 -3
  32. package/output/{render-DQRifjrn.js → render-CAtVGsQF.js} +2 -2
  33. package/output/{render-DQRifjrn.js.map → render-CAtVGsQF.js.map} +1 -1
  34. package/output/{render-CqBz1q82.cjs → render-D8h-jcnw.cjs} +2 -2
  35. package/output/{render-CqBz1q82.cjs.map → render-D8h-jcnw.cjs.map} +1 -1
  36. package/output/server.cjs +2 -2
  37. package/output/server.js +2 -2
  38. package/package.json +1 -1
  39. package/output/i18n-D4O3z-sP.js.map +0 -1
  40. package/output/i18n-Dw4Jlho-.cjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
- const require_i18n = require("./i18n-Dw4Jlho-.cjs");
3
- const require_PageActions = require("./PageActions-DPYXFL6N.cjs");
2
+ const require_i18n = require("./i18n-BuvwT5W9.cjs");
3
+ const require_PageActions = require("./PageActions-DxGK-444.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-CFqy0BnO.cjs")));
248
+ var MermaidViewer = (0, react.lazy)(() => Promise.resolve().then(() => require("./MermaidViewer-DEKNDG7K.cjs")));
249
249
  var mermaidModulePromise;
250
250
  async function loadMermaid() {
251
251
  mermaidModulePromise = mermaidModulePromise ?? import("mermaid").then((module) => module.default);
@@ -4249,6 +4249,7 @@ var textLanguages = {
4249
4249
  "application/xhtml+xml": "html",
4250
4250
  "application/x-www-form-urlencoded": "http",
4251
4251
  "text/css": "css",
4252
+ "text/event-stream": "text",
4252
4253
  "text/csv": "csv",
4253
4254
  "text/html": "html",
4254
4255
  "text/javascript": "javascript",
@@ -4542,6 +4543,10 @@ function OpenApiResponseViewer(arg0) {
4542
4543
  className: "text-xs text-(--clarify-code-faint)",
4543
4544
  children: formatBytes(exchange.size)
4544
4545
  }),
4546
+ exchange.streaming ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
4547
+ className: "text-xs font-semibold text-(--clarify-code-success)",
4548
+ children: t("openapi.streaming")
4549
+ }) : null,
4545
4550
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: (0, clsx.default)("size-2 rounded-full", exchange.status < 400 ? "bg-(--clarify-code-success)" : "bg-(--clarify-code-danger)") }),
4546
4551
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
4547
4552
  className: (0, clsx.default)("text-xs font-semibold", exchange.status < 400 ? "text-(--clarify-code-success)" : "text-(--clarify-code-danger)"),
@@ -4669,9 +4674,13 @@ function requestSnapshot(request) {
4669
4674
  body: requestBodySnapshot(request.init.body)
4670
4675
  };
4671
4676
  }
4677
+ function isEventStream(contentType) {
4678
+ return contentType.split(";", 1)[0].trim().toLowerCase() === "text/event-stream";
4679
+ }
4672
4680
  async function executeApiRequest(request, options = {}) {
4673
4681
  const fetchRequest = options.fetch ?? fetch;
4674
4682
  const now = options.now ?? (() => performance.now());
4683
+ const onProgress = options.onProgress;
4675
4684
  const startedAt = now();
4676
4685
  let response;
4677
4686
  try {
@@ -4683,17 +4692,69 @@ async function executeApiRequest(request, options = {}) {
4683
4692
  if (cause instanceof DOMException && cause.name === "AbortError") throw cause;
4684
4693
  throw new ApiRequestError(cause instanceof Error ? cause.message : String(cause), { cause });
4685
4694
  }
4695
+ const contentType = response.headers.get("content-type") ?? "";
4696
+ const headers = Array.from(response.headers.entries());
4697
+ const requestSnapshotValue = requestSnapshot(request);
4698
+ if (isEventStream(contentType) && response.body) {
4699
+ const reader = response.body.getReader();
4700
+ const decoder = new TextDecoder();
4701
+ let body = "";
4702
+ let totalSize = 0;
4703
+ const emit = (streaming) => {
4704
+ const blob = new Blob([body], { type: contentType });
4705
+ onProgress?.({
4706
+ request: requestSnapshotValue,
4707
+ status: response.status,
4708
+ statusText: response.statusText,
4709
+ url: response.url || request.url,
4710
+ redirected: response.redirected,
4711
+ duration: Math.round(now() - startedAt),
4712
+ size: totalSize,
4713
+ headers,
4714
+ contentType,
4715
+ body,
4716
+ blob,
4717
+ streaming
4718
+ });
4719
+ };
4720
+ emit(true);
4721
+ while (true) {
4722
+ const result = await reader.read();
4723
+ if (result.done) break;
4724
+ totalSize += result.value.byteLength;
4725
+ body += decoder.decode(result.value, { stream: true });
4726
+ emit(true);
4727
+ }
4728
+ body += decoder.decode();
4729
+ const blob = new Blob([body], { type: contentType });
4730
+ const exchange = {
4731
+ request: requestSnapshotValue,
4732
+ status: response.status,
4733
+ statusText: response.statusText,
4734
+ url: response.url || request.url,
4735
+ redirected: response.redirected,
4736
+ duration: Math.round(now() - startedAt),
4737
+ size: totalSize,
4738
+ headers,
4739
+ contentType,
4740
+ body,
4741
+ blob,
4742
+ streaming: false
4743
+ };
4744
+ onProgress?.(exchange);
4745
+ return exchange;
4746
+ }
4686
4747
  const blob = await response.blob();
4687
4748
  return {
4688
- request: requestSnapshot(request),
4749
+ request: requestSnapshotValue,
4689
4750
  status: response.status,
4690
4751
  statusText: response.statusText,
4691
4752
  url: response.url || request.url,
4692
4753
  redirected: response.redirected,
4693
4754
  duration: Math.round(now() - startedAt),
4694
4755
  size: blob.size,
4695
- headers: Array.from(response.headers.entries()),
4696
- contentType: response.headers.get("content-type") ?? blob.type,
4756
+ headers,
4757
+ contentType: contentType || blob.type,
4697
4758
  body: await blob.text(),
4698
4759
  blob
4699
4760
  };
@@ -4894,7 +4955,10 @@ function useOpenApiRequestExecution() {
4894
4955
  setError("");
4895
4956
  setExchange(void 0);
4896
4957
  try {
4897
- setExchange(await executeApiRequest(request, { signal: controller.signal }));
4958
+ setExchange(await executeApiRequest(request, {
4959
+ signal: controller.signal,
4960
+ onProgress: (progress) => setExchange(progress)
4961
+ }));
4898
4962
  } catch (cause) {
4899
4963
  if (cause instanceof DOMException && cause.name === "AbortError") return;
4900
4964
  const message = cause instanceof Error ? cause.message : String(cause);
@@ -5805,4 +5869,4 @@ Object.defineProperty(exports, "primitives_exports", {
5805
5869
  }
5806
5870
  });
5807
5871
 
5808
- //# sourceMappingURL=OpenApiOperation-Bd68uxXq.cjs.map
5872
+ //# sourceMappingURL=OpenApiOperation-DIgbzvk5.cjs.map