@baleada/logic 0.22.2 → 0.22.3

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/lib/index.cjs CHANGED
@@ -308,7 +308,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
308
308
  }
309
309
  };
310
310
  }
311
- if (type === "click" || type === "mousedown" || type === "mouseup" || type === "dblclick" || type === "contextmenu") {
311
+ if (type === "click" || type === "dblclick" || type === "contextmenu" || type.startsWith("mouse")) {
312
312
  return (event) => {
313
313
  const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true], api = {
314
314
  is: (clickcombo) => eventMatchesClickcombo(event, ensureClickcombo(clickcombo))
@@ -323,7 +323,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
323
323
  }
324
324
  };
325
325
  }
326
- if (type === "pointerdown" || type === "pointerup") {
326
+ if (type.startsWith("pointer")) {
327
327
  return (event) => {
328
328
  const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => lazyCollections.some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true], api = {
329
329
  is: (pointercombo) => eventMatchesPointercombo(event, ensurePointercombo(pointercombo))
package/lib/index.d.ts CHANGED
@@ -454,10 +454,10 @@ declare class Recognizeable<Type extends ListenableSupportedType, Metadata exten
454
454
  declare type ListenableSupportedType = 'recognizeable' | 'intersect' | 'mutate' | 'resize' | 'idle' | ListenableMediaQuery | keyof Omit<HTMLElementEventMap, 'resize'> | keyof Omit<DocumentEventMap, 'resize'>;
455
455
  declare type ListenableMediaQuery = `(${string})`;
456
456
  declare type ListenableClickcombo = `${string}+${ListenableLeftClick | ListenableRightClick}`;
457
- declare type ListenableLeftClick = 'click' | 'mousedown' | 'mouseup' | 'dblclick';
457
+ declare type ListenableLeftClick = 'click' | 'dblclick' | `mouse${string}`;
458
458
  declare type ListenableRightClick = 'rightclick' | 'contextmenu';
459
459
  declare type ListenablePointercombo = `${string}+${ListenablePointer}`;
460
- declare type ListenablePointer = 'pointerdown' | 'pointerup';
460
+ declare type ListenablePointer = `pointer${string}`;
461
461
  declare type ListenableKeycombo = string;
462
462
  declare type ListenableSupportedEventType = keyof Omit<HTMLElementEventMap, 'resize'> | keyof Omit<DocumentEventMap, 'resize'>;
463
463
  declare type ListenableOptions<Type extends ListenableSupportedType, RecognizeableMetadata extends Record<any, any> = Record<any, any>> = {
package/lib/index.js CHANGED
@@ -297,7 +297,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
297
297
  }
298
298
  };
299
299
  }
300
- if (type === "click" || type === "mousedown" || type === "mouseup" || type === "dblclick" || type === "contextmenu") {
300
+ if (type === "click" || type === "dblclick" || type === "contextmenu" || type.startsWith("mouse")) {
301
301
  return (event) => {
302
302
  const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true], api = {
303
303
  is: (clickcombo) => eventMatchesClickcombo(event, ensureClickcombo(clickcombo))
@@ -312,7 +312,7 @@ function createExceptAndOnlyEffect(type, effect, options) {
312
312
  }
313
313
  };
314
314
  }
315
- if (type === "pointerdown" || type === "pointerup") {
315
+ if (type.startsWith("pointer")) {
316
316
  return (event) => {
317
317
  const { target } = event, [matchesOnly, matchesExcept] = target instanceof Element ? createMap((selectors) => some((selector) => target.matches(selector))(selectors))([only, except]) : [false, true], api = {
318
318
  is: (pointercombo) => eventMatchesPointercombo(event, ensurePointercombo(pointercombo))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baleada/logic",
3
- "version": "0.22.2",
3
+ "version": "0.22.3",
4
4
  "description": "UI logic for the Baleada toolkit",
5
5
  "main": "lib/index.cjs",
6
6
  "module": "lib/index.js",