@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.
- package/dist/chrome.d.mts +11 -5
- package/dist/chrome.d.ts +11 -5
- package/dist/chrome.js +985 -952
- package/dist/chrome.js.map +1 -1
- package/dist/chrome.mjs +986 -954
- package/dist/chrome.mjs.map +1 -1
- package/dist/code.js +3 -1
- package/dist/code.js.map +1 -1
- package/dist/code.mjs +3 -1
- package/dist/code.mjs.map +1 -1
- package/dist/components.d.mts +7 -5
- package/dist/components.d.ts +7 -5
- package/dist/components.js +697 -617
- package/dist/components.js.map +1 -1
- package/dist/components.mjs +697 -617
- package/dist/components.mjs.map +1 -1
- package/dist/{docs-Dxg4Tp_q.d.ts → docs-ByUx4t-D.d.ts} +19 -4
- package/dist/{docs-wJBfLS08.d.mts → docs-CFE5mU_6.d.mts} +19 -4
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1665 -1519
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1665 -1520
- package/dist/index.mjs.map +1 -1
- package/dist/mdx.d.mts +6 -2
- package/dist/mdx.d.ts +6 -2
- package/dist/mdx.js +175 -76
- package/dist/mdx.js.map +1 -1
- package/dist/mdx.mjs +176 -77
- package/dist/mdx.mjs.map +1 -1
- package/dist/primitives.d.mts +3 -3
- package/dist/primitives.d.ts +3 -3
- package/dist/primitives.js +10 -1
- package/dist/primitives.js.map +1 -1
- package/dist/primitives.mjs +10 -1
- package/dist/primitives.mjs.map +1 -1
- package/dist/session.d.mts +2 -2
- package/dist/session.d.ts +2 -2
- package/dist/session.js +1 -1
- package/dist/session.js.map +1 -1
- package/dist/session.mjs +1 -1
- package/dist/session.mjs.map +1 -1
- package/dist/styles/swagger.css +252 -0
- package/dist/styles/tokens.css +2 -0
- package/dist/{tool-shell-zncroOEQ.d.mts → tool-shell-D8Q8XX11.d.mts} +3 -2
- package/dist/{tool-shell-Be4Q0cNN.d.ts → tool-shell-gmlj47Ie.d.ts} +3 -2
- package/package.json +3 -2
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';
|
|
@@ -7,8 +7,10 @@ import { ArrowUpRight, ArrowRight, Check, Copy } from 'lucide-react';
|
|
|
7
7
|
import { Slot } from '@radix-ui/react-slot';
|
|
8
8
|
import { cva } from 'class-variance-authority';
|
|
9
9
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
10
|
+
import 'next-themes';
|
|
10
11
|
import 'sonner';
|
|
11
12
|
import Link from 'next/link';
|
|
13
|
+
import { useRouter } from 'next/compat/router';
|
|
12
14
|
|
|
13
15
|
// src/code/highlight.ts
|
|
14
16
|
var TOKEN_CLASS = {
|
|
@@ -541,6 +543,11 @@ function ScrollFade({ fade = "var(--card)", className, innerClassName, children,
|
|
|
541
543
|
)
|
|
542
544
|
] });
|
|
543
545
|
}
|
|
546
|
+
function sharedContext(name, initial) {
|
|
547
|
+
const key = /* @__PURE__ */ Symbol.for(`@orangecheck/app-design/${name}`);
|
|
548
|
+
const store = globalThis;
|
|
549
|
+
return store[key] ?? (store[key] = createContext(initial));
|
|
550
|
+
}
|
|
544
551
|
function Spinner({ className, label }) {
|
|
545
552
|
return /* @__PURE__ */ jsxs(
|
|
546
553
|
"svg",
|
|
@@ -784,11 +791,13 @@ function forClipboard(text, lang) {
|
|
|
784
791
|
if (!lines.some((l) => l.startsWith("$ "))) return text;
|
|
785
792
|
return lines.filter((l) => l.startsWith("$ ")).map((l) => l.slice(2)).join("\n");
|
|
786
793
|
}
|
|
787
|
-
function linesFromDom(pre) {
|
|
794
|
+
function linesFromDom(pre, newline) {
|
|
788
795
|
if (!pre) return null;
|
|
789
796
|
const lines = pre.querySelectorAll("[data-line]");
|
|
790
797
|
if (lines.length === 0) return pre.textContent ?? "";
|
|
791
|
-
|
|
798
|
+
const text = Array.from(lines).filter((l) => l.getAttribute("data-diff") !== "remove").map((l) => l.textContent ?? "").join("\n");
|
|
799
|
+
return newline ? `${text}
|
|
800
|
+
` : text;
|
|
792
801
|
}
|
|
793
802
|
function prepare(code, lang, marks, diff) {
|
|
794
803
|
const d = diff ? readDiff(code) : null;
|
|
@@ -797,7 +806,8 @@ function prepare(code, lang, marks, diff) {
|
|
|
797
806
|
const kept = d ? src.split("\n").filter((_, i) => d.diff.get(i + 1) !== "remove") : null;
|
|
798
807
|
return {
|
|
799
808
|
html: linesToHtml(lines, { highlight: parseLineRanges(marks), diff: d?.diff }),
|
|
800
|
-
|
|
809
|
+
// Byte for byte, the final newline too: a hash printed beside the code must match a copy of it.
|
|
810
|
+
copy: kept ? kept.join("\n") + (/\n$/.test(code) ? "\n" : "") : code,
|
|
801
811
|
lines: lines.length,
|
|
802
812
|
diff: !!d
|
|
803
813
|
};
|
|
@@ -810,7 +820,8 @@ function Well({
|
|
|
810
820
|
lines,
|
|
811
821
|
maxLines,
|
|
812
822
|
diff,
|
|
813
|
-
lineNumbers
|
|
823
|
+
lineNumbers,
|
|
824
|
+
wrap
|
|
814
825
|
}) {
|
|
815
826
|
const foldable = maxLines !== void 0 && lines > maxLines + 2;
|
|
816
827
|
const [open, setOpen] = useState(false);
|
|
@@ -829,7 +840,8 @@ function Well({
|
|
|
829
840
|
"data-diff": diff ? "" : void 0,
|
|
830
841
|
"data-line-numbers": lineNumbers ? "" : void 0,
|
|
831
842
|
className: cn(
|
|
832
|
-
"oca-code
|
|
843
|
+
"oca-code py-4 font-mono text-[0.875rem] leading-[1.625] text-oca-ink-muted [font-variant-ligatures:none]",
|
|
844
|
+
wrap ? "whitespace-pre-wrap break-all" : "w-max min-w-full",
|
|
833
845
|
!lined && "px-5"
|
|
834
846
|
),
|
|
835
847
|
children: lined ? /* @__PURE__ */ jsx("code", { className: "block", "data-lang": lang, dangerouslySetInnerHTML: { __html: html } }) : /* @__PURE__ */ jsx("code", { className: "block", "data-lang": lang, children })
|
|
@@ -862,6 +874,7 @@ function CodeBlock({
|
|
|
862
874
|
code,
|
|
863
875
|
html,
|
|
864
876
|
children,
|
|
877
|
+
trailingNewline = false,
|
|
865
878
|
lang,
|
|
866
879
|
caption,
|
|
867
880
|
copy = true,
|
|
@@ -870,6 +883,7 @@ function CodeBlock({
|
|
|
870
883
|
highlight: marks,
|
|
871
884
|
diff,
|
|
872
885
|
lineNumbers,
|
|
886
|
+
wrap,
|
|
873
887
|
actions,
|
|
874
888
|
className
|
|
875
889
|
}) {
|
|
@@ -882,7 +896,7 @@ function CodeBlock({
|
|
|
882
896
|
);
|
|
883
897
|
const markup = prepared?.html ?? html;
|
|
884
898
|
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);
|
|
899
|
+
const read = () => forClipboard(prepared?.copy ?? linesFromDom(preRef.current, trailingNewline) ?? code ?? "", lang);
|
|
886
900
|
return /* @__PURE__ */ jsxs("figure", { className: cn(FRAME, className), children: [
|
|
887
901
|
/* @__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
902
|
/* @__PURE__ */ jsx("span", { className: "truncate text-[0.8125rem] text-oca-ink-subtle", children: caption ?? languageName(lang) ?? "Code" }),
|
|
@@ -901,6 +915,7 @@ function CodeBlock({
|
|
|
901
915
|
maxLines,
|
|
902
916
|
diff: prepared ? prepared.diff : isDiff,
|
|
903
917
|
lineNumbers,
|
|
918
|
+
wrap,
|
|
904
919
|
children
|
|
905
920
|
}
|
|
906
921
|
)
|
|
@@ -1154,6 +1169,7 @@ function MdxTable({ className, ...props }) {
|
|
|
1154
1169
|
}
|
|
1155
1170
|
) }) });
|
|
1156
1171
|
}
|
|
1172
|
+
var said = (n) => n !== void 0 && n !== null && n !== false && n !== "";
|
|
1157
1173
|
function ApiTable({
|
|
1158
1174
|
rows,
|
|
1159
1175
|
caption,
|
|
@@ -1161,43 +1177,42 @@ function ApiTable({
|
|
|
1161
1177
|
className
|
|
1162
1178
|
}) {
|
|
1163
1179
|
const hasDefault = rows.some((r) => r.default !== void 0);
|
|
1164
|
-
const
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
/* @__PURE__ */ jsx("
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
] });
|
|
1180
|
+
const hasDescription = rows.some((r) => said(r.description));
|
|
1181
|
+
const hasSource = rows.some((r) => said(r.source));
|
|
1182
|
+
const cell = "px-4 py-3 max-sm:p-0";
|
|
1183
|
+
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: [
|
|
1184
|
+
caption ? /* @__PURE__ */ jsx("caption", { className: "sr-only", children: caption }) : null,
|
|
1185
|
+
/* @__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: [
|
|
1186
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: nameHeader }),
|
|
1187
|
+
/* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Type" }),
|
|
1188
|
+
hasDefault ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Default" }) : null,
|
|
1189
|
+
hasDescription ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Description" }) : null,
|
|
1190
|
+
hasSource ? /* @__PURE__ */ jsx("th", { scope: "col", className: "px-4 py-2.5 font-medium", children: "Defined in" }) : null
|
|
1191
|
+
] }) }),
|
|
1192
|
+
/* @__PURE__ */ jsx("tbody", { className: "divide-y divide-border max-sm:block", children: rows.map((r) => /* @__PURE__ */ jsxs(
|
|
1193
|
+
"tr",
|
|
1194
|
+
{
|
|
1195
|
+
id: r.id,
|
|
1196
|
+
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",
|
|
1197
|
+
children: [
|
|
1198
|
+
/* @__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: [
|
|
1199
|
+
/* @__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 }),
|
|
1200
|
+
r.required ? /* @__PURE__ */ jsx("span", { className: "text-[0.75rem] text-oca-accent-ink", children: "Required" }) : null,
|
|
1201
|
+
r.deprecated ? /* @__PURE__ */ jsx(Badge, { tone: "muted", children: "Deprecated" }) : null,
|
|
1202
|
+
r.status ? /* @__PURE__ */ jsx(StatusBadge, { status: r.status }) : null
|
|
1203
|
+
] }) }),
|
|
1204
|
+
/* @__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" }),
|
|
1205
|
+
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: [
|
|
1206
|
+
/* @__PURE__ */ jsx("span", { className: "font-sans sm:hidden", children: "Default " }),
|
|
1207
|
+
r.default ?? "\u2014"
|
|
1208
|
+
] }) : null,
|
|
1209
|
+
hasDescription ? /* @__PURE__ */ jsx("td", { className: cn(cell, "leading-relaxed text-muted-foreground", !said(r.description) && "max-sm:hidden"), children: r.description }) : null,
|
|
1210
|
+
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
|
|
1211
|
+
]
|
|
1212
|
+
},
|
|
1213
|
+
r.id ?? r.name
|
|
1214
|
+
)) })
|
|
1215
|
+
] }) }) });
|
|
1201
1216
|
}
|
|
1202
1217
|
function useDarkMode() {
|
|
1203
1218
|
const [dark, setDark] = useState(false);
|
|
@@ -1259,17 +1274,35 @@ function mermaidTheme(el) {
|
|
|
1259
1274
|
sequenceNumberColor: card
|
|
1260
1275
|
};
|
|
1261
1276
|
}
|
|
1277
|
+
var FIT = 4 / 3;
|
|
1262
1278
|
function naturalSize(svg) {
|
|
1263
1279
|
const w = svg.match(/viewBox="[\d.-]+ [\d.-]+ ([\d.]+) [\d.]+"/)?.[1];
|
|
1264
|
-
if (!w) return svg;
|
|
1265
|
-
|
|
1280
|
+
if (!w) return { svg, width: null };
|
|
1281
|
+
const width = Math.ceil(Number(w));
|
|
1282
|
+
return {
|
|
1283
|
+
svg: svg.replace(/<svg([^>]*?)\swidth="100%"/, `<svg$1 width="${width}"`).replace(/max-width:\s*[\d.]+px;?/, ""),
|
|
1284
|
+
width
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
function useInnerWidth(ref, padding) {
|
|
1288
|
+
const [width, setWidth] = useState(null);
|
|
1289
|
+
useEffect(() => {
|
|
1290
|
+
const el = ref.current;
|
|
1291
|
+
if (!el) return;
|
|
1292
|
+
const ro = new ResizeObserver(() => setWidth(el.clientWidth - padding));
|
|
1293
|
+
ro.observe(el);
|
|
1294
|
+
return () => ro.disconnect();
|
|
1295
|
+
}, [ref, padding]);
|
|
1296
|
+
return width;
|
|
1266
1297
|
}
|
|
1267
1298
|
function Diagram({ chart, caption, load, className }) {
|
|
1268
1299
|
const ref = useRef(null);
|
|
1269
1300
|
const dark = useDarkMode();
|
|
1270
1301
|
const raw = useId();
|
|
1271
|
-
const [
|
|
1302
|
+
const [drawn, setDrawn] = useState(null);
|
|
1272
1303
|
const [failed, setFailed] = useState(false);
|
|
1304
|
+
const room = useInnerWidth(ref, 48);
|
|
1305
|
+
const fits = drawn?.width != null && room != null && drawn.width <= room * FIT;
|
|
1273
1306
|
useEffect(() => {
|
|
1274
1307
|
let live = true;
|
|
1275
1308
|
const el = ref.current;
|
|
@@ -1279,9 +1312,9 @@ function Diagram({ chart, caption, load, className }) {
|
|
|
1279
1312
|
const mod = await load();
|
|
1280
1313
|
const mermaid = "default" in mod ? mod.default : mod;
|
|
1281
1314
|
mermaid.initialize({ startOnLoad: false, securityLevel: "strict", theme: "base", themeVariables: mermaidTheme(el) });
|
|
1282
|
-
const { svg
|
|
1315
|
+
const { svg } = await mermaid.render(`oca-diagram-${raw.replace(/[^a-zA-Z0-9]/g, "")}-${dark ? "d" : "l"}`, chart);
|
|
1283
1316
|
if (live) {
|
|
1284
|
-
|
|
1317
|
+
setDrawn(naturalSize(svg));
|
|
1285
1318
|
setFailed(false);
|
|
1286
1319
|
}
|
|
1287
1320
|
} catch {
|
|
@@ -1294,13 +1327,17 @@ function Diagram({ chart, caption, load, className }) {
|
|
|
1294
1327
|
}, [chart, dark, load, raw]);
|
|
1295
1328
|
if (failed) return /* @__PURE__ */ jsx(CodeBlock, { code: chart, caption: "Diagram (shown as its source)", className: cn("my-6", className) });
|
|
1296
1329
|
return /* @__PURE__ */ jsxs("figure", { ref, className: cn("not-prose my-6 overflow-hidden rounded-[1.25rem] border border-border bg-card", className), children: [
|
|
1297
|
-
|
|
1330
|
+
drawn ? /* @__PURE__ */ jsx(ScrollFade, { fade: "var(--card)", children: /* @__PURE__ */ jsx(
|
|
1298
1331
|
"div",
|
|
1299
1332
|
{
|
|
1300
|
-
|
|
1333
|
+
"data-fit": fits ? "" : void 0,
|
|
1334
|
+
className: cn(
|
|
1335
|
+
"flex justify-center p-6 [&_svg]:h-auto",
|
|
1336
|
+
fits ? "w-full [&_svg]:max-w-full" : "w-max min-w-full [&_svg]:max-w-none"
|
|
1337
|
+
),
|
|
1301
1338
|
role: "img",
|
|
1302
1339
|
"aria-label": typeof caption === "string" ? caption : "Diagram",
|
|
1303
|
-
dangerouslySetInnerHTML: { __html: svg }
|
|
1340
|
+
dangerouslySetInnerHTML: { __html: drawn.svg }
|
|
1304
1341
|
}
|
|
1305
1342
|
) }) : /* @__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
1343
|
caption ? /* @__PURE__ */ jsx("figcaption", { className: "border-t border-border px-5 py-3 text-[0.8125rem] text-muted-foreground", children: caption }) : null
|
|
@@ -1470,6 +1507,10 @@ function protocolSite(slug) {
|
|
|
1470
1507
|
{ href: `${OCHK_IO}/trust`, label: "Trust" },
|
|
1471
1508
|
{ href: `${OCHK_IO}/about`, label: "About" }
|
|
1472
1509
|
];
|
|
1510
|
+
var InDocsContext = sharedContext("in-docs", false);
|
|
1511
|
+
function useInDocs() {
|
|
1512
|
+
return useContext(InDocsContext);
|
|
1513
|
+
}
|
|
1473
1514
|
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
1515
|
var STRETCH = 'outline-none after:absolute after:inset-0 after:rounded-[1.25rem] after:content-[""]';
|
|
1475
1516
|
var pad = (n) => String(n + 1).padStart(2, "0");
|
|
@@ -1478,6 +1519,7 @@ function ProtocolGrid({
|
|
|
1478
1519
|
link = "page",
|
|
1479
1520
|
className
|
|
1480
1521
|
}) {
|
|
1522
|
+
const inDocs = useInDocs();
|
|
1481
1523
|
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
1524
|
const p = protocolSite(slug);
|
|
1483
1525
|
const i = PROTOCOL_ORDER.indexOf(slug);
|
|
@@ -1490,7 +1532,7 @@ function ProtocolGrid({
|
|
|
1490
1532
|
] }),
|
|
1491
1533
|
p.status !== "live" ? /* @__PURE__ */ jsx(StatusBadge, { status: p.status }) : null
|
|
1492
1534
|
] }),
|
|
1493
|
-
/* @__PURE__ */ jsx("h3", { className: "oca-display-3", children: /* @__PURE__ */ jsx(
|
|
1535
|
+
/* @__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
1536
|
"a",
|
|
1495
1537
|
{
|
|
1496
1538
|
href: link === "tool" ? p.toolHref : link === "docs" ? `${DOCS_HREF}/${p.slug}` : p.pageHref,
|
|
@@ -1521,14 +1563,61 @@ function ProtocolGrid({
|
|
|
1521
1563
|
] }) }, slug);
|
|
1522
1564
|
}) });
|
|
1523
1565
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1566
|
+
var LINK = "text-foreground underline decoration-foreground/35 underline-offset-4 transition-colors hover:decoration-foreground";
|
|
1567
|
+
var SCHEME = /^[a-z][a-z\d+.-]*:/i;
|
|
1568
|
+
function useResolved(href) {
|
|
1569
|
+
const router = useRouter();
|
|
1570
|
+
if (!router || !href || href.startsWith("/") || href.startsWith("#") || href.startsWith("?") || SCHEME.test(href)) return href;
|
|
1571
|
+
const here = router.asPath.split(/[?#]/)[0] || "/";
|
|
1572
|
+
const url = new URL(href, `https://page.invalid${here}`);
|
|
1573
|
+
return url.pathname + url.search + url.hash;
|
|
1574
|
+
}
|
|
1575
|
+
function TextLink({
|
|
1576
|
+
href: written,
|
|
1577
|
+
children,
|
|
1578
|
+
external,
|
|
1530
1579
|
className
|
|
1531
1580
|
}) {
|
|
1581
|
+
const href = useResolved(written);
|
|
1582
|
+
const internal = href.startsWith("/") && !href.startsWith("/api/") && !href.startsWith("/.well-known/");
|
|
1583
|
+
const offsite = external ?? /^https?:\/\//.test(href);
|
|
1584
|
+
if (internal && !offsite) {
|
|
1585
|
+
return /* @__PURE__ */ jsx(Link, { href, className: cn(LINK, className), children });
|
|
1586
|
+
}
|
|
1587
|
+
return /* @__PURE__ */ jsxs("a", { href, className: cn(LINK, className), ...offsite ? { target: "_blank", rel: "noreferrer" } : {}, children: [
|
|
1588
|
+
children,
|
|
1589
|
+
offsite ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: " (opens in a new tab)" }) : null
|
|
1590
|
+
] });
|
|
1591
|
+
}
|
|
1592
|
+
var SPEC_FILE = {
|
|
1593
|
+
spec: {
|
|
1594
|
+
file: "SPEC.md",
|
|
1595
|
+
title: "Normative source",
|
|
1596
|
+
note: "This page is a human-readable summary. The authoritative copy lives in the spec repo. If the two ever drift, the repo wins."
|
|
1597
|
+
},
|
|
1598
|
+
security: {
|
|
1599
|
+
file: "SECURITY.md",
|
|
1600
|
+
title: "Normative threat model",
|
|
1601
|
+
note: "This page is the short form. The authoritative, numbered threat model lives in the spec repo."
|
|
1602
|
+
},
|
|
1603
|
+
rationale: {
|
|
1604
|
+
file: "WHY.md",
|
|
1605
|
+
title: "Design rationale",
|
|
1606
|
+
note: "This page is the short version. The full rationale and the rejected-design log live in the spec repo."
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
function SpecCard(props) {
|
|
1610
|
+
return props.repo !== void 0 ? /* @__PURE__ */ jsx(SpecFileNote, { ...props }) : /* @__PURE__ */ jsx(ProtocolSpecCard, { ...props });
|
|
1611
|
+
}
|
|
1612
|
+
function SpecFileNote({ repo, file, kind = "spec", version, note, className }) {
|
|
1613
|
+
const d = SPEC_FILE[kind];
|
|
1614
|
+
const f = file ?? d.file;
|
|
1615
|
+
return /* @__PURE__ */ jsxs(Callout, { title: version ? `${d.title} \xB7 ${version}` : d.title, className, children: [
|
|
1616
|
+
/* @__PURE__ */ jsx("p", { children: note ?? d.note }),
|
|
1617
|
+
/* @__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}` }) })
|
|
1618
|
+
] });
|
|
1619
|
+
}
|
|
1620
|
+
function ProtocolSpecCard({ protocol: protocol2, version, license, vectors, size = "md", className }) {
|
|
1532
1621
|
const p = protocolSite(protocol2);
|
|
1533
1622
|
const repo = `oc-${p.slug}-protocol`;
|
|
1534
1623
|
const facts = [
|
|
@@ -1575,23 +1664,6 @@ function SpecCard({
|
|
|
1575
1664
|
] }) }) })
|
|
1576
1665
|
] });
|
|
1577
1666
|
}
|
|
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
1667
|
function createMdxComponents({ mermaid } = {}) {
|
|
1596
1668
|
function Pre(props) {
|
|
1597
1669
|
if (props["data-oca-code"] !== void 0) {
|
|
@@ -1603,6 +1675,7 @@ function createMdxComponents({ mermaid } = {}) {
|
|
|
1603
1675
|
caption: props["data-title"],
|
|
1604
1676
|
diff: props["data-diff"] !== void 0,
|
|
1605
1677
|
lineNumbers: props["data-line-numbers"] !== void 0,
|
|
1678
|
+
trailingNewline: props["data-eol"] !== void 0,
|
|
1606
1679
|
className: "my-6"
|
|
1607
1680
|
}
|
|
1608
1681
|
);
|
|
@@ -1629,6 +1702,9 @@ function createMdxComponents({ mermaid } = {}) {
|
|
|
1629
1702
|
const heading = (as) => function Heading(props) {
|
|
1630
1703
|
return /* @__PURE__ */ jsx(DocsHeading, { as, ...props });
|
|
1631
1704
|
};
|
|
1705
|
+
const minor = (Tag) => function Minor({ className, ...props }) {
|
|
1706
|
+
return /* @__PURE__ */ jsx(Tag, { className: cn("mb-2 mt-6 scroll-mt-28 text-[0.9375rem] font-medium leading-snug text-foreground", className), ...props });
|
|
1707
|
+
};
|
|
1632
1708
|
return {
|
|
1633
1709
|
h1: heading("h1"),
|
|
1634
1710
|
h2: heading("h2"),
|
|
@@ -1637,11 +1713,15 @@ function createMdxComponents({ mermaid } = {}) {
|
|
|
1637
1713
|
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
1714
|
a: A,
|
|
1639
1715
|
strong: (props) => /* @__PURE__ */ jsx("strong", { className: "font-medium text-foreground", ...props }),
|
|
1716
|
+
h5: minor("h5"),
|
|
1717
|
+
h6: minor("h6"),
|
|
1640
1718
|
ul: ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
1641
1719
|
"ul",
|
|
1642
1720
|
{
|
|
1643
1721
|
className: cn(
|
|
1644
1722
|
"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]",
|
|
1723
|
+
// A GitHub task list: the box replaces the bullet.
|
|
1724
|
+
className?.includes("contains-task-list") && "list-none pl-0",
|
|
1645
1725
|
className
|
|
1646
1726
|
),
|
|
1647
1727
|
...props
|
|
@@ -1657,7 +1737,26 @@ function createMdxComponents({ mermaid } = {}) {
|
|
|
1657
1737
|
...props
|
|
1658
1738
|
}
|
|
1659
1739
|
),
|
|
1660
|
-
li: ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
1740
|
+
li: ({ className, ...props }) => /* @__PURE__ */ jsx(
|
|
1741
|
+
"li",
|
|
1742
|
+
{
|
|
1743
|
+
className: cn(
|
|
1744
|
+
"pl-1 [&>p]:my-1 [&>ul]:my-1.5 [&>ol]:my-1.5",
|
|
1745
|
+
// A wrapped task starts under its text, not under the box.
|
|
1746
|
+
className?.includes("task-list-item") && "pl-6 -indent-6",
|
|
1747
|
+
className
|
|
1748
|
+
),
|
|
1749
|
+
...props
|
|
1750
|
+
}
|
|
1751
|
+
),
|
|
1752
|
+
input: (props) => props.type === "checkbox" ? /* @__PURE__ */ jsx(
|
|
1753
|
+
"input",
|
|
1754
|
+
{
|
|
1755
|
+
...props,
|
|
1756
|
+
className: cn("mr-2 size-4 translate-y-[2px] align-baseline accent-foreground", props.className),
|
|
1757
|
+
"aria-label": props.checked ? "Done" : "To do"
|
|
1758
|
+
}
|
|
1759
|
+
) : /* @__PURE__ */ jsx("input", { ...props }),
|
|
1661
1760
|
blockquote: ({ children }) => /* @__PURE__ */ jsx(Callout, { children }),
|
|
1662
1761
|
hr: () => /* @__PURE__ */ jsx("hr", { className: "my-10 border-border" }),
|
|
1663
1762
|
table: MdxTable,
|