@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.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, HTMLAttributes, AnchorHTMLAttributes, ImgHTMLAttributes } from 'react';
3
- import { q as MermaidLoader, M as MdxTable, C as Callout, v as Steps, u as Step, L as LinkCard, e as CardGrid, a as ApiTable, f as CodeBlock, i as CodeTabs, I as InstallTabs, S as SpecCard, r as ProtocolGrid } from './docs-wJBfLS08.mjs';
2
+ import { ReactNode, HTMLAttributes, AnchorHTMLAttributes, InputHTMLAttributes, ImgHTMLAttributes } from 'react';
3
+ import { q as MermaidLoader, M as MdxTable, C as Callout, x as Steps, w as Step, L as LinkCard, e as CardGrid, a as ApiTable, f as CodeBlock, i as CodeTabs, I as InstallTabs, S as SpecCard, r as ProtocolGrid } from './docs-D-T-nHiu.mjs';
4
4
  import { b as StatusBadge } from './status-badge-BJ9Sdsx8.mjs';
5
5
  import './index-DmfyPYe5.mjs';
6
6
  import './hero-Dn37il-9.mjs';
@@ -15,6 +15,7 @@ type PreProps = HTMLAttributes<HTMLPreElement> & {
15
15
  'data-title'?: string;
16
16
  'data-diff'?: string;
17
17
  'data-line-numbers'?: string;
18
+ 'data-eol'?: string;
18
19
  };
