diff --git a/example/suspense/index.html b/example/suspense/index.html index d37af6770..cee072da8 100644 --- a/example/suspense/index.html +++ b/example/suspense/index.html @@ -16,23 +16,56 @@ - - - - over_react Suspense example - - - + + + + over_react Suspense example + + + - + + + +
- - -
- - - - - - + + + + + diff --git a/example/suspense/main.dart b/example/suspense/main.dart index c1c93a4a5..cb7295621 100644 --- a/example/suspense/main.dart +++ b/example/suspense/main.dart @@ -14,11 +14,60 @@ import 'dart:html'; +import 'package:js/js.dart'; +import 'package:over_react/js_component.dart'; import 'package:over_react/over_react.dart'; +import 'package:react/react_client/component_factory.dart'; +import 'package:react/react_client/react_interop.dart' hide lazy; import 'package:react/react_dom.dart' as react_dom; import 'counter_component.dart' deferred as lazy_component; import 'third_party_file.dart'; +part 'main.over_react.g.dart'; + +@Props(keyNamespace: '') +mixin TestJsProps on UiProps { + @Accessor(key: 'buttonProps') + JsMap? _$raw$buttonProps; + + Map? get buttonProps => unjsifyMapProp(_$raw$buttonProps); + set buttonProps(Map? value) => _$raw$buttonProps = jsifyMapProp(value); + + @Accessor(key: 'listOfProps') + List? _$raw$listOfProps; + + List? get listOfProps => unjsifyMapListProp(_$raw$listOfProps); + set listOfProps(List? value) => _$raw$listOfProps = jsifyMapListProp(value); + + @Accessor(key: 'inputRef') + dynamic _$raw$inputRef; + + dynamic get inputRef => unjsifyRefProp(_$raw$inputRef); + set inputRef(dynamic value) => _$raw$inputRef = jsifyRefProp(value); + + @Accessor(key: 'messageContext') + ReactContext? _$raw$messageContext; + + Context? get messageContext => unjsifyContextProp(_$raw$messageContext); + set messageContext(Context? value) => _$raw$messageContext = jsifyContextProp(value); + + dynamic /*ElementType*/ component; + dynamic /*ElementType*/ inputComponent; + dynamic /*ElementType*/ buttonComponent; +} + +@JS('TestJsComponent') +external ReactClass get _TestJs; + +UiFactory TestJs = uiJsComponent( + ReactJsComponentFactoryProxy(_TestJs), + _$TestJsConfig, // ignore: undefined_identifier +); + +UiFactory LazyTestJs = lazy(() async => TestJs, +_$TestJsConfig, // ignore: undefined_identifier +); + UiFactory LazyCounter = lazy(() async { await Future.delayed(Duration(seconds: 5)); await lazy_component.loadLibrary(); @@ -37,7 +86,7 @@ void main() { 'I am a fallback UI that will show while we load the lazy component! The load time is artificially inflated to last an additional 5 seconds just to prove it\'s working!', ) )( - (LazyCounter()..initialCount = 2)( + (LazyTestJs())( (Dom.div()..id = 'Heyyy!')(), ), ), diff --git a/lib/src/util/lazy.dart b/lib/src/util/lazy.dart index 257dad30d..9b88ea23b 100644 --- a/lib/src/util/lazy.dart +++ b/lib/src/util/lazy.dart @@ -14,10 +14,12 @@ library over_react.lazy; +import 'dart:html'; + import 'package:over_react/over_react.dart'; import 'package:react/react.dart' as react; -UiFactory lazy(Future> Function() loadComponent,/* UiFactoryConfig */ dynamic _config) { +UiFactory lazy(Future> Function() loadComponent,/* UiFactoryConfig */ dynamic _config, {bool useJsFactoryProxy = false}) { ArgumentError.checkNotNull(_config, '_config'); if (_config is! UiFactoryConfig) { @@ -26,34 +28,33 @@ UiFactory lazy(Future> Functio r'using either the generated factory config (i.e. _$FooConfig) or manually ' 'declaring your config correctly.'); } - - final lazyFactoryProxy = react.lazy(() async { - final factory = await loadComponent(); - final wrapper = uiForwardRef( - (props, ref) { - final builder = factory() - ..addProps(props) - ..ref = ref; - return props.children == null || (props.children != null && props.children?.isEmpty != false) ? builder() : builder(props.children); - }, - UiFactoryConfig( - propsFactory: PropsFactory.fromUiFactory(factory), - displayName: 'Lazy${_config.displayName}', - ), - ); - return wrapper().componentFactory!; - // return factory().componentFactory!; - }); - - // ignore: invalid_use_of_protected_member + // ignore: invalid_use_of_protected_member final propsFactory = _config.propsFactory; ArgumentError.checkNotNull(propsFactory, '_config.propsFactory'); propsFactory!; + + final lazyFactoryProxy = react.lazy(() async { + final factory = await loadComponent(); + // final wrapper = uiForwardRef( + // (props, ref) { + // final builder = factory() + // ..addProps(props) + // ..ref = ref; + // return props.children == null || (props.children != null && props.children?.isEmpty != false) ? builder() : builder(props.children); + // }, + // UiFactoryConfig( + // propsFactory: PropsFactory.fromUiFactory(factory), + // displayName: 'Lazy${_config.displayName}', + // ), + // ); + // return wrapper().componentFactory!; + return factory().componentFactory!; + }, useJsFactoryProxy: useJsFactoryProxy); + TProps _uiFactory([Map? props]) { TProps builder; if (props == null) { - // propsFactory should get promoted to non-nullable here, but it does not some reason propsF builder = propsFactory.jsMap(JsBackedMap()); } else if (props is JsBackedMap) { builder = propsFactory.jsMap(props); diff --git a/test/over_react/component/lazy_test.dart b/test/over_react/component/lazy_test.dart index a2d319c0b..503fa83f8 100644 --- a/test/over_react/component/lazy_test.dart +++ b/test/over_react/component/lazy_test.dart @@ -2,12 +2,13 @@ @JS() library rmui.test.unit.component.lazy_test; +import 'dart:convert'; import 'dart:html'; import 'package:js/js.dart'; import 'package:over_react/js_component.dart'; import 'package:over_react/over_react.dart'; -import 'package:react/react_client/component_factory.dart'; +import 'package:react/react_client.dart'; import 'package:react/react_client/react_interop.dart' hide lazy; import 'package:react_testing_library/matchers.dart'; import 'package:react_testing_library/react_testing_library.dart'; @@ -15,15 +16,24 @@ import 'package:react_testing_library/react_testing_library.dart'; import 'package:test/test.dart'; import 'package:over_react/components.dart' as components; -import '../util/prop_conversion_test.dart'; import '../util/ref_test_cases.dart'; part 'lazy_test.over_react.g.dart'; main() { enableTestMode(); + group('lazy wrapped', () { + group('JS component', () { + sharedPropConversionTests(LazyTestJs, isJsComponent: true); + }); +group('Dart component', () { + sharedPropConversionTests(LazyTestDart); +}); + }); - group('lazy', () { +} + +sharedPropConversionTests(UiFactory builder, { bool isJsComponent = false }) { group('prop conversions', () { test('a custom Dart Map prop', () async { @@ -32,20 +42,24 @@ test('a custom Dart Map prop', () async { // Use an ErrorBoundary to detect errors on render, since otherwise // React will just unmount the tree without throwing. await expectLater(() async { - render((Suspense()..fallback='Loading')((components.ErrorBoundary() + render((Suspense()..fallback=Dom.div()('Loading'))((components.ErrorBoundary() ..onComponentDidCatch = ((error, _) => renderErrors.add(error)) ..shouldLogErrors = false ..fallbackUIRenderer = ((_, __) => Dom.span()('An error occurred during render')) )( - (LazyTestJS() - ..component = ExpectsDartMapProp.elementType + (builder() + ..component = (isJsComponent ? ExpectsDartMapProp.elementType : ExpectsDartMapProp) ..addProps(ExpectsDartMapProp()..dartMapProp = {'foo': 'bar'}) ..addTestId('componentRoot'))(), ), ), ); - await screen.findByText('An error occurred during render', timeout: Duration(seconds: 5)); + // if (!isJsComponent) { + await waitForElementToBeRemoved(() => screen.getByText('Loading')); + // } else { + // await screen.findByText('An error occurred during render'); + // } // Use prints as an easy way to swallow `print` calls and // prevent RTL from forwarding console errors to the test output, // since React error boundary logging is pretty noisy. @@ -53,19 +67,21 @@ test('a custom Dart Map prop', () async { }, prints(anything)); expect(renderErrors, [ - isA().havingToStringValue(anyOf( - // DDC error message - matches(RegExp( - r"Expected a value of type 'Map[^']*', but got one of type '(Native|Legacy)JavaScriptObject'")), - // dart2js error message - matches(RegExp( - r"type '(Unknown|Plain)JavaScriptObject' is not a subtype of type 'Map[^']*'")), - )), + // if (isJsComponent) + // isA().havingToStringValue(anyOf( + // // DDC error message + // matches(RegExp( + // r"Expected a value of type 'Map[^']*', but got one of type '(Native|Legacy)JavaScriptObject'")), + // // dart2js error message + // matches(RegExp( + // r"type '(Unknown|Plain)JavaScriptObject' is not a subtype of type 'Map[^']*'")), + // )), ]); - +// if (!isJsComponent) { // These are the expectations we'd use if this case didn't error: - // final node = view.getByTestId('componentRoot'); - // expect(node, hasAttribute('data-dart-map-prop', jsonEncode({'foo': 'bar'}))); + final node = screen.getByTestId('componentRoot'); + expect(node, hasAttribute('data-dart-map-prop', jsonEncode({'foo': 'bar'}))); +// } }, tags: ['js-interop-tradeoff']); group('and a ref is set on that component', () { group('which eventually ends up on a non-Dart component', () { @@ -77,9 +93,9 @@ test('a custom Dart Map prop', () async { final testCase = testCaseCollection.createCaseByName(testCaseName); - render((Suspense()..fallback='Loading')((LazyTestJS() + render((Suspense()..fallback='Loading')((builder() ..addTestId('test-js-component') - ..component = BasicForwardRef.elementType + ..component = (isJsComponent ? BasicForwardRef.elementType : BasicForwardRef) ..ref = testCase.ref)())); await screen.findByTestId('test-js-component'); expect(testCase.getCurrent(), isA()); @@ -99,10 +115,10 @@ test('a custom Dart Map prop', () async { final testCase = testCaseCollection.createCaseByName(testCaseName); - render((Suspense()..fallback='Loading')((LazyTestJS() - ..component = Dom.div.elementType + render((Suspense()..fallback='Loading')((builder() + ..component = (isJsComponent ? Dom.div.elementType : Dom.div) ..addTestId('test-js-component') - ..inputComponent = BasicForwardRef.elementType + ..inputComponent = (isJsComponent ? BasicForwardRef.elementType : BasicForwardRef) ..inputRef = testCase.ref)())); await screen.findByTestId('test-js-component'); expect(testCase.getCurrent(), isA()); @@ -122,10 +138,10 @@ test('a custom Dart Map prop', () async { final testCase = testCaseCollection.createCaseByName(testCaseName); - render((Suspense()..fallback='Loading')((LazyTestJS() - ..component = Dom.div.elementType + render((Suspense()..fallback='Loading')((builder() + ..component = (isJsComponent ? Dom.div.elementType : Dom.div) ..addTestId('test-js-component') - ..buttonComponent = BasicForwardRef.elementType + ..buttonComponent = (isJsComponent ? BasicForwardRef.elementType : BasicForwardRef) ..buttonProps = (domProps()..ref = testCase.ref))())); await screen.findByTestId('test-js-component'); expect(testCase.getCurrent(), isA()); @@ -187,10 +203,10 @@ test('a custom Dart Map prop', () async { final testCase = testCaseCollection.createCaseByName(testCaseName); - render((Suspense()..fallback='Loading')((LazyTestJS() - ..component = Dom.div.elementType +// GREG LOOK HERE + render((Suspense()..fallback='Loading')((builder() ..addTestId('test-js-component') - ..component = ClassComponent.elementType + ..component = (isJsComponent ? ClassComponent.elementType : ClassComponent) ..ref = testCase.ref)())); await screen.findByTestId('test-js-component'); if (isDartRefObjectCase) { @@ -223,10 +239,10 @@ test('a custom Dart Map prop', () async { final testCase = testCaseCollection.createCaseByName(testCaseName); - render((Suspense()..fallback='Loading')((LazyTestJS() - ..component = Dom.div.elementType + render((Suspense()..fallback='Loading')((builder() + ..component = (isJsComponent ? Dom.div.elementType : Dom.div) ..addTestId('test-js-component') - ..inputComponent = ClassComponent.elementType + ..inputComponent = (isJsComponent ? ClassComponent.elementType : ClassComponent) ..inputRef = testCase.ref)())); await screen.findByTestId('test-js-component'); if (isDartRefObjectCase) { @@ -257,10 +273,10 @@ test('a custom Dart Map prop', () async { final testCase = testCaseCollection.createCaseByName(testCaseName); - render((Suspense()..fallback='Loading')((LazyTestJS() - ..component = Dom.div.elementType + render((Suspense()..fallback='Loading')((builder() + ..component = (isJsComponent ? Dom.div.elementType : Dom.div) ..addTestId('test-js-component') - ..buttonComponent = ClassComponent.elementType + ..buttonComponent = (isJsComponent ? ClassComponent.elementType : ClassComponent) ..buttonProps = (domProps()..ref = testCase.ref))())); await screen.findByTestId('test-js-component'); // JS callbacks look the same to generateJsProps as Dart callback refs do, @@ -284,11 +300,177 @@ test('a custom Dart Map prop', () async { }); }); }); - }); } -UiFactory LazyTestJS = lazy(() async => TestJs, +UiFactory LazyTestJs = lazy(() async => TestJs, _$TestJsConfig, // ignore: undefined_identifier +//useJsFactoryProxy: true, +); + +UiFactory LazyTestDart = lazy(() async => TestDart, +_$TestDartConfig, // ignore: undefined_identifier +); + +// +// Matcher convenience functions +// + +Matcher sameOrSameAllowInterop(Function f) => + anyOf(same(allowInterop(f)), same(f)); + +extension on TypeMatcher { + Matcher havingJsRef(dynamic matcher) => + having((ref) => ref.jsRef, 'jsRef', matcher); +} + +extension on TypeMatcher { + Matcher havingJsThis(dynamic matcher) => + having((ref) => ref.jsThis, 'jsThis', matcher); +} + +extension on TypeMatcher { + Matcher havingToStringValue(dynamic matcher) => + having((o) => o.toString(), 'toString() value', matcher); +} + +extension on TypeMatcher { + Matcher havingDartComponent(dynamic matcher) => + having((ref) => ref.dartComponent, 'dartComponent', matcher); +} + +// +// Runtime type verification +// + +/// Verifies the runtime type of object, throwing a cast error if it does not match. +/// +/// Even though [object] typed as [T], we'll verify it explicitly in case +/// the type-check at the function call site gets compiled out. +void verifyType(T? object) { + if (T == Object || T == dynamic || T == Null) { + throw ArgumentError.value(T, 'T', 'must be more specific'); + } + + if (object is! T) { + // Try to get Dart to throw a real type error by explicitly casting. + // ignore: unnecessary_statements, unnecessary_cast + object as T; + + // The above `as` should always fail, but may not if the cast gets compiled out, + // or if there are edge cases in the type system cases where this seemingly-incorrect cast works. + // + // Explicitly throw an error so that this case doesn't go unnoticed. + throw UnexpectedSuccessfulCastError( + 'Casting ${Error.safeToString(object)} to type $T should have failed, but did not for some reason.' + ' Check the implementation of verifyType.'); + } +} + +class UnexpectedSuccessfulCastError extends Error { + final String message; + + UnexpectedSuccessfulCastError(this.message); + + @override + String toString() => message; +} + +// +// Test components for use as JS `component` prop +// + +mixin ExpectsDartMapPropProps on UiProps { + Map? dartMapProp; +} + +UiFactory ExpectsDartMapProp = uiForwardRef( + (props, ref) { + verifyType(props.dartMapProp); + + return (Dom.div() + ..addProps(props) + // Use the prop in a way that would fail if it wasn't the correct type + ..['data-dart-map-prop'] = jsonEncode(props.dartMapProp) + ..ref = ref)(props.children); + }, + _$ExpectsDartMapPropConfig, // ignore: undefined_identifier +); + +mixin ExpectsDartStylePropProps on UiProps {} + +UiFactory ExpectsDartStyleProp = uiForwardRef( + (props, ref) { + verifyType>(props.style); + + return (Dom.div() + ..addProps(props) + ..style = { + // Use the prop in a way that would fail if it wasn't the correct type + ...props.style!, + })(props.children); + }, + _$ExpectsDartStylePropConfig, // ignore: undefined_identifier +); + +mixin ExpectsListChildrenPropProps on UiProps {} + +UiFactory ExpectsListChildrenProp = uiForwardRef( + (props, ref) { + verifyType(props.children); + + return (Dom.div()..addProps(props))( + // Use the prop in a way that would fail if it wasn't the correct type + props.children!.map((child) => child), + ); + }, + _$ExpectsListChildrenPropConfig, // ignore: undefined_identifier +); + +// +// Other test components +// + +UiFactory ClassComponent = + castUiFactory(_$ClassComponent); // ignore: undefined_identifier + +mixin ClassComponentProps on UiProps {} + +class ClassComponentComponent extends UiComponent2 { + @override + render() { + return (Dom.div()..addProps(props))(props.children); + } +} + +mixin BasicForwardRefProps on UiProps {} + +const basicForwardRefAttribute = 'data-basic-forward-ref'; +UiFactory BasicForwardRef = uiForwardRef( + (props, ref) { + return (Dom.span() + ..addProps(props) + ..[basicForwardRefAttribute] = '' + ..ref = ref)(props.children); + }, + _$BasicForwardRefConfig, // ignore: undefined_identifier +); + +mixin DartTestJsWrapperPropsMixin on UiProps { + void Function(DartTestJsWrapperProps props)? onRender; +} + +class DartTestJsWrapperProps = UiProps + with TestJsProps, DartTestJsWrapperPropsMixin; + +UiFactory DartTestJsWrapper = uiForwardRef( + (props, ref) { + props.onRender?.call(props); + + return (TestJs() + ..addProps(props.getPropsToForward(exclude: {DartTestJsWrapperPropsMixin})) + ..ref = ref)(props.children); + }, + _$DartTestJsWrapperConfig, // ignore: undefined_identifier ); // @@ -334,3 +516,33 @@ UiFactory TestJs = uiJsComponent( @JS('TestJsComponent') external ReactClass get _TestJs; + + +final defaultMessageContext = createContextInit('default context value'); + +@Props(keyNamespace: '') +class TestDartProps = UiProps with TestJsProps; + +UiFactory TestDart = uiForwardRef( + (props, ref) { + + final buttonProps = props.buttonProps ?? const {}; + final listOfProps = props.listOfProps ?? const [{}]; + final inputRef = props.inputRef; + final buttonComponent = props.buttonComponent ?? Dom.button; + final inputComponent = props.inputComponent ?? Dom.input; + final component = props.component ?? Dom.span; + final children = props.children; + final messageContext = defaultMessageContext; + + final message = useContext(messageContext); + return Dom.div()( + (buttonComponent()..addProps(buttonProps))(), + (Dom.li()..addProps(listOfProps[0] ?? {}))(), + (inputComponent()..addProps(Dom.input()..type = 'text')..ref = inputRef)(), + (component()..addProps(props.getPropsToForward(exclude: {TestJsProps}))..ref = ref)(children), + (Dom.div()..role = 'alert')(message), + ); + }, + _$TestDartConfig, // ignore: undefined_identifier +); diff --git a/test/over_react/component/lazy_test.over_react.g.dart b/test/over_react/component/lazy_test.over_react.g.dart index 076e13a6c..081552584 100644 --- a/test/over_react/component/lazy_test.over_react.g.dart +++ b/test/over_react/component/lazy_test.over_react.g.dart @@ -7,6 +7,342 @@ part of 'lazy_test.dart'; // OverReactBuilder (package:over_react/src/builder.dart) // ************************************************************************** +// React component factory implementation. +// +// Registers component implementation and links type meta to builder factory. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +final $ClassComponentComponentFactory = registerComponent2( + () => _$ClassComponentComponent(), + builderFactory: _$ClassComponent, + componentClass: ClassComponentComponent, + isWrapper: false, + parentType: null, +); + +_$$ClassComponentProps _$ClassComponent([Map? backingProps]) => + backingProps == null + ? _$$ClassComponentProps$JsMap(JsBackedMap()) + : _$$ClassComponentProps(backingProps); + +// Concrete props implementation. +// +// Implements constructor and backing map, and links up to generated component factory. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +abstract class _$$ClassComponentProps extends UiProps + with + ClassComponentProps, + // If this generated mixin is undefined, it's likely because ClassComponentProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ClassComponentProps, and check that $ClassComponentProps is exported/imported properly. + $ClassComponentProps { + _$$ClassComponentProps._(); + + factory _$$ClassComponentProps(Map? backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$ClassComponentProps$JsMap(backingMap as JsBackedMap?); + } else { + return _$$ClassComponentProps$PlainMap(backingMap); + } + } + + /// Let `UiProps` internals know that this class has been generated. + @override + bool get $isClassGenerated => true; + + /// The `ReactComponentFactory` associated with the component built by this class. + @override + ReactComponentFactoryProxy get componentFactory => + super.componentFactory ?? $ClassComponentComponentFactory; + + /// The default namespace for the prop getters/setters generated for this class. + @override + String get propKeyNamespace => ''; + + @override + PropsMetaCollection get staticMeta => const PropsMetaCollection({ + // If this generated mixin is undefined, it's likely because ClassComponentProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ClassComponentProps, and check that $ClassComponentProps is exported/imported properly. + ClassComponentProps: $ClassComponentProps.meta, + }); + + @override + String $getPropKey(void Function(Map m) accessMap) => + _$getPropKey$_$$ClassComponentProps( + accessMap, (map) => _$$ClassComponentProps(map)); +} + +/// An alias for [getPropKey] so it can be referenced within the props class impl +/// without being shadowed by the `getPropKey` instance extension member. +const _$getPropKey$_$$ClassComponentProps = getPropKey; + +// Concrete props implementation that can be backed by any [Map]. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$ClassComponentProps$PlainMap extends _$$ClassComponentProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$ClassComponentProps$PlainMap(Map? backingMap) + : this._props = {}, + super._() { + this._props = backingMap ?? {}; + } + + /// The backing props map proxied by this class. + @override + Map get props => _props; + Map _props; +} + +// Concrete props implementation that can only be backed by [JsMap], +// allowing dart2js to compile more optimal code for key-value pair reads/writes. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$ClassComponentProps$JsMap extends _$$ClassComponentProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$ClassComponentProps$JsMap(JsBackedMap? backingMap) + : this._props = JsBackedMap(), + super._() { + this._props = backingMap ?? JsBackedMap(); + } + + /// The backing props map proxied by this class. + @override + JsBackedMap get props => _props; + JsBackedMap _props; +} + +// Concrete component implementation mixin. +// +// Implements typed props/state factories, defaults `consumedPropKeys` to the keys +// generated for the associated props class. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$ClassComponentComponent extends ClassComponentComponent { + late _$$ClassComponentProps$JsMap _cachedTypedProps; + + @override + _$$ClassComponentProps$JsMap get props => _cachedTypedProps; + + @override + set props(Map value) { + assert( + getBackingMap(value) is JsBackedMap, + 'Component2.props should never be set directly in ' + 'production. If this is required for testing, the ' + 'component should be rendered within the test. If ' + 'that does not have the necessary result, the last ' + 'resort is to use typedPropsFactoryJs.'); + super.props = value; + _cachedTypedProps = + typedPropsFactoryJs(getBackingMap(value) as JsBackedMap); + } + + @override + _$$ClassComponentProps$JsMap typedPropsFactoryJs(JsBackedMap? backingMap) => + _$$ClassComponentProps$JsMap(backingMap); + + @override + _$$ClassComponentProps typedPropsFactory(Map? backingMap) => + _$$ClassComponentProps(backingMap); + + /// Let `UiComponent` internals know that this class has been generated. + @override + bool get $isClassGenerated => true; + + @override + String get displayName => 'ClassComponent'; + + /// The default consumed props, comprising all props mixins used by ClassComponentProps. + /// Used in `*ConsumedProps` methods if [consumedProps] is not overridden. + @override + get $defaultConsumedProps => propsMeta.all; + + @override + PropsMetaCollection get propsMeta => const PropsMetaCollection({ + // If this generated mixin is undefined, it's likely because ClassComponentProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ClassComponentProps, and check that $ClassComponentProps is exported/imported properly. + ClassComponentProps: $ClassComponentProps.meta, + }); +} + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.' + ' EXCEPTION: this may be used in legacy boilerplate until' + ' it is transitioned to the new mixin-based boilerplate.') +mixin $ExpectsDartMapPropProps on ExpectsDartMapPropProps { + static const PropsMeta meta = _$metaForExpectsDartMapPropProps; + @override + Map? get dartMapProp => + (props[_$key__dartMapProp__ExpectsDartMapPropProps] ?? null) as Map?; + @override + set dartMapProp(Map? value) => + props[_$key__dartMapProp__ExpectsDartMapPropProps] = value; + /* GENERATED CONSTANTS */ + static const PropDescriptor _$prop__dartMapProp__ExpectsDartMapPropProps = + PropDescriptor(_$key__dartMapProp__ExpectsDartMapPropProps); + static const String _$key__dartMapProp__ExpectsDartMapPropProps = + 'ExpectsDartMapPropProps.dartMapProp'; + + static const List $props = [ + _$prop__dartMapProp__ExpectsDartMapPropProps + ]; + static const List $propKeys = [ + _$key__dartMapProp__ExpectsDartMapPropProps + ]; + + @override + @UiProps.$mustCallSuper + void validateRequiredProps() { + super.validateRequiredProps(); + } +} + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +const PropsMeta _$metaForExpectsDartMapPropProps = PropsMeta( + fields: $ExpectsDartMapPropProps.$props, + keys: $ExpectsDartMapPropProps.$propKeys, +); + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.' + ' EXCEPTION: this may be used in legacy boilerplate until' + ' it is transitioned to the new mixin-based boilerplate.') +mixin $ExpectsDartStylePropProps on ExpectsDartStylePropProps { + static const PropsMeta meta = _$metaForExpectsDartStylePropProps; + /* GENERATED CONSTANTS */ + + static const List $props = []; + static const List $propKeys = []; + + @override + @UiProps.$mustCallSuper + void validateRequiredProps() { + super.validateRequiredProps(); + } +} + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +const PropsMeta _$metaForExpectsDartStylePropProps = PropsMeta( + fields: $ExpectsDartStylePropProps.$props, + keys: $ExpectsDartStylePropProps.$propKeys, +); + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.' + ' EXCEPTION: this may be used in legacy boilerplate until' + ' it is transitioned to the new mixin-based boilerplate.') +mixin $ExpectsListChildrenPropProps on ExpectsListChildrenPropProps { + static const PropsMeta meta = _$metaForExpectsListChildrenPropProps; + /* GENERATED CONSTANTS */ + + static const List $props = []; + static const List $propKeys = []; + + @override + @UiProps.$mustCallSuper + void validateRequiredProps() { + super.validateRequiredProps(); + } +} + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +const PropsMeta _$metaForExpectsListChildrenPropProps = PropsMeta( + fields: $ExpectsListChildrenPropProps.$props, + keys: $ExpectsListChildrenPropProps.$propKeys, +); + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.' + ' EXCEPTION: this may be used in legacy boilerplate until' + ' it is transitioned to the new mixin-based boilerplate.') +mixin $ClassComponentProps on ClassComponentProps { + static const PropsMeta meta = _$metaForClassComponentProps; + /* GENERATED CONSTANTS */ + + static const List $props = []; + static const List $propKeys = []; + + @override + @UiProps.$mustCallSuper + void validateRequiredProps() { + super.validateRequiredProps(); + } +} + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +const PropsMeta _$metaForClassComponentProps = PropsMeta( + fields: $ClassComponentProps.$props, + keys: $ClassComponentProps.$propKeys, +); + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.' + ' EXCEPTION: this may be used in legacy boilerplate until' + ' it is transitioned to the new mixin-based boilerplate.') +mixin $BasicForwardRefProps on BasicForwardRefProps { + static const PropsMeta meta = _$metaForBasicForwardRefProps; + /* GENERATED CONSTANTS */ + + static const List $props = []; + static const List $propKeys = []; + + @override + @UiProps.$mustCallSuper + void validateRequiredProps() { + super.validateRequiredProps(); + } +} + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +const PropsMeta _$metaForBasicForwardRefProps = PropsMeta( + fields: $BasicForwardRefProps.$props, + keys: $BasicForwardRefProps.$propKeys, +); + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.' + ' EXCEPTION: this may be used in legacy boilerplate until' + ' it is transitioned to the new mixin-based boilerplate.') +mixin $DartTestJsWrapperPropsMixin on DartTestJsWrapperPropsMixin { + static const PropsMeta meta = _$metaForDartTestJsWrapperPropsMixin; + @override + void Function(DartTestJsWrapperProps props)? get onRender => + (props[_$key__onRender__DartTestJsWrapperPropsMixin] ?? null) as void + Function(DartTestJsWrapperProps props)?; + @override + set onRender(void Function(DartTestJsWrapperProps props)? value) => + props[_$key__onRender__DartTestJsWrapperPropsMixin] = value; + /* GENERATED CONSTANTS */ + static const PropDescriptor _$prop__onRender__DartTestJsWrapperPropsMixin = + PropDescriptor(_$key__onRender__DartTestJsWrapperPropsMixin); + static const String _$key__onRender__DartTestJsWrapperPropsMixin = + 'DartTestJsWrapperPropsMixin.onRender'; + + static const List $props = [ + _$prop__onRender__DartTestJsWrapperPropsMixin + ]; + static const List $propKeys = [ + _$key__onRender__DartTestJsWrapperPropsMixin + ]; + + @override + @UiProps.$mustCallSuper + void validateRequiredProps() { + super.validateRequiredProps(); + } +} + +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +const PropsMeta _$metaForDartTestJsWrapperPropsMixin = PropsMeta( + fields: $DartTestJsWrapperPropsMixin.$props, + keys: $DartTestJsWrapperPropsMixin.$propKeys, +); + @Deprecated('This API is for use only within generated code.' ' Do not reference it in your code, as it may change at any time.' ' EXCEPTION: this may be used in legacy boilerplate until' @@ -211,3 +547,583 @@ class _$$TestJsProps$JsMap extends _$$TestJsProps { JsBackedMap get props => _props; JsBackedMap _props; } + +final UiFactoryConfig<_$$ExpectsDartMapPropProps> _$ExpectsDartMapPropConfig = + UiFactoryConfig( + propsFactory: PropsFactory( + map: (map) => _$$ExpectsDartMapPropProps(map), + jsMap: (map) => _$$ExpectsDartMapPropProps$JsMap(map), + ), + displayName: 'ExpectsDartMapProp'); + +@Deprecated(r'Use the private variable, _$ExpectsDartMapPropConfig, instead ' + 'and update the `over_react` lower bound to version 4.1.0. ' + 'For information on why this is deprecated, see https://github.com/Workiva/over_react/pull/650') +final UiFactoryConfig<_$$ExpectsDartMapPropProps> $ExpectsDartMapPropConfig = + _$ExpectsDartMapPropConfig; + +// Concrete props implementation. +// +// Implements constructor and backing map, and links up to generated component factory. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +abstract class _$$ExpectsDartMapPropProps extends UiProps + with + ExpectsDartMapPropProps, + // If this generated mixin is undefined, it's likely because ExpectsDartMapPropProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ExpectsDartMapPropProps, and check that $ExpectsDartMapPropProps is exported/imported properly. + $ExpectsDartMapPropProps { + _$$ExpectsDartMapPropProps._(); + + factory _$$ExpectsDartMapPropProps(Map? backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$ExpectsDartMapPropProps$JsMap(backingMap as JsBackedMap?); + } else { + return _$$ExpectsDartMapPropProps$PlainMap(backingMap); + } + } + + /// Let `UiProps` internals know that this class has been generated. + @override + bool get $isClassGenerated => true; + + /// The default namespace for the prop getters/setters generated for this class. + @override + String get propKeyNamespace => ''; + + @override + PropsMetaCollection get staticMeta => const PropsMetaCollection({ + // If this generated mixin is undefined, it's likely because ExpectsDartMapPropProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ExpectsDartMapPropProps, and check that $ExpectsDartMapPropProps is exported/imported properly. + ExpectsDartMapPropProps: $ExpectsDartMapPropProps.meta, + }); + + @override + String $getPropKey(void Function(Map m) accessMap) => + _$getPropKey$_$$ExpectsDartMapPropProps( + accessMap, (map) => _$$ExpectsDartMapPropProps(map)); +} + +/// An alias for [getPropKey] so it can be referenced within the props class impl +/// without being shadowed by the `getPropKey` instance extension member. +const _$getPropKey$_$$ExpectsDartMapPropProps = getPropKey; + +// Concrete props implementation that can be backed by any [Map]. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$ExpectsDartMapPropProps$PlainMap extends _$$ExpectsDartMapPropProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$ExpectsDartMapPropProps$PlainMap(Map? backingMap) + : this._props = {}, + super._() { + this._props = backingMap ?? {}; + } + + /// The backing props map proxied by this class. + @override + Map get props => _props; + Map _props; +} + +// Concrete props implementation that can only be backed by [JsMap], +// allowing dart2js to compile more optimal code for key-value pair reads/writes. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$ExpectsDartMapPropProps$JsMap extends _$$ExpectsDartMapPropProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$ExpectsDartMapPropProps$JsMap(JsBackedMap? backingMap) + : this._props = JsBackedMap(), + super._() { + this._props = backingMap ?? JsBackedMap(); + } + + /// The backing props map proxied by this class. + @override + JsBackedMap get props => _props; + JsBackedMap _props; +} + +final UiFactoryConfig<_$$ExpectsDartStylePropProps> + _$ExpectsDartStylePropConfig = UiFactoryConfig( + propsFactory: PropsFactory( + map: (map) => _$$ExpectsDartStylePropProps(map), + jsMap: (map) => _$$ExpectsDartStylePropProps$JsMap(map), + ), + displayName: 'ExpectsDartStyleProp'); + +@Deprecated(r'Use the private variable, _$ExpectsDartStylePropConfig, instead ' + 'and update the `over_react` lower bound to version 4.1.0. ' + 'For information on why this is deprecated, see https://github.com/Workiva/over_react/pull/650') +final UiFactoryConfig<_$$ExpectsDartStylePropProps> + $ExpectsDartStylePropConfig = _$ExpectsDartStylePropConfig; + +// Concrete props implementation. +// +// Implements constructor and backing map, and links up to generated component factory. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +abstract class _$$ExpectsDartStylePropProps extends UiProps + with + ExpectsDartStylePropProps, + // If this generated mixin is undefined, it's likely because ExpectsDartStylePropProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ExpectsDartStylePropProps, and check that $ExpectsDartStylePropProps is exported/imported properly. + $ExpectsDartStylePropProps { + _$$ExpectsDartStylePropProps._(); + + factory _$$ExpectsDartStylePropProps(Map? backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$ExpectsDartStylePropProps$JsMap(backingMap as JsBackedMap?); + } else { + return _$$ExpectsDartStylePropProps$PlainMap(backingMap); + } + } + + /// Let `UiProps` internals know that this class has been generated. + @override + bool get $isClassGenerated => true; + + /// The default namespace for the prop getters/setters generated for this class. + @override + String get propKeyNamespace => ''; + + @override + PropsMetaCollection get staticMeta => const PropsMetaCollection({ + // If this generated mixin is undefined, it's likely because ExpectsDartStylePropProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ExpectsDartStylePropProps, and check that $ExpectsDartStylePropProps is exported/imported properly. + ExpectsDartStylePropProps: $ExpectsDartStylePropProps.meta, + }); + + @override + String $getPropKey(void Function(Map m) accessMap) => + _$getPropKey$_$$ExpectsDartStylePropProps( + accessMap, (map) => _$$ExpectsDartStylePropProps(map)); +} + +/// An alias for [getPropKey] so it can be referenced within the props class impl +/// without being shadowed by the `getPropKey` instance extension member. +const _$getPropKey$_$$ExpectsDartStylePropProps = getPropKey; + +// Concrete props implementation that can be backed by any [Map]. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$ExpectsDartStylePropProps$PlainMap + extends _$$ExpectsDartStylePropProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$ExpectsDartStylePropProps$PlainMap(Map? backingMap) + : this._props = {}, + super._() { + this._props = backingMap ?? {}; + } + + /// The backing props map proxied by this class. + @override + Map get props => _props; + Map _props; +} + +// Concrete props implementation that can only be backed by [JsMap], +// allowing dart2js to compile more optimal code for key-value pair reads/writes. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$ExpectsDartStylePropProps$JsMap extends _$$ExpectsDartStylePropProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$ExpectsDartStylePropProps$JsMap(JsBackedMap? backingMap) + : this._props = JsBackedMap(), + super._() { + this._props = backingMap ?? JsBackedMap(); + } + + /// The backing props map proxied by this class. + @override + JsBackedMap get props => _props; + JsBackedMap _props; +} + +final UiFactoryConfig<_$$ExpectsListChildrenPropProps> + _$ExpectsListChildrenPropConfig = UiFactoryConfig( + propsFactory: PropsFactory( + map: (map) => _$$ExpectsListChildrenPropProps(map), + jsMap: (map) => _$$ExpectsListChildrenPropProps$JsMap(map), + ), + displayName: 'ExpectsListChildrenProp'); + +@Deprecated( + r'Use the private variable, _$ExpectsListChildrenPropConfig, instead ' + 'and update the `over_react` lower bound to version 4.1.0. ' + 'For information on why this is deprecated, see https://github.com/Workiva/over_react/pull/650') +final UiFactoryConfig<_$$ExpectsListChildrenPropProps> + $ExpectsListChildrenPropConfig = _$ExpectsListChildrenPropConfig; + +// Concrete props implementation. +// +// Implements constructor and backing map, and links up to generated component factory. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +abstract class _$$ExpectsListChildrenPropProps extends UiProps + with + ExpectsListChildrenPropProps, + // If this generated mixin is undefined, it's likely because ExpectsListChildrenPropProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ExpectsListChildrenPropProps, and check that $ExpectsListChildrenPropProps is exported/imported properly. + $ExpectsListChildrenPropProps { + _$$ExpectsListChildrenPropProps._(); + + factory _$$ExpectsListChildrenPropProps(Map? backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$ExpectsListChildrenPropProps$JsMap(backingMap as JsBackedMap?); + } else { + return _$$ExpectsListChildrenPropProps$PlainMap(backingMap); + } + } + + /// Let `UiProps` internals know that this class has been generated. + @override + bool get $isClassGenerated => true; + + /// The default namespace for the prop getters/setters generated for this class. + @override + String get propKeyNamespace => ''; + + @override + PropsMetaCollection get staticMeta => const PropsMetaCollection({ + // If this generated mixin is undefined, it's likely because ExpectsListChildrenPropProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ExpectsListChildrenPropProps, and check that $ExpectsListChildrenPropProps is exported/imported properly. + ExpectsListChildrenPropProps: $ExpectsListChildrenPropProps.meta, + }); + + @override + String $getPropKey(void Function(Map m) accessMap) => + _$getPropKey$_$$ExpectsListChildrenPropProps( + accessMap, (map) => _$$ExpectsListChildrenPropProps(map)); +} + +/// An alias for [getPropKey] so it can be referenced within the props class impl +/// without being shadowed by the `getPropKey` instance extension member. +const _$getPropKey$_$$ExpectsListChildrenPropProps = getPropKey; + +// Concrete props implementation that can be backed by any [Map]. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$ExpectsListChildrenPropProps$PlainMap + extends _$$ExpectsListChildrenPropProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$ExpectsListChildrenPropProps$PlainMap(Map? backingMap) + : this._props = {}, + super._() { + this._props = backingMap ?? {}; + } + + /// The backing props map proxied by this class. + @override + Map get props => _props; + Map _props; +} + +// Concrete props implementation that can only be backed by [JsMap], +// allowing dart2js to compile more optimal code for key-value pair reads/writes. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$ExpectsListChildrenPropProps$JsMap + extends _$$ExpectsListChildrenPropProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$ExpectsListChildrenPropProps$JsMap(JsBackedMap? backingMap) + : this._props = JsBackedMap(), + super._() { + this._props = backingMap ?? JsBackedMap(); + } + + /// The backing props map proxied by this class. + @override + JsBackedMap get props => _props; + JsBackedMap _props; +} + +final UiFactoryConfig<_$$BasicForwardRefProps> _$BasicForwardRefConfig = + UiFactoryConfig( + propsFactory: PropsFactory( + map: (map) => _$$BasicForwardRefProps(map), + jsMap: (map) => _$$BasicForwardRefProps$JsMap(map), + ), + displayName: 'BasicForwardRef'); + +@Deprecated(r'Use the private variable, _$BasicForwardRefConfig, instead ' + 'and update the `over_react` lower bound to version 4.1.0. ' + 'For information on why this is deprecated, see https://github.com/Workiva/over_react/pull/650') +final UiFactoryConfig<_$$BasicForwardRefProps> $BasicForwardRefConfig = + _$BasicForwardRefConfig; + +// Concrete props implementation. +// +// Implements constructor and backing map, and links up to generated component factory. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +abstract class _$$BasicForwardRefProps extends UiProps + with + BasicForwardRefProps, + // If this generated mixin is undefined, it's likely because BasicForwardRefProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicForwardRefProps, and check that $BasicForwardRefProps is exported/imported properly. + $BasicForwardRefProps { + _$$BasicForwardRefProps._(); + + factory _$$BasicForwardRefProps(Map? backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$BasicForwardRefProps$JsMap(backingMap as JsBackedMap?); + } else { + return _$$BasicForwardRefProps$PlainMap(backingMap); + } + } + + /// Let `UiProps` internals know that this class has been generated. + @override + bool get $isClassGenerated => true; + + /// The default namespace for the prop getters/setters generated for this class. + @override + String get propKeyNamespace => ''; + + @override + PropsMetaCollection get staticMeta => const PropsMetaCollection({ + // If this generated mixin is undefined, it's likely because BasicForwardRefProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicForwardRefProps, and check that $BasicForwardRefProps is exported/imported properly. + BasicForwardRefProps: $BasicForwardRefProps.meta, + }); + + @override + String $getPropKey(void Function(Map m) accessMap) => + _$getPropKey$_$$BasicForwardRefProps( + accessMap, (map) => _$$BasicForwardRefProps(map)); +} + +/// An alias for [getPropKey] so it can be referenced within the props class impl +/// without being shadowed by the `getPropKey` instance extension member. +const _$getPropKey$_$$BasicForwardRefProps = getPropKey; + +// Concrete props implementation that can be backed by any [Map]. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$BasicForwardRefProps$PlainMap extends _$$BasicForwardRefProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$BasicForwardRefProps$PlainMap(Map? backingMap) + : this._props = {}, + super._() { + this._props = backingMap ?? {}; + } + + /// The backing props map proxied by this class. + @override + Map get props => _props; + Map _props; +} + +// Concrete props implementation that can only be backed by [JsMap], +// allowing dart2js to compile more optimal code for key-value pair reads/writes. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$BasicForwardRefProps$JsMap extends _$$BasicForwardRefProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$BasicForwardRefProps$JsMap(JsBackedMap? backingMap) + : this._props = JsBackedMap(), + super._() { + this._props = backingMap ?? JsBackedMap(); + } + + /// The backing props map proxied by this class. + @override + JsBackedMap get props => _props; + JsBackedMap _props; +} + +final UiFactoryConfig<_$$DartTestJsWrapperProps> _$DartTestJsWrapperConfig = + UiFactoryConfig( + propsFactory: PropsFactory( + map: (map) => _$$DartTestJsWrapperProps(map), + jsMap: (map) => _$$DartTestJsWrapperProps$JsMap(map), + ), + displayName: 'DartTestJsWrapper'); + +@Deprecated(r'Use the private variable, _$DartTestJsWrapperConfig, instead ' + 'and update the `over_react` lower bound to version 4.1.0. ' + 'For information on why this is deprecated, see https://github.com/Workiva/over_react/pull/650') +final UiFactoryConfig<_$$DartTestJsWrapperProps> $DartTestJsWrapperConfig = + _$DartTestJsWrapperConfig; + +// Concrete props implementation. +// +// Implements constructor and backing map, and links up to generated component factory. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +abstract class _$$DartTestJsWrapperProps extends UiProps + with + TestJsProps, + // If this generated mixin is undefined, it's likely because TestJsProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestJsProps, and check that $TestJsProps is exported/imported properly. + $TestJsProps, + DartTestJsWrapperPropsMixin, + // If this generated mixin is undefined, it's likely because DartTestJsWrapperPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of DartTestJsWrapperPropsMixin, and check that $DartTestJsWrapperPropsMixin is exported/imported properly. + $DartTestJsWrapperPropsMixin + implements + DartTestJsWrapperProps { + _$$DartTestJsWrapperProps._(); + + factory _$$DartTestJsWrapperProps(Map? backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$DartTestJsWrapperProps$JsMap(backingMap as JsBackedMap?); + } else { + return _$$DartTestJsWrapperProps$PlainMap(backingMap); + } + } + + /// Let `UiProps` internals know that this class has been generated. + @override + bool get $isClassGenerated => true; + + /// The default namespace for the prop getters/setters generated for this class. + @override + String get propKeyNamespace => ''; + + @override + PropsMetaCollection get staticMeta => const PropsMetaCollection({ + // If this generated mixin is undefined, it's likely because TestJsProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestJsProps, and check that $TestJsProps is exported/imported properly. + TestJsProps: $TestJsProps.meta, + // If this generated mixin is undefined, it's likely because DartTestJsWrapperPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of DartTestJsWrapperPropsMixin, and check that $DartTestJsWrapperPropsMixin is exported/imported properly. + DartTestJsWrapperPropsMixin: $DartTestJsWrapperPropsMixin.meta, + }); + + @override + String $getPropKey(void Function(Map m) accessMap) => + _$getPropKey$_$$DartTestJsWrapperProps( + accessMap, (map) => _$$DartTestJsWrapperProps(map)); +} + +/// An alias for [getPropKey] so it can be referenced within the props class impl +/// without being shadowed by the `getPropKey` instance extension member. +const _$getPropKey$_$$DartTestJsWrapperProps = getPropKey; + +// Concrete props implementation that can be backed by any [Map]. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$DartTestJsWrapperProps$PlainMap extends _$$DartTestJsWrapperProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$DartTestJsWrapperProps$PlainMap(Map? backingMap) + : this._props = {}, + super._() { + this._props = backingMap ?? {}; + } + + /// The backing props map proxied by this class. + @override + Map get props => _props; + Map _props; +} + +// Concrete props implementation that can only be backed by [JsMap], +// allowing dart2js to compile more optimal code for key-value pair reads/writes. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$DartTestJsWrapperProps$JsMap extends _$$DartTestJsWrapperProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$DartTestJsWrapperProps$JsMap(JsBackedMap? backingMap) + : this._props = JsBackedMap(), + super._() { + this._props = backingMap ?? JsBackedMap(); + } + + /// The backing props map proxied by this class. + @override + JsBackedMap get props => _props; + JsBackedMap _props; +} + +final UiFactoryConfig<_$$TestDartProps> _$TestDartConfig = UiFactoryConfig( + propsFactory: PropsFactory( + map: (map) => _$$TestDartProps(map), + jsMap: (map) => _$$TestDartProps$JsMap(map), + ), + displayName: 'TestDart'); + +@Deprecated(r'Use the private variable, _$TestDartConfig, instead ' + 'and update the `over_react` lower bound to version 4.1.0. ' + 'For information on why this is deprecated, see https://github.com/Workiva/over_react/pull/650') +final UiFactoryConfig<_$$TestDartProps> $TestDartConfig = _$TestDartConfig; + +// Concrete props implementation. +// +// Implements constructor and backing map, and links up to generated component factory. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +abstract class _$$TestDartProps extends UiProps + with + TestJsProps, + // If this generated mixin is undefined, it's likely because TestJsProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestJsProps, and check that $TestJsProps is exported/imported properly. + $TestJsProps + implements + TestDartProps { + _$$TestDartProps._(); + + factory _$$TestDartProps(Map? backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$TestDartProps$JsMap(backingMap as JsBackedMap?); + } else { + return _$$TestDartProps$PlainMap(backingMap); + } + } + + /// Let `UiProps` internals know that this class has been generated. + @override + bool get $isClassGenerated => true; + + /// The default namespace for the prop getters/setters generated for this class. + @override + String get propKeyNamespace => ''; + + @override + PropsMetaCollection get staticMeta => const PropsMetaCollection({ + // If this generated mixin is undefined, it's likely because TestJsProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestJsProps, and check that $TestJsProps is exported/imported properly. + TestJsProps: $TestJsProps.meta, + }); + + @override + String $getPropKey(void Function(Map m) accessMap) => + _$getPropKey$_$$TestDartProps(accessMap, (map) => _$$TestDartProps(map)); +} + +/// An alias for [getPropKey] so it can be referenced within the props class impl +/// without being shadowed by the `getPropKey` instance extension member. +const _$getPropKey$_$$TestDartProps = getPropKey; + +// Concrete props implementation that can be backed by any [Map]. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$TestDartProps$PlainMap extends _$$TestDartProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$TestDartProps$PlainMap(Map? backingMap) + : this._props = {}, + super._() { + this._props = backingMap ?? {}; + } + + /// The backing props map proxied by this class. + @override + Map get props => _props; + Map _props; +} + +// Concrete props implementation that can only be backed by [JsMap], +// allowing dart2js to compile more optimal code for key-value pair reads/writes. +@Deprecated('This API is for use only within generated code.' + ' Do not reference it in your code, as it may change at any time.') +class _$$TestDartProps$JsMap extends _$$TestDartProps { + // This initializer of `_props` to an empty map, as well as the reassignment + // of `_props` in the constructor body is necessary to work around a DDC bug: https://github.com/dart-lang/sdk/issues/36217 + _$$TestDartProps$JsMap(JsBackedMap? backingMap) + : this._props = JsBackedMap(), + super._() { + this._props = backingMap ?? JsBackedMap(); + } + + /// The backing props map proxied by this class. + @override + JsBackedMap get props => _props; + JsBackedMap _props; +} diff --git a/test/over_react/component/suspense_component_test.dart b/test/over_react/component/suspense_component_test.dart index 37bca667c..896ec6b23 100644 --- a/test/over_react/component/suspense_component_test.dart +++ b/test/over_react/component/suspense_component_test.dart @@ -15,46 +15,14 @@ library suspense_component_test; import 'dart:async'; -import 'dart:js_util'; import 'package:js/js.dart'; -import 'package:over_react/js_component.dart'; import 'package:over_react/over_react.dart'; -import 'package:over_react/src/util/promise_interop.dart'; -import 'package:react/react_client/component_factory.dart'; -import 'package:react/react_client/react_interop.dart' as react_interop; import 'package:react_testing_library/react_testing_library.dart'; import 'package:test/test.dart'; import 'fixtures/lazy_load_me_props.dart'; import 'fixtures/lazy_load_me_component.dart' deferred as lazy_load_me; -@JS('React.lazy') -external react_interop.ReactClass jsLazy(Promise Function() factory); - -// Only intended for testing purposes, Please do not copy/paste this into your repo. -// This will most likely be added to the PUBLIC api in the future, -// but needs more testing and Typing decisions to be made first. -UiFactory lazy(Future> Function() factory, UiFactoryConfig factoryConfig) { - return uiJsComponent( - ReactJsComponentFactoryProxy( - jsLazy( - allowInterop( - () => futureToPromise( - // React.lazy only supports "default exports" from a module. - // This `{default: yourExport}` workaround can be found in the React.lazy RFC comments. - // See: https://github.com/reactjs/rfcs/pull/64#issuecomment-431507924 - (() async { - //resolvedFactory = await factory(); - return jsify({'default': (await factory()).elementType}); - })(), - ), - ), - ), - ), - factoryConfig, - ); -} - const lazyId = 'lazy'; const gregIsNotLazy = 'gregisnotlazy'; const loadingId = 'loading'; diff --git a/test/over_react_component_test.dart b/test/over_react_component_test.dart index 9a481433f..faa2aae93 100644 --- a/test/over_react_component_test.dart +++ b/test/over_react_component_test.dart @@ -22,60 +22,60 @@ library over_react_component_test; import 'package:over_react/over_react.dart'; import 'package:test/test.dart'; -import 'over_react/component/_deprecated/abstract_transition_test.dart' - as deprecated_abstract_transition_test; -import 'over_react/component/abstract_transition_test.dart' - as abstract_transition_test; -import 'over_react/component/with_transition_test.dart' - as with_transition_test; -import 'over_react/component/dom_components_test.dart' as dom_components_test; -import 'over_react/component/error_boundary/error_boundary_test.dart' as error_boundary_test; -import 'over_react/component/_deprecated/error_boundary_mixin_test.dart' - as deprecated_error_boundary_mixin_test; -import 'over_react/component/_deprecated/error_boundary_test.dart' - as deprecated_error_boundary_test; -import 'over_react/component/ref_util_test.dart' as ref_test; -import 'over_react/component/element_type_test.dart' as element_type_test; +// import 'over_react/component/_deprecated/abstract_transition_test.dart' +// as deprecated_abstract_transition_test; +// import 'over_react/component/abstract_transition_test.dart' +// as abstract_transition_test; +// import 'over_react/component/with_transition_test.dart' +// as with_transition_test; +// import 'over_react/component/dom_components_test.dart' as dom_components_test; +// import 'over_react/component/error_boundary/error_boundary_test.dart' as error_boundary_test; +// import 'over_react/component/_deprecated/error_boundary_mixin_test.dart' +// as deprecated_error_boundary_mixin_test; +// import 'over_react/component/_deprecated/error_boundary_test.dart' +// as deprecated_error_boundary_test; +// import 'over_react/component/ref_util_test.dart' as ref_test; +// import 'over_react/component/element_type_test.dart' as element_type_test; import 'over_react/component/lazy_test.dart' as lazy_test; -import 'over_react/component/memo_test.dart' as memo_test; -import 'over_react/component/prop_mixins_test.dart' as prop_mixins_test; -import 'over_react/component/prop_typedefs_test.dart' as prop_typedefs_test; -import 'over_react/component/pure_component_mixin_test.dart' - as pure_component_mixin_test; -import 'over_react/component/_deprecated/resize_sensor_test.dart' - as deprecated_resize_sensor_test; -import 'over_react/component/resize_sensor_test.dart' as resize_sensor_test; -import 'over_react/component/fragment_component_test.dart' - as fragment_component_test; -import 'over_react/component/strictmode_component_test.dart' - as strictmode_component_test; -import 'over_react/component/suspense_component_test.dart' - as suspense_component_test; -import 'over_react/component/context_test.dart' as context_test; -import 'over_react/component/typed_factory_test.dart' as typed_factory_test; +// import 'over_react/component/memo_test.dart' as memo_test; +// import 'over_react/component/prop_mixins_test.dart' as prop_mixins_test; +// import 'over_react/component/prop_typedefs_test.dart' as prop_typedefs_test; +// import 'over_react/component/pure_component_mixin_test.dart' +// as pure_component_mixin_test; +// import 'over_react/component/_deprecated/resize_sensor_test.dart' +// as deprecated_resize_sensor_test; +// import 'over_react/component/resize_sensor_test.dart' as resize_sensor_test; +// import 'over_react/component/fragment_component_test.dart' +// as fragment_component_test; +// import 'over_react/component/strictmode_component_test.dart' +// as strictmode_component_test; +// import 'over_react/component/suspense_component_test.dart' +// as suspense_component_test; +// import 'over_react/component/context_test.dart' as context_test; +// import 'over_react/component/typed_factory_test.dart' as typed_factory_test; void main() { enableTestMode(); - pure_component_mixin_test.main(); - deprecated_abstract_transition_test.main(); - abstract_transition_test.main(); - with_transition_test.main(); - error_boundary_test.main(); - deprecated_error_boundary_mixin_test.main(); - deprecated_error_boundary_test.main(); - ref_test.main(); - element_type_test.main(); + // pure_component_mixin_test.main(); + // deprecated_abstract_transition_test.main(); + // abstract_transition_test.main(); + // with_transition_test.main(); + // error_boundary_test.main(); + // deprecated_error_boundary_mixin_test.main(); + // deprecated_error_boundary_test.main(); + // ref_test.main(); + // element_type_test.main(); lazy_test.main(); - memo_test.main(); - dom_components_test.main(); - prop_mixins_test.main(); - prop_typedefs_test.main(); - deprecated_resize_sensor_test.main(); - resize_sensor_test.main(); - fragment_component_test.main(); - strictmode_component_test.main(); - suspense_component_test.main(); - context_test.main(); - typed_factory_test.main(); + // memo_test.main(); + // dom_components_test.main(); + // prop_mixins_test.main(); + // prop_typedefs_test.main(); + // deprecated_resize_sensor_test.main(); + // resize_sensor_test.main(); + // fragment_component_test.main(); + // strictmode_component_test.main(); + // suspense_component_test.main(); + // context_test.main(); + // typed_factory_test.main(); }