pseudo-dom 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +686 -241
- package/browser/pseudo-dom.js +3576 -735
- package/browser/pseudo-dom.min.js +1 -1
- package/dist/classes/PseudoEventListener.d.ts +96 -96
- package/dist/classes/PseudoEventListener.js +151 -151
- package/dist/classes/PseudoHTMLDocument.d.ts +17 -43
- package/dist/classes/PseudoHTMLDocument.js +24 -94
- package/dist/classes/PseudoHTMLDocument.min.js +1 -1
- package/dist/classes/PseudoNodeList.d.ts +34 -34
- package/dist/classes/PseudoNodeList.js +71 -71
- package/dist/factories/createEvent.d.ts +28 -28
- package/dist/factories/createEvent.js +56 -56
- package/dist/factories/cssSelectAdapter.d.ts +23 -0
- package/dist/factories/cssSelectAdapter.js +87 -0
- package/dist/factories/cssSelectAdapter.min.js +1 -0
- package/dist/factories/eventDefaults.d.ts +31 -31
- package/dist/factories/eventDefaults.js +105 -105
- package/dist/factories/generateDocument.d.ts +11 -11
- package/dist/factories/generateDocument.js +65 -65
- package/dist/factories/generateNodeList.d.ts +9 -9
- package/dist/factories/generateNodeList.js +13 -13
- package/dist/factories/query.d.ts +33 -0
- package/dist/factories/query.js +66 -0
- package/dist/factories/query.min.js +1 -0
- package/dist/functions/activeElement.d.ts +14 -14
- package/dist/functions/activeElement.js +33 -33
- package/dist/functions/getElementById.d.ts +13 -0
- package/dist/functions/getElementById.js +33 -0
- package/dist/functions/getElementById.min.js +1 -0
- package/dist/functions/getParentNodes.d.ts +11 -11
- package/dist/functions/getParentNodes.js +22 -22
- package/dist/functions/getParentNodesFromAttribute.d.ts +14 -14
- package/dist/functions/getParentNodesFromAttribute.js +29 -29
- package/dist/functions/modifierState.d.ts +29 -29
- package/dist/functions/modifierState.js +41 -41
- package/dist/interfaces/PseudoAnimation.d.ts +3 -3
- package/dist/interfaces/PseudoAnimation.js +5 -5
- package/dist/interfaces/PseudoAttr.d.ts +11 -11
- package/dist/interfaces/PseudoAttr.js +5 -5
- package/dist/interfaces/PseudoDOMTokenList.d.ts +16 -16
- package/dist/interfaces/PseudoDOMTokenList.js +5 -5
- package/dist/interfaces/PseudoDocument.d.ts +32 -0
- package/dist/interfaces/PseudoDocument.js +5 -5
- package/dist/interfaces/PseudoDocumentFragment.d.ts +7 -0
- package/dist/interfaces/PseudoDocumentFragment.js +5 -5
- package/dist/interfaces/PseudoElement.d.ts +702 -689
- package/dist/interfaces/PseudoElement.js +5 -5
- package/dist/interfaces/PseudoEvent.d.ts +79 -79
- package/dist/interfaces/PseudoEvent.js +10 -10
- package/dist/interfaces/PseudoEventTarget.d.ts +46 -46
- package/dist/interfaces/PseudoEventTarget.js +5 -5
- package/dist/interfaces/PseudoHTMLCollection.d.ts +23 -23
- package/dist/interfaces/PseudoHTMLCollection.js +5 -5
- package/dist/interfaces/PseudoHTMLElement.d.ts +22 -22
- package/dist/interfaces/PseudoHTMLElement.js +5 -5
- package/dist/interfaces/PseudoHTMLSlotElement.d.ts +3 -3
- package/dist/interfaces/PseudoHTMLSlotElement.js +5 -5
- package/dist/interfaces/PseudoNamedNodeMap.d.ts +11 -11
- package/dist/interfaces/PseudoNamedNodeMap.js +5 -5
- package/dist/interfaces/PseudoNode.d.ts +179 -179
- package/dist/interfaces/PseudoNode.js +5 -5
- package/dist/interfaces/PseudoShadowRoot.d.ts +3 -3
- package/dist/interfaces/PseudoShadowRoot.js +5 -5
- package/dist/main.d.ts +63 -63
- package/dist/main.js +155 -155
- package/dist/services/AnimationService.d.ts +4 -4
- package/dist/services/AnimationService.js +16 -16
- package/dist/services/AttrService.d.ts +37 -37
- package/dist/services/AttrService.js +81 -81
- package/dist/services/CommentService.d.ts +1 -1
- package/dist/services/CommentService.js +13 -13
- package/dist/services/CustomEventService.d.ts +37 -37
- package/dist/services/CustomEventService.js +35 -35
- package/dist/services/DOMTokenListService.d.ts +33 -33
- package/dist/services/DOMTokenListService.js +117 -117
- package/dist/services/DocumentFragmentService.d.ts +8 -0
- package/dist/services/DocumentFragmentService.js +18 -0
- package/dist/services/DocumentFragmentService.min.js +1 -1
- package/dist/services/DocumentService.d.ts +35 -1
- package/dist/services/DocumentService.js +72 -0
- package/dist/services/DocumentService.min.js +1 -1
- package/dist/services/ElementService.d.ts +191 -178
- package/dist/services/ElementService.js +426 -406
- package/dist/services/ElementService.min.js +1 -1
- package/dist/services/EventService.d.ts +120 -120
- package/dist/services/EventService.js +250 -250
- package/dist/services/EventTargetService.d.ts +84 -84
- package/dist/services/EventTargetService.js +232 -232
- package/dist/services/FocusEventService.d.ts +32 -32
- package/dist/services/FocusEventService.js +35 -35
- package/dist/services/HTMLCollectionService.d.ts +54 -49
- package/dist/services/HTMLCollectionService.js +92 -75
- package/dist/services/HTMLCollectionService.min.js +1 -1
- package/dist/services/HTMLElementService.d.ts +57 -57
- package/dist/services/HTMLElementService.js +163 -163
- package/dist/services/HTMLSlotElementService.d.ts +4 -4
- package/dist/services/HTMLSlotElementService.js +9 -9
- package/dist/services/InputEventService.d.ts +41 -41
- package/dist/services/InputEventService.js +47 -47
- package/dist/services/KeyboardEventService.d.ts +70 -70
- package/dist/services/KeyboardEventService.js +86 -86
- package/dist/services/MouseEventService.d.ts +80 -80
- package/dist/services/MouseEventService.js +108 -108
- package/dist/services/NamedNodeMapService.d.ts +23 -23
- package/dist/services/NamedNodeMapService.js +77 -77
- package/dist/services/NodeService.d.ts +297 -271
- package/dist/services/NodeService.js +721 -679
- package/dist/services/NodeService.min.js +1 -1
- package/dist/services/PointerEventService.d.ts +51 -51
- package/dist/services/PointerEventService.js +67 -67
- package/dist/services/ShadowRootService.d.ts +4 -4
- package/dist/services/ShadowRootService.js +9 -9
- package/dist/services/TextService.d.ts +1 -1
- package/dist/services/TextService.js +13 -13
- package/dist/services/UIEventService.d.ts +43 -43
- package/dist/services/UIEventService.js +42 -42
- package/dist/simulate.d.ts +32 -32
- package/dist/simulate.js +115 -115
- package/package.json +4 -3
- package/dist/classes.d.ts +0 -20
- package/dist/classes.js +0 -31
- package/dist/classes.min.js +0 -1
- package/dist/factories/generateNode.d.ts +0 -32
- package/dist/factories/generateNode.js +0 -85
- package/dist/factories/generateNode.min.js +0 -1
- package/dist/factories.d.ts +0 -11
- package/dist/factories.js +0 -27
- package/dist/factories.min.js +0 -1
- package/dist/functions.d.ts +0 -5
- package/dist/functions.js +0 -23
- package/dist/functions.min.js +0 -1
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.KeyboardEventService = void 0
|
|
7
|
-
/**
|
|
8
|
-
* @file Substitute for the DOM KeyboardEvent Class.
|
|
9
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
10
|
-
* @version 1.0.0
|
|
11
|
-
*/
|
|
12
|
-
const UIEventService_1 = require('./UIEventService')
|
|
13
|
-
const modifierState_1 = require('../functions/modifierState')
|
|
14
|
-
/**
|
|
15
|
-
* Simulate the behaviour of the KeyboardEvent Class when there is no DOM available.
|
|
16
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
17
|
-
* @class
|
|
18
|
-
* @augments UIEventService
|
|
19
|
-
* @property {string} key
|
|
20
|
-
* @property {string} code
|
|
21
|
-
* @property {number} location
|
|
22
|
-
* @property {boolean} repeat
|
|
23
|
-
* @property {boolean} isComposing
|
|
24
|
-
*/
|
|
25
|
-
class KeyboardEventService extends UIEventService_1.UIEventService {
|
|
26
|
-
/**
|
|
27
|
-
* @param {string} [typeArg=''] The type of the event
|
|
28
|
-
* @param {KeyboardEventInit} [init={}] The options for the event
|
|
29
|
-
* @constructor
|
|
30
|
-
*/
|
|
31
|
-
constructor (typeArg = '', init = {}) {
|
|
32
|
-
super(typeArg, init)
|
|
33
|
-
this.keyValue = init.key || ''
|
|
34
|
-
this.keyCode = init.code || ''
|
|
35
|
-
this.keyLocation = init.location || 0
|
|
36
|
-
this.held = !!init.repeat
|
|
37
|
-
this.composing = !!init.isComposing
|
|
38
|
-
this.modifiers = (0, modifierState_1.modifierKeys)(init)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
get key () {
|
|
42
|
-
return this.keyValue
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
get code () {
|
|
46
|
-
return this.keyCode
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
get location () {
|
|
50
|
-
return this.keyLocation
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
get repeat () {
|
|
54
|
-
return this.held
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
get isComposing () {
|
|
58
|
-
return this.composing
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
get ctrlKey () {
|
|
62
|
-
return this.modifiers.ctrlKey
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
get shiftKey () {
|
|
66
|
-
return this.modifiers.shiftKey
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
get altKey () {
|
|
70
|
-
return this.modifiers.altKey
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
get metaKey () {
|
|
74
|
-
return this.modifiers.metaKey
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Whether a modifier key was held down when the event happened.
|
|
79
|
-
* @param {string} key Control, Shift, Alt or Meta
|
|
80
|
-
* @returns {boolean}
|
|
81
|
-
*/
|
|
82
|
-
getModifierState (key) {
|
|
83
|
-
return (0, modifierState_1.modifierState)(this.modifiers, key)
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
exports.KeyboardEventService = KeyboardEventService
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.KeyboardEventService = void 0
|
|
7
|
+
/**
|
|
8
|
+
* @file Substitute for the DOM KeyboardEvent Class.
|
|
9
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
const UIEventService_1 = require('./UIEventService')
|
|
13
|
+
const modifierState_1 = require('../functions/modifierState')
|
|
14
|
+
/**
|
|
15
|
+
* Simulate the behaviour of the KeyboardEvent Class when there is no DOM available.
|
|
16
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
17
|
+
* @class
|
|
18
|
+
* @augments UIEventService
|
|
19
|
+
* @property {string} key
|
|
20
|
+
* @property {string} code
|
|
21
|
+
* @property {number} location
|
|
22
|
+
* @property {boolean} repeat
|
|
23
|
+
* @property {boolean} isComposing
|
|
24
|
+
*/
|
|
25
|
+
class KeyboardEventService extends UIEventService_1.UIEventService {
|
|
26
|
+
/**
|
|
27
|
+
* @param {string} [typeArg=''] The type of the event
|
|
28
|
+
* @param {KeyboardEventInit} [init={}] The options for the event
|
|
29
|
+
* @constructor
|
|
30
|
+
*/
|
|
31
|
+
constructor (typeArg = '', init = {}) {
|
|
32
|
+
super(typeArg, init)
|
|
33
|
+
this.keyValue = init.key || ''
|
|
34
|
+
this.keyCode = init.code || ''
|
|
35
|
+
this.keyLocation = init.location || 0
|
|
36
|
+
this.held = !!init.repeat
|
|
37
|
+
this.composing = !!init.isComposing
|
|
38
|
+
this.modifiers = (0, modifierState_1.modifierKeys)(init)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
get key () {
|
|
42
|
+
return this.keyValue
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
get code () {
|
|
46
|
+
return this.keyCode
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
get location () {
|
|
50
|
+
return this.keyLocation
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
get repeat () {
|
|
54
|
+
return this.held
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get isComposing () {
|
|
58
|
+
return this.composing
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
get ctrlKey () {
|
|
62
|
+
return this.modifiers.ctrlKey
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
get shiftKey () {
|
|
66
|
+
return this.modifiers.shiftKey
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
get altKey () {
|
|
70
|
+
return this.modifiers.altKey
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
get metaKey () {
|
|
74
|
+
return this.modifiers.metaKey
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Whether a modifier key was held down when the event happened.
|
|
79
|
+
* @param {string} key Control, Shift, Alt or Meta
|
|
80
|
+
* @returns {boolean}
|
|
81
|
+
*/
|
|
82
|
+
getModifierState (key) {
|
|
83
|
+
return (0, modifierState_1.modifierState)(this.modifiers, key)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.KeyboardEventService = KeyboardEventService
|
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Substitute for the DOM MouseEvent Class.
|
|
3
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
-
* @version 1.0.0
|
|
5
|
-
*/
|
|
6
|
-
import { UIEventInit, UIEventService } from './UIEventService';
|
|
7
|
-
import { PseudoEventTarget } from '../interfaces/PseudoEventTarget';
|
|
8
|
-
/**
|
|
9
|
-
* The options for creating a mouse event, on top of the ones every UI event has.
|
|
10
|
-
* @typedef {Object} MouseEventInit
|
|
11
|
-
* @property {number} [screenX=0]
|
|
12
|
-
* @property {number} [screenY=0]
|
|
13
|
-
* @property {number} [clientX=0]
|
|
14
|
-
* @property {number} [clientY=0]
|
|
15
|
-
* @property {boolean} [ctrlKey=false]
|
|
16
|
-
* @property {boolean} [shiftKey=false]
|
|
17
|
-
* @property {boolean} [altKey=false]
|
|
18
|
-
* @property {boolean} [metaKey=false]
|
|
19
|
-
* @property {number} [button=0] The button which changed (0 is the main button)
|
|
20
|
-
* @property {number} [buttons=0] The buttons which are down
|
|
21
|
-
* @property {PseudoEventTarget|null} [relatedTarget=null] The other target involved (the one the mouse came from or went to)
|
|
22
|
-
*/
|
|
23
|
-
export type MouseEventInit = UIEventInit & {
|
|
24
|
-
screenX?: number;
|
|
25
|
-
screenY?: number;
|
|
26
|
-
clientX?: number;
|
|
27
|
-
clientY?: number;
|
|
28
|
-
ctrlKey?: boolean;
|
|
29
|
-
shiftKey?: boolean;
|
|
30
|
-
altKey?: boolean;
|
|
31
|
-
metaKey?: boolean;
|
|
32
|
-
button?: number;
|
|
33
|
-
buttons?: number;
|
|
34
|
-
relatedTarget?: PseudoEventTarget | null;
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Simulate the behaviour of the MouseEvent Class when there is no DOM available.
|
|
38
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
39
|
-
* @class
|
|
40
|
-
* @augments UIEventService
|
|
41
|
-
* @property {number} screenX
|
|
42
|
-
* @property {number} screenY
|
|
43
|
-
* @property {number} clientX
|
|
44
|
-
* @property {number} clientY
|
|
45
|
-
* @property {number} button
|
|
46
|
-
* @property {number} buttons
|
|
47
|
-
* @property {PseudoEventTarget|null} relatedTarget
|
|
48
|
-
*/
|
|
49
|
-
export declare class MouseEventService extends UIEventService {
|
|
50
|
-
private readonly position;
|
|
51
|
-
private readonly modifiers;
|
|
52
|
-
private readonly buttonPressed;
|
|
53
|
-
private readonly buttonsDown;
|
|
54
|
-
private readonly related;
|
|
55
|
-
/**
|
|
56
|
-
* @param {string} [typeArg=''] The type of the event
|
|
57
|
-
* @param {MouseEventInit} [init={}] The options for the event
|
|
58
|
-
* @constructor
|
|
59
|
-
*/
|
|
60
|
-
constructor(typeArg?: string, init?: MouseEventInit);
|
|
61
|
-
get screenX(): number;
|
|
62
|
-
get screenY(): number;
|
|
63
|
-
get clientX(): number;
|
|
64
|
-
get clientY(): number;
|
|
65
|
-
get x(): number;
|
|
66
|
-
get y(): number;
|
|
67
|
-
get ctrlKey(): boolean;
|
|
68
|
-
get shiftKey(): boolean;
|
|
69
|
-
get altKey(): boolean;
|
|
70
|
-
get metaKey(): boolean;
|
|
71
|
-
get button(): number;
|
|
72
|
-
get buttons(): number;
|
|
73
|
-
get relatedTarget(): PseudoEventTarget | null;
|
|
74
|
-
/**
|
|
75
|
-
* Whether a modifier key was held down when the event happened.
|
|
76
|
-
* @param {string} key Control, Shift, Alt or Meta
|
|
77
|
-
* @returns {boolean}
|
|
78
|
-
*/
|
|
79
|
-
getModifierState(key: string): boolean;
|
|
80
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @file Substitute for the DOM MouseEvent Class.
|
|
3
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import { UIEventInit, UIEventService } from './UIEventService';
|
|
7
|
+
import { PseudoEventTarget } from '../interfaces/PseudoEventTarget';
|
|
8
|
+
/**
|
|
9
|
+
* The options for creating a mouse event, on top of the ones every UI event has.
|
|
10
|
+
* @typedef {Object} MouseEventInit
|
|
11
|
+
* @property {number} [screenX=0]
|
|
12
|
+
* @property {number} [screenY=0]
|
|
13
|
+
* @property {number} [clientX=0]
|
|
14
|
+
* @property {number} [clientY=0]
|
|
15
|
+
* @property {boolean} [ctrlKey=false]
|
|
16
|
+
* @property {boolean} [shiftKey=false]
|
|
17
|
+
* @property {boolean} [altKey=false]
|
|
18
|
+
* @property {boolean} [metaKey=false]
|
|
19
|
+
* @property {number} [button=0] The button which changed (0 is the main button)
|
|
20
|
+
* @property {number} [buttons=0] The buttons which are down
|
|
21
|
+
* @property {PseudoEventTarget|null} [relatedTarget=null] The other target involved (the one the mouse came from or went to)
|
|
22
|
+
*/
|
|
23
|
+
export type MouseEventInit = UIEventInit & {
|
|
24
|
+
screenX?: number;
|
|
25
|
+
screenY?: number;
|
|
26
|
+
clientX?: number;
|
|
27
|
+
clientY?: number;
|
|
28
|
+
ctrlKey?: boolean;
|
|
29
|
+
shiftKey?: boolean;
|
|
30
|
+
altKey?: boolean;
|
|
31
|
+
metaKey?: boolean;
|
|
32
|
+
button?: number;
|
|
33
|
+
buttons?: number;
|
|
34
|
+
relatedTarget?: PseudoEventTarget | null;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Simulate the behaviour of the MouseEvent Class when there is no DOM available.
|
|
38
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
39
|
+
* @class
|
|
40
|
+
* @augments UIEventService
|
|
41
|
+
* @property {number} screenX
|
|
42
|
+
* @property {number} screenY
|
|
43
|
+
* @property {number} clientX
|
|
44
|
+
* @property {number} clientY
|
|
45
|
+
* @property {number} button
|
|
46
|
+
* @property {number} buttons
|
|
47
|
+
* @property {PseudoEventTarget|null} relatedTarget
|
|
48
|
+
*/
|
|
49
|
+
export declare class MouseEventService extends UIEventService {
|
|
50
|
+
private readonly position;
|
|
51
|
+
private readonly modifiers;
|
|
52
|
+
private readonly buttonPressed;
|
|
53
|
+
private readonly buttonsDown;
|
|
54
|
+
private readonly related;
|
|
55
|
+
/**
|
|
56
|
+
* @param {string} [typeArg=''] The type of the event
|
|
57
|
+
* @param {MouseEventInit} [init={}] The options for the event
|
|
58
|
+
* @constructor
|
|
59
|
+
*/
|
|
60
|
+
constructor(typeArg?: string, init?: MouseEventInit);
|
|
61
|
+
get screenX(): number;
|
|
62
|
+
get screenY(): number;
|
|
63
|
+
get clientX(): number;
|
|
64
|
+
get clientY(): number;
|
|
65
|
+
get x(): number;
|
|
66
|
+
get y(): number;
|
|
67
|
+
get ctrlKey(): boolean;
|
|
68
|
+
get shiftKey(): boolean;
|
|
69
|
+
get altKey(): boolean;
|
|
70
|
+
get metaKey(): boolean;
|
|
71
|
+
get button(): number;
|
|
72
|
+
get buttons(): number;
|
|
73
|
+
get relatedTarget(): PseudoEventTarget | null;
|
|
74
|
+
/**
|
|
75
|
+
* Whether a modifier key was held down when the event happened.
|
|
76
|
+
* @param {string} key Control, Shift, Alt or Meta
|
|
77
|
+
* @returns {boolean}
|
|
78
|
+
*/
|
|
79
|
+
getModifierState(key: string): boolean;
|
|
80
|
+
}
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', {
|
|
4
|
-
value: true
|
|
5
|
-
})
|
|
6
|
-
exports.MouseEventService = void 0
|
|
7
|
-
/**
|
|
8
|
-
* @file Substitute for the DOM MouseEvent Class.
|
|
9
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
10
|
-
* @version 1.0.0
|
|
11
|
-
*/
|
|
12
|
-
const UIEventService_1 = require('./UIEventService')
|
|
13
|
-
const modifierState_1 = require('../functions/modifierState')
|
|
14
|
-
/**
|
|
15
|
-
* Simulate the behaviour of the MouseEvent Class when there is no DOM available.
|
|
16
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
17
|
-
* @class
|
|
18
|
-
* @augments UIEventService
|
|
19
|
-
* @property {number} screenX
|
|
20
|
-
* @property {number} screenY
|
|
21
|
-
* @property {number} clientX
|
|
22
|
-
* @property {number} clientY
|
|
23
|
-
* @property {number} button
|
|
24
|
-
* @property {number} buttons
|
|
25
|
-
* @property {PseudoEventTarget|null} relatedTarget
|
|
26
|
-
*/
|
|
27
|
-
class MouseEventService extends UIEventService_1.UIEventService {
|
|
28
|
-
/**
|
|
29
|
-
* @param {string} [typeArg=''] The type of the event
|
|
30
|
-
* @param {MouseEventInit} [init={}] The options for the event
|
|
31
|
-
* @constructor
|
|
32
|
-
*/
|
|
33
|
-
constructor (typeArg = '', init = {}) {
|
|
34
|
-
super(typeArg, init)
|
|
35
|
-
this.position = {
|
|
36
|
-
screenX: init.screenX || 0,
|
|
37
|
-
screenY: init.screenY || 0,
|
|
38
|
-
clientX: init.clientX || 0,
|
|
39
|
-
clientY: init.clientY || 0
|
|
40
|
-
}
|
|
41
|
-
this.modifiers = (0, modifierState_1.modifierKeys)(init)
|
|
42
|
-
this.buttonPressed = init.button || 0
|
|
43
|
-
this.buttonsDown = init.buttons || 0
|
|
44
|
-
this.related = init.relatedTarget || null
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get screenX () {
|
|
48
|
-
return this.position.screenX
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
get screenY () {
|
|
52
|
-
return this.position.screenY
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
get clientX () {
|
|
56
|
-
return this.position.clientX
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
get clientY () {
|
|
60
|
-
return this.position.clientY
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
get x () {
|
|
64
|
-
return this.position.clientX
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
get y () {
|
|
68
|
-
return this.position.clientY
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
get ctrlKey () {
|
|
72
|
-
return this.modifiers.ctrlKey
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
get shiftKey () {
|
|
76
|
-
return this.modifiers.shiftKey
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
get altKey () {
|
|
80
|
-
return this.modifiers.altKey
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
get metaKey () {
|
|
84
|
-
return this.modifiers.metaKey
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
get button () {
|
|
88
|
-
return this.buttonPressed
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
get buttons () {
|
|
92
|
-
return this.buttonsDown
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
get relatedTarget () {
|
|
96
|
-
return this.related
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Whether a modifier key was held down when the event happened.
|
|
101
|
-
* @param {string} key Control, Shift, Alt or Meta
|
|
102
|
-
* @returns {boolean}
|
|
103
|
-
*/
|
|
104
|
-
getModifierState (key) {
|
|
105
|
-
return (0, modifierState_1.modifierState)(this.modifiers, key)
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.MouseEventService = MouseEventService
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', {
|
|
4
|
+
value: true
|
|
5
|
+
})
|
|
6
|
+
exports.MouseEventService = void 0
|
|
7
|
+
/**
|
|
8
|
+
* @file Substitute for the DOM MouseEvent Class.
|
|
9
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
10
|
+
* @version 1.0.0
|
|
11
|
+
*/
|
|
12
|
+
const UIEventService_1 = require('./UIEventService')
|
|
13
|
+
const modifierState_1 = require('../functions/modifierState')
|
|
14
|
+
/**
|
|
15
|
+
* Simulate the behaviour of the MouseEvent Class when there is no DOM available.
|
|
16
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
17
|
+
* @class
|
|
18
|
+
* @augments UIEventService
|
|
19
|
+
* @property {number} screenX
|
|
20
|
+
* @property {number} screenY
|
|
21
|
+
* @property {number} clientX
|
|
22
|
+
* @property {number} clientY
|
|
23
|
+
* @property {number} button
|
|
24
|
+
* @property {number} buttons
|
|
25
|
+
* @property {PseudoEventTarget|null} relatedTarget
|
|
26
|
+
*/
|
|
27
|
+
class MouseEventService extends UIEventService_1.UIEventService {
|
|
28
|
+
/**
|
|
29
|
+
* @param {string} [typeArg=''] The type of the event
|
|
30
|
+
* @param {MouseEventInit} [init={}] The options for the event
|
|
31
|
+
* @constructor
|
|
32
|
+
*/
|
|
33
|
+
constructor (typeArg = '', init = {}) {
|
|
34
|
+
super(typeArg, init)
|
|
35
|
+
this.position = {
|
|
36
|
+
screenX: init.screenX || 0,
|
|
37
|
+
screenY: init.screenY || 0,
|
|
38
|
+
clientX: init.clientX || 0,
|
|
39
|
+
clientY: init.clientY || 0
|
|
40
|
+
}
|
|
41
|
+
this.modifiers = (0, modifierState_1.modifierKeys)(init)
|
|
42
|
+
this.buttonPressed = init.button || 0
|
|
43
|
+
this.buttonsDown = init.buttons || 0
|
|
44
|
+
this.related = init.relatedTarget || null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
get screenX () {
|
|
48
|
+
return this.position.screenX
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get screenY () {
|
|
52
|
+
return this.position.screenY
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get clientX () {
|
|
56
|
+
return this.position.clientX
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
get clientY () {
|
|
60
|
+
return this.position.clientY
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
get x () {
|
|
64
|
+
return this.position.clientX
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get y () {
|
|
68
|
+
return this.position.clientY
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
get ctrlKey () {
|
|
72
|
+
return this.modifiers.ctrlKey
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
get shiftKey () {
|
|
76
|
+
return this.modifiers.shiftKey
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
get altKey () {
|
|
80
|
+
return this.modifiers.altKey
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
get metaKey () {
|
|
84
|
+
return this.modifiers.metaKey
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
get button () {
|
|
88
|
+
return this.buttonPressed
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
get buttons () {
|
|
92
|
+
return this.buttonsDown
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
get relatedTarget () {
|
|
96
|
+
return this.related
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Whether a modifier key was held down when the event happened.
|
|
101
|
+
* @param {string} key Control, Shift, Alt or Meta
|
|
102
|
+
* @returns {boolean}
|
|
103
|
+
*/
|
|
104
|
+
getModifierState (key) {
|
|
105
|
+
return (0, modifierState_1.modifierState)(this.modifiers, key)
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.MouseEventService = MouseEventService
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { PseudoNamedNodeMap } from '../interfaces/PseudoNamedNodeMap';
|
|
2
|
-
import { PseudoAttr } from '../interfaces/PseudoAttr';
|
|
3
|
-
/**
|
|
4
|
-
* Simulate the behaviour of the NamedNodeMap Class when there is no DOM available.
|
|
5
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
6
|
-
* @class
|
|
7
|
-
*/
|
|
8
|
-
export declare class NamedNodeMapService implements PseudoNamedNodeMap {
|
|
9
|
-
private attributes;
|
|
10
|
-
/**
|
|
11
|
-
* @param {Array<PseudoAttr>} [attributes=[]] The attributes to start with
|
|
12
|
-
* @constructor
|
|
13
|
-
*/
|
|
14
|
-
constructor(attributes?: Array<PseudoAttr>);
|
|
15
|
-
get length(): number;
|
|
16
|
-
getNamedItem(name: string): PseudoAttr | null;
|
|
17
|
-
setNamedItem(attr: PseudoAttr): PseudoAttr | null;
|
|
18
|
-
removeNamedItem(attrName: string): PseudoAttr;
|
|
19
|
-
item(index: number): PseudoAttr | null;
|
|
20
|
-
getNamedItemNS(namespace: string, localName: string): PseudoAttr | null;
|
|
21
|
-
setNamedItemNS(attr: PseudoAttr): PseudoAttr | null;
|
|
22
|
-
removeNamedItemNS(namespace: string, localName: string): PseudoAttr;
|
|
23
|
-
}
|
|
1
|
+
import { PseudoNamedNodeMap } from '../interfaces/PseudoNamedNodeMap';
|
|
2
|
+
import { PseudoAttr } from '../interfaces/PseudoAttr';
|
|
3
|
+
/**
|
|
4
|
+
* Simulate the behaviour of the NamedNodeMap Class when there is no DOM available.
|
|
5
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
6
|
+
* @class
|
|
7
|
+
*/
|
|
8
|
+
export declare class NamedNodeMapService implements PseudoNamedNodeMap {
|
|
9
|
+
private attributes;
|
|
10
|
+
/**
|
|
11
|
+
* @param {Array<PseudoAttr>} [attributes=[]] The attributes to start with
|
|
12
|
+
* @constructor
|
|
13
|
+
*/
|
|
14
|
+
constructor(attributes?: Array<PseudoAttr>);
|
|
15
|
+
get length(): number;
|
|
16
|
+
getNamedItem(name: string): PseudoAttr | null;
|
|
17
|
+
setNamedItem(attr: PseudoAttr): PseudoAttr | null;
|
|
18
|
+
removeNamedItem(attrName: string): PseudoAttr;
|
|
19
|
+
item(index: number): PseudoAttr | null;
|
|
20
|
+
getNamedItemNS(namespace: string, localName: string): PseudoAttr | null;
|
|
21
|
+
setNamedItemNS(attr: PseudoAttr): PseudoAttr | null;
|
|
22
|
+
removeNamedItemNS(namespace: string, localName: string): PseudoAttr;
|
|
23
|
+
}
|