@wordpress/widgets 4.32.0 → 4.32.1-next.ff1cebbba.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 (86) hide show
  1. package/build/blocks/legacy-widget/block.json +29 -0
  2. package/build/blocks/legacy-widget/edit/control.js +137 -167
  3. package/build/blocks/legacy-widget/edit/control.js.map +7 -1
  4. package/build/blocks/legacy-widget/edit/convert-to-blocks-button.js +51 -39
  5. package/build/blocks/legacy-widget/edit/convert-to-blocks-button.js.map +7 -1
  6. package/build/blocks/legacy-widget/edit/form.js +105 -75
  7. package/build/blocks/legacy-widget/edit/form.js.map +7 -1
  8. package/build/blocks/legacy-widget/edit/index.js +121 -131
  9. package/build/blocks/legacy-widget/edit/index.js.map +7 -1
  10. package/build/blocks/legacy-widget/edit/inspector-card.js +28 -20
  11. package/build/blocks/legacy-widget/edit/inspector-card.js.map +7 -1
  12. package/build/blocks/legacy-widget/edit/no-preview.js +29 -23
  13. package/build/blocks/legacy-widget/edit/no-preview.js.map +7 -1
  14. package/build/blocks/legacy-widget/edit/preview.js +107 -108
  15. package/build/blocks/legacy-widget/edit/preview.js.map +7 -1
  16. package/build/blocks/legacy-widget/edit/widget-type-selector.js +61 -52
  17. package/build/blocks/legacy-widget/edit/widget-type-selector.js.map +7 -1
  18. package/build/blocks/legacy-widget/index.js +49 -53
  19. package/build/blocks/legacy-widget/index.js.map +7 -1
  20. package/build/blocks/legacy-widget/transforms.js +189 -198
  21. package/build/blocks/legacy-widget/transforms.js.map +7 -1
  22. package/build/blocks/widget-group/block.json +20 -0
  23. package/build/blocks/widget-group/deprecated.js +38 -24
  24. package/build/blocks/widget-group/deprecated.js.map +7 -1
  25. package/build/blocks/widget-group/edit.js +63 -67
  26. package/build/blocks/widget-group/edit.js.map +7 -1
  27. package/build/blocks/widget-group/index.js +93 -80
  28. package/build/blocks/widget-group/index.js.map +7 -1
  29. package/build/blocks/widget-group/save.js +36 -25
  30. package/build/blocks/widget-group/save.js.map +7 -1
  31. package/build/components/index.js +36 -12
  32. package/build/components/index.js.map +7 -1
  33. package/build/components/move-to-widget-area/index.js +48 -37
  34. package/build/components/move-to-widget-area/index.js.map +7 -1
  35. package/build/index.js +67 -98
  36. package/build/index.js.map +7 -1
  37. package/build/register-legacy-widget-variations.js +42 -30
  38. package/build/register-legacy-widget-variations.js.map +7 -1
  39. package/build/utils.js +29 -29
  40. package/build/utils.js.map +7 -1
  41. package/build-module/blocks/legacy-widget/block.json +29 -0
  42. package/build-module/blocks/legacy-widget/edit/control.js +107 -158
  43. package/build-module/blocks/legacy-widget/edit/control.js.map +7 -1
  44. package/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js +33 -33
  45. package/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js.map +7 -1
  46. package/build-module/blocks/legacy-widget/edit/form.js +75 -64
  47. package/build-module/blocks/legacy-widget/edit/form.js.map +7 -1
  48. package/build-module/blocks/legacy-widget/edit/index.js +96 -122
  49. package/build-module/blocks/legacy-widget/edit/index.js.map +7 -1
  50. package/build-module/blocks/legacy-widget/edit/inspector-card.js +10 -15
  51. package/build-module/blocks/legacy-widget/edit/inspector-card.js.map +7 -1
  52. package/build-module/blocks/legacy-widget/edit/no-preview.js +11 -17
  53. package/build-module/blocks/legacy-widget/edit/no-preview.js.map +7 -1
  54. package/build-module/blocks/legacy-widget/edit/preview.js +76 -98
  55. package/build-module/blocks/legacy-widget/edit/preview.js.map +7 -1
  56. package/build-module/blocks/legacy-widget/edit/widget-type-selector.js +43 -46
  57. package/build-module/blocks/legacy-widget/edit/widget-type-selector.js.map +7 -1
  58. package/build-module/blocks/legacy-widget/index.js +12 -45
  59. package/build-module/blocks/legacy-widget/index.js.map +7 -1
  60. package/build-module/blocks/legacy-widget/transforms.js +171 -192
  61. package/build-module/blocks/legacy-widget/transforms.js.map +7 -1
  62. package/build-module/blocks/widget-group/block.json +20 -0
  63. package/build-module/blocks/widget-group/deprecated.js +20 -18
  64. package/build-module/blocks/widget-group/deprecated.js.map +7 -1
  65. package/build-module/blocks/widget-group/edit.js +53 -62
  66. package/build-module/blocks/widget-group/edit.js.map +7 -1
  67. package/build-module/blocks/widget-group/index.js +55 -71
  68. package/build-module/blocks/widget-group/index.js.map +7 -1
  69. package/build-module/blocks/widget-group/save.js +18 -19
  70. package/build-module/blocks/widget-group/save.js.map +7 -1
  71. package/build-module/components/index.js +5 -2
  72. package/build-module/components/index.js.map +7 -1
  73. package/build-module/components/move-to-widget-area/index.js +37 -32
  74. package/build-module/components/move-to-widget-area/index.js.map +7 -1
  75. package/build-module/index.js +34 -60
  76. package/build-module/index.js.map +7 -1
  77. package/build-module/register-legacy-widget-variations.js +24 -24
  78. package/build-module/register-legacy-widget-variations.js.map +7 -1
  79. package/build-module/utils.js +8 -25
  80. package/build-module/utils.js.map +7 -1
  81. package/build-style/style-rtl.css +10 -145
  82. package/build-style/style.css +10 -145
  83. package/package.json +21 -14
  84. package/src/blocks/legacy-widget/editor.scss +3 -0
  85. package/src/blocks/widget-group/editor.scss +3 -0
  86. package/src/style.scss +3 -2
