@bonniepdf/previewer 0.0.0-stage → 2026.11.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ export declare const STYLES = "\n:host {\n --_divider: var(--bpdf-divider, var(--cui-divider, #e2e8f0));\n --_bg: var(--bpdf-bg, var(--cui-bg, #ffffff));\n --_bg-alt: var(--bpdf-bg-alt, var(--cui-bg-alt, #f1f5f9));\n --_bg-soft: var(--bpdf-bg-soft, var(--cui-bg-soft, #f8fafc));\n --_brand: var(--bpdf-brand-2, var(--cui-brand-1, #007acc));\n --_brand-soft: var(--bpdf-brand-soft, var(--cui-brand-soft, rgba(0, 122, 204, 0.08)));\n --_text-1: var(--bpdf-text-1, var(--cui-text-1, #0f172a));\n --_text-2: var(--bpdf-text-2, var(--cui-text-2, #475569));\n --_text-3: var(--bpdf-text-3, var(--cui-text-3, #94a3b8));\n --_radius-md: var(--bpdf-radius, var(--cui-radius, 8px));\n --_radius-sm: 6px;\n\n /* Compliance severity palette (overridable via --bpdf-* tokens). */\n --_sev-error: var(--bpdf-error, var(--cui-danger-1, #dc2626));\n --_sev-warning: var(--bpdf-warning, var(--cui-status-warning-text, #d97706));\n --_sev-info: var(--bpdf-info, var(--cui-palette-blue, #2563eb));\n --_sev-ok: var(--bpdf-status-success-text, var(--bpdf-success, var(--cui-status-success-text, #047857)));\n\n display: block;\n height: 100%;\n min-height: 0;\n /* A clean default font for the chrome; the SVG pages carry their own fonts. */\n font-family: var(--bpdf-font-family, var(--cui-font-family, system-ui, -apple-system, Segoe UI, Roboto, sans-serif));\n}\n\n/* Maximized web components enter the browser's top layer via the Popover API,\n so host-page stacking contexts (sticky headers, transformed ancestors, etc.)\n cannot cover the previewer. The class selector provides the same sizing for\n createPreviewer() instances mounted directly into a light-DOM element. */\n:host(:popover-open),\n.bpp-popover-host:popover-open {\n position: fixed;\n inset: 0;\n width: 100vw;\n height: 100dvh;\n max-width: none;\n max-height: none;\n margin: 0;\n padding: 0;\n border: 0;\n overflow: hidden;\n background: var(--_bg-alt);\n z-index: 2147483647;\n}\n\n* { box-sizing: border-box; }\n\n.bpp {\n position: relative;\n display: flex;\n flex-direction: column;\n height: 100%;\n min-height: 0;\n min-width: 0;\n border: 1px solid var(--_divider);\n border-radius: var(--_radius-md);\n overflow: hidden;\n background: var(--_bg-alt);\n container-type: inline-size;\n}\n\n.bpp-no-border {\n border-color: transparent;\n border-radius: 0;\n border: none;\n}\n\n.bpp-fullscreen {\n position: fixed;\n inset: 0;\n width: 100vw;\n height: 100dvh;\n border-radius: 0;\n z-index: 2147483647;\n}\n\n/* \u2500\u2500 Toolbar \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpp-toolbar {\n display: flex;\n align-items: center;\n height: 48px;\n padding: 0 12px;\n gap: 4px;\n flex-shrink: 0;\n background: var(--_bg-soft);\n border-bottom: 1px solid var(--_divider);\n z-index: 5;\n}\n.bpp-group { display: flex; align-items: center; gap: 2px; }\n.bpp-group-end { margin-left: auto; }\n.bpp-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: 6px;\n min-width: 32px;\n height: 32px;\n padding: 0 6px;\n background: transparent;\n border: 1px solid transparent;\n border-radius: var(--_radius-sm);\n cursor: pointer;\n color: var(--_text-2);\n font: inherit;\n font-size: 0.8125rem;\n}\n.bpp-btn:hover:not(:disabled) {\n background: var(--_bg-alt);\n border-color: var(--_divider);\n color: var(--_text-1);\n}\n.bpp-btn:disabled { opacity: 0.35; cursor: not-allowed; }\n.bpp-btn-active, .bpp-btn-active:hover {\n background: var(--_brand-soft);\n border-color: var(--_brand);\n color: var(--_brand);\n}\n.bpp-btn-download { padding: 0 10px; }\n.bpp-btn-label { white-space: nowrap; }\n.bpp-icon { width: 16px; height: 16px; flex-shrink: 0; }\n.bpp-btn-active .bpp-icon-thumbs-closed,\n.bpp-btn:not(.bpp-btn-active) .bpp-icon-thumbs-open { display: none; }\n.bpp-fullscreen .bpp-icon-fullscreen-open,\n.bpp:not(.bpp-fullscreen) .bpp-icon-fullscreen-close { display: none; }\n.bpp-fullscreen-label { display: none; white-space: nowrap; }\n.bpp-fullscreen .bpp-fullscreen-label { display: inline; }\n.bpp-sep { width: 1px; height: 20px; margin: 0 6px; background: var(--_divider); flex-shrink: 0; }\n.bpp-pages-label {\n display: flex; align-items: center; gap: 4px; min-width: 56px; justify-content: center;\n font-size: 0.8125rem; color: var(--_text-2); font-variant-numeric: tabular-nums; user-select: none;\n}\n.bpp-page-current { font-weight: 600; color: var(--_text-1); }\n.bpp-page-sep, .bpp-page-total { color: var(--_text-3); }\n.bpp-zoom {\n appearance: none; -webkit-appearance: none;\n height: 32px; min-width: 96px; padding: 0 28px 0 8px;\n border: 1px solid var(--_divider); border-radius: var(--_radius-sm);\n background-color: var(--_bg);\n background-image:\n linear-gradient(45deg, transparent 50%, currentColor 50%),\n linear-gradient(135deg, currentColor 50%, transparent 50%);\n background-position: calc(100% - 17px) 50%, calc(100% - 13px) 50%;\n background-size: 4px 4px; background-repeat: no-repeat;\n color: var(--_text-1); font: inherit; font-size: 0.8125rem; cursor: pointer;\n}\n.bpp-zoom:hover { border-color: var(--_text-3); }\n\n@container (max-width: 640px) {\n .bpp-btn-label { display: none; }\n .bpp-btn-download { padding: 0 6px; }\n}\n\n/* Narrow containers (phones): the controls no longer fit on one row, so the\n toolbar wraps instead of clipping them. Separators are dropped because they\n would otherwise start or end a wrapped row. */\n@container (max-width: 560px) {\n .bpp-toolbar {\n flex-wrap: wrap;\n justify-content: center;\n height: auto;\n min-height: 48px;\n padding: 6px 8px;\n row-gap: 4px;\n }\n .bpp-sep { display: none; }\n .bpp-group-end { margin-left: 0; }\n .bpp-group-end:empty { display: none; }\n .bpp-zoom { min-width: 0; }\n}\n\n/* \u2500\u2500 Body / thumbnails / pages \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpp-body { display: flex; flex-direction: row; flex: 1; min-height: 0; overflow: hidden; }\n.bpp-thumbs {\n width: 168px; flex-shrink: 0; overflow-y: auto; overscroll-behavior: contain;\n background: var(--_bg-soft); border-right: 1px solid var(--_divider);\n}\n.bpp-thumbs[hidden] { display: none; }\n.bpp-thumbs-list { list-style: none; margin: 0; padding: 12px; display: flex; flex-direction: column; gap: 12px; }\n.bpp-thumb {\n display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%;\n padding: 0; background: none; border: none; cursor: pointer; color: var(--_text-3); font: inherit;\n}\n.bpp-thumb-canvas {\n display: block; width: 100%; background: #fff; border: 2px solid transparent; border-radius: 2px;\n box-shadow: 0 1px 3px rgba(0,0,0,0.16); overflow: hidden;\n transition: border-color 0.15s ease, box-shadow 0.15s ease;\n}\n.bpp-thumb-canvas svg { display: block; width: 100%; height: auto; }\n/* Link overlays stay inert in thumbnails - a thumbnail click always navigates\n to the page, never follows the document's links. */\n.bpp-thumb-canvas svg a, .bpp-thumb-canvas svg [data-bp-link-page] { pointer-events: none; }\n.bpp-thumb:hover .bpp-thumb-canvas { border-color: var(--_brand); }\n.bpp-thumb-active .bpp-thumb-canvas { border-color: var(--_brand); box-shadow: 0 0 0 1px var(--_brand); }\n.bpp-thumb-label { font-size: 0.75rem; font-variant-numeric: tabular-nums; }\n.bpp-thumb-active .bpp-thumb-label { color: var(--_text-1); font-weight: 600; }\n/* scrollbar-gutter: stable reserves the vertical scrollbar's space at all\n times so the scroll container's clientWidth doesn't jump when the scrollbar\n appears/disappears. Without it, fit-width sizing forms a feedback loop with\n the ResizeObserver (width -> page scale -> content height -> scrollbar ->\n width...), which oscillates forever for documents whose fitted height lands\n right at the viewport boundary (e.g. the pdf-compliance example). */\n.bpp-scroll { flex: 1; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }\n.bpp-pages { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 24px; min-width: min-content; }\n.bpp-page {\n position: relative;\n flex-shrink: 0; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,0.18);\n /* Let the browser skip layout/paint of off-screen pages as a second layer of\n virtualisation on top of the JS mount/unmount. */\n content-visibility: auto;\n}\n.bpp-page-canvas { position: absolute; inset: 0; z-index: 0; }\n.bpp-page svg { display: block; width: 100%; height: 100%; }\n\n/* Chromium paints native SVG selection around glyph cells and leaves the\n advances occupied by spaces uncoloured. A measured overlay fills those gaps;\n the native background is made transparent while its selected foreground is\n retained. The overlay is inert and remains below inspector highlights. */\n.bpp-page-canvas svg text::selection {\n background-color: transparent;\n color: inherit;\n fill: inherit;\n}\n.bpp-selection-layer {\n position: absolute; inset: 0; overflow: hidden;\n pointer-events: none; z-index: 1;\n}\n.bpp-selection-rect {\n position: absolute; display: block;\n background: var(--bpdf-selection, Highlight); opacity: 0.45;\n}\n@media (forced-colors: active) {\n .bpp-page-canvas svg text::selection { color: HighlightText; fill: HighlightText; }\n .bpp-selection-rect { opacity: 1; }\n}\n\n/* \u2500\u2500 Plugin overlays (inspector highlights) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpp-overlay { position: absolute; inset: 0; pointer-events: none; z-index: 2; }\n\n/* \u2500\u2500 Shared inspector side panel (tabbed: structure / compliance / \u2026) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpp-side {\n width: 280px; flex-shrink: 0;\n display: flex; flex-direction: column; min-height: 0;\n border-left: 1px solid var(--_divider); background: var(--_bg-alt);\n font-size: 0.8125rem; color: var(--_text-2);\n}\n.bpp-side[hidden] { display: none; }\n\n/* Splitter between the document area and the inspector panel. A 7px hit area\n that straddles the panel's left seam via negative margins, so it adds no\n layout width. The visible accent line only appears on hover/focus/drag; at\n rest the panel's own border-left is the divider. */\n.bpp-side-resizer {\n flex: 0 0 auto;\n align-self: stretch;\n width: 7px;\n margin-left: -4px;\n margin-right: -3px;\n position: relative;\n z-index: 3;\n cursor: col-resize;\n background: transparent;\n touch-action: none;\n}\n.bpp-side-resizer[hidden] { display: none; }\n.bpp-side-resizer::before {\n content: \"\";\n position: absolute;\n top: 0; bottom: 0; left: 50%;\n width: 2px;\n transform: translateX(-50%);\n background: var(--_brand);\n opacity: 0;\n transition: opacity 0.15s ease;\n}\n.bpp-side-resizer:hover::before,\n.bpp-side-resizer:focus-visible::before,\n.bpp-side-resizer-active::before { opacity: 1; }\n.bpp-side-resizer:focus-visible { outline: none; }\n\n/* Tab strip: one tab per registered panel; hidden when there's only one. */\n.bpp-side-tabs {\n display: flex; flex-shrink: 0; gap: 2px; padding: 6px 6px 0;\n border-bottom: 1px solid var(--_divider);\n}\n.bpp-side-tabs[hidden] { display: none; }\n.bpp-side-tab {\n display: inline-flex; align-items: center; gap: 6px;\n padding: 6px 10px; border: 0; border-bottom: 2px solid transparent;\n background: none; color: var(--_text-2); font: inherit; font-size: 0.8125rem;\n font-weight: 600; cursor: pointer; white-space: nowrap;\n}\n.bpp-side-tab:hover { color: var(--_text-1); }\n.bpp-side-tab-active {\n color: var(--_brand); border-bottom-color: var(--_brand);\n}\n.bpp-side-tab-badge {\n min-width: 16px; height: 16px; padding: 0 4px; box-sizing: border-box;\n display: inline-flex; align-items: center; justify-content: center;\n border-radius: 999px; font-size: 0.625rem; font-weight: 700; line-height: 1; color: #fff;\n}\n.bpp-side-tab-badge[hidden] { display: none; }\n.bpp-side-tab-badge-error { background: var(--_sev-error); }\n.bpp-side-tab-badge-warning { background: var(--_sev-warning); }\n.bpp-side-tab-badge-info { background: var(--_sev-info); }\n.bpp-side-tab-badge-ok { background: var(--_sev-ok); }\n/* Body: holds every panel's element; only the active one is shown. */\n.bpp-side-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }\n.bpp-side-body > [hidden] { display: none; }\n.bpp-side-body > * { flex: 1 1 auto; min-height: 0; }\n/* Toolbar toggle: a dot signals unseen issues while the panel is collapsed. */\n.bpp-side-toggle { position: relative; }\n.bpp-side-toggle-dot {\n position: absolute; top: 3px; right: 3px;\n width: 8px; height: 8px; border-radius: 50%;\n box-shadow: 0 0 0 1.5px var(--_bg);\n}\n.bpp-side-toggle-dot[hidden] { display: none; }\n.bpp-side-toggle-dot-error { background: var(--_sev-error); }\n.bpp-side-toggle-dot-warning { background: var(--_sev-warning); }\n.bpp-side-toggle-dot-info { background: var(--_sev-info); }\n.bpp-tree { list-style: none; margin: 0; padding: 6px 0; }\n.bpp-tree ul { list-style: none; margin: 0; padding-left: 14px; }\n.bpp-tree-row {\n display: flex; align-items: baseline; gap: 6px; width: 100%;\n padding: 3px 10px; border: 0; background: none; text-align: left;\n color: inherit; font: inherit; cursor: pointer;\n}\n.bpp-tree-row:hover { background: color-mix(in srgb, var(--_brand) 10%, transparent); }\n.bpp-tree-row[aria-selected=\"true\"] {\n background: color-mix(in srgb, var(--_brand) 16%, transparent);\n color: var(--_text-1); font-weight: 600;\n}\n.bpp-tree-row:focus-visible {\n outline: 2px solid var(--_brand); outline-offset: -2px;\n}\n.bpp-tree-type { color: var(--_text-1); }\n.bpp-tree-name {\n color: var(--_text-3); font-style: italic;\n overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n}\n/* Expand/collapse affordance: a CSS triangle that rotates, so no icon asset and\n no extra DOM. Leaves keep the box for alignment but draw nothing. */\n.bpp-tree-twisty {\n flex: 0 0 auto; width: 10px; height: 10px; position: relative;\n}\n.bpp-tree-twisty::before {\n content: ''; position: absolute; left: 2px; top: 1px;\n border: 4px solid transparent; border-left-color: var(--_text-3);\n transition: transform 0.12s ease;\n}\n.bpp-tree-row[aria-expanded=\"true\"] > .bpp-tree-twisty::before {\n transform: rotate(90deg); transform-origin: 2px 4px;\n}\n.bpp-tree-twisty-leaf::before { content: none; }\n@media (prefers-reduced-motion: reduce) {\n .bpp-tree-twisty::before { transition: none; }\n}\n\n/* \u2500\u2500 Footer \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n/* Slim bar under the page area: host text left, document conformance pills\n right. Rendered only when the host opts in via the footer option. */\n.bpp-footer {\n display: flex;\n align-items: center;\n justify-content: space-between;\n flex-wrap: wrap;\n gap: 0.25rem 0.75rem;\n min-height: 34px;\n padding: 0.25rem 12px;\n flex-shrink: 0;\n background: var(--_bg-soft);\n border-top: 1px solid var(--_divider);\n font-size: 0.75rem;\n color: var(--_text-3);\n}\n.bpp-footer-text {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.bpp-footer-tags {\n display: flex;\n align-items: center;\n gap: 0.35rem;\n flex-shrink: 0;\n}\n.bpp-footer-tag {\n display: inline-flex;\n align-items: center;\n padding: 0.1rem 0.5rem;\n border-radius: 999px;\n font-size: 0.6875rem;\n font-weight: 600;\n letter-spacing: 0.02em;\n color: var(--_brand);\n background: var(--_brand-soft);\n white-space: nowrap;\n}\n\n/* \u2500\u2500 Loading overlay \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpp-loading {\n position: absolute; inset: 0; z-index: 6;\n display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;\n background: var(--_bg-alt); color: var(--_text-3); font-size: 0.875rem;\n}\n.bpp-loading[hidden] { display: none; }\n.bpp-spinner {\n width: 34px; height: 34px; border-radius: 50%;\n border: 3px solid var(--_divider); border-top-color: var(--_brand);\n animation: bpp-spin 0.8s linear infinite;\n}\n@keyframes bpp-spin { to { transform: rotate(360deg); } }\n\n/* \u2500\u2500 Busy and error states \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpp-busy .bpp-pages { opacity: 0.55; transition: opacity 120ms ease; }\n.bpp-error {\n position: absolute; inset: 0; z-index: 7;\n display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;\n padding: 24px; text-align: center;\n background: var(--_bg-alt); color: var(--_text-2); font-size: 0.875rem;\n}\n.bpp-error[hidden] { display: none; }\n.bpp-error-title { font-weight: 600; color: var(--_text-1); }\n.bpp-error-detail { color: var(--_text-3); overflow-wrap: anywhere; }\n.bpp-error-detail:empty { display: none; }\n.bpp-error.bpp-error-banner {\n inset: auto 0 0 0; flex-direction: row; justify-content: flex-start; gap: 8px;\n padding: 8px 12px; border-top: 1px solid var(--_divider); text-align: left;\n}\n@media (prefers-reduced-motion: reduce) { .bpp-spinner { animation-duration: 2s; } }\n\n/* \u2500\u2500 Compliance view plugin \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n.bpp-cv-host { display: flex; flex-direction: column; height: 100%; min-height: 0; }\n\n/* Summary block: fixed height on both tabs, so it never squeezes the tree. */\n.bpp-cv-summary {\n flex: 0 0 auto;\n padding: 10px 12px; border-bottom: 1px solid var(--_divider);\n display: flex; flex-direction: column; gap: 8px;\n}\n.bpp-cv-header { display: flex; flex-direction: column; gap: 8px; }\n.bpp-cv-pills { display: flex; flex-wrap: wrap; gap: 6px; }\n.bpp-cv-pill {\n padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600;\n color: #fff;\n}\n.bpp-cv-pill-error { background: var(--_sev-error); }\n.bpp-cv-pill-warning { background: var(--_sev-warning); }\n.bpp-cv-pill-info { background: var(--_sev-info); }\n.bpp-cv-pill-zero { background: var(--_bg-alt); color: var(--_text-2); border: 1px solid var(--_divider); }\n.bpp-cv-verdict { font-size: 0.8125rem; font-weight: 600; }\n.bpp-cv-verdict-pass { color: var(--_sev-ok); }\n.bpp-cv-verdict-fail { color: var(--_sev-error); }\n.bpp-cv-filter { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; color: var(--_text-2); cursor: pointer; }\n\n/* Settings row: the finding filters, then the tree's expand/collapse actions. */\n.bpp-cv-settings { display: flex; flex-direction: column; gap: 6px; }\n.bpp-cv-filters { display: flex; flex-direction: column; gap: 4px; }\n.bpp-cv-tree-actions { display: flex; gap: 6px; }\n.bpp-cv-action {\n padding: 2px 8px; border: 1px solid var(--_divider); border-radius: 5px;\n background: none; color: var(--_text-2); font: inherit; font-size: 0.6875rem;\n cursor: pointer;\n}\n.bpp-cv-action:hover { background: var(--_brand-soft); color: var(--_text-1); }\n.bpp-cv-action:focus-visible { outline: 2px solid var(--_brand); outline-offset: 1px; }\n\n/* Section titles. */\n.bpp-cv-section-title {\n font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em;\n color: var(--_text-3); font-weight: 700; padding: 8px 12px 4px;\n}\n\n/* Findings tab. The list scrolls on its own so it can be any length without\n competing with the tree, which lives on the other tab. */\n.bpp-cv-issues { overflow: hidden; }\n.bpp-cv-issues-head {\n flex: 0 0 auto; padding: 10px 12px; border-bottom: 1px solid var(--_divider);\n display: flex; flex-direction: column; gap: 8px;\n}\n.bpp-cv-issues-list {\n flex: 1 1 auto; overflow: auto; min-height: 0;\n display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px;\n}\n.bpp-cv-issues-group { display: flex; flex-direction: column; gap: 6px; }\n.bpp-cv-scope {\n align-self: flex-start; padding: 1px 6px; border-radius: 999px;\n border: 1px solid var(--_divider); color: var(--_text-3); font-size: 0.625rem;\n text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;\n}\n.bpp-cv-finding-where { margin: 0; font-size: 0.75rem; }\n.bpp-cv-finding-el { color: var(--_text-1); font-weight: 600; }\n.bpp-cv-finding-page { color: var(--_text-3); font-variant-numeric: tabular-nums; }\n\n/* Tree area (scrolls). */\n.bpp-cv-tree-host { flex: 1 1 auto; overflow: auto; min-height: 60px; }\n.bpp-cv-tree { padding: 4px 0; }\n.bpp-cv-row { align-items: center; }\n\n/* Finding icons. */\n.bpp-cv-issue-icon { display: inline-flex; flex: 0 0 auto; }\n.bpp-cv-issue-icon .bpp-icon { width: 14px; height: 14px; }\n.bpp-cv-issue-icon-error { color: var(--_sev-error); }\n.bpp-cv-issue-icon-warning { color: var(--_sev-warning); }\n.bpp-cv-issue-icon-info { color: var(--_sev-info); }\n\n/* Role chips. */\n.bpp-cv-role {\n flex: 0 0 auto; padding: 0 5px; border-radius: 4px; font-size: 0.6875rem;\n font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.5;\n background: var(--_bg-soft); color: var(--_text-2); border: 1px solid var(--_divider);\n}\n.bpp-cv-role-heading { background: color-mix(in srgb, var(--_brand) 14%, transparent); color: var(--_brand); border-color: transparent; }\n.bpp-cv-role-figure { background: color-mix(in srgb, var(--_sev-info) 14%, transparent); color: var(--_sev-info); border-color: transparent; }\n.bpp-cv-role-table { background: color-mix(in srgb, var(--_sev-ok) 16%, transparent); color: var(--_sev-ok); border-color: transparent; }\n.bpp-cv-role-artifact { background: transparent; color: var(--_text-3); border-style: dashed; }\n.bpp-cv-row .bpp-cv-role { background: transparent; color: var(--_text-2); border-color: var(--_text-3); }\n.bpp-cv-row .bpp-cv-role-tagged {\n background: color-mix(in srgb, var(--_sev-ok) 14%, transparent);\n color: var(--_text-1); border-color: transparent;\n}\n@media (forced-colors: active) {\n .bpp-cv-row .bpp-cv-role-tagged {\n forced-color-adjust: none;\n background: CanvasText; color: Canvas;\n }\n}\n\n/* Detail pane. */\n.bpp-cv-detail { border-top: 1px solid var(--_divider); max-height: 42%; overflow: auto; flex: 0 0 auto; }\n.bpp-cv-detail-body { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 8px; }\n.bpp-cv-detail-head { display: flex; align-items: center; gap: 6px; padding: 0 12px 6px; }\n.bpp-cv-detail-type { font-weight: 700; color: var(--_text-1); font-size: 0.8125rem; }\n.bpp-cv-detail-name { color: var(--_text-3); font-size: 0.8125rem; font-style: italic; }\n.bpp-cv-geom { margin: 0 12px 4px; font-size: 0.75rem; color: var(--_text-3); font-variant-numeric: tabular-nums; }\n.bpp-cv-attr { margin: 0 12px; font-size: 0.75rem; color: var(--_text-2); font-style: italic; }\n.bpp-cv-empty { padding: 4px 12px; font-size: 0.75rem; color: var(--_text-3); }\n\n/* Finding cards. */\n.bpp-cv-finding {\n border: 1px solid var(--_divider); border-left-width: 3px; border-radius: var(--_radius-sm);\n padding: 8px 10px; background: var(--_bg); display: flex; flex-direction: column; gap: 5px;\n}\n.bpp-cv-issues-group .bpp-cv-finding { margin: 0 12px; }\n.bpp-cv-finding-error { border-left-color: var(--_sev-error); }\n.bpp-cv-finding-warning { border-left-color: var(--_sev-warning); }\n.bpp-cv-finding-info { border-left-color: var(--_sev-info); }\n.bpp-cv-finding-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n.bpp-cv-badge {\n padding: 1px 6px; border-radius: 4px; font-size: 0.625rem; font-weight: 700;\n text-transform: uppercase; letter-spacing: 0.03em; color: #fff;\n}\n.bpp-cv-badge-error { background: var(--_sev-error); }\n.bpp-cv-badge-warning { background: var(--_sev-warning); }\n.bpp-cv-badge-info { background: var(--_sev-info); }\n.bpp-cv-clause { font-size: 0.6875rem; color: var(--_text-3); font-variant-numeric: tabular-nums; }\n.bpp-cv-msg { margin: 0; font-size: 0.75rem; color: var(--_text-1); line-height: 1.45; }\n.bpp-cv-fix { margin: 0; font-size: 0.75rem; color: var(--_text-2); line-height: 1.45; }\n.bpp-cv-fix-label { font-weight: 700; color: var(--_sev-ok); }\n.bpp-cv-jump {\n align-self: flex-start; margin-top: 2px; padding: 3px 8px; border: 1px solid var(--_divider);\n border-radius: var(--_radius-sm); background: var(--_bg-soft); color: var(--_brand);\n font: inherit; font-size: 0.6875rem; font-weight: 600; cursor: pointer;\n}\n.bpp-cv-jump:hover { background: var(--_brand-soft); }\n\n/* On-page markers (issues heatmap) + selection. */\n.bpp-cv-mark { position: absolute; box-sizing: border-box; border-radius: 1px; border: 1px solid transparent; }\n.bpp-cv-mark-error { background: color-mix(in srgb, var(--_sev-error) 12%, transparent); border-color: color-mix(in srgb, var(--_sev-error) 55%, transparent); }\n.bpp-cv-mark-warning { background: color-mix(in srgb, var(--_sev-warning) 12%, transparent); border-color: color-mix(in srgb, var(--_sev-warning) 55%, transparent); }\n.bpp-cv-mark-info { background: color-mix(in srgb, var(--_sev-info) 10%, transparent); border-color: color-mix(in srgb, var(--_sev-info) 45%, transparent); }\n.bpp-cv-sel { position: absolute; box-sizing: border-box; border-radius: 1px; background: color-mix(in srgb, var(--_brand) 16%, transparent); border: 2px solid var(--_brand); }\n.bpp-cv-sel-error { background: color-mix(in srgb, var(--_sev-error) 20%, transparent); border-color: var(--_sev-error); }\n.bpp-cv-sel-warning { background: color-mix(in srgb, var(--_sev-warning) 20%, transparent); border-color: var(--_sev-warning); }\n.bpp-cv-sel-info { background: color-mix(in srgb, var(--_sev-info) 18%, transparent); border-color: var(--_sev-info); }\n\n/* \u2500\u2500 Custom Scrollbars \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */\n/* scrollbar-color is inherited. Set it on the previewer root so nested plugin\n scrollers (such as the accessibility inspector) cannot inherit the host\n document's scrollbar theme through the shadow host. */\n.bpp-styled-scrollbars {\n scrollbar-color: var(--_divider) transparent;\n}\n";
@@ -0,0 +1,406 @@
1
+ /**
2
+ * A single previewable page: its `<svg>` markup plus its intrinsic size in PDF
3
+ * points. Hosts can pass `fontFaceCss` through `LoadOptions` once per document
4
+ * instead of inlining duplicate font CSS into every page SVG.
5
+ */
6
+ export interface PreviewPage {
7
+ /** `<svg>...</svg>` markup for the page. */
8
+ svg: string;
9
+ /** Page width in PDF points (the SVG's intrinsic width). */
10
+ width: number;
11
+ /** Page height in PDF points (the SVG's intrinsic height). */
12
+ height: number;
13
+ }
14
+ /** How the previewer fits pages into the available viewport space. */
15
+ export type FitMode = 'fit-page' | 'fit-width' | 'custom';
16
+ /** A semantic fit mode or an explicit scale selected by the user. */
17
+ export interface PreviewerZoomState {
18
+ mode: FitMode;
19
+ /** Scale factor used when `mode` is `custom` (1 = 100%). */
20
+ scale?: number;
21
+ }
22
+ /** One rectangle an element occupied on a page (top-left origin, PDF points). */
23
+ export interface SnapshotRect {
24
+ page: number;
25
+ x: number;
26
+ y: number;
27
+ width: number;
28
+ height: number;
29
+ }
30
+ /**
31
+ * Intrinsic accessibility facts for a node, mirroring `@bonniepdf/core`'s
32
+ * `NodeAccessibility`. Present only when the element declares a role.
33
+ */
34
+ export interface NodeAccessibility {
35
+ /** Resolved PDF structure tag, e.g. `'H1'`, `'P'`, `'Figure'`, `'TH'`. */
36
+ role: string;
37
+ /** True when the element contributes real content to the structure tree. */
38
+ tagged: boolean;
39
+ /** True when the element renders as an `/Artifact` (out of reading order). */
40
+ artifact: boolean;
41
+ /** `/Alt` alternate text, when supplied. */
42
+ alt?: string;
43
+ /** Author explicitly marked the element decorative. */
44
+ decorative?: boolean;
45
+ /** Heading level 1–6 for `H1`…`H6`. */
46
+ headingLevel?: number;
47
+ /** True for image-like elements (figure candidates). */
48
+ imageLike?: boolean;
49
+ }
50
+ /** One node in the layout tree. */
51
+ export interface SnapshotNode {
52
+ id: string;
53
+ type: string;
54
+ name?: string;
55
+ /** Opaque source id supplied by an instrumented editor preview build. */
56
+ sourceId?: string;
57
+ rects: SnapshotRect[];
58
+ /** Intrinsic accessibility facts, when the element declares a role. */
59
+ a11y?: NodeAccessibility;
60
+ children: SnapshotNode[];
61
+ }
62
+ /** Document-level accessibility/compliance context, mirroring core's `SnapshotMeta`. */
63
+ export interface SnapshotMeta {
64
+ accessibilityMode: number;
65
+ conformance: string;
66
+ language?: string;
67
+ title?: string;
68
+ }
69
+ /** The captured layout of a document, as consumed by inspector plugins. */
70
+ export interface LayoutSnapshot {
71
+ version: number;
72
+ pages: {
73
+ width: number;
74
+ height: number;
75
+ }[];
76
+ root: SnapshotNode;
77
+ /** Document-level accessibility/compliance context. */
78
+ meta?: SnapshotMeta;
79
+ }
80
+ /** Severity of a compliance finding. */
81
+ export type ComplianceSeverity = 'error' | 'warning' | 'info';
82
+ /** One reported accessibility/compliance issue. */
83
+ export interface ComplianceFinding {
84
+ code: string;
85
+ severity: ComplianceSeverity;
86
+ standard: string;
87
+ clause: string;
88
+ message: string;
89
+ fixHint?: string;
90
+ /** The node this finding anchors to; omitted for document-level findings. */
91
+ nodeId?: string;
92
+ role?: string;
93
+ page?: number;
94
+ }
95
+ /** The result of evaluating a snapshot for compliance. */
96
+ export interface ComplianceReport {
97
+ findings: ComplianceFinding[];
98
+ passed: boolean;
99
+ errorCount: number;
100
+ warningCount: number;
101
+ infoCount: number;
102
+ }
103
+ /**
104
+ * Capabilities the previewer host hands to a plugin. Everything here is a thin
105
+ * wrapper over machinery the previewer already owns (page elements, the scale
106
+ * factor, scroll-to-page); plugins never reach into the controller internals.
107
+ */
108
+ export interface PreviewerPluginContext {
109
+ /** The owning document, for creating elements. */
110
+ readonly ownerDocument: Document;
111
+ /** Host element used for composed integration events. */
112
+ readonly hostElement: HTMLElement;
113
+ /** Adds a control to the toolbar's trailing group. */
114
+ addToolbarItem(element: HTMLElement): void;
115
+ /**
116
+ * Registers a side panel in the body (beside the page scroll area). All
117
+ * registered panels share **one** collapsible region with a tab strip — only
118
+ * one panel is ever visible at a time, and a single toolbar button toggles the
119
+ * region. This keeps multiple inspector plugins (structure, compliance, …) from
120
+ * stacking as competing side-by-side panels.
121
+ *
122
+ * - `defaultOpen`: open the region on this panel when it registers (the first
123
+ * panel to request it wins; later panels become inactive tabs).
124
+ * - `onVisibilityChange`: called with `true` when this panel becomes the active,
125
+ * visible tab and `false` when it stops being (region closed or switched away).
126
+ * Plugins use it to paint/clear on-page overlays instead of tracking their own
127
+ * toolbar toggle.
128
+ *
129
+ * The returned handle drives the panel: `setVisible` activates/closes it, and
130
+ * `setBadge` shows a small count/severity badge on its tab (and contributes a
131
+ * dot to the shared toolbar toggle so issues are visible while collapsed).
132
+ */
133
+ addSidePanel(panel: {
134
+ id: string;
135
+ label: string;
136
+ element: HTMLElement;
137
+ defaultOpen?: boolean;
138
+ onVisibilityChange?: (visible: boolean) => void;
139
+ }): {
140
+ setVisible(visible: boolean): void;
141
+ setBadge(text: string | null, tone?: 'error' | 'warning' | 'info' | 'ok'): void;
142
+ };
143
+ /** The `.bpp-page` host element for a 0-based page index, or null. */
144
+ pageElement(index: number): HTMLElement | null;
145
+ /**
146
+ * The pointer-events:none overlay layer for a page, created on first use.
147
+ * Plugins paint absolutely-positioned children into it; it survives the
148
+ * windowed mount/unmount of the page's SVG.
149
+ */
150
+ overlayFor(index: number): HTMLElement | null;
151
+ /** Current scale factor mapping PDF points to CSS pixels. */
152
+ scale(): number;
153
+ /** Number of pages currently loaded. */
154
+ pageCount(): number;
155
+ /** Scrolls a 1-based page into view (mirrors the toolbar's navigation). */
156
+ scrollToPage(pageNumber: number): void;
157
+ }
158
+ /** Per-load context: the plugin context plus the document being shown. */
159
+ export interface PreviewerLoadContext extends PreviewerPluginContext {
160
+ pages: PreviewPage[];
161
+ /** The layout snapshot, when the host was given one via {@link LoadOptions.snapshot}. */
162
+ snapshot?: LayoutSnapshot;
163
+ /** The compliance report, when the host was given one via {@link LoadOptions.report}. */
164
+ report?: ComplianceReport;
165
+ }
166
+ /** State pushed to plugins whenever the viewport scale or current page changes. */
167
+ export interface PreviewerSyncContext {
168
+ scale: number;
169
+ currentPage: number;
170
+ }
171
+ /**
172
+ * A previewer plugin. Lifecycle: `setup` once when the previewer is built (may
173
+ * return a cleanup fn), `load` on every document load, `sync` on scale/page
174
+ * changes, `teardown` on dispose or when a load supersedes the previous one.
175
+ * With no plugins registered the previewer behaves exactly as before.
176
+ */
177
+ export interface PreviewerPlugin {
178
+ readonly name: string;
179
+ /**
180
+ * Set when the plugin reads the layout snapshot or compliance report. When any
181
+ * registered plugin sets it, `load(doc)` asks the document to capture its
182
+ * layout; otherwise it skips that work.
183
+ */
184
+ readonly needsLayout?: boolean;
185
+ setup?(ctx: PreviewerPluginContext): void | (() => void);
186
+ load?(ctx: PreviewerLoadContext): void;
187
+ sync?(ctx: PreviewerSyncContext): void;
188
+ /** Selects a snapshot node when the plugin owns node-selection UI. */
189
+ selectSnapshotNode?(nodeId: string): boolean;
190
+ teardown?(): void;
191
+ }
192
+ /**
193
+ * Controls which built-in toolbar groups render. Each flag defaults to `true`,
194
+ * so an omitted `toolbar` (or omitted flag) leaves the toolbar exactly as it was
195
+ * before this option existed. Hosts embedding the previewer in a context that
196
+ * owns its own chrome (e.g. an editor panel with native save/fullscreen) can
197
+ * drop the groups that don't apply. Note these gate the built-in groups only —
198
+ * plugin-contributed controls (via `addToolbarItem`) are unaffected.
199
+ */
200
+ export interface ToolbarConfig {
201
+ /** The thumbnail-rail toggle button. Defaults to `true`. */
202
+ thumbnails?: boolean;
203
+ /** The previous / page-indicator / next group. Defaults to `true`. */
204
+ pageNav?: boolean;
205
+ /** The zoom-out / zoom-select / zoom-in group. Defaults to `true`. */
206
+ zoom?: boolean;
207
+ /** The full-screen toggle button. Defaults to `true`. */
208
+ fullscreen?: boolean;
209
+ /** The download-PDF button. Defaults to `true`. */
210
+ download?: boolean;
211
+ }
212
+ /**
213
+ * The optional footer bar. Set {@link PreviewerOptions.footer} to render a slim
214
+ * bar below the page area: host-supplied text on the left, and conformance pills
215
+ * on the right derived from each loaded document's snapshot metadata (e.g.
216
+ * `PDF/A-2a`, `PDF/UA-1`). Omitting `footer` renders no bar at all — the
217
+ * previewer's layout is exactly as it was before this option existed.
218
+ */
219
+ export interface FooterConfig {
220
+ /**
221
+ * Left-aligned text. Defaults to `'Generated by @bonniepdf/previewer'`. Set an
222
+ * empty string to leave the left side blank (the pills still render).
223
+ */
224
+ text?: string;
225
+ /**
226
+ * Render conformance pills derived from the loaded document's
227
+ * `snapshot.meta`: its PDF/A conformance level and PDF/UA-1 tagging. Defaults
228
+ * to `true`. Documents loaded without a snapshot simply show no pills.
229
+ */
230
+ conformance?: boolean;
231
+ }
232
+ /** Visibility state for the previewer's collapsible navigation panels. */
233
+ export interface PreviewerViewState {
234
+ showThumbnails: boolean;
235
+ showInspector: boolean;
236
+ zoom: PreviewerZoomState;
237
+ }
238
+ /** Configuration applied when a previewer is created (chrome / defaults). */
239
+ export interface PreviewerOptions {
240
+ /** Plugins extending the previewer (e.g. the accessibility inspector). Optional. */
241
+ plugins?: PreviewerPlugin[];
242
+ /**
243
+ * Which built-in toolbar groups to render. Every flag defaults to `true`, so
244
+ * omitting this leaves the full toolbar in place. See {@link ToolbarConfig}.
245
+ */
246
+ toolbar?: ToolbarConfig;
247
+ /** Show the thumbnail rail on first render. Defaults to `false`. */
248
+ showThumbnails?: boolean;
249
+ /**
250
+ * Show the shared inspector region on first render. When omitted, inspector
251
+ * plugins retain their own `openByDefault` behaviour.
252
+ */
253
+ showInspector?: boolean;
254
+ /** Restores a previously selected zoom. `fitMode` remains the fallback. */
255
+ initialZoom?: PreviewerZoomState;
256
+ /** Called whenever panel visibility or the user-selected zoom changes. */
257
+ onViewStateChange?: (state: PreviewerViewState) => void;
258
+ /** Initial fit mode. Defaults to `'fit-page'`. */
259
+ fitMode?: Exclude<FitMode, 'custom'>;
260
+ /** Accessible label for the previewer region. Defaults to `'PDF preview'`. */
261
+ title?: string;
262
+ /** Default download filename. Defaults to `'document.pdf'`. */
263
+ downloadFilename?: string;
264
+ /** Hides the outer border and border-radius around the previewer. Defaults to `false`. */
265
+ hideBorder?: boolean;
266
+ /**
267
+ * Renders the footer bar below the page area. Omit for no footer. See
268
+ * {@link FooterConfig}.
269
+ */
270
+ footer?: FooterConfig;
271
+ /** Whether to apply custom styling to scrollbars. Defaults to `false`. */
272
+ styleScrollbars?: boolean;
273
+ /**
274
+ * Selection highlight colour as any valid CSS colour. Defaults to the
275
+ * platform-standard `Highlight` system colour. This takes precedence over
276
+ * an inherited `--bpdf-selection` custom property.
277
+ */
278
+ selectionColor?: string;
279
+ }
280
+ /** Per-document data handed to the deprecated `load(pages, options)` form. */
281
+ export interface LoadOptions {
282
+ /**
283
+ * `@font-face` CSS (e.g. from `generateSvgDocumentAsync`) embedding the
284
+ * subsetted fonts the document uses, so pages render with the exact faces they
285
+ * were laid out with. Injected once at the document level (font resources are
286
+ * document-scoped and reach shadow content; the names are namespaced so they
287
+ * never collide with installed fonts).
288
+ */
289
+ fontFaceCss?: string;
290
+ /**
291
+ * A ready PDF blob/URL for the download button.
292
+ * @deprecated Load the document or its export and pass {@link PreviewLoadOptions.pdf}.
293
+ */
294
+ pdfUrl?: string;
295
+ /**
296
+ * Lazily produces the PDF blob URL on the first download click. Preferred over
297
+ * {@link pdfUrl} so previewing a large document does not pay for full PDF
298
+ * generation unless the user actually downloads.
299
+ * @deprecated Load the document or its export and pass {@link PreviewLoadOptions.pdf}.
300
+ */
301
+ pdfProvider?: () => Promise<string>;
302
+ /** Overrides the download filename for this document. */
303
+ downloadFilename?: string;
304
+ /**
305
+ * The layout snapshot for this document (from `generateSvgDocumentAsync({
306
+ * captureLayout: true })`). Consumed by the accessibility inspector; ignored
307
+ * when no plugin uses it.
308
+ */
309
+ snapshot?: LayoutSnapshot;
310
+ /**
311
+ * A precomputed compliance report for this document (from core's
312
+ * `evaluateCompliance(snapshot)`). Consumed by the compliance-view plugin. When
313
+ * omitted while a `snapshot` is present, the plugin still shows role/status
314
+ * badges from the snapshot, just without severity findings.
315
+ */
316
+ report?: ComplianceReport;
317
+ }
318
+ /**
319
+ * A document the previewer can render itself: any object with these two methods,
320
+ * which `@bonniepdf/core`'s `Document` has. Checked by shape, not by class, so
321
+ * the previewer works with whichever copy of core the host bundles.
322
+ */
323
+ export interface PreviewableDocument {
324
+ generateSvgDocumentAsync(options?: {
325
+ captureLayout?: boolean;
326
+ }): Promise<PreviewExport>;
327
+ generateBytesAsync(): Promise<Uint8Array>;
328
+ readonly metadata?: {
329
+ readonly title?: string;
330
+ };
331
+ }
332
+ /**
333
+ * A rendered document produced anywhere, in either language: the value of
334
+ * `@bonniepdf/core`'s `generateSvgDocumentAsync()`, or the JSON a .NET server
335
+ * returns from `SvgDocumentExport.ToJson()`, parsed. Page sizes are read from
336
+ * each page's root `<svg>`.
337
+ */
338
+ export interface PreviewExport {
339
+ /** Export format version. Absent in exports from releases before it existed. */
340
+ version?: number;
341
+ /** One `<svg>` document per page, in page order. */
342
+ pages: readonly string[];
343
+ /** `@font-face` CSS for the embedded fonts, injected once for every page. */
344
+ fontFaceCss?: string;
345
+ /** The layout snapshot, present when the export captured layout. */
346
+ snapshot?: LayoutSnapshot;
347
+ /** The compliance report for {@link snapshot}. */
348
+ report?: ComplianceReport;
349
+ }
350
+ /** What {@link PreviewerHandle.load} accepts: a document, an export, or a promise of either. */
351
+ export type PreviewSource = PreviewableDocument | PreviewExport | PromiseLike<PreviewableDocument | PreviewExport>;
352
+ /**
353
+ * The PDF behind the download button: a URL, the bytes, or a function producing
354
+ * either, called on the first click only. When the previewer turns bytes into
355
+ * an object URL, it owns that URL and revokes it on the next load or on dispose.
356
+ */
357
+ export type PdfSource = string | Blob | Uint8Array | (() => string | Blob | Uint8Array | PromiseLike<string | Blob | Uint8Array>);
358
+ /** Per-load overrides for {@link PreviewerHandle.load}. */
359
+ export interface PreviewLoadOptions {
360
+ /**
361
+ * The download filename. Defaults to the document's title as a slug
362
+ * (`Quarterly Report` → `quarterly-report.pdf`), then to the previewer's
363
+ * `downloadFilename`.
364
+ */
365
+ downloadFilename?: string;
366
+ /**
367
+ * The PDF for the download button. A loaded document supplies its own
368
+ * (generated on the first click), so this is needed only for an export.
369
+ * Without a PDF the download button is hidden.
370
+ */
371
+ pdf?: PdfSource;
372
+ }
373
+ /** Controls a created previewer instance. Returned by `createPreviewer`. */
374
+ export interface PreviewerHandle {
375
+ /**
376
+ * Shows a document. Pass a `@bonniepdf/core` `Document`, and the previewer
377
+ * renders it, captures layout when an inspector needs it, and generates the
378
+ * PDF only if the user downloads. Pass an export (`generateSvgDocumentAsync()`'s
379
+ * result, or .NET's `ToJson()` parsed) when the document was generated
380
+ * elsewhere. A promise of either shows the loading state until it settles.
381
+ *
382
+ * Resolves once the document is shown, or when a newer `load()` supersedes
383
+ * this one. Rejects if rendering fails; the viewer then shows an error state
384
+ * and dispatches a `bpp-load-error` event from the host element.
385
+ */
386
+ load(source: PreviewSource, options?: PreviewLoadOptions): Promise<void>;
387
+ /**
388
+ * Replaces the previewed document with the given pages.
389
+ * @deprecated Pass the document or its export: `load(doc)` or `load(svgExport)`.
390
+ */
391
+ load(pages: PreviewPage[], options?: LoadOptions): void;
392
+ /** Selects and reveals a layout-snapshot node. */
393
+ selectSnapshotNode(nodeId: string): boolean;
394
+ /** Clears rendered pages and resets to the loading state without removing injected fonts. */
395
+ clear(): void;
396
+ /** Disconnects observers and listeners. Safe to call more than once. */
397
+ dispose(): void;
398
+ }
399
+ /**
400
+ * Convenience adapter: turn the raw `string[]` returned by `exportSvgPagesAsync`
401
+ * into {@link PreviewPage}s by reading each SVG's intrinsic dimensions.
402
+ * @deprecated `load()` accepts the export directly: `load(svgExport)`.
403
+ */
404
+ export declare function svgStringsToPages(svgs: readonly string[]): PreviewPage[];
405
+ /** Internal: {@link PreviewPage}s from page SVGs, sized from each root `<svg>`. */
406
+ export declare function readPreviewPages(svgs: readonly string[]): PreviewPage[];