@actuate-media/cms-admin 0.15.0 → 0.16.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/AdminRoot.d.ts.map +1 -1
- package/dist/AdminRoot.js +148 -2
- package/dist/AdminRoot.js.map +1 -1
- package/dist/__tests__/components/posts-badges.test.d.ts +2 -0
- package/dist/__tests__/components/posts-badges.test.d.ts.map +1 -0
- package/dist/__tests__/components/posts-badges.test.js +68 -0
- package/dist/__tests__/components/posts-badges.test.js.map +1 -0
- package/dist/__tests__/layout/sidebar-posts.test.d.ts +2 -0
- package/dist/__tests__/layout/sidebar-posts.test.d.ts.map +1 -0
- package/dist/__tests__/layout/sidebar-posts.test.js +162 -0
- package/dist/__tests__/layout/sidebar-posts.test.js.map +1 -0
- package/dist/__tests__/lib/page-editor-service.test.d.ts +2 -0
- package/dist/__tests__/lib/page-editor-service.test.d.ts.map +1 -0
- package/dist/__tests__/lib/page-editor-service.test.js +137 -0
- package/dist/__tests__/lib/page-editor-service.test.js.map +1 -0
- package/dist/__tests__/lib/pages-service.test.d.ts +2 -0
- package/dist/__tests__/lib/pages-service.test.d.ts.map +1 -0
- package/dist/__tests__/lib/pages-service.test.js +140 -0
- package/dist/__tests__/lib/pages-service.test.js.map +1 -0
- package/dist/__tests__/lib/post-editor-service.test.d.ts +2 -0
- package/dist/__tests__/lib/post-editor-service.test.d.ts.map +1 -0
- package/dist/__tests__/lib/post-editor-service.test.js +185 -0
- package/dist/__tests__/lib/post-editor-service.test.js.map +1 -0
- package/dist/__tests__/lib/posts-service.test.d.ts +2 -0
- package/dist/__tests__/lib/posts-service.test.d.ts.map +1 -0
- package/dist/__tests__/lib/posts-service.test.js +244 -0
- package/dist/__tests__/lib/posts-service.test.js.map +1 -0
- package/dist/__tests__/lib/useApiData.test.d.ts +2 -0
- package/dist/__tests__/lib/useApiData.test.d.ts.map +1 -0
- package/dist/__tests__/lib/useApiData.test.js +84 -0
- package/dist/__tests__/lib/useApiData.test.js.map +1 -0
- package/dist/__tests__/views/dashboard.test.d.ts +2 -0
- package/dist/__tests__/views/dashboard.test.d.ts.map +1 -0
- package/dist/__tests__/views/dashboard.test.js +138 -0
- package/dist/__tests__/views/dashboard.test.js.map +1 -0
- package/dist/__tests__/views/posts-list-view.test.d.ts +2 -0
- package/dist/__tests__/views/posts-list-view.test.d.ts.map +1 -0
- package/dist/__tests__/views/posts-list-view.test.js +98 -0
- package/dist/__tests__/views/posts-list-view.test.js.map +1 -0
- package/dist/actuate-admin.css +1 -1
- package/dist/components/pages/tag-badges.d.ts +21 -0
- package/dist/components/pages/tag-badges.d.ts.map +1 -0
- package/dist/components/pages/tag-badges.js +56 -0
- package/dist/components/pages/tag-badges.js.map +1 -0
- package/dist/components/posts/badges.d.ts +25 -0
- package/dist/components/posts/badges.d.ts.map +1 -0
- package/dist/components/posts/badges.js +123 -0
- package/dist/components/posts/badges.js.map +1 -0
- package/dist/components/posts/icons.d.ts +12 -0
- package/dist/components/posts/icons.d.ts.map +1 -0
- package/dist/components/posts/icons.js +26 -0
- package/dist/components/posts/icons.js.map +1 -0
- package/dist/layout/Layout.js +36 -8
- package/dist/layout/Layout.js.map +1 -1
- package/dist/layout/Sidebar.d.ts +9 -0
- package/dist/layout/Sidebar.d.ts.map +1 -1
- package/dist/layout/Sidebar.js +100 -48
- package/dist/layout/Sidebar.js.map +1 -1
- package/dist/lib/page-editor-service.d.ts +45 -0
- package/dist/lib/page-editor-service.d.ts.map +1 -0
- package/dist/lib/page-editor-service.js +153 -0
- package/dist/lib/page-editor-service.js.map +1 -0
- package/dist/lib/pages-service.d.ts +143 -0
- package/dist/lib/pages-service.d.ts.map +1 -0
- package/dist/lib/pages-service.js +444 -0
- package/dist/lib/pages-service.js.map +1 -0
- package/dist/lib/post-editor-service.d.ts +57 -0
- package/dist/lib/post-editor-service.d.ts.map +1 -0
- package/dist/lib/post-editor-service.js +234 -0
- package/dist/lib/post-editor-service.js.map +1 -0
- package/dist/lib/posts-service.d.ts +73 -0
- package/dist/lib/posts-service.d.ts.map +1 -0
- package/dist/lib/posts-service.js +245 -0
- package/dist/lib/posts-service.js.map +1 -0
- package/dist/lib/preview-link.d.ts +32 -0
- package/dist/lib/preview-link.d.ts.map +1 -0
- package/dist/lib/preview-link.js +40 -0
- package/dist/lib/preview-link.js.map +1 -0
- package/dist/router/index.d.ts +1 -0
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +9 -1
- package/dist/router/index.js.map +1 -1
- package/dist/views/Dashboard.d.ts.map +1 -1
- package/dist/views/Dashboard.js +64 -20
- package/dist/views/Dashboard.js.map +1 -1
- package/dist/views/Pages/PageTagManager.d.ts +14 -0
- package/dist/views/Pages/PageTagManager.d.ts.map +1 -0
- package/dist/views/Pages/PageTagManager.js +145 -0
- package/dist/views/Pages/PageTagManager.js.map +1 -0
- package/dist/views/Pages/PagesListView.d.ts +18 -0
- package/dist/views/Pages/PagesListView.d.ts.map +1 -0
- package/dist/views/Pages/PagesListView.js +287 -0
- package/dist/views/Pages/PagesListView.js.map +1 -0
- package/dist/views/Posts/NewPostPicker.d.ts +16 -0
- package/dist/views/Posts/NewPostPicker.d.ts.map +1 -0
- package/dist/views/Posts/NewPostPicker.js +59 -0
- package/dist/views/Posts/NewPostPicker.js.map +1 -0
- package/dist/views/Posts/NewPostTypeInstructions.d.ts +18 -0
- package/dist/views/Posts/NewPostTypeInstructions.d.ts.map +1 -0
- package/dist/views/Posts/NewPostTypeInstructions.js +147 -0
- package/dist/views/Posts/NewPostTypeInstructions.js.map +1 -0
- package/dist/views/Posts/PostTypesView.d.ts +26 -0
- package/dist/views/Posts/PostTypesView.d.ts.map +1 -0
- package/dist/views/Posts/PostTypesView.js +52 -0
- package/dist/views/Posts/PostTypesView.js.map +1 -0
- package/dist/views/Posts/PostsListView.d.ts +25 -0
- package/dist/views/Posts/PostsListView.d.ts.map +1 -0
- package/dist/views/Posts/PostsListView.js +239 -0
- package/dist/views/Posts/PostsListView.js.map +1 -0
- package/dist/views/Posts/post-type-presets.d.ts +32 -0
- package/dist/views/Posts/post-type-presets.d.ts.map +1 -0
- package/dist/views/Posts/post-type-presets.js +72 -0
- package/dist/views/Posts/post-type-presets.js.map +1 -0
- package/dist/views/page-builder/Widgets.d.ts +13 -0
- package/dist/views/page-builder/Widgets.d.ts.map +1 -0
- package/dist/views/page-builder/Widgets.js +15 -0
- package/dist/views/page-builder/Widgets.js.map +1 -0
- package/dist/views/page-editor/AddSectionModal.d.ts +20 -0
- package/dist/views/page-editor/AddSectionModal.d.ts.map +1 -0
- package/dist/views/page-editor/AddSectionModal.js +22 -0
- package/dist/views/page-editor/AddSectionModal.js.map +1 -0
- package/dist/views/page-editor/EditorCanvas.d.ts +18 -0
- package/dist/views/page-editor/EditorCanvas.d.ts.map +1 -0
- package/dist/views/page-editor/EditorCanvas.js +64 -0
- package/dist/views/page-editor/EditorCanvas.js.map +1 -0
- package/dist/views/page-editor/EditorTopBar.d.ts +30 -0
- package/dist/views/page-editor/EditorTopBar.d.ts.map +1 -0
- package/dist/views/page-editor/EditorTopBar.js +42 -0
- package/dist/views/page-editor/EditorTopBar.js.map +1 -0
- package/dist/views/page-editor/PagePreview.d.ts +13 -0
- package/dist/views/page-editor/PagePreview.d.ts.map +1 -0
- package/dist/views/page-editor/PagePreview.js +37 -0
- package/dist/views/page-editor/PagePreview.js.map +1 -0
- package/dist/views/page-editor/PageSectionEditor.d.ts +16 -0
- package/dist/views/page-editor/PageSectionEditor.d.ts.map +1 -0
- package/dist/views/page-editor/PageSectionEditor.js +272 -0
- package/dist/views/page-editor/PageSectionEditor.js.map +1 -0
- package/dist/views/page-editor/PageSettingsModal.d.ts +12 -0
- package/dist/views/page-editor/PageSettingsModal.d.ts.map +1 -0
- package/dist/views/page-editor/PageSettingsModal.js +52 -0
- package/dist/views/page-editor/PageSettingsModal.js.map +1 -0
- package/dist/views/page-editor/SectionInspector.d.ts +17 -0
- package/dist/views/page-editor/SectionInspector.d.ts.map +1 -0
- package/dist/views/page-editor/SectionInspector.js +98 -0
- package/dist/views/page-editor/SectionInspector.js.map +1 -0
- package/dist/views/page-editor/SectionsPanel.d.ts +15 -0
- package/dist/views/page-editor/SectionsPanel.d.ts.map +1 -0
- package/dist/views/page-editor/SectionsPanel.js +43 -0
- package/dist/views/page-editor/SectionsPanel.js.map +1 -0
- package/dist/views/page-editor/ValidationSummary.d.ts +9 -0
- package/dist/views/page-editor/ValidationSummary.d.ts.map +1 -0
- package/dist/views/page-editor/ValidationSummary.js +10 -0
- package/dist/views/page-editor/ValidationSummary.js.map +1 -0
- package/dist/views/page-editor/section-icons.d.ts +4 -0
- package/dist/views/page-editor/section-icons.d.ts.map +1 -0
- package/dist/views/page-editor/section-icons.js +20 -0
- package/dist/views/page-editor/section-icons.js.map +1 -0
- package/dist/views/page-editor/section-types.d.ts +11 -0
- package/dist/views/page-editor/section-types.d.ts.map +1 -0
- package/dist/views/page-editor/section-types.js +10 -0
- package/dist/views/page-editor/section-types.js.map +1 -0
- package/dist/views/page-editor/sections/ArticleBodySection.d.ts +13 -0
- package/dist/views/page-editor/sections/ArticleBodySection.d.ts.map +1 -0
- package/dist/views/page-editor/sections/ArticleBodySection.js +23 -0
- package/dist/views/page-editor/sections/ArticleBodySection.js.map +1 -0
- package/dist/views/page-editor/sections/AuthorBioSection.d.ts +8 -0
- package/dist/views/page-editor/sections/AuthorBioSection.d.ts.map +1 -0
- package/dist/views/page-editor/sections/AuthorBioSection.js +21 -0
- package/dist/views/page-editor/sections/AuthorBioSection.js.map +1 -0
- package/dist/views/page-editor/sections/ByTheNumbersSection.d.ts +5 -0
- package/dist/views/page-editor/sections/ByTheNumbersSection.d.ts.map +1 -0
- package/dist/views/page-editor/sections/ByTheNumbersSection.js +10 -0
- package/dist/views/page-editor/sections/ByTheNumbersSection.js.map +1 -0
- package/dist/views/page-editor/sections/CtaBannerSection.d.ts +5 -0
- package/dist/views/page-editor/sections/CtaBannerSection.d.ts.map +1 -0
- package/dist/views/page-editor/sections/CtaBannerSection.js +10 -0
- package/dist/views/page-editor/sections/CtaBannerSection.js.map +1 -0
- package/dist/views/page-editor/sections/FeatureHighlightSection.d.ts +5 -0
- package/dist/views/page-editor/sections/FeatureHighlightSection.d.ts.map +1 -0
- package/dist/views/page-editor/sections/FeatureHighlightSection.js +18 -0
- package/dist/views/page-editor/sections/FeatureHighlightSection.js.map +1 -0
- package/dist/views/page-editor/sections/GallerySection.d.ts +6 -0
- package/dist/views/page-editor/sections/GallerySection.d.ts.map +1 -0
- package/dist/views/page-editor/sections/GallerySection.js +17 -0
- package/dist/views/page-editor/sections/GallerySection.js.map +1 -0
- package/dist/views/page-editor/sections/HeroBannerSection.d.ts +5 -0
- package/dist/views/page-editor/sections/HeroBannerSection.d.ts.map +1 -0
- package/dist/views/page-editor/sections/HeroBannerSection.js +11 -0
- package/dist/views/page-editor/sections/HeroBannerSection.js.map +1 -0
- package/dist/views/page-editor/sections/MissionSection.d.ts +6 -0
- package/dist/views/page-editor/sections/MissionSection.d.ts.map +1 -0
- package/dist/views/page-editor/sections/MissionSection.js +12 -0
- package/dist/views/page-editor/sections/MissionSection.js.map +1 -0
- package/dist/views/page-editor/sections/PullQuoteSection.d.ts +6 -0
- package/dist/views/page-editor/sections/PullQuoteSection.d.ts.map +1 -0
- package/dist/views/page-editor/sections/PullQuoteSection.js +13 -0
- package/dist/views/page-editor/sections/PullQuoteSection.js.map +1 -0
- package/dist/views/page-editor/sections/RelatedPostsSection.d.ts +12 -0
- package/dist/views/page-editor/sections/RelatedPostsSection.d.ts.map +1 -0
- package/dist/views/page-editor/sections/RelatedPostsSection.js +23 -0
- package/dist/views/page-editor/sections/RelatedPostsSection.js.map +1 -0
- package/dist/views/page-editor/sections/SectionRenderer.d.ts +22 -0
- package/dist/views/page-editor/sections/SectionRenderer.d.ts.map +1 -0
- package/dist/views/page-editor/sections/SectionRenderer.js +52 -0
- package/dist/views/page-editor/sections/SectionRenderer.js.map +1 -0
- package/dist/views/page-editor/sections/index.d.ts +14 -0
- package/dist/views/page-editor/sections/index.d.ts.map +1 -0
- package/dist/views/page-editor/sections/index.js +12 -0
- package/dist/views/page-editor/sections/index.js.map +1 -0
- package/dist/views/page-editor/sections/parts.d.ts +55 -0
- package/dist/views/page-editor/sections/parts.d.ts.map +1 -0
- package/dist/views/page-editor/sections/parts.js +60 -0
- package/dist/views/page-editor/sections/parts.js.map +1 -0
- package/dist/views/page-editor/viewports.d.ts +14 -0
- package/dist/views/page-editor/viewports.d.ts.map +1 -0
- package/dist/views/page-editor/viewports.js +12 -0
- package/dist/views/page-editor/viewports.js.map +1 -0
- package/dist/views/post-editor/PostEditorCanvas.d.ts +21 -0
- package/dist/views/post-editor/PostEditorCanvas.d.ts.map +1 -0
- package/dist/views/post-editor/PostEditorCanvas.js +58 -0
- package/dist/views/post-editor/PostEditorCanvas.js.map +1 -0
- package/dist/views/post-editor/PostFieldsModal.d.ts +12 -0
- package/dist/views/post-editor/PostFieldsModal.d.ts.map +1 -0
- package/dist/views/post-editor/PostFieldsModal.js +53 -0
- package/dist/views/post-editor/PostFieldsModal.js.map +1 -0
- package/dist/views/post-editor/PostHeader.d.ts +15 -0
- package/dist/views/post-editor/PostHeader.d.ts.map +1 -0
- package/dist/views/post-editor/PostHeader.js +27 -0
- package/dist/views/post-editor/PostHeader.js.map +1 -0
- package/dist/views/post-editor/PostHeaderPanel.d.ts +11 -0
- package/dist/views/post-editor/PostHeaderPanel.d.ts.map +1 -0
- package/dist/views/post-editor/PostHeaderPanel.js +21 -0
- package/dist/views/post-editor/PostHeaderPanel.js.map +1 -0
- package/dist/views/post-editor/PostPreview.d.ts +14 -0
- package/dist/views/post-editor/PostPreview.d.ts.map +1 -0
- package/dist/views/post-editor/PostPreview.js +53 -0
- package/dist/views/post-editor/PostPreview.js.map +1 -0
- package/dist/views/post-editor/PostSectionEditor.d.ts +17 -0
- package/dist/views/post-editor/PostSectionEditor.d.ts.map +1 -0
- package/dist/views/post-editor/PostSectionEditor.js +290 -0
- package/dist/views/post-editor/PostSectionEditor.js.map +1 -0
- package/dist/views/post-editor/PostTemplateEditor.d.ts +9 -0
- package/dist/views/post-editor/PostTemplateEditor.d.ts.map +1 -0
- package/dist/views/post-editor/PostTemplateEditor.js +144 -0
- package/dist/views/post-editor/PostTemplateEditor.js.map +1 -0
- package/package.json +2 -2
- package/src/AdminRoot.tsx +214 -2
- package/src/__tests__/components/posts-badges.test.tsx +77 -0
- package/src/__tests__/layout/sidebar-posts.test.ts +179 -0
- package/src/__tests__/lib/page-editor-service.test.ts +173 -0
- package/src/__tests__/lib/pages-service.test.ts +157 -0
- package/src/__tests__/lib/post-editor-service.test.ts +215 -0
- package/src/__tests__/lib/posts-service.test.ts +279 -0
- package/src/__tests__/lib/useApiData.test.ts +105 -0
- package/src/__tests__/views/dashboard.test.tsx +180 -0
- package/src/__tests__/views/posts-list-view.test.ts +110 -0
- package/src/components/pages/tag-badges.tsx +104 -0
- package/src/components/posts/badges.tsx +170 -0
- package/src/components/posts/icons.ts +40 -0
- package/src/layout/Layout.tsx +66 -10
- package/src/layout/Sidebar.tsx +116 -50
- package/src/lib/page-editor-service.ts +233 -0
- package/src/lib/pages-service.ts +599 -0
- package/src/lib/post-editor-service.ts +342 -0
- package/src/lib/posts-service.ts +366 -0
- package/src/lib/preview-link.ts +63 -0
- package/src/router/index.ts +10 -1
- package/src/views/Dashboard.tsx +142 -89
- package/src/views/Pages/PageTagManager.tsx +436 -0
- package/src/views/Pages/PagesListView.tsx +944 -0
- package/src/views/Posts/NewPostPicker.tsx +147 -0
- package/src/views/Posts/NewPostTypeInstructions.tsx +344 -0
- package/src/views/Posts/PostTypesView.tsx +194 -0
- package/src/views/Posts/PostsListView.tsx +869 -0
- package/src/views/Posts/post-type-presets.ts +105 -0
- package/src/views/page-builder/Widgets.tsx +44 -0
- package/src/views/page-editor/AddSectionModal.tsx +56 -0
- package/src/views/page-editor/EditorCanvas.tsx +127 -0
- package/src/views/page-editor/EditorTopBar.tsx +233 -0
- package/src/views/page-editor/PagePreview.tsx +96 -0
- package/src/views/page-editor/PageSectionEditor.tsx +476 -0
- package/src/views/page-editor/PageSettingsModal.tsx +154 -0
- package/src/views/page-editor/SectionInspector.tsx +599 -0
- package/src/views/page-editor/SectionsPanel.tsx +270 -0
- package/src/views/page-editor/ValidationSummary.tsx +53 -0
- package/src/views/page-editor/section-icons.ts +33 -0
- package/src/views/page-editor/section-types.ts +27 -0
- package/src/views/page-editor/sections/ArticleBodySection.tsx +57 -0
- package/src/views/page-editor/sections/AuthorBioSection.tsx +61 -0
- package/src/views/page-editor/sections/ByTheNumbersSection.tsx +41 -0
- package/src/views/page-editor/sections/CtaBannerSection.tsx +29 -0
- package/src/views/page-editor/sections/FeatureHighlightSection.tsx +63 -0
- package/src/views/page-editor/sections/GallerySection.tsx +54 -0
- package/src/views/page-editor/sections/HeroBannerSection.tsx +44 -0
- package/src/views/page-editor/sections/MissionSection.tsx +22 -0
- package/src/views/page-editor/sections/PullQuoteSection.tsx +27 -0
- package/src/views/page-editor/sections/RelatedPostsSection.tsx +55 -0
- package/src/views/page-editor/sections/SectionRenderer.tsx +102 -0
- package/src/views/page-editor/sections/index.ts +13 -0
- package/src/views/page-editor/sections/parts.tsx +113 -0
- package/src/views/page-editor/viewports.ts +25 -0
- package/src/views/post-editor/PostEditorCanvas.tsx +123 -0
- package/src/views/post-editor/PostFieldsModal.tsx +196 -0
- package/src/views/post-editor/PostHeader.tsx +87 -0
- package/src/views/post-editor/PostHeaderPanel.tsx +107 -0
- package/src/views/post-editor/PostPreview.tsx +114 -0
- package/src/views/post-editor/PostSectionEditor.tsx +506 -0
- package/src/views/post-editor/PostTemplateEditor.tsx +347 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { backgroundClass, paddingClass } from './parts.js';
|
|
4
|
+
import { HeroBannerSection } from './HeroBannerSection.js';
|
|
5
|
+
import { MissionSection } from './MissionSection.js';
|
|
6
|
+
import { FeatureHighlightSection } from './FeatureHighlightSection.js';
|
|
7
|
+
import { ByTheNumbersSection } from './ByTheNumbersSection.js';
|
|
8
|
+
import { CtaBannerSection } from './CtaBannerSection.js';
|
|
9
|
+
import { ArticleBodySection } from './ArticleBodySection.js';
|
|
10
|
+
import { PullQuoteSection } from './PullQuoteSection.js';
|
|
11
|
+
import { AuthorBioSection } from './AuthorBioSection.js';
|
|
12
|
+
import { RelatedPostsSection } from './RelatedPostsSection.js';
|
|
13
|
+
import { GallerySection } from './GallerySection.js';
|
|
14
|
+
/** Dispatch a section's body component by type. Shared by editor + preview. */
|
|
15
|
+
function SectionBody({ section, context }) {
|
|
16
|
+
switch (section.sectionType) {
|
|
17
|
+
case 'hero':
|
|
18
|
+
return _jsx(HeroBannerSection, { section: section });
|
|
19
|
+
case 'text':
|
|
20
|
+
return _jsx(MissionSection, { section: section });
|
|
21
|
+
case 'feature':
|
|
22
|
+
return _jsx(FeatureHighlightSection, { section: section });
|
|
23
|
+
case 'stats':
|
|
24
|
+
return _jsx(ByTheNumbersSection, { section: section });
|
|
25
|
+
case 'cta':
|
|
26
|
+
return _jsx(CtaBannerSection, { section: section });
|
|
27
|
+
case 'article-body':
|
|
28
|
+
return _jsx(ArticleBodySection, { section: section, context: context });
|
|
29
|
+
case 'quote':
|
|
30
|
+
return _jsx(PullQuoteSection, { section: section });
|
|
31
|
+
case 'author-bio':
|
|
32
|
+
return _jsx(AuthorBioSection, { section: section, context: context });
|
|
33
|
+
case 'related-posts':
|
|
34
|
+
return _jsx(RelatedPostsSection, { section: section, context: context });
|
|
35
|
+
case 'gallery':
|
|
36
|
+
return _jsx(GallerySection, { section: section });
|
|
37
|
+
default:
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Renders one section with its background + padding, dispatching to the
|
|
43
|
+
* shared body component. In `editable` mode it layers editor-only chrome
|
|
44
|
+
* (outline + a small purple type label) on top of the same markup the
|
|
45
|
+
* public preview uses — so what you edit is what ships.
|
|
46
|
+
*/
|
|
47
|
+
export function SectionRenderer({ section, editable = false, selected = false, onSelect, registerRef, context, }) {
|
|
48
|
+
const settings = section.settings ?? {};
|
|
49
|
+
const hidden = editable && !section.visible;
|
|
50
|
+
return (_jsxs("section", { ref: (el) => registerRef?.(section.id, el), "data-section-id": section.id, id: settings.anchorId || undefined, className: `relative ${backgroundClass(settings)} ${paddingClass(settings)} ${settings.cssClass ?? ''} ${hidden ? 'opacity-40' : ''} ${editable ? 'cursor-pointer outline-2 -outline-offset-2 transition-[outline]' : ''} ${selected ? 'outline outline-violet-500' : 'outline-transparent'}`, onClick: editable ? () => onSelect?.(section.id) : undefined, "aria-label": editable ? `${section.name} section` : undefined, children: [editable && selected && (_jsx("span", { className: "pointer-events-none absolute top-0 left-0 z-10 rounded-br-md bg-violet-600 px-2 py-0.5 text-xs font-medium text-white", children: section.name })), editable && hidden && (_jsx("span", { className: "pointer-events-none absolute top-0 right-0 z-10 rounded-bl-md bg-zinc-700 px-2 py-0.5 text-xs font-medium text-white", children: "Hidden" })), _jsx(SectionBody, { section: section, context: context })] }));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=SectionRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionRenderer.js","sourceRoot":"","sources":["../../../../src/views/page-editor/sections/SectionRenderer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAGZ,OAAO,EAAE,eAAe,EAAE,YAAY,EAA0B,MAAM,YAAY,CAAA;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBA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,SAAS,EAAC,sHAAsH,uBAE/H,CACR,EACD,KAAC,WAAW,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAI,IAC3C,CACX,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { SectionRenderer } from './SectionRenderer.js';
|
|
2
|
+
export type { SectionRendererProps } from './SectionRenderer.js';
|
|
3
|
+
export type { PostRenderContext } from './parts.js';
|
|
4
|
+
export { HeroBannerSection } from './HeroBannerSection.js';
|
|
5
|
+
export { MissionSection } from './MissionSection.js';
|
|
6
|
+
export { FeatureHighlightSection } from './FeatureHighlightSection.js';
|
|
7
|
+
export { ByTheNumbersSection } from './ByTheNumbersSection.js';
|
|
8
|
+
export { CtaBannerSection } from './CtaBannerSection.js';
|
|
9
|
+
export { ArticleBodySection } from './ArticleBodySection.js';
|
|
10
|
+
export { PullQuoteSection } from './PullQuoteSection.js';
|
|
11
|
+
export { AuthorBioSection } from './AuthorBioSection.js';
|
|
12
|
+
export { RelatedPostsSection } from './RelatedPostsSection.js';
|
|
13
|
+
export { GallerySection } from './GallerySection.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/page-editor/sections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAChE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { SectionRenderer } from './SectionRenderer.js';
|
|
2
|
+
export { HeroBannerSection } from './HeroBannerSection.js';
|
|
3
|
+
export { MissionSection } from './MissionSection.js';
|
|
4
|
+
export { FeatureHighlightSection } from './FeatureHighlightSection.js';
|
|
5
|
+
export { ByTheNumbersSection } from './ByTheNumbersSection.js';
|
|
6
|
+
export { CtaBannerSection } from './CtaBannerSection.js';
|
|
7
|
+
export { ArticleBodySection } from './ArticleBodySection.js';
|
|
8
|
+
export { PullQuoteSection } from './PullQuoteSection.js';
|
|
9
|
+
export { AuthorBioSection } from './AuthorBioSection.js';
|
|
10
|
+
export { RelatedPostsSection } from './RelatedPostsSection.js';
|
|
11
|
+
export { GallerySection } from './GallerySection.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/views/page-editor/sections/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAGtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared building blocks for the section renderers.
|
|
3
|
+
*
|
|
4
|
+
* NOTE ON STYLING: the components under `sections/` render the consumer's
|
|
5
|
+
* *public website* content (purple hero, white prose bands, etc.), not the
|
|
6
|
+
* admin chrome. They therefore use a small, fixed website palette (violet
|
|
7
|
+
* for primary, zinc for neutrals) instead of the admin theme tokens. This
|
|
8
|
+
* is deliberate and scoped to this folder so the preview looks like a real
|
|
9
|
+
* page; the surrounding editor UI still uses the admin design tokens.
|
|
10
|
+
*/
|
|
11
|
+
import type { SectionSettings } from '../section-types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Live post data passed to the post-oriented section renderers
|
|
14
|
+
* (article body, author bio, related posts). Pages never supply this, so
|
|
15
|
+
* every consumer treats it as optional and falls back to placeholder copy.
|
|
16
|
+
*/
|
|
17
|
+
export interface PostRenderContext {
|
|
18
|
+
title?: string;
|
|
19
|
+
excerpt?: string;
|
|
20
|
+
/** the post's main body copy (rendered by the Article Body section) */
|
|
21
|
+
body?: string;
|
|
22
|
+
featuredImageUrl?: string;
|
|
23
|
+
publishDate?: string | null;
|
|
24
|
+
category?: string;
|
|
25
|
+
author?: {
|
|
26
|
+
name?: string;
|
|
27
|
+
bio?: string;
|
|
28
|
+
avatarUrl?: string;
|
|
29
|
+
};
|
|
30
|
+
/** resolved related posts for the Related Posts section */
|
|
31
|
+
relatedPosts?: Array<{
|
|
32
|
+
title: string;
|
|
33
|
+
url?: string;
|
|
34
|
+
excerpt?: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
export declare function str(content: Record<string, unknown>, key: string, fallback?: string): string;
|
|
38
|
+
export declare function bool(content: Record<string, unknown>, key: string, fallback?: boolean): boolean;
|
|
39
|
+
/** Vertical padding scale for a section. */
|
|
40
|
+
export declare function paddingClass(settings: SectionSettings): string;
|
|
41
|
+
/** Returns true when the section background is the dark/purple treatment. */
|
|
42
|
+
export declare function isDarkBackground(settings: SectionSettings): boolean;
|
|
43
|
+
/** Background utility classes derived from settings. */
|
|
44
|
+
export declare function backgroundClass(settings: SectionSettings): string;
|
|
45
|
+
/**
|
|
46
|
+
* Preview-only button. `tone="onDark"` renders the white-on-purple button
|
|
47
|
+
* from the screenshot; `tone="primary"` renders a solid violet button for
|
|
48
|
+
* light backgrounds.
|
|
49
|
+
*/
|
|
50
|
+
export declare function PreviewButton({ label, href, tone, }: {
|
|
51
|
+
label: string;
|
|
52
|
+
href?: string;
|
|
53
|
+
tone?: 'primary' | 'onDark' | 'ghost';
|
|
54
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
55
|
+
//# sourceMappingURL=parts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parts.d.ts","sourceRoot":"","sources":["../../../../src/views/page-editor/sections/parts.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC5D,2DAA2D;IAC3D,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACxE;AAED,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAK,GAAG,MAAM,CAGxF;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,UAAQ,GAAG,OAAO,CAG7F;AAED,4CAA4C;AAC5C,wBAAgB,YAAY,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAY9D;AAED,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAKnE;AAED,wDAAwD;AACxD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,eAAe,GAAG,MAAM,CAWjE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,IAAI,EACJ,IAAgB,GACjB,EAAE;IACD,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAA;CACtC,kDAsBA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function str(content, key, fallback = '') {
|
|
3
|
+
const v = content[key];
|
|
4
|
+
return typeof v === 'string' ? v : fallback;
|
|
5
|
+
}
|
|
6
|
+
export function bool(content, key, fallback = false) {
|
|
7
|
+
const v = content[key];
|
|
8
|
+
return typeof v === 'boolean' ? v : fallback;
|
|
9
|
+
}
|
|
10
|
+
/** Vertical padding scale for a section. */
|
|
11
|
+
export function paddingClass(settings) {
|
|
12
|
+
switch (settings.paddingY) {
|
|
13
|
+
case 'sm':
|
|
14
|
+
return 'py-8';
|
|
15
|
+
case 'md':
|
|
16
|
+
return 'py-12';
|
|
17
|
+
case 'xl':
|
|
18
|
+
return 'py-20 sm:py-28';
|
|
19
|
+
case 'lg':
|
|
20
|
+
default:
|
|
21
|
+
return 'py-16 sm:py-20';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** Returns true when the section background is the dark/purple treatment. */
|
|
25
|
+
export function isDarkBackground(settings) {
|
|
26
|
+
return ((settings.backgroundType === 'solid' || settings.backgroundType === 'gradient') &&
|
|
27
|
+
settings.backgroundColor === 'purple');
|
|
28
|
+
}
|
|
29
|
+
/** Background utility classes derived from settings. */
|
|
30
|
+
export function backgroundClass(settings) {
|
|
31
|
+
if (settings.backgroundType === 'gradient' && settings.backgroundColor === 'purple') {
|
|
32
|
+
return 'bg-gradient-to-br from-violet-600 to-violet-700 text-white';
|
|
33
|
+
}
|
|
34
|
+
if (settings.backgroundType === 'solid' && settings.backgroundColor === 'purple') {
|
|
35
|
+
return 'bg-violet-600 text-white';
|
|
36
|
+
}
|
|
37
|
+
if (settings.backgroundType === 'solid' && settings.backgroundColor === 'muted') {
|
|
38
|
+
return 'bg-zinc-50 text-zinc-900';
|
|
39
|
+
}
|
|
40
|
+
return 'bg-white text-zinc-900';
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Preview-only button. `tone="onDark"` renders the white-on-purple button
|
|
44
|
+
* from the screenshot; `tone="primary"` renders a solid violet button for
|
|
45
|
+
* light backgrounds.
|
|
46
|
+
*/
|
|
47
|
+
export function PreviewButton({ label, href, tone = 'primary', }) {
|
|
48
|
+
if (!label)
|
|
49
|
+
return null;
|
|
50
|
+
const base = 'inline-flex items-center justify-center rounded-lg px-5 py-2.5 text-sm font-medium transition-colors';
|
|
51
|
+
const toneClass = tone === 'onDark'
|
|
52
|
+
? 'bg-white text-violet-700 hover:bg-violet-50'
|
|
53
|
+
: tone === 'ghost'
|
|
54
|
+
? 'border border-zinc-300 text-zinc-700 hover:bg-zinc-50'
|
|
55
|
+
: 'bg-violet-600 text-white hover:bg-violet-700';
|
|
56
|
+
// Editor preview: links are inert (preventDefault) so clicking content
|
|
57
|
+
// selects the section instead of navigating away.
|
|
58
|
+
return (_jsx("a", { href: href || '#', onClick: (e) => e.preventDefault(), className: `${base} ${toneClass}`, tabIndex: -1, children: label }));
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=parts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parts.js","sourceRoot":"","sources":["../../../../src/views/page-editor/sections/parts.tsx"],"names":[],"mappings":";AA8BA,MAAM,UAAU,GAAG,CAAC,OAAgC,EAAE,GAAW,EAAE,QAAQ,GAAG,EAAE;IAC9E,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IACtB,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;AAC7C,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,OAAgC,EAAE,GAAW,EAAE,QAAQ,GAAG,KAAK;IAClF,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;IACtB,OAAO,OAAO,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA;AAC9C,CAAC;AAED,4CAA4C;AAC5C,MAAM,UAAU,YAAY,CAAC,QAAyB;IACpD,QAAQ,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC1B,KAAK,IAAI;YACP,OAAO,MAAM,CAAA;QACf,KAAK,IAAI;YACP,OAAO,OAAO,CAAA;QAChB,KAAK,IAAI;YACP,OAA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AE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,EAClC,SAAS,EAAE,GAAG,IAAI,IAAI,SAAS,EAAE,EACjC,QAAQ,EAAE,CAAC,CAAC,YAEX,KAAK,GACJ,CACL,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Preview viewport presets for the page editor canvas. */
|
|
2
|
+
export type ViewportId = '4k' | '1080p' | 'laptop' | 'tablet' | 'mobile';
|
|
3
|
+
export interface Viewport {
|
|
4
|
+
id: ViewportId;
|
|
5
|
+
label: string;
|
|
6
|
+
/** lucide-react icon name */
|
|
7
|
+
icon: string;
|
|
8
|
+
/** logical CSS width of the preview surface, in px */
|
|
9
|
+
width: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const VIEWPORTS: Viewport[];
|
|
12
|
+
export declare const DEFAULT_VIEWPORT: ViewportId;
|
|
13
|
+
export declare function getViewport(id: ViewportId): Viewport;
|
|
14
|
+
//# sourceMappingURL=viewports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewports.d.ts","sourceRoot":"","sources":["../../../src/views/page-editor/viewports.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAC3D,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAExE,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,UAAU,CAAA;IACd,KAAK,EAAE,MAAM,CAAA;IACb,6BAA6B;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAA;CACd;AAED,eAAO,MAAM,SAAS,EAAE,QAAQ,EAM/B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,UAAoB,CAAA;AAEnD,wBAAgB,WAAW,CAAC,EAAE,EAAE,UAAU,GAAG,QAAQ,CAEpD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const VIEWPORTS = [
|
|
2
|
+
{ id: '4k', label: '4K', icon: 'monitor', width: 1920 },
|
|
3
|
+
{ id: '1080p', label: '1080p', icon: 'monitor', width: 1440 },
|
|
4
|
+
{ id: 'laptop', label: 'Laptop', icon: 'laptop', width: 1280 },
|
|
5
|
+
{ id: 'tablet', label: 'Tablet', icon: 'tablet', width: 768 },
|
|
6
|
+
{ id: 'mobile', label: 'Mobile', icon: 'smartphone', width: 390 },
|
|
7
|
+
];
|
|
8
|
+
export const DEFAULT_VIEWPORT = '1080p';
|
|
9
|
+
export function getViewport(id) {
|
|
10
|
+
return VIEWPORTS.find((v) => v.id === id) ?? VIEWPORTS[1];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=viewports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewports.js","sourceRoot":"","sources":["../../../src/views/page-editor/viewports.ts"],"names":[],"mappings":"AAYA,MAAM,CAAC,MAAM,SAAS,GAAe;IACnC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE;IACvD,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE;IAC7D,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE;IAC9D,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE;IAC7D,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,EAAE;CAClE,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAe,OAAO,CAAA;AAEnD,MAAM,UAAU,WAAW,CAAC,EAAc;IACxC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,IAAI,SAAS,CAAC,CAAC,CAAE,CAAA;AAC5D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PageSection, PostHeaderConfig } from '../../lib/post-editor-service.js';
|
|
2
|
+
import { type PostRenderContext } from '../page-editor/sections/index.js';
|
|
3
|
+
import { type ViewportId } from '../page-editor/viewports.js';
|
|
4
|
+
interface PostEditorCanvasProps {
|
|
5
|
+
sections: PageSection[];
|
|
6
|
+
header: PostHeaderConfig;
|
|
7
|
+
context: PostRenderContext;
|
|
8
|
+
selectedId: string | null;
|
|
9
|
+
viewport: ViewportId;
|
|
10
|
+
onSelect: (id: string) => void;
|
|
11
|
+
onAddSection: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Post preview canvas. Mirrors the Page editor canvas (scaled surface that
|
|
15
|
+
* fits the selected viewport) but renders the post header above the section
|
|
16
|
+
* list so the editor shows the full post layout — header regions plus body
|
|
17
|
+
* sections — exactly as it will ship.
|
|
18
|
+
*/
|
|
19
|
+
export declare function PostEditorCanvas({ sections, header, context, selectedId, viewport, onSelect, onAddSection, }: PostEditorCanvasProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=PostEditorCanvas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostEditorCanvas.d.ts","sourceRoot":"","sources":["../../../src/views/post-editor/PostEditorCanvas.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AACrF,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAC1F,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAG1E,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,WAAW,EAAE,CAAA;IACvB,MAAM,EAAE,gBAAgB,CAAA;IACxB,OAAO,EAAE,iBAAiB,CAAA;IAC1B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,QAAQ,EAAE,UAAU,CAAA;IACpB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,YAAY,EAAE,MAAM,IAAI,CAAA;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,MAAM,EACN,OAAO,EACP,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,YAAY,GACb,EAAE,qBAAqB,2CAoEvB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
import { FileText, Plus } from 'lucide-react';
|
|
5
|
+
import { SectionRenderer } from '../page-editor/sections/index.js';
|
|
6
|
+
import { getViewport } from '../page-editor/viewports.js';
|
|
7
|
+
import { PostHeader } from './PostHeader.js';
|
|
8
|
+
/**
|
|
9
|
+
* Post preview canvas. Mirrors the Page editor canvas (scaled surface that
|
|
10
|
+
* fits the selected viewport) but renders the post header above the section
|
|
11
|
+
* list so the editor shows the full post layout — header regions plus body
|
|
12
|
+
* sections — exactly as it will ship.
|
|
13
|
+
*/
|
|
14
|
+
export function PostEditorCanvas({ sections, header, context, selectedId, viewport, onSelect, onAddSection, }) {
|
|
15
|
+
const vp = getViewport(viewport);
|
|
16
|
+
const containerRef = useRef(null);
|
|
17
|
+
const surfaceRef = useRef(null);
|
|
18
|
+
const sectionRefs = useRef(new Map());
|
|
19
|
+
const [scale, setScale] = useState(1);
|
|
20
|
+
const [surfaceHeight, setSurfaceHeight] = useState(null);
|
|
21
|
+
const registerRef = useCallback((id, el) => {
|
|
22
|
+
if (el)
|
|
23
|
+
sectionRefs.current.set(id, el);
|
|
24
|
+
else
|
|
25
|
+
sectionRefs.current.delete(id);
|
|
26
|
+
}, []);
|
|
27
|
+
useLayoutEffect(() => {
|
|
28
|
+
const container = containerRef.current;
|
|
29
|
+
if (!container)
|
|
30
|
+
return;
|
|
31
|
+
const recompute = () => {
|
|
32
|
+
const available = container.clientWidth - 48;
|
|
33
|
+
const next = Math.min(1, available / vp.width);
|
|
34
|
+
setScale(next > 0 ? next : 1);
|
|
35
|
+
if (surfaceRef.current) {
|
|
36
|
+
setSurfaceHeight(surfaceRef.current.offsetHeight * (next > 0 ? next : 1));
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
recompute();
|
|
40
|
+
const ro = new ResizeObserver(recompute);
|
|
41
|
+
ro.observe(container);
|
|
42
|
+
if (surfaceRef.current)
|
|
43
|
+
ro.observe(surfaceRef.current);
|
|
44
|
+
return () => ro.disconnect();
|
|
45
|
+
}, [vp.width, sections, header, context]);
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
if (!selectedId)
|
|
48
|
+
return;
|
|
49
|
+
const el = sectionRefs.current.get(selectedId);
|
|
50
|
+
if (el)
|
|
51
|
+
el.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
|
52
|
+
}, [selectedId]);
|
|
53
|
+
return (_jsx("div", { ref: containerRef, className: "bg-muted h-full overflow-auto p-6", children: _jsx("div", { className: "mx-auto", style: { width: vp.width * scale, height: surfaceHeight ?? undefined }, children: _jsxs("div", { ref: surfaceRef, className: "border-border origin-top overflow-hidden rounded-xl border bg-white shadow-sm", style: { width: vp.width, transform: `scale(${scale})`, transformOrigin: 'top left' }, children: [_jsx(PostHeader, { config: header, context: context }), sections.length === 0 ? (_jsx(EmptyBody, { onAddSection: onAddSection })) : (sections.map((section) => (_jsx(SectionRenderer, { section: section, context: context, editable: true, selected: section.id === selectedId, onSelect: onSelect, registerRef: registerRef }, section.id))))] }) }) }));
|
|
54
|
+
}
|
|
55
|
+
function EmptyBody({ onAddSection }) {
|
|
56
|
+
return (_jsxs("div", { className: "flex flex-col items-center justify-center gap-3 border-t border-zinc-100 px-6 py-16 text-center", children: [_jsx("span", { className: "flex h-12 w-12 items-center justify-center rounded-full bg-zinc-100", children: _jsx(FileText, { className: "h-5 w-5 text-zinc-400", "aria-hidden": true }) }), _jsx("p", { className: "text-sm text-zinc-500", children: "The header is set by the template. Add body sections to build out this post." }), _jsxs("button", { type: "button", onClick: onAddSection, className: "inline-flex items-center gap-2 rounded-lg bg-violet-600 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-violet-700", children: [_jsx(Plus, { className: "h-4 w-4", "aria-hidden": true }), "Add Section"] })] }));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=PostEditorCanvas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostEditorCanvas.js","sourceRoot":"","sources":["../../../src/views/post-editor/PostEditorCanvas.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACjF,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAAE,eAAe,EAA0B,MAAM,kCAAkC,CAAA;AAC1F,OAAO,EAAE,WAAW,EAAmB,MAAM,6BAA6B,CAAA;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAY5C;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,QAAQ,EACR,MAAM,EACN,OAAO,EACP,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,YAAY,GACU;IACtB,MAAM,EAAE,GAAG,WAAW,CAAC,QAAQ,CAAC,CAAA;IAChC,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAA;IACj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,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACxB,KAAC,eAAe,IAEd,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,OAAO,EAChB,QAAQ,QACR,QAAQ,EAAE,OAAO,CAAC,EAAE,KAAK,UAAU,EACnC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,IANnB,OAAO,CAAC,EAAE,CAOf,CACH,CAAC,CACH,IACG,GACF,GACF,CACP,CAAA;AACH,CAAC;AAED,SAAS,SAAS,CAAC,EAAE,YAAY,EAAgC;IAC/D,OAAO,CACL,eAAK,SAAS,EAAC,iGAAiG,aAC9G,eAAM,SAAS,EAAC,qEAAqE,YACnF,KAAC,QAAQ,IAAC,SAAS,EAAC,uBAAuB,wBAAe,GACrD,EACP,YAAG,SAAS,EAAC,uBAAuB,6FAEhC,EACJ,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,YAAY,EACrB,SAAS,EAAC,wIAAwI,aAElJ,KAAC,IAAI,IAAC,SAAS,EAAC,SAAS,wBAAe,mBAEjC,IACL,CACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EditorPost } from '../../lib/post-editor-service.js';
|
|
2
|
+
interface PostFieldsModalProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
post: EditorPost;
|
|
5
|
+
canEdit: boolean;
|
|
6
|
+
onClose: () => void;
|
|
7
|
+
onSave: (patch: Partial<EditorPost>) => void;
|
|
8
|
+
}
|
|
9
|
+
/** Edits post-level fields: title, slug, excerpt, featured image, category, body, SEO. */
|
|
10
|
+
export declare function PostFieldsModal({ open, post, canEdit, onClose, onSave }: PostFieldsModalProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=PostFieldsModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostFieldsModal.d.ts","sourceRoot":"","sources":["../../../src/views/post-editor/PostFieldsModal.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAElE,UAAU,oBAAoB;IAC5B,IAAI,EAAE,OAAO,CAAA;IACb,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,IAAI,CAAA;CAC7C;AAcD,0FAA0F;AAC1F,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,oBAAoB,2CAuK7F"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { Modal } from '../../components/ui/Modal.js';
|
|
5
|
+
import { Button } from '../../components/ui/Button.js';
|
|
6
|
+
const LABEL = 'text-foreground mb-1 block text-xs font-medium';
|
|
7
|
+
const INPUT = 'border-input bg-input-background text-foreground focus-visible:ring-ring w-full rounded-md border px-2.5 py-1.5 text-sm focus-visible:ring-2 focus-visible:outline-none';
|
|
8
|
+
function slugify(value) {
|
|
9
|
+
return value
|
|
10
|
+
.toLowerCase()
|
|
11
|
+
.trim()
|
|
12
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
13
|
+
.replace(/^-+|-+$/g, '');
|
|
14
|
+
}
|
|
15
|
+
/** Edits post-level fields: title, slug, excerpt, featured image, category, body, SEO. */
|
|
16
|
+
export function PostFieldsModal({ open, post, canEdit, onClose, onSave }) {
|
|
17
|
+
const [title, setTitle] = useState(post.title);
|
|
18
|
+
const [slug, setSlug] = useState(post.slug);
|
|
19
|
+
const [excerpt, setExcerpt] = useState(post.excerpt);
|
|
20
|
+
const [featuredImage, setFeaturedImage] = useState(post.featuredImage);
|
|
21
|
+
const [category, setCategory] = useState(post.category);
|
|
22
|
+
const [body, setBody] = useState(post.body);
|
|
23
|
+
const [seoTitle, setSeoTitle] = useState(post.seoTitle);
|
|
24
|
+
const [seoDescription, setSeoDescription] = useState(post.seoDescription);
|
|
25
|
+
const [slugTouched, setSlugTouched] = useState(Boolean(post.slug));
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
if (!open)
|
|
28
|
+
return;
|
|
29
|
+
setTitle(post.title);
|
|
30
|
+
setSlug(post.slug);
|
|
31
|
+
setExcerpt(post.excerpt);
|
|
32
|
+
setFeaturedImage(post.featuredImage);
|
|
33
|
+
setCategory(post.category);
|
|
34
|
+
setBody(post.body);
|
|
35
|
+
setSeoTitle(post.seoTitle);
|
|
36
|
+
setSeoDescription(post.seoDescription);
|
|
37
|
+
setSlugTouched(Boolean(post.slug));
|
|
38
|
+
}, [open, post]);
|
|
39
|
+
function handleTitle(next) {
|
|
40
|
+
setTitle(next);
|
|
41
|
+
if (!slugTouched)
|
|
42
|
+
setSlug(slugify(next));
|
|
43
|
+
}
|
|
44
|
+
function handleSave() {
|
|
45
|
+
onSave({ title, slug, excerpt, featuredImage, category, body, seoTitle, seoDescription });
|
|
46
|
+
onClose();
|
|
47
|
+
}
|
|
48
|
+
return (_jsx(Modal, { open: open, onClose: onClose, title: "Post details", actions: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "ghost", onClick: onClose, children: "Cancel" }), _jsx(Button, { variant: "primary", onClick: handleSave, disabled: !canEdit, children: "Done" })] }), children: _jsxs("div", { className: "space-y-3", children: [_jsxs("div", { children: [_jsxs("label", { className: LABEL, htmlFor: "pf-title", children: ["Title ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx("input", { id: "pf-title", className: INPUT, value: title, disabled: !canEdit, onChange: (e) => handleTitle(e.target.value) })] }), _jsxs("div", { className: "grid grid-cols-2 gap-3", children: [_jsxs("div", { children: [_jsxs("label", { className: LABEL, htmlFor: "pf-slug", children: ["Slug ", _jsx("span", { className: "text-destructive", children: "*" })] }), _jsx("input", { id: "pf-slug", className: INPUT, value: slug, disabled: !canEdit, onChange: (e) => {
|
|
49
|
+
setSlugTouched(true);
|
|
50
|
+
setSlug(slugify(e.target.value));
|
|
51
|
+
} })] }), _jsxs("div", { children: [_jsx("label", { className: LABEL, htmlFor: "pf-category", children: "Category" }), _jsx("input", { id: "pf-category", className: INPUT, value: category, disabled: !canEdit, placeholder: "e.g. Product", onChange: (e) => setCategory(e.target.value) })] })] }), _jsxs("div", { children: [_jsx("label", { className: LABEL, htmlFor: "pf-excerpt", children: "Excerpt" }), _jsx("textarea", { id: "pf-excerpt", className: `${INPUT} min-h-[60px] resize-y`, value: excerpt, disabled: !canEdit, placeholder: "A short summary shown in listings and the header.", onChange: (e) => setExcerpt(e.target.value) })] }), _jsxs("div", { children: [_jsx("label", { className: LABEL, htmlFor: "pf-image", children: "Featured image URL" }), _jsx("input", { id: "pf-image", className: INPUT, value: featuredImage, disabled: !canEdit, placeholder: "https://\u2026", onChange: (e) => setFeaturedImage(e.target.value) }), featuredImage && (_jsx("div", { className: "border-border bg-muted mt-2 overflow-hidden rounded-md border", children: _jsx("img", { src: featuredImage, alt: "", className: "h-28 w-full object-cover" }) }))] }), _jsxs("div", { children: [_jsx("label", { className: LABEL, htmlFor: "pf-body", children: "Body" }), _jsx("textarea", { id: "pf-body", className: `${INPUT} min-h-[120px] resize-y`, value: body, disabled: !canEdit, placeholder: "The main post content. Shown by the Article Body section.", onChange: (e) => setBody(e.target.value) }), _jsx("p", { className: "text-muted-foreground mt-1 text-xs", children: "Rendered by the Article Body section when its source is set to the post Body field." })] }), _jsxs("div", { children: [_jsx("label", { className: LABEL, htmlFor: "pf-seo-title", children: "SEO title" }), _jsx("input", { id: "pf-seo-title", className: INPUT, value: seoTitle, disabled: !canEdit, onChange: (e) => setSeoTitle(e.target.value) })] }), _jsxs("div", { children: [_jsx("label", { className: LABEL, htmlFor: "pf-seo-desc", children: "SEO description" }), _jsx("textarea", { id: "pf-seo-desc", className: `${INPUT} min-h-[60px] resize-y`, value: seoDescription, disabled: !canEdit, onChange: (e) => setSeoDescription(e.target.value) })] })] }) }));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=PostFieldsModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostFieldsModal.js","sourceRoot":"","sources":["../../../src/views/post-editor/PostFieldsModal.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,8BAA8B,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAWtD,MAAM,KAAK,GAAG,gDAAgD,CAAA;AAC9D,MAAM,KAAK,GACT,yKAAyK,CAAA;AAE3K,SAAS,OAAO,CAAC,KAAa;IAC5B,OAAO,KAAK;SACT,WAAW,EAAE;SACb,IAAI,EAAE;SACN,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;AAC5B,CAAC;AAED,0FAA0F;AAC1F,MAAM,UAAU,eAAe,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAwB;IAC5F,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAC9C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3C,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IACpD,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,aA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,EAAE,EAAC,SAAS,EACZ,SAAS,EAAE,GAAG,KAAK,yBAAyB,EAC5C,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CAAC,OAAO,EAClB,WAAW,EAAC,2DAA2D,EACvE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GACxC,EACF,YAAG,SAAS,EAAC,oCAAoC,oGAE7C,IACA,EACN,0BACE,gBAAO,SAAS,EAAE,KAAK,EAAE,OAAO,EAAC,cAAc,0BAEvC,EACR,gBACE,EAAE,EAAC,cAAc,EACjB,SAAS,EAAE,KAAK,EAChB,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,CAAC,OAAO,EAClB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAC5C,IACE,EACN,0BACE,gBAAO,SAAS,EAAE,KAAK,EAAE,OAAO,EAAC,aAAa,gCAEtC,EACR,mBACE,EAAE,EAAC,aAAa,EAChB,SAAS,EAAE,GAAG,KAAK,wBAAwB,EAC3C,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,CAAC,OAAO,EAClB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAClD,IACE,IACF,GACA,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PostHeaderConfig } from '../page-editor/section-types.js';
|
|
2
|
+
import type { PostRenderContext } from '../page-editor/sections/index.js';
|
|
3
|
+
interface PostHeaderProps {
|
|
4
|
+
config: PostHeaderConfig;
|
|
5
|
+
context: PostRenderContext;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Renders a post's header region from the template's design config plus the
|
|
9
|
+
* post's own field values. Uses the same fixed website palette as the
|
|
10
|
+
* section renderers (see sections/parts.tsx) so the editor canvas and the
|
|
11
|
+
* public preview match.
|
|
12
|
+
*/
|
|
13
|
+
export declare function PostHeader({ config, context }: PostHeaderProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=PostHeader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostHeader.d.ts","sourceRoot":"","sources":["../../../src/views/post-editor/PostHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AAEzE,UAAU,eAAe;IACvB,MAAM,EAAE,gBAAgB,CAAA;IACxB,OAAO,EAAE,iBAAiB,CAAA;CAC3B;AASD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,eAAe,2CAiE9D"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
function formatDate(value) {
|
|
3
|
+
if (!value)
|
|
4
|
+
return '';
|
|
5
|
+
const d = new Date(value);
|
|
6
|
+
if (Number.isNaN(d.getTime()))
|
|
7
|
+
return '';
|
|
8
|
+
return d.toLocaleDateString(undefined, { year: 'numeric', month: 'long', day: 'numeric' });
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Renders a post's header region from the template's design config plus the
|
|
12
|
+
* post's own field values. Uses the same fixed website palette as the
|
|
13
|
+
* section renderers (see sections/parts.tsx) so the editor canvas and the
|
|
14
|
+
* public preview match.
|
|
15
|
+
*/
|
|
16
|
+
export function PostHeader({ config, context }) {
|
|
17
|
+
const title = context.title || 'Untitled post';
|
|
18
|
+
const date = config.showDate ? formatDate(context.publishDate) : '';
|
|
19
|
+
const overlay = config.layout === 'overlay' && config.showFeaturedImage && context.featuredImageUrl;
|
|
20
|
+
const align = config.layout === 'centered' ? 'text-center mx-auto items-center' : 'text-left';
|
|
21
|
+
const meta = (_jsxs("div", { className: `mt-4 flex flex-wrap gap-x-3 gap-y-1 text-sm ${config.layout === 'centered' ? 'justify-center' : ''} ${overlay ? 'text-white/80' : 'text-zinc-500'}`, children: [config.showCategory && context.category && (_jsx("span", { className: "font-medium text-violet-500", children: context.category })), config.showAuthor && _jsx("span", { children: context.author?.name || 'Author name' }), date && _jsx("span", { children: date }), config.showReadingTime && _jsx("span", { children: "5 min read" })] }));
|
|
22
|
+
if (overlay) {
|
|
23
|
+
return (_jsxs("header", { className: "relative", children: [_jsx("img", { src: context.featuredImageUrl, alt: "", className: "h-[360px] w-full object-cover" }), _jsx("div", { className: "absolute inset-0 bg-gradient-to-t from-black/70 to-black/10", "aria-hidden": true }), _jsx("div", { className: "absolute inset-x-0 bottom-0 px-6 pb-8", children: _jsxs("div", { className: `mx-auto flex max-w-3xl flex-col ${align}`, children: [_jsx("h1", { className: "text-3xl font-semibold tracking-tight text-white sm:text-4xl", children: title }), config.showExcerpt && context.excerpt && (_jsx("p", { className: "mt-3 max-w-2xl text-lg text-white/90", children: context.excerpt })), meta] }) })] }));
|
|
24
|
+
}
|
|
25
|
+
return (_jsxs("header", { className: "bg-white px-6 pt-12 pb-2", children: [_jsxs("div", { className: `flex max-w-3xl flex-col ${align} ${config.layout === 'centered' ? 'mx-auto' : ''}`, children: [config.showCategory && context.category && config.layout !== 'centered' && null, _jsx("h1", { className: "text-3xl font-semibold tracking-tight text-zinc-900 sm:text-4xl", children: title }), config.showExcerpt && context.excerpt && (_jsx("p", { className: "mt-3 max-w-2xl text-lg text-zinc-600", children: context.excerpt })), meta] }), config.showFeaturedImage && context.featuredImageUrl && (_jsx("div", { className: "mx-auto mt-8 max-w-4xl", children: _jsx("img", { src: context.featuredImageUrl, alt: "", className: "aspect-[16/9] w-full rounded-xl object-cover" }) }))] }));
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=Post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E,EACA,IAAI,IACD,EACL,MAAM,CAAC,iBAAiB,IAAI,OAAO,CAAC,gBAAgB,IAAI,CACvD,cAAK,SAAS,EAAC,wBAAwB,YACrC,cACE,GAAG,EAAE,OAAO,CAAC,gBAAgB,EAC7B,GAAG,EAAC,EAAE,EACN,SAAS,EAAC,8CAA8C,GACxD,GACE,CACP,IACM,CACV,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PostHeaderConfig } from '../../lib/post-editor-service.js';
|
|
2
|
+
interface PostHeaderPanelProps {
|
|
3
|
+
header: PostHeaderConfig;
|
|
4
|
+
canEdit: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
onChange: (patch: Partial<PostHeaderConfig>) => void;
|
|
7
|
+
}
|
|
8
|
+
/** Inspector panel for the post header layout (template-level design config). */
|
|
9
|
+
export declare function PostHeaderPanel({ header, canEdit, onClose, onChange }: PostHeaderPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=PostHeaderPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostHeaderPanel.d.ts","sourceRoot":"","sources":["../../../src/views/post-editor/PostHeaderPanel.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAA;AAExE,UAAU,oBAAoB;IAC5B,MAAM,EAAE,gBAAgB,CAAA;IACxB,OAAO,EAAE,OAAO,CAAA;IAChB,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAA;CACrD;AAeD,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,oBAAoB,2CAgF3F"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { X } from 'lucide-react';
|
|
4
|
+
const LABEL = 'text-foreground mb-1 block text-xs font-medium';
|
|
5
|
+
const INPUT = 'border-input bg-input-background text-foreground focus-visible:ring-ring w-full rounded-md border px-2.5 py-1.5 text-sm focus-visible:ring-2 focus-visible:outline-none';
|
|
6
|
+
const TOGGLES = [
|
|
7
|
+
{ key: 'showFeaturedImage', label: 'Featured image' },
|
|
8
|
+
{ key: 'showExcerpt', label: 'Excerpt' },
|
|
9
|
+
{ key: 'showAuthor', label: 'Author' },
|
|
10
|
+
{ key: 'showDate', label: 'Date' },
|
|
11
|
+
{ key: 'showCategory', label: 'Category' },
|
|
12
|
+
{ key: 'showReadingTime', label: 'Reading time' },
|
|
13
|
+
];
|
|
14
|
+
/** Inspector panel for the post header layout (template-level design config). */
|
|
15
|
+
export function PostHeaderPanel({ header, canEdit, onClose, onChange }) {
|
|
16
|
+
return (_jsxs("aside", { role: "dialog", "aria-label": "Edit post header", className: "bg-card border-border flex h-full w-80 shrink-0 flex-col border-l", children: [_jsxs("div", { className: "border-border flex items-center justify-between border-b px-4 py-3", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h2", { className: "text-foreground truncate text-sm font-medium", children: "Post header" }), _jsx("p", { className: "text-muted-foreground text-xs", children: "Layout for every post of this type" })] }), _jsx("button", { type: "button", onClick: onClose, "aria-label": "Close header panel", className: "text-muted-foreground hover:text-foreground hover:bg-accent rounded p-1", children: _jsx(X, { className: "h-4 w-4", "aria-hidden": true }) })] }), _jsxs("div", { className: "flex-1 space-y-6 overflow-y-auto p-4", children: [_jsxs("fieldset", { disabled: !canEdit, className: "space-y-3", children: [_jsx("legend", { className: "text-muted-foreground mb-2 text-[10px] font-semibold tracking-wider uppercase", children: "Layout" }), _jsxs("div", { children: [_jsx("label", { className: LABEL, htmlFor: "ph-layout", children: "Header style" }), _jsxs("select", { id: "ph-layout", className: INPUT, value: header.layout, onChange: (e) => onChange({ layout: e.target.value }), children: [_jsx("option", { value: "centered", children: "Centered" }), _jsx("option", { value: "left", children: "Left-aligned" }), _jsx("option", { value: "overlay", children: "Image overlay" })] })] })] }), _jsxs("fieldset", { disabled: !canEdit, className: "space-y-2", children: [_jsx("legend", { className: "text-muted-foreground mb-2 text-[10px] font-semibold tracking-wider uppercase", children: "Show in header" }), TOGGLES.map((t) => {
|
|
17
|
+
const value = header[t.key] === true;
|
|
18
|
+
return (_jsxs("button", { type: "button", role: "switch", "aria-checked": value, disabled: !canEdit, onClick: () => onChange({ [t.key]: !value }), className: "border-border text-foreground hover:bg-accent flex w-full items-center justify-between rounded-md border px-2.5 py-1.5 text-sm disabled:opacity-50", children: [_jsx("span", { children: t.label }), _jsx("span", { "aria-hidden": true, className: `relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors ${value ? 'bg-primary' : 'bg-muted'}`, children: _jsx("span", { className: `inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${value ? 'translate-x-4' : 'translate-x-0.5'}` }) })] }, t.key));
|
|
19
|
+
})] })] })] }));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=PostHeaderPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostHeaderPanel.js","sourceRoot":"","sources":["../../../src/views/post-editor/PostHeaderPanel.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAA;AAUhC,MAAM,KAAK,GAAG,gDAAgD,CAAA;AAC9D,MAAM,KAAK,GACT,yKAAyK,CAAA;AAE3K,MAAM,OAAO,GAA0D;IACrE,EAAE,GAAG,EAAE,mBAAmB,EAAE,KAAK,EAAE,gBAAgB,EAAE;IACrD,EAAE,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE;IACxC,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE;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AuB,IACvC,IACL,IACG,EAEX,oBAAU,QAAQ,EAAE,CAAC,OAAO,EAAE,SAAS,EAAC,WAAW,aACjD,iBAAQ,SAAS,EAAC,+EAA+E,+BAExF,EACR,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;gCACjB,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,CAAA;gCACpC,OAAO,CACL,kBAEE,IAAI,EAAC,QAAQ,EACb,IAAI,EAAC,QAAQ,kBACC,KAAK,EACnB,QAAQ,EAAE,CAAC,OAAO,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAA+B,CAAC,EACzE,SAAS,EAAC,oJAAoJ,aAE9J,yBAAO,CAAC,CAAC,KAAK,GAAQ,EACtB,oCAEE,SAAS,EAAE,qFACT,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,UACzB,EAAE,YAEF,eACE,SAAS,EAAE,6EACT,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,iBAC5B,EAAE,GACF,GACG,KApBF,CAAC,CAAC,GAAG,CAqBH,CACV,CAAA;4BACH,CAAC,CAAC,IACO,IACP,IACA,CACT,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface PostPreviewProps {
|
|
2
|
+
postType: string;
|
|
3
|
+
documentId: string;
|
|
4
|
+
session?: any;
|
|
5
|
+
onNavigate: (path: string) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Chrome-free render of a post using the same header + section renderers as
|
|
9
|
+
* the editor canvas, so the preview reflects what ships. Only visible
|
|
10
|
+
* sections render (hidden ones are omitted, like the public page).
|
|
11
|
+
*/
|
|
12
|
+
export declare function PostPreview({ postType, documentId, session, onNavigate }: PostPreviewProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=PostPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PostPreview.d.ts","sourceRoot":"","sources":["../../../src/views/post-editor/PostPreview.tsx"],"names":[],"mappings":"AAcA,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CACnC;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,gBAAgB,2CAuF1F"}
|