@torpor/view 0.1.3 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torpor/view",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Torpor's view library, for writing and mounting components",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -1,4 +1,5 @@
1
1
  import { type TemplateNode } from "../types/nodes/TemplateNode";
2
+ import isComponentNode from "../types/nodes/isComponentNode";
2
3
  import isElementNode from "../types/nodes/isElementNode";
3
4
  import isParentNode from "../types/nodes/isParentNode";
4
5
  import { type StyleBlock } from "../types/styles/StyleBlock";
@@ -18,7 +19,7 @@ export default function scopeStyles(status: ParseStatus): void {
18
19
  }
19
20
 
20
21
  function scopeStylesOnNode(node: TemplateNode, selectors: string[]) {
21
- if (isElementNode(node)) {
22
+ if (isElementNode(node) || isComponentNode(node)) {
22
23
  let scopeStyles = selectors.includes(node.tagName);
23
24
  if (!scopeStyles) {
24
25
  for (let a of node.attributes) {
@@ -0,0 +1,6 @@
1
+ import { type ElementNode } from "./ElementNode";
2
+ import { type TemplateNode } from "./TemplateNode";
3
+
4
+ export default function isComponentNode(node: TemplateNode): node is ElementNode {
5
+ return node.type === "component";
6
+ }