19
20
  declare function createMdxComponents({ mermaid }?: MdxOptions): {
20
21
  Diagram?: ((p: {
@@ -28,9 +29,12 @@ declare function createMdxComponents({ mermaid }?: MdxOptions): {
28
29
  p: ({ className, ...props }: HTMLAttributes<HTMLParagraphElement>) => react.JSX.Element;
29
30
  a: ({ href, children, ...rest }: AnchorHTMLAttributes<HTMLAnchorElement>) => react.JSX.Element;
30
31
  strong: (props: HTMLAttributes<HTMLElement>) => react.JSX.Element;
32
+ h5: ({ className, ...props }: HTMLAttributes<HTMLHeadingElement>) => react.JSX.Element;
33
+ h6: ({ className, ...props }: HTMLAttributes<HTMLHeadingElement>) => react.JSX.Element;
31
34
  ul: ({ className, ...props }: HTMLAttributes<HTMLUListElement>) => react.JSX.Element;
32
35
  ol: ({ className, ...props }: HTMLAttributes<HTMLOListElement>) => react.JSX.Element;
33
36
  li: ({ className, ...props }: HTMLAttributes<HTMLLIElement>) => react.JSX.Element;
37
+ input: (props: InputHTMLAttributes<HTMLInputElement>) => react.JSX.Element;
34
38
  blockquote: ({ children }: {
35
39
  children?: ReactNode;
36
40
  }) => react.JSX.Element;
package/dist/mdx.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
- import { ReactNode, HTMLAttributes, AnchorHTMLAttributes, ImgHTMLAttributes } from 'react';
3
- import { q as MermaidLoader, M as MdxTable, C as Callout, v as Steps, u as Step, L as LinkCard, e as CardGrid, a as ApiTable, f as CodeBlock, i as CodeTabs, I as InstallTabs, S as SpecCard, r as ProtocolGrid } from './docs-Dxg4Tp_q.js';
2
+ import { ReactNode, HTMLAttributes, AnchorHTMLAttributes, InputHTMLAttributes, ImgHTMLAttributes } from 'react';
3
+ import { q as MermaidLoader, M as MdxTable, C as Callout, x as Steps, w as Step, L as LinkCard, e as CardGrid, a as ApiTable, f as CodeBlock, i as CodeTabs, I as InstallTabs, S as SpecCard, r as ProtocolGrid } from './docs-BB9gK4KF.js';
4
4
  import { b as StatusBadge } from './status-badge-Bt8x3RhO.js';
5
5
  import './index-DmfyPYe5.js';
6
6
  import './hero-Dn37il-9.js';
@@ -15,6 +15,7 @@ type PreProps = HTMLAttributes<HTMLPreElement> & {
15
15
  'data-title'?: string;
16
16
  'data-diff'?: string;
17
17
  'data-line-numbers'?: string;
18
+ 'data-eol'?: string;
18
19
  };
19
20
  declare function createMdxComponents({ mermaid }?: MdxOptions): {
20
21
  Diagram?: ((p: {
@@ -28,9 +29,12 @@ declare function createMdxComponents({ mermaid }?: MdxOptions): {
28
29
  p: ({ className, ...props }: HTMLAttributes<HTMLParagraphElement>) => react.JSX.Element;
29
30
  a: ({ href, children, ...rest }: AnchorHTMLAttributes<HTMLAnchorElement>) => react.JSX.Element;
30
31
  strong: (props: HTMLAttributes<HTMLElement>) => react.JSX.Element;
32
+ h5: ({ className, ...props }: HTMLAttributes<HTMLHeadingElement>) => react.JSX.Element;
33
+ h6: ({ className, ...props }: HTMLAttributes<HTMLHeadingElement>) => react.JSX.Element;
31
34
  ul: ({ className, ...props }: HTMLAttributes<HTMLUListElement>) => react.JSX.Element;
32
35
  ol: ({ className, ...props }: HTMLAttributes<HTMLOListElement>) => react.JSX.Element;
33
36
  li: ({ className, ...props }: HTMLAttributes<HTMLLIElement>) => react.JSX.Element;
37
+ input: (props: InputHTMLAttributes<HTMLInputElement>) => react.JSX.Element;
34
38
  blockquote: ({ children }: {
35
39
  children?: ReactNode;
36
40
  }) => react.JSX.Element;
package/dist/mdx.js CHANGED
@@ -11,6 +11,7 @@ var classVarianceAuthority = require('class-variance-authority');
11
11
  var SeparatorPrimitive = require('@radix-ui/react-separator');
12
12
  require('sonner');
13
13
  var Link = require('next/link');
14
+ var router = require('next/compat/router');
14
15
 
15
16
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
17
 
@@ -567,6 +568,11 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
567
568
  )
568
569
  ] });
569
570
  }
571
+ function sharedContext(name, initial) {
572
+ const key = /* @__PURE__ */ Symbol.for(`@orangecheck/app-design/${name}`);
573
+ const store = globalThis;
574
+ return store[key] ?? (store[key] = react.createContext(initial));
575
+ }
570
576
  function Spinner({ className, label }) {
571
577
  return /* @__PURE__ */ jsxRuntime.jsxs(
572
578
  "svg",
@@ -810,11 +816,13 @@ function forClipboard(text, lang) {
810
816
  if (!lines.some((l) => l.startsWith("$ "))) return text;
811
817
  return lines.filter((l) => l.startsWith("$ ")).map((l) => l.slice(2)).join("\n");
812
818
  }
813
- function linesFromDom(pre) {
819
+ function linesFromDom(pre, newline) {
814
820
  if (!pre) return null;
815
821
  const lines = pre.querySelectorAll("[data-line]");
816
822
  if (lines.length === 0) return pre.textContent ?? "";
817
- return Array.from(lines).filter((l) => l.getAttribute("data-diff") !== "remove").map((l) => l.textContent ?? "").join("\n");
823
+ const text = Array.from(lines).filter((l) => l.getAttribute("data-diff") !== "remove").map((l) => l.textContent ?? "").join("\n");
824
+ return newline ? `${text}
825
+ ` : text;
818
826
  }
819
827
  function prepare(code, lang, marks, diff) {
820
828
  const d = diff ? readDiff(code) : null;
@@ -823,7 +831,8 @@ function prepare(code, lang, marks, diff) {
823
831
  const kept = d ? src.split("\n").filter((_, i) => d.diff.get(i + 1) !== "remove") : null;
824
832
  return {
825
833
  html: linesToHtml(lines, { highlight: parseLineRanges(marks), diff: d?.diff }),
826
- copy: kept ? kept.join("\n") : src,
834
+ // Byte for byte, the final newline too: a hash printed beside the code must match a copy of it.
835
+ copy: kept ? kept.join("\n") + (/\n$/.test(code) ? "\n" : "") : code,
827
836
  lines: lines.length,
828
837
  diff: !!d
829
838
  };
@@ -888,6 +897,7 @@ function CodeBlock({
888
897
  code,
889
898
  html,
890
899
  children,
900
+ trailingNewline = false,
891
901
  lang,
892
902
  caption,
893
903
  copy = true,
@@ -908,7 +918,7 @@ function CodeBlock({
908
918
  );
909
919
  const markup = prepared?.html ?? html;
910
920
  const lines = prepared?.lines ?? (html !== void 0 ? html.split("\n").length : code?.split("\n").length ?? 0);
911
- const read = () => forClipboard(prepared?.copy ?? linesFromDom(preRef.current) ?? code ?? "", lang);
921
+ const read = () => forClipboard(prepared?.copy ?? linesFromDom(preRef.current, trailingNewline) ?? code ?? "", lang);
912
922
  return /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: cn(FRAME, className), children: [
913
923
  /* @__PURE__ */ jsxRuntime.jsxs("figcaption", { className: "flex h-11 items-center justify-between gap-3 border-b border-[var(--oca-code-line)] pl-5 pr-2", children: [
914
924
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-[0.8125rem] text-oca-ink-subtle", children: caption ?? languageName(lang) ?? "Code" }),
@@ -1180,6 +1190,7 @@ function MdxTable({ className, ...props }) {
1180
1190
  }
1181
1191
  ) }) });
1182
1192
  }
1193
+ var said = (n) => n !== void 0 && n !== null && n !== false && n !== "";
1183
1194
  function ApiTable({
1184
1195
  rows,
1185
1196
  caption,
@@ -1187,43 +1198,42 @@ function ApiTable({
1187
1198
  className
1188
1199
  }) {
1189
1200
  const hasDefault = rows.some((r) => r.default !== void 0);
1190
- const marks = (r) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1191
- r.required ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.75rem] text-oca-accent-ink", children: "Required" }) : null,
1192
- r.deprecated ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { tone: "muted", children: "Deprecated" }) : null,
1193
- r.status ? /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: r.status }) : null
1194
- ] });
1195
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("not-prose my-6", className), children: [
1196
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "overflow-hidden rounded-2xl border border-border bg-card max-sm:hidden", children: /* @__PURE__ */ jsxRuntime.jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full border-collapse text-left text-[0.875rem]", children: [
1197
- caption ? /* @__PURE__ */ jsxRuntime.jsx("caption", { className: "sr-only", children: caption }) : null,
1198
- /* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-b border-oca-hairline-strong bg-oca-table-head text-[0.8125rem]", children: [
1199
- /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: nameHeader }),
1200
- /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Type" }),
1201
- hasDefault ? /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Default" }) : null,
1202
- /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Description" })
1203
- ] }) }),
1204
- /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-border", children: rows.map((r) => /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "align-top", children: [
1205
- /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "row", className: "px-4 py-3 text-left font-normal", children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-col items-start gap-1", children: [
1206
- /* @__PURE__ */ jsxRuntime.jsx("code", { className: cn("font-mono text-[0.8125rem] text-foreground", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
1207
- marks(r)
1208
- ] }) }),
1209
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 font-mono text-[0.8125rem] text-muted-foreground", children: r.type ?? "\u2014" }),
1210
- hasDefault ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 font-mono text-[0.8125rem] text-muted-foreground", children: r.default ?? "\u2014" }) : null,
1211
- /* @__PURE__ */ jsxRuntime.jsx("td", { className: "px-4 py-3 leading-relaxed text-muted-foreground", children: r.description })
1212
- ] }, r.name)) })
1213
- ] }) }) }),
1214
- /* @__PURE__ */ jsxRuntime.jsx("ul", { "aria-label": caption, className: "divide-y divide-border rounded-2xl border border-border bg-card sm:hidden", children: rows.map((r) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex flex-col gap-1.5 px-4 py-3.5", children: [
1215
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
1216
- /* @__PURE__ */ jsxRuntime.jsx("code", { className: cn("font-mono text-[0.875rem] text-foreground", r.deprecated && "line-through decoration-oca-subtle"), children: r.name }),
1217
- r.type ? /* @__PURE__ */ jsxRuntime.jsx("code", { className: "break-all font-mono text-[0.8125rem] text-muted-foreground", children: r.type }) : null
1218
- ] }),
1219
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex flex-wrap items-center gap-2 empty:hidden", children: marks(r) }),
1220
- r.description ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.875rem] leading-relaxed text-muted-foreground", children: r.description }) : null,
1221
- r.default !== void 0 ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-[0.8125rem] text-muted-foreground", children: [
1222
- "Default ",
1223
- /* @__PURE__ */ jsxRuntime.jsx("code", { className: "font-mono text-foreground", children: r.default })
1224
- ] }) : null
1225
- ] }, r.name)) })
1226
- ] });
1201
+ const hasDescription = rows.some((r) => said(r.description));
1202
+ const hasSource = rows.some((r) => said(r.source));
1203
+ const cell = "px-4 py-3 max-sm:p-0";
1204
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn("not-prose my-6 overflow-hidden rounded-2xl border border-border bg-card", className), children: /* @__PURE__ */ jsxRuntime.jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { className: "w-full border-collapse text-left text-[0.875rem] max-sm:block", children: [
1205
+ caption ? /* @__PURE__ */ jsxRuntime.jsx("caption", { className: "sr-only", children: caption }) : null,
1206
+ /* @__PURE__ */ jsxRuntime.jsx("thead", { className: "max-sm:sr-only", children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { className: "border-b border-oca-hairline-strong bg-oca-table-head text-[0.8125rem]", children: [
1207
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: nameHeader }),
1208
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Type" }),
1209
+ hasDefault ? /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Default" }) : null,
1210
+ hasDescription ? /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Description" }) : null,
1211
+ hasSource ? /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Defined in" }) : null
1212
+ ] }) }),
1213
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-border max-sm:block", children: rows.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
1214
+ "tr",
1215
+ {
1216
+ id: r.id,
1217
+ 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",
1218
+ children: [
1219
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "row", className: cn(cell, "text-left font-normal"), children: /* @__PURE__ */ jsxRuntime.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: [
1220
+ /* @__PURE__ */ jsxRuntime.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 }),
1221
+ r.required ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.75rem] text-oca-accent-ink", children: "Required" }) : null,
1222
+ r.deprecated ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { tone: "muted", children: "Deprecated" }) : null,
1223
+ r.status ? /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: r.status }) : null
1224
+ ] }) }),
1225
+ /* @__PURE__ */ jsxRuntime.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" }),
1226
+ hasDefault ? /* @__PURE__ */ jsxRuntime.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: [
1227
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-sans sm:hidden", children: "Default " }),
1228
+ r.default ?? "\u2014"
1229
+ ] }) : null,
1230
+ hasDescription ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(cell, "leading-relaxed text-muted-foreground", !said(r.description) && "max-sm:hidden"), children: r.description }) : null,
1231
+ hasSource ? /* @__PURE__ */ jsxRuntime.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
1232
+ ]
1233
+ },
1234
+ r.id ?? r.name
1235
+ )) })
1236
+ ] }) }) });
1227
1237
  }
