@contentbit/studio 1.0.0-rc.2 → 2.0.0-next.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 (66) hide show
  1. package/README.md +19 -9
  2. package/dist/client/assets/api-aCc2x-IO.js +1 -0
  3. package/dist/client/assets/arrow-right-tp4VknZo.js +1 -0
  4. package/dist/client/assets/document-DIh3ZPXr.js +56 -0
  5. package/dist/client/assets/documents-CjBZYbQ4.js +1 -0
  6. package/dist/client/assets/file-code-corner-Fzc5liO9.js +1 -0
  7. package/dist/client/assets/file-text-B8O46COn.js +1 -0
  8. package/dist/client/assets/index-Cd04OFZT.js +11 -0
  9. package/dist/client/assets/page-BMU8eIrR.js +1 -0
  10. package/dist/client/assets/routes-WndCJoku.js +1 -0
  11. package/dist/client/assets/search-BnUPH8AI.js +1 -0
  12. package/dist/client/assets/styles-hAsz_paS.css +2 -0
  13. package/dist/client/assets/target-BMSXP2fU.js +1 -0
  14. package/dist/client/assets/templates-IJid1Zwh.js +1 -0
  15. package/dist/server/api.d.ts.map +1 -1
  16. package/dist/server/assets/_tanstack-start-manifest_v-WfZ3uz_l.js +69 -0
  17. package/dist/server/assets/api-CHfynRIj.js +342 -0
  18. package/dist/server/assets/{document-DSV89Ser.js → document-BjPXZ9gS.js} +2529 -1317
  19. package/dist/server/assets/{routes-FGdym0e5.js → documents-jT4KnSkA.js} +63 -112
  20. package/dist/server/assets/empty-plugin-adapters-Ctp1ZmyT.js +4 -0
  21. package/dist/server/assets/page--xw7NmtK.js +388 -0
  22. package/dist/server/assets/router-xI8HUWRI.js +125 -0
  23. package/dist/server/assets/routes-CfwU-Ww2.js +372 -0
  24. package/dist/server/assets/start-Dk-BJfGT.js +3 -0
  25. package/dist/server/assets/templates--9wK-MK9.js +123 -0
  26. package/dist/server/index.d.ts +2 -2
  27. package/dist/server/index.d.ts.map +1 -1
  28. package/dist/server/index.js +6104 -110
  29. package/dist/server/scan.d.ts +1 -2
  30. package/dist/server/scan.d.ts.map +1 -1
  31. package/dist/server/server.js +3150 -1878
  32. package/dist/server/site.d.ts +38 -0
  33. package/dist/server/site.d.ts.map +1 -0
  34. package/dist/server/types.d.ts +33 -31
  35. package/dist/server/types.d.ts.map +1 -1
  36. package/package.json +26 -15
  37. package/src/components/studio.test.ts +10 -0
  38. package/src/components/studio.tsx +209 -0
  39. package/src/lib/api.test.ts +80 -0
  40. package/src/lib/api.ts +68 -7
  41. package/src/routeTree.gen.ts +57 -3
  42. package/src/routes/document.tsx +34 -88
  43. package/src/routes/documents.tsx +433 -0
  44. package/src/routes/index.tsx +295 -414
  45. package/src/routes/page.tsx +401 -0
  46. package/src/routes/templates.tsx +104 -0
  47. package/src/server/api.ts +19 -3
  48. package/src/server/index.ts +31 -12
  49. package/src/server/scan.test.ts +31 -44
  50. package/src/server/scan.ts +56 -82
  51. package/src/server/site.test.ts +355 -0
  52. package/src/server/site.ts +164 -0
  53. package/src/server/types.ts +28 -30
  54. package/tsconfig.json +1 -1
  55. package/dist/client/assets/api-BX-WUPtV.js +0 -1
  56. package/dist/client/assets/document-BOMp4_F5.js +0 -65
  57. package/dist/client/assets/index-C0ybJ4zQ.js +0 -12
  58. package/dist/client/assets/routes-ACKdIhYm.js +0 -1
  59. package/dist/client/assets/styles-DogO4Wcf.css +0 -2
  60. package/dist/server/assets/_tanstack-start-manifest_v-BC1PNuB0.js +0 -25
  61. package/dist/server/assets/api-Bqt_atjc.js +0 -72
  62. package/dist/server/assets/document-BB_UYqNL.js +0 -9
  63. package/dist/server/assets/empty-plugin-adapters-De7E1vAI.js +0 -5
  64. package/dist/server/assets/router-BJiN6b7L.js +0 -63
  65. package/dist/server/assets/routes-p0tk6PAr.js +0 -20
  66. package/dist/server/assets/start-m8EQRpUf.js +0 -4
