@torpor/view 0.1.4 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@torpor/view",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Torpor's view library, for writing and mounting components",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
@@ -18,20 +18,24 @@ const globalStyleRegex = /\:global\((.+)\)/;
18
18
  function buildStyleBlock(block: StyleBlock, b: Builder, styleHash: string) {
19
19
  // TODO: This should probably be done while parsing
20
20
  // And handle attribute selectors
21
- const selectors = block.selector
22
- .split(/([\s*,>+~])/)
23
- .filter((s) => !!s.trim())
24
- .map((s) => {
25
- if (s.length === 1 && "*,>+~".includes(s)) {
26
- return s;
27
- } else if (globalStyleRegex.test(s)) {
28
- return s.match(globalStyleRegex)![1];
29
- } else {
30
- return `${s}.torp-${styleHash}`;
31
- }
32
- });
33
-
34
- b.append(`${selectors.join(" ")} {`);
21
+ if (block.selector.startsWith("@")) {
22
+ // Just output media queries and properties as-is
23
+ b.append(`${block.selector} {`);
24
+ } else {
25
+ const selectors = block.selector
26
+ .split(/([\s*,>+~])/)
27
+ .filter((s) => !!s.trim())
28
+ .map((s) => {
29
+ if (s.length === 1 && "*,>+~".includes(s)) {
30
+ return s;
31
+ } else if (globalStyleRegex.test(s)) {
32
+ return s.match(globalStyleRegex)![1];
33
+ } else {
34
+ return `${s}.torp-${styleHash}`;
35
+ }
36
+ });
37
+ b.append(`${selectors.join(" ")} {`);
38
+ }
35
39
  for (let attribute of block.attributes) {
36
40
  buildStyleAttribute(attribute, b);
37
41
  }