1228
1238
  function useDarkMode() {
1229
1239
  const [dark, setDark] = react.useState(false);
@@ -1285,17 +1295,35 @@ function mermaidTheme(el) {
1285
1295
  sequenceNumberColor: card
1286
1296
  };
1287
1297
  }
1298
+ var FIT = 4 / 3;
1288
1299
  function naturalSize(svg) {
1289
1300
  const w = svg.match(/viewBox="[\d.-]+ [\d.-]+ ([\d.]+) [\d.]+"/)?.[1];
1290
- if (!w) return svg;
1291
- return svg.replace(/<svg([^>]*?)\swidth="100%"/, `<svg$1 width="${Math.ceil(Number(w))}"`).replace(/max-width:\s*[\d.]+px;?/, "");
1301
+ if (!w) return { svg, width: null };
1302
+ const width = Math.ceil(Number(w));
1303
+ return {
1304
+ svg: svg.replace(/<svg([^>]*?)\swidth="100%"/, `<svg$1 width="${width}"`).replace(/max-width:\s*[\d.]+px;?/, ""),
1305
+ width
1306
+ };
1307
+ }
1308
+ function useInnerWidth(ref, padding) {
1309
+ const [width, setWidth] = react.useState(null);
1310
+ react.useEffect(() => {
1311
+ const el = ref.current;
1312
+ if (!el) return;
1313
+ const ro = new ResizeObserver(() => setWidth(el.clientWidth - padding));
1314
+ ro.observe(el);
1315
+ return () => ro.disconnect();
1316
+ }, [ref, padding]);
1317
+ return width;
1292
1318
  }
