@prenta/admin 0.92.0 → 0.93.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/CHANGELOG.md +552 -0
- package/design-system/tokens.css +173 -71
- package/design-system/tokens.json +244 -63
- package/design-system/tokens.scss +203 -98
- package/design-system/tokens.tailwind.cjs +93 -38
- package/dist/AdminRoot.d.ts +27 -6
- package/dist/AdminRoot.d.ts.map +1 -1
- package/dist/AdminRoot.js.map +1 -1
- package/dist/__tests__/components/breakpoint-controls.render.test.d.ts +2 -0
- package/dist/__tests__/components/breakpoint-controls.render.test.d.ts.map +1 -0
- package/dist/__tests__/components/breakpoint-controls.render.test.js +51 -0
- package/dist/__tests__/components/breakpoint-controls.render.test.js.map +1 -0
- package/dist/__tests__/components/canvas-edit-tip.render.test.d.ts +2 -0
- package/dist/__tests__/components/canvas-edit-tip.render.test.d.ts.map +1 -0
- package/dist/__tests__/components/canvas-edit-tip.render.test.js +37 -0
- package/dist/__tests__/components/canvas-edit-tip.render.test.js.map +1 -0
- package/dist/__tests__/components/editor-rail.render.test.d.ts +2 -0
- package/dist/__tests__/components/editor-rail.render.test.d.ts.map +1 -0
- package/dist/__tests__/components/editor-rail.render.test.js +138 -0
- package/dist/__tests__/components/editor-rail.render.test.js.map +1 -0
- package/dist/__tests__/components/media-block.render.test.d.ts +2 -0
- package/dist/__tests__/components/media-block.render.test.d.ts.map +1 -0
- package/dist/__tests__/components/media-block.render.test.js +108 -0
- package/dist/__tests__/components/media-block.render.test.js.map +1 -0
- package/dist/__tests__/components/page-audit-panel.render.test.d.ts +2 -0
- package/dist/__tests__/components/page-audit-panel.render.test.d.ts.map +1 -0
- package/dist/__tests__/components/page-audit-panel.render.test.js +59 -0
- package/dist/__tests__/components/page-audit-panel.render.test.js.map +1 -0
- package/dist/__tests__/components/reflow-meter.render.test.d.ts +2 -0
- package/dist/__tests__/components/reflow-meter.render.test.d.ts.map +1 -0
- package/dist/__tests__/components/reflow-meter.render.test.js +94 -0
- package/dist/__tests__/components/reflow-meter.render.test.js.map +1 -0
- package/dist/__tests__/components/seo-char-count.test.js +24 -6
- package/dist/__tests__/components/seo-char-count.test.js.map +1 -1
- package/dist/__tests__/components/serp-preview.render.test.d.ts +2 -0
- package/dist/__tests__/components/serp-preview.render.test.d.ts.map +1 -0
- package/dist/__tests__/components/serp-preview.render.test.js +25 -0
- package/dist/__tests__/components/serp-preview.render.test.js.map +1 -0
- package/dist/__tests__/lib/breakpoints.test.d.ts +2 -0
- package/dist/__tests__/lib/breakpoints.test.d.ts.map +1 -0
- package/dist/__tests__/lib/breakpoints.test.js +67 -0
- package/dist/__tests__/lib/breakpoints.test.js.map +1 -0
- package/dist/__tests__/lib/canvas-edit-chrome.test.d.ts +2 -0
- package/dist/__tests__/lib/canvas-edit-chrome.test.d.ts.map +1 -0
- package/dist/__tests__/lib/canvas-edit-chrome.test.js +44 -0
- package/dist/__tests__/lib/canvas-edit-chrome.test.js.map +1 -0
- package/dist/__tests__/lib/media-format.test.d.ts +2 -0
- package/dist/__tests__/lib/media-format.test.d.ts.map +1 -0
- package/dist/__tests__/lib/media-format.test.js +70 -0
- package/dist/__tests__/lib/media-format.test.js.map +1 -0
- package/dist/__tests__/lib/page-audit-input.test.d.ts +2 -0
- package/dist/__tests__/lib/page-audit-input.test.d.ts.map +1 -0
- package/dist/__tests__/lib/page-audit-input.test.js +122 -0
- package/dist/__tests__/lib/page-audit-input.test.js.map +1 -0
- package/dist/__tests__/lib/page-editor-service.test.js +2 -0
- package/dist/__tests__/lib/page-editor-service.test.js.map +1 -1
- package/dist/__tests__/lib/page-redirect.test.d.ts +2 -0
- package/dist/__tests__/lib/page-redirect.test.d.ts.map +1 -0
- package/dist/__tests__/lib/page-redirect.test.js +26 -0
- package/dist/__tests__/lib/page-redirect.test.js.map +1 -0
- package/dist/__tests__/lib/rail-width.test.d.ts +2 -0
- package/dist/__tests__/lib/rail-width.test.d.ts.map +1 -0
- package/dist/__tests__/lib/rail-width.test.js +69 -0
- package/dist/__tests__/lib/rail-width.test.js.map +1 -0
- package/dist/__tests__/lib/reflow-baseline.test.d.ts +2 -0
- package/dist/__tests__/lib/reflow-baseline.test.d.ts.map +1 -0
- package/dist/__tests__/lib/reflow-baseline.test.js +56 -0
- package/dist/__tests__/lib/reflow-baseline.test.js.map +1 -0
- package/dist/__tests__/lib/reflow-probe.test.d.ts +2 -0
- package/dist/__tests__/lib/reflow-probe.test.d.ts.map +1 -0
- package/dist/__tests__/lib/reflow-probe.test.js +73 -0
- package/dist/__tests__/lib/reflow-probe.test.js.map +1 -0
- package/dist/__tests__/styles/canvas-container-queries.test.d.ts +2 -0
- package/dist/__tests__/styles/canvas-container-queries.test.d.ts.map +1 -0
- package/dist/__tests__/styles/canvas-container-queries.test.js +87 -0
- package/dist/__tests__/styles/canvas-container-queries.test.js.map +1 -0
- package/dist/__tests__/styles/packaging.test.d.ts +2 -0
- package/dist/__tests__/styles/packaging.test.d.ts.map +1 -0
- package/dist/__tests__/styles/packaging.test.js +31 -0
- package/dist/__tests__/styles/packaging.test.js.map +1 -0
- package/dist/__tests__/styles/tokens-drift.test.d.ts +2 -0
- package/dist/__tests__/styles/tokens-drift.test.d.ts.map +1 -0
- package/dist/__tests__/styles/tokens-drift.test.js +92 -0
- package/dist/__tests__/styles/tokens-drift.test.js.map +1 -0
- package/dist/__tests__/views/admin-renderer-compat.test.d.ts +2 -0
- package/dist/__tests__/views/admin-renderer-compat.test.d.ts.map +1 -0
- package/dist/__tests__/views/admin-renderer-compat.test.js +43 -0
- package/dist/__tests__/views/admin-renderer-compat.test.js.map +1 -0
- package/dist/__tests__/views/admin-section-renderers.test.js +52 -4
- package/dist/__tests__/views/admin-section-renderers.test.js.map +1 -1
- package/dist/__tests__/views/editor-top-bar.render.test.js +1 -1
- package/dist/__tests__/views/editor-top-bar.render.test.js.map +1 -1
- package/dist/__tests__/views/page-tab.render.test.d.ts +2 -0
- package/dist/__tests__/views/page-tab.render.test.d.ts.map +1 -0
- package/dist/__tests__/views/page-tab.render.test.js +151 -0
- package/dist/__tests__/views/page-tab.render.test.js.map +1 -0
- package/dist/__tests__/views/section-class-parity.test.d.ts +2 -0
- package/dist/__tests__/views/section-class-parity.test.d.ts.map +1 -0
- package/dist/__tests__/views/section-class-parity.test.js +81 -0
- package/dist/__tests__/views/section-class-parity.test.js.map +1 -0
- package/dist/__tests__/views/sections-panel-design-owned.render.test.d.ts +2 -0
- package/dist/__tests__/views/sections-panel-design-owned.render.test.d.ts.map +1 -0
- package/dist/__tests__/views/sections-panel-design-owned.render.test.js +86 -0
- package/dist/__tests__/views/sections-panel-design-owned.render.test.js.map +1 -0
- package/dist/components/BreakpointPicker.d.ts +18 -0
- package/dist/components/BreakpointPicker.d.ts.map +1 -0
- package/dist/components/BreakpointPicker.js +31 -0
- package/dist/components/BreakpointPicker.js.map +1 -0
- package/dist/components/CanvasEditTip.d.ts +6 -0
- package/dist/components/CanvasEditTip.d.ts.map +1 -0
- package/dist/components/CanvasEditTip.js +22 -0
- package/dist/components/CanvasEditTip.js.map +1 -0
- package/dist/components/EditorRail.d.ts +36 -0
- package/dist/components/EditorRail.d.ts.map +1 -0
- package/dist/components/EditorRail.js +104 -0
- package/dist/components/EditorRail.js.map +1 -0
- package/dist/components/EditorRailTabs.d.ts +32 -0
- package/dist/components/EditorRailTabs.d.ts.map +1 -0
- package/dist/components/EditorRailTabs.js +45 -0
- package/dist/components/EditorRailTabs.js.map +1 -0
- package/dist/components/MediaBlock.d.ts +49 -0
- package/dist/components/MediaBlock.d.ts.map +1 -0
- package/dist/components/MediaBlock.js +50 -0
- package/dist/components/MediaBlock.js.map +1 -0
- package/dist/components/ReflowMeter.d.ts +28 -0
- package/dist/components/ReflowMeter.d.ts.map +1 -0
- package/dist/components/ReflowMeter.js +42 -0
- package/dist/components/ReflowMeter.js.map +1 -0
- package/dist/components/ZoomChip.d.ts +17 -0
- package/dist/components/ZoomChip.d.ts.map +1 -0
- package/dist/components/ZoomChip.js +17 -0
- package/dist/components/ZoomChip.js.map +1 -0
- package/dist/components/breakpoint-icons.d.ts +3 -0
- package/dist/components/breakpoint-icons.d.ts.map +1 -0
- package/dist/components/breakpoint-icons.js +16 -0
- package/dist/components/breakpoint-icons.js.map +1 -0
- package/dist/components/page-tab/AuthorPicker.d.ts +31 -0
- package/dist/components/page-tab/AuthorPicker.d.ts.map +1 -0
- package/dist/components/page-tab/AuthorPicker.js +95 -0
- package/dist/components/page-tab/AuthorPicker.js.map +1 -0
- package/dist/components/page-tab/DirectiveSwitch.d.ts +38 -0
- package/dist/components/page-tab/DirectiveSwitch.d.ts.map +1 -0
- package/dist/components/page-tab/DirectiveSwitch.js +29 -0
- package/dist/components/page-tab/DirectiveSwitch.js.map +1 -0
- package/dist/components/seo/EditorSeoScoreBadge.d.ts +8 -1
- package/dist/components/seo/EditorSeoScoreBadge.d.ts.map +1 -1
- package/dist/components/seo/EditorSeoScoreBadge.js +2 -2
- package/dist/components/seo/EditorSeoScoreBadge.js.map +1 -1
- package/dist/components/seo/PageAuditPanel.d.ts +14 -0
- package/dist/components/seo/PageAuditPanel.d.ts.map +1 -0
- package/dist/components/seo/PageAuditPanel.js +59 -0
- package/dist/components/seo/PageAuditPanel.js.map +1 -0
- package/dist/components/seo/SeoCharCount.d.ts +19 -7
- package/dist/components/seo/SeoCharCount.d.ts.map +1 -1
- package/dist/components/seo/SeoCharCount.js +30 -16
- package/dist/components/seo/SeoCharCount.js.map +1 -1
- package/dist/components/seo/SeoEditorPane.d.ts +15 -1
- package/dist/components/seo/SeoEditorPane.d.ts.map +1 -1
- package/dist/components/seo/SeoEditorPane.js +118 -21
- package/dist/components/seo/SeoEditorPane.js.map +1 -1
- package/dist/components/seo/SerpPreview.d.ts +20 -0
- package/dist/components/seo/SerpPreview.d.ts.map +1 -0
- package/dist/components/seo/SerpPreview.js +6 -0
- package/dist/components/seo/SerpPreview.js.map +1 -0
- package/dist/hooks/usePageAudit.d.ts +41 -0
- package/dist/hooks/usePageAudit.d.ts.map +1 -0
- package/dist/hooks/usePageAudit.js +68 -0
- package/dist/hooks/usePageAudit.js.map +1 -0
- package/dist/hooks/useReflowGuard.d.ts +47 -0
- package/dist/hooks/useReflowGuard.d.ts.map +1 -0
- package/dist/hooks/useReflowGuard.js +52 -0
- package/dist/hooks/useReflowGuard.js.map +1 -0
- package/dist/lib/breakpoints.d.ts +51 -0
- package/dist/lib/breakpoints.d.ts.map +1 -0
- package/dist/lib/breakpoints.js +84 -0
- package/dist/lib/breakpoints.js.map +1 -0
- package/dist/lib/canvas-edit-chrome.d.ts +22 -0
- package/dist/lib/canvas-edit-chrome.d.ts.map +1 -0
- package/dist/lib/canvas-edit-chrome.js +81 -0
- package/dist/lib/canvas-edit-chrome.js.map +1 -0
- package/dist/lib/media-format.d.ts +55 -0
- package/dist/lib/media-format.d.ts.map +1 -0
- package/dist/lib/media-format.js +93 -0
- package/dist/lib/media-format.js.map +1 -0
- package/dist/lib/page-audit-input.d.ts +45 -0
- package/dist/lib/page-audit-input.d.ts.map +1 -0
- package/dist/lib/page-audit-input.js +53 -0
- package/dist/lib/page-audit-input.js.map +1 -0
- package/dist/lib/page-editor-service.d.ts +12 -0
- package/dist/lib/page-editor-service.d.ts.map +1 -1
- package/dist/lib/page-editor-service.js +6 -0
- package/dist/lib/page-editor-service.js.map +1 -1
- package/dist/lib/page-redirect.d.ts +39 -0
- package/dist/lib/page-redirect.d.ts.map +1 -0
- package/dist/lib/page-redirect.js +38 -0
- package/dist/lib/page-redirect.js.map +1 -0
- package/dist/lib/rail-width.d.ts +23 -0
- package/dist/lib/rail-width.d.ts.map +1 -0
- package/dist/lib/rail-width.js +59 -0
- package/dist/lib/rail-width.js.map +1 -0
- package/dist/lib/reflow-baseline.d.ts +45 -0
- package/dist/lib/reflow-baseline.d.ts.map +1 -0
- package/dist/lib/reflow-baseline.js +38 -0
- package/dist/lib/reflow-baseline.js.map +1 -0
- package/dist/lib/reflow-probe.d.ts +159 -0
- package/dist/lib/reflow-probe.d.ts.map +1 -0
- package/dist/lib/reflow-probe.js +228 -0
- package/dist/lib/reflow-probe.js.map +1 -0
- package/dist/lib/seo-service.d.ts +10 -0
- package/dist/lib/seo-service.d.ts.map +1 -1
- package/dist/lib/seo-service.js.map +1 -1
- package/dist/prenta-admin.css +1 -1
- package/dist/views/page-editor/CanvasMetaLine.d.ts +19 -0
- package/dist/views/page-editor/CanvasMetaLine.d.ts.map +1 -0
- package/dist/views/page-editor/CanvasMetaLine.js +23 -0
- package/dist/views/page-editor/CanvasMetaLine.js.map +1 -0
- package/dist/views/page-editor/EditorCanvas.d.ts +34 -8
- package/dist/views/page-editor/EditorCanvas.d.ts.map +1 -1
- package/dist/views/page-editor/EditorCanvas.js +68 -34
- package/dist/views/page-editor/EditorCanvas.js.map +1 -1
- package/dist/views/page-editor/EditorTopBar.d.ts +14 -1
- package/dist/views/page-editor/EditorTopBar.d.ts.map +1 -1
- package/dist/views/page-editor/EditorTopBar.js +8 -17
- package/dist/views/page-editor/EditorTopBar.js.map +1 -1
- package/dist/views/page-editor/PageSectionEditor.d.ts.map +1 -1
- package/dist/views/page-editor/PageSectionEditor.js +275 -53
- package/dist/views/page-editor/PageSectionEditor.js.map +1 -1
- package/dist/views/page-editor/PageTab.d.ts +36 -0
- package/dist/views/page-editor/PageTab.d.ts.map +1 -0
- package/dist/views/page-editor/PageTab.js +65 -0
- package/dist/views/page-editor/PageTab.js.map +1 -0
- package/dist/views/page-editor/SectionInspector.d.ts.map +1 -1
- package/dist/views/page-editor/SectionInspector.js +63 -19
- package/dist/views/page-editor/SectionInspector.js.map +1 -1
- package/dist/views/page-editor/SectionsPanel.d.ts +30 -5
- package/dist/views/page-editor/SectionsPanel.d.ts.map +1 -1
- package/dist/views/page-editor/SectionsPanel.js +38 -7
- package/dist/views/page-editor/SectionsPanel.js.map +1 -1
- package/dist/views/page-editor/SitePreviewFrame.d.ts.map +1 -1
- package/dist/views/page-editor/SitePreviewFrame.js +3 -0
- package/dist/views/page-editor/SitePreviewFrame.js.map +1 -1
- package/dist/views/page-editor/reflow-context.d.ts +28 -0
- package/dist/views/page-editor/reflow-context.d.ts.map +1 -0
- package/dist/views/page-editor/reflow-context.js +14 -0
- package/dist/views/page-editor/reflow-context.js.map +1 -0
- package/dist/views/page-editor/sections/ByTheNumbersSection.d.ts.map +1 -1
- package/dist/views/page-editor/sections/ByTheNumbersSection.js +1 -1
- package/dist/views/page-editor/sections/ByTheNumbersSection.js.map +1 -1
- package/dist/views/page-editor/sections/CtaBannerSection.d.ts.map +1 -1
- package/dist/views/page-editor/sections/CtaBannerSection.js +1 -1
- package/dist/views/page-editor/sections/CtaBannerSection.js.map +1 -1
- package/dist/views/page-editor/sections/FeatureHighlightSection.d.ts.map +1 -1
- package/dist/views/page-editor/sections/FeatureHighlightSection.js +2 -2
- package/dist/views/page-editor/sections/FeatureHighlightSection.js.map +1 -1
- package/dist/views/page-editor/sections/GallerySection.d.ts.map +1 -1
- package/dist/views/page-editor/sections/GallerySection.js +7 -3
- package/dist/views/page-editor/sections/GallerySection.js.map +1 -1
- package/dist/views/page-editor/sections/HeroBannerSection.js +1 -1
- package/dist/views/page-editor/sections/HeroBannerSection.js.map +1 -1
- package/dist/views/page-editor/sections/MissionSection.d.ts.map +1 -1
- package/dist/views/page-editor/sections/MissionSection.js +1 -1
- package/dist/views/page-editor/sections/MissionSection.js.map +1 -1
- package/dist/views/page-editor/sections/PullQuoteSection.d.ts.map +1 -1
- package/dist/views/page-editor/sections/PullQuoteSection.js +1 -1
- package/dist/views/page-editor/sections/PullQuoteSection.js.map +1 -1
- package/dist/views/page-editor/sections/RelatedPostsSection.d.ts.map +1 -1
- package/dist/views/page-editor/sections/RelatedPostsSection.js +1 -1
- package/dist/views/page-editor/sections/RelatedPostsSection.js.map +1 -1
- package/dist/views/page-editor/sections/SectionRenderer.d.ts.map +1 -1
- package/dist/views/page-editor/sections/SectionRenderer.js +49 -24
- package/dist/views/page-editor/sections/SectionRenderer.js.map +1 -1
- package/dist/views/page-editor/sections/admin-renderers.d.ts +47 -15
- package/dist/views/page-editor/sections/admin-renderers.d.ts.map +1 -1
- package/dist/views/page-editor/sections/admin-renderers.js +27 -15
- package/dist/views/page-editor/sections/admin-renderers.js.map +1 -1
- package/dist/views/page-editor/sections/parts.d.ts +0 -1
- package/dist/views/page-editor/sections/parts.d.ts.map +1 -1
- package/dist/views/page-editor/sections/parts.js +41 -16
- package/dist/views/page-editor/sections/parts.js.map +1 -1
- package/dist/views/page-editor/viewports.d.ts +7 -14
- package/dist/views/page-editor/viewports.d.ts.map +1 -1
- package/dist/views/page-editor/viewports.js +7 -12
- package/dist/views/page-editor/viewports.js.map +1 -1
- package/dist/views/post-editor/PostEditorCanvas.d.ts +2 -1
- package/dist/views/post-editor/PostEditorCanvas.d.ts.map +1 -1
- package/dist/views/post-editor/PostEditorCanvas.js +5 -2
- package/dist/views/post-editor/PostEditorCanvas.js.map +1 -1
- package/dist/views/post-editor/PostSectionEditor.d.ts.map +1 -1
- package/dist/views/post-editor/PostSectionEditor.js +2 -20
- package/dist/views/post-editor/PostSectionEditor.js.map +1 -1
- package/dist/views/post-editor/PostTemplateEditor.d.ts.map +1 -1
- package/dist/views/post-editor/PostTemplateEditor.js +4 -1
- package/dist/views/post-editor/PostTemplateEditor.js.map +1 -1
- package/package.json +5 -3
- package/src/AdminRoot.tsx +27 -6
- package/src/__tests__/components/breakpoint-controls.render.test.tsx +57 -0
- package/src/__tests__/components/canvas-edit-tip.render.test.tsx +41 -0
- package/src/__tests__/components/editor-rail.render.test.tsx +192 -0
- package/src/__tests__/components/media-block.render.test.tsx +126 -0
- package/src/__tests__/components/page-audit-panel.render.test.tsx +64 -0
- package/src/__tests__/components/reflow-meter.render.test.tsx +144 -0
- package/src/__tests__/components/seo-char-count.test.tsx +26 -6
- package/src/__tests__/components/serp-preview.render.test.tsx +32 -0
- package/src/__tests__/lib/breakpoints.test.ts +84 -0
- package/src/__tests__/lib/canvas-edit-chrome.test.ts +56 -0
- package/src/__tests__/lib/media-format.test.ts +89 -0
- package/src/__tests__/lib/page-audit-input.test.ts +144 -0
- package/src/__tests__/lib/page-editor-service.test.ts +2 -0
- package/src/__tests__/lib/page-redirect.test.ts +29 -0
- package/src/__tests__/lib/rail-width.test.ts +86 -0
- package/src/__tests__/lib/reflow-baseline.test.ts +64 -0
- package/src/__tests__/lib/reflow-probe.test.ts +95 -0
- package/src/__tests__/styles/canvas-container-queries.test.ts +103 -0
- package/src/__tests__/styles/packaging.test.ts +38 -0
- package/src/__tests__/styles/tokens-drift.test.ts +110 -0
- package/src/__tests__/views/admin-renderer-compat.test.ts +48 -0
- package/src/__tests__/views/admin-section-renderers.test.tsx +70 -4
- package/src/__tests__/views/editor-top-bar.render.test.tsx +1 -1
- package/src/__tests__/views/page-tab.render.test.tsx +226 -0
- package/src/__tests__/views/section-class-parity.test.ts +98 -0
- package/src/__tests__/views/sections-panel-design-owned.render.test.tsx +104 -0
- package/src/components/BreakpointPicker.tsx +114 -0
- package/src/components/CanvasEditTip.tsx +46 -0
- package/src/components/EditorRail.tsx +219 -0
- package/src/components/EditorRailTabs.tsx +117 -0
- package/src/components/MediaBlock.tsx +223 -0
- package/src/components/ReflowMeter.tsx +125 -0
- package/src/components/ZoomChip.tsx +39 -0
- package/src/components/breakpoint-icons.ts +17 -0
- package/src/components/page-tab/AuthorPicker.tsx +240 -0
- package/src/components/page-tab/DirectiveSwitch.tsx +86 -0
- package/src/components/seo/EditorSeoScoreBadge.tsx +9 -1
- package/src/components/seo/PageAuditPanel.tsx +192 -0
- package/src/components/seo/SeoCharCount.tsx +55 -24
- package/src/components/seo/SeoEditorPane.tsx +213 -31
- package/src/components/seo/SerpPreview.tsx +41 -0
- package/src/hooks/usePageAudit.ts +98 -0
- package/src/hooks/useReflowGuard.ts +96 -0
- package/src/lib/breakpoints.ts +107 -0
- package/src/lib/canvas-edit-chrome.ts +82 -0
- package/src/lib/media-format.ts +99 -0
- package/src/lib/page-audit-input.ts +104 -0
- package/src/lib/page-editor-service.ts +18 -0
- package/src/lib/page-redirect.ts +60 -0
- package/src/lib/rail-width.ts +58 -0
- package/src/lib/reflow-baseline.ts +70 -0
- package/src/lib/reflow-probe.ts +299 -0
- package/src/lib/seo-service.ts +10 -0
- package/src/styles/prenta-tokens.css +120 -42
- package/src/styles/theme.css +130 -0
- package/src/views/page-editor/CanvasMetaLine.tsx +50 -0
- package/src/views/page-editor/EditorCanvas.tsx +109 -50
- package/src/views/page-editor/EditorTopBar.tsx +35 -43
- package/src/views/page-editor/PageSectionEditor.tsx +419 -148
- package/src/views/page-editor/PageTab.tsx +433 -0
- package/src/views/page-editor/SectionInspector.tsx +82 -41
- package/src/views/page-editor/SectionsPanel.tsx +281 -140
- package/src/views/page-editor/SitePreviewFrame.tsx +3 -0
- package/src/views/page-editor/reflow-context.ts +43 -0
- package/src/views/page-editor/sections/ByTheNumbersSection.tsx +3 -2
- package/src/views/page-editor/sections/CtaBannerSection.tsx +3 -1
- package/src/views/page-editor/sections/FeatureHighlightSection.tsx +3 -2
- package/src/views/page-editor/sections/GallerySection.tsx +7 -3
- package/src/views/page-editor/sections/HeroBannerSection.tsx +2 -2
- package/src/views/page-editor/sections/MissionSection.tsx +4 -2
- package/src/views/page-editor/sections/PullQuoteSection.tsx +3 -1
- package/src/views/page-editor/sections/RelatedPostsSection.tsx +2 -1
- package/src/views/page-editor/sections/SectionRenderer.tsx +69 -29
- package/src/views/page-editor/sections/admin-renderers.tsx +54 -15
- package/src/views/page-editor/sections/parts.tsx +46 -18
- package/src/views/page-editor/viewports.ts +13 -26
- package/src/views/post-editor/PostEditorCanvas.tsx +18 -11
- package/src/views/post-editor/PostSectionEditor.tsx +1 -56
- package/src/views/post-editor/PostTemplateEditor.tsx +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-editor-service.js","sourceRoot":"","sources":["../../src/lib/page-editor-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,IAAI,kBAAkB,EACpC,sBAAsB,GAEvB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAIhE,gEAAgE;AAChE,4EAA4E;AAC5E,OAAO,EACL,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,GAClB,CAAA;AAID,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"page-editor-service.js","sourceRoot":"","sources":["../../src/lib/page-editor-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AACjC,OAAO,EACL,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,IAAI,kBAAkB,EACpC,sBAAsB,GAEvB,MAAM,4BAA4B,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAIhE,gEAAgE;AAChE,4EAA4E;AAC5E,OAAO,EACL,aAAa,EACb,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,uBAAuB,EACvB,WAAW,EACX,eAAe,EACf,oBAAoB,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AgB,gBAAgB,IAAI,IAAI,CAAC,EAAE,EAAE;QAC/C,CAAC,CAAC,gBAAgB,gBAAgB,EAAE,CAAA;IACtC,MAAM,GAAG,GAAG,MAAM,MAAM,CAAiB,QAAQ,EAAE;QACjD,MAAM,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM;QAChC,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;KACjD,CAAC,CAAA;IACF,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,wBAAwB,CAAC,CAAA;IAClF,OAAO,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;AAClC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,eAA8B,IAAI;IAC1D,OAAO;QACL,EAAE,EAAE,IAAI;QACR,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,OAAO;QACf,YAAY;QACZ,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,EAAE;QACZ,cAAc,EAAE,EAAE;QAClB,WAAW,EAAE,IAAI;QACjB,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,IAAI;QACjB,oBAAoB,EAAE,IAAI;QAC1B,UAAU,EAAE,EAAE;QACd,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,KAAK;KACpB,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 301 an editor owes the web when a published page moves.
|
|
3
|
+
*
|
|
4
|
+
* ── Why this is offered rather than assumed ───────────────────────────────
|
|
5
|
+
*
|
|
6
|
+
* Changing the slug of a page that is already live breaks every inbound link
|
|
7
|
+
* to it — search results, other sites, someone's bookmarks — and the CMS is the
|
|
8
|
+
* only party that knows the old address. Leaving the editor to remember it
|
|
9
|
+
* afterwards means the 404s are discovered by visitors.
|
|
10
|
+
*
|
|
11
|
+
* It is offered rather than created silently because a redirect is a public,
|
|
12
|
+
* durable artifact: it outlives the page, and a wrong one is harder to notice
|
|
13
|
+
* than a missing one. The editor sees `old → new` and decides.
|
|
14
|
+
*/
|
|
15
|
+
export interface SlugChange {
|
|
16
|
+
from: string;
|
|
17
|
+
to: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The move worth redirecting, or `null`.
|
|
21
|
+
*
|
|
22
|
+
* `null` when the page has never been live (nothing out there points at the old
|
|
23
|
+
* path), when the path is unchanged, or when either side is empty — a redirect
|
|
24
|
+
* from or to nothing is not a redirect, and posting one would put a broken rule
|
|
25
|
+
* in a table that runs on every request.
|
|
26
|
+
*/
|
|
27
|
+
export declare function pendingSlugChange(publishedPath: string | null, currentPath: string): SlugChange | null;
|
|
28
|
+
/**
|
|
29
|
+
* Create the 301.
|
|
30
|
+
*
|
|
31
|
+
* Failure is reported, never swallowed. The page has already moved by the time
|
|
32
|
+
* this runs, so a silently-failed redirect leaves exactly the broken links the
|
|
33
|
+
* switch promised to prevent — and the editor would have no reason to suspect
|
|
34
|
+
* it.
|
|
35
|
+
*/
|
|
36
|
+
export declare function createPublishRedirect(change: SlugChange): Promise<{
|
|
37
|
+
error?: string;
|
|
38
|
+
}>;
|
|
39
|
+
//# sourceMappingURL=page-redirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-redirect.d.ts","sourceRoot":"","sources":["../../src/lib/page-redirect.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;CACX;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,aAAa,EAAE,MAAM,GAAG,IAAI,EAC5B,WAAW,EAAE,MAAM,GAClB,UAAU,GAAG,IAAI,CAKnB;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAY3F"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { cmsApi } from './api.js';
|
|
2
|
+
/**
|
|
3
|
+
* The move worth redirecting, or `null`.
|
|
4
|
+
*
|
|
5
|
+
* `null` when the page has never been live (nothing out there points at the old
|
|
6
|
+
* path), when the path is unchanged, or when either side is empty — a redirect
|
|
7
|
+
* from or to nothing is not a redirect, and posting one would put a broken rule
|
|
8
|
+
* in a table that runs on every request.
|
|
9
|
+
*/
|
|
10
|
+
export function pendingSlugChange(publishedPath, currentPath) {
|
|
11
|
+
const from = (publishedPath ?? '').trim();
|
|
12
|
+
const to = currentPath.trim();
|
|
13
|
+
if (!from || !to || from === to)
|
|
14
|
+
return null;
|
|
15
|
+
return { from, to };
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Create the 301.
|
|
19
|
+
*
|
|
20
|
+
* Failure is reported, never swallowed. The page has already moved by the time
|
|
21
|
+
* this runs, so a silently-failed redirect leaves exactly the broken links the
|
|
22
|
+
* switch promised to prevent — and the editor would have no reason to suspect
|
|
23
|
+
* it.
|
|
24
|
+
*/
|
|
25
|
+
export async function createPublishRedirect(change) {
|
|
26
|
+
const res = await cmsApi('/redirects', {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
body: JSON.stringify({
|
|
29
|
+
source: change.from,
|
|
30
|
+
destination: change.to,
|
|
31
|
+
statusCode: 301,
|
|
32
|
+
source_kind: 'manual',
|
|
33
|
+
notes: 'Created automatically when the page slug changed on publish.',
|
|
34
|
+
}),
|
|
35
|
+
});
|
|
36
|
+
return res.error ? { error: res.error } : {};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=page-redirect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-redirect.js","sourceRoot":"","sources":["../../src/lib/page-redirect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAqBjC;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,aAA4B,EAC5B,WAAmB;IAEnB,MAAM,IAAI,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;IACzC,MAAM,EAAE,GAAG,WAAW,CAAC,IAAI,EAAE,CAAA;IAC7B,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,IAAI,CAAA;IAC5C,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,CAAA;AACrB,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAAkB;IAC5D,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,YAAY,EAAE;QACrC,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,MAAM,EAAE,MAAM,CAAC,IAAI;YACnB,WAAW,EAAE,MAAM,CAAC,EAAE;YACtB,UAAU,EAAE,GAAG;YACf,WAAW,EAAE,QAAQ;YACrB,KAAK,EAAE,8DAA8D;SACtE,CAAC;KACH,CAAC,CAAA;IACF,OAAO,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AAC9C,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor rail sizing — pure logic, no DOM, so the clamping and persistence
|
|
3
|
+
* rules are testable without mounting a resizable panel.
|
|
4
|
+
*/
|
|
5
|
+
export declare const RAIL_MIN_WIDTH = 300;
|
|
6
|
+
export declare const RAIL_MAX_WIDTH = 620;
|
|
7
|
+
export declare const RAIL_DEFAULT_WIDTH = 360;
|
|
8
|
+
/** Width of the strip that replaces the rail when it is collapsed. */
|
|
9
|
+
export declare const RAIL_COLLAPSED_WIDTH = 38;
|
|
10
|
+
export declare const RAIL_WIDTH_STORAGE_KEY = "pb.panelW";
|
|
11
|
+
/** Constrain a candidate width to the rail's range, rejecting junk. */
|
|
12
|
+
export declare function clampRailWidth(width: number): number;
|
|
13
|
+
/**
|
|
14
|
+
* Read the persisted width. Anything unreadable — no storage, a value written
|
|
15
|
+
* by an older build, a user editing localStorage — falls back to the default
|
|
16
|
+
* rather than throwing or producing a broken layout.
|
|
17
|
+
*
|
|
18
|
+
* Storage access is wrapped: Safari in private mode throws on `getItem`, and a
|
|
19
|
+
* rail that cannot size itself must not take down the editor.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readRailWidth(storage?: Pick<Storage, 'getItem'>): number;
|
|
22
|
+
export declare function writeRailWidth(width: number, storage?: Pick<Storage, 'setItem'>): void;
|
|
23
|
+
//# sourceMappingURL=rail-width.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rail-width.d.ts","sourceRoot":"","sources":["../../src/lib/rail-width.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,cAAc,MAAM,CAAA;AACjC,eAAO,MAAM,cAAc,MAAM,CAAA;AACjC,eAAO,MAAM,kBAAkB,MAAM,CAAA;AAErC,sEAAsE;AACtE,eAAO,MAAM,oBAAoB,KAAK,CAAA;AAEtC,eAAO,MAAM,sBAAsB,cAAc,CAAA;AAEjD,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,MAAM,CAWxE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,GAAG,IAAI,CAQtF"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Editor rail sizing — pure logic, no DOM, so the clamping and persistence
|
|
3
|
+
* rules are testable without mounting a resizable panel.
|
|
4
|
+
*/
|
|
5
|
+
export const RAIL_MIN_WIDTH = 300;
|
|
6
|
+
export const RAIL_MAX_WIDTH = 620;
|
|
7
|
+
export const RAIL_DEFAULT_WIDTH = 360;
|
|
8
|
+
/** Width of the strip that replaces the rail when it is collapsed. */
|
|
9
|
+
export const RAIL_COLLAPSED_WIDTH = 38;
|
|
10
|
+
export const RAIL_WIDTH_STORAGE_KEY = 'pb.panelW';
|
|
11
|
+
/** Constrain a candidate width to the rail's range, rejecting junk. */
|
|
12
|
+
export function clampRailWidth(width) {
|
|
13
|
+
if (!Number.isFinite(width))
|
|
14
|
+
return RAIL_DEFAULT_WIDTH;
|
|
15
|
+
return Math.min(RAIL_MAX_WIDTH, Math.max(RAIL_MIN_WIDTH, Math.round(width)));
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Read the persisted width. Anything unreadable — no storage, a value written
|
|
19
|
+
* by an older build, a user editing localStorage — falls back to the default
|
|
20
|
+
* rather than throwing or producing a broken layout.
|
|
21
|
+
*
|
|
22
|
+
* Storage access is wrapped: Safari in private mode throws on `getItem`, and a
|
|
23
|
+
* rail that cannot size itself must not take down the editor.
|
|
24
|
+
*/
|
|
25
|
+
export function readRailWidth(storage) {
|
|
26
|
+
const store = storage ?? safeStorage();
|
|
27
|
+
if (!store)
|
|
28
|
+
return RAIL_DEFAULT_WIDTH;
|
|
29
|
+
try {
|
|
30
|
+
const raw = store.getItem(RAIL_WIDTH_STORAGE_KEY);
|
|
31
|
+
if (raw === null)
|
|
32
|
+
return RAIL_DEFAULT_WIDTH;
|
|
33
|
+
const parsed = Number.parseInt(raw, 10);
|
|
34
|
+
return Number.isNaN(parsed) ? RAIL_DEFAULT_WIDTH : clampRailWidth(parsed);
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return RAIL_DEFAULT_WIDTH;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function writeRailWidth(width, storage) {
|
|
41
|
+
const store = storage ?? safeStorage();
|
|
42
|
+
if (!store)
|
|
43
|
+
return;
|
|
44
|
+
try {
|
|
45
|
+
store.setItem(RAIL_WIDTH_STORAGE_KEY, String(clampRailWidth(width)));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// Quota or private-mode failure. The width still applies for this session.
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function safeStorage() {
|
|
52
|
+
try {
|
|
53
|
+
return typeof localStorage === 'undefined' ? null : localStorage;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=rail-width.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rail-width.js","sourceRoot":"","sources":["../../src/lib/rail-width.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;AACjC,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;AACjC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAA;AAErC,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAA;AAEtC,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAAA;AAEjD,uEAAuE;AACvE,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,kBAAkB,CAAA;IACtD,OAAO,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,GAAG,CAAC,cAAc,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,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had when they were last live.
|
|
4
|
+
*
|
|
5
|
+
* ── What "baseline" means here, and why ───────────────────────────────────
|
|
6
|
+
*
|
|
7
|
+
* The guard answers "will this edit change how the live page wraps?" — so the
|
|
8
|
+
* baseline has to be what is actually on the site, not what was last saved.
|
|
9
|
+
*
|
|
10
|
+
* This CMS has no draft/published split: a document carries one `status` and
|
|
11
|
+
* saving a PUBLISHED page updates the live content in place. So for a published
|
|
12
|
+
* page the live content is whatever the editor loaded, refreshed on every save
|
|
13
|
+
* and publish. For a page that has never been published there is no baseline at
|
|
14
|
+
* all, and the guard reports line counts without deltas — correctly, because
|
|
15
|
+
* there is no live layout to break.
|
|
16
|
+
*
|
|
17
|
+
* Deliberately NOT sourced from the versions API. Versions do hold full
|
|
18
|
+
* snapshots, but they record every update, so finding "the published one" means
|
|
19
|
+
* scanning history and guessing which entry was live — an extra request and a
|
|
20
|
+
* heuristic, to reconstruct something the editor already has in hand.
|
|
21
|
+
*/
|
|
22
|
+
export interface ReflowBaseline {
|
|
23
|
+
byId: Map<string, Record<string, unknown>>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Snapshot section content, or `null` when the page is not live.
|
|
27
|
+
*
|
|
28
|
+
* `null` rather than an empty snapshot: an empty baseline would read as "every
|
|
29
|
+
* field was previously blank" and flag every line of existing copy as newly
|
|
30
|
+
* added.
|
|
31
|
+
*/
|
|
32
|
+
export declare function snapshotBaseline(sections: readonly PageSection[], status: string): ReflowBaseline | null;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve a `data-cms-field` path against a baseline.
|
|
35
|
+
*
|
|
36
|
+
* Paths are dotted and may index arrays (`stats.0.label`), matching the markers
|
|
37
|
+
* the renderers emit.
|
|
38
|
+
*
|
|
39
|
+
* Returns `undefined` for anything that is not baseline text — no snapshot, a
|
|
40
|
+
* section added since publish, a field that did not exist, or a non-string
|
|
41
|
+
* value. The guard reads `undefined` as "nothing to compare against" and
|
|
42
|
+
* reports no delta, which is the truthful answer in every one of those cases.
|
|
43
|
+
*/
|
|
44
|
+
export declare function baselineFieldText(baseline: ReflowBaseline | null, sectionId: string, fieldPath: string): string | undefined;
|
|
45
|
+
//# sourceMappingURL=reflow-baseline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflow-baseline.d.ts","sourceRoot":"","sources":["../../src/lib/reflow-baseline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;CAC3C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,SAAS,WAAW,EAAE,EAChC,MAAM,EAAE,MAAM,GACb,cAAc,GAAG,IAAI,CAKvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,cAAc,GAAG,IAAI,EAC/B,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAWpB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Snapshot section content, or `null` when the page is not live.
|
|
3
|
+
*
|
|
4
|
+
* `null` rather than an empty snapshot: an empty baseline would read as "every
|
|
5
|
+
* field was previously blank" and flag every line of existing copy as newly
|
|
6
|
+
* added.
|
|
7
|
+
*/
|
|
8
|
+
export function snapshotBaseline(sections, status) {
|
|
9
|
+
if (status !== 'PUBLISHED')
|
|
10
|
+
return null;
|
|
11
|
+
return {
|
|
12
|
+
byId: new Map(sections.map((s) => [s.id, { ...(s.content ?? {}) }])),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve a `data-cms-field` path against a baseline.
|
|
17
|
+
*
|
|
18
|
+
* Paths are dotted and may index arrays (`stats.0.label`), matching the markers
|
|
19
|
+
* the renderers emit.
|
|
20
|
+
*
|
|
21
|
+
* Returns `undefined` for anything that is not baseline text — no snapshot, a
|
|
22
|
+
* section added since publish, a field that did not exist, or a non-string
|
|
23
|
+
* value. The guard reads `undefined` as "nothing to compare against" and
|
|
24
|
+
* reports no delta, which is the truthful answer in every one of those cases.
|
|
25
|
+
*/
|
|
26
|
+
export function baselineFieldText(baseline, sectionId, fieldPath) {
|
|
27
|
+
const content = baseline?.byId.get(sectionId);
|
|
28
|
+
if (!content)
|
|
29
|
+
return undefined;
|
|
30
|
+
let cursor = content;
|
|
31
|
+
for (const key of fieldPath.split('.')) {
|
|
32
|
+
if (cursor === null || typeof cursor !== 'object')
|
|
33
|
+
return undefined;
|
|
34
|
+
cursor = cursor[key];
|
|
35
|
+
}
|
|
36
|
+
return typeof cursor === 'string' ? cursor : undefined;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=reflow-baseline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflow-baseline.js","sourceRoot":"","sources":["../../src/lib/reflow-baseline.ts"],"names":[],"mappings":"AA0BA;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAgC,EAChC,MAAc;IAEd,IAAI,MAAM,KAAK,WAAW;QAAE,OAAO,IAAI,CAAA;IACvC,OAAO;QACL,IAAI,EAAE,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;KACrE,CAAA;AACH,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAC/B,QAA+B,EAC/B,SAAiB,EACjB,SAAiB;IAEjB,MAAM,OAAO,GAAG,QAAQ,EAAE,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IAC7C,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAA;IAE9B,IAAI,MAAM,GAAY,OAAO,CAAA;IAC7B,KAAK,MAAM,GAAG,IAAI,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAA;QACnE,MAAM,GAAI,MAAkC,CAAC,GAAG,CAAC,CAAA;IACnD,CAAC;IAED,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAA;AACxD,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { type BreakpointId } from './breakpoints.js';
|
|
2
|
+
/**
|
|
3
|
+
* Measures how a field's copy wraps at every breakpoint, by laying it out for
|
|
4
|
+
* real rather than estimating.
|
|
5
|
+
*
|
|
6
|
+
* ── Why not a class chain ─────────────────────────────────────────────────
|
|
7
|
+
*
|
|
8
|
+
* The design handoff specifies rebuilding each probe from a hardcoded list of
|
|
9
|
+
* wrapper classes per guarded field, and warns twice that a width cap outside
|
|
10
|
+
* that list makes the guard lie — at wide breakpoints only, so it looks correct
|
|
11
|
+
* on mobile. By the handoff's own account that list drifted twice.
|
|
12
|
+
*
|
|
13
|
+
* A chain is a second source of truth that has to track the renderers' markup
|
|
14
|
+
* by hand. Worse here: the prototype had semantic classes (`.pv-hero-h`), while
|
|
15
|
+
* these components are styled with Tailwind utility strings that Prettier's
|
|
16
|
+
* plugin reorders on save. And a chain written in the admin cannot describe a
|
|
17
|
+
* consumer's own registered renderer at all.
|
|
18
|
+
*
|
|
19
|
+
* So the probe measures the REAL element: the caller renders the actual section
|
|
20
|
+
* into a hidden host, and this module finds the field by its `data-cms-field`
|
|
21
|
+
* marker — the same attribute the click-to-edit bridge uses. There is nothing
|
|
22
|
+
* to keep in sync, and a renderer refactor cannot silently invalidate it.
|
|
23
|
+
*
|
|
24
|
+
* ── Why one host, resized ─────────────────────────────────────────────────
|
|
25
|
+
*
|
|
26
|
+
* Six widths are measured by resizing a single rendered copy, not by rendering
|
|
27
|
+
* six. Layout is recomputed either way; React reconciliation is not.
|
|
28
|
+
*/
|
|
29
|
+
/** A field's wrap count at one breakpoint. */
|
|
30
|
+
export interface FieldLineCount {
|
|
31
|
+
id: BreakpointId;
|
|
32
|
+
lines: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Line count from an element's laid-out height.
|
|
36
|
+
*
|
|
37
|
+
* Falls back to `fontSize * 1.25` when `line-height` computes to `normal`,
|
|
38
|
+
* which it does for any element that never set one. Rounding rather than
|
|
39
|
+
* flooring: sub-pixel line heights accumulate, and 2.97 lines is three.
|
|
40
|
+
*/
|
|
41
|
+
export declare function linesFromMetrics(height: number, lineHeight: number, fontSize: number): number;
|
|
42
|
+
/**
|
|
43
|
+
* How many lines an element's text actually occupies.
|
|
44
|
+
*
|
|
45
|
+
* Counts LINE BOXES via a Range over the element's contents, deduplicated by
|
|
46
|
+
* their top edge. Dividing the element's height by its line-height — the
|
|
47
|
+
* obvious approach, and what the prototype does — counts padding as text: a
|
|
48
|
+
* button reading "Get Started" measured 2 lines, because its vertical padding
|
|
49
|
+
* came to roughly another line's worth of height. Every padded element was
|
|
50
|
+
* over-reported, which is most CTAs and every boxed heading.
|
|
51
|
+
*
|
|
52
|
+
* Rects are deduplicated by rounded top edge because a range spanning nested
|
|
53
|
+
* inline elements (a `<strong>` mid-sentence, an icon in a button) yields one
|
|
54
|
+
* rect per fragment, not per line.
|
|
55
|
+
*
|
|
56
|
+
* Falls back to the height ratio when the range produces nothing — an element
|
|
57
|
+
* whose content is a single replaced node, or a layout engine that gives no
|
|
58
|
+
* rects for empty text.
|
|
59
|
+
*/
|
|
60
|
+
export declare function countLines(el: HTMLElement): number;
|
|
61
|
+
/**
|
|
62
|
+
* The off-screen host.
|
|
63
|
+
*
|
|
64
|
+
* `left: -99999px`, never `display: none` — a hidden element has no layout, so
|
|
65
|
+
* every measurement would be zero. `visibility: hidden` would keep layout but
|
|
66
|
+
* also keep the element in the accessibility tree; moving it off-screen and
|
|
67
|
+
* marking it `aria-hidden` keeps it out of both the viewport and the a11y tree
|
|
68
|
+
* while still being laid out.
|
|
69
|
+
*
|
|
70
|
+
* MOUNT IT INSIDE `.prenta-admin`, never on `document.body`. Type tokens and
|
|
71
|
+
* the font stack are scoped to that root, so a host outside it lays text out in
|
|
72
|
+
* the document's default font and every measurement is taken at the wrong
|
|
73
|
+
* metrics. Caught by `e2e/reflow-probe.spec.ts` on its first run: a button
|
|
74
|
+
* measured 127px on the canvas and 139px in a body-mounted probe.
|
|
75
|
+
*
|
|
76
|
+
* Use `mountProbeHost` rather than appending by hand.
|
|
77
|
+
*/
|
|
78
|
+
export declare function createProbeHost(doc?: Document): HTMLElement;
|
|
79
|
+
/**
|
|
80
|
+
* Attach a probe host in the only place it measures correctly.
|
|
81
|
+
*
|
|
82
|
+
* Returns a detach function. Falls back to `document.body` only when no admin
|
|
83
|
+
* root exists (it always does in the app) — and callers should treat a
|
|
84
|
+
* fallback mount as untrustworthy rather than silently measuring.
|
|
85
|
+
*/
|
|
86
|
+
export declare function mountProbeHost(host: HTMLElement, doc?: Document): {
|
|
87
|
+
detach: () => void;
|
|
88
|
+
scoped: boolean;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Measure one field across every breakpoint.
|
|
92
|
+
*
|
|
93
|
+
* `container` must carry the same class chain the canvas uses
|
|
94
|
+
* (`prenta-canvas`, which supplies the query container). Its width is set per
|
|
95
|
+
* breakpoint, so it must not be width-constrained by a parent.
|
|
96
|
+
*
|
|
97
|
+
* `scope` narrows to one section and is REQUIRED whenever the container holds
|
|
98
|
+
* more than one, because `data-cms-field` paths are unique only within a
|
|
99
|
+
* section — every section has a `heading` and a `body`. Without it a whole page
|
|
100
|
+
* silently measures the first section's field and reports it for all of them.
|
|
101
|
+
* (That mistake is what `e2e/reflow-probe.spec.ts` caught on its second run.)
|
|
102
|
+
*
|
|
103
|
+
* Returns `null` when the field cannot be found — the canvas is rendering a
|
|
104
|
+
* component without `data-cms-field` markers, so there is nothing to measure.
|
|
105
|
+
* Reporting a line count from the wrong element would be worse than reporting
|
|
106
|
+
* none: an editor reads a number as a fact.
|
|
107
|
+
*/
|
|
108
|
+
export declare function measureFieldAcrossBreakpoints(container: HTMLElement, fieldPath: string, scope?: string): FieldLineCount[] | null;
|
|
109
|
+
/** What a probe pass produces for one field. */
|
|
110
|
+
export interface FieldReflow {
|
|
111
|
+
current: FieldLineCount[];
|
|
112
|
+
baseline: FieldLineCount[];
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Measure a field's wrapping now and as published, from the live canvas.
|
|
116
|
+
*
|
|
117
|
+
* The whole `.prenta-canvas` is cloned, not just the target section. Cloning
|
|
118
|
+
* the section alone would require rebuilding whatever sits between the canvas
|
|
119
|
+
* root and the section — which is the class-chain problem again, in a smaller
|
|
120
|
+
* disguise. `e2e/reflow-probe.spec.ts` asserts the whole-canvas clone
|
|
121
|
+
* reproduces every field's rendered width exactly; nothing asserts that for a
|
|
122
|
+
* hand-rebuilt wrapper.
|
|
123
|
+
*
|
|
124
|
+
* The baseline is measured by writing the published string into the SAME cloned
|
|
125
|
+
* element and re-measuring, rather than by rendering the published section. The
|
|
126
|
+
* two differ in exactly one field, so everything else — width caps, siblings,
|
|
127
|
+
* grid tracks — is held identical by construction rather than by hoping a second
|
|
128
|
+
* render matches.
|
|
129
|
+
*
|
|
130
|
+
* `baselineText` of `undefined` means the field has no published version (a new
|
|
131
|
+
* section), so there is no change to report and current is echoed as baseline.
|
|
132
|
+
*
|
|
133
|
+
* Returns `null` when the section or field is absent from the canvas — a
|
|
134
|
+
* consumer's renderer may carry no `data-cms-field` markers, and a line count
|
|
135
|
+
* read off the wrong element is worse than none.
|
|
136
|
+
*/
|
|
137
|
+
export declare function probeFieldReflow(options: {
|
|
138
|
+
canvas: HTMLElement;
|
|
139
|
+
sectionId: string;
|
|
140
|
+
fieldPath: string;
|
|
141
|
+
baselineText: string | undefined;
|
|
142
|
+
doc?: Document;
|
|
143
|
+
}): FieldReflow | null;
|
|
144
|
+
export type ReflowSeverity = 'same' | 'grew' | 'grew-badly';
|
|
145
|
+
/**
|
|
146
|
+
* Compare a field's current wrapping against its published baseline.
|
|
147
|
+
*
|
|
148
|
+
* Only growth is flagged. Copy that got shorter cannot break a layout that
|
|
149
|
+
* already held the longer version, so reporting it would be noise on exactly
|
|
150
|
+
* the edit an editor was asked to make.
|
|
151
|
+
*/
|
|
152
|
+
export declare function reflowSeverity(current: number, baseline: number): ReflowSeverity;
|
|
153
|
+
/**
|
|
154
|
+
* The breakpoint worth proofing on: the biggest jump, and on a tie the
|
|
155
|
+
* narrowest width. A tie means the same damage happens at several sizes, and
|
|
156
|
+
* the narrowest is where it is most likely to look broken.
|
|
157
|
+
*/
|
|
158
|
+
export declare function worstBreakpoint(current: FieldLineCount[], baseline: FieldLineCount[]): BreakpointId | null;
|
|
159
|
+
//# sourceMappingURL=reflow-probe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflow-probe.d.ts","sourceRoot":"","sources":["../../src/lib/reflow-probe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAEjE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,8CAA8C;AAC9C,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,YAAY,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK7F;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,WAA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