@orangecheck/app-design 1.2.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/chrome.d.mts +8 -3
  2. package/dist/chrome.d.ts +8 -3
  3. package/dist/chrome.js +605 -553
  4. package/dist/chrome.js.map +1 -1
  5. package/dist/chrome.mjs +605 -555
  6. package/dist/chrome.mjs.map +1 -1
  7. package/dist/code.js +3 -1
  8. package/dist/code.js.map +1 -1
  9. package/dist/code.mjs +3 -1
  10. package/dist/code.mjs.map +1 -1
  11. package/dist/components.d.mts +3 -3
  12. package/dist/components.d.ts +3 -3
  13. package/dist/components.js +730 -666
  14. package/dist/components.js.map +1 -1
  15. package/dist/components.mjs +731 -667
  16. package/dist/components.mjs.map +1 -1
  17. package/dist/{docs-Dxg4Tp_q.d.ts → docs-BB9gK4KF.d.ts} +18 -4
  18. package/dist/{docs-wJBfLS08.d.mts → docs-D-T-nHiu.d.mts} +18 -4
  19. package/dist/index.d.mts +4 -4
  20. package/dist/index.d.ts +4 -4
  21. package/dist/index.js +1549 -1406
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +1548 -1407
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/mdx.d.mts +6 -2
  26. package/dist/mdx.d.ts +6 -2
  27. package/dist/mdx.js +168 -74
  28. package/dist/mdx.js.map +1 -1
  29. package/dist/mdx.mjs +169 -75
  30. package/dist/mdx.mjs.map +1 -1
  31. package/dist/primitives.d.mts +9 -3
  32. package/dist/primitives.d.ts +9 -3
  33. package/dist/primitives.js +7 -6
  34. package/dist/primitives.js.map +1 -1
  35. package/dist/primitives.mjs +7 -6
  36. package/dist/primitives.mjs.map +1 -1
  37. package/dist/session.d.mts +4 -3
  38. package/dist/session.d.ts +4 -3
  39. package/dist/session.js +27 -3
  40. package/dist/session.js.map +1 -1
  41. package/dist/session.mjs +27 -3
  42. package/dist/session.mjs.map +1 -1
  43. package/dist/styles/swagger.css +252 -0
  44. package/dist/styles/tokens.css +2 -0
  45. package/dist/{tool-shell-kqGWMTep.d.mts → tool-shell-D8Q8XX11.d.mts} +8 -5
  46. package/dist/{tool-shell-DLSwUxTD.d.ts → tool-shell-gmlj47Ie.d.ts} +8 -5
  47. package/package.json +1 -1
package/dist/mdx.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as TabsPrimitive from '@radix-ui/react-tabs';
2
- import { forwardRef, createContext, useState, useMemo, useRef, useId, useEffect, useCallback, useSyncExternalStore, Children, isValidElement } from 'react';
2
+ import { forwardRef, createContext, useState, useMemo, useRef, useId, useEffect, useContext, useCallback, useSyncExternalStore, Children, isValidElement } from 'react';
3
3
  import { clsx } from 'clsx';
4
4
  import { extendTailwindMerge } from 'tailwind-merge';
5
5
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -9,6 +9,7 @@ import { cva } from 'class-variance-authority';
9
9
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
10
10
  import 'sonner';
11
11
  import Link from 'next/link';
12
+ import { useRouter } from 'next/compat/router';
12
13
 
13
14
  // src/code/highlight.ts
14
15
  var TOKEN_CLASS = {
@@ -541,6 +542,11 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
541
542
  )
542
543
  ] });
543
544
  }