1293
1319
  function Diagram({ chart, caption, load, className }) {
1294
1320
  const ref = react.useRef(null);
1295
1321
  const dark = useDarkMode();
1296
1322
  const raw = react.useId();
1297
- const [svg, setSvg] = react.useState(null);
1323
+ const [drawn, setDrawn] = react.useState(null);
1298
1324
  const [failed, setFailed] = react.useState(false);
1325
+ const room = useInnerWidth(ref, 48);
1326
+ const fits = drawn?.width != null && room != null && drawn.width <= room * FIT;
1299
1327
  react.useEffect(() => {
1300
1328
  let live = true;
1301
1329
  const el = ref.current;
@@ -1305,9 +1333,9 @@ function Diagram({ chart, caption, load, className }) {
1305
1333
  const mod = await load();
1306
1334
  const mermaid = "default" in mod ? mod.default : mod;
1307
1335
  mermaid.initialize({ startOnLoad: false, securityLevel: "strict", theme: "base", themeVariables: mermaidTheme(el) });
1308
- const { svg: drawn } = await mermaid.render(`oca-diagram-${raw.replace(/[^a-zA-Z0-9]/g, "")}-${dark ? "d" : "l"}`, chart);
1336
+ const { svg } = await mermaid.render(`oca-diagram-${raw.replace(/[^a-zA-Z0-9]/g, "")}-${dark ? "d" : "l"}`, chart);
1309
1337
  if (live) {
1310
- setSvg(naturalSize(drawn));
1338
+ setDrawn(naturalSize(svg));
1311
1339
  setFailed(false);
1312
1340
  }
1313
1341
  } catch {
@@ -1320,13 +1348,17 @@ function Diagram({ chart, caption, load, className }) {
1320
1348
  }, [chart, dark, load, raw]);
1321
1349
  if (failed) return /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: chart, caption: "Diagram (shown as its source)", className: cn("my-6", className) });
1322
1350
  return /* @__PURE__ */ jsxRuntime.jsxs("figure", { ref, className: cn("not-prose my-6 overflow-hidden rounded-[1.25rem] border border-border bg-card", className), children: [
1323
- svg ? /* @__PURE__ */ jsxRuntime.jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxRuntime.jsx(
1351
+ drawn ? /* @__PURE__ */ jsxRuntime.jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxRuntime.jsx(
1324
1352
  "div",
1325
1353
  {
1326
- className: "flex w-max min-w-full justify-center p-6 [&_svg]:h-auto [&_svg]:max-w-none",
1354
+ "data-fit": fits ? "" : void 0,
1355
+ className: cn(
1356
+ "flex justify-center p-6 [&_svg]:h-auto",
1357
+ fits ? "w-full [&_svg]:max-w-full" : "w-max min-w-full [&_svg]:max-w-none"
1358
+ ),
1327
1359
  role: "img",
1328
1360
  "aria-label": typeof caption === "string" ? caption : "Diagram",
1329
- dangerouslySetInnerHTML: { __html: svg }
1361
+ dangerouslySetInnerHTML: { __html: drawn.svg }
1330
1362
  }
1331
1363
  ) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { role: "status", "aria-label": "Drawing the diagram", className: "p-6", children: /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-40 w-full rounded-xl" }) }),
1332
1364
  caption ? /* @__PURE__ */ jsxRuntime.jsx("figcaption", { className: "border-t border-border px-5 py-3 text-[0.8125rem] text-muted-foreground", children: caption }) : null
@@ -1496,6 +1528,10 @@ function protocolSite(slug) {
1496
1528
  { href: `${OCHK_IO}/trust`, label: "Trust" },
1497
1529
  { href: `${OCHK_IO}/about`, label: "About" }
1498
1530
  ];
1531
+ var InDocsContext = sharedContext("in-docs", false);
1532
+ function useInDocs() {
1533
+ return react.useContext(InDocsContext);
1534
+ }
1499
1535
  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";
1500
1536
  var STRETCH = 'outline-none after:absolute after:inset-0 after:rounded-[1.25rem] after:content-[""]';
1501
1537
  var pad = (n) => String(n + 1).padStart(2, "0");
@@ -1504,6 +1540,7 @@ function ProtocolGrid({
1504
1540
  link = "page",
1505
1541
  className
1506
1542
  }) {
1543
+ const inDocs = useInDocs();
1507
1544
  return /* @__PURE__ */ jsxRuntime.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) => {
1508
1545
  const p = protocolSite(slug);
1509
1546
  const i = PROTOCOL_ORDER.indexOf(slug);
@@ -1516,7 +1553,7 @@ function ProtocolGrid({
1516
1553
  ] }),
1517
1554
  p.status !== "live" ? /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: p.status }) : null
1518
1555
  ] }),
1519
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "oca-display-3", children: /* @__PURE__ */ jsxRuntime.jsx(
1556
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "oca-display-3", children: link === "docs" && inDocs ? /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href: `/${p.slug}`, className: STRETCH, children: p.label }) : /* @__PURE__ */ jsxRuntime.jsx(
1520
1557
  "a",
1521
1558
  {
1522
1559
  href: link === "tool" ? p.toolHref : link === "docs" ? `${DOCS_HREF}/${p.slug}` : p.pageHref,
@@ -1547,14 +1584,61 @@ function ProtocolGrid({
1547
1584
  ] }) }, slug);
