@testing-library/user-event
Advanced tools
Comparing version 14.4.0 to 14.4.1
@@ -27,3 +27,4 @@ 'use strict'; | ||
const doc = this[config.Config].document; | ||
const target = doc.activeElement ?? /* istanbul ignore next */ doc.body; | ||
var _activeElement; | ||
const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body; | ||
const clipboardData = copySelection.copySelection(target); | ||
@@ -30,0 +31,0 @@ if (clipboardData.items.length === 0) { |
@@ -27,3 +27,4 @@ 'use strict'; | ||
const doc = this[config.Config].document; | ||
const target = doc.activeElement ?? /* istanbul ignore next */ doc.body; | ||
var _activeElement; | ||
const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body; | ||
const clipboardData = copySelection.copySelection(target); | ||
@@ -30,0 +31,0 @@ if (clipboardData.items.length === 0) { |
@@ -27,4 +27,6 @@ 'use strict'; | ||
const doc = this[config.Config].document; | ||
const target = doc.activeElement ?? /* istanbul ignore next */ doc.body; | ||
const dataTransfer = (typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) ?? await Clipboard.readDataTransferFromClipboard(doc).catch(()=>{ | ||
var _activeElement; | ||
const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body; | ||
var ref; | ||
const dataTransfer = (ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && ref !== void 0 ? ref : await Clipboard.readDataTransferFromClipboard(doc).catch(()=>{ | ||
throw new Error('`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.'); | ||
@@ -31,0 +33,0 @@ }); |
@@ -9,4 +9,4 @@ 'use strict'; | ||
const objectDescriptor = Object.getOwnPropertyDescriptor(element, propName); | ||
const target = prototypeDescriptor?.set ? 'set' : 'value'; | ||
/* istanbul ignore if */ if (typeof prototypeDescriptor?.[target] !== 'function' || prototypeDescriptor[target][Interceptor]) { | ||
const target = (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor.set) ? 'set' : 'value'; | ||
/* istanbul ignore if */ if (typeof (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) { | ||
throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`); | ||
@@ -22,7 +22,7 @@ } | ||
} | ||
then?.(); | ||
then === null || then === void 0 ? void 0 : then(); | ||
} | ||
intercept[Interceptor] = Interceptor; | ||
Object.defineProperty(element, propName, { | ||
...objectDescriptor ?? prototypeDescriptor, | ||
...objectDescriptor !== null && objectDescriptor !== void 0 ? objectDescriptor : prototypeDescriptor, | ||
[target]: intercept | ||
@@ -29,0 +29,0 @@ }); |
@@ -86,5 +86,6 @@ 'use strict'; | ||
function getUISelection(element) { | ||
const sel = element[UISelection] ?? { | ||
anchorOffset: element.selectionStart ?? 0, | ||
focusOffset: element.selectionEnd ?? 0 | ||
var _selectionStart, _selectionEnd, _UISelection; | ||
const sel = (_UISelection = element[UISelection]) !== null && _UISelection !== void 0 ? _UISelection : { | ||
anchorOffset: (_selectionStart = element.selectionStart) !== null && _selectionStart !== void 0 ? _selectionStart : 0, | ||
focusOffset: (_selectionEnd = element.selectionEnd) !== null && _selectionEnd !== void 0 ? _selectionEnd : 0 | ||
}; | ||
@@ -91,0 +92,0 @@ return { |
@@ -94,3 +94,4 @@ 'use strict'; | ||
function trackOrSetValue(element, v) { | ||
element[TrackChanges]?.tracked?.push(v); | ||
var ref, ref1; | ||
(ref = element[TrackChanges]) === null || ref === void 0 ? void 0 : (ref1 = ref.tracked) === null || ref1 === void 0 ? void 0 : ref1.push(v); | ||
if (!element[TrackChanges]) { | ||
@@ -104,5 +105,6 @@ setUIValueClean(element); | ||
function commitValueAfterInput(element, cursorOffset) { | ||
var ref; | ||
const changes = element[TrackChanges]; | ||
element[TrackChanges] = undefined; | ||
if (!changes?.tracked?.length) { | ||
if (!(changes === null || changes === void 0 ? void 0 : (ref = changes.tracked) === null || ref === void 0 ? void 0 : ref.length)) { | ||
return; | ||
@@ -109,0 +111,0 @@ } |
@@ -30,3 +30,5 @@ 'use strict'; | ||
registry.behavior.keydown = (event, target, config)=>{ | ||
return keydownBehavior[event.key]?.(event, target, config) ?? combinationBehavior(event, target, config); | ||
var ref; | ||
var ref1; | ||
return (ref1 = (ref = keydownBehavior[event.key]) === null || ref === void 0 ? void 0 : ref.call(keydownBehavior, event, target, config)) !== null && ref1 !== void 0 ? ref1 : combinationBehavior(event, target, config); | ||
}; | ||
@@ -84,3 +86,5 @@ const keydownBehavior = { | ||
return ()=>{ | ||
const newPos = getValue.getValue(target)?.length ?? /* istanbul ignore next */ 0; | ||
var ref; | ||
var ref1; | ||
const newPos = (ref1 = (ref = getValue.getValue(target)) === null || ref === void 0 ? void 0 : ref.length) !== null && ref1 !== void 0 ? ref1 : /* istanbul ignore next */ 0; | ||
selection.setSelectionRange(target, newPos, newPos); | ||
@@ -87,0 +91,0 @@ }; |
@@ -25,3 +25,3 @@ 'use strict'; | ||
const form = target.form; | ||
const submit = form?.querySelector('input[type="submit"], button:not([type]), button[type="submit"]'); | ||
const submit = form === null || form === void 0 ? void 0 : form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]'); | ||
if (submit) { | ||
@@ -28,0 +28,0 @@ return ()=>index.dispatchUIEvent(config, submit, 'click'); |
@@ -16,3 +16,4 @@ 'use strict'; | ||
registry.behavior.keyup = (event, target, config)=>{ | ||
return keyupBehavior[event.key]?.(event, target, config); | ||
var ref; | ||
return (ref = keyupBehavior[event.key]) === null || ref === void 0 ? void 0 : ref.call(keyupBehavior, event, target, config); | ||
}; | ||
@@ -19,0 +20,0 @@ const keyupBehavior = { |
@@ -23,3 +23,4 @@ 'use strict'; | ||
return ()=>{ | ||
const insertData = event.clipboardData?.getData('text'); | ||
var ref; | ||
const insertData = (ref = event.clipboardData) === null || ref === void 0 ? void 0 : ref.getData('text'); | ||
if (insertData) { | ||
@@ -26,0 +27,0 @@ input.input(config, target, insertData, 'insertFromPaste'); |
@@ -48,38 +48,54 @@ 'use strict'; | ||
function createEvent(type, target, init) { | ||
var ref; | ||
const window = getWindow.getWindow(target); | ||
const { EventType , defaultInit } = eventMap.eventMap[eventMap.eventMapKeys[type]]; | ||
const event = new (getEventConstructors(window))[EventType](type, defaultInit); | ||
eventInitializer[EventType]?.forEach((f)=>f(event, init ?? {})); | ||
(ref = eventInitializer[EventType]) === null || ref === void 0 ? void 0 : ref.forEach((f)=>f(event, init !== null && init !== void 0 ? init : {})); | ||
return event; | ||
} | ||
/* istanbul ignore next */ function getEventConstructors(window) { | ||
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = window.Event ?? class Event { | ||
var _Event; | ||
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (_Event = window.Event) !== null && _Event !== void 0 ? _Event : class Event { | ||
}; | ||
const AnimationEvent = window.AnimationEvent ?? class AnimationEvent extends Event { | ||
var _AnimationEvent; | ||
const AnimationEvent = (_AnimationEvent = window.AnimationEvent) !== null && _AnimationEvent !== void 0 ? _AnimationEvent : class AnimationEvent extends Event { | ||
}; | ||
const ClipboardEvent = window.ClipboardEvent ?? class ClipboardEvent extends Event { | ||
var _ClipboardEvent; | ||
const ClipboardEvent = (_ClipboardEvent = window.ClipboardEvent) !== null && _ClipboardEvent !== void 0 ? _ClipboardEvent : class ClipboardEvent extends Event { | ||
}; | ||
const PopStateEvent = window.PopStateEvent ?? class PopStateEvent extends Event { | ||
var _PopStateEvent; | ||
const PopStateEvent = (_PopStateEvent = window.PopStateEvent) !== null && _PopStateEvent !== void 0 ? _PopStateEvent : class PopStateEvent extends Event { | ||
}; | ||
const ProgressEvent = window.ProgressEvent ?? class ProgressEvent extends Event { | ||
var _ProgressEvent; | ||
const ProgressEvent = (_ProgressEvent = window.ProgressEvent) !== null && _ProgressEvent !== void 0 ? _ProgressEvent : class ProgressEvent extends Event { | ||
}; | ||
const TransitionEvent = window.TransitionEvent ?? class TransitionEvent extends Event { | ||
var _TransitionEvent; | ||
const TransitionEvent = (_TransitionEvent = window.TransitionEvent) !== null && _TransitionEvent !== void 0 ? _TransitionEvent : class TransitionEvent extends Event { | ||
}; | ||
const UIEvent = window.UIEvent ?? class UIEvent extends Event { | ||
var _UIEvent; | ||
const UIEvent = (_UIEvent = window.UIEvent) !== null && _UIEvent !== void 0 ? _UIEvent : class UIEvent extends Event { | ||
}; | ||
const CompositionEvent = window.CompositionEvent ?? class CompositionEvent extends UIEvent { | ||
var _CompositionEvent; | ||
const CompositionEvent = (_CompositionEvent = window.CompositionEvent) !== null && _CompositionEvent !== void 0 ? _CompositionEvent : class CompositionEvent extends UIEvent { | ||
}; | ||
const FocusEvent = window.FocusEvent ?? class FocusEvent extends UIEvent { | ||
var _FocusEvent; | ||
const FocusEvent = (_FocusEvent = window.FocusEvent) !== null && _FocusEvent !== void 0 ? _FocusEvent : class FocusEvent extends UIEvent { | ||
}; | ||
const InputEvent = window.InputEvent ?? class InputEvent extends UIEvent { | ||
var _InputEvent; | ||
const InputEvent = (_InputEvent = window.InputEvent) !== null && _InputEvent !== void 0 ? _InputEvent : class InputEvent extends UIEvent { | ||
}; | ||
const KeyboardEvent = window.KeyboardEvent ?? class KeyboardEvent extends UIEvent { | ||
var _KeyboardEvent; | ||
const KeyboardEvent = (_KeyboardEvent = window.KeyboardEvent) !== null && _KeyboardEvent !== void 0 ? _KeyboardEvent : class KeyboardEvent extends UIEvent { | ||
}; | ||
const MouseEvent = window.MouseEvent ?? class MouseEvent extends UIEvent { | ||
var _MouseEvent; | ||
const MouseEvent = (_MouseEvent = window.MouseEvent) !== null && _MouseEvent !== void 0 ? _MouseEvent : class MouseEvent extends UIEvent { | ||
}; | ||
const DragEvent = window.DragEvent ?? class DragEvent extends MouseEvent { | ||
var _DragEvent; | ||
const DragEvent = (_DragEvent = window.DragEvent) !== null && _DragEvent !== void 0 ? _DragEvent : class DragEvent extends MouseEvent { | ||
}; | ||
const PointerEvent = window.PointerEvent ?? class PointerEvent extends MouseEvent { | ||
var _PointerEvent; | ||
const PointerEvent = (_PointerEvent = window.PointerEvent) !== null && _PointerEvent !== void 0 ? _PointerEvent : class PointerEvent extends MouseEvent { | ||
}; | ||
const TouchEvent = window.TouchEvent ?? class TouchEvent extends UIEvent { | ||
var _TouchEvent; | ||
const TouchEvent = (_TouchEvent = window.TouchEvent) !== null && _TouchEvent !== void 0 ? _TouchEvent : class TouchEvent extends UIEvent { | ||
}; | ||
@@ -107,3 +123,3 @@ /* eslint-enable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ return { | ||
Object.defineProperty(obj, key, { | ||
get: ()=>value ?? null | ||
get: ()=>value !== null && value !== void 0 ? value : null | ||
}); | ||
@@ -113,3 +129,3 @@ } | ||
function sanitizeNumber(n) { | ||
return Number(n ?? 0); | ||
return Number(n !== null && n !== void 0 ? n : 0); | ||
} | ||
@@ -131,3 +147,3 @@ function initClipboardEvent(event, { clipboardData }) { | ||
view, | ||
detail: sanitizeNumber(detail ?? 0) | ||
detail: sanitizeNumber(detail !== null && detail !== void 0 ? detail : 0) | ||
}); | ||
@@ -134,0 +150,0 @@ } |
@@ -15,4 +15,5 @@ 'use strict'; | ||
function dispatchEvent(config, target, event, preventDefault = false) { | ||
var ref; | ||
const type = event.type; | ||
const behaviorImplementation = preventDefault ? ()=>{} : registry.behavior[type]?.(event, target, config); | ||
const behaviorImplementation = preventDefault ? ()=>{} : (ref = registry.behavior[type]) === null || ref === void 0 ? void 0 : ref(event, target, config); | ||
if (behaviorImplementation) { | ||
@@ -19,0 +20,0 @@ event.preventDefault(); |
@@ -35,10 +35,13 @@ 'use strict'; | ||
const { type , descriptor , consumedLength , releasePrevious , releaseSelf =true , repeat , } = readNextDescriptor.readNextDescriptor(text, 'keyboard'); | ||
const keyDef = keyboardMap.find((def)=>{ | ||
var ref; | ||
const keyDef = (ref = keyboardMap.find((def)=>{ | ||
if (type === '[') { | ||
return def.code?.toLowerCase() === descriptor.toLowerCase(); | ||
var ref; | ||
return ((ref = def.code) === null || ref === void 0 ? void 0 : ref.toLowerCase()) === descriptor.toLowerCase(); | ||
} else if (type === '{') { | ||
return def.key?.toLowerCase() === descriptor.toLowerCase(); | ||
var ref1; | ||
return ((ref1 = def.key) === null || ref1 === void 0 ? void 0 : ref1.toLowerCase()) === descriptor.toLowerCase(); | ||
} | ||
return def.key === descriptor; | ||
}) ?? { | ||
})) !== null && ref !== void 0 ? ref : { | ||
key: 'Unknown', | ||
@@ -45,0 +48,0 @@ code: 'Unknown', |
@@ -50,10 +50,12 @@ 'use strict'; | ||
async function pointerAction(config, action) { | ||
var ref, ref1; | ||
const pointerName = 'pointerName' in action && action.pointerName ? action.pointerName : 'keyDef' in action ? config.system.pointer.getPointerName(action.keyDef) : 'mouse'; | ||
const previousPosition = config.system.pointer.getPreviousPosition(pointerName); | ||
var _target, _coords, _node, _offset; | ||
const position = { | ||
target: action.target ?? getPrevTarget(config, previousPosition), | ||
coords: action.coords ?? previousPosition?.coords, | ||
target: (_target = action.target) !== null && _target !== void 0 ? _target : getPrevTarget(config, previousPosition), | ||
coords: (_coords = action.coords) !== null && _coords !== void 0 ? _coords : previousPosition === null || previousPosition === void 0 ? void 0 : previousPosition.coords, | ||
caret: { | ||
node: action.node ?? (hasCaretPosition(action) ? undefined : previousPosition?.caret?.node), | ||
offset: action.offset ?? (hasCaretPosition(action) ? undefined : previousPosition?.caret?.offset) | ||
node: (_node = action.node) !== null && _node !== void 0 ? _node : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (ref = previousPosition.caret) === null || ref === void 0 ? void 0 : ref.node, | ||
offset: (_offset = action.offset) !== null && _offset !== void 0 ? _offset : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (ref1 = previousPosition.caret) === null || ref1 === void 0 ? void 0 : ref1.offset | ||
} | ||
@@ -80,3 +82,4 @@ }; | ||
function hasCaretPosition(action) { | ||
return !!((action.target ?? action.node) ?? action.offset !== undefined); | ||
var _target, ref; | ||
return !!((ref = (_target = action.target) !== null && _target !== void 0 ? _target : action.node) !== null && ref !== void 0 ? ref : action.offset !== undefined); | ||
} | ||
@@ -87,5 +90,6 @@ function getPrevTarget(config, position) { | ||
} | ||
return position.target ?? config.document.body; | ||
var _target; | ||
return (_target = position.target) !== null && _target !== void 0 ? _target : config.document.body; | ||
} | ||
exports.pointer = pointer; |
@@ -25,2 +25,3 @@ 'use strict'; | ||
const document = getDocument(options$1, node, defaults); | ||
var _system; | ||
return { | ||
@@ -30,3 +31,3 @@ ...defaults, | ||
document, | ||
system: options$1.system ?? new index.System() | ||
system: (_system = options$1.system) !== null && _system !== void 0 ? _system : new index.System() | ||
}; | ||
@@ -40,3 +41,4 @@ } | ||
index$1.prepareDocument(config.document); | ||
const view = config.document.defaultView ?? /* istanbul ignore next */ globalThis.window; | ||
var _defaultView; | ||
const view = (_defaultView = config.document.defaultView) !== null && _defaultView !== void 0 ? _defaultView : /* istanbul ignore next */ globalThis.window; | ||
Clipboard.attachClipboardStubToView(view); | ||
@@ -50,3 +52,3 @@ return doSetup(config); | ||
...options$1, | ||
system: pointerState ?? keyboardState | ||
system: pointerState !== null && pointerState !== void 0 ? pointerState : keyboardState | ||
}, options.defaultOptionsDirect, node); | ||
@@ -95,3 +97,4 @@ index$1.prepareDocument(config.document); | ||
function getDocument(options, node, defaults) { | ||
return (options.document ?? (node && getDocumentFromNode.getDocumentFromNode(node))) ?? defaults.document; | ||
var _document, ref; | ||
return (ref = (_document = options.document) !== null && _document !== void 0 ? _document : node && getDocumentFromNode.getDocumentFromNode(node)) !== null && ref !== void 0 ? ref : defaults.document; | ||
} | ||
@@ -98,0 +101,0 @@ |
@@ -11,4 +11,2 @@ 'use strict'; | ||
*/ class System { | ||
keyboard = new keyboard.KeyboardHost(this); | ||
pointer = new index.PointerHost(this); | ||
getUIEventModifiers() { | ||
@@ -30,4 +28,8 @@ return { | ||
} | ||
constructor(){ | ||
this.keyboard = new keyboard.KeyboardHost(this); | ||
this.pointer = new index.PointerHost(this); | ||
} | ||
} | ||
exports.System = System; |
@@ -17,2 +17,3 @@ 'use strict'; | ||
var _pressed, _code, _code1; | ||
exports.DOM_KEY_LOCATION = void 0; | ||
@@ -48,23 +49,2 @@ (function(DOM_KEY_LOCATION) { | ||
class KeyboardHost { | ||
constructor(system){ | ||
this.system = system; | ||
} | ||
modifiers = { | ||
Alt: false, | ||
AltGraph: false, | ||
CapsLock: false, | ||
Control: false, | ||
Fn: false, | ||
FnLock: false, | ||
Meta: false, | ||
NumLock: false, | ||
ScrollLock: false, | ||
Shift: false, | ||
Symbol: false, | ||
SymbolLock: false | ||
}; | ||
pressed = {}; | ||
carryChar = ''; | ||
lastKeydownTarget = undefined; | ||
modifierLockStart = {}; | ||
isKeyPressed(keyDef) { | ||
@@ -81,3 +61,4 @@ return !!this.pressed[String(keyDef.code)]; | ||
this.setKeydownTarget(target); | ||
this.pressed[code] ??= { | ||
var ref; | ||
(ref = (_pressed = this.pressed)[_code = code]) !== null && ref !== void 0 ? ref : _pressed[_code] = { | ||
keyDef, | ||
@@ -97,3 +78,3 @@ unpreventedDefault: false | ||
} | ||
this.pressed[code].unpreventedDefault ||= unprevented; | ||
(_code1 = this.pressed[code]).unpreventedDefault || (_code1.unpreventedDefault = unprevented); | ||
if (unprevented && this.hasKeyPress(key)) { | ||
@@ -137,4 +118,25 @@ index.dispatchUIEvent(config, getActiveElement.getActiveElementOrBody(config.document), 'keypress', { | ||
} | ||
constructor(system){ | ||
this.modifiers = { | ||
Alt: false, | ||
AltGraph: false, | ||
CapsLock: false, | ||
Control: false, | ||
Fn: false, | ||
FnLock: false, | ||
Meta: false, | ||
NumLock: false, | ||
ScrollLock: false, | ||
Shift: false, | ||
Symbol: false, | ||
SymbolLock: false | ||
}; | ||
this.pressed = {}; | ||
this.carryChar = ''; | ||
this.lastKeydownTarget = undefined; | ||
this.modifierLockStart = {}; | ||
this.system = system; | ||
} | ||
} | ||
exports.KeyboardHost = KeyboardHost; |
@@ -6,3 +6,2 @@ 'use strict'; | ||
class Buttons { | ||
pressed = {}; | ||
getButtons() { | ||
@@ -39,2 +38,5 @@ let v = 0; | ||
} | ||
constructor(){ | ||
this.pressed = {}; | ||
} | ||
} | ||
@@ -41,0 +43,0 @@ const MouseButton = { |
@@ -6,3 +6,2 @@ 'use strict'; | ||
class Device { | ||
pressedKeys = new Set(); | ||
get countPressed() { | ||
@@ -20,4 +19,7 @@ return this.pressedKeys.size; | ||
} | ||
constructor(){ | ||
this.pressedKeys = new Set(); | ||
} | ||
} | ||
exports.Device = Device; |
@@ -10,50 +10,4 @@ 'use strict'; | ||
var _registry, _k; | ||
class PointerHost { | ||
constructor(system){ | ||
this.system = system; | ||
this.buttons = new buttons.Buttons(); | ||
this.mouse = new mouse.Mouse(); | ||
} | ||
devices = new class { | ||
registry = {}; | ||
get(k) { | ||
this.registry[k] ??= new device.Device(); | ||
return this.registry[k]; | ||
} | ||
}(); | ||
pointers = new class { | ||
registry = { | ||
mouse: new pointer.Pointer({ | ||
pointerId: 1, | ||
pointerType: 'mouse', | ||
isPrimary: true | ||
}) | ||
}; | ||
nextId = 2; | ||
new(pointerName, keyDef) { | ||
const isPrimary = keyDef.pointerType !== 'touch' || !Object.values(this.registry).some((p)=>p.pointerType === 'touch' && !p.isCancelled); | ||
if (!isPrimary) { | ||
Object.values(this.registry).forEach((p)=>{ | ||
if (p.pointerType === keyDef.pointerType && !p.isCancelled) { | ||
p.isMultitouch = true; | ||
} | ||
}); | ||
} | ||
this.registry[pointerName] = new pointer.Pointer({ | ||
pointerId: this.nextId++, | ||
pointerType: keyDef.pointerType, | ||
isPrimary | ||
}); | ||
return this.registry[pointerName]; | ||
} | ||
get(pointerName) { | ||
if (!this.has(pointerName)) { | ||
throw new Error(`Trying to access pointer "${pointerName}" which does not exist.`); | ||
} | ||
return this.registry[pointerName]; | ||
} | ||
has(pointerName) { | ||
return pointerName in this.registry; | ||
} | ||
}(); | ||
isKeyPressed(keyDef) { | ||
@@ -85,8 +39,8 @@ return this.devices.get(keyDef.pointerType).isPressed(keyDef); | ||
const mousemove = pointer.pointerType === 'touch' || pointer.isPrevented && pointer.isDown ? undefined : this.mouse.move(config, position); | ||
pointermove?.leave(); | ||
mousemove?.leave(); | ||
pointermove?.enter(); | ||
mousemove?.enter(); | ||
pointermove?.move(); | ||
mousemove?.move(); | ||
pointermove === null || pointermove === void 0 ? void 0 : pointermove.leave(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave(); | ||
pointermove === null || pointermove === void 0 ? void 0 : pointermove.enter(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter(); | ||
pointermove === null || pointermove === void 0 ? void 0 : pointermove.move(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move(); | ||
} | ||
@@ -112,5 +66,5 @@ async release(config, keyDef, position) { | ||
const mousemove = this.mouse.move(config, pointer.position); | ||
mousemove?.leave(); | ||
mousemove?.enter(); | ||
mousemove?.move(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move(); | ||
this.mouse.down(config, keyDef, pointer); | ||
@@ -120,5 +74,5 @@ } | ||
const mousemove1 = this.mouse.move(config, pointer.position); | ||
mousemove1?.leave(); | ||
mousemove1?.enter(); | ||
mousemove1?.move(); | ||
mousemove1 === null || mousemove1 === void 0 ? void 0 : mousemove1.leave(); | ||
mousemove1 === null || mousemove1 === void 0 ? void 0 : mousemove1.enter(); | ||
mousemove1 === null || mousemove1 === void 0 ? void 0 : mousemove1.move(); | ||
this.mouse.up(config, keyDef, pointer); | ||
@@ -138,3 +92,4 @@ } | ||
getMouseTarget(config) { | ||
return this.mouse.position.target ?? config.document.body; | ||
var _target; | ||
return (_target = this.mouse.position.target) !== null && _target !== void 0 ? _target : config.document.body; | ||
} | ||
@@ -145,5 +100,58 @@ setMousePosition(position) { | ||
} | ||
constructor(system){ | ||
this.devices = new class { | ||
get(k) { | ||
var ref; | ||
(ref = (_registry = this.registry)[_k = k]) !== null && ref !== void 0 ? ref : _registry[_k] = new device.Device(); | ||
return this.registry[k]; | ||
} | ||
constructor(){ | ||
this.registry = {}; | ||
} | ||
}(); | ||
this.pointers = new class { | ||
new(pointerName, keyDef) { | ||
const isPrimary = keyDef.pointerType !== 'touch' || !Object.values(this.registry).some((p)=>p.pointerType === 'touch' && !p.isCancelled); | ||
if (!isPrimary) { | ||
Object.values(this.registry).forEach((p)=>{ | ||
if (p.pointerType === keyDef.pointerType && !p.isCancelled) { | ||
p.isMultitouch = true; | ||
} | ||
}); | ||
} | ||
this.registry[pointerName] = new pointer.Pointer({ | ||
pointerId: this.nextId++, | ||
pointerType: keyDef.pointerType, | ||
isPrimary | ||
}); | ||
return this.registry[pointerName]; | ||
} | ||
get(pointerName) { | ||
if (!this.has(pointerName)) { | ||
throw new Error(`Trying to access pointer "${pointerName}" which does not exist.`); | ||
} | ||
return this.registry[pointerName]; | ||
} | ||
has(pointerName) { | ||
return pointerName in this.registry; | ||
} | ||
constructor(){ | ||
this.registry = { | ||
mouse: new pointer.Pointer({ | ||
pointerId: 1, | ||
pointerType: 'mouse', | ||
isPrimary: true | ||
}) | ||
}; | ||
this.nextId = 2; | ||
} | ||
}(); | ||
this.system = system; | ||
this.buttons = new buttons.Buttons(); | ||
this.mouse = new mouse.Mouse(); | ||
} | ||
} | ||
function isDifferentPointerPosition(positionA, positionB) { | ||
return positionA.target !== positionB.target || positionA.coords?.x !== positionB.coords?.y || positionA.coords?.y !== positionB.coords?.y || positionA.caret?.node !== positionB.caret?.node || positionA.caret?.offset !== positionB.caret?.offset; | ||
var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7; | ||
return positionA.target !== positionB.target || ((ref = positionA.coords) === null || ref === void 0 ? void 0 : ref.x) !== ((ref1 = positionB.coords) === null || ref1 === void 0 ? void 0 : ref1.y) || ((ref2 = positionA.coords) === null || ref2 === void 0 ? void 0 : ref2.y) !== ((ref3 = positionB.coords) === null || ref3 === void 0 ? void 0 : ref3.y) || ((ref4 = positionA.caret) === null || ref4 === void 0 ? void 0 : ref4.node) !== ((ref5 = positionB.caret) === null || ref5 === void 0 ? void 0 : ref5.node) || ((ref6 = positionA.caret) === null || ref6 === void 0 ? void 0 : ref6.offset) !== ((ref7 = positionB.caret) === null || ref7 === void 0 ? void 0 : ref7.offset); | ||
} | ||
@@ -150,0 +158,0 @@ |
@@ -25,41 +25,2 @@ 'use strict'; | ||
*/ class Mouse { | ||
position = {}; | ||
buttons = new buttons.Buttons(); | ||
buttonDownTarget = {}; | ||
// According to spec the `detail` on click events should be the number | ||
// of *consecutive* clicks with a specific button. | ||
// On `mousedown` and `mouseup` it should be this number increased by one. | ||
// But the browsers don't implement it this way. | ||
// If another button is pressed, | ||
// in Webkit: the `mouseup` on the previously pressed button has `detail: 0` and no `click`/`auxclick`. | ||
// in Gecko: the `mouseup` and click events have the same detail as the `mousedown`. | ||
// If there is a delay while a button is pressed, | ||
// the `mouseup` and `click` are normal, but a following `mousedown` starts a new click count. | ||
// We'll follow the minimal implementation of Webkit. | ||
clickCount = new class { | ||
down = {}; | ||
count = {}; | ||
incOnClick(button) { | ||
const current = this.down[button] === undefined ? undefined : Number(this.down[button]) + 1; | ||
this.count = this.count[button] === undefined ? {} : { | ||
[button]: Number(this.count[button]) + 1 | ||
}; | ||
return current; | ||
} | ||
getOnDown(button) { | ||
this.down = { | ||
[button]: this.count[button] ?? 0 | ||
}; | ||
this.count = { | ||
[button]: this.count[button] ?? 0 | ||
}; | ||
return Number(this.count[button]) + 1; | ||
} | ||
getOnUp(button) { | ||
return this.down[button] === undefined ? undefined : Number(this.down[button]) + 1; | ||
} | ||
reset() { | ||
this.count = {}; | ||
} | ||
}(); | ||
move(config, position) { | ||
@@ -159,5 +120,7 @@ const prevPosition = this.position; | ||
getTarget(config) { | ||
return this.position.target ?? config.document.body; | ||
var _target; | ||
return (_target = this.position.target) !== null && _target !== void 0 ? _target : config.document.body; | ||
} | ||
startSelecting(config, clickCount) { | ||
var ref, ref1; | ||
// TODO: support extending range (shift) | ||
@@ -167,4 +130,4 @@ this.selecting = selection.setSelectionPerMouseDown({ | ||
target: this.getTarget(config), | ||
node: this.position.caret?.node, | ||
offset: this.position.caret?.offset, | ||
node: (ref = this.position.caret) === null || ref === void 0 ? void 0 : ref.node, | ||
offset: (ref1 = this.position.caret) === null || ref1 === void 0 ? void 0 : ref1.offset, | ||
clickCount | ||
@@ -174,2 +137,3 @@ }); | ||
modifySelecting(config) { | ||
var ref, ref1; | ||
if (!this.selecting) { | ||
@@ -181,4 +145,4 @@ return; | ||
target: this.getTarget(config), | ||
node: this.position.caret?.node, | ||
offset: this.position.caret?.offset | ||
node: (ref = this.position.caret) === null || ref === void 0 ? void 0 : ref.node, | ||
offset: (ref1 = this.position.caret) === null || ref1 === void 0 ? void 0 : ref1.offset | ||
}); | ||
@@ -189,4 +153,49 @@ } | ||
} | ||
constructor(){ | ||
this.position = {}; | ||
this.buttons = new buttons.Buttons(); | ||
this.buttonDownTarget = {}; | ||
// According to spec the `detail` on click events should be the number | ||
// of *consecutive* clicks with a specific button. | ||
// On `mousedown` and `mouseup` it should be this number increased by one. | ||
// But the browsers don't implement it this way. | ||
// If another button is pressed, | ||
// in Webkit: the `mouseup` on the previously pressed button has `detail: 0` and no `click`/`auxclick`. | ||
// in Gecko: the `mouseup` and click events have the same detail as the `mousedown`. | ||
// If there is a delay while a button is pressed, | ||
// the `mouseup` and `click` are normal, but a following `mousedown` starts a new click count. | ||
// We'll follow the minimal implementation of Webkit. | ||
this.clickCount = new class { | ||
incOnClick(button) { | ||
const current = this.down[button] === undefined ? undefined : Number(this.down[button]) + 1; | ||
this.count = this.count[button] === undefined ? {} : { | ||
[button]: Number(this.count[button]) + 1 | ||
}; | ||
return current; | ||
} | ||
getOnDown(button) { | ||
var _button; | ||
this.down = { | ||
[button]: (_button = this.count[button]) !== null && _button !== void 0 ? _button : 0 | ||
}; | ||
var _button1; | ||
this.count = { | ||
[button]: (_button1 = this.count[button]) !== null && _button1 !== void 0 ? _button1 : 0 | ||
}; | ||
return Number(this.count[button]) + 1; | ||
} | ||
getOnUp(button) { | ||
return this.down[button] === undefined ? undefined : Number(this.down[button]) + 1; | ||
} | ||
reset() { | ||
this.count = {}; | ||
} | ||
constructor(){ | ||
this.down = {}; | ||
this.count = {}; | ||
} | ||
}(); | ||
} | ||
} | ||
exports.Mouse = Mouse; |
@@ -19,13 +19,2 @@ 'use strict'; | ||
class Pointer { | ||
constructor({ pointerId , pointerType , isPrimary }){ | ||
this.pointerId = pointerId; | ||
this.pointerType = pointerType; | ||
this.isPrimary = isPrimary; | ||
this.isMultitouch = !isPrimary; | ||
} | ||
isMultitouch = false; | ||
isCancelled = false; | ||
isDown = false; | ||
isPrevented = false; | ||
position = {}; | ||
init(config, position) { | ||
@@ -103,3 +92,4 @@ this.position = position; | ||
getTarget(config) { | ||
return this.position.target ?? config.document.body; | ||
var _target; | ||
return (_target = this.position.target) !== null && _target !== void 0 ? _target : config.document.body; | ||
} | ||
@@ -114,4 +104,15 @@ getEventInit() { | ||
} | ||
constructor({ pointerId , pointerType , isPrimary }){ | ||
this.isMultitouch = false; | ||
this.isCancelled = false; | ||
this.isDown = false; | ||
this.isPrevented = false; | ||
this.position = {}; | ||
this.pointerId = pointerId; | ||
this.pointerType = pointerType; | ||
this.isPrimary = isPrimary; | ||
this.isMultitouch = !isPrimary; | ||
} | ||
} | ||
exports.Pointer = Pointer; |
@@ -33,3 +33,3 @@ 'use strict'; | ||
if (initialSelectionStart !== undefined) { | ||
selection.setSelectionRange(element, initialSelectionStart, initialSelectionEnd ?? initialSelectionStart); | ||
selection.setSelectionRange(element, initialSelectionStart, initialSelectionEnd !== null && initialSelectionEnd !== void 0 ? initialSelectionEnd : initialSelectionStart); | ||
} | ||
@@ -36,0 +36,0 @@ await this.keyboard(text); |
@@ -33,3 +33,3 @@ 'use strict'; | ||
})) { | ||
throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${input?.tagName} element does not accept file uploads`); | ||
throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${input === null || input === void 0 ? void 0 : input.tagName} element does not accept file uploads`); | ||
} | ||
@@ -41,4 +41,8 @@ if (isDisabled.isDisabled(element)) return; | ||
const fileDialog = ()=>{ | ||
var ref; | ||
// do not fire an input event if the file selection does not change | ||
if (files.length === input.files?.length && files.every((f, i)=>f === input.files?.item(i))) { | ||
if (files.length === ((ref = input.files) === null || ref === void 0 ? void 0 : ref.length) && files.every((f, i)=>{ | ||
var ref; | ||
return f === ((ref = input.files) === null || ref === void 0 ? void 0 : ref.item(i)); | ||
})) { | ||
return; | ||
@@ -45,0 +49,0 @@ } |
@@ -37,5 +37,2 @@ 'use strict'; | ||
return new class ClipboardItem { | ||
constructor(d){ | ||
this.data = d; | ||
} | ||
get types() { | ||
@@ -55,2 +52,5 @@ return Array.from(Object.keys(this.data)); | ||
} | ||
constructor(d){ | ||
this.data = d; | ||
} | ||
}(dataMap); | ||
@@ -61,3 +61,2 @@ } | ||
return Object.assign(new class Clipboard extends window.EventTarget { | ||
items = []; | ||
async read() { | ||
@@ -84,2 +83,6 @@ return Array.from(this.items); | ||
} | ||
constructor(...args){ | ||
super(...args); | ||
this.items = []; | ||
} | ||
}(), { | ||
@@ -90,3 +93,4 @@ [ClipboardStubControl]: control | ||
function isClipboardStub(clipboard) { | ||
return !!clipboard?.[ClipboardStubControl]; | ||
var ref; | ||
return !!((ref = clipboard) === null || ref === void 0 ? void 0 : ref[ClipboardStubControl]); | ||
} | ||
@@ -133,3 +137,3 @@ function attachClipboardStubToView(window) { | ||
const window = document.defaultView; | ||
const clipboard = window?.navigator.clipboard; | ||
const clipboard = window === null || window === void 0 ? void 0 : window.navigator.clipboard; | ||
const items = clipboard && await clipboard.read(); | ||
@@ -136,0 +140,0 @@ if (!items) { |
@@ -10,5 +10,16 @@ 'use strict'; | ||
class DataTransferItemStub { | ||
file = null; | ||
data = undefined; | ||
getAsFile() { | ||
return this.file; | ||
} | ||
getAsString(callback) { | ||
if (typeof this.data === 'string') { | ||
callback(this.data); | ||
} | ||
} | ||
/* istanbul ignore next */ webkitGetAsEntry() { | ||
throw new Error('not implemented'); | ||
} | ||
constructor(dataOrFile, type){ | ||
this.file = null; | ||
this.data = undefined; | ||
if (typeof dataOrFile === 'string') { | ||
@@ -24,13 +35,2 @@ this.kind = 'string'; | ||
} | ||
getAsFile() { | ||
return this.file; | ||
} | ||
getAsString(callback) { | ||
if (typeof this.data === 'string') { | ||
callback(this.data); | ||
} | ||
} | ||
/* istanbul ignore next */ webkitGetAsEntry() { | ||
throw new Error('not implemented'); | ||
} | ||
} | ||
@@ -60,5 +60,6 @@ class DataTransferItemListStub extends Array { | ||
getData(format) { | ||
const match = this.items.find(getTypeMatcher(format, true)) ?? this.items.find(getTypeMatcher(format, false)); | ||
var ref; | ||
const match = (ref = this.items.find(getTypeMatcher(format, true))) !== null && ref !== void 0 ? ref : this.items.find(getTypeMatcher(format, false)); | ||
let text = ''; | ||
match?.getAsString((t)=>{ | ||
match === null || match === void 0 ? void 0 : match.getAsString((t)=>{ | ||
text = t; | ||
@@ -87,6 +88,2 @@ }); | ||
} | ||
dropEffect = 'none'; | ||
effectAllowed = 'uninitialized'; | ||
items = new DataTransferItemListStub(); | ||
files = FileList.createFileList(window, []); | ||
get types() { | ||
@@ -102,2 +99,8 @@ const t = []; | ||
/* istanbul ignore next */ setDragImage() {} | ||
constructor(){ | ||
this.dropEffect = 'none'; | ||
this.effectAllowed = 'uninitialized'; | ||
this.items = new DataTransferItemListStub(); | ||
this.files = FileList.createFileList(window, []); | ||
} | ||
}(); | ||
@@ -104,0 +107,0 @@ } |
@@ -155,2 +155,3 @@ 'use strict'; | ||
function isValidNumberInput(value) { | ||
var ref, ref1; | ||
// the browser allows some invalid input but not others | ||
@@ -160,5 +161,5 @@ // it allows up to two '-' at any place before any 'e' or one directly following 'e' | ||
const valueParts = value.split('e', 2); | ||
return !(/[^\d.\-e]/.test(value) || Number(value.match(/-/g)?.length) > 2 || Number(value.match(/\./g)?.length) > 1 || valueParts[1] && !/^-?\d*$/.test(valueParts[1])); | ||
return !(/[^\d.\-e]/.test(value) || Number((ref = value.match(/-/g)) === null || ref === void 0 ? void 0 : ref.length) > 2 || Number((ref1 = value.match(/\./g)) === null || ref1 === void 0 ? void 0 : ref1.length) > 1 || valueParts[1] && !/^-?\d*$/.test(valueParts[1])); | ||
} | ||
exports.input = input; |
@@ -31,3 +31,4 @@ 'use strict'; | ||
} | ||
const attr = element.getAttribute('maxlength') ?? ''; | ||
var ref; | ||
const attr = (ref = element.getAttribute('maxlength')) !== null && ref !== void 0 ? ref : ''; | ||
return /^\d+$/.test(attr) && Number(attr) >= 0 ? Number(attr) : undefined; | ||
@@ -34,0 +35,0 @@ } |
@@ -18,3 +18,4 @@ 'use strict'; | ||
function setFiles(el, files) { | ||
el[fakeFiles]?.restore(); | ||
var ref; | ||
(ref = el[fakeFiles]) === null || ref === void 0 ? void 0 : ref.restore(); | ||
const typeDescr = Object.getOwnPropertyDescriptor(el, 'type'); | ||
@@ -43,3 +44,4 @@ const valueDescr = Object.getOwnPropertyDescriptor(el, 'value'); | ||
} else { | ||
valueDescr?.set?.call(el, v); | ||
var ref; | ||
valueDescr === null || valueDescr === void 0 ? void 0 : (ref = valueDescr.set) === null || ref === void 0 ? void 0 : ref.call(el, v); | ||
} | ||
@@ -46,0 +48,0 @@ } |
@@ -123,2 +123,3 @@ 'use strict'; | ||
for(;;){ | ||
var ref; | ||
const sibling = node[`${direction}Sibling`]; | ||
@@ -130,3 +131,3 @@ if (sibling) { | ||
} | ||
} else if (node.parentNode && (!isElement(node.parentNode) || !isContentEditable.isContentEditable(node.parentNode) && node.parentNode !== node.ownerDocument?.body)) { | ||
} else if (node.parentNode && (!isElement(node.parentNode) || !isContentEditable.isContentEditable(node.parentNode) && node.parentNode !== ((ref = node.ownerDocument) === null || ref === void 0 ? void 0 : ref.body))) { | ||
node = node.parentNode; | ||
@@ -133,0 +134,0 @@ } else { |
@@ -16,3 +16,3 @@ 'use strict'; | ||
const activeElement = getActiveElement.getActiveElement(element.ownerDocument); | ||
if ((target ?? element.ownerDocument.body) === activeElement) { | ||
if ((target !== null && target !== void 0 ? target : element.ownerDocument.body) === activeElement) { | ||
return; | ||
@@ -22,7 +22,10 @@ } else if (target) { | ||
} else { | ||
eventWrapper.eventWrapper(()=>activeElement?.blur()); | ||
eventWrapper.eventWrapper(()=>{ | ||
var ref; | ||
return (ref = activeElement) === null || ref === void 0 ? void 0 : ref.blur(); | ||
}); | ||
} | ||
selection.updateSelectionOnFocus(target ?? element.ownerDocument.body); | ||
selection.updateSelectionOnFocus(target !== null && target !== void 0 ? target : element.ownerDocument.body); | ||
} | ||
exports.focus = focus; |
@@ -9,3 +9,3 @@ 'use strict'; | ||
const activeElement = document.activeElement; | ||
if (activeElement?.shadowRoot) { | ||
if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot) { | ||
return getActiveElement(activeElement.shadowRoot); | ||
@@ -21,3 +21,4 @@ } else { | ||
function getActiveElementOrBody(document) { | ||
return getActiveElement(document) ?? /* istanbul ignore next */ document.body; | ||
var ref; | ||
return (ref = getActiveElement(document)) !== null && ref !== void 0 ? ref : /* istanbul ignore next */ document.body; | ||
} | ||
@@ -24,0 +25,0 @@ |
@@ -28,3 +28,3 @@ 'use strict'; | ||
node: target, | ||
offset: offset ?? value.getUIValue(target).length | ||
offset: offset !== null && offset !== void 0 ? offset : value.getUIValue(target).length | ||
}; | ||
@@ -34,3 +34,3 @@ } else if (node) { | ||
node, | ||
offset: offset ?? (node.nodeType === 3 ? node.nodeValue.length : node.childNodes.length) | ||
offset: offset !== null && offset !== void 0 ? offset : node.nodeType === 3 ? node.nodeValue.length : node.childNodes.length | ||
}; | ||
@@ -67,3 +67,3 @@ } | ||
node: c, | ||
offset: offset ?? c.nodeValue.length | ||
offset: offset !== null && offset !== void 0 ? offset : c.nodeValue.length | ||
}; | ||
@@ -70,0 +70,0 @@ } |
@@ -37,3 +37,4 @@ 'use strict'; | ||
} | ||
const focusNode = isContentEditable.getContentEditable(target) ?? target.ownerDocument.body; | ||
var ref; | ||
const focusNode = (ref = isContentEditable.getContentEditable(target)) !== null && ref !== void 0 ? ref : target.ownerDocument.body; | ||
selection.setSelection({ | ||
@@ -49,5 +50,6 @@ focusNode, | ||
} | ||
const focusNode = isContentEditable.getContentEditable(target) ?? target.ownerDocument.body; | ||
var ref; | ||
const focusNode = (ref = isContentEditable.getContentEditable(target)) !== null && ref !== void 0 ? ref : target.ownerDocument.body; | ||
const selection = target.ownerDocument.getSelection(); | ||
return selection?.anchorNode === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length; | ||
return (selection === null || selection === void 0 ? void 0 : selection.anchorNode) === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length; | ||
} | ||
@@ -54,0 +56,0 @@ |
@@ -33,2 +33,3 @@ 'use strict'; | ||
*/ function setSelectionRange(element, anchorOffset, focusOffset) { | ||
var ref; | ||
if (hasOwnSelection(element)) { | ||
@@ -41,3 +42,3 @@ return setSelection({ | ||
} | ||
/* istanbul ignore else */ if (isContentEditable.isContentEditable(element) && element.firstChild?.nodeType === 3) { | ||
/* istanbul ignore else */ if (isContentEditable.isContentEditable(element) && ((ref = element.firstChild) === null || ref === void 0 ? void 0 : ref.nodeType) === 3) { | ||
return setSelection({ | ||
@@ -73,6 +74,6 @@ focusNode: element.firstChild, | ||
} | ||
const selection$1 = element?.ownerDocument.getSelection(); | ||
const selection$1 = element === null || element === void 0 ? void 0 : element.ownerDocument.getSelection(); | ||
// It is possible to extend a single-range selection into a contenteditable. | ||
// This results in the range acting like a range outside of contenteditable. | ||
const isCE = isContentEditable.getContentEditable(node) && selection$1?.anchorNode && isContentEditable.getContentEditable(selection$1.anchorNode); | ||
const isCE = isContentEditable.getContentEditable(node) && (selection$1 === null || selection$1 === void 0 ? void 0 : selection$1.anchorNode) && isContentEditable.getContentEditable(selection$1.anchorNode); | ||
return { | ||
@@ -91,3 +92,3 @@ type: isCE ? 'contenteditable' : 'default', | ||
const selection = element.ownerDocument.getSelection(); | ||
/* istanbul ignore if */ if (!selection?.focusNode) { | ||
/* istanbul ignore if */ if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) { | ||
return; | ||
@@ -106,3 +107,4 @@ } | ||
if (!selection.isCollapsed) { | ||
const focusNode = contenteditable.firstChild?.nodeType === 3 ? contenteditable.firstChild : contenteditable; | ||
var ref; | ||
const focusNode = ((ref = contenteditable.firstChild) === null || ref === void 0 ? void 0 : ref.nodeType) === 3 ? contenteditable.firstChild : contenteditable; | ||
selection.setBaseAndExtent(focusNode, 0, focusNode, 0); | ||
@@ -122,4 +124,5 @@ } | ||
} else if (typeAndSelection.type === 'contenteditable') { | ||
var ref; | ||
// Multi-range on contenteditable edits the first selection instead of the last | ||
return typeAndSelection.selection?.getRangeAt(0); | ||
return (ref = typeAndSelection.selection) === null || ref === void 0 ? void 0 : ref.getRangeAt(0); | ||
} | ||
@@ -130,2 +133,3 @@ } | ||
*/ function modifySelection({ focusNode , focusOffset }) { | ||
var ref, ref1; | ||
const typeAndSelection = getTargetTypeAndSelection(focusNode); | ||
@@ -138,3 +142,3 @@ if (typeAndSelection.type === 'input') { | ||
} | ||
focusNode.ownerDocument?.getSelection()?.extend(focusNode, focusOffset); | ||
(ref1 = (ref = focusNode.ownerDocument) === null || ref === void 0 ? void 0 : ref.getSelection()) === null || ref1 === void 0 ? void 0 : ref1.extend(focusNode, focusOffset); | ||
} | ||
@@ -144,2 +148,3 @@ /** | ||
*/ function setSelection({ focusNode , focusOffset , anchorNode =focusNode , anchorOffset =focusOffset }) { | ||
var ref, ref1; | ||
const typeAndSelection = getTargetTypeAndSelection(focusNode); | ||
@@ -152,3 +157,3 @@ if (typeAndSelection.type === 'input') { | ||
} | ||
anchorNode.ownerDocument?.getSelection()?.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset); | ||
(ref1 = (ref = anchorNode.ownerDocument) === null || ref === void 0 ? void 0 : ref.getSelection()) === null || ref1 === void 0 ? void 0 : ref1.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset); | ||
} | ||
@@ -167,3 +172,3 @@ /** | ||
const selection1 = node.ownerDocument.getSelection(); | ||
if (!selection1?.focusNode) { | ||
if (!(selection1 === null || selection1 === void 0 ? void 0 : selection1.focusNode)) { | ||
return; | ||
@@ -204,9 +209,9 @@ } | ||
selection.setUISelection(target, { | ||
anchorOffset: start ?? text.length, | ||
focusOffset: end ?? text.length | ||
anchorOffset: start !== null && start !== void 0 ? start : text.length, | ||
focusOffset: end !== null && end !== void 0 ? end : text.length | ||
}); | ||
return { | ||
node: target, | ||
start: start ?? 0, | ||
end: end ?? text.length | ||
start: start !== null && start !== void 0 ? start : 0, | ||
end: end !== null && end !== void 0 ? end : text.length | ||
}; | ||
@@ -232,4 +237,4 @@ } else { | ||
const selection = document.getSelection(); | ||
selection?.removeAllRanges(); | ||
selection?.addRange(range.cloneRange()); | ||
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges(); | ||
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange()); | ||
return range; | ||
@@ -245,3 +250,3 @@ } | ||
} | ||
const textPos = pos ?? text.length; | ||
const textPos = pos !== null && pos !== void 0 ? pos : text.length; | ||
if (clickCount % 3 === 2) { | ||
@@ -287,4 +292,4 @@ return [ | ||
const selection = document.getSelection(); | ||
selection?.removeAllRanges(); | ||
selection?.addRange(range.cloneRange()); | ||
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges(); | ||
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange()); | ||
} | ||
@@ -291,0 +296,0 @@ } |
@@ -44,2 +44,3 @@ 'use strict'; | ||
function readTag(text, pos, startBracket, context) { | ||
var ref, ref1; | ||
const releasePreviousModifier = text[pos] === '/' ? '/' : ''; | ||
@@ -49,6 +50,7 @@ pos += releasePreviousModifier.length; | ||
pos += Number(escapedDescriptor); | ||
const descriptor = escapedDescriptor ? text[pos] : text.slice(pos).match(startBracket === '{' ? /^\w+|^[^}>/]/ : /^\w+/)?.[0]; | ||
const descriptor = escapedDescriptor ? text[pos] : (ref = text.slice(pos).match(startBracket === '{' ? /^\w+|^[^}>/]/ : /^\w+/)) === null || ref === void 0 ? void 0 : ref[0]; | ||
assertDescriptor(descriptor, text, pos, context); | ||
pos += descriptor.length; | ||
const repeatModifier = text.slice(pos).match(/^>\d+/)?.[0] ?? ''; | ||
var ref2; | ||
const repeatModifier = (ref2 = (ref1 = text.slice(pos).match(/^>\d+/)) === null || ref1 === void 0 ? void 0 : ref1[0]) !== null && ref2 !== void 0 ? ref2 : ''; | ||
pos += repeatModifier.length; | ||
@@ -89,3 +91,3 @@ const releaseSelfModifier = text[pos] === '/' || !repeatModifier && text[pos] === '>' ? text[pos] : ''; | ||
function getErrorMessage(expected, found, text, context) { | ||
return `Expected ${expected} but found "${found ?? ''}" in "${text}" | ||
return `Expected ${expected} but found "${found !== null && found !== void 0 ? found : ''}" in "${text}" | ||
See ${context === 'pointer' ? `https://testing-library.com/docs/user-event/pointer#pressing-a-button-or-touching-the-screen` : `https://testing-library.com/docs/user-event/keyboard`} | ||
@@ -92,0 +94,0 @@ for more information about how userEvent parses your input.`; |
@@ -22,3 +22,4 @@ 'use strict'; | ||
} else if (isElementType.isElementType(el, 'fieldset')) { | ||
if (el.hasAttribute('disabled') && !el.querySelector(':scope > legend')?.contains(element)) { | ||
var ref; | ||
if (el.hasAttribute('disabled') && !((ref = el.querySelector(':scope > legend')) === null || ref === void 0 ? void 0 : ref.contains(element))) { | ||
return true; | ||
@@ -25,0 +26,0 @@ } |
@@ -9,3 +9,3 @@ 'use strict'; | ||
const window = getWindow.getWindow(element); | ||
for(let el = element; el?.ownerDocument; el = el.parentElement){ | ||
for(let el = element; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){ | ||
const { display , visibility } = window.getComputedStyle(el); | ||
@@ -12,0 +12,0 @@ if (display === 'none') { |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var _config, _Level; | ||
exports.ApiLevel = void 0; | ||
@@ -13,7 +14,9 @@ (function(ApiLevel) { | ||
function setLevelRef(config, level) { | ||
config[Level] ??= {}; | ||
var ref; | ||
(ref = (_config = config)[_Level = Level]) !== null && ref !== void 0 ? ref : _config[_Level] = {}; | ||
config[Level][level] = {}; | ||
} | ||
function getLevelRef(config, level) { | ||
return config[Level]?.[level]; | ||
var ref; | ||
return (ref = config[Level]) === null || ref === void 0 ? void 0 : ref[level]; | ||
} | ||
@@ -20,0 +23,0 @@ |
@@ -24,7 +24,8 @@ 'use strict'; | ||
function hasPointerEvents(config, element) { | ||
return checkPointerEvents(config, element)?.pointerEvents !== 'none'; | ||
var ref; | ||
return ((ref = checkPointerEvents(config, element)) === null || ref === void 0 ? void 0 : ref.pointerEvents) !== 'none'; | ||
} | ||
function closestPointerEventsDeclaration(element) { | ||
const window = getWindow.getWindow(element); | ||
for(let el = element, tree = []; el?.ownerDocument; el = el.parentElement){ | ||
for(let el = element, tree = []; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){ | ||
tree.push(el); | ||
@@ -49,3 +50,3 @@ const pointerEvents = window.getComputedStyle(el).pointerEvents; | ||
if (!needsCheck) { | ||
return lastCheck?.result; | ||
return lastCheck === null || lastCheck === void 0 ? void 0 : lastCheck.result; | ||
} | ||
@@ -62,3 +63,3 @@ const declaration = closestPointerEventsDeclaration(element); | ||
const declaration = checkPointerEvents(config, element); | ||
if (declaration?.pointerEvents === 'none') { | ||
if ((declaration === null || declaration === void 0 ? void 0 : declaration.pointerEvents) === 'none') { | ||
throw new Error([ | ||
@@ -83,2 +84,3 @@ `Unable to perform pointer interaction as the element ${declaration.tree.length > 1 ? 'inherits' : 'has'} \`pointer-events: none\`:`, | ||
function getLabelDescr(element) { | ||
var ref; | ||
let label; | ||
@@ -88,3 +90,4 @@ if (element.hasAttribute('aria-label')) { | ||
} else if (element.hasAttribute('aria-labelledby')) { | ||
label = element.ownerDocument.getElementById(element.getAttribute('aria-labelledby'))?.textContent?.trim(); | ||
var ref1, ref2; | ||
label = (ref1 = element.ownerDocument.getElementById(element.getAttribute('aria-labelledby'))) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.textContent) === null || ref2 === void 0 ? void 0 : ref2.trim(); | ||
} else if (isElementType.isElementType(element, [ | ||
@@ -98,10 +101,14 @@ 'button', | ||
'textarea', | ||
]) && element.labels?.length) { | ||
label = Array.from(element.labels).map((el)=>el.textContent?.trim()).join('|'); | ||
]) && ((ref = element.labels) === null || ref === void 0 ? void 0 : ref.length)) { | ||
label = Array.from(element.labels).map((el)=>{ | ||
var ref; | ||
return (ref = el.textContent) === null || ref === void 0 ? void 0 : ref.trim(); | ||
}).join('|'); | ||
} else if (isElementType.isElementType(element, 'button')) { | ||
label = element.textContent?.trim(); | ||
var ref3; | ||
label = (ref3 = element.textContent) === null || ref3 === void 0 ? void 0 : ref3.trim(); | ||
} | ||
label = label?.replace(/\n/g, ' '); | ||
if (Number(label?.length) > 30) { | ||
label = `${label?.substring(0, 29)}…`; | ||
label = label === null || label === void 0 ? void 0 : label.replace(/\n/g, ' '); | ||
if (Number(label === null || label === void 0 ? void 0 : label.length) > 30) { | ||
label = `${label === null || label === void 0 ? void 0 : label.substring(0, 29)}…`; | ||
} | ||
@@ -108,0 +115,0 @@ return label ? `(label=${label})` : ''; |
@@ -23,3 +23,4 @@ import '../setup/index.js'; | ||
const doc = this[Config].document; | ||
const target = doc.activeElement ?? /* istanbul ignore next */ doc.body; | ||
var _activeElement; | ||
const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body; | ||
const clipboardData = copySelection(target); | ||
@@ -26,0 +27,0 @@ if (clipboardData.items.length === 0) { |
@@ -23,3 +23,4 @@ import '../setup/index.js'; | ||
const doc = this[Config].document; | ||
const target = doc.activeElement ?? /* istanbul ignore next */ doc.body; | ||
var _activeElement; | ||
const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body; | ||
const clipboardData = copySelection(target); | ||
@@ -26,0 +27,0 @@ if (clipboardData.items.length === 0) { |
@@ -23,4 +23,6 @@ import '../setup/index.js'; | ||
const doc = this[Config].document; | ||
const target = doc.activeElement ?? /* istanbul ignore next */ doc.body; | ||
const dataTransfer = (typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) ?? await readDataTransferFromClipboard(doc).catch(()=>{ | ||
var _activeElement; | ||
const target = (_activeElement = doc.activeElement) !== null && _activeElement !== void 0 ? _activeElement : /* istanbul ignore next */ doc.body; | ||
var ref; | ||
const dataTransfer = (ref = typeof clipboardData === 'string' ? getClipboardDataFromString(doc, clipboardData) : clipboardData) !== null && ref !== void 0 ? ref : await readDataTransferFromClipboard(doc).catch(()=>{ | ||
throw new Error('`userEvent.paste()` without `clipboardData` requires the `ClipboardAPI` to be available.'); | ||
@@ -27,0 +29,0 @@ }); |
@@ -5,4 +5,4 @@ const Interceptor = Symbol('Interceptor for programmatical calls'); | ||
const objectDescriptor = Object.getOwnPropertyDescriptor(element, propName); | ||
const target = prototypeDescriptor?.set ? 'set' : 'value'; | ||
/* istanbul ignore if */ if (typeof prototypeDescriptor?.[target] !== 'function' || prototypeDescriptor[target][Interceptor]) { | ||
const target = (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor.set) ? 'set' : 'value'; | ||
/* istanbul ignore if */ if (typeof (prototypeDescriptor === null || prototypeDescriptor === void 0 ? void 0 : prototypeDescriptor[target]) !== 'function' || prototypeDescriptor[target][Interceptor]) { | ||
throw new Error(`Element ${element.tagName} does not implement "${String(propName)}".`); | ||
@@ -18,7 +18,7 @@ } | ||
} | ||
then?.(); | ||
then === null || then === void 0 ? void 0 : then(); | ||
} | ||
intercept[Interceptor] = Interceptor; | ||
Object.defineProperty(element, propName, { | ||
...objectDescriptor ?? prototypeDescriptor, | ||
...objectDescriptor !== null && objectDescriptor !== void 0 ? objectDescriptor : prototypeDescriptor, | ||
[target]: intercept | ||
@@ -25,0 +25,0 @@ }); |
@@ -82,5 +82,6 @@ import '../utils/click/isClickableInput.js'; | ||
function getUISelection(element) { | ||
const sel = element[UISelection] ?? { | ||
anchorOffset: element.selectionStart ?? 0, | ||
focusOffset: element.selectionEnd ?? 0 | ||
var _selectionStart, _selectionEnd, _UISelection; | ||
const sel = (_UISelection = element[UISelection]) !== null && _UISelection !== void 0 ? _UISelection : { | ||
anchorOffset: (_selectionStart = element.selectionStart) !== null && _selectionStart !== void 0 ? _selectionStart : 0, | ||
focusOffset: (_selectionEnd = element.selectionEnd) !== null && _selectionEnd !== void 0 ? _selectionEnd : 0 | ||
}; | ||
@@ -87,0 +88,0 @@ return { |
@@ -90,3 +90,4 @@ import '../utils/click/isClickableInput.js'; | ||
function trackOrSetValue(element, v) { | ||
element[TrackChanges]?.tracked?.push(v); | ||
var ref, ref1; | ||
(ref = element[TrackChanges]) === null || ref === void 0 ? void 0 : (ref1 = ref.tracked) === null || ref1 === void 0 ? void 0 : ref1.push(v); | ||
if (!element[TrackChanges]) { | ||
@@ -100,5 +101,6 @@ setUIValueClean(element); | ||
function commitValueAfterInput(element, cursorOffset) { | ||
var ref; | ||
const changes = element[TrackChanges]; | ||
element[TrackChanges] = undefined; | ||
if (!changes?.tracked?.length) { | ||
if (!(changes === null || changes === void 0 ? void 0 : (ref = changes.tracked) === null || ref === void 0 ? void 0 : ref.length)) { | ||
return; | ||
@@ -105,0 +107,0 @@ } |
@@ -28,3 +28,5 @@ import '../../utils/click/isClickableInput.js'; | ||
behavior.keydown = (event, target, config)=>{ | ||
return keydownBehavior[event.key]?.(event, target, config) ?? combinationBehavior(event, target, config); | ||
var ref; | ||
var ref1; | ||
return (ref1 = (ref = keydownBehavior[event.key]) === null || ref === void 0 ? void 0 : ref.call(keydownBehavior, event, target, config)) !== null && ref1 !== void 0 ? ref1 : combinationBehavior(event, target, config); | ||
}; | ||
@@ -82,3 +84,5 @@ const keydownBehavior = { | ||
return ()=>{ | ||
const newPos = getValue(target)?.length ?? /* istanbul ignore next */ 0; | ||
var ref; | ||
var ref1; | ||
const newPos = (ref1 = (ref = getValue(target)) === null || ref === void 0 ? void 0 : ref.length) !== null && ref1 !== void 0 ? ref1 : /* istanbul ignore next */ 0; | ||
setSelectionRange(target, newPos, newPos); | ||
@@ -85,0 +89,0 @@ }; |
@@ -23,3 +23,3 @@ import { dispatchUIEvent } from '../index.js'; | ||
const form = target.form; | ||
const submit = form?.querySelector('input[type="submit"], button:not([type]), button[type="submit"]'); | ||
const submit = form === null || form === void 0 ? void 0 : form.querySelector('input[type="submit"], button:not([type]), button[type="submit"]'); | ||
if (submit) { | ||
@@ -26,0 +26,0 @@ return ()=>dispatchUIEvent(config, submit, 'click'); |
@@ -14,3 +14,4 @@ import { isClickableInput } from '../../utils/click/isClickableInput.js'; | ||
behavior.keyup = (event, target, config)=>{ | ||
return keyupBehavior[event.key]?.(event, target, config); | ||
var ref; | ||
return (ref = keyupBehavior[event.key]) === null || ref === void 0 ? void 0 : ref.call(keyupBehavior, event, target, config); | ||
}; | ||
@@ -17,0 +18,0 @@ const keyupBehavior = { |
@@ -21,3 +21,4 @@ import '../../utils/click/isClickableInput.js'; | ||
return ()=>{ | ||
const insertData = event.clipboardData?.getData('text'); | ||
var ref; | ||
const insertData = (ref = event.clipboardData) === null || ref === void 0 ? void 0 : ref.getData('text'); | ||
if (insertData) { | ||
@@ -24,0 +25,0 @@ input(config, target, insertData, 'insertFromPaste'); |
@@ -44,38 +44,54 @@ import '../utils/click/isClickableInput.js'; | ||
function createEvent(type, target, init) { | ||
var ref; | ||
const window = getWindow(target); | ||
const { EventType , defaultInit } = eventMap[eventMapKeys[type]]; | ||
const event = new (getEventConstructors(window))[EventType](type, defaultInit); | ||
eventInitializer[EventType]?.forEach((f)=>f(event, init ?? {})); | ||
(ref = eventInitializer[EventType]) === null || ref === void 0 ? void 0 : ref.forEach((f)=>f(event, init !== null && init !== void 0 ? init : {})); | ||
return event; | ||
} | ||
/* istanbul ignore next */ function getEventConstructors(window) { | ||
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = window.Event ?? class Event { | ||
var _Event; | ||
/* eslint-disable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ const Event = (_Event = window.Event) !== null && _Event !== void 0 ? _Event : class Event { | ||
}; | ||
const AnimationEvent = window.AnimationEvent ?? class AnimationEvent extends Event { | ||
var _AnimationEvent; | ||
const AnimationEvent = (_AnimationEvent = window.AnimationEvent) !== null && _AnimationEvent !== void 0 ? _AnimationEvent : class AnimationEvent extends Event { | ||
}; | ||
const ClipboardEvent = window.ClipboardEvent ?? class ClipboardEvent extends Event { | ||
var _ClipboardEvent; | ||
const ClipboardEvent = (_ClipboardEvent = window.ClipboardEvent) !== null && _ClipboardEvent !== void 0 ? _ClipboardEvent : class ClipboardEvent extends Event { | ||
}; | ||
const PopStateEvent = window.PopStateEvent ?? class PopStateEvent extends Event { | ||
var _PopStateEvent; | ||
const PopStateEvent = (_PopStateEvent = window.PopStateEvent) !== null && _PopStateEvent !== void 0 ? _PopStateEvent : class PopStateEvent extends Event { | ||
}; | ||
const ProgressEvent = window.ProgressEvent ?? class ProgressEvent extends Event { | ||
var _ProgressEvent; | ||
const ProgressEvent = (_ProgressEvent = window.ProgressEvent) !== null && _ProgressEvent !== void 0 ? _ProgressEvent : class ProgressEvent extends Event { | ||
}; | ||
const TransitionEvent = window.TransitionEvent ?? class TransitionEvent extends Event { | ||
var _TransitionEvent; | ||
const TransitionEvent = (_TransitionEvent = window.TransitionEvent) !== null && _TransitionEvent !== void 0 ? _TransitionEvent : class TransitionEvent extends Event { | ||
}; | ||
const UIEvent = window.UIEvent ?? class UIEvent extends Event { | ||
var _UIEvent; | ||
const UIEvent = (_UIEvent = window.UIEvent) !== null && _UIEvent !== void 0 ? _UIEvent : class UIEvent extends Event { | ||
}; | ||
const CompositionEvent = window.CompositionEvent ?? class CompositionEvent extends UIEvent { | ||
var _CompositionEvent; | ||
const CompositionEvent = (_CompositionEvent = window.CompositionEvent) !== null && _CompositionEvent !== void 0 ? _CompositionEvent : class CompositionEvent extends UIEvent { | ||
}; | ||
const FocusEvent = window.FocusEvent ?? class FocusEvent extends UIEvent { | ||
var _FocusEvent; | ||
const FocusEvent = (_FocusEvent = window.FocusEvent) !== null && _FocusEvent !== void 0 ? _FocusEvent : class FocusEvent extends UIEvent { | ||
}; | ||
const InputEvent = window.InputEvent ?? class InputEvent extends UIEvent { | ||
var _InputEvent; | ||
const InputEvent = (_InputEvent = window.InputEvent) !== null && _InputEvent !== void 0 ? _InputEvent : class InputEvent extends UIEvent { | ||
}; | ||
const KeyboardEvent = window.KeyboardEvent ?? class KeyboardEvent extends UIEvent { | ||
var _KeyboardEvent; | ||
const KeyboardEvent = (_KeyboardEvent = window.KeyboardEvent) !== null && _KeyboardEvent !== void 0 ? _KeyboardEvent : class KeyboardEvent extends UIEvent { | ||
}; | ||
const MouseEvent = window.MouseEvent ?? class MouseEvent extends UIEvent { | ||
var _MouseEvent; | ||
const MouseEvent = (_MouseEvent = window.MouseEvent) !== null && _MouseEvent !== void 0 ? _MouseEvent : class MouseEvent extends UIEvent { | ||
}; | ||
const DragEvent = window.DragEvent ?? class DragEvent extends MouseEvent { | ||
var _DragEvent; | ||
const DragEvent = (_DragEvent = window.DragEvent) !== null && _DragEvent !== void 0 ? _DragEvent : class DragEvent extends MouseEvent { | ||
}; | ||
const PointerEvent = window.PointerEvent ?? class PointerEvent extends MouseEvent { | ||
var _PointerEvent; | ||
const PointerEvent = (_PointerEvent = window.PointerEvent) !== null && _PointerEvent !== void 0 ? _PointerEvent : class PointerEvent extends MouseEvent { | ||
}; | ||
const TouchEvent = window.TouchEvent ?? class TouchEvent extends UIEvent { | ||
var _TouchEvent; | ||
const TouchEvent = (_TouchEvent = window.TouchEvent) !== null && _TouchEvent !== void 0 ? _TouchEvent : class TouchEvent extends UIEvent { | ||
}; | ||
@@ -103,3 +119,3 @@ /* eslint-enable @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-extraneous-class */ return { | ||
Object.defineProperty(obj, key, { | ||
get: ()=>value ?? null | ||
get: ()=>value !== null && value !== void 0 ? value : null | ||
}); | ||
@@ -109,3 +125,3 @@ } | ||
function sanitizeNumber(n) { | ||
return Number(n ?? 0); | ||
return Number(n !== null && n !== void 0 ? n : 0); | ||
} | ||
@@ -127,3 +143,3 @@ function initClipboardEvent(event, { clipboardData }) { | ||
view, | ||
detail: sanitizeNumber(detail ?? 0) | ||
detail: sanitizeNumber(detail !== null && detail !== void 0 ? detail : 0) | ||
}); | ||
@@ -130,0 +146,0 @@ } |
@@ -11,4 +11,5 @@ import './behavior/click.js'; | ||
function dispatchEvent(config, target, event, preventDefault = false) { | ||
var ref; | ||
const type = event.type; | ||
const behaviorImplementation = preventDefault ? ()=>{} : behavior[type]?.(event, target, config); | ||
const behaviorImplementation = preventDefault ? ()=>{} : (ref = behavior[type]) === null || ref === void 0 ? void 0 : ref(event, target, config); | ||
if (behaviorImplementation) { | ||
@@ -15,0 +16,0 @@ event.preventDefault(); |
@@ -31,10 +31,13 @@ import '../utils/click/isClickableInput.js'; | ||
const { type , descriptor , consumedLength , releasePrevious , releaseSelf =true , repeat , } = readNextDescriptor(text, 'keyboard'); | ||
const keyDef = keyboardMap.find((def)=>{ | ||
var ref; | ||
const keyDef = (ref = keyboardMap.find((def)=>{ | ||
if (type === '[') { | ||
return def.code?.toLowerCase() === descriptor.toLowerCase(); | ||
var ref; | ||
return ((ref = def.code) === null || ref === void 0 ? void 0 : ref.toLowerCase()) === descriptor.toLowerCase(); | ||
} else if (type === '{') { | ||
return def.key?.toLowerCase() === descriptor.toLowerCase(); | ||
var ref1; | ||
return ((ref1 = def.key) === null || ref1 === void 0 ? void 0 : ref1.toLowerCase()) === descriptor.toLowerCase(); | ||
} | ||
return def.key === descriptor; | ||
}) ?? { | ||
})) !== null && ref !== void 0 ? ref : { | ||
key: 'Unknown', | ||
@@ -41,0 +44,0 @@ code: 'Unknown', |
@@ -46,10 +46,12 @@ import '../setup/index.js'; | ||
async function pointerAction(config, action) { | ||
var ref, ref1; | ||
const pointerName = 'pointerName' in action && action.pointerName ? action.pointerName : 'keyDef' in action ? config.system.pointer.getPointerName(action.keyDef) : 'mouse'; | ||
const previousPosition = config.system.pointer.getPreviousPosition(pointerName); | ||
var _target, _coords, _node, _offset; | ||
const position = { | ||
target: action.target ?? getPrevTarget(config, previousPosition), | ||
coords: action.coords ?? previousPosition?.coords, | ||
target: (_target = action.target) !== null && _target !== void 0 ? _target : getPrevTarget(config, previousPosition), | ||
coords: (_coords = action.coords) !== null && _coords !== void 0 ? _coords : previousPosition === null || previousPosition === void 0 ? void 0 : previousPosition.coords, | ||
caret: { | ||
node: action.node ?? (hasCaretPosition(action) ? undefined : previousPosition?.caret?.node), | ||
offset: action.offset ?? (hasCaretPosition(action) ? undefined : previousPosition?.caret?.offset) | ||
node: (_node = action.node) !== null && _node !== void 0 ? _node : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (ref = previousPosition.caret) === null || ref === void 0 ? void 0 : ref.node, | ||
offset: (_offset = action.offset) !== null && _offset !== void 0 ? _offset : hasCaretPosition(action) ? undefined : previousPosition === null || previousPosition === void 0 ? void 0 : (ref1 = previousPosition.caret) === null || ref1 === void 0 ? void 0 : ref1.offset | ||
} | ||
@@ -76,3 +78,4 @@ }; | ||
function hasCaretPosition(action) { | ||
return !!((action.target ?? action.node) ?? action.offset !== undefined); | ||
var _target, ref; | ||
return !!((ref = (_target = action.target) !== null && _target !== void 0 ? _target : action.node) !== null && ref !== void 0 ? ref : action.offset !== undefined); | ||
} | ||
@@ -83,5 +86,6 @@ function getPrevTarget(config, position) { | ||
} | ||
return position.target ?? config.document.body; | ||
var _target; | ||
return (_target = position.target) !== null && _target !== void 0 ? _target : config.document.body; | ||
} | ||
export { pointer }; |
@@ -21,2 +21,3 @@ import { prepareDocument } from '../document/index.js'; | ||
const document = getDocument(options, node, defaults); | ||
var _system; | ||
return { | ||
@@ -26,3 +27,3 @@ ...defaults, | ||
document, | ||
system: options.system ?? new System() | ||
system: (_system = options.system) !== null && _system !== void 0 ? _system : new System() | ||
}; | ||
@@ -36,3 +37,4 @@ } | ||
prepareDocument(config.document); | ||
const view = config.document.defaultView ?? /* istanbul ignore next */ globalThis.window; | ||
var _defaultView; | ||
const view = (_defaultView = config.document.defaultView) !== null && _defaultView !== void 0 ? _defaultView : /* istanbul ignore next */ globalThis.window; | ||
attachClipboardStubToView(view); | ||
@@ -46,3 +48,3 @@ return doSetup(config); | ||
...options, | ||
system: pointerState ?? keyboardState | ||
system: pointerState !== null && pointerState !== void 0 ? pointerState : keyboardState | ||
}, defaultOptionsDirect, node); | ||
@@ -91,5 +93,6 @@ prepareDocument(config.document); | ||
function getDocument(options, node, defaults) { | ||
return (options.document ?? (node && getDocumentFromNode(node))) ?? defaults.document; | ||
var _document, ref; | ||
return (ref = (_document = options.document) !== null && _document !== void 0 ? _document : node && getDocumentFromNode(node)) !== null && ref !== void 0 ? ref : defaults.document; | ||
} | ||
export { createConfig, setupDirect, setupMain, setupSub }; |
@@ -7,4 +7,2 @@ import { KeyboardHost } from './keyboard.js'; | ||
*/ class System { | ||
keyboard = new KeyboardHost(this); | ||
pointer = new PointerHost(this); | ||
getUIEventModifiers() { | ||
@@ -26,4 +24,8 @@ return { | ||
} | ||
constructor(){ | ||
this.keyboard = new KeyboardHost(this); | ||
this.pointer = new PointerHost(this); | ||
} | ||
} | ||
export { System }; |
@@ -13,2 +13,3 @@ import { dispatchUIEvent } from '../event/index.js'; | ||
var _pressed, _code, _code1; | ||
var DOM_KEY_LOCATION; | ||
@@ -44,23 +45,2 @@ (function(DOM_KEY_LOCATION) { | ||
class KeyboardHost { | ||
constructor(system){ | ||
this.system = system; | ||
} | ||
modifiers = { | ||
Alt: false, | ||
AltGraph: false, | ||
CapsLock: false, | ||
Control: false, | ||
Fn: false, | ||
FnLock: false, | ||
Meta: false, | ||
NumLock: false, | ||
ScrollLock: false, | ||
Shift: false, | ||
Symbol: false, | ||
SymbolLock: false | ||
}; | ||
pressed = {}; | ||
carryChar = ''; | ||
lastKeydownTarget = undefined; | ||
modifierLockStart = {}; | ||
isKeyPressed(keyDef) { | ||
@@ -77,3 +57,4 @@ return !!this.pressed[String(keyDef.code)]; | ||
this.setKeydownTarget(target); | ||
this.pressed[code] ??= { | ||
var ref; | ||
(ref = (_pressed = this.pressed)[_code = code]) !== null && ref !== void 0 ? ref : _pressed[_code] = { | ||
keyDef, | ||
@@ -93,3 +74,3 @@ unpreventedDefault: false | ||
} | ||
this.pressed[code].unpreventedDefault ||= unprevented; | ||
(_code1 = this.pressed[code]).unpreventedDefault || (_code1.unpreventedDefault = unprevented); | ||
if (unprevented && this.hasKeyPress(key)) { | ||
@@ -133,4 +114,25 @@ dispatchUIEvent(config, getActiveElementOrBody(config.document), 'keypress', { | ||
} | ||
constructor(system){ | ||
this.modifiers = { | ||
Alt: false, | ||
AltGraph: false, | ||
CapsLock: false, | ||
Control: false, | ||
Fn: false, | ||
FnLock: false, | ||
Meta: false, | ||
NumLock: false, | ||
ScrollLock: false, | ||
Shift: false, | ||
Symbol: false, | ||
SymbolLock: false | ||
}; | ||
this.pressed = {}; | ||
this.carryChar = ''; | ||
this.lastKeydownTarget = undefined; | ||
this.modifierLockStart = {}; | ||
this.system = system; | ||
} | ||
} | ||
export { DOM_KEY_LOCATION, KeyboardHost }; |
class Buttons { | ||
pressed = {}; | ||
getButtons() { | ||
@@ -34,2 +33,5 @@ let v = 0; | ||
} | ||
constructor(){ | ||
this.pressed = {}; | ||
} | ||
} | ||
@@ -36,0 +38,0 @@ const MouseButton = { |
class Device { | ||
pressedKeys = new Set(); | ||
get countPressed() { | ||
@@ -15,4 +14,7 @@ return this.pressedKeys.size; | ||
} | ||
constructor(){ | ||
this.pressedKeys = new Set(); | ||
} | ||
} | ||
export { Device }; |
@@ -6,50 +6,4 @@ import { Buttons } from './buttons.js'; | ||
var _registry, _k; | ||
class PointerHost { | ||
constructor(system){ | ||
this.system = system; | ||
this.buttons = new Buttons(); | ||
this.mouse = new Mouse(); | ||
} | ||
devices = new class { | ||
registry = {}; | ||
get(k) { | ||
this.registry[k] ??= new Device(); | ||
return this.registry[k]; | ||
} | ||
}(); | ||
pointers = new class { | ||
registry = { | ||
mouse: new Pointer({ | ||
pointerId: 1, | ||
pointerType: 'mouse', | ||
isPrimary: true | ||
}) | ||
}; | ||
nextId = 2; | ||
new(pointerName, keyDef) { | ||
const isPrimary = keyDef.pointerType !== 'touch' || !Object.values(this.registry).some((p)=>p.pointerType === 'touch' && !p.isCancelled); | ||
if (!isPrimary) { | ||
Object.values(this.registry).forEach((p)=>{ | ||
if (p.pointerType === keyDef.pointerType && !p.isCancelled) { | ||
p.isMultitouch = true; | ||
} | ||
}); | ||
} | ||
this.registry[pointerName] = new Pointer({ | ||
pointerId: this.nextId++, | ||
pointerType: keyDef.pointerType, | ||
isPrimary | ||
}); | ||
return this.registry[pointerName]; | ||
} | ||
get(pointerName) { | ||
if (!this.has(pointerName)) { | ||
throw new Error(`Trying to access pointer "${pointerName}" which does not exist.`); | ||
} | ||
return this.registry[pointerName]; | ||
} | ||
has(pointerName) { | ||
return pointerName in this.registry; | ||
} | ||
}(); | ||
isKeyPressed(keyDef) { | ||
@@ -81,8 +35,8 @@ return this.devices.get(keyDef.pointerType).isPressed(keyDef); | ||
const mousemove = pointer.pointerType === 'touch' || pointer.isPrevented && pointer.isDown ? undefined : this.mouse.move(config, position); | ||
pointermove?.leave(); | ||
mousemove?.leave(); | ||
pointermove?.enter(); | ||
mousemove?.enter(); | ||
pointermove?.move(); | ||
mousemove?.move(); | ||
pointermove === null || pointermove === void 0 ? void 0 : pointermove.leave(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave(); | ||
pointermove === null || pointermove === void 0 ? void 0 : pointermove.enter(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter(); | ||
pointermove === null || pointermove === void 0 ? void 0 : pointermove.move(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move(); | ||
} | ||
@@ -108,5 +62,5 @@ async release(config, keyDef, position) { | ||
const mousemove = this.mouse.move(config, pointer.position); | ||
mousemove?.leave(); | ||
mousemove?.enter(); | ||
mousemove?.move(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.leave(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.enter(); | ||
mousemove === null || mousemove === void 0 ? void 0 : mousemove.move(); | ||
this.mouse.down(config, keyDef, pointer); | ||
@@ -116,5 +70,5 @@ } | ||
const mousemove1 = this.mouse.move(config, pointer.position); | ||
mousemove1?.leave(); | ||
mousemove1?.enter(); | ||
mousemove1?.move(); | ||
mousemove1 === null || mousemove1 === void 0 ? void 0 : mousemove1.leave(); | ||
mousemove1 === null || mousemove1 === void 0 ? void 0 : mousemove1.enter(); | ||
mousemove1 === null || mousemove1 === void 0 ? void 0 : mousemove1.move(); | ||
this.mouse.up(config, keyDef, pointer); | ||
@@ -134,3 +88,4 @@ } | ||
getMouseTarget(config) { | ||
return this.mouse.position.target ?? config.document.body; | ||
var _target; | ||
return (_target = this.mouse.position.target) !== null && _target !== void 0 ? _target : config.document.body; | ||
} | ||
@@ -141,7 +96,60 @@ setMousePosition(position) { | ||
} | ||
constructor(system){ | ||
this.devices = new class { | ||
get(k) { | ||
var ref; | ||
(ref = (_registry = this.registry)[_k = k]) !== null && ref !== void 0 ? ref : _registry[_k] = new Device(); | ||
return this.registry[k]; | ||
} | ||
constructor(){ | ||
this.registry = {}; | ||
} | ||
}(); | ||
this.pointers = new class { | ||
new(pointerName, keyDef) { | ||
const isPrimary = keyDef.pointerType !== 'touch' || !Object.values(this.registry).some((p)=>p.pointerType === 'touch' && !p.isCancelled); | ||
if (!isPrimary) { | ||
Object.values(this.registry).forEach((p)=>{ | ||
if (p.pointerType === keyDef.pointerType && !p.isCancelled) { | ||
p.isMultitouch = true; | ||
} | ||
}); | ||
} | ||
this.registry[pointerName] = new Pointer({ | ||
pointerId: this.nextId++, | ||
pointerType: keyDef.pointerType, | ||
isPrimary | ||
}); | ||
return this.registry[pointerName]; | ||
} | ||
get(pointerName) { | ||
if (!this.has(pointerName)) { | ||
throw new Error(`Trying to access pointer "${pointerName}" which does not exist.`); | ||
} | ||
return this.registry[pointerName]; | ||
} | ||
has(pointerName) { | ||
return pointerName in this.registry; | ||
} | ||
constructor(){ | ||
this.registry = { | ||
mouse: new Pointer({ | ||
pointerId: 1, | ||
pointerType: 'mouse', | ||
isPrimary: true | ||
}) | ||
}; | ||
this.nextId = 2; | ||
} | ||
}(); | ||
this.system = system; | ||
this.buttons = new Buttons(); | ||
this.mouse = new Mouse(); | ||
} | ||
} | ||
function isDifferentPointerPosition(positionA, positionB) { | ||
return positionA.target !== positionB.target || positionA.coords?.x !== positionB.coords?.y || positionA.coords?.y !== positionB.coords?.y || positionA.caret?.node !== positionB.caret?.node || positionA.caret?.offset !== positionB.caret?.offset; | ||
var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7; | ||
return positionA.target !== positionB.target || ((ref = positionA.coords) === null || ref === void 0 ? void 0 : ref.x) !== ((ref1 = positionB.coords) === null || ref1 === void 0 ? void 0 : ref1.y) || ((ref2 = positionA.coords) === null || ref2 === void 0 ? void 0 : ref2.y) !== ((ref3 = positionB.coords) === null || ref3 === void 0 ? void 0 : ref3.y) || ((ref4 = positionA.caret) === null || ref4 === void 0 ? void 0 : ref4.node) !== ((ref5 = positionB.caret) === null || ref5 === void 0 ? void 0 : ref5.node) || ((ref6 = positionA.caret) === null || ref6 === void 0 ? void 0 : ref6.offset) !== ((ref7 = positionB.caret) === null || ref7 === void 0 ? void 0 : ref7.offset); | ||
} | ||
export { PointerHost, isDifferentPointerPosition }; |
@@ -16,3 +16,3 @@ import { dispatchUIEvent } from '../../event/index.js'; | ||
import { isDifferentPointerPosition } from './index.js'; | ||
import { Buttons, getMouseEventButton } from './buttons.js'; | ||
import { getMouseEventButton, Buttons } from './buttons.js'; | ||
@@ -22,41 +22,2 @@ /** | ||
*/ class Mouse { | ||
position = {}; | ||
buttons = new Buttons(); | ||
buttonDownTarget = {}; | ||
// According to spec the `detail` on click events should be the number | ||
// of *consecutive* clicks with a specific button. | ||
// On `mousedown` and `mouseup` it should be this number increased by one. | ||
// But the browsers don't implement it this way. | ||
// If another button is pressed, | ||
// in Webkit: the `mouseup` on the previously pressed button has `detail: 0` and no `click`/`auxclick`. | ||
// in Gecko: the `mouseup` and click events have the same detail as the `mousedown`. | ||
// If there is a delay while a button is pressed, | ||
// the `mouseup` and `click` are normal, but a following `mousedown` starts a new click count. | ||
// We'll follow the minimal implementation of Webkit. | ||
clickCount = new class { | ||
down = {}; | ||
count = {}; | ||
incOnClick(button) { | ||
const current = this.down[button] === undefined ? undefined : Number(this.down[button]) + 1; | ||
this.count = this.count[button] === undefined ? {} : { | ||
[button]: Number(this.count[button]) + 1 | ||
}; | ||
return current; | ||
} | ||
getOnDown(button) { | ||
this.down = { | ||
[button]: this.count[button] ?? 0 | ||
}; | ||
this.count = { | ||
[button]: this.count[button] ?? 0 | ||
}; | ||
return Number(this.count[button]) + 1; | ||
} | ||
getOnUp(button) { | ||
return this.down[button] === undefined ? undefined : Number(this.down[button]) + 1; | ||
} | ||
reset() { | ||
this.count = {}; | ||
} | ||
}(); | ||
move(config, position) { | ||
@@ -156,5 +117,7 @@ const prevPosition = this.position; | ||
getTarget(config) { | ||
return this.position.target ?? config.document.body; | ||
var _target; | ||
return (_target = this.position.target) !== null && _target !== void 0 ? _target : config.document.body; | ||
} | ||
startSelecting(config, clickCount) { | ||
var ref, ref1; | ||
// TODO: support extending range (shift) | ||
@@ -164,4 +127,4 @@ this.selecting = setSelectionPerMouseDown({ | ||
target: this.getTarget(config), | ||
node: this.position.caret?.node, | ||
offset: this.position.caret?.offset, | ||
node: (ref = this.position.caret) === null || ref === void 0 ? void 0 : ref.node, | ||
offset: (ref1 = this.position.caret) === null || ref1 === void 0 ? void 0 : ref1.offset, | ||
clickCount | ||
@@ -171,2 +134,3 @@ }); | ||
modifySelecting(config) { | ||
var ref, ref1; | ||
if (!this.selecting) { | ||
@@ -178,4 +142,4 @@ return; | ||
target: this.getTarget(config), | ||
node: this.position.caret?.node, | ||
offset: this.position.caret?.offset | ||
node: (ref = this.position.caret) === null || ref === void 0 ? void 0 : ref.node, | ||
offset: (ref1 = this.position.caret) === null || ref1 === void 0 ? void 0 : ref1.offset | ||
}); | ||
@@ -186,4 +150,49 @@ } | ||
} | ||
constructor(){ | ||
this.position = {}; | ||
this.buttons = new Buttons(); | ||
this.buttonDownTarget = {}; | ||
// According to spec the `detail` on click events should be the number | ||
// of *consecutive* clicks with a specific button. | ||
// On `mousedown` and `mouseup` it should be this number increased by one. | ||
// But the browsers don't implement it this way. | ||
// If another button is pressed, | ||
// in Webkit: the `mouseup` on the previously pressed button has `detail: 0` and no `click`/`auxclick`. | ||
// in Gecko: the `mouseup` and click events have the same detail as the `mousedown`. | ||
// If there is a delay while a button is pressed, | ||
// the `mouseup` and `click` are normal, but a following `mousedown` starts a new click count. | ||
// We'll follow the minimal implementation of Webkit. | ||
this.clickCount = new class { | ||
incOnClick(button) { | ||
const current = this.down[button] === undefined ? undefined : Number(this.down[button]) + 1; | ||
this.count = this.count[button] === undefined ? {} : { | ||
[button]: Number(this.count[button]) + 1 | ||
}; | ||
return current; | ||
} | ||
getOnDown(button) { | ||
var _button; | ||
this.down = { | ||
[button]: (_button = this.count[button]) !== null && _button !== void 0 ? _button : 0 | ||
}; | ||
var _button1; | ||
this.count = { | ||
[button]: (_button1 = this.count[button]) !== null && _button1 !== void 0 ? _button1 : 0 | ||
}; | ||
return Number(this.count[button]) + 1; | ||
} | ||
getOnUp(button) { | ||
return this.down[button] === undefined ? undefined : Number(this.down[button]) + 1; | ||
} | ||
reset() { | ||
this.count = {}; | ||
} | ||
constructor(){ | ||
this.down = {}; | ||
this.count = {}; | ||
} | ||
}(); | ||
} | ||
} | ||
export { Mouse }; |
@@ -15,13 +15,2 @@ import { dispatchUIEvent } from '../../event/index.js'; | ||
class Pointer { | ||
constructor({ pointerId , pointerType , isPrimary }){ | ||
this.pointerId = pointerId; | ||
this.pointerType = pointerType; | ||
this.isPrimary = isPrimary; | ||
this.isMultitouch = !isPrimary; | ||
} | ||
isMultitouch = false; | ||
isCancelled = false; | ||
isDown = false; | ||
isPrevented = false; | ||
position = {}; | ||
init(config, position) { | ||
@@ -99,3 +88,4 @@ this.position = position; | ||
getTarget(config) { | ||
return this.position.target ?? config.document.body; | ||
var _target; | ||
return (_target = this.position.target) !== null && _target !== void 0 ? _target : config.document.body; | ||
} | ||
@@ -110,4 +100,15 @@ getEventInit() { | ||
} | ||
constructor({ pointerId , pointerType , isPrimary }){ | ||
this.isMultitouch = false; | ||
this.isCancelled = false; | ||
this.isDown = false; | ||
this.isPrevented = false; | ||
this.position = {}; | ||
this.pointerId = pointerId; | ||
this.pointerType = pointerType; | ||
this.isPrimary = isPrimary; | ||
this.isMultitouch = !isPrimary; | ||
} | ||
} | ||
export { Pointer }; |
@@ -29,3 +29,3 @@ import '../utils/click/isClickableInput.js'; | ||
if (initialSelectionStart !== undefined) { | ||
setSelectionRange(element, initialSelectionStart, initialSelectionEnd ?? initialSelectionStart); | ||
setSelectionRange(element, initialSelectionStart, initialSelectionEnd !== null && initialSelectionEnd !== void 0 ? initialSelectionEnd : initialSelectionStart); | ||
} | ||
@@ -32,0 +32,0 @@ await this.keyboard(text); |
@@ -29,3 +29,3 @@ import '../utils/click/isClickableInput.js'; | ||
})) { | ||
throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${input?.tagName} element does not accept file uploads`); | ||
throw new TypeError(`The ${input === element ? 'given' : 'associated'} ${input === null || input === void 0 ? void 0 : input.tagName} element does not accept file uploads`); | ||
} | ||
@@ -37,4 +37,8 @@ if (isDisabled(element)) return; | ||
const fileDialog = ()=>{ | ||
var ref; | ||
// do not fire an input event if the file selection does not change | ||
if (files.length === input.files?.length && files.every((f, i)=>f === input.files?.item(i))) { | ||
if (files.length === ((ref = input.files) === null || ref === void 0 ? void 0 : ref.length) && files.every((f, i)=>{ | ||
var ref; | ||
return f === ((ref = input.files) === null || ref === void 0 ? void 0 : ref.item(i)); | ||
})) { | ||
return; | ||
@@ -41,0 +45,0 @@ } |
@@ -33,5 +33,2 @@ import '../click/isClickableInput.js'; | ||
return new class ClipboardItem { | ||
constructor(d){ | ||
this.data = d; | ||
} | ||
get types() { | ||
@@ -51,2 +48,5 @@ return Array.from(Object.keys(this.data)); | ||
} | ||
constructor(d){ | ||
this.data = d; | ||
} | ||
}(dataMap); | ||
@@ -57,3 +57,2 @@ } | ||
return Object.assign(new class Clipboard extends window.EventTarget { | ||
items = []; | ||
async read() { | ||
@@ -80,2 +79,6 @@ return Array.from(this.items); | ||
} | ||
constructor(...args){ | ||
super(...args); | ||
this.items = []; | ||
} | ||
}(), { | ||
@@ -86,3 +89,4 @@ [ClipboardStubControl]: control | ||
function isClipboardStub(clipboard) { | ||
return !!clipboard?.[ClipboardStubControl]; | ||
var ref; | ||
return !!((ref = clipboard) === null || ref === void 0 ? void 0 : ref[ClipboardStubControl]); | ||
} | ||
@@ -129,3 +133,3 @@ function attachClipboardStubToView(window) { | ||
const window = document.defaultView; | ||
const clipboard = window?.navigator.clipboard; | ||
const clipboard = window === null || window === void 0 ? void 0 : window.navigator.clipboard; | ||
const items = clipboard && await clipboard.read(); | ||
@@ -132,0 +136,0 @@ if (!items) { |
@@ -6,5 +6,16 @@ import { createFileList } from './FileList.js'; | ||
class DataTransferItemStub { | ||
file = null; | ||
data = undefined; | ||
getAsFile() { | ||
return this.file; | ||
} | ||
getAsString(callback) { | ||
if (typeof this.data === 'string') { | ||
callback(this.data); | ||
} | ||
} | ||
/* istanbul ignore next */ webkitGetAsEntry() { | ||
throw new Error('not implemented'); | ||
} | ||
constructor(dataOrFile, type){ | ||
this.file = null; | ||
this.data = undefined; | ||
if (typeof dataOrFile === 'string') { | ||
@@ -20,13 +31,2 @@ this.kind = 'string'; | ||
} | ||
getAsFile() { | ||
return this.file; | ||
} | ||
getAsString(callback) { | ||
if (typeof this.data === 'string') { | ||
callback(this.data); | ||
} | ||
} | ||
/* istanbul ignore next */ webkitGetAsEntry() { | ||
throw new Error('not implemented'); | ||
} | ||
} | ||
@@ -56,5 +56,6 @@ class DataTransferItemListStub extends Array { | ||
getData(format) { | ||
const match = this.items.find(getTypeMatcher(format, true)) ?? this.items.find(getTypeMatcher(format, false)); | ||
var ref; | ||
const match = (ref = this.items.find(getTypeMatcher(format, true))) !== null && ref !== void 0 ? ref : this.items.find(getTypeMatcher(format, false)); | ||
let text = ''; | ||
match?.getAsString((t)=>{ | ||
match === null || match === void 0 ? void 0 : match.getAsString((t)=>{ | ||
text = t; | ||
@@ -83,6 +84,2 @@ }); | ||
} | ||
dropEffect = 'none'; | ||
effectAllowed = 'uninitialized'; | ||
items = new DataTransferItemListStub(); | ||
files = createFileList(window, []); | ||
get types() { | ||
@@ -98,2 +95,8 @@ const t = []; | ||
/* istanbul ignore next */ setDragImage() {} | ||
constructor(){ | ||
this.dropEffect = 'none'; | ||
this.effectAllowed = 'uninitialized'; | ||
this.items = new DataTransferItemListStub(); | ||
this.files = createFileList(window, []); | ||
} | ||
}(); | ||
@@ -100,0 +103,0 @@ } |
@@ -151,2 +151,3 @@ import { dispatchUIEvent } from '../../event/index.js'; | ||
function isValidNumberInput(value) { | ||
var ref, ref1; | ||
// the browser allows some invalid input but not others | ||
@@ -156,5 +157,5 @@ // it allows up to two '-' at any place before any 'e' or one directly following 'e' | ||
const valueParts = value.split('e', 2); | ||
return !(/[^\d.\-e]/.test(value) || Number(value.match(/-/g)?.length) > 2 || Number(value.match(/\./g)?.length) > 1 || valueParts[1] && !/^-?\d*$/.test(valueParts[1])); | ||
return !(/[^\d.\-e]/.test(value) || Number((ref = value.match(/-/g)) === null || ref === void 0 ? void 0 : ref.length) > 2 || Number((ref1 = value.match(/\./g)) === null || ref1 === void 0 ? void 0 : ref1.length) > 1 || valueParts[1] && !/^-?\d*$/.test(valueParts[1])); | ||
} | ||
export { input }; |
@@ -27,3 +27,4 @@ import { isElementType } from '../misc/isElementType.js'; | ||
} | ||
const attr = element.getAttribute('maxlength') ?? ''; | ||
var ref; | ||
const attr = (ref = element.getAttribute('maxlength')) !== null && ref !== void 0 ? ref : ''; | ||
return /^\d+$/.test(attr) && Number(attr) >= 0 ? Number(attr) : undefined; | ||
@@ -30,0 +31,0 @@ } |
@@ -14,3 +14,4 @@ // It is not possible to create a real FileList programmatically. | ||
function setFiles(el, files) { | ||
el[fakeFiles]?.restore(); | ||
var ref; | ||
(ref = el[fakeFiles]) === null || ref === void 0 ? void 0 : ref.restore(); | ||
const typeDescr = Object.getOwnPropertyDescriptor(el, 'type'); | ||
@@ -39,3 +40,4 @@ const valueDescr = Object.getOwnPropertyDescriptor(el, 'value'); | ||
} else { | ||
valueDescr?.set?.call(el, v); | ||
var ref; | ||
valueDescr === null || valueDescr === void 0 ? void 0 : (ref = valueDescr.set) === null || ref === void 0 ? void 0 : ref.call(el, v); | ||
} | ||
@@ -42,0 +44,0 @@ } |
@@ -119,2 +119,3 @@ import '../click/isClickableInput.js'; | ||
for(;;){ | ||
var ref; | ||
const sibling = node[`${direction}Sibling`]; | ||
@@ -126,3 +127,3 @@ if (sibling) { | ||
} | ||
} else if (node.parentNode && (!isElement(node.parentNode) || !isContentEditable(node.parentNode) && node.parentNode !== node.ownerDocument?.body)) { | ||
} else if (node.parentNode && (!isElement(node.parentNode) || !isContentEditable(node.parentNode) && node.parentNode !== ((ref = node.ownerDocument) === null || ref === void 0 ? void 0 : ref.body))) { | ||
node = node.parentNode; | ||
@@ -129,0 +130,0 @@ } else { |
@@ -12,3 +12,3 @@ import { eventWrapper } from '../misc/eventWrapper.js'; | ||
const activeElement = getActiveElement(element.ownerDocument); | ||
if ((target ?? element.ownerDocument.body) === activeElement) { | ||
if ((target !== null && target !== void 0 ? target : element.ownerDocument.body) === activeElement) { | ||
return; | ||
@@ -18,7 +18,10 @@ } else if (target) { | ||
} else { | ||
eventWrapper(()=>activeElement?.blur()); | ||
eventWrapper(()=>{ | ||
var ref; | ||
return (ref = activeElement) === null || ref === void 0 ? void 0 : ref.blur(); | ||
}); | ||
} | ||
updateSelectionOnFocus(target ?? element.ownerDocument.body); | ||
updateSelectionOnFocus(target !== null && target !== void 0 ? target : element.ownerDocument.body); | ||
} | ||
export { focus }; |
@@ -5,3 +5,3 @@ import { isDisabled } from '../misc/isDisabled.js'; | ||
const activeElement = document.activeElement; | ||
if (activeElement?.shadowRoot) { | ||
if (activeElement === null || activeElement === void 0 ? void 0 : activeElement.shadowRoot) { | ||
return getActiveElement(activeElement.shadowRoot); | ||
@@ -17,5 +17,6 @@ } else { | ||
function getActiveElementOrBody(document) { | ||
return getActiveElement(document) ?? /* istanbul ignore next */ document.body; | ||
var ref; | ||
return (ref = getActiveElement(document)) !== null && ref !== void 0 ? ref : /* istanbul ignore next */ document.body; | ||
} | ||
export { getActiveElement, getActiveElementOrBody }; |
@@ -24,3 +24,3 @@ import '../click/isClickableInput.js'; | ||
node: target, | ||
offset: offset ?? getUIValue(target).length | ||
offset: offset !== null && offset !== void 0 ? offset : getUIValue(target).length | ||
}; | ||
@@ -30,3 +30,3 @@ } else if (node) { | ||
node, | ||
offset: offset ?? (node.nodeType === 3 ? node.nodeValue.length : node.childNodes.length) | ||
offset: offset !== null && offset !== void 0 ? offset : node.nodeType === 3 ? node.nodeValue.length : node.childNodes.length | ||
}; | ||
@@ -63,3 +63,3 @@ } | ||
node: c, | ||
offset: offset ?? c.nodeValue.length | ||
offset: offset !== null && offset !== void 0 ? offset : c.nodeValue.length | ||
}; | ||
@@ -66,0 +66,0 @@ } |
@@ -33,3 +33,4 @@ import '../click/isClickableInput.js'; | ||
} | ||
const focusNode = getContentEditable(target) ?? target.ownerDocument.body; | ||
var ref; | ||
const focusNode = (ref = getContentEditable(target)) !== null && ref !== void 0 ? ref : target.ownerDocument.body; | ||
setSelection({ | ||
@@ -45,7 +46,8 @@ focusNode, | ||
} | ||
const focusNode = getContentEditable(target) ?? target.ownerDocument.body; | ||
var ref; | ||
const focusNode = (ref = getContentEditable(target)) !== null && ref !== void 0 ? ref : target.ownerDocument.body; | ||
const selection = target.ownerDocument.getSelection(); | ||
return selection?.anchorNode === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length; | ||
return (selection === null || selection === void 0 ? void 0 : selection.anchorNode) === focusNode && selection.focusNode === focusNode && selection.anchorOffset === 0 && selection.focusOffset === focusNode.childNodes.length; | ||
} | ||
export { isAllSelected, selectAll }; |
@@ -29,2 +29,3 @@ import { isElementType } from '../misc/isElementType.js'; | ||
*/ function setSelectionRange(element, anchorOffset, focusOffset) { | ||
var ref; | ||
if (hasOwnSelection(element)) { | ||
@@ -37,3 +38,3 @@ return setSelection({ | ||
} | ||
/* istanbul ignore else */ if (isContentEditable(element) && element.firstChild?.nodeType === 3) { | ||
/* istanbul ignore else */ if (isContentEditable(element) && ((ref = element.firstChild) === null || ref === void 0 ? void 0 : ref.nodeType) === 3) { | ||
return setSelection({ | ||
@@ -69,6 +70,6 @@ focusNode: element.firstChild, | ||
} | ||
const selection = element?.ownerDocument.getSelection(); | ||
const selection = element === null || element === void 0 ? void 0 : element.ownerDocument.getSelection(); | ||
// It is possible to extend a single-range selection into a contenteditable. | ||
// This results in the range acting like a range outside of contenteditable. | ||
const isCE = getContentEditable(node) && selection?.anchorNode && getContentEditable(selection.anchorNode); | ||
const isCE = getContentEditable(node) && (selection === null || selection === void 0 ? void 0 : selection.anchorNode) && getContentEditable(selection.anchorNode); | ||
return { | ||
@@ -87,3 +88,3 @@ type: isCE ? 'contenteditable' : 'default', | ||
const selection = element.ownerDocument.getSelection(); | ||
/* istanbul ignore if */ if (!selection?.focusNode) { | ||
/* istanbul ignore if */ if (!(selection === null || selection === void 0 ? void 0 : selection.focusNode)) { | ||
return; | ||
@@ -102,3 +103,4 @@ } | ||
if (!selection.isCollapsed) { | ||
const focusNode = contenteditable.firstChild?.nodeType === 3 ? contenteditable.firstChild : contenteditable; | ||
var ref; | ||
const focusNode = ((ref = contenteditable.firstChild) === null || ref === void 0 ? void 0 : ref.nodeType) === 3 ? contenteditable.firstChild : contenteditable; | ||
selection.setBaseAndExtent(focusNode, 0, focusNode, 0); | ||
@@ -118,4 +120,5 @@ } | ||
} else if (typeAndSelection.type === 'contenteditable') { | ||
var ref; | ||
// Multi-range on contenteditable edits the first selection instead of the last | ||
return typeAndSelection.selection?.getRangeAt(0); | ||
return (ref = typeAndSelection.selection) === null || ref === void 0 ? void 0 : ref.getRangeAt(0); | ||
} | ||
@@ -126,2 +129,3 @@ } | ||
*/ function modifySelection({ focusNode , focusOffset }) { | ||
var ref, ref1; | ||
const typeAndSelection = getTargetTypeAndSelection(focusNode); | ||
@@ -134,3 +138,3 @@ if (typeAndSelection.type === 'input') { | ||
} | ||
focusNode.ownerDocument?.getSelection()?.extend(focusNode, focusOffset); | ||
(ref1 = (ref = focusNode.ownerDocument) === null || ref === void 0 ? void 0 : ref.getSelection()) === null || ref1 === void 0 ? void 0 : ref1.extend(focusNode, focusOffset); | ||
} | ||
@@ -140,2 +144,3 @@ /** | ||
*/ function setSelection({ focusNode , focusOffset , anchorNode =focusNode , anchorOffset =focusOffset }) { | ||
var ref, ref1; | ||
const typeAndSelection = getTargetTypeAndSelection(focusNode); | ||
@@ -148,3 +153,3 @@ if (typeAndSelection.type === 'input') { | ||
} | ||
anchorNode.ownerDocument?.getSelection()?.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset); | ||
(ref1 = (ref = anchorNode.ownerDocument) === null || ref === void 0 ? void 0 : ref.getSelection()) === null || ref1 === void 0 ? void 0 : ref1.setBaseAndExtent(anchorNode, anchorOffset, focusNode, focusOffset); | ||
} | ||
@@ -163,3 +168,3 @@ /** | ||
const selection1 = node.ownerDocument.getSelection(); | ||
if (!selection1?.focusNode) { | ||
if (!(selection1 === null || selection1 === void 0 ? void 0 : selection1.focusNode)) { | ||
return; | ||
@@ -200,9 +205,9 @@ } | ||
setUISelection(target, { | ||
anchorOffset: start ?? text.length, | ||
focusOffset: end ?? text.length | ||
anchorOffset: start !== null && start !== void 0 ? start : text.length, | ||
focusOffset: end !== null && end !== void 0 ? end : text.length | ||
}); | ||
return { | ||
node: target, | ||
start: start ?? 0, | ||
end: end ?? text.length | ||
start: start !== null && start !== void 0 ? start : 0, | ||
end: end !== null && end !== void 0 ? end : text.length | ||
}; | ||
@@ -228,4 +233,4 @@ } else { | ||
const selection = document.getSelection(); | ||
selection?.removeAllRanges(); | ||
selection?.addRange(range.cloneRange()); | ||
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges(); | ||
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange()); | ||
return range; | ||
@@ -241,3 +246,3 @@ } | ||
} | ||
const textPos = pos ?? text.length; | ||
const textPos = pos !== null && pos !== void 0 ? pos : text.length; | ||
if (clickCount % 3 === 2) { | ||
@@ -283,4 +288,4 @@ return [ | ||
const selection = document.getSelection(); | ||
selection?.removeAllRanges(); | ||
selection?.addRange(range.cloneRange()); | ||
selection === null || selection === void 0 ? void 0 : selection.removeAllRanges(); | ||
selection === null || selection === void 0 ? void 0 : selection.addRange(range.cloneRange()); | ||
} | ||
@@ -287,0 +292,0 @@ } |
@@ -40,2 +40,3 @@ var bracketDict; | ||
function readTag(text, pos, startBracket, context) { | ||
var ref, ref1; | ||
const releasePreviousModifier = text[pos] === '/' ? '/' : ''; | ||
@@ -45,6 +46,7 @@ pos += releasePreviousModifier.length; | ||
pos += Number(escapedDescriptor); | ||
const descriptor = escapedDescriptor ? text[pos] : text.slice(pos).match(startBracket === '{' ? /^\w+|^[^}>/]/ : /^\w+/)?.[0]; | ||
const descriptor = escapedDescriptor ? text[pos] : (ref = text.slice(pos).match(startBracket === '{' ? /^\w+|^[^}>/]/ : /^\w+/)) === null || ref === void 0 ? void 0 : ref[0]; | ||
assertDescriptor(descriptor, text, pos, context); | ||
pos += descriptor.length; | ||
const repeatModifier = text.slice(pos).match(/^>\d+/)?.[0] ?? ''; | ||
var ref2; | ||
const repeatModifier = (ref2 = (ref1 = text.slice(pos).match(/^>\d+/)) === null || ref1 === void 0 ? void 0 : ref1[0]) !== null && ref2 !== void 0 ? ref2 : ''; | ||
pos += repeatModifier.length; | ||
@@ -85,3 +87,3 @@ const releaseSelfModifier = text[pos] === '/' || !repeatModifier && text[pos] === '>' ? text[pos] : ''; | ||
function getErrorMessage(expected, found, text, context) { | ||
return `Expected ${expected} but found "${found ?? ''}" in "${text}" | ||
return `Expected ${expected} but found "${found !== null && found !== void 0 ? found : ''}" in "${text}" | ||
See ${context === 'pointer' ? `https://testing-library.com/docs/user-event/pointer#pressing-a-button-or-touching-the-screen` : `https://testing-library.com/docs/user-event/keyboard`} | ||
@@ -88,0 +90,0 @@ for more information about how userEvent parses your input.`; |
@@ -18,3 +18,4 @@ import { isElementType } from './isElementType.js'; | ||
} else if (isElementType(el, 'fieldset')) { | ||
if (el.hasAttribute('disabled') && !el.querySelector(':scope > legend')?.contains(element)) { | ||
var ref; | ||
if (el.hasAttribute('disabled') && !((ref = el.querySelector(':scope > legend')) === null || ref === void 0 ? void 0 : ref.contains(element))) { | ||
return true; | ||
@@ -21,0 +22,0 @@ } |
@@ -5,3 +5,3 @@ import { getWindow } from './getWindow.js'; | ||
const window = getWindow(element); | ||
for(let el = element; el?.ownerDocument; el = el.parentElement){ | ||
for(let el = element; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){ | ||
const { display , visibility } = window.getComputedStyle(el); | ||
@@ -8,0 +8,0 @@ if (display === 'none') { |
@@ -0,1 +1,2 @@ | ||
var _config, _Level; | ||
var ApiLevel; | ||
@@ -8,9 +9,11 @@ (function(ApiLevel) { | ||
function setLevelRef(config, level) { | ||
config[Level] ??= {}; | ||
var ref; | ||
(ref = (_config = config)[_Level = Level]) !== null && ref !== void 0 ? ref : _config[_Level] = {}; | ||
config[Level][level] = {}; | ||
} | ||
function getLevelRef(config, level) { | ||
return config[Level]?.[level]; | ||
var ref; | ||
return (ref = config[Level]) === null || ref === void 0 ? void 0 : ref[level]; | ||
} | ||
export { ApiLevel, getLevelRef, setLevelRef }; |
@@ -20,7 +20,8 @@ import { PointerEventsCheckLevel } from '../../options.js'; | ||
function hasPointerEvents(config, element) { | ||
return checkPointerEvents(config, element)?.pointerEvents !== 'none'; | ||
var ref; | ||
return ((ref = checkPointerEvents(config, element)) === null || ref === void 0 ? void 0 : ref.pointerEvents) !== 'none'; | ||
} | ||
function closestPointerEventsDeclaration(element) { | ||
const window = getWindow(element); | ||
for(let el = element, tree = []; el?.ownerDocument; el = el.parentElement){ | ||
for(let el = element, tree = []; el === null || el === void 0 ? void 0 : el.ownerDocument; el = el.parentElement){ | ||
tree.push(el); | ||
@@ -45,3 +46,3 @@ const pointerEvents = window.getComputedStyle(el).pointerEvents; | ||
if (!needsCheck) { | ||
return lastCheck?.result; | ||
return lastCheck === null || lastCheck === void 0 ? void 0 : lastCheck.result; | ||
} | ||
@@ -58,3 +59,3 @@ const declaration = closestPointerEventsDeclaration(element); | ||
const declaration = checkPointerEvents(config, element); | ||
if (declaration?.pointerEvents === 'none') { | ||
if ((declaration === null || declaration === void 0 ? void 0 : declaration.pointerEvents) === 'none') { | ||
throw new Error([ | ||
@@ -79,2 +80,3 @@ `Unable to perform pointer interaction as the element ${declaration.tree.length > 1 ? 'inherits' : 'has'} \`pointer-events: none\`:`, | ||
function getLabelDescr(element) { | ||
var ref; | ||
let label; | ||
@@ -84,3 +86,4 @@ if (element.hasAttribute('aria-label')) { | ||
} else if (element.hasAttribute('aria-labelledby')) { | ||
label = element.ownerDocument.getElementById(element.getAttribute('aria-labelledby'))?.textContent?.trim(); | ||
var ref1, ref2; | ||
label = (ref1 = element.ownerDocument.getElementById(element.getAttribute('aria-labelledby'))) === null || ref1 === void 0 ? void 0 : (ref2 = ref1.textContent) === null || ref2 === void 0 ? void 0 : ref2.trim(); | ||
} else if (isElementType(element, [ | ||
@@ -94,10 +97,14 @@ 'button', | ||
'textarea', | ||
]) && element.labels?.length) { | ||
label = Array.from(element.labels).map((el)=>el.textContent?.trim()).join('|'); | ||
]) && ((ref = element.labels) === null || ref === void 0 ? void 0 : ref.length)) { | ||
label = Array.from(element.labels).map((el)=>{ | ||
var ref; | ||
return (ref = el.textContent) === null || ref === void 0 ? void 0 : ref.trim(); | ||
}).join('|'); | ||
} else if (isElementType(element, 'button')) { | ||
label = element.textContent?.trim(); | ||
var ref3; | ||
label = (ref3 = element.textContent) === null || ref3 === void 0 ? void 0 : ref3.trim(); | ||
} | ||
label = label?.replace(/\n/g, ' '); | ||
if (Number(label?.length) > 30) { | ||
label = `${label?.substring(0, 29)}…`; | ||
label = label === null || label === void 0 ? void 0 : label.replace(/\n/g, ' '); | ||
if (Number(label === null || label === void 0 ? void 0 : label.length) > 30) { | ||
label = `${label === null || label === void 0 ? void 0 : label.substring(0, 29)}…`; | ||
} | ||
@@ -104,0 +111,0 @@ return label ? `(label=${label})` : ''; |
{ | ||
"name": "@testing-library/user-event", | ||
"version": "14.4.0", | ||
"version": "14.4.1", | ||
"description": "Fire events the same way the user does", | ||
@@ -29,3 +29,3 @@ "keywords": [ | ||
"scripts": { | ||
"build": "scripts ts-build2 --cjs", | ||
"build": "scripts ts-build2 --cjs --target es2019", | ||
"lint": "kcd-scripts lint", | ||
@@ -39,3 +39,3 @@ "setup": "npm install && npm run validate -s", | ||
"devDependencies": { | ||
"@ph.fritsche/scripts-config": "^2.2.4", | ||
"@ph.fritsche/scripts-config": "^2.3.0", | ||
"@testing-library/dom": "^8.11.4", | ||
@@ -42,0 +42,0 @@ "@testing-library/jest-dom": "^5.16.3", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
423256
10719
0