@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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type DocumentSyncStore } from "./document-sync-plugin.js";
|
|
2
|
+
export interface ContextSyncKeyInput {
|
|
3
|
+
remoteSyncKey: string | null;
|
|
4
|
+
viewingVersion: {
|
|
5
|
+
id: string;
|
|
6
|
+
} | null;
|
|
7
|
+
currentDocument: {
|
|
8
|
+
id: string;
|
|
9
|
+
} | null;
|
|
10
|
+
branchId?: string | null;
|
|
11
|
+
/** Omitted by consumers that drive Puck without the document-sync plugin. */
|
|
12
|
+
documentSyncStore?: Pick<DocumentSyncStore, "getAppliedKey">;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Sync key ContextSyncBridge should push into Puck, or null to push nothing.
|
|
16
|
+
*
|
|
17
|
+
* Two mechanisms can replace the whole canvas: this one (a `setData` dispatch)
|
|
18
|
+
* and the document-sync plugin (`setHistories`, which also resets the undo
|
|
19
|
+
* stack). Since Puck now survives document switches, the plugin owns
|
|
20
|
+
* document -> document transitions; this bridge stands down for them. Its
|
|
21
|
+
* dispatch would otherwise land first — before the plugin advances the applied
|
|
22
|
+
* key — and trip useP1Editor's write-back guard on every page switch, burying
|
|
23
|
+
* the real races that warning is there to surface.
|
|
24
|
+
*
|
|
25
|
+
* The doc-latest key still matters when the canvas already shows the document:
|
|
26
|
+
* returning to latest from a historical version reaches this path, and nothing
|
|
27
|
+
* else restores the live data.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveContextSyncKey({ remoteSyncKey, viewingVersion, currentDocument, branchId, documentSyncStore, }: ContextSyncKeyInput): string | null;
|
|
30
|
+
//# sourceMappingURL=context-sync-key.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-sync-key.d.ts","sourceRoot":"","sources":["../../../src/editor/plugin/context-sync-key.ts"],"names":[],"mappings":"AAEA,OAAO,EAAmB,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEpF,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,cAAc,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACtC,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,6EAA6E;IAC7E,iBAAiB,CAAC,EAAE,IAAI,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;CAC9D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,aAAa,EACb,cAAc,EACd,eAAe,EACf,QAAQ,EACR,iBAAiB,GAClB,EAAE,mBAAmB,GAAG,MAAM,GAAG,IAAI,CAkBrC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { documentSyncKey } from "./document-sync-plugin.js";
|
|
3
|
+
/**
|
|
4
|
+
* Sync key ContextSyncBridge should push into Puck, or null to push nothing.
|
|
5
|
+
*
|
|
6
|
+
* Two mechanisms can replace the whole canvas: this one (a `setData` dispatch)
|
|
7
|
+
* and the document-sync plugin (`setHistories`, which also resets the undo
|
|
8
|
+
* stack). Since Puck now survives document switches, the plugin owns
|
|
9
|
+
* document -> document transitions; this bridge stands down for them. Its
|
|
10
|
+
* dispatch would otherwise land first — before the plugin advances the applied
|
|
11
|
+
* key — and trip useP1Editor's write-back guard on every page switch, burying
|
|
12
|
+
* the real races that warning is there to surface.
|
|
13
|
+
*
|
|
14
|
+
* The doc-latest key still matters when the canvas already shows the document:
|
|
15
|
+
* returning to latest from a historical version reaches this path, and nothing
|
|
16
|
+
* else restores the live data.
|
|
17
|
+
*/
|
|
18
|
+
export function resolveContextSyncKey({ remoteSyncKey, viewingVersion, currentDocument, branchId, documentSyncStore, }) {
|
|
19
|
+
if (remoteSyncKey)
|
|
20
|
+
return remoteSyncKey;
|
|
21
|
+
if (viewingVersion)
|
|
22
|
+
return `version-${viewingVersion.id}`;
|
|
23
|
+
if (!currentDocument)
|
|
24
|
+
return null;
|
|
25
|
+
if (documentSyncStore) {
|
|
26
|
+
const appliedKey = documentSyncStore.getAppliedKey();
|
|
27
|
+
// A null applied key means the plugin has not observed a document yet, so
|
|
28
|
+
// Puck was mounted with this one and there is no switch to defer to.
|
|
29
|
+
if (appliedKey !== null &&
|
|
30
|
+
appliedKey !== documentSyncKey(branchId, currentDocument.id)) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return `doc-${currentDocument.id}-latest`;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=context-sync-key.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-sync-key.js","sourceRoot":"","sources":["../../../src/editor/plugin/context-sync-key.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,eAAe,EAA0B,MAAM,2BAA2B,CAAC;AAWpF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,qBAAqB,CAAC,EACpC,aAAa,EACb,cAAc,EACd,eAAe,EACf,QAAQ,EACR,iBAAiB,GACG;IACpB,IAAI,aAAa;QAAE,OAAO,aAAa,CAAC;IACxC,IAAI,cAAc;QAAE,OAAO,WAAW,cAAc,CAAC,EAAE,EAAE,CAAC;IAC1D,IAAI,CAAC,eAAe;QAAE,OAAO,IAAI,CAAC;IAElC,IAAI,iBAAiB,EAAE,CAAC;QACtB,MAAM,UAAU,GAAG,iBAAiB,CAAC,aAAa,EAAE,CAAC;QACrD,0EAA0E;QAC1E,qEAAqE;QACrE,IACE,UAAU,KAAK,IAAI;YACnB,UAAU,KAAK,eAAe,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,CAAC,EAC5D,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,OAAO,OAAO,eAAe,CAAC,EAAE,SAAS,CAAC;AAC5C,CAAC"}
|
|
@@ -7,13 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import type { Checkpoint, DocumentVersion, PuckData, ActorPresence } from '@pantheon-systems/css-client';
|
|
9
9
|
import type { SaveStatus } from '../../core/types.js';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* Resolve the template being edited from a document path. Templates are stored
|
|
13
|
-
* as documents at `_registry/templates/<name>`; returns the matching template
|
|
14
|
-
* (by name) or null for ordinary pages.
|
|
15
|
-
*/
|
|
16
|
-
export declare function templateFromRegistryPath(path: string | undefined | null, templates: TemplateSummary[] | undefined): TemplateSummary | null;
|
|
10
|
+
export { templateFromRegistryPath } from '../utils/templatePath.js';
|
|
11
|
+
export { P1TemplateFields } from '../components/P1TemplateFields.js';
|
|
17
12
|
/**
|
|
18
13
|
* Options for creating P1 overrides
|
|
19
14
|
*/
|
|
@@ -69,18 +64,25 @@ export interface P1OverridesOptions {
|
|
|
69
64
|
onPublishError?: (error: Error) => void;
|
|
70
65
|
/** Whether to show the default Puck publish button */
|
|
71
66
|
showDefaultPublish?: boolean;
|
|
67
|
+
/** Whether currently viewing a historical version of a document */
|
|
68
|
+
isViewingHistoricalVersion?: boolean;
|
|
69
|
+
/** The historical version being previewed. */
|
|
70
|
+
viewingVersion?: DocumentVersion | null;
|
|
72
71
|
/**
|
|
73
|
-
*
|
|
72
|
+
* Callback to exit version preview and return to the latest version.
|
|
73
|
+
* Wired to the "Back to current version" button in the components/outline overlays.
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
onReturnToLatest?: () => void;
|
|
76
76
|
/**
|
|
77
|
-
* The
|
|
77
|
+
* @deprecated Pass to VersionBannerOverride instead. The banner is no longer
|
|
78
|
+
* rendered by createP1Overrides; this prop is silently ignored.
|
|
78
79
|
*/
|
|
79
|
-
|
|
80
|
+
onRestoreVersion?: (version: DocumentVersion) => Promise<void>;
|
|
80
81
|
/**
|
|
81
|
-
*
|
|
82
|
+
* @deprecated Pass to VersionBannerOverride instead. The banner is no longer
|
|
83
|
+
* rendered by createP1Overrides; this prop is silently ignored.
|
|
82
84
|
*/
|
|
83
|
-
|
|
85
|
+
canRevert?: boolean;
|
|
84
86
|
/**
|
|
85
87
|
* @deprecated Pass syncData to createP1Plugin instead. The plugin renders
|
|
86
88
|
* inside Puck's context where usePuck() works correctly. Passing these props
|
|
@@ -123,46 +125,27 @@ export interface PuckOverrides {
|
|
|
123
125
|
}) => React.ReactElement;
|
|
124
126
|
[key: string]: unknown;
|
|
125
127
|
}
|
|
128
|
+
interface FieldLabelOverrideProps {
|
|
129
|
+
children?: React.ReactNode;
|
|
130
|
+
icon?: React.ReactNode;
|
|
131
|
+
label: string;
|
|
132
|
+
el?: 'label' | 'div';
|
|
133
|
+
readOnly?: boolean;
|
|
134
|
+
}
|
|
126
135
|
/**
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* @example
|
|
132
|
-
* ```tsx
|
|
133
|
-
* import { createP1Overrides, useP1Puck } from '@pantheon-systems/puck-css';
|
|
134
|
-
*
|
|
135
|
-
* function Editor() {
|
|
136
|
-
* const {
|
|
137
|
-
* saveStatus,
|
|
138
|
-
* lastSaved,
|
|
139
|
-
* saveError,
|
|
140
|
-
* saveNow,
|
|
141
|
-
* publishDocument,
|
|
142
|
-
* } = useP1Puck();
|
|
143
|
-
*
|
|
144
|
-
* // Preferred: use refs and getters for better performance
|
|
145
|
-
* const saveStatusRef = useRef(saveStatus);
|
|
146
|
-
* useEffect(() => { saveStatusRef.current = saveStatus; }, [saveStatus]);
|
|
147
|
-
*
|
|
148
|
-
* const overrides = createP1Overrides({
|
|
149
|
-
* getSaveStatus: () => saveStatusRef.current,
|
|
150
|
-
* getLastSaved: () => lastSavedRef.current,
|
|
151
|
-
* getSaveError: () => saveErrorRef.current,
|
|
152
|
-
* onRetrySave: saveNow,
|
|
153
|
-
* });
|
|
136
|
+
* Renders an opted-in field group's label row as a disclosure. Puck hands a
|
|
137
|
+
* label override the field's content as `children`, so the group's own label
|
|
138
|
+
* becomes the toggle — there is no second header and nothing to suppress.
|
|
154
139
|
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
* saveStatus,
|
|
158
|
-
* lastSaved,
|
|
159
|
-
* saveError,
|
|
160
|
-
* onRetrySave: saveNow,
|
|
161
|
-
* });
|
|
140
|
+
* The context is cleared for descendants so a nested group inside a collapsible
|
|
141
|
+
* one keeps its ordinary label.
|
|
162
142
|
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
143
|
+
* Ordinary field labels drop Puck's field-type icon. Its select variant is a
|
|
144
|
+
* chevron, the same glyph the disclosure above uses, so it reads as a group that
|
|
145
|
+
* expands and then does nothing. The label already says what the field is, and
|
|
146
|
+
* the narrow inspector would rather have the space. The read-only lock is a
|
|
147
|
+
* separate slot and survives.
|
|
166
148
|
*/
|
|
149
|
+
export declare function P1FieldLabel(props: FieldLabelOverrideProps): React.ReactElement;
|
|
167
150
|
export declare function createP1Overrides(options: P1OverridesOptions): PuckOverrides;
|
|
168
151
|
//# sourceMappingURL=createP1Overrides.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createP1Overrides.d.ts","sourceRoot":"","sources":["../../../src/editor/plugin/createP1Overrides.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACzG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"createP1Overrides.d.ts","sourceRoot":"","sources":["../../../src/editor/plugin/createP1Overrides.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACzG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAetD,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAGrE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,UAAU,CAAC;IACjC;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, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* P1 Puck Overrides
|
|
4
|
+
*
|
|
5
|
+
* Creates Puck overrides for P1 integration, including
|
|
6
|
+
* header actions for save status and publish functionality.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { ActionBar, FieldLabel } from '@puckeditor/core';
|
|
3
10
|
import { SaveIndicator } from '../components/SaveIndicator.js';
|
|
4
|
-
import { HistoricalVersionBanner } from '../../versioning/components/HistoricalVersionBanner.js';
|
|
5
11
|
import { CollaboratorAvatars } from '../../collaboration/components/CollaboratorAvatars.js';
|
|
6
12
|
import { AgentActivityBanner } from '../../collaboration/components/AgentActivityBanner.js';
|
|
7
13
|
import { PublishedStatusBadge } from '../components/PublishedStatusBadge.js';
|
|
8
14
|
import { ActionBarPinButton } from '../../features/content-type-templates/ui/ActionBarPinButton.js';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
15
|
+
import { P1InspectorFields } from '../components/P1InspectorFields.js';
|
|
16
|
+
import { CollapsibleFieldSection } from '../components/CollapsibleFieldSection.js';
|
|
17
|
+
import { CollapsibleFieldContext } from '../components/collapsibleSectionContext.js';
|
|
18
|
+
import { OutlinePanel } from '../components/OutlinePanel.js';
|
|
19
|
+
import { fieldGuidanceFieldTypes } from './fieldGuidance.js';
|
|
11
20
|
// NOTE: PuckDataSynchronizer is NOT imported here - it's used in P1Plugin instead
|
|
12
21
|
// because headerActions renders outside Puck's context where usePuck() doesn't work.
|
|
13
|
-
//
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* as documents at `_registry/templates/<name>`; returns the matching template
|
|
18
|
-
* (by name) or null for ordinary pages.
|
|
19
|
-
*/
|
|
20
|
-
export function templateFromRegistryPath(path, templates) {
|
|
21
|
-
if (!path || !templates)
|
|
22
|
-
return null;
|
|
23
|
-
const match = path.match(/^_registry\/templates\/(.+)$/);
|
|
24
|
-
if (!match)
|
|
25
|
-
return null;
|
|
26
|
-
return templates.find((t) => t.name === match[1]) ?? null;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Right-sidebar fields override. In template mode (editing a template document)
|
|
30
|
-
* with the root selected, it replaces the default "Page" root fields with the
|
|
31
|
-
* "Template" details panel (Label / Description / URL pattern). Otherwise it
|
|
32
|
-
* renders Puck's default fields unchanged.
|
|
33
|
-
*/
|
|
34
|
-
function P1TemplateFields({ children }) {
|
|
35
|
-
const css = useP1PuckOptional();
|
|
36
|
-
const itemSelector = useOverridesPuck((s) => s.appState?.ui?.itemSelector);
|
|
37
|
-
const { dispatch } = usePuck();
|
|
38
|
-
const template = templateFromRegistryPath(css?.currentDocument?.path, css?.templates);
|
|
39
|
-
// Only override the ROOT fields (nothing selected) while editing a template.
|
|
40
|
-
if (template && !itemSelector && css?.updateTemplate) {
|
|
41
|
-
const updateTemplate = css.updateTemplate;
|
|
42
|
-
return (_jsx(TemplateDetailsPanel, { template: template, onSave: async (details) => {
|
|
43
|
-
// Metadata-only PATCH; the layout is persisted by the canvas autosave.
|
|
44
|
-
await updateTemplate(template.id, {
|
|
45
|
-
label: details.label,
|
|
46
|
-
description: details.description,
|
|
47
|
-
defaultUrlPattern: details.defaultUrlPattern,
|
|
48
|
-
});
|
|
49
|
-
// Mirror the saved metadata into the live Puck root props
|
|
50
|
-
// (root.props._template) so the canvas autosave writes the same
|
|
51
|
-
// metadata the PATCH persisted.
|
|
52
|
-
dispatch({
|
|
53
|
-
type: 'setData',
|
|
54
|
-
data: (prev) => {
|
|
55
|
-
const root = (prev.root ?? {});
|
|
56
|
-
const props = (root.props ?? {});
|
|
57
|
-
return {
|
|
58
|
-
...prev,
|
|
59
|
-
root: {
|
|
60
|
-
...root,
|
|
61
|
-
props: {
|
|
62
|
-
...props,
|
|
63
|
-
_template: {
|
|
64
|
-
...(props._template ?? {}),
|
|
65
|
-
label: details.label,
|
|
66
|
-
description: details.description,
|
|
67
|
-
defaultUrlPattern: details.defaultUrlPattern,
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
|
-
};
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
} }));
|
|
75
|
-
}
|
|
76
|
-
return _jsx(_Fragment, { children: children });
|
|
77
|
-
}
|
|
22
|
+
// Re-exported for backwards compatibility — implementation lives in utils/templatePath.ts.
|
|
23
|
+
export { templateFromRegistryPath } from '../utils/templatePath.js';
|
|
24
|
+
// Re-exported for backwards compatibility — implementation lives in components/P1TemplateFields.tsx.
|
|
25
|
+
export { P1TemplateFields } from '../components/P1TemplateFields.js';
|
|
78
26
|
/**
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```tsx
|
|
85
|
-
* import { createP1Overrides, useP1Puck } from '@pantheon-systems/puck-css';
|
|
86
|
-
*
|
|
87
|
-
* function Editor() {
|
|
88
|
-
* const {
|
|
89
|
-
* saveStatus,
|
|
90
|
-
* lastSaved,
|
|
91
|
-
* saveError,
|
|
92
|
-
* saveNow,
|
|
93
|
-
* publishDocument,
|
|
94
|
-
* } = useP1Puck();
|
|
95
|
-
*
|
|
96
|
-
* // Preferred: use refs and getters for better performance
|
|
97
|
-
* const saveStatusRef = useRef(saveStatus);
|
|
98
|
-
* useEffect(() => { saveStatusRef.current = saveStatus; }, [saveStatus]);
|
|
27
|
+
* Renders an opted-in field group's label row as a disclosure. Puck hands a
|
|
28
|
+
* label override the field's content as `children`, so the group's own label
|
|
29
|
+
* becomes the toggle — there is no second header and nothing to suppress.
|
|
99
30
|
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
* getLastSaved: () => lastSavedRef.current,
|
|
103
|
-
* getSaveError: () => saveErrorRef.current,
|
|
104
|
-
* onRetrySave: saveNow,
|
|
105
|
-
* });
|
|
31
|
+
* The context is cleared for descendants so a nested group inside a collapsible
|
|
32
|
+
* one keeps its ordinary label.
|
|
106
33
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
* onRetrySave: saveNow,
|
|
113
|
-
* });
|
|
114
|
-
*
|
|
115
|
-
* return <Puck overrides={overrides} {...otherProps} />;
|
|
116
|
-
* }
|
|
117
|
-
* ```
|
|
34
|
+
* Ordinary field labels drop Puck's field-type icon. Its select variant is a
|
|
35
|
+
* chevron, the same glyph the disclosure above uses, so it reads as a group that
|
|
36
|
+
* expands and then does nothing. The label already says what the field is, and
|
|
37
|
+
* the narrow inspector would rather have the space. The read-only lock is a
|
|
38
|
+
* separate slot and survives.
|
|
118
39
|
*/
|
|
40
|
+
export function P1FieldLabel(props) {
|
|
41
|
+
const collapsible = React.useContext(CollapsibleFieldContext);
|
|
42
|
+
if (collapsible && props.el === 'div') {
|
|
43
|
+
return (_jsx(CollapsibleFieldContext.Provider, { value: null, children: _jsx(CollapsibleFieldSection, { label: props.label, defaultCollapsed: collapsible.defaultCollapsed, count: collapsible.count, children: props.children }) }));
|
|
44
|
+
}
|
|
45
|
+
return _jsx(FieldLabel, { ...props, icon: undefined });
|
|
46
|
+
}
|
|
119
47
|
export function createP1Overrides(options) {
|
|
120
48
|
const {
|
|
121
49
|
// New getter-based API (preferred)
|
|
@@ -125,7 +53,7 @@ export function createP1Overrides(options) {
|
|
|
125
53
|
// Common options
|
|
126
54
|
onRetrySave, showDefaultPublish = false,
|
|
127
55
|
// Deprecated props - kept for type signature compatibility but ignored
|
|
128
|
-
syncData: _syncData, dataSyncKey: _dataSyncKey,
|
|
56
|
+
syncData: _syncData, dataSyncKey: _dataSyncKey, onRestoreVersion: _onRestoreVersion, canRevert: _canRevert,
|
|
129
57
|
// Presence/Agent Features — NOT destructured here.
|
|
130
58
|
// These are read lazily from `options` in the headerActions render function
|
|
131
59
|
// so that the Proxy pattern from useP1Overrides provides live values.
|
|
@@ -134,6 +62,8 @@ export function createP1Overrides(options) {
|
|
|
134
62
|
// Suppress unused variable warnings for deprecated props
|
|
135
63
|
void _syncData;
|
|
136
64
|
void _dataSyncKey;
|
|
65
|
+
void _onRestoreVersion;
|
|
66
|
+
void _canRevert;
|
|
137
67
|
// Determine if using getter API or direct props API
|
|
138
68
|
const usingGetters = typeof getSaveStatus === 'function';
|
|
139
69
|
// Build props for SaveIndicator based on which API is being used
|
|
@@ -152,7 +82,21 @@ export function createP1Overrides(options) {
|
|
|
152
82
|
};
|
|
153
83
|
return {
|
|
154
84
|
actionBar: ({ label, children }) => (_jsxs(ActionBar, { label: label, children: [children, _jsx(ActionBarPinButton, {})] })),
|
|
155
|
-
fields: ({ children }) => (_jsx(
|
|
85
|
+
fields: ({ children }) => (_jsx(P1InspectorFields, { children: children })),
|
|
86
|
+
fieldLabel: P1FieldLabel,
|
|
87
|
+
fieldTypes: {
|
|
88
|
+
...fieldGuidanceFieldTypes,
|
|
89
|
+
// Marks an opted-in object field for P1FieldLabel, which owns the rendering
|
|
90
|
+
// because it is the only override that receives the label. Object fields
|
|
91
|
+
// without `metadata.collapsible` pass through untouched.
|
|
92
|
+
object: ({ field, children, }) => field.metadata?.collapsible ? (_jsx(CollapsibleFieldContext.Provider, { value: {
|
|
93
|
+
defaultCollapsed: field.metadata.defaultCollapsed,
|
|
94
|
+
// Derived from the resolved field set, so omitting a field — how
|
|
95
|
+
// role gating will hide one — moves the count with it.
|
|
96
|
+
count: Object.keys(field.objectFields ?? {}).length,
|
|
97
|
+
}, children: children })) : (_jsx(_Fragment, { children: children })),
|
|
98
|
+
},
|
|
99
|
+
outline: () => _jsx(OutlinePanel, {}),
|
|
156
100
|
headerActions: ({ children }) => {
|
|
157
101
|
// Read presence/agent values lazily from options (Proxy) each render
|
|
158
102
|
// so they reflect the latest state from useP1Overrides' optionsRef.
|
|
@@ -164,12 +108,10 @@ export function createP1Overrides(options) {
|
|
|
164
108
|
const _onStopAgent = options.onStopAgent;
|
|
165
109
|
const _showSaveIndicator = options.showSaveIndicator ?? true;
|
|
166
110
|
const _isViewingHistoricalVersion = options.isViewingHistoricalVersion ?? false;
|
|
167
|
-
const _viewingVersion = options.viewingVersion;
|
|
168
|
-
const _onReturnToLatest = options.onReturnToLatest;
|
|
169
111
|
const _publishedStatus = options.publishedStatus;
|
|
170
112
|
// Find the first active agent for banner display
|
|
171
113
|
const firstActiveAgent = _activeAgents.find(a => a.state === 'editing') || _activeAgents[0];
|
|
172
|
-
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '8px' }, children: [_showAgentActivityBanner && _isAgentEditing && firstActiveAgent && (_jsx(AgentActivityBanner, { agent: firstActiveAgent, showIdle: true, onStopAgent: _onStopAgent })), _showCollaboratorAvatars && _presence.length > 0 && (_jsx(CollaboratorAvatars, { actors: _presence, maxVisible: 5 })), _isViewingHistoricalVersion &&
|
|
114
|
+
return (_jsxs("div", { style: { display: 'flex', alignItems: 'center', gap: '8px' }, children: [_showAgentActivityBanner && _isAgentEditing && firstActiveAgent && (_jsx(AgentActivityBanner, { agent: firstActiveAgent, showIdle: true, onStopAgent: _onStopAgent })), _showCollaboratorAvatars && _presence.length > 0 && (_jsx(CollaboratorAvatars, { actors: _presence, maxVisible: 5 })), !_isViewingHistoricalVersion && (_jsxs(_Fragment, { children: [_showSaveIndicator && _jsx(SaveIndicator, { ...saveIndicatorProps }), _publishedStatus && (_jsx(PublishedStatusBadge, { status: _publishedStatus }))] })), showDefaultPublish && children] }));
|
|
173
115
|
},
|
|
174
116
|
};
|
|
175
117
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createP1Overrides.js","sourceRoot":"","sources":["../../../src/editor/plugin/createP1Overrides.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"createP1Overrides.js","sourceRoot":"","sources":["../../../src/editor/plugin/createP1Overrides.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kBAAkB,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jD,iDAAiD;YACjD,MAAM,gBAAgB,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,SAAS,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAC;YAE5F,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE,aAK9D,wBAAwB,IAAI,eAAe,IAAI,gBAAgB,IAAI,CAClE,KAAC,mBAAmB,IAAC,KAAK,EAAE,gBAAgB,EAAE,QAAQ,QAAC,WAAW,EAAE,YAAY,GAAI,CACrF,EAEA,wBAAwB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CACnD,KAAC,mBAAmB,IAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC,GAAI,CAC1D,EACA,CAAC,2BAA2B,IAAI,CAC/B,8BACG,kBAAkB,IAAI,KAAC,aAAa,OAAK,kBAAkB,GAAI,EAC/D,gBAAgB,IAAI,CACnB,KAAC,oBAAoB,IAAC,MAAM,EAAE,gBAAgB,GAAI,CACnD,IACA,CACJ,EACA,kBAAkB,IAAI,QAAQ,IAC3B,CACP,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Plugin } from "@puckeditor/core";
|
|
2
|
+
import type { PuckData } from "@pantheon-systems/css-client";
|
|
3
|
+
export interface DocumentSyncSnapshot {
|
|
4
|
+
/** Identity of the loaded document (e.g. `${branchId}:${documentId}`) */
|
|
5
|
+
syncKey: string | null;
|
|
6
|
+
data: PuckData | null;
|
|
7
|
+
}
|
|
8
|
+
export interface DocumentSyncStore {
|
|
9
|
+
publish(snapshot: DocumentSyncSnapshot): void;
|
|
10
|
+
subscribe(onChange: VoidFunction): VoidFunction;
|
|
11
|
+
getSnapshot(): DocumentSyncSnapshot;
|
|
12
|
+
/** Records which document the Puck canvas currently shows; null before the first */
|
|
13
|
+
markApplied(syncKey: string | null): void;
|
|
14
|
+
/** Sync key of the document the canvas shows, or null before the first one */
|
|
15
|
+
getAppliedKey(): string | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Sync-key format for a loaded document. Shared so the publisher
|
|
19
|
+
* (useP1Editor) and readers of the applied key (ContextSyncBridge, the
|
|
20
|
+
* write-back guard) can never disagree about what identifies a document.
|
|
21
|
+
*/
|
|
22
|
+
export declare function documentSyncKey(branchId: string | null | undefined, documentId: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Guarantee a complete PuckData shape before handing data to Puck. Puck's
|
|
25
|
+
* walkAppState reads data.root.props while rebuilding indexes, so a page whose
|
|
26
|
+
* root or content hasn't settled yet (as can happen mid document-switch) would
|
|
27
|
+
* otherwise crash with "Cannot read properties of undefined (reading 'props')".
|
|
28
|
+
* Settled data passes through by reference unchanged; a non-object (a bug
|
|
29
|
+
* upstream — data should already be parsed) collapses to a blank page rather
|
|
30
|
+
* than being spread character-by-character.
|
|
31
|
+
*/
|
|
32
|
+
export declare function normalizeSyncData(data: PuckData): PuckData;
|
|
33
|
+
export declare function createDocumentSyncStore(): DocumentSyncStore;
|
|
34
|
+
export declare function createDocumentSyncPlugin(store: DocumentSyncStore): Plugin;
|
|
35
|
+
//# sourceMappingURL=document-sync-plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-sync-plugin.d.ts","sourceRoot":"","sources":["../../../src/editor/plugin/document-sync-plugin.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,WAAW,oBAAoB;IACnC,yEAAyE;IACzE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC9C,SAAS,CAAC,QAAQ,EAAE,YAAY,GAAG,YAAY,CAAC;IAChD,WAAW,IAAI,oBAAoB,CAAC;IACpC,oFAAoF;IACpF,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAC1C,8EAA8E;IAC9E,aAAa,IAAI,MAAM,GAAG,IAAI,CAAC;CAChC;AAID;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAW1D;AAED,wBAAgB,uBAAuB,IAAI,iBAAiB,CAwB3D;AAwED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAYzE"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* Document-sync plugin
|
|
5
|
+
*
|
|
6
|
+
* Lets a single mounted <Puck> instance follow document switches instead of
|
|
7
|
+
* being remounted via a React key (which tears down the preview iframe and
|
|
8
|
+
* re-parses all canvas styles). useP1Editor publishes the freshly loaded
|
|
9
|
+
* document into a DocumentSyncStore; a headless component inside the Puck
|
|
10
|
+
* tree picks it up and replaces editor state through the history API.
|
|
11
|
+
*
|
|
12
|
+
* A single history.setHistories([{ state }]) call does everything atomically:
|
|
13
|
+
* it dispatches the new state into Puck and replaces the undo stack, so
|
|
14
|
+
* undo can never resurrect the previous document. The state passed omits
|
|
15
|
+
* `indexes` on purpose — Puck's set action only re-runs walkAppState (which
|
|
16
|
+
* rebuilds the node/zone indexes for the new content) when indexes are absent.
|
|
17
|
+
*/
|
|
18
|
+
import { useEffect, useSyncExternalStore } from "react";
|
|
19
|
+
import { useGetPuck } from "@puckeditor/core";
|
|
20
|
+
const EMPTY_SNAPSHOT = { syncKey: null, data: null };
|
|
21
|
+
/**
|
|
22
|
+
* Sync-key format for a loaded document. Shared so the publisher
|
|
23
|
+
* (useP1Editor) and readers of the applied key (ContextSyncBridge, the
|
|
24
|
+
* write-back guard) can never disagree about what identifies a document.
|
|
25
|
+
*/
|
|
26
|
+
export function documentSyncKey(branchId, documentId) {
|
|
27
|
+
return `${branchId ?? ""}:${documentId}`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Guarantee a complete PuckData shape before handing data to Puck. Puck's
|
|
31
|
+
* walkAppState reads data.root.props while rebuilding indexes, so a page whose
|
|
32
|
+
* root or content hasn't settled yet (as can happen mid document-switch) would
|
|
33
|
+
* otherwise crash with "Cannot read properties of undefined (reading 'props')".
|
|
34
|
+
* Settled data passes through by reference unchanged; a non-object (a bug
|
|
35
|
+
* upstream — data should already be parsed) collapses to a blank page rather
|
|
36
|
+
* than being spread character-by-character.
|
|
37
|
+
*/
|
|
38
|
+
export function normalizeSyncData(data) {
|
|
39
|
+
if (!data || typeof data !== "object" || Array.isArray(data)) {
|
|
40
|
+
return { content: [], root: { props: {} } };
|
|
41
|
+
}
|
|
42
|
+
if (data.content && data.root?.props)
|
|
43
|
+
return data;
|
|
44
|
+
const root = data.root ?? { props: {} };
|
|
45
|
+
return {
|
|
46
|
+
...data,
|
|
47
|
+
content: data.content ?? [],
|
|
48
|
+
root: { ...root, props: root.props ?? {} },
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export function createDocumentSyncStore() {
|
|
52
|
+
let snapshot = EMPTY_SNAPSHOT;
|
|
53
|
+
let appliedKey = null;
|
|
54
|
+
const listeners = new Set();
|
|
55
|
+
return {
|
|
56
|
+
publish(next) {
|
|
57
|
+
snapshot = next;
|
|
58
|
+
for (const listener of listeners)
|
|
59
|
+
listener();
|
|
60
|
+
},
|
|
61
|
+
subscribe(onChange) {
|
|
62
|
+
listeners.add(onChange);
|
|
63
|
+
return () => listeners.delete(onChange);
|
|
64
|
+
},
|
|
65
|
+
getSnapshot() {
|
|
66
|
+
return snapshot;
|
|
67
|
+
},
|
|
68
|
+
markApplied(syncKey) {
|
|
69
|
+
appliedKey = syncKey;
|
|
70
|
+
},
|
|
71
|
+
getAppliedKey() {
|
|
72
|
+
return appliedKey;
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function DocumentSync({ store }) {
|
|
77
|
+
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
|
|
78
|
+
// Puck state is read imperatively at push time rather than subscribed to —
|
|
79
|
+
// subscribing to appState would re-run this component on every keystroke.
|
|
80
|
+
const getPuck = useGetPuck();
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const { syncKey, data } = snapshot;
|
|
83
|
+
if (!syncKey || !data)
|
|
84
|
+
return;
|
|
85
|
+
const appliedKey = store.getAppliedKey();
|
|
86
|
+
if (appliedKey === syncKey)
|
|
87
|
+
return;
|
|
88
|
+
if (appliedKey === null) {
|
|
89
|
+
// First document observed: Puck was mounted with it, nothing to push.
|
|
90
|
+
store.markApplied(syncKey);
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const { appState, history } = getPuck();
|
|
94
|
+
// Omit indexes so Puck re-runs walkAppState for the new content.
|
|
95
|
+
const { indexes: _indexes, ...rest } = appState;
|
|
96
|
+
// Marked before dispatching, and rolled back if the dispatch fails. Puck's
|
|
97
|
+
// onChange is a store subscriber, so it fires synchronously inside
|
|
98
|
+
// setHistories: the echo has to find the new document already applied, or
|
|
99
|
+
// useP1Editor's write-back guard reports a race on every switch. A failed
|
|
100
|
+
// dispatch must not leave the key advanced either — the canvas would still
|
|
101
|
+
// hold the old document and the guard would wave through a save that writes
|
|
102
|
+
// it into the new one.
|
|
103
|
+
store.markApplied(syncKey);
|
|
104
|
+
try {
|
|
105
|
+
history.setHistories([
|
|
106
|
+
{
|
|
107
|
+
state: {
|
|
108
|
+
...rest,
|
|
109
|
+
data: normalizeSyncData(data),
|
|
110
|
+
ui: { ...rest.ui, itemSelector: null },
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
]);
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
store.markApplied(appliedKey);
|
|
117
|
+
throw err;
|
|
118
|
+
}
|
|
119
|
+
}, [snapshot, getPuck, store]);
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
export function createDocumentSyncPlugin(store) {
|
|
123
|
+
return {
|
|
124
|
+
name: "p1-document-sync",
|
|
125
|
+
overrides: {
|
|
126
|
+
puck: ({ children }) => (_jsxs(_Fragment, { children: [_jsx(DocumentSync, { store: store }), children] })),
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=document-sync-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-sync-plugin.js","sourceRoot":"","sources":["../../../src/editor/plugin/document-sync-plugin.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb;;;;;;;;;;;;;;GAcG;AAEH,OAAc,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAoB9C,MAAM,cAAc,GAAyB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAE3E;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,QAAmC,EACnC,UAAkB;IAElB,OAAO,GAAG,QAAQ,IAAI,EAAE,IAAI,UAAU,EAAE,CAAC;AAC3C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAc;IAC9C,IAAI,CAAC,IAAI,IAAI,OA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