@lexibase/rdx-types 1.0.0-beta.5 → 1.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/dist/config.d.ts CHANGED
@@ -1,161 +1,250 @@
1
1
  import type { ComponentType } from 'react'
2
2
  import type { RdxPlugin } from './plugins'
3
3
 
4
- /** @deprecated Legacy development website config. New projects use RdxConfig. */
4
+ /**
5
+ * Public configuration shared by defineConfig, the CLI, runtime and plugins.
6
+ *
7
+ * Set the site name once in metadata.applicationName. Live documentation always
8
+ * lives in docs/; the generated .rdx/ directory is not a customization API.
9
+ *
10
+ * @example
11
+ * export default defineConfig({
12
+ * metadata: { applicationName: 'My documentation' },
13
+ * navbar: { title: '' },
14
+ * homepage: { enabled: false },
15
+ * })
16
+ */
5
17
  export type RDXConfig = {
6
- search?: boolean
7
- TOC?: boolean
8
- /**
9
- * The title of the documentation site.
10
- * Displayed in the navbar and browser tab.
11
- *
12
- */
13
- title: string
14
-
15
18
  /**
16
- * A short description of the project.
17
- * Used for SEO and meta tags.
18
- *
19
+ * Enable local documentation search in the navbar.
20
+ * Search uses the project's content sources; no external service is required.
21
+ * @defaultValue false
19
22
  */
20
- description: string
21
-
23
+ search?: boolean
22
24
  /**
23
- * The name of the author or organization.
24
- * Can be shown in the metadata.
25
- *
25
+ * Enable floating heading navigation on documentation pages.
26
+ * Hidden when a page has too few sections to navigate.
27
+ * @defaultValue false
26
28
  */
27
- author: string
28
-
29
+ TOC?: boolean
29
30
  /**
30
- * Path to the favicon file.
31
- * Must be located at 'public/favicon.ico' by default.
32
- *
31
+ * Default HTML and social-preview description of the project.
32
+ * This does not replace descriptions authored in documents or the homepage.
33
+ * @defaultValue ''
33
34
  */
34
- favicon: string
35
-
35
+ description?: string
36
36
  /**
37
- * The base URL where the documentation is hosted.
38
- * Used for generating canonical links and metadata.
39
- *
37
+ * HTML document language, such as 'en' or 'pt-BR'.
38
+ * This does not automatically translate the interface or documentation.
39
+ * @defaultValue 'en'
40
40
  */
41
- url: string
42
-
41
+ lang?: string
42
+ /** Site identity and SEO options. applicationName is required. */
43
+ metadata: RdxMetadata
44
+ /** Optional landing page. Disabled by default; '/' then redirects to '/docs'. */
45
+ homepage?: RdxHomepage
43
46
  /**
44
- * Theme configuration options.
45
- * If omitted, the default theme is 'system'
46
- *
47
+ * Activated plugin objects, returned by their factories, e.g. versioning().
48
+ * Installing a package alone does not activate it. Hooks run in this order.
49
+ * @defaultValue []
47
50
  */
51
+ plugins?: RdxPlugin[]
52
+ /** Theme preferences for the shared RDX interface. */
48
53
  theme?: {
49
54
  /**
50
- * The default theme to apply on first load.
51
- * Accepted values: 'system', 'dark', or 'light'
52
- *
55
+ * Theme used on first visit, before the user chooses a preference.
56
+ * 'system' follows the operating system's color preference.
57
+ * @defaultValue 'system'
53
58
  */
54
- defaultTheme: string
59
+ defaultTheme?: 'system' | 'dark' | 'light'
55
60
  }
56
-
57
- /**
58
- * Navbar configurations options.
59
- *
60
- */
61
- navbar: {
61
+ /** Logo, optional label and action buttons in the shared navbar. */
62
+ navbar?: {
62
63
  /**
63
- * Title displayed next to the logo in the navbar.
64
- * Leave empty to show only the logo.
65
- *
64
+ * Text beside the logo. Empty or omitted shows only the logo.
65
+ * This does not change metadata.applicationName or browser titles.
66
+ * @defaultValue ''
66
67
  */
67
68
  title?: string
68
-
69
69
  /**
70
- * This logo component is injected via `rdx.config.ts` and must be a valid React component.
71
- * It should accept at least a `className` prop for styling purposes.
72
- * Consumers of the design system can override the default logo by providing their own component,
73
- * such as an inline SVG or image-based logo, allowing full customization of branding.
74
- *
75
- */
76
- logo: ComponentType<{ className?: string }>
77
-
78
- /**
79
- * Configuration for navbar action buttons
80
- *
70
+ * Imported React component accepting an optional className for styling.
71
+ * Pass the component itself, not JSX or an image path. Defaults to the RDX logo.
72
+ * @example
73
+ * logo: MyLogo
81
74
  */
75
+ logo?: ComponentType<{ className?: string }>
76
+ /** Optional GitHub link and theme toggle. Omitted actions remain hidden. */
82
77
  actions?: {
83
- /**
84
- * Configuration for github button
85
- *
86
- */
78
+ /** Show the system/light/dark theme switcher in the navbar. */
79
+ showToggleMode?: boolean
80
+ /** Optional repository link. Both visibility and URL must be specified. */
87
81
  github?: {
88
- /**
89
- * Whether to show the GitHub button in the navbar.
90
- *
91
- */
82
+ /** Whether the repository action is displayed. */
92
83
  visible: boolean
93
84
  /**
94
- * URL of the GitHub repository.
95
- * Used as the target for the GitHub button.
96
- *
85
+ * Absolute HTTP(S) repository URL, or '#' as a temporary placeholder.
86
+ * Real links open in a new tab; the placeholder stays in the current tab.
97
87
  */
98
88
  url: string
99
89
  }
100
-
101
- /**
102
- * Whether to display the theme toggle (system/dark/light) in the navbar.
103
- *
104
- */
105
- showToggleMode?: boolean
106
90
  }
107
91
  }
108
92
  }
109
93
 
110
- /** Public configuration shared by the CLI, runtime, and plugins. */
94
+ /** Options for the built-in landing page or a project-owned home.tsx component. */
111
95
  export type RdxHomepage = {
96
+ /**
97
+ * Show a homepage at '/'. When false or omitted, '/' redirects to '/docs'.
98
+ * @defaultValue false
99
+ */
112
100
  enabled?: boolean
113
- /** Custom project-owned homepage, e.g. import Home from './home'. */
101
+ /**
102
+ * Imported React component that owns the homepage body.
103
+ * The shared navbar remains; built-in title, description and buttons are not
104
+ * injected into this component. Used only when enabled is true.
105
+ * @example
106
+ * component: Home // import Home from './home'
107
+ */
114
108
  component?: ComponentType
109
+ /** Built-in homepage heading. Defaults to metadata.applicationName. */
115
110
  title?: string
111
+ /** Optional text below the built-in heading; omitted means no description. */
116
112
  description?: string
117
- buttons?: { label: string; href: string }[]
113
+ /** Buttons below the built-in description. The first button is primary. */
114
+ buttons?: {
115
+ /** Visible button text and accessible name; must not be empty. */
116
+ label: string
117
+ /** Root-relative path or absolute HTTP(S) URL, e.g. '/docs/init/intro'. */
118
+ href: string
119
+ }[]
118
120
  }
119
121
 
120
- export type RdxConfig = {
121
- /** Local documentation search. Defaults to false. */
122
- search?: boolean
123
- /** Floating table of contents for documentation pages. Defaults to false. */
124
- TOC?: boolean
125
- title: string
126
- description?: string
127
- lang?: string
128
- docsDir?: string
129
- homepage?: RdxHomepage
130
- plugins?: RdxPlugin[]
131
- theme?: {
132
- defaultTheme?: 'system' | 'dark' | 'light'
122
+ /**
123
+ * Portable subset of Next.js metadata, translated by the RDX runtime.
124
+ * Root-relative asset URLs refer to files the project owns in public/.
125
+ * No asset files, deployment domain or global canonical URL are created here.
126
+ */
127
+ export type RdxMetadata = {
128
+ /**
129
+ * Absolute HTTP(S) deployment URL used to resolve relative metadata URLs.
130
+ * Set this to the real public site URL when deploying; no domain is assumed.
131
+ * @example 'https://docs.example.com'
132
+ */
133
+ metadataBase?: string
134
+ /**
135
+ * Required, non-empty site name: the single source of shared branding.
136
+ * Supplies the browser title and page-title suffix, social-preview defaults,
137
+ * footer, accessible logo name and built-in homepage fallback.
138
+ */
139
+ applicationName: string
140
+ /** Optional people or organizations credited in the document's metadata. */
141
+ authors?: {
142
+ /** Author or organization name; independent of the site's applicationName. */
143
+ name: string
144
+ /** Optional absolute HTTP(S) profile or organization URL. */
145
+ url?: string
146
+ }[]
147
+ /** Optional keywords emitted in the document's metadata. */
148
+ keywords?: string[]
149
+ /** Browser and device icons. Referenced files must exist in public/ or online. */
150
+ icons?: {
151
+ /**
152
+ * Browser tab icon URL, or a list of icons with explicit sizes and MIME types.
153
+ * @example '/favicon.ico'
154
+ */
155
+ icon?:
156
+ | string
157
+ | {
158
+ /** Root-relative asset path or absolute HTTP(S) image URL. */
159
+ url: string
160
+ /** Icon dimensions, such as '96x96', or 'any' for a scalable icon. */
161
+ sizes?: string
162
+ /** Image MIME type, such as 'image/png' or 'image/svg+xml'. */
163
+ type?: string
164
+ }[]
165
+ /**
166
+ * Traditional shortcut icon link for browser compatibility.
167
+ * @example '/favicon.ico'
168
+ */
169
+ shortcut?: string
170
+ /**
171
+ * Icon used when adding the site to the home screen on Apple devices.
172
+ * @example '/apple-touch-icon.png'
173
+ */
174
+ apple?: string
133
175
  }
134
- navbar?: {
176
+ /**
177
+ * URL of an existing web app manifest describing the app's name, icons, etc.
178
+ * RDX only emits the link; it does not generate the manifest or enable a PWA.
179
+ * @example '/site.webmanifest'
180
+ */
181
+ manifest?: string
182
+ /** Optional crawler directives; these do not protect content from access. */
183
+ robots?: {
184
+ /** Whether search engines are instructed to index the page. */
185
+ index?: boolean
186
+ /** Whether search engines are instructed to follow links on the page. */
187
+ follow?: boolean
188
+ }
189
+ /** Optional Open Graph link previews. No fixed URL is applied to every page. */
190
+ openGraph?: {
191
+ /** Preview title override; defaults to metadata.applicationName. */
135
192
  title?: string
136
- logo?: ComponentType<{ className?: string }>
137
- actions?: {
138
- showToggleMode?: boolean
139
- github?: {
140
- visible: boolean
141
- url: string
142
- }
143
- }
193
+ /** Preview description override; defaults to the root description. */
194
+ description?: string
195
+ /** Optional site name shown by platforms that support it. */
196
+ siteName?: string
197
+ /** Open Graph locale, e.g. 'pt_BR' (underscore), unlike HTML lang 'pt-BR'. */
198
+ locale?: string
199
+ /** Supported Open Graph content type for the documentation site. */
200
+ type?: 'website'
201
+ /** Preview images. Relative URLs are resolved against metadataBase. */
202
+ images?: {
203
+ /** Root-relative asset path or absolute HTTP(S) image URL. */
204
+ url: string
205
+ /** Actual image width in pixels; a positive integer. */
206
+ width?: number
207
+ /** Actual image height in pixels; a positive integer. */
208
+ height?: number
209
+ /** Accessible description of the image. */
210
+ alt?: string
211
+ }[]
212
+ }
213
+ /** Optional Twitter/X card metadata. */
214
+ twitter?: {
215
+ /** Text-oriented summary or a large-image preview card. */
216
+ card?: 'summary' | 'summary_large_image'
217
+ /** Card title override; defaults to metadata.applicationName. */
218
+ title?: string
219
+ /** Card description override; defaults to the root description. */
220
+ description?: string
221
+ /** Account associated with the site, usually '@account'. */
222
+ site?: string
223
+ /** Account credited as the creator, usually '@account'. */
224
+ creator?: string
225
+ /** Image URLs; root-relative paths are resolved against metadataBase. */
226
+ images?: string[]
144
227
  }
145
228
  }
146
229
 
147
- /** Compatibility alias for projects created by the first beta. */
148
- export type RdxRuntimeConfig = RdxConfig
230
+ /** Compatibility alias for the first beta; points to the same RDXConfig contract. */
231
+ export type RdxRuntimeConfig = RDXConfig
149
232
 
233
+ /** Internal configuration after validation and application of RDX defaults. */
150
234
  export type ResolvedRdxConfig = Omit<
151
- RdxConfig,
152
- 'description' | 'lang' | 'docsDir' | 'theme' | 'plugins' | 'TOC' | 'search'
235
+ RDXConfig,
236
+ 'description' | 'lang' | 'theme' | 'plugins' | 'TOC' | 'search'
153
237
  > & {
238
+ /** Resolved local search activation. */
154
239
  search: boolean
240
+ /** Resolved floating heading navigation activation. */
155
241
  TOC: boolean
242
+ /** Resolved site description; empty when not provided. */
156
243
  description: string
244
+ /** Resolved HTML language; 'en' when not provided. */
157
245
  lang: string
158
- docsDir: string
246
+ /** Resolved initial theme preference. */
159
247
  theme: { defaultTheme: 'system' | 'dark' | 'light' }
248
+ /** Activated plugins, in declaration order. */
160
249
  plugins: RdxPlugin[]
161
250
  }
package/dist/index.d.ts CHANGED
@@ -2,8 +2,8 @@ export { VersionsRaw, MDXLoader, DocLink, DocCategory } from './loaders'
2
2
  export { RdxSearchEntry, RdxSearchIndex } from './search'
3
3
  export {
4
4
  RDXConfig,
5
- RdxConfig,
6
5
  RdxHomepage,
6
+ RdxMetadata,
7
7
  RdxRuntimeConfig,
8
8
  ResolvedRdxConfig,
9
9
  } from './config'
package/dist/plugins.d.ts CHANGED
@@ -28,9 +28,9 @@ export type RdxPlugin = {
28
28
  setup?: (
29
29
  context: RdxPluginContext
30
30
  ) =>
31
- | { sources?: RdxContentSource[] }
31
+ | { sources?: RdxContentSource[]; runtimeFiles?: string[] }
32
32
  | void
33
- | Promise<{ sources?: RdxContentSource[] } | void>
33
+ | Promise<{ sources?: RdxContentSource[]; runtimeFiles?: string[] } | void>
34
34
  commands?: RdxPluginCommand[]
35
35
  }
36
36
 
@@ -39,4 +39,6 @@ export type RdxProject = {
39
39
  config: ResolvedRdxConfig
40
40
  sources: RdxContentSource[]
41
41
  commands: RdxPluginCommand[]
42
+ /** Project-relative files plugins need when serving deployed documentation. */
43
+ runtimeFiles: string[]
42
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lexibase/rdx-types",
3
- "version": "1.0.0-beta.5",
3
+ "version": "1.0.0",
4
4
  "license": "MIT",
5
5
  "description": "Shared TypeScript types for RDX documentation projects.",
6
6
  "types": "./dist/index.d.ts",
@@ -32,7 +32,11 @@
32
32
  "@types/react": "19.3.0",
33
33
  "@rdx/typescript-config": "1.0.0"
34
34
  },
35
+ "engines": {
36
+ "node": "^22.18.0 || ^24.11.0"
37
+ },
35
38
  "scripts": {
39
+ "dev": "node ./build.mjs --watch",
36
40
  "build": "node ./build.mjs",
37
41
  "check-types": "tsc --noEmit"
38
42
  }