# @embedpdf/react — . ACTIONS_DEFAULTS [VariableDeclaration] (from packages/plugin/actions/src/contract.ts): ACTIONS_DEFAULTS: ActionsSettings ={ policy:{ goto:{ user: 'allow', hover: 'allow', lifecycle: 'allow'} , named:{ user: 'allow', hover: 'allow', lifecycle: 'allow'} , hide:{ user: 'allow', hover: 'allow', lifecycle: 'allow'} , 'reset-form':{ user: 'allow', hover: 'allow', lifecycle: 'allow'} , javascript:{ user: 'allow', hover: 'allow', lifecycle: 'allow'} , uri:{ user: 'adapter', hover: 'report', lifecycle: 'report'} , print:{ user: 'adapter', hover: 'block', lifecycle: 'block'} , 'submit-form':{ user: 'adapter', hover: 'block', lifecycle: 'block'} , } , triggers:{ document: true, page: true, annotation: true} , openSequence: 'auto', javascript:{ enabled: false, identity: null} , } ANNOTATION_DEFAULTS [VariableDeclaration] (from packages/plugin/annotation/src/contract.ts): ANNOTATION_DEFAULTS: AnnotationSettings ={ tools: [], afterCreate:{ select: true, tool: 'stay', editText: true} , chrome:{ accent: null, outline:{ color: null, style: 'solid', width: 1} , handles:{ shape: 'square', size: 8, hitSize: 24, fill: '#ffffff', stroke: null} , rotationHandle:{ enabled: true, size: 10, hitSize: 24, offset: 32, stalk: true, fill: null, stroke: null, } , guides:{ enabled: true, color: '#e91e63', rotationColor: null, style: 'solid', width: 1.5} , marquee:{ fill: null, stroke: null} , textOutline: null, readout:{ enabled: true, background: 'rgb(0 0 0 / 0.8)', color: '#ffffff'} , } , snap:{ alignment: true, alignmentThresholdPx: 6, rotation: true, rotationAngles: [0, 90, 180, 270], rotationThresholdDeg: 4, } , editable: true, } ARMED_STAMP_TOOL_ID [VariableDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): ARMED_STAMP_TOOL_ID = 'stamp' AbortablePromise [ClassDeclaration] (from packages/engine/core/src/promise/AbortablePromise.ts): export class AbortablePromise extends Promise{ static override get [Symbol.species](): PromiseConstructor{ return Promise; } readonly signal: AbortSignal; private readonly _ctrl: AbortController; private readonly _progressCbs: Set<(p: P) => void>; private readonly _state:{ settled: boolean} ; private readonly _internalReject: (reason: unknown) => void; constructor(executor: AbortableExecutor){ const ctrl = new AbortController(); const progressCbs = new Set<(p: P) => void>(); const state ={ settled: false} ; let capturedReject!: (reason: unknown) => void; super((resolve, reject) =>{ capturedReject = reject; const wrappedResolve = (value: T | PromiseLike) =>{ if (state.settled) return; state.settled = true; resolve(value); } ; const wrappedReject = (reason: unknown) =>{ if (state.settled) return; state.settled = true; reject(reason); } ; const progress = (p: P) =>{ if (state.settled) return; for (const cb of progressCbs){ try{ cb(p); } catch{ } } } ; executor(wrappedResolve, wrappedReject, progress, ctrl.signal); } ); this._ctrl = ctrl; this.signal = ctrl.signal; this._progressCbs = progressCbs; this._state = state; this._internalReject = capturedReject; } abort(reason?: unknown): void{ if (this._state.settled) return; if (this._ctrl.signal.aborted) return; const err = reason instanceof AbortError ? reason : new AbortError(reason); this._state.settled = true; this._ctrl.abort(err); this._internalReject(err); } abortWith(signal: AbortSignal): this{ if (signal.aborted){ this.abort(signal.reason); return this; } const onAbort = () => this.abort(signal.reason); signal.addEventListener('abort', onAbort, { once: true} ); const detach = () => signal.removeEventListener('abort', onAbort); Promise.prototype.then.call(this, detach, detach); return this; } onProgress(cb: (p: P) => void): () => void{ this._progressCbs.add(cb); return () =>{ this._progressCbs.delete(cb); } ; } static resolveValue(value: T | PromiseLike): AbortablePromise{ return new AbortablePromise((resolve) => resolve(value)); } static rejectReason(reason: unknown): AbortablePromise{ return new AbortablePromise((_resolve, reject) => reject(reason)); } static run( fn: (signal: AbortSignal, progress: (p: P) => void) => Promise, ): AbortablePromise{ return new AbortablePromise((resolve, reject, progress, signal) =>{ fn(signal, progress).then(resolve, reject); } ); } } ActionContext [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionContext{ readonly origin: ActionOrigin; readonly source: ActionSource; readonly event: ActionTriggerEvent; } ActionDiagnostic [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionDiagnostic{ readonly code: | 'incomplete-tree' | 'blocked' | 'no-executor' | 'no-adapter' | 'no-session-sink' | 'unresolved-target' | 'duplicate-executor' | 'executor-inert' | 'executor-failed' | 'trigger-disabled' | 'no-commit-sink' | 'trigger-failed' | 'cascade-budget' | 'open-sequence-replayed' | 'no-submit-sink' | 'no-submit-resolver' | 'submit-payload-unavailable' | 'submit-entry-unsupported' | 'reentrant-print'; readonly message: string; } ActionDiagnosticReportedEvent [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionDiagnosticReportedEvent{ readonly code: ActionDiagnostic['code']; readonly action: PdfActionType | null; readonly source: ActionSource | null; } ActionDispatchResult [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionDispatchResult{ readonly status: 'executed' | 'partial' | 'inert' | 'refused' | 'cancelled'; readonly nodes: ActionNodeResult[]; readonly diagnostics: ActionDiagnostic[]; } ActionExecutedEvent [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionExecutedEvent{ readonly tree: PdfActionTree; readonly result: ActionDispatchResult; readonly source: ActionSource; } ActionExecutor [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionExecutor = ( node: PdfActionNode, actionContext: ActionContext, ) => Promise | ActionExecutorResult; ActionExecutorResult [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionExecutorResult = |{ status: 'executed'} |{ status: 'inert'; reason: string} |{ status: 'failed'; error: string} ; ActionNodeResult [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionNodeResult{ readonly path: number[]; readonly type: PdfActionType; readonly status: ActionNodeStatus; readonly detail?: string; } ActionNodeStatus [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionNodeStatus = | 'executed' | 'blocked' | 'no-executor' | 'inert' | 'failed' | 'skipped'; ActionOrigin [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionOrigin = 'user' | 'hover' | 'lifecycle'; ActionPolicy [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionPolicy{ readonly goto: ActionPolicyRow; readonly named: ActionPolicyRow; readonly hide: ActionPolicyRow; readonly 'reset-form': ActionPolicyRow; readonly javascript: ActionPolicyRow; readonly uri: ActionPolicyRow; readonly print: ActionPolicyRow; readonly 'submit-form': ActionPolicyRow; } ActionPolicyDecision [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionPolicyDecision = 'allow' | 'adapter' | 'report' | 'block'; ActionPolicyRow [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionPolicyRow = Readonly>; ActionSource [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionSource = |{ kind: 'widget'; field: FormFieldRef; annotation: AnnotationRef; page: PageRef} |{ kind: 'link'; annotation?: AnnotationRef; page?: PageRef} |{ kind: 'outline'; item: OutlineItemRef} |{ kind: 'annotation'; annotation: AnnotationRef; page: PageRef} |{ kind: 'page'; page: PageRef} |{ kind: 'document'} |{ kind: 'api'} ; ActionStepResult [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionStepResult{ readonly source: ActionSource; readonly tree: PdfActionTree; readonly result: ActionDispatchResult; } ActionSubmitHandler [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionSubmitHandler = ( request: ActionSubmitRequest, chain:{ submitToDocumentHome: (() => Promise) | null} , ) => void | Promise; ActionSubmitRequest [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionSubmitRequest{ url: string | null; method: 'post' | 'get'; format: 'fdf' | 'html' | 'xfdf' | 'pdf'; charSet?: string; entries: FormSubmissionEntry[]; origin: ActionOrigin; event: ActionTriggerEvent; } ActionTreeSource [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionTreeSource = |{ kind: 'annotation'; annotation: AnnotationRef; page: PageRef; event?: 'activate' | PdfAnnotationEventKind; } |{ kind: 'field'; field: FormFieldRef; event: PdfFieldEventKind} |{ kind: 'page'; page: PageRef; event?: 'open' | 'close'} |{ kind: 'document'; event?: DocumentTriggerEvent} |{ kind: 'outline'; item: OutlineItemRef} ; ActionTrigger [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionTrigger = |{ type: 'activate'; annotation: AnnotationRef; page: PageRef; source?: ActionSource} |{ type: 'annotation'; event: PdfAnnotationEventKind; annotation: AnnotationRef; page: PageRef; source?: ActionSource; } |{ type: 'page'; event: 'open' | 'close' | 'visible' | 'invisible'; page: PageRef} |{ type: 'document'; event: DocumentTriggerEvent} ; ActionTriggerEvent [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionTriggerEvent = |{ type: 'activate'} |{ type: 'annotation'; event: PdfAnnotationEventKind} |{ type: 'page'; event: 'open' | 'close' | 'visible' | 'invisible'} |{ type: 'document'; event: DocumentTriggerEvent} ; ActionTriggerResult [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionTriggerResult{ readonly status: 'executed' | 'partial' | 'inert' | 'refused' | 'cancelled'; readonly steps: ActionStepResult[]; readonly diagnostics: ActionDiagnostic[]; } ActionUiAdapter [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionUiAdapter{ openUri(uri: string, options:{ isMap: boolean; origin: ActionOrigin} ): void; print(uiContext?: ActionUiContext): void; alert?(message: string, options: ActionUiContext &{ icon: number; title?: string} ): void; goToPage?(pageIndex: number, uiContext: ActionUiContext): void; } ActionUiContext [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionUiContext{ readonly origin: ActionOrigin; readonly phase: 'boot' | 'user'; } ActionsCapability [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionsCapability extends SettingsApi{ execute( tree: PdfActionTree, actionContext: ActionContext, options?: OperationOptions, ): Promise; canExecute(tree: PdfActionTree, actionContext: ActionContext): boolean; executeNamed( name: PdfNamedAction, context?: Partial, options?: OperationOptions, ): Promise; canExecuteNamed(name: PdfNamedAction, context?: Partial): boolean; readActionTree( source: ActionTreeSource, options?: OperationOptions, ): Promise; isScriptingEnabled(): boolean; dispatch(trigger: ActionTrigger, options?: OperationOptions): Promise; canDispatch(trigger: ActionTrigger): boolean; setUiAdapter(adapter: ActionUiAdapter | null): Unsubscribe; runDocumentVerb( verb: 'save' | 'print', operation: () => Promise | T, options?: OperationOptions, ): Promise; prepareClose(options?: OperationOptions): Promise; setSubmitHandler(handler: ActionSubmitHandler | null): Unsubscribe; registerExecutor(type: PdfActionType, executor: ActionExecutor): Unsubscribe; readonly onExecuted: EventHook; readonly onDiagnosticReported: EventHook; readonly onScriptDiagnosticReported: EventHook; readonly onScriptFailed: EventHook; readonly onOpenSequenceCompleted: EventHook; } ActionsConfig [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionsConfig extends DeepPartial>{ readonly javascript?: DeepPartial & ActionsScriptEnvironment; } ActionsScriptEnvironment [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionsScriptEnvironment{ readonly sandboxFactory?: ScriptSandboxFactory; readonly fileName?: () => string; readonly now?: () => number; readonly utcOffsetMinutes?: () => number; readonly randomSeed?: () => number; readonly budget?: ScriptBudget; readonly maxScriptNodesPerDispatch?: number; } ActionsScriptIdentity [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ActionsScriptIdentity = Partial | (() => Partial); ActionsSettings [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ActionsSettings{ readonly policy: ActionPolicy; readonly triggers:{ readonly document: boolean; readonly page: boolean; readonly annotation: boolean; } ; readonly openSequence: 'auto' | 'headless' | 'off'; readonly javascript:{ readonly enabled: boolean; readonly identity: ActionsScriptIdentity | null; } ; } ActionsToken [VariableDeclaration] (from packages/plugin/actions/src/token.ts): ActionsToken = createCapabilityToken('actions', { hint: `add actionsPlugin() from '@embedpdf/plugin-actions' to your plugins list`, promises:{ execute: true, executeNamed: true, readActionTree: true, dispatch: true, runDocumentVerb: true, prepareClose: true, } , } ) ActionsUiHandlers [TypeAliasDeclaration] (from packages/framework/react/src/actions.tsx): export type ActionsUiHandlers = Partial; AfterCreateSettings [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AfterCreateSettings{ readonly select: boolean; readonly tool: 'stay' | 'default'; readonly editText: boolean; } Align [TypeAliasDeclaration] (from packages/core/stage/src/index.ts): export type Align = 'start' | 'center' | 'end'; AlignValue [TypeAliasDeclaration] (from packages/core/stage/src/index.ts): export type AlignValue = Align | number; Alignment [InterfaceDeclaration] (from packages/core/stage/src/index.ts): export interface Alignment{ x: Align; y: Align; } AlignmentValue [InterfaceDeclaration] (from packages/core/stage/src/index.ts): export interface AlignmentValue{ x: AlignValue; y: AlignValue; } AnalyzeInput [InterfaceDeclaration] (from packages/engine/core/src/signature/analysis/types.ts): export interface AnalyzeInput{ since:{ signatureIndex: number} |{ revisionIndex: number} ; until?: 'persisted' | 'working-copy' |{ revisionIndex: number} ; exploratoryLevel?: ModificationLevel; detail?: 'summary' | 'full'; } AnchorTarget [InterfaceDeclaration] (from packages/framework/web/src/anchored-position.ts): export interface AnchorTarget{ page: PageRef; bounds: AnchoredRect; boundsIn?: (view: PageViewEnv) => AnchoredRect | null; avoid?: AnchoredPoint[]; } Anchored [FunctionDeclaration] (from packages/framework/react/src/anchored.tsx): export function Anchored(props: AnchoredProps){ const shown = useContext(ShownPagesContext); if (!props.anchor?.bounds) return null; if (shown && !shown.has(props.anchor.page.objectNumber)) return null; return ; } AnchoredPlacement [TypeAliasDeclaration] (from packages/framework/web/src/anchored-position.ts): export type AnchoredPlacement = AnchoredSide | `${ AnchoredSide} -${ 'start' | 'end'} `; AnchoredProps [InterfaceDeclaration] (from packages/framework/react/src/anchored.tsx): export interface AnchoredProps{ anchor: (Omit &{ bounds?: AnchoredRect} ) | null; placement?: AnchoredPlacement; gap?: number; pinned?: boolean; children: React.ReactNode; } AnchoredSide [TypeAliasDeclaration] (from packages/framework/web/src/anchored-position.ts): export type AnchoredSide = 'top' | 'right' | 'bottom' | 'left'; Annotation [TypeAliasDeclaration] (from packages/engine/core/src/annotation/kinds/declarations.ts): export type Annotation = ReadOf; AnnotationAnchor [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationAnchor{ readonly page: PageRef; readonly bounds: Rect; readonly boundsIn?: (view: ViewEnv) => Rect | null; } AnnotationAppearanceImage [InterfaceDeclaration] (from packages/engine/core/src/dto/AnnotationRender.ts): export interface AnnotationAppearanceImage{ ref: AnnotationRef; mode: AnnotationAppearanceMode; state: string | null; rect: C['box']; image: PageImageHandle; } AnnotationBundle [InterfaceDeclaration] (from packages/engine/core/src/transfer/AnnotationBundle.ts): export interface AnnotationBundle{ readonly format: 'embedpdf/annotations'; readonly version: 1; readonly pages: readonly BundlePage[]; readonly items: readonly AnnotationBundleItem[]; readonly resources: Readonly>; } AnnotationCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationCapability extends SettingsApi{ get(ref: AnnotationRef): Annotation | null; list(filter?: AnnotationFilter): readonly Annotation[]; getAt(page: PageRef | number, point: Point): Annotation | null; isPending(ref: AnnotationRef): boolean; getStatus(): ResourceStatus; getHovered(): Annotation | null; refresh(options?: OperationOptions): Promise; create( page: PageRef | number, draft: AnnotationDraft | Annotation, resources?: AnnotationResources, options?: OperationOptions &{ tool?: string; select?: boolean} , ): Promise<{ annotation: Annotation} >; createFromSelection( tool: string, options?: OperationOptions &{ clear?: boolean} , ): Promise<{ annotations: readonly Annotation[]} >; update( ref: AnnotationRef, patch: AnnotationPatch, resources?: AnnotationResources, options?: OperationOptions, ): Promise<{ annotation: Annotation} >; delete(ref: AnnotationRef, options?: OperationOptions): Promise; reorder( refs: readonly AnnotationRef[], position: AnnotationPosition, options?: OperationOptions, ): Promise; duplicate( refs: readonly AnnotationRef[], options?: AnnotationDuplicateOptions & OperationOptions, ): Promise; export( selection?: AnnotationExportSelection, options?: OperationOptions, ): Promise; import( bundle: AnnotationBundle, options?: AnnotationImportOptions & OperationOptions & HistoryOptions, ): Promise; downloadResource( ref: AnnotationRef, role: AnnotationResourceRole, options?: OperationOptions, ): Promise; readonly links: AnnotationLinksCapability; readonly selection: AnnotationSelectionCapability; readonly draft: AnnotationDraftCapability; readonly text: AnnotationTextCapability; readonly tools: AnnotationToolsCapability; readonly stamps: AnnotationStampsCapability; readonly comments: CommentsCapability; setFilePickerProvider(provider: FilePickerProvider | null): Unsubscribe; canRead(): boolean; canCreate(): boolean; canUpdate(ref: AnnotationRef): boolean; canDelete(ref: AnnotationRef): boolean; canDuplicate(refs: readonly AnnotationRef[]): boolean; isEditable(ref: AnnotationRef): boolean; isMovable(ref: AnnotationRef): boolean; cancel(): void; readonly onCreated: EventHook; readonly onUpdated: EventHook; readonly onDeleted: EventHook; readonly onReordered: EventHook; readonly onResynced: EventHook; readonly onWriteFailed: EventHook; readonly onSelectionChanged: EventHook; readonly onDraftChanged: EventHook; readonly onEditingChanged: EventHook; readonly onHoverChanged: EventHook; } AnnotationConfig [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type AnnotationConfig = DeepPartial; AnnotationCreatedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationCreatedEvent{ readonly annotation: Annotation; readonly origin: EventOrigin; } AnnotationDeletedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationDeletedEvent{ readonly refs: readonly AnnotationRef[]; readonly page: PageRef; readonly origin: EventOrigin; } AnnotationDraft [TypeAliasDeclaration] (from packages/engine/core/src/annotation/kinds/declarations.ts): export type AnnotationDraft = CreateOf< WritableAnnotationDeclaration, C >; AnnotationDraftCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationDraftCapability{ get(): CreationDraft | null; finish(options?: OperationOptions): Promise<{ annotation: Annotation} | null>; cancel(): void; } AnnotationDraftChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationDraftChangedEvent{ readonly draft: CreationDraft | null; } AnnotationDraftMenu [FunctionDeclaration] (from packages/framework/react/src/annotation-menu.tsx): export function AnnotationDraftMenu({ children, gap = 8, placement = 'top', } : AnnotationDraftMenuProps){ const anchor = useOptionalSelector( AnnotationToken, (annotation) => annotation.draft.get(), null, sameCreationDraftAnchor, ); if (!anchor) return null; return ( { children(anchor)} ); } AnnotationDraftMenuProps [InterfaceDeclaration] (from packages/framework/react/src/annotation-menu.tsx): export interface AnnotationDraftMenuProps{ children: (anchor: CreationDraftAnchor) => React.ReactNode; gap?: number; placement?: AnchoredPlacement; } AnnotationDuplicateOptions [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationDuplicateOptions{ readonly page?: PageRef | number; readonly offset?:{ readonly x: number; readonly y: number} ; readonly select?: boolean; } AnnotationDuplicateResult [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationDuplicateResult{ readonly annotations: readonly Annotation[]; readonly dropped: readonly AnnotationImportDrop[]; } AnnotationEditingChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationEditingChangedEvent{ readonly ref: AnnotationRef | null; } AnnotationExportSelection [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationExportSelection{ readonly refs?: readonly AnnotationRef[]; readonly pages?: readonly (PageRef | number)[]; } AnnotationFilter [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationFilter{ readonly pages?: readonly (PageRef | number)[]; readonly subtype?: AnnotationSubtype; } AnnotationFlags [InterfaceDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export interface AnnotationFlags{ invisible: boolean; hidden: boolean; print: boolean; noZoom: boolean; noRotate: boolean; noView: boolean; readOnly: boolean; locked: boolean; toggleNoView: boolean; lockedContents: boolean; } AnnotationFrame [InterfaceDeclaration] (from packages/framework/react/src/annotation.tsx): export interface AnnotationFrame{ width: number; height: number; rotation: number; scale: number; } AnnotationHoverChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationHoverChangedEvent{ readonly ref: AnnotationRef | null; } AnnotationImportDrop [InterfaceDeclaration] (from packages/engine/core/src/transfer/annotationImport.ts): export interface AnnotationImportDrop{ readonly ref: AnnotationRef; readonly field?: string; readonly reason: AnnotationDropReason; } AnnotationImportOptions [InterfaceDeclaration] (from packages/engine/core/src/transfer/annotationImport.ts): export interface AnnotationImportOptions extends WriteOptions{ readonly pages?: BundleImportPages; readonly attribution?: 'restore' | 'stamp'; } AnnotationImportResult [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationImportResult{ readonly annotations: readonly Annotation[]; readonly refMap: ReadonlyArray<{ readonly from: AnnotationRef; readonly to: AnnotationRef} >; readonly dropped: readonly AnnotationImportDrop[]; } AnnotationInteractiveContext [InterfaceDeclaration] (from packages/framework/react/src/annotation.tsx): export interface AnnotationInteractiveContext{ annotation: Annotation; toolId: string; } AnnotationLayer [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function AnnotationLayer({ renderers, components} : AnnotationLayerProps ={ } ){ const page = usePage(); const anno = useCapability(AnnotationHostToken); useOptionalSelector(InteractionToken, (interaction) => interaction.getActiveToolId(), ''); const interaction = useOptionalCapability(InteractionToken); const viewZoom = page.transform.zoom; const viewRotation = page.transform.rotation; const items = useSelector( AnnotationHostToken, (annotation) => annotation.listPageItems(page.ref, { zoom: viewZoom, rotation: viewRotation} ), shallowArray, ); const texts = useSelector( AnnotationHostToken, (annotation) => annotation.listTextItems(page.ref, { zoom: viewZoom, rotation: viewRotation} ), shallowArray, ); const [urls, setUrls] = useState | null>(null); const [shown] = useState(createShownUrls); useEffect(() => () => shown.release(), [shown]); useRendererBehaviors(anno, () => (interaction?.getActiveToolId() as string) ?? '', renderers); usePaintsPagePart(page.ref, 'annotations'); const previousRenderers = useRef(renderers); if ( renderers && previousRenderers.current && renderers !== previousRenderers.current && shallowArray(renderers, previousRenderers.current) ){ devWarn( 'annotation-renderers-inline', ' was given a new array with the same entries — define it ' + 'outside render (module scope or useMemo), because entry identity keys the behavior registration.', ); } previousRenderers.current = renderers; const bakedKey = useSelector(AnnotationHostToken, (annotation) => annotation.getAppearanceEpoch(page.ref), ); const bakeScale = useOptionalSelector( RenderToken, (render) => render.getAppearanceScale(page.transform.renderScale), page.transform.renderScale, ); useEffect( () => loadAppearanceUrls( shown, (signal) => anno.renderAppearances(page.ref, bakeScale, signal), annotationKey, setUrls, ), [shown, anno, page.ref, bakeScale, bakedKey], ); const editingKey = editingTextKeyOf(texts, annotationKey); return (
{ items.map((item) =>{ const state = item.annotation?.appearanceState ?? null; const shows = pictureOrPainting({ pending: item.source !== 'baked', picture: urls && shownAppearance(urls, item.id, state), version: item.pictureVersion ?? 0, loaded: urls !== null, paint: () => (hasLiveDrawing(item) ? item : null), } ); const native: React.ReactNode = shows?.kind === 'painting' ? ( ) : shows?.kind === 'picture' && item.raster ? ( ) : null; const framed = ( content: React.ReactNode, options?:{ interactive?: boolean; inert?: boolean} , ) => ( { content} ); const annotation = item.annotation; if (!annotation) return framed(native); const look = ( entry: Extract, interactive: boolean, ): React.ReactNode =>{ const pixels = frameInPixels(item.frame, page.transform); const scaled = entry.scale !== false; const Look = entry.component; const drawn = ( ); if (!scaled) return drawn; return (
{ drawn}
); } ; const typing = editingKey !== null && annotationKey(annotation.ref) === editingKey; const drawing = annotationDrawingOf(annotation, anno, renderers, typing); switch (drawing.kind){ case 'owned':{ const Owner = drawing.entry.component; return ( ); } case 'look': return framed(look(drawing.entry, drawing.interactive), { interactive: drawing.interactive, inert: drawing.inert, } ); case 'native': return framed(native, { inert: drawing.inert} ); } } )} { } { layerTextBoxesOf(texts, items, renderers, annotationKey).map((text) => ( ))}
); } AnnotationLayerComponents [InterfaceDeclaration] (from packages/framework/react/src/annotation.tsx): export interface AnnotationLayerComponents{ Handle?: React.ComponentType; RotationHandle?: React.ComponentType; } AnnotationLayerProps [InterfaceDeclaration] (from packages/framework/react/src/annotation.tsx): export interface AnnotationLayerProps{ renderers?: AnnotationRenderer[]; components?: AnnotationLayerComponents; } AnnotationLinksCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationLinksCapability{ get(ref: AnnotationRef): PdfLinkTarget | null; set(ref: AnnotationRef, target: PdfLinkTarget, options?: OperationOptions): Promise; clear(ref: AnnotationRef, options?: OperationOptions): Promise; } AnnotationMenu [FunctionDeclaration] (from packages/framework/react/src/annotation-menu.tsx): export function AnnotationMenu({ children, gap = 15, placement = 'top'} : AnnotationMenuProps){ const{ projector} = useProjectorBinding(); const anchor = useOptionalSelector( AnnotationHostToken, (annotation) =>{ const selectionAnchor = annotation.selection.getAnchor(); if (!selectionAnchor) return null; const env = projector.viewEnv(selectionAnchor.page); return env ? annotation.getSelectionAnchorIn(env) : selectionAnchor; } , null, sameSelectionAnchor, ); if (!anchor) return null; return ( { children} ); } AnnotationMenuProps [InterfaceDeclaration] (from packages/framework/react/src/annotation-menu.tsx): export interface AnnotationMenuProps{ children: React.ReactNode; gap?: number; placement?: AnchoredPlacement; } AnnotationOption [InterfaceDeclaration] (from packages/core/annotation/src/kinds/define.ts): export interface AnnotationOption{ readonly value: string; readonly label: string; readonly labelKey: string; } AnnotationPatch [TypeAliasDeclaration] (from packages/engine/core/src/annotation/kinds/declarations.ts): export type AnnotationPatch = UpdateOf< WritableAnnotationDeclaration, C >; AnnotationPosition [TypeAliasDeclaration] (from packages/engine/core/src/mutation/ListPosition.ts): export type AnnotationPosition = ListPosition; AnnotationProperties [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationProperties{ readonly properties: readonly AnnotationProperty[]; readonly values: FieldValues; readonly mixed: readonly string[]; } AnnotationProperty [TypeAliasDeclaration] (from packages/core/annotation/src/kinds/define.ts): export type AnnotationProperty = |{ readonly key: 'color' | 'interiorColor' | 'fontColor'; readonly control: 'color'; readonly label: string; readonly labelKey: string; readonly allowsNone?: boolean; } |{ readonly key: 'opacity' | 'strokeWidth' | 'fontSize'; readonly control: 'number'; readonly label: string; readonly labelKey: string; readonly min: number; readonly max: number; readonly step: number; } |{ readonly key: 'borderStyle'; readonly control: 'choice'; readonly label: string; readonly labelKey: string; readonly options: readonly AnnotationOption[]; readonly cloudy: boolean; } |{ readonly key: 'lineEndings' | 'fontFamily' | 'textAlign' | 'blendMode' | 'icon' | 'subtype'; readonly control: 'choice'; readonly label: string; readonly labelKey: string; readonly options: readonly AnnotationOption[]; } |{ readonly key: 'orientation'; readonly control: 'choice'; readonly label: string; readonly labelKey: string; readonly options: readonly AnnotationOption[]; } |{ readonly key: FlagKey; readonly control: 'flag'; readonly label: string; readonly labelKey: string; } |{ readonly key: 'overlayText'; readonly control: 'text'; readonly label: string; readonly labelKey: string; } |{ readonly key: 'bold' | 'italic' | 'underline'; readonly control: 'textFormat'; readonly label: string; readonly labelKey: string; readonly format: 'bold' | 'italic' | 'underline'; } |{ readonly key: 'link'; readonly control: 'link'; readonly label: string; readonly labelKey: string; } ; AnnotationRef [TypeAliasDeclaration] (from packages/engine/core/src/identity/AnnotationRef.ts): export type AnnotationRef = |{ kind: 'objectNumber'; page: PageRef; objectNumber: number; } |{ kind: 'baseIndex'; page: PageRef; baseIndex: number; } ; AnnotationRenderer [TypeAliasDeclaration] (from packages/framework/react/src/annotation.tsx): export type AnnotationRenderer = |{ behavior: string; component: React.ComponentType} |{ id?: string; for: (annotation: Annotation) => boolean; component: React.ComponentType; interactive?: boolean | ((context: AnnotationInteractiveContext) => boolean); scale?: boolean; } ; AnnotationRendererProps [InterfaceDeclaration] (from packages/framework/react/src/annotation.tsx): export interface AnnotationRendererProps{ annotation: Annotation; frame: AnnotationFrame; native: React.ReactNode; appearance:{ url: string} | null; hovered: boolean; selected: boolean; interactive: boolean; } AnnotationReorderedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationReorderedEvent{ readonly page: PageRef; readonly order: readonly AnnotationRef[]; readonly origin: EventOrigin; } AnnotationResourceRole [TypeAliasDeclaration] (from packages/engine/core/src/annotation/resources.ts): export type AnnotationResourceRole = (typeof ANNOTATION_RESOURCE_ROLE_NAMES)[number]; AnnotationResources [TypeAliasDeclaration] (from packages/engine/core/src/annotation/resources.ts): export type AnnotationResources = Partial>; AnnotationResyncedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationResyncedEvent{ readonly pages: readonly PageRef[] | 'all'; } AnnotationRotationAnchor [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type AnnotationRotationAnchor = RotationAnchor; AnnotationRotationBadge [FunctionDeclaration] (from packages/framework/react/src/annotation-menu.tsx): export function AnnotationRotationBadge({ children, gap = 16, placement = 'right', } : AnnotationRotationBadgeProps){ const rotation = useOptionalSelector( AnnotationToken, (annotation) => annotation.selection.getRotationAnchor(), null, sameRotationAnchor, ); const readout = useAnnotationSettings((settings) => settings.chrome.readout); if (!rotation || (!children && !readout.enabled)) return null; return ( { children ? ( children(rotation) ) : (
{ rotation.angle} °
)}
); } AnnotationRotationBadgeProps [InterfaceDeclaration] (from packages/framework/react/src/annotation-menu.tsx): export interface AnnotationRotationBadgeProps{ children?: (rotation: RotationAnchor) => React.ReactNode; gap?: number; placement?: AnchoredPlacement; } AnnotationSelectionAnchor [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationSelectionAnchor{ readonly page: PageRef; readonly bounds: Rect; readonly rotationHandle?: Point; } AnnotationSelectionCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationSelectionCapability{ select(refs: readonly AnnotationRef[]): void; add(refs: readonly AnnotationRef[]): void; selectAll(page?: PageRef | number): void; selectInRect(page: PageRef | number, rect: Rect): void; clear(): void; getSelected(): readonly Annotation[]; update( changes: AnnotationPatch | ((annotation: Annotation) => AnnotationPatch), options?: OperationOptions, ): Promise>; updateLink( target: PdfLinkTarget | null, options?: OperationOptions, ): Promise>; getProperties(): AnnotationProperties; delete(options?: OperationOptions): Promise>; rotateBy(degrees: 90 | -90, options?: OperationOptions): Promise; resetRotation(options?: OperationOptions): Promise; group(options?: OperationOptions): Promise; ungroup(options?: OperationOptions): Promise; canGroup(): boolean; canUngroup(): boolean; duplicate( options?: OperationOptions &{ offset?:{ readonly x: number; readonly y: number} } , ): Promise; canDuplicate(): boolean; getAnchor(): AnnotationSelectionAnchor | null; getRotationAnchor(): AnnotationRotationAnchor | null; } AnnotationSelectionChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationSelectionChangedEvent{ readonly refs: readonly AnnotationRef[]; readonly previousRefs: readonly AnnotationRef[]; } AnnotationSettings [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationSettings{ readonly tools: readonly AnnotationToolInput[]; readonly afterCreate: AfterCreateSettings; readonly chrome: ChromeSettings; readonly snap: SnapSettings; readonly editable: EditableKinds; } AnnotationStampsCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationStampsCapability{ arm(stamp: StampInput, options?: OperationOptions): Promise; disarm(): void; isArmed(): boolean; place( stamp: StampInput, placement: StampPlacement, options?: OperationOptions, ): Promise<{ annotation: Annotation} >; } AnnotationState [InterfaceDeclaration] (from packages/plugin/annotation/src/state.ts): export interface AnnotationState{ readonly status: ResourceStatus; readonly selected: readonly Annotation[]; readonly hovered: Annotation | null; readonly editing: Annotation | null; } AnnotationSubtype [TypeAliasDeclaration] (from packages/engine/core/src/annotation/subtype.ts): export type AnnotationSubtype = (typeof ANNOTATION_SUBTYPES)[number]; AnnotationTextCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationTextCapability{ begin(ref: AnnotationRef): void; end(options?: OperationOptions): Promise; getEditing(): Annotation | null; toggleFormat(format: TextFormat, options?: OperationOptions): Promise; } AnnotationToken [VariableDeclaration] (from packages/plugin/annotation/src/token.ts): AnnotationToken = createCapabilityToken('annotation', { hint: `add annotationPlugin() from '@embedpdf/plugin-annotation' to your plugins list`, promises:{ refresh: true, create: true, createFromSelection: true, update: true, delete: true, reorder: true, duplicate: true, export: true, import: true, downloadResource: true, 'links.set': true, 'links.clear': true, 'selection.update': true, 'selection.updateLink': true, 'selection.delete': true, 'selection.rotateBy': true, 'selection.resetRotation': true, 'selection.group': true, 'selection.ungroup': true, 'selection.duplicate': true, 'draft.finish': true, 'text.end': true, 'text.toggleFormat': true, 'stamps.arm': true, 'stamps.place': true, 'comments.reply': true, 'comments.setText': true, 'comments.setStatus': true, 'comments.setMarked': true, 'comments.delete': true, 'comments.deleteThread': true, } , } ) AnnotationTool [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationTool{ readonly id: string; readonly subtype: KindName; readonly preset: string; readonly cursor: string; readonly enables: readonly string[]; readonly defaults?: FieldValues; readonly ghost: ResolvedGhost; readonly meta?: Readonly>; } AnnotationToolDefinition [InterfaceDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export interface AnnotationToolDefinition{ id: string; extends?: string; subtype?: KindName; fieldsKind?: string; preset?: string; defaults?: ToolDefaultsFor; flags?: Partial; cursor?: string; enables?: string[]; source?: K extends 'stamp' ? StampSourceSpec : K extends 'file-attachment' ? PromptSourceSpec : never; selection?: SelectionAuthoring; ink?: K extends 'ink' ? InkAuthoringOptions : never; upright?: boolean; clickCreate?: ClickCreate | false; ghost?: GhostPolicy; afterCreate?: Partial; meta?: Record; } AnnotationToolInput [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type AnnotationToolInput = DirectToolDef | BuiltinToolOverride | ExtendedBuiltinToolDef; AnnotationToolsCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationToolsCapability{ list(): readonly AnnotationTool[]; get(id: string): AnnotationTool | null; register(tool: AnnotationToolInput): Unsubscribe; getDefaults(id: string): ToolDefaults; updateDefaults(id: string, changes: FieldValues): void; getProperties(id: string): AnnotationProperties; readonly onDefaultsChanged: EventHook; } AnnotationTransfer [VariableDeclaration] (from packages/engine/core/src/transfer/AnnotationTransfer.ts): AnnotationTransfer = bundleCodec({ kind: 'annotation', keys: ANNOTATION_BUNDLE_KEYS, assertManifest: assertAnnotationBundleManifest, } ) AnnotationUpdatedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationUpdatedEvent{ readonly annotation: Annotation; readonly origin: EventOrigin; } AnnotationWriteFailedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface AnnotationWriteFailedEvent{ readonly refs: readonly AnnotationRef[]; readonly error: PluginErrorInfo; } AnyPlugin [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type AnyPlugin = PluginDefinition; AppliedValidationTime [TypeAliasDeclaration] (from packages/core/signature/src/trust.ts): export type AppliedValidationTime = |{ readonly kind: 'now'} |{ readonly kind: 'timestamp'; readonly stampedAt: string; readonly tokenVerified: true; readonly genTime: string; } ; AreaUnit [TypeAliasDeclaration] (from packages/engine/core/src/measure/units.ts): export type AreaUnit = `${ LengthUnit} 2` | 'ha' | 'acre'; ArmedSelectionHandle [InterfaceDeclaration] (from packages/plugin/selection/src/handles.ts): export interface ArmedSelectionHandle{ base: Point; drag: SelectionHandleDragSession; } ArmedStampInfo [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ArmedStampInfo{ readonly width: number; readonly height: number; readonly name?: string; readonly subject?: string; } ArmedStampPreview [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ArmedStampPreview{ readonly bytes: Uint8Array; readonly mimeType?: string; } ArrivalAlignValue [TypeAliasDeclaration] (from packages/plugin/stage/src/contract.ts): export type ArrivalAlignValue = AlignValue | 'keep'; ArrivalAlignment [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface ArrivalAlignment{ readonly x: ArrivalAlignValue; readonly y: ArrivalAlignValue; } AssetFromAnnotationsInput [TypeAliasDeclaration] (from packages/plugin/stamp/src/contract.ts): export type AssetFromAnnotationsInput = Omit; AttachedFile [InterfaceDeclaration] (from packages/plugin/attachment/src/contract.ts): export interface AttachedFile extends Readonly{ readonly id: string; readonly home: AttachedFileHome; } AttachedFileHome [TypeAliasDeclaration] (from packages/plugin/attachment/src/contract.ts): export type AttachedFileHome = |{ readonly kind: 'document'; readonly ref: AttachmentRef} |{ readonly kind: 'page'; readonly ref: AnnotationRef} ; AttachmentCapability [InterfaceDeclaration] (from packages/plugin/attachment/src/contract.ts): export interface AttachmentCapability{ list(): readonly AttachedFile[]; get(id: string): AttachedFile | null; getSelected(): readonly AttachedFile[]; select(files: readonly AttachedFile[]): void; isPending(file: AttachedFile): boolean; getStatus(): ResourceStatus; ensureLoaded(options?: OperationOptions): Promise; refresh(options?: OperationOptions): Promise; canDownload(): boolean; canCreate(): boolean; canDelete(file: AttachedFile): boolean; create( files: readonly AttachmentFileSource[], options?: OperationOptions, ): Promise; delete(file: AttachedFile, options?: OperationOptions): Promise; download(file: AttachedFile, options?: OperationOptions): Promise; reveal(file: AttachedFile): void; readonly onChanged: EventHook; readonly onResynced: EventHook; } AttachmentContent [InterfaceDeclaration] (from packages/engine/core/src/dto/Attachment.ts): export interface AttachmentContent{ bytes: Uint8Array; name: string; mimeType: string | null; } AttachmentFileInfo [InterfaceDeclaration] (from packages/engine/core/src/dto/Attachment.ts): export interface AttachmentFileInfo{ name: string; mimeType: string | null; description: string | null; sizeBytes: number | null; md5: string | null; createdAt: IsoDateTime | null; modifiedAt: IsoDateTime | null; } AttachmentFileSource [InterfaceDeclaration] (from packages/engine/core/src/dto/Attachment.ts): export interface AttachmentFileSource{ data: Uint8Array | ArrayBuffer | Blob; name?: string; mimeType?: string; description?: string; } AttachmentRef [TypeAliasDeclaration] (from packages/engine/core/src/dto/Attachment.ts): export type AttachmentRef ={ kind: 'key'; key: string} ; AttachmentState [InterfaceDeclaration] (from packages/plugin/attachment/src/state.ts): export interface AttachmentState{ readonly files: readonly AttachedFile[]; readonly selected: readonly AttachedFile[]; readonly status: ResourceStatus; readonly canCreate: boolean; readonly canDownload: boolean; } AttachmentToken [VariableDeclaration] (from packages/plugin/attachment/src/token.ts): AttachmentToken = createCapabilityToken('attachment', { hint: "add attachmentPlugin() from '@embedpdf/plugin-attachment' to your plugins list", promises:{ ensureLoaded: true, refresh: true, create: true, delete: true, download: true, } , } ) AttachmentsChangedEvent [InterfaceDeclaration] (from packages/plugin/attachment/src/contract.ts): export interface AttachmentsChangedEvent{ readonly type: 'created' | 'deleted' | 'restored'; readonly files: readonly AttachedFile[]; readonly origin: EventOrigin; } AttachmentsResyncedEvent [InterfaceDeclaration] (from packages/plugin/attachment/src/contract.ts): export interface AttachmentsResyncedEvent{ readonly files: readonly AttachedFile[]; } AuthorableFormKind [TypeAliasDeclaration] (from packages/plugin/form/src/tools/definitions.ts): export type AuthorableFormKind = Exclude; BarChild [TypeAliasDeclaration] (from packages/core/ui/src/schema.ts): export type BarChild = BarItem | CustomItem | string; BarGroup [InterfaceDeclaration] (from packages/core/ui/src/schema.ts): export interface BarGroup{ readonly id: string; readonly labelKey?: string; readonly role?: 'buttons' | 'tabs'; readonly shed?: boolean; readonly collapse?: 'menu' | 'select'; readonly importance?: Importance; readonly dependent?: boolean; readonly items: readonly BarChild[]; } BarItem [InterfaceDeclaration] (from packages/core/ui/src/schema.ts): export interface BarItem{ readonly command: string; readonly variants?: readonly Variant[]; readonly importance?: Importance; readonly emphasis?: Emphasis; } BarSchema [InterfaceDeclaration] (from packages/core/ui/src/schema.ts): export interface BarSchema{ readonly id: string; readonly sections: BarSections; } BarSections [InterfaceDeclaration] (from packages/core/ui/src/schema.ts): export interface BarSections{ readonly start?: readonly BarGroup[]; readonly center?: readonly BarGroup[]; readonly end?: readonly BarGroup[]; } BatchResult [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface BatchResult{ readonly applied: readonly T[]; readonly skipped: readonly{ readonly ref: R; readonly reason: string} []; readonly failed: readonly{ readonly ref: R; readonly error: PluginErrorInfo} []; } Behavior [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface Behavior{ readonly id: string; matches(annotation: Annotation): boolean; engaged(annotation: Annotation): boolean; } BehaviorRendererProps [InterfaceDeclaration] (from packages/framework/react/src/annotation.tsx): export interface BehaviorRendererProps{ annotation: Annotation; item: RenderItem; page: PageContextValue; native: React.ReactNode; hovered: boolean; selected: boolean; interactive: boolean; } BlendMode [TypeAliasDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export type BlendMode = | 'normal' | 'multiply' | 'screen' | 'overlay' | 'darken' | 'lighten' | 'color-dodge' | 'color-burn' | 'hard-light' | 'soft-light' | 'difference' | 'exclusion' | 'hue' | 'saturation' | 'color' | 'luminosity'; BoundCommand [InterfaceDeclaration] (from packages/plugin/commands/src/contract.ts): export interface BoundCommand extends ResolvedCommand{ readonly run: () => Promise; readonly shortcutLabel: string | null; } Box [InterfaceDeclaration] (from packages/plugin/form/src/model.ts): export interface Box{ readonly x: number; readonly y: number; readonly width: number; readonly height: number; } BoxQuery [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface BoxQuery{ readonly minWidth?: number; readonly maxWidth?: number; readonly minHeight?: number; readonly maxHeight?: number; readonly orientation?: 'portrait' | 'landscape'; } ByteStore [InterfaceDeclaration] (from packages/framework/web/src/byte-store.ts): export interface ByteStore{ list(): Promise>; put(id: string, bytes: Uint8Array): Promise; delete(id: string): Promise; } COMMANDS_DEFAULTS [VariableDeclaration] (from packages/plugin/commands/src/contract.ts): COMMANDS_DEFAULTS: CommandsSettings ={ commands: [], appState: undefined, disabledCategories: [], disabledCommands: [], notAllowed: 'hide', } CONTINUOUS_RENDER_POLICY [VariableDeclaration] (from packages/engine/core/src/engine/DocumentRenderService.ts): CONTINUOUS_RENDER_POLICY: EngineRenderPolicy ={ kind: 'continuous'} CalibrateInput [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface CalibrateInput{ page: PageRef | number; from: Point; to: Point; distance:{ value: number; unit: LengthUnit} ; } CalibrationCompletedEvent [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface CalibrationCompletedEvent{ readonly page: PageRef; } CalibrationDismissedEvent [TypeAliasDeclaration] (from packages/plugin/measurement/src/contract.ts): export type CalibrationDismissedEvent = Record; CalibrationRequest [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface CalibrationRequest{ page: PageRef; from: Point; to: Point; userSpaceLength: number; } CalibrationRequestedEvent [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface CalibrationRequestedEvent{ readonly request: CalibrationRequest; } CallFacts [InterfaceDeclaration] (from packages/engine/core/src/scheduling/facts.ts): export interface CallFacts{ readonly priority?: CallPriority; readonly view?: string; } CallPriority [TypeAliasDeclaration] (from packages/engine/core/src/scheduling/facts.ts): export type CallPriority = 'high' | 'auto' | 'low'; Camera [InterfaceDeclaration] (from packages/core/stage/src/index.ts): export interface Camera{ x: number; y: number; zoom: number; } Cancel [TypeAliasDeclaration] (from packages/core/main/src/clock.ts): export type Cancel = () => void; CancelledError [ClassDeclaration] (from packages/core/main/src/scope.ts): export class CancelledError extends Error{ constructor(what: string){ super(`[kernel] cancelled: ${ what} `); this.name = 'CancelledError'; } } CapabilityToken [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface CapabilityToken{ readonly name: string; readonly hint?: string; readonly promises?: Readonly>; readonly __type?: T; } ChangeAnalysis [InterfaceDeclaration] (from packages/engine/core/src/signature/analysis/types.ts): export interface ChangeAnalysis{ mode: 'authoritative' | 'exploratory'; policyVersion: number; basis:{ version: BaseVersionInfo; editsVersion: number; source: 'persisted' | 'working-copy'} ; since:{ revisionIndex: number; signatureIndex: number | null} ; until:{ revisionIndex: number} ; restrictions: RestrictionAnchor[]; current: Assessment &{ method: 'net-state' | 'net-state+replay'} ; later:{ revisionCount: number; undoneObjectNumbers: number[]; } ; verdict: StepVerdict; steps: RevisionAnalysis[]; } ChangeLabel [InterfaceDeclaration] (from packages/core/main/src/changes.ts): export interface ChangeLabel{ readonly key: string; readonly [value: string]: string | number; } ChangeQueue [InterfaceDeclaration] (from packages/core/main/src/changes.ts): export interface ChangeQueue{ stage(change: StagedChange): PendingChange; hold(label: ChangeLabel, options?: HoldOptions): HeldChange; sendHolds(): void; group(label: ChangeLabel, run: () => T): T; takeObjectNumber(): number | null; reserveObjectNumbers(count: number): Promise; listPending(): readonly PendingChange[]; hasPending(): boolean; whenSettled(): Promise; readonly onStaged: EventHook; readonly onSettled: EventHook; } ChromeSettings [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ChromeSettings{ readonly accent: string | null; readonly outline:{ readonly color: string | null; readonly style: LineStyle; readonly width: number; } ; readonly handles:{ readonly shape: 'square' | 'circle'; readonly size: number; readonly hitSize: number; readonly fill: string; readonly stroke: string | null; } ; readonly rotationHandle:{ readonly enabled: boolean; readonly size: number; readonly hitSize: number; readonly offset: number; readonly stalk: boolean; readonly fill: string | null; readonly stroke: string | null; } ; readonly guides:{ readonly enabled: boolean; readonly color: string; readonly rotationColor: string | null; readonly style: LineStyle; readonly width: number; } ; readonly marquee:{ readonly fill: string | null; readonly stroke: string | null; } ; readonly textOutline: string | null; readonly readout:{ readonly enabled: boolean; readonly background: string; readonly color: string; } ; } ClickCreate [TypeAliasDeclaration] (from packages/core/annotation/src/types.ts): export type ClickCreate = |{ width: number; height: number; anchor?: 'center' | 'top-left'} |{ length: number; rotation?: number; anchor?: 'center' | 'start' | 'end'} ; CmsSigner [InterfaceDeclaration] (from packages/core/signature/src/sign.ts): export interface CmsSigner{ readonly kind: 'cms'; readonly hash?: Exclude; sign(input:{ digest: Uint8Array; algorithm: Exclude; subFilter: SignatureSubFilter | 'ETSI.RFC3161'; } ): Promise; } CollapsedGroupView [TypeAliasDeclaration] (from packages/framework/react/src/toolbar.tsx): export type CollapsedGroupView = CollapsedGroupViewOf; Color [TypeAliasDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export type Color = string; CommandContext [InterfaceDeclaration] (from packages/core/main/src/command-types.ts): export interface CommandContext{ readonly documentId: string | null; readonly appState: AppState; readonly args?: unknown; readonly signal?: AbortSignal; get(token: CapabilityToken): T; tryGet(token: CapabilityToken): T | null; } CommandDefinition [InterfaceDeclaration] (from packages/core/main/src/command-types.ts): export interface CommandDefinition{ readonly id: string; readonly label?: string; readonly labelKey?: string; readonly icon?: string; iconAccent?(context: CommandContext): IconAccent | null; readonly shortcut?: string | readonly string[]; readonly shortcutInTextFields?: boolean; readonly categories?: readonly string[]; readonly requires?: readonly Permission[]; allowed?(context: CommandContext): boolean; readonly notAllowedKey?: string; locked?(context: CommandContext): SettingLock | null; readonly menu?: string; readonly panel?: | string |{ readonly id: string; readonly exclusive?: string; readonly focus?: boolean} ; readonly modal?: string; enabled?(context: CommandContext): boolean; active?(context: CommandContext): boolean; visible?(context: CommandContext): boolean; labelParams?(context: CommandContext): Readonly>; run?(context: CommandContext): void | Promise; } CommandExecutedEvent [InterfaceDeclaration] (from packages/plugin/commands/src/contract.ts): export interface CommandExecutedEvent{ readonly commandId: CommandId; readonly documentId: string | null; readonly args: unknown; } CommandExecutionFailedEvent [InterfaceDeclaration] (from packages/plugin/commands/src/contract.ts): export interface CommandExecutionFailedEvent{ readonly commandId: CommandId; readonly documentId: string | null; readonly error: PluginErrorInfo; } CommandFamily [InterfaceDeclaration] (from packages/core/main/src/command-types.ts): export interface CommandFamily{ readonly prefix: string; readonly names: (context: CommandContext) => readonly string[]; readonly command: (name: string) => Omit; } CommandId [TypeAliasDeclaration] (from packages/plugin/commands/src/contract.ts): export type CommandId = string; CommandRefusal [InterfaceDeclaration] (from packages/plugin/commands/src/contract.ts): export interface CommandRefusal{ readonly reason: 'turned-off' | 'not-allowed' | 'locked'; readonly message: string; } CommandsCapability [InterfaceDeclaration] (from packages/plugin/commands/src/contract.ts): export interface CommandsCapability extends SettingsApi{ registerCommand(definition: CommandDefinition, options?: RegisterCommandOptions): Unsubscribe; registerCommands( definitions: readonly CommandDefinition[], options?: RegisterCommandOptions, ): Unsubscribe; hasCommand(id: CommandId): boolean; getCommand(id: CommandId): CommandDefinition | null; listCommandIds(): readonly CommandId[]; resolveCommand(id: CommandId, documentId?: string): ResolvedCommand | null; listCommands(documentId?: string): readonly ResolvedCommand[]; searchCommands(query: string, documentId?: string): readonly ResolvedCommand[]; listShortcuts(): readonly{ readonly commandId: CommandId; readonly shortcut: string} []; execute(id: CommandId, options?: ExecuteOptions): Promise; canExecute(id: CommandId, documentId?: string): boolean; getRefusal(id: CommandId, documentId?: string): CommandRefusal | null; getDisabledCategories(): readonly string[]; isCategoryDisabled(category: string): boolean; disableCategory(category: string): void; enableCategory(category: string): void; setDisabledCategories(categories: readonly string[]): void; getDisabledCommands(): readonly CommandId[]; isCommandDisabled(id: CommandId): boolean; disableCommand(id: CommandId): void; enableCommand(id: CommandId): void; setDisabledCommands(ids: readonly CommandId[]): void; readonly onExecuted: EventHook; readonly onExecutionFailed: EventHook; } CommandsConfig [TypeAliasDeclaration] (from packages/plugin/commands/src/contract.ts): export type CommandsConfig = Omit< DeepPartial, 'commands' | 'appState' > &{ readonly commands?: readonly (CommandDefinition | CommandFamily)[]; readonly appState?: AppState; } ; CommandsSettings [InterfaceDeclaration] (from packages/plugin/commands/src/contract.ts): export interface CommandsSettings{ readonly commands: readonly (CommandDefinition | CommandFamily)[]; readonly appState: unknown; readonly disabledCategories: readonly string[]; readonly disabledCommands: readonly CommandId[]; readonly notAllowed: NotAllowedMode; } CommandsToken [VariableDeclaration] (from packages/plugin/commands/src/token.ts): CommandsToken = createCapabilityToken('commands', { hint: `add commandsPlugin() from '@embedpdf/plugin-commands' to your plugins list`, } ) CommentThread [InterfaceDeclaration] (from packages/engine/core/src/annotation/comments.ts): export interface CommentThread{ root: T; page: PageRef; replies: T[]; groupedParts: T[]; review: CommentThreadReview; } CommentThreadChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface CommentThreadChangedEvent{ readonly rootRef: AnnotationRef; readonly type: 'reply' | 'text' | 'status' | 'marked' | 'deleted'; } CommentThreadReview [InterfaceDeclaration] (from packages/engine/core/src/annotation/comments.ts): export interface CommentThreadReview{ byReviewer: Record; lastChange: ReviewStatus | null; markedBy: string[]; statusRefs: AnnotationRef[]; mine: ReviewStatus | null; } CommentThreadView [InterfaceDeclaration] (from packages/framework/react/src/annotation.tsx): export interface CommentThreadView extends CommentThread{ pageIndex: number; pageLabel: string; } CommentsCapability [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface CommentsCapability{ listThreads(): readonly CommentThread[]; getThread(ref: AnnotationRef): CommentThread | null; reply( ref: AnnotationRef, text: string, options?: OperationOptions, ): Promise<{ annotation: Annotation} >; setText(ref: AnnotationRef, text: string, options?: OperationOptions): Promise; setStatus(ref: AnnotationRef, state: string, options?: OperationOptions): Promise; setMarked(ref: AnnotationRef, marked: boolean, options?: OperationOptions): Promise; delete(ref: AnnotationRef, options?: OperationOptions): Promise; deleteThread(ref: AnnotationRef, options?: OperationOptions): Promise; canReply(ref: AnnotationRef): boolean; canSetText(ref: AnnotationRef): boolean; canSetStatus(ref: AnnotationRef): boolean; canSetMarked(ref: AnnotationRef): boolean; canDelete(ref: AnnotationRef): boolean; canDeleteThread(ref: AnnotationRef): boolean; readonly onThreadChanged: EventHook; } CoreState [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface CoreState{ readonly documents: Readonly>; readonly pending: Readonly>; readonly order: readonly string[]; readonly activeId: string | null; } CreateAssetInput [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface CreateAssetInput{ libraryId?: string; name?: string; label?: string; kind?: StampAssetKind; subject?: string; categories?: string[]; source?: BinarySource; mark?: MarkSource; preview?: BinarySource; size?:{ width: number; height: number} ; } CreateLibraryOptions [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface CreateLibraryOptions extends OperationOptions{ readonly id?: string; readonly kind?: StampLibraryKind; readonly categories?: string[]; } CreateMeasurementInput [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface CreateMeasurementInput{ kind: MeasurementKind; page: PageRef | number; points: readonly Point[]; tool?: string; } CreatePaneOptions [InterfaceDeclaration] (from packages/plugin/view-manager/src/contract.ts): export interface CreatePaneOptions{ readonly documentIds?: readonly string[]; } CreationDraft [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type CreationDraft = CreationDraftAnchor; CreationDraftAnchor [InterfaceDeclaration] (from packages/core/annotation/src/types.ts): export interface CreationDraftAnchor{ kind: 'poly'; subtype: PolySubtype; page: PageRef; bounds: Rect; pointCount: number; minPoints: number; canFinish: boolean; } Cursor [TypeAliasDeclaration] (from packages/plugin/interaction/src/contract.ts): export type Cursor = string; CustomItem [InterfaceDeclaration] (from packages/core/ui/src/schema.ts): export interface CustomItem{ readonly slot: string; readonly variants?: readonly string[]; readonly terminal?: string; readonly importance?: Importance; readonly grow?: boolean; } CustomMetadata [TypeAliasDeclaration] (from packages/engine/core/src/dto/CustomMetadata.ts): export type CustomMetadata = Record; CustomMetadataCapability [InterfaceDeclaration] (from packages/plugin/metadata/src/contract.ts): export interface CustomMetadataCapability{ getSnapshot(): CustomMetadata | null; getStatus(): ResourceStatus; update( patch: CustomMetadataPatch, options?: OperationOptions, ): Promise<{ readonly custom: CustomMetadata} >; refresh(options?: OperationOptions): Promise; readonly onUpdated: EventHook; readonly onResynced: EventHook; } CustomMetadataPatch [TypeAliasDeclaration] (from packages/engine/core/src/dto/CustomMetadataPatch.ts): export type CustomMetadataPatch = Record; CustomMetadataResyncedEvent [InterfaceDeclaration] (from packages/plugin/metadata/src/contract.ts): export interface CustomMetadataResyncedEvent{ readonly custom: CustomMetadata; } CustomMetadataUpdateResult [InterfaceDeclaration] (from packages/engine/core/src/mutation/CustomMetadataUpdateResult.ts): export interface CustomMetadataUpdateResult{ custom: CustomMetadata; meta: MutationMeta; } CustomMetadataUpdatedEvent [InterfaceDeclaration] (from packages/plugin/metadata/src/contract.ts): export interface CustomMetadataUpdatedEvent{ readonly custom: CustomMetadata; readonly previous: CustomMetadata | null; readonly changedKeys: readonly string[]; readonly origin: EventOrigin; } CustomSlotContext [InterfaceDeclaration] (from packages/core/ui/src/toolbar-layout.ts): export interface CustomSlotContext{ layer: 'live' | 'measure'; measure: (length: number) => void; } DEFAULT_IMPORTANCE [VariableDeclaration] (from packages/core/ui/src/schema.ts): DEFAULT_IMPORTANCE: Importance = 3 DEFAULT_LIBRARY_KIND [VariableDeclaration] (from packages/plugin/stamp/src/convention.ts): DEFAULT_LIBRARY_KIND = 'stamps' DEFAULT_RESPONSIVE [VariableDeclaration] (from packages/plugin/stage/src/settings.ts): DEFAULT_RESPONSIVE: readonly ResponsiveRule[] = [{ name: 'compact', when:{ maxWidth: 600} , settings:{ padding: 4} } , ] DEFAULT_SETTINGS [VariableDeclaration] (from packages/plugin/stage/src/settings.ts): DEFAULT_SETTINGS: StageSettings ={ flow: 'continuous', layout: 'vertical', spread: 'none', sizing: 'intrinsic', columns: 'square', bounded: true, padding: 24, gap: 16, pageFrame:{ top: 0, right: 0, bottom: 0, left: 0} , direction: 'ltr', fitAlign:{ x: 'center', y: 'center'} , arrivalAlign:{ x: 'start', y: 'start'} , zoomAlign:{ x: 'center', y: 'center'} , anchorAlign:{ x: 'start', y: 'start'} , viewRotation: 0, zoom:{ mode: ZoomMode.Automatic} , minZoom: ZOOM_MIN, maxZoom: ZOOM_MAX, scrollBehavior: 'smooth', interaction: true, panFallback: true, zoomGestures: true, turnGestures: true, scrollChaining: true, zoomBox:{ fill: null, stroke: null} , viewUnitsPerPoint: 96 / 72, } DEFAULT_TOOLS [VariableDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): DEFAULT_TOOLS: AnnotationToolInput[] = [{ id: 'square', subtype: 'square', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6} , clickCreate:{ width: 80, height: 60} , upright: true, } , { id: 'circle', subtype: 'circle', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6} , clickCreate:{ width: 80, height: 60} , upright: true, } , { id: 'line', subtype: 'line', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6} , clickCreate:{ length: 80} , upright: true, } , { id: 'distance', extends: 'line', clickCreate: false, defaults:{ intent: 'line-dimension', strokeWidth: 1, lineEndings:{ start: 'closed-arrow', end: 'closed-arrow'} , captionEnabled: true, captionPosition: 'inline', leader:{ length: 12, extension: 5, offset: 0} , } , } , { id: 'calibrate', extends: 'line', enables: ['annotation-draw'], defaults:{ strokeWidth: 1} , clickCreate: false, } , { id: 'polygon', subtype: 'polygon', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6} , } , { id: 'polyline', subtype: 'polyline', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6} , } , { id: 'perimeter', extends: 'polyline', defaults:{ intent: 'polyline-dimension', strokeWidth: 1, lineEndings:{ start: 'none', end: 'none'} , captionEnabled: true, } , } , { id: 'area', extends: 'polygon', defaults:{ intent: 'polygon-dimension', strokeWidth: 1, captionEnabled: true} , } , { id: 'ink', subtype: 'ink', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: '#ef4444', strokeWidth: 6, blendMode: 'normal'} , ink:{ groupStrokesMs: 800} , } , { id: 'ink-highlight', extends: 'ink', defaults:{ intent: 'ink-highlight', color: '#ffcd45', strokeWidth: 14, blendMode: 'multiply'} , ink:{ straighten:{ deviationThreshold: 0.15, axisSnapDegrees: 15} , } , } , { id: 'free-text', subtype: 'free-text', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 2, fontColor: '#ef4444'} , upright: true, clickCreate:{ width: 180, height: 40, anchor: 'top-left'} , } , { id: 'free-text-callout', subtype: 'free-text-callout', cursor: 'crosshair', enables: DRAW_TAGS, defaults:{ color: HOUSE_RED, strokeWidth: 6, lineEnding: 'open-arrow'} , upright: true, } , { id: 'highlight', subtype: 'highlight', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ffe16a', blendMode: 'multiply'} , selection:{ kind: 'markup'} , } , { id: 'redact', subtype: 'redact', cursor: 'crosshair', enables: ['text-select', 'annotation-draw', 'annotation-edit'], defaults:{ color: '#e44234', interiorColor: '#000000', fontSize: 14, fontColor: '#ffffff', opacity: 1, } , selection:{ kind: 'markup'} , } , { id: 'underline', subtype: 'underline', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ef4444'} , selection:{ kind: 'markup'} , } , { id: 'strikeout', subtype: 'strikeout', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ef4444'} , selection:{ kind: 'markup'} , } , { id: 'squiggly', subtype: 'squiggly', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ef4444'} , selection:{ kind: 'markup'} , } , { id: 'insert-text', subtype: 'caret', fieldsKind: 'caret', preset: 'caret', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ef4444'} , selection:{ kind: 'text-edit', operation: 'insert'} , } , { id: 'replace-text', subtype: 'strikeout', fieldsKind: 'strikeout', cursor: 'default', enables: MARKUP_TAGS, defaults:{ color: '#ef4444'} , selection:{ kind: 'text-edit', operation: 'replace'} , } , { id: ARMED_STAMP_TOOL_ID, subtype: 'stamp', cursor: 'copy', enables: ['annotation-place', 'annotation-edit'], source:{ kind: 'prompt', accept: 'image/png, image/jpeg, application/pdf'} , upright: true, ghost: true, } , { id: 'link', subtype: 'link', cursor: 'crosshair', enables: DRAW_TAGS, } , { id: 'note', subtype: 'text', cursor: 'crosshair', enables: ['annotation-place', 'annotation-edit'], defaults:{ icon: 'comment', color: '#facc15'} , flags:{ noZoom: true, noRotate: true} , upright: true, ghost: true, } , { id: 'attachment', subtype: 'file-attachment', cursor: 'crosshair', enables: ['annotation-place', 'annotation-edit'], source:{ kind: 'prompt'} , defaults:{ icon: 'paperclip', color: '#facc15'} , flags:{ noZoom: true, noRotate: true} , upright: true, ghost: true, } , ] DeepPartial [TypeAliasDeclaration] (from packages/core/main/src/settings.ts): export type DeepPartial ={ readonly [K in keyof T]?: DeepPartialValue} ; DeletePaneOptions [InterfaceDeclaration] (from packages/plugin/view-manager/src/contract.ts): export interface DeletePaneOptions{ readonly moveDocumentsTo?: PaneId; } Direction [TypeAliasDeclaration] (from packages/core/stage/src/index.ts): export type Direction = 'ltr' | 'rtl'; DocCapability [TypeAliasDeclaration] (from packages/engine/core/src/auth/scope/types.ts): export type DocCapability = | 'doc.open' | 'doc.render' | 'doc.text.copy' | 'doc.text.search' | 'doc.content.copy' | 'doc.download' | 'doc.download.flattened' | 'doc.print' | 'doc.print.high' | 'doc.pages.modify' | 'doc.pages.assemble' | 'doc.forms.read' | 'doc.forms.fill' | 'doc.forms.modify' | 'doc.forms.import' | 'doc.forms.script' | 'doc.forms.submit' | 'doc.annotate.read' | 'doc.annotate.modify' | 'doc.annotate.import' | 'doc.metadata.modify' | 'doc.attachments.modify' | 'doc.outline.modify' | 'doc.redact' | 'doc.sign' | 'doc.sign.certify'; DocMdpPermission [TypeAliasDeclaration] (from packages/engine/core/src/signature/types.ts): export type DocMdpPermission = 1 | 2 | 3; DocumentActiveChangedEvent [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DocumentActiveChangedEvent{ readonly documentId: string | null; readonly previousDocumentId: string | null; } DocumentClosedEvent [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DocumentClosedEvent{ readonly documentId: string; } DocumentEvent [TypeAliasDeclaration] (from packages/engine/core/src/events/DocumentEvent.ts): export type DocumentEvent = | ({ type: 'pages.scaleSet'; origin: EventOrigin; pages: PageRef[]; measure: PdfMeasure | null; } & PageScaleResult) | ({ type: 'annotations.created'; page: PageRef; origin: EventOrigin; } & AnnotationCreateResult) | ({ type: 'annotations.updated'; page: PageRef; origin: EventOrigin; } & AnnotationUpdateResult) | ({ type: 'annotations.deleted'; page: PageRef; origin: EventOrigin; deleted: AnnotationRef[]; } & AnnotationDeleteResult) | ({ type: 'annotations.reordered'; page: PageRef; origin: EventOrigin; } & AnnotationReorderResult) |{ type: 'annotations.restored'; page: PageRef; origin: EventOrigin; annotations: Annotation[]; meta: AnnotationListMutationMeta; } | ({ type: 'annotations.flattened'; origin: EventOrigin; } & AnnotationFlattenResult) | ({ type: 'pages.reordered'; origin: EventOrigin} & PageReorderResult) | ({ type: 'pages.rotated'; pages: PageRef[]; rotation: PdfRotation; origin: EventOrigin; } & PageRotateResult) | ({ type: 'pages.deleted'; pages: PageRef[]; origin: EventOrigin; } & PageDeleteResult) | ({ type: 'pages.inserted'; origin: EventOrigin} & PageInsertResult) | ({ type: 'pages.restored'; origin: EventOrigin} & PageRestoreResult) | ({ type: 'pages.named'; name: string; page: PageRef | null; origin: EventOrigin; } & PageNameResult) | ({ type: 'attachments.created'; origin: EventOrigin} & AttachmentCreateResult) | ({ type: 'attachments.deleted'; origin: EventOrigin; deleted: AttachmentRef | null; } & AttachmentDeleteResult) |{ type: 'fonts.changed'; origin: EventOrigin; } | ({ type: 'attachments.restored'; origin: EventOrigin} & AttachmentRestoreResult) | ({ type: 'metadata.updated'; origin: EventOrigin} & MetadataUpdateResult) | ({ type: 'metadata.customUpdated'; origin: EventOrigin} & CustomMetadataUpdateResult) | ({ type: 'outline.created'; origin: EventOrigin} & OutlineCreateResult) | ({ type: 'outline.updated'; origin: EventOrigin} & OutlineUpdateResult) | ({ type: 'outline.moved'; origin: EventOrigin} & OutlineMoveResult) | ({ type: 'outline.deleted'; origin: EventOrigin; deleted: OutlineItemRef[]; } & OutlineDeleteResult) | ({ type: 'outline.restored'; origin: EventOrigin; } & OutlineRestoreResult) | ({ type: 'forms.valueSet'; origin: EventOrigin} & FormSetValueResult) | ({ type: 'forms.repaired'; origin: EventOrigin} & FormRepairResult) | ({ type: 'forms.created'; origin: EventOrigin} & FormFieldCreateResult) | ({ type: 'forms.updated'; origin: EventOrigin} & FormFieldUpdateResult) | ({ type: 'forms.deleted'; origin: EventOrigin; deleted: FormFieldRef | null; } & FormFieldDeleteResult) |{ type: 'forms.restored'; origin: EventOrigin; field: FormField; widgets: WidgetAnnotation[]; meta: FormMutationMeta; } | ({ type: 'forms.widgetAdded'; origin: EventOrigin} & FormWidgetLinkResult) | ({ type: 'forms.widgetRemoved'; origin: EventOrigin} & FormWidgetLinkResult) | ({ type: 'forms.widgetDeleted'; origin: EventOrigin} & FormWidgetDeleteResult) | ({ type: 'forms.widgetRestored'; origin: EventOrigin; } & FormWidgetRestoreResult) | ({ type: 'forms.widgetUpdated'; origin: EventOrigin} & FormWidgetUpdateResult) | ({ type: 'forms.widgetsReordered'; origin: EventOrigin; } & FormWidgetsReorderResult) | ({ type: 'forms.calculationsReordered'; origin: EventOrigin; } & FormCalculationsReorderResult) | ({ type: 'pages.flattened'; pages: PageRef[]; usage: PageFlattenUsage; origin: EventOrigin; } & PageFlattenResult) | ({ type: 'redaction.applied'; origin: EventOrigin; } & RedactionApplyResult) | ({ type: 'signatures.prepared'; field: FormFieldRef; origin: EventOrigin; } & SignaturePrepared) | ({ type: 'signatures.completed'; signingId: string; origin: EventOrigin; } & SignatureCompleteResult) |{ type: 'signatures.cancelled'; signingId: string; origin: EventOrigin; } | ({ type: 'signatures.validationInfoAdded'; origin: EventOrigin; } & ValidationInfoAddResult) |{ type: 'document.versioned'; version: BaseVersionInfo; origin: EventOrigin; } |{ type: 'stream.desynced'; reason: 'backlog-overflow' | 'unknown-change'; at: string; } ; DocumentGate [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function DocumentGate({ fallback = null, locked, error, children} : DocumentGateProps){ const document = useDocument(); if (document.status === 'ready') return <>{ children} ; if (document.status === 'locked' && locked){ return <>{ locked(document as LockedDocumentInfo)} ; } if (document.status === 'error' && error) return <>{ error(document as FailedDocumentInfo)} ; return <>{ fallback} ; } DocumentGateProps [InterfaceDeclaration] (from packages/framework/react/src/runtime.tsx): export interface DocumentGateProps{ fallback?: React.ReactNode; locked?: (document: LockedDocumentInfo) => React.ReactNode; error?: (document: FailedDocumentInfo) => React.ReactNode; children?: React.ReactNode; } DocumentHandle [InterfaceDeclaration] (from packages/engine/core/src/engine/DocumentHandle.ts): export interface DocumentHandle{ readonly id: string; readonly security: DocumentSecurityService; readonly metadata: MetadataService; readonly annotations: DocumentAnnotationsService; readonly actions: DocumentActionsService; readonly attachments: DocumentAttachmentsService; readonly forms: DocumentFormsService; readonly fonts: DocumentFontsService; readonly outline: DocumentOutlineService; readonly search: DocumentSearchService; readonly render: DocumentRenderService; readonly pages: DocumentPagesService; readonly redaction: DocumentRedactionService; readonly signatures: DocumentSignaturesService; readonly events: DocumentEventStream; readonly objectNumbers: ObjectNumberPool; readonly grant?: DocumentGrant; page(ref: PageRef): PageHandle; apply(change: Change, options?: WriteOptions): AbortablePromise; with(facts: CallFacts): DocumentHandle; setWorkingSet(view: string, pages: readonly WorkingSetPage[]): void; download(options?: DownloadOptions): AbortablePromise; close(): AbortablePromise; } DocumentInfo [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DocumentInfo{ readonly id: string; readonly name?: string; readonly status: DocumentStatus; readonly pageCount: number; readonly hasUnsavedChanges: boolean; readonly passwordProvided?: boolean; readonly error?: PluginErrorInfo; readonly openRequest?: GrantOpenRequest; readonly identityRequest?: VisitorIdentityRequest; } DocumentLockedEvent [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DocumentLockedEvent{ readonly documentId: string; readonly passwordProvided: boolean; } DocumentMeta [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DocumentMeta{ readonly id: string; readonly instanceId: string; readonly name?: string; readonly pageCount: number; readonly pages: readonly PageLayout[]; readonly pageLabels: readonly PageLabelSection[]; readonly pendingPages: ReadonlyMap; readonly pagesSequence: number; readonly renderPolicy: EngineRenderPolicy; readonly hasUnsavedChanges: boolean; readonly identityRequest?: VisitorIdentityRequest; readonly openRequest?: GrantOpenRequest; } DocumentMetadata [InterfaceDeclaration] (from packages/engine/core/src/dto/DocumentMetadata.ts): export interface DocumentMetadata{ title: string | null; author: string | null; subject: string | null; keywords: string | null; producer: string | null; creator: string | null; createdAt: IsoDateTime | null; modifiedAt: IsoDateTime | null; trapped: DocumentMetadataTrapped; } DocumentMovedEvent [InterfaceDeclaration] (from packages/plugin/view-manager/src/contract.ts): export interface DocumentMovedEvent{ readonly documentId: string; readonly fromPaneId: PaneId | null; readonly toPaneId: PaneId | null; } DocumentOpenFailedEvent [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DocumentOpenFailedEvent{ readonly documentId: string; readonly error: PluginErrorInfo; } DocumentOpenedEvent [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DocumentOpenedEvent{ readonly documentId: string; readonly info: DocumentInfo; } DocumentOutline [InterfaceDeclaration] (from packages/engine/core/src/dto/DocumentOutline.ts): export interface DocumentOutline{ items: OutlineItem[]; incomplete: boolean; } DocumentPagesChangedEvent [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DocumentPagesChangedEvent{ readonly documentId: string; readonly pagesSequence: number; readonly pages: readonly PageInfo[]; } DocumentProtection [InterfaceDeclaration] (from packages/engine/core/src/signature/types.ts): export interface DocumentProtection{ enforced: ModificationLevel | null; judged: ModificationLevel | null; certification:{ signatureIndex: number; permission: DocMdpPermission} | null; fieldLocks: DocumentFieldLock[]; policyVersion: number; } DocumentScope [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function DocumentScope({ id, children} : DocumentScopeProps){ return ( { children} ); } DocumentScopeProps [InterfaceDeclaration] (from packages/framework/react/src/runtime.tsx): export interface DocumentScopeProps{ id: string; children: React.ReactNode; } DocumentStatus [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type DocumentStatus = 'loading' | 'locked' | 'ready' | 'error'; DocumentTriggerEvent [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type DocumentTriggerEvent = | 'open' | 'will-save' | 'did-save' | 'will-print' | 'did-print' | 'will-close'; DocumentUnsavedChangesChangedEvent [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DocumentUnsavedChangesChangedEvent{ readonly documentId: string; readonly hasUnsavedChanges: boolean; } DocumentsCapability [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DocumentsCapability{ open(source: OpenSource, options?: OpenDocumentOptions): Promise; canOpenFiles(): boolean; retry(id: string, options?: RetryOptions): Promise; identify(id: string, answers: VisitorAnswers): Promise; declineIdentity(id: string): void; rename(id: string, name: string): void; openAll(documents: readonly InitialDocument[]): readonly string[]; unlock(id: string, options: UnlockOptions): Promise; close(id: string): Promise; closeAll(): Promise; setActive(id: string): void; getActiveId(): string | null; getActive(): DocumentInfo | null; list(): readonly DocumentInfo[]; get(id?: string): DocumentInfo | null; has(id: string): boolean; getCount(): number; getOrder(): readonly string[]; setOrder(ids: readonly string[]): void; move(id: string, toIndex: number): void; swap(id: string, otherId: string): void; download(id?: string, options?: DownloadOptions): Promise; downloadLayer(id?: string, options?: OperationOptions): Promise; canDownload(id?: string): boolean; preparePrint(id?: string, options?: PrintOptions): Promise; print(id?: string, options?: PrintOptions): Promise; getPrintQuality(id?: string): PrintQuality | null; canPrint(id?: string): boolean; listPages(id?: string): readonly PageInfo[]; getPage(page: PageRef | number, id?: string): PageInfo | null; getPageIndex(ref: PageRef, id?: string): number; getRevision(id?: string): number; readonly onOpened: EventHook; readonly onOpenFailed: EventHook; readonly onLocked: EventHook; readonly onClosed: EventHook; readonly onActiveChanged: EventHook; readonly onPagesChanged: EventHook; readonly onUnsavedChangesChanged: EventHook; } DocumentsState [InterfaceDeclaration] (from packages/core/main/src/documents-state.ts): export interface DocumentsState{ readonly documents: readonly DocumentInfo[]; readonly activeId: string | null; } DocumentsToken [VariableDeclaration] (from packages/core/main/src/types.ts): DocumentsToken: CapabilityToken ={ name: 'documents'} DownloadOptions [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface DownloadOptions extends OperationOptions{ readonly mode?: PdfSaveMode; } EditableKind [TypeAliasDeclaration] (from packages/core/annotation/src/editable.ts): export type EditableKind = AnnotationSubtype | MeasurementIntent; EditableKinds [TypeAliasDeclaration] (from packages/core/annotation/src/editable.ts): export type EditableKinds = boolean | readonly EditableKind[]; EmbedPDF [VariableDeclaration] (from packages/framework/react/src/runtime.tsx): EmbedPDF = Viewer Engine [InterfaceDeclaration] (from packages/engine/core/src/engine/Engine.ts): export interface Engine{ readonly canOpenFiles: boolean; open(input: OpenInput, options?: OpenOptions): AbortablePromise; destroy(): AbortablePromise; } EngineFactory [TypeAliasDeclaration] (from packages/engine/core/src/engine/Engine.ts): export type EngineFactory = () => Engine; EngineRenderPolicy [TypeAliasDeclaration] (from packages/engine/core/src/engine/DocumentRenderService.ts): export type EngineRenderPolicy = |{ readonly kind: 'continuous'} |{ readonly kind: 'lattice'; readonly fullPage:{ readonly widths: readonly number[]} ; readonly tiles?:{ readonly tileSizes: readonly number[]; readonly scales: readonly number[]; } ; readonly appearances?:{ readonly scales: readonly number[]} ; readonly maxRenderPixels?: number; readonly formats: readonly ('webp' | 'png')[]; readonly background: 'white'; readonly enforced: boolean; } ; EpdfTheme [TypeAliasDeclaration] (from packages/framework/web/src/theme.ts): export type EpdfTheme = Intersection<{ [Name in EpdfSettingVariable]: ThemeBranch< ThemePath, ThemeValue >; } [EpdfSettingVariable] >; EventHook [TypeAliasDeclaration] (from packages/core/main/src/event-hook.ts): export type EventHook = ( listener: (event: T) => void, options?:{ signal?: AbortSignal} , ) => Unsubscribe; EventHookSource [InterfaceDeclaration] (from packages/core/main/src/event-hook.ts): export interface EventHookSource{ readonly on: EventHook; emit(event: T): void; destroy(): void; } EventOrigin [InterfaceDeclaration] (from packages/engine/core/src/events/DocumentEvent.ts): export interface EventOrigin{ kind: 'local' | 'remote'; sessionId: string; subject: string | null; at: string; serverSequence: number | null; transaction?:{ id: string; index: number; count: number} ; undoOf?: string; } ExecuteOptions [InterfaceDeclaration] (from packages/plugin/commands/src/contract.ts): export interface ExecuteOptions extends OperationOptions{ documentId?: string; args?: unknown; } ExecuteResult [TypeAliasDeclaration] (from packages/plugin/commands/src/contract.ts): export type ExecuteResult = |{ readonly status: 'executed'} |{ readonly status: 'rejected'; readonly reason: 'not-found' | 'disabled' | 'hidden'} ; FORM_DEFAULTS [VariableDeclaration] (from packages/plugin/form/src/contract.ts): FORM_DEFAULTS: FormSettings ={ validation: 'scripts', focus:{ color: null} , fields:{ border: null, background: 'rgb(255 255 255 / 0.92)', color: '#1f2a44'} , fillable: true, } FORM_TOOLS [VariableDeclaration] (from packages/plugin/form/src/tools/definitions.ts): FORM_TOOLS: readonly FormToolDefinition[] = [{ id: 'form-text', fieldKind: 'text', visualKind: 'widget-text', clickCreate:{ width: 160, height: 24} , upright: true, defaults:{ ...FIELD_CHROME, fontSize: 12} , cursor: 'crosshair', } , { id: 'form-checkbox', fieldKind: 'checkbox', visualKind: 'widget-toggle', clickCreate:{ width: 18, height: 18} , upright: true, defaults: FIELD_CHROME, cursor: 'crosshair', } , { id: 'form-radio', fieldKind: 'radio', visualKind: 'widget-radio', clickCreate:{ width: 18, height: 18} , upright: true, defaults: FIELD_CHROME, cursor: 'crosshair', } , { id: 'form-combobox', fieldKind: 'combobox', visualKind: 'widget-choice', clickCreate:{ width: 140, height: 24} , upright: true, defaults:{ ...FIELD_CHROME, fontSize: 12} , cursor: 'crosshair', } , { id: 'form-listbox', fieldKind: 'listbox', visualKind: 'widget-choice', clickCreate:{ width: 140, height: 72} , upright: true, defaults:{ ...FIELD_CHROME, fontSize: 12} , cursor: 'crosshair', } , { id: 'form-button', fieldKind: 'pushbutton', visualKind: 'widget-button', clickCreate:{ width: 100, height: 28} , upright: true, defaults:{ ...FIELD_CHROME, interiorColor: '#e5e7eb', fontSize: 12} , cursor: 'crosshair', } , { id: 'form-signature', fieldKind: 'signature', visualKind: 'widget-box', clickCreate:{ width: 160, height: 48} , upright: true, defaults: FIELD_CHROME, cursor: 'crosshair', } , ] FORM_TOOL_BY_ID [VariableDeclaration] (from packages/plugin/form/src/tools/definitions.ts): FORM_TOOL_BY_ID: ReadonlyMap = new Map( FORM_TOOLS.map((tool) => [tool.id, tool]), ) Face [InterfaceDeclaration] (from packages/plugin/annotation/src/rich-text.ts): export interface Face{ family: string; weight?: number; italic?: boolean; } FailedDocumentInfo [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface FailedDocumentInfo extends DocumentInfo{ readonly status: 'error'; readonly error: PluginErrorInfo; } FeedbackPluginOptions [InterfaceDeclaration] (from packages/plugin/interaction/src/feedback.types.ts): export interface FeedbackPluginOptions{ provider?: PlatformFeedback; } FeedbackToken [VariableDeclaration] (from packages/plugin/interaction/src/feedback.types.ts): FeedbackToken = createCapabilityToken('feedback') FieldLockSpec [InterfaceDeclaration] (from packages/engine/core/src/signature/types.ts): export interface FieldLockSpec{ action: FieldLockAction; fields: string[]; permission?: DocMdpPermission; } FieldValues [TypeAliasDeclaration] (from packages/core/annotation/src/types.ts): export type FieldValues = Readonly>; FilePickerProvider [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type FilePickerProvider = ( request: FilePromptRequest, ) => Promise; FilePromptRequest [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface FilePromptRequest{ toolId: string; subtype: KindName; accept?: string; page: PageRef; point: Point; } FillableFields [TypeAliasDeclaration] (from packages/plugin/form/src/contract.ts): export type FillableFields = boolean | readonly FormFieldKind[]; FlagKey [TypeAliasDeclaration] (from packages/core/annotation/src/kinds/define.ts): export type FlagKey = | 'invisible' | 'hidden' | 'print' | 'noZoom' | 'noRotate' | 'noView' | 'readOnly' | 'locked' | 'toggleNoView' | 'lockedContents'; FlowMode [TypeAliasDeclaration] (from packages/plugin/stage/src/contract.ts): export type FlowMode = 'continuous' | 'paged'; Font [InterfaceDeclaration] (from packages/engine/core/src/dto/DocumentFonts.ts): export interface Font{ name: FontName; source: FontSource; builtIn: boolean; familyName: string; weight: number; italic: boolean; postScriptName: string | null; canChoose: boolean; restrictions: FontRestriction[]; programs: FontProgram[]; } FontCss [InterfaceDeclaration] (from packages/plugin/fonts/src/contract.ts): export interface FontCss{ readonly fontFamily: string; readonly fontWeight: number; readonly fontStyle: 'normal' | 'italic'; readonly programs: readonly MountableFontProgram[]; } FontList [InterfaceDeclaration] (from packages/engine/core/src/dto/DocumentFonts.ts): export interface FontList{ fonts: Font[]; fallbacks: FontName[]; lastResort: FontProgram; } FontListChangedEvent [InterfaceDeclaration] (from packages/plugin/fonts/src/contract.ts): export interface FontListChangedEvent{ readonly fonts: FontList; } FontName [TypeAliasDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export type FontName = StandardFont | (string &{ } ); FontProgram [InterfaceDeclaration] (from packages/engine/core/src/dto/DocumentFonts.ts): export interface FontProgram{ displaySha256: string | null; sourceSha256: string | null; embedded: 'whole' | 'subset' | 'none'; format: FontFormat | null; embeddingPermission: FontEmbeddingPermission | null; canDownload: boolean; } FontProgramInfo [InterfaceDeclaration] (from packages/engine/core/src/dto/DocumentFonts.ts): export interface FontProgramInfo extends FontProgram{ covers: CodePointRange[]; ascent: number; descent: number; } FontResolution [InterfaceDeclaration] (from packages/engine/core/src/dto/DocumentFonts.ts): export interface FontResolution{ runs: ResolvedFontRun[]; missingCharacters: string[]; } FontResolveRequest [InterfaceDeclaration] (from packages/engine/core/src/dto/DocumentFonts.ts): export interface FontResolveRequest{ annotation?: AnnotationRef; runs: FontResolveRun[]; } FontRestriction [TypeAliasDeclaration] (from packages/engine/core/src/dto/DocumentFonts.ts): export type FontRestriction = | 'subset' | 'not-embedded' | 'preview-and-print' | 'unsupported-format' | 'no-unicode-map' | 'not-served'; FontSource [TypeAliasDeclaration] (from packages/engine/core/src/dto/DocumentFonts.ts): export type FontSource = 'standard' | 'engine' | 'document'; FontsCapability [InterfaceDeclaration] (from packages/plugin/fonts/src/contract.ts): export interface FontsCapability{ getFontList(): FontList | null; getStatus(): ResourceStatus; ensureLoaded(): Promise; refresh(): Promise; resolve(request: FontResolveRequest, options?: OperationOptions): Promise; readProgram(displaySha256: string, options?: OperationOptions): Promise; getFontCss(font: FontName): FontCss; getFaceCss(face: FaceRequest): FontCss; getRunCss(run: ResolvedFontRun): FontCss; getPaintFonts(font: FontName, text: string): PaintFonts | null; getPaintFontsEpoch(): number; getFaceOfCssFamily(cssFamily: string): FaceRequest | null; readonly onFontListChanged: EventHook; } FontsToken [VariableDeclaration] (from packages/plugin/fonts/src/token.ts): FontsToken = createCapabilityToken('fonts', { hint: "add fontsPlugin() from '@embedpdf/plugin-fonts' to your plugins list", promises:{ ensureLoaded: true, refresh: true, resolve: true, readProgram: true, } , } ) FormBundle [InterfaceDeclaration] (from packages/engine/core/src/transfer/FormBundle.ts): export interface FormBundle{ readonly format: 'embedpdf/form'; readonly version: 1; readonly pages: readonly BundlePage[]; readonly fields: readonly FormBundleField[]; readonly widgets: readonly FormBundleWidget[]; readonly calculationOrder: readonly FormFieldRef[]; readonly resources: Readonly>; } FormCapability [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormCapability extends SettingsApi{ getSnapshot(): FormSnapshot | null; getStatus(): ResourceStatus; getFormKind(): FormKind; list(filter?: FormFilter): readonly FormField[]; get(ref: FormFieldRef): FormField | null; getFieldForWidget(widget: WidgetAddress): FormField | null; getWidget(widget: WidgetAddress): WidgetAnnotation | null; getWidgets(ref: FormFieldRef): readonly WidgetAnnotation[]; getValue(ref: FormFieldRef): FormFieldValue | null; listWidgets(page: PageRef | number): readonly FormWidgetItem[]; getWidgetAt(page: PageRef | number, point:{ x: number; y: number} ): WidgetHit | null; getSelectedField(): FormField | null; getFocusedField(): FormField | null; getFieldSettings(field: FormFieldRef): FormFieldSettings | null; validate(): FormValidation; exportValues(): Readonly>; focus(ref: FormFieldRef, options?: FormFocusOptions): boolean; focusNext(options?: FormFocusNextOptions): boolean; setValue( ref: FormFieldRef, value: FormFieldValue, options?: OperationOptions, ): Promise; setValues( entries: readonly{ readonly ref: FormFieldRef; readonly value: FormFieldValue} [], options?: OperationOptions, ): Promise>; importValues( values: Readonly>, options?: OperationOptions, ): Promise>; reset(refs?: readonly FormFieldRef[], options?: OperationOptions): Promise; activateWidget( widget: AnnotationRef, options?: OperationOptions, ): Promise; export(selection?: FormExportSelection, options?: OperationOptions): Promise; import( bundle: FormBundle, options?: FormImportOptions & OperationOptions & HistoryOptions, ): Promise; refresh(options?: OperationOptions): Promise; create(draft: FormFieldDraft, options?: OperationOptions): Promise; addWidget( ref: FormFieldRef, placement?: Partial, options?: OperationOptions, ): Promise; duplicate( fields: readonly FormFieldRef[], options?: FormDuplicateOptions & OperationOptions, ): Promise; duplicateWidgets( widgets: readonly AnnotationRef[], options?: FormDuplicateOptions & OperationOptions, ): Promise; update( ref: FormFieldRef, patch: FormFieldPatch, options?: OperationOptions, ): Promise; delete(ref: FormFieldRef, options?: OperationOptions): Promise; removeWidget( ref: FormFieldRef, widget: AnnotationRef, options?: OperationOptions, ): Promise; updateWidget( widget: AnnotationRef, patch: WidgetPatch, options?: OperationOptions, ): Promise<{ readonly widget: WidgetAnnotation} >; deleteWidget( widget: AnnotationRef, options?: OperationOptions, ): Promise<{ readonly field: FormField | null} >; reorderCalculations( fields: FormFieldRef[], position: FieldPosition, options?: OperationOptions, ): Promise<{ readonly calculationOrder: readonly FormFieldRef[]} >; repair(options?: FormRepairOptions & OperationOptions): Promise; canRead(): boolean; canFill(field: FormFieldRef): boolean; canDesign(): boolean; canRestoreAttribution(): boolean; canWriteScripts(): boolean; readonly onValueChanged: EventHook; readonly onFieldCreated: EventHook; readonly onFieldUpdated: EventHook; readonly onFieldDeleted: EventHook; readonly onValidationRejected: EventHook; readonly onResynced: EventHook; readonly onFocusChanged: EventHook; } FormCommitResult [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormCommitResult{ readonly status: FormCommitStatus; readonly scripted: boolean; readonly uiEffects: FormUiEffect[]; readonly diagnostics: ScriptDiagnostic[]; readonly error?: ScriptExecutionError; } FormCommitStatus [TypeAliasDeclaration] (from packages/plugin/form/src/contract.ts): export type FormCommitStatus = 'applied' | 'unchanged' | 'rejected' | 'failed'; FormConfig [TypeAliasDeclaration] (from packages/plugin/form/src/contract.ts): export type FormConfig = DeepPartial; FormDuplicateOptions [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormDuplicateOptions{ readonly page?: PageRef | number; readonly offset?:{ readonly x: number; readonly y: number} ; readonly values?: boolean; } FormDuplicateResult [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormDuplicateResult{ readonly fields: readonly FormField[]; readonly widgets: readonly WidgetAnnotation[]; readonly dropped: readonly FormImportDrop[]; } FormExportSelection [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormExportSelection{ readonly fields?: readonly FormFieldRef[]; readonly pages?: readonly (PageRef | number)[]; } FormField [TypeAliasDeclaration] (from packages/engine/core/src/forms/field.ts): export type FormField = | TextField | CheckboxField | RadioField | ComboBoxField | ListBoxField | PushButtonField | SignatureField | UnknownField; FormFieldCreatedEvent [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormFieldCreatedEvent{ readonly field: FormField; readonly origin: EventOrigin; } FormFieldDeletedEvent [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormFieldDeletedEvent{ readonly ref: FormFieldRef; readonly origin: EventOrigin; } FormFieldDraft [TypeAliasDeclaration] (from packages/engine/core/src/forms/draft.ts): export type FormFieldDraft = | TextFieldDraft | CheckboxFieldDraft | RadioFieldDraft | ComboBoxFieldDraft | ListBoxFieldDraft | PushButtonFieldDraft | SignatureFieldDraft; FormFieldFlagSetting [TypeAliasDeclaration] (from packages/plugin/form/src/contract.ts): export type FormFieldFlagSetting = | 'required' | 'readOnly' | 'noExport' | 'multiline' | 'password' | 'comb' | 'radiosInUnison' | 'noToggleToOff' | 'edit' | 'multiSelect'; FormFieldKind [TypeAliasDeclaration] (from packages/engine/core/src/forms/field.ts): export type FormFieldKind = | 'text' | 'checkbox' | 'radio' | 'combobox' | 'listbox' | 'pushbutton' | 'signature' | 'unknown'; FormFieldPatch [TypeAliasDeclaration] (from packages/engine/core/src/forms/patch.ts): export type FormFieldPatch = | TextFieldPatch | CheckboxFieldPatch | RadioFieldPatch | ComboBoxFieldPatch | ListBoxFieldPatch | PushButtonFieldPatch | SignatureFieldPatch; FormFieldRef [TypeAliasDeclaration] (from packages/engine/core/src/identity/FormFieldRef.ts): export type FormFieldRef = |{ kind: 'objectNumber'; objectNumber: number} |{ kind: 'fqn'; name: string} ; FormFieldResult [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormFieldResult{ readonly field: FormField; } FormFieldSetting [TypeAliasDeclaration] (from packages/plugin/form/src/contract.ts): export type FormFieldSetting = |{ readonly key: 'name' | 'alternateName'; readonly control: 'text'; readonly label: string; readonly labelKey: string; } |{ readonly key: FormFieldFlagSetting; readonly control: 'flag'; readonly label: string; readonly labelKey: string; } |{ readonly key: 'maxLength'; readonly control: 'number'; readonly label: string; readonly labelKey: string; readonly min: number; } |{ readonly key: 'defaultValue'; readonly control: 'text'; readonly label: string; readonly labelKey: string; } |{ readonly key: 'defaultValue'; readonly control: 'choice'; readonly label: string; readonly labelKey: string; readonly options: readonly string[]; readonly free: boolean; } |{ readonly key: 'defaultValue'; readonly control: 'choices'; readonly label: string; readonly labelKey: string; readonly options: readonly string[]; } |{ readonly key: 'options'; readonly control: 'options'; readonly label: string; readonly labelKey: string; } ; FormFieldSettings [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormFieldSettings{ readonly properties: readonly FormFieldSetting[]; readonly values: Readonly>; } FormFieldUpdatedEvent [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormFieldUpdatedEvent{ readonly field: FormField; readonly origin: EventOrigin; } FormFieldValue [TypeAliasDeclaration] (from packages/engine/core/src/forms/value.ts): export type FormFieldValue = |{ value: string | null} |{ checked: boolean} |{ selectedValues: string[]} ; FormFilter [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormFilter{ readonly kind?: FormFieldKind; readonly page?: PageRef | number; readonly name?: string; } FormFocusChangedEvent [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormFocusChangedEvent{ readonly field: FormField | null; readonly widget: AnnotationRef | null; } FormFocusNextOptions [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormFocusNextOptions{ from?: FormFieldRef; backward?: boolean; empty?: boolean; wrap?: boolean; } FormFocusOptions [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormFocusOptions{ widget?: WidgetAddress; select?: boolean; } FormImportDrop [InterfaceDeclaration] (from packages/engine/core/src/transfer/formImport.ts): export interface FormImportDrop{ readonly ref: FormFieldRef | null; readonly widget?: AnnotationRef; readonly field?: string; readonly reason: FormImportDropReason; } FormImportDropReason [TypeAliasDeclaration] (from packages/engine/core/src/transfer/formImport.ts): export type FormImportDropReason = | 'name-conflict' | 'no-field' | 'unsupported-kind' | 'script-not-allowed' | 'unsupported-action'; FormImportOptions [InterfaceDeclaration] (from packages/engine/core/src/transfer/formImport.ts): export interface FormImportOptions extends WriteOptions{ readonly pages?: BundleImportPages; readonly attribution?: 'restore' | 'stamp'; readonly values?: boolean; } FormImportResult [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormImportResult{ readonly fields: readonly FormField[]; readonly refMap: ReadonlyArray<{ readonly from: FormFieldRef; readonly to: FormFieldRef} >; readonly dropped: readonly FormImportDrop[]; } FormKind [TypeAliasDeclaration] (from packages/engine/core/src/forms/snapshot.ts): export type FormKind = 'none' | 'acroform' | 'xfa'; FormLayer [FunctionDeclaration] (from packages/framework/react/src/form.tsx): export function FormLayer(){ const page = usePage(); const form = useCapability(FormHostToken); const colors = useFormColors(); const active = useSelector(InteractionToken, (interaction) => interaction.activeToolEnables('form-fill'), ); usePaintsPagePart(page.ref, 'formFields'); useEffect(() =>{ void form.ensureLoaded(page.ref); } , [form, page.ref]); const items = useSelector( FormHostToken, (capability) => capability.listWidgets(page.ref), shallowArray, ); return (
{ (active ? items : []).map((item) =>{ const key = `${ item.key} :${ item.annotObjectNumber} `; switch (item.control){ case 'text': return ; case 'toggle': return ; case 'choice': return item.kind === 'list' ? ( ) : ( ); case 'button': return ; case 'signature': return ; } } )}
); } FormPlainValue [TypeAliasDeclaration] (from packages/plugin/form/src/contract.ts): export type FormPlainValue = string | boolean | readonly string[] | null; FormRepairOptions [InterfaceDeclaration] (from packages/engine/core/src/engine/DocumentFormsService.ts): export interface FormRepairOptions extends WriteOptions{ bakeAppearances?: boolean; } FormRepairResult [InterfaceDeclaration] (from packages/engine/core/src/mutation/FormMutationResults.ts): export interface FormRepairResult{ acroformCreated: boolean; fieldsLinked: number; widgetsLinked: number; fieldsUnrepairable: number; appearancesBaked: number; needsAppearancesCleared: boolean; meta: MutationMeta; } FormResetResult [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormResetResult{ readonly fields: readonly FormField[]; } FormResyncedEvent [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormResyncedEvent{ readonly snapshot: FormSnapshot; } FormScriptingController [ClassDeclaration] (from packages/plugin/form/src/scripting/controller.ts): export class FormScriptingController{ private disposed = false; private readonly transactionBudget: ScriptBudget | undefined; constructor(private readonly options: FormScriptingControllerOptions){ this.transactionBudget = options.budget; } destroy(): void{ this.disposed = true; } transaction(body: (scripts: FormScripts) => Promise): Promise{ if (this.disposed) return Promise.reject(new Error('Form scripting controller is disposed')); return this.options.transaction((txn) => body({ commit: (form, ref, value) => this.run(txn, form, ref, value), activate: (form, ref, action) => this.run(txn, form, ref, undefined, action), recalculate: (form) => this.run(txn, form, undefined), } ), ); } async warm(form: FormSnapshot): Promise{ if (this.disposed) return; const budget = this.transactionBudget ?? DEFAULT_SCRIPT_BUDGET; await this.options.transaction((txn) => txn.run( '', { fields: scriptFieldsFromSnapshot(form), event:{ kind: 'name-tree-boot'} } , budget, ), ); } commit(form: FormSnapshot, ref: FormFieldRef, value: FormFieldValue): Promise{ return this.transaction((scripts) => scripts.commit(form, ref, value)); } activate( form: FormSnapshot, ref: FormFieldRef, action: PdfActionTree, ): Promise{ return this.transaction((scripts) => scripts.activate(form, ref, action)); } recalculate(form: FormSnapshot): Promise{ return this.transaction((scripts) => scripts.recalculate(form)); } private async run( txn: ScriptTransaction, snapshot: FormSnapshot, refInput: FormFieldRef | undefined, proposed?: FormFieldValue, activation?: PdfActionTree, ): Promise{ const asked = refInput ?? snapshot.calculationOrder.find( (candidate): candidate is FormFieldRef => candidate !== null && snapshotField(snapshot, candidate) !== undefined, ) ?? snapshot.fields[0]?.ref; if (!asked){ return{ status: 'accepted', effects: [], bootEffects: [], uiEffects: [], diagnostics: []} ; } const target = snapshotField(snapshot, asked); if (!target){ return this.failed([], [], scriptError(`Form field '${ refKey(asked)} ' no longer exists`)); } const ref = target.ref; const original = scriptFieldsFromSnapshot(snapshot); const overlay: Overlay ={ original, fields: cloneFields(original), resetKeys: new Set(), appearances: new Map(), } ; const targetInput = fieldByRef(overlay.fields, ref); if (!targetInput){ return this.failed([], [], scriptError(`Form field '${ refKey(ref)} ' has no script view`)); } const hasProposedValue = proposed !== undefined; let proposedValue: ScriptValue = cloneValue(targetInput.value); if (proposed){ try{ proposedValue = scriptValueFromFormValue(targetInput, proposed); } catch (error){ return this.failed( [], [], scriptError(error instanceof Error ? error.message : String(error)), ); } } const uiEffects: FormUiEffect[] = []; const diagnostics: ScriptDiagnostic[] = []; const meta = this.options.document(); const pageNumber = pageNumberFor(meta, target); const budget = this.transactionBudget ?? DEFAULT_SCRIPT_BUDGET; let executionMs = 0; let aggregateOutputSize = 0; const consume = ( output: ScriptOutput, phase: FormUiEffect['phase'], ): ScriptExecutionError | null =>{ aggregateOutputSize += utf8Length(JSON.stringify(output)); uiEffects.push(...output.uiEffects.map((effect) => ({ ...effect, phase} ))); diagnostics.push(...output.diagnostics); if (aggregateOutputSize > budget.maxOutputBytes){ return{ kind: 'budget', message: `Form script transaction output exceeded ${ budget.maxOutputBytes} bytes`, } ; } return output.error ?? null; } ; const remainingBudget = (): ScriptBudget | null =>{ const remaining = budget.maxExecutionMs - executionMs; return remaining <= 0 ? null :{ ...budget, maxExecutionMs: remaining} ; } ; const world = ( fields: ScriptFieldInput[], event: ScriptWorldInput['event'], ): ScriptWorldInput => ({ fields, pageNumber, event, } ); const run = async ( source: string, input: ScriptWorldInput, ): Promise<{ output?: ScriptOutput; error?: ScriptExecutionError} > =>{ const remaining = remainingBudget(); if (!remaining){ return{ error:{ kind: 'budget', message: 'Form script transaction timed out'} } ; } let output: ScriptOutput; try{ const startedAt = Date.now(); output = await txn.run(source, input, remaining); executionMs += Date.now() - startedAt; } catch (error){ return{ error: scriptError(error instanceof Error ? error.message : String(error)), } ; } const error = consume(output, 'user'); return error ?{ error} :{ output} ; } ; { let boot: ScriptOutput | null = null; try{ boot = await txn.boot(world(overlay.fields, { kind: 'name-tree-boot'} ), budget); } catch (error){ diagnostics.push({ code: 'script-error', message: `Document boot script failed (continuing without it): ${ error instanceof Error ? error.message : String(error)} `, } ); } if (boot){ const bootError = consume(boot, 'boot'); if (!bootError) applyEffects(overlay, boot.formEffects); else{ diagnostics.push({ code: 'script-error', message: `Document boot script failed (continuing without it): ${ bootError.message} `, } ); } } } const bootEffects = canonicalEffects(overlay); if (activation){ let program: string; try{ program = javaScriptProgramFromActionTree(activation); } catch (error){ return this.failed( uiEffects, diagnostics, scriptError(error instanceof Error ? error.message : String(error)), ); } if (program){ const activated = await run( program, world(overlay.fields, { kind: 'widget-activate', target: ref, source: ref, value: targetInput.value, } ), ); if (activated.error) return this.failed(uiEffects, diagnostics, activated.error); applyEffects(overlay, activated.output!.formEffects); } } if (!activation && hasProposedValue && target.actions?.keystroke && target.kind === 'text'){ let program: string; try{ program = javaScriptProgramFromActionTree(target.actions.keystroke); } catch (error){ return this.failed( uiEffects, diagnostics, scriptError(error instanceof Error ? error.message : String(error)), ); } if (program){ const oldValue = String(targetInput.value ?? ''); const typing = await run( program, world(overlay.fields, { kind: 'field-keystroke', target: ref, source: ref, value: oldValue, change: String(proposedValue ?? ''), selStart: 0, selEnd: oldValue.length, willCommit: false, } ), ); if (typing.error && typing.error.kind !== 'exception'){ return this.failed(uiEffects, diagnostics, typing.error); } if (typing.error){ diagnostics.push({ code: 'script-error', message: `Keystroke script failed (kept the typed value): ${ typing.error.message} `, } ); } else{ if (!typing.output!.event.rc){ return this.rejected(bootEffects, uiEffects, diagnostics); } applyEffects(overlay, typing.output!.formEffects); const event = typing.output!.event; const base = String(event.value ?? ''); proposedValue = base.slice(0, event.selStart) + event.change + base.slice(Math.max(event.selStart, event.selEnd)); } const commit = await run( program, world(overlay.fields, { kind: 'field-keystroke', target: ref, source: ref, value: proposedValue, change: '', selStart: 0, selEnd: 0, willCommit: true, } ), ); if (commit.error && commit.error.kind !== 'exception'){ return this.failed(uiEffects, diagnostics, commit.error); } if (commit.error){ diagnostics.push({ code: 'script-error', message: `Keystroke commit script failed (kept the typed value): ${ commit.error.message} `, } ); } else{ if (!commit.output!.event.rc){ return this.rejected(bootEffects, uiEffects, diagnostics); } applyEffects(overlay, commit.output!.formEffects); proposedValue = cloneValue(commit.output!.event.value); } } } if (!activation && hasProposedValue){ targetInput.value = cloneValue(proposedValue); overlay.resetKeys.delete(refKey(ref)); } if (!activation && hasProposedValue && target.actions?.validate){ let program: string; try{ program = javaScriptProgramFromActionTree(target.actions.validate); } catch (error){ return this.failed( uiEffects, diagnostics, scriptError(error instanceof Error ? error.message : String(error)), ); } if (program){ const validation = await run( program, world(overlay.fields, { kind: 'field-validate', target: ref, source: ref, value: proposedValue, willCommit: true, } ), ); if (validation.error && validation.error.kind !== 'exception'){ return this.failed(uiEffects, diagnostics, validation.error); } if (validation.error){ diagnostics.push({ code: 'script-error', message: `Validate script failed (accepted the value): ${ validation.error.message} `, } ); } else{ if (!validation.output!.event.rc){ return this.rejected(bootEffects, uiEffects, diagnostics); } targetInput.value = cloneValue(validation.output!.event.value); applyEffects(overlay, validation.output!.formEffects); } } } const formatRefs: FormFieldRef[] = !activation && hasProposedValue ? [ref] : []; for (const calculationRef of activation ? [] : snapshot.calculationOrder){ if (!calculationRef) continue; const calculated = snapshotField(snapshot, calculationRef); const tree = calculated?.actions?.calculate; if (!calculated || !tree) continue; let program: string; try{ program = javaScriptProgramFromActionTree(tree); } catch (error){ return this.failed( uiEffects, diagnostics, scriptError(error instanceof Error ? error.message : String(error)), ); } const calculatedInput = fieldByRef(overlay.fields, calculationRef); if (program && calculatedInput){ const calculation = await run( program, world(overlay.fields, { kind: 'field-calculate', target: calculationRef, ...(hasProposedValue ?{ source: ref} :{ } ), value: calculatedInput.value, } ), ); if (calculation.error && calculation.error.kind !== 'exception'){ return this.failed(uiEffects, diagnostics, calculation.error); } if (calculation.error){ diagnostics.push({ code: 'script-error', message: `Calculate script failed (field left unchanged): ${ calculation.error.message} `, } ); } else{ applyEffects(overlay, calculation.output!.formEffects); } } if (!formatRefs.some((candidate) => sameRef(candidate, calculationRef))){ formatRefs.push(calculationRef); } } for (const formatRef of formatRefs){ const field = snapshotField(snapshot, formatRef); const tree = field?.actions?.format; const overlayField = fieldByRef(overlay.fields, formatRef); if (!field || !tree || !overlayField) continue; let program: string; try{ program = javaScriptProgramFromActionTree(tree); } catch (error){ return this.failed( uiEffects, diagnostics, scriptError(error instanceof Error ? error.message : String(error)), ); } if (!program) continue; const format = await run( program, world(overlay.fields, { kind: 'field-format', target: formatRef, ...(hasProposedValue ?{ source: ref} :{ } ), value: overlayField.value, } ), ); if (format.error && format.error.kind !== 'exception'){ return this.failed(uiEffects, diagnostics, format.error); } if (format.error){ diagnostics.push({ code: 'script-error', message: `Format script failed (kept the raw value): ${ format.error.message} `, } ); continue; } applyEffects(overlay, format.output!.formEffects); } const effects = canonicalEffects(overlay); if (effects.length + uiEffects.length > budget.maxEffects){ return this.failed(uiEffects, diagnostics, { kind: 'budget', message: `Form script transaction exceeded ${ budget.maxEffects} effects`, } ); } return{ status: 'accepted', effects, bootEffects, uiEffects, diagnostics} ; } private failed( uiEffects: FormUiEffect[], diagnostics: ScriptDiagnostic[], error: ScriptExecutionError, ): FormScriptResult{ return{ status: 'failed', effects: [], bootEffects: [], uiEffects, diagnostics, error} ; } private rejected( bootEffects: FormEffect[], uiEffects: FormUiEffect[], diagnostics: ScriptDiagnostic[], ): FormScriptResult{ return{ status: 'rejected', effects: [], bootEffects, uiEffects, diagnostics} ; } } FormSetValueResult [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormSetValueResult{ readonly field: FormField; readonly status: FormSetValueStatus; } FormSetValueStatus [TypeAliasDeclaration] (from packages/plugin/form/src/contract.ts): export type FormSetValueStatus = 'applied' | 'unchanged' | 'rejected'; FormSettings [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormSettings{ readonly validation: 'scripts' | 'none'; readonly focus:{ readonly color: string | null; } ; readonly fields:{ readonly border: string | null; readonly background: string; readonly color: string; } ; readonly fillable: FillableFields; } FormSnapshot [InterfaceDeclaration] (from packages/engine/core/src/forms/snapshot.ts): export interface FormSnapshot{ formKind: FormKind; needsAppearances: boolean; fields: FormField[]; widgets: WidgetAnnotation[]; calculationOrder: Array; } FormState [InterfaceDeclaration] (from packages/plugin/form/src/state.ts): export interface FormState{ readonly fields: readonly FormField[]; readonly status: ResourceStatus; readonly formKind: FormKind; readonly selectedField: FormField | null; readonly focusedField: FormField | null; } FormToken [VariableDeclaration] (from packages/plugin/form/src/token.ts): FormToken = createCapabilityToken('form', { hint: `add formPlugin() from '@embedpdf/plugin-form' to your plugins list`, promises:{ setValue: true, setValues: true, importValues: true, reset: true, activateWidget: true, export: true, import: true, refresh: true, create: true, addWidget: true, duplicate: true, duplicateWidgets: true, update: true, delete: true, removeWidget: true, updateWidget: true, deleteWidget: true, reorderCalculations: true, repair: true, } , } ) FormToolDefinition [InterfaceDeclaration] (from packages/plugin/form/src/tools/definitions.ts): export interface FormToolDefinition{ id: string; fieldKind: AuthorableFormKind; visualKind: | 'widget-text' | 'widget-choice' | 'widget-button' | 'widget-toggle' | 'widget-radio' | 'widget-box'; clickCreate: Extract; upright: boolean; defaults: WidgetAppearance; cursor: string; } FormTransfer [VariableDeclaration] (from packages/engine/core/src/transfer/FormTransfer.ts): FormTransfer = bundleCodec({ kind: 'form', keys: FORM_BUNDLE_KEYS, assertManifest: assertFormBundleManifest, } ) FormUiEffect [TypeAliasDeclaration] (from packages/plugin/form/src/contract.ts): export type FormUiEffect = ScriptUiEffect &{ phase: 'boot' | 'user'; origin?: ActionOrigin; } ; FormValidation [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormValidation{ readonly valid: boolean; readonly missing: readonly FormField[]; } FormValidationRejectedEvent [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormValidationRejectedEvent{ readonly field: FormField; readonly issues: readonly ScriptDiagnostic[]; } FormValueChangedEvent [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormValueChangedEvent{ readonly field: FormField; readonly origin: EventOrigin; } FormWidgetAddResult [InterfaceDeclaration] (from packages/plugin/form/src/contract.ts): export interface FormWidgetAddResult{ readonly field: FormField; readonly widget: WidgetAnnotation; } FormWidgetItem [TypeAliasDeclaration] (from packages/plugin/form/src/read/fill-items.ts): export type FormWidgetItem = FormWidgetItemBase & ( |{ control: 'text'; value: string; multiline: boolean; password: boolean; maxLength: number | null; comb: boolean; } |{ control: 'toggle'; kind: 'checkbox'; checked: boolean; exportValue: string; } |{ control: 'toggle'; kind: 'radio'; checked: boolean; exportValue: string; inGroup: GroupPosition | null; } |{ control: 'choice'; kind: 'combo' | 'list'; edit: boolean; multi: boolean; options: FormFieldOption[]; selected: string[]; } |{ control: 'button'} |{ control: 'signature'; signed: boolean} ); FormWidgetLook [InterfaceDeclaration] (from packages/plugin/form/src/model.ts): export interface FormWidgetLook{ readonly border: string | null; readonly borderWidth: number; readonly borderStyle: 'solid' | 'dashed' | 'beveled' | 'inset' | 'underline'; readonly background: string | null; readonly color: string | null; readonly fontFamily: string | null; readonly fontSize: number | null; readonly textAlign: 'left' | 'center' | 'right'; } FullPageSettings [InterfaceDeclaration] (from packages/plugin/render/src/paint-plan.ts): export interface FullPageSettings{ maxWidth?: number; quantize?: 'exact' | readonly number[]; } Gap [TypeAliasDeclaration] (from packages/plugin/stage/src/contract.ts): export type Gap = number |{ px: number} ; GestureCancelledEvent [InterfaceDeclaration] (from packages/plugin/interaction/src/contract.ts): export interface GestureCancelledEvent{ readonly toolId: ToolId; readonly page: PageRef | null; readonly pointerType: PointerKind; } GestureEndedEvent [InterfaceDeclaration] (from packages/plugin/interaction/src/contract.ts): export interface GestureEndedEvent{ readonly toolId: ToolId; readonly page: PageRef | null; readonly pointerType: PointerKind; } GestureStartedEvent [InterfaceDeclaration] (from packages/plugin/interaction/src/contract.ts): export interface GestureStartedEvent{ readonly toolId: ToolId; readonly page: PageRef | null; readonly pointerType: PointerKind; } GhostPolicy [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type GhostPolicy = boolean |{ opacity: number} ; GlobalState [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface GlobalState{ readonly core: CoreState; readonly plugins: Readonly>; } GoToDestinationOptions [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface GoToDestinationOptions{ behavior?: ScrollBehaviorKind; } GoToOptions [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface GoToOptions{ behavior?: ScrollBehaviorKind; viewpoint?: Viewpoint; arrivalAlign?: Partial; } GrantOpenRequest [TypeAliasDeclaration] (from packages/engine/core/src/dto/GrantVisitor.ts): export type GrantOpenRequest = |{ readonly kind: 'passphrase'; readonly passphraseProvided: boolean} |{ readonly kind: 'identity'; readonly request: VisitorIdentityRequest} ; GridColumns [TypeAliasDeclaration] (from packages/plugin/stage/src/contract.ts): export type GridColumns = 'square' | 'auto' | number; GroupDisclosureView [TypeAliasDeclaration] (from packages/framework/react/src/toolbar.tsx): export type GroupDisclosureView = GroupDisclosureViewOf; GroupPosition [InterfaceDeclaration] (from packages/plugin/form/src/read/fill-items.ts): export interface GroupPosition{ readonly position: number; readonly size: number; } HANDLE_BAR [VariableDeclaration] (from packages/plugin/selection/src/handles.ts): HANDLE_BAR = 2 HANDLE_HEAD [VariableDeclaration] (from packages/plugin/selection/src/handles.ts): HANDLE_HEAD = 12 HANDLE_PAD [VariableDeclaration] (from packages/plugin/selection/src/handles.ts): HANDLE_PAD = 14 HISTORY_DEFAULTS [VariableDeclaration] (from packages/plugin/history/src/contract.ts): HISTORY_DEFAULTS: HistorySettings ={ limit: 100} HandleProps [InterfaceDeclaration] (from packages/framework/react/src/annotation.tsx): export interface HandleProps{ at: Point; size: number; rotation: number; kind: HandleRole; active: boolean; } HandleRole [TypeAliasDeclaration] (from packages/core/annotation/src/types.ts): export type HandleRole = 'corner' | 'side' | 'point'; HeldChange [InterfaceDeclaration] (from packages/core/main/src/changes.ts): export interface HeldChange{ readonly open: boolean; readonly change: PendingChange | null; set(ops: readonly ChangeOp[], undo?: readonly PredictedOp[]): void; send(): PendingChange | null; cancel(): void; } HistoryCapability [InterfaceDeclaration] (from packages/plugin/history/src/contract.ts): export interface HistoryCapability extends SettingsApi{ undo(): void; redo(): void; canUndo(): boolean; canRedo(): boolean; getUndoLabel(): ChangeLabel | null; getRedoLabel(): ChangeLabel | null; clear(): void; readonly onUndone: EventHook; readonly onUndoFailed: EventHook; } HistoryConfig [TypeAliasDeclaration] (from packages/plugin/history/src/contract.ts): export type HistoryConfig = DeepPartial; HistoryOptions [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface HistoryOptions{ readonly history?: false; } HistorySettings [InterfaceDeclaration] (from packages/plugin/history/src/contract.ts): export interface HistorySettings{ readonly limit: number; } HistoryState [InterfaceDeclaration] (from packages/plugin/history/src/state.ts): export interface HistoryState{ readonly canUndo: boolean; readonly canRedo: boolean; readonly undoLabel: ChangeLabel | null; readonly redoLabel: ChangeLabel | null; } HistoryToken [VariableDeclaration] (from packages/plugin/history/src/token.ts): HistoryToken = createCapabilityToken('history', { hint: "add historyPlugin() from '@embedpdf/plugin-history' to your plugins list", } ) HistoryUndoFailedEvent [InterfaceDeclaration] (from packages/plugin/history/src/contract.ts): export interface HistoryUndoFailedEvent{ readonly label: ChangeLabel; readonly redo: boolean; readonly reason: 'unavailable' | 'refused'; readonly error: PluginError; } HistoryUndoneEvent [InterfaceDeclaration] (from packages/plugin/history/src/contract.ts): export interface HistoryUndoneEvent{ readonly label: ChangeLabel; readonly redo: boolean; readonly skipped: number; } HoldOptions [InterfaceDeclaration] (from packages/core/main/src/changes.ts): export interface HoldOptions{ readonly merge?: string; } HostClock [InterfaceDeclaration] (from packages/core/main/src/clock.ts): export interface HostClock{ now(): number; after(ms: number, run: () => void): Cancel; nextFrame?(run: (timeMs: number) => void): Cancel; } HostFetch [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type HostFetch = ( url: string, init:{ readonly signal: AbortSignal} , ) => Promise<{ readonly ok: boolean; readonly status: number; arrayBuffer(): Promise; } >; HostFontProgram [InterfaceDeclaration] (from packages/core/main/src/measurer.ts): export interface HostFontProgram{ readonly family: string; readonly weight: number; readonly style: 'normal' | 'italic'; load(): Promise; } HostPrinter [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface HostPrinter{ readonly needsTap?: boolean; stage( sheets: readonly PrintSheet[], options:{ readonly name: string; readonly signal?: AbortSignal} , ): Promise; stagePdf?( pdf: Uint8Array, options:{ readonly name: string; readonly signal?: AbortSignal} , ): Promise; } HostTextMeasurer [InterfaceDeclaration] (from packages/core/main/src/measurer.ts): export interface HostTextMeasurer{ ready(program: HostFontProgram): boolean; refused(program: HostFontProgram): boolean; width(program: HostFontProgram, text: string, rtl: boolean): number; onChange(listener: () => void): () => void; } HoverPump [InterfaceDeclaration] (from packages/plugin/actions/src/hover-pump.ts): export interface HoverPump{ hover(target: HoverTarget | null): void; reset(): void; } HoverTarget [InterfaceDeclaration] (from packages/plugin/actions/src/hover-pump.ts): export interface HoverTarget{ ref: AnnotationRef; page: PageRef; source?: ActionSource; events?:{ enter?: boolean; exit?: boolean} ; } HttpRevocationSourceOptions [InterfaceDeclaration] (from packages/core/signature/src/revocation/http-source.ts): export interface HttpRevocationSourceOptions{ url: string; headers?: Record; fetch?: typeof globalThis.fetch; timeoutMs?: number; retries?: number; } HttpTimestampAuthorityOptions [InterfaceDeclaration] (from packages/core/signature/src/signers/timestamp-http.ts): export interface HttpTimestampAuthorityOptions{ url: string; hash?: Exclude; policy?: string; headers?: Record; fetch?: typeof globalThis.fetch; timeoutMs?: number; retries?: number; } I18N_DEFAULTS [VariableDeclaration] (from packages/plugin/i18n/src/contract.ts): I18N_DEFAULTS: I18nSettings ={ locale: null, fallbackLocale: 'en', locales: NO_LOCALES, loaders: NO_LOADERS, } I18nCapability [InterfaceDeclaration] (from packages/plugin/i18n/src/contract.ts): export interface I18nCapability extends SettingsApi{ t(key: string, options?: TranslateOptions): string; getTranslator(): (key: string, options?: TranslateOptions) => string; hasKey(key: string): boolean; getLocale(): string; getDirection(): TextDirection; listLocales(): readonly LocaleInfo[]; getLoadingLocale(): string | null; setLocale(code: string, options?: OperationOptions): Promise; registerLocale(locale: Locale): Unsubscribe; addTranslations(code: string, translations: TranslationDictionary): void; readonly onLocaleChanged: EventHook; readonly onLocaleLoadFailed: EventHook; } I18nConfig [TypeAliasDeclaration] (from packages/plugin/i18n/src/contract.ts): export type I18nConfig = DeepPartial; I18nSettings [InterfaceDeclaration] (from packages/plugin/i18n/src/contract.ts): export interface I18nSettings{ readonly locale: string | null; readonly fallbackLocale: string; readonly locales: readonly Locale[]; readonly loaders: Readonly>; } I18nState [InterfaceDeclaration] (from packages/plugin/i18n/src/state.ts): export interface I18nState{ readonly locale: string; readonly direction: TextDirection; readonly locales: readonly LocaleInfo[]; readonly loading: string | null; } I18nToken [VariableDeclaration] (from packages/plugin/i18n/src/token.ts): I18nToken = createCapabilityToken('i18n', { hint: `add i18nPlugin() from '@embedpdf/plugin-i18n' to your plugins list`, } ) INITIALS_MARK_NAME [VariableDeclaration] (from packages/plugin/signature/src/contract.ts): INITIALS_MARK_NAME = 'initials' INTERACTION_DEFAULTS [VariableDeclaration] (from packages/plugin/interaction/src/contract.ts): INTERACTION_DEFAULTS: InteractionSettings ={ defaultTool: 'pointer', tools: []} IconAccent [InterfaceDeclaration] (from packages/core/main/src/command-types.ts): export interface IconAccent{ readonly primary?: string; readonly secondary?: string; } Identity [InterfaceDeclaration] (from packages/engine/core/src/auth/scope/types.ts): export interface Identity{ readonly userId?: string; readonly displayName?: string; readonly email?: string; readonly title?: string; readonly organization?: string; readonly organizationalUnit?: string; readonly groupId?: string; } ImageGhost [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ImageGhost{ readonly page: PageRef; readonly box: Rect; readonly rot: number; readonly opacity: number; } ImportLibraryOptions [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface ImportLibraryOptions extends OperationOptions{ id?: string; name?: string; categories?: string[]; assetKind?: StampAssetKind; libraryKind?: StampLibraryKind; assetName?: (pageIndex: number) => string; } Importance [TypeAliasDeclaration] (from packages/core/ui/src/schema.ts): export type Importance = 1 | 2 | 3 | 4 | 5; InitialDocument [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type InitialDocument ={ source: OpenSource; active?: boolean} & Omit< OpenDocumentOptions, 'activate' | 'signal' >; InkAuthoringOptions [InterfaceDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export interface InkAuthoringOptions{ groupStrokesMs?: number; straighten?: InkStraightenOptions; } InteractionCapability [InterfaceDeclaration] (from packages/plugin/interaction/src/contract.ts): export interface InteractionCapability extends SettingsApi{ getActiveTool(): Tool; getActiveToolId(): ToolId; getDefaultToolId(): ToolId; listTools(): readonly Tool[]; getTool(id: ToolId): Tool | null; hasTool(id: ToolId): boolean; canUseTool(id: ToolId): boolean; activateTool(id: ToolId): void; activateDefaultTool(): void; pushTool(id: ToolId): void; popTool(): void; setToolCursor(id: ToolId, cursors: ToolCursors | null): void; registerTool(tool: Tool, options?: RegisterToolOptions): Unsubscribe; readonly onToolChanged: EventHook; readonly onGestureStarted: EventHook; readonly onGestureEnded: EventHook; readonly onGestureCancelled: EventHook; } InteractionConfig [TypeAliasDeclaration] (from packages/plugin/interaction/src/contract.ts): export type InteractionConfig = DeepPartial; InteractionSettings [InterfaceDeclaration] (from packages/plugin/interaction/src/contract.ts): export interface InteractionSettings{ readonly defaultTool: ToolId; readonly tools: readonly Tool[]; } InteractionState [InterfaceDeclaration] (from packages/plugin/interaction/src/state.ts): export interface InteractionState{ readonly activeToolId: ToolId | null; readonly tools: readonly Tool[]; } InteractionToken [VariableDeclaration] (from packages/plugin/interaction/src/token.ts): InteractionToken = createCapabilityToken('interaction', { hint: `add interactionPlugin() from '@embedpdf/plugin-interaction' to your plugins list`, } ) InvalidateOptions [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface InvalidateOptions{ pages?: readonly (PageRef | number)[]; scope?: InvalidateScope; } InvalidateScope [TypeAliasDeclaration] (from packages/plugin/render/src/contract.ts): export type InvalidateScope = 'content' | 'annotations' | 'fields'; Kernel [InterfaceDeclaration] (from packages/core/main/src/kernel.ts): export interface Kernel extends SettingsApi{ readonly engine: Engine; readonly documents: DocumentsCapability; capability(token: CapabilityToken, documentId?: string): T; tryCapability(token: CapabilityToken, documentId?: string): T | null; scopeOf(token: CapabilityToken): PluginScope; settingsOf(token: CapabilityToken): SettingsApi>; subscribe(listener: () => void): Unsubscribe; getState(): GlobalState; getStatus(): KernelStatus; start(): Promise; destroy(): Promise; } KernelProvider [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function KernelProvider({ kernel, children} : KernelProviderProps){ return { children} ; } KernelProviderProps [InterfaceDeclaration] (from packages/framework/react/src/runtime.tsx): export interface KernelProviderProps{ kernel: Kernel; children?: React.ReactNode; } KernelStatus [TypeAliasDeclaration] (from packages/core/main/src/kernel.ts): export type KernelStatus = | 'created' | 'starting' | 'started' | 'failed' | 'destroying' | 'destroyed'; LatestCancellation [InterfaceDeclaration] (from packages/core/main/src/lanes.ts): export interface LatestCancellation{ readonly runId: string; readonly reason: string; } LatestLane [InterfaceDeclaration] (from packages/core/main/src/lanes.ts): export interface LatestLane{ readonly running: boolean; run(fn: (run: LatestRun) => Promise, options?: OperationOptions): Promise; cancel(reason?: unknown): void; } LatestRun [InterfaceDeclaration] (from packages/core/main/src/lanes.ts): export interface LatestRun{ readonly id: string; readonly signal: AbortSignal; readonly superseded: boolean; commit(fn: () => void): boolean; } LayoutKind [TypeAliasDeclaration] (from packages/plugin/stage/src/contract.ts): export type LayoutKind = 'vertical' | 'horizontal' | 'grid'; LengthUnit [TypeAliasDeclaration] (from packages/engine/core/src/measure/units.ts): export type LengthUnit = keyof typeof METRES; LineEnding [TypeAliasDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export type LineEnding = | 'none' | 'square' | 'circle' | 'diamond' | 'open-arrow' | 'closed-arrow' | 'butt' | 'r-open-arrow' | 'r-closed-arrow' | 'slash'; LineEndings [InterfaceDeclaration] (from packages/engine/core/src/annotation/primitives.ts): export interface LineEndings{ start: LineEnding; end: LineEnding; } LineStyle [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type LineStyle = 'solid' | 'dashed'; Link [TypeAliasDeclaration] (from packages/plugin/link/src/contract.ts): export type Link = LinkNavItem; LinkActivateContext [InterfaceDeclaration] (from packages/plugin/link/src/contract.ts): export interface LinkActivateContext{ readonly activate?: PdfActionTree; readonly ref?: AnnotationRef; readonly page?: PageRef; readonly stage?: StageCapability; } LinkActivatedEvent [InterfaceDeclaration] (from packages/plugin/link/src/contract.ts): export interface LinkActivatedEvent{ readonly target: PdfLinkTarget; readonly activation: LinkActivation; } LinkActivation [TypeAliasDeclaration] (from packages/plugin/link/src/contract.ts): export type LinkActivation = |{ status: 'revealed'} |{ status: 'destination'; destination: PageDestination} |{ status: 'uri'; uri: string} |{ status: 'named'; name: string} |{ status: 'reported'; target: PdfLinkTarget} |{ status: 'dispatched'; dispatch: Promise} |{ status: 'none'} ; LinkCapability [InterfaceDeclaration] (from packages/plugin/link/src/contract.ts): export interface LinkCapability{ listLinks(page: PageRef | number): readonly Link[]; getLink(page: PageRef | number, linkId: string): Link | null; getLinkAt(page: PageRef | number, point: Point): Link | null; readAllLinks(options?: OperationOptions): Promise; ensureLoaded(page: PageRef | number, options?: OperationOptions): Promise; isLoaded(page: PageRef | number): boolean; getStatus(page: PageRef | number): ResourceStatus; resolve(target: PdfLinkTarget): LinkResolution; activate(target: PdfLinkTarget | Link, context?: LinkActivateContext): LinkActivation; activateAt( page: PageRef | number, point: Point, context?: LinkActivateContext, ): LinkActivation | null; getLabel(link: Link | PdfLinkTarget): string; readonly onActivated: EventHook; readonly onLoaded: EventHook; } LinkLayer [FunctionDeclaration] (from packages/framework/react/src/link.tsx): export function LinkLayer({ renderLink} : LinkLayerProps ={ } ){ const page = usePage(); const link = useCapability(LinkToken); useUriOpener(); const stage = useOptionalCapability(useStageToken()); const actions = useOptionalCapability(ActionsToken); const linkPump = useMemo(() => (actions ? createHoverPump(actions.dispatch) : null), [actions]); const items = useSelector(LinkToken, (link) => link.listLinks(page.ref), shallowArray); const engaged = useSelector(LinkHostToken, (link) => link.isNavigationEngaged()); const editEnabled = useOptionalSelector( InteractionToken, (interaction) => interaction.activeToolEnables('annotation-edit'), false, ); useEffect(() =>{ void link.ensureLoaded(page.ref); } , [link, page.ref]); if (!engaged || !items.length) return null; const visible = navigableLinksOf(items, editEnabled); if (!visible.length) return null; return (
{ visible.map((item) =>{ const{ box, href, label} = linkAnchorOf(item, page.transform, (each) => link.getLabel(each), ); const context = linkActivateContextOf(item, page.ref, stage); const native = ( sendLinkEvent(actions, item, page.ref, 'mouseDown')} href={ href ?? undefined} target="_blank" rel="noopener noreferrer" role="link" tabIndex={ 0} title={ label} aria-label={ label} onClick={ (event) =>{ if (href && isModifiedClick(event)) return; event.preventDefault(); link.activate(item, context); } } onKeyDown={ (event) =>{ if (event.key === 'Enter' || event.key === ' '){ event.preventDefault(); link.activate(item, context); } } } onPointerEnter={ () => hoverLink(linkPump, item, page.ref)} onPointerLeave={ () => linkPump?.hover(null)} onPointerUp={ () => sendLinkEvent(actions, item, page.ref, 'mouseUp')} onFocus={ () => sendLinkEvent(actions, item, page.ref, 'focus')} onBlur={ () => sendLinkEvent(actions, item, page.ref, 'blur')} style={ { position: 'absolute', left: box.left, top: box.top, width: box.width, height: box.height, cursor: 'pointer', pointerEvents: 'auto', } } /> ); const drawn = renderLink?.({ link: item, native} ) ?? native; return { drawn} ; } )}
); } LinkLayerProps [InterfaceDeclaration] (from packages/framework/react/src/link.tsx): export interface LinkLayerProps{ renderLink?: (props: LinkRenderProps) => React.ReactNode | undefined; } LinkLoadedEvent [InterfaceDeclaration] (from packages/plugin/link/src/contract.ts): export interface LinkLoadedEvent{ readonly page: PageRef; } LinkNavItem [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface LinkNavItem{ readonly id: string; readonly bounds: Rect; readonly target: PdfLinkTarget; readonly attached: boolean; readonly activate?: PdfActionTree; readonly ref?: AnnotationRef; readonly hoverEvents?:{ enter: boolean; exit: boolean} ; } LinkRenderProps [InterfaceDeclaration] (from packages/framework/react/src/link.tsx): export interface LinkRenderProps{ link: Link; native: React.ReactNode; } LinkResolution [TypeAliasDeclaration] (from packages/plugin/link/src/contract.ts): export type LinkResolution = |{ kind: 'destination'; destination: PageDestination} |{ kind: 'uri'; uri: string} |{ kind: 'named'; name: string} |{ kind: 'reported'; target: PdfLinkTarget} ; LinkToken [VariableDeclaration] (from packages/plugin/link/src/token.ts): LinkToken = createCapabilityToken('link', { hint: `add linkPlugin() from '@embedpdf/plugin-link' to your plugins list`, promises:{ readAllLinks: true, ensureLoaded: true, } , } ) Locale [InterfaceDeclaration] (from packages/plugin/i18n/src/contract.ts): export interface Locale{ readonly code: string; readonly name: string; readonly direction?: TextDirection; readonly translations: TranslationDictionary; } LocaleChangedEvent [InterfaceDeclaration] (from packages/plugin/i18n/src/contract.ts): export interface LocaleChangedEvent{ readonly locale: string; readonly previousLocale: string; } LocaleInfo [InterfaceDeclaration] (from packages/plugin/i18n/src/contract.ts): export interface LocaleInfo{ readonly code: string; readonly name: string; readonly direction: TextDirection; readonly loaded: boolean; } LocaleLoadFailedEvent [InterfaceDeclaration] (from packages/plugin/i18n/src/contract.ts): export interface LocaleLoadFailedEvent{ readonly locale: string; readonly error: PluginErrorInfo; } LocaleLoader [TypeAliasDeclaration] (from packages/plugin/i18n/src/contract.ts): export type LocaleLoader = () => Promise; LockedDocumentInfo [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface LockedDocumentInfo extends DocumentInfo{ readonly status: 'locked'; readonly passwordProvided: boolean; } LongTermGap [InterfaceDeclaration] (from packages/core/signature/src/long-term.ts): export interface LongTermGap{ certificate: string | null; reason: LongTermGapReason; } LongTermGapReason [TypeAliasDeclaration] (from packages/core/signature/src/long-term.ts): export type LongTermGapReason = 'no-timestamp' | 'untrusted' | 'no-answer' | 'revoked'; LongTermVerdict [InterfaceDeclaration] (from packages/core/signature/src/long-term.ts): export interface LongTermVerdict{ enabled: boolean; provenAt: string | null; expiresAt: string | null; documentTimestampedAt: string | null; missing: LongTermGap[]; } MEASUREMENT_DEFAULTS [VariableDeclaration] (from packages/plugin/measurement/src/contract.ts): MEASUREMENT_DEFAULTS: MeasurementSettings ={ defaultScale: 'metric', presets: DEFAULT_PRESETS, } MIN_DRAG [VariableDeclaration] (from packages/core/annotation/src/placement.ts): MIN_DRAG = 3 Mark [TypeAliasDeclaration] (from packages/plugin/signature/src/contract.ts): export type Mark ={ assetId: string} |{ source: BinarySource} ; MarkRole [TypeAliasDeclaration] (from packages/plugin/signature/src/contract.ts): export type MarkRole = 'signature' | 'initials'; MarkSource [TypeAliasDeclaration] (from packages/plugin/stamp/src/contract.ts): export type MarkSource = |{ kind: 'ink'; strokes: ReadonlyArray>; color?: string; strokeWidth?: number; } |{ kind: 'text'; text: string; fontFamily: string; color?: string; fontSize?: number} |{ kind: 'image'; source: BinarySource} |{ kind: 'pdf'; source: BinarySource; pageIndex?: number} ; MarkupSubtype [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type MarkupSubtype = 'highlight' | 'underline' | 'strikeout' | 'squiggly'; MeasurementCapability [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface MeasurementCapability extends SettingsApi{ canCalibrate(): boolean; canMeasure(page: PageRef | number): boolean; getPageScale(page: PageRef | number): PageScale; ensureLoaded(page: PageRef | number, options?: OperationOptions): Promise; isBusy(): boolean; listLastReports(): readonly ScaleChangeReport[]; listPresets(): readonly ScalePreset[]; listUnits(): readonly LengthUnit[]; listAreaUnits(): readonly AreaUnit[]; getReadout(ref: AnnotationRef): MeasurementReadout | MeasurementUnavailable; measureDistance( page: PageRef | number, from: Point, to: Point, ): MeasurementReadout | MeasurementUnavailable; measureArea( page: PageRef | number, vertices: readonly Point[], ): MeasurementReadout | MeasurementUnavailable; getCalibrationRequest(): CalibrationRequest | null; setScale( pages: PageTarget, measure: PdfMeasure, options?: ScaleChangeOptions, ): Promise; calibrate( input: CalibrateInput, options?: ScaleChangeOptions &{ applyTo?: PageTarget} , ): Promise; setUnit( pages: PageTarget, unit: LengthUnit, options?: ScaleChangeOptions, ): Promise; setAreaUnit( pages: PageTarget, unit: AreaUnit, options?: ScaleChangeOptions, ): Promise; setPrecision( pages: PageTarget, precision: number, options?: ScaleChangeOptions, ): Promise; setPreset( pages: PageTarget, presetId: string, options?: ScaleChangeOptions, ): Promise; clearScale( pages: PageTarget, options?: ScaleChangeOptions, ): Promise; createMeasurement( input: CreateMeasurementInput, options?: OperationOptions, ): Promise<{ annotation: Annotation} >; startCalibration(): void; dismissCalibration(): void; readonly onScaleChanged: EventHook; readonly onCalibrationRequested: EventHook; readonly onCalibrationCompleted: EventHook; readonly onCalibrationDismissed: EventHook; } MeasurementConfig [TypeAliasDeclaration] (from packages/plugin/measurement/src/contract.ts): export type MeasurementConfig = Partial; MeasurementIntent [TypeAliasDeclaration] (from packages/core/annotation/src/editable.ts): export type MeasurementIntent = 'line-dimension' | 'polyline-dimension' | 'polygon-dimension'; MeasurementKind [TypeAliasDeclaration] (from packages/plugin/measurement/src/contract.ts): export type MeasurementKind = 'distance' | 'perimeter' | 'area'; MeasurementReadout [InterfaceDeclaration] (from packages/engine/core/src/measure/derive.ts): export interface MeasurementReadout{ kind: 'distance' | 'perimeter' | 'area'; label: string; value: number; perimeter?: string; } MeasurementScaleChangedEvent [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface MeasurementScaleChangedEvent{ readonly page: PageRef; readonly report: ScaleChangeReport; } MeasurementSettings [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface MeasurementSettings{ readonly defaultScale: 'metric' | 'imperial' | PdfMeasure; readonly presets: readonly ScalePreset[]; } MeasurementState [InterfaceDeclaration] (from packages/plugin/measurement/src/state.ts): export interface MeasurementState{ readonly busy: boolean; readonly calibrationRequest: CalibrationRequest | null; readonly lastReports: readonly ScaleChangeReport[]; } MeasurementToken [VariableDeclaration] (from packages/plugin/measurement/src/token.ts): MeasurementToken = createCapabilityToken('measurement', { hint: `add measurementPlugin() from '@embedpdf/plugin-measurement' to your plugins list`, promises:{ ensureLoaded: true, setScale: true, calibrate: true, setUnit: true, setAreaUnit: true, setPrecision: true, setPreset: true, clearScale: true, createMeasurement: true, } , } ) MeasurementUnavailable [InterfaceDeclaration] (from packages/engine/core/src/measure/derive.ts): export interface MeasurementUnavailable{ unavailable: | 'not-dimension' | 'no-measure' | 'foreign-measure' | 'no-scale' | 'no-distance-format' | 'no-area-format' | 'invalid-format' | 'invalid-geometry'; } MenuClosedEvent [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface MenuClosedEvent{ readonly id: string; } MenuOpenedEvent [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface MenuOpenedEvent{ readonly id: string; } MetadataCapability [InterfaceDeclaration] (from packages/plugin/metadata/src/contract.ts): export interface MetadataCapability{ getSnapshot(): DocumentMetadata | null; getStatus(): ResourceStatus; ensureLoaded(options?: OperationOptions): Promise; canUpdate(): boolean; update( patch: MetadataPatch, options?: OperationOptions, ): Promise<{ readonly metadata: DocumentMetadata} >; refresh(options?: OperationOptions): Promise; readonly onUpdated: EventHook; readonly onResynced: EventHook; readonly custom: CustomMetadataCapability; } MetadataPatch [InterfaceDeclaration] (from packages/engine/core/src/dto/MetadataPatch.ts): export interface MetadataPatch{ title?: string | null; author?: string | null; subject?: string | null; keywords?: string | null; producer?: string | null; creator?: string | null; createdAt?: DateInput | null; modifiedAt?: DateInput | null; trapped?: DocumentMetadataTrapped; } MetadataResyncedEvent [InterfaceDeclaration] (from packages/plugin/metadata/src/contract.ts): export interface MetadataResyncedEvent{ readonly metadata: DocumentMetadata; } MetadataState [InterfaceDeclaration] (from packages/plugin/metadata/src/state.ts): export interface MetadataState{ readonly metadata: DocumentMetadata | null; readonly custom: CustomMetadata | null; readonly status: ResourceStatus; } MetadataToken [VariableDeclaration] (from packages/plugin/metadata/src/token.ts): MetadataToken = createCapabilityToken('metadata', { hint: "add metadataPlugin() from '@embedpdf/plugin-metadata' to your plugins list", promises:{ update: true, refresh: true, ensureLoaded: true, 'custom.update': true, 'custom.refresh': true, } , } ) MetadataUpdateResult [InterfaceDeclaration] (from packages/engine/core/src/mutation/MetadataUpdateResult.ts): export interface MetadataUpdateResult{ metadata: DocumentMetadata; meta: MutationMeta; } MetadataUpdatedEvent [InterfaceDeclaration] (from packages/plugin/metadata/src/contract.ts): export interface MetadataUpdatedEvent{ readonly metadata: DocumentMetadata; readonly previous: DocumentMetadata | null; readonly changedKeys: readonly (keyof DocumentMetadata)[]; readonly origin: EventOrigin; } Mirror [InterfaceDeclaration] (from packages/core/main/src/mirror.ts): export interface Mirror{ get(): V; view(): V; getStatus(): ResourceStatus; ensureLoaded(): Promise; refresh(): Promise; settled(): Promise; } MirrorChange [InterfaceDeclaration] (from packages/core/main/src/mirror.ts): export interface MirrorChange{ readonly cause: 'load' | 'event'; readonly event: DocumentEvent | null; readonly pages: 'all' | readonly PageRef[] | null; readonly previous: V; readonly next: V; } MirrorReload [InterfaceDeclaration] (from packages/core/main/src/mirror.ts): export interface MirrorReload{ readonly [RELOAD]: 'all' | readonly PageRef[]; } MirrorSpec [InterfaceDeclaration] (from packages/core/main/src/mirror.ts): export interface MirrorSpec{ readonly name: string; readonly initial: () => V; readonly readable?: () => boolean; readonly onDemand?: true; load(doc: DocumentHandle, signal: AbortSignal): Promise<{ value: V; cursor?: number} >; fold(value: V, event: DocumentEvent): V | MirrorReload; predict?(value: V, op: PredictedOp): V; loadPages?( doc: DocumentHandle, pages: readonly PageRef[], signal: AbortSignal, ): Promise<(value: V) => V>; readonly onChanged?: (change: MirrorChange) => void; } Modifiers [InterfaceDeclaration] (from packages/plugin/interaction/src/contract.ts): export interface Modifiers{ readonly shift: boolean; readonly alt: boolean; readonly ctrl: boolean; readonly meta: boolean; } MountableFontProgram [InterfaceDeclaration] (from packages/core/fonts/src/standard/programs.ts): export interface MountableFontProgram{ readonly hash: string; readonly family: string; readonly weight: number; readonly style: 'normal' | 'italic'; load(): Promise; } NO_PAGE_SCALE [VariableDeclaration] (from packages/plugin/measurement/src/contract.ts): NO_PAGE_SCALE: PageScale = Object.freeze({ measure: null, source: 'default', ready: false, persistent: false, } ) NO_READOUT [VariableDeclaration] (from packages/plugin/measurement/src/contract.ts): NO_READOUT: MeasurementUnavailable = Object.freeze({ unavailable: 'not-dimension'} ) NoSettings [InterfaceDeclaration] (from packages/core/main/src/settings.ts): export interface NoSettings{ readonly [noSettings]: true; } NotAllowedMode [TypeAliasDeclaration] (from packages/plugin/commands/src/contract.ts): export type NotAllowedMode = 'hide' | 'disable'; OpenDocumentOptions [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type OpenDocumentOptions = OpenOptions &{ readonly activate?: boolean; readonly name?: string; readonly signal?: AbortSignal; } ; OpenDocumentResult [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface OpenDocumentResult{ readonly document: DocumentInfo; } OpenInput [TypeAliasDeclaration] (from packages/engine/core/src/dto/OpenInput.ts): export type OpenInput = | OpenInputBytes | OpenInputLayerBytes | OpenInputLayerFile | OpenInputById | OpenInputToken | OpenInputGrant; OpenOptions [InterfaceDeclaration] (from packages/engine/core/src/dto/OpenInput.ts): export interface OpenOptions{ password?: string; scope?: ReadonlyArray; identity?: Identity; } OpenSequenceCompletedEvent [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface OpenSequenceCompletedEvent{ readonly result: ActionTriggerResult; } OpenSource [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type OpenSource = | OpenInput | UrlSource | ((signal: AbortSignal) => OpenInput | UrlSource | Promise); OpenSurfaceOptions [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface OpenSurfaceOptions{ readonly exclusive?: string; readonly props?: SurfaceProps; readonly focus?: boolean; } OperationOptions [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface OperationOptions{ readonly signal?: AbortSignal; } OutlineCapability [InterfaceDeclaration] (from packages/plugin/outline/src/contract.ts): export interface OutlineCapability{ list(): readonly OutlineItem[]; get(ref: OutlineItemRef): OutlineItem | null; getChildren(parent: OutlineItemRef | null): readonly OutlineItem[]; listRows(): readonly OutlineRow[]; getCurrentItem(): OutlineItemRef | null; isIncomplete(): boolean; getStatus(): ResourceStatus; ensureLoaded(options?: OperationOptions): Promise; refresh(options?: OperationOptions): Promise; isExpanded(ref: OutlineItemRef): boolean; expand(ref: OutlineItemRef): void; collapse(ref: OutlineItemRef): void; toggle(ref: OutlineItemRef): void; expandAll(): void; collapseAll(): void; reveal(ref: OutlineItemRef): void; getSelected(): readonly OutlineItemRef[]; select(refs: readonly OutlineItemRef[]): void; activate(ref: OutlineItemRef): LinkActivation; canEdit(): boolean; getCurrentViewTarget(): PdfLinkTargetWritable | null; create( input?: OutlineItemInput, options?: OutlineCreateOptions, ): Promise<{ readonly item: OutlineItem} >; update( ref: OutlineItemRef, patch: OutlineItemPatch, options?: OperationOptions, ): Promise<{ readonly item: OutlineItem} >; move( refs: readonly OutlineItemRef[], parent: OutlineItemRef | null, position: OutlinePosition, options?: OperationOptions, ): Promise; delete(refs: readonly OutlineItemRef[], options?: OperationOptions): Promise; readonly onChanged: EventHook; readonly onResynced: EventHook; } OutlineChangedEvent [InterfaceDeclaration] (from packages/plugin/outline/src/contract.ts): export interface OutlineChangedEvent{ readonly type: 'created' | 'updated' | 'moved' | 'deleted' | 'restored'; readonly items: readonly OutlineItemRef[]; readonly origin: EventOrigin; } OutlineCreateOptions [InterfaceDeclaration] (from packages/plugin/outline/src/contract.ts): export interface OutlineCreateOptions extends OperationOptions{ readonly select?: boolean; } OutlineItem [InterfaceDeclaration] (from packages/engine/core/src/dto/DocumentOutline.ts): export interface OutlineItem{ ref: OutlineItemRef; parent: OutlineItemRef | null; title: string; target: PdfLinkTarget | null; action: PdfActionTree | null; open: boolean; color: string | null; bold: boolean; italic: boolean; } OutlineItemDraft [InterfaceDeclaration] (from packages/engine/core/src/dto/DocumentOutline.ts): export interface OutlineItemDraft{ title: string; target?: PdfLinkTargetWritable | null; color?: string | null; bold?: boolean; italic?: boolean; } OutlineItemInput [InterfaceDeclaration] (from packages/plugin/outline/src/contract.ts): export interface OutlineItemInput extends Partial{ readonly parent?: OutlineItemRef | null; readonly position?: OutlinePosition; } OutlineItemPatch [TypeAliasDeclaration] (from packages/engine/core/src/dto/DocumentOutline.ts): export type OutlineItemPatch = Partial> &{ open?: boolean; } ; OutlineItemRef [TypeAliasDeclaration] (from packages/engine/core/src/identity/OutlineItemRef.ts): export type OutlineItemRef ={ kind: 'objectNumber'; objectNumber: number} ; OutlinePosition [TypeAliasDeclaration] (from packages/engine/core/src/mutation/ListPosition.ts): export type OutlinePosition = ListPosition; OutlineResyncedEvent [InterfaceDeclaration] (from packages/plugin/outline/src/contract.ts): export interface OutlineResyncedEvent{ readonly outline: DocumentOutline; } OutlineRow [InterfaceDeclaration] (from packages/plugin/outline/src/contract.ts): export interface OutlineRow{ readonly item: OutlineItem; readonly depth: number; readonly hasChildren: boolean; readonly expanded: boolean; } OutlineState [InterfaceDeclaration] (from packages/plugin/outline/src/state.ts): export interface OutlineState{ readonly items: readonly OutlineItem[]; readonly rows: readonly OutlineRow[]; readonly current: OutlineItemRef | null; readonly selected: readonly OutlineItemRef[]; readonly status: ResourceStatus; readonly incomplete: boolean; readonly canEdit: boolean; } OutlineToken [VariableDeclaration] (from packages/plugin/outline/src/token.ts): OutlineToken = createCapabilityToken('outline', { hint: "add outlinePlugin() from '@embedpdf/plugin-outline' to your plugins list", promises:{ ensureLoaded: true, refresh: true, create: true, update: true, move: true, delete: true, } , } ) OverflowMenuView [TypeAliasDeclaration] (from packages/framework/react/src/toolbar.tsx): export type OverflowMenuView = OverflowMenuViewOf; OverflowRow [TypeAliasDeclaration] (from packages/core/ui/src/projection.ts): export type OverflowRow = |{ readonly kind: 'command'; readonly command: string} |{ readonly kind: 'submenu'; readonly command: string; readonly menu: string} ; OverflowSection [InterfaceDeclaration] (from packages/core/ui/src/projection.ts): export interface OverflowSection{ readonly labelKey?: string; readonly role?: 'radio'; readonly rows: readonly OverflowRow[]; } PINNED [VariableDeclaration] (from packages/core/ui/src/schema.ts): PINNED: Importance = 5 Padding [TypeAliasDeclaration] (from packages/core/stage/src/index.ts): export type Padding = number | PaddingSides; PaddingSides [InterfaceDeclaration] (from packages/core/stage/src/index.ts): export interface PaddingSides{ top: number; right: number; bottom: number; left: number; } PageContextValue [TypeAliasDeclaration] (from packages/framework/react/src/runtime.tsx): export type PageContextValue = PageContext; PageDeleteResult [InterfaceDeclaration] (from packages/engine/core/src/mutation/PageDeleteResult.ts): export interface PageDeleteResult{ layout: PageListSnapshot; meta: MutationMeta; } PageDestination [TypeAliasDeclaration] (from packages/engine/core/src/dto/PdfDestination.ts): export type PageDestination = |{ kind: 'xyz'; page: PageRef; x: number | null; y: number | null; zoom: number | null} |{ kind: 'fit'; page: PageRef} |{ kind: 'fitH'; page: PageRef; y: number | null} |{ kind: 'fitV'; page: PageRef; x: number | null} |{ kind: 'fitR'; page: PageRef; x: number; y: number; width: number; height: number} |{ kind: 'fitB'; page: PageRef} |{ kind: 'fitBH'; page: PageRef; y: number | null} |{ kind: 'fitBV'; page: PageRef; x: number | null} ; PageEditCapability [InterfaceDeclaration] (from packages/plugin/page-edit/src/contract.ts): export interface PageEditCapability{ canEdit(): boolean; canExtract(): boolean; getSelected(): readonly PageRef[]; select(pages: readonly (PageRef | number)[]): void; rotateBy( pages: readonly (PageRef | number)[], delta: 90 | -90 | 180, options?: OperationOptions, ): Promise; setRotation( pages: readonly (PageRef | number)[], rotation: PdfRotation, options?: OperationOptions, ): Promise; reorder( pages: readonly (PageRef | number)[], position: PagePosition, options?: OperationOptions, ): Promise; delete(pages: readonly (PageRef | number)[], options?: OperationOptions): Promise; insertBlank(options?: PageInsertBlankOptions): Promise; insertFromBytes( bytes: Uint8Array | ArrayBuffer, options?: PageInsertFromBytesOptions, ): Promise; insertFromDocument( documentId: string, pages: readonly (PageRef | number)[], options?: PagePositionOptions, ): Promise; duplicate( pages: readonly (PageRef | number)[], options?: PagePositionOptions, ): Promise; extract(pages: readonly (PageRef | number)[], options?: OperationOptions): Promise; } PageEditInsertResult [InterfaceDeclaration] (from packages/plugin/page-edit/src/contract.ts): export interface PageEditInsertResult{ readonly pages: readonly PageRef[]; } PageEditState [InterfaceDeclaration] (from packages/plugin/page-edit/src/state.ts): export interface PageEditState{ readonly selected: readonly PageRef[]; readonly canEdit: boolean; readonly canExtract: boolean; } PageEditToken [VariableDeclaration] (from packages/plugin/page-edit/src/token.ts): PageEditToken = createCapabilityToken('page-edit', { hint: `add pageEditPlugin() from '@embedpdf/plugin-page-edit' to your plugins list`, promises:{ rotateBy: true, setRotation: true, reorder: true, delete: true, insertBlank: true, insertFromBytes: true, insertFromDocument: true, duplicate: true, extract: true, } , } ) PageFrame [InterfaceDeclaration] (from packages/core/geometry/src/index.ts): export interface PageFrame{ top: number; right: number; bottom: number; left: number; } PageHandle [InterfaceDeclaration] (from packages/engine/core/src/engine/PageHandle.ts): export interface PageHandle{ readonly ref: PageRef; readonly annotations: PageAnnotationsService; readonly forms: PageFormsService; readonly text: PageTextService; readonly render: PageRenderService; readonly measure: PageMeasureService; } PageImage [TypeAliasDeclaration] (from packages/plugin/render/src/contract.ts): export type PageImage = PageImageHandle; PageImageHandle [InterfaceDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export interface PageImageHandle extends PageImageResult, ImageSource{ } PageImageObjectUrl [InterfaceDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export interface PageImageObjectUrl{ url: string; revoke(): void; } PageImageOptions [InterfaceDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export interface PageImageOptions< C extends Coordinates = PageCoordinates, > extends PageRenderOptions{ format?: PageRenderEncodedFormat; quality?: number; } PageInfo [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type PageInfo = PageLayout; PageInsertBlankOptions [InterfaceDeclaration] (from packages/plugin/page-edit/src/contract.ts): export interface PageInsertBlankOptions extends OperationOptions{ readonly position?: PagePosition; readonly size?: PdfSize; readonly count?: number; } PageInsertBlankSpec [InterfaceDeclaration] (from packages/engine/core/src/mutation/PageInsertBlankInput.ts): export interface PageInsertBlankSpec{ size: PdfSize; count?: number; } PageInsertFromBytesOptions [InterfaceDeclaration] (from packages/plugin/page-edit/src/contract.ts): export interface PageInsertFromBytesOptions extends OperationOptions{ readonly pageIndexes?: readonly number[]; readonly position?: PagePosition; } PageInsertResult [InterfaceDeclaration] (from packages/engine/core/src/mutation/PageInsertResult.ts): export interface PageInsertResult{ insertedPages: PageRef[]; layout: PageListSnapshot; meta: MutationMeta; } PageLayerOptions [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface PageLayerOptions{ includeAnnotations?: boolean; includeFormFields?: boolean; } PageLayerRights [InterfaceDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export interface PageLayerRights{ readonly annotations: boolean; readonly formFields: boolean; } PageLayout [InterfaceDeclaration] (from packages/engine/core/src/dto/PageLayout.ts): export interface PageLayout{ index: number; ref: PageRef; label: string | null; size: PdfSize; rotation: PdfRotation; userUnit: number; tabOrder: PageTabOrder | null; boxes: PageBoxes; pdfCropBox: PdfRect; actions?: PdfPageActions; viewports?: PageMeasurementViewport[]; } PageMirror [InterfaceDeclaration] (from packages/core/main/src/page-mirror.ts): export interface PageMirror{ get(page: PageRef): V | undefined; view(page: PageRef): V | undefined; getStatus(page: PageRef): ResourceStatus; ensureLoaded(page: PageRef, options?: OperationOptions): Promise; refresh(page?: PageRef): Promise; } PageMirrorChange [InterfaceDeclaration] (from packages/core/main/src/page-mirror.ts): export interface PageMirrorChange{ readonly page: PageRef; readonly cause: 'load' | 'event' | 'drop'; readonly event: DocumentEvent | null; readonly previous: V | undefined; readonly next: V | undefined; } PageMirrorSpec [InterfaceDeclaration] (from packages/core/main/src/page-mirror.ts): export interface PageMirrorSpec{ readonly name: string; load(doc: DocumentHandle, page: PageRef, signal: AbortSignal): Promise; affected(event: DocumentEvent): readonly PageRef[] | 'all' | null; fold?(value: V, event: DocumentEvent, page: PageRef): V | 'reload'; predict?(value: V, op: PredictedOp, page: PageRef): V; readonly onChanged?: (change: PageMirrorChange) => void; } PageObjectNumber [TypeAliasDeclaration] (from packages/engine/core/src/identity/PageObjectNumber.ts): export type PageObjectNumber = number; PagePointerSource [FunctionDeclaration] (from packages/framework/react/src/interaction.tsx): export function PagePointerSource(){ const page = usePage(); const interaction = useCapability(InteractionHostToken); const cursor = useSelector(InteractionHostToken, (interaction) => interaction.getCursor()); const ref = useRef(null); useEffect(() =>{ const element = ref.current; if (!element) return; return attachPagePointer(element, interaction, () => page); } , [interaction, page]); return
; } PagePosition [TypeAliasDeclaration] (from packages/engine/core/src/mutation/ListPosition.ts): export type PagePosition = ListPosition; PagePositionOptions [InterfaceDeclaration] (from packages/plugin/page-edit/src/contract.ts): export interface PagePositionOptions extends OperationOptions{ readonly position?: PagePosition; } PageProvider [VariableDeclaration] (from packages/framework/react/src/runtime.tsx): PageProvider = PageReactContext.Provider PageRaster [InterfaceDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export interface PageRaster{ width: number; height: number; stride: number; color: 'rgba8'; premultipliedAlpha: false; data: ArrayBuffer; } PageRef [TypeAliasDeclaration] (from packages/engine/core/src/identity/PageRef.ts): export type PageRef ={ kind: 'objectNumber'; objectNumber: PageObjectNumber} ; PageRender [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface PageRender{ readonly page: PageRef; readonly image: PageImage; } PageRenderLayers [InterfaceDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export interface PageRenderLayers{ readonly includeAnnotations: boolean; readonly includeFormFields: boolean; } PageRenderOptions [InterfaceDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export interface PageRenderOptions{ target?: PageRenderTarget; viewport?: PageRenderViewport; rotation?: PdfRotation; background?: PageRenderBackground; includeAnnotations?: boolean; includeFormFields?: boolean; usage?: PageFlattenUsage; maxOutputPixels?: number; } PageRenderTarget [TypeAliasDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export type PageRenderTarget = |{ kind: 'page'} |{ kind: 'rect'; rect: C['box']; } ; PageRenderViewport [TypeAliasDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export type PageRenderViewport = | PageScreenViewport |{ kind: 'thumbnail'; } |{ kind: 'dpi'; dpi: PrintDpi; } ; PageReorderResult [InterfaceDeclaration] (from packages/engine/core/src/mutation/PageReorderResult.ts): export interface PageReorderResult{ pages: PageRef[]; layout: PageListSnapshot; meta: MutationMeta; } PageRotateResult [InterfaceDeclaration] (from packages/engine/core/src/mutation/PageRotateResult.ts): export interface PageRotateResult{ layout: PageListSnapshot; meta: MutationMeta; } PageScale [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface PageScale{ readonly measure: PdfMeasurement | null; readonly source: 'owned' | 'foreign' | 'default'; readonly ready: boolean; readonly persistent: boolean; readonly error?: SerializedEngineError; } PageTarget [TypeAliasDeclaration] (from packages/plugin/measurement/src/contract.ts): export type PageTarget = PageRef | number | readonly (PageRef | number)[] | 'all'; PageView [FunctionDeclaration] (from packages/framework/react/src/page-view.tsx): export function PageView({ page: wanted, documentId, fallback = null, width = 240, pageFrame: framePatch, children, pageChrome, className, style, } : PageViewProps){ const wantedRef = typeof wanted === 'number' ? null : wanted; const wantedIndex = typeof wanted === 'number' ? wanted : null; const{ top = 0, right = 0, bottom = 0, left = 0} = framePatch ?? NO_FRAME; const pageFrame = useMemo( () => ({ top, right, bottom, left} ), [top, right, bottom, left], ); const inScope = useDocumentId(); const ref = useRef(null); const docId = documentId ?? inScope; const wantedPageObjectNumber = wantedRef?.objectNumber ?? null; const base = useKernelValue((kernel) =>{ if (!docId) return null; const pages = kernel.documents.listPages(docId); const found = wantedPageObjectNumber !== null ? pages.find((pageInfo) => pageInfo.ref.objectNumber === wantedPageObjectNumber) : pages[wantedIndex ?? 0]; return found ?? null; } ); const page = base?.index ?? wantedIndex ?? 0; const pageObjectNumber = base?.ref.objectNumber ?? wantedPageObjectNumber ?? page + 1; const pageRef = useMemo(() => toPageRef(pageObjectNumber), [pageObjectNumber]); const dpr = typeof window !== 'undefined' ? window.devicePixelRatio || 1 : 1; const transform = useMemo( () => pageTransform(pageViewTransformInput(base, width, dpr)), [base?.size.width, base?.size.height, base?.userUnit, base?.rotation, width, dpr], ); const viewId = useId(); const ctx = useMemo( () => makePageContext(docId ?? '', `page-view:${ viewId} `, pageRef, page, pageFrame, transform, () => ref.current!.getBoundingClientRect(), ), [docId, pageRef, page, pageFrame, transform, viewId], ); const projector = useMemo( () => clientPageProjector(ctx, () => ref.current !== null), [ctx], ); const projectorBinding = useMemo( () => ({ projector, revision: ctx, subscribe: observeClientGeometry} ), [projector, ctx], ); const shownPages = useMemo( () => new Set([ctx.ref.objectNumber]), [ctx.ref.objectNumber], ); const look = useViewerSettings((settings) => settings.page); if (!docId || !base) return <>{ fallback} ; const layout = pageSurfaceLayout(transform, pageFrame); return (
{ }
{ }
{ children}
{ pageChrome}
); } PageViewDemand [InterfaceDeclaration] (from packages/plugin/render/src/paint-plan.ts): export interface PageViewDemand{ desiredDeviceWidth: number; visibleRect?: Rect; velocity?:{ dx: number; dy: number} ; } PageViewEnv [InterfaceDeclaration] (from packages/framework/web/src/anchored-position.ts): export interface PageViewEnv{ scale: number; rotation: 0 | 90 | 180 | 270; zoom: number; } PageViewProps [InterfaceDeclaration] (from packages/framework/react/src/page-view.tsx): export interface PageViewProps{ page: PageRef | number; documentId?: string; fallback?: React.ReactNode; width?: number; pageFrame?: Partial; children: React.ReactNode; pageChrome?: React.ReactNode; className?: string; style?: React.CSSProperties; } PaintFonts [TypeAliasDeclaration] (from packages/core/text/src/paint.ts): export type PaintFonts = TextFonts; PaintedPicture [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface PaintedPicture{ update(page: PicturePage): void; destroy(): void; } PaneCreatedEvent [InterfaceDeclaration] (from packages/plugin/view-manager/src/contract.ts): export interface PaneCreatedEvent{ readonly paneId: PaneId; } PaneDeletedEvent [InterfaceDeclaration] (from packages/plugin/view-manager/src/contract.ts): export interface PaneDeletedEvent{ readonly paneId: PaneId; } PaneFocusChangedEvent [InterfaceDeclaration] (from packages/plugin/view-manager/src/contract.ts): export interface PaneFocusChangedEvent{ readonly paneId: PaneId | null; } PaneId [TypeAliasDeclaration] (from packages/plugin/view-manager/src/contract.ts): export type PaneId = string; PaneInfo [InterfaceDeclaration] (from packages/plugin/view-manager/src/contract.ts): export interface PaneInfo{ readonly id: PaneId; readonly documentIds: readonly string[]; readonly activeDocumentId: string | null; } PdfActionNode [TypeAliasDeclaration] (from packages/engine/core/src/dto/PdfAction.ts): export type PdfActionNode = PdfActionNodeCommon & ( |{ type: 'javascript'; script: string} |{ type: 'goto'; destination: Destination} |{ type: 'uri'; uri: string; isMap: boolean} |{ type: 'named'; name: string} |{ type: 'hide'; targets: PdfActionTargetRef[]; hide: boolean} |{ type: 'reset-form'; fields: PdfActionTargetRef[] | null; exclude: boolean; } |{ type: 'goto-remote'; filePath: string} |{ type: 'goto-embedded'; filePath: string} |{ type: 'launch'; filePath: string} |{ type: 'rendition'; script?: string} |{ type: 'submit-form'; payload?: SubmitFormPayload} |{ type: 'thread'} |{ type: 'sound'} |{ type: 'movie'} |{ type: 'import-data'} |{ type: 'set-ocg-state'} |{ type: 'transition'} |{ type: 'goto-3d-view'} |{ type: 'unknown'} ); PdfActionTree [InterfaceDeclaration] (from packages/engine/core/src/dto/PdfAction.ts): export interface PdfActionTree{ root: PdfActionNode | null; incomplete: boolean; warnings: PdfActionWarning[]; } PdfActionType [TypeAliasDeclaration] (from packages/engine/core/src/dto/PdfAction.ts): export type PdfActionType = PdfActionNode['type']; PdfAnnotationEventKind [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type PdfAnnotationEventKind = | 'cursorEnter' | 'cursorExit' | 'mouseDown' | 'mouseUp' | 'focus' | 'blur'; PdfDestination [TypeAliasDeclaration] (from packages/engine/core/src/dto/PdfDestination.ts): export type PdfDestination = |{ kind: 'xyz'; page: PageRef; left: number | null; top: number | null; zoom: number | null; } |{ kind: 'fit'; page: PageRef} |{ kind: 'fitH'; page: PageRef; top: number | null} |{ kind: 'fitV'; page: PageRef; left: number | null} |{ kind: 'fitR'; page: PageRef; left: number; bottom: number; right: number; top: number; } |{ kind: 'fitB'; page: PageRef} |{ kind: 'fitBH'; page: PageRef; top: number | null} |{ kind: 'fitBV'; page: PageRef; left: number | null} ; PdfFieldEventKind [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type PdfFieldEventKind = 'keystroke' | 'format' | 'validate' | 'calculate'; PdfLinkTarget [TypeAliasDeclaration] (from packages/engine/core/src/dto/PdfLinkTarget.ts): export type PdfLinkTarget = |{ kind: 'goto'; destination: Destination} |{ kind: 'uri'; uri: string} |{ kind: 'goto-remote'; file: string} |{ kind: 'launch'; path: string} |{ kind: 'javascript'} |{ kind: 'named'; name: string} |{ kind: 'unsupported'} ; PdfMeasure [InterfaceDeclaration] (from packages/engine/core/src/dto/Measure.ts): export interface PdfMeasure{ subtype: 'rectilinear'; ratio?: string; x: PdfNumberFormat[]; y?: PdfNumberFormat[]; distance: PdfNumberFormat[]; area: PdfNumberFormat[]; angle?: PdfNumberFormat[]; slope?: PdfNumberFormat[]; origin?: PdfPoint; cyx?: number; } PdfNamedAction [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type PdfNamedAction = | 'NextPage' | 'PrevPage' | 'FirstPage' | 'LastPage' | 'Print' | (string &{ } ); PdfRect [InterfaceDeclaration] (from packages/engine/core/src/geometry/primitives.ts): export interface PdfRect{ left: number; bottom: number; right: number; top: number; } PdfRotation [TypeAliasDeclaration] (from packages/engine/core/src/geometry/primitives.ts): export type PdfRotation = 0 | 90 | 180 | 270; PdfSaveMode [TypeAliasDeclaration] (from packages/engine/core/src/dto/PdfSaveMode.ts): export type PdfSaveMode = 'incremental' | 'rewrite'; PdfSize [InterfaceDeclaration] (from packages/engine/core/src/geometry/primitives.ts): export interface PdfSize{ width: number; height: number; } PendingChange [InterfaceDeclaration] (from packages/core/main/src/changes.ts): export interface PendingChange{ readonly opId: string; readonly label: ChangeLabel; readonly undoOf: string | null; readonly merge: string | null; readonly shows: readonly PredictedOp[]; readonly undo: readonly PredictedOp[]; readonly history: boolean; readonly held: boolean; readonly result: Promise; } PendingMeta [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface PendingMeta{ readonly id: string; readonly name?: string; readonly status: 'loading' | 'locked' | 'error'; readonly passwordProvided?: boolean; readonly error?: unknown; readonly openRequest?: GrantOpenRequest; } PendingPage [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type PendingPage = |{ readonly kind: 'blank'} |{ readonly kind: 'own'} |{ readonly kind: 'copy'; readonly of: PageRef} ; Permission [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type Permission = DocCapability | 'annotations:create' | PluginPermission; PermissionDenied [ClassDeclaration] (from packages/engine/core/src/auth/scope/errors.ts): export class PermissionDenied extends EngineError{ override readonly name: string = 'PermissionDenied'; constructor( public readonly required: string, public readonly context?: string, public readonly anyOf?: readonly string[], public readonly refs?: readonly AnnotationRef[], ){ super( EngineErrorCode.Forbidden, `permission denied${ context ? ` (${ context} )` : ''} : ${ anyOf ? `one of ${ anyOf.join(', ')} ` : required} ${ refs ? ` for ${ refs.length} annotation${ refs.length === 1 ? '' : 's'} ` : ''} `, { details:{ required, ...(context === undefined ?{ } :{ context} ), ...(anyOf === undefined ?{ } :{ anyOf: [...anyOf]} ), ...(refs === undefined ?{ } :{ refs: [...refs]} ), } , } , ); } } PersonalKeyStore [InterfaceDeclaration] (from packages/core/signature/src/signers/personal.ts): export interface PersonalKeyStore{ load(subject: string): Promise; save(subject: string, record: PersonalKeyRecord): Promise; remove(subject: string): Promise; } PersonalSigner [InterfaceDeclaration] (from packages/core/signature/src/signers/personal.ts): export interface PersonalSigner extends RawSigner{ readonly certificate: Uint8Array; readonly subject: string; } PicturePage [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface PicturePage{ readonly ref: PageRef; readonly pageIndex: number; readonly view: string; readonly transform: PageTransform; readonly getViewDemand?: () => PageViewDemand; } PicturePainter [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface PicturePainter{ paints(view: string): boolean; paint(host: Host, page: PicturePage, report: PictureReport): PaintedPicture; } PictureReport [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface PictureReport{ shown(): void; failed(error: unknown): void; } PictureState [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface PictureState{ readonly status: ResourceStatus; readonly slow: boolean; } PictureStateChangedEvent [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface PictureStateChangedEvent extends PictureState{ readonly page: PageRef; readonly view: string; } PlaceMarkResult [TypeAliasDeclaration] (from packages/plugin/signature/src/contract.ts): export type PlaceMarkResult = |{ status: 'signed'; field: FormFieldRef; result: SignFieldResult} |{ status: 'filled'; field: FormFieldRef} |{ status: 'requested'; field: FormFieldRef} |{ status: 'placed'; annotation: AnnotationRef} ; Placement [TypeAliasDeclaration] (from packages/core/annotation/src/types.ts): export type Placement = |{ kind: 'box'; rect: Rect; rot: number} |{ kind: 'segment'; a: Point; b: Point} ; PlatformFeedback [InterfaceDeclaration] (from packages/plugin/interaction/src/feedback.types.ts): export interface PlatformFeedback{ selection(): void; impact(weight?: 'light' | 'medium' | 'heavy'): void; notify(kind: 'success' | 'warning' | 'error'): void; } PluginClock [InterfaceDeclaration] (from packages/core/main/src/clock.ts): export interface PluginClock{ after(ms: number, run: () => void): Cancel; nextFrame(run: (timeMs: number) => void): Cancel; readonly hasFrames: boolean; } PluginContext [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface PluginContext{ readonly id: string; readonly instanceId: string; readonly documentId?: string; readonly engine: Engine; readonly doc: DocumentHandle; documentHandle(documentId?: string): DocumentHandle | null; document(): DocumentMeta | null; getPage(page: PageRef | number): PageInfo | null; pageOf(page: PageRef | number): PageInfo; assertPageRef(ref: PageRef): void; allows(permission: Permission): boolean; assertAllowed(permission: Permission, operation: string): void; allowsField(action: 'fill' | 'sign', field:{ readonly groupId: string | null} ): boolean; assertAllowedField( action: 'fill' | 'sign', field:{ readonly groupId: string | null} , operation: string, ): void; get(token: CapabilityToken): T; tryGet(token: CapabilityToken): T | null; forDocument(token: CapabilityToken, documentId: string): T; tryForDocument(token: CapabilityToken, documentId: string): T | null; readonly state: StateCell; readonly settings: () => Settings; notify(): void; storeChangeCount(): number; watch( select: () => R, handler: (value: R, previous: R) => void, isEqual?: (left: R, right: R) => boolean, ): Unsubscribe; waitFor(predicate: () => boolean, options?: OperationOptions): Promise; mirror(spec: MirrorSpec): Mirror; pageMirror(spec: PageMirrorSpec): PageMirror; readonly changes: ChangeQueue; readonly events:{ source():{ readonly on: EventHook; emit(event: T): void; destroy(): void} ; } ; listen(source: Subscribable, listener: (event: T) => void): void; cleanup(fn: () => void | Promise): void; readonly clock: PluginClock; readonly measurer: HostTextMeasurer | null; onSettle(flush: (signal: AbortSignal) => Promise | void): void; aroundDownload(wrap: (read: () => Promise) => Promise): void; aroundPrint(wrap: (print: () => Promise) => Promise): void; acquire( get: (lifetime: AbortSignal) => Promise, release: (resource: R) => void | Promise, ): Promise; cancellable(signal: AbortSignal | undefined, task: Promise): Promise; latest(key: string): import('./lanes').LatestLane; serialQueue(key?: string): SerialQueue; } PluginDefinition [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface PluginDefinition< State = unknown, Capability = unknown, PluginSettings extends object = NoSettings, >{ readonly id: string; readonly token?: CapabilityToken; readonly scope?: PluginScope; readonly requires?: ReadonlyArray>; readonly optional?: ReadonlyArray>; readonly resolvesAnyCapability?: true; readonly state?: () => State; readonly settings?: SettingsDeclaration; readonly create: NoInfer< (ctx: PluginContext) =>{ api: Capability; connect?: () => void} >; readonly inScope?: NoInfer<(api: Capability, documentId: string) => Capability>; } PluginError [ClassDeclaration] (from packages/core/main/src/errors.ts): export class PluginError extends Error{ override readonly name = 'PluginError'; readonly code: PluginErrorCode; readonly capability: string; readonly permission: string | null; readonly details: unknown; constructor( code: PluginErrorCode, capability: string, message: string, options:{ cause?: unknown; details?: unknown; permission?: string | null} ={ } , ){ super(message); if (options.cause !== undefined) (this as{ cause?: unknown} ).cause = options.cause; this.code = code; this.capability = capability; this.permission = options.permission ?? null; this.details = options.details; } } PluginErrorCode [TypeAliasDeclaration] (from packages/core/main/src/errors.ts): export type PluginErrorCode = | 'permission-denied' | 'unsupported' | 'not-found' | 'not-ready' | 'invalid-input' | 'conflict' | 'instance-closed' | 'operation-cancelled' | 'operation-failed'; PluginErrorInfo [InterfaceDeclaration] (from packages/core/main/src/errors.ts): export interface PluginErrorInfo{ readonly code: PluginErrorCode; readonly message: string; readonly capability: string; readonly permission: string | null; } PluginPermission [TypeAliasDeclaration] (from packages/engine/core/src/auth/scope/types.ts): export type PluginPermission = keyof PluginPermissions & string; PluginPermissions [InterfaceDeclaration] (from packages/engine/core/src/auth/scope/types.ts): export interface PluginPermissions{ } PluginScope [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type PluginScope = 'workspace' | 'document'; Point [InterfaceDeclaration] (from packages/core/geometry/src/index.ts): export interface Point{ x: number; y: number; } PointerKind [TypeAliasDeclaration] (from packages/plugin/interaction/src/contract.ts): export type PointerKind = 'mouse' | 'pen' | 'touch'; PredictedOp [TypeAliasDeclaration] (from packages/core/main/src/changes.ts): export type PredictedOp = | ChangeOp |{ readonly type: 'annotations.restore'; readonly annotation: Annotation; readonly index: number; } |{ readonly type: 'forms.restore'; readonly field: FormField; readonly widgets: readonly WidgetAnnotation[]; } |{ readonly type: 'forms.restoreWidget'; readonly widget: WidgetAnnotation; readonly field: FormField | null; } |{ readonly type: 'outline.restore'; readonly items: readonly OutlineItem[]; readonly index: number; } |{ readonly type: 'attachments.restore'; readonly attachment: Attachment; } |{ readonly type: 'pages.restore'; readonly pages: readonly RestoredPage[]; } |{ readonly type: 'pages.relabel'; readonly labels: readonly PageLabelSection[]; } ; PrepareSignatureInput [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface PrepareSignatureInput{ field: FormFieldRef; mark?: Mark; appearance?: BinarySource; signer?: SignatureSignerInput; certify?:{ permission: DocMdpPermission} ; lock?: FieldLockSpec; subFilter?: SignatureSubFilter; digest?: Exclude; timestampAuthority?: CmsSigner | null; } PreparedPrint [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface PreparedPrint{ readonly quality: PrintQuality; readonly pageCount: number; readonly needsTap: boolean; print(options?: OperationOptions): Promise; destroy(): void; } PrintDpi [TypeAliasDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export type PrintDpi = 150 | 300; PrintOptions [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface PrintOptions extends OperationOptions{ readonly pages?: readonly PageRef[]; readonly includeAnnotations?: boolean; readonly onProgress?: (progress: PrintProgress) => void; } PrintProgress [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface PrintProgress{ readonly pagesRendered: number; readonly pageCount: number; } PrintQuality [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type PrintQuality = |{ readonly kind: 'pdf'} |{ readonly kind: 'images'; readonly dpi: PrintDpi} ; PrintSheet [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface PrintSheet{ readonly image: Blob; readonly widthPt: number; readonly heightPt: number; } ProjectorBinding [InterfaceDeclaration] (from packages/framework/react/src/anchored.tsx): export interface ProjectorBinding{ projector: ViewProjector; revision: unknown; subscribe?: (callback: () => void) => () => void; } ProjectorProvider [VariableDeclaration] (from packages/framework/react/src/anchored.tsx): ProjectorProvider = ProjectorContext.Provider PromiseMemberOf [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type PromiseMemberOf = | PromiseMethodOf |{ [Key in keyof Capability & string]-?: Capability[Key] extends (...args: never[]) => unknown ? never : Capability[Key] extends object ? `${ Key} .${ PromiseMethodOf} ` : never; } [keyof Capability & string]; PromiseMembers [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type PromiseMembers ={ readonly [Path in PromiseMemberOf]: true} ; PromptSourceSpec [InterfaceDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export interface PromptSourceSpec{ kind: 'prompt'; accept?: string; } REDACTION_DEFAULTS [VariableDeclaration] (from packages/plugin/redaction/src/contract.ts): REDACTION_DEFAULTS: RedactionSettings ={ overlay:{ fill: '#000000', text:{ color: '#ffffff', fontFamily: 'helvetica', fontSize: 0} , } , } RENDER_DEFAULTS [VariableDeclaration] (from packages/plugin/render/src/contract.ts): RENDER_DEFAULTS: RenderSettings ={ fullPage:{ maxWidth: 640, quantize: 'exact'} , tiles:{ size: 512, quantize: 'exact', maxScale: 128, bleedPx: 1, prefetch:{ margin: 0.5, velocityBias: true} , settleMs: 150, } , format: null, quality: null, slowAfterMs: 400, debug: false, snapshot:{ scale: 2, box:{ fill: null, stroke: null} } , } RecalibrationReport [InterfaceDeclaration] (from packages/plugin/annotation/src/host-contract.ts): export interface RecalibrationReport{ page: PageRef; scale: PdfMeasure; error?: SerializedEngineError; updated: AnnotationRef[]; skipped:{ ref: AnnotationRef; reason: 'no-authority' | 'locked' | 'foreign-measure' | 'unavailable'; } []; failed:{ ref: AnnotationRef; error: SerializedEngineError} []; } RedactionAppliedEvent [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionAppliedEvent{ readonly result: RedactionApplyResult; readonly origin: EventOrigin; } RedactionApplyResult [InterfaceDeclaration] (from packages/engine/core/src/mutation/RedactionApplyResult.ts): export interface RedactionApplyResult{ scope: RedactionApplyScope; results: RedactionApplyItemResult[]; removedAnnotationCount: number; meta: MutationMeta; } RedactionCapability [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionCapability extends SettingsApi{ canMark(): boolean; canUnmark(ref: AnnotationRef): boolean; canUpdateLabel(ref: AnnotationRef): boolean; canApply(): boolean; isApplying(): boolean; getLastResult(): RedactionApplyResult | null; listPending(filter?: RedactionMarkFilter): readonly RedactionMark[]; getPending(ref: AnnotationRef): RedactionMark | null; getPendingCount(page?: PageRef | number): number; estimateCollateral(refs?: readonly AnnotationRef[]): RedactionCollateral; markSelection(options?: OperationOptions): Promise<{ marks: readonly RedactionMark[]} >; markArea( page: PageRef | number, bounds: Rect, options?: OperationOptions, ): Promise<{ mark: RedactionMark} >; markPage(page: PageRef | number, options?: OperationOptions): Promise<{ mark: RedactionMark} >; markMatches( query: SearchQuery, options?:{ pages?: readonly (PageRef | number)[]} & OperationOptions, ): Promise<{ marks: readonly RedactionMark[]} >; unmark( refs: readonly AnnotationRef[], options?: OperationOptions, ): Promise>; clearPending(options?: OperationOptions): Promise>; updateLabel( ref: AnnotationRef, patch: RedactionLabelPatch, options?: OperationOptions, ): Promise<{ mark: RedactionMark} >; apply(refs: readonly AnnotationRef[], options?: OperationOptions): Promise; applyAll(options?: OperationOptions): Promise; applyPages( pages: readonly (PageRef | number)[], options?: OperationOptions, ): Promise; readonly onApplied: EventHook; readonly onPendingChanged: EventHook; } RedactionCollateral [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionCollateral{ readonly count: number; readonly refs: readonly AnnotationRef[]; } RedactionConfig [TypeAliasDeclaration] (from packages/plugin/redaction/src/contract.ts): export type RedactionConfig = DeepPartial; RedactionLabelPatch [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionLabelPatch{ overlayText?: string | null; repeat?: boolean; } RedactionMark [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionMark{ readonly ref: AnnotationRef; readonly page: PageRef; readonly pageIndex: number; readonly kind: 'area' | 'text'; readonly bounds: Rect; readonly overlayText: string | null; readonly repeat: boolean; } RedactionMarkFilter [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionMarkFilter{ readonly page?: PageRef | number; } RedactionPendingChangedEvent [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionPendingChangedEvent{ readonly pages: readonly PageRef[]; } RedactionSettings [InterfaceDeclaration] (from packages/plugin/redaction/src/contract.ts): export interface RedactionSettings{ readonly overlay:{ readonly fill: string; readonly text:{ readonly color: string; readonly fontFamily: FontName; readonly fontSize: number; } ; } ; } RedactionState [InterfaceDeclaration] (from packages/plugin/redaction/src/state.ts): export interface RedactionState{ readonly pendingCount: number; readonly applying: boolean; readonly lastResult: RedactionApplyResult | null; } RedactionToken [VariableDeclaration] (from packages/plugin/redaction/src/token.ts): RedactionToken = createCapabilityToken('redaction', { hint: `add redactionPlugin() from '@embedpdf/plugin-redaction' to your plugins list`, promises:{ markSelection: true, markArea: true, markPage: true, markMatches: true, unmark: true, clearPending: true, updateLabel: true, apply: true, applyAll: true, applyPages: true, } , } ) RegisterCommandOptions [InterfaceDeclaration] (from packages/plugin/commands/src/contract.ts): export interface RegisterCommandOptions{ replace?: boolean; } RegisterToolOptions [InterfaceDeclaration] (from packages/plugin/interaction/src/contract.ts): export interface RegisterToolOptions{ readonly replace?: boolean; } RenderCapability [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface RenderCapability extends SettingsApi{ canRender(): boolean; canRenderThumbnail(): boolean; renderPage(page: PageRef | number, options?: RenderPageOptions): Promise; renderThumbnail(page: PageRef | number, options?: RenderThumbnailOptions): Promise; renderPages( pages: readonly (PageRef | number)[], options?: RenderPagesOptions, ): Promise>; getRenderPolicy(): EngineRenderPolicy; getRenderEpoch(page: PageRef | number, layers?: PageLayerOptions): number; invalidate(options?: InvalidateOptions): void; readonly onInvalidated: EventHook; getPictureState(page: PageRef | number, view: string): PictureState; readonly onPictureStateChanged: EventHook; handOverPictures(painter: PicturePainter): () => void; getPicturePainter(): PicturePainter | null; canSnapshot(): boolean; getSnapshot(): Snapshot | null; clearSnapshot(): void; readonly onSnapshotChanged: EventHook; } RenderConfig [TypeAliasDeclaration] (from packages/plugin/render/src/contract.ts): export type RenderConfig = DeepPartial; RenderFormat [TypeAliasDeclaration] (from packages/plugin/render/src/contract.ts): export type RenderFormat = NonNullable; RenderInvalidatedEvent [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface RenderInvalidatedEvent{ readonly pages: readonly PageRef[]; readonly scope: InvalidateScope; readonly origin: EventOrigin | null; } RenderItem [InterfaceDeclaration] (from packages/core/annotation/src/types.ts): export interface RenderItem{ id: Id; ref: AnnotationRef | null; annotation?: Annotation; subtype: KindName; geometry: Shape; box: Rect; apBox?: Rect; apRot?: number; style: Style; text?: TextStyle; source: 'baked' | 'vector' | 'draft' | 'ghost'; pictureVersion?: number; lentScene?: () => readonly SceneNode[]; ghostOpacity?: number; selected: boolean; hovered?: boolean; label?:{ text: string; repeat: boolean; fonts?: PaintFonts} ; frame:{ box: Rect; rotation: number; scale: number} ; raster:{ box: Rect; rotation: number} | null; icon?: NoteIcon | FileAttachmentIcon; measure?: MeasurementAppearance; rot?: number; blend?: Exclude; } RenderLayer [FunctionDeclaration] (from packages/framework/react/src/render.tsx): export function RenderLayer(props: RenderLayerProps ={ } ){ const page = usePage(); const painter = useSelector(RenderToken, (render) => render.getPicturePainter()); if (painter?.paints(page.view)){ return } />; } return ; } RenderLayerProps [InterfaceDeclaration] (from packages/framework/react/src/render.tsx): export interface RenderLayerProps{ annotations?: boolean; formFields?: boolean; tiles?: boolean; thumbnail?: boolean; } RenderPageOptions [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface RenderPageOptions extends OperationOptions, PageLayerOptions{ width?: number; scale?: number; rect?: Rect; rotation?: Rotation; format?: RenderFormat; quality?: number; } RenderPagesOptions [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface RenderPagesOptions extends Omit{ concurrency?: number; } RenderSettings [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface RenderSettings{ readonly fullPage: FullPageSettings; readonly tiles: TilesSettings | false; readonly format: RenderFormat | null; readonly quality: number | null; readonly slowAfterMs: number; readonly debug: boolean; readonly snapshot: SnapshotSettings; } RenderThumbnailOptions [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface RenderThumbnailOptions extends OperationOptions, PageLayerOptions{ format?: RenderFormat; quality?: number; } RenderToken [VariableDeclaration] (from packages/plugin/render/src/token.ts): RenderToken = createCapabilityToken('render', { hint: `add renderPlugin() from '@embedpdf/plugin-render' to your plugins list`, promises:{ renderPage: true, renderThumbnail: true, renderPages: true, } , } ) ResolvedCommand [InterfaceDeclaration] (from packages/plugin/commands/src/contract.ts): export interface ResolvedCommand{ readonly id: string; readonly label: string; readonly icon?: string; readonly iconAccent?: IconAccent; readonly shortcuts: readonly string[]; readonly menu?: string; readonly enabled: boolean; readonly active: boolean; readonly pressable: boolean; readonly visible: boolean; readonly categories: readonly string[]; readonly disabledReason?: string; } ResolvedGhost [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type ResolvedGhost = false |{ opacity: number} ; ResolvedTool [InterfaceDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export interface ResolvedTool{ id: string; subtype: KindName; preset: string; fieldsKind: string; cursor: string; enables: ReadonlySet; defaults?: FieldValues; flags?: Partial; source?: StampSourceSpec; selection?: SelectionAuthoring; ink?: InkAuthoringOptions; upright: boolean; clickCreate: ClickCreate | false; ghost: ResolvedGhost; afterCreate?: Partial; capture: boolean; meta?: Record; } ResourceStatus [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type ResourceStatus = 'idle' | 'loading' | 'ready' | 'forbidden' | 'error'; ResponsiveRule [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface ResponsiveRule{ readonly name?: string; readonly when: BoxQuery | ((box: StageBox) => boolean); readonly settings?: StageSettingsPatch; } RestoredPage [InterfaceDeclaration] (from packages/engine/core/src/pages/predict.ts): export interface RestoredPage{ readonly page: PageLayout; readonly after: PageRef | null; } RetryOptions [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface RetryOptions extends OperationOptions{ readonly passphrase?: string; readonly visitorIdentity?: VisitorAnswers; } RevealAlignment [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface RevealAlignment{ readonly x?: ArrivalAlignValue; readonly y?: ArrivalAlignValue; } RevealOptions [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface RevealOptions{ behavior?: ScrollBehaviorKind; rect?: Rect; zoom?: RevealZoom; align?: RevealAlignment; } RevealZoom [TypeAliasDeclaration] (from packages/plugin/stage/src/contract.ts): export type RevealZoom = 'keep' | 'fit' | 'fit-width' | 'fit-height' |{ level: number} ; ReviewStatus [InterfaceDeclaration] (from packages/engine/core/src/annotation/comments.ts): export interface ReviewStatus{ state: string; stateModel: string; by: string | null; at: IsoDateTime | null; ref: AnnotationRef; } RevocationSource [InterfaceDeclaration] (from packages/core/signature/src/revocation/source.ts): export interface RevocationSource{ fetch(request: RevocationRequest): Promise; } RevocationVerdict [TypeAliasDeclaration] (from packages/core/signature/src/long-term.ts): export type RevocationVerdict = 'good' | 'revoked' | 'unknown'; RichTextEditor [InterfaceDeclaration] (from packages/framework/react/src/annotation.tsx): export interface RichTextEditor{ ref: (element: HTMLElement | null) => void; style: React.CSSProperties; editing: boolean; } RotationHandleProps [InterfaceDeclaration] (from packages/framework/react/src/annotation.tsx): export interface RotationHandleProps extends Omit{ from: Point; } SEARCH_DEFAULTS [VariableDeclaration] (from packages/plugin/search/src/contract.ts): SEARCH_DEFAULTS: SearchSettings ={ reveal:{ align:{ y: 0.35} , behavior: 'smooth'} , highlight:{ color: '#ffd500', activeColor: '#ff9632', blendMode: 'multiply'} , } SELECTION_DEFAULTS [VariableDeclaration] (from packages/plugin/selection/src/contract.ts): SELECTION_DEFAULTS: SelectionSettings ={ dragThresholdPx: 4, color: null, handles:{ color: null, shadow: '0 1px 4px rgb(0 0 0 / 0.35)'} , } SIGNATURES_LIBRARY_KIND [VariableDeclaration] (from packages/plugin/signature/src/contract.ts): SIGNATURES_LIBRARY_KIND = 'signatures' SIGNATURE_DEFAULTS [VariableDeclaration] (from packages/plugin/signature/src/contract.ts): SIGNATURE_DEFAULTS: SignatureSettings ={ signingKey: null, mode: null, timestampAuthority: null, revocation: null, documentTimestamp: false, trust: null, allowCertify: false, } SIGNATURE_MARK_NAME [VariableDeclaration] (from packages/plugin/signature/src/contract.ts): SIGNATURE_MARK_NAME = 'signature' SNAPSHOT_MAX_PIXELS [VariableDeclaration] (from packages/plugin/render/src/contract.ts): SNAPSHOT_MAX_PIXELS = 16_000_000 SNAPSHOT_TOOL [VariableDeclaration] (from packages/plugin/render/src/contract.ts): SNAPSHOT_TOOL = 'snapshot' STAMP_DEFAULTS [VariableDeclaration] (from packages/plugin/stamp/src/contract.ts): STAMP_DEFAULTS: StampSettings ={ assetEngine: null, fonts: [], previewWidth: 256, dynamic: true, } ScaleChangeOptions [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface ScaleChangeOptions extends OperationOptions{ recalculate?: boolean; } ScaleChangeReport [TypeAliasDeclaration] (from packages/plugin/measurement/src/contract.ts): export type ScaleChangeReport = | (RecalibrationReport &{ scaleError?: never} ) |{ page: PageRef; scale?: never; error?: never; updated: []; skipped: []; failed: []; scaleError: SerializedEngineError; } ; ScalePreset [InterfaceDeclaration] (from packages/plugin/measurement/src/contract.ts): export interface ScalePreset{ readonly id: string; readonly label: string; readonly paper: number; readonly real: number; readonly unit: LengthUnit; } ScriptDiagnosticReportedEvent [TypeAliasDeclaration] (from packages/plugin/actions/src/contract.ts): export type ScriptDiagnosticReportedEvent = Readonly; ScriptFailedEvent [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface ScriptFailedEvent{ readonly error: ScriptExecutionError; readonly source: ActionSource | null; } ScrollBehaviorKind [TypeAliasDeclaration] (from packages/plugin/stage/src/contract.ts): export type ScrollBehaviorKind = 'smooth' | 'instant'; ScrollHandlerOptions [InterfaceDeclaration] (from packages/plugin/stage/src/scroll-handler.ts): export interface ScrollHandlerOptions{ panFallback?: boolean; } ScrollMetrics [InterfaceDeclaration] (from packages/core/stage/src/index.ts): export interface ScrollMetrics{ scrollLeft: number; scrollTop: number; scrollWidth: number; scrollHeight: number; clientWidth: number; clientHeight: number; scrollableX: boolean; scrollableY: boolean; } Scrollbar [FunctionDeclaration] (from packages/framework/react/src/scrollbar.tsx): export function Scrollbar({ axis, token: explicitToken, autoHide = 1200, minThumbSize = 24, trackPress = 'page', className, style, thumbClassName, thumbStyle, } : ScrollbarProps){ const token = useStageToken(explicitToken); const stage = useCapability(asHost(token)); const metrics = useScrollMetrics(token); const vertical = axis === 'y'; const scrollable = vertical ? metrics.scrollableY : metrics.scrollableX; const trackRef = useRef(null); const [trackPx, setTrackPx] = useState(0); const [dragging, setDragging] = useState(false); const [hovered, setHovered] = useState(false); const [active, setActive] = useState(true); const layout = scrollbarLayout(metrics, vertical, trackPx, minThumbSize); const hideAfter = autoHide === false ? 0 : autoHide; useEffect(() =>{ if (!hideAfter) return; setActive(true); const timer = setTimeout(() => setActive(false), hideAfter); return () => clearTimeout(timer); } , [metrics, hideAfter]); const shown = !hideAfter || active || hovered || dragging; useEffect(() =>{ const element = trackRef.current; if (!element) return; const measure = () => setTrackPx(vertical ? element.clientHeight : element.clientWidth); const ro = new ResizeObserver(measure); ro.observe(element); measure(); return () => ro.disconnect(); } , [vertical, scrollable]); const presses = useMemo(() => createScrollbarPresses(setDragging), []); const track = (): ScrollbarTrack => ({ stage, vertical, element: trackRef.current!, layout, liveLayout: () => scrollbarLayout(stage.getScrollMetrics(), vertical, trackPx, minThumbSize), } ); useEffect(() => () => presses.release(), [presses]); if (!scrollable) return null; const trackDefaults: React.CSSProperties = vertical ?{ position: 'absolute', top: 0, right: 0, bottom: 0, width: 12} :{ position: 'absolute', left: 0, right: 0, bottom: 0, height: 12} ; const thumbDefaults: React.CSSProperties = vertical ?{ position: 'absolute', left: 2, right: 2, top: layout.thumbPosition, height: layout.thumbLength, } :{ position: 'absolute', top: 2, bottom: 2, left: layout.thumbPosition, width: layout.thumbLength, } ; return (
presses.pressTrack(event, track(), trackPress)} onPointerMove={ (event) => presses.move(event, track())} onPointerUp={ () => presses.release()} onPointerCancel={ () => presses.release()} onPointerEnter={ () => setHovered(true)} onPointerLeave={ () => setHovered(false)} >
presses.pressThumb(event, track())} />
); } ScrollbarAxis [TypeAliasDeclaration] (from packages/framework/react/src/scrollbar.tsx): export type ScrollbarAxis = 'x' | 'y'; ScrollbarProps [InterfaceDeclaration] (from packages/framework/react/src/scrollbar.tsx): export interface ScrollbarProps{ axis: ScrollbarAxis; token?: CapabilityToken; autoHide?: number | false; minThumbSize?: number; trackPress?: 'page' | 'jump'; className?: string; style?: React.CSSProperties; thumbClassName?: string; thumbStyle?: React.CSSProperties; } SearchActiveHitChangedEvent [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchActiveHitChangedEvent{ readonly index: number; readonly hit: SearchHit | null; } SearchCancelledEvent [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchCancelledEvent{ readonly reason: 'superseded' | 'cancelled' | 'cleared'; } SearchCapability [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchCapability extends SettingsApi{ canSearch(options?:{ readonly snippets?: boolean} ): boolean; search(query: SearchQuery, options?: SearchOptions): Promise; refresh(options?: OperationOptions): Promise; cancel(): void; clear(): void; nextHit(options?: SearchRevealOptions): SearchHit | null; previousHit(options?: SearchRevealOptions): SearchHit | null; goToHit(hit: SearchHit | number, options?: SearchRevealOptions): SearchHit | null; revealActiveHit(options?: SearchRevealOptions): void; getQuery(): SearchQuery | null; getStatus(): SearchStatus; listHits(filter?: SearchHitFilter): readonly SearchHit[]; getHitCount(page?: PageRef | number): number; listPagesWithHits(): readonly PageRef[]; getActiveHitIndex(): number; getActiveHit(): SearchHit | null; getProgress(): SearchProgress; getError(): PluginErrorInfo | null; findAll(query: SearchQuery, options?: SearchFindAllOptions): Promise; readonly onStarted: EventHook; readonly onProgressChanged: EventHook; readonly onCompleted: EventHook; readonly onCancelled: EventHook; readonly onFailed: EventHook; readonly onActiveHitChanged: EventHook; readonly onCleared: EventHook; } SearchClearedEvent [TypeAliasDeclaration] (from packages/plugin/search/src/contract.ts): export type SearchClearedEvent = Record; SearchCompletedEvent [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchCompletedEvent{ readonly hitCount: number; } SearchConfig [TypeAliasDeclaration] (from packages/plugin/search/src/contract.ts): export type SearchConfig = DeepPartial; SearchFailedEvent [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchFailedEvent{ readonly error: PluginErrorInfo; } SearchFindAllOptions [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchFindAllOptions extends OperationOptions{ readonly snippets?: boolean; } SearchHit [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchHit{ readonly page: PageRef; readonly pageIndex: number; readonly start: number; readonly count: number; readonly segments: readonly TextSegment[]; readonly bounds?: Rect; readonly snippet?: SearchSnippet; } SearchHitFilter [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchHitFilter{ readonly page?: PageRef | number; } SearchLayer [FunctionDeclaration] (from packages/framework/react/src/search.tsx): export function SearchLayer({ onHitClick} : SearchLayerProps){ const page = usePage(); const hits = useSearchHits(page.ref); const active = useSearchState((state) => state.activeHit); const highlight = useSearchSettings((settings) => settings.highlight); const [clicks] = useState(createClickDetector); if (hits.length === 0) return null; const color = paint('search-highlight', highlight.color); const activeColor = paint('search-highlight-active', highlight.activeColor); const blendMode = paint( 'search-blend-mode', highlight.blendMode, ) as React.CSSProperties['mixBlendMode']; const clickable = onHitClick ?{ pointerEvents: 'auto' as const, cursor: 'pointer'} : null; const pointerHandlers = (hit: SearchHit) => onHitClick &&{ onPointerDown: (event: React.PointerEvent) => clicks.press(event), onClick: (event: React.MouseEvent) =>{ if (clicks.isClick(event)) onHitClick(hit); } , } ; const pieces = searchHighlightsOf(hits, { active, page: page.transform, color, activeColor, } ); return (
{ pieces.map((piece) => piece.box ? (
) : ( { } ), )}
); } SearchLayerProps [InterfaceDeclaration] (from packages/framework/react/src/search.tsx): export interface SearchLayerProps{ onHitClick?: (hit: SearchHit) => void; } SearchOptions [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchOptions extends OperationOptions{ readonly from?: PageRef | number; } SearchProgress [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchProgress{ readonly pagesSearched: number; readonly pageCount: number; } SearchProgressChangedEvent [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchProgressChangedEvent extends SearchProgress{ readonly hitCount: number; } SearchQuery [InterfaceDeclaration] (from packages/engine/core/src/search/types.ts): export interface SearchQuery{ text: string; regex?: boolean; matchCase?: boolean; wholeWord?: boolean; matchDiacritics?: boolean; ignoreWhitespace?: boolean; } SearchQueryIssue [TypeAliasDeclaration] (from packages/engine/core/src/search/regex.ts): export type SearchQueryIssue = | SearchRegexIssue | 'diacritics-with-regex' | 'ignore-whitespace-with-regex'; SearchQueryValidation [TypeAliasDeclaration] (from packages/engine/core/src/search/regex.ts): export type SearchQueryValidation = |{ ok: true} |{ ok: false; issue: SearchQueryIssue; message: string} ; SearchRegexValidation [TypeAliasDeclaration] (from packages/engine/core/src/search/regex.ts): export type SearchRegexValidation = |{ ok: true} |{ ok: false; issue: SearchRegexIssue; message: string} ; SearchResult [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchResult{ readonly status: 'complete' | 'superseded' | 'cancelled'; readonly hitCount: number; } SearchReveal [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchReveal{ readonly align: RevealAlignment; readonly behavior: ScrollBehaviorKind; } SearchRevealOptions [TypeAliasDeclaration] (from packages/plugin/search/src/contract.ts): export type SearchRevealOptions = Partial; SearchSettings [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchSettings{ readonly reveal: SearchReveal; readonly highlight:{ readonly color: string; readonly activeColor: string; readonly blendMode: BlendMode; } ; } SearchSnippet [InterfaceDeclaration] (from packages/engine/core/src/search/types.ts): export interface SearchSnippet{ before: string; match: string; after: string; } SearchStartedEvent [InterfaceDeclaration] (from packages/plugin/search/src/contract.ts): export interface SearchStartedEvent{ readonly query: SearchQuery; } SearchState [InterfaceDeclaration] (from packages/plugin/search/src/state.ts): export interface SearchState{ readonly query: SearchQuery | null; readonly status: SearchStatus; readonly hitCount: number; readonly activeHitIndex: number; readonly activeHit: SearchHit | null; readonly progress: SearchProgress; readonly error: PluginErrorInfo | null; } SearchStatus [TypeAliasDeclaration] (from packages/plugin/search/src/contract.ts): export type SearchStatus = 'idle' | 'searching' | 'complete' | 'cancelled' | 'error'; SearchToken [VariableDeclaration] (from packages/plugin/search/src/token.ts): SearchToken = createCapabilityToken('search', { hint: "add searchPlugin() from '@embedpdf/plugin-search' to your plugins list", promises:{ search: true, refresh: true, findAll: true, } , } ) SelectionAnchor [InterfaceDeclaration] (from packages/plugin/selection/src/contract.ts): export interface SelectionAnchor{ readonly page: PageRef; readonly bounds: Rect; } SelectionAuthoring [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type SelectionAuthoring = |{ kind: 'markup'} |{ kind: 'text-edit'; operation: 'insert' | 'replace'} ; SelectionCapability [InterfaceDeclaration] (from packages/plugin/selection/src/contract.ts): export interface SelectionCapability extends SettingsApi{ canSelect(): boolean; canCopy(): boolean; select(range: SelectionRangeInput): void; selectAll(): void; selectPage(page: PageRef | number): void; selectWordAt(page: PageRef | number, point: Point): boolean; selectLineAt(page: PageRef | number, point: Point): boolean; extendTo(page: PageRef | number, point: Point): void; clear(): void; hasSelection(): boolean; isSelecting(): boolean; getSnapshot(): SelectionSnapshot; getRange(): TextRange | null; listSelectedPages(): readonly PageRef[]; listSegments(page: PageRef | number): readonly SelectionSegment[]; listRects(page: PageRef | number): readonly Rect[]; getAnchor(): SelectionAnchor | null; readText(options?: OperationOptions): Promise; readTextInRange(range: TextRange, options?: OperationOptions): Promise; readonly onChanged: EventHook; readonly onCommitted: EventHook; readonly onCleared: EventHook; } SelectionChangedEvent [InterfaceDeclaration] (from packages/plugin/selection/src/contract.ts): export interface SelectionChangedEvent{ readonly range: TextRange | null; readonly pages: readonly PageRef[]; } SelectionClearedEvent [TypeAliasDeclaration] (from packages/plugin/selection/src/contract.ts): export type SelectionClearedEvent = Record; SelectionClipboard [FunctionDeclaration] (from packages/framework/react/src/selection.tsx): export function SelectionClipboard({ prefetch, onRefused, target} : SelectionClipboardProps ={ } ){ const selection = useOptionalCapability(SelectionToken); const refused = useRef(onRefused); refused.current = onRefused; useEffect(() =>{ const element = target ? target.current : undefined; if (!selection || element === null) return; return wireSelectionClipboard(selection, { ...(prefetch === undefined ?{ } :{ prefetch} ), ...(element ?{ target: element} :{ } ), onRefused: () => refused.current?.(), } ); } , [selection, prefetch, target]); return null; } SelectionClipboardProps [InterfaceDeclaration] (from packages/framework/react/src/selection.tsx): export interface SelectionClipboardProps extends Pick< SelectionClipboardOptions, 'prefetch' | 'onRefused' >{ target?: RefObject; } SelectionCommittedEvent [InterfaceDeclaration] (from packages/plugin/selection/src/contract.ts): export interface SelectionCommittedEvent{ readonly range: TextRange; } SelectionConfig [TypeAliasDeclaration] (from packages/plugin/selection/src/contract.ts): export type SelectionConfig = DeepPartial; SelectionEndpoint [InterfaceDeclaration] (from packages/plugin/selection/src/contract.ts): export interface SelectionEndpoint{ readonly page: PageRef; readonly glyphQuad: Quad; readonly advance: 1 | -1; readonly rect: Rect; } SelectionHandleDragSession [InterfaceDeclaration] (from packages/plugin/selection/src/handles.ts): export interface SelectionHandleDragSession{ move(overlay: Point): void; end(): void; } SelectionHandleEndpoint [InterfaceDeclaration] (from packages/plugin/selection/src/handles.ts): export interface SelectionHandleEndpoint{ page: PageRef; glyphQuad: Quad; advance: 1 | -1; } SelectionHandleEndpoints [InterfaceDeclaration] (from packages/plugin/selection/src/handles.ts): export interface SelectionHandleEndpoints{ start: SelectionHandleEndpoint; end: SelectionHandleEndpoint; } SelectionHandleGeometry [InterfaceDeclaration] (from packages/plugin/selection/src/handles.ts): export interface SelectionHandleGeometry{ bar:{ from: Point; to: Point} ; length: number; rotation: number; upright: boolean; head: Point; } SelectionHandleStage [InterfaceDeclaration] (from packages/plugin/selection/src/handles.ts): export interface SelectionHandleStage{ pageToViewport(page: PageRef, point: Point): Point | null; getPageAt(point: Point):{ ref: PageRef; point: Point} | null; viewportToPage(page: PageRef, point: Point): Point | null; } SelectionHandleTarget [InterfaceDeclaration] (from packages/plugin/selection/src/handles.ts): export interface SelectionHandleTarget{ beginGestureAt(page: PageRef, point: Point): boolean; extendTo(page: PageRef, point: Point): void; endGesture(): void; } SelectionHandleView [InterfaceDeclaration] (from packages/plugin/selection/src/handles.ts): export interface SelectionHandleView{ toOverlay(page: PageRef, point: Point): Point | null; pageAt(overlay: Point):{ ref: PageRef; point: Point} | null; pointOnPage(page: PageRef, overlay: Point): Point | null; } SelectionHandles [FunctionDeclaration] (from packages/framework/react/src/selection.tsx): export function SelectionHandles({ token: explicitToken} : SelectionHandlesProps ={ } ){ const token = useStageToken(explicitToken); const host = useCapability(SelectionHostToken); const stage = useOptionalCapability(token); const surface = useOptionalProjectorBinding(); if (!surface || surface.projector.space !== 'overlay'){ devWarn( 'selection-handles-outside-stage', ' renders nothing here: mount it in the overlay slot ' + '(a has no camera to project the handles through).', ); } const selecting = useSelectionState((state) => state.isSelecting); const visible = useSelector(SelectionHostToken, (selection) => selection.isHighlightVisible()); const handles = useSelectionSettings((settings) => settings.handles); const accent = useViewerSettings((settings) => settings.accent); const endpoints = useSelector( SelectionHostToken, (selection) => selectionHandleEndpointsOf(selection.getSnapshot()), sameSelectionEndpoints, ); useKernelValue(() => stage?.listVisiblePages() ?? null); const [dragging, setDragging] = useState<'start' | 'end' | null>(null); const armSource = useRef<{ stage: StageCapability; endpoints: SelectionHandleEndpoints} | null>( null, ); armSource.current = stage && endpoints ?{ stage, endpoints} : null; const bindHandle = useMemo(() =>{ const detach: Partial void>> ={ } ; const make = (role: 'start' | 'end') => (element: HTMLDivElement | null) =>{ detach[role]?.(); delete detach[role]; if (!element) return; detach[role] = attachSelectionHandle(element, { arm: () =>{ const src = armSource.current; if (!src) return null; const armed = armSelectionHandle( host, selectionHandleViewOf(src.stage), src.endpoints, role, ); if (!armed) return null; setDragging(role); return{ base: armed.base, session:{ move: armed.drag.move, end: () =>{ armed.drag.end(); setDragging(null); } , } , } ; } , } ); } ; return{ start: make('start'), end: make('end')} ; } , [host]); if (!stage || !endpoints || !visible) return null; if (selecting && !dragging) return null; const view = selectionHandleViewOf(stage); const color = paint('text-selection-handle', handles.color ?? accent); const shadow = paint('text-selection-handle-shadow', handles.shadow); const renderHandle = (role: 'start' | 'end') =>{ const geometry = selectionHandleGeometry(view, endpoints[role], role); if (!geometry) return null; const barTop = HANDLE_PAD + (role === 'start' ? HANDLE_HEAD : 0); const pivotX = HANDLE_PAD + HANDLE_BAR / 2; return (
{ }
{ }
); } ; return ( <>{ renderHandle('start')} { renderHandle('end')} ); } SelectionHandlesProps [InterfaceDeclaration] (from packages/framework/react/src/selection.tsx): export interface SelectionHandlesProps{ token?: CapabilityToken; } SelectionLayer [FunctionDeclaration] (from packages/framework/react/src/selection.tsx): export function SelectionLayer(){ const page = usePage(); const selection = useCapability(SelectionHostToken); const segments = useSelector( SelectionHostToken, (selection) => selection.listSegments(page.ref), shallowArray, ); const visible = useSelector(SelectionHostToken, (selection) => selection.isHighlightVisible()); const color = useSelectionSettings((settings) => settings.color); const accent = useViewerSettings((settings) => settings.accent); useEffect(() =>{ void selection.ensureLoaded(page.ref); } , [selection, page.ref]); if (!visible) return null; const fill = paint('text-selection', color ?? mixAccent('text-selection', accent)); return ( { segments.map((segment, i) => ( ))} ); } SelectionMenu [FunctionDeclaration] (from packages/framework/react/src/selection.tsx): export function SelectionMenu({ children, gap = 8, placement = 'top'} : SelectionMenuProps){ const selecting = useSelectionState((state) => state.isSelecting); const anchor = useSelector(SelectionToken, (selection) => selection.getAnchor(), samePageBounds); if (selecting || !anchor) return null; return ( { children} ); } SelectionMenuProps [InterfaceDeclaration] (from packages/framework/react/src/selection.tsx): export interface SelectionMenuProps{ children: React.ReactNode; gap?: number; placement?: AnchoredPlacement; } SelectionRangeInput [TypeAliasDeclaration] (from packages/plugin/selection/src/contract.ts): export type SelectionRangeInput = TextRange |{ page: PageRef; start: number; count: number} ; SelectionSegment [TypeAliasDeclaration] (from packages/plugin/selection/src/geometry.ts): export type SelectionSegment = PdfTextSegment; SelectionSettings [InterfaceDeclaration] (from packages/plugin/selection/src/contract.ts): export interface SelectionSettings{ readonly dragThresholdPx: number; readonly color: string | null; readonly handles:{ readonly color: string | null; readonly shadow: string; } ; } SelectionSnapshot [InterfaceDeclaration] (from packages/plugin/selection/src/contract.ts): export interface SelectionSnapshot{ readonly pages: readonly{ page: PageRef; segments: readonly SelectionSegment[]} []; readonly start: SelectionEndpoint | null; readonly end: SelectionEndpoint | null; readonly direction: 'forward' | 'backward'; readonly range: TextRange | null; } SelectionState [InterfaceDeclaration] (from packages/plugin/selection/src/state.ts): export interface SelectionState{ readonly hasSelection: boolean; readonly isSelecting: boolean; readonly range: TextRange | null; readonly pages: readonly PageRef[]; } SelectionToken [VariableDeclaration] (from packages/plugin/selection/src/token.ts): SelectionToken = createCapabilityToken('selection', { hint: `add selectionPlugin() from '@embedpdf/plugin-selection' to your plugins list`, promises:{ readText: true, readTextInRange: true, } , } ) SendChange [TypeAliasDeclaration] (from packages/core/main/src/changes.ts): export type SendChange = ( doc: DocumentHandle, write:{ readonly opId: string} , ) => PromiseLike; SerialQueue [InterfaceDeclaration] (from packages/core/main/src/serial-queue.ts): export interface SerialQueue{ (operation: () => Promise, options?: OperationOptions): Promise; idle(): Promise; } SettingLock [InterfaceDeclaration] (from packages/core/main/src/settings.ts): export interface SettingLock{ readonly by: string; readonly reasonKey?: string; } Settings [InterfaceDeclaration] (from packages/core/main/src/settings.ts): export interface Settings{ get(): T; readonly api: SettingsApi; } SettingsApi [InterfaceDeclaration] (from packages/core/main/src/settings.ts): export interface SettingsApi{ getSettings(): T; updateSettings(changes: DeepPartial): void; resetSettings(): void; readonly onSettingsChanged: EventHook>; } SettingsChangedEvent [InterfaceDeclaration] (from packages/core/main/src/settings.ts): export interface SettingsChangedEvent{ readonly settings: T; readonly changedKeys: readonly (keyof T)[]; } SettingsDeclaration [InterfaceDeclaration] (from packages/core/main/src/settings.ts): export interface SettingsDeclaration{ readonly defaults: T; readonly registered?: DeepPartial | undefined; readonly whole?: readonly SettingPath[]; } SettingsHook [TypeAliasDeclaration] (from packages/framework/react/src/state.ts): export type SettingsHook = ( select?: (settings: Settings) => Selected, ) => Selected; SettingsOf [TypeAliasDeclaration] (from packages/core/main/src/settings.ts): export type SettingsOf = Capability extends{ getSettings(): infer T} ? T : never; SettledChange [TypeAliasDeclaration] (from packages/core/main/src/changes.ts): export type SettledChange = |{ readonly change: PendingChange; readonly status: 'applied'; readonly result: ChangeResult} |{ readonly change: PendingChange; readonly status: 'refused'; readonly error: PluginError} ; ShellCapability [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface ShellCapability{ isOpen(id: string): boolean; getSurface(id: string): SurfaceState | null; listOpenSurfaces(): readonly SurfaceState[]; open(id: string, options?: OpenSurfaceOptions): void; close(id: string): void; toggle(id: string, options?: OpenSurfaceOptions): void; updateSurfaceProps(id: string, props: SurfaceProps): void; closeAll(): void; isMenuOpen(id: string): boolean; listOpenMenus(): readonly string[]; openMenu(id: string): void; closeMenu(id: string): void; toggleMenu(id: string): void; closeAllMenus(): void; getSnapshot(): ShellSnapshot; applySnapshot(snapshot: ShellSnapshot): void; readonly onSurfaceOpened: EventHook; readonly onSurfaceClosed: EventHook; readonly onMenuOpened: EventHook; readonly onMenuClosed: EventHook; } ShellSnapshot [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface ShellSnapshot{ readonly surfaces: Readonly>>; readonly openMenus: readonly string[]; } ShellState [InterfaceDeclaration] (from packages/plugin/shell/src/state.ts): export interface ShellState{ readonly openSurfaces: readonly SurfaceState[]; readonly openMenus: readonly string[]; } ShellToken [VariableDeclaration] (from packages/plugin/shell/src/token.ts): ShellToken = createCapabilityToken('shell', { hint: `add shellPlugin() from '@embedpdf/plugin-shell' to your plugins list`, } ) ShownPages [TypeAliasDeclaration] (from packages/framework/react/src/anchored.tsx): export type ShownPages = ReadonlySet; ShownPagesProvider [VariableDeclaration] (from packages/framework/react/src/anchored.tsx): ShownPagesProvider = ShownPagesContext.Provider SignFieldInput [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignFieldInput{ field: FormFieldRef; mark: Mark; signingKey?: SigningKey; timestampAuthority?: CmsSigner | null; signer?: SignatureSignerInput; appearance?: BinarySource; certify?:{ permission: DocMdpPermission} ; lock?: FieldLockSpec; } SignFieldResult [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignFieldResult extends SignatureCompleteResult{ readonly validationInfo: ValidationInfoAdded | null; readonly validationInfoError: PluginError | null; } Signature [InterfaceDeclaration] (from packages/engine/core/src/signature/types.ts): export interface Signature{ index: number; field: FormFieldRef; fieldName: string; widget: FormFieldWidget | null; signed: boolean; kind: SignatureKind; filter: string | null; subFilter: string | null; byteRange: [number, number, number, number] | null; contentsSizeBytes: number; coverage: SignatureCoverage | null; revisionIndex: number | null; signer: SignatureSigner; docMdp: DocMdpPermission | null; catalogCertification: boolean; fieldMdp: FieldLockSpec | null; lock: FieldLockSpec | null; seedValue: SignatureSeedValue | null; } SignatureCapability [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureCapability extends SettingsApi{ getSnapshot(): SignatureSnapshot | null; getStatus(): ResourceStatus; listSignatures(): readonly SignatureInfo[]; listUnsignedFields(): readonly FormFieldRef[]; getSignature(field: SignatureFieldAddress): SignatureInfo | null; listVerdicts(): readonly SignatureVerdict[] | null; getVerdict(field: SignatureFieldAddress): SignatureVerdict | null; getProtection(): DocumentProtection | null; getPending(): SignaturePending | null; isBusy(): boolean; getMode(): SignatureMode; getTarget(): FormFieldRef | null; sign(input: SignFieldInput, options?: OperationOptions): Promise; prepareSignature( input: PrepareSignatureInput, options?: OperationOptions, ): Promise; completeSignature( signingId: string, cms: Uint8Array, options?: OperationOptions, ): Promise; cancelPending(options?: OperationOptions): Promise; fillField(field: FormFieldRef, mark: Mark, options?: OperationOptions): Promise; clearField(field: FormFieldRef, options?: OperationOptions): Promise; placeMark( mark: Mark, target:{ field: FormFieldRef} | StampPlacement, options?: OperationOptions, ): Promise; setTarget(field: FormFieldRef | null): void; requestInspection(field: FormFieldRef): void; refresh(options?: OperationOptions): Promise; validate(options?: SignatureValidateOptions): Promise; validateField( field: SignatureFieldAddress, options?: SignatureValidateOptions, ): Promise; addValidationInfo( field?: SignatureFieldAddress, options?: OperationOptions, ): Promise; analyzeChanges(input: AnalyzeInput, options?: OperationOptions): Promise; readRevision( target: SignatureFieldAddress |{ revisionIndex: number} , options?: OperationOptions, ): Promise; canSign(field: FormFieldRef): boolean; canFill(field: FormFieldRef): boolean; canCertify(): boolean; canReadRevision(): boolean; canAddValidationInfo(): boolean; readonly onSigned: EventHook; readonly onFilled: EventHook; readonly onCleared: EventHook; readonly onValidated: EventHook; readonly onProtectionChanged: EventHook; readonly onInvalidationPredicted: EventHook; readonly onTargetChanged: EventHook; readonly onSignRequested: EventHook; readonly onInspectionRequested: EventHook; } SignatureClearedEvent [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureClearedEvent{ readonly field: FormFieldRef; } SignatureCompleteResult [InterfaceDeclaration] (from packages/engine/core/src/signature/types.ts): export interface SignatureCompleteResult{ status: 'completed' | 'already-completed'; signature: Signature; version: BaseVersionInfo; previous: DocumentVersionRef; protection: DocumentProtection; meta: MutationMeta; } SignatureConfig [TypeAliasDeclaration] (from packages/plugin/signature/src/contract.ts): export type SignatureConfig = Partial; SignatureFieldAddress [TypeAliasDeclaration] (from packages/plugin/signature/src/contract.ts): export type SignatureFieldAddress = FormFieldRef | AnnotationRef | FormWidget; SignatureFilledEvent [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureFilledEvent{ readonly field: FormFieldRef; } SignatureInfo [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureInfo extends Signature{ readonly verdict: SignatureVerdict | null; } SignatureInspectionRequestedEvent [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureInspectionRequestedEvent{ readonly field: FormFieldRef; } SignatureInvalidationPredictedEvent [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureInvalidationPredictedEvent{ readonly field: FormFieldRef; readonly detail: string; } SignatureMode [TypeAliasDeclaration] (from packages/plugin/signature/src/contract.ts): export type SignatureMode = 'sign' | 'visual' | 'ask'; SignaturePending [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignaturePending{ readonly signingId: string; readonly field: FormFieldRef; } SignaturePrepared [InterfaceDeclaration] (from packages/engine/core/src/signature/types.ts): export interface SignaturePrepared{ signingId: string; digest: Uint8Array; algorithm: Exclude; byteRange: [number, number, number, number]; contentsSizeBytes: number; subFilter: SignatureSubFilter | 'ETSI.RFC3161'; expectedVersion: DocumentVersionRef; expiresAt: string | null; field?: FormFieldRef; } SignatureProtectionChangedEvent [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureProtectionChangedEvent{ readonly protection: DocumentProtection; } SignatureSettings [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureSettings{ readonly signingKey: SigningKey | null; readonly mode: SignatureMode | null; readonly timestampAuthority: CmsSigner | null; readonly revocation: RevocationSource | null; readonly documentTimestamp: boolean; readonly trust: TrustPort | null; readonly allowCertify: boolean; } SignatureSignRequestedEvent [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureSignRequestedEvent{ readonly field: FormFieldRef; readonly mark: Mark; } SignatureSignedEvent [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureSignedEvent{ readonly field: FormFieldRef; readonly result: SignatureCompleteResult; readonly origin: EventOrigin; } SignatureSnapshot [InterfaceDeclaration] (from packages/engine/core/src/signature/types.ts): export interface SignatureSnapshot{ chainValid: boolean; revisions: PdfRevision[]; signatures: Signature[]; protection: DocumentProtection; } SignatureState [InterfaceDeclaration] (from packages/plugin/signature/src/state.ts): export interface SignatureState{ readonly signatures: readonly SignatureInfo[]; readonly protection: DocumentProtection | null; readonly target: FormFieldRef | null; readonly busy: boolean; readonly pending: SignaturePending | null; readonly status: ResourceStatus; } SignatureTargetChangedEvent [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureTargetChangedEvent{ readonly field: FormFieldRef | null; } SignatureToken [VariableDeclaration] (from packages/plugin/signature/src/token.ts): SignatureToken = createCapabilityToken('signature', { hint: `add signaturePlugin() from '@embedpdf/plugin-signature' to your plugins list`, promises:{ sign: true, prepareSignature: true, completeSignature: true, cancelPending: true, fillField: true, clearField: true, placeMark: true, refresh: true, validate: true, validateField: true, addValidationInfo: true, analyzeChanges: true, readRevision: true, } , } ) SignatureValidateOptions [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureValidateOptions extends OperationOptions{ readonly validationTime?: ValidationTime |{ readonly kind: 'earliest-timestamp'} ; readonly until?: 'persisted' | 'working-copy'; } SignatureValidatedEvent [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignatureValidatedEvent{ readonly verdicts: readonly SignatureVerdict[]; } SignatureVerdict [InterfaceDeclaration] (from packages/core/signature/src/verdict.ts): export interface SignatureVerdict{ signature: Signature; integrity: IntegrityVerdict; cryptography: CryptographyVerdict; trust: TrustStatus; trustReason?: string; validationTime: AppliedValidationTime; revocation: RevocationVerdict; revocationReason?: string; modifications:{ verdict: ModificationsVerdict; detail?: string; basis: 'persisted' | 'working-copy'; laterRevisions?: number; undone?: boolean; } ; summary: 'valid' | 'valid-untrusted' | 'invalid' | 'indeterminate'; cms: ParsedCms | null; timestamp: TimestampVerdict | null; longTerm: LongTermVerdict; } SignerPort [TypeAliasDeclaration] (from packages/core/signature/src/sign.ts): export type SignerPort = CmsSigner | RawSigner; SignerRow [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface SignerRow{ readonly libraryId: string; readonly name: string; readonly library: StampLibrary; readonly signatures: StampAsset[]; readonly initials: StampAsset | null; } SigningKey [TypeAliasDeclaration] (from packages/plugin/signature/src/contract.ts): export type SigningKey = SignerPort | (() => SignerPort | Promise); Size [InterfaceDeclaration] (from packages/core/geometry/src/index.ts): export interface Size{ width: number; height: number; } SizingMode [TypeAliasDeclaration] (from packages/core/stage/src/index.ts): export type SizingMode = 'intrinsic' | 'uniform'; SliceChange [InterfaceDeclaration] (from packages/core/main/src/store.ts): export interface SliceChange{ readonly next: S; readonly previous: S; } SliceLease [InterfaceDeclaration] (from packages/core/main/src/store.ts): export interface SliceLease{ readonly key: string; readonly instanceId: string; readonly live: boolean; read(): S; write(next: S): boolean; readonly onChange: EventHook>; revoke(): void; } SnapSettings [InterfaceDeclaration] (from packages/core/annotation/src/types.ts): export interface SnapSettings{ readonly alignment: boolean; readonly alignmentThresholdPx: number; readonly rotation: boolean; readonly rotationAngles: readonly number[]; readonly rotationThresholdDeg: number; } Snapshot [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface Snapshot{ readonly page: PageRef; readonly rect: Rect; readonly image: Promise; } SnapshotBoxLook [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface SnapshotBoxLook{ readonly fill: string | null; readonly stroke: string | null; } SnapshotChangedEvent [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface SnapshotChangedEvent{ readonly snapshot: Snapshot | null; } SnapshotLayer [FunctionDeclaration] (from packages/framework/react/src/render.tsx): export function SnapshotLayer(){ const page = usePage(); const box = useOptionalSelector(RenderToken, (render) => render.getSnapshotBox(page.ref), null); const colors = useRenderSettings((settings) => settings.snapshot.box); const accent = useViewerSettings((settings) => settings.accent); if (!box) return null; const{ left, top, width, height} = rectInPixels(box, page.transform); return ( ); } SnapshotMenu [FunctionDeclaration] (from packages/framework/react/src/render.tsx): export function SnapshotMenu({ children, gap = 8, placement = 'bottom'} : SnapshotMenuProps){ const snapshot = useSnapshot(); const anchor = useMemo( () => snapshot &&{ page: snapshot.page, bounds: snapshot.rect} , [snapshot], ); if (!anchor) return null; return ( { children} ); } SnapshotMenuProps [InterfaceDeclaration] (from packages/framework/react/src/render.tsx): export interface SnapshotMenuProps{ children: React.ReactNode; gap?: number; placement?: AnchoredPlacement; } SnapshotSettings [InterfaceDeclaration] (from packages/plugin/render/src/contract.ts): export interface SnapshotSettings{ readonly scale: number; readonly box: SnapshotBoxLook; } SplitPaneOptions [InterfaceDeclaration] (from packages/plugin/view-manager/src/contract.ts): export interface SplitPaneOptions{ readonly from?: PaneId; } SpreadMode [TypeAliasDeclaration] (from packages/core/stage/src/index.ts): export type SpreadMode = 'none' | 'odd' | 'even'; Stage [FunctionDeclaration] (from packages/framework/react/src/stage.tsx): export function Stage({ children, pageChrome, overlay, tool, onToolChange, token: explicitToken, className, style, } : StageProps){ const token = useStageToken(explicitToken); const stage = useCapability(token as unknown as CapabilityToken); const ix = useOptionalCapability(InteractionToken); useEffect(() =>{ if (tool === undefined || !ix) return; if (ix.getActiveToolId() !== tool) ix.activateTool(tool); } , [tool, ix]); useCapabilityEvent( InteractionPublicToken, (interaction) => interaction.onToolChanged, (event) => onToolChange?.(event.toolId), ); const interaction = useSelector(token, (stage) => stage.getSettings().interaction); const panFallback = useSelector(token, (stage) => stage.getSettings().panFallback); const zoomGestures = useSelector(token, (stage) => stage.getSettings().zoomGestures); const useHub = interaction && !!ix; const hubCursor = useKernelValue(() => ix?.getCursor() ?? 'default'); const ref = useRef(null); const docId = useDocumentId(); const pages = useSelector(token, (stage) => stage.listVisiblePages()); const frame = useSelector( token, (stage) => stage.getSettings().pageFrame, (left, right) => left.top === right.top && left.right === right.right && left.bottom === right.bottom && left.left === right.left, ); const projector = useMemo(() => stageViewProjector(() => stage), [stage]); const projectorBinding = useMemo( () => ({ projector, revision: pages} ), [projector, pages], ); const shownKey = pages.map((page) => page.ref.objectNumber).join(', '); const shownPages = useMemo( () => new Set(shownKey ? shownKey.split(', ').map(Number) : []), [shownKey], ); useLayoutEffect(() =>{ const element = ref.current!; const detachSurface = createStageSurface(element, stage, { hub: useHub ? ix : null, source: stage.getLensId(), zoomGestures, } ); const offScroll = useHub && ix ? ix.registerHandler(createScrollHandler(stage, ix, { panFallback} ), { source: stage.getLensId(), } ) : null; const offZoomDrag = useHub && ix ? ix.registerHandler(createZoomDragHandler(stage, ix), { source: stage.getLensId()} ) : null; return () =>{ offZoomDrag?.(); offScroll?.(); detachSurface(); } ; } , [stage, ix, useHub, zoomGestures, panFallback]); return (
{ } { pages.map((visiblePage) => ( ))} { } { overlay}
); } StageBox [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageBox{ readonly width: number; readonly height: number; readonly orientation: 'portrait' | 'landscape'; } StageCameraChangedEvent [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageCameraChangedEvent{ readonly camera: Camera; } StageCapability [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageCapability{ getCamera(): Camera; setCamera(camera: Camera): void; getViewportSize(): Size; getZoomLevel(): number; getZoomMode(): ZoomModeValue | 'custom'; getViewRotation(): Rotation; getCurrentPage(): PageRef | null; getCurrentPageIndex(): number; getPageCount(): number; listCurrentItemPages(): readonly PageInfo[]; listCurrentPages(): readonly PageInfo[]; listVisiblePages(): readonly VisiblePage[]; isPageVisible(page: PageRef | number): boolean; getViewpoint(): Viewpoint; getCurrentDestination(): PageDestination | null; getViewState(): StageViewState; applyViewState(view: StageViewState): void; isMoving(): boolean; stopMotion(): void; zoomTo(zoom: number | ZoomSpec, options?: ZoomToOptions): void; zoomBy(factor: number, options?: ZoomToOptions): void; zoomIn(options?: ZoomToOptions): void; zoomOut(options?: ZoomToOptions): void; canZoomIn(): boolean; canZoomOut(): boolean; fitWidth(): void; fitPage(): void; fitAll(): void; fitAutomatic(): void; goToPage(page: PageRef | number, options?: GoToOptions): void; goToDestination(destination: PageDestination, options?: GoToDestinationOptions): void; goToFirstPage(options?: GoToOptions): void; goToLastPage(options?: GoToOptions): void; nextPage(options?: GoToOptions): void; previousPage(options?: GoToOptions): void; canGoNext(): boolean; canGoPrevious(): boolean; reveal(page: PageRef | number, options?: RevealOptions): void; scrollTo(options: StageScrollToOptions): void; scrollBy(options: StageScrollToOptions): void; panBy(dxViewport: number, dyViewport: number): void; resetView(): void; setViewRotation(rotation: Rotation): void; rotateViewBy(delta: 90 | -90): void; getSettings(): StageSettings; updateSettings(changes: StageSettingsPatch): void; resetSettings(): void; setResponsiveRules(rules: readonly ResponsiveRule[]): void; lockSettings(lock: StageSettingsLock): () => void; getLock(setting: keyof StageSettings): SettingLock | null; listActiveRules(): readonly string[]; matchesRule(name: string): boolean; getPageAt(point: ViewportPoint):{ ref: PageRef; point: Point; scale: number; rotation: Rotation; zoom: number; } | null; viewportToPage(page: PageRef | number, point: ViewportPoint): Point | null; pageToViewport(page: PageRef | number, point: Point): ViewportPoint | null; pageRectToViewport(page: PageRef | number, rect: Rect): ViewportRect | null; getPageBox(page: PageRef | number): VisiblePage | null; readonly onPageChanged: EventHook; readonly onZoomChanged: EventHook; readonly onCameraChanged: EventHook; readonly onMotionEnded: EventHook; readonly onSettingsChanged: EventHook; readonly onViewportChanged: EventHook; } StageConfig [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageConfig extends StageSettingsPatch{ responsive?: readonly ResponsiveRule[]; } StageMotionEndedEvent [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageMotionEndedEvent{ readonly camera: Camera; } StagePageChangedEvent [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StagePageChangedEvent{ readonly page: PageRef | null; readonly pageIndex: number; readonly previousPageIndex: number; } StagePluginOptions [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StagePluginOptions extends StageConfig{ id?: string; token?: CapabilityToken; } StageProps [InterfaceDeclaration] (from packages/framework/react/src/stage.tsx): export interface StageProps{ children: (page: PageContextValue) => React.ReactNode; pageChrome?: (page: PageContextValue) => React.ReactNode; overlay?: React.ReactNode; tool?: string; onToolChange?: (toolId: string) => void; token?: StageTokenProp; className?: string; style?: React.CSSProperties; } StageScope [FunctionDeclaration] (from packages/framework/react/src/stage-scope.tsx): export function StageScope({ token, children} : StageScopeProps){ return { children} ; } StageScopeProps [InterfaceDeclaration] (from packages/framework/react/src/stage-scope.tsx): export interface StageScopeProps{ token: StageTokenProp; children: React.ReactNode; } StageScrollToOptions [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageScrollToOptions{ left?: number; top?: number; behavior?: ScrollBehaviorKind; } StageSettings [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageSettings{ readonly flow: FlowMode; readonly layout: LayoutKind; readonly spread: SpreadMode; readonly sizing: SizingMode; readonly columns: GridColumns; readonly bounded: boolean; readonly padding: Padding; readonly gap: Gap; readonly pageFrame: PageFrame; readonly direction: Direction; readonly fitAlign: Alignment; readonly arrivalAlign: ArrivalAlignment; readonly zoomAlign: AlignmentValue; readonly anchorAlign: AlignmentValue; readonly viewRotation: Rotation; readonly zoom: ZoomSpec; readonly minZoom: number; readonly maxZoom: number; readonly scrollBehavior: ScrollBehaviorKind; readonly interaction: boolean; readonly panFallback: boolean; readonly zoomGestures: boolean; readonly turnGestures: boolean; readonly scrollChaining: boolean; readonly zoomBox: ZoomBoxLook; readonly viewUnitsPerPoint: number; } StageSettingsChangedEvent [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageSettingsChangedEvent{ readonly settings: StageSettings; readonly changedKeys: readonly (keyof StageSettings)[]; } StageSettingsLock [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageSettingsLock extends SettingLock{ readonly settings: Omit; } StageSettingsPatch [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageSettingsPatch extends Partial< Omit >{ padding?: number | Partial; pageFrame?: Partial; zoomBox?: Partial; } StageState [InterfaceDeclaration] (from packages/plugin/stage/src/state.ts): export interface StageState{ readonly zoomLevel: number; readonly zoomMode: ZoomModeValue | 'custom'; readonly currentPageIndex: number; readonly currentPage: PageRef | null; readonly pageCount: number; readonly viewRotation: Rotation; readonly activeRules: readonly string[]; } StageToken [VariableDeclaration] (from packages/plugin/stage/src/token.ts): StageToken = createCapabilityToken('stage', { hint: `add stagePlugin() from '@embedpdf/plugin-stage' to your plugins list`, } ) StageTokenProp [TypeAliasDeclaration] (from packages/framework/react/src/stage-scope.tsx): export type StageTokenProp = CapabilityToken; StageViewState [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageViewState extends StageSettings{ readonly pageIndex: number; readonly anchor: Anchor; } StageViewportChangedEvent [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageViewportChangedEvent{ readonly size: Size; } StageZoomChangedEvent [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface StageZoomChangedEvent{ readonly level: number; readonly previousLevel: number; readonly mode: ZoomModeValue | 'custom'; } StagedChange [TypeAliasDeclaration] (from packages/core/main/src/changes.ts): export type StagedChange = |{ readonly label: ChangeLabel; readonly ops: readonly ChangeOp[]; readonly undo?: readonly PredictedOp[]; readonly history?: false; } |{ readonly label: ChangeLabel; readonly undoOf: string; readonly shows: readonly PredictedOp[]; } |{ readonly label: ChangeLabel; readonly send: SendChange; readonly opId?: string; readonly history?: false; } ; StagedPrint [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface StagedPrint{ print(): Promise; destroy(): void; } StampArmChangedEvent [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampArmChangedEvent{ readonly documentId: string; readonly asset: StampAsset | null; } StampArmOptions [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampArmOptions extends StampDocumentOptions{ readonly targetWidth?: number; } StampAsset [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampAsset{ readonly id: string; readonly libraryId: string; readonly kind: StampAssetKind; readonly name: string; readonly label: string; readonly size:{ width: number; height: number} ; readonly page: PageRef; readonly subject?: string; readonly categories?: string[]; } StampAssetCreatedEvent [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampAssetCreatedEvent{ readonly assetId: string; readonly libraryId: string; readonly asset: StampAsset; } StampAssetDeletedEvent [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampAssetDeletedEvent{ readonly assetId: string; readonly libraryId: string; readonly asset: null; } StampAssetEngine [TypeAliasDeclaration] (from packages/plugin/stamp/src/contract.ts): export type StampAssetEngine = LocalEngine | (() => LocalEngine | Promise); StampAssetFilter [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampAssetFilter{ readonly libraryId?: string; readonly kind?: StampAssetKind; readonly category?: string; } StampAssetKind [TypeAliasDeclaration] (from packages/plugin/stamp/src/contract.ts): export type StampAssetKind = 'stamp' | 'signature' | 'initials'; StampAssetPatch [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampAssetPatch{ readonly label?: string; readonly subject?: string | null; readonly categories?: string[]; } StampAssetPreview [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampAssetPreview{ readonly bytes: Uint8Array; readonly mimeType: string; } StampAssetUpdatedEvent [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampAssetUpdatedEvent{ readonly assetId: string; readonly libraryId: string; readonly asset: StampAsset; } StampCapability [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampCapability extends SettingsApi{ listLibraries(filter?: StampLibraryFilter): readonly StampLibrary[]; getLibrary(libraryId: string): StampLibrary | null; listAssets(filter?: StampAssetFilter): readonly StampAsset[]; getAsset(assetId: string): StampAsset | null; getAssetPreview(assetId: string): StampAssetPreview | null; renderAssetPreview( assetId: string, options:{ width: number} & OperationOptions, ): Promise; getAssetBytes(assetId: string): Uint8Array | null; createLibrary(name: string, options?: CreateLibraryOptions): Promise<{ library: StampLibrary} >; updateLibrary( libraryId: string, changes: StampLibraryPatch, options?: OperationOptions, ): Promise<{ library: StampLibrary} >; deleteLibrary(libraryId: string, options?: OperationOptions): Promise; importLibrary( source: BinarySource, options?: ImportLibraryOptions, ): Promise<{ library: StampLibrary} >; exportLibrary(libraryId: string, options?: OperationOptions): Promise; createAsset(input: CreateAssetInput, options?: OperationOptions): Promise<{ asset: StampAsset} >; createAssetFromAnnotations( page: PageRef | number, refs: readonly AnnotationRef[], input: AssetFromAnnotationsInput, options?: StampDocumentOptions, ): Promise<{ asset: StampAsset} >; updateAsset( assetId: string, changes: StampAssetPatch, options?: OperationOptions, ): Promise<{ asset: StampAsset} >; deleteAsset(assetId: string, options?: OperationOptions): Promise; moveAsset( assetId: string, to:{ libraryId: string} , options?: OperationOptions, ): Promise<{ asset: StampAsset} >; duplicateAsset( assetId: string, options?:{ label?: string} & OperationOptions, ): Promise<{ asset: StampAsset} >; armAsset(assetId: string, options?: StampArmOptions): Promise; disarm(documentId?: string): void; getArmedAsset(documentId?: string): StampAsset | null; placeAsset( assetId: string, placement: StampPlacement, options?: StampDocumentOptions, ): Promise<{ annotation: Annotation} >; placeAssetOnPages( assetId: string, pages: readonly (PageRef | number)[] | 'all', placement: Omit, options?: StampDocumentOptions, ): Promise>; canPlace(documentId?: string): boolean; canCreateFromAnnotations(documentId?: string): boolean; canImport(): boolean; readonly onLibraryCreated: EventHook; readonly onLibraryUpdated: EventHook; readonly onLibraryDeleted: EventHook; readonly onAssetCreated: EventHook; readonly onAssetUpdated: EventHook; readonly onAssetDeleted: EventHook; readonly onArmChanged: EventHook; readonly onLibraryChanged: EventHook; } StampConfig [TypeAliasDeclaration] (from packages/plugin/stamp/src/contract.ts): export type StampConfig = DeepPartial; StampDocumentOptions [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampDocumentOptions extends OperationOptions{ readonly documentId?: string; } StampFont [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampFont{ readonly key: string; readonly load: () => Promise; } StampInput [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface StampInput{ source: BinarySource; targetWidth?: number; name?: string; subject?: string; preview?: BinarySource | StampPreviewProvider; intrinsicSize?:{ width: number; height: number} ; } StampLibrary [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampLibrary{ readonly id: string; readonly name: string; readonly kind: StampLibraryKind; readonly locale?: string; readonly categories?: string[]; readonly assetIds: string[]; } StampLibraryChangedEvent [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampLibraryChangedEvent{ readonly libraryId: string; readonly type: | 'created' | 'imported' | 'updated' | 'asset-created' | 'asset-updated' | 'asset-deleted' | 'deleted'; } StampLibraryCreatedEvent [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampLibraryCreatedEvent{ readonly libraryId: string; readonly library: StampLibrary; } StampLibraryDeletedEvent [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampLibraryDeletedEvent{ readonly libraryId: string; readonly library: null; } StampLibraryFilter [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampLibraryFilter{ readonly kind?: StampLibraryKind | readonly StampLibraryKind[]; } StampLibraryKind [TypeAliasDeclaration] (from packages/plugin/stamp/src/contract.ts): export type StampLibraryKind = string; StampLibraryPatch [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampLibraryPatch{ readonly name?: string; readonly categories?: string[]; } StampLibraryStore [InterfaceDeclaration] (from packages/plugin/stamp/src/persistence.ts): export interface StampLibraryStore{ list(): Promise>; put(id: string, bytes: Uint8Array): Promise; delete(id: string): Promise; } StampLibraryUpdatedEvent [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampLibraryUpdatedEvent{ readonly libraryId: string; readonly library: StampLibrary; } StampPlacement [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface StampPlacement{ readonly page: PageRef | number; readonly center: Point; readonly targetWidth?: number; readonly rotation?: number; readonly select?: boolean; } StampPreviewProvider [TypeAliasDeclaration] (from packages/plugin/annotation/src/contract.ts): export type StampPreviewProvider = (devicePixelWidth: number) => Promise; StampSettings [InterfaceDeclaration] (from packages/plugin/stamp/src/contract.ts): export interface StampSettings{ readonly assetEngine: StampAssetEngine | null; readonly fonts: readonly StampFont[]; readonly previewWidth: number; readonly dynamic: boolean; } StampSourceSpec [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type StampSourceSpec ={ kind: 'bytes'; source: BinarySource} | PromptSourceSpec; StampState [InterfaceDeclaration] (from packages/plugin/stamp/src/state.ts): export interface StampState{ readonly armedAsset: StampAsset | null; } StampToken [VariableDeclaration] (from packages/plugin/stamp/src/token.ts): StampToken = createCapabilityToken('stamp', { hint: `add stampPlugin() from '@embedpdf/plugin-stamp' to your plugins list`, } ) StateCell [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface StateCell{ get(): State; update( transition: (state: State, ...args: Args) => State, ...args: Args ): void; readonly onChange: EventHook>; } StateChange [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface StateChange{ readonly next: S; readonly previous: S; } StateDeclaration [InterfaceDeclaration] (from packages/core/main/src/state.ts): export interface StateDeclaration{ readonly token: CapabilityToken; readonly read: (capability: Capability) => State; readonly empty: State; readonly ensure?: (capability: Capability) => Promise; } StateHook [TypeAliasDeclaration] (from packages/framework/react/src/state.ts): export type StateHook = (select?: (state: State) => Selected) => Selected; StripView [TypeAliasDeclaration] (from packages/framework/react/src/toolbar.tsx): export type StripView = StripViewOf; StripViewGroup [TypeAliasDeclaration] (from packages/framework/react/src/toolbar.tsx): export type StripViewGroup = StripViewGroupOf; Style [InterfaceDeclaration] (from packages/core/annotation/src/types.ts): export interface Style{ color: Color | null; interiorColor: Color | null; strokeWidth: number; opacity: number; blendMode: BlendMode; borderStyle: AnnotationBorderStyle; dashArray: number[] | null; cloudyIntensity: number | null; } SubmitIntent [InterfaceDeclaration] (from packages/plugin/actions/src/contract.ts): export interface SubmitIntent{ readonly url: string | null; readonly fields: PdfActionTargetRef[] | null; readonly exclude: boolean; readonly includeNoValueFields: boolean; readonly format: 'fdf' | 'html' | 'xfdf' | 'pdf'; readonly method: 'post' | 'get'; readonly charSet?: string; } Subscribable [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type Subscribable = | ((listener: (event: T) => void) => Unsubscribe) |{ subscribe(listener: (event: T) => void): Unsubscribe} ; SurfaceClosedEvent [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface SurfaceClosedEvent{ readonly id: string; } SurfaceFocusOptions [InterfaceDeclaration] (from packages/framework/web/src/surface-focus.ts): export interface SurfaceFocusOptions{ readonly select?: boolean; } SurfaceHandle [InterfaceDeclaration] (from packages/framework/react/src/shell.ts): export interface SurfaceHandle{ readonly isOpen: boolean; readonly props: SurfaceProps; open(options?: OpenSurfaceOptions): void; close(): void; toggle(options?: OpenSurfaceOptions): void; } SurfaceOpenedEvent [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface SurfaceOpenedEvent{ readonly id: string; readonly props?: SurfaceProps; } SurfaceProps [TypeAliasDeclaration] (from packages/plugin/shell/src/contract.ts): export type SurfaceProps = Readonly>; SurfaceState [InterfaceDeclaration] (from packages/plugin/shell/src/contract.ts): export interface SurfaceState{ readonly id: string; readonly open: boolean; readonly exclusive?: string; readonly props?: SurfaceProps; readonly focusRequest: number; } SvgCursorOptions [InterfaceDeclaration] (from packages/framework/web/src/cursor.ts): export interface SvgCursorOptions{ svg: string; hotspot?:{ x: number; y: number} ; fallback?: string; } TestCertificateAuthority [InterfaceDeclaration] (from packages/core/signature/src/signers/test-authority.ts): export interface TestCertificateAuthority{ readonly certificate: Uint8Array; issueSigner(options?:{ commonName?: string; algorithm?: 'RSA-PKCS1-v1_5' | 'RSA-PSS' | 'ECDSA'; hash?: 'sha256' | 'sha384' | 'sha512'; unrevocable?: Unrevocable; } ): Promise; readonly revocation: RevocationSource; revoke( signer: Pick | Uint8Array, options?:{ at?: Date; reason?: RevocationReason} , ): void; } TestSigner [InterfaceDeclaration] (from packages/core/signature/src/signers/webcrypto.ts): export interface TestSigner extends RawSigner{ readonly certificate: Uint8Array; readonly privateKey: CryptoKey; } TestTimestampAuthority [InterfaceDeclaration] (from packages/core/signature/src/signers/webcrypto.ts): export interface TestTimestampAuthority extends CmsSigner{ readonly certificate: Uint8Array; } TextAlign [TypeAliasDeclaration] (from packages/core/annotation/src/types.ts): export type TextAlign = 'left' | 'center' | 'right'; TextDirection [TypeAliasDeclaration] (from packages/plugin/i18n/src/contract.ts): export type TextDirection = 'ltr' | 'rtl'; TextFormat [TypeAliasDeclaration] (from packages/plugin/annotation/src/rich-text.ts): export type TextFormat = 'bold' | 'italic' | 'underline'; TextItem [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface TextItem{ readonly id: string; readonly ref: AnnotationRef | null; readonly box: Rect; readonly contents: string; readonly richText:{ paragraphs: RichTextParagraph[]} ; readonly face:{ family: string; weight: number; italic: boolean} ; readonly programs: readonly MountableFontProgram[]; readonly editing: boolean; readonly rot?: number; readonly css:{ fontFamily: string; fontSize: number; color: string; fontWeight: number; fontStyle: 'normal' | 'italic'; textDecoration: 'none' | 'underline'; align: 'left' | 'center' | 'right'; padding: number; } ; } TextPosition [InterfaceDeclaration] (from packages/plugin/selection/src/contract.ts): export interface TextPosition{ readonly page: PageRef; readonly index: number; } TextRange [InterfaceDeclaration] (from packages/plugin/selection/src/contract.ts): export interface TextRange{ readonly start: TextPosition; readonly end: TextPosition; } TextSegment [TypeAliasDeclaration] (from packages/plugin/search/src/contract.ts): export type TextSegment = PdfTextSegment; TextSelection [InterfaceDeclaration] (from packages/plugin/annotation/src/rich-text.ts): export interface TextSelection extends RichTextRange{ id: string; } TextStyle [InterfaceDeclaration] (from packages/core/annotation/src/types.ts): export interface TextStyle{ fontFamily: string; fontSize: number; fontColor: Color; textAlign: TextAlign; bold?: boolean; italic?: boolean; underline?: boolean; } ThreadDeleteResult [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ThreadDeleteResult{ readonly deleted: AnnotationRef[]; readonly failed: Array<{ ref: AnnotationRef; error: unknown} >; } TilesSettings [InterfaceDeclaration] (from packages/plugin/render/src/paint-plan.ts): export interface TilesSettings{ size?: number; quantize?: 'exact' | readonly number[]; maxScale?: number; bleedPx?: number; engageRatio?: number; prefetch?:{ margin?: number; velocityBias?: boolean; } ; settleMs?: number; } TimestampVerdict [TypeAliasDeclaration] (from packages/core/signature/src/verdict.ts): export type TimestampVerdict = TimestampFacts & ( |{ readonly summary: 'valid' | 'valid-untrusted'; readonly stampedAt: string; readonly authorityCertificate: Uint8Array; } |{ readonly summary: 'invalid' | 'indeterminate'; readonly stampedAt: string | null; readonly authorityCertificate: Uint8Array | null; } ); Tool [InterfaceDeclaration] (from packages/plugin/interaction/src/contract.ts): export interface Tool{ readonly id: ToolId; readonly cursor: Cursor; readonly touch?: ToolTouch; canUse?(): boolean; onPointerDown?(event: ToolPointerEvent): boolean | void; onPointerMove?(event: ToolPointerEvent): void; onPointerUp?(event: ToolPointerEvent): void; onHover?(event: ToolPointerEvent): void; } ToolAuthoringKind [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type ToolAuthoringKind = keyof typeof TOOL_DEFAULT_FIELDS; ToolChangedEvent [InterfaceDeclaration] (from packages/plugin/interaction/src/contract.ts): export interface ToolChangedEvent{ readonly toolId: ToolId; readonly previousToolId: ToolId; } ToolCursorImage [TypeAliasDeclaration] (from packages/framework/web/src/cursor.ts): export type ToolCursorImage = SvgCursorOptions | string; ToolCursorSpec [InterfaceDeclaration] (from packages/framework/web/src/cursor.ts): export interface ToolCursorSpec{ toolId: string; cursors: Record; } ToolCursors [TypeAliasDeclaration] (from packages/plugin/interaction/src/contract.ts): export type ToolCursors = Readonly>; ToolDefaults [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ToolDefaults{ readonly color?: string | null; readonly interiorColor?: string | null; readonly opacity?: number; readonly strokeWidth?: number; readonly fontFamily?: string; readonly fontSize?: number; readonly fontColor?: string; readonly textAlign?: 'left' | 'center' | 'right'; readonly icon?: string; readonly contents?: string | null; readonly [field: string]: unknown; } ToolDefaultsChangedEvent [InterfaceDeclaration] (from packages/plugin/annotation/src/contract.ts): export interface ToolDefaultsChangedEvent{ readonly toolId: string; readonly defaults: ToolDefaults; } ToolDefaultsFor [TypeAliasDeclaration] (from packages/plugin/annotation/src/tools/definitions.ts): export type ToolDefaultsFor = ToolDraftOf & (K extends 'free-text' | 'free-text-callout' ? ToolRichText : unknown); ToolId [TypeAliasDeclaration] (from packages/plugin/interaction/src/contract.ts): export type ToolId = string; ToolPointerEvent [InterfaceDeclaration] (from packages/plugin/interaction/src/contract.ts): export interface ToolPointerEvent{ readonly page: PageRef; readonly point: Point; readonly modifiers: Modifiers; readonly pointerType: PointerKind; } ToolTouch [TypeAliasDeclaration] (from packages/plugin/interaction/src/contract.ts): export type ToolTouch = 'draw' | 'tap'; Toolbar [FunctionDeclaration] (from packages/framework/react/src/toolbar.tsx): export function Toolbar({ bar, orientation = 'horizontal', gap = 8, separatorWidth = 1, 'aria-label': ariaLabel, className, style, renderCommand = defaultRenderCommand, renderCustom, renderCollapsed, renderGroupTrigger, renderSeparator, renderOverflowTrigger = defaultRenderOverflowTrigger, renderOverflowMenu, } : ToolbarProps){ const kernel = useKernel(); const commands = useCapability(CommandsToken); const documentId = useDocumentId(); const vertical = orientation === 'vertical'; const [, force] = useReducer((x: number) => x + 1, 0); useEffect(() => kernel.subscribe(force), [kernel]); const containerRef = useRef(null); const [containerLength, setContainerLength] = useState(0); useLayoutEffect( () => containerRef.current ? observeContentLength(containerRef.current, orientation, setContainerLength) : undefined, [orientation], ); const [lengths] = useState(createToolbarLengths); const [, bumpMeasureVersion] = useReducer((version: number) => version + 1, 0); const onLength = useMemo( () => (key: string, length: number) =>{ if (lengths.report(orientation, key, length)) bumpMeasureVersion(); } , [lengths, orientation], ); const roving = useRef(null); useLayoutEffect(() =>{ const toolbar = containerRef.current; if (!toolbar) return; const focus = attachToolbarFocus(toolbar, orientation); roving.current = focus; return () =>{ focus.detach(); roving.current = null; } ; } , [orientation]); useLayoutEffect(() => roving.current?.refresh()); const resolveCmd = (id: string): ResolvedCommand | null => commands.resolveCommand(id, documentId ?? undefined); const executeCmd = (id: string) => void commands.execute(id, { documentId: documentId ?? undefined} ); const normalized = useMemo(() => normalizeBar(bar), [bar]); const layout = layoutToolbar({ bar: normalized, resolve: resolveCmd, unregistered: unregisteredCommand, execute: executeCmd, menuTarget: (id) => commands.getMenuTarget(id), metrics: lengths.metrics(orientation, gap, separatorWidth), measureKey: toolbarMeasureKey, containerLength, orientation, } ); const [overflowOpen, setOverflowOpen] = useState(false); useEffect(() =>{ if (!layout.hasOverflow) setOverflowOpen(false); } , [layout.hasOverflow]); const isExternalSlot = (part: ToolbarPart): boolean => part.kind === 'custom' && !renderCustom?.[part.name]; const renderPart = ( part: ToolbarPart, layer: 'live' | 'measure', ): React.ReactNode =>{ switch (part.kind){ case 'command': return renderCommand(part.command, part.variant, part.run); case 'custom':{ const terminal = () => part.terminal ? renderCommand(part.terminal, 'icon', part.runTerminal) : null; const registered = renderCustom?.[part.name]; if (registered){ const custom = registered(part.variant, { layer, measure: (length) => onLength(part.measureKey, length), } ); return custom === undefined ? terminal() : custom; } if (layer === 'measure') return null; return ( { terminal()} ); } case 'collapsed':{ const drawn = renderCollapsed?.(part.view); return drawn === undefined ? ( ) : ( drawn ); } case 'disclosure':{ const drawn = renderGroupTrigger?.(part.view); return drawn === undefined ? ( ) : ( drawn ); } } } ; const renderLiveSection = (section: LiveSection): React.ReactNode => section.groups.map((group, i) => ( { i > 0 && (renderSeparator ? renderSeparator() : )} { group.parts.map((part) => ( { renderPart(part, 'live')} ))} )); const sectionStyle = (section: LiveSection): React.CSSProperties => ({ display: 'flex', flexDirection: vertical ? 'column' : 'row', alignItems: 'center', gap, flex: section.grows ? '1 0 auto' : '0 0 auto', ...(section.spacing === 'balance' ? vertical ?{ marginTop: 'auto', marginBottom: 'auto'} :{ marginLeft: 'auto', marginRight: 'auto'} : section.spacing === 'gap' ? vertical ?{ marginTop: gap} :{ marginInlineStart: gap} : null), } ); const overflowView: OverflowMenuView ={ sections: layout.overflow, isOpen: overflowOpen, close: () => setOverflowOpen(false), resolve: resolveCmd, execute: executeCmd, } ; return (
{ layout.sections.map((section) => (
{ renderLiveSection(section)} { section.name === 'end' && layout.hasOverflow && ( { renderOverflowTrigger(overflowOpen, () => setOverflowOpen((previous) => !previous))} { renderOverflowMenu ? ( renderOverflowMenu(overflowView) ) : ( )} )}
))} { }
{ layout.measured .filter((part) => !isExternalSlot(part)) .map((part) =>{ const drawn = renderPart(part, 'measure'); if (part.kind === 'custom' && drawn === null) return null; return ( { drawn} ); } )} { renderOverflowTrigger(false, () =>{ } )}
); } ToolbarProps [InterfaceDeclaration] (from packages/framework/react/src/toolbar.tsx): export interface ToolbarProps{ bar: BarSchema; orientation?: 'horizontal' | 'vertical'; gap?: number; separatorWidth?: number; 'aria-label'?: string; className?: string; style?: React.CSSProperties; renderCommand?: (cmd: ResolvedCommand, variant: string, run: () => void) => React.ReactNode; renderCustom?: Record React.ReactNode>; renderCollapsed?: (view: CollapsedGroupView) => React.ReactNode; renderGroupTrigger?: (view: GroupDisclosureView) => React.ReactNode; renderSeparator?: () => React.ReactNode; renderOverflowTrigger?: (isOpen: boolean, toggle: () => void) => React.ReactNode; renderOverflowMenu?: (view: OverflowMenuView) => React.ReactNode; } TranslateOptions [InterfaceDeclaration] (from packages/plugin/i18n/src/contract.ts): export interface TranslateOptions{ params?: Readonly>; fallbackKey?: string; fallback?: string; } TranslationDictionary [InterfaceDeclaration] (from packages/plugin/i18n/src/contract.ts): export interface TranslationDictionary{ readonly [key: string]: string | TranslationDictionary; } TrustPort [InterfaceDeclaration] (from packages/core/signature/src/trust.ts): export interface TrustPort{ anchors(): Promise; timestampAnchors?(): Promise; } UnlockOptions [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface UnlockOptions extends OperationOptions{ readonly password: string; } Unsubscribe [TypeAliasDeclaration] (from packages/core/main/src/types.ts): export type Unsubscribe = () => void; UrlSource [InterfaceDeclaration] (from packages/core/main/src/types.ts): export interface UrlSource{ readonly kind: 'url'; readonly url: string; readonly id?: string; } VIEWER_DEFAULTS [VariableDeclaration] (from packages/core/main/src/viewer-settings.ts): VIEWER_DEFAULTS: ViewerSettings = Object.freeze({ identity: null, scope: null, accent: '#3858e9', page: Object.freeze({ background: '#ffffff', shadow: '0 6px 18px rgb(0 0 0 / 0.18)'} ), } ) VIEWER_WHOLE_SETTINGS [VariableDeclaration] (from packages/core/main/src/viewer-settings.ts): VIEWER_WHOLE_SETTINGS = ['identity'] as const ValidationInfoAdded [InterfaceDeclaration] (from packages/plugin/signature/src/contract.ts): export interface ValidationInfoAdded{ readonly added: ValidationInfoCounts; readonly documentTimestamp: FormFieldRef | null; } ValidationInfoCounts [TypeAliasDeclaration] (from packages/engine/core/src/signature/types.ts): export type ValidationInfoCounts = Record; ValidationTime [TypeAliasDeclaration] (from packages/core/signature/src/trust.ts): export type ValidationTime = |{ kind: 'now'} |{ kind: 'timestamp'; stampedAt: string; tokenVerified: true; genTime?: string; } |{ kind: 'timestamp'; genTime: string; tokenVerified: true; stampedAt?: undefined; } ; Variant [TypeAliasDeclaration] (from packages/core/ui/src/schema.ts): export type Variant = 'icon+label' | 'icon' | 'label'; ViewDemandInput [InterfaceDeclaration] (from packages/plugin/render/src/paint-plan.ts): export interface PageViewDemand{ desiredDeviceWidth: number; visibleRect?: Rect; velocity?:{ dx: number; dy: number} ; } ViewManagerCapability [InterfaceDeclaration] (from packages/plugin/view-manager/src/contract.ts): export interface ViewManagerCapability{ listPanes(): readonly PaneInfo[]; getPane(id: PaneId): PaneInfo | null; getPaneOrder(): readonly PaneId[]; getFocusedPaneId(): PaneId | null; getPaneOfDocument(documentId: string): PaneId | null; createPane(options?: CreatePaneOptions): PaneId; deletePane(id: PaneId, options?: DeletePaneOptions): void; movePane(id: PaneId, toIndex: number): void; setFocusedPane(id: PaneId | null): void; splitPane(documentId: string, options?: SplitPaneOptions): PaneId; setActiveDocument(paneId: PaneId, documentId: string | null): void; addDocument(paneId: PaneId, documentId: string, index?: number): void; removeDocument(paneId: PaneId, documentId: string): void; moveDocumentWithin(paneId: PaneId, documentId: string, toIndex: number): void; moveDocumentBetween( fromPaneId: PaneId, toPaneId: PaneId, documentId: string, toIndex?: number, ): void; readonly onPaneCreated: EventHook; readonly onPaneDeleted: EventHook; readonly onFocusChanged: EventHook; readonly onDocumentMoved: EventHook; } ViewManagerState [InterfaceDeclaration] (from packages/plugin/view-manager/src/state.ts): export interface ViewManagerState{ readonly panes: readonly PaneInfo[]; readonly focusedPaneId: PaneId | null; } ViewManagerToken [VariableDeclaration] (from packages/plugin/view-manager/src/token.ts): ViewManagerToken = createCapabilityToken('view-manager', { hint: `add viewManagerPlugin() from '@embedpdf/plugin-view-manager' to your plugins list`, } ) ViewProjector [InterfaceDeclaration] (from packages/framework/web/src/anchored-position.ts): export interface ViewProjector{ space: 'overlay' | 'client'; toScreen(page: PageRef, rect: AnchoredRect): AnchoredRect | null; toScreenPoint(page: PageRef, at: AnchoredPoint): AnchoredPoint | null; viewEnv(page: PageRef): PageViewEnv | null; view(): AnchoredRect | null; } Viewer [VariableDeclaration] (from packages/framework/react/src/runtime.tsx): Viewer = forwardRef(function Viewer({ engine, plugins, initialDocuments, fallback, renderError, onReady, identity, scope, accent, page, fetch: ownFetch, children, } : ViewerProps, ref, ){ const initial = useRef({ engine, plugins, initialDocuments} ); const settings = viewerSettingsOf({ identity, scope, accent, page} ); const latestSettings = useRef(settings); latestSettings.current = settings; const warned = useRef(false); if (isDev() && !warned.current){ if (initial.current.engine !== engine || initial.current.plugins !== plugins){ warned.current = true; console.warn( '[embedpdf] engine/plugins are init-only. A changed identity is ignored — ' + 'pass stable references (module scope, useState, or useMemo). ' + 'An inline `plugins={ [...]} ` array recreates its identity every render.', ); } } const [boot, setBoot] = useState({ phase: 'booting', kernel: null} ); const onReadyRef = useRef(onReady); onReadyRef.current = onReady; const fetchRef = useRef(ownFetch); fetchRef.current = ownFetch; useImperativeHandle( ref, () => (boot.phase === 'ready' ? boot.kernel : null), [boot], ); useEffect(() =>{ const captured = initial.current; const ownsEngine = typeof captured.engine === 'function'; const engine: Engine = ownsEngine ? (captured.engine as EngineFactory)() : (captured.engine as Engine); if (isLocalEngine(engine)) engine.warmup(); let kernel: Kernel; try{ kernel = createKernel({ engine, plugins: captured.plugins, settings: latestSettings.current, clock: browserClock(), printer: browserPrinter(), measurer: browserTextMeasurer(), fetch: (url, init) =>{ const download = fetchRef.current ?? globalThis.fetch; return download(url, init); } , } ); } catch (error){ setBoot({ phase: 'error', error} ); if (ownsEngine) void engine.destroy(); return; } let alive = true; setBoot({ phase: 'booting', kernel} ); kernel.start().then( () =>{ if (!alive) return; onReadyRef.current?.(kernel); setBoot({ phase: 'ready', kernel} ); kernel.documents.openAll(captured.initialDocuments ?? []); } , (error) =>{ if (alive) setBoot({ phase: 'error', error} ); } , ); return () =>{ alive = false; void kernel.destroy().then(() =>{ if (ownsEngine) void engine.destroy(); } ); } ; } , []); const liveKernel = boot.phase === 'error' ? null : boot.kernel; useEffect(() =>{ liveKernel?.updateSettings(latestSettings.current); } ); if (boot.phase === 'error'){ return <>{ renderError ? renderError(boot.error) : null} ; } if (!boot.kernel) return null; return ( { boot.phase === 'ready' ? children : (fallback ?? null)} ); } ) ViewerPageSettings [InterfaceDeclaration] (from packages/core/main/src/viewer-settings.ts): export interface ViewerPageSettings{ readonly background: string; readonly shadow: string; } ViewerProps [InterfaceDeclaration] (from packages/framework/react/src/runtime.tsx): export interface ViewerProps{ engine: Engine | EngineFactory; plugins: AnyPlugin[]; initialDocuments?: InitialDocument[]; fallback?: React.ReactNode; renderError?: (error: unknown) => React.ReactNode; onReady?: (kernel: Kernel) => void; identity?: Identity | null; scope?: readonly string[] | null; accent?: string; page?: Partial; fetch?: HostFetch; children?: React.ReactNode; } ViewerSettings [InterfaceDeclaration] (from packages/core/main/src/viewer-settings.ts): export interface ViewerSettings{ readonly identity: Identity | null; readonly scope: readonly string[] | null; readonly accent: string; readonly page: ViewerPageSettings; } ViewerSettingsInput [InterfaceDeclaration] (from packages/core/main/src/viewer-settings.ts): export interface ViewerSettingsInput{ readonly identity?: Identity | null; readonly scope?: readonly string[] | null; readonly accent?: string; readonly page?: Partial; } Viewpoint [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface Viewpoint{ readonly anchor: Anchor; readonly zoom: ZoomSpec; } ViewportPoint [TypeAliasDeclaration] (from packages/plugin/stage/src/contract.ts): export type ViewportPoint = Point; ViewportRect [TypeAliasDeclaration] (from packages/plugin/stage/src/contract.ts): export type ViewportRect = Rect; VisiblePage [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface VisiblePage extends PageBox{ readonly ref: PageRef; readonly screenX: number; readonly screenY: number; readonly transform: PageTransform; readonly visibleRect: Rect; } VisitorAnswers [TypeAliasDeclaration] (from packages/engine/core/src/dto/GrantVisitor.ts): export type VisitorAnswers = Partial>; VisitorIdentityRequest [InterfaceDeclaration] (from packages/engine/core/src/dto/GrantVisitor.ts): export interface VisitorIdentityRequest{ readonly fields: Partial>; readonly missing: readonly VisitorIdentityField[]; readonly invalid: readonly VisitorIdentityField[]; readonly purpose?: string; readonly privacyUrl?: string; } WidgetActivationResult [TypeAliasDeclaration] (from packages/plugin/form/src/contract.ts): export type WidgetActivationResult = |{ status: 'form'; result: FormCommitResult} |{ status: 'dispatched'; result: ActionTriggerResult} ; WidgetAddress [TypeAliasDeclaration] (from packages/plugin/form/src/contract.ts): export type WidgetAddress = AnnotationRef | FormWidget; WidgetAnnotation [TypeAliasDeclaration] (from packages/engine/core/src/annotation/kinds/widget/index.ts): export type WidgetAnnotation = ReadOf< typeof WidgetDeclaration, C >; WidgetHit [InterfaceDeclaration] (from packages/plugin/form/src/model.ts): export interface WidgetHit extends WidgetPlace{ readonly annotObjectNumber: number; readonly field: FormField; } WidgetPlace [InterfaceDeclaration] (from packages/plugin/form/src/model.ts): export interface WidgetPlace{ readonly box: Box; readonly rotation: 0 | 90 | 180 | 270; readonly rect: Box; } WorkingSetPage [InterfaceDeclaration] (from packages/engine/core/src/scheduling/facts.ts): export interface WorkingSetPage{ readonly page: PageRef; readonly role: 'visible' | 'near'; readonly visible?: PageBox; readonly pixels: number; } ZoomBoxLook [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface ZoomBoxLook{ readonly fill: string | null; readonly stroke: string | null; } ZoomMode [VariableDeclaration] (from packages/core/stage/src/index.ts): ZoomMode ={ Automatic: 'automatic', FitPage: 'fit-page', FitWidth: 'fit-width', FitAll: 'fit-all', } as const ZoomModeValue [TypeAliasDeclaration] (from packages/core/stage/src/index.ts): export type ZoomModeValue = (typeof ZoomMode)[keyof typeof ZoomMode]; ZoomSpec [TypeAliasDeclaration] (from packages/core/stage/src/index.ts): export type ZoomSpec = |{ mode: ZoomModeValue} |{ level: number} |{ pageWidth: number} |{ pageHeight: number} ; ZoomToOptions [InterfaceDeclaration] (from packages/plugin/stage/src/contract.ts): export interface ZoomToOptions{ readonly around?: ViewportPoint; } actionsPlugin [VariableDeclaration] (from packages/plugin/actions/src/actions.plugin.ts): actionsPlugin = (config?: ActionsConfig) => definePlugin({ id: 'actions', token: ActionsToken, scope: 'document', settings:{ defaults: ACTIONS_DEFAULTS, registered: registeredSettings(config)} , create: (ctx) => createActionsController(ctx, config), } ) annotationCommands [VariableDeclaration] (from packages/framework/react/src/command-lists.ts): annotationCommands = createAnnotationCommands() annotationKey [FunctionDeclaration] (from packages/engine/core/src/identity/annotationKey.ts): export function annotationKey(ref: AnnotationRef): string{ switch (ref.kind){ case 'objectNumber': return `obj:${ ref.objectNumber} `; case 'baseIndex': return `base:${ ref.page.objectNumber} :${ ref.baseIndex} `; } } annotationPlugin [VariableDeclaration] (from packages/plugin/annotation/src/annotation.plugin.ts): annotationPlugin = (config?: AnnotationConfig) => definePlugin({ id: 'annotation', token: AnnotationToken, scope: 'document', requires: [InteractionToken], optional: [SelectionToken, PublicActionsToken, RenderToken, FontsToken], state: initialAnnotationModel, settings:{ defaults: ANNOTATION_DEFAULTS, registered: config, whole: ['chrome.marquee']} , create: createAnnotationController, } ) annotationState [VariableDeclaration] (from packages/plugin/annotation/src/state.ts): annotationState = defineState(AnnotationToken, { read: (annotation): AnnotationState => ({ status: annotation.getStatus(), selected: annotation.selection.getSelected(), hovered: annotation.getHovered(), editing: annotation.text.getEditing(), } ), empty:{ status: 'loading', selected: [], hovered: null, editing: null} , } ) armSelectionHandle [FunctionDeclaration] (from packages/plugin/selection/src/handles.ts): export function armSelectionHandle( selection: SelectionHandleTarget, view: SelectionHandleView, endpoints: SelectionHandleEndpoints, role: 'start' | 'end', ): ArmedSelectionHandle | null{ const geometry = selectionHandleGeometry(view, endpoints[role], role); if (!geometry) return null; const opposite = endpoints[role === 'start' ? 'end' : 'start']; return{ base: midpoint(geometry.bar.from, geometry.bar.to), drag: createSelectionHandleDrag(selection, view, opposite, endpoints[role].page), } ; } attachmentPlugin [VariableDeclaration] (from packages/plugin/attachment/src/attachment.plugin.ts): attachmentPlugin = () => definePlugin({ id: 'attachment', token: AttachmentToken, scope: 'document', optional: [AnnotationToken, StageToken], state: initialAttachmentModel, create: createAttachmentController, } ) attachmentState [VariableDeclaration] (from packages/plugin/attachment/src/state.ts): attachmentState = defineState(AttachmentToken, { read: (attachment): AttachmentState => ({ files: attachment.list(), selected: attachment.getSelected(), status: attachment.getStatus(), canCreate: attachment.canCreate(), canDownload: attachment.canDownload(), } ), empty:{ files: [], selected: [], status: 'idle', canCreate: false, canDownload: false, } , ensure: (attachment) => attachment.ensureLoaded(), } ) boundCommandOf [FunctionDeclaration] (from packages/plugin/commands/src/contract.ts): export function boundCommandOf( command: ResolvedCommand, execute: (id: CommandId) => Promise, options:{ readonly isMac: boolean} , ): BoundCommand{ const [first] = command.shortcuts; return{ ...command, run: () => execute(command.id), shortcutLabel: first === undefined ? null : formatShortcut(first, { isMac: options.isMac} ), } ; } boxOf [VariableDeclaration] (from packages/plugin/stage/src/responsive.ts): boxOf = (size: Size): StageBox => ({ width: size.width, height: size.height, orientation: size.height >= size.width ? 'portrait' : 'landscape', } ) commandsPlugin [VariableDeclaration] (from packages/plugin/commands/src/commands.plugin.ts): commandsPlugin = (config?: CommandsConfig) => definePlugin({ id: 'commands', scope: 'workspace', token: CommandsToken, optional: [I18nToken, ShellToken], resolvesAnyCapability: true, settings:{ defaults: COMMANDS_DEFAULTS, registered: config as CommandsConfig | undefined, whole: ['appState'], } , create: createCommandsController, inScope: (commands, documentId) => ({ ...commands, resolveCommand: (id, target = documentId) => commands.resolveCommand(id, target), listCommands: (target = documentId) => commands.listCommands(target), searchCommands: (query, target = documentId) => commands.searchCommands(query, target), execute: (id, options) => commands.execute(id, { ...options, documentId: options?.documentId ?? documentId} ), canExecute: (id, target = documentId) => commands.canExecute(id, target), getRefusal: (id, target = documentId) => commands.getRefusal(id, target), } ), } ) composeApi [FunctionDeclaration] (from packages/core/main/src/compose.ts): export function composeApi( capability: string, slices: T, ): UnionToIntersection{ const seen = new Set(); const api: Record ={ } ; for (const slice of slices){ for (const key of Object.keys(slice)){ if (seen.has(key)){ throw new Error(`[${ capability} ] api member '${ key} ' is defined twice`); } seen.add(key); api[key] = (slice as Record)[key]; } } return api as UnionToIntersection; } copyImage [FunctionDeclaration] (from packages/framework/web/src/clipboard.ts): export async function copyImage( image: ClipboardImageSource | PromiseLike, ): Promise{ const blob = Promise.resolve(image).then((picture) => picture.blob()); await navigator.clipboard.write([new ClipboardItem({ 'image/png': blob} )]); } copySelection [FunctionDeclaration] (from packages/framework/web/src/clipboard.ts): export async function copySelection( selection: Pick, ): Promise{ const text = await selection.readText(); if (text !== '') await navigator.clipboard.writeText(text); return text; } createCapabilityToken [FunctionDeclaration] (from packages/core/main/src/index.ts): export function createCapabilityToken( name: string, options?:{ hint?: string; promises?: PromiseMembers} , ): CapabilityToken{ return{ name, hint: options?.hint, ...(options?.promises ?{ promises: options.promises as Readonly>} :{ } ), } ; } createClickCounter [FunctionDeclaration] (from packages/framework/web/src/page-pointer.ts): export function createClickCounter(maxGapMs = 400, maxDistancePx = 6){ let last = 0; let lastX = 0; let lastY = 0; let count = 0; return (now: number, x: number, y: number): number =>{ count = now - last <= maxGapMs && Math.hypot(x - lastX, y - lastY) <= maxDistancePx ? count + 1 : 1; last = now; lastX = x; lastY = y; return count; } ; } createEventHook [FunctionDeclaration] (from packages/core/main/src/event-hook.ts): export function createEventHook( onListenerError?: (error: unknown) => void, ): EventHookSource{ let listeners: Set<(event: T) => void> | null = new Set(); return{ on(listener, options){ if (!listeners || options?.signal?.aborted) return () =>{ } ; listeners.add(listener); const off = () => void listeners?.delete(listener); options?.signal?.addEventListener('abort', off, { once: true} ); return off; } , emit(event){ if (!listeners) return; for (const listener of [...listeners]){ try{ listener(event); } catch (error){ onListenerError?.(error); } } } , destroy(){ listeners = null; } , } ; } createFormScriptingController [FunctionDeclaration] (from packages/plugin/form/src/scripting/controller.ts): export function createFormScriptingController( options: FormScriptingControllerOptions, ): FormScriptingController{ return new FormScriptingController(options); } createHostToken [FunctionDeclaration] (from packages/core/main/src/index.ts): export function createHostToken(token: CapabilityToken): CapabilityToken{ return token as CapabilityToken; } createHoverPump [FunctionDeclaration] (from packages/plugin/actions/src/hover-pump.ts): export function createHoverPump( dispatch: (trigger: ActionTrigger) => Promise, ): HoverPump{ let delivered: HoverTarget | null = null; let desired: HoverTarget | null = null; let inFlight = false; const pump = (): void =>{ if (inFlight || sameTarget(delivered, desired)) return; inFlight = true; const from = delivered; const to = desired; delivered = to; const submissions: Array> = []; if (from && from.events?.exit !== false){ submissions.push( dispatch({ type: 'annotation', event: 'cursorExit', annotation: from.ref, page: from.page, ...(from.source ?{ source: from.source} :{ } ), } ), ); } if (to && to.events?.enter !== false){ submissions.push( dispatch({ type: 'annotation', event: 'cursorEnter', annotation: to.ref, page: to.page, ...(to.source ?{ source: to.source} :{ } ), } ), ); } void Promise.allSettled(submissions).then(() =>{ inFlight = false; pump(); } ); } ; return{ hover(target){ desired = target; pump(); } , reset(){ delivered = null; desired = null; } , } ; } createKernel [FunctionDeclaration] (from packages/core/main/src/kernel.ts): export function createKernel(config:{ engine: Engine; plugins: AnyPlugin[]; settings?: DeepPartial; report?: (error: unknown) => void; clock?: HostClock; printer?: HostPrinter; measurer?: HostTextMeasurer; fetch?: HostFetch; } ): Kernel{ const{ engine, plugins} = config; const report = config.report ?? ((error: unknown) => console.error('[kernel]', error)); const store = createStore(report); const plan = planPlugins(plugins); const documentScopedPlugins = plan.ordered.filter(isDocumentScoped); const workspaceCapabilities = new Map, unknown>(); const workspaceLeases = new Map>(); const workspaceConnectors = new Map void>(); const workspaceCancel = new AbortController(); const workspaceScope = createScope(report); const inScopeByToken = new Map, NonNullable>([ [DocumentsToken, documentsInScope], ]); for (const plugin of plan.ordered){ if (plugin.token && plugin.inScope && !isDocumentScoped(plugin)){ inScopeByToken.set(plugin.token, plugin.inScope); } } const opened = createEventHook(report); const openFailed = createEventHook(report); const locked = createEventHook(report); const closed = createEventHook(report); const activeChanged = createEventHook(report); const pagesChanged = createEventHook(report); const unsavedChangesChanged = createEventHook(report); workspaceScope.defer(() =>{ for (const hook of [ opened, openFailed, locked, closed, activeChanged, pagesChanged, unsavedChangesChanged, ]) hook.destroy(); } ); const setCore = (patch: Partial): void =>{ const before = store.getCore().activeId; store.setCore(patch); const after = store.getCore().activeId; if (before !== after) activeChanged.emit({ documentId: after, previousDocumentId: before} ); } ; const sessions = new Map(); let status: KernelStatus = 'created'; let startPromise: Promise | null = null; let destroyPromise: Promise | null = null; const guardUsable = (what: string) =>{ if (status === 'failed' || status === 'destroying' || status === 'destroyed'){ throw new Error(`[kernel] ${ what} on a ${ status} kernel`); } } ; const checkpoint = (session: DocumentSession) =>{ if (session.cancel.signal.aborted){ throw new CancelledError(`closed while opening: ${ session.id} `); } } ; async function engineCall( session: DocumentSession, call: Promise, onLateResult?: (value: T) => void | Promise, ): Promise{ const abortable = call as Promise &{ abort?: (reason?: unknown) => void} ; session.engineOp = typeof abortable.abort === 'function' ? (abortable as never) : null; const signal = session.cancel.signal; let onAbort: (() => void) | undefined; const cancellation = new Promise((_, reject) =>{ onAbort = () => reject(new CancelledError(`closed while opening: ${ session.id} `)); if (signal.aborted) onAbort(); else signal.addEventListener('abort', onAbort, { once: true} ); } ); try{ return await Promise.race([call, cancellation]); } catch (error){ if (isCancelled(error)){ void call.then( (value) =>{ if (onLateResult) session.scope.defer(() => onLateResult(value)); } , () =>{ } , ); } throw error; } finally{ if (onAbort) signal.removeEventListener('abort', onAbort); session.engineOp = null; } } function createSession(id: string, name: string | undefined): DocumentSession{ const cancel = new AbortController(); const changes = createDocumentChanges({ handle: () => session.handle, notify: () =>{ refreshPages(session); store.notify(); } , report, } ); const session: DocumentSession ={ id, instanceId: `${ id} #${ ++instanceCounter} `, name, source: null, grantInput: null, openOptions: undefined, phase: 'opening', handle: null, stagedMeta: null, scope: createScope(report), operation: null, engineOp: null, cancel, signal: cancel.signal, capabilities: new Map(), building: new Set(), views: new Map(), connectors: new Map(), leases: new Map(), settleFlushes: new Set(), downloadWraps: [], printWraps: [], changes, pageView: createPageView({ changes, report} ), changeCount: 0, changesSeen: 0, close: () => closeSession(session), } ; session.settleFlushes.add(() => session.changes.settle()); session.scope.defer(() => session.changes.close()); return session; } function beginOperation(session: DocumentSession, run: () => Promise): Promise{ if (session.operation){ throw new Error(`[documents] "${ session.id} " already has an active transition`); } const operation = run().finally(() =>{ if (session.operation === operation) session.operation = null; } ); session.operation = operation; return operation; } function rekeySession(session: DocumentSession, nextId: string): void{ const previousId = session.id; if (previousId === nextId) return; const core = store.getCore(); if (sessions.has(nextId) || core.documents[nextId] || core.pending[nextId]){ throw new PluginError('conflict', 'documents', `duplicate document id: ${ nextId} `); } sessions.delete(previousId); session.id = nextId; sessions.set(nextId, session); session.views.clear(); const slot = core.pending[previousId]; if (slot){ const{ [previousId]: _moved, ...pending} = core.pending; setCore({ pending:{ ...pending, [nextId]:{ ...slot, id: nextId} } , order: core.order.map((id) => (id === previousId ? nextId : id)), activeId: core.activeId === previousId ? nextId : core.activeId, } ); } } const closingSessions = new WeakMap>(); function closeSession(session: DocumentSession): Promise{ const inFlight = closingSessions.get(session); if (inFlight) return inFlight; const closing = (async () =>{ session.phase = 'closing'; unpublishSlot(session.id); for (const lease of session.leases.values()) lease.revoke(); const reason = new CancelledError(`closed while opening: ${ session.id} `); session.cancel.abort(reason); session.engineOp?.abort(reason); await session.operation?.catch((error) =>{ if (!isCancelled(error) && !isAbortLike(error)) report(error); } ); await session.scope.destroy(); if (sessions.get(session.id) === session) sessions.delete(session.id); session.views.clear(); closed.emit({ documentId: session.id} ); } )(); closingSessions.set(session, closing); return closing; } function nextActiveDocument(core: CoreState, removedId: string): string | null{ if (core.activeId !== removedId) return core.activeId; const index = core.order.indexOf(removedId); const remaining = core.order.filter((id) => id !== removedId); return remaining.length === 0 ? null : (remaining[Math.max(0, index - 1)] ?? remaining[0]); } function publishPendingSlot(session: DocumentSession, activate: boolean): void{ const core = store.getCore(); setCore({ pending:{ ...core.pending, [session.id]:{ id: session.id, name: session.name, status: 'loading'} , } , order: core.order.includes(session.id) ? core.order : [...core.order, session.id], activeId: activate || core.activeId === null ? session.id : core.activeId, } ); } function publishLocked(session: DocumentSession, passwordProvided: boolean): void{ const core = store.getCore(); setCore({ pending:{ ...core.pending, [session.id]:{ id: session.id, name: session.name, status: 'locked', passwordProvided} , } , } ); locked.emit({ documentId: session.id, passwordProvided} ); } function publishError(session: DocumentSession, error: unknown): void{ const core = store.getCore(); const openRequest = openRequestOf(error, session.grantInput); setCore({ pending:{ ...core.pending, [session.id]:{ id: session.id, name: session.name, status: 'error', error, ...(openRequest ?{ openRequest} :{ } ), } , } , } ); openFailed.emit({ documentId: session.id, error: toPluginErrorInfo(toPluginError('documents', error)), } ); } function unpublishSlot(id: string): void{ const core = store.getCore(); if (!core.pending[id] && !core.documents[id]) return; const{ [id]: _pending, ...pending} = core.pending; const{ [id]: _document, ...documents} = core.documents; setCore({ pending, documents, order: core.order.filter((other) => other !== id), activeId: nextActiveDocument(core, id), } ); } function commitReady(session: DocumentSession): void{ session.phase = 'ready'; session.pageView.refresh(); const meta = pageMetaOf(session.stagedMeta!, session.pageView.current()); const core = store.getCore(); const{ [session.id]: _resolved, ...pending} = core.pending; setCore({ documents:{ ...core.documents, [session.id]: meta} , pending} ); const grant = session.handle?.grant; if (grant){ session.scope.defer( grant.onIdentityRequested((request) => setIdentityRequest(session, request)), ); session.scope.defer(grant.onOpenRequested((request) => setOpenRequest(session, request))); } opened.emit({ documentId: session.id, info: documentInfoOf(meta)} ); } function pageMetaOf(meta: DocumentMeta, view: PageView): DocumentMeta{ const{ pages, labels, pending} = view; if (meta.pages === pages && meta.pageLabels === labels && meta.pendingPages === pending){ return meta; } return{ ...meta, pageCount: pages.length, pages, pageLabels: labels, pendingPages: pending, pagesSequence: meta.pages === pages ? meta.pagesSequence : meta.pagesSequence + 1, } ; } function refreshPages(session: DocumentSession): void{ const view = session.pageView.refresh(); if (!view) return; const now = store.getCore(); const existing = now.documents[session.id]; if (!existing) return; const updated = pageMetaOf(existing, view); if (updated === existing) return; setCore({ documents:{ ...now.documents, [session.id]: updated} } ); if (updated.pages === existing.pages) return; pagesChanged.emit({ documentId: session.id, pagesSequence: updated.pagesSequence, pages: updated.pages, } ); } function setOpenRequest(session: DocumentSession, request: GrantOpenRequest | null): void{ const core = store.getCore(); const published = core.documents[session.id]; if (!published || (published.openRequest ?? null) === request) return; const{ openRequest: _shown, ...rest} = published; setCore({ documents:{ ...core.documents, [session.id]: request ?{ ...rest, openRequest: request} : rest, } , } ); } async function resumeGrant(session: DocumentSession, options: RetryOptions | undefined){ const grant = session.handle!.grant!; const{ passphrase, visitorIdentity} = options ??{ } ; try{ await grant.resume({ ...(passphrase !== undefined ?{ passphrase} :{ } ), ...(visitorIdentity !== undefined ?{ visitorIdentity} :{ } ), } ); } catch (error){ setOpenRequest(session, grant.openRequest); throw toPluginError('documents', error); } setOpenRequest(session, grant.openRequest); return{ document: getDocument(session.id)!} ; } function setIdentityRequest( session: DocumentSession, request: VisitorIdentityRequest | null, ): void{ const core = store.getCore(); const published = core.documents[session.id]; if (!published || (published.identityRequest ?? null) === request) return; const{ identityRequest: _shown, ...rest} = published; setCore({ documents:{ ...core.documents, [session.id]: request ?{ ...rest, identityRequest: request} : rest, } , } ); } async function identify(id: string, answers: VisitorAnswers): Promise{ const session = readySession(id, 'identify'); const grant = session.handle!.grant; if (!grant){ throw new PluginError('invalid-input', 'documents', `${ id} isn't from a grant`); } try{ await grant.identify(answers); } catch (error){ const request = visitorIdentityRequestOf(error); if (request) setIdentityRequest(session, request); throw toPluginError('documents', error); } setIdentityRequest(session, grant.identityRequest); } function declineIdentity(id: string): void{ const session = readySession(id, 'decline'); session.handle!.grant?.decline(); setIdentityRequest(session, null); } function setUnsavedChanges(session: DocumentSession, hasUnsavedChanges: boolean): void{ const core = store.getCore(); const published = core.documents[session.id]; if (!published){ if (session.stagedMeta && session.stagedMeta.hasUnsavedChanges !== hasUnsavedChanges){ session.stagedMeta ={ ...session.stagedMeta, hasUnsavedChanges} ; } return; } if (published.hasUnsavedChanges === hasUnsavedChanges) return; setCore({ documents:{ ...core.documents, [session.id]:{ ...published, hasUnsavedChanges} } , } ); unsavedChangesChanged.emit({ documentId: session.id, hasUnsavedChanges} ); } const sessionOf = (documentId?: string): DocumentSession | null =>{ const id = documentId ?? store.getCore().activeId; return id ? (sessions.get(id) ?? null) : null; } ; const documentHandle = (documentId?: string): DocumentHandle | null =>{ const session = sessionOf(documentId); if (!session) return null; return session.phase === 'bringup' || session.phase === 'ready' ? session.handle : null; } ; function readySession(documentId: string | undefined, verb: string): DocumentSession{ const session = sessionOf(documentId); if (!session || !documentHandle(session.id)){ throw new PluginError('not-ready', 'documents', `no open document to ${ verb} `); } return session; } const allowsOn = (documentId: string | undefined, permission: Permission): boolean =>{ const handle = documentHandle(documentId); return handle ? sessionAllows(handle.security, permission) : false; } ; async function downloadFile( documentId: string | undefined, signal: AbortSignal | undefined, verb: string, read: (handle: DocumentHandle) => Promise, refuse?: (handle: DocumentHandle) => PluginError | null, ): Promise{ const session = readySession(documentId, verb); if (!allowsOn(session.id, 'doc.download')){ throw permissionDenied('documents', 'doc.download', `documents.${ verb} `); } const refusal = refuse?.(session.handle!); if (refusal) throw refusal; try{ await settle(session.settleFlushes, [signal, session.signal], report); const handle = documentHandle(session.id); if (!handle) throw new PluginError('not-ready', 'documents', `no open document to ${ verb} `); let readAt = -1; const readFile = () =>{ readAt = session.changeCount; return cancellable('documents', signal, read(handle)); } ; const bytes = await runWrapped(session.downloadWraps, readFile); if (readAt === session.changeCount) setUnsavedChanges(session, false); return bytes; } catch (error){ throw toPluginError('documents', error); } } const printer = config.printer ?? null; const canPrintOn = (documentId: string | undefined): boolean => printer !== null && allowsOn(documentId, 'doc.print'); const printQualityOf = (documentId: string | undefined): PrintQuality | null =>{ if (!canPrintOn(documentId)) return null; if (!allowsOn(documentId, 'doc.print.high')) return PRINT_STANDARD; const mayKeepCopy = allowsOn(documentId, 'doc.download') || allowsOn(documentId, 'doc.download.flattened'); return mayKeepCopy && printer?.stagePdf ? PRINT_PDF : PRINT_HIGH; } ; function printPagesOf( session: DocumentSession, pages: readonly PageRef[] | undefined, ): readonly PageInfo[]{ const all = metaOf(session.id)?.pages ?? EMPTY_PAGES; if (pages === undefined) return all; if (pages.length === 0){ throw new PluginError('invalid-input', 'documents', 'a print needs at least one page'); } const found = pages.map((ref) =>{ const page = findPage(all, ref); if (!page){ throw new PluginError( 'not-found', 'documents', `page ${ ref.objectNumber} is not in this document`, ); } return page; } ); if (new Set(found).size !== found.length){ throw new PluginError('invalid-input', 'documents', 'a print names a page twice'); } return found; } const printLayersOf = (documentId: string, options: PrintOptions) => ({ includeAnnotations: options.includeAnnotations ?? allowsOn(documentId, 'doc.annotate.read'), includeFormFields: allowsOn(documentId, 'doc.forms.read'), } ); async function stagePrint( session: DocumentSession, activePrinter: HostPrinter, quality: PrintQuality, options: PrintOptions, ): Promise<{ staged: StagedPrint; quality: PrintQuality; changesSeen: number} >{ const{ signal} = options; await settle(session.settleFlushes, [signal, session.signal], report); const handle = documentHandle(session.id); if (!handle) throw new PluginError('not-ready', 'documents', 'no open document to print'); const changesSeen = session.changesSeen; const job: PrintJob ={ handle, pages: printPagesOf(session, options.pages), layers: printLayersOf(session.id, options), name: session.name ?? 'document', options, } ; options.onProgress?.({ pagesRendered: 0, pageCount: job.pages.length} ); if (quality.kind === 'images'){ return{ staged: await stagePictures(job, activePrinter, quality.dpi), quality, changesSeen} ; } try{ return{ staged: await stagePdfCopy(job, activePrinter), quality, changesSeen} ; } catch (error){ if (signal?.aborted) throw error; const staged = await stagePictures(job, activePrinter, PRINT_HIGH.dpi); return{ staged, quality: PRINT_HIGH, changesSeen} ; } } async function stagePdfCopy(job: PrintJob, activePrinter: HostPrinter): Promise{ const{ handle, pages, layers, name, options} = job; const{ signal} = options; if (!activePrinter.stagePdf){ throw new PluginError('unsupported', 'documents', 'this printer prints no PDF'); } const pdf = await cancellable( 'documents', signal, handle.pages.extract( pages.map((page) => page.ref), { flatten:{ usage: 'print'} , ...layers} , ), ); const staged = await activePrinter.stagePdf(pdf, { name, ...(signal ?{ signal} :{ } )} ); options.onProgress?.({ pagesRendered: pages.length, pageCount: pages.length} ); return staged; } async function stagePictures( job: PrintJob, activePrinter: HostPrinter, dpi: PrintDpi, ): Promise{ const{ handle, pages, layers, name, options} = job; const{ signal} = options; const sheets: PrintSheet[] = []; for (const page of pages){ const image = await cancellable( 'documents', signal, handle.page(page.ref).render.image({ usage: 'print', viewport:{ kind: 'dpi', dpi} , format: 'png', ...layers, } ), ); const blob = await cancellable('documents', signal, image.blob()); sheets.push({ image: blob, widthPt: page.size.width, heightPt: page.size.height} ); options.onProgress?.({ pagesRendered: sheets.length, pageCount: pages.length} ); } return activePrinter.stage(sheets, { name, ...(signal ?{ signal} :{ } )} ); } async function preparePrint( documentId: string | undefined, options: PrintOptions ={ } , ): Promise{ const session = readySession(documentId, 'preparePrint'); if (!allowsOn(session.id, 'doc.print')){ throw permissionDenied('documents', 'doc.print', 'documents.preparePrint'); } const quality = printQualityOf(session.id); if (!printer || !quality){ throw new PluginError( 'unsupported', 'documents', 'no printer: pass one to createKernel({ printer} ), such as browserPrinter() from @embedpdf/web', ); } const pageCount = printPagesOf(session, options.pages).length; try{ let{ staged, changesSeen, quality: printed, } = await stagePrint(session, printer, quality, options); let disposed = false; const destroy = () =>{ if (disposed) return; disposed = true; staged.destroy(); } ; session.scope.defer(destroy); const restage = async (as: PrintQuality, signal: AbortSignal | undefined) =>{ const fresh = await stagePrint(session, printer, as, { ...(options.pages ?{ pages: options.pages} :{ } ), ...(options.includeAnnotations !== undefined ?{ includeAnnotations: options.includeAnnotations} :{ } ), ...(signal ?{ signal} :{ } ), } ); staged.destroy(); ({ staged, changesSeen, quality: printed} = fresh); } ; return{ get quality(){ return printed; } , pageCount, needsTap: printer.needsTap === true, async print(printOptions){ if (disposed){ throw new PluginError('invalid-input', 'documents', 'this print was disposed'); } const signal = printOptions?.signal; const run = async () =>{ if (session.changesSeen !== changesSeen) await restage(quality, signal); if (signal?.aborted){ throw new PluginError('operation-cancelled', 'documents', 'print cancelled', { cause: signal.reason, } ); } try{ await staged.print(); } catch (error){ if (printed.kind !== 'pdf') throw error; await restage(PRINT_HIGH, signal); await staged.print(); } } ; try{ await runWrapped(session.printWraps, run); } catch (error){ throw toPluginError('documents', error); } } , destroy, } ; } catch (error){ throw toPluginError('documents', error); } } const isBuilding = (plugin: AnyPlugin, session: DocumentSession): boolean => session.building.has(plugin) && !session.capabilities.has(plugin); function buildDocumentCapability(plugin: AnyPlugin, session: DocumentSession): unknown{ let capability = session.capabilities.get(plugin); if (!capability){ if (session.building.has(plugin)){ throw new PluginError( 'not-ready', plugin.id, `"${ plugin.id} " was asked for while it is being created`, ); } const ctx = createPluginContext(services, plugin, session, session.signal, session.scope); session.building.add(plugin); let created: ReturnType; try{ created = plugin.create(ctx); } finally{ session.building.delete(plugin); } const{ api, connect} = created; capability = api; session.connectors.set(plugin, () =>{ connect?.(); markConnected(ctx); } ); session.capabilities.set(plugin, capability); } return capability; } function workspaceViewOf( token: CapabilityToken, capability: T, documentId: string | undefined, ): T{ const inScope = inScopeByToken.get(token); const session = documentId === undefined ? undefined : sessions.get(documentId); if (!inScope || !session) return capability; let view = session.views.get(token); if (view === undefined){ view = inScope(capability, session.id); session.views.set(token, view); } return view as T; } function resolveCapability(token: CapabilityToken, documentId?: string): T{ guardUsable(`capability("${ token.name} ")`); const workspaceCapability = workspaceCapabilities.get(token); if (workspaceCapability) return workspaceViewOf(token, workspaceCapability as T, documentId); const provider = plan.providerOf(token); if (!provider) throw new Error(`No capability "${ token.name} ".`); const id = documentId ?? store.getCore().activeId; if (!id) throw new Error(`Capability "${ token.name} " requires an active document.`); const session = sessions.get(id); if (!session) throw new Error(`Capability "${ token.name} " unavailable: no document "${ id} ".`); if (session.phase === 'bringup' || session.phase === 'ready'){ return buildDocumentCapability(provider, session) as T; } const shown = session.phase === 'opening' ? 'loading' : session.phase; throw new Error(`Capability "${ token.name} " unavailable: document "${ id} " is ${ shown} .`); } function tryResolveInternal(token: CapabilityToken, documentId?: string): T | null{ if (status === 'destroying' || status === 'destroyed') return null; const workspaceCapability = workspaceCapabilities.get(token); if (workspaceCapability) return workspaceViewOf(token, workspaceCapability as T, documentId); const provider = plan.providerOf(token); if (!provider) return null; const session = sessionOf(documentId); if (!session || (session.phase !== 'bringup' && session.phase !== 'ready')) return null; if (isBuilding(provider, session)) return null; return buildDocumentCapability(provider, session) as T; } function tryResolveCapability(token: CapabilityToken, documentId?: string): T | null{ if (status === 'destroying' || status === 'destroyed') return null; const workspaceCapability = workspaceCapabilities.get(token); if (workspaceCapability) return workspaceViewOf(token, workspaceCapability as T, documentId); const provider = plan.providerOf(token); if (!provider) return null; const session = sessionOf(documentId); if (!session || session.phase !== 'ready') return null; if (isBuilding(provider, session)) return null; return buildDocumentCapability(provider, session) as T; } const viewerSettings = createSettingsStore({ defaults: VIEWER_DEFAULTS, registered: config.settings, whole: VIEWER_WHOLE_SETTINGS} , store.notify, report, ); workspaceScope.defer(() => viewerSettings.destroy()); const settingsStores = new Map>(); for (const plugin of plan.ordered){ if (plugin.settings){ settingsStores.set(plugin, createSettingsStore(plugin.settings, store.notify, report)); } } workspaceScope.defer(() =>{ for (const settings of settingsStores.values()) settings.destroy(); } ); function settingsOf(token: CapabilityToken): SettingsApi>{ const provider = plan.providerOf(token); if (!provider) throw new Error(`No capability "${ token.name} ".`); const settings = settingsStores.get(provider); if (!settings) throw new Error(`Plugin "${ provider.id} " has no settings.`); return settings.api as unknown as SettingsApi>; } const services: ContextServices ={ engine, store, workspaceScope, workspaceSignal: workspaceCancel.signal, workspaceLeases, report, clock: config.clock ?? timerClock, measurer: config.measurer ?? null, resolveCapability, tryResolveCapability: tryResolveInternal, documentHandle, settingsStoreOf: (plugin) => settingsStores.get(plugin), } ; let ticketCounter = 0; const nextTicket = () => `pending:${ ++ticketCounter} `; async function bringUp( session: DocumentSession, snapshot:{ pageCount: number; pages: DocumentMeta['pages']; labels: DocumentMeta['pageLabels']; } , ): Promise{ session.phase = 'bringup'; let renderPolicy: EngineRenderPolicy = CONTINUOUS_RENDER_POLICY; try{ renderPolicy = (await session.handle!.render?.getPolicy()) ?? CONTINUOUS_RENDER_POLICY; } catch{ } checkpoint(session); session.pageView.setEnginePages(snapshot); session.pageView.refresh(); session.stagedMeta ={ id: session.id, instanceId: session.instanceId, name: session.name, pageCount: snapshot.pageCount, pages: session.pageView.current().pages, pageLabels: session.pageView.current().labels, pendingPages: NO_PENDING_PAGES, pagesSequence: 0, renderPolicy, hasUnsavedChanges: false, } ; const tracksChanges = isLocalDocument(session.handle!); const bursts = createBurstGate(store); session.scope.defer(bursts.close); let layoutsSeen = 0; let pageReads = 0; const readPagesAgain = (): void =>{ const seen = layoutsSeen; const read = ++pageReads; session.handle!.pages.list().then( (snapshot) =>{ if (session.cancel.signal.aborted || layoutsSeen !== seen || pageReads !== read) return; session.pageView.setEnginePages(snapshot); refreshPages(session); } , (error: unknown) =>{ if (!session.cancel.signal.aborted) report(error); } , ); } ; const unsubscribeEvents = session.handle!.events.subscribe((event) =>{ bursts.first(event); if (changesDocument(event)){ session.changesSeen += 1; if (tracksChanges){ session.changeCount += 1; setUnsavedChanges(session, true); } } const layout = layoutFromEvent(event); if (layout){ layoutsSeen += 1; session.pageView.setEnginePages(layout); } if (event.type === 'stream.desynced') readPagesAgain(); session.pageView.fold(event); refreshPages(session); } ); session.scope.defer(unsubscribeEvents); for (const plugin of documentScopedPlugins){ const lease = store.lease( sliceKey(plugin.id, session.id), initialStateOf(plugin), session.instanceId, ); session.leases.set(plugin, lease); session.scope.defer(() => lease.revoke()); } const release = store.hold(); try{ for (const plugin of documentScopedPlugins){ buildDocumentCapability(plugin, session); session.connectors.get(plugin)?.(); } } finally{ release(); } session.scope.defer(session.handle!.events.subscribe((event) => bursts.last(event))); checkpoint(session); } function openedResult(session: DocumentSession): OpenDocumentResult{ const core = store.getCore(); const entry = core.documents[session.id] ?? core.pending[session.id]; if (!entry) throw new PluginError('instance-closed', 'documents', `${ session.id} was closed`); return{ document: documentInfoOf(entry)} ; } async function openDocument( input: OpenSource, options?: OpenDocumentOptions, slotId?: string, ): Promise{ const signal = options?.signal; if (signal?.aborted){ throw new PluginError('operation-cancelled', 'documents', 'the open was cancelled'); } try{ const{ session, done} = reserveAndOpen(input, options, slotId); const cancel = () => void session.close(); signal?.addEventListener('abort', cancel, { once: true} ); try{ return openedResult(await done); } finally{ signal?.removeEventListener('abort', cancel); } } catch (error){ throw toPluginError('documents', error); } } function engineOptionsOf(options: OpenDocumentOptions | undefined){ const{ activate: _activate, name: _name, signal: _signal, ...own} = options ??{ } ; const viewer = viewerSettings.api.getSettings(); const scope = own.scope ?? viewer.scope ?? undefined; const identity = own.identity ?? viewer.identity ?? undefined; return{ ...own, ...(scope !== undefined ?{ scope} :{ } ), ...(identity !== undefined ?{ identity} :{ } ), } ; } function reserveAndOpen( input: OpenSource, options?: OpenDocumentOptions, slotId?: string, ):{ session: DocumentSession; done: Promise} { guardUsable('documents.open()'); const engineOptions = engineOptionsOf(options); const requestedId = slotId ?? (typeof input === 'function' ? nextTicket() : (idOfInput(input) ?? nextTicket())); if (sessions.has(requestedId)){ throw new PluginError('conflict', 'documents', `document already open: ${ requestedId} `); } const session = createSession(requestedId, options?.name); session.source = input; session.openOptions = options; sessions.set(session.id, session); publishPendingSlot(session, options?.activate ?? true); const done = beginOperation(session, async () =>{ try{ const given = typeof input === 'function' ? await engineCall(session, Promise.resolve(input(session.cancel.signal))) : input; checkpoint(session); const source = isUrlSource(given) ? await engineCall(session, fetchUrlSource(given, session.cancel.signal, config.fetch)) : given; checkpoint(session); session.grantInput = source.kind === 'grant' ? source : null; const sourceId = idOfInput(source); if (sourceId) rekeySession(session, sourceId); const handle = await engineCall(session, engine.open(source, engineOptions), (late) => late.close(), ); session.handle = handle; session.scope.defer(() => handle.close()); checkpoint(session); if (handle.id !== session.id) rekeySession(session, handle.id); const prompt = handle.security?.passwordPrompt; if (prompt?.state === 'required'){ session.phase = 'locked'; publishLocked(session, prompt.incorrect); return session; } const snapshot = await engineCall(session, handle.pages.list()); checkpoint(session); await bringUp(session, snapshot); commitReady(session); return session; } catch (error){ if (isCancelled(error)) throw error; if (session.phase === 'closing' || isAbortLike(error)){ throw new CancelledError(`closed while opening: ${ session.id} `); } await session.scope.destroy(); session.phase = 'error'; publishError(session, error); throw error; } } ); return{ session, done} ; } async function unlockDocument(id: string, options: UnlockOptions): Promise{ guardUsable('documents.unlock()'); const session = sessions.get(id); if (!session || session.phase !== 'locked' || !session.handle){ throw new PluginError('invalid-input', 'documents', `document is not locked: ${ id} `); } const handle = session.handle; return beginOperation(session, async () =>{ try{ await cancellable( 'documents', options.signal, engineCall(session, handle.security.unlock({ password: options.password} )), ); } catch (error){ if (session.phase === 'closing' || isAbortLike(error)){ throw new CancelledError(`closed while opening: ${ session.id} `); } throw error; } checkpoint(session); try{ const snapshot = await engineCall(session, handle.pages.list()); checkpoint(session); await bringUp(session, snapshot); commitReady(session); } catch (error){ if (isCancelled(error)) throw error; if (session.phase === 'closing' || isAbortLike(error)){ throw new CancelledError(`closed while opening: ${ session.id} `); } await session.scope.destroy(); session.phase = 'error'; publishError(session, error); throw error; } } ).catch((error: unknown) =>{ throw toPluginError('documents', error); } ); } async function closeDocument(documentId: string): Promise{ const session = sessions.get(documentId); if (!session) return; await session.close(); } function reorder(next: string[]){ setCore({ order: next} ); } const metaOf = (documentId?: string): DocumentMeta | null =>{ const core = store.getCore(); const id = documentId ?? core.activeId; return id ? (core.documents[id] ?? null) : null; } ; let listMemo:{ core: CoreState; value: readonly DocumentInfo[]} | null = null; const listDocuments = (): readonly DocumentInfo[] =>{ const core = store.getCore(); if (listMemo?.core === core) return listMemo.value; const next = core.order.map((id) => documentInfoOf(core.documents[id] ?? core.pending[id])); const previous = listMemo?.value; const same = previous !== undefined && previous.length === next.length && previous.every((info, i) => info === next[i]); const value = same ? previous : Object.freeze(next); listMemo ={ core, value} ; return value; } ; const getDocument = (documentId?: string): DocumentInfo | null =>{ const core = store.getCore(); const id = documentId ?? core.activeId; const entry = id ? (core.documents[id] ?? core.pending[id]) : undefined; return entry ? documentInfoOf(entry) : null; } ; const documents: DocumentsCapability ={ open: openDocument, canOpenFiles: () => engine.canOpenFiles, retry: async (id, options) =>{ const session = sessions.get(id); if (session?.phase === 'ready' && session.handle?.grant?.openRequest){ return resumeGrant(session, options); } if (!session || session.phase !== 'error' || session.source === null){ throw new PluginError( 'invalid-input', 'documents', `${ id} didn't fail to open; nothing to retry`, ); } const{ source, grantInput, openOptions} = session; const given = retrySourceOf(source, grantInput, options); const identity = options?.visitorIdentity !== undefined ?{ ...engineOptionsOf(openOptions).identity, ...options.visitorIdentity} : undefined; sessions.delete(id); return openDocument( given, { ...openOptions, ...(identity !== undefined ?{ identity} :{ } ), activate: false, signal: options?.signal, } , id, ); } , identify, declineIdentity, rename: (id, name) =>{ const core = store.getCore(); if (core.documents[id]){ setCore({ documents:{ ...core.documents, [id]:{ ...core.documents[id], name} } } ); } else if (core.pending[id]){ setCore({ pending:{ ...core.pending, [id]:{ ...core.pending[id], name} } } ); } const session = sessions.get(id); if (session) session.name = name; } , openAll: (initialDocuments) =>{ guardUsable('documents.openAll()'); const activeIndex = Math.max( 0, initialDocuments.findIndex((initialDocument) => initialDocument.active), ); return initialDocuments.map(({ source, active: _active, ...options} , index) =>{ try{ const{ session, done} = reserveAndOpen(source, { ...options, activate: index === activeIndex, } ); void done.catch(() =>{ } ); return session.id; } catch{ return typeof source === 'function' ? '' : (idOfInput(source) ?? ''); } } ); } , unlock: unlockDocument, close: closeDocument, closeAll: async () =>{ for (const id of [...store.getCore().order]) await closeDocument(id); } , setActive: (id) =>{ const core = store.getCore(); if (core.documents[id] || core.pending[id]) setCore({ activeId: id} ); } , getActiveId: () => store.getCore().activeId, getActive: () => getDocument(), list: listDocuments, get: getDocument, has: (id) =>{ const core = store.getCore(); return core.documents[id] !== undefined || core.pending[id] !== undefined; } , getCount: () => store.getCore().order.length, getOrder: () => store.getCore().order, setOrder: (ids) =>{ const current = store.getCore().order; const same = ids.length === current.length && [...ids].sort().join('\0') === [...current].sort().join('\0'); if (!same){ throw new PluginError( 'invalid-input', 'documents', 'setOrder() needs a permutation of the current order', ); } reorder([...ids]); } , move: (id, toIndex) =>{ const core = store.getCore(); if (!core.documents[id] && !core.pending[id]) return; const without = core.order.filter((documentId) => documentId !== id); const clamped = Math.max(0, Math.min(toIndex, without.length)); without.splice(clamped, 0, id); reorder(without); } , swap: (id, otherId) =>{ const core = store.getCore(); const index = core.order.indexOf(id); const otherIndex = core.order.indexOf(otherId); if (index < 0 || otherIndex < 0) return; const next = [...core.order]; next[index] = otherId; next[otherIndex] = id; reorder(next); } , download: (id, options) => downloadFile(id, options?.signal, 'download', (handle) => handle.download(options?.mode !== undefined ?{ mode: options.mode} : undefined), ), downloadLayer: (id, options) => downloadFile( id, options?.signal, 'downloadLayer', (handle) => (isLocalDocument(handle) ? handle.downloadLayer() : Promise.reject(noLayer())), (handle) => (isLocalDocument(handle) ? null : noLayer()), ), preparePrint: (id, options) => preparePrint(id, options), async print(id, options ={ } ){ const prepared = await preparePrint(id, options); try{ await prepared.print(options.signal ?{ signal: options.signal} : undefined); } finally{ prepared.destroy(); } } , getPrintQuality: (id) => printQualityOf(id), canDownload: (id) => allowsOn(id, 'doc.download'), canPrint: (id) => canPrintOn(id), listPages: (id) => metaOf(id)?.pages ?? EMPTY_PAGES, getPage: (page, id) => findPage(metaOf(id)?.pages ?? EMPTY_PAGES, page), getPageIndex: (ref, id) => metaOf(id)?.pages.findIndex((pageInfo) => pageRefsEqual(pageInfo.ref, ref)) ?? -1, getRevision: (id) => metaOf(id)?.pagesSequence ?? -1, onOpened: opened.on, onOpenFailed: openFailed.on, onLocked: locked.on, onClosed: closed.on, onActiveChanged: activeChanged.on, onPagesChanged: pagesChanged.on, onUnsavedChangesChanged: unsavedChangesChanged.on, } ; workspaceCapabilities.set(DocumentsToken, documents); for (const plugin of plan.ordered){ if (!isDocumentScoped(plugin)){ workspaceLeases.set(plugin, store.lease(plugin.id, initialStateOf(plugin))); } } for (const plugin of plan.ordered){ if (isDocumentScoped(plugin)) continue; const ctx = createPluginContext( services, plugin, undefined, workspaceCancel.signal, workspaceScope, ); const{ api, connect} = plugin.create(ctx); if (plugin.token) workspaceCapabilities.set(plugin.token, api); workspaceConnectors.set(plugin, () =>{ connect?.(); markConnected(ctx); } ); } return{ ...viewerSettings.api, engine, documents, capability: resolveCapability, tryCapability: tryResolveCapability, scopeOf: plan.scopeOf, settingsOf, subscribe: store.subscribe, getState: store.getState, getStatus: () => status, start: () =>{ if (status === 'destroying' || status === 'destroyed' || status === 'failed'){ return Promise.reject(new Error(`[kernel] start() on a ${ status} kernel`)); } return (startPromise ??= (async () =>{ status = 'starting'; try{ for (const plugin of plan.ordered){ if (status !== 'starting') return; if (!isDocumentScoped(plugin)) workspaceConnectors.get(plugin)?.(); } status = 'started'; } catch (error){ status = 'failed'; await workspaceScope.destroy(); workspaceCapabilities.clear(); throw error; } } )()); } , destroy: () =>{ return (destroyPromise ??= (async () =>{ const wasFailed = status === 'failed'; status = 'destroying'; workspaceCancel.abort(new CancelledError('kernel destroyed')); await startPromise?.catch((error) =>{ if (!isCancelled(error) && !wasFailed) report(error); } ); await Promise.allSettled([...sessions.values()].map((session) => session.close())); sessions.clear(); await workspaceScope.destroy(); workspaceCapabilities.clear(); store.destroy(); status = 'destroyed'; } )()); } , } ; } createLatestLane [FunctionDeclaration] (from packages/core/main/src/lanes.ts): export function createLatestLane( lifetime: AbortSignal, capability: string, name: string, ): LatestLane{ let generation = 0; let active: AbortController | null = null; const closed = () => new PluginError('instance-closed', capability, `${ name} : instance closed`); const cancelled = (id: string, why: string) => new PluginError('operation-cancelled', capability, `${ name} : ${ why} `, { details:{ runId: id, reason: why} , } ); return{ get running(){ return active !== null; } , cancel(reason){ active?.abort(reason ?? 'cancelled'); active = null; } , async run(fn, options){ if (lifetime.aborted) throw closed(); if (options?.signal?.aborted) throw cancelled(`${ name} #${ generation + 1} `, 'cancelled before start'); const mine = ++generation; const id = `${ name} #${ mine} `; const controller = new AbortController(); const previous = active; active = controller; const onLifetime = () => controller.abort('instance-closed'); const onCaller = () => controller.abort('cancelled'); lifetime.addEventListener('abort', onLifetime, { once: true} ); options?.signal?.addEventListener('abort', onCaller, { once: true} ); const current = () => mine === generation && !controller.signal.aborted; const run: LatestRun ={ id, signal: controller.signal, get superseded(){ return mine !== generation; } , commit(commitFn){ if (!current()) return false; commitFn(); return true; } , } ; try{ previous?.abort('superseded'); if (!current()) throw cancelled(id, 'superseded'); const value = await fn(run); if (!current()) throw cancelled(id, String(controller.signal.reason ?? 'superseded')); return value; } catch (error){ if (lifetime.aborted) throw closed(); if (!current()) throw cancelled(id, String(controller.signal.reason ?? 'superseded')); throw toPluginError(capability, error); } finally{ lifetime.removeEventListener('abort', onLifetime); options?.signal?.removeEventListener('abort', onCaller); if (active === controller) active = null; } } , } ; } createScrollHandler [FunctionDeclaration] (from packages/plugin/stage/src/scroll-handler.ts): export function createScrollHandler( stage: StageCapability, interaction: InteractionHostCapability, options: ScrollHandlerOptions ={ } , ): InteractionHandler{ const panFallback = options.panFallback ?? true; let last ={ x: 0, y: 0} ; const isPanTool = (): boolean => interaction.getActiveTool().enables.has('scroll'); return{ id: 'stage-scroll', priority: 10, enabledFor: (tool) => tool.enables.has('scroll') || (panFallback && tool.gapCursor === undefined), onPointerDown: (sample) =>{ if (!isPanTool() && sample.page) return false; last = sample.viewport; interaction.claimCursor('stage-grab', 'grabbing', 40); return true; } , onPointerMove: (sample) =>{ stage.panBy(sample.viewport.x - last.x, sample.viewport.y - last.y); last = sample.viewport; } , onPointerUp: () => interaction.claimCursor('stage-grab', null), onHover: (sample) =>{ if (panFallback && !isPanTool()){ interaction.claimCursor('stage-pan-fallback', sample.page ? null : 'grab', 5); } } , } ; } createSelectionHandleDrag [FunctionDeclaration] (from packages/plugin/selection/src/handles.ts): export function createSelectionHandleDrag( selection: SelectionHandleTarget, view: SelectionHandleView, opposite: SelectionHandleEndpoint, draggedPage: PageRef, ): SelectionHandleDragSession{ const quad = opposite.glyphQuad; const anchorPoint = midpoint( midpoint(quad.upperLeft, quad.lowerRight), midpoint(quad.upperRight, quad.lowerLeft), ); let begun = false; let lastPage = draggedPage; return{ move: (overlay) =>{ if (!begun){ if (!selection.beginGestureAt(opposite.page, anchorPoint)) return; begun = true; } const hit = view.pageAt(overlay); if (hit){ lastPage = hit.ref; selection.extendTo(hit.ref, hit.point); } else{ const point = view.pointOnPage(lastPage, overlay); if (point) selection.extendTo(lastPage, point); } } , end: () =>{ if (begun) selection.endGesture(); } , } ; } createSerialQueue [FunctionDeclaration] (from packages/core/main/src/serial-queue.ts): export function createSerialQueue(capability: string): SerialQueue{ let tail: Promise = Promise.resolve(); const queue = (operation: () => Promise, options?: OperationOptions): Promise =>{ const start = (): Promise => options?.signal?.aborted ? Promise.reject( new PluginError('operation-cancelled', capability, 'cancelled before it started', { cause: options.signal.reason, } ), ) : operation(); const result = tail.then(start, start); tail = result.then( () => undefined, () => undefined, ); return result; } ; return Object.assign(queue, { idle: () => tail} ); } createTestCertificateAuthority [FunctionDeclaration] (from packages/core/signature/src/signers/test-authority.ts): export async function createTestCertificateAuthority( options:{ commonName?: string; url?: string; now?: () => Date} ={ } , ): Promise{ ensureEngine(); const now = options.now ?? (() => new Date()); const url = (options.url ?? 'http://test-authority.example').replace(/\/$/, ''); const addresses ={ ocsp: `${ url} /ocsp`, crl: `${ url} /crl`, issuer: `${ url} /issuer`} ; const commonName = options.commonName ?? 'EmbedPDF test certificate authority'; const dates = () => ({ notBefore: new Date(now().getTime() - DAY), notAfter: new Date(now().getTime() + 365 * DAY), } ); const rootKeys = await generateSigningKeyPair('RSA-PKCS1-v1_5', 'sha256', true); const root: Issuer ={ certificate: await issueCertificate({ kind: 'authority', commonName, publicKey: rootKeys.publicKey, privateKey: rootKeys.privateKey, ...dates(), } ), privateKey: rootKeys.privateKey, } ; const responderKeys = await generateSigningKeyPair('RSA-PKCS1-v1_5', 'sha256', true); const responder: Issuer ={ certificate: await issueCertificate({ kind: 'responder', commonName: `${ commonName} (OCSP responder)`, publicKey: responderKeys.publicKey, issuer: root, ...dates(), } ), privateKey: responderKeys.privateKey, } ; const der = (certificate: pkijs.Certificate) => new Uint8Array(certificate.toSchema(true).toBER(false)); const rootDer = der(root.certificate); const issued: pkijs.Certificate[] = []; const unrevocableOnes = new Set(); const revoked = new Map(); const serialOf = (certificate: pkijs.Certificate) => new Uint8Array(certificate.serialNumber.valueBlock.valueHexView); const bySerial = (serial: Uint8Array) => issued.find((certificate) => bytesEqual(serialOf(certificate), serial)) ?? null; const answer = async (request: RevocationRequest): Promise =>{ if (!request.url.startsWith(url)){ throw new Error(`the test certificate authority does not answer at ${ request.url} `); } if (request.kind === 'issuer') return rootDer; if (request.kind === 'crl'){ return buildCrl({ issuer: root, thisUpdate: now(), nextUpdate: new Date(now().getTime() + 7 * DAY), revoked: [...revoked].map(([certificate, entry]) => ({ serialNumber: certificate.serialNumber, at: entry.at, reason: entry.reason, } )), } ); } const parsed = asn1js.fromBER(toArrayBuffer(request.body)); if (parsed.offset === -1) throw new Error('the OCSP request is not valid DER'); const asked = new pkijs.OCSPRequest({ schema: parsed.result} ).tbsRequest.requestList[0]; if (!asked) throw new Error('the OCSP request asks about no certificate'); const certificate = bySerial( new Uint8Array(asked.reqCert.serialNumber.valueBlock.valueHexView), ); const entry = certificate ? revoked.get(certificate) : undefined; return buildOcspResponse({ certificate: certificate ?? root.certificate, issuer: root.certificate, asked: asked.reqCert, signer: responder, status: !certificate ? 'unknown' : entry ?{ revokedAt: entry.at, reason: entry.reason} : 'good', producedAt: now(), thisUpdate: now(), nextUpdate: new Date(now().getTime() + HOUR), } ); } ; return{ certificate: rootDer, async issueSigner(signerOptions ={ } ){ const hash = signerOptions.hash ?? 'sha256'; const keys = await generateSigningKeyPair( signerOptions.algorithm ?? 'RSA-PKCS1-v1_5', hash, true, ); const{ unrevocable} = signerOptions; const certificate = await issueCertificate({ kind: 'signer', commonName: signerOptions.commonName ?? 'EmbedPDF test signer', publicKey: keys.publicKey, issuer: root, addresses: unrevocable ?{ issuer: addresses.issuer} : addresses, ...(unrevocable ?{ unrevocable} :{ } ), ...dates(), } ); issued.push(certificate); if (unrevocable) unrevocableOnes.add(certificate); const leaf = der(certificate); const signer = webCryptoSigner({ privateKey: keys.privateKey, certificateChain: [leaf, rootDer], hash, } ); return{ ...signer, certificate: leaf, privateKey: keys.privateKey} ; } , revocation:{ fetch: answer} , revoke(signer, revokeOptions ={ } ){ const bytes = signer instanceof Uint8Array ? signer : signer.certificate; const certificate = issued.find((candidate) => bytesEqual(der(candidate), bytes)); if (!certificate){ throw new Error('the test certificate authority did not issue this certificate'); } if (unrevocableOnes.has(certificate)){ throw new Error('this certificate was issued as one that cannot be withdrawn'); } revoked.set(certificate, { at: revokeOptions.at ?? now(), reason: revokeOptions.reason ?? null, } ); } , } ; } createTestSigner [FunctionDeclaration] (from packages/core/signature/src/signers/webcrypto.ts): export async function createTestSigner( options:{ commonName?: string; algorithm?: 'RSA-PKCS1-v1_5' | 'RSA-PSS' | 'ECDSA'; hash?: 'sha256' | 'sha384' | 'sha512'; } ={ } , ): Promise{ const{ selfSignedCertificate} = await import('./self-signed'); const hash = options.hash ?? 'sha256'; const keys = await generateSigningKeyPair(options.algorithm ?? 'RSA-PKCS1-v1_5', hash, true); const certificate = await selfSignedCertificate({ publicKey: keys.publicKey, privateKey: keys.privateKey, commonName: options.commonName ?? 'EmbedPDF test signer', hash, } ); const signer = webCryptoSigner({ privateKey: keys.privateKey, certificateChain: [certificate], hash, } ); return{ ...signer, certificate, privateKey: keys.privateKey} ; } createTestTimestampAuthority [FunctionDeclaration] (from packages/core/signature/src/signers/webcrypto.ts): export async function createTestTimestampAuthority( options:{ commonName?: string} ={ } , ): Promise{ const{ timestampAuthorityCertificate} = await import('./self-signed'); const keys = await generateSigningKeyPair('RSA-PKCS1-v1_5', 'sha256', true); const certificate = await timestampAuthorityCertificate({ publicKey: keys.publicKey, privateKey: keys.privateKey, commonName: options.commonName ?? 'EmbedPDF test timestamp authority', hash: 'sha256', } ); const authority = webCryptoSigner({ privateKey: keys.privateKey, certificateChain: [certificate], } ); const{ buildTimestampToken} = await import('../cms/timestamp'); return{ kind: 'cms', certificate, sign: ({ digest, algorithm} ) => buildTimestampToken({ digest, hash: algorithm, authority} ), } ; } createZoomDragHandler [FunctionDeclaration] (from packages/plugin/stage/src/zoom-drag-handler.ts): export function createZoomDragHandler( stage: StageHostCapability, interaction: InteractionHostCapability, ): InteractionHandler{ return{ id: 'stage-zoom-drag', priority: 10, enabledFor: (tool) => tool.enables.has('zoom-box'), onPointerDown: (sample) =>{ if (sample.source !== stage.getLensId()) return false; stage.beginZoomDrag(sample.viewport); return true; } , onPointerMove: (sample) => stage.moveZoomDrag(sample.viewport), onPointerUp: (sample) => stage.endZoomDrag({ zoomOut: sample.modifiers.alt} ), onPointerCancel: () => stage.cancelZoomDrag(), onHover: (sample) => interaction.claimCursor('stage-zoom-out', sample.modifiers.alt ? 'zoom-out' : null), } ; } custom [FunctionDeclaration] (from packages/core/ui/src/schema.ts): export function custom( slot: string, terminal?: string, options?: Omit, ): CustomItem{ return terminal === undefined ?{ slot, ...options} :{ slot, terminal, ...options} ; } decodePageKey [FunctionDeclaration] (from packages/engine/core/src/identity/PageRef.ts): export function decodePageKey(key: string): PageRef | null{ if (!key.startsWith('obj:')) return null; const rest = key.slice('obj:'.length); const n = Number.parseInt(rest, 10); if (!Number.isInteger(n) || n <= 0 || String(n) !== rest) return null; return{ kind: 'objectNumber', objectNumber: n} ; } definePlugin [FunctionDeclaration] (from packages/core/main/src/index.ts): export function definePlugin< State = void, Capability = unknown, Settings extends object = NoSettings, >( definition: PluginDefinition, ): PluginDefinition{ return definition; } defineState [FunctionDeclaration] (from packages/core/main/src/state.ts): export function defineState( token: CapabilityToken, declaration:{ readonly read: (capability: Capability) => State; readonly empty: NoInfer; readonly ensure?: (capability: NoInfer) => Promise; } , ): StateDeclaration{ return{ token, read: declaration.read, empty: Object.freeze(declaration.empty), ...(declaration.ensure ?{ ensure: declaration.ensure} :{ } ), } ; } displayNameOf [FunctionDeclaration] (from packages/plugin/attachment/src/names.ts): export function displayNameOf(file:{ readonly name: string} ): string{ return file.name.replace(HIDDEN, '').trim() || 'attachment'; } documentCommands [VariableDeclaration] (from packages/framework/react/src/command-lists.ts): documentCommands = createDocumentCommands(standardCommandsBrowser) documentState [VariableDeclaration] (from packages/core/main/src/documents-state.ts): documentState = defineState(DocumentsToken, { read: (documents): DocumentInfo => documents.get() ?? NO_DOCUMENT, empty: NO_DOCUMENT, } ) documentsState [VariableDeclaration] (from packages/core/main/src/documents-state.ts): documentsState = defineState(DocumentsToken, { read: (documents): DocumentsState => ({ documents: documents.list(), activeId: documents.getActiveId(), } ), empty:{ documents: [], activeId: null} , } ) encodePageKey [FunctionDeclaration] (from packages/engine/core/src/identity/PageRef.ts): export function encodePageKey(ref: PageRef): string{ if (!isValidPageObjectNumber(ref.objectNumber)){ throw new RangeError( `encodePageKey: objectNumber must be a positive integer, got ${ ref.objectNumber} `, ); } return `obj:${ ref.objectNumber} `; } epdfTheme [FunctionDeclaration] (from packages/framework/react/src/theme.ts): export function epdfTheme(theme: EpdfTheme): React.CSSProperties{ return epdfThemeVariables(theme) as React.CSSProperties; } eventOf [VariableDeclaration] (from packages/plugin/actions/src/contract.ts): eventOf = (trigger: ActionTrigger): ActionTriggerEvent =>{ switch (trigger.type){ case 'activate': return{ type: 'activate'} ; case 'annotation': return{ type: 'annotation', event: trigger.event} ; case 'page': return{ type: 'page', event: trigger.event} ; case 'document': return{ type: 'document', event: trigger.event} ; } } feedbackPlugin [VariableDeclaration] (from packages/plugin/interaction/src/feedback.ts): feedbackPlugin = (options: FeedbackPluginOptions ={ } ) => definePlugin({ id: 'feedback', scope: 'workspace', token: FeedbackToken, create: () => ({ api: options.provider ?? NOOP} ), } ) filePickerProvider [VariableDeclaration] (from packages/framework/react/src/annotation.tsx): filePickerProvider: FilePickerProvider = pickRequestedFile fontsPlugin [VariableDeclaration] (from packages/plugin/fonts/src/fonts.plugin.ts): fontsPlugin = () => definePlugin({ id: 'fonts', token: FontsToken, scope: 'document', create: createFontsController, } ) fontsState [VariableDeclaration] (from packages/plugin/fonts/src/state.ts): fontsState = defineState(FontsToken, { read: (fonts) => ({ fonts: fonts.getFontList(), status: fonts.getStatus(), } ), empty:{ fonts: null, status: 'idle', } , ensure: (fonts) => fonts.ensureLoaded(), } ) formPlugin [VariableDeclaration] (from packages/plugin/form/src/form.plugin.ts): formPlugin = (config?: FormConfig) => definePlugin({ id: 'form', token: FormToken, scope: 'document', requires: [InteractionToken], optional: [AnnotationToken, ActionsToken, RenderToken, FontsToken], state: initialFormModel, settings:{ defaults: FORM_DEFAULTS, registered: config} , create: createFormController, } ) formState [VariableDeclaration] (from packages/plugin/form/src/state.ts): formState = defineState(FormToken, { read: (form): FormState => ({ fields: form.list(), status: form.getStatus(), formKind: form.getFormKind(), selectedField: form.getSelectedField(), focusedField: form.getFocusedField(), } ), empty:{ fields: NO_FIELDS, status: 'idle', formKind: 'none', selectedField: null, focusedField: null, } , } ) formatShortcut [FunctionDeclaration] (from packages/framework/react/src/commands.ts): export function formatShortcut(shortcut: string, options:{ isMac?: boolean} ={ } ): string{ return formatKeys(shortcut, { isMac: options.isMac ?? isMacPlatform()} ); } gesturePlacement [FunctionDeclaration] (from packages/core/annotation/src/placement.ts): export function gesturePlacement( form: GestureForm, from: Point, to: Point, clickCreate: ClickCreate | false | undefined, frame: PlacementFrame ={ } , ): Placement | null{ if (!isDrag(form, from, to)){ return clickCreate ? resolveClickPlacement(from, clickCreate, frame) : null; } const a = frame.pageBox ? clampPointToBox(from, frame.pageBox) : from; const b = frame.pageBox ? clampPointToBox(to, frame.pageBox) : to; if (form === 'segment') return{ kind: 'segment', a, b} ; const rot = uprightTurn(frame); const dragged = rectFromPoints(a, b); return{ kind: 'box', rect: rot % 180 ? transposedAboutCenter(dragged) : dragged, rot} ; } group [FunctionDeclaration] (from packages/core/ui/src/schema.ts): export function group( id: string, items: readonly BarChild[], options?: Omit, ): BarGroup{ return{ id, ...options, items} ; } guardHandle [FunctionDeclaration] (from packages/core/main/src/guarded-handle.ts): export function guardHandle( handle: DocumentHandle, lifetime: GuardedLifetime, capability: string, ): DocumentHandle{ const cache = new WeakMap(); const closedError = () => new PluginError( 'instance-closed', capability, `document instance ${ lifetime.instanceId} was closed`, ); const guardPromise = (pending: PromiseLike): Promise =>{ const abortable = pending as PromiseLike &{ abort?: (reason?: unknown) => void} ; const guarded = new Promise((resolve, reject) =>{ const onAbort = () =>{ abortable.abort?.(lifetime.signal.reason); reject(closedError()); } ; if (lifetime.signal.aborted){ onAbort(); } else{ lifetime.signal.addEventListener('abort', onAbort, { once: true} ); } Promise.resolve(pending).then( (value) =>{ lifetime.signal.removeEventListener('abort', onAbort); if (!lifetime.signal.aborted) resolve(value); } , (error) =>{ lifetime.signal.removeEventListener('abort', onAbort); if (!lifetime.signal.aborted) reject(toPluginError(capability, error)); } , ); } ); if (typeof abortable.abort === 'function'){ Object.defineProperty(guarded, 'abort', { value: (reason?: unknown) => abortable.abort!(reason), enumerable: false, } ); } return guarded; } ; const wrapFunction = (fn: (...args: unknown[]) => unknown, target: object) => function guardedCall(...args: unknown[]): unknown{ let result: unknown; try{ result = fn.apply(target, args); } catch (error){ throw toPluginError(capability, error); } if (isPromiseLike(result)) return guardPromise(result); return wrapValue(result, target); } ; const wrapValue = (value: unknown, target: object): unknown =>{ if (typeof value === 'function') return wrapFunction(value as (...args: unknown[]) => unknown, target); if (isPlainWrappable(value)) return wrapObject(value); return value; } ; const wrapObject = (target: object): object =>{ let proxy = cache.get(target); if (!proxy){ proxy = new Proxy(target, { get(proxyTarget, property){ return wrapValue(Reflect.get(proxyTarget, property, proxyTarget), proxyTarget); } , } ); cache.set(target, proxy); } return proxy; } ; return wrapObject(handle) as DocumentHandle; } historyCommands [VariableDeclaration] (from packages/framework/react/src/command-lists.ts): historyCommands = createHistoryCommands() historyPlugin [VariableDeclaration] (from packages/plugin/history/src/history.plugin.ts): historyPlugin = (config?: HistoryConfig) => definePlugin({ id: 'history', token: HistoryToken, scope: 'document', state: emptyHistory, settings:{ defaults: HISTORY_DEFAULTS, registered: config} , create: createHistoryController, } ) historyState [VariableDeclaration] (from packages/plugin/history/src/state.ts): historyState = defineState(HistoryToken, { read: (history): HistoryState => ({ canUndo: history.canUndo(), canRedo: history.canRedo(), undoLabel: history.getUndoLabel(), redoLabel: history.getRedoLabel(), } ), empty:{ canUndo: false, canRedo: false, undoLabel: null, redoLabel: null, } , } ) httpRevocationSource [FunctionDeclaration] (from packages/core/signature/src/revocation/http-source.ts): export function httpRevocationSource(options: HttpRevocationSourceOptions): RevocationSource{ const{ url: route, timeoutMs = 10_000, retries = 1} = options; async function ask(request: RevocationRequest): Promise{ const send = options.fetch ?? globalThis.fetch; const details = (more: Record ={ } ) => ({ source: request.url, route, ...more, } ); const noAnswer = (why: string, cause?: unknown) => new EngineError( EngineErrorCode.Network, `${ request.url} did not answer through ${ route} : ${ why} `, { details: details(), cause} , ); const payload: RevocationRouteRequest ={ kind: request.kind, url: request.url, ...(request.kind === 'ocsp' ?{ body: toBase64(request.body)} :{ } ), } ; const timeout = new AbortController(); const timer = setTimeout(() => timeout.abort(), timeoutMs); try{ let response: Response; try{ response = await send(route, { method: 'POST', headers:{ 'content-type': 'application/json', ...options.headers} , body: JSON.stringify(payload), signal: timeout.signal, } ); } catch (error){ if (timeout.signal.aborted) throw noAnswer(`no reply within ${ timeoutMs} ms`, error); throw noAnswer((error as Error).message, error); } if (response.status >= 500 || response.status === 429){ throw noAnswer(`HTTP ${ response.status} ${ await said(response)} `); } if (!response.ok){ const refusal = await refusalOf(response); throw new EngineError( EngineErrorCode.SignatureRefused, `the route at ${ route} refused to ask ${ request.url} : ${ refusal.message ?? `HTTP ${ response.status} `} `, { details: details({ httpStatus: response.status, reason: refusal.reason} )} , ); } try{ return new Uint8Array(await response.arrayBuffer()); } catch (error){ throw noAnswer( timeout.signal.aborted ? `no reply within ${ timeoutMs} ms` : `the reply broke off: ${ (error as Error).message} `, error, ); } } finally{ clearTimeout(timer); } } return{ async fetch(request){ for (let attempt = 0; ; attempt++){ try{ return await ask(request); } catch (error){ const noAnswer = EngineError.is(error, EngineErrorCode.Network); if (!noAnswer || attempt >= retries) throw error; await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS)); } } } , } ; } httpTimestampAuthority [FunctionDeclaration] (from packages/core/signature/src/signers/timestamp-http.ts): export function httpTimestampAuthority(options: HttpTimestampAuthorityOptions): CmsSigner{ const{ url, policy, timeoutMs = 10_000, retries = 1} = options; const details = (more: Record ={ } ) => ({ authority: url, ...more} ); const refused = (message: string, more: Record, cause?: unknown) => new EngineError(EngineErrorCode.SignatureRefused, message, { details: details(more), cause} ); const wrongAnswer = (reason: CompletionRefusal, what: string) => refused(`the timestamp authority at ${ url} ${ what} `, { reason} ); async function ask(query: Uint8Array): Promise{ const send = options.fetch ?? globalThis.fetch; const noAnswer = (why: string, cause?: unknown) => new EngineError( EngineErrorCode.Network, `the timestamp authority at ${ url} did not answer: ${ why} `, { details: details(), cause} , ); const timeout = new AbortController(); const timer = setTimeout(() => timeout.abort(), timeoutMs); try{ let response: Response; try{ response = await send(url, { method: 'POST', headers:{ 'content-type': 'application/timestamp-query', ...options.headers} , body: new Uint8Array(query), signal: timeout.signal, } ); } catch (error){ if (timeout.signal.aborted) throw noAnswer(`no reply within ${ timeoutMs} ms`, error); const hint = 'document' in globalThis ? '. In a browser most authorities cannot be called directly: call yours through a route on your own server' : ''; throw noAnswer(`${ (error as Error).message} ${ hint} `, error); } if (response.status >= 500 || response.status === 429){ throw noAnswer(`HTTP ${ response.status} `); } if (!response.ok){ throw refused( `the timestamp authority at ${ url} refused the request: HTTP ${ response.status} `, { httpStatus: response.status} , ); } try{ return new Uint8Array(await response.arrayBuffer()); } catch (error){ throw noAnswer( timeout.signal.aborted ? `no reply within ${ timeoutMs} ms` : `the reply broke off: ${ (error as Error).message} `, error, ); } } finally{ clearTimeout(timer); } } return{ kind: 'cms', hash: options.hash ?? 'sha256', async sign({ digest, algorithm, subFilter} ){ if (subFilter !== 'ETSI.RFC3161'){ throw new EngineError( EngineErrorCode.InvalidArg, "a timestamp authority can't sign a document: pass it as `timestampAuthority`, or sign with `kind: 'timestamp'`", { details: details()} , ); } const [protocol, parse, timestamp, engine] = await Promise.all([ import('../cms/timestamp-protocol'), import('../cms/parse'), import('../cms/timestamp'), import('../cms/engine'), ]); const nonce = engine.randomPositiveInteger(); const query = protocol.buildTimestampRequest({ digest, algorithm, policy, nonce} ); let reply: Uint8Array; for (let attempt = 0; ; attempt++){ try{ reply = await ask(query); break; } catch (error){ const noAnswer = EngineError.is(error, EngineErrorCode.Network); if (!noAnswer || attempt >= retries) throw error; await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY_MS)); } } let response; try{ response = protocol.readTimestampResponse(reply); } catch (error){ throw refused( `the timestamp authority at ${ url} sent a reply that can't be read: ${ (error as Error).message} `, { reason: 'malformed'} , error, ); } if (!response.granted){ const said = [response.failInfo, response.statusText].filter(Boolean).join(': '); throw refused( `the timestamp authority at ${ url} refused the request${ said ? ` (${ said} )` : ''} `, { failInfo: response.failInfo} , ); } if (!response.token) throw wrongAnswer('malformed', 'granted the request but sent no token'); let info; try{ info = timestamp.readTimestampInfo( parse.readCmsParts(response.token, 'tst-info').eContent!, ); } catch (error){ throw refused( `the timestamp authority at ${ url} sent a token that can't be read: ${ (error as Error).message} `, { reason: 'malformed'} , error, ); } if (info.imprintAlgorithm !== algorithm){ throw wrongAnswer( 'algorithm-mismatch', `stamped a ${ info.imprintAlgorithm} digest where ${ algorithm} was asked for`, ); } if (!engine.bytesEqual(info.imprint, digest)){ throw wrongAnswer('digest-mismatch', 'stamped another digest than the one it was sent'); } if (!info.nonce || !engine.bytesEqual(info.nonce, timestamp.withoutLeadingZeros(nonce))){ throw wrongAnswer( 'profile-violation', "sent a token that doesn't answer this request: its nonce is not the one sent", ); } if (policy && info.policy !== policy){ throw wrongAnswer( 'profile-violation', `issued the token under policy ${ info.policy} where ${ policy} was asked for`, ); } return response.token; } , } ; } i18nPlugin [VariableDeclaration] (from packages/plugin/i18n/src/i18n.plugin.ts): i18nPlugin = (config?: I18nConfig) => definePlugin({ id: 'i18n', scope: 'workspace', token: I18nToken, state: initialI18nModel, settings:{ defaults: I18N_DEFAULTS, registered: config} , create: createI18nController, } ) i18nState [VariableDeclaration] (from packages/plugin/i18n/src/state.ts): i18nState = defineState(I18nToken, { read: (i18n): I18nState => ({ locale: i18n.getLocale(), direction: i18n.getDirection(), locales: i18n.listLocales(), loading: i18n.getLoadingLocale(), } ), empty:{ locale: 'en', direction: 'ltr', locales: [], loading: null} , } ) indexedDbByteStore [FunctionDeclaration] (from packages/framework/web/src/byte-store.ts): export function indexedDbByteStore( dbName: string, options: IndexedDbByteStoreOptions ={ } , ): ByteStore{ const storeName = options.storeName ?? 'bytes'; const open = (): Promise => new Promise((resolve, reject) =>{ const request = indexedDB.open(dbName, 1); request.onupgradeneeded = () =>{ if (!request.result.objectStoreNames.contains(storeName)){ request.result.createObjectStore(storeName); } } ; request.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error ?? new Error('indexedDB.open failed')); } ); const run = async ( mode: IDBTransactionMode, body: (store: IDBObjectStore) => IDBRequest, ): Promise =>{ const db = await open(); try{ return await new Promise((resolve, reject) =>{ const request = body(db.transaction(storeName, mode).objectStore(storeName)); request.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error ?? new Error('indexedDB request failed')); } ); } finally{ db.close(); } } ; return{ list: async () =>{ const keys = await run('readonly', (store) => store.getAllKeys()); const values = await run('readonly', (store) => store.getAll()); return keys.map((key, i) => ({ id: String(key), bytes: new Uint8Array(values[i])} )); } , put: (id, bytes) => run('readwrite', (store) => store.put(new Uint8Array(bytes), id)).then(() => undefined), delete: (id) => run('readwrite', (store) => store.delete(id)).then(() => undefined), } ; } indexedDbKeyStore [FunctionDeclaration] (from packages/core/signature/src/signers/personal.ts): export function indexedDbKeyStore( dbName: string, options:{ storeName?: string} ={ } , ): PersonalKeyStore{ const storeName = options.storeName ?? 'keys'; let opening: Promise | null = null; const open = (): Promise =>{ opening ??= new Promise((resolve, reject) =>{ const request = indexedDB.open(dbName, 1); request.onupgradeneeded = () =>{ if (!request.result.objectStoreNames.contains(storeName)){ request.result.createObjectStore(storeName); } } ; request.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error ?? new Error('indexedDB open failed')); } ); return opening; } ; const run = async ( mode: IDBTransactionMode, op: (store: IDBObjectStore) => IDBRequest, ): Promise =>{ const db = await open(); return new Promise((resolve, reject) =>{ const tx = db.transaction(storeName, mode); const request = op(tx.objectStore(storeName)); request.onsuccess = () => resolve(request.result); request.onerror = () => reject(request.error ?? new Error('indexedDB request failed')); } ); } ; return{ load: async (subject) => ((await run('readonly', (store) => store.get(subject))) as PersonalKeyRecord | undefined) ?? null, save: (subject, record) => run('readwrite', (store) => store.put(record, subject)).then(() => undefined), remove: (subject) => run('readwrite', (store) => store.delete(subject)).then(() => undefined), } ; } interactionCommands [VariableDeclaration] (from packages/framework/react/src/command-lists.ts): interactionCommands = createInteractionCommands() interactionPlugin [VariableDeclaration] (from packages/plugin/interaction/src/interaction.plugin.ts): interactionPlugin = (config?: InteractionConfig) => definePlugin({ id: 'interaction', token: InteractionToken, scope: 'document', state: initialInteractionModel, settings:{ defaults: INTERACTION_DEFAULTS, registered: config} , create: (ctx) => createInteractionController(ctx, builtinTools()), } ) interactionState [VariableDeclaration] (from packages/plugin/interaction/src/state.ts): interactionState = defineState(InteractionToken, { read: (interaction): InteractionState => ({ activeToolId: interaction.getActiveToolId(), tools: interaction.listTools(), } ), empty:{ activeToolId: null, tools: []} , } ) interpolate [FunctionDeclaration] (from packages/plugin/i18n/src/contract.ts): export function interpolate( text: string, params?: Readonly>, ): string{ if (!params) return text; return text.replace(/\{ (\w+)\} /g, (match, slot: string) => params[slot] !== undefined ? String(params[slot]) : match, ); } isCancelled [VariableDeclaration] (from packages/core/main/src/scope.ts): isCancelled = (error: unknown): error is CancelledError => error instanceof CancelledError isLocalEngine [FunctionDeclaration] (from packages/engine/core/src/engine/LocalEngine.ts): export function isLocalEngine(engine: Engine): engine is LocalEngine{ return hasLocalEngineBrand(engine); } isPdf [FunctionDeclaration] (from packages/core/main/src/pdf-header.ts): export function isPdf(bytes: Uint8Array): boolean{ const end = Math.min(bytes.length - PDF_HEADER.length, 1024); for (let start = 0; start <= end; start++){ if (PDF_HEADER.every((byte, index) => bytes[start + index] === byte)) return true; } return false; } isPluginError [FunctionDeclaration] (from packages/core/main/src/errors.ts): export function isPluginError(value: unknown, code?: PluginErrorCode): value is PluginError{ if (!(value instanceof PluginError)) return false; return code === undefined || value.code === code; } isReadMember [FunctionDeclaration] (from packages/core/main/src/capability-handle.ts): export function isReadMember(name: string): boolean{ return READ.test(name); } item [FunctionDeclaration] (from packages/core/ui/src/schema.ts): export function item(command: string, options?: Omit): BarItem{ return{ command, ...options} ; } kindNamed [FunctionDeclaration] (from packages/core/annotation/src/kinds/index.ts): export function kindNamed(name: string): AnnotationKind{ const kind = KINDS[name]; if (kind) return kind; let shown = shownOnly.get(name); if (!shown){ shown ={ name, family: boxFamily, style: plainStyle, caps:{ ...NO_CAPS, rasterOnly: true} , properties: [], } ; shownOnly.set(name, shown); } return shown; } linkPlugin [VariableDeclaration] (from packages/plugin/link/src/link.plugin.ts): linkPlugin = () => definePlugin({ id: 'link', token: LinkToken, scope: 'document', requires: [InteractionToken], optional: [StageToken, AnnotationToken, ActionsToken], create: createLinkController, } ) makePageContext [FunctionDeclaration] (from packages/framework/web/src/page-context.ts): export function makePageContext( documentId: string, view: string, ref: PageRef, pageIndex: number, frame: PageFrameShape, transform: Transform, getRect: () => ClientBox, getViewDemand?: () => Demand, ): PageContext{ return{ documentId, view, ref, pageIndex, frame, transform, ...(getViewDemand ?{ getViewDemand} :{ } ), ...pageClientSpace(() => transform, getRect), } ; } markRoleOf [VariableDeclaration] (from packages/plugin/signature/src/contract.ts): markRoleOf = (asset: Pick): MarkRole => asset.name === INITIALS_MARK_NAME ? 'initials' : 'signature' matchesQuery [VariableDeclaration] (from packages/plugin/stage/src/responsive.ts): matchesQuery = (query: BoxQuery, box: StageBox): boolean => (query.minWidth === undefined || box.width >= query.minWidth) && (query.maxWidth === undefined || box.width <= query.maxWidth) && (query.minHeight === undefined || box.height >= query.minHeight) && (query.maxHeight === undefined || box.height <= query.maxHeight) && (query.orientation === undefined || box.orientation === query.orientation) measurementPlugin [VariableDeclaration] (from packages/plugin/measurement/src/measurement.plugin.ts): measurementPlugin = (config?: MeasurementConfig) => definePlugin({ id: 'measurement', scope: 'document', token: MeasurementToken, requires: [AnnotationToken, InteractionToken], state: initialMeasurementModel, settings:{ defaults: MEASUREMENT_DEFAULTS, registered: config, whole: ['defaultScale']} , create: createMeasurementController, } ) measurementState [VariableDeclaration] (from packages/plugin/measurement/src/state.ts): measurementState = defineState(MeasurementToken, { read: (measurement): MeasurementState => ({ busy: measurement.isBusy(), calibrationRequest: measurement.getCalibrationRequest(), lastReports: measurement.listLastReports(), } ), empty:{ busy: false, calibrationRequest: null, lastReports: NO_REPORTS, } , } ) memo [FunctionDeclaration] (from packages/core/main/src/memo.ts): export function memo( inputs: () => Inputs, compute: (...inputs: Computed) => Result, ): () => Result{ let last:{ inputs: Inputs; result: Result} | null = null; return () =>{ const next = inputs(); if (last && sameInputs(last.inputs, next)) return last.result; const result = compute(...(next as unknown as Computed)); last ={ inputs: next, result} ; return result; } ; } memoByKey [FunctionDeclaration] (from packages/core/main/src/memo.ts): export function memoByKey( inputs: (key: Key) => Inputs, compute: (key: Key, ...inputs: Computed) => Result, options:{ maxEntries?: number} ={ } , ): (key: Key) => Result{ const cache = new Map(); return (key) =>{ const next = inputs(key); const cached = cache.get(key); if (cached && sameInputs(cached.inputs, next)) return cached.result; const result = compute(key, ...(next as unknown as Computed)); if (cached) cache.delete(key); else if (options.maxEntries !== undefined && cache.size >= options.maxEntries){ const oldest = cache.keys().next(); if (!oldest.done) cache.delete(oldest.value); } cache.set(key, { inputs: next, result} ); return result; } ; } memoryKeyStore [FunctionDeclaration] (from packages/core/signature/src/signers/personal.ts): export function memoryKeyStore(): PersonalKeyStore{ const records = new Map(); return{ load: async (subject) => records.get(subject) ?? null, save: async (subject, record) =>{ records.set(subject, record); } , remove: async (subject) =>{ records.delete(subject); } , } ; } memoryStampStore [FunctionDeclaration] (from packages/plugin/stamp/src/persistence.ts): export function memoryStampStore(): StampLibraryStore{ const rows = new Map(); return{ list: async () => [...rows.entries()].map(([id, bytes]) => ({ id, bytes} )), put: async (id, bytes) =>{ rows.set(id, new Uint8Array(bytes)); } , delete: async (id) =>{ rows.delete(id); } , } ; } mergeSettings [FunctionDeclaration] (from packages/core/main/src/settings.ts): export function mergeSettings( settings: T, changes: DeepPartial | undefined, declaration?: Pick, 'defaults' | 'whole'>, ): T{ const whole = declaration?.whole ?? []; if (whole.length === 0 || !isPlainObject(changes)) return mergeValue(settings, changes) as T; const paths = whole.map((path) => path.split('.')); let merged = mergeValue(settings, withoutPaths(changes, paths)); for (const path of paths){ const change = valueAt(changes, path); if (change === undefined) continue; const value = filledFrom(valueAt(declaration?.defaults, path), change); if (!sameValue(valueAt(merged, path), value)) merged = withValueAt(merged, path, value); } return merged as T; } metadataPlugin [VariableDeclaration] (from packages/plugin/metadata/src/metadata.plugin.ts): metadataPlugin = () => definePlugin({ id: 'metadata', token: MetadataToken, scope: 'document', create: createMetadataController, } ) metadataState [VariableDeclaration] (from packages/plugin/metadata/src/state.ts): metadataState = defineState(MetadataToken, { read: (metadata): MetadataState => ({ metadata: metadata.getSnapshot(), custom: metadata.custom.getSnapshot(), status: metadata.getStatus(), } ), empty:{ metadata: null, custom: null, status: 'idle', } , ensure: (metadata) => metadata.ensureLoaded(), } ) negotiateLocale [FunctionDeclaration] (from packages/plugin/i18n/src/negotiate.ts): export function negotiateLocale( available: readonly string[], requested: readonly string[], ): string | null{ const byCanonical = new Map(); for (const code of available){ const canonical = code.toLowerCase(); if (!byCanonical.has(canonical)) byCanonical.set(canonical, code); } const languageOf = (code: string) => code.toLowerCase().split('-')[0]; for (const wanted of requested){ const exact = byCanonical.get(wanted.toLowerCase()); if (exact !== undefined) return exact; } for (const wanted of requested){ const narrowed = byCanonical.get(languageOf(wanted)); if (narrowed !== undefined && sameScript(wanted, narrowed)) return narrowed; } for (const wanted of requested){ const language = languageOf(wanted); for (const [canonical, original] of byCanonical){ if (languageOf(canonical) === language && sameScript(wanted, original)) return original; } } return null; } orientationPatch [FunctionDeclaration] (from packages/core/annotation/src/record/shape.ts): export function orientationPatch( annotation: Annotation, rotation: Rotation, ):{ box: Rect; rotation: Rotation | null} | Record{ if (!kindOf(annotation).caps.quarterTurns) return{ } ; const shape = shapeOf(annotation); if (shape.kind !== 'box') return{ } ; const stands = standingRect(shape.box, shape.rotation); return{ box: standingRect(stands, rotation), rotation: rotation || null} ; } outlinePlugin [VariableDeclaration] (from packages/plugin/outline/src/outline.plugin.ts): outlinePlugin = () => definePlugin({ id: 'outline', token: OutlineToken, scope: 'document', optional: [StageToken, ActionsToken, LinkToken, SelectionToken, I18nToken], state: initialOutlineModel, create: createOutlineController, } ) outlineState [VariableDeclaration] (from packages/plugin/outline/src/state.ts): outlineState = defineState(OutlineToken, { read: (outline): OutlineState => ({ items: outline.list(), rows: outline.listRows(), current: outline.getCurrentItem(), selected: outline.getSelected(), status: outline.getStatus(), incomplete: outline.isIncomplete(), canEdit: outline.canEdit(), } ), empty:{ items: [], rows: [], current: null, selected: [], status: 'idle', incomplete: false, canEdit: false, } , ensure: (outline) => outline.ensureLoaded(), } ) pageEditPlugin [VariableDeclaration] (from packages/plugin/page-edit/src/page-edit.plugin.ts): pageEditPlugin = () => definePlugin({ id: 'page-edit', scope: 'document', token: PageEditToken, state: initialPageEditModel, create: createPageEditController, } ) pageEditState [VariableDeclaration] (from packages/plugin/page-edit/src/state.ts): pageEditState = defineState(PageEditToken, { read: (pageEdit): PageEditState => ({ selected: pageEdit.getSelected(), canEdit: pageEdit.canEdit(), canExtract: pageEdit.canExtract(), } ), empty:{ selected: [], canEdit: false, canExtract: false, } , } ) pageRefsEqual [FunctionDeclaration] (from packages/engine/core/src/identity/PageRef.ts): export function pageRefsEqual(a: PageRef, b: PageRef): boolean{ return a.kind === b.kind && a.objectNumber === b.objectNumber; } persistStampLibraries [FunctionDeclaration] (from packages/plugin/stamp/src/persistence.ts): export function persistStampLibraries( stamp: Pick, store: StampLibraryStore, options:{ except?: readonly string[]} ={ } , ): () => void{ const except = new Set(options.except ?? []); const lines = new Map(); const run = (libraryId: string, step: Step): void =>{ const line = lines.get(libraryId); if (line){ if (line.started) line.next = step; else line.step = step; return; } const fresh ={ step, started: false, next: null as Step | null} ; lines.set(libraryId, fresh); void Promise.resolve().then(async () =>{ fresh.started = true; try{ if (fresh.step === 'save') await store.put(libraryId, await stamp.exportLibrary(libraryId)); else await store.delete(libraryId); } catch (error){ const doing = fresh.step === 'save' ? 'persisting' : 'deleting stored'; globalThis.console?.warn(`[stamp] ${ doing} library '${ libraryId} ' failed:`, error); } lines.delete(libraryId); if (fresh.next) run(libraryId, fresh.next); } ); } ; return stamp.onLibraryChanged(({ libraryId, type} ) =>{ if (except.has(libraryId)) return; run(libraryId, type === 'deleted' ? 'delete' : 'save'); } ); } personalSigner [FunctionDeclaration] (from packages/core/signature/src/signers/personal.ts): export async function personalSigner(input:{ subject: string; store: PersonalKeyStore; algorithm?: 'RSA-PKCS1-v1_5' | 'RSA-PSS' | 'ECDSA'; hash?: 'sha256' | 'sha384' | 'sha512'; } ): Promise{ const{ ensureEngine} = await import('../cms/engine'); ensureEngine(); const hash = input.hash ?? 'sha256'; let record = await input.store.load(input.subject); if (!record){ const{ selfSignedCertificate} = await import('./self-signed'); const keys = await generateSigningKeyPair(input.algorithm ?? 'RSA-PKCS1-v1_5', hash, false); const certificate = await selfSignedCertificate({ publicKey: keys.publicKey, privateKey: keys.privateKey, commonName: input.subject, hash, } ); record ={ privateKey: keys.privateKey, certificate} ; await input.store.save(input.subject, record); } const signer = webCryptoSigner({ privateKey: record.privateKey, certificateChain: [record.certificate], hash, } ); return{ ...signer, certificate: record.certificate, subject: input.subject} ; } propertiesOf [FunctionDeclaration] (from packages/core/annotation/src/props.ts): export function propertiesOf(kind: AnnotationKind): readonly AnnotationProperty[]{ let properties = withFlags.get(kind); if (!properties){ properties = [...kind.properties, ...FLAG_PROPERTIES]; withFlags.set(kind, properties); } return properties; } redactionPlugin [VariableDeclaration] (from packages/plugin/redaction/src/redaction.plugin.ts): redactionPlugin = (config?: RedactionConfig) => definePlugin({ id: 'redaction', token: RedactionToken, scope: 'document', requires: [AnnotationToken], optional: [SelectionToken, SearchToken], state: initialRedactionModel, settings:{ defaults: REDACTION_DEFAULTS, registered: config} , create: createRedactionController, } ) redactionState [VariableDeclaration] (from packages/plugin/redaction/src/state.ts): redactionState = defineState(RedactionToken, { read: (redaction): RedactionState => ({ pendingCount: redaction.getPendingCount(), applying: redaction.isApplying(), lastResult: redaction.getLastResult(), } ), empty:{ pendingCount: 0, applying: false, lastResult: null, } , } ) reload [FunctionDeclaration] (from packages/core/main/src/mirror.ts): export function reload(options?:{ pages?: readonly PageRef[]} ): MirrorReload{ return{ [RELOAD]: options?.pages ?? 'all'} ; } remoteSigner [FunctionDeclaration] (from packages/core/signature/src/signers/remote.ts): export function remoteSigner(input:{ sign: (request:{ digest: Uint8Array; algorithm: 'sha256' | 'sha384' | 'sha512'; subFilter: 'adbe.pkcs7.detached' | 'ETSI.CAdES.detached' | 'ETSI.RFC3161'; } ) => Promise; } ): CmsSigner{ return{ kind: 'cms', sign: (request) => input.sign(request), } ; } renderCommands [VariableDeclaration] (from packages/framework/react/src/command-lists.ts): renderCommands = createRenderCommands(standardCommandsBrowser) renderPlugin [VariableDeclaration] (from packages/plugin/render/src/render.plugin.ts): renderPlugin = (config?: RenderConfig) => definePlugin({ id: 'render', scope: 'document', token: RenderToken, optional: [InteractionToken], state: initialRenderState, settings:{ defaults: RENDER_DEFAULTS, registered: config, whole: ['snapshot.box']} , create: createRenderController, } ) reorderBackOf [FunctionDeclaration] (from packages/engine/core/src/pages/predict.ts): export function reorderBackOf( pages: readonly PageLayout[], refs: readonly PageRef[], ): PageOp<'pages.reorder'>[]{ return restoredPagesOf(pages, refs).map(({ page, after} ) => ({ type: 'pages.reorder', pages: [page.ref], position: after ?{ after} : 'start', } )); } resolveClickPlacement [FunctionDeclaration] (from packages/core/annotation/src/placement.ts): export function resolveClickPlacement( point: Point, policy: ClickCreate, frame: PlacementFrame ={ } , ): Placement{ const seen = frame.upright ? (frame.displayRotation ?? 0) : 0; if ('length' in policy){ const turn = ((policy.rotation ?? 0) * Math.PI) / 180; const span = rotatePoint({ x: Math.cos(turn) * policy.length, y: Math.sin(turn) * policy.length} , { x: 0, y: 0} , -seen, ); const before = policy.anchor === 'start' ? 0 : policy.anchor === 'end' ? 1 : 0.5; const a ={ x: point.x - span.x * before, y: point.y - span.y * before} ; const b ={ x: a.x + span.x, y: a.y + span.y} ; const bounds = rectFromPoints(a, b); const placed = clampRectToBox(bounds, frame.pageBox); const dx = placed.x - bounds.x; const dy = placed.y - bounds.y; return{ kind: 'segment', a:{ x: a.x + dx, y: a.y + dy} , b:{ x: b.x + dx, y: b.y + dy} } ; } const{ width, height} = policy; const rot = uprightTurn(frame); const rect = policy.anchor === 'top-left' ? uprightAnchoredRect(point, width, height, seen) :{ x: point.x - width / 2, y: point.y - height / 2, width, height} ; const shown = rot % 180 ? transposedAboutCenter(rect) : rect; const placed = clampRectToBox(shown, frame.pageBox); return{ kind: 'box', rect:{ ...rect, x: rect.x + placed.x - shown.x, y: rect.y + placed.y - shown.y} , rot, } ; } resolveLinkTarget [FunctionDeclaration] (from packages/plugin/link/src/contract.ts): export function resolveLinkTarget( target: PdfLinkTarget, hasPage: (page: PageRef) => boolean, ): LinkResolution{ switch (target.kind){ case 'goto': return hasPage(target.destination.page) ?{ kind: 'destination', destination: target.destination} :{ kind: 'reported', target} ; case 'uri': return{ kind: 'uri', uri: target.uri} ; case 'named': return{ kind: 'named', name: target.name} ; default: return{ kind: 'reported', target} ; } } resolvePageLayers [FunctionDeclaration] (from packages/engine/core/src/dto/PageRender.ts): export function resolvePageLayers( options:{ includeAnnotations?: boolean; includeFormFields?: boolean} | undefined, may: PageLayerRights, ): PageRenderLayers{ const{ includeAnnotations, includeFormFields} = options ??{ } ; if (includeAnnotations === true && !may.annotations){ throw new PermissionDenied('doc.annotate.read', 'includeAnnotations'); } if (includeFormFields === true && !may.formFields){ throw new PermissionDenied('doc.forms.read', 'includeFormFields'); } return{ includeAnnotations: includeAnnotations ?? may.annotations, includeFormFields: includeFormFields ?? (includeAnnotations === false ? false : may.formFields), } ; } resolveResponsive [VariableDeclaration] (from packages/plugin/stage/src/responsive.ts): resolveResponsive = ( base: StageSettings, rules: readonly ResponsiveRule[], box: StageBox, ): ResolvedResponsive =>{ let effective = base; const active: string[] = []; for (const rule of rules){ if (!ruleMatches(rule, box)) continue; if (rule.name !== undefined) active.push(rule.name); if (rule.settings) effective = mergeSettings(effective, rule.settings); } return{ effective, active} ; } resolvedCommandsEqual [VariableDeclaration] (from packages/plugin/commands/src/contract.ts): resolvedCommandsEqual = ( left: ResolvedCommand | null, right: ResolvedCommand | null, ): boolean =>{ if (left === right) return true; if (!left || !right) return false; return ( left.id === right.id && left.label === right.label && left.icon === right.icon && left.iconAccent?.primary === right.iconAccent?.primary && left.iconAccent?.secondary === right.iconAccent?.secondary && left.menu === right.menu && left.enabled === right.enabled && left.active === right.active && left.pressable === right.pressable && left.visible === right.visible && left.disabledReason === right.disabledReason && left.shortcuts.length === right.shortcuts.length && left.shortcuts.every((shortcut, index) => shortcut === right.shortcuts[index]) ); } restoreStampLibraries [FunctionDeclaration] (from packages/plugin/stamp/src/persistence.ts): export async function restoreStampLibraries( stamp: Pick, store: StampLibraryStore, ): Promise{ const restored: string[] = []; for (const{ id, bytes} of await store.list()){ try{ restored.push((await stamp.importLibrary(bytes)).library.id); } catch (error){ globalThis.console?.warn(`[stamp] stored library '${ id} ' could not be restored:`, error); } } return restored; } restoredPagesOf [FunctionDeclaration] (from packages/engine/core/src/pages/predict.ts): export function restoredPagesOf( pages: readonly PageLayout[], refs: readonly PageRef[], ): RestoredPage[]{ const deleting = new Set(refs.map(encodePageKey)); return pages.flatMap((page, index) => deleting.has(keyOf(page)) ? [{ page, after: index > 0 ? pages[index - 1]!.ref : null} ] : [], ); } returnsPromise [FunctionDeclaration] (from packages/core/main/src/capability-handle.ts): export function returnsPromise(token: CapabilityToken, path: string): boolean{ return token.promises?.[path] === true; } rotateBackOf [FunctionDeclaration] (from packages/engine/core/src/pages/predict.ts): export function rotateBackOf( pages: readonly PageLayout[], refs: readonly PageRef[], ): PageOp<'pages.rotate'>[]{ const rotations = new Map(pages.map((page) => [keyOf(page), page.rotation])); const groups = new Map(); for (const ref of refs){ const rotation = rotations.get(encodePageKey(ref)); if (rotation === undefined) continue; groups.set(rotation, [...(groups.get(rotation) ?? []), ref]); } return [...groups].map(([rotation, group]) => ({ type: 'pages.rotate', pages: group, rotation, } )); } samePageViewDemand [FunctionDeclaration] (from packages/plugin/render/src/paint-plan.ts): export function samePageViewDemand(left: PageViewDemand, right: PageViewDemand): boolean{ return ( left.desiredDeviceWidth === right.desiredDeviceWidth && left.velocity?.dx === right.velocity?.dx && left.velocity?.dy === right.velocity?.dy && (left.visibleRect === right.visibleRect || (left.visibleRect !== undefined && right.visibleRect !== undefined && left.visibleRect.x === right.visibleRect.x && left.visibleRect.y === right.visibleRect.y && left.visibleRect.width === right.visibleRect.width && left.visibleRect.height === right.visibleRect.height)) ); } saveFile [FunctionDeclaration] (from packages/framework/web/src/file-picker.ts): export function saveFile(bytes: Uint8Array | Blob, name: string, mimeType?: string): void{ const blob = bytes instanceof Blob ? bytes : new Blob([bytes as BlobPart], { type: mimeType ?? 'application/octet-stream'} ); const url = URL.createObjectURL(blob); const anchor = document.createElement('a'); anchor.href = url; anchor.download = name; anchor.style.display = 'none'; document.body.appendChild(anchor); anchor.click(); anchor.remove(); setTimeout(() => URL.revokeObjectURL(url), 1000); } searchPlugin [VariableDeclaration] (from packages/plugin/search/src/search.plugin.ts): searchPlugin = (config?: SearchConfig) => definePlugin({ id: 'search', token: SearchToken, scope: 'document', optional: [StageToken], state: initialSearchModel, settings:{ defaults: SEARCH_DEFAULTS, registered: config} , create: createSearchController, } ) searchState [VariableDeclaration] (from packages/plugin/search/src/state.ts): searchState = defineState(SearchToken, { read: (search): SearchState => ({ query: search.getQuery(), status: search.getStatus(), hitCount: search.getHitCount(), activeHitIndex: search.getActiveHitIndex(), activeHit: search.getActiveHit(), progress: search.getProgress(), error: search.getError(), } ), empty:{ query: null, status: 'idle', hitCount: 0, activeHitIndex: -1, activeHit: null, progress: NO_PROGRESS, error: null, } , } ) selectionCommands [VariableDeclaration] (from packages/framework/react/src/command-lists.ts): selectionCommands = createSelectionCommands(standardCommandsBrowser) selectionHandleEndpointsOf [FunctionDeclaration] (from packages/plugin/selection/src/handles.ts): export function selectionHandleEndpointsOf( snapshot: Pick, ): SelectionHandleEndpoints | null{ const{ start, end} = snapshot; if (!start || !end) return null; return{ start:{ page: start.page, glyphQuad: start.glyphQuad, advance: start.advance} , end:{ page: end.page, glyphQuad: end.glyphQuad, advance: end.advance} , } ; } selectionHandleGeometry [FunctionDeclaration] (from packages/plugin/selection/src/handles.ts): export function selectionHandleGeometry( view: SelectionHandleView, endpoint: SelectionHandleEndpoint, role: 'start' | 'end', ): SelectionHandleGeometry | null{ const leading = role === 'start' ? endpoint.advance > 0 : endpoint.advance < 0; const [upperPage, lowerPage] = quadEdge(endpoint.glyphQuad, leading ? 'left' : 'right'); const upper = view.toOverlay(endpoint.page, upperPage); const lower = view.toOverlay(endpoint.page, lowerPage); if (!upper || !lower) return null; const dx = lower.x - upper.x; const dy = lower.y - upper.y; const length = Math.hypot(dx, dy); if (length === 0) return null; const rotation = (Math.atan2(dy, dx) * 180) / Math.PI - 90; const upright = Math.abs(rotation) < HANDLE_ROT_EPSILON; const ux = dx / length; const uy = dy / length; const head = role === 'start' ?{ x: upper.x - (ux * HANDLE_HEAD) / 2, y: upper.y - (uy * HANDLE_HEAD) / 2} :{ x: lower.x + (ux * HANDLE_HEAD) / 2, y: lower.y + (uy * HANDLE_HEAD) / 2} ; return{ bar:{ from: upper, to: lower} , length, rotation, upright, head} ; } selectionHandleViewOf [FunctionDeclaration] (from packages/plugin/selection/src/handles.ts): export function selectionHandleViewOf(stage: SelectionHandleStage): SelectionHandleView{ return{ toOverlay: (page, point) => stage.pageToViewport(page, point), pageAt: (overlay) => stage.getPageAt(overlay), pointOnPage: (page, overlay) => stage.viewportToPage(page, overlay), } ; } selectionPlugin [VariableDeclaration] (from packages/plugin/selection/src/selection.plugin.ts): selectionPlugin = (config?: SelectionConfig) => definePlugin({ id: 'selection', token: SelectionToken, scope: 'document', requires: [InteractionToken], optional: [FeedbackToken], state: initialSelectionModel, settings:{ defaults: SELECTION_DEFAULTS, registered: config} , create: createSelectionController, } ) selectionState [VariableDeclaration] (from packages/plugin/selection/src/state.ts): selectionState = defineState(SelectionToken, { read: (selection): SelectionState => ({ hasSelection: selection.hasSelection(), isSelecting: selection.isSelecting(), range: selection.getRange(), pages: selection.listSelectedPages(), } ), empty:{ hasSelection: false, isSelecting: false, range: null, pages: [], } , } ) settingsEqual [VariableDeclaration] (from packages/plugin/stage/src/settings.ts): settingsEqual = (left: StageSettings, right: StageSettings): boolean => SETTING_KEYS.every((key) => eqSetting(left[key], right[key])) settingsHook [FunctionDeclaration] (from packages/framework/react/src/state.ts): export function settingsHook( token: CapabilityToken, ): SettingsHook>{ return function useSettings>( select?: (settings: SettingsOf) => Selected, ): Selected{ return useKernelValue((kernel) =>{ const settings = kernel.settingsOf(token).getSettings(); return select ? select(settings) : (settings as unknown as Selected); } , shallowEqual); } ; } shallowArray [VariableDeclaration] (from packages/framework/react/src/runtime.tsx): shallowArray = (left: readonly T[], right: readonly T[]): boolean => left === right || (left.length === right.length && left.every((item, i) => item === right[i])) shallowEqual [FunctionDeclaration] (from packages/core/main/src/state.ts): export function shallowEqual(left: unknown, right: unknown): boolean{ if (Object.is(left, right)) return true; if (typeof left !== 'object' || typeof right !== 'object' || left === null || right === null){ return false; } if (Array.isArray(left) !== Array.isArray(right)) return false; const leftFields = left as Record; const rightFields = right as Record; const keys = Object.keys(leftFields); return ( keys.length === Object.keys(rightFields).length && keys.every((key) => key in rightFields && Object.is(leftFields[key], rightFields[key])) ); } shellPlugin [VariableDeclaration] (from packages/plugin/shell/src/shell.plugin.ts): shellPlugin = () => definePlugin({ id: 'shell', scope: 'document', token: ShellToken, state: initialShellModel, create: createShellController, } ) shellState [VariableDeclaration] (from packages/plugin/shell/src/state.ts): shellState = defineState(ShellToken, { read: (shell): ShellState => ({ openSurfaces: shell.listOpenSurfaces(), openMenus: shell.listOpenMenus(), } ), empty:{ openSurfaces: [], openMenus: []} , } ) signaturePlugin [VariableDeclaration] (from packages/plugin/signature/src/signature.plugin.ts): signaturePlugin = (config?: SignatureConfig) => definePlugin({ id: 'signature', token: SignatureToken, scope: 'document', requires: [FormToken], optional: [InteractionToken, StampToken, AnnotationToken], state: initialSignatureModel, settings:{ defaults: SIGNATURE_DEFAULTS, registered: config, whole: ['signingKey', 'timestampAuthority', 'revocation', 'trust'], } , create: createSignatureController, } ) signatureState [VariableDeclaration] (from packages/plugin/signature/src/state.ts): signatureState = defineState(SignatureToken, { read: (signature): SignatureState => ({ signatures: signature.listSignatures(), protection: signature.getProtection(), target: signature.getTarget(), busy: signature.isBusy(), pending: signature.getPending(), status: signature.getStatus(), } ), empty:{ signatures: NO_SIGNATURES, protection: null, target: null, busy: false, pending: null, status: 'idle', } , } ) signerRowsOf [FunctionDeclaration] (from packages/plugin/signature/src/contract.ts): export function signerRowsOf( libraries: readonly StampLibrary[], assets: readonly StampAsset[], ): SignerRow[]{ return libraries .filter((library) => library.kind === SIGNATURES_LIBRARY_KIND) .map((library) =>{ const own = assets.filter((asset) => asset.libraryId === library.id); return{ libraryId: library.id, name: library.name, library, signatures: own.filter((asset) => markRoleOf(asset) === 'signature'), initials: own.find((asset) => markRoleOf(asset) === 'initials') ?? null, } ; } ); } snapAppearanceScale [FunctionDeclaration] (from packages/engine/core/src/engine/DocumentRenderService.ts): export function snapAppearanceScale(policy: EngineRenderPolicy, scale: number): number{ if (policy.kind === 'continuous' || policy.appearances === undefined) return scale; if (policy.appearances.scales.length === 0){ throw new EngineError( EngineErrorCode.InvalidArg, 'render policy has an empty appearance-scale lattice', ); } const scales = [...policy.appearances.scales].sort((a, b) => a - b); return scales.find((s) => s >= scale) ?? scales[scales.length - 1]!; } snapFullPageViewport [FunctionDeclaration] (from packages/engine/core/src/engine/DocumentRenderService.ts): export function snapFullPageViewport( policy: EngineRenderPolicy, viewport: PageRenderViewport, options?:{ pageWidth?: number} , ): PageRenderViewport{ if (policy.kind === 'continuous') return viewport; if (viewport.kind === 'dpi' || viewport.kind === 'thumbnail') return viewport; if (policy.fullPage.widths.length === 0){ throw new EngineError(EngineErrorCode.InvalidArg, 'render policy has an empty width ladder'); } const widths = [...policy.fullPage.widths].sort((a, b) => a - b); let requested: number; if (viewport.kind === 'width'){ requested = viewport.width; } else{ const pageWidth = options?.pageWidth; if (pageWidth === undefined || pageWidth <= 0){ throw new EngineError( EngineErrorCode.InvalidArg, 'snapping a scale viewport to a width lattice requires opts.pageWidth', ); } requested = (viewport.scale ?? 1) * pageWidth; } const snapped = widths.find((width) => width >= requested) ?? widths[widths.length - 1]!; return{ kind: 'width', width: snapped} ; } snapTileScale [FunctionDeclaration] (from packages/engine/core/src/engine/DocumentRenderService.ts): export function snapTileScale(policy: EngineRenderPolicy, scale: number): number{ if (policy.kind === 'continuous' || policy.tiles === undefined) return scale; if (policy.tiles.scales.length === 0){ throw new EngineError( EngineErrorCode.InvalidArg, 'render policy has an empty tile-scale lattice', ); } const scales = [...policy.tiles.scales].sort((a, b) => a - b); return scales.find((s) => s >= scale) ?? scales[scales.length - 1]!; } stageCommands [VariableDeclaration] (from packages/framework/react/src/command-lists.ts): stageCommands = createStageCommands() stagePlugin [VariableDeclaration] (from packages/plugin/stage/src/stage.plugin.ts): stagePlugin = (options: StagePluginOptions ={ } ) =>{ const{ id = DEFAULT_LENS_ID, token = StageToken, ...config} = options; return definePlugin({ id, token: createHostToken(token), scope: 'document', optional: [ActionsToken], state: () => initialStageModel(config), create: (ctx) => createStageController(ctx, config), } ); } stageState [VariableDeclaration] (from packages/plugin/stage/src/state.ts): stageState = defineState(StageToken, { read: (stage): StageState => ({ zoomLevel: stage.getZoomLevel(), zoomMode: stage.getZoomMode(), currentPageIndex: stage.getCurrentPageIndex(), currentPage: stage.getCurrentPage(), pageCount: stage.getPageCount(), viewRotation: stage.getViewRotation(), activeRules: stage.listActiveRules(), } ), empty:{ zoomLevel: 1, zoomMode: ZoomMode.Automatic, currentPageIndex: 0, currentPage: null, pageCount: 0, viewRotation: 0, activeRules: [], } , } ) stampPlugin [VariableDeclaration] (from packages/plugin/stamp/src/stamp.plugin.ts): stampPlugin = (config?: StampConfig) => definePlugin({ id: 'stamp', token: StampToken, scope: 'workspace', optional: [AnnotationToken, ActionsToken], state: initialStampModel, settings:{ defaults: STAMP_DEFAULTS, registered: config, whole: ['assetEngine', 'fonts']} , create: createStampController, inScope: (stamp, documentId) =>{ const scoped = (options?: Options) => ({ ...options, documentId: options?.documentId ?? documentId, } ); return{ ...stamp, createAssetFromAnnotations: (page, refs, input, options) => stamp.createAssetFromAnnotations(page, refs, input, scoped(options)), armAsset: (assetId, options) => stamp.armAsset(assetId, scoped(options)), disarm: (target = documentId) => stamp.disarm(target), getArmedAsset: (target = documentId) => stamp.getArmedAsset(target), placeAsset: (assetId, placement, options) => stamp.placeAsset(assetId, placement, scoped(options)), placeAssetOnPages: (assetId, pages, placement, options) => stamp.placeAssetOnPages(assetId, pages, placement, scoped(options)), canPlace: (target = documentId) => stamp.canPlace(target), canCreateFromAnnotations: (target = documentId) => stamp.canCreateFromAnnotations(target), } ; } , } ) stampState [VariableDeclaration] (from packages/plugin/stamp/src/state.ts): stampState = defineState(StampToken, { read: (stamp): StampState => ({ armedAsset: stamp.getArmedAsset(), } ), empty:{ armedAsset: null, } , } ) standInFor [FunctionDeclaration] (from packages/core/main/src/capability-handle.ts): export function standInFor(kernel: Kernel, token: CapabilityToken): T{ let byToken = standIns.get(kernel); if (!byToken){ byToken = new WeakMap(); standIns.set(kernel, byToken); } let standIn = byToken.get(token); if (!standIn){ standIn = createStandIn(token, () => kernel.settingsOf(token)); byToken.set(token, standIn); } return standIn as T; } standardCommands [VariableDeclaration] (from packages/framework/react/src/command-lists.ts): standardCommands = join( stageCommands, interactionCommands, selectionCommands, annotationCommands, historyCommands, renderCommands, documentCommands, ) stateHook [FunctionDeclaration] (from packages/framework/react/src/state.ts): export function stateHook( declaration: StateDeclaration, ): StateHook{ const{ ensure} = declaration; const useDeclaredState = function useDeclaredState( select?: (state: State) => Selected, ): Selected{ const scoped = useDocumentScope(); return useKernelValue((kernel) =>{ const capability = kernel.tryCapability(declaration.token, scoped ?? undefined); const state = capability ? declaration.read(capability) : declaration.empty; return select ? select(state) : (state as unknown as Selected); } , shallowEqual); } ; if (!ensure) return useDeclaredState; return function useLoadedState(select?: (state: State) => Selected): Selected{ const scoped = useDocumentScope(); const capability = useKernelValue( (kernel) => kernel.tryCapability(declaration.token, scoped ?? undefined), Object.is, ); useEffect(() =>{ if (capability) ensure(capability).catch(() =>{ } ); } , [capability]); return useDeclaredState(select); } ; } submitEntriesToUrlEncoded [VariableDeclaration] (from packages/plugin/actions/src/submit-encoding.ts): submitEntriesToUrlEncoded = (entries: FormSubmissionEntry[]): string => entries .flatMap(({ name, value} ) => value === null ? [encodeURIComponent(name)] : Array.isArray(value) ? value.map((item) => `${ encodeURIComponent(name)} =${ encodeURIComponent(item)} `) : [`${ encodeURIComponent(name)} =${ encodeURIComponent(value)} `], ) .join('&') svgCursor [FunctionDeclaration] (from packages/framework/web/src/cursor.ts): export function svgCursor({ svg, hotspot, fallback = 'crosshair'} : SvgCursorOptions): string{ const tagStart = svg.indexOf('= 0 ? svg.indexOf('>', tagStart) : -1; const openTag = tagEnd >= 0 ? svg.slice(tagStart, tagEnd + 1) : ''; if (!/\swidth\s*=/.test(openTag) || !/\sheight\s*=/.test(openTag)){ throw new Error( '[web] svgCursor: the needs explicit width/height attributes — ' + 'browsers ignore cursor images without an intrinsic size', ); } const uri = `data:image/svg+xml, ${ encodeURIComponent(svg)} `; const spot = hotspot ? ` ${ Math.round(hotspot.x)} ${ Math.round(hotspot.y)} ` : ''; return `url("${ uri} ")${ spot} , ${ fallback} `; } timerClock [VariableDeclaration] (from packages/core/main/src/clock.ts): timerClock: HostClock ={ now: () => performance.now(), after(ms, run){ const timer = setTimeout(run, ms); return () => clearTimeout(timer); } , } toFieldRef [FunctionDeclaration] (from packages/engine/core/src/identity/FormFieldRef.ts): export function toFieldRef(name: string): FormFieldRef{ return{ kind: 'fqn', name} ; } toPageRef [FunctionDeclaration] (from packages/engine/core/src/identity/PageRef.ts): export function toPageRef(pageObjectNumber: PageObjectNumber): PageRef{ return{ kind: 'objectNumber', objectNumber: pageObjectNumber} ; } toPluginError [FunctionDeclaration] (from packages/core/main/src/errors.ts): export function toPluginError(capability: string, error: unknown): PluginError{ if (error instanceof PluginError) return error; if (isCancelled(error) || (error instanceof Error && error.name === 'AbortError')){ return new PluginError('operation-cancelled', capability, 'operation cancelled', { cause: error, } ); } if (EngineError.is(error)){ const code = ENGINE_CODE_MAP[String(error.code)] ?? 'operation-failed'; return new PluginError(code, capability, error.message, { cause: error, details: error.details, permission: code === 'permission-denied' ? requiredPermissionOf(error) : null, } ); } const message = error instanceof Error ? error.message : String(error); return new PluginError('operation-failed', capability, message, { cause: error} ); } toPluginErrorInfo [FunctionDeclaration] (from packages/core/main/src/errors.ts): export function toPluginErrorInfo(error: PluginError): PluginErrorInfo{ return{ code: error.code, message: error.message, capability: error.capability, permission: error.permission, } ; } toolCommand [VariableDeclaration] (from packages/plugin/interaction/src/commands.ts): toolCommand = (toolId: string): Omit => ({ labelKey: `commands.tool.${ toolId} `, label: toolId, icon: toolId, categories: ['tool'], run: (context) => interactionOf(context)?.activateTool(toolId), active: (context) => interactionOf(context)?.getActiveToolId() === toolId, visible: (context) => interactionOf(context)?.hasTool(toolId) ?? false, enabled: (context) => interactionOf(context)?.canUseTool(toolId) ?? true, } ) triggerOriginOf [VariableDeclaration] (from packages/plugin/actions/src/contract.ts): triggerOriginOf = (trigger: ActionTrigger): ActionOrigin =>{ switch (trigger.type){ case 'activate': return 'user'; case 'annotation': return trigger.event === 'cursorEnter' || trigger.event === 'cursorExit' ? 'hover' : 'user'; case 'page': case 'document': return 'lifecycle'; } } unknownCommandWarning [VariableDeclaration] (from packages/plugin/commands/src/contract.ts): unknownCommandWarning = (id: CommandId, known: Iterable): string => `no command "${ id} "${ didYouMean(id, known)} : it shows as neither visible nor enabled` unregisteredCommand [VariableDeclaration] (from packages/plugin/commands/src/contract.ts): unregisteredCommand = (id: CommandId): ResolvedCommand => ({ id, label: id, shortcuts: [], enabled: false, active: false, pressable: false, visible: false, categories: [], } ) useActions [FunctionDeclaration] (from packages/framework/react/src/actions.tsx): export function useActions(): ActionsCapability{ return useCapability(ActionsToken); } useActionsEvent [FunctionDeclaration] (from packages/framework/react/src/actions.tsx): export function useActionsEvent( select: (actions: ActionsCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(ActionsToken, select, handler); } useActionsSettings [VariableDeclaration] (from packages/framework/react/src/actions.tsx): useActionsSettings = settingsHook(ActionsToken) useActionsUiAdapter [FunctionDeclaration] (from packages/framework/react/src/actions.tsx): export function useActionsUiAdapter(handlers?: ActionsUiHandlers): void{ const actions = useOptionalCapability(ActionsToken); const stage = useOptionalCapability(StageToken); const handlersRef = useRef(handlers); handlersRef.current = handlers; useEffect(() =>{ if (!actions) return; const adapter: ActionUiAdapter = createDefaultActionsUiAdapter({ overrides: () => handlersRef.current, goToPage: (page) => stage?.goToPage(page), } ); return actions.setUiAdapter(adapter); } , [actions, stage]); } useActiveDocumentId [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useActiveDocumentId(): string | null{ return useKernelValue((kernel) => kernel.documents.getActiveId()); } useAnnotation [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useAnnotation(): AnnotationCapability{ return useCapability(AnnotationToken); } useAnnotationAnchor [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useAnnotationAnchor(ref: AnnotationRef | null): AnnotationAnchor | null{ const key = ref ? annotationKey(ref) : null; const stable = React.useMemo(() => ref, [key]); return useOptionalSelector( AnnotationHostToken, (annotation) => (stable ? annotation.getAnnotationAnchor(stable) : null), null, sameAnnotationAnchor, ); } useAnnotationDefaults [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useAnnotationDefaults(toolId: string): ToolDefaults{ return useOptionalSelector( AnnotationToken, (annotation) => annotation.tools.getDefaults(toolId), NO_DEFAULTS, ); } useAnnotationEvent [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useAnnotationEvent( select: (annotation: AnnotationCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(AnnotationToken, select, handler); } useAnnotationList [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useAnnotationList(filter?: AnnotationFilter): readonly Annotation[]{ const key = filter ? `${ (filter.pages ?? []) .map((page) => (typeof page === 'number' ? `#${ page} ` : page.objectNumber)) .join(', ')} |${ filter.pages ? 'p' : ''} |${ filter.subtype ?? ''} ` : ''; const stable = React.useMemo(() => filter, [key]); return useOptionalSelector( AnnotationToken, (annotation) => annotation.list(stable), NO_ANNOTATIONS, shallowArray, ); } useAnnotationProperties [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useAnnotationProperties(toolId?: string): AnnotationProperties{ return useOptionalSelector( AnnotationToken, (annotation) => toolId === undefined ? annotation.selection.getProperties() : annotation.tools.getProperties(toolId), NO_PROPERTIES, ); } useAnnotationSettings [VariableDeclaration] (from packages/framework/react/src/annotation-hooks.ts): useAnnotationSettings = settingsHook(AnnotationToken) useAnnotationState [VariableDeclaration] (from packages/framework/react/src/annotation-hooks.ts): useAnnotationState = stateHook(annotationState) useAttachment [FunctionDeclaration] (from packages/framework/react/src/attachment.ts): export function useAttachment(): AttachmentCapability{ return useCapability(AttachmentToken); } useAttachmentEvent [FunctionDeclaration] (from packages/framework/react/src/attachment.ts): export function useAttachmentEvent( select: (attachment: AttachmentCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(AttachmentToken, select, handler); } useAttachmentState [VariableDeclaration] (from packages/framework/react/src/attachment.ts): useAttachmentState = stateHook(attachmentState) useCapability [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useCapability(token: CapabilityToken): T{ const kernel = useKernel(); const capability = useOptionalCapability(token); if (capability) return capability; if (kernel.scopeOf(token) === 'document') return standInFor(kernel, token); return kernel.capability(token); } useCapabilityEvent [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useCapabilityEvent( token: CapabilityToken, select: (capability: C) => EventHook, handler: (event: T) => void, ): void{ const capability = useOptionalCapability(token); const handlerRef = useRef(handler); handlerRef.current = handler; const selectRef = useRef(select); selectRef.current = select; useEffect(() =>{ if (!capability) return; return selectRef.current(capability)((event) => handlerRef.current(event)); } , [capability]); } useCommand [FunctionDeclaration] (from packages/framework/react/src/commands.ts): export function useCommand(id: string): BoundCommand{ const commands = useCapability(CommandsToken); const documentId = useDocumentId() ?? undefined; const resolved = useKernelValue( () => commands.resolveCommand(id, documentId), resolvedCommandsEqual, ); if (resolved === null){ devWarn(`useCommand:${ id} `, `useCommand(): ${ unknownCommandWarning(id, commands.listCommandIds())} `); } return useMemo( () => boundCommandOf( resolved ?? unregisteredCommand(id), (commandId) => commands.execute(commandId, { documentId} ), { isMac: isMacPlatform()} , ), [resolved, commands, documentId, id], ); } useCommandShortcuts [FunctionDeclaration] (from packages/framework/react/src/commands.ts): export function useCommandShortcuts(options?:{ isMac?: boolean; target?: RefObject; onRefused?: (commandId: CommandId, refusal: CommandRefusal) => void; } ): void{ const commands = useCapability(CommandsHostToken); const isMac = options?.isMac; const target = options?.target; const onRefused = useRef(options?.onRefused); onRefused.current = options?.onRefused; useEffect(() =>{ const report = (commandId: CommandId, refusal: CommandRefusal) => onRefused.current?.(commandId, refusal); if (!target) return bindCommandShortcuts(commands, { isMac, onRefused: report} ); return target.current ? bindCommandShortcuts(commands, { isMac, target: target.current, onRefused: report} ) : undefined; } , [commands, isMac, target]); } useCommands [FunctionDeclaration] (from packages/framework/react/src/commands.ts): export function useCommands(): CommandsCapability{ return useCapability(CommandsToken); } useCommandsEvent [FunctionDeclaration] (from packages/framework/react/src/commands.ts): export function useCommandsEvent( select: (commands: CommandsCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(CommandsToken, select, handler); } useCommandsSettings [VariableDeclaration] (from packages/framework/react/src/commands.ts): useCommandsSettings = settingsHook(CommandsToken) useCommentThread [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useCommentThread(ref: AnnotationRef | null): CommentThreadView | null{ const views = useCommentThreads(); const api = useOptionalCapability(AnnotationToken); if (ref == null || !api) return null; const thread = api.comments.getThread(ref); if (!thread) return null; return ( views.find((view) => annotationKey(view.root.ref) === annotationKey(thread.root.ref)) ?? null ); } useCommentThreads [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useCommentThreads(): CommentThreadView[]{ const docId = useDocumentId(); const threads = useOptionalSelector( AnnotationToken, (annotation) => annotation.comments.listThreads(), NO_THREADS, ); const pages = useKernelValue((kernel) => docId ? kernel.documents.listPages(docId) : EMPTY_PAGES, ); return React.useMemo(() => enrichCommentThreads(threads, pages), [threads, pages]); } useComments [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useComments(): CommentsCapability{ return useCapability(AnnotationToken).comments; } useDocument [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useDocument( select?: (document: DocumentInfo) => Selected, ): Selected{ return useDeclared(DocumentsToken, documentState.read, documentState.empty, select); } useDocumentId [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useDocumentId(): string | null{ const scoped = useDocumentScope(); const active = useActiveDocumentId(); return scoped ?? active; } useDocumentScope [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useDocumentScope(): string | null{ return useContext(DocumentScopeReactContext); } useDocuments [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useDocuments(): DocumentsCapability{ return useCapability(DocumentsToken); } useDocumentsEvent [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useDocumentsEvent( select: (documents: DocumentsCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(DocumentsToken, select, handler); } useDocumentsState [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useDocumentsState( select?: (state: DocumentsState) => Selected, ): Selected{ return useDeclared(DocumentsToken, documentsState.read, documentsState.empty, select); } useFilePickerProvider [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useFilePickerProvider( provider: FilePickerProvider | null = filePickerProvider, ): void{ const anno = useOptionalCapability(AnnotationToken); useEffect(() =>{ if (!anno) return; return installFilePickerProvider(anno, provider, () => devWarn( 'file-picker-provider-twice', 'useFilePickerProvider() is called from two mounted components for the same document — ' + 'the later one wins. Call it once, at a document-scoped spot.', ), ); } , [anno, provider]); } useFontCss [FunctionDeclaration] (from packages/framework/react/src/fonts.ts): export function useFontCss(font: FontName | null): FontCss | null{ const css = useOptionalSelector( FontsToken, (fonts) => (font === null ? null : fonts.getFontCss(font)), null, ); useFontMounts(css?.programs ?? NO_PROGRAMS); return css; } useFontMounts [FunctionDeclaration] (from packages/framework/react/src/font-mounts.ts): export function useFontMounts(programs: readonly MountableFontProgram[]): void{ const [mounts] = useState(() => createFontMounts()); useEffect(() => () => mounts.release(), [mounts]); useEffect(() => mounts.mount(programs)); } useFonts [FunctionDeclaration] (from packages/framework/react/src/fonts.ts): export function useFonts(): FontsCapability{ return useCapability(FontsToken); } useFontsEvent [FunctionDeclaration] (from packages/framework/react/src/fonts.ts): export function useFontsEvent( select: (fonts: FontsCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(FontsToken, select, handler); } useFontsState [VariableDeclaration] (from packages/framework/react/src/fonts.ts): useFontsState = stateHook(fontsState) useForm [FunctionDeclaration] (from packages/framework/react/src/form.tsx): export function useForm(): FormCapability{ return useCapability(FormToken); } useFormEvent [FunctionDeclaration] (from packages/framework/react/src/form.tsx): export function useFormEvent( select: (form: FormCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(FormToken, select, handler); } useFormSettings [VariableDeclaration] (from packages/framework/react/src/form.tsx): useFormSettings = settingsHook(FormToken) useFormState [VariableDeclaration] (from packages/framework/react/src/form.tsx): useFormState = stateHook(formState) useFormValue [FunctionDeclaration] (from packages/framework/react/src/form.tsx): export function useFormValue(ref: FormFieldRef): FormFieldValue | null{ const scoped = useDocumentScope(); const key = ref.kind === 'fqn' ? `n:${ ref.name} ` : `o:${ ref.objectNumber} `; const stable = useMemo(() => ref, [key]); return useKernelValue( (kernel) => kernel.tryCapability(FormToken, scoped ?? undefined)?.getValue(stable) ?? null, ); } useHistory [FunctionDeclaration] (from packages/framework/react/src/history.ts): export function useHistory(): HistoryCapability{ return useCapability(HistoryToken); } useHistoryEvent [FunctionDeclaration] (from packages/framework/react/src/history.ts): export function useHistoryEvent( select: (history: HistoryCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(HistoryToken, select, handler); } useHistoryState [VariableDeclaration] (from packages/framework/react/src/history.ts): useHistoryState = stateHook(historyState) useI18n [FunctionDeclaration] (from packages/framework/react/src/i18n.ts): export function useI18n(): I18nCapability{ return useCapability(I18nToken); } useI18nEvent [FunctionDeclaration] (from packages/framework/react/src/i18n.ts): export function useI18nEvent( select: (i18n: I18nCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(I18nToken, select, handler); } useI18nSettings [VariableDeclaration] (from packages/framework/react/src/i18n.ts): useI18nSettings = settingsHook(I18nToken) useI18nState [VariableDeclaration] (from packages/framework/react/src/i18n.ts): useI18nState = stateHook(i18nState) useInteraction [FunctionDeclaration] (from packages/framework/react/src/interaction.tsx): export function useInteraction(): InteractionCapability{ return useCapability(InteractionToken); } useInteractionEvent [FunctionDeclaration] (from packages/framework/react/src/interaction.tsx): export function useInteractionEvent( select: (interaction: InteractionCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(InteractionToken, select, handler); } useInteractionSettings [VariableDeclaration] (from packages/framework/react/src/interaction.tsx): useInteractionSettings = settingsHook(InteractionToken) useInteractionState [VariableDeclaration] (from packages/framework/react/src/interaction.tsx): useInteractionState = stateHook(interactionState) useKernel [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useKernel(): Kernel{ const kernel = useContext(KernelReactContext); if (!kernel) throw new Error('useKernel must be used within /'); return kernel; } useKernelValue [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useKernelValue( select: (kernel: Kernel) => R, isEqual: (left: R, right: R) => boolean = Object.is, ): R{ const kernel = useKernel(); const last = useRef<{ v: R} | null>(null); const get = () =>{ const next = select(kernel); if (last.current && isEqual(last.current.v, next)) return last.current.v; last.current ={ v: next} ; return next; } ; return useSyncExternalStore(kernel.subscribe, get, get); } useLink [FunctionDeclaration] (from packages/framework/react/src/link.tsx): export function useLink(): LinkCapability{ useUriOpener(); return useCapability(LinkToken); } useLinkEvent [FunctionDeclaration] (from packages/framework/react/src/link.tsx): export function useLinkEvent( select: (link: LinkCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(LinkToken, select, handler); } useMeasurement [FunctionDeclaration] (from packages/framework/react/src/measurement.tsx): export function useMeasurement(): MeasurementCapability{ return useCapability(MeasurementToken); } useMeasurementEvent [FunctionDeclaration] (from packages/framework/react/src/measurement.tsx): export function useMeasurementEvent( select: (measurement: MeasurementCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(MeasurementToken, select, handler); } useMeasurementReadout [FunctionDeclaration] (from packages/framework/react/src/measurement.tsx): export function useMeasurementReadout( ref: AnnotationRef, ): MeasurementReadout | MeasurementUnavailable{ const scoped = useDocumentScope(); return useKernelValue( (kernel) => kernel.tryCapability(MeasurementToken, scoped ?? undefined)?.getReadout(ref) ?? NO_READOUT, ); } useMeasurementSettings [VariableDeclaration] (from packages/framework/react/src/measurement.tsx): useMeasurementSettings = settingsHook(MeasurementToken) useMeasurementState [VariableDeclaration] (from packages/framework/react/src/measurement.tsx): useMeasurementState = stateHook(measurementState) useMetadata [FunctionDeclaration] (from packages/framework/react/src/metadata.ts): export function useMetadata(): MetadataCapability{ return useCapability(MetadataToken); } useMetadataEvent [FunctionDeclaration] (from packages/framework/react/src/metadata.ts): export function useMetadataEvent( select: (metadata: MetadataCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(MetadataToken, select, handler); } useMetadataState [VariableDeclaration] (from packages/framework/react/src/metadata.ts): useMetadataState = stateHook(metadataState) useOptionalCapability [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useOptionalCapability(token: CapabilityToken): T | null{ const scoped = useDocumentScope(); return useKernelValue((kernel) => kernel.tryCapability(token, scoped ?? undefined)); } useOptionalProjectorBinding [FunctionDeclaration] (from packages/framework/react/src/anchored.tsx): export function useOptionalProjectorBinding(): ProjectorBinding | null{ return useContext(ProjectorContext); } useOptionalSelector [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useOptionalSelector( token: CapabilityToken, select: (capability: C) => R, fallback: R, isEqual: (left: R, right: R) => boolean = Object.is, ): R{ const kernel = useKernel(); const capability = useOptionalCapability(token); const last = useRef<{ v: R} | null>(null); const get = () =>{ let next: R; if (capability === null){ next = fallback; } else{ try{ next = select(capability); } catch{ next = fallback; } } if (last.current && isEqual(last.current.v, next)) return last.current.v; last.current ={ v: next} ; return next; } ; return useSyncExternalStore(kernel.subscribe, get, get); } useOutline [FunctionDeclaration] (from packages/framework/react/src/outline.ts): export function useOutline(): OutlineCapability{ return useCapability(OutlineToken); } useOutlineEvent [FunctionDeclaration] (from packages/framework/react/src/outline.ts): export function useOutlineEvent( select: (outline: OutlineCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(OutlineToken, select, handler); } useOutlineState [VariableDeclaration] (from packages/framework/react/src/outline.ts): useOutlineState = stateHook(outlineState) usePage [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function usePage(): PageContextValue{ const context = useContext(PageReactContext); if (!context) throw new Error('usePage must be used inside or a page'); return context; } usePageEdit [FunctionDeclaration] (from packages/framework/react/src/page-edit.ts): export function usePageEdit(): PageEditCapability{ return useCapability(PageEditToken); } usePageEditState [VariableDeclaration] (from packages/framework/react/src/page-edit.ts): usePageEditState = stateHook(pageEditState) usePageList [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function usePageList(): readonly PageInfo[]{ const documentId = useDocumentId(); return useKernelValue((kernel) => documentId ? kernel.documents.listPages(documentId) : NO_PAGES, ); } usePageScale [FunctionDeclaration] (from packages/framework/react/src/measurement.tsx): export function usePageScale(page: PageRef | number): PageScale; usePendingRedactions [FunctionDeclaration] (from packages/framework/react/src/redaction.tsx): export function usePendingRedactions(filter?: RedactionMarkFilter): readonly RedactionMark[]{ const scoped = useDocumentScope(); const page = filter?.page; return useKernelValue( (kernel) => kernel .tryCapability(RedactionToken, scoped ?? undefined) ?.listPending(page === undefined ? undefined :{ page} ) ?? NO_MARKS, ); } usePictureState [FunctionDeclaration] (from packages/framework/react/src/render.tsx): export function usePictureState(): PictureState{ const page = usePage(); return useOptionalSelector( RenderPublicToken, (render) => render.getPictureState(page.ref, page.view), NO_PICTURE, ); } useProjectorBinding [FunctionDeclaration] (from packages/framework/react/src/anchored.tsx): export function useProjectorBinding(): ProjectorBinding{ const binding = useContext(ProjectorContext); if (!binding){ throw new Error( 'No ViewProjector in scope: mount anchored UI under (overlay slot) or .', ); } return binding; } useRedaction [FunctionDeclaration] (from packages/framework/react/src/redaction.tsx): export function useRedaction(): RedactionCapability{ return useCapability(RedactionToken); } useRedactionEvent [FunctionDeclaration] (from packages/framework/react/src/redaction.tsx): export function useRedactionEvent( select: (redaction: RedactionCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(RedactionToken, select, handler); } useRedactionSettings [VariableDeclaration] (from packages/framework/react/src/redaction.tsx): useRedactionSettings = settingsHook(RedactionToken) useRedactionState [VariableDeclaration] (from packages/framework/react/src/redaction.tsx): useRedactionState = stateHook(redactionState) useRender [FunctionDeclaration] (from packages/framework/react/src/render.tsx): export function useRender(): RenderCapability{ return useCapability(RenderPublicToken); } useRenderEvent [FunctionDeclaration] (from packages/framework/react/src/render.tsx): export function useRenderEvent( select: (render: RenderCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(RenderPublicToken, select, handler); } useRenderSettings [VariableDeclaration] (from packages/framework/react/src/render.tsx): useRenderSettings = settingsHook(RenderPublicToken) useRichTextEditor [FunctionDeclaration] (from packages/framework/react/src/annotation.tsx): export function useRichTextEditor(annotation: Annotation): RichTextEditor{ const page = usePage(); const zoom = page.transform.zoom; const rotation = page.transform.rotation; const item = useOptionalSelector( AnnotationHostToken, (anno) => anno.getTextItem(annotation.ref, { zoom, rotation} ), null, ); const scale = textBoxEditorScaleOf(item, page.transform, React.useContext(LookScaleContext)); const own = React.useMemo(() => (item ? ownTextBoxOf(item, scale) : null), [item, scale]); const ref = useTextBoxEditor(item, own?.scale ?? scale); useFontMounts(item?.programs ?? NO_PROGRAMS); return{ ref, style: own?.style ?? NO_STYLE, editing: item?.editing ?? false} ; } useScrollMetrics [FunctionDeclaration] (from packages/framework/react/src/scrollbar.tsx): export function useScrollMetrics(token?: CapabilityToken): ScrollMetrics{ const lens = asHost(useStageToken(token)); const scoped = useDocumentScope(); return useKernelValue( (kernel) => kernel.tryCapability(lens, scoped ?? undefined)?.getScrollMetrics() ?? NO_SCROLL, ); } useSearch [FunctionDeclaration] (from packages/framework/react/src/search.tsx): export function useSearch(): SearchCapability{ return useCapability(SearchToken); } useSearchEvent [FunctionDeclaration] (from packages/framework/react/src/search.tsx): export function useSearchEvent( select: (search: SearchCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(SearchToken, select, handler); } useSearchHits [FunctionDeclaration] (from packages/framework/react/src/search.tsx): export function useSearchHits(page?: PageRef | number): readonly SearchHit[]{ const scoped = useDocumentScope(); return useKernelValue( (kernel) => kernel .tryCapability(SearchToken, scoped ?? undefined) ?.listHits(page === undefined ? undefined :{ page} ) ?? NO_HITS, ); } useSearchSettings [VariableDeclaration] (from packages/framework/react/src/search.tsx): useSearchSettings = settingsHook(SearchToken) useSearchState [VariableDeclaration] (from packages/framework/react/src/search.tsx): useSearchState = stateHook(searchState) useSelection [FunctionDeclaration] (from packages/framework/react/src/selection.tsx): export function useSelection(){ return useCapability(SelectionToken); } useSelectionEvent [FunctionDeclaration] (from packages/framework/react/src/selection.tsx): export function useSelectionEvent( select: (selection: SelectionCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(SelectionToken, select, handler); } useSelectionSettings [VariableDeclaration] (from packages/framework/react/src/selection.tsx): useSelectionSettings = settingsHook(SelectionToken) useSelectionState [VariableDeclaration] (from packages/framework/react/src/selection.tsx): useSelectionState = stateHook(selectionState) useSelector [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useSelector( token: CapabilityToken, select: (capability: C) => R, isEqual: (left: R, right: R) => boolean = Object.is, ): R{ const kernel = useKernel(); const scoped = useDocumentScope(); const capability = useOptionalCapability(token) ?? kernel.capability(token, scoped ?? undefined); const last = useRef<{ v: R} | null>(null); const get = () =>{ const next = select(capability); if (last.current && isEqual(last.current.v, next)) return last.current.v; last.current ={ v: next} ; return next; } ; return useSyncExternalStore(kernel.subscribe, get, get); } useShell [FunctionDeclaration] (from packages/framework/react/src/shell.ts): export function useShell(): ShellCapability{ return useCapability(ShellToken); } useShellEvent [FunctionDeclaration] (from packages/framework/react/src/shell.ts): export function useShellEvent( select: (shell: ShellCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(ShellToken, select, handler); } useShellState [VariableDeclaration] (from packages/framework/react/src/shell.ts): useShellState = stateHook(shellState) useSignature [FunctionDeclaration] (from packages/framework/react/src/signature.tsx): export function useSignature(): SignatureCapability{ return useCapability(SignatureToken); } useSignatureEvent [FunctionDeclaration] (from packages/framework/react/src/signature.tsx): export function useSignatureEvent( select: (signature: SignatureCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(SignatureToken, select, handler); } useSignatureSettings [VariableDeclaration] (from packages/framework/react/src/signature.tsx): useSignatureSettings = settingsHook(SignatureToken) useSignatureState [VariableDeclaration] (from packages/framework/react/src/signature.tsx): useSignatureState = stateHook(signatureState) useSignerRows [FunctionDeclaration] (from packages/framework/react/src/signature.tsx): export function useSignerRows(): SignerRow[]{ const libraries = useStampLibraries({ kind: SIGNATURES_LIBRARY_KIND} ); const assets = useStampAssets(); return useMemo(() => signerRowsOf(libraries, assets), [libraries, assets]); } useSnapshot [FunctionDeclaration] (from packages/framework/react/src/render.tsx): export function useSnapshot(): Snapshot | null{ return useOptionalSelector(RenderPublicToken, (render) => render.getSnapshot(), null); } useStage [FunctionDeclaration] (from packages/framework/react/src/stage.tsx): export function useStage(token?: StageTokenProp): StageCapability{ return useCapability(useStageToken(token)); } useStageEvent [FunctionDeclaration] (from packages/framework/react/src/stage.tsx): export function useStageEvent( select: (stage: StageCapability) => EventHook, handler: (event: T) => void, token?: StageTokenProp, ): void{ useCapabilityEvent(useStageToken(token), select, handler); } useStageSettings [FunctionDeclaration] (from packages/framework/react/src/stage.tsx): export function useStageSettings( select?: (settings: StageSettings) => Selected, token?: StageTokenProp, ): Selected{ const lens = useStageToken(token); const scoped = useDocumentScope(); return useKernelValue((kernel) =>{ const settings = kernel.tryCapability(lens, scoped ?? undefined)?.getSettings(); const value = settings ?? DEFAULT_SETTINGS; return select ? select(value) : (value as unknown as Selected); } , shallowEqual); } useStageState [FunctionDeclaration] (from packages/framework/react/src/stage.tsx): export function useStageState( select?: (state: StageState) => Selected, token?: StageTokenProp, ): Selected{ const lens = useStageToken(token); const scoped = useDocumentScope(); return useKernelValue((kernel) =>{ const stage = kernel.tryCapability(lens, scoped ?? undefined); const state = stage ? stageState.read(stage) : stageState.empty; return select ? select(state) : (state as unknown as Selected); } , shallowEqual); } useStageToken [FunctionDeclaration] (from packages/framework/react/src/stage-scope.tsx): export function useStageToken(explicit?: StageTokenProp): StageTokenProp{ const scoped = useContext(StageTokenContext); return explicit ?? scoped ?? StageToken; } useStamp [FunctionDeclaration] (from packages/framework/react/src/stamp.tsx): export function useStamp(): StampCapability{ return useCapability(StampToken); } useStampAssetPreviewUrl [FunctionDeclaration] (from packages/framework/react/src/stamp.tsx): export function useStampAssetPreviewUrl(assetId: string | null): string | null{ const stamp = useStamp(); const [url, setUrl] = useState(null); useEffect(() =>{ const preview = assetId ? stamp.getAssetPreview(assetId) : null; if (!preview){ setUrl(null); return; } const objectUrl = objectUrlOf(preview); setUrl(objectUrl.url); return () =>{ objectUrl.revoke(); setUrl(null); } ; } , [stamp, assetId]); return url; } useStampAssets [FunctionDeclaration] (from packages/framework/react/src/stamp.tsx): export function useStampAssets(filter?: StampAssetFilter): readonly StampAsset[]{ const libraryId = filter?.libraryId; const kind = filter?.kind; const category = filter?.category; return useSelector( StampToken, (stamp) => stamp.listAssets({ libraryId, kind, category} ), shallowArray, ); } useStampEvent [FunctionDeclaration] (from packages/framework/react/src/stamp.tsx): export function useStampEvent( select: (stamp: StampCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(StampToken, select, handler); } useStampLibraries [FunctionDeclaration] (from packages/framework/react/src/stamp.tsx): export function useStampLibraries(filter?: StampLibraryFilter): readonly StampLibrary[]{ const kinds = filter?.kind === undefined ? undefined : ([] as string[]).concat(filter.kind).join('\u0000'); return useSelector( StampToken, (stamp) => stamp.listLibraries(kinds === undefined ? undefined :{ kind: kinds.split('\u0000')} ), shallowArray, ); } useStampSettings [VariableDeclaration] (from packages/framework/react/src/stamp.tsx): useStampSettings = settingsHook(StampToken) useStampState [VariableDeclaration] (from packages/framework/react/src/stamp.tsx): useStampState = stateHook(stampState) useStripView [FunctionDeclaration] (from packages/framework/react/src/toolbar.tsx): export function useStripView(bar: BarSchema | undefined): StripView | null{ const commands = useCapability(CommandsToken); const documentId = useDocumentId(); const normalized = useMemo(() => (bar ? normalizeBar(bar) : null), [bar]); const groups = useKernelValue( () => normalized ? stripGroupsOf(normalized, (id) => commands.resolveCommand(id, documentId ?? undefined)) : NO_STRIP_GROUPS, stripGroupsEqual, ); return useMemo( () => groups.length === 0 ? null :{ groups, execute: (id: string) => void commands.execute(id, { documentId: documentId ?? undefined} ), } , [groups, commands, documentId], ); } useSurface [FunctionDeclaration] (from packages/framework/react/src/shell.ts): export function useSurface(id: string): SurfaceHandle{ const shell = useOptionalCapability(ShellToken); const isOpen = useOptionalSelector(ShellToken, (shell) => shell.isOpen(id), false); const props = useOptionalSelector( ShellToken, (shell) => shell.getSurface(id)?.props ?? NO_PROPS, NO_PROPS, ); return useMemo( () => ({ isOpen, props, open: (options?: OpenSurfaceOptions) => shell?.open(id, options), close: () => shell?.close(id), toggle: (options?: OpenSurfaceOptions) => shell?.toggle(id, options), } ), [shell, id, isOpen, props], ); } useSurfaceFocus [FunctionDeclaration] (from packages/framework/react/src/shell.ts): export function useSurfaceFocus( id: string, ref: RefObject, options: SurfaceFocusOptions ={ } , ): void{ const shell = useOptionalCapability(ShellToken); const request = useOptionalSelector( ShellToken, (current) => current.getSurface(id)?.focusRequest ?? 0, 0, ); const [follower] = useState(createSurfaceFocusFollower); const select = options.select ?? false; useEffect(() => follower.follow(ref.current, shell, request, { select} )); } useT [FunctionDeclaration] (from packages/framework/react/src/i18n.ts): export function useT(): (key: string, options?: TranslateOptions) => string{ return useSelector(I18nToken, (i18n) => i18n.getTranslator()); } useToolCursor [FunctionDeclaration] (from packages/framework/react/src/interaction.tsx): export function useToolCursor(spec: ToolCursorSpec | null): void{ const interaction = useOptionalCapability(InteractionHostToken); const key = spec && JSON.stringify(spec); const ref = useRef(spec); ref.current = spec; useEffect(() =>{ const cursorSpec = ref.current; if (!cursorSpec || !interaction) return; interaction.setToolCursor(cursorSpec.toolId, toolCursorsOf(cursorSpec.cursors)); return () => interaction.setToolCursor(cursorSpec.toolId, null); } , [interaction, key]); } useViewManager [FunctionDeclaration] (from packages/framework/react/src/view-manager.ts): export function useViewManager(): ViewManagerCapability{ return useCapability(ViewManagerToken); } useViewManagerEvent [FunctionDeclaration] (from packages/framework/react/src/view-manager.ts): export function useViewManagerEvent( select: (viewManager: ViewManagerCapability) => EventHook, handler: (event: T) => void, ): void{ useCapabilityEvent(ViewManagerToken, select, handler); } useViewManagerState [VariableDeclaration] (from packages/framework/react/src/view-manager.ts): useViewManagerState = stateHook(viewManagerState) useViewerSettings [FunctionDeclaration] (from packages/framework/react/src/runtime.tsx): export function useViewerSettings( select?: (settings: ViewerSettings) => Selected, ): Selected{ return useKernelValue((kernel) =>{ const settings = kernel.getSettings(); return select ? select(settings) : (settings as unknown as Selected); } , shallowEqual); } validateSearchQuery [FunctionDeclaration] (from packages/engine/core/src/search/regex.ts): export function validateSearchQuery(query: SearchQuery): SearchQueryValidation{ if (!query.regex) return{ ok: true} ; if (query.matchDiacritics){ return{ ok: false, issue: 'diacritics-with-regex', message: 'Diacritic-sensitive matching is not available for regex patterns (regex runs on the raw text plane).', } ; } if (query.ignoreWhitespace){ return{ ok: false, issue: 'ignore-whitespace-with-regex', message: 'Whitespace-insensitive matching is not available for regex patterns (regex runs on the raw text plane; use \\s* in the pattern).', } ; } return validateSearchRegex(query.text); } validateSearchRegex [FunctionDeclaration] (from packages/engine/core/src/search/regex.ts): export function validateSearchRegex(pattern: string): SearchRegexValidation{ if (pattern.length === 0){ return{ ok: false, issue: 'empty', message: 'Pattern is empty.'} ; } if (pattern.length > SEARCH_REGEX_MAX_LENGTH){ return{ ok: false, issue: 'too-long', message: `Pattern exceeds ${ SEARCH_REGEX_MAX_LENGTH} characters.`, } ; } let inClass = false; for (let i = 0; i < pattern.length; i++){ const ch = pattern[i]; if (ch === '\\'){ const next = pattern[i + 1] ?? ''; if (!inClass && next >= '1' && next <= '9'){ return{ ok: false, issue: 'backreference', message: `Backreference \\${ next} is not supported.`, } ; } if (!inClass && next === 'k' && pattern[i + 2] === '<'){ return{ ok: false, issue: 'backreference', message: 'Named backreferences (\\k<…>) are not supported.', } ; } i++; continue; } if (inClass){ if (ch === ']') inClass = false; continue; } if (ch === '['){ inClass = true; continue; } if (ch === '(' && pattern[i + 1] === '?'){ const tag = pattern[i + 2] ?? ''; if (tag === '=' || tag === '!'){ return{ ok: false, issue: 'lookaround', message: 'Lookahead ((?=…), (?!…)) is not supported.', } ; } if (tag === '<' && (pattern[i + 3] === '=' || pattern[i + 3] === '!')){ return{ ok: false, issue: 'lookaround', message: 'Lookbehind ((?<=…), (? vibrate(8), impact: (weight = 'light') => vibrate(weight === 'heavy' ? 30 : weight === 'medium' ? 20 : 10), notify: (kind) => vibrate( kind === 'error' ? [12, 60, 12, 60, 12] : kind === 'warning' ? [15, 70, 15] : [10, 50, 10], ), } viewManagerPlugin [VariableDeclaration] (from packages/plugin/view-manager/src/view-manager.plugin.ts): viewManagerPlugin = () => definePlugin({ id: 'view-manager', scope: 'workspace', token: ViewManagerToken, requires: [DocumentsToken], state: initialViewManagerModel, create: createViewManagerController, } ) viewManagerState [VariableDeclaration] (from packages/plugin/view-manager/src/state.ts): viewManagerState = defineState(ViewManagerToken, { read: (viewManager): ViewManagerState => ({ panes: viewManager.listPanes(), focusedPaneId: viewManager.getFocusedPaneId(), } ), empty:{ panes: [], focusedPaneId: null} , } ) viewerSettingsOf [FunctionDeclaration] (from packages/core/main/src/viewer-settings.ts): export function viewerSettingsOf({ identity, scope, accent, page, } : ViewerSettingsInput): ViewerSettings{ return{ identity: identity ?? null, scope: scope ?? null, accent: accent ?? VIEWER_DEFAULTS.accent, page:{ ...VIEWER_DEFAULTS.page, ...page} , } ; } webCryptoSigner [FunctionDeclaration] (from packages/core/signature/src/signers/webcrypto.ts): export function webCryptoSigner(input:{ privateKey: CryptoKey; certificateChain: Uint8Array[]; hash?: Exclude; } ): RawSigner{ const keyAlgorithm = input.privateKey.algorithm as RsaHashedKeyAlgorithm | EcKeyAlgorithm; let algorithm: RawSignatureAlgorithm; let hash: Exclude; switch (keyAlgorithm.name){ case 'RSASSA-PKCS1-v1_5': algorithm = 'RSA-PKCS1-v1_5'; hash = hashFromWebCrypto((keyAlgorithm as RsaHashedKeyAlgorithm).hash.name); break; case 'RSA-PSS': algorithm = 'RSA-PSS'; hash = hashFromWebCrypto((keyAlgorithm as RsaHashedKeyAlgorithm).hash.name); break; case 'ECDSA': algorithm = 'ECDSA'; hash = input.hash ?? 'sha256'; break; default: throw new Error(`unsupported WebCrypto key algorithm ${ keyAlgorithm.name} `); } return{ kind: 'raw', certificateChain: input.certificateChain, algorithm, hash, async sign(data){ const params: AlgorithmIdentifier | RsaPssParams | EcdsaParams = algorithm === 'RSA-PSS' ?{ name: 'RSA-PSS', saltLength:{ sha256: 32, sha384: 48, sha512: 64} [hash]} : algorithm === 'ECDSA' ?{ name: 'ECDSA', hash: WEBCRYPTO_HASH[hash]} :{ name: 'RSASSA-PKCS1-v1_5'} ; const copy = new Uint8Array(data.byteLength); copy.set(data); const signature = await globalThis.crypto.subtle.sign(params, input.privateKey, copy); return new Uint8Array(signature); } , } ; } widgetAppearanceOf [FunctionDeclaration] (from packages/core/annotation/src/record/defaults.ts): export function widgetAppearanceOf(defaults: FieldValues): WidgetAppearance{ return Object.fromEntries( WIDGET_APPEARANCE_FIELDS.filter((name) => defaults[name] !== undefined).map((name) => [ name, defaults[name], ]), ) as WidgetAppearance; } wkFeedback [VariableDeclaration] (from packages/framework/web/src/feedback.ts): wkFeedback = ( handlerName: string, fallback: WebPlatformFeedback = vibrationFeedback, ): WebPlatformFeedback =>{ const handler = (): WKMessageHandler | undefined =>{ if (typeof window === 'undefined') return undefined; const webkitWindow = window as Window &{ webkit?:{ messageHandlers?: Record} ; } ; return webkitWindow.webkit?.messageHandlers?.[handlerName]; } ; return{ selection: () =>{ const messageHandler = handler(); if (messageHandler) messageHandler.postMessage({ family: 'selection'} ); else fallback.selection(); } , impact: (weight = 'light') =>{ const messageHandler = handler(); if (messageHandler) messageHandler.postMessage({ family: 'impact', weight} ); else fallback.impact(weight); } , notify: (kind) =>{ const messageHandler = handler(); if (messageHandler) messageHandler.postMessage({ family: 'notify', kind} ); else fallback.notify(kind); } , } ; }