@@ -1,33 +1,14 @@
1
- import { t as Route } from "./routes-p0tk6PAr.js";
2
- import { i as Button, n as fetchGraph, r as fetchProject } from "./api-Bqt_atjc.js";
3
- import { useEffect, useMemo, useState } from "react";
4
1
  import { Link, useNavigate } from "@tanstack/react-router";
2
+ import { AlertTriangle, ArrowRight, Blocks, ChevronsUpDown, FileText, Filter, RefreshCw, Search, Target } from "lucide-react";
3
+ import { useMemo } from "react";
4
+ import { a as Button, c as FileFindings, p as StudioNav, r as useProject } from "./api-CHfynRIj.js";
5
+ import { i as Route } from "./router-xI8HUWRI.js";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
- import { AlertTriangle, ArrowRight, Blocks, ChevronsUpDown, FileText, Filter, Link2, RefreshCw, Search, Target } from "lucide-react";
7
- //#region src/routes/index.tsx?tsr-split=component
7
+ // src/routes/documents.tsx?tsr-split=component
8
8
  function Dashboard() {
9
9
  const search = Route.useSearch();
10
- const navigate = useNavigate({ from: "/" });
11
- const [project, setProject] = useState(null);
12
- const [graph, setGraph] = useState(null);
13
- const [error, setError] = useState(null);
14
- const [refreshing, setRefreshing] = useState(false);
15
- async function refresh() {
16
- setRefreshing(true);
17
- setError(null);
18
- try {
19
- const [project, graph] = await Promise.all([fetchProject(), fetchGraph()]);
20
- setProject(project);
21
- setGraph(graph);
22
- } catch (err) {
23
- setError(err instanceof Error ? err.message : String(err));
24
- } finally {
25
- setRefreshing(false);
26
- }
27
- }
28
- useEffect(() => {
29
- refresh();
30
- }, []);
10
+ const navigate = useNavigate({ from: "/documents" });
11
+ const { data: project, error, refreshing, refresh } = useProject();
31
12
  const files = useMemo(() => {
32
13
  if (!project) return [];
33
14
  const query = search.q.toLowerCase().trim();
@@ -43,7 +24,7 @@ function Dashboard() {
43
24
  ...file.keywords?.lsi ?? []
44
25
  ].filter(Boolean).join(" ").toLowerCase();
45
26
  return (search.status === "all" || file.status === search.status) && haystack.includes(query);
46
- }).sort((a, b) => compareFiles(a, b, search.sort, search.dir));
27
+ }).toSorted((a, b) => compareFiles(a, b, search.sort, search.dir));
47
28
  }, [
48
29
  project,
49
30
  search.dir,
@@ -53,7 +34,7 @@ function Dashboard() {
53
34
  ]);