@@ -1 +1,7 @@
1
- {"version":3,"names":["_components","require","_i18n","_icons","_jsxRuntime","MoveToWidgetArea","currentWidgetAreaId","widgetAreas","onSelect","jsx","ToolbarGroup","children","ToolbarItem","toggleProps","DropdownMenu","icon","moveTo","label","__","onClose","MenuGroup","MenuItemsChoice","choices","map","widgetArea","value","id","name","info","description"],"sources":["@wordpress/widgets/src/components/move-to-widget-area/index.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\tToolbarGroup,\n\tToolbarItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moveTo } from '@wordpress/icons';\n\nexport default function MoveToWidgetArea( {\n\tcurrentWidgetAreaId,\n\twidgetAreas,\n\tonSelect,\n} ) {\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ moveTo }\n\t\t\t\t\t\tlabel={ __( 'Move to widget area' ) }\n\t\t\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup label={ __( 'Move to' ) }>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tchoices={ widgetAreas.map(\n\t\t\t\t\t\t\t\t\t\t( widgetArea ) => ( {\n\t\t\t\t\t\t\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\t\t\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t\t\t\t\t\t\t\tinfo: widgetArea.description,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tvalue={ currentWidgetAreaId }\n\t\t\t\t\t\t\t\t\tonSelect={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tonSelect( value );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n}\n"],"mappings":";;;;;;AAGA,IAAAA,WAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAA0C,IAAAG,WAAA,GAAAH,OAAA;AAX1C;AACA;AACA;;AAWe,SAASI,gBAAgBA,CAAE;EACzCC,mBAAmB;EACnBC,WAAW;EACXC;AACD,CAAC,EAAG;EACH,oBACC,IAAAJ,WAAA,CAAAK,GAAA,EAACT,WAAA,CAAAU,YAAY;IAAAC,QAAA,eACZ,IAAAP,WAAA,CAAAK,GAAA,EAACT,WAAA,CAAAY,WAAW;MAAAD,QAAA,EACPE,WAAW,iBACd,IAAAT,WAAA,CAAAK,GAAA,EAACT,WAAA,CAAAc,YAAY;QACZC,IAAI,EAAGC,aAAQ;QACfC,KAAK,EAAG,IAAAC,QAAE,EAAE,qBAAsB,CAAG;QACrCL,WAAW,EAAGA,WAAa;QAAAF,QAAA,EAEzBA,CAAE;UAAEQ;QAAQ,CAAC,kBACd,IAAAf,WAAA,CAAAK,GAAA,EAACT,WAAA,CAAAoB,SAAS;UAACH,KAAK,EAAG,IAAAC,QAAE,EAAE,SAAU,CAAG;UAAAP,QAAA,eACnC,IAAAP,WAAA,CAAAK,GAAA,EAACT,WAAA,CAAAqB,eAAe;YACfC,OAAO,EAAGf,WAAW,CAACgB,GAAG,CACtBC,UAAU,KAAQ;cACnBC,KAAK,EAAED,UAAU,CAACE,EAAE;cACpBT,KAAK,EAAEO,UAAU,CAACG,IAAI;cACtBC,IAAI,EAAEJ,UAAU,CAACK;YAClB,CAAC,CACF,CAAG;YACHJ,KAAK,EAAGnB,mBAAqB;YAC7BE,QAAQ,EAAKiB,KAAK,IAAM;cACvBjB,QAAQ,CAAEiB,KAAM,CAAC;cACjBN,OAAO,CAAC,CAAC;YACV;UAAG,CACH;QAAC,CACQ;MACX,CACY;IACd,CACW;EAAC,CACD,CAAC;AAEjB","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/move-to-widget-area/index.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport {\n\tDropdownMenu,\n\tMenuGroup,\n\tMenuItemsChoice,\n\tToolbarGroup,\n\tToolbarItem,\n} from '@wordpress/components';\nimport { __ } from '@wordpress/i18n';\nimport { moveTo } from '@wordpress/icons';\n\nexport default function MoveToWidgetArea( {\n\tcurrentWidgetAreaId,\n\twidgetAreas,\n\tonSelect,\n} ) {\n\treturn (\n\t\t<ToolbarGroup>\n\t\t\t<ToolbarItem>\n\t\t\t\t{ ( toggleProps ) => (\n\t\t\t\t\t<DropdownMenu\n\t\t\t\t\t\ticon={ moveTo }\n\t\t\t\t\t\tlabel={ __( 'Move to widget area' ) }\n\t\t\t\t\t\ttoggleProps={ toggleProps }\n\t\t\t\t\t>\n\t\t\t\t\t\t{ ( { onClose } ) => (\n\t\t\t\t\t\t\t<MenuGroup label={ __( 'Move to' ) }>\n\t\t\t\t\t\t\t\t<MenuItemsChoice\n\t\t\t\t\t\t\t\t\tchoices={ widgetAreas.map(\n\t\t\t\t\t\t\t\t\t\t( widgetArea ) => ( {\n\t\t\t\t\t\t\t\t\t\t\tvalue: widgetArea.id,\n\t\t\t\t\t\t\t\t\t\t\tlabel: widgetArea.name,\n\t\t\t\t\t\t\t\t\t\t\tinfo: widgetArea.description,\n\t\t\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t\t\t\t) }\n\t\t\t\t\t\t\t\t\tvalue={ currentWidgetAreaId }\n\t\t\t\t\t\t\t\t\tonSelect={ ( value ) => {\n\t\t\t\t\t\t\t\t\t\tonSelect( value );\n\t\t\t\t\t\t\t\t\t\tonClose();\n\t\t\t\t\t\t\t\t\t} }\n\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t</MenuGroup>\n\t\t\t\t\t\t) }\n\t\t\t\t\t</DropdownMenu>\n\t\t\t\t) }\n\t\t\t</ToolbarItem>\n\t\t</ToolbarGroup>\n\t);\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6BQ;AA1BR,wBAMO;AACP,kBAAmB;AACnB,mBAAuB;AAER,SAAR,iBAAmC;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AACD,GAAI;AACH,SACC,4CAAC,kCACA,sDAAC,iCACE,WAAE,gBACH;AAAA,IAAC;AAAA;AAAA,MACA,MAAO;AAAA,MACP,WAAQ,gBAAI,qBAAsB;AAAA,MAClC;AAAA,MAEE,WAAE,EAAE,QAAQ,MACb,4CAAC,+BAAU,WAAQ,gBAAI,SAAU,GAChC;AAAA,QAAC;AAAA;AAAA,UACA,SAAU,YAAY;AAAA,YACrB,CAAE,gBAAkB;AAAA,cACnB,OAAO,WAAW;AAAA,cAClB,OAAO,WAAW;AAAA,cAClB,MAAM,WAAW;AAAA,YAClB;AAAA,UACD;AAAA,UACA,OAAQ;AAAA,UACR,UAAW,CAAE,UAAW;AACvB,qBAAU,KAAM;AAChB,oBAAQ;AAAA,UACT;AAAA;AAAA,MACD,GACD;AAAA;AAAA,EAEF,GAEF,GACD;AAEF;",
6
+ "names": []
7
+ }
package/build/index.js CHANGED
@@ -1,107 +1,76 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- var _exportNames = {
8
- registerLegacyWidgetBlock: true,
9
- registerWidgetGroupBlock: true,
10
- registerLegacyWidgetVariations: true
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
11
10
  };
