vite-plugin-specter 0.3.2 → 0.3.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.
@@ -0,0 +1,38 @@
1
+ {
2
+ "manifest_version": 3,
3
+ "name": "Specter",
4
+ "version": "0.3.3",
5
+ "description": "Element inspector for AI-assisted development. Ctrl+Option+Z to activate.",
6
+ "icons": {
7
+ "16": "icons/icon16.png",
8
+ "32": "icons/icon32.png",
9
+ "48": "icons/icon48.png",
10
+ "128": "icons/icon128.png"
11
+ },
12
+ "action": {
13
+ "default_icon": {
14
+ "16": "icons/icon16.png",
15
+ "32": "icons/icon32.png",
16
+ "48": "icons/icon48.png",
17
+ "128": "icons/icon128.png"
18
+ },
19
+ "default_title": "Activate Specter on this page"
20
+ },
21
+ "background": {
22
+ "service_worker": "background.js"
23
+ },
24
+ "content_scripts": [
25
+ {
26
+ "matches": [
27
+ "<all_urls>"
28
+ ],
29
+ "js": [
30
+ "content.js"
31
+ ],
32
+ "run_at": "document_end"
33
+ }
34
+ ],
35
+ "permissions": [
36
+ "activeTab"
37
+ ]
38
+ }
@@ -273,17 +273,11 @@
273
273
  return { hex: toHex(m[1], m[2], m[3]), alpha: m[4] !== undefined ? parseFloat(m[4]) : 1 };
274
274
  }
275
275
 
276
- function colorLabel(str) {
277
- var c = parseColor(str);
278
- if (!c) return null;
279
- if (c.alpha < 1) return c.hex + ' (' + Math.round(c.alpha * 100) + '% opacity)';
280
- return c.hex;
281
- }
282
-
283
276
  function colorObj(str) {
284
277
  var c = parseColor(str);
285
278
  if (!c) return null;
286
- return { raw: str, hex: c.hex, alpha: c.alpha, label: colorLabel(str) };
279
+ var label = c.alpha < 1 ? c.hex + ' (' + Math.round(c.alpha * 100) + '% opacity)' : c.hex;
280
+ return { raw: str, hex: c.hex, alpha: c.alpha, label: label };
287
281
  }
288
282
 
289
283
  function edge(t, r, b, l) {
@@ -485,6 +479,7 @@
485
479
  function clearHoverOutline() {
486
480
  if (outlinedEl) {
487
481
  outlinedEl.style.outline = prevOutline;
482
+ outlinedEl.style.outlineOffset = '';
488
483
  outlinedEl = null;
489
484
  }
490
485
  }
@@ -561,7 +556,7 @@
561
556
  }
562
557
 
