@wordpress/fields 0.0.2
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 +5 -0
- package/LICENSE.md +788 -0
- package/README.md +73 -0
- package/build/actions/base-post/duplicate-post.js +146 -0
- package/build/actions/base-post/duplicate-post.js.map +1 -0
- package/build/actions/base-post/duplicate-post.native.js +9 -0
- package/build/actions/base-post/duplicate-post.native.js.map +1 -0
- package/build/actions/base-post/index.js +42 -0
- package/build/actions/base-post/index.js.map +1 -0
- package/build/actions/base-post/reorder-page.js +116 -0
- package/build/actions/base-post/reorder-page.js.map +1 -0
- package/build/actions/base-post/reorder-page.native.js +9 -0
- package/build/actions/base-post/reorder-page.native.js.map +1 -0
- package/build/actions/base-post/view-post.js +36 -0
- package/build/actions/base-post/view-post.js.map +1 -0
- package/build/actions/common/index.js +21 -0
- package/build/actions/common/index.js.map +1 -0
- package/build/actions/common/permanently-delete-post.js +109 -0
- package/build/actions/common/permanently-delete-post.js.map +1 -0
- package/build/actions/common/view-post-revisions.js +49 -0
- package/build/actions/common/view-post-revisions.js.map +1 -0
- package/build/actions/index.js +39 -0
- package/build/actions/index.js.map +1 -0
- package/build/actions/pattern/duplicate-pattern.js +48 -0
- package/build/actions/pattern/duplicate-pattern.js.map +1 -0
- package/build/actions/pattern/export-pattern.js +57 -0
- package/build/actions/pattern/export-pattern.js.map +1 -0
- package/build/actions/pattern/export-pattern.native.js +9 -0
- package/build/actions/pattern/export-pattern.native.js.map +1 -0
- package/build/actions/pattern/index.js +28 -0
- package/build/actions/pattern/index.js.map +1 -0
- package/build/actions/utils.js +65 -0
- package/build/actions/utils.js.map +1 -0
- package/build/fields/index.js +21 -0
- package/build/fields/index.js.map +1 -0
- package/build/fields/order/index.js +23 -0
- package/build/fields/order/index.js.map +1 -0
- package/build/fields/title/index.js +27 -0
- package/build/fields/title/index.js.map +1 -0
- package/build/index.js +28 -0
- package/build/index.js.map +1 -0
- package/build/index.native.js +28 -0
- package/build/index.native.js.map +1 -0
- package/build/lock-unlock.js +18 -0
- package/build/lock-unlock.js.map +1 -0
- package/build/types.js +6 -0
- package/build/types.js.map +1 -0
- package/build/wordpress-editor.d.js +2 -0
- package/build/wordpress-editor.d.js.map +1 -0
- package/build-module/actions/base-post/duplicate-post.js +139 -0
- package/build-module/actions/base-post/duplicate-post.js.map +1 -0
- package/build-module/actions/base-post/duplicate-post.native.js +3 -0
- package/build-module/actions/base-post/duplicate-post.native.js.map +1 -0
- package/build-module/actions/base-post/index.js +6 -0
- package/build-module/actions/base-post/index.js.map +1 -0
- package/build-module/actions/base-post/reorder-page.js +111 -0
- package/build-module/actions/base-post/reorder-page.js.map +1 -0
- package/build-module/actions/base-post/reorder-page.native.js +3 -0
- package/build-module/actions/base-post/reorder-page.native.js.map +1 -0
- package/build-module/actions/base-post/view-post.js +30 -0
- package/build-module/actions/base-post/view-post.js.map +1 -0
- package/build-module/actions/common/index.js +3 -0
- package/build-module/actions/common/index.js.map +1 -0
- package/build-module/actions/common/permanently-delete-post.js +102 -0
- package/build-module/actions/common/permanently-delete-post.js.map +1 -0
- package/build-module/actions/common/view-post-revisions.js +43 -0
- package/build-module/actions/common/view-post-revisions.js.map +1 -0
- package/build-module/actions/index.js +4 -0
- package/build-module/actions/index.js.map +1 -0
- package/build-module/actions/pattern/duplicate-pattern.js +39 -0
- package/build-module/actions/pattern/duplicate-pattern.js.map +1 -0
- package/build-module/actions/pattern/export-pattern.js +51 -0
- package/build-module/actions/pattern/export-pattern.js.map +1 -0
- package/build-module/actions/pattern/export-pattern.native.js +3 -0
- package/build-module/actions/pattern/export-pattern.native.js.map +1 -0
- package/build-module/actions/pattern/index.js +4 -0
- package/build-module/actions/pattern/index.js.map +1 -0
- package/build-module/actions/utils.js +54 -0
- package/build-module/actions/utils.js.map +1 -0
- package/build-module/fields/index.js +3 -0
- package/build-module/fields/index.js.map +1 -0
- package/build-module/fields/order/index.js +17 -0
- package/build-module/fields/order/index.js.map +1 -0
- package/build-module/fields/title/index.js +22 -0
- package/build-module/fields/title/index.js.map +1 -0
- package/build-module/index.js +3 -0
- package/build-module/index.js.map +1 -0
- package/build-module/index.native.js +3 -0
- package/build-module/index.native.js.map +1 -0
- package/build-module/lock-unlock.js +9 -0
- package/build-module/lock-unlock.js.map +1 -0
- package/build-module/types.js +2 -0
- package/build-module/types.js.map +1 -0
- package/build-module/wordpress-editor.d.js +2 -0
- package/build-module/wordpress-editor.d.js.map +1 -0
- package/build-types/actions/base-post/duplicate-post.d.ts +5 -0
- package/build-types/actions/base-post/duplicate-post.d.ts.map +1 -0
- package/build-types/actions/base-post/duplicate-post.native.d.ts +3 -0
- package/build-types/actions/base-post/duplicate-post.native.d.ts.map +1 -0
- package/build-types/actions/base-post/index.d.ts +6 -0
- package/build-types/actions/base-post/index.d.ts.map +1 -0
- package/build-types/actions/base-post/reorder-page.d.ts +8 -0
- package/build-types/actions/base-post/reorder-page.d.ts.map +1 -0
- package/build-types/actions/base-post/reorder-page.native.d.ts +3 -0
- package/build-types/actions/base-post/reorder-page.native.d.ts.map +1 -0
- package/build-types/actions/base-post/view-post.d.ts +8 -0
- package/build-types/actions/base-post/view-post.d.ts.map +1 -0
- package/build-types/actions/common/index.d.ts +3 -0
- package/build-types/actions/common/index.d.ts.map +1 -0
- package/build-types/actions/common/permanently-delete-post.d.ts +5 -0
- package/build-types/actions/common/permanently-delete-post.d.ts.map +1 -0
- package/build-types/actions/common/view-post-revisions.d.ts +8 -0
- package/build-types/actions/common/view-post-revisions.d.ts.map +1 -0
- package/build-types/actions/index.d.ts +4 -0
- package/build-types/actions/index.d.ts.map +1 -0
- package/build-types/actions/pattern/duplicate-pattern.d.ts +5 -0
- package/build-types/actions/pattern/duplicate-pattern.d.ts.map +1 -0
- package/build-types/actions/pattern/export-pattern.d.ts +8 -0
- package/build-types/actions/pattern/export-pattern.d.ts.map +1 -0
- package/build-types/actions/pattern/export-pattern.native.d.ts +3 -0
- package/build-types/actions/pattern/export-pattern.native.d.ts.map +1 -0
- package/build-types/actions/pattern/index.d.ts +4 -0
- package/build-types/actions/pattern/index.d.ts.map +1 -0
- package/build-types/actions/utils.d.ts +23 -0
- package/build-types/actions/utils.d.ts.map +1 -0
- package/build-types/fields/index.d.ts +3 -0
- package/build-types/fields/index.d.ts.map +1 -0
- package/build-types/fields/order/index.d.ts +11 -0
- package/build-types/fields/order/index.d.ts.map +1 -0
- package/build-types/fields/title/index.d.ts +11 -0
- package/build-types/fields/title/index.d.ts.map +1 -0
- package/build-types/index.d.ts +3 -0
- package/build-types/index.d.ts.map +1 -0
- package/build-types/index.native.d.ts +3 -0
- package/build-types/index.native.d.ts.map +1 -0
- package/build-types/lock-unlock.d.ts +2 -0
- package/build-types/lock-unlock.d.ts.map +1 -0
- package/build-types/types.d.ts +92 -0
- package/build-types/types.d.ts.map +1 -0
- package/package.json +63 -0
- package/src/actions/base-post/duplicate-post.native.tsx +3 -0
- package/src/actions/base-post/duplicate-post.tsx +174 -0
- package/src/actions/base-post/index.ts +5 -0
- package/src/actions/base-post/reorder-page.native.tsx +3 -0
- package/src/actions/base-post/reorder-page.tsx +125 -0
- package/src/actions/base-post/view-post.tsx +30 -0
- package/src/actions/common/index.ts +2 -0
- package/src/actions/common/permanently-delete-post.tsx +118 -0
- package/src/actions/common/view-post-revisions.tsx +47 -0
- package/src/actions/index.ts +3 -0
- package/src/actions/pattern/duplicate-pattern.tsx +40 -0
- package/src/actions/pattern/export-pattern.native.tsx +3 -0
- package/src/actions/pattern/export-pattern.tsx +76 -0
- package/src/actions/pattern/index.ts +3 -0
- package/src/actions/utils.ts +66 -0
- package/src/fields/index.ts +2 -0
- package/src/fields/order/index.ts +18 -0
- package/src/fields/title/index.ts +21 -0
- package/src/index.native.ts +2 -0
- package/src/index.ts +2 -0
- package/src/lock-unlock.ts +9 -0
- package/src/types.ts +85 -0
- package/src/wordpress-editor.d.ts +1 -0
- package/tsconfig.json +29 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _url = require("@wordpress/url");
|
|
8
|
+
var _i18n = require("@wordpress/i18n");
|
|
9
|
+
/**
|
|
10
|
+
* WordPress dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const viewPostRevisions = {
|
|
18
|
+
id: 'view-post-revisions',
|
|
19
|
+
context: 'list',
|
|
20
|
+
label(items) {
|
|
21
|
+
var _items$0$_links$versi;
|
|
22
|
+
const revisionsCount = (_items$0$_links$versi = items[0]._links?.['version-history']?.[0]?.count) !== null && _items$0$_links$versi !== void 0 ? _items$0$_links$versi : 0;
|
|
23
|
+
return (0, _i18n.sprintf)( /* translators: %s: number of revisions */
|
|
24
|
+
(0, _i18n.__)('View revisions (%s)'), revisionsCount);
|
|
25
|
+
},
|
|
26
|
+
isEligible(post) {
|
|
27
|
+
var _post$_links$predeces, _post$_links$version;
|
|
28
|
+
if (post.status === 'trash') {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
const lastRevisionId = (_post$_links$predeces = post?._links?.['predecessor-version']?.[0]?.id) !== null && _post$_links$predeces !== void 0 ? _post$_links$predeces : null;
|
|
32
|
+
const revisionsCount = (_post$_links$version = post?._links?.['version-history']?.[0]?.count) !== null && _post$_links$version !== void 0 ? _post$_links$version : 0;
|
|
33
|
+
return !!lastRevisionId && revisionsCount > 1;
|
|
34
|
+
},
|
|
35
|
+
callback(posts, {
|
|
36
|
+
onActionPerformed
|
|
37
|
+
}) {
|
|
38
|
+
const post = posts[0];
|
|
39
|
+
const href = (0, _url.addQueryArgs)('revision.php', {
|
|
40
|
+
revision: post?._links?.['predecessor-version']?.[0]?.id
|
|
41
|
+
});
|
|
42
|
+
document.location.href = href;
|
|
43
|
+
if (onActionPerformed) {
|
|
44
|
+
onActionPerformed(posts);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var _default = exports.default = viewPostRevisions;
|
|
49
|
+
//# sourceMappingURL=view-post-revisions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_url","require","_i18n","viewPostRevisions","id","context","label","items","_items$0$_links$versi","revisionsCount","_links","count","sprintf","__","isEligible","post","_post$_links$predeces","_post$_links$version","status","lastRevisionId","callback","posts","onActionPerformed","href","addQueryArgs","revision","document","location","_default","exports","default"],"sources":["@wordpress/fields/src/actions/common/view-post-revisions.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport { __, sprintf } from '@wordpress/i18n';\nimport type { Action } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { Post } from '../../types';\n\nconst viewPostRevisions: Action< Post > = {\n\tid: 'view-post-revisions',\n\tcontext: 'list',\n\tlabel( items ) {\n\t\tconst revisionsCount =\n\t\t\titems[ 0 ]._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn sprintf(\n\t\t\t/* translators: %s: number of revisions */\n\t\t\t__( 'View revisions (%s)' ),\n\t\t\trevisionsCount\n\t\t);\n\t},\n\tisEligible( post ) {\n\t\tif ( post.status === 'trash' ) {\n\t\t\treturn false;\n\t\t}\n\t\tconst lastRevisionId =\n\t\t\tpost?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id ?? null;\n\t\tconst revisionsCount =\n\t\t\tpost?._links?.[ 'version-history' ]?.[ 0 ]?.count ?? 0;\n\t\treturn !! lastRevisionId && revisionsCount > 1;\n\t},\n\tcallback( posts, { onActionPerformed } ) {\n\t\tconst post = posts[ 0 ];\n\t\tconst href = addQueryArgs( 'revision.php', {\n\t\t\trevision: post?._links?.[ 'predecessor-version' ]?.[ 0 ]?.id,\n\t\t} );\n\t\tdocument.location.href = href;\n\t\tif ( onActionPerformed ) {\n\t\t\tonActionPerformed( posts );\n\t\t}\n\t},\n};\n\nexport default viewPostRevisions;\n"],"mappings":";;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAKA;AACA;AACA;;AAGA,MAAME,iBAAiC,GAAG;EACzCC,EAAE,EAAE,qBAAqB;EACzBC,OAAO,EAAE,MAAM;EACfC,KAAKA,CAAEC,KAAK,EAAG;IAAA,IAAAC,qBAAA;IACd,MAAMC,cAAc,IAAAD,qBAAA,GACnBD,KAAK,CAAE,CAAC,CAAE,CAACG,MAAM,GAAI,iBAAiB,CAAE,GAAI,CAAC,CAAE,EAAEC,KAAK,cAAAH,qBAAA,cAAAA,qBAAA,GAAI,CAAC;IAC5D,OAAO,IAAAI,aAAO,GACb;IACA,IAAAC,QAAE,EAAE,qBAAsB,CAAC,EAC3BJ,cACD,CAAC;EACF,CAAC;EACDK,UAAUA,CAAEC,IAAI,EAAG;IAAA,IAAAC,qBAAA,EAAAC,oBAAA;IAClB,IAAKF,IAAI,CAACG,MAAM,KAAK,OAAO,EAAG;MAC9B,OAAO,KAAK;IACb;IACA,MAAMC,cAAc,IAAAH,qBAAA,GACnBD,IAAI,EAAEL,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEN,EAAE,cAAAY,qBAAA,cAAAA,qBAAA,GAAI,IAAI;IAC3D,MAAMP,cAAc,IAAAQ,oBAAA,GACnBF,IAAI,EAAEL,MAAM,GAAI,iBAAiB,CAAE,GAAI,CAAC,CAAE,EAAEC,KAAK,cAAAM,oBAAA,cAAAA,oBAAA,GAAI,CAAC;IACvD,OAAO,CAAC,CAAEE,cAAc,IAAIV,cAAc,GAAG,CAAC;EAC/C,CAAC;EACDW,QAAQA,CAAEC,KAAK,EAAE;IAAEC;EAAkB,CAAC,EAAG;IACxC,MAAMP,IAAI,GAAGM,KAAK,CAAE,CAAC,CAAE;IACvB,MAAME,IAAI,GAAG,IAAAC,iBAAY,EAAE,cAAc,EAAE;MAC1CC,QAAQ,EAAEV,IAAI,EAAEL,MAAM,GAAI,qBAAqB,CAAE,GAAI,CAAC,CAAE,EAAEN;IAC3D,CAAE,CAAC;IACHsB,QAAQ,CAACC,QAAQ,CAACJ,IAAI,GAAGA,IAAI;IAC7B,IAAKD,iBAAiB,EAAG;MACxBA,iBAAiB,CAAED,KAAM,CAAC;IAC3B;EACD;AACD,CAAC;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEa3B,iBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _basePost = require("./base-post");
|
|
7
|
+
Object.keys(_basePost).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _basePost[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _basePost[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _common = require("./common");
|
|
18
|
+
Object.keys(_common).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _common[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _common[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
var _pattern = require("./pattern");
|
|
29
|
+
Object.keys(_pattern).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _pattern[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _pattern[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_basePost","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_common","_pattern"],"sources":["@wordpress/fields/src/actions/index.ts"],"sourcesContent":["export * from './base-post';\nexport * from './common';\nexport * from './pattern';\n"],"mappings":";;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,SAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,SAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,SAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,OAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,OAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,OAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,OAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,QAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,QAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,QAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,QAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
var _patterns = require("@wordpress/patterns");
|
|
9
|
+
var _lockUnlock = require("../../lock-unlock");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
/**
|
|
12
|
+
* WordPress dependencies
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
// Patterns.
|
|
22
|
+
const {
|
|
23
|
+
CreatePatternModalContents,
|
|
24
|
+
useDuplicatePatternProps
|
|
25
|
+
} = (0, _lockUnlock.unlock)(_patterns.privateApis);
|
|
26
|
+
const duplicatePattern = {
|
|
27
|
+
id: 'duplicate-pattern',
|
|
28
|
+
label: (0, _i18n._x)('Duplicate', 'action label'),
|
|
29
|
+
isEligible: item => item.type !== 'wp_template_part',
|
|
30
|
+
modalHeader: (0, _i18n._x)('Duplicate pattern', 'action label'),
|
|
31
|
+
RenderModal: ({
|
|
32
|
+
items,
|
|
33
|
+
closeModal
|
|
34
|
+
}) => {
|
|
35
|
+
const [item] = items;
|
|
36
|
+
const duplicatedProps = useDuplicatePatternProps({
|
|
37
|
+
pattern: item,
|
|
38
|
+
onSuccess: () => closeModal?.()
|
|
39
|
+
});
|
|
40
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(CreatePatternModalContents, {
|
|
41
|
+
onClose: closeModal,
|
|
42
|
+
confirmLabel: (0, _i18n._x)('Duplicate', 'action label'),
|
|
43
|
+
...duplicatedProps
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var _default = exports.default = duplicatePattern;
|
|
48
|
+
//# sourceMappingURL=duplicate-pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_patterns","_lockUnlock","_jsxRuntime","CreatePatternModalContents","useDuplicatePatternProps","unlock","patternsPrivateApis","duplicatePattern","id","label","_x","isEligible","item","type","modalHeader","RenderModal","items","closeModal","duplicatedProps","pattern","onSuccess","jsx","onClose","confirmLabel","_default","exports","default"],"sources":["@wordpress/fields/src/actions/pattern/duplicate-pattern.tsx"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { _x } from '@wordpress/i18n';\n// @ts-ignore\nimport { privateApis as patternsPrivateApis } from '@wordpress/patterns';\nimport type { Action } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport { unlock } from '../../lock-unlock';\nimport type { Pattern } from '../../types';\n\n// Patterns.\nconst { CreatePatternModalContents, useDuplicatePatternProps } =\n\tunlock( patternsPrivateApis );\n\nconst duplicatePattern: Action< Pattern > = {\n\tid: 'duplicate-pattern',\n\tlabel: _x( 'Duplicate', 'action label' ),\n\tisEligible: ( item ) => item.type !== 'wp_template_part',\n\tmodalHeader: _x( 'Duplicate pattern', 'action label' ),\n\tRenderModal: ( { items, closeModal } ) => {\n\t\tconst [ item ] = items;\n\t\tconst duplicatedProps = useDuplicatePatternProps( {\n\t\t\tpattern: item,\n\t\t\tonSuccess: () => closeModal?.(),\n\t\t} );\n\t\treturn (\n\t\t\t<CreatePatternModalContents\n\t\t\t\tonClose={ closeModal }\n\t\t\t\tconfirmLabel={ _x( 'Duplicate', 'action label' ) }\n\t\t\t\t{ ...duplicatedProps }\n\t\t\t/>\n\t\t);\n\t},\n};\n\nexport default duplicatePattern;\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAEA,IAAAC,SAAA,GAAAD,OAAA;AAMA,IAAAE,WAAA,GAAAF,OAAA;AAA2C,IAAAG,WAAA,GAAAH,OAAA;AAX3C;AACA;AACA;;AAEA;;AAIA;AACA;AACA;;AAIA;AACA,MAAM;EAAEI,0BAA0B;EAAEC;AAAyB,CAAC,GAC7D,IAAAC,kBAAM,EAAEC,qBAAoB,CAAC;AAE9B,MAAMC,gBAAmC,GAAG;EAC3CC,EAAE,EAAE,mBAAmB;EACvBC,KAAK,EAAE,IAAAC,QAAE,EAAE,WAAW,EAAE,cAAe,CAAC;EACxCC,UAAU,EAAIC,IAAI,IAAMA,IAAI,CAACC,IAAI,KAAK,kBAAkB;EACxDC,WAAW,EAAE,IAAAJ,QAAE,EAAE,mBAAmB,EAAE,cAAe,CAAC;EACtDK,WAAW,EAAEA,CAAE;IAAEC,KAAK;IAAEC;EAAW,CAAC,KAAM;IACzC,MAAM,CAAEL,IAAI,CAAE,GAAGI,KAAK;IACtB,MAAME,eAAe,GAAGd,wBAAwB,CAAE;MACjDe,OAAO,EAAEP,IAAI;MACbQ,SAAS,EAAEA,CAAA,KAAMH,UAAU,GAAG;IAC/B,CAAE,CAAC;IACH,oBACC,IAAAf,WAAA,CAAAmB,GAAA,EAAClB,0BAA0B;MAC1BmB,OAAO,EAAGL,UAAY;MACtBM,YAAY,EAAG,IAAAb,QAAE,EAAE,WAAW,EAAE,cAAe,CAAG;MAAA,GAC7CQ;IAAe,CACpB,CAAC;EAEJ;AACD,CAAC;AAAC,IAAAM,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEanB,gBAAgB","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _changeCase = require("change-case");
|
|
8
|
+
var _clientZip = require("client-zip");
|
|
9
|
+
var _blob = require("@wordpress/blob");
|
|
10
|
+
var _i18n = require("@wordpress/i18n");
|
|
11
|
+
var _icons = require("@wordpress/icons");
|
|
12
|
+
var _utils = require("../utils");
|
|
13
|
+
/**
|
|
14
|
+
* External dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* WordPress dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Internal dependencies
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
function getJsonFromItem(item) {
|
|
26
|
+
return JSON.stringify({
|
|
27
|
+
__file: item.type,
|
|
28
|
+
title: (0, _utils.getItemTitle)(item),
|
|
29
|
+
content: typeof item.content === 'string' ? item.content : item.content?.raw,
|
|
30
|
+
syncStatus: item.wp_pattern_sync_status
|
|
31
|
+
}, null, 2);
|
|
32
|
+
}
|
|
33
|
+
const exportPattern = {
|
|
34
|
+
id: 'export-pattern',
|
|
35
|
+
label: (0, _i18n.__)('Export as JSON'),
|
|
36
|
+
icon: _icons.download,
|
|
37
|
+
supportsBulk: true,
|
|
38
|
+
isEligible: item => item.type === 'wp_block',
|
|
39
|
+
callback: async items => {
|
|
40
|
+
if (items.length === 1) {
|
|
41
|
+
return (0, _blob.downloadBlob)(`${(0, _changeCase.paramCase)((0, _utils.getItemTitle)(items[0]) || items[0].slug)}.json`, getJsonFromItem(items[0]), 'application/json');
|
|
42
|
+
}
|
|
43
|
+
const nameCount = {};
|
|
44
|
+
const filesToZip = items.map(item => {
|
|
45
|
+
const name = (0, _changeCase.paramCase)((0, _utils.getItemTitle)(item) || item.slug);
|
|
46
|
+
nameCount[name] = (nameCount[name] || 0) + 1;
|
|
47
|
+
return {
|
|
48
|
+
name: `${name + (nameCount[name] > 1 ? '-' + (nameCount[name] - 1) : '')}.json`,
|
|
49
|
+
lastModified: new Date(),
|
|
50
|
+
input: getJsonFromItem(item)
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
return (0, _blob.downloadBlob)((0, _i18n.__)('patterns-export') + '.zip', await (0, _clientZip.downloadZip)(filesToZip).blob(), 'application/zip');
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
var _default = exports.default = exportPattern;
|
|
57
|
+
//# sourceMappingURL=export-pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_changeCase","require","_clientZip","_blob","_i18n","_icons","_utils","getJsonFromItem","item","JSON","stringify","__file","type","title","getItemTitle","content","raw","syncStatus","wp_pattern_sync_status","exportPattern","id","label","__","icon","download","supportsBulk","isEligible","callback","items","length","downloadBlob","kebabCase","slug","nameCount","filesToZip","map","name","lastModified","Date","input","downloadZip","blob","_default","exports","default"],"sources":["@wordpress/fields/src/actions/pattern/export-pattern.tsx"],"sourcesContent":["/**\n * External dependencies\n */\nimport { paramCase as kebabCase } from 'change-case';\nimport { downloadZip } from 'client-zip';\n\n/**\n * WordPress dependencies\n */\nimport { downloadBlob } from '@wordpress/blob';\nimport { __ } from '@wordpress/i18n';\nimport { download } from '@wordpress/icons';\nimport type { Action } from '@wordpress/dataviews';\n\n/**\n * Internal dependencies\n */\nimport type { Pattern } from '../../types';\nimport { getItemTitle } from '../utils';\n\nfunction getJsonFromItem( item: Pattern ) {\n\treturn JSON.stringify(\n\t\t{\n\t\t\t__file: item.type,\n\t\t\ttitle: getItemTitle( item ),\n\t\t\tcontent:\n\t\t\t\ttypeof item.content === 'string'\n\t\t\t\t\t? item.content\n\t\t\t\t\t: item.content?.raw,\n\t\t\tsyncStatus: item.wp_pattern_sync_status,\n\t\t},\n\t\tnull,\n\t\t2\n\t);\n}\n\nconst exportPattern: Action< Pattern > = {\n\tid: 'export-pattern',\n\tlabel: __( 'Export as JSON' ),\n\ticon: download,\n\tsupportsBulk: true,\n\tisEligible: ( item ) => item.type === 'wp_block',\n\tcallback: async ( items ) => {\n\t\tif ( items.length === 1 ) {\n\t\t\treturn downloadBlob(\n\t\t\t\t`${ kebabCase(\n\t\t\t\t\tgetItemTitle( items[ 0 ] ) || items[ 0 ].slug\n\t\t\t\t) }.json`,\n\t\t\t\tgetJsonFromItem( items[ 0 ] ),\n\t\t\t\t'application/json'\n\t\t\t);\n\t\t}\n\t\tconst nameCount: Record< string, number > = {};\n\t\tconst filesToZip = items.map( ( item ) => {\n\t\t\tconst name = kebabCase( getItemTitle( item ) || item.slug );\n\t\t\tnameCount[ name ] = ( nameCount[ name ] || 0 ) + 1;\n\t\t\treturn {\n\t\t\t\tname: `${\n\t\t\t\t\tname +\n\t\t\t\t\t( nameCount[ name ] > 1\n\t\t\t\t\t\t? '-' + ( nameCount[ name ] - 1 )\n\t\t\t\t\t\t: '' )\n\t\t\t\t}.json`,\n\t\t\t\tlastModified: new Date(),\n\t\t\t\tinput: getJsonFromItem( item ),\n\t\t\t};\n\t\t} );\n\t\treturn downloadBlob(\n\t\t\t__( 'patterns-export' ) + '.zip',\n\t\t\tawait downloadZip( filesToZip ).blob(),\n\t\t\t'application/zip'\n\t\t);\n\t},\n};\n\nexport default exportPattern;\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAKA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AAOA,IAAAK,MAAA,GAAAL,OAAA;AAlBA;AACA;AACA;;AAIA;AACA;AACA;;AAMA;AACA;AACA;;AAIA,SAASM,eAAeA,CAAEC,IAAa,EAAG;EACzC,OAAOC,IAAI,CAACC,SAAS,CACpB;IACCC,MAAM,EAAEH,IAAI,CAACI,IAAI;IACjBC,KAAK,EAAE,IAAAC,mBAAY,EAAEN,IAAK,CAAC;IAC3BO,OAAO,EACN,OAAOP,IAAI,CAACO,OAAO,KAAK,QAAQ,GAC7BP,IAAI,CAACO,OAAO,GACZP,IAAI,CAACO,OAAO,EAAEC,GAAG;IACrBC,UAAU,EAAET,IAAI,CAACU;EAClB,CAAC,EACD,IAAI,EACJ,CACD,CAAC;AACF;AAEA,MAAMC,aAAgC,GAAG;EACxCC,EAAE,EAAE,gBAAgB;EACpBC,KAAK,EAAE,IAAAC,QAAE,EAAE,gBAAiB,CAAC;EAC7BC,IAAI,EAAEC,eAAQ;EACdC,YAAY,EAAE,IAAI;EAClBC,UAAU,EAAIlB,IAAI,IAAMA,IAAI,CAACI,IAAI,KAAK,UAAU;EAChDe,QAAQ,EAAE,MAAQC,KAAK,IAAM;IAC5B,IAAKA,KAAK,CAACC,MAAM,KAAK,CAAC,EAAG;MACzB,OAAO,IAAAC,kBAAY,EACjB,GAAG,IAAAC,qBAAS,EACZ,IAAAjB,mBAAY,EAAEc,KAAK,CAAE,CAAC,CAAG,CAAC,IAAIA,KAAK,CAAE,CAAC,CAAE,CAACI,IAC1C,CAAG,OAAM,EACTzB,eAAe,CAAEqB,KAAK,CAAE,CAAC,CAAG,CAAC,EAC7B,kBACD,CAAC;IACF;IACA,MAAMK,SAAmC,GAAG,CAAC,CAAC;IAC9C,MAAMC,UAAU,GAAGN,KAAK,CAACO,GAAG,CAAI3B,IAAI,IAAM;MACzC,MAAM4B,IAAI,GAAG,IAAAL,qBAAS,EAAE,IAAAjB,mBAAY,EAAEN,IAAK,CAAC,IAAIA,IAAI,CAACwB,IAAK,CAAC;MAC3DC,SAAS,CAAEG,IAAI,CAAE,GAAG,CAAEH,SAAS,CAAEG,IAAI,CAAE,IAAI,CAAC,IAAK,CAAC;MAClD,OAAO;QACNA,IAAI,EAAG,GACNA,IAAI,IACFH,SAAS,CAAEG,IAAI,CAAE,GAAG,CAAC,GACpB,GAAG,IAAKH,SAAS,CAAEG,IAAI,CAAE,GAAG,CAAC,CAAE,GAC/B,EAAE,CACL,OAAM;QACPC,YAAY,EAAE,IAAIC,IAAI,CAAC,CAAC;QACxBC,KAAK,EAAEhC,eAAe,CAAEC,IAAK;MAC9B,CAAC;IACF,CAAE,CAAC;IACH,OAAO,IAAAsB,kBAAY,EAClB,IAAAR,QAAE,EAAE,iBAAkB,CAAC,GAAG,MAAM,EAChC,MAAM,IAAAkB,sBAAW,EAAEN,UAAW,CAAC,CAACO,IAAI,CAAC,CAAC,EACtC,iBACD,CAAC;EACF;AACD,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEazB,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["exportPattern","undefined","_default","exports","default"],"sources":["@wordpress/fields/src/actions/pattern/export-pattern.native.tsx"],"sourcesContent":["const exportPattern = undefined;\n\nexport default exportPattern;\n"],"mappings":";;;;;;AAAA,MAAMA,aAAa,GAAGC,SAAS;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEjBJ,aAAa","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "duplicatePattern", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _duplicatePattern.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "exportPattern", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _exportPattern.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "exportPatternNative", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () {
|
|
22
|
+
return _exportPattern2.default;
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
var _duplicatePattern = _interopRequireDefault(require("./duplicate-pattern"));
|
|
26
|
+
var _exportPattern = _interopRequireDefault(require("./export-pattern"));
|
|
27
|
+
var _exportPattern2 = _interopRequireDefault(require("./export-pattern.native"));
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_duplicatePattern","_interopRequireDefault","require","_exportPattern","_exportPattern2"],"sources":["@wordpress/fields/src/actions/pattern/index.ts"],"sourcesContent":["export { default as duplicatePattern } from './duplicate-pattern';\nexport { default as exportPattern } from './export-pattern';\nexport { default as exportPatternNative } from './export-pattern.native';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,cAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAH,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TEMPLATE_POST_TYPE = exports.TEMPLATE_PART_POST_TYPE = exports.TEMPLATE_ORIGINS = void 0;
|
|
7
|
+
exports.getItemTitle = getItemTitle;
|
|
8
|
+
exports.isTemplate = isTemplate;
|
|
9
|
+
exports.isTemplateOrTemplatePart = isTemplateOrTemplatePart;
|
|
10
|
+
exports.isTemplatePart = isTemplatePart;
|
|
11
|
+
exports.isTemplateRemovable = isTemplateRemovable;
|
|
12
|
+
var _htmlEntities = require("@wordpress/html-entities");
|
|
13
|
+
/**
|
|
14
|
+
* WordPress dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Internal dependencies
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const TEMPLATE_POST_TYPE = exports.TEMPLATE_POST_TYPE = 'wp_template';
|
|
22
|
+
const TEMPLATE_PART_POST_TYPE = exports.TEMPLATE_PART_POST_TYPE = 'wp_template_part';
|
|
23
|
+
const TEMPLATE_ORIGINS = exports.TEMPLATE_ORIGINS = {
|
|
24
|
+
custom: 'custom',
|
|
25
|
+
theme: 'theme',
|
|
26
|
+
plugin: 'plugin'
|
|
27
|
+
};
|
|
28
|
+
function isTemplate(post) {
|
|
29
|
+
return post.type === TEMPLATE_POST_TYPE;
|
|
30
|
+
}
|
|
31
|
+
function isTemplatePart(post) {
|
|
32
|
+
return post.type === TEMPLATE_PART_POST_TYPE;
|
|
33
|
+
}
|
|
34
|
+
function isTemplateOrTemplatePart(p) {
|
|
35
|
+
return p.type === TEMPLATE_POST_TYPE || p.type === TEMPLATE_PART_POST_TYPE;
|
|
36
|
+
}
|
|
37
|
+
function getItemTitle(item) {
|
|
38
|
+
if (typeof item.title === 'string') {
|
|
39
|
+
return (0, _htmlEntities.decodeEntities)(item.title);
|
|
40
|
+
}
|
|
41
|
+
if ('rendered' in item.title) {
|
|
42
|
+
return (0, _htmlEntities.decodeEntities)(item.title.rendered);
|
|
43
|
+
}
|
|
44
|
+
if ('raw' in item.title) {
|
|
45
|
+
return (0, _htmlEntities.decodeEntities)(item.title.raw);
|
|
46
|
+
}
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Check if a template is removable.
|
|
52
|
+
*
|
|
53
|
+
* @param template The template entity to check.
|
|
54
|
+
* @return Whether the template is removable.
|
|
55
|
+
*/
|
|
56
|
+
function isTemplateRemovable(template) {
|
|
57
|
+
if (!template) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
// In patterns list page we map the templates parts to a different object
|
|
61
|
+
// than the one returned from the endpoint. This is why we need to check for
|
|
62
|
+
// two props whether is custom or has a theme file.
|
|
63
|
+
return [template.source, template.source].includes(TEMPLATE_ORIGINS.custom) && !Boolean(template.type === 'wp_template' && template?.plugin) && !template.has_theme_file;
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_htmlEntities","require","TEMPLATE_POST_TYPE","exports","TEMPLATE_PART_POST_TYPE","TEMPLATE_ORIGINS","custom","theme","plugin","isTemplate","post","type","isTemplatePart","isTemplateOrTemplatePart","p","getItemTitle","item","title","decodeEntities","rendered","raw","isTemplateRemovable","template","source","includes","Boolean","has_theme_file"],"sources":["@wordpress/fields/src/actions/utils.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { decodeEntities } from '@wordpress/html-entities';\n\n/**\n * Internal dependencies\n */\nimport type { Post, TemplatePart, Template } from '../types';\n\nexport const TEMPLATE_POST_TYPE = 'wp_template';\nexport const TEMPLATE_PART_POST_TYPE = 'wp_template_part';\nexport const TEMPLATE_ORIGINS = {\n\tcustom: 'custom',\n\ttheme: 'theme',\n\tplugin: 'plugin',\n};\n\nexport function isTemplate( post: Post ): post is Template {\n\treturn post.type === TEMPLATE_POST_TYPE;\n}\n\nexport function isTemplatePart( post: Post ): post is TemplatePart {\n\treturn post.type === TEMPLATE_PART_POST_TYPE;\n}\n\nexport function isTemplateOrTemplatePart(\n\tp: Post\n): p is Template | TemplatePart {\n\treturn p.type === TEMPLATE_POST_TYPE || p.type === TEMPLATE_PART_POST_TYPE;\n}\n\nexport function getItemTitle( item: Post ) {\n\tif ( typeof item.title === 'string' ) {\n\t\treturn decodeEntities( item.title );\n\t}\n\tif ( 'rendered' in item.title ) {\n\t\treturn decodeEntities( item.title.rendered );\n\t}\n\tif ( 'raw' in item.title ) {\n\t\treturn decodeEntities( item.title.raw );\n\t}\n\treturn '';\n}\n\n/**\n * Check if a template is removable.\n *\n * @param template The template entity to check.\n * @return Whether the template is removable.\n */\nexport function isTemplateRemovable( template: Template | TemplatePart ) {\n\tif ( ! template ) {\n\t\treturn false;\n\t}\n\t// In patterns list page we map the templates parts to a different object\n\t// than the one returned from the endpoint. This is why we need to check for\n\t// two props whether is custom or has a theme file.\n\treturn (\n\t\t[ template.source, template.source ].includes(\n\t\t\tTEMPLATE_ORIGINS.custom\n\t\t) &&\n\t\t! Boolean( template.type === 'wp_template' && template?.plugin ) &&\n\t\t! template.has_theme_file\n\t);\n}\n"],"mappings":";;;;;;;;;;;AAGA,IAAAA,aAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAGA;AACA;AACA;;AAGO,MAAMC,kBAAkB,GAAAC,OAAA,CAAAD,kBAAA,GAAG,aAAa;AACxC,MAAME,uBAAuB,GAAAD,OAAA,CAAAC,uBAAA,GAAG,kBAAkB;AAClD,MAAMC,gBAAgB,GAAAF,OAAA,CAAAE,gBAAA,GAAG;EAC/BC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,MAAM,EAAE;AACT,CAAC;AAEM,SAASC,UAAUA,CAAEC,IAAU,EAAqB;EAC1D,OAAOA,IAAI,CAACC,IAAI,KAAKT,kBAAkB;AACxC;AAEO,SAASU,cAAcA,CAAEF,IAAU,EAAyB;EAClE,OAAOA,IAAI,CAACC,IAAI,KAAKP,uBAAuB;AAC7C;AAEO,SAASS,wBAAwBA,CACvCC,CAAO,EACwB;EAC/B,OAAOA,CAAC,CAACH,IAAI,KAAKT,kBAAkB,IAAIY,CAAC,CAACH,IAAI,KAAKP,uBAAuB;AAC3E;AAEO,SAASW,YAAYA,CAAEC,IAAU,EAAG;EAC1C,IAAK,OAAOA,IAAI,CAACC,KAAK,KAAK,QAAQ,EAAG;IACrC,OAAO,IAAAC,4BAAc,EAAEF,IAAI,CAACC,KAAM,CAAC;EACpC;EACA,IAAK,UAAU,IAAID,IAAI,CAACC,KAAK,EAAG;IAC/B,OAAO,IAAAC,4BAAc,EAAEF,IAAI,CAACC,KAAK,CAACE,QAAS,CAAC;EAC7C;EACA,IAAK,KAAK,IAAIH,IAAI,CAACC,KAAK,EAAG;IAC1B,OAAO,IAAAC,4BAAc,EAAEF,IAAI,CAACC,KAAK,CAACG,GAAI,CAAC;EACxC;EACA,OAAO,EAAE;AACV;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,mBAAmBA,CAAEC,QAAiC,EAAG;EACxE,IAAK,CAAEA,QAAQ,EAAG;IACjB,OAAO,KAAK;EACb;EACA;EACA;EACA;EACA,OACC,CAAEA,QAAQ,CAACC,MAAM,EAAED,QAAQ,CAACC,MAAM,CAAE,CAACC,QAAQ,CAC5CnB,gBAAgB,CAACC,MAClB,CAAC,IACD,CAAEmB,OAAO,CAAEH,QAAQ,CAACX,IAAI,KAAK,aAAa,IAAIW,QAAQ,EAAEd,MAAO,CAAC,IAChE,CAAEc,QAAQ,CAACI,cAAc;AAE3B","ignoreList":[]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
Object.defineProperty(exports, "orderField", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _order.default;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "titleField", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _title.default;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
var _title = _interopRequireDefault(require("./title"));
|
|
20
|
+
var _order = _interopRequireDefault(require("./order"));
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_title","_interopRequireDefault","require","_order"],"sources":["@wordpress/fields/src/fields/index.ts"],"sourcesContent":["export { default as titleField } from './title';\nexport { default as orderField } from './order';\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Internal dependencies
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
const orderField = {
|
|
17
|
+
type: 'integer',
|
|
18
|
+
id: 'menu_order',
|
|
19
|
+
label: (0, _i18n.__)('Order'),
|
|
20
|
+
description: (0, _i18n.__)('Determines the order of pages.')
|
|
21
|
+
};
|
|
22
|
+
var _default = exports.default = orderField;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","orderField","type","id","label","__","description","_default","exports","default"],"sources":["@wordpress/fields/src/fields/order/index.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport type { Field } from '@wordpress/dataviews';\nimport { __ } from '@wordpress/i18n';\n/**\n * Internal dependencies\n */\nimport type { BasePost } from '../../types';\n\nconst orderField: Field< BasePost > = {\n\ttype: 'integer',\n\tid: 'menu_order',\n\tlabel: __( 'Order' ),\n\tdescription: __( 'Determines the order of pages.' ),\n};\n\nexport default orderField;\n"],"mappings":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AAJA;AACA;AACA;;AAGA;AACA;AACA;;AAGA,MAAMC,UAA6B,GAAG;EACrCC,IAAI,EAAE,SAAS;EACfC,EAAE,EAAE,YAAY;EAChBC,KAAK,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;EACpBC,WAAW,EAAE,IAAAD,QAAE,EAAE,gCAAiC;AACnD,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaR,UAAU","ignoreList":[]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _i18n = require("@wordpress/i18n");
|
|
8
|
+
var _utils = require("../../actions/utils");
|
|
9
|
+
/**
|
|
10
|
+
* WordPress dependencies
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Internal dependencies
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
const titleField = {
|
|
18
|
+
type: 'text',
|
|
19
|
+
id: 'title',
|
|
20
|
+
label: (0, _i18n.__)('Title'),
|
|
21
|
+
placeholder: (0, _i18n.__)('No title'),
|
|
22
|
+
getValue: ({
|
|
23
|
+
item
|
|
24
|
+
}) => (0, _utils.getItemTitle)(item)
|
|
25
|
+
};
|
|
26
|
+
var _default = exports.default = titleField;
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_i18n","require","_utils","titleField","type","id","label","__","placeholder","getValue","item","getItemTitle","_default","exports","default"],"sources":["@wordpress/fields/src/fields/title/index.ts"],"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 { getItemTitle } from '../../actions/utils';\n\nconst titleField: Field< BasePost > = {\n\ttype: 'text',\n\tid: 'title',\n\tlabel: __( 'Title' ),\n\tplaceholder: __( 'No title' ),\n\tgetValue: ( { item } ) => getItemTitle( item ),\n};\n\nexport default titleField;\n"],"mappings":";;;;;;AAIA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,MAAA,GAAAD,OAAA;AAVA;AACA;AACA;;AAIA;AACA;AACA;;AAIA,MAAME,UAA6B,GAAG;EACrCC,IAAI,EAAE,MAAM;EACZC,EAAE,EAAE,OAAO;EACXC,KAAK,EAAE,IAAAC,QAAE,EAAE,OAAQ,CAAC;EACpBC,WAAW,EAAE,IAAAD,QAAE,EAAE,UAAW,CAAC;EAC7BE,QAAQ,EAAEA,CAAE;IAAEC;EAAK,CAAC,KAAM,IAAAC,mBAAY,EAAED,IAAK;AAC9C,CAAC;AAAC,IAAAE,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAEaX,UAAU","ignoreList":[]}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _fields = require("./fields");
|
|
7
|
+
Object.keys(_fields).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _fields[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _fields[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _actions = require("./actions");
|
|
18
|
+
Object.keys(_actions).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _actions[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _actions[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_fields","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_actions"],"sources":["@wordpress/fields/src/index.ts"],"sourcesContent":["export * from './fields';\nexport * from './actions';\n"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,QAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,QAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,QAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,QAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _duplicatePost = require("./actions/base-post/duplicate-post.native");
|
|
7
|
+
Object.keys(_duplicatePost).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _duplicatePost[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _duplicatePost[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
var _reorderPage = require("./actions/base-post/reorder-page.native");
|
|
18
|
+
Object.keys(_reorderPage).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _reorderPage[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () {
|
|
24
|
+
return _reorderPage[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_duplicatePost","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_reorderPage"],"sources":["@wordpress/fields/src/index.native.ts"],"sourcesContent":["export * from './actions/base-post/duplicate-post.native';\nexport * from './actions/base-post/reorder-page.native';\n"],"mappings":";;;;;AAAA,IAAAA,cAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,cAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,cAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,cAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,YAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,YAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,YAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,YAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.unlock = exports.lock = void 0;
|
|
7
|
+
var _privateApis = require("@wordpress/private-apis");
|
|
8
|
+
/**
|
|
9
|
+
* WordPress dependencies
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
lock,
|
|
14
|
+
unlock
|
|
15
|
+
} = (0, _privateApis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)('I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.', '@wordpress/fields');
|
|
16
|
+
exports.unlock = unlock;
|
|
17
|
+
exports.lock = lock;
|
|
18
|
+
//# sourceMappingURL=lock-unlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_privateApis","require","lock","unlock","__dangerousOptInToUnstableAPIsOnlyForCoreModules","exports"],"sources":["@wordpress/fields/src/lock-unlock.ts"],"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"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAEO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,+HAA+H,EAC/H,mBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA","ignoreList":[]}
|
package/build/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/fields/src/types.ts"],"sourcesContent":["type PostStatus =\n\t| 'published'\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\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}\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}\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\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};\n}\n\n// Will be unnecessary after typescript 5.0 upgrade.\nexport type CoreDataError = { message?: string; code?: string };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sources":["@wordpress/fields/src/wordpress-editor.d.ts"],"sourcesContent":["declare module '@wordpress/editor';\n"],"mappings":"","ignoreList":[]}
|