@bendyline/squisq-react 2.2.0 → 2.3.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,21 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { SquisqAnnotatedSchema } from '@bendyline/squisq/jsonForm';
3
+ import { Theme, SurfaceScheme } from '@bendyline/squisq/schemas';
4
+
5
+ interface JsonViewProps {
6
+ /** Schema describing the value's shape (with optional `squisq` UI hints). */
7
+ schema: SquisqAnnotatedSchema;
8
+ /** The value to display. */
9
+ value: unknown;
10
+ /** Optional theme. Defaults to `DEFAULT_THEME`. */
11
+ theme?: Theme;
12
+ /** Light/dark surface override; `'auto'` follows `prefers-color-scheme`. */
13
+ surface?: SurfaceScheme | 'auto';
14
+ /** Padding/gap density. Default: 'comfortable'. */
15
+ density?: 'comfortable' | 'compact';
16
+ /** Optional CSS class for the outer container. */
17
+ className?: string;
18
+ }
19
+ declare function JsonView(props: JsonViewProps): react_jsx_runtime.JSX.Element;
20
+
21
+ export { JsonView, type JsonViewProps };
@@ -0,0 +1,10 @@
1
+ import {
2
+ JsonView
3
+ } from "../chunk-NANF7REM.js";
4
+ import "../chunk-TT6ENR6T.js";
5
+ import "../chunk-D7KN4CRG.js";
6
+ import "../chunk-WLUZTUNZ.js";
7
+ import "../chunk-LR3AIGDD.js";
8
+ export {
9
+ JsonView
10
+ };
@@ -0,0 +1,124 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ImageLayer as ImageLayer$1, TextLayer as TextLayer$1, ShapeLayer as ShapeLayer$1, PathLayer as PathLayer$1, VideoLayer as VideoLayer$1, TableLayer as TableLayer$1, TreeLayer as TreeLayer$1, MapLayer as MapLayer$1, MermaidLayer as MermaidLayer$1, Theme } from '@bendyline/squisq/schemas';
3
+
4
+ interface ImageLayerProps {
5
+ layer: ImageLayer$1;
6
+ /** Base path for resolving relative image URLs */
7
+ basePath: string;
8
+ /** Viewport dimensions for percentage calculations */
9
+ viewport: {
10
+ width: number;
11
+ height: number;
12
+ };
13
+ /** Current time relative to block start (for animation timing) */
14
+ blockTime: number;
15
+ /** Whether authored and responsive image motion should run. */
16
+ animationsEnabled?: boolean;
17
+ }
18
+ declare function ImageLayer({ layer, basePath, viewport, blockTime, animationsEnabled, }: ImageLayerProps): react_jsx_runtime.JSX.Element;
19
+
20
+ interface TextLayerProps {
21
+ layer: TextLayer$1;
22
+ /** Viewport dimensions for percentage calculations */
23
+ viewport: {
24
+ width: number;
25
+ height: number;
26
+ };
27
+ /** Current time relative to block start */
28
+ blockTime: number;
29
+ }
30
+ /**
31
+ * Dispatch between the plain SVG-text renderer and the rich HTML renderer
32
+ * based on whether the layer carries `content.html`.
33
+ */
34
+ declare function TextLayer(props: TextLayerProps): react_jsx_runtime.JSX.Element;
35
+
36
+ interface ShapeLayerProps {
37
+ layer: ShapeLayer$1;
38
+ /** Viewport dimensions for percentage calculations */
39
+ viewport: {
40
+ width: number;
41
+ height: number;
42
+ };
43
+ /** Current time relative to block start */
44
+ blockTime: number;
45
+ }
46
+ declare function ShapeLayer({ layer, viewport, blockTime }: ShapeLayerProps): react_jsx_runtime.JSX.Element;
47
+
48
+ interface PathLayerProps {
49
+ layer: PathLayer$1;
50
+ /** Viewport dimensions — used to resolve `%` positions for named shapes. */
51
+ viewport: {
52
+ width: number;
53
+ height: number;
54
+ };
55
+ /** Current time relative to block start. */
56
+ blockTime: number;
57
+ }
58
+ declare function PathLayer({ layer, viewport, blockTime }: PathLayerProps): react_jsx_runtime.JSX.Element;
59
+
60
+ interface VideoLayerProps {
61
+ layer: VideoLayer$1;
62
+ /** Base path for resolving relative video URLs */
63
+ basePath: string;
64
+ /** Viewport dimensions for percentage calculations */
65
+ viewport: {
66
+ width: number;
67
+ height: number;
68
+ };
69
+ /** Current time relative to block start (for playback sync) */
70
+ blockTime: number;
71
+ /** Whether the doc is currently playing */
72
+ isPlaying?: boolean;
73
+ }
74
+ declare function VideoLayer({ layer, basePath, viewport, blockTime, isPlaying }: VideoLayerProps): react_jsx_runtime.JSX.Element;
75
+
76
+ interface TableLayerProps {
77
+ layer: TableLayer$1;
78
+ /** Viewport dimensions for percentage calculations */
79
+ viewport: {
80
+ width: number;
81
+ height: number;
82
+ };
83
+ /** Current time relative to block start (for animation) */
84
+ blockTime: number;
85
+ }
86
+ declare function TableLayer({ layer, viewport, blockTime }: TableLayerProps): react_jsx_runtime.JSX.Element;
87
+
88
+ interface TreeLayerProps {
89
+ layer: TreeLayer$1;
90
+ viewport: {
91
+ width: number;
92
+ height: number;
93
+ };
94
+ blockTime: number;
95
+ }
96
+ declare function TreeLayer({ layer, viewport, blockTime }: TreeLayerProps): react_jsx_runtime.JSX.Element;
97
+
98
+ interface MapLayerProps {
99
+ layer: MapLayer$1;
100
+ /** Base path for resolving relative image URLs */
101
+ basePath: string;
102
+ /** Viewport dimensions for percentage calculations */
103
+ viewport: {
104
+ width: number;
105
+ height: number;
106
+ };
107
+ /** Current time relative to block start (for animation timing) */
108
+ blockTime: number;
109
+ }
110
+ declare function MapLayer({ layer, basePath, viewport, blockTime }: MapLayerProps): react_jsx_runtime.JSX.Element;
111
+
112
+ interface MermaidLayerProps {
113
+ layer: MermaidLayer$1;
114
+ viewport: {
115
+ width: number;
116
+ height: number;
117
+ };
118
+ blockTime: number;
119
+ theme?: Theme;
120
+ }
121
+ /** Mermaid diagram hosted in HTML inside the slide SVG. */
122
+ declare function MermaidLayer({ layer, viewport, blockTime, theme }: MermaidLayerProps): react_jsx_runtime.JSX.Element;
123
+
124
+ export { ImageLayer, MapLayer, MermaidLayer, PathLayer, ShapeLayer, TableLayer, TextLayer, TreeLayer, VideoLayer };
@@ -0,0 +1,24 @@
1
+ import {
2
+ ImageLayer,
3
+ MapLayer,
4
+ MermaidLayer,
5
+ PathLayer,
6
+ ShapeLayer,
7
+ TableLayer,
8
+ TextLayer,
9
+ TreeLayer,
10
+ VideoLayer
11
+ } from "../chunk-XYS7HMP4.js";
12
+ import "../chunk-WLUZTUNZ.js";
13
+ import "../chunk-LR3AIGDD.js";
14
+ export {
15
+ ImageLayer,
16
+ MapLayer,
17
+ MermaidLayer,
18
+ PathLayer,
19
+ ShapeLayer,
20
+ TableLayer,
21
+ TextLayer,
22
+ TreeLayer,
23
+ VideoLayer
24
+ };
@@ -0,0 +1,44 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Theme } from '@bendyline/squisq/schemas';
3
+ import { MarkdownBlockNode, HtmlPolicy } from '@bendyline/squisq/markdown';
4
+
5
+ interface MarkdownRendererProps {
6
+ /** Block-level AST nodes to render */
7
+ nodes: MarkdownBlockNode[];
8
+ /** Optional CSS class for the wrapper element */
9
+ className?: string;
10
+ /**
11
+ * Raw HTML policy. Defaults to `sanitize`, which removes unsafe tags,
12
+ * event handlers, and executable URL schemes before rendering.
13
+ */
14
+ htmlPolicy?: HtmlPolicy;
15
+ /**
16
+ * Extra URL schemes to allow on links (e.g. a host app's internal
17
+ * navigation scheme it intercepts on click). Executable schemes are
18
+ * never allowed regardless. See {@link SanitizeUrlOptions}.
19
+ */
20
+ linkSchemes?: readonly string[];
21
+ /** Resolved Squisq theme inherited by embedded Mermaid diagrams. */
22
+ theme?: Theme;
23
+ }
24
+ /**
25
+ * Renders MarkdownBlockNode[] AST as React HTML elements.
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <MarkdownRenderer nodes={block.contents} />
30
+ * ```
31
+ */
32
+ declare function MarkdownRenderer({ nodes, className, htmlPolicy, linkSchemes, theme, }: MarkdownRendererProps): react_jsx_runtime.JSX.Element | null;
33
+
34
+ interface MermaidDiagramProps {
35
+ source: string;
36
+ className?: string;
37
+ ariaLabel?: string;
38
+ /** Resolved Squisq theme whose palette Mermaid should inherit. */
39
+ theme?: Theme;
40
+ }
41
+ /** Read-only Mermaid rendering for page bodies and slide layers. */
42
+ declare function MermaidDiagram({ source, className, ariaLabel, theme, }: MermaidDiagramProps): react_jsx_runtime.JSX.Element;
43
+
44
+ export { MarkdownRenderer, MermaidDiagram, type MermaidDiagramProps };
@@ -0,0 +1,11 @@
1
+ import {
2
+ MarkdownRenderer
3
+ } from "../chunk-D7KN4CRG.js";
4
+ import {
5
+ MermaidDiagram
6
+ } from "../chunk-WLUZTUNZ.js";
7
+ import "../chunk-LR3AIGDD.js";
8
+ export {
9
+ MarkdownRenderer,
10
+ MermaidDiagram
11
+ };
@@ -0,0 +1,105 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { Doc, ViewportConfig, Theme, SurfaceScheme, ThemePageStyle } from '@bendyline/squisq/schemas';
3
+ import { PageTransformHints, PageSectionMaterialization, PageSection, MaterializeBlockLayersOptions } from '@bendyline/squisq/doc';
4
+ import * as react from 'react';
5
+
6
+ interface LinearDocViewProps {
7
+ /**
8
+ * The Doc to render. Wins over `markdown` when both are provided.
9
+ * When neither `doc` nor `markdown` is given, an empty container renders.
10
+ */
11
+ doc?: Doc;
12
+ /**
13
+ * Markdown source to render. When `doc` is absent, the markdown is parsed
14
+ * and converted to a Doc via `markdownToDoc(parseMarkdown(markdown))`.
15
+ * Ignored when `doc` is provided.
16
+ */
17
+ markdown?: string;
18
+ /** Base path for resolving media URLs (images, etc.) */
19
+ basePath?: string;
20
+ /** Viewport config for embedded SVG canvas sections (default: landscape) */
21
+ viewport?: ViewportConfig;
22
+ /** Optional CSS class for the outer container */
23
+ className?: string;
24
+ /** Theme to use for rendering (default: DEFAULT_THEME from the theme library) */
25
+ theme?: Theme;
26
+ /** Whether embedded canvas sections render their layer animations (default: true). */
27
+ animationsEnabled?: boolean;
28
+ /**
29
+ * Optional surface scheme (light / dark paper) overlaid on top of the
30
+ * theme's colors. Orthogonal to `theme` — a theme picks editorial
31
+ * identity, a surface picks the paper. Pass `'auto'` to follow the
32
+ * user's OS `prefers-color-scheme`, a `SurfaceScheme` object to force a
33
+ * specific surface, or omit to use the theme's built-in colors.
34
+ */
35
+ surface?: SurfaceScheme | 'auto';
36
+ /**
37
+ * Use tight padding + a hugging layout. The default layout is a full
38
+ * page with themed section bands. Short conversational snippets like
39
+ * chat replies benefit from a much tighter layout. Set to `true` to
40
+ * render with minimal padding so the content hugs its container.
41
+ */
42
+ thinMargins?: boolean;
43
+ /**
44
+ * How images inside the doc should be sized. `'inline'` (default)
45
+ * flows them at natural size up to the column width; `'thumbnail'`
46
+ * constrains each image to a 100×100 box with aspect-preserving
47
+ * containment — use for chat history and other dense surfaces where
48
+ * full-size images would dominate the layout.
49
+ */
50
+ imageDisplayMode?: ImageDisplayMode;
51
+ /**
52
+ * Let unmodified Up/Down arrows scroll this view even when it does not
53
+ * currently hold focus. Intended for a primary document preview.
54
+ */
55
+ globalKeyboardShortcuts?: boolean;
56
+ /**
57
+ * Synthesize a hero section from `doc.startBlock` at the top of the
58
+ * page (default: true). The editor's Cover toggle maps here.
59
+ */
60
+ showCover?: boolean;
61
+ /**
62
+ * Page hints from the active transform (Summarize) style — spacing and
63
+ * emphasis-curve adjustments defined by `TransformStyleConfig.page`.
64
+ */
65
+ transformPage?: PageTransformHints;
66
+ }
67
+ type ImageDisplayMode = 'inline' | 'thumbnail';
68
+ /**
69
+ * Renders a Doc as a scrolling, theme-art-directed page.
70
+ *
71
+ * @example
72
+ * ```tsx
73
+ * <LinearDocView doc={doc} basePath="/media/" />
74
+ * ```
75
+ */
76
+ declare function LinearDocView({ doc, markdown, basePath, viewport, className, theme, surface, animationsEnabled, thinMargins, imageDisplayMode, globalKeyboardShortcuts, showCover, transformPage, }: LinearDocViewProps): react_jsx_runtime.JSX.Element;
77
+
78
+ interface PageSectionViewProps {
79
+ entry: PageSectionMaterialization;
80
+ /** Alternation flip for feature-split sections (theme `alternate` hint). */
81
+ featureFlip?: boolean;
82
+ /** True when this is the doc's lead prose section (drop-cap target). */
83
+ isLeadProse?: boolean;
84
+ }
85
+ declare function PageSectionView({ entry, featureFlip, isLeadProse }: PageSectionViewProps): react_jsx_runtime.JSX.Element;
86
+
87
+ interface CanvasSectionProps {
88
+ section: PageSection;
89
+ }
90
+ declare function CanvasSection({ section }: CanvasSectionProps): react_jsx_runtime.JSX.Element | null;
91
+
92
+ interface PageViewContextValue {
93
+ theme: Theme;
94
+ pageStyle: ThemePageStyle;
95
+ basePath: string;
96
+ viewport: ViewportConfig;
97
+ /** Options for `materializeBlockLayers` inside canvas embeds. */
98
+ renderContext: MaterializeBlockLayersOptions;
99
+ animationsEnabled: boolean;
100
+ imageDisplayMode: ImageDisplayMode;
101
+ }
102
+ declare const PageViewContext: react.Context<PageViewContextValue>;
103
+ declare function usePageView(): PageViewContextValue;
104
+
105
+ export { CanvasSection, type CanvasSectionProps, type ImageDisplayMode, LinearDocView, type LinearDocViewProps, PageSectionView, type PageSectionViewProps, PageViewContext, type PageViewContextValue, usePageView };
@@ -0,0 +1,19 @@
1
+ import {
2
+ CanvasSection,
3
+ LinearDocView,
4
+ PageSectionView,
5
+ PageViewContext,
6
+ usePageView
7
+ } from "../chunk-TQH6RTTV.js";
8
+ import "../chunk-XYS7HMP4.js";
9
+ import "../chunk-TT6ENR6T.js";
10
+ import "../chunk-D7KN4CRG.js";
11
+ import "../chunk-WLUZTUNZ.js";
12
+ import "../chunk-LR3AIGDD.js";
13
+ export {
14
+ CanvasSection,
15
+ LinearDocView,
16
+ PageSectionView,
17
+ PageViewContext,
18
+ usePageView
19
+ };