@growth-labs/cms 0.1.1 → 0.1.3

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 (72) hide show
  1. package/README.md +6 -2
  2. package/dist/engine/index.d.ts +1 -1
  3. package/dist/engine/index.d.ts.map +1 -1
  4. package/dist/engine/index.js +2 -2
  5. package/dist/engine/index.js.map +1 -1
  6. package/dist/engine/publisher.d.ts +14 -3
  7. package/dist/engine/publisher.d.ts.map +1 -1
  8. package/dist/engine/publisher.js +11 -5
  9. package/dist/engine/publisher.js.map +1 -1
  10. package/dist/engine/slug-redirects.d.ts +16 -0
  11. package/dist/engine/slug-redirects.d.ts.map +1 -1
  12. package/dist/engine/slug-redirects.js +34 -0
  13. package/dist/engine/slug-redirects.js.map +1 -1
  14. package/dist/routes/content.d.ts +1 -1
  15. package/dist/routes/content.d.ts.map +1 -1
  16. package/dist/routes/content.js +35 -26
  17. package/dist/routes/content.js.map +1 -1
  18. package/dist/schema/insights-ingest.d.ts +16 -16
  19. package/dist/schema/migrations.d.ts +5 -3
  20. package/dist/schema/migrations.d.ts.map +1 -1
  21. package/dist/schema/migrations.js +148 -4
  22. package/dist/schema/migrations.js.map +1 -1
  23. package/dist/schema/types.d.ts +2 -2
  24. package/dist/schema/types.d.ts.map +1 -1
  25. package/dist/ui/commands.d.ts +2 -1
  26. package/dist/ui/commands.d.ts.map +1 -1
  27. package/dist/ui/commands.js +1 -2
  28. package/dist/ui/commands.js.map +1 -1
  29. package/dist/ui/components/SharePickers.d.ts.map +1 -1
  30. package/dist/ui/components/SharePickers.js +11 -7
  31. package/dist/ui/components/SharePickers.js.map +1 -1
  32. package/dist/ui/editor/ContentForm.d.ts +1 -1
  33. package/dist/ui/editor/ContentForm.d.ts.map +1 -1
  34. package/dist/ui/editor/ContentForm.js +5 -5
  35. package/dist/ui/editor/ContentForm.js.map +1 -1
  36. package/dist/ui/editor/content-payload.js +2 -2
  37. package/dist/ui/editor/content-payload.js.map +1 -1
  38. package/dist/ui/preview/draft-page.js +5 -4
  39. package/dist/ui/preview/draft-page.js.map +1 -1
  40. package/dist/ui/screens/EditorScreen.d.ts.map +1 -1
  41. package/dist/ui/screens/EditorScreen.js +2 -0
  42. package/dist/ui/screens/EditorScreen.js.map +1 -1
  43. package/dist/ui/screens/LibraryScreen.d.ts.map +1 -1
  44. package/dist/ui/screens/LibraryScreen.js +4 -2
  45. package/dist/ui/screens/LibraryScreen.js.map +1 -1
  46. package/dist/ui/screens/SocialShareScreen.js +1 -1
  47. package/dist/ui/screens/SocialShareScreen.js.map +1 -1
  48. package/dist/ui/screens/content-view.d.ts +2 -1
  49. package/dist/ui/screens/content-view.d.ts.map +1 -1
  50. package/dist/ui/screens/content-view.js.map +1 -1
  51. package/dist/ui/screens/public-url.d.ts.map +1 -1
  52. package/dist/ui/screens/public-url.js +2 -0
  53. package/dist/ui/screens/public-url.js.map +1 -1
  54. package/migrations/0001_create_cms_tables.sql +4 -4
  55. package/migrations/0017_content_pages.sql +138 -0
  56. package/package.json +1 -1
  57. package/src/engine/index.ts +6 -2
  58. package/src/engine/publisher.ts +45 -9
  59. package/src/engine/slug-redirects.ts +42 -0
  60. package/src/routes/content.ts +45 -29
  61. package/src/schema/migrations.ts +148 -4
  62. package/src/schema/types.ts +2 -2
  63. package/src/ui/commands.ts +3 -1
  64. package/src/ui/components/SharePickers.tsx +13 -10
  65. package/src/ui/editor/ContentForm.tsx +7 -7
  66. package/src/ui/editor/content-payload.ts +2 -2
  67. package/src/ui/preview/draft-page.tsx +7 -4
  68. package/src/ui/screens/EditorScreen.tsx +2 -0
  69. package/src/ui/screens/LibraryScreen.tsx +4 -2
  70. package/src/ui/screens/SocialShareScreen.tsx +1 -0
  71. package/src/ui/screens/content-view.ts +3 -1
  72. package/src/ui/screens/public-url.ts +2 -0
