@cubetool/plugin-cli-plus
Advanced tools
+60
-0
@@ -30,2 +30,58 @@ <!DOCTYPE html> | ||
| <script> | ||
| /** 临时 hack 响应式样式实现*/ | ||
| var _originAddCube = addCube; | ||
| let dynamicCubeCss = (() => { | ||
| let allWcss = {}; | ||
| let wcssStyle = document.createElement('style'); | ||
| wcssStyle.type = 'text/css'; | ||
| wcssStyle.id = 'cube-wcss-style'; | ||
| document.head.append(wcssStyle); | ||
| function updateCss(cssCode){ | ||
| wcssStyle.innerHTML = cssCode; | ||
| } | ||
| function updateStyle(width){ | ||
| let cssCode = ''; | ||
| for(let scope in allWcss){ | ||
| const [min, max] = scope.split(',').map(i => parseInt(i, 10)); | ||
| if(width >= min && width < max){ | ||
| const csses = allWcss[scope]; | ||
| csses.forEach(code => { | ||
| cssCode += code; | ||
| }); | ||
| } | ||
| } | ||
| updateCss(cssCode); | ||
| } | ||
| return { | ||
| addWcss(wcss){ | ||
| if(wcss && wcss.length){ | ||
| wcss.forEach(wcssData => { | ||
| const {scope, code} = wcssData; | ||
| if(!allWcss[scope]){ | ||
| allWcss[scope] = [] | ||
| } | ||
| allWcss[scope].push(code) | ||
| }) | ||
| } | ||
| }, | ||
| widthHandle(){ | ||
| document.getElementById('wrap-width').addEventListener('change', e => { | ||
| updateStyle(e.target.value); | ||
| }); | ||
| updateStyle(document.getElementById('wrap-width').value); | ||
| }, | ||
| } | ||
| })(); | ||
| var addCube = function(pkgid, data){ | ||
| dynamicCubeCss.addWcss(data.wcss) | ||
| _originAddCube(pkgid, data); | ||
| } | ||
| window.dynamicCubeCss = dynamicCubeCss; | ||
| </script> | ||
| <script> | ||
| const insertHttpProxyCtrl = function(wrap){ | ||
@@ -85,2 +141,6 @@ const tpl = ` | ||
| insertHttpProxyCtrl(document.querySelector('.cube-ctrl')); | ||
| // 动态 cube css 处理(临时处理) | ||
| dynamicCubeCss.widthHandle(); | ||
| return cool | ||
@@ -87,0 +147,0 @@ } |
+1
-1
| { | ||
| "name": "@cubetool/plugin-cli-plus", | ||
| "version": "2.0.0-beta.5", | ||
| "version": "2.0.0-beta.6", | ||
| "description": "开发者工具核心 CLI 功能增强插件", | ||
@@ -5,0 +5,0 @@ "author": "TTFE", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
23913
7.38%