Added PreviewFiles to devTool server side.
This commit is contained in:
1 parent
29a75a6e26
commit
dfcd9681bc
13 files changed
+94
-26
No files matched your search
@@ -15,3 +15,4 @@ data
|
|||||||
src
|
src
|
||||||
exports
|
exports
|
||||||
block.json
|
block.json
|
||||||
|
design
|
||||||
+18
-16
@@ -6,7 +6,7 @@ import fetch from "node-fetch";
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import http from "http";
|
import http from "http";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import unzipper from "unzipper";
|
import StreamZip from "node-stream-zip";
|
||||||
import {fileURLToPath} from 'url';
|
import {fileURLToPath} from 'url';
|
||||||
import memFs from 'mem-fs';
|
import memFs from 'mem-fs';
|
||||||
import editor from 'mem-fs-editor';
|
import editor from 'mem-fs-editor';
|
||||||
@@ -17,7 +17,7 @@ const __filename = fileURLToPath(import.meta.url);
|
|||||||
const __dirname = path.dirname(__filename);
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
const isDev = process.env.NODE_ENV === 'development'; // Check README file in case you get "missing files" error.
|
const isDev = process.env.NODE_ENV === 'development'; // Check README file in case you get "missing files" error.
|
||||||
const blocksRegistry = isDev ? 'http://localhost:3020' : 'https://axe-web-blocks-registry.captain.devdevdev.life';
|
const blocksRegistry = isDev ? 'https://axe-web-blocks-registry.captain.devdevdev.life' : 'https://axe-web-blocks-registry.captain.devdevdev.life';
|
||||||
const blocksDirectory = isDev ? 'blocks/' : '';
|
const blocksDirectory = isDev ? 'blocks/' : '';
|
||||||
|
|
||||||
if (isDev) {
|
if (isDev) {
|
||||||
@@ -28,7 +28,7 @@ try {
|
|||||||
const blockName = await init();
|
const blockName = await init();
|
||||||
console.log(`🎉 Done! \n\nCheck the "${blocksDirectory}${blockName}" directory. \n`);
|
console.log(`🎉 Done! \n\nCheck the "${blocksDirectory}${blockName}" directory. \n`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Fail.');
|
console.log(`❌ Fail.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function init() {
|
async function init() {
|
||||||
@@ -69,24 +69,26 @@ async function getBlockSourceFiles(blockName) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const zipFile = await downloadFile(responseData.downloadUrl, responseData.name + '.zip');
|
if (responseData.status && responseData.status !== 200) {
|
||||||
await fs.createReadStream(zipFile)
|
console.log("⚠️ [ERROR]", responseData.message || "Server side error.");
|
||||||
.pipe(unzipper.Extract({path: `${blocksDirectory}${responseData.name}/src`}))
|
throw new Error("⚠️ [ERROR]", responseData.message || "Server side error.");
|
||||||
.promise();
|
}
|
||||||
|
|
||||||
// Remove downloaded file.
|
console.log(`⬇️ Downloading v${responseData.version}`);
|
||||||
|
const zipFile = await downloadFile(responseData.downloadUrl, responseData.name + '.zip');
|
||||||
|
|
||||||
|
// Download, Extract and Remove downloaded file.
|
||||||
try {
|
try {
|
||||||
|
const zip = new StreamZip.async({file: zipFile});
|
||||||
|
await zip.extract(null, `${blocksDirectory}${responseData.name}/src`);
|
||||||
|
await zip.close();
|
||||||
|
|
||||||
await fs.promises.access(zipFile, fs.constants.W_OK);
|
await fs.promises.access(zipFile, fs.constants.W_OK);
|
||||||
await fs.promises.unlink(zipFile);
|
await fs.promises.unlink(zipFile);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e)
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (responseData.statusCode && responseData.statusCode !== 200) {
|
|
||||||
console.log(responseData);
|
|
||||||
console.log("⚠️ [ERROR]", responseData.message || "Server side error.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
await createTechnicalFiles({
|
await createTechnicalFiles({
|
||||||
title: responseData.title,
|
title: responseData.title,
|
||||||
@@ -145,8 +147,8 @@ async function createDataFiles(blockName, dataSources = []) {
|
|||||||
|
|
||||||
if (typeof source.preview_images !== 'undefined' && source.preview_images.length) {
|
if (typeof source.preview_images !== 'undefined' && source.preview_images.length) {
|
||||||
for (let preview_image of source.preview_images) {
|
for (let preview_image of source.preview_images) {
|
||||||
await setupPath(`${blocksDirectory}${blockName}/design`);
|
await setupPath(`${blocksDirectory}${blockName}/design/preview`);
|
||||||
await downloadFile(preview_image.url, `${blocksDirectory}${blockName}/design/${source.name}-${preview_image.width}.${preview_image.extension}`)
|
await downloadFile(preview_image.url, `${blocksDirectory}${blockName}/design/preview/${source.name}.${preview_image.width}.${preview_image.extension}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Vendored
+16
-2
@@ -11480,6 +11480,14 @@ const SidebarDataOptionsStyle = qe.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
function DesignPreview(props = {}) {
|
||||||
|
return /*#__PURE__*/React.createElement("span", {
|
||||||
|
style: {
|
||||||
|
color: '#999'
|
||||||
|
}
|
||||||
|
}, "Preview");
|
||||||
|
}
|
||||||
|
|
||||||
function DataOptions(props = {}) {
|
function DataOptions(props = {}) {
|
||||||
props.rootAttributes = props.rootAttributes ?? {};
|
props.rootAttributes = props.rootAttributes ?? {};
|
||||||
const initialState = {
|
const initialState = {
|
||||||
@@ -11513,10 +11521,16 @@ function DataOptions(props = {}) {
|
|||||||
|
|
||||||
const handleBlur = async e => (await isClickOutside(e)) ? closeSidebar() : null;
|
const handleBlur = async e => (await isClickOutside(e)) ? closeSidebar() : null;
|
||||||
|
|
||||||
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SidebarButtonToggleStyle, {
|
return /*#__PURE__*/React.createElement("div", {
|
||||||
|
style: {
|
||||||
|
display: 'flex',
|
||||||
|
gap: '1rem',
|
||||||
|
alignItems: 'center'
|
||||||
|
}
|
||||||
|
}, /*#__PURE__*/React.createElement(SidebarButtonToggleStyle, {
|
||||||
onClick: () => openSidebar(),
|
onClick: () => openSidebar(),
|
||||||
title: "Open a Sidebar with Data Options"
|
title: "Open a Sidebar with Data Options"
|
||||||
}, "#"), /*#__PURE__*/React.createElement(SidebarStyle, {
|
}), /*#__PURE__*/React.createElement(DesignPreview, null), /*#__PURE__*/React.createElement(SidebarStyle, {
|
||||||
className: sidebarOpen ? 'active sidebar-active' : '',
|
className: sidebarOpen ? 'active sidebar-active' : '',
|
||||||
tabIndex: "0",
|
tabIndex: "0",
|
||||||
onBlur: handleBlur
|
onBlur: handleBlur
|
||||||
|
|||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"index.min.js","sources":["../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/react/index.js","../../../node_modules/scheduler/cjs/scheduler.production.min.js","../../../node_modules/scheduler/index.js","../../../node_modules/react-dom/cjs/react-dom.production.min.js","../../../node_modules/react-dom/index.js","../../../node_modules/react-dom/client.js","../../../node_modules/react-is/cjs/react-is.production.min.js","../../../node_modules/react-is/index.js","../../../node_modules/@emotion/stylis/dist/stylis.esm.js","../../../node_modules/@emotion/unitless/dist/unitless.esm.js","../../../node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../../node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js","../../../node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js","../../../node_modules/hoist-non-react-statics/node_modules/react-is/index.js","../../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../toolbar/responsive.style.js","../toolbar/responsive-button/responsive-button.style.js","../toolbar/responsive-button/ResponsiveButton.jsx","../toolbar/responsive.jsx","../toolbar/publish.jsx","../toolbar/data-options/data-options.style.js","../toolbar/data-options/DataOptions.jsx","../index.js"],"sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];c.children=f}if(a&&a.defaultProps)for(d in g=a.defaultProps,g)void 0===c[d]&&(c[d]=g[d]);return{$$typeof:l,type:a,key:k,ref:h,props:c,_owner:K.current}}\nfunction N(a,b){return{$$typeof:l,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===l}function escape(a){var b={\"=\":\"=0\",\":\":\"=2\"};return\"$\"+a.replace(/[=:]/g,function(a){return b[a]})}var P=/\\/+/g;function Q(a,b){return\"object\"===typeof a&&null!==a&&null!=a.key?escape(\"\"+a.key):b.toString(36)}\nfunction R(a,b,e,d,c){var k=typeof a;if(\"undefined\"===k||\"boolean\"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case \"string\":case \"number\":h=!0;break;case \"object\":switch(a.$$typeof){case l:case n:h=!0}}if(h)return h=a,c=c(h),a=\"\"===d?\".\"+Q(h,0):d,I(c)?(e=\"\",null!=a&&(e=a.replace(P,\"$&/\")+\"/\"),R(c,b,e,\"\",function(a){return a})):null!=c&&(O(c)&&(c=N(c,e+(!c.key||h&&h.key===c.key?\"\":(\"\"+c.key).replace(P,\"$&/\")+\"/\")+a)),b.push(c)),1;h=0;d=\"\"===d?\".\":d+\":\";if(I(a))for(var g=0;g<a.length;g++){k=\na[g];var f=d+Q(k,g);h+=R(k,b,e,f,c)}else if(f=A(a),\"function\"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=d+Q(k,g++),h+=R(k,b,e,f,c);else if(\"object\"===k)throw b=String(a),Error(\"Objects are not valid as a React child (found: \"+(\"[object Object]\"===b?\"object with keys {\"+Object.keys(a).join(\", \")+\"}\":b)+\"). If you meant to render a collection of children, use an array instead.\");return h}\nfunction S(a,b,e){if(null==a)return a;var d=[],c=0;R(a,d,\"\",\"\",function(a){return b.call(e,a,c++)});return d}function T(Line truncated
|
{"version":3,"file":"index.min.js","sources":["../../../node_modules/react/cjs/react.production.min.js","../../../node_modules/react/index.js","../../../node_modules/scheduler/cjs/scheduler.production.min.js","../../../node_modules/scheduler/index.js","../../../node_modules/react-dom/cjs/react-dom.production.min.js","../../../node_modules/react-dom/index.js","../../../node_modules/react-dom/client.js","../../../node_modules/react-is/cjs/react-is.production.min.js","../../../node_modules/react-is/index.js","../../../node_modules/@emotion/stylis/dist/stylis.esm.js","../../../node_modules/@emotion/unitless/dist/unitless.esm.js","../../../node_modules/@emotion/memoize/dist/emotion-memoize.esm.js","../../../node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js","../../../node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.production.min.js","../../../node_modules/hoist-non-react-statics/node_modules/react-is/index.js","../../../node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js","../toolbar/responsive.style.js","../toolbar/responsive-button/responsive-button.style.js","../toolbar/responsive-button/ResponsiveButton.jsx","../toolbar/responsive.jsx","../toolbar/publish.jsx","../toolbar/data-options/data-options.style.js","../toolbar/data-options/DesignPreview.jsx","../toolbar/data-options/DataOptions.jsx","../index.js"],"sourcesContent":["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1<g){for(var f=Array(g),m=0;m<g;m++)f[m]=arguments[m+2];c.children=f}if(a&&a.defaultProps)for(d in g=a.defaultProps,g)void 0===c[d]&&(c[d]=g[d]);return{$$typeof:l,type:a,key:k,ref:h,props:c,_owner:K.current}}\nfunction N(a,b){return{$$typeof:l,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===l}function escape(a){var b={\"=\":\"=0\",\":\":\"=2\"};return\"$\"+a.replace(/[=:]/g,function(a){return b[a]})}var P=/\\/+/g;function Q(a,b){return\"object\"===typeof a&&null!==a&&null!=a.key?escape(\"\"+a.key):b.toString(36)}\nfunction R(a,b,e,d,c){var k=typeof a;if(\"undefined\"===k||\"boolean\"===k)a=null;var h=!1;if(null===a)h=!0;else switch(k){case \"string\":case \"number\":h=!0;break;case \"object\":switch(a.$$typeof){case l:case n:h=!0}}if(h)return h=a,c=c(h),a=\"\"===d?\".\"+Q(h,0):d,I(c)?(e=\"\",null!=a&&(e=a.replace(P,\"$&/\")+\"/\"),R(c,b,e,\"\",function(a){return a})):null!=c&&(O(c)&&(c=N(c,e+(!c.key||h&&h.key===c.key?\"\":(\"\"+c.key).replace(P,\"$&/\")+\"/\")+a)),b.push(c)),1;h=0;d=\"\"===d?\".\":d+\":\";if(I(a))for(var g=0;g<a.length;g++){k=\na[g];var f=d+Q(k,g);h+=R(k,b,e,f,c)}else if(f=A(a),\"function\"===typeof f)for(a=f.call(a),g=0;!(k=a.next()).done;)k=k.value,f=d+Q(k,g++),h+=R(k,b,e,f,c);else if(\"object\"===k)throw b=String(a),Error(\"Objects are not valid as a React child (found: \"+(\"[object Object]\"===b?\"object with keys {\"+Object.keys(a).join(\", \")+\"}\":b)+\"). If you meant to render a collection of children, use an array instead.\");return h}\nfunction S(a,b,e){if(null==a)return a;var d=[],c=0;R(a,d,\"\",\"\",function(a){rLine truncated
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48" fill="#21252d">
|
||||||
|
<path
|
||||||
|
d="M9.5 43.05q-1.85 0-3.2-1.35t-1.35-3.2v-29q0-1.9 1.35-3.25T9.5 4.9h13.35v4.6H9.5v29h29V25.15h4.6V38.5q0 1.85-1.35 3.2t-3.25 1.35ZM20.3 30.9l-3.15-3.2 18.2-18.2h-9.5V4.9H43.1v17.25h-4.6V12.7Z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 294 B |
@@ -7,6 +7,7 @@ import {
|
|||||||
SidebarStyle,
|
SidebarStyle,
|
||||||
} from "./data-options.style.js";
|
} from "./data-options.style.js";
|
||||||
import {isClickOutside, isEscHit} from "../responsive-button/ResponsiveButton.jsx";
|
import {isClickOutside, isEscHit} from "../responsive-button/ResponsiveButton.jsx";
|
||||||
|
import {DesignPreview} from "./DesignPreview.jsx";
|
||||||
|
|
||||||
function DataOptions(props = {}) {
|
function DataOptions(props = {}) {
|
||||||
props.rootAttributes = props.rootAttributes ?? {};
|
props.rootAttributes = props.rootAttributes ?? {};
|
||||||
@@ -41,8 +42,9 @@ function DataOptions(props = {}) {
|
|||||||
|
|
||||||
const handleBlur = async (e) => await isClickOutside(e) ? closeSidebar() : null;
|
const handleBlur = async (e) => await isClickOutside(e) ? closeSidebar() : null;
|
||||||
|
|
||||||
return <>
|
return <div style={{display: 'flex', gap: '1rem', alignItems: 'center'}}>
|
||||||
<SidebarButtonToggleStyle onClick={() => openSidebar()} title="Open a Sidebar with Data Options">#</SidebarButtonToggleStyle>
|
<SidebarButtonToggleStyle onClick={() => openSidebar()} title="Open a Sidebar with Data Options"/>
|
||||||
|
<DesignPreview/>
|
||||||
|
|
||||||
<SidebarStyle className={sidebarOpen ? 'active sidebar-active' : ''} tabIndex='0' onBlur={handleBlur}>
|
<SidebarStyle className={sidebarOpen ? 'active sidebar-active' : ''} tabIndex='0' onBlur={handleBlur}>
|
||||||
<SidebarHeaderStyle>
|
<SidebarHeaderStyle>
|
||||||
@@ -66,7 +68,7 @@ function DataOptions(props = {}) {
|
|||||||
<pre>{JSON.stringify(state.data, null, 2)}</pre>
|
<pre>{JSON.stringify(state.data, null, 2)}</pre>
|
||||||
}
|
}
|
||||||
</SidebarStyle>
|
</SidebarStyle>
|
||||||
</>;
|
</div>;
|
||||||
|
|
||||||
function openSidebar() {
|
function openSidebar() {
|
||||||
setSidebarOpen(true);
|
setSidebarOpen(true);
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import React, {useCallback, useEffect, useState} from 'react';
|
||||||
|
|
||||||
|
export function DesignPreview(props = {}) {
|
||||||
|
return <span style={{color: '#999'}}>Preview</span>
|
||||||
|
}
|
||||||
@@ -94,7 +94,7 @@ body {
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.page_toolbar__right {
|
.page_toolbar__left, .page_toolbar__right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"sourceRoot":"","sources":["page--main.scss","_buttons.scss","_overlay.scss","_page--breakpoints.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;EACE;EACA;EAEA;;;ACTF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;;;ACtBJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AFIF;EACE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EAHF;IAII;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAKF;EADF;IAEI;;;AAKN;EACE;EACA;EACA;;;AGvEJ;EACE;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EAEA;EAEA;;AAEA;EACE;EAEA;EACA;EACA;;;AHyDJ;EACE;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA","file":"page--main.css"}
|
{"version":3,"sourceRoot":"","sources":["page--main.scss","_buttons.scss","_overlay.scss","_page--breakpoints.scss"],"names":[],"mappings":"AAAA;EACE;EACA;;;AAGF;EACE;EACA;EAEA;;;ACTF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AAEA;EACE;EACA;;AAGF;EACE;EACA;;;ACtBJ;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AFIF;EACE;EACA;EAEA;EACA;EACA;EAEA;EACA;EACA;;AAEA;EACE;EACA;EACA;EACA;;AAEA;EACE;;AAEA;EAHF;IAII;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AAKF;EADF;IAEI;;;AAKN;EAEE;EACA;EACA;;;AGxEJ;EACE;EACA;EACA;EAEA;EACA;EAEA;EACA;EACA;EAEA;EAEA;;AAEA;EACE;EAEA;EACA;EACA;;;AH0DJ;EACE;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA","file":"page--main.css"}
|
||||||
@@ -66,6 +66,7 @@ body {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__left,
|
||||||
&__right {
|
&__right {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|||||||
Generated
+18
@@ -29,6 +29,7 @@
|
|||||||
"mem-fs-editor": "^9.5.0",
|
"mem-fs-editor": "^9.5.0",
|
||||||
"mkdirp": "^1.0.4",
|
"mkdirp": "^1.0.4",
|
||||||
"node-fetch": "^3.2.10",
|
"node-fetch": "^3.2.10",
|
||||||
|
"node-stream-zip": "^1.15.0",
|
||||||
"open": "^8.4.0",
|
"open": "^8.4.0",
|
||||||
"sanitize-html": "^2.7.1",
|
"sanitize-html": "^2.7.1",
|
||||||
"sass": "^1.50.1",
|
"sass": "^1.50.1",
|
||||||
@@ -7948,6 +7949,18 @@
|
|||||||
"integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==",
|
"integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==",
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
|
"node_modules/node-stream-zip": {
|
||||||
|
"version": "1.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-stream-zip/-/node-stream-zip-1.15.0.tgz",
|
||||||
|
"integrity": "sha512-LN4fydt9TqhZhThkZIVQnF9cwjU3qmUH9h78Mx/K7d3VvfRqqwthLwJEUOEL0QPZ0XQmNN7be5Ggit5+4dq3Bw==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.12.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/antelle"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/nopt": {
|
"node_modules/nopt": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
|
||||||
@@ -18852,6 +18865,11 @@
|
|||||||
"integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==",
|
"integrity": "sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==",
|
||||||
"peer": true
|
"peer": true
|
||||||
},
|
},
|
||||||
|
"node-stream-zip": {
|
||||||
|
"version": "1.15.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/node-stream-zip/-/node-stream-zip-1.15.0.tgz",
|
||||||
|
"integrity": "sha512-LN4fydt9TqhZhThkZIVQnF9cwjU3qmUH9h78Mx/K7d3VvfRqqwthLwJEUOEL0QPZ0XQmNN7be5Ggit5+4dq3Bw=="
|
||||||
|
},
|
||||||
"nopt": {
|
"nopt": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz",
|
||||||
|
|||||||
+2
-2
@@ -39,10 +39,10 @@
|
|||||||
"mem-fs-editor": "^9.5.0",
|
"mem-fs-editor": "^9.5.0",
|
||||||
"mkdirp": "^1.0.4",
|
"mkdirp": "^1.0.4",
|
||||||
"node-fetch": "^3.2.10",
|
"node-fetch": "^3.2.10",
|
||||||
|
"node-stream-zip": "^1.15.0",
|
||||||
"open": "^8.4.0",
|
"open": "^8.4.0",
|
||||||
"sanitize-html": "^2.7.1",
|
"sanitize-html": "^2.7.1",
|
||||||
"sass": "^1.50.1",
|
"sass": "^1.50.1"
|
||||||
"unzipper": "^0.10.11"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/preset-react": "^7.18.6",
|
"@babel/preset-react": "^7.18.6",
|
||||||
|
|||||||
@@ -145,19 +145,40 @@ app.get('/publish', async (req, res) => {
|
|||||||
await fs.unlink('./dist.zip');
|
await fs.unlink('./dist.zip');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getListOfDesignPreviewFiles(jsonDataFileName, previewFiles) {
|
||||||
|
return previewFiles
|
||||||
|
.filter(fileName => {
|
||||||
|
return fileName.startsWith(jsonDataFileName + '.');
|
||||||
|
})
|
||||||
|
.map(fileName => {
|
||||||
|
const fileData = fileName.split('.');
|
||||||
|
const fileFormat = fileData.pop();
|
||||||
|
const previewSize = fileData.pop();
|
||||||
|
|
||||||
|
return {
|
||||||
|
dataSource: jsonDataFileName,
|
||||||
|
widthDimension: Number.parseInt(previewSize, 10),
|
||||||
|
url: `/preview/${fileName}`,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
app.get('/data', async (req, res) => {
|
app.get('/data', async (req, res) => {
|
||||||
let jsonDataFileName = req.query.name ? req.query.name : 'default';
|
let jsonDataFileName = req.query.name ? req.query.name : 'default';
|
||||||
const data = await getBlockConfigs(jsonDataFileName);
|
const data = await getBlockConfigs(jsonDataFileName);
|
||||||
|
|
||||||
const dataFiles = prepareListOfDataFiles(await fs.readdir('./data'));
|
const dataFiles = prepareListOfDataFiles(await fs.readdir('./data'));
|
||||||
|
const designPreviewFiles = getListOfDesignPreviewFiles(jsonDataFileName, await fs.readdir('./design/preview'));
|
||||||
|
|
||||||
return res.json({
|
return res.json({
|
||||||
dataOptions: dataFiles,
|
dataOptions: dataFiles,
|
||||||
|
designPreview: designPreviewFiles,
|
||||||
data,
|
data,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use(express.static('src'));
|
app.use(express.static('src'));
|
||||||
|
app.use(express.static('design'));
|
||||||
app.use(express.static(projectDir + 'layouts'));
|
app.use(express.static(projectDir + 'layouts'));
|
||||||
|
|
||||||
const listener = app.listen(0, async () => {
|
const listener = app.listen(0, async () => {
|
||||||
|
|||||||
Reference in new issue
Block a user