1548
1585
  }) });
1549
1586
  }
1550
- function SpecCard({
1551
- protocol: protocol2,
1552
- version,
1553
- license,
1554
- vectors,
1555
- size = "md",
1587
+ var LINK = "text-foreground underline decoration-foreground/35 underline-offset-4 transition-colors hover:decoration-foreground";
1588
+ var SCHEME = /^[a-z][a-z\d+.-]*:/i;
1589
+ function useResolved(href) {
1590
+ const router$1 = router.useRouter();
1591
+ if (!router$1 || !href || href.startsWith("/") || href.startsWith("#") || href.startsWith("?") || SCHEME.test(href)) return href;
1592
+ const here = router$1.asPath.split(/[?#]/)[0] || "/";
1593
+ const url = new URL(href, `https://page.invalid${here}`);
1594
+ return url.pathname + url.search + url.hash;
1595
+ }
1596
+ function TextLink({
1597
+ href: written,
1598
+ children,
1599
+ external,
1556
1600
  className
1557
1601
  }) {
1602
+ const href = useResolved(written);
1603
+ const internal = href.startsWith("/") && !href.startsWith("/api/") && !href.startsWith("/.well-known/");
1604
+ const offsite = external ?? /^https?:\/\//.test(href);
1605
+ if (internal && !offsite) {
1606
+ return /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href, className: cn(LINK, className), children });
1607
+ }
1608
+ return /* @__PURE__ */ jsxRuntime.jsxs("a", { href, className: cn(LINK, className), ...offsite ? { target: "_blank", rel: "noreferrer" } : {}, children: [
1609
+ children,
1610
+ offsite ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: " (opens in a new tab)" }) : null
1611
+ ] });
1612
+ }
1613
+ var SPEC_FILE = {
1614
+ spec: {
1615
+ file: "SPEC.md",
1616
+ title: "Normative source",
1617
+ note: "This page is a human-readable summary. The authoritative copy lives in the spec repo. If the two ever drift, the repo wins."
1618
+ },
1619
+ security: {
1620
+ file: "SECURITY.md",
1621
+ title: "Normative threat model",
1622
+ note: "This page is the short form. The authoritative, numbered threat model lives in the spec repo."
1623
+ },
1624
+ rationale: {
1625
+ file: "WHY.md",
1626
+ title: "Design rationale",
1627
+ note: "This page is the short version. The full rationale and the rejected-design log live in the spec repo."
1628
+ }
1629
+ };
1630
+ function SpecCard(props) {
1631
+ return props.repo !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(SpecFileNote, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(ProtocolSpecCard, { ...props });
1632
+ }
1633
+ function SpecFileNote({ repo, file, kind = "spec", version, note, className }) {
1634
+ const d = SPEC_FILE[kind];
1635
+ const f = file ?? d.file;
1636
+ return /* @__PURE__ */ jsxRuntime.jsxs(Callout, { title: version ? `${d.title} \xB7 ${version}` : d.title, className, children: [
1637
+ /* @__PURE__ */ jsxRuntime.jsx("p", { children: note ?? d.note }),
1638
+ /* @__PURE__ */ jsxRuntime.jsx("p", { children: /* @__PURE__ */ jsxRuntime.jsx(TextLink, { href: `https://github.com/orangecheck/${repo}/blob/main/${f}`, className: "break-all font-mono text-[0.875rem]", children: `${repo}/${f}` }) })
1639
+ ] });
1640
+ }
1641
+ function ProtocolSpecCard({ protocol: protocol2, version, license, vectors, size = "md", className }) {
1558
1642
  const p = protocolSite(protocol2);
1559
1643
  const repo = `oc-${p.slug}-protocol`;
1560
1644
  const facts = [
@@ -1601,23 +1685,6 @@ function SpecCard({
1601
1685
  ] }) }) })
