Compare commits

..

464 Commits
leg ... 15.3.2

Author SHA1 Message Date
aleclarson
7dfd3948a9 Add 'node-haste' roots 2017-03-16 21:58:43 -04:00
aleclarson
b3ebab438b Add 'build.sh' script for easier rebuilds 2017-03-16 21:58:43 -04:00
aleclarson
0070ad353a Implement multi-gesture support
`ResponderCache`
- Track active responders
- Provide `findAncestor` for getting active ancestor

`GestureCache`
- Group touches by their current target
- Active responders automatically capture touches inside descendants
- Each gesture has:
  - `target: Number`
  - `touchMap: {Number: Touch}`
  - `changedTouches: [Touch]`
  - `touchHistory: TouchHistory`
- Call `touchesChanged(...)` for every touch event
- Call `targetChanged(...)` for every grant/release event

`ResponderEventPlugin`
- Remove `responderInst` local variable in favor of `ResponderCache`
- Replace `changeResponder(...)` with `ResponderCache` methods
- Add `extractTouchEvents(...)` and call it for each changed gesture
- Remove `noResponderTouches(...)` in favor of gesture-specific `TouchHistory`
- Ignore native events without a `touches` array
- Increment/decrement `trackedTouchCount` by the number of `changedTouches`
- Add injectable `GlobalTouchHandler` to receive 'touchEnd' events

`TouchHistory`
- Previously known as the `ResponderTouchHistoryStore`
- No longer a singleton, because each gesture needs its own

`ReactNativeEventEmitter`
- Batch touch events since we handle all `changedTouches` at once

