From 6123f467e5a30747522e07ca17b20502debcd44a Mon Sep 17 00:00:00 2001 From: LongYinan Date: Fri, 6 Mar 2020 00:30:59 +0800 Subject: [PATCH] [WIP]Add more chapters --- doczrc.js | 135 ++++++++++++++---- index.mdx | 23 ++- .../adding_new_module_asynchronously.mdx | 4 +- .../adding_new_module_asynchronously.zh.mdx | 2 +- recipes/{ => react}/cancellation.mdx | 4 +- recipes/{ => react}/cancellation.zh.mdx | 2 +- .../{ => react}/dependencies_replacement.mdx | 4 +- .../dependencies_replacement.zh.mdx | 2 +- recipes/{ => react}/loading_error_state.mdx | 4 +- .../{ => react}/loading_error_state.zh.mdx | 2 +- recipes/{ => react}/select-state.mdx | 2 +- recipes/{ => react}/select-state.zh.mdx | 0 recipes/writting_tests.mdx | 1 - recipes/writting_tests.zh.mdx | 1 - 14 files changed, 142 insertions(+), 44 deletions(-) rename recipes/{ => react}/adding_new_module_asynchronously.mdx (90%) rename recipes/{ => react}/adding_new_module_asynchronously.zh.mdx (92%) rename recipes/{ => react}/cancellation.mdx (98%) rename recipes/{ => react}/cancellation.zh.mdx (98%) rename recipes/{ => react}/dependencies_replacement.mdx (97%) rename recipes/{ => react}/dependencies_replacement.zh.mdx (98%) rename recipes/{ => react}/loading_error_state.mdx (97%) rename recipes/{ => react}/loading_error_state.zh.mdx (98%) rename recipes/{ => react}/select-state.mdx (98%) rename recipes/{ => react}/select-state.zh.mdx (100%) diff --git a/doczrc.js b/doczrc.js index 88a33c6..bfd87ae 100644 --- a/doczrc.js +++ b/doczrc.js @@ -6,14 +6,14 @@ export default { themeConfig: { colors: { header: { - bg: '#ffd54f', - }, + bg: '#ffd54f' + } }, styles: { inlineCode: { - color: 'hotpink', - }, - }, + color: 'hotpink' + } + } }, menu: [ 'Introduction', @@ -23,32 +23,71 @@ export default { 'Concept', { name: 'Action', - route: '/en/basic/action', + route: '/en/basic/action' }, { name: 'Effects', - route: '/en/basic/effects', + route: '/en/basic/effects' }, { name: 'Dependencies Injection', - route: '/en/basic/dependencies-injection', + route: '/en/basic/dependencies-injection' + } + ] + }, + { + name: 'React recipes', + menu: [ + { + name: 'Cancellation', + route: '/en/recipes/react/cancellation' + }, + { + name: 'Loading/Error states handling', + route: '/en/recipes/react/loading-error-states-handling' + }, + { + name: 'StateSelector', + route: '/en/recipes/react/state-selector' }, - ], + { + name: 'Dependencies Replacement', + route: '/en/recipes/react/dependencies-replacement' + }, + { + name: 'Adding new EffectModule asynchronously', + route: '/en/recipes/react/adding-new-effect-module-asynchronously' + }, + ] }, { - name: 'Recipes', + name: 'VueJS recipes', menu: [ - 'Cancellation', - 'Loading/Error states handling', - 'StateSelector', - 'Dependencies Replacement', - 'Adding new EffectModule asynchronously', - 'Writting tests', - ], + { + name: 'Cancellation', + route: '/en/recipes/vue/cancellation' + }, + { + name: 'Loading/Error states handling', + route: '/en/recipes/vue/loading-error-states-handling' + }, + { + name: 'Dependencies Replacement', + route: '/en/recipes/vue/dependencies-replacement' + }, + { + name: 'Adding new EffectModule asynchronously', + route: '/en/recipes/vue/adding-new-effect-module-asynchronously' + }, + ] + }, + { + name: 'Writting tests', + route: '/en/recipes/writting-tests' }, { name: 'FAQ', - route: '/en/faq', + route: '/en/faq' }, { name: '基本概念', @@ -56,25 +95,67 @@ export default { '概念', { name: 'Action', - route: '/zh/basic/action', + route: '/zh/basic/action' }, { name: 'Effects', - route: '/zh/basic/effects', + route: '/zh/basic/effects' }, { name: '依赖注入', - route: '/zh/basic/dependencies-injection', + route: '/zh/basic/dependencies-injection' + } + ] + }, + { + name: 'React 接入指南', + menu: [ + { + name: '取消', + route: '/zh/recipes/react/cancellation' + }, + { + name: '处理 Loading/Error 状态', + route: '/zh/recipes/react/loading-error-states-handling' + }, + { + name: 'StateSelector', + route: '/zh/recipes/react/state-selector' + }, + { + name: '依赖替换', + route: '/zh/recipes/react/dependencies-replacement' + }, + { + name: 'Module 异步加载', + route: '/zh/recipes/react/adding-new-effect-module-asynchronously' }, - ], + ] }, { - name: '深入', - menu: ['取消', '处理 Loading/Error 状态', 'StateSelector', '依赖替换', 'Module 异步加载', '测试'], + name: 'VueJS 接入指南', + menu: [ + { + name: '取消', + route: '/zh/recipes/vue/cancellation' + }, + { + name: '处理 Loading/Error 状态', + route: '/zh/recipes/vue/loading-error-states-handling' + }, + { + name: '依赖替换', + route: '/zh/recipes/vue/dependencies-replacement' + }, + { + name: 'Module 异步加载', + route: '/zh/recipes/vue/adding-new-effect-module-asynchronously' + }, + ] }, { name: '常见问题', - route: '/zh/faq', - }, - ], + route: '/zh/faq' + } + ] } diff --git a/index.mdx b/index.mdx index 3704777..2123466 100644 --- a/index.mdx +++ b/index.mdx @@ -9,15 +9,34 @@ route: / [![Slack Status](https://img.shields.io/badge/slack-@sigi/framework-green.svg?logo=slack)](https://join.slack.com/t/sigiframework/shared_invite/enQtOTM4ODYwMjQ5OTY5LTRmM2JhYTA1NTA5OWVkZWQzZmVkZjE4OGM0ZjM4NGJlZTliNTZjYjE5OGExMjE3MTNkNGE2NmE1MjM5NDQwNTY) # Introduction -**Sigi** is a high level **Process manager** with well designed API which based on `RxJS` and `Immer`. -`TypeScript` is not requirement but we **strongly recommand** using `Sigi` with `TypeScript`, and we don't provide `JavaScript` version document for now. +> **Sigi** is son of Odin ***(Oðin)***, the **Sig** in Sigi means victory because the name of Odin is ***Sigtýr***, which means ***The god of victory***. + + +**Sigi** is a high level **Process manager** with well designed API which based on `RxJS` and `Immer`. Unlike others state management framenwork, **Sigi** focus on the ***Process management***, which usually come with ***State management*** requirement. + +Of course **Sigi** also manage your state, but if you only want put some data in state, and really don't care how the data will be fetched, cached or staled, **Sigi** might too ***heavy*** for you. + +**Sigi** is really good at manage the ***process*** of how the state changed, not just the state itself. With the benifit of `RxJS`, you can easily cancel the ongoing request when leaving page (`takeUntil`), or ignore the following event which will trigger ajax request when the first triggered one hasn't resposed yet (`exhaustMap`). + +`RxJS` is the only way to manage process now, so you might need to know about [RxJS](https://rxjs.dev/) before you get start. We will also provide `AsyncGenerator` API in future. + +**Sigi** is written by `TypeScript`, and we **strongly recommand** using `Sigi` with `TypeScript`, we don't provide `JavaScript` version document now. ## Install + +### React app + ```bash yarn install @sigi/{core,di,react,react-router,ssr} immer rxjs ``` +### VueJS app + +```bash +yarn install @sigi/{core,di,vue} immer rxjs +``` + ## Required polyfill in legacy browsers > Bundle these polyfills on demand, `Sigi` does't import them in source code. diff --git a/recipes/adding_new_module_asynchronously.mdx b/recipes/react/adding_new_module_asynchronously.mdx similarity index 90% rename from recipes/adding_new_module_asynchronously.mdx rename to recipes/react/adding_new_module_asynchronously.mdx index 9e98620..c7afe0f 100644 --- a/recipes/adding_new_module_asynchronously.mdx +++ b/recipes/react/adding_new_module_asynchronously.mdx @@ -1,7 +1,7 @@ --- name: Adding new EffectModule asynchronously -route: /en/recipes/adding-new-effect-module-asynchronously -menu: Recipes +route: /en/recipes/react/adding-new-effect-module-asynchronously +menu: React Recipes --- # Adding new EffectModule Asynchronously/Lazily diff --git a/recipes/adding_new_module_asynchronously.zh.mdx b/recipes/react/adding_new_module_asynchronously.zh.mdx similarity index 92% rename from recipes/adding_new_module_asynchronously.zh.mdx rename to recipes/react/adding_new_module_asynchronously.zh.mdx index 842bdb1..4936c28 100644 --- a/recipes/adding_new_module_asynchronously.zh.mdx +++ b/recipes/react/adding_new_module_asynchronously.zh.mdx @@ -1,6 +1,6 @@ --- name: EffectModule 异步加载 -route: /zh/recipes/adding-new-effect-module-asynchronously +route: /zh/recipes/react/adding-new-effect-module-asynchronously menu: 深入 --- diff --git a/recipes/cancellation.mdx b/recipes/react/cancellation.mdx similarity index 98% rename from recipes/cancellation.mdx rename to recipes/react/cancellation.mdx index 4a621c1..5998f30 100644 --- a/recipes/cancellation.mdx +++ b/recipes/react/cancellation.mdx @@ -1,7 +1,7 @@ --- name: Cancellation -route: /en/recipes/cancellation -menu: Recipes +route: /en/recipes/react/cancellation +menu: React Recipes --- # Cancellation diff --git a/recipes/cancellation.zh.mdx b/recipes/react/cancellation.zh.mdx similarity index 98% rename from recipes/cancellation.zh.mdx rename to recipes/react/cancellation.zh.mdx index 7e3c602..3c571a7 100644 --- a/recipes/cancellation.zh.mdx +++ b/recipes/react/cancellation.zh.mdx @@ -1,6 +1,6 @@ --- name: 取消 -route: /zh/recipes/cancellation +route: /zh/recipes/react/cancellation menu: 深入 --- diff --git a/recipes/dependencies_replacement.mdx b/recipes/react/dependencies_replacement.mdx similarity index 97% rename from recipes/dependencies_replacement.mdx rename to recipes/react/dependencies_replacement.mdx index 1629c28..eaa3a38 100644 --- a/recipes/dependencies_replacement.mdx +++ b/recipes/react/dependencies_replacement.mdx @@ -1,7 +1,7 @@ --- name: Dependencies Replacement -route: /en/recipes/dependencies-replacement -menu: Recipes +route: /en/recipes/react/dependencies-replacement +menu: React Recipes --- # Dependencies replacement diff --git a/recipes/dependencies_replacement.zh.mdx b/recipes/react/dependencies_replacement.zh.mdx similarity index 98% rename from recipes/dependencies_replacement.zh.mdx rename to recipes/react/dependencies_replacement.zh.mdx index 281f9af..6bc2177 100644 --- a/recipes/dependencies_replacement.zh.mdx +++ b/recipes/react/dependencies_replacement.zh.mdx @@ -1,6 +1,6 @@ --- name: 依赖替换 -route: /zh/recipes/dependencies-replacement +route: /zh/recipes/react/dependencies-replacement menu: 深入 --- diff --git a/recipes/loading_error_state.mdx b/recipes/react/loading_error_state.mdx similarity index 97% rename from recipes/loading_error_state.mdx rename to recipes/react/loading_error_state.mdx index ce0ea8b..7e9a9d4 100644 --- a/recipes/loading_error_state.mdx +++ b/recipes/react/loading_error_state.mdx @@ -1,7 +1,7 @@ --- name: Loading/Error states handling -route: /en/recipes/loading-error-states-handling -menu: Recipes +route: /en/recipes/react/loading-error-states-handling +menu: React Recipes --- # Loading/Error states handling diff --git a/recipes/loading_error_state.zh.mdx b/recipes/react/loading_error_state.zh.mdx similarity index 98% rename from recipes/loading_error_state.zh.mdx rename to recipes/react/loading_error_state.zh.mdx index cbbafba..9ec6a01 100644 --- a/recipes/loading_error_state.zh.mdx +++ b/recipes/react/loading_error_state.zh.mdx @@ -1,6 +1,6 @@ --- name: 处理 Loading/Error 状态 -route: /zh/recipes/loading-error-states-handling +route: /zh/recipes/react/loading-error-states-handling menu: 深入 --- diff --git a/recipes/select-state.mdx b/recipes/react/select-state.mdx similarity index 98% rename from recipes/select-state.mdx rename to recipes/react/select-state.mdx index bf98c9c..8033a66 100644 --- a/recipes/select-state.mdx +++ b/recipes/react/select-state.mdx @@ -1,7 +1,7 @@ --- name: StateSelector route: /en/recipes/state-selector -menu: Recipes +menu: React Recipes --- # StateSelector diff --git a/recipes/select-state.zh.mdx b/recipes/react/select-state.zh.mdx similarity index 100% rename from recipes/select-state.zh.mdx rename to recipes/react/select-state.zh.mdx diff --git a/recipes/writting_tests.mdx b/recipes/writting_tests.mdx index 51b4077..0ce3638 100644 --- a/recipes/writting_tests.mdx +++ b/recipes/writting_tests.mdx @@ -1,7 +1,6 @@ --- name: Writting tests route: /en/recipes/writting-tests -menu: Recipes --- # Writting tests diff --git a/recipes/writting_tests.zh.mdx b/recipes/writting_tests.zh.mdx index affaf6a..bac1a7e 100644 --- a/recipes/writting_tests.zh.mdx +++ b/recipes/writting_tests.zh.mdx @@ -1,7 +1,6 @@ --- name: 测试 route: /zh/recipes/writting-tests -menu: 深入 --- # 编写测试