@orangecheck/app-design 1.3.0 → 1.4.1

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 +11 -5
  2. package/dist/chrome.d.ts +11 -5
  3. package/dist/chrome.js +985 -952
  4. package/dist/chrome.js.map +1 -1
  5. package/dist/chrome.mjs +986 -954
  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 +7 -5
  12. package/dist/components.d.ts +7 -5
  13. package/dist/components.js +697 -617
  14. package/dist/components.js.map +1 -1
  15. package/dist/components.mjs +697 -617
  16. package/dist/components.mjs.map +1 -1
  17. package/dist/{docs-Dxg4Tp_q.d.ts → docs-ByUx4t-D.d.ts} +19 -4
  18. package/dist/{docs-wJBfLS08.d.mts → docs-CFE5mU_6.d.mts} +19 -4
  19. package/dist/index.d.mts +3 -3
  20. package/dist/index.d.ts +3 -3
  21. package/dist/index.js +1665 -1519
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +1665 -1520
  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 +175 -76
  28. package/dist/mdx.js.map +1 -1
  29. package/dist/mdx.mjs +176 -77
  30. package/dist/mdx.mjs.map +1 -1
  31. package/dist/primitives.d.mts +3 -3
  32. package/dist/primitives.d.ts +3 -3
  33. package/dist/primitives.js +10 -1
  34. package/dist/primitives.js.map +1 -1
  35. package/dist/primitives.mjs +10 -1
  36. package/dist/primitives.mjs.map +1 -1
  37. package/dist/session.d.mts +2 -2
  38. package/dist/session.d.ts +2 -2
  39. package/dist/session.js +1 -1
  40. package/dist/session.js.map +1 -1
  41. package/dist/session.mjs +1 -1
  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-zncroOEQ.d.mts → tool-shell-D8Q8XX11.d.mts} +3 -2
  46. package/dist/{tool-shell-Be4Q0cNN.d.ts → tool-shell-gmlj47Ie.d.ts} +3 -2
  47. package/package.json +3 -2
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-CFE5mU_6.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-ByUx4t-D.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
@@ -9,8 +9,10 @@ var lucideReact = require('lucide-react');
9
9
  var reactSlot = require('@radix-ui/react-slot');
10
10
  var classVarianceAuthority = require('class-variance-authority');
11
11
  var SeparatorPrimitive = require('@radix-ui/react-separator');
12
+ require('next-themes');
12
13
  require('sonner');
13
14
  var Link = require('next/link');
15
+ var router = require('next/compat/router');
14
16
 
15
17
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
16
18
 
@@ -567,6 +569,11 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
567
569
  )
568
570
  ] });
569
571
  }
