├── .babelrc.js
├── .eslintrc
├── .flowconfig
├── .gitignore
├── .prettierrc
├── .travis.yml
├── CODE_OF_CONDUCT.md
├── ReadMe.md
├── examples
├── App.js
└── index.html
├── flow-typed
├── rdl-types.js
└── react-reconciler.js
├── package.json
├── scripts
└── rollup.config.js
├── src
├── DOMComponent.js
├── DOMComponentTree.js
├── DOMConfig.js
├── DOMProperties.js
├── HTMLNodeType.js
├── Reconciler.js
├── Root.js
├── SSRHydrationDev.js
├── SSRHydrationProd.js
├── __tests__
│ ├── DOMProperties.js
│ ├── SVG.js
│ ├── context.js
│ ├── findDOMNode.js
│ ├── test-utils.js
│ └── unmountComponentAtNode.js
├── events
│ ├── SyntheticEvent.js
│ ├── __tests__
│ │ └── events.js
│ └── index.js
├── index.js
└── test-utils.js
├── test
├── setup.js
└── setupTests.js
├── webpack.config.js
└── yarn.lock
/.babelrc.js:
--------------------------------------------------------------------------------
1 | const dev = process.env.NODE_ENV !== 'production';
2 | const BUILD = !!process.env.ROLLUP;
3 |
4 | module.exports = {
5 | presets: [
6 | [
7 | '@babel/env',
8 | {
9 | modules: BUILD ? false : 'commonjs',
10 | shippedProposals: true,
11 | loose: true,
12 | targets: {
13 | browsers: [
14 | 'last 2 versions',
15 | 'last 4 android versions',
16 | 'last 4 iOS versions',
17 | 'safari >= 7',
18 | 'not ie <= 11',
19 | 'not android <= 4.4.3',
20 | ],
21 | },
22 | },
23 | ],
24 | '@babel/flow',
25 | ['@babel/react', { development: dev }],
26 | ],
27 | plugins: [['@babel/plugin-proposal-class-properties', { loose: true }]],
28 | };
29 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "parser": "babel-eslint",
3 | "plugins": ["flowtype"],
4 | "extends": ["jason/react", "prettier", "plugin:flowtype/recommended"],
5 | "globals": {
6 | "__DEV__": false,
7 | "__SVG__": false,
8 | "performance": false
9 | },
10 | "env": {
11 | "browser": true
12 | },
13 | "rules": {
14 | "flowtype/generic-spacing": "off",
15 | "flowtype/use-flow-type": "error",
16 | "no-restricted-syntax": [
17 | "error",
18 | "AwaitExpression",
19 | "ArrowFunctionExpression[async=true]",
20 | "FunctionDeclaration[async=true]",
21 | "FunctionExpression[async=true]"
22 | ]
23 | },
24 | "overrides": [
25 | {
26 | "files": ["**/__tests__/**/*.js", "test/**"],
27 | "env": {
28 | "jest": true
29 | },
30 | "rules": {
31 | "react/prop-types": "off",
32 | "global-require": "off",
33 | "no-console": "off"
34 | },
35 | "settings": {
36 | "import/core-modules": [
37 | "react-dom-lite",
38 | "react-dom-lite/test-utils"
39 | ]
40 | }
41 | }
42 | ]
43 | }
44 |
--------------------------------------------------------------------------------
/.flowconfig:
--------------------------------------------------------------------------------
1 | [ignore]
2 |
3 | [include]
4 |
5 | [libs]
6 |
7 | [lints]
8 |
9 | [options]
10 |
11 | [strict]
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules/
2 | build/
3 | lib/
4 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "singleQuote": true,
3 | "trailingComma": "all"
4 | }
5 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | sudo: false
2 | language: node_js
3 | cache: "yarn"
4 | node_js:
5 | - 8
6 | branches:
7 | only:
8 | - master
9 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | In the interest of fostering an open and welcoming environment, we as
6 | contributors and maintainers pledge to making participation in our project and
7 | our community a harassment-free experience for everyone, regardless of age, body
8 | size, disability, ethnicity, gender identity and expression, level of experience,
9 | education, socio-economic status, nationality, personal appearance, race,
10 | religion, or sexual identity and orientation.
11 |
12 | ## Our Standards
13 |
14 | Examples of behavior that contributes to creating a positive environment
15 | include:
16 |
17 | * Using welcoming and inclusive language
18 | * Being respectful of differing viewpoints and experiences
19 | * Gracefully accepting constructive criticism
20 | * Focusing on what is best for the community
21 | * Showing empathy towards other community members
22 |
23 | Examples of unacceptable behavior by participants include:
24 |
25 | * The use of sexualized language or imagery and unwelcome sexual attention or
26 | advances
27 | * Trolling, insulting/derogatory comments, and personal or political attacks
28 | * Public or private harassment
29 | * Publishing others' private information, such as a physical or electronic
30 | address, without explicit permission
31 | * Other conduct which could reasonably be considered inappropriate in a
32 | professional setting
33 |
34 | ## Our Responsibilities
35 |
36 | Project maintainers are responsible for clarifying the standards of acceptable
37 | behavior and are expected to take appropriate and fair corrective action in
38 | response to any instances of unacceptable behavior.
39 |
40 | Project maintainers have the right and responsibility to remove, edit, or
41 | reject comments, commits, code, wiki edits, issues, and other contributions
42 | that are not aligned to this Code of Conduct, or to ban temporarily or
43 | permanently any contributor for other behaviors that they deem inappropriate,
44 | threatening, offensive, or harmful.
45 |
46 | ## Scope
47 |
48 | This Code of Conduct applies both within project spaces and in public spaces
49 | when an individual is representing the project or its community. Examples of
50 | representing a project or community include using an official project e-mail
51 | address, posting via an official social media account, or acting as an appointed
52 | representative at an online or offline event. Representation of a project may be
53 | further defined and clarified by project maintainers.
54 |
55 | ## Enforcement
56 |
57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
58 | reported by contacting the project team at monastic.panic@gmail.com. All
59 | complaints will be reviewed and investigated and will result in a response that
60 | is deemed necessary and appropriate to the circumstances. The project team is
61 | obligated to maintain confidentiality with regard to the reporter of an incident.
62 | Further details of specific enforcement policies may be posted separately.
63 |
64 | Project maintainers who do not follow or enforce the Code of Conduct in good
65 | faith may face temporary or permanent repercussions as determined by other
66 | members of the project's leadership.
67 |
68 | ## Attribution
69 |
70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72 |
73 | [homepage]: https://www.contributor-covenant.org
74 |
--------------------------------------------------------------------------------
/ReadMe.md:
--------------------------------------------------------------------------------
1 | # React DOM Lite
2 |
3 | _"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint-Exupery._
4 |
5 | Compliance and amazing cross browser support led to a robust but heavy `react-dom`. React DOM Lite is an attempt to sculpt away some of the mass away and see if we can make something more low powered device friendly.
6 |
7 | ## Road map
8 |
9 | Keeping in mind the existing React ecosystem (and of course the web ecosystem too), following is the feature list to attain feature parity with the existing react-dom:
10 |
11 | * SVG and namespaced attribute support
12 | * Event normalization / polyfilling
13 | * Portals (event propagation)
14 | * Controlled inputs
15 | * Browser support matrix
16 | * SSR, hydration.
17 |
18 | The goal is to be compatible with the react ecosystem, while remaining lite. This will likely mean that the supported browsers, will be more limited than react-dom, and attempts to polyfill differences between browsers will be limited and more tightly scoped.
19 |
--------------------------------------------------------------------------------
/examples/App.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react';
2 | import * as DomLite from 'react-dom-lite';
3 |
4 | class Counter extends React.Component {
5 | constructor(...args) {
6 | super(...args);
7 |
8 | this.state = { count: 0 };
9 | }
10 | handleCount() {
11 | this.setState(({ count }) => {
12 | return {
13 | count: count + 1,
14 | };
15 | });
16 | }
17 |
18 | render() {
19 | return (
20 |