Skip to content

Commit fc751b8

Browse files
committed
[optimize] upgrade to TypeScript 4.x
[optimize] upgrade Upstream packages
1 parent 5bffeff commit fc751b8

6 files changed

Lines changed: 24 additions & 28 deletions

File tree

ReadMe.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ export class TestTag extends mixin<Props, State>() {
132132

133133
render({ title }: Props, { status }: State) {
134134
return (
135-
<Fragment>
135+
<>
136136
<h1 title={title} className={`title ${status}`}>
137137
{title}
138138
<img alt={title} onClick={this.onClick} />
139139

140140
<SubTag />
141141
</h1>
142-
</Fragment>
142+
</>
143143
);
144144
}
145145
}
@@ -191,10 +191,9 @@ We recommend these libraries to use with WebCell:
191191

192192
## Roadmap
193193

194-
- [x] (Template) [Document Fragment node][21]
195194
- [ ] Server-side Render
196195

197-
Go to [contribute][22]!
196+
Go to [contribute][21]!
198197

199198
[1]: https://www.webcomponents.org/
200199
[2]: https://facebook.github.io/jsx/
@@ -216,5 +215,4 @@ Go to [contribute][22]!
216215
[18]: https://web-cell.dev/web-utility/
217216
[19]: https://web-cell.dev/iterable-observer/
218217
[20]: https://github.com/EasyWebApp/MarkCell
219-
[21]: https://github.com/Microsoft/TypeScript/issues/20469
220-
[22]: https://github.com/EasyWebApp/WebCell/blob/v2/Contributing.md
218+
[21]: https://github.com/EasyWebApp/WebCell/blob/v2/Contributing.md

package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web-cell",
3-
"version": "2.1.3",
3+
"version": "2.2.0",
44
"description": "Web Components engine based on JSX & TypeScript",
55
"keywords": [
66
"web",
@@ -26,27 +26,27 @@
2626
"@webcomponents/webcomponentsjs": "^2.4.4",
2727
"core-js": "^3.6.5",
2828
"jsdom": "^16.4.0",
29-
"web-utility": "^1.7.0"
29+
"web-utility": "^1.8.0"
3030
},
3131
"devDependencies": {
3232
"@types/core-js": "^2.5.3",
33-
"@types/jest": "^26.0.9",
33+
"@types/jest": "^26.0.10",
3434
"@types/jsdom": "^16.2.3",
35-
"@typescript-eslint/parser": "^3.8.0",
36-
"eslint": "^7.6.0",
35+
"@typescript-eslint/parser": "^3.10.1",
36+
"eslint": "^7.7.0",
3737
"eslint-config-prettier": "^6.11.0",
3838
"eslint-plugin-prettier": "^3.1.4",
3939
"husky": "^4.2.5",
40-
"jest": "^26.3.0",
41-
"lint-staged": "^10.2.11",
40+
"jest": "^26.4.2",
41+
"lint-staged": "^10.2.13",
4242
"open-cli": "^6.0.1",
4343
"parcel-bundler": "^1.12.4",
44-
"prettier": "^2.0.5",
44+
"prettier": "^2.1.1",
4545
"snabbdom": "^1.0.1",
46-
"ts-jest": "^26.1.4",
46+
"ts-jest": "^26.3.0",
4747
"typedoc": "^0.18.0",
48-
"typescript": "^3.9.7",
49-
"web-utility": "^1.7.0"
48+
"typescript": "^4.0.2",
49+
"web-utility": "^1.8.0"
5050
},
5151
"scripts": {
5252
"lint": "lint-staged",

source/WebCell.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ import {
99
import { ComponentMeta, watch, DOMEventDelegater } from './decorator';
1010
import { VNodeChildElement, VNode, createCell, render } from './renderer';
1111

12-
export interface WebCellComponent<
13-
P extends WebCellProps = WebCellProps,
14-
S = {}
15-
> extends HTMLElement {
12+
export interface WebCellComponent<P extends WebCellProps = WebCellProps, S = {}>
13+
extends HTMLElement {
1614
/**
1715
* Called every time the element is inserted into the DOM
1816
*/
@@ -144,10 +142,10 @@ export function mixin<P = WebCellProps, S = {}>(
144142
this.cache = {} as Partial<S>;
145143

146144
this.vTree = render(
147-
<Fragment>
145+
<>
148146
{this.CSS}
149147
{this.render(this.props, this.state)}
150-
</Fragment>,
148+
</>,
151149
this.root,
152150
this.vTree
153151
);

source/utility/vDOM.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { HTMLProps } from 'web-utility/source/DOM-type';
22
import { VNodeChildElement } from 'snabbdom/src/package/h';
3+
import { WebCellComponent } from '../WebCell';
34

45
export interface WebCellData extends HTMLProps {
56
key?: string | number;
@@ -23,9 +24,7 @@ declare global {
2324
interface ElementChildrenAttribute {
2425
defaultSlot: VNodeChildElement[];
2526
}
26-
interface ElementClass {
27-
render: (props: WebCellProps, state: any) => WebCellElement;
28-
}
27+
interface ElementClass extends WebCellComponent<any, any> {}
2928
}
3029
}
3130

test/renderer.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ describe('Renderer', () => {
4646

4747
it('should render VDOM to Markup', () => {
4848
const source = renderToStaticMarkup(
49-
<Fragment>
49+
<>
5050
<div
5151
className="test"
5252
style={{ color: 'red', opacity: 0.5 }}
@@ -57,7 +57,7 @@ describe('Renderer', () => {
5757
<span>example</span>
5858
</div>
5959
sample
60-
</Fragment>
60+
</>
6161
);
6262

6363
expect(source).toBe(

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"experimentalDecorators": true,
1414
"jsx": "react",
1515
"jsxFactory": "createCell",
16+
"jsxFragmentFactory": "Fragment",
1617
"lib": ["ES2019", "DOM"]
1718
},
1819
"include": ["./source/**/*"],

0 commit comments

Comments
 (0)