12
- exports.registerLegacyWidgetBlock = registerLegacyWidgetBlock;
13
- Object.defineProperty(exports, "registerLegacyWidgetVariations", {
14
- enumerable: true,
15
- get: function () {
16
- return _registerLegacyWidgetVariations.default;
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
16
  }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var index_exports = {};
30
+ __export(index_exports, {
31
+ registerLegacyWidgetBlock: () => registerLegacyWidgetBlock,
32
+ registerLegacyWidgetVariations: () => import_register_legacy_widget_variations.default,
33
+ registerWidgetGroupBlock: () => registerWidgetGroupBlock
18
34
  });
19
- exports.registerWidgetGroupBlock = registerWidgetGroupBlock;
20
- var _blocks = require("@wordpress/blocks");
21
- var legacyWidget = _interopRequireWildcard(require("./blocks/legacy-widget"));
22
- var widgetGroup = _interopRequireWildcard(require("./blocks/widget-group"));
23
- var _components = require("./components");
24
- Object.keys(_components).forEach(function (key) {
25
- if (key === "default" || key === "__esModule") return;
26
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
27
- if (key in exports && exports[key] === _components[key]) return;
28
- Object.defineProperty(exports, key, {
29
- enumerable: true,
30
- get: function () {
31
- return _components[key];
32
- }
33
- });
34
- });
35
- var _utils = require("./utils");
36
- Object.keys(_utils).forEach(function (key) {
37
- if (key === "default" || key === "__esModule") return;
38
- if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
39
- if (key in exports && exports[key] === _utils[key]) return;
40
- Object.defineProperty(exports, key, {
41
- enumerable: true,
42
- get: function () {
43
- return _utils[key];
44
- }
45
- });
46
- });
47
- var _registerLegacyWidgetVariations = _interopRequireDefault(require("./register-legacy-widget-variations"));
48
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
49
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
50
- /**
51
- * WordPress dependencies
52
- */
53
-
54
- /**
55
- * Internal dependencies
56
- */
57
-
58
- /**
59
- * Registers the Legacy Widget block.
60
- *
61
- * Note that for the block to be useful, any scripts required by a widget must
62
- * be loaded into the page.
63
- *
64
- * @param {Object} supports Block support settings.
65
- * @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/
66
- */
35
+ module.exports = __toCommonJS(index_exports);
36
+ var import_blocks = require("@wordpress/blocks");
37
+ var legacyWidget = __toESM(require("./blocks/legacy-widget"));
38
+ var widgetGroup = __toESM(require("./blocks/widget-group"));
39
+ __reExport(index_exports, require("./components"), module.exports);
40
+ __reExport(index_exports, require("./utils"), module.exports);
41
+ var import_register_legacy_widget_variations = __toESM(require("./register-legacy-widget-variations"));
67
42
  function registerLegacyWidgetBlock(supports = {}) {
68
- const {
69
- metadata,
70
- settings,
71
- name
72
- } = legacyWidget;
73
- (0, _blocks.registerBlockType)({
74
- name,
75
- ...metadata
76
- }, {
77
- ...settings,
78
- supports: {
79
- ...settings.supports,
80
- ...supports
43
+ const { metadata, settings, name } = legacyWidget;
44
+ (0, import_blocks.registerBlockType)(
45
+ { name, ...metadata },
46
+ {
47
+ ...settings,
48
+ supports: {
49
+ ...settings.supports,
50
+ ...supports
51
+ }
81
52
  }
82
- });
53
+ );
83
54
  }
84
-
85
- /**
86
- * Registers the Widget Group block.
87
- *
88
- * @param {Object} supports Block support settings.
89
- */
90
55
  function registerWidgetGroupBlock(supports = {}) {
91
- const {
92
- metadata,
93
- settings,
94
- name
95
- } = widgetGroup;
96
- (0, _blocks.registerBlockType)({
97
- name,
98
- ...metadata
99
- }, {
100
- ...settings,
101
- supports: {
102
- ...settings.supports,
103
- ...supports
56
+ const { metadata, settings, name } = widgetGroup;
57
+ (0, import_blocks.registerBlockType)(
58
+ { name, ...metadata },
59
+ {
60
+ ...settings,
61
+ supports: {
62
+ ...settings.supports,
63
+ ...supports
64
+ }
104
65
  }
105
- });
66
+ );
106
67
  }
107
- //# sourceMappingURL=index.js.map
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ registerLegacyWidgetBlock,
71
+ registerLegacyWidgetVariations,
72
+ registerWidgetGroupBlock,
73
+ ...require("./components"),
74
+ ...require("./utils")
75
+ });
76
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_blocks","require","legacyWidget","_interopRequireWildcard","widgetGroup","_components","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_utils","_registerLegacyWidgetVariations","_interopRequireDefault","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","n","__proto__","a","getOwnPropertyDescriptor","u","i","set","registerLegacyWidgetBlock","supports","metadata","settings","name","registerBlockType","registerWidgetGroupBlock"],"sources":["@wordpress/widgets/src/index.js"],"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 *\n * @param {Object} supports Block support settings.\n */\nexport function registerWidgetGroupBlock( supports = {} ) {\n\tconst { metadata, settings, name } = widgetGroup;\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\nexport { default as registerLegacyWidgetVariations } from './register-legacy-widget-variations';\n"],"mappings":"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","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/index.js"],
4
+ "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 *\n * @param {Object} supports Block support settings.\n */\nexport function registerWidgetGroupBlock( supports = {} ) {\n\tconst { metadata, settings, name } = widgetGroup;\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\nexport { default as registerLegacyWidgetVariations } from './register-legacy-widget-variations';\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,oBAAkC;AAKlC,mBAA8B;AAC9B,kBAA6B;AAE7B,0BAAc,yBAXd;AAYA,0BAAc,oBAZd;AAwDA,+CAA0D;AAjCnD,SAAS,0BAA2B,WAAW,CAAC,GAAI;AAC1D,QAAM,EAAE,UAAU,UAAU,KAAK,IAAI;AACrC;AAAA,IACC,EAAE,MAAM,GAAG,SAAS;AAAA,IACpB;AAAA,MACC,GAAG;AAAA,MACH,UAAU;AAAA,QACT,GAAG,SAAS;AAAA,QACZ,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AACD;AAOO,SAAS,yBAA0B,WAAW,CAAC,GAAI;AACzD,QAAM,EAAE,UAAU,UAAU,KAAK,IAAI;AACrC;AAAA,IACC,EAAE,MAAM,GAAG,SAAS;AAAA,IACpB;AAAA,MACC,GAAG;AAAA,MACH,UAAU;AAAA,QACT,GAAG,SAAS;AAAA,QACZ,GAAG;AAAA,MACJ;AAAA,IACD;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -1,37 +1,49 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var register_legacy_widget_variations_exports = {};
19
+ __export(register_legacy_widget_variations_exports, {
20
+ default: () => registerLegacyWidgetVariations
5
21
  });
6
- exports.default = registerLegacyWidgetVariations;
7
- var _data = require("@wordpress/data");
8
- var _coreData = require("@wordpress/core-data");
9
- var _blocks = require("@wordpress/blocks");
10
- /**
11
- * WordPress dependencies
12
- */
13
-
22
+ module.exports = __toCommonJS(register_legacy_widget_variations_exports);
23
+ var import_data = require("@wordpress/data");
24
+ var import_core_data = require("@wordpress/core-data");
25
+ var import_blocks = require("@wordpress/blocks");
14
26
  function registerLegacyWidgetVariations(settings) {
15
- const unsubscribe = (0, _data.subscribe)(() => {
16
- var _settings$widgetTypes;
17
- const hiddenIds = (_settings$widgetTypes = settings?.widgetTypesToHideFromLegacyWidgetBlock) !== null && _settings$widgetTypes !== void 0 ? _settings$widgetTypes : [];
18
- const widgetTypes = (0, _data.select)(_coreData.store).getWidgetTypes({
19
- per_page: -1
20
- })?.filter(widgetType => !hiddenIds.includes(widgetType.id));
27
+ const unsubscribe = (0, import_data.subscribe)(() => {
28
+ const hiddenIds = settings?.widgetTypesToHideFromLegacyWidgetBlock ?? [];
29
+ const widgetTypes = (0, import_data.select)(import_core_data.store).getWidgetTypes({ per_page: -1 })?.filter((widgetType) => !hiddenIds.includes(widgetType.id));
21
30
  if (widgetTypes) {
22
31
  unsubscribe();
23
- (0, _data.dispatch)(_blocks.store).addBlockVariations('core/legacy-widget', widgetTypes.map(widgetType => ({
24
- name: widgetType.id,
25
- title: widgetType.name,
26
- description: widgetType.description,
27
- attributes: widgetType.is_multi ? {
28
- idBase: widgetType.id,
29
- instance: {}
30
- } : {
31
- id: widgetType.id
32
- }
33
- })));
32
+ (0, import_data.dispatch)(import_blocks.store).addBlockVariations(
33
+ "core/legacy-widget",
34
+ widgetTypes.map((widgetType) => ({
35
+ name: widgetType.id,
36
+ title: widgetType.name,
37
+ description: widgetType.description,
38
+ attributes: widgetType.is_multi ? {
39
+ idBase: widgetType.id,
40
+ instance: {}
41
+ } : {
42
+ id: widgetType.id
43
+ }
44
+ }))
45
+ );
34
46
  }
35
47
  });
36
48
  }
37
- //# sourceMappingURL=register-legacy-widget-variations.js.map
49
+ //# sourceMappingURL=register-legacy-widget-variations.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["_data","require","_coreData","_blocks","registerLegacyWidgetVariations","settings","unsubscribe","subscribe","_settings$widgetTypes","hiddenIds","widgetTypesToHideFromLegacyWidgetBlock","widgetTypes","select","coreStore","getWidgetTypes","per_page","filter","widgetType","includes","id","dispatch","blocksStore","addBlockVariations","map","name","title","description","attributes","is_multi","idBase","instance"],"sources":["@wordpress/widgets/src/register-legacy-widget-variations.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { subscribe, select, dispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\nexport default function registerLegacyWidgetVariations( settings ) {\n\tconst unsubscribe = subscribe( () => {\n\t\tconst hiddenIds =\n\t\t\tsettings?.widgetTypesToHideFromLegacyWidgetBlock ?? [];\n\t\tconst widgetTypes = select( coreStore )\n\t\t\t.getWidgetTypes( { per_page: -1 } )\n\t\t\t?.filter( ( widgetType ) => ! hiddenIds.includes( widgetType.id ) );\n\t\tif ( widgetTypes ) {\n\t\t\tunsubscribe();\n\t\t\tdispatch( blocksStore ).addBlockVariations(\n\t\t\t\t'core/legacy-widget',\n\t\t\t\twidgetTypes.map( ( widgetType ) => ( {\n\t\t\t\t\tname: widgetType.id,\n\t\t\t\t\ttitle: widgetType.name,\n\t\t\t\t\tdescription: widgetType.description,\n\t\t\t\t\tattributes: widgetType.is_multi\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tidBase: widgetType.id,\n\t\t\t\t\t\t\t\tinstance: {},\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tid: widgetType.id,\n\t\t\t\t\t\t },\n\t\t\t\t} ) )\n\t\t\t);\n\t\t}\n\t} );\n}\n"],"mappings":";;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKe,SAASG,8BAA8BA,CAAEC,QAAQ,EAAG;EAClE,MAAMC,WAAW,GAAG,IAAAC,eAAS,EAAE,MAAM;IAAA,IAAAC,qBAAA;IACpC,MAAMC,SAAS,IAAAD,qBAAA,GACdH,QAAQ,EAAEK,sCAAsC,cAAAF,qBAAA,cAAAA,qBAAA,GAAI,EAAE;IACvD,MAAMG,WAAW,GAAG,IAAAC,YAAM,EAAEC,eAAU,CAAC,CACrCC,cAAc,CAAE;MAAEC,QAAQ,EAAE,CAAC;IAAE,CAAE,CAAC,EACjCC,MAAM,CAAIC,UAAU,IAAM,CAAER,SAAS,CAACS,QAAQ,CAAED,UAAU,CAACE,EAAG,CAAE,CAAC;IACpE,IAAKR,WAAW,EAAG;MAClBL,WAAW,CAAC,CAAC;MACb,IAAAc,cAAQ,EAAEC,aAAY,CAAC,CAACC,kBAAkB,CACzC,oBAAoB,EACpBX,WAAW,CAACY,GAAG,CAAIN,UAAU,KAAQ;QACpCO,IAAI,EAAEP,UAAU,CAACE,EAAE;QACnBM,KAAK,EAAER,UAAU,CAACO,IAAI;QACtBE,WAAW,EAAET,UAAU,CAACS,WAAW;QACnCC,UAAU,EAAEV,UAAU,CAACW,QAAQ,GAC5B;UACAC,MAAM,EAAEZ,UAAU,CAACE,EAAE;UACrBW,QAAQ,EAAE,CAAC;QACX,CAAC,GACD;UACAX,EAAE,EAAEF,UAAU,CAACE;QACf;MACJ,CAAC,CAAG,CACL,CAAC;IACF;EACD,CAAE,CAAC;AACJ","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/register-legacy-widget-variations.js"],
4
+ "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { subscribe, select, dispatch } from '@wordpress/data';\nimport { store as coreStore } from '@wordpress/core-data';\nimport { store as blocksStore } from '@wordpress/blocks';\n\nexport default function registerLegacyWidgetVariations( settings ) {\n\tconst unsubscribe = subscribe( () => {\n\t\tconst hiddenIds =\n\t\t\tsettings?.widgetTypesToHideFromLegacyWidgetBlock ?? [];\n\t\tconst widgetTypes = select( coreStore )\n\t\t\t.getWidgetTypes( { per_page: -1 } )\n\t\t\t?.filter( ( widgetType ) => ! hiddenIds.includes( widgetType.id ) );\n\t\tif ( widgetTypes ) {\n\t\t\tunsubscribe();\n\t\t\tdispatch( blocksStore ).addBlockVariations(\n\t\t\t\t'core/legacy-widget',\n\t\t\t\twidgetTypes.map( ( widgetType ) => ( {\n\t\t\t\t\tname: widgetType.id,\n\t\t\t\t\ttitle: widgetType.name,\n\t\t\t\t\tdescription: widgetType.description,\n\t\t\t\t\tattributes: widgetType.is_multi\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tidBase: widgetType.id,\n\t\t\t\t\t\t\t\tinstance: {},\n\t\t\t\t\t\t }\n\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\tid: widgetType.id,\n\t\t\t\t\t\t },\n\t\t\t\t} ) )\n\t\t\t);\n\t\t}\n\t} );\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAA4C;AAC5C,uBAAmC;AACnC,oBAAqC;AAEtB,SAAR,+BAAiD,UAAW;AAClE,QAAM,kBAAc,uBAAW,MAAM;AACpC,UAAM,YACL,UAAU,0CAA0C,CAAC;AACtD,UAAM,kBAAc,oBAAQ,iBAAAA,KAAU,EACpC,eAAgB,EAAE,UAAU,GAAG,CAAE,GAChC,OAAQ,CAAE,eAAgB,CAAE,UAAU,SAAU,WAAW,EAAG,CAAE;AACnE,QAAK,aAAc;AAClB,kBAAY;AACZ,gCAAU,cAAAC,KAAY,EAAE;AAAA,QACvB;AAAA,QACA,YAAY,IAAK,CAAE,gBAAkB;AAAA,UACpC,MAAM,WAAW;AAAA,UACjB,OAAO,WAAW;AAAA,UAClB,aAAa,WAAW;AAAA,UACxB,YAAY,WAAW,WACpB;AAAA,YACA,QAAQ,WAAW;AAAA,YACnB,UAAU,CAAC;AAAA,UACX,IACA;AAAA,YACA,IAAI,WAAW;AAAA,UACf;AAAA,QACJ,EAAI;AAAA,MACL;AAAA,IACD;AAAA,EACD,CAAE;AACH;",
6
+ "names": ["coreStore", "blocksStore"]
7
+ }
package/build/utils.js CHANGED
@@ -1,41 +1,41 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var utils_exports = {};
19
+ __export(utils_exports, {
20
+ addWidgetIdToBlock: () => addWidgetIdToBlock,
21
+ getWidgetIdFromBlock: () => getWidgetIdFromBlock
5
22
  });
6
- exports.addWidgetIdToBlock = addWidgetIdToBlock;
7
- exports.getWidgetIdFromBlock = getWidgetIdFromBlock;
8
- // @ts-check
9
-
10
- /**
11
- * Get the internal widget id from block.
12
- *
13
- * @typedef {Object} Attributes
14
- * @property {string} __internalWidgetId The internal widget id.
15
- * @typedef {Object} Block
16
- * @property {Attributes} attributes The attributes of the block.
17
- *
18
- * @param {Block} block The block.
19
- * @return {string} The internal widget id.
20
- */
23
+ module.exports = __toCommonJS(utils_exports);
21
24
  function getWidgetIdFromBlock(block) {
22
25
  return block.attributes.__internalWidgetId;
23
26
  }
24
-
25
- /**
26
- * Add internal widget id to block's attributes.
27
- *
28
- * @param {Block} block The block.
29
- * @param {string} widgetId The widget id.
30
- * @return {Block} The updated block.
31
- */
32
27
  function addWidgetIdToBlock(block, widgetId) {
33
28
  return {
34
29
  ...block,
35
30
  attributes: {
36
- ...(block.attributes || {}),
31
+ ...block.attributes || {},
37
32
  __internalWidgetId: widgetId
38
33
  }
39
34
  };
40
35
  }
41
- //# sourceMappingURL=utils.js.map
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ addWidgetIdToBlock,
39
+ getWidgetIdFromBlock
40
+ });
41
+ //# sourceMappingURL=utils.js.map
@@ -1 +1,7 @@
1
- {"version":3,"names":["getWidgetIdFromBlock","block","attributes","__internalWidgetId","addWidgetIdToBlock","widgetId"],"sources":["@wordpress/widgets/src/utils.js"],"sourcesContent":["// @ts-check\n\n/**\n * Get the internal widget id from block.\n *\n * @typedef {Object} Attributes\n * @property {string} __internalWidgetId The internal widget id.\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n *\n * @param {Block} block The block.\n * @return {string} The internal widget id.\n */\nexport function getWidgetIdFromBlock( block ) {\n\treturn block.attributes.__internalWidgetId;\n}\n\n/**\n * Add internal widget id to block's attributes.\n *\n * @param {Block} block The block.\n * @param {string} widgetId The widget id.\n * @return {Block} The updated block.\n */\nexport function addWidgetIdToBlock( block, widgetId ) {\n\treturn {\n\t\t...block,\n\t\tattributes: {\n\t\t\t...( block.attributes || {} ),\n\t\t\t__internalWidgetId: widgetId,\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,oBAAoBA,CAAEC,KAAK,EAAG;EAC7C,OAAOA,KAAK,CAACC,UAAU,CAACC,kBAAkB;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,kBAAkBA,CAAEH,KAAK,EAAEI,QAAQ,EAAG;EACrD,OAAO;IACN,GAAGJ,KAAK;IACRC,UAAU,EAAE;MACX,IAAKD,KAAK,CAACC,UAAU,IAAI,CAAC,CAAC,CAAE;MAC7BC,kBAAkB,EAAEE;IACrB;EACD,CAAC;AACF","ignoreList":[]}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/utils.js"],
4
+ "sourcesContent": ["// @ts-check\n\n/**\n * Get the internal widget id from block.\n *\n * @typedef {Object} Attributes\n * @property {string} __internalWidgetId The internal widget id.\n * @typedef {Object} Block\n * @property {Attributes} attributes The attributes of the block.\n *\n * @param {Block} block The block.\n * @return {string} The internal widget id.\n */\nexport function getWidgetIdFromBlock( block ) {\n\treturn block.attributes.__internalWidgetId;\n}\n\n/**\n * Add internal widget id to block's attributes.\n *\n * @param {Block} block The block.\n * @param {string} widgetId The widget id.\n * @return {Block} The updated block.\n */\nexport function addWidgetIdToBlock( block, widgetId ) {\n\treturn {\n\t\t...block,\n\t\tattributes: {\n\t\t\t...( block.attributes || {} ),\n\t\t\t__internalWidgetId: widgetId,\n\t\t},\n\t};\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAaO,SAAS,qBAAsB,OAAQ;AAC7C,SAAO,MAAM,WAAW;AACzB;AASO,SAAS,mBAAoB,OAAO,UAAW;AACrD,SAAO;AAAA,IACN,GAAG;AAAA,IACH,YAAY;AAAA,MACX,GAAK,MAAM,cAAc,CAAC;AAAA,MAC1B,oBAAoB;AAAA,IACrB;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 3,
4
+ "name": "core/legacy-widget",
5
+ "title": "Legacy Widget",
6
+ "category": "widgets",
7
+ "description": "Display a legacy widget.",
8
+ "textdomain": "default",
9
+ "attributes": {
10
+ "id": {
11
+ "type": "string",
12
+ "default": null
13
+ },
14
+ "idBase": {
15
+ "type": "string",
16
+ "default": null
17
+ },
18
+ "instance": {
19
+ "type": "object",
20
+ "default": null
21
+ }
22
+ },
23
+ "supports": {
24
+ "html": false,
25
+ "customClassName": false,
26
+ "reusable": false
27
+ },
28
+ "editorStyle": "wp-block-legacy-widget-editor"
29
+ }