windows-watch #4
@@ -1,4 +1,4 @@
|
|||||||
<script src="/scripts/frame-index.js"></script>
|
<script src="/scripts/dist/frame-index.min.js"></script>
|
||||||
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
|
||||||
<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>{{#if config.jsUrl }}
|
<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>{{#if config.jsUrl }}
|
||||||
{{#each config.jsUrl }}<script src="{{ this }}"></script>
|
{{#each config.jsUrl }}<script src="{{ this }}"></script>
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
!function(){let e;const t=2*window.outerHeight;function n(n){const o=document.querySelector("body > main").scrollHeight;if(e===o||o>t)return;e=o,window.parent.postMessage("resize:"+JSON.stringify({height:e}),"*")}n(),new ResizeObserver(n).observe(document.body)}();
|
||||||
Vendored
+15
-9821
File diff suppressed because one or more lines are too long
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="48" width="48" fill="#21252d">
|
||||||
|
<path
|
||||||
|
d="M24 45.25q-4.35 0-8.225-1.675T9 39q-2.9-2.9-4.575-6.775Q2.75 28.35 2.75 24q0-4.5 1.675-8.375t4.625-6.75Q12 6 15.95 4.35q3.95-1.65 8.4-1.65 4.2 0 8 1.425t6.675 3.95Q41.9 10.6 43.6 14.05q1.7 3.45 1.7 7.5 0 5.7-3.2 9.35-3.2 3.65-8.9 3.65h-2.9q-.8 0-1.4.65-.6.65-.6 1.45 0 1.25.5 1.75t.5 1.55q0 2.2-1.5 3.75-1.5 1.55-3.8 1.55ZM24 24Zm-11.2 1.3q1 0 1.75-.75t.75-1.75q0-1-.75-1.75t-1.75-.75q-1 0-1.75.75t-.75 1.75q0 1 .75 1.75t1.75.75Zm6.1-8.15q1 0 1.75-.75t.75-1.75q0-1.05-.75-1.775-.75-.725-1.75-.725-1.05 0-1.775.725-.725.725-.725 1.725 0 1.05.725 1.8t1.775.75Zm10.25 0q1 0 1.75-.75t.75-1.75q0-1.05-.75-1.775-.75-.725-1.75-.725-1.05 0-1.775.725-.725.725-.725 1.725 0 1.05.725 1.8t1.775.75Zm6.2 8.15q1 0 1.75-.75t.75-1.75q0-1-.75-1.75t-1.75-.75q-1.05 0-1.775.75-.725.75-.725 1.75t.725 1.75q.725.75 1.775.75ZM23.8 40.55q.4 0 .6-.175.2-.175.2-.625 0-.7-.75-1.175-.75-.475-.75-2.375 0-2.45 1.65-4.4 1.65-1.95 4.1-1.95h4.35q3.7 0 5.525-2.2 1.825-2.2 1.825-5.8 0-6.6-4.925-10.5Q30.7 7.45 24.4 7.45q-7.1 0-12.025 4.825Q7.45 17.1 7.45 24q0 6.9 4.8 11.725 4.8 4.825 11.55 4.825Z"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.1 KiB |
@@ -1,27 +0,0 @@
|
|||||||
'use strict';
|
|
||||||
|
|
||||||
const heightLimit = window.outerHeight * 2;
|
|
||||||
let height = getCurrentHeight();
|
|
||||||
setupResizeListener();
|
|
||||||
|
|
||||||
///
|
|
||||||
|
|
||||||
function setupResizeListener() {
|
|
||||||
const resizeObserver = new ResizeObserver(handleHeightChange);
|
|
||||||
resizeObserver.observe(document.body);
|
|
||||||
}
|
|
||||||
|
|
||||||
function handleHeightChange(entries) {
|
|
||||||
const updatedHeight = getCurrentHeight();
|
|
||||||
if (height === updatedHeight || updatedHeight > heightLimit) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const RESIZE_CODE = 'resize:';
|
|
||||||
window.parent.postMessage(RESIZE_CODE + JSON.stringify({height}), '*');
|
|
||||||
height = updatedHeight;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCurrentHeight() {
|
|
||||||
return document.querySelector('body > main').scrollHeight;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
export function setupFrameResizeListener() {
|
||||||
|
const previewFrame = getPreviewFrame();
|
||||||
|
|
||||||
|
window.addEventListener('message', function (e) {
|
||||||
|
const RESIZE_CODE = 'resize:';
|
||||||
|
if (typeof e.data !== 'string' || !e.data.startsWith(RESIZE_CODE)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = JSON.parse(e.data.substring(RESIZE_CODE.length))
|
||||||
|
previewFrame.style.height = data.height + 'px'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getPreviewFrame() {
|
||||||
|
return document.getElementById('preview_frame');
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
// Scrollbars / Frame resizes notifications.
|
||||||
|
(function () {
|
||||||
|
let height;
|
||||||
|
const heightLimit = window.outerHeight * 2;
|
||||||
|
|
||||||
|
handleHeightChange(); // Initial frame's height setup.
|
||||||
|
setupResizeListener(); // Listen to frame's height changes.
|
||||||
|
|
||||||
|
///
|
||||||
|
|
||||||
|
function setupResizeListener() {
|
||||||
|
const resizeObserver = new ResizeObserver(handleHeightChange);
|
||||||
|
resizeObserver.observe(document.body);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleHeightChange(entries) {
|
||||||
|
const updatedHeight = getCurrentHeight();
|
||||||
|
if (height === updatedHeight || updatedHeight > heightLimit) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const RESIZE_CODE = 'resize:';
|
||||||
|
height = updatedHeight;
|
||||||
|
window.parent.postMessage(RESIZE_CODE + JSON.stringify({height}), '*');
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCurrentHeight() {
|
||||||
|
return document.querySelector('body > main').scrollHeight;
|
||||||
|
}
|
||||||
|
})();
|
||||||
@@ -3,22 +3,13 @@
|
|||||||
import {setupResponsiveness} from './toolbar/responsive.jsx';
|
import {setupResponsiveness} from './toolbar/responsive.jsx';
|
||||||
import {setupPublish} from "./toolbar/publish.jsx";
|
import {setupPublish} from "./toolbar/publish.jsx";
|
||||||
import {setupDataOptions} from "./toolbar/data-options/DataOptions.jsx";
|
import {setupDataOptions} from "./toolbar/data-options/DataOptions.jsx";
|
||||||
|
import {getPreviewFrame, setupFrameResizeListener} from "./frame/editor.js";
|
||||||
|
|
||||||
const previewFrame = document.getElementById('preview_frame');
|
|
||||||
const rootAttributes = {
|
const rootAttributes = {
|
||||||
previewFrame,
|
previewFrame: getPreviewFrame(),
|
||||||
}
|
};
|
||||||
|
|
||||||
|
setupFrameResizeListener();
|
||||||
setupResponsiveness(rootAttributes);
|
setupResponsiveness(rootAttributes);
|
||||||
setupDataOptions(rootAttributes);
|
setupDataOptions(rootAttributes);
|
||||||
setupPublish(rootAttributes)
|
setupPublish(rootAttributes);
|
||||||
|
|
||||||
window.addEventListener('message', function (e) {
|
|
||||||
const RESIZE_CODE = 'resize:';
|
|
||||||
if (typeof e.data !== 'string' || !e.data.startsWith(RESIZE_CODE)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const data = JSON.parse(e.data.substring(RESIZE_CODE.length))
|
|
||||||
previewFrame.style.height = data.height + 'px';
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {useEffect, useState} from 'react';
|
import React, {useState} from 'react';
|
||||||
import * as ReactDOM from 'react-dom/client';
|
import * as ReactDOM from 'react-dom/client';
|
||||||
|
|
||||||
function Publish(props = {}) {
|
function Publish(props = {}) {
|
||||||
|
|||||||
Generated
+240
@@ -50,6 +50,7 @@
|
|||||||
"rollup": "^2.77.2",
|
"rollup": "^2.77.2",
|
||||||
"rollup-plugin-copy": "^3.4.0",
|
"rollup-plugin-copy": "^3.4.0",
|
||||||
"rollup-plugin-jsx": "^1.0.3",
|
"rollup-plugin-jsx": "^1.0.3",
|
||||||
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"styled-components": "^5.3.5"
|
"styled-components": "^5.3.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -602,6 +603,30 @@
|
|||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@jridgewell/source-map": {
|
||||||
|
"version": "0.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
|
||||||
|
"integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@jridgewell/gen-mapping": "^0.3.0",
|
||||||
|
"@jridgewell/trace-mapping": "^0.3.9"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@jridgewell/source-map/node_modules/@jridgewell/gen-mapping": {
|
||||||
|
"version": "0.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
|
||||||
|
"integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@jridgewell/set-array": "^1.0.1",
|
||||||
|
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||||
|
"@jridgewell/trace-mapping": "^0.3.9"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@jridgewell/sourcemap-codec": {
|
"node_modules/@jridgewell/sourcemap-codec": {
|
||||||
"version": "1.4.14",
|
"version": "1.4.14",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||||
@@ -5621,6 +5646,41 @@
|
|||||||
"node": ">=8"
|
"node": ">=8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/jest-worker": {
|
||||||
|
"version": "26.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz",
|
||||||
|
"integrity": "sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@types/node": "*",
|
||||||
|
"merge-stream": "^2.0.0",
|
||||||
|
"supports-color": "^7.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 10.13.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/jest-worker/node_modules/has-flag": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||||
|
"dev": true,
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/jest-worker/node_modules/supports-color": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"has-flag": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/js-tokens": {
|
"node_modules/js-tokens": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
@@ -6461,6 +6521,12 @@
|
|||||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||||
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
|
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
|
||||||
},
|
},
|
||||||
|
"node_modules/merge-stream": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"node_modules/merge2": {
|
"node_modules/merge2": {
|
||||||
"version": "1.4.1",
|
"version": "1.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
||||||
@@ -8077,6 +8143,30 @@
|
|||||||
"vlq": "^0.2.1"
|
"vlq": "^0.2.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/rollup-plugin-terser": {
|
||||||
|
"version": "7.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz",
|
||||||
|
"integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@babel/code-frame": "^7.10.4",
|
||||||
|
"jest-worker": "^26.2.1",
|
||||||
|
"serialize-javascript": "^4.0.0",
|
||||||
|
"terser": "^5.0.0"
|
||||||
|
},
|
||||||
|
"peerDependencies": {
|
||||||
|
"rollup": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/rollup-plugin-terser/node_modules/serialize-javascript": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"randombytes": "^2.1.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/rollup-pluginutils": {
|
"node_modules/rollup-pluginutils": {
|
||||||
"version": "1.5.2",
|
"version": "1.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz",
|
||||||
@@ -8766,6 +8856,16 @@
|
|||||||
"decode-uri-component": "^0.2.0"
|
"decode-uri-component": "^0.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/source-map-support": {
|
||||||
|
"version": "0.5.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||||
|
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"buffer-from": "^1.0.0",
|
||||||
|
"source-map": "^0.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/source-map-url": {
|
"node_modules/source-map-url": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz",
|
||||||
@@ -9116,6 +9216,36 @@
|
|||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/terser": {
|
||||||
|
"version": "5.15.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/terser/-/terser-5.15.1.tgz",
|
||||||
|
"integrity": "sha512-K1faMUvpm/FBxjBXud0LWVAGxmvoPbZbfTCYbSgaaYQaIXI3/TdI7a7ZGA73Zrou6Q8Zmz3oeUTsp/dj+ag2Xw==",
|
||||||
|
"dev": true,
|
||||||
|
"dependencies": {
|
||||||
|
"@jridgewell/source-map": "^0.3.2",
|
||||||
|
"acorn": "^8.5.0",
|
||||||
|
"commander": "^2.20.0",
|
||||||
|
"source-map-support": "~0.5.20"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"terser": "bin/terser"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/terser/node_modules/acorn": {
|
||||||
|
"version": "8.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz",
|
||||||
|
"integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==",
|
||||||
|
"dev": true,
|
||||||
|
"bin": {
|
||||||
|
"acorn": "bin/acorn"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/textextensions": {
|
"node_modules/textextensions": {
|
||||||
"version": "5.15.0",
|
"version": "5.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/textextensions/-/textextensions-5.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/textextensions/-/textextensions-5.15.0.tgz",
|
||||||
@@ -10419,6 +10549,29 @@
|
|||||||
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz",
|
||||||
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw=="
|
"integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw=="
|
||||||
},
|
},
|
||||||
|
"@jridgewell/source-map": {
|
||||||
|
"version": "0.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jridgewell/source-map/-/source-map-0.3.2.tgz",
|
||||||
|
"integrity": "sha512-m7O9o2uR8k2ObDysZYzdfhb08VuEml5oWGiosa1VdaPZ/A6QyPkAJuwN0Q1lhULOf6B7MtQmHENS743hWtCrgw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@jridgewell/gen-mapping": "^0.3.0",
|
||||||
|
"@jridgewell/trace-mapping": "^0.3.9"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@jridgewell/gen-mapping": {
|
||||||
|
"version": "0.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz",
|
||||||
|
"integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@jridgewell/set-array": "^1.0.1",
|
||||||
|
"@jridgewell/sourcemap-codec": "^1.4.10",
|
||||||
|
"@jridgewell/trace-mapping": "^0.3.9"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"@jridgewell/sourcemap-codec": {
|
"@jridgewell/sourcemap-codec": {
|
||||||
"version": "1.4.14",
|
"version": "1.4.14",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz",
|
||||||
@@ -14352,6 +14505,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"jest-worker": {
|
||||||
|
"version": "26.6.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz",
|
||||||
|
"integrity": "sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*",
|
||||||
|
"merge-stream": "^2.0.0",
|
||||||
|
"supports-color": "^7.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"has-flag": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"supports-color": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"has-flag": "^4.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"js-tokens": {
|
"js-tokens": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
|
||||||
@@ -15016,6 +15197,12 @@
|
|||||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||||
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
|
"integrity": "sha512-cCi6g3/Zr1iqQi6ySbseM1Xvooa98N0w31jzUYrXPX2xqObmFGHJ0tQ5u74H3mVh7wLouTseZyYIq39g8cNp1w=="
|
||||||
},
|
},
|
||||||
|
"merge-stream": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"merge2": {
|
"merge2": {
|
||||||
"version": "1.4.1",
|
"version": "1.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
|
||||||
@@ -16221,6 +16408,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"rollup-plugin-terser": {
|
||||||
|
"version": "7.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz",
|
||||||
|
"integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@babel/code-frame": "^7.10.4",
|
||||||
|
"jest-worker": "^26.2.1",
|
||||||
|
"serialize-javascript": "^4.0.0",
|
||||||
|
"terser": "^5.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"serialize-javascript": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"randombytes": "^2.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"rollup-pluginutils": {
|
"rollup-pluginutils": {
|
||||||
"version": "1.5.2",
|
"version": "1.5.2",
|
||||||
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz",
|
"resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz",
|
||||||
@@ -16777,6 +16987,16 @@
|
|||||||
"decode-uri-component": "^0.2.0"
|
"decode-uri-component": "^0.2.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"source-map-support": {
|
||||||
|
"version": "0.5.21",
|
||||||
|
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
|
||||||
|
"integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"buffer-from": "^1.0.0",
|
||||||
|
"source-map": "^0.6.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"source-map-url": {
|
"source-map-url": {
|
||||||
"version": "0.4.1",
|
"version": "0.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz",
|
"resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz",
|
||||||
@@ -17041,6 +17261,26 @@
|
|||||||
"readable-stream": "^3.1.1"
|
"readable-stream": "^3.1.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"terser": {
|
||||||
|
"version": "5.15.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/terser/-/terser-5.15.1.tgz",
|
||||||
|
"integrity": "sha512-K1faMUvpm/FBxjBXud0LWVAGxmvoPbZbfTCYbSgaaYQaIXI3/TdI7a7ZGA73Zrou6Q8Zmz3oeUTsp/dj+ag2Xw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@jridgewell/source-map": "^0.3.2",
|
||||||
|
"acorn": "^8.5.0",
|
||||||
|
"commander": "^2.20.0",
|
||||||
|
"source-map-support": "~0.5.20"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"acorn": {
|
||||||
|
"version": "8.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.1.tgz",
|
||||||
|
"integrity": "sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==",
|
||||||
|
"dev": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"textextensions": {
|
"textextensions": {
|
||||||
"version": "5.15.0",
|
"version": "5.15.0",
|
||||||
"resolved": "https://registry.npmjs.org/textextensions/-/textextensions-5.15.0.tgz",
|
"resolved": "https://registry.npmjs.org/textextensions/-/textextensions-5.15.0.tgz",
|
||||||
|
|||||||
+7
-4
@@ -8,11 +8,11 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "component-dev",
|
"start": "component-dev",
|
||||||
"dev": "NODE_ENV=development NODE_CONFIG_DIR=blocks/header/config BLOCK_NAME=header node server.js",
|
"dev": "NODE_ENV=development NODE_CONFIG_DIR=blocks/text-block/config BLOCK_NAME=text-block node server.js",
|
||||||
"build": "rollup --config rollup.config.js",
|
"build": "rollup --config rollup.config.js",
|
||||||
"build-platform": "NODE_ENV=development NODE_CONFIG_DIR=blocks/header/config BLOCK_NAME=header node ./build.js",
|
"build-platform": "NODE_ENV=development NODE_CONFIG_DIR=blocks/text-block/config BLOCK_NAME=text-block node ./build.js",
|
||||||
"build-platform-cli": "component-build",
|
"build-platform-cli": "component-build",
|
||||||
"dev-js": "rollup --config rollup.config.js --watch"
|
"dev-js": "NODE_ENV=development rollup --config rollup.config.js --watch"
|
||||||
},
|
},
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
@@ -54,6 +54,7 @@
|
|||||||
"rollup": "^2.77.2",
|
"rollup": "^2.77.2",
|
||||||
"rollup-plugin-copy": "^3.4.0",
|
"rollup-plugin-copy": "^3.4.0",
|
||||||
"rollup-plugin-jsx": "^1.0.3",
|
"rollup-plugin-jsx": "^1.0.3",
|
||||||
|
"rollup-plugin-terser": "^7.0.2",
|
||||||
"styled-components": "^5.3.5"
|
"styled-components": "^5.3.5"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -62,7 +63,9 @@
|
|||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"helpers.js",
|
"helpers.js",
|
||||||
"layouts/**/*",
|
"layouts/*.hbs",
|
||||||
|
"layouts/styles/*.css*",
|
||||||
|
"layouts/scripts/dist/*.js*",
|
||||||
"platforms/**/*"
|
"platforms/**/*"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-5
@@ -3,13 +3,17 @@ import {nodeResolve} from '@rollup/plugin-node-resolve';
|
|||||||
import commonjs from '@rollup/plugin-commonjs';
|
import commonjs from '@rollup/plugin-commonjs';
|
||||||
import replace from '@rollup/plugin-replace';
|
import replace from '@rollup/plugin-replace';
|
||||||
import css from "@modular-css/rollup";
|
import css from "@modular-css/rollup";
|
||||||
import copy from 'rollup-plugin-copy'
|
import copy from 'rollup-plugin-copy';
|
||||||
|
import {terser} from "rollup-plugin-terser";
|
||||||
|
|
||||||
export default {
|
const devMode = (process.env.NODE_ENV === 'development');
|
||||||
|
console.log('Build Mode', devMode ? 'Development' : 'Production');
|
||||||
|
|
||||||
|
export default [{
|
||||||
input: 'layouts/scripts/index.js',
|
input: 'layouts/scripts/index.js',
|
||||||
output: {
|
output: {
|
||||||
file: 'layouts/scripts/dist/index.min.js',
|
file: 'layouts/scripts/dist/index.min.js',
|
||||||
sourcemap: true
|
sourcemap: devMode,
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
nodeResolve({
|
nodeResolve({
|
||||||
@@ -26,10 +30,21 @@ export default {
|
|||||||
presets: ["@babel/preset-react"],
|
presets: ["@babel/preset-react"],
|
||||||
}),
|
}),
|
||||||
commonjs(),
|
commonjs(),
|
||||||
|
!devMode && terser(),
|
||||||
copy({
|
copy({
|
||||||
targets: [
|
targets: [
|
||||||
{ src: 'layouts/scripts/toolbar/images/**/*', dest: 'layouts/scripts/dist/toolbar/images' }
|
{src: 'layouts/scripts/toolbar/images/**/*', dest: 'layouts/scripts/dist/toolbar/images'}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
}
|
}, {
|
||||||
|
input: 'layouts/scripts/frame/frame.js',
|
||||||
|
output: {
|
||||||
|
file: 'layouts/scripts/dist/frame-index.min.js',
|
||||||
|
sourcemap: devMode
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
commonjs(),
|
||||||
|
!devMode && terser()
|
||||||
|
]
|
||||||
|
}];
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ const {isDev, modulesPath, projectPath, developmentBlockName} = getConfigs();
|
|||||||
const blocksRegistry = isDev ? 'http://localhost:3020' : PRODUCTION_REGISTRY_URL;
|
const blocksRegistry = isDev ? 'http://localhost:3020' : PRODUCTION_REGISTRY_URL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init server
|
* Init server
|
||||||
*/
|
*/
|
||||||
@@ -222,7 +221,7 @@ function startBrowserSync() {
|
|||||||
return cb();
|
return cb();
|
||||||
}]));
|
}]));
|
||||||
|
|
||||||
gulp.watch(path.join(projectPath, 'src/**/*.scss'), {delay: 400}, gulp.series(['build-styling-files', function (cb) {
|
gulp.watch(path.posix.join(projectPath, "src/**/*.scss"), {delay: 400}, gulp.series(['build-styling-files', function (cb) {
|
||||||
browserSyncReload(bs, 'css', 'Style Files Change');
|
browserSyncReload(bs, 'css', 'Style Files Change');
|
||||||
return cb();
|
return cb();
|
||||||
}]));
|
}]));
|
||||||
@@ -276,12 +275,12 @@ function browserSyncReload(bs, extension = '', message = '') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getJSBundleFiles() {
|
function getJSBundleFiles() {
|
||||||
return [path.join(projectPath, 'src/**/*.js'), path.join(projectPath, 'src/**/*.mjs'), '!' + path.join(projectPath, 'src/**/*.min.js')];
|
return [path.posix.join(projectPath, "src/**/*.js"), path.posix.join(projectPath, "src/**/*.mjs"), "!" + path.posix.join(projectPath, "src/**/*.min.js")];
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildScriptFiles(done) {
|
function buildScriptFiles(done) {
|
||||||
const files = getJSBundleFiles();
|
const files = getJSBundleFiles();
|
||||||
return gulp.src(files)
|
return gulp.src(files, {base: path.posix.join(projectPath, 'src')})
|
||||||
.pipe(sourcemaps.init({}))
|
.pipe(sourcemaps.init({}))
|
||||||
.pipe(babel()).on('error', function (error) {
|
.pipe(babel()).on('error', function (error) {
|
||||||
showError(new PluginError('JavaScript', error).toString());
|
showError(new PluginError('JavaScript', error).toString());
|
||||||
@@ -292,11 +291,11 @@ function buildScriptFiles(done) {
|
|||||||
.pipe(uglify())
|
.pipe(uglify())
|
||||||
.pipe(rename({extname: '.min.js'}))
|
.pipe(rename({extname: '.min.js'}))
|
||||||
.pipe(sourcemaps.write('.'))
|
.pipe(sourcemaps.write('.'))
|
||||||
.pipe(gulp.dest(path.join(projectPath, 'src/')));
|
.pipe(gulp.dest(path.posix.join(projectPath, 'src')));
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildStyleFiles(done) {
|
function buildStyleFiles(done) {
|
||||||
return gulp.src(path.join(projectPath, 'src/**/*.scss'))
|
return gulp.src(path.join(projectPath, 'src/**/*.scss'), {base: path.posix.join(projectPath, 'src')})
|
||||||
.pipe(sourcemaps.init({}))
|
.pipe(sourcemaps.init({}))
|
||||||
.pipe(sass.sync({outputStyle: 'compressed'}).on('error', function (error) {
|
.pipe(sass.sync({outputStyle: 'compressed'}).on('error', function (error) {
|
||||||
showError(new PluginError('SCSS', error.messageFormatted).toString());
|
showError(new PluginError('SCSS', error.messageFormatted).toString());
|
||||||
@@ -306,7 +305,7 @@ function buildStyleFiles(done) {
|
|||||||
// .pipe(gulp.dest('src/'))
|
// .pipe(gulp.dest('src/'))
|
||||||
.pipe(rename({extname: '.min.css'}))
|
.pipe(rename({extname: '.min.css'}))
|
||||||
.pipe(sourcemaps.write('.', {}))
|
.pipe(sourcemaps.write('.', {}))
|
||||||
.pipe(gulp.dest(path.join(projectPath, 'src')))
|
.pipe(gulp.dest(path.posix.join(projectPath, 'src')))
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildAssetFiles() {
|
function buildAssetFiles() {
|
||||||
@@ -379,7 +378,7 @@ async function zipProject() {
|
|||||||
archive.pipe(output);
|
archive.pipe(output);
|
||||||
|
|
||||||
// append files from a subdirectory, putting its contents at the root of archive
|
// append files from a subdirectory, putting its contents at the root of archive
|
||||||
archive.directory(path.join(projectPath, 'src', '/'), false);
|
archive.directory(path.join(projectPath, 'src'), false);
|
||||||
|
|
||||||
// finalize the archive (ie we are done appending files but streams have to finish yet)
|
// finalize the archive (ie we are done appending files but streams have to finish yet)
|
||||||
// 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand
|
// 'close', 'end' or 'finish' may be fired right after calling this method so register to them beforehand
|
||||||
|
|||||||
Reference in New Issue
Block a user