vite-plugin-specter 0.3.3 → 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.
package/dist/client.js CHANGED
@@ -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;
@@ -976,8 +971,9 @@
976
971
 
977
972
  window.__specterToggle = function() { if (fiActive) deactivate(); else activate(); };
978
973
 
979
- if (typeof browser !== 'undefined' && browser.runtime && browser.runtime.onMessage) {
980
- 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) {
981
977
  if (msg && msg.type === 'specter-toggle') window.__specterToggle();
982
978
  });
983
979
  }
@@ -0,0 +1,4 @@
1
+ // Chrome MV3 service worker
2
+ chrome.action.onClicked.addListener((tab) => {
3
+ chrome.tabs.sendMessage(tab.id, { type: 'specter-toggle' });
4
+ });