weevar 1.2.0 → 2.0.1

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/README.md CHANGED
@@ -4,7 +4,7 @@ A dev-only overlay for React apps that lets you **rearrange layout** and **edit
4
4
 
5
5
  Weevar runs locally while your dev server is active. Nothing ships to production until you apply the generated prompts to your source code.
6
6
 
7
- **Current version:** see the tray footer (`v1.2.0` at time of this release).
7
+ **Current version:** see the tray footer (`v2.0.1` at time of this release).
8
8
 
9
9
  ---
10
10
 
@@ -190,16 +190,18 @@ The published **`weevar/react`** production export is a **no-op** — the overla
190
190
 
191
191
  ## Documentation
192
192
 
193
+ - [Weevar.com](https://weevar.com)
193
194
  - [Install](https://github.com/Pro-Gee/Weevar/blob/main/docs/INSTALL.md)
194
195
  - [Usage](https://github.com/Pro-Gee/Weevar/blob/main/docs/USAGE.md)
195
196
  - [Troubleshooting](https://github.com/Pro-Gee/Weevar/blob/main/docs/TROUBLESHOOTING.md)
196
197
  - [Compatibility](https://github.com/Pro-Gee/Weevar/blob/main/docs/COMPATIBILITY.md)
197
198
  - [Security](https://github.com/Pro-Gee/Weevar/blob/main/docs/SECURITY.md)
198
199
  - [Changelog](https://github.com/Pro-Gee/Weevar/blob/main/CHANGELOG.md)
199
- - [Weevar.com](https://weevar.com)
200
200
 
201
201
  ---
202
202
 
203
203
  ## License
204
204
 
205
- MIT — © 2026 Gideon Adeyemi
205
+ MIT Licensed
206
+
207
+ © 2026 Gideon Adeyemi (Weevar was created and is maintained by Gideon Adeyemi)
package/dist/react.dev.js CHANGED
@@ -142,13 +142,36 @@ function isInsideWeevarOverlay(el) {
142
142
  if (element.id === WEEVAR_HOST_ID) return true;
143
143
  return false;
144
144
  }
145
+ var weevarClosedShadowRoot = null;
146
+ function setWeevarClosedShadowRoot(root) {
147
+ weevarClosedShadowRoot = root;
148
+ }
145
149
  function getDeepActiveElement() {
146
- let active = document.activeElement;
150
+ const hostActive = document.activeElement;
151
+ if (hostActive instanceof HTMLElement && hostActive.id === WEEVAR_HOST_ID && weevarClosedShadowRoot?.activeElement) {
152
+ return weevarClosedShadowRoot.activeElement;
153
+ }
154
+ let active = hostActive;
147
155
  while (active?.shadowRoot?.activeElement) {
148
156
  active = active.shadowRoot.activeElement;
149
157
  }
150
158
  return active;
151
159
  }
160
+ function isEditableElement(el) {
161
+ if (!(el instanceof HTMLElement)) return false;
162
+ const tag = el.tagName;
163
+ if (tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT") return true;
164
+ return el.isContentEditable;
165
+ }
166
+ function shouldIgnoreWeevarShortcut(e) {
167
+ const target = e.target;
168
+ if (isEditableElement(target instanceof HTMLElement ? target : null)) return true;
169
+ if (isEditableElement(getDeepActiveElement())) return true;
170
+ for (const n of e.composedPath()) {
171
+ if (n instanceof HTMLElement && isEditableElement(n)) return true;
172
+ }
173
+ return false;
174
+ }
152
175
  function blurWeevarOverlayFocusIfPointerOutside(e) {
153
176
  const ae = getDeepActiveElement();
154
177
  if (!(ae instanceof HTMLElement)) return;
@@ -1660,7 +1683,7 @@ function readRadiusValues(el) {
1660
1683
  }
1661
1684
 
1662
1685
  // src/version.ts
1663
- var WEEVAR_VERSION = "1.2.0";
1686
+ var WEEVAR_VERSION = "2.0.1";
1664
1687
  function weevarVersionLabel() {
1665
1688
  return `v${WEEVAR_VERSION}`;
1666
1689
  }
@@ -2194,7 +2217,8 @@ function ColorPicker({
2194
2217
  setHexRaw(displayOpaqueHex);
2195
2218
  hexFieldBaselineRef.current = displayOpaqueHex.toLowerCase();
2196
2219
  },
2197
- onChange: (raw) => {
2220
+ onChange: (e) => {
2221
+ const raw = e.target.value;
2198
2222
  setHexRaw(raw);
2199
2223
  if (isValidOpaqueHex(raw)) {
2200
2224
  onChange(
@@ -2249,7 +2273,8 @@ function ColorPicker({
2249
2273
  setAlphaRaw(formatAlphaPercent(displayAlphaPercent));
2250
2274
  alphaFieldBaselineRef.current = formatAlphaPercent(displayAlphaPercent);
2251
2275
  },
2252
- onChange: (raw) => {
2276
+ onChange: (e) => {
2277
+ const raw = e.target.value;
2253
2278
  setAlphaRaw(raw);
2254
2279
  const pct = parseAlphaPercentInput(raw);
2255
2280
  if (pct != null) {
@@ -10393,10 +10418,8 @@ body *:focus {
10393
10418
  const onShortcut = (e) => {
10394
10419
  if (e.defaultPrevented) return;
10395
10420
  if (e.metaKey || e.ctrlKey || e.altKey) return;
10396
- const t = e.target;
10397
- if (t instanceof HTMLElement) {
10398
- if (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable) return;
10399
- }
10421
+ if (editSelectionTrayVisible) return;
10422
+ if (shouldIgnoreWeevarShortcut(e)) return;
10400
10423
  const k = e.key.toLowerCase();
10401
10424
  if (k === "p") {
10402
10425
  e.preventDefault();
@@ -10452,6 +10475,7 @@ body *:focus {
10452
10475
  };
10453
10476
  }, [
10454
10477
  sessionOn,
10478
+ editSelectionTrayVisible,
10455
10479
  cancelDrag,
10456
10480
  setSessionOn,
10457
10481
  generateFromBatch,
@@ -11528,6 +11552,7 @@ function Weevar(props) {
11528
11552
  const owner = existingHost.getAttribute(WEEVAR_HOST_OWNER_ATTR);
11529
11553
  if (owner && owner !== WEEVAR_HOST_OWNER_TOKEN) {
11530
11554
  if (owner.startsWith("weevar-")) {
11555
+ setWeevarClosedShadowRoot(null);
11531
11556
  existingHost.remove();
11532
11557
  } else {
11533
11558
  if (undefined.DEV && !warnedAboutForeignHostOwner) {
@@ -11539,6 +11564,7 @@ function Weevar(props) {
11539
11564
  return false;
11540
11565
  }
11541
11566
  } else {
11567
+ setWeevarClosedShadowRoot(null);
11542
11568
  existingHost.remove();
11543
11569
  }
11544
11570
  }
@@ -11548,6 +11574,7 @@ function Weevar(props) {
11548
11574
  host.style.cssText = "position:fixed;inset:0;pointer-events:none;z-index:2147483646;";
11549
11575
  document.body.appendChild(host);
11550
11576
  const shadow = host.attachShadow({ mode: "closed" });
11577
+ setWeevarClosedShadowRoot(shadow);
11551
11578
  const mount = document.createElement("div");
11552
11579
  shadow.appendChild(mount);
11553
11580
  const root = client.createRoot(mount);
@@ -11590,12 +11617,7 @@ function Weevar(props) {
11590
11617
  react.useEffect(() => {
11591
11618
  if (disabled) return;
11592
11619
  const onKey = (e) => {
11593
- const target = e.target;
11594
- if (target instanceof HTMLElement) {
11595
- const tag = target.tagName;
11596
- if (tag === "INPUT" || tag === "TEXTAREA" || target.isContentEditable)
11597
- return;
11598
- }
11620
+ if (shouldIgnoreWeevarShortcut(e)) return;
11599
11621
  const match = keybind ? matchCustomKeybind(e, keybind) : defaultMatchKeybind(e);
11600
11622
  if (!match) return;
11601
11623
  e.preventDefault();
@@ -11613,6 +11635,7 @@ function Weevar(props) {
11613
11635
  window.setTimeout(() => {
11614
11636
  root?.unmount();
11615
11637
  if (ownedHost && ownedHost.getAttribute(WEEVAR_HOST_OWNER_ATTR) === WEEVAR_HOST_OWNER_TOKEN) {
11638
+ setWeevarClosedShadowRoot(null);
11616
11639
  ownedHost.remove();
11617
11640
  }
11618
11641
  }, 0);