@torpor/view 0.4.3 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/compile.cjs +9 -11
- package/dist/compile.cjs.map +1 -1
- package/dist/compile.js +9 -11
- package/dist/compile.js.map +1 -1
- package/package.json +1 -1
- package/src/compile/build/client/replaceForVarNames.ts +1 -1
- package/src/compile/parse/scopeStyles.ts +13 -12
package/dist/compile.js
CHANGED
|
@@ -681,7 +681,7 @@ function printDebug(varName, status, b) {}
|
|
|
681
681
|
* Variables used within a for loop need to be retrieved from the loop data.
|
|
682
682
|
*/
|
|
683
683
|
function replaceForVarNames(value, status) {
|
|
684
|
-
for (let varName of status.forVarNames) value = value.replaceAll(new RegExp(`(^|\\s|\\(|\\[|\\{|!)${varName[0]}($|\\s
|
|
684
|
+
for (let varName of status.forVarNames) value = value.replaceAll(new RegExp(`(^|\\s|\\(|\\[|\\{|!)${varName[0]}($|\\s|\\.|,|\\(|\\)|\\[|\\]|\\}|;)`, "g"), `$1${varName[1]}$2`);
|
|
685
685
|
return value;
|
|
686
686
|
}
|
|
687
687
|
|
|
@@ -3362,16 +3362,14 @@ function scopeStyles(status) {
|
|
|
3362
3362
|
}
|
|
3363
3363
|
}
|
|
3364
3364
|
function scopeStylesOnNode(node, selectors) {
|
|
3365
|
-
if (isElementNode(node) || isComponentNode(node)) {
|
|
3366
|
-
|
|
3367
|
-
if (
|
|
3368
|
-
if (
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
node.scopeStyles = scopeStyles$1;
|
|
3374
|
-
}
|
|
3365
|
+
if (isElementNode(node) || isComponentNode(node)) node.scopeStyles = selectors.includes(node.tagName) || node.attributes.find((a) => {
|
|
3366
|
+
if (a.name === "class" && a.reactive) return true;
|
|
3367
|
+
else if (a.name === "id" && a.value) {
|
|
3368
|
+
if (selectors.includes(`#${trimQuotes(a.value)}`)) return true;
|
|
3369
|
+
} else if (a.name === "class" && a.value) {
|
|
3370
|
+
for (let classname of trimQuotes(a.value).split(/\s+/)) if (selectors.includes(`.${classname}`)) return true;
|
|
3371
|
+
}
|
|
3372
|
+
}) !== void 0;
|
|
3375
3373
|
if (isParentNode(node)) for (let child of node.children) scopeStylesOnNode(child, selectors);
|
|
3376
3374
|
}
|
|
3377
3375
|
function collectStyleSelectors(block, selectors) {
|