author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:40:08 +0200 | |
changeset 21 | 48c4eec2b7e6 |
parent 19 | 3d72ae0968f4 |
child 22 | 8c2e4d02f4ef |
permissions | -rw-r--r-- |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1 |
/******/ (() => { // webpackBootstrap |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
2 |
/******/ "use strict"; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
3 |
/******/ // The require scope |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
4 |
/******/ var __webpack_require__ = {}; |
19 | 5 |
/******/ |
18 | 6 |
/************************************************************************/ |
19 | 7 |
/******/ /* webpack/runtime/compat get default export */ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
8 |
/******/ (() => { |
19 | 9 |
/******/ // getDefaultExport function for compatibility with non-harmony modules |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
10 |
/******/ __webpack_require__.n = (module) => { |
19 | 11 |
/******/ var getter = module && module.__esModule ? |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
12 |
/******/ () => (module['default']) : |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
13 |
/******/ () => (module); |
19 | 14 |
/******/ __webpack_require__.d(getter, { a: getter }); |
15 |
/******/ return getter; |
|
16 |
/******/ }; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
17 |
/******/ })(); |
19 | 18 |
/******/ |
19 |
/******/ /* webpack/runtime/define property getters */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
20 |
/******/ (() => { |
19 | 21 |
/******/ // define getter functions for harmony exports |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
22 |
/******/ __webpack_require__.d = (exports, definition) => { |
19 | 23 |
/******/ for(var key in definition) { |
24 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
|
25 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
|
26 |
/******/ } |
|
27 |
/******/ } |
|
28 |
/******/ }; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
29 |
/******/ })(); |
19 | 30 |
/******/ |
31 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
32 |
/******/ (() => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
33 |
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
34 |
/******/ })(); |
19 | 35 |
/******/ |
36 |
/******/ /* webpack/runtime/make namespace object */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
37 |
/******/ (() => { |
19 | 38 |
/******/ // define __esModule on exports |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
39 |
/******/ __webpack_require__.r = (exports) => { |
19 | 40 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
41 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
|
42 |
/******/ } |
|
43 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
|
44 |
/******/ }; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
45 |
/******/ })(); |
19 | 46 |
/******/ |
47 |
/************************************************************************/ |
|
48 |
var __webpack_exports__ = {}; |
|
18 | 49 |
// ESM COMPAT FLAG |
50 |
__webpack_require__.r(__webpack_exports__); |
|
51 |
||
52 |
// EXPORTS |
|
19 | 53 |
__webpack_require__.d(__webpack_exports__, { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
54 |
MoveToWidgetArea: () => (/* reexport */ MoveToWidgetArea), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
55 |
addWidgetIdToBlock: () => (/* reexport */ addWidgetIdToBlock), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
56 |
getWidgetIdFromBlock: () => (/* reexport */ getWidgetIdFromBlock), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
57 |
registerLegacyWidgetBlock: () => (/* binding */ registerLegacyWidgetBlock), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
58 |
registerLegacyWidgetVariations: () => (/* reexport */ registerLegacyWidgetVariations), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
59 |
registerWidgetGroupBlock: () => (/* binding */ registerWidgetGroupBlock) |
19 | 60 |
}); |
18 | 61 |
|
62 |
// NAMESPACE OBJECT: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/index.js |
|
63 |
var legacy_widget_namespaceObject = {}; |
|
64 |
__webpack_require__.r(legacy_widget_namespaceObject); |
|
19 | 65 |
__webpack_require__.d(legacy_widget_namespaceObject, { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
66 |
metadata: () => (metadata), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
67 |
name: () => (legacy_widget_name), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
68 |
settings: () => (settings) |
19 | 69 |
}); |
18 | 70 |
|
19 | 71 |
// NAMESPACE OBJECT: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/index.js |
72 |
var widget_group_namespaceObject = {}; |
|
73 |
__webpack_require__.r(widget_group_namespaceObject); |
|
74 |
__webpack_require__.d(widget_group_namespaceObject, { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
75 |
metadata: () => (widget_group_metadata), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
76 |
name: () => (widget_group_name), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
77 |
settings: () => (widget_group_settings) |
19 | 78 |
}); |
18 | 79 |
|
19 | 80 |
;// CONCATENATED MODULE: external ["wp","blocks"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
81 |
const external_wp_blocks_namespaceObject = window["wp"]["blocks"]; |
19 | 82 |
;// CONCATENATED MODULE: external ["wp","primitives"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
83 |
const external_wp_primitives_namespaceObject = window["wp"]["primitives"]; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
84 |
;// CONCATENATED MODULE: external "ReactJSXRuntime" |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
85 |
const external_ReactJSXRuntime_namespaceObject = window["ReactJSXRuntime"]; |
19 | 86 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/widget.js |
18 | 87 |
/** |
88 |
* WordPress dependencies |
|
89 |
*/ |
|
90 |
||
91 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
92 |
const widget = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
93 |
xmlns: "http://www.w3.org/2000/svg", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
94 |
viewBox: "0 0 24 24", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
95 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
96 |
d: "M6 3H8V5H16V3H18V5C19.1046 5 20 5.89543 20 7V19C20 20.1046 19.1046 21 18 21H6C4.89543 21 4 20.1046 4 19V7C4 5.89543 4.89543 5 6 5V3ZM18 6.5H6C5.72386 6.5 5.5 6.72386 5.5 7V8H18.5V7C18.5 6.72386 18.2761 6.5 18 6.5ZM18.5 9.5H5.5V19C5.5 19.2761 5.72386 19.5 6 19.5H18C18.2761 19.5 18.5 19.2761 18.5 19V9.5ZM11 11H13V13H11V11ZM7 11V13H9V11H7ZM15 13V11H17V13H15Z" |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
97 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
98 |
}); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
99 |
/* harmony default export */ const library_widget = (widget); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
100 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
101 |
;// CONCATENATED MODULE: ./node_modules/clsx/dist/clsx.mjs |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
102 |
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f)}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}/* harmony default export */ const dist_clsx = (clsx); |
19 | 103 |
;// CONCATENATED MODULE: external ["wp","blockEditor"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
104 |
const external_wp_blockEditor_namespaceObject = window["wp"]["blockEditor"]; |
19 | 105 |
;// CONCATENATED MODULE: external ["wp","components"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
106 |
const external_wp_components_namespaceObject = window["wp"]["components"]; |
19 | 107 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/brush.js |
18 | 108 |
/** |
109 |
* WordPress dependencies |
|
110 |
*/ |
|
111 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
112 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
113 |
const brush = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
18 | 114 |
xmlns: "http://www.w3.org/2000/svg", |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
115 |
viewBox: "0 0 24 24", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
116 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
117 |
d: "M4 20h8v-1.5H4V20zM18.9 3.5c-.6-.6-1.5-.6-2.1 0l-7.2 7.2c-.4-.1-.7 0-1.1.1-.5.2-1.5.7-1.9 2.2-.4 1.7-.8 2.2-1.1 2.7-.1.1-.2.3-.3.4l-.6 1.1H6c2 0 3.4-.4 4.7-1.4.8-.6 1.2-1.4 1.3-2.3 0-.3 0-.5-.1-.7L19 5.7c.5-.6.5-1.6-.1-2.2zM9.7 14.7c-.7.5-1.5.8-2.4 1 .2-.5.5-1.2.8-2.3.2-.6.4-1 .8-1.1.5-.1 1 .1 1.3.3.2.2.3.5.2.8 0 .3-.1.9-.7 1.3z" |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
118 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
119 |
}); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
120 |
/* harmony default export */ const library_brush = (brush); |
18 | 121 |
|
19 | 122 |
;// CONCATENATED MODULE: external ["wp","i18n"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
123 |
const external_wp_i18n_namespaceObject = window["wp"]["i18n"]; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
124 |
;// CONCATENATED MODULE: external ["wp","element"] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
125 |
const external_wp_element_namespaceObject = window["wp"]["element"]; |
19 | 126 |
;// CONCATENATED MODULE: external ["wp","data"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
127 |
const external_wp_data_namespaceObject = window["wp"]["data"]; |
19 | 128 |
;// CONCATENATED MODULE: external ["wp","coreData"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
129 |
const external_wp_coreData_namespaceObject = window["wp"]["coreData"]; |
19 | 130 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/widget-type-selector.js |
18 | 131 |
/** |
132 |
* WordPress dependencies |
|
133 |
*/ |
|
134 |
||
135 |
||
136 |
||
137 |
||
138 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
139 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
140 |
function WidgetTypeSelector({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
141 |
selectedId, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
142 |
onSelect |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
143 |
}) { |
19 | 144 |
const widgetTypes = (0,external_wp_data_namespaceObject.useSelect)(select => { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
145 |
var _select$getSettings$w; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
146 |
const hiddenIds = (_select$getSettings$w = select(external_wp_blockEditor_namespaceObject.store).getSettings()?.widgetTypesToHideFromLegacyWidgetBlock) !== null && _select$getSettings$w !== void 0 ? _select$getSettings$w : []; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
147 |
return select(external_wp_coreData_namespaceObject.store).getWidgetTypes({ |
18 | 148 |
per_page: -1 |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
149 |
})?.filter(widgetType => !hiddenIds.includes(widgetType.id)); |
18 | 150 |
}, []); |
151 |
if (!widgetTypes) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
152 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}); |
18 | 153 |
} |
154 |
if (widgetTypes.length === 0) { |
|
19 | 155 |
return (0,external_wp_i18n_namespaceObject.__)('There are no widgets available.'); |
18 | 156 |
} |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
157 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.SelectControl, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
158 |
__nextHasNoMarginBottom: true, |
19 | 159 |
label: (0,external_wp_i18n_namespaceObject.__)('Select a legacy widget to display:'), |
18 | 160 |
value: selectedId !== null && selectedId !== void 0 ? selectedId : '', |
161 |
options: [{ |
|
162 |
value: '', |
|
19 | 163 |
label: (0,external_wp_i18n_namespaceObject.__)('Select widget') |
18 | 164 |
}, ...widgetTypes.map(widgetType => ({ |
165 |
value: widgetType.id, |
|
166 |
label: widgetType.name |
|
167 |
}))], |
|
168 |
onChange: value => { |
|
169 |
if (value) { |
|
170 |
const selected = widgetTypes.find(widgetType => widgetType.id === value); |
|
171 |
onSelect({ |
|
172 |
selectedId: selected.id, |
|
173 |
isMulti: selected.is_multi |
|
174 |
}); |
|
175 |
} else { |
|
176 |
onSelect({ |
|
177 |
selectedId: null |
|
178 |
}); |
|
179 |
} |
|
180 |
} |
|
181 |
}); |
|
182 |
} |
|
183 |
||
19 | 184 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/inspector-card.js |
18 | 185 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
186 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
187 |
function InspectorCard({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
188 |
name, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
189 |
description |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
190 |
}) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
191 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
192 |
className: "wp-block-legacy-widget-inspector-card", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
193 |
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
194 |
className: "wp-block-legacy-widget-inspector-card__name", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
195 |
children: name |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
196 |
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("span", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
197 |
children: description |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
198 |
})] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
199 |
}); |
18 | 200 |
} |
201 |
||
19 | 202 |
;// CONCATENATED MODULE: external ["wp","notices"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
203 |
const external_wp_notices_namespaceObject = window["wp"]["notices"]; |
19 | 204 |
;// CONCATENATED MODULE: external ["wp","compose"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
205 |
const external_wp_compose_namespaceObject = window["wp"]["compose"]; |
19 | 206 |
;// CONCATENATED MODULE: external ["wp","apiFetch"] |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
207 |
const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; |
19 | 208 |
var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); |
209 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/control.js |
|
18 | 210 |
/** |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
211 |
* WordPress dependencies |
18 | 212 |
*/ |
213 |
||
214 |
||
215 |
||
216 |
||
217 |
/** |
|
218 |
* An API for creating and loading a widget control (a <div class="widget"> |
|
219 |
* element) that is compatible with most third party widget scripts. By not |
|
220 |
* using React for this, we ensure that we have complete contorl over the DOM |
|
221 |
* and do not accidentally remove any elements that a third party widget script |
|
222 |
* has attached an event listener to. |
|
223 |
* |
|
224 |
* @property {Element} element The control's DOM element. |
|
225 |
*/ |
|
19 | 226 |
class Control { |
18 | 227 |
/** |
228 |
* Creates and loads a new control. |
|
229 |
* |
|
230 |
* @access public |
|
19 | 231 |
* @param {Object} params |
232 |
* @param {string} params.id |
|
233 |
* @param {string} params.idBase |
|
234 |
* @param {Object} params.instance |
|
18 | 235 |
* @param {Function} params.onChangeInstance |
236 |
* @param {Function} params.onChangeHasPreview |
|
237 |
* @param {Function} params.onError |
|
238 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
239 |
constructor({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
240 |
id, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
241 |
idBase, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
242 |
instance, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
243 |
onChangeInstance, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
244 |
onChangeHasPreview, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
245 |
onError |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
246 |
}) { |
18 | 247 |
this.id = id; |
248 |
this.idBase = idBase; |
|
249 |
this._instance = instance; |
|
250 |
this._hasPreview = null; |
|
251 |
this.onChangeInstance = onChangeInstance; |
|
252 |
this.onChangeHasPreview = onChangeHasPreview; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
253 |
this.onError = onError; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
254 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
255 |
// We can't use the real widget number as this is calculated by the |
18 | 256 |
// server and we may not ever *actually* save this widget. Instead, use |
257 |
// a fake but unique number. |
|
258 |
this.number = ++lastNumber; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
259 |
this.handleFormChange = (0,external_wp_compose_namespaceObject.debounce)(this.handleFormChange.bind(this), 200); |
18 | 260 |
this.handleFormSubmit = this.handleFormSubmit.bind(this); |
261 |
this.initDOM(); |
|
262 |
this.bindEvents(); |
|
263 |
this.loadContent(); |
|
264 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
265 |
|
18 | 266 |
/** |
267 |
* Clean up the control so that it can be garabge collected. |
|
268 |
* |
|
269 |
* @access public |
|
270 |
*/ |
|
271 |
destroy() { |
|
272 |
this.unbindEvents(); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
273 |
this.element.remove(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
274 |
// TODO: How do we make third party widget scripts remove their event |
18 | 275 |
// listeners? |
276 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
277 |
|
18 | 278 |
/** |
279 |
* Creates the control's DOM structure. |
|
280 |
* |
|
281 |
* @access private |
|
282 |
*/ |
|
283 |
initDOM() { |
|
284 |
var _this$id, _this$idBase; |
|
285 |
this.element = el('div', { |
|
286 |
class: 'widget open' |
|
287 |
}, [el('div', { |
|
288 |
class: 'widget-inside' |
|
289 |
}, [this.form = el('form', { |
|
290 |
class: 'form', |
|
291 |
method: 'post' |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
292 |
}, [ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
293 |
// These hidden form inputs are what most widgets' scripts |
18 | 294 |
// use to access data about the widget. |
295 |
el('input', { |
|
296 |
class: 'widget-id', |
|
297 |
type: 'hidden', |
|
298 |
name: 'widget-id', |
|
299 |
value: (_this$id = this.id) !== null && _this$id !== void 0 ? _this$id : `${this.idBase}-${this.number}` |
|
300 |
}), el('input', { |
|
301 |
class: 'id_base', |
|
302 |
type: 'hidden', |
|
303 |
name: 'id_base', |
|
304 |
value: (_this$idBase = this.idBase) !== null && _this$idBase !== void 0 ? _this$idBase : this.id |
|
305 |
}), el('input', { |
|
306 |
class: 'widget-width', |
|
307 |
type: 'hidden', |
|
308 |
name: 'widget-width', |
|
309 |
value: '250' |
|
310 |
}), el('input', { |
|
311 |
class: 'widget-height', |
|
312 |
type: 'hidden', |
|
313 |
name: 'widget-height', |
|
314 |
value: '200' |
|
315 |
}), el('input', { |
|
316 |
class: 'widget_number', |
|
317 |
type: 'hidden', |
|
318 |
name: 'widget_number', |
|
319 |
value: this.idBase ? this.number.toString() : '' |
|
320 |
}), this.content = el('div', { |
|
321 |
class: 'widget-content' |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
322 |
}), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
323 |
// Non-multi widgets can be saved via a Save button. |
18 | 324 |
this.id && el('button', { |
325 |
class: 'button is-primary', |
|
326 |
type: 'submit' |
|
19 | 327 |
}, (0,external_wp_i18n_namespaceObject.__)('Save'))])])]); |
18 | 328 |
} |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
329 |
|
18 | 330 |
/** |
331 |
* Adds the control's event listeners. |
|
332 |
* |
|
333 |
* @access private |
|
334 |
*/ |
|
335 |
bindEvents() { |
|
336 |
// Prefer jQuery 'change' event instead of the native 'change' event |
|
337 |
// because many widgets use jQuery's event bus to trigger an update. |
|
338 |
if (window.jQuery) { |
|
339 |
const { |
|
340 |
jQuery: $ |
|
341 |
} = window; |
|
342 |
$(this.form).on('change', null, this.handleFormChange); |
|
343 |
$(this.form).on('input', null, this.handleFormChange); |
|
344 |
$(this.form).on('submit', this.handleFormSubmit); |
|
345 |
} else { |
|
346 |
this.form.addEventListener('change', this.handleFormChange); |
|
347 |
this.form.addEventListener('input', this.handleFormChange); |
|
348 |
this.form.addEventListener('submit', this.handleFormSubmit); |
|
349 |
} |
|
350 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
351 |
|
18 | 352 |
/** |
353 |
* Removes the control's event listeners. |
|
354 |
* |
|
355 |
* @access private |
|
356 |
*/ |
|
357 |
unbindEvents() { |
|
358 |
if (window.jQuery) { |
|
359 |
const { |
|
360 |
jQuery: $ |
|
361 |
} = window; |
|
362 |
$(this.form).off('change', null, this.handleFormChange); |
|
363 |
$(this.form).off('input', null, this.handleFormChange); |
|
364 |
$(this.form).off('submit', this.handleFormSubmit); |
|
365 |
} else { |
|
366 |
this.form.removeEventListener('change', this.handleFormChange); |
|
367 |
this.form.removeEventListener('input', this.handleFormChange); |
|
368 |
this.form.removeEventListener('submit', this.handleFormSubmit); |
|
369 |
} |
|
370 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
371 |
|
18 | 372 |
/** |
373 |
* Fetches the widget's form HTML from the REST API and loads it into the |
|
374 |
* control's form. |
|
375 |
* |
|
376 |
* @access private |
|
377 |
*/ |
|
378 |
async loadContent() { |
|
379 |
try { |
|
380 |
if (this.id) { |
|
381 |
const { |
|
382 |
form |
|
383 |
} = await saveWidget(this.id); |
|
384 |
this.content.innerHTML = form; |
|
385 |
} else if (this.idBase) { |
|
386 |
const { |
|
387 |
form, |
|
388 |
preview |
|
389 |
} = await encodeWidget({ |
|
390 |
idBase: this.idBase, |
|
391 |
instance: this.instance, |
|
392 |
number: this.number |
|
393 |
}); |
|
394 |
this.content.innerHTML = form; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
395 |
this.hasPreview = !isEmptyHTML(preview); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
396 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
397 |
// If we don't have an instance, perform a save right away. This |
18 | 398 |
// happens when creating a new Legacy Widget block. |
399 |
if (!this.instance.hash) { |
|
400 |
const { |
|
401 |
instance |
|
402 |
} = await encodeWidget({ |
|
403 |
idBase: this.idBase, |
|
404 |
instance: this.instance, |
|
405 |
number: this.number, |
|
406 |
formData: serializeForm(this.form) |
|
407 |
}); |
|
408 |
this.instance = instance; |
|
409 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
410 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
411 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
412 |
// Trigger 'widget-added' when widget is ready. This event is what |
18 | 413 |
// widgets' scripts use to initialize, attach events, etc. The event |
414 |
// must be fired using jQuery's event bus as this is what widget |
|
415 |
// scripts expect. If jQuery is not loaded, do nothing - some |
|
416 |
// widgets will still work regardless. |
|
417 |
if (window.jQuery) { |
|
418 |
const { |
|
419 |
jQuery: $ |
|
420 |
} = window; |
|
421 |
$(document).trigger('widget-added', [$(this.element)]); |
|
422 |
} |
|
423 |
} catch (error) { |
|
424 |
this.onError(error); |
|
425 |
} |
|
426 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
427 |
|
18 | 428 |
/** |
429 |
* Perform a save when a multi widget's form is changed. Non-multi widgets |
|
430 |
* are saved manually. |
|
431 |
* |
|
432 |
* @access private |
|
433 |
*/ |
|
434 |
handleFormChange() { |
|
435 |
if (this.idBase) { |
|
436 |
this.saveForm(); |
|
437 |
} |
|
438 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
439 |
|
18 | 440 |
/** |
441 |
* Perform a save when the control's form is manually submitted. |
|
442 |
* |
|
443 |
* @access private |
|
444 |
* @param {Event} event |
|
445 |
*/ |
|
446 |
handleFormSubmit(event) { |
|
447 |
event.preventDefault(); |
|
448 |
this.saveForm(); |
|
449 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
450 |
|
18 | 451 |
/** |
452 |
* Serialize the control's form, send it to the REST API, and update the |
|
453 |
* instance with the encoded instance that the REST API returns. |
|
454 |
* |
|
455 |
* @access private |
|
456 |
*/ |
|
457 |
async saveForm() { |
|
458 |
const formData = serializeForm(this.form); |
|
459 |
try { |
|
460 |
if (this.id) { |
|
461 |
const { |
|
462 |
form |
|
463 |
} = await saveWidget(this.id, formData); |
|
464 |
this.content.innerHTML = form; |
|
465 |
if (window.jQuery) { |
|
466 |
const { |
|
467 |
jQuery: $ |
|
468 |
} = window; |
|
469 |
$(document).trigger('widget-updated', [$(this.element)]); |
|
470 |
} |
|
471 |
} else if (this.idBase) { |
|
472 |
const { |
|
473 |
instance, |
|
474 |
preview |
|
475 |
} = await encodeWidget({ |
|
476 |
idBase: this.idBase, |
|
477 |
instance: this.instance, |
|
478 |
number: this.number, |
|
479 |
formData |
|
480 |
}); |
|
481 |
this.instance = instance; |
|
482 |
this.hasPreview = !isEmptyHTML(preview); |
|
483 |
} |
|
484 |
} catch (error) { |
|
485 |
this.onError(error); |
|
486 |
} |
|
487 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
488 |
|
18 | 489 |
/** |
490 |
* The widget's instance object. |
|
491 |
* |
|
492 |
* @access private |
|
493 |
*/ |
|
494 |
get instance() { |
|
495 |
return this._instance; |
|
496 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
497 |
|
18 | 498 |
/** |
499 |
* The widget's instance object. |
|
500 |
* |
|
501 |
* @access private |
|
502 |
*/ |
|
503 |
set instance(instance) { |
|
504 |
if (this._instance !== instance) { |
|
505 |
this._instance = instance; |
|
506 |
this.onChangeInstance(instance); |
|
507 |
} |
|
508 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
509 |
|
18 | 510 |
/** |
511 |
* Whether or not the widget can be previewed. |
|
512 |
* |
|
513 |
* @access public |
|
514 |
*/ |
|
515 |
get hasPreview() { |
|
516 |
return this._hasPreview; |
|
517 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
518 |
|
18 | 519 |
/** |
520 |
* Whether or not the widget can be previewed. |
|
521 |
* |
|
522 |
* @access private |
|
523 |
*/ |
|
524 |
set hasPreview(hasPreview) { |
|
525 |
if (this._hasPreview !== hasPreview) { |
|
526 |
this._hasPreview = hasPreview; |
|
527 |
this.onChangeHasPreview(hasPreview); |
|
528 |
} |
|
529 |
} |
|
530 |
} |
|
531 |
let lastNumber = 0; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
532 |
function el(tagName, attributes = {}, content = null) { |
18 | 533 |
const element = document.createElement(tagName); |
534 |
for (const [attribute, value] of Object.entries(attributes)) { |
|
535 |
element.setAttribute(attribute, value); |
|
536 |
} |
|
537 |
if (Array.isArray(content)) { |
|
538 |
for (const child of content) { |
|
539 |
if (child) { |
|
540 |
element.appendChild(child); |
|
541 |
} |
|
542 |
} |
|
543 |
} else if (typeof content === 'string') { |
|
544 |
element.innerText = content; |
|
545 |
} |
|
546 |
return element; |
|
547 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
548 |
async function saveWidget(id, formData = null) { |
18 | 549 |
let widget; |
550 |
if (formData) { |
|
551 |
widget = await external_wp_apiFetch_default()({ |
|
552 |
path: `/wp/v2/widgets/${id}?context=edit`, |
|
553 |
method: 'PUT', |
|
554 |
data: { |
|
555 |
form_data: formData |
|
556 |
} |
|
557 |
}); |
|
558 |
} else { |
|
559 |
widget = await external_wp_apiFetch_default()({ |
|
560 |
path: `/wp/v2/widgets/${id}?context=edit`, |
|
561 |
method: 'GET' |
|
562 |
}); |
|
563 |
} |
|
564 |
return { |
|
565 |
form: widget.rendered_form |
|
566 |
}; |
|
567 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
568 |
async function encodeWidget({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
569 |
idBase, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
570 |
instance, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
571 |
number, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
572 |
formData = null |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
573 |
}) { |
18 | 574 |
const response = await external_wp_apiFetch_default()({ |
575 |
path: `/wp/v2/widget-types/${idBase}/encode`, |
|
576 |
method: 'POST', |
|
577 |
data: { |
|
578 |
instance, |
|
579 |
number, |
|
580 |
form_data: formData |
|
581 |
} |
|
582 |
}); |
|
583 |
return { |
|
584 |
instance: response.instance, |
|
585 |
form: response.form, |
|
586 |
preview: response.preview |
|
587 |
}; |
|
588 |
} |
|
589 |
function isEmptyHTML(html) { |
|
590 |
const element = document.createElement('div'); |
|
591 |
element.innerHTML = html; |
|
592 |
return isEmptyNode(element); |
|
593 |
} |
|
594 |
function isEmptyNode(node) { |
|
595 |
switch (node.nodeType) { |
|
596 |
case node.TEXT_NODE: |
|
597 |
// Text nodes are empty if it's entirely whitespace. |
|
598 |
return node.nodeValue.trim() === ''; |
|
599 |
case node.ELEMENT_NODE: |
|
600 |
// Elements that are "embedded content" are not empty. |
|
601 |
// https://dev.w3.org/html5/spec-LC/content-models.html#embedded-content-0 |
|
602 |
if (['AUDIO', 'CANVAS', 'EMBED', 'IFRAME', 'IMG', 'MATH', 'OBJECT', 'SVG', 'VIDEO'].includes(node.tagName)) { |
|
603 |
return false; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
604 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
605 |
// Elements with no children are empty. |
18 | 606 |
if (!node.hasChildNodes()) { |
607 |
return true; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
608 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
609 |
// Elements with children are empty if all their children are empty. |
18 | 610 |
return Array.from(node.childNodes).every(isEmptyNode); |
611 |
default: |
|
612 |
return true; |
|
613 |
} |
|
614 |
} |
|
615 |
function serializeForm(form) { |
|
616 |
return new window.URLSearchParams(Array.from(new window.FormData(form))).toString(); |
|
617 |
} |
|
618 |
||
19 | 619 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/form.js |
18 | 620 |
/** |
621 |
* External dependencies |
|
622 |
*/ |
|
623 |
||
624 |
/** |
|
625 |
* WordPress dependencies |
|
626 |
*/ |
|
627 |
||
628 |
||
629 |
||
630 |
||
631 |
||
632 |
||
633 |
/** |
|
634 |
* Internal dependencies |
|
635 |
*/ |
|
636 |
||
637 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
638 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
639 |
function Form({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
640 |
title, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
641 |
isVisible, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
642 |
id, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
643 |
idBase, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
644 |
instance, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
645 |
isWide, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
646 |
onChangeInstance, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
647 |
onChangeHasPreview |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
648 |
}) { |
19 | 649 |
const ref = (0,external_wp_element_namespaceObject.useRef)(); |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
650 |
const isMediumLargeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('small'); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
651 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
652 |
// We only want to remount the control when the instance changes |
18 | 653 |
// *externally*. For example, if the user performs an undo. To do this, we |
654 |
// keep track of changes made to instance by the control itself and then |
|
655 |
// ignore those. |
|
19 | 656 |
const outgoingInstances = (0,external_wp_element_namespaceObject.useRef)(new Set()); |
657 |
const incomingInstances = (0,external_wp_element_namespaceObject.useRef)(new Set()); |
|
18 | 658 |
const { |
659 |
createNotice |
|
19 | 660 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_notices_namespaceObject.store); |
661 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
|
18 | 662 |
if (incomingInstances.current.has(instance)) { |
663 |
incomingInstances.current.delete(instance); |
|
664 |
return; |
|
665 |
} |
|
19 | 666 |
const control = new Control({ |
18 | 667 |
id, |
668 |
idBase, |
|
669 |
instance, |
|
670 |
onChangeInstance(nextInstance) { |
|
671 |
outgoingInstances.current.add(instance); |
|
672 |
incomingInstances.current.add(nextInstance); |
|
673 |
onChangeInstance(nextInstance); |
|
674 |
}, |
|
675 |
onChangeHasPreview, |
|
676 |
onError(error) { |
|
677 |
window.console.error(error); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
678 |
createNotice('error', (0,external_wp_i18n_namespaceObject.sprintf)( /* translators: %s: the name of the affected block. */ |
19 | 679 |
(0,external_wp_i18n_namespaceObject.__)('The "%s" block was affected by errors and may not function properly. Check the developer tools for more details.'), idBase || id)); |
18 | 680 |
} |
681 |
}); |
|
682 |
ref.current.appendChild(control.element); |
|
683 |
return () => { |
|
684 |
if (outgoingInstances.current.has(instance)) { |
|
685 |
outgoingInstances.current.delete(instance); |
|
686 |
return; |
|
687 |
} |
|
688 |
control.destroy(); |
|
689 |
}; |
|
690 |
}, [id, idBase, instance, onChangeInstance, onChangeHasPreview, isMediumLargeViewport]); |
|
691 |
if (isWide && isMediumLargeViewport) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
692 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
693 |
className: dist_clsx({ |
18 | 694 |
'wp-block-legacy-widget__container': isVisible |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
695 |
}), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
696 |
children: [isVisible && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
697 |
className: "wp-block-legacy-widget__edit-form-title", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
698 |
children: title |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
699 |
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Popover, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
700 |
focusOnMount: false, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
701 |
placement: "right", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
702 |
offset: 32, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
703 |
resize: false, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
704 |
flip: false, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
705 |
shift: true, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
706 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
707 |
ref: ref, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
708 |
className: "wp-block-legacy-widget__edit-form", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
709 |
hidden: !isVisible |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
710 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
711 |
})] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
712 |
}); |
18 | 713 |
} |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
714 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
18 | 715 |
ref: ref, |
716 |
className: "wp-block-legacy-widget__edit-form", |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
717 |
hidden: !isVisible, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
718 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
719 |
className: "wp-block-legacy-widget__edit-form-title", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
720 |
children: title |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
721 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
722 |
}); |
18 | 723 |
} |
724 |
||
19 | 725 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/preview.js |
18 | 726 |
/** |
727 |
* External dependencies |
|
728 |
*/ |
|
729 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
730 |
|
18 | 731 |
/** |
732 |
* WordPress dependencies |
|
733 |
*/ |
|
734 |
||
735 |
||
736 |
||
737 |
||
738 |
||
739 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
740 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
741 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
742 |
function Preview({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
743 |
idBase, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
744 |
instance, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
745 |
isVisible |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
746 |
}) { |
19 | 747 |
const [isLoaded, setIsLoaded] = (0,external_wp_element_namespaceObject.useState)(false); |
748 |
const [srcDoc, setSrcDoc] = (0,external_wp_element_namespaceObject.useState)(''); |
|
749 |
(0,external_wp_element_namespaceObject.useEffect)(() => { |
|
750 |
const abortController = typeof window.AbortController === 'undefined' ? undefined : new window.AbortController(); |
|
751 |
async function fetchPreviewHTML() { |
|
752 |
const restRoute = `/wp/v2/widget-types/${idBase}/render`; |
|
753 |
return await external_wp_apiFetch_default()({ |
|
754 |
path: restRoute, |
|
755 |
method: 'POST', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
756 |
signal: abortController?.signal, |
19 | 757 |
data: instance ? { |
758 |
instance |
|
759 |
} : {} |
|
760 |
}); |
|
761 |
} |
|
762 |
fetchPreviewHTML().then(response => { |
|
763 |
setSrcDoc(response.preview); |
|
764 |
}).catch(error => { |
|
765 |
if ('AbortError' === error.name) { |
|
766 |
// We don't want to log aborted requests. |
|
767 |
return; |
|
18 | 768 |
} |
19 | 769 |
throw error; |
770 |
}); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
771 |
return () => abortController?.abort(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
772 |
}, [idBase, instance]); |
19 | 773 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
774 |
// Resize the iframe on either the load event, or when the iframe becomes visible. |
19 | 775 |
const ref = (0,external_wp_compose_namespaceObject.useRefEffect)(iframe => { |
776 |
// Only set height if the iframe is loaded, |
|
777 |
// or it will grow to an unexpected large height in Safari if it's hidden initially. |
|
778 |
if (!isLoaded) { |
|
779 |
return; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
780 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
781 |
// If the preview frame has another origin then this won't work. |
19 | 782 |
// One possible solution is to add custom script to call `postMessage` in the preview frame. |
783 |
// Or, better yet, we migrate away from iframe. |
|
784 |
function setHeight() { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
785 |
var _iframe$contentDocume, _iframe$contentDocume2; |
19 | 786 |
// Pick the maximum of these two values to account for margin collapsing. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
787 |
const height = Math.max((_iframe$contentDocume = iframe.contentDocument.documentElement?.offsetHeight) !== null && _iframe$contentDocume !== void 0 ? _iframe$contentDocume : 0, (_iframe$contentDocume2 = iframe.contentDocument.body?.offsetHeight) !== null && _iframe$contentDocume2 !== void 0 ? _iframe$contentDocume2 : 0); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
788 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
789 |
// Fallback to a height of 100px if the height cannot be determined. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
790 |
// This ensures the block is still selectable. 100px should hopefully |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
791 |
// be not so big that it's annoying, and not so small that nothing |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
792 |
// can be seen. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
793 |
iframe.style.height = `${height !== 0 ? height : 100}px`; |
19 | 794 |
} |
795 |
const { |
|
796 |
IntersectionObserver |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
797 |
} = iframe.ownerDocument.defaultView; |
19 | 798 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
799 |
// Observe for intersections that might cause a change in the height of |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
800 |
// the iframe, e.g. a Widget Area becoming expanded. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
801 |
const intersectionObserver = new IntersectionObserver(([entry]) => { |
19 | 802 |
if (entry.isIntersecting) { |
803 |
setHeight(); |
|
804 |
} |
|
805 |
}, { |
|
806 |
threshold: 1 |
|
807 |
}); |
|
808 |
intersectionObserver.observe(iframe); |
|
809 |
iframe.addEventListener('load', setHeight); |
|
810 |
return () => { |
|
811 |
intersectionObserver.disconnect(); |
|
812 |
iframe.removeEventListener('load', setHeight); |
|
813 |
}; |
|
18 | 814 |
}, [isLoaded]); |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
815 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
816 |
children: [isVisible && !isLoaded && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
817 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
818 |
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
819 |
className: dist_clsx('wp-block-legacy-widget__edit-preview', { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
820 |
'is-offscreen': !isVisible || !isLoaded |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
821 |
}), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
822 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Disabled, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
823 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("iframe", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
824 |
ref: ref, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
825 |
className: "wp-block-legacy-widget__edit-preview-iframe", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
826 |
tabIndex: "-1", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
827 |
title: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget Preview'), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
828 |
srcDoc: srcDoc, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
829 |
onLoad: event => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
830 |
// To hide the scrollbars of the preview frame for some edge cases, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
831 |
// such as negative margins in the Gallery Legacy Widget. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
832 |
// It can't be scrolled anyway. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
833 |
// TODO: Ideally, this should be fixed in core. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
834 |
event.target.contentDocument.body.style.overflow = 'hidden'; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
835 |
setIsLoaded(true); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
836 |
}, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
837 |
height: 100 |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
838 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
839 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
840 |
})] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
841 |
}); |
18 | 842 |
} |
843 |
||
19 | 844 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/no-preview.js |
18 | 845 |
/** |
846 |
* WordPress dependencies |
|
847 |
*/ |
|
848 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
849 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
850 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
851 |
function NoPreview({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
852 |
name |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
853 |
}) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
854 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)("div", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
855 |
className: "wp-block-legacy-widget__edit-no-preview", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
856 |
children: [name && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("h3", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
857 |
children: name |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
858 |
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("p", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
859 |
children: (0,external_wp_i18n_namespaceObject.__)('No preview available.') |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
860 |
})] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
861 |
}); |
18 | 862 |
} |
863 |
||
19 | 864 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/convert-to-blocks-button.js |
18 | 865 |
/** |
866 |
* WordPress dependencies |
|
867 |
*/ |
|
868 |
||
869 |
||
870 |
||
871 |
||
872 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
873 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
874 |
function ConvertToBlocksButton({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
875 |
clientId, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
876 |
rawInstance |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
877 |
}) { |
18 | 878 |
const { |
879 |
replaceBlocks |
|
19 | 880 |
} = (0,external_wp_data_namespaceObject.useDispatch)(external_wp_blockEditor_namespaceObject.store); |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
881 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarButton, { |
18 | 882 |
onClick: () => { |
883 |
if (rawInstance.title) { |
|
19 | 884 |
replaceBlocks(clientId, [(0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { |
18 | 885 |
content: rawInstance.title |
19 | 886 |
}), ...(0,external_wp_blocks_namespaceObject.rawHandler)({ |
18 | 887 |
HTML: rawInstance.text |
888 |
})]); |
|
889 |
} else { |
|
19 | 890 |
replaceBlocks(clientId, (0,external_wp_blocks_namespaceObject.rawHandler)({ |
18 | 891 |
HTML: rawInstance.text |
892 |
})); |
|
893 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
894 |
}, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
895 |
children: (0,external_wp_i18n_namespaceObject.__)('Convert to blocks') |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
896 |
}); |
18 | 897 |
} |
898 |
||
19 | 899 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/edit/index.js |
18 | 900 |
/** |
901 |
* External dependencies |
|
902 |
*/ |
|
903 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
904 |
|
18 | 905 |
/** |
906 |
* WordPress dependencies |
|
907 |
*/ |
|
908 |
||
909 |
||
910 |
||
911 |
||
912 |
||
913 |
||
914 |
||
915 |
||
916 |
/** |
|
917 |
* Internal dependencies |
|
918 |
*/ |
|
919 |
||
920 |
||
921 |
||
922 |
||
923 |
||
924 |
||
925 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
926 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
927 |
|
18 | 928 |
function Edit(props) { |
929 |
const { |
|
930 |
id, |
|
931 |
idBase |
|
932 |
} = props.attributes; |
|
933 |
const { |
|
934 |
isWide = false |
|
935 |
} = props; |
|
19 | 936 |
const blockProps = (0,external_wp_blockEditor_namespaceObject.useBlockProps)({ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
937 |
className: dist_clsx({ |
18 | 938 |
'is-wide-widget': isWide |
939 |
}) |
|
940 |
}); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
941 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
942 |
...blockProps, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
943 |
children: !id && !idBase ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Empty, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
944 |
...props |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
945 |
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NotEmpty, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
946 |
...props |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
947 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
948 |
}); |
18 | 949 |
} |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
950 |
function Empty({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
951 |
attributes: { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
952 |
id, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
953 |
idBase |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
954 |
}, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
955 |
setAttributes |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
956 |
}) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
957 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
958 |
icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
18 | 959 |
icon: library_brush |
960 |
}), |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
961 |
label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget'), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
962 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Flex, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
963 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.FlexBlock, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
964 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(WidgetTypeSelector, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
965 |
selectedId: id !== null && id !== void 0 ? id : idBase, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
966 |
onSelect: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
967 |
selectedId, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
968 |
isMulti |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
969 |
}) => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
970 |
if (!selectedId) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
971 |
setAttributes({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
972 |
id: null, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
973 |
idBase: null, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
974 |
instance: null |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
975 |
}); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
976 |
} else if (isMulti) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
977 |
setAttributes({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
978 |
id: null, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
979 |
idBase: selectedId, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
980 |
instance: {} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
981 |
}); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
982 |
} else { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
983 |
setAttributes({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
984 |
id: selectedId, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
985 |
idBase: null, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
986 |
instance: null |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
987 |
}); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
988 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
989 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
990 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
991 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
992 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
993 |
}); |
18 | 994 |
} |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
995 |
function NotEmpty({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
996 |
attributes: { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
997 |
id, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
998 |
idBase, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
999 |
instance |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1000 |
}, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1001 |
setAttributes, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1002 |
clientId, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1003 |
isSelected, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1004 |
isWide = false |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1005 |
}) { |
19 | 1006 |
const [hasPreview, setHasPreview] = (0,external_wp_element_namespaceObject.useState)(null); |
1007 |
const widgetTypeId = id !== null && id !== void 0 ? id : idBase; |
|
18 | 1008 |
const { |
19 | 1009 |
record: widgetType, |
1010 |
hasResolved: hasResolvedWidgetType |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1011 |
} = (0,external_wp_coreData_namespaceObject.useEntityRecord)('root', 'widgetType', widgetTypeId); |
19 | 1012 |
const isNavigationMode = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).isNavigationMode(), []); |
1013 |
const setInstance = (0,external_wp_element_namespaceObject.useCallback)(nextInstance => { |
|
18 | 1014 |
setAttributes({ |
1015 |
instance: nextInstance |
|
1016 |
}); |
|
1017 |
}, []); |
|
1018 |
if (!widgetType && hasResolvedWidgetType) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1019 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1020 |
icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
18 | 1021 |
icon: library_brush |
1022 |
}), |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1023 |
label: (0,external_wp_i18n_namespaceObject.__)('Legacy Widget'), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1024 |
children: (0,external_wp_i18n_namespaceObject.__)('Widget is missing.') |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1025 |
}); |
18 | 1026 |
} |
1027 |
if (!hasResolvedWidgetType) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1028 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1029 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1030 |
}); |
18 | 1031 |
} |
1032 |
const mode = idBase && (isNavigationMode || !isSelected) ? 'preview' : 'edit'; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1033 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1034 |
children: [idBase === 'text' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockControls, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1035 |
group: "other", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1036 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(ConvertToBlocksButton, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1037 |
clientId: clientId, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1038 |
rawInstance: instance.raw |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1039 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1040 |
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InspectorControls, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1041 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(InspectorCard, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1042 |
name: widgetType.name, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1043 |
description: widgetType.description |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1044 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1045 |
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Form, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1046 |
title: widgetType.name, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1047 |
isVisible: mode === 'edit', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1048 |
id: id, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1049 |
idBase: idBase, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1050 |
instance: instance, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1051 |
isWide: isWide, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1052 |
onChangeInstance: setInstance, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1053 |
onChangeHasPreview: setHasPreview |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1054 |
}), idBase && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1055 |
children: [hasPreview === null && mode === 'preview' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1056 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Spinner, {}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1057 |
}), hasPreview === true && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(Preview, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1058 |
idBase: idBase, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1059 |
instance: instance, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1060 |
isVisible: mode === 'preview' |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1061 |
}), hasPreview === false && mode === 'preview' && /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(NoPreview, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1062 |
name: widgetType.name |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1063 |
})] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1064 |
})] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1065 |
}); |
18 | 1066 |
} |
1067 |
||
19 | 1068 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/transforms.js |
18 | 1069 |
/** |
1070 |
* WordPress dependencies |
|
1071 |
*/ |
|
1072 |
||
1073 |
const legacyWidgetTransforms = [{ |
|
1074 |
block: 'core/calendar', |
|
1075 |
widget: 'calendar' |
|
1076 |
}, { |
|
1077 |
block: 'core/search', |
|
1078 |
widget: 'search' |
|
1079 |
}, { |
|
1080 |
block: 'core/html', |
|
1081 |
widget: 'custom_html', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1082 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1083 |
content |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1084 |
}) => ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1085 |
content |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1086 |
}) |
18 | 1087 |
}, { |
1088 |
block: 'core/archives', |
|
1089 |
widget: 'archives', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1090 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1091 |
count, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1092 |
dropdown |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1093 |
}) => { |
18 | 1094 |
return { |
1095 |
displayAsDropdown: !!dropdown, |
|
1096 |
showPostCounts: !!count |
|
1097 |
}; |
|
1098 |
} |
|
1099 |
}, { |
|
1100 |
block: 'core/latest-posts', |
|
1101 |
widget: 'recent-posts', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1102 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1103 |
show_date: displayPostDate, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1104 |
number |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1105 |
}) => { |
18 | 1106 |
return { |
1107 |
displayPostDate: !!displayPostDate, |
|
1108 |
postsToShow: number |
|
1109 |
}; |
|
1110 |
} |
|
1111 |
}, { |
|
1112 |
block: 'core/latest-comments', |
|
1113 |
widget: 'recent-comments', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1114 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1115 |
number |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1116 |
}) => { |
18 | 1117 |
return { |
1118 |
commentsToShow: number |
|
1119 |
}; |
|
1120 |
} |
|
1121 |
}, { |
|
1122 |
block: 'core/tag-cloud', |
|
1123 |
widget: 'tag_cloud', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1124 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1125 |
taxonomy, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1126 |
count |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1127 |
}) => { |
18 | 1128 |
return { |
1129 |
showTagCounts: !!count, |
|
1130 |
taxonomy |
|
1131 |
}; |
|
1132 |
} |
|
1133 |
}, { |
|
1134 |
block: 'core/categories', |
|
1135 |
widget: 'categories', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1136 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1137 |
count, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1138 |
dropdown, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1139 |
hierarchical |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1140 |
}) => { |
18 | 1141 |
return { |
1142 |
displayAsDropdown: !!dropdown, |
|
1143 |
showPostCounts: !!count, |
|
1144 |
showHierarchy: !!hierarchical |
|
1145 |
}; |
|
1146 |
} |
|
1147 |
}, { |
|
1148 |
block: 'core/audio', |
|
1149 |
widget: 'media_audio', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1150 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1151 |
url, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1152 |
preload, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1153 |
loop, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1154 |
attachment_id: id |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1155 |
}) => { |
18 | 1156 |
return { |
1157 |
src: url, |
|
1158 |
id, |
|
1159 |
preload, |
|
1160 |
loop |
|
1161 |
}; |
|
1162 |
} |
|
1163 |
}, { |
|
1164 |
block: 'core/video', |
|
1165 |
widget: 'media_video', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1166 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1167 |
url, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1168 |
preload, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1169 |
loop, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1170 |
attachment_id: id |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1171 |
}) => { |
18 | 1172 |
return { |
1173 |
src: url, |
|
1174 |
id, |
|
1175 |
preload, |
|
1176 |
loop |
|
1177 |
}; |
|
1178 |
} |
|
1179 |
}, { |
|
1180 |
block: 'core/image', |
|
1181 |
widget: 'media_image', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1182 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1183 |
alt, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1184 |
attachment_id: id, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1185 |
caption, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1186 |
height, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1187 |
link_classes: linkClass, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1188 |
link_rel: rel, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1189 |
link_target_blank: targetBlack, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1190 |
link_type: linkDestination, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1191 |
link_url: link, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1192 |
size: sizeSlug, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1193 |
url, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1194 |
width |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1195 |
}) => { |
18 | 1196 |
return { |
1197 |
alt, |
|
1198 |
caption, |
|
1199 |
height, |
|
1200 |
id, |
|
1201 |
link, |
|
1202 |
linkClass, |
|
1203 |
linkDestination, |
|
1204 |
linkTarget: targetBlack ? '_blank' : undefined, |
|
1205 |
rel, |
|
1206 |
sizeSlug, |
|
1207 |
url, |
|
1208 |
width |
|
1209 |
}; |
|
1210 |
} |
|
1211 |
}, { |
|
1212 |
block: 'core/gallery', |
|
1213 |
widget: 'media_gallery', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1214 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1215 |
ids, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1216 |
link_type: linkTo, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1217 |
size, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1218 |
number |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1219 |
}) => { |
18 | 1220 |
return { |
1221 |
ids, |
|
1222 |
columns: number, |
|
1223 |
linkTo, |
|
1224 |
sizeSlug: size, |
|
1225 |
images: ids.map(id => ({ |
|
1226 |
id |
|
1227 |
})) |
|
1228 |
}; |
|
1229 |
} |
|
1230 |
}, { |
|
1231 |
block: 'core/rss', |
|
1232 |
widget: 'rss', |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1233 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1234 |
url, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1235 |
show_author: displayAuthor, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1236 |
show_date: displayDate, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1237 |
show_summary: displayExcerpt, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1238 |
items |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1239 |
}) => { |
18 | 1240 |
return { |
1241 |
feedURL: url, |
|
1242 |
displayAuthor: !!displayAuthor, |
|
1243 |
displayDate: !!displayDate, |
|
1244 |
displayExcerpt: !!displayExcerpt, |
|
1245 |
itemsToShow: items |
|
1246 |
}; |
|
1247 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1248 |
}].map(({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1249 |
block, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1250 |
widget, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1251 |
transform |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1252 |
}) => { |
18 | 1253 |
return { |
1254 |
type: 'block', |
|
1255 |
blocks: [block], |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1256 |
isMatch: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1257 |
idBase, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1258 |
instance |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1259 |
}) => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1260 |
return idBase === widget && !!instance?.raw; |
18 | 1261 |
}, |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1262 |
transform: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1263 |
instance |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1264 |
}) => { |
19 | 1265 |
const transformedBlock = (0,external_wp_blocks_namespaceObject.createBlock)(block, transform ? transform(instance.raw) : undefined); |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1266 |
if (!instance.raw?.title) { |
18 | 1267 |
return transformedBlock; |
1268 |
} |
|
19 | 1269 |
return [(0,external_wp_blocks_namespaceObject.createBlock)('core/heading', { |
18 | 1270 |
content: instance.raw.title |
1271 |
}), transformedBlock]; |
|
1272 |
} |
|
1273 |
}; |
|
1274 |
}); |
|
1275 |
const transforms = { |
|
1276 |
to: legacyWidgetTransforms |
|
1277 |
}; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1278 |
/* harmony default export */ const legacy_widget_transforms = (transforms); |
18 | 1279 |
|
19 | 1280 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/legacy-widget/index.js |
18 | 1281 |
/** |
1282 |
* WordPress dependencies |
|
1283 |
*/ |
|
1284 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1285 |
|
18 | 1286 |
/** |
1287 |
* Internal dependencies |
|
1288 |
*/ |
|
19 | 1289 |
const metadata = { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1290 |
$schema: "https://schemas.wp.org/trunk/block.json", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1291 |
apiVersion: 3, |
18 | 1292 |
name: "core/legacy-widget", |
1293 |
title: "Legacy Widget", |
|
1294 |
category: "widgets", |
|
1295 |
description: "Display a legacy widget.", |
|
1296 |
textdomain: "default", |
|
1297 |
attributes: { |
|
1298 |
id: { |
|
1299 |
type: "string", |
|
1300 |
"default": null |
|
1301 |
}, |
|
1302 |
idBase: { |
|
1303 |
type: "string", |
|
1304 |
"default": null |
|
1305 |
}, |
|
1306 |
instance: { |
|
1307 |
type: "object", |
|
1308 |
"default": null |
|
1309 |
} |
|
1310 |
}, |
|
1311 |
supports: { |
|
1312 |
html: false, |
|
1313 |
customClassName: false, |
|
1314 |
reusable: false |
|
1315 |
}, |
|
1316 |
editorStyle: "wp-block-legacy-widget-editor" |
|
1317 |
}; |
|
1318 |
||
1319 |
||
1320 |
const { |
|
1321 |
name: legacy_widget_name |
|
19 | 1322 |
} = metadata; |
18 | 1323 |
|
19 | 1324 |
const settings = { |
18 | 1325 |
icon: library_widget, |
1326 |
edit: Edit, |
|
1327 |
transforms: legacy_widget_transforms |
|
1328 |
}; |
|
1329 |
||
19 | 1330 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/group.js |
18 | 1331 |
/** |
1332 |
* WordPress dependencies |
|
1333 |
*/ |
|
1334 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1335 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1336 |
const group = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
19 | 1337 |
viewBox: "0 0 24 24", |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1338 |
xmlns: "http://www.w3.org/2000/svg", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1339 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1340 |
d: "M18 4h-7c-1.1 0-2 .9-2 2v3H6c-1.1 0-2 .9-2 2v7c0 1.1.9 2 2 2h7c1.1 0 2-.9 2-2v-3h3c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4.5 14c0 .3-.2.5-.5.5H6c-.3 0-.5-.2-.5-.5v-7c0-.3.2-.5.5-.5h3V13c0 1.1.9 2 2 2h2.5v3zm0-4.5H11c-.3 0-.5-.2-.5-.5v-2.5H13c.3 0 .5.2.5.5v2.5zm5-.5c0 .3-.2.5-.5.5h-3V11c0-1.1-.9-2-2-2h-2.5V6c0-.3.2-.5.5-.5h7c.3 0 .5.2.5.5v7z" |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1341 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1342 |
}); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1343 |
/* harmony default export */ const library_group = (group); |
18 | 1344 |
|
19 | 1345 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/edit.js |
18 | 1346 |
/** |
1347 |
* WordPress dependencies |
|
1348 |
*/ |
|
1349 |
||
1350 |
||
1351 |
||
19 | 1352 |
|
1353 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1354 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1355 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1356 |
|
19 | 1357 |
function edit_Edit(props) { |
1358 |
const { |
|
1359 |
clientId |
|
1360 |
} = props; |
|
1361 |
const { |
|
1362 |
innerBlocks |
|
1363 |
} = (0,external_wp_data_namespaceObject.useSelect)(select => select(external_wp_blockEditor_namespaceObject.store).getBlock(clientId), [clientId]); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1364 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1365 |
...(0,external_wp_blockEditor_namespaceObject.useBlockProps)({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1366 |
className: 'widget' |
19 | 1367 |
}), |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1368 |
children: innerBlocks.length === 0 ? /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PlaceholderContent, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1369 |
...props |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1370 |
}) : /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(PreviewContent, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1371 |
...props |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1372 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1373 |
}); |
19 | 1374 |
} |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1375 |
function PlaceholderContent({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1376 |
clientId |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1377 |
}) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1378 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1379 |
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.Placeholder, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1380 |
className: "wp-block-widget-group__placeholder", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1381 |
icon: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.BlockIcon, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1382 |
icon: library_group |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1383 |
}), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1384 |
label: (0,external_wp_i18n_namespaceObject.__)('Widget Group'), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1385 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.ButtonBlockAppender, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1386 |
rootClientId: clientId |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1387 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1388 |
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1389 |
renderAppender: false |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1390 |
})] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1391 |
}); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1392 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1393 |
function PreviewContent({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1394 |
attributes, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1395 |
setAttributes |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1396 |
}) { |
19 | 1397 |
var _attributes$title; |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1398 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1399 |
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1400 |
tagName: "h2", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1401 |
identifier: "title", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1402 |
className: "widget-title", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1403 |
allowedFormats: [], |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1404 |
placeholder: (0,external_wp_i18n_namespaceObject.__)('Title'), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1405 |
value: (_attributes$title = attributes.title) !== null && _attributes$title !== void 0 ? _attributes$title : '', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1406 |
onChange: title => setAttributes({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1407 |
title |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1408 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1409 |
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks, {})] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1410 |
}); |
19 | 1411 |
} |
1412 |
||
1413 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/save.js |
|
1414 |
/** |
|
1415 |
* WordPress dependencies |
|
1416 |
*/ |
|
1417 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1418 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1419 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1420 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1421 |
function save({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1422 |
attributes |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1423 |
}) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1424 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1425 |
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1426 |
tagName: "h2", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1427 |
className: "widget-title", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1428 |
value: attributes.title |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1429 |
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)("div", { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1430 |
className: "wp-widget-group__inner-blocks", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1431 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1432 |
})] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1433 |
}); |
18 | 1434 |
} |
1435 |
||
19 | 1436 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/deprecated.js |
1437 |
/** |
|
1438 |
* WordPress dependencies |
|
1439 |
*/ |
|
1440 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1441 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1442 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1443 |
|
19 | 1444 |
const v1 = { |
1445 |
attributes: { |
|
1446 |
title: { |
|
1447 |
type: 'string' |
|
1448 |
} |
|
1449 |
}, |
|
1450 |
supports: { |
|
1451 |
html: false, |
|
1452 |
inserter: true, |
|
1453 |
customClassName: true, |
|
1454 |
reusable: false |
|
1455 |
}, |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1456 |
save({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1457 |
attributes |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1458 |
}) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1459 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsxs)(external_ReactJSXRuntime_namespaceObject.Fragment, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1460 |
children: [/*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.RichText.Content, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1461 |
tagName: "h2", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1462 |
className: "widget-title", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1463 |
value: attributes.title |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1464 |
}), /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_blockEditor_namespaceObject.InnerBlocks.Content, {})] |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1465 |
}); |
19 | 1466 |
} |
1467 |
}; |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1468 |
/* harmony default export */ const deprecated = ([v1]); |
19 | 1469 |
|
1470 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/blocks/widget-group/index.js |
|
1471 |
/** |
|
1472 |
* WordPress dependencies |
|
1473 |
*/ |
|
1474 |
||
1475 |
||
1476 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1477 |
|
19 | 1478 |
/** |
1479 |
* Internal dependencies |
|
1480 |
*/ |
|
1481 |
const widget_group_metadata = { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1482 |
$schema: "https://schemas.wp.org/trunk/block.json", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1483 |
apiVersion: 3, |
19 | 1484 |
name: "core/widget-group", |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1485 |
title: "Widget Group", |
19 | 1486 |
category: "widgets", |
1487 |
attributes: { |
|
1488 |
title: { |
|
1489 |
type: "string" |
|
1490 |
} |
|
1491 |
}, |
|
1492 |
supports: { |
|
1493 |
html: false, |
|
1494 |
inserter: true, |
|
1495 |
customClassName: true, |
|
1496 |
reusable: false |
|
1497 |
}, |
|
1498 |
editorStyle: "wp-block-widget-group-editor", |
|
1499 |
style: "wp-block-widget-group" |
|
1500 |
}; |
|
1501 |
||
18 | 1502 |
|
1503 |
||
19 | 1504 |
const { |
1505 |
name: widget_group_name |
|
1506 |
} = widget_group_metadata; |
|
1507 |
||
1508 |
const widget_group_settings = { |
|
1509 |
title: (0,external_wp_i18n_namespaceObject.__)('Widget Group'), |
|
1510 |
description: (0,external_wp_i18n_namespaceObject.__)('Create a classic widget layout with a title that’s styled by your theme for your widget areas.'), |
|
1511 |
icon: library_group, |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1512 |
__experimentalLabel: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1513 |
name: label |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1514 |
}) => label, |
19 | 1515 |
edit: edit_Edit, |
1516 |
save: save, |
|
1517 |
transforms: { |
|
1518 |
from: [{ |
|
1519 |
type: 'block', |
|
1520 |
isMultiBlock: true, |
|
1521 |
blocks: ['*'], |
|
1522 |
isMatch(attributes, blocks) { |
|
1523 |
// Avoid transforming existing `widget-group` blocks. |
|
1524 |
return !blocks.some(block => block.name === 'core/widget-group'); |
|
1525 |
}, |
|
1526 |
__experimentalConvert(blocks) { |
|
1527 |
// Put the selected blocks inside the new Widget Group's innerBlocks. |
|
1528 |
let innerBlocks = [...blocks.map(block => { |
|
1529 |
return (0,external_wp_blocks_namespaceObject.createBlock)(block.name, block.attributes, block.innerBlocks); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1530 |
})]; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1531 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1532 |
// If the first block is a heading then assume this is intended |
19 | 1533 |
// to be the Widget's "title". |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1534 |
const firstHeadingBlock = innerBlocks[0].name === 'core/heading' ? innerBlocks[0] : null; |
19 | 1535 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1536 |
// Remove the first heading block as we're copying |
19 | 1537 |
// it's content into the Widget Group's title attribute. |
1538 |
innerBlocks = innerBlocks.filter(block => block !== firstHeadingBlock); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1539 |
return (0,external_wp_blocks_namespaceObject.createBlock)('core/widget-group', { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1540 |
...(firstHeadingBlock && { |
19 | 1541 |
title: firstHeadingBlock.attributes.content |
1542 |
}) |
|
1543 |
}, innerBlocks); |
|
1544 |
} |
|
1545 |
}] |
|
1546 |
}, |
|
1547 |
deprecated: deprecated |
|
1548 |
}; |
|
1549 |
||
1550 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/move-to.js |
|
1551 |
/** |
|
1552 |
* WordPress dependencies |
|
1553 |
*/ |
|
1554 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1555 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1556 |
const moveTo = /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.SVG, { |
19 | 1557 |
xmlns: "http://www.w3.org/2000/svg", |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1558 |
viewBox: "0 0 24 24", |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1559 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_primitives_namespaceObject.Path, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1560 |
d: "M19.75 9c0-1.257-.565-2.197-1.39-2.858-.797-.64-1.827-1.017-2.815-1.247-1.802-.42-3.703-.403-4.383-.396L11 4.5V6l.177-.001c.696-.006 2.416-.02 4.028.356.887.207 1.67.518 2.216.957.52.416.829.945.829 1.688 0 .592-.167.966-.407 1.23-.255.281-.656.508-1.236.674-1.19.34-2.82.346-4.607.346h-.077c-1.692 0-3.527 0-4.942.404-.732.209-1.424.545-1.935 1.108-.526.579-.796 1.33-.796 2.238 0 1.257.565 2.197 1.39 2.858.797.64 1.827 1.017 2.815 1.247 1.802.42 3.703.403 4.383.396L13 19.5h.714V22L18 18.5 13.714 15v3H13l-.177.001c-.696.006-2.416.02-4.028-.356-.887-.207-1.67-.518-2.216-.957-.52-.416-.829-.945-.829-1.688 0-.592.167-.966.407-1.23.255-.281.656-.508 1.237-.674 1.189-.34 2.819-.346 4.606-.346h.077c1.692 0 3.527 0 4.941-.404.732-.209 1.425-.545 1.936-1.108.526-.579.796-1.33.796-2.238z" |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1561 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1562 |
}); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1563 |
/* harmony default export */ const move_to = (moveTo); |
19 | 1564 |
|
1565 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/components/move-to-widget-area/index.js |
|
1566 |
/** |
|
1567 |
* WordPress dependencies |
|
1568 |
*/ |
|
1569 |
||
1570 |
||
1571 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1572 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1573 |
function MoveToWidgetArea({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1574 |
currentWidgetAreaId, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1575 |
widgetAreas, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1576 |
onSelect |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1577 |
}) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1578 |
return /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarGroup, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1579 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.ToolbarItem, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1580 |
children: toggleProps => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.DropdownMenu, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1581 |
icon: move_to, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1582 |
label: (0,external_wp_i18n_namespaceObject.__)('Move to widget area'), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1583 |
toggleProps: toggleProps, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1584 |
children: ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1585 |
onClose |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1586 |
}) => /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuGroup, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1587 |
label: (0,external_wp_i18n_namespaceObject.__)('Move to'), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1588 |
children: /*#__PURE__*/(0,external_ReactJSXRuntime_namespaceObject.jsx)(external_wp_components_namespaceObject.MenuItemsChoice, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1589 |
choices: widgetAreas.map(widgetArea => ({ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1590 |
value: widgetArea.id, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1591 |
label: widgetArea.name, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1592 |
info: widgetArea.description |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1593 |
})), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1594 |
value: currentWidgetAreaId, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1595 |
onSelect: value => { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1596 |
onSelect(value); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1597 |
onClose(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1598 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1599 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1600 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1601 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1602 |
}) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1603 |
}); |
19 | 1604 |
} |
1605 |
||
1606 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/components/index.js |
|
1607 |
||
1608 |
||
1609 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/utils.js |
|
18 | 1610 |
// @ts-check |
1611 |
||
1612 |
/** |
|
1613 |
* Get the internal widget id from block. |
|
1614 |
* |
|
1615 |
* @typedef {Object} Attributes |
|
19 | 1616 |
* @property {string} __internalWidgetId The internal widget id. |
18 | 1617 |
* @typedef {Object} Block |
19 | 1618 |
* @property {Attributes} attributes The attributes of the block. |
18 | 1619 |
* |
19 | 1620 |
* @param {Block} block The block. |
18 | 1621 |
* @return {string} The internal widget id. |
1622 |
*/ |
|
1623 |
function getWidgetIdFromBlock(block) { |
|
1624 |
return block.attributes.__internalWidgetId; |
|
1625 |
} |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1626 |
|
18 | 1627 |
/** |
1628 |
* Add internal widget id to block's attributes. |
|
1629 |
* |
|
19 | 1630 |
* @param {Block} block The block. |
18 | 1631 |
* @param {string} widgetId The widget id. |
1632 |
* @return {Block} The updated block. |
|
1633 |
*/ |
|
1634 |
function addWidgetIdToBlock(block, widgetId) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1635 |
return { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1636 |
...block, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1637 |
attributes: { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1638 |
...(block.attributes || {}), |
18 | 1639 |
__internalWidgetId: widgetId |
1640 |
} |
|
1641 |
}; |
|
1642 |
} |
|
1643 |
||
19 | 1644 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/register-legacy-widget-variations.js |
18 | 1645 |
/** |
1646 |
* WordPress dependencies |
|
1647 |
*/ |
|
1648 |
||
1649 |
||
1650 |
||
1651 |
function registerLegacyWidgetVariations(settings) { |
|
19 | 1652 |
const unsubscribe = (0,external_wp_data_namespaceObject.subscribe)(() => { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1653 |
var _settings$widgetTypes; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1654 |
const hiddenIds = (_settings$widgetTypes = settings?.widgetTypesToHideFromLegacyWidgetBlock) !== null && _settings$widgetTypes !== void 0 ? _settings$widgetTypes : []; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1655 |
const widgetTypes = (0,external_wp_data_namespaceObject.select)(external_wp_coreData_namespaceObject.store).getWidgetTypes({ |
18 | 1656 |
per_page: -1 |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1657 |
})?.filter(widgetType => !hiddenIds.includes(widgetType.id)); |
18 | 1658 |
if (widgetTypes) { |
1659 |
unsubscribe(); |
|
19 | 1660 |
(0,external_wp_data_namespaceObject.dispatch)(external_wp_blocks_namespaceObject.store).addBlockVariations('core/legacy-widget', widgetTypes.map(widgetType => ({ |
18 | 1661 |
name: widgetType.id, |
1662 |
title: widgetType.name, |
|
1663 |
description: widgetType.description, |
|
1664 |
attributes: widgetType.is_multi ? { |
|
1665 |
idBase: widgetType.id, |
|
1666 |
instance: {} |
|
1667 |
} : { |
|
1668 |
id: widgetType.id |
|
1669 |
} |
|
1670 |
}))); |
|
1671 |
} |
|
1672 |
}); |
|
1673 |
} |
|
1674 |
||
19 | 1675 |
;// CONCATENATED MODULE: ./node_modules/@wordpress/widgets/build-module/index.js |
18 | 1676 |
/** |
1677 |
* WordPress dependencies |
|
1678 |
*/ |
|
1679 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1680 |
|
18 | 1681 |
/** |
1682 |
* Internal dependencies |
|
1683 |
*/ |
|
1684 |
||
1685 |
||
1686 |
||
1687 |
||
19 | 1688 |
|
18 | 1689 |
/** |
1690 |
* Registers the Legacy Widget block. |
|
1691 |
* |
|
1692 |
* Note that for the block to be useful, any scripts required by a widget must |
|
1693 |
* be loaded into the page. |
|
1694 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1695 |
* @param {Object} supports Block support settings. |
18 | 1696 |
* @see https://developer.wordpress.org/block-editor/how-to-guides/widgets/legacy-widget-block/ |
1697 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1698 |
function registerLegacyWidgetBlock(supports = {}) { |
18 | 1699 |
const { |
1700 |
metadata, |
|
1701 |
settings, |
|
1702 |
name |
|
1703 |
} = legacy_widget_namespaceObject; |
|
19 | 1704 |
(0,external_wp_blocks_namespaceObject.registerBlockType)({ |
1705 |
name, |
|
1706 |
...metadata |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1707 |
}, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1708 |
...settings, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1709 |
supports: { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1710 |
...settings.supports, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1711 |
...supports |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1712 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1713 |
}); |
19 | 1714 |
} |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1715 |
|
19 | 1716 |
/** |
1717 |
* Registers the Widget Group block. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1718 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1719 |
* @param {Object} supports Block support settings. |
19 | 1720 |
*/ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1721 |
function registerWidgetGroupBlock(supports = {}) { |
19 | 1722 |
const { |
1723 |
metadata, |
|
1724 |
settings, |
|
1725 |
name |
|
1726 |
} = widget_group_namespaceObject; |
|
1727 |
(0,external_wp_blocks_namespaceObject.registerBlockType)({ |
|
18 | 1728 |
name, |
1729 |
...metadata |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1730 |
}, { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1731 |
...settings, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1732 |
supports: { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1733 |
...settings.supports, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1734 |
...supports |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1735 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1736 |
}); |
18 | 1737 |
} |
1738 |
||
1739 |
||
19 | 1740 |
(window.wp = window.wp || {}).widgets = __webpack_exports__; |
1741 |
/******/ })() |
|
1742 |
; |