@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.cjs CHANGED
@@ -132,6 +132,53 @@ var GLYPHS = {
132
132
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "9" }),
133
133
  /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 7v5l3 2" })
134
134
  ] }),
135
+ /** A clock with a counter-clockwise arrow — a changelog, a history. */
136
+ history: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
137
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }),
138
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 3v5h5" }),
139
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M12 7v5l4 2" })
140
+ ] }),
141
+ bell: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
142
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9" }),
143
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M10.3 21a1.94 1.94 0 0 0 3.4 0" })
144
+ ] }),
145
+ /** A paper plane — send, deliver. */
146
+ send: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
147
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m22 2-7 20-4-9-9-4Z" }),
148
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M22 2 11 13" })
149
+ ] }),
150
+ idCard: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
151
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "5", width: "20", height: "14", rx: "2" }),
152
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "9", cy: "11", r: "2" }),
153
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6.17 15a3 3 0 0 1 5.66 0" }),
154
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16 10h2M16 14h2" })
155
+ ] }),
156
+ coins: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
157
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "8", cy: "8", r: "6" }),
158
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M18.09 10.37A6 6 0 1 1 10.34 18" }),
159
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M7 6h1v4" }),
160
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m16.71 13.88.7.71-2.82 2.82" })
161
+ ] }),
162
+ handshake: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
163
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m11 17 2 2a1 1 0 1 0 3-3" }),
164
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4" }),
165
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m21 3 1 11h-2" }),
166
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3" }),
167
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M3 4h8" })
168
+ ] }),
169
+ shieldCheck: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
170
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1 1 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z" }),
171
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m9 12 2 2 4-4" })
172
+ ] }),
173
+ banknote: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
174
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "2", y: "6", width: "20", height: "12", rx: "2" }),
175
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "2" }),
176
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M6 12h.01M18 12h.01" })
177
+ ] }),
178
+ circlePlay: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
179
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
180
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m10 8 6 4-6 4z" })
181
+ ] }),
135
182
  /** A circled `i` — an informational note, and the generic error state. */
136
183
  info: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
137
184
  /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "10" }),
@@ -397,38 +444,6 @@ function Info({ children }) {
397
444
  function Tip({ children }) {
398
445
  return /* @__PURE__ */ jsxRuntime.jsx(Callout, { tone: "tip", children });
399
446
  }
400
- function Card({
401
- title,
402
- href,
403
- children
404
- }) {
405
- const style = {
406
- display: "block",
407
- border: "1px solid var(--color-fd-border)",
408
- borderRadius: 12,
409
- padding: "16px 18px",
410
- textDecoration: "none",
411
- color: "inherit",
412
- background: "var(--color-fd-card)"
413
- };
414
- const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
415
- title !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 700, fontSize: 15, marginBottom: 4 }, children: title }),
416
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "var(--color-fd-muted-foreground)", fontSize: 14 }, children })
417
- ] });
418
- if (href !== void 0) {
419
- return /* @__PURE__ */ jsxRuntime.jsx("a", { href, style, children: body });
420
- }
421
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style, children: body });
422
- }
423
- function CardGroup({ cols = 2, children }) {
424
- const style = {
425
- display: "grid",
426
- gridTemplateColumns: `repeat(${String(cols)}, minmax(0, 1fr))`,
427
- gap: 12,
428
- margin: "16px 0"
429
- };
430
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style, children });
431
- }
432
447
 
433
448
  // src/ui/docs-icons.tsx
