Skip to content

Commit 2844c0c

Browse files
Merge pull request #22 from remarkablemark/feat/react-property
feat(react-property)!: use property from React 17
2 parents 6e263dd + a54deb6 commit 2844c0c

File tree

15 files changed

+455
-364
lines changed

15 files changed

+455
-364
lines changed

packages/react-property/README.md

Lines changed: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
[![NPM version](https://img.shields.io/npm/v/react-property.svg)](https://www.npmjs.com/package/react-property)
66

7-
[HTML](https://github.com/facebook/react/blob/15-stable/src/renderers/dom/shared/HTMLDOMPropertyConfig.js) and [SVG](https://github.com/facebook/react/blob/15-stable/src/renderers/dom/shared/SVGDOMPropertyConfig.js) [DOM](https://github.com/facebook/react/blob/15-stable/src/renderers/dom/shared/DOMProperty.js) property configs used by [React](https://github.com/facebook/react).
7+
HTML and SVG DOM properties used by [React](https://github.com/facebook/react). See [DOMProperty](https://github.com/facebook/react/blob/main/packages/react-dom/src/shared/DOMProperty.js) and [possibleStandardNames](https://github.com/facebook/react/blob/main/packages/react-dom/src/shared/possibleStandardNames.js).
88

9-
[Repl.it](https://repl.it/@remarkablemark/react-property)
9+
Try [Replit](https://repl.it/@remarkablemark/react-property) demo.
1010

1111
## Install
1212

@@ -16,7 +16,7 @@ npm install react-property
1616

1717
## Usage
1818

19-
Import main module:
19+
Import module:
2020

2121
```js
2222
// CommonJS
@@ -26,50 +26,28 @@ const reactProperty = require('react-property');
2626
import reactProperty from 'react-property';
2727
```
2828

29-
Main module exports:
29+
Module contains:
3030

3131
```js
3232
{
33-
html: {
34-
autofocus: {
35-
attributeName: 'autofocus',
36-
propertyName: 'autoFocus',
37-
mustUseProperty: false,
38-
hasBooleanValue: true,
39-
hasNumericValue: false,
40-
hasPositiveNumericValue: false,
41-
hasOverloadedBooleanValue: false
42-
},
33+
BOOLEAN: 3,
34+
BOOLEANISH_STRING: 2,
35+
NUMERIC: 5,
36+
OVERLOADED_BOOLEAN: 4,
37+
POSITIVE_NUMERIC: 6,
38+
RESERVED: 0,
39+
STRING: 1,
40+
getPropertyInfo: [Function: getPropertyInfo],
41+
isCustomAttribute: [Function: bound test],
42+
possibleStandardNames: {
43+
accept: 'accept',
44+
acceptcharset: 'acceptCharset',
45+
'accept-charset': 'acceptCharset',
4346
// ...
44-
},
45-
svg: {
46-
// ...
47-
},
48-
properties: {
49-
// ...
50-
},
51-
isCustomAttribute: [Function: bound test]
47+
}
5248
}
5349
```
5450

55-
You may also import what you need:
56-
57-
```js
58-
const HTMLDOMPropertyConfig = require('react-property/lib/HTMLDOMPropertyConfig');
59-
const injection = require('react-property/lib/injection');
60-
```
61-
62-
## Layout
63-
64-
```
65-
.
66-
├── index.js
67-
└── lib
68-
   ├── HTMLDOMPropertyConfig.js
69-
   ├── SVGDOMPropertyConfig.js
70-
   └── injection.js
71-
```
72-
7351
## License
7452

75-
MIT. See [license](https://github.com/facebook/react/blob/15-stable/LICENSE) from original project.
53+
MIT. See [license](https://github.com/facebook/react/blob/main/LICENSE) from original project.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-flow", "@babel/preset-env"]
3+
}

packages/react-property/index.js

Lines changed: 0 additions & 106 deletions
This file was deleted.

packages/react-property/package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@
22
"name": "react-property",
33
"version": "1.0.2",
44
"description": "HTML and SVG DOM property configs used by React.",
5-
"main": "index.js",
5+
"main": "lib/index.js",
66
"scripts": {
7-
"build": "npm run build:html && npm run build:injection && npm run build:svg",
8-
"build:html": "node scripts/build-html",
9-
"build:injection": "node scripts/build-injection",
10-
"build:svg": "node scripts/build-svg",
7+
"build": "rollup -c rollup.config.possibleStandardNames.js && scripts/build.js && rollup -c",
118
"clean": "rm -rf lib",
129
"lint": "eslint --ignore-path .gitignore .",
1310
"lint:fix": "npm run lint -- --fix",
@@ -37,11 +34,15 @@
3734
"/lib"
3835
],
3936
"devDependencies": {
37+
"@babel/preset-env": "^7.15.4",
38+
"@babel/preset-flow": "^7.14.5",
39+
"@rollup/plugin-alias": "^3.1.5",
40+
"@rollup/plugin-babel": "^5.3.0",
4041
"eslint": "^7.32.0",
4142
"eslint-plugin-prettier": "^4.0.0",
4243
"jest": "^27.1.0",
4344
"prettier": "^2.3.2",
44-
"react-dom": "^15"
45+
"rollup": "^2.56.3"
4546
},
4647
"license": "MIT"
4748
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import alias from '@rollup/plugin-alias';
2+
import { babel } from '@rollup/plugin-babel';
3+
import { resolve } from 'path';
4+
5+
export default {
6+
input: 'src/index.js',
7+
output: {
8+
file: 'lib/index.js',
9+
format: 'cjs'
10+
},
11+
plugins: [
12+
alias({
13+
entries: [
14+
{
15+
find: 'react-dom',
16+
replacement: resolve(__dirname, '../../react/packages/react-dom')
17+
},
18+
{
19+
find: 'shared',
20+
replacement: resolve(__dirname, '../../react/packages/shared')
21+
}
22+
]
23+
}),
24+
babel({
25+
babelHelpers: 'bundled'
26+
})
27+
],
28+
treeshake: {
29+
// remove undefined variables like `__PROFILE__` and `__DEV__`
30+
unknownGlobalSideEffects: false
31+
}
32+
};
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { babel } from '@rollup/plugin-babel';
2+
import { resolve } from 'path';
3+
4+
export default {
5+
input: resolve(
6+
__dirname,
7+
'../../react/packages/react-dom/src/shared/possibleStandardNames'
8+
),
9+
output: {
10+
exports: 'auto',
11+
file: 'lib/possibleStandardNames.js',
12+
format: 'cjs'
13+
},
14+
plugins: [
15+
babel({
16+
babelHelpers: 'bundled'
17+
})
18+
]
19+
};

packages/react-property/scripts/build-html.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

packages/react-property/scripts/build-injection.js

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)