@planningcenter/chat-react-native 3.15.0-rc.7 → 3.15.0-rc.8
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/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/polyfills/events/CustomEvent.d.ts +21 -0
- package/build/polyfills/events/CustomEvent.d.ts.map +1 -0
- package/build/polyfills/events/CustomEvent.js +22 -0
- package/build/polyfills/events/CustomEvent.js.map +1 -0
- package/build/polyfills/events/Event.d.ts +49 -0
- package/build/polyfills/events/Event.d.ts.map +1 -0
- package/build/polyfills/events/Event.js +125 -0
- package/build/polyfills/events/Event.js.map +1 -0
- package/build/polyfills/events/EventHandlerAttributes.d.ts +8 -0
- package/build/polyfills/events/EventHandlerAttributes.d.ts.map +1 -0
- package/build/polyfills/events/EventHandlerAttributes.js +46 -0
- package/build/polyfills/events/EventHandlerAttributes.js.map +1 -0
- package/build/polyfills/events/EventTarget.d.ts +33 -0
- package/build/polyfills/events/EventTarget.d.ts.map +1 -0
- package/build/polyfills/events/EventTarget.js +238 -0
- package/build/polyfills/events/EventTarget.js.map +1 -0
- package/build/polyfills/events/internals/EventInternals.d.ts +30 -0
- package/build/polyfills/events/internals/EventInternals.d.ts.map +1 -0
- package/build/polyfills/events/internals/EventInternals.js +76 -0
- package/build/polyfills/events/internals/EventInternals.js.map +1 -0
- package/build/polyfills/events/internals/EventTargetInternals.d.ts +9 -0
- package/build/polyfills/events/internals/EventTargetInternals.d.ts.map +1 -0
- package/build/polyfills/events/internals/EventTargetInternals.js +11 -0
- package/build/polyfills/events/internals/EventTargetInternals.js.map +1 -0
- package/build/polyfills/webidl/PlatformObjects.d.ts +31 -0
- package/build/polyfills/webidl/PlatformObjects.d.ts.map +1 -0
- package/build/polyfills/webidl/PlatformObjects.js +39 -0
- package/build/polyfills/webidl/PlatformObjects.js.map +1 -0
- package/package.json +5 -5
- package/src/__tests__/event-polyfill.test.ts +314 -0
- package/src/index.tsx +2 -0
- package/src/polyfills/events/CustomEvent.ts +32 -0
- package/src/polyfills/events/Event.ts +186 -0
- package/src/polyfills/events/EventHandlerAttributes.ts +67 -0
- package/src/polyfills/events/EventTarget.ts +360 -0
- package/src/polyfills/events/README.md +1 -0
- package/src/polyfills/events/internals/EventInternals.ts +95 -0
- package/src/polyfills/events/internals/EventTargetInternals.ts +16 -0
- package/src/polyfills/webidl/PlatformObjects.ts +50 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal implementation details for the `Event` module.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type Event from '../Event'
|
|
6
|
+
import type EventTarget from '../EventTarget'
|
|
7
|
+
|
|
8
|
+
export const COMPOSED_PATH_KEY: unique symbol = Symbol('composedPath')
|
|
9
|
+
export const CURRENT_TARGET_KEY: unique symbol = Symbol('currentTarget')
|
|
10
|
+
export const EVENT_PHASE_KEY: unique symbol = Symbol('eventPhase')
|
|
11
|
+
export const IN_PASSIVE_LISTENER_FLAG_KEY: unique symbol = Symbol('inPassiveListenerFlag')
|
|
12
|
+
export const IS_TRUSTED_KEY: unique symbol = Symbol('isTrusted')
|
|
13
|
+
export const STOP_IMMEDIATE_PROPAGATION_FLAG_KEY: unique symbol = Symbol('stopPropagationFlag')
|
|
14
|
+
export const STOP_PROPAGATION_FLAG_KEY: unique symbol = Symbol('stopPropagationFlag')
|
|
15
|
+
export const TARGET_KEY: unique symbol = Symbol('target')
|
|
16
|
+
|
|
17
|
+
export function getCurrentTarget(event: Event): EventTarget | null {
|
|
18
|
+
// @ts-expect-error index on symbol
|
|
19
|
+
return event[CURRENT_TARGET_KEY]
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function setCurrentTarget(event: Event, currentTarget: EventTarget | null): void {
|
|
23
|
+
// @ts-expect-error index on symbol
|
|
24
|
+
event[CURRENT_TARGET_KEY] = currentTarget
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function getComposedPath(event: Event): ReadonlyArray<EventTarget> {
|
|
28
|
+
// @ts-expect-error index on symbol
|
|
29
|
+
return event[COMPOSED_PATH_KEY]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function setComposedPath(event: Event, composedPath: ReadonlyArray<EventTarget>): void {
|
|
33
|
+
// @ts-expect-error index on symbol
|
|
34
|
+
event[COMPOSED_PATH_KEY] = composedPath
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function getEventPhase(event: Event): import('../Event').EventPhase {
|
|
38
|
+
// @ts-expect-error index on symbol
|
|
39
|
+
return event[EVENT_PHASE_KEY]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function setEventPhase(event: Event, eventPhase: import('../Event').EventPhase): void {
|
|
43
|
+
// @ts-expect-error index on symbol
|
|
44
|
+
event[EVENT_PHASE_KEY] = eventPhase
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function getInPassiveListenerFlag(event: Event): boolean {
|
|
48
|
+
// @ts-expect-error index on symbol
|
|
49
|
+
return event[IN_PASSIVE_LISTENER_FLAG_KEY]
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function setInPassiveListenerFlag(event: Event, value: boolean): void {
|
|
53
|
+
// @ts-expect-error index on symbol
|
|
54
|
+
event[IN_PASSIVE_LISTENER_FLAG_KEY] = value
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function getIsTrusted(event: Event): boolean {
|
|
58
|
+
// @ts-expect-error index on symbol
|
|
59
|
+
return event[IS_TRUSTED_KEY]
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function setIsTrusted(event: Event, isTrusted: boolean): void {
|
|
63
|
+
// @ts-expect-error index on symbol
|
|
64
|
+
event[IS_TRUSTED_KEY] = isTrusted
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function getStopImmediatePropagationFlag(event: Event): boolean {
|
|
68
|
+
// @ts-expect-error index on symbol
|
|
69
|
+
return event[STOP_IMMEDIATE_PROPAGATION_FLAG_KEY]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function setStopImmediatePropagationFlag(event: Event, value: boolean): void {
|
|
73
|
+
// @ts-expect-error index on symbol
|
|
74
|
+
event[STOP_IMMEDIATE_PROPAGATION_FLAG_KEY] = value
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function getStopPropagationFlag(event: Event): boolean {
|
|
78
|
+
// @ts-expect-error index on symbol
|
|
79
|
+
return event[STOP_PROPAGATION_FLAG_KEY]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function setStopPropagationFlag(event: Event, value: boolean): void {
|
|
83
|
+
// @ts-expect-error index on symbol
|
|
84
|
+
event[STOP_PROPAGATION_FLAG_KEY] = value
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function getTarget(event: Event): EventTarget | null {
|
|
88
|
+
// @ts-expect-error index on symbol
|
|
89
|
+
return event[TARGET_KEY]
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function setTarget(event: Event, target: EventTarget | null): void {
|
|
93
|
+
// @ts-expect-error index on symbol
|
|
94
|
+
event[TARGET_KEY] = target
|
|
95
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal implementation details for the `EventTarget` module.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type Event from '../Event'
|
|
6
|
+
import type EventTarget from '../EventTarget'
|
|
7
|
+
import { setIsTrusted } from './EventInternals'
|
|
8
|
+
|
|
9
|
+
export const EVENT_TARGET_GET_THE_PARENT_KEY: unique symbol = Symbol('EventTarget[get the parent]')
|
|
10
|
+
|
|
11
|
+
export const INTERNAL_DISPATCH_METHOD_KEY: unique symbol = Symbol('EventTarget[dispatch]')
|
|
12
|
+
|
|
13
|
+
export function dispatchTrustedEvent(eventTarget: EventTarget, event: Event): void {
|
|
14
|
+
setIsTrusted(event, true)
|
|
15
|
+
return eventTarget[INTERNAL_DISPATCH_METHOD_KEY](event)
|
|
16
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const IS_PLATFORM_OBJECT_KEY = Symbol('isPlatformObject')
|
|
9
|
+
const CLONE_PLATFORM_OBJECT_KEY = Symbol('clonePlatformObject')
|
|
10
|
+
|
|
11
|
+
type CloneFn<T extends object> = (value: T) => T
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Marks the given object or instances of the given class as platform objects.
|
|
15
|
+
*
|
|
16
|
+
* Optionally, it sets the clone function for that platform object, which is a
|
|
17
|
+
* simplification of the serializable attribute of the Web interface.
|
|
18
|
+
*/
|
|
19
|
+
export function setPlatformObject<T extends object>(
|
|
20
|
+
obj: { prototype: unknown },
|
|
21
|
+
options?: { clone: CloneFn<T> }
|
|
22
|
+
): void
|
|
23
|
+
export function setPlatformObject<T extends object>(obj: T, options?: { clone: CloneFn<T> }): void
|
|
24
|
+
export function setPlatformObject(obj: any, options?: { clone: (value: any) => any }): void {
|
|
25
|
+
if (typeof obj === 'function') {
|
|
26
|
+
;(obj.prototype as any)[IS_PLATFORM_OBJECT_KEY] = true
|
|
27
|
+
if (options) {
|
|
28
|
+
;(obj.prototype as any)[CLONE_PLATFORM_OBJECT_KEY] = options.clone
|
|
29
|
+
}
|
|
30
|
+
} else {
|
|
31
|
+
;(obj as any)[IS_PLATFORM_OBJECT_KEY] = true
|
|
32
|
+
if (options) {
|
|
33
|
+
;(obj as any)[CLONE_PLATFORM_OBJECT_KEY] = options.clone
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Indicates if the given object is a platform object.
|
|
40
|
+
*/
|
|
41
|
+
export function isPlatformObject<T extends object>(obj: T): boolean {
|
|
42
|
+
return IS_PLATFORM_OBJECT_KEY in (obj as any)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Returns the clone function for the given platform object, if it was set.
|
|
47
|
+
*/
|
|
48
|
+
export function getPlatformObjectClone<T extends object>(obj: T): ((value: T) => T) | undefined {
|
|
49
|
+
return (obj as any)[CLONE_PLATFORM_OBJECT_KEY]
|
|
50
|
+
}
|