@file-viewer/renderer-typst 2.1.29 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/typst.js +5 -5
  2. package/package.json +2 -2
package/dist/typst.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { $typst, MemoryAccessModel } from '@myriaddreamin/typst.ts';
2
2
  import { TypstSnippet } from '@myriaddreamin/typst.ts/contrib/snippet';
3
- import { resolveFileViewerTypstCompilerWasmUrl, resolveFileViewerTypstFontAssetsUrl, resolveFileViewerTypstRendererWasmUrl, } from '@file-viewer/core/assets';
3
+ import { resolveFileViewerTypstCompilerWasmUrl, resolveFileViewerTypstFontAssetsUrl, resolveFileViewerTypstRendererWasmUrl, resolveFileViewerRuntimeAssetBaseUrl, } from '@file-viewer/core/assets';
4
4
  import { createFileViewerTranslator, createFileViewerZoomChangeEmitter, formatCssPixels, registerFileViewerZoomProvider, readFileViewerText, unregisterFileViewerZoomProvider, } from '@file-viewer/core';
5
5
  const typstStyle = `
6
- .typst-viewer{min-height:100%;overflow:auto;background:#eef1f4;color:#172033}
6
+ .typst-viewer{min-height:100%;overflow:auto;background:var(--file-viewer-render-surface-background,#eef1f4);color:#172033}
7
7
  .typst-toolbar{position:sticky;top:0;z-index:2;display:flex;min-height:52px;align-items:center;justify-content:space-between;gap:16px;padding:10px 18px;border-bottom:1px solid rgba(120,134,155,.18);background:rgba(248,250,252,.92);backdrop-filter:blur(16px)}
8
8
  .typst-toolbar div{min-width:0}
9
9
  .typst-toolbar strong,.typst-toolbar span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -19,7 +19,7 @@ const typstStyle = `
19
19
  .typst-loading p{margin:0;color:#6a778b;font-size:13px}
20
20
  .typst-error{color:#9f1d1d}
21
21
  .typst-error pre{max-height:360px;margin:14px 0 0;overflow:auto;border-radius:10px;background:#fff1f2;color:#9f1d1d;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,'Liberation Mono',monospace;font-size:12px;line-height:1.7;padding:14px;white-space:pre-wrap}
22
- [data-viewer-theme='dark'] .typst-viewer{background:#101820;color:#e6edf3}
22
+ [data-viewer-theme='dark'] .typst-viewer{background:var(--file-viewer-render-surface-background,#101820);color:#e6edf3}
23
23
  [data-viewer-theme='dark'] .typst-toolbar{border-bottom-color:rgba(139,148,158,.22);background:rgba(15,23,42,.9)}
24
24
  [data-viewer-theme='dark'] .typst-toolbar strong{color:#f8fafc}
25
25
  [data-viewer-theme='dark'] .typst-toolbar span,[data-viewer-theme='dark'] .typst-toolbar em{color:#9aa7b8}
@@ -28,7 +28,7 @@ const typstStyle = `
28
28
  [data-viewer-theme='dark'] .typst-loading strong,[data-viewer-theme='dark'] .typst-error strong{color:#f8fafc}
29
29
  @keyframes typst-spin{to{transform:rotate(360deg)}}
30
30
  @media (max-width:767px){.typst-toolbar{align-items:flex-start;flex-direction:column;gap:4px}.typst-pages{gap:16px;padding:16px 10px 28px}}
31
- @media (prefers-color-scheme:dark){[data-viewer-theme='system'] .typst-viewer{background:#101820;color:#e6edf3}[data-viewer-theme='system'] .typst-toolbar{border-bottom-color:rgba(139,148,158,.22);background:rgba(15,23,42,.9)}[data-viewer-theme='system'] .typst-toolbar strong{color:#f8fafc}[data-viewer-theme='system'] .typst-toolbar span,[data-viewer-theme='system'] .typst-toolbar em{color:#9aa7b8}[data-viewer-theme='system'] .typst-page-shell{border-color:rgba(139,148,158,.26);box-shadow:0 24px 56px rgba(0,0,0,.38)}[data-viewer-theme='system'] .typst-loading,[data-viewer-theme='system'] .typst-error{border-color:rgba(139,148,158,.22);background:#151b23;box-shadow:0 24px 56px rgba(0,0,0,.32)}[data-viewer-theme='system'] .typst-loading strong,[data-viewer-theme='system'] .typst-error strong{color:#f8fafc}}
31
+ @media (prefers-color-scheme:dark){[data-viewer-theme='system'] .typst-viewer{background:var(--file-viewer-render-surface-background,#101820);color:#e6edf3}[data-viewer-theme='system'] .typst-toolbar{border-bottom-color:rgba(139,148,158,.22);background:rgba(15,23,42,.9)}[data-viewer-theme='system'] .typst-toolbar strong{color:#f8fafc}[data-viewer-theme='system'] .typst-toolbar span,[data-viewer-theme='system'] .typst-toolbar em{color:#9aa7b8}[data-viewer-theme='system'] .typst-page-shell{border-color:rgba(139,148,158,.26);box-shadow:0 24px 56px rgba(0,0,0,.38)}[data-viewer-theme='system'] .typst-loading,[data-viewer-theme='system'] .typst-error{border-color:rgba(139,148,158,.22);background:#151b23;box-shadow:0 24px 56px rgba(0,0,0,.32)}[data-viewer-theme='system'] .typst-loading strong,[data-viewer-theme='system'] .typst-error strong{color:#f8fafc}}
32
32
  `;
33
33
  let typstEngineConfigKey = '';
34
34
  const DEFAULT_TYPST_RENDER_TIMEOUT_MS = 180000;
@@ -494,7 +494,7 @@ export default async function renderTypst(buffer, target, _type, context) {
494
494
  };
495
495
  const renderTypstSvg = async () => {
496
496
  var _a, _b;
497
- const candidates = resolveTypstEngineCandidates(context, documentRef.baseURI);
497
+ const candidates = resolveTypstEngineCandidates(context, resolveFileViewerRuntimeAssetBaseUrl(documentRef));
498
498
  const timeoutMs = normalizeRenderTimeoutMs((_b = (_a = context === null || context === void 0 ? void 0 : context.options) === null || _a === void 0 ? void 0 : _a.typst) === null || _b === void 0 ? void 0 : _b.renderTimeoutMs);
499
499
  let lastError;
500
500
  for (const candidate of candidates) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@file-viewer/renderer-typst",
3
- "version": "2.1.29",
3
+ "version": "2.2.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Standalone Typst renderer plugin for Flyfish File Viewer powered by browser WASM.",
@@ -54,7 +54,7 @@
54
54
  "LICENSE"
55
55
  ],
56
56
  "dependencies": {
57
- "@file-viewer/core": "2.1.29",
57
+ "@file-viewer/core": "2.2.0",
58
58
  "@myriaddreamin/typst-ts-renderer": "0.7.0",
59
59
  "@myriaddreamin/typst-ts-web-compiler": "0.7.0",
60
60
  "@myriaddreamin/typst.ts": "0.7.0"