545
+ function sharedContext(name, initial) {
546
+ const key = /* @__PURE__ */ Symbol.for(`@orangecheck/app-design/${name}`);
547
+ const store = globalThis;
548
+ return store[key] ?? (store[key] = createContext(initial));
549
+ }
544
550
  function Spinner({ className, label }) {
545
551
  return /* @__PURE__ */ jsxs(
546
552
  "svg",
@@ -784,11 +790,13 @@ function forClipboard(text, lang) {
784
790
  if (!lines.some((l) => l.startsWith("$ "))) return text;
785
791
  return lines.filter((l) => l.startsWith("$ ")).map((l) => l.slice(2)).join("\n");
786
792
  }
787
- function linesFromDom(pre) {
793
+ function linesFromDom(pre, newline) {
788
794
  if (!pre) return null;
789
795
  const lines = pre.querySelectorAll("[data-line]");
790
796
  if (lines.length === 0) return pre.textContent ?? "";
791
- return Array.from(lines).filter((l) => l.getAttribute("data-diff") !== "remove").map((l) => l.textContent ?? "").join("\n");
797
+ const text = Array.from(lines).filter((l) => l.getAttribute("data-diff") !== "remove").map((l) => l.textContent ?? "").join("\n");
798
+ return newline ? `${text}
799
+ ` : text;
792
800
  }
793
801
  function prepare(code, lang, marks, diff) {
794
802
  const d = diff ? readDiff(code) : null;
@@ -797,7 +805,8 @@ function prepare(code, lang, marks, diff) {
797
805
  const kept = d ? src.split("\n").filter((_, i) => d.diff.get(i + 1) !== "remove") : null;
798
806
  return {
799
807
  html: linesToHtml(lines, { highlight: parseLineRanges(marks), diff: d?.diff }),
800
- copy: kept ? kept.join("\n") : src,
808
+ // Byte for byte, the final newline too: a hash printed beside the code must match a copy of it.
809
+ copy: kept ? kept.join("\n") + (/\n$/.test(code) ? "\n" : "") : code,
801
810
  lines: lines.length,
802
811
  diff: !!d
803
812
  };
@@ -862,6 +871,7 @@ function CodeBlock({
862
871
  code,
863
872
  html,
864
873
  children,
874
+ trailingNewline = false,
865
875
  lang,
866
876
  caption,
867
877
  copy = true,
@@ -882,7 +892,7 @@ function CodeBlock({
882
892
  );
883
893
  const markup = prepared?.html ?? html;
884
894
  const lines = prepared?.lines ?? (html !== void 0 ? html.split("\n").length : code?.split("\n").length ?? 0);
885
- const read = () => forClipboard(prepared?.copy ?? linesFromDom(preRef.current) ?? code ?? "", lang);
895
+ const read = () => forClipboard(prepared?.copy ?? linesFromDom(preRef.current, trailingNewline) ?? code ?? "", lang);
886
896
  return /* @__PURE__ */ jsxs("figure", { className: cn(FRAME, className), children: [
887
897
  /* @__PURE__ */ jsxs("figcaption", { className: "flex h-11 items-center justify-between gap-3 border-b border-[var(--oca-code-line)] pl-5 pr-2", children: [
888
898
  /* @__PURE__ */ jsx("span", { className: "truncate text-[0.8125rem] text-oca-ink-subtle", children: caption ?? languageName(lang) ?? "Code" }),
@@ -1154,6 +1164,7 @@ function MdxTable({ className, ...props }) {
1154
1164
  }
1155
1165
  ) }) });
1156
1166
  }
1167
+ var said = (n) => n !== void 0 && n !== null && n !== false && n !== "";
1157
1168
  function ApiTable({
1158
1169
  rows,
1159
1170
  caption,
@@ -1161,43 +1172,42 @@ function ApiTable({
1161
1172
  className
1162
1173
  }) {
1163
1174
  const hasDefault = rows.some((r) => r.default !== void 0);
1164
- const marks = (r) => /* @__PURE__ */ jsxs(Fragment, { children: [
1165
- r.required ? /* @__PURE__ */ jsx("span", { className: "text-[0.75rem] text-oca-accent-ink", children: "Required" }) : null,
1166
- r.deprecated ? /* @__PURE__ */ jsx(Badge, { tone: "muted", children: "Deprecated" }) : null,
1167
- r.status ? /* @__PURE__ */ jsx(StatusBadge, { status: r.status }) : null
1168
- ] });
1169
- return /* @__PURE__ */ jsxs("div", { className: cn("not-prose my-6", className), children: [
1170
- /* @__PURE__ */ jsx("div", { className: "overflow-hidden rounded-2xl border border-border bg-card max-sm:hidden", children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-left text-[0.875rem]", children: [
1171
- caption ? /* @__PURE__ */ jsx("caption", { className: "sr-only", children: caption }) : null,
1172
- /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-oca-hairline-strong bg-oca-table-head text-[0.8125rem]", children: [
1173
- /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: nameHeader }),
1174
- /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Type" }),
1175
- hasDefault ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Default" }) : null,
1176
- /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Description" })
1177
- ] }) }),
1178
- /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border", children: rows.map((r) => /* @__PURE__ */ jsxs("tr", { className: "align-top", children: [
1179
- /* @__PURE__ */ jsx("th", { scope: "row", className: "px-4 py-3 text-left font-normal", children: /* @__PURE__ */ jsxs("span", { className: "flex flex-col items-start gap-1", children: [
1180
- /* @__PURE__ */ jsx("code", { className: cn("font-mono text-[0.8125rem] text-foreground", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
1181
- marks(r)
1182
- ] }) }),
1183
- /* @__PURE__ */ jsx("td", { className: "px-4 py-3 font-mono text-[0.8125rem] text-muted-foreground", children: r.type ?? "\u2014" }),
1184
- hasDefault ? /* @__PURE__ */ jsx("td", { className: "px-4 py-3 font-mono text-[0.8125rem] text-muted-foreground", children: r.default ?? "\u2014" }) : null,
1185
- /* @__PURE__ */ jsx("td", { className: "px-4 py-3 leading-relaxed text-muted-foreground", children: r.description })
1186
- ] }, r.name)) })
1187
- ] }) }) }),
1188
- /* @__PURE__ */ jsx("ul", { "aria-label": caption, className: "divide-y divide-border rounded-2xl border border-border bg-card sm:hidden", children: rows.map((r) => /* @__PURE__ */ jsxs("li", { className: "flex flex-col gap-1.5 px-4 py-3.5", children: [
1189
- /* @__PURE__ */ jsxs("span", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
1190
- /* @__PURE__ */ jsx("code", { className: cn("font-mono text-[0.875rem] text-foreground", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
1191
- r.type ? /* @__PURE__ */ jsx("code", { className: "break-all font-mono text-[0.8125rem] text-muted-foreground", children: r.type }) : null
1192
- ] }),
1193
- /* @__PURE__ */ jsx("span", { className: "flex flex-wrap items-center gap-2 empty:hidden", children: marks(r) }),
1194
- r.description ? /* @__PURE__ */ jsx("span", { className: "text-[0.875rem] leading-relaxed text-muted-foreground", children: r.description }) : null,
1195
- r.default !== void 0 ? /* @__PURE__ */ jsxs("span", { className: "text-[0.8125rem] text-muted-foreground", children: [
1196
- "Default ",
1197
- /* @__PURE__ */ jsx("code", { className: "font-mono text-foreground", children: r.default })
1198
- ] }) : null
1199
- ] }, r.name)) })
1200
- ] });
1175
+ const hasDescription = rows.some((r) => said(r.description));
1176
+ const hasSource = rows.some((r) => said(r.source));
1177
+ const cell = "px-4 py-3 max-sm:p-0";
1178
+ return /* @__PURE__ */ jsx("div", { className: cn("not-prose my-6 overflow-hidden rounded-2xl border border-border bg-card", className), children: /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxs("table", { className: "w-full border-collapse text-left text-[0.875rem] max-sm:block", children: [
1179
+ caption ? /* @__PURE__ */ jsx("caption", { className: "sr-only", children: caption }) : null,
1180
+ /* @__PURE__ */ jsx("thead", { className: "max-sm:sr-only", children: /* @__PURE__ */ jsxs("tr", { className: "border-b border-oca-hairline-strong bg-oca-table-head text-[0.8125rem]", children: [
1181
+ /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: nameHeader }),
1182
+ /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Type" }),
1183
+ hasDefault ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Default" }) : null,
1184
+ hasDescription ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Description" }) : null,
1185
+ hasSource ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Defined in" }) : null
1186
+ ] }) }),
1187
+ /* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border max-sm:block", children: rows.map((r) => /* @__PURE__ */ jsxs(
1188
+ "tr",
1189
+ {
1190
+ id: r.id,
1191
+ className: "scroll-mt-28 align-top target:bg-muted max-sm:flex max-sm:flex-col max-sm:gap-1.5 max-sm:px-4 max-sm:py-3.5",
1192
+ children: [
1193
+ /* @__PURE__ */ jsx("th", { scope: "row", className: cn(cell, "text-left font-normal"), children: /* @__PURE__ */ jsxs("span", { className: "flex flex-col items-start gap-1 max-sm:flex-row max-sm:flex-wrap max-sm:items-baseline max-sm:gap-x-2", children: [
1194
+ /* @__PURE__ */ jsx("code", { className: cn("font-mono text-[0.8125rem] text-foreground max-sm:text-[0.875rem]", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
1195
+ r.required ? /* @__PURE__ */ jsx("span", { className: "text-[0.75rem] text-oca-accent-ink", children: "Required" }) : null,
1196
+ r.deprecated ? /* @__PURE__ */ jsx(Badge, { tone: "muted", children: "Deprecated" }) : null,
1197
+ r.status ? /* @__PURE__ */ jsx(StatusBadge, { status: r.status }) : null
1198
+ ] }) }),
1199
+ /* @__PURE__ */ jsx("td", { className: cn(cell, "font-mono text-[0.8125rem] text-muted-foreground max-sm:break-all", !said(r.type) && "max-sm:hidden"), children: r.type ?? "\u2014" }),
1200
+ hasDefault ? /* @__PURE__ */ jsxs("td", { className: cn(cell, "font-mono text-[0.8125rem] text-muted-foreground max-sm:order-last", r.default === void 0 && "max-sm:hidden"), children: [
1201
+ /* @__PURE__ */ jsx("span", { className: "font-sans sm:hidden", children: "Default " }),
1202
+ r.default ?? "\u2014"
1203
+ ] }) : null,
1204
+ hasDescription ? /* @__PURE__ */ jsx("td", { className: cn(cell, "leading-relaxed text-muted-foreground", !said(r.description) && "max-sm:hidden"), children: r.description }) : null,
1205
+ hasSource ? /* @__PURE__ */ jsx("td", { className: cn(cell, "text-[0.8125rem] text-muted-foreground max-sm:order-last max-sm:break-all", !said(r.source) && "max-sm:hidden"), children: r.source }) : null
1206
+ ]
1207
+ },
1208
+ r.id ?? r.name
1209
+ )) })
1210
+ ] }) }) });
1201
1211
  }
