@docubook/mdx 1.0.0 → 1.1.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.
- package/README.md +121 -0
- package/dist/{Stepper-B7xt0Dyr.d.cts → Stepper-I9nywkZb.d.cts} +1 -1
- package/dist/{Stepper-B7xt0Dyr.d.ts → Stepper-I9nywkZb.d.ts} +1 -1
- package/dist/adapters/next/index.cjs +8 -6
- package/dist/adapters/next/index.js +8 -6
- package/dist/adapters/react-router/index.cjs +8 -6
- package/dist/adapters/react-router/index.js +8 -6
- package/dist/core/index.cjs +262 -116
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +273 -127
- package/dist/core/server.cjs +74 -36
- package/dist/core/server.d.cts +2 -2
- package/dist/core/server.d.ts +2 -2
- package/dist/core/server.js +74 -36
- package/dist/index.cjs +74 -36
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +74 -36
- package/package.json +1 -1
package/dist/core/index.cjs
CHANGED
|
@@ -85,7 +85,24 @@ function AccordionGroupProvider({ children }) {
|
|
|
85
85
|
|
|
86
86
|
// src/core/components/Accordion.tsx
|
|
87
87
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
88
|
+
var accordionDefaultClasses = {
|
|
89
|
+
rootStandalone: "rounded-lg border shadow-sm",
|
|
90
|
+
rootInGroup: "border-border border-b last:border-b-0",
|
|
91
|
+
button: "bg-muted/40 dark:bg-muted/20 hover:bg-muted/70 dark:hover:bg-muted/70 flex w-full cursor-pointer items-center gap-2 px-4 py-3 text-start transition-colors",
|
|
92
|
+
chevron: "text-muted-foreground h-4 w-4 shrink-0 transition-transform duration-200",
|
|
93
|
+
chevronOpen: "rotate-90",
|
|
94
|
+
icon: "text-foreground h-4 w-4 shrink-0",
|
|
95
|
+
title: "text-foreground m-0! text-base font-medium",
|
|
96
|
+
contentGrid: "grid transition-[grid-template-rows] duration-200 ease-out",
|
|
97
|
+
contentGridOpen: "grid-rows-[1fr]",
|
|
98
|
+
contentGridClosed: "grid-rows-[0fr]",
|
|
99
|
+
contentOverflow: "overflow-hidden",
|
|
100
|
+
contentBody: "dark:bg-muted/10 bg-muted/15 px-4 py-3"
|
|
101
|
+
};
|
|
88
102
|
function Accordion({ title, children, icon }) {
|
|
103
|
+
const baseId = (0, import_react2.useId)();
|
|
104
|
+
const triggerId = `${baseId}-trigger`;
|
|
105
|
+
const contentId = `${baseId}-content`;
|
|
89
106
|
const groupContext = (0, import_react2.useContext)(AccordionGroupContext);
|
|
90
107
|
const isInGroup = groupContext?.inGroup === true;
|
|
91
108
|
const groupOpen = groupContext?.openTitle === title;
|
|
@@ -103,9 +120,11 @@ function Accordion({ title, children, icon }) {
|
|
|
103
120
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
104
121
|
"div",
|
|
105
122
|
{
|
|
123
|
+
"data-docubook": "accordion",
|
|
106
124
|
className: cn(
|
|
107
|
-
|
|
108
|
-
isInGroup &&
|
|
125
|
+
"dbk-accordion",
|
|
126
|
+
!isInGroup && accordionDefaultClasses.rootStandalone,
|
|
127
|
+
isInGroup && accordionDefaultClasses.rootInGroup
|
|
109
128
|
),
|
|
110
129
|
children: [
|
|
111
130
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
@@ -113,19 +132,25 @@ function Accordion({ title, children, icon }) {
|
|
|
113
132
|
{
|
|
114
133
|
type: "button",
|
|
115
134
|
onClick: handleToggle,
|
|
116
|
-
className: "
|
|
135
|
+
className: cn("dbk-accordion__button", accordionDefaultClasses.button),
|
|
136
|
+
"aria-expanded": isOpen,
|
|
137
|
+
"aria-controls": contentId,
|
|
138
|
+
id: triggerId,
|
|
139
|
+
"data-docubook": "accordion-button",
|
|
117
140
|
children: [
|
|
118
141
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
119
142
|
import_lucide_react.ChevronRight,
|
|
120
143
|
{
|
|
121
144
|
className: cn(
|
|
122
|
-
"
|
|
123
|
-
|
|
124
|
-
|
|
145
|
+
"dbk-accordion__chevron",
|
|
146
|
+
accordionDefaultClasses.chevron,
|
|
147
|
+
isOpen && accordionDefaultClasses.chevronOpen
|
|
148
|
+
),
|
|
149
|
+
"data-docubook": "accordion-chevron"
|
|
125
150
|
}
|
|
126
151
|
),
|
|
127
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: "
|
|
128
|
-
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { className: "
|
|
152
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Icon, { className: cn("dbk-accordion__icon", accordionDefaultClasses.icon), "data-docubook": "accordion-icon" }),
|
|
153
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { className: cn("dbk-accordion__title", accordionDefaultClasses.title), "data-docubook": "accordion-title", children: title })
|
|
129
154
|
]
|
|
130
155
|
}
|
|
131
156
|
),
|
|
@@ -133,10 +158,15 @@ function Accordion({ title, children, icon }) {
|
|
|
133
158
|
"div",
|
|
134
159
|
{
|
|
135
160
|
className: cn(
|
|
136
|
-
"
|
|
137
|
-
|
|
161
|
+
"dbk-accordion__content-grid",
|
|
162
|
+
accordionDefaultClasses.contentGrid,
|
|
163
|
+
isOpen ? accordionDefaultClasses.contentGridOpen : accordionDefaultClasses.contentGridClosed
|
|
138
164
|
),
|
|
139
|
-
|
|
165
|
+
"data-docubook": "accordion-content-grid",
|
|
166
|
+
id: contentId,
|
|
167
|
+
role: "region",
|
|
168
|
+
"aria-labelledby": triggerId,
|
|
169
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: cn("dbk-accordion__content-overflow", accordionDefaultClasses.contentOverflow), "data-docubook": "accordion-content-overflow", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: cn("dbk-accordion__content-body", accordionDefaultClasses.contentBody), "data-docubook": "accordion-content-body", children }) })
|
|
140
170
|
}
|
|
141
171
|
)
|
|
142
172
|
]
|
|
@@ -147,8 +177,18 @@ function Accordion({ title, children, icon }) {
|
|
|
147
177
|
// src/core/components/AccordionGroup.tsx
|
|
148
178
|
var import_clsx2 = __toESM(require("clsx"), 1);
|
|
149
179
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
180
|
+
var accordionGroupDefaultClasses = {
|
|
181
|
+
root: "overflow-hidden rounded-lg border"
|
|
182
|
+
};
|
|
150
183
|
function AccordionGroup({ children, className }) {
|
|
151
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AccordionGroupProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
184
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AccordionGroupProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
className: (0, import_clsx2.default)("dbk-accordion-group", accordionGroupDefaultClasses.root, className),
|
|
188
|
+
"data-docubook": "accordion-group",
|
|
189
|
+
children
|
|
190
|
+
}
|
|
191
|
+
) });
|
|
152
192
|
}
|
|
153
193
|
|
|
154
194
|
// src/core/components/Button.tsx
|
|
@@ -222,6 +262,7 @@ function Card({
|
|
|
222
262
|
"div",
|
|
223
263
|
{
|
|
224
264
|
className: (0, import_clsx3.default)(
|
|
265
|
+
"dbk-card",
|
|
225
266
|
"border rounded-lg shadow-sm p-4 transition-all duration-200",
|
|
226
267
|
"bg-card text-card-foreground border-border",
|
|
227
268
|
"hover:bg-accent/5 hover:border-accent/30",
|
|
@@ -229,20 +270,21 @@ function Card({
|
|
|
229
270
|
horizontal ? "flex-row items-start gap-1" : "flex-col space-y-1",
|
|
230
271
|
className
|
|
231
272
|
),
|
|
273
|
+
"data-docubook": "card",
|
|
232
274
|
children: [
|
|
233
|
-
Icon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { className: (0, import_clsx3.default)("w-5 h-5 text-primary shrink-0", horizontal && "mt-0.5") }),
|
|
234
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
235
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-base font-semibold text-foreground leading-6", children: title }),
|
|
236
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-sm text-muted-foreground -mt-3", children })
|
|
275
|
+
Icon && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Icon, { className: (0, import_clsx3.default)("dbk-card__icon", "w-5 h-5 text-primary shrink-0", horizontal && "mt-0.5"), "data-docubook": "card-icon" }),
|
|
276
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "dbk-card__body flex-1 min-w-0", "data-docubook": "card-body", children: [
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dbk-card__title text-base font-semibold text-foreground leading-6", "data-docubook": "card-title", children: title }),
|
|
278
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "dbk-card__content text-sm text-muted-foreground -mt-3", "data-docubook": "card-content", children })
|
|
237
279
|
] })
|
|
238
280
|
]
|
|
239
281
|
}
|
|
240
282
|
);
|
|
241
283
|
if (!href) return content;
|
|
242
284
|
if (LinkComponent) {
|
|
243
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LinkComponent, { href, className: "no-underline block", children: content });
|
|
285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LinkComponent, { href, className: "dbk-card__link no-underline block", "data-docubook": "card-link", children: content });
|
|
244
286
|
}
|
|
245
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { className: "no-underline block", href, children: content });
|
|
287
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("a", { className: "dbk-card__link no-underline block", href, "data-docubook": "card-link", children: content });
|
|
246
288
|
}
|
|
247
289
|
|
|
248
290
|
// src/core/components/CardGroup.tsx
|
|
@@ -264,105 +306,144 @@ function CardGroup({ children, cols = 2, className }) {
|
|
|
264
306
|
var import_react4 = require("react");
|
|
265
307
|
var import_lucide_react2 = require("lucide-react");
|
|
266
308
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
267
|
-
|
|
309
|
+
var fileDefaultClasses = {
|
|
310
|
+
root: "flex items-center gap-2 py-1.5 pl-7 pr-3 text-sm rounded-md transition-colors duration-150 cursor-default select-none hover:bg-muted/50",
|
|
311
|
+
rootHover: "bg-accent/10",
|
|
312
|
+
icon: "h-3.5 w-3.5 shrink-0 transition-colors text-muted-foreground",
|
|
313
|
+
iconHover: "text-accent",
|
|
314
|
+
text: "font-mono text-sm text-foreground truncate",
|
|
315
|
+
extension: "ml-auto text-xs text-muted-foreground/80"
|
|
316
|
+
};
|
|
317
|
+
var folderDefaultClasses = {
|
|
318
|
+
root: "relative",
|
|
319
|
+
header: "flex items-center gap-2 py-1.5 pl-4 pr-3 rounded-md transition-colors duration-150 select-none",
|
|
320
|
+
headerHover: "bg-muted/60",
|
|
321
|
+
headerOpen: "text-foreground",
|
|
322
|
+
headerClosed: "text-foreground/80",
|
|
323
|
+
headerPointer: "cursor-pointer",
|
|
324
|
+
headerDefault: "cursor-default",
|
|
325
|
+
chevron: "h-3.5 w-3.5 shrink-0 transition-transform duration-200",
|
|
326
|
+
chevronOpen: "rotate-90",
|
|
327
|
+
chevronHover: "text-foreground/70",
|
|
328
|
+
chevronDefault: "text-muted-foreground",
|
|
329
|
+
spacer: "w-3.5",
|
|
330
|
+
icon: "h-4 w-4 shrink-0 transition-colors",
|
|
331
|
+
iconOpenHover: "text-accent",
|
|
332
|
+
iconOpenDefault: "text-muted-foreground",
|
|
333
|
+
iconClosedHover: "text-accent/80",
|
|
334
|
+
iconClosedDefault: "text-muted-foreground/80",
|
|
335
|
+
text: "font-medium transition-colors duration-150",
|
|
336
|
+
textHover: "text-accent",
|
|
337
|
+
children: "ml-5 border-l-2 border-muted/50 pl-2"
|
|
338
|
+
};
|
|
339
|
+
var filesDefaultClasses = {
|
|
340
|
+
root: "rounded-xl border border-muted/20 bg-card/20 backdrop-blur-sm shadow-sm overflow-hidden transition-all duration-200 hover:shadow-md hover:border-muted/60",
|
|
341
|
+
content: "p-2"
|
|
342
|
+
};
|
|
343
|
+
function FileComponent({
|
|
344
|
+
name
|
|
345
|
+
}) {
|
|
268
346
|
const [isHovered, setIsHovered] = (0, import_react4.useState)(false);
|
|
269
347
|
const fileExtension = name.split(".").pop()?.toUpperCase();
|
|
270
348
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
271
349
|
"div",
|
|
272
350
|
{
|
|
273
|
-
className:
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
351
|
+
className: cn(
|
|
352
|
+
"dbk-file-tree__file",
|
|
353
|
+
fileDefaultClasses.root,
|
|
354
|
+
isHovered && fileDefaultClasses.rootHover
|
|
355
|
+
),
|
|
356
|
+
"data-docubook": "file-tree-file",
|
|
278
357
|
onMouseEnter: () => setIsHovered(true),
|
|
279
358
|
onMouseLeave: () => setIsHovered(false),
|
|
280
359
|
tabIndex: -1,
|
|
281
360
|
children: [
|
|
282
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
className: `
|
|
286
|
-
h-3.5 w-3.5 shrink-0 transition-colors
|
|
287
|
-
${isHovered ? "text-accent" : "text-muted-foreground"}
|
|
288
|
-
`
|
|
289
|
-
}
|
|
290
|
-
),
|
|
291
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-mono text-sm text-foreground truncate", children: name }),
|
|
292
|
-
isHovered && fileExtension && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "ml-auto text-xs text-muted-foreground/80", children: fileExtension })
|
|
361
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react2.File, { className: cn("dbk-file-tree__file-icon", fileDefaultClasses.icon, isHovered && fileDefaultClasses.iconHover), "data-docubook": "file-tree-file-icon" }),
|
|
362
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn("dbk-file-tree__file-text", fileDefaultClasses.text), "data-docubook": "file-tree-file-text", children: name }),
|
|
363
|
+
isHovered && fileExtension && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn("dbk-file-tree__file-extension", fileDefaultClasses.extension), "data-docubook": "file-tree-file-extension", children: fileExtension })
|
|
293
364
|
]
|
|
294
365
|
}
|
|
295
366
|
);
|
|
296
367
|
}
|
|
297
|
-
function FolderComponent({
|
|
368
|
+
function FolderComponent({
|
|
369
|
+
name,
|
|
370
|
+
children
|
|
371
|
+
}) {
|
|
298
372
|
const [isOpen, setIsOpen] = (0, import_react4.useState)(true);
|
|
299
373
|
const [isHovered, setIsHovered] = (0, import_react4.useState)(false);
|
|
300
374
|
const hasChildren = import_react4.Children.count(children) > 0;
|
|
301
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "
|
|
375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn("dbk-file-tree__folder", folderDefaultClasses.root), "data-docubook": "file-tree-folder", children: [
|
|
302
376
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
303
|
-
"
|
|
377
|
+
"button",
|
|
304
378
|
{
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
379
|
+
type: "button",
|
|
380
|
+
className: cn(
|
|
381
|
+
"dbk-file-tree__folder-button",
|
|
382
|
+
folderDefaultClasses.header,
|
|
383
|
+
isHovered && folderDefaultClasses.headerHover,
|
|
384
|
+
isOpen ? folderDefaultClasses.headerOpen : folderDefaultClasses.headerClosed,
|
|
385
|
+
hasChildren ? folderDefaultClasses.headerPointer : folderDefaultClasses.headerDefault
|
|
386
|
+
),
|
|
312
387
|
onClick: () => hasChildren && setIsOpen(!isOpen),
|
|
313
388
|
onMouseEnter: () => setIsHovered(true),
|
|
314
389
|
onMouseLeave: () => setIsHovered(false),
|
|
315
|
-
|
|
390
|
+
"aria-expanded": hasChildren ? isOpen : void 0,
|
|
391
|
+
"data-docubook": "file-tree-folder-button",
|
|
316
392
|
children: [
|
|
317
393
|
hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
318
394
|
import_lucide_react2.ChevronRight,
|
|
319
395
|
{
|
|
320
|
-
className:
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
396
|
+
className: cn(
|
|
397
|
+
"dbk-file-tree__folder-chevron",
|
|
398
|
+
folderDefaultClasses.chevron,
|
|
399
|
+
isOpen && folderDefaultClasses.chevronOpen,
|
|
400
|
+
isHovered ? folderDefaultClasses.chevronHover : folderDefaultClasses.chevronDefault
|
|
401
|
+
),
|
|
402
|
+
"data-docubook": "file-tree-folder-chevron"
|
|
325
403
|
}
|
|
326
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "
|
|
404
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: cn("dbk-file-tree__folder-spacer", folderDefaultClasses.spacer), "data-docubook": "file-tree-folder-spacer" }),
|
|
327
405
|
isOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
328
406
|
import_lucide_react2.FolderOpen,
|
|
329
407
|
{
|
|
330
|
-
className:
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
408
|
+
className: cn(
|
|
409
|
+
"dbk-file-tree__folder-icon",
|
|
410
|
+
folderDefaultClasses.icon,
|
|
411
|
+
isHovered ? folderDefaultClasses.iconOpenHover : folderDefaultClasses.iconOpenDefault
|
|
412
|
+
),
|
|
413
|
+
"data-docubook": "file-tree-folder-icon"
|
|
334
414
|
}
|
|
335
415
|
) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
336
416
|
import_lucide_react2.Folder,
|
|
337
417
|
{
|
|
338
|
-
className:
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
418
|
+
className: cn(
|
|
419
|
+
"dbk-file-tree__folder-icon",
|
|
420
|
+
folderDefaultClasses.icon,
|
|
421
|
+
isHovered ? folderDefaultClasses.iconClosedHover : folderDefaultClasses.iconClosedDefault
|
|
422
|
+
),
|
|
423
|
+
"data-docubook": "file-tree-folder-icon"
|
|
342
424
|
}
|
|
343
425
|
),
|
|
344
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className:
|
|
426
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: cn("dbk-file-tree__folder-text", folderDefaultClasses.text, isHovered && folderDefaultClasses.textHover), "data-docubook": "file-tree-folder-text", children: name })
|
|
345
427
|
]
|
|
346
428
|
}
|
|
347
429
|
),
|
|
348
|
-
isOpen && hasChildren && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "
|
|
430
|
+
isOpen && hasChildren && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: cn("dbk-file-tree__folder-children", folderDefaultClasses.children), "data-docubook": "file-tree-folder-children", children })
|
|
349
431
|
] });
|
|
350
432
|
}
|
|
351
|
-
function Files({
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
if ((0, import_react4.isValidElement)(child)) {
|
|
358
|
-
return (0, import_react4.cloneElement)(child, { key: index });
|
|
359
|
-
}
|
|
360
|
-
return null;
|
|
361
|
-
}) })
|
|
433
|
+
function Files({
|
|
434
|
+
children
|
|
435
|
+
}) {
|
|
436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: cn("dbk-file-tree", filesDefaultClasses.root), "data-docubook": "file-tree", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: cn("dbk-file-tree__content", filesDefaultClasses.content), "data-docubook": "file-tree-content", children: import_react4.Children.map(children, (child, index) => {
|
|
437
|
+
if ((0, import_react4.isValidElement)(child)) {
|
|
438
|
+
return (0, import_react4.cloneElement)(child, { key: index });
|
|
362
439
|
}
|
|
363
|
-
|
|
440
|
+
return null;
|
|
441
|
+
}) }) });
|
|
364
442
|
}
|
|
365
|
-
function Folder({
|
|
443
|
+
function Folder({
|
|
444
|
+
name,
|
|
445
|
+
children
|
|
446
|
+
}) {
|
|
366
447
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FolderComponent, { name, children });
|
|
367
448
|
}
|
|
368
449
|
function File({ name }) {
|
|
@@ -545,7 +626,8 @@ function Kbd({
|
|
|
545
626
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
546
627
|
"kbd",
|
|
547
628
|
{
|
|
548
|
-
className: "inline-flex items-center justify-center px-2 py-1 mx-0.5 text-xs font-mono font-medium text-foreground bg-secondary/70 border rounded-md",
|
|
629
|
+
className: "dbk-kbd inline-flex items-center justify-center px-2 py-1 mx-0.5 text-xs font-mono font-medium text-foreground bg-secondary/70 border rounded-md",
|
|
630
|
+
"data-docubook": "kbd",
|
|
549
631
|
...props,
|
|
550
632
|
children: renderContent()
|
|
551
633
|
}
|
|
@@ -599,6 +681,12 @@ var iconMap = {
|
|
|
599
681
|
warning: import_lucide_react4.AlertTriangle,
|
|
600
682
|
success: import_lucide_react4.CheckCircle2
|
|
601
683
|
};
|
|
684
|
+
var noteDefaultClasses = {
|
|
685
|
+
icon: "h-5 w-5",
|
|
686
|
+
contentWrapper: "pl-8",
|
|
687
|
+
title: "mb-1 font-medium leading-none tracking-tight",
|
|
688
|
+
content: "text-sm [&_p]:leading-relaxed opacity-90"
|
|
689
|
+
};
|
|
602
690
|
function Note({
|
|
603
691
|
className,
|
|
604
692
|
title = "Note",
|
|
@@ -607,13 +695,24 @@ function Note({
|
|
|
607
695
|
...props
|
|
608
696
|
}) {
|
|
609
697
|
const Icon = iconMap[type] || import_lucide_react4.Info;
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
698
|
+
const noteRole = type === "danger" ? "alert" : "status";
|
|
699
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
700
|
+
"div",
|
|
701
|
+
{
|
|
702
|
+
className: cn("dbk-note", noteVariants({ variant: type }), className),
|
|
703
|
+
"data-docubook": "note",
|
|
704
|
+
"data-variant": type,
|
|
705
|
+
role: noteRole,
|
|
706
|
+
...props,
|
|
707
|
+
children: [
|
|
708
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon, { className: cn("dbk-note__icon", noteDefaultClasses.icon), "data-docubook": "note-icon" }),
|
|
709
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: cn("dbk-note__content-wrapper", noteDefaultClasses.contentWrapper), "data-docubook": "note-content-wrapper", children: [
|
|
710
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("h5", { className: cn("dbk-note__title", noteDefaultClasses.title), "data-docubook": "note-title", children: title }),
|
|
711
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: cn("dbk-note__content", noteDefaultClasses.content), "data-docubook": "note-content", children })
|
|
712
|
+
] })
|
|
713
|
+
]
|
|
714
|
+
}
|
|
715
|
+
);
|
|
617
716
|
}
|
|
618
717
|
|
|
619
718
|
// src/core/components/Copy.tsx
|
|
@@ -623,20 +722,28 @@ var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
|
623
722
|
function Copy({ content }) {
|
|
624
723
|
const [isCopied, setIsCopied] = (0, import_react6.useState)(false);
|
|
625
724
|
async function handleCopy() {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
725
|
+
try {
|
|
726
|
+
await navigator.clipboard.writeText(content);
|
|
727
|
+
setIsCopied(true);
|
|
728
|
+
setTimeout(() => {
|
|
729
|
+
setIsCopied(false);
|
|
730
|
+
}, 2e3);
|
|
731
|
+
} catch {
|
|
629
732
|
setIsCopied(false);
|
|
630
|
-
}
|
|
733
|
+
}
|
|
631
734
|
}
|
|
632
|
-
return /* @__PURE__ */ (0, import_jsx_runtime12.
|
|
735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
|
|
633
736
|
"button",
|
|
634
737
|
{
|
|
635
738
|
type: "button",
|
|
636
|
-
className: "
|
|
739
|
+
className: "dbk-copy inline-flex h-6 w-6 items-center justify-center rounded-md border bg-secondary text-secondary-foreground transition-colors hover:bg-secondary/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 cursor-copy",
|
|
637
740
|
onClick: handleCopy,
|
|
638
741
|
"aria-label": isCopied ? "Copied" : "Copy code",
|
|
639
|
-
|
|
742
|
+
"data-docubook": "copy-button",
|
|
743
|
+
children: [
|
|
744
|
+
isCopied ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ClipboardCheckIcon, { className: "dbk-copy__icon w-3 h-3", "data-docubook": "copy-icon" }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react5.ClipboardIcon, { className: "dbk-copy__icon w-3 h-3", "data-docubook": "copy-icon" }),
|
|
745
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "sr-only", "aria-live": "polite", children: isCopied ? "Copied" : "Copy" })
|
|
746
|
+
]
|
|
640
747
|
}
|
|
641
748
|
);
|
|
642
749
|
}
|
|
@@ -711,30 +818,31 @@ var import_react7 = require("react");
|
|
|
711
818
|
var import_lucide_react6 = require("lucide-react");
|
|
712
819
|
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
713
820
|
function Release({ version, title, date, children }) {
|
|
714
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "mb-16 group", children: [
|
|
715
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-3 mt-6 mb-2", children: [
|
|
821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "dbk-release mb-16 group", "data-docubook": "release", children: [
|
|
822
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "dbk-release__header flex items-center gap-3 mt-6 mb-2", "data-docubook": "release-header", children: [
|
|
716
823
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
717
824
|
"div",
|
|
718
825
|
{
|
|
719
826
|
id: version,
|
|
720
|
-
className: "inline-flex items-center rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-sm font-semibold text-primary transition-colors hover:bg-primary/15 scroll-m-20 backdrop-blur-sm",
|
|
827
|
+
className: "dbk-release__version inline-flex items-center rounded-full border border-primary/20 bg-primary/10 px-3 py-1 text-sm font-semibold text-primary transition-colors hover:bg-primary/15 scroll-m-20 backdrop-blur-sm",
|
|
828
|
+
"data-docubook": "release-version",
|
|
721
829
|
children: [
|
|
722
830
|
"v",
|
|
723
831
|
version
|
|
724
832
|
]
|
|
725
833
|
}
|
|
726
834
|
),
|
|
727
|
-
date && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "flex items-center gap-3 text-sm font-medium text-muted-foreground", children: [
|
|
835
|
+
date && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "dbk-release__date-wrapper flex items-center gap-3 text-sm font-medium text-muted-foreground", "data-docubook": "release-date-wrapper", children: [
|
|
728
836
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "h-1 w-1 rounded-full bg-muted-foreground/30" }),
|
|
729
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("time", { dateTime: date, children: new Date(date).toLocaleDateString("en-US", {
|
|
837
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("time", { className: "dbk-release__date", "data-docubook": "release-date", dateTime: date, children: new Date(date).toLocaleDateString("en-US", {
|
|
730
838
|
year: "numeric",
|
|
731
839
|
month: "long",
|
|
732
840
|
day: "numeric"
|
|
733
841
|
}) })
|
|
734
842
|
] })
|
|
735
843
|
] }),
|
|
736
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "text-2xl font-bold text-foreground/90 mb-6 mt-0!", children: title }),
|
|
737
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "space-y-8", children })
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("h3", { className: "dbk-release__title text-2xl font-bold text-foreground/90 mb-6 mt-0!", "data-docubook": "release-title", children: title }),
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "dbk-release__content space-y-8", "data-docubook": "release-content", children })
|
|
738
846
|
] });
|
|
739
847
|
}
|
|
740
848
|
var typeConfig = {
|
|
@@ -766,23 +874,25 @@ var typeConfig = {
|
|
|
766
874
|
};
|
|
767
875
|
function Changes({ type, children }) {
|
|
768
876
|
const config = typeConfig[type] || typeConfig.added;
|
|
769
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "space-y-3 mb-8", children: [
|
|
770
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
877
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "dbk-release-changes space-y-3 mb-8", "data-docubook": "release-changes", "data-type": type, children: [
|
|
878
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "dbk-release-changes__header flex items-center gap-2", "data-docubook": "release-changes-header", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
771
879
|
"div",
|
|
772
880
|
{
|
|
773
881
|
className: cn(
|
|
882
|
+
"dbk-release-changes__badge",
|
|
774
883
|
"px-3 py-1 rounded-full text-sm font-medium flex items-center gap-1.5",
|
|
775
884
|
config.className
|
|
776
885
|
),
|
|
886
|
+
"data-docubook": "release-changes-badge",
|
|
777
887
|
children: [
|
|
778
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(config.icon, { className: "h-3.5 w-3.5" }),
|
|
779
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: config.label })
|
|
888
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(config.icon, { className: "dbk-release-changes__icon h-3.5 w-3.5", "data-docubook": "release-changes-icon" }),
|
|
889
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "dbk-release-changes__label", "data-docubook": "release-changes-label", children: config.label })
|
|
780
890
|
]
|
|
781
891
|
}
|
|
782
892
|
) }),
|
|
783
|
-
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "list-none pl-0 space-y-2 text-foreground/80", children: import_react7.Children.map(children, (child, index) => {
|
|
893
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "dbk-release-changes__list list-none pl-0 space-y-2 text-foreground/80", "data-docubook": "release-changes-list", children: import_react7.Children.map(children, (child, index) => {
|
|
784
894
|
const processedChild = typeof child === "string" ? child.trim().replace(/^[-*]\s+/, "") : child;
|
|
785
|
-
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: "leading-relaxed", children: processedChild }, index);
|
|
895
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("li", { className: "dbk-release-changes__item leading-relaxed", "data-docubook": "release-changes-item", children: processedChild }, index);
|
|
786
896
|
}) })
|
|
787
897
|
] });
|
|
788
898
|
}
|
|
@@ -791,20 +901,35 @@ function Changes({ type, children }) {
|
|
|
791
901
|
var import_clsx5 = __toESM(require("clsx"), 1);
|
|
792
902
|
var import_react8 = require("react");
|
|
793
903
|
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
794
|
-
|
|
904
|
+
var stepperDefaultClasses = {
|
|
905
|
+
root: "flex flex-col",
|
|
906
|
+
item: "border-l border-muted pl-9 ml-3 relative",
|
|
907
|
+
itemWithConnector: "pb-5 ",
|
|
908
|
+
number: "bg-muted text-muted-foreground w-8 h-8 text-xs font-medium rounded-md border border-border/50 flex items-center justify-center absolute -left-4 font-code"
|
|
909
|
+
};
|
|
910
|
+
var stepperItemDefaultClasses = {
|
|
911
|
+
root: "pt-0.5",
|
|
912
|
+
title: "mt-0",
|
|
913
|
+
content: ""
|
|
914
|
+
};
|
|
915
|
+
function Stepper({
|
|
916
|
+
children
|
|
917
|
+
}) {
|
|
795
918
|
const length = import_react8.Children.count(children);
|
|
796
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("
|
|
919
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("ol", { className: cn("dbk-stepper", stepperDefaultClasses.root), "data-docubook": "stepper", children: import_react8.Children.map(children, (child, index) => {
|
|
797
920
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
|
798
|
-
"
|
|
921
|
+
"li",
|
|
799
922
|
{
|
|
800
923
|
className: cn(
|
|
801
|
-
"
|
|
924
|
+
"dbk-stepper__item",
|
|
925
|
+
stepperDefaultClasses.item,
|
|
802
926
|
(0, import_clsx5.default)({
|
|
803
|
-
|
|
927
|
+
[stepperDefaultClasses.itemWithConnector]: index < length - 1
|
|
804
928
|
})
|
|
805
929
|
),
|
|
930
|
+
"data-docubook": "stepper-item",
|
|
806
931
|
children: [
|
|
807
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "
|
|
932
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn("dbk-stepper__number", stepperDefaultClasses.number), "data-docubook": "stepper-number", "aria-hidden": "true", children: index + 1 }),
|
|
808
933
|
child
|
|
809
934
|
]
|
|
810
935
|
}
|
|
@@ -815,28 +940,49 @@ function StepperItem({
|
|
|
815
940
|
children,
|
|
816
941
|
title
|
|
817
942
|
}) {
|
|
818
|
-
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "
|
|
819
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { className: "
|
|
820
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children })
|
|
943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("dbk-stepper-item", stepperItemDefaultClasses.root), "data-docubook": "stepper-item-content", children: [
|
|
944
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h4", { className: cn("dbk-stepper-item__title", stepperItemDefaultClasses.title), "data-docubook": "stepper-item-title", children: title }),
|
|
945
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: cn("dbk-stepper-item__content", stepperItemDefaultClasses.content), "data-docubook": "stepper-item-body", children })
|
|
821
946
|
] });
|
|
822
947
|
}
|
|
823
948
|
|
|
824
949
|
// src/core/components/Tooltip.tsx
|
|
825
950
|
var import_react9 = require("react");
|
|
826
951
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
952
|
+
var tooltipDefaultClasses = {
|
|
953
|
+
root: "relative inline-flex items-center cursor-help text-primary hover:text-primary/80 transition-colors",
|
|
954
|
+
trigger: "border-b border-dashed border-primary/60 pb-0.5",
|
|
955
|
+
content: "absolute bottom-full left-1/2 -translate-x-1/2 mb-3 w-64 bg-popover text-popover-foreground text-sm p-3 rounded-md shadow-lg border border-border/50 wrap-break-word text-left z-50",
|
|
956
|
+
arrow: "absolute -bottom-1.5 left-1/2 -translate-x-1/2 w-3 h-3 bg-popover rotate-45 border-b border-r border-border/50 -z-10"
|
|
957
|
+
};
|
|
827
958
|
var Tooltip = ({ text, tip }) => {
|
|
828
959
|
const [visible, setVisible] = (0, import_react9.useState)(false);
|
|
829
960
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
830
961
|
"span",
|
|
831
962
|
{
|
|
832
|
-
className: "
|
|
963
|
+
className: cn("dbk-tooltip", tooltipDefaultClasses.root),
|
|
964
|
+
"data-docubook": "tooltip",
|
|
833
965
|
onMouseEnter: () => setVisible(true),
|
|
834
966
|
onMouseLeave: () => setVisible(false),
|
|
835
967
|
children: [
|
|
836
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
837
|
-
|
|
968
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
969
|
+
"button",
|
|
970
|
+
{
|
|
971
|
+
type: "button",
|
|
972
|
+
className: cn("dbk-tooltip__trigger", tooltipDefaultClasses.trigger),
|
|
973
|
+
"data-docubook": "tooltip-trigger",
|
|
974
|
+
onFocus: () => setVisible(true),
|
|
975
|
+
onBlur: () => setVisible(false),
|
|
976
|
+
onKeyDown: (event) => {
|
|
977
|
+
if (event.key === "Escape") setVisible(false);
|
|
978
|
+
},
|
|
979
|
+
"aria-expanded": visible,
|
|
980
|
+
children: text
|
|
981
|
+
}
|
|
982
|
+
),
|
|
983
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: cn("dbk-tooltip__content", tooltipDefaultClasses.content), role: "tooltip", "data-docubook": "tooltip-content", children: [
|
|
838
984
|
tip,
|
|
839
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "
|
|
985
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: cn("dbk-tooltip__arrow", tooltipDefaultClasses.arrow), "data-docubook": "tooltip-arrow" })
|
|
840
986
|
] })
|
|
841
987
|
]
|
|
842
988
|
}
|
package/dist/core/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { FC, ReactNode, ComponentProps } from 'react';
|
|
3
|
-
import { C as CardGroup, K as Kbd, N as Note, S as Stepper, a as StepperItem, Y as YoutubeProps, R as Release, b as Changes, L as Link } from '../Stepper-
|
|
4
|
-
export { c as Youtube } from '../Stepper-
|
|
3
|
+
import { C as CardGroup, K as Kbd, N as Note, S as Stepper, a as StepperItem, Y as YoutubeProps, R as Release, b as Changes, L as Link } from '../Stepper-I9nywkZb.cjs';
|
|
4
|
+
export { c as Youtube } from '../Stepper-I9nywkZb.cjs';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
import * as Icons from 'lucide-react';
|
|
7
7
|
import { B as Button, C as Card } from '../Card-L5O7G4xG.cjs';
|
|
@@ -33,10 +33,10 @@ interface FileProps {
|
|
|
33
33
|
name: string;
|
|
34
34
|
children?: ReactNode;
|
|
35
35
|
}
|
|
36
|
-
declare function Files({ children }: {
|
|
36
|
+
declare function Files({ children, }: {
|
|
37
37
|
children: ReactNode;
|
|
38
38
|
}): react_jsx_runtime.JSX.Element;
|
|
39
|
-
declare function Folder({ name, children }: FileProps): react_jsx_runtime.JSX.Element;
|
|
39
|
+
declare function Folder({ name, children, }: FileProps): react_jsx_runtime.JSX.Element;
|
|
40
40
|
declare function File({ name }: FileProps): react_jsx_runtime.JSX.Element;
|
|
41
41
|
|
|
42
42
|
type PreProps = ComponentProps<"pre"> & {
|