-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
299 lines (297 loc) · 12.2 KB
/
Copy pathastro.config.mjs
File metadata and controls
299 lines (297 loc) · 12.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
// @ts-check
import path from "node:path";
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import mdx from "@astrojs/mdx";
import hoconGrammar from "./src/grammars/hocon.tmLanguage.json" with { type: "json" };
// Project-page deployment: https://abstractmenus.github.io/docs/
const SITE = "https://abstractmenus.github.io";
const BASE = "/docs/";
export default defineConfig({
site: SITE,
base: BASE,
trailingSlash: "always",
// Bare /docs/ -> default locale. The destination must include `base`
// because Astro doesn't auto-prepend it for redirect targets.
redirects: {
"/": "/docs/en/",
},
integrations: [
starlight({
title: "AbstractMenus",
description: "Documentation for the AbstractMenus Paper/Folia GUI plugin.",
// Astro 6 requires public-asset URLs to include the configured base.
// Starlight passes this through verbatim into <link rel="icon" href=...>.
favicon: BASE + "favicon.ico",
logo: { src: "./src/assets/logo.png", alt: "AbstractMenus" },
social: [
{ icon: "discord", label: "Discord", href: "https://discord.gg/4VGP3Gv" },
{ icon: "github", label: "GitHub", href: "https://github.com/AbstractMenus" },
],
defaultLocale: "en",
locales: {
// Each locale lives in its own subdirectory under
// src/content/docs/<locale>/, served at /docs/<locale>/.
en: { label: "English", lang: "en" },
ru: { label: "Русский", lang: "ru" },
},
customCss: [
"./src/styles/brand.css",
"./src/styles/examples.css",
],
expressiveCode: {
themes: ["github-dark", "github-light"],
shiki: {
// Custom grammar for HOCON; ```hocon code blocks pick this up.
langs: [/** @type {any} */ (hoconGrammar)],
},
},
sidebar: [
{
label: "Getting Started",
translations: { ru: "Начало работы" },
collapsed: true,
items: [
{ slug: "start/installation" },
{ slug: "start/config" },
{ slug: "start/how-to" },
{ slug: "start/hocon" },
{ slug: "start/faq" },
{ slug: "start/tips" },
],
},
{
label: "Authoring menus",
translations: { ru: "Создание меню" },
collapsed: true,
items: [
{ slug: "general/commands" },
{ slug: "general/menu-structure" },
{ slug: "general/item-format" },
{ slug: "general/activators" },
{ slug: "general/actions" },
{ slug: "general/rules" },
{ slug: "general/variables" },
{ slug: "general/text-colors" },
{ slug: "general/placeholders" },
],
},
{
label: "Techniques",
translations: { ru: "Приёмы" },
collapsed: true,
items: [
{ slug: "advanced/logical" },
{ slug: "advanced/templates" },
{ slug: "advanced/input" },
{ slug: "advanced/animations" },
{ slug: "advanced/generation" },
{ slug: "advanced/drag-and-drop" },
],
},
{
label: "Reference",
translations: { ru: "Справочник" },
collapsed: true,
items: [
{ slug: "general/cheatsheet" },
{ slug: "general/examples" },
],
},
{
label: "For Developers",
translations: { ru: "Для разработчиков" },
collapsed: true,
items: [
{ slug: "developers/general" },
{ slug: "developers/addons" },
{ slug: "developers/own-types" },
{ slug: "developers/handlers" },
{ slug: "developers/serializers" },
{ slug: "developers/variables" },
{ slug: "developers/utils" },
{ slug: "developers/migration" },
],
},
{
label: 'Examples',
translations: { ru: 'Примеры' },
collapsed: true,
items: [
{ slug: 'examples' },
{ slug: 'examples/builder' },
{
label: 'Shops',
translations: { ru: 'Магазины' },
collapsed: true,
autogenerate: { directory: 'examples/shops' },
},
{
label: 'Hub & Navigation',
translations: { ru: 'Хаб и навигация' },
collapsed: true,
autogenerate: { directory: 'examples/hub-and-nav' },
},
{
label: 'Cosmetics',
translations: { ru: 'Косметика' },
collapsed: true,
autogenerate: { directory: 'examples/cosmetics' },
},
{
label: 'Donate',
translations: { ru: 'Донат' },
collapsed: true,
autogenerate: { directory: 'examples/donate' },
},
{
label: 'Casino & Games',
translations: { ru: 'Казино и игры' },
collapsed: true,
autogenerate: { directory: 'examples/casino-and-games' },
},
{
label: 'Kits & Rewards',
translations: { ru: 'Киты и награды' },
collapsed: true,
autogenerate: { directory: 'examples/kits-and-rewards' },
},
{
label: 'Admin Tools',
translations: { ru: 'Админ-инструменты' },
collapsed: true,
autogenerate: { directory: 'examples/admin-tools' },
},
{
label: 'Info Pages',
translations: { ru: 'Инфо-страницы' },
collapsed: true,
autogenerate: { directory: 'examples/info-pages' },
},
{
label: 'State & Variables',
translations: { ru: 'Состояние и переменные' },
collapsed: true,
autogenerate: { directory: 'examples/state-and-vars' },
},
{
label: 'World Integrations',
translations: { ru: 'Интеграции мира' },
collapsed: true,
autogenerate: { directory: 'examples/world-integrations' },
},
{
label: 'Snippets',
translations: { ru: 'Сниппеты' },
collapsed: true,
autogenerate: { directory: 'examples/snippets' },
},
],
},
{
label: 'Playground',
translations: { ru: 'Песочница' },
// Full URL because Starlight rewrites relative links per locale
// (would otherwise become /docs/en/playground/, which 404s).
link: SITE + BASE + 'playground/',
badge: { text: 'beta', variant: 'note' },
attrs: { 'data-playground-link': 'true' },
},
{
slug: "changelog",
attrs: { "data-changelog-link": "true" },
},
],
lastUpdated: true,
pagination: true,
editLink: {
baseUrl:
"https://github.com/AbstractMenus/docs/edit/main/src/content/docs/",
},
// Persist sidebar group open/closed state across page loads + a floating
// action button in the bottom-right of the sidebar that toggles all groups.
// Starlight's `collapsed: true` on each group makes them closed by default;
// this script remembers the user's manual toggles per group via localStorage.
head: [
{
tag: "script",
content: [
"(function(){",
"var KEY='ame-sidebar-groups';",
"function load(){try{return JSON.parse(localStorage.getItem(KEY)||'{}');}catch(e){return {};}}",
"function save(s){try{localStorage.setItem(KEY,JSON.stringify(s));}catch(e){}}",
"var lang=document.documentElement.lang||'en';",
"var L=lang==='ru'?{expand:'Развернуть все',collapse:'Свернуть все'}:{expand:'Expand all',collapse:'Collapse all'};",
"var SVG_ATTRS='width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"';",
"var ICON_EXPAND='<svg class=\"sl-fab-icon sl-fab-icon-expand\" '+SVG_ATTRS+'><polyline points=\"7 6 12 11 17 6\"></polyline><polyline points=\"7 13 12 18 17 13\"></polyline></svg>';",
"var ICON_COLLAPSE='<svg class=\"sl-fab-icon sl-fab-icon-collapse\" '+SVG_ATTRS+'><polyline points=\"17 11 12 6 7 11\"></polyline><polyline points=\"17 18 12 13 7 18\"></polyline></svg>';",
"function init(){",
"var sidebar=document.querySelector('.sidebar-content');",
"if(!sidebar)return;",
"var groups=sidebar.querySelectorAll('details');",
"var seen={};var state=load();",
"groups.forEach(function(d){",
"var summary=d.querySelector(':scope > summary');if(!summary)return;",
"var label=(summary.textContent||'').trim();if(!label||seen[label])return;",
"seen[label]=true;",
"var isActive=d.querySelector('a[aria-current=\"page\"]');",
"if(!isActive&&label in state){d.open=state[label];}",
"d.addEventListener('toggle',function(){var s=load();s[label]=d.open;save(s);refreshFab();});",
"});",
"var existing=document.querySelector('.sl-fab');if(existing)existing.parentNode.removeChild(existing);",
"var btn=document.createElement('button');",
"btn.type='button';btn.className='sl-fab';",
"btn.setAttribute('aria-label',L.expand);",
"btn.innerHTML=ICON_EXPAND+ICON_COLLAPSE+'<span class=\"sl-fab-tooltip\" data-tt>'+L.expand+'</span>';",
"function refreshFab(){",
"var d=sidebar.querySelectorAll('details');var anyOpen=false;",
"d.forEach(function(x){if(x.open)anyOpen=true;});",
"btn.classList.toggle('is-collapse',anyOpen);",
"var tt=btn.querySelector('[data-tt]');",
"if(tt)tt.textContent=anyOpen?L.collapse:L.expand;",
"btn.setAttribute('aria-label',anyOpen?L.collapse:L.expand);",
"}",
"btn.addEventListener('click',function(){",
"var d=sidebar.querySelectorAll('details');var anyOpen=false;",
"d.forEach(function(x){if(x.open)anyOpen=true;});",
"var newOpen=!anyOpen;var s=load();",
"d.forEach(function(x){var sm=x.querySelector(':scope > summary');var lbl=sm?(sm.textContent||'').trim():'';x.open=newOpen;if(lbl)s[lbl]=newOpen;});",
"save(s);refreshFab();",
"});",
"var pane=document.querySelector('.sidebar-pane')||sidebar;",
"pane.appendChild(btn);",
"refreshFab();",
"}",
"if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',init);}else{init();}",
"})();",
].join(""),
},
{
// Sidebar's Playground entry has to be a full URL because Starlight
// would otherwise rewrite a relative path through the locale segment
// and 404. The static URL is a production fallback; this script
// rewrites it to the current origin on every load so the link works
// identically in dev (localhost), preview, and production.
tag: "script",
content: [
"(function(){",
"function fix(){",
"var as=document.querySelectorAll('a[data-playground-link]');",
"for(var i=0;i<as.length;i++){as[i].href=window.location.origin+'" + BASE + "playground/';}",
"}",
"if(document.readyState==='loading'){document.addEventListener('DOMContentLoaded',fix);}else{fix();}",
"})();",
].join(""),
},
],
}),
mdx(),
],
vite: {
resolve: {
alias: {
"@components": path.resolve("./src/components"),
},
},
},
});