Skip to content

Commit a52bb34

Browse files
authored
Merge pull request #7 from kopach/typescript
build: introduce TypeScript to the project
2 parents 6dd67af + 36cdff4 commit a52bb34

16 files changed

+2018
-3343
lines changed

.babelrc

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

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
src
2-
.babelrc
32
webpack.config.js
43
assets

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,5 @@ But for implementation purposed use it like a regular child component.
159159
# TODO
160160

161161
- ~Live Demos~
162-
- Maybe Typescript this?
162+
- ~Maybe Typescript this?~
163163
- Test cases

assets/react-webcomponent.png

-76.9 KB
Loading

dist/build.js

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import React from 'react';
2+
declare type Mode = 'open' | 'element';
3+
export declare const registerAsWebComponent: (component: React.ElementType, customElementName: string, mode?: Mode) => void;
4+
export {};

dist/prop-bridge.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import React from 'react';
2+
export declare const renderReact2Node: (RComponent: React.ElementType, initialProps: {}, targetDomNode: Element | DocumentFragment, onRender: (ref: React.RefObject<any>) => void) => void;
3+
export declare const sendPropsToReact: (propBridgeRef: React.RefObject<any>, props: any) => void;
4+
export declare const getPropsFromNode: (node: HTMLElement) => {
5+
[key: string]: string | JSX.Element;
6+
};

dist/react-dom-child.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import React from 'react';
2+
import 'child-replace-with-polyfill';
3+
export declare class ReactDomChild extends React.Component {
4+
ref: React.RefObject<HTMLDivElement>;
5+
componentDidMount(): void;
6+
render(): JSX.Element;
7+
}

package-lock.json

Lines changed: 1861 additions & 3255 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"name": "react-webcomponentify",
33
"version": "1.2.2",
44
"description": "Build and export React Components as Web Components without any extra effort.",
5-
"main": "dist/build.js",
5+
"main": "dist/build",
6+
"typings": "dist/index",
67
"scripts": {
78
"test": "echo \"Error: no test specified\" && exit 1",
89
"build": "webpack -p"
@@ -26,18 +27,18 @@
2627
},
2728
"homepage": "https://github.com/master-atul/react-webcomponentify#readme",
2829
"dependencies": {
29-
"child-replace-with-polyfill": "^1.0.1",
30-
"react-create-ref": "^1.0.1"
30+
"child-replace-with-polyfill": "1.0.1",
31+
"react-create-ref": "1.0.1"
3132
},
3233
"devDependencies": {
33-
"@babel/core": "^7.2.2",
34-
"@babel/plugin-proposal-class-properties": "^7.3.0",
35-
"@babel/plugin-syntax-class-properties": "^7.2.0",
36-
"@babel/plugin-transform-react-jsx": "^7.3.0",
37-
"@babel/preset-env": "^7.3.1",
38-
"babel-loader": "^8.0.5",
39-
"webpack": "^4.29.0",
40-
"webpack-cli": "^3.2.1"
34+
"@types/react": "17.0.4",
35+
"@types/react-dom": "17.0.3",
36+
"react": "17.0.2",
37+
"react-dom": "17.0.2",
38+
"ts-loader": "8.2.0",
39+
"typescript": "4.2.4",
40+
"webpack": "4.29.0",
41+
"webpack-cli": "3.2.1"
4142
},
4243
"peerDependencies": {
4344
"react": "*",

0 commit comments

Comments
 (0)