import { CreativeCommonsVersion } from '../packages/utils/dist'; import { creativeCommonsVersions } from '../packages/utils/dist'; import { default as default_2 } from 'react'; import { defaultCreativeCommonsVersion } from '../packages/utils/dist'; import { DiagnosticRecord } from '../packages/utils/dist'; import { DiagnosticsTabId } from '../packages/doenetml/dist'; import { DoenetEditor as DoenetEditor_2 } from '../packages/doenetml/dist'; import { DoenetEditorHandle } from '../packages/doenetml/dist'; import { DoenetViewer as DoenetViewer_2 } from '../packages/doenetml/dist'; import { ErrorRecord } from '../packages/utils/dist'; import { getMediaLicenseDisplay } from '../packages/utils/dist'; import { getMediaLicenseInfo } from '../packages/utils/dist'; import { mathjaxConfig } from '../packages/utils/dist'; import { MediaLicenseDisplay } from '../packages/utils/dist'; import { MediaLicenseInfo } from '../packages/utils/dist'; import { MediaLicenseKind } from '../packages/utils/dist'; import { mediaLicenses } from '../packages/utils/dist'; import { ReaderStyleOverrides } from '../packages/utils/dist'; import { ReaderStyleValueOverrides } from '../packages/utils/dist'; import { StylePaletteInfo } from '../packages/utils/dist'; import { WarningRecord } from '../packages/utils/dist'; export { CreativeCommonsVersion } export { creativeCommonsVersions } export { defaultCreativeCommonsVersion } export { DiagnosticRecord } export { DiagnosticsTabId } export declare const DoenetEditor: default_2.ForwardRefExoticComponent & default_2.RefAttributes>; export { DoenetEditorHandle } export declare type DoenetEditorIframeProps = DoenetEditorProps & { /** * Called once the standalone bundle inside the iframe has booted, with * the style palettes THAT bundle supports — the source of truth for a * host rendering a palette picker, since the iframe may run a pinned or * older DoenetML version than this wrapper. Receives `null` when the * booted bundle predates palette discovery. Feed a chosen palette name * back in as the `palette` field of `styleOverrides`. */ onStylePalettes?: (palettes: StylePaletteInfo[] | null) => void; doenetML: string; /** * The URL of a standalone DoenetML bundle. This may be from the CDN. * If autodetectVersion is `true` and a version is detected, this URL is ignored. */ standaloneUrl?: string; /** * The URL of a CSS file that styles the standalone DoenetML bundle. * If autodetectVersion is `true` and a version is detected, this URL is ignored. */ cssUrl?: string; /** * The version of standalone DoenetML bundle if urls are not provided. * If autodetectVersion is `true` and a version is detected, this setting is ignored. */ doenetmlVersion?: string; /** * If `true`, look for a xmlns attribute in an outer `` tag * and use that for the doenetmlVersion, * overwriting any doenetmlVersion or urls provided */ autodetectVersion?: boolean; /** * The width of the iframe (and the width of the editor-viewer widget) */ width?: string; /** * The height of the iframe (and the height of the editor-viewer widget) */ height?: string; }; declare type DoenetEditorProps = Omit, "doenetML" | "width" | "height" | "externalVirtualKeyboardProvided">; /** * Render Doenet viewer constrained to an iframe. A URL pointing to a version of DoenetML * standalone must be provided (along with a URL to the corresponding CSS file). * * Parameters for the underlying `DoenetViewer` component are passed via props. * Serializable prop changes after mount are pushed into the iframe as * messages and applied in place with the same semantics as the in-process * ``: e.g. flipping `render` starts the document without a * reload, and changing `doenetML` (or `activityId`/`docId`/`attemptNumber`/ * `requestedVariantIndex`) re-initializes the document's core inside the * same iframe realm — the multi-MB standalone bundle is not re-parsed. Only * a change of the bundle itself (`standaloneUrl`/`cssUrl`/`doenetmlVersion`, * a version change detected in `doenetML`, or `useSharedCoreWorker`) reloads * the iframe. To force a full remount instead, change the component's `key`. * * Function props are forwarded across the iframe boundary via Comlink * proxies and follow the latest identity passed. (Bundles older than * v0.7.18 cannot re-render in place; for those the wrapper falls back to * reloading the iframe on any prop change, its historical behavior.) */ export declare function DoenetViewer({ doenetML, standaloneUrl: specifiedStandaloneUrl, cssUrl: specifiedCssUrl, doenetmlVersion: specifiedDoenetmlVersion, autodetectVersion, useSharedCoreWorker, mountPolicy, keepLive, onStylePalettes, ...doenetViewerProps }: DoenetViewerIframeProps): default_2.JSX.Element | null; export declare type DoenetViewerIframeProps = DoenetViewerProps & { doenetML: string; /** * Called once the standalone bundle inside the iframe has booted, with * the style palettes THAT bundle supports — the source of truth for a * host rendering a palette picker, since the iframe may run a pinned or * older DoenetML version than this wrapper. Receives `null` when the * booted bundle predates palette discovery. Feed a chosen palette name * back in as the `palette` field of `styleOverrides`. */ onStylePalettes?: (palettes: StylePaletteInfo[] | null) => void; /** * The URL of a standalone DoenetML bundle. This may be from the CDN. * If autodetectVersion is `true` and a version is detected, this URL is ignored. */ standaloneUrl?: string; /** * The URL of a CSS file that styles the standalone DoenetML bundle. * If autodetectVersion is `true` and a version is detected, this URL is ignored. */ cssUrl?: string; /** * The version of standalone DoenetML bundle if urls are not provided. * If autodetectVersion is `true` and a version is detected, this setting is ignored. */ doenetmlVersion?: string; /** * If `true`, look for a xmlns attribute in an outer `` tag * and use that for the doenetmlVersion, * overwriting any doenetmlVersion or urls provided */ autodetectVersion?: boolean; /** * Opt-in (#1466): multiplex this viewer's core onto a shared core worker * owned by this (parent) page, instead of the iframe booting its own * ~100 MB dedicated worker. Viewers on the same page with the same * standalone version share workers (up to a pool cap per worker), which * is the dominant memory saving on pages embedding many documents. * Trade-off: a worker-level hang or crash affects every document on that * worker (per-core teardown stays individual; suspect workers are * quarantined so retries boot fresh ones). Default off. */ useSharedCoreWorker?: boolean; /** * Opt-in windowed mounting (#1441, stream B): keep at most * `maxLiveViewers` viewers live on the page. Windowed viewers start as * fixed-height placeholders and only create their iframe when they come * near the viewport AND a boot slot is free (`maxConcurrentBoots` caps * simultaneous realm boots page-wide — an off-screen viewer never boots * at all). Off-screen viewers beyond the budget are *parked* — their * state is flushed (`SPLICE.flushState`) and their iframe is replaced * by the placeholder again — and restored when scrolled back near the * viewport. Parking requires a persistence path: it only activates for * viewers with `flags.allowSaveState` (the wrapper snapshots the * flushed `reportScoreAndState` and seeds `initialState` on restore) or * `flags.allowLocalState` (IndexedDB restores on reboot), and only when * the selected bundle is new enough to acknowledge the flush (v0.7.21+, * or a host-specified `standaloneUrl`); otherwise the viewer boots on * visibility but then always stays live. The policy is read at mount; * changing it afterwards is not supported. Default off (no prop = * today's behavior). */ mountPolicy?: MountPolicy; /** * Windowed-mounting hint: treat this viewer as visible regardless of * viewport intersection — boot it eagerly (still subject to the * page-wide `maxConcurrentBoots` slot queue) and never park it while * set. For hosts that know an off-screen or `display:none` viewer is * about to be shown, e.g. a paginator prefetching the pages adjacent to * the current one. Dynamic, unlike `mountPolicy`; no effect without a * windowed `mountPolicy`. The hint counts as visibility for boot * ordering and the least-recently-visible eviction order, so keep it on * a few viewers at a time (a page-wide `keepLive` would defeat the * budget). */ keepLive?: boolean; }; declare type DoenetViewerProps = Omit, "doenetML" | "externalVirtualKeyboardProvided">; export { ErrorRecord } export { getMediaLicenseDisplay } export { getMediaLicenseInfo } /** Snapshot for tests and diagnostics. */ export declare function getViewerLifecycleStats(): { registered: number; live: number; parking: number; parked: number; booting: number; bootQueue: number; }; export { mathjaxConfig } export { MediaLicenseDisplay } export { MediaLicenseInfo } export { MediaLicenseKind } export { mediaLicenses } /** * Page-wide lifecycle manager for windowed `` mounting * (#1441, stream B). * * Viewers that opt in via the `mountPolicy` prop register here. The manager * enforces a page-wide budget of live viewers: when more than * `maxLiveViewers` are live at once, the least-recently-visible off-screen * viewers are asked to park (flush their state and replace their iframe with * a placeholder), so idle memory tracks what the user can see rather than * how many documents the page embeds. * * It also gates *when* a lazily-mounted viewer may boot its iframe realm: a * page-wide boot-slot semaphore (`maxConcurrentBoots`) caps how many viewers * evaluate the multi-MB standalone bundle at once, serving visible viewers * first (see `requestBootSlot`). * * This module is pure policy: *when* to park and *when* to boot. The * mechanics (flushing state, creating/swapping the iframe, restoring) live in * the `DoenetViewer` wrapper, which registers callbacks here. Module-level * state is intentional — the budget is shared by every windowed viewer on * the page (same pattern as `shared-core-pool.ts`). * * Rules: * - A currently-visible viewer is never parked (the budget is soft: if more * than `maxLiveViewers` are visible at once, all of them stay live). * - A viewer only becomes eligible to park after it has been off-screen for * its `parkDelayMs` (debounce against scroll flicker). * - Viewers whose `canPark` returns false (no persistence path — parking * would lose student work) are never parked. * - Eviction order is least-recently-visible first. */ export declare type MountPolicy = { /** The only mode currently defined. */ mode: "windowed"; /** * Page-wide budget of simultaneously live (iframe-mounted) viewers. * When viewers on the same page specify different values, the smallest * wins. Default 3. */ maxLiveViewers?: number; /** * `rootMargin` for the visibility observer — how far outside the * viewport a viewer still counts as "visible". Default "1000px". */ visibleMargin?: string; /** * How long to wait for the viewer to acknowledge the pre-park state * flush before parking anyway. Default 5000. */ flushTimeoutMs?: number; /** * How long a viewer must be continuously off-screen before it may be * parked. Default 2000. */ parkDelayMs?: number; /** * Page-wide cap on how many windowed viewers may be *booting* their * iframe realm at once (each boot parses the multi-MB standalone bundle * and starts a core worker — the initialization stampede #1439 * targets). Additional viewers wait for a slot, visible-first. As with * `maxLiveViewers`, the smallest value across viewers wins. Default 2. */ maxConcurrentBoots?: number; }; export { ReaderStyleOverrides } export { ReaderStyleValueOverrides } export { StylePaletteInfo } export declare const version: string; export { WarningRecord } export { }