@wordpress/fields 0.26.0 → 0.27.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 +2 -0
- package/build/actions/delete-post.js +5 -3
- package/build/actions/delete-post.js.map +1 -1
- package/build/actions/duplicate-pattern.js +5 -3
- package/build/actions/duplicate-pattern.js.map +1 -1
- package/build/actions/duplicate-post.js +4 -2
- package/build/actions/duplicate-post.js.map +1 -1
- package/build/actions/duplicate-template-part.js +4 -2
- package/build/actions/duplicate-template-part.js.map +1 -1
- package/build/actions/export-pattern.js +3 -1
- package/build/actions/export-pattern.js.map +1 -1
- package/build/actions/index.js +2 -0
- package/build/actions/index.js.map +1 -1
- package/build/actions/permanently-delete-post.js +4 -2
- package/build/actions/permanently-delete-post.js.map +1 -1
- package/build/actions/rename-post.js +8 -3
- package/build/actions/rename-post.js.map +2 -2
- package/build/actions/reorder-page.js +4 -2
- package/build/actions/reorder-page.js.map +1 -1
- package/build/actions/reset-post.js +6 -4
- package/build/actions/reset-post.js.map +1 -1
- package/build/actions/restore-post.js +3 -1
- package/build/actions/restore-post.js.map +1 -1
- package/build/actions/trash-post.js +7 -2
- package/build/actions/trash-post.js.map +2 -2
- package/build/actions/utils.js +2 -0
- package/build/actions/utils.js.map +1 -1
- package/build/actions/view-post-revisions.js +3 -1
- package/build/actions/view-post-revisions.js.map +1 -1
- package/build/actions/view-post.js +3 -1
- package/build/actions/view-post.js.map +1 -1
- package/build/components/create-template-part-modal/index.js +4 -2
- package/build/components/create-template-part-modal/index.js.map +1 -1
- package/build/components/create-template-part-modal/utils.js +5 -3
- package/build/components/create-template-part-modal/utils.js.map +1 -1
- package/build/fields/author/author-view.js +3 -1
- package/build/fields/author/author-view.js.map +1 -1
- package/build/fields/author/index.js +3 -1
- package/build/fields/author/index.js.map +1 -1
- package/build/fields/comment-status/index.js +3 -1
- package/build/fields/comment-status/index.js.map +1 -1
- package/build/fields/date/date-view.js +5 -3
- package/build/fields/date/date-view.js.map +1 -1
- package/build/fields/date/index.js +3 -1
- package/build/fields/date/index.js.map +1 -1
- package/build/fields/discussion/index.js +3 -1
- package/build/fields/discussion/index.js.map +1 -1
- package/build/fields/featured-image/featured-image-edit.js +5 -3
- package/build/fields/featured-image/featured-image-edit.js.map +1 -1
- package/build/fields/featured-image/featured-image-view.js +3 -1
- package/build/fields/featured-image/featured-image-view.js.map +1 -1
- package/build/fields/featured-image/index.js +3 -1
- package/build/fields/featured-image/index.js.map +1 -1
- package/build/fields/index.js +2 -0
- package/build/fields/index.js.map +1 -1
- package/build/fields/order/index.js +3 -1
- package/build/fields/order/index.js.map +1 -1
- package/build/fields/page-title/index.js +3 -1
- package/build/fields/page-title/index.js.map +1 -1
- package/build/fields/page-title/view.js +4 -2
- package/build/fields/page-title/view.js.map +1 -1
- package/build/fields/parent/index.js +3 -1
- package/build/fields/parent/index.js.map +1 -1
- package/build/fields/parent/parent-edit.js +5 -3
- package/build/fields/parent/parent-edit.js.map +1 -1
- package/build/fields/parent/parent-view.js +4 -2
- package/build/fields/parent/parent-view.js.map +1 -1
- package/build/fields/parent/utils.js +2 -0
- package/build/fields/parent/utils.js.map +1 -1
- package/build/fields/password/edit.js +3 -1
- package/build/fields/password/edit.js.map +1 -1
- package/build/fields/password/index.js +3 -1
- package/build/fields/password/index.js.map +1 -1
- package/build/fields/pattern-title/index.js +3 -1
- package/build/fields/pattern-title/index.js.map +1 -1
- package/build/fields/pattern-title/view.js +4 -2
- package/build/fields/pattern-title/view.js.map +1 -1
- package/build/fields/ping-status/index.js +4 -2
- package/build/fields/ping-status/index.js.map +1 -1
- package/build/fields/slug/index.js +3 -1
- package/build/fields/slug/index.js.map +1 -1
- package/build/fields/slug/slug-edit.js +4 -2
- package/build/fields/slug/slug-edit.js.map +1 -1
- package/build/fields/slug/slug-view.js +3 -1
- package/build/fields/slug/slug-view.js.map +1 -1
- package/build/fields/slug/utils.js +3 -1
- package/build/fields/slug/utils.js.map +1 -1
- package/build/fields/status/index.js +4 -2
- package/build/fields/status/index.js.map +1 -1
- package/build/fields/status/status-elements.js +3 -1
- package/build/fields/status/status-elements.js.map +1 -1
- package/build/fields/status/status-view.js +3 -1
- package/build/fields/status/status-view.js.map +1 -1
- package/build/fields/template/index.js +3 -1
- package/build/fields/template/index.js.map +1 -1
- package/build/fields/template/template-edit.js +5 -3
- package/build/fields/template/template-edit.js.map +1 -1
- package/build/fields/template-title/index.js +3 -1
- package/build/fields/template-title/index.js.map +1 -1
- package/build/fields/title/index.js +3 -1
- package/build/fields/title/index.js.map +1 -1
- package/build/fields/title/view.js +3 -1
- package/build/fields/title/view.js.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/lock-unlock.js +3 -1
- package/build/lock-unlock.js.map +1 -1
- package/build/mutation/index.js +4 -2
- package/build/mutation/index.js.map +1 -1
- package/build/types.js +2 -0
- package/build/types.js.map +1 -1
- package/build-module/actions/delete-post.js +4 -3
- package/build-module/actions/delete-post.js.map +1 -1
- package/build-module/actions/duplicate-pattern.js +4 -3
- package/build-module/actions/duplicate-pattern.js.map +1 -1
- package/build-module/actions/duplicate-post.js +3 -2
- package/build-module/actions/duplicate-post.js.map +1 -1
- package/build-module/actions/duplicate-template-part.js +3 -2
- package/build-module/actions/duplicate-template-part.js.map +1 -1
- package/build-module/actions/export-pattern.js +2 -1
- package/build-module/actions/export-pattern.js.map +1 -1
- package/build-module/actions/index.js +1 -0
- package/build-module/actions/index.js.map +1 -1
- package/build-module/actions/permanently-delete-post.js +3 -2
- package/build-module/actions/permanently-delete-post.js.map +1 -1
- package/build-module/actions/rename-post.js +7 -3
- package/build-module/actions/rename-post.js.map +2 -2
- package/build-module/actions/reorder-page.js +3 -2
- package/build-module/actions/reorder-page.js.map +1 -1
- package/build-module/actions/reset-post.js +5 -4
- package/build-module/actions/reset-post.js.map +1 -1
- package/build-module/actions/restore-post.js +2 -1
- package/build-module/actions/restore-post.js.map +1 -1
- package/build-module/actions/trash-post.js +6 -2
- package/build-module/actions/trash-post.js.map +2 -2
- package/build-module/actions/utils.js +1 -0
- package/build-module/actions/utils.js.map +1 -1
- package/build-module/actions/view-post-revisions.js +2 -1
- package/build-module/actions/view-post-revisions.js.map +1 -1
- package/build-module/actions/view-post.js +2 -1
- package/build-module/actions/view-post.js.map +1 -1
- package/build-module/components/create-template-part-modal/index.js +3 -2
- package/build-module/components/create-template-part-modal/index.js.map +1 -1
- package/build-module/components/create-template-part-modal/utils.js +4 -3
- package/build-module/components/create-template-part-modal/utils.js.map +1 -1
- package/build-module/fields/author/author-view.js +2 -1
- package/build-module/fields/author/author-view.js.map +1 -1
- package/build-module/fields/author/index.js +2 -1
- package/build-module/fields/author/index.js.map +1 -1
- package/build-module/fields/comment-status/index.js +2 -1
- package/build-module/fields/comment-status/index.js.map +1 -1
- package/build-module/fields/date/date-view.js +4 -3
- package/build-module/fields/date/date-view.js.map +1 -1
- package/build-module/fields/date/index.js +2 -1
- package/build-module/fields/date/index.js.map +1 -1
- package/build-module/fields/discussion/index.js +2 -1
- package/build-module/fields/discussion/index.js.map +1 -1
- package/build-module/fields/featured-image/featured-image-edit.js +4 -3
- package/build-module/fields/featured-image/featured-image-edit.js.map +1 -1
- package/build-module/fields/featured-image/featured-image-view.js +2 -1
- package/build-module/fields/featured-image/featured-image-view.js.map +1 -1
- package/build-module/fields/featured-image/index.js +2 -1
- package/build-module/fields/featured-image/index.js.map +1 -1
- package/build-module/fields/index.js +1 -0
- package/build-module/fields/index.js.map +1 -1
- package/build-module/fields/order/index.js +2 -1
- package/build-module/fields/order/index.js.map +1 -1
- package/build-module/fields/page-title/index.js +2 -1
- package/build-module/fields/page-title/index.js.map +1 -1
- package/build-module/fields/page-title/view.js +3 -2
- package/build-module/fields/page-title/view.js.map +1 -1
- package/build-module/fields/parent/index.js +2 -1
- package/build-module/fields/parent/index.js.map +1 -1
- package/build-module/fields/parent/parent-edit.js +4 -3
- package/build-module/fields/parent/parent-edit.js.map +1 -1
- package/build-module/fields/parent/parent-view.js +3 -2
- package/build-module/fields/parent/parent-view.js.map +1 -1
- package/build-module/fields/parent/utils.js +1 -0
- package/build-module/fields/parent/utils.js.map +1 -1
- package/build-module/fields/password/edit.js +2 -1
- package/build-module/fields/password/edit.js.map +1 -1
- package/build-module/fields/password/index.js +2 -1
- package/build-module/fields/password/index.js.map +1 -1
- package/build-module/fields/pattern-title/index.js +2 -1
- package/build-module/fields/pattern-title/index.js.map +1 -1
- package/build-module/fields/pattern-title/view.js +3 -2
- package/build-module/fields/pattern-title/view.js.map +1 -1
- package/build-module/fields/ping-status/index.js +3 -2
- package/build-module/fields/ping-status/index.js.map +1 -1
- package/build-module/fields/slug/index.js +2 -1
- package/build-module/fields/slug/index.js.map +1 -1
- package/build-module/fields/slug/slug-edit.js +3 -2
- package/build-module/fields/slug/slug-edit.js.map +1 -1
- package/build-module/fields/slug/slug-view.js +2 -1
- package/build-module/fields/slug/slug-view.js.map +1 -1
- package/build-module/fields/slug/utils.js +2 -1
- package/build-module/fields/slug/utils.js.map +1 -1
- package/build-module/fields/status/index.js +3 -2
- package/build-module/fields/status/index.js.map +1 -1
- package/build-module/fields/status/status-elements.js +2 -1
- package/build-module/fields/status/status-elements.js.map +1 -1
- package/build-module/fields/status/status-view.js +2 -1
- package/build-module/fields/status/status-view.js.map +1 -1
- package/build-module/fields/template/index.js +2 -1
- package/build-module/fields/template/index.js.map +1 -1
- package/build-module/fields/template/template-edit.js +4 -3
- package/build-module/fields/template/template-edit.js.map +1 -1
- package/build-module/fields/template-title/index.js +2 -1
- package/build-module/fields/template-title/index.js.map +1 -1
- package/build-module/fields/title/index.js +2 -1
- package/build-module/fields/title/index.js.map +1 -1
- package/build-module/fields/title/view.js +2 -1
- package/build-module/fields/title/view.js.map +1 -1
- package/build-module/index.js +1 -0
- package/build-module/index.js.map +1 -1
- package/build-module/lock-unlock.js +2 -1
- package/build-module/lock-unlock.js.map +1 -1
- package/build-module/mutation/index.js +3 -2
- package/build-module/mutation/index.js.map +1 -1
- package/build-types/actions/rename-post.d.ts.map +1 -1
- package/build-types/actions/trash-post.d.ts.map +1 -1
- package/build-types/fields/date/date-view.d.ts.map +1 -1
- package/build-types/fields/featured-image/featured-image-edit.d.ts.map +1 -1
- package/build-types/fields/featured-image/featured-image-view.d.ts.map +1 -1
- package/build-types/fields/parent/parent-edit.d.ts.map +1 -1
- package/build-types/fields/parent/parent-view.d.ts.map +1 -1
- package/build-types/fields/slug/slug-edit.d.ts.map +1 -1
- package/build-types/fields/slug/slug-view.d.ts.map +1 -1
- package/build-types/fields/slug/utils.d.ts.map +1 -1
- package/build-types/fields/template/template-edit.d.ts.map +1 -1
- package/build-types/mutation/index.d.ts.map +1 -1
- package/package.json +26 -26
- package/src/actions/rename-post.tsx +6 -0
- package/src/actions/trash-post.tsx +5 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/parent/parent-view.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { DataViewRenderFieldProps } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getTitleWithFallbackName } from './utils';\n\nexport const ParentView = ( {\n\titem,\n}: DataViewRenderFieldProps< BasePost > ) => {\n\tconst parent = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecord } = select( coreStore );\n\t\t\treturn item?.parent\n\t\t\t\t? getEntityRecord( 'postType', item.type, item.parent )\n\t\t\t\t: null;\n\t\t},\n\t\t[ item.parent, item.type ]\n\t);\n\n\tif ( parent ) {\n\t\treturn <>{ getTitleWithFallbackName( parent ) }</>;\n\t}\n\n\treturn <>{ __( 'None' ) }</>;\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,iBAAiB;AAC1B,SAAS,SAAS,iBAAiB;AAEnC,SAAS,UAAU;AAMnB,SAAS,gCAAgC;AAgBhC;AAdF,IAAM,aAAa,CAAE;AAAA,EAC3B;AACD,MAA6C;AAC5C,QAAM,SAAS;AAAA,IACd,CAAE,WAAY;AACb,YAAM,EAAE,gBAAgB,IAAI,OAAQ,SAAU;AAC9C,aAAO,MAAM,SACV,gBAAiB,YAAY,KAAK,MAAM,KAAK,MAAO,IACpD;AAAA,IACJ;AAAA,IACA,CAAE,KAAK,QAAQ,KAAK,IAAK;AAAA,EAC1B;AAEA,MAAK,QAAS;AACb,WAAO,gCAAI,mCAA0B,MAAO,GAAG;AAAA,EAChD;AAEA,SAAO,gCAAI,aAAI,MAAO,GAAG;AAC1B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/parent/utils.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nexport function getTitleWithFallbackName( post: BasePost ) {\n\treturn typeof post.title === 'object' &&\n\t\t'rendered' in post.title &&\n\t\tpost.title.rendered\n\t\t? decodeEntities( post.title.rendered )\n\t\t: `#${ post?.id } (${ __( 'no title' ) })`;\n}\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,sBAAsB;AAC/B,SAAS,UAAU;AAOZ,SAAS,yBAA0B,MAAiB;AAC1D,SAAO,OAAO,KAAK,UAAU,YAC5B,cAAc,KAAK,SACnB,KAAK,MAAM,WACT,eAAgB,KAAK,MAAM,QAAS,IACpC,IAAK,MAAM,EAAG,KAAM,GAAI,UAAW,CAAE;AACzC;",
|
|
5
|
+
"mappings": ";AAGA,SAAS,sBAAsB;AAC/B,SAAS,UAAU;AAOZ,SAAS,yBAA0B,MAAiB;AAC1D,SAAO,OAAO,KAAK,UAAU,YAC5B,cAAc,KAAK,SACnB,KAAK,MAAM,WACT,eAAgB,KAAK,MAAM,QAAS,IACpC,IAAK,MAAM,EAAG,KAAM,GAAI,UAAW,CAAE;AACzC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/password/edit.tsx
|
|
2
2
|
import {
|
|
3
3
|
CheckboxControl,
|
|
4
4
|
__experimentalVStack as VStack,
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
} from "@wordpress/components";
|
|
7
7
|
import { useState } from "@wordpress/element";
|
|
8
8
|
import { __ } from "@wordpress/i18n";
|
|
9
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
function PasswordEdit({
|
|
10
11
|
data,
|
|
11
12
|
onChange,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/password/edit.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tCheckboxControl,\n\t__experimentalVStack as VStack,\n\tTextControl,\n} from '@wordpress/components';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\nimport { useState } from '@wordpress/element';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nfunction PasswordEdit( {\n\tdata,\n\tonChange,\n\tfield,\n}: DataFormControlProps< BasePost > ) {\n\tconst [ showPassword, setShowPassword ] = useState(\n\t\t!! field.getValue( { item: data } )\n\t);\n\n\tconst handleTogglePassword = ( value: boolean ) => {\n\t\tsetShowPassword( value );\n\t\tif ( ! value ) {\n\t\t\tonChange( { password: '' } );\n\t\t}\n\t};\n\n\treturn (\n\t\t<VStack\n\t\t\tas=\"fieldset\"\n\t\t\tspacing={ 4 }\n\t\t\tclassName=\"fields-controls__password\"\n\t\t>\n\t\t\t<CheckboxControl\n\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\tlabel={ __( 'Password protected' ) }\n\t\t\t\thelp={ __( 'Only visible to those who know the password' ) }\n\t\t\t\tchecked={ showPassword }\n\t\t\t\tonChange={ handleTogglePassword }\n\t\t\t/>\n\t\t\t{ showPassword && (\n\t\t\t\t<div className=\"fields-controls__password-input\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\tlabel={ __( 'Password' ) }\n\t\t\t\t\t\tonChange={ ( value ) =>\n\t\t\t\t\t\t\tonChange( {\n\t\t\t\t\t\t\t\tpassword: value,\n\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t}\n\t\t\t\t\t\tvalue={ field.getValue( { item: data } ) || '' }\n\t\t\t\t\t\tplaceholder={ __( 'Use a secure password' ) }\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tmaxLength={ 255 }\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t) }\n\t\t</VStack>\n\t);\n}\nexport default PasswordEdit;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA,wBAAwB;AAAA,EACxB;AAAA,OACM;AAEP,SAAS,gBAAgB;AACzB,SAAS,UAAU;AAwBjB,SAKC,KALD;AAjBF,SAAS,aAAc;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AACD,GAAsC;AACrC,QAAM,CAAE,cAAc,eAAgB,IAAI;AAAA,IACzC,CAAC,CAAE,MAAM,SAAU,EAAE,MAAM,KAAK,CAAE;AAAA,EACnC;AAEA,QAAM,uBAAuB,CAAE,UAAoB;AAClD,oBAAiB,KAAM;AACvB,QAAK,CAAE,OAAQ;AACd,eAAU,EAAE,UAAU,GAAG,CAAE;AAAA,IAC5B;AAAA,EACD;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,IAAG;AAAA,MACH,SAAU;AAAA,MACV,WAAU;AAAA,MAEV;AAAA;AAAA,UAAC;AAAA;AAAA,YACA,yBAAuB;AAAA,YACvB,OAAQ,GAAI,oBAAqB;AAAA,YACjC,MAAO,GAAI,6CAA8C;AAAA,YACzD,SAAU;AAAA,YACV,UAAW;AAAA;AAAA,QACZ;AAAA,QACE,gBACD,oBAAC,SAAI,WAAU,mCACd;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,UAAW;AAAA,YACvB,UAAW,CAAE,UACZ,SAAU;AAAA,cACT,UAAU;AAAA,YACX,CAAE;AAAA,YAEH,OAAQ,MAAM,SAAU,EAAE,MAAM,KAAK,CAAE,KAAK;AAAA,YAC5C,aAAc,GAAI,uBAAwB;AAAA,YAC1C,MAAK;AAAA,YACL,uBAAqB;AAAA,YACrB,yBAAuB;AAAA,YACvB,WAAY;AAAA;AAAA,QACb,GACD;AAAA;AAAA;AAAA,EAEF;AAEF;AACA,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/password/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport PasswordEdit from './edit';\n\nconst passwordField: Field< BasePost > = {\n\tid: 'password',\n\ttype: 'text',\n\tlabel: __( 'Password' ),\n\tEdit: PasswordEdit,\n\tenableSorting: false,\n\tenableHiding: false,\n\tisVisible: ( item ) => item.status !== 'private',\n\tfilterBy: false,\n};\n\n/**\n * Password field for BasePost.\n */\nexport default passwordField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAMnB,OAAO,kBAAkB;AAEzB,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAMnB,OAAO,kBAAkB;AAEzB,IAAM,gBAAmC;AAAA,EACxC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,UAAW;AAAA,EACtB,MAAM;AAAA,EACN,eAAe;AAAA,EACf,cAAc;AAAA,EACd,WAAW,CAAE,SAAU,KAAK,WAAW;AAAA,EACvC,UAAU;AACX;AAKA,IAAO,mBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
// packages/fields/src/fields/pattern-title/index.ts
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
3
|
import { getItemTitle } from "../../actions/utils";
|
|
3
4
|
import PatternTitleView from "./view";
|
|
4
|
-
|
|
5
|
+
var patternTitleField = {
|
|
5
6
|
type: "text",
|
|
6
7
|
id: "title",
|
|
7
8
|
label: __("Title"),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/pattern-title/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { Pattern } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\nimport PatternTitleView from './view';\n\nconst patternTitleField: Field< Pattern > = {\n\ttype: 'text',\n\tid: 'title',\n\tlabel: __( 'Title' ),\n\tplaceholder: __( 'No title' ),\n\tgetValue: ( { item } ) => getItemTitle( item ),\n\trender: PatternTitleView,\n\tenableHiding: false,\n\tenableGlobalSearch: true,\n\tfilterBy: false,\n};\n\n/**\n * Title for the pattern entity.\n */\nexport default patternTitleField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAMnB,SAAS,oBAAoB;AAC7B,OAAO,sBAAsB;AAE7B,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAMnB,SAAS,oBAAoB;AAC7B,OAAO,sBAAsB;AAE7B,IAAM,oBAAsC;AAAA,EAC3C,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,OAAO,GAAI,OAAQ;AAAA,EACnB,aAAa,GAAI,UAAW;AAAA,EAC5B,UAAU,CAAE,EAAE,KAAK,MAAO,aAAc,IAAK;AAAA,EAC7C,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,UAAU;AACX;AAKA,IAAO,wBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/pattern-title/view.tsx
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import { Icon, lockSmall } from "@wordpress/icons";
|
|
4
4
|
import { Tooltip } from "@wordpress/components";
|
|
5
5
|
import { privateApis as patternPrivateApis } from "@wordpress/patterns";
|
|
6
6
|
import { BaseTitleView } from "../title/view";
|
|
7
7
|
import { unlock } from "../../lock-unlock";
|
|
8
|
-
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
var { PATTERN_TYPES } = unlock(patternPrivateApis);
|
|
9
10
|
function PatternTitleView({ item }) {
|
|
10
11
|
return /* @__PURE__ */ jsx(BaseTitleView, { item, className: "fields-field__pattern-title", children: item.type === PATTERN_TYPES.theme && /* @__PURE__ */ jsx(
|
|
11
12
|
Tooltip,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/pattern-title/view.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport { Icon, lockSmall } from '@wordpress/icons';\nimport { Tooltip } from '@wordpress/components';\n// @ts-ignore\nimport { privateApis as patternPrivateApis } from '@wordpress/patterns';\n\n/**\n * Internal dependencies\n */\nimport type { CommonPost } from '../../types';\nimport { BaseTitleView } from '../title/view';\nimport { unlock } from '../../lock-unlock';\n\nexport const { PATTERN_TYPES } = unlock( patternPrivateApis );\n\nexport default function PatternTitleView( { item }: { item: CommonPost } ) {\n\treturn (\n\t\t<BaseTitleView item={ item } className=\"fields-field__pattern-title\">\n\t\t\t{ item.type === PATTERN_TYPES.theme && (\n\t\t\t\t<Tooltip\n\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\ttext={ __( 'This pattern cannot be edited.' ) }\n\t\t\t\t>\n\t\t\t\t\t<Icon icon={ lockSmall } size={ 24 } />\n\t\t\t\t</Tooltip>\n\t\t\t) }\n\t\t</BaseTitleView>\n\t);\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,UAAU;AACnB,SAAS,MAAM,iBAAiB;AAChC,SAAS,eAAe;AAExB,SAAS,eAAe,0BAA0B;AAMlD,SAAS,qBAAqB;AAC9B,SAAS,cAAc;AAYlB;AAVE,IAAM,EAAE,cAAc,IAAI,OAAQ,kBAAmB;AAE7C,SAAR,iBAAmC,EAAE,KAAK,GAA0B;AAC1E,SACC,oBAAC,iBAAc,MAAc,WAAU,+BACpC,eAAK,SAAS,cAAc,SAC7B;AAAA,IAAC;AAAA;AAAA,MACA,WAAU;AAAA,MACV,MAAO,GAAI,gCAAiC;AAAA,MAE5C,8BAAC,QAAK,MAAO,WAAY,MAAO,IAAK;AAAA;AAAA,EACtC,GAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/ping-status/index.tsx
|
|
2
2
|
import { __ } from "@wordpress/i18n";
|
|
3
3
|
import { CheckboxControl, ExternalLink } from "@wordpress/components";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
5
|
function PingStatusEdit({
|
|
5
6
|
data,
|
|
6
7
|
onChange
|
|
@@ -31,7 +32,7 @@ function PingStatusEdit({
|
|
|
31
32
|
}
|
|
32
33
|
);
|
|
33
34
|
}
|
|
34
|
-
|
|
35
|
+
var pingStatusField = {
|
|
35
36
|
id: "ping_status",
|
|
36
37
|
label: __("Trackbacks & Pingbacks"),
|
|
37
38
|
type: "text",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/ping-status/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { DataFormControlProps, Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\nimport { CheckboxControl, ExternalLink } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nfunction PingStatusEdit( {\n\tdata,\n\tonChange,\n}: DataFormControlProps< BasePost > ) {\n\tconst pingStatus = data?.ping_status ?? 'open';\n\n\tconst onTogglePingback = ( checked: boolean ) => {\n\t\tonChange( {\n\t\t\t...data,\n\t\t\tping_status: checked ? 'open' : 'closed',\n\t\t} );\n\t};\n\n\treturn (\n\t\t<CheckboxControl\n\t\t\t__nextHasNoMarginBottom\n\t\t\tlabel={ __( 'Enable pingbacks & trackbacks' ) }\n\t\t\tchecked={ pingStatus === 'open' }\n\t\t\tonChange={ onTogglePingback }\n\t\t\thelp={\n\t\t\t\t<ExternalLink\n\t\t\t\t\thref={ __(\n\t\t\t\t\t\t'https://wordpress.org/documentation/article/trackbacks-and-pingbacks/'\n\t\t\t\t\t) }\n\t\t\t\t>\n\t\t\t\t\t{ __( 'Learn more about pingbacks & trackbacks' ) }\n\t\t\t\t</ExternalLink>\n\t\t\t}\n\t\t/>\n\t);\n}\n\nconst pingStatusField: Field< BasePost > = {\n\tid: 'ping_status',\n\tlabel: __( 'Trackbacks & Pingbacks' ),\n\ttype: 'text',\n\tEdit: PingStatusEdit,\n\tenableSorting: false,\n\tenableHiding: false,\n\tfilterBy: false,\n\telements: [\n\t\t{\n\t\t\tvalue: 'open',\n\t\t\tlabel: __( 'Allow' ),\n\t\t\tdescription: __(\n\t\t\t\t'Allow link notifications from other blogs (pingbacks and trackbacks) on new articles.'\n\t\t\t),\n\t\t},\n\t\t{\n\t\t\tvalue: 'closed',\n\t\t\tlabel: __( \"Don't allow\" ),\n\t\t\tdescription: __(\n\t\t\t\t\"Don't allow link notifications from other blogs (pingbacks and trackbacks) on new articles.\"\n\t\t\t),\n\t\t},\n\t],\n};\n\n/**\n * Ping status field for BasePost.\n */\nexport default pingStatusField;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AACnB,SAAS,iBAAiB,oBAAoB;AA2B1C;AApBJ,SAAS,eAAgB;AAAA,EACxB;AAAA,EACA;AACD,GAAsC;AACrC,QAAM,aAAa,MAAM,eAAe;AAExC,QAAM,mBAAmB,CAAE,YAAsB;AAChD,aAAU;AAAA,MACT,GAAG;AAAA,MACH,aAAa,UAAU,SAAS;AAAA,IACjC,CAAE;AAAA,EACH;AAEA,SACC;AAAA,IAAC;AAAA;AAAA,MACA,yBAAuB;AAAA,MACvB,OAAQ,GAAI,+BAAgC;AAAA,MAC5C,SAAU,eAAe;AAAA,MACzB,UAAW;AAAA,MACX,MACC;AAAA,QAAC;AAAA;AAAA,UACA,MAAO;AAAA,YACN;AAAA,UACD;AAAA,UAEE,aAAI,yCAA0C;AAAA;AAAA,MACjD;AAAA;AAAA,EAEF;AAEF;AAEA,IAAM,kBAAqC;AAAA,EAC1C,IAAI;AAAA,EACJ,OAAO,GAAI,wBAAyB;AAAA,EACpC,MAAM;AAAA,EACN,MAAM;AAAA,EACN,eAAe;AAAA,EACf,cAAc;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AAAA,IACT;AAAA,MACC,OAAO;AAAA,MACP,OAAO,GAAI,OAAQ;AAAA,MACnB,aAAa;AAAA,QACZ;AAAA,MACD;AAAA,IACD;AAAA,IACA;AAAA,MACC,OAAO;AAAA,MACP,OAAO,GAAI,aAAc;AAAA,MACzB,aAAa;AAAA,QACZ;AAAA,MACD;AAAA,IACD;AAAA,EACD;AACD;AAKA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/slug/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport SlugEdit from './slug-edit';\nimport SlugView from './slug-view';\n\nconst slugField: Field< BasePost > = {\n\tid: 'slug',\n\ttype: 'text',\n\tlabel: __( 'Slug' ),\n\tEdit: SlugEdit,\n\trender: SlugView,\n\tfilterBy: false,\n};\n\n/**\n * Slug field for BasePost.\n */\nexport default slugField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAMnB,OAAO,cAAc;AACrB,OAAO,cAAc;AAErB,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAMnB,OAAO,cAAc;AACrB,OAAO,cAAc;AAErB,IAAM,YAA+B;AAAA,EACpC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,MAAO;AAAA,EAClB,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AACX;AAKA,IAAO,eAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/slug/slug-edit.tsx
|
|
2
2
|
import {
|
|
3
3
|
Button,
|
|
4
4
|
ExternalLink,
|
|
@@ -14,7 +14,8 @@ import { store as noticesStore } from "@wordpress/notices";
|
|
|
14
14
|
import { safeDecodeURIComponent } from "@wordpress/url";
|
|
15
15
|
import { __ } from "@wordpress/i18n";
|
|
16
16
|
import { getSlug } from "./utils";
|
|
17
|
-
|
|
17
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
var SlugEdit = ({
|
|
18
19
|
field,
|
|
19
20
|
onChange,
|
|
20
21
|
data
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/slug/slug-edit.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tButton,\n\tExternalLink,\n\t__experimentalInputControl as InputControl,\n\t__experimentalInputControlPrefixWrapper as InputControlPrefixWrapper,\n\t__experimentalVStack as VStack,\n} from '@wordpress/components';\nimport { copySmall } from '@wordpress/icons';\nimport { useCopyToClipboard, useInstanceId } from '@wordpress/compose';\nimport { useDispatch } from '@wordpress/data';\nimport { useCallback, useEffect, useRef } from '@wordpress/element';\nimport { store as noticesStore } from '@wordpress/notices';\nimport { safeDecodeURIComponent } from '@wordpress/url';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getSlug } from './utils';\n\nconst SlugEdit = ( {\n\tfield,\n\tonChange,\n\tdata,\n}: DataFormControlProps< BasePost > ) => {\n\tconst { id } = field;\n\n\tconst slug = field.getValue( { item: data } ) || getSlug( data );\n\tconst permalinkTemplate = data.permalink_template || '';\n\tconst PERMALINK_POSTNAME_REGEX = /%(?:postname|pagename)%/;\n\tconst [ prefix, suffix ] = permalinkTemplate.split(\n\t\tPERMALINK_POSTNAME_REGEX\n\t);\n\tconst permalinkPrefix = prefix;\n\tconst permalinkSuffix = suffix;\n\tconst isEditable = PERMALINK_POSTNAME_REGEX.test( permalinkTemplate );\n\tconst originalSlugRef = useRef( slug );\n\tconst slugToDisplay = slug || originalSlugRef.current;\n\tconst permalink = isEditable\n\t\t? `${ permalinkPrefix }${ slugToDisplay }${ permalinkSuffix }`\n\t\t: safeDecodeURIComponent( data.link || '' );\n\n\tuseEffect( () => {\n\t\tif ( slug && originalSlugRef.current === undefined ) {\n\t\t\toriginalSlugRef.current = slug;\n\t\t}\n\t}, [ slug ] );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue?: string ) =>\n\t\t\tonChange( {\n\t\t\t\t[ id ]: newValue,\n\t\t\t} ),\n\t\t[ id, onChange ]\n\t);\n\n\tconst { createNotice } = useDispatch( noticesStore );\n\n\tconst copyButtonRef = useCopyToClipboard( permalink, () => {\n\t\tcreateNotice( 'info', __( 'Copied Permalink to clipboard.' ), {\n\t\t\tisDismissible: true,\n\t\t\ttype: 'snackbar',\n\t\t} );\n\t} );\n\n\tconst postUrlSlugDescriptionId =\n\t\t'editor-post-url__slug-description-' + useInstanceId( SlugEdit );\n\n\treturn (\n\t\t<fieldset className=\"fields-controls__slug\">\n\t\t\t{ isEditable && (\n\t\t\t\t<VStack>\n\t\t\t\t\t<VStack spacing=\"0px\">\n\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t{ __(\n\t\t\t\t\t\t\t\t'Customize the last part of the Permalink.'\n\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<ExternalLink href=\"https://wordpress.org/documentation/article/page-post-settings-sidebar/#permalink\">\n\t\t\t\t\t\t\t{ __( 'Learn more' ) }\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</VStack>\n\t\t\t\t\t<InputControl\n\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\tprefix={\n\t\t\t\t\t\t\t<InputControlPrefixWrapper>\n\t\t\t\t\t\t\t\t/\n\t\t\t\t\t\t\t</InputControlPrefixWrapper>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsuffix={\n\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t__next40pxDefaultSize\n\t\t\t\t\t\t\t\ticon={ copySmall }\n\t\t\t\t\t\t\t\tref={ copyButtonRef }\n\t\t\t\t\t\t\t\tlabel={ __( 'Copy' ) }\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlabel={ __( 'Link' ) }\n\t\t\t\t\t\thideLabelFromVision\n\t\t\t\t\t\tvalue={ slug }\n\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\tspellCheck=\"false\"\n\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\tclassName=\"fields-controls__slug-input\"\n\t\t\t\t\t\tonChange={ ( newValue?: string ) => {\n\t\t\t\t\t\t\tonChangeControl( newValue );\n\t\t\t\t\t\t} }\n\t\t\t\t\t\tonBlur={ () => {\n\t\t\t\t\t\t\tif ( slug === '' ) {\n\t\t\t\t\t\t\t\tonChangeControl( originalSlugRef.current );\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} }\n\t\t\t\t\t\taria-describedby={ postUrlSlugDescriptionId }\n\t\t\t\t\t/>\n\t\t\t\t\t<div className=\"fields-controls__slug-help\">\n\t\t\t\t\t\t<span className=\"fields-controls__slug-help-visual-label\">\n\t\t\t\t\t\t\t{ __( 'Permalink:' ) }\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<ExternalLink\n\t\t\t\t\t\t\tclassName=\"fields-controls__slug-help-link\"\n\t\t\t\t\t\t\thref={ permalink }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<span className=\"fields-controls__slug-help-prefix\">\n\t\t\t\t\t\t\t\t{ permalinkPrefix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"fields-controls__slug-help-slug\">\n\t\t\t\t\t\t\t\t{ slugToDisplay }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t<span className=\"fields-controls__slug-help-suffix\">\n\t\t\t\t\t\t\t\t{ permalinkSuffix }\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</ExternalLink>\n\t\t\t\t\t</div>\n\t\t\t\t</VStack>\n\t\t\t) }\n\t\t\t{ ! isEditable && (\n\t\t\t\t<ExternalLink\n\t\t\t\t\tclassName=\"fields-controls__slug-help\"\n\t\t\t\t\thref={ permalink }\n\t\t\t\t>\n\t\t\t\t\t{ permalink }\n\t\t\t\t</ExternalLink>\n\t\t\t) }\n\t\t</fieldset>\n\t);\n};\n\nexport default SlugEdit;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
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AEC,CAAE,cACH;AAAA,MAAC;AAAA;AAAA,QACA,WAAU;AAAA,QACV,MAAO;AAAA,QAEL;AAAA;AAAA,IACH;AAAA,KAEF;AAEF;AAEA,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
// packages/fields/src/fields/slug/slug-view.tsx
|
|
1
2
|
import { useEffect, useRef } from "@wordpress/element";
|
|
2
3
|
import { getSlug } from "./utils";
|
|
3
|
-
|
|
4
|
+
var SlugView = ({ item }) => {
|
|
4
5
|
const slug = getSlug(item);
|
|
5
6
|
const originalSlugRef = useRef(slug);
|
|
6
7
|
useEffect(() => {
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/slug/slug-view.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useEffect, useRef } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getSlug } from './utils';\n\nconst SlugView = ( { item }: { item: BasePost } ) => {\n\tconst slug = getSlug( item );\n\tconst originalSlugRef = useRef( slug );\n\n\tuseEffect( () => {\n\t\tif ( slug && originalSlugRef.current === undefined ) {\n\t\t\toriginalSlugRef.current = slug;\n\t\t}\n\t}, [ slug ] );\n\n\tconst slugToDisplay = slug || originalSlugRef.current;\n\n\treturn `${ slugToDisplay }`;\n};\n\nexport default SlugView;\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,WAAW,cAAc;AAMlC,SAAS,eAAe;AAExB,
|
|
5
|
+
"mappings": ";AAGA,SAAS,WAAW,cAAc;AAMlC,SAAS,eAAe;AAExB,IAAM,WAAW,CAAE,EAAE,KAAK,MAA2B;AACpD,QAAM,OAAO,QAAS,IAAK;AAC3B,QAAM,kBAAkB,OAAQ,IAAK;AAErC,YAAW,MAAM;AAChB,QAAK,QAAQ,gBAAgB,YAAY,QAAY;AACpD,sBAAgB,UAAU;AAAA,IAC3B;AAAA,EACD,GAAG,CAAE,IAAK,CAAE;AAEZ,QAAM,gBAAgB,QAAQ,gBAAgB;AAE9C,SAAO,GAAI,aAAc;AAC1B;AAEA,IAAO,oBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/slug/utils.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { cleanForSlug } from '@wordpress/url';\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\n\nexport const getSlug = ( item: BasePost ): string => {\n\tif ( typeof item !== 'object' ) {\n\t\treturn '';\n\t}\n\n\treturn (\n\t\titem.slug || cleanForSlug( getItemTitle( item ) ) || item.id.toString()\n\t);\n};\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,oBAAoB;AAK7B,SAAS,oBAAoB;AAEtB,
|
|
5
|
+
"mappings": ";AAGA,SAAS,oBAAoB;AAK7B,SAAS,oBAAoB;AAEtB,IAAM,UAAU,CAAE,SAA4B;AACpD,MAAK,OAAO,SAAS,UAAW;AAC/B,WAAO;AAAA,EACR;AAEA,SACC,KAAK,QAAQ,aAAc,aAAc,IAAK,CAAE,KAAK,KAAK,GAAG,SAAS;AAExE;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
// packages/fields/src/fields/status/index.tsx
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
3
|
import StatusView from "./status-view";
|
|
3
4
|
import STATUSES from "./status-elements";
|
|
4
|
-
|
|
5
|
-
|
|
5
|
+
var OPERATOR_IS_ANY = "isAny";
|
|
6
|
+
var statusField = {
|
|
6
7
|
label: __("Status"),
|
|
7
8
|
id: "status",
|
|
8
9
|
type: "text",
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/status/index.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport StatusView from './status-view';\nimport STATUSES from './status-elements';\n\nconst OPERATOR_IS_ANY = 'isAny';\n\nconst statusField: Field< BasePost > = {\n\tlabel: __( 'Status' ),\n\tid: 'status',\n\ttype: 'text',\n\telements: STATUSES,\n\trender: StatusView,\n\tEdit: 'radio',\n\tenableSorting: false,\n\tfilterBy: {\n\t\toperators: [ OPERATOR_IS_ANY ],\n\t},\n};\n\n/**\n * Status field for BasePost.\n */\nexport default statusField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAMnB,OAAO,gBAAgB;AACvB,OAAO,cAAc;AAErB,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAMnB,OAAO,gBAAgB;AACvB,OAAO,cAAc;AAErB,IAAM,kBAAkB;AAExB,IAAM,cAAiC;AAAA,EACtC,OAAO,GAAI,QAAS;AAAA,EACpB,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,UAAU;AAAA,EACV,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,eAAe;AAAA,EACf,UAAU;AAAA,IACT,WAAW,CAAE,eAAgB;AAAA,EAC9B;AACD;AAKA,IAAO,iBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/fields/src/fields/status/status-elements.tsx
|
|
1
2
|
import {
|
|
2
3
|
trash,
|
|
3
4
|
drafts,
|
|
@@ -7,7 +8,7 @@ import {
|
|
|
7
8
|
notAllowed
|
|
8
9
|
} from "@wordpress/icons";
|
|
9
10
|
import { __ } from "@wordpress/i18n";
|
|
10
|
-
|
|
11
|
+
var STATUSES = [
|
|
11
12
|
{
|
|
12
13
|
value: "draft",
|
|
13
14
|
label: __("Draft"),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/status/status-elements.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\ttrash,\n\tdrafts,\n\tpublished,\n\tscheduled,\n\tpending,\n\tnotAllowed,\n} from '@wordpress/icons';\nimport { __ } from '@wordpress/i18n';\n\n// See https://github.com/WordPress/gutenberg/issues/55886\n// We do not support custom statutes at the moment.\nconst STATUSES = [\n\t{\n\t\tvalue: 'draft',\n\t\tlabel: __( 'Draft' ),\n\t\ticon: drafts,\n\t\tdescription: __( 'Not ready to publish.' ),\n\t},\n\t{\n\t\tvalue: 'future',\n\t\tlabel: __( 'Scheduled' ),\n\t\ticon: scheduled,\n\t\tdescription: __( 'Publish automatically on a chosen date.' ),\n\t},\n\t{\n\t\tvalue: 'pending',\n\t\tlabel: __( 'Pending Review' ),\n\t\ticon: pending,\n\t\tdescription: __( 'Waiting for review before publishing.' ),\n\t},\n\t{\n\t\tvalue: 'private',\n\t\tlabel: __( 'Private' ),\n\t\ticon: notAllowed,\n\t\tdescription: __( 'Only visible to site admins and editors.' ),\n\t},\n\t{\n\t\tvalue: 'publish',\n\t\tlabel: __( 'Published' ),\n\t\ticon: published,\n\t\tdescription: __( 'Visible to everyone.' ),\n\t},\n\t{ value: 'trash', label: __( 'Trash' ), icon: trash },\n];\n\nexport default STATUSES;\n"],
|
|
5
|
-
"mappings": "AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU;AAInB,
|
|
5
|
+
"mappings": ";AAGA;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,UAAU;AAInB,IAAM,WAAW;AAAA,EAChB;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,OAAQ;AAAA,IACnB,MAAM;AAAA,IACN,aAAa,GAAI,uBAAwB;AAAA,EAC1C;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,WAAY;AAAA,IACvB,MAAM;AAAA,IACN,aAAa,GAAI,yCAA0C;AAAA,EAC5D;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,gBAAiB;AAAA,IAC5B,MAAM;AAAA,IACN,aAAa,GAAI,uCAAwC;AAAA,EAC1D;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,SAAU;AAAA,IACrB,MAAM;AAAA,IACN,aAAa,GAAI,0CAA2C;AAAA,EAC7D;AAAA,EACA;AAAA,IACC,OAAO;AAAA,IACP,OAAO,GAAI,WAAY;AAAA,IACvB,MAAM;AAAA,IACN,aAAa,GAAI,sBAAuB;AAAA,EACzC;AAAA,EACA,EAAE,OAAO,SAAS,OAAO,GAAI,OAAQ,GAAG,MAAM,MAAM;AACrD;AAEA,IAAO,0BAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/status/status-view.tsx
|
|
2
2
|
import { __experimentalHStack as HStack, Icon } from "@wordpress/components";
|
|
3
3
|
import STATUSES from "./status-elements";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
5
|
function StatusView({ item }) {
|
|
5
6
|
const status = STATUSES.find(({ value }) => value === item.status);
|
|
6
7
|
const label = status?.label || item.status;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/status/status-view.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack, Icon } from '@wordpress/components';\n\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\nimport STATUSES from './status-elements';\n\nfunction StatusView( { item }: { item: BasePost } ) {\n\tconst status = STATUSES.find( ( { value } ) => value === item.status );\n\tconst label = status?.label || item.status;\n\tconst icon = status?.icon;\n\treturn (\n\t\t<HStack alignment=\"left\" spacing={ 0 }>\n\t\t\t{ icon && (\n\t\t\t\t<div className=\"edit-site-post-list__status-icon\">\n\t\t\t\t\t<Icon icon={ icon } />\n\t\t\t\t</div>\n\t\t\t) }\n\t\t\t<span>{ label }</span>\n\t\t</HStack>\n\t);\n}\n\nexport default StatusView;\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,wBAAwB,QAAQ,YAAY;AAMrD,OAAO,cAAc;AAOnB,SAGG,KAHH;AALF,SAAS,WAAY,EAAE,KAAK,GAAwB;AACnD,QAAM,SAAS,SAAS,KAAM,CAAE,EAAE,MAAM,MAAO,UAAU,KAAK,MAAO;AACrE,QAAM,QAAQ,QAAQ,SAAS,KAAK;AACpC,QAAM,OAAO,QAAQ;AACrB,SACC,qBAAC,UAAO,WAAU,QAAO,SAAU,GAChC;AAAA,YACD,oBAAC,SAAI,WAAU,oCACd,8BAAC,QAAK,MAAc,GACrB;AAAA,IAED,oBAAC,UAAO,iBAAO;AAAA,KAChB;AAEF;AAEA,IAAO,sBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/template/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport { __ } from '@wordpress/i18n';\nimport type { BasePost } from '../../types';\nimport { TemplateEdit } from './template-edit';\n\nconst templateField: Field< BasePost > = {\n\tid: 'template',\n\ttype: 'text',\n\tlabel: __( 'Template' ),\n\tEdit: TemplateEdit,\n\tenableSorting: false,\n\tfilterBy: false,\n};\n\n/**\n * Template field for BasePost.\n */\nexport default templateField;\n"],
|
|
5
|
-
"mappings": "AAQA,SAAS,UAAU;AAEnB,SAAS,oBAAoB;AAE7B,
|
|
5
|
+
"mappings": ";AAQA,SAAS,UAAU;AAEnB,SAAS,oBAAoB;AAE7B,IAAM,gBAAmC;AAAA,EACxC,IAAI;AAAA,EACJ,MAAM;AAAA,EACN,OAAO,GAAI,UAAW;AAAA,EACtB,MAAM;AAAA,EACN,eAAe;AAAA,EACf,UAAU;AACX;AAKA,IAAO,mBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/template/template-edit.tsx
|
|
2
2
|
import { useCallback, useMemo, useState } from "@wordpress/element";
|
|
3
3
|
import { parse } from "@wordpress/blocks";
|
|
4
4
|
import { store as coreStore } from "@wordpress/core-data";
|
|
@@ -16,8 +16,9 @@ import { decodeEntities } from "@wordpress/html-entities";
|
|
|
16
16
|
import { __ } from "@wordpress/i18n";
|
|
17
17
|
import { getItemTitle } from "../../actions/utils";
|
|
18
18
|
import { unlock } from "../../lock-unlock";
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
var EMPTY_ARRAY = [];
|
|
21
|
+
var TemplateEdit = ({
|
|
21
22
|
data,
|
|
22
23
|
field,
|
|
23
24
|
onChange
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/template/template-edit.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useCallback, useMemo, useState } from '@wordpress/element';\n// @ts-ignore\nimport { parse } from '@wordpress/blocks';\nimport type { WpTemplate } from '@wordpress/core-data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport type { DataFormControlProps } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\n// @ts-expect-error block-editor is not typed correctly.\nimport { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';\nimport {\n\tButton,\n\tDropdown,\n\tMenuGroup,\n\tMenuItem,\n\tModal,\n} from '@wordpress/components';\nimport { useAsyncList } from '@wordpress/compose';\nimport { useSelect } from '@wordpress/data';\nimport { decodeEntities } from '@wordpress/html-entities';\nimport { __ } from '@wordpress/i18n';\nimport { getItemTitle } from '../../actions/utils';\nimport type { BasePost } from '../../types';\nimport { unlock } from '../../lock-unlock';\n\nconst EMPTY_ARRAY: [] = [];\n\nexport const TemplateEdit = ( {\n\tdata,\n\tfield,\n\tonChange,\n}: DataFormControlProps< BasePost > ) => {\n\tconst { id } = field;\n\tconst postType = data.type;\n\tconst postId =\n\t\ttypeof data.id === 'number' ? data.id : parseInt( data.id, 10 );\n\tconst slug = data.slug;\n\n\tconst { canSwitchTemplate, templates } = useSelect(\n\t\t( select ) => {\n\t\t\tconst allTemplates =\n\t\t\t\tselect( coreStore ).getEntityRecords< WpTemplate >(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\t{\n\t\t\t\t\t\tper_page: -1,\n\t\t\t\t\t\tpost_type: postType,\n\t\t\t\t\t}\n\t\t\t\t) ?? EMPTY_ARRAY;\n\n\t\t\tconst { getHomePage, getPostsPageId } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\n\t\t\tconst isPostsPage = getPostsPageId() === +postId;\n\t\t\tconst isFrontPage =\n\t\t\t\tpostType === 'page' && getHomePage()?.postId === +postId;\n\n\t\t\tconst allowSwitchingTemplate = ! isPostsPage && ! isFrontPage;\n\n\t\t\treturn {\n\t\t\t\ttemplates: allTemplates,\n\t\t\t\tcanSwitchTemplate: allowSwitchingTemplate,\n\t\t\t};\n\t\t},\n\t\t[ postId, postType ]\n\t);\n\n\tconst templatesAsPatterns = useMemo( () => {\n\t\tif ( ! canSwitchTemplate ) {\n\t\t\treturn [];\n\t\t}\n\t\treturn templates\n\t\t\t.filter(\n\t\t\t\t( template ) =>\n\t\t\t\t\ttemplate.is_custom &&\n\t\t\t\t\ttemplate.slug !== data.template &&\n\t\t\t\t\t// Skip empty templates.\n\t\t\t\t\t!! template.content.raw\n\t\t\t)\n\t\t\t.map( ( template ) => ( {\n\t\t\t\tname: template.slug,\n\t\t\t\tblocks: parse( template.content.raw ),\n\t\t\t\ttitle: decodeEntities( template.title.rendered ),\n\t\t\t\tid: template.id,\n\t\t\t} ) );\n\t}, [ canSwitchTemplate, data.template, templates ] );\n\n\tconst shownTemplates = useAsyncList( templatesAsPatterns );\n\n\tconst value = field.getValue( { item: data } );\n\tconst foundTemplate = templates.find(\n\t\t( template ) => template.slug === value\n\t);\n\n\tconst currentTemplate = useSelect(\n\t\t( select ) => {\n\t\t\tif ( foundTemplate ) {\n\t\t\t\treturn foundTemplate;\n\t\t\t}\n\n\t\t\tlet slugToCheck;\n\t\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t\t// through template hierarchy.\n\t\t\tif ( slug ) {\n\t\t\t\tslugToCheck =\n\t\t\t\t\tpostType === 'page'\n\t\t\t\t\t\t? `${ postType }-${ slug }`\n\t\t\t\t\t\t: `single-${ postType }-${ slug }`;\n\t\t\t} else {\n\t\t\t\tslugToCheck =\n\t\t\t\t\tpostType === 'page' ? 'page' : `single-${ postType }`;\n\t\t\t}\n\n\t\t\tif ( postType ) {\n\t\t\t\tconst templateId = select( coreStore ).getDefaultTemplateId( {\n\t\t\t\t\tslug: slugToCheck,\n\t\t\t\t} );\n\n\t\t\t\treturn select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_template',\n\t\t\t\t\ttemplateId\n\t\t\t\t);\n\t\t\t}\n\t\t},\n\t\t[ foundTemplate, postType, slug ]\n\t);\n\n\tconst [ showModal, setShowModal ] = useState( false );\n\n\tconst onChangeControl = useCallback(\n\t\t( newValue: string ) =>\n\t\t\tonChange( {\n\t\t\t\t[ id ]: newValue,\n\t\t\t} ),\n\t\t[ id, onChange ]\n\t);\n\n\treturn (\n\t\t<fieldset className=\"fields-controls__template\">\n\t\t\t<Dropdown\n\t\t\t\tpopoverProps={ { placement: 'bottom-start' } }\n\t\t\t\trenderToggle={ ( { onToggle } ) => (\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\tsize=\"compact\"\n\t\t\t\t\t\tonClick={ onToggle }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ currentTemplate\n\t\t\t\t\t\t\t? getItemTitle( currentTemplate )\n\t\t\t\t\t\t\t: '' }\n\t\t\t\t\t</Button>\n\t\t\t\t) }\n\t\t\t\trenderContent={ ( { onToggle } ) => (\n\t\t\t\t\t<MenuGroup>\n\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tsetShowModal( true );\n\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Change template' ) }\n\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// The default template in a post is indicated by an empty string\n\t\t\t\t\t\t\tvalue !== '' && (\n\t\t\t\t\t\t\t\t<MenuItem\n\t\t\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\t\t\tonChangeControl( '' );\n\t\t\t\t\t\t\t\t\t\tonToggle();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t{ __( 'Use default template' ) }\n\t\t\t\t\t\t\t\t</MenuItem>\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t}\n\t\t\t\t\t</MenuGroup>\n\t\t\t\t) }\n\t\t\t/>\n\t\t\t{ showModal && (\n\t\t\t\t<Modal\n\t\t\t\t\ttitle={ __( 'Choose a template' ) }\n\t\t\t\t\tonRequestClose={ () => setShowModal( false ) }\n\t\t\t\t\toverlayClassName=\"fields-controls__template-modal\"\n\t\t\t\t\tisFullScreen\n\t\t\t\t>\n\t\t\t\t\t<div className=\"fields-controls__template-content\">\n\t\t\t\t\t\t<BlockPatternsList\n\t\t\t\t\t\t\tlabel={ __( 'Templates' ) }\n\t\t\t\t\t\t\tblockPatterns={ templatesAsPatterns }\n\t\t\t\t\t\t\tshownPatterns={ shownTemplates }\n\t\t\t\t\t\t\tonClickPattern={ (\n\t\t\t\t\t\t\t\ttemplate: ( typeof templatesAsPatterns )[ 0 ]\n\t\t\t\t\t\t\t) => {\n\t\t\t\t\t\t\t\tonChangeControl( template.name );\n\t\t\t\t\t\t\t\tsetShowModal( false );\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</Modal>\n\t\t\t) }\n\t\t</fieldset>\n\t);\n};\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,SAAS,aAAa,SAAS,gBAAgB;AAE/C,SAAS,aAAa;AAEtB,SAAS,SAAS,iBAAiB;AAOnC,SAAS,mCAAmC,yBAAyB;AACrE;AAAA,EACC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACM;AACP,SAAS,oBAAoB;AAC7B,SAAS,iBAAiB;AAC1B,SAAS,sBAAsB;AAC/B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAE7B,SAAS,cAAc;AA2HlB,cAYA,YAZA;AAzHL,IAAM,cAAkB,CAAC;AAElB,IAAM,eAAe,CAAE;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AACD,MAAyC;AACxC,QAAM,EAAE,GAAG,IAAI;AACf,QAAM,WAAW,KAAK;AACtB,QAAM,SACL,OAAO,KAAK,OAAO,WAAW,KAAK,KAAK,SAAU,KAAK,IAAI,EAAG;AAC/D,QAAM,OAAO,KAAK;AAElB,QAAM,EAAE,mBAAmB,UAAU,IAAI;AAAA,IACxC,CAAE,WAAY;AACb,YAAM,eACL,O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AAA,QAChC,gBAAiB,MAAM,aAAc,KAAM;AAAA,QAC3C,kBAAiB;AAAA,QACjB,cAAY;AAAA,QAEZ,8BAAC,SAAI,WAAU,qCACd;AAAA,UAAC;AAAA;AAAA,YACA,OAAQ,GAAI,WAAY;AAAA,YACxB,eAAgB;AAAA,YAChB,eAAgB;AAAA,YAChB,gBAAiB,CAChB,aACI;AACJ,8BAAiB,SAAS,IAAK;AAC/B,2BAAc,KAAM;AAAA,YACrB;AAAA;AAAA,QACD,GACD;AAAA;AAAA,IACD;AAAA,KAEF;AAEF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
// packages/fields/src/fields/template-title/index.ts
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
3
|
import { getItemTitle } from "../../actions/utils";
|
|
3
4
|
import TitleView from "../title/view";
|
|
4
|
-
|
|
5
|
+
var templateTitleField = {
|
|
5
6
|
type: "text",
|
|
6
7
|
label: __("Template"),
|
|
7
8
|
placeholder: __("No title"),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/template-title/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { Template } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\nimport TitleView from '../title/view';\n\nconst templateTitleField: Field< Template > = {\n\ttype: 'text',\n\tlabel: __( 'Template' ),\n\tplaceholder: __( 'No title' ),\n\tid: 'title',\n\tgetValue: ( { item } ) => getItemTitle( item ),\n\trender: TitleView,\n\tenableHiding: false,\n\tenableGlobalSearch: true,\n\tfilterBy: false,\n};\n\n/**\n * Title for the template entity.\n */\nexport default templateTitleField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAMnB,SAAS,oBAAoB;AAC7B,OAAO,eAAe;AAEtB,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAMnB,SAAS,oBAAoB;AAC7B,OAAO,eAAe;AAEtB,IAAM,qBAAwC;AAAA,EAC7C,MAAM;AAAA,EACN,OAAO,GAAI,UAAW;AAAA,EACtB,aAAa,GAAI,UAAW;AAAA,EAC5B,IAAI;AAAA,EACJ,UAAU,CAAE,EAAE,KAAK,MAAO,aAAc,IAAK;AAAA,EAC7C,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,UAAU;AACX;AAKA,IAAO,yBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
// packages/fields/src/fields/title/index.ts
|
|
1
2
|
import { __ } from "@wordpress/i18n";
|
|
2
3
|
import { getItemTitle } from "../../actions/utils";
|
|
3
4
|
import TitleView from "./view";
|
|
4
|
-
|
|
5
|
+
var titleField = {
|
|
5
6
|
type: "text",
|
|
6
7
|
id: "title",
|
|
7
8
|
label: __("Title"),
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/title/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { CommonPost } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\nimport TitleView from './view';\n\nconst titleField: Field< CommonPost > = {\n\ttype: 'text',\n\tid: 'title',\n\tlabel: __( 'Title' ),\n\tplaceholder: __( 'No title' ),\n\tgetValue: ( { item } ) => getItemTitle( item ),\n\trender: TitleView,\n\tenableHiding: true,\n\tenableGlobalSearch: true,\n\tfilterBy: false,\n};\n\n/**\n * Title for the any entity with a `title` property.\n * For patterns, pages or templates you should use the respective field\n * because there are some differences in the rendering, labels, etc.\n */\nexport default titleField;\n"],
|
|
5
|
-
"mappings": "AAIA,SAAS,UAAU;AAMnB,SAAS,oBAAoB;AAC7B,OAAO,eAAe;AAEtB,
|
|
5
|
+
"mappings": ";AAIA,SAAS,UAAU;AAMnB,SAAS,oBAAoB;AAC7B,OAAO,eAAe;AAEtB,IAAM,aAAkC;AAAA,EACvC,MAAM;AAAA,EACN,IAAI;AAAA,EACJ,OAAO,GAAI,OAAQ;AAAA,EACnB,aAAa,GAAI,UAAW;AAAA,EAC5B,UAAU,CAAE,EAAE,KAAK,MAAO,aAAc,IAAK;AAAA,EAC7C,QAAQ;AAAA,EACR,cAAc;AAAA,EACd,oBAAoB;AAAA,EACpB,UAAU;AACX;AAOA,IAAO,gBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
// packages/fields/src/fields/title/view.tsx
|
|
2
2
|
import clsx from "clsx";
|
|
3
3
|
import { __experimentalHStack as HStack } from "@wordpress/components";
|
|
4
4
|
import { __ } from "@wordpress/i18n";
|
|
5
5
|
import { getItemTitle } from "../../actions/utils";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
function BaseTitleView({
|
|
7
8
|
item,
|
|
8
9
|
className,
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/fields/title/view.tsx"],
|
|
4
4
|
"sourcesContent": ["/**\n * External dependencies\n */\nimport clsx from 'clsx';\nimport type { ReactNode } from 'react';\n\n/**\n * WordPress dependencies\n */\nimport { __experimentalHStack as HStack } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Internal dependencies\n */\nimport type { CommonPost } from '../../types';\nimport { getItemTitle } from '../../actions/utils';\n\nexport function BaseTitleView( {\n\titem,\n\tclassName,\n\tchildren,\n}: {\n\titem: CommonPost;\n\tclassName?: string;\n\tchildren?: ReactNode;\n} ) {\n\tconst renderedTitle = getItemTitle( item );\n\treturn (\n\t\t<HStack\n\t\t\tclassName={ clsx( 'fields-field__title', className ) }\n\t\t\talignment=\"center\"\n\t\t\tjustify=\"flex-start\"\n\t\t>\n\t\t\t<span>{ renderedTitle || __( '(no title)' ) }</span>\n\t\t\t{ children }\n\t\t</HStack>\n\t);\n}\n\nexport default function TitleView( { item }: { item: CommonPost } ) {\n\treturn <BaseTitleView item={ item } />;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";AAGA,OAAO,UAAU;AAMjB,SAAS,wBAAwB,cAAc;AAC/C,SAAS,UAAU;AAMnB,SAAS,oBAAoB;AAa3B,SAKC,KALD;AAXK,SAAS,cAAe;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACD,GAII;AACH,QAAM,gBAAgB,aAAc,IAAK;AACzC,SACC;AAAA,IAAC;AAAA;AAAA,MACA,WAAY,KAAM,uBAAuB,SAAU;AAAA,MACnD,WAAU;AAAA,MACV,SAAQ;AAAA,MAER;AAAA,4BAAC,UAAO,2BAAiB,GAAI,YAAa,GAAG;AAAA,QAC3C;AAAA;AAAA;AAAA,EACH;AAEF;AAEe,SAAR,UAA4B,EAAE,KAAK,GAA0B;AACnE,SAAO,oBAAC,iBAAc,MAAc;AACrC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/build-module/index.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts"],
|
|
4
4
|
"sourcesContent": ["export * from './fields';\nexport * from './actions';\nexport { default as CreateTemplatePartModal } from './components/create-template-part-modal';\nexport type { BasePostWithEmbeddedAuthor, BasePost, PostType } from './types';\n"],
|
|
5
|
-
"mappings": "AAAA,cAAc;AACd,cAAc;AACd,SAAoB,WAAXA,gBAA0C;",
|
|
5
|
+
"mappings": ";AAAA,cAAc;AACd,cAAc;AACd,SAAoB,WAAXA,gBAA0C;",
|
|
6
6
|
"names": ["default"]
|
|
7
7
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
// packages/fields/src/lock-unlock.ts
|
|
1
2
|
import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from "@wordpress/private-apis";
|
|
2
|
-
|
|
3
|
+
var { lock, unlock } = __dangerousOptInToUnstableAPIsOnlyForCoreModules(
|
|
3
4
|
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.",
|
|
4
5
|
"@wordpress/fields"
|
|
5
6
|
);
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/lock-unlock.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.',\n\t\t'@wordpress/fields'\n\t);\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,wDAAwD;AAC1D,
|
|
5
|
+
"mappings": ";AAGA,SAAS,wDAAwD;AAC1D,IAAM,EAAE,MAAM,OAAO,IAC3B;AAAA,EACC;AAAA,EACA;AACD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// packages/fields/src/mutation/index.ts
|
|
1
2
|
import { store as noticesStore } from "@wordpress/notices";
|
|
2
3
|
import { store as coreStore } from "@wordpress/core-data";
|
|
3
4
|
import { dispatch } from "@wordpress/data";
|
|
@@ -21,7 +22,7 @@ function getErrorMessagesFromPromises(allSettledResults) {
|
|
|
21
22
|
}
|
|
22
23
|
return errorMessages;
|
|
23
24
|
}
|
|
24
|
-
|
|
25
|
+
var deletePostWithNotices = async (posts, notice, callbacks) => {
|
|
25
26
|
const { createSuccessNotice, createErrorNotice } = dispatch(noticesStore);
|
|
26
27
|
const { deleteEntityRecord } = dispatch(coreStore);
|
|
27
28
|
const allSettledResults = await Promise.allSettled(
|
|
@@ -62,7 +63,7 @@ const deletePostWithNotices = async (posts, notice, callbacks) => {
|
|
|
62
63
|
callbacks.onActionError?.();
|
|
63
64
|
}
|
|
64
65
|
};
|
|
65
|
-
|
|
66
|
+
var editPostWithNotices = async (postsWithUpdates, notice, callbacks) => {
|
|
66
67
|
const { createSuccessNotice, createErrorNotice } = dispatch(noticesStore);
|
|
67
68
|
const { editEntityRecord, saveEditedEntityRecord } = dispatch(coreStore);
|
|
68
69
|
await Promise.allSettled(
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/mutation/index.ts"],
|
|
4
4
|
"sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { store as noticesStore } from '@wordpress/notices';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { dispatch } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport type { CoreDataError, Post } from '../types';\n\nfunction getErrorMessagesFromPromises< T >(\n\tallSettledResults: PromiseSettledResult< T >[]\n) {\n\tconst errorMessages = new Set< string >();\n\t// If there was at lease one failure.\n\tif ( allSettledResults.length === 1 ) {\n\t\tconst typedError = allSettledResults[ 0 ] as {\n\t\t\treason?: CoreDataError;\n\t\t};\n\t\tif ( typedError.reason?.message ) {\n\t\t\terrorMessages.add( typedError.reason.message );\n\t\t}\n\t} else {\n\t\tconst failedPromises = allSettledResults.filter(\n\t\t\t( { status } ) => status === 'rejected'\n\t\t);\n\t\tfor ( const failedPromise of failedPromises ) {\n\t\t\tconst typedError = failedPromise as {\n\t\t\t\treason?: CoreDataError;\n\t\t\t};\n\t\t\tif ( typedError.reason?.message ) {\n\t\t\t\terrorMessages.add( typedError.reason.message );\n\t\t\t}\n\t\t}\n\t}\n\treturn errorMessages;\n}\n\nexport type NoticeSettings< T extends Post > = {\n\tsuccess: {\n\t\tid?: string;\n\t\ttype?: string;\n\t\tmessages: {\n\t\t\tgetMessage: ( posts: T ) => string;\n\t\t\tgetBatchMessage: ( posts: T[] ) => string;\n\t\t};\n\t};\n\terror: {\n\t\tid?: string;\n\t\ttype?: string;\n\t\tmessages: {\n\t\t\tgetMessage: ( errors: Set< string > ) => string;\n\t\t\tgetBatchMessage: ( errors: Set< string > ) => string;\n\t\t};\n\t};\n};\n\nexport const deletePostWithNotices = async < T extends Post >(\n\tposts: T[],\n\tnotice: NoticeSettings< T >,\n\tcallbacks: {\n\t\tonActionPerformed?: ( posts: T[] ) => void;\n\t\tonActionError?: () => void;\n\t}\n) => {\n\tconst { createSuccessNotice, createErrorNotice } = dispatch( noticesStore );\n\tconst { deleteEntityRecord } = dispatch( coreStore );\n\tconst allSettledResults = await Promise.allSettled(\n\t\tposts.map( ( post ) => {\n\t\t\treturn deleteEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpost.type,\n\t\t\t\tpost.id,\n\t\t\t\t{ force: true },\n\t\t\t\t{ throwOnError: true }\n\t\t\t);\n\t\t} )\n\t);\n\t// If all the promises were fulfilled with success.\n\tif ( allSettledResults.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\tlet successMessage;\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\tsuccessMessage = notice.success.messages.getMessage( posts[ 0 ] );\n\t\t} else {\n\t\t\tsuccessMessage = notice.success.messages.getBatchMessage( posts );\n\t\t}\n\t\tcreateSuccessNotice( successMessage, {\n\t\t\ttype: notice.success.type ?? 'snackbar',\n\t\t\tid: notice.success.id,\n\t\t} );\n\t\tcallbacks.onActionPerformed?.( posts );\n\t} else {\n\t\tconst errorMessages = getErrorMessagesFromPromises( allSettledResults );\n\t\tlet errorMessage = '';\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\terrorMessage = notice.error.messages.getMessage( errorMessages );\n\t\t} else {\n\t\t\terrorMessage =\n\t\t\t\tnotice.error.messages.getBatchMessage( errorMessages );\n\t\t}\n\n\t\tcreateErrorNotice( errorMessage, {\n\t\t\ttype: notice.error.type ?? 'snackbar',\n\t\t\tid: notice.error.id,\n\t\t} );\n\t\tcallbacks.onActionError?.();\n\t}\n};\n\nexport const editPostWithNotices = async < T extends Post >(\n\tpostsWithUpdates: {\n\t\toriginalPost: T;\n\t\tchanges: Partial< T >;\n\t}[],\n\tnotice: NoticeSettings< T >,\n\tcallbacks: {\n\t\tonActionPerformed?: ( posts: T[] ) => void;\n\t\tonActionError?: () => void;\n\t}\n) => {\n\tconst { createSuccessNotice, createErrorNotice } = dispatch( noticesStore );\n\tconst { editEntityRecord, saveEditedEntityRecord } = dispatch( coreStore );\n\tawait Promise.allSettled(\n\t\tpostsWithUpdates.map( ( post ) => {\n\t\t\treturn editEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpost.originalPost.type,\n\t\t\t\tpost.originalPost.id,\n\t\t\t\t{\n\t\t\t\t\t...post.changes,\n\t\t\t\t}\n\t\t\t);\n\t\t} )\n\t);\n\tconst allSettledResults = await Promise.allSettled(\n\t\tpostsWithUpdates.map( ( post ) => {\n\t\t\treturn saveEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\tpost.originalPost.type,\n\t\t\t\tpost.originalPost.id,\n\t\t\t\t{\n\t\t\t\t\tthrowOnError: true,\n\t\t\t\t}\n\t\t\t);\n\t\t} )\n\t);\n\t// If all the promises were fulfilled with success.\n\tif ( allSettledResults.every( ( { status } ) => status === 'fulfilled' ) ) {\n\t\tlet successMessage;\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\tsuccessMessage = notice.success.messages.getMessage(\n\t\t\t\tpostsWithUpdates[ 0 ].originalPost\n\t\t\t);\n\t\t} else {\n\t\t\tsuccessMessage = notice.success.messages.getBatchMessage(\n\t\t\t\tpostsWithUpdates.map( ( post ) => post.originalPost )\n\t\t\t);\n\t\t}\n\t\tcreateSuccessNotice( successMessage, {\n\t\t\ttype: notice.success.type ?? 'snackbar',\n\t\t\tid: notice.success.id,\n\t\t} );\n\t\tcallbacks.onActionPerformed?.(\n\t\t\tpostsWithUpdates.map( ( post ) => post.originalPost )\n\t\t);\n\t} else {\n\t\tconst errorMessages = getErrorMessagesFromPromises( allSettledResults );\n\t\tlet errorMessage = '';\n\t\tif ( allSettledResults.length === 1 ) {\n\t\t\terrorMessage = notice.error.messages.getMessage( errorMessages );\n\t\t} else {\n\t\t\terrorMessage =\n\t\t\t\tnotice.error.messages.getBatchMessage( errorMessages );\n\t\t}\n\n\t\tcreateErrorNotice( errorMessage, {\n\t\t\ttype: notice.error.type ?? 'snackbar',\n\t\t\tid: notice.error.id,\n\t\t} );\n\t\tcallbacks.onActionError?.();\n\t}\n};\n"],
|
|
5
|
-
"mappings": "AAGA,SAAS,SAAS,oBAAoB;AACtC,SAAS,SAAS,iBAAiB;AACnC,SAAS,gBAAgB;AAOzB,SAAS,6BACR,mBACC;AACD,QAAM,gBAAgB,oBAAI,IAAc;AAExC,MAAK,kBAAkB,WAAW,GAAI;AACrC,UAAM,aAAa,kBAAmB,CAAE;AAGxC,QAAK,WAAW,QAAQ,SAAU;AACjC,oBAAc,IAAK,WAAW,OAAO,OAAQ;AAAA,IAC9C;AAAA,EACD,OAAO;AACN,UAAM,iBAAiB,kBAAkB;AAAA,MACxC,CAAE,EAAE,OAAO,MAAO,WAAW;AAAA,IAC9B;AACA,eAAY,iBAAiB,gBAAiB;AAC7C,YAAM,aAAa;AAGnB,UAAK,WAAW,QAAQ,SAAU;AACjC,sBAAc,IAAK,WAAW,OAAO,OAAQ;AAAA,MAC9C;AAAA,IACD;AAAA,EACD;AACA,SAAO;AACR;AAqBO,
|
|
5
|
+
"mappings": ";AAGA,SAAS,SAAS,oBAAoB;AACtC,SAAS,SAAS,iBAAiB;AACnC,SAAS,gBAAgB;AAOzB,SAAS,6BACR,mBACC;AACD,QAAM,gBAAgB,oBAAI,IAAc;AAExC,MAAK,kBAAkB,WAAW,GAAI;AACrC,UAAM,aAAa,kBAAmB,CAAE;AAGxC,QAAK,WAAW,QAAQ,SAAU;AACjC,oBAAc,IAAK,WAAW,OAAO,OAAQ;AAAA,IAC9C;AAAA,EACD,OAAO;AACN,UAAM,iBAAi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