420 lines
16 KiB
JavaScript
420 lines
16 KiB
JavaScript
/******/ (() => { // webpackBootstrap
|
|
/******/ var __webpack_modules__ = ({
|
|
|
|
/***/ "./src/core-variants/core-embed-variant/editor.js":
|
|
/*!********************************************************!*\
|
|
!*** ./src/core-variants/core-embed-variant/editor.js ***!
|
|
\********************************************************/
|
|
/***/ (() => {
|
|
|
|
wp.blocks.registerBlockStyle("core/embed", {
|
|
name: "stacked-background",
|
|
label: "Fond empilé"
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/core-variants/core-heading-variant/editor.js":
|
|
/*!**********************************************************!*\
|
|
!*** ./src/core-variants/core-heading-variant/editor.js ***!
|
|
\**********************************************************/
|
|
/***/ (() => {
|
|
|
|
wp.blocks.registerBlockStyle("core/heading", {
|
|
name: "stroked-after",
|
|
label: "Titre + trait "
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/core-variants/core-image-variant/editor.js":
|
|
/*!********************************************************!*\
|
|
!*** ./src/core-variants/core-image-variant/editor.js ***!
|
|
\********************************************************/
|
|
/***/ (() => {
|
|
|
|
wp.blocks.registerBlockStyle("core/image", {
|
|
name: "framed",
|
|
label: "Encadré",
|
|
isDefault: true
|
|
});
|
|
wp.blocks.registerBlockStyle("core/image", {
|
|
name: "stacked",
|
|
label: "Empilé",
|
|
isDefault: false
|
|
});
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/core-variants/core-list-variant/editor.js":
|
|
/*!*******************************************************!*\
|
|
!*** ./src/core-variants/core-list-variant/editor.js ***!
|
|
\*******************************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/blocks */ "@wordpress/blocks");
|
|
/* harmony import */ var _wordpress_blocks__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
|
|
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
|
|
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/block-editor */ "@wordpress/block-editor");
|
|
/* harmony import */ var _wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__);
|
|
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
|
|
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__);
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
|
|
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__);
|
|
/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @wordpress/hooks */ "@wordpress/hooks");
|
|
/* harmony import */ var _wordpress_hooks__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_hooks__WEBPACK_IMPORTED_MODULE_5__);
|
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
|
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_6__);
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! react/jsx-runtime */ "react/jsx-runtime");
|
|
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Variation du bloc "Liste" pour ajouter une classe spéciale
|
|
|
|
(0,_wordpress_blocks__WEBPACK_IMPORTED_MODULE_0__.registerBlockVariation)("core/list", {
|
|
name: "iconed-list",
|
|
title: "Liste avec icônes",
|
|
description: "Liste dont chaque élément peut avoir une icône personnalisée.",
|
|
attributes: {
|
|
className: "is-iconed-list"
|
|
},
|
|
scope: ["inserter", "transform"],
|
|
isActive: blockAttributes => {
|
|
const cls = blockAttributes && blockAttributes.className || "";
|
|
return cls.split(" ").includes("is-iconed-list");
|
|
}
|
|
});
|
|
|
|
// -----------------------------
|
|
// 1. On étend les attributs de core/list-item
|
|
// -----------------------------
|
|
|
|
(0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_5__.addFilter)("blocks.registerBlockType", "am/iconed-list-item-attributes", (settings, name) => {
|
|
if (name !== "core/list-item") {
|
|
return settings;
|
|
}
|
|
return {
|
|
...settings,
|
|
attributes: {
|
|
...settings.attributes,
|
|
icon: {
|
|
type: "string",
|
|
default: ""
|
|
}
|
|
}
|
|
};
|
|
});
|
|
|
|
// -----------------------------
|
|
// 2. On ajoute un panneau de réglages pour choisir l'icône
|
|
// -----------------------------
|
|
|
|
(0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_5__.addFilter)("editor.BlockEdit", "am/iconed-list-item-controls", BlockEdit => props => {
|
|
if (props.name !== "core/list-item") {
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(BlockEdit, {
|
|
...props
|
|
});
|
|
}
|
|
const {
|
|
attributes,
|
|
setAttributes
|
|
} = props;
|
|
const {
|
|
icon
|
|
} = attributes;
|
|
const ICONS = [{
|
|
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Loupe"),
|
|
value: "loupe"
|
|
}, {
|
|
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Sablier"),
|
|
value: "sablier"
|
|
}, {
|
|
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Cadenas"),
|
|
value: "cadenas"
|
|
}, {
|
|
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Check"),
|
|
value: "check"
|
|
}, {
|
|
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Loupe Alt"),
|
|
value: "loupe-alt"
|
|
}, {
|
|
title: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Pendule"),
|
|
value: "pendule"
|
|
}];
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_element__WEBPACK_IMPORTED_MODULE_4__.Fragment, {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(BlockEdit, {
|
|
...props
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsxs)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.BlockControls, {
|
|
children: [/*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarGroup, {
|
|
children: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__.ToolbarDropdownMenu, {
|
|
label: (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__.__)("Icône du bullet"),
|
|
className: "iconed-list-item-icon-dropdown",
|
|
icon: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
className: `iconed-list-item-backend-icon-square iconed-list-item-backend-icon-square--${icon}`
|
|
}),
|
|
controls: ICONS.map(({
|
|
title,
|
|
value
|
|
}) => ({
|
|
title,
|
|
icon: /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)("div", {
|
|
className: `iconed-list-item-backend-icon-square iconed-list-item-backend-icon-square--${value}`
|
|
}),
|
|
isActive: icon === value,
|
|
onClick: () => setAttributes({
|
|
icon: value
|
|
})
|
|
}))
|
|
})
|
|
}), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(_wordpress_block_editor__WEBPACK_IMPORTED_MODULE_2__.AlignmentToolbar, {
|
|
value: attributes.align,
|
|
onChange: value => setAttributes({
|
|
align: value
|
|
})
|
|
})]
|
|
})]
|
|
});
|
|
});
|
|
|
|
// -----------------------------
|
|
// 3. On ajoute des props au HTML sauvegardé pour chaque <li>
|
|
// -----------------------------
|
|
(0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_5__.addFilter)("blocks.getSaveContent.extraProps", "carhop/iconed-list-item-save-props", (extraProps, blockType, attributes) => {
|
|
if (blockType.name !== "core/list-item") {
|
|
return extraProps;
|
|
}
|
|
if (attributes.icon) {
|
|
extraProps = {
|
|
...extraProps,
|
|
className: (extraProps.className || "") + " has-custom-icon has-custom-icon--" + attributes.icon
|
|
};
|
|
}
|
|
return extraProps;
|
|
});
|
|
|
|
// -----------------------------
|
|
// 4. Applique les mêmes classes en mode éditeur (BlockListBlock)
|
|
// -----------------------------
|
|
(0,_wordpress_hooks__WEBPACK_IMPORTED_MODULE_5__.addFilter)("editor.BlockListBlock", "carhop/iconed-list-item-editor-classes", (0,_wordpress_compose__WEBPACK_IMPORTED_MODULE_6__.createHigherOrderComponent)(BlockListBlock => {
|
|
return props => {
|
|
if (props.name !== "core/list-item") {
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(BlockListBlock, {
|
|
...props
|
|
});
|
|
}
|
|
const slug = props.attributes?.icon || "";
|
|
const className = [props.className || "", slug ? "has-custom-icon" : "", slug ? `has-custom-icon--${slug}` : ""].filter(Boolean).join(" ");
|
|
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_7__.jsx)(BlockListBlock, {
|
|
...props,
|
|
className: className
|
|
});
|
|
};
|
|
}, "withIconedListItemEditorClasses"));
|
|
|
|
/***/ }),
|
|
|
|
/***/ "./src/core-variants/variants.scss":
|
|
/*!*****************************************!*\
|
|
!*** ./src/core-variants/variants.scss ***!
|
|
\*****************************************/
|
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
|
|
"use strict";
|
|
__webpack_require__.r(__webpack_exports__);
|
|
// extracted by mini-css-extract-plugin
|
|
|
|
|
|
/***/ }),
|
|
|
|
/***/ "@wordpress/block-editor":
|
|
/*!*************************************!*\
|
|
!*** external ["wp","blockEditor"] ***!
|
|
\*************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = window["wp"]["blockEditor"];
|
|
|
|
/***/ }),
|
|
|
|
/***/ "@wordpress/blocks":
|
|
/*!********************************!*\
|
|
!*** external ["wp","blocks"] ***!
|
|
\********************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = window["wp"]["blocks"];
|
|
|
|
/***/ }),
|
|
|
|
/***/ "@wordpress/components":
|
|
/*!************************************!*\
|
|
!*** external ["wp","components"] ***!
|
|
\************************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = window["wp"]["components"];
|
|
|
|
/***/ }),
|
|
|
|
/***/ "@wordpress/compose":
|
|
/*!*********************************!*\
|
|
!*** external ["wp","compose"] ***!
|
|
\*********************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = window["wp"]["compose"];
|
|
|
|
/***/ }),
|
|
|
|
/***/ "@wordpress/element":
|
|
/*!*********************************!*\
|
|
!*** external ["wp","element"] ***!
|
|
\*********************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = window["wp"]["element"];
|
|
|
|
/***/ }),
|
|
|
|
/***/ "@wordpress/hooks":
|
|
/*!*******************************!*\
|
|
!*** external ["wp","hooks"] ***!
|
|
\*******************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = window["wp"]["hooks"];
|
|
|
|
/***/ }),
|
|
|
|
/***/ "@wordpress/i18n":
|
|
/*!******************************!*\
|
|
!*** external ["wp","i18n"] ***!
|
|
\******************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = window["wp"]["i18n"];
|
|
|
|
/***/ }),
|
|
|
|
/***/ "react/jsx-runtime":
|
|
/*!**********************************!*\
|
|
!*** external "ReactJSXRuntime" ***!
|
|
\**********************************/
|
|
/***/ ((module) => {
|
|
|
|
"use strict";
|
|
module.exports = window["ReactJSXRuntime"];
|
|
|
|
/***/ })
|
|
|
|
/******/ });
|
|
/************************************************************************/
|
|
/******/ // The module cache
|
|
/******/ var __webpack_module_cache__ = {};
|
|
/******/
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
/******/ // Check if module is in cache
|
|
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
/******/ if (cachedModule !== undefined) {
|
|
/******/ return cachedModule.exports;
|
|
/******/ }
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
/******/ // no module.id needed
|
|
/******/ // no module.loaded needed
|
|
/******/ exports: {}
|
|
/******/ };
|
|
/******/
|
|
/******/ // Execute the module function
|
|
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
/******/
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
/******/
|
|
/************************************************************************/
|
|
/******/ /* webpack/runtime/compat get default export */
|
|
/******/ (() => {
|
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
/******/ __webpack_require__.n = (module) => {
|
|
/******/ var getter = module && module.__esModule ?
|
|
/******/ () => (module['default']) :
|
|
/******/ () => (module);
|
|
/******/ __webpack_require__.d(getter, { a: getter });
|
|
/******/ return getter;
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/define property getters */
|
|
/******/ (() => {
|
|
/******/ // define getter functions for harmony exports
|
|
/******/ __webpack_require__.d = (exports, definition) => {
|
|
/******/ for(var key in definition) {
|
|
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
/******/ }
|
|
/******/ }
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
/******/ (() => {
|
|
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
/******/ })();
|
|
/******/
|
|
/******/ /* webpack/runtime/make namespace object */
|
|
/******/ (() => {
|
|
/******/ // define __esModule on exports
|
|
/******/ __webpack_require__.r = (exports) => {
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
/******/ }
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
/******/ };
|
|
/******/ })();
|
|
/******/
|
|
/************************************************************************/
|
|
var __webpack_exports__ = {};
|
|
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
|
|
(() => {
|
|
"use strict";
|
|
/*!***************************************!*\
|
|
!*** ./src/core-variants/variants.js ***!
|
|
\***************************************/
|
|
__webpack_require__.r(__webpack_exports__);
|
|
/* harmony import */ var _core_heading_variant_editor_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./core-heading-variant/editor.js */ "./src/core-variants/core-heading-variant/editor.js");
|
|
/* harmony import */ var _core_heading_variant_editor_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_core_heading_variant_editor_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
/* harmony import */ var _core_image_variant_editor_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./core-image-variant/editor.js */ "./src/core-variants/core-image-variant/editor.js");
|
|
/* harmony import */ var _core_image_variant_editor_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_core_image_variant_editor_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
/* harmony import */ var _core_embed_variant_editor_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./core-embed-variant/editor.js */ "./src/core-variants/core-embed-variant/editor.js");
|
|
/* harmony import */ var _core_embed_variant_editor_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_core_embed_variant_editor_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
/* harmony import */ var _core_list_variant_editor_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./core-list-variant/editor.js */ "./src/core-variants/core-list-variant/editor.js");
|
|
/* harmony import */ var _variants_scss__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./variants.scss */ "./src/core-variants/variants.scss");
|
|
|
|
|
|
|
|
|
|
|
|
})();
|
|
|
|
/******/ })()
|
|
;
|
|
//# sourceMappingURL=variations.js.map
|