@pantheon-systems/puck-css 0.7.0 → 0.9.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/dist/agent/useAgentEdit.d.ts.map +1 -1
- package/dist/agent/useAgentEdit.js.map +1 -1
- package/dist/agent/useAgentTrigger.d.ts.map +1 -1
- package/dist/agent/useAgentTrigger.js.map +1 -1
- package/dist/auth/AuthGate.d.ts +1 -1
- package/dist/auth/AuthGate.d.ts.map +1 -1
- package/dist/collaboration/utils/avatarColor.d.ts +2 -8
- package/dist/collaboration/utils/avatarColor.d.ts.map +1 -1
- package/dist/collaboration/utils/avatarColor.js +4 -31
- package/dist/collaboration/utils/avatarColor.js.map +1 -1
- package/dist/collaboration/utils/focusHighlightConfig.d.ts.map +1 -1
- package/dist/collaboration/utils/focusHighlightConfig.js.map +1 -1
- package/dist/collaboration/utils/initials.d.ts +2 -0
- package/dist/collaboration/utils/initials.d.ts.map +1 -0
- package/dist/collaboration/utils/initials.js +27 -0
- package/dist/collaboration/utils/initials.js.map +1 -0
- package/dist/collaboration/utils/presenceIdentity.d.ts +29 -0
- package/dist/collaboration/utils/presenceIdentity.d.ts.map +1 -0
- package/dist/collaboration/utils/presenceIdentity.js +42 -0
- package/dist/collaboration/utils/presenceIdentity.js.map +1 -0
- package/dist/core/config.d.ts +2 -2
- package/dist/core/config.d.ts.map +1 -1
- package/dist/core/config.js +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/types.d.ts +21 -4
- package/dist/core/types.d.ts.map +1 -1
- package/dist/data/css-queries/css-query-registry.d.ts +11 -0
- package/dist/data/css-queries/css-query-registry.d.ts.map +1 -0
- package/dist/data/css-queries/css-query-registry.js +28 -0
- package/dist/data/css-queries/css-query-registry.js.map +1 -0
- package/dist/data/dal/index.d.ts +1 -1
- package/dist/data/dal/index.d.ts.map +1 -1
- package/dist/data/dal/init.d.ts +5 -0
- package/dist/data/dal/init.d.ts.map +1 -1
- package/dist/data/dal/init.js +31 -4
- package/dist/data/dal/init.js.map +1 -1
- package/dist/data/dal/p1-store.d.ts +23 -0
- package/dist/data/dal/p1-store.d.ts.map +1 -1
- package/dist/data/dal/p1-store.js +14 -1
- package/dist/data/dal/p1-store.js.map +1 -1
- package/dist/data/page-editor-meta.d.ts.map +1 -1
- package/dist/data/page-editor-meta.js +0 -1
- package/dist/data/page-editor-meta.js.map +1 -1
- package/dist/data/query-provider.d.ts +1 -1
- package/dist/data/query-provider.d.ts.map +1 -1
- package/dist/data/remote-datasources/fetch-http-json.d.ts.map +1 -1
- package/dist/data/remote-datasources/fetch-http-json.js.map +1 -1
- package/dist/data/remote-datasources/loader.js +1 -1
- package/dist/data/remote-datasources/loader.js.map +1 -1
- package/dist/data/resolve-data-templates.d.ts.map +1 -1
- package/dist/data/resolve-data-templates.js +26 -4
- package/dist/data/resolve-data-templates.js.map +1 -1
- package/dist/editor/P1App.d.ts.map +1 -1
- package/dist/editor/P1App.js +1 -1
- package/dist/editor/P1App.js.map +1 -1
- package/dist/editor/P1PuckProvider.d.ts.map +1 -1
- package/dist/editor/P1PuckProvider.js +174 -57
- package/dist/editor/P1PuckProvider.js.map +1 -1
- package/dist/editor/aiPanelStore.d.ts +15 -0
- package/dist/editor/aiPanelStore.d.ts.map +1 -0
- package/dist/editor/aiPanelStore.js +43 -0
- package/dist/editor/aiPanelStore.js.map +1 -0
- package/dist/editor/components/CollapsibleFieldSection.d.ts +10 -0
- package/dist/editor/components/CollapsibleFieldSection.d.ts.map +1 -0
- package/dist/editor/components/CollapsibleFieldSection.js +9 -0
- package/dist/editor/components/CollapsibleFieldSection.js.map +1 -0
- package/dist/editor/components/CollapsibleSection.module.css +70 -0
- package/dist/editor/components/CollapsibleSectionHeader.d.ts +20 -0
- package/dist/editor/components/CollapsibleSectionHeader.d.ts.map +1 -0
- package/dist/editor/components/CollapsibleSectionHeader.js +10 -0
- package/dist/editor/components/CollapsibleSectionHeader.js.map +1 -0
- package/dist/editor/components/DraggableRow.d.ts +13 -0
- package/dist/editor/components/DraggableRow.d.ts.map +1 -0
- package/dist/editor/components/DraggableRow.js +20 -0
- package/dist/editor/components/DraggableRow.js.map +1 -0
- package/dist/editor/components/FieldHelpText.d.ts +6 -0
- package/dist/editor/components/FieldHelpText.d.ts.map +1 -0
- package/dist/editor/components/FieldHelpText.js +6 -0
- package/dist/editor/components/FieldHelpText.js.map +1 -0
- package/dist/editor/components/FieldHelpText.module.css +13 -0
- package/dist/editor/components/InspectorTabHeader.d.ts +18 -0
- package/dist/editor/components/InspectorTabHeader.d.ts.map +1 -0
- package/dist/editor/components/InspectorTabHeader.js +16 -0
- package/dist/editor/components/InspectorTabHeader.js.map +1 -0
- package/dist/editor/components/OutlinePanel.d.ts +10 -0
- package/dist/editor/components/OutlinePanel.d.ts.map +1 -0
- package/dist/editor/components/OutlinePanel.js +64 -0
- package/dist/editor/components/OutlinePanel.js.map +1 -0
- package/dist/editor/components/OutlinePanel.module.css +111 -0
- package/dist/editor/components/P1InspectorFields.d.ts +16 -0
- package/dist/editor/components/P1InspectorFields.d.ts.map +1 -0
- package/dist/editor/components/P1InspectorFields.js +61 -0
- package/dist/editor/components/P1InspectorFields.js.map +1 -0
- package/dist/editor/components/P1TemplateFields.d.ts +11 -0
- package/dist/editor/components/P1TemplateFields.d.ts.map +1 -0
- package/dist/editor/components/P1TemplateFields.js +52 -0
- package/dist/editor/components/P1TemplateFields.js.map +1 -0
- package/dist/editor/components/PanelHeader.d.ts +25 -0
- package/dist/editor/components/PanelHeader.d.ts.map +1 -0
- package/dist/editor/components/PanelHeader.js +12 -0
- package/dist/editor/components/PanelHeader.js.map +1 -0
- package/dist/editor/components/PanelHeader.module.css +34 -0
- package/dist/editor/components/PanelShell.d.ts +10 -0
- package/dist/editor/components/PanelShell.d.ts.map +1 -0
- package/dist/editor/components/PanelShell.js +7 -0
- package/dist/editor/components/PanelShell.js.map +1 -0
- package/dist/editor/components/PanelShell.module.css +15 -0
- package/dist/editor/components/PreviewPanelOverlay.d.ts +12 -0
- package/dist/editor/components/PreviewPanelOverlay.d.ts.map +1 -0
- package/dist/editor/components/PreviewPanelOverlay.js +7 -0
- package/dist/editor/components/PreviewPanelOverlay.js.map +1 -0
- package/dist/editor/components/PublishedStatusBadge.d.ts +1 -1
- package/dist/editor/components/PublishedStatusBadge.d.ts.map +1 -1
- package/dist/editor/components/VersionBannerOverride.d.ts +5 -1
- package/dist/editor/components/VersionBannerOverride.d.ts.map +1 -1
- package/dist/editor/components/VersionBannerOverride.js +24 -7
- package/dist/editor/components/VersionBannerOverride.js.map +1 -1
- package/dist/editor/components/VersionTimeline.d.ts +20 -0
- package/dist/editor/components/VersionTimeline.d.ts.map +1 -0
- package/dist/editor/components/VersionTimeline.js +42 -0
- package/dist/editor/components/VersionTimeline.js.map +1 -0
- package/dist/editor/components/collapsibleSectionContext.d.ts +17 -0
- package/dist/editor/components/collapsibleSectionContext.d.ts.map +1 -0
- package/dist/editor/components/collapsibleSectionContext.js +13 -0
- package/dist/editor/components/collapsibleSectionContext.js.map +1 -0
- package/dist/editor/components/componentIconName.d.ts +15 -0
- package/dist/editor/components/componentIconName.d.ts.map +1 -0
- package/dist/editor/components/componentIconName.js +68 -0
- package/dist/editor/components/componentIconName.js.map +1 -0
- package/dist/editor/components/connectable.d.ts +1 -1
- package/dist/editor/components/connectable.d.ts.map +1 -1
- package/dist/editor/components/merge-preview/MergePreviewPanel.d.ts.map +1 -1
- package/dist/editor/components/merge-preview/MergePreviewPanel.js.map +1 -1
- package/dist/editor/components/merge-preview/MergePreviewRenderer.js +3 -15
- package/dist/editor/components/merge-preview/MergePreviewRenderer.js.map +1 -1
- package/dist/editor/components/outlineTree.d.ts +68 -0
- package/dist/editor/components/outlineTree.d.ts.map +1 -0
- package/dist/editor/components/outlineTree.js +72 -0
- package/dist/editor/components/outlineTree.js.map +1 -0
- package/dist/editor/components/useDragReorder.d.ts +16 -0
- package/dist/editor/components/useDragReorder.d.ts.map +1 -0
- package/dist/editor/components/useDragReorder.js +35 -0
- package/dist/editor/components/useDragReorder.js.map +1 -0
- package/dist/editor/index.d.ts +13 -0
- package/dist/editor/index.d.ts.map +1 -1
- package/dist/editor/index.js +8 -0
- package/dist/editor/index.js.map +1 -1
- package/dist/editor/plugin/P1Plugin.d.ts +25 -2
- package/dist/editor/plugin/P1Plugin.d.ts.map +1 -1
- package/dist/editor/plugin/P1Plugin.js +147 -63
- package/dist/editor/plugin/P1Plugin.js.map +1 -1
- package/dist/editor/plugin/context-sync-key.d.ts +30 -0
- package/dist/editor/plugin/context-sync-key.d.ts.map +1 -0
- package/dist/editor/plugin/context-sync-key.js +36 -0
- package/dist/editor/plugin/context-sync-key.js.map +1 -0
- package/dist/editor/plugin/createP1Overrides.d.ts +33 -50
- package/dist/editor/plugin/createP1Overrides.d.ts.map +1 -1
- package/dist/editor/plugin/createP1Overrides.js +54 -112
- package/dist/editor/plugin/createP1Overrides.js.map +1 -1
- package/dist/editor/plugin/document-sync-plugin.d.ts +35 -0
- package/dist/editor/plugin/document-sync-plugin.d.ts.map +1 -0
- package/dist/editor/plugin/document-sync-plugin.js +130 -0
- package/dist/editor/plugin/document-sync-plugin.js.map +1 -0
- package/dist/editor/plugin/fieldGuidance.d.ts +45 -0
- package/dist/editor/plugin/fieldGuidance.d.ts.map +1 -0
- package/dist/editor/plugin/fieldGuidance.js +24 -0
- package/dist/editor/plugin/fieldGuidance.js.map +1 -0
- package/dist/editor/plugin/mergePreviewPlugin.d.ts.map +1 -1
- package/dist/editor/plugin/mergePreviewPlugin.js.map +1 -1
- package/dist/editor/plugin/selectHeaderCollaborators.d.ts +12 -0
- package/dist/editor/plugin/selectHeaderCollaborators.d.ts.map +1 -0
- package/dist/editor/plugin/selectHeaderCollaborators.js +15 -0
- package/dist/editor/plugin/selectHeaderCollaborators.js.map +1 -0
- package/dist/editor/thumbnails/LiveThumbnail.d.ts +47 -0
- package/dist/editor/thumbnails/LiveThumbnail.d.ts.map +1 -0
- package/dist/editor/thumbnails/LiveThumbnail.js +120 -0
- package/dist/editor/thumbnails/LiveThumbnail.js.map +1 -0
- package/dist/editor/thumbnails/ThumbnailCard.d.ts +37 -0
- package/dist/editor/thumbnails/ThumbnailCard.d.ts.map +1 -0
- package/dist/editor/thumbnails/ThumbnailCard.js +91 -0
- package/dist/editor/thumbnails/ThumbnailCard.js.map +1 -0
- package/dist/editor/thumbnails/buildLiveThumbnailDrawer.d.ts +33 -0
- package/dist/editor/thumbnails/buildLiveThumbnailDrawer.d.ts.map +1 -0
- package/dist/editor/thumbnails/buildLiveThumbnailDrawer.js +79 -0
- package/dist/editor/thumbnails/buildLiveThumbnailDrawer.js.map +1 -0
- package/dist/editor/thumbnails/humanizeComponentName.d.ts +18 -0
- package/dist/editor/thumbnails/humanizeComponentName.d.ts.map +1 -0
- package/dist/editor/thumbnails/humanizeComponentName.js +32 -0
- package/dist/editor/thumbnails/humanizeComponentName.js.map +1 -0
- package/dist/editor/thumbnails/resolveLiveThumbnailDrawer.d.ts +15 -0
- package/dist/editor/thumbnails/resolveLiveThumbnailDrawer.d.ts.map +1 -0
- package/dist/editor/thumbnails/resolveLiveThumbnailDrawer.js +19 -0
- package/dist/editor/thumbnails/resolveLiveThumbnailDrawer.js.map +1 -0
- package/dist/editor/thumbnails/thumbnailCache.d.ts +39 -0
- package/dist/editor/thumbnails/thumbnailCache.d.ts.map +1 -0
- package/dist/editor/thumbnails/thumbnailCache.js +97 -0
- package/dist/editor/thumbnails/thumbnailCache.js.map +1 -0
- package/dist/editor/useDocuments.d.ts.map +1 -1
- package/dist/editor/useDocuments.js +27 -15
- package/dist/editor/useDocuments.js.map +1 -1
- package/dist/editor/useP1Editor.d.ts +15 -13
- package/dist/editor/useP1Editor.d.ts.map +1 -1
- package/dist/editor/useP1Editor.js +97 -20
- package/dist/editor/useP1Editor.js.map +1 -1
- package/dist/editor/useP1Overrides.d.ts +1 -1
- package/dist/editor/useP1Overrides.d.ts.map +1 -1
- package/dist/editor/useP1Overrides.js.map +1 -1
- package/dist/editor/useP1Plugin.d.ts +20 -2
- package/dist/editor/useP1Plugin.d.ts.map +1 -1
- package/dist/editor/useP1Plugin.js +5 -0
- package/dist/editor/useP1Plugin.js.map +1 -1
- package/dist/editor/useRealtime.d.ts +2 -2
- package/dist/editor/useRealtime.d.ts.map +1 -1
- package/dist/editor/useRealtime.js.map +1 -1
- package/dist/editor/utils/componentRegistry.d.ts +4 -4
- package/dist/editor/utils/componentRegistry.d.ts.map +1 -1
- package/dist/editor/utils/componentRegistry.js +0 -1
- package/dist/editor/utils/componentRegistry.js.map +1 -1
- package/dist/editor/utils/puckYjsBinding.d.ts.map +1 -1
- package/dist/editor/utils/puckYjsBinding.js +6 -4
- package/dist/editor/utils/puckYjsBinding.js.map +1 -1
- package/dist/editor/utils/restoreDocumentVersion.d.ts +18 -0
- package/dist/editor/utils/restoreDocumentVersion.d.ts.map +1 -0
- package/dist/editor/utils/restoreDocumentVersion.js +49 -0
- package/dist/editor/utils/restoreDocumentVersion.js.map +1 -0
- package/dist/editor/utils/sanitizeRichtextDefaults.d.ts +22 -0
- package/dist/editor/utils/sanitizeRichtextDefaults.d.ts.map +1 -0
- package/dist/editor/utils/sanitizeRichtextDefaults.js +98 -0
- package/dist/editor/utils/sanitizeRichtextDefaults.js.map +1 -0
- package/dist/editor/utils/snapshotToPuckData.d.ts +11 -0
- package/dist/editor/utils/snapshotToPuckData.d.ts.map +1 -0
- package/dist/editor/utils/snapshotToPuckData.js +27 -0
- package/dist/editor/utils/snapshotToPuckData.js.map +1 -0
- package/dist/editor/utils/syncComponentRegistry.d.ts.map +1 -1
- package/dist/editor/utils/syncComponentRegistry.js +32 -6
- package/dist/editor/utils/syncComponentRegistry.js.map +1 -1
- package/dist/editor/utils/templatePath.d.ts +8 -0
- package/dist/editor/utils/templatePath.d.ts.map +1 -0
- package/dist/editor/utils/templatePath.js +14 -0
- package/dist/editor/utils/templatePath.js.map +1 -0
- package/dist/features/content-type-templates/permissions/createPuckPermissions.d.ts +10 -7
- package/dist/features/content-type-templates/permissions/createPuckPermissions.d.ts.map +1 -1
- package/dist/features/content-type-templates/permissions/createPuckPermissions.js +27 -8
- package/dist/features/content-type-templates/permissions/createPuckPermissions.js.map +1 -1
- package/dist/features/content-type-templates/stores/template-store-api.d.ts.map +1 -1
- package/dist/features/content-type-templates/ui/ActionBarPinButton.d.ts.map +1 -1
- package/dist/features/content-type-templates/ui/ActionBarPinButton.js +1 -1
- package/dist/features/content-type-templates/ui/ActionBarPinButton.js.map +1 -1
- package/dist/features/content-type-templates/validation/structural-validation.d.ts +4 -4
- package/dist/features/content-type-templates/validation/structural-validation.d.ts.map +1 -1
- package/dist/features/content-type-templates/validation/structural-validation.js +123 -50
- package/dist/features/content-type-templates/validation/structural-validation.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -2
- package/dist/index.js.map +1 -1
- package/dist/merge/components/merge-resolution/CherryPickVisualPanel.js +1 -3
- package/dist/merge/components/merge-resolution/CherryPickVisualPanel.js.map +1 -1
- package/dist/merge/components/merge-resolution/DocumentResolutionDetail.js +2 -2
- package/dist/merge/components/merge-resolution/DocumentResolutionDetail.js.map +1 -1
- package/dist/p1/editor/client.d.ts +1 -1
- package/dist/p1/editor/client.d.ts.map +1 -1
- package/dist/p1/editor/client.js +3 -3
- package/dist/p1/editor/client.js.map +1 -1
- package/dist/p1/editor/connect/connect-field-modal.d.ts +1 -1
- package/dist/p1/editor/connect/connect-field-modal.d.ts.map +1 -1
- package/dist/p1/editor/connect/connect-field-modal.js +2 -2
- package/dist/p1/editor/connect/connect-field-modal.js.map +1 -1
- package/dist/p1/editor/connect/connect-preview-config.d.ts +1 -1
- package/dist/p1/editor/connect/connect-preview-config.d.ts.map +1 -1
- package/dist/p1/editor/connect/field-connect-plugin.js +1 -1
- package/dist/p1/editor/connect/field-connect-plugin.js.map +1 -1
- package/dist/p1/editor/editor-preview-resolve.d.ts +7 -1
- package/dist/p1/editor/editor-preview-resolve.d.ts.map +1 -1
- package/dist/p1/editor/editor-preview-resolve.js +9 -2
- package/dist/p1/editor/editor-preview-resolve.js.map +1 -1
- package/dist/p1/editor/{hooks.d.ts → hooks/api-hooks.d.ts} +9 -20
- package/dist/p1/editor/hooks/api-hooks.d.ts.map +1 -0
- package/dist/p1/editor/{hooks.js → hooks/api-hooks.js} +72 -57
- package/dist/p1/editor/hooks/api-hooks.js.map +1 -0
- package/dist/p1/editor/hooks/index.d.ts +4 -0
- package/dist/p1/editor/hooks/index.d.ts.map +1 -0
- package/dist/p1/editor/hooks/index.js +4 -0
- package/dist/p1/editor/hooks/index.js.map +1 -0
- package/dist/p1/editor/hooks/useEditorContext.d.ts +13 -0
- package/dist/p1/editor/hooks/useEditorContext.d.ts.map +1 -0
- package/dist/p1/editor/hooks/useEditorContext.js +25 -0
- package/dist/p1/editor/hooks/useEditorContext.js.map +1 -0
- package/dist/p1/editor/hooks/useP1Plugins.d.ts +3 -0
- package/dist/p1/editor/hooks/useP1Plugins.d.ts.map +1 -0
- package/dist/p1/editor/hooks/useP1Plugins.js +33 -0
- package/dist/p1/editor/hooks/useP1Plugins.js.map +1 -0
- package/dist/p1/editor/icons/button-block-icon.d.ts +1 -1
- package/dist/p1/editor/icons/button-block-icon.d.ts.map +1 -1
- package/dist/p1/editor/icons/default-block-icon.d.ts +1 -1
- package/dist/p1/editor/icons/default-block-icon.d.ts.map +1 -1
- package/dist/p1/editor/icons/divider-block-icon.d.ts +1 -1
- package/dist/p1/editor/icons/divider-block-icon.d.ts.map +1 -1
- package/dist/p1/editor/icons/grid-block-icon.d.ts +1 -1
- package/dist/p1/editor/icons/grid-block-icon.d.ts.map +1 -1
- package/dist/p1/editor/icons/heading-block-icon.d.ts +1 -1
- package/dist/p1/editor/icons/heading-block-icon.d.ts.map +1 -1
- package/dist/p1/editor/icons/image-block-icon.d.ts +1 -1
- package/dist/p1/editor/icons/image-block-icon.d.ts.map +1 -1
- package/dist/p1/editor/icons/list-block-icon.d.ts +1 -1
- package/dist/p1/editor/icons/list-block-icon.d.ts.map +1 -1
- package/dist/p1/editor/icons/paragraph-block-icon.d.ts +1 -1
- package/dist/p1/editor/icons/paragraph-block-icon.d.ts.map +1 -1
- package/dist/p1/editor/icons/quote-block-icon.d.ts +1 -1
- package/dist/p1/editor/icons/quote-block-icon.d.ts.map +1 -1
- package/dist/p1/editor/icons/spacer-block-icon.d.ts +1 -1
- package/dist/p1/editor/icons/spacer-block-icon.d.ts.map +1 -1
- package/dist/p1/editor/index.d.ts +2 -2
- package/dist/p1/editor/index.d.ts.map +1 -1
- package/dist/p1/editor/index.js +2 -2
- package/dist/p1/editor/index.js.map +1 -1
- package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.js +65 -67
- package/dist/p1/editor/remote-datasources/remote-datasource-explorer-plugin.js.map +1 -1
- package/dist/p1/editor/remote-datasources/remote-datasource-form-helpers.d.ts +4 -4
- package/dist/p1/editor/remote-datasources/remote-datasource-form-helpers.d.ts.map +1 -1
- package/dist/p1/editor/remote-datasources/remote-datasource-form-helpers.js.map +1 -1
- package/dist/p1/editor/remote-datasources/remote-datasource-manager.d.ts +1 -1
- package/dist/p1/editor/remote-datasources/remote-datasource-manager.d.ts.map +1 -1
- package/dist/p1/editor/remote-datasources/remote-datasource-manager.js +2 -2
- package/dist/p1/editor/remote-datasources/remote-datasource-manager.js.map +1 -1
- package/dist/p1/editor/remote-datasources/template-preview-params-toolbar.d.ts +1 -1
- package/dist/p1/editor/remote-datasources/template-preview-params-toolbar.d.ts.map +1 -1
- package/dist/p1/editor/remote-datasources/template-preview-params-toolbar.js +2 -2
- package/dist/p1/editor/remote-datasources/template-preview-params-toolbar.js.map +1 -1
- package/dist/p1/editor/template-autocomplete-layer.d.ts +2 -2
- package/dist/p1/editor/template-autocomplete-layer.d.ts.map +1 -1
- package/dist/p1/editor/template-autocomplete-layer.js +23 -3
- package/dist/p1/editor/template-autocomplete-layer.js.map +1 -1
- package/dist/p1/pages/render-client.d.ts +1 -1
- package/dist/p1/pages/render-client.d.ts.map +1 -1
- package/dist/pds/components/AgentChip.d.ts.map +1 -1
- package/dist/pds/components/AgentChip.js +1 -2
- package/dist/pds/components/AgentChip.js.map +1 -1
- package/dist/pds/components/CreatePageModal.d.ts +10 -1
- package/dist/pds/components/CreatePageModal.d.ts.map +1 -1
- package/dist/pds/components/CreatePageModal.js +29 -9
- package/dist/pds/components/CreatePageModal.js.map +1 -1
- package/dist/pds/components/CreatePageModal.module.css +34 -0
- package/dist/pds/components/DocStateBadge.d.ts +1 -1
- package/dist/pds/components/DocStateBadge.d.ts.map +1 -1
- package/dist/pds/components/DocStateBadge.js +1 -1
- package/dist/pds/components/DocStateBadge.js.map +1 -1
- package/dist/pds/components/LoadingMessage.d.ts +16 -0
- package/dist/pds/components/LoadingMessage.d.ts.map +1 -0
- package/dist/pds/components/LoadingMessage.js +6 -0
- package/dist/pds/components/LoadingMessage.js.map +1 -0
- package/dist/pds/components/LoadingMessage.module.css +44 -0
- package/dist/pds/components/NavIcon.js +1 -1
- package/dist/pds/components/NavIcon.js.map +1 -1
- package/dist/pds/components/P1EditorHeader.d.ts +10 -2
- package/dist/pds/components/P1EditorHeader.d.ts.map +1 -1
- package/dist/pds/components/P1EditorHeader.js +16 -7
- package/dist/pds/components/P1EditorHeader.js.map +1 -1
- package/dist/pds/components/P1EditorHeader.module.css +113 -35
- package/dist/pds/components/P1EditorSubheader.d.ts +1 -2
- package/dist/pds/components/P1EditorSubheader.d.ts.map +1 -1
- package/dist/pds/components/P1EditorSubheader.js +10 -21
- package/dist/pds/components/P1EditorSubheader.js.map +1 -1
- package/dist/pds/components/P1EditorSubheader.module.css +7 -1
- package/dist/pds/components/PageNavigator.d.ts.map +1 -1
- package/dist/pds/components/PageNavigator.js.map +1 -1
- package/dist/pds/components/PresenceStack.d.ts +6 -5
- package/dist/pds/components/PresenceStack.d.ts.map +1 -1
- package/dist/pds/components/PresenceStack.js +43 -4
- package/dist/pds/components/PresenceStack.js.map +1 -1
- package/dist/pds/components/PresenceStack.module.css +52 -7
- package/dist/pds/components/PublishControl.js +2 -2
- package/dist/pds/components/PublishControl.js.map +1 -1
- package/dist/pds/components/WorkstreamSwitcher.d.ts +7 -2
- package/dist/pds/components/WorkstreamSwitcher.d.ts.map +1 -1
- package/dist/pds/components/WorkstreamSwitcher.js +5 -3
- package/dist/pds/components/WorkstreamSwitcher.js.map +1 -1
- package/dist/pds/index.d.ts +2 -0
- package/dist/pds/index.d.ts.map +1 -1
- package/dist/pds/index.js +1 -0
- package/dist/pds/index.js.map +1 -1
- package/dist/pds/theme/pds-core-content.d.ts +1 -1
- package/dist/pds/theme/pds-core-content.d.ts.map +1 -1
- package/dist/pds/theme/pds-core-content.js +1 -1
- package/dist/pds/theme/pds-core-content.js.map +1 -1
- package/dist/server.d.ts +4 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -1
- package/dist/server.js.map +1 -1
- package/dist/versioning/components/HistoricalVersionBanner.d.ts +19 -21
- package/dist/versioning/components/HistoricalVersionBanner.d.ts.map +1 -1
- package/dist/versioning/components/HistoricalVersionBanner.js +7 -19
- package/dist/versioning/components/HistoricalVersionBanner.js.map +1 -1
- package/dist/versioning/components/ReadOnlyFieldsGuard.d.ts +14 -0
- package/dist/versioning/components/ReadOnlyFieldsGuard.d.ts.map +1 -0
- package/dist/versioning/components/ReadOnlyFieldsGuard.js +8 -0
- package/dist/versioning/components/ReadOnlyFieldsGuard.js.map +1 -0
- package/dist/versioning/components/VersionBannerActions.d.ts +15 -0
- package/dist/versioning/components/VersionBannerActions.d.ts.map +1 -0
- package/dist/versioning/components/VersionBannerActions.js +30 -0
- package/dist/versioning/components/VersionBannerActions.js.map +1 -0
- package/dist/versioning/components/VersionPublishedBadge.d.ts +1 -1
- package/dist/versioning/components/VersionPublishedBadge.d.ts.map +1 -1
- package/dist/versioning/components/VersionReadOnlyBanner.d.ts +12 -0
- package/dist/versioning/components/VersionReadOnlyBanner.d.ts.map +1 -0
- package/dist/versioning/components/VersionReadOnlyBanner.js +5 -0
- package/dist/versioning/components/VersionReadOnlyBanner.js.map +1 -0
- package/dist/versioning/components/version-compare/VisualVersionCompare.d.ts +2 -2
- package/dist/versioning/components/version-compare/VisualVersionCompare.d.ts.map +1 -1
- package/dist/versioning/index.d.ts +4 -0
- package/dist/versioning/index.d.ts.map +1 -1
- package/dist/versioning/index.js +2 -0
- package/dist/versioning/index.js.map +1 -1
- package/dist/versioning/utils/formatVersionDate.d.ts +15 -0
- package/dist/versioning/utils/formatVersionDate.d.ts.map +1 -0
- package/dist/versioning/utils/formatVersionDate.js +41 -0
- package/dist/versioning/utils/formatVersionDate.js.map +1 -0
- package/dist/versioning/utils/versionKind.d.ts +19 -0
- package/dist/versioning/utils/versionKind.d.ts.map +1 -0
- package/dist/versioning/utils/versionKind.js +30 -0
- package/dist/versioning/utils/versionKind.js.map +1 -0
- package/package.json +16 -8
- package/src/pds/theme/PuckEditorTheme.css +81 -0
- package/src/pds/theme/PuckEditorTheme.test.ts +50 -1
- package/src/pds/theme/pds-core-content.ts +1 -1
- package/src/pds/theme/pds-core.css +1 -1
- package/src/styles.css +693 -29
- package/dist/features/content-type-templates/editor/useTemplateScaffold.d.ts +0 -15
- package/dist/features/content-type-templates/editor/useTemplateScaffold.d.ts.map +0 -1
- package/dist/features/content-type-templates/editor/useTemplateScaffold.js +0 -29
- package/dist/features/content-type-templates/editor/useTemplateScaffold.js.map +0 -1
- package/dist/p1/editor/hooks.d.ts.map +0 -1
- package/dist/p1/editor/hooks.js.map +0 -1
|
@@ -5,19 +5,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
* React context provider for P1 Puck integration.
|
|
6
6
|
*/
|
|
7
7
|
import { useState, useCallback, useMemo, useEffect, useRef } from 'react';
|
|
8
|
+
import isEqual from 'lodash.isequal';
|
|
8
9
|
import { P1PuckContext } from '../core/P1PuckContext.js';
|
|
9
10
|
import { NotificationProvider, useNotifications } from '../core/NotificationContext.js';
|
|
10
11
|
import { PresenceContext } from '../core/PresenceContext.js';
|
|
11
|
-
import isEqual from 'lodash.isequal';
|
|
12
12
|
import { debounce } from '../core/utils/debounce.js';
|
|
13
13
|
import { withRetry } from '../core/utils/retry.js';
|
|
14
|
-
import { useRealtime } from './useRealtime.js';
|
|
15
|
-
import { useDocuments } from './useDocuments.js';
|
|
16
14
|
import { resolveFeatureConfig } from '../core/featureConfig.js';
|
|
17
|
-
import { resolveActivePlugins, composeProviders } from './composePlugins.js';
|
|
18
|
-
import { DEFAULT_CSS_FEATURE_PLUGINS } from './defaultPlugins.js';
|
|
19
15
|
import { createPuckPermissions } from '../features/content-type-templates/permissions/createPuckPermissions.js';
|
|
20
16
|
import { useTemplateList } from '../features/content-type-templates/hooks/useTemplateList.js';
|
|
17
|
+
import { presenceIdentityKey } from '../collaboration/utils/presenceIdentity.js';
|
|
18
|
+
import { DEFAULT_CSS_FEATURE_PLUGINS } from './defaultPlugins.js';
|
|
19
|
+
import { resolveActivePlugins, composeProviders } from './composePlugins.js';
|
|
20
|
+
import { snapshotToPuckData } from './utils/snapshotToPuckData.js';
|
|
21
|
+
import { useDocuments } from './useDocuments.js';
|
|
22
|
+
import { useRealtime } from './useRealtime.js';
|
|
21
23
|
/**
|
|
22
24
|
* Provider component for P1 Puck integration.
|
|
23
25
|
*
|
|
@@ -126,6 +128,10 @@ userRole = 'editor', children, }) {
|
|
|
126
128
|
// Document state
|
|
127
129
|
const [currentDocument, setCurrentDocument] = useState(null);
|
|
128
130
|
const [currentData, setCurrentData] = useState(null);
|
|
131
|
+
// True while loadDocument is in flight. Consumers use it to distinguish
|
|
132
|
+
// "no document while switching" (keep showing the old canvas) from
|
|
133
|
+
// "genuinely no document" (show the empty state).
|
|
134
|
+
const [documentLoading, setDocumentLoading] = useState(false);
|
|
129
135
|
// Template state (PROPOSAL-010)
|
|
130
136
|
const [currentTemplate, setCurrentTemplate] = useState(null);
|
|
131
137
|
// Save state
|
|
@@ -192,6 +198,10 @@ userRole = 'editor', children, }) {
|
|
|
192
198
|
const REMOTE_SYNC_DEBOUNCE_DELAY = 50;
|
|
193
199
|
// Ref to track viewingVersion for use in callbacks (avoids stale closure)
|
|
194
200
|
const viewingVersionRef = useRef(null);
|
|
201
|
+
// Tracks the latest data seen by saveData when NOT viewing historical.
|
|
202
|
+
// Used by returnToLatest to restore unsaved edits that were in Puck's
|
|
203
|
+
// memory when the user navigated to a historical version.
|
|
204
|
+
const latestLocalDataRef = useRef(null);
|
|
195
205
|
// Helper to cancel any pending remote sync - used when loading documents/versions
|
|
196
206
|
// This prevents race conditions where a pending remote update overrides loaded data
|
|
197
207
|
const cancelPendingRemoteSync = useCallback(() => {
|
|
@@ -394,14 +404,14 @@ userRole = 'editor', children, }) {
|
|
|
394
404
|
// The list endpoint carries no layout content; fetch the full template.
|
|
395
405
|
const fullTemplate = await userClient.templates.get(siteId, branchIdRef.current, template.id);
|
|
396
406
|
// A template without a content array has no stored layout snapshot;
|
|
397
|
-
//
|
|
407
|
+
// creating a page from it would silently produce a blank page. An empty
|
|
398
408
|
// array is a legitimate empty layout and passes.
|
|
399
409
|
if (!fullTemplate.content) {
|
|
400
410
|
throw new Error(`Template "${template.label || template.name}" has no layout yet. Open it in the editor and add components before creating pages from it.`);
|
|
401
411
|
}
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
await createDocumentRawRef.current(path,
|
|
412
|
+
// The backend builds the initial version from the template, preserving
|
|
413
|
+
// each component's durable slot id; no client snapshot is sent.
|
|
414
|
+
await createDocumentRawRef.current(path, undefined, {
|
|
405
415
|
templateId: fullTemplate.id,
|
|
406
416
|
templateVersion: fullTemplate.version,
|
|
407
417
|
title,
|
|
@@ -642,6 +652,11 @@ userRole = 'editor', children, }) {
|
|
|
642
652
|
return;
|
|
643
653
|
}
|
|
644
654
|
}
|
|
655
|
+
// Only genuine user edits reach here — load/restore echoes arm
|
|
656
|
+
// suppressNextSaveRef before they fire and are returned early above.
|
|
657
|
+
if (!viewingVersionRef.current) {
|
|
658
|
+
latestLocalDataRef.current = data;
|
|
659
|
+
}
|
|
645
660
|
// When realtime is enabled, detect whether this onChange came from a remote
|
|
646
661
|
// sync (Yjs update from another client) vs. a local user edit.
|
|
647
662
|
// Remote updates should NOT trigger a REST save — the DO handles persistence.
|
|
@@ -698,6 +713,12 @@ userRole = 'editor', children, }) {
|
|
|
698
713
|
return;
|
|
699
714
|
}
|
|
700
715
|
}
|
|
716
|
+
// Mirror the realtime guard: don't save when previewing a historical version.
|
|
717
|
+
// Without this, the PuckDataSynchronizer echo from loadVersion resumes the
|
|
718
|
+
// debounce and writes historical data to the server.
|
|
719
|
+
if (viewingVersionRef.current !== null) {
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
701
722
|
pendingDataRef.current = data;
|
|
702
723
|
if (debouncedSave.isPaused()) {
|
|
703
724
|
debouncedSave.resume();
|
|
@@ -725,6 +746,34 @@ userRole = 'editor', children, }) {
|
|
|
725
746
|
}
|
|
726
747
|
await performSave();
|
|
727
748
|
}, [debouncedSave, performSave, enableRealtime]);
|
|
749
|
+
// Persist current in-memory edits as a REST version before a destructive operation.
|
|
750
|
+
// Realtime: confirms WebSocket delivery then snapshots latestLocalDataRef as a version.
|
|
751
|
+
// Non-realtime: delegates to performSave which creates a version from pendingDataRef.
|
|
752
|
+
const persistCurrentEdits = useCallback(async () => {
|
|
753
|
+
if (!enableRealtime || !realtimeConnectedRef.current) {
|
|
754
|
+
await performSave();
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
await realtime.waitForDelivery();
|
|
758
|
+
const latestData = latestLocalDataRef.current;
|
|
759
|
+
const doc = currentDocumentRef.current;
|
|
760
|
+
if (latestData && doc && currentDataDocumentPathRef.current === doc.path) {
|
|
761
|
+
setSaveStatus('saving');
|
|
762
|
+
try {
|
|
763
|
+
await userClient.versions.create(siteId, {
|
|
764
|
+
documentId: doc.id,
|
|
765
|
+
branchId,
|
|
766
|
+
snapshot: latestData,
|
|
767
|
+
});
|
|
768
|
+
setSaveStatus('saved');
|
|
769
|
+
setLastSaved(new Date());
|
|
770
|
+
}
|
|
771
|
+
catch (err) {
|
|
772
|
+
setSaveStatus('error');
|
|
773
|
+
throw err;
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
}, [enableRealtime, realtime, performSave, userClient, siteId, branchId]);
|
|
728
777
|
// Load document by path
|
|
729
778
|
const loadDocument = useCallback(async (path) => {
|
|
730
779
|
// Flush any pending debounced save while the outgoing document's
|
|
@@ -741,6 +790,8 @@ userRole = 'editor', children, }) {
|
|
|
741
790
|
}
|
|
742
791
|
debouncedSave.cancel();
|
|
743
792
|
pendingDataRef.current = null;
|
|
793
|
+
// Invalidate cached local edit so returnToLatest() doesn't treat it as unsaved.
|
|
794
|
+
latestLocalDataRef.current = null;
|
|
744
795
|
// Cancel any pending remote sync to prevent race conditions
|
|
745
796
|
// where a stale remote update overrides the document we're loading
|
|
746
797
|
cancelPendingRemoteSync();
|
|
@@ -750,29 +801,28 @@ userRole = 'editor', children, }) {
|
|
|
750
801
|
// will no longer match — signaling that our response is stale.
|
|
751
802
|
loadRequestIdRef.current += 1;
|
|
752
803
|
const thisRequestId = loadRequestIdRef.current;
|
|
753
|
-
|
|
754
|
-
//
|
|
804
|
+
setDocumentLoading(true);
|
|
805
|
+
// Pre-clear the current document so nothing can save against the old
|
|
806
|
+
// one while the fetch is in flight. The canvas keeps showing the
|
|
807
|
+
// previous document — documentLoading suppresses the empty state.
|
|
755
808
|
currentDataDocumentPathRef.current = null;
|
|
756
809
|
setCurrentData(null);
|
|
757
|
-
setCurrentDocument(null);
|
|
758
810
|
try {
|
|
759
|
-
|
|
760
|
-
const normalizedPath = path.startsWith('/') ? path.slice(1) : path;
|
|
761
|
-
// Get document by path
|
|
762
|
-
const doc = await userClient.documents.getByPath(siteId, normalizedPath);
|
|
811
|
+
const doc = await userClient.documents.getByPath(siteId, path.startsWith('/') ? path.slice(1) : path);
|
|
763
812
|
// Staleness check: a newer loadDocument call has started
|
|
764
813
|
if (thisRequestId !== loadRequestIdRef.current) {
|
|
765
814
|
console.debug('[P1PuckProvider] Stale loadDocument — skipping (after getByPath)');
|
|
766
815
|
return;
|
|
767
816
|
}
|
|
768
|
-
//
|
|
769
|
-
//
|
|
770
|
-
|
|
771
|
-
//
|
|
772
|
-
// causing the new Y.Doc to be seeded with the wrong document's Yjs
|
|
773
|
-
// state — which the DO then commits as the first realtime version.
|
|
817
|
+
// Use ID not path — paths may differ by normalization, causing a false disconnect.
|
|
818
|
+
// Same-doc keeps Yjs alive; cross-doc nulls out so useRealtime seeds a fresh Y.Doc.
|
|
819
|
+
const isSameDocument = doc.id === currentDocumentRef.current?.id;
|
|
820
|
+
// Null data before identity update so useRealtime sees initialData=null.
|
|
774
821
|
currentDataDocumentPathRef.current = null;
|
|
775
822
|
setCurrentData(null);
|
|
823
|
+
if (!isSameDocument) {
|
|
824
|
+
setCurrentDocument(null);
|
|
825
|
+
}
|
|
776
826
|
setCurrentDocument(doc);
|
|
777
827
|
// Fetch template if document is bound to one (PROPOSAL-010)
|
|
778
828
|
if (doc.templateId) {
|
|
@@ -793,7 +843,7 @@ userRole = 'editor', children, }) {
|
|
|
793
843
|
}
|
|
794
844
|
// Get latest version
|
|
795
845
|
const version = await userClient.versions.getLatest(siteId, branchId, doc.id);
|
|
796
|
-
const puckData = version.snapshot;
|
|
846
|
+
const puckData = snapshotToPuckData(version.snapshot);
|
|
797
847
|
// Staleness check: a newer loadDocument call has started
|
|
798
848
|
if (thisRequestId !== loadRequestIdRef.current) {
|
|
799
849
|
console.debug('[P1PuckProvider] Stale loadDocument — skipping (after getLatest)');
|
|
@@ -851,6 +901,13 @@ userRole = 'editor', children, }) {
|
|
|
851
901
|
setCurrentDocument(null);
|
|
852
902
|
throw error;
|
|
853
903
|
}
|
|
904
|
+
finally {
|
|
905
|
+
// Guarded so a stale call's completion can't clear the flag while a
|
|
906
|
+
// newer load is still in flight.
|
|
907
|
+
if (thisRequestId === loadRequestIdRef.current) {
|
|
908
|
+
setDocumentLoading(false);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
854
911
|
}, [userClient, siteId, branchId, cancelPendingRemoteSync, enableRealtime, debouncedSave, performSave]);
|
|
855
912
|
// Load a specific version into the editor
|
|
856
913
|
const loadVersion = useCallback(async (version) => {
|
|
@@ -873,12 +930,9 @@ userRole = 'editor', children, }) {
|
|
|
873
930
|
console.warn('Could not fetch full version data, using version from list:', fetchError);
|
|
874
931
|
}
|
|
875
932
|
}
|
|
876
|
-
|
|
877
|
-
//
|
|
878
|
-
|
|
879
|
-
if (!puckData || (!puckData.content && !puckData.root)) {
|
|
880
|
-
puckData = { content: [], root: { props: {} } };
|
|
881
|
-
}
|
|
933
|
+
// Parses a JSON-string snapshot and falls back to blank Puck data for
|
|
934
|
+
// an empty/invalid snapshot (e.g. version 1's initial blank state).
|
|
935
|
+
const puckData = snapshotToPuckData(versionToUse.snapshot);
|
|
882
936
|
// IMPORTANT: Update the ref BEFORE state updates to block any incoming remote updates
|
|
883
937
|
// The effect that syncs viewingVersionRef runs AFTER render, which is too late
|
|
884
938
|
// Remote updates check this ref, so we need it set synchronously
|
|
@@ -913,6 +967,10 @@ userRole = 'editor', children, }) {
|
|
|
913
967
|
dataToRestore = currentYjsData;
|
|
914
968
|
}
|
|
915
969
|
}
|
|
970
|
+
// 1. Edits typed inside the debounce window — cleared from pendingDataRef by loadVersion but still live here.
|
|
971
|
+
const hadLocalEdits = !!latestLocalDataRef.current;
|
|
972
|
+
dataToRestore ??= latestLocalDataRef.current;
|
|
973
|
+
latestLocalDataRef.current = null; // consume — prevents stale ref short-circuiting server fetch on next history visit
|
|
916
974
|
// Re-fetch the true latest from the server when no live Yjs snapshot is
|
|
917
975
|
// available. The cached latestVersionDataRef is only a last-resort fallback
|
|
918
976
|
// (e.g. no current document); it is NOT used on fetch failure — silently
|
|
@@ -922,8 +980,7 @@ userRole = 'editor', children, }) {
|
|
|
922
980
|
if (!dataToRestore) {
|
|
923
981
|
const doc = currentDocumentRef.current;
|
|
924
982
|
if (doc) {
|
|
925
|
-
//
|
|
926
|
-
// frozen on the historical snapshot with no indication.
|
|
983
|
+
// 2. Authoritative server state — the only source that reflects saves from other tabs, users, or agents.
|
|
927
984
|
setIsReturningToLatest(true);
|
|
928
985
|
try {
|
|
929
986
|
const version = await userClient.versions.getLatest(siteId, branchId, doc.id);
|
|
@@ -941,16 +998,16 @@ userRole = 'editor', children, }) {
|
|
|
941
998
|
setIsReturningToLatest(false);
|
|
942
999
|
}
|
|
943
1000
|
}
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
dataToRestore = latestVersionDataRef.current;
|
|
1001
|
+
// 3. No document context — can't fetch; use last value written by performSave.
|
|
1002
|
+
dataToRestore ??= latestVersionDataRef.current;
|
|
947
1003
|
}
|
|
948
1004
|
if (dataToRestore) {
|
|
949
1005
|
// IMPORTANT: Update the ref BEFORE state updates
|
|
950
1006
|
// Setting to null allows remote updates to resume
|
|
951
1007
|
viewingVersionRef.current = null;
|
|
952
|
-
// Suppress the echo
|
|
953
|
-
//
|
|
1008
|
+
// Suppress the PuckDataSynchronizer echo: setCurrentData triggers a setData
|
|
1009
|
+
// dispatch and Puck fires onChange → saveData. Arm the ref so saveData drops
|
|
1010
|
+
// that echo; we control the save explicitly below.
|
|
954
1011
|
suppressNextSaveRef.current = dataToRestore;
|
|
955
1012
|
if (enableRealtime) {
|
|
956
1013
|
pendingRemoteUpdatesRef.current += 1;
|
|
@@ -967,7 +1024,13 @@ userRole = 'editor', children, }) {
|
|
|
967
1024
|
// Resume auto-save
|
|
968
1025
|
debouncedSave.resume();
|
|
969
1026
|
setAutoSavePaused(false);
|
|
970
|
-
|
|
1027
|
+
// Only queue a save when restoring from local in-memory edits — those were
|
|
1028
|
+
// never persisted. Data from the server fetch is already the latest saved
|
|
1029
|
+
// version; queuing a save would create a spurious identical version.
|
|
1030
|
+
if (hadLocalEdits) {
|
|
1031
|
+
pendingDataRef.current = dataToRestore;
|
|
1032
|
+
debouncedSave();
|
|
1033
|
+
}
|
|
971
1034
|
setSaveStatus('idle');
|
|
972
1035
|
}
|
|
973
1036
|
}, [debouncedSave, cancelPendingRemoteSync, enableRealtime, realtime, userClient, siteId, branchId, showErrorNotifications, notificationContext]);
|
|
@@ -1132,6 +1195,8 @@ userRole = 'editor', children, }) {
|
|
|
1132
1195
|
// but shouldn't cause PuckDataSynchronizer or plugin re-renders.
|
|
1133
1196
|
const presenceStateRef = useRef(presenceState);
|
|
1134
1197
|
presenceStateRef.current = presenceState;
|
|
1198
|
+
const humanPresenceKey = presenceIdentityKey(presenceState?.humans);
|
|
1199
|
+
const agentPresenceKey = presenceIdentityKey(presenceState?.agents);
|
|
1135
1200
|
// =========================================================================
|
|
1136
1201
|
// Phase 9: Agent Edit Capabilities (when this client IS an agent)
|
|
1137
1202
|
// =========================================================================
|
|
@@ -1381,31 +1446,72 @@ userRole = 'editor', children, }) {
|
|
|
1381
1446
|
const result = await userClient.documents.publish(siteId, branchId, doc.id);
|
|
1382
1447
|
return result.checkpoint;
|
|
1383
1448
|
}, [userClient, siteId, branchId, debouncedSave, performSave, enableRealtime, realtime]);
|
|
1449
|
+
// Tracks the currently in-flight switchBranch flush (everything after the
|
|
1450
|
+
// synchronous branch-selection commit), so a rapid re-selection can await
|
|
1451
|
+
// the prior call instead of racing it. See switchBranch below.
|
|
1452
|
+
const switchBranchInFlightRef = useRef(null);
|
|
1384
1453
|
// Switch branch
|
|
1385
1454
|
const switchBranch = useCallback(async (newBranchId) => {
|
|
1386
|
-
//
|
|
1387
|
-
|
|
1388
|
-
//
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
//
|
|
1394
|
-
|
|
1455
|
+
// Commit the new workstream selection FIRST, synchronously, before the
|
|
1456
|
+
// async save-flush below. The UI (WorkstreamSwitcher) fires this inside
|
|
1457
|
+
// startTransition without awaiting it, so its "Switching..." busy state
|
|
1458
|
+
// clears as soon as this function's synchronous portion returns — well
|
|
1459
|
+
// before a save-flush of the outgoing document would resolve. If the
|
|
1460
|
+
// user navigates to a different document in that window, this provider
|
|
1461
|
+
// can remount (the editor route has no layout.tsx to shield it across
|
|
1462
|
+
// param changes), and its branchId initializer re-reads sessionStorage.
|
|
1463
|
+
// Persisting here — before the flush, not after — guarantees that read
|
|
1464
|
+
// always sees the newly selected branch instead of a stale one,
|
|
1465
|
+
// preventing the workstream selector from snapping back to Live/main.
|
|
1395
1466
|
setBranchId(newBranchId);
|
|
1396
1467
|
persistBranchId(newBranchId);
|
|
1397
|
-
setCurrentDocument(null);
|
|
1398
|
-
currentDataDocumentPathRef.current = null;
|
|
1399
|
-
setCurrentData(null);
|
|
1400
|
-
setViewingVersion(null);
|
|
1401
|
-
// Clear remoteSyncKey so new branch document sync takes priority
|
|
1402
|
-
setRemoteSyncKey(null);
|
|
1403
|
-
pendingDataRef.current = null;
|
|
1404
|
-
setSaveStatus('idle');
|
|
1405
|
-
setSaveError(null);
|
|
1406
|
-
// Update current branch
|
|
1407
1468
|
const branch = branches.find((b) => b.id === newBranchId);
|
|
1408
1469
|
setCurrentBranch(branch ?? null);
|
|
1470
|
+
// Serialize the flush portion below against any switchBranch call
|
|
1471
|
+
// still in flight. Because the branch commit above is synchronous but
|
|
1472
|
+
// the flush is not, a rapid second call (the switcher fires onSwitch
|
|
1473
|
+
// fire-and-forget, so its busy state clears well before the flush
|
|
1474
|
+
// resolves) can otherwise start its own flush while pendingDataRef
|
|
1475
|
+
// still holds the first call's outgoing edit — grabbing a performSave
|
|
1476
|
+
// closure already pointed at the intermediate branch and saving that
|
|
1477
|
+
// same edit a second time, to the wrong branch. Awaiting the prior
|
|
1478
|
+
// in-flight flush first guarantees only one flush ever reads/clears
|
|
1479
|
+
// pendingDataRef at a time, and that each flush's performSave targets
|
|
1480
|
+
// the branch that was current when that flush actually started.
|
|
1481
|
+
const previousSwitch = switchBranchInFlightRef.current;
|
|
1482
|
+
const thisSwitch = (async () => {
|
|
1483
|
+
if (previousSwitch) {
|
|
1484
|
+
// A prior switch's flush failure shouldn't block this one.
|
|
1485
|
+
await previousSwitch.catch(() => undefined);
|
|
1486
|
+
}
|
|
1487
|
+
// Cancel any pending remote sync - we're switching to a different branch
|
|
1488
|
+
cancelPendingRemoteSync();
|
|
1489
|
+
// Save any pending changes on the outgoing document/branch first
|
|
1490
|
+
if (pendingDataRef.current) {
|
|
1491
|
+
debouncedSave.cancel();
|
|
1492
|
+
await performSave();
|
|
1493
|
+
}
|
|
1494
|
+
// IMPORTANT: Update the ref BEFORE state updates
|
|
1495
|
+
viewingVersionRef.current = null;
|
|
1496
|
+
setCurrentDocument(null);
|
|
1497
|
+
currentDataDocumentPathRef.current = null;
|
|
1498
|
+
setCurrentData(null);
|
|
1499
|
+
setViewingVersion(null);
|
|
1500
|
+
// Clear remoteSyncKey so new branch document sync takes priority
|
|
1501
|
+
setRemoteSyncKey(null);
|
|
1502
|
+
pendingDataRef.current = null;
|
|
1503
|
+
setSaveStatus('idle');
|
|
1504
|
+
setSaveError(null);
|
|
1505
|
+
})();
|
|
1506
|
+
switchBranchInFlightRef.current = thisSwitch;
|
|
1507
|
+
try {
|
|
1508
|
+
await thisSwitch;
|
|
1509
|
+
}
|
|
1510
|
+
finally {
|
|
1511
|
+
if (switchBranchInFlightRef.current === thisSwitch) {
|
|
1512
|
+
switchBranchInFlightRef.current = null;
|
|
1513
|
+
}
|
|
1514
|
+
}
|
|
1409
1515
|
}, [branches, debouncedSave, performSave, cancelPendingRemoteSync, persistBranchId]);
|
|
1410
1516
|
// Presence context value (for hooks like useFocusRegionReporting)
|
|
1411
1517
|
const presenceContextValue = useMemo(() => {
|
|
@@ -1458,6 +1564,9 @@ userRole = 'editor', children, }) {
|
|
|
1458
1564
|
const saveNowRef = useRef(saveNow);
|
|
1459
1565
|
saveNowRef.current = saveNow;
|
|
1460
1566
|
const stableSaveNow = useCallback(() => saveNowRef.current(), []);
|
|
1567
|
+
const persistCurrentEditsRef = useRef(persistCurrentEdits);
|
|
1568
|
+
persistCurrentEditsRef.current = persistCurrentEdits;
|
|
1569
|
+
const stablePersistCurrentEdits = useCallback(() => persistCurrentEditsRef.current(), []);
|
|
1461
1570
|
const createCheckpointRef = useRef(createCheckpoint);
|
|
1462
1571
|
createCheckpointRef.current = createCheckpoint;
|
|
1463
1572
|
const stableCreateCheckpoint = useCallback((name) => createCheckpointRef.current(name), []);
|
|
@@ -1568,12 +1677,14 @@ userRole = 'editor', children, }) {
|
|
|
1568
1677
|
userId,
|
|
1569
1678
|
currentDocument,
|
|
1570
1679
|
currentData,
|
|
1680
|
+
documentLoading,
|
|
1571
1681
|
saveStatus,
|
|
1572
1682
|
lastSaved,
|
|
1573
1683
|
saveError,
|
|
1574
1684
|
loadDocument: stableLoadDocument,
|
|
1575
1685
|
saveData: stableSaveData,
|
|
1576
1686
|
saveNow: stableSaveNow,
|
|
1687
|
+
persistCurrentEdits: stablePersistCurrentEdits,
|
|
1577
1688
|
createCheckpoint: stableCreateCheckpoint,
|
|
1578
1689
|
publishDocument: stablePublishDocument,
|
|
1579
1690
|
switchBranch: stableSwitchBranch,
|
|
@@ -1654,12 +1765,14 @@ userRole = 'editor', children, }) {
|
|
|
1654
1765
|
userId,
|
|
1655
1766
|
currentDocument,
|
|
1656
1767
|
currentData,
|
|
1768
|
+
documentLoading,
|
|
1657
1769
|
saveStatus,
|
|
1658
1770
|
lastSaved,
|
|
1659
1771
|
saveError,
|
|
1660
1772
|
stableLoadDocument,
|
|
1661
1773
|
stableSaveData,
|
|
1662
1774
|
stableSaveNow,
|
|
1775
|
+
stablePersistCurrentEdits,
|
|
1663
1776
|
stableCreateCheckpoint,
|
|
1664
1777
|
stablePublishDocument,
|
|
1665
1778
|
stableSwitchBranch,
|
|
@@ -1697,7 +1810,11 @@ userRole = 'editor', children, }) {
|
|
|
1697
1810
|
handleRealtimeDataCapture,
|
|
1698
1811
|
// Phase 9 dependencies (full presenceState excluded — accessed via getter/ref,
|
|
1699
1812
|
// but humanPresenceCount/hasActiveHumans/hasActiveAgents are direct values so every
|
|
1700
|
-
// join/leave triggers re-renders regardless of how many actors are present)
|
|
1813
|
+
// join/leave triggers re-renders regardless of how many actors are present).
|
|
1814
|
+
// The roster keys cover the changes a count cannot see: a same-frame join/leave of
|
|
1815
|
+
// two humans would keep the count the same but change the roster.
|
|
1816
|
+
humanPresenceKey,
|
|
1817
|
+
agentPresenceKey,
|
|
1701
1818
|
presenceState?.humans.length,
|
|
1702
1819
|
presenceState?.hasActiveHumans,
|
|
1703
1820
|
presenceState?.hasActiveAgents,
|