sia-reactor 0.0.40 → 0.0.41

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.
@@ -1159,9 +1159,9 @@ function assignEl(el, props, dataset, styles, nodiff = true) {
1159
1159
  }
1160
1160
  return el;
1161
1161
  }
1162
- function getActiveEl(root) {
1162
+ function getActiveEl(root, noBody = true) {
1163
1163
  const activeEl = (root ?? document).activeElement;
1164
- return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
1164
+ return !activeEl || noBody && activeEl === document.body ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
1165
1165
  }
1166
1166
 
1167
1167
  // src/ts/utils/keys.ts
@@ -2,9 +2,9 @@ import {
2
2
  Autotracker,
3
3
  TimeTravelConsole,
4
4
  withTracker
5
- } from "../chunk-ENEEV334.js";
6
- import "../chunk-KPJ5SPXP.js";
7
- import "../chunk-ORK3EGB6.js";
5
+ } from "../chunk-A2SOELR6.js";
6
+ import "../chunk-AW22CQWE.js";
7
+ import "../chunk-PJTPFVEG.js";
8
8
  import {
9
9
  CTX,
10
10
  NIL,
@@ -1079,9 +1079,9 @@ function assignEl(el, props, dataset, styles, nodiff = true) {
1079
1079
  }
1080
1080
  return el;
1081
1081
  }
1082
- function getActiveEl(root) {
1082
+ function getActiveEl(root, noBody = true) {
1083
1083
  const activeEl = (root ?? document).activeElement;
1084
- return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
1084
+ return !activeEl || noBody && activeEl === document.body ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
1085
1085
  }
1086
1086
 
1087
1087
  // src/ts/utils/keys.ts
@@ -3,9 +3,9 @@ import {
3
3
  TimeTravelConsole,
4
4
  effect,
5
5
  withTracker
6
- } from "../chunk-ENEEV334.js";
7
- import "../chunk-KPJ5SPXP.js";
8
- import "../chunk-ORK3EGB6.js";
6
+ } from "../chunk-A2SOELR6.js";
7
+ import "../chunk-AW22CQWE.js";
8
+ import "../chunk-PJTPFVEG.js";
9
9
  import "../chunk-LZJYX2LE.js";
10
10
  export {
11
11
  Autotracker,
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  wpArr
3
- } from "./chunk-KPJ5SPXP.js";
3
+ } from "./chunk-AW22CQWE.js";
4
4
  import {
5
5
  KEYS_BLOCKS,
6
6
  createEl,
7
7
  formatKeyForDisplay,
8
8
  keyEventAllowed,
9
9
  parseForARIAKS
10
- } from "./chunk-ORK3EGB6.js";
10
+ } from "./chunk-PJTPFVEG.js";
11
11
  import {
12
12
  CTX,
13
13
  NIL,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  guardAllMethods,
3
3
  guardMethod
4
- } from "./chunk-ORK3EGB6.js";
4
+ } from "./chunk-PJTPFVEG.js";
5
5
  import {
6
6
  getPath,
7
7
  getReactor,
@@ -54,16 +54,16 @@ function assignEl(el, props, dataset, styles, nodiff = true) {
54
54
  }
55
55
  return el;
56
56
  }
