diff --git a/doc/new_boilerplate_migration.md b/doc/new_boilerplate_migration.md index 471d13a01..c1c389458 100644 --- a/doc/new_boilerplate_migration.md +++ b/doc/new_boilerplate_migration.md @@ -13,9 +13,9 @@ _Preview of new boilerplate:_ * [Use Mixin-Based Props Declaration that Disallows Subclassing](#use-mixin-based-props-declaration-that-disallows-subclassing) * [Consume props from all props mixins by default](#consume-props-from-all-props-mixins-by-default) * [Examples](#examples) -* __[Function Component Boilerplate *(coming soon)*](#function-component-boilerplate-coming-soon)__ +* __[Function Component Boilerplate](#function-component-boilerplate)__ * [Constraints](#function-component-constraints) - * [Design](#design) + * [Syntax](#syntax) * __[Upgrading Existing Code](#upgrading-existing-code)__ ## Background @@ -720,7 +720,7 @@ props, and boilerplate shouldn't change shape drastically when doing so. don't allow generic type inference of the `props` arg in the function closure. -### Design +### Syntax ```dart import 'package:over_react/over_react.dart'; @@ -765,6 +765,44 @@ UiFactory Foo = uiFunction( ); ``` +#### With Consumed Props + +Because functional components have no instance that track consumed props, the syntax for passing unconsumed +props changes within functional components. + +`UiProps` exposes a field `staticMeta` that can be used to generate an iterable containing props meta for specific mixins. +This is similar to accessing `propsMeta` within a class based component. Using the iterable returned from `staticMeta`'s +APIs (such as `forMixins`), we can generate unconsumed props and pass them to a child component. + +This is done like so: +```dart +mixin FooPropsMixin on UiProps { + String passedProp; +} + +mixin BarPropsMixin on UiProps { + String nonPassedProp; +} + +class FooBarProps = UiProps with BarPropsMixin, FooPropsMixin; + +UiFactory FooBar = uiFunction( + (props) { + final consumedProps = props.staticMeta.forMixins({BarPropsMixin}); + + return (Foo()..addUnconsumedProps(props, consumedProps))(); + }, + $FooBarConfig, // ignore: undefined_identifier +); + +UiFactory Foo = uiFunction( + (props) { + return 'foo: ${props.passedProp}'; + }, + $FooConfig, // ignore: undefined_identifier +); +``` + #### With UiProps ```dart @@ -778,7 +816,7 @@ UiFactory Foo = uiFunction( ); ``` -#### With propTypes +#### With propTypes (Coming soon!) ```dart UiFactory Foo = uiFunction( @@ -799,7 +837,7 @@ UiFactory Foo = uiFunction( `getPropTypes` provides a way to set up prop validation within the same variable initializer. -#### Local function components using just a props mixin (no top-level Factory necessary) +#### Local function components using just a props mixin - no top-level Factory necessary (Coming soon!) ```dart import 'package:over_react/over_react.dart'; diff --git a/doc/props_mixin_component_composition.md b/doc/props_mixin_component_composition.md index ddb6a0be8..a9117be74 100644 --- a/doc/props_mixin_component_composition.md +++ b/doc/props_mixin_component_composition.md @@ -4,24 +4,25 @@ In our core `UiProps` documentation, the pattern of [composing multiple props mi This example builds on that, showing a lightweight example a common use-case for such composition. -We'll show two components +We'll show three components -1. A `Bar` component that has its own props API - and default rendering behavior when rendered standalone. -2. A `FooBar` component that has its own props API, in addition to the `Bar` props API. This allows consumers to set props declared in `BarPropsMixin`, which will be forwarded to the `Bar` component it renders. +1. A `Foo` component that has its own props API - and default rendering behavior when rendered standalone. +1. A `FooBar` component that has its own props API, in addition to the `Foo` props API. This allows consumers to set props declared in `FooPropsMixin`, which will be forwarded to the `Foo` component it renders. +1. A `FooBaz` component, the functional version of `FooBar`. -### Bar Component +### Foo Component ```dart import 'package:over_react/over_react.dart'; -part 'bar.over_react.g.dart'; +part 'foo.over_react.g.dart'; -UiFactory Bar = _$Bar; // ignore: undefined_identifier +UiFactory Foo = _$Foo; // ignore: undefined_identifier -mixin BarPropsMixin on UiProps { +mixin FooPropsMixin on UiProps { Set qux; } -class BarComponent extends UiComponent2 { +class FooComponent extends UiComponent2 { @override get defaultProps => (newProps() ..qux = {1, 2, 3} @@ -31,7 +32,7 @@ class BarComponent extends UiComponent2 { render() { return (Dom.div() ..modifyProps(addUnconsumedDomProps) - ..className = (forwardingClassNameBuilder()..add('bar')) + ..className = (forwardingClassNameBuilder()..add('foo')) )( 'Qux: ', props.qux.map((n) => n), @@ -44,36 +45,36 @@ class BarComponent extends UiComponent2 { __Which, when rendered on its own - produces the following HTML:__ ```html -
Qux: 123
+
Qux: 123
``` -### Composing Bar using the FooBar component +### Composing Foo using the FooBar component -To compose the `Bar` component using `FooBar`, we'll expose the prop API for both the `BarPropsMixin` and the `FooPropsMixin` like so: +To compose the `Foo` component using `FooBar`, we'll expose the prop API for both the `FooPropsMixin` and the `BarPropsMixin` like so: ```dart import 'package:over_react/over_react.dart'; -import 'bar.dart'; +import 'foo.dart'; part 'foo_bar.over_react.g.dart'; UiFactory FooBar = _$FooBar; // ignore: undefined_identifier -mixin FooPropsMixin on UiProps { +mixin BarPropsMixin on UiProps { bool baz; Set bizzles; } -class FooBarProps = UiProps with FooPropsMixin, BarPropsMixin; +class FooBarProps = UiProps with BarPropsMixin, FooPropsMixin; class FooBarComponent extends UiComponent2 { - // Only consume the props found within FooPropsMixin, so that any prop values - // found in BarPropsMixin get forwarded to the child Bar component via `addUnconsumedProps`. + // Only consume the props found within BarPropsMixin, so that any prop values + // found in FooPropsMixin get forwarded to the child Foo component via `addUnconsumedProps`. @override - get consumedProps => propsMeta.forMixins({FooPropsMixin}); + get consumedProps => propsMeta.forMixins({BarPropsMixin}); @override render() { - return (Bar() + return (Foo() ..modifyProps(addUnconsumedProps) ..className = (forwardingClassNameBuilder()..add('foo__bar')) )( @@ -116,7 +117,7 @@ main() { Produces the following HTML: ```html -
+
Qux: 234
Bizzles: @@ -129,4 +130,83 @@ Produces the following HTML:
``` +### Composing Foo using the FooBaz component + +To compose the `Foo` component using `FooBaz`, a functional component, we'll expose the prop API for both the `FooPropsMixin` and the `BazPropsMixin` like so: +```dart +import 'package:over_react/over_react.dart'; +import 'foo.dart'; + +part 'foo_baz.over_react.g.dart'; + +mixin BarPropsMixin on UiProps { + bool baz; + Set bizzles; +} + +class FooBazProps = UiProps with BarPropsMixin, FooPropsMixin; + +UiFactory FooBaz = uiFunction( + (props) { + // Only consume the props found within BarPropsMixin, so that any prop values + // found in FooPropsMixin get forwarded to the child Foo component via `addUnconsumedProps`. + final consumedProps = props.staticMeta.forMixins({BarPropsMixin}); + + return (Foo() + ..addUnconsumedProps(props, consumedProps) + ..className = (forwardingClassNameBuilder()..add('foo__baz')) + )( + (Dom.div()..className = 'foo__baz__bizzles')( + 'Bizzles: ', + Dom.ol()( + props.bizzles.map(_renderBizzleItem).toList(), + ), + ), + ); + + ReactElement _renderBizzleItem(String bizzle) { + return (Dom.li()..key = bizzle)(bizzle); + } + }, + $FooBazConfig, // ignore: undefined_identifier +); +``` + +Which, when composed / rendered like so: +```dart +import 'dart:html'; +import 'package:over_react/react_dom.dart' as react_dom; +import 'package:over_react/over_react.dart'; + +// An example of where the `FooBaz` component might be exported from +import 'package:my_package_name/foobaz.dart'; + +@override +main() { + final abcFooBaz = (FooBaz() + ..className = 'foo_baz--abc' + ..aria.label = 'I am FooBaz!' + ..qux = {2, 3, 4} + ..bizzles = {'a', 'b', 'c'} + )(); + + react_dom.render(abcFooBaz, querySelector('#some_element_id')); +} +``` + +Produces the following HTML: +```html +
+ Qux: 234 +
+ Bizzles: +
    +
  1. a
  2. +
  3. b
  4. +
  5. c
  6. +
+
+
+``` + > To learn more about the `consumedProps` behavior shown above, check out the [mixin-based prop forwarding documentation](new_boilerplate_migration.md#updated-default-behavior-in-the-mixin-based-syntax). diff --git a/example/builder/main.dart b/example/builder/main.dart index 1ee59c63d..654e98e2c 100644 --- a/example/builder/main.dart +++ b/example/builder/main.dart @@ -23,6 +23,8 @@ import './src/basic_library.dart'; import './src/generic_inheritance_sub.dart'; import './src/generic_inheritance_super.dart'; import './src/function_component.dart' as function; +import 'src/functional_consumed_props.dart'; +import 'src/new_class_consumed_props.dart'; main() { react_dom.render( @@ -59,6 +61,14 @@ main() { ' - ', componentConstructorsByName[name]().toString(), )).toList(), + (SomeParent() + ..aParentProp = 'parent' + ..aPropToBePassed = 'passed' + )(), + (SomeClassParent() + ..aParentProp = 'classParent' + ..aPropToBePassed = 'passed' + )() ), querySelector('#content') ); } diff --git a/example/builder/src/abstract_inheritance.over_react.g.dart b/example/builder/src/abstract_inheritance.over_react.g.dart index 858b97ad0..7e70c7934 100644 --- a/example/builder/src/abstract_inheritance.over_react.g.dart +++ b/example/builder/src/abstract_inheritance.over_react.g.dart @@ -60,6 +60,14 @@ abstract class _$$SubProps extends UiProps /// 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 SuperPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SuperPropsMixin, and check that $SuperPropsMixin is exported/imported properly. + SuperPropsMixin: $SuperPropsMixin.meta, + // If this generated mixin is undefined, it's likely because SubPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SubPropsMixin, and check that $SubPropsMixin is exported/imported properly. + SubPropsMixin: $SubPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/basic.over_react.g.dart b/example/builder/src/basic.over_react.g.dart index 6ee3b4565..a1825de85 100644 --- a/example/builder/src/basic.over_react.g.dart +++ b/example/builder/src/basic.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$BasicProps extends UiProps /// 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 BasicProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicProps, and check that $BasicProps is exported/imported properly. + BasicProps: $BasicProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/basic_library.over_react.g.dart b/example/builder/src/basic_library.over_react.g.dart index 84797a2f0..5a02a26d9 100644 --- a/example/builder/src/basic_library.over_react.g.dart +++ b/example/builder/src/basic_library.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$BasicPartOfLibProps extends UiProps /// 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 ExamplePropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ExamplePropsMixin, and check that $ExamplePropsMixin is exported/imported properly. + ExamplePropsMixin: $ExamplePropsMixin.meta, + // If this generated mixin is undefined, it's likely because BasicPartOfLibPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicPartOfLibPropsMixin, and check that $BasicPartOfLibPropsMixin is exported/imported properly. + BasicPartOfLibPropsMixin: $BasicPartOfLibPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -424,6 +432,14 @@ abstract class _$$SubPartOfLibProps extends UiProps /// 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 SuperPartOfLibPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SuperPartOfLibPropsMixin, and check that $SuperPartOfLibPropsMixin is exported/imported properly. + SuperPartOfLibPropsMixin: $SuperPartOfLibPropsMixin.meta, + // If this generated mixin is undefined, it's likely because SubPartOfLibPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SubPartOfLibPropsMixin, and check that $SubPartOfLibPropsMixin is exported/imported properly. + SubPartOfLibPropsMixin: $SubPartOfLibPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/basic_with_state.over_react.g.dart b/example/builder/src/basic_with_state.over_react.g.dart index f01749921..6342b0025 100644 --- a/example/builder/src/basic_with_state.over_react.g.dart +++ b/example/builder/src/basic_with_state.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$BasicProps extends UiProps /// 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 BasicProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicProps, and check that $BasicProps is exported/imported properly. + BasicProps: $BasicProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/basic_with_type_params.over_react.g.dart b/example/builder/src/basic_with_type_params.over_react.g.dart index 8c215d3dc..3af35365a 100644 --- a/example/builder/src/basic_with_type_params.over_react.g.dart +++ b/example/builder/src/basic_with_type_params.over_react.g.dart @@ -59,6 +59,12 @@ abstract class _$$BasicProps extends UiProps /// 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 BasicPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicPropsMixin, and check that $BasicPropsMixin is exported/imported properly. + BasicPropsMixin: $BasicPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/function_component.over_react.g.dart b/example/builder/src/function_component.over_react.g.dart index 3c9a29f65..eaca6bd81 100644 --- a/example/builder/src/function_component.over_react.g.dart +++ b/example/builder/src/function_component.over_react.g.dart @@ -164,6 +164,12 @@ abstract class _$$BasicProps extends UiProps /// 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 BasicProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicProps, and check that $BasicProps is exported/imported properly. + BasicProps: $BasicProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -237,6 +243,12 @@ abstract class _$$FooProps extends UiProps /// 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 FooProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FooProps, and check that $FooProps is exported/imported properly. + FooProps: $FooProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/functional_consumed_props.dart b/example/builder/src/functional_consumed_props.dart new file mode 100644 index 000000000..5fa937599 --- /dev/null +++ b/example/builder/src/functional_consumed_props.dart @@ -0,0 +1,55 @@ +// Copyright 2020 Workiva Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:over_react/over_react.dart'; + +// ignore_for_file: uri_has_not_been_generated +part 'functional_consumed_props.over_react.g.dart'; + +mixin ParentOnlyPropsMixin on UiProps { + String aParentProp; +} + +mixin SharedPropsMixin on UiProps { + String aPropToBePassed; +} + +class SomeParentProps = UiProps with ParentOnlyPropsMixin, SharedPropsMixin; + +UiFactory SomeParent = uiFunction((props) { + final consumedProps = props.staticMeta.forMixins({ParentOnlyPropsMixin}); + + return ( + Dom.div()( + Dom.div()( + 'The parent prop is: ${props.aParentProp}', + ), + (SomeChild()..addUnconsumedProps(props, consumedProps))(), + ) + ); + }, + $SomeParentConfig, // ignore: undefined_identifier +); + +class SomeChildProps = UiProps with SharedPropsMixin; + +UiFactory SomeChild = uiFunction((props) { + return ( + Fragment()( + 'The passed prop value is ${props.aPropToBePassed}', + ) + ); +}, + $SomeChildConfig, // ignore: undefined_identifier +); \ No newline at end of file diff --git a/example/builder/src/functional_consumed_props.over_react.g.dart b/example/builder/src/functional_consumed_props.over_react.g.dart new file mode 100644 index 000000000..0c83bdeb2 --- /dev/null +++ b/example/builder/src/functional_consumed_props.over_react.g.dart @@ -0,0 +1,240 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: deprecated_member_use_from_same_package, unnecessary_null_in_if_null_operators, prefer_null_aware_operators +part of 'functional_consumed_props.dart'; + +// ************************************************************************** +// OverReactBuilder (package:over_react/src/builder.dart) +// ************************************************************************** + +@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 $ParentOnlyPropsMixin on ParentOnlyPropsMixin { + static const PropsMeta meta = _$metaForParentOnlyPropsMixin; + @override + String get aParentProp => + props[_$key__aParentProp__ParentOnlyPropsMixin] ?? + null; // Add ` ?? null` to workaround DDC bug: ; + @override + set aParentProp(String value) => + props[_$key__aParentProp__ParentOnlyPropsMixin] = value; + /* GENERATED CONSTANTS */ + static const PropDescriptor _$prop__aParentProp__ParentOnlyPropsMixin = + PropDescriptor(_$key__aParentProp__ParentOnlyPropsMixin); + static const String _$key__aParentProp__ParentOnlyPropsMixin = + 'ParentOnlyPropsMixin.aParentProp'; + + static const List $props = [ + _$prop__aParentProp__ParentOnlyPropsMixin + ]; + static const List $propKeys = [ + _$key__aParentProp__ParentOnlyPropsMixin + ]; +} + +@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 _$metaForParentOnlyPropsMixin = PropsMeta( + fields: $ParentOnlyPropsMixin.$props, + keys: $ParentOnlyPropsMixin.$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 $SharedPropsMixin on SharedPropsMixin { + static const PropsMeta meta = _$metaForSharedPropsMixin; + @override + String get aPropToBePassed => + props[_$key__aPropToBePassed__SharedPropsMixin] ?? + null; // Add ` ?? null` to workaround DDC bug: ; + @override + set aPropToBePassed(String value) => + props[_$key__aPropToBePassed__SharedPropsMixin] = value; + /* GENERATED CONSTANTS */ + static const PropDescriptor _$prop__aPropToBePassed__SharedPropsMixin = + PropDescriptor(_$key__aPropToBePassed__SharedPropsMixin); + static const String _$key__aPropToBePassed__SharedPropsMixin = + 'SharedPropsMixin.aPropToBePassed'; + + static const List $props = [ + _$prop__aPropToBePassed__SharedPropsMixin + ]; + static const List $propKeys = [ + _$key__aPropToBePassed__SharedPropsMixin + ]; +} + +@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 _$metaForSharedPropsMixin = PropsMeta( + fields: $SharedPropsMixin.$props, + keys: $SharedPropsMixin.$propKeys, +); + +final UiFactoryConfig<_$$SomeParentProps> $SomeParentConfig = UiFactoryConfig( + propsFactory: PropsFactory( + map: (map) => _$$SomeParentProps(map), + jsMap: (map) => _$$SomeParentProps$JsMap(map), + ), + displayName: 'SomeParent'); + +// 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 _$$SomeParentProps extends UiProps + with + ParentOnlyPropsMixin, + $ParentOnlyPropsMixin, // If this generated mixin is undefined, it's likely because ParentOnlyPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ParentOnlyPropsMixin, and check that $ParentOnlyPropsMixin is exported/imported properly. + SharedPropsMixin, + $SharedPropsMixin // If this generated mixin is undefined, it's likely because SharedPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPropsMixin, and check that $SharedPropsMixin is exported/imported properly. + implements + SomeParentProps { + _$$SomeParentProps._(); + + factory _$$SomeParentProps(Map backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$SomeParentProps$JsMap(backingMap); + } else { + return _$$SomeParentProps$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 ParentOnlyPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ParentOnlyPropsMixin, and check that $ParentOnlyPropsMixin is exported/imported properly. + ParentOnlyPropsMixin: $ParentOnlyPropsMixin.meta, + // If this generated mixin is undefined, it's likely because SharedPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPropsMixin, and check that $SharedPropsMixin is exported/imported properly. + SharedPropsMixin: $SharedPropsMixin.meta, + }); +} + +// 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 _$$SomeParentProps$PlainMap extends _$$SomeParentProps { + // 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 + _$$SomeParentProps$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 _$$SomeParentProps$JsMap extends _$$SomeParentProps { + // 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 + _$$SomeParentProps$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<_$$SomeChildProps> $SomeChildConfig = UiFactoryConfig( + propsFactory: PropsFactory( + map: (map) => _$$SomeChildProps(map), + jsMap: (map) => _$$SomeChildProps$JsMap(map), + ), + displayName: 'SomeChild'); + +// 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 _$$SomeChildProps extends UiProps + with + SharedPropsMixin, + $SharedPropsMixin // If this generated mixin is undefined, it's likely because SharedPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPropsMixin, and check that $SharedPropsMixin is exported/imported properly. + implements + SomeChildProps { + _$$SomeChildProps._(); + + factory _$$SomeChildProps(Map backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$SomeChildProps$JsMap(backingMap); + } else { + return _$$SomeChildProps$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 SharedPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPropsMixin, and check that $SharedPropsMixin is exported/imported properly. + SharedPropsMixin: $SharedPropsMixin.meta, + }); +} + +// 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 _$$SomeChildProps$PlainMap extends _$$SomeChildProps { + // 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 + _$$SomeChildProps$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 _$$SomeChildProps$JsMap extends _$$SomeChildProps { + // 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 + _$$SomeChildProps$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/example/builder/src/generic_inheritance_sub.over_react.g.dart b/example/builder/src/generic_inheritance_sub.over_react.g.dart index 7403115e2..5a72f28d1 100644 --- a/example/builder/src/generic_inheritance_sub.over_react.g.dart +++ b/example/builder/src/generic_inheritance_sub.over_react.g.dart @@ -60,6 +60,14 @@ abstract class _$$GenericSubProps extends UiProps /// 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 GenericSuperPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of GenericSuperPropsMixin, and check that $GenericSuperPropsMixin is exported/imported properly. + GenericSuperPropsMixin: $GenericSuperPropsMixin.meta, + // If this generated mixin is undefined, it's likely because GenericSubPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of GenericSubPropsMixin, and check that $GenericSubPropsMixin is exported/imported properly. + GenericSubPropsMixin: $GenericSubPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/generic_inheritance_super.over_react.g.dart b/example/builder/src/generic_inheritance_super.over_react.g.dart index f81a0db44..d1d3cd92f 100644 --- a/example/builder/src/generic_inheritance_super.over_react.g.dart +++ b/example/builder/src/generic_inheritance_super.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$GenericSuperProps extends UiProps /// 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 GenericSuperPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of GenericSuperPropsMixin, and check that $GenericSuperPropsMixin is exported/imported properly. + GenericSuperPropsMixin: $GenericSuperPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/namespaced_imports.over_react.g.dart b/example/builder/src/namespaced_imports.over_react.g.dart index 7f26ffe43..cd41968c0 100644 --- a/example/builder/src/namespaced_imports.over_react.g.dart +++ b/example/builder/src/namespaced_imports.over_react.g.dart @@ -60,6 +60,14 @@ abstract class _$$BasicProps extends UiProps /// 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 pm.ExamplePropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of pm.ExamplePropsMixin, and check that pm.$ExamplePropsMixin is exported/imported properly. + pm.ExamplePropsMixin: pm.$ExamplePropsMixin.meta, + // If this generated mixin is undefined, it's likely because BasicPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicPropsMixin, and check that $BasicPropsMixin is exported/imported properly. + BasicPropsMixin: $BasicPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/new_class_consumed_props.dart b/example/builder/src/new_class_consumed_props.dart new file mode 100644 index 000000000..df163ef0f --- /dev/null +++ b/example/builder/src/new_class_consumed_props.dart @@ -0,0 +1,61 @@ +// Copyright 2020 Workiva Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +import 'package:over_react/over_react.dart'; + +// ignore_for_file: uri_has_not_been_generated +part 'new_class_consumed_props.over_react.g.dart'; + +UiFactory SomeClassParent = _$SomeClassParent; // ignore: undefined_identifier + +mixin ParentOnlyPropsMixin on UiProps { + String aParentProp; +} + +mixin SharedPropsMixin on UiProps { + String aPropToBePassed; +} + +class SomeParentProps = UiProps with ParentOnlyPropsMixin, SharedPropsMixin; + +class SomeClassParentComponent extends UiComponent2 { + @override + render() { + final meta = props.staticMeta.forMixins({ParentOnlyPropsMixin}); + + return ( + Dom.div()( + Dom.div()( + 'The parent prop is: ${props.aParentProp}', + ), + (SomeClassChild()..addUnconsumedProps(props, meta))(), + ) + ); + } +} + +UiFactory SomeClassChild = _$SomeClassChild; // ignore: undefined_identifier + +class SomeChildProps = UiProps with SharedPropsMixin; + +class SomeClassChildComponent extends UiComponent2 { + @override + render() { + return ( + Dom.div()( + 'The passed prop value is: ${props.aPropToBePassed}', + ) + ); + } +} \ No newline at end of file diff --git a/example/builder/src/new_class_consumed_props.over_react.g.dart b/example/builder/src/new_class_consumed_props.over_react.g.dart new file mode 100644 index 000000000..10f761680 --- /dev/null +++ b/example/builder/src/new_class_consumed_props.over_react.g.dart @@ -0,0 +1,372 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +// ignore_for_file: deprecated_member_use_from_same_package, unnecessary_null_in_if_null_operators, prefer_null_aware_operators +part of 'new_class_consumed_props.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 $SomeClassParentComponentFactory = registerComponent2( + () => _$SomeClassParentComponent(), + builderFactory: _$SomeClassParent, + componentClass: SomeClassParentComponent, + isWrapper: false, + parentType: null, + displayName: 'SomeClassParent', +); + +_$$SomeParentProps _$SomeClassParent([Map backingProps]) => backingProps == null + ? _$$SomeParentProps$JsMap(JsBackedMap()) + : _$$SomeParentProps(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 _$$SomeParentProps extends UiProps + with + ParentOnlyPropsMixin, + $ParentOnlyPropsMixin, // If this generated mixin is undefined, it's likely because ParentOnlyPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ParentOnlyPropsMixin, and check that $ParentOnlyPropsMixin is exported/imported properly. + SharedPropsMixin, + $SharedPropsMixin // If this generated mixin is undefined, it's likely because SharedPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPropsMixin, and check that $SharedPropsMixin is exported/imported properly. + implements + SomeParentProps { + _$$SomeParentProps._(); + + factory _$$SomeParentProps(Map backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$SomeParentProps$JsMap(backingMap); + } else { + return _$$SomeParentProps$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 ?? $SomeClassParentComponentFactory; + + /// 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 ParentOnlyPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ParentOnlyPropsMixin, and check that $ParentOnlyPropsMixin is exported/imported properly. + ParentOnlyPropsMixin: $ParentOnlyPropsMixin.meta, + // If this generated mixin is undefined, it's likely because SharedPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPropsMixin, and check that $SharedPropsMixin is exported/imported properly. + SharedPropsMixin: $SharedPropsMixin.meta, + }); +} + +// 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 _$$SomeParentProps$PlainMap extends _$$SomeParentProps { + // 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 + _$$SomeParentProps$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 _$$SomeParentProps$JsMap extends _$$SomeParentProps { + // 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 + _$$SomeParentProps$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 _$SomeClassParentComponent extends SomeClassParentComponent { + _$$SomeParentProps$JsMap _cachedTypedProps; + + @override + _$$SomeParentProps$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)); + } + + @override + _$$SomeParentProps$JsMap typedPropsFactoryJs(JsBackedMap backingMap) => + _$$SomeParentProps$JsMap(backingMap); + + @override + _$$SomeParentProps typedPropsFactory(Map backingMap) => + _$$SomeParentProps(backingMap); + + /// Let `UiComponent` internals know that this class has been generated. + @override + bool get $isClassGenerated => true; + + /// The default consumed props, comprising all props mixins used by SomeParentProps. + /// 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 ParentOnlyPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ParentOnlyPropsMixin, and check that $ParentOnlyPropsMixin is exported/imported properly. + ParentOnlyPropsMixin: $ParentOnlyPropsMixin.meta, + // If this generated mixin is undefined, it's likely because SharedPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPropsMixin, and check that $SharedPropsMixin is exported/imported properly. + SharedPropsMixin: $SharedPropsMixin.meta, + }); +} + +// 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 $SomeClassChildComponentFactory = registerComponent2( + () => _$SomeClassChildComponent(), + builderFactory: _$SomeClassChild, + componentClass: SomeClassChildComponent, + isWrapper: false, + parentType: null, + displayName: 'SomeClassChild', +); + +_$$SomeChildProps _$SomeClassChild([Map backingProps]) => backingProps == null + ? _$$SomeChildProps$JsMap(JsBackedMap()) + : _$$SomeChildProps(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 _$$SomeChildProps extends UiProps + with + SharedPropsMixin, + $SharedPropsMixin // If this generated mixin is undefined, it's likely because SharedPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPropsMixin, and check that $SharedPropsMixin is exported/imported properly. + implements + SomeChildProps { + _$$SomeChildProps._(); + + factory _$$SomeChildProps(Map backingMap) { + if (backingMap == null || backingMap is JsBackedMap) { + return _$$SomeChildProps$JsMap(backingMap); + } else { + return _$$SomeChildProps$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 ?? $SomeClassChildComponentFactory; + + /// 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 SharedPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPropsMixin, and check that $SharedPropsMixin is exported/imported properly. + SharedPropsMixin: $SharedPropsMixin.meta, + }); +} + +// 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 _$$SomeChildProps$PlainMap extends _$$SomeChildProps { + // 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 + _$$SomeChildProps$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 _$$SomeChildProps$JsMap extends _$$SomeChildProps { + // 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 + _$$SomeChildProps$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 _$SomeClassChildComponent extends SomeClassChildComponent { + _$$SomeChildProps$JsMap _cachedTypedProps; + + @override + _$$SomeChildProps$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)); + } + + @override + _$$SomeChildProps$JsMap typedPropsFactoryJs(JsBackedMap backingMap) => + _$$SomeChildProps$JsMap(backingMap); + + @override + _$$SomeChildProps typedPropsFactory(Map backingMap) => + _$$SomeChildProps(backingMap); + + /// Let `UiComponent` internals know that this class has been generated. + @override + bool get $isClassGenerated => true; + + /// The default consumed props, comprising all props mixins used by SomeChildProps. + /// 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 SharedPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPropsMixin, and check that $SharedPropsMixin is exported/imported properly. + SharedPropsMixin: $SharedPropsMixin.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 $ParentOnlyPropsMixin on ParentOnlyPropsMixin { + static const PropsMeta meta = _$metaForParentOnlyPropsMixin; + @override + String get aParentProp => + props[_$key__aParentProp__ParentOnlyPropsMixin] ?? + null; // Add ` ?? null` to workaround DDC bug: ; + @override + set aParentProp(String value) => + props[_$key__aParentProp__ParentOnlyPropsMixin] = value; + /* GENERATED CONSTANTS */ + static const PropDescriptor _$prop__aParentProp__ParentOnlyPropsMixin = + PropDescriptor(_$key__aParentProp__ParentOnlyPropsMixin); + static const String _$key__aParentProp__ParentOnlyPropsMixin = + 'ParentOnlyPropsMixin.aParentProp'; + + static const List $props = [ + _$prop__aParentProp__ParentOnlyPropsMixin + ]; + static const List $propKeys = [ + _$key__aParentProp__ParentOnlyPropsMixin + ]; +} + +@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 _$metaForParentOnlyPropsMixin = PropsMeta( + fields: $ParentOnlyPropsMixin.$props, + keys: $ParentOnlyPropsMixin.$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 $SharedPropsMixin on SharedPropsMixin { + static const PropsMeta meta = _$metaForSharedPropsMixin; + @override + String get aPropToBePassed => + props[_$key__aPropToBePassed__SharedPropsMixin] ?? + null; // Add ` ?? null` to workaround DDC bug: ; + @override + set aPropToBePassed(String value) => + props[_$key__aPropToBePassed__SharedPropsMixin] = value; + /* GENERATED CONSTANTS */ + static const PropDescriptor _$prop__aPropToBePassed__SharedPropsMixin = + PropDescriptor(_$key__aPropToBePassed__SharedPropsMixin); + static const String _$key__aPropToBePassed__SharedPropsMixin = + 'SharedPropsMixin.aPropToBePassed'; + + static const List $props = [ + _$prop__aPropToBePassed__SharedPropsMixin + ]; + static const List $propKeys = [ + _$key__aPropToBePassed__SharedPropsMixin + ]; +} + +@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 _$metaForSharedPropsMixin = PropsMeta( + fields: $SharedPropsMixin.$props, + keys: $SharedPropsMixin.$propKeys, +); diff --git a/example/builder/src/private_component.over_react.g.dart b/example/builder/src/private_component.over_react.g.dart index ef9158b4a..7b1a8a163 100644 --- a/example/builder/src/private_component.over_react.g.dart +++ b/example/builder/src/private_component.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$_PrivateProps extends UiProps /// 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 _PrivateProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of _PrivateProps, and check that $_PrivateProps is exported/imported properly. + _PrivateProps: $_PrivateProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/private_factory_public_component.over_react.g.dart b/example/builder/src/private_factory_public_component.over_react.g.dart index f994c9be6..7043db6d4 100644 --- a/example/builder/src/private_factory_public_component.over_react.g.dart +++ b/example/builder/src/private_factory_public_component.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$FormActionInputProps extends UiProps /// 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 FormActionInputProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FormActionInputProps, and check that $FormActionInputProps is exported/imported properly. + FormActionInputProps: $FormActionInputProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/builder/src/with_legacy_props_mixin.over_react.g.dart b/example/builder/src/with_legacy_props_mixin.over_react.g.dart index 39076f99f..4b6cc4ee6 100644 --- a/example/builder/src/with_legacy_props_mixin.over_react.g.dart +++ b/example/builder/src/with_legacy_props_mixin.over_react.g.dart @@ -60,6 +60,14 @@ abstract class _$$BasicProps extends UiProps /// 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 BasicPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicPropsMixin, and check that $BasicPropsMixin is exported/imported properly. + BasicPropsMixin: $BasicPropsMixin.meta, + // If this generated mixin is undefined, it's likely because TransitionPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TransitionPropsMixin, and check that $TransitionPropsMixin is exported/imported properly. + TransitionPropsMixin: $TransitionPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/context/components/my_context_component.over_react.g.dart b/example/context/components/my_context_component.over_react.g.dart index f724dd681..c123971fe 100644 --- a/example/context/components/my_context_component.over_react.g.dart +++ b/example/context/components/my_context_component.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$MyContextComponentProps extends UiProps /// 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 MyContextComponentProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of MyContextComponentProps, and check that $MyContextComponentProps is exported/imported properly. + MyContextComponentProps: $MyContextComponentProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/context/components/my_provider_component.over_react.g.dart b/example/context/components/my_provider_component.over_react.g.dart index be0b25bc7..ec91d5104 100644 --- a/example/context/components/my_provider_component.over_react.g.dart +++ b/example/context/components/my_provider_component.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$MyProviderProps extends UiProps /// 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 MyProviderProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of MyProviderProps, and check that $MyProviderProps is exported/imported properly. + MyProviderProps: $MyProviderProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/hooks/use_callback_example.over_react.g.dart b/example/hooks/use_callback_example.over_react.g.dart index 490a69b16..df21c672a 100644 --- a/example/hooks/use_callback_example.over_react.g.dart +++ b/example/hooks/use_callback_example.over_react.g.dart @@ -61,6 +61,12 @@ abstract class _$$UseCallbackExampleProps extends UiProps /// 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 UseCallbackExampleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of UseCallbackExampleProps, and check that $UseCallbackExampleProps is exported/imported properly. + UseCallbackExampleProps: $UseCallbackExampleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/hooks/use_context_example.over_react.g.dart b/example/hooks/use_context_example.over_react.g.dart index b60409b89..0ebb0b1c9 100644 --- a/example/hooks/use_context_example.over_react.g.dart +++ b/example/hooks/use_context_example.over_react.g.dart @@ -80,6 +80,12 @@ abstract class _$$UseContextExampleProps extends UiProps /// 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 UseContextExampleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of UseContextExampleProps, and check that $UseContextExampleProps is exported/imported properly. + UseContextExampleProps: $UseContextExampleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -154,6 +160,12 @@ abstract class _$$NewContextProviderProps extends UiProps /// 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 NewContextProviderProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of NewContextProviderProps, and check that $NewContextProviderProps is exported/imported properly. + NewContextProviderProps: $NewContextProviderProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/hooks/use_debug_value_example.over_react.g.dart b/example/hooks/use_debug_value_example.over_react.g.dart index 3cd1ae54d..20ef32e01 100644 --- a/example/hooks/use_debug_value_example.over_react.g.dart +++ b/example/hooks/use_debug_value_example.over_react.g.dart @@ -93,6 +93,12 @@ abstract class _$$FriendListItemProps extends UiProps /// 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 FriendListItemProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FriendListItemProps, and check that $FriendListItemProps is exported/imported properly. + FriendListItemProps: $FriendListItemProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -167,6 +173,12 @@ abstract class _$$UseDebugValueExampleProps extends UiProps /// 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 UseDebugValueExampleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of UseDebugValueExampleProps, and check that $UseDebugValueExampleProps is exported/imported properly. + UseDebugValueExampleProps: $UseDebugValueExampleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/hooks/use_imperative_handle_example.over_react.g.dart b/example/hooks/use_imperative_handle_example.over_react.g.dart index 295a294b1..704ded8e0 100644 --- a/example/hooks/use_imperative_handle_example.over_react.g.dart +++ b/example/hooks/use_imperative_handle_example.over_react.g.dart @@ -104,6 +104,12 @@ abstract class _$$FancyInputProps extends UiProps /// 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 FancyInputProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FancyInputProps, and check that $FancyInputProps is exported/imported properly. + FancyInputProps: $FancyInputProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -178,6 +184,12 @@ abstract class _$$UseImperativeHandleExampleProps extends UiProps /// 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 UseImperativeHandleExampleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of UseImperativeHandleExampleProps, and check that $UseImperativeHandleExampleProps is exported/imported properly. + UseImperativeHandleExampleProps: $UseImperativeHandleExampleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/hooks/use_layout_effect_example.over_react.g.dart b/example/hooks/use_layout_effect_example.over_react.g.dart index c41fdb287..571894224 100644 --- a/example/hooks/use_layout_effect_example.over_react.g.dart +++ b/example/hooks/use_layout_effect_example.over_react.g.dart @@ -61,6 +61,12 @@ abstract class _$$UseLayoutEffectProps extends UiProps /// 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 UseLayoutEffectProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of UseLayoutEffectProps, and check that $UseLayoutEffectProps is exported/imported properly. + UseLayoutEffectProps: $UseLayoutEffectProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/hooks/use_memo_example.over_react.g.dart b/example/hooks/use_memo_example.over_react.g.dart index 2739e0d9c..0db6196b7 100644 --- a/example/hooks/use_memo_example.over_react.g.dart +++ b/example/hooks/use_memo_example.over_react.g.dart @@ -61,6 +61,12 @@ abstract class _$$UseMemoExampleProps extends UiProps /// 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 UseMemoExampleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of UseMemoExampleProps, and check that $UseMemoExampleProps is exported/imported properly. + UseMemoExampleProps: $UseMemoExampleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/hooks/use_reducer_example.over_react.g.dart b/example/hooks/use_reducer_example.over_react.g.dart index 5e0d98d29..19e8098f9 100644 --- a/example/hooks/use_reducer_example.over_react.g.dart +++ b/example/hooks/use_reducer_example.over_react.g.dart @@ -76,6 +76,12 @@ abstract class _$$UseReducerExampleProps extends UiProps /// 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 UseReducerExampleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of UseReducerExampleProps, and check that $UseReducerExampleProps is exported/imported properly. + UseReducerExampleProps: $UseReducerExampleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/hooks/use_ref_example.over_react.g.dart b/example/hooks/use_ref_example.over_react.g.dart index ba1cb081b..d9617f7d6 100644 --- a/example/hooks/use_ref_example.over_react.g.dart +++ b/example/hooks/use_ref_example.over_react.g.dart @@ -61,6 +61,12 @@ abstract class _$$UseRefExampleProps extends UiProps /// 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 UseRefExampleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of UseRefExampleProps, and check that $UseRefExampleProps is exported/imported properly. + UseRefExampleProps: $UseRefExampleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/example/hooks/use_state_example.over_react.g.dart b/example/hooks/use_state_example.over_react.g.dart index 59982510d..75bfd4008 100644 --- a/example/hooks/use_state_example.over_react.g.dart +++ b/example/hooks/use_state_example.over_react.g.dart @@ -61,6 +61,12 @@ abstract class _$$UseStateExampleProps extends UiProps /// 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 UseStateExampleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of UseStateExampleProps, and check that $UseStateExampleProps is exported/imported properly. + UseStateExampleProps: $UseStateExampleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/lib/src/builder/codegen/component_generator.dart b/lib/src/builder/codegen/component_generator.dart index 048bea648..1332ac993 100644 --- a/lib/src/builder/codegen/component_generator.dart +++ b/lib/src/builder/codegen/component_generator.dart @@ -172,16 +172,7 @@ class _ComponentGenerator extends ComponentGenerator { @override void _generateAdditionalComponentBody() { - outputContentsBuffer - ..writeln() - ..writeln(' @override') - ..writeln(' PropsMetaCollection get propsMeta => const PropsMetaCollection({'); - for (final name in declaration.allPropsMixins) { - final names = TypedMapNames(name.name); - outputContentsBuffer.write(' ${generatedMixinWarningCommentLine(names, isProps: true)}'); - outputContentsBuffer.writeln(' ${names.consumerName}: ${names.publicGeneratedMetaName},'); - } - outputContentsBuffer.writeln(' });'); + generatePropsMeta(outputContentsBuffer, declaration.allPropsMixins); } } diff --git a/lib/src/builder/codegen/typed_map_impl_generator.dart b/lib/src/builder/codegen/typed_map_impl_generator.dart index 9c9a904f9..e173aa5c4 100644 --- a/lib/src/builder/codegen/typed_map_impl_generator.dart +++ b/lib/src/builder/codegen/typed_map_impl_generator.dart @@ -134,6 +134,7 @@ abstract class TypedMapImplGenerator extends BoilerplateDeclarationGenerator { String _generateConcretePropsOrStateImpl({ String componentFactoryName, String propKeyNamespace, + List allPropsMixins, }) { if (isProps) { if (componentFactoryName == null || propKeyNamespace == null) { @@ -222,6 +223,11 @@ abstract class TypedMapImplGenerator extends BoilerplateDeclarationGenerator { ' /// The default namespace for the prop getters/setters generated for this class.') ..writeln(' @override') ..writeln(' String get propKeyNamespace => ${stringLiteral(propKeyNamespace)};'); + + if (allPropsMixins != null) { + generatePropsMeta(buffer, allPropsMixins, + classType: 'PropsMetaCollection', fieldName: r'staticMeta'); + } } // End of class body @@ -345,10 +351,13 @@ class _TypedMapImplGenerator extends TypedMapImplGenerator { @override final Version version; + final List allPropsMixins; + _TypedMapImplGenerator.props(ClassComponentDeclaration declaration) : names = TypedMapNames(declaration.props.either.name.name), factoryNames = [FactoryNames(declaration.factory.name.name)], member = declaration.props.either, + allPropsMixins = declaration.allPropsMixins, isProps = true, componentFactoryName = ComponentNames(declaration.component.name.name).componentFactoryName, isFunctionComponentDeclaration = false, @@ -358,6 +367,7 @@ class _TypedMapImplGenerator extends TypedMapImplGenerator { : names = TypedMapNames(declaration.state.either.name.name), factoryNames = [FactoryNames(declaration.factory.name.name)], member = declaration.state.either, + allPropsMixins = null, isProps = false, componentFactoryName = ComponentNames(declaration.component.name.name).componentFactoryName, isFunctionComponentDeclaration = false, @@ -369,6 +379,7 @@ class _TypedMapImplGenerator extends TypedMapImplGenerator { factoryNames = declaration.factories.map((factory) => FactoryNames(factory.name.name)).toList(), member = declaration.props.either, + allPropsMixins = declaration.allPropsMixins, isProps = true, componentFactoryName = 'null', isFunctionComponentDeclaration = declaration.factories.first.shouldGenerateConfig, @@ -403,6 +414,7 @@ class _TypedMapImplGenerator extends TypedMapImplGenerator { componentFactoryName: componentFactoryName, // This doesn't really apply to the new boilerplate propKeyNamespace: '', + allPropsMixins: allPropsMixins, )); } diff --git a/lib/src/builder/codegen/util.dart b/lib/src/builder/codegen/util.dart index df55f89dc..143b41735 100644 --- a/lib/src/builder/codegen/util.dart +++ b/lib/src/builder/codegen/util.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import 'package:analyzer/dart/ast/ast.dart'; import 'package:logging/logging.dart'; import 'package:meta/meta.dart'; import 'package:over_react/src/component_declaration/annotations.dart' as annotations; @@ -66,3 +67,21 @@ String generatedMixinWarningCommentLine(TypedMapNames mixinNames, {@required boo return value; } + +void generatePropsMeta( + StringBuffer buffer, + List mixins, { + String classType = 'PropsMetaCollection', + String fieldName = 'propsMeta', +}) { + buffer + ..writeln() + ..writeln(' @override') + ..writeln(' $classType get $fieldName => const $classType({'); + for (final name in mixins) { + final names = TypedMapNames(name.name); + buffer.write(' ${generatedMixinWarningCommentLine(names, isProps: true)}'); + buffer.writeln(' ${names.consumerName}: ${names.publicGeneratedMetaName},'); + } + buffer.writeln(' });'); +} diff --git a/lib/src/builder/parsing/declarations.dart b/lib/src/builder/parsing/declarations.dart index 891e67271..5d508a894 100644 --- a/lib/src/builder/parsing/declarations.dart +++ b/lib/src/builder/parsing/declarations.dart @@ -221,6 +221,17 @@ mixin _TypedMapMixinShorthandDeclaration { } } +extension on Union { + /// Retrieves all of the mixins related to a props class declaration. + /// + /// This is the safest way to retrieve that information because it takes + /// into account the nature of the [Union] typing of `props`. + List get allPropsMixins => this.switchCase( + (a) => a.nodeHelper.mixins.map((name) => name.name).toList(), + (b) => [b.name], + ); +} + /// A boilerplate declaration for a class-based component declared using the new mixin-based /// boilerplate. /// @@ -238,11 +249,7 @@ class ClassComponentDeclaration extends BoilerplateDeclaration @override get type => DeclarationType.classComponentDeclaration; - /// All the props mixins related to this component declaration - List get allPropsMixins => props.switchCase( - (a) => a.nodeHelper.mixins.map((name) => name.name).toList(), - (b) => [b.name], - ); + List get allPropsMixins => props.allPropsMixins; @override void validate(ErrorCollector errorCollector) { @@ -278,6 +285,8 @@ class PropsMapViewOrFunctionComponentDeclaration extends BoilerplateDeclaration /// Can be either [BoilerplateProps] or [BoilerplatePropsMixin], but not both. final Union props; + List get allPropsMixins => props.allPropsMixins; + @override get _members => [...factories, props.either]; diff --git a/lib/src/component/abstract_transition_props.over_react.g.dart b/lib/src/component/abstract_transition_props.over_react.g.dart index 479405744..cafd03002 100644 --- a/lib/src/component/abstract_transition_props.over_react.g.dart +++ b/lib/src/component/abstract_transition_props.over_react.g.dart @@ -151,6 +151,12 @@ abstract class _$$TransitionPropsMixin extends UiProps /// 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 TransitionPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TransitionPropsMixin, and check that $TransitionPropsMixin is exported/imported properly. + TransitionPropsMixin: $TransitionPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/lib/src/component/error_boundary.over_react.g.dart b/lib/src/component/error_boundary.over_react.g.dart index a52a3a655..a16343d41 100644 --- a/lib/src/component/error_boundary.over_react.g.dart +++ b/lib/src/component/error_boundary.over_react.g.dart @@ -59,6 +59,12 @@ abstract class _$$ErrorBoundaryProps extends UiProps /// 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 ErrorBoundaryProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ErrorBoundaryProps, and check that $ErrorBoundaryProps is exported/imported properly. + ErrorBoundaryProps: $ErrorBoundaryProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/lib/src/component/error_boundary_recoverable.over_react.g.dart b/lib/src/component/error_boundary_recoverable.over_react.g.dart index 6795d005e..094b69f9e 100644 --- a/lib/src/component/error_boundary_recoverable.over_react.g.dart +++ b/lib/src/component/error_boundary_recoverable.over_react.g.dart @@ -61,6 +61,12 @@ abstract class _$$RecoverableErrorBoundaryProps extends UiProps /// 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 v2.ErrorBoundaryProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of v2.ErrorBoundaryProps, and check that v2.$ErrorBoundaryProps is exported/imported properly. + v2.ErrorBoundaryProps: v2.$ErrorBoundaryProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/lib/src/component/resize_sensor.over_react.g.dart b/lib/src/component/resize_sensor.over_react.g.dart index 7269e74b8..4485ee080 100644 --- a/lib/src/component/resize_sensor.over_react.g.dart +++ b/lib/src/component/resize_sensor.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$ResizeSensorProps extends UiProps /// 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 ResizeSensorProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ResizeSensorProps, and check that $ResizeSensorProps is exported/imported properly. + ResizeSensorProps: $ResizeSensorProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/lib/src/component/strictmode_component.dart b/lib/src/component/strictmode_component.dart index 529ac315e..78670593f 100644 --- a/lib/src/component/strictmode_component.dart +++ b/lib/src/component/strictmode_component.dart @@ -20,6 +20,8 @@ import 'package:react/react_client.dart'; import 'package:react/react_client/js_backed_map.dart'; import 'package:react/react.dart' as react; +import '../../over_react.dart'; + class StrictModeProps extends component_base.UiProps with builder_helpers.GeneratedClass implements builder_helpers.UiProps { @@ -30,6 +32,9 @@ class StrictModeProps extends component_base.UiProps @override ReactComponentFactoryProxy componentFactory = react.StrictMode; + @override + PropsMetaCollection get staticMeta => throw UnimplementedError('StrictModeProps instances do not implement instance meta'); + @override final Map props; diff --git a/lib/src/component/with_transition.over_react.g.dart b/lib/src/component/with_transition.over_react.g.dart index b5dec4baa..366445d5e 100644 --- a/lib/src/component/with_transition.over_react.g.dart +++ b/lib/src/component/with_transition.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$WithTransitionProps extends UiProps /// 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 v2.TransitionPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of v2.TransitionPropsMixin, and check that v2.$TransitionPropsMixin is exported/imported properly. + v2.TransitionPropsMixin: v2.$TransitionPropsMixin.meta, + // If this generated mixin is undefined, it's likely because WithTransitionPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of WithTransitionPropsMixin, and check that $WithTransitionPropsMixin is exported/imported properly. + WithTransitionPropsMixin: $WithTransitionPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/lib/src/component_declaration/builder_helpers.dart b/lib/src/component_declaration/builder_helpers.dart index 09d3388bc..6c22a3b28 100644 --- a/lib/src/component_declaration/builder_helpers.dart +++ b/lib/src/component_declaration/builder_helpers.dart @@ -14,6 +14,8 @@ library over_react.component_declaration.builder_helpers; +import '../../component_base.dart'; +import '../../over_react.dart'; import './component_base.dart' as component_base; import './annotations.dart' as annotations; @@ -121,6 +123,15 @@ abstract class UiProps extends component_base.UiProps with GeneratedClass { @toBeGenerated String get propKeyNamespace => throw UngeneratedError(member: #propKeyNamespace); @override @toBeGenerated Map get props => throw UngeneratedError(member: #props); + + /// A collection of metadata for the prop fields in all prop mixins used by + /// this props instance's generated props class. + /// + /// Synonymous with [UiComponent2]'s `propsMeta`. + /// + /// This can be used to derive consumed props by usage in conjunction with [addUnconsumedProps] + /// and [addUnconsumedDomProps]. + @toBeGenerated PropsMetaCollection get staticMeta => throw UngeneratedError(member: #meta); } /// A [dart.collection.MapView]-like class with strongly-typed getters/setters for React state. diff --git a/lib/src/component_declaration/component_base.dart b/lib/src/component_declaration/component_base.dart index 46a123e95..c970dbaf2 100644 --- a/lib/src/component_declaration/component_base.dart +++ b/lib/src/component_declaration/component_base.dart @@ -464,6 +464,56 @@ abstract class UiProps extends MapBase modifier(this); } + /// Copies key-value pairs from the provided [props] map into this map, + /// excluding those with keys found in [consumedProps]. + /// + /// [consumedProps] should be a `Iterable` instance. + /// This is the return type of [PropsMetaCollection]'s related APIs `forMixins`, + /// `allExceptForMixins`, and `all`. + /// + /// __Example:__ + /// + /// ```dart + /// // within a functional component (wrapped in `uiFunction`) + /// // Consider props in FooProps "consumed"... + /// final consumedProps = props.staticMeta.forMixins({FooProps}); + /// // ...and filter them out when forwarding props to Bar. + /// return (Bar()..addUnconsumedProps(props, consumedProps))(); + /// ``` + /// + /// To only add DOM props, use [addUnconsumedDomProps]. + /// + /// Related: `UiComponent2`'s `addUnconsumedProps` + void addUnconsumedProps(Map props, Iterable consumedProps) { + final consumedPropKeys = consumedProps.map((consumedProps) => consumedProps.keys); + forwardUnconsumedPropsV2(props, propsToUpdate: this, keySetsToOmit: consumedPropKeys); + } + + /// Copies DOM only key-value pairs from the provided [props] map into this map, + /// excluding those with keys found in [consumedProps]. + /// + /// [consumedProps] should be a `Iterable` instance. + /// This is the return type of [PropsMetaCollection]'s related APIs `forMixins`, + /// `allExceptForMixins`, and `all`. + /// + /// __Example:__ + /// + /// ```dart + /// // within a functional component (wrapped in `uiFunction`) + /// // Consider props in FooProps "consumed"... + /// final consumedProps = [PropsMeta.forSimpleKey('className')]; + /// // ...and filter them out when forwarding props to Bar. + /// return (Bar()..addUnconsumedDomProps(props, consumedProps))(); + /// ``` + /// + /// To add all unconsumed props, including DOM props, use [addUnconsumedProps]. + /// + /// Related: `UiComponent2`'s `addUnconsumedDomProps` + void addUnconsumedDomProps(Map props, Iterable consumedProps) { + final consumedPropKeys = consumedProps.map((consumedProps) => consumedProps.keys); + forwardUnconsumedPropsV2(props, propsToUpdate: this, keySetsToOmit: consumedPropKeys, onlyCopyDomProps: true); + } + /// Whether [UiProps] is in a testing environment. /// /// Do not set this directly; Call [enableTestMode] or [disableTestMode] instead. diff --git a/lib/src/util/map_util.dart b/lib/src/util/map_util.dart index 1daaa0042..b754aaa75 100644 --- a/lib/src/util/map_util.dart +++ b/lib/src/util/map_util.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// ignore_for_file: deprecated_member_use_from_same_package library over_react.map_util; import 'dart:collection'; @@ -75,6 +76,9 @@ Map getPropsToForward(Map props, { /// /// Based upon configuration, the function will overlook [props] that are not /// meant to be passed on, such as non-DOM props or specified values. +/// +/// DEPRECATED: Use [forwardUnconsumedPropsV2] instead. +@Deprecated('This implementation does not filter DOM props correctly. Use forwardUnconsumedPropsV2 instead.') void forwardUnconsumedProps(Map props, { bool omitReactProps = true, bool onlyCopyDomProps = false, @@ -124,6 +128,57 @@ void forwardUnconsumedProps(Map props, { } } +/// Adds unconsumed props to a passed in [Map] reference ([propsToUpdate]). +/// +/// Based upon configuration, the function will overlook [props] that are not +/// meant to be passed on, such as non-DOM props or specified values. +/// +/// Identical to [forwardUnconsumedProps], with the exception of properly filtering +/// DOM props. +void forwardUnconsumedPropsV2(Map props, { + bool omitReactProps = true, + bool onlyCopyDomProps = false, + Iterable keysToOmit, + Iterable keySetsToOmit, + Map propsToUpdate, +}) { + for (final key in props.keys) { + if (keysToOmit != null && keysToOmit.contains(key)) continue; + + if (keySetsToOmit != null && keySetsToOmit.isNotEmpty) { + // If the passed in value of [keySetsToOmit] comes from + // [addUnconsumedProps], there should only be a single index. + // Consequently, this case exists to give the opportunity for the loop + // to continue without initiating another loop (which is less + // performant than `.first.contains()`). + // TODO: further optimize this by identifying the best looping / data structure + if (keySetsToOmit != null && keySetsToOmit.first.contains(key)) continue; + + if (keySetsToOmit.length > 1) { + bool shouldContinue = false; + for (final keySet in keySetsToOmit) { + if (keySet.contains(key)) { + shouldContinue = true; + break; + } + } + + if (shouldContinue) continue; + } + } + + if (onlyCopyDomProps && !((key is String && (key.startsWith('aria-') || + key.startsWith('data-'))) || + _validDomProps.contains(key))) { + continue; + } + + if (omitReactProps && const ['key', 'ref', 'children'].contains(key)) continue; + + propsToUpdate[key] = props[key]; + } +} + /// Returns a copy of the [DomPropsMixin.style] map found in [props]. /// /// Returns an empty map if [props] or its style map are `null`. diff --git a/lib/src/util/react_util.dart b/lib/src/util/react_util.dart index f7c2f3918..9c79e8596 100644 --- a/lib/src/util/react_util.dart +++ b/lib/src/util/react_util.dart @@ -22,6 +22,10 @@ import 'package:react/react_client.dart'; /// A `MapView` helper that stubs in unimplemented pieces of [UiProps]. /// /// Useful when you need a `MapView` for a `PropsMixin` that implements [UiProps]. +/// +/// DEPRECATED: Use new boilerplate mixin pattern instead (see the New Boilerplate Migration +/// Guide for more information). +@Deprecated('This pattern is deprecated in favor of the mixin props mixin pattern. See the New Boilerplate Migration guide for more information.') class UiPropsMapView extends MapView with ReactPropsMixin, @@ -40,6 +44,8 @@ class UiPropsMapView extends MapView bool get $isClassGenerated => throw UnimplementedError('@PropsMixin instances do not implement \$isClassGenerated'); + PropsMetaCollection get staticMeta => throw UnimplementedError('@PropsMixin instances do not implement instance meta'); + String get propKeyNamespace => throw UnimplementedError('@PropsMixin instances do not implement propKeyNamespace'); @@ -57,6 +63,14 @@ class UiPropsMapView extends MapView void modifyProps(PropsModifier modifier, [bool shouldModify = true]) => throw UnimplementedError('@PropsMixin instances do not implement modifyProps'); + @override + void addUnconsumedProps(Map props, Iterable consumedProps) => + throw UnimplementedError('@PropsMixin instances do not implement addUnconsumedProps'); + + @override + void addUnconsumedDomProps(Map props, Iterable consumedProps) => + throw UnimplementedError('@PropsMixin instances do not implement addUnconsumedDomProps'); + @override void addTestId(String value, {String key = defaultTestIdKey}) => throw UnimplementedError('@PropsMixin instances do not implement addTestId'); diff --git a/test/over_react/component/abstract_transition_test.over_react.g.dart b/test/over_react/component/abstract_transition_test.over_react.g.dart index c59862d3f..3ba6c9c9b 100644 --- a/test/over_react/component/abstract_transition_test.over_react.g.dart +++ b/test/over_react/component/abstract_transition_test.over_react.g.dart @@ -60,6 +60,14 @@ abstract class _$$TransitionerProps extends UiProps /// 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 TransitionerPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TransitionerPropsMixin, and check that $TransitionerPropsMixin is exported/imported properly. + TransitionerPropsMixin: $TransitionerPropsMixin.meta, + // If this generated mixin is undefined, it's likely because TransitionPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TransitionPropsMixin, and check that $TransitionPropsMixin is exported/imported properly. + TransitionPropsMixin: $TransitionPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component/fixtures/pure_test_components.over_react.g.dart b/test/over_react/component/fixtures/pure_test_components.over_react.g.dart index 76a8d5d41..45b3d3a17 100644 --- a/test/over_react/component/fixtures/pure_test_components.over_react.g.dart +++ b/test/over_react/component/fixtures/pure_test_components.over_react.g.dart @@ -59,6 +59,12 @@ abstract class _$$PureTestWrapperProps extends UiProps /// 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 SharedPureTestPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPureTestPropsMixin, and check that $SharedPureTestPropsMixin is exported/imported properly. + SharedPureTestPropsMixin: $SharedPureTestPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -200,6 +206,14 @@ abstract class _$$PureTestProps extends UiProps /// 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 SharedPureTestPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SharedPureTestPropsMixin, and check that $SharedPureTestPropsMixin is exported/imported properly. + SharedPureTestPropsMixin: $SharedPureTestPropsMixin.meta, + // If this generated mixin is undefined, it's likely because PureTestPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of PureTestPropsMixin, and check that $PureTestPropsMixin is exported/imported properly. + PureTestPropsMixin: $PureTestPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component/memo_test.over_react.g.dart b/test/over_react/component/memo_test.over_react.g.dart index 9f84b93cb..a6cd017df 100644 --- a/test/over_react/component/memo_test.over_react.g.dart +++ b/test/over_react/component/memo_test.over_react.g.dart @@ -237,6 +237,12 @@ abstract class _$$FunctionCustomPropsProps extends UiProps /// 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 FunctionCustomPropsProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FunctionCustomPropsProps, and check that $FunctionCustomPropsProps is exported/imported properly. + FunctionCustomPropsProps: $FunctionCustomPropsProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component/ref_util_test.over_react.g.dart b/test/over_react/component/ref_util_test.over_react.g.dart index 3590e228b..0d80f2d2e 100644 --- a/test/over_react/component/ref_util_test.over_react.g.dart +++ b/test/over_react/component/ref_util_test.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$BasicProps extends UiProps /// 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 BasicProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicProps, and check that $BasicProps is exported/imported properly. + BasicProps: $BasicProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -226,6 +232,12 @@ abstract class _$$BasicUiFunctionProps extends UiProps /// 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 BasicUiFunctionProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicUiFunctionProps, and check that $BasicUiFunctionProps is exported/imported properly. + BasicUiFunctionProps: $BasicUiFunctionProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -301,6 +313,12 @@ abstract class _$$SecondaryBasicUiFunctionProps extends UiProps /// 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 BasicUiFunctionProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicUiFunctionProps, and check that $BasicUiFunctionProps is exported/imported properly. + BasicUiFunctionProps: $BasicUiFunctionProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component/with_transition_test.over_react.g.dart b/test/over_react/component/with_transition_test.over_react.g.dart index ee33c45ee..617e35c09 100644 --- a/test/over_react/component/with_transition_test.over_react.g.dart +++ b/test/over_react/component/with_transition_test.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$WithTransitionTesterProps extends UiProps /// 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 WithTransitionPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of WithTransitionPropsMixin, and check that $WithTransitionPropsMixin is exported/imported properly. + WithTransitionPropsMixin: $WithTransitionPropsMixin.meta, + // If this generated mixin is undefined, it's likely because TransitionPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TransitionPropsMixin, and check that $TransitionPropsMixin is exported/imported properly. + TransitionPropsMixin: $TransitionPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_helpers_test.dart b/test/over_react/component_declaration/builder_helpers_test.dart index 588b9cede..8343a5083 100644 --- a/test/over_react/component_declaration/builder_helpers_test.dart +++ b/test/over_react/component_declaration/builder_helpers_test.dart @@ -65,6 +65,7 @@ main() { test('props', () {expect(() => unimplemented.props, throwsUngeneratedError);}); test('propKeyNamespace', () {expect(() => unimplemented.propKeyNamespace, throwsUngeneratedError);}); test('a map method', () {expect(() => unimplemented.keys, throwsUngeneratedError);}); + test('staticMeta', () {expect(() => unimplemented.staticMeta, throwsUngeneratedError);}); testStubbedMapMembers(() => UnimplementedUiProps()); }); diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/accessor_mixin_integration_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/accessor_mixin_integration_test.over_react.g.dart index b06cf4768..4ed20ace3 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/accessor_mixin_integration_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/accessor_mixin_integration_test.over_react.g.dart @@ -563,6 +563,12 @@ abstract class _$$TestPropsMixin extends UiProps /// 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 TestPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestPropsMixin, and check that $TestPropsMixin is exported/imported properly. + TestPropsMixin: $TestPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -637,6 +643,15 @@ abstract class _$$TestCustomNamespaceProps extends UiProps /// 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 TestCustomNamespacePropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestCustomNamespacePropsMixin, and check that $TestCustomNamespacePropsMixin is exported/imported properly. + TestCustomNamespacePropsMixin: $TestCustomNamespacePropsMixin.meta, + // If this generated mixin is undefined, it's likely because TestCustomNamespaceWithPropsAnnotationPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestCustomNamespaceWithPropsAnnotationPropsMixin, and check that $TestCustomNamespaceWithPropsAnnotationPropsMixin is exported/imported properly. + TestCustomNamespaceWithPropsAnnotationPropsMixin: + $TestCustomNamespaceWithPropsAnnotationPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/compact_hoc_syntax_integration_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/compact_hoc_syntax_integration_test.over_react.g.dart index 5f9d20e21..18363f535 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/compact_hoc_syntax_integration_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/compact_hoc_syntax_integration_test.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$FooProps extends UiProps /// 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 FooProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FooProps, and check that $FooProps is exported/imported properly. + FooProps: $FooProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/component_integration_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/component_integration_test.over_react.g.dart index a959fb768..6776264b6 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/component_integration_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/component_integration_test.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$ComponentTestProps extends UiProps /// 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 ComponentTestProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ComponentTestProps, and check that $ComponentTestProps is exported/imported properly. + ComponentTestProps: $ComponentTestProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -331,6 +337,12 @@ abstract class _$$IsErrorBoundaryProps extends UiProps /// 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 IsErrorBoundaryProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of IsErrorBoundaryProps, and check that $IsErrorBoundaryProps is exported/imported properly. + IsErrorBoundaryProps: $IsErrorBoundaryProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -489,6 +501,12 @@ abstract class _$$IsNotErrorBoundaryProps extends UiProps /// 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 IsNotErrorBoundaryProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of IsNotErrorBoundaryProps, and check that $IsNotErrorBoundaryProps is exported/imported properly. + IsNotErrorBoundaryProps: $IsNotErrorBoundaryProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/component_integration_verbose_syntax_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/component_integration_verbose_syntax_test.over_react.g.dart index 524b3fe16..969a7a7ac 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/component_integration_verbose_syntax_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/component_integration_verbose_syntax_test.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$ComponentTestProps extends UiProps /// 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 ComponentTestPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ComponentTestPropsMixin, and check that $ComponentTestPropsMixin is exported/imported properly. + ComponentTestPropsMixin: $ComponentTestPropsMixin.meta, + // If this generated mixin is undefined, it's likely because TestPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestPropsMixin, and check that $TestPropsMixin is exported/imported properly. + TestPropsMixin: $TestPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/constant_required_accessor_integration_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/constant_required_accessor_integration_test.over_react.g.dart index 6627cc4a1..93bc5b668 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/constant_required_accessor_integration_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/constant_required_accessor_integration_test.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$ComponentTestProps extends UiProps /// 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 ComponentTestProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ComponentTestProps, and check that $ComponentTestProps is exported/imported properly. + ComponentTestProps: $ComponentTestProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/covariant_accessor_override_integration_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/covariant_accessor_override_integration_test.over_react.g.dart index e26230ab7..d33c29e5f 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/covariant_accessor_override_integration_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/covariant_accessor_override_integration_test.over_react.g.dart @@ -100,6 +100,14 @@ abstract class _$$TestProps extends UiProps /// 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 BasePropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasePropsMixin, and check that $BasePropsMixin is exported/imported properly. + BasePropsMixin: $BasePropsMixin.meta, + // If this generated mixin is undefined, it's likely because OverridePropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of OverridePropsMixin, and check that $OverridePropsMixin is exported/imported properly. + OverridePropsMixin: $OverridePropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/do_not_generate_accessor_integration_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/do_not_generate_accessor_integration_test.over_react.g.dart index 0d8e3f775..b455b5b08 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/do_not_generate_accessor_integration_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/do_not_generate_accessor_integration_test.over_react.g.dart @@ -59,6 +59,12 @@ abstract class _$$DoNotGenerateAccessorTestProps extends UiProps /// 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 DoNotGenerateAccessorTestProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of DoNotGenerateAccessorTestProps, and check that $DoNotGenerateAccessorTestProps is exported/imported properly. + DoNotGenerateAccessorTestProps: $DoNotGenerateAccessorTestProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/function_component_test.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/function_component_test.dart index 1499dd8a9..95c1c37ce 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/function_component_test.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/function_component_test.dart @@ -192,14 +192,14 @@ void functionComponentTestHelper(UiFactory factory, test( 'that returns a new props class implementation instance backed by an existing map', () { - Map existingMap = {'TestProps.stringProp': 'test'}; + Map existingMap = {'TestPropsMixin.stringProp': 'test'}; final props = factory(existingMap); expect(props.stringProp, equals('test')); props.stringProp = 'modified'; expect(props.stringProp, equals('modified')); - expect(existingMap['TestProps.stringProp'], equals('modified')); + expect(existingMap['TestPropsMixin.stringProp'], equals('modified')); }); }); @@ -208,18 +208,18 @@ void functionComponentTestHelper(UiFactory factory, 'the props class name as a namespace and the prop name as the key by default', () { expect(factory()..stringProp = 'test', - containsPair('TestProps.stringProp', 'test')); + containsPair('TestPropsMixin.stringProp', 'test')); expect( - factory()..dynamicProp = 2, containsPair('TestProps.dynamicProp', 2)); + factory()..dynamicProp = 2, containsPair('TestPropsMixin.dynamicProp', 2)); expect(factory()..untypedProp = false, - containsPair('TestProps.untypedProp', false)); + containsPair('TestPropsMixin.untypedProp', false)); }); test('custom prop keys', () { expect(factory()..customKeyProp = 'test', - containsPair('TestProps.custom key!', 'test')); + containsPair('TestPropsMixin.custom key!', 'test')); }); test('custom prop key namespaces', () { @@ -232,6 +232,75 @@ void functionComponentTestHelper(UiFactory factory, containsPair('custom namespace~~custom key!', 'test')); }); }); + + group('can pass along unconsumed props', () { + const stringProp = 'a string'; + const anotherProp = 'this should be filtered'; + const className = 'aClassName'; + + group('using `addUnconsumedProps`', () { + TestProps initialProps; + TestProps secondProps; + + setUp(() { + initialProps = (factory() + ..stringProp = stringProp + ..anotherProp = anotherProp + ); + + secondProps = factory(); + + expect(secondProps.stringProp, isNull, reason: 'Test setup sanity check'); + expect(secondProps.anotherProp, isNull, reason: 'Test setup sanity check'); + }); + + test('', () { + secondProps.addUnconsumedProps(initialProps, []); + expect(secondProps.anotherProp, anotherProp); + expect(secondProps.stringProp, stringProp); + }); + + test('and consumed props are correctly filtered', () { + final consumedProps = initialProps.staticMeta.forMixins({TestPropsMixin}); + secondProps.addUnconsumedProps(initialProps, consumedProps); + expect(secondProps.stringProp, isNull); + expect(secondProps.anotherProp, anotherProp); + }); + }); + + group('using `addUnconsumedDomProps`', () + { + TestProps initialProps; + TestProps secondProps; + + setUp(() { + initialProps = (factory() + ..stringProp = stringProp + ..anotherProp = anotherProp + ..className = className + ); + + secondProps = factory(); + + expect(secondProps.className, isNull, reason: 'Test setup sanity check'); + }); + + test('', () { + secondProps.addUnconsumedDomProps(initialProps, []); + expect(secondProps.stringProp, isNull); + expect(secondProps.anotherProp, isNull); + expect(secondProps.className, className); + }); + + test('and consumed props are correctly filtered', () { + expect(initialProps.className, isNotNull, reason: 'Test setup sanity check'); + secondProps.addUnconsumedDomProps(initialProps, [PropsMeta.forSimpleKey('className')]); + expect(secondProps.stringProp, isNull); + expect(secondProps.anotherProp, isNull); + expect(secondProps.className, isNull); + }); + }); + }); } UiFactory BasicUiForwardRef = uiForwardRef( @@ -362,7 +431,7 @@ final _Test = uiFunction( $_TestConfig, // ignore: undefined_identifier ); -mixin TestProps on UiProps { +mixin TestPropsMixin on UiProps { String stringProp; dynamic dynamicProp; var untypedProp; // ignore: prefer_typing_uninitialized_variables @@ -376,3 +445,13 @@ mixin TestProps on UiProps { @Accessor(keyNamespace: 'custom namespace~~', key: 'custom key!') dynamic customKeyAndNamespaceProp; } + +mixin ASecondPropsMixin on UiProps { + String anotherProp; +} + +mixin AThirdPropsMixin on UiProps { + String aPropsFromAThirdMixin; +} + +class TestProps = UiProps with TestPropsMixin, ASecondPropsMixin, AThirdPropsMixin; diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/function_component_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/function_component_test.over_react.g.dart index a3a06d43e..d8cd878c8 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/function_component_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/function_component_test.over_react.g.dart @@ -11,99 +11,171 @@ part of 'function_component_test.dart'; ' 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 $TestProps on TestProps { - static const PropsMeta meta = _$metaForTestProps; +mixin $TestPropsMixin on TestPropsMixin { + static const PropsMeta meta = _$metaForTestPropsMixin; @override String get stringProp => - props[_$key__stringProp__TestProps] ?? + props[_$key__stringProp__TestPropsMixin] ?? null; // Add ` ?? null` to workaround DDC bug: ; @override - set stringProp(String value) => props[_$key__stringProp__TestProps] = value; + set stringProp(String value) => + props[_$key__stringProp__TestPropsMixin] = value; @override dynamic get dynamicProp => - props[_$key__dynamicProp__TestProps] ?? + props[_$key__dynamicProp__TestPropsMixin] ?? null; // Add ` ?? null` to workaround DDC bug: ; @override set dynamicProp(dynamic value) => - props[_$key__dynamicProp__TestProps] = value; + props[_$key__dynamicProp__TestPropsMixin] = value; @override get untypedProp => - props[_$key__untypedProp__TestProps] ?? + props[_$key__untypedProp__TestPropsMixin] ?? null; // Add ` ?? null` to workaround DDC bug: ; @override - set untypedProp(value) => props[_$key__untypedProp__TestProps] = value; + set untypedProp(value) => props[_$key__untypedProp__TestPropsMixin] = value; @override @Accessor(key: 'custom key!') dynamic get customKeyProp => - props[_$key__customKeyProp__TestProps] ?? + props[_$key__customKeyProp__TestPropsMixin] ?? null; // Add ` ?? null` to workaround DDC bug: ; @override @Accessor(key: 'custom key!') set customKeyProp(dynamic value) => - props[_$key__customKeyProp__TestProps] = value; + props[_$key__customKeyProp__TestPropsMixin] = value; @override @Accessor(keyNamespace: 'custom namespace~~') dynamic get customNamespaceProp => - props[_$key__customNamespaceProp__TestProps] ?? + props[_$key__customNamespaceProp__TestPropsMixin] ?? null; // Add ` ?? null` to workaround DDC bug: ; @override @Accessor(keyNamespace: 'custom namespace~~') set customNamespaceProp(dynamic value) => - props[_$key__customNamespaceProp__TestProps] = value; + props[_$key__customNamespaceProp__TestPropsMixin] = value; @override @Accessor(keyNamespace: 'custom namespace~~', key: 'custom key!') dynamic get customKeyAndNamespaceProp => - props[_$key__customKeyAndNamespaceProp__TestProps] ?? + props[_$key__customKeyAndNamespaceProp__TestPropsMixin] ?? null; // Add ` ?? null` to workaround DDC bug: ; @override @Accessor(keyNamespace: 'custom namespace~~', key: 'custom key!') set customKeyAndNamespaceProp(dynamic value) => - props[_$key__customKeyAndNamespaceProp__TestProps] = value; + props[_$key__customKeyAndNamespaceProp__TestPropsMixin] = value; /* GENERATED CONSTANTS */ - static const PropDescriptor _$prop__stringProp__TestProps = - PropDescriptor(_$key__stringProp__TestProps); - static const PropDescriptor _$prop__dynamicProp__TestProps = - PropDescriptor(_$key__dynamicProp__TestProps); - static const PropDescriptor _$prop__untypedProp__TestProps = - PropDescriptor(_$key__untypedProp__TestProps); - static const PropDescriptor _$prop__customKeyProp__TestProps = - PropDescriptor(_$key__customKeyProp__TestProps); - static const PropDescriptor _$prop__customNamespaceProp__TestProps = - PropDescriptor(_$key__customNamespaceProp__TestProps); - static const PropDescriptor _$prop__customKeyAndNamespaceProp__TestProps = - PropDescriptor(_$key__customKeyAndNamespaceProp__TestProps); - static const String _$key__stringProp__TestProps = 'TestProps.stringProp'; - static const String _$key__dynamicProp__TestProps = 'TestProps.dynamicProp'; - static const String _$key__untypedProp__TestProps = 'TestProps.untypedProp'; - static const String _$key__customKeyProp__TestProps = 'TestProps.custom key!'; - static const String _$key__customNamespaceProp__TestProps = + static const PropDescriptor _$prop__stringProp__TestPropsMixin = + PropDescriptor(_$key__stringProp__TestPropsMixin); + static const PropDescriptor _$prop__dynamicProp__TestPropsMixin = + PropDescriptor(_$key__dynamicProp__TestPropsMixin); + static const PropDescriptor _$prop__untypedProp__TestPropsMixin = + PropDescriptor(_$key__untypedProp__TestPropsMixin); + static const PropDescriptor _$prop__customKeyProp__TestPropsMixin = + PropDescriptor(_$key__customKeyProp__TestPropsMixin); + static const PropDescriptor _$prop__customNamespaceProp__TestPropsMixin = + PropDescriptor(_$key__customNamespaceProp__TestPropsMixin); + static const PropDescriptor + _$prop__customKeyAndNamespaceProp__TestPropsMixin = + PropDescriptor(_$key__customKeyAndNamespaceProp__TestPropsMixin); + static const String _$key__stringProp__TestPropsMixin = + 'TestPropsMixin.stringProp'; + static const String _$key__dynamicProp__TestPropsMixin = + 'TestPropsMixin.dynamicProp'; + static const String _$key__untypedProp__TestPropsMixin = + 'TestPropsMixin.untypedProp'; + static const String _$key__customKeyProp__TestPropsMixin = + 'TestPropsMixin.custom key!'; + static const String _$key__customNamespaceProp__TestPropsMixin = 'custom namespace~~customNamespaceProp'; - static const String _$key__customKeyAndNamespaceProp__TestProps = + static const String _$key__customKeyAndNamespaceProp__TestPropsMixin = 'custom namespace~~custom key!'; static const List $props = [ - _$prop__stringProp__TestProps, - _$prop__dynamicProp__TestProps, - _$prop__untypedProp__TestProps, - _$prop__customKeyProp__TestProps, - _$prop__customNamespaceProp__TestProps, - _$prop__customKeyAndNamespaceProp__TestProps + _$prop__stringProp__TestPropsMixin, + _$prop__dynamicProp__TestPropsMixin, + _$prop__untypedProp__TestPropsMixin, + _$prop__customKeyProp__TestPropsMixin, + _$prop__customNamespaceProp__TestPropsMixin, + _$prop__customKeyAndNamespaceProp__TestPropsMixin ]; static const List $propKeys = [ - _$key__stringProp__TestProps, - _$key__dynamicProp__TestProps, - _$key__untypedProp__TestProps, - _$key__customKeyProp__TestProps, - _$key__customNamespaceProp__TestProps, - _$key__customKeyAndNamespaceProp__TestProps + _$key__stringProp__TestPropsMixin, + _$key__dynamicProp__TestPropsMixin, + _$key__untypedProp__TestPropsMixin, + _$key__customKeyProp__TestPropsMixin, + _$key__customNamespaceProp__TestPropsMixin, + _$key__customKeyAndNamespaceProp__TestPropsMixin ]; } @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 _$metaForTestProps = PropsMeta( - fields: $TestProps.$props, - keys: $TestProps.$propKeys, +const PropsMeta _$metaForTestPropsMixin = PropsMeta( + fields: $TestPropsMixin.$props, + keys: $TestPropsMixin.$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 $ASecondPropsMixin on ASecondPropsMixin { + static const PropsMeta meta = _$metaForASecondPropsMixin; + @override + String get anotherProp => + props[_$key__anotherProp__ASecondPropsMixin] ?? + null; // Add ` ?? null` to workaround DDC bug: ; + @override + set anotherProp(String value) => + props[_$key__anotherProp__ASecondPropsMixin] = value; + /* GENERATED CONSTANTS */ + static const PropDescriptor _$prop__anotherProp__ASecondPropsMixin = + PropDescriptor(_$key__anotherProp__ASecondPropsMixin); + static const String _$key__anotherProp__ASecondPropsMixin = + 'ASecondPropsMixin.anotherProp'; + + static const List $props = [ + _$prop__anotherProp__ASecondPropsMixin + ]; + static const List $propKeys = [_$key__anotherProp__ASecondPropsMixin]; +} + +@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 _$metaForASecondPropsMixin = PropsMeta( + fields: $ASecondPropsMixin.$props, + keys: $ASecondPropsMixin.$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 $AThirdPropsMixin on AThirdPropsMixin { + static const PropsMeta meta = _$metaForAThirdPropsMixin; + @override + String get aPropsFromAThirdMixin => + props[_$key__aPropsFromAThirdMixin__AThirdPropsMixin] ?? + null; // Add ` ?? null` to workaround DDC bug: ; + @override + set aPropsFromAThirdMixin(String value) => + props[_$key__aPropsFromAThirdMixin__AThirdPropsMixin] = value; + /* GENERATED CONSTANTS */ + static const PropDescriptor _$prop__aPropsFromAThirdMixin__AThirdPropsMixin = + PropDescriptor(_$key__aPropsFromAThirdMixin__AThirdPropsMixin); + static const String _$key__aPropsFromAThirdMixin__AThirdPropsMixin = + 'AThirdPropsMixin.aPropsFromAThirdMixin'; + + static const List $props = [ + _$prop__aPropsFromAThirdMixin__AThirdPropsMixin + ]; + static const List $propKeys = [ + _$key__aPropsFromAThirdMixin__AThirdPropsMixin + ]; +} + +@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 _$metaForAThirdPropsMixin = PropsMeta( + fields: $AThirdPropsMixin.$props, + keys: $AThirdPropsMixin.$propKeys, ); final UiFactoryConfig<_$$TestProps> $TestConfig = UiFactoryConfig( @@ -134,9 +206,14 @@ final UiFactoryConfig<_$$TestProps> $_TestConfig = UiFactoryConfig( ' Do not reference it in your code, as it may change at any time.') abstract class _$$TestProps extends UiProps with - TestProps, - $TestProps // If this generated mixin is undefined, it's likely because TestProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestProps, and check that $TestProps is exported/imported properly. -{ + TestPropsMixin, + $TestPropsMixin, // If this generated mixin is undefined, it's likely because TestPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestPropsMixin, and check that $TestPropsMixin is exported/imported properly. + ASecondPropsMixin, + $ASecondPropsMixin, // If this generated mixin is undefined, it's likely because ASecondPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ASecondPropsMixin, and check that $ASecondPropsMixin is exported/imported properly. + AThirdPropsMixin, + $AThirdPropsMixin // If this generated mixin is undefined, it's likely because AThirdPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of AThirdPropsMixin, and check that $AThirdPropsMixin is exported/imported properly. + implements + TestProps { _$$TestProps._(); factory _$$TestProps(Map backingMap) { @@ -154,6 +231,16 @@ abstract class _$$TestProps extends UiProps /// 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 TestPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestPropsMixin, and check that $TestPropsMixin is exported/imported properly. + TestPropsMixin: $TestPropsMixin.meta, + // If this generated mixin is undefined, it's likely because ASecondPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ASecondPropsMixin, and check that $ASecondPropsMixin is exported/imported properly. + ASecondPropsMixin: $ASecondPropsMixin.meta, + // If this generated mixin is undefined, it's likely because AThirdPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of AThirdPropsMixin, and check that $AThirdPropsMixin is exported/imported properly. + AThirdPropsMixin: $AThirdPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/namespaced_accessor_integration_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/namespaced_accessor_integration_test.over_react.g.dart index 08b1a867a..a7679995e 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/namespaced_accessor_integration_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/namespaced_accessor_integration_test.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$NamespacedAccessorTestProps extends UiProps /// 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 NamespacedAccessorTestProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of NamespacedAccessorTestProps, and check that $NamespacedAccessorTestProps is exported/imported properly. + NamespacedAccessorTestProps: $NamespacedAccessorTestProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/private_props_ddc_bug.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/private_props_ddc_bug.over_react.g.dart index 23aebe1d2..f0c8b4171 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/private_props_ddc_bug.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/private_props_ddc_bug.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$FooProps extends UiProps /// 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 FooProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FooProps, and check that $FooProps is exported/imported properly. + FooProps: $FooProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_map_view_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_map_view_test.over_react.g.dart index d5149259c..ff57bc564 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_map_view_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_map_view_test.over_react.g.dart @@ -137,6 +137,12 @@ abstract class _$$TestProps extends UiProps /// 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 TestProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestProps, and check that $TestProps is exported/imported properly. + TestProps: $TestProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.dart index d63345fac..bde2eaf71 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.dart @@ -52,9 +52,7 @@ main() { }); }); - group('(field)', () { - final propsMeta = _$TestComponent().propsMeta; - + void commonMetaTests(PropsMetaCollection propsMeta) { test('provides access to the expected props', () { expect(propsMeta.props.length, 3); expect(propsMeta.props.map((prop) => prop.key), containsAll(expectedKeys)); @@ -147,6 +145,21 @@ main() { }, tags: 'no-ddc'); }); }); + } + + group('(field)', () { + commonMetaTests(_$TestComponent().propsMeta); + }); + + group('(props instance)', () { + group('generates props meta utilities attached to the props instance', () { + test(r'that can be accessed directly via staticMeta', () { + expect(Test().staticMeta, isNotNull); + expect(Test().staticMeta, isA()); + }); + }); + + commonMetaTests(Test().staticMeta); }); }); } diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.over_react.g.dart index c305a85f1..8b4460503 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/props_meta_test.over_react.g.dart @@ -62,6 +62,16 @@ abstract class _$$TestProps extends UiProps /// 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 TestPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TestPropsMixin, and check that $TestPropsMixin is exported/imported properly. + TestPropsMixin: $TestPropsMixin.meta, + // If this generated mixin is undefined, it's likely because FooPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FooPropsMixin, and check that $FooPropsMixin is exported/imported properly. + FooPropsMixin: $FooPropsMixin.meta, + // If this generated mixin is undefined, it's likely because BazPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BazPropsMixin, and check that $BazPropsMixin is exported/imported properly. + BazPropsMixin: $BazPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/required_accessor_integration_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/required_accessor_integration_test.over_react.g.dart index b718df67c..8c0f81631 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/required_accessor_integration_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/required_accessor_integration_test.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$ComponentTestProps extends UiProps /// 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 ComponentTestProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ComponentTestProps, and check that $ComponentTestProps is exported/imported properly. + ComponentTestProps: $ComponentTestProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/stateful_component_integration_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/stateful_component_integration_test.over_react.g.dart index 52173b079..2f8728032 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/stateful_component_integration_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/stateful_component_integration_test.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$StatefulComponentTestProps extends UiProps /// 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 StatefulComponentTestProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of StatefulComponentTestProps, and check that $StatefulComponentTestProps is exported/imported properly. + StatefulComponentTestProps: $StatefulComponentTestProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/unassigned_prop_integration_test.over_react.g.dart b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/unassigned_prop_integration_test.over_react.g.dart index 0a470902a..06ff1b13f 100644 --- a/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/unassigned_prop_integration_test.over_react.g.dart +++ b/test/over_react/component_declaration/builder_integration_tests/new_boilerplate/unassigned_prop_integration_test.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$FooProps extends UiProps /// 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 FooProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FooProps, and check that $FooProps is exported/imported properly. + FooProps: $FooProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test/over_react/util/map_util_test.dart b/test/over_react/util/map_util_test.dart index e3c8d6358..93e314659 100644 --- a/test/over_react/util/map_util_test.dart +++ b/test/over_react/util/map_util_test.dart @@ -12,12 +12,22 @@ // See the License for the specific language governing permissions and // limitations under the License. +// ignore_for_file: deprecated_member_use_from_same_package library map_util_test; import 'package:over_react/over_react.dart'; import 'package:test/test.dart'; import 'package:over_react/src/component_declaration/component_base.dart' as component_base; +typedef ForwardUnconsumedPropsFunction = void Function(Map props, { + bool omitReactProps, + bool onlyCopyDomProps, + Iterable keysToOmit, + Iterable + keySetsToOmit, + Map propsToUpdate + }); + /// Main entrypoint for map_util testing main() { group('map_util part', () { @@ -123,142 +133,253 @@ main() { }); }); - group('forwardUnconsumedProps() modifies a passed in props reference', () { - group('with React props', () { - test('omitted out by default', () { - Map startingProps = { - 'key': 'my key', - 'ref': 'my ref', - 'other prop': 'my other prop' + void commonPropsForwardingUtilTests(ForwardUnconsumedPropsFunction functionToTest) { + group('(common prop forwarding tests) modifies a passed in props reference', () { + group('with React props', () { + test('omitted out by default', () { + Map startingProps = { + 'key': 'my key', + 'ref': 'my ref', + 'other prop': 'my other prop' + }; + + Map actual = {}; + + functionToTest(startingProps, propsToUpdate: actual); + + var expected = {'other prop': 'my other prop'}; + + expect(actual, equals(expected)); + }); + + test('not omitted when specified', () { + var actual = {}; + + functionToTest({ + 'key': 'my key', + 'ref': 'my ref', + 'other prop': 'my other prop' + }, omitReactProps: false, propsToUpdate: actual); + + var expected = { + 'key': 'my key', + 'ref': 'my ref', + 'other prop': 'my other prop' + }; + + expect(actual, equals(expected)); + }); + }); + + test('with the specified keys omitted', () { + var actual = {}; + + functionToTest({ + 'prop 1': 'my prop #1', + 'prop 2': 'my prop #2', + 'prop 3': 'my prop #3', + 'prop 4': 'my prop #4', + }, keysToOmit: [ + 'prop 2', + 'prop 4' + ], propsToUpdate: actual); + + var expected = { + 'prop 1': 'my prop #1', + 'prop 3': 'my prop #3', }; - Map actual = {}; + expect(actual, equals(expected)); + }); + + test('with the specified sets of keys omitted', () { + var actual = {}; - forwardUnconsumedProps(startingProps, propsToUpdate: actual); + functionToTest({ + 'prop 1': 'my prop #1', + 'prop 2': 'my prop #2', + 'prop 3': 'my prop #3', + 'prop 4': 'my prop #4', + 'prop 5': 'my prop #5', + 'prop 6': 'my prop #6', + }, keySetsToOmit: [ + [ + 'prop 1', + 'prop 3' + ], + [ + 'prop 4', + 'prop 5' + ], + ], propsToUpdate: actual); - var expected = {'other prop': 'my other prop'}; + var expected = { + 'prop 2': 'my prop #2', + 'prop 6': 'my prop #6', + }; expect(actual, equals(expected)); }); - test('not omitted when specified', () { + test('when keySetsToOmit is empty', () { var actual = {}; - forwardUnconsumedProps({ - 'key': 'my key', - 'ref': 'my ref', - 'other prop': 'my other prop' - }, omitReactProps: false, propsToUpdate: actual); + functionToTest({ + 'prop 1': 'my prop #1', + 'prop 2': 'my prop #2', + 'prop 3': 'my prop #3', + 'prop 4': 'my prop #4', + 'prop 5': 'my prop #5', + 'prop 6': 'my prop #6', + }, keySetsToOmit: [], propsToUpdate: actual); var expected = { - 'key': 'my key', - 'ref': 'my ref', - 'other prop': 'my other prop' + 'prop 1': 'my prop #1', + 'prop 2': 'my prop #2', + 'prop 3': 'my prop #3', + 'prop 4': 'my prop #4', + 'prop 5': 'my prop #5', + 'prop 6': 'my prop #6', }; expect(actual, equals(expected)); }); - }); - test('with the specified keys omitted', () { - var actual = {}; + test('when keySetsToOmit is null', () { + var actual = {}; - forwardUnconsumedProps({ - 'prop 1': 'my prop #1', - 'prop 2': 'my prop #2', - 'prop 3': 'my prop #3', - 'prop 4': 'my prop #4', - }, keysToOmit: [ - 'prop 2', - 'prop 4' - ], propsToUpdate: actual); + functionToTest({ + 'prop 1': 'my prop #1', + 'prop 2': 'my prop #2', + 'prop 3': 'my prop #3', + 'prop 4': 'my prop #4', + 'prop 5': 'my prop #5', + 'prop 6': 'my prop #6', + }, keySetsToOmit: null, propsToUpdate: actual); - var expected = { - 'prop 1': 'my prop #1', - 'prop 3': 'my prop #3', - }; + var expected = { + 'prop 1': 'my prop #1', + 'prop 2': 'my prop #2', + 'prop 3': 'my prop #3', + 'prop 4': 'my prop #4', + 'prop 5': 'my prop #5', + 'prop 6': 'my prop #6', + }; - expect(actual, equals(expected)); - }); + expect(actual, equals(expected)); + }); - test('with the specified sets of keys omitted', () { - var actual = {}; + test('with only valid DOM/SVG props', () { + var actual = {}; - forwardUnconsumedProps({ - 'prop 1': 'my prop #1', - 'prop 2': 'my prop #2', - 'prop 3': 'my prop #3', - 'prop 4': 'my prop #4', - 'prop 5': 'my prop #5', - 'prop 6': 'my prop #6', - }, keySetsToOmit: [ - [ - 'prop 1', - 'prop 3' - ], - [ - 'prop 4', - 'prop 5' - ], - ], propsToUpdate: actual); + functionToTest({ + 'tabIndex': '0', + 'className': 'my classname', + 'cx': '0', + 'stroke': 'red', + 'data-test-prop': 'my data attr', + 'aria-test-prop': 'my aria attr', + 'classNameBlacklist': 'my classname blacklist', + 'custom prop': 'my custom prop', + }, onlyCopyDomProps: true, propsToUpdate: actual); - var expected = { - 'prop 2': 'my prop #2', - 'prop 6': 'my prop #6', - }; + var expected = { + 'tabIndex': '0', + 'className': 'my classname', + 'cx': '0', + 'stroke': 'red', + 'data-test-prop': 'my data attr', + 'aria-test-prop': 'my aria attr', + }; - expect(actual, equals(expected)); + expect(actual, equals(expected)); + }); }); - - test('when keySetsToOmit is empty', () { - var actual = {}; + } + + // This test is necessary because `forwardUnconsumedProps` doesn't actually + // filter out DOM props that should be omitted. Therefore, a shared test + // for `forwardUnconsumedProps` and `forwardUnconsumedPropsV2` is useful + // to demonstrate the change in behavior. + void commonDomPropsFilteringTest(ForwardUnconsumedPropsFunction functionToTest, {bool shouldFilter = true}) { + group('(common DOM props filtering test) ${shouldFilter ? 'should' : 'shouldn\'t'} filter DOM props', () { + test('when `keysToOmit` is set', () { + final actual = {}; + const startingDomProps = { + 'tabIndex': '0', + 'className': 'my classname', + 'cx': '0', + 'stroke': 'red', + 'data-test-prop': 'my data attr', + 'aria-test-prop': 'my aria attr', + }; - forwardUnconsumedProps({ - 'prop 1': 'my prop #1', - 'prop 2': 'my prop #2', - 'prop 3': 'my prop #3', - 'prop 4': 'my prop #4', - 'prop 5': 'my prop #5', - 'prop 6': 'my prop #6', - }, keySetsToOmit: [], propsToUpdate: actual); + const mapWithDomAndCustomProps = { + ...startingDomProps, + 'classNameBlacklist': 'my classname blacklist', + 'custom prop': 'my custom prop', + }; - var expected = { - 'prop 1': 'my prop #1', - 'prop 2': 'my prop #2', - 'prop 3': 'my prop #3', - 'prop 4': 'my prop #4', - 'prop 5': 'my prop #5', - 'prop 6': 'my prop #6', - }; + functionToTest( + mapWithDomAndCustomProps, + keysToOmit: [ + 'stroke', + 'className', + ], onlyCopyDomProps: true, propsToUpdate: actual); - expect(actual, equals(expected)); - }); + final expected = shouldFilter ? { + 'tabIndex': '0', + 'cx': '0', + 'data-test-prop': 'my data attr', + 'aria-test-prop': 'my aria attr', + } : startingDomProps; - test('with only valid DOM/SVG props', () { - var actual = {}; + expect(actual, equals(expected)); + }); - forwardUnconsumedProps({ - 'tabIndex': '0', - 'className': 'my classname', - 'cx': '0', - 'stroke': 'red', - 'data-test-prop': 'my data attr', - 'aria-test-prop': 'my aria attr', - 'classNameBlacklist': 'my classname blacklist', - 'custom prop': 'my custom prop', - }, onlyCopyDomProps: true, propsToUpdate: actual); + test('when `keySetsToOmit` is set', () { + final actual = {}; + const startingDomProps = { + 'tabIndex': '0', + 'className': 'my classname', + 'cx': '0', + 'stroke': 'red', + 'data-test-prop': 'my data attr', + 'aria-test-prop': 'my aria attr', + }; - var expected = { - 'tabIndex': '0', - 'className': 'my classname', - 'cx': '0', - 'stroke': 'red', - 'data-test-prop': 'my data attr', - 'aria-test-prop': 'my aria attr', - }; + const mapWithDomAndCustomProps = { + ...startingDomProps, + 'classNameBlacklist': 'my classname blacklist', + 'custom prop': 'my custom prop', + }; + + functionToTest( + mapWithDomAndCustomProps, + keySetsToOmit: [ + ['stroke'], + ['className', 'tabIndex'], + ], onlyCopyDomProps: true, propsToUpdate: actual); + + final expected = shouldFilter ? { + 'cx': '0', + 'data-test-prop': 'my data attr', + 'aria-test-prop': 'my aria attr', + } : startingDomProps; + + expect(actual, equals(expected)); + }); - expect(actual, equals(expected)); }); + } + group('forwardUnconsumedProps', () { + commonPropsForwardingUtilTests(forwardUnconsumedProps); + commonDomPropsFilteringTest(forwardUnconsumedProps, shouldFilter: false); + }); + + group('forwardUnconsumedPropsV2', () { + commonPropsForwardingUtilTests(forwardUnconsumedPropsV2); + commonDomPropsFilteringTest(forwardUnconsumedPropsV2); }); group('newStyleFromProps() returns', () { diff --git a/test/over_react/util/react_util_test.dart b/test/over_react/util/react_util_test.dart index 4e660fd68..98b98d9cb 100644 --- a/test/over_react/util/react_util_test.dart +++ b/test/over_react/util/react_util_test.dart @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +// ignore_for_file: deprecated_member_use_from_same_package @TestOn('browser') library react_util_test; diff --git a/test_fixtures/gold_output_files/mixin_based/basic.over_react.g.dart.goldFile b/test_fixtures/gold_output_files/mixin_based/basic.over_react.g.dart.goldFile index 16df4c8c9..bccc8fcbe 100644 --- a/test_fixtures/gold_output_files/mixin_based/basic.over_react.g.dart.goldFile +++ b/test_fixtures/gold_output_files/mixin_based/basic.over_react.g.dart.goldFile @@ -57,6 +57,12 @@ abstract class _$$BasicProps extends UiProps /// 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 BasicProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicProps, and check that $BasicProps is exported/imported properly. + BasicProps: $BasicProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test_fixtures/gold_output_files/mixin_based/basic_library.over_react.g.dart.goldFile b/test_fixtures/gold_output_files/mixin_based/basic_library.over_react.g.dart.goldFile index 84797a2f0..5a02a26d9 100644 --- a/test_fixtures/gold_output_files/mixin_based/basic_library.over_react.g.dart.goldFile +++ b/test_fixtures/gold_output_files/mixin_based/basic_library.over_react.g.dart.goldFile @@ -61,6 +61,14 @@ abstract class _$$BasicPartOfLibProps extends UiProps /// 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 ExamplePropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ExamplePropsMixin, and check that $ExamplePropsMixin is exported/imported properly. + ExamplePropsMixin: $ExamplePropsMixin.meta, + // If this generated mixin is undefined, it's likely because BasicPartOfLibPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BasicPartOfLibPropsMixin, and check that $BasicPartOfLibPropsMixin is exported/imported properly. + BasicPartOfLibPropsMixin: $BasicPartOfLibPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -424,6 +432,14 @@ abstract class _$$SubPartOfLibProps extends UiProps /// 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 SuperPartOfLibPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SuperPartOfLibPropsMixin, and check that $SuperPartOfLibPropsMixin is exported/imported properly. + SuperPartOfLibPropsMixin: $SuperPartOfLibPropsMixin.meta, + // If this generated mixin is undefined, it's likely because SubPartOfLibPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SubPartOfLibPropsMixin, and check that $SubPartOfLibPropsMixin is exported/imported properly. + SubPartOfLibPropsMixin: $SubPartOfLibPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/test_fixtures/gold_output_files/mixin_based/type_parameters.over_react.g.dart.goldFile b/test_fixtures/gold_output_files/mixin_based/type_parameters.over_react.g.dart.goldFile index 26f9eb1b1..faf5a86b7 100644 --- a/test_fixtures/gold_output_files/mixin_based/type_parameters.over_react.g.dart.goldFile +++ b/test_fixtures/gold_output_files/mixin_based/type_parameters.over_react.g.dart.goldFile @@ -201,6 +201,12 @@ abstract class _$$SingleProps extends UiProps /// 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 SingleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SingleProps, and check that $SingleProps is exported/imported properly. + SingleProps: $SingleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -273,6 +279,12 @@ abstract class _$$SingleWithBoundProps extends UiProps /// 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 SingleWithBoundProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SingleWithBoundProps, and check that $SingleWithBoundProps is exported/imported properly. + SingleWithBoundProps: $SingleWithBoundProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -346,6 +358,12 @@ abstract class _$$DoubleProps extends UiProps /// 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 DoubleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of DoubleProps, and check that $DoubleProps is exported/imported properly. + DoubleProps: $DoubleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -428,6 +446,20 @@ abstract class _$$ConcreteNoneProps extends UiProps /// 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 NoneProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of NoneProps, and check that $NoneProps is exported/imported properly. + NoneProps: $NoneProps.meta, + // If this generated mixin is undefined, it's likely because SingleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SingleProps, and check that $SingleProps is exported/imported properly. + SingleProps: $SingleProps.meta, + // If this generated mixin is undefined, it's likely because SingleThatWontBeSpecifiedProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SingleThatWontBeSpecifiedProps, and check that $SingleThatWontBeSpecifiedProps is exported/imported properly. + SingleThatWontBeSpecifiedProps: $SingleThatWontBeSpecifiedProps.meta, + // If this generated mixin is undefined, it's likely because SingleWithBoundProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SingleWithBoundProps, and check that $SingleWithBoundProps is exported/imported properly. + SingleWithBoundProps: $SingleWithBoundProps.meta, + // If this generated mixin is undefined, it's likely because DoubleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of DoubleProps, and check that $DoubleProps is exported/imported properly. + DoubleProps: $DoubleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -510,6 +542,20 @@ abstract class _$$ConcreteArgsProps extends UiProps /// 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 NoneProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of NoneProps, and check that $NoneProps is exported/imported properly. + NoneProps: $NoneProps.meta, + // If this generated mixin is undefined, it's likely because SingleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SingleProps, and check that $SingleProps is exported/imported properly. + SingleProps: $SingleProps.meta, + // If this generated mixin is undefined, it's likely because SingleThatWontBeSpecifiedProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SingleThatWontBeSpecifiedProps, and check that $SingleThatWontBeSpecifiedProps is exported/imported properly. + SingleThatWontBeSpecifiedProps: $SingleThatWontBeSpecifiedProps.meta, + // If this generated mixin is undefined, it's likely because SingleWithBoundProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of SingleWithBoundProps, and check that $SingleWithBoundProps is exported/imported properly. + SingleWithBoundProps: $SingleWithBoundProps.meta, + // If this generated mixin is undefined, it's likely because DoubleProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of DoubleProps, and check that $DoubleProps is exported/imported properly. + DoubleProps: $DoubleProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demo_components/button.over_react.g.dart b/web/component2/src/demo_components/button.over_react.g.dart index 0a500172c..9cc8d4c29 100644 --- a/web/component2/src/demo_components/button.over_react.g.dart +++ b/web/component2/src/demo_components/button.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$ButtonProps extends UiProps /// 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 ButtonProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ButtonProps, and check that $ButtonProps is exported/imported properly. + ButtonProps: $ButtonProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demo_components/button_group.over_react.g.dart b/web/component2/src/demo_components/button_group.over_react.g.dart index ecb186058..a76c4248e 100644 --- a/web/component2/src/demo_components/button_group.over_react.g.dart +++ b/web/component2/src/demo_components/button_group.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$ButtonGroupProps extends UiProps /// 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 ButtonGroupProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ButtonGroupProps, and check that $ButtonGroupProps is exported/imported properly. + ButtonGroupProps: $ButtonGroupProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demo_components/list_group.over_react.g.dart b/web/component2/src/demo_components/list_group.over_react.g.dart index 3befc6f44..6320273f2 100644 --- a/web/component2/src/demo_components/list_group.over_react.g.dart +++ b/web/component2/src/demo_components/list_group.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$ListGroupProps extends UiProps /// 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 ListGroupProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ListGroupProps, and check that $ListGroupProps is exported/imported properly. + ListGroupProps: $ListGroupProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demo_components/list_group_item.over_react.g.dart b/web/component2/src/demo_components/list_group_item.over_react.g.dart index 3934b8f0a..5eec3c084 100644 --- a/web/component2/src/demo_components/list_group_item.over_react.g.dart +++ b/web/component2/src/demo_components/list_group_item.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$ListGroupItemProps extends UiProps /// 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 ListGroupItemProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ListGroupItemProps, and check that $ListGroupItemProps is exported/imported properly. + ListGroupItemProps: $ListGroupItemProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demo_components/progress.over_react.g.dart b/web/component2/src/demo_components/progress.over_react.g.dart index bc9204f94..be2840d86 100644 --- a/web/component2/src/demo_components/progress.over_react.g.dart +++ b/web/component2/src/demo_components/progress.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$ProgressProps extends UiProps /// 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 ProgressProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ProgressProps, and check that $ProgressProps is exported/imported properly. + ProgressProps: $ProgressProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demo_components/prop_validation.over_react.g.dart b/web/component2/src/demo_components/prop_validation.over_react.g.dart index 00880546b..01b054fce 100644 --- a/web/component2/src/demo_components/prop_validation.over_react.g.dart +++ b/web/component2/src/demo_components/prop_validation.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$PropTypesTestProps extends UiProps /// 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 PropTypesTestProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of PropTypesTestProps, and check that $PropTypesTestProps is exported/imported properly. + PropTypesTestProps: $PropTypesTestProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demo_components/prop_validation_wrap.over_react.g.dart b/web/component2/src/demo_components/prop_validation_wrap.over_react.g.dart index 2bb104b68..b1e6926f1 100644 --- a/web/component2/src/demo_components/prop_validation_wrap.over_react.g.dart +++ b/web/component2/src/demo_components/prop_validation_wrap.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$PropTypesWrapProps extends UiProps /// 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 PropTypesWrapProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of PropTypesWrapProps, and check that $PropTypesWrapProps is exported/imported properly. + PropTypesWrapProps: $PropTypesWrapProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demo_components/tag.over_react.g.dart b/web/component2/src/demo_components/tag.over_react.g.dart index 30a1bff36..7babd67f9 100644 --- a/web/component2/src/demo_components/tag.over_react.g.dart +++ b/web/component2/src/demo_components/tag.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$TagProps extends UiProps /// 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 TagProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of TagProps, and check that $TagProps is exported/imported properly. + TagProps: $TagProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demo_components/toggle_button.over_react.g.dart b/web/component2/src/demo_components/toggle_button.over_react.g.dart index 21dd1525e..abfc11059 100644 --- a/web/component2/src/demo_components/toggle_button.over_react.g.dart +++ b/web/component2/src/demo_components/toggle_button.over_react.g.dart @@ -63,6 +63,16 @@ abstract class _$$ToggleButtonProps extends UiProps /// 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 ButtonProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ButtonProps, and check that $ButtonProps is exported/imported properly. + ButtonProps: $ButtonProps.meta, + // If this generated mixin is undefined, it's likely because ToggleButtonPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ToggleButtonPropsMixin, and check that $ToggleButtonPropsMixin is exported/imported properly. + ToggleButtonPropsMixin: $ToggleButtonPropsMixin.meta, + // If this generated mixin is undefined, it's likely because AbstractInputPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of AbstractInputPropsMixin, and check that $AbstractInputPropsMixin is exported/imported properly. + AbstractInputPropsMixin: $AbstractInputPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demo_components/toggle_button_group.over_react.g.dart b/web/component2/src/demo_components/toggle_button_group.over_react.g.dart index dcda1bea4..3b796f9b4 100644 --- a/web/component2/src/demo_components/toggle_button_group.over_react.g.dart +++ b/web/component2/src/demo_components/toggle_button_group.over_react.g.dart @@ -62,6 +62,14 @@ abstract class _$$ToggleButtonGroupProps extends UiProps /// 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 ButtonGroupProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ButtonGroupProps, and check that $ButtonGroupProps is exported/imported properly. + ButtonGroupProps: $ButtonGroupProps.meta, + // If this generated mixin is undefined, it's likely because AbstractInputPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of AbstractInputPropsMixin, and check that $AbstractInputPropsMixin is exported/imported properly. + AbstractInputPropsMixin: $AbstractInputPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/component2/src/demos/ref.over_react.g.dart b/web/component2/src/demos/ref.over_react.g.dart index da5f75b9f..86cfaf0d4 100644 --- a/web/component2/src/demos/ref.over_react.g.dart +++ b/web/component2/src/demos/ref.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$FooProps extends UiProps /// 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 FooProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FooProps, and check that $FooProps is exported/imported properly. + FooProps: $FooProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -194,6 +200,12 @@ abstract class _$$LogProps extends UiProps /// 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 LogProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of LogProps, and check that $LogProps is exported/imported properly. + LogProps: $LogProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -572,6 +584,12 @@ abstract class _$$FancyButtonProps extends UiProps /// 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 FancyButtonProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FancyButtonProps, and check that $FancyButtonProps is exported/imported properly. + FancyButtonProps: $FancyButtonProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -648,6 +666,14 @@ abstract class _$$Foo2Props extends UiProps /// 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 AnotherPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of AnotherPropsMixin, and check that $AnotherPropsMixin is exported/imported properly. + AnotherPropsMixin: $AnotherPropsMixin.meta, + // If this generated mixin is undefined, it's likely because FooProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FooProps, and check that $FooProps is exported/imported properly. + FooProps: $FooProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -721,6 +747,12 @@ abstract class _$$BazProps extends UiProps /// 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 BazProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BazProps, and check that $BazProps is exported/imported properly. + BazProps: $BazProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -795,6 +827,12 @@ abstract class _$$RefDemoProps extends UiProps /// 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 RefDemoProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of RefDemoProps, and check that $RefDemoProps is exported/imported properly. + RefDemoProps: $RefDemoProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -869,6 +907,12 @@ abstract class _$$RefDemoSectionProps extends UiProps /// 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 RefDemoSectionProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of RefDemoSectionProps, and check that $RefDemoSectionProps is exported/imported properly. + RefDemoSectionProps: $RefDemoSectionProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. @@ -942,6 +986,12 @@ abstract class _$$RefDemoHocProps extends UiProps /// 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 RefDemoHocProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of RefDemoHocProps, and check that $RefDemoHocProps is exported/imported properly. + RefDemoHocProps: $RefDemoHocProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/advanced/components/little_block.over_react.g.dart b/web/flux_to_redux/advanced/components/little_block.over_react.g.dart index ba7689b62..618dd36c6 100644 --- a/web/flux_to_redux/advanced/components/little_block.over_react.g.dart +++ b/web/flux_to_redux/advanced/components/little_block.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$LittleBlockProps extends UiProps /// 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 LittleBlockProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of LittleBlockProps, and check that $LittleBlockProps is exported/imported properly. + LittleBlockProps: $LittleBlockProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/advanced/examples/flux_implementation/components/big_block.over_react.g.dart b/web/flux_to_redux/advanced/examples/flux_implementation/components/big_block.over_react.g.dart index 4be7a0802..425606fcd 100644 --- a/web/flux_to_redux/advanced/examples/flux_implementation/components/big_block.over_react.g.dart +++ b/web/flux_to_redux/advanced/examples/flux_implementation/components/big_block.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$BigBlockProps extends UiProps /// 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 FluxUiPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FluxUiPropsMixin, and check that $FluxUiPropsMixin is exported/imported properly. + FluxUiPropsMixin: $FluxUiPropsMixin.meta, + // If this generated mixin is undefined, it's likely because BigBlockPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BigBlockPropsMixin, and check that $BigBlockPropsMixin is exported/imported properly. + BigBlockPropsMixin: $BigBlockPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/advanced/examples/influx_implementation/components/big_block.over_react.g.dart b/web/flux_to_redux/advanced/examples/influx_implementation/components/big_block.over_react.g.dart index e1c170caf..ada9b4643 100644 --- a/web/flux_to_redux/advanced/examples/influx_implementation/components/big_block.over_react.g.dart +++ b/web/flux_to_redux/advanced/examples/influx_implementation/components/big_block.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$BigBlockProps extends UiProps /// 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 FluxUiPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FluxUiPropsMixin, and check that $FluxUiPropsMixin is exported/imported properly. + FluxUiPropsMixin: $FluxUiPropsMixin.meta, + // If this generated mixin is undefined, it's likely because BigBlockPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BigBlockPropsMixin, and check that $BigBlockPropsMixin is exported/imported properly. + BigBlockPropsMixin: $BigBlockPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/advanced/examples/influx_implementation/components/connect_flux_big_block.over_react.g.dart b/web/flux_to_redux/advanced/examples/influx_implementation/components/connect_flux_big_block.over_react.g.dart index 1f62b7f8a..d6a77ff2a 100644 --- a/web/flux_to_redux/advanced/examples/influx_implementation/components/connect_flux_big_block.over_react.g.dart +++ b/web/flux_to_redux/advanced/examples/influx_implementation/components/connect_flux_big_block.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$ConnectFluxBigBlockProps extends UiProps /// 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 ConnectFluxBigBlockPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ConnectFluxBigBlockPropsMixin, and check that $ConnectFluxBigBlockPropsMixin is exported/imported properly. + ConnectFluxBigBlockPropsMixin: $ConnectFluxBigBlockPropsMixin.meta, + // If this generated mixin is undefined, it's likely because ConnectPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ConnectPropsMixin, and check that $ConnectPropsMixin is exported/imported properly. + ConnectPropsMixin: $ConnectPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/advanced/examples/influx_implementation/components/redux_big_block.over_react.g.dart b/web/flux_to_redux/advanced/examples/influx_implementation/components/redux_big_block.over_react.g.dart index 874c545c1..6cb9dc4a5 100644 --- a/web/flux_to_redux/advanced/examples/influx_implementation/components/redux_big_block.over_react.g.dart +++ b/web/flux_to_redux/advanced/examples/influx_implementation/components/redux_big_block.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$ReduxBigBlockProps extends UiProps /// 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 ReduxBigBlockPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ReduxBigBlockPropsMixin, and check that $ReduxBigBlockPropsMixin is exported/imported properly. + ReduxBigBlockPropsMixin: $ReduxBigBlockPropsMixin.meta, + // If this generated mixin is undefined, it's likely because ConnectPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ConnectPropsMixin, and check that $ConnectPropsMixin is exported/imported properly. + ConnectPropsMixin: $ConnectPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/advanced/examples/influx_implementation/components/should_not_update.over_react.g.dart b/web/flux_to_redux/advanced/examples/influx_implementation/components/should_not_update.over_react.g.dart index 421819ef3..de81fa193 100644 --- a/web/flux_to_redux/advanced/examples/influx_implementation/components/should_not_update.over_react.g.dart +++ b/web/flux_to_redux/advanced/examples/influx_implementation/components/should_not_update.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$ShouldNotUpdateProps extends UiProps /// 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 ShouldNotUpdateProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ShouldNotUpdateProps, and check that $ShouldNotUpdateProps is exported/imported properly. + ShouldNotUpdateProps: $ShouldNotUpdateProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/advanced/examples/redux_implementation/components/random_color_redux.over_react.g.dart b/web/flux_to_redux/advanced/examples/redux_implementation/components/random_color_redux.over_react.g.dart index e112b8e44..3ddbe7b65 100644 --- a/web/flux_to_redux/advanced/examples/redux_implementation/components/random_color_redux.over_react.g.dart +++ b/web/flux_to_redux/advanced/examples/redux_implementation/components/random_color_redux.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$RandomColorReduxProps extends UiProps /// 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 RandomColorReduxPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of RandomColorReduxPropsMixin, and check that $RandomColorReduxPropsMixin is exported/imported properly. + RandomColorReduxPropsMixin: $RandomColorReduxPropsMixin.meta, + // If this generated mixin is undefined, it's likely because ConnectPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ConnectPropsMixin, and check that $ConnectPropsMixin is exported/imported properly. + ConnectPropsMixin: $ConnectPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/advanced/examples/redux_implementation/components/should_not_update.over_react.g.dart b/web/flux_to_redux/advanced/examples/redux_implementation/components/should_not_update.over_react.g.dart index 421819ef3..de81fa193 100644 --- a/web/flux_to_redux/advanced/examples/redux_implementation/components/should_not_update.over_react.g.dart +++ b/web/flux_to_redux/advanced/examples/redux_implementation/components/should_not_update.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$ShouldNotUpdateProps extends UiProps /// 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 ShouldNotUpdateProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ShouldNotUpdateProps, and check that $ShouldNotUpdateProps is exported/imported properly. + ShouldNotUpdateProps: $ShouldNotUpdateProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/simple/examples/flux_implementation/components/big_block.over_react.g.dart b/web/flux_to_redux/simple/examples/flux_implementation/components/big_block.over_react.g.dart index 4dd6253ea..eb13ec1a9 100644 --- a/web/flux_to_redux/simple/examples/flux_implementation/components/big_block.over_react.g.dart +++ b/web/flux_to_redux/simple/examples/flux_implementation/components/big_block.over_react.g.dart @@ -59,6 +59,12 @@ abstract class _$$BigBlockProps extends UiProps /// 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 FluxUiPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FluxUiPropsMixin, and check that $FluxUiPropsMixin is exported/imported properly. + FluxUiPropsMixin: $FluxUiPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/simple/examples/influx_implementation/components/big_block.over_react.g.dart b/web/flux_to_redux/simple/examples/influx_implementation/components/big_block.over_react.g.dart index 13eb3f98d..ed681c323 100644 --- a/web/flux_to_redux/simple/examples/influx_implementation/components/big_block.over_react.g.dart +++ b/web/flux_to_redux/simple/examples/influx_implementation/components/big_block.over_react.g.dart @@ -59,6 +59,12 @@ abstract class _$$BigBlockProps extends UiProps /// 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 FluxUiPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FluxUiPropsMixin, and check that $FluxUiPropsMixin is exported/imported properly. + FluxUiPropsMixin: $FluxUiPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/simple/examples/influx_implementation/components/connect_flux_big_block.over_react.g.dart b/web/flux_to_redux/simple/examples/influx_implementation/components/connect_flux_big_block.over_react.g.dart index b6321e754..b78b0f1c7 100644 --- a/web/flux_to_redux/simple/examples/influx_implementation/components/connect_flux_big_block.over_react.g.dart +++ b/web/flux_to_redux/simple/examples/influx_implementation/components/connect_flux_big_block.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$ConnectFluxBigBlockProps extends UiProps /// 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 ConnectFluxBigBlockPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ConnectFluxBigBlockPropsMixin, and check that $ConnectFluxBigBlockPropsMixin is exported/imported properly. + ConnectFluxBigBlockPropsMixin: $ConnectFluxBigBlockPropsMixin.meta, + // If this generated mixin is undefined, it's likely because ConnectPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ConnectPropsMixin, and check that $ConnectPropsMixin is exported/imported properly. + ConnectPropsMixin: $ConnectPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/simple/examples/influx_implementation/components/redux_big_block.over_react.g.dart b/web/flux_to_redux/simple/examples/influx_implementation/components/redux_big_block.over_react.g.dart index 50b105a53..7a15e6066 100644 --- a/web/flux_to_redux/simple/examples/influx_implementation/components/redux_big_block.over_react.g.dart +++ b/web/flux_to_redux/simple/examples/influx_implementation/components/redux_big_block.over_react.g.dart @@ -61,6 +61,14 @@ abstract class _$$ReduxBigBlockProps extends UiProps /// 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 ReduxBigBlockPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ReduxBigBlockPropsMixin, and check that $ReduxBigBlockPropsMixin is exported/imported properly. + ReduxBigBlockPropsMixin: $ReduxBigBlockPropsMixin.meta, + // If this generated mixin is undefined, it's likely because ConnectPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ConnectPropsMixin, and check that $ConnectPropsMixin is exported/imported properly. + ConnectPropsMixin: $ConnectPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/simple/examples/influx_implementation/components/should_not_update.over_react.g.dart b/web/flux_to_redux/simple/examples/influx_implementation/components/should_not_update.over_react.g.dart index e01043493..658b5ceaf 100644 --- a/web/flux_to_redux/simple/examples/influx_implementation/components/should_not_update.over_react.g.dart +++ b/web/flux_to_redux/simple/examples/influx_implementation/components/should_not_update.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$ShouldNotUpdateProps extends UiProps /// 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 ShouldNotUpdateProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ShouldNotUpdateProps, and check that $ShouldNotUpdateProps is exported/imported properly. + ShouldNotUpdateProps: $ShouldNotUpdateProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/simple/examples/redux_implementation/components/big_block.over_react.g.dart b/web/flux_to_redux/simple/examples/redux_implementation/components/big_block.over_react.g.dart index 7df520ceb..612e5f66b 100644 --- a/web/flux_to_redux/simple/examples/redux_implementation/components/big_block.over_react.g.dart +++ b/web/flux_to_redux/simple/examples/redux_implementation/components/big_block.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$BigBlockProps extends UiProps /// 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 BigBlockProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of BigBlockProps, and check that $BigBlockProps is exported/imported properly. + BigBlockProps: $BigBlockProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/flux_to_redux/simple/examples/redux_implementation/components/should_not_update.over_react.g.dart b/web/flux_to_redux/simple/examples/redux_implementation/components/should_not_update.over_react.g.dart index 421819ef3..de81fa193 100644 --- a/web/flux_to_redux/simple/examples/redux_implementation/components/should_not_update.over_react.g.dart +++ b/web/flux_to_redux/simple/examples/redux_implementation/components/should_not_update.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$ShouldNotUpdateProps extends UiProps /// 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 ShouldNotUpdateProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ShouldNotUpdateProps, and check that $ShouldNotUpdateProps is exported/imported properly. + ShouldNotUpdateProps: $ShouldNotUpdateProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/over_react_redux/examples/dev_tools/components/counter.over_react.g.dart b/web/over_react_redux/examples/dev_tools/components/counter.over_react.g.dart index 818f9cbba..b73dde9db 100644 --- a/web/over_react_redux/examples/dev_tools/components/counter.over_react.g.dart +++ b/web/over_react_redux/examples/dev_tools/components/counter.over_react.g.dart @@ -60,6 +60,14 @@ abstract class _$$CounterProps extends UiProps /// 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 CounterPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of CounterPropsMixin, and check that $CounterPropsMixin is exported/imported properly. + CounterPropsMixin: $CounterPropsMixin.meta, + // If this generated mixin is undefined, it's likely because ConnectPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ConnectPropsMixin, and check that $ConnectPropsMixin is exported/imported properly. + ConnectPropsMixin: $ConnectPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/over_react_redux/examples/multiple_stores/components/counter.over_react.g.dart b/web/over_react_redux/examples/multiple_stores/components/counter.over_react.g.dart index 818f9cbba..b73dde9db 100644 --- a/web/over_react_redux/examples/multiple_stores/components/counter.over_react.g.dart +++ b/web/over_react_redux/examples/multiple_stores/components/counter.over_react.g.dart @@ -60,6 +60,14 @@ abstract class _$$CounterProps extends UiProps /// 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 CounterPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of CounterPropsMixin, and check that $CounterPropsMixin is exported/imported properly. + CounterPropsMixin: $CounterPropsMixin.meta, + // If this generated mixin is undefined, it's likely because ConnectPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ConnectPropsMixin, and check that $ConnectPropsMixin is exported/imported properly. + ConnectPropsMixin: $ConnectPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/over_react_redux/examples/simple/components/counter.over_react.g.dart b/web/over_react_redux/examples/simple/components/counter.over_react.g.dart index 818f9cbba..b73dde9db 100644 --- a/web/over_react_redux/examples/simple/components/counter.over_react.g.dart +++ b/web/over_react_redux/examples/simple/components/counter.over_react.g.dart @@ -60,6 +60,14 @@ abstract class _$$CounterProps extends UiProps /// 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 CounterPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of CounterPropsMixin, and check that $CounterPropsMixin is exported/imported properly. + CounterPropsMixin: $CounterPropsMixin.meta, + // If this generated mixin is undefined, it's likely because ConnectPropsMixin is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of ConnectPropsMixin, and check that $ConnectPropsMixin is exported/imported properly. + ConnectPropsMixin: $ConnectPropsMixin.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/src/demos/faulty-component.over_react.g.dart b/web/src/demos/faulty-component.over_react.g.dart index 1e0821bc5..b7a9cf75d 100644 --- a/web/src/demos/faulty-component.over_react.g.dart +++ b/web/src/demos/faulty-component.over_react.g.dart @@ -57,6 +57,12 @@ abstract class _$$FaultyProps extends UiProps /// 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 FaultyProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FaultyProps, and check that $FaultyProps is exported/imported properly. + FaultyProps: $FaultyProps.meta, + }); } // Concrete props implementation that can be backed by any [Map]. diff --git a/web/src/demos/faulty-on-mount-component.over_react.g.dart b/web/src/demos/faulty-on-mount-component.over_react.g.dart index 288e316f0..041aee1e5 100644 --- a/web/src/demos/faulty-on-mount-component.over_react.g.dart +++ b/web/src/demos/faulty-on-mount-component.over_react.g.dart @@ -58,6 +58,12 @@ abstract class _$$FaultyOnMountProps extends UiProps /// 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 FaultyOnMountProps is not a valid `mixin`-based props mixin, or because it is but the generated mixin was not imported. Check the declaration of FaultyOnMountProps, and check that $FaultyOnMountProps is exported/imported properly. + FaultyOnMountProps: $FaultyOnMountProps.meta, + }); } // Concrete props implementation that can be backed by any [Map].