1202
1212
  function useDarkMode() {
1203
1213
  const [dark, setDark] = useState(false);
@@ -1259,17 +1269,35 @@ function mermaidTheme(el) {
1259
1269
  sequenceNumberColor: card
1260
1270
  };
1261
1271
  }
1272
+ var FIT = 4 / 3;
1262
1273
  function naturalSize(svg) {
1263
1274
  const w = svg.match(/viewBox="[\d.-]+ [\d.-]+ ([\d.]+) [\d.]+"/)?.[1];
1264
- if (!w) return svg;
1265
- return svg.replace(/<svg([^>]*?)\swidth="100%"/, `<svg$1 width="${Math.ceil(Number(w))}"`).replace(/max-width:\s*[\d.]+px;?/, "");
1275
+ if (!w) return { svg, width: null };
1276
+ const width = Math.ceil(Number(w));
1277
+ return {
1278
+ svg: svg.replace(/<svg([^>]*?)\swidth="100%"/, `<svg$1 width="${width}"`).replace(/max-width:\s*[\d.]+px;?/, ""),
1279
+ width
1280
+ };
1281
+ }
1282
+ function useInnerWidth(ref, padding) {
1283
+ const [width, setWidth] = useState(null);
1284
+ useEffect(() => {
1285
+ const el = ref.current;
1286
+ if (!el) return;
1287
+ const ro = new ResizeObserver(() => setWidth(el.clientWidth - padding));
1288
+ ro.observe(el);
1289
+ return () => ro.disconnect();
1290
+ }, [ref, padding]);
1291
+ return width;
1266
1292
  }