`ReactNativeGlobalResponderHandler`
- Support multiple JS responders
2017-03-16 21:58:43 -04:00
aleclarson
39ce13e9b3 [babel-plugin] Avoid circular dependency of 'object-assign' on itself
The 'transform-object-assign-require.js' plugin replaces usage of Object.assign with require('object-assign').
But it needs to make sure the current file is not 'object-assign' itself. Otherwise a circular dependency will be introduced.
2017-03-16 21:58:42 -04:00
aleclarson
6ed8e9d788 Revert "Compile to 'lib' instead of 'build/modules'"
This reverts commit 9eb86c14b4.
2017-03-16 21:58:42 -04:00
aleclarson
9eb86c14b4 Compile to 'lib' instead of 'build/modules' 2016-09-19 21:44:51 -07:00
aleclarson
c7a4196413 Ignore 'docs' directory 2016-09-19 21:23:38 -07:00
aleclarson
4decc08e53 Revert test changes made in bb11639 2016-09-19 21:23:14 -07:00
aleclarsoniv
76a30ace67 [ResponderEventPlugin] Always dispatch 'responderTerminate' before 'responderGrant'
Since the 'grantEvent' is passed to 'executeDirectDispatch', it's currently handled before the 'terminateEvent'.
It makes more sense for the previous responder to handle its terminate event before the next responder handles its grant event.
2016-09-19 21:23:06 -07:00
Paul O’Shannessy
bdf263625d 15.3.2 2016-09-19 10:35:00 -07:00
Paul O’Shannessy
8c7bbbfc21 Update Changelog & Readme for 15.3.2 2016-09-19 10:33:58 -07:00
Paul O’Shannessy
15631e02a2 Merge branch '15-dev' into 15-stable 2016-09-19 10:22:31 -07:00
Paul O’Shannessy
1907f72934 15.3.2-rc.1 2016-09-15 16:40:56 -07:00
Stephen John Sorensen
ba62748217 remove plain object warning (#7724)
(cherry picked from commit b2297ae6c3)
2016-09-15 16:32:45 -07:00
tokikuch
224ace32be BeforeInput is fired with a wrong text at a wrong time on IE (#7107)
(cherry picked from commit a64ca9b697)
2016-09-15 16:32:45 -07:00
Brandon Dail
3ef748abb3 Use compositeType in warning invariant for refs (#7658)
(cherry picked from commit 06ea71d3fd)
2016-09-15 16:32:45 -07:00
Paul O’Shannessy
3f8b8d754c Add more specific link to react-addons-shallow-compare readme (#7608)
(cherry picked from commit 2e38fcf355)
2016-09-15 16:32:45 -07:00
Paul O’Shannessy
7a18e4e00b Copy all SVG child nodes when using setting innerHTML in IE (#7618)
(cherry picked from commit c73d8633c3)
2016-09-15 16:32:45 -07:00
Mateusz Burzyński
60ed71459c Guarded ensureScrollValueMonitoring against some malicious script on the Internet overriding native document.createEvent (fixes #6887) (#7621)
(cherry picked from commit 51476de913)
2016-09-15 16:32:45 -07:00
Ben Alpert
7b39bbaa91 Improve error boundaries tests (#7569)
(cherry picked from commit 7d7defe30f)
2016-09-15 16:32:45 -07:00
Miller Medeiros
2927c4ce76 Add checkpoint/rollback to ReactNativeReconcileTransaction (#7619)
(cherry picked from commit 51f04fdbc1)
2016-09-15 16:32:45 -07:00
Kevin Lin
3e47b3002b Add 'as' keyword (#7543) (#7582)
* Add 'as' keyword (#7543)

* fix commenting to adhere to styling

* fix grammar in comment

(cherry picked from commit c85f46320e)
2016-09-15 16:32:45 -07:00
Marcin Mazurek
1bac6d567f Warn if input changes controlledness - also for null (#7544) (#7603)
(cherry picked from commit ba84b5b0a7)
2016-09-15 16:32:45 -07:00
TedPowers
92cfbf16c2 Changed to !document.documentMode (#7594)
(cherry picked from commit 8397ef58db)
2016-09-15 16:32:45 -07:00
Miller Medeiros
b445b26164 Support error boundaries on ReactTestRenderer (#7558)
(cherry picked from commit 38f74bcaf4)
2016-09-15 16:32:45 -07:00
Dan Abramov
832c503c92 Ensure lifecycle timers are stopped on errors (#7548)
* Ensure lifecycle timers are stopped on errors

Fixes #7349

* Address review feedback and add an extra test

(cherry picked from commit a229cdba7f)
2016-09-15 16:32:45 -07:00
Paul Kehrer
076d7fd63a Add playsInline as an allowed HTML property (#7519)
The WHATWG has unprefixed `-webkit-playsinline` as `playsinline` (see: https://github.com/whatwg/html/pull/1444) and iOS 10 intends to use it (https://webkit.org/blog/6784/new-video-policies-for-ios/).
(cherry picked from commit 7b11aa9450)
2016-09-15 16:32:45 -07:00
Lucas
3ed71070a3 Add missing KeyUp eventType (#7533)
Fixes #7222.
(cherry picked from commit 869cb05b76)
2016-09-15 16:32:45 -07:00
Greg Palmer
08dbefedc7 Avoid "Member not found" error in IE (#7411)
Explanation, discussion, and similar change as #7343

Addresses #7320
(cherry picked from commit a8741963dc)
2016-09-15 16:32:45 -07:00
Ben Alpert
4be377650e Improve validateDOMNesting message for whitespace (#7515)
For #5071.
(cherry picked from commit 6a65960641)
2016-09-15 16:32:45 -07:00
Paul O’Shannessy
8898803b4a Merge remote-tracking branch 'upstream/15-stable' into 15-dev 2016-09-15 16:31:58 -07:00
Kite
21f71d72f0 Fix the HTML for package management (#7656)
(cherry picked from commit ed8a753346)
2016-09-06 15:35:57 -07:00
却痕
d79061e0c6 docs:translate doc 11-advanced-performance to chinese (#7584)
(cherry picked from commit 4c365ea957)
2016-09-06 15:35:57 -07:00
Michael Jackson
d951c560e4 s/npmcdn/unpkg/g (#7609)
npmcdn.com is moving to unpkg.com. Same backend, one less letter in the
domain name. Boom.
(cherry picked from commit 9fd42264fe)
2016-09-06 15:35:57 -07:00
Duke Pham
6cf782b75c Add line breaks to examples on 10.1-animation docs per (#7606)
comments to issue #7317.
Updated JP doc examples to match other languages
Reformat to match JSX multi-line style #7550
(cherry picked from commit 3071f31d04)
2016-09-06 15:35:57 -07:00
Robert Kielty
dca0f7315c Adds minor additions clarifying questions I had reading intro tutorial (#7595)
(cherry picked from commit ee199381de)
2016-09-06 15:35:57 -07:00
Nik Nyby
0983d2dbcf docs: re-position comments to account for code sample width (#7602)
(cherry picked from commit 9511b4fe29)
2016-09-06 15:35:57 -07:00
Christophe Hurpeau
d90cbec236 doc: npm ls react is a better advice (#7513)
Refs Must Have Owner Warning
`npm ls react` is a better advice than `npm ls | grep react`
(cherry picked from commit 517a0dc051)
2016-09-06 15:35:57 -07:00
NestorTejero
6e20d410bb add explicit link to http://bower.io/ (#7546)
(cherry picked from commit 32e60fecdc)
2016-09-06 15:35:56 -07:00
Dan Abramov
b4f6460bff Link to Create React App (#7654)
* Link to Create React App

* Reword
2016-09-03 18:14:00 +01:00
Paul O’Shannessy
199056cf1b Update website for 15.3.1 2016-08-19 11:46:11 -07:00
Paul O’Shannessy
681c68c62a 15.3.1 2016-08-19 11:42:05 -07:00
Paul O’Shannessy
cc41ec258f Update readme for 15.3.1 2016-08-19 11:41:29 -07:00
Paul O’Shannessy
3c0906ca24 Update changelog for 15.3.1 2016-08-19 11:40:07 -07:00
Paul O’Shannessy
60a3655469 Merge branch '15-dev' into 15-stable 2016-08-19 11:39:36 -07:00
Paul O’Shannessy
15df676d2e Update deps and re-shrinkwrap 2016-08-19 11:24:43 -07:00
Paul O’Shannessy
e5276bbbe7 regenerate error codes 2016-08-19 10:49:42 -07:00
Paul O’Shannessy
12ab5baff4 Upgrade to fbjs v0.8.4 (#7532)
(cherry picked from commit 944be18357)
2016-08-19 10:46:22 -07:00
Alexandre Kirszenberg
f120c1b78e Fix ReactTestInstance::toJSON() with empty top-level components (#7523)
(cherry picked from commit 9f5b009f05)
2016-08-19 10:45:06 -07:00
ventuno
421bb8c53a Warn if using React.unmountComponentAtNode on a different React instance's tree. (#7456)
* Warn when using React.unmountComponentAtNode on a different React instance's tree

https://github.com/facebook/react/issues/3787

* Adding tests.

* Implementing recommended changes.

https://github.com/facebook/react/issues/3787

(cherry picked from commit a9e681a828)
2016-08-19 10:45:06 -07:00
Ben Alpert
9fea8ec6c8 Update onlyChild invariant message (#7514)
(cherry picked from commit 921d8c151b)
2016-08-19 10:45:06 -07:00
Dan Abramov
536f826b56 Fix slow performance of PropTypes.oneOfType() on misses (#7510)
It used to be slow whenever a type miss occurred because expensive `Error` objects were being created. For example, with `oneOfType([number, data])`, passing a date would create an `Error` object in `number` typechecker for every item.

The savings depend on how much commonly you used `oneOfType()`, and how often it had “misses”. If you used it heavily, you might see 1.5x to 2x performance improvements in `__DEV__` after this fix.
(cherry picked from commit 680685bec4)
2016-08-19 10:44:58 -07:00
Alex Zherdev
307b4ebcc9 Fix header link generation for non-English docs (#7497)
(cherry picked from commit 11c0adcc95)
2016-08-19 10:41:20 -07:00
龙海燕
e1a9eb13b1 Update 09.2-package-management.md (#7520)
(cherry picked from commit db6f36bdce)
2016-08-19 10:41:20 -07:00
Jess Telford
51fe7e466e React.Children.toArray() changes keys (#7495)
As noted by @spicyj in #5541
(cherry picked from commit aa48c82b0d)
2016-08-19 10:41:19 -07:00
Tanase Hagi
8403a28adc Add propsTypes and defaultProps example for stateless functions (#7458)
* Add propsTypes and defaultProps example for stateless functions

* Update 05-reusable-components.md

* Update 05-reusable-components.md

(cherry picked from commit 09f0a06b8a)
2016-08-19 10:41:19 -07:00
Robert Martin
c4f8466d5d Capitalize AJAX (#7435)
(cherry picked from commit 43674d989d)
2016-08-19 10:41:19 -07:00
Robert Chang
cc5889c543 change a word in performance docs (#7442)
(cherry picked from commit 0833d89783)
2016-08-19 10:41:19 -07:00
Paul O’Shannessy
9e88467485 15.3.1-rc.2 2016-08-15 15:53:40 -07:00
Troy DeMonbreun
bfb3852942 Fix for #7170 (#7486)
* Write failing test

* Ensure .min and .max are set before .value

* Adjusting test for false negative

* Revert test adjustment (apparently it was only failing locally)

(cherry picked from commit 3013afe2d5)
2016-08-15 15:51:55 -07:00
Christopher Chedeau
df4356133d Fix flow (#7499)
ReactElement requires a generic argument now and the return function of render is a ReactTestInstance and not a ReactElement.
(cherry picked from commit 9a48b5ca7b)
2016-08-15 15:51:48 -07:00
Dan Abramov
814be45aa8 Avoid indexOf() during unmounting a root in the hook (#7496)
* Avoid indexOf() during unmounting a root in the hook

* Check for (Map|Set).prototype.keys

(cherry picked from commit 48475787b4)
2016-08-15 15:20:26 -07:00
Andres Suarez
bab9227e9d Remove last use of mapObject (#7494)
(cherry picked from commit 8d1e416d9a)
2016-08-15 15:20:26 -07:00
Andres Suarez
2f1ce9169d Avoid object iteration when creating DOM factories (#7493)
(cherry picked from commit e5f9ae2705)
2016-08-15 15:20:26 -07:00
Dan Abramov
b19f202542 Use ES6 Map in ReactComponentTreeHook if available (#7491)
* Use ES6 Map in ReactComponentTreeHook if available

* Make getRootIDs fast again

* Only use native Map

(cherry picked from commit db452bd20b)
2016-08-15 15:20:26 -07:00
jaaberg
71f12283d9 Fix typo in changelog (#7468)
(cherry picked from commit fdc91e016f)
2016-08-15 15:20:25 -07:00
Dan Abramov
4c5882258c Don't define key or ref dummy props if none were provided (#7488)
* Don't define key or ref dummy props if none were provided

This fixes a performance regression.

* Style nit

(cherry picked from commit a56e105081)
2016-08-15 15:20:25 -07:00
Dan Abramov
ce24114a01 Fix ReactComponentTreeHook.getRegisteredIDs() to work with inlined content (#7490)
I broke this in #7463: parseInt() cuts off #text at the end.
Changing to just use negative numbers instead.
(cherry picked from commit a73886456e)
2016-08-15 15:20:25 -07:00
Nathan Hunzaker
8e79c9fd30 Add some semicolons for linting. (#7390)
(cherry picked from commit 8aed0cd67e)
2016-08-15 15:19:58 -07:00
Paul O’Shannessy
5372e66c0c 15.3.1-rc.1 2016-08-12 16:34:14 -07:00
Paul O’Shannessy
94dbf619d3 Regenerate error codes 2016-08-12 16:34:13 -07:00
Dan Abramov
9d7ceac1f3 Remove ReactDOMInstrumentation (#7481)
Its events are not being used anywhere.
(cherry picked from commit cba2b19b84)
2016-08-12 16:02:29 -07:00
Dan Abramov
6a992382a4 Improve DEV performance in Chrome (#7483)
* Ensure this._domID is always a number

* Ensure this._rootNodeID is always a number

(cherry picked from commit 4b734f7a02)
2016-08-12 16:02:29 -07:00
Dan Abramov
c93d0c4f30 Consolidate hook events (#7472)
* Remove onBeforeMountComponent hook event

It is unnecessary.
We now pass the element as part of onInstantiateComponent, and it can't change before mounting.

* Remove onComponentHasMounted hook event

It is unused after #7410.

* Replace on(Begin|End)ReconcilerTimer hook events

We already have onBeforeUpdateComponent.
Let's just have on(Before?)(Mount|Update|Unmount)Component and stick with them.

This removes double event dispatches in some hot spots.

* Remove onComponentHasUpdated hook

The tests still pass so presumably it was not necessary.

* Add missing __DEV__ to TestUtils code

* Replace on(InstantiateComponent|SetParent) with onBeforeMountComponent

This lets us further consolidate hooks.
The parent ID is now passed as an argument to onBeforeMountComponent() with the element.

* Remove onMountRootComponent hook event

It is unnecessary now that we pass the parent ID to onBeforeMountComponent.

* Use parentDebugID = 0 both for roots and production

This removes some awkward branching.

(cherry picked from commit 0e976e136c)
2016-08-12 16:02:29 -07:00
Dan Abramov
f2010e5532 Remove unnecessary indirection and events from the hooks (#7464)
* Remove unnecessary indirection from the tree hook

* Replace onSetDisplayName, onSetOwner, onSetText with one event

Less events is better.
onSetDisplayName, onSetOwner, and onSetText only existed because we didn't initially track elements.

* Remove unused variables

(cherry picked from commit 1f31357a2e)
2016-08-12 16:02:29 -07:00
Dan Abramov
5dce7c21e3 Fix unmounting performance regression in __DEV__ (#7463)
* Comment previous occurrences of this issue

* Fix DEV performance regression in V8

* Extract try/catch into a separate function when calling hooks

(cherry picked from commit afa27bc4d5)
2016-08-12 16:02:29 -07:00
Dan Abramov
382f1519b2 Prevent performance regression in DEV due to warning arguments (#7461)
* Prevent internal performance regression

This only affects Facebook website, not open source version of React.

On the Facebook website, we don't have a transform for warnings and invariants.
Therefore, expensive arguments will be calculated even if the warning doesn't fire.
This fixes a few cases where that calculation might be more expensive than usually.

In my testing, this brings down average row click time in Power Editor from ~300ms to ~220ms in __DEV__ (vs ~40ms in prod).

* Put warning() that shows up in profile behind condition

(cherry picked from commit 178cb7d339)
2016-08-12 16:02:29 -07:00
Keyan Zhang
38914dfe6a Fix memory leak in ReactChildrenMutationWarningHook for SSR (#7410)
* corrected ReactChildrenMutationWarningHook's name

* changed `onComponentHasMounted` to `onMountComponent`

and get element from `ReactComponentTreeHook` instead of keeping an internal store

(cherry picked from commit 5514ea369d)
2016-08-12 16:02:28 -07:00
Paul O’Shannessy
f65d629541 Remove unused createHierarchyRenderer (#7454)
(cherry picked from commit c848b65378)
2016-08-12 16:02:28 -07:00
Paul O’Shannessy
7608eda1ff Fix JSON in package.json (#7408)
(cherry picked from commit d1cff59ddc)
2016-08-12 16:02:28 -07:00
Paul O’Shannessy
21d9b85d66 Specify "files" field for npm packages (#7396)
(cherry picked from commit c5cb5b8bd8)
2016-08-12 16:02:23 -07:00
Keyan Zhang
44fa2c83d1 Fix <input> with type date/time/etc. issue on mobile browsers (#7397)
Fix <input> with type date/time/etc. issue on mobile browsers
(cherry picked from commit 8af6f9e5a2)
2016-08-12 16:00:09 -07:00
Timothy Yung
bad1080586 Change trackedTouchCount invariant into a console.error (#7400)
* Change `trackedTouchCount` invariant into a console.error

* Fix ResponderEventPlugin lint warning

(cherry picked from commit 0fb8febd0a)
2016-08-12 16:00:09 -07:00
Keyan Zhang
992e11b852 Merge pull request #7381 from keyanzhang/rename-hooks
Rename Devtool to Hook
(cherry picked from commit 328fc75bc9)
2016-08-12 16:00:09 -07:00
Nathan Hunzaker
043c249458 Avoid "Member not found exception" in IE10 (#7343)
'change' custom events raise "Member not found" in <= IE10. To
circumvent this, the SyntheticEvent class now checks for "typeof
event.cancelBubble !== 'unknown'". This eliminates this exception and
maintains the expected bubbling functionality.

Addresses #7320.
(cherry picked from commit 2823dfcbfb)
2016-08-12 16:00:08 -07:00
Ben Alpert
d551e19b18 Remove unused unmountIDFromEnvironment (#7259)
I got rid of the need for this a few months ago.
(cherry picked from commit 30aa84181d)
2016-08-12 16:00:08 -07:00
Patrick Finnigan
58720d608e fix doc for React Native mountComponent (#7313)
(cherry picked from commit 85dcbf83c5)
2016-08-12 16:00:08 -07:00
Keyan Zhang
3c7f275f4f Merge pull request #7321 from keyanzhang/codemod-es6-component
Codemod tests from createClass to ES2015 classes
(cherry picked from commit 484f96bb61)
2016-08-12 16:00:08 -07:00
Nathan Hunzaker
77d6143485 Avoid validation warning when inputs change type (#7333)
For controlled inputs, `updateWrapper` was getting called before the
`type` prop had a chance to update. This could lead to a case where
switching from the `text` to `number` type caused a validation error
that would prevent the proper input value from being assigned.

This commit moves the call to `ReactDOMInput.updateWrapper` below
`_updateProperties` to avoid this situation.
(cherry picked from commit 08a0895887)
2016-08-12 16:00:08 -07:00
Keyan Zhang
d0fc12db61 Add babel-plugin-transform-class-properties (#7322)
* added babel-plugin-transform-class-properties

* removed babel-plugin- prefix

(cherry picked from commit fc04e853f8)
2016-08-12 16:00:08 -07:00
Paul O’Shannessy
ae17ce5b03 Merge branch '15-stable' into 15-dev 2016-08-12 15:18:19 -07:00
Joseph Savona
8794c51389 Fix link formatting on Relay blog post (#7434)
(cherry picked from commit ba2230df29)
2016-08-05 14:54:53 -07:00
Joseph Savona
8a1c16bf09 Relay blog post (#7433)
(cherry picked from commit aca62e7d24)
2016-08-05 10:55:47 -07:00
Paul O’Shannessy
1f65b2901b [docs] Use appropriately sized og:image (#7417)
Also runs through Imageoptim for smaller size.
(cherry picked from commit b910a1478d)
2016-08-05 10:55:47 -07:00
Paul O’Shannessy
9be069fb98 [docs] Use npmcdn (#7394)
(cherry picked from commit 1bb257de93)
2016-08-02 13:51:46 -07:00
Paul O’Shannessy
b194f66fbc [docs] add permalink for newly translated page (#7380)
(cherry picked from commit 57ae3b389d)
2016-07-29 16:27:02 -07:00
Bruce Harris
1d4e8c958d Update tutorial with reference to autobinding docs (#6870)
* Update tutorial with reference to autobinding docs

* Update tutorial to clarify that autobinding happens specifically with createClass() API

(cherry picked from commit f329099831)
2016-07-29 16:22:49 -07:00
Paul O’Shannessy
b071f10dd7 [docs] Add permalink to PropTypes warning page (#7377)
Followup to #7219, which was created before the Jekyll 3 upgrade, which needs the permalink field.
(cherry picked from commit 25aa5e36c9)
2016-07-29 12:15:08 -07:00
Dan Abramov
44f63165cb Add “Don't Call PropTypes” warning (#7219)
(cherry picked from commit 8329856a3f)
2016-07-29 12:15:08 -07:00
Paul O’Shannessy
cc01d1be33 Update website for 15.3.0 2016-07-29 11:36:35 -07:00
Paul O’Shannessy
66cee497e7 15.3.0 2016-07-29 11:26:23 -07:00
Paul O’Shannessy
7251f6a6e9 Update readme for 15.3.0 2016-07-29 11:25:55 -07:00
Paul O’Shannessy
f7837682b4 Changelog for 15.3.0 2016-07-29 11:25:39 -07:00
Paul O’Shannessy
41f21520d1 Merge branch '15-dev' into 15-stable 2016-07-29 11:14:25 -07:00
Paul O’Shannessy
e5efe5f568 Update version of react-test-renderer 2016-07-28 22:35:19 -07:00
Dustan Kasten
396ab3eba1 ReactTestRenderer package (#7362)
(cherry picked from commit 7e874f59f5)
2016-07-28 21:42:42 -07:00
Keyan Zhang
01ad9af590 fixed incorrect doc location (#7365)
(cherry picked from commit c9dc2ab0ec)
2016-07-28 11:41:22 -07:00
Jackson Huang
5d2f6c07c3 Create 02-displaying-data.zh-TW.md (#7284)
* Create 02-displaying-data.zh-TW.md

* Update 02-displaying-data.zh-TW.md

(cherry picked from commit fe5128fe8f)
2016-07-28 11:41:22 -07:00
Gert Hengeveld
6cab7064a0 Added ReactNL conference (#7342)
(cherry picked from commit 9d33fb0b76)
2016-07-28 11:41:21 -07:00
Amjad Masad
6f80ed8615 "transient dependencies" -> "transitive dependencies" (#7341)
I think that's what you meant -- although with npm dependencies are kind of transient :P
(cherry picked from commit d157827311)
2016-07-28 11:41:21 -07:00
scloudyy
88d49edda5 Update docs zh cn (#7254)
* update 03-interactivity-and-dynamic-uis.zh-CN

* update 04-multiple-components.zh-CN

* update 05-reusable-components.zh-CN

* updat 06-transferring-props.zh-CN

* update 07-forms.zh-CN

* update 08-working-with-the-browser.zh-CN

* update 08 and 08.1

* update 09-tooling-integration.zh-CN

* revise

* don't use ES6

(cherry picked from commit 5b06667efd)
2016-07-28 11:41:21 -07:00
Veljko Tornjanski
5f705664fa Wording change in doc (#7348)
(cherry picked from commit 0805921883)
2016-07-28 11:41:21 -07:00
Seyi
6fba1f1fad Blog post: Fixed typo in post (#7336)
(cherry picked from commit 1fc5f284c0)
2016-07-22 13:23:17 -07:00
Paul O’Shannessy
127af0ffc7 Host our own images for the blog, use https links (#7339)
(cherry picked from commit 7614c12ed7)
2016-07-22 13:23:17 -07:00
Steven Syrek
86f72d0830 Correct grammatical error (subject-verb agreement) (#7338)
"It is worth repeating: there is no configuration files or complicated folder structures." > "It is worth repeating: there are no configuration files or complicated folder structures."
(cherry picked from commit c0b7d81872)
2016-07-22 13:23:17 -07:00
Dan Abramov
9423829db2 Add blog post 2016-07-22 16:59:02 +01:00
Paul O’Shannessy
f8a698e9af 15.3.0-rc.3 2016-07-21 14:36:01 -07:00
Keyan Zhang
807244badd improved warning in ReactUpdateQueue (#7326)
(cherry picked from commit 3fd582643e)
2016-07-21 14:34:16 -07:00
Alex Zherdev
2106bf5085 Mention actual prop type in element type checker (#7319)
(cherry picked from commit 8bcea5310e)
2016-07-21 14:34:16 -07:00
Sassan Haradji
2debcef8f6 prevent spamming warnings related to performance measurement code (#7299)
* prevent spamming warnings related to performance measurement code

* minor changes in names and such

* -

* -

(cherry picked from commit 1cc9a5dc71)
2016-07-21 14:34:16 -07:00
Dan Abramov
7cdcb4f696 Eagerly evaluate inline requires in Jest (#7245)
* Eagerly evaluate inline requires in Jest

I inlined some requires in #7188 to fix the build size regression.
However this caused an issue with Jest due to it resetting module registry between tests.

This is a temporary fix to #7240.
It should be reverted as part of #7178.

* Make the hack work in all environments

(cherry picked from commit 15ae5857f6)
2016-07-21 14:34:15 -07:00
Dan Abramov
8f8e215df1 Fix TestUtils crash with NODE_ENV=production (#7246)
I caused it with #7189.
We generally don’t recommend running TestUtils in production environment but this is technically a regression.

Fixes #7231.
(cherry picked from commit 27d7592cf6)
2016-07-21 14:34:15 -07:00
Paul O’Shannessy
0c56ee7a89 Switch Travis CI to Trusty Beta (#7309)
(cherry picked from commit 5ac1bae58e)
2016-07-20 11:48:19 -07:00
Paul O’Shannessy
dfebed11c2 Merge pull request #7308 from zpao/jekyll3
Upgrade to Jekyll 3
(cherry picked from commit 5e3959e071)
2016-07-19 16:36:23 -07:00
Paul O’Shannessy
0394bae0e3 [docs] Follow up to 6972 - update docs code (#7278)
(cherry picked from commit 0bfaf5156d)
2016-07-19 16:36:23 -07:00
segmentationfaulter
1e4828d9fc Update 03-interactivity-and-dynamic-uis.md (#6972)
(cherry picked from commit bf0572dde7)
2016-07-19 16:36:23 -07:00
Dan Abramov
108f25350d Clarify the section about dogfooding (#7292) 2016-07-16 15:03:00 +01:00
Dan Abramov
f40b5b5c47 Minor tweaks to Design Principles (#7283) 2016-07-14 21:30:13 +01:00
Dan Abramov
b38bbde2fe Add Design Principles to the docs (#7282) 2016-07-14 20:39:41 +01:00
Fernando Alex Helwanger
939071d737 Add mixins property to context example (#7277) 2016-07-14 14:25:44 +01:00
Paul O’Shannessy
42d7d0adad 15.3.0-rc.2 2016-07-13 14:03:52 -07:00
Troy DeMonbreun
14e6a69a46 Fix #7099 (#7251)
* Set step prop before value prop

* Embed comments on .step sequence behavior

(cherry picked from commit fc04310792)
2016-07-13 13:54:23 -07:00
Mert Kahyaoğlu
b1e1ccf632 Renaming: ReactDOM (#7265)
Rename React with ReactDOM
(cherry picked from commit 2da50a0f18)
2016-07-13 13:54:23 -07:00
Brandon Dail
7b78757c6f Add referrerPolicy to HTMLDOMPropertyConfig (#7274)
(cherry picked from commit cccef3c683)
2016-07-13 13:54:23 -07:00
Brandon Dail
7d3cf9565e Inject default batching after pending transactions (#7033)
(cherry picked from commit b6e1eb2718)
2016-07-13 13:54:22 -07:00
Paul O’Shannessy
86cc1d4e67 15.3.0-rc.1 2016-07-13 11:57:28 -07:00
Paul O’Shannessy
80d09bfbb3 Regenerate error codes 2016-07-13 11:50:57 -07:00
Keyan Zhang
615ae2f497 warn for using maps as children with owner info (#7260)
(cherry picked from commit 5103e1d6a1)
2016-07-13 11:44:10 -07:00
Ben Alpert
1c3b4af564 Test renderer improvements (#7258)
Adds `.update(newElement)` and `.unmount()` and makes children reorders and composite type swapping work.

Part of #7148.
(cherry picked from commit caec8d5ce7)
2016-07-13 11:44:10 -07:00
Ben Alpert
40cc8fa45f Update benchmarks to be more realistic polymorphically (#7255)
Previously, the extract-components script would create the same number of layers of composites as the page it captures, but it would output a new class for each time any composite is used (since we don't want to replicate all the component logic).

I changed the script to output a single type for each type in the input -- and each generated component takes an index for which output it should return. This should be closer to how the original code behaves, especially with respect to VM function call lookups where the amount of polymorphism makes a difference.

I re-recorded the benchmarks with the new scripts. They run significantly faster:

```
Comparing old.txt (control) vs new.txt (test)
Significant differences marked by ***
% change from control to test, with 99% CIs:

* ssr_pe_cold_ms_jsc_jit
    % change: -41.73% [-43.37%, -40.09%]  ***
    means: 39.3191 (control), 22.9127 (test)
* ssr_pe_cold_ms_jsc_nojit
    % change: -44.24% [-46.69%, -41.80%]  ***
    means: 45.8646 (control), 25.5764 (test)
* ssr_pe_cold_ms_node
    % change: -45.61% [-47.38%, -43.85%]  ***
    means: 90.1118 (control), 49.0116 (test)
```

This is probably in part due to the changes here, but also the page I captured has changed somewhat in the meantime and there seem to be slightly fewer components in the hierarchy, so they're not really comparable. But going forward we can use this benchmark which should be more accurate. I also included an identical copy that uses stateless functional components so we can test optimizations to those later.
(cherry picked from commit e5513eceff)
2016-07-13 11:44:09 -07:00
Kent C. Dodds
ea61ddb0d0 Add link to video chat with @spicyj (#7252)
(cherry picked from commit 12bc80a6dc)
2016-07-13 11:44:09 -07:00
Usman
9f975293e1 Fixed all eslint warnings (#7230)
(cherry picked from commit c52a2b9ab0)
2016-07-13 11:44:09 -07:00
Samy Al Zahrani
d40393fde7 Add xmlns and xmlns:xlink attributes (#6471)
(cherry picked from commit 9a80d42817)
2016-07-13 11:44:09 -07:00
Dan Abramov
8517e99816 Fix unmounting performance regression in V8 (#7232)
As reported in #7227, unmounting performance regressed with React 15.
It seems that `delete` has become much slower since we started using numeric keys.
Forcing dictionary keys to start with a dot fixes the issue.
(cherry picked from commit 64e7602b3b)
2016-07-13 11:44:09 -07:00
Ben Alpert
cf07f0cab1 Add React.PureComponent (#7195)
This provides an easy way to indicate that components should only rerender when given new props, like PureRenderMixin. If you rely on mutation in your React components, you can continue to use `React.Component`.

Inheriting from `React.PureComponent` indicates to React that your component doesn't need to rerender when the props are unchanged. We'll compare the old and new props before each render and short-circuit if they're unchanged. It's like an automatic shouldComponentUpdate.
(cherry picked from commit c8fbdac227)
2016-07-13 11:44:09 -07:00
yiminghe
ddb58dd9f3 consistent owner for stateless component (#6534)
(cherry picked from commit b11540ccb2)
2016-07-13 11:43:37 -07:00
Brandon Dail
7d9ded56a2 Use hardcoded value for PropType secret (#7194)
Rename secret!
(cherry picked from commit 2c93a41580)
2016-07-13 11:39:40 -07:00
Brandon Dail
e75e8dcbeb Warn if PropType function is called manually (#7132)
* Warn if PropType function is called in production

* Check if console is undefined before warning

* Randomize value of ReactPropTypesSecret

* Remove dev environment tests

* Rename typeCheckPass to productionWarningCheck

* Rename productionWarningCheck to expectWarningInProduction

* Call toString on Math.random()

* Rename test block for React type checks

* Make sure warning isnt emitted for failing props

* Cache warning by component and prop, warn in dev

* Pass ReactPropTypesSecret to internal checks

* Move tests to ReactPropTypes-test.js

* Update the warning message to include link

* Do not test warning for unions  with invalid args

(cherry picked from commit 95ac239cf3)
2016-07-13 11:39:40 -07:00
Troy DeMonbreun
4a0a534357 Fix for #5468: Validate PropTypes.oneOf(Type) arguments early (#6316)
* Fix for 5468: Validate proptype definitions sooner

Added typeCheckWarn() func and updated the oneOf/oneOfType tests
Added __DEV__ warning for invalid oneOf/OneOfType args

* Suppress redundant error on warn; typeCheckWarn() removed

* Return no-op

* Using emptyFunction module for consistency

* Remove createChainableTypeChecker() call

* Adjust test to assert type check passes when warned

(cherry picked from commit 6cc037bd0d)
2016-07-13 11:39:40 -07:00
Ben Alpert
d441128bf6 Make "unexpected batch number" a warning (#7133)
This was added to catch internal errors in React but doesn't seem to be doing much good except frustrating people more when their apps throw (#6895, FB-internal t11950821). Until more proper error boundaries land, let's make this a warning.
(cherry picked from commit abcd567325)
2016-07-13 11:39:40 -07:00
Dan Abramov
891e087926 Fix tests from #6158 to use Jasmine 2 (#7126)
(cherry picked from commit a49b7a2dfb)
2016-07-13 11:39:40 -07:00
Swaroop SM
9d385ef326 Warn if the included mixin is undefined (#6158)
(cherry picked from commit 18bad0669f)
2016-07-13 11:39:40 -07:00
Evan Jacobs
3b80d4dcd7 [TestUtils] Copy type to nativeEvent in Simulate.<eventName> (#6154)
Although it is unreasonable to set every possible property for
simulated events, `type` is useful for event handlers that are shared
between types and potentially have different behaviors.
(cherry picked from commit 5a20d449f6)
2016-07-13 11:39:39 -07:00
Dan Abramov
343033bf06 Resolve refs in the order of the children (#7101)
* Resolve refs in the order of the children

React makes no guarantees about ref resolution order. Unfortunately, some of the internal Facebook component APIs (specifically, layer dialogs) currently depend on the ref resolution order. Specifically, the assumption is that if the layer dialog is placed as a last child, by the time it mounts or updates, the refs to any previously declared elements have been resolved.

With the current `ReactMultiChild`, this is *usually* the case but not always. Both initial mount and an update of all components satisfy this assumption: by the time a child mounts or updates, the previous children’s refs have been resolved. The one scenario where it isn’t true is when **a new child is mounted during an update**.

In this case, the `mountComponent()` call used to be delayed until `ReactMultiChild` processes the queue. However, this is inconsistent with how updates normally work: unlike mounting, updating and unmounting happens inside `ReactChildReconciler.updateChildren()` loop.

This PR changes the `mountComponent()` to be performed inside `ReactChildReconciler`, just like `receiveComponent()` and `unmountComponent()`, and thus ensures that `attachRef()` calls are enqueued in the order the children were processed, so by the time the next child flushes, the refs of the previous children have been resolved.

This is not ideal and will probably be broken by incremental reconciler in the future. However, since we are trying to get rid of mixins in the internal codebase, and layered components are one of the biggest blockers to that, it’s lesser evil to temporarily make ref resolution order more strict until we have time to fix up the layer APIs to not rely on it, and are able to relax it again (which would be a breaking change).

* Use array instead of object to avoid lookups

(cherry picked from commit 83cbc3e5fb)
2016-07-13 11:39:39 -07:00
Jim
b688bb301c Warn if people mutate children. (#7001)
(cherry picked from commit 49238b9440)
2016-07-13 11:39:34 -07:00
Paul O’Shannessy
9138b45e82 Merge branch '15-stable' into 15-dev 2016-07-13 11:12:26 -07:00
Zac Smith
1b7f871819 Remove uneccesary colon (#7238)
Only use a colon after a statement that is a complete sentence, like [Grammer Girl says](http://www.quickanddirtytips.com/education/grammar/colons).
(cherry picked from commit 473097144c)
2016-07-13 11:11:06 -07:00
Varayut Lerdkanlayanawat
52e45997db Reformat event names in Media Events section (#7250)
(cherry picked from commit 45223dc8bf)
2016-07-13 11:11:05 -07:00
Dan Abramov
45547d1c3b Fix typos in “Mixins Considered Harmful” (#7275)
* Fix typos in “Mixins Considered Harmful”

* Use consistent code style
2016-07-13 18:47:19 +01:00
Dan Abramov
0f520b8cc0 Add a new blog post about mixins 2016-07-13 17:42:01 +01:00
Paul O’Shannessy
5478d76271 Merge pull request #7229 from zpao/blog-post-errorcodes
Blog post for error codes
(cherry picked from commit 92492e08b2)
2016-07-11 17:42:17 -07:00
Paul O’Shannessy
57a1ebb809 Fix typo in previous changelog update 2016-07-08 15:53:40 -07:00
Paul O’Shannessy
dfb5cc306f Changelog fixes 2016-07-08 15:50:04 -07:00
Paul O’Shannessy
ea880f2e2c Update website for 15.2.1 2016-07-08 15:27:35 -07:00
Paul O’Shannessy
68faf9d1b9 15.2.1 2016-07-08 15:15:02 -07:00
Paul O’Shannessy
5597ca70be Update readme for 15.2.1 2016-07-08 15:12:35 -07:00
Paul O’Shannessy
4b9d48a150 Merge branch '15-dev' into 15-stable 2016-07-08 15:11:36 -07:00
Paul O’Shannessy
6b19617333 changelog for 15.2.1 2016-07-08 15:09:28 -07:00
Keyan Zhang
86d696d933 Fixed PR link
(cherry picked from commit 48ccab788b)
2016-07-08 12:01:13 -07:00
Dan Abramov
e685ca9126 Mention @Aweary’s #6933 in 15.2.0 changelog
(cherry picked from commit 4aa860e1bb)
2016-07-08 12:01:08 -07:00
Dan Abramov
abaa9a8760 Add link to @troydemonbreun’s contribution
We missed this PR in the changelog
(cherry picked from commit 36734f4d37)
2016-07-08 12:01:01 -07:00
Paul O’Shannessy
ebabd2f8cd Rebuild error codes 2016-07-08 11:49:51 -07:00
Paul O’Shannessy
c51e8a1523 re-shrinkwrap 2016-07-08 11:46:00 -07:00
Dan Abramov
9fb898943a Make ReactPerf.start() work during reconciliation (#7208)
* Add failing test demonstrating a ReactPerf warning

* Make the failing ReactPerf test more precise

* Make ReactPerf.start() work during reconciliation

* Reorder lifecycle methods for greater clarity

* Fix memory leak

* Error boundaries should not break ReactPerf

* Put onBeginFlush/onEndFlush into transaction wrappers

This looks cleaner even though it is not strictly necessary.
We still call them manually for unmounting because it doesn't have a transaction.

(cherry picked from commit 1a0e3a3215)
2016-07-08 11:01:15 -07:00
saiyagg
ccd781d97e Remove duplicate line (#7210)
(cherry picked from commit 21ce27161d)
2016-07-08 10:58:37 -07:00
Andrey Okonetchnikov
9db68fcf5d Do not render name attribute on INPUT if it is not supplied. Closes #7198. (#7199)
(cherry picked from commit 0d892c03da)
2016-07-08 10:58:37 -07:00
Paul O’Shannessy
219e838070 Don't detach value from defaultValue for submit/reset inputs (#7197)
(cherry picked from commit 5c737b9550)
2016-07-08 10:58:37 -07:00
Dan Abramov
720ce5aa70 Pass shouldHaveDebugID flag to instantiateComponent (#7193)
* Add failing tests for #7187 and #7190

* Pass shouldHaveDebugID flag to instantiateComponent

This allows us to remove a hack that was added in #6770 and caused #7187 and #7190.

* Move logic for choosing whether to use debugID outside instantiate

(cherry picked from commit d2ff462b79)
2016-07-08 10:58:36 -07:00
Sebastian Markbåge
a0a8f2a451 Move error boundaries test into reconciler (#7166)
The src/core folder moved while this PR was pending so this file
didn't move with it.

Let's get rid of this annoying top level folder.
(cherry picked from commit 4f7a38c3b7)
2016-07-08 10:56:29 -07:00
Marshall Bowers
67cc922747 Gulp: lint, flow, and version-check (#7174)
* Add plugin loading for gulp

* Convert `lint` task to gulp

* Convert `flow` task to gulp

* Convert `version-check` task to gulp

* Add missing semicolons

(cherry picked from commit 69703e04d5)
2016-07-08 10:56:29 -07:00
Timothy Yung
75e6399261 Revise ResponderTouchHistoryStore Error Handling (#7143)
Touch behavior is inconsistent across different platforms, and ResponderTouchHistoryStore currently fatals when assumptions are broken. In addition, the behavior differs between development and production.

This pull request does a few things to make ResponderTouchHistoryStore easier to deal with:

Adds Flow to keep the TouchEvent, Touch, and TouchRecord types straight.
Changes behavior to be consistent across environments. This means either always throwing or never throwing (and making use of warning and console.error as appropriate).
When an orphaned move or end event is received, print debug information and ignore it instead of crashing and burning.
(cherry picked from commit 2b226f5fa6)
2016-07-08 10:56:29 -07:00
Dan Abramov
25528eacbc Disable DebugTools in production (#7189)
(cherry picked from commit 5d31ebcf5f)
2016-07-08 10:56:23 -07:00
Christopher Chedeau
f6b619aab1 [flow] isTextInputElement (#7075)
Summary:

I had to cast into any because flow doesn't think that checking the lowercase version of nodeName is a valid way to refine the variable from HTMLElement to HTMLInputElement. I'm also not confident enough in changing the implementation to an instanceof HTMLInputElement to please flow. It also takes care of the null check in the process.

The `nodeName &&` condition wasn't useful since the two branches are checking it against concrete values and actually makes the type different since nodeName is not a boolean per se. I replaced them with if conditions to make it clearer what it actually did instead of doing boolean logic tricks.

It is unclear why I had to type supportedInputTypes, see this internal post for a discussion: https://www.facebook.com/groups/flowtype/permalink/1084168611631753/

The only difference in behavior is that I now explicitely convert to boolean the object dereference via `!!`.

Test Plan:
npm run flow
Careful inspection of the code

Reviewers: @zpao @spicyj
(cherry picked from commit 309215fc40)
2016-07-08 10:48:57 -07:00
Dan Abramov
7547d0d8e5 Inline dev-only requires (#7188)
* Inline dev-only requires

This reduces the production bundled build size.

* Use new references after resetting module registry in tests

This fixes the tests which were broken due to inlining some requires.

(cherry picked from commit 8fe6b5fb46)
2016-07-08 10:48:57 -07:00
Christopher Chedeau
d7a6c95464 [flow] fix flattenChildren type (#7110)
Summary:
Make the debug attribute optional

Test Plan:
npm run flow

Reviewers: @keyanzhang @chicoxyzzy
(cherry picked from commit 07cfba17a9)
2016-07-08 10:48:57 -07:00
Dan Abramov
9687b35d83 Remove Danger.dangerouslyRenderMarkup as it is dead code (#7185)
(cherry picked from commit 7d0801e1a0)
2016-07-08 10:48:57 -07:00
Robin Ricard
173d065a9e Trigger a proper no-op warning for async state changes on server (#7127)
This commit fixes #5473: ReactDOMServer.renderToString: presence of onClick
handler causes errors on async update

This commit performs the following changes:

- Adds a getUpdateQueue method to ReactServerRenderingTransaction,
  ReactReconcileTransaction, ReactNativeReconcileTransaction and
  ReactTestReconcileTransaction
- Make the ReactCompositeComponent call this getUpdateQueue instead of using
  ReactUpdateQueue that was unwanted at certain moments on server
- On ReactServerRenderingTransaction, dispatch ReactUpdateQueue's methods
  while rendering and warning methods afterwards. This is done through the new
  ReactServerUpdateQueue class
- Added a series of tests that mimics the case presented in #5473 with setState,
  forceUpdate and replaceState
- Add flow typechecking on concerned files
(cherry picked from commit dbdddf1c82)
2016-07-08 10:48:56 -07:00
Richard Roncancio
67cbe6d471 Removed transitionAppearTimeout to remove warning (#7165)
- Removed the prop transitionAppearTimeout from
addons/transitions/ReactTransitionGroup in order to remove a warning
when passing unknown props to DOM elements.
(cherry picked from commit 6e5dd8926c)
2016-07-08 10:48:56 -07:00
Sebastian Markbåge
c625bc88aa Unshare not actually shared files (#7167)
This moves some files out of shared that are not actually shared
with isomorphic. They're specific to the renderers.
(cherry picked from commit 4bc1048e0d)
2016-07-08 10:48:56 -07:00
Sebastian Markbåge
f1f599d775 Merge pull request #7154 from sebmarkbage/sideeffects
[Fiber] Host Side Effects
(cherry picked from commit cf259a4ff8)
2016-07-08 10:48:56 -07:00
Sebastian Markbåge
c4b719d4dc Merge pull request #7034 from sebmarkbage/newreconciler
[Fiber] Host Container Fiber and Priority Levels
(cherry picked from commit 291f8e30a9)
2016-07-08 10:48:56 -07:00
starkch
e23690a0dc Reword invariant message about empty tags (fixes #7065) (#7066)
* addresses issue #7065

* fix test to use new message

* fix string in tests

* fix test string

* Update error message and tests

(cherry picked from commit f94912516f)
2016-07-08 10:48:56 -07:00
Dan Abramov
20d2398ab6 Fix renderSubtreeIntoContainer to update context (#7125)
* create failing test case

* Fix renderSubtreeIntoContainer to update context

Fixes #6599

* Also test re-rendering due to prop update

* Address review feedback

(cherry picked from commit 25f9f4563e)
2016-07-08 10:48:56 -07:00
Esteban
32cadeacdb Remove comment about PooledClass destructors being optional (#6560)
They are no longer optional since #4720
(cherry picked from commit 752e1595fc)
2016-07-08 10:48:56 -07:00
Sergey Rubanov
a3c0d68af9 [flow] add some typings to utils (#7104)
* add some typings to utils

* add typing of flattenChildren

* more accurate typings for flattenChildren

(cherry picked from commit 3b5c756c7a)
2016-07-08 10:48:56 -07:00
Christopher Chedeau
24cf5c7a5e [flow] type deprecated (#7076)
Summary:

Test Plan:
npm run flow

Reviewers: @zpao @spicyj @gabelevi
(cherry picked from commit 9342c2f02f)
2016-07-08 10:48:56 -07:00
Jim
8ea1ee14d5 Remove dead HAS_SIDE_EFFECTS logic (#6987)
(cherry picked from commit 416b5ef173)
2016-07-08 10:48:56 -07:00
Jared Fox
ec029f66cc fix webcomponent example issue #7056 (#7057)
* fix webcomponent example issue #7056

* update fix issue #7056, remove unused web component  callbacks

(cherry picked from commit cd9ad90d05)
2016-07-08 10:48:55 -07:00
Christopher Chedeau
ba6ca7ff71 [cleanup] Move ReactStateSetters inside of addons/link (#7085)
Summary:
The only callsite of ReactStateSetters is in LinkedStateMixin which lives in addons/link. Better move it there to avoid cluttering the other folder.

Test Plan:
None

Reviewers: @zpao @spicyj
(cherry picked from commit b0732ef881)
2016-07-08 10:48:55 -07:00
Christopher Chedeau
eb9f4efde7 [flow] type adler32 (#7080)
This one is trivial

Test Plan:
npm run flow

Reviewers: @zpao @spicyj
(cherry picked from commit 489caeb2d7)
2016-07-08 10:48:55 -07:00
Christopher Chedeau
8ee93720ce [flow] type KeyEscapeUtils (#7079)
Summary:

The only call site ensures that the value is not null: dc6fc8cc07/src/shared/utils/traverseAllChildren.js (L44)

key is stringified inside of createElement, so we are guaranteed to receive a string right now: dc6fc8cc07/src/isomorphic/classic/element/ReactElement.js (L142)

Test Plan:
npm run flow

Reviewers: @zpao @spicyj
(cherry picked from commit 12a6ad1ef5)
2016-07-08 10:48:55 -07:00
Christopher Chedeau
cea00b4b21 Merge pull request #7053 from vjeux/flow_accumulate
[flow] annotate accumulate, accumulateInto and forEachAccumulated
(cherry picked from commit 5b4dad31f8)
2016-07-08 10:48:55 -07:00
Paul O’Shannessy
f3c9508e95 Specify possible need for C++ compiler (#7064)
(cherry picked from commit 4886e028bf)
2016-07-08 10:48:55 -07:00
Toru Kobayashi
23de673537 Remove setProps and replaceProps from src (#7045)
(cherry picked from commit e8fa464d6f)
2016-07-08 10:48:55 -07:00
Jim
26870ad27b Move null-input-value-prop warning into devtool, add stack trace (#7040)
(cherry picked from commit 97d89fa5bf)
2016-07-08 10:48:55 -07:00
Paul O’Shannessy
54ee110436 Merge branch '15-stable' into 15-dev 2016-07-07 23:17:21 -07:00
Paul O’Shannessy
a011a23090 Import warnings that currently live in gists. (#7175)
(cherry picked from commit 26ed910f28)
2016-07-05 13:54:19 -07:00
Samuel Reed
0d4c994471 Add PropTypes.symbol to reusable components doc (#7171)
(cherry picked from commit 3946ac33b8)
2016-07-05 13:54:19 -07:00
Paul O’Shannessy
bc1d59ee19 Fix formatting of changelog 2016-07-01 11:56:41 -07:00
Paul O’Shannessy
3a6584b2ee Update website for 15.2.0 2016-07-01 11:41:46 -07:00
Paul O’Shannessy
c650249339 15.2.0 2016-07-01 11:31:05 -07:00
Paul O’Shannessy
516aa96419 Update readme for 15.2.0 2016-07-01 11:21:37 -07:00
Paul O’Shannessy
1808ecb348 Merge branch '15-dev' into 15-stable 2016-07-01 11:12:22 -07:00
Paul O’Shannessy
74c29b391a Changelog for 15.2.0 2016-07-01 11:09:46 -07:00
Paul O’Shannessy
33f54bfaa1 15.2.0-rc.2 2016-06-30 23:22:15 -07:00
Griffin Michl
5131a43f96 Group warnings for unknown DOM properties (#7153)
(cherry picked from commit 39265cb892)
2016-06-30 23:13:29 -07:00
Jim
62135da3ba Add autoFocus to list of whitelisted dom element props. (#7098)
(cherry picked from commit b4fc27357c)
2016-06-30 23:13:10 -07:00
Brandon Dail
7fbbb535ff Clarify purpose of state property in ES6 classes (#7109)
(cherry picked from commit 60760eb915)
2016-06-29 10:15:09 -07:00
Jim
bda788e932 webcomponents should use attachedCallback instead of createdCallback. (#7102)
(cherry picked from commit c7ba16fbbf)
2016-06-29 10:15:09 -07:00
Paul O’Shannessy
ec44f2af6d [docs] Update share button (#7097)
(cherry picked from commit 4f00553c15)
2016-06-29 10:15:09 -07:00
Nik Nyby
6059444c84 update babel-core to 5.8.34 in tutorial docs (#7059)
(cherry picked from commit a8d8210222)
2016-06-20 16:43:55 -07:00
Claudio Brandolino
814bf1ca0c Standardise format of the three "state" questions. (#7046)
* Standardise format of the three "state" questions.

The original format follows the template:

 > 1. x? if `x` then probably isn't state
 > 2. y? if `!y` then probably isn't state
 > 3. z? if `z` then it's not state

This caused both me and a hallway tester to do a double take.

The proposed reformulation allows the answers to follow the same template.

In the same spirit, it uses the same contraction pattern in the last answer (`it's not state`-> `it isn't state`). This has the welcome side effect to make the lack of "probably" stand out more.

* Update phrasing in thinking in reacr

(cherry picked from commit 5bca3773ab)
2016-06-20 16:43:55 -07:00
Toru Kobayashi
aaa496213e Remove setProps and replaceProps from docs (#7044)
(cherry picked from commit 718c07c915)
2016-06-20 16:43:55 -07:00
Paul O’Shannessy
c66f40f749 15.2.0-rc.1 2016-06-14 18:24:12 -07:00
Paul O’Shannessy
e921abf260 Re-shrinkwrap for latest dependency changes & updates 2016-06-14 18:20:57 -07:00
Paul O’Shannessy
d893ab6428 Merge pull request #7042 from zpao/15-dev-fixups
15 dev fixups
2016-06-14 18:20:07 -07:00
Paul O’Shannessy
dbb67824a4 Don't build fiber files into package 2016-06-14 18:16:42 -07:00
Paul O’Shannessy
592abf8ee7 Update the error codes 2016-06-14 18:16:41 -07:00
Paul O’Shannessy
2a411dd248 Revert part of createElement validation changes from #6859 2016-06-14 18:16:41 -07:00
Juan
909d647801 Update readme to latest React description (#7014)
* Update readme to latest React description

* Update readme to latest wordsmithing

(cherry picked from commit b618b786a9)
2016-06-14 15:50:39 -07:00
Christoph Pojer
243be87c6d Add symbol to identify a ReactTestComponent instance. (#7035)
(cherry picked from commit 6b8db0e111)
2016-06-14 15:50:39 -07:00
Dominic Gannaway
eab4ffa721 Performance: setTextContent should attempt to set TextNode nodeValue where possible (#7005)
(cherry picked from commit 40f6d3eaca)
2016-06-14 15:50:39 -07:00
Keyan Zhang
1e0f0a35cf pinned babylon version for eslint to work (#7008)
(cherry picked from commit 46cd6a0b62)
2016-06-14 15:50:39 -07:00
Jim
d4aebaa671 Remove console.log from test (#7006)
(cherry picked from commit 2282894d52)
2016-06-14 15:50:39 -07:00
Jim
cd5189a63c Fix controlled/uncontrolled validation for radio+checkbox inputs (#7003)
(cherry picked from commit 0bb0fe8d00)
2016-06-14 15:50:39 -07:00
Jim
cf50a83b8d Fix IE11 placeholder textContent value bug. (#7002)
(cherry picked from commit f0b140d726)
2016-06-14 15:50:39 -07:00
Brandon Dail
89746fa70f Warn if childContextType is defined on SFC (#6933)
Add console.error message content check

Use appropriate name in warning/test
(cherry picked from commit c47830d12c)
2016-06-14 15:50:39 -07:00
Hiroyuki Wada
e1c2c42c24 Fix #5839 Add error event to source element (#6941)
* Fix #5839 Add error event to source element

* Add test case for <source onError={callback}>

(cherry picked from commit 518336e2fb)
2016-06-14 15:50:39 -07:00
Josh Hunt
05c133a9c3 Fix #6950, work around IE missing innerHTML on SVG nodes (#6982)
* Workaround IE lacking innerHTML on SVG elements

* Add tests for setInnerHTML

* Correctly check if node has innerHTML property

* Ensure tests for setInnerHTML actually tests both codepaths

* Provide mock element for setInnerHTML tests

* Only use SVG setInnerHTML workaround for SVG elements

(cherry picked from commit 99d8524d23)
2016-06-14 15:50:38 -07:00
Sebastian Markbåge
92bda144d9 Merge pull request #6988 from sebmarkbage/newreconciler
[Fiber] Minimize abuse of .alternate
(cherry picked from commit 0cafd83834)
2016-06-14 15:50:38 -07:00
Timothy Yung
6eeb2898f7 Improve error message for components in bad states (missing instance) (#6990)
(cherry picked from commit 7988acaa95)
2016-06-14 15:50:38 -07:00
Keyan Zhang
e974383cba Add reactProdInvariant and corresponding babel rewrite pass (#6948)
(cherry picked from commit 1abce1630c)
2016-06-14 15:50:38 -07:00
Sebastian Markbåge
7912baea69 Merge pull request #6981 from sebmarkbage/newreconciler
[Fiber] Add support for simple updates and fiber pooling
(cherry picked from commit ccd26ee020)
2016-06-14 15:50:38 -07:00
Jim
07389fd9fc Fix autofocus for input and textarea (#6986)
(cherry picked from commit eb705d1448)
2016-06-14 15:50:32 -07:00
Dan Abramov
7a4aef0d0d Tweak ReactPerf warning message and code style (#6977)
(cherry picked from commit d101f68bce)
2016-06-14 15:49:51 -07:00
Alexander
85fd90d4c2 Warn that ReactPerf does not work in the production build (#6884)
Fixes #6871
(cherry picked from commit 2a46103ac8)
2016-06-14 15:49:51 -07:00
Ben Alpert
6080ab547d Fix function declaration in if statement (#6963)
Firefox doesn't like these and throws.
(cherry picked from commit 3c3c30a19a)
2016-06-14 15:49:50 -07:00
Keyan Zhang
6562466c9e Fix null node issue in ReactCSSTransitionGroup (#6958)
(cherry picked from commit c9eb572a6f)
2016-06-14 15:49:50 -07:00
Paul O’Shannessy
904c6e767b Merge pull request #6957 from zpao/flow026
Upgrade Flow
(cherry picked from commit d3b36d5524)
2016-06-14 15:49:50 -07:00
Sasha Aickin
58634bda69 Replace the implementation of escapeTextContentForBrowser with escape-html (#6862)
* Replacing the implementation of escapeTextContentForBrowser with escape-html for performance

* Addressing @spicyj's code review comment here: https://github.com/facebook/react/pull/6862#issuecomment-223102868 . Pulled the code of escape-html in to react and changed the encoding of single quote to &#x27.

* Addressing code review comment https://github.com/facebook/react/pull/6862#discussion_r65462074 to make code more inlinable for v8. Thanks, @spicyj.

(cherry picked from commit d6e70586b7)
2016-06-14 15:49:50 -07:00
Keyan Zhang
cb10a45ded Add a gulp script for extracting error codes (#6882)
(cherry picked from commit bfd1531eca)
2016-06-14 15:49:50 -07:00
Ben Alpert
90007f7087 Add rudimentary test renderer (#6944)
(cherry picked from commit 50982cea99)
2016-06-14 15:49:50 -07:00
Sebastian Markbåge
39ddfdd9a2 Merge pull request #6931 from sebmarkbage/newreconciler
[Fiber] Simple test assertions
(cherry picked from commit dc5686a42f)
2016-06-14 15:49:50 -07:00
Sebastian Markbåge
ab4ea744f9 Merge pull request #6903 from sebmarkbage/newreconciler
[Fiber] Transfer everything from Element onto the Fiber and use Tag instead of Stage
(cherry picked from commit 7de23758f1)
2016-06-14 15:49:49 -07:00
Alex Jacobs
60cc2fe911 Fix minor lint warnings (#6909)
(cherry picked from commit 29ed7c6c8c)
2016-06-14 15:49:49 -07:00
Ben Alpert
74ea71b324 Fix style test for Jasmine 2 (#6913)
(cherry picked from commit e62384bca4)
2016-06-14 15:49:49 -07:00
Nate Norberg
3d748e93f1 Added more specific warning for using onDblClick instead of onDoubleClick (#6881)
(cherry picked from commit 38900cc7ca)
2016-06-14 15:49:49 -07:00
Jim
a5d7fc84ee Followup to 6896, add explanation of workaround. (#6905)
(cherry picked from commit ba3bfe3e31)
2016-06-14 15:49:49 -07:00
Paul O’Shannessy
e8a8d005f0 Merge pull request #6677 from zpao/dont-warn-css-0-string
Don't warn when style value is '0'
(cherry picked from commit 5c6f9d31bd)
2016-06-14 15:49:49 -07:00
Sebastian Markbåge
2f4c61d1be Merge pull request #6859 from sebmarkbage/newreconciler
[Fiber] Child Reconciler + New Coroutines Primitive
(cherry picked from commit 0f4a4df12e)
2016-06-14 15:49:49 -07:00
Robin Berjon
677dd27912 Stop passing null as second argument to document.createElement() (#6896)
* Stop passing null as second argument to document.createElement()

* rewrap check for props.is to make it more readable

(cherry picked from commit 263615573c)
2016-06-14 15:49:48 -07:00
Dan Abramov
689f5cc187 Merge pull request #6886 from Weizenlol/patch-1
Added own property check when deleting listeners.
(cherry picked from commit ca5a0dad16)
2016-06-14 15:49:48 -07:00
Dan Abramov
8f8d9a9dde Merge pull request #6880 from gaearon/clone-key-ref-props-2
Fix issues introduced by createElement() warning
(cherry picked from commit 2d74280679)
2016-06-14 15:49:48 -07:00
Ben Alpert
634b107491 Warn when element is missing in devtool (#6869)
(cherry picked from commit 21d271f6d0)
2016-06-14 15:49:48 -07:00
Dan Abramov
31ba751d2e Make sure cloneElement() supports prototype-less config (#6878)
This brings createElement() fix from #6855 to cloneElement().
(cherry picked from commit e822cbd183)
2016-06-14 15:49:48 -07:00
Dan Abramov
c8b2a3dc13 Merge pull request #6872 from gaearon/jest-cli@12
Update to Jest 12.1.1 and Jasmine 2
(cherry picked from commit c0ecde687a)
2016-06-14 15:49:43 -07:00
Ben Alpert
58313419e2 Fix instrumentation in shallow rendering (#6867)
Previously, this threw:

```
 FAIL  src/test/__tests__/ReactTestUtils-test.js (7.291s)
● ReactTestUtils › it can fail context when shallowly rendering
  - TypeError: Cannot read property '_source' of null
        at describeID (src/renderers/shared/devtools/ReactComponentTreeDevtool.js:70:46)
        at Object.ReactComponentTreeDevtool.getStackAddendumByID (src/renderers/shared/devtools/ReactComponentTreeDevtool.js:203:15)
        at checkReactTypeSpec (src/isomorphic/classic/types/checkReactTypeSpec.js:76:58)
        at ReactCompositeComponentMixin._checkContextTypes (src/renderers/shared/stack/reconciler/ReactCompositeComponent.js:668:5)
        at ReactCompositeComponentMixin._processContext (src/renderers/shared/stack/reconciler/ReactCompositeComponent.js:607:14)
        at ReactCompositeComponentMixin.mountComponent (src/renderers/shared/stack/reconciler/ReactCompositeComponent.js:191:30)
        at ReactShallowRenderer._render (src/test/ReactTestUtils.js:483:14)
        at _batchedRender (src/test/ReactTestUtils.js:460:12)
        at ReactDefaultBatchingStrategyTransaction.Mixin.perform (src/shared/utils/Transaction.js:140:20)
        at Object.ReactDefaultBatchingStrategy.batchedUpdates (src/renderers/shared/stack/reconciler/ReactDefaultBatchingStrategy.js:65:19)
        at Object.batchedUpdates (src/renderers/shared/stack/reconciler/ReactUpdates.js:112:20)
        at ReactShallowRenderer.render (src/test/ReactTestUtils.js:453:16)
        at Spec.eval (src/test/__tests__/ReactTestUtils-test.js:289:34)
        at jasmine.Block.execute (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:1067:17)
        at jasmine.Queue.next_ (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2100:31)
        at jasmine.Queue.start (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2053:8)
        at Spec.jasmine.Spec.execute (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2380:14)
        at jasmine.Queue.next_ (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2100:31)
        at onComplete (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2096:18)
        at Spec.jasmine.Spec.finish (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2354:5)
        at eval [as onComplete] (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2381:10)
        at jasmine.Queue.next_ (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2110:14)
        at eval (node_modules/jest-jasmine1/vendor/jasmine-1.3.0.js:2090:18)
        at Timeout.e [as _onTimeout] (node_modules/jsdom/lib/jsdom/browser/Window.js:440:19)
        at tryOnTimeout (timers.js:224:11)
        at Timer.listOnTimeout (timers.js:198:5)
```
(cherry picked from commit 510155e027)
2016-06-14 15:48:53 -07:00
Dan Abramov
8e598ea5c6 Don't count the time inside flushes towards lifecycle hooks (#6860)
* Don't count the time inside flushes towards lifecycle hooks

Fixes #6842.

We keep the existing behavior of testing for matching `onBeginLifeCycleTimer`/`onEndLifeCycleTimer` calls, but we push the current timer onto the stack if we enter a flush.
This solves an issue with portals which cause updates while a lifecycle timer is already running.

I chose to subtract the time spent in the flush from the time counted towards the lifecycle method because it would artificially inflate the “total” time of the component due to all the components inside the portal, so it would skew the exclusive table.

* Fix up the comment

(cherry picked from commit 8d7161e004)
2016-06-14 15:48:53 -07:00
Jim
58f0298c62 Add warning for unknown properties. (#6800)
(cherry picked from commit de1de9e18f)
2016-06-14 15:48:53 -07:00
Jim
f98e6c1955 Properly set value and defaultValue for input and textarea (#6406)
* Have `defaultValue` reach DOM node for html input box for #4618

* Cleanup and bug fixes for merge.

(cherry picked from commit 4338c8db4b)
2016-06-14 15:48:47 -07:00
Ben Alpert
a2f7b34f38 Remove unknown props in ART (#6861)
(cherry picked from commit cb4a0af7dd)
2016-06-14 15:34:28 -07:00
Ben Alpert
fad173a0f9 Merge pull request #6775 from spicyj/fix-art
Copy React ART tests and add hacks to fix them
(cherry picked from commit 531a6b3265)
2016-06-14 15:34:28 -07:00
Dan Abramov
c1a9d1c0e0 Fix componentWillUnmount() not counted by ReactPerf (#6858)
* Fix componentWillUnmount() not counted by ReactPerf

* Test that functional component render() time shows up in ReactPerf

* Test for setState() code path updates being included

(cherry picked from commit 9ba5668d18)
2016-06-14 15:34:28 -07:00
Ali Taheri Moghaddar
3cf363384e Avoid directly calling hasOwnProperty (#6855)
* Avoid directly calling hasOwnProperty

* Fix failing test case

(cherry picked from commit c313baa0ca)
2016-06-14 15:34:28 -07:00
Ben Alpert
bff0662ba3 Add test to ensure 'undefined' children is used (#6853)
(cherry picked from commit fe2002c3d8)
2016-06-14 15:34:28 -07:00
Keyan Zhang
8b6749dedd Extract the type checker into a separate module (#6851)
The type checker is now a separate module under `isomorphic/classic/types`
(cherry picked from commit db6ac5c01c)
2016-06-14 15:34:28 -07:00
Jim
00095e3cbd Removed unnecessary null check (#6841)
(cherry picked from commit 799eae2faf)
2016-06-14 15:34:28 -07:00
Keyan Zhang
6890805b16 Remove prop types checking in ReactCompositeComponent (#6824)
Remove prop types checking in ReactCompositeComponent

(cherry picked from commit c136369a81)
2016-06-14 15:34:28 -07:00
Rui Araújo
c654fdf709 Move ReactElementValidator to __DEV__ block (#6830)
It saves some more bytes in production mode.
(cherry picked from commit d955ee9fae)
2016-06-14 15:34:27 -07:00
Roderick Hsiao
c060f4ac3d Support onLoad event on link element (#6815)
(cherry picked from commit fd589fc8dd)
2016-06-14 15:34:27 -07:00
Keyan Zhang
23d3e70b4e Add component stack info to key validation warnings (#6799)
* Add component stack info to key validation warnings

* Add `ReactComponentTreeDevtool.getStackAddendumByID`
(cherry picked from commit 47e49ae8b7)
2016-06-14 15:34:27 -07:00
Paul O’Shannessy
d945077f42 Merge pull request #6804 from dmitriiabramov/update_typescript
Update typescript
(cherry picked from commit 6a3e9d583b)
2016-06-14 15:34:27 -07:00
Ben Berman
6607ffb9ec Minor comment typo (#6808)
(cherry picked from commit eda08d9656)
2016-06-14 15:34:27 -07:00
Dan Abramov
ad5902bc39 Merge pull request #6801 from iamdustan/instrumentation-to-shared
Move instrumentation to renderers/shared. Closes #6797
(cherry picked from commit d1256825bc)
2016-06-14 15:34:27 -07:00
Dan Abramov
5247dc3cd2 Merge pull request #6789 from gaearon/tree-devtool-fixes
Make sure element is reported correctly by tree devtool
(cherry picked from commit 7f08961604)
2016-06-14 15:34:27 -07:00
Jim
b340601ef6 Fire unknown prop warning when rendering client side. (#6693)
(cherry picked from commit 2e881aa4b4)
2016-06-14 15:34:27 -07:00
Dan Abramov
0f6081ee26 Merge pull request #6787 from gaearon/tree-devtool-test-tweaks
Refactor ReactComponentTreeDevtool test
(cherry picked from commit 503cbd3356)
2016-06-14 15:34:26 -07:00
David Aurelio
c17797f979 Require modules from React Native as node modules. (#6715)
(cherry picked from commit 151e1d7014)
2016-06-14 15:34:26 -07:00
Ben Alpert
6638d49ad9 Embed JSX filename paths relative to repo root (#6778)
Test Plan: Changed the preprocessor to log the output of babel.transform and saw

```
var _jsxFileName = 'src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js';
```

in the resulting output, instead of an absolute path.
(cherry picked from commit 6afd51061a)
2016-06-14 15:34:26 -07:00
Sebastian McKenzie
659ff22ea4 Remove unnecessary require causing excess memory usage (#6781)
(cherry picked from commit 3703b63a11)
2016-06-14 15:34:26 -07:00
Ben Alpert
442d78a556 Show component stack in PropTypes warnings (#6771)
(cherry picked from commit 378c879a6a)
2016-06-14 15:34:26 -07:00
Ben Alpert
a599587fce Fix severe perf problems in component tree devtool (#6770)
One of the ReactMultiChildText tests renders 2145 roots (and even more components) and unmounts none of them. Now we don't loop through them all a bunch of times so the test takes 20 seconds instead of 60.

We should clean up instantiateReactComponent somehow so that the onSetDisplayName call isn't produced for the TopLevelWrapper, which should allow us to just store an array of unmountedIDs instead of a hash map so we at least don't have double maps. This change mirrors the old logic though.

Reviewers: @gaearon, @sebmarkbage
(cherry picked from commit 3cc733add4)
2016-06-14 15:34:26 -07:00
Ben Alpert
9483255583 Print stack in devtool exception warning (#6768)
(cherry picked from commit 5b5bd5eb75)
2016-06-14 15:34:26 -07:00
Ben Alpert
b3d37a908c Track source more generically in ReactComponentTreeDevtool (#6765)
Being able to get the source for your parent components seems useful, and ReactComponentTreeDevtool is best poised to be able to do that.

I'm also not sure it makes sense to have separate DOM-specific `onMountDOMComponent` and `onUpdateDOMComponent` events, so I removed them for now. Even if we want them, their timing seemed sort of arbitrary.

I also made it so DOM devtools can listen to non-DOM events too. Willing to change that if people think it's ugly though.
(cherry picked from commit 03f4ba260b)
2016-06-14 15:34:26 -07:00
Nima Jahanshahi
e039795971 Fixed an invalid escape char in attribute name regexp (#6772)
more info: https://www.w3.org/TR/xml/#NT-Name
(cherry picked from commit 32c750de5c)
2016-06-14 15:34:26 -07:00
Dan Abramov
47d0f21c60 Merge pull request #6767 from gaearon/fix-broken-master
Fix remaining onNativeOperation => onHostOperation rename
(cherry picked from commit 74cce27fe0)
2016-06-14 15:34:25 -07:00
Dan Abramov
a88d821d9f Merge pull request #6763 from nfcampos/is-running
added isProfiling() to ReactDebugTool and isRunning() to PerfTools
(cherry picked from commit 5569d1d40e)
2016-06-14 15:34:25 -07:00
Ben Alpert
460c4c2b9a Remove some dead code (#6764)
(cherry picked from commit 20bcabb1ea)
2016-06-14 15:34:25 -07:00
Dmitriy Kubyshkin
3bf315d70e Fixed removing attributes during custom element update. Fixes #6747 (#6748)
(cherry picked from commit 0e889d7c72)
2016-06-14 15:34:25 -07:00
Ben Alpert
5d3920f5ab Rename host-y things to be "host" not "native" (#6754)
For clarity.

I left "native event" as-is because there's a lot of it, it's not particularly ambiguous, and SimulateNative/nativeTouchData are public API in ReactTestUtils.
(cherry picked from commit ba9b985406)
2016-06-14 15:34:19 -07:00
Sebastian Markbåge
69208fc62a React Fiber Reconciler (#6690)
This is an outline for the new reconciler infrastructure.

I created a noop renderer to have something to get started from.

I split the reconciler folder into old and new, as well as shared.
I put shouldUpdateReactComponent in shared as an example of a
utility that can easily be shared between both. I plan on breaking
out more utilities like these.
(cherry picked from commit cf157886e9)
2016-06-14 15:30:26 -07:00
Sebastian Markbåge
484a5b38af Fix flow errors (#6719)
The new flow somehow found these on my machine but nowhere else
and not previously.
(cherry picked from commit 069f8099d6)
2016-06-14 15:30:25 -07:00
Dan Abramov
f112083c7a Merge pull request #6377 from puradox/proptypes-symbol
Add new primitive PropType `Symbol`
(cherry picked from commit 7bf96c08e6)
2016-06-14 15:30:25 -07:00
Bradford
2ef148d1ee fix minor capitalzation typo (#6736)
(cherry picked from commit 25be6dc027)
2016-06-14 15:30:25 -07:00
yiminghe
818ef42d22 allow to ignore value attribute for option (#5362)
(cherry picked from commit 904ee9a678)
2016-06-14 15:30:25 -07:00
Sebastian Markbåge
d77b28e90b Get patch versions of Flow (#6716)
Best practice or whatever.
(cherry picked from commit 700b7148ef)
2016-06-14 15:30:25 -07:00
Ben Alpert
2183e55c12 Disable coverage on Travis (#6712)
(cherry picked from commit 82ab58ea03)
2016-06-14 15:30:20 -07:00
Paul O’Shannessy
b3d3ae42ed Cleanup: remove @nolint (#6703)
(cherry picked from commit 873369cc7c)
2016-06-14 15:29:36 -07:00
Ben Alpert
61924171bf Move dev-only flags to only exist on composites (#6709)
_isOwnerNecessary was unused.
(cherry picked from commit e01bf78a79)
2016-06-14 15:29:35 -07:00
Jay Phelps
20a081eb37 [DOCS] ReactTextComponent was renamed ReactDOMTextComponent a while ago (#6700)
(cherry picked from commit fbe900265f)
2016-06-14 15:29:35 -07:00
Keyan Zhang
7dbf29a10d fixed transform-react-jsx-source devDep (#6697)
(cherry picked from commit 9ce54210ea)
2016-06-14 15:29:35 -07:00
Paul O’Shannessy
440543aa88 Setup grunt flow task and run on travis (#6684)
(cherry picked from commit c9504d99a5)
2016-06-14 15:29:35 -07:00
Troy DeMonbreun
4725941c74 Fix for #6062 : Show source line number on unknown property warning (#6398)
* New approach for 6062 fix : Show source line number on unknown property warning

* WIP: ReactDebugToolEventForwarderDevTool

* Update event signature to debugID

* Trigger events in ReactDOMComponent

* Renamed to onMountDOMComponent; passing in element directly

* Added debugID; updated simple test

* Added test for multi-div JSX to ref exact line

* Added test for composite component

(cherry picked from commit 7cf61db257)
2016-06-14 15:29:35 -07:00
Paul O’Shannessy
f14d0ef339 grunt jest tasks shouldn't use watchman (#6675)
(cherry picked from commit f25a88e965)
2016-06-14 15:29:35 -07:00
Sebastian Markbåge
c595c27357 Set up Flow - Yay! (#6682)
This just configures flow to be checked and fixes our existing
Flow typed files.

Possible enhancements:

Export .js.flow declarations from the build. Unclear whether this
will be a supported workflow in the future or not, so let's wait
on that.

We should fail builds and CI on Flow errors.

Ideally we should lint for Flow style guides (like no space before
colon).
(cherry picked from commit 771d938fc0)
2016-06-14 15:29:35 -07:00
Sasha Aickin
6d378bf78e Add test logic to make sure that events get tested when rendering on top of server-generated markup. (#6668)
(cherry picked from commit 256753b830)
2016-06-14 15:29:35 -07:00
Greg Hurrell
23c4d31291 Remove errant console.log (#6664)
That crept in in c1e3f7ec14.
(cherry picked from commit 4f01b4b186)
2016-06-14 15:29:35 -07:00
Ryan Lahfa
6af9f59010 package(node-engine-version): accept 6.x versions (#6645)
(cherry picked from commit 9d201abb2b)
2016-06-14 15:29:35 -07:00
Christoph Pojer
571d1f7314 Merge pull request #6638 from cpojer/master
Update Jest’s grunt task.
(cherry picked from commit 64401150a0)
2016-06-14 15:29:35 -07:00
Stolenkid
dd29092472 fixed a minor typo (#6600)
(cherry picked from commit aeda84602f)
2016-06-14 15:29:34 -07:00
Dan Abramov
3a48eef3c8 Merge pull request #6605 from gaearon/fix-warning-condition
Fix the warning condition in ReactDebugTool and ReactDOMDebugTool
(cherry picked from commit 7dbc95f379)
2016-06-14 15:29:34 -07:00
Qin Junwen
f80da18f2e Update 10.4-test-utils.md (#6971)
The find/scry methods which returns DOM component in react@0.13 now returns DOMElement in react@0.14 and later.
(cherry picked from commit a394ed6a6c)
2016-06-14 15:02:24 -07:00
Robert Haritonov
c4c800416f Add React Amsterdam conference to the list (#7028)
(cherry picked from commit 4577db6d3c)
2016-06-14 15:02:24 -07:00
nhducit
a6e4c9210d Update 03-interactivity-and-dynamic-uis.md (#7015)
(cherry picked from commit eda159cd28)
2016-06-14 15:02:23 -07:00
Ryo Shibayama
764519245b Fix Japanese/Italian/Korean tutorials (#7020)
* Fix japanese tutorial

* Fix Italian tutorial as same as e4fe662

* Fix Korean tutorial as same as e4fe662

(cherry picked from commit e487c36ec0)
2016-06-14 15:02:23 -07:00
inkinworld
902a15d149 Update 12-context.md (#6973)
Modify a clerical error
(cherry picked from commit 665633a1b7)
2016-06-14 15:02:23 -07:00
Ben Alpert
3e61ccc2d4 Wordsmith the homepage (#7022)
(cherry picked from commit 96d2a30c25)
2016-06-13 12:40:31 -07:00
Ben Alpert
3aaf9abb73 New marketing copy on homepage (#7012)
(cherry picked from commit c7868cc741)
2016-06-10 19:47:53 -07:00
ogom
e348891410 Updte tutorial to ja-JP (#6967)
(cherry picked from commit 9c7f895783)
2016-06-08 19:31:35 -07:00
Yusong Liu
45469fbde9 Fix the typo in the documentaion pages for shallowCompare (#6980)
* fix the typo for the docs of shallowCompare at:
https://facebook.github.io/react/docs/shallow-compare.html

* change "value" to "values" to match the two objects.

(cherry picked from commit 5331323cd2)
2016-06-08 19:31:35 -07:00
Keyan Zhang
0bc349c450 temporarily disabled tests under ./scripts 2016-06-07 16:09:15 -07:00
Keyan Zhang
6aacfdb9ba Add a gulp script for extracting error codes (#6882)
(cherry picked from commit bfd1531eca)
2016-06-07 15:08:42 -07:00
Keyan Zhang
5aa1c3547e [Docs] Error Decoder Page (#6946)
(cherry picked from commit cf73de9459)
2016-06-07 14:47:52 -07:00
Daniel Rosenwasser
c1c31f2cba Update link and description of TypeScript support. (#6953)
(cherry picked from commit 6b3f11cdd7)
2016-06-03 14:46:59 -07:00
Ben Alpert
79707ca3ee Use remarkable instead of marked (#6961)
https://github.com/reactjs/react-tutorial/issues/139
(cherry picked from commit 1801d56500)
2016-06-03 14:41:50 -07:00
Ben Alpert
5fcb784294 Remove Flux from docs nav (#6945)
Most people don't use the official Flux implementation or docs so I think this is likely to be more confusing than helpful. Maybe later we can add a better comparison of data management solutions.
(cherry picked from commit 9498747606)
2016-06-01 11:42:00 -07:00
hjmoss
0a1e5eb93b Grammar: less dependencies -> fewer dependencies (#6917)
* Grammar: less dependencies -> fewer dependencies

* changelog.md grammar: less dependencies -> fewer dependencies

(cherry picked from commit 4e82e8b6e6)
2016-05-31 12:15:48 -07:00
Toru Kobayashi
826d2ac716 Remove getDOMNode from docs (#6919)
(cherry picked from commit 97b44085ff)
2016-05-31 12:15:48 -07:00
Paul O’Shannessy
878644b358 [docs] Use existing layout for redirecting html-jsx (#6904)
(cherry picked from commit d87005e0b6)
2016-05-31 12:15:48 -07:00
Ilya Gelman
ef4efcced1 Add ReactNext 2016 conference (#6833)
(cherry picked from commit b0cb4e850d)
2016-05-31 12:15:48 -07:00
Daniel Lo Nigro
9e1a44e6bb Move HTMLtoJSX page off React site. References https://github.com/reactjs/react-magic/issues/52 (#6608)
(cherry picked from commit 871116f001)
2016-05-31 12:15:48 -07:00
Daniel Lo Nigro
7819816cc9 Add link to ReactJS.NET on server-side environments page (#6607)
(cherry picked from commit d81f3297aa)
2016-05-31 12:15:48 -07:00
Keyan Zhang
087c4c8b3c switched to codemirror's jsx mode (#6898)
(cherry picked from commit c8bab76091)
2016-05-31 12:15:47 -07:00
Dan Abramov
b370918e0c Merge pull request #6890 from grgur/patch-1
Added React Europe 2015 videos
(cherry picked from commit 1d3aceb6c3)
2016-05-31 12:15:47 -07:00
Andrew Clark
e6ad21933b Clarify that string refs are considered legacy. (#6692)
(cherry picked from commit d7ced68dce)
2016-05-31 12:15:47 -07:00
Alex Zherdev
22b96dd414 Context docs updated with ES6 examples (#6852)
(cherry picked from commit 6a101b6c10)
2016-05-31 12:15:47 -07:00
Vedat Mahir YILMAZ
aa2edb427a Interactivity and Dynamic UIs Docs page updated with ES6 Example (#6832)
* Interactivity and Dynamic UIs Pages ES6 Example

* Change bind handler

(cherry picked from commit c7ef0af54b)
2016-05-31 12:15:47 -07:00
Keyan Zhang
39d6f49896 Merge pull request #6814 from Ivanwangcy/master
Update 03-interactivity-and-dynamic-uis.zh-CN.md
(cherry picked from commit e1e34274f6)
2016-05-31 12:15:47 -07:00
hao.huang
e0a82f4921 Add permalink (#6813)
Add permalink to this doc,so we can access with 'prev' and 'next'
(cherry picked from commit 09fdd1d578)
2016-05-31 12:15:47 -07:00
Ben Alpert
b95a23ce78 Point people to prod build in perf docs (#6857)
(cherry picked from commit 43b63995a8)
2016-05-24 11:11:07 -07:00
Paul O’Shannessy
7842c19934 Update website for 15.1.0 2016-05-20 15:57:02 -07:00
Paul O’Shannessy
fef495942a 15.1.0 2016-05-20 15:54:35 -07:00
Paul O’Shannessy
b7d480986a Update readme for 15.1.0 2016-05-20 15:44:48 -07:00
Paul O’Shannessy
da6a30b022 Merge branch '15.1.0-dev' into 15-stable 2016-05-20 15:41:45 -07:00
Paul O’Shannessy
bca912f91e Changelog for 15.1.0 2016-05-20 15:20:11 -07:00
Dan Abramov
5b77fff586 Merge pull request #6753 from facebook/fix-6750
Fix a memory leak in ReactComponentTreeDevtool
(cherry picked from commit de1bb7a71f)
2016-05-19 22:56:28 -07:00
Dan Abramov
95db5bab42 Merge pull request #6752 from facebook/fix-6742
Fix ReactPerf.printOperations() crash
(cherry picked from commit 027d9a919b)
2016-05-19 22:56:22 -07:00
Rachel D. Cartwright
b4c1356d18 make test utils format consistent (#6777)
(cherry picked from commit 207fe0b478)
2016-05-16 13:00:48 -07:00
djskinner
668dd47700 Refer to correct example (#6760)
I *think* this should refer to the second example, where the instance to the ref is stored. In any case please can someone confirm for my own understanding?
(cherry picked from commit 712b1f75bf)
2016-05-16 13:00:43 -07:00
Chad Fawcett
d9bcda01db Add information on JSX element keys (#6751)
(cherry picked from commit 5d64199bb6)
2016-05-16 13:00:33 -07:00
Jarrod Mosen
8c50a04455 Fix grammar on homepage (#6746)
* Fix grammar in README

* Change DOM abstraction grammar on homepage

(cherry picked from commit 01b060d7dc)
2016-05-16 13:00:25 -07:00
hao.huang
80b849e2a0 Add permalink (#6713)
Add permalink to docs, so we can access with 'prev' and 'next'
(cherry picked from commit 92bebcad5f)
2016-05-16 13:00:20 -07:00
Ben Alpert
e15a7d1f7e Revert "Don't wrap drag events in IE/Edge in dev builds" (#6741)
(cherry picked from commit 98cb2f8507)
2016-05-12 11:38:07 -07:00
Paul O’Shannessy
7da8884581 15.1.0-alpha.1 2016-05-09 22:25:33 -07:00
Paul O’Shannessy
871523c8f4 Shrinkwrap to pick up jest upgrade 2016-05-09 22:22:41 -07:00
Dan Abramov
09172b112f Merge pull request #6647 from gaearon/bye-bye-reactperf
Replace ReactPerf with new implementation
(cherry picked from commit b6a6078167)
2016-05-09 22:07:49 -07:00
Desmond Brand
3adc4a6e0e Add links to docs for addons and top level API (#6555)
This makes it easier to figure out where the docs live.

Googling for e.g. `react-addons-update` also works, but this should
make things easier for people that hyperclick directly to the source.
(cherry picked from commit db175052c0)
2016-05-09 22:07:42 -07:00
Ben Alpert
b29bf7515b Fix bug with double updates in a single batch (#6650)
Fixes #2410. Fixes #6371. Fixes #6538.

I also manually tested the codepen in #3762 and verified it now works.
(cherry picked from commit c1e3f7ec14)
2016-05-09 22:05:32 -07:00
Dan Abramov
cba62feeec Merge pull request #6633 from gaearon/native-tree-devtool
Make ReactComponentTreeDevtool work with React Native
(cherry picked from commit 45ec1265eb)
2016-05-09 22:05:16 -07:00
Christoph Pojer
09c6d53e64 Merge pull request #6620 from cpojer/master
Update to Jest 12. Codemod to new Jest APIs.
(cherry picked from commit d07b554291)
2016-05-09 22:05:09 -07:00
Dan Abramov
78aa706491 Merge pull request #6046 from gaearon/new-perf
Add new ReactPerf
(cherry picked from commit 98a8f49068)
2016-05-09 21:54:42 -07:00
Dan Abramov
f50d542ff7 Merge pull request #6612 from gaearon/instrumentation-new-operations
Add ReactNativeOperationHistoryDevtool to track native operations
(cherry picked from commit 3bdf09e86f)
2016-05-09 21:54:36 -07:00
Dan Abramov
583d7205c6 Merge pull request #6549 from gaearon/instrumentation-new
Provide info about component tree to devtools
(cherry picked from commit 76a4c46dba)
2016-05-09 21:54:23 -07:00
Jim
1f1dba92a8 Merge pull request #6364 from p-jackson/issue-5700
Don't wrap drag events in IE/Edge in dev builds
(cherry picked from commit 2e8f28c29f)
2016-05-09 21:54:17 -07:00
Jim
258e591e45 Merge pull request #6341 from borisyankov/master
Add more information to warning 'Input elements must be either controlled or uncontrolled'
(cherry picked from commit 006058daa5)
2016-05-09 21:54:12 -07:00
Jim
42d27cd152 Merge pull request #6134 from richardscarrott/master
Warn if props obj passed into createElement / cloneElement inherits from anything other than Object
(cherry picked from commit 7b47e3e537)
2016-05-09 21:53:51 -07:00
Paul O’Shannessy
d8d6c7a07b 15.0.3-alpha.2 2016-05-09 21:32:13 -07:00
Paul O’Shannessy
4f0163fd38 Ensure babelrc gets added to zipfile too (#6688)
(cherry picked from commit 48f4684b5f)
2016-05-09 21:29:12 -07:00
Jim
0244879c8f Basic SSR support for error boundaries (#6694)
(cherry picked from commit 96cb8c5fc4)
2016-05-09 21:23:44 -07:00
Andreas Svensson
743e4c6231 DOMLazyTree, populate <object> before insertion into DOM (#6691)
(cherry picked from commit 2af4765a2a)
2016-05-09 21:23:38 -07:00
Tanase Hagi
c3d99b5292 Update examples/basic-commonjs/package.json (#6685)
(cherry picked from commit 83521bddb0)
2016-05-09 21:22:54 -07:00
Jake Boone
d1f519e0cd Grammar correction in ReactDOMInput.js warning (#6657)
Changed "a uncontrolled input" to "an uncontrolled input".
(cherry picked from commit 393a1798fa)
2016-05-09 21:19:51 -07:00
Brandon Dail
ff3cec5beb Return early from enqueuePutListener for SSR (#6678)
(cherry picked from commit eb116482a3)
2016-05-09 21:19:42 -07:00
Jan Schär
b0deadc05d Allow custom elements extending native ones (#6570)
...by passing the `is` attribute as the second param to `createElement`.
See http://webcomponents.org/polyfills/custom-elements/
(cherry picked from commit 3d31361cfb)
2016-05-09 21:16:51 -07:00
Dan Abramov
ced4ef9ad6 Fix zh-TW permalink 2016-05-10 02:21:01 +01:00
Dan Abramov
ca19ae5ad0 Fix ru-RU doc page permalinks
Fixes #6735
2016-05-10 01:48:48 +01:00
Dan Abramov
9460263e41 Merge pull request #6730 from elas7/fix-docs
[docs] Remove mention of 'nested object' as an allowed children in React.Children.map
(cherry picked from commit 982e096eb5)
2016-05-09 15:37:45 -07:00
Yaxian
197ecabb9a refine the translation of chapter 12-context (#6665)
(cherry picked from commit 9ddf9e137e)
2016-05-09 15:37:38 -07:00
Dan Abramov
ee459684f1 Merge pull request #6696 from dotu/patch-3
Create 03-interactivity-and-dynamic-uis.ru-RU.md
(cherry picked from commit 590ee490f9)
2016-05-09 15:37:34 -07:00
Kevin Suttle
6516c72ef1 Fix broken link to TypeScript docs (#6687)
(cherry picked from commit 3370db14bb)
2016-05-09 15:37:28 -07:00
Dan Abramov
9d022818e1 Merge pull request #6669 from dotu/patch-2
Create 02-displaying-data.ru-RU.md
(cherry picked from commit 4ed46ec52f)
2016-05-09 15:37:20 -07:00
Andrey Safronov
b9ae9f5f38 Create 01-why-react.ru-RU.md (#6659)
* Create 01-why-react.ru-RU.md

* Create 01-why-react.ru-RU.md

Translation for language code [ru-RU](https://en.wikipedia.org/wiki/Russian_language)

* Create 01-why-react.ru-RU.md

Errors fixes

* Update 01-why-react.ru-RU.md

исправил "чтобы решить".
спасибо за отзывчивость. надеюсь дальнейшие переводы хоть немного помогут распространению React в России :)

(cherry picked from commit 08e568cfc8)
2016-05-09 15:37:16 -07:00
Jackson Huang
b8ac9e1597 Create 01-why-react.zh-TW.md (#6470)
* Create 01-why-react.zh-TW.md

Translation for language code [zh-TW](https://en.wikipedia.org/wiki/Zh-TW)

* Update 01-why-react.zh-TW.md

change "封裝性非常好" to "封裝性高"

(cherry picked from commit 44f84634d7)
2016-05-09 15:37:09 -07:00
Simen Bekkhus
9537b240de Add note on how to submit a form (#6594)
(cherry picked from commit 772468183f)
2016-05-09 15:37:05 -07:00
Dan Abramov
9c6de78844 Merge pull request #6628 from sheerun/patch-1
Document stateless components in formal types
(cherry picked from commit af1a21289b)
2016-05-09 15:36:43 -07:00
Yan Li
6bb4fea31d adds ReactRally & Reactive 2016 + conf locations (#6623)
(cherry picked from commit 71179459de)
2016-05-09 15:36:35 -07:00
z.ky
97849a08cd Update tutorial - add link for starting server (#6602)
To be extra helpful to beginners, and avoid questions like this: http://stackoverflow.com/questions/35758956/react-tutorial-how-do-i-start-the-server
(cherry picked from commit f4e608fc2e)
2016-05-09 15:31:35 -07:00
Paul O’Shannessy
2f435912d8 Shrinkwrap to account for updated object-assign 2016-05-03 12:38:01 -07:00
Paul O’Shannessy
d737dc6dd2 15.0.3-alpha.1 2016-05-03 12:21:33 -07:00
Paul O’Shannessy
1b22f12acd Ensure we're using latest object-assign (#6681)
This picks up the change to feature test against order bugs.
(cherry picked from commit 468901c336)
2016-05-03 12:18:46 -07:00
Pieter De Baets
69bb9e3c8c Remove some mocks that are already packaged by InitializeJavaScriptAppEngine (#6642)
(cherry picked from commit 760b1ef4c3)
2016-05-03 12:03:13 -07:00
Pieter De Baets
772b5f9a5a Move ReactIOS components to native subfolder (#6643)
* Move ReactIOS components to ReactNative
* Drop ReactNative subfolder
(cherry picked from commit 222f5087fe)
2016-05-03 12:02:35 -07:00
Sebastian Markbåge
64acaca8ee Use spread instead of deprecated merge utility (#6634)
(cherry picked from commit 72ba5971ae)
2016-05-03 11:50:28 -07:00
Sebastian Markbåge
0008beb1fb Get rid of transformMatrix/decomposeMatrix special case (#6660)
This is no longer needed on the native side.

This is also the last use of the Platform flag. React Core is now
platform agnostic with regard to React Native. So I'll remove
the mocks and dependency.
(cherry picked from commit 0e4b046634)
2016-05-03 11:44:02 -07:00
Paul O’Shannessy
846b5ea252 Update website for 15.0.2 2016-04-29 17:34:00 -07:00
Paul O’Shannessy
de0b0b3705 15.0.2 2016-04-29 17:32:43 -07:00
Paul O’Shannessy
4dec99c61e Update readme for 15.0.2 2016-04-29 17:28:09 -07:00
Paul O’Shannessy
18d715b86e Merge branch '15.0.2-dev' into 15-stable 2016-04-29 17:27:26 -07:00
Paul O’Shannessy
a157791264 Changelog for 15.0.2 2016-04-29 17:04:18 -07:00
Paul O’Shannessy
590d82bc33 Ensure babelrc file gets packaged for starter kit (#6617)
(cherry picked from commit 096e5c7cf7)
2016-04-28 00:41:34 -07:00
Paul O’Shannessy
a210dacdf4 15.0.2-alpha.4 2016-04-27 23:54:09 -07:00
Jim
1dfaa528f8 ComponentWillUnmount should only ever be invoked once (#6613)
(cherry picked from commit 8dfdac6780)
2016-04-27 23:32:08 -07:00
Esteban
8c811778d6 Fix return type in onlyChild's JSDoc (#6573)
The return type is a 'ReactElement' instead of a 'ReactComponent'.
(cherry picked from commit 416f315c96)
2016-04-27 23:20:27 -07:00
Esteban
395ae75eb3 Fix mapFunction parameters in mapChildren's JSDoc (#6569)
Remove 'key' parameter from 'mapFunction(child, key, index)'. It is no longer called with 'key'.
(cherry picked from commit 9462d0d040)
2016-04-27 23:19:52 -07:00
Ike Peters
2606966b43 properly handling invalid scryRenderedDOMComponentsWithClass args (#6529)
properly handling invalid scryRenderedDOMComponentsWithClass args

properly handle invalid scryRenderedDOMComponentsWithClass args
(cherry picked from commit 9df54e0fce)
2016-04-27 23:19:22 -07:00
Dan Abramov
c98f0e6631 Merge pull request #6516 from gaearon/ignore-dom-writes-outside-batch
Ignore DOM writes outside the batch in ReactPerf
(cherry picked from commit 6a93137f0e)
2016-04-27 23:18:17 -07:00
Paul O’Shannessy
a7714585bb Merge pull request #6504 from alexlur/patch-1
Replaces Array#map with Array#forEach
(cherry picked from commit 932334d3d4)
2016-04-27 23:13:18 -07:00
hkal
da6e4853be Helper for escaping and unescpaing component keys (#6500)
- Abstract escaping
- Provide human readible same key warnings
(cherry picked from commit dc6fc8cc07)
2016-04-27 23:12:19 -07:00
Ben Alpert
afba0f3da7 Merge pull request #6469 from keyanzhang/validate-foreignObject-children
Ensure validateDOMNesting catches nested body elements
(cherry picked from commit 4016e71609)
2016-04-27 23:10:30 -07:00
Jim
d2b947c351 Merge pull request #6462 from Wildhoney/master
Re-added support for attaching events to document fragments
(cherry picked from commit 0b1fd18685)
2016-04-27 23:09:50 -07:00
Jim
d1ba51bc84 Merge pull request #6442 from trevorsmith/master
Correctly select options when nested inside an optgroup
(cherry picked from commit 5ac51c39a0)
2016-04-27 23:06:43 -07:00
Dan Abramov
9d73b2339a Merge pull request #6388 from gaearon/bye-bye-deprecated-utils
Remove OrderedMap and ReactPropTransferer
(cherry picked from commit b8f8360b5c)
2016-04-27 23:05:48 -07:00
Dan Abramov
e88c96b1d7 Merge pull request #6362 from gaearon/no-owner-in-test-utils
Elements from functional components in TestUtils should have no owner
(cherry picked from commit ae56910573)
2016-04-27 22:59:40 -07:00
Dan Abramov
3655e30adb Merge pull request #6215 from nhunzaker/nh-fix-disabled-inputs
Disabled inputs should not respond to clicks in IE
(cherry picked from commit 36e4fe54a8)
2016-04-27 22:54:46 -07:00
Paul O’Shannessy
112a400662 15.0.2-alpha.3 2016-04-25 12:55:13 -07:00
Sebastian Markbåge
33a9603e93 Ignore events fired on missing React Native instances
This can happen if something gets unmounted before the event gets
dispatched. I'm not sure how this works out exactly but this
preserves previous behavior in this scenario.
(cherry picked from commit 69b6869a3e)
2016-04-25 12:53:02 -07:00
Sebastian Markbåge
ae6dfa9dae Merge pull request #6588 from sahrens/patch-3
Delete ReactNativeGlobalInteractionHandler.js
(cherry picked from commit 2f2ed71bd0)
2016-04-25 12:52:52 -07:00
Sebastian Markbåge
c05ae26ec8 Merge pull request #6587 from sahrens/patch-2
Move PanResponder back to react-native repo temporarily.
(cherry picked from commit ea504521d5)
2016-04-25 12:52:46 -07:00
Sebastian Markbåge
3b2f29ef69 Merge pull request #6584 from sahrens/patch-1
[RN] Don't hold interaction handles for all touches
(cherry picked from commit aacb5467a0)
2016-04-25 12:52:41 -07:00
Denis Laxalde
ecb61403d7 Remove mention of deprecated ReactLink add-on (#6535)
(cherry picked from commit de7d1da997)
2016-04-22 13:13:07 -07:00
Paul O’Shannessy
9eb37bff49 Merge pull request #6519 from zpao/envdocsfixup
Cleanup environments doc
(cherry picked from commit befb70e42f)
2016-04-22 13:12:02 -07:00
Minwei Xu
605109021f ref-09-webcomponents.zh-CN.md (#6561)
(cherry picked from commit b7a2409919)
2016-04-22 13:11:55 -07:00
Adrian Sieber
a3b7699f42 Minor fixes (#6527)
* Fix typos in CHANGELOG.md

* Fix typos in 2014-11-24-react-js-conf-updates.md

(cherry picked from commit 8156ee0cab)
2016-04-22 13:11:48 -07:00
Jim
3251460ebd Mention Enzyme on the test utils page. (#6523)
(cherry picked from commit a12aab10cb)
2016-04-22 13:11:31 -07:00
Paul O’Shannessy
ec036ed185 Merge pull request #6576 from yuji0602/tutorial_md_sample_json_change
Changed example json value.
2016-04-22 10:40:18 -07:00
yuji0602
5922ea1a0c Changed example json value. 2016-04-22 13:38:01 +09:00
Ben Alpert
1fb7d64171 15.0.2-alpha.2 2016-04-21 15:18:27 -07:00
Ben Alpert
fd8aa077e3 Merge pull request #6572 from spicyj/rn-batch
Batch event handling in React Native
2016-04-21 15:15:19 -07:00
Paul O’Shannessy
3e8a2aaddb 15.0.2-alpha.1 2016-04-20 10:37:33 -07:00
Paul O’Shannessy
c81c29ae58 Merge pull request #6553 from zpao/cleanuppkg
Clean up package.json after #6338
(cherry picked from commit bddecc9696)
2016-04-20 10:37:03 -07:00
Sebastian Markbåge
5b4b6e7999 Merge pull request #6338 from sebmarkbage/reactnative2
Move React Core Integration and Injection to the Core Repo
(cherry picked from commit c84ad52ddb)
2016-04-20 09:39:50 -07:00
Jim
f565c92e38 Added docs for environment integration.
(cherry picked from commit 66bfee6543)
2016-04-14 12:32:35 -07:00
Jim
fc4bf8158a Create section on using React with package managers.
(cherry picked from commit c01c46b88a)
2016-04-14 12:31:31 -07:00
Dan Abramov
7cd3aa7a1e Use the same changelog format as 15.0 post 2016-04-08 23:01:15 +01:00
Jim
ab4057880e Merge pull request #6443 from Aweary/patch-1
Grammar fix for 15.0 blog post
(cherry picked from commit 09022b165f)
2016-04-08 11:29:06 -07:00
Paul O’Shannessy
d72885b383 Actually bump version on website 2016-04-08 11:28:52 -07:00
Paul O’Shannessy
fd1476e3aa Update website for 15.0.1 2016-04-08 11:22:55 -07:00
Paul O’Shannessy
142e4ebb57 15.0.1 blog post 2016-04-08 11:12:26 -07:00
Paul O’Shannessy
ca92b9104c 15.0.1 2016-04-08 11:12:25 -07:00
Paul O’Shannessy
a6179d03f3 Update changelog & readme for 15.0.1 2016-04-08 11:12:25 -07:00
Ben Alpert
8afaf0380f Merge pull request #6449 from spicyj/option-value
Set value using attribute only on initial option render
(cherry picked from commit 2b1bd1d7fe)
2016-04-07 21:47:58 -07:00
Paul O’Shannessy
ca0c409b6f Merge pull request #6444 from zpao/re__spreadwarn
Add back React.__spread and make it warn
(cherry picked from commit 516c1d809e)
2016-04-07 17:49:05 -07:00
Paul O’Shannessy
177796ff79 Fix extraneous markup in changelog 2016-04-07 17:49:05 -07:00
Paul O’Shannessy
da3be881ba [docs] Clarify data-reactid in v15 post
(cherry picked from commit 6fd2b29ec8)
2016-04-07 15:27:37 -07:00
Dan Abramov
1a0ec77094 Add the missing download
(cherry picked from commit 1aee28ef1b)
2016-04-07 14:33:05 -07:00
Jim
e226021c5e Merge pull request #6400 from jimfb/return-value-legacy
Document legacyness of the return value of ReactDOM.render()
(cherry picked from commit 1dc7c581db)
2016-04-07 14:28:20 -07:00
Jim
1942c6a035 Merge pull request #6419 from IvanVergiliev/master
Add documentation about empty functional components
(cherry picked from commit 62f64a84a4)
2016-04-07 14:28:14 -07:00
Paul O’Shannessy
c49166401a Update readme for v15 2016-04-07 13:59:21 -07:00
Paul O’Shannessy
500c0003b2 Update Changelog for v15 2016-04-07 13:58:15 -07:00
Paul O’Shannessy
0275d77fc0 [docs] Update site for v15 2016-04-07 13:58:15 -07:00
Dan Abramov
67a4b12e27 Add React 15 post 2016-04-07 13:58:14 -07:00
Paul O’Shannessy
d1c08f11d5 v15.0.0 2016-04-07 12:07:50 -07:00
Paul O’Shannessy
40c0867f63 [docs] Update acknowledgements for v15 2016-04-07 12:04:24 -07:00
Paul O’Shannessy
7081a85ace Shrinkwrap for release branch 2016-04-07 11:55:23 -07:00
2838 changed files with 157362 additions and 472113 deletions

28
.babelrc Normal file
View File

@@ -0,0 +1,28 @@
{
"presets": ["react"],
"ignore": ["third_party"],
"plugins": [
"transform-class-properties",
"syntax-trailing-function-commas",
"transform-object-rest-spread",
"transform-es2015-template-literals",
"transform-es2015-literals",
"transform-es2015-arrow-functions",
"transform-es2015-block-scoped-functions",
["transform-es2015-classes", { "loose": true }],
"transform-es2015-object-super",
"transform-es2015-shorthand-properties",
"transform-es2015-computed-properties",
"transform-es2015-for-of",
"check-es2015-constants",
["transform-es2015-spread", { "loose": true }],
"transform-es2015-parameters",
["transform-es2015-destructuring", { "loose": true }],
"transform-es2015-block-scoping",
"transform-es2015-modules-commonjs",
"transform-es3-member-expression-literals",
"transform-es3-property-literals",
"./scripts/babel/transform-object-assign-require",
"transform-react-jsx-source"
]
}

View File

@@ -1,538 +0,0 @@
version: 2
aliases:
- &docker
- image: circleci/openjdk:8-jdk-node-browsers
- &environment
TZ: /usr/share/zoneinfo/America/Los_Angeles
- &restore_yarn_cache
restore_cache:
name: Restore node_modules cache
keys:
- v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
- v2-node-{{ arch }}-{{ .Branch }}-
- v2-node-{{ arch }}-
- &run_yarn
run:
name: Install Packages
command: yarn --frozen-lockfile
- &attach_workspace
at: build
- &process_artifacts
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: node ./scripts/rollup/consolidateBundleSizes.js
- run: ./scripts/circleci/pack_and_store_artifact.sh
- store_artifacts:
path: ./node_modules.tgz
- store_artifacts:
path: ./build.tgz
- store_artifacts:
path: ./build/bundle-sizes.json
- store_artifacts:
# TODO: Update release script to use local file instead of pulling
# from artifacts.
path: ./scripts/error-codes/codes.json
- persist_to_workspace:
root: build
paths:
- bundle-sizes.json
jobs:
setup:
docker: *docker
environment: *environment
steps:
- checkout
- run:
name: Nodejs Version
command: node --version
- *restore_yarn_cache
- *run_yarn
- save_cache:
name: Save node_modules cache
key: v2-node-{{ arch }}-{{ .Branch }}-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
yarn_lint:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: node ./scripts/prettier/index
- run: node ./scripts/tasks/eslint
- run: ./scripts/circleci/check_license.sh
- run: ./scripts/circleci/check_modules.sh
- run: ./scripts/circleci/test_print_warnings.sh
yarn_flow:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: node ./scripts/tasks/flow-ci
RELEASE_CHANNEL_stable_yarn_test:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=stable --ci
yarn_test:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --ci
RELEASE_CHANNEL_stable_yarn_test_www:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-classic --ci
RELEASE_CHANNEL_stable_yarn_test_www_variant:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-classic --variant --ci
RELEASE_CHANNEL_stable_yarn_test_prod_www:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-classic --prod --ci
RELEASE_CHANNEL_stable_yarn_test_prod_www_variant:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-classic --prod --variant --ci
yarn_test_www:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-modern --ci
yarn_test_www_variant:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-modern --variant --ci
yarn_test_prod_www:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-modern --prod --ci
yarn_test_prod_www_variant:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=www-modern --prod --variant --ci
RELEASE_CHANNEL_stable_yarn_test_persistent:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=stable --persistent --ci
RELEASE_CHANNEL_stable_yarn_test_prod:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=stable --prod --ci
yarn_test_prod:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=experimental --prod --ci
RELEASE_CHANNEL_stable_yarn_build:
docker: *docker
environment: *environment
parallelism: 20
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run:
environment:
RELEASE_CHANNEL: stable
command: |
./scripts/circleci/add_build_info_json.sh
./scripts/circleci/update_package_versions.sh
yarn build
- run: echo "stable" >> build/RELEASE_CHANNEL
- persist_to_workspace:
root: build
paths:
- RELEASE_CHANNEL
- facebook-www
- facebook-react-native
- node_modules
- react-native
- dist
- sizes/*.json
yarn_build:
docker: *docker
environment: *environment
parallelism: 20
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run:
environment:
RELEASE_CHANNEL: experimental
command: |
./scripts/circleci/add_build_info_json.sh
./scripts/circleci/update_package_versions.sh
yarn build
- run: echo "experimental" >> build/RELEASE_CHANNEL
- persist_to_workspace:
root: build
paths:
- RELEASE_CHANNEL
- facebook-www
- facebook-react-native
- node_modules
- react-native
- dist
- sizes/*.json
build_devtools_and_process_artifacts:
docker: *docker
environment: *environment
parallelism: 20
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run:
environment:
RELEASE_CHANNEL: experimental
command: ./scripts/circleci/pack_and_store_devtools_artifacts.sh
- store_artifacts:
path: ./build/devtools.tgz
# These jobs are named differently so we can distinguish the stable and
# and experimental artifacts
process_artifacts: *process_artifacts
process_artifacts_experimental: *process_artifacts
sizebot_stable:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
# This runs in the process_artifacts job, too, but it's faster to run
# this step in both jobs instead of running the jobs sequentially
- run: node ./scripts/rollup/consolidateBundleSizes.js
- run:
environment:
RELEASE_CHANNEL: stable
command: node ./scripts/tasks/danger
sizebot_experimental:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
# This runs in the process_artifacts job, too, but it's faster to run
# this step in both jobs instead of running the jobs sequentially
- run: node ./scripts/rollup/consolidateBundleSizes.js
- run:
environment:
RELEASE_CHANNEL: experimental
command: node ./scripts/tasks/danger
yarn_lint_build:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn lint-build
- run: scripts/circleci/check_minified_errors.sh
RELEASE_CHANNEL_stable_yarn_lint_build:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run:
environment:
RELEASE_CHANNEL: stable
command: yarn lint-build
- run: scripts/circleci/check_minified_errors.sh
RELEASE_CHANNEL_stable_yarn_test_build:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=stable --build --ci
yarn_test_build:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=experimental --build --ci
yarn_test_build_devtools:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test --project=devtools --build --ci
RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- run:
name: Run DOM fixture tests
environment:
RELEASE_CHANNEL: stable
command: |
cd fixtures/dom
yarn --frozen-lockfile
yarn prestart
yarn test --maxWorkers=2
test_fuzz:
docker: *docker
environment: *environment
steps:
- checkout
- *restore_yarn_cache
- *run_yarn
- run:
name: Run fuzz tests
command: |
FUZZ_TEST_SEED=$RANDOM yarn test fuzz --ci
FUZZ_TEST_SEED=$RANDOM yarn test --prod fuzz --ci
RELEASE_CHANNEL_stable_yarn_test_build_prod:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=stable --build --prod --ci
yarn_test_build_prod:
docker: *docker
environment: *environment
steps:
- checkout
- attach_workspace: *attach_workspace
- *restore_yarn_cache
- *run_yarn
- run: yarn test --release-channel=experimental --build --prod --ci
workflows:
version: 2
stable:
jobs:
- setup
- yarn_lint:
requires:
- setup
- yarn_flow:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_test:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_test_prod:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_test_persistent:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_test_www:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_test_www_variant:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_test_prod_www:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_test_prod_www_variant:
requires:
- setup
- RELEASE_CHANNEL_stable_yarn_build:
requires:
- setup
- process_artifacts:
requires:
- RELEASE_CHANNEL_stable_yarn_build
- sizebot_stable:
requires:
- RELEASE_CHANNEL_stable_yarn_build
- RELEASE_CHANNEL_stable_yarn_lint_build:
requires:
- RELEASE_CHANNEL_stable_yarn_build
- RELEASE_CHANNEL_stable_yarn_test_build:
requires:
- RELEASE_CHANNEL_stable_yarn_build
- RELEASE_CHANNEL_stable_yarn_test_build_prod:
requires:
- RELEASE_CHANNEL_stable_yarn_build
- RELEASE_CHANNEL_stable_yarn_test_dom_fixtures:
requires:
- RELEASE_CHANNEL_stable_yarn_build
experimental:
jobs:
- setup
- yarn_test:
requires:
- setup
- yarn_test_prod:
requires:
- setup
- yarn_test_www:
requires:
- setup
- yarn_test_www_variant:
requires:
- setup
- yarn_test_prod_www:
requires:
- setup
- yarn_test_prod_www_variant:
requires:
- setup
- yarn_build:
requires:
- setup
- process_artifacts_experimental:
requires:
- yarn_build
- sizebot_experimental:
requires:
- yarn_build
- yarn_test_build:
requires:
- yarn_build
- yarn_test_build_prod:
requires:
- yarn_build
- yarn_lint_build:
requires:
- yarn_build
- yarn_test_build_devtools:
requires:
- yarn_build
# FIXME: Temporarily disabled to unblock master.
# - build_devtools_and_process_artifacts:
# requires:
# - yarn_build
fuzz_tests:
triggers:
- schedule:
# Fuzz tests run hourly
cron: "0 * * * *"
filters:
branches:
only:
- master
jobs:
- setup
- test_fuzz:
requires:
- setup

View File

@@ -1,10 +0,0 @@
{
"packages": ["packages/react", "packages/react-dom", "packages/scheduler"],
"buildCommand": "build --type=NODE react/index,react-dom/index,react-dom/server,scheduler/index,scheduler/tracing",
"publishDirectory": {
"react": "build/node_modules/react",
"react-dom": "build/node_modules/react-dom",
"scheduler": "build/node_modules/scheduler"
},
"sandboxes": ["new"]
}

View File

@@ -1,4 +1,4 @@
# https://editorconfig.org
# http://editorconfig.org
root = true
[*]

View File

@@ -1,21 +1,17 @@
# Third party
**/node_modules
# Not written by hand
packages/react-art/npm/lib
# Build products
# We can probably lint these later but not important at this point
src/renderers/art
src/shared/vendor
# But not in docs/_js/examples/*
docs/_js/*.js
docs/js/
docs/_site/
# gems
docs/vendor/bundle/
# This should be more like examples/**/thirdparty/** but
# we should fix https://github.com/facebook/esprima/pull/85 first
examples/
# Ignore built files.
build/
coverage/
fixtures/
scripts/bench/benchmarks/**/*.js
# React repository clone
scripts/bench/remote-repo/
packages/react-devtools-core/dist
packages/react-devtools-extensions/chrome/build
packages/react-devtools-extensions/firefox/build
packages/react-devtools-extensions/shared/build
packages/react-devtools-inline/dist
packages/react-devtools-shell/dist
scripts/bench/bench-*.js
vendor/*

View File

@@ -1,30 +1,19 @@
'use strict';
const {
es5Paths,
esNextPaths,
} = require('./scripts/shared/pathsByLanguageVersion');
const restrictedGlobals = require('confusing-browser-globals');
const OFF = 0;
const WARNING = 1;
const ERROR = 2;
module.exports = {
extends: ['fbjs', 'prettier'],
// Stop ESLint from looking for a configuration file in parent folders
root: true,
plugins: ['jest', 'no-for-of-loops', 'react', 'react-internal'],
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 8,
sourceType: 'script',
ecmaFeatures: {
experimentalObjectRestSpread: true,
},
extends: './node_modules/fbjs-scripts/eslint/.eslintrc.js',
plugins: [
'react',
'react-internal',
],
ecmaFeatures: {
modules: false
},
// We're stricter than the default config, mostly. We'll override a few rules
@@ -32,153 +21,54 @@ module.exports = {
rules: {
'accessor-pairs': OFF,
'brace-style': [ERROR, '1tbs'],
'consistent-return': OFF,
'comma-dangle': [ERROR, 'always-multiline'],
'consistent-return': ERROR,
'dot-location': [ERROR, 'property'],
// We use console['error']() as a signal to not transform it:
'dot-notation': [ERROR, {allowPattern: '^(error|warn)$'}],
'dot-notation': ERROR,
'eol-last': ERROR,
eqeqeq: [ERROR, 'allow-null'],
indent: OFF,
'eqeqeq': [ERROR, 'allow-null'],
'indent': [ERROR, 2, {SwitchCase: 1}],
'jsx-quotes': [ERROR, 'prefer-double'],
'keyword-spacing': [ERROR, {after: true, before: true}],
'no-bitwise': OFF,
'no-inner-declarations': [ERROR, 'functions'],
'no-multi-spaces': ERROR,
'no-restricted-globals': [ERROR].concat(restrictedGlobals),
'no-restricted-syntax': [ERROR, 'WithStatement'],
'no-shadow': ERROR,
'no-unused-expressions': ERROR,
'no-unused-vars': [ERROR, {args: 'none'}],
'no-use-before-define': OFF,
'no-useless-concat': OFF,
quotes: [ERROR, 'single', {avoidEscape: true, allowTemplateLiterals: true}],
'quotes': [ERROR, 'single', 'avoid-escape'],
'space-after-keywords': ERROR,
'space-before-blocks': ERROR,
'space-before-function-paren': OFF,
'valid-typeof': [ERROR, {requireStringLiterals: true}],
// We apply these settings to files that should run on Node.
// They can't use JSX or ES6 modules, and must be in strict mode.
// They can, however, use other ES6 features.
// (Note these rules are overridden later for source files.)
'no-var': ERROR,
strict: ERROR,
// Enforced by Prettier
// TODO: Prettier doesn't handle long strings or long comments. Not a big
// deal. But I turned it off because loading the plugin causes some obscure
// syntax error and it didn't seem worth investigating.
'max-len': OFF,
'space-before-function-paren': [ERROR, {anonymous: 'never', named: 'never'}],
'space-before-keywords': ERROR,
'strict': [ERROR, 'global'],
// React & JSX
// Our transforms set this automatically
'react/display-name': OFF,
'react/jsx-boolean-value': [ERROR, 'always'],
'react/jsx-no-undef': ERROR,
// We don't care to do this
'react/jsx-sort-prop-types': OFF,
'react/jsx-space-before-closing': ERROR,
'react/jsx-sort-props': OFF,
'react/jsx-uses-react': ERROR,
'react/no-is-mounted': OFF,
'react/jsx-uses-vars': ERROR,
// It's easier to test some things this way
'react/no-did-mount-set-state': OFF,
'react/no-did-update-set-state': OFF,
// We define multiple components in test files
'react/no-multi-comp': OFF,
'react/no-unknown-property': OFF,
// This isn't useful in our test code
'react/prop-types': OFF,
'react/react-in-jsx-scope': ERROR,
'react/self-closing-comp': ERROR,
// We don't care to do this
'react/jsx-wrap-multilines': [
ERROR,
{declaration: false, assignment: false},
],
// Prevent for...of loops because they require a Symbol polyfill.
// You can disable this rule for code that isn't shipped (e.g. build scripts and tests).
'no-for-of-loops/no-for-of-loops': ERROR,
'react/sort-comp': OFF,
'react/wrap-multilines': [ERROR, {declaration: false, assignment: false}],
// CUSTOM RULES
// the second argument of warning/invariant should be a literal string
'react-internal/no-primitive-constructors': ERROR,
'react-internal/no-to-warn-dev-within-to-throw': ERROR,
'react-internal/invariant-args': ERROR,
'react-internal/warning-args': ERROR,
'react-internal/no-production-logging': ERROR,
'react-internal/no-cross-fork-imports': ERROR,
},
overrides: [
{
// We apply these settings to files that we ship through npm.
// They must be ES5.
files: es5Paths,
parser: 'espree',
parserOptions: {
ecmaVersion: 5,
sourceType: 'script',
},
rules: {
'no-var': OFF,
strict: ERROR,
},
},
{
// We apply these settings to the source files that get compiled.
// They can use all features including JSX (but shouldn't use `var`).
files: esNextPaths,
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 8,
sourceType: 'module',
},
rules: {
'no-var': ERROR,
'prefer-const': ERROR,
strict: OFF,
},
},
{
files: ['**/__tests__/*.js'],
rules: {
// https://github.com/jest-community/eslint-plugin-jest
'jest/no-focused-tests': ERROR,
'jest/valid-expect': ERROR,
'jest/valid-expect-in-promise': ERROR,
},
},
{
files: [
'**/__tests__/**/*.js',
'scripts/**/*.js',
'packages/*/npm/**/*.js',
'packages/dom-event-testing-library/**/*.js',
'packages/react-devtools*/**/*.js',
],
rules: {
'react-internal/no-production-logging': OFF,
'react-internal/warning-args': OFF,
},
},
{
files: ['packages/react-native-renderer/**/*.js'],
globals: {
nativeFabricUIManager: true,
},
},
{
files: ['packages/react-transport-dom-webpack/**/*.js'],
globals: {
__webpack_chunk_load__: true,
__webpack_require__: true,
},
},
],
globals: {
SharedArrayBuffer: true,
spyOnDev: true,
spyOnDevAndProd: true,
spyOnProd: true,
__PROFILE__: true,
__UMD__: true,
__EXPERIMENTAL__: true,
__VARIANT__: true,
gate: true,
trustedTypes: true,
},
'react-internal/warning-and-invariant-args': ERROR,
}
};

37
.flowconfig Normal file
View File

@@ -0,0 +1,37 @@
[ignore]
.*/examples/.*
.*/build/.*
.*/node_modules/y18n/.*
.*/__mocks__/.*
.*/__tests__/.*
# Ignore Docs
.*/docs/.*
[include]
[libs]
./node_modules/fbjs/flow/lib
./flow
[options]
module.system=haste
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
experimental.strict_type_args=true
munge_underscores=false
suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FixMe
suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*\\)?)\\)
suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-4]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*\\)?)\\)? #[0-9]+
suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy
[version]
^0.27.0

View File

@@ -1,41 +0,0 @@
---
name: "🐛 Bug Report"
about: Report a reproducible bug or regression.
title: 'Bug: '
labels: 'Status: Unconfirmed'
---
<!--
Please provide a clear and concise description of what the bug is. Include
screenshots if needed. Please test using the latest version of the relevant
React packages to make sure your issue has not already been fixed.
-->
React version:
## Steps To Reproduce
1.
2.
<!--
Your bug will get fixed much faster if we can run your code and it doesn't
have dependencies other than React. Issues without reproduction steps or
code examples may be immediately closed as not actionable.
-->
Link to code example:
<!--
Please provide a CodeSandbox (https://codesandbox.io/s/new), a link to a
repository on GitHub, or provide a minimal code example that reproduces the
problem. You may provide a screenshot of the application if you think it is
relevant to your bug report. Here are some tips for providing a minimal
example: https://stackoverflow.com/help/mcve.
-->
## The current behavior
## The expected behavior

View File

@@ -1,7 +0,0 @@
contact_links:
- name: 📃 Documentation Issue
url: https://github.com/reactjs/reactjs.org/issues/new
about: This issue tracker is not for documentation issues. Please file documentation issues here.
- name: 🤔 Questions and Help
url: https://reactjs.org/community/support.html
about: This issue tracker is not for support questions. Please refer to the React community's help and discussion forums.

View File

@@ -1,27 +0,0 @@
<!--
Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory.
Before submitting a pull request, please make sure the following is done:
1. Fork [the repository](https://github.com/facebook/react) and create your branch from `master`.
2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development.
5. Run `yarn test-prod` to test in the production environment. It supports the same options as `yarn test`.
6. If you need a debugger, run `yarn debug-test --watch TestName`, open `chrome://inspect`, and press "Inspect".
7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files.
9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
10. If you haven't already, complete the CLA.
Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html
-->
## Summary
<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->
## Test Plan
<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. -->

34
.github/stale.yml vendored
View File

@@ -1,34 +0,0 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Issues with these labels will never be considered stale
exemptLabels:
- "Partner"
- "React Core Team"
- "Resolution: Backlog"
- "Type: Bug"
- "Type: Discussion"
- "Type: Needs Investigation"
- "Type: Regression"
# Label to use when marking an issue as stale
staleLabel: "Resolution: Stale"
issues:
# Comment to post when marking an issue as stale.
markComment: >
This issue has been automatically marked as stale.
**If this issue is still affecting you, please leave any comment** (for example, "bump"), and we'll keep it open.
We are sorry that we haven't been able to prioritize it yet. If you have any new additional information, please include it with your comment!
# Comment to post when closing a stale issue.
closeComment: >
Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!
pulls:
# Comment to post when marking a pull request as stale.
markComment: >
This pull request has been automatically marked as stale.
**If this pull request is still relevant, please leave any comment** (for example, "bump"), and we'll keep it open.
We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated.
# Comment to post when closing a stale pull request.
closeComment: >
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you!

29
.gitignore vendored
View File

@@ -1,18 +1,23 @@
.DS_STORE
node_modules
scripts/flow/*/.flowconfig
.flowconfig
*~
*.pyc
static
.grunt
_SpecRunner.html
__benchmarks__
build/
remote-repo/
coverage/
.module-cache
fixtures/dom/public/react-dom.js
fixtures/dom/public/react.js
*.gem
docs/.bundle
docs/code
docs/_site
docs/.sass-cache
docs/js/*
docs/downloads
docs/vendor/bundle
examples/shared/*.js
test/the-files-to-test.generated.js
*.log*
chrome-user-data
@@ -21,17 +26,3 @@ chrome-user-data
.idea
*.iml
.vscode
*.swp
*.swo
packages/react-devtools-core/dist
packages/react-devtools-extensions/chrome/build
packages/react-devtools-extensions/chrome/*.crx
packages/react-devtools-extensions/chrome/*.pem
packages/react-devtools-extensions/firefox/build
packages/react-devtools-extensions/firefox/*.xpi
packages/react-devtools-extensions/firefox/*.pem
packages/react-devtools-extensions/shared/build
packages/react-devtools-extensions/.tempUserDataDir
packages/react-devtools-inline/dist
packages/react-devtools-shell/dist

View File

@@ -11,6 +11,8 @@ Andrew Kulakov <avk@8xx8.ru>
Andrew Sokolov <asokolov@atlassian.com>
Anto Aravinth <anto.aravinth.cse@gmail.com>
Baraa Hamodi <bhamodi@uwaterloo.ca> <baraa@optimizely.com>
Ben Alpert <ben@benalpert.com> <balpert@fb.com>
Ben Alpert <ben@benalpert.com> <spicyjalapeno@gmail.com>
Ben Halpern <bendhalpern@gmail.com>
Ben Newman <bn@cs.stanford.edu> <benjamn@fb.com>
Benjamin Woodruff <github@benjam.info> <bgw@fb.com>
@@ -88,7 +90,6 @@ Kevin Coughlin <kevintcoughlin@gmail.com> <kevincoughlin@tumblr.com>
Krystian Karczewski <karcz.k@gmail.com>
Kunal Mehta <k.mehta@berkeley.edu> <kunalm@fb.com>
Laurence Rowe <l@lrowe.co.uk> <laurence@lrowe.co.uk>
Lea Rosema <terabaud@gmail.com>
Marcin K. <katzoo@github.mail>
Mark Anderson <undernewmanagement@users.noreply.github.com>
Mark Funk <mfunk86@gmail.com> <mark@boomtownroi.com>
@@ -136,10 +137,6 @@ Sebastian Markbåge <sebastian@calyptus.eu> <sema@fb.com>
Sergey Rubanov <chi187@gmail.com>
Shogun Sea <shogunsea08@gmail.com> <xxin@groupon.com>
Soichiro Kawamura <mail@w-st.com>
Sophie Alpert <git@sophiebits.com> <balpert@fb.com>
Sophie Alpert <git@sophiebits.com> <ben@benalpert.com>
Sophie Alpert <git@sophiebits.com> <sophiebits@fb.com>
Sophie Alpert <git@sophiebits.com> <spicyjalapeno@gmail.com>
Sota Ohara <ohrst.18@gmail.com>
Steven Luscher <react@steveluscher.com> <github@steveluscher.com>
Steven Luscher <react@steveluscher.com> <steveluscher@fb.com>

1
.nvmrc
View File

@@ -1 +0,0 @@
v12.16.2

View File

@@ -1,6 +0,0 @@
packages/react-devtools-core/dist
packages/react-devtools-extensions/chrome/build
packages/react-devtools-extensions/firefox/build
packages/react-devtools-extensions/shared/build
packages/react-devtools-inline/dist
packages/react-devtools-shell/dist

View File

@@ -1,21 +0,0 @@
'use strict';
const {esNextPaths} = require('./scripts/shared/pathsByLanguageVersion');
module.exports = {
bracketSpacing: false,
singleQuote: true,
jsxBracketSameLine: true,
trailingComma: 'es5',
printWidth: 80,
parser: 'babel',
overrides: [
{
files: esNextPaths,
options: {
trailingComma: 'all',
},
},
],
};

114
.travis.yml Normal file
View File

@@ -0,0 +1,114 @@
---
sudo: required
dist: trusty
language: node_js
node_js:
- 4
rvm:
- 2.2.3
cache:
directories:
- docs/vendor/bundle
- node_modules
before_install:
- |
if [ "$TEST_TYPE" != build_website ] && \
! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/'
then
echo "Only docs were updated, stopping build process."
exit
fi
npm install -g npm@latest-2
npm --version
script:
- |
if [ "$TEST_TYPE" = build_website ]; then
if [ "$TRAVIS_BRANCH" = "$REACT_WEBSITE_BRANCH" ] && [ "$TRAVIS_PULL_REQUEST" = false ]; then
set -e
GH_PAGES_DIR="$TRAVIS_BUILD_DIR"/../react-gh-pages
echo "machine github.com login reactjs-bot password $GITHUB_TOKEN" >~/.netrc
git config --global user.name "Travis CI"
git config --global user.email "travis@reactjs.org"
git clone --branch gh-pages --depth=50 \
https://reactjs-bot@github.com/facebook/react.git \
$GH_PAGES_DIR
pushd docs
bundle install --jobs=3 --retry=3 --path=vendor/bundle
bundle exec rake release
cd $GH_PAGES_DIR
git status
if ! git diff-index --quiet HEAD --; then
git add -A .
git commit -m "Rebuild website"
git push origin gh-pages
fi
popd
fi
elif [ "$TEST_TYPE" = build ]; then
if [ "$SERVER" ]; then
set -e
./node_modules/.bin/grunt build
curl \
-F "react=@build/react.js" \
-F "react.min=@build/react.min.js" \
-F "react-with-addons=@build/react-with-addons.js" \
-F "react-with-addons.min=@build/react-with-addons.min.js" \
-F "react-dom=@build/react-dom.js" \
-F "react-dom.min=@build/react-dom.min.js" \
-F "react-dom-server=@build/react-dom-server.js" \
-F "react-dom-server.min=@build/react-dom-server.min.js" \
-F "npm-react=@build/packages/react.tgz" \
-F "npm-react-dom=@build/packages/react-dom.tgz" \
-F "npm-react-native=@build/packages/react-native-renderer.tgz" \
-F "commit=$TRAVIS_COMMIT" \
-F "date=`git log --format='%ct' -1`" \
-F "pull_request=$TRAVIS_PULL_REQUEST" \
-F "token=$SECRET_TOKEN" \
-F "branch=$TRAVIS_BRANCH" \
$SERVER
fi
elif [ "$TEST_TYPE" = test ]; then
set -e
# Disabling coverage because it's broken:
# https://travis-ci.org/facebook/react/jobs/128163922
if false; then
./node_modules/.bin/grunt jest:coverage
cat ./coverage/lcov.info | ./node_modules/.bin/coveralls
else
./node_modules/.bin/grunt jest:normal
fi
echo 'Testing in server-render (HTML generation) mode...'
printf '\nmodule.exports.useCreateElement = false;\n' \
>> src/renderers/dom/shared/ReactDOMFeatureFlags.js
./node_modules/.bin/grunt jest:normal
git checkout -- src/renderers/dom/shared/ReactDOMFeatureFlags.js
./node_modules/.bin/gulp react:extract-errors
else
./node_modules/.bin/grunt $TEST_TYPE
fi
env:
matrix:
- TEST_TYPE=build
- TEST_TYPE=test
- TEST_TYPE=lint
- TEST_TYPE=flow
- TEST_TYPE=build_website
global:
# SERVER
- secure: qPvsJ46XzGrdIuPA70b55xQNGF8jcK7N1LN5CCQYYocXLa+fBrl+fTE77QvehOPhqwJXcj6kOxI+sY0KrVwV7gmq2XY2HZGWUSCxTN0SZlNIzqPA80Y7G/yOjA4PUt8LKgP+8tptyhTAY56qf+hgW8BoLiKOdztYF2p+3zXOLuA=
# SECRET_TOKEN
- secure: dkpPW+VnoqC/okhRdV90m36NcyBFhcwEKL3bNFExAwi0dXnFao8RoFlvnwiPlA23h2faROkMIetXlti6Aju08BgUFV+f9aL6vLyU7gUent4Nd3413zf2fwDtXIWIETg6uLnOpSykGKgCAT/hY3Q2oPLqOoY0OxfgnbqwxkxljrE=
# GITHUB_TOKEN
- secure: EHCyCSKMwKlLHNtcj9nmkRzmiiPE3aDGlPcnEyrDJeRI0SeN/iCXHXfFivR0vFq3vr+9naMBczAR2AEidtps5KbJrKqdZnjPFRbmfVtzWr/LlvVCub3u13Pub6TdKIVBTny1PuZ5X8GvdxMNVig89jGjvzhhWuQRaz3VhJnTra4=
# COVERALLS_TOKEN
- secure: h/cUq+TrUMZOQmkFD7CvuwX0uAwmjIfKZ4qSUzY+QzUtDzOzA0L/XF84xTBq1Q5YYsEiaoF6GxxGCdrLQiBA/ZTd+88UHgeZPMRvi0xG9Q+PeePVOsZMTxy4/WWFgOfSQCk49Mj9zizGgO78i6vxq+SDXMtFHnZ+TpPJIEW6/m0=
notifications:
irc:
use_notice: true
skip_join: true
on_success: change
on_failure: change
channels:
- chat.freenode.net#reactjs

View File

@@ -1 +0,0 @@
{}

437
AUTHORS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,76 +0,0 @@
# Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, sex characteristics, gender identity and expression,
level of experience, education, socio-economic status, nationality, personal
appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies within all project spaces, and it also applies when
an individual is representing the project or its community in public spaces.
Examples of representing a project or community include using an official
project e-mail address, posting via an official social media account, or acting
as an appointed representative at an online or offline event. Representation of
a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at <opensource-conduct@fb.com>. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see
https://www.contributor-covenant.org/faq

View File

@@ -1,5 +1,102 @@
# Contributing to React
Want to contribute to React? There are a few things you need to know.
React is one of Facebook's first open source projects that is both under very active development and is also being used to ship code to everybody on [facebook.com](https://www.facebook.com). We're still working out the kinks to make contributing to this project as easy and transparent as possible, but we're not quite there yet. Hopefully this document makes the process for contributing clear and answers some questions that you may have.
We wrote a **[contribution guide](https://reactjs.org/contributing/how-to-contribute.html)** to help you get started.
## [Code of Conduct](https://code.facebook.com/codeofconduct)
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.facebook.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
## Our Development Process
Some of the core team will be working directly on GitHub. These changes will be public from the beginning. Other changesets will come via a bridge with Facebook's internal source control. This is a necessity as it allows engineers at Facebook outside of the core team to move fast and contribute from an environment they are comfortable in.
### `master` is unsafe
We will do our best to keep `master` in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with. We will do our best to communicate these changes and always version appropriately so you can lock into a specific version if need be.
### Test Suite
Use `grunt test` to run the full test suite with PhantomJS.
This command is just a facade to [Jest](https://facebook.github.io/jest/). You may optionally run `npm install -g jest-cli` and use Jest commands directly to have more control over how tests are executed.
For example, `jest --watch` lets you automatically run the test suite on every file change.
You can also run a subset of tests by passing a prefix to `jest`. For instance, `jest ReactDOMSVG` will only run tests in the files that start with `ReactDOMSVG`, such as `ReactDOMSVG-test.js`.
When you know which tests you want to run, you can achieve a fast feedback loop by using these two features together. For example, `jest ReactDOMSVG --watch` will re-run only the matching tests on every change.
Just make sure to run the whole test suite before submitting a pull request!
### Pull Requests
**Working on your first Pull Request?** You can learn how from this *free* series [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github)
You may also be interested in watching [this short video](https://www.youtube.com/watch?v=wUpPsEcGsg8) (26 mins) which gives an introduction on how to contribute to the React JS project.
The core team will be monitoring for pull requests. When we get one, we'll run some Facebook-specific integration tests on it first. From here, we'll need to get another person to sign off on the changes and then merge the pull request. For API changes we may need to fix internal uses, which could cause some delay. We'll do our best to provide updates and feedback throughout the process.
*Before* submitting a pull request, please make sure the following is done…
1. Fork the repo and create your branch from `master`.
2. If you've added code that should be tested, add tests!
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes (`grunt test`).
5. Make sure your code lints (`grunt lint`) - we've done our best to make sure these rules match our internal linting guidelines.
6. If you haven't already, complete the CLA.
### Contributor License Agreement (CLA)
In order to accept your pull request, we need you to submit a CLA. You only need to do this once, so if you've done this for another Facebook open source project, you're good to go. If you are submitting a pull request for the first time, just let us know that you have completed the CLA and we can cross-check with your GitHub username.
[Complete your CLA here.](https://code.facebook.com/cla)
## Bugs
### Where to Find Known Issues
We will be using GitHub Issues for our public bugs. We will keep a close eye on this and try to make it clear when we have an internal fix in progress. Before filing a new task, try to make sure your problem doesn't already exist.
### Reporting New Issues
The best way to get your bug fixed is to provide a reduced test case. jsFiddle, jsBin, and other sites provide a way to give live examples. Those are especially helpful though may not work for `JSX`-based code.
### Security Bugs
Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page.
## How to Get in Touch
* IRC - [#reactjs on freenode](https://webchat.freenode.net/?channels=reactjs)
* Discussion forum - [discuss.reactjs.org](https://discuss.reactjs.org/)
## Meeting Notes
React team meets once a week to discuss the development of React, future plans, and priorities.
You can find the meeting notes in a [dedicated repository](https://github.com/reactjs/core-notes/).
## Style Guide
Our linter will catch most styling issues that may exist in your code.
You can check the status of your code styling by simply running: `grunt lint`
However, there are still some styles that the linter cannot pick up. If you are unsure about something, looking at [Airbnb's Style Guide](https://github.com/airbnb/javascript) will guide you in the right direction.
### Code Conventions
* Use semicolons `;`
* Commas last `,`
* 2 spaces for indentation (no tabs)
* Prefer `'` over `"`
* `'use strict';`
* 80 character line length
* Write "attractive" code
* Do not use the optional parameters of `setTimeout` and `setInterval`
### Documentation
* Do not wrap lines at 80 characters
## License
By contributing to React, you agree that your contributions will be licensed under its BSD license.

183
Gruntfile.js Normal file
View File

@@ -0,0 +1,183 @@
'use strict';
var path = require('path');
var GULP_EXE = 'gulp';
if (process.platform === 'win32') {
GULP_EXE += '.cmd';
}
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
browserify: require('./grunt/config/browserify'),
npm: require('./grunt/config/npm'),
clean: [
'./build',
'./*.gem',
'./docs/_site',
'./examples/shared/*.js',
'.module-cache',
],
'compare_size': require('./grunt/config/compare_size'),
});
grunt.config.set('compress', require('./grunt/config/compress'));
function spawnGulp(args, opts, done) {
grunt.util.spawn({
// This could be more flexible (require.resolve & lookup bin in package)
// but if it breaks we'll fix it then.
cmd: path.join('node_modules', '.bin', GULP_EXE),
args: args,
opts: Object.assign({stdio: 'inherit'}, opts),
}, function(err, result, code) {
if (err) {
grunt.fail.fatal('Something went wrong running gulp: ', result);
}
done(code === 0);
});
}
Object.keys(grunt.file.readJSON('package.json').devDependencies)
.filter(function(npmTaskName) {
return npmTaskName.indexOf('grunt-') === 0;
})
.filter(function(npmTaskName) {
return npmTaskName !== 'grunt-cli';
})
.forEach(function(npmTaskName) {
grunt.loadNpmTasks(npmTaskName);
});
grunt.registerTask('eslint', function() {
// Use gulp here.
spawnGulp(['eslint'], null, this.async());
});
grunt.registerTask('lint', ['eslint']);
grunt.registerTask('flow', function() {
// Use gulp here.
spawnGulp(['flow'], null, this.async());
});
grunt.registerTask('delete-build-modules', function() {
// Use gulp here.
spawnGulp(['react:clean'], null, this.async());
});
// Our own browserify-based tasks to build a single JS file build.
grunt.registerMultiTask('browserify', require('./grunt/tasks/browserify'));
grunt.registerMultiTask('npm', require('./grunt/tasks/npm'));
var npmReactTasks = require('./grunt/tasks/npm-react');
grunt.registerTask('npm-react:release', npmReactTasks.buildRelease);
grunt.registerTask('npm-react:pack', npmReactTasks.packRelease);
var npmReactDOMTasks = require('./grunt/tasks/npm-react-dom');
grunt.registerTask('npm-react-dom:release', npmReactDOMTasks.buildRelease);
grunt.registerTask('npm-react-dom:pack', npmReactDOMTasks.packRelease);
var npmReactNativeTasks = require('./grunt/tasks/npm-react-native');
grunt.registerTask('npm-react-native:release', npmReactNativeTasks.buildRelease);
grunt.registerTask('npm-react-native:pack', npmReactNativeTasks.packRelease);
var npmReactAddonsTasks = require('./grunt/tasks/npm-react-addons');
grunt.registerTask('npm-react-addons:release', npmReactAddonsTasks.buildReleases);
grunt.registerTask('npm-react-addons:pack', npmReactAddonsTasks.packReleases);
var npmReactTestRendererTasks = require('./grunt/tasks/npm-react-test');
grunt.registerTask('npm-react-test:release', npmReactTestRendererTasks.buildRelease);
grunt.registerTask('npm-react-test:pack', npmReactTestRendererTasks.packRelease);
grunt.registerTask('version-check', function() {
// Use gulp here.
spawnGulp(['version-check'], null, this.async());
});
grunt.registerTask('build:basic', [
'build-modules',
'version-check',
'browserify:basic',
]);
grunt.registerTask('build:addons', [
'build-modules',
'browserify:addons',
]);
grunt.registerTask('build:min', [
'build-modules',
'version-check',
'browserify:min',
]);
grunt.registerTask('build:addons-min', [
'build-modules',
'browserify:addonsMin',
]);
grunt.registerTask('build:npm-react', [
'version-check',
'build-modules',
'npm-react:release',
]);
grunt.registerTask('build:react-dom', require('./grunt/tasks/react-dom'));
var jestTasks = require('./grunt/tasks/jest');
grunt.registerTask('jest:normal', jestTasks.normal);
grunt.registerTask('jest:coverage', jestTasks.coverage);
grunt.registerTask('test', ['jest:normal']);
grunt.registerTask('npm:test', ['build', 'npm:pack']);
// Optimized build task that does all of our builds. The subtasks will be run
// in order so we can take advantage of that and only run build-modules once.
grunt.registerTask('build', [
'delete-build-modules',
'build-modules',
'version-check',
'browserify:basic',
'browserify:addons',
'browserify:min',
'browserify:addonsMin',
'build:react-dom',
'npm-react:release',
'npm-react:pack',
'npm-react-dom:release',
'npm-react-dom:pack',
'npm-react-native:release',
'npm-react-native:pack',
'npm-react-addons:release',
'npm-react-addons:pack',
'npm-react-test:release',
'npm-react-test:pack',
'compare_size',
]);
// Automate the release!
var releaseTasks = require('./grunt/tasks/release');
grunt.registerTask('release:setup', releaseTasks.setup);
grunt.registerTask('release:bower', releaseTasks.bower);
grunt.registerTask('release:docs', releaseTasks.docs);
grunt.registerTask('release:msg', releaseTasks.msg);
grunt.registerTask('release:starter', releaseTasks.starter);
grunt.registerTask('release', [
'release:setup',
'clean',
'build',
'release:bower',
'release:starter',
'compress',
'release:docs',
'release:msg',
]);
grunt.registerTask('build-modules', function() {
spawnGulp(['react:modules'], null, this.async());
});
// The default task - build - to keep setup easy.
grunt.registerTask('default', ['build']);
};

44
LICENSE
View File

@@ -1,21 +1,31 @@
MIT License
BSD License
Copyright (c) Facebook, Inc. and its affiliates.
For React software
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Copyright (c) 2013-present, Facebook, Inc.
All rights reserved.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name Facebook nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

393
LICENSE-docs Normal file
View File

@@ -0,0 +1,393 @@
Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More_considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public licenses.
Notwithstanding, Creative Commons may elect to apply one of its public
licenses to material it publishes and in those instances will be
considered the "Licensor." Except for the limited purpose of indicating
that material is shared under a Creative Commons public license or as
otherwise permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the public
licenses.
Creative Commons may be contacted at creativecommons.org.

9
LICENSE-examples Normal file
View File

@@ -0,0 +1,9 @@
The examples provided by Facebook are for non-commercial testing and evaluation
purposes only. Facebook reserves all rights not expressly granted.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

33
PATENTS Normal file
View File

@@ -0,0 +1,33 @@
Additional Grant of Patent Rights Version 2
"Software" means the React software distributed by Facebook, Inc.
Facebook, Inc. ("Facebook") hereby grants to each recipient of the Software
("you") a perpetual, worldwide, royalty-free, non-exclusive, irrevocable
(subject to the termination provision below) license under any Necessary
Claims, to make, have made, use, sell, offer to sell, import, and otherwise
transfer the Software. For avoidance of doubt, no license is granted under
Facebook's rights in any patent claims that are infringed by (i) modifications
to the Software made by you or any third party or (ii) the Software in
combination with any software or other technology.
The license granted hereunder will terminate, automatically and without notice,
if you (or any of your subsidiaries, corporate affiliates or agents) initiate
directly or indirectly, or take a direct financial interest in, any Patent
Assertion: (i) against Facebook or any of its subsidiaries or corporate
affiliates, (ii) against any party if such Patent Assertion arises in whole or
in part from any software, technology, product or service of Facebook or any of
its subsidiaries or corporate affiliates, or (iii) against any party relating
to the Software. Notwithstanding the foregoing, if Facebook or any of its
subsidiaries or corporate affiliates files a lawsuit alleging patent
infringement against you in the first instance, and you respond by filing a
patent infringement counterclaim in that lawsuit against that party that is
unrelated to the Software, the license granted hereunder will not terminate
under section (i) of this paragraph due to such counterclaim.
A "Necessary Claim" is a claim of a patent owned by Facebook that is
necessarily infringed by the Software standing alone.
A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
or contributory infringement or inducement to infringe any patent, including a
cross-claim or counterclaim.

134
README.md
View File

@@ -1,75 +1,115 @@
# [React](https://reactjs.org/) &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/facebook/react/blob/master/LICENSE) [![npm version](https://img.shields.io/npm/v/react.svg?style=flat)](https://www.npmjs.com/package/react) [![CircleCI Status](https://circleci.com/gh/facebook/react.svg?style=shield&circle-token=:circle-token)](https://circleci.com/gh/facebook/react) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://reactjs.org/docs/how-to-contribute.html#your-first-pull-request)
# [React](https://facebook.github.io/react/) [![Build Status](https://img.shields.io/travis/facebook/react/master.svg?style=flat)](https://travis-ci.org/facebook/react) [![Coverage Status](https://img.shields.io/coveralls/facebook/react/master.svg?style=flat)](https://coveralls.io/github/facebook/react?branch=master) [![npm version](https://img.shields.io/npm/v/react.svg?style=flat)](https://www.npmjs.com/package/react) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md#pull-requests)
React is a JavaScript library for building user interfaces.
* **Declarative:** React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes. Declarative views make your code more predictable, simpler to understand, and easier to debug.
* **Component-Based:** Build encapsulated components that manage their own state, then compose them to make complex UIs. Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.
* **Learn Once, Write Anywhere:** We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. React can also render on the server using Node and power mobile apps using [React Native](https://reactnative.dev/).
* **Learn Once, Write Anywhere:** We don't make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code. React can also render on the server using Node and power mobile apps using [React Native](https://facebook.github.io/react-native/).
[Learn how to use React in your own project](https://reactjs.org/docs/getting-started.html).
## Installation
React has been designed for gradual adoption from the start, and **you can use as little or as much React as you need**:
* Use [Online Playgrounds](https://reactjs.org/docs/getting-started.html#online-playgrounds) to get a taste of React.
* [Add React to a Website](https://reactjs.org/docs/add-react-to-a-website.html) as a `<script>` tag in one minute.
* [Create a New React App](https://reactjs.org/docs/create-a-new-react-app.html) if you're looking for a powerful JavaScript toolchain.
You can use React as a `<script>` tag from a [CDN](https://reactjs.org/docs/cdn-links.html), or as a `react` package on [npm](https://www.npmjs.com/package/react).
## Documentation
You can find the React documentation [on the website](https://reactjs.org/docs).
Check out the [Getting Started](https://reactjs.org/docs/getting-started.html) page for a quick overview.
The documentation is divided into several sections:
* [Tutorial](https://reactjs.org/tutorial/tutorial.html)
* [Main Concepts](https://reactjs.org/docs/hello-world.html)
* [Advanced Guides](https://reactjs.org/docs/jsx-in-depth.html)
* [API Reference](https://reactjs.org/docs/react-api.html)
* [Where to Get Support](https://reactjs.org/community/support.html)
* [Contributing Guide](https://reactjs.org/docs/how-to-contribute.html)
You can improve it by sending pull requests to [this repository](https://github.com/reactjs/reactjs.org).
[Learn how to use React in your own project](https://facebook.github.io/react/docs/getting-started.html).
## Examples
We have several examples [on the website](https://reactjs.org/). Here is the first one to get you started:
We have several examples [on the website](https://facebook.github.io/react/). Here is the first one to get you started:
```jsx
function HelloMessage({ name }) {
return <div>Hello {name}</div>;
}
```js
var HelloMessage = React.createClass({
render: function() {
return <div>Hello {this.props.name}</div>;
}
});
ReactDOM.render(
<HelloMessage name="Taylor" />,
<HelloMessage name="John" />,
document.getElementById('container')
);
```
This example will render "Hello Taylor" into a container on the page.
This example will render "Hello John" into a container on the page.
You'll notice that we used an HTML-like syntax; [we call it JSX](https://reactjs.org/docs/introducing-jsx.html). JSX is not required to use React, but it makes code more readable, and writing it feels like writing HTML. If you're using React as a `<script>` tag, read [this section](https://reactjs.org/docs/add-react-to-a-website.html#optional-try-react-with-jsx) on integrating JSX; otherwise, the [recommended JavaScript toolchains](https://reactjs.org/docs/create-a-new-react-app.html) handle it automatically.
You'll notice that we used an HTML-like syntax; [we call it JSX](https://facebook.github.io/react/docs/jsx-in-depth.html). JSX is not required to use React, but it makes code more readable, and writing it feels like writing HTML. A simple transform is included with React that allows converting JSX into native JavaScript for browsers to digest.
## Contributing
## Installation
The main purpose of this repository is to continue to evolve React core, making it faster and easier to use. Development of React happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving React.
The fastest way to get started is to serve JavaScript from a CDN. We're using [unpkg](https://unpkg.com/) below but React is also available on [cdnjs](https://cdnjs.com/libraries/react) and [jsdelivr](https://www.jsdelivr.com/projects/react):
### [Code of Conduct](https://code.fb.com/codeofconduct)
```html
<!-- The core React library -->
<script src="https://unpkg.com/react@15.3.2/dist/react.js"></script>
<!-- The ReactDOM Library -->
<script src="https://unpkg.com/react-dom@15.3.2/dist/react-dom.js"></script>
```
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read [the full text](https://code.fb.com/codeofconduct) so that you can understand what actions will and will not be tolerated.
We've also built a [starter kit](https://facebook.github.io/react/downloads/react-15.3.2.zip) which might be useful if this is your first time using React. It includes a webpage with an example of using React with live code.
### [Contributing Guide](https://reactjs.org/contributing/how-to-contribute.html)
If you'd like to use [bower](http://bower.io), it's as easy as:
Read our [contributing guide](https://reactjs.org/contributing/how-to-contribute.html) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React.
```sh
bower install --save react
```
### Good First Issues
And it's just as easy with [npm](http://npmjs.com):
```sh
npm i --save react
```
## Contribute
The main purpose of this repository is to continue to evolve React core, making it faster and easier to use. If you're interested in helping with that, then keep reading. If you're not interested in helping right now that's ok too. :) Any feedback you have about using React would be greatly appreciated.
### Building Your Copy of React
The process to build `react.js` is built entirely on top of node.js, using many libraries you may already be familiar with.
#### Prerequisites
* You have `node` installed at v4.0.0+ and `npm` at v2.0.0+.
* You have `gcc` installed or are comfortable installing a compiler if needed. Some of our `npm` dependencies may require a compliation step. On OS X, the Xcode Command Line Tools will cover this. On Ubuntu, `apt-get install build-essential` will install the required packages. Similar commands should work on other Linux distros. Windows will require some additional steps, see the [`node-gyp` installation instructions](https://github.com/nodejs/node-gyp#installation) for details.
* You are familiar with `npm` and know whether or not you need to use `sudo` when installing packages globally.
* You are familiar with `git`.
#### Build
Once you have the repository cloned, building a copy of `react.js` is really easy.
```sh
# grunt-cli is needed by grunt; you might have this installed already
npm install -g grunt-cli
npm install
grunt build
```
At this point, you should now have a `build/` directory populated with everything you need to use React. The examples should all work.
### Grunt
We use grunt to automate many tasks. Run `grunt -h` to see a mostly complete listing. The important ones to know:
```sh
# Build and run tests with PhantomJS
grunt test
# Lint the code with ESLint
grunt lint
# Wipe out build directory
grunt clean
```
### Good First Bug
To help you get your feet wet and get you familiar with our contribution process, we have a list of [good first bugs](https://github.com/facebook/react/labels/good%20first%20bug) that contain bugs which are fairly easy to fix. This is a great place to get started.
To help you get your feet wet and get you familiar with our contribution process, we have a list of [good first issues](https://github.com/facebook/react/labels/good%20first%20issue) that contain bugs which have a relatively limited scope. This is a great place to get started.
### License
React is [MIT licensed](./LICENSE).
React is [BSD licensed](./LICENSE). We also provide an additional [patent grant](./PATENTS).
React documentation is [Creative Commons licensed](./LICENSE-docs).
Examples provided in this repository and in the documentation are [separately licensed](./LICENSE-examples).
### More…
There's only so much we can cram in here. To read more about the community and guidelines for submitting pull requests, please read the [Contributing document](CONTRIBUTING.md).
## Troubleshooting
See the [Troubleshooting Guide](https://github.com/facebook/react/wiki/Troubleshooting)

View File

@@ -1,7 +0,0 @@
# Reporting Security Issues
If you believe you have found a security vulnerability in React, we encourage you to let us know right away. We will investigate all legitimate reports and do our best to quickly fix the problem.
Please refer to the following page for our responsible disclosure policy, reward guidelines, and those things that should not be reported:
https://www.facebook.com/whitehat

View File

@@ -1,41 +0,0 @@
image: Visual Studio 2017
# Fix line endings in Windows. (runs before repo cloning)
init:
- git config --global core.autocrlf input
environment:
JAVA_HOME: C:\Program Files\Java\jdk1.8.0
matrix:
- nodejs_version: 10
# Finish on first failed build
matrix:
fast_finish: true
platform:
- x64
branches:
only:
- master
# Disable Visual Studio build and deploy
build: off
deploy: off
install:
- ps: Install-Product node $env:nodejs_version $env:platform
- yarn install --frozen-lockfile
test_script:
- node --version
- yarn lint
# - yarn flow-ci
- yarn build
- yarn test
- yarn prettier
cache:
- node_modules
- "%LOCALAPPDATA%/Yarn"

View File

@@ -1,27 +0,0 @@
'use strict';
module.exports = {
plugins: [
'@babel/plugin-syntax-jsx',
'@babel/plugin-transform-react-jsx',
'@babel/plugin-transform-flow-strip-types',
['@babel/plugin-proposal-class-properties', {loose: true}],
'syntax-trailing-function-commas',
[
'@babel/plugin-proposal-object-rest-spread',
{loose: true, useBuiltIns: true},
],
['@babel/plugin-transform-template-literals', {loose: true}],
'@babel/plugin-transform-literals',
'@babel/plugin-transform-arrow-functions',
'@babel/plugin-transform-block-scoped-functions',
'@babel/plugin-transform-object-super',
'@babel/plugin-transform-shorthand-properties',
'@babel/plugin-transform-computed-properties',
'@babel/plugin-transform-for-of',
['@babel/plugin-transform-spread', {loose: true, useBuiltIns: true}],
'@babel/plugin-transform-parameters',
['@babel/plugin-transform-destructuring', {loose: true, useBuiltIns: true}],
['@babel/plugin-transform-block-scoping', {throwIfClosureRequired: true}],
],
};

5
build.sh Normal file
View File

@@ -0,0 +1,5 @@
grunt build:npm-react
cd build/packages/react
deps link
npm install
cd ../../..

View File

@@ -1,295 +0,0 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
// Hi, if this is your first time editing/reading a Dangerfile, here's a summary:
// It's a JS runtime which helps you provide continuous feedback inside GitHub.
//
// You can see the docs here: http://danger.systems/js/
//
// If you want to test changes Danger, I'd recommend checking out an existing PR
// and then running the `danger pr` command.
//
// You'll need a GitHub token, you can re-use this one:
//
// 0a7d5c3cad9a6dbec2d9 9a5222cf49062a4c1ef7
//
// (Just remove the space)
//
// So, for example:
//
// `DANGER_GITHUB_API_TOKEN=[ENV_ABOVE] yarn danger pr https://github.com/facebook/react/pull/11865
const {markdown, danger, warn} = require('danger');
const fetch = require('node-fetch');
const {generateResultsArray} = require('./scripts/rollup/stats');
const {existsSync, readFileSync} = require('fs');
const {exec} = require('child_process');
// This must match the name of the CI job that creates the build artifacts
const RELEASE_CHANNEL =
process.env.RELEASE_CHANNEL === 'experimental' ? 'experimental' : 'stable';
const artifactsJobName =
process.env.RELEASE_CHANNEL === 'experimental'
? 'process_artifacts_experimental'
: 'process_artifacts';
if (!existsSync('./build/bundle-sizes.json')) {
// This indicates the build failed previously.
// In that case, there's nothing for the Dangerfile to do.
// Exit early to avoid leaving a redundant (and potentially confusing) PR comment.
warn(
'No bundle size information found. This indicates the build ' +
'job failed.'
);
process.exit(0);
}
const currentBuildResults = JSON.parse(
readFileSync('./build/bundle-sizes.json')
);
/**
* Generates a Markdown table
* @param {string[]} headers
* @param {string[][]} body
*/
function generateMDTable(headers, body) {
const tableHeaders = [
headers.join(' | '),
headers.map(() => ' --- ').join(' | '),
];
const tablebody = body.map(r => r.join(' | '));
return tableHeaders.join('\n') + '\n' + tablebody.join('\n');
}
/**
* Generates a user-readable string from a percentage change
* @param {number} change
* @param {boolean} includeEmoji
*/
function addPercent(change, includeEmoji) {
if (!isFinite(change)) {
// When a new package is created
return 'n/a';
}
const formatted = (change * 100).toFixed(1);
if (/^-|^0(?:\.0+)$/.test(formatted)) {
return `${formatted}%`;
} else {
if (includeEmoji) {
return `:small_red_triangle:+${formatted}%`;
} else {
return `+${formatted}%`;
}
}
}
function setBoldness(row, isBold) {
if (isBold) {
return row.map(element => `**${element}**`);
} else {
return row;
}
}
/**
* Gets the commit that represents the merge between the current branch
* and master.
*/
function git(args) {
return new Promise(res => {
exec('git ' + args, (err, stdout, stderr) => {
if (err) {
throw err;
} else {
res(stdout.trim());
}
});
});
}
(async function() {
// Use git locally to grab the commit which represents the place
// where the branches differ
const upstreamRepo = danger.github.pr.base.repo.full_name;
if (upstreamRepo !== 'facebook/react') {
// Exit unless we're running in the main repo
return;
}
markdown(`## Size changes (${RELEASE_CHANNEL})`);
const upstreamRef = danger.github.pr.base.ref;
await git(`remote add upstream https://github.com/facebook/react.git`);
await git('fetch upstream');
const baseCommit = await git(`merge-base HEAD upstream/${upstreamRef}`);
let previousBuildResults = null;
try {
let baseCIBuildId = null;
const statusesResponse = await fetch(
`https://api.github.com/repos/facebook/react/commits/${baseCommit}/status`
);
const {statuses, state} = await statusesResponse.json();
if (state === 'failure') {
warn(`Base commit is broken: ${baseCommit}`);
return;
}
for (let i = 0; i < statuses.length; i++) {
const status = statuses[i];
if (status.context === `ci/circleci: ${artifactsJobName}`) {
if (status.state === 'success') {
baseCIBuildId = /\/facebook\/react\/([0-9]+)/.exec(
status.target_url
)[1];
break;
}
if (status.state === 'pending') {
warn(`Build job for base commit is still pending: ${baseCommit}`);
return;
}
}
}
if (baseCIBuildId === null) {
warn(`Could not find build artifacts for base commit: ${baseCommit}`);
return;
}
const baseArtifactsInfoResponse = await fetch(
`https://circleci.com/api/v1.1/project/github/facebook/react/${baseCIBuildId}/artifacts`
);
const baseArtifactsInfo = await baseArtifactsInfoResponse.json();
for (let i = 0; i < baseArtifactsInfo.length; i++) {
const info = baseArtifactsInfo[i];
if (info.path.endsWith('bundle-sizes.json')) {
const resultsResponse = await fetch(info.url);
previousBuildResults = await resultsResponse.json();
break;
}
}
} catch (error) {
warn(`Failed to fetch build artifacts for base commit: ${baseCommit}`);
return;
}
if (previousBuildResults === null) {
warn(`Could not find build artifacts for base commit: ${baseCommit}`);
return;
}
// Take the JSON of the build response and
// make an array comparing the results for printing
const results = generateResultsArray(
currentBuildResults,
previousBuildResults
);
const packagesToShow = results
.filter(
r =>
Math.abs(r.prevFileSizeAbsoluteChange) >= 300 || // bytes
Math.abs(r.prevGzipSizeAbsoluteChange) >= 100 // bytes
)
.map(r => r.packageName);
if (packagesToShow.length) {
let allTables = [];
// Highlight React and React DOM changes inline
// e.g. react: `react.production.min.js`: -3%, `react.development.js`: +4%
if (packagesToShow.includes('react')) {
const reactProd = results.find(
r => r.bundleType === 'UMD_PROD' && r.packageName === 'react'
);
if (
reactProd.prevFileSizeChange !== 0 ||
reactProd.prevGzipSizeChange !== 0
) {
const changeSize = addPercent(reactProd.prevFileSizeChange, true);
const changeGzip = addPercent(reactProd.prevGzipSizeChange, true);
markdown(`React: size: ${changeSize}, gzip: ${changeGzip}`);
}
}
if (packagesToShow.includes('react-dom')) {
const reactDOMProd = results.find(
r => r.bundleType === 'UMD_PROD' && r.packageName === 'react-dom'
);
if (
reactDOMProd.prevFileSizeChange !== 0 ||
reactDOMProd.prevGzipSizeChange !== 0
) {
const changeSize = addPercent(reactDOMProd.prevFileSizeChange, true);
const changeGzip = addPercent(reactDOMProd.prevGzipSizeChange, true);
markdown(`ReactDOM: size: ${changeSize}, gzip: ${changeGzip}`);
}
}
// Show a hidden summary table for all diffs
// eslint-disable-next-line no-var,no-for-of-loops/no-for-of-loops
for (var name of new Set(packagesToShow)) {
const thisBundleResults = results.filter(r => r.packageName === name);
const changedFiles = thisBundleResults.filter(
r => r.prevFileSizeChange !== 0 || r.prevGzipSizeChange !== 0
);
const mdHeaders = [
'File',
'Filesize Diff',
'Gzip Diff',
'Prev Size',
'Current Size',
'Prev Gzip',
'Current Gzip',
'ENV',
];
const mdRows = changedFiles.map(r => {
const isProd = r.bundleType.includes('PROD');
return setBoldness(
[
r.filename,
addPercent(r.prevFileSizeChange, isProd),
addPercent(r.prevGzipSizeChange, isProd),
r.prevSize,
r.prevFileSize,
r.prevGzip,
r.prevGzipSize,
r.bundleType,
],
isProd
);
});
allTables.push(`\n## ${name}`);
allTables.push(generateMDTable(mdHeaders, mdRows));
}
const summary = `
<details>
<summary>Details of bundled changes.</summary>
<p>Comparing: ${baseCommit}...${danger.github.pr.head.sha}</p>
${allTables.join('\n')}
</details>
`;
markdown(summary);
} else {
markdown('No significant bundle size changes to report.');
}
})();

9
docs/404.md Normal file
View File

@@ -0,0 +1,9 @@
---
layout: single
title: Page Not Found
permalink: 404.html
---
We couldn't find what you were looking for.
Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

29
docs/Gemfile Normal file
View File

@@ -0,0 +1,29 @@
source 'https://rubygems.org'
gem 'rake'
# jekyll, which builds it all
# 3.0 includes sass processing
gem 'jekyll', '~>3.1'
# Jekyll extensions
gem 'jekyll-redirect-from'
gem 'jekyll-paginate'
# JSON
gem 'json'
# For `rake watch`
gem 'rb-fsevent'
# For markdown header cleanup
gem 'sanitize', '~>2.0'
# Markdown
gem 'redcarpet'
# Syntax highlighting
gem 'pygments.rb'
# Avoid having to poll for changes on Windows
gem 'wdm', '>= 0.1.0' if Gem.win_platform?

70
docs/Gemfile.lock Normal file
View File

@@ -0,0 +1,70 @@
GEM
remote: https://rubygems.org/
specs:
colorator (0.1)
ffi (1.9.14)
ffi (1.9.14-x64-mingw32)
jekyll (3.1.6)
colorator (~> 0.1)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
liquid (~> 3.0)
mercenary (~> 0.3.3)
rouge (~> 1.7)
safe_yaml (~> 1.0)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.11.0)
jekyll (>= 2.0)
jekyll-sass-converter (1.4.0)
sass (~> 3.4)
jekyll-watch (1.4.0)
listen (~> 3.0, < 3.1)
json (2.0.1)
kramdown (1.11.1)
liquid (3.0.6)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
mercenary (0.3.6)
mini_portile2 (2.1.0)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
nokogiri (1.6.8-x64-mingw32)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
pkg-config (1.1.7)
posix-spawn (0.3.11)
pygments.rb (0.6.3)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.2.0)
rake (11.2.2)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
redcarpet (3.3.4)
rouge (1.11.1)
safe_yaml (1.0.4)
sanitize (2.1.0)
nokogiri (>= 1.4.4)
sass (3.4.22)
yajl-ruby (1.2.1)
PLATFORMS
ruby
x64-mingw32
DEPENDENCIES
jekyll (~> 3.1)
jekyll-paginate
jekyll-redirect-from
json
pygments.rb
rake
rb-fsevent
redcarpet
sanitize (~> 2.0)
BUNDLED WITH
1.11.2

67
docs/README.md Normal file
View File

@@ -0,0 +1,67 @@
# React Documentation & Website
We use [Jekyll](http://jekyllrb.com/) to build the site using ([mostly](http://zpao.com/posts/adding-line-highlights-to-markdown-code-fences/)) Markdown, and we host it by pushing HTML to [GitHub Pages](http://pages.github.com/).
## Installation
If you are working on the site, you will want to install and run a local copy of it.
### Dependencies
In order to use Jekyll, you will need to have Ruby installed.
- [Ruby](http://www.ruby-lang.org/) (version >= 1.8.7)
- [RubyGems](http://rubygems.org/) (version >= 1.3.7)
- [Bundler](http://gembundler.com/)
Mac OS X comes pre-installed with Ruby, but you may need to update RubyGems (via `gem update --system`).
Otherwise, [RVM](https://rvm.io/) and [rbenv](https://github.com/sstephenson/rbenv) are popular ways to install Ruby.
Once you have RubyGems and installed Bundler (via `gem install bundler`), use it to install the dependencies:
```sh
$ cd react/docs
$ bundle install # Might need sudo.
$ npm install
```
### Instructions
The site requires React, so first make sure you've built the project (via `grunt`).
Use Jekyll to serve the website locally (by default, at `http://localhost:4000`):
```sh
$ cd react/docs
$ bundle exec rake
$ bundle exec jekyll serve -w
$ open http://localhost:4000/react/
```
We use [SASS](http://sass-lang.com/) (with [Bourbon](http://bourbon.io/)) for our CSS, and we use JSX to transform some of our JS.
If you only want to modify the HTML or Markdown, you do not have to do anything because we package pre-compiled copies of the CSS and JS.
If you want to modify the CSS or JS, use [Rake](http://rake.rubyforge.org/) to compile them:
```sh
$ cd react/docs
$ bundle exec rake watch # Automatically compiles as needed.
# bundle exec rake Manually compile CSS and JS.
# bundle exec rake js Manually compile JS, only.
```
## Afterthoughts
### Updating `facebook.github.io/react`
The easiest way to do this is to have a separate clone of this repository, checked out to the `gh-pages` branch. We have a build step that expects this to be in a directory named `react-gh-pages` at the same depth as `react`. Then it's just a matter of running `grunt docs`, which will compile the site and copy it out to this repository. From there, you can check it in.
**Note:** This should only be done for new releases. You should create a tag corresponding to the release tag in the main repository.
We also have a rake task that does the same thing (without creating commits). It expects the directory structure mentioned above.
```sh
$ bundle exec rake release
```
### Removing the Jekyll / Ruby Dependency
In an ideal world, we would not be adding a Ruby dependency on part of our project. We would like to move towards a point where we are using React to render the website.

76
docs/Rakefile Normal file
View File

@@ -0,0 +1,76 @@
require('rubygems')
require('json')
require('yaml')
require('open-uri')
desc "download babel-browser"
task :fetch_remotes do
IO.copy_stream(
open('https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js'),
'js/babel-browser.min.js'
)
end
desc "generate js from jsx"
task :js do
system "../node_modules/.bin/babel _js --out-dir=js"
end
desc "watch js"
task :watch do
Process.spawn "../node_modules/.bin/babel _js --out-dir=js --watch"
Process.waitall
end
desc "update version to match ../package.json"
task :update_version do
react_version = JSON.parse(File.read('../package.json'))['version']
site_config = YAML.load_file('_config.yml')
if site_config['react_version'] != react_version
site_config['react_version'] = react_version
File.open('_config.yml', 'w+') { |f| f.write(site_config.to_yaml) }
end
end
desc "update SRI hashes"
task :update_hashes do
map = {
'react.js' => 'dev',
'react.min.js' => 'prod',
'react-with-addons.js' => 'addons_dev',
'react-with-addons.min.js' => 'addons_prod',
'react-dom.js' => 'dom_dev',
'react-dom.min.js' => 'dom_prod',
'react-dom-server.js' => 'dom_server_dev',
'react-dom-server.min.js' => 'dom_server_prod'
}
site_config = YAML.load_file('_config.yml')
map.each do |file, key|
site_config['react_hashes'][key] = `openssl dgst -sha384 -binary ../../react-bower/#{file} | openssl base64 -A`
end
File.open('_config.yml', 'w+') { |f| f.write(site_config.to_yaml) }
end
desc "update acknowledgements list"
task :update_acknowledgements do
authors = File.readlines('../AUTHORS').map {|author| author.gsub(/ <.*\n/,'')}
# split into cols here because nobody knows how to use liquid
# need to to_f because ruby will keep slice_size as int and round on its own
slice_size = (authors.size / 3.to_f).ceil
cols = authors.each_slice(slice_size).to_a
File.open('_data/acknowledgements.yml', 'w+') { |f| f.write(cols.to_yaml) }
end
desc "copy error codes to docs"
task :copy_error_codes do
codes_json = File.read('../scripts/error-codes/codes.json')
codes_js = "var errorMap = #{codes_json.chomp};\n"
File.write('js/errorMap.js', codes_js)
end
desc "build into ../../react-gh-pages"
task :release => [:update_version, :js, :fetch_remotes, :copy_error_codes] do
system "jekyll build -d ../../react-gh-pages"
end
task :default => [:js]

65
docs/_config.yml Normal file
View File

@@ -0,0 +1,65 @@
---
name: React
description: A JavaScript library for building user interfaces
url: https://facebook.github.io
baseurl: "/react"
permalink: "/blog/:year/:month/:day/:title.html"
paginate_path: "/blog/page:num/"
paginate: 5
timezone: America/Los_Angeles
highlighter: pygments
defaults:
- scope:
path: ''
type: posts
values:
layout: post
sectionid: blog
- scope:
path: blog
type: pages
values:
sectionid: blog
- scope:
path: docs
type: pages
values:
layout: docs
sectionid: docs
- scope:
path: tips
type: pages
values:
sectionid: docs
- scope:
path: contributing
type: pages
values:
sectionid: docs
exclude:
- Gemfile
- Gemfile.lock
- README.md
- Rakefile
- vendor/bundle
markdown: redcarpet
redcarpet:
extensions:
- fenced_code_blocks
- footnotes
sass:
style: :compressed
sass_dir: _css
gems:
- jekyll-redirect-from
- jekyll-paginate
react_version: 15.3.1
react_hashes:
dev: gS+zau+tpUQYisQ0pOWmfNOfcczNoZQjeQ6+5jOgVqV1WBYqkIbdqpay3VuCHQjt
prod: GjSRThJn3fjCmKim4Jou04Ax7vvKfk76xSCKUo7/V70VNIlidvZd3ZnT9rtJk0KM
addons_dev: 37FL10I5CNyIhpG9UrOeUrUKONP5CUt3PYHxWz9Eo4kYWS7weaFzDRP7BxRfhB75
addons_prod: hSlojvw2moZ49rKg6U9wW83sJi7QnWC6nB53jlsGy5hmltJC6ET/cRRKzMifYEg5
dom_dev: yMyOXveaWIIfHWhBZNUrKSPQCw+BWRGucJIdsQeltkvBNDrWXKo+jKVKyx6hH/5r
dom_prod: 3AR/0xGUlR37VpbeHbKQhvizC4T8sNTU8t5GS9JC/4odeRePZuPYl5Pyv/zTeSd8
dom_server_dev: sPg6+OzdWmnH1aArppe66vtLc7tZ2gxh5KxXoZFHAxZoquTi4J71PHASGmv7meE1
dom_server_prod: L4CScwloTXP7xdPmmp3KRAKqASCN8hQpjM6DsrAyCl4K8RXi8Ig+9i0X6k8AyfM9

171
docs/_css/_solarized.scss Normal file
View File

@@ -0,0 +1,171 @@
html * {
color-profile: sRGB;
rendering-intent: auto;
}
.cm-s-solarized-light {
background-color: #f8f5ec;
color: #637c84;
}
.cm-s-solarized-light .emphasis {
font-weight: bold;
}
.cm-s-solarized-light .dotted {
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-light .CodeMirror-gutter {
background-color: #eee8d5;
border-right: 3px solid #eee8d5;
}
.cm-s-solarized-light .CodeMirror-gutter .CodeMirror-gutter-text {
color: #93a1a1;
}
.cm-s-solarized-light .CodeMirror-cursor {
border-left-color: #002b36 !important;
}
.cm-s-solarized-light .CodeMirror-matchingbracket {
color: #002b36;
background-color: #eee8d5;
box-shadow: 0 0 10px #eee8d5;
font-weight: bold;
}
.cm-s-solarized-light .CodeMirror-nonmatchingbracket {
color: #002b36;
background-color: #eee8d5;
box-shadow: 0 0 10px #eee8d5;
font-weight: bold;
color: #dc322f;
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-light span.cm-keyword {
color: #859900;
}
.cm-s-solarized-light span.cm-atom {
color: #2aa198;
}
.cm-s-solarized-light span.cm-number {
color: #586e75;
}
.cm-s-solarized-light span.cm-def {
color: #637c84;
}
.cm-s-solarized-light span.cm-variable {
color: #637c84;
}
.cm-s-solarized-light span.cm-variable-2 {
color: #b58900;
}
.cm-s-solarized-light span.cm-variable-3 {
color: #cb4b16;
}
.cm-s-solarized-light span.cm-comment {
color: #93a1a1;
}
.cm-s-solarized-light span.cm-property {
color: #657b83;
}
.cm-s-solarized-light span.cm-operator {
color: #657b83;
}
.cm-s-solarized-light span.cm-string {
color: #36958e;
}
.cm-s-solarized-light span.cm-error {
font-weight: bold;
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-light span.cm-bracket {
color: #268bd2;
}
.cm-s-solarized-light span.cm-tag {
color: #268bd2;
}
.cm-s-solarized-light span.cm-attribute {
color: #586e75;
}
.cm-s-solarized-light span.cm-meta {
color: #268bd2;
}
.cm-s-solarized-dark {
background-color: #002b36;
color: #839496;
}
.cm-s-solarized-dark .emphasis {
font-weight: bold;
}
.cm-s-solarized-dark .dotted {
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-dark .CodeMirror-gutter {
background-color: #073642;
border-right: 3px solid #073642;
}
.cm-s-solarized-dark .CodeMirror-gutter .CodeMirror-gutter-text {
color: #586e75;
}
.cm-s-solarized-dark .CodeMirror-cursor {
border-left-color: #fdf6e3 !important;
}
.cm-s-solarized-dark .CodeMirror-matchingbracket {
color: #fdf6e3;
background-color: #073642;
box-shadow: 0 0 10px #073642;
font-weight: bold;
}
.cm-s-solarized-dark .CodeMirror-nonmatchingbracket {
color: #fdf6e3;
background-color: #073642;
box-shadow: 0 0 10px #073642;
font-weight: bold;
color: #dc322f;
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-dark span.cm-keyword {
color: #839496;
font-weight: bold;
}
.cm-s-solarized-dark span.cm-atom {
color: #2aa198;
}
.cm-s-solarized-dark span.cm-number {
color: #93a1a1;
}
.cm-s-solarized-dark span.cm-def {
color: #268bd2;
}
.cm-s-solarized-dark span.cm-variable {
color: #cb4b16;
}
.cm-s-solarized-dark span.cm-variable-2 {
color: #cb4b16;
}
.cm-s-solarized-dark span.cm-variable-3 {
color: #cb4b16;
}
.cm-s-solarized-dark span.cm-comment {
color: #586e75;
}
.cm-s-solarized-dark span.cm-property {
color: #b58900;
}
.cm-s-solarized-dark span.cm-operator {
color: #839496;
}
.cm-s-solarized-dark span.cm-string {
color: #6c71c4;
}
.cm-s-solarized-dark span.cm-error {
font-weight: bold;
border-bottom: 1px dotted #cb4b16;
}
.cm-s-solarized-dark span.cm-bracket {
color: #cb4b16;
}
.cm-s-solarized-dark span.cm-tag {
color: #839496;
}
.cm-s-solarized-dark span.cm-attribute {
color: #93a1a1;
}
.cm-s-solarized-dark span.cm-meta {
color: #268bd2;
}

133
docs/_css/_typography.scss Normal file
View File

@@ -0,0 +1,133 @@
@import 'variables.scss';
$textColor: $mediumColor;
$textColorLight: lighten($textColor, 20%);
html {
font-family: $helvetica;
font-family: proxima-nova, $helvetica;
color: $textColor;
line-height: 1.28;
}
p {
margin: 0 0 10px;
}
.subHeader {
font-size: 21px;
font-weight: 200;
line-height: 30px;
margin-bottom: 10px;
}
em {
font-style: italic;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin: 10px 0;
font-family: inherit;
font-weight: bold;
line-height: 20px;
color: inherit;
text-rendering: optimizelegibility;
}
h1 small,
h2 small,
h3 small,
h4 small,
h5 small,
h6 small {
font-weight: normal;
color: $textColorLight
}
h1,
h2,
h3 {
line-height: 40px;
}
h1 {
font-size: 39px;
}
h2 {
font-size: 31px;
}
h3 {
font-size: 23px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
font-size: 11px;
}
h1 small {
font-size: 24px;
}
h2 small {
font-size: 18px;
}
h3 small {
font-size: 16px;
}
h4 small {
font-size: 14px;
}
ul,
ol {
margin: 0 0 10px 25px;
padding: 0;
}
ul ul,
ul ol,
ol ol,
ol ul {
margin-bottom: 0;
}
li {
line-height: 20px;
}
a {
color: $linkColor;
text-decoration: none;
&:hover,
&:focus {
color: $linkInteract;
text-decoration: underline;
}
&:focus {
outline: thin dotted #333;
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
}
.center {
text-align: center;
}

22
docs/_css/_variables.scss Normal file
View File

@@ -0,0 +1,22 @@
$primary: #cc7a6f;
$linkColor: darken($primary, 9%);
$linkInteract: darken($linkColor, 9%);
$pageBg: #f9f9f9;
$lightColor: #e9e9e9;
$mediumestColor: #666;
$mediumColor: #484848;
$darkColor: #2d2d2d;
$darkestColor: #222222;
$blueColor: #61dafb;
$orangeColor: complement($blueColor);
$lightTextColor: #fafafa;
$mediumTextColor: #aaa;
$darkTextColor: $mediumColor;
$buttonBlueTop: #77a3d2;
$buttonBlueBottom: #4783c2;
$buttonGreyTop: #9a9a9a;
$buttonGreyBottom: #646464;

View File

@@ -0,0 +1,8 @@
//************************************************************************//
// These mixins/functions are deprecated
// They will be removed in the next MAJOR version release
//************************************************************************//
@mixin inline-block {
display: inline-block;
@warn "inline-block mixin is deprecated and will be removed in the next major version release";
}

79
docs/_css/bourbon/_bourbon.scss vendored Normal file
View File

@@ -0,0 +1,79 @@
// Settings
@import "settings/prefixer";
@import "settings/px-to-em";
@import "settings/asset-pipeline";
// Custom Helpers
@import "helpers/convert-units";
@import "helpers/gradient-positions-parser";
@import "helpers/is-num";
@import "helpers/linear-angle-parser";
@import "helpers/linear-gradient-parser";
@import "helpers/linear-positions-parser";
@import "helpers/linear-side-corner-parser";
@import "helpers/radial-arg-parser";
@import "helpers/radial-positions-parser";
@import "helpers/radial-gradient-parser";
@import "helpers/render-gradients";
@import "helpers/shape-size-stripper";
@import "helpers/str-to-num";
// Custom Functions
@import "functions/assign";
@import "functions/color-lightness";
@import "functions/flex-grid";
@import "functions/golden-ratio";
@import "functions/grid-width";
@import "functions/modular-scale";
@import "functions/px-to-em";
@import "functions/px-to-rem";
@import "functions/strip-units";
@import "functions/tint-shade";
@import "functions/transition-property-name";
@import "functions/unpack";
// CSS3 Mixins
@import "css3/animation";
@import "css3/appearance";
@import "css3/backface-visibility";
@import "css3/background";
@import "css3/background-image";
@import "css3/border-image";
@import "css3/border-radius";
@import "css3/box-sizing";
@import "css3/calc";
@import "css3/columns";
@import "css3/filter";
@import "css3/flex-box";
@import "css3/font-face";
@import "css3/font-feature-settings";
@import "css3/hyphens";
@import "css3/hidpi-media-query";
@import "css3/image-rendering";
@import "css3/keyframes";
@import "css3/linear-gradient";
@import "css3/perspective";
@import "css3/radial-gradient";
@import "css3/transform";
@import "css3/transition";
@import "css3/user-select";
@import "css3/placeholder";
// Addons & other mixins
@import "addons/button";
@import "addons/clearfix";
@import "addons/directional-values";
@import "addons/ellipsis";
@import "addons/font-family";
@import "addons/hide-text";
@import "addons/html5-input-types";
@import "addons/position";
@import "addons/prefixer";
@import "addons/retina-image";
@import "addons/size";
@import "addons/timing-functions";
@import "addons/triangle";
@import "addons/word-wrap";
// Soon to be deprecated Mixins
@import "bourbon-deprecated-upcoming";

374
docs/_css/bourbon/addons/_button.scss vendored Normal file
View File

@@ -0,0 +1,374 @@
@mixin button ($style: simple, $base-color: #4294f0, $text-size: inherit, $padding: 7px 18px) {
@if type-of($style) == string and type-of($base-color) == color {
@include buttonstyle($style, $base-color, $text-size, $padding);
}
@if type-of($style) == string and type-of($base-color) == number {
$padding: $text-size;
$text-size: $base-color;
$base-color: #4294f0;
@if $padding == inherit {
$padding: 7px 18px;
}
@include buttonstyle($style, $base-color, $text-size, $padding);
}
@if type-of($style) == color and type-of($base-color) == color {
$base-color: $style;
$style: simple;
@include buttonstyle($style, $base-color, $text-size, $padding);
}
@if type-of($style) == color and type-of($base-color) == number {
$padding: $text-size;
$text-size: $base-color;
$base-color: $style;
$style: simple;
@if $padding == inherit {
$padding: 7px 18px;
}
@include buttonstyle($style, $base-color, $text-size, $padding);
}
@if type-of($style) == number {
$padding: $base-color;
$text-size: $style;
$base-color: #4294f0;
$style: simple;
@if $padding == #4294f0 {
$padding: 7px 18px;
}
@include buttonstyle($style, $base-color, $text-size, $padding);
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
// Selector Style Button
//************************************************************************//
@mixin buttonstyle($type, $b-color, $t-size, $pad) {
// Grayscale button
@if $type == simple and $b-color == grayscale($b-color) {
@include simple($b-color, true, $t-size, $pad);
}
@if $type == shiny and $b-color == grayscale($b-color) {
@include shiny($b-color, true, $t-size, $pad);
}
@if $type == pill and $b-color == grayscale($b-color) {
@include pill($b-color, true, $t-size, $pad);
}
@if $type == flat and $b-color == grayscale($b-color) {
@include flat($b-color, true, $t-size, $pad);
}
// Colored button
@if $type == simple {
@include simple($b-color, false, $t-size, $pad);
}
@else if $type == shiny {
@include shiny($b-color, false, $t-size, $pad);
}
@else if $type == pill {
@include pill($b-color, false, $t-size, $pad);
}
@else if $type == flat {
@include flat($b-color, false, $t-size, $pad);
}
}
// Simple Button
//************************************************************************//
@mixin simple($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) {
$color: hsl(0, 0, 100%);
$border: adjust-color($base-color, $saturation: 9%, $lightness: -14%);
$inset-shadow: adjust-color($base-color, $saturation: -8%, $lightness: 15%);
$stop-gradient: adjust-color($base-color, $saturation: 9%, $lightness: -11%);
$text-shadow: adjust-color($base-color, $saturation: 15%, $lightness: -18%);
@if is-light($base-color) {
$color: hsl(0, 0, 20%);
$text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%);
}
@if $grayscale == true {
$border: grayscale($border);
$inset-shadow: grayscale($inset-shadow);
$stop-gradient: grayscale($stop-gradient);
$text-shadow: grayscale($text-shadow);
}
border: 1px solid $border;
border-radius: 3px;
box-shadow: inset 0 1px 0 0 $inset-shadow;
color: $color;
display: inline-block;
font-size: $textsize;
font-weight: bold;
@include linear-gradient ($base-color, $stop-gradient);
padding: $padding;
text-decoration: none;
text-shadow: 0 1px 0 $text-shadow;
background-clip: padding-box;
&:hover:not(:disabled) {
$base-color-hover: adjust-color($base-color, $saturation: -4%, $lightness: -5%);
$inset-shadow-hover: adjust-color($base-color, $saturation: -7%, $lightness: 5%);
$stop-gradient-hover: adjust-color($base-color, $saturation: 8%, $lightness: -14%);
@if $grayscale == true {
$base-color-hover: grayscale($base-color-hover);
$inset-shadow-hover: grayscale($inset-shadow-hover);
$stop-gradient-hover: grayscale($stop-gradient-hover);
}
box-shadow: inset 0 1px 0 0 $inset-shadow-hover;
cursor: pointer;
@include linear-gradient ($base-color-hover, $stop-gradient-hover);
}
&:active:not(:disabled),
&:focus:not(:disabled) {
$border-active: adjust-color($base-color, $saturation: 9%, $lightness: -14%);
$inset-shadow-active: adjust-color($base-color, $saturation: 7%, $lightness: -17%);
@if $grayscale == true {
$border-active: grayscale($border-active);
$inset-shadow-active: grayscale($inset-shadow-active);
}
border: 1px solid $border-active;
box-shadow: inset 0 0 8px 4px $inset-shadow-active, inset 0 0 8px 4px $inset-shadow-active;
}
}
// Shiny Button
//************************************************************************//
@mixin shiny($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) {
$color: hsl(0, 0, 100%);
$border: adjust-color($base-color, $red: -117, $green: -111, $blue: -81);
$border-bottom: adjust-color($base-color, $red: -126, $green: -127, $blue: -122);
$fourth-stop: adjust-color($base-color, $red: -79, $green: -70, $blue: -46);
$inset-shadow: adjust-color($base-color, $red: 37, $green: 29, $blue: 12);
$second-stop: adjust-color($base-color, $red: -56, $green: -50, $blue: -33);
$text-shadow: adjust-color($base-color, $red: -140, $green: -141, $blue: -114);
$third-stop: adjust-color($base-color, $red: -86, $green: -75, $blue: -48);
@if is-light($base-color) {
$color: hsl(0, 0, 20%);
$text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%);
}
@if $grayscale == true {
$border: grayscale($border);
$border-bottom: grayscale($border-bottom);
$fourth-stop: grayscale($fourth-stop);
$inset-shadow: grayscale($inset-shadow);
$second-stop: grayscale($second-stop);
$text-shadow: grayscale($text-shadow);
$third-stop: grayscale($third-stop);
}
border: 1px solid $border;
border-bottom: 1px solid $border-bottom;
border-radius: 5px;
box-shadow: inset 0 1px 0 0 $inset-shadow;
color: $color;
display: inline-block;
font-size: $textsize;
font-weight: bold;
@include linear-gradient(top, $base-color 0%, $second-stop 50%, $third-stop 50%, $fourth-stop 100%);
padding: $padding;
text-align: center;
text-decoration: none;
text-shadow: 0 -1px 1px $text-shadow;
&:hover:not(:disabled) {
$first-stop-hover: adjust-color($base-color, $red: -13, $green: -15, $blue: -18);
$second-stop-hover: adjust-color($base-color, $red: -66, $green: -62, $blue: -51);
$third-stop-hover: adjust-color($base-color, $red: -93, $green: -85, $blue: -66);
$fourth-stop-hover: adjust-color($base-color, $red: -86, $green: -80, $blue: -63);
@if $grayscale == true {
$first-stop-hover: grayscale($first-stop-hover);
$second-stop-hover: grayscale($second-stop-hover);
$third-stop-hover: grayscale($third-stop-hover);
$fourth-stop-hover: grayscale($fourth-stop-hover);
}
cursor: pointer;
@include linear-gradient(top, $first-stop-hover 0%,
$second-stop-hover 50%,
$third-stop-hover 50%,
$fourth-stop-hover 100%);
}
&:active:not(:disabled),
&:focus:not(:disabled) {
$inset-shadow-active: adjust-color($base-color, $red: -111, $green: -116, $blue: -122);
@if $grayscale == true {
$inset-shadow-active: grayscale($inset-shadow-active);
}
box-shadow: inset 0 0 20px 0 $inset-shadow-active;
}
}
// Pill Button
//************************************************************************//
@mixin pill($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) {
$color: hsl(0, 0, 100%);
$border-bottom: adjust-color($base-color, $hue: 8, $saturation: -11%, $lightness: -26%);
$border-sides: adjust-color($base-color, $hue: 4, $saturation: -21%, $lightness: -21%);
$border-top: adjust-color($base-color, $hue: -1, $saturation: -30%, $lightness: -15%);
$inset-shadow: adjust-color($base-color, $hue: -1, $saturation: -1%, $lightness: 7%);
$stop-gradient: adjust-color($base-color, $hue: 8, $saturation: 14%, $lightness: -10%);
$text-shadow: adjust-color($base-color, $hue: 5, $saturation: -19%, $lightness: -15%);
@if is-light($base-color) {
$color: hsl(0, 0, 20%);
$text-shadow: adjust-color($base-color, $saturation: 10%, $lightness: 4%);
}
@if $grayscale == true {
$border-bottom: grayscale($border-bottom);
$border-sides: grayscale($border-sides);
$border-top: grayscale($border-top);
$inset-shadow: grayscale($inset-shadow);
$stop-gradient: grayscale($stop-gradient);
$text-shadow: grayscale($text-shadow);
}
border: 1px solid $border-top;
border-color: $border-top $border-sides $border-bottom;
border-radius: 16px;
box-shadow: inset 0 1px 0 0 $inset-shadow;
color: $color;
display: inline-block;
font-size: $textsize;
font-weight: normal;
line-height: 1;
@include linear-gradient ($base-color, $stop-gradient);
padding: $padding;
text-align: center;
text-decoration: none;
text-shadow: 0 -1px 1px $text-shadow;
background-clip: padding-box;
&:hover:not(:disabled) {
$base-color-hover: adjust-color($base-color, $lightness: -4.5%);
$border-bottom: adjust-color($base-color, $hue: 8, $saturation: 13.5%, $lightness: -32%);
$border-sides: adjust-color($base-color, $hue: 4, $saturation: -2%, $lightness: -27%);
$border-top: adjust-color($base-color, $hue: -1, $saturation: -17%, $lightness: -21%);
$inset-shadow-hover: adjust-color($base-color, $saturation: -1%, $lightness: 3%);
$stop-gradient-hover: adjust-color($base-color, $hue: 8, $saturation: -4%, $lightness: -15.5%);
$text-shadow-hover: adjust-color($base-color, $hue: 5, $saturation: -5%, $lightness: -22%);
@if $grayscale == true {
$base-color-hover: grayscale($base-color-hover);
$border-bottom: grayscale($border-bottom);
$border-sides: grayscale($border-sides);
$border-top: grayscale($border-top);
$inset-shadow-hover: grayscale($inset-shadow-hover);
$stop-gradient-hover: grayscale($stop-gradient-hover);
$text-shadow-hover: grayscale($text-shadow-hover);
}
border: 1px solid $border-top;
border-color: $border-top $border-sides $border-bottom;
box-shadow: inset 0 1px 0 0 $inset-shadow-hover;
cursor: pointer;
@include linear-gradient ($base-color-hover, $stop-gradient-hover);
text-shadow: 0 -1px 1px $text-shadow-hover;
background-clip: padding-box;
}
&:active:not(:disabled),
&:focus:not(:disabled) {
$active-color: adjust-color($base-color, $hue: 4, $saturation: -12%, $lightness: -10%);
$border-active: adjust-color($base-color, $hue: 6, $saturation: -2.5%, $lightness: -30%);
$border-bottom-active: adjust-color($base-color, $hue: 11, $saturation: 6%, $lightness: -31%);
$inset-shadow-active: adjust-color($base-color, $hue: 9, $saturation: 2%, $lightness: -21.5%);
$text-shadow-active: adjust-color($base-color, $hue: 5, $saturation: -12%, $lightness: -21.5%);
@if $grayscale == true {
$active-color: grayscale($active-color);
$border-active: grayscale($border-active);
$border-bottom-active: grayscale($border-bottom-active);
$inset-shadow-active: grayscale($inset-shadow-active);
$text-shadow-active: grayscale($text-shadow-active);
}
background: $active-color;
border: 1px solid $border-active;
border-bottom: 1px solid $border-bottom-active;
box-shadow: inset 0 0 6px 3px $inset-shadow-active;
text-shadow: 0 -1px 1px $text-shadow-active;
}
}
// Flat Button
//************************************************************************//
@mixin flat($base-color, $grayscale: false, $textsize: inherit, $padding: 7px 18px) {
$color: hsl(0, 0, 100%);
@if is-light($base-color) {
$color: hsl(0, 0, 20%);
}
background-color: $base-color;
border-radius: 3px;
border: none;
color: $color;
display: inline-block;
font-size: inherit;
font-weight: bold;
padding: 7px 18px;
text-decoration: none;
background-clip: padding-box;
&:hover:not(:disabled){
$base-color-hover: adjust-color($base-color, $saturation: 4%, $lightness: 5%);
@if $grayscale == true {
$base-color-hover: grayscale($base-color-hover);
}
background-color: $base-color-hover;
cursor: pointer;
}
&:active:not(:disabled),
&:focus:not(:disabled) {
$base-color-active: adjust-color($base-color, $saturation: -4%, $lightness: -5%);
@if $grayscale == true {
$base-color-active: grayscale($base-color-active);
}
background-color: $base-color-active;
cursor: pointer;
}
}

23
docs/_css/bourbon/addons/_clearfix.scss vendored Normal file
View File

@@ -0,0 +1,23 @@
// Modern micro clearfix provides an easy way to contain floats without adding additional markup.
//
// Example usage:
//
// // Contain all floats within .wrapper
// .wrapper {
// @include clearfix;
// .content,
// .sidebar {
// float : left;
// }
// }
@mixin clearfix {
&:after {
content:"";
display:table;
clear:both;
}
}
// Acknowledgements
// Beat *that* clearfix: [Thierry Koblentz](http://www.css-101.org/articles/clearfix/latest-new-clearfix-so-far.php)

View File

@@ -0,0 +1,111 @@
// directional-property mixins are shorthands
// for writing properties like the following
//
// @include margin(null 0 10px);
// ------
// margin-right: 0;
// margin-bottom: 10px;
// margin-left: 0;
//
// - or -
//
// @include border-style(dotted null);
// ------
// border-top-style: dotted;
// border-bottom-style: dotted;
//
// ------
//
// Note: You can also use false instead of null
@function collapse-directionals($vals) {
$output: null;
$A: nth( $vals, 1 );
$B: if( length($vals) < 2, $A, nth($vals, 2));
$C: if( length($vals) < 3, $A, nth($vals, 3));
$D: if( length($vals) < 2, $A, nth($vals, if( length($vals) < 4, 2, 4) ));
@if $A == 0 { $A: 0 }
@if $B == 0 { $B: 0 }
@if $C == 0 { $C: 0 }
@if $D == 0 { $D: 0 }
@if $A == $B and $A == $C and $A == $D { $output: $A }
@else if $A == $C and $B == $D { $output: $A $B }
@else if $B == $D { $output: $A $B $C }
@else { $output: $A $B $C $D }
@return $output;
}
@function contains-falsy($list) {
@each $item in $list {
@if not $item {
@return true;
}
}
@return false;
}
@mixin directional-property($pre, $suf, $vals) {
// Property Names
$top: $pre + "-top" + if($suf, "-#{$suf}", "");
$bottom: $pre + "-bottom" + if($suf, "-#{$suf}", "");
$left: $pre + "-left" + if($suf, "-#{$suf}", "");
$right: $pre + "-right" + if($suf, "-#{$suf}", "");
$all: $pre + if($suf, "-#{$suf}", "");
$vals: collapse-directionals($vals);
@if contains-falsy($vals) {
@if nth($vals, 1) { #{$top}: nth($vals, 1); }
@if length($vals) == 1 {
@if nth($vals, 1) { #{$right}: nth($vals, 1); }
} @else {
@if nth($vals, 2) { #{$right}: nth($vals, 2); }
}
// prop: top/bottom right/left
@if length($vals) == 2 {
@if nth($vals, 1) { #{$bottom}: nth($vals, 1); }
@if nth($vals, 2) { #{$left}: nth($vals, 2); }
// prop: top right/left bottom
} @else if length($vals) == 3 {
@if nth($vals, 3) { #{$bottom}: nth($vals, 3); }
@if nth($vals, 2) { #{$left}: nth($vals, 2); }
// prop: top right bottom left
} @else if length($vals) == 4 {
@if nth($vals, 3) { #{$bottom}: nth($vals, 3); }
@if nth($vals, 4) { #{$left}: nth($vals, 4); }
}
// prop: top/right/bottom/left
} @else {
#{$all}: $vals;
}
}
@mixin margin($vals...) {
@include directional-property(margin, false, $vals...);
}
@mixin padding($vals...) {
@include directional-property(padding, false, $vals...);
}
@mixin border-style($vals...) {
@include directional-property(border, style, $vals...);
}
@mixin border-color($vals...) {
@include directional-property(border, color, $vals...);
}
@mixin border-width($vals...) {
@include directional-property(border, width, $vals...);
}

View File

@@ -0,0 +1,7 @@
@mixin ellipsis($width: 100%) {
display: inline-block;
max-width: $width;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}

View File

@@ -0,0 +1,5 @@
$georgia: Georgia, Cambria, "Times New Roman", Times, serif;
$helvetica: "Helvetica Neue", Helvetica, Roboto, Arial, sans-serif;
$lucida-grande: "Lucida Grande", Tahoma, Verdana, Arial, sans-serif;
$monospace: "Bitstream Vera Sans Mono", Consolas, Courier, monospace;
$verdana: Verdana, Geneva, sans-serif;

View File

@@ -0,0 +1,10 @@
@mixin hide-text {
overflow: hidden;
&:before {
content: "";
display: block;
width: 0;
height: 100%;
}
}

View File

@@ -0,0 +1,86 @@
//************************************************************************//
// Generate a variable ($all-text-inputs) with a list of all html5
// input types that have a text-based input, excluding textarea.
// http://diveintohtml5.org/forms.html
//************************************************************************//
$inputs-list: 'input[type="email"]',
'input[type="number"]',
'input[type="password"]',
'input[type="search"]',
'input[type="tel"]',
'input[type="text"]',
'input[type="url"]',
// Webkit & Gecko may change the display of these in the future
'input[type="color"]',
'input[type="date"]',
'input[type="datetime"]',
'input[type="datetime-local"]',
'input[type="month"]',
'input[type="time"]',
'input[type="week"]';
// Bare inputs
//************************************************************************//
$all-text-inputs: assign-inputs($inputs-list);
// Hover Pseudo-class
//************************************************************************//
$all-text-inputs-hover: assign-inputs($inputs-list, hover);
// Focus Pseudo-class
//************************************************************************//
$all-text-inputs-focus: assign-inputs($inputs-list, focus);
// You must use interpolation on the variable:
// #{$all-text-inputs}
// #{$all-text-inputs-hover}
// #{$all-text-inputs-focus}
// Example
//************************************************************************//
// #{$all-text-inputs}, textarea {
// border: 1px solid red;
// }
//************************************************************************//
// Generate a variable ($all-button-inputs) with a list of all html5
// input types that have a button-based input, excluding button.
//************************************************************************//
$inputs-button-list: 'input[type="button"]',
'input[type="reset"]',
'input[type="submit"]';
// Bare inputs
//************************************************************************//
$all-button-inputs: assign-inputs($inputs-button-list);
// Hover Pseudo-class
//************************************************************************//
$all-button-inputs-hover: assign-inputs($inputs-button-list, hover);
// Focus Pseudo-class
//************************************************************************//
$all-button-inputs-focus: assign-inputs($inputs-button-list, focus);
// Active Pseudo-class
//************************************************************************//
$all-button-inputs-active: assign-inputs($inputs-button-list, active);
// You must use interpolation on the variable:
// #{$all-button-inputs}
// #{$all-button-inputs-hover}
// #{$all-button-inputs-focus}
// #{$all-button-inputs-active}
// Example
//************************************************************************//
// #{$all-button-inputs}, button {
// border: 1px solid red;
// }

32
docs/_css/bourbon/addons/_position.scss vendored Normal file
View File

@@ -0,0 +1,32 @@
@mixin position ($position: relative, $coordinates: null null null null) {
@if type-of($position) == list {
$coordinates: $position;
$position: relative;
}
$coordinates: unpack($coordinates);
$top: nth($coordinates, 1);
$right: nth($coordinates, 2);
$bottom: nth($coordinates, 3);
$left: nth($coordinates, 4);
position: $position;
@if ($top and $top == auto) or (type-of($top) == number) {
top: $top;
}
@if ($right and $right == auto) or (type-of($right) == number) {
right: $right;
}
@if ($bottom and $bottom == auto) or (type-of($bottom) == number) {
bottom: $bottom;
}
@if ($left and $left == auto) or (type-of($left) == number) {
left: $left;
}
}

45
docs/_css/bourbon/addons/_prefixer.scss vendored Normal file
View File

@@ -0,0 +1,45 @@
//************************************************************************//
// Example: @include prefixer(border-radius, $radii, webkit ms spec);
//************************************************************************//
// Variables located in /settings/_prefixer.scss
@mixin prefixer ($property, $value, $prefixes) {
@each $prefix in $prefixes {
@if $prefix == webkit {
@if $prefix-for-webkit {
-webkit-#{$property}: $value;
}
}
@else if $prefix == moz {
@if $prefix-for-mozilla {
-moz-#{$property}: $value;
}
}
@else if $prefix == ms {
@if $prefix-for-microsoft {
-ms-#{$property}: $value;
}
}
@else if $prefix == o {
@if $prefix-for-opera {
-o-#{$property}: $value;
}
}
@else if $prefix == spec {
@if $prefix-for-spec {
#{$property}: $value;
}
}
@else {
@warn "Unrecognized prefix: #{$prefix}";
}
}
}
@mixin disable-prefix-for-all() {
$prefix-for-webkit: false !global;
$prefix-for-mozilla: false !global;
$prefix-for-microsoft: false !global;
$prefix-for-opera: false !global;
$prefix-for-spec: false !global;
}

View File

@@ -0,0 +1,31 @@
@mixin retina-image($filename, $background-size, $extension: png, $retina-filename: null, $retina-suffix: _2x, $asset-pipeline: $asset-pipeline) {
@if $asset-pipeline {
background-image: image-url("#{$filename}.#{$extension}");
}
@else {
background-image: url("#{$filename}.#{$extension}");
}
@include hidpi {
@if $asset-pipeline {
@if $retina-filename {
background-image: image-url("#{$retina-filename}.#{$extension}");
}
@else {
background-image: image-url("#{$filename}#{$retina-suffix}.#{$extension}");
}
}
@else {
@if $retina-filename {
background-image: url("#{$retina-filename}.#{$extension}");
}
@else {
background-image: url("#{$filename}#{$retina-suffix}.#{$extension}");
}
}
background-size: $background-size;
}
}

16
docs/_css/bourbon/addons/_size.scss vendored Normal file
View File

@@ -0,0 +1,16 @@
@mixin size($size) {
$height: nth($size, 1);
$width: $height;
@if length($size) > 1 {
$height: nth($size, 2);
}
@if $height == auto or (type-of($height) == number and not unitless($height)) {
height: $height;
}
@if $width == auto or (type-of($width) == number and not unitless($width)) {
width: $width;
}
}

View File

@@ -0,0 +1,32 @@
// CSS cubic-bezier timing functions. Timing functions courtesy of jquery.easie (github.com/jaukia/easie)
// Timing functions are the same as demo'ed here: http://jqueryui.com/resources/demos/effect/easing.html
// EASE IN
$ease-in-quad: cubic-bezier(0.550, 0.085, 0.680, 0.530);
$ease-in-cubic: cubic-bezier(0.550, 0.055, 0.675, 0.190);
$ease-in-quart: cubic-bezier(0.895, 0.030, 0.685, 0.220);
$ease-in-quint: cubic-bezier(0.755, 0.050, 0.855, 0.060);
$ease-in-sine: cubic-bezier(0.470, 0.000, 0.745, 0.715);
$ease-in-expo: cubic-bezier(0.950, 0.050, 0.795, 0.035);
$ease-in-circ: cubic-bezier(0.600, 0.040, 0.980, 0.335);
$ease-in-back: cubic-bezier(0.600, -0.280, 0.735, 0.045);
// EASE OUT
$ease-out-quad: cubic-bezier(0.250, 0.460, 0.450, 0.940);
$ease-out-cubic: cubic-bezier(0.215, 0.610, 0.355, 1.000);
$ease-out-quart: cubic-bezier(0.165, 0.840, 0.440, 1.000);
$ease-out-quint: cubic-bezier(0.230, 1.000, 0.320, 1.000);
$ease-out-sine: cubic-bezier(0.390, 0.575, 0.565, 1.000);
$ease-out-expo: cubic-bezier(0.190, 1.000, 0.220, 1.000);
$ease-out-circ: cubic-bezier(0.075, 0.820, 0.165, 1.000);
$ease-out-back: cubic-bezier(0.175, 0.885, 0.320, 1.275);
// EASE IN OUT
$ease-in-out-quad: cubic-bezier(0.455, 0.030, 0.515, 0.955);
$ease-in-out-cubic: cubic-bezier(0.645, 0.045, 0.355, 1.000);
$ease-in-out-quart: cubic-bezier(0.770, 0.000, 0.175, 1.000);
$ease-in-out-quint: cubic-bezier(0.860, 0.000, 0.070, 1.000);
$ease-in-out-sine: cubic-bezier(0.445, 0.050, 0.550, 0.950);
$ease-in-out-expo: cubic-bezier(1.000, 0.000, 0.000, 1.000);
$ease-in-out-circ: cubic-bezier(0.785, 0.135, 0.150, 0.860);
$ease-in-out-back: cubic-bezier(0.680, -0.550, 0.265, 1.550);

83
docs/_css/bourbon/addons/_triangle.scss vendored Normal file
View File

@@ -0,0 +1,83 @@
@mixin triangle ($size, $color, $direction) {
height: 0;
width: 0;
$width: nth($size, 1);
$height: nth($size, length($size));
$foreground-color: nth($color, 1);
$background-color: if(length($color) == 2, nth($color, 2), transparent);
@if ($direction == up) or ($direction == down) or ($direction == right) or ($direction == left) {
$width: $width / 2;
$height: if(length($size) > 1, $height, $height/2);
@if $direction == up {
border-left: $width solid $background-color;
border-right: $width solid $background-color;
border-bottom: $height solid $foreground-color;
} @else if $direction == right {
border-top: $width solid $background-color;
border-bottom: $width solid $background-color;
border-left: $height solid $foreground-color;
} @else if $direction == down {
border-left: $width solid $background-color;
border-right: $width solid $background-color;
border-top: $height solid $foreground-color;
} @else if $direction == left {
border-top: $width solid $background-color;
border-bottom: $width solid $background-color;
border-right: $height solid $foreground-color;
}
}
@else if ($direction == up-right) or ($direction == up-left) {
border-top: $height solid $foreground-color;
@if $direction == up-right {
border-left: $width solid $background-color;
} @else if $direction == up-left {
border-right: $width solid $background-color;
}
}
@else if ($direction == down-right) or ($direction == down-left) {
border-bottom: $height solid $foreground-color;
@if $direction == down-right {
border-left: $width solid $background-color;
} @else if $direction == down-left {
border-right: $width solid $background-color;
}
}
@else if ($direction == inset-up) {
border-width: $height $width;
border-style: solid;
border-color: $background-color $background-color $foreground-color;
}
@else if ($direction == inset-down) {
border-width: $height $width;
border-style: solid;
border-color: $foreground-color $background-color $background-color;
}
@else if ($direction == inset-right) {
border-width: $width $height;
border-style: solid;
border-color: $background-color $background-color $background-color $foreground-color;
}
@else if ($direction == inset-left) {
border-width: $width $height;
border-style: solid;
border-color: $background-color $foreground-color $background-color $background-color;
}
}

View File

@@ -0,0 +1,8 @@
@mixin word-wrap($wrap: break-word) {
word-wrap: $wrap;
@if $wrap == break-word {
overflow-wrap: break-word;
word-break: break-all;
}
}

52
docs/_css/bourbon/css3/_animation.scss vendored Normal file
View File

@@ -0,0 +1,52 @@
// http://www.w3.org/TR/css3-animations/#the-animation-name-property-
// Each of these mixins support comma separated lists of values, which allows different transitions for individual properties to be described in a single style rule. Each value in the list corresponds to the value at that same position in the other properties.
// Official animation shorthand property.
@mixin animation ($animations...) {
@include prefixer(animation, $animations, webkit moz spec);
}
// Individual Animation Properties
@mixin animation-name ($names...) {
@include prefixer(animation-name, $names, webkit moz spec);
}
@mixin animation-duration ($times...) {
@include prefixer(animation-duration, $times, webkit moz spec);
}
@mixin animation-timing-function ($motions...) {
// ease | linear | ease-in | ease-out | ease-in-out
@include prefixer(animation-timing-function, $motions, webkit moz spec);
}
@mixin animation-iteration-count ($values...) {
// infinite | <number>
@include prefixer(animation-iteration-count, $values, webkit moz spec);
}
@mixin animation-direction ($directions...) {
// normal | alternate
@include prefixer(animation-direction, $directions, webkit moz spec);
}
@mixin animation-play-state ($states...) {
// running | paused
@include prefixer(animation-play-state, $states, webkit moz spec);
}
@mixin animation-delay ($times...) {
@include prefixer(animation-delay, $times, webkit moz spec);
}
@mixin animation-fill-mode ($modes...) {
// none | forwards | backwards | both
@include prefixer(animation-fill-mode, $modes, webkit moz spec);
}

View File

@@ -0,0 +1,3 @@
@mixin appearance ($value) {
@include prefixer(appearance, $value, webkit moz ms o spec);
}

View File

@@ -0,0 +1,6 @@
//************************************************************************//
// Backface-visibility mixin
//************************************************************************//
@mixin backface-visibility($visibility) {
@include prefixer(backface-visibility, $visibility, webkit spec);
}

View File

@@ -0,0 +1,42 @@
//************************************************************************//
// Background-image property for adding multiple background images with
// gradients, or for stringing multiple gradients together.
//************************************************************************//
@mixin background-image($images...) {
$webkit-images: ();
$spec-images: ();
@each $image in $images {
$webkit-image: ();
$spec-image: ();
@if (type-of($image) == string) {
$url-str: str-slice($image, 0, 3);
$gradient-type: str-slice($image, 0, 6);
@if $url-str == "url" {
$webkit-image: $image;
$spec-image: $image;
}
@else if $gradient-type == "linear" {
$gradients: _linear-gradient-parser($image);
$webkit-image: map-get($gradients, webkit-image);
$spec-image: map-get($gradients, spec-image);
}
@else if $gradient-type == "radial" {
$gradients: _radial-gradient-parser($image);
$webkit-image: map-get($gradients, webkit-image);
$spec-image: map-get($gradients, spec-image);
}
}
$webkit-images: append($webkit-images, $webkit-image, comma);
$spec-images: append($spec-images, $spec-image, comma);
}
background-image: $webkit-images;
background-image: $spec-images;
}

55
docs/_css/bourbon/css3/_background.scss vendored Normal file
View File

@@ -0,0 +1,55 @@
//************************************************************************//
// Background property for adding multiple backgrounds using shorthand
// notation.
//************************************************************************//
@mixin background($backgrounds...) {
$webkit-backgrounds: ();
$spec-backgrounds: ();
@each $background in $backgrounds {
$webkit-background: ();
$spec-background: ();
$background-type: type-of($background);
@if $background-type == string or list {
$background-str: if($background-type == list, nth($background, 1), $background);
$url-str: str-slice($background-str, 0, 3);
$gradient-type: str-slice($background-str, 0, 6);
@if $url-str == "url" {
$webkit-background: $background;
$spec-background: $background;
}
@else if $gradient-type == "linear" {
$gradients: _linear-gradient-parser("#{$background}");
$webkit-background: map-get($gradients, webkit-image);
$spec-background: map-get($gradients, spec-image);
}
@else if $gradient-type == "radial" {
$gradients: _radial-gradient-parser("#{$background}");
$webkit-background: map-get($gradients, webkit-image);
$spec-background: map-get($gradients, spec-image);
}
@else {
$webkit-background: $background;
$spec-background: $background;
}
}
@else {
$webkit-background: $background;
$spec-background: $background;
}
$webkit-backgrounds: append($webkit-backgrounds, $webkit-background, comma);
$spec-backgrounds: append($spec-backgrounds, $spec-background, comma);
}
background: $webkit-backgrounds;
background: $spec-backgrounds;
}

View File

@@ -0,0 +1,59 @@
@mixin border-image($borders...) {
$webkit-borders: ();
$spec-borders: ();
@each $border in $borders {
$webkit-border: ();
$spec-border: ();
$border-type: type-of($border);
@if $border-type == string or list {
$border-str: if($border-type == list, nth($border, 1), $border);
$url-str: str-slice($border-str, 0, 3);
$gradient-type: str-slice($border-str, 0, 6);
@if $url-str == "url" {
$webkit-border: $border;
$spec-border: $border;
}
@else if $gradient-type == "linear" {
$gradients: _linear-gradient-parser("#{$border}");
$webkit-border: map-get($gradients, webkit-image);
$spec-border: map-get($gradients, spec-image);
}
@else if $gradient-type == "radial" {
$gradients: _radial-gradient-parser("#{$border}");
$webkit-border: map-get($gradients, webkit-image);
$spec-border: map-get($gradients, spec-image);
}
@else {
$webkit-border: $border;
$spec-border: $border;
}
}
@else {
$webkit-border: $border;
$spec-border: $border;
}
$webkit-borders: append($webkit-borders, $webkit-border, comma);
$spec-borders: append($spec-borders, $spec-border, comma);
}
-webkit-border-image: $webkit-borders;
border-image: $spec-borders;
border-style: solid;
}
//Examples:
// @include border-image(url("image.png"));
// @include border-image(url("image.png") 20 stretch);
// @include border-image(linear-gradient(45deg, orange, yellow));
// @include border-image(linear-gradient(45deg, orange, yellow) stretch);
// @include border-image(linear-gradient(45deg, orange, yellow) 20 30 40 50 stretch round);
// @include border-image(radial-gradient(top, cover, orange, yellow, orange));

View File

@@ -0,0 +1,22 @@
//************************************************************************//
// Shorthand Border-radius mixins
//************************************************************************//
@mixin border-top-radius($radii) {
@include prefixer(border-top-left-radius, $radii, spec);
@include prefixer(border-top-right-radius, $radii, spec);
}
@mixin border-bottom-radius($radii) {
@include prefixer(border-bottom-left-radius, $radii, spec);
@include prefixer(border-bottom-right-radius, $radii, spec);
}
@mixin border-left-radius($radii) {
@include prefixer(border-top-left-radius, $radii, spec);
@include prefixer(border-bottom-left-radius, $radii, spec);
}
@mixin border-right-radius($radii) {
@include prefixer(border-top-right-radius, $radii, spec);
@include prefixer(border-bottom-right-radius, $radii, spec);
}

View File

@@ -0,0 +1,4 @@
@mixin box-sizing ($box) {
// content-box | border-box | inherit
@include prefixer(box-sizing, $box, webkit moz spec);
}

4
docs/_css/bourbon/css3/_calc.scss vendored Normal file
View File

@@ -0,0 +1,4 @@
@mixin calc($property, $value) {
#{$property}: -webkit-calc(#{$value});
#{$property}: calc(#{$value});
}

47
docs/_css/bourbon/css3/_columns.scss vendored Normal file
View File

@@ -0,0 +1,47 @@
@mixin columns($arg: auto) {
// <column-count> || <column-width>
@include prefixer(columns, $arg, webkit moz spec);
}
@mixin column-count($int: auto) {
// auto || integer
@include prefixer(column-count, $int, webkit moz spec);
}
@mixin column-gap($length: normal) {
// normal || length
@include prefixer(column-gap, $length, webkit moz spec);
}
@mixin column-fill($arg: auto) {
// auto || length
@include prefixer(column-fill, $arg, webkit moz spec);
}
@mixin column-rule($arg) {
// <border-width> || <border-style> || <color>
@include prefixer(column-rule, $arg, webkit moz spec);
}
@mixin column-rule-color($color) {
@include prefixer(column-rule-color, $color, webkit moz spec);
}
@mixin column-rule-style($style: none) {
// none | hidden | dashed | dotted | double | groove | inset | inset | outset | ridge | solid
@include prefixer(column-rule-style, $style, webkit moz spec);
}
@mixin column-rule-width ($width: none) {
@include prefixer(column-rule-width, $width, webkit moz spec);
}
@mixin column-span($arg: none) {
// none || all
@include prefixer(column-span, $arg, webkit moz spec);
}
@mixin column-width($length: auto) {
// auto || length
@include prefixer(column-width, $length, webkit moz spec);
}

5
docs/_css/bourbon/css3/_filter.scss vendored Normal file
View File

@@ -0,0 +1,5 @@
@mixin filter($function: none) {
// <filter-function> [<filter-function]* | none
@include prefixer(filter, $function, webkit spec);
}

321
docs/_css/bourbon/css3/_flex-box.scss vendored Normal file
View File

@@ -0,0 +1,321 @@
// CSS3 Flexible Box Model and property defaults
// Custom shorthand notation for flexbox
@mixin box($orient: inline-axis, $pack: start, $align: stretch) {
@include display-box;
@include box-orient($orient);
@include box-pack($pack);
@include box-align($align);
}
@mixin display-box {
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox; // IE 10
display: box;
}
@mixin box-orient($orient: inline-axis) {
// horizontal|vertical|inline-axis|block-axis|inherit
@include prefixer(box-orient, $orient, webkit moz spec);
}
@mixin box-pack($pack: start) {
// start|end|center|justify
@include prefixer(box-pack, $pack, webkit moz spec);
-ms-flex-pack: $pack; // IE 10
}
@mixin box-align($align: stretch) {
// start|end|center|baseline|stretch
@include prefixer(box-align, $align, webkit moz spec);
-ms-flex-align: $align; // IE 10
}
@mixin box-direction($direction: normal) {
// normal|reverse|inherit
@include prefixer(box-direction, $direction, webkit moz spec);
-ms-flex-direction: $direction; // IE 10
}
@mixin box-lines($lines: single) {
// single|multiple
@include prefixer(box-lines, $lines, webkit moz spec);
}
@mixin box-ordinal-group($int: 1) {
@include prefixer(box-ordinal-group, $int, webkit moz spec);
-ms-flex-order: $int; // IE 10
}
@mixin box-flex($value: 0.0) {
@include prefixer(box-flex, $value, webkit moz spec);
-ms-flex: $value; // IE 10
}
@mixin box-flex-group($int: 1) {
@include prefixer(box-flex-group, $int, webkit moz spec);
}
// CSS3 Flexible Box Model and property defaults
// Unified attributes for 2009, 2011, and 2012 flavours.
// 2009 - display (box | inline-box)
// 2011 - display (flexbox | inline-flexbox)
// 2012 - display (flex | inline-flex)
@mixin display($value) {
// flex | inline-flex
@if $value == "flex" {
// 2009
display: -webkit-box;
display: -moz-box;
display: box;
// 2012
display: -webkit-flex;
display: -moz-flex;
display: -ms-flexbox; // 2011 (IE 10)
display: flex;
}
@elseif $value == "inline-flex" {
display: -webkit-inline-box;
display: -moz-inline-box;
display: inline-box;
display: -webkit-inline-flex;
display: -moz-inline-flex;
display: -ms-inline-flexbox;
display: inline-flex;
}
@else {
display: $value;
}
}
// 2009 - box-flex (integer)
// 2011 - flex (decimal | width decimal)
// 2012 - flex (integer integer width)
@mixin flex($value) {
// Grab flex-grow for older browsers.
$flex-grow: nth($value, 1);
// 2009
@include prefixer(box-flex, $flex-grow, webkit moz spec);
// 2011 (IE 10), 2012
@include prefixer(flex, $value, webkit moz ms spec);
}
// 2009 - box-orient ( horizontal | vertical | inline-axis | block-axis)
// - box-direction (normal | reverse)
// 2011 - flex-direction (row | row-reverse | column | column-reverse)
// 2012 - flex-direction (row | row-reverse | column | column-reverse)
@mixin flex-direction($value: row) {
// Alt values.
$value-2009: $value;
$value-2011: $value;
$direction: "normal";
@if $value == row {
$value-2009: horizontal;
}
@elseif $value == "row-reverse" {
$value-2009: horizontal;
$direction: reverse;
}
@elseif $value == column {
$value-2009: vertical;
}
@elseif $value == "column-reverse" {
$value-2009: vertical;
$direction: reverse;
}
// 2009
@include prefixer(box-orient, $value-2009, webkit moz spec);
@if $direction == "reverse" {
@include prefixer(box-direction, $direction, webkit moz spec);
}
// 2012
@include prefixer(flex-direction, $value, webkit moz spec);
// 2011 (IE 10)
-ms-flex-direction: $value;
}
// 2009 - box-lines (single | multiple)
// 2011 - flex-wrap (nowrap | wrap | wrap-reverse)
// 2012 - flex-wrap (nowrap | wrap | wrap-reverse)
@mixin flex-wrap($value: nowrap) {
// Alt values.
$alt-value: $value;
@if $value == nowrap {
$alt-value: single;
}
@elseif $value == wrap {
$alt-value: multiple;
}
@elseif $value == "wrap-reverse" {
$alt-value: multiple;
}
@include prefixer(box-lines, $alt-value, webkit moz spec);
@include prefixer(flex-wrap, $value, webkit moz ms spec);
}
// 2009 - TODO: parse values into flex-direction/flex-wrap
// 2011 - TODO: parse values into flex-direction/flex-wrap
// 2012 - flex-flow (flex-direction || flex-wrap)
@mixin flex-flow($value) {
@include prefixer(flex-flow, $value, webkit moz spec);
}
// 2009 - box-ordinal-group (integer)
// 2011 - flex-order (integer)
// 2012 - order (integer)
@mixin order($int: 0) {
// 2009
@include prefixer(box-ordinal-group, $int, webkit moz spec);
// 2012
@include prefixer(order, $int, webkit moz spec);
// 2011 (IE 10)
-ms-flex-order: $int;
}
// 2012 - flex-grow (number)
@mixin flex-grow($number: 0) {
@include prefixer(flex-grow, $number, webkit moz spec);
-ms-flex-positive: $number;
}
// 2012 - flex-shrink (number)
@mixin flex-shrink($number: 1) {
@include prefixer(flex-shrink, $number, webkit moz spec);
-ms-flex-negative: $number;
}
// 2012 - flex-basis (number)
@mixin flex-basis($width: auto) {
@include prefixer(flex-basis, $width, webkit moz spec);
-ms-flex-preferred-size: $width;
}
// 2009 - box-pack (start | end | center | justify)
// 2011 - flex-pack (start | end | center | justify)
// 2012 - justify-content (flex-start | flex-end | center | space-between | space-around)
@mixin justify-content ($value: flex-start) {
// Alt values.
$alt-value: $value;
@if $value == "flex-start" {
$alt-value: start;
}
@elseif $value == "flex-end" {
$alt-value: end;
}
@elseif $value == "space-between" {
$alt-value: justify;
}
@elseif $value == "space-around" {
$alt-value: center;
}
// 2009
@include prefixer(box-pack, $alt-value, webkit moz spec);
// 2012
@include prefixer(justify-content, $value, webkit moz ms o spec);
// 2011 (IE 10)
-ms-flex-pack: $alt-value;
}
// 2009 - box-align (start | end | center | baseline | stretch)
// 2011 - flex-align (start | end | center | baseline | stretch)
// 2012 - align-items (flex-start | flex-end | center | baseline | stretch)
@mixin align-items($value: stretch) {
$alt-value: $value;
@if $value == "flex-start" {
$alt-value: start;
}
@elseif $value == "flex-end" {
$alt-value: end;
}
// 2009
@include prefixer(box-align, $alt-value, webkit moz spec);
// 2012
@include prefixer(align-items, $value, webkit moz ms o spec);
// 2011 (IE 10)
-ms-flex-align: $alt-value;
}
// 2011 - flex-item-align (auto | start | end | center | baseline | stretch)
// 2012 - align-self (auto | flex-start | flex-end | center | baseline | stretch)
@mixin align-self($value: auto) {
$value-2011: $value;
@if $value == "flex-start" {
$value-2011: start;
}
@elseif $value == "flex-end" {
$value-2011: end;
}
// 2012
@include prefixer(align-self, $value, webkit moz spec);
// 2011 (IE 10)
-ms-flex-item-align: $value-2011;
}
// 2011 - flex-line-pack (start | end | center | justify | distribute | stretch)
// 2012 - align-content (flex-start | flex-end | center | space-between | space-around | stretch)
@mixin align-content($value: stretch) {
$value-2011: $value;
@if $value == "flex-start" {
$value-2011: start;
}
@elseif $value == "flex-end" {
$value-2011: end;
}
@elseif $value == "space-between" {
$value-2011: justify;
}
@elseif $value == "space-around" {
$value-2011: distribute;
}
// 2012
@include prefixer(align-content, $value, webkit moz spec);
// 2011 (IE 10)
-ms-flex-line-pack: $value-2011;
}

23
docs/_css/bourbon/css3/_font-face.scss vendored Normal file
View File

@@ -0,0 +1,23 @@
// Order of the includes matters, and it is: normal, bold, italic, bold+italic.
@mixin font-face($font-family, $file-path, $weight: normal, $style: normal, $asset-pipeline: $asset-pipeline) {
@font-face {
font-family: $font-family;
font-weight: $weight;
font-style: $style;
@if $asset-pipeline == true {
src: font-url('#{$file-path}.eot');
src: font-url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
font-url('#{$file-path}.woff') format('woff'),
font-url('#{$file-path}.ttf') format('truetype'),
font-url('#{$file-path}.svg##{$font-family}') format('svg');
} @else {
src: url('#{$file-path}.eot');
src: url('#{$file-path}.eot?#iefix') format('embedded-opentype'),
url('#{$file-path}.woff') format('woff'),
url('#{$file-path}.ttf') format('truetype'),
url('#{$file-path}.svg##{$font-family}') format('svg');
}
}
}

View File

@@ -0,0 +1,10 @@
// Font feature settings mixin and property default.
// Examples: @include font-feature-settings("liga");
// @include font-feature-settings("lnum" false);
// @include font-feature-settings("pnum" 1, "kern" 0);
// @include font-feature-settings("ss01", "ss02");
@mixin font-feature-settings($settings...) {
@if length($settings) == 0 { $settings: none; }
@include prefixer(font-feature-settings, $settings, webkit moz ms spec);
}

View File

@@ -0,0 +1,10 @@
// HiDPI mixin. Default value set to 1.3 to target Google Nexus 7 (http://bjango.com/articles/min-device-pixel-ratio/)
@mixin hidpi($ratio: 1.3) {
@media only screen and (-webkit-min-device-pixel-ratio: $ratio),
only screen and (min--moz-device-pixel-ratio: $ratio),
only screen and (-o-min-device-pixel-ratio: #{$ratio}/1),
only screen and (min-resolution: #{round($ratio*96)}dpi),
only screen and (min-resolution: #{$ratio}dppx) {
@content;
}
}

4
docs/_css/bourbon/css3/_hyphens.scss vendored Normal file
View File

@@ -0,0 +1,4 @@
@mixin hyphens($hyphenation: none) {
// none | manual | auto
@include prefixer(hyphens, $hyphenation, webkit moz ms spec);
}

View File

@@ -0,0 +1,14 @@
@mixin image-rendering ($mode:auto) {
@if ($mode == crisp-edges) {
-ms-interpolation-mode: nearest-neighbor; // IE8+
image-rendering: -moz-crisp-edges;
image-rendering: -o-crisp-edges;
image-rendering: -webkit-optimize-contrast;
image-rendering: crisp-edges;
}
@else {
image-rendering: $mode;
}
}

35
docs/_css/bourbon/css3/_keyframes.scss vendored Normal file
View File

@@ -0,0 +1,35 @@
// Adds keyframes blocks for supported prefixes, removing redundant prefixes in the block's content
@mixin keyframes($name) {
$original-prefix-for-webkit: $prefix-for-webkit;
$original-prefix-for-mozilla: $prefix-for-mozilla;
$original-prefix-for-microsoft: $prefix-for-microsoft;
$original-prefix-for-opera: $prefix-for-opera;
$original-prefix-for-spec: $prefix-for-spec;
@if $original-prefix-for-webkit {
@include disable-prefix-for-all();
$prefix-for-webkit: true !global;
@-webkit-keyframes #{$name} {
@content;
}
}
@if $original-prefix-for-mozilla {
@include disable-prefix-for-all();
$prefix-for-mozilla: true !global;
@-moz-keyframes #{$name} {
@content;
}
}
$prefix-for-webkit: $original-prefix-for-webkit !global;
$prefix-for-mozilla: $original-prefix-for-mozilla !global;
$prefix-for-microsoft: $original-prefix-for-microsoft !global;
$prefix-for-opera: $original-prefix-for-opera !global;
$prefix-for-spec: $original-prefix-for-spec !global;
@if $original-prefix-for-spec {
@keyframes #{$name} {
@content;
}
}
}

View File

@@ -0,0 +1,38 @@
@mixin linear-gradient($pos, $G1, $G2: null,
$G3: null, $G4: null,
$G5: null, $G6: null,
$G7: null, $G8: null,
$G9: null, $G10: null,
$fallback: null) {
// Detect what type of value exists in $pos
$pos-type: type-of(nth($pos, 1));
$pos-spec: null;
$pos-degree: null;
// If $pos is missing from mixin, reassign vars and add default position
@if ($pos-type == color) or (nth($pos, 1) == "transparent") {
$G10: $G9; $G9: $G8; $G8: $G7; $G7: $G6; $G6: $G5;
$G5: $G4; $G4: $G3; $G3: $G2; $G2: $G1; $G1: $pos;
$pos: null;
}
@if $pos {
$positions: _linear-positions-parser($pos);
$pos-degree: nth($positions, 1);
$pos-spec: nth($positions, 2);
}
$full: $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10;
// Set $G1 as the default fallback color
$fallback-color: nth($G1, 1);
// If $fallback is a color use that color as the fallback color
@if (type-of($fallback) == color) or ($fallback == "transparent") {
$fallback-color: $fallback;
}
background-color: $fallback-color;
background-image: -webkit-linear-gradient($pos-degree $full); // Safari 5.1+, Chrome
background-image: unquote("linear-gradient(#{$pos-spec}#{$full})");
}

View File

@@ -0,0 +1,8 @@
@mixin perspective($depth: none) {
// none | <length>
@include prefixer(perspective, $depth, webkit moz spec);
}
@mixin perspective-origin($value: 50% 50%) {
@include prefixer(perspective-origin, $value, webkit moz spec);
}

View File

@@ -0,0 +1,8 @@
@mixin placeholder {
$placeholders: ":-webkit-input" ":-moz" "-moz" "-ms-input";
@each $placeholder in $placeholders {
&:#{$placeholder}-placeholder {
@content;
}
}
}

View File

@@ -0,0 +1,39 @@
// Requires Sass 3.1+
@mixin radial-gradient($G1, $G2,
$G3: null, $G4: null,
$G5: null, $G6: null,
$G7: null, $G8: null,
$G9: null, $G10: null,
$pos: null,
$shape-size: null,
$fallback: null) {
$data: _radial-arg-parser($G1, $G2, $pos, $shape-size);
$G1: nth($data, 1);
$G2: nth($data, 2);
$pos: nth($data, 3);
$shape-size: nth($data, 4);
$full: $G1, $G2, $G3, $G4, $G5, $G6, $G7, $G8, $G9, $G10;
// Strip deprecated cover/contain for spec
$shape-size-spec: _shape-size-stripper($shape-size);
// Set $G1 as the default fallback color
$first-color: nth($full, 1);
$fallback-color: nth($first-color, 1);
@if (type-of($fallback) == color) or ($fallback == "transparent") {
$fallback-color: $fallback;
}
// Add Commas and spaces
$shape-size: if($shape-size, '#{$shape-size}, ', null);
$pos: if($pos, '#{$pos}, ', null);
$pos-spec: if($pos, 'at #{$pos}', null);
$shape-size-spec: if(($shape-size-spec != ' ') and ($pos == null), '#{$shape-size-spec}, ', '#{$shape-size-spec} ');
background-color: $fallback-color;
background-image: -webkit-radial-gradient(unquote(#{$pos}#{$shape-size}#{$full}));
background-image: unquote("radial-gradient(#{$shape-size-spec}#{$pos-spec}#{$full})");
}

15
docs/_css/bourbon/css3/_transform.scss vendored Normal file
View File

@@ -0,0 +1,15 @@
@mixin transform($property: none) {
// none | <transform-function>
@include prefixer(transform, $property, webkit moz ms o spec);
}
@mixin transform-origin($axes: 50%) {
// x-axis - left | center | right | length | %
// y-axis - top | center | bottom | length | %
// z-axis - length
@include prefixer(transform-origin, $axes, webkit moz ms o spec);
}
@mixin transform-style ($style: flat) {
@include prefixer(transform-style, $style, webkit moz ms o spec);
}

77
docs/_css/bourbon/css3/_transition.scss vendored Normal file
View File

@@ -0,0 +1,77 @@
// Shorthand mixin. Supports multiple parentheses-deliminated values for each variable.
// Example: @include transition (all 2s ease-in-out);
// @include transition (opacity 1s ease-in 2s, width 2s ease-out);
// @include transition-property (transform, opacity);
@mixin transition ($properties...) {
// Fix for vendor-prefix transform property
$needs-prefixes: false;
$webkit: ();
$moz: ();
$spec: ();
// Create lists for vendor-prefixed transform
@each $list in $properties {
@if nth($list, 1) == "transform" {
$needs-prefixes: true;
$list1: -webkit-transform;
$list2: -moz-transform;
$list3: ();
@each $var in $list {
$list3: join($list3, $var);
@if $var != "transform" {
$list1: join($list1, $var);
$list2: join($list2, $var);
}
}
$webkit: append($webkit, $list1);
$moz: append($moz, $list2);
$spec: append($spec, $list3);
}
// Create lists for non-prefixed transition properties
@else {
$webkit: append($webkit, $list, comma);
$moz: append($moz, $list, comma);
$spec: append($spec, $list, comma);
}
}
@if $needs-prefixes {
-webkit-transition: $webkit;
-moz-transition: $moz;
transition: $spec;
}
@else {
@if length($properties) >= 1 {
@include prefixer(transition, $properties, webkit moz spec);
}
@else {
$properties: all 0.15s ease-out 0s;
@include prefixer(transition, $properties, webkit moz spec);
}
}
}
@mixin transition-property ($properties...) {
-webkit-transition-property: transition-property-names($properties, 'webkit');
-moz-transition-property: transition-property-names($properties, 'moz');
transition-property: transition-property-names($properties, false);
}
@mixin transition-duration ($times...) {
@include prefixer(transition-duration, $times, webkit moz spec);
}
@mixin transition-timing-function ($motions...) {
// ease | linear | ease-in | ease-out | ease-in-out | cubic-bezier()
@include prefixer(transition-timing-function, $motions, webkit moz spec);
}
@mixin transition-delay ($times...) {
@include prefixer(transition-delay, $times, webkit moz spec);
}

View File

@@ -0,0 +1,3 @@
@mixin user-select($arg: none) {
@include prefixer(user-select, $arg, webkit moz ms spec);
}

View File

@@ -0,0 +1,11 @@
@function assign-inputs($inputs, $pseudo: null) {
$list : ();
@each $input in $inputs {
$input: unquote($input);
$input: if($pseudo, $input + ":" + $pseudo, $input);
$list: append($list, $input, comma);
}
@return $list;
}

View File

@@ -0,0 +1,13 @@
// Programatically determines whether a color is light or dark
// Returns a boolean
// More details here http://robots.thoughtbot.com/closer-look-color-lightness
@function is-light($hex-color) {
$-local-red: red(rgba($hex-color, 1.0));
$-local-green: green(rgba($hex-color, 1.0));
$-local-blue: blue(rgba($hex-color, 1.0));
$-local-lightness: ($-local-red * 0.2126 + $-local-green * 0.7152 + $-local-blue * 0.0722) / 255;
@return $-local-lightness > .6;
}

View File

@@ -0,0 +1,39 @@
// Flexible grid
@function flex-grid($columns, $container-columns: $fg-max-columns) {
$width: $columns * $fg-column + ($columns - 1) * $fg-gutter;
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
@return percentage($width / $container-width);
}
// Flexible gutter
@function flex-gutter($container-columns: $fg-max-columns, $gutter: $fg-gutter) {
$container-width: $container-columns * $fg-column + ($container-columns - 1) * $fg-gutter;
@return percentage($gutter / $container-width);
}
// The $fg-column, $fg-gutter and $fg-max-columns variables must be defined in your base stylesheet to properly use the flex-grid function.
// This function takes the fluid grid equation (target / context = result) and uses columns to help define each.
//
// The calculation presumes that your column structure will be missing the last gutter:
//
// -- column -- gutter -- column -- gutter -- column
//
// $fg-column: 60px; // Column Width
// $fg-gutter: 25px; // Gutter Width
// $fg-max-columns: 12; // Total Columns For Main Container
//
// div {
// width: flex-grid(4); // returns (315px / 995px) = 31.65829%;
// margin-left: flex-gutter(); // returns (25px / 995px) = 2.51256%;
//
// p {
// width: flex-grid(2, 4); // returns (145px / 315px) = 46.031746%;
// float: left;
// margin: flex-gutter(4); // returns (25px / 315px) = 7.936508%;
// }
//
// blockquote {
// float: left;
// width: flex-grid(2, 4); // returns (145px / 315px) = 46.031746%;
// }
// }

View File

@@ -0,0 +1,3 @@
@function golden-ratio($value, $increment) {
@return modular-scale($value, $increment, $golden)
}

View File

@@ -0,0 +1,13 @@
@function grid-width($n) {
@return $n * $gw-column + ($n - 1) * $gw-gutter;
}
// The $gw-column and $gw-gutter variables must be defined in your base stylesheet to properly use the grid-width function.
//
// $gw-column: 100px; // Column Width
// $gw-gutter: 40px; // Gutter Width
//
// div {
// width: grid-width(4); // returns 520px;
// margin-left: $gw-gutter; // returns 40px;
// }

View File

@@ -0,0 +1,66 @@
// Scaling Variables
$golden: 1.618;
$minor-second: 1.067;
$major-second: 1.125;
$minor-third: 1.2;
$major-third: 1.25;
$perfect-fourth: 1.333;
$augmented-fourth: 1.414;
$perfect-fifth: 1.5;
$minor-sixth: 1.6;
$major-sixth: 1.667;
$minor-seventh: 1.778;
$major-seventh: 1.875;
$octave: 2;
$major-tenth: 2.5;
$major-eleventh: 2.667;
$major-twelfth: 3;
$double-octave: 4;
@function modular-scale($value, $increment, $ratio) {
$v1: nth($value, 1);
$v2: nth($value, length($value));
$value: $v1;
// scale $v2 to just above $v1
@while $v2 > $v1 {
$v2: ($v2 / $ratio); // will be off-by-1
}
@while $v2 < $v1 {
$v2: ($v2 * $ratio); // will fix off-by-1
}
// check AFTER scaling $v2 to prevent double-counting corner-case
$double-stranded: $v2 > $v1;
@if $increment > 0 {
@for $i from 1 through $increment {
@if $double-stranded and ($v1 * $ratio) > $v2 {
$value: $v2;
$v2: ($v2 * $ratio);
} @else {
$v1: ($v1 * $ratio);
$value: $v1;
}
}
}
@if $increment < 0 {
// adjust $v2 to just below $v1
@if $double-stranded {
$v2: ($v2 / $ratio);
}
@for $i from $increment through -1 {
@if $double-stranded and ($v1 / $ratio) < $v2 {
$value: $v2;
$v2: ($v2 / $ratio);
} @else {
$v1: ($v1 / $ratio);
$value: $v1;
}
}
}
@return $value;
}

View File

@@ -0,0 +1,13 @@
// Convert pixels to ems
// eg. for a relational value of 12px write em(12) when the parent is 16px
// if the parent is another value say 24px write em(12, 24)
@function em($pxval, $base: $em-base) {
@if not unitless($pxval) {
$pxval: strip-units($pxval);
}
@if not unitless($base) {
$base: strip-units($base);
}
@return ($pxval / $base) * 1em;
}

View File

@@ -0,0 +1,15 @@
// Convert pixels to rems
// eg. for a relational value of 12px write rem(12)
// Assumes $em-base is the font-size of <html>
@function rem($pxval) {
@if not unitless($pxval) {
$pxval: strip-units($pxval);
}
$base: $em-base;
@if not unitless($base) {
$base: strip-units($base);
}
@return ($pxval / $base) * 1rem;
}

View File

@@ -0,0 +1,5 @@
// Srtips the units from a value. e.g. 12px -> 12
@function strip-units($val) {
@return ($val / ($val * 0 + 1));
}

View File

@@ -0,0 +1,9 @@
// Add percentage of white to a color
@function tint($color, $percent){
@return mix(white, $color, $percent);
}
// Add percentage of black to a color
@function shade($color, $percent){
@return mix(black, $color, $percent);
}

View File

@@ -0,0 +1,22 @@
// Return vendor-prefixed property names if appropriate
// Example: transition-property-names((transform, color, background), moz) -> -moz-transform, color, background
//************************************************************************//
@function transition-property-names($props, $vendor: false) {
$new-props: ();
@each $prop in $props {
$new-props: append($new-props, transition-property-name($prop, $vendor), comma);
}
@return $new-props;
}
@function transition-property-name($prop, $vendor: false) {
// put other properties that need to be prefixed here aswell
@if $vendor and $prop == transform {
@return unquote('-'+$vendor+'-'+$prop);
}
@else {
@return $prop;
}
}

View File

@@ -0,0 +1,17 @@
// Convert shorthand to the 4-value syntax
@function unpack($shorthand) {
@if length($shorthand) == 1 {
@return nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1) nth($shorthand, 1);
}
@else if length($shorthand) == 2 {
@return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 1) nth($shorthand, 2);
}
@else if length($shorthand) == 3 {
@return nth($shorthand, 1) nth($shorthand, 2) nth($shorthand, 3) nth($shorthand, 2);
}
@else {
@return $shorthand;
}
}

View File

@@ -0,0 +1,15 @@
//************************************************************************//
// Helper function for str-to-num fn.
// Source: http://sassmeister.com/gist/9647408
//************************************************************************//
@function _convert-units($number, $unit) {
$strings: 'px' 'cm' 'mm' '%' 'ch' 'pica' 'in' 'em' 'rem' 'pt' 'pc' 'ex' 'vw' 'vh' 'vmin' 'vmax', 'deg', 'rad', 'grad', 'turn';
$units: 1px 1cm 1mm 1% 1ch 1pica 1in 1em 1rem 1pt 1pc 1ex 1vw 1vh 1vmin 1vmax, 1deg, 1rad, 1grad, 1turn;
$index: index($strings, $unit);
@if not $index {
@warn "Unknown unit `#{$unit}`.";
@return false;
}
@return $number * nth($units, $index);
}

View File

@@ -0,0 +1,13 @@
@function _gradient-positions-parser($gradient-type, $gradient-positions) {
@if $gradient-positions
and ($gradient-type == linear)
and (type-of($gradient-positions) != color) {
$gradient-positions: _linear-positions-parser($gradient-positions);
}
@else if $gradient-positions
and ($gradient-type == radial)
and (type-of($gradient-positions) != color) {
$gradient-positions: _radial-positions-parser($gradient-positions);
}
@return $gradient-positions;
}

View File

@@ -0,0 +1,8 @@
//************************************************************************//
// Helper for linear-gradient-parser
//************************************************************************//
@function _is-num($char) {
$values: '0' '1' '2' '3' '4' '5' '6' '7' '8' '9' 0 1 2 3 4 5 6 7 8 9;
$index: index($values, $char);
@return if($index, true, false);
}

View File

@@ -0,0 +1,25 @@
// Private function for linear-gradient-parser
@function _linear-angle-parser($image, $first-val, $prefix, $suffix) {
$offset: null;
$unit-short: str-slice($first-val, str-length($first-val) - 2, str-length($first-val));
$unit-long: str-slice($first-val, str-length($first-val) - 3, str-length($first-val));
@if ($unit-long == "grad") or
($unit-long == "turn") {
$offset: if($unit-long == "grad", -100grad * 3, -0.75turn);
}
@else if ($unit-short == "deg") or
($unit-short == "rad") {
$offset: if($unit-short == "deg", -90 * 3, 1.6rad);
}
@if $offset {
$num: _str-to-num($first-val);
@return (
webkit-image: -webkit- + $prefix + ($offset - $num) + $suffix,
spec-image: $image
);
}
}

View File

@@ -0,0 +1,41 @@
@function _linear-gradient-parser($image) {
$image: unquote($image);
$gradients: ();
$start: str-index($image, "(");
$end: str-index($image, ",");
$first-val: str-slice($image, $start + 1, $end - 1);
$prefix: str-slice($image, 0, $start);
$suffix: str-slice($image, $end, str-length($image));
$has-multiple-vals: str-index($first-val, " ");
$has-single-position: unquote(_position-flipper($first-val) + "");
$has-angle: _is-num(str-slice($first-val, 0, 0));
@if $has-multiple-vals {
$gradients: _linear-side-corner-parser($image, $first-val, $prefix, $suffix, $has-multiple-vals);
}
@else if $has-single-position != "" {
$pos: unquote($has-single-position + "");
$gradients: (
webkit-image: -webkit- + $image,
spec-image: $prefix + "to " + $pos + $suffix
);
}
@else if $has-angle {
// Rotate degree for webkit
$gradients: _linear-angle-parser($image, $first-val, $prefix, $suffix);
}
@else {
$gradients: (
webkit-image: -webkit- + $image,
spec-image: $image
);
}
@return $gradients;
}

Some files were not shown because too many files have changed in this diff Show More