report.typ 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. #set page(paper: "a4", margin: (x: 18mm, y: 16mm))
  2. #set text(size: 10pt)
  3. #set heading(numbering: "1.")
  4. #align(center)[
  5. #text(size: 22pt, weight: "bold")[Flyfish Viewer Typst Report]
  6. #linebreak()
  7. #text(fill: rgb("#64748b"))[Native Typst preview rendered in the browser]
  8. ]
  9. #v(10pt)
  10. #grid(
  11. columns: (1fr, 1fr, 1fr),
  12. gutter: 10pt,
  13. box(fill: rgb("#f0fdf4"), stroke: rgb("#bbf7d0"), inset: 10pt, radius: 5pt)[
  14. #text(weight: "bold", fill: rgb("#166534"))[Async Engine]
  15. #linebreak()
  16. WASM compiler and renderer are loaded only for `.typ` documents.
  17. ],
  18. box(fill: rgb("#eff6ff"), stroke: rgb("#bfdbfe"), inset: 10pt, radius: 5pt)[
  19. #text(weight: "bold", fill: rgb("#1d4ed8"))[Paged Output]
  20. #linebreak()
  21. Page size metadata is preserved for preview, print, and HTML export.
  22. ],
  23. box(fill: rgb("#fff7ed"), stroke: rgb("#fed7aa"), inset: 10pt, radius: 5pt)[
  24. #text(weight: "bold", fill: rgb("#9a3412"))[Safe SVG]
  25. #linebreak()
  26. Generated SVG keeps scripts disabled in the viewer integration.
  27. ],
  28. )
  29. = Why Typst
  30. Typst is a modern markup-based typesetting system. It is expressive like a
  31. document language, but fast enough for interactive browser previews when paired
  32. with a WASM renderer.
  33. == Supported preview path
  34. #table(
  35. columns: (1.1fr, 1.5fr, 1.4fr, 1.3fr),
  36. inset: 7pt,
  37. stroke: 0.5pt + rgb("#d8dee8"),
  38. fill: (x, y) => if y == 0 { rgb("#e8f3ff") } else if calc.rem(y, 2) == 0 { rgb("#f8fafc") },
  39. [Format], [Renderer], [Loading], [Operations],
  40. [`.typ`], [`typst.ts` WASM], [Async vendor chunk], [Preview / print / HTML],
  41. [`.typst`], [Compatibility alias], [Same render path], [Preview / print / HTML],
  42. [Packages], [Typst registry], [Network-bound when used], [Best with pinned templates],
  43. )
  44. == Formula and code
  45. The renderer keeps mathematical layout and text positioning in SVG:
  46. $ integral_0^1 x^2 dif x = 1/3 quad and quad E = m c^2 $
  47. ```ts
  48. import FileViewer from '@flyfish-group/file-viewer3'
  49. const options = {
  50. toolbar: { print: true, exportHtml: true },
  51. watermark: { enabled: true, text: 'Internal Preview' }
  52. }
  53. ```
  54. #pagebreak()
  55. = Browser integration checklist
  56. #enum(
  57. [Select `report.typ` from the grouped demo file picker.],
  58. [The Typst renderer compiles the source to SVG in a dedicated async chunk.],
  59. [Each page is displayed on a white document surface over a neutral canvas.],
  60. [Printing and rendered HTML export use the document page dimensions.],
  61. )
  62. #v(8pt)
  63. #quote(block: true)[
  64. The demo intentionally includes headings, tables, math, code, and multiple
  65. pages so smoke tests can catch empty output, clipped pages, and broken print
  66. adapters.
  67. ]
  68. #rect(width: 100%, height: 58pt, fill: rgb("#ecfdf5"), stroke: rgb("#86efac"), radius: 6pt)[
  69. #align(center + horizon)[#text(weight: "bold", fill: rgb("#166534"))[
  70. Flyfish Viewer renders Typst documents without server-side conversion.
  71. ]]
  72. ]