@graphysdk/react-renderer 0.0.1-experimental.3 → 0.0.1-experimental.5

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/index.d.ts CHANGED
@@ -182,12 +182,14 @@ declare interface GraphProviderProps {
182
182
  * no `config` prop: every consumer must wrap with `<GraphProvider>` so commands can operate
183
183
  * on the live spec.
184
184
  */
185
- export declare const GraphRenderer: ({ slots, ...props }: GraphRendererProps) => JSX.Element;
185
+ export declare const GraphRenderer: ({ slots, sizing, onResize, ...props }: GraphRendererProps) => JSX.Element;
186
186
 
187
- /** Props for {@link GraphRenderer}: pixel size, interaction toggles, and per-region slot overrides. */
187
+ /** Props for {@link GraphRenderer}: container sizing, interaction toggles, and per-region slot overrides. */
188
188
  export declare interface GraphRendererProps {
189
- width: number;
190
- height: number;
189
+ /** Controls how the graph responds to its container size. Defaults to filling the parent container. */
190
+ sizing?: GraphSizing;
191
+ /** Callback invoked when the graph's container is resized. Fires in every sizing mode. */
192
+ onResize?: ResizeObserverOnResize;
191
193
  isAnimated?: boolean;
192
194
  showTooltips?: boolean;
193
195
  mode?: GraphMode;
@@ -195,6 +197,27 @@ export declare interface GraphRendererProps {
195
197
  slots?: GraphSlots;
196
198
  }
197
199
 
200
+ /** Controls how the graph claims space in its container. */
201
+ export declare type GraphSizing = {
202
+ mode: 'responsive';
203
+ } | {
204
+ mode: 'fixed';
205
+ width: number;
206
+ height: number;
207
+ } | {
208
+ mode: 'keepAspectRatio';
209
+ intrinsicWidth: number;
210
+ intrinsicHeight: number;
211
+ } | {
212
+ mode: 'keepAspectRatio';
213
+ intrinsicWidth: number;
214
+ aspectRatio: number;
215
+ } | {
216
+ mode: 'keepAspectRatio';
217
+ intrinsicHeight: number;
218
+ aspectRatio: number;
219
+ };
220
+
198
221
  /**
199
222
  * Region overrides for `GraphRenderer`. Each slot replaces how one region paints; the viz-engine
200
223
  * `Spec` stays the source of truth for whether a region exists and what data it receives. An
@@ -295,6 +318,15 @@ export declare interface LegendSlotProps {
295
318
  /** vanilla-extract class that binds the light token values; the default theme. */
296
319
  export declare const lightTheme: string;
297
320
 
321
+ export declare type ResizeObserverOnResize = (state: ResizeObserverState) => void;
322
+
323
+ export declare interface ResizeObserverState {
324
+ width: number;
325
+ height: number;
326
+ /** True until the first ResizeObserver measurement lands. */
327
+ isDefault: boolean;
328
+ }
329
+
298
330
  /**
299
331
  * Passed as the second argument to a layout-coupled slot's `measure`. Exposes the renderer's own
300
332
  * text measurer — the same Canvas-backed instance the built-in measurers use — and the active