54
35
  function setSearch(next) {
55
36
  navigate({
56
- to: "/",
37
+ to: "/documents",
57
38
  search: (prev) => ({
58
39
  ...prev,
59
40
  ...next
@@ -72,53 +53,52 @@ function Dashboard() {
72
53
  className: "border-b bg-muted/30",
73
54
  children: /* @__PURE__ */ jsxs("div", {
74
55
  className: "mx-auto flex max-w-7xl flex-col gap-6 px-5 py-6",
75
- children: [/* @__PURE__ */ jsxs("div", {
76
- className: "flex flex-col gap-4 md:flex-row md:items-end md:justify-between",
77
- children: [/* @__PURE__ */ jsxs("div", { children: [
78
- /* @__PURE__ */ jsx("p", {
79
- className: "font-mono text-xs uppercase text-muted-foreground",
80
- children: "contentbit studio"
81
- }),
82
- /* @__PURE__ */ jsx("h1", {
83
- className: "mt-1 text-3xl font-semibold tracking-tight",
84
- children: "Content dashboard"
85
- }),
86
- /* @__PURE__ */ jsx("p", {
87
- className: "mt-2 max-w-2xl text-sm text-muted-foreground",
88
- children: "Read-only view of content health, structure, links, keywords, and previews."
89
- })
90
- ] }), /* @__PURE__ */ jsxs(Button, {
91
- onClick: refresh,
92
- disabled: refreshing,
93
- className: "w-fit gap-2",
94
- children: [/* @__PURE__ */ jsx(RefreshCw, { className: refreshing ? "size-4 animate-spin" : "size-4" }), "Refresh"]
95
- })]
96
- }), project && /* @__PURE__ */ jsxs("div", {
97
- className: "grid gap-px overflow-hidden rounded-sm border bg-border md:grid-cols-4",
98
- children: [
99
- /* @__PURE__ */ jsx(Metric, {
100
- label: "files",
101
- value: project.summary.files,
102
- icon: /* @__PURE__ */ jsx(FileText, { className: "size-4" })
103
- }),
104
- /* @__PURE__ */ jsx(Metric, {
105
- label: "findings",
106
- value: project.summary.errors + project.summary.warnings + project.summary.suggestions,
107
- icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }),
108
- tone: project.summary.errors > 0 ? "bad" : project.summary.warnings > 0 ? "warn" : "ok"
109
- }),
110
- /* @__PURE__ */ jsx(Metric, {
111
- label: "blocks",
112
- value: project.summary.blocks,
113
- icon: /* @__PURE__ */ jsx(Blocks, { className: "size-4" })
114
- }),
115
- /* @__PURE__ */ jsx(Metric, {
116
- label: "graph",
117
- value: project.linkGraph ? `${project.linkGraph.pages}/${project.linkGraph.links}` : "off",
118
- icon: /* @__PURE__ */ jsx(Link2, { className: "size-4" })
119
- })
120
- ]
121
- })]
56
+ children: [
57
+ /* @__PURE__ */ jsx(StudioNav, {}),
58
+ /* @__PURE__ */ jsxs("div", {
59
+ className: "flex flex-col gap-4 md:flex-row md:items-end md:justify-between",
60
+ children: [/* @__PURE__ */ jsxs("div", { children: [
61
+ /* @__PURE__ */ jsx("p", {
62
+ className: "font-mono text-xs uppercase text-muted-foreground",
63
+ children: "contentbit studio"
64
+ }),
65
+ /* @__PURE__ */ jsx("h1", {
66
+ className: "mt-1 text-3xl font-semibold tracking-tight",
67
+ children: "Documents"
68
+ }),
69
+ /* @__PURE__ */ jsx("p", {
70
+ className: "mt-2 max-w-2xl text-sm text-muted-foreground",
71
+ children: "The Markdown files, with their findings, structure, links, keywords and previews."
72
+ })
73
+ ] }), /* @__PURE__ */ jsxs(Button, {
74
+ onClick: refresh,
75
+ disabled: refreshing,
76
+ className: "w-fit gap-2",
77
+ children: [/* @__PURE__ */ jsx(RefreshCw, { className: refreshing ? "size-4 animate-spin" : "size-4" }), "Refresh"]
78
+ })]
79
+ }),
80
+ project && /* @__PURE__ */ jsxs("div", {
81
+ className: "grid gap-px overflow-hidden rounded-sm border bg-border md:grid-cols-3",
82
+ children: [
83
+ /* @__PURE__ */ jsx(Metric, {
84
+ label: "files",
85
+ value: project.summary.files,
86
+ icon: /* @__PURE__ */ jsx(FileText, { className: "size-4" })
87
+ }),
88
+ /* @__PURE__ */ jsx(Metric, {
89
+ label: "findings",
90
+ value: project.summary.errors + project.summary.warnings + project.summary.suggestions,
91
+ icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }),
92
+ tone: project.summary.errors > 0 ? "bad" : project.summary.warnings > 0 ? "warn" : "ok"
93
+ }),
94
+ /* @__PURE__ */ jsx(Metric, {
95
+ label: "blocks",
96
+ value: project.summary.blocks,
97
+ icon: /* @__PURE__ */ jsx(Blocks, { className: "size-4" })
98
+ })
99
+ ]
100
+ })
101
+ ]
122
102
  })
123
103
  }), /* @__PURE__ */ jsxs("section", {
124
104
  className: "mx-auto grid max-w-7xl gap-5 px-5 py-5 lg:grid-cols-[minmax(0,1fr)_320px]",
@@ -182,7 +162,7 @@ function Dashboard() {
182
162
  className: "divide-y",
183
163
  children: [files.map((file) => /* @__PURE__ */ jsx(FileRow, { file }, file.path)), files.length === 0 && /* @__PURE__ */ jsx("div", {
184
164
  className: "p-4 text-sm text-muted-foreground",
185
- children: "No documents match the current filters."
165
+ children: project.files.length === 0 ? "No Markdown files. The built pages are under Pages." : "No documents match the current filters."
186
166
  })]
187
167
  }) : /* @__PURE__ */ jsx("div", {
188
168
  className: "p-4 text-sm text-muted-foreground",
@@ -192,6 +172,13 @@ function Dashboard() {
192
172
  }), /* @__PURE__ */ jsxs("aside", {
193
173
  className: "flex flex-col gap-4",
194
174
  children: [
175
+ project && project.agentGuidanceFindings.length > 0 && /* @__PURE__ */ jsx(Panel, {
176
+ title: "Agent guidance",
177
+ children: /* @__PURE__ */ jsx(FileFindings, {
178
+ root: project.root,
179
+ findings: project.agentGuidanceFindings
180
+ })
181
+ }),
195
182
  project?.seo && /* @__PURE__ */ jsxs(Panel, {
196
183
  title: "SEO",
197
184
  children: [/* @__PURE__ */ jsxs("div", {
@@ -215,41 +202,6 @@ function Dashboard() {
215
202
  children: [/* @__PURE__ */ jsx(Target, { className: "size-4" }), /* @__PURE__ */ jsx("span", { children: project.seo.schemaVersion })]
216
203
  })]
217
204
  }),
218
- /* @__PURE__ */ jsxs(Panel, {
219
- title: "Link graph",
220
- children: [project?.linkGraph ? /* @__PURE__ */ jsxs("div", {
221
- className: "grid grid-cols-3 gap-px overflow-hidden border bg-border text-center",
222
- children: [
223
- /* @__PURE__ */ jsx(TinyMetric, {
224
- value: project.linkGraph.pages,
225
- label: "pages"
226
- }),
227
- /* @__PURE__ */ jsx(TinyMetric, {
228
- value: project.linkGraph.links,
229
- label: "links"
230
- }),
231
- /* @__PURE__ */ jsx(TinyMetric, {
232
- value: project.linkGraph.orphans,
233
- label: "orphans"
234
- })
235
- ]
236
- }) : /* @__PURE__ */ jsx("p", {
237
- className: "text-sm text-muted-foreground",
238
- children: "No slug frontmatter detected."
239
- }), graph && graph.edges.length > 0 && /* @__PURE__ */ jsx("ul", {
240
- className: "mt-3 flex max-h-56 flex-col gap-2 overflow-auto text-xs",
241
- children: graph.edges.slice(0, 12).map((edge, index) => /* @__PURE__ */ jsxs("li", {
242
- className: "flex items-center gap-2",
243
- children: [/* @__PURE__ */ jsx("span", {
244
- className: edge.status === "unresolved" ? "text-destructive" : "text-muted-foreground",
245
- children: edge.status
246
- }), /* @__PURE__ */ jsx("span", {
247
- className: "truncate",
248
- children: edge.target
249
- })]
250
- }, `${edge.from}-${edge.target}-${index}`))
251
- })]
252
- }),
253
205
  /* @__PURE__ */ jsx(Panel, {
254
206
  title: "Block usage",
255
207
  children: project && Object.keys(project.blockUsage).length > 0 ? /* @__PURE__ */ jsx("div", {
@@ -406,5 +358,4 @@ function keywordScore(file) {
406
358
  function findingScore(file) {
407
359
  return file.findings.errors * 100 + file.findings.warnings * 10 + file.findings.suggestions;
408
360
  }
409
- //#endregion
410
361
  export { Dashboard as component };
@@ -0,0 +1,4 @@
1
+ // ../../node_modules/.pnpm/@tanstack+start-server-core@1.169.16/node_modules/@tanstack/start-server-core/dist/esm/empty-plugin-adapters.js
2
+ var pluginSerializationAdapters = [];
3
+ var hasPluginAdapters = false;
4
+ export { hasPluginAdapters, pluginSerializationAdapters };
@@ -0,0 +1,388 @@
1
+ import { Link } from "@tanstack/react-router";
2
+ import { AlertTriangle, ArrowLeft, FileCode2, Globe, Link2, ListTree, RefreshCw, Target } from "lucide-react";
3
+ import { a as Button, d as Panel, f as SiteFindingItem, h as relativeTo, m as plural, n as usePage, o as Badge, p as StudioNav, s as ContentFindingItem } from "./api-CHfynRIj.js";
4
+ import { a as Route } from "./router-xI8HUWRI.js";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ // src/routes/page.tsx?tsr-split=component
7
+ function PageView() {
8
+ const search = Route.useSearch();
9
+ const { data: page, error: loadError, refreshing, refresh } = usePage(search.path);
10
+ const error = search.path ? loadError : "Missing page path.";
11
+ const context = page?.context.page === search.path ? page.context : void 0;
12
+ const root = page?.root ?? "";
13
+ return /* @__PURE__ */ jsxs("main", {
14
+ className: "min-h-svh bg-background text-foreground",
15
+ children: [/* @__PURE__ */ jsx("header", {
16
+ className: "border-b bg-muted/30",
17
+ children: /* @__PURE__ */ jsxs("div", {
18
+ className: "mx-auto flex max-w-7xl flex-col gap-5 px-5 py-5",
19
+ children: [
20
+ /* @__PURE__ */ jsx(StudioNav, {}),
21
+ /* @__PURE__ */ jsxs("div", {
22
+ className: "flex flex-col gap-3 md:flex-row md:items-center md:justify-between",
23
+ children: [/* @__PURE__ */ jsx(Button, {
24
+ asChild: true,
25
+ variant: "outline",
26
+ className: "w-fit gap-2",
27
+ children: /* @__PURE__ */ jsxs(Link, {
28
+ to: "/",
29
+ search: { q: "" },
30
+ children: [/* @__PURE__ */ jsx(ArrowLeft, { className: "size-4" }), "Pages"]
31
+ })
32
+ }), /* @__PURE__ */ jsxs(Button, {
33
+ onClick: refresh,
34
+ disabled: refreshing,
35
+ className: "w-fit gap-2",
36
+ children: [/* @__PURE__ */ jsx(RefreshCw, { className: refreshing ? "size-4 animate-spin" : "size-4" }), "Refresh"]
37
+ })]
38
+ }),
39
+ /* @__PURE__ */ jsxs("div", { children: [
40
+ /* @__PURE__ */ jsx("p", {
41
+ className: "font-mono text-xs uppercase text-muted-foreground",
42
+ children: "page context"
43
+ }),
44
+ /* @__PURE__ */ jsx("h1", {
45
+ className: "mt-1 break-all font-mono text-2xl font-semibold tracking-tight",
46
+ children: search.path || "Built page"
47
+ }),
48
+ context && /* @__PURE__ */ jsxs(Fragment, { children: [
49
+ context.url && /* @__PURE__ */ jsx("a", {
50
+ href: context.url,
51
+ target: "_blank",
52
+ rel: "noreferrer",
53
+ className: "mt-1 block break-all text-sm text-muted-foreground hover:underline",
54
+ children: context.url
55
+ }),
56
+ /* @__PURE__ */ jsxs("p", {
57
+ className: "mt-1 text-sm",
58
+ children: [
59
+ "Source:",
60
+ " ",
61
+ context.source ? /* @__PURE__ */ jsx(Link, {
62
+ to: "/document",
63
+ search: { path: context.source.file },
64
+ className: "font-mono underline underline-offset-4",
65
+ children: relativeTo(root, context.source.file)
66
+ }) : /* @__PURE__ */ jsx("span", {
67
+ className: "text-muted-foreground",
68
+ children: "none"
69
+ })
70
+ ]
71
+ }),
72
+ /* @__PURE__ */ jsxs("div", {
73
+ className: "mt-3 flex flex-wrap gap-2 text-xs",
74
+ children: [
75
+ /* @__PURE__ */ jsx(Badge, { children: plural(context.words, "word") }),
76
+ /* @__PURE__ */ jsxs(Badge, { children: [plural(context.linksIn.length, "link"), " in"] }),
77
+ /* @__PURE__ */ jsxs(Badge, { children: [plural(context.linksOut.length, "link"), " out"] }),
78
+ /* @__PURE__ */ jsx(Badge, { children: plural(context.findings.length, "finding") })
79
+ ]
80
+ })
81
+ ] })
82
+ ] })
83
+ ]
84
+ })
85
+ }), /* @__PURE__ */ jsxs("section", {
86
+ className: "mx-auto grid max-w-7xl gap-5 px-5 py-5 xl:grid-cols-[minmax(0,1fr)_380px]",
87
+ children: [/* @__PURE__ */ jsxs("div", {
88
+ className: "min-w-0 space-y-5",
89
+ children: [
90
+ error && /* @__PURE__ */ jsx(Panel, {
91
+ title: "Error",
92
+ icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }),
93
+ children: /* @__PURE__ */ jsx("p", {
94
+ className: "text-sm text-destructive",
95
+ children: error
96
+ })
97
+ }),
98
+ !context && !error && /* @__PURE__ */ jsx(Panel, {
99
+ title: "Loading",
100
+ icon: /* @__PURE__ */ jsx(RefreshCw, { className: "size-4" }),
101
+ children: /* @__PURE__ */ jsx("p", {
102
+ className: "text-sm",
103
+ children: "Reading the page..."
104
+ })
105
+ }),
106
+ context && /* @__PURE__ */ jsxs(Fragment, { children: [
107
+ /* @__PURE__ */ jsx(Panel, {
108
+ title: "Served",
109
+ icon: /* @__PURE__ */ jsx(Globe, { className: "size-4" }),
110
+ children: /* @__PURE__ */ jsx(Facts, { rows: [
111
+ ["Title", context.served.title],
112
+ ["Description", context.served.description],
113
+ ["Canonical", context.served.canonical],
114
+ ["Lang", context.served.lang],
115
+ ["Robots", `${context.served.robots.noindex ? "noindex" : "index"}, ${context.served.robots.nofollow ? "nofollow" : "follow"}`],
116
+ ["Hreflang", context.served.alternates.map(({ hreflang, href }) => `${hreflang} ${href}`).join(", ") || void 0],
117
+ ["Structured data", context.served.structuredData.join(", ") || void 0]
118
+ ] })
119
+ }),
120
+ context.declared && /* @__PURE__ */ jsx(Panel, {
121
+ title: "Declared",
122
+ icon: /* @__PURE__ */ jsx(FileCode2, { className: "size-4" }),
123
+ children: /* @__PURE__ */ jsx(Facts, { rows: [
124
+ ["Title", context.declared.title],
125
+ ["Description", context.declared.description],
126
+ ["Type", context.declared.type],
127
+ ["Intent", context.declared.intent],
128
+ ["Primary keyword", context.declared.keywords?.primary],
129
+ ["Secondary keywords", context.declared.keywords?.secondary?.join(", ")],
130
+ ["LSI keywords", context.declared.keywords?.lsi?.join(", ")]
131
+ ] })
132
+ }),
133
+ /* @__PURE__ */ jsx(Panel, {
134
+ title: `Outline, ${plural(context.words, "word")}`,
135
+ icon: /* @__PURE__ */ jsx(ListTree, { className: "size-4" }),
136
+ children: /* @__PURE__ */ jsx(Outline, { context })
137
+ }),
138
+ /* @__PURE__ */ jsx(Panel, {
139
+ title: "Links out",
140
+ icon: /* @__PURE__ */ jsx(Link2, { className: "size-4" }),
141
+ children: /* @__PURE__ */ jsx(LinksOut, { context })
142
+ }),
143
+ /* @__PURE__ */ jsx(Panel, {
144
+ title: "Links in",
145
+ icon: /* @__PURE__ */ jsx(Link2, { className: "size-4" }),
146
+ children: /* @__PURE__ */ jsx(LinksIn, { context })
147
+ })
148
+ ] })
149
+ ]
150
+ }), context && /* @__PURE__ */ jsxs("aside", {
151
+ className: "space-y-5",
152
+ children: [
153
+ /* @__PURE__ */ jsx(Panel, {
154
+ title: "Findings",
155
+ icon: /* @__PURE__ */ jsx(AlertTriangle, { className: "size-4" }),
156
+ children: context.findings.length > 0 ? /* @__PURE__ */ jsx("ul", {
157
+ className: "space-y-3",
158
+ children: context.findings.map((finding, index) => /* @__PURE__ */ jsx(SiteFindingItem, {
159
+ finding,
160
+ root
161
+ }, `${finding.code}-${index}`))
162
+ }) : /* @__PURE__ */ jsx("p", {
163
+ className: "text-sm text-muted-foreground",
164
+ children: "No findings on this page."
165
+ })
166
+ }),
167
+ context.source && /* @__PURE__ */ jsx(Panel, {
168
+ title: "Markdown findings",
169
+ icon: /* @__PURE__ */ jsx(FileCode2, { className: "size-4" }),
170
+ children: context.contentFindings.length > 0 ? /* @__PURE__ */ jsx("ul", {
171
+ className: "space-y-3",
172
+ children: context.contentFindings.map((finding, index) => /* @__PURE__ */ jsx(ContentFindingItem, { finding }, `${finding.code}-${index}`))
173
+ }) : /* @__PURE__ */ jsx("p", {
174
+ className: "text-sm text-muted-foreground",
175
+ children: "No findings in its source."
176
+ })
177
+ }),
178
+ context.contract && /* @__PURE__ */ jsx(Panel, {
179
+ title: "Contract",
180
+ icon: /* @__PURE__ */ jsx(Target, { className: "size-4" }),
181
+ children: /* @__PURE__ */ jsx(Contract, { contract: context.contract })
182
+ })
183
+ ]
184
+ })]
185
+ })]
186
+ });
187
+ }
188
+ function Facts({ rows }) {
189
+ return /* @__PURE__ */ jsx("dl", {
190
+ className: "grid gap-x-4 gap-y-2 text-sm md:grid-cols-[10rem_1fr]",
191
+ children: rows.map(([label, value]) => /* @__PURE__ */ jsx(Row, {
192
+ label,
193
+ children: value ?? /* @__PURE__ */ jsx("span", {
194
+ className: "text-muted-foreground",
195
+ children: "none"
196
+ })
197
+ }, label))
198
+ });
199
+ }
200
+ function Row({ label, children }) {
201
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("dt", {
202
+ className: "text-xs uppercase text-muted-foreground md:pt-0.5",
203
+ children: label
204
+ }), /* @__PURE__ */ jsx("dd", {
205
+ className: "min-w-0 break-words",
206
+ children
207
+ })] });
208
+ }
209
+ function Outline({ context }) {
210
+ return /* @__PURE__ */ jsxs("div", {
211
+ className: "space-y-3 text-sm",
212
+ children: [
213
+ context.intro && /* @__PURE__ */ jsxs("p", {
214
+ className: "line-clamp-3 text-muted-foreground",
215
+ children: [/* @__PURE__ */ jsx("span", {
216
+ className: "mr-2 font-mono text-xs uppercase",
217
+ children: "intro"
218
+ }), context.intro]
219
+ }),
220
+ context.outline.length === 0 && /* @__PURE__ */ jsx("p", {
221
+ className: "text-muted-foreground",
222
+ children: "No headings."
223
+ }),
224
+ /* @__PURE__ */ jsx("ul", {
225
+ className: "space-y-2",
226
+ children: context.outline.map((heading, index) => /* @__PURE__ */ jsxs("li", {
227
+ style: { paddingLeft: `${(heading.level - 1) * 1.25}rem` },
228
+ children: [/* @__PURE__ */ jsxs("p", { children: [
229
+ /* @__PURE__ */ jsxs("span", {
230
+ className: "mr-2 font-mono text-xs text-muted-foreground",
231
+ children: ["h", heading.level]
232
+ }),
233
+ /* @__PURE__ */ jsx("span", {
234
+ className: "font-medium",
235
+ children: heading.text
236
+ }),
237
+ heading.id && /* @__PURE__ */ jsxs("span", {
238
+ className: "ml-2 font-mono text-xs text-muted-foreground",
239
+ children: ["#", heading.id]
240
+ }),
241
+ /* @__PURE__ */ jsx("span", {
242
+ className: "ml-2 text-xs text-muted-foreground",
243
+ children: plural(heading.words, "word")
244
+ })
245
+ ] }), heading.body && /* @__PURE__ */ jsx("p", {
246
+ className: "mt-1 line-clamp-3 text-xs text-muted-foreground",
247
+ children: heading.body
248
+ })]
249
+ }, `${heading.text}-${index}`))
250
+ })
251
+ ]
252
+ });
253
+ }
254
+ function LinksOut({ context }) {
255
+ if (context.linksOut.length === 0) return /* @__PURE__ */ jsx("p", {
256
+ className: "text-sm text-muted-foreground",
257
+ children: "No links."
258
+ });
259
+ return /* @__PURE__ */ jsx(LinkTable, {
260
+ headers: [
261
+ "Text",
262
+ "Target",
263
+ "Placement"
264
+ ],
265
+ children: context.linksOut.map(({ href, text, placement, target }, index) => /* @__PURE__ */ jsxs("tr", {
266
+ className: "border-t align-top",
267
+ children: [
268
+ /* @__PURE__ */ jsx("td", {
269
+ className: "py-1.5 pr-3 break-words",
270
+ children: text || /* @__PURE__ */ jsx(Muted, { children: "no text" })
271
+ }),
272
+ /* @__PURE__ */ jsx("td", {
273
+ className: "py-1.5 pr-3 font-mono text-xs break-all",
274
+ children: /* @__PURE__ */ jsx(LinkTarget, {
275
+ href,
276
+ target
277
+ })
278
+ }),
279
+ /* @__PURE__ */ jsx("td", {
280
+ className: "py-1.5 text-xs text-muted-foreground",
281
+ children: placement
282
+ })
283
+ ]
284
+ }, `${href}-${index}`))
285
+ });
286
+ }
287
+ function LinksIn({ context }) {
288
+ if (context.linksIn.length === 0) return /* @__PURE__ */ jsx("p", {
289
+ className: "text-sm text-muted-foreground",
290
+ children: "No built page links here."
291
+ });
292
+ return /* @__PURE__ */ jsx(LinkTable, {
293
+ headers: [
294
+ "From",
295
+ "Text",
296
+ "Placement"
297
+ ],
298
+ children: context.linksIn.map(({ from, text, anchor, placement }, index) => /* @__PURE__ */ jsxs("tr", {
299
+ className: "border-t align-top",
300
+ children: [
301
+ /* @__PURE__ */ jsx("td", {
302
+ className: "py-1.5 pr-3 font-mono text-xs break-all",
303
+ children: /* @__PURE__ */ jsx(Link, {
304
+ to: "/page",
305
+ search: { path: from },
306
+ className: "hover:underline",
307
+ children: from
308
+ })
309
+ }),
310
+ /* @__PURE__ */ jsxs("td", {
311
+ className: "py-1.5 pr-3 break-words",
312
+ children: [text || /* @__PURE__ */ jsx(Muted, { children: "no text" }), anchor !== void 0 && /* @__PURE__ */ jsxs("span", {
313
+ className: "ml-1 font-mono text-xs text-muted-foreground",
314
+ children: ["#", anchor]
315
+ })]
316
+ }),
317
+ /* @__PURE__ */ jsx("td", {
318
+ className: "py-1.5 text-xs text-muted-foreground",
319
+ children: placement
320
+ })
321
+ ]
322
+ }, `${from}-${index}`))
323
+ });
324
+ }
325
+ function LinkTable({ headers, children }) {
326
+ return /* @__PURE__ */ jsx("div", {
327
+ className: "max-h-[32rem] overflow-auto",
328
+ children: /* @__PURE__ */ jsxs("table", {
329
+ className: "w-full text-left text-sm",
330
+ children: [/* @__PURE__ */ jsx("thead", {
331
+ className: "text-xs uppercase text-muted-foreground",
332
+ children: /* @__PURE__ */ jsx("tr", { children: headers.map((header) => /* @__PURE__ */ jsx("th", {
333
+ className: "pb-2 pr-3 font-medium",
334
+ children: header
335
+ }, header)) })
336
+ }), /* @__PURE__ */ jsx("tbody", { children })]
337
+ })
338
+ });
339
+ }
340
+ function LinkTarget({ href, target }) {
341
+ if (target.kind === "page") return /* @__PURE__ */ jsxs(Link, {
342
+ to: "/page",
343
+ search: { path: target.page },
344
+ className: "hover:underline",
345
+ children: [target.page, target.anchor !== void 0 && `#${target.anchor}`]
346
+ });
347
+ const label = target.kind === "file" ? target.exists ? "a file in the build" : "a file missing from the build" : target.kind === "missing" ? "no built page" : target.kind === "host-route" ? "a host route" : target.kind;
348
+ return /* @__PURE__ */ jsxs(Fragment, { children: [href, /* @__PURE__ */ jsx("span", {
349
+ className: `ml-2 font-sans ${target.kind === "missing" || target.kind === "file" && !target.exists ? "text-destructive" : "text-muted-foreground"}`,
350
+ children: label
351
+ })] });
352
+ }
353
+ function Contract({ contract }) {
354
+ return /* @__PURE__ */ jsxs("div", {
355
+ className: "space-y-3 text-sm",
356
+ children: [
357
+ /* @__PURE__ */ jsxs("p", { children: ["Page type: ", /* @__PURE__ */ jsx("span", {
358
+ className: "font-medium",
359
+ children: contract.target.type ?? "none"
360
+ })] }),
361
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
362
+ className: "mb-1 text-xs uppercase text-muted-foreground",
363
+ children: "Acceptance checks"
364
+ }), contract.acceptanceChecks.length === 0 ? /* @__PURE__ */ jsx("p", {
365
+ className: "text-muted-foreground",
366
+ children: "None."
367
+ }) : /* @__PURE__ */ jsx("ul", {
368
+ className: "space-y-1",
369
+ children: contract.acceptanceChecks.map((check) => /* @__PURE__ */ jsx("li", {
370
+ className: "border bg-muted/40 px-2 py-1.5",
371
+ children: check
372
+ }, check))
373
+ })] }),
374
+ contract.recommendedBlocks.length > 0 && /* @__PURE__ */ jsxs("p", { children: [
375
+ "Recommended blocks: ",
376
+ contract.recommendedBlocks.join(", "),
377
+ "."
378
+ ] })
379
+ ]
380
+ });
381
+ }
382
+ function Muted({ children }) {
383
+ return /* @__PURE__ */ jsx("span", {
384
+ className: "text-muted-foreground",
385
+ children
386
+ });
387
+ }
388
+ export { PageView as component };