@pantheon-systems/puck-css 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agent/components/AgentActionButton.js +0 -13
- package/dist/agent/components/AgentActionButton.js.map +1 -1
- package/dist/agent/components/AgentActionModal.js +0 -13
- package/dist/agent/components/AgentActionModal.js.map +1 -1
- package/dist/agent/components/AgentStatusPanel.js +0 -10
- package/dist/agent/components/AgentStatusPanel.js.map +1 -1
- package/dist/agent/components/index.js +0 -5
- package/dist/agent/components/index.js.map +1 -1
- package/dist/agent/useAgentEdit.js +0 -12
- package/dist/agent/useAgentEdit.js.map +1 -1
- package/dist/agent/useAgentTrigger.js +0 -29
- package/dist/agent/useAgentTrigger.js.map +1 -1
- package/dist/auth/P1AuthProvider.d.ts +9 -2
- package/dist/auth/P1AuthProvider.d.ts.map +1 -1
- package/dist/auth/P1AuthProvider.js +21 -44
- package/dist/auth/P1AuthProvider.js.map +1 -1
- package/dist/auth/P1LoginPage.js +0 -18
- package/dist/auth/P1LoginPage.js.map +1 -1
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.d.ts.map +1 -1
- package/dist/auth/index.js +1 -9
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/logout.d.ts +23 -0
- package/dist/auth/logout.d.ts.map +1 -0
- package/dist/auth/logout.js +14 -0
- package/dist/auth/logout.js.map +1 -0
- package/dist/auth/storage-keys.d.ts +5 -0
- package/dist/auth/storage-keys.d.ts.map +1 -0
- package/dist/auth/storage-keys.js +3 -0
- package/dist/auth/storage-keys.js.map +1 -0
- package/dist/collaboration/components/AgentActivityBanner.js +0 -15
- package/dist/collaboration/components/AgentActivityBanner.js.map +1 -1
- package/dist/collaboration/components/CollaboratorAvatars.js +0 -17
- package/dist/collaboration/components/CollaboratorAvatars.js.map +1 -1
- package/dist/collaboration/components/FocusRegionHighlight.js +0 -9
- package/dist/collaboration/components/FocusRegionHighlight.js.map +1 -1
- package/dist/collaboration/components/PresenceIndicator.js +0 -9
- package/dist/collaboration/components/PresenceIndicator.js.map +1 -1
- package/dist/collaboration/useBranchPresence.js +0 -36
- package/dist/collaboration/useBranchPresence.js.map +1 -1
- package/dist/collaboration/useFocusRegionReporting.js +0 -75
- package/dist/collaboration/useFocusRegionReporting.js.map +1 -1
- package/dist/collaboration/usePresence.js +0 -37
- package/dist/collaboration/usePresence.js.map +1 -1
- package/dist/collaboration/useSitePresence.js +0 -36
- package/dist/collaboration/useSitePresence.js.map +1 -1
- package/dist/collaboration/utils/avatarColor.js +0 -3
- package/dist/collaboration/utils/avatarColor.js.map +1 -1
- package/dist/collaboration/utils/focusHighlightConfig.js +0 -61
- package/dist/collaboration/utils/focusHighlightConfig.js.map +1 -1
- package/dist/collaboration/utils/focusRegionMap.js +1 -80
- package/dist/collaboration/utils/focusRegionMap.js.map +1 -1
- package/dist/collaboration/utils/initials.js +0 -14
- package/dist/collaboration/utils/initials.js.map +1 -1
- package/dist/collaboration/utils/presenceIdentity.js +0 -26
- package/dist/collaboration/utils/presenceIdentity.js.map +1 -1
- package/dist/core/FocusHighlightContext.js +0 -31
- package/dist/core/FocusHighlightContext.js.map +1 -1
- package/dist/core/NotificationContext.js +2 -67
- package/dist/core/NotificationContext.js.map +1 -1
- package/dist/core/P1PuckContext.js +0 -31
- package/dist/core/P1PuckContext.js.map +1 -1
- package/dist/core/PresenceContext.js +0 -18
- package/dist/core/PresenceContext.js.map +1 -1
- package/dist/core/config.js +0 -11
- package/dist/core/config.js.map +1 -1
- package/dist/core/featureConfig.js +0 -32
- package/dist/core/featureConfig.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/plugin-types.d.ts +9 -0
- package/dist/core/plugin-types.d.ts.map +1 -1
- package/dist/core/types.d.ts +7 -1
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js +0 -3
- package/dist/core/types.js.map +1 -1
- package/dist/core/utils/debounce.js +0 -18
- package/dist/core/utils/debounce.js.map +1 -1
- package/dist/core/utils/requestError.js +0 -5
- package/dist/core/utils/requestError.js.map +1 -1
- package/dist/core/utils/retry.js +0 -31
- package/dist/core/utils/retry.js.map +1 -1
- package/dist/core/utils/throttle.js +0 -24
- package/dist/core/utils/throttle.js.map +1 -1
- package/dist/data/cross-reference-resolve.js +0 -6
- package/dist/data/cross-reference-resolve.js.map +1 -1
- package/dist/data/cross-reference.js +0 -15
- package/dist/data/cross-reference.js.map +1 -1
- package/dist/data/css-queries/css-query-registry.d.ts +2 -2
- package/dist/data/css-queries/css-query-registry.js +1 -1
- package/dist/data/css-queries/css-query-registry.js.map +1 -1
- package/dist/data/dal/index.js +0 -21
- package/dist/data/dal/index.js.map +1 -1
- package/dist/data/dal/init.js +0 -40
- package/dist/data/dal/init.js.map +1 -1
- package/dist/data/dal/p1-store.d.ts.map +1 -1
- package/dist/data/dal/p1-store.js +11 -41
- package/dist/data/dal/p1-store.js.map +1 -1
- package/dist/data/data-list-block/builtin-components/cards.d.ts +1 -0
- package/dist/data/data-list-block/builtin-components/cards.d.ts.map +1 -1
- package/dist/data/data-list-block/builtin-components/cards.js +16 -16
- package/dist/data/data-list-block/builtin-components/cards.js.map +1 -1
- package/dist/data/data-list-block/builtin-components/listing.d.ts +1 -0
- package/dist/data/data-list-block/builtin-components/listing.d.ts.map +1 -1
- package/dist/data/data-list-block/builtin-components/listing.js +4 -3
- package/dist/data/data-list-block/builtin-components/listing.js.map +1 -1
- package/dist/data/data-list-block/builtin-components/rows.d.ts +1 -0
- package/dist/data/data-list-block/builtin-components/rows.d.ts.map +1 -1
- package/dist/data/data-list-block/builtin-components/rows.js +3 -3
- package/dist/data/data-list-block/builtin-components/rows.js.map +1 -1
- package/dist/data/data-list-block/create-data-list-block.d.ts +1 -0
- package/dist/data/data-list-block/create-data-list-block.d.ts.map +1 -1
- package/dist/data/data-list-block/create-data-list-block.js +7 -11
- package/dist/data/data-list-block/create-data-list-block.js.map +1 -1
- package/dist/data/data-list-block/data-list.css +314 -0
- package/dist/data/data-list-block/utils.js +0 -1
- package/dist/data/data-list-block/utils.js.map +1 -1
- package/dist/data/fields/pds-field-helpers.js +1 -4
- package/dist/data/fields/pds-field-helpers.js.map +1 -1
- package/dist/data/fields/visible-when.js +0 -5
- package/dist/data/fields/visible-when.js.map +1 -1
- package/dist/data/fields.d.ts.map +1 -1
- package/dist/data/fields.js +7 -14
- package/dist/data/fields.js.map +1 -1
- package/dist/data/get-page.js +0 -1
- package/dist/data/get-page.js.map +1 -1
- package/dist/data/page-editor-meta.js +0 -7
- package/dist/data/page-editor-meta.js.map +1 -1
- package/dist/data/page-store.js +0 -32
- package/dist/data/page-store.js.map +1 -1
- package/dist/data/page-structure.js +0 -3
- package/dist/data/page-structure.js.map +1 -1
- package/dist/data/paths.d.ts +6 -0
- package/dist/data/paths.d.ts.map +1 -1
- package/dist/data/paths.js +3 -16
- package/dist/data/paths.js.map +1 -1
- package/dist/data/query-provider.d.ts +14 -0
- package/dist/data/query-provider.d.ts.map +1 -1
- package/dist/data/query-provider.js +20 -9
- package/dist/data/query-provider.js.map +1 -1
- package/dist/data/remote-datasources/fetch-http-json.js +0 -5
- package/dist/data/remote-datasources/fetch-http-json.js.map +1 -1
- package/dist/data/remote-datasources/loader.js +0 -21
- package/dist/data/remote-datasources/loader.js.map +1 -1
- package/dist/data/remote-datasources/remote-datasource-registry.js +0 -4
- package/dist/data/remote-datasources/remote-datasource-registry.js.map +1 -1
- package/dist/data/resolve-data-templates.js +0 -24
- package/dist/data/resolve-data-templates.js.map +1 -1
- package/dist/data/route-templates.js +0 -29
- package/dist/data/route-templates.js.map +1 -1
- package/dist/data/semantic-ops.js +0 -11
- package/dist/data/semantic-ops.js.map +1 -1
- package/dist/data/styles.js +0 -2
- package/dist/data/styles.js.map +1 -1
- package/dist/data/template-autocomplete.js +0 -8
- package/dist/data/template-autocomplete.js.map +1 -1
- package/dist/data/utils.d.ts +16 -0
- package/dist/data/utils.d.ts.map +1 -1
- package/dist/data/utils.js +21 -1
- package/dist/data/utils.js.map +1 -1
- package/dist/editor/P1App.d.ts.map +1 -1
- package/dist/editor/P1App.js +6 -45
- package/dist/editor/P1App.js.map +1 -1
- package/dist/editor/P1PuckProvider.d.ts +1 -1
- package/dist/editor/P1PuckProvider.d.ts.map +1 -1
- package/dist/editor/P1PuckProvider.js +54 -561
- package/dist/editor/P1PuckProvider.js.map +1 -1
- package/dist/editor/aiPanelStore.js +0 -7
- package/dist/editor/aiPanelStore.js.map +1 -1
- package/dist/editor/components/BranchSelector.js +0 -21
- package/dist/editor/components/BranchSelector.js.map +1 -1
- package/dist/editor/components/CollapsibleSectionHeader.js +1 -4
- package/dist/editor/components/CollapsibleSectionHeader.js.map +1 -1
- package/dist/editor/components/DraggableRow.js +0 -1
- package/dist/editor/components/DraggableRow.js.map +1 -1
- package/dist/editor/components/EditorReloadOverlay.d.ts +16 -0
- package/dist/editor/components/EditorReloadOverlay.d.ts.map +1 -0
- package/dist/editor/components/EditorReloadOverlay.js +13 -0
- package/dist/editor/components/EditorReloadOverlay.js.map +1 -0
- package/dist/editor/components/NotificationContainer.js +0 -20
- package/dist/editor/components/NotificationContainer.js.map +1 -1
- package/dist/editor/components/OutlinePanel.js +1 -12
- package/dist/editor/components/OutlinePanel.js.map +1 -1
- package/dist/editor/components/P1InspectorFields.d.ts.map +1 -1
- package/dist/editor/components/P1InspectorFields.js +12 -14
- package/dist/editor/components/P1InspectorFields.js.map +1 -1
- package/dist/editor/components/P1TemplateFields.js +6 -12
- package/dist/editor/components/P1TemplateFields.js.map +1 -1
- package/dist/editor/components/PanelHeader.d.ts.map +1 -1
- package/dist/editor/components/PanelHeader.js +3 -2
- package/dist/editor/components/PanelHeader.js.map +1 -1
- package/dist/editor/components/PublishButton.js +0 -21
- package/dist/editor/components/PublishButton.js.map +1 -1
- package/dist/editor/components/PuckDataCapture.js +0 -14
- package/dist/editor/components/PuckDataCapture.js.map +1 -1
- package/dist/editor/components/PuckDataSynchronizer.js +0 -67
- package/dist/editor/components/PuckDataSynchronizer.js.map +1 -1
- package/dist/editor/components/PuckSelectionTracker.js +0 -62
- package/dist/editor/components/PuckSelectionTracker.js.map +1 -1
- package/dist/editor/components/SaveIndicator.js +0 -41
- package/dist/editor/components/SaveIndicator.js.map +1 -1
- package/dist/editor/components/Toast.js +1 -32
- package/dist/editor/components/Toast.js.map +1 -1
- package/dist/editor/components/VersionBannerOverride.d.ts +7 -1
- package/dist/editor/components/VersionBannerOverride.d.ts.map +1 -1
- package/dist/editor/components/VersionBannerOverride.js +17 -24
- package/dist/editor/components/VersionBannerOverride.js.map +1 -1
- package/dist/editor/components/collapsibleSectionContext.js +0 -10
- package/dist/editor/components/collapsibleSectionContext.js.map +1 -1
- package/dist/editor/components/componentIconName.js +0 -23
- package/dist/editor/components/componentIconName.js.map +1 -1
- package/dist/editor/components/connectable.js +0 -5
- package/dist/editor/components/connectable.js.map +1 -1
- package/dist/editor/components/merge-preview/MergePreviewRenderer.js +2 -74
- package/dist/editor/components/merge-preview/MergePreviewRenderer.js.map +1 -1
- package/dist/editor/components/merge-preview/ScaledContent.js +0 -6
- package/dist/editor/components/merge-preview/ScaledContent.js.map +1 -1
- package/dist/editor/components/merge-preview/index.js +0 -5
- package/dist/editor/components/merge-preview/index.js.map +1 -1
- package/dist/editor/components/outlineTree.js +0 -31
- package/dist/editor/components/outlineTree.js.map +1 -1
- package/dist/editor/components/useDragReorder.js +0 -1
- package/dist/editor/components/useDragReorder.js.map +1 -1
- package/dist/editor/composePlugins.d.ts +9 -3
- package/dist/editor/composePlugins.d.ts.map +1 -1
- package/dist/editor/composePlugins.js +3 -8
- package/dist/editor/composePlugins.js.map +1 -1
- package/dist/editor/defaultPlugins.d.ts +1 -1
- package/dist/editor/defaultPlugins.d.ts.map +1 -1
- package/dist/editor/defaultPlugins.js +3 -1
- package/dist/editor/defaultPlugins.js.map +1 -1
- package/dist/editor/freshFieldTypes.d.ts +12 -0
- package/dist/editor/freshFieldTypes.d.ts.map +1 -0
- package/dist/editor/freshFieldTypes.js +11 -0
- package/dist/editor/freshFieldTypes.js.map +1 -0
- package/dist/editor/logout-store.d.ts +13 -0
- package/dist/editor/logout-store.d.ts.map +1 -0
- package/dist/editor/logout-store.js +23 -0
- package/dist/editor/logout-store.js.map +1 -0
- package/dist/editor/plugin/P1Plugin.d.ts +16 -3
- package/dist/editor/plugin/P1Plugin.d.ts.map +1 -1
- package/dist/editor/plugin/P1Plugin.js +21 -171
- package/dist/editor/plugin/P1Plugin.js.map +1 -1
- package/dist/editor/plugin/context-sync-key.js +0 -19
- package/dist/editor/plugin/context-sync-key.js.map +1 -1
- package/dist/editor/plugin/createP1Overrides.js +1 -49
- package/dist/editor/plugin/createP1Overrides.js.map +1 -1
- package/dist/editor/plugin/document-sync-plugin.js +0 -50
- package/dist/editor/plugin/document-sync-plugin.js.map +1 -1
- package/dist/editor/plugin/fieldGuidance.js +0 -5
- package/dist/editor/plugin/fieldGuidance.js.map +1 -1
- package/dist/editor/plugin/index.js +0 -6
- package/dist/editor/plugin/index.js.map +1 -1
- package/dist/editor/plugin/selectHeaderCollaborators.js +0 -8
- package/dist/editor/plugin/selectHeaderCollaborators.js.map +1 -1
- package/dist/editor/presets.js +2 -2
- package/dist/editor/stablePluginDeps.d.ts +9 -0
- package/dist/editor/stablePluginDeps.d.ts.map +1 -0
- package/dist/editor/stablePluginDeps.js +15 -0
- package/dist/editor/stablePluginDeps.js.map +1 -0
- package/dist/editor/thumbnails/LiveThumbnail.js +1 -49
- package/dist/editor/thumbnails/LiveThumbnail.js.map +1 -1
- package/dist/editor/thumbnails/ThumbnailCard.js +0 -25
- package/dist/editor/thumbnails/ThumbnailCard.js.map +1 -1
- package/dist/editor/thumbnails/buildLiveThumbnailDrawer.js +0 -21
- package/dist/editor/thumbnails/buildLiveThumbnailDrawer.js.map +1 -1
- package/dist/editor/thumbnails/humanizeComponentName.js +0 -17
- package/dist/editor/thumbnails/humanizeComponentName.js.map +1 -1
- package/dist/editor/thumbnails/resolveLiveThumbnailDrawer.js +0 -11
- package/dist/editor/thumbnails/resolveLiveThumbnailDrawer.js.map +1 -1
- package/dist/editor/thumbnails/thumbnailCache.js +0 -38
- package/dist/editor/thumbnails/thumbnailCache.js.map +1 -1
- package/dist/editor/useAutoSave.js +0 -32
- package/dist/editor/useAutoSave.js.map +1 -1
- package/dist/editor/useBranches.js +0 -30
- package/dist/editor/useBranches.js.map +1 -1
- package/dist/editor/useComponentRegistry.d.ts +1 -1
- package/dist/editor/useComponentRegistry.js +0 -28
- package/dist/editor/useComponentRegistry.js.map +1 -1
- package/dist/editor/useDocuments.js +0 -51
- package/dist/editor/useDocuments.js.map +1 -1
- package/dist/editor/useMergePreview.js +8 -12
- package/dist/editor/useMergePreview.js.map +1 -1
- package/dist/editor/useP1Editor.d.ts +35 -7
- package/dist/editor/useP1Editor.d.ts.map +1 -1
- package/dist/editor/useP1Editor.js +146 -243
- package/dist/editor/useP1Editor.js.map +1 -1
- package/dist/editor/useP1Overrides.js +15 -50
- package/dist/editor/useP1Overrides.js.map +1 -1
- package/dist/editor/useP1Plugin.d.ts +10 -4
- package/dist/editor/useP1Plugin.d.ts.map +1 -1
- package/dist/editor/useP1Plugin.js +34 -56
- package/dist/editor/useP1Plugin.js.map +1 -1
- package/dist/editor/useRealtime.d.ts +15 -3
- package/dist/editor/useRealtime.d.ts.map +1 -1
- package/dist/editor/useRealtime.js +12 -91
- package/dist/editor/useRealtime.js.map +1 -1
- package/dist/editor/useResponsivePanels.js +2 -35
- package/dist/editor/useResponsivePanels.js.map +1 -1
- package/dist/editor/useSidebarScrollPreservation.js +0 -14
- package/dist/editor/useSidebarScrollPreservation.js.map +1 -1
- package/dist/editor/utils/buildThumbnailOverride.js +0 -9
- package/dist/editor/utils/buildThumbnailOverride.js.map +1 -1
- package/dist/editor/utils/componentRegistry.d.ts +6 -11
- package/dist/editor/utils/componentRegistry.d.ts.map +1 -1
- package/dist/editor/utils/componentRegistry.js +1 -71
- package/dist/editor/utils/componentRegistry.js.map +1 -1
- package/dist/editor/utils/createStablePluginArray.js +0 -27
- package/dist/editor/utils/createStablePluginArray.js.map +1 -1
- package/dist/editor/utils/path.js +0 -6
- package/dist/editor/utils/path.js.map +1 -1
- package/dist/editor/utils/puckYjsBinding.d.ts +1 -1
- package/dist/editor/utils/puckYjsBinding.js +0 -99
- package/dist/editor/utils/puckYjsBinding.js.map +1 -1
- package/dist/editor/utils/restoreDocumentVersion.js +0 -12
- package/dist/editor/utils/restoreDocumentVersion.js.map +1 -1
- package/dist/editor/utils/sanitizeRichtextDefaults.js +0 -26
- package/dist/editor/utils/sanitizeRichtextDefaults.js.map +1 -1
- package/dist/editor/utils/snapshotToPuckData.js +0 -8
- package/dist/editor/utils/snapshotToPuckData.js.map +1 -1
- package/dist/editor/utils/syncComponentRegistry.d.ts +2 -2
- package/dist/editor/utils/syncComponentRegistry.js +1 -76
- package/dist/editor/utils/syncComponentRegistry.js.map +1 -1
- package/dist/editor/utils/syncComponentRegistryWriteOnly.d.ts +7 -7
- package/dist/editor/utils/syncComponentRegistryWriteOnly.js +0 -22
- package/dist/editor/utils/syncComponentRegistryWriteOnly.js.map +1 -1
- package/dist/editor/utils/templatePath.js +0 -5
- package/dist/editor/utils/templatePath.js.map +1 -1
- package/dist/features/content-type-templates/editor/useTemplatePermissions.js +0 -3
- package/dist/features/content-type-templates/editor/useTemplatePermissions.js.map +1 -1
- package/dist/features/content-type-templates/hooks/useTemplateList.js +0 -30
- package/dist/features/content-type-templates/hooks/useTemplateList.js.map +1 -1
- package/dist/features/content-type-templates/index.js +0 -8
- package/dist/features/content-type-templates/index.js.map +1 -1
- package/dist/features/content-type-templates/permissions/createPuckPermissions.js +1 -43
- package/dist/features/content-type-templates/permissions/createPuckPermissions.js.map +1 -1
- package/dist/features/content-type-templates/permissions/role-permissions.d.ts +8 -0
- package/dist/features/content-type-templates/permissions/role-permissions.d.ts.map +1 -1
- package/dist/features/content-type-templates/permissions/role-permissions.js +3 -29
- package/dist/features/content-type-templates/permissions/role-permissions.js.map +1 -1
- package/dist/features/content-type-templates/permissions/useContentRole.js +0 -24
- package/dist/features/content-type-templates/permissions/useContentRole.js.map +1 -1
- package/dist/features/content-type-templates/permissions/useResolveContentRole.d.ts +5 -5
- package/dist/features/content-type-templates/permissions/useResolveContentRole.js +2 -22
- package/dist/features/content-type-templates/permissions/useResolveContentRole.js.map +1 -1
- package/dist/features/content-type-templates/stores/index.js +0 -5
- package/dist/features/content-type-templates/stores/index.js.map +1 -1
- package/dist/features/content-type-templates/stores/template-store-api.js +0 -14
- package/dist/features/content-type-templates/stores/template-store-api.js.map +1 -1
- package/dist/features/content-type-templates/stores/template-store.d.ts +1 -1
- package/dist/features/content-type-templates/stores/template-store.js +0 -12
- package/dist/features/content-type-templates/stores/template-store.js.map +1 -1
- package/dist/features/content-type-templates/types.js +0 -5
- package/dist/features/content-type-templates/types.js.map +1 -1
- package/dist/features/content-type-templates/ui/ActionBarPinButton.js +12 -21
- package/dist/features/content-type-templates/ui/ActionBarPinButton.js.map +1 -1
- package/dist/features/content-type-templates/ui/TemplateDetailsPanel.js +0 -23
- package/dist/features/content-type-templates/ui/TemplateDetailsPanel.js.map +1 -1
- package/dist/features/content-type-templates/ui/TemplateSelector.js +0 -19
- package/dist/features/content-type-templates/ui/TemplateSelector.js.map +1 -1
- package/dist/features/content-type-templates/validation/structural-validation.js +0 -40
- package/dist/features/content-type-templates/validation/structural-validation.js.map +1 -1
- package/dist/features/localization/authority.d.ts +26 -0
- package/dist/features/localization/authority.d.ts.map +1 -0
- package/dist/features/localization/authority.js +17 -0
- package/dist/features/localization/authority.js.map +1 -0
- package/dist/features/localization/index.d.ts +11 -0
- package/dist/features/localization/index.d.ts.map +1 -0
- package/dist/features/localization/index.js +7 -0
- package/dist/features/localization/index.js.map +1 -0
- package/dist/features/localization/prop-target.d.ts +26 -0
- package/dist/features/localization/prop-target.d.ts.map +1 -0
- package/dist/features/localization/prop-target.js +15 -0
- package/dist/features/localization/prop-target.js.map +1 -0
- package/dist/features/localization/puck-overrides.d.ts +12 -0
- package/dist/features/localization/puck-overrides.d.ts.map +1 -0
- package/dist/features/localization/puck-overrides.js +12 -0
- package/dist/features/localization/puck-overrides.js.map +1 -0
- package/dist/features/localization/relation.d.ts +14 -0
- package/dist/features/localization/relation.d.ts.map +1 -0
- package/dist/features/localization/relation.js +7 -0
- package/dist/features/localization/relation.js.map +1 -0
- package/dist/features/localization/translatable.d.ts +24 -0
- package/dist/features/localization/translatable.d.ts.map +1 -0
- package/dist/features/localization/translatable.js +30 -0
- package/dist/features/localization/translatable.js.map +1 -0
- package/dist/features/localization/types.d.ts +17 -0
- package/dist/features/localization/types.d.ts.map +1 -0
- package/dist/features/localization/types.js +2 -0
- package/dist/features/localization/types.js.map +1 -0
- package/dist/features/localization/ui/AuthorityFieldControl.d.ts +32 -0
- package/dist/features/localization/ui/AuthorityFieldControl.d.ts.map +1 -0
- package/dist/features/localization/ui/AuthorityFieldControl.js +36 -0
- package/dist/features/localization/ui/AuthorityFieldControl.js.map +1 -0
- package/dist/features/localization/ui/TranslatabilityToggle.d.ts +17 -0
- package/dist/features/localization/ui/TranslatabilityToggle.d.ts.map +1 -0
- package/dist/features/localization/ui/TranslatabilityToggle.js +16 -0
- package/dist/features/localization/ui/TranslatabilityToggle.js.map +1 -0
- package/dist/features/localization/useLocalizationData.d.ts +37 -0
- package/dist/features/localization/useLocalizationData.d.ts.map +1 -0
- package/dist/features/localization/useLocalizationData.js +88 -0
- package/dist/features/localization/useLocalizationData.js.map +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -43
- package/dist/index.js.map +1 -1
- package/dist/merge/components/conflict-notifications/ConflictNotificationToast.js +0 -19
- package/dist/merge/components/conflict-notifications/ConflictNotificationToast.js.map +1 -1
- package/dist/merge/components/conflict-notifications/index.js +0 -5
- package/dist/merge/components/conflict-notifications/index.js.map +1 -1
- package/dist/merge/components/conflict-notifications/useConflictNotifications.js +0 -48
- package/dist/merge/components/conflict-notifications/useConflictNotifications.js.map +1 -1
- package/dist/merge/components/conflict-resolution/ComponentConflictGroup.js +0 -36
- package/dist/merge/components/conflict-resolution/ComponentConflictGroup.js.map +1 -1
- package/dist/merge/components/conflict-resolution/PuckFieldResolutionPanel.js +0 -40
- package/dist/merge/components/conflict-resolution/PuckFieldResolutionPanel.js.map +1 -1
- package/dist/merge/components/conflict-resolution/RenderedResolutionPreview.js +0 -21
- package/dist/merge/components/conflict-resolution/RenderedResolutionPreview.js.map +1 -1
- package/dist/merge/components/conflict-resolution/index.js +0 -5
- package/dist/merge/components/conflict-resolution/index.js.map +1 -1
- package/dist/merge/components/merge-resolution/CherryPickVisualPanel.js +0 -44
- package/dist/merge/components/merge-resolution/CherryPickVisualPanel.js.map +1 -1
- package/dist/merge/components/merge-resolution/ComponentClickOverlay.js +0 -24
- package/dist/merge/components/merge-resolution/ComponentClickOverlay.js.map +1 -1
- package/dist/merge/components/merge-resolution/DocumentResolutionDetail.d.ts.map +1 -1
- package/dist/merge/components/merge-resolution/DocumentResolutionDetail.js +6 -31
- package/dist/merge/components/merge-resolution/DocumentResolutionDetail.js.map +1 -1
- package/dist/merge/components/merge-resolution/index.js +0 -3
- package/dist/merge/components/merge-resolution/index.js.map +1 -1
- package/dist/merge/useMergeResolution.d.ts +1 -1
- package/dist/merge/useMergeResolution.d.ts.map +1 -1
- package/dist/merge/useMergeResolution.js +6 -75
- package/dist/merge/useMergeResolution.js.map +1 -1
- package/dist/merge/utils/namespacePuckData.d.ts.map +1 -1
- package/dist/merge/utils/namespacePuckData.js +8 -8
- package/dist/merge/utils/namespacePuckData.js.map +1 -1
- package/dist/merge/utils/puckFieldClassifier.js +0 -183
- package/dist/merge/utils/puckFieldClassifier.js.map +1 -1
- package/dist/p1/editor/connect/connect-preview-config.js +0 -5
- package/dist/p1/editor/connect/connect-preview-config.js.map +1 -1
- package/dist/p1/editor/connect/field-connect-plugin.js +0 -6
- package/dist/p1/editor/connect/field-connect-plugin.js.map +1 -1
- package/dist/p1/editor/editor-preview-resolve.js +0 -13
- package/dist/p1/editor/editor-preview-resolve.js.map +1 -1
- package/dist/p1/editor/hooks/api-hooks.js +0 -7
- package/dist/p1/editor/hooks/api-hooks.js.map +1 -1
- package/dist/p1/editor/hooks/useLiveEditorContext.d.ts.map +1 -1
- package/dist/p1/editor/hooks/useLiveEditorContext.js +2 -13
- package/dist/p1/editor/hooks/useLiveEditorContext.js.map +1 -1
- package/dist/p1/editor/hooks/useLiveRemoteDatasources.js +0 -22
- package/dist/p1/editor/hooks/useLiveRemoteDatasources.js.map +1 -1
- package/dist/p1/editor/hooks/useP1Plugins.js +0 -5
- package/dist/p1/editor/hooks/useP1Plugins.js.map +1 -1
- package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.js +0 -7
- package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.js.map +1 -1
- package/dist/p1/editor/template-autocomplete-layer.js +0 -4
- package/dist/p1/editor/template-autocomplete-layer.js.map +1 -1
- package/dist/pds/components/AgentChip.js +0 -3
- package/dist/pds/components/AgentChip.js.map +1 -1
- package/dist/pds/components/CreatePageModal.js +1 -97
- package/dist/pds/components/CreatePageModal.js.map +1 -1
- package/dist/pds/components/LoadingMessage.d.ts.map +1 -1
- package/dist/pds/components/LoadingMessage.js +2 -1
- package/dist/pds/components/LoadingMessage.js.map +1 -1
- package/dist/pds/components/LoadingMessage.module.css +2 -21
- package/dist/pds/components/LoadingOverlay.d.ts +17 -0
- package/dist/pds/components/LoadingOverlay.d.ts.map +1 -0
- package/dist/pds/components/LoadingOverlay.js +7 -0
- package/dist/pds/components/LoadingOverlay.js.map +1 -0
- package/dist/pds/components/LoadingOverlay.module.css +28 -0
- package/dist/pds/components/P1EditorHeader.d.ts +9 -2
- package/dist/pds/components/P1EditorHeader.d.ts.map +1 -1
- package/dist/pds/components/P1EditorHeader.js +6 -26
- package/dist/pds/components/P1EditorHeader.js.map +1 -1
- package/dist/pds/components/P1EditorHeader.module.css +26 -0
- package/dist/pds/components/PageNavigator.js +0 -16
- package/dist/pds/components/PageNavigator.js.map +1 -1
- package/dist/pds/components/PageNotFound.d.ts +27 -0
- package/dist/pds/components/PageNotFound.d.ts.map +1 -0
- package/dist/pds/components/PageNotFound.js +24 -0
- package/dist/pds/components/PageNotFound.js.map +1 -0
- package/dist/pds/components/PageNotFound.module.css +51 -0
- package/dist/pds/components/PresenceStack.js +0 -9
- package/dist/pds/components/PresenceStack.js.map +1 -1
- package/dist/pds/components/PublishControl.js +0 -6
- package/dist/pds/components/PublishControl.js.map +1 -1
- package/dist/pds/components/WorkstreamSwitcher.js +1 -25
- package/dist/pds/components/WorkstreamSwitcher.js.map +1 -1
- package/dist/pds/index.d.ts +4 -0
- package/dist/pds/index.d.ts.map +1 -1
- package/dist/pds/index.js +2 -29
- package/dist/pds/index.js.map +1 -1
- package/dist/pds/theme/pds-core-content.js +0 -5
- package/dist/pds/theme/pds-core-content.js.map +1 -1
- package/dist/pds/utils/deriveDocState.js +0 -1
- package/dist/pds/utils/deriveDocState.js.map +1 -1
- package/dist/pds/utils/deriveLiveDocState.js +0 -13
- package/dist/pds/utils/deriveLiveDocState.js.map +1 -1
- package/dist/registry-sync.js +0 -4
- package/dist/registry-sync.js.map +1 -1
- package/dist/server.js +0 -7
- package/dist/server.js.map +1 -1
- package/dist/versioning/components/ReadOnlyFieldsGuard.js +0 -3
- package/dist/versioning/components/ReadOnlyFieldsGuard.js.map +1 -1
- package/dist/versioning/components/VersionBannerActions.js +0 -1
- package/dist/versioning/components/VersionBannerActions.js.map +1 -1
- package/dist/versioning/components/version-compare/BranchDiffHeader.js +0 -7
- package/dist/versioning/components/version-compare/BranchDiffHeader.js.map +1 -1
- package/dist/versioning/components/version-compare/BranchMergeCompare.js +0 -19
- package/dist/versioning/components/version-compare/BranchMergeCompare.js.map +1 -1
- package/dist/versioning/components/version-compare/ComponentNode.js +0 -8
- package/dist/versioning/components/version-compare/ComponentNode.js.map +1 -1
- package/dist/versioning/components/version-compare/ComponentTree.js +0 -10
- package/dist/versioning/components/version-compare/ComponentTree.js.map +1 -1
- package/dist/versioning/components/version-compare/DiffHeader.js +0 -3
- package/dist/versioning/components/version-compare/DiffHeader.js.map +1 -1
- package/dist/versioning/components/version-compare/DocumentDiffList.js +0 -14
- package/dist/versioning/components/version-compare/DocumentDiffList.js.map +1 -1
- package/dist/versioning/components/version-compare/PropDiffPanel.js +0 -7
- package/dist/versioning/components/version-compare/PropDiffPanel.js.map +1 -1
- package/dist/versioning/components/version-compare/PropDiffRow.js +0 -3
- package/dist/versioning/components/version-compare/PropDiffRow.js.map +1 -1
- package/dist/versioning/components/version-compare/PropValueDisplay.js +0 -22
- package/dist/versioning/components/version-compare/PropValueDisplay.js.map +1 -1
- package/dist/versioning/components/version-compare/VersionComparePage.js +0 -13
- package/dist/versioning/components/version-compare/VersionComparePage.js.map +1 -1
- package/dist/versioning/components/version-compare/VisualBranchCompare.js +0 -17
- package/dist/versioning/components/version-compare/VisualBranchCompare.js.map +1 -1
- package/dist/versioning/components/version-compare/VisualVersionCompare.js +0 -23
- package/dist/versioning/components/version-compare/VisualVersionCompare.js.map +1 -1
- package/dist/versioning/components/version-compare/index.js +0 -5
- package/dist/versioning/components/version-compare/index.js.map +1 -1
- package/dist/versioning/components/version-history/AgentCheckpointBadge.js +0 -14
- package/dist/versioning/components/version-history/AgentCheckpointBadge.js.map +1 -1
- package/dist/versioning/components/version-history/VersionItem.js +0 -7
- package/dist/versioning/components/version-history/VersionItem.js.map +1 -1
- package/dist/versioning/components/version-history/index.js +0 -5
- package/dist/versioning/components/version-history/index.js.map +1 -1
- package/dist/versioning/useCheckpoints.js +0 -28
- package/dist/versioning/useCheckpoints.js.map +1 -1
- package/dist/versioning/useVersions.js +0 -31
- package/dist/versioning/useVersions.js.map +1 -1
- package/dist/versioning/utils/branchDiff.js +0 -93
- package/dist/versioning/utils/branchDiff.js.map +1 -1
- package/dist/versioning/utils/diff.js +0 -79
- package/dist/versioning/utils/diff.js.map +1 -1
- package/dist/versioning/utils/formatVersionDate.js +0 -12
- package/dist/versioning/utils/formatVersionDate.js.map +1 -1
- package/dist/versioning/utils/highlightConfig.js +0 -42
- package/dist/versioning/utils/highlightConfig.js.map +1 -1
- package/dist/versioning/utils/versionKind.js +0 -10
- package/dist/versioning/utils/versionKind.js.map +1 -1
- package/package.json +7 -7
- package/src/data/data-list-block/data-list.css +314 -0
- package/src/pds/theme/PuckEditorTheme.css +5 -5
- package/src/styles.css +1 -1
- package/src/pds/theme/PuckEditorTheme.test.ts +0 -195
- package/src/pds/theme/pds-core-content.ts +0 -8
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
/**
|
|
3
|
-
* useP1Editor Hook
|
|
4
|
-
*
|
|
5
|
-
* All-in-one hook for setting up a P1-enabled Puck editor.
|
|
6
|
-
* Composes useP1Plugin and useP1Overrides internally, handles
|
|
7
|
-
* document loading, version management, historical version protection,
|
|
8
|
-
* and provides everything needed to render <Puck>.
|
|
9
|
-
*/
|
|
10
2
|
import { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
11
3
|
import { useP1Puck } from '../core/P1PuckContext.js';
|
|
12
4
|
import { useVersions } from '../versioning/useVersions.js';
|
|
13
5
|
import { useP1Auth } from '../auth/index.js';
|
|
6
|
+
import { isDocumentGoneError, isDocumentNotFoundError } from '../data/utils.js';
|
|
7
|
+
import { canCreatePages } from '../features/content-type-templates/permissions/role-permissions.js';
|
|
14
8
|
import { useP1Plugin } from './useP1Plugin.js';
|
|
15
9
|
import { useP1Overrides } from './useP1Overrides.js';
|
|
10
|
+
import { withFreshFieldTypes } from './freshFieldTypes.js';
|
|
16
11
|
import { useComponentRegistry } from './useComponentRegistry.js';
|
|
17
12
|
import { buildThumbnailOverride } from './utils/buildThumbnailOverride.js';
|
|
18
13
|
import { makeEagerVersionHandler } from './utils/makeEagerVersionHandler.js';
|
|
@@ -20,67 +15,45 @@ import { restoreDocumentVersion } from './utils/restoreDocumentVersion.js';
|
|
|
20
15
|
import { initialPanelUi } from './useResponsivePanels.js';
|
|
21
16
|
import { createDocumentSyncStore, createDocumentSyncPlugin, documentSyncKey, BLANK_SYNC_KEY, } from './plugin/document-sync-plugin.js';
|
|
22
17
|
import { resolveLiveThumbnailDrawer } from './thumbnails/resolveLiveThumbnailDrawer.js';
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* Must be used inside a P1PuckProvider.
|
|
31
|
-
*
|
|
32
|
-
* @param options - Editor configuration
|
|
33
|
-
* @returns Loading state, puck props, and P1 context
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```tsx
|
|
37
|
-
* function Editor() {
|
|
38
|
-
* const { loading, error, puckProps } = useP1Editor({
|
|
39
|
-
* documentPath: '/home',
|
|
40
|
-
* puckConfig: config,
|
|
41
|
-
* });
|
|
42
|
-
*
|
|
43
|
-
* if (loading) return <Loading />;
|
|
44
|
-
* if (error) return <Error error={error} />;
|
|
45
|
-
*
|
|
46
|
-
* return <Puck {...puckProps} />;
|
|
47
|
-
* }
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
18
|
+
function titleFromPath(path) {
|
|
19
|
+
const slug = path.split('/').filter(Boolean).pop();
|
|
20
|
+
if (!slug)
|
|
21
|
+
return 'Home';
|
|
22
|
+
const words = slug.replace(/[-_]+/g, ' ').trim();
|
|
23
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
24
|
+
}
|
|
50
25
|
export function useP1Editor(options) {
|
|
51
26
|
const { documentPath, puckConfig, additionalPlugins, additionalOverrides, thumbnails, liveThumbnailDrawer, overrideOptions, pluginOptions, onSelectionChange, onDocumentNotFound, } = options;
|
|
52
|
-
const
|
|
27
|
+
const ccr = useP1Puck();
|
|
53
28
|
const { user, logout } = useP1Auth();
|
|
54
|
-
// =========================================================================
|
|
55
|
-
// Document Loading
|
|
56
|
-
// =========================================================================
|
|
57
29
|
const [loading, setLoading] = useState(true);
|
|
58
30
|
const [error, setError] = useState(null);
|
|
59
31
|
const [needsRedirect, setNeedsRedirect] = useState(false);
|
|
32
|
+
const [notFound, setNotFound] = useState(false);
|
|
33
|
+
const [loadAttempt, setLoadAttempt] = useState(0);
|
|
60
34
|
const loadedPathRef = useRef(null);
|
|
61
|
-
|
|
62
|
-
const prevBranchRef = useRef(
|
|
63
|
-
if (prevBranchRef.current !==
|
|
64
|
-
prevBranchRef.current =
|
|
35
|
+
const loadedBranchRef = useRef(null);
|
|
36
|
+
const prevBranchRef = useRef(ccr.branchId);
|
|
37
|
+
if (prevBranchRef.current !== ccr.branchId) {
|
|
38
|
+
prevBranchRef.current = ccr.branchId;
|
|
65
39
|
loadedPathRef.current = null;
|
|
66
40
|
}
|
|
67
|
-
// Keep callback in a ref so the effect doesn't re-run when it changes
|
|
68
41
|
const onDocumentNotFoundRef = useRef(onDocumentNotFound);
|
|
69
42
|
onDocumentNotFoundRef.current = onDocumentNotFound;
|
|
70
43
|
useEffect(() => {
|
|
71
|
-
|
|
72
|
-
if (!css.branchId)
|
|
44
|
+
if (!ccr.branchId)
|
|
73
45
|
return;
|
|
74
|
-
// Skip if already loaded this path on this branch
|
|
75
46
|
if (loadedPathRef.current === documentPath)
|
|
76
47
|
return;
|
|
77
48
|
let cancelled = false;
|
|
78
49
|
setLoading(true);
|
|
79
50
|
setError(null);
|
|
80
|
-
|
|
51
|
+
setNotFound(false);
|
|
52
|
+
ccr.loadDocument(documentPath)
|
|
81
53
|
.then(() => {
|
|
82
54
|
if (!cancelled) {
|
|
83
55
|
loadedPathRef.current = documentPath;
|
|
56
|
+
loadedBranchRef.current = ccr.branchId;
|
|
84
57
|
setNeedsRedirect(false);
|
|
85
58
|
setLoading(false);
|
|
86
59
|
}
|
|
@@ -89,101 +62,87 @@ export function useP1Editor(options) {
|
|
|
89
62
|
if (cancelled)
|
|
90
63
|
return;
|
|
91
64
|
const loadErr = err instanceof Error ? err : new Error(String(err));
|
|
92
|
-
|
|
65
|
+
if (isDocumentGoneError(loadErr)) {
|
|
66
|
+
setNeedsRedirect(true);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
93
69
|
if (onDocumentNotFoundRef.current) {
|
|
94
70
|
try {
|
|
95
71
|
const shouldRetry = await onDocumentNotFoundRef.current(documentPath, loadErr);
|
|
96
72
|
if (!cancelled && shouldRetry) {
|
|
97
|
-
await
|
|
73
|
+
await ccr.loadDocument(documentPath);
|
|
98
74
|
if (!cancelled) {
|
|
99
75
|
loadedPathRef.current = documentPath;
|
|
76
|
+
loadedBranchRef.current = ccr.branchId;
|
|
100
77
|
setNeedsRedirect(false);
|
|
101
78
|
setLoading(false);
|
|
102
|
-
void
|
|
79
|
+
void ccr.refreshDocuments();
|
|
103
80
|
}
|
|
104
81
|
return;
|
|
105
82
|
}
|
|
106
83
|
}
|
|
107
84
|
catch {
|
|
108
|
-
// callback itself failed — fall through to unload
|
|
109
85
|
}
|
|
110
86
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
87
|
+
if (cancelled)
|
|
88
|
+
return;
|
|
89
|
+
if (isDocumentNotFoundError(loadErr)) {
|
|
90
|
+
loadedPathRef.current = null;
|
|
91
|
+
setNotFound(true);
|
|
92
|
+
setLoading(false);
|
|
93
|
+
return;
|
|
114
94
|
}
|
|
95
|
+
setNeedsRedirect(true);
|
|
115
96
|
});
|
|
116
97
|
return () => {
|
|
117
98
|
cancelled = true;
|
|
118
99
|
};
|
|
119
|
-
}, [documentPath,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
// the preview empty state guide the user to pick a page.
|
|
100
|
+
}, [documentPath, ccr.branchId, ccr.loadDocument, loadAttempt]);
|
|
101
|
+
const retry = useCallback(() => {
|
|
102
|
+
loadedPathRef.current = null;
|
|
103
|
+
setLoadAttempt((n) => n + 1);
|
|
104
|
+
}, []);
|
|
105
|
+
const branchBootError = ccr.branchId ? null : ccr.branchResolutionError ?? null;
|
|
126
106
|
useEffect(() => {
|
|
127
107
|
if (!needsRedirect)
|
|
128
108
|
return;
|
|
129
|
-
if (
|
|
109
|
+
if (ccr.documentsLoading)
|
|
130
110
|
return;
|
|
131
111
|
setNeedsRedirect(false);
|
|
132
|
-
if (
|
|
133
|
-
|
|
134
|
-
// a branch that genuinely holds nothing; saying "no documents" for the
|
|
135
|
-
// former is how the real failure stays hidden.
|
|
136
|
-
setError(css.documentsError ?? new Error('No documents found on this branch'));
|
|
112
|
+
if (ccr.documents.length === 0) {
|
|
113
|
+
setError(ccr.documentsError ?? new Error('No documents found on this branch'));
|
|
137
114
|
}
|
|
138
115
|
setLoading(false);
|
|
139
|
-
}, [needsRedirect,
|
|
140
|
-
// =========================================================================
|
|
141
|
-
// Version Management
|
|
142
|
-
// =========================================================================
|
|
116
|
+
}, [needsRedirect, ccr.documentsLoading, ccr.documents.length, ccr.documentsError]);
|
|
143
117
|
const { versions, loading: versionsLoading, refresh: refreshVersions, } = useVersions({
|
|
144
|
-
client:
|
|
145
|
-
siteId:
|
|
146
|
-
branchId:
|
|
147
|
-
documentId:
|
|
118
|
+
client: ccr.client,
|
|
119
|
+
siteId: ccr.siteId,
|
|
120
|
+
branchId: ccr.branchId,
|
|
121
|
+
documentId: ccr.currentDocument?.id ?? null,
|
|
148
122
|
});
|
|
149
|
-
// Refresh versions when document changes; also reset eager-version flag so a
|
|
150
|
-
// stale post-publish signal from the previous document never fires on the new one.
|
|
151
123
|
useEffect(() => {
|
|
152
124
|
needsVersionRef.current = false;
|
|
153
|
-
if (
|
|
125
|
+
if (ccr.currentDocument?.id)
|
|
154
126
|
void refreshVersions();
|
|
155
|
-
}, [
|
|
156
|
-
// Refresh versions after a successful save so the publish badge reflects the
|
|
157
|
-
// new unpublished draft (publishedStatus flips 'published' → 'unpublished-changes').
|
|
158
|
-
// Without this the badge would keep reading "Live" after an edit on the Live branch.
|
|
127
|
+
}, [ccr.currentDocument?.id, refreshVersions]);
|
|
159
128
|
useEffect(() => {
|
|
160
|
-
if (
|
|
129
|
+
if (ccr.saveStatus === 'saved')
|
|
161
130
|
void refreshVersions();
|
|
162
|
-
}, [
|
|
163
|
-
// Select a version — latest returns to live editing, others load historical
|
|
131
|
+
}, [ccr.saveStatus, refreshVersions]);
|
|
164
132
|
const handleVersionSelect = useCallback((version) => {
|
|
165
133
|
const latestVersion = versions[0];
|
|
166
134
|
if (latestVersion && version.id === latestVersion.id) {
|
|
167
|
-
void
|
|
135
|
+
void ccr.returnToLatest();
|
|
168
136
|
}
|
|
169
137
|
else {
|
|
170
|
-
void
|
|
138
|
+
void ccr.loadVersion(version);
|
|
171
139
|
}
|
|
172
|
-
}, [versions,
|
|
173
|
-
|
|
174
|
-
const
|
|
175
|
-
// =========================================================================
|
|
176
|
-
// Published Status (derived from version data)
|
|
177
|
-
// =========================================================================
|
|
178
|
-
// The backend includes isPublished on each DocumentVersion via an EXISTS
|
|
179
|
-
// subquery against checkpoint_documents. No additional API calls needed.
|
|
180
|
-
const currentVersionId = css.viewingVersion?.id ?? versions[0]?.id;
|
|
140
|
+
}, [versions, ccr.loadVersion, ccr.returnToLatest]);
|
|
141
|
+
const handleRestoreVersion = useCallback((version) => restoreDocumentVersion(version, ccr, refreshVersions, () => { }), [ccr, refreshVersions]);
|
|
142
|
+
const currentVersionId = ccr.viewingVersion?.id ?? versions[0]?.id;
|
|
181
143
|
const currentVersionIsPublished = versions.find(v => v.id === currentVersionId)?.isPublished ?? false;
|
|
182
144
|
const hasPublishedVersion = versions.some(v => v.isPublished);
|
|
183
|
-
|
|
184
|
-
// inherited and isPublished fields from the branch-level listing endpoint.
|
|
185
|
-
// css.currentDocument comes from the site-level getByPath endpoint and lacks these.
|
|
186
|
-
const branchDocument = css.documents.find(d => d.id === css.currentDocument?.id);
|
|
145
|
+
const branchDocument = ccr.documents.find(d => d.id === ccr.currentDocument?.id);
|
|
187
146
|
const inheritedAndPublished = branchDocument?.inherited && branchDocument?.isPublished;
|
|
188
147
|
const publishedStatus = versionsLoading
|
|
189
148
|
? undefined
|
|
@@ -194,60 +153,68 @@ export function useP1Editor(options) {
|
|
|
194
153
|
: hasPublishedVersion
|
|
195
154
|
? 'unpublished-changes'
|
|
196
155
|
: 'draft';
|
|
197
|
-
// =========================================================================
|
|
198
|
-
// Focus Region Reporting (outgoing — report local selection to server)
|
|
199
|
-
// =========================================================================
|
|
200
|
-
// Report selection changes to the presence system via WebSocket.
|
|
201
|
-
// Wraps the consumer's onSelectionChange so both reporting and
|
|
202
|
-
// the consumer callback are called.
|
|
203
156
|
const onSelectionChangeRef = useRef(onSelectionChange);
|
|
204
157
|
onSelectionChangeRef.current = onSelectionChange;
|
|
205
158
|
const handleSelectionChange = useCallback((path, itemId) => {
|
|
206
|
-
// Report to presence system via WebSocket (instant broadcast to other clients)
|
|
207
159
|
const regions = path ? [path] : [];
|
|
208
|
-
|
|
209
|
-
// Forward to consumer callback
|
|
160
|
+
ccr.sendFocusRegions(regions);
|
|
210
161
|
onSelectionChangeRef.current?.(path, itemId);
|
|
211
|
-
}, [
|
|
212
|
-
// =========================================================================
|
|
213
|
-
// Component Registry (runs at editor startup, writes descriptors to P1 backend)
|
|
214
|
-
// =========================================================================
|
|
162
|
+
}, [ccr.sendFocusRegions]);
|
|
215
163
|
useComponentRegistry({ puckConfig });
|
|
216
|
-
// =========================================================================
|
|
217
|
-
// Plugin & Overrides (composed hooks)
|
|
218
|
-
// =========================================================================
|
|
219
|
-
// Set true after a successful publish; the next onChange fires the eager
|
|
220
|
-
// version create and clears this immediately.
|
|
221
164
|
const needsVersionRef = useRef(false);
|
|
222
|
-
const eagerVersionParamsRef = useRef({ siteId:
|
|
223
|
-
eagerVersionParamsRef.current = { siteId:
|
|
224
|
-
// Wrap publish to refresh version list and call consumer callback after success.
|
|
165
|
+
const eagerVersionParamsRef = useRef({ siteId: ccr.siteId, branchId: ccr.branchId, documentId: ccr.currentDocument?.id ?? null });
|
|
166
|
+
eagerVersionParamsRef.current = { siteId: ccr.siteId, branchId: ccr.branchId, documentId: ccr.currentDocument?.id ?? null };
|
|
225
167
|
const consumerOnPublishSuccessRef = useRef(overrideOptions?.onPublishSuccess);
|
|
226
168
|
consumerOnPublishSuccessRef.current = overrideOptions?.onPublishSuccess;
|
|
227
169
|
const handlePublish = useCallback(async () => {
|
|
228
|
-
const checkpoint = await
|
|
170
|
+
const checkpoint = await ccr.publishDocument();
|
|
229
171
|
needsVersionRef.current = true;
|
|
230
172
|
void refreshVersions();
|
|
231
173
|
consumerOnPublishSuccessRef.current?.(checkpoint);
|
|
232
|
-
}, [
|
|
233
|
-
const canRevert =
|
|
234
|
-
// Pushes freshly loaded documents into the live Puck instance, replacing
|
|
235
|
-
// the remount-on-document-switch behavior the old document-scoped puckKey
|
|
236
|
-
// provided (see document-sync-plugin.tsx). Handed to the P1 plugin as well
|
|
237
|
-
// so its context sync defers document switches to this store.
|
|
174
|
+
}, [ccr, refreshVersions]);
|
|
175
|
+
const canRevert = ccr.userRole === 'admin' || ccr.userRole === 'editor' || ccr.userRole === 'author';
|
|
238
176
|
const [documentSyncStore] = useState(createDocumentSyncStore);
|
|
177
|
+
const [logoutError, setLogoutError] = useState(null);
|
|
178
|
+
const [isLoggingOut, setIsLoggingOut] = useState(false);
|
|
179
|
+
const handleLogout = useCallback(async () => {
|
|
180
|
+
setIsLoggingOut(true);
|
|
181
|
+
setLogoutError(null);
|
|
182
|
+
try {
|
|
183
|
+
const outcome = await logout();
|
|
184
|
+
if (outcome.status === 'error') {
|
|
185
|
+
setLogoutError(outcome.message);
|
|
186
|
+
setIsLoggingOut(false);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
catch (err) {
|
|
190
|
+
setLogoutError(err instanceof Error ? err.message : 'Logout failed');
|
|
191
|
+
setIsLoggingOut(false);
|
|
192
|
+
}
|
|
193
|
+
}, [logout]);
|
|
194
|
+
const pageNotFound = useMemo(() => notFound
|
|
195
|
+
? {
|
|
196
|
+
canCreate: canCreatePages(ccr.userRole),
|
|
197
|
+
onCreate: async () => {
|
|
198
|
+
await ccr.createDocument(documentPath, null, titleFromPath(documentPath));
|
|
199
|
+
retry();
|
|
200
|
+
},
|
|
201
|
+
}
|
|
202
|
+
: null, [notFound, documentPath, ccr.userRole, ccr.createDocument, retry]);
|
|
239
203
|
const p1Plugin = useP1Plugin({
|
|
240
204
|
documentSyncStore,
|
|
205
|
+
pageNotFound,
|
|
241
206
|
onSelectionChange: handleSelectionChange,
|
|
242
|
-
currentUser: user ? { id:
|
|
243
|
-
onLogout:
|
|
207
|
+
currentUser: user ? { id: ccr.userId, name: user.name, email: user.email, avatar: user.picture } : undefined,
|
|
208
|
+
onLogout: handleLogout,
|
|
209
|
+
logoutError,
|
|
210
|
+
isLoggingOut,
|
|
244
211
|
puckConfig,
|
|
245
212
|
...pluginOptions,
|
|
246
213
|
onPublish: handlePublish,
|
|
247
214
|
versions,
|
|
248
215
|
versionsLoading,
|
|
249
216
|
publishedStatus,
|
|
250
|
-
selectedVersionId:
|
|
217
|
+
selectedVersionId: ccr.viewingVersion?.id ?? undefined,
|
|
251
218
|
onVersionSelect: handleVersionSelect,
|
|
252
219
|
onRestoreVersion: handleRestoreVersion,
|
|
253
220
|
canRevert,
|
|
@@ -261,11 +228,7 @@ export function useP1Editor(options) {
|
|
|
261
228
|
publishedStatus,
|
|
262
229
|
...(overrideOptions?.onPublishSuccess ? { onPublishSuccess: wrappedOnPublishSuccess } : {}),
|
|
263
230
|
});
|
|
264
|
-
// =========================================================================
|
|
265
|
-
// Stable plugin array
|
|
266
|
-
// =========================================================================
|
|
267
231
|
if (process.env.NODE_ENV === "development") {
|
|
268
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
269
232
|
const prev = useRef(additionalPlugins);
|
|
270
233
|
if (prev.current !== additionalPlugins) {
|
|
271
234
|
const countChanged = (prev.current?.length ?? 0) !== (additionalPlugins?.length ?? 0);
|
|
@@ -280,77 +243,53 @@ export function useP1Editor(options) {
|
|
|
280
243
|
additionalPluginsRef.current = additionalPlugins;
|
|
281
244
|
const pluginCount = additionalPlugins?.length ?? 0;
|
|
282
245
|
const documentSyncPlugin = useMemo(() => createDocumentSyncPlugin(documentSyncStore), [documentSyncStore]);
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
// Both the key and the data come from the payload's own origin, so a key can
|
|
286
|
-
// never be paired with a different document's data. Keying off the live
|
|
287
|
-
// branchId instead published the incoming branch's key beside the outgoing
|
|
288
|
-
// branch's data the instant a switch began; the plugin applied that pairing,
|
|
289
|
-
// recorded the new key as applied, and then ignored the correct document when
|
|
290
|
-
// it arrived under the same key — leaving the canvas a workstream behind.
|
|
291
|
-
//
|
|
292
|
-
// safeData is read directly rather than through a ref: it only advances when
|
|
293
|
-
// the provider loads a document (saveData deliberately never touches
|
|
294
|
-
// currentData), so it cannot re-fire on every keystroke.
|
|
295
|
-
const currentDocumentId = css.currentDocument?.id;
|
|
296
|
-
const origin = css.currentDataOrigin;
|
|
246
|
+
const currentDocumentId = ccr.currentDocument?.id;
|
|
247
|
+
const origin = ccr.currentDataOrigin;
|
|
297
248
|
useEffect(() => {
|
|
298
249
|
if (loading || error || !origin)
|
|
299
250
|
return;
|
|
300
|
-
// Historical versions sync through ContextSyncBridge, which does not reset
|
|
301
|
-
// the undo stack.
|
|
302
251
|
if (origin.historical)
|
|
303
252
|
return;
|
|
304
|
-
|
|
305
|
-
// Withholding it keeps the applied key naming what the canvas really shows.
|
|
306
|
-
if (origin.branchId !== css.branchId)
|
|
253
|
+
if (origin.branchId !== ccr.branchId)
|
|
307
254
|
return;
|
|
308
255
|
if (origin.documentId !== currentDocumentId)
|
|
309
256
|
return;
|
|
310
257
|
documentSyncStore.publish({
|
|
311
258
|
syncKey: documentSyncKey(origin.branchId, origin.documentId),
|
|
312
|
-
data:
|
|
259
|
+
data: ccr.safeData,
|
|
313
260
|
});
|
|
314
261
|
}, [
|
|
315
262
|
loading,
|
|
316
263
|
error,
|
|
317
264
|
origin,
|
|
318
|
-
|
|
319
|
-
|
|
265
|
+
ccr.safeData,
|
|
266
|
+
ccr.branchId,
|
|
320
267
|
currentDocumentId,
|
|
321
268
|
documentSyncStore,
|
|
322
269
|
]);
|
|
270
|
+
const featurePuckPlugins = ccr.featurePuckPlugins;
|
|
323
271
|
const plugins = useMemo(() => {
|
|
324
272
|
const result = [p1Plugin, documentSyncPlugin];
|
|
273
|
+
result.push(...featurePuckPlugins);
|
|
325
274
|
if (additionalPluginsRef.current) {
|
|
326
275
|
result.push(...additionalPluginsRef.current);
|
|
327
276
|
}
|
|
328
277
|
return result;
|
|
329
|
-
}, [p1Plugin, documentSyncPlugin, pluginCount]);
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
// document switches)
|
|
333
|
-
// =========================================================================
|
|
334
|
-
const isViewingHistoricalRef = useRef(css.isViewingHistoricalVersion);
|
|
335
|
-
isViewingHistoricalRef.current = css.isViewingHistoricalVersion;
|
|
336
|
-
// With Puck surviving document switches, onChange can fire while the canvas
|
|
337
|
-
// still shows the previous document but css already targets the new one
|
|
338
|
-
// (load in flight, or loaded but not yet pushed by the sync plugin). Saving
|
|
339
|
-
// then would write the old page's content into the new page — drop instead.
|
|
278
|
+
}, [p1Plugin, documentSyncPlugin, featurePuckPlugins, pluginCount]);
|
|
279
|
+
const isViewingHistoricalRef = useRef(ccr.isViewingHistoricalVersion);
|
|
280
|
+
isViewingHistoricalRef.current = ccr.isViewingHistoricalVersion;
|
|
340
281
|
const saveTargetKeyRef = useRef(null);
|
|
341
|
-
saveTargetKeyRef.current =
|
|
342
|
-
? documentSyncKey(
|
|
282
|
+
saveTargetKeyRef.current = ccr.currentDocument?.id
|
|
283
|
+
? documentSyncKey(ccr.branchId, ccr.currentDocument.id)
|
|
343
284
|
: null;
|
|
344
285
|
const eagerVersionHandler = useMemo(() => makeEagerVersionHandler(needsVersionRef, () => eagerVersionParamsRef.current, {
|
|
345
|
-
createVersion: (siteId, params) =>
|
|
286
|
+
createVersion: (siteId, params) => ccr.client.versions.create(siteId, params),
|
|
346
287
|
refreshVersions,
|
|
347
|
-
}), [
|
|
348
|
-
const { saveData } =
|
|
288
|
+
}), [ccr.client, refreshVersions]);
|
|
289
|
+
const { saveData } = ccr;
|
|
349
290
|
const onChange = useCallback((data) => {
|
|
350
291
|
if (isViewingHistoricalRef.current)
|
|
351
292
|
return;
|
|
352
|
-
// The blank sentinel stays permissive so a consumer running without the
|
|
353
|
-
// document-sync plugin is not frozen read-only.
|
|
354
293
|
const appliedKey = documentSyncStore.getAppliedKey();
|
|
355
294
|
if (appliedKey !== BLANK_SYNC_KEY && appliedKey !== saveTargetKeyRef.current) {
|
|
356
295
|
console.warn('[useP1Editor] save SKIPPED: canvas/document mismatch during switch.', 'canvas:', appliedKey, 'target:', saveTargetKeyRef.current);
|
|
@@ -359,44 +298,21 @@ export function useP1Editor(options) {
|
|
|
359
298
|
eagerVersionHandler(data);
|
|
360
299
|
saveData(data);
|
|
361
300
|
}, [saveData, documentSyncStore, eagerVersionHandler]);
|
|
362
|
-
// =========================================================================
|
|
363
|
-
// Permissions (read-only for historical versions)
|
|
364
|
-
// =========================================================================
|
|
365
301
|
const permissions = useMemo(() => {
|
|
366
|
-
if (
|
|
367
|
-
// Omit edit:false so page/root fields are never locked by Puck's own
|
|
368
|
-
// readonly rendering. Interaction is blocked by ReadOnlyFieldsGuard
|
|
369
|
-
// (inert attribute) instead, which also covers root fields without
|
|
370
|
-
// requiring resolvePermissions on config.root.
|
|
302
|
+
if (ccr.isViewingHistoricalVersion) {
|
|
371
303
|
return { delete: false, drag: false, duplicate: false, insert: false };
|
|
372
304
|
}
|
|
373
305
|
return { delete: true, drag: true, duplicate: true, edit: true, insert: true };
|
|
374
|
-
}, [
|
|
375
|
-
// =========================================================================
|
|
376
|
-
// Stable merged overrides
|
|
377
|
-
// =========================================================================
|
|
378
|
-
// Merge additional overrides (e.g. from media plugins) with P1 overrides.
|
|
379
|
-
// Uses ref pattern to keep the merge stable — only recomputes when
|
|
380
|
-
// p1Overrides changes, not when additionalOverrides reference changes
|
|
381
|
-
// (which would happen every render if the consumer doesn't memoize).
|
|
306
|
+
}, [ccr.isViewingHistoricalVersion]);
|
|
382
307
|
const additionalOverridesRef = useRef(additionalOverrides);
|
|
383
308
|
additionalOverridesRef.current = additionalOverrides;
|
|
384
|
-
// Thumbnail override — built from the thumbnails map and merged between
|
|
385
|
-
// p1Overrides and additionalOverrides so the site can still fully override
|
|
386
|
-
// componentItem if needed.
|
|
387
309
|
const thumbnailsRef = useRef(thumbnails);
|
|
388
310
|
thumbnailsRef.current = thumbnails;
|
|
389
|
-
// Live thumbnail drawer — default ON for every consumer. Uses raw puckConfig
|
|
390
|
-
// (not configWithPermissions) so previews show all components regardless of
|
|
391
|
-
// role. Because useMemo deps on p1Overrides (stable after mount), changes to
|
|
392
|
-
// puckConfig or liveThumbnailDrawer after mount are not picked up.
|
|
393
311
|
const puckConfigRef = useRef(puckConfig);
|
|
394
312
|
puckConfigRef.current = puckConfig;
|
|
395
313
|
const liveThumbnailDrawerRef = useRef(liveThumbnailDrawer);
|
|
396
314
|
liveThumbnailDrawerRef.current = liveThumbnailDrawer;
|
|
397
315
|
const mergedOverrides = useMemo(() => {
|
|
398
|
-
// Layer order (last wins):
|
|
399
|
-
// p1Overrides → liveThumbnailDrawer → thumbnailOverride → additionalOverrides
|
|
400
316
|
const layers = [
|
|
401
317
|
p1Overrides,
|
|
402
318
|
resolveLiveThumbnailDrawer(puckConfigRef.current, liveThumbnailDrawerRef.current),
|
|
@@ -418,35 +334,16 @@ export function useP1Editor(options) {
|
|
|
418
334
|
}
|
|
419
335
|
}
|
|
420
336
|
}
|
|
421
|
-
return merged;
|
|
337
|
+
return withFreshFieldTypes(merged);
|
|
422
338
|
}, [p1Overrides]);
|
|
423
|
-
|
|
424
|
-
// Assemble puckProps
|
|
425
|
-
// =========================================================================
|
|
426
|
-
// Key that forces Puck to remount on role change (let puck internally manage the change on document change),
|
|
427
|
-
// ensuring clean undo history, sidebar state, and fresh permission cache.
|
|
428
|
-
// Puck caches resolvePermissions results per component instance — the
|
|
429
|
-
// cache is only invalidated when component data changes, not when the
|
|
430
|
-
// resolver function changes. Including userRole in the key forces a
|
|
431
|
-
// clean remount with an empty cache when roles switch.
|
|
432
|
-
const puckKey = `css-${css.userRole}`;
|
|
433
|
-
// Sidebar visibility for the initial mount. puckKey is the dependency on
|
|
434
|
-
// purpose even though it is not read here: a new key remounts Puck, which
|
|
435
|
-
// re-reads this as its initial `ui`, so the budget must be applied again.
|
|
436
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
339
|
+
const puckKey = `p1-${ccr.userRole}`;
|
|
437
340
|
const initialSidebarUi = useMemo(() => initialPanelUi(), [puckKey]);
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
// Puck doesn't have a top-level resolvePermissions prop — permissions
|
|
442
|
-
// must be resolved per-component via config[type].resolvePermissions.
|
|
443
|
-
const resolvePermsRef = useRef(css.resolvePermissions);
|
|
444
|
-
resolvePermsRef.current = css.resolvePermissions;
|
|
445
|
-
// Template mode: editing a template document (path `_registry/templates/<name>`).
|
|
446
|
-
const isTemplateMode = /^_registry\/templates\//.test(css.currentDocument?.path ?? '');
|
|
341
|
+
const resolvePermsRef = useRef(ccr.resolvePermissions);
|
|
342
|
+
resolvePermsRef.current = ccr.resolvePermissions;
|
|
343
|
+
const isTemplateMode = /^_registry\/templates\//.test(ccr.currentDocument?.path ?? '');
|
|
447
344
|
const configWithPermissions = useMemo(() => {
|
|
448
345
|
let cfg = puckConfig;
|
|
449
|
-
if (
|
|
346
|
+
if (ccr.resolvePermissions) {
|
|
450
347
|
const components = (cfg.components ?? {});
|
|
451
348
|
const wrapped = {};
|
|
452
349
|
for (const [name, comp] of Object.entries(components)) {
|
|
@@ -457,12 +354,6 @@ export function useP1Editor(options) {
|
|
|
457
354
|
if (!resolver)
|
|
458
355
|
return params.permissions;
|
|
459
356
|
const basePerms = resolver({ type: name, props: data?.props }, {});
|
|
460
|
-
// Template-authoring mode: the context resolver only sees a
|
|
461
|
-
// metadata summary (no pins), so the document's live _pinMap is the
|
|
462
|
-
// pin source. On a bound page the resolver reads the live template
|
|
463
|
-
// and already governs pins, so the page's own snapshot pinMap is
|
|
464
|
-
// ignored — otherwise a stale pin would stay locked after the
|
|
465
|
-
// template unpins it.
|
|
466
357
|
if (isTemplateMode) {
|
|
467
358
|
const pinMap = (params.appState?.data?.root?.props?._pinMap ?? {});
|
|
468
359
|
const compId = data?.props?.id;
|
|
@@ -476,31 +367,43 @@ export function useP1Editor(options) {
|
|
|
476
367
|
}
|
|
477
368
|
cfg = { ...cfg, components: wrapped };
|
|
478
369
|
}
|
|
479
|
-
// In template mode, relabel the right-sidebar root header "Page" -> "Template".
|
|
480
|
-
// Puck derives that heading from `config.root.label` (no override hook exists).
|
|
481
370
|
if (isTemplateMode) {
|
|
482
371
|
const root = (cfg.root ?? {});
|
|
483
372
|
cfg = { ...cfg, root: { ...root, label: 'Template' } };
|
|
484
373
|
}
|
|
485
374
|
return cfg;
|
|
486
|
-
}, [puckConfig, !!
|
|
375
|
+
}, [puckConfig, !!ccr.resolvePermissions, isTemplateMode]);
|
|
487
376
|
const puckProps = useMemo(() => ({
|
|
488
377
|
config: configWithPermissions,
|
|
489
|
-
data:
|
|
378
|
+
data: ccr.safeData,
|
|
490
379
|
onChange,
|
|
491
380
|
plugins,
|
|
492
381
|
overrides: mergedOverrides,
|
|
493
382
|
ui: initialSidebarUi,
|
|
494
383
|
permissions,
|
|
495
|
-
onAction:
|
|
496
|
-
}), [configWithPermissions,
|
|
384
|
+
onAction: ccr.handleAction,
|
|
385
|
+
}), [configWithPermissions, ccr.safeData, onChange, plugins, mergedOverrides, initialSidebarUi, permissions, ccr.handleAction]);
|
|
386
|
+
const inFlight = branchBootError === null && loading;
|
|
387
|
+
const lastGoodRef = useRef(null);
|
|
388
|
+
const settled = loadedPathRef.current === documentPath && loadedBranchRef.current === ccr.branchId;
|
|
389
|
+
if (settled && !inFlight && !error && !branchBootError) {
|
|
390
|
+
lastGoodRef.current = { puckKey, puckProps };
|
|
391
|
+
}
|
|
392
|
+
const retained = lastGoodRef.current;
|
|
393
|
+
const hasContent = retained !== null;
|
|
394
|
+
const reloadKind = loadedBranchRef.current !== null && loadedBranchRef.current !== ccr.branchId
|
|
395
|
+
? 'branch'
|
|
396
|
+
: 'document';
|
|
497
397
|
return {
|
|
498
|
-
loading:
|
|
398
|
+
loading: inFlight && !hasContent,
|
|
399
|
+
reloading: inFlight && hasContent ? reloadKind : null,
|
|
400
|
+
hasContent,
|
|
499
401
|
error: error ?? branchBootError,
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
402
|
+
notFound,
|
|
403
|
+
retry,
|
|
404
|
+
puckKey: retained?.puckKey ?? puckKey,
|
|
405
|
+
puckProps: retained?.puckProps ?? puckProps,
|
|
406
|
+
css: ccr,
|
|
504
407
|
redirectPath: null,
|
|
505
408
|
};
|
|
506
409
|
}
|