@@ -51,6 +51,7 @@ const CONTENT_TYPE_LABELS: Record<ContentType, string> = {
51
51
  video: 'Video',
52
52
  podcast: 'Podcast',
53
53
  newsletter: 'Newsletter',
54
+ page: 'Page',
54
55
  }
55
56
 
56
57
  const STATUS_PILL_COLORS: Record<ContentStatus, string> = {
@@ -472,6 +473,7 @@ function contentTypeIcon(type: ContentType): import('../icons.js').IconName {
472
473
  video: 'video',
473
474
  podcast: 'mic',
474
475
  newsletter: 'mail',
476
+ page: 'doc',
475
477
  }
476
478
  return map[type]
477
479
  }
@@ -50,6 +50,7 @@ const TYPE_OPTIONS: Array<{ value: ContentType | ''; label: string }> = [
50
50
  { value: 'video', label: 'Video' },
51
51
  { value: 'podcast', label: 'Podcast' },
52
52
  { value: 'newsletter', label: 'Newsletter' },
53
+ { value: 'page', label: 'Page' },
53
54
  ]
54
55
 
55
56
  const CONTENT_TYPE_ICONS: Record<ContentType, string> = {
@@ -57,6 +58,7 @@ const CONTENT_TYPE_ICONS: Record<ContentType, string> = {
57
58
  video: 'video',
58
59
  podcast: 'mic',
59
60
  newsletter: 'mail',
61
+ page: 'doc',
60
62
  }
61
63
 
62
64
  // ---------------------------------------------------------------------------
@@ -261,7 +263,7 @@ export function LibraryScreen({ openDoc }: LibraryScreenProps) {
261
263
  <div>
262
264
  <h1 className="page-title">Content</h1>
263
265
  <div className="page-sub">
264
- {lib.counts.all} items across articles, video, podcasts and newsletters.
266
+ {lib.counts.all} items across articles, video, podcasts, newsletters and pages.
265
267
  </div>
266
268
  </div>
267
269
  <div style={{ display: 'flex', gap: 8 }}>
@@ -509,7 +511,7 @@ function NewContentMenu({ openDoc }: { openDoc: LibraryScreenProps['openDoc'] })
509
511
  return () => document.removeEventListener('mousedown', handler)
510
512
  }, [open])
511
513
 
512
- const types: ContentType[] = ['article', 'video', 'podcast', 'newsletter']
514
+ const types: ContentType[] = ['article', 'video', 'podcast', 'newsletter', 'page']
513
515
 
514
516
  return (
515
517
  <div ref={ref} style={{ position: 'relative' }}>
@@ -411,6 +411,7 @@ function PerModeFields({
411
411
  <option value="video">Video</option>
412
412
  <option value="podcast">Podcast</option>
413
413
  <option value="newsletter">Newsletter</option>
414
+ <option value="page">Page</option>
414
415
  </select>
415
416
  </div>
416
417
  </div>
@@ -2,7 +2,9 @@
2
2
  // ContentRoute owns a ContentView state; dispatching actions moves between the
3
3
  // library list (open === null) and the editor (open !== null).
4
4
 
5
- export type ContentType = 'article' | 'video' | 'podcast' | 'newsletter'
5
+ import type { ContentType } from '../../schema/types.js'
6
+
7
+ export type { ContentType } from '../../schema/types.js'
6
8
 
7
9
  export interface ContentView {
8
10
  /** null = create new; string = open existing by id */
@@ -10,6 +10,7 @@
10
10
  // video → /video/<slug> (src/pages/video/[slug].astro)
11
11
  // newsletter → /warfronts-weekly/<slug>
12
12
  // (src/pages/warfronts-weekly/[slug].astro)
13
+ // page → /<slug>
13
14
  //
14
15
  // SOURCE OF TRUTH for the path scheme: the Fronts site page structure at
15
16
  // /Users/zephyr/projects/fulcrum-labs/fronts/src/pages/
@@ -44,6 +45,7 @@ const CONTENT_PUBLIC_PATH: Record<ContentType, (slug: string) => string> = {
44
45
  // SOURCE: fronts/src/pages/warfronts-weekly/[slug].astro
45
46
  // fronts/src/lib/content.ts ~L779
46
47
  newsletter: (slug) => `/warfronts-weekly/${slug}`,
48
+ page: (slug) => `/${slug.replace(/^\/+/, '')}`,
47
49
  }
48
50
 
49
51
  // ---------------------------------------------------------------------------