57
- function getActiveEl(root) {
57
+ function getActiveEl(root, noBody = true) {
58
58
  const activeEl = (root ?? document).activeElement;
59
- return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
59
+ return !activeEl || noBody && activeEl === document.body ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
60
60
  }
61
61
 
62
62
  // src/ts/utils/keys.ts
63
63
  var KEYS_BLOCKS = ["Ctrl+Tab", "Ctrl+Shift+Tab", "Ctrl+PageUp", "Ctrl+PageDown", "Cmd+Option+ArrowRight", "Cmd+Option+ArrowLeft", "Ctrl+1", "Ctrl+2", "Ctrl+3", "Ctrl+4", "Ctrl+5", "Ctrl+6", "Ctrl+7", "Ctrl+8", "Ctrl+9", "Cmd+1", "Cmd+2", "Cmd+3", "Cmd+4", "Cmd+5", "Cmd+6", "Cmd+7", "Cmd+8", "Cmd+9", "Alt+ArrowLeft", "Alt+ArrowRight", "Cmd+ArrowLeft", "Cmd+ArrowRight", "Ctrl+r", "Ctrl+Shift+r", "F5", "Shift+F5", "Cmd+r", "Cmd+Shift+r", "Ctrl+h", "Ctrl+j", "Ctrl+d", "Ctrl+f", "Cmd+y", "Cmd+Option+b", "Cmd+d", "Cmd+f", "Ctrl+Shift+i", "Ctrl+Shift+j", "Ctrl+Shift+c", "Ctrl+u", "F12", "Cmd+Option+i", "Cmd+Option+j", "Cmd+Option+c", "Cmd+Option+u", "Ctrl+=", "Ctrl+-", "Ctrl+0", "Cmd+=", "Cmd+-", "Cmd+0", "Ctrl+p", "Ctrl+s", "Ctrl+o", "Cmd+p", "Cmd+s", "Cmd+o"];
64
64
  function parseKeyCombo(combo) {
65
65
  const parts = cleanKeyCombo(combo).toLowerCase().split("+");
66
- return { ctrlKey: parts.includes("ctrl"), shiftKey: parts.includes("shift"), altKey: parts.includes("alt"), metaKey: parts.includes("meta") || parts.includes("cmd"), key: parts.find((p) => !["ctrl", "shift", "alt", "meta", "cmd"].includes(p)) || "" };
66
+ return { ctrlKey: parts.includes("ctrl"), shiftKey: parts.includes("shift"), altKey: parts.includes("alt"), metaKey: parts.includes("meta") || parts.includes("cmd"), key: parts.find((p) => !/^(ctrl|shift|alt|meta|cmd)$/.test(p)) || "" };
67
67
  }
68
68
  function stringifyKeyEvent(e) {
69
69
  const parts = [];
package/dist/modules.js CHANGED
@@ -5,8 +5,8 @@ import {
5
5
  } from "./chunk-JGEI2Q4M.js";
6
6
  import {
7
7
  BaseReactorModule
8
- } from "./chunk-KPJ5SPXP.js";
9
- import "./chunk-ORK3EGB6.js";
8
+ } from "./chunk-AW22CQWE.js";
9
+ import "./chunk-PJTPFVEG.js";
10
10
  import {
11
11
  CTX,
12
12
  NIL,
package/dist/super.d.ts CHANGED
@@ -1558,9 +1558,10 @@ declare function assignEl<El extends HTMLElement>(el?: El | null, props?: Partia
1558
1558
  declare function assignEl<El extends HTMLElement>(el?: El | null, props?: Partial<El>, dataset?: Dataset, styles?: Style, nodiff?: boolean): El | null;
1559
1559
  /** Get the currently active element, traversing into shadow roots if necessary.
1560
1560
  * @param root Root node to start searching from, defaults to the main document.
1561
+ * @param noBody If `true`, will return `null` if the active element is the body element.
1561
1562
  * @returns The active element or null if none found.
1562
1563
  */
1563
- declare function getActiveEl(root?: Document | ShadowRoot | null): Element | null;
1564
+ declare function getActiveEl(root?: Document | ShadowRoot | null, noBody?: boolean): Element | null;
1564
1565
 
1565
1566
  type utils_FanoutOptionsTuple = FanoutOptionsTuple;
1566
1567
  declare const utils_KEYS_BLOCKS: typeof KEYS_BLOCKS;
@@ -1251,16 +1251,16 @@ var sia = (() => {
1251
1251
  }
1252
1252
  return el;
1253
1253
  }
1254
- function getActiveEl(root) {
1254
+ function getActiveEl(root, noBody = true) {
1255
1255
  const activeEl = (root ?? document).activeElement;
1256
- return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
1256
+ return !activeEl || noBody && activeEl === document.body ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
1257
1257
  }
1258
1258
 
1259
1259
  // src/ts/utils/keys.ts
1260
1260
  var KEYS_BLOCKS = ["Ctrl+Tab", "Ctrl+Shift+Tab", "Ctrl+PageUp", "Ctrl+PageDown", "Cmd+Option+ArrowRight", "Cmd+Option+ArrowLeft", "Ctrl+1", "Ctrl+2", "Ctrl+3", "Ctrl+4", "Ctrl+5", "Ctrl+6", "Ctrl+7", "Ctrl+8", "Ctrl+9", "Cmd+1", "Cmd+2", "Cmd+3", "Cmd+4", "Cmd+5", "Cmd+6", "Cmd+7", "Cmd+8", "Cmd+9", "Alt+ArrowLeft", "Alt+ArrowRight", "Cmd+ArrowLeft", "Cmd+ArrowRight", "Ctrl+r", "Ctrl+Shift+r", "F5", "Shift+F5", "Cmd+r", "Cmd+Shift+r", "Ctrl+h", "Ctrl+j", "Ctrl+d", "Ctrl+f", "Cmd+y", "Cmd+Option+b", "Cmd+d", "Cmd+f", "Ctrl+Shift+i", "Ctrl+Shift+j", "Ctrl+Shift+c", "Ctrl+u", "F12", "Cmd+Option+i", "Cmd+Option+j", "Cmd+Option+c", "Cmd+Option+u", "Ctrl+=", "Ctrl+-", "Ctrl+0", "Cmd+=", "Cmd+-", "Cmd+0", "Ctrl+p", "Ctrl+s", "Ctrl+o", "Cmd+p", "Cmd+s", "Cmd+o"];
1261
1261
  function parseKeyCombo(combo) {
1262
1262
  const parts = cleanKeyCombo(combo).toLowerCase().split("+");
1263
- return { ctrlKey: parts.includes("ctrl"), shiftKey: parts.includes("shift"), altKey: parts.includes("alt"), metaKey: parts.includes("meta") || parts.includes("cmd"), key: parts.find((p) => !["ctrl", "shift", "alt", "meta", "cmd"].includes(p)) || "" };
1263
+ return { ctrlKey: parts.includes("ctrl"), shiftKey: parts.includes("shift"), altKey: parts.includes("alt"), metaKey: parts.includes("meta") || parts.includes("cmd"), key: parts.find((p) => !/^(ctrl|shift|alt|meta|cmd)$/.test(p)) || "" };
1264
1264
  }
1265
1265
  function stringifyKeyEvent(e) {
1266
1266
  const parts = [];
package/dist/utils.cjs CHANGED
@@ -1164,16 +1164,16 @@ function assignEl(el, props, dataset, styles, nodiff = true) {
1164
1164
  }
1165
1165
  return el;
1166
1166
  }
1167
- function getActiveEl(root) {
1167
+ function getActiveEl(root, noBody = true) {
1168
1168
  const activeEl = (root ?? document).activeElement;
1169
- return !activeEl ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
1169
+ return !activeEl || noBody && activeEl === document.body ? null : activeEl.shadowRoot ? getActiveEl(activeEl.shadowRoot) : activeEl;
1170
1170
  }
1171
1171
 
1172
1172
  // src/ts/utils/keys.ts
1173
1173
  var KEYS_BLOCKS = ["Ctrl+Tab", "Ctrl+Shift+Tab", "Ctrl+PageUp", "Ctrl+PageDown", "Cmd+Option+ArrowRight", "Cmd+Option+ArrowLeft", "Ctrl+1", "Ctrl+2", "Ctrl+3", "Ctrl+4", "Ctrl+5", "Ctrl+6", "Ctrl+7", "Ctrl+8", "Ctrl+9", "Cmd+1", "Cmd+2", "Cmd+3", "Cmd+4", "Cmd+5", "Cmd+6", "Cmd+7", "Cmd+8", "Cmd+9", "Alt+ArrowLeft", "Alt+ArrowRight", "Cmd+ArrowLeft", "Cmd+ArrowRight", "Ctrl+r", "Ctrl+Shift+r", "F5", "Shift+F5", "Cmd+r", "Cmd+Shift+r", "Ctrl+h", "Ctrl+j", "Ctrl+d", "Ctrl+f", "Cmd+y", "Cmd+Option+b", "Cmd+d", "Cmd+f", "Ctrl+Shift+i", "Ctrl+Shift+j", "Ctrl+Shift+c", "Ctrl+u", "F12", "Cmd+Option+i", "Cmd+Option+j", "Cmd+Option+c", "Cmd+Option+u", "Ctrl+=", "Ctrl+-", "Ctrl+0", "Cmd+=", "Cmd+-", "Cmd+0", "Ctrl+p", "Ctrl+s", "Ctrl+o", "Cmd+p", "Cmd+s", "Cmd+o"];
1174
1174
  function parseKeyCombo(combo) {
1175
1175
  const parts = cleanKeyCombo(combo).toLowerCase().split("+");
1176
- return { ctrlKey: parts.includes("ctrl"), shiftKey: parts.includes("shift"), altKey: parts.includes("alt"), metaKey: parts.includes("meta") || parts.includes("cmd"), key: parts.find((p) => !["ctrl", "shift", "alt", "meta", "cmd"].includes(p)) || "" };
1176
+ return { ctrlKey: parts.includes("ctrl"), shiftKey: parts.includes("shift"), altKey: parts.includes("alt"), metaKey: parts.includes("meta") || parts.includes("cmd"), key: parts.find((p) => !/^(ctrl|shift|alt|meta|cmd)$/.test(p)) || "" };
1177
1177
  }
1178
1178
  function stringifyKeyEvent(e) {
1179
1179
  const parts = [];
package/dist/utils.d.cts CHANGED
@@ -197,8 +197,9 @@ declare function assignEl<El extends HTMLElement>(el?: El | null, props?: Partia
197
197
  declare function assignEl<El extends HTMLElement>(el?: El | null, props?: Partial<El>, dataset?: Dataset, styles?: Style, nodiff?: boolean): El | null;
198
198
  /** Get the currently active element, traversing into shadow roots if necessary.
199
199
  * @param root Root node to start searching from, defaults to the main document.
200
+ * @param noBody If `true`, will return `null` if the active element is the body element.
200
201
  * @returns The active element or null if none found.
201
202
  */
202
- declare function getActiveEl(root?: Document | ShadowRoot | null): Element | null;
203
+ declare function getActiveEl(root?: Document | ShadowRoot | null, noBody?: boolean): Element | null;
203
204
 
204
205
  export { KEYS_BLOCKS, type KeyStruct, type KeysSettings, assignEl, bindAllMethods, clamp, cleanKeyCombo, createEl, formatKeyForDisplay, formatKeyShortcutsForDisplay, getActiveEl, getTermsForKey, guardAllMethods, guardMethod, keyEventAllowed, matchKeys, onAllMethods, parseForARIAKS, parseKeyCombo, requestAnimationFrame, setInterval, setTimeout, stringifyKeyEvent };
package/dist/utils.d.ts CHANGED
@@ -197,8 +197,9 @@ declare function assignEl<El extends HTMLElement>(el?: El | null, props?: Partia
197
197
  declare function assignEl<El extends HTMLElement>(el?: El | null, props?: Partial<El>, dataset?: Dataset, styles?: Style, nodiff?: boolean): El | null;
198
198
  /** Get the currently active element, traversing into shadow roots if necessary.
199
199
  * @param root Root node to start searching from, defaults to the main document.
200
+ * @param noBody If `true`, will return `null` if the active element is the body element.
200
201
  * @returns The active element or null if none found.
201
202
  */
202
- declare function getActiveEl(root?: Document | ShadowRoot | null): Element | null;
203
+ declare function getActiveEl(root?: Document | ShadowRoot | null, noBody?: boolean): Element | null;
203
204
 
204
205
  export { KEYS_BLOCKS, type KeyStruct, type KeysSettings, assignEl, bindAllMethods, clamp, cleanKeyCombo, createEl, formatKeyForDisplay, formatKeyShortcutsForDisplay, getActiveEl, getTermsForKey, guardAllMethods, guardMethod, keyEventAllowed, matchKeys, onAllMethods, parseForARIAKS, parseKeyCombo, requestAnimationFrame, setInterval, setTimeout, stringifyKeyEvent };
package/dist/utils.js CHANGED
@@ -22,7 +22,7 @@ import {
22
22
  parseForARIAKS,
23
23
  parseKeyCombo,
24
24
  stringifyKeyEvent
25
- } from "./chunk-ORK3EGB6.js";
25
+ } from "./chunk-PJTPFVEG.js";
26
26
  import {
27
27
  arrRegex,
28
28
  canHandle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sia-reactor",
3
- "version": "0.0.40",
3
+ "version": "0.0.41",
4
4
  "description": "The Programmable Data DOM. A high-performance State & Intent Architecture (S.I.A.) engine that gives your data transactional mutation routing and multi-phase state observation.",
5
5
  "author": "Oketade Oluwatobiloba <tobioketade007@gmail.com>",
6
6
  "license": "MIT",
@@ -60,10 +60,10 @@
60
60
  },
61
61
  "scripts": {
62
62
  "build": "tsup",
63
+ "build:demo": "vite build --config demo/vite.config.ts",
63
64
  "test": "vitest --reporter=verbose",
64
65
  "test:run": "vitest run --reporter=verbose",
65
66
  "demo": "vite --config demo/vite.config.ts",
66
- "demo:build": "vite build --config demo/vite.config.ts",
67
67
  "demo:preview": "vite preview --config demo/vite.config.ts",
68
68
  "change": "changeset",
69
69
  "bump": "changeset version",