572
+ function sharedContext(name, initial) {
573
+ const key = /* @__PURE__ */ Symbol.for(`@orangecheck/app-design/${name}`);
574
+ const store = globalThis;
575
+ return store[key] ?? (store[key] = react.createContext(initial));
576
+ }
570
577
  function Spinner({ className, label }) {
571
578
  return /* @__PURE__ */ jsxRuntime.jsxs(
572
579
  "svg",
@@ -810,11 +817,13 @@ function forClipboard(text, lang) {
810
817
  if (!lines.some((l) => l.startsWith("$ "))) return text;
811
818
  return lines.filter((l) => l.startsWith("$ ")).map((l) => l.slice(2)).join("\n");
812
819
  }
813
- function linesFromDom(pre) {
820
+ function linesFromDom(pre, newline) {
814
821
  if (!pre) return null;
815
822
  const lines = pre.querySelectorAll("[data-line]");
816
823
  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");
824
+ const text = Array.from(lines).filter((l) => l.getAttribute("data-diff") !== "remove").map((l) => l.textContent ?? "").join("\n");
825
+ return newline ? `${text}
826
+ ` : text;
818
827
  }
819
828
  function prepare(code, lang, marks, diff) {
820
829
  const d = diff ? readDiff(code) : null;
@@ -823,7 +832,8 @@ function prepare(code, lang, marks, diff) {
823
832
  const kept = d ? src.split("\n").filter((_, i) => d.diff.get(i + 1) !== "remove") : null;
824
833
  return {
825
834
  html: linesToHtml(lines, { highlight: parseLineRanges(marks), diff: d?.diff }),
826
- copy: kept ? kept.join("\n") : src,
835
+ // Byte for byte, the final newline too: a hash printed beside the code must match a copy of it.
836
+ copy: kept ? kept.join("\n") + (/\n$/.test(code) ? "\n" : "") : code,
827
837
  lines: lines.length,
828
838
  diff: !!d
829
839
  };
@@ -836,7 +846,8 @@ function Well({
836
846
  lines,
837
847
  maxLines,
838
848
  diff,
839
- lineNumbers
849
+ lineNumbers,
850
+ wrap
840
851
  }) {
841
852
  const foldable = maxLines !== void 0 && lines > maxLines + 2;
842
853
  const [open, setOpen] = react.useState(false);
@@ -855,7 +866,8 @@ function Well({
855
866
  "data-diff": diff ? "" : void 0,
856
867
  "data-line-numbers": lineNumbers ? "" : void 0,
857
868
  className: cn(
858
- "oca-code w-max min-w-full py-4 font-mono text-[0.875rem] leading-[1.625] text-oca-ink-muted [font-variant-ligatures:none]",
869
+ "oca-code py-4 font-mono text-[0.875rem] leading-[1.625] text-oca-ink-muted [font-variant-ligatures:none]",
870
+ wrap ? "whitespace-pre-wrap break-all" : "w-max min-w-full",
859
871
  !lined && "px-5"
860
872
  ),
861
873
  children: lined ? /* @__PURE__ */ jsxRuntime.jsx("code", { className: "block", "data-lang": lang, dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsxRuntime.jsx("code", { className: "block", "data-lang": lang, children })
@@ -888,6 +900,7 @@ function CodeBlock({
888
900
  code,
889
901
  html,
890
902
  children,
903
+ trailingNewline = false,
891
904
  lang,
892
905
  caption,
893
906
  copy = true,
@@ -896,6 +909,7 @@ function CodeBlock({
896
909
  highlight: marks,
897
910
  diff,
898
911
  lineNumbers,
912
+ wrap,
899
913
  actions,
900
914
  className
901
915
  }) {
@@ -908,7 +922,7 @@ function CodeBlock({
908
922
  );
909
923
  const markup = prepared?.html ?? html;
910
924
  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);
925
+ const read = () => forClipboard(prepared?.copy ?? linesFromDom(preRef.current, trailingNewline) ?? code ?? "", lang);
912
926
  return /* @__PURE__ */ jsxRuntime.jsxs("figure", { className: cn(FRAME, className), children: [
913
927
  /* @__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
928
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate text-[0.8125rem] text-oca-ink-subtle", children: caption ?? languageName(lang) ?? "Code" }),
@@ -927,6 +941,7 @@ function CodeBlock({
927
941
  maxLines,
928
942
  diff: prepared ? prepared.diff : isDiff,
929
943
  lineNumbers,
944
+ wrap,
930
945
  children
931
946
  }
932
947
  )
@@ -1180,6 +1195,7 @@ function MdxTable({ className, ...props }) {
1180
1195
  }
1181
1196
  ) }) });
1182
1197
  }
1198
+ var said = (n) => n !== void 0 && n !== null && n !== false && n !== "";
1183
1199
  function ApiTable({
1184
1200
  rows,
1185
1201
  caption,
@@ -1187,43 +1203,42 @@ function ApiTable({
1187
1203
  className
1188
1204
  }) {
1189
1205
  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
- ] });
1206
+ const hasDescription = rows.some((r) => said(r.description));
1207
+ const hasSource = rows.some((r) => said(r.source));
1208
+ const cell = "px-4 py-3 max-sm:p-0";
1209
+ 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: [
1210
+ caption ? /* @__PURE__ */ jsxRuntime.jsx("caption", { className: "sr-only", children: caption }) : null,
1211
+ /* @__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: [
1212
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: nameHeader }),
1213
+ /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Type" }),
1214
+ hasDefault ? /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Default" }) : null,
1215
+ hasDescription ? /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Description" }) : null,
1216
+ hasSource ? /* @__PURE__ */ jsxRuntime.jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Defined in" }) : null
1217
+ ] }) }),
1218
+ /* @__PURE__ */ jsxRuntime.jsx("tbody", { className: "divide-y divide-border max-sm:block", children: rows.map((r) => /* @__PURE__ */ jsxRuntime.jsxs(
1219
+ "tr",
1220
+ {
1221
+ id: r.id,
1222
+ 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",
1223
+ children: [
1224
+ /* @__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: [
1225
+ /* @__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 }),
1226
+ r.required ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-[0.75rem] text-oca-accent-ink", children: "Required" }) : null,
1227
+ r.deprecated ? /* @__PURE__ */ jsxRuntime.jsx(Badge, { tone: "muted", children: "Deprecated" }) : null,
1228
+ r.status ? /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: r.status }) : null
1229
+ ] }) }),
1230
+ /* @__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" }),
1231
+ 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: [
1232
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "font-sans sm:hidden", children: "Default " }),
1233
+ r.default ?? "\u2014"
1234
+ ] }) : null,
1235
+ hasDescription ? /* @__PURE__ */ jsxRuntime.jsx("td", { className: cn(cell, "leading-relaxed text-muted-foreground", !said(r.description) && "max-sm:hidden"), children: r.description }) : null,
1236
+ 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
1237
+ ]
1238
+ },
1239
+ r.id ?? r.name
1240
+ )) })
1241
+ ] }) }) });
1227
1242
  }
