@heyo-sh/create-heyo-docs 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deployments/cloudflare/astro/package.json +2 -1
- package/deployments/cloudflare/astro/src/env.d.ts +8 -0
- package/deployments/cloudflare/astro/src/pages/heyo-docs-internal/ai-chat.ts +32 -0
- package/deployments/cloudflare/next/app/heyo-docs-internal/ai-chat/route.ts +27 -0
- package/deployments/cloudflare/next/cloudflare-env.d.ts +7 -0
- package/deployments/cloudflare/react-router/app/cloudflare-env.d.ts +7 -0
- package/deployments/cloudflare/react-router/app/lib/cloudflare-context.ts +4 -0
- package/deployments/cloudflare/react-router/app/routes/ai-chat.ts +31 -0
- package/deployments/cloudflare/react-router/package.json +2 -1
- package/deployments/cloudflare/react-router/workers/app.ts +6 -2
- package/deployments/vercel/astro/package.json +1 -0
- package/dist/index.js +37 -16
- package/dist/project-name.d.ts +1 -1
- package/dist/project-name.d.ts.map +1 -1
- package/dist/scaffold.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +2 -2
- package/templates/astro/content/index.mdx +8 -0
- package/templates/astro/heyo-docs.config.ts +4 -48
- package/templates/astro/src/components/docs-app.tsx +30 -130
- package/templates/astro/src/heyo-docs-icons.tsx +3 -1
- package/templates/astro/src/layouts/docs-layout.astro +20 -504
- package/templates/astro/src/lib/docs.ts +3 -2
- package/templates/astro/src/lib/openapi-request.ts +6 -146
- package/templates/astro/src/pages/[...slug].astro +7 -15
- package/templates/astro/src/pages/[...slug].md.ts +4 -1
- package/templates/astro/src/pages/heyo-docs-internal/ai-chat.ts +10 -3
- package/templates/astro/src/pages/heyo-docs-internal/openapi-request.ts +6 -0
- package/templates/astro/src/pages/index.astro +18 -9
- package/templates/astro/src/pages/llms-full.txt.ts +1 -1
- package/templates/astro/src/pages/llms.txt.ts +1 -1
- package/templates/astro/src/pages/rss.xml.ts +1 -1
- package/templates/astro/src/pages/sitemap.xml.ts +2 -2
- package/templates/astro/src/virtual.d.ts +5 -5
- package/templates/next/app/[[...slug]]/page.tsx +10 -9
- package/templates/next/app/components/docs-app.tsx +28 -120
- package/templates/next/app/heyo-docs-icons.tsx +1 -1
- package/templates/next/app/heyo-docs-internal/ai-chat/route.ts +9 -2
- package/templates/next/app/heyo-docs-internal/markdown/[[...slug]]/route.ts +1 -1
- package/templates/next/app/layout.tsx +25 -444
- package/templates/next/app/lib/docs.ts +3 -3
- package/templates/next/app/lib/openapi-request.ts +4 -136
- package/templates/next/app/llms-full.txt/route.ts +1 -1
- package/templates/next/app/llms.txt/route.ts +1 -1
- package/templates/next/app/rss.xml/route.ts +1 -1
- package/templates/next/app/sitemap.xml/route.ts +1 -1
- package/templates/next/content/index.mdx +8 -0
- package/templates/next/heyo-docs.config.ts +3 -47
- package/templates/next/next.config.ts +7 -1
- package/templates/react-router/app/heyo-docs-icons.tsx +3 -1
- package/templates/react-router/app/root.tsx +28 -465
- package/templates/react-router/app/routes/ai-chat.ts +6 -2
- package/templates/react-router/app/routes/docs.tsx +22 -63
- package/templates/react-router/app/routes/home.tsx +6 -1
- package/templates/react-router/app/routes/llms-full.ts +1 -1
- package/templates/react-router/app/routes/llms.ts +1 -1
- package/templates/react-router/app/routes/markdown.ts +4 -1
- package/templates/react-router/app/routes/openapi-request.ts +11 -144
- package/templates/react-router/app/routes/rss.ts +1 -1
- package/templates/react-router/app/routes/sitemap.ts +5 -8
- package/templates/react-router/app/virtual.d.ts +5 -5
- package/templates/react-router/content/index.mdx +8 -0
- package/templates/react-router/heyo-docs.config.ts +4 -48
- package/templates/astro/content/api-overview.mdx +0 -20
- package/templates/astro/content/assets/local-architecture.svg +0 -22
- package/templates/astro/content/assets/quick-reference.txt +0 -5
- package/templates/astro/content/changelog.mdx +0 -38
- package/templates/astro/content/configuration.mdx +0 -117
- package/templates/astro/content/deploying.mdx +0 -57
- package/templates/astro/content/essentials/callouts.mdx +0 -34
- package/templates/astro/content/essentials/code-blocks.mdx +0 -43
- package/templates/astro/content/essentials/lists.mdx +0 -36
- package/templates/astro/content/essentials/tables.mdx +0 -30
- package/templates/astro/content/essentials/tabs.mdx +0 -40
- package/templates/astro/content/essentials/text-styling.mdx +0 -43
- package/templates/astro/content/getting-started.mdx +0 -16
- package/templates/astro/content/mdx-components.mdx +0 -44
- package/templates/astro/content/openapi-petstore.json +0 -160
- package/templates/astro/content/openapi.json +0 -278
- package/templates/astro/content/quickstart.mdx +0 -60
- package/templates/astro/src/components/theme-provider.tsx +0 -106
- package/templates/astro/src/lib/seo.ts +0 -221
- package/templates/astro/src/lib/theme.ts +0 -74
- package/templates/next/app/components/theme-provider.tsx +0 -93
- package/templates/next/app/lib/seo.ts +0 -189
- package/templates/next/app/lib/theme.ts +0 -61
- package/templates/next/content/api-overview.mdx +0 -20
- package/templates/next/content/assets/local-architecture.svg +0 -22
- package/templates/next/content/assets/quick-reference.txt +0 -5
- package/templates/next/content/changelog.mdx +0 -38
- package/templates/next/content/configuration.mdx +0 -117
- package/templates/next/content/deploying.mdx +0 -57
- package/templates/next/content/essentials/callouts.mdx +0 -34
- package/templates/next/content/essentials/code-blocks.mdx +0 -43
- package/templates/next/content/essentials/lists.mdx +0 -36
- package/templates/next/content/essentials/tables.mdx +0 -30
- package/templates/next/content/essentials/tabs.mdx +0 -40
- package/templates/next/content/essentials/text-styling.mdx +0 -43
- package/templates/next/content/getting-started.mdx +0 -16
- package/templates/next/content/mdx-components.mdx +0 -41
- package/templates/next/content/openapi-petstore.json +0 -160
- package/templates/next/content/openapi.json +0 -278
- package/templates/next/content/quickstart.mdx +0 -60
- package/templates/react-router/app/components/theme-provider.tsx +0 -106
- package/templates/react-router/app/lib/theme.ts +0 -74
- package/templates/react-router/content/api-overview.mdx +0 -20
- package/templates/react-router/content/assets/local-architecture.svg +0 -22
- package/templates/react-router/content/assets/quick-reference.txt +0 -5
- package/templates/react-router/content/changelog.mdx +0 -38
- package/templates/react-router/content/configuration.mdx +0 -117
- package/templates/react-router/content/deploying.mdx +0 -57
- package/templates/react-router/content/essentials/callouts.mdx +0 -34
- package/templates/react-router/content/essentials/code-blocks.mdx +0 -43
- package/templates/react-router/content/essentials/lists.mdx +0 -36
- package/templates/react-router/content/essentials/tables.mdx +0 -30
- package/templates/react-router/content/essentials/tabs.mdx +0 -40
- package/templates/react-router/content/essentials/text-styling.mdx +0 -43
- package/templates/react-router/content/getting-started.mdx +0 -16
- package/templates/react-router/content/mdx-components.mdx +0 -293
- package/templates/react-router/content/openapi-petstore.json +0 -160
- package/templates/react-router/content/openapi.json +0 -278
- package/templates/react-router/content/quickstart.mdx +0 -60
|
@@ -1,278 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"openapi": "3.1.0",
|
|
3
|
-
"info": {
|
|
4
|
-
"title": "Planet API",
|
|
5
|
-
"version": "1.0.0",
|
|
6
|
-
"description": "An example API used by the Heyo Docs React Router demo."
|
|
7
|
-
},
|
|
8
|
-
"servers": [
|
|
9
|
-
{
|
|
10
|
-
"url": "https://api.example.com/v1",
|
|
11
|
-
"description": "Example production API"
|
|
12
|
-
}
|
|
13
|
-
],
|
|
14
|
-
"security": [
|
|
15
|
-
{
|
|
16
|
-
"BearerAuth": []
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
"paths": {
|
|
20
|
-
"/organizations/{organizationId}/planets": {
|
|
21
|
-
"parameters": [
|
|
22
|
-
{
|
|
23
|
-
"name": "organizationId",
|
|
24
|
-
"in": "path",
|
|
25
|
-
"required": true,
|
|
26
|
-
"description": "The organization that owns the planets.",
|
|
27
|
-
"schema": {
|
|
28
|
-
"type": "string",
|
|
29
|
-
"example": "org_123"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
],
|
|
33
|
-
"get": {
|
|
34
|
-
"operationId": "listPlanets",
|
|
35
|
-
"summary": "List planets",
|
|
36
|
-
"description": "Returns the planets that belong to an organization.",
|
|
37
|
-
"tags": ["Planets"],
|
|
38
|
-
"parameters": [
|
|
39
|
-
{
|
|
40
|
-
"name": "limit",
|
|
41
|
-
"in": "query",
|
|
42
|
-
"description": "Maximum number of records to return.",
|
|
43
|
-
"schema": {
|
|
44
|
-
"type": "integer",
|
|
45
|
-
"default": 20
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
],
|
|
49
|
-
"responses": {
|
|
50
|
-
"200": {
|
|
51
|
-
"description": "A page of planets.",
|
|
52
|
-
"content": {
|
|
53
|
-
"application/json": {
|
|
54
|
-
"schema": {
|
|
55
|
-
"type": "array",
|
|
56
|
-
"items": {
|
|
57
|
-
"$ref": "#/components/schemas/Planet"
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"post": {
|
|
66
|
-
"operationId": "createPlanet",
|
|
67
|
-
"summary": "Create a planet",
|
|
68
|
-
"description": "Creates a planet inside an organization.",
|
|
69
|
-
"tags": ["Planets"],
|
|
70
|
-
"requestBody": {
|
|
71
|
-
"required": true,
|
|
72
|
-
"description": "The planet to create.",
|
|
73
|
-
"content": {
|
|
74
|
-
"application/json": {
|
|
75
|
-
"schema": {
|
|
76
|
-
"$ref": "#/components/schemas/PlanetInput"
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"responses": {
|
|
82
|
-
"201": {
|
|
83
|
-
"description": "The newly created planet.",
|
|
84
|
-
"content": {
|
|
85
|
-
"application/json": {
|
|
86
|
-
"schema": {
|
|
87
|
-
"$ref": "#/components/schemas/Planet"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"/organizations/{organizationId}/planets/{planetId}": {
|
|
96
|
-
"parameters": [
|
|
97
|
-
{
|
|
98
|
-
"name": "organizationId",
|
|
99
|
-
"in": "path",
|
|
100
|
-
"required": true,
|
|
101
|
-
"description": "The organization that owns the planet.",
|
|
102
|
-
"schema": {
|
|
103
|
-
"type": "string",
|
|
104
|
-
"example": "org_123"
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"name": "planetId",
|
|
109
|
-
"in": "path",
|
|
110
|
-
"required": true,
|
|
111
|
-
"description": "The planet identifier.",
|
|
112
|
-
"schema": {
|
|
113
|
-
"type": "string",
|
|
114
|
-
"example": "planet_earth"
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
],
|
|
118
|
-
"get": {
|
|
119
|
-
"operationId": "getPlanet",
|
|
120
|
-
"summary": "Get a planet",
|
|
121
|
-
"description": "Returns one planet by ID.",
|
|
122
|
-
"tags": ["Planets"],
|
|
123
|
-
"responses": {
|
|
124
|
-
"200": {
|
|
125
|
-
"description": "The requested planet.",
|
|
126
|
-
"content": {
|
|
127
|
-
"application/json": {
|
|
128
|
-
"schema": {
|
|
129
|
-
"$ref": "#/components/schemas/Planet"
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
},
|
|
134
|
-
"404": {
|
|
135
|
-
"description": "Planet not found."
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
"put": {
|
|
140
|
-
"operationId": "replacePlanet",
|
|
141
|
-
"summary": "Replace a planet",
|
|
142
|
-
"description": "Replaces all editable planet values.",
|
|
143
|
-
"tags": ["Planets"],
|
|
144
|
-
"requestBody": {
|
|
145
|
-
"required": true,
|
|
146
|
-
"content": {
|
|
147
|
-
"application/json": {
|
|
148
|
-
"schema": {
|
|
149
|
-
"$ref": "#/components/schemas/PlanetInput"
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
"responses": {
|
|
155
|
-
"200": {
|
|
156
|
-
"description": "The updated planet.",
|
|
157
|
-
"content": {
|
|
158
|
-
"application/json": {
|
|
159
|
-
"schema": {
|
|
160
|
-
"$ref": "#/components/schemas/Planet"
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
"patch": {
|
|
168
|
-
"operationId": "updatePlanet",
|
|
169
|
-
"summary": "Update a planet",
|
|
170
|
-
"description": "Updates one or more planet fields.",
|
|
171
|
-
"tags": ["Planets"],
|
|
172
|
-
"requestBody": {
|
|
173
|
-
"required": true,
|
|
174
|
-
"content": {
|
|
175
|
-
"application/json": {
|
|
176
|
-
"schema": {
|
|
177
|
-
"$ref": "#/components/schemas/PlanetPatch"
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
},
|
|
182
|
-
"responses": {
|
|
183
|
-
"200": {
|
|
184
|
-
"description": "The updated planet.",
|
|
185
|
-
"content": {
|
|
186
|
-
"application/json": {
|
|
187
|
-
"schema": {
|
|
188
|
-
"$ref": "#/components/schemas/Planet"
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
},
|
|
195
|
-
"delete": {
|
|
196
|
-
"operationId": "deletePlanet",
|
|
197
|
-
"summary": "Delete a planet",
|
|
198
|
-
"description": "Permanently removes a planet from an organization.",
|
|
199
|
-
"tags": ["Planets"],
|
|
200
|
-
"parameters": [
|
|
201
|
-
{
|
|
202
|
-
"name": "hardDelete",
|
|
203
|
-
"in": "query",
|
|
204
|
-
"description": "Also remove historical records.",
|
|
205
|
-
"schema": {
|
|
206
|
-
"type": "boolean",
|
|
207
|
-
"default": false
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
],
|
|
211
|
-
"responses": {
|
|
212
|
-
"204": {
|
|
213
|
-
"description": "Planet deleted."
|
|
214
|
-
},
|
|
215
|
-
"404": {
|
|
216
|
-
"description": "Planet not found."
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
},
|
|
222
|
-
"components": {
|
|
223
|
-
"securitySchemes": {
|
|
224
|
-
"BearerAuth": {
|
|
225
|
-
"type": "http",
|
|
226
|
-
"scheme": "bearer",
|
|
227
|
-
"bearerFormat": "JWT"
|
|
228
|
-
}
|
|
229
|
-
},
|
|
230
|
-
"schemas": {
|
|
231
|
-
"Planet": {
|
|
232
|
-
"type": "object",
|
|
233
|
-
"required": ["id", "name", "classification"],
|
|
234
|
-
"properties": {
|
|
235
|
-
"id": {
|
|
236
|
-
"type": "string",
|
|
237
|
-
"example": "planet_earth"
|
|
238
|
-
},
|
|
239
|
-
"name": {
|
|
240
|
-
"type": "string",
|
|
241
|
-
"example": "Earth"
|
|
242
|
-
},
|
|
243
|
-
"classification": {
|
|
244
|
-
"type": "string",
|
|
245
|
-
"enum": ["terrestrial", "gas-giant", "ice-giant"]
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
"PlanetInput": {
|
|
250
|
-
"type": "object",
|
|
251
|
-
"required": ["name", "classification"],
|
|
252
|
-
"properties": {
|
|
253
|
-
"name": {
|
|
254
|
-
"type": "string",
|
|
255
|
-
"example": "Mars"
|
|
256
|
-
},
|
|
257
|
-
"classification": {
|
|
258
|
-
"type": "string",
|
|
259
|
-
"enum": ["terrestrial", "gas-giant", "ice-giant"]
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
},
|
|
263
|
-
"PlanetPatch": {
|
|
264
|
-
"type": "object",
|
|
265
|
-
"properties": {
|
|
266
|
-
"name": {
|
|
267
|
-
"type": "string",
|
|
268
|
-
"example": "New Mars"
|
|
269
|
-
},
|
|
270
|
-
"classification": {
|
|
271
|
-
"type": "string",
|
|
272
|
-
"enum": ["terrestrial", "gas-giant", "ice-giant"]
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Quickstart
|
|
3
|
-
description: Create, run, and understand your Heyo Docs project.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Quickstart
|
|
7
|
-
|
|
8
|
-
A new Heyo Docs project is a complete documentation site: MDX files provide the
|
|
9
|
-
content, `heyo-docs.config.ts` defines the site model, and your selected
|
|
10
|
-
framework renders the finished experience.
|
|
11
|
-
|
|
12
|
-
## Create a project
|
|
13
|
-
|
|
14
|
-
Use the creator with the package manager you already use. It asks for a project
|
|
15
|
-
name, framework, deployment target, theme, and package manager, then creates a
|
|
16
|
-
ready-to-run application.
|
|
17
|
-
|
|
18
|
-
<CodeBlockGroup defaultValue="bun" variant="line">
|
|
19
|
-
<CodeBlock language="bash" title="bun">
|
|
20
|
-
{"bun create @heyo-sh/heyo-docs"}
|
|
21
|
-
</CodeBlock>
|
|
22
|
-
<CodeBlock language="bash" title="npm">
|
|
23
|
-
{"npm create @heyo-sh/heyo-docs@latest"}
|
|
24
|
-
</CodeBlock>
|
|
25
|
-
<CodeBlock language="bash" title="pnpm">
|
|
26
|
-
{"pnpm create @heyo-sh/heyo-docs"}
|
|
27
|
-
</CodeBlock>
|
|
28
|
-
<CodeBlock language="bash" title="yarn">
|
|
29
|
-
{"yarn dlx @heyo-sh/create-heyo-docs"}
|
|
30
|
-
</CodeBlock>
|
|
31
|
-
</CodeBlockGroup>
|
|
32
|
-
|
|
33
|
-
When the command finishes, move into the new directory and run the development
|
|
34
|
-
command printed by the creator. The local server rebuilds the documentation
|
|
35
|
-
when you change either content or configuration.
|
|
36
|
-
|
|
37
|
-
## How the pieces fit together
|
|
38
|
-
|
|
39
|
-
1. **Content** lives in the `content` directory. Every `.mdx` file becomes a
|
|
40
|
-
documentation route.
|
|
41
|
-
2. **Configuration** in `heyo-docs.config.ts` gives the site its name, theme,
|
|
42
|
-
navigation order, and public metadata.
|
|
43
|
-
3. **The framework app** loads the same model during development and production
|
|
44
|
-
builds, so the sidebar, search, routes, and adjacent-page links stay in sync.
|
|
45
|
-
|
|
46
|
-
Create a new file such as `content/guides/deployment.mdx` to add the
|
|
47
|
-
`/guides/deployment` route. Add that path to a navigation section when the
|
|
48
|
-
page should appear in the sidebar.
|
|
49
|
-
|
|
50
|
-
## Make your first change
|
|
51
|
-
|
|
52
|
-
Update the title and description in the frontmatter of `content/index.mdx`,
|
|
53
|
-
then refresh the browser. Use [Basic Configuration](/configuration) to adjust
|
|
54
|
-
the site model and [Text Styling](/essentials/text-styling) for writing the
|
|
55
|
-
page itself.
|
|
56
|
-
|
|
57
|
-
<Callout type="tip" title="One source of truth">
|
|
58
|
-
Keep navigation in <code>heyo-docs.config.ts</code> and page-specific details
|
|
59
|
-
in MDX frontmatter. The build validates both before publishing.
|
|
60
|
-
</Callout>
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createContext,
|
|
3
|
-
useContext,
|
|
4
|
-
useEffect,
|
|
5
|
-
useState,
|
|
6
|
-
type ReactNode,
|
|
7
|
-
} from "react";
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
applyTheme,
|
|
11
|
-
DEFAULT_THEME,
|
|
12
|
-
getStoredTheme,
|
|
13
|
-
type ResolvedTheme,
|
|
14
|
-
THEME_STORAGE_KEY,
|
|
15
|
-
type Theme,
|
|
16
|
-
} from "../lib/theme";
|
|
17
|
-
|
|
18
|
-
type ThemeProviderProps = {
|
|
19
|
-
children: ReactNode;
|
|
20
|
-
defaultTheme?: Theme;
|
|
21
|
-
storageKey?: string;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
type ThemeProviderState = {
|
|
25
|
-
theme: Theme;
|
|
26
|
-
resolvedTheme: ResolvedTheme;
|
|
27
|
-
mounted: boolean;
|
|
28
|
-
setTheme: (theme: Theme) => void;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
const ThemeProviderContext = createContext<ThemeProviderState | undefined>(
|
|
32
|
-
undefined,
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export function ThemeProvider({
|
|
36
|
-
children,
|
|
37
|
-
defaultTheme = DEFAULT_THEME,
|
|
38
|
-
storageKey = THEME_STORAGE_KEY,
|
|
39
|
-
}: ThemeProviderProps) {
|
|
40
|
-
const [theme, setThemeState] = useState<Theme>(defaultTheme);
|
|
41
|
-
const [resolvedTheme, setResolvedTheme] = useState<ResolvedTheme>(
|
|
42
|
-
defaultTheme === "system" ? "light" : defaultTheme,
|
|
43
|
-
);
|
|
44
|
-
const [mounted, setMounted] = useState(false);
|
|
45
|
-
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
const syncTheme = () => {
|
|
48
|
-
const nextTheme = getStoredTheme(storageKey, defaultTheme);
|
|
49
|
-
|
|
50
|
-
setThemeState(nextTheme);
|
|
51
|
-
setResolvedTheme(applyTheme(nextTheme));
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
syncTheme();
|
|
55
|
-
|
|
56
|
-
const mediaQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
57
|
-
const handleSystemThemeChange = () => {
|
|
58
|
-
const nextTheme = getStoredTheme(storageKey, defaultTheme);
|
|
59
|
-
setResolvedTheme(applyTheme(nextTheme));
|
|
60
|
-
};
|
|
61
|
-
const handleStorage = (event: StorageEvent) => {
|
|
62
|
-
if (event.key !== null && event.key !== storageKey) return;
|
|
63
|
-
syncTheme();
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
mediaQuery.addEventListener("change", handleSystemThemeChange);
|
|
67
|
-
window.addEventListener("storage", handleStorage);
|
|
68
|
-
setMounted(true);
|
|
69
|
-
|
|
70
|
-
return () => {
|
|
71
|
-
mediaQuery.removeEventListener("change", handleSystemThemeChange);
|
|
72
|
-
window.removeEventListener("storage", handleStorage);
|
|
73
|
-
};
|
|
74
|
-
}, [defaultTheme, storageKey]);
|
|
75
|
-
|
|
76
|
-
const value = {
|
|
77
|
-
theme,
|
|
78
|
-
resolvedTheme,
|
|
79
|
-
mounted,
|
|
80
|
-
setTheme: (nextTheme: Theme) => {
|
|
81
|
-
try {
|
|
82
|
-
window.localStorage.setItem(storageKey, nextTheme);
|
|
83
|
-
} catch {
|
|
84
|
-
// The requested preference still applies when storage is unavailable.
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
setThemeState(nextTheme);
|
|
88
|
-
setResolvedTheme(applyTheme(nextTheme));
|
|
89
|
-
},
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
return (
|
|
93
|
-
<ThemeProviderContext.Provider value={value}>
|
|
94
|
-
{children}
|
|
95
|
-
</ThemeProviderContext.Provider>
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export function useTheme() {
|
|
100
|
-
const context = useContext(ThemeProviderContext);
|
|
101
|
-
|
|
102
|
-
if (context === undefined)
|
|
103
|
-
throw new Error("useTheme must be used within a ThemeProvider");
|
|
104
|
-
|
|
105
|
-
return context;
|
|
106
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
export type Theme = "dark" | "light" | "system";
|
|
2
|
-
export type ResolvedTheme = Exclude<Theme, "system">;
|
|
3
|
-
|
|
4
|
-
export const DEFAULT_THEME: Theme = "system";
|
|
5
|
-
export const THEME_STORAGE_KEY = "heyo-docs-theme";
|
|
6
|
-
|
|
7
|
-
const themeValues = new Set<Theme>(["light", "dark", "system"]);
|
|
8
|
-
|
|
9
|
-
export function isTheme(value: string | null): value is Theme {
|
|
10
|
-
return value !== null && themeValues.has(value as Theme);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function getStoredTheme(
|
|
14
|
-
storageKey: string,
|
|
15
|
-
fallbackTheme: Theme,
|
|
16
|
-
): Theme {
|
|
17
|
-
if (typeof window === "undefined") return fallbackTheme;
|
|
18
|
-
|
|
19
|
-
try {
|
|
20
|
-
const storedTheme = window.localStorage.getItem(storageKey);
|
|
21
|
-
return isTheme(storedTheme) ? storedTheme : fallbackTheme;
|
|
22
|
-
} catch {
|
|
23
|
-
return fallbackTheme;
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getSystemTheme(): ResolvedTheme {
|
|
28
|
-
return window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
29
|
-
? "dark"
|
|
30
|
-
: "light";
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function resolveTheme(theme: Theme): ResolvedTheme {
|
|
34
|
-
return theme === "system" ? getSystemTheme() : theme;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function applyTheme(theme: Theme): ResolvedTheme {
|
|
38
|
-
const resolvedTheme = resolveTheme(theme);
|
|
39
|
-
const root = window.document.documentElement;
|
|
40
|
-
|
|
41
|
-
root.classList.remove("light", "dark");
|
|
42
|
-
root.classList.add(resolvedTheme);
|
|
43
|
-
root.style.colorScheme = resolvedTheme;
|
|
44
|
-
|
|
45
|
-
return resolvedTheme;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export function getThemeScript(storageKey: string, defaultTheme: Theme) {
|
|
49
|
-
return `(() => {
|
|
50
|
-
const storageKey = ${JSON.stringify(storageKey)};
|
|
51
|
-
const fallbackTheme = ${JSON.stringify(defaultTheme)};
|
|
52
|
-
const isTheme = (value) => value === "light" || value === "dark" || value === "system";
|
|
53
|
-
|
|
54
|
-
const storedTheme = (() => {
|
|
55
|
-
try {
|
|
56
|
-
const value = window.localStorage.getItem(storageKey);
|
|
57
|
-
return isTheme(value) ? value : fallbackTheme;
|
|
58
|
-
} catch {
|
|
59
|
-
return fallbackTheme;
|
|
60
|
-
}
|
|
61
|
-
})();
|
|
62
|
-
|
|
63
|
-
const resolvedTheme = storedTheme === "system"
|
|
64
|
-
? window.matchMedia("(prefers-color-scheme: dark)").matches
|
|
65
|
-
? "dark"
|
|
66
|
-
: "light"
|
|
67
|
-
: storedTheme;
|
|
68
|
-
|
|
69
|
-
const root = document.documentElement;
|
|
70
|
-
root.classList.remove("light", "dark");
|
|
71
|
-
root.classList.add(resolvedTheme);
|
|
72
|
-
root.style.colorScheme = resolvedTheme;
|
|
73
|
-
})();`;
|
|
74
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: API overview
|
|
3
|
-
description: Learn how to authenticate and explore the API reference.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# API overview
|
|
7
|
-
|
|
8
|
-
The API reference is generated from `openapi.json`. Use the endpoint pages to
|
|
9
|
-
enter parameters, send a request, and copy a cURL or JavaScript example.
|
|
10
|
-
|
|
11
|
-
## Authentication
|
|
12
|
-
|
|
13
|
-
The example API uses a Bearer token. Enter it once on any protected endpoint;
|
|
14
|
-
Heyo Docs keeps it in this browser while you move between API pages.
|
|
15
|
-
|
|
16
|
-
## Custom pages first
|
|
17
|
-
|
|
18
|
-
This ordinary MDX page belongs to the OpenAPI group. Its section is configured
|
|
19
|
-
before the generated endpoint sections, so it always appears at the top of the
|
|
20
|
-
sidebar.
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="960" height="360" viewBox="0 0 960 360" fill="none">
|
|
2
|
-
<rect width="960" height="360" rx="24" fill="#F7F7F8"/>
|
|
3
|
-
<g fill="#FFFFFF" stroke="#D4D4D8" stroke-width="2">
|
|
4
|
-
<rect x="72" y="108" width="220" height="144" rx="18"/>
|
|
5
|
-
<rect x="370" y="108" width="220" height="144" rx="18"/>
|
|
6
|
-
<rect x="668" y="108" width="220" height="144" rx="18"/>
|
|
7
|
-
</g>
|
|
8
|
-
<g fill="#18181B" font-family="Arial, sans-serif" text-anchor="middle">
|
|
9
|
-
<text x="182" y="166" font-size="17" font-weight="700">Content</text>
|
|
10
|
-
<text x="182" y="194" font-size="14" fill="#71717A">MDX and assets</text>
|
|
11
|
-
<text x="480" y="166" font-size="17" font-weight="700">Build</text>
|
|
12
|
-
<text x="480" y="194" font-size="14" fill="#71717A">Vite bundles files</text>
|
|
13
|
-
<text x="778" y="166" font-size="17" font-weight="700">Documentation</text>
|
|
14
|
-
<text x="778" y="194" font-size="14" fill="#71717A">Static output</text>
|
|
15
|
-
</g>
|
|
16
|
-
<g stroke="#71717A" stroke-linecap="round" stroke-width="2">
|
|
17
|
-
<path d="M314 180h34"/>
|
|
18
|
-
<path d="m340 172 8 8-8 8"/>
|
|
19
|
-
<path d="M612 180h34"/>
|
|
20
|
-
<path d="m638 172 8 8-8 8"/>
|
|
21
|
-
</g>
|
|
22
|
-
</svg>
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Changelog
|
|
3
|
-
description: Mock release notes for the Heyo Docs example.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Changelog
|
|
7
|
-
|
|
8
|
-
<Update label="April 2026" tags={["New", "Documentation"]}>
|
|
9
|
-
|
|
10
|
-
## Starter documentation
|
|
11
|
-
|
|
12
|
-
New projects and runnable examples now include a structured Quickstart, basic
|
|
13
|
-
configuration guide, deployment overview, and essential writing patterns.
|
|
14
|
-
|
|
15
|
-
## Square API group
|
|
16
|
-
|
|
17
|
-
The example navigation now keeps the pinned Square OpenAPI schema in its own
|
|
18
|
-
group, making large-schema behaviour easy to inspect.
|
|
19
|
-
|
|
20
|
-
</Update>
|
|
21
|
-
|
|
22
|
-
<Update label="March 2026" tags={["Improved", "Developer experience"]}>
|
|
23
|
-
|
|
24
|
-
## Clearer navigation
|
|
25
|
-
|
|
26
|
-
External documentation links can display an icon, and sidebar groups now keep
|
|
27
|
-
onboarding, API reference, and release notes separate.
|
|
28
|
-
|
|
29
|
-
</Update>
|
|
30
|
-
|
|
31
|
-
<Update label="February 2026" tags={["Fixed"]}>
|
|
32
|
-
|
|
33
|
-
## More predictable previews
|
|
34
|
-
|
|
35
|
-
Preview builds now validate configured routes before mock release notes are
|
|
36
|
-
published.
|
|
37
|
-
|
|
38
|
-
</Update>
|