@torpor/view 0.0.11 → 0.0.13

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.
Files changed (174) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/{ServerSlotRender-AWF3bD5B.d.cts → ServerSlotRender-t1sOutne.d.cts} +1 -1
  3. package/dist/{ServerSlotRender-AWF3bD5B.d.ts → ServerSlotRender-t1sOutne.d.ts} +1 -1
  4. package/dist/{chunk-GO2L324Q.js → chunk-T6JGCJ5T.js} +5 -2
  5. package/dist/chunk-T6JGCJ5T.js.map +1 -0
  6. package/dist/compile.cjs +42 -31
  7. package/dist/compile.cjs.map +1 -1
  8. package/dist/compile.d.cts +1 -0
  9. package/dist/compile.d.ts +1 -0
  10. package/dist/compile.js +42 -31
  11. package/dist/compile.js.map +1 -1
  12. package/dist/index.cjs +4 -1
  13. package/dist/index.cjs.map +1 -1
  14. package/dist/index.d.cts +2 -2
  15. package/dist/index.d.ts +2 -2
  16. package/dist/index.js +1 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/metafile-cjs.json +1 -1
  19. package/dist/metafile-esm.json +1 -1
  20. package/dist/ssr.cjs +4 -1
  21. package/dist/ssr.cjs.map +1 -1
  22. package/dist/ssr.d.cts +2 -2
  23. package/dist/ssr.d.ts +2 -2
  24. package/dist/ssr.js +1 -1
  25. package/dist/ssr.js.map +1 -1
  26. package/package.json +6 -6
  27. package/scripts/buildTestOutput.ts +2 -121
  28. package/src/compile/build/client/buildAddFragment.ts +1 -1
  29. package/src/compile/build/client/buildAwaitNode.ts +1 -1
  30. package/src/compile/build/client/buildComponentNode.ts +1 -1
  31. package/src/compile/build/client/buildControlNode.ts +1 -1
  32. package/src/compile/build/client/buildElementNode.ts +7 -1
  33. package/src/compile/build/client/buildForNode.ts +1 -1
  34. package/src/compile/build/client/buildFragment.ts +1 -1
  35. package/src/compile/build/client/buildFragmentText.ts +7 -1
  36. package/src/compile/build/client/buildHeadNode.ts +1 -1
  37. package/src/compile/build/client/buildHtmlNode.ts +1 -1
  38. package/src/compile/build/client/buildIfNode.ts +1 -1
  39. package/src/compile/build/client/buildMount.ts +1 -1
  40. package/src/compile/build/client/buildNode.ts +1 -1
  41. package/src/compile/build/client/buildReplaceNode.ts +1 -1
  42. package/src/compile/build/client/buildRootNode.ts +1 -1
  43. package/src/compile/build/client/buildRun.ts +1 -1
  44. package/src/compile/build/client/buildScriptNode.ts +1 -1
  45. package/src/compile/build/client/buildSlotNode.ts +1 -1
  46. package/src/compile/build/client/buildSwitchNode.ts +1 -1
  47. package/src/compile/build/client/buildTextNode.ts +1 -1
  48. package/src/compile/build/client/replaceForVarNames.ts +1 -1
  49. package/src/compile/build/server/buildServerAwaitNode.ts +1 -1
  50. package/src/compile/build/server/buildServerComponentNode.ts +1 -1
  51. package/src/compile/build/server/buildServerControlNode.ts +1 -1
  52. package/src/compile/build/server/buildServerElementNode.ts +9 -1
  53. package/src/compile/build/server/buildServerForNode.ts +1 -1
  54. package/src/compile/build/server/buildServerHtmlNode.ts +1 -1
  55. package/src/compile/build/server/buildServerIfNode.ts +1 -1
  56. package/src/compile/build/server/buildServerNode.ts +5 -1
  57. package/src/compile/build/server/buildServerReplaceNode.ts +1 -1
  58. package/src/compile/build/server/buildServerRootNode.ts +5 -1
  59. package/src/compile/build/server/buildServerScriptNode.ts +1 -1
  60. package/src/compile/build/server/buildServerSlotNode.ts +1 -1
  61. package/src/compile/build/server/buildServerSpecialNode.ts +1 -1
  62. package/src/compile/build/server/buildServerSwitchNode.ts +1 -1
  63. package/src/compile/build/server/buildServerTextNode.ts +1 -1
  64. package/src/compile/build/utils/isFullyReactive.ts +1 -1
  65. package/src/compile/build/utils/isReactive.ts +1 -1
  66. package/src/compile/build/utils/isReactiveAttribute.ts +1 -1
  67. package/src/compile/parse/addSpaceElement.ts +4 -1
  68. package/src/compile/parse/parseCode.ts +4 -0
  69. package/src/compile/parse/parseControl.ts +4 -1
  70. package/src/compile/parse/parseImports.ts +1 -1
  71. package/src/compile/parse/parseMarkup.ts +1 -1
  72. package/src/compile/parse/parseStyles.ts +1 -1
  73. package/src/compile/parse/scopeStyles.ts +13 -21
  74. package/src/compile/parse/slottifyChildNodes.ts +1 -1
  75. package/src/compile/parse/utils/addError.ts +5 -1
  76. package/src/compile/parse/utils/consumeUntil.ts +1 -1
  77. package/src/compile/parse/utils/isAlphaNumeric.ts +1 -1
  78. package/src/compile/parse/utils/isAlphaNumericChar.ts +1 -1
  79. package/src/compile/parse/utils/isSpace.ts +1 -1
  80. package/src/compile/parse/utils/isSpaceChar.ts +1 -1
  81. package/src/compile/types/nodes/TemplateNode.ts +3 -0
  82. package/src/compile/utils/Builder.ts +3 -3
  83. package/src/compile/utils/trimEnd.ts +1 -1
  84. package/src/compile/utils/trimMatched.ts +1 -1
  85. package/src/compile/utils/trimQuotes.ts +1 -1
  86. package/src/compile/utils/trimStart.ts +1 -1
  87. package/src/compile/utils/trimStartAndEnd.ts +1 -1
  88. package/src/compile/utils/voidTags.ts +1 -1
  89. package/src/debug/printHtml.ts +1 -1
  90. package/src/motion/animate.ts +1 -1
  91. package/src/render/$mount.ts +1 -1
  92. package/src/render/$run.ts +1 -1
  93. package/src/render/$serverMount.ts +1 -1
  94. package/src/render/$serverRun.ts +1 -1
  95. package/src/render/$stream.ts +1 -1
  96. package/src/render/addAnimation.ts +1 -1
  97. package/src/render/addEvent.ts +1 -1
  98. package/src/render/addFragment.ts +1 -1
  99. package/src/render/applyProps.ts +1 -1
  100. package/src/render/clearRange.ts +1 -1
  101. package/src/render/createComment.ts +1 -1
  102. package/src/render/createElement.ts +1 -1
  103. package/src/render/createFragment.ts +1 -1
  104. package/src/render/createText.ts +1 -1
  105. package/src/render/flushMountEffects.ts +1 -1
  106. package/src/render/getClasses.ts +4 -1
  107. package/src/render/hydrate.ts +1 -1
  108. package/src/render/hydrateRoot.ts +1 -1
  109. package/src/render/mount.ts +1 -1
  110. package/src/render/moveRange.ts +1 -1
  111. package/src/render/popRange.ts +1 -1
  112. package/src/render/runControl.ts +1 -1
  113. package/src/render/runControlBranch.ts +1 -1
  114. package/src/render/runList.ts +1 -1
  115. package/src/render/runListItems.ts +1 -1
  116. package/src/render/setAttribute.ts +1 -1
  117. package/src/render/setDynamicElement.ts +1 -1
  118. package/src/watch/proxyGet.ts +1 -1
  119. package/src/watch/removeEffect.ts +1 -1
  120. package/src/watch/runEffect.ts +1 -1
  121. package/src/watch/symbols.ts +1 -1
  122. package/src/watch/trackEffect.ts +1 -1
  123. package/src/watch/transferEffects.ts +1 -1
  124. package/src/watch/triggerEffects.ts +1 -1
  125. package/test/bench/components/output/Bench-client.ts +0 -204
  126. package/test/bench/components/output/Bench-server.ts +0 -130
  127. package/test/bench/components/temp/Bench-client-5fee290225ae4771aa847360006123671e8f17f1.ts +208 -0
  128. package/test/bench/components/temp/Bench-server-00cefa588803c01ca4f2741c595e4f045cdd101e.ts +130 -0
  129. package/test/build-server/components/{output/IfNested-client.ts → temp/IfNested-client-979db97eea5b4595550b9b46f297f3fbc31796d2.ts} +11 -0
  130. package/test/buildHtml.ts +1 -1
  131. package/test/buildOutputFiles.ts +47 -12
  132. package/test/class/class.test.ts +29 -6
  133. package/test/class/components/Class.torp +15 -1
  134. package/test/class/components/output/Class-client.ts +10 -6
  135. package/test/class/components/output/Class-server.ts +1 -1
  136. package/test/class/components/temp/{Class-client-600bf865c14f1052d24e1c79242f837aaf5ae5e8.ts → Class-client-8c3f9e0257cc2b687e9bb7106cccbab94a4b5adf.ts} +10 -6
  137. package/test/class/components/temp/Class-server-2218c3284845fdab80d1a41ebace9a9e2ddd6fc1.ts +17 -0
  138. package/test/component/components/temp/Header-client-ac151eea86e3f6b058fab101661e13ae73864968.ts +34 -0
  139. package/test/component/components/temp/Header-server-4f10f2332f3ca7a097517cfb938ab1e6f31d68ac.ts +17 -0
  140. package/test/console/components/temp/{Console-client-254d7d4799471401334d698b1631ab1cb5b70558.ts → Console-client-2f206752ce59e59fba9bb91263b4102fd515951e.ts} +1 -1
  141. package/test/console/components/temp/Console-server-b4b15f7a0d1d2b50d87bad4870e1b8d368707c04.ts +17 -0
  142. package/test/globalSetup.ts +1 -1
  143. package/test/helpers.ts +6 -2
  144. package/test/hydrateComponent.ts +1 -1
  145. package/test/importComponent.ts +12 -40
  146. package/test/mountComponent.ts +5 -1
  147. package/test/party/components/temp/AnswerButton-client-243454cd7bf84c648f244b3587e60d01a0401039.ts +33 -0
  148. package/test/party/components/temp/AnswerButton-server-938e46c1d2510ea37454854ef527e4aa64eb8e52.ts +16 -0
  149. package/test/party/components/temp/FunnyButton-client-2e6bec8259065b5bc9ae16d1ca93dd1bd0c56b7c.ts +40 -0
  150. package/test/party/components/temp/FunnyButton-server-e8ab55e47c735f7e42c55d2b7504dfa4190a1b40.ts +32 -0
  151. package/test/party/components/temp/Time-client-7ba4ca9322af2cb88a873c812fc776760c337c64.ts +47 -0
  152. package/test/party/components/temp/Time-server-08f66c7f3f32b13de06d75fe679cf58b5727c473.ts +31 -0
  153. package/test/party/components/temp/UserProfile-client-938bcef20a2555de22aca939022a32742ac5e729.ts +51 -0
  154. package/test/party/components/temp/UserProfile-server-9df5c59b8797fa67c479bc76450104d45e6076f9.ts +22 -0
  155. package/test/party/components/temp/UserProfileContext-client-93211cdba795b8baf926f60f5b17da90701743b3.ts +44 -0
  156. package/test/party/components/temp/UserProfileContext-server-cf58767df1e2d1dde919f59de73cdd9764bbc006.ts +20 -0
  157. package/test/slots/components/temp/Article-client-741f94eab2e96655f4c9d69ccd7d9c7cc998f4ce.ts +41 -0
  158. package/test/slots/components/temp/Article-server-a6bd47a621cc213db4313eb775a52246541dd203.ts +28 -0
  159. package/test/slots/components/temp/Header-client-e2e1e7d60b48b0841cd0c20224f520330ca96458.ts +38 -0
  160. package/test/slots/components/temp/Header-server-1c195508a91c32822da22a08576c8a30c9070636.ts +22 -0
  161. package/test/slots/components/temp/List-client-0659d999cfb48b865fe5b8aaaf2a4ddac3a8a8b6.ts +76 -0
  162. package/test/slots/components/temp/List-server-4b76485a259d054187edad8aa691d80ac918ad86.ts +25 -0
  163. package/test/special-component/components/temp/BigTitle-client-881a9f84876fb3f6d994736edb253b96e71de926.ts +32 -0
  164. package/test/special-component/components/temp/BigTitle-server-9efc738f5eb131a4b859c4a99a8e255d93834e9a.ts +20 -0
  165. package/test/special-component/components/temp/SmallTitle-client-25b3097b7ae47848dd82967403faf7745fc43388.ts +32 -0
  166. package/test/special-component/components/temp/SmallTitle-server-fc105db9a91b83644d67e049ce583a3d1a61f50c.ts +20 -0
  167. package/tsconfig.json +1 -1
  168. package/tsup.config.ts +7 -2
  169. package/vitest.config.ts +2 -2
  170. package/dist/chunk-GO2L324Q.js.map +0 -1
  171. package/test/bench/components/temp/Bench-client-3efcd3b6c03c7a51368df3b8b1bdf2e7fa722432.ts +0 -126
  172. package/test/build-server/components/IfNested.d.ts +0 -18
  173. package/test/class/components/temp/Class-server-082505b03612c762384ffff329472db3f55b8097.ts +0 -17
  174. /package/test/build-server/components/{output/IfNested-server.ts → temp/IfNested-server-3c4e4b6f2162c0906cef685830219b9ea9ee985c.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @torpor/view
2
2
 
3
+ ## 0.0.13
4
+
5
+ ### Patch Changes
6
+
7
+ - ed4a6db: Fix: include quoted content in styles
8
+
9
+ ## 0.0.12
10
+
11
+ ### Patch Changes
12
+
13
+ - ff5f459: Fix: scope more styles
14
+
3
15
  ## 0.0.11
4
16
 
5
17
  ### Patch Changes
@@ -6,7 +6,7 @@ type Cleanup = () => void;
6
6
 
7
7
  declare function formatText(value: any): string;
8
8
 
9
- declare function getClasses(value: unknown): string;
9
+ declare function getClasses(value: unknown, styleHash?: string): string;
10
10
 
11
11
  declare function getStyles(value: Record<string, any>): string;
12
12
 
@@ -6,7 +6,7 @@ type Cleanup = () => void;
6
6
 
7
7
  declare function formatText(value: any): string;
8
8
 
9
- declare function getClasses(value: unknown): string;
9
+ declare function getClasses(value: unknown, styleHash?: string): string;
10
10
 
11
11
  declare function getStyles(value: Record<string, any>): string;
12
12
 
@@ -4,9 +4,12 @@ function formatText(value) {
4
4
  }
5
5
 
6
6
  // src/render/getClasses.ts
7
- function getClasses(value) {
7
+ function getClasses(value, styleHash) {
8
8
  let classes = [];
9
9
  gatherNames("", value, classes);
10
+ if (styleHash) {
11
+ classes.push(styleHash);
12
+ }
10
13
  return classes.join(" ");
11
14
  }
12
15
  function gatherNames(name, value, classes) {
@@ -39,4 +42,4 @@ export {
39
42
  getClasses,
40
43
  getStyles
41
44
  };
42
- //# sourceMappingURL=chunk-GO2L324Q.js.map
45
+ //# sourceMappingURL=chunk-T6JGCJ5T.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/render/formatText.ts","../src/render/getClasses.ts","../src/render/getStyles.ts"],"sourcesContent":["export default function formatText(value: any): string {\n\treturn value ?? \"\";\n}\n","export default function getClasses(value: unknown, styleHash?: string): string {\n\tlet classes: string[] = [];\n\tgatherNames(\"\", value, classes);\n\tif (styleHash) {\n\t\tclasses.push(styleHash);\n\t}\n\treturn classes.join(\" \");\n}\n\nfunction gatherNames(name: unknown, value: unknown, classes: string[]) {\n\tif (value) {\n\t\tif (Array.isArray(value)) {\n\t\t\tfor (let v of value) {\n\t\t\t\tgatherNames(v, v, classes);\n\t\t\t}\n\t\t} else if (typeof value === \"object\") {\n\t\t\tfor (let [n, v] of Object.entries(value)) {\n\t\t\t\tgatherNames(n, v, classes);\n\t\t\t}\n\t\t} else {\n\t\t\tclasses.push(name as string);\n\t\t}\n\t}\n}\n","export default function getStyles(value: Record<string, any>): string {\n\tlet styles: string[] = [];\n\tfor (let [n, v] of Object.entries(value)) {\n\t\tstyles.push(`${n}: ${v}`);\n\t}\n\treturn styles.join(\"; \");\n}\n"],"mappings":";AAAe,SAAR,WAA4B,OAAoB;AACtD,SAAO,SAAS;AACjB;;;ACFe,SAAR,WAA4B,OAAgB,WAA4B;AAC9E,MAAI,UAAoB,CAAC;AACzB,cAAY,IAAI,OAAO,OAAO;AAC9B,MAAI,WAAW;AACd,YAAQ,KAAK,SAAS;AAAA,EACvB;AACA,SAAO,QAAQ,KAAK,GAAG;AACxB;AAEA,SAAS,YAAY,MAAe,OAAgB,SAAmB;AACtE,MAAI,OAAO;AACV,QAAI,MAAM,QAAQ,KAAK,GAAG;AACzB,eAAS,KAAK,OAAO;AACpB,oBAAY,GAAG,GAAG,OAAO;AAAA,MAC1B;AAAA,IACD,WAAW,OAAO,UAAU,UAAU;AACrC,eAAS,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,KAAK,GAAG;AACzC,oBAAY,GAAG,GAAG,OAAO;AAAA,MAC1B;AAAA,IACD,OAAO;AACN,cAAQ,KAAK,IAAc;AAAA,IAC5B;AAAA,EACD;AACD;;;ACvBe,SAAR,UAA2B,OAAoC;AACrE,MAAI,SAAmB,CAAC;AACxB,WAAS,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,KAAK,GAAG;AACzC,WAAO,KAAK,GAAG,CAAC,KAAK,CAAC,EAAE;AAAA,EACzB;AACA,SAAO,OAAO,KAAK,IAAI;AACxB;","names":[]}
package/dist/compile.cjs CHANGED
@@ -91,6 +91,17 @@ var HYDRATION_START_COMMENT = "<![>";
91
91
  var HYDRATION_END_COMMENT = "<!]>";
92
92
  var HYDRATION_BRANCH_COMMENT = "<!^>";
93
93
 
94
+ // src/compile/utils/trimQuotes.ts
95
+ function trimQuotes(text) {
96
+ let start = 0;
97
+ let end = text.length;
98
+ while (text[start] === "'" && text[end - 1] === "'" || text[start] === '"' && text[end - 1] === '"' || text[start] === "`" && text[end - 1] === "`") {
99
+ start += 1;
100
+ end -= 1;
101
+ }
102
+ return text.substring(start, end);
103
+ }
104
+
94
105
  // src/compile/build/utils/isReactive.ts
95
106
  function isReactive(text) {
96
107
  return text.includes("{") && text.includes("}");
@@ -198,6 +209,9 @@ function buildElementFragmentText(node, status, fragments, currentFragment) {
198
209
  if (a.name.startsWith("data-")) {
199
210
  return `${a.name}=""`;
200
211
  }
212
+ } else if (a.name === "class" && node.scopeStyles) {
213
+ let value = a.value ? `"${trimQuotes(a.value)} torp-${status.styleHash}"` : `"torp-${status.styleHash}"`;
214
+ return `${a.name}=${value}`;
201
215
  } else {
202
216
  return `${a.name}${a.value != null ? `=${a.value}` : ""}`;
203
217
  }
@@ -267,17 +281,6 @@ function trimMatched(text, startChar, endChar) {
267
281
  return text.substring(start, end);
268
282
  }
269
283
 
270
- // src/compile/utils/trimQuotes.ts
271
- function trimQuotes(text) {
272
- let start = 0;
273
- let end = text.length;
274
- while (text[start] === "'" && text[end - 1] === "'" || text[start] === '"' && text[end - 1] === '"' || text[start] === "`" && text[end - 1] === "`") {
275
- start += 1;
276
- end -= 1;
277
- }
278
- return text.substring(start, end);
279
- }
280
-
281
284
  // src/compile/build/utils/isFullyReactive.ts
282
285
  function isFullyReactive(text) {
283
286
  return text.trim().startsWith("{") && text.trim().endsWith("}");
@@ -1534,9 +1537,15 @@ function buildElementAttributes(node, varName, status, b) {
1534
1537
  } else if (name.startsWith(":transition")) {
1535
1538
  buildTransitionAttribute(node, varName, name, value, status, b);
1536
1539
  } else if (name === "class") {
1540
+ if (node.scopeStyles) {
1541
+ value += `+ "torp-${status.styleHash}"`;
1542
+ }
1537
1543
  buildRun("setClassName", `${varName}.className = ${value};`, status, b);
1538
1544
  } else if (name === ":class") {
1539
1545
  status.imports.add("t_class");
1546
+ if (node.scopeStyles) {
1547
+ value += `, "torp-${status.styleHash}"`;
1548
+ }
1540
1549
  buildRun("setClasses", `${varName}.className = t_class(${value});`, status, b);
1541
1550
  } else if (name === ":style") {
1542
1551
  status.imports.add("t_style");
@@ -2449,6 +2458,9 @@ function buildElementAttributes2(node, status) {
2449
2458
  attributes.push(`${propName}="\${${valueOrDefault}}"`);
2450
2459
  } else if (name === ":class") {
2451
2460
  status.imports.add("t_class");
2461
+ if (node.scopeStyles) {
2462
+ value += `, "torp-${status.styleHash}"`;
2463
+ }
2452
2464
  attributes.push(`class="\${t_class(${value})}"`);
2453
2465
  } else if (name === ":style") {
2454
2466
  status.imports.add("t_style");
@@ -2462,6 +2474,9 @@ function buildElementAttributes2(node, status) {
2462
2474
  attributes.push(
2463
2475
  `${name}="${trimQuotes(value).replaceAll("{", "${t_attr(").replaceAll("}", ")}")}"`
2464
2476
  );
2477
+ } else if (name === "class" && node.scopeStyles) {
2478
+ value = value ? `"${trimQuotes(value)} torp-${status.styleHash}"` : `"torp-${status.styleHash}"`;
2479
+ attributes.push(`${name}="${trimQuotes(value).replaceAll('"', "&quot;")}"`);
2465
2480
  } else if (value != null) {
2466
2481
  attributes.push(`${name}="${trimQuotes(value).replaceAll('"', "&quot;")}"`);
2467
2482
  } else {
@@ -3589,40 +3604,32 @@ function scopeStyles(status) {
3589
3604
  for (let block of component.style.blocks) {
3590
3605
  collectStyleSelectors(block, selectors);
3591
3606
  }
3592
- scopeStylesOnNode(component.markup, selectors, component.style.hash);
3607
+ scopeStylesOnNode(component.markup, selectors);
3593
3608
  }
3594
3609
  }
3595
3610
  }
3596
- function scopeStylesOnNode(node, selectors, styleHash) {
3611
+ function scopeStylesOnNode(node, selectors) {
3597
3612
  if (isElementNode(node)) {
3598
- let addClass = selectors.includes(node.tagName);
3599
- if (!addClass) {
3613
+ let scopeStyles2 = selectors.includes(node.tagName);
3614
+ if (!scopeStyles2) {
3600
3615
  for (let a of node.attributes) {
3601
3616
  if (a.name === "class" || a.name === ":class") {
3602
- addClass = true;
3617
+ scopeStyles2 = true;
3603
3618
  } else if (a.name === "id" && a.value) {
3604
- addClass = selectors.includes(`#${trimQuotes(a.value)}`);
3619
+ scopeStyles2 = selectors.includes(`#${trimQuotes(a.value)}`);
3605
3620
  } else if (a.name === "class" && a.value) {
3606
- addClass = selectors.includes(`.${trimQuotes(a.value)}`);
3621
+ scopeStyles2 = selectors.includes(`.${trimQuotes(a.value)}`);
3622
+ }
3623
+ if (scopeStyles2) {
3624
+ break;
3607
3625
  }
3608
- if (addClass) break;
3609
- }
3610
- }
3611
- if (addClass) {
3612
- let classAttribute = node.attributes.find((a) => a.name === "class");
3613
- if (classAttribute && classAttribute.value) {
3614
- classAttribute.value = `"${trimQuotes(classAttribute.value)} torp-${styleHash}"`;
3615
- } else {
3616
- node.attributes.push({
3617
- name: "class",
3618
- value: `"torp-${styleHash}"`
3619
- });
3620
3626
  }
3621
3627
  }
3628
+ node.scopeStyles = scopeStyles2;
3622
3629
  }
3623
3630
  if (isParentNode(node)) {
3624
3631
  for (let child of node.children) {
3625
- scopeStylesOnNode(child, selectors, styleHash);
3632
+ scopeStylesOnNode(child, selectors);
3626
3633
  }
3627
3634
  }
3628
3635
  }
@@ -3798,15 +3805,19 @@ function parseComponentStyle(status) {
3798
3805
  } else if (char === "/" && nextChar === "*") {
3799
3806
  status.i = status.source.indexOf("*/", status.i) + 1;
3800
3807
  } else if (char === '"' || char === "'") {
3808
+ styleSource += char;
3801
3809
  for (let j = status.i + 1; j < status.source.length; j++) {
3810
+ styleSource += status.source[j];
3802
3811
  if (status.source[j] === char && status.source[j - 1] !== "\\") {
3803
3812
  status.i = j;
3804
3813
  break;
3805
3814
  }
3806
3815
  }
3807
3816
  } else if (char === "`") {
3817
+ styleSource += char;
3808
3818
  let level2 = 0;
3809
3819
  for (let j = status.i + 1; j < status.source.length; j++) {
3820
+ styleSource += status.source[j];
3810
3821
  if (status.source[j] === char && status.source[j - 1] !== "\\" && level2 === 0) {
3811
3822
  status.i = j;
3812
3823
  break;