434
449
  var ICONS = {
@@ -444,7 +459,17 @@ var ICONS = {
444
459
  user: "user",
445
460
  users: "users",
446
461
  building: "building",
447
- clock: "clock"
462
+ clock: "clock",
463
+ history: "history",
464
+ bell: "bell",
465
+ send: "send",
466
+ "id-card": "idCard",
467
+ coins: "coins",
468
+ handshake: "handshake",
469
+ "shield-check": "shieldCheck",
470
+ banknote: "banknote",
471
+ "circle-play": "circlePlay",
472
+ mail: "mail"
448
473
  };
449
474
  var ALIASES = {
450
475
  home: "house",
@@ -462,16 +487,127 @@ var ALIASES = {
462
487
  "building-2": "building",
463
488
  office: "building",
464
489
  company: "building",
465
- history: "clock",
466
- time: "clock"
490
+ time: "clock",
491
+ "clock-rotate-left": "history",
492
+ "paper-plane": "send",
493
+ "address-card": "id-card",
494
+ shield: "shield-check",
495
+ "money-check-dollar-pen": "banknote",
496
+ "money-bill": "banknote",
497
+ "money-bill-transfer": "banknote",
498
+ play: "circle-play",
499
+ envelope: "mail"
467
500
  };
468
501
  function docsIcon(name) {
469
- if (!name) {
502
+ const glyph = name === void 0 ? void 0 : glyphFor(name);
503
+ return glyph === void 0 ? void 0 : strokeIcon(glyph, { size: 16, rounded: true, key: `docs-icon-${glyph}` });
504
+ }
505
+ function glyphFor(name) {
506
+ const key = name.toLowerCase();
507
+ return ICONS[key] ?? ICONS[ALIASES[key] ?? ""];
508
+ }
509
+ function Card({
510
+ title,
511
+ icon: icon2,
512
+ href,
513
+ children
514
+ }) {
515
+ const glyph = icon2 === void 0 ? void 0 : glyphFor(icon2);
516
+ const style = {
517
+ display: "block",
518
+ border: "1px solid var(--color-fd-border)",
519
+ borderRadius: 12,
520
+ padding: "22px 24px",
521
+ textDecoration: "none",
522
+ color: "inherit",
523
+ background: "var(--color-fd-card)"
524
+ };
525
+ const body = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
526
+ glyph !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "var(--color-fd-primary)", marginBottom: 10 }, children: strokeIcon(glyph, { size: 20, rounded: true }) }),
527
+ title !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 700, fontSize: 15, marginBottom: 4 }, children: title }),
528
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { color: "var(--color-fd-muted-foreground)", fontSize: 14 }, children })
529
+ ] });
530
+ if (href !== void 0) {
531
+ return /* @__PURE__ */ jsxRuntime.jsx("a", { href, style, children: body });
532
+ }
533
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style, children: body });
534
+ }
535
+ function CardGroup({ cols = 2, children }) {
536
+ const style = {
537
+ display: "grid",
538
+ gridTemplateColumns: `repeat(${String(cols)}, minmax(0, 1fr))`,
539
+ gap: 16,
540
+ margin: "16px 0"
541
+ };
542
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style, children });
543
+ }
544
+ function findLabel(node, depth = 0) {
545
+ if (depth > 4) {
470
546
  return void 0;
471
547
  }
472
- const key = name.toLowerCase();
473
- const glyph = ICONS[key] ?? ICONS[ALIASES[key] ?? ""];
474
- return glyph === void 0 ? void 0 : strokeIcon(glyph, { size: 16, rounded: true, key: `docs-icon-${glyph}` });
548
+ for (const child of react.Children.toArray(node)) {
549
+ if (!react.isValidElement(child)) {
550
+ continue;
551
+ }
552
+ const { title, lang, children } = child.props;
553
+ if (typeof title === "string" && title !== "") {
554
+ return title;
555
+ }
556
+ if (typeof lang === "string" && lang !== "") {
557
+ return lang;
558
+ }
559
+ const nested = findLabel(children, depth + 1);
560
+ if (nested !== void 0) {
561
+ return nested;
562
+ }
563
+ }
564
+ return void 0;
565
+ }
566
+ function parseLabels(labels) {
567
+ if (labels === void 0) {
568
+ return [];
569
+ }
570
+ if (typeof labels !== "string") {
571
+ return labels;
572
+ }
573
+ try {
574
+ const parsed = JSON.parse(labels);
575
+ return Array.isArray(parsed) ? parsed.map(String) : [];
576
+ } catch {
577
+ return [];
578
+ }
579
+ }
580
+ function CodeGroup({
581
+ children,
582
+ labels
583
+ }) {
584
+ const group = react.useId();
585
+ const blocks = react.Children.toArray(children).filter(
586
+ (child) => react.isValidElement(child)
587
+ );
588
+ const named = parseLabels(labels);
589
+ const labelOf = (block, index) => named[index] ?? findLabel(block) ?? `Code ${String(index + 1)}`;
590
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "tabs tabs--code", children: [
591
+ blocks.map((_block, index) => /* @__PURE__ */ jsxRuntime.jsx(
592
+ "input",
593
+ {
594
+ className: "tabs__radio",
595
+ type: "radio",
596
+ name: group,
597
+ id: `${group}-${String(index)}`,
598
+ defaultChecked: index === 0
599
+ },
600
+ index
601
+ )),
602
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "tabs__bar", children: blocks.map((block, index) => /* @__PURE__ */ jsxRuntime.jsx("label", { className: "tabs__trigger", htmlFor: `${group}-${String(index)}`, children: labelOf(block, index) }, index)) }),
603
+ blocks.map((block, index) => /* @__PURE__ */ jsxRuntime.jsx("section", { className: "tabs__panel", children: block }, index))
604
+ ] });
605
+ }
606
+ function Frame({ caption, children }) {
607
+ return /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: "frame", children: [
608
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "frame__body", children }),
609
+ caption === void 0 ? null : /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "frame__caption", children: caption })
610
+ ] });
475
611
  }
476
612
 
477
613
  // src/ui/nav-links.ts
@@ -684,7 +820,9 @@ var mdxComponents = {
684
820
  Steps,
685
821
  Step,
686
822
  Tabs,
687
- Tab
823
+ Tab,
824
+ Frame,
825
+ CodeGroup
688
826
  };
689
827
  var defaultResolveHref = (page) => {
690
828
  if (page.kind === "openapi") {
@@ -781,8 +919,10 @@ exports.AuthScreen = AuthScreen;
781
919
  exports.Callout = Callout;
782
920
  exports.Card = Card;
783
921
  exports.CardGroup = CardGroup;
922
+ exports.CodeGroup = CodeGroup;
784
923
  exports.DocsSidebar = DocsSidebar;
785
924
  exports.ErrorScreen = ErrorScreen;
925
+ exports.Frame = Frame;
786
926
  exports.Info = Info;
787
927
  exports.MethodBadge = MethodBadge;
788
928
  exports.NavActions = NavActions;