@clarify-labs/renderer 0.11.7 → 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 (67) hide show
  1. package/output/{ClarifyShell-CukbPOAd.cjs → ClarifyShell-GCXbb_AF.cjs} +120 -68
  2. package/output/ClarifyShell-GCXbb_AF.cjs.map +1 -0
  3. package/output/{ClarifyShell-CKvXZj0f.js → ClarifyShell-nV23Fn7m.js} +120 -68
  4. package/output/ClarifyShell-nV23Fn7m.js.map +1 -0
  5. package/output/{MermaidViewer-FOg263MO.cjs → MermaidViewer-DEKNDG7K.cjs} +3 -3
  6. package/output/{MermaidViewer-FOg263MO.cjs.map → MermaidViewer-DEKNDG7K.cjs.map} +1 -1
  7. package/output/{MermaidViewer-_tpH0JNn.js → MermaidViewer-Ssxr00dy.js} +3 -3
  8. package/output/{MermaidViewer-_tpH0JNn.js.map → MermaidViewer-Ssxr00dy.js.map} +1 -1
  9. package/output/{OpenApiOperation-Dv9u2GEJ.js → OpenApiOperation-B26v2y44.js} +77 -12
  10. package/output/{OpenApiOperation-Dv9u2GEJ.js.map → OpenApiOperation-B26v2y44.js.map} +1 -1
  11. package/output/{OpenApiOperation-c-I6Nw9j.cjs → OpenApiOperation-DIgbzvk5.cjs} +77 -12
  12. package/output/{OpenApiOperation-c-I6Nw9j.cjs.map → OpenApiOperation-DIgbzvk5.cjs.map} +1 -1
  13. package/output/{PageActions-DviEypf6.js → PageActions-BbmyFeSk.js} +114 -76
  14. package/output/PageActions-BbmyFeSk.js.map +1 -0
  15. package/output/{PageActions-ob2OJusG.cjs → PageActions-DxGK-444.cjs} +119 -75
  16. package/output/PageActions-DxGK-444.cjs.map +1 -0
  17. package/output/{SearchDialog-89JAjQMh.js → SearchDialog-4oEbmVMR.js} +29 -20
  18. package/output/SearchDialog-4oEbmVMR.js.map +1 -0
  19. package/output/{SearchDialog-CTiUIKeo.cjs → SearchDialog-DexOW8E4.cjs} +29 -20
  20. package/output/SearchDialog-DexOW8E4.cjs.map +1 -0
  21. package/output/app/AppShell.d.ts +1 -2
  22. package/output/app/BuiltInNotFoundPage.d.ts +1 -0
  23. package/output/app/PageActions.d.ts +0 -1
  24. package/output/client.cjs +3 -3
  25. package/output/client.js +3 -3
  26. package/output/context.d.ts +2 -1
  27. package/output/core/context.d.ts +9 -0
  28. package/output/core/types.d.ts +4 -0
  29. package/output/{i18n-Cjfk1N7i.cjs → i18n-BuvwT5W9.cjs} +38 -3
  30. package/output/i18n-BuvwT5W9.cjs.map +1 -0
  31. package/output/{i18n-Cff810G_.js → i18n-C6tIP-nl.js} +26 -3
  32. package/output/i18n-C6tIP-nl.js.map +1 -0
  33. package/output/index.cjs +11 -7
  34. package/output/index.cjs.map +1 -1
  35. package/output/index.d.ts +3 -2
  36. package/output/index.js +8 -8
  37. package/output/index.js.map +1 -1
  38. package/output/openapi/lib/api-exchange.d.ts +2 -0
  39. package/output/preview.cjs +6 -6
  40. package/output/preview.cjs.map +1 -1
  41. package/output/preview.js +6 -6
  42. package/output/preview.js.map +1 -1
  43. package/output/{render-B41PHjt8.js → render-CAtVGsQF.js} +2 -2
  44. package/output/{render-B41PHjt8.js.map → render-CAtVGsQF.js.map} +1 -1
  45. package/output/{render-BxiVlY6q.cjs → render-D8h-jcnw.cjs} +2 -2
  46. package/output/{render-BxiVlY6q.cjs.map → render-D8h-jcnw.cjs.map} +1 -1
  47. package/output/renderer.css +4 -0
  48. package/output/server.cjs +2 -2
  49. package/output/server.js +2 -2
  50. package/output/shell/ContentActions.d.ts +0 -1
  51. package/output/shell/Header.d.ts +1 -2
  52. package/output/shell/Search.d.ts +3 -6
  53. package/output/shell/mobile.d.ts +1 -2
  54. package/output/shell/search/SearchDialog.d.ts +2 -1
  55. package/output/shell/search/pagefind.d.ts +3 -2
  56. package/output/theme/ThemeRoot.d.ts +0 -2
  57. package/output/theme/randomTheme.d.ts +2 -1
  58. package/output/utils/href.d.ts +2 -0
  59. package/package.json +1 -1
  60. package/output/ClarifyShell-CKvXZj0f.js.map +0 -1
  61. package/output/ClarifyShell-CukbPOAd.cjs.map +0 -1
  62. package/output/PageActions-DviEypf6.js.map +0 -1
  63. package/output/PageActions-ob2OJusG.cjs.map +0 -1
  64. package/output/SearchDialog-89JAjQMh.js.map +0 -1
  65. package/output/SearchDialog-CTiUIKeo.cjs.map +0 -1
  66. package/output/i18n-Cff810G_.js.map +0 -1
  67. package/output/i18n-Cjfk1N7i.cjs.map +0 -1