1228
1243
  function useDarkMode() {
1229
1244
  const [dark, setDark] = react.useState(false);
@@ -1285,17 +1300,35 @@ function mermaidTheme(el) {
1285
1300
  sequenceNumberColor: card
1286
1301
  };
1287
1302
  }
1303
+ var FIT = 4 / 3;
1288
1304
  function naturalSize(svg) {
1289
1305
  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;?/, "");
1306
+ if (!w) return { svg, width: null };
1307
+ const width = Math.ceil(Number(w));
1308
+ return {
1309
+ svg: svg.replace(/<svg([^>]*?)\swidth="100%"/, `<svg$1 width="${width}"`).replace(/max-width:\s*[\d.]+px;?/, ""),
1310
+ width
1311
+ };
1312
+ }
1313
+ function useInnerWidth(ref, padding) {
1314
+ const [width, setWidth] = react.useState(null);
1315
+ react.useEffect(() => {
1316
+ const el = ref.current;
1317
+ if (!el) return;
1318
+ const ro = new ResizeObserver(() => setWidth(el.clientWidth - padding));
1319
+ ro.observe(el);
1320
+ return () => ro.disconnect();
1321
+ }, [ref, padding]);
1322
+ return width;
1292
1323
  }
1293
1324
  function Diagram({ chart, caption, load, className }) {
1294
1325
  const ref = react.useRef(null);
1295
1326
  const dark = useDarkMode();
1296
1327
  const raw = react.useId();
1297
- const [svg, setSvg] = react.useState(null);
1328
+ const [drawn, setDrawn] = react.useState(null);
1298
1329
  const [failed, setFailed] = react.useState(false);
1330
+ const room = useInnerWidth(ref, 48);
1331
+ const fits = drawn?.width != null && room != null && drawn.width <= room * FIT;
1299
1332
  react.useEffect(() => {
1300
1333
  let live = true;
1301
1334
  const el = ref.current;
@@ -1305,9 +1338,9 @@ function Diagram({ chart, caption, load, className }) {
1305
1338
  const mod = await load();
1306
1339
  const mermaid = "default" in mod ? mod.default : mod;
1307
1340
  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);
1341
+ const { svg } = await mermaid.render(`oca-diagram-${raw.replace(/[^a-zA-Z0-9]/g, "")}-${dark ? "d" : "l"}`, chart);
1309
1342
  if (live) {
1310
- setSvg(naturalSize(drawn));
1343
+ setDrawn(naturalSize(svg));
1311
1344
  setFailed(false);
1312
1345
  }
1313
1346
  } catch {
@@ -1320,13 +1353,17 @@ function Diagram({ chart, caption, load, className }) {
1320
1353
  }, [chart, dark, load, raw]);
1321
1354
  if (failed) return /* @__PURE__ */ jsxRuntime.jsx(CodeBlock, { code: chart, caption: "Diagram (shown as its source)", className: cn("my-6", className) });
1322
1355
  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(
1356
+ drawn ? /* @__PURE__ */ jsxRuntime.jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsxRuntime.jsx(
1324
1357
  "div",
1325
1358
  {
1326
- className: "flex w-max min-w-full justify-center p-6 [&_svg]:h-auto [&_svg]:max-w-none",
1359
+ "data-fit": fits ? "" : void 0,
1360
+ className: cn(
1361
+ "flex justify-center p-6 [&_svg]:h-auto",
1362
+ fits ? "w-full [&_svg]:max-w-full" : "w-max min-w-full [&_svg]:max-w-none"
1363
+ ),
1327
1364
  role: "img",
1328
1365
  "aria-label": typeof caption === "string" ? caption : "Diagram",
1329
- dangerouslySetInnerHTML: { __html: svg }
1366
+ dangerouslySetInnerHTML: { __html: drawn.svg }
1330
1367
  }
1331
1368
  ) }) : /* @__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
1369
  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 +1533,10 @@ function protocolSite(slug) {
1496
1533
  { href: `${OCHK_IO}/trust`, label: "Trust" },
1497
1534
  { href: `${OCHK_IO}/about`, label: "About" }
1498
1535
  ];
1536
+ var InDocsContext = sharedContext("in-docs", false);
1537
+ function useInDocs() {
1538
+ return react.useContext(InDocsContext);
1539
+ }
1499
1540
  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
1541
  var STRETCH = 'outline-none after:absolute after:inset-0 after:rounded-[1.25rem] after:content-[""]';
1501
1542
  var pad = (n) => String(n + 1).padStart(2, "0");
@@ -1504,6 +1545,7 @@ function ProtocolGrid({
1504
1545
  link = "page",
1505
1546
  className
1506
1547
  }) {
1548
+ const inDocs = useInDocs();
1507
1549
  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
1550
  const p = protocolSite(slug);
1509
1551
  const i = PROTOCOL_ORDER.indexOf(slug);
@@ -1516,7 +1558,7 @@ function ProtocolGrid({
1516
1558
  ] }),
1517
1559
  p.status !== "live" ? /* @__PURE__ */ jsxRuntime.jsx(StatusBadge, { status: p.status }) : null
1518
1560
  ] }),
