@glyphjs/runtime 0.1.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.
@@ -0,0 +1,570 @@
1
+ import { GlyphRuntimeConfig, GlyphRuntime, GlyphIR, AnimationConfig, Diagnostic, Block, LayoutHints, ContainerContext, GlyphComponentDefinition, ComponentType, BlockProps, GlyphTheme, Reference, GlyphThemeContext, GlyphComponentProps, InlineNode, ContainerTier } from '@glyphjs/types';
2
+ export { AnimationConfig } from '@glyphjs/types';
3
+ import * as react from 'react';
4
+ import { ReactNode, Component, ErrorInfo, CSSProperties, ComponentType as ComponentType$1, RefObject } from 'react';
5
+
6
+ /**
7
+ * Creates a fully configured Glyph runtime instance.
8
+ *
9
+ * Returns a `GlyphRuntime` object containing:
10
+ * - `GlyphDocument` — A React component pre-wired with the config
11
+ * - `registerComponent()` — Dynamically add component definitions
12
+ * - `setTheme()` — Update the theme (triggers re-render)
13
+ */
14
+ declare function createGlyphRuntime(config: GlyphRuntimeConfig): GlyphRuntime;
15
+
16
+ interface GlyphDocumentProps {
17
+ ir: GlyphIR;
18
+ className?: string;
19
+ animation?: AnimationConfig;
20
+ diagnostics?: Diagnostic[];
21
+ }
22
+ /**
23
+ * Renders a complete GlyphIR document.
24
+ * Selects the appropriate layout component based on `ir.layout.mode`
25
+ * and renders each block via `BlockRenderer`.
26
+ * Expects to be wrapped in a `RuntimeProvider` (either directly
27
+ * or via the `createGlyphRuntime()` factory).
28
+ */
29
+ declare function GlyphDocument({ ir, className, animation, diagnostics, }: GlyphDocumentProps): ReactNode;
30
+
31
+ interface BlockRendererProps {
32
+ block: Block;
33
+ layout: LayoutHints;
34
+ /** Position index used for stagger animation delay. */
35
+ index?: number;
36
+ /** Container measurement context for responsive adaptation. */
37
+ container: ContainerContext;
38
+ }
39
+ /**
40
+ * Renders a single Block by dispatching to the correct renderer.
41
+ * Each block is wrapped in its own ErrorBoundary so a failure
42
+ * in one block does not crash the rest of the document.
43
+ * When an `index` is provided, the block wrapper applies an
44
+ * entry animation with stagger delay via `useBlockAnimation`.
45
+ */
46
+ declare function BlockRenderer({ block, layout, index, container, }: BlockRendererProps): ReactNode;
47
+
48
+ interface ErrorBoundaryProps {
49
+ blockId: string;
50
+ blockType: string;
51
+ onDiagnostic: (diagnostic: Diagnostic) => void;
52
+ children: ReactNode;
53
+ }
54
+ interface ErrorBoundaryState {
55
+ hasError: boolean;
56
+ error: Error | null;
57
+ }
58
+ /**
59
+ * Per-block error boundary that catches render errors.
60
+ * Reports diagnostics via the onDiagnostic callback and renders
61
+ * a fallback UI instead of crashing the entire document.
62
+ */
63
+ declare class ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {
64
+ constructor(props: ErrorBoundaryProps);
65
+ static getDerivedStateFromError(error: Error): ErrorBoundaryState;
66
+ componentDidCatch(error: Error, info: ErrorInfo): void;
67
+ render(): ReactNode;
68
+ }
69
+
70
+ interface FallbackRendererProps {
71
+ block: Block;
72
+ }
73
+ /**
74
+ * Fallback renderer for unknown or unregistered block types.
75
+ * Renders the block type name and a stringified preview of the raw data.
76
+ * Styled subtly so it is visible during development but not intrusive.
77
+ */
78
+ declare function FallbackRenderer({ block }: FallbackRendererProps): ReactNode;
79
+
80
+ /**
81
+ * Listener function invoked when the registry changes.
82
+ */
83
+ type RegistryChangeListener = () => void;
84
+ /**
85
+ * Enhanced plugin registry that adds validation, theme defaults
86
+ * merging, and change notification on top of the base ComponentRegistry.
87
+ *
88
+ * This class replaces the original `ComponentRegistry` with a
89
+ * superset of its API so existing consumers continue to work.
90
+ */
91
+ declare class PluginRegistry {
92
+ private components;
93
+ private overrides;
94
+ private listeners;
95
+ private themeDefaults;
96
+ /**
97
+ * Register a `ui:*` component plugin definition.
98
+ * Validates the definition first; throws if invalid.
99
+ * Merges any `themeDefaults` from the definition into
100
+ * the accumulated theme defaults map.
101
+ *
102
+ * @param definition - The component definition to register.
103
+ * @throws Error if the definition fails validation.
104
+ */
105
+ registerComponent(definition: GlyphComponentDefinition): void;
106
+ /** Bulk-register an array of component definitions. */
107
+ registerAll(definitions: GlyphComponentDefinition[]): void;
108
+ /** Set override renderers (keyed by block type). */
109
+ setOverrides(overrides: Partial<Record<string, ComponentType<BlockProps>>>): void;
110
+ /** Get a registered `ui:*` component definition. */
111
+ getRenderer(blockType: string): GlyphComponentDefinition | undefined;
112
+ /** Get an override renderer for any block type. */
113
+ getOverride(blockType: string): ComponentType<BlockProps> | undefined;
114
+ /** Check if a component type is registered. */
115
+ has(blockType: string): boolean;
116
+ /** Get all registered component type names. */
117
+ getRegisteredTypes(): string[];
118
+ /**
119
+ * Returns the accumulated theme defaults from all registered
120
+ * component definitions. These can be merged into a GlyphTheme
121
+ * to provide sensible defaults for plugin-specific variables.
122
+ */
123
+ getThemeDefaults(): Record<string, string>;
124
+ /**
125
+ * Merge accumulated plugin theme defaults into a GlyphTheme.
126
+ * Plugin defaults have lower priority than existing theme variables.
127
+ *
128
+ * @param theme - The base theme to merge defaults into.
129
+ * @returns A new GlyphTheme with plugin defaults applied under existing variables.
130
+ */
131
+ mergeThemeDefaults(theme: GlyphTheme): GlyphTheme;
132
+ /**
133
+ * Subscribe to registry changes.
134
+ *
135
+ * @param listener - Callback invoked whenever a component or override is registered.
136
+ * @returns An unsubscribe function that removes the listener.
137
+ */
138
+ subscribe(listener: RegistryChangeListener): () => void;
139
+ private notify;
140
+ }
141
+
142
+ interface RuntimeContextValue {
143
+ registry: PluginRegistry;
144
+ references: Reference[];
145
+ theme: GlyphThemeContext;
146
+ onDiagnostic: (diagnostic: Diagnostic) => void;
147
+ onNavigate: (ref: Reference, targetBlock: Block) => void;
148
+ }
149
+ interface RuntimeProviderProps {
150
+ registry: PluginRegistry;
151
+ references: Reference[];
152
+ theme: 'light' | 'dark' | GlyphTheme | undefined;
153
+ /** Optional CSS class name applied to the runtime wrapper div. */
154
+ className?: string;
155
+ /** Optional inline styles merged with (and overriding) theme CSS variables. */
156
+ style?: CSSProperties;
157
+ onDiagnostic?: (diagnostic: Diagnostic) => void;
158
+ onNavigate?: (ref: Reference, targetBlock: Block) => void;
159
+ children: ReactNode;
160
+ }
161
+ declare function RuntimeProvider({ registry, references, theme, className, style: consumerStyle, onDiagnostic, onNavigate, children, }: RuntimeProviderProps): ReactNode;
162
+ /** Access the full runtime context. Throws if used outside RuntimeProvider. */
163
+ declare function useRuntime(): RuntimeContextValue;
164
+ /**
165
+ * Get incoming and outgoing references for a specific block.
166
+ */
167
+ declare function useReferences(blockId: string): {
168
+ incomingRefs: Reference[];
169
+ outgoingRefs: Reference[];
170
+ };
171
+
172
+ interface ValidationResult {
173
+ valid: boolean;
174
+ errors: string[];
175
+ }
176
+ /**
177
+ * Validates a GlyphComponentDefinition before registration.
178
+ *
179
+ * Checks:
180
+ * 1. `type` must match the `ui:${string}` format
181
+ * 2. `schema` must be present with `parse` and `safeParse` methods
182
+ * 3. `render` must be present and be a function or class
183
+ *
184
+ * @param definition - The component definition to validate.
185
+ * @returns A ValidationResult with `valid` (boolean) and `errors` (string[]).
186
+ */
187
+ declare function validateComponentDefinition(definition: GlyphComponentDefinition): ValidationResult;
188
+
189
+ /**
190
+ * Assembles the full `GlyphComponentProps` for a ui:* component.
191
+ *
192
+ * - Parses `block.data` through the component's Zod schema (via `safeParse`)
193
+ * - Filters outgoing refs: references where `sourceBlockId === block.id`
194
+ * (plus bidirectional refs where `targetBlockId === block.id`)
195
+ * - Filters incoming refs: references where `targetBlockId === block.id`
196
+ * (plus bidirectional refs where `sourceBlockId === block.id`)
197
+ * - Wires the `onNavigate` callback
198
+ * - Passes theme context and layout hints
199
+ *
200
+ * @param block - The IR block to resolve props for.
201
+ * @param definition - The registered component definition (provides the Zod schema).
202
+ * @param references - All references in the document (filtered to this block).
203
+ * @param onNavigate - Callback invoked when the component triggers navigation via a reference.
204
+ * @param themeContext - Current theme context passed through to the component.
205
+ * @param layoutHints - Layout hints (e.g., viewport size, container width) for responsive rendering.
206
+ * @param containerContext - Container measurement context for container-adaptive layout.
207
+ * @returns Fully assembled GlyphComponentProps ready to pass to the component's render function.
208
+ */
209
+ declare function resolveComponentProps<T = unknown>(block: Block, definition: GlyphComponentDefinition<T>, references: Reference[], onNavigate: (ref: Reference) => void, themeContext: GlyphThemeContext, layoutHints: LayoutHints, containerContext: ContainerContext): GlyphComponentProps<T>;
210
+
211
+ interface LayoutProviderProps {
212
+ layout: LayoutHints;
213
+ children: ReactNode;
214
+ }
215
+ /**
216
+ * Provides layout hints to the component tree.
217
+ * Wraps children in a `LayoutContext` so any descendant
218
+ * can call `useLayout()` to access the active layout.
219
+ */
220
+ declare function LayoutProvider({ layout, children, }: LayoutProviderProps): ReactNode;
221
+ /**
222
+ * Access the current layout hints from the nearest `LayoutProvider`.
223
+ * Falls back to the default document layout if no provider is found.
224
+ */
225
+ declare function useLayout(): LayoutHints;
226
+
227
+ interface DocumentLayoutProps {
228
+ blocks: Block[];
229
+ layout: LayoutHints;
230
+ renderBlock: (block: Block, index: number) => ReactNode;
231
+ }
232
+ /**
233
+ * Document mode layout — single-column vertical flow.
234
+ *
235
+ * Applies configurable `maxWidth` and inter-block spacing.
236
+ */
237
+ declare function DocumentLayout({ blocks, layout, renderBlock, }: DocumentLayoutProps): ReactNode;
238
+
239
+ interface DashboardLayoutProps {
240
+ blocks: Block[];
241
+ layout: LayoutHints;
242
+ renderBlock: (block: Block, index: number) => ReactNode;
243
+ }
244
+ /**
245
+ * Dashboard mode layout — CSS grid with configurable columns.
246
+ *
247
+ * Supports per-block placement overrides via `layout.blockLayout`.
248
+ * Blocks without overrides flow naturally in the grid.
249
+ */
250
+ declare function DashboardLayout({ blocks, layout, renderBlock, }: DashboardLayoutProps): ReactNode;
251
+
252
+ interface PresentationLayoutProps {
253
+ blocks: Block[];
254
+ renderBlock: (block: Block, index: number) => ReactNode;
255
+ }
256
+ /**
257
+ * Presentation mode layout — full-viewport slides.
258
+ *
259
+ * Displays one block at a time with keyboard navigation
260
+ * (left/up for previous, right/down/space for next).
261
+ * Shows a slide indicator in the bottom-right corner.
262
+ */
263
+ declare function PresentationLayout({ blocks, renderBlock, }: PresentationLayoutProps): ReactNode;
264
+
265
+ interface InlineRendererProps {
266
+ nodes: InlineNode[];
267
+ }
268
+ /**
269
+ * Recursively renders an array of InlineNode values into React elements.
270
+ * Handles text, strong, emphasis, delete, inlineCode, link, image, and break.
271
+ * Links with `#glyph:block-id` URLs are rendered as navigable cross-block
272
+ * references that smooth-scroll to the target block on click.
273
+ */
274
+ declare function InlineRenderer({ nodes }: InlineRendererProps): ReactNode;
275
+
276
+ /**
277
+ * Renders a heading block (`<h1>` through `<h6>`) based on `data.depth`.
278
+ * Generates an `id` attribute from the heading text for anchor links.
279
+ */
280
+ declare function GlyphHeading({ block }: BlockProps): ReactNode;
281
+
282
+ /**
283
+ * Renders a paragraph block with inline content.
284
+ */
285
+ declare function GlyphParagraph({ block }: BlockProps): ReactNode;
286
+
287
+ /**
288
+ * Renders a list block as `<ol>` or `<ul>` based on `data.ordered`.
289
+ * Supports `start` attribute for ordered lists and nested sub-lists.
290
+ */
291
+ declare function GlyphList({ block }: BlockProps): ReactNode;
292
+
293
+ /**
294
+ * Renders a fenced code block as `<pre><code>`.
295
+ * Adds a `data-language` attribute and a `language-{lang}` CSS class
296
+ * so users can integrate their own syntax highlighter (e.g. Prism, Shiki).
297
+ */
298
+ declare function GlyphCodeBlock({ block }: BlockProps): ReactNode;
299
+
300
+ /**
301
+ * Renders a blockquote with inline content.
302
+ */
303
+ declare function GlyphBlockquote({ block }: BlockProps): ReactNode;
304
+
305
+ /**
306
+ * Renders an image block as a `<figure>` containing an `<img>` with lazy loading.
307
+ * If `data.title` is present, renders a `<figcaption>`.
308
+ */
309
+ declare function GlyphImage({ block }: BlockProps): ReactNode;
310
+
311
+ /**
312
+ * Renders a thematic break (horizontal rule).
313
+ */
314
+ declare function GlyphThematicBreak(_props: BlockProps): ReactNode;
315
+
316
+ /**
317
+ * Renders raw HTML content sanitized with DOMPurify.
318
+ * Removes dangerous elements, attributes, and URLs to prevent XSS.
319
+ */
320
+ declare function GlyphRawHtml({ block }: BlockProps): ReactNode;
321
+
322
+ /**
323
+ * Maps standard Markdown block type strings to their built-in
324
+ * renderer components. Used by `BlockRenderer` to resolve
325
+ * standard blocks before falling back to the unknown-type fallback.
326
+ */
327
+ declare const builtInRenderers: Record<string, ComponentType$1<BlockProps>>;
328
+
329
+ /**
330
+ * Built-in light theme.
331
+ *
332
+ * Provides all `--glyph-*` CSS variables with values suitable for
333
+ * light backgrounds and dark text. Palette inspired by the Oblivion
334
+ * neon-on-dark design language — cool off-whites, teal accents,
335
+ * generous radii.
336
+ */
337
+ declare const lightTheme: GlyphTheme;
338
+
339
+ /**
340
+ * Built-in dark theme.
341
+ *
342
+ * Provides all `--glyph-*` CSS variables with values suitable for
343
+ * dark backgrounds and light text. Palette inspired by the Oblivion
344
+ * neon-on-dark design language — deep navy blacks, neon cyan-green
345
+ * accents, generous radii.
346
+ */
347
+ declare const darkTheme: GlyphTheme;
348
+
349
+ /**
350
+ * Resolves a theme value — either a string shortcut (`'light'` / `'dark'`)
351
+ * or a full `GlyphTheme` object — into a concrete `GlyphTheme`.
352
+ *
353
+ * When `undefined` is passed, defaults to the light theme.
354
+ */
355
+ declare function resolveTheme(theme: 'light' | 'dark' | GlyphTheme | undefined): GlyphTheme;
356
+ /**
357
+ * Merges component-specific theme defaults into a theme's variable map.
358
+ *
359
+ * Variables already present in `theme.variables` take precedence. Only
360
+ * keys from `defaults` that are absent in the theme are added.
361
+ *
362
+ * Returns a new theme object — the original is not mutated.
363
+ */
364
+ declare function mergeThemeDefaults(theme: GlyphTheme, defaults: Record<string, string>): GlyphTheme;
365
+ /**
366
+ * Creates a `resolveVar` function bound to a given theme.
367
+ *
368
+ * The returned function takes a CSS variable name (e.g. `'--glyph-bg'`) and
369
+ * returns the value defined in the theme, or an empty string if the variable
370
+ * is not present.
371
+ */
372
+ declare function createResolveVar(theme: GlyphTheme): (varName: string) => string;
373
+ /**
374
+ * Heuristic check for whether a theme is a "dark" theme.
375
+ *
376
+ * Inspects the `--glyph-bg` variable: if its perceived luminance is below
377
+ * the midpoint it is considered dark. Falls back to checking whether the
378
+ * theme name contains the substring "dark" (case-insensitive).
379
+ */
380
+ declare function isDarkTheme(theme: GlyphTheme): boolean;
381
+
382
+ interface ThemeProviderProps {
383
+ /** A theme shortcut string or a full GlyphTheme object. */
384
+ theme?: 'light' | 'dark' | GlyphTheme;
385
+ /** Optional CSS class name applied to the theme wrapper div. */
386
+ className?: string;
387
+ /** Optional inline styles merged with (and overriding) theme CSS variables. */
388
+ style?: CSSProperties;
389
+ children: ReactNode;
390
+ }
391
+ /**
392
+ * Applies a Glyph theme to its children.
393
+ *
394
+ * Resolves the theme to a full `GlyphTheme` object, then renders a wrapper
395
+ * `<div>` with all `--glyph-*` CSS variables applied as inline styles.
396
+ * Descendants can read theme values via `useGlyphTheme()`.
397
+ */
398
+ declare function ThemeProvider({ theme, className, style: consumerStyle, children, }: ThemeProviderProps): ReactNode;
399
+ /**
400
+ * Returns the current `GlyphThemeContext`.
401
+ *
402
+ * Must be used inside a `<ThemeProvider>` or the `<RuntimeProvider>`
403
+ * from `createGlyphRuntime()`.
404
+ *
405
+ * @throws if called outside a theme context.
406
+ */
407
+ declare function useGlyphTheme(): GlyphThemeContext;
408
+
409
+ interface AnimationState {
410
+ enabled: boolean;
411
+ duration: number;
412
+ easing: string;
413
+ staggerDelay: number;
414
+ }
415
+ declare const AnimationContext: react.Context<AnimationState>;
416
+ interface AnimationProviderProps {
417
+ config?: AnimationConfig;
418
+ children: ReactNode;
419
+ }
420
+ /**
421
+ * Provides animation configuration to the component tree.
422
+ * Merges partial user config with sensible defaults.
423
+ */
424
+ declare function AnimationProvider({ config, children, }: AnimationProviderProps): ReactNode;
425
+ /**
426
+ * Returns the current animation configuration.
427
+ * Falls back to defaults if no `AnimationProvider` is found.
428
+ */
429
+ declare function useAnimation(): AnimationState;
430
+
431
+ interface BlockAnimationResult {
432
+ /** Attach to the block wrapper element. */
433
+ ref: RefObject<HTMLDivElement | null>;
434
+ /** Inline styles that drive the entry animation. */
435
+ style: CSSProperties;
436
+ /** Whether the block has entered the viewport. */
437
+ isVisible: boolean;
438
+ }
439
+ /**
440
+ * Per-block entry animation powered by Intersection Observer.
441
+ *
442
+ * Returns a `ref` to attach to the block wrapper, an inline `style`
443
+ * object that drives the CSS transition, and an `isVisible` flag.
444
+ *
445
+ * Animations are skipped when:
446
+ * - The animation config has `enabled: false`
447
+ * - The user has `prefers-reduced-motion: reduce` set
448
+ *
449
+ * @param index - The block's position in the document, used for stagger delay.
450
+ */
451
+ declare function useBlockAnimation(index: number): BlockAnimationResult;
452
+
453
+ interface DiagnosticsOverlayProps {
454
+ diagnostics: Diagnostic[];
455
+ }
456
+ /**
457
+ * Dev-mode overlay that displays compilation diagnostics.
458
+ * Shows an aggregate summary and a scrollable list of diagnostics
459
+ * with severity icons/colors, codes, messages, and source positions.
460
+ * Dismissable via a close button or the Escape key.
461
+ * Only rendered when diagnostics are present.
462
+ */
463
+ declare function DiagnosticsOverlay({ diagnostics, }: DiagnosticsOverlayProps): ReactNode;
464
+
465
+ interface BlockDiagnosticIndicatorProps {
466
+ diagnostics: Diagnostic[];
467
+ }
468
+ /**
469
+ * Per-block indicator badge for blocks that have diagnostics.
470
+ * Displays a small color-coded icon; click to expand inline details.
471
+ */
472
+ declare function BlockDiagnosticIndicator({ diagnostics, }: BlockDiagnosticIndicatorProps): ReactNode;
473
+
474
+ interface ReferenceIndicatorProps {
475
+ blockId: string;
476
+ }
477
+ /**
478
+ * Renders clickable reference badges for a given block.
479
+ *
480
+ * - Outgoing references are shown as " -> target-label"
481
+ * - Incoming references are shown as " <- source-label"
482
+ * - Clicking a badge navigates (smooth-scroll + highlight) to the
483
+ * referenced block.
484
+ */
485
+ declare function ReferenceIndicator({ blockId, }: ReferenceIndicatorProps): ReactNode;
486
+
487
+ interface NavigationResult {
488
+ /**
489
+ * Smooth-scroll to a block by ID, highlight it briefly, and
490
+ * move focus. Also fires the runtime `onNavigate` callback.
491
+ */
492
+ navigateTo: (blockId: string, ref?: Reference) => void;
493
+ }
494
+ /**
495
+ * Provides cross-block navigation utilities.
496
+ *
497
+ * - Smooth-scrolls the target block into view
498
+ * - Applies a temporary highlight via a `data-glyph-highlight` attribute
499
+ * - Moves DOM focus to the block for keyboard users
500
+ * - Announces the navigation to screen readers via an `aria-live` region
501
+ * - Invokes the `onNavigate` callback from the runtime config
502
+ */
503
+ declare function useNavigation(): NavigationResult;
504
+
505
+ /**
506
+ * Resolves the container tier from a measured width with hysteresis.
507
+ *
508
+ * When growing, transitions use the higher threshold (500, 900).
509
+ * When shrinking, transitions use the lower threshold (484, 884).
510
+ * A width of 0 (not yet measured) defaults to `'wide'`.
511
+ */
512
+ declare function resolveTier(width: number, previous: ContainerTier): ContainerTier;
513
+
514
+ interface ContainerMeasureProps {
515
+ children: ReactNode;
516
+ /** Stable callback invoked with the container's content width in px. */
517
+ onMeasure: (width: number) => void;
518
+ }
519
+ /**
520
+ * Wraps children in a block-level div and reports its content width
521
+ * via ResizeObserver. The wrapper uses `width: 100%` and does not
522
+ * alter the layout of its children.
523
+ *
524
+ * `onMeasure` should be a stable reference (e.g. a `setState` setter)
525
+ * to avoid unnecessary observer teardown/setup.
526
+ */
527
+ declare function ContainerMeasure({ children, onMeasure }: ContainerMeasureProps): ReactNode;
528
+
529
+ /**
530
+ * Returns `true` once the component has mounted on the client.
531
+ *
532
+ * During server-side rendering (SSR) and the initial client render
533
+ * before hydration completes, this returns `false`. After the first
534
+ * `useEffect` fires (client only), it flips to `true`.
535
+ *
536
+ * Use this to gate browser-only code paths (e.g. D3 rendering,
537
+ * ResizeObserver, window access) so they are skipped during SSR.
538
+ */
539
+ declare function useIsClient(): boolean;
540
+
541
+ interface SSRPlaceholderProps {
542
+ /** Width of the placeholder element (CSS value). Defaults to `'100%'`. */
543
+ width?: string | number;
544
+ /** Height of the placeholder element (CSS value). Defaults to `300`. */
545
+ height?: string | number;
546
+ /** Optional CSS class name applied to both the placeholder and wrapper. */
547
+ className?: string;
548
+ /** Content to render once the component has mounted on the client. */
549
+ children: ReactNode;
550
+ }
551
+ /**
552
+ * Renders a lightweight placeholder `<div>` during server-side rendering
553
+ * and on the initial client render (before hydration completes).
554
+ * Once `useEffect` fires on the client, the placeholder is replaced
555
+ * with the provided `children`.
556
+ *
557
+ * This is useful for wrapping components that rely on browser-only APIs
558
+ * (e.g. D3 charts, Canvas, ResizeObserver) so that `renderToString`
559
+ * produces valid, non-crashing HTML with the correct dimensions reserved.
560
+ *
561
+ * @example
562
+ * ```tsx
563
+ * <SSRPlaceholder width="100%" height={400}>
564
+ * <Chart data={chartData} />
565
+ * </SSRPlaceholder>
566
+ * ```
567
+ */
568
+ declare function SSRPlaceholder({ width, height, className, children, }: SSRPlaceholderProps): ReactNode;
569
+
570
+ export { AnimationContext, AnimationProvider, type AnimationState, type BlockAnimationResult, BlockDiagnosticIndicator, BlockRenderer, PluginRegistry as ComponentRegistry, ContainerMeasure, DashboardLayout, DiagnosticsOverlay, DocumentLayout, ErrorBoundary, FallbackRenderer, GlyphBlockquote, GlyphCodeBlock, GlyphDocument, GlyphHeading, GlyphImage, GlyphList, GlyphParagraph, GlyphRawHtml, GlyphThematicBreak, InlineRenderer, LayoutProvider, type NavigationResult, PluginRegistry, PresentationLayout, ReferenceIndicator, type RegistryChangeListener, type RuntimeContextValue, RuntimeProvider, type RuntimeProviderProps, SSRPlaceholder, type SSRPlaceholderProps, ThemeProvider, type ThemeProviderProps, type ValidationResult, builtInRenderers, createGlyphRuntime, createResolveVar, darkTheme, isDarkTheme, lightTheme, mergeThemeDefaults, resolveComponentProps, resolveTheme, resolveTier, useAnimation, useBlockAnimation, useGlyphTheme, useIsClient, useLayout, useNavigation, useReferences, useRuntime, validateComponentDefinition };