Skip to content

Commit

Permalink
feat: rewrite Overlay to WebComponent with LitElement
Browse files Browse the repository at this point in the history
- add storybook for Overlay
- adjust storybook vite config into a split file
- move plugins from dependencies to peerDependencies with mark as optional
  • Loading branch information
zthxxx committed Jul 26, 2023
1 parent 82c6f27 commit 7c2e814
Show file tree
Hide file tree
Showing 70 changed files with 8,488 additions and 7,467 deletions.
71 changes: 60 additions & 11 deletions .commitlintrc.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,68 @@
# Git Commit Message Convention
# - follow: https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md
# - tool: https://commitlint.js.org/#/concepts-commit-conventions
#
# ```
# <type>(<scope?>): <subject>
# <BLANK LINE>
# <body?>
# <BLANK LINE>
# <footer?>
# ```
extends:
- "@commitlint/config-conventional"
# https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional
- '@commitlint/config-conventional'

# # https://commitlint.js.org/#/reference-rules
rules:
# https://commitlint.js.org/#/reference-rules?id=type-enum
type-enum:
- 2
- 2 # error
- always
- - feat
- fix
- polish
- - build
- chore
- ci
- docs
- style
- feat
- fix
- perf
- refactor
- revert
- perf
- style
- test
- workflow
- ci
- build
- chore
- polish
- hotfix

# https://commitlint.js.org/#/reference-rules?id=scope-case
scope-case:
- 2 # error
- always
- - lower-case
- upper-case
- kebab-case
- pascal-case
- start-case

# https://commitlint.js.org/#/reference-rules?id=subject-case
subject-case:
- 1 # warning
- always
- - lower-case
- sentence-case
- start-case

# https://commitlint.js.org/#/reference-rules?id=header-max-length
header-max-length:
- 2 # error
- always
- 120

# https://commitlint.js.org/#/reference-rules?id=footer-leading-blank
footer-leading-blank:
- 2 # error
- always

