@commonpub/layer 0.23.3 → 0.25.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.
- package/README.md +41 -12
- package/components/LayoutRow.vue +944 -0
- package/components/LayoutSection.vue +1028 -0
- package/components/LayoutSlot.vue +104 -162
- package/components/PageFrame.vue +116 -0
- package/components/admin/layouts/AdminLayoutsAnnouncer.vue +53 -0
- package/components/admin/layouts/AdminLayoutsAutoForm.vue +419 -0
- package/components/admin/layouts/AdminLayoutsCanvas.vue +332 -0
- package/components/admin/layouts/AdminLayoutsConflictModal.vue +266 -0
- package/components/admin/layouts/AdminLayoutsHelpOverlay.vue +346 -0
- package/components/admin/layouts/AdminLayoutsInspector.vue +157 -0
- package/components/admin/layouts/AdminLayoutsInspectorPage.vue +266 -0
- package/components/admin/layouts/AdminLayoutsInspectorRow.vue +80 -0
- package/components/admin/layouts/AdminLayoutsInspectorSection.vue +175 -0
- package/components/admin/layouts/AdminLayoutsPalette.vue +117 -0
- package/components/admin/layouts/AdminLayoutsPaletteTile.vue +149 -0
- package/components/admin/layouts/AdminLayoutsToolbar.vue +483 -0
- package/components/blocks/BlockDividerView.vue +52 -2
- package/components/homepage/ContentGridSection.vue +23 -1
- package/components/homepage/HeroSection.vue +69 -8
- package/components/sections/SectionCta.vue +175 -0
- package/components/sections/SectionLearning.vue +232 -0
- package/composables/autoFormSchema.ts +319 -0
- package/composables/useAdminSidebar.ts +116 -0
- package/composables/useEditorChrome.ts +56 -0
- package/composables/useFeatures.ts +32 -5
- package/composables/useLayout.ts +46 -43
- package/composables/useLayoutAnnouncer.ts +332 -0
- package/composables/useLayoutAutoSave.ts +117 -0
- package/composables/useLayoutDrag.ts +290 -0
- package/composables/useLayoutEditor.ts +593 -0
- package/composables/useLayoutHistory.ts +583 -0
- package/composables/useLayoutHotkeys.ts +366 -0
- package/composables/useLayoutResize.ts +783 -0
- package/layouts/admin.vue +137 -24
- package/middleware/admin-layouts.ts +29 -0
- package/nuxt.config.ts +14 -0
- package/package.json +8 -5
- package/pages/[...customPath].vue +154 -0
- package/pages/admin/homepage.vue +46 -0
- package/pages/admin/index.vue +16 -0
- package/pages/admin/layouts/[id].vue +1110 -0
- package/pages/admin/layouts/index.vue +356 -0
- package/pages/explore.vue +16 -6
- package/sections/builtin/content-feed.ts +18 -29
- package/sections/builtin/contests.ts +30 -0
- package/sections/builtin/cta.ts +46 -0
- package/sections/builtin/custom-html.ts +36 -0
- package/sections/builtin/divider.ts +15 -17
- package/sections/builtin/editorial.ts +29 -0
- package/sections/builtin/embed.ts +31 -0
- package/sections/builtin/gallery.ts +29 -0
- package/sections/builtin/heading.ts +14 -19
- package/sections/builtin/hero.ts +16 -51
- package/sections/builtin/hubs.ts +30 -0
- package/sections/builtin/image.ts +12 -49
- package/sections/builtin/learning.ts +30 -0
- package/sections/builtin/markdown.ts +29 -0
- package/sections/builtin/paragraph.ts +14 -17
- package/sections/builtin/stats.ts +35 -0
- package/sections/builtin/video.ts +30 -0
- package/sections/registry.ts +38 -7
- package/server/api/admin/homepage/sections.put.ts +52 -1
- package/server/api/admin/layouts/[id]/publish.post.ts +12 -0
- package/server/api/admin/layouts/[id]/versions/[versionId]/revert.post.ts +11 -0
- package/server/api/admin/layouts/[id].delete.ts +33 -1
- package/server/api/admin/layouts/[id].put.ts +78 -0
- package/server/api/admin/layouts/index.post.ts +60 -4
- package/server/api/admin/layouts/migrate-homepage.post.ts +68 -0
- package/server/api/admin/layouts/seed-homepage.post.ts +9 -0
- package/server/api/layouts/by-route.get.ts +64 -12
- package/server/plugins/feature-flags-prime.ts +39 -0
- package/server/utils/layoutCache.ts +37 -1
- package/server/utils/validateSectionConfigs.ts +123 -0
- package/theme/base.css +1 -0
- package/components/sections/SectionContentFeed.vue +0 -160
- package/components/sections/SectionDivider.vue +0 -55
- package/components/sections/SectionHeading.vue +0 -78
- package/components/sections/SectionHero.vue +0 -164
- package/components/sections/SectionImage.vue +0 -104
- package/components/sections/SectionParagraph.vue +0 -55
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ export default defineCommonPubConfig({
|
|
|
27
27
|
instance: {
|
|
28
28
|
name: 'My Community',
|
|
29
29
|
domain: 'example.com',
|
|
30
|
-
contentTypes: ['project', '
|
|
30
|
+
contentTypes: ['project', 'blog', 'explainer'],
|
|
31
31
|
},
|
|
32
32
|
features: {
|
|
33
33
|
content: true,
|
|
@@ -38,34 +38,63 @@ export default defineCommonPubConfig({
|
|
|
38
38
|
admin: true,
|
|
39
39
|
},
|
|
40
40
|
auth: {
|
|
41
|
-
|
|
41
|
+
emailPassword: true,
|
|
42
42
|
},
|
|
43
43
|
});
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
> `article` is a deprecated alias that normalises to `blog` on write (session 116); use `blog`, `project`, or `explainer` for new content (CLAUDE.md rule #6).
|
|
47
|
+
|
|
48
|
+
Create `server/utils/config.ts` to load the config on the server side. See `apps/reference/server/utils/config.ts` for a complete example with environment variable overrides.
|
|
47
49
|
|
|
48
50
|
## What's Included
|
|
49
51
|
|
|
50
|
-
### Pages (
|
|
52
|
+
### Pages (90 routes)
|
|
53
|
+
|
|
54
|
+
Content CRUD (projects/blogs/explainers), hub feeds (community/product/company), learning paths, docs sites, contests, events, messages, notifications, search, user profiles, federation, **admin panel** (users, content, reports, settings, theme editor at `/admin/theme/edit/[id]`, layout editor at `/admin/layouts/[id]`), and more.
|
|
55
|
+
|
|
56
|
+
### Components (132)
|
|
57
|
+
|
|
58
|
+
Content editor (`CpubEditor`), content cards, author rows, comment sections, engagement bars, federation UI, notification items, message threads, **21 block renderers** under `components/blocks/` (`BlockHeadingView`, `BlockCalloutView`, `BlockEmbedView`, `BlockMarkdownView`, `BlockGalleryView`, etc. — all `*View` suffixed), homepage section renderers (`HeroSection`, etc.), the **layout-editor admin chrome** (`AdminLayoutsToolbar`, `AdminLayoutsCanvas`, `AdminLayoutsPalette`, `AdminLayoutsInspector`, `AdminLayoutsConflictModal`), and the `<LayoutSlot>` renderer that arranges existing components per the layout engine.
|
|
59
|
+
|
|
60
|
+
### Composables (33)
|
|
61
|
+
|
|
62
|
+
Highlights — see `layers/base/composables/*.ts` for the full set:
|
|
51
63
|
|
|
52
|
-
|
|
64
|
+
| Composable | Purpose |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `useAuth` | Better Auth session + identity |
|
|
67
|
+
| `useFeatures` | Reactive feature-flag lookup |
|
|
68
|
+
| `useContentSave` / `usePublishValidation` | Save lifecycle for blocks-based content + pre-publish validation |
|
|
69
|
+
| `useEngagement` / `useRealtimeCounts` | Likes, comments, bookmarks + realtime counters |
|
|
70
|
+
| `useFederation` / `useMirrorContent` | AP discovery + mirrored content |
|
|
71
|
+
| `useMessages` / `useNotifications` | Realtime SSE streams |
|
|
72
|
+
| `useTheme` / `useThemeAdmin` | Dark/light + branded theme switch (cookie-persisted, no flash) + admin theme editor |
|
|
73
|
+
| `useAdminSidebar` | Desktop sidebar collapse + mobile drawer (session 161) |
|
|
74
|
+
| `useEditorChrome` | Layout-editor palette + inspector visibility (session 161) |
|
|
75
|
+
| `useLayoutEditor` / `useLayoutAutoSave` | Layout draft state, single-flight save, conflict throttle, pagehide beacon, version-counter dirty (sessions 160-162) |
|
|
76
|
+
| `useLayout` | Public layout resolution via `<LayoutSlot>` |
|
|
77
|
+
| `useMarkdownImport` / `useSanitize` | Markdown ingest + HTML/iframe sanitization |
|
|
78
|
+
| `useFocusTrap` / `useToast` / `useApiError` | Accessibility + UX utilities |
|
|
53
79
|
|
|
54
|
-
|
|
80
|
+
The TipTap block editor itself lives in `@commonpub/editor` (composable `useBlockEditor` is imported from there, not declared in the layer).
|
|
55
81
|
|
|
56
|
-
|
|
82
|
+
### Server (~300 Nitro API routes)
|
|
57
83
|
|
|
58
|
-
|
|
84
|
+
API routes for all CommonPub features, auth middleware (`requireAdmin`, `requireFeature`), federation endpoints (Fedify-mounted), per-feature audit logging (`cpub.audit.*`), layout-engine CRUD at `/api/admin/layouts/*` (gated on `features.admin` + `features.layoutEngine`), and Nitro plugins for identity startup + feature-flag override.
|
|
59
85
|
|
|
60
|
-
|
|
86
|
+
### Layout engine + section registry
|
|
61
87
|
|
|
62
|
-
|
|
88
|
+
The layout engine ships a 12-column zone/row/section model with a section registry at `layers/base/sections/registry.ts`:
|
|
63
89
|
|
|
64
|
-
|
|
90
|
+
- **17 built-in sections** (`hero`, `heading`, `paragraph`, `image`, `content-feed`, `cta`, `learning`, `divider`, etc.). Each is a `SectionDefinition` pointing at an EXISTING `Block*` or `Homepage*` component via `propMap` — the engine ARRANGES, it doesn't render parallel renderers (see `feedback-reuse-existing-components`).
|
|
91
|
+
- **Per-section Zod schemas** in `@commonpub/schema/src/sectionConfigs.ts` (session 161) — enforced server-side at the layout API boundary with `cpub.audit.layout.config-rejected` audit logging.
|
|
92
|
+
- **Database tables** `layouts` / `layout_rows` / `layout_sections` / `layout_versions` (migration 0005). Layouts are instance-local — they NEVER federate via `@commonpub/protocol` per ADR 027.
|
|
93
|
+
- **Editor** at `/admin/layouts` (list) + `/admin/layouts/[id]` (3-column shell: palette / canvas / inspector). Auto-save 1.5s debounce + If-Match optimistic concurrency + 3-option conflict modal + cascade-throttle banner.
|
|
65
94
|
|
|
66
95
|
### Theme
|
|
67
96
|
|
|
68
|
-
CSS custom properties
|
|
97
|
+
CSS custom properties (`var(--*)` only — CLAUDE.md rule #3). Four user-selectable themes (`base`, `dark`, `agora`, `agora-dark`) plus structural CSS modules (`components.css`, `prose.css`, `editor-panels.css`, `forms.css`, `layouts.css`, `generics.css`). Admins can also create custom DB-stored themes via the theme editor at `/admin/theme` (session 154-156). Consumer apps override with their own `theme.css` and can shadow components for branding.
|
|
69
98
|
|
|
70
99
|
## Customization
|
|
71
100
|
|