From 3e5fbab9137b422187e4c697f642674f5720f6a1 Mon Sep 17 00:00:00 2001 From: mym0404 Date: Sun, 17 Mar 2024 14:41:43 +0900 Subject: [PATCH 01/17] chore: remove legacy release script --- package.json | 3 +-- tool/publish.mjs | 20 -------------------- 2 files changed, 1 insertion(+), 22 deletions(-) delete mode 100644 tool/publish.mjs diff --git a/package.json b/package.json index 073ed4d8..23906d1c 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "react-native-themed-styled-system", + "name": "react-native-styled-system", "version": "0.0.30", "description": "React Native Styled System", "main": "lib/commonjs/index.js", @@ -11,7 +11,6 @@ "check:type": "yarn tsc --noEmit", "test": "jest", "test:coverage": "jest --coverage", - "release": "zx tool/publish.mjs", "build": "yarn t && bob build", "gen": "zx bin/theme-gen.mjs bin/theme.ts --output bin/ret.d.ts", "prepare": "husky" diff --git a/tool/publish.mjs b/tool/publish.mjs deleted file mode 100644 index f82fb746..00000000 --- a/tool/publish.mjs +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env zx - -const pkg = JSON.parse(await fs.readFile('package.json', 'utf-8')); - -cd('doc'); -await $`yarn && yarn deploy`; -cd('..'); - -// eslint-disable-next-line prefer-const -let [a, b, c] = pkg.version.split('.'); -c = Number(c) + 1 + ''; -pkg.version = `${a}.${b}.${c}`; -await fs.writeFile('package.json', JSON.stringify(pkg, null, 2)); - -const v = pkg.version; - -await $`yarn build`; -await $`git add . && git commit -m "Release ${v}"`; -await $`npm publish --access public`; -await $`git push`; From eb019066f2afecca463ad90668247e2a53542b6f Mon Sep 17 00:00:00 2001 From: mym0404 Date: Sun, 17 Mar 2024 21:54:46 +0900 Subject: [PATCH 02/17] chore: change favicon of doc --- doc/static/img/favicon.ico | Bin 4286 -> 9662 bytes doc/static/img/logo.svg | 2 +- doc/static/img/logo48.png | Bin 0 -> 1307 bytes package.json | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 doc/static/img/logo48.png diff --git a/doc/static/img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^FI#emul-%^a~kVe24 zg=K6SGr}ASv`4mzOreC;O%d6O|3aw(J{|~4Imz;&r4|()8nx)6{eofOdn{1*Phy}) zzyQ%hM{86z-B}Ovt>7P zKF~VZN{g~L>uXeXez-#CD1+J4uKiTEt(`}_S?ne;JVP!Sd2JD^$j0>yKOa`IUd8Jv7&693_V!LfSy3gv< zL1h4M(|)m^dh@t)2@B!Y^;V>_9GfTEOv~oF2MsnSd}~~jYIU_=u)g`L5CyyUup^!+ z;?Q6WFLvMe1Xz!od3G8`Kv+3#*Uh{n`7mes#f;#1VB& g>fM(u39uRJQAUCGZKlN}0Rs(22><{9 diff --git a/doc/static/img/logo.svg b/doc/static/img/logo.svg index 03e40fc4..9bb0a50a 100644 --- a/doc/static/img/logo.svg +++ b/doc/static/img/logo.svg @@ -1,4 +1,4 @@ - + diff --git a/doc/static/img/logo48.png b/doc/static/img/logo48.png new file mode 100644 index 0000000000000000000000000000000000000000..1285d85af12911f94ca6502abaf7a33468a69035 GIT binary patch literal 1307 zcmV+$1?2jPP)+K($m%Wt&k4D@S{HPa2-`IH=roYjK6uIpA;mSiQ;Ga zrm+3n8CB%@Ss^ONt%{brP;By)GJeM-PTb;F?R&=4^EcQ}hBx1XM;S1TKD7)9ha-nj z=BsvmOg4zK4%yJxc{Y?&Y{7XN3(g<9hEM&~j|;$z6~OS&i_e1zUnt`a;K9!dkuW1f z0qc42S(V=L@C*737#{5C7!0B;u%T?Qq8zZ`6EJ}Df#G2(z6W1q0g8J0A5bXrf;9MI z_!)mc{T~E)?YKmExQfeei=xQ4`Q0ccLn1tMVI`Q#%b(;75W80@d?!Zi!Y^|L@U+cx z_%U=KsQ3;{p@UTJ;`<**`Nn3c@J3t(dZgaV6<`9t`K(lU16D&jsY~MuFh*q&QsMQa z4)nBM&J|!-nfjwb`6s~T_;vpS{iLCs(zJs+#JG@hW(j_37=MyFR(d4djxtXM34f>OSykG^ zDsj`@HL9bglqS+|Ya|1X#_Ikj{0cFO4{p6K$d3*SAE!Ar^7V_qx1%qUgNO%_v_cEf z|K5y^rOo83LPvXgn}``09vX-Zw8;Jn*I&nuvND2&00DZK`E?V{bqf2td9E|e*?RVk?aU` R|G)qM002ovPDHLkV1n3kfj0mE literal 0 HcmV?d00001 diff --git a/package.json b/package.json index 23906d1c..050ffd53 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "react-native-styled-system", + "name": "react-native-themed-styled-system", "version": "0.0.30", "description": "React Native Styled System", "main": "lib/commonjs/index.js", From 934d0a3d5cea9078179eb3c5fc18dde7741961f1 Mon Sep 17 00:00:00 2001 From: Jimin <60884877+zmin9@users.noreply.github.com> Date: Mon, 18 Mar 2024 10:25:37 +0900 Subject: [PATCH 03/17] Update global-theme-value.mdx --- doc/docs/advanced/global-theme-value.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/docs/advanced/global-theme-value.mdx b/doc/docs/advanced/global-theme-value.mdx index 11797110..1843fb9c 100644 --- a/doc/docs/advanced/global-theme-value.mdx +++ b/doc/docs/advanced/global-theme-value.mdx @@ -58,7 +58,7 @@ export const StyledSystemAppThemeProvider = ({ children }: PropsWithChildren<{}> //highlight-start useEffect(() => { - globalTheme = theme; + _globalTheme = theme; }, [theme]); //highlight-end From 19fa6fa4799661068499f774fd98e203eda29b8b Mon Sep 17 00:00:00 2001 From: mym0404 Date: Mon, 18 Mar 2024 11:00:18 +0900 Subject: [PATCH 04/17] chore(doc): add google search console site verification html in doc website --- doc/static/google1412e6e86cbe747b.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/static/google1412e6e86cbe747b.html diff --git a/doc/static/google1412e6e86cbe747b.html b/doc/static/google1412e6e86cbe747b.html new file mode 100644 index 00000000..01dde3a2 --- /dev/null +++ b/doc/static/google1412e6e86cbe747b.html @@ -0,0 +1 @@ +google-site-verification: google1412e6e86cbe747b.html \ No newline at end of file From d9c94e4104de88d5d780c5627a6f4a57a53eebca Mon Sep 17 00:00:00 2001 From: zmin9 Date: Mon, 18 Mar 2024 10:31:20 +0900 Subject: [PATCH 05/17] feat(typing): support raw color --- bin/ret.d.ts | 4 ++-- bin/theme-gen.mjs | 7 ++++++- src/hook/useSx.test.ts | 6 ++++++ src/util/propsToThemedStyle.ts | 6 +++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/ret.d.ts b/bin/ret.d.ts index 5acec92a..400388a2 100644 --- a/bin/ret.d.ts +++ b/bin/ret.d.ts @@ -1,6 +1,6 @@ -import type { RadiiValue, SizesValue, SpaceValue } from './Token'; +import type { ColorsValue, RadiiValue, SizesValue, SpaceValue } from './Token'; export interface ThemedTypings { @@ -8,7 +8,7 @@ export interface ThemedTypings { -colors: "white" | "black" | "transparent" | "gray50" | "gray100" | "gray200" | "gray300" | "gray400" | "gray500" | "gray600" | "gray700" | "gray800" | "gray900" | "violet50" | "violet100" | "violet200" | "violet300" | "violet400" | "violet500" | "violet600" | "violet700" | "violet800" | "violet900" | "green50" | "green100" | "green200" | "green300" | "green400" | "green500" | "green600" | "yellow50" | "yellow100" | "yellow200" | "yellow300" | "yellow400" | "yellow500" | "yellow600" | "red50" | "red100" | "red200" | "red300" | "red400" | "red500" | "red600" | "blue50" | "blue100" | "blue200" | "blue300" | "blue400" | "blue500" | "blue600" | "blue700" | "blue800" | "blue900" +colors: ColorsValue | "white" | "black" | "transparent" | "gray50" | "gray100" | "gray200" | "gray300" | "gray400" | "gray500" | "gray600" | "gray700" | "gray800" | "gray900" | "violet50" | "violet100" | "violet200" | "violet300" | "violet400" | "violet500" | "violet600" | "violet700" | "violet800" | "violet900" | "green50" | "green100" | "green200" | "green300" | "green400" | "green500" | "green600" | "yellow50" | "yellow100" | "yellow200" | "yellow300" | "yellow400" | "yellow500" | "yellow600" | "red50" | "red100" | "red200" | "red300" | "red400" | "red500" | "red600" | "blue50" | "blue100" | "blue200" | "blue300" | "blue400" | "blue500" | "blue600" | "blue700" | "blue800" | "blue900" diff --git a/bin/theme-gen.mjs b/bin/theme-gen.mjs index ee0c3d4d..45ca5758 100755 --- a/bin/theme-gen.mjs +++ b/bin/theme-gen.mjs @@ -147,7 +147,7 @@ try { let result = read(tmpFile); result = result.replace( /import.*/, - "import type { RadiiValue, SizesValue, SpaceValue } from './Token';\n", + "import type { ColorsValue, RadiiValue, SizesValue, SpaceValue } from './Token';\n", ); result = result.replace(/export.*/, 'export interface ThemedTypings {'); result = result.replace(/\/\/.*/g, ''); @@ -185,6 +185,11 @@ try { 'radii:', 'radii: RadiiValue | `${number}` | `${number}px` | `${any}px` | ', ); + + result = result.replace( + 'colors:', + 'colors: ColorsValue | ', + ); result = result.replace(/\|[\s ]*\n/g, ';'); diff --git a/src/hook/useSx.test.ts b/src/hook/useSx.test.ts index ddbf6f03..bfb8b2fd 100644 --- a/src/hook/useSx.test.ts +++ b/src/hook/useSx.test.ts @@ -51,6 +51,7 @@ describe('simple usages', () => { it('color', () => { expectResult(baseTheme, { bg: 'red' }, { backgroundColor: 'red' }); + expectResult(baseTheme, { bg: '#ffffff' }, { backgroundColor: '#ffffff' }); }); }); @@ -140,6 +141,11 @@ describe('sizes parsing', () => { describe('shortcut priority', () => { it('bg', () => { expectResult(baseTheme, { bg: 'red', backgroundColor: 'blue' }, { backgroundColor: 'blue' }); + expectResult( + baseTheme, + { bg: 'red', backgroundColor: '#ffffff' }, + { backgroundColor: '#ffffff' }, + ); }); it('w', () => { diff --git a/src/util/propsToThemedStyle.ts b/src/util/propsToThemedStyle.ts index 41817f30..972439bb 100644 --- a/src/util/propsToThemedStyle.ts +++ b/src/util/propsToThemedStyle.ts @@ -35,7 +35,11 @@ export const propsToThemedStyle = ({ return; } - return theme.colors[token]; + if (token in theme.colors) { + return theme.colors[token]; + } else { + return token; + } }; /** From 2d3b609a0a8574ea72f9ec9b6c79b5093bbfbd85 Mon Sep 17 00:00:00 2001 From: mym0404 Date: Mon, 18 Mar 2024 14:15:47 +0900 Subject: [PATCH 06/17] chore: add pull request template --- .github/PULL_REQUEST_TEMPLATE.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/PULL_REQUEST_TEMPLATE.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..d0050b6d --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,19 @@ +Thank you for contributing `react-native-themed-styled-system` package πŸ€— + +## Type of change + +Please delete options that are not relevant. + +- [ ] Release (merge into main branch) +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) +- [ ] This change requires a documentation update +- +## What does this change? + +Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. + +Fixes # 🎯 + +Please delete section if it is not a PR changes feature. \ No newline at end of file From 15c69f7fe115a6f81c4b0563c27a2f903b5f582e Mon Sep 17 00:00:00 2001 From: mym0404 Date: Mon, 18 Mar 2024 14:16:59 +0900 Subject: [PATCH 07/17] chore: add codeowners --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 00000000..57c3e7d8 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @mym0404 @zmin9 \ No newline at end of file From 372223aaffcabdf7b25f0a71912b47634845c3dd Mon Sep 17 00:00:00 2001 From: MJ Studio Date: Mon, 18 Mar 2024 14:21:25 +0900 Subject: [PATCH 08/17] chore: create bug_report.yaml --- .github/ISSUE_TEMPLATE/bug_report.yaml | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yaml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 00000000..f0d03958 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,53 @@ +name: Bug Report +description: File a bug report +title: '[BUG]: ' +labels: ['bug'] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + - type: input + id: version + attributes: + label: Version + description: What version of our software are you running? ($ fluttergen -v) + placeholder: ex. 5.0.0 + validations: + required: false + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what you see! + value: 'A bug happened!' + validations: + required: true + - type: textarea + id: pubspec + attributes: + label: Relevant a package.json. + description: Please copy and pates your package.json. + render: json + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output, if any. + render: shell + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](../../CODE_OF_CONDUCT.md) + options: + - label: I agree to follow this project's Code of Conduct + required: true From 7866f74d8dbe5fddc2092cb100ee5e290827cfa2 Mon Sep 17 00:00:00 2001 From: MJ Studio Date: Mon, 18 Mar 2024 14:21:52 +0900 Subject: [PATCH 09/17] chore: create feature_request.yaml --- .github/ISSUE_TEMPLATE/feature_request.yaml | 87 +++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yaml diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 00000000..432f3548 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,87 @@ +name: Bug Report +description: File a bug report +title: '[BUG]: ' +labels: ['bug'] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: checkboxes + attributes: + label: Is there an existing issue for this? + description: Please search to see if an issue already exists for the bug you encountered. + options: + - label: I have searched the existing issues + required: true + - type: input + id: version + attributes: + label: Version + description: What version of our software are you running? ($ fluttergen -v) + placeholder: ex. 5.0.0 + validations: + required: false + - type: dropdown + id: command-type + attributes: + label: Command type + description: What type of our software are you running? + options: + - build_runner (Default) + - Dart command + - Homebrew + validations: + required: true + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + placeholder: Tell us what you see! + value: 'A bug happened!' + validations: + required: true + - type: textarea + id: pubspec + attributes: + label: Relevant a pubspec.yaml. + description: Please copy and pates your pubspec.yaml. + placeholder: | + name: app + + flutter_gen: + output: lib/gen/ + line_length: 80 + + integrations: + flutter_svg: true + + assets: + enabled: true + outputs: + class_name: MyAssets + + fonts: + enabled: true + outputs: + class_name: MyFonts + + flutter: + assets: + - assets/images + render: yaml + - type: textarea + id: logs + attributes: + label: Relevant log output + description: Please copy and paste any relevant log output, if any. + render: shell + - type: checkboxes + id: terms + attributes: + label: Code of Conduct + description: By submitting this issue, you agree to follow our [Code of Conduct](../../CODE_OF_CONDUCT.md) + options: + - label: I agree to follow this project's Code of Conduct + required: true From 54548b04d93625f2f1554077b59fd79e318e8bc9 Mon Sep 17 00:00:00 2001 From: mym0404 Date: Mon, 18 Mar 2024 14:22:31 +0900 Subject: [PATCH 10/17] chore: remove issue_Template --- issue_template.md | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 issue_template.md diff --git a/issue_template.md b/issue_template.md deleted file mode 100644 index 4d905d22..00000000 --- a/issue_template.md +++ /dev/null @@ -1,13 +0,0 @@ -### Version of react-native-themed-styled-system - -### Version of react-native - -### Platforms you faced the error (IOS or Android or both?) - -### Expected behavior - -### Actual behavior - -### Tested environment (Emulator? Real Device?) - -### Steps to reproduce the behavior From f6148f8c010827176c7b5ac64a829d928a536c61 Mon Sep 17 00:00:00 2001 From: mym0404 Date: Mon, 18 Mar 2024 14:23:20 +0900 Subject: [PATCH 11/17] chore: change issue template file extension --- .github/ISSUE_TEMPLATE/{bug_report.yaml => bug_report.yml} | 0 .../ISSUE_TEMPLATE/{feature_request.yaml => feature_request.yml} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename .github/ISSUE_TEMPLATE/{bug_report.yaml => bug_report.yml} (100%) rename .github/ISSUE_TEMPLATE/{feature_request.yaml => feature_request.yml} (100%) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yml similarity index 100% rename from .github/ISSUE_TEMPLATE/bug_report.yaml rename to .github/ISSUE_TEMPLATE/bug_report.yml diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yml similarity index 100% rename from .github/ISSUE_TEMPLATE/feature_request.yaml rename to .github/ISSUE_TEMPLATE/feature_request.yml From ff8d3898010148aff001b4aa6dec75a5fe8cc2f5 Mon Sep 17 00:00:00 2001 From: MJ Studio Date: Mon, 18 Mar 2024 14:27:08 +0900 Subject: [PATCH 12/17] chore: update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 38 ++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..dd84ea78 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. From 5b7105378147f2620c4a366dd8ac55b0f5eaf071 Mon Sep 17 00:00:00 2001 From: MJ Studio Date: Mon, 18 Mar 2024 14:28:30 +0900 Subject: [PATCH 13/17] chore: update issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 38 ----------------------- .github/ISSUE_TEMPLATE/custom.md | 10 ++++++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++++++++++++ 3 files changed, 30 insertions(+), 38 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/custom.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index dd84ea78..00000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: '' - ---- - -**Describe the bug** -A clear and concise description of what the bug is. - -**To Reproduce** -Steps to reproduce the behavior: -1. Go to '...' -2. Click on '....' -3. Scroll down to '....' -4. See error - -**Expected behavior** -A clear and concise description of what you expected to happen. - -**Screenshots** -If applicable, add screenshots to help explain your problem. - -**Desktop (please complete the following information):** - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] - -**Smartphone (please complete the following information):** - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - - Browser [e.g. stock browser, safari] - - Version [e.g. 22] - -**Additional context** -Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md new file mode 100644 index 00000000..48d5f81f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -0,0 +1,10 @@ +--- +name: Custom issue template +about: Describe this issue template's purpose here. +title: '' +labels: '' +assignees: '' + +--- + + diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..bbcbbe7d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. From 603130872b5d8f9699cda777161ce5e4fb9639b4 Mon Sep 17 00:00:00 2001 From: MJ Studio Date: Mon, 18 Mar 2024 14:28:51 +0900 Subject: [PATCH 14/17] chore: update issue templates --- .github/ISSUE_TEMPLATE/custom.md | 10 ---------- .github/ISSUE_TEMPLATE/feature_request.md | 20 -------------------- 2 files changed, 30 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/custom.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md deleted file mode 100644 index 48d5f81f..00000000 --- a/.github/ISSUE_TEMPLATE/custom.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -name: Custom issue template -about: Describe this issue template's purpose here. -title: '' -labels: '' -assignees: '' - ---- - - diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index bbcbbe7d..00000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here. From 192066517f68e7e32d84cd0dc790721711b68d55 Mon Sep 17 00:00:00 2001 From: mym0404 Date: Mon, 18 Mar 2024 14:33:34 +0900 Subject: [PATCH 15/17] chore: update issue form --- .github/ISSUE_TEMPLATE/bug_report.yml | 2 +- .github/ISSUE_TEMPLATE/feature_request.yml | 79 ++++++---------------- 2 files changed, 20 insertions(+), 61 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index f0d03958..ce0485c5 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -18,7 +18,7 @@ body: id: version attributes: label: Version - description: What version of our software are you running? ($ fluttergen -v) + description: What version of our software are you running? placeholder: ex. 5.0.0 validations: required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index 432f3548..4bfd08cb 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,82 +1,41 @@ -name: Bug Report -description: File a bug report -title: '[BUG]: ' -labels: ['bug'] +name: Feature Request +description: File a feature request +title: '[FR]: ' +labels: [ 'enhancement' ] body: - type: markdown attributes: value: | - Thanks for taking the time to fill out this bug report! + Thanks for taking the time to fill out this feature request! - type: checkboxes attributes: label: Is there an existing issue for this? - description: Please search to see if an issue already exists for the bug you encountered. + description: Please search to see if an issue already exists for this feature request. options: - label: I have searched the existing issues required: true - - type: input - id: version - attributes: - label: Version - description: What version of our software are you running? ($ fluttergen -v) - placeholder: ex. 5.0.0 - validations: - required: false - - type: dropdown - id: command-type + - type: textarea + id: describe-problem attributes: - label: Command type - description: What type of our software are you running? - options: - - build_runner (Default) - - Dart command - - Homebrew + label: Describe the problem + description: Is your feature request related to a problem? Please describe. + placeholder: I'm always frustrated when... validations: required: true - type: textarea - id: what-happened + id: solution attributes: - label: What happened? - description: Also tell us, what did you expect to happen? - placeholder: Tell us what you see! - value: 'A bug happened!' + label: Describe the solution + description: Please describe the solution you'd like. A clear and concise description of what you want to happen. validations: required: true - type: textarea - id: pubspec + id: context attributes: - label: Relevant a pubspec.yaml. - description: Please copy and pates your pubspec.yaml. - placeholder: | - name: app - - flutter_gen: - output: lib/gen/ - line_length: 80 - - integrations: - flutter_svg: true - - assets: - enabled: true - outputs: - class_name: MyAssets - - fonts: - enabled: true - outputs: - class_name: MyFonts - - flutter: - assets: - - assets/images - render: yaml - - type: textarea - id: logs - attributes: - label: Relevant log output - description: Please copy and paste any relevant log output, if any. - render: shell + label: Additional context + description: Add any other context or screenshots about the feature request here. + validations: + required: false - type: checkboxes id: terms attributes: From 68a4d3203b3da3d9990f5d74ea33fca0ae9f8d54 Mon Sep 17 00:00:00 2001 From: mym0404 Date: Tue, 19 Mar 2024 12:05:28 +0900 Subject: [PATCH 16/17] feat: remove t,r,b,l shortcut props this props are not standard in styled-system. Also, it is too short to be overwritten or make a confusion. --- doc/docs/usage/sx-props.mdx | 12 ++++-------- src/@types/SxProps.ts | 8 -------- src/util/propsToThemedStyle.ts | 16 ++++------------ 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/doc/docs/usage/sx-props.mdx b/doc/docs/usage/sx-props.mdx index 8a716509..f9ff376a 100644 --- a/doc/docs/usage/sx-props.mdx +++ b/doc/docs/usage/sx-props.mdx @@ -50,14 +50,10 @@ px: Token<'space'>; // paddingX paddingY: Token<'space'>; py: Token<'space'>; // paddingY top: Token<'space'>; -t: Token<'space'>; // top -right: Token<'space'>; -r: Token<'space'>; // right -bottom: Token<'space'>; -b: Token<'space'>; // bottom -left: Token<'space'>; -l: Token<'space'>; // left -gap: Token<'space'>; // only works if parsed result is number +right: Token<'space'>; +bottom: Token<'space'>; +left: Token<'space'>; +gap: Token<'space'>; // only works if parsed result is number gapX: Token<'space'>; // only works if parsed result is number gapY: Token<'space'>; // only works if parsed result is number ``` diff --git a/src/@types/SxProps.ts b/src/@types/SxProps.ts index 11b85603..2fbdb0a7 100644 --- a/src/@types/SxProps.ts +++ b/src/@types/SxProps.ts @@ -40,13 +40,9 @@ export const _allPropList = [ 'paddingY', 'py', 'top', - 't', 'right', - 'r', 'bottom', - 'b', 'left', - 'l', 'gap', 'gapX', 'gapY', @@ -131,13 +127,9 @@ type ThemedSpaceTokenProps = { paddingY: Token<'space'>; py: Token<'space'>; // paddingY top: Token<'space'>; - t: Token<'space'>; // top right: Token<'space'>; - r: Token<'space'>; // right bottom: Token<'space'>; - b: Token<'space'>; // bottom left: Token<'space'>; - l: Token<'space'>; // left gap: Token<'space'>; // only works if parsed result is number gapX: Token<'space'>; // only works if parsed result is number gapY: Token<'space'>; // only works if parsed result is number diff --git a/src/util/propsToThemedStyle.ts b/src/util/propsToThemedStyle.ts index 972439bb..b1d88586 100644 --- a/src/util/propsToThemedStyle.ts +++ b/src/util/propsToThemedStyle.ts @@ -215,26 +215,18 @@ export const propsToThemedStyle = ({ fillViewStyleIfNotNullish(ret, 'paddingVertical', parseSpace(sx.paddingY ?? sx.py)); fillViewStyleIfNotNullish(ret, 'paddingHorizontal', parseSpace(sx.paddingX ?? sx.px)); - fillViewStyleIfNotNullish( - ret, - 'top', - parseSpace(sx.top ?? sx.t ?? (sx.absoluteFill ? 0 : undefined)), - ); + fillViewStyleIfNotNullish(ret, 'top', parseSpace(sx.top ?? (sx.absoluteFill ? 0 : undefined))); fillViewStyleIfNotNullish( ret, 'right', - parseSpace(sx.right ?? sx.r ?? (sx.absoluteFill ? 0 : undefined)), + parseSpace(sx.right ?? (sx.absoluteFill ? 0 : undefined)), ); fillViewStyleIfNotNullish( ret, 'bottom', - parseSpace(sx.bottom ?? sx.b ?? (sx.absoluteFill ? 0 : undefined)), - ); - fillViewStyleIfNotNullish( - ret, - 'left', - parseSpace(sx.left ?? sx.l ?? (sx.absoluteFill ? 0 : undefined)), + parseSpace(sx.bottom ?? (sx.absoluteFill ? 0 : undefined)), ); + fillViewStyleIfNotNullish(ret, 'left', parseSpace(sx.left ?? (sx.absoluteFill ? 0 : undefined))); // endregion From 1eb6c9a780357b81bb5293e1d8bbb07697b26eec Mon Sep 17 00:00:00 2001 From: mym0404 Date: Tue, 19 Mar 2024 12:51:29 +0900 Subject: [PATCH 17/17] feat: change priority of style parsing. `style` should has first priority --- doc/docs/usage/style-parsing.mdx | 8 ++-- .../current/usage/style-parsing.mdx | 8 ++-- src/hook/useSx.test.ts | 4 +- src/hook/useSx.ts | 40 ++++++++++++------- src/util/propsToThemedStyle.ts | 9 ++--- 5 files changed, 38 insertions(+), 31 deletions(-) diff --git a/doc/docs/usage/style-parsing.mdx b/doc/docs/usage/style-parsing.mdx index 4f5b3f37..ffa70eb1 100644 --- a/doc/docs/usage/style-parsing.mdx +++ b/doc/docs/usage/style-parsing.mdx @@ -22,9 +22,9 @@ const props = { 3. Styles inside the `sx` prop of Props 4. First argument of `viewStyle(sx?: SxProps)` -**The priority is calculated as 3 > 2 > 4 > 1.** +**The priority is calculated as 1 > 3 > 2 > 4.** -3 has the highest priority. +1 has the highest priority.
Test code for the prove @@ -38,8 +38,8 @@ describe('style parse priority', () => { expectResult(emptyTheme, { w: 1, viewStyleSx: { w: 2 } }, { width: 1 }); }); - it('viewStyle parameter > style prop property', () => { - expectResult(emptyTheme, { style: { width: 1 }, viewStyleSx: { w: 2 } }, { width: 2 }); + it('style prop property > viewStyle parameter', () => { + expectResult(emptyTheme, { style: { width: 1 }, viewStyleSx: { w: 2 } }, { width: 1 }); }); }); ``` diff --git a/doc/i18n/ko/docusaurus-plugin-content-docs/current/usage/style-parsing.mdx b/doc/i18n/ko/docusaurus-plugin-content-docs/current/usage/style-parsing.mdx index 6ca0dcb7..f3c1d6e7 100644 --- a/doc/i18n/ko/docusaurus-plugin-content-docs/current/usage/style-parsing.mdx +++ b/doc/i18n/ko/docusaurus-plugin-content-docs/current/usage/style-parsing.mdx @@ -22,9 +22,9 @@ const props = { 3. Props의 `sx` prop λ‚΄λΆ€μ˜ μŠ€νƒ€μΌλ“€ 4. `viewStyle(sx?: SxProps)`의 첫 인자 -**이에 λ”°λ₯Έ μš°μ„ μˆœμœ„λŠ” 3 > 2 > 4 > 1 둜 κ³„μ‚°λ©λ‹ˆλ‹€.** +**이에 λ”°λ₯Έ μš°μ„ μˆœμœ„λŠ” 1 > 3 > 2 > 4 > 둜 κ³„μ‚°λ©λ‹ˆλ‹€.** -3이 κ°€μž₯ μš°μ„ μˆœμœ„κ°€ λ†’μŠ΅λ‹ˆλ‹€. +1이 κ°€μž₯ μš°μ„ μˆœμœ„κ°€ λ†’μŠ΅λ‹ˆλ‹€.
이λ₯Ό λ³΄μ—¬μ£ΌλŠ” ν…ŒμŠ€νŠΈ μ½”λ“œ @@ -38,8 +38,8 @@ describe('style parse priority', () => { expectResult(emptyTheme, { w: 1, viewStyleSx: { w: 2 } }, { width: 1 }); }); - it('viewStyle parameter > style prop property', () => { - expectResult(emptyTheme, { style: { width: 1 }, viewStyleSx: { w: 2 } }, { width: 2 }); + it('style prop property > viewStyle parameter', () => { + expectResult(emptyTheme, { style: { width: 1 }, viewStyleSx: { w: 2 } }, { width: 1 }); }); }); ``` diff --git a/src/hook/useSx.test.ts b/src/hook/useSx.test.ts index bfb8b2fd..efb521ba 100644 --- a/src/hook/useSx.test.ts +++ b/src/hook/useSx.test.ts @@ -166,8 +166,8 @@ describe('style parse priority', () => { expectResult(emptyTheme, { w: 1, viewStyleSx: { w: 2 } }, { width: 1 }); }); - it('viewStyle parameter > style prop property', () => { - expectResult(emptyTheme, { style: { width: 1 }, viewStyleSx: { w: 2 } }, { width: 2 }); + it('style prop property > viewStyle parameter', () => { + expectResult(emptyTheme, { style: { width: 1 }, viewStyleSx: { w: 2 } }, { width: 1 }); }); }); diff --git a/src/hook/useSx.ts b/src/hook/useSx.ts index 35e2802b..d13cb57e 100644 --- a/src/hook/useSx.ts +++ b/src/hook/useSx.ts @@ -1,5 +1,6 @@ import { useContext, useMemo } from 'react'; import type { StyleProp, ViewStyle } from 'react-native'; +import { StyleSheet } from 'react-native'; import type { SxProps } from '../@types/SxProps'; import { _allPropList } from '../@types/SxProps'; @@ -19,21 +20,30 @@ export const useSx =