1519
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "oca-display-3", children: /* @__PURE__ */ jsxRuntime.jsx(
1561
+ /* @__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
1562
  "a",
1521
1563
  {
1522
1564
  href: link === "tool" ? p.toolHref : link === "docs" ? `${DOCS_HREF}/${p.slug}` : p.pageHref,
@@ -1547,14 +1589,61 @@ function ProtocolGrid({
1547
1589
  ] }) }, slug);
1548
1590
  }) });
1549
1591
  }
1550
- function SpecCard({
1551
- protocol: protocol2,
1552
- version,
1553
- license,
1554
- vectors,
1555
- size = "md",
1592
+ var LINK = "text-foreground underline decoration-foreground/35 underline-offset-4 transition-colors hover:decoration-foreground";
1593
+ var SCHEME = /^[a-z][a-z\d+.-]*:/i;
1594
+ function useResolved(href) {
1595
+ const router$1 = router.useRouter();
1596
+ if (!router$1 || !href || href.startsWith("/") || href.startsWith("#") || href.startsWith("?") || SCHEME.test(href)) return href;
1597
+ const here = router$1.asPath.split(/[?#]/)[0] || "/";
1598
+ const url = new URL(href, `https://page.invalid${here}`);
1599
+ return url.pathname + url.search + url.hash;
1600
+ }
1601
+ function TextLink({
1602
+ href: written,
1603
+ children,
1604
+ external,
1556
1605
  className
1557
1606
  }) {
1607
+ const href = useResolved(written);
1608
+ const internal = href.startsWith("/") && !href.startsWith("/api/") && !href.startsWith("/.well-known/");
1609
+ const offsite = external ?? /^https?:\/\//.test(href);
1610
+ if (internal && !offsite) {
1611
+ return /* @__PURE__ */ jsxRuntime.jsx(Link__default.default, { href, className: cn(LINK, className), children });
1612
+ }
1613
+ return /* @__PURE__ */ jsxRuntime.jsxs("a", { href, className: cn(LINK, className), ...offsite ? { target: "_blank", rel: "noreferrer" } : {}, children: [
1614
+ children,
1615
+ offsite ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "sr-only", children: " (opens in a new tab)" }) : null
1616
+ ] });
1617
+ }
1618
+ var SPEC_FILE = {
1619
+ spec: {
1620
+ file: "SPEC.md",
1621
+ title: "Normative source",
1622
+ note: "This page is a human-readable summary. The authoritative copy lives in the spec repo. If the two ever drift, the repo wins."
1623
+ },
1624
+ security: {
1625
+ file: "SECURITY.md",
1626
+ title: "Normative threat model",
1627
+ note: "This page is the short form. The authoritative, numbered threat model lives in the spec repo."
1628
+ },
1629
+ rationale: {
1630
+ file: "WHY.md",
1631
+ title: "Design rationale",
1632
+ note: "This page is the short version. The full rationale and the rejected-design log live in the spec repo."
1633
+ }
1634
+ };
1635
+ function SpecCard(props) {
1636
+ return props.repo !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(SpecFileNote, { ...props }) : /* @__PURE__ */ jsxRuntime.jsx(ProtocolSpecCard, { ...props });
1637
+ }
1638
+ function SpecFileNote({ repo, file, kind = "spec", version, note, className }) {
1639
+ const d = SPEC_FILE[kind];
1640
+ const f = file ?? d.file;
1641
+ return /* @__PURE__ */ jsxRuntime.jsxs(Callout, { title: version ? `${d.title} \xB7 ${version}` : d.title, className, children: [
1642
+ /* @__PURE__ */ jsxRuntime.jsx("p", { children: note ?? d.note }),
1643
+ /* @__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}` }) })
1644
+ ] });
1645
+ }
1646
+ function ProtocolSpecCard({ protocol: protocol2, version, license, vectors, size = "md", className }) {
1558
1647
  const p = protocolSite(protocol2);
1559
1648
  const repo = `oc-${p.slug}-protocol`;
1560
1649
  const facts = [
@@ -1601,23 +1690,6 @@ function SpecCard({
1601
1690
  ] }) }) })
1602
1691
  ] });
1603
1692
  }
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
1693
  function createMdxComponents({ mermaid } = {}) {
1622
1694
  function Pre(props) {
1623
1695
  if (props["data-oca-code"] !== void 0) {
@@ -1629,6 +1701,7 @@ function createMdxComponents({ mermaid } = {}) {
1629
1701
  caption: props["data-title"],
1630
1702
  diff: props["data-diff"] !== void 0,
1631
1703
  lineNumbers: props["data-line-numbers"] !== void 0,
1704
+ trailingNewline: props["data-eol"] !== void 0,
1632
1705
  className: "my-6"
1633
1706
  }
1634
1707
  );
@@ -1655,6 +1728,9 @@ function createMdxComponents({ mermaid } = {}) {
1655
1728
  const heading = (as) => function Heading(props) {
1656
1729
  return /* @__PURE__ */ jsxRuntime.jsx(DocsHeading, { as, ...props });
1657
1730
  };
1731
+ const minor = (Tag) => function Minor({ className, ...props }) {
1732
+ 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 });
1733
+ };
1658
1734
  return {
1659
1735
  h1: heading("h1"),
1660
1736
  h2: heading("h2"),
@@ -1663,11 +1739,15 @@ function createMdxComponents({ mermaid } = {}) {
1663
1739
  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
1740
  a: A,
1665
1741
  strong: (props) => /* @__PURE__ */ jsxRuntime.jsx("strong", { className: "font-medium text-foreground", ...props }),
1742
+ h5: minor("h5"),
1743
+ h6: minor("h6"),
1666
1744
  ul: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1667
1745
  "ul",
1668
1746
  {
1669
1747
  className: cn(
1670
1748
  "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]",
1749
+ // A GitHub task list: the box replaces the bullet.
1750
+ className?.includes("contains-task-list") && "list-none pl-0",
1671
1751
  className
1672
1752
  ),
1673
1753
  ...props
@@ -1683,7 +1763,26 @@ function createMdxComponents({ mermaid } = {}) {
1683
1763
  ...props
1684
1764
  }
1685
1765
  ),
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 }),
1766
+ li: ({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
1767
+ "li",
1768
+ {
1769
+ className: cn(
1770
+ "pl-1 [&>p]:my-1 [&>ul]:my-1.5 [&>ol]:my-1.5",
1771
+ // A wrapped task starts under its text, not under the box.
1772
+ className?.includes("task-list-item") && "pl-6 -indent-6",
1773
+ className
1774
+ ),
1775
+ ...props
1776
+ }
1777
+ ),
1778
+ input: (props) => props.type === "checkbox" ? /* @__PURE__ */ jsxRuntime.jsx(
1779
+ "input",
1780
+ {
1781
+ ...props,
1782
+ className: cn("mr-2 size-4 translate-y-[2px] align-baseline accent-foreground", props.className),
1783
+ "aria-label": props.checked ? "Done" : "To do"
1784
+ }
1785
+ ) : /* @__PURE__ */ jsxRuntime.jsx("input", { ...props }),
1687
1786
  blockquote: ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(Callout, { children }),
1688
1787
  hr: () => /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "my-10 border-border" }),
1689
1788
  table: MdxTable,