@wordpress/fields 0.29.0 → 0.29.1-next.06ee73755.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 +0 -2
- package/LICENSE.md +1 -1
- package/README.md +41 -0
- package/build/actions/{delete-post.js → delete-post.cjs} +4 -4
- package/build/actions/{duplicate-pattern.js → duplicate-pattern.cjs} +2 -2
- package/build/actions/{duplicate-post.js → duplicate-post.cjs} +2 -2
- package/build/actions/{duplicate-template-part.js → duplicate-template-part.cjs} +3 -3
- package/build/actions/{export-pattern.js → export-pattern.cjs} +2 -2
- package/build/actions/{index.js → index.cjs} +14 -14
- package/build/actions/{permanently-delete-post.js → permanently-delete-post.cjs} +2 -2
- package/build/actions/{rename-post.js → rename-post.cjs} +3 -4
- package/build/actions/{rename-post.js.map → rename-post.cjs.map} +2 -2
- package/build/actions/{reorder-page.js → reorder-page.cjs} +2 -2
- package/build/actions/reorder-page.cjs.map +7 -0
- package/build/actions/{reset-post.js → reset-post.cjs} +2 -2
- package/build/actions/{restore-post.js → restore-post.cjs} +2 -2
- package/build/actions/{trash-post.js → trash-post.cjs} +2 -2
- package/build/actions/{utils.js → utils.cjs} +1 -1
- package/build/actions/{view-post-revisions.js → view-post-revisions.cjs} +1 -1
- package/build/actions/{view-post.js → view-post.cjs} +1 -1
- package/build/components/create-template-part-modal/{index.js → index.cjs} +3 -4
- package/build/components/create-template-part-modal/index.cjs.map +7 -0
- package/build/components/create-template-part-modal/{utils.js → utils.cjs} +1 -1
- package/build/components/media-edit/index.cjs +494 -0
- package/build/components/media-edit/index.cjs.map +7 -0
- package/build/fields/author/{author-view.js → author-view.cjs} +1 -1
- package/build/fields/author/{index.js → index.cjs} +2 -2
- package/build/fields/comment-status/{index.js → index.cjs} +1 -1
- package/build/fields/date/{date-view.js → date-view.cjs} +1 -1
- package/build/fields/date/{index.js → index.cjs} +2 -2
- package/build/fields/discussion/{index.js → index.cjs} +1 -1
- package/build/fields/featured-image/{featured-image-view.js → featured-image-view.cjs} +1 -1
- package/build/fields/featured-image/index.cjs +52 -0
- package/build/fields/featured-image/index.cjs.map +7 -0
- package/build/fields/{index.js → index.cjs} +18 -18
- package/build/fields/notes/{index.js → index.cjs} +1 -1
- package/build/fields/order/{index.js → index.cjs} +1 -1
- package/build/fields/page-title/{index.js → index.cjs} +3 -3
- package/build/fields/page-title/{view.js → view.cjs} +3 -3
- package/build/fields/parent/{index.js → index.cjs} +3 -3
- package/build/fields/parent/{parent-edit.js → parent-edit.cjs} +2 -3
- package/build/fields/parent/{parent-edit.js.map → parent-edit.cjs.map} +2 -2
- package/build/fields/parent/{parent-view.js → parent-view.cjs} +2 -2
- package/build/fields/parent/{utils.js → utils.cjs} +1 -1
- package/build/fields/password/{edit.js → edit.cjs} +1 -3
- package/build/fields/password/{edit.js.map → edit.cjs.map} +2 -2
- package/build/fields/password/{index.js → index.cjs} +2 -2
- package/build/fields/pattern-title/{index.js → index.cjs} +3 -3
- package/build/fields/pattern-title/{view.js → view.cjs} +3 -3
- package/build/fields/ping-status/{index.js → index.cjs} +1 -2
- package/build/fields/ping-status/index.cjs.map +7 -0
- package/build/fields/slug/{index.js → index.cjs} +3 -3
- package/build/fields/slug/{slug-edit.js → slug-edit.cjs} +2 -2
- package/build/fields/slug/{slug-view.js → slug-view.cjs} +2 -2
- package/build/fields/slug/{utils.js → utils.cjs} +2 -2
- package/build/fields/status/{index.js → index.cjs} +3 -3
- package/build/fields/status/{status-elements.js → status-elements.cjs} +1 -1
- package/build/fields/status/{status-view.js → status-view.cjs} +2 -2
- package/build/fields/template/{index.js → index.cjs} +2 -2
- package/build/fields/template/{template-edit.js → template-edit.cjs} +3 -3
- package/build/fields/template-title/{index.js → index.cjs} +3 -3
- package/build/fields/title/{index.js → index.cjs} +3 -3
- package/build/fields/title/{view.js → view.cjs} +2 -2
- package/build/{index.js → index.cjs} +10 -7
- package/build/index.cjs.map +7 -0
- package/build/{lock-unlock.js → lock-unlock.cjs} +1 -1
- package/build/mutation/{index.js → index.cjs} +1 -1
- package/build/{types.js → types.cjs} +1 -1
- package/build/types.cjs.map +7 -0
- package/build-module/actions/{delete-post.js → delete-post.mjs} +4 -4
- package/build-module/actions/{duplicate-pattern.js → duplicate-pattern.mjs} +2 -2
- package/build-module/actions/{duplicate-post.js → duplicate-post.mjs} +2 -2
- package/build-module/actions/{duplicate-template-part.js → duplicate-template-part.mjs} +3 -3
- package/build-module/actions/{export-pattern.js → export-pattern.mjs} +2 -2
- package/build-module/actions/index.mjs +30 -0
- package/build-module/actions/{permanently-delete-post.js → permanently-delete-post.mjs} +2 -2
- package/build-module/actions/{rename-post.js → rename-post.mjs} +3 -4
- package/build-module/actions/{rename-post.js.map → rename-post.mjs.map} +2 -2
- package/build-module/actions/{reorder-page.js → reorder-page.mjs} +2 -2
- package/build-module/actions/reorder-page.mjs.map +7 -0
- package/build-module/actions/{reset-post.js → reset-post.mjs} +2 -2
- package/build-module/actions/{restore-post.js → restore-post.mjs} +2 -2
- package/build-module/actions/{trash-post.js → trash-post.mjs} +2 -2
- package/build-module/actions/{utils.js → utils.mjs} +1 -1
- package/build-module/actions/{view-post-revisions.js → view-post-revisions.mjs} +1 -1
- package/build-module/actions/{view-post.js → view-post.mjs} +1 -1
- package/build-module/components/create-template-part-modal/{index.js → index.mjs} +3 -4
- package/build-module/components/create-template-part-modal/index.mjs.map +7 -0
- package/build-module/components/create-template-part-modal/{utils.js → utils.mjs} +1 -1
- package/build-module/components/media-edit/index.mjs +478 -0
- package/build-module/components/media-edit/index.mjs.map +7 -0
- package/build-module/fields/author/{author-view.js → author-view.mjs} +1 -1
- package/build-module/fields/author/{index.js → index.mjs} +2 -2
- package/build-module/fields/comment-status/{index.js → index.mjs} +1 -1
- package/build-module/fields/date/{date-view.js → date-view.mjs} +1 -1
- package/build-module/fields/date/{index.js → index.mjs} +2 -2
- package/build-module/fields/discussion/{index.js → index.mjs} +1 -1
- package/build-module/fields/featured-image/{featured-image-view.js → featured-image-view.mjs} +1 -1
- package/build-module/fields/featured-image/{index.js → index.mjs} +8 -5
- package/build-module/fields/featured-image/index.mjs.map +7 -0
- package/build-module/fields/index.mjs +38 -0
- package/build-module/fields/notes/{index.js → index.mjs} +1 -1
- package/build-module/fields/order/{index.js → index.mjs} +1 -1
- package/build-module/fields/page-title/{index.js → index.mjs} +3 -3
- package/build-module/fields/page-title/{view.js → view.mjs} +3 -3
- package/build-module/fields/parent/{index.js → index.mjs} +3 -3
- package/build-module/fields/parent/{parent-edit.js → parent-edit.mjs} +2 -3
- package/build-module/fields/parent/{parent-edit.js.map → parent-edit.mjs.map} +2 -2
- package/build-module/fields/parent/{parent-view.js → parent-view.mjs} +2 -2
- package/build-module/fields/parent/{utils.js → utils.mjs} +1 -1
- package/build-module/fields/password/{edit.js → edit.mjs} +1 -3
- package/build-module/fields/password/{edit.js.map → edit.mjs.map} +2 -2
- package/build-module/fields/password/{index.js → index.mjs} +2 -2
- package/build-module/fields/pattern-title/{index.js → index.mjs} +3 -3
- package/build-module/fields/pattern-title/{view.js → view.mjs} +3 -3
- package/build-module/fields/ping-status/{index.js → index.mjs} +1 -2
- package/build-module/fields/ping-status/index.mjs.map +7 -0
- package/build-module/fields/slug/{index.js → index.mjs} +3 -3
- package/build-module/fields/slug/{slug-edit.js → slug-edit.mjs} +2 -2
- package/build-module/fields/slug/{slug-view.js → slug-view.mjs} +2 -2
- package/build-module/fields/slug/{utils.js → utils.mjs} +2 -2
- package/build-module/fields/status/{index.js → index.mjs} +3 -3
- package/build-module/fields/status/{status-elements.js → status-elements.mjs} +1 -1
- package/build-module/fields/status/{status-view.js → status-view.mjs} +2 -2
- package/build-module/fields/template/{index.js → index.mjs} +2 -2
- package/build-module/fields/template/{template-edit.js → template-edit.mjs} +3 -3
- package/build-module/fields/template-title/{index.js → index.mjs} +3 -3
- package/build-module/fields/title/{index.js → index.mjs} +3 -3
- package/build-module/fields/title/{view.js → view.mjs} +2 -2
- package/build-module/index.mjs +10 -0
- package/build-module/index.mjs.map +7 -0
- package/build-module/{lock-unlock.js → lock-unlock.mjs} +1 -1
- package/build-module/mutation/{index.js → index.mjs} +1 -1
- package/build-module/types.mjs +1 -0
- package/build-style/style-rtl.css +191 -62
- package/build-style/style.css +191 -62
- package/build-types/actions/rename-post.d.ts.map +1 -1
- package/build-types/actions/reorder-page.d.ts.map +1 -1
- package/build-types/components/create-template-part-modal/index.d.ts.map +1 -1
- package/build-types/components/media-edit/index.d.ts +42 -0
- package/build-types/components/media-edit/index.d.ts.map +1 -0
- package/build-types/fields/featured-image/index.d.ts +0 -3
- package/build-types/fields/featured-image/index.d.ts.map +1 -1
- package/build-types/fields/parent/parent-edit.d.ts.map +1 -1
- package/build-types/fields/password/edit.d.ts.map +1 -1
- package/build-types/fields/ping-status/index.d.ts.map +1 -1
- package/build-types/index.d.ts +2 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/types.d.ts +24 -0
- package/build-types/types.d.ts.map +1 -1
- package/package.json +38 -30
- package/src/actions/rename-post.tsx +0 -1
- package/src/actions/reorder-page.tsx +1 -2
- package/src/components/create-template-part-modal/index.tsx +2 -3
- package/src/components/media-edit/index.tsx +616 -0
- package/src/components/media-edit/style.scss +232 -0
- package/src/fields/featured-image/{index.ts → index.tsx} +5 -2
- package/src/fields/featured-image/style.scss +7 -89
- package/src/fields/parent/parent-edit.tsx +0 -1
- package/src/fields/password/edit.tsx +0 -2
- package/src/fields/ping-status/index.tsx +0 -1
- package/src/index.ts +2 -0
- package/src/style.scss +1 -0
- package/src/types.ts +30 -0
- package/build/actions/reorder-page.js.map +0 -7
- package/build/components/create-template-part-modal/index.js.map +0 -7
- package/build/fields/featured-image/featured-image-edit.js +0 -162
- package/build/fields/featured-image/featured-image-edit.js.map +0 -7
- package/build/fields/featured-image/index.js +0 -39
- package/build/fields/featured-image/index.js.map +0 -7
- package/build/fields/ping-status/index.js.map +0 -7
- package/build/index.js.map +0 -7
- package/build/types.js.map +0 -7
- package/build-module/actions/index.js +0 -30
- package/build-module/actions/reorder-page.js.map +0 -7
- package/build-module/components/create-template-part-modal/index.js.map +0 -7
- package/build-module/fields/featured-image/featured-image-edit.js +0 -140
- package/build-module/fields/featured-image/featured-image-edit.js.map +0 -7
- package/build-module/fields/featured-image/index.js.map +0 -7
- package/build-module/fields/index.js +0 -38
- package/build-module/fields/ping-status/index.js.map +0 -7
- package/build-module/index.js +0 -8
- package/build-module/index.js.map +0 -7
- package/build-module/types.js +0 -1
- package/build-types/fields/featured-image/featured-image-edit.d.ts +0 -7
- package/build-types/fields/featured-image/featured-image-edit.d.ts.map +0 -1
- package/src/fields/featured-image/featured-image-edit.tsx +0 -170
- package/tsconfig.json +0 -31
- package/tsconfig.tsbuildinfo +0 -1
- /package/build/actions/{delete-post.js.map → delete-post.cjs.map} +0 -0
- /package/build/actions/{duplicate-pattern.js.map → duplicate-pattern.cjs.map} +0 -0
- /package/build/actions/{duplicate-post.js.map → duplicate-post.cjs.map} +0 -0
- /package/build/actions/{duplicate-template-part.js.map → duplicate-template-part.cjs.map} +0 -0
- /package/build/actions/{export-pattern.js.map → export-pattern.cjs.map} +0 -0
- /package/build/actions/{index.js.map → index.cjs.map} +0 -0
- /package/build/actions/{permanently-delete-post.js.map → permanently-delete-post.cjs.map} +0 -0
- /package/build/actions/{reset-post.js.map → reset-post.cjs.map} +0 -0
- /package/build/actions/{restore-post.js.map → restore-post.cjs.map} +0 -0
- /package/build/actions/{trash-post.js.map → trash-post.cjs.map} +0 -0
- /package/build/actions/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/actions/{view-post-revisions.js.map → view-post-revisions.cjs.map} +0 -0
- /package/build/actions/{view-post.js.map → view-post.cjs.map} +0 -0
- /package/build/components/create-template-part-modal/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/fields/author/{author-view.js.map → author-view.cjs.map} +0 -0
- /package/build/fields/author/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/comment-status/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/date/{date-view.js.map → date-view.cjs.map} +0 -0
- /package/build/fields/date/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/discussion/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/featured-image/{featured-image-view.js.map → featured-image-view.cjs.map} +0 -0
- /package/build/fields/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/notes/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/order/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/page-title/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/page-title/{view.js.map → view.cjs.map} +0 -0
- /package/build/fields/parent/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/parent/{parent-view.js.map → parent-view.cjs.map} +0 -0
- /package/build/fields/parent/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/fields/password/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/pattern-title/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/pattern-title/{view.js.map → view.cjs.map} +0 -0
- /package/build/fields/slug/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/slug/{slug-edit.js.map → slug-edit.cjs.map} +0 -0
- /package/build/fields/slug/{slug-view.js.map → slug-view.cjs.map} +0 -0
- /package/build/fields/slug/{utils.js.map → utils.cjs.map} +0 -0
- /package/build/fields/status/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/status/{status-elements.js.map → status-elements.cjs.map} +0 -0
- /package/build/fields/status/{status-view.js.map → status-view.cjs.map} +0 -0
- /package/build/fields/template/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/template/{template-edit.js.map → template-edit.cjs.map} +0 -0
- /package/build/fields/template-title/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/title/{index.js.map → index.cjs.map} +0 -0
- /package/build/fields/title/{view.js.map → view.cjs.map} +0 -0
- /package/build/{lock-unlock.js.map → lock-unlock.cjs.map} +0 -0
- /package/build/mutation/{index.js.map → index.cjs.map} +0 -0
- /package/build-module/actions/{delete-post.js.map → delete-post.mjs.map} +0 -0
- /package/build-module/actions/{duplicate-pattern.js.map → duplicate-pattern.mjs.map} +0 -0
- /package/build-module/actions/{duplicate-post.js.map → duplicate-post.mjs.map} +0 -0
- /package/build-module/actions/{duplicate-template-part.js.map → duplicate-template-part.mjs.map} +0 -0
- /package/build-module/actions/{export-pattern.js.map → export-pattern.mjs.map} +0 -0
- /package/build-module/actions/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/actions/{permanently-delete-post.js.map → permanently-delete-post.mjs.map} +0 -0
- /package/build-module/actions/{reset-post.js.map → reset-post.mjs.map} +0 -0
- /package/build-module/actions/{restore-post.js.map → restore-post.mjs.map} +0 -0
- /package/build-module/actions/{trash-post.js.map → trash-post.mjs.map} +0 -0
- /package/build-module/actions/{utils.js.map → utils.mjs.map} +0 -0
- /package/build-module/actions/{view-post-revisions.js.map → view-post-revisions.mjs.map} +0 -0
- /package/build-module/actions/{view-post.js.map → view-post.mjs.map} +0 -0
- /package/build-module/components/create-template-part-modal/{utils.js.map → utils.mjs.map} +0 -0
- /package/build-module/fields/author/{author-view.js.map → author-view.mjs.map} +0 -0
- /package/build-module/fields/author/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/comment-status/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/date/{date-view.js.map → date-view.mjs.map} +0 -0
- /package/build-module/fields/date/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/discussion/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/featured-image/{featured-image-view.js.map → featured-image-view.mjs.map} +0 -0
- /package/build-module/fields/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/notes/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/order/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/page-title/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/page-title/{view.js.map → view.mjs.map} +0 -0
- /package/build-module/fields/parent/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/parent/{parent-view.js.map → parent-view.mjs.map} +0 -0
- /package/build-module/fields/parent/{utils.js.map → utils.mjs.map} +0 -0
- /package/build-module/fields/password/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/pattern-title/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/pattern-title/{view.js.map → view.mjs.map} +0 -0
- /package/build-module/fields/slug/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/slug/{slug-edit.js.map → slug-edit.mjs.map} +0 -0
- /package/build-module/fields/slug/{slug-view.js.map → slug-view.mjs.map} +0 -0
- /package/build-module/fields/slug/{utils.js.map → utils.mjs.map} +0 -0
- /package/build-module/fields/status/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/status/{status-elements.js.map → status-elements.mjs.map} +0 -0
- /package/build-module/fields/status/{status-view.js.map → status-view.mjs.map} +0 -0
- /package/build-module/fields/template/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/template/{template-edit.js.map → template-edit.mjs.map} +0 -0
- /package/build-module/fields/template-title/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/title/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/fields/title/{view.js.map → view.mjs.map} +0 -0
- /package/build-module/{lock-unlock.js.map → lock-unlock.mjs.map} +0 -0
- /package/build-module/mutation/{index.js.map → index.mjs.map} +0 -0
- /package/build-module/{types.js.map → types.mjs.map} +0 -0
|
@@ -31,16 +31,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
// packages/fields/src/index.ts
|
|
32
32
|
var index_exports = {};
|
|
33
33
|
__export(index_exports, {
|
|
34
|
-
CreateTemplatePartModal: () => import_create_template_part_modal.default
|
|
34
|
+
CreateTemplatePartModal: () => import_create_template_part_modal.default,
|
|
35
|
+
MediaEdit: () => import_media_edit.default
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(index_exports);
|
|
37
|
-
__reExport(index_exports, require("./fields"), module.exports);
|
|
38
|
-
__reExport(index_exports, require("./actions"), module.exports);
|
|
39
|
-
var import_create_template_part_modal = __toESM(require("./components/create-template-part-modal"));
|
|
38
|
+
__reExport(index_exports, require("./fields/index.cjs"), module.exports);
|
|
39
|
+
__reExport(index_exports, require("./actions/index.cjs"), module.exports);
|
|
40
|
+
var import_create_template_part_modal = __toESM(require("./components/create-template-part-modal/index.cjs"));
|
|
41
|
+
var import_media_edit = __toESM(require("./components/media-edit/index.cjs"));
|
|
40
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
41
43
|
0 && (module.exports = {
|
|
42
44
|
CreateTemplatePartModal,
|
|
43
|
-
|
|
44
|
-
...require("./
|
|
45
|
+
MediaEdit,
|
|
46
|
+
...require("./fields/index.cjs"),
|
|
47
|
+
...require("./actions/index.cjs")
|
|
45
48
|
});
|
|
46
|
-
//# sourceMappingURL=index.
|
|
49
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["export * from './fields';\nexport * from './actions';\nexport { default as CreateTemplatePartModal } from './components/create-template-part-modal';\nexport { default as MediaEdit } from './components/media-edit';\nexport type {\n\tBasePostWithEmbeddedAuthor,\n\tBasePost,\n\tMediaEditProps,\n\tPostType,\n\tPattern,\n} from './types';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAc,+BAAd;AACA,0BAAc,gCADd;AAEA,wCAAmD;AACnD,wBAAqC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/types.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { DataFormControlProps } from '@wordpress/dataviews';\n\ntype PostStatus =\n\t| 'publish'\n\t| 'draft'\n\t| 'pending'\n\t| 'private'\n\t| 'future'\n\t| 'auto-draft'\n\t| 'trash';\n\nexport interface CommonPost {\n\tstatus?: PostStatus;\n\ttitle: string | { rendered: string } | { raw: string };\n\tcontent: string | { raw: string; rendered: string };\n\ttype: string;\n\tid: string | number;\n\tblocks?: Object[];\n\t_links?: Links;\n}\n\ninterface Links {\n\t'predecessor-version'?: { href: string; id: number }[];\n\t'version-history'?: { href: string; count: number }[];\n\t[ key: string ]: { href: string }[] | undefined;\n}\n\ninterface Author {\n\tid: number;\n\tname: string;\n\tavatar_urls: Record< string, string >;\n}\n\ninterface EmbeddedAuthor {\n\tauthor: Author[];\n}\n\n/**\n * BasePost interface used for all post types.\n */\nexport interface BasePost extends CommonPost {\n\tcomment_status?: 'open' | 'closed';\n\texcerpt?: string | { raw: string; rendered: string };\n\tmeta?: Record< string, any >;\n\tparent?: number;\n\tpassword?: string;\n\ttemplate?: string;\n\tformat?: string;\n\tfeatured_media?: number;\n\tmenu_order?: number;\n\tping_status?: 'open' | 'closed';\n\tlink?: string;\n\tslug?: string;\n\tpermalink_template?: string;\n\tdate?: string;\n\tmodified?: string;\n\tauthor?: number;\n}\n\nexport interface BasePostWithEmbeddedAuthor extends BasePost {\n\t_embedded: EmbeddedAuthor;\n}\n\ninterface FeaturedMedia {\n\ttitle: {\n\t\trendered: string;\n\t};\n\tsource_url: string;\n\tmedia_details: {\n\t\tsizes: Record< string, { width: number; source_url: string } >;\n\t};\n}\n\ninterface EmbeddedFeaturedMedia {\n\t'wp:featuredmedia': FeaturedMedia[];\n}\n\nexport interface BasePostWithEmbeddedFeaturedMedia extends BasePost {\n\t_embedded: EmbeddedFeaturedMedia;\n}\n\nexport interface Template extends CommonPost {\n\ttype: 'wp_template';\n\tis_custom: boolean;\n\tsource: string;\n\torigin: string;\n\tplugin?: string;\n\thas_theme_file: boolean;\n\tid: string;\n}\n\nexport interface TemplatePart extends CommonPost {\n\ttype: 'wp_template_part';\n\tsource: string;\n\torigin: string;\n\thas_theme_file: boolean;\n\tid: string;\n\tarea: string;\n\tplugin?: string;\n}\n\nexport interface Pattern extends CommonPost {\n\tslug: string;\n\ttitle: { raw: string };\n\twp_pattern_sync_status: string;\n}\n\nexport type Post = Template | TemplatePart | Pattern | BasePost;\n\nexport type PostWithPermissions = Post & {\n\tpermissions: {\n\t\tdelete: boolean;\n\t\tupdate: boolean;\n\t};\n};\n\ninterface EditorSupport {\n\tnotes?: boolean;\n}\n\nexport interface PostType {\n\tslug: string;\n\tviewable: boolean;\n\tsupports?: {\n\t\t'page-attributes'?: boolean;\n\t\ttitle?: boolean;\n\t\trevisions?: boolean;\n\t\tauthor?: string;\n\t\tthumbnail?: string;\n\t\tcomments?: string;\n\t\teditor?: boolean | [ EditorSupport ];\n\t\ttrackbacks?: boolean;\n\t};\n}\n\n// Will be unnecessary after typescript 5.0 upgrade.\nexport type CoreDataError = { message?: string; code?: string };\n\nexport interface MediaEditProps< Item >\n\textends Pick<\n\t\tDataFormControlProps< Item >,\n\t\t'data' | 'field' | 'onChange' | 'hideLabelFromVision'\n\t> {\n\t/**\n\t * Array of allowed media types (e.g., ['image', 'video']).\n\t *\n\t * @default ['image']\n\t */\n\tallowedTypes?: string[];\n\t/**\n\t * Whether to allow multiple media selections.\n\t *\n\t * @default false\n\t */\n\tmultiple?: boolean;\n\t/**\n\t * Whether to render in an expanded form.\n\t *\n\t * @default false\n\t */\n\tisExpanded?: boolean;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -14,9 +14,9 @@ import {
|
|
|
14
14
|
getItemTitle,
|
|
15
15
|
isTemplateOrTemplatePart,
|
|
16
16
|
isTemplateRemovable
|
|
17
|
-
} from "./utils";
|
|
18
|
-
import { deletePostWithNotices } from "../mutation";
|
|
19
|
-
import { unlock } from "../lock-unlock";
|
|
17
|
+
} from "./utils.mjs";
|
|
18
|
+
import { deletePostWithNotices } from "../mutation/index.mjs";
|
|
19
|
+
import { unlock } from "../lock-unlock.mjs";
|
|
20
20
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
21
21
|
var { PATTERN_TYPES } = unlock(patternsPrivateApis);
|
|
22
22
|
var deletePostAction = {
|
|
@@ -173,4 +173,4 @@ var delete_post_default = deletePostAction;
|
|
|
173
173
|
export {
|
|
174
174
|
delete_post_default as default
|
|
175
175
|
};
|
|
176
|
-
//# sourceMappingURL=delete-post.
|
|
176
|
+
//# sourceMappingURL=delete-post.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// packages/fields/src/actions/duplicate-pattern.tsx
|
|
2
2
|
import { _x } from "@wordpress/i18n";
|
|
3
3
|
import { privateApis as patternsPrivateApis } from "@wordpress/patterns";
|
|
4
|
-
import { unlock } from "../lock-unlock";
|
|
4
|
+
import { unlock } from "../lock-unlock.mjs";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
var { CreatePatternModalContents, useDuplicatePatternProps } = unlock(patternsPrivateApis);
|
|
7
7
|
var duplicatePattern = {
|
|
@@ -30,4 +30,4 @@ var duplicate_pattern_default = duplicatePattern;
|
|
|
30
30
|
export {
|
|
31
31
|
duplicate_pattern_default as default
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=duplicate-pattern.
|
|
33
|
+
//# sourceMappingURL=duplicate-pattern.mjs.map
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
__experimentalVStack as VStack,
|
|
11
11
|
__experimentalInputControl as InputControl
|
|
12
12
|
} from "@wordpress/components";
|
|
13
|
-
import { getItemTitle } from "./utils";
|
|
13
|
+
import { getItemTitle } from "./utils.mjs";
|
|
14
14
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
var duplicatePost = {
|
|
16
16
|
id: "duplicate-post",
|
|
@@ -143,4 +143,4 @@ var duplicate_post_default = duplicatePost;
|
|
|
143
143
|
export {
|
|
144
144
|
duplicate_post_default as default
|
|
145
145
|
};
|
|
146
|
-
//# sourceMappingURL=duplicate-post.
|
|
146
|
+
//# sourceMappingURL=duplicate-post.mjs.map
|
|
@@ -4,8 +4,8 @@ import { _x, sprintf } from "@wordpress/i18n";
|
|
|
4
4
|
import { store as noticesStore } from "@wordpress/notices";
|
|
5
5
|
import { useMemo } from "@wordpress/element";
|
|
6
6
|
import { parse } from "@wordpress/blocks";
|
|
7
|
-
import { CreateTemplatePartModalContents } from "../components/create-template-part-modal";
|
|
8
|
-
import { getItemTitle } from "./utils";
|
|
7
|
+
import { CreateTemplatePartModalContents } from "../components/create-template-part-modal/index.mjs";
|
|
8
|
+
import { getItemTitle } from "./utils.mjs";
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
10
10
|
var duplicateTemplatePart = {
|
|
11
11
|
id: "duplicate-template-part",
|
|
@@ -58,4 +58,4 @@ var duplicate_template_part_default = duplicateTemplatePart;
|
|
|
58
58
|
export {
|
|
59
59
|
duplicate_template_part_default as default
|
|
60
60
|
};
|
|
61
|
-
//# sourceMappingURL=duplicate-template-part.
|
|
61
|
+
//# sourceMappingURL=duplicate-template-part.mjs.map
|
|
@@ -4,7 +4,7 @@ import { downloadZip } from "client-zip";
|
|
|
4
4
|
import { downloadBlob } from "@wordpress/blob";
|
|
5
5
|
import { __ } from "@wordpress/i18n";
|
|
6
6
|
import { download } from "@wordpress/icons";
|
|
7
|
-
import { getItemTitle } from "./utils";
|
|
7
|
+
import { getItemTitle } from "./utils.mjs";
|
|
8
8
|
function getJsonFromItem(item) {
|
|
9
9
|
return JSON.stringify(
|
|
10
10
|
{
|
|
@@ -54,4 +54,4 @@ var export_pattern_default = exportPattern;
|
|
|
54
54
|
export {
|
|
55
55
|
export_pattern_default as default
|
|
56
56
|
};
|
|
57
|
-
//# sourceMappingURL=export-pattern.
|
|
57
|
+
//# sourceMappingURL=export-pattern.mjs.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// packages/fields/src/actions/index.ts
|
|
2
|
+
import { default as default2 } from "./view-post.mjs";
|
|
3
|
+
import { default as default3 } from "./reorder-page.mjs";
|
|
4
|
+
import { default as default4 } from "./duplicate-post.mjs";
|
|
5
|
+
import { default as default5 } from "./rename-post.mjs";
|
|
6
|
+
import { default as default6 } from "./reset-post.mjs";
|
|
7
|
+
import { default as default7 } from "./duplicate-pattern.mjs";
|
|
8
|
+
import { default as default8 } from "./export-pattern.mjs";
|
|
9
|
+
import { default as default9 } from "./view-post-revisions.mjs";
|
|
10
|
+
import { default as default10 } from "./permanently-delete-post.mjs";
|
|
11
|
+
import { default as default11 } from "./restore-post.mjs";
|
|
12
|
+
import { default as default12 } from "./trash-post.mjs";
|
|
13
|
+
import { default as default13 } from "./delete-post.mjs";
|
|
14
|
+
import { default as default14 } from "./duplicate-template-part.mjs";
|
|
15
|
+
export {
|
|
16
|
+
default13 as deletePost,
|
|
17
|
+
default7 as duplicatePattern,
|
|
18
|
+
default4 as duplicatePost,
|
|
19
|
+
default14 as duplicateTemplatePart,
|
|
20
|
+
default8 as exportPattern,
|
|
21
|
+
default10 as permanentlyDeletePost,
|
|
22
|
+
default5 as renamePost,
|
|
23
|
+
default3 as reorderPage,
|
|
24
|
+
default6 as resetPost,
|
|
25
|
+
default11 as restorePost,
|
|
26
|
+
default12 as trashPost,
|
|
27
|
+
default2 as viewPost,
|
|
28
|
+
default9 as viewPostRevisions
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
__experimentalVStack as VStack
|
|
13
13
|
} from "@wordpress/components";
|
|
14
14
|
import { decodeEntities } from "@wordpress/html-entities";
|
|
15
|
-
import { getItemTitle, isTemplateOrTemplatePart } from "./utils";
|
|
15
|
+
import { getItemTitle, isTemplateOrTemplatePart } from "./utils.mjs";
|
|
16
16
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
17
|
var permanentlyDeletePost = {
|
|
18
18
|
id: "permanently-delete",
|
|
@@ -165,4 +165,4 @@ var permanently_delete_post_default = permanentlyDeletePost;
|
|
|
165
165
|
export {
|
|
166
166
|
permanently_delete_post_default as default
|
|
167
167
|
};
|
|
168
|
-
//# sourceMappingURL=permanently-delete-post.
|
|
168
|
+
//# sourceMappingURL=permanently-delete-post.mjs.map
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
__experimentalVStack as VStack
|
|
12
12
|
} from "@wordpress/components";
|
|
13
13
|
import { store as noticesStore } from "@wordpress/notices";
|
|
14
|
-
import { unlock } from "../lock-unlock";
|
|
14
|
+
import { unlock } from "../lock-unlock.mjs";
|
|
15
15
|
import {
|
|
16
16
|
getItemTitle,
|
|
17
17
|
isTemplateRemovable,
|
|
18
18
|
isTemplate,
|
|
19
19
|
isTemplatePart
|
|
20
|
-
} from "./utils";
|
|
20
|
+
} from "./utils.mjs";
|
|
21
21
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
22
22
|
var { PATTERN_TYPES } = unlock(patternsPrivateApis);
|
|
23
23
|
var renamePost = {
|
|
@@ -76,7 +76,6 @@ var renamePost = {
|
|
|
76
76
|
/* @__PURE__ */ jsx(
|
|
77
77
|
TextControl,
|
|
78
78
|
{
|
|
79
|
-
__nextHasNoMarginBottom: true,
|
|
80
79
|
__next40pxDefaultSize: true,
|
|
81
80
|
label: __("Name"),
|
|
82
81
|
value: title,
|
|
@@ -113,4 +112,4 @@ var rename_post_default = renamePost;
|
|
|
113
112
|
export {
|
|
114
113
|
rename_post_default as default
|
|
115
114
|
};
|
|
116
|
-
//# sourceMappingURL=rename-post.
|
|
115
|
+
//# sourceMappingURL=rename-post.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/actions/rename-post.tsx"],
|
|
4
|
-
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n// @ts-ignore\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport type { Action } from '@wordpress/dataviews';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../lock-unlock';\nimport {\n\tgetItemTitle,\n\tisTemplateRemovable,\n\tisTemplate,\n\tisTemplatePart,\n} from './utils';\nimport type { CoreDataError, PostWithPermissions } from '../types';\n\n// Patterns.\nconst { PATTERN_TYPES } = unlock( patternsPrivateApis );\n\nconst renamePost: Action< PostWithPermissions > = {\n\tid: 'rename-post',\n\tlabel: __( 'Rename' ),\n\tmodalFocusOnMount: 'firstContentElement',\n\tisEligible( post ) {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Non-database template cannot be edited.\n\t\tif (\n\t\t\tpost.type === 'wp_template' &&\n\t\t\ttypeof post.id === 'string' &&\n\t\t\twindow?.__experimentalTemplateActivate\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst specialChecks = [ 'wp_template', 'wp_template_part' ];\n\n\t\tif ( ! window?.__experimentalTemplateActivate ) {\n\t\t\tspecialChecks.push( 'wp_template' );\n\t\t}\n\n\t\t// Templates, template parts and patterns have special checks for renaming.\n\t\tif ( ! specialChecks.includes( post.type ) ) {\n\t\t\treturn post.permissions?.update;\n\t\t}\n\n\t\t// In the case of templates, we can only rename custom templates.\n\t\tif ( isTemplate( post ) && ! window?.__experimentalTemplateActivate ) {\n\t\t\treturn (\n\t\t\t\tisTemplateRemovable( post ) &&\n\t\t\t\tpost.is_custom &&\n\t\t\t\tpost.permissions?.update\n\t\t\t);\n\t\t}\n\n\t\tif ( isTemplatePart( post ) ) {\n\t\t\treturn (\n\t\t\t\tpost.source === 'custom' &&\n\t\t\t\t! post?.has_theme_file &&\n\t\t\t\tpost.permissions?.update\n\t\t\t);\n\t\t}\n\n\t\treturn post.type === PATTERN_TYPES.user && post.permissions?.update;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ title, setTitle ] = useState( () => getItemTitle( item, '' ) );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tuseDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function onRename( event: React.FormEvent ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\ttitle,\n\t\t\t\t} );\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetTitle( '' );\n\t\t\t\tcloseModal?.();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t\tcreateSuccessNotice( __( 'Name updated' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tonActionPerformed?.( items );\n\t\t\t} catch ( error ) {\n\t\t\t\tconst typedError = error as CoreDataError;\n\t\t\t\tconst errorMessage =\n\t\t\t\t\ttypedError.message && typedError.code !== 'unknown_error'\n\t\t\t\t\t\t? typedError.message\n\t\t\t\t\t\t: __( 'An error occurred while updating the name' );\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<form onSubmit={ onRename }>\n\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\
|
|
5
|
-
"mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AACnB,SAAS,gBAAgB;AAEzB,SAAS,eAAe,2BAA2B;AACnD;AAAA,EACC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,OAClB;AAEP,SAAS,SAAS,oBAAoB;AAMtC,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AA4FF,
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { useState } from '@wordpress/element';\n// @ts-ignore\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport {\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport type { Action } from '@wordpress/dataviews';\nimport { store as noticesStore } from '@wordpress/notices';\n\n/**\n * Internal dependencies\n */\n\nimport { unlock } from '../lock-unlock';\nimport {\n\tgetItemTitle,\n\tisTemplateRemovable,\n\tisTemplate,\n\tisTemplatePart,\n} from './utils';\nimport type { CoreDataError, PostWithPermissions } from '../types';\n\n// Patterns.\nconst { PATTERN_TYPES } = unlock( patternsPrivateApis );\n\nconst renamePost: Action< PostWithPermissions > = {\n\tid: 'rename-post',\n\tlabel: __( 'Rename' ),\n\tmodalFocusOnMount: 'firstContentElement',\n\tisEligible( post ) {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Non-database template cannot be edited.\n\t\tif (\n\t\t\tpost.type === 'wp_template' &&\n\t\t\ttypeof post.id === 'string' &&\n\t\t\twindow?.__experimentalTemplateActivate\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\n\t\tconst specialChecks = [ 'wp_template', 'wp_template_part' ];\n\n\t\tif ( ! window?.__experimentalTemplateActivate ) {\n\t\t\tspecialChecks.push( 'wp_template' );\n\t\t}\n\n\t\t// Templates, template parts and patterns have special checks for renaming.\n\t\tif ( ! specialChecks.includes( post.type ) ) {\n\t\t\treturn post.permissions?.update;\n\t\t}\n\n\t\t// In the case of templates, we can only rename custom templates.\n\t\tif ( isTemplate( post ) && ! window?.__experimentalTemplateActivate ) {\n\t\t\treturn (\n\t\t\t\tisTemplateRemovable( post ) &&\n\t\t\t\tpost.is_custom &&\n\t\t\t\tpost.permissions?.update\n\t\t\t);\n\t\t}\n\n\t\tif ( isTemplatePart( post ) ) {\n\t\t\treturn (\n\t\t\t\tpost.source === 'custom' &&\n\t\t\t\t! post?.has_theme_file &&\n\t\t\t\tpost.permissions?.update\n\t\t\t);\n\t\t}\n\n\t\treturn post.type === PATTERN_TYPES.user && post.permissions?.update;\n\t},\n\tRenderModal: ( { items, closeModal, onActionPerformed } ) => {\n\t\tconst [ item ] = items;\n\t\tconst [ title, setTitle ] = useState( () => getItemTitle( item, '' ) );\n\t\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\t\tuseDispatch( coreStore );\n\t\tconst { createSuccessNotice, createErrorNotice } =\n\t\t\tuseDispatch( noticesStore );\n\n\t\tasync function onRename( event: React.FormEvent ) {\n\t\t\tevent.preventDefault();\n\t\t\ttry {\n\t\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\ttitle,\n\t\t\t\t} );\n\t\t\t\t// Update state before saving rerenders the list.\n\t\t\t\tsetTitle( '' );\n\t\t\t\tcloseModal?.();\n\t\t\t\t// Persist edited entity.\n\t\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t} );\n\t\t\t\tcreateSuccessNotice( __( 'Name updated' ), {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t} );\n\t\t\t\tonActionPerformed?.( items );\n\t\t\t} catch ( error ) {\n\t\t\t\tconst typedError = error as CoreDataError;\n\t\t\t\tconst errorMessage =\n\t\t\t\t\ttypedError.message && typedError.code !== 'unknown_error'\n\t\t\t\t\t\t? typedError.message\n\t\t\t\t\t\t: __( 'An error occurred while updating the name' );\n\t\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\t\t\t}\n\t\t}\n\n\t\treturn (\n\t\t\t<form onSubmit={ onRename }>\n\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\trequired\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tcloseModal?.();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t);\n\t},\n};\n\n/**\n * Rename action for PostWithPermissions.\n */\nexport default renamePost;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AACnB,SAAS,gBAAgB;AAEzB,SAAS,eAAe,2BAA2B;AACnD;AAAA,EACC;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,OAClB;AAEP,SAAS,SAAS,oBAAoB;AAMtC,SAAS,cAAc;AACvB;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AA4FF,cAOA,YAPA;AAxFL,IAAM,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AAY,KAAK,MAAM,KAAK,IAAI;AAAA,UAC7D,cAAc;AAAA,QACf,CAAE;AACF,4BAAqB,GAAI,cAAe,GAAG;AAAA,UAC1C,MAAM;AAAA,QACP,CAAE;AACF,4BAAqB,KAAM;AAAA,MAC5B,SAAU,OAAQ;AACjB,cAAM,aAAa;AACnB,cAAM,eACL,WAAW,WAAW,WAAW,SAAS,kBACvC,WAAW,UACX,GAAI,2CAA4C;AACpD,0BAAmB,cAAc,EAAE,MAAM,WAAW,CAAE;AAAA,MACvD;AAAA,IACD;AAEA,WACC,oBAAC,UAAK,UAAW,UAChB,+BAAC,UAAO,SAAQ,KACf;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,uBAAqB;AAAA,UACrB,OAAQ,GAAI,MAAO;AAAA,UACnB,OAAQ;AAAA,UACR,UAAW;AAAA,UACX,UAAQ;AAAA;AAAA,MACT;AAAA,MACA,qBAAC,UAAO,SAAQ,SACf;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,SAAQ;AAAA,YACR,SAAU,MAAM;AACf,2BAAa;AAAA,YACd;AAAA,YAEE,aAAI,QAAS;AAAA;AAAA,QAChB;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACA,uBAAqB;AAAA,YACrB,SAAQ;AAAA,YACR,MAAK;AAAA,YAEH,aAAI,MAAO;AAAA;AAAA,QACd;AAAA,SACD;AAAA,OACD,GACD;AAAA,EAEF;AACD;AAKA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "@wordpress/components";
|
|
13
13
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
14
14
|
function isItemValid(item) {
|
|
15
|
-
return typeof item.menu_order === "number" && Number.isInteger(item.menu_order)
|
|
15
|
+
return typeof item.menu_order === "number" && Number.isInteger(item.menu_order);
|
|
16
16
|
}
|
|
17
17
|
function ReorderModal({
|
|
18
18
|
items,
|
|
@@ -107,4 +107,4 @@ var reorder_page_default = reorderPage;
|
|
|
107
107
|
export {
|
|
108
108
|
reorder_page_default as default
|
|
109
109
|
};
|
|
110
|
-
//# sourceMappingURL=reorder-page.
|
|
110
|
+
//# sourceMappingURL=reorder-page.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/actions/reorder-page.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __ } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { useState } from '@wordpress/element';\nimport {\n\tButton,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\t__experimentalInputControl as InputControl,\n} from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { CoreDataError, BasePost } from '../types';\n\ninterface RenderModalProps< Item > {\n\titems: Item[];\n\tcloseModal?: () => void;\n\tonActionPerformed?: ( items: Item[] ) => void;\n}\n\ninterface Action< Item > {\n\tid: string;\n\tlabel: string;\n\tisEligible?: ( item: Item ) => boolean;\n\tmodalFocusOnMount?: string;\n\tRenderModal: ( props: RenderModalProps< Item > ) => JSX.Element;\n}\n\nfunction isItemValid( item: BasePost ): boolean {\n\treturn (\n\t\ttypeof item.menu_order === 'number' &&\n\t\tNumber.isInteger( item.menu_order )\n\t);\n}\n\nfunction ReorderModal( {\n\titems,\n\tcloseModal,\n\tonActionPerformed,\n}: RenderModalProps< BasePost > ) {\n\tconst [ item, setItem ] = useState( items[ 0 ] );\n\tconst { editEntityRecord, saveEditedEntityRecord } =\n\t\tuseDispatch( coreStore );\n\tconst { createSuccessNotice, createErrorNotice } =\n\t\tuseDispatch( noticesStore );\n\n\tconst isValid = isItemValid( item );\n\n\tasync function onOrder( event: React.FormEvent ) {\n\t\tevent.preventDefault();\n\n\t\tif ( ! isValid ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tawait editEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tmenu_order: item.menu_order,\n\t\t\t} );\n\t\t\tcloseModal?.();\n\t\t\t// Persist edited entity.\n\t\t\tawait saveEditedEntityRecord( 'postType', item.type, item.id, {\n\t\t\t\tthrowOnError: true,\n\t\t\t} );\n\t\t\tcreateSuccessNotice( __( 'Order updated.' ), {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t\tonActionPerformed?.( items );\n\t\t} catch ( error ) {\n\t\t\tconst typedError = error as CoreDataError;\n\t\t\tconst errorMessage =\n\t\t\t\ttypedError.message && typedError.code !== 'unknown_error'\n\t\t\t\t\t? typedError.message\n\t\t\t\t\t: __( 'An error occurred while updating the order' );\n\t\t\tcreateErrorNotice( errorMessage, {\n\t\t\t\ttype: 'snackbar',\n\t\t\t} );\n\t\t}\n\t}\n\n\treturn (\n\t\t<form onSubmit={ onOrder }>\n\t\t\t<VStack spacing=\"5\">\n\t\t\t\t<div>\n\t\t\t\t\t{ __(\n\t\t\t\t\t\t'Determines the order of pages. Pages with the same order value are sorted alphabetically. Negative order values are supported.'\n\t\t\t\t\t) }\n\t\t\t\t</div>\n\t\t\t\t<InputControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Order' ) }\n\t\t\t\t\ttype=\"number\"\n\t\t\t\t\tvalue={\n\t\t\t\t\t\ttypeof item.menu_order === 'number' &&\n\t\t\t\t\t\tNumber.isInteger( item.menu_order )\n\t\t\t\t\t\t\t? String( item.menu_order )\n\t\t\t\t\t\t\t: ''\n\t\t\t\t\t}\n\t\t\t\t\tonChange={ ( value ) => {\n\t\t\t\t\t\tconst parsed = parseInt( value as string, 10 ); // absorbs '' and undefined\n\t\t\t\t\t\tsetItem( {\n\t\t\t\t\t\t\t...item,\n\t\t\t\t\t\t\tmenu_order: isNaN( parsed ) ? undefined : parsed,\n\t\t\t\t\t\t} );\n\t\t\t\t\t} }\n\t\t\t\t/>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal?.();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taccessibleWhenDisabled\n\t\t\t\t\t\tdisabled={ ! isValid }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Save' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n\nconst reorderPage: Action< BasePost > = {\n\tid: 'order-pages',\n\tlabel: __( 'Order' ),\n\tisEligible( { status } ) {\n\t\treturn status !== 'trash';\n\t},\n\tmodalFocusOnMount: 'firstContentElement',\n\tRenderModal: ReorderModal,\n};\n\n/**\n * Reorder action for BasePost.\n */\nexport default reorderPage;\n"],
|
|
5
|
+
"mappings": ";AAGA,SAAS,mBAAmB;AAC5B,SAAS,SAAS,iBAAiB;AACnC,SAAS,UAAU;AACnB,SAAS,SAAS,oBAAoB;AACtC,SAAS,gBAAgB;AACzB;AAAA,EACC;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,EACxB,8BAA8B;AAAA,OACxB;AA4EH,cAuBA,YAvBA;AAvDJ,SAAS,YAAa,MAA0B;AAC/C,SACC,OAAO,KAAK,eAAe,YAC3B,OAAO,UAAW,KAAK,UAAW;AAEpC;AAEA,SAAS,aAAc;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AACD,GAAkC;AACjC,QAAM,CAAE,MAAM,OAAQ,IAAI,SAAU,MAAO,CAAE,CAAE;AAC/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;AAAA;AAAA,QAAC;AAAA;AAAA,UACA,uBAAqB;AAAA,UACrB,SAAQ;AAAA,UACR,SAAU,MAAM;AACf,yBAAa;AAAA,UACd;AAAA,UAEE,aAAI,QAAS;AAAA;AAAA,MAChB;AAAA,MACA;AAAA,QAAC;AAAA;AAAA,UACA,uBAAqB;AAAA,UACrB,SAAQ;AAAA,UACR,MAAK;AAAA,UACL,wBAAsB;AAAA,UACtB,UAAW,CAAE;AAAA,UAEX,aAAI,MAAO;AAAA;AAAA,MACd;AAAA,OACD;AAAA,KACD,GACD;AAEF;AAEA,IAAM,cAAkC;AAAA,EACvC,IAAI;AAAA,EACJ,OAAO,GAAI,OAAQ;AAAA,EACnB,WAAY,EAAE,OAAO,GAAI;AACxB,WAAO,WAAW;AAAA,EACnB;AAAA,EACA,mBAAmB;AAAA,EACnB,aAAa;AACd;AAKA,IAAO,uBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "@wordpress/components";
|
|
15
15
|
import { addQueryArgs } from "@wordpress/url";
|
|
16
16
|
import apiFetch from "@wordpress/api-fetch";
|
|
17
|
-
import { getItemTitle, isTemplateOrTemplatePart } from "./utils";
|
|
17
|
+
import { getItemTitle, isTemplateOrTemplatePart } from "./utils.mjs";
|
|
18
18
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
19
19
|
var isTemplateRevertable = (templateOrTemplatePart) => {
|
|
20
20
|
if (!templateOrTemplatePart) {
|
|
@@ -236,4 +236,4 @@ var reset_post_default = resetPostAction;
|
|
|
236
236
|
export {
|
|
237
237
|
reset_post_default as default
|
|
238
238
|
};
|
|
239
|
-
//# sourceMappingURL=reset-post.
|
|
239
|
+
//# sourceMappingURL=reset-post.mjs.map
|
|
@@ -3,7 +3,7 @@ import { backup } from "@wordpress/icons";
|
|
|
3
3
|
import { store as coreStore } from "@wordpress/core-data";
|
|
4
4
|
import { __, sprintf } from "@wordpress/i18n";
|
|
5
5
|
import { store as noticesStore } from "@wordpress/notices";
|
|
6
|
-
import { getItemTitle, isTemplateOrTemplatePart } from "./utils";
|
|
6
|
+
import { getItemTitle, isTemplateOrTemplatePart } from "./utils.mjs";
|
|
7
7
|
var restorePost = {
|
|
8
8
|
id: "restore",
|
|
9
9
|
label: __("Restore"),
|
|
@@ -110,4 +110,4 @@ var restore_post_default = restorePost;
|
|
|
110
110
|
export {
|
|
111
111
|
restore_post_default as default
|
|
112
112
|
};
|
|
113
|
-
//# sourceMappingURL=restore-post.
|
|
113
|
+
//# sourceMappingURL=restore-post.mjs.map
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
__experimentalHStack as HStack,
|
|
12
12
|
__experimentalVStack as VStack
|
|
13
13
|
} from "@wordpress/components";
|
|
14
|
-
import { getItemTitle } from "./utils";
|
|
14
|
+
import { getItemTitle } from "./utils.mjs";
|
|
15
15
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
16
|
var trashPost = {
|
|
17
17
|
id: "move-to-trash",
|
|
@@ -175,4 +175,4 @@ var trash_post_default = trashPost;
|
|
|
175
175
|
export {
|
|
176
176
|
trash_post_default as default
|
|
177
177
|
};
|
|
178
|
-
//# sourceMappingURL=trash-post.
|
|
178
|
+
//# sourceMappingURL=trash-post.mjs.map
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
getCleanTemplatePartSlug,
|
|
28
28
|
getUniqueTemplatePartTitle,
|
|
29
29
|
useExistingTemplateParts
|
|
30
|
-
} from "./utils";
|
|
30
|
+
} from "./utils.mjs";
|
|
31
31
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
32
32
|
function getAreaRadioId(value, instanceId) {
|
|
33
33
|
return `fields-create-template-part-modal__area-option-${value}-${instanceId}`;
|
|
@@ -62,7 +62,7 @@ var getTemplatePartIcon = (areaOrIconName) => {
|
|
|
62
62
|
return footerIcon;
|
|
63
63
|
} else if ("sidebar" === areaOrIconName) {
|
|
64
64
|
return sidebarIcon;
|
|
65
|
-
} else if ("overlay" === areaOrIconName) {
|
|
65
|
+
} else if ("navigation-overlay" === areaOrIconName) {
|
|
66
66
|
return overlayIcon;
|
|
67
67
|
}
|
|
68
68
|
if ("menu" === areaOrIconName) {
|
|
@@ -135,7 +135,6 @@ function CreateTemplatePartModalContents({
|
|
|
135
135
|
TextControl,
|
|
136
136
|
{
|
|
137
137
|
__next40pxDefaultSize: true,
|
|
138
|
-
__nextHasNoMarginBottom: true,
|
|
139
138
|
label: __("Name"),
|
|
140
139
|
value: title,
|
|
141
140
|
onChange: setTitle,
|
|
@@ -247,4 +246,4 @@ export {
|
|
|
247
246
|
CreateTemplatePartModalContents,
|
|
248
247
|
CreateTemplatePartModal as default
|
|
249
248
|
};
|
|
250
|
-
//# sourceMappingURL=index.
|
|
249
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/components/create-template-part-modal/index.tsx"],
|
|
4
|
+
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tIcon,\n\tBaseControl,\n\tTextControl,\n\tButton,\n\tModal,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { useInstanceId } from '@wordpress/compose';\nimport type { TemplatePartArea } from '@wordpress/core-data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { useDispatch, useSelect } from '@wordpress/data';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\nimport {\n\tcheck,\n\tfooter as footerIcon,\n\theader as headerIcon,\n\tsidebar as sidebarIcon,\n\ttableColumnAfter as overlayIcon,\n\tsymbolFilled as symbolFilledIcon,\n} from '@wordpress/icons';\nimport { store as noticesStore } from '@wordpress/notices';\n// @ts-expect-error serialize is not typed\nimport { serialize } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport {\n\tgetCleanTemplatePartSlug,\n\tgetUniqueTemplatePartTitle,\n\tuseExistingTemplateParts,\n} from './utils';\n\nfunction getAreaRadioId( value: string, instanceId: number ) {\n\treturn `fields-create-template-part-modal__area-option-${ value }-${ instanceId }`;\n}\nfunction getAreaRadioDescriptionId( value: string, instanceId: number ) {\n\treturn `fields-create-template-part-modal__area-option-description-${ value }-${ instanceId }`;\n}\n\ntype CreateTemplatePartModalContentsProps = {\n\tdefaultArea?: string;\n\tblocks: any[];\n\tconfirmLabel?: string;\n\tcloseModal: () => void;\n\tonCreate: ( templatePart: any ) => void;\n\tonError?: () => void;\n\tdefaultTitle?: string;\n};\n\n/**\n * A React component that renders a modal for creating a template part. The modal displays a title and the contents for creating the template part.\n * This component should not live in this package, it should be moved to a dedicated package responsible for managing template.\n * @param props The component props.\n * @param props.modalTitle\n */\nexport default function CreateTemplatePartModal( {\n\tmodalTitle,\n\t...restProps\n}: {\n\tmodalTitle?: string;\n} & CreateTemplatePartModalContentsProps ) {\n\tconst defaultModalTitle = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getPostType( 'wp_template_part' )?.labels\n\t\t\t\t?.add_new_item,\n\t\t[]\n\t);\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ modalTitle || defaultModalTitle }\n\t\t\tonRequestClose={ restProps.closeModal }\n\t\t\toverlayClassName=\"fields-create-template-part-modal\"\n\t\t\tfocusOnMount=\"firstContentElement\"\n\t\t\tsize=\"medium\"\n\t\t>\n\t\t\t<CreateTemplatePartModalContents { ...restProps } />\n\t\t</Modal>\n\t);\n}\n\n/**\n * Helper function to retrieve the corresponding icon by area name or icon name.\n *\n * @param {string} areaOrIconName The area name (e.g., 'header', 'navigation-overlay') or icon name (e.g., 'menu').\n *\n * @return {Object} The corresponding icon.\n */\nconst getTemplatePartIcon = ( areaOrIconName: string ) => {\n\t// Handle area names first\n\tif ( 'header' === areaOrIconName ) {\n\t\treturn headerIcon;\n\t} else if ( 'footer' === areaOrIconName ) {\n\t\treturn footerIcon;\n\t} else if ( 'sidebar' === areaOrIconName ) {\n\t\treturn sidebarIcon;\n\t} else if ( 'navigation-overlay' === areaOrIconName ) {\n\t\t// TODO: Replace with a proper overlay icon when available.\n\t\t// Using tableColumnAfter as a placeholder.\n\t\treturn overlayIcon;\n\t}\n\t// Handle icon names for backwards compatibility\n\tif ( 'menu' === areaOrIconName ) {\n\t\t// TODO: Replace with a proper overlay icon when available.\n\t\t// Using tableColumnAfter as a placeholder.\n\t\treturn overlayIcon;\n\t}\n\treturn symbolFilledIcon;\n};\n\n/**\n * A React component that renders the content of a model for creating a template part.\n * This component should not live in this package; it should be moved to a dedicated package responsible for managing template.\n *\n * @param {Object} props - The component props.\n * @param {string} [props.defaultArea=uncategorized] - The default area for the template part.\n * @param {Array} [props.blocks=[]] - The blocks to be included in the template part.\n * @param {string} [props.confirmLabel='Add'] - The label for the confirm button.\n * @param {Function} props.closeModal - Function to close the modal.\n * @param {Function} props.onCreate - Function to call when the template part is successfully created.\n * @param {Function} [props.onError] - Function to call when there is an error creating the template part.\n * @param {string} [props.defaultTitle=''] - The default title for the template part.\n */\nexport function CreateTemplatePartModalContents( {\n\tdefaultArea = 'uncategorized',\n\tblocks = [],\n\tconfirmLabel = __( 'Add' ),\n\tcloseModal,\n\tonCreate,\n\tonError,\n\tdefaultTitle = '',\n}: CreateTemplatePartModalContentsProps ) {\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst { saveEntityRecord } = useDispatch( coreStore );\n\tconst existingTemplateParts = useExistingTemplateParts();\n\n\tconst [ title, setTitle ] = useState( defaultTitle );\n\tconst [ area, setArea ] = useState( defaultArea );\n\tconst [ isSubmitting, setIsSubmitting ] = useState( false );\n\tconst instanceId = useInstanceId( CreateTemplatePartModal );\n\n\tconst defaultTemplatePartAreas = useSelect(\n\t\t( select ) =>\n\t\t\tselect( coreStore ).getCurrentTheme()?.default_template_part_areas,\n\t\t[]\n\t);\n\n\tasync function createTemplatePart() {\n\t\tif ( ! title || isSubmitting ) {\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tsetIsSubmitting( true );\n\t\t\tconst uniqueTitle = getUniqueTemplatePartTitle(\n\t\t\t\ttitle,\n\t\t\t\texistingTemplateParts\n\t\t\t);\n\t\t\tconst cleanSlug = getCleanTemplatePartSlug( uniqueTitle );\n\n\t\t\tconst templatePart = await saveEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template_part',\n\t\t\t\t{\n\t\t\t\t\tslug: cleanSlug,\n\t\t\t\t\ttitle: uniqueTitle,\n\t\t\t\t\tcontent: serialize( blocks ),\n\t\t\t\t\tarea,\n\t\t\t\t},\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t\tawait onCreate( templatePart );\n\n\t\t\t// TODO: Add a success notice?\n\t\t} catch ( error ) {\n\t\t\tconst errorMessage =\n\t\t\t\terror instanceof Error &&\n\t\t\t\t'code' in error &&\n\t\t\t\terror.message &&\n\t\t\t\terror.code !== 'unknown_error'\n\t\t\t\t\t? error.message\n\t\t\t\t\t: __(\n\t\t\t\t\t\t\t'An error occurred while creating the template part.'\n\t\t\t\t\t );\n\n\t\t\tcreateErrorNotice( errorMessage, { type: 'snackbar' } );\n\n\t\t\tonError?.();\n\t\t} finally {\n\t\t\tsetIsSubmitting( false );\n\t\t}\n\t}\n\treturn (\n\t\t<form\n\t\t\tonSubmit={ async ( event ) => {\n\t\t\t\tevent.preventDefault();\n\t\t\t\tawait createTemplatePart();\n\t\t\t} }\n\t\t>\n\t\t\t<VStack spacing=\"4\">\n\t\t\t\t<TextControl\n\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\tvalue={ title }\n\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\trequired\n\t\t\t\t/>\n\t\t\t\t<fieldset className=\"fields-create-template-part-modal__area-fieldset\">\n\t\t\t\t\t<BaseControl.VisualLabel as=\"legend\">\n\t\t\t\t\t\t{ __( 'Area' ) }\n\t\t\t\t\t</BaseControl.VisualLabel>\n\t\t\t\t\t<div className=\"fields-create-template-part-modal__area-radio-group\">\n\t\t\t\t\t\t{ ( defaultTemplatePartAreas ?? [] ).map(\n\t\t\t\t\t\t\t( item: TemplatePartArea ) => {\n\t\t\t\t\t\t\t\tconst icon = getTemplatePartIcon( item.icon );\n\t\t\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\tkey={ item.area }\n\t\t\t\t\t\t\t\t\t\tclassName=\"fields-create-template-part-modal__area-radio-wrapper\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t\t\t\ttype=\"radio\"\n\t\t\t\t\t\t\t\t\t\t\tid={ getAreaRadioId(\n\t\t\t\t\t\t\t\t\t\t\t\titem.area,\n\t\t\t\t\t\t\t\t\t\t\t\tinstanceId\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tname={ `fields-create-template-part-modal__area-${ instanceId }` }\n\t\t\t\t\t\t\t\t\t\t\tvalue={ item.area }\n\t\t\t\t\t\t\t\t\t\t\tchecked={ area === item.area }\n\t\t\t\t\t\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\t\t\t\t\t\tsetArea( item.area );\n\t\t\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t\t\t\taria-describedby={ getAreaRadioDescriptionId(\n\t\t\t\t\t\t\t\t\t\t\t\titem.area,\n\t\t\t\t\t\t\t\t\t\t\t\tinstanceId\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\ticon={ icon }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-create-template-part-modal__area-radio-icon\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<label\n\t\t\t\t\t\t\t\t\t\t\thtmlFor={ getAreaRadioId(\n\t\t\t\t\t\t\t\t\t\t\t\titem.area,\n\t\t\t\t\t\t\t\t\t\t\t\tinstanceId\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-create-template-part-modal__area-radio-label\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ item.label }\n\t\t\t\t\t\t\t\t\t\t</label>\n\t\t\t\t\t\t\t\t\t\t<Icon\n\t\t\t\t\t\t\t\t\t\t\ticon={ check }\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-create-template-part-modal__area-radio-checkmark\"\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t<p\n\t\t\t\t\t\t\t\t\t\t\tclassName=\"fields-create-template-part-modal__area-radio-description\"\n\t\t\t\t\t\t\t\t\t\t\tid={ getAreaRadioDescriptionId(\n\t\t\t\t\t\t\t\t\t\t\t\titem.area,\n\t\t\t\t\t\t\t\t\t\t\t\tinstanceId\n\t\t\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{ item.description }\n\t\t\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t) }\n\t\t\t\t\t</div>\n\t\t\t\t</fieldset>\n\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\tcloseModal();\n\t\t\t\t\t\t} }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t</Button>\n\t\t\t\t\t<Button\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\taria-disabled={ ! title || isSubmitting }\n\t\t\t\t\t\tisBusy={ isSubmitting }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ confirmLabel }\n\t\t\t\t\t</Button>\n\t\t\t\t</HStack>\n\t\t\t</VStack>\n\t\t</form>\n\t);\n}\n"],
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,wBAAwB;AAAA,EACxB,wBAAwB;AAAA,OAClB;AACP,SAAS,qBAAqB;AAE9B,SAAS,SAAS,iBAAiB;AACnC,SAAS,aAAa,iBAAiB;AACvC,SAAS,gBAAgB;AACzB,SAAS,UAAU;AACnB;AAAA,EACC;AAAA,EACA,UAAU;AAAA,EACV,UAAU;AAAA,EACV,WAAW;AAAA,EACX,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,OACV;AACP,SAAS,SAAS,oBAAoB;AAEtC,SAAS,iBAAiB;AAK1B;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,OACM;AA6CJ,cA4IM,YA5IN;AA3CH,SAAS,eAAgB,OAAe,YAAqB;AAC5D,SAAO,kDAAmD,KAAM,IAAK,UAAW;AACjF;AACA,SAAS,0BAA2B,OAAe,YAAqB;AACvE,SAAO,8DAA+D,KAAM,IAAK,UAAW;AAC7F;AAkBe,SAAR,wBAA0C;AAAA,EAChD;AAAA,EACA,GAAG;AACJ,GAE2C;AAC1C,QAAM,oBAAoB;AAAA,IACzB,CAAE,WACD,OAAQ,SAAU,EAAE,YAAa,kBAAmB,GAAG,QACpD;AAAA,IACJ,CAAC;AAAA,EACF;AACA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,OAAQ,cAAc;AAAA,MACtB,gBAAiB,UAAU;AAAA,MAC3B,kBAAiB;AAAA,MACjB,cAAa;AAAA,MACb,MAAK;AAAA,MAEL,8BAAC,mCAAkC,GAAG,WAAY;AAAA;AAAA,EACnD;AAEF;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