Skip to content

Commit

Permalink
[optimize] support Async Rendering mode
Browse files Browse the repository at this point in the history
[optimize] update Upstream packages
  • Loading branch information
TechQuery committed Nov 20, 2024
1 parent dcf74cd commit 6d5e309
Show file tree
Hide file tree
Showing 7 changed files with 698 additions and 719 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ jobs:
[[ "$TOPICS" ]] && {
gh api --method PUT "repos/$REPOSITORY/topics" -f "names[]"
gh repo edit "$REPOSITORY" --add-topic "$TOPICS"
} || true
}
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
},
"dependencies": {
"browser-unhandled-rejection": "^1.0.2",
"cell-router": "^3.0.0-rc.8",
"dom-renderer": "^2.4.2",
"cell-router": "^3.0.1",
"dom-renderer": "^2.6.0",
"koajax": "^3.0.3",
"mdui": "^2.1.3",
"mobx": "^6.13.5",
"web-cell": "^3.0.0",
"web-cell": "^3.0.3",
"web-utility": "^4.4.2"
},
"devDependencies": {
"@parcel/config-default": "~2.12.0",
"@parcel/packager-raw-url": "~2.12.0",
"@parcel/transformer-typescript-tsc": "~2.12.0",
"@parcel/transformer-webmanifest": "~2.12.0",
"@parcel/config-default": "~2.13.0",
"@parcel/packager-raw-url": "~2.13.0",
"@parcel/transformer-typescript-tsc": "~2.13.0",
"@parcel/transformer-webmanifest": "~2.13.0",
"@softonus/prettier-plugin-duplicate-remover": "^1.0.1",
"@types/node": "^20.17.6",
"husky": "^9.1.6",
"husky": "^9.1.7",
"lint-staged": "^15.2.10",
"parcel": "~2.12.0",
"postcss": "^8.4.47",
"parcel": "~2.13.0",
"postcss": "^8.4.49",
"prettier": "^3.3.3",
"prettier-plugin-css-order": "^2.1.2",
"typescript": "~5.6.3",
Expand Down
1,371 changes: 670 additions & 701 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DOMRenderer } from 'dom-renderer';
import { configure } from 'mobx';

import { PageBox } from './page';
import { renderMode } from './utility';

auto();

Expand Down Expand Up @@ -34,4 +35,6 @@ serviceWorker?.addEventListener('controllerchange', () =>
window.location.reload()
);

documentReady.then(() => new DOMRenderer().render(<PageBox />));
documentReady.then(() =>
new DOMRenderer().render(<PageBox />, document.body, renderMode)
);
7 changes: 4 additions & 3 deletions src/page/CompanyList.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { WebCell, component, reaction, attribute, observer } from 'web-cell';
import { observable } from 'mobx';
import { WebCell, attribute, component, observer, reaction } from 'web-cell';

import 'mdui/components/button';
import 'mdui/components/card';

import companyStore, { WorkType, Company } from '../model/Company';
import companyStore, { Company, WorkType } from '../model/Company';
import { renderMode } from '../utility';

export interface CompanyListProps {
type: WorkType;
}

export interface CompanyList extends WebCell<CompanyListProps> {}

@component({ tagName: 'company-list' })
@component({ tagName: 'company-list', renderMode })
@observer
export class CompanyList
extends HTMLElement
Expand Down
7 changes: 4 additions & 3 deletions src/page/index.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { attribute, component, observer } from 'web-cell';
import { createRouter } from 'cell-router';
import { observable } from 'mobx';
import { attribute, component, observer } from 'web-cell';

import 'mdui/components/button-icon';
import 'mdui/components/list';
import 'mdui/components/list-item';
import 'mdui/components/navigation-drawer';
import 'mdui/components/top-app-bar';
import 'mdui/components/top-app-bar-title';
import 'mdui/components/navigation-drawer';

import { renderMode } from '../utility';
import { CompanyList } from './CompanyList';

const { Route } = createRouter();

@component({ tagName: 'page-box' })
@component({ tagName: 'page-box', renderMode })
@observer
export class PageBox extends HTMLElement {
@attribute
Expand Down
5 changes: 5 additions & 0 deletions src/utility.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { parseURLData } from 'web-utility';

export const { renderMode = 'sync' } = parseURLData() as {
renderMode?: 'sync';
};

0 comments on commit 6d5e309

Please sign in to comment.