Skip to content

Commit

Permalink
[migrate] move decorators to original modules for Git diff
Browse files Browse the repository at this point in the history
[migrate] move WebField, AsyncBox & utilities to Legacy folder for now
[remove] Renderer module
  • Loading branch information
TechQuery committed Jan 5, 2024
1 parent ed4d2f4 commit 2e06a56
Show file tree
Hide file tree
Showing 14 changed files with 266 additions and 704 deletions.
5 changes: 3 additions & 2 deletions Migrating.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
-interface State {
+class State {
+ @observable
key: string;
- key: string;
+ accessor key = '';
}

@component({
Expand Down Expand Up @@ -56,7 +57,7 @@ At the same time, `shouldUpdate() {}` life-cycle has been dropped. You just need
MobX's [`@observable`][4] & [`reaction()`][5] are awesome APIs to implement these above with clear codes, so we add `mobx` package as a dependency:

```shell
npm install mobx@5
npm install mobx
```

On the other hand, [`mobx-web-cell` adapter][6] has been merged into the core package. And cause of replacing **Prototype Overwrite** with **Class Inheritance** to refactor **Class Mixins**, `@observer` decorator should follow strict order to make observation work:
Expand Down
4 changes: 2 additions & 2 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export interface TestTagProps extends WebCellProps {

class State {
@observable
status = '';
accessor status = '';
}

@component({
Expand All @@ -148,7 +148,7 @@ export class TestTag extends HTMLElement {

@attribute
@observable
topic = 'Test';
accessor topic = 'Test';

state = new State();

Expand Down
4 changes: 2 additions & 2 deletions source/Async.tsx → legacy/Async.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { observable } from 'mobx';

import { ComponentTag, WebCellProps, FunctionComponent } from './utility';
import { WebCellClass, WebCell } from './WebCell';
import { component, observer, reaction } from './decorator';
import { WebCellClass, WebCell } from '../source/WebCell';
import { component, observer, reaction } from '../source/decorator';
import { createCell } from './renderer';

export interface AsyncBoxProps extends WebCellProps {
Expand Down
4 changes: 2 additions & 2 deletions source/WebField.ts → legacy/WebField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
CustomFormElementClass
} from 'web-utility';

import { WebCell, WebCellComponent } from './WebCell';
import { attribute, reaction } from './decorator';
import { WebCell, WebCellComponent } from '../source/WebCell';
import { attribute, reaction } from '../source/decorator';
import { WebCellProps } from './utility';

export type WebFieldProps<T extends HTMLElement = HTMLInputElement> =
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions source/utility/vDOM.ts → legacy/utility/vDOM.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { HTMLProps, SVGProps } from 'web-utility';
import { Key, VNode, JsxVNodeChildren, Fragment } from 'snabbdom';

import { ComponentMeta } from '../decorator';
import { WebCellClass, WebCellComponent } from '../WebCell';
import { ComponentMeta } from '../../source/decorator';
import { WebCellClass, WebCellComponent } from '../../source/WebCell';

interface VDOMExtra<T extends Element> {
key?: Key;
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "web-cell",
"version": "3.0.0-rc.1",
"version": "3.0.0-rc.2",
"description": "Web Components engine based on VDOM, JSX, MobX & TypeScript",
"keywords": [
"web",
Expand All @@ -27,7 +27,7 @@
"types": "dist/index.d.ts",
"dependencies": {
"@swc/helpers": "^0.5.3",
"dom-renderer": "^2.0.1",
"dom-renderer": "^2.0.2",
"mobx": ">=6.11",
"regenerator-runtime": "^0.14.1",
"web-utility": "^4.1.3"
Expand All @@ -54,7 +54,7 @@
"husky": "^8.0.3",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^23.0.1",
"jsdom": "^23.1.0",
"lint-staged": "^15.2.0",
"open-cli": "^8.0.0",
"parcel": "~2.11.0",
Expand All @@ -73,7 +73,7 @@
"pack-preview": "cd preview/ && rimraf ../.parcel-cache dist/ && parcel build --public-url=. --dist-dir=../docs/preview/",
"pack-dist": "parcel build source/index.ts",
"pack-docs": "rimraf docs/ && typedoc source/",
"build": "rimraf dist/ && npm run pack-dist && npm run pack-preview",
"build": "rimraf dist/ && npm run pack-dist && npm run pack-docs && npm run pack-preview",
"start": "npm run pack-docs && open-cli docs/index.html",
"prepublishOnly": "npm test && npm run build"
},
Expand Down
24 changes: 12 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

1 comment on commit 2e06a56

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for web-cell ready!

✅ Preview
https://web-cell-kor72asl5-techquery.vercel.app

Built with commit 2e06a56.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.