@t007/toast 0.0.35 → 0.0.37

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/index.d.ts CHANGED
@@ -18,7 +18,7 @@ interface ToastOptions {
18
18
  /** Delay before the toast is initialized. */
19
19
  delay?: number | null;
20
20
  /** Container element used to host toast stacks. */
21
- rootElement?: HTMLElement;
21
+ rootElement?: HTMLElement | null;
22
22
  /** Text rendered as the toast body. */
23
23
  render?: string | (() => string);
24
24
  /** Rich HTML rendered as the toast body. */
@@ -13,7 +13,7 @@
13
13
  return sig.addEventListener("abort", kill, { once: true }), id;
14
14
  }
15
15
 
16
- // ../../../sia-reactor/dist/chunk-ORK3EGB6.js
16
+ // ../../../sia-reactor/dist/chunk-PJTPFVEG.js
17
17
  function onAllMethods(owner, callback, skipOwn = true, nested = false) {
18
18
  let proto = owner;
19
19
  while (proto && proto !== Object.prototype) {
@@ -53,7 +53,7 @@
53
53
  return el;
54
54
  }
55
55
 
56
- // ../../../sia-reactor/dist/chunk-WYSENFHG.js
56
+ // ../../../sia-reactor/dist/chunk-LZJYX2LE.js
57
57
  var RTR_BATCH = "undefined" !== typeof window ? ("undefined" !== typeof queueMicrotask ? queueMicrotask : setTimeout).bind(window) : "undefined" !== typeof process && process.nextTick ? process.nextTick : setTimeout;
58
58
  var RTR_LOG = console.log.bind(console, "[S.I.A Reactor]");
59
59
  var NIL = Object.freeze({});
@@ -62,13 +62,34 @@
62
62
  isDevEnv = process.env.NODE_ENV !== "production";
63
63
  } catch (e) {
64
64
  }
65
+ var CTX_BUILD = {
66
+ /** Flag indicating whether the application is running in development mode. */
67
+ isDevEnv,
68
+ /** Flag indicating whether an operation is bypassing checks so reactors can allow all writes. */
69
+ usingForce: false,
70
+ /** Active `Autotracker` instance, override for automatic dependency collection on `Reactor` traps. */
71
+ autotracker: null,
72
+ /** Extensible meta context for payloads and cross-cutting concerns. */
73
+ meta: null,
74
+ /** Default configuration for new `Reactor` instances and also fallback for utils that need and are called without these options. */
75
+ defaults: {
76
+ crossRealms: false,
77
+ smartCloning: false,
78
+ eventBubbling: true,
79
+ eventCapturing: "auto",
80
+ lineageTracing: false,
81
+ preserveContext: false,
82
+ equalityFunction: Object.is,
83
+ batchingFunction: RTR_BATCH
84
+ }
85
+ };
86
+ var CTX = globalThis[/* @__PURE__ */ Symbol.for("S.I.A_CTX")] ??= CTX_BUILD;
65
87
  function isObj(obj, arraycheck = true) {
66
88
  return "object" === typeof obj && obj !== null && (arraycheck ? !Array.isArray(obj) : true);
67
89
  }
68
90
 
69
- // ../utils/dist/chunk-ZOFWWRKV.js
91
+ // ../utils/dist/chunk-ZFW6HNGO.js
70
92
  var INTERACTIVE_SELECTOR = ":is(button,[href],input:not([type='hidden']),select,textarea,details>summary,[contenteditable],iframe,audio[controls],video[controls],[tabindex]):not([disabled],[tabindex='-1'],[data-focus-guard],[inert],[inert] *)";
71
- var isInteractive = (target) => target instanceof HTMLElement && target.matches(INTERACTIVE_SELECTOR);
72
93
  var VIRTUAL_RESOURCE = /* @__PURE__ */ Symbol.for("T007_VIRTUAL_RESOURCE");
73
94
  function loadResource(req, type = "style", { module, media, crossOrigin, integrity, referrerPolicy, nonce, fetchPriority, attempts = 3, retryKey = false } = {}, win = window) {
74
95
  win.t007 ??= {}, win.t007._resourceCache ??= {};
@@ -366,7 +387,7 @@
366
387
  _handleToastPointerStart(e) {
367
388
  if (isStr(this._ptrType) && e.pointerType !== this._ptrType) return;
368
389
  if (e.touches?.length > 1) return;
369
- !isInteractive(e.target) && this.toastElement.setPointerCapture(e.pointerId);
390
+ !e.target.closest(INTERACTIVE_SELECTOR) && this.toastElement.setPointerCapture(e.pointerId);
370
391
  this.#isPaused = true;
371
392
  this._ptrTicker = this._ptrDirSet = this._ptrDir = false;
372
393
  this._ptrStartX = e.clientX ?? e.targetTouches[0]?.clientX;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/js/index.js
2
- import { isStr, isNum, isObj, isFunc, clamp, uid, bindAllMethods, isInteractive, createEl, loadResource, isDef, setTimeout, bindCleanupToSignal } from "@t007/utils";
2
+ import { isStr, isNum, isObj, isFunc, clamp, uid, bindAllMethods, createEl, loadResource, isDef, setTimeout, bindCleanupToSignal, INTERACTIVE_SELECTOR } from "@t007/utils";
3
3
  var T007_Toast = class {
4
4
  #constructed = false;
5
5
  // to minimize updates
@@ -219,7 +219,7 @@ var T007_Toast = class {
219
219
  _handleToastPointerStart(e) {
220
220
  if (isStr(this._ptrType) && e.pointerType !== this._ptrType) return;
221
221
  if (e.touches?.length > 1) return;
222
- !isInteractive(e.target) && this.toastElement.setPointerCapture(e.pointerId);
222
+ !e.target.closest(INTERACTIVE_SELECTOR) && this.toastElement.setPointerCapture(e.pointerId);
223
223
  this.#isPaused = true;
224
224
  this._ptrTicker = this._ptrDirSet = this._ptrDir = false;
225
225
  this._ptrStartX = e.clientX ?? e.targetTouches[0]?.clientX;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@t007/toast",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "A lightweight, pure JS toast system.",
5
5
  "author": "Oketade Oluwatobiloba <tobioketade007@gmail.com>",
6
6
  "license": "MIT",
@@ -55,7 +55,7 @@
55
55
  "promise"
56
56
  ],
57
57
  "dependencies": {
58
- "@t007/utils": "^0.0.36"
58
+ "@t007/utils": "^0.0.38"
59
59
  },
60
60
  "devDependencies": {
61
61
  "esbuild-sass-plugin": "^3.7.0"