1267
1293
  function Diagram({ chart, caption, load, className }) {
1268
1294
  const ref = useRef(null);
1269
1295
  const dark = useDarkMode();
1270
1296
  const raw = useId();
1271
- const [svg, setSvg] = useState(null);
1297
+ const [drawn, setDrawn] = useState(null);
1272
1298
  const [failed, setFailed] = useState(false);
1299
+ const room = useInnerWidth(ref, 48);
1300
+ const fits = drawn?.width != null && room != null && drawn.width <= room * FIT;
1273
1301
  useEffect(() => {
1274
1302
  let live = true;
1275
1303
  const el = ref.current;
@@ -1279,9 +1307,9 @@ function Diagram({ chart, caption, load, className }) {
1279
1307
  const mod = await load();
1280
1308
  const mermaid = "default" in mod ? mod.default : mod;
1281
1309
  mermaid.initialize({ startOnLoad: false, securityLevel: "strict", theme: "base", themeVariables: mermaidTheme(el) });
1282
- const { svg: drawn } = await mermaid.render(`oca-diagram-${raw.replace(/[^a-zA-Z0-9]/g, "")}-${dark ? "d" : "l"}`, chart);
1310
+ const { svg } = await mermaid.render(`oca-diagram-${raw.replace(/[^a-zA-Z0-9]/g, "")}-${dark ? "d" : "l"}`, chart);
1283
1311
  if (live) {
1284
- setSvg(naturalSize(drawn));
1312
+ setDrawn(naturalSize(svg));
1285
1313
  setFailed(false);
1286
1314
  }
1287
1315
  } catch {
@@ -1294,13 +1322,17 @@ function Diagram({ chart, caption, load, className }) {
1294
1322
  }, [chart, dark, load, raw]);
1295
1323
  if (failed) return /* @__PURE__ */ jsx(CodeBlock, { code: chart, caption: "Diagram (shown as its source)", className: cn("my-6", className) });
1296
1324
  return /* @__PURE__ */ jsxs("figure", { ref, className: cn("not-prose my-6 overflow-hidden rounded-[1.25rem] border border-border bg-card", className), children: [
1297
- svg ? /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsx(
1325
+ drawn ? /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsx(
1298
1326
  "div",
1299
1327
  {
1300
- className: "flex w-max min-w-full justify-center p-6 [&_svg]:h-auto [&_svg]:max-w-none",
1328
+ "data-fit": fits ? "" : void 0,
1329
+ className: cn(
1330
+ "flex justify-center p-6 [&_svg]:h-auto",
1331
+ fits ? "w-full [&_svg]:max-w-full" : "w-max min-w-full [&_svg]:max-w-none"
1332
+ ),
1301
1333
  role: "img",
1302
1334
  "aria-label": typeof caption === "string" ? caption : "Diagram",
1303
- dangerouslySetInnerHTML: { __html: svg }
1335
+ dangerouslySetInnerHTML: { __html: drawn.svg }
1304
1336
  }
1305
1337
  ) }) : /* @__PURE__ */ jsx("div", { role: "status", "aria-label": "Drawing the diagram", className: "p-6", children: /* @__PURE__ */ jsx(Skeleton, { className: "h-40 w-full rounded-xl" }) }),
1306
1338
  caption ? /* @__PURE__ */ jsx("figcaption", { className: "border-t border-border px-5 py-3 text-[0.8125rem] text-muted-foreground", children: caption }) : null
@@ -1470,6 +1502,10 @@ function protocolSite(slug) {
1470
1502
  { href: `${OCHK_IO}/trust`, label: "Trust" },
1471
1503
  { href: `${OCHK_IO}/about`, label: "About" }
1472
1504
  ];
1505
+ var InDocsContext = sharedContext("in-docs", false);
1506
+ function useInDocs() {
1507
+ return useContext(InDocsContext);
1508
+ }
1473
1509
  var CARD = "group relative flex h-full flex-col rounded-[1.25rem] border border-border bg-card p-6 transition-colors hover:border-oca-hairline-strong md:p-7 has-[a:focus-visible]:ring-2 has-[a:focus-visible]:ring-ring has-[a:focus-visible]:ring-offset-2 has-[a:focus-visible]:ring-offset-background";
1474
1510
  var STRETCH = 'outline-none after:absolute after:inset-0 after:rounded-[1.25rem] after:content-[""]';
1475
1511
  var pad = (n) => String(n + 1).padStart(2, "0");
@@ -1478,6 +1514,7 @@ function ProtocolGrid({
1478
1514
  link = "page",
1479
1515
  className
1480
1516
  }) {
1517
+ const inDocs = useInDocs();
1481
1518
  return /* @__PURE__ */ jsx("ul", { className: cn("grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 md:gap-5", className), children: protocols.map((slug) => {
1482
1519
  const p = protocolSite(slug);
1483
1520
  const i = PROTOCOL_ORDER.indexOf(slug);
@@ -1490,7 +1527,7 @@ function ProtocolGrid({
1490
1527
  ] }),
1491
1528
  p.status !== "live" ? /* @__PURE__ */ jsx(StatusBadge, { status: p.status }) : null
1492
1529
  ] }),
1493
- /* @__PURE__ */ jsx("h3", { className: "oca-display-3", children: /* @__PURE__ */ jsx(
1530
+ /* @__PURE__ */ jsx("h3", { className: "oca-display-3", children: link === "docs" && inDocs ? /* @__PURE__ */ jsx(Link, { href: `/${p.slug}`, className: STRETCH, children: p.label }) : /* @__PURE__ */ jsx(
1494
1531
  "a",
1495
1532
  {
1496
1533
  href: link === "tool" ? p.toolHref : link === "docs" ? `${DOCS_HREF}/${p.slug}` : p.pageHref,
@@ -1521,14 +1558,61 @@ function ProtocolGrid({
1521
1558
  ] }) }, slug);
1522
1559
  }) });
1523
1560
  }
1524
- function SpecCard({
1525
- protocol: protocol2,
1526
- version,
1527
- license,
1528
- vectors,
1529
- size = "md",
1561
+ var LINK = "text-foreground underline decoration-foreground/35 underline-offset-4 transition-colors hover:decoration-foreground";
1562
+ var SCHEME = /^[a-z][a-z\d+.-]*:/i;
1563
+ function useResolved(href) {
1564
+ const router = useRouter();
1565
+ if (!router || !href || href.startsWith("/") || href.startsWith("#") || href.startsWith("?") || SCHEME.test(href)) return href;
1566
+ const here = router.asPath.split(/[?#]/)[0] || "/";
1567
+ const url = new URL(href, `https://page.invalid${here}`);
1568
+ return url.pathname + url.search + url.hash;
1569
+ }
1570
+ function TextLink({
1571
+ href: written,
1572
+ children,
1573
+ external,
1530
1574
  className
1531
1575
  }) {
1576
+ const href = useResolved(written);
1577
+ const internal = href.startsWith("/") && !href.startsWith("/api/") && !href.startsWith("/.well-known/");
1578
+ const offsite = external ?? /^https?:\/\//.test(href);
1579
+ if (internal && !offsite) {
1580
+ return /* @__PURE__ */ jsx(Link, { href, className: cn(LINK, className), children });
1581
+ }
1582
+ return /* @__PURE__ */ jsxs("a", { href, className: cn(LINK, className), ...offsite ? { target: "_blank", rel: "noreferrer" } : {}, children: [
1583
+ children,
1584
+ offsite ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: " (opens in a new tab)" }) : null
1585
+ ] });
1586
+ }
1587
+ var SPEC_FILE = {
1588
+ spec: {
1589
+ file: "SPEC.md",
1590
+ title: "Normative source",
1591
+ note: "This page is a human-readable summary. The authoritative copy lives in the spec repo. If the two ever drift, the repo wins."
1592
+ },
1593
+ security: {
1594
+ file: "SECURITY.md",
1595
+ title: "Normative threat model",
1596
+ note: "This page is the short form. The authoritative, numbered threat model lives in the spec repo."
1597
+ },
1598
+ rationale: {
1599
+ file: "WHY.md",
1600
+ title: "Design rationale",
1601
+ note: "This page is the short version. The full rationale and the rejected-design log live in the spec repo."
1602
+ }
1603
+ };
1604
+ function SpecCard(props) {
1605
+ return props.repo !== void 0 ? /* @__PURE__ */ jsx(SpecFileNote, { ...props }) : /* @__PURE__ */ jsx(ProtocolSpecCard, { ...props });
1606
+ }
1607
+ function SpecFileNote({ repo, file, kind = "spec", version, note, className }) {
1608
+ const d = SPEC_FILE[kind];
1609
+ const f = file ?? d.file;
1610
+ return /* @__PURE__ */ jsxs(Callout, { title: version ? `${d.title} \xB7 ${version}` : d.title, className, children: [
1611
+ /* @__PURE__ */ jsx("p", { children: note ?? d.note }),
1612
+ /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx(TextLink, { href: `https://github.com/orangecheck/${repo}/blob/main/${f}`, className: "break-all font-mono text-[0.875rem]", children: `${repo}/${f}` }) })
1613
+ ] });
1614
+ }
1615
+ function ProtocolSpecCard({ protocol: protocol2, version, license, vectors, size = "md", className }) {
1532
1616
  const p = protocolSite(protocol2);
1533
1617
  const repo = `oc-${p.slug}-protocol`;
1534
1618
  const facts = [
@@ -1575,23 +1659,6 @@ function SpecCard({
1575
1659
  ] }) }) })
1576
1660
  ] });
