pseudo-dom 0.6.0 → 0.7.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 +432 -13
- package/browser/pseudo-dom.js +3364 -603
- 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 +67 -67
- package/dist/classes/PseudoHTMLDocument.js +144 -144
- package/dist/classes/PseudoNodeList.d.ts +34 -34
- package/dist/classes/PseudoNodeList.js +71 -71
- package/dist/classes.d.ts +20 -20
- package/dist/classes.js +31 -31
- 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/generateNode.d.ts +32 -32
- package/dist/factories/generateNode.js +85 -85
- 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/factories.d.ts +11 -11
- package/dist/factories.js +27 -27
- package/dist/functions/activeElement.d.ts +14 -14
- package/dist/functions/activeElement.js +33 -33
- 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/functions.d.ts +5 -5
- package/dist/functions.js +23 -23
- 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 +7 -0
- package/dist/interfaces/PseudoDocument.js +5 -5
- package/dist/interfaces/PseudoDocumentFragment.d.ts +3 -3
- package/dist/interfaces/PseudoDocumentFragment.js +5 -5
- package/dist/interfaces/PseudoElement.d.ts +20 -7
- 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 +13 -13
- package/dist/services/DocumentFragmentService.js +24 -24
- package/dist/services/DocumentService.d.ts +7 -0
- package/dist/services/DocumentService.js +23 -0
- package/dist/services/DocumentService.min.js +1 -1
- package/dist/services/ElementService.d.ts +13 -0
- package/dist/services/ElementService.js +20 -0
- 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 +11 -6
- package/dist/services/HTMLCollectionService.js +25 -8
- 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 +26 -0
- package/dist/services/NodeService.js +42 -0
- 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 +3 -2
|
@@ -1,120 +1,120 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Substitute for the DOM Event Class.
|
|
3
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
-
* @version 1.0.0
|
|
5
|
-
*/
|
|
6
|
-
import { PseudoEventTarget } from '../interfaces/PseudoEventTarget';
|
|
7
|
-
import { PseudoEvent } from '../interfaces/PseudoEvent';
|
|
8
|
-
/**
|
|
9
|
-
* The parts of an event which the dispatching of it (EventTargetService) needs to change or read. Not part of the DOM's
|
|
10
|
-
* Event, which is why they are kept apart from the event's own properties.
|
|
11
|
-
*/
|
|
12
|
-
export type EventInner = {
|
|
13
|
-
currentTarget: PseudoEventTarget | null;
|
|
14
|
-
eventPhase: number;
|
|
15
|
-
target: PseudoEventTarget;
|
|
16
|
-
immediatePropagationStopped: boolean;
|
|
17
|
-
propagationStopped: boolean;
|
|
18
|
-
/** True for an event which the browser created for a user action, an event which a script created is not trusted. */
|
|
19
|
-
trusted: boolean;
|
|
20
|
-
/** True while the event is being dispatched. */
|
|
21
|
-
dispatching: boolean;
|
|
22
|
-
/** True while a passive listener is running, in which preventDefault does nothing. */
|
|
23
|
-
inPassiveListener: boolean;
|
|
24
|
-
/** The targets the event travels through, the target first and the root last, set while dispatching. */
|
|
25
|
-
path: Array<PseudoEventTarget>;
|
|
26
|
-
/** Finish the dispatch: no phase, no current target, no path and the stop flags are cleared so the event can be dispatched again. */
|
|
27
|
-
finishDispatch: () => void;
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Simulate the behaviour of the Event Class when there is no DOM available.
|
|
31
|
-
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
32
|
-
* @class
|
|
33
|
-
* @property {number} NONE
|
|
34
|
-
* @property {number} CAPTURING_PHASE
|
|
35
|
-
* @property {number} AT_TARGET
|
|
36
|
-
* @property {number} BUBBLING_PHASE
|
|
37
|
-
* @property {boolean} bubbles - A Boolean indicating whether the event bubbles up through the Dom or not.
|
|
38
|
-
* @property {boolean} cancelable - A Boolean indicating whether the event is cancelable.
|
|
39
|
-
* @property {boolean} composed - A Boolean value indicating whether the event can bubble across the boundary
|
|
40
|
-
* between the shadow Dom and the regular Dom.
|
|
41
|
-
* @property {function|PseudoEventTarget} currentTarget - A reference to the currently registered target for the event. This
|
|
42
|
-
* is the object to which the event is currently slated to be sent; it's possible this has been changed along the way
|
|
43
|
-
* through re-targeting.
|
|
44
|
-
* @property {boolean} defaultPrevented - Indicates whether event.preventDefault() has been called on the event.
|
|
45
|
-
* @property {boolean} immediatePropagationStopped - Flag that no further propagation should occur, including on current
|
|
46
|
-
* target.
|
|
47
|
-
* @property {boolean} propagationStopped - Flag that no further propagation should occur.
|
|
48
|
-
* @property {int} eventPhase - Indicates which phase of the event flow is being processed. Uses EventService constants.
|
|
49
|
-
* @property {EventTarget|PseudoEventTarget} target - A reference to the target to which the event was originally
|
|
50
|
-
* dispatched.
|
|
51
|
-
* @property {int} timeStamp - The time at which the event was created (in milliseconds). By specification, this
|
|
52
|
-
* value is time since epoch, but in reality browsers' definitions vary; in addition, work is underway to change this
|
|
53
|
-
* to be a DomHighResTimeStamp instead.
|
|
54
|
-
* @property {string} type - The name of the event (case-insensitive).
|
|
55
|
-
* @property {boolean} isTrusted - Indicates whether the event was initiated by the browser (after a user
|
|
56
|
-
* click for instance) or by a script (using an event creation method, like event.initEvent)
|
|
57
|
-
*/
|
|
58
|
-
export declare class EventService implements PseudoEvent {
|
|
59
|
-
static readonly NONE = 0;
|
|
60
|
-
static readonly CAPTURING_PHASE = 1;
|
|
61
|
-
static readonly AT_TARGET = 2;
|
|
62
|
-
static readonly BUBBLING_PHASE = 3;
|
|
63
|
-
private properties;
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
* @param {string} typeArg
|
|
67
|
-
* @param {Object} [eventOptions={}]
|
|
68
|
-
* @param {boolean} [eventOptions.bubbles=false]
|
|
69
|
-
* @param {boolean} [eventOptions.cancelable=false]
|
|
70
|
-
* @param {boolean} [eventOptions.composed=false]
|
|
71
|
-
* @constructor
|
|
72
|
-
*/
|
|
73
|
-
constructor(typeArg?: string, { bubbles, cancelable, composed }?: {
|
|
74
|
-
bubbles?: boolean;
|
|
75
|
-
cancelable?: boolean;
|
|
76
|
-
composed?: boolean;
|
|
77
|
-
});
|
|
78
|
-
get bubbles(): boolean;
|
|
79
|
-
get cancelable(): boolean;
|
|
80
|
-
get composed(): boolean;
|
|
81
|
-
get currentTarget(): PseudoEventTarget;
|
|
82
|
-
get defaultPrevented(): boolean;
|
|
83
|
-
get eventPhase(): number;
|
|
84
|
-
get isTrusted(): boolean;
|
|
85
|
-
get target(): PseudoEventTarget;
|
|
86
|
-
get timeStamp(): number;
|
|
87
|
-
get type(): string;
|
|
88
|
-
/**
|
|
89
|
-
* Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
|
|
90
|
-
* @returns {EventInner}
|
|
91
|
-
*/
|
|
92
|
-
get inner(): EventInner;
|
|
93
|
-
/**
|
|
94
|
-
* Return an array of targets that will have the event executed open them. The order is based on the eventPhase
|
|
95
|
-
* @method
|
|
96
|
-
* @returns {Array.<PseudoEventTarget>}
|
|
97
|
-
*/
|
|
98
|
-
composedPath(): Array<PseudoEventTarget>;
|
|
99
|
-
/**
|
|
100
|
-
* Cancels the event (if it is cancelable).
|
|
101
|
-
* @method
|
|
102
|
-
* @returns {null}
|
|
103
|
-
*/
|
|
104
|
-
preventDefault(): null;
|
|
105
|
-
/**
|
|
106
|
-
* For this particular event, no other listener will be called.
|
|
107
|
-
* Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
108
|
-
* capture phase, for instance)
|
|
109
|
-
* @method
|
|
110
|
-
* @returns {null}
|
|
111
|
-
*/
|
|
112
|
-
stopImmediatePropagation(): null;
|
|
113
|
-
/**
|
|
114
|
-
* Stops the propagation of events further along in the Dom.
|
|
115
|
-
* @method
|
|
116
|
-
* @returns {null}
|
|
117
|
-
*/
|
|
118
|
-
stopPropagation(): null;
|
|
119
|
-
private setReadOnlyProperties;
|
|
120
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @file Substitute for the DOM Event Class.
|
|
3
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
4
|
+
* @version 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
import { PseudoEventTarget } from '../interfaces/PseudoEventTarget';
|
|
7
|
+
import { PseudoEvent } from '../interfaces/PseudoEvent';
|
|
8
|
+
/**
|
|
9
|
+
* The parts of an event which the dispatching of it (EventTargetService) needs to change or read. Not part of the DOM's
|
|
10
|
+
* Event, which is why they are kept apart from the event's own properties.
|
|
11
|
+
*/
|
|
12
|
+
export type EventInner = {
|
|
13
|
+
currentTarget: PseudoEventTarget | null;
|
|
14
|
+
eventPhase: number;
|
|
15
|
+
target: PseudoEventTarget;
|
|
16
|
+
immediatePropagationStopped: boolean;
|
|
17
|
+
propagationStopped: boolean;
|
|
18
|
+
/** True for an event which the browser created for a user action, an event which a script created is not trusted. */
|
|
19
|
+
trusted: boolean;
|
|
20
|
+
/** True while the event is being dispatched. */
|
|
21
|
+
dispatching: boolean;
|
|
22
|
+
/** True while a passive listener is running, in which preventDefault does nothing. */
|
|
23
|
+
inPassiveListener: boolean;
|
|
24
|
+
/** The targets the event travels through, the target first and the root last, set while dispatching. */
|
|
25
|
+
path: Array<PseudoEventTarget>;
|
|
26
|
+
/** Finish the dispatch: no phase, no current target, no path and the stop flags are cleared so the event can be dispatched again. */
|
|
27
|
+
finishDispatch: () => void;
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Simulate the behaviour of the Event Class when there is no DOM available.
|
|
31
|
+
* @author Joshua Heagle <joshuaheagle@gmail.com>
|
|
32
|
+
* @class
|
|
33
|
+
* @property {number} NONE
|
|
34
|
+
* @property {number} CAPTURING_PHASE
|
|
35
|
+
* @property {number} AT_TARGET
|
|
36
|
+
* @property {number} BUBBLING_PHASE
|
|
37
|
+
* @property {boolean} bubbles - A Boolean indicating whether the event bubbles up through the Dom or not.
|
|
38
|
+
* @property {boolean} cancelable - A Boolean indicating whether the event is cancelable.
|
|
39
|
+
* @property {boolean} composed - A Boolean value indicating whether the event can bubble across the boundary
|
|
40
|
+
* between the shadow Dom and the regular Dom.
|
|
41
|
+
* @property {function|PseudoEventTarget} currentTarget - A reference to the currently registered target for the event. This
|
|
42
|
+
* is the object to which the event is currently slated to be sent; it's possible this has been changed along the way
|
|
43
|
+
* through re-targeting.
|
|
44
|
+
* @property {boolean} defaultPrevented - Indicates whether event.preventDefault() has been called on the event.
|
|
45
|
+
* @property {boolean} immediatePropagationStopped - Flag that no further propagation should occur, including on current
|
|
46
|
+
* target.
|
|
47
|
+
* @property {boolean} propagationStopped - Flag that no further propagation should occur.
|
|
48
|
+
* @property {int} eventPhase - Indicates which phase of the event flow is being processed. Uses EventService constants.
|
|
49
|
+
* @property {EventTarget|PseudoEventTarget} target - A reference to the target to which the event was originally
|
|
50
|
+
* dispatched.
|
|
51
|
+
* @property {int} timeStamp - The time at which the event was created (in milliseconds). By specification, this
|
|
52
|
+
* value is time since epoch, but in reality browsers' definitions vary; in addition, work is underway to change this
|
|
53
|
+
* to be a DomHighResTimeStamp instead.
|
|
54
|
+
* @property {string} type - The name of the event (case-insensitive).
|
|
55
|
+
* @property {boolean} isTrusted - Indicates whether the event was initiated by the browser (after a user
|
|
56
|
+
* click for instance) or by a script (using an event creation method, like event.initEvent)
|
|
57
|
+
*/
|
|
58
|
+
export declare class EventService implements PseudoEvent {
|
|
59
|
+
static readonly NONE = 0;
|
|
60
|
+
static readonly CAPTURING_PHASE = 1;
|
|
61
|
+
static readonly AT_TARGET = 2;
|
|
62
|
+
static readonly BUBBLING_PHASE = 3;
|
|
63
|
+
private properties;
|
|
64
|
+
/**
|
|
65
|
+
*
|
|
66
|
+
* @param {string} typeArg
|
|
67
|
+
* @param {Object} [eventOptions={}]
|
|
68
|
+
* @param {boolean} [eventOptions.bubbles=false]
|
|
69
|
+
* @param {boolean} [eventOptions.cancelable=false]
|
|
70
|
+
* @param {boolean} [eventOptions.composed=false]
|
|
71
|
+
* @constructor
|
|
72
|
+
*/
|
|
73
|
+
constructor(typeArg?: string, { bubbles, cancelable, composed }?: {
|
|
74
|
+
bubbles?: boolean;
|
|
75
|
+
cancelable?: boolean;
|
|
76
|
+
composed?: boolean;
|
|
77
|
+
});
|
|
78
|
+
get bubbles(): boolean;
|
|
79
|
+
get cancelable(): boolean;
|
|
80
|
+
get composed(): boolean;
|
|
81
|
+
get currentTarget(): PseudoEventTarget;
|
|
82
|
+
get defaultPrevented(): boolean;
|
|
83
|
+
get eventPhase(): number;
|
|
84
|
+
get isTrusted(): boolean;
|
|
85
|
+
get target(): PseudoEventTarget;
|
|
86
|
+
get timeStamp(): number;
|
|
87
|
+
get type(): string;
|
|
88
|
+
/**
|
|
89
|
+
* Scope several accessors inside the inner object. These are only intended for usage by other DOM classes.
|
|
90
|
+
* @returns {EventInner}
|
|
91
|
+
*/
|
|
92
|
+
get inner(): EventInner;
|
|
93
|
+
/**
|
|
94
|
+
* Return an array of targets that will have the event executed open them. The order is based on the eventPhase
|
|
95
|
+
* @method
|
|
96
|
+
* @returns {Array.<PseudoEventTarget>}
|
|
97
|
+
*/
|
|
98
|
+
composedPath(): Array<PseudoEventTarget>;
|
|
99
|
+
/**
|
|
100
|
+
* Cancels the event (if it is cancelable).
|
|
101
|
+
* @method
|
|
102
|
+
* @returns {null}
|
|
103
|
+
*/
|
|
104
|
+
preventDefault(): null;
|
|
105
|
+
/**
|
|
106
|
+
* For this particular event, no other listener will be called.
|
|
107
|
+
* Neither those attached on the same element, nor those attached on elements which will be traversed later (in
|
|
108
|
+
* capture phase, for instance)
|
|
109
|
+
* @method
|
|
110
|
+
* @returns {null}
|
|
111
|
+
*/
|
|
112
|
+
stopImmediatePropagation(): null;
|
|
113
|
+
/**
|
|
114
|
+
* Stops the propagation of events further along in the Dom.
|
|
115
|
+
* @method
|
|
116
|
+
* @returns {null}
|
|
117
|
+
*/
|
|
118
|
+
stopPropagation(): null;
|
|
119
|
+
private setReadOnlyProperties;
|
|
120
|
+
}
|