@wordpress/patterns 1.1.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE.md +788 -0
  3. package/README.md +26 -0
  4. package/build/components/create-pattern-modal.js +100 -0
  5. package/build/components/create-pattern-modal.js.map +1 -0
  6. package/build/components/index.js +32 -0
  7. package/build/components/index.js.map +1 -0
  8. package/build/components/pattern-convert-button.js +102 -0
  9. package/build/components/pattern-convert-button.js.map +1 -0
  10. package/build/components/patterns-manage-button.js +72 -0
  11. package/build/components/patterns-manage-button.js.map +1 -0
  12. package/build/index.js +18 -0
  13. package/build/index.js.map +1 -0
  14. package/build/index.native.js +19 -0
  15. package/build/index.native.js.map +1 -0
  16. package/build/lock-unlock.js +18 -0
  17. package/build/lock-unlock.js.map +1 -0
  18. package/build/private-apis.js +21 -0
  19. package/build/private-apis.js.map +1 -0
  20. package/build/store/actions.js +77 -0
  21. package/build/store/actions.js.map +1 -0
  22. package/build/store/constants.js +12 -0
  23. package/build/store/constants.js.map +1 -0
  24. package/build/store/index.js +49 -0
  25. package/build/store/index.js.map +1 -0
  26. package/build/store/reducer.js +26 -0
  27. package/build/store/reducer.js.map +1 -0
  28. package/build/store/selectors.js +17 -0
  29. package/build/store/selectors.js.map +1 -0
  30. package/build-module/components/create-pattern-modal.js +91 -0
  31. package/build-module/components/create-pattern-modal.js.map +1 -0
  32. package/build-module/components/index.js +24 -0
  33. package/build-module/components/index.js.map +1 -0
  34. package/build-module/components/pattern-convert-button.js +95 -0
  35. package/build-module/components/pattern-convert-button.js.map +1 -0
  36. package/build-module/components/patterns-manage-button.js +64 -0
  37. package/build-module/components/patterns-manage-button.js.map +1 -0
  38. package/build-module/index.js +6 -0
  39. package/build-module/index.js.map +1 -0
  40. package/build-module/index.native.js +11 -0
  41. package/build-module/index.native.js.map +1 -0
  42. package/build-module/lock-unlock.js +9 -0
  43. package/build-module/lock-unlock.js.map +1 -0
  44. package/build-module/private-apis.js +12 -0
  45. package/build-module/private-apis.js.map +1 -0
  46. package/build-module/store/actions.js +69 -0
  47. package/build-module/store/actions.js.map +1 -0
  48. package/build-module/store/constants.js +5 -0
  49. package/build-module/store/constants.js.map +1 -0
  50. package/build-module/store/index.js +38 -0
  51. package/build-module/store/index.js.map +1 -0
  52. package/build-module/store/reducer.js +17 -0
  53. package/build-module/store/reducer.js.map +1 -0
  54. package/build-module/store/selectors.js +11 -0
  55. package/build-module/store/selectors.js.map +1 -0
  56. package/build-style/style-rtl.css +108 -0
  57. package/build-style/style.css +108 -0
  58. package/package.json +55 -0
  59. package/src/components/create-pattern-modal.js +121 -0
  60. package/src/components/index.js +30 -0
  61. package/src/components/pattern-convert-button.js +123 -0
  62. package/src/components/patterns-manage-button.js +77 -0
  63. package/src/components/style.scss +3 -0
  64. package/src/index.js +6 -0
  65. package/src/index.native.js +11 -0
  66. package/src/lock-unlock.js +9 -0
  67. package/src/private-apis.js +12 -0
  68. package/src/store/actions.js +99 -0
  69. package/src/store/constants.js +4 -0
  70. package/src/store/index.js +38 -0
  71. package/src/store/reducer.js +19 -0
  72. package/src/store/selectors.js +10 -0
  73. package/src/style.scss +1 -0
