Skip to content

Commit

Permalink
Make more deprecated APIs private
Browse files Browse the repository at this point in the history
  • Loading branch information
greglittlefield-wf committed Oct 6, 2023
1 parent 36c5933 commit 91c9c2c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 31 deletions.
11 changes: 9 additions & 2 deletions lib/react_client/bridge.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
@JS()
library react.react_client.bridge;

import 'package:js/js.dart';
import 'package:meta/meta.dart';
import 'package:react/react.dart';
import 'package:react/react_client/js_backed_map.dart';
import 'package:react/react_client/react_interop.dart';
import 'package:react/src/typedefs.dart';

/// A function that returns a bridge instance for use with a given [component].
Expand Down Expand Up @@ -135,10 +137,15 @@ class Component2BridgeImpl extends Component2Bridge {
location: location,
propFullName: propFullName,
));
return error == null ? null : JsError(error.toString());
return error == null ? null : _JsError(error.toString());
}

return MapEntry(propKey, allowInterop(handlePropValidator));
})).jsObject;
}
}

@JS('Error')
class _JsError {
external _JsError(message);
}
28 changes: 0 additions & 28 deletions lib/react_client/react_interop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -422,17 +422,6 @@ class ReactClassConfig {
external set displayName(String value);
}

/// Interop class for the data structure at `ReactElement._store`.
///
/// Used to validate variadic children before they get to [React.createElement].
@Deprecated('For internal use only. Will be made private in 7.0.0.')
@JS()
@anonymous
class ReactElementStore {
external bool get validated;
external set validated(bool value);
}

/// A virtual DOM element representing an instance of a DOM element,
/// React component, or fragment.
///
Expand All @@ -453,8 +442,6 @@ class ReactElementStore {
@JS()
@anonymous
class ReactElement {
external ReactElementStore get _store; // ignore: unused_element

/// The type of this element.
///
/// For DOM components, this will be a [String] tagName (e.g., `'div'`, `'a'`).
Expand Down Expand Up @@ -581,13 +568,6 @@ class ReactDartComponentInternal {
final Map props;
}

/// Creates a new JS Error object with the provided message.
@Deprecated('For internal use only. Will be made private in 7.0.0.')
@JS('Error')
class JsError {
external JsError(message);
}

/// A JS variable that can be used with Dart interop in order to force returning a JavaScript `null`.
/// Use this if dart2js is possibly converting Dart `null` into `undefined`.
@JS('_jsNull')
Expand All @@ -603,14 +583,6 @@ external get jsUndefined;
@JS('_throwErrorFromJS')
external Never throwErrorFromJS(error);

/// Marks [child] as validated, as if it were passed into [React.createElement]
/// as a variadic child.
///
/// Offloaded to the JS to avoid dart2js interceptor lookup.
@Deprecated('For internal use only. Will be made private in 7.0.0.')
@JS('_markChildValidated')
external void markChildValidated(child);

@JS('React.__isDevelopment')
external bool get _inReactDevMode;

Expand Down
10 changes: 9 additions & 1 deletion lib/src/react_client/internal_react_interop.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:react/react.dart' show Component, Component2, ComponentFactory;
import 'package:react/react_client/bridge.dart';
import 'package:react/react_client/js_backed_map.dart';
import 'package:react/react_client/react_interop.dart'
show React, ReactClass, ReactComponent, ReactDartComponentInternal, markChildValidated;
show React, ReactClass, ReactComponent, ReactDartComponentInternal;

/// A JavaScript interop class representing a value in a React JS `context` object.
///
Expand Down Expand Up @@ -50,6 +50,14 @@ class ReactDartContextInternal {
ReactDartContextInternal(this.value);
}

/// Marks [child] as validated, as if it were passed into [React.createElement]
/// as a variadic child.
///
/// Offloaded to the JS to avoid dart2js interceptor lookup.
@JS('_markChildValidated')
@internal
external void markChildValidated(child);

/// Mark each child in [children] as validated so that React doesn't emit key warnings.
///
/// ___Only for use with variadic children.___
Expand Down
1 change: 1 addition & 0 deletions test/js_builds/shared_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:react/react.dart' as react;
import 'package:react/react_client/component_factory.dart';
import 'package:react/react_dom.dart' as react_dom;
import 'package:react/react_client/react_interop.dart';
import 'package:react/src/react_client/internal_react_interop.dart';
import 'package:test/test.dart';

void verifyJsFileLoaded(String filename) {
Expand Down

0 comments on commit 91c9c2c

Please sign in to comment.