563
558
  function clearSelection() {
564
- selectedEls.forEach(function (el) { el.style.outline = ''; });
559
+ selectedEls.forEach(function (el) { el.style.outline = ''; el.style.outlineOffset = ''; });
565
560
  selectedEls.length = 0;
566
561
  selectedBadges.forEach(function (b) { b.remove(); });
567
562
  selectedBadges.length = 0;
@@ -926,7 +921,7 @@
926
921
  if (isInputFocused()) return;
927
922
 
928
923
  if (e.key === 'p' || e.key === 'P') {
929
- if (measureMode || !lastHovered) return;
924
+ if (!lastHovered) return;
930
925
  clearHoverOutline();
931
926
  toggleSelection(lastHovered);
932
927
  return;
@@ -945,11 +940,12 @@
945
940
  }
946
941
 
947
942
  if (e.key === 'Escape') {
948
- if (pinEl) {
943
+ if (pinEl || selectedEls.length > 0) {
949
944
  clearPin();
945
+ clearSelection();
950
946
  clearMeasureOverlay();
951
947
  hideTooltip();
952
- updatePillForSelection();
948
+ collapsePill();
953
949
  } else {
954
950
  deactivate();
955
951
  }
@@ -975,8 +971,9 @@
975
971
 
976
972
  window.__specterToggle = function() { if (fiActive) deactivate(); else activate(); };
977
973
 
978
- if (typeof browser !== 'undefined' && browser.runtime && browser.runtime.onMessage) {
979
- browser.runtime.onMessage.addListener(function(msg) {
974
+ var _rt = (typeof browser !== 'undefined' && browser.runtime) || (typeof chrome !== 'undefined' && chrome.runtime);
975
+ if (_rt && _rt.onMessage) {
976
+ _rt.onMessage.addListener(function(msg) {
980
977
  if (msg && msg.type === 'specter-toggle') window.__specterToggle();
981
978
  });
982
979
  }
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "manifest_version": 2,
3
3
  "name": "Specter",
4
- "version": "0.3.0",
4
+ "version": "0.3.3",
5
5
  "description": "Element inspector for AI-assisted development. Ctrl+Option+Z to activate.",
6
6
  "browser_specific_settings": {
7
7
  "gecko": {
8
8
  "id": "specter@setugk.com",
9
- "strict_min_version": "109.0"
9
+ "strict_min_version": "109.0",
10
+ "data_collection_permissions": {
11
+ "required": [
12
+ "none"
13
+ ],
14
+ "optional": []
15
+ }
10
16
  }
11
17
  },
12
18
  "icons": {
package/dist/index.cjs CHANGED
@@ -303,17 +303,11 @@ function getClientScript(options) {
303
303
  return { hex: toHex(m[1], m[2], m[3]), alpha: m[4] !== undefined ? parseFloat(m[4]) : 1 };
304
304
  }
305
305
 
306
- function colorLabel(str) {
307
- var c = parseColor(str);
308
- if (!c) return null;
309
- if (c.alpha < 1) return c.hex + ' (' + Math.round(c.alpha * 100) + '% opacity)';
310
- return c.hex;
311
- }
312
-
313
306
  function colorObj(str) {
314
307
  var c = parseColor(str);
315
308
  if (!c) return null;
316
- return { raw: str, hex: c.hex, alpha: c.alpha, label: colorLabel(str) };
309
+ var label = c.alpha < 1 ? c.hex + ' (' + Math.round(c.alpha * 100) + '% opacity)' : c.hex;
310
+ return { raw: str, hex: c.hex, alpha: c.alpha, label: label };
317
311
  }
318
312
 
319
313
  function edge(t, r, b, l) {
@@ -515,6 +509,7 @@ function getClientScript(options) {
515
509
  function clearHoverOutline() {
516
510
  if (outlinedEl) {
517
511
  outlinedEl.style.outline = prevOutline;
512
+ outlinedEl.style.outlineOffset = '';
518
513
  outlinedEl = null;
519
514
  }
520
515
  }
@@ -591,7 +586,7 @@ function getClientScript(options) {
591
586
  }
592
587
 
593
588
  function clearSelection() {
594
- selectedEls.forEach(function (el) { el.style.outline = ''; });
589
+ selectedEls.forEach(function (el) { el.style.outline = ''; el.style.outlineOffset = ''; });
595
590
  selectedEls.length = 0;
596
591
  selectedBadges.forEach(function (b) { b.remove(); });
597
592
  selectedBadges.length = 0;
@@ -956,7 +951,7 @@ function getClientScript(options) {
956
951
  if (isInputFocused()) return;
957
952
 
958
953
  if (e.key === 'p' || e.key === 'P') {
959
- if (measureMode || !lastHovered) return;
954
+ if (!lastHovered) return;
960
955
  clearHoverOutline();
961
956
  toggleSelection(lastHovered);
962
957
  return;
@@ -975,11 +970,12 @@ function getClientScript(options) {
975
970
  }
976
971
 
977
972
  if (e.key === 'Escape') {
978
- if (pinEl) {
973
+ if (pinEl || selectedEls.length > 0) {
979
974
  clearPin();
975
+ clearSelection();
980
976
  clearMeasureOverlay();
981
977
  hideTooltip();
982
- updatePillForSelection();
978
+ collapsePill();
983
979
  } else {
984
980
  deactivate();
985
981
  }
@@ -1005,8 +1001,9 @@ function getClientScript(options) {
1005
1001
 
1006
1002
  window.__specterToggle = function() { if (fiActive) deactivate(); else activate(); };
1007
1003
 
1008
- if (typeof browser !== 'undefined' && browser.runtime && browser.runtime.onMessage) {
1009
- browser.runtime.onMessage.addListener(function(msg) {
1004
+ var _rt = (typeof browser !== 'undefined' && browser.runtime) || (typeof chrome !== 'undefined' && chrome.runtime);
1005
+ if (_rt && _rt.onMessage) {
1006
+ _rt.onMessage.addListener(function(msg) {
1010
1007
  if (msg && msg.type === 'specter-toggle') window.__specterToggle();
1011
1008
  });
1012
1009
  }
package/dist/index.js CHANGED
@@ -276,17 +276,11 @@ function getClientScript(options) {
276
276
  return { hex: toHex(m[1], m[2], m[3]), alpha: m[4] !== undefined ? parseFloat(m[4]) : 1 };
277
277
  }
278
278
 
279
- function colorLabel(str) {
280
- var c = parseColor(str);
281
- if (!c) return null;
282
- if (c.alpha < 1) return c.hex + ' (' + Math.round(c.alpha * 100) + '% opacity)';
283
- return c.hex;
284
- }
285
-
286
279
  function colorObj(str) {
287
280
  var c = parseColor(str);
288
281
  if (!c) return null;
289
- return { raw: str, hex: c.hex, alpha: c.alpha, label: colorLabel(str) };
282
+ var label = c.alpha < 1 ? c.hex + ' (' + Math.round(c.alpha * 100) + '% opacity)' : c.hex;
283
+ return { raw: str, hex: c.hex, alpha: c.alpha, label: label };
290
284
  }
291
285
 
292
286
  function edge(t, r, b, l) {
@@ -488,6 +482,7 @@ function getClientScript(options) {
488
482
  function clearHoverOutline() {
489
483
  if (outlinedEl) {
490
484
  outlinedEl.style.outline = prevOutline;
485
+ outlinedEl.style.outlineOffset = '';
491
486
  outlinedEl = null;
492
487
  }
493
488
  }
@@ -564,7 +559,7 @@ function getClientScript(options) {
564
559
  }
565
560
 
566
561
  function clearSelection() {
567
- selectedEls.forEach(function (el) { el.style.outline = ''; });
562
+ selectedEls.forEach(function (el) { el.style.outline = ''; el.style.outlineOffset = ''; });
568
563
  selectedEls.length = 0;
569
564
  selectedBadges.forEach(function (b) { b.remove(); });
570
565
  selectedBadges.length = 0;
@@ -929,7 +924,7 @@ function getClientScript(options) {
929
924
  if (isInputFocused()) return;
930
925
 
931
926
  if (e.key === 'p' || e.key === 'P') {
932
- if (measureMode || !lastHovered) return;
927
+ if (!lastHovered) return;
933
928
  clearHoverOutline();
934
929
  toggleSelection(lastHovered);
935
930
  return;
@@ -948,11 +943,12 @@ function getClientScript(options) {
948
943
  }
949
944
 
950
945
  if (e.key === 'Escape') {
951
- if (pinEl) {
946
+ if (pinEl || selectedEls.length > 0) {
952
947
  clearPin();
948
+ clearSelection();
953
949
  clearMeasureOverlay();
954
950
  hideTooltip();
955
- updatePillForSelection();
951
+ collapsePill();
956
952
  } else {
957
953
  deactivate();
958
954
  }
@@ -978,8 +974,9 @@ function getClientScript(options) {
978
974
 
979
975
  window.__specterToggle = function() { if (fiActive) deactivate(); else activate(); };
980
976
 
981
- if (typeof browser !== 'undefined' && browser.runtime && browser.runtime.onMessage) {
982
- browser.runtime.onMessage.addListener(function(msg) {
977
+ var _rt = (typeof browser !== 'undefined' && browser.runtime) || (typeof chrome !== 'undefined' && chrome.runtime);
978
+ if (_rt && _rt.onMessage) {
979
+ _rt.onMessage.addListener(function(msg) {
983
980
  if (msg && msg.type === 'specter-toggle') window.__specterToggle();
984
981
  });
985
982
  }
@@ -1,8 +1,4 @@
1
1
  // Chrome MV3 service worker
2
- // Toolbar click injects Specter on any page (not just localhost)
3
2
  chrome.action.onClicked.addListener((tab) => {
4
- chrome.scripting.executeScript({
5
- target: { tabId: tab.id },
6
- files: ['content.js'],
7
- });
3
+ chrome.tabs.sendMessage(tab.id, { type: 'specter-toggle' });
8
4
  });
@@ -273,17 +273,11 @@
273
273
  return { hex: toHex(m[1], m[2], m[3]), alpha: m[4] !== undefined ? parseFloat(m[4]) : 1 };
274
274
  }
275
275
 
276
- function colorLabel(str) {
277
- var c = parseColor(str);
278
- if (!c) return null;
279
- if (c.alpha < 1) return c.hex + ' (' + Math.round(c.alpha * 100) + '% opacity)';
280
- return c.hex;
281
- }
282
-
283
276
  function colorObj(str) {
284
277
  var c = parseColor(str);
285
278
  if (!c) return null;
286
- return { raw: str, hex: c.hex, alpha: c.alpha, label: colorLabel(str) };
279
+ var label = c.alpha < 1 ? c.hex + ' (' + Math.round(c.alpha * 100) + '% opacity)' : c.hex;
280
+ return { raw: str, hex: c.hex, alpha: c.alpha, label: label };
287
281
  }
288
282
 
289
283
  function edge(t, r, b, l) {
@@ -485,6 +479,7 @@
485
479
  function clearHoverOutline() {
486
480
  if (outlinedEl) {
487
481
  outlinedEl.style.outline = prevOutline;
482
+ outlinedEl.style.outlineOffset = '';
488
483
  outlinedEl = null;
489
484
  }
490
485
  }
@@ -561,7 +556,7 @@
561
556
  }
562
557
 
563
558
  function clearSelection() {
564
- selectedEls.forEach(function (el) { el.style.outline = ''; });
559
+ selectedEls.forEach(function (el) { el.style.outline = ''; el.style.outlineOffset = ''; });
565
560
  selectedEls.length = 0;
566
561
  selectedBadges.forEach(function (b) { b.remove(); });
567
562
  selectedBadges.length = 0;
@@ -926,7 +921,7 @@
926
921
  if (isInputFocused()) return;
927
922
 
928
923
  if (e.key === 'p' || e.key === 'P') {
929
- if (measureMode || !lastHovered) return;
924
+ if (!lastHovered) return;
930
925
  clearHoverOutline();
931
926
  toggleSelection(lastHovered);
932
927
  return;
@@ -945,11 +940,12 @@
945
940
  }
946
941
 
947
942
  if (e.key === 'Escape') {
948
- if (pinEl) {
943
+ if (pinEl || selectedEls.length > 0) {
949
944
  clearPin();
945
+ clearSelection();
950
946
  clearMeasureOverlay();
951
947
  hideTooltip();
952
- updatePillForSelection();
948
+ collapsePill();
953
949
  } else {
954
950
  deactivate();
955
951
  }
@@ -975,8 +971,9 @@
975
971
 
976
972
  window.__specterToggle = function() { if (fiActive) deactivate(); else activate(); };
977
973
 
978
- if (typeof browser !== 'undefined' && browser.runtime && browser.runtime.onMessage) {
979
- browser.runtime.onMessage.addListener(function(msg) {
974
+ var _rt = (typeof browser !== 'undefined' && browser.runtime) || (typeof chrome !== 'undefined' && chrome.runtime);
975
+ if (_rt && _rt.onMessage) {
976
+ _rt.onMessage.addListener(function(msg) {
980
977
  if (msg && msg.type === 'specter-toggle') window.__specterToggle();
981
978
  });
982
979
  }
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "manifest_version": 2,
3
3
  "name": "Specter",
4
- "version": "0.3.0",
4
+ "version": "0.3.3",
5
5
  "description": "Element inspector for AI-assisted development. Ctrl+Option+Z to activate.",
6
6
  "browser_specific_settings": {
7
7
  "gecko": {
8
8
  "id": "specter@setugk.com",
9
- "strict_min_version": "109.0"
9
+ "strict_min_version": "109.0",
10
+ "data_collection_permissions": {
11
+ "required": [
12
+ "none"
13
+ ],
14
+ "optional": []
15
+ }
10
16
  }
11
17
  },
12
18
  "icons": {
@@ -24,15 +30,23 @@
24
30
  "default_title": "Toggle Specter"
25
31
  },
26
32
  "background": {
27
- "scripts": ["background.firefox.js"],
33
+ "scripts": [
34
+ "background.firefox.js"
35
+ ],
28
36
  "persistent": false
29
37
  },
30
38
  "content_scripts": [
31
39
  {
32
- "matches": ["<all_urls>"],
33
- "js": ["content.js"],
40
+ "matches": [
41
+ "<all_urls>"
42
+ ],
43
+ "js": [
44
+ "content.js"
45
+ ],
34
46
  "run_at": "document_end"
35
47
  }
36
48
  ],
37
- "permissions": ["activeTab"]
38
- }
49
+ "permissions": [
50
+ "activeTab"
51
+ ]
52
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Specter",
4
- "version": "0.3.0",
4
+ "version": "0.3.3",
5
5
  "description": "Element inspector for AI-assisted development. Ctrl+Option+Z to activate.",
6
6
  "icons": {
7
7
  "16": "icons/icon16.png",
@@ -24,13 +24,15 @@
24
24
  "content_scripts": [
25
25
  {
26
26
  "matches": [
27
- "http://localhost/*",
28
- "http://127.0.0.1/*",
29
- "http://0.0.0.0/*"
27
+ "<all_urls>"
28
+ ],
29
+ "js": [
30
+ "content.js"
30
31
  ],
31
- "js": ["content.js"],
32
32
  "run_at": "document_end"
33
33
  }
34
34
  ],
35
- "permissions": ["activeTab", "scripting"]
35
+ "permissions": [
36
+ "activeTab"
37
+ ]
36
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-specter",
3
- "version": "0.3.2",
3
+ "version": "0.3.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",