1577
1661
  }
1578
- var LINK = "text-foreground underline decoration-foreground/35 underline-offset-4 transition-colors hover:decoration-foreground";
1579
- function TextLink({
1580
- href,
1581
- children,
1582
- external,
1583
- className
1584
- }) {
1585
- const internal = href.startsWith("/") && !href.startsWith("/api/") && !href.startsWith("/.well-known/");
1586
- const offsite = external ?? /^https?:\/\//.test(href);
1587
- if (internal && !offsite) {
1588
- return /* @__PURE__ */ jsx(Link, { href, className: cn(LINK, className), children });
1589
- }
1590
- return /* @__PURE__ */ jsxs("a", { href, className: cn(LINK, className), ...offsite ? { target: "_blank", rel: "noreferrer" } : {}, children: [
1591
- children,
1592
- offsite ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: " (opens in a new tab)" }) : null
1593
- ] });
1594
- }
1595
1662
  function createMdxComponents({ mermaid } = {}) {
1596
1663
  function Pre(props) {
1597
1664
  if (props["data-oca-code"] !== void 0) {
@@ -1603,6 +1670,7 @@ function createMdxComponents({ mermaid } = {}) {
1603
1670
  caption: props["data-title"],
1604
1671
  diff: props["data-diff"] !== void 0,
1605
1672
  lineNumbers: props["data-line-numbers"] !== void 0,
1673
+ trailingNewline: props["data-eol"] !== void 0,
1606
1674
  className: "my-6"
1607
1675
  }
1608
1676
  );
@@ -1629,6 +1697,9 @@ function createMdxComponents({ mermaid } = {}) {
1629
1697
  const heading = (as) => function Heading(props) {
1630
1698
  return /* @__PURE__ */ jsx(DocsHeading, { as, ...props });
1631
1699
  };
1700
+ const minor = (Tag) => function Minor({ className, ...props }) {
1701
+ return /* @__PURE__ */ jsx(Tag, { className: cn("mb-2 mt-6 scroll-mt-28 text-[0.9375rem] font-medium leading-snug text-foreground", className), ...props });
1702
+ };
1632
1703
  return {
1633
1704
  h1: heading("h1"),
1634
1705
  h2: heading("h2"),
@@ -1637,11 +1708,15 @@ function createMdxComponents({ mermaid } = {}) {
1637
1708
  p: ({ className, ...props }) => /* @__PURE__ */ jsx("p", { className: cn("my-4 text-[1rem] leading-[1.75] text-muted-foreground md:text-[1.0625rem]", className), ...props }),
1638
1709
  a: A,
1639
1710
  strong: (props) => /* @__PURE__ */ jsx("strong", { className: "font-medium text-foreground", ...props }),
1711
+ h5: minor("h5"),
1712
+ h6: minor("h6"),
1640
1713
  ul: ({ className, ...props }) => /* @__PURE__ */ jsx(
1641
1714
  "ul",
1642
1715
  {
1643
1716
  className: cn(
1644
1717
  "my-4 list-disc space-y-1.5 pl-5 text-[1rem] leading-[1.7] text-muted-foreground marker:text-oca-subtle md:text-[1.0625rem]",
1718
+ // A GitHub task list: the box replaces the bullet.
1719
+ className?.includes("contains-task-list") && "list-none pl-0",
1645
1720
  className
1646
1721
  ),
1647
1722
  ...props
@@ -1657,7 +1732,26 @@ function createMdxComponents({ mermaid } = {}) {
1657
1732
  ...props
1658
1733
  }
1659
1734
  ),
1660
- li: ({ className, ...props }) => /* @__PURE__ */ jsx("li", { className: cn("pl-1 [&>p]:my-1 [&>ul]:my-1.5 [&>ol]:my-1.5", className), ...props }),
1735
+ li: ({ className, ...props }) => /* @__PURE__ */ jsx(
1736
+ "li",
1737
+ {
1738
+ className: cn(
1739
+ "pl-1 [&>p]:my-1 [&>ul]:my-1.5 [&>ol]:my-1.5",
1740
+ // A wrapped task starts under its text, not under the box.
1741
+ className?.includes("task-list-item") && "pl-6 -indent-6",
1742
+ className
1743
+ ),
1744
+ ...props
1745
+ }
1746
+ ),
1747
+ input: (props) => props.type === "checkbox" ? /* @__PURE__ */ jsx(
1748
+ "input",
1749
+ {
1750
+ ...props,
1751
+ className: cn("mr-2 size-4 translate-y-[2px] align-baseline accent-foreground", props.className),
1752
+ "aria-label": props.checked ? "Done" : "To do"
1753
+ }
1754
+ ) : /* @__PURE__ */ jsx("input", { ...props }),
1661
1755
  blockquote: ({ children }) => /* @__PURE__ */ jsx(Callout, { children }),
1662
1756
  hr: () => /* @__PURE__ */ jsx("hr", { className: "my-10 border-border" }),
1663
1757
  table: MdxTable,