@openpkg-ts/ui 0.3.2 → 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.
@@ -1,8 +1,6 @@
1
1
  "use client";
2
2
  // src/docskit/api/api-code-panel.tsx
3
- import { highlight, Pre } from "codehike/code";
4
- import { Check, Copy, ExternalLink } from "lucide-react";
5
- import { useEffect as useEffect2, useState as useState4 } from "react";
3
+ import { useState as useState5 } from "react";
6
4
 
7
5
  // src/lib/utils.ts
8
6
  import { clsx } from "clsx";
@@ -11,20 +9,41 @@ function cn(...inputs) {
11
9
  return twMerge(clsx(inputs));
12
10
  }
13
11
 
14
- // src/hooks/use-copy-to-clipboard.ts
15
- import { useCallback, useRef, useState } from "react";
16
- var COPY_FEEDBACK_MS = 1200;
17
- function useCopyToClipboard(timeout = COPY_FEEDBACK_MS) {
18
- const [copied, setCopied] = useState(false);
19
- const timerRef = useRef();
20
- const copy = useCallback((text) => {
21
- navigator.clipboard.writeText(text).then(() => {
22
- setCopied(true);
23
- clearTimeout(timerRef.current);
24
- timerRef.current = setTimeout(() => setCopied(false), timeout);
25
- });
26
- }, [timeout]);
27
- return [copied, copy];
12
+ // src/docskit/code.client-highlight.tsx
13
+ import {
14
+ highlight,
15
+ Inline,
16
+ Pre
17
+ } from "codehike/code";
18
+ import { useEffect, useState as useState3 } from "react";
19
+
20
+ // src/hooks/use-local-storage.ts
21
+ import React from "react";
22
+ function useStateOrLocalStorage(key, initialState) {
23
+ const [state, setState] = React.useState(initialState);
24
+ React.useLayoutEffect(() => {
25
+ if (!key)
26
+ return;
27
+ const storedValue = window.localStorage.getItem(key);
28
+ if (storedValue != null) {
29
+ setState(storedValue);
30
+ }
31
+ const onStorageChange = (e) => {
32
+ if (e.key === key) {
33
+ const storedValue2 = window.localStorage.getItem(key);
34
+ setState(storedValue2 || initialState);
35
+ }
36
+ };
37
+ window.addEventListener("storage", onStorageChange);
38
+ return () => window.removeEventListener("storage", onStorageChange);
39
+ }, [key, initialState]);
40
+ const setStorage = !key ? setState : (value) => {
41
+ if (typeof window !== "undefined") {
42
+ window.localStorage.setItem(key, value);
43
+ window.dispatchEvent(new StorageEvent("storage", { key }));
44
+ }
45
+ };
46
+ return [state, setStorage];
28
47
  }
29
48
 
30
49
  // src/docskit/code.config.ts
@@ -50,43 +69,77 @@ function flagsToOptions(flags = "") {
50
69
  return options;
51
70
  }
52
71
 
72
+ // src/docskit/code.copy.tsx
73
+ import { Check, Copy } from "lucide-react";
74
+ import { useState } from "react";
75
+ import { jsx } from "react/jsx-runtime";
76
+
77
+ function CopyButton({
78
+ text,
79
+ className,
80
+ variant = "floating"
81
+ }) {
82
+ const [copied, setCopied] = useState(false);
83
+ return /* @__PURE__ */ jsx("button", {
84
+ type: "button",
85
+ className: cn("cursor-pointer transition-opacity duration-200", variant === "floating" && [
86
+ "size-8 flex items-center justify-center",
87
+ "rounded border border-openpkg-code-border bg-openpkg-code-bg",
88
+ "opacity-0 group-hover:opacity-100"
89
+ ], variant === "inline" && "rounded", className),
90
+ onClick: () => {
91
+ navigator.clipboard.writeText(text);
92
+ setCopied(true);
93
+ setTimeout(() => setCopied(false), 1200);
94
+ },
95
+ "aria-label": "Copy to clipboard",
96
+ children: copied ? /* @__PURE__ */ jsx(Check, {
97
+ size: 16,
98
+ className: "block"
99
+ }) : /* @__PURE__ */ jsx(Copy, {
100
+ size: 16,
101
+ className: "block"
102
+ })
103
+ });
104
+ }
105
+
53
106
  // src/docskit/callout.tsx
54
107
  import { InnerLine } from "codehike/code";
55
108
 
56
109
  // src/docskit/notes.client.tsx
57
- import React from "react";
58
- import { jsx } from "react/jsx-runtime";
110
+ import React2 from "react";
111
+ import { jsx as jsx2 } from "react/jsx-runtime";
59
112
 
60
- var NotesContext = React.createContext([]);
113
+ var NotesContext = React2.createContext([]);
61
114
  function WithClientNotes({ children, notes }) {
62
- return /* @__PURE__ */ jsx(NotesContext.Provider, {
115
+ return /* @__PURE__ */ jsx2(NotesContext.Provider, {
63
116
  value: notes,
64
117
  children
65
118
  });
66
119
  }
67
120
  function useNotesContext(n) {
68
- return React.useContext(NotesContext).find(({ name }) => name === n);
121
+ return React2.useContext(NotesContext).find(({ name }) => name === n);
69
122
  }
70
123
 
71
124
  // src/docskit/callout.client.tsx
72
- import { jsx as jsx2 } from "react/jsx-runtime";
125
+ import { jsx as jsx3 } from "react/jsx-runtime";
73
126
 
74
127
  function CalloutClient({ name }) {
75
128
  const note = useNotesContext(name);
76
129
  if (note?.type === "code") {
77
- return /* @__PURE__ */ jsx2("div", {
130
+ return /* @__PURE__ */ jsx3("div", {
78
131
  className: "prose-no-margin [&>div]:!border-none [&>div]:!my-0 [&>div>pre]:!bg-transparent",
79
132
  children: note.children
80
133
  });
81
134
  }
82
- return /* @__PURE__ */ jsx2("div", {
135
+ return /* @__PURE__ */ jsx3("div", {
83
136
  className: "px-2 prose dark:prose-invert",
84
137
  children: note ? note.children : name
85
138
  });
86
139
  }
87
140
 
88
141
  // src/docskit/callout.tsx
89
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
142
+ import { jsx as jsx4, jsxs } from "react/jsx-runtime";
90
143
  var callout = {
91
144
  name: "callout",
92
145
  transform: (annotation) => {
@@ -115,16 +168,16 @@ var callout = {
115
168
  marginLeft: `${indentation}ch`,
116
169
  border: "1px solid var(--ch-23)"
117
170
  },
118
- className: "w-fit bg-dk-tabs-background rounded px-0 relative my-1 whitespace-break-spaces select-none",
171
+ className: "w-fit bg-openpkg-code-header rounded px-0 relative my-1 whitespace-break-spaces select-none",
119
172
  children: [
120
- /* @__PURE__ */ jsx3("div", {
173
+ /* @__PURE__ */ jsx4("div", {
121
174
  style: {
122
175
  left: `${column - indentation - 1}ch`,
123
176
  borderColor: "var(--ch-23)"
124
177
  },
125
- className: "absolute border-l border-t w-2 h-2 rotate-45 -translate-y-1/2 -top-[1px] bg-dk-tabs-background"
178
+ className: "absolute border-l border-t w-2 h-2 rotate-45 -translate-y-1/2 -top-[1px] bg-openpkg-code-header"
126
179
  }),
127
- /* @__PURE__ */ jsx3(CalloutClient, {
180
+ /* @__PURE__ */ jsx4(CalloutClient, {
128
181
  name: annotation.query
129
182
  })
130
183
  ]
@@ -136,17 +189,17 @@ var callout = {
136
189
 
137
190
  // src/docskit/code.line.tsx
138
191
  import { InnerLine as InnerLine2 } from "codehike/code";
139
- import { jsx as jsx4 } from "react/jsx-runtime";
192
+ import { jsx as jsx5 } from "react/jsx-runtime";
140
193
  var line = {
141
194
  name: "line",
142
195
  Line: ({ annotation, ...props }) => {
143
- return /* @__PURE__ */ jsx4("div", {
196
+ return /* @__PURE__ */ jsx5("div", {
144
197
  style: {
145
- borderLeftColor: "var(--dk-line-border, transparent)",
146
- backgroundColor: "var(--dk-line-bg, transparent)"
198
+ borderLeftColor: "var(--openpkg-line-border, transparent)",
199
+ backgroundColor: "var(--openpkg-line-bg, transparent)"
147
200
  },
148
201
  className: "flex border-l-2 border-l-transparent background-color 0.3s ease",
149
- children: /* @__PURE__ */ jsx4(InnerLine2, {
202
+ children: /* @__PURE__ */ jsx5(InnerLine2, {
150
203
  merge: props,
151
204
  className: "px-3 flex-1"
152
205
  })
@@ -160,10 +213,10 @@ import { ChevronDownIcon } from "lucide-react";
160
213
 
161
214
  // src/collapsible/collapsible.tsx
162
215
  import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
163
- import { jsx as jsx5 } from "react/jsx-runtime";
216
+ import { jsx as jsx6 } from "react/jsx-runtime";
164
217
 
165
218
  function Collapsible({ ...props }) {
166
- return /* @__PURE__ */ jsx5(CollapsiblePrimitive.Root, {
219
+ return /* @__PURE__ */ jsx6(CollapsiblePrimitive.Root, {
167
220
  "data-slot": "collapsible",
168
221
  ...props
169
222
  });
@@ -171,7 +224,7 @@ function Collapsible({ ...props }) {
171
224
  function CollapsibleTrigger2({
172
225
  ...props
173
226
  }) {
174
- return /* @__PURE__ */ jsx5(CollapsiblePrimitive.CollapsibleTrigger, {
227
+ return /* @__PURE__ */ jsx6(CollapsiblePrimitive.CollapsibleTrigger, {
175
228
  "data-slot": "collapsible-trigger",
176
229
  ...props
177
230
  });
@@ -179,14 +232,14 @@ function CollapsibleTrigger2({
179
232
  function CollapsibleContent2({
180
233
  ...props
181
234
  }) {
182
- return /* @__PURE__ */ jsx5(CollapsiblePrimitive.CollapsibleContent, {
235
+ return /* @__PURE__ */ jsx6(CollapsiblePrimitive.CollapsibleContent, {
183
236
  "data-slot": "collapsible-content",
184
237
  ...props
185
238
  });
186
239
  }
187
240
 
188
241
  // src/docskit/collapse.tsx
189
- import { jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
242
+ import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
190
243
  var collapseRoot = {
191
244
  name: "collapse",
192
245
  transform: (annotation) => {
@@ -207,22 +260,22 @@ var collapseRoot = {
207
260
  ];
208
261
  },
209
262
  Block: ({ annotation, children }) => {
210
- return /* @__PURE__ */ jsx6(Collapsible, {
263
+ return /* @__PURE__ */ jsx7(Collapsible, {
211
264
  defaultOpen: annotation.query !== "collapsed",
212
265
  children
213
266
  });
214
267
  }
215
268
  };
216
- var icon = /* @__PURE__ */ jsx6(ChevronDownIcon, {
269
+ var icon = /* @__PURE__ */ jsx7(ChevronDownIcon, {
217
270
  className: "inline-block group-data-[state=closed]:-rotate-90 transition select-none opacity-30 group-data-[state=closed]:opacity-80 group-hover:!opacity-100 mb-0.5 ml-1 -mr-1 ",
218
271
  size: 15
219
272
  });
220
273
  var collapseTrigger = {
221
274
  name: "CollapseTrigger",
222
275
  onlyIfAnnotated: true,
223
- AnnotatedLine: ({ annotation, ...props }) => /* @__PURE__ */ jsx6(CollapsibleTrigger2, {
276
+ AnnotatedLine: ({ annotation, ...props }) => /* @__PURE__ */ jsx7(CollapsibleTrigger2, {
224
277
  className: "group contents",
225
- children: /* @__PURE__ */ jsx6(InnerLine3, {
278
+ children: /* @__PURE__ */ jsx7(InnerLine3, {
226
279
  merge: props,
227
280
  data: { icon }
228
281
  })
@@ -232,13 +285,13 @@ var collapseTrigger = {
232
285
  return /* @__PURE__ */ jsxs2("div", {
233
286
  className: "table-row",
234
287
  children: [
235
- /* @__PURE__ */ jsx6("span", {
288
+ /* @__PURE__ */ jsx7("span", {
236
289
  className: "w-4 text-center table-cell",
237
290
  children: icon2
238
291
  }),
239
- /* @__PURE__ */ jsx6("div", {
292
+ /* @__PURE__ */ jsx7("div", {
240
293
  className: "table-cell",
241
- children: /* @__PURE__ */ jsx6(InnerLine3, {
294
+ children: /* @__PURE__ */ jsx7(InnerLine3, {
242
295
  merge: props
243
296
  })
244
297
  })
@@ -254,27 +307,27 @@ var collapse = [collapseRoot, collapseTrigger, collapseContent];
254
307
 
255
308
  // src/docskit/diff.tsx
256
309
  import { InnerLine as InnerLine4 } from "codehike/code";
257
- import { jsx as jsx7, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
310
+ import { jsx as jsx8, jsxs as jsxs3, Fragment } from "react/jsx-runtime";
258
311
  var diff = {
259
312
  name: "diff",
260
313
  onlyIfAnnotated: true,
261
314
  Block: ({ annotation, children }) => {
262
315
  const color = annotation.query === "-" ? "#f85149" : "#3fb950";
263
- return /* @__PURE__ */ jsx7("div", {
316
+ return /* @__PURE__ */ jsx8("div", {
264
317
  style: {
265
- ["--dk-line-bg"]: `rgb(from ${color} r g b / 0.13)`,
266
- ["--dk-line-border"]: color
318
+ ["--openpkg-line-bg"]: `rgb(from ${color} r g b / 0.13)`,
319
+ ["--openpkg-line-border"]: color
267
320
  },
268
321
  children
269
322
  });
270
323
  },
271
324
  Line: ({ annotation, ...props }) => /* @__PURE__ */ jsxs3(Fragment, {
272
325
  children: [
273
- /* @__PURE__ */ jsx7("div", {
326
+ /* @__PURE__ */ jsx8("div", {
274
327
  className: "min-w-[1ch] box-content opacity-70 pl-2 select-none",
275
328
  children: annotation?.query
276
329
  }),
277
- /* @__PURE__ */ jsx7(InnerLine4, {
330
+ /* @__PURE__ */ jsx8(InnerLine4, {
278
331
  merge: props
279
332
  })
280
333
  ]
@@ -282,7 +335,7 @@ var diff = {
282
335
  };
283
336
 
284
337
  // src/docskit/expandable.tsx
285
- import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
338
+ import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
286
339
  var expandable = {
287
340
  name: "expandable",
288
341
  transform: (annotation) => {
@@ -291,14 +344,14 @@ var expandable = {
291
344
  Block: ({ children }) => {
292
345
  return /* @__PURE__ */ jsxs4(Collapsible, {
293
346
  children: [
294
- /* @__PURE__ */ jsx8(CollapsibleTrigger2, {
295
- className: "h-24 w-full translate-y-[-75%] absolute bg-gradient-to-b from-dk-background/0 via-dk-background/80 to-dk-background data-[state=open]:invisible",
296
- children: /* @__PURE__ */ jsx8("div", {
347
+ /* @__PURE__ */ jsx9(CollapsibleTrigger2, {
348
+ className: "h-24 w-full translate-y-[-75%] absolute bg-gradient-to-b from-openpkg-code-bg/0 via-openpkg-code-bg/80 to-openpkg-code-bg data-[state=open]:invisible",
349
+ children: /* @__PURE__ */ jsx9("div", {
297
350
  className: "pt-6",
298
351
  children: "Expand"
299
352
  })
300
353
  }),
301
- /* @__PURE__ */ jsx8(CollapsibleContent2, {
354
+ /* @__PURE__ */ jsx9(CollapsibleContent2, {
302
355
  children
303
356
  })
304
357
  ]
@@ -311,7 +364,7 @@ import {
311
364
  InnerLine as InnerLine5
312
365
  } from "codehike/code";
313
366
  import { createContext, useContext, useState as useState2 } from "react";
314
- import { jsx as jsx9 } from "react/jsx-runtime";
367
+ import { jsx as jsx10 } from "react/jsx-runtime";
315
368
 
316
369
  var HoverContext = createContext({
317
370
  hoveredNames: [],
@@ -326,7 +379,7 @@ function HoverProvider({ children }) {
326
379
  const removeHoveredName = (name) => {
327
380
  setHoveredNames((prev) => prev.filter((n) => n !== name));
328
381
  };
329
- return /* @__PURE__ */ jsx9(HoverContext.Provider, {
382
+ return /* @__PURE__ */ jsx10(HoverContext.Provider, {
330
383
  value: { hoveredNames, addHoveredName, removeHoveredName },
331
384
  children
332
385
  });
@@ -339,7 +392,7 @@ function Hoverable({
339
392
  }) {
340
393
  const { addHoveredName, removeHoveredName, hoveredNames } = useContext(HoverContext);
341
394
  const isHovered = hoveredNames.length > 0 && hoveredNames[hoveredNames.length - 1] === name;
342
- return /* @__PURE__ */ jsx9("span", {
395
+ return /* @__PURE__ */ jsx10("span", {
343
396
  className,
344
397
  onMouseEnter: () => addHoveredName(name),
345
398
  onMouseLeave: () => removeHoveredName(name),
@@ -353,10 +406,10 @@ var HoverBlock = ({ annotation, children }) => {
353
406
  const name = annotation?.query;
354
407
  const isHovered = name && hoveredNames[hoveredNames.length - 1] === name;
355
408
  const style = isHovered && !annotation.data?.inline ? {
356
- ["--dk-line-bg"]: `rgb(from ${color} r g b / 0.13)`,
357
- ["--dk-line-border"]: color
409
+ ["--openpkg-line-bg"]: `rgb(from ${color} r g b / 0.13)`,
410
+ ["--openpkg-line-border"]: color
358
411
  } : undefined;
359
- return /* @__PURE__ */ jsx9("div", {
412
+ return /* @__PURE__ */ jsx10("div", {
360
413
  style,
361
414
  children
362
415
  });
@@ -369,7 +422,7 @@ var HoverLine = ({ annotation, ...props }) => {
369
422
  const name = annotation?.query;
370
423
  const isHovered = name && hoveredNames[hoveredNames.length - 1] === name;
371
424
  const opacity = isHovered ? 1 : prevOpacity ? prevOpacity : anyHovered ? 0.5 : 1;
372
- return /* @__PURE__ */ jsx9(InnerLine5, {
425
+ return /* @__PURE__ */ jsx10(InnerLine5, {
373
426
  merge: props,
374
427
  style: {
375
428
  opacity,
@@ -380,7 +433,7 @@ var HoverLine = ({ annotation, ...props }) => {
380
433
  var HoverInline = ({ annotation, children }) => {
381
434
  const { hoveredNames } = useContext(HoverContext);
382
435
  const isHovered = hoveredNames[hoveredNames.length - 1] === annotation.query;
383
- return /* @__PURE__ */ jsx9("span", {
436
+ return /* @__PURE__ */ jsx10("span", {
384
437
  className: "rounded px-0.5 py-0 -mx-0.5",
385
438
  style: {
386
439
  transition: "background-color 0.3s ease, box-shadow 0.3s ease",
@@ -392,15 +445,15 @@ var HoverInline = ({ annotation, children }) => {
392
445
  };
393
446
 
394
447
  // src/docskit/hover.tsx
395
- import { jsx as jsx10 } from "react/jsx-runtime";
448
+ import { jsx as jsx11 } from "react/jsx-runtime";
396
449
  function WithHover(props) {
397
- return /* @__PURE__ */ jsx10(HoverProvider, {
450
+ return /* @__PURE__ */ jsx11(HoverProvider, {
398
451
  children: props.children
399
452
  });
400
453
  }
401
454
  function HoverLink(props) {
402
455
  const hover = props.href?.slice("hover:".length) ?? "";
403
- return /* @__PURE__ */ jsx10(Hoverable, {
456
+ return /* @__PURE__ */ jsx11(Hoverable, {
404
457
  className: "underline decoration-dotted underline-offset-4 inline cursor-help",
405
458
  name: hover,
406
459
  children: props.children
@@ -429,19 +482,19 @@ var hover = {
429
482
 
430
483
  // src/docskit/line-numbers.tsx
431
484
  import { InnerLine as InnerLine6 } from "codehike/code";
432
- import { jsx as jsx11, jsxs as jsxs5, Fragment as Fragment2 } from "react/jsx-runtime";
485
+ import { jsx as jsx12, jsxs as jsxs5, Fragment as Fragment2 } from "react/jsx-runtime";
433
486
  var lineNumbers = {
434
487
  name: "line-numbers",
435
488
  Line: (props) => {
436
489
  const width = props.totalLines.toString().length + 1;
437
490
  return /* @__PURE__ */ jsxs5(Fragment2, {
438
491
  children: [
439
- /* @__PURE__ */ jsx11("span", {
492
+ /* @__PURE__ */ jsx12("span", {
440
493
  style: { minWidth: `${width}ch` },
441
- className: "text-right text-dk-line-number select-none mr-1",
494
+ className: "text-right text-openpkg-code-line-number select-none mr-1",
442
495
  children: props.lineNumber
443
496
  }),
444
- /* @__PURE__ */ jsx11(InnerLine6, {
497
+ /* @__PURE__ */ jsx12(InnerLine6, {
445
498
  merge: props
446
499
  })
447
500
  ]
@@ -450,12 +503,12 @@ var lineNumbers = {
450
503
  };
451
504
 
452
505
  // src/docskit/link.tsx
453
- import { jsx as jsx12 } from "react/jsx-runtime";
506
+ import { jsx as jsx13 } from "react/jsx-runtime";
454
507
  var link = {
455
508
  name: "link",
456
509
  Inline: ({ annotation, children }) => {
457
510
  const { query } = annotation;
458
- return /* @__PURE__ */ jsx12("a", {
511
+ return /* @__PURE__ */ jsx13("a", {
459
512
  href: query,
460
513
  className: "underline",
461
514
  children
@@ -464,22 +517,22 @@ var link = {
464
517
  };
465
518
 
466
519
  // src/docskit/mark.tsx
467
- import { jsx as jsx13 } from "react/jsx-runtime";
520
+ import { jsx as jsx14 } from "react/jsx-runtime";
468
521
  var mark = {
469
522
  name: "mark",
470
523
  Block: ({ annotation, children }) => {
471
524
  const color2 = getColor(annotation);
472
- return /* @__PURE__ */ jsx13("div", {
525
+ return /* @__PURE__ */ jsx14("div", {
473
526
  style: {
474
- ["--dk-line-bg"]: `rgb(from ${color2} r g b / 0.13)`,
475
- ["--dk-line-border"]: color2
527
+ ["--openpkg-line-bg"]: `rgb(from ${color2} r g b / 0.13)`,
528
+ ["--openpkg-line-border"]: color2
476
529
  },
477
530
  children
478
531
  });
479
532
  },
480
533
  Inline: ({ annotation, children }) => {
481
534
  const color2 = getColor(annotation);
482
- return /* @__PURE__ */ jsx13("span", {
535
+ return /* @__PURE__ */ jsx14("span", {
483
536
  style: {
484
537
  boxShadow: `0 0 0 1px rgb(from ${color2} r g b / 0.5)`,
485
538
  backgroundColor: `rgb(from ${color2} r g b / 0.13)`
@@ -497,28 +550,28 @@ var colors = ["var(--ch-5)", "var(--ch-3)", "var(--ch-2)"];
497
550
 
498
551
  // src/tooltip/tooltip.tsx
499
552
  import * as TooltipPrimitive from "@radix-ui/react-tooltip";
500
- import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
553
+ import { jsx as jsx15, jsxs as jsxs6 } from "react/jsx-runtime";
501
554
 
502
555
  function TooltipProvider({
503
556
  delayDuration = 0,
504
557
  ...props
505
558
  }) {
506
- return /* @__PURE__ */ jsx14(TooltipPrimitive.Provider, {
559
+ return /* @__PURE__ */ jsx15(TooltipPrimitive.Provider, {
507
560
  "data-slot": "tooltip-provider",
508
561
  delayDuration,
509
562
  ...props
510
563
  });
511
564
  }
512
565
  function Tooltip({ ...props }) {
513
- return /* @__PURE__ */ jsx14(TooltipProvider, {
514
- children: /* @__PURE__ */ jsx14(TooltipPrimitive.Root, {
566
+ return /* @__PURE__ */ jsx15(TooltipProvider, {
567
+ children: /* @__PURE__ */ jsx15(TooltipPrimitive.Root, {
515
568
  "data-slot": "tooltip",
516
569
  ...props
517
570
  })
518
571
  });
519
572
  }
520
573
  function TooltipTrigger({ ...props }) {
521
- return /* @__PURE__ */ jsx14(TooltipPrimitive.Trigger, {
574
+ return /* @__PURE__ */ jsx15(TooltipPrimitive.Trigger, {
522
575
  "data-slot": "tooltip-trigger",
523
576
  ...props
524
577
  });
@@ -529,7 +582,7 @@ function TooltipContent({
529
582
  children,
530
583
  ...props
531
584
  }) {
532
- return /* @__PURE__ */ jsx14(TooltipPrimitive.Portal, {
585
+ return /* @__PURE__ */ jsx15(TooltipPrimitive.Portal, {
533
586
  children: /* @__PURE__ */ jsxs6(TooltipPrimitive.Content, {
534
587
  "data-slot": "tooltip-content",
535
588
  sideOffset,
@@ -537,7 +590,7 @@ function TooltipContent({
537
590
  ...props,
538
591
  children: [
539
592
  children,
540
- /* @__PURE__ */ jsx14(TooltipPrimitive.Arrow, {
593
+ /* @__PURE__ */ jsx15(TooltipPrimitive.Arrow, {
541
594
  className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"
542
595
  })
543
596
  ]
@@ -546,33 +599,33 @@ function TooltipContent({
546
599
  }
547
600
 
548
601
  // src/docskit/tooltip.client.tsx
549
- import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
602
+ import { jsx as jsx16, jsxs as jsxs7 } from "react/jsx-runtime";
550
603
 
551
604
  function NoteTooltip({ children, name }) {
552
605
  let note = useNotesContext(name);
553
606
  if (!note) {
554
607
  note = { name, type: "prose", children: name };
555
608
  }
556
- return /* @__PURE__ */ jsx15(TooltipProvider, {
609
+ return /* @__PURE__ */ jsx16(TooltipProvider, {
557
610
  delayDuration: 100,
558
611
  children: /* @__PURE__ */ jsxs7(Tooltip, {
559
612
  children: [
560
- /* @__PURE__ */ jsx15(TooltipTrigger, {
613
+ /* @__PURE__ */ jsx16(TooltipTrigger, {
561
614
  asChild: true,
562
- children: /* @__PURE__ */ jsx15("span", {
615
+ children: /* @__PURE__ */ jsx16("span", {
563
616
  className: "underline decoration-dotted underline-offset-4 cursor-help",
564
617
  children
565
618
  })
566
619
  }),
567
- note.type === "code" ? /* @__PURE__ */ jsx15(TooltipContent, {
620
+ note.type === "code" ? /* @__PURE__ */ jsx16(TooltipContent, {
568
621
  className: cn("min-w-44 max-w-96 whitespace-normal", "p-0 [&>div]:!my-0 border-none rounded-none bg-transparent", "[&>span>svg]:invisible"),
569
622
  children: note?.children
570
- }) : note.type === "image" ? /* @__PURE__ */ jsx15(TooltipContent, {
623
+ }) : note.type === "image" ? /* @__PURE__ */ jsx16(TooltipContent, {
571
624
  className: cn("min-w-44 max-w-96 whitespace-normal", "p-0 [&>*]:first:mt-0 [&>*]:last:mb-0 border-none bg-transparent", "[&>span>svg]:invisible"),
572
625
  children: note?.children
573
- }) : /* @__PURE__ */ jsx15(TooltipContent, {
626
+ }) : /* @__PURE__ */ jsx16(TooltipContent, {
574
627
  className: cn("min-w-44 max-w-96 whitespace-normal", "p-4"),
575
- children: /* @__PURE__ */ jsx15("div", {
628
+ children: /* @__PURE__ */ jsx16("div", {
576
629
  className: "[&>:first-child]:mt-0 [&>:last-child]:mb-0",
577
630
  children: note?.children
578
631
  })
@@ -583,12 +636,12 @@ function NoteTooltip({ children, name }) {
583
636
  }
584
637
 
585
638
  // src/docskit/tooltip.tsx
586
- import { jsx as jsx16 } from "react/jsx-runtime";
639
+ import { jsx as jsx17 } from "react/jsx-runtime";
587
640
  var tooltip = {
588
641
  name: "tooltip",
589
642
  Inline: ({ children, annotation }) => {
590
643
  const { query } = annotation;
591
- return /* @__PURE__ */ jsx16(NoteTooltip, {
644
+ return /* @__PURE__ */ jsx17(NoteTooltip, {
592
645
  name: query,
593
646
  children
594
647
  });
@@ -596,7 +649,7 @@ var tooltip = {
596
649
  };
597
650
  function TooltipLink(props) {
598
651
  const name = props.href?.slice("tooltip:".length) ?? "";
599
- return /* @__PURE__ */ jsx16(NoteTooltip, {
652
+ return /* @__PURE__ */ jsx17(NoteTooltip, {
600
653
  name,
601
654
  children: props.children
602
655
  });
@@ -604,16 +657,16 @@ function TooltipLink(props) {
604
657
 
605
658
  // src/docskit/word-wrap.tsx
606
659
  import { InnerLine as InnerLine7, InnerPre, InnerToken } from "codehike/code";
607
- import { jsx as jsx17 } from "react/jsx-runtime";
660
+ import { jsx as jsx18 } from "react/jsx-runtime";
608
661
  var wordWrap = {
609
662
  name: "word-wrap",
610
- Pre: (props) => /* @__PURE__ */ jsx17(InnerPre, {
663
+ Pre: (props) => /* @__PURE__ */ jsx18(InnerPre, {
611
664
  merge: props,
612
665
  className: "whitespace-pre-wrap"
613
666
  }),
614
- Line: (props) => /* @__PURE__ */ jsx17(InnerLine7, {
667
+ Line: (props) => /* @__PURE__ */ jsx18(InnerLine7, {
615
668
  merge: props,
616
- children: /* @__PURE__ */ jsx17("div", {
669
+ children: /* @__PURE__ */ jsx18("div", {
617
670
  style: {
618
671
  textIndent: `${-props.indentation}ch`,
619
672
  marginLeft: `${props.indentation}ch`
@@ -621,7 +674,7 @@ var wordWrap = {
621
674
  children: props.children
622
675
  })
623
676
  }),
624
- Token: (props) => /* @__PURE__ */ jsx17(InnerToken, {
677
+ Token: (props) => /* @__PURE__ */ jsx18(InnerToken, {
625
678
  merge: props,
626
679
  style: { textIndent: 0 }
627
680
  })
@@ -644,13 +697,55 @@ function getHandlers(options) {
644
697
  ].filter(Boolean);
645
698
  }
646
699
 
700
+ // src/docskit/code.icon.tsx
701
+ import { TerminalIcon } from "lucide-react";
702
+ import { themeIcons } from "seti-icons";
703
+ import { jsx as jsx19 } from "react/jsx-runtime";
704
+ function CodeIcon({
705
+ title,
706
+ lang,
707
+ className
708
+ }) {
709
+ if (title?.toLowerCase() === "terminal output" || title?.toLowerCase() === "terminal" || lang === "sh" || lang === "shell" || lang === "bash") {
710
+ return /* @__PURE__ */ jsx19(TerminalIcon, {
711
+ size: 16,
712
+ className,
713
+ style: { marginTop: -3.5 }
714
+ });
715
+ }
716
+ const ext = lang === "rust" ? "rs" : lang === "typescript" ? "ts" : lang;
717
+ const filename = `x.${ext}`;
718
+ const { svg } = getIcon(filename);
719
+ const __html = svg.replace(/svg/, `svg fill='currentColor' style='margin: -4px; height: 24px; width: 24px;'`);
720
+ return /* @__PURE__ */ jsx19("span", {
721
+ className,
722
+ children: /* @__PURE__ */ jsx19("span", {
723
+ dangerouslySetInnerHTML: { __html },
724
+ style: { display: "contents" }
725
+ })
726
+ });
727
+ }
728
+ var getIcon = themeIcons({
729
+ white: "#d4d7d6",
730
+ grey: "#4d5a5e",
731
+ "grey-light": "#6d8086",
732
+ blue: "#519aba",
733
+ green: "#8dc149",
734
+ orange: "#e37933",
735
+ pink: "#f55385",
736
+ purple: "#a074c4",
737
+ red: "#cc3e44",
738
+ yellow: "#cbcb41",
739
+ ignore: "#41535b"
740
+ });
741
+
647
742
  // src/docskit/code.skeleton.tsx
648
743
  import { useId } from "react";
649
- import { jsx as jsx18, jsxs as jsxs8 } from "react/jsx-runtime";
744
+ import { jsx as jsx20, jsxs as jsxs8 } from "react/jsx-runtime";
650
745
 
651
746
  function SkeletonLine({ width = "75%" }) {
652
- return /* @__PURE__ */ jsx18("div", {
653
- className: "h-4 bg-dk-border/20 rounded animate-pulse",
747
+ return /* @__PURE__ */ jsx20("div", {
748
+ className: "h-4 bg-openpkg-code-border/20 rounded animate-pulse",
654
749
  style: { width }
655
750
  });
656
751
  }
@@ -664,25 +759,25 @@ function CodeBlockSkeleton({
664
759
  return widths[i % widths.length];
665
760
  });
666
761
  return /* @__PURE__ */ jsxs8("div", {
667
- className: "rounded overflow-hidden border border-dk-border my-4 not-prose",
762
+ className: "rounded overflow-hidden border border-openpkg-code-border my-4 not-prose",
668
763
  children: [
669
- hasTitle && /* @__PURE__ */ jsx18("div", {
670
- className: cn("border-b border-dk-border bg-dk-tabs-background px-3 py-0", "w-full h-9 flex items-center shrink-0"),
764
+ hasTitle && /* @__PURE__ */ jsx20("div", {
765
+ className: cn("border-b border-openpkg-code-border bg-openpkg-code-header px-3 py-0", "w-full h-9 flex items-center shrink-0"),
671
766
  children: /* @__PURE__ */ jsxs8("div", {
672
767
  className: "flex items-center h-5 gap-2",
673
768
  children: [
674
- /* @__PURE__ */ jsx18("div", {
675
- className: "size-4 bg-dk-border/30 rounded animate-pulse"
769
+ /* @__PURE__ */ jsx20("div", {
770
+ className: "size-4 bg-openpkg-code-border/30 rounded animate-pulse"
676
771
  }),
677
- /* @__PURE__ */ jsx18("div", {
678
- className: "h-4 w-20 bg-dk-border/30 rounded animate-pulse"
772
+ /* @__PURE__ */ jsx20("div", {
773
+ className: "h-4 w-20 bg-openpkg-code-border/30 rounded animate-pulse"
679
774
  })
680
775
  ]
681
776
  })
682
777
  }),
683
- /* @__PURE__ */ jsx18("div", {
684
- className: "bg-dk-background px-4 py-3 space-y-2",
685
- children: lineWidths.map((width, i) => /* @__PURE__ */ jsx18(SkeletonLine, {
778
+ /* @__PURE__ */ jsx20("div", {
779
+ className: "bg-openpkg-code-bg px-4 py-3 space-y-2",
780
+ children: lineWidths.map((width, i) => /* @__PURE__ */ jsx20(SkeletonLine, {
686
781
  width
687
782
  }, `${id}-line-${i}`))
688
783
  })
@@ -696,28 +791,28 @@ function TerminalSkeleton({ lines = 3 }) {
696
791
  return widths[i % widths.length];
697
792
  });
698
793
  return /* @__PURE__ */ jsxs8("div", {
699
- className: "rounded overflow-hidden border border-dk-border my-4 not-prose",
794
+ className: "rounded overflow-hidden border border-openpkg-code-border my-4 not-prose",
700
795
  children: [
701
- /* @__PURE__ */ jsx18("div", {
702
- className: cn("border-b border-dk-border bg-dk-tabs-background", "w-full h-9 flex items-center justify-center shrink-0", "relative"),
796
+ /* @__PURE__ */ jsx20("div", {
797
+ className: cn("border-b border-openpkg-code-border bg-openpkg-code-header", "w-full h-9 flex items-center justify-center shrink-0", "relative"),
703
798
  children: /* @__PURE__ */ jsxs8("div", {
704
799
  className: "absolute left-3 flex items-center gap-2",
705
800
  children: [
706
- /* @__PURE__ */ jsx18("div", {
707
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
801
+ /* @__PURE__ */ jsx20("div", {
802
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
708
803
  }),
709
- /* @__PURE__ */ jsx18("div", {
710
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
804
+ /* @__PURE__ */ jsx20("div", {
805
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
711
806
  }),
712
- /* @__PURE__ */ jsx18("div", {
713
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
807
+ /* @__PURE__ */ jsx20("div", {
808
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
714
809
  })
715
810
  ]
716
811
  })
717
812
  }),
718
- /* @__PURE__ */ jsx18("div", {
719
- className: "bg-dk-background px-4 py-3 space-y-2",
720
- children: lineWidths.map((width, i) => /* @__PURE__ */ jsx18(SkeletonLine, {
813
+ /* @__PURE__ */ jsx20("div", {
814
+ className: "bg-openpkg-code-bg px-4 py-3 space-y-2",
815
+ children: lineWidths.map((width, i) => /* @__PURE__ */ jsx20(SkeletonLine, {
721
816
  width
722
817
  }, `${id}-line-${i}`))
723
818
  })
@@ -725,39 +820,36 @@ function TerminalSkeleton({ lines = 3 }) {
725
820
  });
726
821
  }
727
822
  function InlineCodeSkeleton() {
728
- return /* @__PURE__ */ jsx18("span", {
729
- className: "inline-block h-5 w-16 bg-dk-border/20 rounded border border-dk-border animate-pulse align-middle"
823
+ return /* @__PURE__ */ jsx20("span", {
824
+ className: "inline-block h-5 w-16 bg-openpkg-code-border/20 rounded border border-openpkg-code-border animate-pulse align-middle"
730
825
  });
731
826
  }
732
- function CodeTabsSkeleton({
733
- tabs = 2,
734
- lines = 6
735
- }) {
827
+ function CodeTabsSkeleton({ tabs = 2, lines = 6 }) {
736
828
  const id = useId();
737
829
  const lineWidths = Array.from({ length: lines }, (_, i) => {
738
830
  const widths = ["40%", "65%", "55%", "80%", "45%", "70%"];
739
831
  return widths[i % widths.length];
740
832
  });
741
833
  return /* @__PURE__ */ jsxs8("div", {
742
- className: "rounded overflow-hidden border border-dk-border my-4 not-prose",
834
+ className: "rounded overflow-hidden border border-openpkg-code-border my-4 not-prose",
743
835
  children: [
744
- /* @__PURE__ */ jsx18("div", {
745
- className: cn("border-b border-dk-border bg-dk-tabs-background px-2 py-0", "w-full h-9 flex items-center shrink-0 gap-1"),
836
+ /* @__PURE__ */ jsx20("div", {
837
+ className: cn("border-b border-openpkg-code-border bg-openpkg-code-header px-2 py-0", "w-full h-9 flex items-center shrink-0 gap-1"),
746
838
  children: Array.from({ length: tabs }).map((_, i) => /* @__PURE__ */ jsxs8("div", {
747
839
  className: "flex items-center gap-1.5 px-3 h-full",
748
840
  children: [
749
- /* @__PURE__ */ jsx18("div", {
750
- className: "size-4 bg-dk-border/30 rounded animate-pulse"
841
+ /* @__PURE__ */ jsx20("div", {
842
+ className: "size-4 bg-openpkg-code-border/30 rounded animate-pulse"
751
843
  }),
752
- /* @__PURE__ */ jsx18("div", {
753
- className: "h-4 w-16 bg-dk-border/30 rounded animate-pulse"
844
+ /* @__PURE__ */ jsx20("div", {
845
+ className: "h-4 w-16 bg-openpkg-code-border/30 rounded animate-pulse"
754
846
  })
755
847
  ]
756
848
  }, `${id}-tab-${i}`))
757
849
  }),
758
- /* @__PURE__ */ jsx18("div", {
759
- className: "bg-dk-background px-4 py-3 space-y-2",
760
- children: lineWidths.map((width, i) => /* @__PURE__ */ jsx18(SkeletonLine, {
850
+ /* @__PURE__ */ jsx20("div", {
851
+ className: "bg-openpkg-code-bg px-4 py-3 space-y-2",
852
+ children: lineWidths.map((width, i) => /* @__PURE__ */ jsx20(SkeletonLine, {
761
853
  width
762
854
  }, `${id}-line-${i}`))
763
855
  })
@@ -765,1331 +857,1466 @@ function CodeTabsSkeleton({
765
857
  });
766
858
  }
767
859
 
768
- // src/docskit/api/language-selector.tsx
769
- import { ChevronDown } from "lucide-react";
770
- import * as React2 from "react";
771
- import { jsx as jsx19, jsxs as jsxs9 } from "react/jsx-runtime";
860
+ // src/docskit/tabs.tsx
861
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
862
+ import { jsx as jsx21 } from "react/jsx-runtime";
772
863
 
773
- function LanguageSelector({
774
- languages,
775
- value,
776
- onChange,
777
- className
778
- }) {
779
- const [open, setOpen] = React2.useState(false);
780
- const containerRef = React2.useRef(null);
781
- const selectedLanguage = languages.find((l) => l.id === value);
782
- React2.useEffect(() => {
783
- const handleClickOutside = (e) => {
784
- if (containerRef.current && !containerRef.current.contains(e.target)) {
785
- setOpen(false);
786
- }
787
- };
788
- document.addEventListener("mousedown", handleClickOutside);
789
- return () => document.removeEventListener("mousedown", handleClickOutside);
790
- }, []);
791
- return /* @__PURE__ */ jsxs9("div", {
792
- ref: containerRef,
793
- className: cn("relative", className),
794
- children: [
795
- /* @__PURE__ */ jsxs9("button", {
796
- type: "button",
797
- onClick: () => setOpen(!open),
798
- className: cn("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-sm font-medium", "bg-[var(--openpkg-bg-secondary)] hover:bg-[var(--openpkg-bg-tertiary)] text-[var(--openpkg-text-primary)] transition-colors cursor-pointer"),
799
- children: [
800
- selectedLanguage?.label ?? value,
801
- /* @__PURE__ */ jsx19(ChevronDown, {
802
- size: 14,
803
- className: cn("transition-transform", open && "rotate-180")
804
- })
805
- ]
806
- }),
807
- open && /* @__PURE__ */ jsx19("div", {
808
- className: cn("absolute top-full left-0 mt-1 z-50 min-w-[120px]", "bg-[var(--openpkg-bg-card)] border border-[var(--openpkg-border-subtle)] rounded-md shadow-lg overflow-hidden"),
809
- children: languages.map((lang) => /* @__PURE__ */ jsx19("button", {
810
- type: "button",
811
- onClick: () => {
812
- onChange(lang.id);
813
- setOpen(false);
814
- },
815
- className: cn("w-full px-3 py-2 text-sm text-left transition-colors cursor-pointer", lang.id === value ? "bg-[color-mix(in_srgb,var(--openpkg-accent-primary)_10%,transparent)] text-[var(--openpkg-accent-primary)]" : "text-[var(--openpkg-text-primary)] hover:bg-[var(--openpkg-bg-secondary)]"),
816
- children: lang.label
817
- }, lang.id))
818
- })
819
- ]
864
+ function Tabs({ className, ...props }) {
865
+ return /* @__PURE__ */ jsx21(TabsPrimitive.Root, {
866
+ "data-slot": "tabs",
867
+ className: cn("flex flex-col gap-2", className),
868
+ ...props
869
+ });
870
+ }
871
+ function TabsList({ className, ...props }) {
872
+ return /* @__PURE__ */ jsx21(TabsPrimitive.List, {
873
+ "data-slot": "tabs-list",
874
+ className: cn("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]", className),
875
+ ...props
876
+ });
877
+ }
878
+ function TabsTrigger({ className, ...props }) {
879
+ return /* @__PURE__ */ jsx21(TabsPrimitive.Trigger, {
880
+ "data-slot": "tabs-trigger",
881
+ className: cn("dark:data-[state=active]:text-foreground focus-visible:ring-ring/50 focus-visible:outline-ring dark:text-muted-foreground inline-flex h-full flex-1 items-center justify-center gap-1.5 px-2 py-1 text-sm font-normal whitespace-nowrap transition-colors focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
882
+ ...props
883
+ });
884
+ }
885
+ function TabsContent({ className, ...props }) {
886
+ return /* @__PURE__ */ jsx21(TabsPrimitive.Content, {
887
+ "data-slot": "tabs-content",
888
+ className: cn("flex-1 outline-none", className),
889
+ ...props
820
890
  });
821
891
  }
822
892
 
823
- // src/docskit/api/api-code-panel.tsx
824
- import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
893
+ // src/docskit/code.client-highlight.tsx
894
+ import { jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
825
895
 
826
- function APICodePanel({
827
- languages,
828
- examples,
829
- externalLink,
830
- title,
831
- className
832
- }) {
833
- const [selectedLang, setSelectedLang] = useState4(examples[0]?.languageId ?? languages[0]?.id);
834
- const [copied, copy] = useCopyToClipboard();
835
- const [highlighted, setHighlighted] = useState4(null);
836
- const currentExample = examples.find((e) => e.languageId === selectedLang);
837
- const code = currentExample?.code ?? "";
838
- const lang = currentExample?.highlightLang ?? currentExample?.languageId ?? "txt";
839
- useEffect2(() => {
896
+ function ClientDocsKitCode(props) {
897
+ const { codeblock, handlers: extraHandlers, className: wrapperClassName } = props;
898
+ const [highlighted, setHighlighted] = useState3(null);
899
+ const { title, flags } = extractFlags(codeblock);
900
+ const options = flagsToOptions(flags);
901
+ useEffect(() => {
840
902
  let cancelled = false;
841
- highlight({
842
- value: code,
843
- lang: lang === "curl" ? "bash" : lang,
844
- meta: ""
845
- }, theme).then((result) => {
846
- if (!cancelled) {
903
+ highlight({ ...codeblock, lang: codeblock.lang || "txt" }, theme).then((result) => {
904
+ if (!cancelled)
847
905
  setHighlighted(result);
848
- }
849
906
  });
850
907
  return () => {
851
908
  cancelled = true;
852
909
  };
853
- }, [code, lang]);
854
- const handleCopy = () => {
855
- copy(code);
856
- };
857
- const handlers = getHandlers({ copyButton: false });
858
- return /* @__PURE__ */ jsxs10("div", {
859
- className: cn("rounded-lg overflow-hidden border border-dk-border", "bg-dk-background text-gray-100", "sticky top-20", className),
910
+ }, [codeblock.value, codeblock.lang, codeblock.meta]);
911
+ if (!highlighted) {
912
+ return /* @__PURE__ */ jsx22(CodeBlockSkeleton, {
913
+ hasTitle: !!title
914
+ });
915
+ }
916
+ const handlers = getHandlers(options);
917
+ if (extraHandlers) {
918
+ handlers.push(...extraHandlers);
919
+ }
920
+ const { background: _background, ...highlightedStyle } = highlighted.style;
921
+ const showCopy = options?.copyButton;
922
+ const icon2 = /* @__PURE__ */ jsx22(CodeIcon, {
923
+ title,
924
+ lang: codeblock.lang,
925
+ className: "opacity-60"
926
+ });
927
+ return /* @__PURE__ */ jsxs9("div", {
928
+ className: cn("group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose", wrapperClassName),
860
929
  children: [
861
- /* @__PURE__ */ jsxs10("div", {
862
- className: "flex items-center justify-between px-4 py-3 border-b border-dk-border bg-dk-tabs-background",
930
+ title ? /* @__PURE__ */ jsx22("div", {
931
+ className: cn("border-b-[1px] border-openpkg-code-border bg-openpkg-code-header px-3 py-0", "w-full h-9 flex items-center shrink-0", "text-openpkg-code-text-inactive text-sm font-mono"),
932
+ children: /* @__PURE__ */ jsxs9("div", {
933
+ className: "flex items-center h-5 gap-2",
934
+ children: [
935
+ /* @__PURE__ */ jsx22("div", {
936
+ className: "size-4",
937
+ children: icon2
938
+ }),
939
+ /* @__PURE__ */ jsx22("span", {
940
+ className: "leading-none",
941
+ children: title
942
+ })
943
+ ]
944
+ })
945
+ }) : null,
946
+ /* @__PURE__ */ jsxs9("div", {
947
+ className: "relative flex items-start",
863
948
  children: [
864
- /* @__PURE__ */ jsxs10("div", {
865
- className: "flex items-center gap-3",
866
- children: [
867
- languages.length > 1 && /* @__PURE__ */ jsx20(LanguageSelector, {
868
- languages,
869
- value: selectedLang,
870
- onChange: setSelectedLang,
871
- className: "[&_button]:bg-white/5 [&_button]:hover:bg-white/10 [&_button]:text-gray-200"
872
- }),
873
- title && /* @__PURE__ */ jsx20("span", {
874
- className: "text-sm text-dk-tab-inactive-foreground",
875
- children: title
876
- })
877
- ]
949
+ /* @__PURE__ */ jsx22(Pre, {
950
+ code: highlighted,
951
+ className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current max-h-full flex-1",
952
+ style: highlightedStyle,
953
+ handlers
878
954
  }),
879
- /* @__PURE__ */ jsxs10("div", {
880
- className: "flex items-center gap-2",
881
- children: [
882
- /* @__PURE__ */ jsx20("button", {
883
- type: "button",
884
- onClick: handleCopy,
885
- className: "p-1.5 rounded text-dk-tab-inactive-foreground hover:text-gray-200 transition-colors cursor-pointer",
886
- "aria-label": "Copy code",
887
- children: copied ? /* @__PURE__ */ jsx20(Check, {
888
- size: 16
889
- }) : /* @__PURE__ */ jsx20(Copy, {
890
- size: 16
891
- })
892
- }),
893
- externalLink && /* @__PURE__ */ jsx20("a", {
894
- href: externalLink,
895
- target: "_blank",
896
- rel: "noopener noreferrer",
897
- className: "p-1.5 rounded text-dk-tab-inactive-foreground hover:text-gray-200 transition-colors",
898
- "aria-label": "Open in playground",
899
- children: /* @__PURE__ */ jsx20(ExternalLink, {
900
- size: 16
901
- })
902
- })
903
- ]
955
+ showCopy && /* @__PURE__ */ jsx22(CopyButton, {
956
+ text: highlighted.code,
957
+ variant: "floating",
958
+ className: cn("absolute right-3 z-10 text-openpkg-code-text-inactive", "top-3")
904
959
  })
905
960
  ]
906
- }),
907
- /* @__PURE__ */ jsx20("div", {
908
- className: "overflow-auto max-h-[60vh] lg:max-h-none",
909
- children: highlighted ? /* @__PURE__ */ jsx20(Pre, {
910
- code: highlighted,
911
- className: "overflow-auto px-4 py-3 m-0 rounded-none !bg-dk-background selection:bg-dk-selection selection:text-current text-sm",
912
- style: highlighted.style,
913
- handlers
914
- }) : /* @__PURE__ */ jsx20(CodeBlockSkeleton, {
915
- lines: code.split(`
916
- `).length
917
- })
918
961
  })
919
962
  ]
920
963
  });
921
964
  }
922
- // src/docskit/api/api-reference-page.tsx
923
- import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
924
-
925
- function APIReferencePage({
926
- title,
927
- description,
928
- children,
929
- className
930
- }) {
931
- return /* @__PURE__ */ jsxs11("div", {
932
- className: cn("max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", className),
965
+ function ClientTerminal(props) {
966
+ const { codeblock, handlers: extraHandlers } = props;
967
+ const [highlighted, setHighlighted] = useState3(null);
968
+ const { flags } = extractFlagsSimple(codeblock);
969
+ const options = flagsToOptions(flags);
970
+ useEffect(() => {
971
+ let cancelled = false;
972
+ highlight({ ...codeblock, lang: codeblock.lang || "bash" }, theme).then((result) => {
973
+ if (!cancelled)
974
+ setHighlighted(result);
975
+ });
976
+ return () => {
977
+ cancelled = true;
978
+ };
979
+ }, [codeblock.value, codeblock.lang, codeblock.meta]);
980
+ if (!highlighted) {
981
+ return /* @__PURE__ */ jsx22(TerminalSkeleton, {});
982
+ }
983
+ const handlers = getHandlers(options);
984
+ if (extraHandlers) {
985
+ handlers.push(...extraHandlers);
986
+ }
987
+ const { background: _background, ...highlightedStyle } = highlighted.style;
988
+ const showCopy = options?.copyButton;
989
+ const isMultiLine = highlighted.code.includes(`
990
+ `);
991
+ return /* @__PURE__ */ jsxs9("div", {
992
+ className: "group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose",
933
993
  children: [
934
- /* @__PURE__ */ jsxs11("header", {
935
- className: "py-8 border-b border-[var(--openpkg-border-subtle)]",
994
+ /* @__PURE__ */ jsxs9("div", {
995
+ className: cn("border-b border-openpkg-code-border bg-openpkg-code-header", "w-full h-9 flex items-center justify-center shrink-0", "relative"),
936
996
  children: [
937
- /* @__PURE__ */ jsx21("h1", {
938
- className: "text-3xl font-bold text-[var(--openpkg-text-primary)]",
939
- children: title
997
+ /* @__PURE__ */ jsxs9("div", {
998
+ className: "absolute left-3 flex items-center gap-2",
999
+ children: [
1000
+ /* @__PURE__ */ jsx22("div", {
1001
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
1002
+ }),
1003
+ /* @__PURE__ */ jsx22("div", {
1004
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
1005
+ }),
1006
+ /* @__PURE__ */ jsx22("div", {
1007
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
1008
+ })
1009
+ ]
940
1010
  }),
941
- description && /* @__PURE__ */ jsx21("div", {
942
- className: "mt-4 text-lg text-[var(--openpkg-text-muted)] prose prose-lg dark:prose-invert max-w-none",
943
- children: description
1011
+ /* @__PURE__ */ jsx22("span", {
1012
+ className: "sr-only",
1013
+ children: "Terminal window"
944
1014
  })
945
1015
  ]
946
1016
  }),
947
- /* @__PURE__ */ jsx21("div", {
948
- children
1017
+ /* @__PURE__ */ jsxs9("div", {
1018
+ className: "relative flex items-start",
1019
+ children: [
1020
+ /* @__PURE__ */ jsx22(Pre, {
1021
+ code: highlighted,
1022
+ className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current max-h-full flex-1",
1023
+ style: highlightedStyle,
1024
+ handlers
1025
+ }),
1026
+ showCopy && /* @__PURE__ */ jsx22(CopyButton, {
1027
+ text: highlighted.code,
1028
+ variant: "floating",
1029
+ className: cn("absolute right-3 z-10 text-openpkg-code-text-inactive", isMultiLine ? "top-3" : "top-1/2 -translate-y-1/2")
1030
+ })
1031
+ ]
949
1032
  })
950
1033
  ]
951
1034
  });
952
1035
  }
953
- // src/docskit/api/api-section.tsx
954
- import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
955
-
956
- function APISection({
957
- title,
958
- id,
959
- description,
960
- children,
961
- languages,
962
- examples,
963
- externalLink,
964
- codePanelTitle,
965
- className
966
- }) {
967
- return /* @__PURE__ */ jsx22("section", {
968
- id,
969
- className: cn("py-8 border-b border-[var(--openpkg-border-subtle)] last:border-b-0", className),
970
- children: /* @__PURE__ */ jsxs12("div", {
971
- className: "grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-12",
1036
+ function ClientInlineCode({ codeblock }) {
1037
+ const [highlighted, setHighlighted] = useState3(null);
1038
+ useEffect(() => {
1039
+ let cancelled = false;
1040
+ highlight(codeblock, theme).then((result) => {
1041
+ if (!cancelled)
1042
+ setHighlighted(result);
1043
+ });
1044
+ return () => {
1045
+ cancelled = true;
1046
+ };
1047
+ }, [codeblock.value, codeblock.lang, codeblock.meta]);
1048
+ if (!highlighted) {
1049
+ return /* @__PURE__ */ jsx22(InlineCodeSkeleton, {});
1050
+ }
1051
+ return /* @__PURE__ */ jsx22(Inline, {
1052
+ code: highlighted,
1053
+ className: "selection:bg-openpkg-code-selection selection:text-current rounded border border-openpkg-code-border px-1 py-0.5 whitespace-nowrap !bg-openpkg-code-bg",
1054
+ style: highlighted.style
1055
+ });
1056
+ }
1057
+ function extractFlags(codeblock) {
1058
+ const meta = codeblock.meta || "";
1059
+ const flags = meta.split(" ").filter((flag) => flag.startsWith("-"))[0] ?? "";
1060
+ const metaWithoutFlags = !flags ? meta : meta === flags ? "" : meta.replace(` ${flags}`, "").trim();
1061
+ const title = metaWithoutFlags.trim();
1062
+ return { title, flags: flags.slice(1) };
1063
+ }
1064
+ function extractFlagsSimple(codeblock) {
1065
+ const meta = codeblock.meta || "";
1066
+ const flagMatch = meta.split(" ").find((flag) => flag.startsWith("-"));
1067
+ const flags = flagMatch ? flagMatch.slice(1) : "";
1068
+ return { flags };
1069
+ }
1070
+ function ClientCode(props) {
1071
+ const { codeblocks, flags: groupFlags, storage } = props;
1072
+ const [highlighted, setHighlighted] = useState3(null);
1073
+ const groupOptions = flagsToOptions(groupFlags?.startsWith("-") ? groupFlags.slice(1) : groupFlags);
1074
+ const _codeBlocksKey = codeblocks.map((b) => `${b.value}|${b.lang}|${b.meta}`).join("::");
1075
+ useEffect(() => {
1076
+ let cancelled = false;
1077
+ Promise.all(codeblocks.map(async (block, index) => {
1078
+ const { title, flags } = extractFlags(block);
1079
+ const tabOptions = flagsToOptions(flags);
1080
+ const options = { ...groupOptions, ...tabOptions };
1081
+ const result = await highlight({ ...block, lang: block.lang || "txt" }, theme);
1082
+ return {
1083
+ index,
1084
+ highlighted: result,
1085
+ title,
1086
+ options,
1087
+ icon: /* @__PURE__ */ jsx22(CodeIcon, {
1088
+ title,
1089
+ lang: block.lang,
1090
+ className: "opacity-60"
1091
+ })
1092
+ };
1093
+ })).then((results) => {
1094
+ if (!cancelled) {
1095
+ const map = new Map;
1096
+ results.forEach((r) => map.set(r.index, r));
1097
+ setHighlighted(map);
1098
+ }
1099
+ });
1100
+ return () => {
1101
+ cancelled = true;
1102
+ };
1103
+ }, [_codeBlocksKey]);
1104
+ if (!highlighted) {
1105
+ return /* @__PURE__ */ jsx22(CodeTabsSkeleton, {
1106
+ tabs: codeblocks.length
1107
+ });
1108
+ }
1109
+ if (codeblocks.length === 1) {
1110
+ const tab = highlighted.get(0);
1111
+ const handlers = getHandlers(tab.options);
1112
+ const { background: _background, ...highlightedStyle } = tab.highlighted.style;
1113
+ return /* @__PURE__ */ jsxs9("div", {
1114
+ className: "group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose",
972
1115
  children: [
973
- /* @__PURE__ */ jsxs12("div", {
974
- className: "space-y-6",
1116
+ tab.title ? /* @__PURE__ */ jsx22("div", {
1117
+ className: cn("border-b-[1px] border-openpkg-code-border bg-openpkg-code-header px-3 py-0", "w-full h-9 flex items-center shrink-0", "text-openpkg-code-text-inactive text-sm font-mono"),
1118
+ children: /* @__PURE__ */ jsxs9("div", {
1119
+ className: "flex items-center h-5 gap-2",
1120
+ children: [
1121
+ /* @__PURE__ */ jsx22("div", {
1122
+ className: "size-4",
1123
+ children: tab.icon
1124
+ }),
1125
+ /* @__PURE__ */ jsx22("span", {
1126
+ className: "leading-none",
1127
+ children: tab.title
1128
+ })
1129
+ ]
1130
+ })
1131
+ }) : null,
1132
+ /* @__PURE__ */ jsxs9("div", {
1133
+ className: "relative flex items-start",
975
1134
  children: [
976
- /* @__PURE__ */ jsxs12("div", {
977
- children: [
978
- /* @__PURE__ */ jsx22("h2", {
979
- className: "text-2xl font-semibold text-[var(--openpkg-text-primary)]",
980
- children: title
981
- }),
982
- description && /* @__PURE__ */ jsx22("div", {
983
- className: "mt-3 text-[var(--openpkg-text-muted)] prose prose-sm dark:prose-invert",
984
- children: description
985
- })
986
- ]
1135
+ /* @__PURE__ */ jsx22(Pre, {
1136
+ code: tab.highlighted,
1137
+ className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current max-h-full flex-1",
1138
+ style: highlightedStyle,
1139
+ handlers
987
1140
  }),
988
- children
1141
+ tab.options.copyButton && /* @__PURE__ */ jsx22(CopyButton, {
1142
+ text: tab.highlighted.code,
1143
+ variant: "floating",
1144
+ className: "absolute right-3 top-3 z-10 text-openpkg-code-text-inactive"
1145
+ })
989
1146
  ]
990
- }),
991
- /* @__PURE__ */ jsx22("div", {
992
- className: "lg:pl-4",
993
- children: /* @__PURE__ */ jsx22(APICodePanel, {
994
- languages,
995
- examples,
996
- externalLink,
997
- title: codePanelTitle,
998
- className: "max-h-[400px] lg:max-h-none"
999
- })
1000
1147
  })
1001
1148
  ]
1002
- })
1003
- });
1004
- }
1005
- // src/docskit/api/endpoint-badge.tsx
1006
- import { cva } from "class-variance-authority";
1007
- import * as React3 from "react";
1008
- import { jsx as jsx23 } from "react/jsx-runtime";
1009
- var endpointBadgeVariants = cva("inline-flex items-center justify-center font-mono font-bold uppercase tracking-wide rounded shrink-0", {
1010
- variants: {
1011
- method: {
1012
- GET: "bg-emerald-500/15 text-emerald-500",
1013
- POST: "bg-blue-500/15 text-blue-500",
1014
- PUT: "bg-amber-500/15 text-amber-500",
1015
- DELETE: "bg-rose-500/15 text-rose-500",
1016
- PATCH: "bg-violet-500/15 text-violet-500"
1017
- },
1018
- size: {
1019
- sm: "h-5 px-1.5 text-[10px]",
1020
- md: "h-6 px-2 text-xs"
1021
- }
1022
- },
1023
- defaultVariants: {
1024
- method: "GET",
1025
- size: "md"
1149
+ });
1026
1150
  }
1027
- });
1028
- var EndpointBadge = React3.forwardRef(({ className, method, size, ...props }, ref) => {
1029
- return /* @__PURE__ */ jsx23("span", {
1030
- ref,
1031
- className: cn(endpointBadgeVariants({ method, size, className })),
1032
- ...props,
1033
- children: method
1151
+ return /* @__PURE__ */ jsx22(ClientMultiCode, {
1152
+ highlighted,
1153
+ groupOptions,
1154
+ storage
1034
1155
  });
1035
- });
1036
- EndpointBadge.displayName = "EndpointBadge";
1037
- // src/docskit/api/endpoint-header.tsx
1038
- import { Check as Check2, Copy as Copy2 } from "lucide-react";
1039
- import * as React4 from "react";
1040
- import { jsx as jsx24, jsxs as jsxs13 } from "react/jsx-runtime";
1041
-
1042
- var EndpointHeader = React4.forwardRef(({ className, method, path, copyable = true, ...props }, ref) => {
1043
- const [copied, copy] = useCopyToClipboard();
1044
- const handleCopy = () => {
1045
- copy(path);
1046
- };
1047
- return /* @__PURE__ */ jsxs13("div", {
1048
- ref,
1049
- className: cn("group flex items-center gap-3 py-2 px-3 rounded-lg bg-[var(--openpkg-bg-secondary)] border border-[var(--openpkg-border-subtle)]", className),
1050
- ...props,
1156
+ }
1157
+ function ClientMultiCode({
1158
+ highlighted,
1159
+ groupOptions,
1160
+ storage
1161
+ }) {
1162
+ const tabs = Array.from(highlighted.values());
1163
+ const [storedTitle, setCurrentTitle] = useStateOrLocalStorage(storage, tabs[0].title);
1164
+ const current = tabs.find((tab) => tab.title === storedTitle) || tabs[0];
1165
+ const handlers = getHandlers(current.options);
1166
+ const { background: _background, ...highlightedStyle } = current.highlighted.style;
1167
+ return /* @__PURE__ */ jsxs9(Tabs, {
1168
+ value: current.title,
1169
+ onValueChange: setCurrentTitle,
1170
+ className: cn("group border rounded selection:bg-openpkg-code-selection selection:text-current border-openpkg-code-border overflow-hidden relative flex flex-col max-h-full min-h-0 my-4 gap-0 not-prose"),
1051
1171
  children: [
1052
- /* @__PURE__ */ jsx24(EndpointBadge, {
1053
- method
1054
- }),
1055
- /* @__PURE__ */ jsx24("code", {
1056
- className: "font-mono text-sm text-[var(--openpkg-text-primary)] flex-1",
1057
- children: path
1172
+ /* @__PURE__ */ jsx22(TabsList, {
1173
+ className: cn("border-b border-openpkg-code-border bg-openpkg-code-header w-full h-9 min-h-9 shrink-0", "rounded-none p-0 m-0 justify-start items-stretch"),
1174
+ children: tabs.map(({ icon: icon2, title }) => /* @__PURE__ */ jsxs9(TabsTrigger, {
1175
+ value: title,
1176
+ className: cn("rounded-none transition-colors duration-200 gap-1.5 px-3 font-mono justify-start grow-0", "border-r border-openpkg-code-border", "text-openpkg-code-text-inactive data-[state=active]:text-openpkg-code-text-active hover:text-openpkg-code-text-active", "data-[state=active]:bg-openpkg-code-bg/50"),
1177
+ children: [
1178
+ /* @__PURE__ */ jsx22("div", {
1179
+ children: icon2
1180
+ }),
1181
+ /* @__PURE__ */ jsx22("span", {
1182
+ className: "leading-none",
1183
+ children: title
1184
+ })
1185
+ ]
1186
+ }, title))
1058
1187
  }),
1059
- copyable && /* @__PURE__ */ jsx24("button", {
1060
- type: "button",
1061
- onClick: handleCopy,
1062
- className: cn("p-1.5 rounded text-[var(--openpkg-text-muted)] hover:text-[var(--openpkg-text-primary)]", "opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"),
1063
- "aria-label": "Copy path",
1064
- children: copied ? /* @__PURE__ */ jsx24(Check2, {
1065
- size: 14
1066
- }) : /* @__PURE__ */ jsx24(Copy2, {
1067
- size: 14
1068
- })
1188
+ /* @__PURE__ */ jsxs9(TabsContent, {
1189
+ value: current.title,
1190
+ className: "relative min-h-0 mt-0 flex flex-col",
1191
+ children: [
1192
+ /* @__PURE__ */ jsx22(Pre, {
1193
+ code: current.highlighted,
1194
+ className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current max-h-full flex-1",
1195
+ style: highlightedStyle,
1196
+ handlers
1197
+ }),
1198
+ groupOptions.copyButton && /* @__PURE__ */ jsx22(CopyButton, {
1199
+ text: current.highlighted.code,
1200
+ variant: "floating",
1201
+ className: "absolute right-3 top-3 z-10 text-openpkg-code-text-inactive"
1202
+ })
1203
+ ]
1069
1204
  })
1070
1205
  ]
1071
1206
  });
1072
- });
1073
- EndpointHeader.displayName = "EndpointHeader";
1074
- // src/docskit/api/parameter-item.tsx
1075
- import { Check as Check3, ChevronRight, Copy as Copy3 } from "lucide-react";
1076
- import { useState as useState5 } from "react";
1077
- import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
1207
+ }
1078
1208
 
1079
- function NestedProperty({
1080
- name,
1081
- schema,
1082
- required = false,
1083
- depth = 0
1209
+ // src/docskit/api/language-selector.tsx
1210
+ import { ChevronDown } from "lucide-react";
1211
+ import * as React3 from "react";
1212
+ import { jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
1213
+
1214
+ function LanguageSelector({
1215
+ languages,
1216
+ value,
1217
+ onChange,
1218
+ className
1084
1219
  }) {
1085
- const [expanded, setExpanded] = useState5(false);
1086
- const [copied, copy] = useCopyToClipboard();
1087
- const type = schema.typeString ?? schema.type ?? "unknown";
1088
- const hasNested = schema.properties && Object.keys(schema.properties).length > 0;
1089
- const _nestedCount = hasNested && schema.properties ? Object.keys(schema.properties).length : 0;
1090
- return /* @__PURE__ */ jsxs14("div", {
1091
- className: cn("border-t border-[var(--openpkg-border-subtle)] first:border-t-0", depth > 0 && "ml-4"),
1220
+ const [open, setOpen] = React3.useState(false);
1221
+ const containerRef = React3.useRef(null);
1222
+ const selectedLanguage = languages.find((l) => l.id === value);
1223
+ React3.useEffect(() => {
1224
+ const handleClickOutside = (e) => {
1225
+ if (containerRef.current && !containerRef.current.contains(e.target)) {
1226
+ setOpen(false);
1227
+ }
1228
+ };
1229
+ document.addEventListener("mousedown", handleClickOutside);
1230
+ return () => document.removeEventListener("mousedown", handleClickOutside);
1231
+ }, []);
1232
+ return /* @__PURE__ */ jsxs10("div", {
1233
+ ref: containerRef,
1234
+ className: cn("relative", className),
1092
1235
  children: [
1093
- /* @__PURE__ */ jsx25("div", {
1094
- className: "group py-4",
1095
- children: /* @__PURE__ */ jsxs14("div", {
1096
- className: "flex items-start gap-2",
1097
- children: [
1098
- hasNested ? /* @__PURE__ */ jsx25("button", {
1099
- type: "button",
1100
- onClick: () => setExpanded(!expanded),
1101
- className: "mt-0.5 p-0.5 text-[var(--openpkg-text-muted)] hover:text-[var(--openpkg-text-primary)] transition-colors cursor-pointer",
1102
- "aria-label": expanded ? "Collapse" : "Expand",
1103
- children: /* @__PURE__ */ jsx25(ChevronRight, {
1104
- size: 14,
1105
- className: cn("transition-transform duration-200", expanded && "rotate-90")
1106
- })
1107
- }) : /* @__PURE__ */ jsx25("div", {
1108
- className: "w-5"
1109
- }),
1110
- /* @__PURE__ */ jsxs14("div", {
1111
- className: "flex-1 min-w-0",
1112
- children: [
1113
- /* @__PURE__ */ jsxs14("div", {
1114
- className: "flex items-center gap-2 flex-wrap",
1115
- children: [
1116
- /* @__PURE__ */ jsxs14("span", {
1117
- className: "font-mono text-sm font-medium text-[var(--openpkg-text-primary)]",
1118
- children: [
1119
- name,
1120
- !required && /* @__PURE__ */ jsx25("span", {
1121
- className: "text-[var(--openpkg-text-muted)]",
1122
- children: "?"
1123
- })
1124
- ]
1125
- }),
1126
- /* @__PURE__ */ jsx25("span", {
1127
- className: "font-mono text-xs text-[var(--openpkg-text-muted)]",
1128
- children: type
1129
- }),
1130
- hasNested && /* @__PURE__ */ jsx25("button", {
1131
- type: "button",
1132
- onClick: () => setExpanded(!expanded),
1133
- className: "text-xs text-[var(--openpkg-accent-link)] hover:underline cursor-pointer",
1134
- children: "Show child parameters"
1135
- }),
1136
- /* @__PURE__ */ jsx25("button", {
1137
- type: "button",
1138
- onClick: () => copy(name),
1139
- className: "p-1 rounded text-[var(--openpkg-text-muted)] hover:text-[var(--openpkg-text-primary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
1140
- "aria-label": "Copy name",
1141
- children: copied ? /* @__PURE__ */ jsx25(Check3, {
1142
- size: 12
1143
- }) : /* @__PURE__ */ jsx25(Copy3, {
1144
- size: 12
1145
- })
1146
- })
1147
- ]
1148
- }),
1149
- schema.description && /* @__PURE__ */ jsx25("p", {
1150
- className: "text-sm text-[var(--openpkg-text-muted)] mt-1",
1151
- children: schema.description
1152
- })
1153
- ]
1154
- })
1155
- ]
1156
- })
1236
+ /* @__PURE__ */ jsxs10("button", {
1237
+ type: "button",
1238
+ onClick: () => setOpen(!open),
1239
+ className: cn("flex items-center gap-1.5 px-2.5 py-1.5 rounded-md text-sm font-medium", "bg-muted/50 hover:bg-muted text-foreground transition-colors cursor-pointer"),
1240
+ children: [
1241
+ selectedLanguage?.label ?? value,
1242
+ /* @__PURE__ */ jsx23(ChevronDown, {
1243
+ size: 14,
1244
+ className: cn("transition-transform", open && "rotate-180")
1245
+ })
1246
+ ]
1157
1247
  }),
1158
- hasNested && expanded && schema.properties && /* @__PURE__ */ jsx25("div", {
1159
- className: "border-l border-[var(--openpkg-border-subtle)] ml-2 mb-3",
1160
- children: Object.entries(schema.properties).map(([propName, propSchema]) => /* @__PURE__ */ jsx25(NestedProperty, {
1161
- name: propName,
1162
- schema: propSchema,
1163
- required: schema.required?.includes(propName),
1164
- depth: depth + 1
1165
- }, propName))
1248
+ open && /* @__PURE__ */ jsx23("div", {
1249
+ className: cn("absolute top-full left-0 mt-1 z-50 min-w-[120px]", "bg-popover border border-border rounded-md shadow-lg overflow-hidden"),
1250
+ children: languages.map((lang) => /* @__PURE__ */ jsx23("button", {
1251
+ type: "button",
1252
+ onClick: () => {
1253
+ onChange(lang.id);
1254
+ setOpen(false);
1255
+ },
1256
+ className: cn("w-full px-3 py-2 text-sm text-left transition-colors cursor-pointer", lang.id === value ? "bg-primary/10 text-primary" : "text-foreground hover:bg-muted"),
1257
+ children: lang.label
1258
+ }, lang.id))
1166
1259
  })
1167
1260
  ]
1168
1261
  });
1169
1262
  }
1170
- function APIParameterItem({
1171
- name,
1172
- type,
1173
- required = false,
1174
- description,
1175
- children,
1176
- depth = 0,
1263
+
1264
+ // src/docskit/api/api-code-panel.tsx
1265
+ import { jsx as jsx24, jsxs as jsxs11 } from "react/jsx-runtime";
1266
+
1267
+ function APICodePanel({
1268
+ languages,
1269
+ examples,
1270
+ externalLink,
1271
+ title,
1177
1272
  className
1178
1273
  }) {
1179
- const [expanded, setExpanded] = useState5(false);
1180
- const [copied, copy] = useCopyToClipboard();
1181
- const hasNested = children?.properties && Object.keys(children.properties).length > 0;
1182
- const _nestedCount = hasNested && children?.properties ? Object.keys(children.properties).length : 0;
1183
- return /* @__PURE__ */ jsxs14("div", {
1184
- className: cn("border-b border-[var(--openpkg-border-subtle)] last:border-b-0", className),
1274
+ const [selectedLang, setSelectedLang] = useState5(examples[0]?.languageId ?? languages[0]?.id);
1275
+ const currentExample = examples.find((e) => e.languageId === selectedLang);
1276
+ const code = currentExample?.code ?? "";
1277
+ const lang = currentExample?.highlightLang ?? currentExample?.languageId ?? "txt";
1278
+ const metaTitle = title ?? "";
1279
+ const meta = metaTitle ? `${metaTitle} -c` : "-c";
1280
+ return /* @__PURE__ */ jsxs11("div", {
1281
+ className: cn("sticky top-20", className),
1185
1282
  children: [
1186
- /* @__PURE__ */ jsx25("div", {
1187
- className: "group py-4",
1188
- children: /* @__PURE__ */ jsxs14("div", {
1189
- className: "flex items-start gap-2",
1190
- children: [
1191
- hasNested ? /* @__PURE__ */ jsx25("button", {
1192
- type: "button",
1193
- onClick: () => setExpanded(!expanded),
1194
- className: "mt-0.5 p-0.5 text-[var(--openpkg-text-muted)] hover:text-[var(--openpkg-text-primary)] transition-colors cursor-pointer",
1195
- "aria-label": expanded ? "Collapse" : "Expand",
1196
- children: /* @__PURE__ */ jsx25(ChevronRight, {
1197
- size: 14,
1198
- className: cn("transition-transform duration-200", expanded && "rotate-90")
1199
- })
1200
- }) : /* @__PURE__ */ jsx25("div", {
1201
- className: "w-5"
1202
- }),
1203
- /* @__PURE__ */ jsxs14("div", {
1204
- className: "flex-1 min-w-0",
1205
- children: [
1206
- /* @__PURE__ */ jsxs14("div", {
1207
- className: "flex items-center gap-2 flex-wrap",
1208
- children: [
1209
- /* @__PURE__ */ jsx25("span", {
1210
- className: "font-mono text-sm font-medium text-[var(--openpkg-text-primary)]",
1211
- children: name
1212
- }),
1213
- required && /* @__PURE__ */ jsx25("span", {
1214
- className: "text-[10px] font-semibold px-1.5 py-0.5 rounded border border-[var(--openpkg-border-subtle)] bg-[var(--openpkg-bg-badge)] text-[var(--openpkg-text-muted)] uppercase tracking-wide",
1215
- children: "Required"
1216
- }),
1217
- /* @__PURE__ */ jsx25("span", {
1218
- className: "font-mono text-xs text-[var(--openpkg-text-muted)]",
1219
- children: type
1220
- }),
1221
- hasNested && /* @__PURE__ */ jsx25("button", {
1222
- type: "button",
1223
- onClick: () => setExpanded(!expanded),
1224
- className: "text-xs text-[var(--openpkg-accent-link)] hover:underline cursor-pointer",
1225
- children: "Show child parameters"
1226
- }),
1227
- /* @__PURE__ */ jsx25("button", {
1228
- type: "button",
1229
- onClick: () => copy(name),
1230
- className: "p-1 rounded text-[var(--openpkg-text-muted)] hover:text-[var(--openpkg-text-primary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
1231
- "aria-label": "Copy name",
1232
- children: copied ? /* @__PURE__ */ jsx25(Check3, {
1233
- size: 12
1234
- }) : /* @__PURE__ */ jsx25(Copy3, {
1235
- size: 12
1236
- })
1237
- })
1238
- ]
1239
- }),
1240
- description && /* @__PURE__ */ jsx25("p", {
1241
- className: "text-sm text-[var(--openpkg-text-muted)] mt-1",
1242
- children: description
1243
- })
1244
- ]
1245
- })
1246
- ]
1283
+ languages.length > 1 && /* @__PURE__ */ jsx24("div", {
1284
+ className: "flex items-center gap-2 mb-2",
1285
+ children: /* @__PURE__ */ jsx24(LanguageSelector, {
1286
+ languages,
1287
+ value: selectedLang,
1288
+ onChange: setSelectedLang
1247
1289
  })
1248
1290
  }),
1249
- hasNested && expanded && children?.properties && /* @__PURE__ */ jsx25("div", {
1250
- className: "border-l border-[var(--openpkg-border-subtle)] ml-2 mb-3",
1251
- children: Object.entries(children.properties).map(([propName, propSchema]) => /* @__PURE__ */ jsx25(NestedProperty, {
1252
- name: propName,
1253
- schema: propSchema,
1254
- required: children.required?.includes(propName),
1255
- depth: depth + 1
1256
- }, propName))
1291
+ /* @__PURE__ */ jsx24(ClientDocsKitCode, {
1292
+ codeblock: {
1293
+ value: code,
1294
+ lang: lang === "curl" ? "bash" : lang,
1295
+ meta
1296
+ }
1257
1297
  })
1258
1298
  ]
1259
1299
  });
1260
1300
  }
1261
- // src/docskit/api/parameter-list.tsx
1262
- import { ChevronDown as ChevronDown2 } from "lucide-react";
1263
- import * as React5 from "react";
1264
- import { useState as useState6 } from "react";
1265
- import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
1301
+ // src/docskit/api/api-reference-layout.tsx
1302
+ import { jsx as jsx25, jsxs as jsxs12 } from "react/jsx-runtime";
1266
1303
 
1267
- function ParameterList({
1268
- title,
1269
- collapseAfter,
1304
+ function APIReferenceLayout({
1270
1305
  children,
1271
- className
1306
+ examples,
1307
+ className,
1308
+ leftWidth = "58%",
1309
+ rightWidth = "42%"
1272
1310
  }) {
1273
- const [expanded, setExpanded] = useState6(false);
1274
- const childArray = React5.Children.toArray(children);
1275
- const shouldCollapse = collapseAfter !== undefined && childArray.length > collapseAfter;
1276
- const visibleChildren = shouldCollapse && !expanded ? childArray.slice(0, collapseAfter) : childArray;
1277
- const hiddenCount = shouldCollapse ? childArray.length - collapseAfter : 0;
1278
- return /* @__PURE__ */ jsxs15("div", {
1279
- className: cn("", className),
1311
+ return /* @__PURE__ */ jsxs12("div", {
1312
+ className: cn("openpkg-api-layout", "max-w-[1600px] mx-auto", "flex flex-col", "lg:grid", className),
1313
+ style: {
1314
+ "--openpkg-left-width": leftWidth,
1315
+ "--openpkg-right-width": rightWidth
1316
+ },
1280
1317
  children: [
1281
- title && /* @__PURE__ */ jsx26("h3", {
1282
- className: "text-sm font-medium text-[var(--openpkg-text-primary)] mb-3 uppercase tracking-wide",
1283
- children: title
1284
- }),
1285
- /* @__PURE__ */ jsx26("div", {
1286
- className: "divide-y divide-[var(--openpkg-border-subtle)] border-t border-b border-[var(--openpkg-border-subtle)]",
1287
- children: visibleChildren
1318
+ /* @__PURE__ */ jsx25("div", {
1319
+ className: cn("openpkg-api-layout-left", "py-8 px-4", "sm:py-10 sm:px-6", "lg:py-12 lg:px-12 lg:pl-16", "lg:border-r lg:border-[var(--openpkg-border-subtle)]", "bg-[var(--openpkg-bg-root)]", "openpkg-animate-fade-in"),
1320
+ style: { gridColumn: "1" },
1321
+ children
1288
1322
  }),
1289
- shouldCollapse && !expanded && /* @__PURE__ */ jsxs15("button", {
1290
- type: "button",
1291
- onClick: () => setExpanded(true),
1292
- className: "flex items-center gap-1 mt-3 text-sm text-[var(--openpkg-accent-link)] hover:underline cursor-pointer",
1293
- children: [
1294
- /* @__PURE__ */ jsx26(ChevronDown2, {
1295
- size: 14
1296
- }),
1297
- "Show ",
1298
- hiddenCount,
1299
- " more ",
1300
- hiddenCount === 1 ? "parameter" : "parameters"
1301
- ]
1323
+ /* @__PURE__ */ jsx25("div", {
1324
+ className: cn("openpkg-api-layout-right", "border-t border-[var(--openpkg-border-subtle)] lg:border-t-0", "py-8 px-4", "sm:py-10 sm:px-6", "lg:sticky lg:top-0 lg:h-screen lg:overflow-y-auto", "lg:py-12 lg:px-12 lg:pl-8", "bg-[var(--openpkg-bg-root)]", "openpkg-animate-fade-in"),
1325
+ style: {
1326
+ gridColumn: "2",
1327
+ animationDelay: "100ms"
1328
+ },
1329
+ children: examples
1302
1330
  })
1303
1331
  ]
1304
1332
  });
1305
1333
  }
1306
- // src/docskit/api/response-block.tsx
1307
- import { Check as Check4, Copy as Copy4 } from "lucide-react";
1308
- import * as React6 from "react";
1309
- import { jsx as jsx27, jsxs as jsxs16, Fragment as Fragment4 } from "react/jsx-runtime";
1334
+ // src/docskit/api/api-reference-page.tsx
1335
+ import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
1310
1336
 
1311
- function ResponseBlock({ data, title, className }) {
1312
- const [copied, copy] = useCopyToClipboard();
1313
- const jsonString = JSON.stringify(data, null, 2);
1314
- const handleCopy = () => {
1315
- copy(jsonString);
1316
- };
1317
- return /* @__PURE__ */ jsxs16("div", {
1318
- className: cn("group rounded-lg border border-[var(--openpkg-border-subtle)] overflow-hidden bg-[var(--openpkg-bg-secondary)]", className),
1337
+ function APIReferencePage({
1338
+ title,
1339
+ description,
1340
+ children,
1341
+ className
1342
+ }) {
1343
+ return /* @__PURE__ */ jsxs13("div", {
1344
+ className: cn("max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", className),
1319
1345
  children: [
1320
- title && /* @__PURE__ */ jsxs16("div", {
1321
- className: "flex items-center justify-between px-4 py-2 border-b border-[var(--openpkg-border-subtle)] bg-[var(--openpkg-bg-tertiary)]",
1346
+ /* @__PURE__ */ jsxs13("header", {
1347
+ className: "py-8 border-b border-border",
1322
1348
  children: [
1323
- /* @__PURE__ */ jsx27("span", {
1324
- className: "text-xs font-medium text-[var(--openpkg-text-muted)] uppercase tracking-wide",
1349
+ /* @__PURE__ */ jsx26("h1", {
1350
+ className: "text-3xl font-bold text-foreground",
1325
1351
  children: title
1326
1352
  }),
1327
- /* @__PURE__ */ jsx27("button", {
1328
- type: "button",
1329
- onClick: handleCopy,
1330
- className: "p-1 rounded text-[var(--openpkg-text-muted)] hover:text-[var(--openpkg-text-primary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
1331
- "aria-label": "Copy response",
1332
- children: copied ? /* @__PURE__ */ jsx27(Check4, {
1333
- size: 14
1334
- }) : /* @__PURE__ */ jsx27(Copy4, {
1335
- size: 14
1336
- })
1353
+ description && /* @__PURE__ */ jsx26("div", {
1354
+ className: "mt-4 text-lg text-muted-foreground prose prose-lg dark:prose-invert max-w-none",
1355
+ children: description
1337
1356
  })
1338
1357
  ]
1339
1358
  }),
1340
- /* @__PURE__ */ jsxs16("div", {
1341
- className: "relative",
1342
- children: [
1343
- /* @__PURE__ */ jsx27("pre", {
1344
- className: "p-4 overflow-auto text-sm font-mono leading-relaxed",
1345
- children: /* @__PURE__ */ jsx27("code", {
1346
- children: /* @__PURE__ */ jsx27(JsonHighlight, {
1347
- json: data
1348
- })
1349
- })
1350
- }),
1351
- !title && /* @__PURE__ */ jsx27("button", {
1352
- type: "button",
1353
- onClick: handleCopy,
1354
- className: "absolute top-3 right-3 p-1.5 rounded text-[var(--openpkg-text-muted)] hover:text-[var(--openpkg-text-primary)] opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
1355
- "aria-label": "Copy response",
1356
- children: copied ? /* @__PURE__ */ jsx27(Check4, {
1357
- size: 14
1358
- }) : /* @__PURE__ */ jsx27(Copy4, {
1359
- size: 14
1360
- })
1361
- })
1362
- ]
1359
+ /* @__PURE__ */ jsx26("div", {
1360
+ children
1363
1361
  })
1364
1362
  ]
1365
1363
  });
1366
1364
  }
1367
- function JsonHighlight({ json, depth = 0 }) {
1368
- const indent = " ".repeat(depth);
1369
- const nextIndent = " ".repeat(depth + 1);
1370
- if (json === null) {
1371
- return /* @__PURE__ */ jsx27("span", {
1372
- className: "text-[var(--openpkg-syn-number)]",
1373
- children: "null"
1374
- });
1375
- }
1376
- if (typeof json === "boolean") {
1377
- return /* @__PURE__ */ jsx27("span", {
1378
- className: "text-[var(--openpkg-syn-boolean)]",
1379
- children: json ? "true" : "false"
1380
- });
1381
- }
1382
- if (typeof json === "number") {
1383
- return /* @__PURE__ */ jsx27("span", {
1384
- className: "text-[var(--openpkg-syn-number)]",
1385
- children: json
1386
- });
1387
- }
1388
- if (typeof json === "string") {
1389
- return /* @__PURE__ */ jsxs16("span", {
1390
- className: "text-[var(--openpkg-syn-string)]",
1391
- children: [
1392
- '"',
1393
- json,
1394
- '"'
1395
- ]
1396
- });
1397
- }
1398
- if (Array.isArray(json)) {
1399
- if (json.length === 0) {
1400
- return /* @__PURE__ */ jsx27("span", {
1401
- className: "text-[var(--openpkg-syn-punctuation)]",
1402
- children: "[]"
1403
- });
1404
- }
1405
- return /* @__PURE__ */ jsxs16(Fragment4, {
1406
- children: [
1407
- /* @__PURE__ */ jsx27("span", {
1408
- className: "text-[var(--openpkg-syn-punctuation)]",
1409
- children: "["
1410
- }),
1411
- `
1412
- `,
1413
- json.map((item, i) => /* @__PURE__ */ jsxs16(React6.Fragment, {
1414
- children: [
1415
- nextIndent,
1416
- /* @__PURE__ */ jsx27(JsonHighlight, {
1417
- json: item,
1418
- depth: depth + 1
1419
- }),
1420
- i < json.length - 1 && /* @__PURE__ */ jsx27("span", {
1421
- className: "text-[var(--openpkg-syn-punctuation)]",
1422
- children: ","
1423
- }),
1424
- `
1425
- `
1426
- ]
1427
- }, i)),
1428
- indent,
1429
- /* @__PURE__ */ jsx27("span", {
1430
- className: "text-[var(--openpkg-syn-punctuation)]",
1431
- children: "]"
1432
- })
1433
- ]
1434
- });
1435
- }
1436
- if (typeof json === "object") {
1437
- const entries = Object.entries(json);
1438
- if (entries.length === 0) {
1439
- return /* @__PURE__ */ jsx27("span", {
1440
- className: "text-[var(--openpkg-syn-punctuation)]",
1441
- children: "{}"
1442
- });
1443
- }
1444
- return /* @__PURE__ */ jsxs16(Fragment4, {
1365
+ // src/docskit/api/api-section.tsx
1366
+ import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
1367
+
1368
+ function APISection({
1369
+ title,
1370
+ id,
1371
+ description,
1372
+ children,
1373
+ languages,
1374
+ examples,
1375
+ externalLink,
1376
+ codePanelTitle,
1377
+ className
1378
+ }) {
1379
+ return /* @__PURE__ */ jsx27("section", {
1380
+ id,
1381
+ className: cn("py-8 border-b border-border last:border-b-0", className),
1382
+ children: /* @__PURE__ */ jsxs14("div", {
1383
+ className: "grid grid-cols-1 lg:grid-cols-2 gap-8 lg:gap-12",
1445
1384
  children: [
1446
- /* @__PURE__ */ jsx27("span", {
1447
- className: "text-[var(--openpkg-syn-punctuation)]",
1448
- children: "{"
1449
- }),
1450
- `
1451
- `,
1452
- entries.map(([key, value], i) => /* @__PURE__ */ jsxs16(React6.Fragment, {
1385
+ /* @__PURE__ */ jsxs14("div", {
1386
+ className: "space-y-6",
1453
1387
  children: [
1454
- nextIndent,
1455
- /* @__PURE__ */ jsxs16("span", {
1456
- className: "text-[var(--openpkg-syn-property)]",
1388
+ /* @__PURE__ */ jsxs14("div", {
1457
1389
  children: [
1458
- '"',
1459
- key,
1460
- '"'
1461
- ]
1462
- }),
1463
- /* @__PURE__ */ jsx27("span", {
1464
- className: "text-[var(--openpkg-syn-punctuation)]",
1465
- children: ": "
1466
- }),
1467
- /* @__PURE__ */ jsx27(JsonHighlight, {
1468
- json: value,
1469
- depth: depth + 1
1470
- }),
1471
- i < entries.length - 1 && /* @__PURE__ */ jsx27("span", {
1472
- className: "text-[var(--openpkg-syn-punctuation)]",
1473
- children: ","
1390
+ /* @__PURE__ */ jsx27("h2", {
1391
+ className: "text-2xl font-semibold text-foreground",
1392
+ children: title
1393
+ }),
1394
+ description && /* @__PURE__ */ jsx27("div", {
1395
+ className: "mt-3 text-muted-foreground prose prose-sm dark:prose-invert",
1396
+ children: description
1397
+ })
1398
+ ]
1474
1399
  }),
1475
- `
1476
- `
1400
+ children
1477
1401
  ]
1478
- }, key)),
1479
- indent,
1480
- /* @__PURE__ */ jsx27("span", {
1481
- className: "text-[var(--openpkg-syn-punctuation)]",
1482
- children: "}"
1402
+ }),
1403
+ /* @__PURE__ */ jsx27("div", {
1404
+ className: "lg:pl-4",
1405
+ children: /* @__PURE__ */ jsx27(APICodePanel, {
1406
+ languages,
1407
+ examples,
1408
+ externalLink,
1409
+ title: codePanelTitle,
1410
+ className: "max-h-[400px] lg:max-h-none"
1411
+ })
1483
1412
  })
1484
1413
  ]
1485
- });
1486
- }
1487
- return /* @__PURE__ */ jsx27("span", {
1488
- className: "text-[var(--openpkg-text-primary)]",
1489
- children: String(json)
1414
+ })
1490
1415
  });
1491
1416
  }
1492
- // src/docskit/code.tsx
1493
- import { highlight as highlight2, Pre as Pre2 } from "codehike/code";
1494
-
1495
- // src/docskit/code.copy.tsx
1496
- import { Check as Check5, Copy as Copy5 } from "lucide-react";
1417
+ // src/docskit/api/code-block.tsx
1497
1418
  import { jsx as jsx28 } from "react/jsx-runtime";
1498
1419
 
1499
- function CopyButton({
1500
- text,
1501
- className,
1502
- variant = "floating"
1420
+ function CodeBlock({
1421
+ code,
1422
+ language = "typescript",
1423
+ showLineNumbers = false,
1424
+ className
1503
1425
  }) {
1504
- const [copied, copy] = useCopyToClipboard();
1505
- return /* @__PURE__ */ jsx28("button", {
1506
- type: "button",
1507
- className: cn("cursor-pointer transition-opacity duration-200", variant === "floating" && [
1508
- "size-8 flex items-center justify-center",
1509
- "rounded border border-dk-border bg-dk-background",
1510
- "opacity-0 group-hover:opacity-100"
1511
- ], variant === "inline" && "rounded", className),
1512
- onClick: () => copy(text),
1513
- "aria-label": "Copy to clipboard",
1514
- children: copied ? /* @__PURE__ */ jsx28(Check5, {
1515
- size: 16,
1516
- className: "block"
1517
- }) : /* @__PURE__ */ jsx28(Copy5, {
1518
- size: 16,
1519
- className: "block"
1520
- })
1426
+ const flags = `-c${showLineNumbers ? "n" : ""}`;
1427
+ return /* @__PURE__ */ jsx28(ClientDocsKitCode, {
1428
+ codeblock: {
1429
+ value: code,
1430
+ lang: language,
1431
+ meta: flags
1432
+ },
1433
+ className: cn("my-0 border-[var(--openpkg-border-subtle)]", className)
1521
1434
  });
1522
1435
  }
1436
+ // src/docskit/api/collapsible-panel.tsx
1437
+ import { ChevronRight } from "lucide-react";
1438
+ import { useId as useId2, useState as useState6 } from "react";
1439
+ import { jsx as jsx29, jsxs as jsxs15 } from "react/jsx-runtime";
1523
1440
 
1524
- // src/docskit/code.icon.tsx
1525
- import { TerminalIcon } from "lucide-react";
1526
- import { themeIcons } from "seti-icons";
1527
- import { jsx as jsx29 } from "react/jsx-runtime";
1528
- function CodeIcon({
1441
+ function CollapsiblePanel({
1529
1442
  title,
1530
- lang,
1443
+ children,
1444
+ defaultExpanded = false,
1445
+ expanded: controlledExpanded,
1446
+ onExpandedChange,
1531
1447
  className
1532
1448
  }) {
1533
- if (title?.toLowerCase() === "terminal output" || title?.toLowerCase() === "terminal" || lang === "sh" || lang === "shell" || lang === "bash") {
1534
- return /* @__PURE__ */ jsx29(TerminalIcon, {
1535
- size: 16,
1536
- className,
1537
- style: { marginTop: -3.5 }
1538
- });
1539
- }
1540
- const ext = lang === "rust" ? "rs" : lang === "typescript" ? "ts" : lang;
1541
- const filename = `x.${ext}`;
1542
- const { svg } = getIcon(filename);
1543
- const __html = svg.replace(/svg/, `svg fill='currentColor' style='margin: -4px; height: 24px; width: 24px;'`);
1544
- return /* @__PURE__ */ jsx29("span", {
1545
- className,
1546
- children: /* @__PURE__ */ jsx29("span", {
1547
- dangerouslySetInnerHTML: { __html },
1548
- style: { display: "contents" }
1549
- })
1449
+ const [internalExpanded, setInternalExpanded] = useState6(defaultExpanded);
1450
+ const isControlled = controlledExpanded !== undefined;
1451
+ const expanded = isControlled ? controlledExpanded : internalExpanded;
1452
+ const contentId = useId2();
1453
+ const toggle = () => {
1454
+ const next = !expanded;
1455
+ if (isControlled) {
1456
+ onExpandedChange?.(next);
1457
+ } else {
1458
+ setInternalExpanded(next);
1459
+ }
1460
+ };
1461
+ return /* @__PURE__ */ jsxs15("div", {
1462
+ className: cn("openpkg-collapsible-panel", className),
1463
+ children: [
1464
+ /* @__PURE__ */ jsxs15("button", {
1465
+ type: "button",
1466
+ onClick: toggle,
1467
+ "aria-expanded": expanded,
1468
+ "aria-controls": contentId,
1469
+ className: cn("openpkg-collapsible-trigger", "flex items-center gap-2.5 w-full", "px-4 py-3", "bg-[var(--openpkg-bg-collapsible)]", "border border-[var(--openpkg-border-subtle)]", "rounded-md", "cursor-pointer", "transition-all duration-150", "hover:bg-[var(--openpkg-bg-tertiary)]", expanded && "rounded-b-none border-b-transparent mb-0", !expanded && "mb-2"),
1470
+ children: [
1471
+ /* @__PURE__ */ jsx29(ChevronRight, {
1472
+ size: 14,
1473
+ className: cn("text-[var(--openpkg-text-muted)]", "transition-transform duration-200", expanded && "rotate-90")
1474
+ }),
1475
+ /* @__PURE__ */ jsx29("span", {
1476
+ className: "text-[13px] font-medium text-[var(--openpkg-text-secondary)]",
1477
+ children: title
1478
+ })
1479
+ ]
1480
+ }),
1481
+ /* @__PURE__ */ jsx29("div", {
1482
+ id: contentId,
1483
+ role: "region",
1484
+ className: cn("openpkg-collapsible-content", "grid transition-[grid-template-rows,opacity] duration-200 ease-out", expanded ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0"),
1485
+ children: /* @__PURE__ */ jsx29("div", {
1486
+ className: cn("min-h-0 overflow-hidden", "bg-[var(--openpkg-bg-code)]", "border border-[var(--openpkg-border-subtle)]", "border-t-0", "rounded-b-md", "mb-2"),
1487
+ children
1488
+ })
1489
+ })
1490
+ ]
1550
1491
  });
1551
1492
  }
1552
- var getIcon = themeIcons({
1553
- white: "#d4d7d6",
1554
- grey: "#4d5a5e",
1555
- "grey-light": "#6d8086",
1556
- blue: "#519aba",
1557
- green: "#8dc149",
1558
- orange: "#e37933",
1559
- pink: "#f55385",
1560
- purple: "#a074c4",
1561
- red: "#cc3e44",
1562
- yellow: "#cbcb41",
1563
- ignore: "#41535b"
1493
+ // src/docskit/api/endpoint-badge.tsx
1494
+ import { cva } from "class-variance-authority";
1495
+ import * as React4 from "react";
1496
+ import { jsx as jsx30 } from "react/jsx-runtime";
1497
+ var endpointBadgeVariants = cva("inline-flex items-center justify-center font-mono font-bold uppercase tracking-wide rounded shrink-0", {
1498
+ variants: {
1499
+ method: {
1500
+ GET: "bg-emerald-500/15 text-emerald-500",
1501
+ POST: "bg-blue-500/15 text-blue-500",
1502
+ PUT: "bg-amber-500/15 text-amber-500",
1503
+ DELETE: "bg-rose-500/15 text-rose-500",
1504
+ PATCH: "bg-violet-500/15 text-violet-500"
1505
+ },
1506
+ size: {
1507
+ sm: "h-5 px-1.5 text-[10px]",
1508
+ md: "h-6 px-2 text-xs"
1509
+ }
1510
+ },
1511
+ defaultVariants: {
1512
+ method: "GET",
1513
+ size: "md"
1514
+ }
1515
+ });
1516
+ var EndpointBadge = React4.forwardRef(({ className, method, size, ...props }, ref) => {
1517
+ return /* @__PURE__ */ jsx30("span", {
1518
+ ref,
1519
+ className: cn(endpointBadgeVariants({ method, size, className })),
1520
+ ...props,
1521
+ children: method
1522
+ });
1564
1523
  });
1524
+ EndpointBadge.displayName = "EndpointBadge";
1525
+ // src/docskit/api/endpoint-header.tsx
1526
+ import { Check as Check2, Copy as Copy2 } from "lucide-react";
1527
+ import * as React5 from "react";
1528
+ import { useState as useState7 } from "react";
1529
+ import { jsx as jsx31, jsxs as jsxs16 } from "react/jsx-runtime";
1565
1530
 
1566
- // src/docskit/code.tsx
1567
- import { jsx as jsx30, jsxs as jsxs17 } from "react/jsx-runtime";
1568
- async function DocsKitCode(props) {
1569
- const { codeblock, className, ...rest } = props;
1570
- const group = await toCodeGroup({ codeblocks: [codeblock], ...rest });
1571
- return /* @__PURE__ */ jsx30(SingleCode, {
1572
- group,
1573
- className
1531
+ var EndpointHeader = React5.forwardRef(({ className, method, path, copyable = true, ...props }, ref) => {
1532
+ const [copied, setCopied] = useState7(false);
1533
+ const handleCopy = () => {
1534
+ navigator.clipboard.writeText(path);
1535
+ setCopied(true);
1536
+ setTimeout(() => setCopied(false), 1200);
1537
+ };
1538
+ return /* @__PURE__ */ jsxs16("div", {
1539
+ ref,
1540
+ className: cn("group flex items-center gap-3 py-2 px-3 rounded-lg bg-muted/50 border border-border", className),
1541
+ ...props,
1542
+ children: [
1543
+ /* @__PURE__ */ jsx31(EndpointBadge, {
1544
+ method
1545
+ }),
1546
+ /* @__PURE__ */ jsx31("code", {
1547
+ className: "font-mono text-sm text-foreground flex-1",
1548
+ children: path
1549
+ }),
1550
+ copyable && /* @__PURE__ */ jsx31("button", {
1551
+ type: "button",
1552
+ onClick: handleCopy,
1553
+ className: cn("p-1.5 rounded text-muted-foreground hover:text-foreground", "opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer"),
1554
+ "aria-label": "Copy path",
1555
+ children: copied ? /* @__PURE__ */ jsx31(Check2, {
1556
+ size: 14
1557
+ }) : /* @__PURE__ */ jsx31(Copy2, {
1558
+ size: 14
1559
+ })
1560
+ })
1561
+ ]
1574
1562
  });
1575
- }
1576
- async function SingleCode(props) {
1577
- const { pre, title, code, icon: icon2, options } = props.group.tabs[0];
1578
- const showCopy = options?.copyButton;
1563
+ });
1564
+ EndpointHeader.displayName = "EndpointHeader";
1565
+ // src/docskit/api/enum-values-section.tsx
1566
+ import { jsx as jsx32, jsxs as jsxs17 } from "react/jsx-runtime";
1567
+
1568
+ function EnumValuesSection({
1569
+ values,
1570
+ header = "Possible values",
1571
+ className
1572
+ }) {
1573
+ if (values.length === 0)
1574
+ return null;
1579
1575
  return /* @__PURE__ */ jsxs17("div", {
1580
- className: cn("group rounded overflow-hidden relative border-dk-border flex flex-col border my-4 not-prose", props.className),
1576
+ className: cn("openpkg-enum-section", "mt-3", className),
1581
1577
  children: [
1582
- title ? /* @__PURE__ */ jsx30("div", {
1583
- className: cn("border-b-[1px] border-dk-border bg-dk-tabs-background px-3 py-0", "w-full h-9 flex items-center shrink-0", "text-dk-tab-inactive-foreground text-sm font-mono"),
1584
- children: /* @__PURE__ */ jsxs17("div", {
1585
- className: "flex items-center h-5 gap-2",
1578
+ /* @__PURE__ */ jsx32("div", {
1579
+ className: cn("openpkg-enum-header", "text-[11px] font-medium", "text-[var(--openpkg-text-muted)]", "mb-2.5 pb-2", "border-b border-[var(--openpkg-border-subtle)]"),
1580
+ children: header
1581
+ }),
1582
+ /* @__PURE__ */ jsx32("div", {
1583
+ className: "openpkg-enum-values flex flex-col gap-0.5",
1584
+ children: values.map((item) => /* @__PURE__ */ jsxs17("div", {
1585
+ className: cn("openpkg-enum-value", "py-2.5 px-3", "bg-[var(--openpkg-bg-secondary)]", "rounded"),
1586
1586
  children: [
1587
- /* @__PURE__ */ jsx30("div", {
1588
- className: "size-4",
1589
- children: icon2
1587
+ /* @__PURE__ */ jsx32("span", {
1588
+ className: cn("openpkg-enum-value-name", "font-mono text-xs font-medium", "text-[var(--openpkg-syn-string)]", "bg-[var(--openpkg-bg-badge)]", "px-1.5 py-0.5 rounded", "inline-block mb-1"),
1589
+ children: item.value
1590
1590
  }),
1591
- /* @__PURE__ */ jsx30("span", {
1592
- className: "leading-none",
1593
- children: title
1591
+ item.description && /* @__PURE__ */ jsx32("p", {
1592
+ className: cn("openpkg-enum-value-description", "text-xs text-[var(--openpkg-text-secondary)]", "leading-relaxed", "[&_code]:font-mono [&_code]:text-[11px] [&_code]:bg-[var(--openpkg-bg-badge)] [&_code]:px-1 [&_code]:py-0.5 [&_code]:rounded"),
1593
+ children: item.description
1594
1594
  })
1595
1595
  ]
1596
- })
1597
- }) : null,
1598
- /* @__PURE__ */ jsxs17("div", {
1599
- className: "relative flex items-start",
1600
- children: [
1601
- pre,
1602
- showCopy && /* @__PURE__ */ jsx30(CopyButton, {
1603
- text: code,
1604
- variant: "floating",
1605
- className: cn("absolute right-3 z-10 text-dk-tab-inactive-foreground", title ? "top-3" : "top-1/2 -translate-y-1/2")
1606
- })
1607
- ]
1596
+ }, item.value))
1608
1597
  })
1609
1598
  ]
1610
1599
  });
1611
1600
  }
1612
- async function toCodeGroup(props) {
1613
- const rawFlags = props.flags?.startsWith("-") ? props.flags.slice(1) : props.flags;
1614
- const groupOptions = flagsToOptions(rawFlags);
1615
- const tabs = await Promise.all(props.codeblocks.map(async (tab) => {
1616
- const { flags, title } = extractFlags(tab);
1617
- const tabOptions = flagsToOptions(flags);
1618
- const options = { ...groupOptions, ...tabOptions };
1619
- const highlighted = await highlight2({ ...tab, lang: tab.lang || "txt" }, theme);
1620
- const handlers = getHandlers(options);
1621
- if (props.handlers) {
1622
- handlers.push(...props.handlers);
1623
- }
1624
- const { background: _background, ...highlightedStyle } = highlighted.style;
1625
- return {
1626
- options,
1627
- title,
1628
- code: highlighted.code,
1629
- icon: /* @__PURE__ */ jsx30(CodeIcon, {
1630
- title,
1631
- lang: tab.lang,
1632
- className: "opacity-60"
1633
- }),
1634
- lang: tab.lang,
1635
- pre: /* @__PURE__ */ jsx30(Pre2, {
1636
- code: highlighted,
1637
- className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-dk-background selection:bg-dk-selection selection:text-current max-h-full flex-1",
1638
- style: highlightedStyle,
1639
- handlers
1640
- })
1641
- };
1642
- }));
1643
- return {
1644
- storage: props.storage,
1645
- options: groupOptions,
1646
- tabs
1647
- };
1648
- }
1649
- function extractFlags(codeblock) {
1650
- const flags = codeblock.meta.split(" ").filter((flag) => flag.startsWith("-"))[0] ?? "";
1651
- const metaWithoutFlags = !flags ? codeblock.meta : codeblock.meta === flags ? "" : codeblock.meta.replace(` ${flags}`, "").trim();
1652
- const title = metaWithoutFlags.trim();
1653
- return { title, flags: flags.slice(1) };
1601
+ // src/docskit/api/example-chips.tsx
1602
+ import { jsx as jsx33 } from "react/jsx-runtime";
1603
+
1604
+ function ExampleChips({
1605
+ examples,
1606
+ activeId,
1607
+ onSelect,
1608
+ className
1609
+ }) {
1610
+ return /* @__PURE__ */ jsx33("div", {
1611
+ className: cn("openpkg-example-chips", "flex flex-wrap gap-2 mb-5", className),
1612
+ children: examples.map((example) => {
1613
+ const isActive = example.id === activeId;
1614
+ return /* @__PURE__ */ jsx33("button", {
1615
+ type: "button",
1616
+ onClick: () => onSelect(example.id),
1617
+ className: cn("openpkg-example-chip", "text-xs font-medium", "px-3 py-1.5", "border rounded-md", "cursor-pointer", "transition-all duration-150", isActive ? [
1618
+ "border-[var(--openpkg-border-chip-active)]",
1619
+ "text-[var(--openpkg-text-primary)]",
1620
+ "bg-[var(--openpkg-bg-tertiary)]"
1621
+ ] : [
1622
+ "border-[var(--openpkg-border-chip)]",
1623
+ "text-[var(--openpkg-text-secondary)]",
1624
+ "bg-transparent",
1625
+ "hover:border-[var(--openpkg-text-muted)]",
1626
+ "hover:text-[var(--openpkg-text-primary)]"
1627
+ ]),
1628
+ "aria-pressed": isActive,
1629
+ children: example.label
1630
+ }, example.id);
1631
+ })
1632
+ });
1654
1633
  }
1655
- // src/hooks/use-local-storage.ts
1656
- import React7 from "react";
1657
- function useStateOrLocalStorage(key, initialState) {
1658
- const [state, setState] = React7.useState(initialState);
1659
- React7.useLayoutEffect(() => {
1660
- if (!key)
1634
+ // src/docskit/api/example-section.tsx
1635
+ import { useEffect as useEffect4, useRef as useRef3, useState as useState9 } from "react";
1636
+
1637
+ // src/docskit/hooks/use-sync-scroll.tsx
1638
+ import {
1639
+ createContext as createContext2,
1640
+ useCallback,
1641
+ useContext as useContext2,
1642
+ useEffect as useEffect3,
1643
+ useMemo,
1644
+ useRef as useRef2,
1645
+ useState as useState8
1646
+ } from "react";
1647
+ import { jsx as jsx34 } from "react/jsx-runtime";
1648
+
1649
+ var SyncScrollContext = createContext2(null);
1650
+ function SyncScrollProvider({
1651
+ children,
1652
+ rootMargin = "-20% 0px -60% 0px",
1653
+ scrollBehavior = "smooth"
1654
+ }) {
1655
+ const [activeSection, setActiveSection] = useState8(null);
1656
+ const sectionsRef = useRef2(new Map);
1657
+ const rightColumnRef = useRef2(null);
1658
+ const isScrollingRef = useRef2(false);
1659
+ const registerSection = useCallback((id, ref) => {
1660
+ sectionsRef.current.set(id, ref);
1661
+ }, []);
1662
+ const unregisterSection = useCallback((id) => {
1663
+ sectionsRef.current.delete(id);
1664
+ }, []);
1665
+ const registerRightColumn = useCallback((ref) => {
1666
+ rightColumnRef.current = ref;
1667
+ }, []);
1668
+ const scrollToSection = useCallback((id) => {
1669
+ const rightColumn = rightColumnRef.current?.current;
1670
+ if (!rightColumn)
1661
1671
  return;
1662
- const storedValue = window.localStorage.getItem(key);
1663
- if (storedValue != null) {
1664
- setState(storedValue);
1672
+ const targetExample = rightColumn.querySelector(`[data-section="${id}"]`);
1673
+ if (targetExample instanceof HTMLElement) {
1674
+ const targetTop = targetExample.offsetTop - 48;
1675
+ rightColumn.scrollTo({ top: targetTop, behavior: scrollBehavior });
1665
1676
  }
1666
- const onStorageChange = (e) => {
1667
- if (e.key === key) {
1668
- const storedValue2 = window.localStorage.getItem(key);
1669
- setState(storedValue2 || initialState);
1677
+ }, [scrollBehavior]);
1678
+ useEffect3(() => {
1679
+ if (typeof window === "undefined")
1680
+ return;
1681
+ const handleIntersect = (entries) => {
1682
+ if (isScrollingRef.current)
1683
+ return;
1684
+ for (const entry of entries) {
1685
+ if (entry.isIntersecting) {
1686
+ const sectionId = entry.target.getAttribute("data-section");
1687
+ if (sectionId) {
1688
+ setActiveSection(sectionId);
1689
+ scrollToSection(sectionId);
1690
+ }
1691
+ break;
1692
+ }
1670
1693
  }
1671
1694
  };
1672
- window.addEventListener("storage", onStorageChange);
1673
- return () => window.removeEventListener("storage", onStorageChange);
1674
- }, [key, initialState]);
1675
- const setStorage = !key ? setState : (value) => {
1676
- if (typeof window !== "undefined") {
1677
- window.localStorage.setItem(key, value);
1678
- window.dispatchEvent(new StorageEvent("storage", { key }));
1695
+ const observer = new IntersectionObserver(handleIntersect, {
1696
+ rootMargin,
1697
+ threshold: 0
1698
+ });
1699
+ for (const [_id, ref] of sectionsRef.current) {
1700
+ if (ref.current) {
1701
+ observer.observe(ref.current);
1702
+ }
1679
1703
  }
1680
- };
1681
- return [state, setStorage];
1682
- }
1683
-
1684
- // src/docskit/tabs.tsx
1685
- import * as TabsPrimitive from "@radix-ui/react-tabs";
1686
- import { jsx as jsx31 } from "react/jsx-runtime";
1687
-
1688
- function Tabs({
1689
- className,
1690
- ...props
1691
- }) {
1692
- return /* @__PURE__ */ jsx31(TabsPrimitive.Root, {
1693
- "data-slot": "tabs",
1694
- className: cn("flex flex-col gap-2", className),
1695
- ...props
1704
+ return () => {
1705
+ observer.disconnect();
1706
+ };
1707
+ }, [rootMargin, scrollToSection]);
1708
+ const value = useMemo(() => ({
1709
+ activeSection,
1710
+ registerSection,
1711
+ unregisterSection,
1712
+ scrollToSection,
1713
+ registerRightColumn
1714
+ }), [activeSection, registerSection, unregisterSection, scrollToSection, registerRightColumn]);
1715
+ return /* @__PURE__ */ jsx34(SyncScrollContext.Provider, {
1716
+ value,
1717
+ children
1696
1718
  });
1697
1719
  }
1698
- function TabsList({
1699
- className,
1700
- ...props
1720
+ function useSyncScroll() {
1721
+ const context = useContext2(SyncScrollContext);
1722
+ if (!context) {
1723
+ throw new Error("useSyncScroll must be used within SyncScrollProvider");
1724
+ }
1725
+ return context;
1726
+ }
1727
+ function useSyncSection(id) {
1728
+ const { registerSection, unregisterSection } = useSyncScroll();
1729
+ const ref = useRef2(null);
1730
+ useEffect3(() => {
1731
+ registerSection(id, ref);
1732
+ return () => unregisterSection(id);
1733
+ }, [id, registerSection, unregisterSection]);
1734
+ return ref;
1735
+ }
1736
+
1737
+ // src/docskit/api/example-section.tsx
1738
+ import { jsx as jsx35, jsxs as jsxs18 } from "react/jsx-runtime";
1739
+
1740
+ function ExampleSection({
1741
+ id,
1742
+ examples,
1743
+ dataSource,
1744
+ response,
1745
+ notes,
1746
+ className
1701
1747
  }) {
1702
- return /* @__PURE__ */ jsx31(TabsPrimitive.List, {
1703
- "data-slot": "tabs-list",
1704
- className: cn("bg-[var(--openpkg-bg-secondary)] text-[var(--openpkg-text-muted)] inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]", className),
1705
- ...props
1748
+ const [activeExampleId, setActiveExampleId] = useState9(examples[0]?.id ?? "");
1749
+ const ref = useRef3(null);
1750
+ const syncScroll = useSyncScrollSafe();
1751
+ const activeExample = examples.find((e) => e.id === activeExampleId) ?? examples[0];
1752
+ const isActive = syncScroll?.activeSection === id;
1753
+ useEffect4(() => {
1754
+ if (ref.current) {
1755
+ ref.current.setAttribute("data-section", id);
1756
+ }
1757
+ }, [id]);
1758
+ return /* @__PURE__ */ jsxs18("div", {
1759
+ ref,
1760
+ "data-section": id,
1761
+ className: cn("openpkg-example-section", "mb-12 last:mb-0", "transition-opacity duration-300", isActive ? "opacity-100" : "opacity-40", className),
1762
+ children: [
1763
+ examples.length > 1 && /* @__PURE__ */ jsx35(ExampleChips, {
1764
+ examples: examples.map((e) => ({ id: e.id, label: e.label })),
1765
+ activeId: activeExampleId,
1766
+ onSelect: setActiveExampleId
1767
+ }),
1768
+ activeExample && /* @__PURE__ */ jsx35(CodeBlock, {
1769
+ code: activeExample.code,
1770
+ language: activeExample.language ?? "typescript",
1771
+ showLineNumbers: true
1772
+ }),
1773
+ dataSource && /* @__PURE__ */ jsx35(CollapsiblePanel, {
1774
+ title: "Data source",
1775
+ children: /* @__PURE__ */ jsx35("div", {
1776
+ className: "p-4",
1777
+ children: /* @__PURE__ */ jsx35(CodeBlock, {
1778
+ code: dataSource,
1779
+ language: "sql"
1780
+ })
1781
+ })
1782
+ }),
1783
+ response && /* @__PURE__ */ jsx35(CollapsiblePanel, {
1784
+ title: "Response",
1785
+ children: /* @__PURE__ */ jsx35("div", {
1786
+ className: "p-4",
1787
+ children: /* @__PURE__ */ jsx35(CodeBlock, {
1788
+ code: response,
1789
+ language: "json"
1790
+ })
1791
+ })
1792
+ }),
1793
+ notes && /* @__PURE__ */ jsx35(CollapsiblePanel, {
1794
+ title: "Notes",
1795
+ children: /* @__PURE__ */ jsx35("div", {
1796
+ className: cn("openpkg-panel-note", "p-4", "text-[13px] text-[var(--openpkg-text-secondary)]", "leading-relaxed", "[&_code]:font-mono [&_code]:text-xs [&_code]:bg-[var(--openpkg-bg-badge)] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:rounded"),
1797
+ children: typeof notes === "string" ? /* @__PURE__ */ jsx35("p", {
1798
+ children: notes
1799
+ }) : notes
1800
+ })
1801
+ })
1802
+ ]
1706
1803
  });
1707
1804
  }
1708
- function TabsTrigger({
1709
- className,
1710
- ...props
1805
+ function useSyncScrollSafe() {
1806
+ try {
1807
+ return useSyncScroll();
1808
+ } catch {
1809
+ return null;
1810
+ }
1811
+ }
1812
+ // src/docskit/api/expandable-parameter.tsx
1813
+ import { formatSchema } from "@openpkg-ts/sdk/browser";
1814
+ import { useState as useState10 } from "react";
1815
+
1816
+ // src/docskit/api/parameter-item.tsx
1817
+ import { Link } from "lucide-react";
1818
+ import { jsx as jsx36, jsxs as jsxs19 } from "react/jsx-runtime";
1819
+
1820
+ function APIParameterItem({
1821
+ name,
1822
+ parentPath,
1823
+ type,
1824
+ required,
1825
+ optional,
1826
+ expandable: expandable2,
1827
+ description,
1828
+ children,
1829
+ anchorId,
1830
+ showAnchor = false,
1831
+ className
1711
1832
  }) {
1712
- return /* @__PURE__ */ jsx31(TabsPrimitive.Trigger, {
1713
- "data-slot": "tabs-trigger",
1714
- className: cn("data-[state=active]:text-[var(--openpkg-text-primary)] focus-visible:ring-[var(--openpkg-accent-primary)] focus-visible:outline-[var(--openpkg-accent-primary)] text-[var(--openpkg-text-muted)] inline-flex h-full flex-1 items-center justify-center gap-1.5 px-2 py-1 text-sm font-normal whitespace-nowrap transition-colors focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
1715
- ...props
1833
+ const handleAnchorClick = () => {
1834
+ if (anchorId && typeof window !== "undefined") {
1835
+ window.location.hash = anchorId;
1836
+ navigator.clipboard?.writeText(window.location.href);
1837
+ }
1838
+ };
1839
+ return /* @__PURE__ */ jsxs19("div", {
1840
+ id: anchorId,
1841
+ className: cn("openpkg-param", "py-5 border-b border-[var(--openpkg-border-subtle)]", "last:border-b-0", className),
1842
+ children: [
1843
+ /* @__PURE__ */ jsxs19("div", {
1844
+ className: "openpkg-param-header flex items-center gap-2.5 mb-2 flex-wrap",
1845
+ children: [
1846
+ showAnchor && /* @__PURE__ */ jsx36("button", {
1847
+ type: "button",
1848
+ onClick: handleAnchorClick,
1849
+ className: cn("openpkg-anchor-link", "flex items-center justify-center w-4 h-4", "opacity-0 group-hover:opacity-100 hover:opacity-100", "text-[var(--openpkg-text-muted)]", "hover:text-[var(--openpkg-accent-blue)]", "cursor-pointer transition-opacity"),
1850
+ "aria-label": "Copy link",
1851
+ children: /* @__PURE__ */ jsx36(Link, {
1852
+ size: 14
1853
+ })
1854
+ }),
1855
+ /* @__PURE__ */ jsxs19("span", {
1856
+ className: "openpkg-param-name font-mono text-sm font-semibold",
1857
+ children: [
1858
+ parentPath && /* @__PURE__ */ jsx36("span", {
1859
+ className: "text-[var(--openpkg-text-muted)]",
1860
+ children: parentPath
1861
+ }),
1862
+ /* @__PURE__ */ jsx36("span", {
1863
+ className: "text-[var(--openpkg-text-primary)]",
1864
+ children: name
1865
+ })
1866
+ ]
1867
+ }),
1868
+ required && /* @__PURE__ */ jsx36("span", {
1869
+ className: cn("openpkg-param-badge", "text-[11px] font-medium uppercase tracking-wide", "px-2 py-0.5 rounded", "bg-[var(--openpkg-bg-badge)]", "text-[var(--openpkg-text-muted)]"),
1870
+ children: "Required"
1871
+ }),
1872
+ optional && /* @__PURE__ */ jsx36("span", {
1873
+ className: cn("openpkg-param-badge", "text-[11px] font-medium uppercase tracking-wide", "px-2 py-0.5 rounded", "bg-[var(--openpkg-bg-badge)]", "text-[var(--openpkg-text-muted)]"),
1874
+ children: "Optional"
1875
+ }),
1876
+ expandable2 && /* @__PURE__ */ jsx36("span", {
1877
+ className: cn("openpkg-badge-expandable", "text-[10px] font-medium", "px-2 py-0.5 rounded", "text-[var(--openpkg-accent-purple)]", "bg-[color-mix(in_srgb,var(--openpkg-accent-purple)_12%,transparent)]"),
1878
+ children: "Expandable"
1879
+ }),
1880
+ /* @__PURE__ */ jsx36("span", {
1881
+ className: "openpkg-param-type text-[13px] text-[var(--openpkg-text-muted)]",
1882
+ children: type
1883
+ })
1884
+ ]
1885
+ }),
1886
+ description && /* @__PURE__ */ jsx36("p", {
1887
+ className: cn("openpkg-param-description", "text-sm text-[var(--openpkg-text-secondary)]", "leading-relaxed", "[&_code]:font-mono [&_code]:text-[13px] [&_code]:bg-[var(--openpkg-bg-badge)] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:rounded"),
1888
+ children: description
1889
+ }),
1890
+ children
1891
+ ]
1716
1892
  });
1717
1893
  }
1718
- function TabsContent({
1719
- className,
1720
- ...props
1894
+
1895
+ // src/docskit/api/nested-parameter-container.tsx
1896
+ import { jsx as jsx37 } from "react/jsx-runtime";
1897
+
1898
+ function NestedParameterContainer({
1899
+ children,
1900
+ level = 0,
1901
+ className
1721
1902
  }) {
1722
- return /* @__PURE__ */ jsx31(TabsPrimitive.Content, {
1723
- "data-slot": "tabs-content",
1724
- className: cn("flex-1 outline-none", className),
1725
- ...props
1903
+ return /* @__PURE__ */ jsx37("div", {
1904
+ className: cn("openpkg-nested-container", "border border-t-0", level === 0 ? "border-[var(--openpkg-border-medium)]" : "border-[var(--openpkg-border-subtle)]", "rounded-b-lg", "px-5", "mb-2", "[&>.openpkg-param]:py-5", "[&>.openpkg-param]:border-b", "[&>.openpkg-param]:border-[var(--openpkg-border-subtle)]", "[&>.openpkg-param:last-child]:border-b-0", className),
1905
+ "data-level": level,
1906
+ children
1726
1907
  });
1727
1908
  }
1728
1909
 
1729
- // src/docskit/code.client.tsx
1730
- import { jsx as jsx32, jsxs as jsxs18 } from "react/jsx-runtime";
1910
+ // src/docskit/api/nested-parameter-toggle.tsx
1911
+ import { Plus } from "lucide-react";
1912
+ import { jsx as jsx38, jsxs as jsxs20 } from "react/jsx-runtime";
1731
1913
 
1732
- function MultiCode({
1733
- group,
1914
+ function NestedParameterToggle({
1915
+ expanded,
1916
+ onToggle,
1917
+ count,
1734
1918
  className
1735
1919
  }) {
1736
- const [storedTitle, setCurrentTitle] = useStateOrLocalStorage(group.storage, group.tabs[0].title);
1737
- const current = group.tabs.find((tab) => tab.title === storedTitle) || group.tabs[0];
1738
- const { code } = current;
1739
- const currentTitle = current?.title;
1740
- return /* @__PURE__ */ jsxs18(Tabs, {
1741
- value: currentTitle,
1742
- onValueChange: setCurrentTitle,
1743
- className: cn("group border rounded selection:bg-dk-selection selection:text-current border-dk-border overflow-hidden relative flex flex-col max-h-full min-h-0 my-4 gap-0 not-prose", className),
1920
+ return /* @__PURE__ */ jsxs20("button", {
1921
+ type: "button",
1922
+ onClick: onToggle,
1923
+ className: cn("openpkg-nested-toggle", "inline-flex items-center gap-2", "font-sans text-[13px] font-medium", "text-[var(--openpkg-text-secondary)]", "bg-transparent", "border border-[var(--openpkg-border-medium)]", "rounded-lg", "px-4 py-2.5", "mt-3", "cursor-pointer", "transition-all duration-150", "hover:border-[var(--openpkg-text-muted)]", "hover:text-[var(--openpkg-text-primary)]", expanded && "rounded-b-none border-b-transparent mb-0", className),
1924
+ "aria-expanded": expanded,
1744
1925
  children: [
1745
- /* @__PURE__ */ jsx32(TabsList, {
1746
- className: cn("border-b border-dk-border bg-dk-tabs-background w-full h-9 min-h-9 shrink-0", "rounded-none p-0 m-0 justify-start items-stretch"),
1747
- children: group.tabs.map(({ icon: icon2, title }, _index) => /* @__PURE__ */ jsxs18(TabsTrigger, {
1748
- value: title,
1749
- className: cn("rounded-none transition-colors duration-200 gap-1.5 px-3 font-mono justify-start grow-0", "border-r border-dk-border", "text-dk-tab-inactive-foreground data-[state=active]:text-dk-tab-active-foreground hover:text-dk-tab-active-foreground", "data-[state=active]:bg-dk-background/50"),
1750
- children: [
1751
- /* @__PURE__ */ jsx32("div", {
1752
- children: icon2
1753
- }),
1754
- /* @__PURE__ */ jsx32("span", {
1755
- className: "leading-none",
1756
- children: title
1757
- })
1758
- ]
1759
- }, title))
1926
+ /* @__PURE__ */ jsx38(Plus, {
1927
+ size: 12,
1928
+ className: cn("transition-transform duration-200", expanded && "rotate-45")
1760
1929
  }),
1761
- /* @__PURE__ */ jsxs18(TabsContent, {
1762
- value: current.title,
1763
- className: "relative min-h-0 mt-0 flex flex-col",
1930
+ /* @__PURE__ */ jsxs20("span", {
1764
1931
  children: [
1765
- current.pre,
1766
- group.options.copyButton && /* @__PURE__ */ jsx32(CopyButton, {
1767
- text: code,
1768
- variant: "floating",
1769
- className: "absolute right-3 top-3 z-10 text-dk-tab-inactive-foreground"
1770
- })
1932
+ expanded ? "Hide" : "Show",
1933
+ " child parameters",
1934
+ count !== undefined && ` (${count})`
1771
1935
  ]
1772
1936
  })
1773
1937
  ]
1774
1938
  });
1775
1939
  }
1776
- // src/docskit/code.client-highlight.tsx
1777
- import {
1778
- highlight as highlight3,
1779
- Inline,
1780
- Pre as Pre3
1781
- } from "codehike/code";
1782
- import { useEffect as useEffect3, useState as useState7 } from "react";
1783
- import { jsx as jsx33, jsxs as jsxs19 } from "react/jsx-runtime";
1784
1940
 
1785
- function ClientDocsKitCode(props) {
1786
- const { codeblock, handlers: extraHandlers, className: wrapperClassName } = props;
1787
- const [highlighted, setHighlighted] = useState7(null);
1788
- const { title, flags } = extractFlags2(codeblock);
1789
- const options = flagsToOptions(flags);
1790
- useEffect3(() => {
1791
- let cancelled = false;
1792
- highlight3({ ...codeblock, lang: codeblock.lang || "txt" }, theme).then((result) => {
1793
- if (!cancelled)
1794
- setHighlighted(result);
1795
- });
1796
- return () => {
1797
- cancelled = true;
1798
- };
1799
- }, [codeblock.value, codeblock.lang, codeblock.meta, codeblock]);
1800
- if (!highlighted) {
1801
- return /* @__PURE__ */ jsx33(CodeBlockSkeleton, {
1802
- hasTitle: !!title
1803
- });
1804
- }
1805
- const handlers = getHandlers(options);
1806
- if (extraHandlers) {
1807
- handlers.push(...extraHandlers);
1808
- }
1809
- const { background: _background, ...highlightedStyle } = highlighted.style;
1810
- const showCopy = options?.copyButton;
1811
- const icon2 = /* @__PURE__ */ jsx33(CodeIcon, {
1812
- title,
1813
- lang: codeblock.lang,
1814
- className: "opacity-60"
1815
- });
1816
- return /* @__PURE__ */ jsxs19("div", {
1817
- className: cn("group rounded overflow-hidden relative border-dk-border flex flex-col border my-4 not-prose", wrapperClassName),
1818
- children: [
1819
- title ? /* @__PURE__ */ jsx33("div", {
1820
- className: cn("border-b-[1px] border-dk-border bg-dk-tabs-background px-3 py-0", "w-full h-9 flex items-center shrink-0", "text-dk-tab-inactive-foreground text-sm font-mono"),
1821
- children: /* @__PURE__ */ jsxs19("div", {
1822
- className: "flex items-center h-5 gap-2",
1941
+ // src/docskit/api/expandable-parameter.tsx
1942
+ import { jsx as jsx39, jsxs as jsxs21, Fragment as Fragment3 } from "react/jsx-runtime";
1943
+
1944
+ function ExpandableParameter({
1945
+ parameter,
1946
+ parentPath,
1947
+ defaultExpanded = false,
1948
+ expanded: controlledExpanded,
1949
+ onExpandedChange,
1950
+ level = 0,
1951
+ className
1952
+ }) {
1953
+ const [internalExpanded, setInternalExpanded] = useState10(defaultExpanded);
1954
+ const isControlled = controlledExpanded !== undefined;
1955
+ const expanded = isControlled ? controlledExpanded : internalExpanded;
1956
+ const handleToggle = () => {
1957
+ const newValue = !expanded;
1958
+ if (isControlled) {
1959
+ onExpandedChange?.(newValue);
1960
+ } else {
1961
+ setInternalExpanded(newValue);
1962
+ }
1963
+ };
1964
+ const { nestedParams, enumValues, hasChildren } = extractSchemaInfo(parameter.schema);
1965
+ const type = formatSchema(parameter.schema);
1966
+ const isRequired = parameter.required !== false;
1967
+ return /* @__PURE__ */ jsx39("div", {
1968
+ className: cn("openpkg-expandable-param", className),
1969
+ children: /* @__PURE__ */ jsxs21(APIParameterItem, {
1970
+ name: parameter.name,
1971
+ parentPath,
1972
+ type: hasChildren ? "object" : type,
1973
+ required: isRequired,
1974
+ expandable: hasChildren,
1975
+ description: parameter.description,
1976
+ anchorId: parentPath ? `${parentPath}${parameter.name}` : parameter.name,
1977
+ showAnchor: level > 0,
1978
+ children: [
1979
+ enumValues.length > 0 && !nestedParams.length && /* @__PURE__ */ jsx39(EnumValuesSection, {
1980
+ values: enumValues
1981
+ }),
1982
+ nestedParams.length > 0 && /* @__PURE__ */ jsxs21(Fragment3, {
1823
1983
  children: [
1824
- /* @__PURE__ */ jsx33("div", {
1825
- className: "size-4",
1826
- children: icon2
1984
+ /* @__PURE__ */ jsx39(NestedParameterToggle, {
1985
+ expanded,
1986
+ onToggle: handleToggle,
1987
+ count: nestedParams.length
1827
1988
  }),
1828
- /* @__PURE__ */ jsx33("span", {
1829
- className: "leading-none",
1830
- children: title
1989
+ expanded && /* @__PURE__ */ jsx39(NestedParameterContainer, {
1990
+ level,
1991
+ children: nestedParams.map((nested) => /* @__PURE__ */ jsx39(ExpandableParameter, {
1992
+ parameter: nested,
1993
+ parentPath: `${parameter.name}.`,
1994
+ level: level + 1
1995
+ }, nested.name))
1831
1996
  })
1832
1997
  ]
1833
1998
  })
1834
- }) : null,
1835
- /* @__PURE__ */ jsxs19("div", {
1836
- className: "relative flex items-start",
1999
+ ]
2000
+ })
2001
+ });
2002
+ }
2003
+ function extractSchemaInfo(schema) {
2004
+ const result = {
2005
+ nestedParams: [],
2006
+ enumValues: [],
2007
+ hasChildren: false
2008
+ };
2009
+ if (!schema || typeof schema !== "object")
2010
+ return result;
2011
+ const s = schema;
2012
+ if (s.type === "object" && s.properties && typeof s.properties === "object") {
2013
+ const props = s.properties;
2014
+ const required = Array.isArray(s.required) ? s.required : [];
2015
+ for (const [name, propSchema] of Object.entries(props)) {
2016
+ result.nestedParams.push({
2017
+ name,
2018
+ schema: propSchema,
2019
+ required: required.includes(name),
2020
+ description: propSchema?.description
2021
+ });
2022
+ }
2023
+ }
2024
+ if (Array.isArray(s.enum)) {
2025
+ result.enumValues = s.enum.map((value) => ({
2026
+ value: String(value),
2027
+ description: undefined
2028
+ }));
2029
+ }
2030
+ result.hasChildren = result.nestedParams.length > 0 || result.enumValues.length > 0;
2031
+ return result;
2032
+ }
2033
+ // src/docskit/api/method-section.tsx
2034
+ import { useEffect as useEffect5, useRef as useRef4 } from "react";
2035
+ import { jsx as jsx40, jsxs as jsxs22 } from "react/jsx-runtime";
2036
+
2037
+ function MethodSection({
2038
+ id,
2039
+ title,
2040
+ signature,
2041
+ description,
2042
+ notes,
2043
+ children,
2044
+ className
2045
+ }) {
2046
+ const ref = useRef4(null);
2047
+ const syncScroll = useSyncScrollSafe2();
2048
+ useEffect5(() => {
2049
+ if (syncScroll && ref.current) {
2050
+ syncScroll.registerSection(id, ref);
2051
+ return () => syncScroll.unregisterSection(id);
2052
+ }
2053
+ }, [id, syncScroll]);
2054
+ return /* @__PURE__ */ jsxs22("section", {
2055
+ ref,
2056
+ id,
2057
+ "data-section": id,
2058
+ className: cn("openpkg-method-section", "mb-20 last:mb-0", className),
2059
+ children: [
2060
+ /* @__PURE__ */ jsx40("h2", {
2061
+ className: cn("text-2xl font-semibold tracking-tight", "text-[var(--openpkg-text-primary)]", "mb-4"),
2062
+ children: title
2063
+ }),
2064
+ signature && /* @__PURE__ */ jsx40("code", {
2065
+ className: cn("block font-mono text-sm", "text-[var(--openpkg-text-muted)]", "mb-6"),
2066
+ children: signature
2067
+ }),
2068
+ description && /* @__PURE__ */ jsx40("div", {
2069
+ className: cn("openpkg-method-description", "text-[15px] leading-relaxed", "text-[var(--openpkg-text-secondary)]", "mb-6", "[&_a]:text-[var(--openpkg-accent-link)] [&_a]:no-underline [&_a]:font-medium hover:[&_a]:underline", "[&_code]:bg-[var(--openpkg-bg-badge)] [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:rounded [&_code]:font-mono [&_code]:text-[13px]"),
2070
+ children: typeof description === "string" ? /* @__PURE__ */ jsx40("p", {
2071
+ children: description
2072
+ }) : description
2073
+ }),
2074
+ notes && notes.length > 0 && /* @__PURE__ */ jsx40("ul", {
2075
+ className: cn("openpkg-method-notes", "list-disc list-inside", "text-[15px] leading-relaxed", "text-[var(--openpkg-text-secondary)]", "mb-8 space-y-2"),
2076
+ children: notes.map((note, i) => /* @__PURE__ */ jsx40("li", {
2077
+ children: note
2078
+ }, i))
2079
+ }),
2080
+ children && /* @__PURE__ */ jsxs22("div", {
2081
+ className: "openpkg-method-params",
1837
2082
  children: [
1838
- /* @__PURE__ */ jsx33(Pre3, {
1839
- code: highlighted,
1840
- className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-dk-background selection:bg-dk-selection selection:text-current max-h-full flex-1",
1841
- style: highlightedStyle,
1842
- handlers
2083
+ /* @__PURE__ */ jsx40("h3", {
2084
+ className: cn("text-xs font-semibold uppercase tracking-wider", "text-[var(--openpkg-text-muted)]", "mb-4 pb-2", "border-b border-[var(--openpkg-border-subtle)]"),
2085
+ children: "Parameters"
1843
2086
  }),
1844
- showCopy && /* @__PURE__ */ jsx33(CopyButton, {
1845
- text: highlighted.code,
1846
- variant: "floating",
1847
- className: cn("absolute right-3 z-10 text-dk-tab-inactive-foreground", title ? "top-3" : "top-1/2 -translate-y-1/2")
1848
- })
2087
+ children
1849
2088
  ]
1850
2089
  })
1851
2090
  ]
1852
2091
  });
1853
2092
  }
1854
- function ClientTerminal(props) {
1855
- const { codeblock, handlers: extraHandlers } = props;
1856
- const [highlighted, setHighlighted] = useState7(null);
1857
- const { flags } = extractFlagsSimple(codeblock);
1858
- const options = flagsToOptions(flags);
1859
- useEffect3(() => {
1860
- let cancelled = false;
1861
- highlight3({ ...codeblock, lang: codeblock.lang || "bash" }, theme).then((result) => {
1862
- if (!cancelled)
1863
- setHighlighted(result);
1864
- });
1865
- return () => {
1866
- cancelled = true;
1867
- };
1868
- }, [codeblock.value, codeblock.lang, codeblock.meta, codeblock]);
1869
- if (!highlighted) {
1870
- return /* @__PURE__ */ jsx33(TerminalSkeleton, {});
1871
- }
1872
- const handlers = getHandlers(options);
1873
- if (extraHandlers) {
1874
- handlers.push(...extraHandlers);
2093
+ function useSyncScrollSafe2() {
2094
+ try {
2095
+ return useSyncScroll();
2096
+ } catch {
2097
+ return null;
1875
2098
  }
1876
- const { background: _background, ...highlightedStyle } = highlighted.style;
1877
- const showCopy = options?.copyButton;
1878
- const isMultiLine = highlighted.code.includes(`
1879
- `);
1880
- return /* @__PURE__ */ jsxs19("div", {
1881
- className: "group rounded overflow-hidden relative border-dk-border flex flex-col border my-4 not-prose",
2099
+ }
2100
+ // src/docskit/api/parameter-list.tsx
2101
+ import { ChevronDown as ChevronDown2 } from "lucide-react";
2102
+ import * as React6 from "react";
2103
+ import { useState as useState11 } from "react";
2104
+ import { jsx as jsx41, jsxs as jsxs23 } from "react/jsx-runtime";
2105
+
2106
+ function ParameterList({
2107
+ title,
2108
+ collapseAfter,
2109
+ children,
2110
+ className
2111
+ }) {
2112
+ const [expanded, setExpanded] = useState11(false);
2113
+ const childArray = React6.Children.toArray(children);
2114
+ const shouldCollapse = collapseAfter !== undefined && childArray.length > collapseAfter;
2115
+ const visibleChildren = shouldCollapse && !expanded ? childArray.slice(0, collapseAfter) : childArray;
2116
+ const hiddenCount = shouldCollapse ? childArray.length - collapseAfter : 0;
2117
+ return /* @__PURE__ */ jsxs23("div", {
2118
+ className: cn("", className),
2119
+ children: [
2120
+ title && /* @__PURE__ */ jsx41("h3", {
2121
+ className: "text-sm font-medium text-foreground mb-3 uppercase tracking-wide",
2122
+ children: title
2123
+ }),
2124
+ /* @__PURE__ */ jsx41("div", {
2125
+ className: "divide-y divide-border border-t border-b border-border",
2126
+ children: visibleChildren
2127
+ }),
2128
+ shouldCollapse && !expanded && /* @__PURE__ */ jsxs23("button", {
2129
+ type: "button",
2130
+ onClick: () => setExpanded(true),
2131
+ className: "flex items-center gap-1 mt-3 text-sm text-primary hover:underline cursor-pointer",
2132
+ children: [
2133
+ /* @__PURE__ */ jsx41(ChevronDown2, {
2134
+ size: 14
2135
+ }),
2136
+ "Show ",
2137
+ hiddenCount,
2138
+ " more ",
2139
+ hiddenCount === 1 ? "parameter" : "parameters"
2140
+ ]
2141
+ })
2142
+ ]
2143
+ });
2144
+ }
2145
+ // src/docskit/api/response-block.tsx
2146
+ import { Check as Check3, Copy as Copy3 } from "lucide-react";
2147
+ import { useState as useState12 } from "react";
2148
+ import { jsx as jsx42, jsxs as jsxs24 } from "react/jsx-runtime";
2149
+
2150
+ function ResponseBlock({ data, title, className }) {
2151
+ const [copied, setCopied] = useState12(false);
2152
+ const jsonString = JSON.stringify(data, null, 2);
2153
+ const handleCopy = () => {
2154
+ navigator.clipboard.writeText(jsonString);
2155
+ setCopied(true);
2156
+ setTimeout(() => setCopied(false), 1200);
2157
+ };
2158
+ return /* @__PURE__ */ jsxs24("div", {
2159
+ className: cn("group rounded-lg border border-border overflow-hidden bg-muted/30", className),
1882
2160
  children: [
1883
- /* @__PURE__ */ jsxs19("div", {
1884
- className: cn("border-b border-dk-border bg-dk-tabs-background", "w-full h-9 flex items-center justify-center shrink-0", "relative"),
2161
+ title && /* @__PURE__ */ jsxs24("div", {
2162
+ className: "flex items-center justify-between px-4 py-2 border-b border-border bg-muted/50",
1885
2163
  children: [
1886
- /* @__PURE__ */ jsxs19("div", {
1887
- className: "absolute left-3 flex items-center gap-2",
1888
- children: [
1889
- /* @__PURE__ */ jsx33("div", {
1890
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
1891
- }),
1892
- /* @__PURE__ */ jsx33("div", {
1893
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
1894
- }),
1895
- /* @__PURE__ */ jsx33("div", {
1896
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
1897
- })
1898
- ]
2164
+ /* @__PURE__ */ jsx42("span", {
2165
+ className: "text-xs font-medium text-muted-foreground uppercase tracking-wide",
2166
+ children: title
1899
2167
  }),
1900
- /* @__PURE__ */ jsx33("span", {
1901
- className: "sr-only",
1902
- children: "Terminal window"
2168
+ /* @__PURE__ */ jsx42("button", {
2169
+ type: "button",
2170
+ onClick: handleCopy,
2171
+ className: "p-1 rounded text-muted-foreground hover:text-foreground opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer",
2172
+ "aria-label": "Copy response",
2173
+ children: copied ? /* @__PURE__ */ jsx42(Check3, {
2174
+ size: 14
2175
+ }) : /* @__PURE__ */ jsx42(Copy3, {
2176
+ size: 14
2177
+ })
1903
2178
  })
1904
2179
  ]
1905
2180
  }),
1906
- /* @__PURE__ */ jsxs19("div", {
2181
+ /* @__PURE__ */ jsx42(ClientDocsKitCode, {
2182
+ codeblock: {
2183
+ value: jsonString,
2184
+ lang: "json",
2185
+ meta: title ? "" : "-c"
2186
+ },
2187
+ className: "!my-0 !border-0 !rounded-none"
2188
+ })
2189
+ ]
2190
+ });
2191
+ }
2192
+ // src/docskit/code.tsx
2193
+ import { highlight as highlight2, Pre as Pre2 } from "codehike/code";
2194
+ import { jsx as jsx43, jsxs as jsxs25 } from "react/jsx-runtime";
2195
+ async function DocsKitCode(props) {
2196
+ const { codeblock, className, ...rest } = props;
2197
+ const group = await toCodeGroup({ codeblocks: [codeblock], ...rest });
2198
+ return /* @__PURE__ */ jsx43(SingleCode, {
2199
+ group,
2200
+ className
2201
+ });
2202
+ }
2203
+ async function SingleCode(props) {
2204
+ const { pre, title, code, icon: icon2, options } = props.group.tabs[0];
2205
+ const showCopy = options?.copyButton;
2206
+ return /* @__PURE__ */ jsxs25("div", {
2207
+ className: cn("group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose", props.className),
2208
+ children: [
2209
+ title ? /* @__PURE__ */ jsx43("div", {
2210
+ className: cn("border-b-[1px] border-openpkg-code-border bg-openpkg-code-header px-3 py-0", "w-full h-9 flex items-center shrink-0", "text-openpkg-code-text-inactive text-sm font-mono"),
2211
+ children: /* @__PURE__ */ jsxs25("div", {
2212
+ className: "flex items-center h-5 gap-2",
2213
+ children: [
2214
+ /* @__PURE__ */ jsx43("div", {
2215
+ className: "size-4",
2216
+ children: icon2
2217
+ }),
2218
+ /* @__PURE__ */ jsx43("span", {
2219
+ className: "leading-none",
2220
+ children: title
2221
+ })
2222
+ ]
2223
+ })
2224
+ }) : null,
2225
+ /* @__PURE__ */ jsxs25("div", {
1907
2226
  className: "relative flex items-start",
1908
2227
  children: [
1909
- /* @__PURE__ */ jsx33(Pre3, {
1910
- code: highlighted,
1911
- className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-dk-background selection:bg-dk-selection selection:text-current max-h-full flex-1",
1912
- style: highlightedStyle,
1913
- handlers
1914
- }),
1915
- showCopy && /* @__PURE__ */ jsx33(CopyButton, {
1916
- text: highlighted.code,
2228
+ pre,
2229
+ showCopy && /* @__PURE__ */ jsx43(CopyButton, {
2230
+ text: code,
1917
2231
  variant: "floating",
1918
- className: cn("absolute right-3 z-10 text-dk-tab-inactive-foreground", isMultiLine ? "top-3" : "top-1/2 -translate-y-1/2")
2232
+ className: cn("absolute right-3 z-10 text-openpkg-code-text-inactive", "top-3")
1919
2233
  })
1920
2234
  ]
1921
2235
  })
1922
2236
  ]
1923
2237
  });
1924
2238
  }
1925
- function ClientInlineCode({ codeblock }) {
1926
- const [highlighted, setHighlighted] = useState7(null);
1927
- useEffect3(() => {
1928
- let cancelled = false;
1929
- highlight3(codeblock, theme).then((result) => {
1930
- if (!cancelled)
1931
- setHighlighted(result);
1932
- });
1933
- return () => {
1934
- cancelled = true;
2239
+ async function toCodeGroup(props) {
2240
+ const rawFlags = props.flags?.startsWith("-") ? props.flags.slice(1) : props.flags;
2241
+ const groupOptions = flagsToOptions(rawFlags);
2242
+ const tabs = await Promise.all(props.codeblocks.map(async (tab) => {
2243
+ const { flags, title } = extractFlags2(tab);
2244
+ const tabOptions = flagsToOptions(flags);
2245
+ const options = { ...groupOptions, ...tabOptions };
2246
+ const highlighted = await highlight2({ ...tab, lang: tab.lang || "txt" }, theme);
2247
+ const handlers = getHandlers(options);
2248
+ if (props.handlers) {
2249
+ handlers.push(...props.handlers);
2250
+ }
2251
+ const { background: _background, ...highlightedStyle } = highlighted.style;
2252
+ return {
2253
+ options,
2254
+ title,
2255
+ code: highlighted.code,
2256
+ icon: /* @__PURE__ */ jsx43(CodeIcon, {
2257
+ title,
2258
+ lang: tab.lang,
2259
+ className: "opacity-60"
2260
+ }),
2261
+ lang: tab.lang,
2262
+ pre: /* @__PURE__ */ jsx43(Pre2, {
2263
+ code: highlighted,
2264
+ className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current max-h-full flex-1",
2265
+ style: highlightedStyle,
2266
+ handlers
2267
+ })
1935
2268
  };
1936
- }, [codeblock.value, codeblock.lang, codeblock.meta, codeblock]);
1937
- if (!highlighted) {
1938
- return /* @__PURE__ */ jsx33(InlineCodeSkeleton, {});
1939
- }
1940
- return /* @__PURE__ */ jsx33(Inline, {
1941
- code: highlighted,
1942
- className: "selection:bg-dk-selection selection:text-current rounded border border-dk-border px-1 py-0.5 whitespace-nowrap !bg-dk-background",
1943
- style: highlighted.style
1944
- });
2269
+ }));
2270
+ return {
2271
+ storage: props.storage,
2272
+ options: groupOptions,
2273
+ tabs
2274
+ };
1945
2275
  }
1946
2276
  function extractFlags2(codeblock) {
1947
- const meta = codeblock.meta || "";
1948
- const flags = meta.split(" ").filter((flag) => flag.startsWith("-"))[0] ?? "";
1949
- const metaWithoutFlags = !flags ? meta : meta === flags ? "" : meta.replace(` ${flags}`, "").trim();
2277
+ const flags = codeblock.meta.split(" ").filter((flag) => flag.startsWith("-"))[0] ?? "";
2278
+ const metaWithoutFlags = !flags ? codeblock.meta : codeblock.meta === flags ? "" : codeblock.meta.replace(` ${flags}`, "").trim();
1950
2279
  const title = metaWithoutFlags.trim();
1951
2280
  return { title, flags: flags.slice(1) };
1952
2281
  }
1953
- function extractFlagsSimple(codeblock) {
1954
- const meta = codeblock.meta || "";
1955
- const flagMatch = meta.split(" ").find((flag) => flag.startsWith("-"));
1956
- const flags = flagMatch ? flagMatch.slice(1) : "";
1957
- return { flags };
1958
- }
1959
- function ClientCode(props) {
1960
- const { codeblocks, flags: groupFlags, storage } = props;
1961
- const [highlighted, setHighlighted] = useState7(null);
1962
- const groupOptions = flagsToOptions(groupFlags?.startsWith("-") ? groupFlags.slice(1) : groupFlags);
1963
- const _codeBlocksKey = codeblocks.map((b) => `${b.value}|${b.lang}|${b.meta}`).join("::");
1964
- useEffect3(() => {
1965
- let cancelled = false;
1966
- Promise.all(codeblocks.map(async (block, index) => {
1967
- const { title, flags } = extractFlags2(block);
1968
- const tabOptions = flagsToOptions(flags);
1969
- const options = { ...groupOptions, ...tabOptions };
1970
- const result = await highlight3({ ...block, lang: block.lang || "txt" }, theme);
1971
- return {
1972
- index,
1973
- highlighted: result,
1974
- title,
1975
- options,
1976
- icon: /* @__PURE__ */ jsx33(CodeIcon, {
1977
- title,
1978
- lang: block.lang,
1979
- className: "opacity-60"
1980
- })
1981
- };
1982
- })).then((results) => {
1983
- if (!cancelled) {
1984
- const map = new Map;
1985
- results.forEach((r) => map.set(r.index, r));
1986
- setHighlighted(map);
1987
- }
1988
- });
1989
- return () => {
1990
- cancelled = true;
1991
- };
1992
- }, [codeblocks.map, groupOptions]);
1993
- if (!highlighted) {
1994
- return /* @__PURE__ */ jsx33(CodeTabsSkeleton, {
1995
- tabs: codeblocks.length
1996
- });
1997
- }
1998
- if (codeblocks.length === 1) {
1999
- const tab = highlighted.get(0);
2000
- if (!tab)
2001
- return null;
2002
- const handlers = getHandlers(tab.options);
2003
- const { background: _background, ...highlightedStyle } = tab.highlighted.style;
2004
- return /* @__PURE__ */ jsxs19("div", {
2005
- className: "group rounded overflow-hidden relative border-dk-border flex flex-col border my-4 not-prose",
2006
- children: [
2007
- tab.title ? /* @__PURE__ */ jsx33("div", {
2008
- className: cn("border-b-[1px] border-dk-border bg-dk-tabs-background px-3 py-0", "w-full h-9 flex items-center shrink-0", "text-dk-tab-inactive-foreground text-sm font-mono"),
2009
- children: /* @__PURE__ */ jsxs19("div", {
2010
- className: "flex items-center h-5 gap-2",
2011
- children: [
2012
- /* @__PURE__ */ jsx33("div", {
2013
- className: "size-4",
2014
- children: tab.icon
2015
- }),
2016
- /* @__PURE__ */ jsx33("span", {
2017
- className: "leading-none",
2018
- children: tab.title
2019
- })
2020
- ]
2021
- })
2022
- }) : null,
2023
- /* @__PURE__ */ jsxs19("div", {
2024
- className: "relative flex items-start",
2025
- children: [
2026
- /* @__PURE__ */ jsx33(Pre3, {
2027
- code: tab.highlighted,
2028
- className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-dk-background selection:bg-dk-selection selection:text-current max-h-full flex-1",
2029
- style: highlightedStyle,
2030
- handlers
2031
- }),
2032
- tab.options.copyButton && /* @__PURE__ */ jsx33(CopyButton, {
2033
- text: tab.highlighted.code,
2034
- variant: "floating",
2035
- className: "absolute right-3 top-3 z-10 text-dk-tab-inactive-foreground"
2036
- })
2037
- ]
2038
- })
2039
- ]
2040
- });
2041
- }
2042
- return /* @__PURE__ */ jsx33(ClientMultiCode, {
2043
- highlighted,
2044
- groupOptions,
2045
- storage
2046
- });
2047
- }
2048
- function ClientMultiCode({
2049
- highlighted,
2050
- groupOptions,
2051
- storage
2052
- }) {
2053
- const tabs = Array.from(highlighted.values());
2054
- const [storedTitle, setCurrentTitle] = useStateOrLocalStorage(storage, tabs[0].title);
2055
- const current = tabs.find((tab) => tab.title === storedTitle) || tabs[0];
2056
- const handlers = getHandlers(current.options);
2057
- const { background: _background, ...highlightedStyle } = current.highlighted.style;
2058
- return /* @__PURE__ */ jsxs19(Tabs, {
2059
- value: current.title,
2282
+ // src/docskit/code.client.tsx
2283
+ import { jsx as jsx44, jsxs as jsxs26 } from "react/jsx-runtime";
2284
+
2285
+ function MultiCode({ group, className }) {
2286
+ const [storedTitle, setCurrentTitle] = useStateOrLocalStorage(group.storage, group.tabs[0].title);
2287
+ const current = group.tabs.find((tab) => tab.title === storedTitle) || group.tabs[0];
2288
+ const { code } = current;
2289
+ const currentTitle = current?.title;
2290
+ return /* @__PURE__ */ jsxs26(Tabs, {
2291
+ value: currentTitle,
2060
2292
  onValueChange: setCurrentTitle,
2061
- className: cn("group border rounded selection:bg-dk-selection selection:text-current border-dk-border overflow-hidden relative flex flex-col max-h-full min-h-0 my-4 gap-0 not-prose"),
2293
+ className: cn("group border rounded selection:bg-openpkg-code-selection selection:text-current border-openpkg-code-border overflow-hidden relative flex flex-col max-h-full min-h-0 my-4 gap-0 not-prose", className),
2062
2294
  children: [
2063
- /* @__PURE__ */ jsx33(TabsList, {
2064
- className: cn("border-b border-dk-border bg-dk-tabs-background w-full h-9 min-h-9 shrink-0", "rounded-none p-0 m-0 justify-start items-stretch"),
2065
- children: tabs.map(({ icon: icon2, title }) => /* @__PURE__ */ jsxs19(TabsTrigger, {
2295
+ /* @__PURE__ */ jsx44(TabsList, {
2296
+ className: cn("border-b border-openpkg-code-border bg-openpkg-code-header w-full h-9 min-h-9 shrink-0", "rounded-none p-0 m-0 justify-start items-stretch"),
2297
+ children: group.tabs.map(({ icon: icon2, title }, _index) => /* @__PURE__ */ jsxs26(TabsTrigger, {
2066
2298
  value: title,
2067
- className: cn("rounded-none transition-colors duration-200 gap-1.5 px-3 font-mono justify-start grow-0", "border-r border-dk-border", "text-dk-tab-inactive-foreground data-[state=active]:text-dk-tab-active-foreground hover:text-dk-tab-active-foreground", "data-[state=active]:bg-dk-background/50"),
2299
+ className: cn("rounded-none transition-colors duration-200 gap-1.5 px-3 font-mono justify-start grow-0", "border-r border-openpkg-code-border", "text-openpkg-code-text-inactive data-[state=active]:text-openpkg-code-text-active hover:text-openpkg-code-text-active", "data-[state=active]:bg-openpkg-code-bg/50"),
2068
2300
  children: [
2069
- /* @__PURE__ */ jsx33("div", {
2301
+ /* @__PURE__ */ jsx44("div", {
2070
2302
  children: icon2
2071
2303
  }),
2072
- /* @__PURE__ */ jsx33("span", {
2304
+ /* @__PURE__ */ jsx44("span", {
2073
2305
  className: "leading-none",
2074
2306
  children: title
2075
2307
  })
2076
2308
  ]
2077
2309
  }, title))
2078
2310
  }),
2079
- /* @__PURE__ */ jsxs19(TabsContent, {
2311
+ /* @__PURE__ */ jsxs26(TabsContent, {
2080
2312
  value: current.title,
2081
2313
  className: "relative min-h-0 mt-0 flex flex-col",
2082
2314
  children: [
2083
- /* @__PURE__ */ jsx33(Pre3, {
2084
- code: current.highlighted,
2085
- className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-dk-background selection:bg-dk-selection selection:text-current max-h-full flex-1",
2086
- style: highlightedStyle,
2087
- handlers
2088
- }),
2089
- groupOptions.copyButton && /* @__PURE__ */ jsx33(CopyButton, {
2090
- text: current.highlighted.code,
2315
+ current.pre,
2316
+ group.options.copyButton && /* @__PURE__ */ jsx44(CopyButton, {
2317
+ text: code,
2091
2318
  variant: "floating",
2092
- className: "absolute right-3 top-3 z-10 text-dk-tab-inactive-foreground"
2319
+ className: "absolute right-3 top-3 z-10 text-openpkg-code-text-inactive"
2093
2320
  })
2094
2321
  ]
2095
2322
  })
@@ -2098,22 +2325,22 @@ function ClientMultiCode({
2098
2325
  }
2099
2326
  // src/docskit/code.diff.tsx
2100
2327
  import {
2101
- highlight as highlight4,
2102
- Pre as Pre4
2328
+ highlight as highlight3,
2329
+ Pre as Pre3
2103
2330
  } from "codehike/code";
2104
2331
  import { ChevronDown as ChevronDown3, ChevronUp } from "lucide-react";
2105
- import { useEffect as useEffect4, useState as useState8 } from "react";
2106
- import { jsx as jsx34, jsxs as jsxs20 } from "react/jsx-runtime";
2332
+ import { useEffect as useEffect6, useState as useState13 } from "react";
2333
+ import { jsx as jsx45, jsxs as jsxs27 } from "react/jsx-runtime";
2107
2334
 
2108
2335
  function StackedChevrons({ isOpen, className }) {
2109
- return /* @__PURE__ */ jsxs20("div", {
2336
+ return /* @__PURE__ */ jsxs27("div", {
2110
2337
  className: cn("flex flex-col items-center -space-y-1 transition-opacity", className),
2111
2338
  children: [
2112
- /* @__PURE__ */ jsx34(ChevronUp, {
2113
- className: cn("size-3 transition-colors", isOpen ? "text-dk-tab-active-foreground" : "text-dk-tab-inactive-foreground")
2339
+ /* @__PURE__ */ jsx45(ChevronUp, {
2340
+ className: cn("size-3 transition-colors", isOpen ? "text-openpkg-code-text-active" : "text-openpkg-code-text-inactive")
2114
2341
  }),
2115
- /* @__PURE__ */ jsx34(ChevronDown3, {
2116
- className: cn("size-3 transition-colors", isOpen ? "text-dk-tab-active-foreground" : "text-dk-tab-inactive-foreground")
2342
+ /* @__PURE__ */ jsx45(ChevronDown3, {
2343
+ className: cn("size-3 transition-colors", isOpen ? "text-openpkg-code-text-active" : "text-openpkg-code-text-inactive")
2117
2344
  })
2118
2345
  ]
2119
2346
  });
@@ -2128,14 +2355,14 @@ function ClientDiffCode(props) {
2128
2355
  className: wrapperClassName,
2129
2356
  defaultOpen = true
2130
2357
  } = props;
2131
- const [highlighted, setHighlighted] = useState8(null);
2132
- const [isOpen, setIsOpen] = useState8(defaultOpen);
2358
+ const [highlighted, setHighlighted] = useState13(null);
2359
+ const [isOpen, setIsOpen] = useState13(defaultOpen);
2133
2360
  const { title, flags } = extractFlags3(codeblock);
2134
2361
  const options = flagsToOptions(flags);
2135
2362
  const filename = filenameProp || title || "file";
2136
- useEffect4(() => {
2363
+ useEffect6(() => {
2137
2364
  let cancelled = false;
2138
- highlight4({ ...codeblock, lang: codeblock.lang || "txt" }, theme).then((result) => {
2365
+ highlight3({ ...codeblock, lang: codeblock.lang || "txt" }, theme).then((result) => {
2139
2366
  if (!cancelled)
2140
2367
  setHighlighted(result);
2141
2368
  });
@@ -2144,7 +2371,7 @@ function ClientDiffCode(props) {
2144
2371
  };
2145
2372
  }, [codeblock.value, codeblock.lang, codeblock.meta, codeblock]);
2146
2373
  if (!highlighted) {
2147
- return /* @__PURE__ */ jsx34(CodeBlockSkeleton, {
2374
+ return /* @__PURE__ */ jsx45(CodeBlockSkeleton, {
2148
2375
  hasTitle: true
2149
2376
  });
2150
2377
  }
@@ -2154,53 +2381,53 @@ function ClientDiffCode(props) {
2154
2381
  }
2155
2382
  const { background: _background, ...highlightedStyle } = highlighted.style;
2156
2383
  const showCopy = options?.copyButton;
2157
- const icon2 = /* @__PURE__ */ jsx34(CodeIcon, {
2384
+ const icon2 = /* @__PURE__ */ jsx45(CodeIcon, {
2158
2385
  title: filename,
2159
2386
  lang: codeblock.lang,
2160
2387
  className: "opacity-60"
2161
2388
  });
2162
2389
  const hasAdditions = diff2?.additions !== undefined && diff2.additions > 0;
2163
2390
  const hasDeletions = diff2?.deletions !== undefined && diff2.deletions > 0;
2164
- return /* @__PURE__ */ jsx34(Collapsible, {
2391
+ return /* @__PURE__ */ jsx45(Collapsible, {
2165
2392
  open: isOpen,
2166
2393
  onOpenChange: setIsOpen,
2167
- children: /* @__PURE__ */ jsxs20("div", {
2168
- className: cn("group rounded overflow-hidden relative border-dk-border flex flex-col border my-4 not-prose", wrapperClassName),
2394
+ children: /* @__PURE__ */ jsxs27("div", {
2395
+ className: cn("group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose", wrapperClassName),
2169
2396
  children: [
2170
- /* @__PURE__ */ jsx34(CollapsibleTrigger2, {
2397
+ /* @__PURE__ */ jsx45(CollapsibleTrigger2, {
2171
2398
  asChild: true,
2172
- children: /* @__PURE__ */ jsxs20("button", {
2399
+ children: /* @__PURE__ */ jsxs27("button", {
2173
2400
  type: "button",
2174
- className: cn("border-b border-dk-border bg-dk-tabs-background px-3 py-0", "w-full h-9 flex items-center shrink-0 cursor-pointer", "text-dk-tab-inactive-foreground text-sm font-mono", "hover:bg-dk-background/50 transition-colors"),
2401
+ className: cn("border-b border-openpkg-code-border bg-openpkg-code-header px-3 py-0", "w-full h-9 flex items-center shrink-0 cursor-pointer", "text-openpkg-code-text-inactive text-sm font-mono", "hover:bg-openpkg-code-bg/50 transition-colors"),
2175
2402
  children: [
2176
- /* @__PURE__ */ jsxs20("div", {
2403
+ /* @__PURE__ */ jsxs27("div", {
2177
2404
  className: "flex items-center h-5 gap-2 flex-1 min-w-0",
2178
2405
  children: [
2179
- /* @__PURE__ */ jsx34("div", {
2406
+ /* @__PURE__ */ jsx45("div", {
2180
2407
  className: "size-4 shrink-0",
2181
2408
  children: icon2
2182
2409
  }),
2183
- path && /* @__PURE__ */ jsx34("span", {
2184
- className: "text-dk-tab-inactive-foreground truncate",
2410
+ path && /* @__PURE__ */ jsx45("span", {
2411
+ className: "text-openpkg-code-text-inactive truncate",
2185
2412
  children: path
2186
2413
  }),
2187
- /* @__PURE__ */ jsx34("span", {
2188
- className: "text-dk-tab-active-foreground font-medium truncate",
2414
+ /* @__PURE__ */ jsx45("span", {
2415
+ className: "text-openpkg-code-text-active font-medium truncate",
2189
2416
  children: filename
2190
2417
  })
2191
2418
  ]
2192
2419
  }),
2193
- /* @__PURE__ */ jsxs20("div", {
2420
+ /* @__PURE__ */ jsxs27("div", {
2194
2421
  className: "flex items-center gap-2 text-sm shrink-0 ml-2",
2195
2422
  children: [
2196
- hasAdditions && /* @__PURE__ */ jsxs20("span", {
2423
+ hasAdditions && /* @__PURE__ */ jsxs27("span", {
2197
2424
  className: "text-green-500 font-medium",
2198
2425
  children: [
2199
2426
  "+",
2200
2427
  diff2.additions
2201
2428
  ]
2202
2429
  }),
2203
- hasDeletions && /* @__PURE__ */ jsxs20("span", {
2430
+ hasDeletions && /* @__PURE__ */ jsxs27("span", {
2204
2431
  className: "text-red-500 font-medium",
2205
2432
  children: [
2206
2433
  "-",
@@ -2209,27 +2436,27 @@ function ClientDiffCode(props) {
2209
2436
  })
2210
2437
  ]
2211
2438
  }),
2212
- /* @__PURE__ */ jsx34(StackedChevrons, {
2439
+ /* @__PURE__ */ jsx45(StackedChevrons, {
2213
2440
  isOpen,
2214
2441
  className: "ml-2"
2215
2442
  })
2216
2443
  ]
2217
2444
  })
2218
2445
  }),
2219
- /* @__PURE__ */ jsx34(CollapsibleContent2, {
2220
- children: /* @__PURE__ */ jsxs20("div", {
2446
+ /* @__PURE__ */ jsx45(CollapsibleContent2, {
2447
+ children: /* @__PURE__ */ jsxs27("div", {
2221
2448
  className: "relative flex items-start",
2222
2449
  children: [
2223
- /* @__PURE__ */ jsx34(Pre4, {
2450
+ /* @__PURE__ */ jsx45(Pre3, {
2224
2451
  code: highlighted,
2225
- className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-dk-background selection:bg-dk-selection selection:text-current max-h-full flex-1",
2452
+ className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current max-h-full flex-1",
2226
2453
  style: highlightedStyle,
2227
2454
  handlers
2228
2455
  }),
2229
- showCopy && /* @__PURE__ */ jsx34(CopyButton, {
2456
+ showCopy && /* @__PURE__ */ jsx45(CopyButton, {
2230
2457
  text: highlighted.code,
2231
2458
  variant: "floating",
2232
- className: "absolute right-3 top-3 z-10 text-dk-tab-inactive-foreground"
2459
+ className: "absolute right-3 top-3 z-10 text-openpkg-code-text-inactive"
2233
2460
  })
2234
2461
  ]
2235
2462
  })
@@ -2246,21 +2473,19 @@ function extractFlags3(codeblock) {
2246
2473
  return { title, flags: flags.slice(1) };
2247
2474
  }
2248
2475
  // src/docskit/code.inline.tsx
2249
- import { highlight as highlight5, Inline as Inline2 } from "codehike/code";
2250
- import { jsx as jsx35 } from "react/jsx-runtime";
2251
- async function DocsKitInlineCode({
2252
- codeblock
2253
- }) {
2254
- const highlighted = await highlight5(codeblock, theme);
2255
- return /* @__PURE__ */ jsx35(Inline2, {
2476
+ import { highlight as highlight4, Inline as Inline2 } from "codehike/code";
2477
+ import { jsx as jsx46 } from "react/jsx-runtime";
2478
+ async function DocsKitInlineCode({ codeblock }) {
2479
+ const highlighted = await highlight4(codeblock, theme);
2480
+ return /* @__PURE__ */ jsx46(Inline2, {
2256
2481
  code: highlighted,
2257
- className: "selection:bg-dk-selection selection:text-current rounded border border-dk-border px-1 py-0.5 whitespace-nowrap !bg-dk-background",
2482
+ className: "selection:bg-openpkg-code-selection selection:text-current rounded border border-openpkg-code-border px-1 py-0.5 whitespace-nowrap !bg-openpkg-code-bg",
2258
2483
  style: highlighted.style
2259
2484
  });
2260
2485
  }
2261
2486
  // src/docskit/code.package-install.tsx
2262
- import { useState as useState9 } from "react";
2263
- import { jsx as jsx36, jsxs as jsxs21 } from "react/jsx-runtime";
2487
+ import { useState as useState14 } from "react";
2488
+ import { jsx as jsx47, jsxs as jsxs28 } from "react/jsx-runtime";
2264
2489
 
2265
2490
  var managerLabels = {
2266
2491
  npm: "npm",
@@ -2312,81 +2537,61 @@ function PackageInstall({
2312
2537
  managers = ["npm", "bun", "pnpm", "yarn"],
2313
2538
  copyButton = true
2314
2539
  }) {
2315
- const [activeManager, setActiveManager] = useState9(managers[0]);
2540
+ const [activeManager, setActiveManager] = useState14(managers[0]);
2316
2541
  const command = getInstallCommand(activeManager, pkg, { dev, global: isGlobal });
2317
- return /* @__PURE__ */ jsxs21("div", {
2318
- className: "group rounded overflow-hidden border border-dk-border flex flex-col my-4 not-prose",
2542
+ return /* @__PURE__ */ jsxs28("div", {
2543
+ className: "group rounded overflow-hidden border border-openpkg-code-border flex flex-col my-4 not-prose",
2319
2544
  children: [
2320
- /* @__PURE__ */ jsxs21("div", {
2321
- className: cn("border-b border-dk-border bg-dk-tabs-background", "w-full h-9 flex items-center px-3 gap-2 shrink-0"),
2545
+ /* @__PURE__ */ jsxs28("div", {
2546
+ className: cn("border-b border-openpkg-code-border bg-openpkg-code-header", "w-full h-9 flex items-center px-3 gap-2 shrink-0"),
2322
2547
  children: [
2323
- /* @__PURE__ */ jsxs21("div", {
2548
+ /* @__PURE__ */ jsxs28("div", {
2324
2549
  className: "flex items-center gap-2",
2325
2550
  children: [
2326
- /* @__PURE__ */ jsx36("div", {
2327
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
2551
+ /* @__PURE__ */ jsx47("div", {
2552
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
2328
2553
  }),
2329
- /* @__PURE__ */ jsx36("div", {
2330
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
2554
+ /* @__PURE__ */ jsx47("div", {
2555
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
2331
2556
  }),
2332
- /* @__PURE__ */ jsx36("div", {
2333
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
2557
+ /* @__PURE__ */ jsx47("div", {
2558
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
2334
2559
  })
2335
2560
  ]
2336
2561
  }),
2337
- /* @__PURE__ */ jsx36("div", {
2562
+ /* @__PURE__ */ jsx47("div", {
2338
2563
  className: "flex items-center gap-0.5 ml-1",
2339
- children: managers.map((manager) => /* @__PURE__ */ jsx36("button", {
2564
+ children: managers.map((manager) => /* @__PURE__ */ jsx47("button", {
2340
2565
  type: "button",
2341
2566
  onClick: () => setActiveManager(manager),
2342
- className: cn("px-2 py-0.5 text-sm font-medium rounded-md transition-colors duration-200", "border h-6", activeManager === manager ? "bg-dk-background border-dk-border text-dk-tab-active-foreground" : "border-transparent text-dk-tab-inactive-foreground hover:text-dk-tab-active-foreground"),
2567
+ className: cn("px-2 py-0.5 text-sm font-medium rounded-md transition-colors duration-200", "border h-6", activeManager === manager ? "bg-openpkg-code-bg border-openpkg-code-border text-openpkg-code-text-active" : "border-transparent text-openpkg-code-text-inactive hover:text-openpkg-code-text-active"),
2343
2568
  children: managerLabels[manager]
2344
2569
  }, manager))
2345
2570
  }),
2346
- /* @__PURE__ */ jsx36("span", {
2571
+ /* @__PURE__ */ jsx47("span", {
2347
2572
  className: "sr-only",
2348
2573
  children: "Terminal window"
2349
2574
  })
2350
2575
  ]
2351
2576
  }),
2352
- /* @__PURE__ */ jsxs21("div", {
2353
- className: "relative flex items-start bg-dk-background",
2354
- children: [
2355
- /* @__PURE__ */ jsx36("pre", {
2356
- className: "overflow-auto px-3 py-3 m-0 font-mono text-sm flex-1",
2357
- children: /* @__PURE__ */ jsxs21("code", {
2358
- children: [
2359
- /* @__PURE__ */ jsx36("span", {
2360
- className: "text-ch-5",
2361
- children: command.split(" ")[0]
2362
- }),
2363
- /* @__PURE__ */ jsxs21("span", {
2364
- className: "text-ch-0",
2365
- children: [
2366
- " ",
2367
- command.split(" ").slice(1).join(" ")
2368
- ]
2369
- })
2370
- ]
2371
- })
2372
- }),
2373
- copyButton && /* @__PURE__ */ jsx36(CopyButton, {
2374
- text: command,
2375
- variant: "floating",
2376
- className: "absolute right-3 top-1/2 -translate-y-1/2 z-10 text-dk-tab-inactive-foreground"
2377
- })
2378
- ]
2577
+ /* @__PURE__ */ jsx47(ClientDocsKitCode, {
2578
+ codeblock: {
2579
+ value: command,
2580
+ lang: "bash",
2581
+ meta: copyButton ? "-c" : ""
2582
+ },
2583
+ className: "!my-0 !border-0 !rounded-none"
2379
2584
  })
2380
2585
  ]
2381
2586
  });
2382
2587
  }
2383
2588
  // src/docskit/code.tabs.tsx
2384
- import { Block, CodeBlock } from "codehike/blocks";
2589
+ import { Block, CodeBlock as CodeBlock2 } from "codehike/blocks";
2385
2590
  import { z } from "zod";
2386
- import { jsx as jsx37 } from "react/jsx-runtime";
2591
+ import { jsx as jsx48 } from "react/jsx-runtime";
2387
2592
  async function CodeGroup(props) {
2388
2593
  const result = Block.extend({
2389
- code: z.array(CodeBlock),
2594
+ code: z.array(CodeBlock2),
2390
2595
  flags: z.string().optional(),
2391
2596
  storage: z.string().optional(),
2392
2597
  handlers: z.array(z.any()).optional()
@@ -2395,16 +2600,16 @@ async function CodeGroup(props) {
2395
2600
  throw betterError(result.error, "CodeGroup");
2396
2601
  }
2397
2602
  const { code, ...rest } = result.data;
2398
- return /* @__PURE__ */ jsx37(Code, {
2603
+ return /* @__PURE__ */ jsx48(Code, {
2399
2604
  codeblocks: code,
2400
2605
  ...rest
2401
2606
  });
2402
2607
  }
2403
2608
  async function Code(props) {
2404
2609
  const group = await toCodeGroup(props);
2405
- return group.tabs.length === 1 ? /* @__PURE__ */ jsx37(SingleCode, {
2610
+ return group.tabs.length === 1 ? /* @__PURE__ */ jsx48(SingleCode, {
2406
2611
  group
2407
- }) : /* @__PURE__ */ jsx37(MultiCode, {
2612
+ }) : /* @__PURE__ */ jsx48(MultiCode, {
2408
2613
  group
2409
2614
  }, group.storage);
2410
2615
  }
@@ -2417,13 +2622,13 @@ function betterError(error, componentName) {
2417
2622
  }
2418
2623
  }
2419
2624
  // src/docskit/code.terminal.tsx
2420
- import { highlight as highlight6, Pre as Pre5 } from "codehike/code";
2421
- import { jsx as jsx38, jsxs as jsxs22 } from "react/jsx-runtime";
2625
+ import { highlight as highlight5, Pre as Pre4 } from "codehike/code";
2626
+ import { jsx as jsx49, jsxs as jsxs29 } from "react/jsx-runtime";
2422
2627
  async function Terminal(props) {
2423
2628
  const { codeblock, handlers: extraHandlers } = props;
2424
2629
  const { flags } = extractFlags4(codeblock);
2425
2630
  const options = flagsToOptions(flags);
2426
- const highlighted = await highlight6({ ...codeblock, lang: codeblock.lang || "bash" }, theme);
2631
+ const highlighted = await highlight5({ ...codeblock, lang: codeblock.lang || "bash" }, theme);
2427
2632
  const handlers = getHandlers(options);
2428
2633
  if (extraHandlers) {
2429
2634
  handlers.push(...extraHandlers);
@@ -2432,45 +2637,45 @@ async function Terminal(props) {
2432
2637
  const showCopy = options?.copyButton;
2433
2638
  const isMultiLine = highlighted.code.includes(`
2434
2639
  `);
2435
- return /* @__PURE__ */ jsxs22("div", {
2436
- className: "group rounded overflow-hidden relative border-dk-border flex flex-col border my-4 not-prose",
2640
+ return /* @__PURE__ */ jsxs29("div", {
2641
+ className: "group rounded overflow-hidden relative border-openpkg-code-border flex flex-col border my-4 not-prose",
2437
2642
  children: [
2438
- /* @__PURE__ */ jsxs22("div", {
2439
- className: cn("border-b border-dk-border bg-dk-tabs-background", "w-full h-9 flex items-center justify-center shrink-0", "relative"),
2643
+ /* @__PURE__ */ jsxs29("div", {
2644
+ className: cn("border-b border-openpkg-code-border bg-openpkg-code-header", "w-full h-9 flex items-center justify-center shrink-0", "relative"),
2440
2645
  children: [
2441
- /* @__PURE__ */ jsxs22("div", {
2646
+ /* @__PURE__ */ jsxs29("div", {
2442
2647
  className: "absolute left-3 flex items-center gap-2",
2443
2648
  children: [
2444
- /* @__PURE__ */ jsx38("div", {
2445
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
2649
+ /* @__PURE__ */ jsx49("div", {
2650
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
2446
2651
  }),
2447
- /* @__PURE__ */ jsx38("div", {
2448
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
2652
+ /* @__PURE__ */ jsx49("div", {
2653
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
2449
2654
  }),
2450
- /* @__PURE__ */ jsx38("div", {
2451
- className: "size-3 rounded-full bg-dk-tab-inactive-foreground/30"
2655
+ /* @__PURE__ */ jsx49("div", {
2656
+ className: "size-3 rounded-full bg-openpkg-code-text-inactive/30"
2452
2657
  })
2453
2658
  ]
2454
2659
  }),
2455
- /* @__PURE__ */ jsx38("span", {
2660
+ /* @__PURE__ */ jsx49("span", {
2456
2661
  className: "sr-only",
2457
2662
  children: "Terminal window"
2458
2663
  })
2459
2664
  ]
2460
2665
  }),
2461
- /* @__PURE__ */ jsxs22("div", {
2666
+ /* @__PURE__ */ jsxs29("div", {
2462
2667
  className: "relative flex items-start",
2463
2668
  children: [
2464
- /* @__PURE__ */ jsx38(Pre5, {
2669
+ /* @__PURE__ */ jsx49(Pre4, {
2465
2670
  code: highlighted,
2466
- className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-dk-background selection:bg-dk-selection selection:text-current max-h-full flex-1",
2671
+ className: "overflow-auto px-0 py-3 m-0 rounded-none !bg-openpkg-code-bg selection:bg-openpkg-code-selection selection:text-current max-h-full flex-1",
2467
2672
  style: highlightedStyle,
2468
2673
  handlers
2469
2674
  }),
2470
- showCopy && /* @__PURE__ */ jsx38(CopyButton, {
2675
+ showCopy && /* @__PURE__ */ jsx49(CopyButton, {
2471
2676
  text: highlighted.code,
2472
2677
  variant: "floating",
2473
- className: cn("absolute right-3 z-10 text-dk-tab-inactive-foreground", isMultiLine ? "top-3" : "top-1/2 -translate-y-1/2")
2678
+ className: cn("absolute right-3 z-10 text-openpkg-code-text-inactive", isMultiLine ? "top-3" : "top-1/2 -translate-y-1/2")
2474
2679
  })
2475
2680
  ]
2476
2681
  })
@@ -2484,19 +2689,19 @@ function extractFlags4(codeblock) {
2484
2689
  return { flags };
2485
2690
  }
2486
2691
  // src/docskit/docskit.tsx
2487
- import React8 from "react";
2692
+ import React7 from "react";
2488
2693
  function addDocsKit(components) {
2489
2694
  return {
2490
2695
  ...components,
2491
2696
  DocsKitCode,
2492
2697
  DocsKitInlineCode,
2493
2698
  a: (props) => {
2494
- return React8.createElement(components?.a || "a", props);
2699
+ return React7.createElement(components?.a || "a", props);
2495
2700
  }
2496
2701
  };
2497
2702
  }
2498
2703
  // src/docskit/notes.tsx
2499
- import { jsx as jsx39 } from "react/jsx-runtime";
2704
+ import { jsx as jsx50 } from "react/jsx-runtime";
2500
2705
  function WithNotes({ children, ...rest }) {
2501
2706
  const notes = Object.entries(rest).filter(([name]) => name !== "title" && name !== "_data").map(([name, value]) => {
2502
2707
  const block = value;
@@ -2510,7 +2715,7 @@ function WithNotes({ children, ...rest }) {
2510
2715
  return {
2511
2716
  name,
2512
2717
  type: "code",
2513
- children: /* @__PURE__ */ jsx39(Code, {
2718
+ children: /* @__PURE__ */ jsx50(Code, {
2514
2719
  codeblocks: [block]
2515
2720
  })
2516
2721
  };
@@ -2518,7 +2723,7 @@ function WithNotes({ children, ...rest }) {
2518
2723
  return {
2519
2724
  name,
2520
2725
  type: "image",
2521
- children: /* @__PURE__ */ jsx39("img", {
2726
+ children: /* @__PURE__ */ jsx50("img", {
2522
2727
  src: block.url,
2523
2728
  alt: block.alt
2524
2729
  })
@@ -2527,91 +2732,53 @@ function WithNotes({ children, ...rest }) {
2527
2732
  throw new Error("Invalid block inside <WithNotes />");
2528
2733
  }
2529
2734
  });
2530
- return /* @__PURE__ */ jsx39(WithClientNotes, {
2735
+ return /* @__PURE__ */ jsx50(WithClientNotes, {
2531
2736
  notes,
2532
2737
  children
2533
2738
  });
2534
2739
  }
2535
- // src/docskit/code.tabs-legacy.tsx
2536
- import { Check as Check6, Copy as Copy6 } from "lucide-react";
2537
- import { useState as useState10 } from "react";
2538
- import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
2740
+ // src/docskit/import-section.tsx
2741
+ import { Check as Check4, Copy as Copy4 } from "lucide-react";
2539
2742
 
2540
- function CodeTabs({
2541
- tabs,
2542
- defaultIndex = 0,
2543
- sticky = false,
2544
- className
2545
- }) {
2546
- const [activeIndex, setActiveIndex] = useState10(defaultIndex);
2547
- const [copied, copy] = useCopyToClipboard();
2548
- const activeTab = tabs[activeIndex];
2549
- const handleCopy = () => {
2550
- if (!activeTab)
2551
- return;
2552
- copy(activeTab.code);
2553
- };
2554
- if (!tabs.length)
2555
- return null;
2556
- return /* @__PURE__ */ jsxs23("div", {
2557
- className: cn("group rounded-lg border border-dk-border bg-dk-background overflow-hidden", "selection:bg-dk-selection selection:text-current", className),
2558
- children: [
2559
- /* @__PURE__ */ jsxs23("div", {
2560
- className: cn("flex items-center border-b border-dk-border bg-dk-tabs-background", sticky && "sticky top-0 z-10"),
2561
- children: [
2562
- /* @__PURE__ */ jsx40("div", {
2563
- className: "flex-1 flex items-stretch",
2564
- children: tabs.map((tab, index) => /* @__PURE__ */ jsx40("button", {
2565
- type: "button",
2566
- onClick: () => setActiveIndex(index),
2567
- className: cn("px-4 py-2 text-sm font-mono transition-colors duration-200", "border-r border-dk-border last:border-r-0", index === activeIndex ? "text-dk-tab-active-foreground bg-dk-background/50" : "text-dk-tab-inactive-foreground hover:text-dk-tab-active-foreground"),
2568
- children: tab.label
2569
- }, tab.label))
2570
- }),
2571
- /* @__PURE__ */ jsx40("button", {
2572
- type: "button",
2573
- onClick: handleCopy,
2574
- className: cn("p-2 mx-2", "text-dk-tab-inactive-foreground hover:text-dk-tab-active-foreground", "opacity-0 group-hover:opacity-100 transition-opacity", "cursor-pointer"),
2575
- "aria-label": "Copy code",
2576
- children: copied ? /* @__PURE__ */ jsx40(Check6, {
2577
- size: 16
2578
- }) : /* @__PURE__ */ jsx40(Copy6, {
2579
- size: 16
2580
- })
2581
- })
2582
- ]
2583
- }),
2584
- /* @__PURE__ */ jsx40("div", {
2585
- className: "bg-dk-background",
2586
- children: activeTab?.content
2587
- })
2588
- ]
2589
- });
2743
+ // src/hooks/use-copy-to-clipboard.ts
2744
+ import { useCallback as useCallback2, useRef as useRef5, useState as useState15 } from "react";
2745
+ var COPY_FEEDBACK_MS = 1200;
2746
+ function useCopyToClipboard(timeout = COPY_FEEDBACK_MS) {
2747
+ const [copied, setCopied] = useState15(false);
2748
+ const timerRef = useRef5(undefined);
2749
+ const copy = useCallback2((text) => {
2750
+ navigator.clipboard.writeText(text).then(() => {
2751
+ setCopied(true);
2752
+ clearTimeout(timerRef.current);
2753
+ timerRef.current = setTimeout(() => setCopied(false), timeout);
2754
+ });
2755
+ }, [timeout]);
2756
+ return [copied, copy];
2590
2757
  }
2758
+
2591
2759
  // src/docskit/import-section.tsx
2592
- import { Check as Check7, Copy as Copy7 } from "lucide-react";
2593
- import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
2760
+ import { jsx as jsx51, jsxs as jsxs30 } from "react/jsx-runtime";
2594
2761
 
2595
2762
  function ImportSection({ importStatement, className }) {
2596
2763
  const [copied, copy] = useCopyToClipboard();
2597
2764
  const handleCopy = () => {
2598
2765
  copy(importStatement);
2599
2766
  };
2600
- return /* @__PURE__ */ jsxs24("div", {
2767
+ return /* @__PURE__ */ jsxs30("div", {
2601
2768
  className: cn("group flex items-center justify-between gap-3", "rounded-lg border border-[var(--openpkg-border-subtle)] bg-[var(--openpkg-bg-secondary)] px-4 py-3", className),
2602
2769
  children: [
2603
- /* @__PURE__ */ jsx41("code", {
2770
+ /* @__PURE__ */ jsx51("code", {
2604
2771
  className: "font-mono text-sm text-[var(--openpkg-text-primary)] overflow-x-auto",
2605
2772
  children: importStatement
2606
2773
  }),
2607
- /* @__PURE__ */ jsx41("button", {
2774
+ /* @__PURE__ */ jsx51("button", {
2608
2775
  type: "button",
2609
2776
  onClick: handleCopy,
2610
2777
  className: cn("shrink-0 p-1.5 rounded", "text-[var(--openpkg-text-muted)] hover:text-[var(--openpkg-text-primary)]", "opacity-0 group-hover:opacity-100 transition-opacity duration-200", "cursor-pointer"),
2611
2778
  "aria-label": "Copy import statement",
2612
- children: copied ? /* @__PURE__ */ jsx41(Check7, {
2779
+ children: copied ? /* @__PURE__ */ jsx51(Check4, {
2613
2780
  size: 16
2614
- }) : /* @__PURE__ */ jsx41(Copy7, {
2781
+ }) : /* @__PURE__ */ jsx51(Copy4, {
2615
2782
  size: 16
2616
2783
  })
2617
2784
  })
@@ -2620,8 +2787,8 @@ function ImportSection({ importStatement, className }) {
2620
2787
  }
2621
2788
  // src/docskit/type-badge.tsx
2622
2789
  import { cva as cva2 } from "class-variance-authority";
2623
- import * as React9 from "react";
2624
- import { jsx as jsx42 } from "react/jsx-runtime";
2790
+ import * as React8 from "react";
2791
+ import { jsx as jsx52 } from "react/jsx-runtime";
2625
2792
  var typeBadgeVariants = cva2("font-mono text-sm", {
2626
2793
  variants: {
2627
2794
  typeColor: {
@@ -2676,9 +2843,9 @@ function detectTypeColor(type) {
2676
2843
  }
2677
2844
  return "default";
2678
2845
  }
2679
- var TypeBadge = React9.forwardRef(({ className, type, typeColor, ...props }, ref) => {
2846
+ var TypeBadge = React8.forwardRef(({ className, type, typeColor, ...props }, ref) => {
2680
2847
  const color2 = typeColor ?? detectTypeColor(type);
2681
- return /* @__PURE__ */ jsx42("span", {
2848
+ return /* @__PURE__ */ jsx52("span", {
2682
2849
  ref,
2683
2850
  className: cn(typeBadgeVariants({ typeColor: color2 }), className),
2684
2851
  ...props,
@@ -2688,6 +2855,8 @@ var TypeBadge = React9.forwardRef(({ className, type, typeColor, ...props }, ref
2688
2855
  TypeBadge.displayName = "TypeBadge";
2689
2856
  export {
2690
2857
  wordWrap,
2858
+ useSyncSection,
2859
+ useSyncScroll,
2691
2860
  typeBadgeVariants,
2692
2861
  tooltip,
2693
2862
  toCodeGroup,
@@ -2713,25 +2882,34 @@ export {
2713
2882
  TabsList,
2714
2883
  TabsContent,
2715
2884
  Tabs,
2885
+ SyncScrollProvider,
2716
2886
  SingleCode,
2717
2887
  ResponseBlock,
2718
2888
  ParameterList,
2719
2889
  PackageInstall,
2890
+ NestedParameterToggle,
2891
+ NestedParameterContainer,
2720
2892
  MultiCode,
2893
+ MethodSection,
2721
2894
  LanguageSelector,
2722
2895
  InlineCodeSkeleton,
2723
2896
  ImportSection,
2724
2897
  HoverLink,
2898
+ ExpandableParameter,
2899
+ ExampleSection,
2900
+ ExampleChips,
2901
+ EnumValuesSection,
2725
2902
  EndpointHeader,
2726
2903
  EndpointBadge,
2727
2904
  DocsKitInlineCode,
2728
2905
  DocsKitCode,
2729
2906
  CopyButton,
2907
+ CollapsiblePanel,
2730
2908
  CodeTabsSkeleton,
2731
- CodeTabs,
2732
2909
  CodeIcon,
2733
2910
  CodeGroup,
2734
2911
  CodeBlockSkeleton,
2912
+ CodeBlock,
2735
2913
  Code,
2736
2914
  ClientTerminal,
2737
2915
  ClientInlineCode,
@@ -2740,6 +2918,7 @@ export {
2740
2918
  ClientCode,
2741
2919
  APISection,
2742
2920
  APIReferencePage,
2921
+ APIReferenceLayout,
2743
2922
  APIParameterItem,
2744
2923
  APICodePanel
2745
2924
  };