/** * P1 Puck Overrides * * Creates Puck overrides for P1 integration: fields-panel behavior, the * outline panel, and the action bar. It no longer declares `headerActions` — * that block (save status, publish badge, collaborator avatars) was dead * code, discarded by the P1 plugin's own `header` override (P1Plugin.tsx's * `HeaderOverride`), which never forwards the `actions` prop Puck builds from * the `headerActions` chain. The equivalent live UI is * P1EditorSubheader's own PublishControl/PresenceStack, driven directly by * props from P1SubheaderBridge. */ import React from 'react'; import type { Checkpoint, DocumentVersion, PuckData, ActorPresence } from '@pantheon-systems/css-client'; import type { SaveStatus } from '../../core/types.js'; export { templateFromRegistryPath } from '../utils/templatePath.js'; export { P1TemplateFields } from '../components/P1TemplateFields.js'; /** * Options for creating P1 overrides */ export interface P1OverridesOptions { /** * @deprecated Was used to build the `headerActions` SaveIndicator, which was * dead code — discarded by the P1 plugin's own `header` * override before it ever reached the screen. P1EditorSubheader's own * PublishControl shows live save state instead. This prop is ignored. */ getSaveStatus?: () => SaveStatus; /** * @deprecated Same as `getSaveStatus` — ignored. */ getLastSaved?: () => Date | null; /** * @deprecated Same as `getSaveStatus` — ignored. */ getSaveError?: () => Error | null; /** * @deprecated Same as `getSaveStatus` — ignored. */ saveStatus?: SaveStatus; /** * @deprecated Same as `getSaveStatus` — ignored. */ lastSaved?: Date | null; /** * @deprecated Same as `getSaveStatus` — ignored. */ saveError?: Error | null; /** * @deprecated Was passed to the dead `headerActions` SaveIndicator (see * `getSaveStatus`). This prop is ignored. */ onRetrySave: () => void; /** * @deprecated Publish is now handled by P1EditorSubheader's PublishControl. * This prop is ignored and will be removed in a future release. */ onPublish?: () => Promise; /** * @deprecated Publish is now handled by P1EditorSubheader's PublishControl. * This prop is ignored and will be removed in a future release. */ onPublishSuccess?: (checkpoint: Checkpoint) => void; /** * @deprecated Publish is now handled by P1EditorSubheader's PublishControl. * This prop is ignored and will be removed in a future release. */ onPublishError?: (error: Error) => void; /** * @deprecated Only gated the dead `headerActions` block's own children. * This prop is ignored. */ showDefaultPublish?: boolean; /** * @deprecated Only gated the dead `headerActions` block. * This prop is ignored. */ isViewingHistoricalVersion?: boolean; /** The historical version being previewed. */ viewingVersion?: DocumentVersion | null; /** * Callback to exit version preview and return to the latest version. * Wired to the "Back to current version" button in the components/outline overlays. */ onReturnToLatest?: () => void; /** * @deprecated Pass to VersionBannerOverride instead. The banner is no longer * rendered by createP1Overrides; this prop is silently ignored. */ onRestoreVersion?: (version: DocumentVersion) => Promise; /** * @deprecated Pass to VersionBannerOverride instead. The banner is no longer * rendered by createP1Overrides; this prop is silently ignored. */ canRevert?: boolean; /** * @deprecated Pass syncData to createP1Plugin instead. The plugin renders * inside Puck's context where usePuck() works correctly. Passing these props * here will be ignored. */ syncData?: PuckData | null; /** * @deprecated Pass dataSyncKey to createP1Plugin instead. The plugin renders * inside Puck's context where usePuck() works correctly. Passing these props * here will be ignored. */ dataSyncKey?: string | null; /** * @deprecated Drove the dead `headerActions` SaveIndicator. This prop is * ignored; P1EditorSubheader's PublishControl shows live save state * instead. */ showSaveIndicator?: boolean; /** @deprecated Ignored — see the Presence/Agent Features note above. */ showCollaboratorAvatars?: boolean; /** @deprecated Ignored — see the Presence/Agent Features note above. */ presence?: ActorPresence[]; /** @deprecated Ignored — see the Presence/Agent Features note above. */ showAgentActivityBanner?: boolean; /** @deprecated Ignored — see the Presence/Agent Features note above. */ activeAgents?: ActorPresence[]; /** @deprecated Ignored — see the Presence/Agent Features note above. */ isAgentEditing?: boolean; /** @deprecated Ignored — see the Presence/Agent Features note above. */ onStopAgent?: (agent: ActorPresence) => void; /** * @deprecated Drove the dead `headerActions` PublishedStatusBadge. This * prop is ignored; P1EditorSubheader's PublishControl (via * `badgeDocState`) shows live published status instead. */ publishedStatus?: 'published' | 'unpublished-changes' | 'draft'; /** * Whether threads are available to this reader. Off by default: the feature is * behind a rollout flag, and while it is off none of it is reachable. */ threadsEnabled?: boolean; } /** * Puck Overrides type (matches Puck's expected structure) */ export interface PuckOverrides { headerActions?: (props: { children: React.ReactNode; }) => React.ReactElement; drawerItem?: (props: { name: string; children: React.ReactNode; }) => React.ReactElement; [key: string]: unknown; } interface FieldLabelOverrideProps { children?: React.ReactNode; icon?: React.ReactNode; label: string; el?: 'label' | 'div'; readOnly?: boolean; } /** * Renders an opted-in field group's label row as a disclosure. Puck hands a * label override the field's content as `children`, so the group's own label * becomes the toggle — there is no second header and nothing to suppress. * * The context is cleared for descendants so a nested group inside a collapsible * one keeps its ordinary label. * * Ordinary field labels drop Puck's field-type icon. Its select variant is a * chevron, the same glyph the disclosure above uses, so it reads as a group that * expands and then does nothing. The label already says what the field is, and * the narrow inspector would rather have the space. The read-only lock is a * separate slot and survives. */ export declare function P1FieldLabel(props: FieldLabelOverrideProps): React.ReactElement; export declare function createP1Overrides(options: P1OverridesOptions): PuckOverrides;