@@ -1,14 +1,14 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
2
- const require_i18n = require("./i18n-Cjfk1N7i.cjs");
3
- const require_PageActions = require("./PageActions-ob2OJusG.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);
7
7
  let react = require("react");
8
8
  let react_router_dom = require("react-router-dom");
9
+ let react_jsx_runtime = require("react/jsx-runtime");
9
10
  let _headlessui_react = require("@headlessui/react");
10
11
  let lucide_react = require("lucide-react");
11
- let react_jsx_runtime = require("react/jsx-runtime");
12
12
  let framer_motion = require("framer-motion");
13
13
  let zustand = require("zustand");
14
14
  let react_markdown = require("react-markdown");
@@ -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-FOg263MO.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);
@@ -5490,6 +5554,7 @@ function EndpointIdentity(arg0) {
5490
5554
  }
5491
5555
  function OpenApiOperation(arg0) {
5492
5556
  const { spec, path, method, operation, operationSource = "path" } = arg0;
5557
+ const playgroundEnabled = require_i18n.useConfigOptional()?.features.openapi.playground ?? true;
5493
5558
  const id = getOpenApiOperationSectionId(operation);
5494
5559
  const summary = operation.summary ?? `${method} ${path}`;
5495
5560
  const description = operation.description;
@@ -5519,9 +5584,9 @@ function OpenApiOperation(arg0) {
5519
5584
  onSelectServer: serverState.onSelectServer,
5520
5585
  onChangeServerVariable: serverState.onChangeServerVariable,
5521
5586
  onToggleServer: serverState.onToggleServer,
5522
- onTryRequest: () => setRequestOpen(true)
5587
+ onTryRequest: playgroundEnabled ? () => setRequestOpen(true) : void 0
5523
5588
  }),
5524
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiRequestDialog, {
5589
+ playgroundEnabled ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OpenApiRequestDialog, {
5525
5590
  open: requestOpen,
5526
5591
  onClose: () => setRequestOpen(false),
5527
5592
  spec,
@@ -5529,7 +5594,7 @@ function OpenApiOperation(arg0) {
5529
5594
  method,
5530
5595
  operation,
5531
5596
  operationSource
5532
- }),
5597
+ }) : null,
5533
5598
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointRequest, {
5534
5599
  spec,
5535
5600
  path,
@@ -5804,4 +5869,4 @@ Object.defineProperty(exports, "primitives_exports", {
5804
5869
  }
5805
5870
  });
5806
5871
 
5807
- //# sourceMappingURL=OpenApiOperation-c-I6Nw9j.cjs.map
5872
+ //# sourceMappingURL=OpenApiOperation-DIgbzvk5.cjs.map