@csszyx/vue-adapter 0.11.4 → 0.11.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/dist/index.cjs CHANGED
@@ -200,10 +200,10 @@ function mergeClassAttributes(template) {
200
200
  const tag = result.slice(start, end + 1);
201
201
  i = end + 1;
202
202
  if (!/^<[a-z]/i.test(tag)) continue;
203
- const staticMatch = /\bclass="([^"]*)"/.exec(tag);
204
- const dynamicMatch = /\b(?::class|v-bind:class)="([^"]*)"/.exec(tag);
203
+ const staticMatch = /(?:^|\s)class="([^"]*)"/.exec(tag);
204
+ const dynamicMatch = /(?:^|\s)(?::class|v-bind:class)="([^"]*)"/.exec(tag);
205
205
  if (!staticMatch || !dynamicMatch) continue;
206
- const cleaned = tag.replace(/\bclass="[^"]*"/, "").replace(/\b(?::class|v-bind:class)="[^"]*"/, "");
206
+ const cleaned = tag.replace(/(^|\s)class="[^"]*"/, "$1").replace(/(^|\s)(?::class|v-bind:class)="[^"]*"/, "$1");
207
207
  const insertIdx = cleaned.indexOf(" ") + 1;
208
208
  const newTag = `${cleaned.slice(0, insertIdx)}:class="['${staticMatch[1]}', ${dynamicMatch[1]}]" ${cleaned.slice(insertIdx)}`;
209
209
  result = result.slice(0, start) + newTag + result.slice(end + 1);
package/dist/index.js CHANGED
@@ -200,10 +200,10 @@ function mergeClassAttributes(template) {
200
200
  const tag = result.slice(start, end + 1);
201
201
  i = end + 1;
202
202
  if (!/^<[a-z]/i.test(tag)) continue;
203
- const staticMatch = /\bclass="([^"]*)"/.exec(tag);
204
- const dynamicMatch = /\b(?::class|v-bind:class)="([^"]*)"/.exec(tag);
203
+ const staticMatch = /(?:^|\s)class="([^"]*)"/.exec(tag);
204
+ const dynamicMatch = /(?:^|\s)(?::class|v-bind:class)="([^"]*)"/.exec(tag);
205
205
  if (!staticMatch || !dynamicMatch) continue;
206
- const cleaned = tag.replace(/\bclass="[^"]*"/, "").replace(/\b(?::class|v-bind:class)="[^"]*"/, "");
206
+ const cleaned = tag.replace(/(^|\s)class="[^"]*"/, "$1").replace(/(^|\s)(?::class|v-bind:class)="[^"]*"/, "$1");
207
207
  const insertIdx = cleaned.indexOf(" ") + 1;
208
208
  const newTag = `${cleaned.slice(0, insertIdx)}:class="['${staticMatch[1]}', ${dynamicMatch[1]}]" ${cleaned.slice(insertIdx)}`;
209
209
  result = result.slice(0, start) + newTag + result.slice(end + 1);
package/dist/index.mjs CHANGED
@@ -181,10 +181,10 @@ export function mergeClassAttributes(template) {
181
181
  const tag = result.slice(start, end + 1);
182
182
  i = end + 1;
183
183
  if (!/^<[a-z]/i.test(tag)) continue;
184
- const staticMatch = /\bclass="([^"]*)"/.exec(tag);
185
- const dynamicMatch = /\b(?::class|v-bind:class)="([^"]*)"/.exec(tag);
184
+ const staticMatch = /(?:^|\s)class="([^"]*)"/.exec(tag);
185
+ const dynamicMatch = /(?:^|\s)(?::class|v-bind:class)="([^"]*)"/.exec(tag);
186
186
  if (!staticMatch || !dynamicMatch) continue;
187
- const cleaned = tag.replace(/\bclass="[^"]*"/, "").replace(/\b(?::class|v-bind:class)="[^"]*"/, "");
187
+ const cleaned = tag.replace(/(^|\s)class="[^"]*"/, "$1").replace(/(^|\s)(?::class|v-bind:class)="[^"]*"/, "$1");
188
188
  const insertIdx = cleaned.indexOf(" ") + 1;
189
189
  const newTag = `${cleaned.slice(0, insertIdx)}:class="['${staticMatch[1]}', ${dynamicMatch[1]}]" ${cleaned.slice(insertIdx)}`;
190
190
  result = result.slice(0, start) + newTag + result.slice(end + 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@csszyx/vue-adapter",
3
- "version": "0.11.4",
3
+ "version": "0.11.5",
4
4
  "private": false,
5
5
  "description": "Vue SFC preprocessor for csszyx - transform sz props to className",
6
6
  "license": "MIT",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "oxc-parser": "0.131.0",
28
- "@csszyx/compiler": "0.11.4"
28
+ "@csszyx/compiler": "0.11.5"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "vue": "^3.0.0"