Skip to content

Commit

Permalink
🎉 Conditionalise the template library
Browse files Browse the repository at this point in the history
  • Loading branch information
ZafarKamal123 committed Sep 8, 2023
1 parent 9f24dff commit 0c40391
Show file tree
Hide file tree
Showing 29 changed files with 47,800 additions and 36,132 deletions.
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require("@wordpress/prettier-config");
module.exports = require('@wordpress/prettier-config');
54 changes: 27 additions & 27 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"extends": "stylelint-config-wordpress",
"rules": {
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": [
"extend",
"at-root",
"debug",
"warn",
"error",
"if",
"else",
"for",
"each",
"while",
"mixin",
"include",
"content",
"return",
"function"
]
}
],
"no-descending-specificity": null,
}
}
"extends": "stylelint-config-wordpress",
"rules": {
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": [
"extend",
"at-root",
"debug",
"warn",
"error",
"if",
"else",
"for",
"each",
"while",
"mixin",
"include",
"content",
"return",
"function"
]
}
],
"no-descending-specificity": null
}
}
2 changes: 1 addition & 1 deletion build/admin.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'e6513dbd86f9427fde2277a1279027df');
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'c261e604c344e712a3fbd231241b6e5b');
2 changes: 1 addition & 1 deletion build/admin.build.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/editor.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('wp-polyfill'), 'version' => 'faedd7ffbc55cd9c15dd5b296cea705a');
<?php return array('dependencies' => array('wp-polyfill'), 'version' => '826b1a7f75ffcee6417c3bea7442eb3b');
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-dom-ready', 'wp-html-entities', 'wp-polyfill', 'wp-url'), 'version' => '5d3ee391e6d22ba3cdd3b4096c90f493');
<?php return array('dependencies' => array('lodash', 'react', 'react-dom', 'wp-dom-ready', 'wp-html-entities', 'wp-polyfill', 'wp-url'), 'version' => 'ac17079a082314488905bdea1c63a2a8');
106 changes: 50 additions & 56 deletions build/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21566,33 +21566,30 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/components */ "@wordpress/components");
/* harmony import */ var _wordpress_components__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @wordpress/icons */ "./node_modules/@wordpress/icons/build-module/index.js");
/* harmony import */ var _components_library__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./components/library */ "./src/addons/template-library/components/library.js");
/* harmony import */ var react_query__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react-query */ "./node_modules/react-query/es/index.js");
/* harmony import */ var _query_client__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./query-client */ "./src/addons/template-library/query-client.js");
/* harmony import */ var _stores_library__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./stores/library */ "./src/addons/template-library/stores/library.js");
/* harmony import */ var _components_library__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./components/library */ "./src/addons/template-library/components/library.js");
/* harmony import */ var react_query__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-query */ "./node_modules/react-query/es/index.js");
/* harmony import */ var _query_client__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./query-client */ "./src/addons/template-library/query-client.js");
/* harmony import */ var _stores_library__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./stores/library */ "./src/addons/template-library/stores/library.js");

/**
* WordPress Dependencies
/**
* WordPress Dependencies
*/






/**
* Custom Dependencies
/**
* Custom Dependencies
*/




function App() {
var isVisible = Object(_stores_library__WEBPACK_IMPORTED_MODULE_7__["default"])(function (state) {
var isVisible = Object(_stores_library__WEBPACK_IMPORTED_MODULE_6__["default"])(function (state) {
return state.isVisible;
});
var setVisible = Object(_stores_library__WEBPACK_IMPORTED_MODULE_7__["default"])(function (state) {
var setVisible = Object(_stores_library__WEBPACK_IMPORTED_MODULE_6__["default"])(function (state) {
return state.setVisible;
});
var openModal = function openModal() {
Expand All @@ -21601,21 +21598,20 @@ function App() {
var closeModal = function closeModal() {
return setVisible(false);
};
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(react_query__WEBPACK_IMPORTED_MODULE_5__["QueryClientProvider"], {
client: _query_client__WEBPACK_IMPORTED_MODULE_6__["default"]
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(react_query__WEBPACK_IMPORTED_MODULE_4__["QueryClientProvider"], {
client: _query_client__WEBPACK_IMPORTED_MODULE_5__["default"]
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__["Button"], {
variant: "primary",
style: {
marginRight: 5
},
onClick: openModal,
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_3__["cloud"]
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Cloud Library', 'gutenberghub-template-library')), isVisible && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__["Modal"], {
onClick: openModal
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__["__"])('Template Library', 'gutenberghub-template-library')), isVisible && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_2__["Modal"], {
isFullScreen: true,
__experimentalhideheader: true,
onRequestClose: closeModal,
className: "gutenberghub-template-library-root"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_components_library__WEBPACK_IMPORTED_MODULE_4__["default"], {
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_components_library__WEBPACK_IMPORTED_MODULE_3__["default"], {
onRequestClose: closeModal
}))));
}
Expand Down Expand Up @@ -21855,18 +21851,10 @@ function LibraryCreateNewConnection() {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(LibraryError, null);
}
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
className: "gutenberghub-template-library-cloud-grid"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(react_responsive_masonry__WEBPACK_IMPORTED_MODULE_9__["ResponsiveMasonry"], {
columnsCountBreakPoints: {
350: 1,
750: 2,
900: 4
}
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(react_responsive_masonry__WEBPACK_IMPORTED_MODULE_9__["default"], {
gutter: "15px"
className: "gutenberghub-template-library-cloud__cloud-grid"
}, cloudList === null || cloudList === void 0 ? void 0 : cloudList.map(function (item) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_library_cloud__WEBPACK_IMPORTED_MODULE_6__["default"], item === null || item === void 0 ? void 0 : item.acf);
}))));
}));
}
/* harmony default export */ __webpack_exports__["default"] = (LibraryCreateNewConnection);

Expand Down Expand Up @@ -21937,7 +21925,7 @@ function LibraryConnectionsSwitcher() {
}
}, connection === null || connection === void 0 ? void 0 : connection.title);
}), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["Button"], {
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_4__["plusCircle"],
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_4__["plus"],
isPressed: isAddingNewConnection,
onClick: function onClick() {
setIsAddingNewConnection(true);
Expand Down Expand Up @@ -22122,7 +22110,7 @@ __webpack_require__.r(__webpack_exports__);
function LibraryHeader(props) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
className: "gutenberghub-template-library-header"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("h3", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Library', 'gutenberghub-template-library')), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_library_connections_switcher__WEBPACK_IMPORTED_MODULE_5__["default"], null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["Button"], {
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("h3", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Template Library', 'gutenberghub-template-library')), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_library_connections_switcher__WEBPACK_IMPORTED_MODULE_5__["default"], null), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["Button"], {
showTooltip: true,
icon: _wordpress_icons__WEBPACK_IMPORTED_MODULE_4__["close"],
onClick: props.onClose,
Expand Down Expand Up @@ -22162,12 +22150,12 @@ function LibraryNoConnectionsFound() {
});
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
className: "gutenberghub-template-library-no-connections"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("h2", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('No Connections Found', 'gutenberghub-template-library')), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("p", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])("You don't have any existing connection. Try creating a new connection.", 'gutenberghub-template-library')), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["Button"], {
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("h2", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('No Cloud Found', 'gutenberghub-template-library')), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("p", null, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])("You don't have any existing cloud. Try adding a new cloud.", 'gutenberghub-template-library')), Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_components__WEBPACK_IMPORTED_MODULE_3__["Button"], {
variant: "primary",
onClick: function onClick() {
return setIsAddingNewConnection(true);
}
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Create New Connection', 'gutenberghub-template-library')));
}, Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__["__"])('Add New Connection', 'gutenberghub-template-library')));
}
/* harmony default export */ __webpack_exports__["default"] = (LibraryNoConnectionsFound);

