@openmaic/renderer 0.2.1 → 0.2.3

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.
package/FONTS.md CHANGED
@@ -24,6 +24,22 @@ the fonts.
24
24
  | `ZcoolHappy` | 站酷快乐体 | 站酷 (ZCOOL) free-use license (永久免费授权所有人使用,可免费商用) | ✅ (conditions) | © ZCOOL (站酷), designers retain attribution — [license](./font-licenses/ZcoolHappy-LICENSE.txt) |
25
25
  | `WenDingPLKaiTi` | 文鼎PL简中楷 (AR PL KaitiM GB) | Arphic Public License (1999) | ✅ | © 1994–1999 Arphic Technology Co., Ltd. — [license](./font-licenses/ARPHIC-PL.txt) |
26
26
 
27
+ ### Aliases (`picker-fonts.css`)
28
+
29
+ The opt-in `picker-fonts.css` declares four other names for faces above, from
30
+ `FONT_ALIASES` in `fonts.config.mjs`. They are the Google Fonts names of the
31
+ same typefaces, which the `@openmaic/editor` default font picker writes into
32
+ slides. An alias is only another CSS `font-family` name: its rule points at the
33
+ same woff2 as its target, so no extra font is served and the font files are
34
+ unchanged.
35
+
36
+ | Alias (`font-family`) | Renders with |
37
+ | --------------------- | ----------------- |
38
+ | `Noto Sans SC` | `SourceHanSans` |
39
+ | `Noto Serif SC` | `SourceHanSerif` |
40
+ | `LXGW WenKai` | `LXGWWenKai` |
41
+ | `ZCOOL KuaiLe` | `ZcoolHappy` |
42
+
27
43
  ✅ = free to redistribute (bundle/embed/serve) as long as its conditions are met
28
44
  (notice/license travels with it; not sold on its own). The four OFL faces are
29
45
  OFL 1.1; `ZcoolHappy` is permanently free for everyone to use with the
package/README.md CHANGED
@@ -224,6 +224,20 @@ once at your app shell to make those faces available:
224
224
  import '@openmaic/renderer/fonts.css';
225
225
  ```
226
226
 
227
+ Slides whose fonts were picked in `@openmaic/editor`'s default picker name the
228
+ Google Fonts versions of those typefaces (`Noto Sans SC`, `Noto Serif SC`,
229
+ `LXGW WenKai`, `ZCOOL KuaiLe`). To render them, also import the opt-in alias
230
+ sheet, which maps those names onto the same files:
231
+
232
+ ```ts
233
+ import '@openmaic/renderer/picker-fonts.css';
234
+ ```
235
+
236
+ It claims the four names for the whole page with no `unicode-range`: any text
237
+ set in one of them renders with, and downloads, the whole self-hosted file
238
+ (SourceHanSans is about 7.5 MB, SourceHanSerif about 10 MB). Leave it out if
239
+ your page loads its own faces under these names.
240
+
227
241
  > **Runtime dependency — read this.** The `@font-face` `src` URLs point at an
228
242
  > external font host (`https://file.maic.chat/fonts/<name>.woff2`); the woff2
229
243
  > files are **not** bundled in the package. So this is a hard runtime dependency:
