vite-plugin-specter 0.2.3 → 0.2.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/dist/client.js CHANGED
@@ -269,7 +269,7 @@
269
269
  function parseColor(str) {
270
270
  if (!str || str === 'transparent' || str === 'rgba(0, 0, 0, 0)') return null;
271
271
  var m = str.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
272
- if (!m) return { hex: str, alpha: 1 };
272
+ if (!m) return null;
273
273
  return { hex: toHex(m[1], m[2], m[3]), alpha: m[4] !== undefined ? parseFloat(m[4]) : 1 };
274
274
  }
275
275
 
package/dist/index.cjs CHANGED
@@ -299,7 +299,7 @@ function getClientScript(options) {
299
299
  function parseColor(str) {
300
300
  if (!str || str === 'transparent' || str === 'rgba(0, 0, 0, 0)') return null;
301
301
  var m = str.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([\\d.]+))?\\)/);
302
- if (!m) return { hex: str, alpha: 1 };
302
+ if (!m) return null;
303
303
  return { hex: toHex(m[1], m[2], m[3]), alpha: m[4] !== undefined ? parseFloat(m[4]) : 1 };
304
304
  }
305
305
 
@@ -1016,7 +1016,7 @@ function specter(options = {}) {
1016
1016
  name: "vite-plugin-specter",
1017
1017
  apply: "serve",
1018
1018
  transformIndexHtml(html) {
1019
- const script = getClientScript(options);
1019
+ const script = getClientScript(options).replace(/<\/script>/gi, "<\\/script>");
1020
1020
  return html.replace("</body>", () => `<script>
1021
1021
  ${script}
1022
1022
  </script>
package/dist/index.js CHANGED
@@ -272,7 +272,7 @@ function getClientScript(options) {
272
272
  function parseColor(str) {
273
273
  if (!str || str === 'transparent' || str === 'rgba(0, 0, 0, 0)') return null;
274
274
  var m = str.match(/rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([\\d.]+))?\\)/);
275
- if (!m) return { hex: str, alpha: 1 };
275
+ if (!m) return null;
276
276
  return { hex: toHex(m[1], m[2], m[3]), alpha: m[4] !== undefined ? parseFloat(m[4]) : 1 };
277
277
  }
278
278
 
@@ -989,7 +989,7 @@ function specter(options = {}) {
989
989
  name: "vite-plugin-specter",
990
990
  apply: "serve",
991
991
  transformIndexHtml(html) {
992
- const script = getClientScript(options);
992
+ const script = getClientScript(options).replace(/<\/script>/gi, "<\\/script>");
993
993
  return html.replace("</body>", () => `<script>
994
994
  ${script}
995
995
  </script>
@@ -269,7 +269,7 @@
269
269
  function parseColor(str) {
270
270
  if (!str || str === 'transparent' || str === 'rgba(0, 0, 0, 0)') return null;
271
271
  var m = str.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?\)/);
272
- if (!m) return { hex: str, alpha: 1 };
272
+ if (!m) return null;
273
273
  return { hex: toHex(m[1], m[2], m[3]), alpha: m[4] !== undefined ? parseFloat(m[4]) : 1 };
274
274
  }
275
275
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-specter",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Inspect elements and Figma-style measure spacing in your vibe-coded Vite projects. Give your AI exactly what it needs to make the right change.",
5
5
  "author": "Setu Kathawate <dev@setugk.com>",
6
6
  "homepage": "https://github.com/setugk/vite-plugin-specter#readme",