@clarify-labs/renderer 0.4.0 → 0.5.0

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 (97) hide show
  1. package/output/AppShell-D3FsVHQK.js +390 -0
  2. package/output/AppShell-D3FsVHQK.js.map +1 -0
  3. package/output/AppShell-DeaJ-rgo.cjs +409 -0
  4. package/output/AppShell-DeaJ-rgo.cjs.map +1 -0
  5. package/output/OpenApiOperation-DYXG-6Rw.js +1772 -0
  6. package/output/OpenApiOperation-DYXG-6Rw.js.map +1 -0
  7. package/output/OpenApiOperation-mhoi-s4N.cjs +1840 -0
  8. package/output/OpenApiOperation-mhoi-s4N.cjs.map +1 -0
  9. package/output/app/PageNavigation.d.ts +7 -0
  10. package/output/app/PageSkeleton.d.ts +1 -0
  11. package/output/{components → app}/SectionProvider.d.ts +3 -2
  12. package/output/chunk-DakpK96I.cjs +43 -0
  13. package/output/client.cjs +1 -1
  14. package/output/client.js +1 -1
  15. package/output/components/Button.d.ts +18 -0
  16. package/output/components/Code.d.ts +11 -7
  17. package/output/components/Collapse.d.ts +9 -0
  18. package/output/components/Heading.d.ts +10 -0
  19. package/output/components/Logo.d.ts +2 -0
  20. package/output/components/Prose.d.ts +7 -0
  21. package/output/components/Tag.d.ts +34 -0
  22. package/output/components/index.d.ts +9 -80
  23. package/output/components/patterns.d.ts +4 -2
  24. package/output/context.d.ts +1 -8
  25. package/output/core/context.d.ts +8 -0
  26. package/output/core/i18n.d.ts +5 -0
  27. package/output/core/index.d.ts +3 -0
  28. package/output/core/types.d.ts +174 -0
  29. package/output/i18n.d.ts +1 -5
  30. package/output/index.cjs +105 -1741
  31. package/output/index.cjs.map +1 -1
  32. package/output/index.d.ts +15 -4
  33. package/output/index.js +71 -1719
  34. package/output/index.js.map +1 -1
  35. package/output/markdown.cjs +3 -0
  36. package/output/markdown.d.ts +1 -0
  37. package/output/markdown.js +2 -0
  38. package/output/mdx/DocShell.d.ts +7 -0
  39. package/output/mdx/Markdown.d.ts +7 -0
  40. package/output/mdx/components.d.ts +7 -7
  41. package/output/mdx/primitives.d.ts +18 -12
  42. package/output/mdx/remark.d.ts +2 -0
  43. package/output/openapi/{example-panels.d.ts → components/ExamplePanels.d.ts} +14 -9
  44. package/output/openapi/components/OpenApiOperation.d.ts +33 -0
  45. package/output/openapi/components/SchemaProperties.d.ts +20 -0
  46. package/output/openapi/entry.d.ts +13 -0
  47. package/output/openapi/index.d.ts +3 -3
  48. package/output/openapi/{helpers.d.ts → lib/helpers.d.ts} +7 -6
  49. package/output/openapi/{request-code.d.ts → lib/request-code.d.ts} +7 -5
  50. package/output/openapi/types.d.ts +5 -1
  51. package/output/preview/openapi.d.ts +28 -0
  52. package/output/preview.cjs +734 -0
  53. package/output/preview.cjs.map +1 -0
  54. package/output/preview.d.ts +19 -0
  55. package/output/preview.js +731 -0
  56. package/output/preview.js.map +1 -0
  57. package/output/remark-DNOdJz5i.cjs +14 -0
  58. package/output/remark-DNOdJz5i.cjs.map +1 -0
  59. package/output/remark-o5sg9Ilv.js +7 -0
  60. package/output/remark-o5sg9Ilv.js.map +1 -0
  61. package/output/{render-BCiQn6Q1.js → render-BpavVnAe.js} +3 -2
  62. package/output/render-BpavVnAe.js.map +1 -0
  63. package/output/{render-CZsdzmme.cjs → render-CjZt3edL.cjs} +6 -5
  64. package/output/render-CjZt3edL.cjs.map +1 -0
  65. package/output/renderer.css +403 -63
  66. package/output/server.cjs +7 -5
  67. package/output/server.cjs.map +1 -1
  68. package/output/server.js +4 -2
  69. package/output/server.js.map +1 -1
  70. package/output/shell/Navigation.d.ts +3 -2
  71. package/output/shell/Search.d.ts +6 -4
  72. package/output/{components → shell}/SiteLogo.d.ts +1 -1
  73. package/output/shell/icons.d.ts +3 -2
  74. package/output/shell/mobile.d.ts +3 -2
  75. package/output/{AppShell-nQnuKyn2.js → shell-BlMMdTpZ.js} +1118 -1320
  76. package/output/shell-BlMMdTpZ.js.map +1 -0
  77. package/output/{AppShell-CZw1MrPG.cjs → shell-_MyLsMUI.cjs} +1192 -1394
  78. package/output/shell-_MyLsMUI.cjs.map +1 -0
  79. package/output/{components → theme}/ThemeProvider.d.ts +3 -2
  80. package/output/types.d.ts +1 -174
  81. package/output/utils/clipboard.d.ts +1 -0
  82. package/output/utils/hash.d.ts +1 -0
  83. package/output/utils/href.d.ts +5 -0
  84. package/output/utils/lucide.d.ts +17 -0
  85. package/package.json +15 -2
  86. package/output/AppShell-CZw1MrPG.cjs.map +0 -1
  87. package/output/AppShell-nQnuKyn2.js.map +0 -1
  88. package/output/components/PageNavigation.d.ts +0 -5
  89. package/output/openapi/openapi-page.d.ts +0 -19
  90. package/output/openapi/schema-properties.d.ts +0 -15
  91. package/output/render-BCiQn6Q1.js.map +0 -1
  92. package/output/render-CZsdzmme.cjs.map +0 -1
  93. /package/output/{components → app}/BuiltWithClarify.d.ts +0 -0
  94. /package/output/{components → app}/PageFooter.d.ts +0 -0
  95. /package/output/openapi/{spec-path.d.ts → lib/spec-path.d.ts} +0 -0
  96. /package/output/openapi/{utils.d.ts → lib/utils.d.ts} +0 -0
  97. /package/output/{components → theme}/ThemeToggle.d.ts +0 -0