1602
1686
  ] });
1603
1687
  }
1604
- var LINK = "text-foreground underline decoration-foreground/35 underline-offset-4 transition-colors hover:decoration-foreground";
1605
- function TextLink({
1606
- href,
1607
- children,
1608
- external,
1609
- className
1610
- }) {
1611
- const internal = href.startsWith("/") && !href.startsWith("/api/") && !href.startsWith("/.well-known/");
1612
- const offsite = external ?? /^https?:\/\//.test(href);
1613
- if (internal && !offsite) {
1614
- return /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href, className: cn(LINK, className), children });
1615
- }
1616
- return /* @__PURE__ */ jsxRuntime.jsxs("a", { href, className: cn(LINK, className), ...offsite ? { target: "_blank", rel: "noreferrer" } : {}, children: [
1617
- children,
1618
- offsite ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: " (opens in a new tab)" }) : null
1619
- ] });
1620
- }
1621
1688
  function createMdxComponents({ mermaid } = {}) {
1622
1689
  function Pre(props) {
1623
1690
  if (props["data-oca-code"] !== void 0) {
@@ -1629,6 +1696,7 @@ function createMdxComponents({ mermaid } = {}) {
1629
1696
  caption: props["data-title"],
1630
1697
  diff: props["data-diff"] !== void 0,
1631
1698
  lineNumbers: props["data-line-numbers"] !== void 0,
1699
+ trailingNewline: props["data-eol"] !== void 0,
1632
1700
  className: "my-6"
1633
1701
  }
1634
1702
  );
@@ -1655,6 +1723,9 @@ function createMdxComponents({ mermaid } = {}) {
1655
1723
  const heading = (as) => function Heading(props) {
1656
1724
  return /* @__PURE__ */ jsxRuntime.jsx(DocsHeading, { as, ...props });
1657
1725
  };
1726
+ const minor = (Tag) => function Minor({ className, ...props }) {
1727
+ return /* @__PURE__ */ jsxRuntime.jsx(Tag, { className: cn("mb-2 mt-6 scroll-mt-28 text-[0.9375rem] font-medium leading-snug text-foreground", className), ...props });
1728
+ };
1658
1729
  return {
1659
1730
  h1: heading("h1"),
1660
1731
  h2: heading("h2"),
@@ -1663,11 +1734,15 @@ function createMdxComponents({ mermaid } = {}) {
1663
1734
  p: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("p", { className: cn("my-4 text-[1rem] leading-[1.75] text-muted-foreground md:text-[1.0625rem]", className), ...props }),
1664
1735
  a: A,
1665
1736
  strong: (props) => /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "font-medium text-foreground", ...props }),
1737
+ h5: minor("h5"),
1738
+ h6: minor("h6"),
1666
1739
  ul: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1667
1740
  "ul",
1668
1741
  {
1669
1742
  className: cn(
1670
1743
  "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]",
1744
+ // A GitHub task list: the box replaces the bullet.
1745
+ className?.includes("contains-task-list") && "list-none pl-0",
1671
1746
  className
1672
1747
  ),
1673
1748
  ...props
@@ -1683,7 +1758,26 @@ function createMdxComponents({ mermaid } = {}) {
1683
1758
  ...props
1684
1759
  }
1685
1760
  ),
1686
- li: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx("li", { className: cn("pl-1 [&>p]:my-1 [&>ul]:my-1.5 [&>ol]:my-1.5", className), ...props }),
1761
+ li: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1762
+ "li",
1763
+ {
1764
+ className: cn(
1765
+ "pl-1 [&>p]:my-1 [&>ul]:my-1.5 [&>ol]:my-1.5",
1766
+ // A wrapped task starts under its text, not under the box.
1767
+ className?.includes("task-list-item") && "pl-6 -indent-6",
1768
+ className
1769
+ ),
1770
+ ...props
1771
+ }
1772
+ ),
1773
+ input: (props) => props.type === "checkbox" ? /* @__PURE__ */ jsxRuntime.jsx(
1774
+ "input",
1775
+ {
1776
+ ...props,
1777
+ className: cn("mr-2 size-4 translate-y-[2px] align-baseline accent-foreground", props.className),
1778
+ "aria-label": props.checked ? "Done" : "To do"
1779
+ }
1780
+ ) : /* @__PURE__ */ jsxRuntime.jsx("input", { ...props }),
1687
1781
  blockquote: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Callout, { children }),
1688
1782
  hr: () => /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "my-10 border-border" }),
1689
1783
  table: MdxTable,