@pantheon-systems/puck-css 0.12.0 → 0.13.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/types.d.ts +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/create-data-list-block.js +0 -7
- package/dist/data/data-list-block/create-data-list-block.js.map +1 -1
- 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.js +0 -12
- 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.js +0 -16
- package/dist/data/paths.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 +2 -0
- package/dist/data/utils.d.ts.map +1 -1
- package/dist/data/utils.js +3 -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.js +39 -556
- 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.js +2 -14
- 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/defaultPlugins.d.ts +1 -1
- package/dist/editor/defaultPlugins.js +1 -1
- 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 +6 -3
- package/dist/editor/plugin/P1Plugin.d.ts.map +1 -1
- package/dist/editor/plugin/P1Plugin.js +20 -170
- 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/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 +27 -7
- package/dist/editor/useP1Editor.d.ts.map +1 -1
- package/dist/editor/useP1Editor.js +106 -239
- 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 +7 -3
- package/dist/editor/useP1Plugin.d.ts.map +1 -1
- package/dist/editor/useP1Plugin.js +28 -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.js +0 -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/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.js +0 -12
- 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/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 +2 -0
- package/dist/pds/index.d.ts.map +1 -1
- package/dist/pds/index.js +1 -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/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,21 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Phase 3.1: Puck-Yjs Binding Utility
|
|
3
|
-
*
|
|
4
|
-
* Bidirectional binding between Puck data and Yjs CRDT.
|
|
5
|
-
* Prevents sync loops by using Yjs transaction origins.
|
|
6
|
-
*/
|
|
7
1
|
import * as Y from 'yjs';
|
|
8
|
-
/**
|
|
9
|
-
* Origin marker for local changes (prevents sync loops)
|
|
10
|
-
*/
|
|
11
2
|
const LOCAL_ORIGIN = 'local';
|
|
12
|
-
/**
|
|
13
|
-
* Incrementally patch a Y.Map to match a plain object.
|
|
14
|
-
* Only touches keys/values that actually differ, minimising Yjs operations
|
|
15
|
-
* (and therefore the size of the update binary that is broadcast).
|
|
16
|
-
*/
|
|
17
3
|
export function patchYMap(ymap, newObj) {
|
|
18
|
-
// Remove keys that no longer exist
|
|
19
4
|
for (const key of ymap.keys()) {
|
|
20
5
|
if (!(key in newObj)) {
|
|
21
6
|
ymap.delete(key);
|
|
@@ -23,7 +8,6 @@ export function patchYMap(ymap, newObj) {
|
|
|
23
8
|
}
|
|
24
9
|
for (const [key, newVal] of Object.entries(newObj)) {
|
|
25
10
|
const curVal = ymap.get(key);
|
|
26
|
-
// If both sides are Y.Map / plain-object, recurse
|
|
27
11
|
if (curVal instanceof Y.Map &&
|
|
28
12
|
newVal !== null &&
|
|
29
13
|
typeof newVal === 'object' &&
|
|
@@ -31,31 +15,23 @@ export function patchYMap(ymap, newObj) {
|
|
|
31
15
|
patchYMap(curVal, newVal);
|
|
32
16
|
continue;
|
|
33
17
|
}
|
|
34
|
-
// If both sides are Y.Array / plain-array, patch the array
|
|
35
18
|
if (curVal instanceof Y.Array && Array.isArray(newVal)) {
|
|
36
19
|
patchYArray(curVal, newVal);
|
|
37
20
|
continue;
|
|
38
21
|
}
|
|
39
|
-
// For primitives, skip if unchanged
|
|
40
22
|
if (!(curVal instanceof Y.Map) &&
|
|
41
23
|
!(curVal instanceof Y.Array) &&
|
|
42
24
|
JSON.stringify(curVal) === JSON.stringify(newVal)) {
|
|
43
25
|
continue;
|
|
44
26
|
}
|
|
45
|
-
// Value changed type or is a different primitive – replace wholesale
|
|
46
27
|
ymap.set(key, toYjsValue(newVal));
|
|
47
28
|
}
|
|
48
29
|
}
|
|
49
|
-
/**
|
|
50
|
-
* Incrementally patch a Y.Array to match a plain array.
|
|
51
|
-
* Patches items in-place where possible, appends/trims as needed.
|
|
52
|
-
*/
|
|
53
30
|
export function patchYArray(yarr, newArr) {
|
|
54
31
|
const minLen = Math.min(yarr.length, newArr.length);
|
|
55
32
|
for (let i = 0; i < minLen; i++) {
|
|
56
33
|
const curItem = yarr.get(i);
|
|
57
34
|
const newItem = newArr[i];
|
|
58
|
-
// If both are Y.Map / plain-object, patch in place
|
|
59
35
|
if (curItem instanceof Y.Map &&
|
|
60
36
|
newItem !== null &&
|
|
61
37
|
typeof newItem === 'object' &&
|
|
@@ -63,43 +39,27 @@ export function patchYArray(yarr, newArr) {
|
|
|
63
39
|
patchYMap(curItem, newItem);
|
|
64
40
|
continue;
|
|
65
41
|
}
|
|
66
|
-
// If both are Y.Array / plain-array, patch in place
|
|
67
42
|
if (curItem instanceof Y.Array && Array.isArray(newItem)) {
|
|
68
43
|
patchYArray(curItem, newItem);
|
|
69
44
|
continue;
|
|
70
45
|
}
|
|
71
|
-
// For primitives, skip if unchanged
|
|
72
46
|
if (!(curItem instanceof Y.Map) &&
|
|
73
47
|
!(curItem instanceof Y.Array) &&
|
|
74
48
|
JSON.stringify(curItem) === JSON.stringify(newItem)) {
|
|
75
49
|
continue;
|
|
76
50
|
}
|
|
77
|
-
// Different – delete and re-insert at same index
|
|
78
51
|
yarr.delete(i, 1);
|
|
79
52
|
yarr.insert(i, [toYjsValue(newItem)]);
|
|
80
53
|
}
|
|
81
|
-
// Append new items
|
|
82
54
|
if (newArr.length > yarr.length) {
|
|
83
55
|
const toAdd = newArr.slice(yarr.length).map((item) => toYjsValue(item));
|
|
84
56
|
yarr.push(toAdd);
|
|
85
57
|
}
|
|
86
|
-
// Trim excess items from the end
|
|
87
58
|
if (yarr.length > newArr.length) {
|
|
88
59
|
yarr.delete(newArr.length, yarr.length - newArr.length);
|
|
89
60
|
}
|
|
90
61
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Convert a Puck data structure to a Yjs Y.Map.
|
|
93
|
-
* When the root map already has data, uses incremental patching to minimise
|
|
94
|
-
* the number of Yjs operations (reducing flicker and broadcast size).
|
|
95
|
-
*
|
|
96
|
-
* @param data - The PuckData to convert
|
|
97
|
-
* @param root - The Y.Map to populate
|
|
98
|
-
*/
|
|
99
62
|
export function puckDataToYMap(data, root) {
|
|
100
|
-
// Top-level no-op guard: if the Y.Doc already contains identical data,
|
|
101
|
-
// skip the entire transaction. This prevents echo loops where a receiving
|
|
102
|
-
// client's Puck onChange re-sends data that's already in the Y.Doc.
|
|
103
63
|
if (root.size > 0) {
|
|
104
64
|
const currentJson = JSON.stringify(root.toJSON());
|
|
105
65
|
const newJson = JSON.stringify(data);
|
|
@@ -109,22 +69,15 @@ export function puckDataToYMap(data, root) {
|
|
|
109
69
|
}
|
|
110
70
|
root.doc?.transact(() => {
|
|
111
71
|
if (root.size > 0) {
|
|
112
|
-
// Incremental update – only touch what changed
|
|
113
72
|
patchYMap(root, data);
|
|
114
73
|
}
|
|
115
74
|
else {
|
|
116
|
-
// Full creation – first time populating the map.
|
|
117
|
-
// Tolerate partial data (missing content/root) the same way
|
|
118
|
-
// yMapToPuckData does on the read path: a document switch can seed a
|
|
119
|
-
// fresh Y.Doc from a page object that has no content array yet.
|
|
120
75
|
const contentArray = new Y.Array();
|
|
121
76
|
for (const item of data.content ?? []) {
|
|
122
77
|
contentArray.push([toYjsValue(item)]);
|
|
123
78
|
}
|
|
124
79
|
root.set('content', contentArray);
|
|
125
|
-
// Convert root data
|
|
126
80
|
root.set('root', toYjsValue(data.root ?? { props: {} }));
|
|
127
|
-
// Convert zones if present
|
|
128
81
|
if (data.zones) {
|
|
129
82
|
const zonesMap = new Y.Map();
|
|
130
83
|
for (const [key, components] of Object.entries(data.zones)) {
|
|
@@ -139,19 +92,11 @@ export function puckDataToYMap(data, root) {
|
|
|
139
92
|
}
|
|
140
93
|
}, LOCAL_ORIGIN);
|
|
141
94
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Convert a Yjs Y.Map to PuckData.
|
|
144
|
-
*
|
|
145
|
-
* @param root - The Y.Map containing Puck data
|
|
146
|
-
* @returns The PuckData structure
|
|
147
|
-
*/
|
|
148
95
|
export function yMapToPuckData(root) {
|
|
149
96
|
const json = root.toJSON();
|
|
150
|
-
// Ensure content is an array
|
|
151
97
|
const content = Array.isArray(json.content)
|
|
152
98
|
? json.content
|
|
153
99
|
: [];
|
|
154
|
-
// Ensure root has props
|
|
155
100
|
const rootData = json.root;
|
|
156
101
|
const rootWithProps = {
|
|
157
102
|
props: rootData?.props ?? {},
|
|
@@ -161,65 +106,33 @@ export function yMapToPuckData(root) {
|
|
|
161
106
|
content,
|
|
162
107
|
root: rootWithProps,
|
|
163
108
|
};
|
|
164
|
-
// Include zones if present
|
|
165
109
|
if (json.zones) {
|
|
166
110
|
result.zones = json.zones;
|
|
167
111
|
}
|
|
168
112
|
return result;
|
|
169
113
|
}
|
|
170
|
-
/**
|
|
171
|
-
* Create a bidirectional binding between Puck data and a Y.Doc.
|
|
172
|
-
*
|
|
173
|
-
* Uses transaction origins to prevent sync loops:
|
|
174
|
-
* - Local changes use 'local' origin and don't trigger onRemoteUpdate
|
|
175
|
-
* - Remote changes (any other origin) trigger onRemoteUpdate
|
|
176
|
-
*
|
|
177
|
-
* @param ydoc - The Y.Doc to bind to
|
|
178
|
-
* @param onRemoteUpdate - Callback when remote changes arrive
|
|
179
|
-
* @returns Binding interface with applyLocalChange and destroy methods
|
|
180
|
-
*/
|
|
181
114
|
export function createPuckYjsBinding(ydoc, onRemoteUpdate) {
|
|
182
115
|
const root = ydoc.getMap('root');
|
|
183
|
-
// Instance-specific state to prevent interference between multiple bindings
|
|
184
|
-
// Previously this was a module-level variable which caused race conditions
|
|
185
|
-
// when multiple binding instances existed in the same browser window
|
|
186
116
|
const bindingState = {
|
|
187
117
|
isApplyingLocalChange: false,
|
|
188
118
|
destroyed: false,
|
|
189
119
|
};
|
|
190
|
-
// Observer for remote changes
|
|
191
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
192
120
|
const observer = (_events, txn) => {
|
|
193
|
-
// Double-check: skip if we're in the middle of applying a local change
|
|
194
|
-
// This handles any edge cases where transaction origin might not be set correctly
|
|
195
121
|
if (bindingState.isApplyingLocalChange) {
|
|
196
122
|
return;
|
|
197
123
|
}
|
|
198
|
-
// Ignore local changes by transaction origin
|
|
199
124
|
if (txn.origin === LOCAL_ORIGIN) {
|
|
200
125
|
return;
|
|
201
126
|
}
|
|
202
|
-
// Convert Y.Map to PuckData and notify
|
|
203
127
|
const puckData = yMapToPuckData(root);
|
|
204
|
-
// Guard against empty Yjs initial sync state. When a new Yjs document
|
|
205
|
-
// connects, the first sync may produce an empty snapshot ({} or
|
|
206
|
-
// { content: [], root: { props: {} } }). Applying this would overwrite
|
|
207
|
-
// real editor content and trigger a save loop.
|
|
208
128
|
if (puckData.content.length === 0 && Object.keys(puckData.root.props).length === 0 && !puckData.zones) {
|
|
209
129
|
return;
|
|
210
130
|
}
|
|
211
131
|
onRemoteUpdate(puckData);
|
|
212
132
|
};
|
|
213
|
-
// Subscribe to changes on root map
|
|
214
133
|
root.observeDeep(observer);
|
|
215
134
|
return {
|
|
216
|
-
/**
|
|
217
|
-
* Apply a local change to the Y.Doc.
|
|
218
|
-
* Uses LOCAL_ORIGIN to prevent triggering onRemoteUpdate.
|
|
219
|
-
* Also sets isApplyingLocalChange flag as a backup mechanism.
|
|
220
|
-
*/
|
|
221
135
|
applyLocalChange: (data) => {
|
|
222
|
-
// Prevent writes through a destroyed binding (cross-document state bleed guard)
|
|
223
136
|
if (bindingState.destroyed) {
|
|
224
137
|
return;
|
|
225
138
|
}
|
|
@@ -231,12 +144,6 @@ export function createPuckYjsBinding(ydoc, onRemoteUpdate) {
|
|
|
231
144
|
bindingState.isApplyingLocalChange = false;
|
|
232
145
|
}
|
|
233
146
|
},
|
|
234
|
-
/**
|
|
235
|
-
* Cleanup observers and mark as destroyed.
|
|
236
|
-
* After destroy(), applyLocalChange becomes a no-op.
|
|
237
|
-
* Idempotent: safe to call multiple times (e.g. React strict mode
|
|
238
|
-
* double-unmount where both useLayoutEffect and useEffect cleanups fire).
|
|
239
|
-
*/
|
|
240
147
|
destroy: () => {
|
|
241
148
|
if (bindingState.destroyed)
|
|
242
149
|
return;
|
|
@@ -245,12 +152,6 @@ export function createPuckYjsBinding(ydoc, onRemoteUpdate) {
|
|
|
245
152
|
},
|
|
246
153
|
};
|
|
247
154
|
}
|
|
248
|
-
/**
|
|
249
|
-
* Convert a JavaScript value to a Yjs-compatible value.
|
|
250
|
-
*
|
|
251
|
-
* @param value - The value to convert
|
|
252
|
-
* @returns The Yjs-compatible value
|
|
253
|
-
*/
|
|
254
155
|
function toYjsValue(value) {
|
|
255
156
|
if (value === null || value === undefined) {
|
|
256
157
|
return value;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"puckYjsBinding.js","sourceRoot":"","sources":["../../../src/editor/utils/puckYjsBinding.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"puckYjsBinding.js","sourceRoot":"","sources":["../../../src/editor/utils/puckYjsBinding.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAuBzB,MAAM,YAAY,GAAG,OAAO,CAAC;AA4B7B,MAAM,UAAU,SAAS,CACvB,IAAoB,EACpB,MAA+B;IAG/B,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAC9B,IAAI,CAAC,CAAC,GAAG,IAAI,MAAM,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IAED,KAAK,MAAM,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAG7B,IACE,MAAM,YAAY,CAAC,CAAC,GAAG;YACv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C,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChD,OAAO,GAAG,CAAC;QACb,CAAC;aAAM,CAAC;YACN,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;YACxB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC3C,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;YAC5B,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reverts the document to a previous version.
|
|
3
|
-
*
|
|
4
|
-
* Flow:
|
|
5
|
-
* 1. Pause auto-save and flush any pending edits (with a confirm fallback on flush failure).
|
|
6
|
-
* 2. Call the restore API. On success, best-effort reload the document.
|
|
7
|
-
* 3. Resume auto-save (always, in finally).
|
|
8
|
-
* 4. Notify the caller whether the reload succeeded so it can refresh the
|
|
9
|
-
* version list and remount Puck with clean state.
|
|
10
|
-
*
|
|
11
|
-
* @param onReloadSuccess - Called when the post-restore document reload succeeds.
|
|
12
|
-
*/
|
|
13
1
|
export async function restoreDocumentVersion(version, deps, refreshVersions, onReloadSuccess) {
|
|
14
2
|
const { client, siteId, branchId, currentDocument, pauseAutoSave, resumeAutoSave, persistCurrentEdits, loadDocument, notifications } = deps;
|
|
15
3
|
if (!currentDocument)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"restoreDocumentVersion.js","sourceRoot":"","sources":["../../../src/editor/utils/restoreDocumentVersion.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"restoreDocumentVersion.js","sourceRoot":"","sources":["../../../src/editor/utils/restoreDocumentVersion.ts"],"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
|
-
* Puck merges `defaultProps` underneath stored props on every render, so a
|
|
5
|
-
* block whose stored props omit a richtext key silently renders that key's
|
|
6
|
-
* default. An empty-string default is fatal there: Puck's RichTextRender wraps
|
|
7
|
-
* any non-HTML string as `{type:"text", text: value}`, and prosemirror-model
|
|
8
|
-
* rejects a zero-length text node with `RangeError: Empty text nodes are not
|
|
9
|
-
* allowed` — taking down the whole subtree, since that render path has no error
|
|
10
|
-
* boundary. `undefined` is safe (it normalizes to an empty doc), so dropping
|
|
11
|
-
* the key is strictly better than defaulting to "".
|
|
12
|
-
*
|
|
13
|
-
* Runs over nested object/array fields too, since richtext commonly lives
|
|
14
|
-
* inside array items.
|
|
15
|
-
*/
|
|
16
1
|
const DROP = Symbol('drop');
|
|
17
2
|
function sanitizeValue(field, value) {
|
|
18
3
|
if (!field)
|
|
@@ -25,9 +10,6 @@ function sanitizeValue(field, value) {
|
|
|
25
10
|
}
|
|
26
11
|
if (field.type === 'array' && field.arrayFields && Array.isArray(value)) {
|
|
27
12
|
const itemFields = field.arrayFields;
|
|
28
|
-
// `map` always allocates, so compare item identity to decide whether the
|
|
29
|
-
// array actually changed — otherwise the caller sees a new reference and
|
|
30
|
-
// treats an untouched config as modified.
|
|
31
13
|
let itemChanged = false;
|
|
32
14
|
const next = value.map((item) => {
|
|
33
15
|
if (!isPlainObject(item))
|
|
@@ -66,14 +48,6 @@ function sanitizeComponent(component) {
|
|
|
66
48
|
const next = sanitizeProps(fields, defaultProps);
|
|
67
49
|
return next === defaultProps ? component : { ...component, defaultProps: next };
|
|
68
50
|
}
|
|
69
|
-
/**
|
|
70
|
-
* Return a config with empty-string richtext defaults removed. Returns the
|
|
71
|
-
* input unchanged (same reference) when there is nothing to strip, so it is
|
|
72
|
-
* safe to call in a render path without breaking Puck's memoization.
|
|
73
|
-
*/
|
|
74
|
-
// Generic in T rather than constrained to ConfigLike: Puck's `Config` field
|
|
75
|
-
// unions don't structurally satisfy the loose shape this walks, and callers
|
|
76
|
-
// should get their own config type back untouched.
|
|
77
51
|
export function sanitizeRichtextDefaults(config) {
|
|
78
52
|
const input = config;
|
|
79
53
|
let changed = false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitizeRichtextDefaults.js","sourceRoot":"","sources":["../../../src/editor/utils/sanitizeRichtextDefaults.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sanitizeRichtextDefaults.js","sourceRoot":"","sources":["../../../src/editor/utils/sanitizeRichtextDefaults.ts"],"names":[],"mappings":"AAkCA,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;AAE5B,SAAS,aAAa,CAAC,KAA4B,EAAE,KAAc;IACjE,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IAEzB,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAC9B,OAAO,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACrC,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,YAAY,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1E,OAAO,aAAa,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxE,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAAC;QAIrC,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YAC9B,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC;gBAAE,OAAO,IAAI,CAAC;YACtC,MAAM,SAAS,GAAG,aAAa,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAClD,IAAI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4
|
-
* objects, but the backend sometimes returns them as a JSON string; parsing
|
|
5
|
-
* here keeps every downstream consumer (currentData, safeData, the Yjs seed,
|
|
6
|
-
* the document-sync store) working with a real object instead of spreading a
|
|
7
|
-
* string character-by-character. Empty or invalid snapshots — including the
|
|
8
|
-
* blank initial version — collapse to blank Puck data.
|
|
9
|
-
*/
|
|
10
2
|
export function snapshotToPuckData(snapshot) {
|
|
11
3
|
let value = snapshot;
|
|
12
4
|
if (typeof value === "string") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotToPuckData.js","sourceRoot":"","sources":["../../../src/editor/utils/snapshotToPuckData.ts"],"names":[],"mappings":"AAEA,MAAM,KAAK,GAAa,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"snapshotToPuckData.js","sourceRoot":"","sources":["../../../src/editor/utils/snapshotToPuckData.ts"],"names":[],"mappings":"AAEA,MAAM,KAAK,GAAa,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC;AAU7D,MAAM,UAAU,kBAAkB,CAAC,QAAiB;IAClD,IAAI,KAAK,GAAY,QAAQ,CAAC;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC;YACH,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,IAAI,GAAG,KAA0B,CAAC;IACxC,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9C,OAAO,IAAgB,CAAC;AAC1B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* syncComponentRegistry
|
|
3
3
|
*
|
|
4
|
-
* Serialises ComponentDescriptor objects to
|
|
4
|
+
* Serialises ComponentDescriptor objects to backend documents under the
|
|
5
5
|
* /_registry/ path prefix, hash-checking to skip unchanged components.
|
|
6
6
|
*
|
|
7
7
|
* Extracted from useComponentRegistry.ts (verbatim, renamed) so it can run
|
|
@@ -19,7 +19,7 @@ export declare const COMPONENT_PREFIX = "_registry/components/";
|
|
|
19
19
|
export declare const INDEX_PATH = "_registry/index";
|
|
20
20
|
/**
|
|
21
21
|
* Maximum age of the registry index's last full per-component verification
|
|
22
|
-
*
|
|
22
|
+
* before the fast path is forced to re-verify every component's
|
|
23
23
|
* actual document content instead of trusting the index's hashes map alone.
|
|
24
24
|
* Bounds how long an index/document desync can persist undetected.
|
|
25
25
|
*/
|
|
@@ -1,51 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* syncComponentRegistry
|
|
3
|
-
*
|
|
4
|
-
* Serialises ComponentDescriptor objects to CSS documents under the
|
|
5
|
-
* /_registry/ path prefix, hash-checking to skip unchanged components.
|
|
6
|
-
*
|
|
7
|
-
* Extracted from useComponentRegistry.ts (verbatim, renamed) so it can run
|
|
8
|
-
* outside React — the browser hook and a headless CI sync script both call
|
|
9
|
-
* this same function. No React import here by design.
|
|
10
|
-
*/
|
|
11
1
|
import { ConflictError } from '@pantheon-systems/css-client';
|
|
12
2
|
import { buildRegistryIndex, } from './componentRegistry.js';
|
|
13
|
-
// =============================================================================
|
|
14
|
-
// Registry path helpers
|
|
15
|
-
// =============================================================================
|
|
16
3
|
const REGISTRY_PREFIX = '_registry/';
|
|
17
4
|
export const COMPONENT_PREFIX = '_registry/components/';
|
|
18
5
|
export const INDEX_PATH = '_registry/index';
|
|
19
|
-
|
|
20
|
-
* Maximum age of the registry index's last full per-component verification
|
|
21
|
-
* (PCC-3430) before the fast path is forced to re-verify every component's
|
|
22
|
-
* actual document content instead of trusting the index's hashes map alone.
|
|
23
|
-
* Bounds how long an index/document desync can persist undetected.
|
|
24
|
-
*/
|
|
25
|
-
export const REGISTRY_VERIFICATION_INTERVAL_MS = 24 * 60 * 60 * 1000; // 24 hours
|
|
6
|
+
export const REGISTRY_VERIFICATION_INTERVAL_MS = 24 * 60 * 60 * 1000;
|
|
26
7
|
export function componentPath(name) {
|
|
27
8
|
return `${COMPONENT_PREFIX}${name}`;
|
|
28
9
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Comparison key for matching a component name against server state.
|
|
31
|
-
*
|
|
32
|
-
* The server's normalizePath lowercases every document path on write, so a
|
|
33
|
-
* component registered as HeroBlock lists back at _registry/components/heroblock.
|
|
34
|
-
* Every in-memory lookup that matches descriptor names against path-derived
|
|
35
|
-
* names (or index hash keys) must go through this key, or PascalCase components
|
|
36
|
-
* never match their own documents and re-register on every load. Stored
|
|
37
|
-
* formats are unchanged — index hashes stay keyed by original names, and
|
|
38
|
-
* componentPath still sends the original name (the server normalizes it).
|
|
39
|
-
*/
|
|
40
10
|
function registryComponentKey(name) {
|
|
41
11
|
return name.toLowerCase();
|
|
42
12
|
}
|
|
43
13
|
export async function syncComponentRegistry(client, siteId, branchId, descriptors) {
|
|
44
|
-
// Step 1: List all existing registry documents
|
|
45
14
|
const existingDocs = (await client.documents.list(siteId, branchId, {
|
|
46
15
|
pathPrefix: REGISTRY_PREFIX,
|
|
47
16
|
}));
|
|
48
|
-
// Step 2: Build lookup maps for existing component docs
|
|
49
17
|
const docByName = new Map();
|
|
50
18
|
let indexDoc;
|
|
51
19
|
for (const doc of existingDocs) {
|
|
@@ -57,8 +25,6 @@ export async function syncComponentRegistry(client, siteId, branchId, descriptor
|
|
|
57
25
|
docByName.set(registryComponentKey(name), doc);
|
|
58
26
|
}
|
|
59
27
|
}
|
|
60
|
-
// Names that collide case-insensitively share one server document (the
|
|
61
|
-
// server lowercases paths) and will silently overwrite each other.
|
|
62
28
|
const namesByKey = new Map();
|
|
63
29
|
for (const descriptor of descriptors) {
|
|
64
30
|
const key = registryComponentKey(descriptor.name);
|
|
@@ -69,15 +35,6 @@ export async function syncComponentRegistry(client, siteId, branchId, descriptor
|
|
|
69
35
|
console.warn('[syncComponentRegistry] Component names collide case-insensitively and will share one registry document (last write wins):', names);
|
|
70
36
|
}
|
|
71
37
|
}
|
|
72
|
-
// Step 3: Resolve stored hashes — fast path (from index) or legacy (per-component).
|
|
73
|
-
//
|
|
74
|
-
// Fast path: if the index version has a `hashes` map, read all hashes from it
|
|
75
|
-
// in a single request instead of fetching each component version individually.
|
|
76
|
-
// This collapses N simultaneous getLatest calls (one per component) into 1.
|
|
77
|
-
//
|
|
78
|
-
// Legacy fallback: index exists but has no `hashes` field (written by an older
|
|
79
|
-
// version of this hook), or no index exists yet. Falls back to per-component
|
|
80
|
-
// fetches so existing registries continue to work on the first run after deploy.
|
|
81
38
|
const storedHashByName = new Map();
|
|
82
39
|
let gotHashesFromIndex = false;
|
|
83
40
|
let existingVerifiedAt;
|
|
@@ -100,13 +57,6 @@ export async function syncComponentRegistry(client, siteId, branchId, descriptor
|
|
|
100
57
|
console.debug('[syncComponentRegistry] Fast path: loaded', storedHashByName.size, 'hashes from index');
|
|
101
58
|
}
|
|
102
59
|
else if (verificationIsStale) {
|
|
103
|
-
// PCC-3430: the fast path trusts `hashes` without ever reading the
|
|
104
|
-
// documents it describes. If an entry ever comes to record a hash
|
|
105
|
-
// that doesn't match its document's real content (e.g. an
|
|
106
|
-
// out-of-band revert the index was never told about), the fast path
|
|
107
|
-
// has no way to detect this on its own and would skip forever.
|
|
108
|
-
// Periodically forcing a real per-component check bounds how long
|
|
109
|
-
// such a desync can persist instead of letting it stick indefinitely.
|
|
110
60
|
console.debug('[syncComponentRegistry] Registry verification is stale — forcing per-component fetch to self-heal any index/document desync');
|
|
111
61
|
}
|
|
112
62
|
else {
|
|
@@ -121,7 +71,6 @@ export async function syncComponentRegistry(client, siteId, branchId, descriptor
|
|
|
121
71
|
console.debug('[syncComponentRegistry] No index document found — will create one after registration');
|
|
122
72
|
}
|
|
123
73
|
if (!gotHashesFromIndex) {
|
|
124
|
-
// Legacy path: fetch each component version individually to get stored hash.
|
|
125
74
|
console.debug('[syncComponentRegistry] Legacy path: fetching', docByName.size, 'component versions individually');
|
|
126
75
|
await Promise.all(Array.from(docByName.entries()).map(async ([name, doc]) => {
|
|
127
76
|
try {
|
|
@@ -132,27 +81,14 @@ export async function syncComponentRegistry(client, siteId, branchId, descriptor
|
|
|
132
81
|
}
|
|
133
82
|
}
|
|
134
83
|
catch {
|
|
135
|
-
// Version fetch failure → treat as hash mismatch, will overwrite
|
|
136
84
|
}
|
|
137
85
|
}));
|
|
138
86
|
}
|
|
139
|
-
// Step 4: Write only changed/new descriptors
|
|
140
87
|
let registered = 0;
|
|
141
88
|
let skipped = 0;
|
|
142
89
|
await Promise.all(descriptors.map(async (descriptor) => {
|
|
143
90
|
const storedHash = storedHashByName.get(registryComponentKey(descriptor.name));
|
|
144
91
|
const existingDoc = docByName.get(registryComponentKey(descriptor.name));
|
|
145
|
-
// Skip only when the hash is unchanged AND the component document still
|
|
146
|
-
// exists on this branch. A hash-only check is unsafe: the index can drift
|
|
147
|
-
// out of sync with on-disk component docs (e.g. a partial historical
|
|
148
|
-
// write, an out-of-band deletion, or branch CoW interactions where the
|
|
149
|
-
// index was inherited but its referenced component docs were not). In
|
|
150
|
-
// that case the index reports a matching hash for a name whose document
|
|
151
|
-
// is missing, and the registry stays permanently stuck at fewer
|
|
152
|
-
// components than the running config defines. Requiring `existingDoc`
|
|
153
|
-
// forces the missing component through the create path on the next run,
|
|
154
|
-
// which self-heals the desync and rewrites the index from the full
|
|
155
|
-
// descriptor set.
|
|
156
92
|
if (existingDoc !== undefined && storedHash === descriptor.descriptorHash) {
|
|
157
93
|
skipped++;
|
|
158
94
|
return;
|
|
@@ -188,24 +124,13 @@ export async function syncComponentRegistry(client, siteId, branchId, descriptor
|
|
|
188
124
|
registered++;
|
|
189
125
|
}));
|
|
190
126
|
console.debug('[syncComponentRegistry] Registration complete:', 'registered =', registered, 'skipped =', skipped, 'total =', descriptors.length, '| gotHashesFromIndex =', gotHashesFromIndex);
|
|
191
|
-
// Detect hash instability: if we got hashes from the index but still had to register
|
|
192
|
-
// components, log which components had mismatched hashes.
|
|
193
127
|
if (gotHashesFromIndex && registered > 0) {
|
|
194
128
|
const changed = descriptors.filter(d => storedHashByName.get(registryComponentKey(d.name)) !== d.descriptorHash);
|
|
195
129
|
console.warn('[syncComponentRegistry] Hash mismatch detected for', changed.length, 'component(s) despite index being present.', 'These components will trigger a full re-registration on every load if their hashes are unstable:', changed.map(d => ({ name: d.name, stored: storedHashByName.get(registryComponentKey(d.name)), computed: d.descriptorHash })));
|
|
196
130
|
}
|
|
197
|
-
// Step 5: Write index when something changed, index doesn't exist yet, OR the existing
|
|
198
|
-
// index lacks the `hashes` field (legacy format). The third condition promotes legacy
|
|
199
|
-
// indexes to the fast-path format so that the next startup can skip per-component fetches.
|
|
200
131
|
const indexNeedsWrite = registered > 0 || indexDoc === undefined || !gotHashesFromIndex;
|
|
201
132
|
console.debug('[syncComponentRegistry] indexNeedsWrite =', indexNeedsWrite, '(registered > 0:', registered > 0, ', no indexDoc:', indexDoc === undefined, ', legacy format:', !gotHashesFromIndex, ')');
|
|
202
133
|
if (indexNeedsWrite) {
|
|
203
|
-
// A per-component verification just ran whenever we didn't trust the
|
|
204
|
-
// fast path (missing index, legacy format, or forced by staleness) —
|
|
205
|
-
// stamp verifiedAt as confirmed now. Otherwise carry the existing value
|
|
206
|
-
// forward: a fast-path-only run (skips + a changed component or two)
|
|
207
|
-
// doesn't verify every component's actual content, so it must not reset
|
|
208
|
-
// the clock on the next forced verification.
|
|
209
134
|
const verifiedAt = !gotHashesFromIndex ? new Date().toISOString() : existingVerifiedAt;
|
|
210
135
|
const index = buildRegistryIndex(descriptors, siteId, branchId, verifiedAt);
|
|
211
136
|
let indexDocId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"syncComponentRegistry.js","sourceRoot":"","sources":["../../../src/editor/utils/syncComponentRegistry.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"syncComponentRegistry.js","sourceRoot":"","sources":["../../../src/editor/utils/syncComponentRegistry.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EACL,kBAAkB,GAGnB,MAAM,wBAAwB,CAAC;AAgBhC,MAAM,eAAe,GAAG,YAAY,CAAC;AACrC,MAAM,CAAC,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AACxD,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,CAAC;AAQ5C,MAAM,CAAC,MAAM,iCAAiC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAErE,MAAM,UAAU,aAAa,CAAC,IAAY;IACxC,OAAO,GAAG,gBAAgB,GAAG,IAAI,EAAE,CAAC;AACtC,CAAC;AAaD,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;AAC5B,CAAC;AAYD,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,MAAgB,EAChB,MAAc,EACd,QAAgB,EAChB,WAAkC;IAGlC,MAAM,YAAY,GAAG,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,EAAE;QAClE,UAAU,EAAE,eAAe;KAC5B,CAAC,CAAmB,CAAC;IAGtB,MAAM,SAAS,GAAG,IAAI,GAAG,EAAwB,CAAC;IAClD,IAAI,QAAkC,CAAC;IACvC,KAAK,MAAM,GAAG,IAAI,YAAY,EAAE,CAAC;QAC/B,IAAI,GAAG,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YAC5B,QAAQ,GAAG,GAAG,CAAC;QACjB,CAAC;aAAM,IAAI,GAAG,CAAC,IAAI,CAA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CAAC;oBACjC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;oBACtE,UAAU,GAAI,QAAyB,CAAC,EAAE,CAAC;gBAC7C,CAAC;qBAAM,CAAC;oBACN,MAAM,GAAG,CAAC;gBACZ,CAAC;YACH,CAAC;QACH,CAAC;aAAM,CAAC;YACN,UAAU,GAAG,QAAQ,CAAC,EAAE,CAAC;QAC3B,CAAC;QACD,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;YACnC,UAAU,EAAE,UAAU;YACtB,QAAQ;YACR,QAAQ,EAAE,KAA2C;SACtD,CAAC,CAAC;IACL,CAAC;IAED,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* A write-only variant of syncComponentRegistry for callers holding a
|
|
5
5
|
* write:registry-scoped token, which has no read access at all by design
|
|
6
6
|
* (see collaborative-state-system's §0 write:registry scope). Skips the
|
|
7
|
-
* existence/hash-check reads entirely and
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
7
|
+
* existence/hash-check reads entirely and posts every descriptor on every
|
|
8
|
+
* run, relying on the backend's upsert-on-conflict behavior for _registry/*
|
|
9
|
+
* paths. The backend compares the posted content against what the branch
|
|
10
|
+
* already stores and writes a version only when it differs, so posting
|
|
11
|
+
* unconditionally costs nothing but the request — the skip-if-unchanged
|
|
12
|
+
* decision moved to the one side that can read, keeping this token unable
|
|
13
|
+
* to read anything.
|
|
14
14
|
*
|
|
15
15
|
* The interactive editor keeps using syncComponentRegistry, unmodified,
|
|
16
16
|
* with its skip-if-unchanged behavior — this variant is CI-only.
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* syncComponentRegistryWriteOnly
|
|
3
|
-
*
|
|
4
|
-
* A write-only variant of syncComponentRegistry for callers holding a
|
|
5
|
-
* write:registry-scoped token, which has no read access at all by design
|
|
6
|
-
* (see collaborative-state-system's §0 write:registry scope). Skips the
|
|
7
|
-
* existence/hash-check reads entirely and always creates-or-versions every
|
|
8
|
-
* descriptor, relying on the backend's upsert-on-conflict behavior for
|
|
9
|
-
* _registry/* paths (a live conflict on these paths creates a new version
|
|
10
|
-
* instead of erroring). Every run rewrites every component + the index,
|
|
11
|
-
* whether or not anything changed — accepted as a low-volume cost (the CI
|
|
12
|
-
* workflow only triggers on pushes touching component code) in exchange for
|
|
13
|
-
* a token that genuinely cannot read anything.
|
|
14
|
-
*
|
|
15
|
-
* The interactive editor keeps using syncComponentRegistry, unmodified,
|
|
16
|
-
* with its skip-if-unchanged behavior — this variant is CI-only.
|
|
17
|
-
*/
|
|
18
1
|
import { buildRegistryIndex } from './componentRegistry.js';
|
|
19
2
|
import { componentPath, INDEX_PATH } from './syncComponentRegistry.js';
|
|
20
3
|
export async function syncComponentRegistryWriteOnly(client, siteId, branchId, descriptors) {
|
|
@@ -24,11 +7,6 @@ export async function syncComponentRegistryWriteOnly(client, siteId, branchId, d
|
|
|
24
7
|
path: componentPath(descriptor.name),
|
|
25
8
|
snapshot: descriptor,
|
|
26
9
|
})));
|
|
27
|
-
// Every descriptor above was just unconditionally rewritten with its true
|
|
28
|
-
// current content — that IS a full per-component verification, the
|
|
29
|
-
// strongest one possible (PCC-3430). Stamping verifiedAt here means the
|
|
30
|
-
// next editor load can trust the fast path immediately instead of forcing
|
|
31
|
-
// an unnecessary per-component fetch right after this run.
|
|
32
10
|
const index = buildRegistryIndex(descriptors, siteId, branchId, new Date().toISOString());
|
|
33
11
|
await client.documents.create({
|
|
34
12
|
siteId,
|