@glw907/cairn-cms 0.53.0 → 0.55.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 (52) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/components/AdminLayout.svelte +52 -19
  3. package/dist/components/ConceptList.svelte +210 -73
  4. package/dist/components/ConceptList.svelte.d.ts +6 -4
  5. package/dist/components/EditPage.svelte +372 -110
  6. package/dist/components/EditPage.svelte.d.ts +2 -1
  7. package/dist/components/EditorToolbar.svelte +26 -10
  8. package/dist/components/MarkdownEditor.svelte +108 -14
  9. package/dist/components/MarkdownHelpDialog.svelte +5 -0
  10. package/dist/components/ShortcutsDialog.svelte +37 -0
  11. package/dist/components/ShortcutsDialog.svelte.d.ts +13 -0
  12. package/dist/components/ShortcutsGrid.svelte +18 -0
  13. package/dist/components/ShortcutsGrid.svelte.d.ts +23 -0
  14. package/dist/components/cairn-admin.css +184 -104
  15. package/dist/components/editor-folding.d.ts +7 -0
  16. package/dist/components/editor-folding.js +331 -0
  17. package/dist/components/editor-highlight.js +55 -6
  18. package/dist/components/editor-shortcuts.d.ts +16 -0
  19. package/dist/components/editor-shortcuts.js +36 -0
  20. package/dist/components/markdown-directives.d.ts +17 -0
  21. package/dist/components/markdown-directives.js +41 -0
  22. package/dist/components/topbar-context.d.ts +13 -0
  23. package/dist/components/topbar-context.js +17 -0
  24. package/dist/content/manifest.d.ts +1 -0
  25. package/dist/content/manifest.js +6 -0
  26. package/dist/delivery/content-index.js +1 -1
  27. package/dist/delivery/data.d.ts +1 -1
  28. package/dist/delivery/data.js +1 -1
  29. package/dist/sveltekit/content-routes.d.ts +3 -0
  30. package/dist/sveltekit/content-routes.js +10 -5
  31. package/package.json +1 -1
  32. package/src/lib/components/AdminLayout.svelte +52 -19
  33. package/src/lib/components/ConceptList.svelte +210 -73
  34. package/src/lib/components/EditPage.svelte +372 -110
  35. package/src/lib/components/EditorToolbar.svelte +26 -10
  36. package/src/lib/components/MarkdownEditor.svelte +108 -14
  37. package/src/lib/components/MarkdownHelpDialog.svelte +5 -0
  38. package/src/lib/components/ShortcutsDialog.svelte +37 -0
  39. package/src/lib/components/ShortcutsGrid.svelte +18 -0
  40. package/src/lib/components/cairn-admin.css +24 -11
  41. package/src/lib/components/editor-folding.ts +356 -0
  42. package/src/lib/components/editor-highlight.ts +54 -4
  43. package/src/lib/components/editor-shortcuts.ts +42 -0
  44. package/src/lib/components/markdown-directives.ts +42 -0
  45. package/src/lib/components/topbar-context.ts +30 -0
  46. package/src/lib/content/manifest.ts +7 -0
  47. package/src/lib/delivery/content-index.ts +1 -1
  48. package/src/lib/delivery/data.ts +1 -1
  49. package/src/lib/sveltekit/content-routes.ts +13 -5
  50. /package/dist/{delivery → content}/excerpt.d.ts +0 -0
  51. /package/dist/{delivery → content}/excerpt.js +0 -0
  52. /package/src/lib/{delivery → content}/excerpt.ts +0 -0
@@ -6,6 +6,8 @@ import { redirect, error, fail } from '@sveltejs/kit';
6
6
  import { findConcept } from '../content/concepts.js';
7
7
  import { extractCairnLinks, formatCairnToken, rewriteCairnLink } from '../content/links.js';
8
8
  import { frontmatterFromForm, parseMarkdown, dateInputValue, serializeMarkdown } from '../content/frontmatter.js';
9
+ import { deriveExcerpt } from '../content/excerpt.js';
10
+ import { asString } from '../content/identity.js';
9
11
  import { isValidId, slugify, filenameFromId, composeDatedId, slugFromId, renameId } from '../content/ids.js';
10
12
  import { appCredentials, type GithubKeyEnv } from '../github/credentials.js';
11
13
  import { listMarkdown, readRaw, commitFiles, type FileChange } from '../github/repo.js';
@@ -56,6 +58,9 @@ export interface EntrySummary {
56
58
  draft: boolean;
57
59
  /** Publish state derived from the ref set: live as-is, live with pending edits, or branch-only. */
58
60
  status: 'published' | 'edited' | 'new';
61
+ /** The row's one-line summary: the manifest's indexed excerpt for a published row, the branch
62
+ * frontmatter/body excerpt for a pending one, and null when neither yields text. */
63
+ summary: string | null;
59
64
  }
60
65
 
61
66
  /** The concept list view's data. */
@@ -251,13 +256,16 @@ export function createContentRoutes(runtime: CairnRuntime, deps: ContentRoutesDe
251
256
  ): Promise<EntrySummary> {
252
257
  try {
253
258
  const raw = await readRaw(repo, file.path, token);
254
- if (raw === null) return { id: file.id, title: file.id, date: null, draft: false, status };
255
- const { frontmatter } = parseMarkdown(raw);
259
+ if (raw === null) return { id: file.id, title: file.id, date: null, draft: false, status, summary: null };
260
+ const { frontmatter, body } = parseMarkdown(raw);
256
261
  const title = typeof frontmatter.title === 'string' && frontmatter.title.trim() ? frontmatter.title : file.id;
257
262
  const date = dateInputValue(frontmatter.date) || null;
258
- return { id: file.id, title, date, draft: frontmatter.draft === true, status };
263
+ // Normalize an empty excerpt to null, so a pending row matches EntrySummary's `string | null`
264
+ // contract (the published builder already coalesces with `?? null`).
265
+ const summary = deriveExcerpt(body, { description: asString(frontmatter.description) }) || null;
266
+ return { id: file.id, title, date, draft: frontmatter.draft === true, status, summary };
259
267
  } catch {
260
- return { id: file.id, title: file.id, date: null, draft: false, status };
268
+ return { id: file.id, title: file.id, date: null, draft: false, status, summary: null };
261
269
  }
262
270
  }
263
271
 
@@ -329,7 +337,7 @@ export function createContentRoutes(runtime: CairnRuntime, deps: ContentRoutesDe
329
337
  rows.map((e) =>
330
338
  pendingIds.has(e.id)
331
339
  ? pendingRow(concept, e.id, 'edited', token)
332
- : { id: e.id, title: e.title, date: e.date ?? null, draft: e.draft, status: 'published' as const },
340
+ : { id: e.id, title: e.title, date: e.date ?? null, draft: e.draft, status: 'published' as const, summary: e.summary ?? null },
333
341
  ),
334
342
  );
335
343
  const listed = new Set(rows.map((e) => e.id));
File without changes
File without changes
File without changes