Skip to content

zidane-ui/views/preview

import { … } from 'zidane-ui/views/preview'ui/src/views/preview.ts

Components#

ViewPreviewComponent#

zidane-ui/views/preview: the page a view renderer loads, so the model can see the view it made (docs/VIEWS.md, The model sees its result). An app builds a small page that imports the kit's stylesheet and calls installViewPreviewPage.

TypeScript
function ViewPreview(props: ViewPreviewProps): Element
Parameters
NameTypeDescription
propsViewPreviewProps

ViewPreviewProps.

Element
ViewPreview props
NameTypeDescription
inputs?boolean

The requesting host has inputs on: Choice, Form and Action draw enabled.

viewPick<StoredView, 'anchor' | 'id' | 'title' | 'tree' | 'alt' | 'origin' | 'sessionId' | 'createdAt' | 'heights'> & Partial<StoredView>

The stored view to draw.

ui/src/views/ViewPreviewPage.tsx:81

Functions#

installViewPreviewPageFunction#

zidane-ui/views/preview: the page a view renderer loads, so the model can see the view it made (docs/VIEWS.md, The model sees its result). An app builds a small page that imports the kit's stylesheet and calls installViewPreviewPage.

TypeScript
function installViewPreviewPage(options?: ViewPreviewPageOptions): ViewPreviewPageApi
Parameters
NameTypeDefaultDescription
options?ViewPreviewPageOptions{}

ViewPreviewPageOptions.

ViewPreviewPageApi

ui/src/views/ViewPreviewPage.tsx:235

measureViewPreviewFunction#

zidane-ui/views/preview: the page a view renderer loads, so the model can see the view it made (docs/VIEWS.md, The model sees its result). An app builds a small page that imports the kit's stylesheet and calls installViewPreviewPage.

TypeScript
function measureViewPreview(root: HTMLElement): ViewPreviewPageResult
Parameters
NameTypeDescription
rootHTMLElement

The page's root element.

ViewPreviewPageResult

ui/src/views/ViewPreviewPage.tsx:165

Constants#

VIEW_PREVIEW_SETTLE_MSConstant#

The longest the page waits for a view to hold still before it measures what is there, unless the driver says (settleMs).

TypeScript
const VIEW_PREVIEW_SETTLE_MS = 10_000

ui/src/views/ViewPreviewPage.tsx:38

Interfaces#

ViewPreviewPageOptionsInterface#

Options of installViewPreviewPage.

TypeScript
interface ViewPreviewPageOptions
ViewPreviewPageOptions properties
NameTypeDescription
root?HTMLElement

Where the view draws. Default: #root.

themes?{ dark?: string; light?: string }

Theme ids for each appearance (themeStylesheet). Default: the built-in ones.

ui/src/views/ViewPreviewPage.tsx:222

ViewPreviewPropsInterface#

Props of ViewPreview.

TypeScript
interface ViewPreviewProps
ViewPreviewProps properties
NameTypeDescription
inputs?boolean

The requesting host has inputs on: Choice, Form and Action draw enabled.

viewPick<StoredView, 'anchor' | 'id' | 'title' | 'tree' | 'alt' | 'origin' | 'sessionId' | 'createdAt' | 'heights'> & Partial<StoredView>

The stored view to draw.

ui/src/views/ViewPreviewPage.tsx:69