( ) => { const styledSystemContext = useContext(StyledSystemContext); - const viewStyle = useStableCallback((sx?: SxProps): StyleProp | undefined => { - const skip = !props && !sx; - - if (skip) { - return; - } - - const mergedSx: SxProps = { ...sx, ...props, ...props?.sx }; - - return propsToThemedStyle({ - theme: optionTheme ?? styledSystemContext?.theme, - sx: mergedSx, - baseStyle: props?.style, - }); - }); + const viewStyle = useStableCallback( + (sx?: Omit): StyleProp | undefined => { + const skip = !props && !sx; + + if (skip) { + return; + } + + const mergedSx: SxProps = { ...sx, ...props, ...props?.sx }; + + const ret = propsToThemedStyle({ + theme: optionTheme ?? styledSystemContext?.theme, + sx: mergedSx, + }); + + if (!ret) { + return props?.style; + } else if (props?.style) { + return StyleSheet.compose(ret, props.style); + } else { + return ret; + } + }, + ); const filteredProps: Omit = useMemo(() => { const ret = { ...props }; diff --git a/src/util/propsToThemedStyle.ts b/src/util/propsToThemedStyle.ts index b1d88586..afc1dfc5 100644 --- a/src/util/propsToThemedStyle.ts +++ b/src/util/propsToThemedStyle.ts @@ -1,6 +1,5 @@ /* eslint-disable padding-line-between-statements */ import type { DimensionValue, StyleProp, ViewStyle } from 'react-native'; -import { StyleSheet } from 'react-native'; import { is } from '@mj-studio/js-util'; import type { SxProps } from '../@types/SxProps'; @@ -11,11 +10,9 @@ import { parsePxSuffixNumber } from '../internal/util/parsePxSuffixNumber'; import { printWarning } from '../internal/util/printWarning'; export const propsToThemedStyle = ({ - baseStyle, theme, sx, }: { - baseStyle?: StyleProp; theme?: ThemedDict; sx?: SxProps; }): StyleProp | undefined => { @@ -23,11 +20,11 @@ export const propsToThemedStyle = ({ if (!theme) { printWarning('theme not found'); - return baseStyle; + return; } if (!sx) { - return baseStyle; + return; } const parseColor = (token?: Token<'colors'>): string | undefined => { @@ -304,5 +301,5 @@ export const propsToThemedStyle = ({ fillViewStyleIfNotNullish(ret, 'zIndex', sx.zIndex); // endregion - return StyleSheet.compose(baseStyle, ret); + return ret; };