Showing preview only (492K chars total). Download the full file or copy to clipboard to get everything.
Repository: facebookarchive/flux
Branch: main
Commit: 4ee8c50865c3
Files: 155
Total size: 454.1 KB
Directory structure:
gitextract_v_zkddy6/
├── .github/
│ └── workflows/
│ └── node.js.yml
├── .gitignore
├── .npmignore
├── .prettierrc
├── .watchmanconfig
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Gulpfile.js
├── LICENSE
├── README.md
├── bower.json
├── dist/
│ ├── Flux.js
│ └── FluxUtils.js
├── docs/
│ ├── Dispatcher.ko-KR.md
│ ├── Dispatcher.md
│ ├── Flux-Utils.md
│ ├── In-Depth-Overview.md
│ ├── Overview.ko-KR.md
│ ├── Overview.md
│ ├── Related-Libraries.md
│ ├── Videos.ko-KR.md
│ └── Videos.md
├── examples/
│ ├── README.md
│ ├── flux-async/
│ │ ├── .babelrc
│ │ ├── .flowconfig
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── flow/
│ │ │ ├── flux-utils.js
│ │ │ ├── flux.js
│ │ │ ├── immutable.js
│ │ │ └── misc.js
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── server/
│ │ │ └── app.js
│ │ ├── src/
│ │ │ ├── TodoActions.js
│ │ │ ├── TodoDispatcher.js
│ │ │ ├── containers/
│ │ │ │ └── AppContainer.js
│ │ │ ├── data_managers/
│ │ │ │ ├── TodoAPI.js
│ │ │ │ └── TodoDataManager.js
│ │ │ ├── load_object/
│ │ │ │ ├── LoadObject.js
│ │ │ │ ├── LoadObjectMap.js
│ │ │ │ └── LoadObjectState.js
│ │ │ ├── records/
│ │ │ │ └── Todo.js
│ │ │ ├── root.js
│ │ │ ├── stores/
│ │ │ │ ├── TodoDraftStore.js
│ │ │ │ ├── TodoListStore.js
│ │ │ │ ├── TodoLoggerStore.js
│ │ │ │ └── TodoStore.js
│ │ │ ├── utils/
│ │ │ │ └── FakeID.js
│ │ │ └── views/
│ │ │ └── AppView.js
│ │ ├── todomvc-common/
│ │ │ ├── .bower.json
│ │ │ ├── base.css
│ │ │ ├── bower.json
│ │ │ └── readme.md
│ │ └── webpack.config.js
│ ├── flux-concepts/
│ │ └── README.md
│ ├── flux-flow/
│ │ ├── .babelrc
│ │ ├── .flowconfig
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── flow/
│ │ │ ├── flux-utils.js
│ │ │ └── flux.js
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── AppActions.js
│ │ │ ├── AppContainer.js
│ │ │ ├── AppDispatcher.js
│ │ │ ├── AppStore.js
│ │ │ ├── AppView.js
│ │ │ ├── __flowtests__/
│ │ │ │ └── App-flowtest.js
│ │ │ └── root.js
│ │ └── webpack.config.js
│ ├── flux-jest/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── package.json
│ │ └── src/
│ │ └── __tests__/
│ │ └── TodoStore-test.js
│ ├── flux-jest-container/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── package.json
│ │ └── src/
│ │ └── __tests__/
│ │ ├── AppContainer-test.js
│ │ └── __snapshots__/
│ │ └── AppContainer-test.js.snap
│ ├── flux-logging/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── TodoDispatcher.js
│ │ │ ├── TodoLoggerStore.js
│ │ │ └── root.js
│ │ └── webpack.config.js
│ ├── flux-shell/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ └── root.js
│ │ └── webpack.config.js
│ ├── flux-todomvc/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── containers/
│ │ │ │ └── AppContainer.js
│ │ │ ├── data/
│ │ │ │ ├── Counter.js
│ │ │ │ ├── Todo.js
│ │ │ │ ├── TodoActionTypes.js
│ │ │ │ ├── TodoActions.js
│ │ │ │ ├── TodoDispatcher.js
│ │ │ │ ├── TodoDraftStore.js
│ │ │ │ ├── TodoEditStore.js
│ │ │ │ └── TodoStore.js
│ │ │ ├── root.js
│ │ │ └── views/
│ │ │ └── AppView.js
│ │ ├── todomvc-common/
│ │ │ ├── .bower.json
│ │ │ ├── base.css
│ │ │ ├── bower.json
│ │ │ └── readme.md
│ │ └── webpack.config.js
│ └── todomvc-common/
│ ├── .bower.json
│ ├── base.css
│ ├── bower.json
│ └── readme.md
├── index.js
├── jest.config.js
├── package.json
├── scripts/
│ ├── babel/
│ │ └── default-options.js
│ └── jest/
│ ├── environment.js
│ └── preprocessor.js
├── src/
│ ├── .flowconfig
│ ├── Dispatcher.js
│ ├── FluxMixinLegacy.js
│ ├── FluxStoreGroup.js
│ ├── __tests__/
│ │ ├── Dispatcher-test.js
│ │ └── FluxStoreGroup-test.js
│ ├── container/
│ │ ├── FluxContainer.js
│ │ ├── FluxContainerSubscriptions.js
│ │ └── __tests__/
│ │ └── FluxContainer-test.js
│ ├── stores/
│ │ ├── FluxReduceStore.js
│ │ ├── FluxStore.js
│ │ └── __tests__/
│ │ ├── FluxReduceStore-test.js
│ │ └── FluxStore-test.js
│ └── utils/
│ └── abstractMethod.js
├── utils.js
└── website/
├── .gitignore
├── README.md
├── docusaurus.config.js
├── package.json
├── sidebars.js
└── src/
├── css/
│ └── custom.css
└── pages/
├── index.js
├── styles.module.css
└── support.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .github/workflows/node.js.yml
================================================
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn install
- run: yarn test
- run: yarn run build
================================================
FILE: .gitignore
================================================
node_modules
lib
*.log
website/src/flux/docs/
website/core/metadata.js
flow/include
================================================
FILE: .npmignore
================================================
src/
Makefile
Flux.js
CONTRIBUTING.md
.flowconfig
================================================
FILE: .prettierrc
================================================
{
"bracketSameLine": true,
"bracketSpacing": false,
"printWidth": 80,
"proseWrap": "never",
"singleQuote": true,
"trailingComma": "all"
}
================================================
FILE: .watchmanconfig
================================================
{}
================================================
FILE: CHANGELOG.md
================================================
# Changelog
### 4.0.3
- Upgraded `fbjs` to 3.0.1 which fixes [CVE-2021-27292](https://www.whitesourcesoftware.com/vulnerability-database/CVE-2021-27292)
### 4.0.2
- Added support for `UNSAFE_componentWillReceiveProps` lifecycle method
### 4.0.1
- Upgrade `fbemitter` dependency to 3.x
### 4.0.0
- Upgrade `fbjs` dependency to ^3.x
- Upgrade for Babel 7 compatibility (#495) (thanks to @koba04)
- Added React 17 as a peer dependency
### 3.1.3
- Added support for React 16
### 3.1.2
- No meaningful changes.
### 3.1.1
- No meaningful changes.
### 3.1.0
- `Dispatcher`: Methods `register` and `unregister` can once again be called in
the middle of a dispatch.
### 3.0.0
- `FluxMapStore`: Removed. It added very little value over `FluxReduceStore`.
- `FluxContainer`: Subscriptions are setup in constructor rather than
`componentDidMount`
- `FluxContainer`: Can create containers using stateless functional components
- `FluxContainer`: Uses functional version of `setState`
- `FluxMixin`: Subscriptions are setup in `componentWillMount` rather than
`componentDidMount`
- `Dispatcher`: Methods `register` and `unregister` can not be called in the
middle of a dispatch
- `React` added as peer dependency to `flux/utils`
- Package `dist/FluxUtils.js` alongside `dist/Flux.js`
_**Note**: This is marked as a breaking change due to the large number of small
changes in `FluxContainer`. Depending on how coupled code is to the timing of
`componentWillMount`, `componentDidMount`, or setting state synchronously it is
possible that there may be some breakages. Generally it should not be an issue._
### 2.1.1
- Publish `dist/` on npm
### 2.1.0
- Add flux-utils which include four main base classes: `Store`, `ReduceStore`,
`MapStore`, `Container`
- Add flux-utils example and documentation
- Upgrade build script
- Publish a minified version of `Flux` in `dist/`
- Add flow types to `Dispatcher`
================================================
FILE: CODE_OF_CONDUCT.md
================================================
# Code of Conduct
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.
================================================
FILE: CONTRIBUTING.md
================================================
# Contributing to Flux
We want to make contributing to this project as easy and transparent as
possible.
## Code of Conduct
The code of conduct is described in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md)
## Pull Requests
We actively welcome your pull requests.
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.
5. Make sure your code lints.
6. If you haven't already, complete the Contributor License Agreement (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 to work on any of Facebook's open source projects.
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.
### 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 Flux, you agree that your contributions will be licensed under its BSD license.
================================================
FILE: Gulpfile.js
================================================
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
const babel = require('gulp-babel');
const del = require('del');
const flatten = require('gulp-flatten');
const gulp = require('gulp');
const gulpUtil = require('gulp-util');
const header = require('gulp-header');
const rename = require('gulp-rename');
const webpackStream = require('webpack-stream');
const babelDefaultOptions = require('./scripts/babel/default-options');
const DEVELOPMENT_HEADER =
['/**', ' * Flux v<%= version %>', ' */'].join('\n') + '\n';
const PRODUCTION_HEADER =
[
'/**',
' * Flux v<%= version %>',
' *',
' * Copyright (c) Meta Platforms, Inc. and affiliates.',
' *',
' * This source code is licensed under the BSD-style license found in the',
' * LICENSE file in the root directory of this source tree. An additional grant',
' * of patent rights can be found in the PATENTS file in the same directory.',
' */',
].join('\n') + '\n';
const paths = {
dist: './dist/',
lib: 'lib',
entry: './index.js',
entryUtils: './utils.js',
src: [
'src/**/*.js',
'!src/**/__tests__/**/*.js',
'!src/**/__mocks__/**/*.js',
],
};
const buildDist = function (opts) {
const webpackOpts = {
debug: opts.debug,
module: {
loaders: [{test: /\.js$/, loader: 'babel'}],
},
output: {
filename: opts.output,
libraryTarget: 'umd',
library: opts.library,
},
plugins: [
new webpackStream.webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(
opts.debug ? 'development' : 'production',
),
}),
],
};
if (!opts.debug) {
webpackOpts.plugins.push(
new webpackStream.webpack.optimize.UglifyJsPlugin({
compress: {
hoist_vars: true,
screw_ie8: true,
warnings: false,
},
}),
);
}
return webpackStream(webpackOpts, null, function (err, stats) {
if (err) {
throw new gulpUtil.PluginError('webpack', err);
}
if (stats.compilation.errors.length) {
gulpUtil.log('webpack', '\n' + stats.toString({colors: true}));
}
});
};
gulp.task('clean', function () {
return del([paths.lib, 'Flux.js']);
});
gulp.task('lib', function () {
return gulp
.src(paths.src)
.pipe(babel(babelDefaultOptions))
.pipe(flatten())
.pipe(gulp.dest(paths.lib));
});
gulp.task('flow', function () {
return gulp
.src(paths.src)
.pipe(flatten())
.pipe(rename({extname: '.js.flow'}))
.pipe(gulp.dest(paths.lib));
});
gulp.task(
'dist',
gulp.series('lib', function () {
const distOpts = {
debug: true,
output: 'Flux.js',
library: 'Flux',
};
return gulp
.src(paths.entry)
.pipe(buildDist(distOpts))
.pipe(
header(DEVELOPMENT_HEADER, {
version: process.env.npm_package_version,
}),
)
.pipe(gulp.dest(paths.dist));
}),
);
gulp.task(
'dist:utils',
gulp.series('lib', function () {
const distOpts = {
debug: true,
output: 'FluxUtils.js',
library: 'FluxUtils',
};
return gulp
.src(paths.entryUtils)
.pipe(buildDist(distOpts))
.pipe(
header(DEVELOPMENT_HEADER, {
version: process.env.npm_package_version,
}),
)
.pipe(gulp.dest(paths.dist));
}),
);
gulp.task(
'dist:min',
gulp.series('lib', function () {
const distOpts = {
debug: false,
output: 'Flux.min.js',
library: 'Flux',
};
return gulp
.src(paths.entry)
.pipe(buildDist(distOpts))
.pipe(
header(PRODUCTION_HEADER, {
version: process.env.npm_package_version,
}),
)
.pipe(gulp.dest(paths.dist));
}),
);
gulp.task(
'dist:utils:min',
gulp.series('lib', function () {
const distOpts = {
debug: false,
output: 'FluxUtils.min.js',
library: 'FluxUtils',
};
return gulp
.src(paths.entryUtils)
.pipe(buildDist(distOpts))
.pipe(
header(PRODUCTION_HEADER, {
version: process.env.npm_package_version,
}),
)
.pipe(gulp.dest(paths.dist));
}),
);
gulp.task('build', gulp.series('lib', 'flow', 'dist', 'dist:utils'));
gulp.task(
'publish',
gulp.series(
'clean',
'flow',
gulp.parallel('dist', 'dist:min', 'dist:utils', 'dist:utils:min'),
),
);
gulp.task('default', gulp.series('build'));
================================================
FILE: LICENSE
================================================
BSD License
For Flux software
Copyright (c) Facebook, Inc. and its affiliates.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* 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.
================================================
FILE: README.md
================================================
## ⚠️ The Flux project has been archived and no further changes will be made. We recommend using more sophisticated alternatives like [Redux](http://redux.js.org/), [MobX](https://mobx.js.org/), [Recoil](https://recoiljs.org/), [Zustand](https://github.com/pmndrs/zustand), or [Jotai](https://github.com/pmndrs/jotai).
<p align="center">
<img src="https://github.com/facebookarchive/flux/blob/main/website/static/img/flux-logo-color.svg" alt="logo" width="20%" />
</p>
<h1 align="center">
Flux
</h1>
<p align="center">
An application architecture for React utilizing a unidirectional data flow.<br>
<a href="https://github.com/facebook/flux/blob/master/LICENSE">
<img src="https://img.shields.io/badge/License-BSD%20-blue.svg" alt="Licence Badge" />
</a>
<a href="https://www.npmjs.com/package/flux">
<img src="https://img.shields.io/npm/v/flux.svg?style=flat" alt="Current npm package version." />
</a>
</p>
<hr/>
<img src="./img/flux-diagram-white-background.png" style="width: 100%;" />
## Getting Started
Start by looking through the [guides and examples](./examples) on Github. For more resources and API docs check out [facebook.github.io/flux](https://facebookarchive.github.io/flux).
## How Flux works
For more information on how Flux works check out the [Flux Concepts](./examples/flux-concepts) guide, or the [In Depth Overview](https://facebookarchive.github.io/flux/docs/in-depth-overview).
## Requirements
Flux is more of a pattern than a framework, and does not have any hard dependencies. However, we often use [EventEmitter](https://nodejs.org/api/events.html#events_class_eventemitter) as a basis for `Stores` and [React](https://github.com/facebook/react) for our `Views`. The one piece of Flux not readily available elsewhere is the `Dispatcher`. This module, along with some other utilities, is available here to complete your Flux toolbox.
## Installing Flux
Flux is available as a [npm module](https://www.npmjs.org/package/flux), so you can add it to your package.json file or run `npm install flux`. The dispatcher will be available as `Flux.Dispatcher` and can be required like this:
```javascript
const Dispatcher = require('flux').Dispatcher;
```
Take a look at the [dispatcher API and some examples](https://facebookarchive.github.io/flux/docs/dispatcher).
## Flux Utils
We have also provided some basic utility classes to help get you started with Flux. These base classes are a solid foundation for a simple Flux application, but they are **not** a feature-complete framework that will handle all use cases. There are many other great Flux frameworks out there if these utilities do not fulfill your needs.
```js
import {ReduceStore} from 'flux/utils';
class CounterStore extends ReduceStore<number> {
getInitialState(): number {
return 0;
}
reduce(state: number, action: Object): number {
switch (action.type) {
case 'increment':
return state + 1;
case 'square':
return state * state;
default:
return state;
}
}
}
```
Check out the [examples](./examples) and [documentation](https://facebookarchive.github.io/flux/docs/flux-utils) for more information.
## Building Flux from a Cloned Repo
Clone the repo and navigate into the resulting `flux` directory. Then run `npm install`.
This will run [Gulp](https://gulpjs.com/)-based build tasks automatically and produce the file Flux.js, which you can then require as a module.
You could then require the Dispatcher like so:
```javascript
const Dispatcher = require('path/to/this/directory/Flux').Dispatcher;
```
The build process also produces de-sugared versions of the `Dispatcher` and `invariant` modules in a `lib` directory, and you can require those modules directly, copying them into whatever directory is most convenient for you. The `flux-todomvc` and `flux-chat` example applications both do this.
## License
Flux is BSD-licensed. We also provide an additional patent grant.
================================================
FILE: bower.json
================================================
{
"name": "flux",
"description": "An application architecture based on a unidirectional data flow",
"version": "2.1.1",
"main": "dist/Flux.js",
"license": "https://github.com/facebook/flux/blob/master/LICENSE",
"homepage": "https://facebook.github.io/flux/",
"repository": {
"type": "git",
"url": "https://github.com/facebook/flux.git"
},
"authors": [
"Facebook",
"Jing Chen <jingc@fb.com>",
"Bill Fisher <fisherwebdev@gmail.com>",
"Paul O'Shannessy <paul@oshannessy.com>"
],
"keywords": [
"flux",
"dispatcher",
"react",
"facebook"
],
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests",
"docs",
"examples",
"src",
"lib",
"website",
"CONTRIBUTING.md",
"Gulpfile.js",
"index.js",
"package.json"
]
}
================================================
FILE: dist/Flux.js
================================================
/**
* Flux v4.0.4
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["Flux"] = factory();
else
root["Flux"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
module.exports.Dispatcher = __webpack_require__(1);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Dispatcher
*
* @preventMunge
*/
'use strict';
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var invariant = __webpack_require__(2);
var _prefix = 'ID_';
/**
* Dispatcher is used to broadcast payloads to registered callbacks. This is
* different from generic pub-sub systems in two ways:
*
* 1) Callbacks are not subscribed to particular events. Every payload is
* dispatched to every registered callback.
* 2) Callbacks can be deferred in whole or part until other callbacks have
* been executed.
*
* For example, consider this hypothetical flight destination form, which
* selects a default city when a country is selected:
*
* var flightDispatcher = new Dispatcher();
*
* // Keeps track of which country is selected
* var CountryStore = {country: null};
*
* // Keeps track of which city is selected
* var CityStore = {city: null};
*
* // Keeps track of the base flight price of the selected city
* var FlightPriceStore = {price: null}
*
* When a user changes the selected city, we dispatch the payload:
*
* flightDispatcher.dispatch({
* actionType: 'city-update',
* selectedCity: 'paris'
* });
*
* This payload is digested by `CityStore`:
*
* flightDispatcher.register(function(payload) {
* if (payload.actionType === 'city-update') {
* CityStore.city = payload.selectedCity;
* }
* });
*
* When the user selects a country, we dispatch the payload:
*
* flightDispatcher.dispatch({
* actionType: 'country-update',
* selectedCountry: 'australia'
* });
*
* This payload is digested by both stores:
*
* CountryStore.dispatchToken = flightDispatcher.register(function(payload) {
* if (payload.actionType === 'country-update') {
* CountryStore.country = payload.selectedCountry;
* }
* });
*
* When the callback to update `CountryStore` is registered, we save a reference
* to the returned token. Using this token with `waitFor()`, we can guarantee
* that `CountryStore` is updated before the callback that updates `CityStore`
* needs to query its data.
*
* CityStore.dispatchToken = flightDispatcher.register(function(payload) {
* if (payload.actionType === 'country-update') {
* // `CountryStore.country` may not be updated.
* flightDispatcher.waitFor([CountryStore.dispatchToken]);
* // `CountryStore.country` is now guaranteed to be updated.
*
* // Select the default city for the new country
* CityStore.city = getDefaultCityForCountry(CountryStore.country);
* }
* });
*
* The usage of `waitFor()` can be chained, for example:
*
* FlightPriceStore.dispatchToken =
* flightDispatcher.register(function(payload) {
* switch (payload.actionType) {
* case 'country-update':
* case 'city-update':
* flightDispatcher.waitFor([CityStore.dispatchToken]);
* FlightPriceStore.price =
* getFlightPriceStore(CountryStore.country, CityStore.city);
* break;
* }
* });
*
* The `country-update` payload will be guaranteed to invoke the stores'
* registered callbacks in order: `CountryStore`, `CityStore`, then
* `FlightPriceStore`.
*/
var Dispatcher = /*#__PURE__*/function () {
function Dispatcher() {
_defineProperty(this, "_callbacks", void 0);
_defineProperty(this, "_isDispatching", void 0);
_defineProperty(this, "_isHandled", void 0);
_defineProperty(this, "_isPending", void 0);
_defineProperty(this, "_lastID", void 0);
_defineProperty(this, "_pendingPayload", void 0);
this._callbacks = {};
this._isDispatching = false;
this._isHandled = {};
this._isPending = {};
this._lastID = 1;
}
/**
* Registers a callback to be invoked with every dispatched payload. Returns
* a token that can be used with `waitFor()`.
*/
var _proto = Dispatcher.prototype;
_proto.register = function register(callback) {
var id = _prefix + this._lastID++;
this._callbacks[id] = callback;
return id;
}
/**
* Removes a callback based on its token.
*/;
_proto.unregister = function unregister(id) {
!this._callbacks[id] ? true ? invariant(false, 'Dispatcher.unregister(...): `%s` does not map to a registered callback.', id) : invariant(false) : void 0;
delete this._callbacks[id];
}
/**
* Waits for the callbacks specified to be invoked before continuing execution
* of the current callback. This method should only be used by a callback in
* response to a dispatched payload.
*/;
_proto.waitFor = function waitFor(ids) {
!this._isDispatching ? true ? invariant(false, 'Dispatcher.waitFor(...): Must be invoked while dispatching.') : invariant(false) : void 0;
for (var ii = 0; ii < ids.length; ii++) {
var id = ids[ii];
if (this._isPending[id]) {
!this._isHandled[id] ? true ? invariant(false, 'Dispatcher.waitFor(...): Circular dependency detected while ' + 'waiting for `%s`.', id) : invariant(false) : void 0;
continue;
}
!this._callbacks[id] ? true ? invariant(false, 'Dispatcher.waitFor(...): `%s` does not map to a registered callback.', id) : invariant(false) : void 0;
this._invokeCallback(id);
}
}
/**
* Dispatches a payload to all registered callbacks.
*/;
_proto.dispatch = function dispatch(payload) {
!!this._isDispatching ? true ? invariant(false, 'Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.') : invariant(false) : void 0;
this._startDispatching(payload);
try {
for (var id in this._callbacks) {
if (this._isPending[id]) {
continue;
}
this._invokeCallback(id);
}
} finally {
this._stopDispatching();
}
}
/**
* Is this Dispatcher currently dispatching.
*/;
_proto.isDispatching = function isDispatching() {
return this._isDispatching;
}
/**
* Call the callback stored with the given id. Also do some internal
* bookkeeping.
*
* @internal
*/;
_proto._invokeCallback = function _invokeCallback(id) {
this._isPending[id] = true;
this._callbacks[id](this._pendingPayload);
this._isHandled[id] = true;
}
/**
* Set up bookkeeping needed when dispatching.
*
* @internal
*/;
_proto._startDispatching = function _startDispatching(payload) {
for (var id in this._callbacks) {
this._isPending[id] = false;
this._isHandled[id] = false;
}
this._pendingPayload = payload;
this._isDispatching = true;
}
/**
* Clear bookkeeping used for dispatching.
*
* @internal
*/;
_proto._stopDispatching = function _stopDispatching() {
delete this._pendingPayload;
this._isDispatching = false;
};
return Dispatcher;
}();
module.exports = Dispatcher;
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
'use strict';
var validateFormat = true ? function (format) {
if (format === undefined) {
throw new Error('invariant(...): Second argument must be a string.');
}
} : function (format) {};
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments to provide
* information about what broke and what you were expecting.
*
* The invariant message will be stripped in production, but the invariant will
* remain to ensure logic does not differ in production.
*/
function invariant(condition, format) {
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return String(args[argIndex++]);
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // Skip invariant's own stack frame.
throw error;
}
}
module.exports = invariant;
/***/ })
/******/ ])
});
;
================================================
FILE: dist/FluxUtils.js
================================================
/**
* Flux v4.0.4
*/
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["FluxUtils"] = factory();
else
root["FluxUtils"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
module.exports.Container = __webpack_require__(1);
module.exports.Mixin = __webpack_require__(9);
module.exports.ReduceStore = __webpack_require__(10);
module.exports.Store = __webpack_require__(11);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule FluxContainer
*
*/
'use strict';
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
enumerableOnly && (symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
})), keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread(target) {
for (var i = 1; i < arguments.length; i++) {
var source = null != arguments[i] ? arguments[i] : {};
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
_defineProperty(target, key, source[key]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
return target;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var FluxContainerSubscriptions = __webpack_require__(2);
var React = __webpack_require__(5);
var invariant = __webpack_require__(4);
var shallowEqual = __webpack_require__(8);
var Component = React.Component;
var DEFAULT_OPTIONS = {
pure: true,
withProps: false,
withContext: false
};
/**
* A FluxContainer is used to subscribe a react component to multiple stores.
* The stores that are used must be returned from a static `getStores()` method.
*
* The component receives information from the stores via state. The state
* is generated using a static `calculateState()` method that each container
* must implement. A simple container may look like:
*
* class FooContainer extends Component {
* static getStores() {
* return [FooStore];
* }
*
* static calculateState() {
* return {
* foo: FooStore.getState(),
* };
* }
*
* render() {
* return <FooView {...this.state} />;
* }
* }
*
* module.exports = FluxContainer.create(FooContainer);
*
* Flux container also supports some other, more advanced use cases. If you need
* to base your state off of props as well:
*
* class FooContainer extends Component {
* ...
*
* static calculateState(prevState, props) {
* return {
* foo: FooStore.getSpecificFoo(props.id),
* };
* }
*
* ...
* }
*
* module.exports = FluxContainer.create(FooContainer, {withProps: true});
*
* Or if your stores are passed through your props:
*
* class FooContainer extends Component {
* ...
*
* static getStores(props) {
* const {BarStore, FooStore} = props.stores;
* return [BarStore, FooStore];
* }
*
* static calculateState(prevState, props) {
* const {BarStore, FooStore} = props.stores;
* return {
* bar: BarStore.getState(),
* foo: FooStore.getState(),
* };
* }
*
* ...
* }
*
* module.exports = FluxContainer.create(FooContainer, {withProps: true});
*/
function create(Base, options) {
enforceInterface(Base);
// Construct the options using default, override with user values as necessary.
var realOptions = _objectSpread(_objectSpread({}, DEFAULT_OPTIONS), options || {});
var getState = function getState(state, maybeProps, maybeContext) {
var props = realOptions.withProps ? maybeProps : undefined;
var context = realOptions.withContext ? maybeContext : undefined;
return Base.calculateState(state, props, context);
};
var getStores = function getStores(maybeProps, maybeContext) {
var props = realOptions.withProps ? maybeProps : undefined;
var context = realOptions.withContext ? maybeContext : undefined;
return Base.getStores(props, context);
};
// Build the container class.
var ContainerClass = /*#__PURE__*/function (_Base) {
_inheritsLoose(ContainerClass, _Base);
function ContainerClass(props, context) {
var _this;
_this = _Base.call(this, props, context) || this;
_defineProperty(_assertThisInitialized(_this), "_fluxContainerSubscriptions", void 0);
_this._fluxContainerSubscriptions = new FluxContainerSubscriptions();
_this._fluxContainerSubscriptions.setStores(getStores(props, context));
_this._fluxContainerSubscriptions.addListener(function () {
_this.setState(function (prevState, currentProps) {
return getState(prevState, currentProps, context);
});
});
var calculatedState = getState(undefined, props, context);
_this.state = _objectSpread(_objectSpread({}, _this.state || {}), calculatedState);
return _this;
}
var _proto = ContainerClass.prototype;
_proto.UNSAFE_componentWillReceiveProps = function UNSAFE_componentWillReceiveProps(nextProps, nextContext) {
if (_Base.prototype.UNSAFE_componentWillReceiveProps) {
_Base.prototype.UNSAFE_componentWillReceiveProps.call(this, nextProps, nextContext);
}
if (_Base.prototype.componentWillReceiveProps) {
_Base.prototype.componentWillReceiveProps.call(this, nextProps, nextContext);
}
if (realOptions.withProps || realOptions.withContext) {
// Update both stores and state.
this._fluxContainerSubscriptions.setStores(getStores(nextProps, nextContext));
this.setState(function (prevState) {
return getState(prevState, nextProps, nextContext);
});
}
};
_proto.componentWillUnmount = function componentWillUnmount() {
if (_Base.prototype.componentWillUnmount) {
_Base.prototype.componentWillUnmount.call(this);
}
this._fluxContainerSubscriptions.reset();
};
return ContainerClass;
}(Base); // Make sure we override shouldComponentUpdate only if the pure option is
// specified. We can't override this above because we don't want to override
// the default behavior on accident. Super works weird with react ES6 classes.
var container = realOptions.pure ? createPureComponent(ContainerClass) : ContainerClass;
// Update the name of the container before returning
var componentName = Base.displayName || Base.name;
container.displayName = 'FluxContainer(' + componentName + ')';
return container;
}
function createPureComponent(BaseComponent) {
var PureComponent = /*#__PURE__*/function (_BaseComponent) {
_inheritsLoose(PureComponent, _BaseComponent);
function PureComponent() {
return _BaseComponent.apply(this, arguments) || this;
}
var _proto2 = PureComponent.prototype;
_proto2.shouldComponentUpdate = function shouldComponentUpdate(nextProps, nextState) {
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
};
return PureComponent;
}(BaseComponent);
return PureComponent;
}
function enforceInterface(o) {
!o.getStores ? true ? invariant(false, 'Components that use FluxContainer must implement `static getStores()`') : invariant(false) : void 0;
!o.calculateState ? true ? invariant(false, 'Components that use FluxContainer must implement `static calculateState()`') : invariant(false) : void 0;
}
/**
* This is a way to connect stores to a functional stateless view. Here's a
* simple example:
*
* // FooView.js
*
* function FooView(props) {
* return <div>{props.value}</div>;
* }
*
* module.exports = FooView;
*
*
* // FooContainer.js
*
* function getStores() {
* return [FooStore];
* }
*
* function calculateState() {
* return {
* value: FooStore.getState();
* };
* }
*
* module.exports = FluxContainer.createFunctional(
* FooView,
* getStores,
* calculateState,
* );
*
*/
function createFunctional(viewFn, _getStores, _calculateState, options) {
var FunctionalContainer = /*#__PURE__*/function (_Component) {
_inheritsLoose(FunctionalContainer, _Component);
function FunctionalContainer() {
var _this2;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this2 = _Component.call.apply(_Component, [this].concat(args)) || this;
_defineProperty(_assertThisInitialized(_this2), "state", void 0);
return _this2;
}
FunctionalContainer.getStores = function getStores(props, context) {
return _getStores(props, context);
};
FunctionalContainer.calculateState = function calculateState(prevState, props, context) {
return _calculateState(prevState, props, context);
};
var _proto3 = FunctionalContainer.prototype;
_proto3.render = function render() {
return viewFn(this.state);
};
return FunctionalContainer;
}(Component); // Update the name of the component before creating the container.
var viewFnName = viewFn.displayName || viewFn.name || 'FunctionalContainer';
FunctionalContainer.displayName = viewFnName;
return create(FunctionalContainer, options);
}
module.exports = {
create: create,
createFunctional: createFunctional
};
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule FluxContainerSubscriptions
*
*/
'use strict';
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var FluxStoreGroup = __webpack_require__(3);
function shallowArrayEqual(a, b) {
if (a === b) {
return true;
}
if (a.length !== b.length) {
return false;
}
for (var i = 0; i < a.length; i++) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
}
var FluxContainerSubscriptions = /*#__PURE__*/function () {
function FluxContainerSubscriptions() {
_defineProperty(this, "_callbacks", void 0);
_defineProperty(this, "_storeGroup", void 0);
_defineProperty(this, "_stores", void 0);
_defineProperty(this, "_tokens", void 0);
this._callbacks = [];
}
var _proto = FluxContainerSubscriptions.prototype;
_proto.setStores = function setStores(stores) {
var _this = this;
if (this._stores && shallowArrayEqual(this._stores, stores)) {
return;
}
this._stores = stores;
this._resetTokens();
this._resetStoreGroup();
var changed = false;
var changedStores = [];
if (true) {
// Keep track of the stores that changed for debugging purposes only
this._tokens = stores.map(function (store) {
return store.addListener(function () {
changed = true;
changedStores.push(store);
});
});
} else {
var setChanged = function setChanged() {
changed = true;
};
this._tokens = stores.map(function (store) {
return store.addListener(setChanged);
});
}
var callCallbacks = function callCallbacks() {
if (changed) {
_this._callbacks.forEach(function (fn) {
return fn();
});
changed = false;
if (true) {
// Uncomment this to print the stores that changed.
// console.log(changedStores);
changedStores = [];
}
}
};
this._storeGroup = new FluxStoreGroup(stores, callCallbacks);
};
_proto.addListener = function addListener(fn) {
this._callbacks.push(fn);
};
_proto.reset = function reset() {
this._resetTokens();
this._resetStoreGroup();
this._resetCallbacks();
this._resetStores();
};
_proto._resetTokens = function _resetTokens() {
if (this._tokens) {
this._tokens.forEach(function (token) {
return token.remove();
});
this._tokens = null;
}
};
_proto._resetStoreGroup = function _resetStoreGroup() {
if (this._storeGroup) {
this._storeGroup.release();
this._storeGroup = null;
}
};
_proto._resetStores = function _resetStores() {
this._stores = null;
};
_proto._resetCallbacks = function _resetCallbacks() {
this._callbacks = [];
};
return FluxContainerSubscriptions;
}();
module.exports = FluxContainerSubscriptions;
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule FluxStoreGroup
*
*/
'use strict';
function _createForOfIteratorHelper(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (!it) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
var F = function F() {};
return {
s: F,
n: function n() {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
},
e: function e(_e) {
throw _e;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true,
didErr = false,
err;
return {
s: function s() {
it = it.call(o);
},
n: function n() {
var step = it.next();
normalCompletion = step.done;
return step;
},
e: function e(_e2) {
didErr = true;
err = _e2;
},
f: function f() {
try {
if (!normalCompletion && it["return"] != null) it["return"]();
} finally {
if (didErr) throw err;
}
}
};
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var invariant = __webpack_require__(4);
/**
* FluxStoreGroup allows you to execute a callback on every dispatch after
* waiting for each of the given stores.
*/
var FluxStoreGroup = /*#__PURE__*/function () {
function FluxStoreGroup(stores, callback) {
var _this = this;
_defineProperty(this, "_dispatcher", void 0);
_defineProperty(this, "_dispatchToken", void 0);
this._dispatcher = _getUniformDispatcher(stores);
// Precompute store tokens.
var storeTokens = stores.map(function (store) {
return store.getDispatchToken();
});
// Register with the dispatcher.
this._dispatchToken = this._dispatcher.register(function (payload) {
_this._dispatcher.waitFor(storeTokens);
callback();
});
}
var _proto = FluxStoreGroup.prototype;
_proto.release = function release() {
this._dispatcher.unregister(this._dispatchToken);
};
return FluxStoreGroup;
}();
function _getUniformDispatcher(stores) {
!(stores && stores.length) ? true ? invariant(false, 'Must provide at least one store to FluxStoreGroup') : invariant(false) : void 0;
var dispatcher = stores[0].getDispatcher();
if (true) {
var _iterator = _createForOfIteratorHelper(stores),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var store = _step.value;
!(store.getDispatcher() === dispatcher) ? true ? invariant(false, 'All stores in a FluxStoreGroup must use the same dispatcher') : invariant(false) : void 0;
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
return dispatcher;
}
module.exports = FluxStoreGroup;
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
'use strict';
var validateFormat = true ? function (format) {
if (format === undefined) {
throw new Error('invariant(...): Second argument must be a string.');
}
} : function (format) {};
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments to provide
* information about what broke and what you were expecting.
*
* The invariant message will be stripped in production, but the invariant will
* remain to ensure logic does not differ in production.
*/
function invariant(condition, format) {
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
validateFormat(format);
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return String(args[argIndex++]);
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // Skip invariant's own stack frame.
throw error;
}
}
module.exports = invariant;
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
if (false) {
module.exports = require('./cjs/react.production.min.js');
} else {
module.exports = __webpack_require__(6);
}
/***/ }),
/* 6 */
/***/ (function(module, exports, __webpack_require__) {
/** @license React v17.0.2
* react.development.js
*
* 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';
if (true) {
(function () {
'use strict';
var _assign = __webpack_require__(7);
// TODO: this is special because it gets imported during build.
var ReactVersion = '17.0.2';
// ATTENTION
// When adding new symbols to this file,
// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE = 0xeac7;
var REACT_PORTAL_TYPE = 0xeaca;
exports.Fragment = 0xeacb;
exports.StrictMode = 0xeacc;
exports.Profiler = 0xead2;
var REACT_PROVIDER_TYPE = 0xeacd;
var REACT_CONTEXT_TYPE = 0xeace;
var REACT_FORWARD_REF_TYPE = 0xead0;
exports.Suspense = 0xead1;
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
var REACT_MEMO_TYPE = 0xead3;
var REACT_LAZY_TYPE = 0xead4;
var REACT_BLOCK_TYPE = 0xead9;
var REACT_SERVER_BLOCK_TYPE = 0xeada;
var REACT_FUNDAMENTAL_TYPE = 0xead5;
var REACT_SCOPE_TYPE = 0xead7;
var REACT_OPAQUE_ID_TYPE = 0xeae0;
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
var REACT_OFFSCREEN_TYPE = 0xeae2;
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
if (typeof Symbol === 'function' && Symbol.for) {
var symbolFor = Symbol.for;
REACT_ELEMENT_TYPE = symbolFor('react.element');
REACT_PORTAL_TYPE = symbolFor('react.portal');
exports.Fragment = symbolFor('react.fragment');
exports.StrictMode = symbolFor('react.strict_mode');
exports.Profiler = symbolFor('react.profiler');
REACT_PROVIDER_TYPE = symbolFor('react.provider');
REACT_CONTEXT_TYPE = symbolFor('react.context');
REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
exports.Suspense = symbolFor('react.suspense');
REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
REACT_MEMO_TYPE = symbolFor('react.memo');
REACT_LAZY_TYPE = symbolFor('react.lazy');
REACT_BLOCK_TYPE = symbolFor('react.block');
REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
REACT_SCOPE_TYPE = symbolFor('react.scope');
REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
}
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator';
function getIteratorFn(maybeIterable) {
if (maybeIterable === null || typeof maybeIterable !== 'object') {
return null;
}
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
if (typeof maybeIterator === 'function') {
return maybeIterator;
}
return null;
}
/**
* Keeps track of the current dispatcher.
*/
var ReactCurrentDispatcher = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
/**
* Keeps track of the current batch's configuration such as how long an update
* should suspend for if it needs to.
*/
var ReactCurrentBatchConfig = {
transition: 0
};
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
var ReactDebugCurrentFrame = {};
var currentExtraStackFrame = null;
function setExtraStackFrame(stack) {
{
currentExtraStackFrame = stack;
}
}
{
ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
{
currentExtraStackFrame = stack;
}
}; // Stack implementation injected by the current renderer.
ReactDebugCurrentFrame.getCurrentStack = null;
ReactDebugCurrentFrame.getStackAddendum = function () {
var stack = ''; // Add an extra top frame while an element is being validated
if (currentExtraStackFrame) {
stack += currentExtraStackFrame;
} // Delegate to the injected renderer-specific implementation
var impl = ReactDebugCurrentFrame.getCurrentStack;
if (impl) {
stack += impl() || '';
}
return stack;
};
}
/**
* Used by act() to track whether you're inside an act() scope.
*/
var IsSomeRendererActing = {
current: false
};
var ReactSharedInternals = {
ReactCurrentDispatcher: ReactCurrentDispatcher,
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
ReactCurrentOwner: ReactCurrentOwner,
IsSomeRendererActing: IsSomeRendererActing,
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
assign: _assign
};
{
ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
}
// by calls to these methods by a Babel plugin.
//
// In PROD (or in packages without access to React internals),
// they are left as they are instead.
function warn(format) {
{
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
printWarning('warn', format, args);
}
}
function error(format) {
{
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
printWarning('error', format, args);
}
}
function printWarning(level, format, args) {
// When changing this logic, you might want to also
// update consoleWithStackDev.www.js as well.
{
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
var stack = ReactDebugCurrentFrame.getStackAddendum();
if (stack !== '') {
format += '%s';
args = args.concat([stack]);
}
var argsWithFormat = args.map(function (item) {
return '' + item;
}); // Careful: RN currently depends on this prefix
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
// breaks IE9: https://github.com/facebook/react/issues/13610
// eslint-disable-next-line react-internal/no-production-logging
Function.prototype.apply.call(console[level], console, argsWithFormat);
}
}
var didWarnStateUpdateForUnmountedComponent = {};
function warnNoop(publicInstance, callerName) {
{
var _constructor = publicInstance.constructor;
var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
var warningKey = componentName + "." + callerName;
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
return;
}
error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
}
}
/**
* This is the abstract API for an update queue.
*/
var ReactNoopUpdateQueue = {
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function (publicInstance) {
return false;
},
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {?function} callback Called after component is updated.
* @param {?string} callerName name of the calling function in the public API.
* @internal
*/
enqueueForceUpdate: function (publicInstance, callback, callerName) {
warnNoop(publicInstance, 'forceUpdate');
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} completeState Next state.
* @param {?function} callback Called after component is updated.
* @param {?string} callerName name of the calling function in the public API.
* @internal
*/
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
warnNoop(publicInstance, 'replaceState');
},
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialState Next partial state to be merged with state.
* @param {?function} callback Called after component is updated.
* @param {?string} Name of the calling function in the public API.
* @internal
*/
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
warnNoop(publicInstance, 'setState');
}
};
var emptyObject = {};
{
Object.freeze(emptyObject);
}
/**
* Base class helpers for the updating state of a component.
*/
function Component(props, context, updater) {
this.props = props;
this.context = context; // If a component has string refs, we will assign a different object later.
this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue;
}
Component.prototype.isReactComponent = {};
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* There is no guarantee that calls to `setState` will run synchronously,
* as they may eventually be batched together. You can provide an optional
* callback that will be executed when the call to setState is actually
* completed.
*
* When a function is provided to setState, it will be called at some point in
* the future (not synchronously). It will be called with the up to date
* component arguments (state, props, context). These values can be different
* from this.* because your function may be called after receiveProps but before
* shouldComponentUpdate, and this new state, props, and context will not yet be
* assigned to this.
*
* @param {object|function} partialState Next partial state or function to
* produce next partial state to be merged with current state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
Component.prototype.setState = function (partialState, callback) {
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
{
throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");
}
}
this.updater.enqueueSetState(this, partialState, callback, 'setState');
};
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {?function} callback Called after update is complete.
* @final
* @protected
*/
Component.prototype.forceUpdate = function (callback) {
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
};
/**
* Deprecated APIs. These APIs used to exist on classic React classes but since
* we would like to deprecate them, we're not going to move them over to this
* modern base class. Instead, we define a getter that warns if it's accessed.
*/
{
var deprecatedAPIs = {
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
};
var defineDeprecationWarning = function (methodName, info) {
Object.defineProperty(Component.prototype, methodName, {
get: function () {
warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
return undefined;
}
});
};
for (var fnName in deprecatedAPIs) {
if (deprecatedAPIs.hasOwnProperty(fnName)) {
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
}
}
}
function ComponentDummy() {}
ComponentDummy.prototype = Component.prototype;
/**
* Convenience component with default shallow equality check for sCU.
*/
function PureComponent(props, context, updater) {
this.props = props;
this.context = context; // If a component has string refs, we will assign a different object later.
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
}
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
_assign(pureComponentPrototype, Component.prototype);
pureComponentPrototype.isPureReactComponent = true;
// an immutable object with a single mutable value
function createRef() {
var refObject = {
current: null
};
{
Object.seal(refObject);
}
return refObject;
}
function getWrappedName(outerType, innerType, wrapperName) {
var functionName = innerType.displayName || innerType.name || '';
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
}
function getContextName(type) {
return type.displayName || 'Context';
}
function getComponentName(type) {
if (type == null) {
// Host root, text node or just invalid type.
return null;
}
{
if (typeof type.tag === 'number') {
error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
}
}
if (typeof type === 'function') {
return type.displayName || type.name || null;
}
if (typeof type === 'string') {
return type;
}
switch (type) {
case exports.Fragment:
return 'Fragment';
case REACT_PORTAL_TYPE:
return 'Portal';
case exports.Profiler:
return 'Profiler';
case exports.StrictMode:
return 'StrictMode';
case exports.Suspense:
return 'Suspense';
case REACT_SUSPENSE_LIST_TYPE:
return 'SuspenseList';
}
if (typeof type === 'object') {
switch (type.$$typeof) {
case REACT_CONTEXT_TYPE:
var context = type;
return getContextName(context) + '.Consumer';
case REACT_PROVIDER_TYPE:
var provider = type;
return getContextName(provider._context) + '.Provider';
case REACT_FORWARD_REF_TYPE:
return getWrappedName(type, type.render, 'ForwardRef');
case REACT_MEMO_TYPE:
return getComponentName(type.type);
case REACT_BLOCK_TYPE:
return getComponentName(type._render);
case REACT_LAZY_TYPE:
{
var lazyComponent = type;
var payload = lazyComponent._payload;
var init = lazyComponent._init;
try {
return getComponentName(init(payload));
} catch (x) {
return null;
}
}
}
}
return null;
}
var hasOwnProperty = Object.prototype.hasOwnProperty;
var RESERVED_PROPS = {
key: true,
ref: true,
__self: true,
__source: true
};
var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
{
didWarnAboutStringRefs = {};
}
function hasValidRef(config) {
{
if (hasOwnProperty.call(config, 'ref')) {
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.ref !== undefined;
}
function hasValidKey(config) {
{
if (hasOwnProperty.call(config, 'key')) {
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
if (getter && getter.isReactWarning) {
return false;
}
}
}
return config.key !== undefined;
}
function defineKeyPropWarningGetter(props, displayName) {
var warnAboutAccessingKey = function () {
{
if (!specialPropKeyWarningShown) {
specialPropKeyWarningShown = true;
error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
}
}
};
warnAboutAccessingKey.isReactWarning = true;
Object.defineProperty(props, 'key', {
get: warnAboutAccessingKey,
configurable: true
});
}
function defineRefPropWarningGetter(props, displayName) {
var warnAboutAccessingRef = function () {
{
if (!specialPropRefWarningShown) {
specialPropRefWarningShown = true;
error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
}
}
};
warnAboutAccessingRef.isReactWarning = true;
Object.defineProperty(props, 'ref', {
get: warnAboutAccessingRef,
configurable: true
});
}
function warnIfStringRefCannotBeAutoConverted(config) {
{
if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
var componentName = getComponentName(ReactCurrentOwner.current.type);
if (!didWarnAboutStringRefs[componentName]) {
error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
didWarnAboutStringRefs[componentName] = true;
}
}
}
}
/**
* Factory method to create a new React element. This no longer adheres to
* the class pattern, so do not use new to call it. Also, instanceof check
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
* if something is a React Element.
*
* @param {*} type
* @param {*} props
* @param {*} key
* @param {string|object} ref
* @param {*} owner
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @internal
*/
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allows us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
{
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
writable: true,
value: false
}); // self and source are DEV only properties.
Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
writable: false,
value: self
}); // Two elements created in two different places should be considered
// equal for testing purposes and therefore we hide it from enumeration.
Object.defineProperty(element, '_source', {
configurable: false,
enumerable: false,
writable: false,
value: source
});
if (Object.freeze) {
Object.freeze(element.props);
Object.freeze(element);
}
}
return element;
};
/**
* Create and return a new ReactElement of the given type.
* See https://reactjs.org/docs/react-api.html#createelement
*/
function createElement(type, config, children) {
var propName; // Reserved names are extracted
var props = {};
var key = null;
var ref = null;
var self = null;
var source = null;
if (config != null) {
if (hasValidRef(config)) {
ref = config.ref;
{
warnIfStringRefCannotBeAutoConverted(config);
}
}
if (hasValidKey(config)) {
key = '' + config.key;
}
self = config.__self === undefined ? null : config.__self;
source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
for (propName in config) {
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
} // Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
{
if (Object.freeze) {
Object.freeze(childArray);
}
}
props.children = childArray;
} // Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (props[propName] === undefined) {
props[propName] = defaultProps[propName];
}
}
}
{
if (key || ref) {
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
if (key) {
defineKeyPropWarningGetter(props, displayName);
}
if (ref) {
defineRefPropWarningGetter(props, displayName);
}
}
}
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
}
function cloneAndReplaceKey(oldElement, newKey) {
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
return newElement;
}
/**
* Clone and return a new ReactElement using element as the starting point.
* See https://reactjs.org/docs/react-api.html#cloneelement
*/
function cloneElement(element, config, children) {
if (!!(element === null || element === undefined)) {
{
throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + ".");
}
}
var propName; // Original props are copied
var props = _assign({}, element.props); // Reserved names are extracted
var key = element.key;
var ref = element.ref; // Self is preserved since the owner is preserved.
var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
// transpiler, and the original source is probably a better indicator of the
// true owner.
var source = element._source; // Owner will be preserved, unless ref is overridden
var owner = element._owner;
if (config != null) {
if (hasValidRef(config)) {
// Silently steal the ref from the parent.
ref = config.ref;
owner = ReactCurrentOwner.current;
}
if (hasValidKey(config)) {
key = '' + config.key;
} // Remaining properties override existing props
var defaultProps;
if (element.type && element.type.defaultProps) {
defaultProps = element.type.defaultProps;
}
for (propName in config) {
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
if (config[propName] === undefined && defaultProps !== undefined) {
// Resolve default props
props[propName] = defaultProps[propName];
} else {
props[propName] = config[propName];
}
}
}
} // Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
return ReactElement(element.type, key, ref, self, source, owner, props);
}
/**
* Verifies the object is a ReactElement.
* See https://reactjs.org/docs/react-api.html#isvalidelement
* @param {?object} object
* @return {boolean} True if `object` is a ReactElement.
* @final
*/
function isValidElement(object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
}
var SEPARATOR = '.';
var SUBSEPARATOR = ':';
/**
* Escape and wrap key so it is safe to use as a reactid
*
* @param {string} key to be escaped.
* @return {string} the escaped key.
*/
function escape(key) {
var escapeRegex = /[=:]/g;
var escaperLookup = {
'=': '=0',
':': '=2'
};
var escapedString = key.replace(escapeRegex, function (match) {
return escaperLookup[match];
});
return '$' + escapedString;
}
/**
* TODO: Test that a single child and an array with one item have the same key
* pattern.
*/
var didWarnAboutMaps = false;
var userProvidedKeyEscapeRegex = /\/+/g;
function escapeUserProvidedKey(text) {
return text.replace(userProvidedKeyEscapeRegex, '$&/');
}
/**
* Generate a key string that identifies a element within a set.
*
* @param {*} element A element that could contain a manual key.
* @param {number} index Index that is used if a manual key is not provided.
* @return {string}
*/
function getElementKey(element, index) {
// Do some typechecking here since we call this blindly. We want to ensure
// that we don't block potential future ES APIs.
if (typeof element === 'object' && element !== null && element.key != null) {
// Explicit key
return escape('' + element.key);
} // Implicit key determined by the index in the set
return index.toString(36);
}
function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
// All of the above are perceived as null.
children = null;
}
var invokeCallback = false;
if (children === null) {
invokeCallback = true;
} else {
switch (type) {
case 'string':
case 'number':
invokeCallback = true;
break;
case 'object':
switch (children.$$typeof) {
case REACT_ELEMENT_TYPE:
case REACT_PORTAL_TYPE:
invokeCallback = true;
}
}
}
if (invokeCallback) {
var _child = children;
var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows:
var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
if (Array.isArray(mappedChild)) {
var escapedChildKey = '';
if (childKey != null) {
escapedChildKey = escapeUserProvidedKey(childKey) + '/';
}
mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
return c;
});
} else if (mappedChild != null) {
if (isValidElement(mappedChild)) {
mappedChild = cloneAndReplaceKey(mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
escapedPrefix + (
// $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
mappedChild.key && (!_child || _child.key !== mappedChild.key) ?
// $FlowFixMe Flow incorrectly thinks existing element's key can be a number
escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
}
array.push(mappedChild);
}
return 1;
}
var child;
var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = nextNamePrefix + getElementKey(child, i);
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
}
} else {
var iteratorFn = getIteratorFn(children);
if (typeof iteratorFn === 'function') {
var iterableChildren = children;
{
// Warn about using Maps as children
if (iteratorFn === iterableChildren.entries) {
if (!didWarnAboutMaps) {
warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
}
didWarnAboutMaps = true;
}
}
var iterator = iteratorFn.call(iterableChildren);
var step;
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
nextName = nextNamePrefix + getElementKey(child, ii++);
subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
}
} else if (type === 'object') {
var childrenString = '' + children;
{
{
throw Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead.");
}
}
}
}
return subtreeCount;
}
/**
* Maps children that are typically specified as `props.children`.
*
* See https://reactjs.org/docs/react-api.html#reactchildrenmap
*
* The provided mapFunction(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func The map function.
* @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var result = [];
var count = 0;
mapIntoArray(children, result, '', '', function (child) {
return func.call(context, child, count++);
});
return result;
}
/**
* Count the number of children that are typically specified as
* `props.children`.
*
* See https://reactjs.org/docs/react-api.html#reactchildrencount
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
function countChildren(children) {
var n = 0;
mapChildren(children, function () {
n++; // Don't return anything
});
return n;
}
/**
* Iterates through children that are typically specified as `props.children`.
*
* See https://reactjs.org/docs/react-api.html#reactchildrenforeach
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
mapChildren(children, function () {
forEachFunc.apply(this, arguments); // Don't return anything.
}, forEachContext);
}
/**
* Flatten a children object (typically specified as `props.children`) and
* return an array with appropriately re-keyed children.
*
* See https://reactjs.org/docs/react-api.html#reactchildrentoarray
*/
function toArray(children) {
return mapChildren(children, function (child) {
return child;
}) || [];
}
/**
* Returns the first child in a collection of children and verifies that there
* is only one child in the collection.
*
* See https://reactjs.org/docs/react-api.html#reactchildrenonly
*
* The current implementation of this function assumes that a single child gets
* passed without a wrapper, but the purpose of this helper function is to
* abstract away the particular structure of children.
*
* @param {?object} children Child collection structure.
* @return {ReactElement} The first and only `ReactElement` contained in the
* structure.
*/
function onlyChild(children) {
if (!isValidElement(children)) {
{
throw Error("React.Children.only expected to receive a single React element child.");
}
}
return children;
}
function createContext(defaultValue, calculateChangedBits) {
if (calculateChangedBits === undefined) {
calculateChangedBits = null;
} else {
{
if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
}
}
}
var context = {
$$typeof: REACT_CONTEXT_TYPE,
_calculateChangedBits: calculateChangedBits,
// As a workaround to support multiple concurrent renderers, we categorize
// some renderers as primary and others as secondary. We only expect
// there to be two concurrent renderers at most: React Native (primary) and
// Fabric (secondary); React DOM (primary) and React ART (secondary).
// Secondary renderers store their context values on separate fields.
_currentValue: defaultValue,
_currentValue2: defaultValue,
// Used to track how many concurrent renderers this context currently
// supports within in a single renderer. Such as parallel server rendering.
_threadCount: 0,
// These are circular
Provider: null,
Consumer: null
};
context.Provider = {
$$typeof: REACT_PROVIDER_TYPE,
_context: context
};
var hasWarnedAboutUsingNestedContextConsumers = false;
var hasWarnedAboutUsingConsumerProvider = false;
var hasWarnedAboutDisplayNameOnConsumer = false;
{
// A separate object, but proxies back to the original context object for
// backwards compatibility. It has a different $$typeof, so we can properly
// warn for the incorrect usage of Context as a Consumer.
var Consumer = {
$$typeof: REACT_CONTEXT_TYPE,
_context: context,
_calculateChangedBits: context._calculateChangedBits
}; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
Object.defineProperties(Consumer, {
Provider: {
get: function () {
if (!hasWarnedAboutUsingConsumerProvider) {
hasWarnedAboutUsingConsumerProvider = true;
error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
}
return context.Provider;
},
set: function (_Provider) {
context.Provider = _Provider;
}
},
_currentValue: {
get: function () {
return context._currentValue;
},
set: function (_currentValue) {
context._currentValue = _currentValue;
}
},
_currentValue2: {
get: function () {
return context._currentValue2;
},
set: function (_currentValue2) {
context._currentValue2 = _currentValue2;
}
},
_threadCount: {
get: function () {
return context._threadCount;
},
set: function (_threadCount) {
context._threadCount = _threadCount;
}
},
Consumer: {
get: function () {
if (!hasWarnedAboutUsingNestedContextConsumers) {
hasWarnedAboutUsingNestedContextConsumers = true;
error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
}
return context.Consumer;
}
},
displayName: {
get: function () {
return context.displayName;
},
set: function (displayName) {
if (!hasWarnedAboutDisplayNameOnConsumer) {
warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
hasWarnedAboutDisplayNameOnConsumer = true;
}
}
}
}); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
context.Consumer = Consumer;
}
{
context._currentRenderer = null;
context._currentRenderer2 = null;
}
return context;
}
var Uninitialized = -1;
var Pending = 0;
var Resolved = 1;
var Rejected = 2;
function lazyInitializer(payload) {
if (payload._status === Uninitialized) {
var ctor = payload._result;
var thenable = ctor(); // Transition to the next state.
var pending = payload;
pending._status = Pending;
pending._result = thenable;
thenable.then(function (moduleObject) {
if (payload._status === Pending) {
var defaultExport = moduleObject.default;
{
if (defaultExport === undefined) {
error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' +
// Break up imports to avoid accidentally parsing them as dependencies.
'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
}
} // Transition to the next state.
var resolved = payload;
resolved._status = Resolved;
resolved._result = defaultExport;
}
}, function (error) {
if (payload._status === Pending) {
// Transition to the next state.
var rejected = payload;
rejected._status = Rejected;
rejected._result = error;
}
});
}
if (payload._status === Resolved) {
return payload._result;
} else {
throw payload._result;
}
}
function lazy(ctor) {
var payload = {
// We use these fields to store the result.
_status: -1,
_result: ctor
};
var lazyType = {
$$typeof: REACT_LAZY_TYPE,
_payload: payload,
_init: lazyInitializer
};
{
// In production, this would just set it on the object.
var defaultProps;
var propTypes; // $FlowFixMe
Object.defineProperties(lazyType, {
defaultProps: {
configurable: true,
get: function () {
return defaultProps;
},
set: function (newDefaultProps) {
error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
defaultProps = newDefaultProps; // Match production behavior more closely:
// $FlowFixMe
Object.defineProperty(lazyType, 'defaultProps', {
enumerable: true
});
}
},
propTypes: {
configurable: true,
get: function () {
return propTypes;
},
set: function (newPropTypes) {
error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
propTypes = newPropTypes; // Match production behavior more closely:
// $FlowFixMe
Object.defineProperty(lazyType, 'propTypes', {
enumerable: true
});
}
}
});
}
return lazyType;
}
function forwardRef(render) {
{
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
} else if (typeof render !== 'function') {
error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
} else {
if (render.length !== 0 && render.length !== 2) {
error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
}
}
if (render != null) {
if (render.defaultProps != null || render.propTypes != null) {
error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
}
}
}
var elementType = {
$$typeof: REACT_FORWARD_REF_TYPE,
render: render
};
{
var ownName;
Object.defineProperty(elementType, 'displayName', {
enumerable: false,
configurable: true,
get: function () {
return ownName;
},
set: function (name) {
ownName = name;
if (render.displayName == null) {
render.displayName = name;
}
}
});
}
return elementType;
}
// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
var enableScopeAPI = false; // Experimental Create Event Handle API.
function isValidElementType(type) {
if (typeof type === 'string' || typeof type === 'function') {
return true;
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI) {
return true;
}
if (typeof type === 'object' && type !== null) {
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
return true;
}
}
return false;
}
function memo(type, compare) {
{
if (!isValidElementType(type)) {
error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
}
}
var elementType = {
$$typeof: REACT_MEMO_TYPE,
type: type,
compare: compare === undefined ? null : compare
};
{
var ownName;
Object.defineProperty(elementType, 'displayName', {
enumerable: false,
configurable: true,
get: function () {
return ownName;
},
set: function (name) {
ownName = name;
if (type.displayName == null) {
type.displayName = name;
}
}
});
}
return elementType;
}
function resolveDispatcher() {
var dispatcher = ReactCurrentDispatcher.current;
if (!(dispatcher !== null)) {
{
throw Error("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.");
}
}
return dispatcher;
}
function useContext(Context, unstable_observedBits) {
var dispatcher = resolveDispatcher();
{
if (unstable_observedBits !== undefined) {
error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : '');
} // TODO: add a more generic warning for invalid values.
if (Context._context !== undefined) {
var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
// and nobody should be using this in existing code.
if (realContext.Consumer === Context) {
error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
} else if (realContext.Provider === Context) {
error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
}
}
}
return dispatcher.useContext(Context, unstable_observedBits);
}
function useState(initialState) {
var dispatcher = resolveDispatcher();
return dispatcher.useState(initialState);
}
function useReducer(reducer, initialArg, init) {
var dispatcher = resolveDispatcher();
return dispatcher.useReducer(reducer, initialArg, init);
}
function useRef(initialValue) {
var dispatcher = resolveDispatcher();
return dispatcher.useRef(initialValue);
}
function useEffect(create, deps) {
var dispatcher = resolveDispatcher();
return dispatcher.useEffect(create, deps);
}
function useLayoutEffect(create, deps) {
var dispatcher = resolveDispatcher();
return dispatcher.useLayoutEffect(create, deps);
}
function useCallback(callback, deps) {
var dispatcher = resolveDispatcher();
return dispatcher.useCallback(callback, deps);
}
function useMemo(create, deps) {
var dispatcher = resolveDispatcher();
return dispatcher.useMemo(create, deps);
}
function useImperativeHandle(ref, create, deps) {
var dispatcher = resolveDispatcher();
return dispatcher.useImperativeHandle(ref, create, deps);
}
function useDebugValue(value, formatterFn) {
{
var dispatcher = resolveDispatcher();
return dispatcher.useDebugValue(value, formatterFn);
}
}
// Helpers to patch console.logs to avoid logging during side-effect free
// replaying on render function. This currently only patches the object
// lazily which won't cover if the log function was extracted eagerly.
// We could also eagerly patch the method.
var disabledDepth = 0;
var prevLog;
var prevInfo;
var prevWarn;
var prevError;
var prevGroup;
var prevGroupCollapsed;
var prevGroupEnd;
function disabledLog() {}
disabledLog.__reactDisabledLog = true;
function disableLogs() {
{
if (disabledDepth === 0) {
/* eslint-disable react-internal/no-production-logging */
prevLog = console.log;
prevInfo = console.info;
prevWarn = console.warn;
prevError = console.error;
prevGroup = console.group;
prevGroupCollapsed = console.groupCollapsed;
prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
var props = {
configurable: true,
enumerable: true,
value: disabledLog,
writable: true
}; // $FlowFixMe Flow thinks console is immutable.
Object.defineProperties(console, {
info: props,
log: props,
warn: props,
error: props,
group: props,
groupCollapsed: props,
groupEnd: props
});
/* eslint-enable react-internal/no-production-logging */
}
disabledDepth++;
}
}
function reenableLogs() {
{
disabledDepth--;
if (disabledDepth === 0) {
/* eslint-disable react-internal/no-production-logging */
var props = {
configurable: true,
enumerable: true,
writable: true
}; // $FlowFixMe Flow thinks console is immutable.
Object.defineProperties(console, {
log: _assign({}, props, {
value: prevLog
}),
info: _assign({}, props, {
value: prevInfo
}),
warn: _assign({}, props, {
value: prevWarn
}),
error: _assign({}, props, {
value: prevError
}),
group: _assign({}, props, {
value: prevGroup
}),
groupCollapsed: _assign({}, props, {
value: prevGroupCollapsed
}),
groupEnd: _assign({}, props, {
value: prevGroupEnd
})
});
/* eslint-enable react-internal/no-production-logging */
}
if (disabledDepth < 0) {
error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
}
}
}
var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
var prefix;
function describeBuiltInComponentFrame(name, source, ownerFn) {
{
if (prefix === undefined) {
// Extract the VM specific prefix used by each line.
try {
throw Error();
} catch (x) {
var match = x.stack.trim().match(/\n( *(at )?)/);
prefix = match && match[1] || '';
}
} // We use the prefix to ensure our stacks line up with native stack frames.
return '\n' + prefix + name;
}
}
var reentry = false;
var componentFrameCache;
{
var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
componentFrameCache = new PossiblyWeakMap();
}
function describeNativeComponentFrame(fn, construct) {
// If something asked for a stack inside a fake render, it should get ignored.
if (!fn || reentry) {
return '';
}
{
var frame = componentFrameCache.get(fn);
if (frame !== undefined) {
return frame;
}
}
var control;
reentry = true;
var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
Error.prepareStackTrace = undefined;
var previousDispatcher;
{
previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
// for warnings.
ReactCurrentDispatcher$1.current = null;
disableLogs();
}
try {
// This should throw.
if (construct) {
// Something should be setting the props in the constructor.
var Fake = function () {
throw Error();
}; // $FlowFixMe
Object.defineProperty(Fake.prototype, 'props', {
set: function () {
// We use a throwing setter instead of frozen or non-writable props
// because that won't throw in a non-strict mode function.
throw Error();
}
});
if (typeof Reflect === 'object' && Reflect.construct) {
// We construct a different control for this case to include any extra
// frames added by the construct call.
try {
Reflect.construct(Fake, []);
} catch (x) {
control = x;
}
Reflect.construct(fn, [], Fake);
} else {
try {
Fake.call();
} catch (x) {
control = x;
}
fn.call(Fake.prototype);
}
} else {
try {
throw Error();
} catch (x) {
control = x;
}
fn();
}
} catch (sample) {
// This is inlined manually because closure doesn't do it for us.
if (sample && control && typeof sample.stack === 'string') {
// This extracts the first frame from the sample that isn't also in the control.
// Skipping one frame that we assume is the frame that calls the two.
var sampleLines = sample.stack.split('\n');
var controlLines = control.stack.split('\n');
var s = sampleLines.length - 1;
var c = controlLines.length - 1;
while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
// We expect at least one stack frame to be shared.
// Typically this will be the root most one. However, stack frames may be
// cut off due to maximum stack limits. In this case, one maybe cut off
// earlier than the other. We assume that the sample is longer or the same
// and there for cut off earlier. So we should find the root most frame in
// the sample somewhere in the control.
c--;
}
for (; s >= 1 && c >= 0; s--, c--) {
// Next we find the first one that isn't the same which should be the
// frame that called our sample function and the control.
if (sampleLines[s] !== controlLines[c]) {
// In V8, the first line is describing the message but other VMs don't.
// If we're about to return the first line, and the control is also on the same
// line, that's a pretty good indicator that our sample threw at same line as
// the control. I.e. before we entered the sample frame. So we ignore this result.
// This can happen if you passed a class to function component, or non-function.
if (s !== 1 || c !== 1) {
do {
s--;
c--; // We may still have similar intermediate frames from the construct call.
// The next one that isn't the same should be our match though.
if (c < 0 || sampleLines[s] !== controlLines[c]) {
// V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
{
if (typeof fn === 'function') {
componentFrameCache.set(fn, _frame);
}
} // Return the line we found.
return _frame;
}
} while (s >= 1 && c >= 0);
}
break;
}
}
}
} finally {
reentry = false;
{
ReactCurrentDispatcher$1.current = previousDispatcher;
reenableLogs();
}
Error.prepareStackTrace = previousPrepareStackTrace;
} // Fallback to just using the name if we couldn't make it throw.
var name = fn ? fn.displayName || fn.name : '';
var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
{
if (typeof fn === 'function') {
componentFrameCache.set(fn, syntheticFrame);
}
}
return syntheticFrame;
}
function describeFunctionComponentFrame(fn, source, ownerFn) {
{
return describeNativeComponentFrame(fn, false);
}
}
function shouldConstruct(Component) {
var prototype = Component.prototype;
return !!(prototype && prototype.isReactComponent);
}
function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
if (type == null) {
return '';
}
if (typeof type === 'function') {
{
return describeNativeComponentFrame(type, shouldConstruct(type));
}
}
if (typeof type === 'string') {
return describeBuiltInComponentFrame(type);
}
switch (type) {
case exports.Suspense:
return describeBuiltInComponentFrame('Suspense');
case REACT_SUSPENSE_LIST_TYPE:
return describeBuiltInComponentFrame('SuspenseList');
}
if (typeof type === 'object') {
switch (type.$$typeof) {
case REACT_FORWARD_REF_TYPE:
return describeFunctionComponentFrame(type.render);
case REACT_MEMO_TYPE:
// Memo may contain any component type so we recursively resolve it.
return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
case REACT_BLOCK_TYPE:
return describeFunctionComponentFrame(type._render);
case REACT_LAZY_TYPE:
{
var lazyComponent = type;
var payload = lazyComponent._payload;
var init = lazyComponent._init;
try {
// Lazy may contain any component type so we recursively resolve it.
return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
} catch (x) {}
}
}
}
return '';
}
var loggedTypeFailures = {};
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
function setCurrentlyValidatingElement(element) {
{
if (element) {
var owner = element._owner;
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
} else {
ReactDebugCurrentFrame$1.setExtraStackFrame(null);
}
}
}
function checkPropTypes(typeSpecs, values, location, componentName, element) {
{
// $FlowFixMe This is okay but Flow doesn't know it.
var has = Function.call.bind(Object.prototype.hasOwnProperty);
for (var typeSpecName in typeSpecs) {
if (has(typeSpecs, typeSpecName)) {
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
if (typeof typeSpecs[typeSpecName] !== 'function') {
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
err.name = 'Invariant Violation';
throw err;
}
error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
} catch (ex) {
error$1 = ex;
}
if (error$1 && !(error$1 instanceof Error)) {
setCurrentlyValidatingElement(element);
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
setCurrentlyValidatingElement(null);
}
if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error$1.message] = true;
setCurrentlyValidatingElement(element);
error('Failed %s type: %s', location, error$1.message);
setCurrentlyValidatingElement(null);
}
}
}
}
}
function setCurrentlyValidatingElement$1(element) {
{
if (element) {
var owner = element._owner;
var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
setExtraStackFrame(stack);
} else {
setExtraStackFrame(null);
}
}
}
var propTypesMisspellWarningShown;
{
propTypesMisspellWarningShown = false;
}
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
var name = getComponentName(ReactCurrentOwner.current.type);
if (name) {
return '\n\nCheck the render method of `' + name + '`.';
}
}
return '';
}
function getSourceInfoErrorAddendum(source) {
if (source !== undefined) {
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
var lineNumber = source.lineNumber;
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
}
return '';
}
function getSourceInfoErrorAddendumForProps(elementProps) {
if (elementProps !== null && elementProps !== undefined) {
return getSourceInfoErrorAddendum(elementProps.__source);
}
return '';
}
/**
* Warn if there's no key explicitly set on dynamic arrays of children or
* object keys are not valid. This allows us to keep track of children between
* updates.
*/
var ownerHasKeyUseWarning = {};
function getCurrentComponentErrorInfo(parentType) {
var info = getDeclarationErrorAddendum();
if (!info) {
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
if (parentName) {
info = "\n\nCheck the top-level render call using <" + parentName + ">.";
}
}
return info;
}
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
* reordered. All children that haven't already been validated are required to
* have a "key" property assigned to it. Error statuses are cached so a warning
* will only be shown once.
*
* @internal
* @param {ReactElement} element Element that requires a key.
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
return;
}
ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
var childOwner = '';
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
// Give the component that originally created this child.
childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
}
{
setCurrentlyValidatingElement$1(element);
error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
setCurrentlyValidatingElement$1(null);
}
}
/**
* Ensure that every element either is passed in a static location, in an
* array with an explicit keys property defined, or in an object literal
* with valid key property.
*
* @internal
* @param {ReactNode} node Statically passed child of any type.
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
if (typeof node !== 'object') {
return;
}
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (isValidElement(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (isValidElement(node)) {
// This element was passed in a valid location.
if (node._store) {
node._store.validated = true;
}
} else if (node) {
var iteratorFn = getIteratorFn(node);
if (typeof iteratorFn === 'function') {
// Entry iterators used to provide implicit keys,
// but now we print a separate warning for them later.
if (iteratorFn !== node.entries) {
var iterator = iteratorFn.call(node);
var step;
while (!(step = iterator.next()).done) {
if (isValidElement(step.value)) {
validateExplicitKey(step.value, parentType);
}
}
}
}
}
}
/**
* Given an element, validate that its props follow the propTypes definition,
* provided by the type.
*
* @param {ReactElement} element
*/
function validatePropTypes(element) {
{
var type = element.type;
if (type === null || type === undefined || typeof type === 'string') {
return;
}
var propTypes;
if (typeof type === 'function') {
propTypes = type.propTypes;
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
// Note: Memo only checks outer props here.
// Inner props are checked in the reconciler.
type.$$typeof === REACT_MEMO_TYPE)) {
propTypes = type.propTypes;
} else {
return;
}
if (propTypes) {
// Intentionally inside to avoid triggering lazy initializers:
var name = getComponentName(type);
checkPropTypes(propTypes, element.props, 'prop', name, element);
} else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
var _name = getComponentName(type);
error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
}
if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
}
}
}
/**
* Given a fragment, validate that it can only be provided with fragment props
* @param {ReactElement} fragment
*/
function validateFragmentProps(fragment) {
{
var keys = Object.keys(fragment.props);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (key !== 'children' && key !== 'key') {
setCurrentlyValidatingElement$1(fragment);
error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
setCurrentlyValidatingElement$1(null);
break;
}
}
if (fragment.ref !== null) {
setCurrentlyValidatingElement$1(fragment);
error('Invalid attribute `ref` supplied to `React.Fragment`.');
setCurrentlyValidatingElement$1(null);
}
}
}
function createElementWithValidation(type, props, children) {
var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
if (!validType) {
var info = '';
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
}
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
if (sourceInfo) {
info += sourceInfo;
} else {
info += getDeclarationErrorAddendum();
}
var typeString;
if (type === null) {
typeString = 'null';
} else if (Array.isArray(type)) {
typeString = 'array';
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
info = ' Did you accidentally export a JSX literal instead of a component?';
} else {
typeString = typeof type;
}
{
error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
}
}
var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
// TODO: Drop this when these are no longer allowed as the type argument.
if (element == null) {
return element;
} // Skip key warning if the type isn't valid since our key validation logic
// doesn't expect a non-string/function type and can throw confusing errors.
// We don't want exception behavior to differ between dev and prod.
// (Rendering will throw with a helpful message and as soon as the type is
// fixed, the key warnings will appear.)
if (validType) {
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
}
if (type === exports.Fragment) {
validateFragmentProps(element);
} else {
validatePropTypes(element);
}
return element;
}
var didWarnAboutDeprecatedCreateFactory = false;
function createFactoryWithValidation(type) {
var validatedFactory = createElementWithValidation.bind(null, type);
validatedFactory.type = type;
{
if (!didWarnAboutDeprecatedCreateFactory) {
didWarnAboutDeprecatedCreateFactory = true;
warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
} // Legacy hook: remove it
Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
get: function () {
warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
Object.defineProperty(this, 'type', {
value: type
});
return type;
}
});
}
return validatedFactory;
}
function cloneElementWithValidation(element, props, children) {
var newElement = cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);
}
validatePropTypes(newElement);
return newElement;
}
{
try {
var frozenObject = Object.freeze({});
/* eslint-disable no-new */
new Map([[frozenObject, null]]);
new Set([frozenObject]);
/* eslint-enable no-new */
} catch (e) {}
}
var createElement$1 = createElementWithValidation;
var cloneElement$1 = cloneElementWithValidation;
var createFactory = createFactoryWithValidation;
var Children = {
map: mapChildren,
forEach: forEachChildren,
count: countChildren,
toArray: toArray,
only: onlyChild
};
exports.Children = Children;
exports.Component = Component;
exports.PureComponent = PureComponent;
exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
exports.cloneElement = cloneElement$1;
exports.createContext = createContext;
exports.createElement = createElement$1;
exports.createFactory = createFactory;
exports.createRef = createRef;
exports.forwardRef = forwardRef;
exports.isValidElement = isValidElement;
exports.lazy = lazy;
exports.memo = memo;
exports.useCallback = useCallback;
exports.useContext = useContext;
exports.useDebugValue = useDebugValue;
exports.useEffect = useEffect;
exports.useImperativeHandle = useImperativeHandle;
exports.useLayoutEffect = useLayoutEffect;
exports.useMemo = useMemo;
exports.useReducer = useReducer;
exports.useRef = useRef;
exports.useState = useState;
exports.version = ReactVersion;
})();
}
/***/ }),
/* 7 */
/***/ (function(module, exports) {
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
'use strict';
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/* 8 */
/***/ (function(module, exports) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @typechecks
*
*/
/*eslint-disable no-self-compare */
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
// Added the nonzero y check to make Flow happy, but it is redundant
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (is(objA, objB)) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
} // Test for A's keys different from B.
for (var i = 0; i < keysA.length; i++) {
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
/***/ }),
/* 9 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule FluxMixinLegacy
*
*/
'use strict';
function _createForOfIteratorHelper(o, allowArrayLike) {
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
if (!it) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
var F = function F() {};
return {
s: F,
n: function n() {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
},
e: function e(_e) {
throw _e;
},
f: F
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
var normalCompletion = true,
didErr = false,
err;
return {
s: function s() {
it = it.call(o);
},
n: function n() {
var step = it.next();
normalCompletion = step.done;
return step;
},
e: function e(_e2) {
didErr = true;
err = _e2;
},
f: function f() {
try {
if (!normalCompletion && it["return"] != null) it["return"]();
} finally {
if (didErr) throw err;
}
}
};
}
function _unsupportedIterableToArray(o, minLen) {
if (!o) return;
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
var n = Object.prototype.toString.call(o).slice(8, -1);
if (n === "Object" && o.constructor) n = o.constructor.name;
if (n === "Map" || n === "Set") return Array.from(o);
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
}
function _arrayLikeToArray(arr, len) {
if (len == null || len > arr.length) len = arr.length;
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
return arr2;
}
var FluxStoreGroup = __webpack_require__(3);
var invariant = __webpack_require__(4);
/**
* `FluxContainer` should be preferred over this mixin, but it requires using
* react with classes. So this mixin is provided where it is not yet possible
* to convert a container to be a class.
*
* This mixin should be used for React components that have state based purely
* on stores. `this.props` will not be available inside of `calculateState()`.
*
* This mixin will only `setState` not replace it, so you should always return
* every key in your state unless you know what you are doing. Consider this:
*
* var Foo = React.createClass({
* mixins: [
* FluxMixinLegacy([FooStore])
* ],
*
* statics: {
* calculateState(prevState) {
* if (!prevState) {
* return {
* foo: FooStore.getFoo(),
* };
* }
*
* return {
* bar: FooStore.getBar(),
* };
* }
* },
* });
*
* On the second calculateState when prevState is not null, the state will be
* updated to contain the previous foo AND the bar that was just returned. Only
* returning bar will not delete foo.
*
*/
function FluxMixinLegacy(stores) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
withProps: false
};
stores = stores.filter(function (store) {
return !!store;
});
return {
getInitialState: function getInitialState() {
enforceInterface(this);
return options.withProps ? this.constructor.calculateState(null, this.props) : this.constructor.calculateState(null, undefined);
},
componentWillMount: function componentWillMount() {
var _this = this;
// This tracks when any store has changed and we may need to update.
var changed = false;
var setChanged = function setChanged() {
changed = true;
};
// This adds subscriptions to stores. When a store changes all we do is
// set changed to true.
this._fluxMixinSubscriptions = stores.map(function (store) {
return store.addListener(setChanged);
});
// This callback is called after the dispatch of the relevant stores. If
// any have reported a change we update the state, then reset changed.
var callback = function callback() {
if (changed) {
_this.setState(function (prevState) {
return options.withProps ? _this.constructor.calculateState(prevState, _this.props) : _this.constructor.calculateState(prevState, undefined);
});
}
changed = false;
};
this._fluxMixinStoreGroup = new FluxStoreGroup(stores, callback);
},
componentWillUnmount: function componentWillUnmount() {
this._fluxMixinStoreGroup.release();
var _iterator = _createForOfIteratorHelper(this._fluxMixinSubscriptions),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var subscription = _step.value;
subscription.remove();
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
this._fluxMixinSubscriptions = [];
}
};
}
function enforceInterface(o) {
!o.constructor.calculateState ? true ? invariant(false, 'Components that use FluxMixinLegacy must implement ' + '`calculateState()` on the statics object') : invariant(false) : void 0;
}
module.exports = FluxMixinLegacy;
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule FluxReduceStore
*
*/
'use strict';
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var FluxStore = __webpack_require__(11);
var abstractMethod = __webpack_require__(18);
var invariant = __webpack_require__(4);
/**
* This is the basic building block of a Flux application. All of your stores
* should extend this class.
*
* class CounterStore extends FluxReduceStore<number> {
* getInitialState(): number {
* return 1;
* }
*
* reduce(state: number, action: Object): number {
* switch(action.type) {
* case: 'add':
* return state + action.value;
* case: 'double':
* return state * 2;
* default:
* return state;
* }
* }
* }
*/
var FluxReduceStore = /*#__PURE__*/function (_FluxStore) {
_inheritsLoose(FluxReduceStore, _FluxStore);
function FluxReduceStore(dispatcher) {
var _this;
_this = _FluxStore.call(this, dispatcher) || this;
_defineProperty(_assertThisInitialized(_this), "_state", void 0);
_this._state = _this.getInitialState();
return _this;
}
/**
* Getter that exposes the entire state of this store. If your state is not
* immutable you should override this and not expose _state directly.
*/
var _proto = FluxReduceStore.prototype;
_proto.getState = function getState() {
return this._state;
}
/**
* Constructs the initial state for this store. This is called once during
* construction of the store.
*/;
_proto.getInitialState = function getInitialState() {
return abstractMethod('FluxReduceStore', 'getInitialState');
}
/**
* Used to reduce a stream of actions coming from the dispatcher into a
* single state object.
*/;
_proto.reduce = function reduce(state, action) {
return abstractMethod('FluxReduceStore', 'reduce');
}
/**
* Checks if two versions of state are the same. You do not need to override
* this if your state is immutable.
*/;
_proto.areEqual = function areEqual(one, two) {
return one === two;
};
_proto.__invokeOnDispatch = function __invokeOnDispatch(action) {
this.__changed = false;
// Reduce the stream of incoming actions to state, update when necessary.
var startingState = this._state;
var endingState = this.reduce(startingState, action);
// This means your ending state should never be undefined.
!(endingState !== undefined) ? true ? invariant(false, '%s returned undefined from reduce(...), did you forget to return ' + 'state in the default case? (use null if this was intentional)', this.constructor.name) : invariant(false) : void 0;
if (!this.areEqual(startingState, endingState)) {
this._state = endingState;
// `__emitChange()` sets `this.__changed` to true and then the actual
// change will be fired from the emitter at the end of the dispatch, this
// is required in order to support methods like `hasChanged()`
this.__emitChange();
}
if (this.__changed) {
this.__emitter.emit(this.__changeEvent);
}
};
return FluxReduceStore;
}(FluxStore);
module.exports = FluxReduceStore;
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule FluxStore
*
*/
'use strict';
function _defineProperty(obj, key, value) {
key = _toPropertyKey(key);
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _toPropertyKey(arg) {
var key = _toPrimitive(arg, "string");
return typeof key === "symbol" ? key : String(key);
}
function _toPrimitive(input, hint) {
if (typeof input !== "object" || input === null) return input;
var prim = input[Symbol.toPrimitive];
if (prim !== undefined) {
var res = prim.call(input, hint || "default");
if (typeof res !== "object") return res;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (hint === "string" ? String : Number)(input);
}
var _require = __webpack_require__(12),
EventEmitter = _require.EventEmitter;
var invariant = __webpack_require__(4);
/**
* This class represents the most basic functionality for a FluxStore. Do not
* extend this store directly; instead extend FluxReduceStore when creating a
* new store.
*/
var FluxStore = /*#__PURE__*/function () {
// private
// protected, available to subclasses
function FluxStore(dispatcher) {
var _this = this;
_defineProperty(this, "_dispatchToken", void 0);
_defineProperty(this, "__changed", void 0);
_defineProperty(this, "__changeEvent", void 0);
_defineProperty(this, "__className", void 0);
_defineProperty(this, "__dispatcher", void 0);
_defineProperty(this, "__emitter", void 0);
this.__className = this.constructor.name;
this.__changed = false;
this.__changeEvent = 'change';
this.__dispatcher = dispatcher;
this.__emitter = new EventEmitter();
this._dispatchToken = dispatcher.register(function (payload) {
_this.__invokeOnDispatch(payload);
});
}
var _proto = FluxStore.prototype;
_proto.addListener = function addListener(callback) {
return this.__emitter.addListener(this.__changeEvent, callback);
};
_proto.getDispatcher = function getDispatcher() {
return this.__dispatcher;
}
/**
* This exposes a unique string to identify each store's registered callback.
* This is used with the dispatcher's waitFor method to declaratively depend
* on other stores updating themselves first.
*/;
_proto.getDispatchToken = function getDispatchToken() {
return this._dispatchToken;
}
/**
* Returns whether the store has changed during the most recent dispatch.
*/;
_proto.hasChanged = function hasChanged() {
!this.__dispatcher.isDispatching() ? true ? invariant(false, '%s.hasChanged(): Must be invoked while dispatching.', this.__className) : invariant(false) : void 0;
return this.__changed;
};
_proto.__emitChange = function __emitChange() {
!this.__dispatcher.isDispatching() ? true ? invariant(false, '%s.__emitChange(): Must be invoked while dispatching.', this.__className) : invariant(false) : void 0;
this.__changed = true;
}
/**
* This method encapsulates all logic for invoking __onDispatch. It should
* be used for things like catching changes and emitting them after the
* subclass has handled a payload.
*/;
_proto.__invokeOnDispatch = function __invokeOnDispatch(payload) {
this.__changed = false;
this.__onDispatch(payload);
if (this.__changed) {
this.__emitter.emit(this.__changeEvent);
}
}
/**
* The callback that will be registered with the dispatcher during
* instantiation. Subclasses must override this method. This callback is the
* only way the store receives new data.
*/;
_proto.__onDispatch = function __onDispatch(payload) {
true ? true ? invariant(false, '%s has not overridden FluxStore.__onDispatch(), which is required', this.__className) : invariant(false) : void 0;
};
return FluxStore;
}();
module.exports = FluxStore;
/***/ }),
/* 12 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
var fbemitter = {
EventEmitter: __webpack_require__(13),
EmitterSubscription: __webpack_require__(14)
};
module.exports = fbemitter;
/***/ }),
/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule BaseEventEmitter
* @typechecks
*/
var EmitterSubscription = __webpack_require__(14);
var EventSubscriptionVendor = __webpack_require__(16);
var invariant = __webpack_require__(4);
var emptyFunction = __webpack_require__(17);
/**
* @class BaseEventEmitter
* @description
* An EventEmitter is responsible for managing a set of listeners and publishing
* events to them when it is told that such events happened. In addition to the
* data for the given event it also sends a event control object which allows
* the listeners/handlers to prevent the default behavior of the given event.
*
* The emitter is designed to be generic enough to support all the different
* contexts in which one might want to emit events. It is a simple multicast
* mechanism on top of which extra functionality can be composed. For example, a
* more advanced emitter may use an EventHolder and EventFactory.
*/
var BaseEventEmitter = /*#__PURE__*/function () {
/**
* @constructor
*/
function BaseEventEmitter() {
this._subscriber = new EventSubscriptionVendor();
this._currentSubscription = null;
}
/**
* Adds a listener to be invoked when events of the specified type are
* emitted. An optional calling context may be provided. The data arguments
* emitted will be passed to the listener function.
*
* TODO: Annotate the listener arg's type. This is tricky because listeners
* can be invoked with varargs.
*
* @param {string} eventType - Name of the event to listen to
* @param {function} listener - Function to invoke when the specified event is
* emitted
* @param {*} context - Optional context object to use when invoking the
* listener
*/
var _proto = BaseEventEmitter.prototype;
_proto.addListener = function addListener(eventType, listener, context) {
return this._subscriber.addSubscription(eventType, new EmitterSubscription(this._subscriber, listener, context));
}
/**
* Similar to addListener, except that the listener is removed after it is
* invoked once.
*
* @param {string} eventType - Name of the event to listen to
* @param {function} listener - Function to invoke only once when the
* specified event is emitted
* @param {*} context - Optional context object to use when invoking the
* listener
*/;
_proto.once = function once(eventType, listener, context) {
var emitter = this;
return this.addListener(eventType, function () {
emitter.removeCurrentListener();
listener.apply(context, arguments);
});
}
/**
* Removes all of the registered listeners, including those registered as
* listener maps.
*
* @param {?string} eventType - Optional name of the event whose registered
* listeners to remove
*/;
_proto.removeAllListeners = function removeAllListeners(eventType) {
this._subscriber.removeAllSubscriptions(eventType);
}
/**
* Provides an API that can be called during an eventing cycle to remove the
* last listener that was invoked. This allows a developer to provide an event
* object that can remove the listener (or listener map) during the
* invocation.
*
* If it is called when not inside of an emitting cycle it will throw.
*
* @throws {Error} When called not during an eventing cycle
*
* @example
* var subscription = emitter.addListenerMap({
* someEvent: function(data, event) {
* console.log(data);
* emitter.removeCurrentListener();
* }
* });
*
* emitter.emit('someEvent', 'abc'); // logs 'abc'
* emitter.emit('someEvent', 'def'); // does not log anything
*/;
_proto.removeCurrentListener = function removeCurrentListener() {
!!!this._currentSubscription ? true ? invariant(false, 'Not in an emitting cycle; there is no current subscription') : invariant(false) : void 0;
this._subscriber.removeSubscription(this._currentSubscription);
}
/**
* Returns an array of listeners that are currently registered for the given
* event.
*
* @param {string} eventType - Name of the event to query
* @return {array}
*/;
_proto.listeners = function listeners(eventType) /* TODO: Array<EventSubscription> */
{
var subscriptions = this._subscriber.getSubscriptionsForType(eventType);
return subscriptions ? subscriptions.filter(emptyFunction.thatReturnsTrue).map(function (subscription) {
return subscription.listener;
}) : [];
}
/**
* Emits an event of the given type with the given data. All handlers of that
* particular type will be notified.
*
* @param {string} eventType - Name of the event to emit
* @param {*} Arbitrary arguments to be passed to each registered listener
*
* @example
* emitter.addListener('someEvent', function(message) {
* console.log(message);
* });
*
* emitter.emit('someEvent', 'abc'); // logs 'abc'
*/;
_proto.emit = function emit(eventType) {
var subscriptions = this._subscriber.getSubscriptionsForType(eventType);
if (subscriptions) {
var keys = Object.keys(subscriptions);
for (var ii = 0; ii < keys.length; ii++) {
var key = keys[ii];
var subscription = subscriptions[key]; // The subscription may have been removed during this event loop.
if (subscription) {
this._currentSubscription = subscription;
this.__emitToSubscription.apply(this, [subscription].concat(Array.prototype.slice.call(arguments)));
}
}
this._currentSubscription = null;
}
}
/**
* Provides a hook to override how the emitter emits an event to a specific
* subscription. This allows you to set up logging and error boundaries
* specific to your environment.
*
* @param {EmitterSubscription} subscription
* @param {string} eventType
* @param {*} Arbitrary arguments to be passed to each registered listener
*/;
_proto.__emitToSubscription = function __emitToSubscription(subscription, eventType) {
var args = Array.prototype.slice.call(arguments, 2);
subscription.listener.apply(subscription.context, args);
};
return BaseEventEmitter;
}();
module.exports = BaseEventEmitter;
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EmitterSubscription
* @typechecks
*/
'use strict';
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
var EventSubscription = __webpack_require__(15);
/**
* EmitterSubscription represents a subscription with listener and context data.
*/
var EmitterSubscription = /*#__PURE__*/function (_EventSubscription) {
_inheritsLoose(EmitterSubscription, _EventSubscription);
/**
* @param {EventSubscriptionVendor} subscriber - The subscriber that controls
* this subscription
* @param {function} listener - Function to invoke when the specified event is
* emitted
* @param {*} context - Optional context object to use when invoking the
* listener
*/
function EmitterSubscription(subscriber, listener, context) {
var _this;
_this = _EventSubscription.call(this, subscriber) || this;
_this.listener = listener;
_this.context = context;
return _this;
}
return EmitterSubscription;
}(EventSubscription);
module.exports = EmitterSubscription;
/***/ }),
/* 15 */
/***/ (function(module, exports) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventSubscription
* @typechecks
*/
'use strict';
/**
* EventSubscription represents a subscription to a particular event. It can
* remove its own subscription.
*/
var EventSubscription = /*#__PURE__*/function () {
/**
* @param {EventSubscriptionVendor} subscriber the subscriber that controls
* this subscription.
*/
function EventSubscription(subscriber) {
this.subscriber = subscriber;
}
/**
* Removes this subscription from the subscriber that controls it.
*/
var _proto = EventSubscription.prototype;
_proto.remove = function remove() {
if (this.subscriber) {
this.subscriber.removeSubscription(this);
this.subscriber = null;
}
};
return EventSubscription;
}();
module.exports = EventSubscription;
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2014-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventSubscriptionVendor
* @typechecks
*/
'use strict';
var invariant = __webpack_require__(4);
/**
* EventSubscriptionVendor stores a set of EventSubscriptions that are
* subscribed to a particular event type.
*/
var EventSubscriptionVendor = /*#__PURE__*/function () {
function EventSubscriptionVendor() {
this._subscriptionsForType = {};
this._currentSubscription = null;
}
/**
* Adds a subscription keyed by an event type.
*
* @param {string} eventType
* @param {EventSubscription} subscription
*/
var _proto = EventSubscriptionVendor.prototype;
_proto.addSubscription = function addSubscription(eventType, subscription) {
!(subscription.subscriber === this) ? true ? invariant(false, 'The subscriber of the subscription is incorrectly set.') : invariant(false) : void 0;
if (!this._subscriptionsForType[eventType]) {
this._subscriptionsForType[eventType] = [];
}
var key = this._subscriptionsForType[eventType].length;
this._subscriptionsForType[eventType].push(subscription);
subscription.eventType = eventType;
subscription.key = key;
return subscription;
}
/**
* Removes a bulk set of the subscriptions.
*
* @param {?string} eventType - Optional name of the event type whose
* registered supscriptions to remove, if null remove all subscriptions.
*/;
_proto.removeAllSubscriptions = function removeAllSubscriptions(eventType) {
if (eventType === undefined) {
this._subscriptionsForType = {};
} else {
delete this._subscriptionsForType[eventType];
}
}
/**
* Removes a specific subscription. Instead of calling this function, call
* `subscription.remove()` directly.
*
* @param {object} subscription
*/;
_proto.removeSubscription = function removeSubscription(subscription) {
var eventType = subscription.eventType;
var key = subscription.key;
var subscriptionsForType = this._subscriptionsForType[eventType];
if (subscriptionsForType) {
delete subscriptionsForType[key];
}
}
/**
* Returns the array of subscriptions that are currently registered for the
* given event type.
*
* Note: This array can be potentially sparse as subscriptions are deleted
* from it when they are removed.
*
* TODO: This returns a nullable array. wat?
*
* @param {string} eventType
* @return {?array}
*/;
_proto.getSubscriptionsForType = function getSubscriptionsForType(eventType) {
return this._subscriptionsForType[eventType];
};
return EventSubscriptionVendor;
}();
module.exports = EventSubscriptionVendor;
/***/ }),
/* 17 */
/***/ (function(module, exports) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*
*/
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
var emptyFunction = function emptyFunction() {};
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule abstractMethod
*
*/
'use strict';
var invariant = __webpack_require__(4);
function abstractMethod(className, methodName) {
true ? true ? invariant(false, 'Subclasses of %s must override %s() with their own implementation.', className, methodName) : invariant(false) : void 0;
}
module.exports = abstractMethod;
/***/ })
/******/ ])
});
;
================================================
FILE: docs/Dispatcher.ko-KR.md
================================================
---
id: dispatcher-ko-KR
title: Dispatcher
---
Dispatcher는 등록된 callback에 데이터를 중계할 때 사용된다. 일반적인 pub-sub 시스템과는 다음 두 항목이 다르다:
- 콜백은 이벤트를 개별적으로 구독하지 않는다. 모든 데이터 변동은 등록된 모든 콜백에 전달된다.
- 콜백이 실행될 때 콜백의 전체나 일부를 중단할 수 있다.
소스 코드를 보려면 [Dispatcher.js](https://github.com/facebookarchive/flux/blob/master/src/Dispatcher.js)에서 확인할 수 있다.
## API
- **`register(function callback): string`** 모든 데이터 변동이 있을 때 실행될 콜백을 등록한다. `waitFor()`에서 사용 가능한 토큰을 반환한다.
- **`unregister(string id): void`** 토큰으로 콜백을 제거한다.
- **`waitFor(array<string> ids): void`** 현재 실행한 콜백이 진행되기 전에 특정 콜백을 지연하게 한다. 데이터 변동에 응답하는 콜백에만 사용해야 한다.
- **`dispatch(object payload): void`** 등록된 모든 콜백에 데이터를 전달한다.
- **`isDispatching(): boolean`** 이 Dispatcher가 지금 데이터를 전달하고 있는지 확인한다.
## 예시
가상의 비행 목적지 양식에서 국가를 선택했을 때 기본 도시를 선택하는 예를 보자:
```js
var flightDispatcher = new Dispatcher();
// 어떤 국가를 선택했는지 계속 추적한다
var CountryStore = {country: null};
// 어느 도시를 선택했는지 계속 추적한다
var CityStore = {city: null};
// 선택된 도시의 기본 항공료를 계속 추적한다
var FlightPriceStore = {price: null};
```
사용자가 선택한 도시를 변경하면 데이터를 전달한다:
```js
flightDispatcher.dispatch({
actionType: 'city-update',
selectedCity: 'paris',
});
```
이 데이터 변동은 `CityStore`가 소화한다:
```js
flightDispatcher.register(function (payload) {
if (payload.actionType === 'city-update') {
CityStore.city = payload.selectedCity;
}
});
```
사용자가 국가를 선택하면 데이터를 전달한다:
```js
flightDispatcher.dispatch({
actionType: 'country-update',
selectedCountry: 'australia',
});
```
이 데이터는 두 store에 의해 소화된다:
```js
CountryStore.dispatchToken = flightDispatcher.register(function (payload) {
if (payload.actionType === 'country-update') {
CountryStore.country = payload.selectedCountry;
}
});
```
`CountryStore`가 등록한 콜백을 업데이트 할 때 반환되는 토큰을 참조값으로 저장했다. 이 토큰은 `waitFor()` 에서 사용할 수 있고 `CityStore`가 갱신하는 것보다 먼저 `CountryStore`를 갱신하도록 보장할 수 있다.
```js
CityStore.dispatchToken = flightDispatcher.register(function (payload) {
if (payload.actionType === 'country-update') {
// `CountryStore.country`는 업데이트 되지 않는다
flightDispatcher.waitFor([CountryStore.dispatchToken]);
// `CountryStore.country`는 업데이트가 될 수 있음이 보장되었다
// 새로운 국가의 기본 도시를 선택한다
CityStore.city = getDefaultCityForCountry(CountryStore.country);
}
});
```
`waitFor()`는 다음과 같이 묶을 수 있다:
```js
FlightPriceStore.dispatchToken = flightDispatcher.register(function (payload) {
switch (payload.actionType) {
case 'country-update':
case 'city-update':
flightDispatcher.waitFor([CityStore.dispatchToken]);
FlightPriceStore.price = getFlightPriceStore(
CountryStore.country,
CityStore.city,
);
break;
}
});
```
`country-update`는 콜백이 등록된 순서 즉 `CountryStore`, `CityStore`, `FlightPriceStore` 순서로 실행되도록 보장된다.
================================================
FILE: docs/Dispatcher.md
================================================
---
id: dispatcher
title: Dispatcher
---
Dispatcher is used to broadcast payloads to registered callbacks. This is different from generic pub-sub systems in two ways:
- Callbacks are not subscribed to particular events. Every payload is dispatched to every registered callback.
- Callbacks can be deferred in whole or part until other callbacks have been executed.
Check out [Dispatcher.js](https://github.com/facebookarchive/flux/blob/master/src/Dispatcher.js) for the source code.
## API
- **`register(function callback): string`** Registers a callback to be invoked with every dispatched payload. Returns a token that can be used with `waitFor()`.
- **`unregister(string id): void`** Removes a callback based on its token.
- **`waitFor(array<string> ids): void`** Waits for the callbacks specified to be invoked before continuing execution of the current callback. This method should only be used by a callback in response to a dispatched payload.
- **`dispatch(object payload): void`** Dispatches a payload to all registered callbacks.
- **`isDispatching(): boolean`** Is this Dispatcher currently dispatching.
## Example
For example, consider this hypothetical flight destination form, which selects a default city when a country is selected:
```js
var flightDispatcher = new Dispatcher();
// Keeps track of which country is selected
var CountryStore = {country: null};
// Keeps track of which city is selected
var CityStore = {city: null};
// Keeps track of the base flight price of the selected city
var FlightPriceStore = {price: null};
```
When a user changes the selected city, we dispatch the payload:
```js
flightDispatcher.dispatch({
actionType: 'city-update',
selectedCity: 'paris',
});
```
This payload is digested by `CityStore`:
```js
flightDispatcher.register(function (payload) {
if (payload.actionType === 'city-update') {
CityStore.city = payload.selectedCity;
}
});
```
When the user selects a country, we dispatch the payload:
```js
flightDispatcher.dispatch({
actionType: 'country-update',
selectedCountry: 'australia',
});
```
This payload is digested by both stores:
```js
CountryStore.dispatchToken = flightDispatcher.register(function (payload) {
if (payload.actionType === 'country-update') {
CountryStore.country = payload.selectedCountry;
}
});
```
When the callback to update `CountryStore` is registered, we save a reference to the returned token. Using this token with `waitFor()`, we can guarantee that `CountryStore` is updated before the callback that updates `CityStore` needs to query its data.
```js
CityStore.dispatchToken = flightDispatcher.register(function (payload) {
if (payload.actionType === 'country-update') {
// `CountryStore.country` may not be updated.
flightDispatcher.waitFor([CountryStore.dispatchToken]);
// `CountryStore.country` is now guaranteed to be updated.
// Select the default city for the new country
CityStore.city = getDefaultCityForCountry(CountryStore.country);
}
});
```
The usage of `waitFor()` can be chained, for example:
```js
FlightPriceStore.dispatchToken = flightDispatcher.register(function (payload) {
switch (payload.actionType) {
case 'country-update':
case 'city-update':
flightDispatcher.waitFor([CityStore.dispatchToken]);
FlightPriceStore.price = getFlightPriceStore(
CountryStore.country,
CityStore.city,
);
break;
}
});
```
The `country-update` payload will be guaranteed to invoke the stores' registered callbacks in order: `CountryStore`, `CityStore`, then `FlightPriceStore`.
================================================
FILE: docs/Flux-Utils.md
================================================
---
id: flux-utils
title: Flux Utils
---
Flux Utils is a set of basic utility classes to help get you started with Flux. These base classes are a solid foundation for a simple Flux application, but they are **not** a feature-complete framework that will handle all use cases. There are many other great Flux frameworks out there if these utilities do not fulfill your needs.
## Usage
There are three main classes exposed in Flux Utils:
1. `Store`
1. `ReduceStore`
1. `Container`
These base classes can be imported from `flux/utils` like this:
```js
import {ReduceStore} from 'flux/utils';
class CounterStore extends ReduceStore<number> {
getInitialState(): number {
return 0;
}
reduce(state: number, action: Object): number {
switch (action.type) {
case 'increment':
return state + 1;
case 'square':
return state * state;
default:
return state;
}
}
}
```
## Best practices
There are some best practices we try to follow when using these classes:
### Stores
- Cache data
- Expose public getters to access data (never have public setters)
- Respond to specific actions from the dispatcher
- Always emit a change when their data changes
- Only emit changes during a dispatch
### Actions
Describe a user's action, are not setters. (e.g. `select-page` not `set-page-id`)
### Containers
- Are React components that control a view
- Primary job is to gather information from stores and save it in their state
- Have no `props` and no UI logic
### Views
- Are React components that are controlled by a container
- Have all of the UI and rendering logic
- Receive all information and callbacks as props
## API
### `Store`
#### `constructor(dispatcher: Dispatcher)`
Constructs and registers an instance of this store with the given dispatcher.
#### `addListener(callback: Function): {remove: Function}`
Adds a listener to the store, when the store changes the given callback will be called. A token is returned that can be used to remove the listener. Calling the `remove()` function on the returned token will remove the listener.
#### `getDispatcher(): Dispatcher`
Returns the dispatcher this store is registered with.
#### `getDispatchToken(): DispatchToken`
Returns the dispatch token that the dispatcher recognizes this store by. Can be used to `waitFor()` this store.
#### `hasChanged(): boolean`
Ask if a store has changed during the current dispatch. Can only be invoked while dispatching. This can be used for constructing derived stores that depend on data from other stores.
#### `__emitChange(): void`
Emit an event notifying all listeners that this store has changed. This can only be invoked when dispatching. Changes are de-duplicated and resolved at the end of this store's `__onDispatch` function.
#### `onDispatch(payload: Object): void`
Subclasses must override this method. This is how the store receives actions from the dispatcher. All state mutation logic must be done during this method.
---
### `ReduceStore<T>`
This class extends the base `Store`.
#### `getState(): T`
Getter that exposes the entire state of this store. If your state is not immutable you should override this and not expose state directly.
#### `getInitialState(): T`
Constructs the initial state for this store. This is called once during construction of the store.
#### `reduce(state: T, action: Object): T`
Reduces the current state, and an action to the new state of this store. All subclasses must implement this method. This method should be pure and have no side-effects.
#### `areEqual(one: T, two: T): boolean`
Checks if two versions of state are the same. You do not need to override this if your state is immutable.
#### Doesn't Need to Emit a Change
Note that any store that extends `ReduceStore` does not need to manually emit changes in `reduce()` (you still can if you want to though). The state is compared before and after each dispatch and changes are emitted automatically. If you need to control this behavior (perhaps because your state is mutable) override `areEqual()`.
---
### `Container`
#### `create(base: ReactClass, options: ?Object): ReactClass`
Create is used to transform a react class into a container that updates its state when relevant stores change. The provided base class must have static methods `getStores()` and `calculateState()`.
```js
import {Component} from 'react';
import {Container} from 'flux/utils';
class CounterContainer extends Component {
static getStores() {
return [CounterStore];
}
static calculateState(prevState) {
return {
counter: CounterStore.getState(),
};
}
render() {
return <CounterUI counter={this.state.counter} />;
}
}
const container = Container.create(CounterContainer);
```
Additional options may be provided when creating your container in order to control certain behaviors.
- **Containers are pure** - By default containers are pure, meaning they will not re-render when their props and state do not change (as determined by `shallowEquals()`). To disable this behavior pass options `{pure: false}` as the second argument to `create()`.
- **Containers cannot access props** - By default containers are not able to access any props. This is both for performance reasons, and to ensure that containers are re-usable and props do not have to be threaded throughout a component tree. There are some valid situations in which you need to determine your state based on both props and a store's state. In those situations pass options `{withProps: true}` as the second argument to `create()`. This will expose the components props as the second argument to `calculateState()`.
If you are unable to utilize react classes most of this functionality is also mirrored in a mixin. `import {Mixin} from 'flux/utils';`
## Using Flux with React Hooks
React 16.8 introduced [Hooks](https://reactjs.org/docs/hooks-intro.html). Much of the functionality of Flux and Flux Utils can be reproduced using [useContext](https://reactjs.org/docs/hooks-reference.html#usecontext) & [useReducer](https://reactjs.org/docs/hooks-reference.html#usereducer).
## Existing Projects with `Store`/`ReduceStore`
If you have existing projects that need to continue using Flux Util's Stores, you can use the [flux-hooks](https://github.com/Fieldscope/flux-hooks) package. Access the store using useFluxStore which provides an API similar to [Container](#container)'s calculateState.
================================================
FILE: docs/In-Depth-Overview.md
================================================
---
id: in-depth-overview
title: In-Depth Overview
---
Flux is the application architecture that Facebook uses for building client-side web applications. It complements React's composable view components by utilizing a unidirectional data flow. It's more of a pattern rather than a formal framework, and you can start using Flux immediately without a lot of new code.
<figure class="video-container">
<iframe src="//www.youtube.com/embed/nYkdrAPrdcw?list=PLb0IAmt7-GS188xDYE-u1ShQmFFGbrk0v&start=621" frameborder="0" allowfullscreen width="100%"></iframe>
</figure>
Flux applications have three major parts: the dispatcher, the stores, and the views (React components). These should not be confused with Model-View-Controller. Controllers do exist in a Flux application, but they are controller-views — views often found at the top of the hierarchy that retrieve data from the stores and pass this data down to their children. Additionally, action creators — dispatcher helper methods — are used to support a semantic API that describes all changes that are possible in the application. It can be useful to think of them as a fourth part of the Flux update cycle.
Flux eschews MVC in favor of a unidirectional data flow. When a user interacts with a React view, the view propagates an action through a central dispatcher, to the various stores that hold the application's data and business logic, which updates all of the views that are affected. This works especially well with React's declarative programming style, which allows the store to send updates without specifying how to transition views between states.
We originally set out to deal correctly with derived data: for example, we wanted to show an unread count for message threads while another view showed a list of threads, with the unread ones highlighted. This was difficult to handle with MVC — marking a single thread as read would update the thread model, and then also need to update the unread count model. These dependencies and cascading updates often occur in a large MVC application, leading to a tangled weave of data flow and unpredictable results.
Control is inverted with stores: the stores accept updates and reconcile them as appropriate, rather than depending on something external to update its data in a consistent way. Nothing outside the store has any insight into how it manages the data for its domain, helping to keep a clear separation of concerns. Stores have no direct setter methods like `setAsRead()`, but instead have only a single way of getting new data into their self-contained world — the callback they register with the dispatcher.
## Structure and Data Flow
Data in a Flux application flows in a single direction:
<figure>
<img src="/flux/img/overview/flux-simple-f8-diagram-1300w.png" alt="Unidirectional data flow in Flux" />
</figure>
A unidirectional data flow is central to the Flux pattern, and the above diagram should be **the primary mental model for the Flux programmer**. The dispatcher, stores and views are independent nodes with distinct inputs and outputs. The actions are simple objects containing the new data and an identifying _type_ property.
The views may cause a new action to be propagated through the system in response to user interactions:
<figure class="diagram">
<img src="/flux/img/overview/flux-simple-f8-diagram-with-client-action-1300w.png" alt="data flow in Flux with data originating from user interactions" />
</figure>
All data flows through the dispatcher as a central hub. Actions are provided to the dispatcher in an _action creator_ method, and most often originate from user interactions with the views. The dispatcher then invokes the callbacks that the stores have registered with it, dispatching actions to all stores. Within their registered callbacks, stores respond to whichever actions are relevant to the state they maintain. The stores then emit a _change_ event to alert the controller-views that a change to the data layer has occurred. Controller-views listen for these events and retrieve data from the stores in an event handler. The controller-views call their own `setState()` method, causing a re-rendering of themselves and all of their descendants in the component tree.
<figure class="diagram">
<img src="/flux/img/overview/flux-simple-f8-diagram-explained-1300w.png" alt="varying transports between each step of the Flux data flow" />
</figure>
This structure allows us to reason easily about our application in a way that is reminiscent of _functional reactive programming_, or more specifically _data-flow programming_ or _flow-based programming_, where data flows through the application in a single direction — there are no two-way bindings. Application state is maintained only in the stores, allowing the different parts of the application to remain highly decoupled. Where dependencies do occur between stores, they are kept in a strict hierarchy, with synchronous updates managed by the dispatcher.
We found that two-way data bindings led to cascading updates, where changing one object led to another object changing, which could also trigger more updates. As applications grew, these cascading updates made it very difficult to predict what would change as the result of one user interaction. When updates can only change data within a single round, the system as a whole becomes more predictable.
Let's look at the various parts of Flux up close. A good place to start is the dispatcher.
### A Single Dispatcher
The dispatcher is the central hub that manages all data flow in a Flux application. It is essentially a registry of callbacks into the stores and has no real intelligence of its own — it is a simple mechanism for distributing the actions to the stores. Each store registers itself and provides a callback. When an action creator provides the dispatcher with a new action, all stores in the application receive the action via the callbacks in the registry.
As an application grows, the dispatcher becomes more vital, as it can be used to manage dependencies between the stores by invoking the registered callbacks in a specific order. Stores can declaratively wait for other stores to finish updating, and then update themselves accordingly.
The same dispatcher that Facebook uses in production is available through [npm](https://www.npmjs.com/package/flux), [Bower](http://bower.io/), or [GitHub](https://github.com/facebookarchive/flux).
### Stores
Stores contain the application state and logic. Their role is somewhat similar to a model in a traditional MVC, but they manage the state of many objects — they do not represent a single record of data like ORM models do. Nor are they the same as Backbone's collections. More than simply managing a collection of ORM-style objects, stores manage the application state for a particular **domain** within the application.
For example, Facebook's [Lookback Video Editor](https://facebook.com/lookback/edit) utilized a TimeStore that kept track of the playback time position and the playback state. On the other hand, the same application's ImageStore kept track of a collection of images. The TodoStore in our [TodoMVC example](https://github.com/facebookarchive/flux/tree/master/examples/flux-todomvc/) is similar in that it manages a collection of to-do items. A store exhibits characteristics of both a collection of models and a singleton model of a logical domain.
As mentioned above, a store registers itself with the dispatcher and provides it with a callback. This callback receives the action as a parameter. Within the store's registered callback, a switch statement based on the action's type is used to interpret the action and to provide the proper hooks into the store's internal methods. This allows an action to result in an update to the state of the store, via the dispatcher. After the stores are updated, they broadcast an event declaring that their state has changed, so the views may query the new state and update themselves.
### Views and Controller-Views
React provides the kind of composable and freely re-renderable views we need for the view layer. Close to the top of the nested view hierarchy, a special kind of view listens for events that are broadcast by the stores that it depends on. We call this a controller-view, as it provides the glue code to get the data from the stores and to pass this data down the chain of its descendants. We might have one of these controller-views governing any significant section of the page.
When it receives the event from the store, it first requests the new data it needs via the stores' public getter methods. It then calls its own `setState()` or `forceUpdate()` methods, causing its `render()` method and the `render()` method of all its descendants to run.
We often pass the entire state of the store down the chain of views in a single object, allowing different descendants to use what they need. In addition to keeping the controller-like behavior at the top of the hierarchy, and thus keeping our descendant views as functionally pure as possible, passing down the entire state of the store in a single object also has the effect of reducing the number of props we need to manage.
Occasionally we may need to add additional controller-views deeper in the hierarchy to keep components simple. This might help us to better encapsulate a section of the hierarchy related to a specific data domain. Be aware, however, that controller-views deeper in the hierarchy can violate the singular flow of data by introducing a new, potentially conflicting entry point for the data flow. In making the decision of whether to add a deep controller-view, balance the gain of simpler components against the complexity of multiple data updates flowing into the hierarchy at different points. These multiple data updates can lead to odd effects, with React's render method getting invoked repeatedly by updates from different controller-views, potentially increasing the difficulty of debugging.
### Actions
The dispatcher exposes a method that allows us to trigger a dispatch to the stores, and to include a payload of data, which we call an action. The action's creation may be wrapped into a semantic helper method which sends the action to the dispatcher. For example, we may want to change the text of a to-do item in a to-do list application. We would create an action with a function signature like `updateText(todoId, newText)` in our `TodoActions` module. This method may be invoked from within our views' event handlers, so we can call it in response to a user interaction. This action creator method also adds a _type_ to the action, so that when the action is interpreted in the store, it can respond appropriately. In our example, this type might be named something like `TODO_UPDATE_TEXT`.
Actions may also come from other places, such as the server. This happens, for example, during data initialization. It may also happen when the server returns an error code or when the server has updates to provide to the application.
### What About that Dispatcher?
As mentioned earlier, the dispatcher is also able to manage dependencies between stores. This functionality is available through the `waitFor()` method within the Dispatcher class. We did not need to use this method within the extremely simple [TodoMVC application](https://github.com/facebookarchive/flux/tree/master/examples/flux-todomvc/), but it becomes vital in a larger, more complex application.
Within the TodoStore's registered callback we could explicitly wait for any dependencies to first update before moving forward:
```javascript
case 'TODO_CREATE':
Dispatcher.waitFor([
PrependedTextStore.dispatchToken,
YetAnotherStore.dispatchToken
]);
TodoStore.create(PrependedTextStore.getText() + ' ' + action.text);
break;
```
`waitFor()` accepts a single argument which is an array of dispatcher registry indexes, often called _dispatch tokens_. Thus the store that is invoking `waitFor()` can depend on the state of another store to inform how it should update its own state.
A dispatch token is returned by `register()` when registering callbacks for the Dispatcher:
```javascript
PrependedTextStore.dispatchToken = Dispatcher.register(function (payload) {
// ...
});
```
For more on `waitFor()`, actions, action creators and the dispatcher, please see [Flux: Actions and the Dispatcher](https://legacy.reactjs.org/blog/2014/07/30/flux-actions-and-the-dispatcher.html).
================================================
FILE: docs/Overview.ko-KR.md
================================================
---
id: overview-ko-KR
title: 개요
layout: docs
category: Quick Start
next: dispatcher-ko-KR
lang: ko-KR
---
Flux는 Facebook에서 클라이언트-사이드 웹 애플리케이션을 만드는 데 사용하는 애플리케이션 아키텍처다. 단방향 데이터 흐름을 활용해 뷰 컴포넌트를 구성하는 React를 보완하는 역할을 한다. 이전까지의 프레임워크와는 달리 패턴과 같은 모습을 하고 있으므로 수많은 새로운 코드를 작성할 필요 없이 바로 Flux를 이용해 사용할 수 있다.
<figure class="video-container disassociated-with-next-sibling">
<iframe src="//www.youtube.com/embed/nYkdrAPrdcw?list=PLb0IAmt7-GS188xDYE-u1ShQmFFGbrk0v&start=621" frameborder="0" allowfullscreen></iframe>
</figure>
Flux 애플리케이션은 다음 핵심적인 세 가지 부분으로 구성되어 있다: Dispatcher, Stores, Views(React 컴포넌트). Model-View-Controller와 혼동해서는 안 된다. Controller도 물론 Flux 애플리케이션에 존재하지만, 위계의 최상위에서 controller-views - views 관계로 존재하고 있다. 이 controller-views는 stores에서 데이터를 가져와 그 데이터를 자식에게 보내는 역할을 한다. 덧붙여 dispatcher를 돕는 action creator 메소드는 이 애플리케이션에서 가능한 모든 변화를 표현하는 유의적 API를 지원하는 데 사용된다. Flux 업데이트 주기의 4번째 부분이라고 생각하면 유용하다.
Flux는 MVC와 다르게 단방향으로 데이터가 흐른다. React view에서 사용자가 상호작용을 할 때, 그 view는 중앙의 dispatcher를 통해 action을 전파하게 된다. 애플리케이션의 데이터와 비즈니스 로직을 가지고 있는 store는 action이 전파되면 이 action에 영향이 있는 모든 view를 갱신한다. 이 방식은 특히 React의 선언형 프로그래밍 스타일 즉, view가 어떤 방식으로 갱신해야 하는지 일일이 작성하지 않고서도 데이터를 변경할 수 있는 형태에서 편리하다.
이 프로젝트는 파생되는 데이터를 올바르게 다루기 위해 시작되었다. 예를 들면 현재 뷰에서 읽지 않은 메시지가 강조되어 있으면서도 읽지 않은 메시지 수를 상단 바에 표시하고 싶었다. 이런 부분은 MVC에서 다루기 어려운데, 메시지를 읽기 위한 단일 스레드에서 메시지 스레드 모델을 갱신해야 하고 동시에 읽지 않은 메시지 수 모델을 갱신 해야 하기 때문이다. 대형 MVC 애플리케이션에서 종종 나타나는 데이터 간의 의존성과 연쇄적인 갱신은 뒤얽힌 데이터 흐름을 만들고 예측할 수 없는 결과로 이끌게 된다.
Flux는 store를 이용해 제어를 뒤집었다. 일관성을 유지한다는 명목으로 외부의 갱신에 의존하는 방식과 달리 Store는 갱신을 받아들이고 적절하게 조화한다. Store 바깥에 아무것도 두지 않는 방식으로 데이터의 도메인을 관리해야 할 필요가 없어져 외부의 갱신에 따른 문제를 명확하게 분리할 수 있도록 돕는다. Store는 독립적인 세계를 가지고 있어 `setAsRead()`와 같은 직접적인 setter 메소드가 없는 대신 dispatcher에 등록한 콜백을 통해 데이터를 받게 된다.
## 구조와 데이터 흐름
<p class="associated-with-next-sibling">
Flux 애플리케이션에서의 데이터는 단방향으로 흐른다:
</p>
<figure class="diagram associated-with-next-sibling">
<img src="/flux/img/flux-simple-f8-diagram-1300w.png" alt="Flux에서의 단방향 데이터 흐름" />
</figure>
단방향 데이터 흐름은 Flux 패턴의 핵심인데 위 다이어그램은 **Flux 프로그래머를 위한 제일의 멘탈 모델**이 된다. dispatcher, store와 view는 독립적인 노드로 입력과 출력이 완전히 구분된다. action은 새로운 데이터를 포함하고 있는 간단한 객체로 _type_ 프로퍼티로 구분할 수 있다.
<p class="associated-with-next-sibling">
view는 사용자의 상호작용에 응답하기 위해 새로운 action을 만들어 시스템에 전파한다:
</p>
<figure class="diagram">
<img src="/flux/img/flux-simple-f8-diagram-with-client-action-1300w.png" alt="사용자 상호작용에 따른 Flux의 데이터 흐름" />
</figure>
<p class="associated-with-next-sibling">
모든 데이터는 중앙 허브인 dispatcher를 통해 흐른다. action은 dispatcher에게 <em>action creator</em> 메소드를 제공하는데 대부분의 action은 view에서의 사용자 상호작용에서 발생한다. dispatcher는 store를 등록하기 위한 콜백을 실행한 이후에 action을 모든 store로 전달한다. store는 등록된 콜백을 활용해 관리하고 있는 상태 중 어떤 액션이라도 관련이 있다면 전달해준다. store는 <em>change</em> 이벤트를 controller-views에게 알려주고 그 결과로 데이터 계층에서의 변화가 일어난다. Controller-views는 이 이벤트를 듣고 있다가 이벤트 핸들러가 있는 store에서 데이터를 다시 가져온다. controller-views는 자신의 <code>setState()</code> 메소드를 호출하고 컴포넌트 트리에 속해 있는 자식 노드 모두를 다시 렌더링하게 한다.
</p>
<figure class="diagram">
<img src="/flux/img/flux-simple-f8-diagram-explained-1300w.png" alt="flux 데이터 흐름의 각각 순서에서 다양하게 전달되는 데이터" />
</figure>
Action creator는 라이브러리에서 제공하는 도움 메소드로 메소드 파라미터에서 action을 생성하고 *type*을 설정하거나 dispatcher에게 제공하는 역할을 한다.
모든 action은 store가 dispatcher에 등록해둔 callback을 통해 모든 store에 전송된다.
action에 대한 응답으로 store가 스스로 갱신을 한 다음에는 자신이 변경되었다고 모두에게 알린다.
controller-view라고 불리는 특별한 view가 변경 이벤트를 듣고 새로운 데이터를 store에서 가져온 후 모든 트리에 있는 자식 view에게 새로운 데이터를 제공한다.
이 구조는 함수형 반응 프로그래밍을 다시 재현하는 것을 쉽게 만들거
gitextract_v_zkddy6/
├── .github/
│ └── workflows/
│ └── node.js.yml
├── .gitignore
├── .npmignore
├── .prettierrc
├── .watchmanconfig
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── Gulpfile.js
├── LICENSE
├── README.md
├── bower.json
├── dist/
│ ├── Flux.js
│ └── FluxUtils.js
├── docs/
│ ├── Dispatcher.ko-KR.md
│ ├── Dispatcher.md
│ ├── Flux-Utils.md
│ ├── In-Depth-Overview.md
│ ├── Overview.ko-KR.md
│ ├── Overview.md
│ ├── Related-Libraries.md
│ ├── Videos.ko-KR.md
│ └── Videos.md
├── examples/
│ ├── README.md
│ ├── flux-async/
│ │ ├── .babelrc
│ │ ├── .flowconfig
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── flow/
│ │ │ ├── flux-utils.js
│ │ │ ├── flux.js
│ │ │ ├── immutable.js
│ │ │ └── misc.js
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── server/
│ │ │ └── app.js
│ │ ├── src/
│ │ │ ├── TodoActions.js
│ │ │ ├── TodoDispatcher.js
│ │ │ ├── containers/
│ │ │ │ └── AppContainer.js
│ │ │ ├── data_managers/
│ │ │ │ ├── TodoAPI.js
│ │ │ │ └── TodoDataManager.js
│ │ │ ├── load_object/
│ │ │ │ ├── LoadObject.js
│ │ │ │ ├── LoadObjectMap.js
│ │ │ │ └── LoadObjectState.js
│ │ │ ├── records/
│ │ │ │ └── Todo.js
│ │ │ ├── root.js
│ │ │ ├── stores/
│ │ │ │ ├── TodoDraftStore.js
│ │ │ │ ├── TodoListStore.js
│ │ │ │ ├── TodoLoggerStore.js
│ │ │ │ └── TodoStore.js
│ │ │ ├── utils/
│ │ │ │ └── FakeID.js
│ │ │ └── views/
│ │ │ └── AppView.js
│ │ ├── todomvc-common/
│ │ │ ├── .bower.json
│ │ │ ├── base.css
│ │ │ ├── bower.json
│ │ │ └── readme.md
│ │ └── webpack.config.js
│ ├── flux-concepts/
│ │ └── README.md
│ ├── flux-flow/
│ │ ├── .babelrc
│ │ ├── .flowconfig
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── flow/
│ │ │ ├── flux-utils.js
│ │ │ └── flux.js
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── AppActions.js
│ │ │ ├── AppContainer.js
│ │ │ ├── AppDispatcher.js
│ │ │ ├── AppStore.js
│ │ │ ├── AppView.js
│ │ │ ├── __flowtests__/
│ │ │ │ └── App-flowtest.js
│ │ │ └── root.js
│ │ └── webpack.config.js
│ ├── flux-jest/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── package.json
│ │ └── src/
│ │ └── __tests__/
│ │ └── TodoStore-test.js
│ ├── flux-jest-container/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── package.json
│ │ └── src/
│ │ └── __tests__/
│ │ ├── AppContainer-test.js
│ │ └── __snapshots__/
│ │ └── AppContainer-test.js.snap
│ ├── flux-logging/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── TodoDispatcher.js
│ │ │ ├── TodoLoggerStore.js
│ │ │ └── root.js
│ │ └── webpack.config.js
│ ├── flux-shell/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ └── root.js
│ │ └── webpack.config.js
│ ├── flux-todomvc/
│ │ ├── .babelrc
│ │ ├── .gitignore
│ │ ├── README.md
│ │ ├── index.html
│ │ ├── package.json
│ │ ├── src/
│ │ │ ├── containers/
│ │ │ │ └── AppContainer.js
│ │ │ ├── data/
│ │ │ │ ├── Counter.js
│ │ │ │ ├── Todo.js
│ │ │ │ ├── TodoActionTypes.js
│ │ │ │ ├── TodoActions.js
│ │ │ │ ├── TodoDispatcher.js
│ │ │ │ ├── TodoDraftStore.js
│ │ │ │ ├── TodoEditStore.js
│ │ │ │ └── TodoStore.js
│ │ │ ├── root.js
│ │ │ └── views/
│ │ │ └── AppView.js
│ │ ├── todomvc-common/
│ │ │ ├── .bower.json
│ │ │ ├── base.css
│ │ │ ├── bower.json
│ │ │ └── readme.md
│ │ └── webpack.config.js
│ └── todomvc-common/
│ ├── .bower.json
│ ├── base.css
│ ├── bower.json
│ └── readme.md
├── index.js
├── jest.config.js
├── package.json
├── scripts/
│ ├── babel/
│ │ └── default-options.js
│ └── jest/
│ ├── environment.js
│ └── preprocessor.js
├── src/
│ ├── .flowconfig
│ ├── Dispatcher.js
│ ├── FluxMixinLegacy.js
│ ├── FluxStoreGroup.js
│ ├── __tests__/
│ │ ├── Dispatcher-test.js
│ │ └── FluxStoreGroup-test.js
│ ├── container/
│ │ ├── FluxContainer.js
│ │ ├── FluxContainerSubscriptions.js
│ │ └── __tests__/
│ │ └── FluxContainer-test.js
│ ├── stores/
│ │ ├── FluxReduceStore.js
│ │ ├── FluxStore.js
│ │ └── __tests__/
│ │ ├── FluxReduceStore-test.js
│ │ └── FluxStore-test.js
│ └── utils/
│ └── abstractMethod.js
├── utils.js
└── website/
├── .gitignore
├── README.md
├── docusaurus.config.js
├── package.json
├── sidebars.js
└── src/
├── css/
│ └── custom.css
└── pages/
├── index.js
├── styles.module.css
└── support.js
SYMBOL INDEX (275 symbols across 36 files)
FILE: Gulpfile.js
constant DEVELOPMENT_HEADER (line 20) | const DEVELOPMENT_HEADER =
constant PRODUCTION_HEADER (line 22) | const PRODUCTION_HEADER =
FILE: dist/Flux.js
function __webpack_require__ (line 19) | function __webpack_require__(moduleId) {
function _defineProperty (line 90) | function _defineProperty(obj, key, value) {
function _toPropertyKey (line 104) | function _toPropertyKey(arg) {
function _toPrimitive (line 108) | function _toPrimitive(input, hint) {
function Dispatcher (line 209) | function Dispatcher() {
function invariant (line 353) | function invariant(condition, format) {
FILE: dist/FluxUtils.js
function __webpack_require__ (line 19) | function __webpack_require__(moduleId) {
function _assertThisInitialized (line 92) | function _assertThisInitialized(self) {
function _inheritsLoose (line 98) | function _inheritsLoose(subClass, superClass) {
function _setPrototypeOf (line 103) | function _setPrototypeOf(o, p) {
function ownKeys (line 110) | function ownKeys(object, enumerableOnly) {
function _objectSpread (line 120) | function _objectSpread(target) {
function _defineProperty (line 131) | function _defineProperty(obj, key, value) {
function _toPropertyKey (line 145) | function _toPropertyKey(arg) {
function _toPrimitive (line 149) | function _toPrimitive(input, hint) {
function create (line 236) | function create(Base, options) {
function createPureComponent (line 303) | function createPureComponent(BaseComponent) {
function enforceInterface (line 317) | function enforceInterface(o) {
function createFunctional (line 354) | function createFunctional(viewFn, _getStores, _calculateState, options) {
function _defineProperty (line 404) | function _defineProperty(obj, key, value) {
function _toPropertyKey (line 418) | function _toPropertyKey(arg) {
function _toPrimitive (line 422) | function _toPrimitive(input, hint) {
function shallowArrayEqual (line 433) | function shallowArrayEqual(a, b) {
function FluxContainerSubscriptions (line 448) | function FluxContainerSubscriptions() {
function _createForOfIteratorHelper (line 548) | function _createForOfIteratorHelper(o, allowArrayLike) {
function _unsupportedIterableToArray (line 599) | function _unsupportedIterableToArray(o, minLen) {
function _arrayLikeToArray (line 607) | function _arrayLikeToArray(arr, len) {
function _defineProperty (line 612) | function _defineProperty(obj, key, value) {
function _toPropertyKey (line 626) | function _toPropertyKey(arg) {
function _toPrimitive (line 630) | function _toPrimitive(input, hint) {
function FluxStoreGroup (line 646) | function FluxStoreGroup(stores, callback) {
function _getUniformDispatcher (line 669) | function _getUniformDispatcher(stores) {
function invariant (line 719) | function invariant(condition, format) {
function getIteratorFn (line 828) | function getIteratorFn(maybeIterable) {
function setExtraStackFrame (line 873) | function setExtraStackFrame(stack) {
function warn (line 924) | function warn(format) {
function error (line 932) | function error(format) {
function printWarning (line 940) | function printWarning(level, format, args) {
function warnNoop (line 962) | function warnNoop(publicInstance, callerName) {
function Component (line 1047) | function Component(props, context, updater) {
function ComponentDummy (line 1134) | function ComponentDummy() {}
function PureComponent (line 1140) | function PureComponent(props, context, updater) {
function createRef (line 1154) | function createRef() {
function getWrappedName (line 1163) | function getWrappedName(outerType, innerType, wrapperName) {
function getContextName (line 1167) | function getContextName(type) {
function getComponentName (line 1170) | function getComponentName(type) {
function hasValidRef (line 1240) | function hasValidRef(config) {
function hasValidKey (line 1251) | function hasValidKey(config) {
function defineKeyPropWarningGetter (line 1262) | function defineKeyPropWarningGetter(props, displayName) {
function defineRefPropWarningGetter (line 1277) | function defineRefPropWarningGetter(props, displayName) {
function warnIfStringRefCannotBeAutoConverted (line 1292) | function warnIfStringRefCannotBeAutoConverted(config) {
function createElement (line 1379) | function createElement(type, config, children) {
function cloneAndReplaceKey (line 1445) | function cloneAndReplaceKey(oldElement, newKey) {
function cloneElement (line 1454) | function cloneElement(element, config, children) {
function isValidElement (line 1521) | function isValidElement(object) {
function escape (line 1533) | function escape(key) {
function escapeUserProvidedKey (line 1551) | function escapeUserProvidedKey(text) {
function getElementKey (line 1562) | function getElementKey(element, index) {
function mapIntoArray (line 1572) | function mapIntoArray(children, array, escapedPrefix, nameSoFar, callbac...
function mapChildren (line 1681) | function mapChildren(children, func, context) {
function countChildren (line 1702) | function countChildren(children) {
function forEachChildren (line 1723) | function forEachChildren(children, forEachFunc, forEachContext) {
function toArray (line 1735) | function toArray(children) {
function onlyChild (line 1755) | function onlyChild(children) {
function createContext (line 1763) | function createContext(defaultValue, calculateChangedBits) {
function lazyInitializer (line 1878) | function lazyInitializer(payload) {
function lazy (line 1916) | function lazy(ctor) {
function forwardRef (line 1967) | function forwardRef(render) {
function isValidElementType (line 2011) | function isValidElementType(type) {
function memo (line 2026) | function memo(type, compare) {
function resolveDispatcher (line 2055) | function resolveDispatcher() {
function useContext (line 2064) | function useContext(Context, unstable_observedBits) {
function useState (line 2084) | function useState(initialState) {
function useReducer (line 2088) | function useReducer(reducer, initialArg, init) {
function useRef (line 2092) | function useRef(initialValue) {
function useEffect (line 2096) | function useEffect(create, deps) {
function useLayoutEffect (line 2100) | function useLayoutEffect(create, deps) {
function useCallback (line 2104) | function useCallback(callback, deps) {
function useMemo (line 2108) | function useMemo(create, deps) {
function useImperativeHandle (line 2112) | function useImperativeHandle(ref, create, deps) {
function useDebugValue (line 2116) | function useDebugValue(value, formatterFn) {
function disabledLog (line 2135) | function disabledLog() {}
function disableLogs (line 2137) | function disableLogs() {
function reenableLogs (line 2171) | function reenableLogs() {
function describeBuiltInComponentFrame (line 2215) | function describeBuiltInComponentFrame(name, source, ownerFn) {
function describeNativeComponentFrame (line 2236) | function describeNativeComponentFrame(fn, construct) {
function describeFunctionComponentFrame (line 2368) | function describeFunctionComponentFrame(fn, source, ownerFn) {
function shouldConstruct (line 2373) | function shouldConstruct(Component) {
function describeUnknownElementTypeFrameInDEV (line 2377) | function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
function setCurrentlyValidatingElement (line 2420) | function setCurrentlyValidatingElement(element) {
function checkPropTypes (line 2431) | function checkPropTypes(typeSpecs, values, location, componentName, elem...
function setCurrentlyValidatingElement$1 (line 2470) | function setCurrentlyValidatingElement$1(element) {
function getDeclarationErrorAddendum (line 2485) | function getDeclarationErrorAddendum() {
function getSourceInfoErrorAddendum (line 2494) | function getSourceInfoErrorAddendum(source) {
function getSourceInfoErrorAddendumForProps (line 2502) | function getSourceInfoErrorAddendumForProps(elementProps) {
function getCurrentComponentErrorInfo (line 2515) | function getCurrentComponentErrorInfo(parentType) {
function validateExplicitKey (line 2537) | function validateExplicitKey(element, parentType) {
function validateChildKeys (line 2571) | function validateChildKeys(node, parentType) {
function validatePropTypes (line 2611) | function validatePropTypes(element) {
function validateFragmentProps (line 2648) | function validateFragmentProps(fragment) {
function createElementWithValidation (line 2667) | function createElementWithValidation(type, props, children) {
function createFactoryWithValidation (line 2721) | function createFactoryWithValidation(type) {
function cloneElementWithValidation (line 2743) | function cloneElementWithValidation(element, props, children) {
function toObject (line 2814) | function toObject(val) {
function shouldUseNative (line 2820) | function shouldUseNative() {
function is (line 2907) | function is(x, y) {
function shallowEqual (line 2925) | function shallowEqual(objA, objB) {
function _createForOfIteratorHelper (line 2964) | function _createForOfIteratorHelper(o, allowArrayLike) {
function _unsupportedIterableToArray (line 3015) | function _unsupportedIterableToArray(o, minLen) {
function _arrayLikeToArray (line 3023) | function _arrayLikeToArray(arr, len) {
function FluxMixinLegacy (line 3066) | function FluxMixinLegacy(stores) {
function enforceInterface (line 3122) | function enforceInterface(o) {
function _assertThisInitialized (line 3144) | function _assertThisInitialized(self) {
function _inheritsLoose (line 3150) | function _inheritsLoose(subClass, superClass) {
function _setPrototypeOf (line 3155) | function _setPrototypeOf(o, p) {
function _defineProperty (line 3162) | function _defineProperty(obj, key, value) {
function _toPropertyKey (line 3176) | function _toPropertyKey(arg) {
function _toPrimitive (line 3180) | function _toPrimitive(input, hint) {
function FluxReduceStore (line 3217) | function FluxReduceStore(dispatcher) {
function _defineProperty (line 3299) | function _defineProperty(obj, key, value) {
function _toPropertyKey (line 3313) | function _toPropertyKey(arg) {
function _toPrimitive (line 3317) | function _toPrimitive(input, hint) {
function FluxStore (line 3341) | function FluxStore(dispatcher) {
function BaseEventEmitter (line 3470) | function BaseEventEmitter() {
function _inheritsLoose (line 3629) | function _inheritsLoose(subClass, superClass) {
function EmitterSubscription (line 3650) | function EmitterSubscription(subscriber, listener, context) {
function EventSubscription (line 3687) | function EventSubscription(subscriber) {
function EventSubscriptionVendor (line 3729) | function EventSubscriptionVendor() {
function makeEmptyFunction (line 3815) | function makeEmptyFunction(arg) {
function abstractMethod (line 3858) | function abstractMethod(className, methodName) {
FILE: examples/flux-async/server/app.js
constant ERROR_PCT (line 19) | const ERROR_PCT = 25.0;
constant PORT (line 23) | const PORT = 3000;
constant DATA_FILE (line 27) | const DATA_FILE = path.join(__dirname, 'data.json');
constant SHOULD_DELAY (line 35) | const SHOULD_DELAY = true;
constant RANGE (line 36) | const RANGE = [250, 2000];
function randomError (line 415) | function randomError(res) {
function unique (line 425) | function unique(arr) {
function missing (line 430) | function missing(res, field) {
function missingID (line 434) | function missingID(res, id) {
function getTodos (line 438) | function getTodos() {
function setTodos (line 446) | function setTodos(todos) {
function nextID (line 451) | function nextID() {
FILE: examples/flux-async/src/containers/AppContainer.js
function getStores (line 23) | function getStores() {
function getState (line 27) | function getState() {
function onDelete (line 54) | function onDelete(ids: Array<string>) {
function onDraftCreate (line 61) | function onDraftCreate(value: string) {
function onDraftSet (line 71) | function onDraftSet(value: string) {
function onRetry (line 78) | function onRetry(todo: Todo) {
function onUpdateTodos (line 95) | function onUpdateTodos(todos: Array<Todo>) {
FILE: examples/flux-async/src/data_managers/TodoAPI.js
constant PORT (line 17) | const PORT = 3000;
constant PREFIX (line 18) | const PREFIX = 'http://localhost:' + PORT;
class TodoAPI (line 29) | class TodoAPI {
method get (line 63) | get(uri, data) {
method post (line 67) | post(uri, data) {
function promiseXHR (line 76) | function promiseXHR(method: 'get' | 'post', uri, data) {
FILE: examples/flux-async/src/load_object/LoadObject.js
constant SECRET (line 25) | const SECRET = 'SECRET_' + Math.random();
method if (line 127) | if (this._operation === operation) {
method if (line 140) | if (this._value === value && this._hasValue === true) {
method if (line 147) | if (this._error === error) {
method if (line 160) | if (this._operation === 'NONE') {
method if (line 173) | if (this._value === undefined && this._hasValue === false) {
method if (line 186) | if (this._error === undefined) {
method if (line 199) | if (!this.hasValue()) {
FILE: examples/flux-async/src/load_object/LoadObjectState.js
method if (line 37) | if (!this._preventLoadsForThisFrame && this._shouldLoad(this._data)) {
method if (line 49) | if (lo === this._data) {
FILE: examples/flux-async/src/records/Todo.js
class Todo (line 16) | class Todo {
FILE: examples/flux-async/src/stores/TodoDraftStore.js
method constructor (line 23) | constructor() {
method switch (line 32) | switch (action.type) {
FILE: examples/flux-async/src/stores/TodoListStore.js
method constructor (line 27) | constructor() {
method switch (line 40) | switch (action.type) {
FILE: examples/flux-async/src/stores/TodoLoggerStore.js
constant DEBUG (line 19) | const DEBUG = false;
function log (line 21) | function log(action: Action): void {
method constructor (line 28) | constructor() {
FILE: examples/flux-async/src/stores/TodoStore.js
method constructor (line 28) | constructor() {
method switch (line 42) | switch (action.type) {
FILE: examples/flux-async/src/utils/FakeID.js
constant RANDOM_INT (line 16) | const RANDOM_INT = Math.round(Math.random() * 10000);
constant PREFIX (line 17) | const PREFIX = 'FAKE_' + RANDOM_INT + '_';
FILE: examples/flux-async/src/views/AppView.js
constant ENTER_KEY_CODE (line 176) | const ENTER_KEY_CODE = 13;
FILE: examples/flux-flow/src/AppContainer.js
function getStores (line 19) | function getStores() {
function getState (line 23) | function getState() {
FILE: examples/flux-flow/src/AppStore.js
method constructor (line 20) | constructor() {
method switch (line 29) | switch (action.type) {
FILE: examples/flux-flow/src/AppView.js
function AppView (line 18) | function AppView(props: Props): React.Element<*> {
FILE: examples/flux-flow/src/__flowtests__/App-flowtest.js
function t1 (line 28) | function t1() {
function t2 (line 39) | function t2(): React.Element<*> {
FILE: examples/flux-logging/src/TodoLoggerStore.js
method log (line 19) | log(...args) {
class TodoLoggerStore (line 24) | class TodoLoggerStore extends ReduceStore {
method constructor (line 25) | constructor() {
method getInitialState (line 29) | getInitialState() {
method reduce (line 36) | reduce(state, action) {
FILE: examples/flux-todomvc/src/containers/AppContainer.js
function getStores (line 19) | function getStores() {
function getState (line 23) | function getState() {
FILE: examples/flux-todomvc/src/data/Counter.js
method increment (line 18) | increment() {
FILE: examples/flux-todomvc/src/data/TodoActions.js
method addTodo (line 16) | addTodo(text) {
method deleteCompletedTodos (line 23) | deleteCompletedTodos() {
method deleteTodo (line 29) | deleteTodo(id) {
method editTodo (line 36) | editTodo(id, text) {
method startEditingTodo (line 44) | startEditingTodo(id) {
method stopEditingTodo (line 51) | stopEditingTodo() {
method toggleAllTodos (line 57) | toggleAllTodos() {
method toggleTodo (line 63) | toggleTodo(id) {
method updateDraft (line 70) | updateDraft(text) {
FILE: examples/flux-todomvc/src/data/TodoDraftStore.js
class TodoDraftStore (line 16) | class TodoDraftStore extends ReduceStore {
method constructor (line 17) | constructor() {
method getInitialState (line 21) | getInitialState() {
method reduce (line 25) | reduce(state, action) {
FILE: examples/flux-todomvc/src/data/TodoEditStore.js
class TodoEditStore (line 16) | class TodoEditStore extends ReduceStore {
method constructor (line 17) | constructor() {
method getInitialState (line 21) | getInitialState() {
method reduce (line 25) | reduce(state, action) {
FILE: examples/flux-todomvc/src/data/TodoStore.js
class TodoStore (line 19) | class TodoStore extends ReduceStore {
method constructor (line 20) | constructor() {
method getInitialState (line 24) | getInitialState() {
method reduce (line 28) | reduce(state, action) {
FILE: examples/flux-todomvc/src/views/AppView.js
function AppView (line 16) | function AppView(props) {
function Header (line 26) | function Header(props) {
function Main (line 35) | function Main(props) {
function Footer (line 70) | function Footer(props) {
constant ENTER_KEY_CODE (line 99) | const ENTER_KEY_CODE = 13;
function NewTodo (line 100) | function NewTodo(props) {
function TodoItem (line 122) | function TodoItem(props) {
FILE: src/FluxStoreGroup.js
method for (line 55) | for (var store of stores) {
FILE: src/__tests__/FluxStoreGroup-test.js
class SimpleStore (line 17) | class SimpleStore extends FluxStore {
method __onDispatch (line 18) | __onDispatch(payload) {
FILE: src/container/FluxContainer.js
constant DEFAULT_OPTIONS (line 31) | const DEFAULT_OPTIONS = {
method constructor (line 131) | constructor(props: Props, context: any) {
method UNSAFE_componentWillReceiveProps (line 147) | UNSAFE_componentWillReceiveProps(nextProps: any, nextContext: any): void {
method componentWillUnmount (line 167) | componentWillUnmount() {
FILE: src/container/FluxContainerSubscriptions.js
method if (line 19) | if (a === b) {
method if (line 26) | if (a[i] !== b[i]) {
method if (line 44) | if (this._stores && shallowArrayEqual(this._stores, stores)) {
method if (line 70) | if (changed) {
method if (line 95) | if (this._tokens) {
method if (line 102) | if (this._storeGroup) {
FILE: src/container/__tests__/FluxContainer-test.js
function createContainer (line 25) | function createContainer(containerClass, options, props) {
class BaseContainer (line 38) | class BaseContainer extends React.Component {
method getStores (line 39) | static getStores() {
method render (line 43) | render() {
class FooStoreClass (line 52) | class FooStoreClass extends FluxReduceStore {
method constructor (line 53) | constructor() {
method getInitialState (line 57) | getInitialState() {
method reduce (line 61) | reduce(state, action) {
class SimpleContainer (line 76) | class SimpleContainer extends BaseContainer {
method calculateState (line 77) | static calculateState(prevState) {
method calculateState (line 97) | static calculateState(prevState) {
method calculateState (line 135) | static calculateState(prevState, props) {
method calculateState (line 159) | static calculateState(prevState, props) {
method calculateState (line 185) | static calculateState(prevState, props) {
method constructor (line 191) | constructor(props) {
method calculateState (line 219) | static calculateState(prevState, props) {
method UNSAFE_componentWillMount (line 225) | UNSAFE_componentWillMount() {
method getStores (line 242) | static getStores(props, context) {
method calculateState (line 246) | static calculateState(prevState, props, context) {
method calculateState (line 269) | static calculateState(prevState, props, context) {
class SimpleContainer (line 96) | class SimpleContainer extends BaseContainer {
method calculateState (line 77) | static calculateState(prevState) {
method calculateState (line 97) | static calculateState(prevState) {
method calculateState (line 135) | static calculateState(prevState, props) {
method calculateState (line 159) | static calculateState(prevState, props) {
method calculateState (line 185) | static calculateState(prevState, props) {
method constructor (line 191) | constructor(props) {
method calculateState (line 219) | static calculateState(prevState, props) {
method UNSAFE_componentWillMount (line 225) | UNSAFE_componentWillMount() {
method getStores (line 242) | static getStores(props, context) {
method calculateState (line 246) | static calculateState(prevState, props, context) {
method calculateState (line 269) | static calculateState(prevState, props, context) {
class SimpleContainer (line 134) | class SimpleContainer extends BaseContainer {
method calculateState (line 77) | static calculateState(prevState) {
method calculateState (line 97) | static calculateState(prevState) {
method calculateState (line 135) | static calculateState(prevState, props) {
method calculateState (line 159) | static calculateState(prevState, props) {
method calculateState (line 185) | static calculateState(prevState, props) {
method constructor (line 191) | constructor(props) {
method calculateState (line 219) | static calculateState(prevState, props) {
method UNSAFE_componentWillMount (line 225) | UNSAFE_componentWillMount() {
method getStores (line 242) | static getStores(props, context) {
method calculateState (line 246) | static calculateState(prevState, props, context) {
method calculateState (line 269) | static calculateState(prevState, props, context) {
class SimpleContainer (line 158) | class SimpleContainer extends BaseContainer {
method calculateState (line 77) | static calculateState(prevState) {
method calculateState (line 97) | static calculateState(prevState) {
method calculateState (line 135) | static calculateState(prevState, props) {
method calculateState (line 159) | static calculateState(prevState, props) {
method calculateState (line 185) | static calculateState(prevState, props) {
method constructor (line 191) | constructor(props) {
method calculateState (line 219) | static calculateState(prevState, props) {
method UNSAFE_componentWillMount (line 225) | UNSAFE_componentWillMount() {
method getStores (line 242) | static getStores(props, context) {
method calculateState (line 246) | static calculateState(prevState, props, context) {
method calculateState (line 269) | static calculateState(prevState, props, context) {
class SimpleContainer (line 184) | class SimpleContainer extends BaseContainer {
method calculateState (line 77) | static calculateState(prevState) {
method calculateState (line 97) | static calculateState(prevState) {
method calculateState (line 135) | static calculateState(prevState, props) {
method calculateState (line 159) | static calculateState(prevState, props) {
method calculateState (line 185) | static calculateState(prevState, props) {
method constructor (line 191) | constructor(props) {
method calculateState (line 219) | static calculateState(prevState, props) {
method UNSAFE_componentWillMount (line 225) | UNSAFE_componentWillMount() {
method getStores (line 242) | static getStores(props, context) {
method calculateState (line 246) | static calculateState(prevState, props, context) {
method calculateState (line 269) | static calculateState(prevState, props, context) {
class SimpleContainer (line 218) | class SimpleContainer extends BaseContainer {
method calculateState (line 77) | static calculateState(prevState) {
method calculateState (line 97) | static calculateState(prevState) {
method calculateState (line 135) | static calculateState(prevState, props) {
method calculateState (line 159) | static calculateState(prevState, props) {
method calculateState (line 185) | static calculateState(prevState, props) {
method constructor (line 191) | constructor(props) {
method calculateState (line 219) | static calculateState(prevState, props) {
method UNSAFE_componentWillMount (line 225) | UNSAFE_componentWillMount() {
method getStores (line 242) | static getStores(props, context) {
method calculateState (line 246) | static calculateState(prevState, props, context) {
method calculateState (line 269) | static calculateState(prevState, props, context) {
class SimpleContainer (line 239) | class SimpleContainer extends BaseContainer {
method calculateState (line 77) | static calculateState(prevState) {
method calculateState (line 97) | static calculateState(prevState) {
method calculateState (line 135) | static calculateState(prevState, props) {
method calculateState (line 159) | static calculateState(prevState, props) {
method calculateState (line 185) | static calculateState(prevState, props) {
method constructor (line 191) | constructor(props) {
method calculateState (line 219) | static calculateState(prevState, props) {
method UNSAFE_componentWillMount (line 225) | UNSAFE_componentWillMount() {
method getStores (line 242) | static getStores(props, context) {
method calculateState (line 246) | static calculateState(prevState, props, context) {
method calculateState (line 269) | static calculateState(prevState, props, context) {
class SimpleContainer (line 266) | class SimpleContainer extends BaseContainer {
method calculateState (line 77) | static calculateState(prevState) {
method calculateState (line 97) | static calculateState(prevState) {
method calculateState (line 135) | static calculateState(prevState, props) {
method calculateState (line 159) | static calculateState(prevState, props) {
method calculateState (line 185) | static calculateState(prevState, props) {
method constructor (line 191) | constructor(props) {
method calculateState (line 219) | static calculateState(prevState, props) {
method UNSAFE_componentWillMount (line 225) | UNSAFE_componentWillMount() {
method getStores (line 242) | static getStores(props, context) {
method calculateState (line 246) | static calculateState(prevState, props, context) {
method calculateState (line 269) | static calculateState(prevState, props, context) {
FILE: src/stores/__tests__/FluxReduceStore-test.js
class FooStore (line 16) | class FooStore extends FluxReduceStore {
method getInitialState (line 17) | getInitialState() {
method reduce (line 21) | reduce(state, action) {
FILE: src/stores/__tests__/FluxStore-test.js
class TestFluxStore (line 19) | class TestFluxStore extends FluxStore {
method __onDispatch (line 20) | __onDispatch(action) {
class IncompleteFluxStore (line 31) | class IncompleteFluxStore extends FluxStore {}
class IllegalFluxStore (line 33) | class IllegalFluxStore extends FluxStore {
method __onDispatch (line 34) | __onDispatch() {}
method illegalEmit (line 35) | illegalEmit() {
FILE: website/src/pages/index.js
function VideoContainer (line 49) | function VideoContainer() {
function Home (line 86) | function Home() {
FILE: website/src/pages/support.js
function Support (line 16) | function Support() {
Condensed preview — 155 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (497K chars).
[
{
"path": ".github/workflows/node.js.yml",
"chars": 734,
"preview": "# This workflow will do a clean install of node dependencies, build the source code and run tests across different versi"
},
{
"path": ".gitignore",
"chars": 84,
"preview": "node_modules\nlib\n*.log\nwebsite/src/flux/docs/\nwebsite/core/metadata.js\nflow/include\n"
},
{
"path": ".npmignore",
"chars": 50,
"preview": "src/\nMakefile\nFlux.js\nCONTRIBUTING.md\n.flowconfig\n"
},
{
"path": ".prettierrc",
"chars": 150,
"preview": "{\n \"bracketSameLine\": true,\n \"bracketSpacing\": false,\n \"printWidth\": 80,\n \"proseWrap\": \"never\",\n \"singleQuote\": tru"
},
{
"path": ".watchmanconfig",
"chars": 3,
"preview": "{}\n"
},
{
"path": "CHANGELOG.md",
"chars": 1919,
"preview": "# Changelog\n\n### 4.0.3\n\n- Upgraded `fbjs` to 3.0.1 which fixes [CVE-2021-27292](https://www.whitesourcesoftware.com/vuln"
},
{
"path": "CODE_OF_CONDUCT.md",
"chars": 249,
"preview": "# Code of Conduct\n\nFacebook has adopted a Code of Conduct that we expect project participants to adhere to. Please [read"
},
{
"path": "CONTRIBUTING.md",
"chars": 1985,
"preview": "# Contributing to Flux\nWe want to make contributing to this project as easy and transparent as\npossible.\n\n## Code of Con"
},
{
"path": "Gulpfile.js",
"chars": 4668,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the BSD-style license"
},
{
"path": "LICENSE",
"chars": 1510,
"preview": "BSD License\n\nFor Flux software\n\nCopyright (c) Facebook, Inc. and its affiliates.\n\nRedistribution and use in source and b"
},
{
"path": "README.md",
"chars": 3976,
"preview": "## ⚠️ The Flux project has been archived and no further changes will be made. We recommend using more sophisticated alte"
},
{
"path": "bower.json",
"chars": 843,
"preview": "{\n \"name\": \"flux\",\n \"description\": \"An application architecture based on a unidirectional data flow\",\n \"version\": \"2."
},
{
"path": "dist/Flux.js",
"chars": 12043,
"preview": "/**\n * Flux v4.0.4\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && ty"
},
{
"path": "dist/FluxUtils.js",
"chars": 140721,
"preview": "/**\n * Flux v4.0.4\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && ty"
},
{
"path": "docs/Dispatcher.ko-KR.md",
"chars": 2712,
"preview": "---\nid: dispatcher-ko-KR\ntitle: Dispatcher\n---\n\nDispatcher는 등록된 callback에 데이터를 중계할 때 사용된다. 일반적인 pub-sub 시스템과는 다음 두 항목이 다"
},
{
"path": "docs/Dispatcher.md",
"chars": 3597,
"preview": "---\nid: dispatcher\ntitle: Dispatcher\n---\n\nDispatcher is used to broadcast payloads to registered callbacks. This is diff"
},
{
"path": "docs/Flux-Utils.md",
"chars": 6466,
"preview": "---\nid: flux-utils\ntitle: Flux Utils\n---\n\nFlux Utils is a set of basic utility classes to help get you started with Flux"
},
{
"path": "docs/In-Depth-Overview.md",
"chars": 12512,
"preview": "---\nid: in-depth-overview\ntitle: In-Depth Overview\n---\n\nFlux is the application architecture that Facebook uses for buil"
},
{
"path": "docs/Overview.ko-KR.md",
"chars": 8916,
"preview": "---\nid: overview-ko-KR\ntitle: 개요\nlayout: docs\ncategory: Quick Start\nnext: dispatcher-ko-KR\nlang: ko-KR\n---\n\nFlux는 Facebo"
},
{
"path": "docs/Overview.md",
"chars": 536,
"preview": "---\nid: overview\ntitle: Overview\nlayout: docs\ncategory: Quick Start\nnext: in-depth-overview\n---\n\nIn order to get started"
},
{
"path": "docs/Related-Libraries.md",
"chars": 7286,
"preview": "---\nid: related-libraries\ntitle: Related Libraries\n---\n\n### React – User Interfaces\n\nIf any JavaScript project has taken"
},
{
"path": "docs/Videos.ko-KR.md",
"chars": 1012,
"preview": "---\nid: videos-ko-KR\ntitle: 비디오\n---\n\n### Rethinking Web App Development at Facebook - Facebook F8 Conference 2014\n\n<figu"
},
{
"path": "docs/Videos.md",
"chars": 1132,
"preview": "---\nid: videos\ntitle: Videos\n---\n\n### Rethinking Web App Development at Facebook - Facebook F8 Conference 2014\n\n<figure "
},
{
"path": "examples/README.md",
"chars": 2069,
"preview": "# Examples\n\nThis directory contains examples that should help get you started with Flux. They are listed in the order yo"
},
{
"path": "examples/flux-async/.babelrc",
"chars": 402,
"preview": "{\n \"presets\": [\"es2015\"],\n \"plugins\": [\n \"syntax-async-functions\",\n \"syntax-class-properties\",\n \"syntax-flow\""
},
{
"path": "examples/flux-async/.flowconfig",
"chars": 137,
"preview": "[ignore]\n\n.*/node_modules/.*\n\n[libs]\n\nflow\n\n[options]\n\nsuppress_comment=\\\\(.\\\\|\\n\\\\)*\\\\$FlowExpectedError\nexperimental.c"
},
{
"path": "examples/flux-async/.gitignore",
"chars": 24,
"preview": "bundle.js\ndata.json\nlib\n"
},
{
"path": "examples/flux-async/README.md",
"chars": 4001,
"preview": "# flux-async\n\nThis is an advanced example. It pulls a lot of the concepts from previous examples into a single applicati"
},
{
"path": "examples/flux-async/flow/flux-utils.js",
"chars": 1691,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/flow/flux.js",
"chars": 653,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/flow/immutable.js",
"chars": 590,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/flow/misc.js",
"chars": 487,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/index.html",
"chars": 379,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Flux • TodoMVC</title>\n <link rel=\""
},
{
"path": "examples/flux-async/package.json",
"chars": 1456,
"preview": "{\n \"name\": \"flux-todomvc\",\n \"version\": \"1.0.0\",\n \"description\": \"Basic shell application for the Flux architecture\",\n"
},
{
"path": "examples/flux-async/server/app.js",
"chars": 9802,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/TodoActions.js",
"chars": 1802,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/TodoDispatcher.js",
"chars": 508,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/containers/AppContainer.js",
"chars": 2539,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/data_managers/TodoAPI.js",
"chars": 3037,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/data_managers/TodoDataManager.js",
"chars": 2532,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/load_object/LoadObject.js",
"chars": 6117,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/load_object/LoadObjectMap.js",
"chars": 4365,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/load_object/LoadObjectState.js",
"chars": 1900,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/records/Todo.js",
"chars": 829,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/root.js",
"chars": 589,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/stores/TodoDraftStore.js",
"chars": 990,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/stores/TodoListStore.js",
"chars": 2819,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/stores/TodoLoggerStore.js",
"chars": 870,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/stores/TodoStore.js",
"chars": 4679,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/utils/FakeID.js",
"chars": 862,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/src/views/AppView.js",
"chars": 6360,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-async/todomvc-common/.bower.json",
"chars": 382,
"preview": "{\n \"name\": \"todomvc-common\",\n \"version\": \"0.1.9\",\n \"homepage\": \"https://github.com/tastejs/todomvc-common\",\n \"_relea"
},
{
"path": "examples/flux-async/todomvc-common/base.css",
"chars": 11100,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "examples/flux-async/todomvc-common/bower.json",
"chars": 53,
"preview": "{\n \"name\": \"todomvc-common\",\n \"version\": \"0.1.9\"\n}\n"
},
{
"path": "examples/flux-async/todomvc-common/readme.md",
"chars": 99,
"preview": "# todomvc-common\n\n> Bower component for some common utilities we use in every app\n\n## License\n\nMIT\n"
},
{
"path": "examples/flux-async/webpack.config.js",
"chars": 312,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "examples/flux-concepts/README.md",
"chars": 4379,
"preview": "# flux-concepts\n\nThese are the important high-level concepts and principles you should know about when writing applicati"
},
{
"path": "examples/flux-flow/.babelrc",
"chars": 337,
"preview": "{\n \"presets\": [\"es2015\"],\n \"plugins\": [\n \"syntax-async-functions\",\n \"syntax-flow\",\n \"syntax-jsx\",\n \"syntax"
},
{
"path": "examples/flux-flow/.flowconfig",
"chars": 137,
"preview": "[ignore]\n\n.*/node_modules/.*\n\n[libs]\n\nflow\n\n[options]\n\nsuppress_comment=\\\\(.\\\\|\\n\\\\)*\\\\$FlowExpectedError\nexperimental.c"
},
{
"path": "examples/flux-flow/.gitignore",
"chars": 14,
"preview": "bundle.js\nlib\n"
},
{
"path": "examples/flux-flow/README.md",
"chars": 1398,
"preview": "# flux-flow\n\nThis is a very simple example that highlights how to set up Flux and [Flow](https://flowtype.org/) in the s"
},
{
"path": "examples/flux-flow/flow/flux-utils.js",
"chars": 1691,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-flow/flow/flux.js",
"chars": 653,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-flow/index.html",
"chars": 206,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Flux • Shell</title>\n </head>\n <body"
},
{
"path": "examples/flux-flow/package.json",
"chars": 1227,
"preview": "{\n \"name\": \"flux-flow\",\n \"version\": \"1.0.0\",\n \"description\": \"Basic shell application for the Flux architecture\",\n \""
},
{
"path": "examples/flux-flow/src/AppActions.js",
"chars": 467,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-flow/src/AppContainer.js",
"chars": 876,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-flow/src/AppDispatcher.js",
"chars": 507,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-flow/src/AppStore.js",
"chars": 1140,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-flow/src/AppView.js",
"chars": 524,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-flow/src/__flowtests__/App-flowtest.js",
"chars": 1472,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-flow/src/root.js",
"chars": 518,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-flow/webpack.config.js",
"chars": 312,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "examples/flux-jest/.babelrc",
"chars": 337,
"preview": "{\n \"presets\": [\"es2015\"],\n \"plugins\": [\n \"syntax-async-functions\",\n \"syntax-flow\",\n \"syntax-jsx\",\n \"syntax"
},
{
"path": "examples/flux-jest/.gitignore",
"chars": 14,
"preview": "bundle.js\nlib\n"
},
{
"path": "examples/flux-jest/README.md",
"chars": 986,
"preview": "# flux-jest\n\nBeing able to unit test stores is critical. This example shows you how to write tests for the TodoMVC store"
},
{
"path": "examples/flux-jest/package.json",
"chars": 1293,
"preview": "{\n \"name\": \"flux-jest\",\n \"version\": \"1.0.0\",\n \"description\": \"Basic shell application for the Flux architecture\",\n \""
},
{
"path": "examples/flux-jest/src/__tests__/TodoStore-test.js",
"chars": 6193,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-jest-container/.babelrc",
"chars": 337,
"preview": "{\n \"presets\": [\"es2015\"],\n \"plugins\": [\n \"syntax-async-functions\",\n \"syntax-flow\",\n \"syntax-jsx\",\n \"syntax"
},
{
"path": "examples/flux-jest-container/.gitignore",
"chars": 14,
"preview": "bundle.js\nlib\n"
},
{
"path": "examples/flux-jest-container/README.md",
"chars": 1674,
"preview": "# flux-jest-container\n\nTesting the container logic that connects stores to views can be tricky. This example shows you h"
},
{
"path": "examples/flux-jest-container/package.json",
"chars": 1331,
"preview": "{\n \"name\": \"flux-jest\",\n \"version\": \"1.0.0\",\n \"description\": \"Basic shell application for the Flux architecture\",\n \""
},
{
"path": "examples/flux-jest-container/src/__tests__/AppContainer-test.js",
"chars": 4997,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-jest-container/src/__tests__/__snapshots__/AppContainer-test.js.snap",
"chars": 14586,
"preview": "exports[`AppContainer can edit task tat is complete 1`] = `\n<div>\n <header\n id=\"header\">\n <h1>\n todos\n </"
},
{
"path": "examples/flux-logging/.babelrc",
"chars": 337,
"preview": "{\n \"presets\": [\"es2015\"],\n \"plugins\": [\n \"syntax-async-functions\",\n \"syntax-flow\",\n \"syntax-jsx\",\n \"syntax"
},
{
"path": "examples/flux-logging/.gitignore",
"chars": 14,
"preview": "bundle.js\nlib\n"
},
{
"path": "examples/flux-logging/README.md",
"chars": 874,
"preview": "# flux-logging\n\nTaking advantage of the fact that a store gets every action makes it easy to add logging to a Flux appli"
},
{
"path": "examples/flux-logging/index.html",
"chars": 436,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Flux • TodoMVC</title>\n <link rel=\""
},
{
"path": "examples/flux-logging/package.json",
"chars": 1230,
"preview": "{\n \"name\": \"flux-logging\",\n \"version\": \"1.0.0\",\n \"description\": \"Basic shell application for the Flux architecture\",\n"
},
{
"path": "examples/flux-logging/src/TodoDispatcher.js",
"chars": 693,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-logging/src/TodoLoggerStore.js",
"chars": 1683,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-logging/src/root.js",
"chars": 709,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-logging/webpack.config.js",
"chars": 312,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "examples/flux-shell/.babelrc",
"chars": 337,
"preview": "{\n \"presets\": [\"es2015\"],\n \"plugins\": [\n \"syntax-async-functions\",\n \"syntax-flow\",\n \"syntax-jsx\",\n \"syntax"
},
{
"path": "examples/flux-shell/.gitignore",
"chars": 14,
"preview": "bundle.js\nlib\n"
},
{
"path": "examples/flux-shell/README.md",
"chars": 470,
"preview": "# flux-shell\n\nThis is a very simple hello world app that you can use as a starting point for your application.\n\n# Usage\n"
},
{
"path": "examples/flux-shell/index.html",
"chars": 206,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Flux • Shell</title>\n </head>\n <body"
},
{
"path": "examples/flux-shell/package.json",
"chars": 1257,
"preview": "{\n \"name\": \"flux-shell\",\n \"version\": \"1.0.0\",\n \"description\": \"Basic shell application for the Flux architecture\",\n "
},
{
"path": "examples/flux-shell/src/root.js",
"chars": 470,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-shell/webpack.config.js",
"chars": 312,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "examples/flux-todomvc/.babelrc",
"chars": 337,
"preview": "{\n \"presets\": [\"es2015\"],\n \"plugins\": [\n \"syntax-async-functions\",\n \"syntax-flow\",\n \"syntax-jsx\",\n \"syntax"
},
{
"path": "examples/flux-todomvc/.gitignore",
"chars": 14,
"preview": "bundle.js\nlib\n"
},
{
"path": "examples/flux-todomvc/README.md",
"chars": 13133,
"preview": "# flux-todomvc\n\nThis example is where you should start. It walks you through creating the classic [TodoMVC](http://todom"
},
{
"path": "examples/flux-todomvc/index.html",
"chars": 420,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>Flux • TodoMVC</title>\n <link rel=\""
},
{
"path": "examples/flux-todomvc/package.json",
"chars": 1230,
"preview": "{\n \"name\": \"flux-todomvc\",\n \"version\": \"1.0.0\",\n \"description\": \"Basic shell application for the Flux architecture\",\n"
},
{
"path": "examples/flux-todomvc/src/containers/AppContainer.js",
"chars": 1326,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-todomvc/src/data/Counter.js",
"chars": 519,
"preview": "/*\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed unde"
},
{
"path": "examples/flux-todomvc/src/data/Todo.js",
"chars": 468,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-todomvc/src/data/TodoActionTypes.js",
"chars": 707,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-todomvc/src/data/TodoActions.js",
"chars": 1537,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-todomvc/src/data/TodoDispatcher.js",
"chars": 416,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-todomvc/src/data/TodoDraftStore.js",
"chars": 872,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-todomvc/src/data/TodoEditStore.js",
"chars": 883,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-todomvc/src/data/TodoStore.js",
"chars": 1821,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-todomvc/src/root.js",
"chars": 520,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-todomvc/src/views/AppView.js",
"chars": 4229,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "examples/flux-todomvc/todomvc-common/.bower.json",
"chars": 382,
"preview": "{\n \"name\": \"todomvc-common\",\n \"version\": \"0.1.9\",\n \"homepage\": \"https://github.com/tastejs/todomvc-common\",\n \"_relea"
},
{
"path": "examples/flux-todomvc/todomvc-common/base.css",
"chars": 9841,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "examples/flux-todomvc/todomvc-common/bower.json",
"chars": 53,
"preview": "{\n \"name\": \"todomvc-common\",\n \"version\": \"0.1.9\"\n}\n"
},
{
"path": "examples/flux-todomvc/todomvc-common/readme.md",
"chars": 99,
"preview": "# todomvc-common\n\n> Bower component for some common utilities we use in every app\n\n## License\n\nMIT\n"
},
{
"path": "examples/flux-todomvc/webpack.config.js",
"chars": 312,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "examples/todomvc-common/.bower.json",
"chars": 382,
"preview": "{\n \"name\": \"todomvc-common\",\n \"version\": \"0.1.9\",\n \"homepage\": \"https://github.com/tastejs/todomvc-common\",\n \"_relea"
},
{
"path": "examples/todomvc-common/base.css",
"chars": 9841,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "examples/todomvc-common/bower.json",
"chars": 53,
"preview": "{\n \"name\": \"todomvc-common\",\n \"version\": \"0.1.9\"\n}\n"
},
{
"path": "examples/todomvc-common/readme.md",
"chars": 99,
"preview": "# todomvc-common\n\n> Bower component for some common utilities we use in every app\n\n## License\n\nMIT\n"
},
{
"path": "index.js",
"chars": 375,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "jest.config.js",
"chars": 610,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "package.json",
"chars": 1714,
"preview": "{\n \"name\": \"flux\",\n \"version\": \"4.0.4\",\n \"description\": \"An application architecture based on a unidirectional data f"
},
{
"path": "scripts/babel/default-options.js",
"chars": 669,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the BSD-style license"
},
{
"path": "scripts/jest/environment.js",
"chars": 317,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the BSD-style license"
},
{
"path": "scripts/jest/preprocessor.js",
"chars": 484,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "src/.flowconfig",
"chars": 767,
"preview": "[ignore]\n.*/__tests__/.*\n\n[include]\n../node_modules/fbemitter\n../node_modules/fbjs/lib\n../node_modules/immutable\n../node"
},
{
"path": "src/Dispatcher.js",
"chars": 6834,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "src/FluxMixinLegacy.js",
"chars": 3493,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.\n *\n * This source code is licensed under "
},
{
"path": "src/FluxStoreGroup.js",
"chars": 1717,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "src/__tests__/Dispatcher-test.js",
"chars": 5237,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "src/__tests__/FluxStoreGroup-test.js",
"chars": 2039,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "src/container/FluxContainer.js",
"chars": 7706,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "src/container/FluxContainerSubscriptions.js",
"chars": 2681,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.\n *\n * This source code is licensed under "
},
{
"path": "src/container/__tests__/FluxContainer-test.js",
"chars": 7441,
"preview": "/**\n * Copyright 2004-present Facebook. All Rights Reserved.\n *\n * This source code is licensed under the BSD-style lice"
},
{
"path": "src/stores/FluxReduceStore.js",
"chars": 3145,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.\n *\n * This source code is licensed under "
},
{
"path": "src/stores/FluxStore.js",
"chars": 3071,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.\n *\n * This source code is licensed under "
},
{
"path": "src/stores/__tests__/FluxReduceStore-test.js",
"chars": 2804,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "src/stores/__tests__/FluxStore-test.js",
"chars": 3405,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "src/utils/abstractMethod.js",
"chars": 659,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "utils.js",
"chars": 548,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n * All rights reserved.\n *\n * This source code is licensed und"
},
{
"path": "website/.gitignore",
"chars": 232,
"preview": "# dependencies\n/node_modules\n\n# production\n/build\n\n# generated files\n.docusaurus\n.cache-loader\n\n# misc\n.DS_Store\n.env.lo"
},
{
"path": "website/README.md",
"chars": 689,
"preview": "# Website\n\nThis website is built using Docusaurus 2, a modern static website generator.\n\n### Installation\n\n```\n$ yarn\n``"
},
{
"path": "website/docusaurus.config.js",
"chars": 3159,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "website/package.json",
"chars": 670,
"preview": "{\n \"name\": \"flux-website\",\n \"version\": \"0.0.1\",\n \"private\": true,\n \"scripts\": {\n \"docusaurus\": \"docusaurus\",\n "
},
{
"path": "website/sidebars.js",
"chars": 376,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "website/src/css/custom.css",
"chars": 1127,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "website/src/pages/index.js",
"chars": 5045,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "website/src/pages/styles.module.css",
"chars": 1502,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
},
{
"path": "website/src/pages/support.js",
"chars": 2448,
"preview": "/**\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found"
}
]
About this extraction
This page contains the full source code of the facebookarchive/flux GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 155 files (454.1 KB), approximately 119.7k tokens, and a symbol index with 275 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.