@terrafirmagreg-team/guide 0.0.0-stage → 1.2.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/package.json +57 -3
- package/src/components/book-switcher.tsx +52 -0
- package/src/components/mdx/guide-entry.tsx +48 -0
- package/src/components/mdx/multiblock.tsx +86 -0
- package/src/components/tree/children.tsx +75 -0
- package/src/components/tree/index.tsx +127 -0
- package/src/components/views/browser.tsx +133 -0
- package/src/components/views/entry/pages.tsx +188 -0
- package/src/components/views/entry/view.tsx +62 -0
- package/src/components/views/kind/links.tsx +112 -0
- package/src/components/views/kind/media.tsx +168 -0
- package/src/components/views/kind/recipe.tsx +89 -0
- package/src/components/views/kind/table.tsx +140 -0
- package/src/components/views/kind/unknown.tsx +24 -0
- package/src/components/views/page/category-body.tsx +58 -0
- package/src/components/views/page/entry-body.tsx +81 -0
- package/src/components/views/page/overview-body.tsx +99 -0
- package/src/components/views/page/text.tsx +58 -0
- package/src/components/views/page/view.tsx +279 -0
- package/src/components/views/text.tsx +132 -0
- package/src/hooks/use-left-sidebar-tree.ts +28 -0
- package/src/hooks/use-tree.ts +35 -0
- package/src/lib/book/convert.ts +75 -0
- package/src/lib/book/index-rows.ts +136 -0
- package/src/lib/book/index.ts +3 -0
- package/src/lib/book/localize.ts +77 -0
- package/src/lib/book/raw.ts +81 -0
- package/src/lib/books.ts +31 -0
- package/src/lib/breadcrumb.ts +56 -0
- package/src/lib/client/guides.ts +262 -0
- package/src/lib/client-payload/extras.ts +103 -0
- package/src/lib/client-payload/index.ts +113 -0
- package/src/lib/client-payload/links.ts +103 -0
- package/src/lib/config.ts +47 -0
- package/src/lib/data/dto.ts +78 -0
- package/src/lib/data/parse.ts +94 -0
- package/src/lib/dump.ts +6 -0
- package/src/lib/embeds.ts +12 -0
- package/src/lib/format.ts +232 -0
- package/src/lib/links.ts +2 -0
- package/src/lib/markdown/book.ts +74 -0
- package/src/lib/markdown/ctx.ts +28 -0
- package/src/lib/markdown/index.ts +9 -0
- package/src/lib/markdown/page.ts +153 -0
- package/src/lib/markdown/table.ts +36 -0
- package/src/lib/markdown/text.ts +40 -0
- package/src/lib/markdown-page.ts +74 -0
- package/src/lib/messages.ts +14 -0
- package/src/lib/meta.ts +10 -0
- package/src/lib/multiblock/index.ts +9 -0
- package/src/lib/multiblock/url.ts +75 -0
- package/src/lib/names.ts +37 -0
- package/src/lib/page-kind.ts +118 -0
- package/src/lib/paths.ts +54 -0
- package/src/lib/preview.ts +37 -0
- package/src/lib/query.ts +29 -0
- package/src/lib/recipe.ts +31 -0
- package/src/lib/reference/index.ts +41 -0
- package/src/lib/reference/resolver.ts +88 -0
- package/src/lib/search/filter.ts +18 -0
- package/src/lib/search/index.ts +183 -0
- package/src/lib/sprites.ts +18 -0
- package/src/lib/table.ts +11 -0
- package/src/lib/toc.ts +138 -0
- package/src/locales/en_us.json +14 -0
- package/src/locales/ru_ru.json +14 -0
- package/src/locales.ts +6 -0
- package/src/types/index.ts +217 -0
- package/README.md +0 -3
package/src/locales.ts
ADDED
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import type { DatasetRef } from '@terrafirmagreg-team/sites/location';
|
|
2
|
+
import type { Lang } from '@terrafirmagreg-team/translate/types/locale';
|
|
3
|
+
import type { DatasetLanding } from '@terrafirmagreg-team/kit/types';
|
|
4
|
+
import type { DumpText } from '@terrafirmagreg-team/dump/lib/dump/contract/text';
|
|
5
|
+
import type {
|
|
6
|
+
ReferenceKind,
|
|
7
|
+
TaggedReference,
|
|
8
|
+
} from '@terrafirmagreg-team/dump/lib/dump/contract/ref';
|
|
9
|
+
import type { GuidePage } from '@terrafirmagreg-team/guide/lib/data/dto';
|
|
10
|
+
import type { AtlasBundle } from '@terrafirmagreg-team/dump/lib/dump/assets/atlas/dto';
|
|
11
|
+
import type { EmbedRecipe } from '@terrafirmagreg-team/kit/types/embeds';
|
|
12
|
+
import type { DumpEntityEntry } from '@terrafirmagreg-team/dump/lib/dump/data/registry/dto';
|
|
13
|
+
import type { PagePreviewData } from '@terrafirmagreg-team/ui/types/preview';
|
|
14
|
+
|
|
15
|
+
export type {
|
|
16
|
+
GuideMultiblock,
|
|
17
|
+
GuidePage,
|
|
18
|
+
GuideTableCell,
|
|
19
|
+
GuideTableLegend,
|
|
20
|
+
} from '@terrafirmagreg-team/guide/lib/data/dto';
|
|
21
|
+
|
|
22
|
+
export type GuideEntry = {
|
|
23
|
+
id: string;
|
|
24
|
+
name?: string;
|
|
25
|
+
category?: string;
|
|
26
|
+
icon?: TaggedReference;
|
|
27
|
+
pages?: GuidePage[];
|
|
28
|
+
order?: number;
|
|
29
|
+
contentLanguage?: Lang;
|
|
30
|
+
|
|
31
|
+
translation?: 'untranslated' | 'partial';
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type GuideEntryRef = {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
icon?: TaggedReference;
|
|
38
|
+
pageCount?: number;
|
|
39
|
+
order?: number;
|
|
40
|
+
translation?: 'untranslated' | 'partial';
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type GuideCategory = {
|
|
44
|
+
id: string;
|
|
45
|
+
name: string;
|
|
46
|
+
description?: string;
|
|
47
|
+
icon?: TaggedReference;
|
|
48
|
+
entries: GuideEntryRef[];
|
|
49
|
+
order?: number;
|
|
50
|
+
translation?: 'untranslated' | 'partial';
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export type GuideBook = {
|
|
54
|
+
id?: string;
|
|
55
|
+
slug: string;
|
|
56
|
+
name: string;
|
|
57
|
+
description?: string;
|
|
58
|
+
landing: DumpText[];
|
|
59
|
+
landingText?: string;
|
|
60
|
+
cover: TaggedReference | null;
|
|
61
|
+
macros?: Record<string, string>;
|
|
62
|
+
translation?: 'untranslated' | 'partial';
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export type GuideIndex = {
|
|
66
|
+
status: 'missing' | 'ready';
|
|
67
|
+
root: string;
|
|
68
|
+
modId: string;
|
|
69
|
+
bookId?: string;
|
|
70
|
+
bookPath?: string;
|
|
71
|
+
bookSlug?: string;
|
|
72
|
+
book: GuideBook | null;
|
|
73
|
+
categories: GuideCategory[];
|
|
74
|
+
entries: GuideEntry[];
|
|
75
|
+
language: Lang;
|
|
76
|
+
isFallback: boolean;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
type GuideMultiblockDef = {
|
|
80
|
+
id: string;
|
|
81
|
+
pattern?: string[][];
|
|
82
|
+
mapping?: Record<string, unknown>;
|
|
83
|
+
glb?: string;
|
|
84
|
+
error?: string | null;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
type GuideEntityRender = {
|
|
88
|
+
path?: string;
|
|
89
|
+
scale?: number;
|
|
90
|
+
offset?: number;
|
|
91
|
+
width?: number;
|
|
92
|
+
height?: number;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export type GuideBookMeta = {
|
|
96
|
+
bookId?: string;
|
|
97
|
+
name?: string;
|
|
98
|
+
multiblockDefs?: GuideMultiblockDef[];
|
|
99
|
+
entityRenders?: Record<string, GuideEntityRender>;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export type GuideFormatNode =
|
|
103
|
+
| {
|
|
104
|
+
type: 'text';
|
|
105
|
+
value: string;
|
|
106
|
+
styles: string[];
|
|
107
|
+
color?: string;
|
|
108
|
+
link?: string;
|
|
109
|
+
tooltip?: string;
|
|
110
|
+
}
|
|
111
|
+
| { type: 'break' }
|
|
112
|
+
| { type: 'keybind'; value: string }
|
|
113
|
+
| { type: 'command'; value: string; label?: string };
|
|
114
|
+
|
|
115
|
+
export type GuideFormatOptions = {
|
|
116
|
+
dataset?: DatasetRef;
|
|
117
|
+
lang?: Lang;
|
|
118
|
+
modId?: string;
|
|
119
|
+
bookPath?: string;
|
|
120
|
+
categoryByEntry?: Map<string, string>;
|
|
121
|
+
macros?: Record<string, string>;
|
|
122
|
+
langMap?: Record<string, string>;
|
|
123
|
+
keybinds?: Record<string, string>;
|
|
124
|
+
questLinks?: Record<string, { filename: string; questId: string }>;
|
|
125
|
+
previews?: Record<string, PagePreviewData>;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export type GuideCategoryRef = {
|
|
129
|
+
id: string;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
type GuideReferenceKind = 'guide' | 'recipe' | 'quest';
|
|
133
|
+
|
|
134
|
+
export type GuideReference = {
|
|
135
|
+
kind: GuideReferenceKind;
|
|
136
|
+
id: string;
|
|
137
|
+
anchor?: string;
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export type ResolvedGuideReference = GuideReference & {
|
|
141
|
+
href?: string;
|
|
142
|
+
available: boolean;
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export type GuideReferenceContext = {
|
|
146
|
+
dataset: DatasetRef;
|
|
147
|
+
lang: Lang;
|
|
148
|
+
modId: string;
|
|
149
|
+
bookPath: string;
|
|
150
|
+
categoryByEntry: Map<string, string>;
|
|
151
|
+
questLinks?: Record<string, { filename: string; questId: string }>;
|
|
152
|
+
targets?: Partial<
|
|
153
|
+
Record<'recipe' | 'quest', (id: string) => string | undefined>
|
|
154
|
+
>;
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export type GuideTocLabels = {
|
|
158
|
+
related?: string;
|
|
159
|
+
objective?: string;
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
export type GuidePageKind = 'pack' | 'overview' | 'category' | 'entry';
|
|
163
|
+
|
|
164
|
+
export type GuidePageData = DatasetLanding;
|
|
165
|
+
|
|
166
|
+
export type PageRendererProps = {
|
|
167
|
+
dataset: DatasetRef;
|
|
168
|
+
lang: Lang;
|
|
169
|
+
bookPath: string;
|
|
170
|
+
page: GuidePage;
|
|
171
|
+
atlases?: Record<string, AtlasBundle>;
|
|
172
|
+
meta: GuideBookMeta;
|
|
173
|
+
bookModId: string;
|
|
174
|
+
categoryByEntry: Map<string, string>;
|
|
175
|
+
langMap: Record<string, string>;
|
|
176
|
+
entryRefs: Map<string, GuideEntryRef>;
|
|
177
|
+
keybinds?: Record<string, string>;
|
|
178
|
+
book?: GuideBook | null;
|
|
179
|
+
extras?: GuideEntryExtras;
|
|
180
|
+
questLinks?: Record<string, { filename: string; questId: string }>;
|
|
181
|
+
previews?: Record<string, PagePreviewData>;
|
|
182
|
+
messages: GuideMessages;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
export type GuideMessages = Record<string, string>;
|
|
186
|
+
|
|
187
|
+
export type GuideEntryExtras = {
|
|
188
|
+
atlases: Record<string, AtlasBundle>;
|
|
189
|
+
keybinds: Record<string, string>;
|
|
190
|
+
recipes: Record<string, EmbedRecipe>;
|
|
191
|
+
entities: Record<string, DumpEntityEntry>;
|
|
192
|
+
entityNames: Record<string, string>;
|
|
193
|
+
glbs: Record<string, string>;
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export type GuidePagePayload = {
|
|
197
|
+
kind: GuidePageKind;
|
|
198
|
+
dataset: DatasetRef;
|
|
199
|
+
lang: Lang;
|
|
200
|
+
title: string;
|
|
201
|
+
modId?: string;
|
|
202
|
+
bookPath?: string;
|
|
203
|
+
description?: string;
|
|
204
|
+
previewIcon?: string;
|
|
205
|
+
previewKind?: ReferenceKind;
|
|
206
|
+
categoryId?: string;
|
|
207
|
+
bookModId?: string;
|
|
208
|
+
book?: GuideBook | null;
|
|
209
|
+
categories?: GuideCategory[];
|
|
210
|
+
entries?: GuideEntry[];
|
|
211
|
+
entry?: GuideEntry;
|
|
212
|
+
extras?: GuideEntryExtras;
|
|
213
|
+
questLinks?: Record<string, { filename: string; questId: string }>;
|
|
214
|
+
previews?: Record<string, PagePreviewData>;
|
|
215
|
+
messages: GuideMessages;
|
|
216
|
+
};
|
|
217
|
+
|
package/README.md
DELETED