@blaaiz/docs-core 0.7.6 → 0.9.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/dist/ui.d.ts CHANGED
@@ -246,12 +246,16 @@ declare function Tip({ children }: {
246
246
  * @packageDocumentation
247
247
  */
248
248
  /**
249
- * A card. When `href` is set it renders as a link.
249
+ * A card. When `href` is set it renders as a link. `icon` takes the same
250
+ * names as `docs.json` navigation icons (the Mintlify vocabulary — `user`,
251
+ * `bell`, `paper-plane`, …); an unknown name shows no icon rather than a
252
+ * broken one.
250
253
  *
251
254
  * @public
252
255
  */
253
- declare function Card({ title, href, children, }: {
256
+ declare function Card({ title, icon, href, children, }: {
254
257
  title?: string;
258
+ icon?: string;
255
259
  href?: string;
256
260
  children?: ReactNode;
257
261
  }): react.JSX.Element;
@@ -265,6 +269,42 @@ declare function CardGroup({ cols, children }: {
265
269
  children?: ReactNode;
266
270
  }): react.JSX.Element;
267
271
 
272
+ /**
273
+ * The code-tab container: one hidden radio per block, the bar of fence titles,
274
+ * and the blocks as panels. CSS shows the checked radio's label and panel.
275
+ *
276
+ * @public
277
+ */
278
+ declare function CodeGroup({ children, labels, }: {
279
+ readonly children?: ReactNode;
280
+ readonly labels?: string | readonly string[];
281
+ }): react.JSX.Element;
282
+
283
+ /**
284
+ * Frame — the Mintlify `<Frame>`: a bordered, centred surface around an image
285
+ * or any media, with an optional caption. A plain `<figure>`, so it renders in
286
+ * a Server Component with zero client JavaScript. Styled by `styles/docs.css`
287
+ * on the theme tokens.
288
+ *
289
+ * @packageDocumentation
290
+ */
291
+ /**
292
+ * Props for {@link Frame}.
293
+ *
294
+ * @public
295
+ */
296
+ interface FrameProps {
297
+ /** A caption rendered under the media. */
298
+ readonly caption?: ReactNode;
299
+ readonly children?: ReactNode;
300
+ }
301
+ /**
302
+ * A framed media block.
303
+ *
304
+ * @public
305
+ */
306
+ declare function Frame({ caption, children }: FrameProps): react.JSX.Element;
307
+
268
308
  /**
269
309
  * Resolve a `docs.json` icon name to an inline SVG. Unknown names resolve to
270
310
  * nothing, so the sidebar simply shows no icon rather than a broken one.
@@ -593,6 +633,8 @@ declare const mdxComponents: {
593
633
  Step: typeof Step;
594
634
  Tabs: typeof Tabs;
595
635
  Tab: typeof Tab;
636
+ Frame: typeof Frame;
637
+ CodeGroup: typeof CodeGroup;
596
638
  };
597
639
 
598
640
  /**
@@ -629,4 +671,4 @@ declare function DocsSidebar({ nav, resolveHref, }: {
629
671
  resolveHref?: ResolveHref;
630
672
  }): react.JSX.Element;
631
673
 
632
- export { Accordion, AccordionGroup, type ApiOperationSlots, AuthScreen, type AuthScreenProps, Callout, Card, CardGroup, type DocsLayoutTab, type DocsNavLink, type DocsNavLinksOptions, DocsSidebar, type ErrorKind, type ErrorPreset, ErrorScreen, type ErrorScreenProps, Info, MethodBadge, NavActions, type NavActionsProps, type NavJsonLink, Note, type ResolveHref, type SidebarBadgeTransformer, type SidebarItem, Step, Steps, Tab, type TabProps, Tabs, Tip, Warning, apiMethodBadges, apiOperationLayout, authErrorMessage, docsIcon, docsLayoutTabs, docsNavLinks, errorPreset, isDocsNavLinkActive, mdxComponents };
674
+ export { Accordion, AccordionGroup, type ApiOperationSlots, AuthScreen, type AuthScreenProps, Callout, Card, CardGroup, CodeGroup, type DocsLayoutTab, type DocsNavLink, type DocsNavLinksOptions, DocsSidebar, type ErrorKind, type ErrorPreset, ErrorScreen, type ErrorScreenProps, Frame, type FrameProps, Info, MethodBadge, NavActions, type NavActionsProps, type NavJsonLink, Note, type ResolveHref, type SidebarBadgeTransformer, type SidebarItem, Step, Steps, Tab, type TabProps, Tabs, Tip, Warning, apiMethodBadges, apiOperationLayout, authErrorMessage, docsIcon, docsLayoutTabs, docsNavLinks, errorPreset, isDocsNavLinkActive, mdxComponents };
package/dist/ui.js CHANGED
@@ -1,4 +1,4 @@
1
- import { strokeIcon } from './chunk-6H6OB7YP.js';
1
+ import { strokeIcon } from './chunk-FSB3DLMU.js';
2
2
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
3
3
  import { isValidElement, cloneElement, useId, Children } from 'react';
4
4
 
@@ -278,38 +278,6 @@ function Info({ children }) {
278
278
  function Tip({ children }) {
279
279
  return /* @__PURE__ */ jsx(Callout, { tone: "tip", children });
280
280
  }
281
- function Card({
282
- title,
283
- href,
284
- children
285
- }) {
286
- const style = {
287
- display: "block",
288
- border: "1px solid var(--color-fd-border)",
289
- borderRadius: 12,
290
- padding: "16px 18px",
291
- textDecoration: "none",
292
- color: "inherit",
293
- background: "var(--color-fd-card)"
294
- };
295
- const body = /* @__PURE__ */ jsxs(Fragment, { children: [
296
- title !== void 0 && /* @__PURE__ */ jsx("div", { style: { fontWeight: 700, fontSize: 15, marginBottom: 4 }, children: title }),
297
- /* @__PURE__ */ jsx("div", { style: { color: "var(--color-fd-muted-foreground)", fontSize: 14 }, children })
298
- ] });
299
- if (href !== void 0) {
300
- return /* @__PURE__ */ jsx("a", { href, style, children: body });
301
- }
302
- return /* @__PURE__ */ jsx("div", { style, children: body });
303
- }
304
- function CardGroup({ cols = 2, children }) {
305
- const style = {
306
- display: "grid",
307
- gridTemplateColumns: `repeat(${String(cols)}, minmax(0, 1fr))`,
308
- gap: 12,
309
- margin: "16px 0"
310
- };
311
- return /* @__PURE__ */ jsx("div", { style, children });
312
- }
313
281
 
314
282
  // src/ui/docs-icons.tsx
315
283
  var ICONS = {
@@ -325,7 +293,17 @@ var ICONS = {
325
293
  user: "user",
326
294
  users: "users",
327
295
  building: "building",
328
- clock: "clock"
296
+ clock: "clock",
297
+ history: "history",
298
+ bell: "bell",
299
+ send: "send",
300
+ "id-card": "idCard",
301
+ coins: "coins",
302
+ handshake: "handshake",
303
+ "shield-check": "shieldCheck",
304
+ banknote: "banknote",
305
+ "circle-play": "circlePlay",
306
+ mail: "mail"
329
307
  };
330
308
  var ALIASES = {
331
309
  home: "house",
@@ -343,16 +321,127 @@ var ALIASES = {
343
321
  "building-2": "building",
344
322
  office: "building",
345
323
  company: "building",
346
- history: "clock",
347
- time: "clock"
324
+ time: "clock",
325
+ "clock-rotate-left": "history",
326
+ "paper-plane": "send",
327
+ "address-card": "id-card",
328
+ shield: "shield-check",
329
+ "money-check-dollar-pen": "banknote",
330
+ "money-bill": "banknote",
331
+ "money-bill-transfer": "banknote",
332
+ play: "circle-play",
333
+ envelope: "mail"
348
334
  };
349
335
  function docsIcon(name) {
350
- if (!name) {
336
+ const glyph = name === void 0 ? void 0 : glyphFor(name);
337
+ return glyph === void 0 ? void 0 : strokeIcon(glyph, { size: 16, rounded: true, key: `docs-icon-${glyph}` });
338
+ }
339
+ function glyphFor(name) {
340
+ const key = name.toLowerCase();
341
+ return ICONS[key] ?? ICONS[ALIASES[key] ?? ""];
342
+ }
343
+ function Card({
344
+ title,
345
+ icon: icon2,
346
+ href,
347
+ children
348
+ }) {
349
+ const glyph = icon2 === void 0 ? void 0 : glyphFor(icon2);
350
+ const style = {
351
+ display: "block",
352
+ border: "1px solid var(--color-fd-border)",
353
+ borderRadius: 12,
354
+ padding: "22px 24px",
355
+ textDecoration: "none",
356
+ color: "inherit",
357
+ background: "var(--color-fd-card)"
358
+ };
359
+ const body = /* @__PURE__ */ jsxs(Fragment, { children: [
360
+ glyph !== void 0 && /* @__PURE__ */ jsx("div", { style: { color: "var(--color-fd-primary)", marginBottom: 10 }, children: strokeIcon(glyph, { size: 20, rounded: true }) }),
361
+ title !== void 0 && /* @__PURE__ */ jsx("div", { style: { fontWeight: 700, fontSize: 15, marginBottom: 4 }, children: title }),
362
+ /* @__PURE__ */ jsx("div", { style: { color: "var(--color-fd-muted-foreground)", fontSize: 14 }, children })
363
+ ] });
364
+ if (href !== void 0) {
365
+ return /* @__PURE__ */ jsx("a", { href, style, children: body });
366
+ }
367
+ return /* @__PURE__ */ jsx("div", { style, children: body });
368
+ }
369
+ function CardGroup({ cols = 2, children }) {
370
+ const style = {
371
+ display: "grid",
372
+ gridTemplateColumns: `repeat(${String(cols)}, minmax(0, 1fr))`,
373
+ gap: 16,
374
+ margin: "16px 0"
375
+ };
376
+ return /* @__PURE__ */ jsx("div", { style, children });
377
+ }
378
+ function findLabel(node, depth = 0) {
379
+ if (depth > 4) {
351
380
  return void 0;
352
381
  }
353
- const key = name.toLowerCase();
354
- const glyph = ICONS[key] ?? ICONS[ALIASES[key] ?? ""];
355
- return glyph === void 0 ? void 0 : strokeIcon(glyph, { size: 16, rounded: true, key: `docs-icon-${glyph}` });
382
+ for (const child of Children.toArray(node)) {
383
+ if (!isValidElement(child)) {
384
+ continue;
385
+ }
386
+ const { title, lang, children } = child.props;
387
+ if (typeof title === "string" && title !== "") {
388
+ return title;
389
+ }
390
+ if (typeof lang === "string" && lang !== "") {
391
+ return lang;
392
+ }
393
+ const nested = findLabel(children, depth + 1);
394
+ if (nested !== void 0) {
395
+ return nested;
396
+ }
397
+ }
398
+ return void 0;
399
+ }
400
+ function parseLabels(labels) {
401
+ if (labels === void 0) {
402
+ return [];
403
+ }
404
+ if (typeof labels !== "string") {
405
+ return labels;
406
+ }
407
+ try {
408
+ const parsed = JSON.parse(labels);
409
+ return Array.isArray(parsed) ? parsed.map(String) : [];
410
+ } catch {
411
+ return [];
412
+ }
413
+ }
414
+ function CodeGroup({
415
+ children,
416
+ labels
417
+ }) {
418
+ const group = useId();
419
+ const blocks = Children.toArray(children).filter(
420
+ (child) => isValidElement(child)
421
+ );
422
+ const named = parseLabels(labels);
423
+ const labelOf = (block, index) => named[index] ?? findLabel(block) ?? `Code ${String(index + 1)}`;
424
+ return /* @__PURE__ */ jsxs("div", { className: "tabs tabs--code", children: [
425
+ blocks.map((_block, index) => /* @__PURE__ */ jsx(
426
+ "input",
427
+ {
428
+ className: "tabs__radio",
429
+ type: "radio",
430
+ name: group,
431
+ id: `${group}-${String(index)}`,
432
+ defaultChecked: index === 0
433
+ },
434
+ index
435
+ )),
436
+ /* @__PURE__ */ jsx("div", { className: "tabs__bar", children: blocks.map((block, index) => /* @__PURE__ */ jsx("label", { className: "tabs__trigger", htmlFor: `${group}-${String(index)}`, children: labelOf(block, index) }, index)) }),
437
+ blocks.map((block, index) => /* @__PURE__ */ jsx("section", { className: "tabs__panel", children: block }, index))
438
+ ] });
439
+ }
440
+ function Frame({ caption, children }) {
441
+ return /* @__PURE__ */ jsxs("figure", { className: "frame", children: [
442
+ /* @__PURE__ */ jsx("div", { className: "frame__body", children }),
443
+ caption === void 0 ? null : /* @__PURE__ */ jsx("figcaption", { className: "frame__caption", children: caption })
444
+ ] });
356
445
  }
357
446
 
358
447
  // src/ui/nav-links.ts
@@ -565,7 +654,9 @@ var mdxComponents = {
565
654
  Steps,
566
655
  Step,
567
656
  Tabs,
568
- Tab
657
+ Tab,
658
+ Frame,
659
+ CodeGroup
569
660
  };
570
661
  var defaultResolveHref = (page) => {
571
662
  if (page.kind === "openapi") {
@@ -656,6 +747,6 @@ function DocsSidebar({
656
747
  ] }, `t-${String(index)}`)) });
657
748
  }
658
749
 
659
- export { Accordion, AccordionGroup, AuthScreen, Callout, Card, CardGroup, DocsSidebar, ErrorScreen, Info, MethodBadge, NavActions, Note, Step, Steps, Tab, Tabs, Tip, Warning, apiMethodBadges, apiOperationLayout, authErrorMessage, docsIcon, docsLayoutTabs, docsNavLinks, errorPreset, isDocsNavLinkActive, mdxComponents };
750
+ export { Accordion, AccordionGroup, AuthScreen, Callout, Card, CardGroup, CodeGroup, DocsSidebar, ErrorScreen, Frame, Info, MethodBadge, NavActions, Note, Step, Steps, Tab, Tabs, Tip, Warning, apiMethodBadges, apiOperationLayout, authErrorMessage, docsIcon, docsLayoutTabs, docsNavLinks, errorPreset, isDocsNavLinkActive, mdxComponents };
660
751
  //# sourceMappingURL=ui.js.map
661
752
  //# sourceMappingURL=ui.js.map