@wordpress/core-data 7.52.0 → 7.53.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/CHANGELOG.md +16 -0
- package/README.md +1 -0
- package/build/actions.cjs +18 -9
- package/build/actions.cjs.map +2 -2
- package/build/awareness/awareness-state.cjs.map +2 -2
- package/build/awareness/base-awareness.cjs.map +2 -2
- package/build/awareness/block-lookup.cjs.map +2 -2
- package/build/awareness/post-editor-awareness.cjs +7 -0
- package/build/awareness/post-editor-awareness.cjs.map +2 -2
- package/build/awareness/typed-awareness.cjs.map +2 -2
- package/build/awareness/types.cjs.map +1 -1
- package/build/awareness/utils.cjs.map +2 -2
- package/build/batch/create-batch.cjs.map +2 -2
- package/build/batch/default-processor.cjs.map +2 -2
- package/build/components/entities-saved-states/entity-record-item.cjs.map +2 -2
- package/build/components/entities-saved-states/entity-type-list.cjs.map +2 -2
- package/build/components/entities-saved-states/hooks/use-is-dirty.cjs +4 -0
- package/build/components/entities-saved-states/hooks/use-is-dirty.cjs.map +2 -2
- package/build/components/entities-saved-states/index.cjs.map +2 -2
- package/build/dynamic-entities.cjs.map +2 -2
- package/build/entities.cjs.map +2 -2
- package/build/entity-context.cjs.map +2 -2
- package/build/entity-provider.cjs.map +2 -2
- package/build/entity-types/attachment.cjs.map +1 -1
- package/build/entity-types/base.cjs.map +1 -1
- package/build/entity-types/comment.cjs.map +1 -1
- package/build/entity-types/font-collection.cjs.map +1 -1
- package/build/entity-types/font-family.cjs.map +1 -1
- package/build/entity-types/global-styles-revision.cjs.map +1 -1
- package/build/entity-types/helpers.cjs.map +1 -1
- package/build/entity-types/icon.cjs.map +1 -1
- package/build/entity-types/index.cjs.map +1 -1
- package/build/entity-types/menu-location.cjs.map +1 -1
- package/build/entity-types/nav-menu-item.cjs.map +1 -1
- package/build/entity-types/nav-menu.cjs.map +1 -1
- package/build/entity-types/page.cjs.map +1 -1
- package/build/entity-types/plugin.cjs.map +1 -1
- package/build/entity-types/post-revision.cjs.map +1 -1
- package/build/entity-types/post-status.cjs.map +1 -1
- package/build/entity-types/post.cjs.map +1 -1
- package/build/entity-types/settings.cjs.map +1 -1
- package/build/entity-types/sidebar.cjs.map +1 -1
- package/build/entity-types/taxonomy.cjs.map +1 -1
- package/build/entity-types/term.cjs.map +1 -1
- package/build/entity-types/theme.cjs.map +1 -1
- package/build/entity-types/type.cjs.map +1 -1
- package/build/entity-types/user.cjs.map +1 -1
- package/build/entity-types/widget-type.cjs.map +1 -1
- package/build/entity-types/widget.cjs.map +1 -1
- package/build/entity-types/wp-template-part.cjs.map +1 -1
- package/build/entity-types/wp-template.cjs.map +1 -1
- package/build/fetch/__experimental-fetch-link-suggestions.cjs.map +2 -2
- package/build/fetch/__experimental-fetch-url-data.cjs.map +2 -2
- package/build/fetch/index.cjs.map +2 -2
- package/build/footnotes/get-footnotes-order.cjs.map +2 -2
- package/build/footnotes/get-rich-text-values-cached.cjs.map +2 -2
- package/build/footnotes/index.cjs +12 -1
- package/build/footnotes/index.cjs.map +3 -3
- package/build/hooks/index.cjs.map +2 -2
- package/build/hooks/use-entity-block-editor.cjs.map +2 -2
- package/build/hooks/use-entity-id.cjs.map +2 -2
- package/build/hooks/use-entity-prop.cjs.map +2 -2
- package/build/hooks/use-entity-record.cjs.map +2 -2
- package/build/hooks/use-entity-records.cjs +2 -2
- package/build/hooks/use-entity-records.cjs.map +2 -2
- package/build/hooks/use-post-editor-awareness-state.cjs.map +2 -2
- package/build/hooks/use-query-select.cjs.map +2 -2
- package/build/hooks/use-resource-permissions.cjs.map +2 -2
- package/build/hooks/utils.cjs.map +2 -2
- package/build/index.cjs.map +2 -2
- package/build/lock-unlock.cjs.map +2 -2
- package/build/locks/actions.cjs.map +2 -2
- package/build/locks/engine.cjs.map +2 -2
- package/build/locks/reducer.cjs.map +2 -2
- package/build/locks/selectors.cjs.map +2 -2
- package/build/private-actions.cjs +54 -7
- package/build/private-actions.cjs.map +2 -2
- package/build/private-apis.cjs +3 -0
- package/build/private-apis.cjs.map +2 -2
- package/build/private-selectors.cjs +5 -0
- package/build/private-selectors.cjs.map +2 -2
- package/build/queried-data/get-query-parts.cjs.map +2 -2
- package/build/queried-data/reducer.cjs.map +2 -2
- package/build/queried-data/selectors.cjs.map +2 -2
- package/build/reducer.cjs.map +2 -2
- package/build/resolvers.cjs +21 -26
- package/build/resolvers.cjs.map +2 -2
- package/build/selectors.cjs.map +2 -2
- package/build/sync.cjs +26 -0
- package/build/sync.cjs.map +2 -2
- package/build/types.cjs.map +1 -1
- package/build/utils/block-selection-history.cjs.map +2 -2
- package/build/utils/clear-unchanged-edits.cjs.map +2 -2
- package/build/utils/conservative-map-item.cjs.map +2 -2
- package/build/utils/crdt-blocks.cjs.map +2 -2
- package/build/utils/crdt-selection.cjs.map +2 -2
- package/build/utils/crdt-text.cjs.map +2 -2
- package/build/utils/crdt-user-selections.cjs +43 -16
- package/build/utils/crdt-user-selections.cjs.map +3 -3
- package/build/utils/crdt-utils.cjs.map +2 -2
- package/build/utils/crdt.cjs.map +2 -2
- package/build/utils/get-template-info.cjs.map +2 -2
- package/build/utils/get-template-part-icon.cjs.map +2 -2
- package/build/utils/log-entity-deprecation.cjs.map +2 -2
- package/build/utils/save-crdt-doc.cjs.map +2 -2
- package/build-module/actions.mjs +19 -9
- package/build-module/actions.mjs.map +2 -2
- package/build-module/awareness/awareness-state.mjs.map +2 -2
- package/build-module/awareness/base-awareness.mjs.map +2 -2
- package/build-module/awareness/block-lookup.mjs.map +2 -2
- package/build-module/awareness/post-editor-awareness.mjs +7 -0
- package/build-module/awareness/post-editor-awareness.mjs.map +2 -2
- package/build-module/awareness/typed-awareness.mjs.map +2 -2
- package/build-module/awareness/utils.mjs.map +2 -2
- package/build-module/batch/create-batch.mjs.map +2 -2
- package/build-module/batch/default-processor.mjs.map +2 -2
- package/build-module/components/entities-saved-states/entity-record-item.mjs.map +2 -2
- package/build-module/components/entities-saved-states/entity-type-list.mjs.map +2 -2
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.mjs +4 -0
- package/build-module/components/entities-saved-states/hooks/use-is-dirty.mjs.map +2 -2
- package/build-module/components/entities-saved-states/index.mjs.map +2 -2
- package/build-module/dynamic-entities.mjs.map +2 -2
- package/build-module/entities.mjs.map +2 -2
- package/build-module/entity-context.mjs.map +2 -2
- package/build-module/entity-provider.mjs.map +2 -2
- package/build-module/fetch/__experimental-fetch-link-suggestions.mjs.map +2 -2
- package/build-module/fetch/__experimental-fetch-url-data.mjs.map +2 -2
- package/build-module/fetch/index.mjs.map +2 -2
- package/build-module/footnotes/get-footnotes-order.mjs.map +2 -2
- package/build-module/footnotes/get-rich-text-values-cached.mjs.map +2 -2
- package/build-module/footnotes/index.mjs +12 -1
- package/build-module/footnotes/index.mjs.map +2 -2
- package/build-module/hooks/index.mjs.map +2 -2
- package/build-module/hooks/use-entity-block-editor.mjs.map +2 -2
- package/build-module/hooks/use-entity-id.mjs.map +2 -2
- package/build-module/hooks/use-entity-prop.mjs.map +2 -2
- package/build-module/hooks/use-entity-record.mjs.map +2 -2
- package/build-module/hooks/use-entity-records.mjs +2 -2
- package/build-module/hooks/use-entity-records.mjs.map +2 -2
- package/build-module/hooks/use-post-editor-awareness-state.mjs.map +2 -2
- package/build-module/hooks/use-query-select.mjs.map +2 -2
- package/build-module/hooks/use-resource-permissions.mjs.map +2 -2
- package/build-module/hooks/utils.mjs.map +2 -2
- package/build-module/index.mjs.map +2 -2
- package/build-module/lock-unlock.mjs.map +2 -2
- package/build-module/locks/actions.mjs.map +2 -2
- package/build-module/locks/engine.mjs.map +2 -2
- package/build-module/locks/reducer.mjs.map +2 -2
- package/build-module/locks/selectors.mjs.map +2 -2
- package/build-module/private-actions.mjs +54 -7
- package/build-module/private-actions.mjs.map +2 -2
- package/build-module/private-apis.mjs +9 -1
- package/build-module/private-apis.mjs.map +2 -2
- package/build-module/private-selectors.mjs +4 -0
- package/build-module/private-selectors.mjs.map +2 -2
- package/build-module/queried-data/get-query-parts.mjs.map +2 -2
- package/build-module/queried-data/reducer.mjs.map +2 -2
- package/build-module/queried-data/selectors.mjs.map +2 -2
- package/build-module/reducer.mjs.map +2 -2
- package/build-module/resolvers.mjs +21 -26
- package/build-module/resolvers.mjs.map +2 -2
- package/build-module/selectors.mjs.map +2 -2
- package/build-module/sync.mjs +23 -0
- package/build-module/sync.mjs.map +2 -2
- package/build-module/utils/block-selection-history.mjs.map +2 -2
- package/build-module/utils/clear-unchanged-edits.mjs.map +2 -2
- package/build-module/utils/conservative-map-item.mjs.map +2 -2
- package/build-module/utils/crdt-blocks.mjs.map +2 -2
- package/build-module/utils/crdt-selection.mjs.map +2 -2
- package/build-module/utils/crdt-text.mjs.map +2 -2
- package/build-module/utils/crdt-user-selections.mjs +43 -16
- package/build-module/utils/crdt-user-selections.mjs.map +3 -3
- package/build-module/utils/crdt-utils.mjs.map +2 -2
- package/build-module/utils/crdt.mjs.map +2 -2
- package/build-module/utils/get-template-info.mjs.map +2 -2
- package/build-module/utils/get-template-part-icon.mjs.map +2 -2
- package/build-module/utils/log-entity-deprecation.mjs.map +2 -2
- package/build-module/utils/save-crdt-doc.mjs.map +2 -2
- package/build-types/actions.d.ts +4 -0
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/awareness/awareness-state.d.ts.map +1 -1
- package/build-types/awareness/base-awareness.d.ts +0 -3
- package/build-types/awareness/base-awareness.d.ts.map +1 -1
- package/build-types/awareness/block-lookup.d.ts +0 -3
- package/build-types/awareness/block-lookup.d.ts.map +1 -1
- package/build-types/awareness/post-editor-awareness.d.ts +0 -3
- package/build-types/awareness/post-editor-awareness.d.ts.map +1 -1
- package/build-types/awareness/typed-awareness.d.ts +0 -3
- package/build-types/awareness/typed-awareness.d.ts.map +1 -1
- package/build-types/awareness/types.d.ts +0 -6
- package/build-types/awareness/types.d.ts.map +1 -1
- package/build-types/awareness/utils.d.ts +0 -3
- package/build-types/awareness/utils.d.ts.map +1 -1
- package/build-types/batch/create-batch.d.ts.map +1 -1
- package/build-types/batch/default-processor.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/entity-record-item.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/entity-type-list.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/hooks/use-is-dirty.d.ts.map +1 -1
- package/build-types/components/entities-saved-states/index.d.ts.map +1 -1
- package/build-types/dynamic-entities.d.ts +0 -3
- package/build-types/dynamic-entities.d.ts.map +1 -1
- package/build-types/entities.d.ts.map +1 -1
- package/build-types/entity-context.d.ts.map +1 -1
- package/build-types/entity-provider.d.ts.map +1 -1
- package/build-types/entity-types/attachment.d.ts +0 -3
- package/build-types/entity-types/attachment.d.ts.map +1 -1
- package/build-types/entity-types/base.d.ts +0 -3
- package/build-types/entity-types/base.d.ts.map +1 -1
- package/build-types/entity-types/comment.d.ts +0 -3
- package/build-types/entity-types/comment.d.ts.map +1 -1
- package/build-types/entity-types/font-collection.d.ts +0 -3
- package/build-types/entity-types/font-collection.d.ts.map +1 -1
- package/build-types/entity-types/font-family.d.ts +0 -3
- package/build-types/entity-types/font-family.d.ts.map +1 -1
- package/build-types/entity-types/global-styles-revision.d.ts +0 -3
- package/build-types/entity-types/global-styles-revision.d.ts.map +1 -1
- package/build-types/entity-types/helpers.d.ts +0 -3
- package/build-types/entity-types/helpers.d.ts.map +1 -1
- package/build-types/entity-types/icon.d.ts +0 -3
- package/build-types/entity-types/icon.d.ts.map +1 -1
- package/build-types/entity-types/index.d.ts +0 -3
- package/build-types/entity-types/index.d.ts.map +1 -1
- package/build-types/entity-types/menu-location.d.ts +0 -3
- package/build-types/entity-types/menu-location.d.ts.map +1 -1
- package/build-types/entity-types/nav-menu-item.d.ts +0 -3
- package/build-types/entity-types/nav-menu-item.d.ts.map +1 -1
- package/build-types/entity-types/nav-menu.d.ts +0 -3
- package/build-types/entity-types/nav-menu.d.ts.map +1 -1
- package/build-types/entity-types/page.d.ts +0 -3
- package/build-types/entity-types/page.d.ts.map +1 -1
- package/build-types/entity-types/plugin.d.ts +0 -3
- package/build-types/entity-types/plugin.d.ts.map +1 -1
- package/build-types/entity-types/post-revision.d.ts +0 -3
- package/build-types/entity-types/post-revision.d.ts.map +1 -1
- package/build-types/entity-types/post-status.d.ts +0 -3
- package/build-types/entity-types/post-status.d.ts.map +1 -1
- package/build-types/entity-types/post.d.ts +0 -3
- package/build-types/entity-types/post.d.ts.map +1 -1
- package/build-types/entity-types/settings.d.ts +0 -3
- package/build-types/entity-types/settings.d.ts.map +1 -1
- package/build-types/entity-types/sidebar.d.ts +0 -3
- package/build-types/entity-types/sidebar.d.ts.map +1 -1
- package/build-types/entity-types/taxonomy.d.ts +0 -3
- package/build-types/entity-types/taxonomy.d.ts.map +1 -1
- package/build-types/entity-types/term.d.ts +0 -3
- package/build-types/entity-types/term.d.ts.map +1 -1
- package/build-types/entity-types/test/attachment.test.d.ts +0 -8
- package/build-types/entity-types/test/attachment.test.d.ts.map +1 -1
- package/build-types/entity-types/theme.d.ts +0 -3
- package/build-types/entity-types/theme.d.ts.map +1 -1
- package/build-types/entity-types/type.d.ts +0 -3
- package/build-types/entity-types/type.d.ts.map +1 -1
- package/build-types/entity-types/user.d.ts +0 -3
- package/build-types/entity-types/user.d.ts.map +1 -1
- package/build-types/entity-types/widget-type.d.ts +0 -3
- package/build-types/entity-types/widget-type.d.ts.map +1 -1
- package/build-types/entity-types/widget.d.ts +0 -3
- package/build-types/entity-types/widget.d.ts.map +1 -1
- package/build-types/entity-types/wp-template-part.d.ts +0 -3
- package/build-types/entity-types/wp-template-part.d.ts.map +1 -1
- package/build-types/entity-types/wp-template.d.ts +0 -3
- package/build-types/entity-types/wp-template.d.ts.map +1 -1
- package/build-types/fetch/__experimental-fetch-link-suggestions.d.ts.map +1 -1
- package/build-types/fetch/__experimental-fetch-url-data.d.ts.map +1 -1
- package/build-types/fetch/index.d.ts.map +1 -1
- package/build-types/footnotes/get-footnotes-order.d.ts.map +1 -1
- package/build-types/footnotes/get-rich-text-values-cached.d.ts.map +1 -1
- package/build-types/footnotes/index.d.ts.map +1 -1
- package/build-types/hooks/index.d.ts +0 -3
- package/build-types/hooks/index.d.ts.map +1 -1
- package/build-types/hooks/use-entity-block-editor.d.ts.map +1 -1
- package/build-types/hooks/use-entity-id.d.ts.map +1 -1
- package/build-types/hooks/use-entity-prop.d.ts.map +1 -1
- package/build-types/hooks/use-entity-record.d.ts.map +1 -1
- package/build-types/hooks/use-entity-records.d.ts.map +1 -1
- package/build-types/hooks/use-post-editor-awareness-state.d.ts.map +1 -1
- package/build-types/hooks/use-query-select.d.ts.map +1 -1
- package/build-types/hooks/use-resource-permissions.d.ts.map +1 -1
- package/build-types/hooks/utils.d.ts +0 -6
- package/build-types/hooks/utils.d.ts.map +1 -1
- package/build-types/index.d.ts +1 -0
- package/build-types/index.d.ts.map +1 -1
- package/build-types/lock-unlock.d.ts.map +1 -1
- package/build-types/locks/actions.d.ts.map +1 -1
- package/build-types/locks/engine.d.ts.map +1 -1
- package/build-types/locks/reducer.d.ts.map +1 -1
- package/build-types/locks/selectors.d.ts.map +1 -1
- package/build-types/private-actions.d.ts +1 -1
- package/build-types/private-actions.d.ts.map +1 -1
- package/build-types/private-apis.d.ts +4 -3
- package/build-types/private-apis.d.ts.map +1 -1
- package/build-types/private-selectors.d.ts +12 -3
- package/build-types/private-selectors.d.ts.map +1 -1
- package/build-types/queried-data/get-query-parts.d.ts.map +1 -1
- package/build-types/queried-data/reducer.d.ts.map +1 -1
- package/build-types/queried-data/selectors.d.ts.map +1 -1
- package/build-types/reducer.d.ts.map +1 -1
- package/build-types/resolvers.d.ts +1 -2
- package/build-types/resolvers.d.ts.map +1 -1
- package/build-types/selectors.d.ts.map +1 -1
- package/build-types/sync.d.ts +31 -3
- package/build-types/sync.d.ts.map +1 -1
- package/build-types/types.d.ts +9 -8
- package/build-types/types.d.ts.map +1 -1
- package/build-types/utils/block-selection-history.d.ts +0 -6
- package/build-types/utils/block-selection-history.d.ts.map +1 -1
- package/build-types/utils/clear-unchanged-edits.d.ts.map +1 -1
- package/build-types/utils/conservative-map-item.d.ts.map +1 -1
- package/build-types/utils/crdt-blocks.d.ts +0 -3
- package/build-types/utils/crdt-blocks.d.ts.map +1 -1
- package/build-types/utils/crdt-selection.d.ts +0 -3
- package/build-types/utils/crdt-selection.d.ts.map +1 -1
- package/build-types/utils/crdt-text.d.ts +0 -3
- package/build-types/utils/crdt-text.d.ts.map +1 -1
- package/build-types/utils/crdt-user-selections.d.ts.map +1 -1
- package/build-types/utils/crdt-utils.d.ts +0 -6
- package/build-types/utils/crdt-utils.d.ts.map +1 -1
- package/build-types/utils/crdt.d.ts.map +1 -1
- package/build-types/utils/get-template-info.d.ts.map +1 -1
- package/build-types/utils/get-template-part-icon.d.ts.map +1 -1
- package/build-types/utils/log-entity-deprecation.d.ts.map +1 -1
- package/build-types/utils/save-crdt-doc.d.ts.map +1 -1
- package/package.json +24 -23
- package/src/actions.js +45 -29
- package/src/awareness/awareness-state.ts +0 -3
- package/src/awareness/base-awareness.ts +0 -8
- package/src/awareness/block-lookup.ts +1 -8
- package/src/awareness/post-editor-awareness.ts +13 -10
- package/src/awareness/test/awareness-state.ts +0 -11
- package/src/awareness/test/base-awareness.ts +0 -7
- package/src/awareness/test/block-lookup.ts +0 -8
- package/src/awareness/test/post-editor-awareness.ts +0 -7
- package/src/awareness/test/typed-awareness.ts +0 -11
- package/src/awareness/test/utils.ts +0 -3
- package/src/awareness/typed-awareness.ts +0 -7
- package/src/awareness/types.ts +0 -7
- package/src/awareness/utils.ts +0 -3
- package/src/batch/create-batch.js +0 -3
- package/src/batch/default-processor.js +0 -4
- package/src/batch/test/create-batch.js +0 -3
- package/src/batch/test/default-processor.js +0 -7
- package/src/components/entities-saved-states/entity-record-item.js +0 -7
- package/src/components/entities-saved-states/entity-type-list.js +0 -7
- package/src/components/entities-saved-states/hooks/use-is-dirty.js +4 -7
- package/src/components/entities-saved-states/index.js +0 -11
- package/src/components/entities-saved-states/test/use-is-dirty.js +70 -11
- package/src/dynamic-entities.ts +0 -3
- package/src/entities.js +0 -11
- package/src/entity-context.js +0 -3
- package/src/entity-provider.js +0 -7
- package/src/entity-types/attachment.ts +0 -4
- package/src/entity-types/base.ts +0 -3
- package/src/entity-types/comment.ts +0 -3
- package/src/entity-types/font-collection.ts +0 -3
- package/src/entity-types/font-family.ts +0 -3
- package/src/entity-types/global-styles-revision.ts +0 -4
- package/src/entity-types/helpers.ts +0 -3
- package/src/entity-types/icon.ts +0 -4
- package/src/entity-types/index.ts +0 -3
- package/src/entity-types/menu-location.ts +0 -4
- package/src/entity-types/nav-menu-item.ts +0 -4
- package/src/entity-types/nav-menu.ts +0 -4
- package/src/entity-types/page.ts +0 -4
- package/src/entity-types/plugin.ts +0 -4
- package/src/entity-types/post-revision.ts +0 -4
- package/src/entity-types/post-status.ts +0 -3
- package/src/entity-types/post.ts +0 -4
- package/src/entity-types/settings.ts +0 -4
- package/src/entity-types/sidebar.ts +0 -4
- package/src/entity-types/taxonomy.ts +0 -4
- package/src/entity-types/term.ts +0 -4
- package/src/entity-types/test/attachment.test.ts +0 -4
- package/src/entity-types/theme.ts +0 -4
- package/src/entity-types/type.ts +0 -4
- package/src/entity-types/user.ts +0 -4
- package/src/entity-types/widget-type.ts +0 -4
- package/src/entity-types/widget.ts +0 -4
- package/src/entity-types/wp-template-part.ts +0 -4
- package/src/entity-types/wp-template.ts +0 -4
- package/src/fetch/__experimental-fetch-link-suggestions.ts +0 -3
- package/src/fetch/__experimental-fetch-url-data.js +0 -3
- package/src/fetch/index.js +0 -7
- package/src/fetch/test/__experimental-fetch-link-suggestions.js +0 -3
- package/src/fetch/test/__experimental-fetch-url-data.js +1 -7
- package/src/footnotes/get-footnotes-order.js +0 -3
- package/src/footnotes/get-rich-text-values-cached.js +0 -7
- package/src/footnotes/index.js +21 -8
- package/src/footnotes/test/index.js +57 -0
- package/src/hooks/index.ts +0 -3
- package/src/hooks/test/use-entity-record.js +0 -12
- package/src/hooks/test/use-entity-records.js +0 -12
- package/src/hooks/test/use-post-editor-awareness-state.ts +0 -7
- package/src/hooks/test/use-query-select.js +0 -11
- package/src/hooks/test/use-resource-permissions.js +0 -12
- package/src/hooks/use-entity-block-editor.js +0 -7
- package/src/hooks/use-entity-id.js +0 -7
- package/src/hooks/use-entity-prop.js +0 -7
- package/src/hooks/use-entity-record.ts +0 -7
- package/src/hooks/use-entity-records.ts +2 -9
- package/src/hooks/use-post-editor-awareness-state.ts +0 -7
- package/src/hooks/use-query-select.ts +0 -7
- package/src/hooks/use-resource-permissions.ts +0 -7
- package/src/hooks/utils.ts +0 -7
- package/src/index.js +0 -7
- package/src/lock-unlock.ts +0 -3
- package/src/locks/actions.js +0 -3
- package/src/locks/engine.js +0 -3
- package/src/locks/reducer.js +0 -3
- package/src/locks/selectors.js +0 -3
- package/src/locks/test/engine.js +0 -3
- package/src/locks/test/reducer.js +0 -7
- package/src/locks/test/selectors.js +0 -7
- package/src/locks/test/utils.js +0 -7
- package/src/private-actions.js +63 -15
- package/src/private-apis.ts +9 -4
- package/src/private-selectors.ts +22 -7
- package/src/queried-data/get-query-parts.js +0 -7
- package/src/queried-data/reducer.js +0 -7
- package/src/queried-data/selectors.js +0 -7
- package/src/queried-data/test/actions.js +0 -3
- package/src/queried-data/test/get-query-parts.js +0 -3
- package/src/queried-data/test/reducer.js +0 -7
- package/src/queried-data/test/selectors.js +0 -3
- package/src/reducer.js +0 -11
- package/src/resolvers.js +23 -40
- package/src/selectors.ts +0 -7
- package/src/sync.ts +64 -7
- package/src/test/actions.js +256 -8
- package/src/test/deprecated-entity-logging.js +0 -7
- package/src/test/entities.js +0 -8
- package/src/test/entity-provider.js +0 -11
- package/src/test/private-actions.js +297 -7
- package/src/test/private-selectors.js +0 -3
- package/src/test/reducer.js +0 -7
- package/src/test/resolvers.js +0 -12
- package/src/test/rtc-rich-text-offset-space.test.js +0 -12
- package/src/test/selectors.js +0 -7
- package/src/test/store.js +8 -15
- package/src/types.ts +14 -12
- package/src/utils/block-selection-history.ts +0 -10
- package/src/utils/clear-unchanged-edits.ts +0 -3
- package/src/utils/conservative-map-item.js +0 -3
- package/src/utils/crdt-blocks.ts +0 -11
- package/src/utils/crdt-selection.ts +0 -7
- package/src/utils/crdt-text.ts +0 -3
- package/src/utils/crdt-user-selections.ts +85 -23
- package/src/utils/crdt-utils.ts +0 -7
- package/src/utils/crdt.ts +0 -11
- package/src/utils/get-template-info.js +0 -6
- package/src/utils/get-template-part-icon.js +0 -3
- package/src/utils/log-entity-deprecation.ts +0 -7
- package/src/utils/save-crdt-doc.js +0 -7
- package/src/utils/test/block-selection-history.test.ts +0 -7
- package/src/utils/test/clear-unchanged-edits.js +0 -3
- package/src/utils/test/conservative-map-item.js +0 -3
- package/src/utils/test/crdt-blocks.ts +0 -17
- package/src/utils/test/crdt-user-selections.ts +107 -30
- package/src/utils/test/crdt-utils.ts +0 -7
- package/src/utils/test/crdt.ts +0 -16
- package/src/utils/test/get-nested-value.js +0 -3
- package/src/utils/test/get-normalized-comma-separable.js +0 -3
- package/src/utils/test/get-template-info.js +0 -6
- package/src/utils/test/if-matching-action.js +0 -7
- package/src/utils/test/is-numeric-id.js +0 -3
- package/src/utils/test/log-entity-deprecation.js +0 -7
- package/src/utils/test/replace-action.js +0 -3
- package/src/utils/test/rtc-rich-text-cursor-scope.test.js +0 -14
- package/src/utils/test/rtc-rich-text-offset-space.test.js +0 -14
- package/src/utils/test/save-crdt-doc.js +0 -7
- package/src/utils/test/set-nested-value.js +0 -3
- package/src/utils/test/with-weak-map-cache.js +0 -3
- package/build-types/utils/on-sub-key.d.ts +0 -4
- package/build-types/utils/on-sub-key.d.ts.map +0 -1
package/src/actions.js
CHANGED
|
@@ -1,25 +1,15 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import fastDeepEqual from 'fast-deep-equal/es6/index.js';
|
|
5
2
|
import { v4 as uuid } from 'uuid';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* WordPress dependencies
|
|
9
|
-
*/
|
|
10
3
|
import apiFetch from '@wordpress/api-fetch';
|
|
11
4
|
import { addQueryArgs } from '@wordpress/url';
|
|
12
5
|
import deprecated from '@wordpress/deprecated';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Internal dependencies
|
|
16
|
-
*/
|
|
17
6
|
import { clearUnchangedEdits, getNestedValue, setNestedValue } from './utils';
|
|
18
7
|
import { receiveItems, removeItems, receiveQueriedItems } from './queried-data';
|
|
19
8
|
import { DEFAULT_ENTITY_KEY } from './entities';
|
|
20
9
|
import { createBatch } from './batch';
|
|
21
10
|
import { STORE_NAME } from './name';
|
|
22
11
|
import {
|
|
12
|
+
CRDT_AUTOSAVE_SNAPSHOT_KEY,
|
|
23
13
|
LOCAL_EDITOR_ORIGIN,
|
|
24
14
|
LOCAL_UNDO_IGNORED_ORIGIN,
|
|
25
15
|
getSyncManager,
|
|
@@ -444,6 +434,9 @@ export const deleteEntityRecord =
|
|
|
444
434
|
* @param {Object} edits The edits.
|
|
445
435
|
* @param {Object} options Options for the edit.
|
|
446
436
|
* @param {boolean} [options.undoIgnore] Whether to ignore the edit in undo history or not.
|
|
437
|
+
* @param {boolean} [options.isCached] Whether the edit is transient (e.g. typing). Transient
|
|
438
|
+
* edits are staged and eventually merged into the
|
|
439
|
+
* preceding undo level instead of creating a new one.
|
|
447
440
|
*
|
|
448
441
|
* @return {Object} Action object.
|
|
449
442
|
*/
|
|
@@ -729,6 +722,25 @@ export const saveEntityRecord =
|
|
|
729
722
|
? select.getRawEntityRecord( kind, name, recordId )
|
|
730
723
|
: {};
|
|
731
724
|
|
|
725
|
+
// `saveEntityRecord` can be called directly, bypassing
|
|
726
|
+
// `editEntityRecord`, so make sure its changes enter the
|
|
727
|
+
// CRDT first. An autosave snapshots the document below, and
|
|
728
|
+
// a regular save creates the persisted document from it, so
|
|
729
|
+
// both must see these changes.
|
|
730
|
+
if (
|
|
731
|
+
entityConfig.syncConfig &&
|
|
732
|
+
! __unstableSkipSyncUpdate &&
|
|
733
|
+
! isNewRecord &&
|
|
734
|
+
persistedRecord
|
|
735
|
+
) {
|
|
736
|
+
getSyncManager()?.update(
|
|
737
|
+
`${ kind }/${ name }`,
|
|
738
|
+
recordId,
|
|
739
|
+
record,
|
|
740
|
+
LOCAL_UNDO_IGNORED_ORIGIN
|
|
741
|
+
);
|
|
742
|
+
}
|
|
743
|
+
|
|
732
744
|
// Most of this autosave logic is very specific to posts.
|
|
733
745
|
// This is fine for now as it is the only supported autosave,
|
|
734
746
|
// but ideally this should all be handled in the back end,
|
|
@@ -762,6 +774,21 @@ export const saveEntityRecord =
|
|
|
762
774
|
: undefined,
|
|
763
775
|
}
|
|
764
776
|
);
|
|
777
|
+
// Capture the CRDT snapshot in the same tick as the
|
|
778
|
+
// payload so it describes exactly the content being
|
|
779
|
+
// autosaved.
|
|
780
|
+
if ( entityConfig.syncConfig ) {
|
|
781
|
+
const crdtSnapshot =
|
|
782
|
+
getSyncManager()?.getEntitySnapshot(
|
|
783
|
+
`${ kind }/${ name }`,
|
|
784
|
+
recordId
|
|
785
|
+
);
|
|
786
|
+
|
|
787
|
+
if ( crdtSnapshot ) {
|
|
788
|
+
data[ CRDT_AUTOSAVE_SNAPSHOT_KEY ] = crdtSnapshot;
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
765
792
|
updatedRecord = await __unstableFetch( {
|
|
766
793
|
path: `${ path }/autosaves`,
|
|
767
794
|
method: 'POST',
|
|
@@ -820,23 +847,6 @@ export const saveEntityRecord =
|
|
|
820
847
|
);
|
|
821
848
|
}
|
|
822
849
|
} else {
|
|
823
|
-
// `saveEntityRecord` can be called directly, bypassing
|
|
824
|
-
// `editEntityRecord`, so make sure its changes enter the
|
|
825
|
-
// CRDT before the persisted document is created below.
|
|
826
|
-
if (
|
|
827
|
-
entityConfig.syncConfig &&
|
|
828
|
-
! __unstableSkipSyncUpdate &&
|
|
829
|
-
! isNewRecord &&
|
|
830
|
-
persistedRecord
|
|
831
|
-
) {
|
|
832
|
-
getSyncManager()?.update(
|
|
833
|
-
`${ kind }/${ name }`,
|
|
834
|
-
recordId,
|
|
835
|
-
record,
|
|
836
|
-
LOCAL_UNDO_IGNORED_ORIGIN
|
|
837
|
-
);
|
|
838
|
-
}
|
|
839
|
-
|
|
840
850
|
let edits = record;
|
|
841
851
|
if ( entityConfig.__unstablePrePersist ) {
|
|
842
852
|
edits = {
|
|
@@ -852,13 +862,19 @@ export const saveEntityRecord =
|
|
|
852
862
|
method: recordId ? 'PUT' : 'POST',
|
|
853
863
|
data: edits,
|
|
854
864
|
} );
|
|
865
|
+
// Pass the pre-`__unstablePrePersist` edits so the reducer
|
|
866
|
+
// can clear the persisted edits from state. The values
|
|
867
|
+
// added by `__unstablePrePersist` (e.g. a fresh CRDT
|
|
868
|
+
// snapshot in `meta`) never exist in the state edits, so
|
|
869
|
+
// comparing against them would fail to match and leave the
|
|
870
|
+
// record dirty after a successful save.
|
|
855
871
|
dispatch.receiveEntityRecords(
|
|
856
872
|
kind,
|
|
857
873
|
name,
|
|
858
874
|
updatedRecord,
|
|
859
875
|
undefined,
|
|
860
876
|
true,
|
|
861
|
-
|
|
877
|
+
record
|
|
862
878
|
);
|
|
863
879
|
if ( entityConfig.syncConfig ) {
|
|
864
880
|
let syncChanges;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { resolveSelect } from '@wordpress/data';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
2
|
import { AwarenessState } from './awareness-state';
|
|
10
3
|
import { STORE_NAME as coreStore } from '../name';
|
|
11
4
|
import { generateCollaboratorInfo, areCollaboratorInfosEqual } from './utils';
|
|
12
|
-
|
|
13
5
|
import type { BaseState } from './types';
|
|
14
6
|
|
|
15
7
|
export abstract class BaseAwarenessState<
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { useSelect } from '@wordpress/data';
|
|
5
2
|
import { Y } from '@wordpress/sync';
|
|
6
|
-
// @ts-
|
|
3
|
+
// @ts-expect-error `@wordpress/block-editor` does not expose type declarations for its entry point.
|
|
7
4
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
5
|
import type { AbsoluteBlockIndexPath } from '../types';
|
|
13
6
|
import { unlock } from '../lock-unlock';
|
|
14
7
|
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { dispatch, select, subscribe } from '@wordpress/data';
|
|
5
2
|
import { Y } from '@wordpress/sync';
|
|
6
|
-
// @ts-
|
|
3
|
+
// @ts-expect-error `@wordpress/block-editor` does not expose type declarations for its entry point.
|
|
7
4
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
5
|
import { BaseAwarenessState, baseEqualityFieldChecks } from './base-awareness';
|
|
13
6
|
import {
|
|
14
7
|
getBlockPathInYdoc,
|
|
@@ -30,7 +23,6 @@ import {
|
|
|
30
23
|
SelectionType,
|
|
31
24
|
SelectionDirection,
|
|
32
25
|
} from '../utils/crdt-user-selections';
|
|
33
|
-
|
|
34
26
|
import type {
|
|
35
27
|
ResolvedSelection,
|
|
36
28
|
SelectionState,
|
|
@@ -200,7 +192,7 @@ export class PostEditorAwareness extends BaseAwarenessState< PostEditorState > {
|
|
|
200
192
|
undoIgnore: true,
|
|
201
193
|
};
|
|
202
194
|
|
|
203
|
-
// @ts-
|
|
195
|
+
// @ts-expect-error Types are not provided when using the store name instead of the store instance.
|
|
204
196
|
dispatch( coreStore ).editEntityRecord(
|
|
205
197
|
this.kind,
|
|
206
198
|
this.name,
|
|
@@ -288,7 +280,18 @@ export class PostEditorAwareness extends BaseAwarenessState< PostEditorState > {
|
|
|
288
280
|
};
|
|
289
281
|
}
|
|
290
282
|
|
|
283
|
+
// SelectionInMultipleBlocks is decomposed by the caller into per-endpoint
|
|
284
|
+
// Cursor / WholeBlock calls and should never arrive here directly.
|
|
285
|
+
if ( selection.type === SelectionType.SelectionInMultipleBlocks ) {
|
|
286
|
+
return {
|
|
287
|
+
richTextOffset: null,
|
|
288
|
+
localClientId: null,
|
|
289
|
+
attributeKey: null,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
291
293
|
// Text-based selections: resolve cursor position and navigate up.
|
|
294
|
+
// SelectionCursor → cursorPosition; SelectionInOneBlock → cursorStartPosition.
|
|
292
295
|
const cursorPos =
|
|
293
296
|
'cursorPosition' in selection
|
|
294
297
|
? selection.cursorPosition
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import {
|
|
5
2
|
describe,
|
|
6
3
|
expect,
|
|
@@ -9,15 +6,7 @@ import {
|
|
|
9
6
|
beforeEach,
|
|
10
7
|
afterEach,
|
|
11
8
|
} from '@jest/globals';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* WordPress dependencies
|
|
15
|
-
*/
|
|
16
9
|
import { Y } from '@wordpress/sync';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Internal dependencies
|
|
20
|
-
*/
|
|
21
10
|
import { AwarenessState } from '../awareness-state';
|
|
22
11
|
import type { EnhancedState, EqualityFieldCheck } from '../types';
|
|
23
12
|
|
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { Y } from '@wordpress/sync';
|
|
5
2
|
import { renderHook } from '@testing-library/react';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
3
|
import {
|
|
11
4
|
getBlockPathInYdoc,
|
|
12
5
|
getContainingBlockYMap,
|
|
13
6
|
resolveBlockClientIdByPath,
|
|
14
7
|
usePostContentBlocks,
|
|
15
8
|
} from '../block-lookup';
|
|
16
|
-
|
|
17
9
|
import type { EditorStoreBlock } from '../block-lookup';
|
|
18
10
|
|
|
19
11
|
type MockBlock = EditorStoreBlock & {
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { Y } from '@wordpress/sync';
|
|
5
2
|
import { dispatch, select, subscribe, resolveSelect } from '@wordpress/data';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
3
|
import { PostEditorAwareness } from '../post-editor-awareness';
|
|
11
4
|
import { SelectionType } from '../../utils/crdt-user-selections';
|
|
12
5
|
import type {
|
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { describe, expect, test, beforeEach, afterEach } from '@jest/globals';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
2
|
import { Y } from '@wordpress/sync';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Internal dependencies
|
|
13
|
-
*/
|
|
14
3
|
import { TypedAwareness } from '../typed-awareness';
|
|
15
4
|
import type { EnhancedState } from '../types';
|
|
16
5
|
|
package/src/awareness/types.ts
CHANGED
package/src/awareness/utils.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import apiFetch from '@wordpress/api-fetch';
|
|
5
2
|
|
|
6
3
|
/**
|
|
@@ -41,7 +38,6 @@ export default async function defaultProcessor( requests ) {
|
|
|
41
38
|
|
|
42
39
|
const results = [];
|
|
43
40
|
|
|
44
|
-
// @ts-ignore We would have crashed or never gotten to this point if we hadn't received the maxItems count.
|
|
45
41
|
for ( const batchRequests of chunk( requests, maxItems ) ) {
|
|
46
42
|
const batchResponse = await apiFetch( {
|
|
47
43
|
path: '/batch/v1',
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { CheckboxControl, PanelRow } from '@wordpress/components';
|
|
5
2
|
import { __ } from '@wordpress/i18n';
|
|
6
3
|
import { useSelect } from '@wordpress/data';
|
|
7
4
|
import { decodeEntities } from '@wordpress/html-entities';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
5
|
import { STORE_NAME } from '../../name';
|
|
13
6
|
import { getTemplateInfo } from '../../utils/get-template-info';
|
|
14
7
|
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { __ } from '@wordpress/i18n';
|
|
5
2
|
import { useSelect } from '@wordpress/data';
|
|
6
3
|
import { PanelBody, PanelRow } from '@wordpress/components';
|
|
7
4
|
import { getGlobalStylesChanges } from '@wordpress/global-styles-engine';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Internal dependencies
|
|
11
|
-
*/
|
|
12
5
|
import EntityRecordItem from './entity-record-item';
|
|
13
6
|
import { STORE_NAME } from '../../name';
|
|
14
7
|
|
|
@@ -1,12 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { useSelect } from '@wordpress/data';
|
|
5
2
|
import { useMemo, useState } from '@wordpress/element';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Internal dependencies
|
|
9
|
-
*/
|
|
10
3
|
import { STORE_NAME } from '../../../name';
|
|
11
4
|
|
|
12
5
|
/**
|
|
@@ -44,11 +37,15 @@ export const useIsDirty = () => {
|
|
|
44
37
|
|
|
45
38
|
const siteEntityLabels = siteEntityConfig?.meta?.labels ?? {};
|
|
46
39
|
const {
|
|
40
|
+
title: siteTitleEdit,
|
|
41
|
+
description: siteDescriptionEdit,
|
|
47
42
|
site_logo: siteLogoEdit,
|
|
48
43
|
site_icon: siteIconEdit,
|
|
49
44
|
...otherSiteEdits
|
|
50
45
|
} = siteEdits ?? {};
|
|
51
46
|
const orderedSiteProperties = [
|
|
47
|
+
siteTitleEdit !== undefined && 'title',
|
|
48
|
+
siteDescriptionEdit !== undefined && 'description',
|
|
52
49
|
siteLogoEdit !== undefined && 'site_logo',
|
|
53
50
|
siteIconEdit !== undefined && 'site_icon',
|
|
54
51
|
...Object.keys( otherSiteEdits ),
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import clsx from 'clsx';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
2
|
import { Button, Flex, FlexItem } from '@wordpress/components';
|
|
10
3
|
import { __, _n, sprintf } from '@wordpress/i18n';
|
|
11
4
|
import {
|
|
@@ -18,10 +11,6 @@ import {
|
|
|
18
11
|
useInstanceId,
|
|
19
12
|
} from '@wordpress/compose';
|
|
20
13
|
import { useDispatch } from '@wordpress/data';
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Internal dependencies
|
|
24
|
-
*/
|
|
25
14
|
import EntityTypeList from './entity-type-list';
|
|
26
15
|
import { useIsDirty } from './hooks/use-is-dirty';
|
|
27
16
|
import { unlock } from '../../lock-unlock';
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { act, renderHook } from '@testing-library/react';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
2
|
import { useIsDirty } from '../hooks/use-is-dirty';
|
|
10
3
|
|
|
11
4
|
jest.mock( '@wordpress/data', () => {
|
|
@@ -31,9 +24,19 @@ jest.mock( '@wordpress/data', () => {
|
|
|
31
24
|
] ),
|
|
32
25
|
getEntityRecordEdits: jest.fn().mockReturnValue( {
|
|
33
26
|
title: 'My Site',
|
|
27
|
+
description: 'My Tagline',
|
|
28
|
+
site_logo: 123,
|
|
29
|
+
site_icon: 456,
|
|
34
30
|
} ),
|
|
35
31
|
getEntityConfig: jest.fn().mockReturnValue( {
|
|
36
|
-
meta: {
|
|
32
|
+
meta: {
|
|
33
|
+
labels: {
|
|
34
|
+
title: 'Site Title',
|
|
35
|
+
description: 'Site Tagline',
|
|
36
|
+
site_logo: 'Site Logo',
|
|
37
|
+
site_icon: 'Site Icon',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
37
40
|
} ),
|
|
38
41
|
};
|
|
39
42
|
};
|
|
@@ -43,7 +46,7 @@ jest.mock( '@wordpress/data', () => {
|
|
|
43
46
|
} );
|
|
44
47
|
|
|
45
48
|
describe( 'useIsDirty', () => {
|
|
46
|
-
it( 'should calculate dirtyEntityRecords', () => {
|
|
49
|
+
it( 'should calculate dirtyEntityRecords in the expected order', () => {
|
|
47
50
|
const { result } = renderHook( () => useIsDirty() );
|
|
48
51
|
expect( result.current.dirtyEntityRecords ).toEqual( [
|
|
49
52
|
{
|
|
@@ -52,7 +55,30 @@ describe( 'useIsDirty', () => {
|
|
|
52
55
|
property: 'property',
|
|
53
56
|
title: 'title',
|
|
54
57
|
},
|
|
55
|
-
{
|
|
58
|
+
{
|
|
59
|
+
kind: 'root',
|
|
60
|
+
name: 'site',
|
|
61
|
+
property: 'title',
|
|
62
|
+
title: 'Site Title',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
kind: 'root',
|
|
66
|
+
name: 'site',
|
|
67
|
+
property: 'description',
|
|
68
|
+
title: 'Site Tagline',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
kind: 'root',
|
|
72
|
+
name: 'site',
|
|
73
|
+
property: 'site_logo',
|
|
74
|
+
title: 'Site Logo',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
kind: 'root',
|
|
78
|
+
name: 'site',
|
|
79
|
+
property: 'site_icon',
|
|
80
|
+
title: 'Site Icon',
|
|
81
|
+
},
|
|
56
82
|
] );
|
|
57
83
|
} );
|
|
58
84
|
it( 'should return `isDirty: true` when there are changes', () => {
|
|
@@ -78,7 +104,40 @@ describe( 'useIsDirty', () => {
|
|
|
78
104
|
kind: 'root',
|
|
79
105
|
name: 'site',
|
|
80
106
|
key: 'key',
|
|
81
|
-
property: '
|
|
107
|
+
property: 'title',
|
|
108
|
+
},
|
|
109
|
+
false
|
|
110
|
+
);
|
|
111
|
+
} );
|
|
112
|
+
act( () => {
|
|
113
|
+
result.current.setUnselectedEntities(
|
|
114
|
+
{
|
|
115
|
+
kind: 'root',
|
|
116
|
+
name: 'site',
|
|
117
|
+
key: 'key',
|
|
118
|
+
property: 'description',
|
|
119
|
+
},
|
|
120
|
+
false
|
|
121
|
+
);
|
|
122
|
+
} );
|
|
123
|
+
act( () => {
|
|
124
|
+
result.current.setUnselectedEntities(
|
|
125
|
+
{
|
|
126
|
+
kind: 'root',
|
|
127
|
+
name: 'site',
|
|
128
|
+
key: 'key',
|
|
129
|
+
property: 'site_logo',
|
|
130
|
+
},
|
|
131
|
+
false
|
|
132
|
+
);
|
|
133
|
+
} );
|
|
134
|
+
act( () => {
|
|
135
|
+
result.current.setUnselectedEntities(
|
|
136
|
+
{
|
|
137
|
+
kind: 'root',
|
|
138
|
+
name: 'site',
|
|
139
|
+
key: 'key',
|
|
140
|
+
property: 'site_icon',
|
|
82
141
|
},
|
|
83
142
|
false
|
|
84
143
|
);
|
package/src/dynamic-entities.ts
CHANGED
package/src/entities.js
CHANGED
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { capitalCase, pascalCase } from 'change-case';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* WordPress dependencies
|
|
8
|
-
*/
|
|
9
2
|
import apiFetch from '@wordpress/api-fetch';
|
|
10
3
|
import { __unstableSerializeAndClean, parse } from '@wordpress/blocks';
|
|
11
4
|
import { __ } from '@wordpress/i18n';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Internal dependencies
|
|
15
|
-
*/
|
|
16
5
|
import { PostEditorAwareness } from './awareness/post-editor-awareness';
|
|
17
6
|
import { getSyncManager } from './sync';
|
|
18
7
|
import {
|
package/src/entity-context.js
CHANGED
package/src/entity-provider.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Internal dependencies
|
|
3
|
-
*/
|
|
4
1
|
import type {
|
|
5
2
|
Context,
|
|
6
3
|
ContextualField,
|
|
@@ -11,7 +8,6 @@ import type {
|
|
|
11
8
|
CommentingStatus,
|
|
12
9
|
PingStatus,
|
|
13
10
|
} from './helpers';
|
|
14
|
-
|
|
15
11
|
import type { BaseEntityRecords as _BaseEntityRecords } from './base-entity-records';
|
|
16
12
|
|
|
17
13
|
interface MediaDetails {
|
package/src/entity-types/base.ts
CHANGED