Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS-object-based props/state, Component2 initial impl, JsMap #161

Merged
Merged
Show file tree
Hide file tree
Changes from 36 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
bbaf170
Add JsBackedMap
greglittlefield-wf Aug 20, 2018
f4a25b9
Component2 that uses JS props directly
greglittlefield-wf Aug 22, 2018
ee4b95d
Remove unnecessary return
greglittlefield-wf Aug 22, 2018
598e911
Fix prop/state updating ordering, fix defaultProps
greglittlefield-wf Aug 22, 2018
b775866
Fix JsBackedMap remove bug/typo
greglittlefield-wf Aug 22, 2018
b476da5
Fix Dart component children not being wrapped in lists
greglittlefield-wf Aug 23, 2018
3ec45cf
Add flag to detect Dart component classes
greglittlefield-wf Aug 23, 2018
e8607c1
Get factory tests passing
greglittlefield-wf Aug 23, 2018
48ec4e0
Fix/update lifecycle tests
greglittlefield-wf Aug 23, 2018
2356435
Fix modification of children
greglittlefield-wf Aug 23, 2018
9834c84
Improve JsBackedMap default constructor perf
greglittlefield-wf Aug 23, 2018
7ed7dc1
Add polyfills for Object.assign and Reflect.deleteProperty for IE11
greglittlefield-wf Aug 24, 2018
3242470
Merge remote tracking branch 'origin/master' into js_map_perf/dart_1
greglittlefield-wf Feb 27, 2019
0ed7e5c
Redo children test changes that were discarded in the merge
greglittlefield-wf Feb 28, 2019
4965761
dartfmt
greglittlefield-wf Feb 28, 2019
5254a74
Merge remote-tracking branch 'upstream/5.0.0-wip' into js_map_perf/da…
greglittlefield-wf Feb 28, 2019
6a6064a
Use object-assign package
greglittlefield-wf Feb 28, 2019
2081498
Move polyfills to top
greglittlefield-wf Mar 1, 2019
7eadd80
Merge branch '5.0.0-wip' into js_map_perf/dart_1
greglittlefield-wf Mar 1, 2019
47cfa9c
Optimize props map copying on DOM components
greglittlefield-wf Mar 1, 2019
504d538
Add JsBackMap value tests
greglittlefield-wf Mar 1, 2019
549009e
Add operator== and hashCode to JsBackedMap
greglittlefield-wf Mar 2, 2019
af27724
Cleanup
greglittlefield-wf Mar 2, 2019
6c18bf6
dartfmt
greglittlefield-wf Mar 4, 2019
e433546
Fix bindings after a bad merge with 5.0.0-wip
greglittlefield-wf Mar 4, 2019
7f2b9be
Regenerate JS
greglittlefield-wf Mar 4, 2019
76b76fb
Run lifecycle tests on Component and Component2
greglittlefield-wf Mar 4, 2019
936a40c
dartfmt
greglittlefield-wf Mar 4, 2019
5f9d6dd
Revert conversion of examples to Component2
greglittlefield-wf Mar 4, 2019
55879fd
Misc cleanup
greglittlefield-wf Mar 4, 2019
86419ca
Clean up Component/Component2 delineation
greglittlefield-wf Mar 4, 2019
a7cd2b6
Fix dependency_validator infractions
greglittlefield-wf Mar 4, 2019
ee377ec
Bump SDK constraint to Dart-2-only, remove Dart 1 build from CI
greglittlefield-wf Mar 4, 2019
ae33bee
Extend Component2
aaronlademann-wf Mar 5, 2019
68933d5
Update deprecation annotations / comments
aaronlademann-wf Mar 5, 2019
e3fb375
Merge pull request #2 from aaronlademann-wf/js_map_perf/dart_2_adl-re…
greglittlefield-wf Mar 5, 2019
ee873c1
Address CR feedback, misc typing cleanup
greglittlefield-wf Mar 6, 2019
5f2005b
Implement displayName via runtimeType only in DDC, cleanup
greglittlefield-wf Mar 6, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,3 @@ jobs:
- pub run dependency_validator -i build_runner,build_test,build_web_compilers
- pub run test -p chrome
- pub run build_runner test -- -p chrome
- stage: Dart 1
dart: 1.24.3
script:
- dartanalyzer .
- pub run test -p chrome
43 changes: 43 additions & 0 deletions js_src/_dart_helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,48 @@ function _createReactDartComponentClass(dartInteropStatics, componentStatics, js
return ReactDartComponent;
}

function _createReactDartComponentClass2(dartInteropStatics, componentStatics) {
class ReactDartComponent2 extends React.Component {
constructor(props) {
super(props);
// TODO combine these two calls into one
this.dartComponent = dartInteropStatics.initComponent(this, componentStatics);
this.state = dartInteropStatics.handleGetInitialState(this.dartComponent);
}
// FIXME remove unsafe members when implementing new React 16 lifecycle methods
UNSAFE_componentWillMount() {
dartInteropStatics.handleComponentWillMount(this.dartComponent, this);
}
componentDidMount() {
dartInteropStatics.handleComponentDidMount(this.dartComponent);
}
// FIXME remove unsafe members when implementing new React 16 lifecycle methods
UNSAFE_componentWillReceiveProps(nextProps) {
dartInteropStatics.handleComponentWillReceiveProps(this.dartComponent, nextProps);
}
shouldComponentUpdate(nextProps, nextState) {
return dartInteropStatics.handleShouldComponentUpdate(this.dartComponent, nextProps, nextState);
}
// FIXME remove unsafe members when implementing new React 16 lifecycle methods
UNSAFE_componentWillUpdate(nextProps, nextState) {
dartInteropStatics.handleComponentWillUpdate(this.dartComponent, nextProps, nextState);
}
componentDidUpdate(prevProps, prevState) {
dartInteropStatics.handleComponentDidUpdate(this.dartComponent, this, prevProps, prevState);
}
componentWillUnmount() {
dartInteropStatics.handleComponentWillUnmount(this.dartComponent);
}
render() {
var result = dartInteropStatics.handleRender(this.dartComponent);
if (typeof result === 'undefined') result = null;
return result;
}
}

return ReactDartComponent2;
}

function _markChildValidated(child) {
const store = child._store;
if (store) store.validated = true;
Expand All @@ -86,5 +128,6 @@ module.exports = {
_getProperty,
_setProperty,
_createReactDartComponentClass,
_createReactDartComponentClass2,
_markChildValidated,
};
11 changes: 11 additions & 0 deletions js_src/polyfill/delete_property.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Reflect.deleteProperty polyfill for IE11
if (typeof Reflect === 'undefined') {
Reflect = {};
}
if (typeof Reflect.deleteProperty !== 'function') {
Object.defineProperty(Reflect, 'deleteProperty', {
value: function deleteProperty(target, propertyKey) {
return (delete target[propertyKey]);
}
});
}
5 changes: 5 additions & 0 deletions js_src/polyfill/object_assign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const objectAssign = require('object-assign');

if (!Object.assign) {
Object.assign = objectAssign
}
3 changes: 3 additions & 0 deletions js_src/react.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
require('./polyfill/delete_property');
require('./polyfill/object_assign');

const React = require('react');
const PropTypes = require('prop-types');
const DartHelpers = require('./_dart_helpers');
Expand Down
Loading