defiant-builder
Advanced tools
Comparing version 1.6.7 to 1.6.8
@@ -166,2 +166,33 @@ | ||
const safeAnimDefScope = (id, css) => { | ||
let out = css | ||
let names = [] | ||
// capture all keyframe names | ||
out.replace(/@keyframes (\w[a-z-_]+) {/ig, (all, mmatch) => names.includes(mmatch) ? null : names.push(mmatch)) | ||
names = names.map(i => i.trim()) | ||
out = out.replace(/@keyframes (\w[a-z-_]+) \{/ig, `@keyframes ${id}-$1 {`) | ||
// replace all mixed animation-names | ||
out = out.replace(/animation:[a-z \d\D-,]*?;/mig, (all, mmatch) => { | ||
let str = all | ||
names.map(key => { | ||
let rx = new RegExp(key, "g") | ||
str = str.replace(rx, `${id}-${key}`) | ||
}) | ||
return str | ||
}) | ||
// replace all animation-names | ||
out = out.replace(/animation-name:[a-z \d\D-,]*?;/mig, (all, mmatch) => { | ||
let str = all | ||
names.map(key => { | ||
let rx = new RegExp(key, "g") | ||
str = str.replace(rx, `${id}-${key}`) | ||
}) | ||
return str | ||
}) | ||
return out | ||
} | ||
// ** Compiles styles (less files) | ||
@@ -181,5 +212,7 @@ const compileStyle = async (meta, appPath) => { | ||
if (cssFile && await FS.fileExists(filePath)) { | ||
data = await FS.readFile(filePath) | ||
toolbar_output = await less.render(`.ant-window_[data-id="${id}"] .win-toolbar_, .ant-window_[data-id="${id}"] .win-caption-toolbar_ {${data.toString()}}`, options) | ||
data = safeAnimDefScope(id, data.toString()) | ||
toolbar_output = await less.render(`.ant-window_[data-id="${id}"] .win-toolbar_, .ant-window_[data-id="${id}"] .win-caption-toolbar_ {${data}}`, options) | ||
toolbar_output = toolbar_output.css | ||
@@ -194,3 +227,4 @@ .replace(/(url\('?)\~/g, `$1/app/${namespace}/${id}`) | ||
data = await FS.readFile(filePath) | ||
statusbar_output = await less.render(`.ant-window_[data-id="${id}"] .win-status-bar_ {${data.toString()}}`, options) | ||
data = safeAnimDefScope(id, data.toString()) | ||
statusbar_output = await less.render(`.ant-window_[data-id="${id}"] .win-status-bar_ {${data}}`, options) | ||
statusbar_output = statusbar_output.css | ||
@@ -205,3 +239,4 @@ .replace(/(url\('?)\~/g, `$1/app/${namespace}/${id}`) | ||
data = await FS.readFile(filePath) | ||
dialog_output = await less.render(`.ant-window_[data-id="${id}"] .dialog_ {${data.toString()}}`, options) | ||
data = safeAnimDefScope(id, data.toString()) | ||
dialog_output = await less.render(`.ant-window_[data-id="${id}"] .dialog_ {${data}}`, options) | ||
dialog_output = dialog_output.css | ||
@@ -218,2 +253,3 @@ .replace(/(url\('?)\~/g, `$1/app/${namespace}/${id}`) | ||
data = data.toString().replace(/(@import ("|'))/g, `$1${dirPath}/`) | ||
data = safeAnimDefScope(id, data) | ||
winbody_output = await less.render(`.ant-window_[data-id="${id}"] ${isHeadless ? "": ".win-body_"} {${data}}`, options) | ||
@@ -224,2 +260,3 @@ winbody_output = winbody_output.css | ||
} | ||
return toolbar_output + winbody_output + statusbar_output + dialog_output | ||
@@ -226,0 +263,0 @@ } |
{ | ||
"name": "defiant-builder", | ||
"version": "1.6.7", | ||
"version": "1.6.8", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56598
555