package/README.md ADDED
@@ -0,0 +1,26 @@
1
+ # Patterns
2
+
3
+ > **Note**
4
+ > This package is currently only used internally by the Gutenberg project to manage the creation and editing of user patterns using the `wp_block` CPT in the context of the block editor. The likes of the `PatternsMenuItems` component expect to be rendered within a `BlockEditorProvider` in order to work.
5
+
6
+ ## Installation
7
+
8
+ Install the module
9
+
10
+ ```bash
11
+ npm install @wordpress/patterns --save
12
+ ```
13
+
14
+ _This package assumes that your code will run in an **ES2015+** environment. If you're using an environment that has limited or no support for such language features and APIs, you should include [the polyfill shipped in `@wordpress/babel-preset-default`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/babel-preset-default#polyfill) in your code._
15
+
16
+ ## Components
17
+
18
+ This package doesn't currently have any publically exported components.
19
+
20
+ ## Contributing to this package
21
+
22
+ This is an individual package that's part of the Gutenberg project. The project is organized as a monorepo. It's made up of multiple self-contained software packages, each with a specific purpose. The packages in this monorepo are published to [npm](https://www.npmjs.com/) and used by [WordPress](https://make.wordpress.org/core/) as well as other software projects.
23
+
24
+ To find out more about contributing to this package or Gutenberg as a whole, please read the project's main [contributor guide](https://github.com/WordPress/gutenberg/tree/HEAD/CONTRIBUTING.md).
25
+
26
+ <br /><br /><p align="center"><img src="https://s.w.org/style/images/codeispoetry.png?1" alt="Code is Poetry." /></p>
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.USER_PATTERN_CATEGORY = exports.SYNC_TYPES = void 0;
7
+ exports.default = CreatePatternModal;
8
+ var _element = require("@wordpress/element");
9
+ var _components = require("@wordpress/components");
10
+ var _i18n = require("@wordpress/i18n");
11
+ var _data = require("@wordpress/data");
12
+ var _notices = require("@wordpress/notices");
13
+ var _store = require("../store");
14
+ /**
15
+ * WordPress dependencies
16
+ */
17
+
18
+ const USER_PATTERN_CATEGORY = 'my-patterns';
19
+ exports.USER_PATTERN_CATEGORY = USER_PATTERN_CATEGORY;
20
+ const SYNC_TYPES = {
21
+ full: undefined,
22
+ unsynced: 'unsynced'
23
+ };
24
+
25
+ /**
26
+ * Internal dependencies
27
+ */
28
+ exports.SYNC_TYPES = SYNC_TYPES;
29
+ function CreatePatternModal({
30
+ onSuccess,
31
+ onError,
32
+ clientIds,
33
+ onClose,
34
+ className = 'patterns-menu-items__convert-modal'
35
+ }) {
36
+ const [syncType, setSyncType] = (0, _element.useState)(SYNC_TYPES.full);
37
+ const [title, setTitle] = (0, _element.useState)('');
38
+ const {
39
+ __experimentalCreatePattern: createPattern
40
+ } = (0, _data.useDispatch)(_store.store);
41
+ const {
42
+ createErrorNotice
43
+ } = (0, _data.useDispatch)(_notices.store);
44
+ const onCreate = (0, _element.useCallback)(async function (patternTitle, sync) {
45
+ try {
46
+ const newPattern = await createPattern(patternTitle, sync, clientIds);
47
+ onSuccess({
48
+ pattern: newPattern,
49
+ categoryId: USER_PATTERN_CATEGORY
50
+ });
51
+ } catch (error) {
52
+ createErrorNotice(error.message, {
53
+ type: 'snackbar',
54
+ id: 'convert-to-pattern-error'
55
+ });
56
+ onError();
57
+ }
58
+ }, [createPattern, clientIds, onSuccess, createErrorNotice, onError]);
59
+ return (0, _element.createElement)(_components.Modal, {
60
+ title: (0, _i18n.__)('Create pattern'),
61
+ onRequestClose: () => {
62
+ onClose();
63
+ setTitle('');
64
+ },
65
+ overlayClassName: className
66
+ }, (0, _element.createElement)("form", {
67
+ onSubmit: event => {
68
+ event.preventDefault();
69
+ onCreate(title, syncType);
70
+ setTitle('');
71
+ }
72
+ }, (0, _element.createElement)(_components.__experimentalVStack, {
73
+ spacing: "5"
74
+ }, (0, _element.createElement)(_components.TextControl, {
75
+ __nextHasNoMarginBottom: true,
76
+ label: (0, _i18n.__)('Name'),
77
+ value: title,
78
+ onChange: setTitle,
79
+ placeholder: (0, _i18n.__)('My pattern')
80
+ }), (0, _element.createElement)(_components.ToggleControl, {
81
+ label: (0, _i18n.__)('Synced'),
82
+ help: (0, _i18n.__)('Editing the pattern will update it anywhere it is used.'),
83
+ checked: !syncType,
84
+ onChange: () => {
85
+ setSyncType(syncType === SYNC_TYPES.full ? SYNC_TYPES.unsynced : SYNC_TYPES.full);
86
+ }
87
+ }), (0, _element.createElement)(_components.__experimentalHStack, {
88
+ justify: "right"
89
+ }, (0, _element.createElement)(_components.Button, {
90
+ variant: "tertiary",
91
+ onClick: () => {
92
+ onClose();
93
+ setTitle('');
94
+ }
95
+ }, (0, _i18n.__)('Cancel')), (0, _element.createElement)(_components.Button, {
96
+ variant: "primary",
97
+ type: "submit"
98
+ }, (0, _i18n.__)('Create'))))));
99
+ }
100
+ //# sourceMappingURL=create-pattern-modal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_components","_i18n","_data","_notices","_store","USER_PATTERN_CATEGORY","exports","SYNC_TYPES","full","undefined","unsynced","CreatePatternModal","onSuccess","onError","clientIds","onClose","className","syncType","setSyncType","useState","title","setTitle","__experimentalCreatePattern","createPattern","useDispatch","store","createErrorNotice","noticesStore","onCreate","useCallback","patternTitle","sync","newPattern","pattern","categoryId","error","message","type","id","createElement","Modal","__","onRequestClose","overlayClassName","onSubmit","event","preventDefault","__experimentalVStack","spacing","TextControl","__nextHasNoMarginBottom","label","value","onChange","placeholder","ToggleControl","help","checked","__experimentalHStack","justify","Button","variant","onClick"],"sources":["@wordpress/patterns/src/components/create-pattern-modal.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tModal,\n\tButton,\n\tTextControl,\n\t__experimentalHStack as HStack,\n\t__experimentalVStack as VStack,\n\tToggleControl,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { useState, useCallback } from '@wordpress/element';\nimport { useDispatch } from '@wordpress/data';\nimport { store as noticesStore } from '@wordpress/notices';\n\nexport const USER_PATTERN_CATEGORY = 'my-patterns';\n\nexport const SYNC_TYPES = {\n\tfull: undefined,\n\tunsynced: 'unsynced',\n};\n\n/**\n * Internal dependencies\n */\nimport { store } from '../store';\n\nexport default function CreatePatternModal( {\n\tonSuccess,\n\tonError,\n\tclientIds,\n\tonClose,\n\tclassName = 'patterns-menu-items__convert-modal',\n} ) {\n\tconst [ syncType, setSyncType ] = useState( SYNC_TYPES.full );\n\tconst [ title, setTitle ] = useState( '' );\n\tconst { __experimentalCreatePattern: createPattern } = useDispatch( store );\n\n\tconst { createErrorNotice } = useDispatch( noticesStore );\n\tconst onCreate = useCallback(\n\t\tasync function ( patternTitle, sync ) {\n\t\t\ttry {\n\t\t\t\tconst newPattern = await createPattern(\n\t\t\t\t\tpatternTitle,\n\t\t\t\t\tsync,\n\t\t\t\t\tclientIds\n\t\t\t\t);\n\t\t\t\tonSuccess( {\n\t\t\t\t\tpattern: newPattern,\n\t\t\t\t\tcategoryId: USER_PATTERN_CATEGORY,\n\t\t\t\t} );\n\t\t\t} catch ( error ) {\n\t\t\t\tcreateErrorNotice( error.message, {\n\t\t\t\t\ttype: 'snackbar',\n\t\t\t\t\tid: 'convert-to-pattern-error',\n\t\t\t\t} );\n\t\t\t\tonError();\n\t\t\t}\n\t\t},\n\t\t[ createPattern, clientIds, onSuccess, createErrorNotice, onError ]\n\t);\n\treturn (\n\t\t<Modal\n\t\t\ttitle={ __( 'Create pattern' ) }\n\t\t\tonRequestClose={ () => {\n\t\t\t\tonClose();\n\t\t\t\tsetTitle( '' );\n\t\t\t} }\n\t\t\toverlayClassName={ className }\n\t\t>\n\t\t\t<form\n\t\t\t\tonSubmit={ ( event ) => {\n\t\t\t\t\tevent.preventDefault();\n\t\t\t\t\tonCreate( title, syncType );\n\t\t\t\t\tsetTitle( '' );\n\t\t\t\t} }\n\t\t\t>\n\t\t\t\t<VStack spacing=\"5\">\n\t\t\t\t\t<TextControl\n\t\t\t\t\t\t__nextHasNoMarginBottom\n\t\t\t\t\t\tlabel={ __( 'Name' ) }\n\t\t\t\t\t\tvalue={ title }\n\t\t\t\t\t\tonChange={ setTitle }\n\t\t\t\t\t\tplaceholder={ __( 'My pattern' ) }\n\t\t\t\t\t/>\n\n\t\t\t\t\t<ToggleControl\n\t\t\t\t\t\tlabel={ __( 'Synced' ) }\n\t\t\t\t\t\thelp={ __(\n\t\t\t\t\t\t\t'Editing the pattern will update it anywhere it is used.'\n\t\t\t\t\t\t) }\n\t\t\t\t\t\tchecked={ ! syncType }\n\t\t\t\t\t\tonChange={ () => {\n\t\t\t\t\t\t\tsetSyncType(\n\t\t\t\t\t\t\t\tsyncType === SYNC_TYPES.full\n\t\t\t\t\t\t\t\t\t? SYNC_TYPES.unsynced\n\t\t\t\t\t\t\t\t\t: SYNC_TYPES.full\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t} }\n\t\t\t\t\t/>\n\t\t\t\t\t<HStack justify=\"right\">\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tvariant=\"tertiary\"\n\t\t\t\t\t\t\tonClick={ () => {\n\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\tsetTitle( '' );\n\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{ __( 'Cancel' ) }\n\t\t\t\t\t\t</Button>\n\n\t\t\t\t\t\t<Button variant=\"primary\" type=\"submit\">\n\t\t\t\t\t\t\t{ __( 'Create' ) }\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t</HStack>\n\t\t\t\t</VStack>\n\t\t\t</form>\n\t\t</Modal>\n\t);\n}\n"],"mappings":";;;;;;;AAYA,IAAAA,QAAA,GAAAC,OAAA;AATA,IAAAC,WAAA,GAAAD,OAAA;AAQA,IAAAE,KAAA,GAAAF,OAAA;AAEA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAYA,IAAAK,MAAA,GAAAL,OAAA;AA1BA;AACA;AACA;;AAcO,MAAMM,qBAAqB,GAAG,aAAa;AAACC,OAAA,CAAAD,qBAAA,GAAAA,qBAAA;AAE5C,MAAME,UAAU,GAAG;EACzBC,IAAI,EAAEC,SAAS;EACfC,QAAQ,EAAE;AACX,CAAC;;AAED;AACA;AACA;AAFAJ,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAKe,SAASI,kBAAkBA,CAAE;EAC3CC,SAAS;EACTC,OAAO;EACPC,SAAS;EACTC,OAAO;EACPC,SAAS,GAAG;AACb,CAAC,EAAG;EACH,MAAM,CAAEC,QAAQ,EAAEC,WAAW,CAAE,GAAG,IAAAC,iBAAQ,EAAEZ,UAAU,CAACC,IAAK,CAAC;EAC7D,MAAM,CAAEY,KAAK,EAAEC,QAAQ,CAAE,GAAG,IAAAF,iBAAQ,EAAE,EAAG,CAAC;EAC1C,MAAM;IAAEG,2BAA2B,EAAEC;EAAc,CAAC,GAAG,IAAAC,iBAAW,EAAEC,YAAM,CAAC;EAE3E,MAAM;IAAEC;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,MAAO,CAAG;IACtBW,KAAK,EAAGhC,KAAO;IACfiC,QAAQ,EAAGhC,QAAU;IACrBiC,WAAW,EAAG,IAAAb,QAAE,EAAE,YAAa;EAAG,CAClC,CAAC,EAEF,IAAA3C,QAAA,CAAAyC,aAAA,EAACvC,WAAA,CAAAuD,aAAa;IACbJ,KAAK,EAAG,IAAAV,QAAE,EAAE,QAAS,CAAG;IACxBe,IAAI,EAAG,IAAAf,QAAE,EACR,yDACD,CAAG;IACHgB,OAAO,EAAG,CAAExC,QAAU;IACtBoC,QAAQ,EAAGA,CAAA,KAAM;MAChBnC,WAAW,CACVD,QAAQ,KAAKV,UAAU,CAACC,IAAI,GACzBD,UAAU,CAACG,QAAQ,GACnBH,UAAU,CAACC,IACf,CAAC;IACF;EAAG,CACH,CAAC,EACF,IAAAV,QAAA,CAAAyC,aAAA,EAACvC,WAAA,CAAA0D,oBAAM;IAACC,OAAO,EAAC;EAAO,GACtB,IAAA7D,QAAA,CAAAyC,aAAA,EAACvC,WAAA,CAAA4D,MAAM;IACNC,OAAO,EAAC,UAAU;IAClBC,OAAO,EAAGA,CAAA,KAAM;MACf/C,OAAO,CAAC,CAAC;MACTM,QAAQ,CAAE,EAAG,CAAC;IACf;EAAG,GAED,IAAAoB,QAAE,EAAE,QAAS,CACR,CAAC,EAET,IAAA3C,QAAA,CAAAyC,aAAA,EAACvC,WAAA,CAAA4D,MAAM;IAACC,OAAO,EAAC,SAAS;IAACxB,IAAI,EAAC;EAAQ,GACpC,IAAAI,QAAE,EAAE,QAAS,CACR,CACD,CACD,CACH,CACA,CAAC;AAEV"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = PatternsMenuItems;
8
+ var _element = require("@wordpress/element");
9
+ var _blockEditor = require("@wordpress/block-editor");
10
+ var _patternConvertButton = _interopRequireDefault(require("./pattern-convert-button"));
11
+ var _patternsManageButton = _interopRequireDefault(require("./patterns-manage-button"));
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+
16
+ /**
17
+ * Internal dependencies
18
+ */
19
+
20
+ function PatternsMenuItems({
21
+ rootClientId
22
+ }) {
23
+ return (0, _element.createElement)(_blockEditor.BlockSettingsMenuControls, null, ({
24
+ selectedClientIds
25
+ }) => (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_patternConvertButton.default, {
26
+ clientIds: selectedClientIds,
27
+ rootClientId: rootClientId
28
+ }), selectedClientIds.length === 1 && (0, _element.createElement)(_patternsManageButton.default, {
29
+ clientId: selectedClientIds[0]
30
+ })));
31
+ }
32
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_blockEditor","require","_patternConvertButton","_interopRequireDefault","_patternsManageButton","PatternsMenuItems","rootClientId","_element","createElement","BlockSettingsMenuControls","selectedClientIds","Fragment","default","clientIds","length","clientId"],"sources":["@wordpress/patterns/src/components/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { BlockSettingsMenuControls } from '@wordpress/block-editor';\n\n/**\n * Internal dependencies\n */\nimport PatternConvertButton from './pattern-convert-button';\nimport PatternsManageButton from './patterns-manage-button';\n\nexport default function PatternsMenuItems( { rootClientId } ) {\n\treturn (\n\t\t<BlockSettingsMenuControls>\n\t\t\t{ ( { selectedClientIds } ) => (\n\t\t\t\t<>\n\t\t\t\t\t<PatternConvertButton\n\t\t\t\t\t\tclientIds={ selectedClientIds }\n\t\t\t\t\t\trootClientId={ rootClientId }\n\t\t\t\t\t/>\n\t\t\t\t\t{ selectedClientIds.length === 1 && (\n\t\t\t\t\t\t<PatternsManageButton\n\t\t\t\t\t\t\tclientId={ selectedClientIds[ 0 ] }\n\t\t\t\t\t\t/>\n\t\t\t\t\t) }\n\t\t\t\t</>\n\t\t\t) }\n\t\t</BlockSettingsMenuControls>\n\t);\n}\n"],"mappings":";;;;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAKA,IAAAC,qBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAD,sBAAA,CAAAF,OAAA;AATA;AACA;AACA;;AAGA;AACA;AACA;;AAIe,SAASI,iBAAiBA,CAAE;EAAEC;AAAa,CAAC,EAAG;EAC7D,OACC,IAAAC,QAAA,CAAAC,aAAA,EAACR,YAAA,CAAAS,yBAAyB,QACvB,CAAE;IAAEC;EAAkB,CAAC,KACxB,IAAAH,QAAA,CAAAC,aAAA,EAAAD,QAAA,CAAAI,QAAA,QACC,IAAAJ,QAAA,CAAAC,aAAA,EAACN,qBAAA,CAAAU,OAAoB;IACpBC,SAAS,EAAGH,iBAAmB;IAC/BJ,YAAY,EAAGA;EAAc,CAC7B,CAAC,EACAI,iBAAiB,CAACI,MAAM,KAAK,CAAC,IAC/B,IAAAP,QAAA,CAAAC,aAAA,EAACJ,qBAAA,CAAAQ,OAAoB;IACpBG,QAAQ,EAAGL,iBAAiB,CAAE,CAAC;EAAI,CACnC,CAED,CAEuB,CAAC;AAE9B"}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = PatternConvertButton;
8
+ var _element = require("@wordpress/element");
9
+ var _blocks = require("@wordpress/blocks");
10
+ var _blockEditor = require("@wordpress/block-editor");
11
+ var _components = require("@wordpress/components");
12
+ var _icons = require("@wordpress/icons");
13
+ var _data = require("@wordpress/data");
14
+ var _coreData = require("@wordpress/core-data");
15
+ var _i18n = require("@wordpress/i18n");
16
+ var _notices = require("@wordpress/notices");
17
+ var _createPatternModal = _interopRequireDefault(require("./create-pattern-modal"));
18
+ /**
19
+ * WordPress dependencies
20
+ */
21
+
22
+ /**
23
+ * Internal dependencies
24
+ */
25
+
26
+ /**
27
+ * Menu control to convert block(s) to a pattern block.
28
+ *
29
+ * @param {Object} props Component props.
30
+ * @param {string[]} props.clientIds Client ids of selected blocks.
31
+ * @param {string} props.rootClientId ID of the currently selected top-level block.
32
+ * @return {import('@wordpress/element').WPComponent} The menu control or null.
33
+ */
34
+ function PatternConvertButton({
35
+ clientIds,
36
+ rootClientId
37
+ }) {
38
+ const {
39
+ createSuccessNotice
40
+ } = (0, _data.useDispatch)(_notices.store);
41
+ const [isModalOpen, setIsModalOpen] = (0, _element.useState)(false);
42
+ const canConvert = (0, _data.useSelect)(select => {
43
+ var _getBlocksByClientId;
44
+ const {
45
+ canUser
46
+ } = select(_coreData.store);
47
+ const {
48
+ getBlocksByClientId,
49
+ canInsertBlockType,
50
+ getBlockRootClientId
51
+ } = select(_blockEditor.store);
52
+ const rootId = rootClientId || (clientIds.length > 0 ? getBlockRootClientId(clientIds[0]) : undefined);
53
+ const blocks = (_getBlocksByClientId = getBlocksByClientId(clientIds)) !== null && _getBlocksByClientId !== void 0 ? _getBlocksByClientId : [];
54
+ const isReusable = blocks.length === 1 && blocks[0] && (0, _blocks.isReusableBlock)(blocks[0]) && !!select(_coreData.store).getEntityRecord('postType', 'wp_block', blocks[0].attributes.ref);
55
+ const _canConvert =
56
+ // Hide when this is already a synced pattern.
57
+ !isReusable &&
58
+ // Hide when patterns are disabled.
59
+ canInsertBlockType('core/block', rootId) && blocks.every(block =>
60
+ // Guard against the case where a regular block has *just* been converted.
61
+ !!block &&
62
+ // Hide on invalid blocks.
63
+ block.isValid &&
64
+ // Hide when block doesn't support being made into a pattern.
65
+ (0, _blocks.hasBlockSupport)(block.name, 'reusable', true)) &&
66
+ // Hide when current doesn't have permission to do that.
67
+ !!canUser('create', 'blocks');
68
+ return _canConvert;
69
+ }, [clientIds, rootClientId]);
70
+ if (!canConvert) {
71
+ return null;
72
+ }
73
+ const handleSuccess = ({
74
+ pattern
75
+ }) => {
76
+ createSuccessNotice(pattern.wp_pattern_sync_status === 'unsynced' ? (0, _i18n.sprintf)(
77
+ // translators: %s: the name the user has given to the pattern.
78
+ (0, _i18n.__)('Unsynced Pattern created: %s'), pattern.title.raw) : (0, _i18n.sprintf)(
79
+ // translators: %s: the name the user has given to the pattern.
80
+ (0, _i18n.__)('Synced Pattern created: %s'), pattern.title.raw), {
81
+ type: 'snackbar',
82
+ id: 'convert-to-pattern-success'
83
+ });
84
+ setIsModalOpen(false);
85
+ };
86
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuItem, {
87
+ icon: _icons.symbol,
88
+ onClick: () => setIsModalOpen(true)
89
+ }, (0, _i18n.__)('Create pattern')), isModalOpen && (0, _element.createElement)(_createPatternModal.default, {
90
+ clientIds: clientIds,
91
+ onSuccess: pattern => {
92
+ handleSuccess(pattern);
93
+ },
94
+ onError: () => {
95
+ setIsModalOpen(false);
96
+ },
97
+ onClose: () => {
98
+ setIsModalOpen(false);
99
+ }
100
+ }));
101
+ }
102
+ //# sourceMappingURL=pattern-convert-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_element","require","_blocks","_blockEditor","_components","_icons","_data","_coreData","_i18n","_notices","_createPatternModal","_interopRequireDefault","PatternConvertButton","clientIds","rootClientId","createSuccessNotice","useDispatch","noticesStore","isModalOpen","setIsModalOpen","useState","canConvert","useSelect","select","_getBlocksByClientId","canUser","coreStore","getBlocksByClientId","canInsertBlockType","getBlockRootClientId","blockEditorStore","rootId","length","undefined","blocks","isReusable","isReusableBlock","getEntityRecord","attributes","ref","_canConvert","every","block","isValid","hasBlockSupport","name","handleSuccess","pattern","wp_pattern_sync_status","sprintf","__","title","raw","type","id","createElement","Fragment","MenuItem","icon","symbol","onClick","default","onSuccess","onError","onClose"],"sources":["@wordpress/patterns/src/components/pattern-convert-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { hasBlockSupport, isReusableBlock } from '@wordpress/blocks';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { useState } from '@wordpress/element';\nimport { MenuItem } from '@wordpress/components';\nimport { symbol } from '@wordpress/icons';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { __, sprintf } from '@wordpress/i18n';\nimport { store as noticesStore } from '@wordpress/notices';\n/**\n * Internal dependencies\n */\nimport CreatePatternModal from './create-pattern-modal';\n\n/**\n * Menu control to convert block(s) to a pattern block.\n *\n * @param {Object} props Component props.\n * @param {string[]} props.clientIds Client ids of selected blocks.\n * @param {string} props.rootClientId ID of the currently selected top-level block.\n * @return {import('@wordpress/element').WPComponent} The menu control or null.\n */\nexport default function PatternConvertButton( { clientIds, rootClientId } ) {\n\tconst { createSuccessNotice } = useDispatch( noticesStore );\n\tconst [ isModalOpen, setIsModalOpen ] = useState( false );\n\tconst canConvert = useSelect(\n\t\t( select ) => {\n\t\t\tconst { canUser } = select( coreStore );\n\t\t\tconst {\n\t\t\t\tgetBlocksByClientId,\n\t\t\t\tcanInsertBlockType,\n\t\t\t\tgetBlockRootClientId,\n\t\t\t} = select( blockEditorStore );\n\n\t\t\tconst rootId =\n\t\t\t\trootClientId ||\n\t\t\t\t( clientIds.length > 0\n\t\t\t\t\t? getBlockRootClientId( clientIds[ 0 ] )\n\t\t\t\t\t: undefined );\n\n\t\t\tconst blocks = getBlocksByClientId( clientIds ) ?? [];\n\n\t\t\tconst isReusable =\n\t\t\t\tblocks.length === 1 &&\n\t\t\t\tblocks[ 0 ] &&\n\t\t\t\tisReusableBlock( blocks[ 0 ] ) &&\n\t\t\t\t!! select( coreStore ).getEntityRecord(\n\t\t\t\t\t'postType',\n\t\t\t\t\t'wp_block',\n\t\t\t\t\tblocks[ 0 ].attributes.ref\n\t\t\t\t);\n\n\t\t\tconst _canConvert =\n\t\t\t\t// Hide when this is already a synced pattern.\n\t\t\t\t! isReusable &&\n\t\t\t\t// Hide when patterns are disabled.\n\t\t\t\tcanInsertBlockType( 'core/block', rootId ) &&\n\t\t\t\tblocks.every(\n\t\t\t\t\t( block ) =>\n\t\t\t\t\t\t// Guard against the case where a regular block has *just* been converted.\n\t\t\t\t\t\t!! block &&\n\t\t\t\t\t\t// Hide on invalid blocks.\n\t\t\t\t\t\tblock.isValid &&\n\t\t\t\t\t\t// Hide when block doesn't support being made into a pattern.\n\t\t\t\t\t\thasBlockSupport( block.name, 'reusable', true )\n\t\t\t\t) &&\n\t\t\t\t// Hide when current doesn't have permission to do that.\n\t\t\t\t!! canUser( 'create', 'blocks' );\n\n\t\t\treturn _canConvert;\n\t\t},\n\t\t[ clientIds, rootClientId ]\n\t);\n\n\tif ( ! canConvert ) {\n\t\treturn null;\n\t}\n\n\tconst handleSuccess = ( { pattern } ) => {\n\t\tcreateSuccessNotice(\n\t\t\tpattern.wp_pattern_sync_status === 'unsynced'\n\t\t\t\t? sprintf(\n\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t__( 'Unsynced Pattern created: %s' ),\n\t\t\t\t\t\tpattern.title.raw\n\t\t\t\t )\n\t\t\t\t: sprintf(\n\t\t\t\t\t\t// translators: %s: the name the user has given to the pattern.\n\t\t\t\t\t\t__( 'Synced Pattern created: %s' ),\n\t\t\t\t\t\tpattern.title.raw\n\t\t\t\t ),\n\t\t\t{\n\t\t\t\ttype: 'snackbar',\n\t\t\t\tid: 'convert-to-pattern-success',\n\t\t\t}\n\t\t);\n\t\tsetIsModalOpen( false );\n\t};\n\treturn (\n\t\t<>\n\t\t\t<MenuItem icon={ symbol } onClick={ () => setIsModalOpen( true ) }>\n\t\t\t\t{ __( 'Create pattern' ) }\n\t\t\t</MenuItem>\n\t\t\t{ isModalOpen && (\n\t\t\t\t<CreatePatternModal\n\t\t\t\t\tclientIds={ clientIds }\n\t\t\t\t\tonSuccess={ ( pattern ) => {\n\t\t\t\t\t\thandleSuccess( pattern );\n\t\t\t\t\t} }\n\t\t\t\t\tonError={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }\n\t\t\t\t\tonClose={ () => {\n\t\t\t\t\t\tsetIsModalOpen( false );\n\t\t\t\t\t} }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,CAAAuD,aAAA,EAACnD,WAAA,CAAAqD,QAAQ;IAACC,IAAI,EAAGC,aAAQ;IAACC,OAAO,EAAGA,CAAA,KAAMzC,cAAc,CAAE,IAAK;EAAG,GAC/D,IAAA+B,QAAE,EAAE,gBAAiB,CACd,CAAC,EACThC,WAAW,IACZ,IAAAlB,QAAA,CAAAuD,aAAA,EAAC7C,mBAAA,CAAAmD,OAAkB;IAClBhD,SAAS,EAAGA,SAAW;IACvBiD,SAAS,EAAKf,OAAO,IAAM;MAC1BD,aAAa,CAAEC,OAAQ,CAAC;IACzB,CAAG;IACHgB,OAAO,EAAGA,CAAA,KAAM;MACf5C,cAAc,CAAE,KAAM,CAAC;IACxB,CAAG;IACH6C,OAAO,EAAGA,CAAA,KAAM;MACf7C,cAAc,CAAE,KAAM,CAAC;IACxB;EAAG,CACH,CAED,CAAC;AAEL"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _element = require("@wordpress/element");
8
+ var _components = require("@wordpress/components");
9
+ var _i18n = require("@wordpress/i18n");
10
+ var _blocks = require("@wordpress/blocks");
11
+ var _data = require("@wordpress/data");
12
+ var _blockEditor = require("@wordpress/block-editor");
13
+ var _url = require("@wordpress/url");
14
+ var _coreData = require("@wordpress/core-data");
15
+ var _store = require("../store");
16
+ /**
17
+ * WordPress dependencies
18
+ */
19
+
20
+ /**
21
+ * Internal dependencies
22
+ */
23
+
24
+ function PatternsManageButton({
25
+ clientId
26
+ }) {
27
+ const {
28
+ canRemove,
29
+ isVisible,
30
+ innerBlockCount,
31
+ managePatternsUrl
32
+ } = (0, _data.useSelect)(select => {
33
+ const {
34
+ getBlock,
35
+ canRemoveBlock,
36
+ getBlockCount,
37
+ getSettings
38
+ } = select(_blockEditor.store);
39
+ const {
40
+ canUser
41
+ } = select(_coreData.store);
42
+ const reusableBlock = getBlock(clientId);
43
+ const isBlockTheme = getSettings().__unstableIsBlockBasedTheme;
44
+ return {
45
+ canRemove: canRemoveBlock(clientId),
46
+ isVisible: !!reusableBlock && (0, _blocks.isReusableBlock)(reusableBlock) && !!canUser('update', 'blocks', reusableBlock.attributes.ref),
47
+ innerBlockCount: getBlockCount(clientId),
48
+ // The site editor and templates both check whether the user
49
+ // has edit_theme_options capabilities. We can leverage that here
50
+ // and omit the manage patterns link if the user can't access it.
51
+ managePatternsUrl: isBlockTheme && canUser('read', 'templates') ? (0, _url.addQueryArgs)('site-editor.php', {
52
+ path: '/patterns'
53
+ }) : (0, _url.addQueryArgs)('edit.php', {
54
+ post_type: 'wp_block'
55
+ })
56
+ };
57
+ }, [clientId]);
58
+ const {
59
+ __experimentalConvertSyncedPatternToStatic: convertBlockToStatic
60
+ } = (0, _data.useDispatch)(_store.store);
61
+ if (!isVisible) {
62
+ return null;
63
+ }
64
+ return (0, _element.createElement)(_element.Fragment, null, (0, _element.createElement)(_components.MenuItem, {
65
+ href: managePatternsUrl
66
+ }, (0, _i18n.__)('Manage patterns')), canRemove && (0, _element.createElement)(_components.MenuItem, {
67
+ onClick: () => convertBlockToStatic(clientId)
68
+ }, innerBlockCount > 1 ? (0, _i18n.__)('Detach patterns') : (0, _i18n.__)('Detach pattern')));
69
+ }
70
+ var _default = PatternsManageButton;
71
+ exports.default = _default;
72
+ //# sourceMappingURL=patterns-manage-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_components","require","_i18n","_blocks","_data","_blockEditor","_url","_coreData","_store","PatternsManageButton","clientId","canRemove","isVisible","innerBlockCount","managePatternsUrl","useSelect","select","getBlock","canRemoveBlock","getBlockCount","getSettings","blockEditorStore","canUser","coreStore","reusableBlock","isBlockTheme","__unstableIsBlockBasedTheme","isReusableBlock","attributes","ref","addQueryArgs","path","post_type","__experimentalConvertSyncedPatternToStatic","convertBlockToStatic","useDispatch","editorStore","_element","createElement","Fragment","MenuItem","href","__","onClick","_default","exports","default"],"sources":["@wordpress/patterns/src/components/patterns-manage-button.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { MenuItem } from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { isReusableBlock } from '@wordpress/blocks';\nimport { useSelect, useDispatch } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { addQueryArgs } from '@wordpress/url';\nimport { store as coreStore } from '@wordpress/core-data';\n\n/**\n * Internal dependencies\n */\nimport { store as editorStore } from '../store';\n\nfunction PatternsManageButton( { clientId } ) {\n\tconst { canRemove, isVisible, innerBlockCount, managePatternsUrl } =\n\t\tuseSelect(\n\t\t\t( select ) => {\n\t\t\t\tconst { getBlock, canRemoveBlock, getBlockCount, getSettings } =\n\t\t\t\t\tselect( blockEditorStore );\n\t\t\t\tconst { canUser } = select( coreStore );\n\t\t\t\tconst reusableBlock = getBlock( clientId );\n\t\t\t\tconst isBlockTheme = getSettings().__unstableIsBlockBasedTheme;\n\n\t\t\t\treturn {\n\t\t\t\t\tcanRemove: canRemoveBlock( clientId ),\n\t\t\t\t\tisVisible:\n\t\t\t\t\t\t!! reusableBlock &&\n\t\t\t\t\t\tisReusableBlock( reusableBlock ) &&\n\t\t\t\t\t\t!! canUser(\n\t\t\t\t\t\t\t'update',\n\t\t\t\t\t\t\t'blocks',\n\t\t\t\t\t\t\treusableBlock.attributes.ref\n\t\t\t\t\t\t),\n\t\t\t\t\tinnerBlockCount: getBlockCount( clientId ),\n\t\t\t\t\t// The site editor and templates both check whether the user\n\t\t\t\t\t// has edit_theme_options capabilities. We can leverage that here\n\t\t\t\t\t// and omit the manage patterns link if the user can't access it.\n\t\t\t\t\tmanagePatternsUrl:\n\t\t\t\t\t\tisBlockTheme && canUser( 'read', 'templates' )\n\t\t\t\t\t\t\t? addQueryArgs( 'site-editor.php', {\n\t\t\t\t\t\t\t\t\tpath: '/patterns',\n\t\t\t\t\t\t\t } )\n\t\t\t\t\t\t\t: addQueryArgs( 'edit.php', {\n\t\t\t\t\t\t\t\t\tpost_type: 'wp_block',\n\t\t\t\t\t\t\t } ),\n\t\t\t\t};\n\t\t\t},\n\t\t\t[ clientId ]\n\t\t);\n\n\tconst { __experimentalConvertSyncedPatternToStatic: convertBlockToStatic } =\n\t\tuseDispatch( editorStore );\n\n\tif ( ! isVisible ) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<>\n\t\t\t<MenuItem href={ managePatternsUrl }>\n\t\t\t\t{ __( 'Manage patterns' ) }\n\t\t\t</MenuItem>\n\t\t\t{ canRemove && (\n\t\t\t\t<MenuItem onClick={ () => convertBlockToStatic( clientId ) }>\n\t\t\t\t\t{ innerBlockCount > 1\n\t\t\t\t\t\t? __( 'Detach patterns' )\n\t\t\t\t\t\t: __( 'Detach pattern' ) }\n\t\t\t\t</MenuItem>\n\t\t\t) }\n\t\t</>\n\t);\n}\n\nexport default PatternsManageButton;\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAKA,IAAAO,MAAA,GAAAP,OAAA;AAdA;AACA;AACA;;AASA;AACA;AACA;;AAGA,SAASQ,oBAAoBA,CAAE;EAAEC;AAAS,CAAC,EAAG;EAC7C,MAAM;IAAEC,SAAS;IAAEC,SAAS;IAAEC,eAAe;IAAEC;EAAkB,CAAC,GACjE,IAAAC,eAAS,EACNC,MAAM,IAAM;IACb,MAAM;MAAEC,QAAQ;MAAEC,cAAc;MAAEC,aAAa;MAAEC;IAAY,CAAC,GAC7DJ,MAAM,CAAEK,kBAAiB,CAAC;IAC3B,MAAM;MAAEC;IAAQ,CAAC,GAAGN,MAAM,CAAEO,eAAU,CAAC;IACvC,MAAMC,aAAa,GAAGP,QAAQ,CAAEP,QAAS,CAAC;IAC1C,MAA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EcnC,oBAAoB;AAAAoC,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
package/build/index.js ADDED
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ require("./store");
7
+ var _privateApis = require("./private-apis");
8
+ Object.keys(_privateApis).forEach(function (key) {
9
+ if (key === "default" || key === "__esModule") return;
10
+ if (key in exports && exports[key] === _privateApis[key]) return;
11
+ Object.defineProperty(exports, key, {
12
+ enumerable: true,
13
+ get: function () {
14
+ return _privateApis[key];
15
+ }
16
+ });
17
+ });
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["require","_privateApis","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["@wordpress/patterns/src/index.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './store';\n\nexport * from './private-apis';\n"],"mappings":";;;;;AAGAA,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAAAE,MAAA,CAAAC,IAAA,CAAAF,YAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAJ,YAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAR,YAAA,CAAAI,GAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.privateApis = void 0;
7
+ require("./store");
8
+ var _lockUnlock = require("./lock-unlock");
9
+ /**
10
+ * Internal dependencies
11
+ */
12
+
13
+ const privateApis = {};
14
+ exports.privateApis = privateApis;
15
+ (0, _lockUnlock.lock)(privateApis, {
16
+ CreatePatternModal: () => null,
17
+ PatternsMenuItems: () => null
18
+ });
19
+ //# sourceMappingURL=index.native.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["require","_lockUnlock","privateApis","exports","lock","CreatePatternModal","PatternsMenuItems"],"sources":["@wordpress/patterns/src/index.native.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport './store';\nimport { lock } from './lock-unlock';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tCreatePatternModal: () => null,\n\tPatternsMenuItems: () => null,\n} );\n"],"mappings":";;;;;;AAGAA,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAIO,MAAME,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,kBAAkB,EAAEA,CAAA,KAAM,IAAI;EAC9BC,iBAAiB,EAAEA,CAAA,KAAM;AAC1B,CAAE,CAAC"}
@@ -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 know using unstable features means my plugin or theme will inevitably break on the next WordPress release.', '@wordpress/patterns');
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/patterns/src/lock-unlock.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';\nexport const { lock, unlock } =\n\t__dangerousOptInToUnstableAPIsOnlyForCoreModules(\n\t\t'I know using unstable features means my plugin or theme will inevitably break on the next WordPress release.',\n\t\t'@wordpress/patterns'\n\t);\n"],"mappings":";;;;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AAHA;AACA;AACA;;AAEO,MAAM;EAAEC,IAAI;EAAEC;AAAO,CAAC,GAC5B,IAAAC,6DAAgD,EAC/C,8GAA8G,EAC9G,qBACD,CAAC;AAACC,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAAE,OAAA,CAAAH,IAAA,GAAAA,IAAA"}
@@ -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
+ exports.privateApis = void 0;
8
+ var _lockUnlock = require("./lock-unlock");
9
+ var _createPatternModal = _interopRequireDefault(require("./components/create-pattern-modal"));
10
+ var _components = _interopRequireDefault(require("./components"));
11
+ /**
12
+ * Internal dependencies
13
+ */
14
+
15
+ const privateApis = {};
16
+ exports.privateApis = privateApis;
17
+ (0, _lockUnlock.lock)(privateApis, {
18
+ CreatePatternModal: _createPatternModal.default,
19
+ PatternsMenuItems: _components.default
20
+ });
21
+ //# sourceMappingURL=private-apis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_lockUnlock","require","_createPatternModal","_interopRequireDefault","_components","privateApis","exports","lock","CreatePatternModal","PatternsMenuItems"],"sources":["@wordpress/patterns/src/private-apis.js"],"sourcesContent":["/**\n * Internal dependencies\n */\nimport { lock } from './lock-unlock';\nimport CreatePatternModal from './components/create-pattern-modal';\nimport PatternsMenuItems from './components';\n\nexport const privateApis = {};\nlock( privateApis, {\n\tCreatePatternModal,\n\tPatternsMenuItems,\n} );\n"],"mappings":";;;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AACA,IAAAC,mBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,WAAA,GAAAD,sBAAA,CAAAF,OAAA;AALA;AACA;AACA;;AAKO,MAAMI,WAAW,GAAG,CAAC,CAAC;AAACC,OAAA,CAAAD,WAAA,GAAAA,WAAA;AAC9B,IAAAE,gBAAI,EAAEF,WAAW,EAAE;EAClBG,kBAAkB,EAAlBA,2BAAkB;EAClBC,iBAAiB,EAAjBA;AACD,CAAE,CAAC"}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.__experimentalCreatePattern = exports.__experimentalConvertSyncedPatternToStatic = void 0;
7
+ exports.__experimentalSetEditingPattern = __experimentalSetEditingPattern;
8
+ var _blocks = require("@wordpress/blocks");
9
+ var _coreData = require("@wordpress/core-data");
10
+ var _blockEditor = require("@wordpress/block-editor");
11
+ /**
12
+ * WordPress dependencies
13
+ */
14
+
15
+ /**
16
+ * Returns a generator converting one or more static blocks into a pattern, or creating a new empty pattern.
17
+ *
18
+ * @param {string} title Pattern title.
19
+ * @param {'full'|'unsynced'} syncType They way block is synced, 'full' or 'unsynced'.
20
+ * @param {string[]|undefined} clientIds Optional client IDs of blocks to convert to pattern.
21
+ */
22
+ const __experimentalCreatePattern = (title, syncType, clientIds) => async ({
23
+ registry,
24
+ dispatch
25
+ }) => {
26
+ const meta = syncType === 'unsynced' ? {
27
+ wp_pattern_sync_status: syncType
28
+ } : undefined;
29
+ const reusableBlock = {
30
+ title,
31
+ content: clientIds ? (0, _blocks.serialize)(registry.select(_blockEditor.store).getBlocksByClientId(clientIds)) : undefined,
32
+ status: 'publish',
33
+ meta
34
+ };
35
+ const updatedRecord = await registry.dispatch(_coreData.store).saveEntityRecord('postType', 'wp_block', reusableBlock);
36
+ if (syncType === 'unsynced' || !clientIds) {
37
+ return updatedRecord;
38
+ }
39
+ const newBlock = (0, _blocks.createBlock)('core/block', {
40
+ ref: updatedRecord.id
41
+ });
42
+ registry.dispatch(_blockEditor.store).replaceBlocks(clientIds, newBlock);
43
+ dispatch.__experimentalSetEditingPattern(newBlock.clientId, true);
44
+ return updatedRecord;
45
+ };
46
+
47
+ /**
48
+ * Returns a generator converting a synced pattern block into a static block.
49
+ *
50
+ * @param {string} clientId The client ID of the block to attach.
51
+ */
52
+ exports.__experimentalCreatePattern = __experimentalCreatePattern;
53
+ const __experimentalConvertSyncedPatternToStatic = clientId => ({
54
+ registry
55
+ }) => {
56
+ const oldBlock = registry.select(_blockEditor.store).getBlock(clientId);
57
+ const pattern = registry.select('core').getEditedEntityRecord('postType', 'wp_block', oldBlock.attributes.ref);
58
+ const newBlocks = (0, _blocks.parse)(typeof pattern.content === 'function' ? pattern.content(pattern) : pattern.content);
59
+ registry.dispatch(_blockEditor.store).replaceBlocks(oldBlock.clientId, newBlocks);
60
+ };
61
+
62
+ /**
63
+ * Returns an action descriptor for SET_EDITING_PATTERN action.
64
+ *
65
+ * @param {string} clientId The clientID of the pattern to target.
66
+ * @param {boolean} isEditing Whether the block should be in editing state.
67
+ * @return {Object} Action descriptor.
68
+ */
69
+ exports.__experimentalConvertSyncedPatternToStatic = __experimentalConvertSyncedPatternToStatic;
70
+ function __experimentalSetEditingPattern(clientId, isEditing) {
71
+ return {
72
+ type: 'SET_EDITING_PATTERN',
73
+ clientId,
74
+ isEditing
75
+ };
76
+ }
77
+ //# sourceMappingURL=actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_blocks","require","_coreData","_blockEditor","__experimentalCreatePattern","title","syncType","clientIds","registry","dispatch","meta","wp_pattern_sync_status","undefined","reusableBlock","content","serialize","select","blockEditorStore","getBlocksByClientId","status","updatedRecord","coreStore","saveEntityRecord","newBlock","createBlock","ref","id","replaceBlocks","__experimentalSetEditingPattern","clientId","exports","__experimentalConvertSyncedPatternToStatic","oldBlock","getBlock","pattern","getEditedEntityRecord","attributes","newBlocks","parse","isEditing","type"],"sources":["@wordpress/patterns/src/store/actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\n\nimport { parse, serialize, createBlock } from '@wordpress/blocks';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\n\n/**\n * Returns a generator converting one or more static blocks into a pattern, or creating a new empty pattern.\n *\n * @param {string} title Pattern title.\n * @param {'full'|'unsynced'} syncType They way block is synced, 'full' or 'unsynced'.\n * @param {string[]|undefined} clientIds Optional client IDs of blocks to convert to pattern.\n */\nexport const __experimentalCreatePattern =\n\t( title, syncType, clientIds ) =>\n\tasync ( { registry, dispatch } ) => {\n\t\tconst meta =\n\t\t\tsyncType === 'unsynced'\n\t\t\t\t? {\n\t\t\t\t\t\twp_pattern_sync_status: syncType,\n\t\t\t\t }\n\t\t\t\t: undefined;\n\n\t\tconst reusableBlock = {\n\t\t\ttitle,\n\t\t\tcontent: clientIds\n\t\t\t\t? serialize(\n\t\t\t\t\t\tregistry\n\t\t\t\t\t\t\t.select( blockEditorStore )\n\t\t\t\t\t\t\t.getBlocksByClientId( clientIds )\n\t\t\t\t )\n\t\t\t\t: undefined,\n\t\t\tstatus: 'publish',\n\t\t\tmeta,\n\t\t};\n\n\t\tconst updatedRecord = await registry\n\t\t\t.dispatch( coreStore )\n\t\t\t.saveEntityRecord( 'postType', 'wp_block', reusableBlock );\n\n\t\tif ( syncType === 'unsynced' || ! clientIds ) {\n\t\t\treturn updatedRecord;\n\t\t}\n\n\t\tconst newBlock = createBlock( 'core/block', {\n\t\t\tref: updatedRecord.id,\n\t\t} );\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( clientIds, newBlock );\n\t\tdispatch.__experimentalSetEditingPattern( newBlock.clientId, true );\n\t\treturn updatedRecord;\n\t};\n\n/**\n * Returns a generator converting a synced pattern block into a static block.\n *\n * @param {string} clientId The client ID of the block to attach.\n */\nexport const __experimentalConvertSyncedPatternToStatic =\n\t( clientId ) =>\n\t( { registry } ) => {\n\t\tconst oldBlock = registry\n\t\t\t.select( blockEditorStore )\n\t\t\t.getBlock( clientId );\n\t\tconst pattern = registry\n\t\t\t.select( 'core' )\n\t\t\t.getEditedEntityRecord(\n\t\t\t\t'postType',\n\t\t\t\t'wp_block',\n\t\t\t\toldBlock.attributes.ref\n\t\t\t);\n\n\t\tconst newBlocks = parse(\n\t\t\ttypeof pattern.content === 'function'\n\t\t\t\t? pattern.content( pattern )\n\t\t\t\t: pattern.content\n\t\t);\n\t\tregistry\n\t\t\t.dispatch( blockEditorStore )\n\t\t\t.replaceBlocks( oldBlock.clientId, newBlocks );\n\t};\n\n/**\n * Returns an action descriptor for SET_EDITING_PATTERN action.\n *\n * @param {string} clientId The clientID of the pattern to target.\n * @param {boolean} isEditing Whether the block should be in editing state.\n * @return {Object} Action descriptor.\n */\nexport function __experimentalSetEditingPattern( clientId, isEditing ) {\n\treturn {\n\t\ttype: 'SET_EDITING_PATTERN',\n\t\tclientId,\n\t\tisEditing,\n\t};\n}\n"],"mappings":";;;;;;;AAIA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AANA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMG,2BAA2B,GACvCA,CAAEC,KAAK,EAAEC,QAAQ,EAAEC,SAAS,KAC5B,OAAQ;EAAEC,QAAQ;EAAEC;AAAS,CAAC,KAAM;EACnC,MAAMC,IAAI,GACTJ,QAAQ,KAAK,UAAU,GACpB;IACAK,sBAAsB,EAAEL;EACxB,CAAC,GACDM,SAAS;EAEb,MAAMC,aAAa,GAAG;IACrBR,KAAK;IACLS,OAAO,EAAEP,SAAS,GACf,IAAAQ,iBAAS,EACTP,QAAQ,CACNQ,MAAM,CAAEC,kBAAiB,CAAC,CAC1BC,mBAAmB,CAAEX,SAAU,CACjC,CAAC,GACDK,SAAS;IACZO,MAAM,EAAE,SAAS;IACjBT;EACD,CAAC;EAED,MAAMU,aAAa,GAAG,MAAMZ,QAAQ,CAClCC,QAAQ,CAAEY,eAAU,CAAC,CACrBC,gBAAgB,CAAE,UAAU,EAAE,UAAU,EAAET,aAAc,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AAG;EACtE,OAAO;IACNC,IAAI,EAAE,qBAAqB;IAC3BX,QAAQ;IACRU;EACD,CAAC;AACF"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.STORE_NAME = void 0;
7
+ /**
8
+ * Module Constants
9
+ */
10
+ const STORE_NAME = 'core/patterns';
11
+ exports.STORE_NAME = STORE_NAME;
12
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["STORE_NAME","exports"],"sources":["@wordpress/patterns/src/store/constants.js"],"sourcesContent":["/**\n * Module Constants\n */\nexport const STORE_NAME = 'core/patterns';\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACO,MAAMA,UAAU,GAAG,eAAe;AAACC,OAAA,CAAAD,UAAA,GAAAA,UAAA"}