|
1 | 1 | import { defineConfig } from 'vitepress' |
2 | 2 |
|
3 | | -// "Blueprint" code palette from the design handoff (docs-page-1d) |
4 | | -const blueprintCodeTheme = { |
5 | | - name: 'blueprint-dark', |
6 | | - type: 'dark', |
7 | | - colors: { |
8 | | - 'editor.background': '#0C1220', |
9 | | - 'editor.foreground': '#C9D4EE', |
10 | | - }, |
11 | | - tokenColors: [ |
12 | | - { scope: ['comment', 'punctuation.definition.comment'], settings: { foreground: '#566184' } }, |
13 | | - { scope: ['keyword', 'storage.type', 'storage.modifier', 'keyword.operator'], settings: { foreground: '#FF7A1A' } }, |
14 | | - { scope: ['string', 'punctuation.definition.string', 'entity.name.function', 'support.function'], settings: { foreground: '#7EA6FF' } }, |
15 | | - { scope: ['constant.numeric', 'constant.language', 'support.constant'], settings: { foreground: '#FFB36B' } }, |
16 | | - { scope: ['variable', 'variable.other', 'entity.name.type', 'entity.name.class', 'support.class'], settings: { foreground: '#C9D4EE' } }, |
17 | | - ], |
18 | | -} |
| 3 | +const guide = [ |
| 4 | + { |
| 5 | + text: 'Get started', |
| 6 | + items: [ |
| 7 | + { text: 'Introduction', link: '/guide/introduction' }, |
| 8 | + { text: 'Installation', link: '/guide/installation' }, |
| 9 | + { text: 'Quick start', link: '/guide/quick-start' }, |
| 10 | + ], |
| 11 | + }, |
| 12 | + { |
| 13 | + text: 'Creating objects', |
| 14 | + items: [ |
| 15 | + { text: 'Hydration', link: '/features/hydration' }, |
| 16 | + { text: 'Validation', link: '/features/validation' }, |
| 17 | + { text: 'Collecting errors', link: '/features/error-accumulation' }, |
| 18 | + { text: 'Optional values', link: '/features/optional' }, |
| 19 | + { text: 'Input pipes', link: '/features/pipes' }, |
| 20 | + ], |
| 21 | + }, |
| 22 | + { |
| 23 | + text: 'Output', |
| 24 | + items: [ |
| 25 | + { text: 'Serialization', link: '/features/serialization' }, |
| 26 | + { text: 'JSON Schema & TypeScript', link: '/features/schema-generation' }, |
| 27 | + ], |
| 28 | + }, |
| 29 | + { |
| 30 | + text: 'Working with objects', |
| 31 | + items: [ |
| 32 | + { text: 'Immutable copies', link: '/features/with' }, |
| 33 | + { text: 'Comparing objects', link: '/features/comparison' }, |
| 34 | + { text: 'Collections', link: '/features/collections' }, |
| 35 | + ], |
| 36 | + }, |
| 37 | + { |
| 38 | + text: 'Large data & production', |
| 39 | + items: [ |
| 40 | + { text: 'Streaming XML', link: '/features/xml' }, |
| 41 | + { text: 'Metadata cache', link: '/features/cache' }, |
| 42 | + { text: 'Performance', link: '/guide/performance' }, |
| 43 | + ], |
| 44 | + }, |
| 45 | + { |
| 46 | + text: 'Coming from another library', |
| 47 | + items: [ |
| 48 | + { text: 'Migrating from laravel-data', link: '/guide/migrating-from-laravel-data' }, |
| 49 | + ], |
| 50 | + }, |
| 51 | +] |
| 52 | + |
| 53 | +const attributes = [ |
| 54 | + { |
| 55 | + text: 'Overview', |
| 56 | + items: [{ text: 'All attributes', link: '/attributes/' }], |
| 57 | + }, |
| 58 | + { |
| 59 | + text: 'Input & mapping', |
| 60 | + items: [ |
| 61 | + { text: '#[MapPropertyName]', link: '/attributes/map-property-name' }, |
| 62 | + { text: '#[MapInputName] / #[MapOutputName]', link: '/attributes/map-input-output-name' }, |
| 63 | + { text: '#[TransformKeys]', link: '/attributes/transform-keys' }, |
| 64 | + { text: '#[Flatten]', link: '/attributes/flatten' }, |
| 65 | + { text: '#[Pipe]', link: '/attributes/pipe' }, |
| 66 | + { text: '#[RejectUnknownKeys]', link: '/attributes/reject-unknown-keys' }, |
| 67 | + ], |
| 68 | + }, |
| 69 | + { |
| 70 | + text: 'Types & validation', |
| 71 | + items: [ |
| 72 | + { text: '#[Cast]', link: '/attributes/cast' }, |
| 73 | + { text: '#[DataCollection]', link: '/attributes/data-collection' }, |
| 74 | + { text: '#[Discriminator]', link: '/attributes/discriminator' }, |
| 75 | + { text: '#[Rules]', link: '/attributes/rules' }, |
| 76 | + { text: '#[InferRules]', link: '/attributes/infer-rules' }, |
| 77 | + ], |
| 78 | + }, |
| 79 | + { |
| 80 | + text: 'Output', |
| 81 | + items: [ |
| 82 | + { text: '#[Hidden]', link: '/attributes/hidden' }, |
| 83 | + { text: '#[IgnoreIfNull]', link: '/attributes/ignore-if-null' }, |
| 84 | + { text: '#[Computed]', link: '/attributes/computed' }, |
| 85 | + { text: '#[WrapIn]', link: '/attributes/wrap-in' }, |
| 86 | + ], |
| 87 | + }, |
| 88 | + { |
| 89 | + text: 'XML & Laravel', |
| 90 | + items: [ |
| 91 | + { text: '#[XmlAttribute] / #[XmlElement] / #[XmlText]', link: '/attributes/xml' }, |
| 92 | + { text: '#[WhenLoaded]', link: '/attributes/when-loaded' }, |
| 93 | + ], |
| 94 | + }, |
| 95 | +] |
| 96 | + |
| 97 | +const casts = [ |
| 98 | + { |
| 99 | + text: 'Overview', |
| 100 | + items: [ |
| 101 | + { text: 'All casts', link: '/casts/' }, |
| 102 | + { text: 'Writing your own', link: '/casts/custom' }, |
| 103 | + ], |
| 104 | + }, |
| 105 | + { |
| 106 | + text: 'Dates & enums', |
| 107 | + items: [ |
| 108 | + { text: 'DateTimeCast', link: '/casts/date-time' }, |
| 109 | + { text: 'EnumCast', link: '/casts/enum' }, |
| 110 | + ], |
| 111 | + }, |
| 112 | + { |
| 113 | + text: 'Scalars', |
| 114 | + items: [ |
| 115 | + { text: 'BooleanCast', link: '/casts/boolean' }, |
| 116 | + { text: 'IntegerCast & FloatCast', link: '/casts/numeric' }, |
| 117 | + { text: 'TrimCast', link: '/casts/trim' }, |
| 118 | + ], |
| 119 | + }, |
| 120 | + { |
| 121 | + text: 'Structured values', |
| 122 | + items: [ |
| 123 | + { text: 'JsonCast', link: '/casts/json' }, |
| 124 | + { text: 'CommaSeparatedCast', link: '/casts/comma-separated' }, |
| 125 | + { text: 'MoneyCast', link: '/casts/money' }, |
| 126 | + { text: 'UuidCast', link: '/casts/uuid' }, |
| 127 | + ], |
| 128 | + }, |
| 129 | + { |
| 130 | + text: 'Security', |
| 131 | + items: [{ text: 'EncryptedCast', link: '/casts/encrypted' }], |
| 132 | + }, |
| 133 | +] |
| 134 | + |
| 135 | +const frameworks = [ |
| 136 | + { |
| 137 | + text: 'Laravel', |
| 138 | + items: [ |
| 139 | + { text: 'Setup in five minutes', link: '/integrations/laravel' }, |
| 140 | + { text: 'Requests, models & responses', link: '/laravel/' }, |
| 141 | + { text: 'Service provider & commands', link: '/laravel/service-provider' }, |
| 142 | + { text: 'Eloquent casting', link: '/laravel/eloquent-casting' }, |
| 143 | + { text: 'Livewire', link: '/laravel/livewire' }, |
| 144 | + { text: 'Pagination & response envelope', link: '/laravel/pagination' }, |
| 145 | + ], |
| 146 | + }, |
| 147 | + { |
| 148 | + text: 'Other environments', |
| 149 | + items: [ |
| 150 | + { text: 'Plain PHP', link: '/integrations/plain-php' }, |
| 151 | + { text: 'Symfony', link: '/integrations/symfony' }, |
| 152 | + { text: 'Slim & PSR-7', link: '/integrations/psr-7' }, |
| 153 | + ], |
| 154 | + }, |
| 155 | +] |
19 | 156 |
|
20 | 157 | export default defineConfig({ |
21 | 158 | title: 'Simple Data Objects', |
22 | 159 | description: 'Lightweight, attribute-driven Data Transfer Objects for PHP 8.4+', |
23 | 160 | base: '/simple-data-objects/', |
24 | 161 |
|
25 | 162 | head: [ |
26 | | - ['link', { rel: 'icon', href: '/simple-data-objects/favicon.ico' }], |
27 | | - ['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }], |
28 | | - ['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }], |
29 | | - ['link', { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap' }], |
| 163 | + ['link', { rel: 'icon', type: 'image/png', href: '/simple-data-objects/favicon.png' }], |
30 | 164 | ], |
31 | 165 |
|
32 | 166 | markdown: { |
33 | | - theme: blueprintCodeTheme, |
| 167 | + theme: { light: 'github-light', dark: 'github-dark' }, |
34 | 168 | }, |
35 | 169 |
|
36 | 170 | themeConfig: { |
| 171 | + logo: { light: '/logo.png', dark: '/logo-dark.png', alt: 'std-out' }, |
| 172 | + |
37 | 173 | nav: [ |
38 | | - { text: 'Guide', link: '/guide/installation' }, |
39 | | - { text: 'Features', link: '/features/hydration' }, |
40 | | - { text: 'Laravel', link: '/laravel/' }, |
41 | | - { text: 'Casts', link: '/casts/' }, |
| 174 | + { text: 'Guide', link: '/guide/introduction', activeMatch: '^/(guide|features)/' }, |
42 | 175 | { |
43 | | - text: 'v2.0 (current)', |
| 176 | + text: 'Reference', |
| 177 | + activeMatch: '^/(attributes|casts)/', |
44 | 178 | items: [ |
45 | | - { text: 'v2.0 (current)', link: '/' }, |
46 | | - { text: 'v1.x (stable)', link: 'https://std-out.github.io/simple-data-objects/v1/' }, |
| 179 | + { text: 'Attributes', link: '/attributes/' }, |
| 180 | + { text: 'Built-in casts', link: '/casts/' }, |
47 | 181 | ], |
48 | 182 | }, |
49 | 183 | { |
50 | | - text: 'GitHub', |
51 | | - link: 'https://github.com/std-out/simple-data-objects', |
| 184 | + text: 'Frameworks', |
| 185 | + activeMatch: '^/(laravel|integrations)/', |
| 186 | + items: [ |
| 187 | + { text: 'Laravel', link: '/integrations/laravel' }, |
| 188 | + { text: 'Plain PHP', link: '/integrations/plain-php' }, |
| 189 | + { text: 'Symfony', link: '/integrations/symfony' }, |
| 190 | + { text: 'Slim & PSR-7', link: '/integrations/psr-7' }, |
| 191 | + ], |
| 192 | + }, |
| 193 | + { text: 'Performance', link: '/guide/performance' }, |
| 194 | + { |
| 195 | + text: 'v2', |
| 196 | + items: [ |
| 197 | + { text: 'v2 (current)', link: '/' }, |
| 198 | + { text: 'v1 (stable)', link: 'https://std-out.github.io/simple-data-objects/v1/' }, |
| 199 | + { text: 'Changelog', link: 'https://github.com/std-out/simple-data-objects/blob/main/CHANGELOG.md' }, |
| 200 | + ], |
52 | 201 | }, |
53 | 202 | ], |
54 | 203 |
|
55 | 204 | sidebar: { |
56 | | - '/laravel/': [ |
57 | | - { |
58 | | - text: 'Laravel', |
59 | | - items: [ |
60 | | - { text: 'Overview', link: '/laravel/' }, |
61 | | - { text: 'Service Provider & Commands', link: '/laravel/service-provider' }, |
62 | | - { text: 'Eloquent Attribute Casting', link: '/laravel/eloquent-casting' }, |
63 | | - { text: 'Livewire Integration', link: '/laravel/livewire' }, |
64 | | - { text: 'Pagination & Response Envelope', link: '/laravel/pagination' }, |
65 | | - { text: '#[WhenLoaded]', link: '/attributes/when-loaded' }, |
66 | | - ], |
67 | | - }, |
68 | | - ], |
| 205 | + '/guide/': guide, |
| 206 | + '/features/': guide, |
| 207 | + '/attributes/': attributes, |
| 208 | + '/casts/': casts, |
| 209 | + '/laravel/': frameworks, |
| 210 | + '/integrations/': frameworks, |
| 211 | + }, |
| 212 | + |
| 213 | + outline: { level: [2, 3], label: 'On this page' }, |
69 | 214 |
|
70 | | - '/': [ |
71 | | - { |
72 | | - text: 'Getting Started', |
73 | | - items: [ |
74 | | - { text: 'Introduction', link: '/guide/introduction' }, |
75 | | - { text: 'Installation', link: '/guide/installation' }, |
76 | | - { text: 'Quick Start', link: '/guide/quick-start' }, |
77 | | - { text: 'Performance', link: '/guide/performance' }, |
78 | | - { text: 'Migrating from spatie/laravel-data', link: '/guide/migrating-from-laravel-data' }, |
79 | | - ], |
80 | | - }, |
81 | | - { |
82 | | - text: 'Features', |
83 | | - items: [ |
84 | | - { text: 'Hydration', link: '/features/hydration' }, |
85 | | - { text: 'Serialization', link: '/features/serialization' }, |
86 | | - { text: 'Validation', link: '/features/validation' }, |
87 | | - { text: 'fromResult() — Error Accumulation', link: '/features/error-accumulation' }, |
88 | | - { text: 'Optional — Absent vs Null', link: '/features/optional' }, |
89 | | - { text: 'Schema Generation — JSON Schema & TypeScript', link: '/features/schema-generation' }, |
90 | | - { text: 'DataPipe — Preprocessing', link: '/features/pipes' }, |
91 | | - { text: 'Immutable Copies — with()', link: '/features/with' }, |
92 | | - { text: 'Comparison — equals() & diff()', link: '/features/comparison' }, |
93 | | - { text: 'Collections', link: '/features/collections' }, |
94 | | - { text: 'Streaming XML', link: '/features/xml' }, |
95 | | - { text: 'Metadata Cache', link: '/features/cache' }, |
96 | | - ], |
97 | | - }, |
98 | | - { |
99 | | - text: 'Integrations', |
100 | | - items: [ |
101 | | - { text: 'Plain PHP', link: '/integrations/plain-php' }, |
102 | | - { text: 'Laravel', link: '/integrations/laravel' }, |
103 | | - { text: 'Symfony', link: '/integrations/symfony' }, |
104 | | - { text: 'Slim & PSR-7', link: '/integrations/psr-7' }, |
105 | | - ], |
106 | | - }, |
107 | | - { |
108 | | - text: 'Attributes', |
109 | | - items: [ |
110 | | - { text: 'Overview', link: '/attributes/' }, |
111 | | - { text: '#[Cast]', link: '/attributes/cast' }, |
112 | | - { text: '#[Rules]', link: '/attributes/rules' }, |
113 | | - { text: '#[InferRules]', link: '/attributes/infer-rules' }, |
114 | | - { text: '#[Pipe]', link: '/attributes/pipe' }, |
115 | | - { text: '#[Flatten]', link: '/attributes/flatten' }, |
116 | | - { text: '#[Hidden]', link: '/attributes/hidden' }, |
117 | | - { text: '#[IgnoreIfNull]', link: '/attributes/ignore-if-null' }, |
118 | | - { text: '#[Computed]', link: '/attributes/computed' }, |
119 | | - { text: '#[MapPropertyName]', link: '/attributes/map-property-name' }, |
120 | | - { text: '#[MapInputName] / #[MapOutputName]', link: '/attributes/map-input-output-name' }, |
121 | | - { text: '#[TransformKeys]', link: '/attributes/transform-keys' }, |
122 | | - { text: '#[Discriminator]', link: '/attributes/discriminator' }, |
123 | | - { text: '#[DataCollection]', link: '/attributes/data-collection' }, |
124 | | - { text: '#[WhenLoaded]', link: '/attributes/when-loaded' }, |
125 | | - { text: '#[RejectUnknownKeys]', link: '/attributes/reject-unknown-keys' }, |
126 | | - { text: '#[WrapIn]', link: '/attributes/wrap-in' }, |
127 | | - { text: '#[XmlAttribute] / #[XmlElement] / #[XmlText]', link: '/attributes/xml' }, |
128 | | - ], |
129 | | - }, |
130 | | - { |
131 | | - text: 'Built-in Casts', |
132 | | - items: [ |
133 | | - { text: 'Overview', link: '/casts/' }, |
134 | | - { text: 'DateTimeCast', link: '/casts/date-time' }, |
135 | | - { text: 'EnumCast', link: '/casts/enum' }, |
136 | | - { text: 'BooleanCast', link: '/casts/boolean' }, |
137 | | - { text: 'IntegerCast & FloatCast', link: '/casts/numeric' }, |
138 | | - { text: 'TrimCast', link: '/casts/trim' }, |
139 | | - { text: 'JsonCast', link: '/casts/json' }, |
140 | | - { text: 'EncryptedCast', link: '/casts/encrypted' }, |
141 | | - { text: 'UuidCast', link: '/casts/uuid' }, |
142 | | - { text: 'CommaSeparatedCast', link: '/casts/comma-separated' }, |
143 | | - { text: 'MoneyCast', link: '/casts/money' }, |
144 | | - { text: 'Custom Casts', link: '/casts/custom' }, |
145 | | - ], |
146 | | - }, |
147 | | - ], |
| 215 | + editLink: { |
| 216 | + pattern: 'https://github.com/std-out/simple-data-objects/edit/main/docs/:path', |
| 217 | + text: 'Suggest a change to this page', |
148 | 218 | }, |
149 | 219 |
|
150 | 220 | socialLinks: [ |
|
0 commit comments