@wordpress/widgets 2.20.0 → 3.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 3.1.0 (2023-01-02)
6
+
7
+ ## 3.0.0 (2022-12-14)
8
+
9
+ ### Breaking Changes
10
+
11
+ - Updated dependencies to require React 18 ([45235](https://github.com/WordPress/gutenberg/pull/45235))
12
+
5
13
  ## 2.20.0 (2022-11-16)
6
14
 
7
15
  ## 2.19.0 (2022-11-02)
package/build/index.js CHANGED
@@ -73,9 +73,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
73
73
  * Note that for the block to be useful, any scripts required by a widget must
74
74
  * be loaded into the page.
75
75
  *
76
+ * @param {Object} supports Block support settings.
76
77
  * @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/
77
78
  */
78
79
  function registerLegacyWidgetBlock() {
80
+ let supports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
79
81
  const {
80
82
  metadata,
81
83
  settings,
@@ -84,7 +86,11 @@ function registerLegacyWidgetBlock() {
84
86
  (0, _blocks.registerBlockType)({
85
87
  name,
86
88
  ...metadata
87
- }, settings);
89
+ }, { ...settings,
90
+ supports: { ...settings.supports,
91
+ ...supports
92
+ }
93
+ });
88
94
  }
89
95
  /**
90
96
  * Registers the Widget Group block.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/widgets/src/index.js"],"names":["registerLegacyWidgetBlock","metadata","settings","name","legacyWidget","registerWidgetGroupBlock","widgetGroup"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAuBA;;;;;;AAnCA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,yBAAT,GAAqC;AAC3C,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAA+BC,YAArC;AACA,iCAAmB;AAAED,IAAAA,IAAF;AAAQ,OAAGF;AAAX,GAAnB,EAA0CC,QAA1C;AACA;AAED;AACA;AACA;;;AACO,SAASG,wBAAT,GAAoC;AAC1C,QAAM;AAAEJ,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAA+BG,WAArC;AACA,iCAAmB;AAAEH,IAAAA,IAAF;AAAQ,OAAGF;AAAX,GAAnB,EAA0CC,QAA1C;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport * as legacyWidget from './blocks/legacy-widget';\nimport * as widgetGroup from './blocks/widget-group';\n\nexport * from './components';\nexport * from './utils';\n\n/**\n * Registers the Legacy Widget block.\n *\n * Note that for the block to be useful, any scripts required by a widget must\n * be loaded into the page.\n *\n * @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/\n */\nexport function registerLegacyWidgetBlock() {\n\tconst { metadata, settings, name } = legacyWidget;\n\tregisterBlockType( { name, ...metadata }, settings );\n}\n\n/**\n * Registers the Widget Group block.\n */\nexport function registerWidgetGroupBlock() {\n\tconst { metadata, settings, name } = widgetGroup;\n\tregisterBlockType( { name, ...metadata }, settings );\n}\n\nexport { default as registerLegacyWidgetVariations } from './register-legacy-widget-variations';\n"]}
1
+ {"version":3,"sources":["@wordpress/widgets/src/index.js"],"names":["registerLegacyWidgetBlock","supports","metadata","settings","name","legacyWidget","registerWidgetGroupBlock","widgetGroup"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAGA;;AAKA;;AACA;;AAEA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AACA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAiCA;;;;;;AA7CA;AACA;AACA;;AAGA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,yBAAT,GAAoD;AAAA,MAAhBC,QAAgB,uEAAL,EAAK;AAC1D,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAA+BC,YAArC;AACA,iCACC;AAAED,IAAAA,IAAF;AAAQ,OAAGF;AAAX,GADD,EAEC,EACC,GAAGC,QADJ;AAECF,IAAAA,QAAQ,EAAE,EACT,GAAGE,QAAQ,CAACF,QADH;AAET,SAAGA;AAFM;AAFX,GAFD;AAUA;AAED;AACA;AACA;;;AACO,SAASK,wBAAT,GAAoC;AAC1C,QAAM;AAAEJ,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAA+BG,WAArC;AACA,iCAAmB;AAAEH,IAAAA,IAAF;AAAQ,OAAGF;AAAX,GAAnB,EAA0CC,QAA1C;AACA","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport * as legacyWidget from './blocks/legacy-widget';\nimport * as widgetGroup from './blocks/widget-group';\n\nexport * from './components';\nexport * from './utils';\n\n/**\n * Registers the Legacy Widget block.\n *\n * Note that for the block to be useful, any scripts required by a widget must\n * be loaded into the page.\n *\n * @param {Object} supports Block support settings.\n * @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/\n */\nexport function registerLegacyWidgetBlock( supports = {} ) {\n\tconst { metadata, settings, name } = legacyWidget;\n\tregisterBlockType(\n\t\t{ name, ...metadata },\n\t\t{\n\t\t\t...settings,\n\t\t\tsupports: {\n\t\t\t\t...settings.supports,\n\t\t\t\t...supports,\n\t\t\t},\n\t\t}\n\t);\n}\n\n/**\n * Registers the Widget Group block.\n */\nexport function registerWidgetGroupBlock() {\n\tconst { metadata, settings, name } = widgetGroup;\n\tregisterBlockType( { name, ...metadata }, settings );\n}\n\nexport { default as registerLegacyWidgetVariations } from './register-legacy-widget-variations';\n"]}
@@ -16,10 +16,12 @@ export * from './utils';
16
16
  * Note that for the block to be useful, any scripts required by a widget must
17
17
  * be loaded into the page.
18
18
  *
19
+ * @param {Object} supports Block support settings.
19
20
  * @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/
20
21
  */
21
22
 
22
23
  export function registerLegacyWidgetBlock() {
24
+ let supports = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
23
25
  const {
24
26
  metadata,
25
27
  settings,
@@ -28,7 +30,11 @@ export function registerLegacyWidgetBlock() {
28
30
  registerBlockType({
29
31
  name,
30
32
  ...metadata
31
- }, settings);
33
+ }, { ...settings,
34
+ supports: { ...settings.supports,
35
+ ...supports
36
+ }
37
+ });
32
38
  }
33
39
  /**
34
40
  * Registers the Widget Group block.
@@ -1 +1 @@
1
- {"version":3,"sources":["@wordpress/widgets/src/index.js"],"names":["registerBlockType","legacyWidget","widgetGroup","registerLegacyWidgetBlock","metadata","settings","name","registerWidgetGroupBlock","default","registerLegacyWidgetVariations"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,mBAAlC;AAEA;AACA;AACA;;AACA,OAAO,KAAKC,YAAZ,MAA8B,wBAA9B;AACA,OAAO,KAAKC,WAAZ,MAA6B,uBAA7B;AAEA,cAAc,cAAd;AACA,cAAc,SAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,yBAAT,GAAqC;AAC3C,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAA+BL,YAArC;AACAD,EAAAA,iBAAiB,CAAE;AAAEM,IAAAA,IAAF;AAAQ,OAAGF;AAAX,GAAF,EAAyBC,QAAzB,CAAjB;AACA;AAED;AACA;AACA;;AACA,OAAO,SAASE,wBAAT,GAAoC;AAC1C,QAAM;AAAEH,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAA+BJ,WAArC;AACAF,EAAAA,iBAAiB,CAAE;AAAEM,IAAAA,IAAF;AAAQ,OAAGF;AAAX,GAAF,EAAyBC,QAAzB,CAAjB;AACA;AAED,SAASG,OAAO,IAAIC,8BAApB,QAA0D,qCAA1D","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport * as legacyWidget from './blocks/legacy-widget';\nimport * as widgetGroup from './blocks/widget-group';\n\nexport * from './components';\nexport * from './utils';\n\n/**\n * Registers the Legacy Widget block.\n *\n * Note that for the block to be useful, any scripts required by a widget must\n * be loaded into the page.\n *\n * @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/\n */\nexport function registerLegacyWidgetBlock() {\n\tconst { metadata, settings, name } = legacyWidget;\n\tregisterBlockType( { name, ...metadata }, settings );\n}\n\n/**\n * Registers the Widget Group block.\n */\nexport function registerWidgetGroupBlock() {\n\tconst { metadata, settings, name } = widgetGroup;\n\tregisterBlockType( { name, ...metadata }, settings );\n}\n\nexport { default as registerLegacyWidgetVariations } from './register-legacy-widget-variations';\n"]}
1
+ {"version":3,"sources":["@wordpress/widgets/src/index.js"],"names":["registerBlockType","legacyWidget","widgetGroup","registerLegacyWidgetBlock","supports","metadata","settings","name","registerWidgetGroupBlock","default","registerLegacyWidgetVariations"],"mappings":"AAAA;AACA;AACA;AACA,SAASA,iBAAT,QAAkC,mBAAlC;AAEA;AACA;AACA;;AACA,OAAO,KAAKC,YAAZ,MAA8B,wBAA9B;AACA,OAAO,KAAKC,WAAZ,MAA6B,uBAA7B;AAEA,cAAc,cAAd;AACA,cAAc,SAAd;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,yBAAT,GAAoD;AAAA,MAAhBC,QAAgB,uEAAL,EAAK;AAC1D,QAAM;AAAEC,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAA+BN,YAArC;AACAD,EAAAA,iBAAiB,CAChB;AAAEO,IAAAA,IAAF;AAAQ,OAAGF;AAAX,GADgB,EAEhB,EACC,GAAGC,QADJ;AAECF,IAAAA,QAAQ,EAAE,EACT,GAAGE,QAAQ,CAACF,QADH;AAET,SAAGA;AAFM;AAFX,GAFgB,CAAjB;AAUA;AAED;AACA;AACA;;AACA,OAAO,SAASI,wBAAT,GAAoC;AAC1C,QAAM;AAAEH,IAAAA,QAAF;AAAYC,IAAAA,QAAZ;AAAsBC,IAAAA;AAAtB,MAA+BL,WAArC;AACAF,EAAAA,iBAAiB,CAAE;AAAEO,IAAAA,IAAF;AAAQ,OAAGF;AAAX,GAAF,EAAyBC,QAAzB,CAAjB;AACA;AAED,SAASG,OAAO,IAAIC,8BAApB,QAA0D,qCAA1D","sourcesContent":["/**\n * WordPress dependencies\n */\nimport { registerBlockType } from '@wordpress/blocks';\n\n/**\n * Internal dependencies\n */\nimport * as legacyWidget from './blocks/legacy-widget';\nimport * as widgetGroup from './blocks/widget-group';\n\nexport * from './components';\nexport * from './utils';\n\n/**\n * Registers the Legacy Widget block.\n *\n * Note that for the block to be useful, any scripts required by a widget must\n * be loaded into the page.\n *\n * @param {Object} supports Block support settings.\n * @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/\n */\nexport function registerLegacyWidgetBlock( supports = {} ) {\n\tconst { metadata, settings, name } = legacyWidget;\n\tregisterBlockType(\n\t\t{ name, ...metadata },\n\t\t{\n\t\t\t...settings,\n\t\t\tsupports: {\n\t\t\t\t...settings.supports,\n\t\t\t\t...supports,\n\t\t\t},\n\t\t}\n\t);\n}\n\n/**\n * Registers the Widget Group block.\n */\nexport function registerWidgetGroupBlock() {\n\tconst { metadata, settings, name } = widgetGroup;\n\tregisterBlockType( { name, ...metadata }, settings );\n}\n\nexport { default as registerLegacyWidgetVariations } from './register-legacy-widget-variations';\n"]}
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Converts a hex value into the rgb equivalent.
3
+ *
4
+ * @param {string} hex - the hexadecimal value to convert
5
+ * @return {string} comma separated rgb values
6
+ */
1
7
  /**
2
8
  * Colors
3
9
  */
@@ -11,6 +17,12 @@
11
17
  * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
12
18
  * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
13
19
  */
20
+ /**
21
+ * Converts a hex value into the rgb equivalent.
22
+ *
23
+ * @param {string} hex - the hexadecimal value to convert
24
+ * @return {string} comma separated rgb values
25
+ */
14
26
  /**
15
27
  * Colors
16
28
  */
@@ -46,15 +58,15 @@
46
58
  * @param {string} hex - the hexadecimal value to convert
47
59
  * @return {string} comma separated rgb values
48
60
  */
49
- /**
50
- * Breakpoint mixins
51
- */
52
61
  /**
53
62
  * Long content fade mixin
54
63
  *
55
64
  * Creates a fading overlay to signify that the content is longer
56
65
  * than the space allows.
57
66
  */
67
+ /**
68
+ * Breakpoint mixins
69
+ */
58
70
  /**
59
71
  * Focus styles.
60
72
  */
@@ -82,6 +94,8 @@
82
94
  --wp-admin-theme-color-darker-20: #005a87;
83
95
  --wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
84
96
  --wp-admin-border-width-focus: 2px;
97
+ --wp-block-synced-color: #7a00df;
98
+ --wp-block-synced-color--rgb: 122, 0, 223;
85
99
  }
86
100
  @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
87
101
  :root {
@@ -1,3 +1,9 @@
1
+ /**
2
+ * Converts a hex value into the rgb equivalent.
3
+ *
4
+ * @param {string} hex - the hexadecimal value to convert
5
+ * @return {string} comma separated rgb values
6
+ */
1
7
  /**
2
8
  * Colors
3
9
  */
@@ -11,6 +17,12 @@
11
17
  * Don't add to this sheet unless you're pretty sure the value will be reused in many places.
12
18
  * For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
13
19
  */
20
+ /**
21
+ * Converts a hex value into the rgb equivalent.
22
+ *
23
+ * @param {string} hex - the hexadecimal value to convert
24
+ * @return {string} comma separated rgb values
25
+ */
14
26
  /**
15
27
  * Colors
16
28
  */
@@ -46,15 +58,15 @@
46
58
  * @param {string} hex - the hexadecimal value to convert
47
59
  * @return {string} comma separated rgb values
48
60
  */
49
- /**
50
- * Breakpoint mixins
51
- */
52
61
  /**
53
62
  * Long content fade mixin
54
63
  *
55
64
  * Creates a fading overlay to signify that the content is longer
56
65
  * than the space allows.
57
66
  */
67
+ /**
68
+ * Breakpoint mixins
69
+ */
58
70
  /**
59
71
  * Focus styles.
60
72
  */
@@ -82,6 +94,8 @@
82
94
  --wp-admin-theme-color-darker-20: #005a87;
83
95
  --wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
84
96
  --wp-admin-border-width-focus: 2px;
97
+ --wp-block-synced-color: #7a00df;
98
+ --wp-block-synced-color--rgb: 122, 0, 223;
85
99
  }
86
100
  @media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
87
101
  :root {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/widgets",
3
- "version": "2.20.0",
3
+ "version": "3.1.0",
4
4
  "description": "Functionality used by the widgets block editor in the Widgets screen and the Customizer.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -21,25 +21,25 @@
21
21
  "react-native": "src/index",
22
22
  "dependencies": {
23
23
  "@babel/runtime": "^7.16.0",
24
- "@wordpress/api-fetch": "^6.19.0",
25
- "@wordpress/block-editor": "^10.5.0",
26
- "@wordpress/blocks": "^11.21.0",
27
- "@wordpress/components": "^22.1.0",
28
- "@wordpress/compose": "^5.20.0",
29
- "@wordpress/core-data": "^5.5.0",
30
- "@wordpress/data": "^7.6.0",
31
- "@wordpress/element": "^4.20.0",
32
- "@wordpress/i18n": "^4.22.0",
33
- "@wordpress/icons": "^9.13.0",
34
- "@wordpress/notices": "^3.22.0",
24
+ "@wordpress/api-fetch": "^6.21.0",
25
+ "@wordpress/block-editor": "^11.1.0",
26
+ "@wordpress/blocks": "^12.1.0",
27
+ "@wordpress/components": "^23.1.0",
28
+ "@wordpress/compose": "^6.1.0",
29
+ "@wordpress/core-data": "^6.1.0",
30
+ "@wordpress/data": "^8.1.0",
31
+ "@wordpress/element": "^5.1.0",
32
+ "@wordpress/i18n": "^4.24.0",
33
+ "@wordpress/icons": "^9.15.0",
34
+ "@wordpress/notices": "^3.24.0",
35
35
  "classnames": "^2.3.1"
36
36
  },
37
37
  "peerDependencies": {
38
- "react": "^17.0.0",
39
- "react-dom": "^17.0.0"
38
+ "react": "^18.0.0",
39
+ "react-dom": "^18.0.0"
40
40
  },
41
41
  "publishConfig": {
42
42
  "access": "public"
43
43
  },
44
- "gitHead": "7ac04f446242452d3cb24372f9ca58f0cae97715"
44
+ "gitHead": "200bee7b06b15f6fa655e25b6ab69cbd6b49a357"
45
45
  }
package/src/index.js CHANGED
@@ -18,11 +18,21 @@ export * from './utils';
18
18
  * Note that for the block to be useful, any scripts required by a widget must
19
19
  * be loaded into the page.
20
20
  *
21
+ * @param {Object} supports Block support settings.
21
22
  * @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/
22
23
  */
23
- export function registerLegacyWidgetBlock() {
24
+ export function registerLegacyWidgetBlock( supports = {} ) {
24
25
  const { metadata, settings, name } = legacyWidget;
25
- registerBlockType( { name, ...metadata }, settings );
26
+ registerBlockType(
27
+ { name, ...metadata },
28
+ {
29
+ ...settings,
30
+ supports: {
31
+ ...settings.supports,
32
+ ...supports,
33
+ },
34
+ }
35
+ );
26
36
  }
27
37
 
28
38
  /**