@@ -0,0 +1,731 @@
1
+ import { a as authPlaceholder, c as getServerKey, d as getRequestBody, i as ResponseExamplesPanel, l as getServers, o as defaultServerVariables, r as RequestExamplesPanel, s as getAuthOptions, t as EndpointIdentity, u as getMediaTypeEntries } from "./OpenApiOperation-DYXG-6Rw.js";
2
+ import { F as OpenApisContext, N as ClarifyConfigContext, P as ClarifyLocaleContext, n as Navigation, y as SectionProvider } from "./shell-BlMMdTpZ.js";
3
+ import { useState } from "react";
4
+ import { MemoryRouter } from "react-router-dom";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ //#region source/preview/openapi.tsx
7
+ function schemaFromType(type) {
8
+ if (type.endsWith("[]")) return {
9
+ type: "array",
10
+ items: schemaFromType(type.slice(0, -2))
11
+ };
12
+ if (type === "number" || type === "integer" || type === "boolean" || type === "object") return { type };
13
+ return { type: "string" };
14
+ }
15
+ function parseResponseExample(endpoint) {
16
+ if (typeof endpoint.responseExample !== "undefined") return endpoint.responseExample;
17
+ if (!endpoint.response) return void 0;
18
+ try {
19
+ return JSON.parse(endpoint.response);
20
+ } catch {
21
+ return endpoint.response;
22
+ }
23
+ }
24
+ function inferSchemaFromExample(example) {
25
+ if (Array.isArray(example)) return {
26
+ type: "array",
27
+ items: inferSchemaFromExample(example[0]) ?? { type: "object" }
28
+ };
29
+ if (typeof example === "object" && example !== null) return {
30
+ type: "object",
31
+ properties: Object.fromEntries(Object.entries(example).map(([key, value]) => [key, inferSchemaFromExample(value)]))
32
+ };
33
+ if (typeof example === "number") return { type: Number.isInteger(example) ? "integer" : "number" };
34
+ if (typeof example === "boolean") return { type: "boolean" };
35
+ return typeof example === "undefined" ? void 0 : { type: "string" };
36
+ }
37
+ function normalizeParameterLocation(location) {
38
+ return location === "route" ? "path" : location;
39
+ }
40
+ function toOpenApiParameter(parameter) {
41
+ return {
42
+ name: parameter.name,
43
+ in: normalizeParameterLocation(parameter.in),
44
+ required: parameter.required,
45
+ description: parameter.description,
46
+ schema: parameter.schema ?? schemaFromType(parameter.type)
47
+ };
48
+ }
49
+ function createPreviewOpenApi(endpoint) {
50
+ const method = endpoint.method.toLowerCase();
51
+ const parameters = (endpoint.parameters ?? []).map(toOpenApiParameter);
52
+ const responseExample = parseResponseExample(endpoint);
53
+ const responseSchema = endpoint.responseSchema ?? inferSchemaFromExample(responseExample);
54
+ const requestSchema = endpoint.requestSchema ?? inferSchemaFromExample(endpoint.requestExample);
55
+ const operation = {
56
+ summary: endpoint.summary,
57
+ description: endpoint.description,
58
+ parameters,
59
+ requestBody: requestSchema ? {
60
+ description: endpoint.requestDescription,
61
+ required: true,
62
+ content: { "application/json": {
63
+ schema: requestSchema,
64
+ example: endpoint.requestExample
65
+ } }
66
+ } : void 0,
67
+ responses: { [endpoint.responseStatus ?? "200"]: {
68
+ description: endpoint.responseDescription ?? "OK",
69
+ content: { "application/json": {
70
+ schema: responseSchema,
71
+ example: responseExample
72
+ } }
73
+ } }
74
+ };
75
+ return {
76
+ operation,
77
+ spec: {
78
+ openapi: "3.1.0",
79
+ info: {
80
+ title: "Clarify Build API",
81
+ version: "2026-06-20",
82
+ description: "API reference generated from OpenAPI and rendered as static documentation."
83
+ },
84
+ servers: [{
85
+ url: "https://server",
86
+ description: "Production"
87
+ }, {
88
+ url: "https://test-server",
89
+ description: "Test"
90
+ }],
91
+ components: { securitySchemes: { bearerAuth: {
92
+ type: "http",
93
+ scheme: "bearer",
94
+ bearerFormat: "JWT"
95
+ } } },
96
+ security: [{ bearerAuth: [] }],
97
+ paths: { [endpoint.path]: { [method]: operation } }
98
+ },
99
+ parameters
100
+ };
101
+ }
102
+ function OpenApiExamplesPreview(arg0) {
103
+ const { endpoint } = arg0;
104
+ const { operation, spec, parameters } = createPreviewOpenApi(endpoint);
105
+ const method = endpoint.method.toUpperCase();
106
+ const requestContents = getMediaTypeEntries(getRequestBody(spec, operation)?.content, spec);
107
+ const [selectedRequestMediaType, setSelectedRequestMediaType] = useState(requestContents[0]?.mediaType ?? "");
108
+ const selectedRequestContent = requestContents.find((content) => content.mediaType === selectedRequestMediaType) ?? requestContents[0];
109
+ const servers = getServers(spec, operation, endpoint.path);
110
+ const [selectedServerKey, setSelectedServerKey] = useState(getServerKey(servers[0], 0));
111
+ const selectedServer = servers.find((server, index) => getServerKey(server, index) === selectedServerKey) ?? servers[0];
112
+ const [serverVariables, setServerVariables] = useState(defaultServerVariables(selectedServer));
113
+ const [serverOpen, setServerOpen] = useState(false);
114
+ const authOptions = getAuthOptions(spec, operation);
115
+ const [selectedAuthName, setSelectedAuthName] = useState(authOptions[0]?.name ?? "");
116
+ const selectedAuth = authOptions.find((option) => option.name === selectedAuthName);
117
+ const [authValues, setAuthValues] = useState({});
118
+ const [authOpen, setAuthOpen] = useState(false);
119
+ const authInput = selectedAuth ? {
120
+ name: selectedAuth.name,
121
+ scheme: selectedAuth.scheme,
122
+ value: authValues[selectedAuth.name] ?? authPlaceholder(selectedAuth)
123
+ } : void 0;
124
+ return /* @__PURE__ */ jsxs("div", {
125
+ className: "space-y-4",
126
+ children: [/* @__PURE__ */ jsx(EndpointIdentity, {
127
+ method,
128
+ path: endpoint.path,
129
+ servers,
130
+ selectedServerKey,
131
+ selectedServer,
132
+ serverVariables,
133
+ serverOpen,
134
+ authOptions,
135
+ selectedAuthName,
136
+ selectedAuth,
137
+ authValues,
138
+ authOpen,
139
+ onSelectServer: (value) => {
140
+ const nextServer = servers.find((server, index) => getServerKey(server, index) === value) ?? servers[0];
141
+ setSelectedServerKey(value);
142
+ setServerVariables(defaultServerVariables(nextServer));
143
+ },
144
+ onChangeServerVariable: (name, value) => setServerVariables((current) => ({
145
+ ...current,
146
+ [name]: value
147
+ })),
148
+ onToggleServer: () => {
149
+ setServerOpen((current) => !current);
150
+ setAuthOpen(false);
151
+ },
152
+ onToggleAuth: () => {
153
+ setAuthOpen((current) => !current);
154
+ setServerOpen(false);
155
+ },
156
+ onSelectAuth: setSelectedAuthName,
157
+ onChangeAuthValue: (name, value) => setAuthValues((current) => ({
158
+ ...current,
159
+ [name]: value
160
+ }))
161
+ }), /* @__PURE__ */ jsxs("div", {
162
+ className: "grid min-w-0 gap-4 lg:grid-cols-2",
163
+ children: [/* @__PURE__ */ jsx(RequestExamplesPanel, {
164
+ spec,
165
+ path: endpoint.path,
166
+ method,
167
+ parameters,
168
+ requestContents,
169
+ selectedMediaType: selectedRequestContent?.mediaType ?? "",
170
+ onSelectMediaType: setSelectedRequestMediaType,
171
+ selectedServer,
172
+ serverVariables,
173
+ auth: authInput
174
+ }), /* @__PURE__ */ jsx(ResponseExamplesPanel, {
175
+ operation,
176
+ spec
177
+ })]
178
+ })]
179
+ });
180
+ }
181
+ //#endregion
182
+ //#region source/preview.tsx
183
+ var embeddedEndpoint = {
184
+ method: "GET",
185
+ path: "/examples/basic-request",
186
+ summary: "Basic request",
187
+ description: "Rendered from api.openapi.json inside the MDX guide.",
188
+ parameters: [
189
+ {
190
+ name: "cursor",
191
+ in: "query",
192
+ type: "string",
193
+ description: "Start after this cursor."
194
+ },
195
+ {
196
+ name: "limit",
197
+ in: "query",
198
+ type: "integer",
199
+ description: "Max items to return."
200
+ },
201
+ {
202
+ name: "X-Trace-Id",
203
+ in: "header",
204
+ type: "string",
205
+ description: "Optional request trace."
206
+ }
207
+ ],
208
+ responseDescription: "A page of example records.",
209
+ responseSchema: {
210
+ type: "object",
211
+ required: ["items"],
212
+ properties: {
213
+ items: {
214
+ type: "array",
215
+ items: { type: "object" }
216
+ },
217
+ next: { type: "string" }
218
+ }
219
+ },
220
+ responseExample: {
221
+ items: [],
222
+ next: "cursor_2"
223
+ }
224
+ };
225
+ var embeddedGuide = {
226
+ label: "source/en-US/openapi/embedding.mdx",
227
+ title: "Embed OpenAPI in MDX",
228
+ body: "Use MDX for workflow context, then render the exact operation from the spec.",
229
+ embed: "<OpenApiOperation specPath=\"/api\" path=\"/examples/basic-request\" method=\"get\" />",
230
+ outputs: [
231
+ "/openapi/embedding",
232
+ "/api",
233
+ "/api.openapi.json",
234
+ "/llms.txt"
235
+ ]
236
+ };
237
+ var staticOutputEndpoint = {
238
+ method: "POST",
239
+ path: "/api/{id}/path",
240
+ summary: "Create static build",
241
+ description: "Build static docs from MDX and OpenAPI sources.",
242
+ parameters: [{
243
+ name: "id",
244
+ in: "path",
245
+ type: "string",
246
+ required: true,
247
+ description: "Project ID."
248
+ }],
249
+ responseDescription: "Build metadata and static outputs.",
250
+ responseSchema: {
251
+ type: "object",
252
+ required: [
253
+ "id",
254
+ "status",
255
+ "outputs"
256
+ ],
257
+ properties: {
258
+ id: {
259
+ type: "string",
260
+ description: "Build identifier."
261
+ },
262
+ status: {
263
+ type: "string",
264
+ enum: [
265
+ "queued",
266
+ "running",
267
+ "ready"
268
+ ],
269
+ description: "Current build state."
270
+ },
271
+ outputs: {
272
+ type: "array",
273
+ description: "Generated static artifacts.",
274
+ items: {
275
+ type: "object",
276
+ required: ["path", "kind"],
277
+ properties: {
278
+ path: { type: "string" },
279
+ kind: {
280
+ type: "string",
281
+ enum: [
282
+ "html",
283
+ "asset",
284
+ "openapi",
285
+ "llms"
286
+ ]
287
+ }
288
+ }
289
+ }
290
+ }
291
+ }
292
+ },
293
+ requestDescription: "Static build options.",
294
+ requestSchema: {
295
+ type: "object",
296
+ required: ["source", "output"],
297
+ properties: {
298
+ source: {
299
+ type: "string",
300
+ description: "MDX source root."
301
+ },
302
+ output: {
303
+ type: "string",
304
+ description: "Static output root."
305
+ },
306
+ includeSearchIndex: {
307
+ type: "boolean",
308
+ description: "Generate search data."
309
+ }
310
+ }
311
+ },
312
+ requestExample: {
313
+ source: "source",
314
+ output: "output",
315
+ includeSearchIndex: true
316
+ },
317
+ responseExample: {
318
+ id: "build_01HY",
319
+ status: "ready",
320
+ outputs: [
321
+ {
322
+ path: "/openapi/index.html",
323
+ kind: "html"
324
+ },
325
+ {
326
+ path: "/api.openapi.json",
327
+ kind: "openapi"
328
+ },
329
+ {
330
+ path: "/llms.txt",
331
+ kind: "llms"
332
+ }
333
+ ]
334
+ }
335
+ };
336
+ var previewConfig = {
337
+ title: "Clarify preview",
338
+ description: "Renderer preview environment",
339
+ rootDirectory: "source",
340
+ routePrefix: "/",
341
+ outputDirectory: "output",
342
+ theme: {
343
+ preset: "default",
344
+ tokens: {
345
+ colors: {
346
+ primary: "#2563eb",
347
+ accent: "#60a5fa",
348
+ background: "#ffffff",
349
+ foreground: "#18181b",
350
+ surface: "#ffffff",
351
+ muted: "#71717a",
352
+ border: "rgb(24 24 27 / 0.1)",
353
+ codeBackground: "#f4f4f5"
354
+ },
355
+ radius: {
356
+ sm: "0.375rem",
357
+ md: "0.5rem",
358
+ lg: "0.75rem",
359
+ xl: "1rem"
360
+ }
361
+ },
362
+ layout: { maxWidth: "88rem" }
363
+ },
364
+ i18n: {
365
+ defaultLocale: "en",
366
+ missing: "fallback",
367
+ locales: [{
368
+ code: "en",
369
+ label: "English"
370
+ }]
371
+ }
372
+ };
373
+ var methodStyles = {
374
+ GET: "bg-emerald-400/15 text-emerald-600 dark:bg-emerald-400/20 dark:text-emerald-300",
375
+ POST: "bg-sky-400/15 text-sky-600 dark:bg-sky-400/20 dark:text-sky-300",
376
+ PUT: "bg-amber-400/15 text-amber-600 dark:bg-amber-400/20 dark:text-amber-300",
377
+ PATCH: "bg-amber-400/15 text-amber-600 dark:bg-amber-400/20 dark:text-amber-300",
378
+ DELETE: "bg-rose-400/15 text-rose-600 dark:bg-rose-400/20 dark:text-rose-300"
379
+ };
380
+ var mainPreviewPath = "/openapi/embedding";
381
+ var mainPreviewSections = [{
382
+ id: "overview",
383
+ title: "Overview"
384
+ }, {
385
+ id: "request-example",
386
+ title: "Request example"
387
+ }];
388
+ function PreviewEnvironment(arg0) {
389
+ const { children, initialEntry = "/preview", sections = [] } = arg0;
390
+ return /* @__PURE__ */ jsx(MemoryRouter, {
391
+ initialEntries: [initialEntry],
392
+ children: /* @__PURE__ */ jsx(ClarifyConfigContext.Provider, {
393
+ value: previewConfig,
394
+ children: /* @__PURE__ */ jsx(ClarifyLocaleContext.Provider, {
395
+ value: previewConfig.i18n.defaultLocale,
396
+ children: /* @__PURE__ */ jsx(OpenApisContext.Provider, {
397
+ value: {},
398
+ children: /* @__PURE__ */ jsx(SectionProvider, {
399
+ sections,
400
+ children
401
+ })
402
+ })
403
+ })
404
+ })
405
+ });
406
+ }
407
+ function Chrome(arg0) {
408
+ const { title, status, children } = arg0;
409
+ return /* @__PURE__ */ jsxs("div", {
410
+ className: "clarify-app clarify-preview h-full overflow-hidden bg-(--clarify-theme-tokens-colors-background) text-(--clarify-ui-text) shadow-2xl ring-1 ring-(--clarify-theme-tokens-colors-border) dark:bg-zinc-950 dark:text-white dark:ring-white/10",
411
+ children: [/* @__PURE__ */ jsxs("div", {
412
+ className: "flex items-center gap-3 border-b border-(--clarify-theme-tokens-colors-border) px-4 py-3 text-xs/6 text-(--clarify-ui-text-faint) dark:border-white/10",
413
+ children: [
414
+ /* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-rose-400" }),
415
+ /* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-amber-400" }),
416
+ /* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-emerald-400" }),
417
+ /* @__PURE__ */ jsx("span", {
418
+ className: "ml-2 truncate font-medium text-(--clarify-ui-text-soft)",
419
+ children: title
420
+ }),
421
+ status ? /* @__PURE__ */ jsx("span", {
422
+ className: "ml-auto hidden rounded-full bg-emerald-400/15 px-2 py-0.5 font-medium text-emerald-700 sm:inline dark:text-emerald-300",
423
+ children: status
424
+ }) : null
425
+ ]
426
+ }), children]
427
+ });
428
+ }
429
+ function MethodBadge(arg0) {
430
+ const method = arg0.method.toUpperCase();
431
+ return /* @__PURE__ */ jsx("span", {
432
+ className: `rounded-md px-2.5 py-0.5 text-xs/6 font-black tracking-wide ${methodStyles[method] ?? "bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text-soft)"}`,
433
+ children: method
434
+ });
435
+ }
436
+ function createPreviewNavigation(arg0) {
437
+ const { endpoint, guide, outputs } = arg0;
438
+ return [
439
+ {
440
+ title: "Guides",
441
+ path: "/guides",
442
+ icon: "BookOpenText",
443
+ children: [{
444
+ title: guide?.title ?? "MDX guide",
445
+ path: mainPreviewPath,
446
+ icon: "FileText"
447
+ }, {
448
+ title: "Getting started",
449
+ path: "/getting-started",
450
+ icon: "Rocket"
451
+ }]
452
+ },
453
+ {
454
+ title: "API Reference",
455
+ path: "/api",
456
+ icon: "Braces",
457
+ children: [{
458
+ title: endpoint.summary,
459
+ path: endpoint.path,
460
+ icon: "Cable"
461
+ }, {
462
+ title: "Generate static output",
463
+ path: staticOutputEndpoint.path,
464
+ icon: "UploadCloud"
465
+ }]
466
+ },
467
+ {
468
+ title: "Build Output",
469
+ path: "/output",
470
+ icon: "PackageCheck",
471
+ children: [{
472
+ title: `Routes (${outputs.length})`,
473
+ path: "/output/routes",
474
+ icon: "ListTree"
475
+ }]
476
+ }
477
+ ];
478
+ }
479
+ function PreviewNavigation(arg0) {
480
+ return /* @__PURE__ */ jsx(Navigation, {
481
+ navigation: createPreviewNavigation(arg0),
482
+ className: "px-2"
483
+ });
484
+ }
485
+ function PreviewMetricGrid(arg0) {
486
+ const { metrics } = arg0;
487
+ return /* @__PURE__ */ jsx("div", {
488
+ className: "grid grid-cols-3 gap-2",
489
+ children: metrics.map((metric) => /* @__PURE__ */ jsxs("div", {
490
+ className: "rounded-xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-2.5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50",
491
+ children: [
492
+ /* @__PURE__ */ jsx("div", {
493
+ className: "text-xs/5 text-(--clarify-ui-text-faint)",
494
+ children: metric.label
495
+ }),
496
+ /* @__PURE__ */ jsx("div", {
497
+ className: "text-base/6 font-semibold text-(--clarify-ui-text-strong)",
498
+ children: metric.value
499
+ }),
500
+ metric.hint ? /* @__PURE__ */ jsx("div", {
501
+ className: "text-xs/5 text-(--clarify-ui-text-faint)",
502
+ children: metric.hint
503
+ }) : null
504
+ ]
505
+ }, metric.label))
506
+ });
507
+ }
508
+ function PreviewLabel(arg0) {
509
+ return /* @__PURE__ */ jsx("div", {
510
+ className: "text-xs/5 font-semibold uppercase tracking-wider text-(--clarify-ui-text-faint)",
511
+ children: arg0.children
512
+ });
513
+ }
514
+ function GuideSummaryPreview(arg0) {
515
+ const { guide } = arg0;
516
+ return /* @__PURE__ */ jsxs("header", {
517
+ className: "border-b border-(--clarify-theme-tokens-colors-border) pb-4 dark:border-white/10",
518
+ children: [
519
+ /* @__PURE__ */ jsx(PreviewLabel, { children: guide.label }),
520
+ /* @__PURE__ */ jsx("h2", {
521
+ className: "mt-1 text-xl/7 font-semibold tracking-tight text-(--clarify-ui-text-strong)",
522
+ children: guide.title
523
+ }),
524
+ /* @__PURE__ */ jsx("p", {
525
+ className: "mt-2 max-w-2xl text-sm/6 text-(--clarify-ui-text-soft)",
526
+ children: guide.body
527
+ }),
528
+ /* @__PURE__ */ jsx("pre", {
529
+ className: "mt-3 overflow-hidden rounded-xl bg-zinc-950 px-3 py-2 text-xs/5 whitespace-pre-wrap text-zinc-300",
530
+ children: guide.embed
531
+ })
532
+ ]
533
+ });
534
+ }
535
+ function EndpointSummaryPreview(arg0) {
536
+ const { endpoint } = arg0;
537
+ return /* @__PURE__ */ jsxs("div", {
538
+ className: "min-w-0",
539
+ children: [
540
+ /* @__PURE__ */ jsxs("div", {
541
+ className: "flex flex-wrap items-center gap-3",
542
+ children: [/* @__PURE__ */ jsx(MethodBadge, { method: endpoint.method }), /* @__PURE__ */ jsx("code", {
543
+ className: "text-sm font-medium text-(--clarify-ui-text)",
544
+ children: endpoint.path
545
+ })]
546
+ }),
547
+ /* @__PURE__ */ jsx("h3", {
548
+ className: "mt-3 text-lg/7 font-semibold tracking-tight text-(--clarify-ui-text-strong)",
549
+ children: endpoint.summary
550
+ }),
551
+ /* @__PURE__ */ jsx("p", {
552
+ className: "mt-1 text-sm/6 text-(--clarify-ui-text-soft)",
553
+ children: endpoint.description
554
+ })
555
+ ]
556
+ });
557
+ }
558
+ function EmbeddedApiPreview(arg0) {
559
+ const { endpoint } = arg0;
560
+ return /* @__PURE__ */ jsx("div", {
561
+ className: "clarify-preview-api-frame min-w-0 overflow-hidden border-t border-(--clarify-theme-tokens-colors-border) pt-4 dark:border-white/10",
562
+ children: /* @__PURE__ */ jsx("div", {
563
+ className: "clarify-preview-api-content clarify-preview-api-content-embedded",
564
+ children: /* @__PURE__ */ jsx(OpenApiExamplesPreview, { endpoint })
565
+ })
566
+ });
567
+ }
568
+ function OutputListPreview(arg0) {
569
+ const { outputs } = arg0;
570
+ return /* @__PURE__ */ jsxs("div", {
571
+ className: "border-t border-(--clarify-theme-tokens-colors-border) pt-4 dark:border-white/10",
572
+ children: [/* @__PURE__ */ jsx(PreviewLabel, { children: "Static output" }), /* @__PURE__ */ jsx("div", {
573
+ className: "mt-3 grid gap-2 sm:grid-cols-2 xl:grid-cols-4",
574
+ children: outputs.map((output) => /* @__PURE__ */ jsxs("div", {
575
+ className: "flex items-center gap-2 rounded-lg bg-(--clarify-ui-subtle-background) px-3 py-2 text-xs/5 text-(--clarify-ui-text-soft) dark:bg-white/5",
576
+ children: [/* @__PURE__ */ jsx("span", { className: "size-1.5 rounded-full bg-emerald-400" }), /* @__PURE__ */ jsx("span", {
577
+ className: "truncate font-mono",
578
+ children: output
579
+ })]
580
+ }, output))
581
+ })]
582
+ });
583
+ }
584
+ function MainContentPreview() {
585
+ return /* @__PURE__ */ jsx("section", {
586
+ className: "min-w-0 bg-(--clarify-theme-tokens-colors-background) px-5 py-4 dark:bg-zinc-950",
587
+ children: /* @__PURE__ */ jsx("div", {
588
+ className: "clarify-preview-content-window overflow-hidden",
589
+ children: /* @__PURE__ */ jsxs("div", {
590
+ className: "space-y-4",
591
+ children: [
592
+ /* @__PURE__ */ jsx(GuideSummaryPreview, { guide: embeddedGuide }),
593
+ /* @__PURE__ */ jsx(PreviewMetricGrid, { metrics: [
594
+ {
595
+ label: "MDX",
596
+ value: "Guide",
597
+ hint: "context"
598
+ },
599
+ {
600
+ label: "Spec",
601
+ value: "OpenAPI",
602
+ hint: "source"
603
+ },
604
+ {
605
+ label: "Out",
606
+ value: "Static",
607
+ hint: "CDN"
608
+ }
609
+ ] }),
610
+ /* @__PURE__ */ jsxs("div", {
611
+ className: "clarify-preview-endpoint-grid grid gap-4",
612
+ children: [/* @__PURE__ */ jsx(EndpointSummaryPreview, { endpoint: embeddedEndpoint }), /* @__PURE__ */ jsx(EmbeddedApiPreview, { endpoint: embeddedEndpoint })]
613
+ }),
614
+ /* @__PURE__ */ jsx(OutputListPreview, { outputs: embeddedGuide.outputs ?? [] })
615
+ ]
616
+ })
617
+ })
618
+ });
619
+ }
620
+ function MainPreview() {
621
+ return /* @__PURE__ */ jsx(PreviewEnvironment, {
622
+ initialEntry: mainPreviewPath,
623
+ sections: mainPreviewSections,
624
+ children: /* @__PURE__ */ jsx(Chrome, {
625
+ title: "source/en-US/openapi/embedding.mdx",
626
+ status: "Rendered from OpenAPI + MDX",
627
+ children: /* @__PURE__ */ jsxs("div", {
628
+ className: "clarify-preview-shell grid",
629
+ children: [/* @__PURE__ */ jsx("aside", {
630
+ className: "border-r border-(--clarify-theme-tokens-colors-border) px-1 py-4 text-sm/7 dark:border-white/10 dark:bg-white/5",
631
+ children: /* @__PURE__ */ jsx(PreviewNavigation, {
632
+ endpoint: embeddedEndpoint,
633
+ guide: embeddedGuide,
634
+ outputs: embeddedGuide.outputs ?? []
635
+ })
636
+ }), /* @__PURE__ */ jsx(MainContentPreview, {})]
637
+ })
638
+ })
639
+ });
640
+ }
641
+ function MdxPreview() {
642
+ return /* @__PURE__ */ jsx(PreviewEnvironment, { children: /* @__PURE__ */ jsx(Chrome, {
643
+ title: "source/started/index.mdx",
644
+ status: "Rendered by renderer",
645
+ children: /* @__PURE__ */ jsx("div", {
646
+ className: "clarify-preview-body overflow-hidden bg-(--clarify-theme-tokens-colors-background) p-5 dark:bg-zinc-950",
647
+ children: /* @__PURE__ */ jsxs("article", {
648
+ className: "max-w-3xl text-sm/7 text-(--clarify-ui-text-soft)",
649
+ children: [
650
+ /* @__PURE__ */ jsx("div", {
651
+ className: "inline-flex rounded-full bg-(--clarify-ui-accent-background) px-3 py-1 text-xs/5 font-semibold text-(--clarify-ui-accent-text)",
652
+ children: "MDX page"
653
+ }),
654
+ /* @__PURE__ */ jsx("h2", {
655
+ className: "mt-3 text-2xl/8 font-semibold tracking-tight text-(--clarify-ui-text-strong)",
656
+ children: "Get Started"
657
+ }),
658
+ /* @__PURE__ */ jsx("p", {
659
+ className: "mt-3",
660
+ children: "Write pages in source/. Clarify turns MDX, config, and OpenAPI files into routes."
661
+ }),
662
+ /* @__PURE__ */ jsxs("div", {
663
+ className: "mt-5 rounded-2xl border border-(--clarify-ui-accent-border) bg-(--clarify-ui-accent-background) p-4 text-sm/6 text-(--clarify-ui-text-strong)",
664
+ children: [/* @__PURE__ */ jsx("div", {
665
+ className: "font-semibold text-(--clarify-ui-text-strong)",
666
+ children: "Static output ready"
667
+ }), /* @__PURE__ */ jsx("p", {
668
+ className: "mt-1",
669
+ children: "output/ is plain static files."
670
+ })]
671
+ }),
672
+ /* @__PURE__ */ jsxs("div", {
673
+ className: "mt-5 grid gap-4 sm:grid-cols-2",
674
+ children: [/* @__PURE__ */ jsxs("div", {
675
+ className: "rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50",
676
+ children: [/* @__PURE__ */ jsx("h3", {
677
+ className: "text-base/6 font-semibold text-(--clarify-ui-text-strong)",
678
+ children: "MDX pages"
679
+ }), /* @__PURE__ */ jsx("p", {
680
+ className: "mt-2 text-sm/6",
681
+ children: "Guides live beside code."
682
+ })]
683
+ }), /* @__PURE__ */ jsxs("div", {
684
+ className: "rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50",
685
+ children: [/* @__PURE__ */ jsx("h3", {
686
+ className: "text-base/6 font-semibold text-(--clarify-ui-text-strong)",
687
+ children: "API embeds"
688
+ }), /* @__PURE__ */ jsx("p", {
689
+ className: "mt-2 text-sm/6",
690
+ children: "Specs render inline."
691
+ })]
692
+ })]
693
+ }),
694
+ /* @__PURE__ */ jsxs("div", {
695
+ className: "mt-5 rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-5 shadow-sm dark:border-white/10 dark:bg-zinc-900/50",
696
+ children: [/* @__PURE__ */ jsxs("div", {
697
+ className: "flex items-center gap-3",
698
+ children: [/* @__PURE__ */ jsx(MethodBadge, { method: embeddedEndpoint.method }), /* @__PURE__ */ jsx("code", {
699
+ className: "text-sm font-medium text-(--clarify-ui-text)",
700
+ children: embeddedEndpoint.path
701
+ })]
702
+ }), /* @__PURE__ */ jsx("p", {
703
+ className: "mt-3 text-sm/6",
704
+ children: embeddedEndpoint.description
705
+ })]
706
+ })
707
+ ]
708
+ })
709
+ })
710
+ }) });
711
+ }
712
+ function OpenApiPreview() {
713
+ return /* @__PURE__ */ jsx(PreviewEnvironment, { children: /* @__PURE__ */ jsx(Chrome, {
714
+ title: "source/api.openapi.json",
715
+ status: "Endpoint + examples",
716
+ children: /* @__PURE__ */ jsx("div", {
717
+ className: "clarify-preview-openapi-window overflow-hidden bg-(--clarify-theme-tokens-colors-background) px-4 py-4 dark:bg-zinc-950",
718
+ children: /* @__PURE__ */ jsx("div", {
719
+ className: "clarify-preview-openapi-mask h-full overflow-hidden",
720
+ children: /* @__PURE__ */ jsx("div", {
721
+ className: "clarify-preview-api-content clarify-preview-api-content-openapi origin-top pb-10",
722
+ children: /* @__PURE__ */ jsx(OpenApiExamplesPreview, { endpoint: staticOutputEndpoint })
723
+ })
724
+ })
725
+ })
726
+ }) });
727
+ }
728
+ //#endregion
729
+ export { MainPreview, MdxPreview, OpenApiPreview };
730
+
731
+ //# sourceMappingURL=preview.js.map