Skip to content

Commit 265791f

Browse files
committed
Merge branch 'master' of github.com:cleandart/react-dart into 6.0.0-wip
2 parents f20d343 + 6285464 commit 265791f

File tree

5 files changed

+2193
-0
lines changed

5 files changed

+2193
-0
lines changed

lib/react.dart

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import 'package:react/src/react_client/private_utils.dart' show validateJsApiThe
2121

2222
export 'package:react/src/context.dart';
2323
export 'package:react/src/prop_validator.dart';
24+
export 'package:react/src/react_client/event_helpers.dart';
2425
export 'package:react/react_client/react_interop.dart' show forwardRef, forwardRef2, createRef, memo, memo2;
2526

2627
typedef Error PropValidator<TProps>(TProps props, PropValidatorInfo info);
@@ -1433,6 +1434,10 @@ class NotSpecified {
14331434
const NotSpecified();
14341435
}
14351436

1437+
const _syntheticEventDeprecationMessagePrefix = 'Creating events via constructors is no longer supported. ';
1438+
const _syntheticEventDeprecationMessagePostfix =
1439+
'Alternatively, use the `Simulate` test APIs to create events in testing environments.';
1440+
14361441
/// A cross-browser wrapper around the browser's [nativeEvent].
14371442
///
14381443
/// It has the same interface as the browser's native event, including [stopPropagation] and [preventDefault], except
@@ -1584,6 +1589,9 @@ class SyntheticEvent {
15841589
/// See: <https://developer.mozilla.org/en-US/docs/Web/API/Event/type>
15851590
final String type;
15861591

1592+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1593+
'Use `createSyntheticEvent` instead. ' +
1594+
_syntheticEventDeprecationMessagePostfix)
15871595
SyntheticEvent(
15881596
this.bubbles,
15891597
this.cancelable,
@@ -1602,6 +1610,9 @@ class SyntheticEvent {
16021610
class SyntheticClipboardEvent extends SyntheticEvent {
16031611
final clipboardData;
16041612

1613+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1614+
'Use `createSyntheticClipboardEvent` instead. ' +
1615+
_syntheticEventDeprecationMessagePostfix)
16051616
SyntheticClipboardEvent(
16061617
bool bubbles,
16071618
bool cancelable,
@@ -1633,6 +1644,9 @@ class SyntheticKeyboardEvent extends SyntheticEvent {
16331644
final num keyCode;
16341645
final num charCode;
16351646

1647+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1648+
'Use `createSyntheticKeyboardEvent` instead. ' +
1649+
_syntheticEventDeprecationMessagePostfix)
16361650
SyntheticKeyboardEvent(
16371651
bool bubbles,
16381652
bool cancelable,
@@ -1664,6 +1678,9 @@ class SyntheticKeyboardEvent extends SyntheticEvent {
16641678
class SyntheticCompositionEvent extends SyntheticEvent {
16651679
final String data;
16661680

1681+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1682+
'Use `createSyntheticCompositionEvent` instead. ' +
1683+
_syntheticEventDeprecationMessagePostfix)
16671684
SyntheticCompositionEvent(
16681685
bool bubbles,
16691686
bool cancelable,
@@ -1685,6 +1702,9 @@ class SyntheticCompositionEvent extends SyntheticEvent {
16851702
class SyntheticFocusEvent extends SyntheticEvent {
16861703
final /*DOMEventTarget*/ relatedTarget;
16871704

1705+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1706+
'Use `createSyntheticFocusEvent` instead. ' +
1707+
_syntheticEventDeprecationMessagePostfix)
16881708
SyntheticFocusEvent(
16891709
bool bubbles,
16901710
bool cancelable,
@@ -1704,6 +1724,9 @@ class SyntheticFocusEvent extends SyntheticEvent {
17041724
}
17051725

17061726
class SyntheticFormEvent extends SyntheticEvent {
1727+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1728+
'Use `createSyntheticFormEvent` instead. ' +
1729+
_syntheticEventDeprecationMessagePostfix)
17071730
SyntheticFormEvent(
17081731
bool bubbles,
17091732
bool cancelable,
@@ -1746,6 +1769,9 @@ class SyntheticMouseEvent extends SyntheticEvent {
17461769
final num screenY;
17471770
final bool shiftKey;
17481771

1772+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1773+
'Use `createSyntheticMouseEvent` instead. ' +
1774+
_syntheticEventDeprecationMessagePostfix)
17491775
SyntheticMouseEvent(
17501776
bool bubbles,
17511777
bool cancelable,
@@ -1789,6 +1815,9 @@ class SyntheticPointerEvent extends SyntheticEvent {
17891815
final String pointerType;
17901816
final bool isPrimary;
17911817

1818+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1819+
'Use `createSyntheticPointerEvent` instead. ' +
1820+
_syntheticEventDeprecationMessagePostfix)
17921821
SyntheticPointerEvent(
17931822
bool bubbles,
17941823
bool cancelable,
@@ -1825,6 +1854,9 @@ class SyntheticTouchEvent extends SyntheticEvent {
18251854
final /*DOMTouchList*/ targetTouches;
18261855
final /*DOMTouchList*/ touches;
18271856

1857+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1858+
'Use `createSyntheticTouchEvent` instead. ' +
1859+
_syntheticEventDeprecationMessagePostfix)
18281860
SyntheticTouchEvent(
18291861
bool bubbles,
18301862
bool cancelable,
@@ -1854,6 +1886,9 @@ class SyntheticTransitionEvent extends SyntheticEvent {
18541886
final num elapsedTime;
18551887
final String pseudoElement;
18561888

1889+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1890+
'Use `createSyntheticTransitionEvent` instead. ' +
1891+
_syntheticEventDeprecationMessagePostfix)
18571892
SyntheticTransitionEvent(
18581893
bubbles,
18591894
cancelable,
@@ -1879,6 +1914,9 @@ class SyntheticAnimationEvent extends SyntheticEvent {
18791914
final num elapsedTime;
18801915
final String pseudoElement;
18811916

1917+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1918+
'Use `createSyntheticAnimationEvent` instead. ' +
1919+
_syntheticEventDeprecationMessagePostfix)
18821920
SyntheticAnimationEvent(
18831921
bubbles,
18841922
cancelable,
@@ -1903,6 +1941,9 @@ class SyntheticUIEvent extends SyntheticEvent {
19031941
final num detail;
19041942
final /*DOMAbstractView*/ view;
19051943

1944+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1945+
'Use `createSyntheticUIEvent` instead. ' +
1946+
_syntheticEventDeprecationMessagePostfix)
19061947
SyntheticUIEvent(
19071948
bool bubbles,
19081949
bool cancelable,
@@ -1928,6 +1969,9 @@ class SyntheticWheelEvent extends SyntheticEvent {
19281969
final num deltaY;
19291970
final num deltaZ;
19301971

1972+
@Deprecated(_syntheticEventDeprecationMessagePrefix +
1973+
'Use `createSyntheticWheelEvent` instead. ' +
1974+
_syntheticEventDeprecationMessagePostfix)
19311975
SyntheticWheelEvent(
19321976
bool bubbles,
19331977
bool cancelable,

lib/src/react_client/event_factory.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: deprecated_member_use_from_same_package
2+
13
import 'dart:html';
24

35
import 'package:react/react.dart';

0 commit comments

Comments
 (0)