Expand Down Expand Up @@ -22567,31 +22555,37 @@ __webpack_require__.r(__webpack_exports__);
/* harmony import */ var _app__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./app */ "./src/addons/template-library/app.js");
/* harmony import */ var react_query__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react-query */ "./node_modules/react-query/es/index.js");
/* harmony import */ var _query_client__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./query-client */ "./src/addons/template-library/query-client.js");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! lodash */ "lodash");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_5__);







_wordpress_dom_ready__WEBPACK_IMPORTED_MODULE_1___default()(function () {
var observer = new MutationObserver(function (_, observer) {
var toolbarElement = document.querySelector('.edit-post-header__toolbar');
if (toolbarElement) {
var wrapper = document.createElement('div');
wrapper.id = 'wpcloudify-toolbar-items';
wrapper.style.display = 'flex'; // TODO: move this somewhere else.

toolbarElement.appendChild(wrapper);
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["render"])(Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(react_query__WEBPACK_IMPORTED_MODULE_3__["QueryClientProvider"], {
client: _query_client__WEBPACK_IMPORTED_MODULE_4__["default"]
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_app__WEBPACK_IMPORTED_MODULE_2__["default"], null)), wrapper);
observer.disconnect();
}
});
observer.observe(document.body, {
childList: true,
attributes: true
});
var isAddonActive = Object(lodash__WEBPACK_IMPORTED_MODULE_5__["get"])(window, 'editorskitInfo.addons.template_library', false);
if (isAddonActive) {
var observer = new MutationObserver(function (_, observer) {
var toolbarElement = document.querySelector('.edit-post-header__toolbar');
if (toolbarElement) {
var wrapper = document.createElement('div');
wrapper.id = 'wpcloudify-toolbar-items';
wrapper.style.display = 'flex'; // TODO: move this somewhere else.

toolbarElement.appendChild(wrapper);
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["render"])(Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(react_query__WEBPACK_IMPORTED_MODULE_3__["QueryClientProvider"], {
client: _query_client__WEBPACK_IMPORTED_MODULE_4__["default"]
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_app__WEBPACK_IMPORTED_MODULE_2__["default"], null)), wrapper);
observer.disconnect();
}
});
observer.observe(document.body, {
childList: true,
attributes: true
});
}
});

/***/ }),
Expand Down Expand Up @@ -22947,10 +22941,10 @@ function _getTemplates() {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var zustand__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! zustand */ "./node_modules/zustand/index.js");
/* harmony import */ var zustand__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(zustand__WEBPACK_IMPORTED_MODULE_0__);
/**
*
* zustand Dependencies
*
/**
*
* zustand Dependencies
*
*/

var useLibrary = zustand__WEBPACK_IMPORTED_MODULE_0___default()(function (set) {
Expand Down Expand Up @@ -23123,7 +23117,7 @@ var registerBlockType = wp.blocks.registerBlockType;


function registerBlocks() {
[_blocks_import__WEBPACK_IMPORTED_MODULE_29__, _blocks_shareablock__WEBPACK_IMPORTED_MODULE_30__].forEach(function (block) {
[_blocks_import__WEBPACK_IMPORTED_MODULE_29__, shareABloc].forEach(function (block) {
if (!block) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion build/settings.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'wp-polyfill'), 'version' => '2122c698da257ca92b378cb5ce591451');
<?php return array('dependencies' => array('lodash', 'wp-polyfill'), 'version' => '33495f2403a800db9b3f432240babfda');
Loading

0 comments on commit 0c40391

Please sign in to comment.