package/dist/context.d.ts CHANGED
@@ -4,6 +4,8 @@ import type { SlideEffects } from './types/effects';
4
4
  export interface SlideContextValue {
5
5
  slide: Slide;
6
6
  scale?: number;
7
+ /** Preserve the text, formula, and image sizing used by existing classroom slides. */
8
+ classroomSizing?: boolean;
7
9
  background?: SlideBackground;
8
10
  effects?: SlideEffects;
9
11
  renderImage?: (element: PPTImageElement, resolvedSrc: string, defaultContent: ReactNode) => ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sources":["../src/context.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext, type CSSProperties, type ReactNode } from 'react';\nimport type {\n PPTElement,\n PPTImageElement,\n PPTVideoElement,\n Slide,\n SlideBackground,\n} from '@openmaic/dsl';\nimport type { SlideEffects } from './types/effects';\n\nexport interface SlideContextValue {\n slide: Slide;\n scale?: number;\n background?: SlideBackground;\n effects?: SlideEffects;\n renderImage?: (\n element: PPTImageElement,\n resolvedSrc: string,\n defaultContent: ReactNode,\n ) => ReactNode;\n renderVideo?: (element: PPTVideoElement) => ReactNode;\n videoInteractive?: boolean;\n onElementClick?: (element: PPTElement, event: React.MouseEvent) => void;\n}\n\nconst SlideContext = createContext<SlideContextValue | null>(null);\n\nexport interface SlideRendererProviderProps extends SlideContextValue {\n children?: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\nexport function SlideRendererProvider({\n children,\n className,\n style,\n ...value\n}: SlideRendererProviderProps) {\n return (\n <SlideContext.Provider value={value}>\n {className || style ? (\n <div className={className} style={style}>\n {children}\n </div>\n ) : (\n children\n )}\n </SlideContext.Provider>\n );\n}\n\n/**\n * Read the closest SlideRendererProvider value.\n * Throws if used outside a provider — use `useOptionalSlideContext` for nullable access.\n */\nexport function useSlideContext(): SlideContextValue {\n const value = useContext(SlideContext);\n if (!value) {\n throw new Error(\n 'useSlideContext must be used inside a <SlideRendererProvider>. ' +\n 'Pass props directly to <SlideCanvas> if you do not need the provider.',\n );\n }\n return value;\n}\n\n/** Nullable variant; returns null when outside a provider. */\nexport function useOptionalSlideContext(): SlideContextValue | null {\n return useContext(SlideContext);\n}\n"],"names":[],"mappings":";;;;AA2BA;AAQM;AAMJ;AAWF;AAEA;;;AAGG;;AAED;;;AAIM;;AAGN;AACF;AAEA;;AAEE;AACF;;"}
1
+ {"version":3,"file":"context.js","sources":["../src/context.tsx"],"sourcesContent":["'use client';\n\nimport { createContext, useContext, type CSSProperties, type ReactNode } from 'react';\nimport type {\n PPTElement,\n PPTImageElement,\n PPTVideoElement,\n Slide,\n SlideBackground,\n} from '@openmaic/dsl';\nimport type { SlideEffects } from './types/effects';\n\nexport interface SlideContextValue {\n slide: Slide;\n scale?: number;\n /** Preserve the text, formula, and image sizing used by existing classroom slides. */\n classroomSizing?: boolean;\n background?: SlideBackground;\n effects?: SlideEffects;\n renderImage?: (\n element: PPTImageElement,\n resolvedSrc: string,\n defaultContent: ReactNode,\n ) => ReactNode;\n renderVideo?: (element: PPTVideoElement) => ReactNode;\n videoInteractive?: boolean;\n onElementClick?: (element: PPTElement, event: React.MouseEvent) => void;\n}\n\nconst SlideContext = createContext<SlideContextValue | null>(null);\n\nexport interface SlideRendererProviderProps extends SlideContextValue {\n children?: ReactNode;\n className?: string;\n style?: CSSProperties;\n}\n\nexport function SlideRendererProvider({\n children,\n className,\n style,\n ...value\n}: SlideRendererProviderProps) {\n return (\n <SlideContext.Provider value={value}>\n {className || style ? (\n <div className={className} style={style}>\n {children}\n </div>\n ) : (\n children\n )}\n </SlideContext.Provider>\n );\n}\n\n/**\n * Read the closest SlideRendererProvider value.\n * Throws if used outside a provider — use `useOptionalSlideContext` for nullable access.\n */\nexport function useSlideContext(): SlideContextValue {\n const value = useContext(SlideContext);\n if (!value) {\n throw new Error(\n 'useSlideContext must be used inside a <SlideRendererProvider>. ' +\n 'Pass props directly to <SlideCanvas> if you do not need the provider.',\n );\n }\n return value;\n}\n\n/** Nullable variant; returns null when outside a provider. */\nexport function useOptionalSlideContext(): SlideContextValue | null {\n return useContext(SlideContext);\n}\n"],"names":[],"mappings":";;;;AA6BA;AAQM;AAMJ;AAWF;AAEA;;;AAGG;;AAED;;;AAIM;;AAGN;AACF;AAEA;;AAEE;AACF;;"}
@@ -2,6 +2,7 @@
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { useElementShadow } from '../shared/useElementShadow.js';
4
4
  import { useElementFlip } from '../shared/useElementFlip.js';
5
+ import { useOptionalSlideContext } from '../../context.js';
5
6
  import { useClipImage } from './useClipImage.js';
6
7
  import { useFilter } from './useFilter.js';
7
8
  import { ImageOutline } from './ImageOutline.js';
@@ -12,6 +13,7 @@ function BaseImageElement({ elementInfo, renderImage }) {
12
13
  const { clipShape, imgPosition } = useClipImage(elementInfo);
13
14
  const { filter } = useFilter(elementInfo.filters);
14
15
  const src = elementInfo.src;
16
+ const classroomSizing = useOptionalSlideContext()?.classroomSizing;
15
17
  // Soft-edge feather (a:softEdge): fade the image alpha to transparent over
16
18
  // `softEdge` px at every edge. Two intersecting linear-gradient masks feather
17
19
  // all four sides (corners get both). html2canvas-pro ignores CSS masks, so
@@ -42,7 +44,7 @@ function BaseImageElement({ elementInfo, renderImage }) {
42
44
  left: imgPosition.left,
43
45
  width: imgPosition.width,
44
46
  height: imgPosition.height,
45
- maxWidth: 'none',
47
+ maxWidth: classroomSizing ? '100%' : 'none',
46
48
  maxHeight: 'none',
47
49
  filter,
48
50
  ...softEdgeMaskStyle,
@@ -1 +1 @@
1
- {"version":3,"file":"BaseImageElement.js","sources":["../../../src/elements/image/BaseImageElement.tsx"],"sourcesContent":["'use client';\n\nimport type { CSSProperties, ReactNode } from 'react';\nimport type { PPTImageElement } from '@openmaic/dsl';\nimport { useElementShadow } from '../shared/useElementShadow';\nimport { useElementFlip } from '../shared/useElementFlip';\nimport { useClipImage } from './useClipImage';\nimport { useFilter } from './useFilter';\nimport { ImageOutline } from './ImageOutline';\n\nexport interface BaseImageElementProps {\n elementInfo: PPTImageElement;\n /**\n * Optional render slot: replace the default <img> with custom content.\n * The slot receives `(element, resolvedSrc, defaultContent)` and is responsible\n * for selecting placeholders, retry UI, or the renderer's prepared image.\n * Its return value is authoritative, including `null`.\n */\n renderImage?: (\n element: PPTImageElement,\n resolvedSrc: string,\n defaultContent: ReactNode,\n ) => ReactNode;\n}\n\nexport function BaseImageElement({ elementInfo, renderImage }: BaseImageElementProps) {\n const { shadowStyle } = useElementShadow(elementInfo.shadow);\n const { flipStyle } = useElementFlip(elementInfo.flipH, elementInfo.flipV);\n const { clipShape, imgPosition } = useClipImage(elementInfo);\n const { filter } = useFilter(elementInfo.filters);\n\n const src = elementInfo.src;\n\n // Soft-edge feather (a:softEdge): fade the image alpha to transparent over\n // `softEdge` px at every edge. Two intersecting linear-gradient masks feather\n // all four sides (corners get both). html2canvas-pro ignores CSS masks, so\n // slideToPng bakes the same feather into pixels via the data-soft-edge hook.\n const softEdge =\n elementInfo.softEdge && elementInfo.softEdge > 0 ? elementInfo.softEdge : undefined;\n const softEdgeMaskStyle: CSSProperties = softEdge\n ? (() => {\n const grad = (dir: string) =>\n `linear-gradient(${dir}, transparent 0, #000 ${softEdge}px, #000 calc(100% - ${softEdge}px), transparent 100%)`;\n const mask = `${grad('to right')}, ${grad('to bottom')}`;\n return {\n maskImage: mask,\n WebkitMaskImage: mask,\n maskComposite: 'intersect',\n WebkitMaskComposite: 'source-in',\n maskRepeat: 'no-repeat',\n WebkitMaskRepeat: 'no-repeat',\n } as CSSProperties;\n })()\n : {};\n const defaultContent = src ? (\n <>\n <img\n src={src}\n draggable={false}\n data-soft-edge={softEdge || undefined}\n // Lazy + async decode: thumbnail surfaces (sidebar, nav rail, course\n // cards) mount far more images than the viewport needs. In-viewport\n // images are unaffected — the browser fetches them immediately.\n // slideToPng forces these back to eager in its off-screen tree.\n loading=\"lazy\"\n decoding=\"async\"\n style={{\n position: 'absolute',\n top: imgPosition.top,\n left: imgPosition.left,\n width: imgPosition.width,\n height: imgPosition.height,\n maxWidth: 'none',\n maxHeight: 'none',\n filter,\n ...softEdgeMaskStyle,\n }}\n alt=\"\"\n onDragStart={(e) => e.preventDefault()}\n />\n {elementInfo.colorMask && (\n <div\n style={{\n position: 'absolute',\n inset: 0,\n backgroundColor: elementInfo.colorMask,\n }}\n />\n )}\n </>\n ) : null;\n\n return (\n <div\n className=\"base-element-image element-content\"\n style={{\n position: 'absolute',\n top: `${elementInfo.top}px`,\n left: `${elementInfo.left}px`,\n width: `${elementInfo.width}px`,\n height: `${elementInfo.height}px`,\n }}\n >\n <div\n style={{\n width: '100%',\n height: '100%',\n transform: `rotate(${elementInfo.rotate}deg)`,\n }}\n >\n <div\n style={{\n position: 'relative',\n width: '100%',\n height: '100%',\n filter: shadowStyle ? `drop-shadow(${shadowStyle})` : '',\n transform: flipStyle,\n }}\n >\n <ImageOutline elementInfo={elementInfo} />\n\n <div\n style={{\n position: 'relative',\n width: '100%',\n height: '100%',\n overflow: 'hidden',\n clipPath: clipShape.style,\n pointerEvents: renderImage ? 'auto' : undefined,\n }}\n >\n {renderImage ? renderImage(elementInfo, src, defaultContent) : defaultContent}\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;AA2BE;;;AAIA;;;;;;;;AAUM;AAEA;;AAEE;AACA;AACA;AACA;AACA;AACA;;AAEJ;;AAEJ;;;;;;AAaQ;;;;;AAKA;AACA;;AAEA;;AAQE;AACA;;AAED;AAMT;AAIM;AACA;AACA;AACA;AACA;;AAKE;AACA;AACA;;AAKE;AACA;AACA;;AAEA;;AAOE;AACA;AACA;AACA;;;;AAWd;;"}
1
+ {"version":3,"file":"BaseImageElement.js","sources":["../../../src/elements/image/BaseImageElement.tsx"],"sourcesContent":["'use client';\n\nimport type { CSSProperties, ReactNode } from 'react';\nimport type { PPTImageElement } from '@openmaic/dsl';\nimport { useElementShadow } from '../shared/useElementShadow';\nimport { useElementFlip } from '../shared/useElementFlip';\nimport { useOptionalSlideContext } from '../../context';\nimport { useClipImage } from './useClipImage';\nimport { useFilter } from './useFilter';\nimport { ImageOutline } from './ImageOutline';\n\nexport interface BaseImageElementProps {\n elementInfo: PPTImageElement;\n /**\n * Optional render slot: replace the default <img> with custom content.\n * The slot receives `(element, resolvedSrc, defaultContent)` and is responsible\n * for selecting placeholders, retry UI, or the renderer's prepared image.\n * Its return value is authoritative, including `null`.\n */\n renderImage?: (\n element: PPTImageElement,\n resolvedSrc: string,\n defaultContent: ReactNode,\n ) => ReactNode;\n}\n\nexport function BaseImageElement({ elementInfo, renderImage }: BaseImageElementProps) {\n const { shadowStyle } = useElementShadow(elementInfo.shadow);\n const { flipStyle } = useElementFlip(elementInfo.flipH, elementInfo.flipV);\n const { clipShape, imgPosition } = useClipImage(elementInfo);\n const { filter } = useFilter(elementInfo.filters);\n\n const src = elementInfo.src;\n const classroomSizing = useOptionalSlideContext()?.classroomSizing;\n\n // Soft-edge feather (a:softEdge): fade the image alpha to transparent over\n // `softEdge` px at every edge. Two intersecting linear-gradient masks feather\n // all four sides (corners get both). html2canvas-pro ignores CSS masks, so\n // slideToPng bakes the same feather into pixels via the data-soft-edge hook.\n const softEdge =\n elementInfo.softEdge && elementInfo.softEdge > 0 ? elementInfo.softEdge : undefined;\n const softEdgeMaskStyle: CSSProperties = softEdge\n ? (() => {\n const grad = (dir: string) =>\n `linear-gradient(${dir}, transparent 0, #000 ${softEdge}px, #000 calc(100% - ${softEdge}px), transparent 100%)`;\n const mask = `${grad('to right')}, ${grad('to bottom')}`;\n return {\n maskImage: mask,\n WebkitMaskImage: mask,\n maskComposite: 'intersect',\n WebkitMaskComposite: 'source-in',\n maskRepeat: 'no-repeat',\n WebkitMaskRepeat: 'no-repeat',\n } as CSSProperties;\n })()\n : {};\n const defaultContent = src ? (\n <>\n <img\n src={src}\n draggable={false}\n data-soft-edge={softEdge || undefined}\n // Lazy + async decode: thumbnail surfaces (sidebar, nav rail, course\n // cards) mount far more images than the viewport needs. In-viewport\n // images are unaffected — the browser fetches them immediately.\n // slideToPng forces these back to eager in its off-screen tree.\n loading=\"lazy\"\n decoding=\"async\"\n style={{\n position: 'absolute',\n top: imgPosition.top,\n left: imgPosition.left,\n width: imgPosition.width,\n height: imgPosition.height,\n maxWidth: classroomSizing ? '100%' : 'none',\n maxHeight: 'none',\n filter,\n ...softEdgeMaskStyle,\n }}\n alt=\"\"\n onDragStart={(e) => e.preventDefault()}\n />\n {elementInfo.colorMask && (\n <div\n style={{\n position: 'absolute',\n inset: 0,\n backgroundColor: elementInfo.colorMask,\n }}\n />\n )}\n </>\n ) : null;\n\n return (\n <div\n className=\"base-element-image element-content\"\n style={{\n position: 'absolute',\n top: `${elementInfo.top}px`,\n left: `${elementInfo.left}px`,\n width: `${elementInfo.width}px`,\n height: `${elementInfo.height}px`,\n }}\n >\n <div\n style={{\n width: '100%',\n height: '100%',\n transform: `rotate(${elementInfo.rotate}deg)`,\n }}\n >\n <div\n style={{\n position: 'relative',\n width: '100%',\n height: '100%',\n filter: shadowStyle ? `drop-shadow(${shadowStyle})` : '',\n transform: flipStyle,\n }}\n >\n <ImageOutline elementInfo={elementInfo} />\n\n <div\n style={{\n position: 'relative',\n width: '100%',\n height: '100%',\n overflow: 'hidden',\n clipPath: clipShape.style,\n pointerEvents: renderImage ? 'auto' : undefined,\n }}\n >\n {renderImage ? renderImage(elementInfo, src, defaultContent) : defaultContent}\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AA4BE;;;AAIA;AACA;;;;;;;;AAUM;AAEA;;AAEE;AACA;AACA;AACA;AACA;AACA;;AAEJ;;AAEJ;;;;;;AAaQ;;;;;;AAMA;;AAEA;;AAQE;AACA;;AAED;AAMT;AAIM;AACA;AACA;AACA;AACA;;AAKE;AACA;AACA;;AAKE;AACA;AACA;;AAEA;;AAOE;AACA;AACA;AACA;;;;AAWd;;"}
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import { useRef, useState, useCallback, useLayoutEffect, useEffect } from 'react';
3
+ import { useRef, useCallback, useLayoutEffect, useEffect } from 'react';
4
+ import { useOptionalSlideContext } from '../../context.js';
4
5
 
5
6
  function BaseLatexElement({ elementInfo }) {
6
7
  return (jsx("div", { className: "base-element-latex", style: {
@@ -28,8 +29,8 @@ const ALIGN_MAP = {
28
29
  right: 'flex-end',
29
30
  };
30
31
  function KatexContent({ html, width, height, align = 'center', }) {
32
+ const classroomSizing = useOptionalSlideContext()?.classroomSizing;
31
33
  const innerRef = useRef(null);
32
- const [scale, setScale] = useState(1);
33
34
  // Measure the formula's natural size and shrink-to-fit its box. Extracted so
34
35
  // it can run both synchronously on mount (useLayoutEffect) and again once the
35
36
  // KaTeX fonts finish loading (useEffect below).
@@ -47,12 +48,10 @@ function KatexContent({ html, width, height, align = 'center', }) {
47
48
  const naturalW = innerRef.current.scrollWidth;
48
49
  const naturalH = innerRef.current.scrollHeight;
49
50
  if (naturalW > 0 && naturalH > 0) {
50
- // Cap at 1: only ever shrink the formula to fit its box, never enlarge.
51
- // A short formula sitting in a large frame (e.g. slide 29 的右侧推理框)
52
- // would otherwise get scaled up to fill the box and render huge.
53
- setScale(Math.min(width / naturalW, height / naturalH, 1));
51
+ const fit = Math.min(width / naturalW, height / naturalH);
52
+ innerRef.current.style.transform = `scale(${classroomSizing ? fit : Math.min(fit, 1)})`;
54
53
  }
55
- }, [width, height]);
54
+ }, [width, height, classroomSizing]);
56
55
  useLayoutEffect(() => {
57
56
  measure();
58
57
  }, [measure, html]);
@@ -85,7 +84,7 @@ function KatexContent({ html, width, height, align = 'center', }) {
85
84
  justifyContent: justify,
86
85
  }, children: jsx("div", { ref: innerRef, className: "slide-renderer-prose", style: {
87
86
  transformOrigin: origin,
88
- transform: `scale(${scale})`,
87
+ transform: 'scale(1)',
89
88
  whiteSpace: 'nowrap',
90
89
  }, dangerouslySetInnerHTML: { __html: html } }) }));
91
90
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BaseLatexElement.js","sources":["../../../src/elements/latex/BaseLatexElement.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useRef, useState, useLayoutEffect } from 'react';\nimport type { PPTLatexElement } from '@openmaic/dsl';\n\nexport interface BaseLatexElementProps {\n elementInfo: PPTLatexElement;\n}\n\nexport function BaseLatexElement({ elementInfo }: BaseLatexElementProps) {\n return (\n <div\n className=\"base-element-latex\"\n style={{\n position: 'absolute',\n top: `${elementInfo.top}px`,\n left: `${elementInfo.left}px`,\n width: `${elementInfo.width}px`,\n height: `${elementInfo.height}px`,\n }}\n >\n <div\n className=\"rotate-wrapper\"\n style={{\n width: '100%',\n height: '100%',\n transform: `rotate(${elementInfo.rotate}deg)`,\n }}\n >\n <div\n className=\"element-content\"\n style={{\n position: 'relative',\n width: '100%',\n height: '100%',\n // KaTeX glyphs inherit `color`; apply the formula's resolved color\n // (e.g. 蓝色权重) so it isn't forced to the browser default.\n ...(elementInfo.color ? { color: elementInfo.color } : {}),\n }}\n >\n {elementInfo.html ? (\n <KatexContent\n html={elementInfo.html}\n width={elementInfo.width}\n height={elementInfo.height}\n align={elementInfo.align}\n />\n ) : elementInfo.path && elementInfo.viewBox ? (\n <svg\n overflow=\"visible\"\n width={elementInfo.width}\n height={elementInfo.height}\n stroke={elementInfo.color}\n strokeWidth={elementInfo.strokeWidth}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={{ transformOrigin: '0 0', overflow: 'visible' }}\n >\n <g\n transform={`scale(${elementInfo.width / elementInfo.viewBox[0]}, ${\n elementInfo.height / elementInfo.viewBox[1]\n }) translate(0,0) matrix(1,0,0,1,0,0)`}\n >\n <path d={elementInfo.path} />\n </g>\n </svg>\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n\nconst ALIGN_MAP = {\n left: 'flex-start',\n center: 'center',\n right: 'flex-end',\n} as const;\n\nfunction KatexContent({\n html,\n width,\n height,\n align = 'center',\n}: {\n html: string;\n width: number;\n height: number;\n align?: 'left' | 'center' | 'right';\n}) {\n const innerRef = useRef<HTMLDivElement>(null);\n const [scale, setScale] = useState(1);\n\n // Measure the formula's natural size and shrink-to-fit its box. Extracted so\n // it can run both synchronously on mount (useLayoutEffect) and again once the\n // KaTeX fonts finish loading (useEffect below).\n //\n // KaTeX lays out large delimiters (\\left\\{, \\begin{cases}) using the metrics of\n // its `KaTeX_Size1`–`Size4` faces. Those woff2 files load asynchronously, so a\n // first measure on a cold export runs against the fallback font — the brace is\n // sized wrong and the piecewise body (`cases`) desynchronizes from it (the bug\n // reported as \"大括号后面的分段函数与大括号错位\"). Re-measuring after\n // `document.fonts.ready` snaps the scale back to the real glyph metrics before\n // the off-screen snapshot captures the frame.\n const measure = useCallback(() => {\n if (!innerRef.current) return;\n const naturalW = innerRef.current.scrollWidth;\n const naturalH = innerRef.current.scrollHeight;\n if (naturalW > 0 && naturalH > 0) {\n // Cap at 1: only ever shrink the formula to fit its box, never enlarge.\n // A short formula sitting in a large frame (e.g. slide 29 的右侧推理框)\n // would otherwise get scaled up to fill the box and render huge.\n setScale(Math.min(width / naturalW, height / naturalH, 1));\n }\n }, [width, height]);\n\n useLayoutEffect(() => {\n measure();\n }, [measure, html]);\n\n useEffect(() => {\n const fonts = typeof document !== 'undefined' ? document.fonts : undefined;\n if (!fonts) return;\n let cancelled = false;\n // Re-measure once the font set settles (initial + any subsequent face that\n // finishes decoding), so the fit-scale reflects the real KaTeX_Size metrics.\n fonts.ready.then(() => {\n if (!cancelled) measure();\n });\n const onLoadingDone = () => measure();\n fonts.addEventListener?.('loadingdone', onLoadingDone);\n return () => {\n cancelled = true;\n fonts.removeEventListener?.('loadingdone', onLoadingDone);\n };\n }, [measure, html]);\n\n const justify = ALIGN_MAP[align];\n const origin =\n align === 'left' ? 'left center' : align === 'right' ? 'right center' : 'center center';\n\n return (\n <div\n style={{\n width,\n height,\n overflow: 'hidden',\n display: 'flex',\n alignItems: 'center',\n justifyContent: justify,\n }}\n >\n <div\n ref={innerRef}\n className=\"slide-renderer-prose\"\n style={{\n transformOrigin: origin,\n transform: `scale(${scale})`,\n whiteSpace: 'nowrap',\n }}\n dangerouslySetInnerHTML={{ __html: html }}\n />\n </div>\n );\n}\n"],"names":[],"mappings":";;;;AASM;AACJ;AAIM;AACA;AACA;AACA;AACA;AACD;AAKG;AACA;AACA;AACD;AAKG;AACA;AACA;;;AAGA;AACD;AAkCX;AAEA;AACE;AACA;AACA;;AAGF;AAWE;;;;;;;;;;;;;AAcA;;;AAEE;AACA;;;;;AAKE;;AAEJ;;AAGE;AACF;;AAGE;AACA;;;;;AAIA;AACE;AAAgB;AAClB;AACA;;AAEA;;;AAGA;AACF;AAEA;;;;;AASM;AACA;AACA;AACA;;AAOE;;AAEA;;AAMV;;"}
1
+ {"version":3,"file":"BaseLatexElement.js","sources":["../../../src/elements/latex/BaseLatexElement.tsx"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useRef, useLayoutEffect } from 'react';\nimport { useOptionalSlideContext } from '../../context';\nimport type { PPTLatexElement } from '@openmaic/dsl';\n\nexport interface BaseLatexElementProps {\n elementInfo: PPTLatexElement;\n}\n\nexport function BaseLatexElement({ elementInfo }: BaseLatexElementProps) {\n return (\n <div\n className=\"base-element-latex\"\n style={{\n position: 'absolute',\n top: `${elementInfo.top}px`,\n left: `${elementInfo.left}px`,\n width: `${elementInfo.width}px`,\n height: `${elementInfo.height}px`,\n }}\n >\n <div\n className=\"rotate-wrapper\"\n style={{\n width: '100%',\n height: '100%',\n transform: `rotate(${elementInfo.rotate}deg)`,\n }}\n >\n <div\n className=\"element-content\"\n style={{\n position: 'relative',\n width: '100%',\n height: '100%',\n // KaTeX glyphs inherit `color`; apply the formula's resolved color\n // (e.g. 蓝色权重) so it isn't forced to the browser default.\n ...(elementInfo.color ? { color: elementInfo.color } : {}),\n }}\n >\n {elementInfo.html ? (\n <KatexContent\n html={elementInfo.html}\n width={elementInfo.width}\n height={elementInfo.height}\n align={elementInfo.align}\n />\n ) : elementInfo.path && elementInfo.viewBox ? (\n <svg\n overflow=\"visible\"\n width={elementInfo.width}\n height={elementInfo.height}\n stroke={elementInfo.color}\n strokeWidth={elementInfo.strokeWidth}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={{ transformOrigin: '0 0', overflow: 'visible' }}\n >\n <g\n transform={`scale(${elementInfo.width / elementInfo.viewBox[0]}, ${\n elementInfo.height / elementInfo.viewBox[1]\n }) translate(0,0) matrix(1,0,0,1,0,0)`}\n >\n <path d={elementInfo.path} />\n </g>\n </svg>\n ) : null}\n </div>\n </div>\n </div>\n );\n}\n\nconst ALIGN_MAP = {\n left: 'flex-start',\n center: 'center',\n right: 'flex-end',\n} as const;\n\nfunction KatexContent({\n html,\n width,\n height,\n align = 'center',\n}: {\n html: string;\n width: number;\n height: number;\n align?: 'left' | 'center' | 'right';\n}) {\n const classroomSizing = useOptionalSlideContext()?.classroomSizing;\n const innerRef = useRef<HTMLDivElement>(null);\n\n // Measure the formula's natural size and shrink-to-fit its box. Extracted so\n // it can run both synchronously on mount (useLayoutEffect) and again once the\n // KaTeX fonts finish loading (useEffect below).\n //\n // KaTeX lays out large delimiters (\\left\\{, \\begin{cases}) using the metrics of\n // its `KaTeX_Size1`–`Size4` faces. Those woff2 files load asynchronously, so a\n // first measure on a cold export runs against the fallback font — the brace is\n // sized wrong and the piecewise body (`cases`) desynchronizes from it (the bug\n // reported as \"大括号后面的分段函数与大括号错位\"). Re-measuring after\n // `document.fonts.ready` snaps the scale back to the real glyph metrics before\n // the off-screen snapshot captures the frame.\n const measure = useCallback(() => {\n if (!innerRef.current) return;\n const naturalW = innerRef.current.scrollWidth;\n const naturalH = innerRef.current.scrollHeight;\n if (naturalW > 0 && naturalH > 0) {\n const fit = Math.min(width / naturalW, height / naturalH);\n innerRef.current.style.transform = `scale(${classroomSizing ? fit : Math.min(fit, 1)})`;\n }\n }, [width, height, classroomSizing]);\n\n useLayoutEffect(() => {\n measure();\n }, [measure, html]);\n\n useEffect(() => {\n const fonts = typeof document !== 'undefined' ? document.fonts : undefined;\n if (!fonts) return;\n let cancelled = false;\n // Re-measure once the font set settles (initial + any subsequent face that\n // finishes decoding), so the fit-scale reflects the real KaTeX_Size metrics.\n fonts.ready.then(() => {\n if (!cancelled) measure();\n });\n const onLoadingDone = () => measure();\n fonts.addEventListener?.('loadingdone', onLoadingDone);\n return () => {\n cancelled = true;\n fonts.removeEventListener?.('loadingdone', onLoadingDone);\n };\n }, [measure, html]);\n\n const justify = ALIGN_MAP[align];\n const origin =\n align === 'left' ? 'left center' : align === 'right' ? 'right center' : 'center center';\n\n return (\n <div\n style={{\n width,\n height,\n overflow: 'hidden',\n display: 'flex',\n alignItems: 'center',\n justifyContent: justify,\n }}\n >\n <div\n ref={innerRef}\n className=\"slide-renderer-prose\"\n style={{\n transformOrigin: origin,\n transform: 'scale(1)',\n whiteSpace: 'nowrap',\n }}\n dangerouslySetInnerHTML={{ __html: html }}\n />\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;AAUM;AACJ;AAIM;AACA;AACA;AACA;AACA;AACD;AAKG;AACA;AACA;AACD;AAKG;AACA;AACA;;;AAGA;AACD;AAkCX;AAEA;AACE;AACA;AACA;;AAGF;AAWE;AACA;;;;;;;;;;;;AAaA;;;AAEE;AACA;;AAEE;;;;;AAMF;AACF;;AAGE;AACA;;;;;AAIA;AACE;AAAgB;AAClB;AACA;;AAEA;;;AAGA;AACF;AAEA;;;;;AASM;AACA;AACA;AACA;;AAOE;AACA;AACA;;AAMV;;"}
@@ -5,6 +5,7 @@ import { useElementShadow } from '../shared/useElementShadow.js';
5
5
  import { ElementOutline } from '../shared/ElementOutline.js';
6
6
  import { preservesPlainTextLineBreaks } from '../../utils/richText.js';
7
7
  import { useInnerHtml, useInlineMath } from '../../utils/inlineMath.js';
8
+ import { useOptionalSlideContext } from '../../context.js';
8
9
  import { hasTextInsets } from '../shared/hasTextInsets.js';
9
10
 
10
11
  function BaseTextElement({ elementInfo, target, renderContent, fillHeight = false, }) {
@@ -15,7 +16,8 @@ function BaseTextElement({ elementInfo, target, renderContent, fillHeight = fals
15
16
  // Imported OOXML text carries its own bodyPr insets on the outer div.
16
17
  // Adding the editor's default inset again shifts the label and reduces line width.
17
18
  const contentHasTextInsets = hasTextInsets(elementInfo.content);
18
- const vAlign = elementInfo.vAlign ?? 'top';
19
+ const classroomSizing = useOptionalSlideContext()?.classroomSizing;
20
+ const vAlign = classroomSizing && !fillHeight ? 'top' : (elementInfo.vAlign ?? 'top');
19
21
  const justifyContent = vAlign === 'middle' ? 'center' : vAlign === 'bottom' ? 'flex-end' : 'flex-start';
20
22
  const defaultContent = (jsx("div", { ref: proseRef, "data-inline-math-root": "", className: "text ProseMirror-static", style: {
21
23
  position: 'relative',
@@ -41,7 +43,7 @@ function BaseTextElement({ elementInfo, target, renderContent, fillHeight = fals
41
43
  }, children: jsxs("div", { className: "element-content slide-renderer-prose", style: {
42
44
  position: 'relative',
43
45
  boxSizing: 'border-box',
44
- padding: contentHasTextInsets ? 0 : '10px',
46
+ padding: contentHasTextInsets && (!classroomSizing || fillHeight) ? 0 : '10px',
45
47
  overflowWrap: 'break-word',
46
48
  width: elementInfo.vertical ? 'auto' : '100%',
47
49
  height: elementInfo.vertical || fillHeight ? '100%' : 'auto',
@@ -1 +1 @@
1
- {"version":3,"file":"BaseTextElement.js","sources":["../../../src/elements/text/BaseTextElement.tsx"],"sourcesContent":["'use client';\n\nimport { useRef, type CSSProperties, type ReactNode } from 'react';\nimport type { PPTTextElement } from '@openmaic/dsl';\nimport { useElementShadow } from '../shared/useElementShadow';\nimport { ElementOutline } from '../shared/ElementOutline';\nimport { preservesPlainTextLineBreaks } from '../../utils/richText';\nimport { useInlineMath, useInnerHtml } from '../../utils/inlineMath';\nimport { hasTextInsets } from '../shared/hasTextInsets';\n\nexport interface BaseTextElementProps {\n elementInfo: PPTTextElement;\n target?: string;\n renderContent?: (element: PPTTextElement, defaultContent: ReactNode) => ReactNode;\n /** Keep a recovered shape's label container sized for an absolute-positioned editor. */\n fillHeight?: boolean;\n}\n\nexport function BaseTextElement({\n elementInfo,\n target,\n renderContent,\n fillHeight = false,\n}: BaseTextElementProps) {\n const { shadowStyle } = useElementShadow(elementInfo.shadow);\n const proseRef = useRef<HTMLDivElement>(null);\n const innerHtml = useInnerHtml(elementInfo.content);\n useInlineMath(proseRef, elementInfo.content);\n // Imported OOXML text carries its own bodyPr insets on the outer div.\n // Adding the editor's default inset again shifts the label and reduces line width.\n const contentHasTextInsets = hasTextInsets(elementInfo.content);\n\n const vAlign = elementInfo.vAlign ?? 'top';\n const justifyContent =\n vAlign === 'middle' ? 'center' : vAlign === 'bottom' ? 'flex-end' : 'flex-start';\n const defaultContent = (\n <div\n ref={proseRef}\n data-inline-math-root=\"\"\n className=\"text ProseMirror-static\"\n style={{\n position: 'relative',\n pointerEvents: target === 'thumbnail' ? 'none' : undefined,\n whiteSpace: preservesPlainTextLineBreaks(elementInfo.content) ? 'pre-line' : undefined,\n }}\n dangerouslySetInnerHTML={innerHtml}\n />\n );\n\n return (\n <div\n className=\"base-element-text\"\n style={{\n position: 'absolute',\n top: `${elementInfo.top}px`,\n left: `${elementInfo.left}px`,\n width: `${elementInfo.width}px`,\n height: `${elementInfo.height}px`,\n }}\n >\n <div\n className=\"rotate-wrapper\"\n style={{\n width: '100%',\n height: '100%',\n transform: `rotate(${elementInfo.rotate}deg)`,\n // Fill the full text box and rotate it with the glyphs/outline.\n backgroundColor: elementInfo.fill,\n opacity: elementInfo.opacity,\n display: 'flex',\n flexDirection: 'column',\n justifyContent,\n }}\n >\n <div\n className=\"element-content slide-renderer-prose\"\n style={{\n position: 'relative',\n boxSizing: 'border-box',\n padding: contentHasTextInsets ? 0 : '10px',\n overflowWrap: 'break-word',\n width: elementInfo.vertical ? 'auto' : '100%',\n height: elementInfo.vertical || fillHeight ? '100%' : 'auto',\n display: fillHeight ? 'flex' : undefined,\n flexDirection: fillHeight ? 'column' : undefined,\n justifyContent: fillHeight ? justifyContent : undefined,\n textShadow: shadowStyle,\n lineHeight: elementInfo.lineHeight,\n letterSpacing:\n elementInfo.wordSpace !== undefined ? `${elementInfo.wordSpace}px` : undefined,\n color: elementInfo.defaultColor,\n fontFamily: elementInfo.defaultFontName,\n writingMode: elementInfo.vertical ? 'vertical-rl' : 'horizontal-tb',\n ...(elementInfo.paragraphSpace !== undefined\n ? ({ '--paragraphSpace': `${elementInfo.paragraphSpace}px` } as CSSProperties)\n : null),\n }}\n >\n <ElementOutline\n width={elementInfo.width}\n height={elementInfo.height}\n outline={elementInfo.outline}\n />\n {renderContent?.(elementInfo, defaultContent) ?? defaultContent}\n </div>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAkBM;;AAOJ;;AAEA;;;;AAKA;;AAGA;AAMM;;AAEA;AACD;AAKL;AAIM;AACA;AACA;AACA;AACA;AACD;AAKG;AACA;AACA;;;;AAIA;AACA;;AAED;AAKG;AACA;;AAEA;;AAEA;;;;AAIA;;AAEA;;;;AAKA;;;AAGD;AAYX;;"}
1
+ {"version":3,"file":"BaseTextElement.js","sources":["../../../src/elements/text/BaseTextElement.tsx"],"sourcesContent":["'use client';\n\nimport { useRef, type CSSProperties, type ReactNode } from 'react';\nimport type { PPTTextElement } from '@openmaic/dsl';\nimport { useElementShadow } from '../shared/useElementShadow';\nimport { ElementOutline } from '../shared/ElementOutline';\nimport { preservesPlainTextLineBreaks } from '../../utils/richText';\nimport { useInlineMath, useInnerHtml } from '../../utils/inlineMath';\nimport { useOptionalSlideContext } from '../../context';\nimport { hasTextInsets } from '../shared/hasTextInsets';\n\nexport interface BaseTextElementProps {\n elementInfo: PPTTextElement;\n target?: string;\n renderContent?: (element: PPTTextElement, defaultContent: ReactNode) => ReactNode;\n /** Keep a recovered shape's label container sized for an absolute-positioned editor. */\n fillHeight?: boolean;\n}\n\nexport function BaseTextElement({\n elementInfo,\n target,\n renderContent,\n fillHeight = false,\n}: BaseTextElementProps) {\n const { shadowStyle } = useElementShadow(elementInfo.shadow);\n const proseRef = useRef<HTMLDivElement>(null);\n const innerHtml = useInnerHtml(elementInfo.content);\n useInlineMath(proseRef, elementInfo.content);\n // Imported OOXML text carries its own bodyPr insets on the outer div.\n // Adding the editor's default inset again shifts the label and reduces line width.\n const contentHasTextInsets = hasTextInsets(elementInfo.content);\n\n const classroomSizing = useOptionalSlideContext()?.classroomSizing;\n const vAlign = classroomSizing && !fillHeight ? 'top' : (elementInfo.vAlign ?? 'top');\n const justifyContent =\n vAlign === 'middle' ? 'center' : vAlign === 'bottom' ? 'flex-end' : 'flex-start';\n const defaultContent = (\n <div\n ref={proseRef}\n data-inline-math-root=\"\"\n className=\"text ProseMirror-static\"\n style={{\n position: 'relative',\n pointerEvents: target === 'thumbnail' ? 'none' : undefined,\n whiteSpace: preservesPlainTextLineBreaks(elementInfo.content) ? 'pre-line' : undefined,\n }}\n dangerouslySetInnerHTML={innerHtml}\n />\n );\n\n return (\n <div\n className=\"base-element-text\"\n style={{\n position: 'absolute',\n top: `${elementInfo.top}px`,\n left: `${elementInfo.left}px`,\n width: `${elementInfo.width}px`,\n height: `${elementInfo.height}px`,\n }}\n >\n <div\n className=\"rotate-wrapper\"\n style={{\n width: '100%',\n height: '100%',\n transform: `rotate(${elementInfo.rotate}deg)`,\n // Fill the full text box and rotate it with the glyphs/outline.\n backgroundColor: elementInfo.fill,\n opacity: elementInfo.opacity,\n display: 'flex',\n flexDirection: 'column',\n justifyContent,\n }}\n >\n <div\n className=\"element-content slide-renderer-prose\"\n style={{\n position: 'relative',\n boxSizing: 'border-box',\n padding: contentHasTextInsets && (!classroomSizing || fillHeight) ? 0 : '10px',\n overflowWrap: 'break-word',\n width: elementInfo.vertical ? 'auto' : '100%',\n height: elementInfo.vertical || fillHeight ? '100%' : 'auto',\n display: fillHeight ? 'flex' : undefined,\n flexDirection: fillHeight ? 'column' : undefined,\n justifyContent: fillHeight ? justifyContent : undefined,\n textShadow: shadowStyle,\n lineHeight: elementInfo.lineHeight,\n letterSpacing:\n elementInfo.wordSpace !== undefined ? `${elementInfo.wordSpace}px` : undefined,\n color: elementInfo.defaultColor,\n fontFamily: elementInfo.defaultFontName,\n writingMode: elementInfo.vertical ? 'vertical-rl' : 'horizontal-tb',\n ...(elementInfo.paragraphSpace !== undefined\n ? ({ '--paragraphSpace': `${elementInfo.paragraphSpace}px` } as CSSProperties)\n : null),\n }}\n >\n <ElementOutline\n width={elementInfo.width}\n height={elementInfo.height}\n outline={elementInfo.outline}\n />\n {renderContent?.(elementInfo, defaultContent) ?? defaultContent}\n </div>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;AAmBM;;AAOJ;;AAEA;;;;AAKA;;;AAIA;AAMM;;AAEA;AACD;AAKL;AAIM;AACA;AACA;AACA;AACA;AACD;AAKG;AACA;AACA;;;;AAIA;AACA;;AAED;AAKG;AACA;AACA;AACA;;AAEA;;;;AAIA;;AAEA;;;;AAKA;;;AAGD;AAYX;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmaic/renderer",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "React component for rendering PPTist-style Slide JSON, extracted from OpenMAIC.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,6 +24,7 @@
24
24
  "import": "./dist/snapshot/index.js"
25
25
  },
26
26
  "./fonts.css": "./fonts.css",
27
+ "./picker-fonts.css": "./picker-fonts.css",
27
28
  "./geometry": {
28
29
  "types": "./dist/utils/element.d.ts",
29
30
  "import": "./dist/utils/element.js"
@@ -32,6 +33,7 @@
32
33
  "files": [
33
34
  "dist",
34
35
  "fonts.css",
36
+ "picker-fonts.css",
35
37
  "README.md",
36
38
  "DESIGN.md",
37
39
  "LICENSE",
@@ -79,8 +81,8 @@
79
81
  "lucide-react": "^0.562.0",
80
82
  "tailwind-merge": "^3.4.0",
81
83
  "tinycolor2": "^1.6.0",
82
- "@openmaic/geometry": "^0.1.0",
83
- "@openmaic/dsl": "^0.13.0"
84
+ "@openmaic/dsl": "^0.13.0",
85
+ "@openmaic/geometry": "^0.1.0"
84
86
  },
85
87
  "devDependencies": {
86
88
  "@rollup/plugin-commonjs": "^28.0.1",
@@ -0,0 +1,36 @@
1
+ /**
2
+ * GENERATED FILE — do not edit by hand.
3
+ * Source of truth: FONT_ALIASES in fonts.config.mjs (run `pnpm run genfonts`).
4
+ *
5
+ * Opt-in. Declares the Google Fonts names that the @openmaic/editor default
6
+ * font picker writes for its Chinese fonts, over the self-hosted faces in
7
+ * fonts.css, so a slide set in one of them renders in it wherever it is shown:
8
+ * import '@openmaic/renderer/picker-fonts.css';
9
+ *
10
+ * Importing it claims these family names for the whole page, and each covers
11
+ * every character with no unicode-range: any text on the page set in one of
12
+ * them, slide or not, renders with (and downloads) the whole self-hosted file.
13
+ * Do not import it if the page loads its own faces under these names.
14
+ */
15
+ @font-face {
16
+ font-display: swap;
17
+ font-family: 'Noto Sans SC';
18
+ font-weight: 250 900;
19
+ src: url('https://file.maic.chat/fonts/SourceHanSans.woff2') format('woff2');
20
+ }
21
+ @font-face {
22
+ font-display: swap;
23
+ font-family: 'Noto Serif SC';
24
+ font-weight: 250 900;
25
+ src: url('https://file.maic.chat/fonts/SourceHanSerif.woff2') format('woff2');
26
+ }
27
+ @font-face {
28
+ font-display: swap;
29
+ font-family: 'LXGW WenKai';
30
+ src: url('https://file.maic.chat/fonts/LXGWWenKai.woff2') format('woff2');
31
+ }
32
+ @font-face {
33
+ font-display: swap;
34
+ font-family: 'ZCOOL KuaiLe';
35
+ src: url('https://file.maic.chat/fonts/ZcoolHappy.woff2') format('woff2');
36
+ }