# https://commitlint.js.org/#/reference-rules?id=body-leading-blank
body-leading-blank:
- 2 # error
- always
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ module.exports = {
* https://github.com/antfu/eslint-config/blob/v0.39.7
*/
extends: [
'@antfu',
'@antfu/react',
],

Expand Down Expand Up @@ -194,6 +193,7 @@ module.exports = {
'TSTypeParameterInstantiation',
'TSIntersectionType',
'TSUnionType',
'PropertyDefinition[decorators]',
// 'ConditionalExpression',
// 'TemplateLiteral *',
// 'JSXElement',
Expand Down
5 changes: 5 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

# https://commitlint.js.org/#/reference-cli
exec npx --no -- commitlint --edit "$1"
4 changes: 3 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
# run by git
. "$(dirname -- "$0")/_/husky.sh"

TIMING=1 npx lint-staged
# https://github.com/lint-staged/lint-staged
# `TIMING` for eslint
TIMING=1 exec npx lint-staged
1 change: 0 additions & 1 deletion docs/components/landing-page/landing-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export const LandingPage = () => {
/>
</Feature>


<Feature
large
id='working-pipeline'
Expand Down
3 changes: 3 additions & 0 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pnpm i
pnpm update -rDL typescript
# it's equal to
pnpm update --recursive --dev --latest typescript
# https://pnpm.io/cli/update
```

Or
Expand Down Expand Up @@ -69,6 +70,8 @@ sync demo code from vite4 to other examples:
./scripts/sync-page-code.sh
```

> **NOTE:** use copied files rather than symlink is design for StackBlitz online demo with pure subpath.

### build examples sites

Expand Down
2 changes: 1 addition & 1 deletion docs/images/compiler-part.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/images/middleware-part.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
"react-dev-inspector": "workspace:*",
"rimraf": "3.0.2",
"tailwindcss": "3.3.3",
"typescript": "5.1.6"
"typescript": "5.3.2"
}
}
15 changes: 14 additions & 1 deletion docs/utils/tw-styled/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,20 @@ type StyledTagCreator = {

interface StyledCreator extends StyledComponentCreator, StyledTagCreator {}


/**
* style-component method for tailwindcss
*
* Note: add this config in VSCode `settings.json` for code hinting
* via [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense):
*
* ```json
* "tailwindCSS.experimental.classRegex": [
* "className: *`([^`]*)`",
* "className: *\"([^\"]*)\"",
* "className: *'([^']*)'",
* ],
* ```
*/
export const twStyled = (
<T, P extends { className?: string }, Tag extends keyof JSX.IntrinsicElements>(
Component: ForwardRefRenderFunction<T, P> | ComponentType<P> | Tag,
Expand Down
8 changes: 4 additions & 4 deletions examples/cra5-with-rewired/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"react-github-corner": "2.5.0"
},
"devDependencies": {
"@react-dev-inspector/babel-plugin": "beta",
"@react-dev-inspector/middleware": "beta",
"@react-dev-inspector/babel-plugin": "^2",
"@react-dev-inspector/middleware": "^2",
"@types/node": "16.18.7",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
Expand All @@ -39,12 +39,12 @@
"postcss": "8.4.26",
"postcss-loader": "7.3.3",
"react-app-rewired": "2.2.1",
"react-dev-inspector": "beta",
"react-dev-inspector": "^2",
"react-scripts": "5.0.1",
"rimraf": "3.0.2",
"style-loader": "3.3.3",
"tailwindcss": "3.3.3",
"typescript": "5.1.6"
"typescript": "5.3.2"
},
"browserslist": {
"production": [
Expand Down
2 changes: 1 addition & 1 deletion examples/cra5-with-rewired/src/ShowPage/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Title = styled.h1({
export const Slogan = styled.p({
displayName: 'Slogan',
className: `
mt-6 leading-8 text-gray-600 text-[min(4.5vw,1.25rem)] leading-[min(6vw,1.75rem)] sm:text-lg
mt-6 text-gray-600 text-[min(4.5vw,1.25rem)] leading-[min(6vw,1.75rem)] sm:text-lg
transition-all duration-200 ease
`,
})
Expand Down
14 changes: 14 additions & 0 deletions examples/cra5-with-rewired/src/ShowPage/tw-styled/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ type StyledTagCreator = {
interface StyledCreator extends StyledComponentCreator, StyledTagCreator {}


/**
* style-component method for tailwindcss
*
* Note: add this config in VSCode `settings.json` for code hinting
* via [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense):
*
* ```json
* "tailwindCSS.experimental.classRegex": [
* "className: *`([^`]*)`",
* "className: *\"([^\"]*)\"",
* "className: *'([^']*)'",
* ],
* ```
*/
export const twStyled = (
<T, P extends { className?: string }, Tag extends keyof JSX.IntrinsicElements>(
Component: ForwardRefRenderFunction<T, P> | ComponentType<P> | Tag,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Title = styled.h1({
export const Slogan = styled.p({
displayName: 'Slogan',
className: `
mt-6 leading-8 text-gray-600 text-[min(4.5vw,1.25rem)] leading-[min(6vw,1.75rem)] sm:text-lg
mt-6 text-gray-600 text-[min(4.5vw,1.25rem)] leading-[min(6vw,1.75rem)] sm:text-lg
transition-all duration-200 ease
`,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ type StyledTagCreator = {
interface StyledCreator extends StyledComponentCreator, StyledTagCreator {}


/**
* style-component method for tailwindcss
*
* Note: add this config in VSCode `settings.json` for code hinting
* via [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense):
*
* ```json
* "tailwindCSS.experimental.classRegex": [
* "className: *`([^`]*)`",
* "className: *\"([^\"]*)\"",
* "className: *'([^']*)'",
* ],
* ```
*/
export const twStyled = (
<T, P extends { className?: string }, Tag extends keyof JSX.IntrinsicElements>(
Component: ForwardRefRenderFunction<T, P> | ComponentType<P> | Tag,
Expand Down
8 changes: 4 additions & 4 deletions examples/nextjs-custom-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"react-github-corner": "2.5.0"
},
"devDependencies": {
"@react-dev-inspector/babel-plugin": "beta",
"@react-dev-inspector/middleware": "beta",
"@react-dev-inspector/babel-plugin": "^2",
"@react-dev-inspector/middleware": "^2",
"@types/node": "16.18.7",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
Expand All @@ -36,10 +36,10 @@
"next": "13.1.0",
"npm-run-all": "4.1.5",
"postcss": "8.4.26",
"react-dev-inspector": "beta",
"react-dev-inspector": "^2",
"rimraf": "3.0.2",
"tailwindcss": "3.3.3",
"typescript": "5.1.6"
"typescript": "5.3.2"
},
"browserslist": {
"production": [
Expand Down
8 changes: 4 additions & 4 deletions examples/rspack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
},
"devDependencies": {
"@babel/preset-typescript": "7.22.5",
"@react-dev-inspector/babel-plugin": "beta",
"@react-dev-inspector/middleware": "beta",
"@react-dev-inspector/babel-plugin": "^2",
"@react-dev-inspector/middleware": "^2",
"@rspack/cli": "0.3.1",
"@types/node": "16.18.7",
"@types/react": "18.0.26",
Expand All @@ -38,11 +38,11 @@
"npm-run-all": "4.1.5",
"postcss": "8.4.26",
"postcss-loader": "7.3.3",
"react-dev-inspector": "beta",
"react-dev-inspector": "^2",
"rimraf": "3.0.2",
"tailwindcss": "3.3.3",
"ts-node": "10.9.1",
"typescript": "5.1.6"
"typescript": "5.3.2"
},
"browserslist": {
"production": [
Expand Down
2 changes: 1 addition & 1 deletion examples/rspack/src/ShowPage/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Title = styled.h1({
export const Slogan = styled.p({
displayName: 'Slogan',
className: `
mt-6 leading-8 text-gray-600 text-[min(4.5vw,1.25rem)] leading-[min(6vw,1.75rem)] sm:text-lg
mt-6 text-gray-600 text-[min(4.5vw,1.25rem)] leading-[min(6vw,1.75rem)] sm:text-lg
transition-all duration-200 ease
`,
})
Expand Down
14 changes: 14 additions & 0 deletions examples/rspack/src/ShowPage/tw-styled/styled.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,20 @@ type StyledTagCreator = {
interface StyledCreator extends StyledComponentCreator, StyledTagCreator {}


/**
* style-component method for tailwindcss
*
* Note: add this config in VSCode `settings.json` for code hinting
* via [Tailwind CSS IntelliSense](https://github.com/tailwindlabs/tailwindcss-intellisense):
*
* ```json
* "tailwindCSS.experimental.classRegex": [
* "className: *`([^`]*)`",
* "className: *\"([^\"]*)\"",
* "className: *'([^']*)'",
* ],
* ```
*/
export const twStyled = (
<T, P extends { className?: string }, Tag extends keyof JSX.IntrinsicElements>(
Component: ForwardRefRenderFunction<T, P> | ComponentType<P> | Tag,
Expand Down
8 changes: 4 additions & 4 deletions examples/umi3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@
"react-github-corner": "2.5.0"
},
"devDependencies": {
"@emotion/babel-plugin": "^11.9.2",
"@react-dev-inspector/umi3-plugin": "beta",
"@emotion/babel-plugin": "^11.11.0",
"@react-dev-inspector/umi3-plugin": "^2",
"@types/node": "16.18.7",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
"@zthxxx/tsconfig": "1.0.2",
"npm-run-all": "4.1.5",
"react-dev-inspector": "beta",
"react-dev-inspector": "^2",
"rimraf": "3.0.2",
"typescript": "5.1.6",
"typescript": "5.3.2",
"umi": "3.5.41"
}
}
8 changes: 4 additions & 4 deletions examples/umi4/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"react-github-corner": "2.5.0"
},
"devDependencies": {
"@react-dev-inspector/umi4-plugin": "beta",
"@swc/core": "^1.3.82",
"@react-dev-inspector/umi4-plugin": "^2",
"@swc/core": "^1.3.99",
"@types/node": "16.18.7",
"@types/react": "18.0.26",
"@types/react-dom": "18.0.9",
Expand All @@ -36,11 +36,11 @@
"autoprefixer": "10.4.14",
"npm-run-all": "4.1.5",
"postcss": "8.4.26",
"react-dev-inspector": "beta",
"react-dev-inspector": "^2",
"rimraf": "3.0.2",
"swc-plugin-auto-css-modules": "^1.5.0",
"tailwindcss": "3.3.3",
"typescript": "5.1.6",
"typescript": "5.3.2",
"umi": "4.0.72"
}
}
2 changes: 1 addition & 1 deletion examples/umi4/src/ShowPage/styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Title = styled.h1({
export const Slogan = styled.p({
displayName: 'Slogan',
className: `
mt-6 leading-8 text-gray-600 text-[min(4.5vw,1.25rem)] leading-[min(6vw,1.75rem)] sm:text-lg
mt-6 text-gray-600 text-[min(4.5vw,1.25rem)] leading-[min(6vw,1.75rem)] sm:text-lg
transition-all duration-200 ease
`,
})
Expand Down
Loading

0 comments on commit 7c2e814

Please sign in to comment.