Skip to content

Commit fa72b26

Browse files
committed
docs: update docs (migrate from docusaurus to vitepress); test: add tests for setData(skipped temp)
1 parent 65d14df commit fa72b26

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+4265
-12415
lines changed

.eslintignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ jsconfig.json
1717
post-build.mjs
1818
coverage
1919
vitest.config.ts
20-
website
20+
website
21+
docs

.github/workflows/github-pages.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ jobs:
2525
cache: 'pnpm'
2626

2727
- name: Install dependencies
28-
run: cd website && pnpm install
29-
- name: Build website
30-
run: pnpm website:build
28+
run: cd docs && pnpm install
29+
- name: Build docs
30+
run: pnpm build
3131

3232
- name: Upload Build Artifact
3333
uses: actions/upload-pages-artifact@v3
3434
with:
35-
path: website/build
35+
path: docs/.vitepress/dist
3636

3737
deploy:
3838
name: Deploy to GitHub Pages

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
dist
3-
coverage
3+
coverage
4+
docs/.vitepress/cache

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ install:
44
pnpm i
55
reinstall:
66
make clean
7-
make install
7+
make install
8+
doc:
9+
cd docs && \
10+
rm -rf node_modules && \
11+
rm -rf .vitepress/cache && \
12+
pnpm i && \
13+
pnpm dev

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,8 +394,8 @@ export const queryClient = new QueryClient({
394394
queries: {
395395
throwOnError: true,
396396
queryKeyHashFn: hashKey,
397-
refetchOnWindowFocus: 'always',
398-
refetchOnReconnect: 'always',
397+
refetchOnWindowFocus: true,
398+
refetchOnReconnect: true,
399399
staleTime: 5 * 60 * 1000,
400400
retry: (failureCount, error) => {
401401
if ('status' in error && Number(error.status) >= 500) {

docs/.vitepress/config.mts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import { defineConfig } from 'vitepress';
2+
3+
import path from 'path';
4+
import fs from 'fs';
5+
6+
const { version, name: packageName, author, license } = JSON.parse(
7+
fs.readFileSync(
8+
path.resolve(__dirname, '../../package.json'),
9+
{ encoding: 'utf-8' },
10+
),
11+
);
12+
13+
export default defineConfig({
14+
title: packageName.replace(/-/g, ' '),
15+
description: `${packageName.replace(/-/g, ' ')} documentation`,
16+
base: `/${packageName}/`,
17+
lastUpdated: true,
18+
head: [
19+
['link', { rel: 'icon', href: `/${packageName}/logo.png` }],
20+
],
21+
themeConfig: {
22+
logo: '/logo.png',
23+
search: {
24+
provider: 'local'
25+
},
26+
nav: [
27+
{ text: 'Home', link: '/' },
28+
{ text: 'Introduction', link: '/introduction/getting-started' },
29+
{
30+
text: `v${version}`,
31+
items: [
32+
{
33+
items: [
34+
{
35+
text: `v${version}`,
36+
link: `https://github.com/${author}/${packageName}/releases/tag/v${version}`,
37+
},
38+
],
39+
},
40+
],
41+
},
42+
],
43+
sidebar: [
44+
{
45+
text: 'Introduction',
46+
items: [
47+
{ text: 'Getting started', link: '/introduction/getting-started' },
48+
],
49+
},
50+
{
51+
text: 'API',
52+
items: [
53+
{ text: 'MobxQuery', link: '/api/MobxQuery' },
54+
{ text: 'MobxMutation', link: '/api/MobxMutation' },
55+
{ text: 'MobxInfiniteQuery', link: '/api/MobxInfiniteQuery' },
56+
{ text: 'MobxQueryClient', link: '/api/MobxQueryClient' },
57+
],
58+
},
59+
{
60+
text: 'Other',
61+
items: [
62+
{ text: 'Project examples', link: '/other/project-examples' },
63+
{ text: 'Swagger Codegen', link: '/other/swagger-codegen' },
64+
],
65+
}
66+
],
67+
68+
footer: {
69+
message: `Released under the ${license} License.`,
70+
copyright: `Copyright © 2024-PRESENT ${author}`,
71+
},
72+
73+
socialLinks: [
74+
{ icon: 'github', link: `https://github.com/${author}/${packageName}` },
75+
],
76+
},
77+
});

docs/.vitepress/theme/index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// https://vitepress.dev/guide/custom-theme
2+
import { h } from 'vue'
3+
import type { Theme } from 'vitepress'
4+
import DefaultTheme from 'vitepress/theme'
5+
import './style.css'
6+
import 'uno.css'
7+
8+
export default {
9+
extends: DefaultTheme,
10+
Layout: () => {
11+
return h(DefaultTheme.Layout, null, {
12+
// https://vitepress.dev/guide/extending-default-theme#layout-slots
13+
})
14+
},
15+
enhanceApp({ app, router, siteData }) {
16+
// ...
17+
}
18+
} satisfies Theme

docs/.vitepress/theme/style.css

Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
/**
2+
* Customize default theme styling by overriding CSS variables:
3+
* https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
4+
*/
5+
6+
/**
7+
* Colors
8+
*
9+
* Each colors have exact same color scale system with 3 levels of solid
10+
* colors with different brightness, and 1 soft color.
11+
*
12+
* - `XXX-1`: The most solid color used mainly for colored text. It must
13+
* satisfy the contrast ratio against when used on top of `XXX-soft`.
14+
*
15+
* - `XXX-2`: The color used mainly for hover state of the button.
16+
*
17+
* - `XXX-3`: The color for solid background, such as bg color of the button.
18+
* It must satisfy the contrast ratio with pure white (#ffffff) text on
19+
* top of it.
20+
*
21+
* - `XXX-soft`: The color used for subtle background such as custom container
22+
* or badges. It must satisfy the contrast ratio when putting `XXX-1` colors
23+
* on top of it.
24+
*
25+
* The soft color must be semi transparent alpha channel. This is crucial
26+
* because it allows adding multiple "soft" colors on top of each other
27+
* to create a accent, such as when having inline code block inside
28+
* custom containers.
29+
*
30+
* - `default`: The color used purely for subtle indication without any
31+
* special meanings attched to it such as bg color for menu hover state.
32+
*
33+
* - `brand`: Used for primary brand colors, such as link text, button with
34+
* brand theme, etc.
35+
*
36+
* - `tip`: Used to indicate useful information. The default theme uses the
37+
* brand color for this by default.
38+
*
39+
* - `warning`: Used to indicate warning to the users. Used in custom
40+
* container, badges, etc.
41+
*
42+
* - `danger`: Used to show error, or dangerous message to the users. Used
43+
* in custom container, badges, etc.
44+
* -------------------------------------------------------------------------- */
45+
46+
:root {
47+
--vp-c-indigo-1: #c87a45;
48+
--vp-c-indigo-2: #ff8a4f;
49+
--vp-c-indigo-3: #fb681f;
50+
--vp-c-indigo-soft: #ff82512b;
51+
}
52+
53+
html.dark {
54+
--vp-c-indigo-1: #ffae77;
55+
--vp-c-indigo-2: #ff8a4f;
56+
--vp-c-indigo-3: #fb681f;
57+
--vp-c-indigo-soft: #ff662069;
58+
}
59+
60+
:root {
61+
--vp-c-default-1: var(--vp-c-gray-1);
62+
--vp-c-default-2: var(--vp-c-gray-2);
63+
--vp-c-default-3: var(--vp-c-gray-3);
64+
--vp-c-default-soft: var(--vp-c-gray-soft);
65+
66+
--vp-c-brand-1: var(--vp-c-indigo-1);
67+
--vp-c-brand-2: var(--vp-c-indigo-2);
68+
--vp-c-brand-3: var(--vp-c-indigo-3);
69+
--vp-c-brand-soft: var(--vp-c-indigo-soft);
70+
71+
--vp-c-tip-1: var(--vp-c-brand-1);
72+
--vp-c-tip-2: var(--vp-c-brand-2);
73+
--vp-c-tip-3: var(--vp-c-brand-3);
74+
--vp-c-tip-soft: var(--vp-c-brand-soft);
75+
76+
--vp-c-warning-1: var(--vp-c-yellow-1);
77+
--vp-c-warning-2: var(--vp-c-yellow-2);
78+
--vp-c-warning-3: var(--vp-c-yellow-3);
79+
--vp-c-warning-soft: var(--vp-c-yellow-soft);
80+
81+
--vp-c-danger-1: var(--vp-c-red-1);
82+
--vp-c-danger-2: var(--vp-c-red-2);
83+
--vp-c-danger-3: var(--vp-c-red-3);
84+
--vp-c-danger-soft: var(--vp-c-red-soft);
85+
}
86+
87+
/**
88+
* Component: Button
89+
* -------------------------------------------------------------------------- */
90+
91+
:root {
92+
--vp-button-brand-border: transparent;
93+
--vp-button-brand-text: var(--vp-c-white);
94+
--vp-button-brand-bg: var(--vp-c-brand-3);
95+
--vp-button-brand-hover-border: transparent;
96+
--vp-button-brand-hover-text: var(--vp-c-white);
97+
--vp-button-brand-hover-bg: var(--vp-c-brand-2);
98+
--vp-button-brand-active-border: transparent;
99+
--vp-button-brand-active-text: var(--vp-c-white);
100+
--vp-button-brand-active-bg: var(--vp-c-brand-1);
101+
}
102+
103+
/**
104+
* Component: Home
105+
* -------------------------------------------------------------------------- */
106+
107+
:root {
108+
--vp-home-hero-name-color: transparent;
109+
--vp-home-hero-name-background: -webkit-linear-gradient(120deg, #ff1148 30%, #ff7a32);
110+
--vp-home-hero-image-background-image: linear-gradient(-45deg, #ff542f 50%, #ffbbcf 50%);
111+
--vp-home-hero-image-filter: blur(44px);
112+
}
113+
114+
html.dark {
115+
--vp-home-hero-image-background-image: linear-gradient(-45deg, #ff510b 50%, #ff243d 50%);
116+
}
117+
118+
@media (min-width: 640px) {
119+
:root {
120+
--vp-home-hero-image-filter: blur(56px);
121+
}
122+
}
123+
124+
@media (min-width: 960px) {
125+
:root {
126+
--vp-home-hero-image-filter: blur(68px);
127+
}
128+
}
129+
130+
/**
131+
* Component: Custom Block
132+
* -------------------------------------------------------------------------- */
133+
134+
:root {
135+
--vp-custom-block-tip-border: transparent;
136+
--vp-custom-block-tip-text: var(--vp-c-text-1);
137+
--vp-custom-block-tip-bg: var(--vp-c-brand-soft);
138+
--vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
139+
}
140+
141+
.i-logos\:mobx-icon {
142+
background: url(/mobx.svg) no-repeat;
143+
background-size: 100% 100%;
144+
background-color: transparent;
145+
width: 1.2em;
146+
height: 1.2em;
147+
}
148+
149+
/**
150+
* Component: Algolia
151+
* -------------------------------------------------------------------------- */
152+
153+
.DocSearch {
154+
--docsearch-primary-color: var(--vp-c-brand-1) !important;
155+
}
156+
157+
@keyframes logoBgGradientAnimate {
158+
0% {
159+
background-position: 0% 0%;
160+
transform: scale(1) translate(-50%, -50%);
161+
}
162+
50% {
163+
background-position: 300% 300%;
164+
transform: scale(1.4) translate(-35%, -35%);
165+
}
166+
100% {
167+
background-position: 0% 0%;
168+
transform: scale(1) translate(-50%, -50%);
169+
}
170+
}
171+
172+
.image-container > .image-bg {
173+
background-size: 200% 200%;
174+
animation: logoBgGradientAnimate 7s linear infinite;
175+
}
176+
177+
@keyframes logoAnimate {
178+
0% {
179+
transform: scale(1) translate(-50%, -50%);
180+
}
181+
50% {
182+
transform: scale(1.05) translate(-48%, -48%);
183+
}
184+
100% {
185+
transform: scale(1) translate(-50%, -50%);
186+
}
187+
}
188+
189+
.image-container > .image-src {
190+
animation: logoAnimate 10s linear infinite;
191+
}

docs/API/Mobx Infinite Query/overview.mdx

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/API/Mobx Mutation/overview.mdx

Lines changed: 0 additions & 7 deletions
This file was deleted.

0 commit comments

Comments
 (0)