@openmaic/renderer 0.2.0 → 0.2.2

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:
@@ -104,12 +104,7 @@ function SlideCanvas(props) {
104
104
  }, children: [jsx(InlineMathPriorityContext.Provider, { value: props.mathPriority ?? 'normal', children: visibleElements.map((element) => (jsx(SlideElement, { elementInfo: element, elementIndex: elementIndexById.get(element.id) ?? 1, theme: slide.theme, renderImage: renderImage, renderVideo: renderVideo, renderText: renderText, renderShapeLabel: renderShapeLabel, renderTable: renderTable, videoInteractive: videoInteractive, onElementClick: onElementClick, idPrefix: elementIdPrefix, dragOffset: dragOffsets?.get(element.id) }, element.id))) }), highlights.map((highlight) => {
105
105
  const element = visibleElements.find((el) => el.id === highlight.elementId);
106
106
  return element ? (jsx(HighlightOverlay, { element: element, options: highlight }, highlight.elementId)) : null;
107
- })] }), jsx(SpotlightOverlay, { options: effects?.spotlight, elementIdPrefix: elementIdPrefix, measurementKey: visibleElements }), jsx("div", { style: {
108
- position: 'absolute',
109
- inset: 0,
110
- pointerEvents: 'none',
111
- padding: '5%',
112
- }, children: jsx("div", { style: { position: 'relative', width: '100%', height: '100%' }, children: jsx(AnimatePresence, { children: effects?.laser && laserGeometry && (jsx(LaserOverlay, { geometry: laserGeometry, color: effects.laser.color, duration: effects.laser.duration }, `laser-${effects.laser.elementId}`)) }) }) })] })] }));
107
+ })] }), jsx(SpotlightOverlay, { options: effects?.spotlight, elementIdPrefix: elementIdPrefix, measurementKey: visibleElements }), jsx("div", { style: { position: 'absolute', inset: 0, pointerEvents: 'none' }, children: jsx(AnimatePresence, { children: effects?.laser && laserGeometry && (jsx(LaserOverlay, { geometry: laserGeometry, color: effects.laser.color, duration: effects.laser.duration }, `laser-${effects.laser.elementId}`)) }) })] })] }));
113
108
  }
114
109
 
115
110
  export { SlideCanvas };
@@ -1 +1 @@
1
- {"version":3,"file":"SlideCanvas.js","sources":["../src/SlideCanvas.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo, useRef, type CSSProperties, type ReactNode } from 'react';\nimport { AnimatePresence } from 'motion/react';\n\nimport type {\n PPTElement,\n PPTImageElement,\n PPTShapeElement,\n PPTTableElement,\n PPTTextElement,\n PPTVideoElement,\n Slide,\n SlideBackground,\n} from '@openmaic/dsl';\nimport type { SlideEffects } from './types/effects';\nimport { findElementGeometry, type PercentageGeometry } from './utils/geometry';\nimport { useSlideBackgroundStyle } from './hooks/useSlideBackgroundStyle';\nimport { useViewportSize } from './hooks/useViewportSize';\nimport { SlideElement } from './SlideElement';\nimport { HighlightOverlay } from './effects/HighlightOverlay';\nimport { SpotlightOverlay } from './effects/SpotlightOverlay';\nimport { LaserOverlay } from './effects/LaserOverlay';\nimport { useOptionalSlideContext } from './context';\nimport { SLIDE_RENDERER_STYLES } from './styles';\nimport { InlineMathPriorityContext } from './utils/inlineMath';\n\nexport interface SlideCanvasProps {\n /**\n * Single slide data (PPTist-style). May be omitted when this component is\n * rendered inside a `<SlideRendererProvider>` that supplies it.\n */\n slide?: Slide;\n /**\n * Canvas scale. When omitted, the canvas auto-fits the container using\n * `slide.viewportSize` and `slide.viewportRatio`. Set to a fixed number\n * (e.g. 1) to skip auto-fit and render at slide-native dimensions.\n */\n scale?: number;\n /** Percent of the container to use when auto-fitting the slide. */\n canvasPercentage?: number;\n /** Called with the computed fit scale when `scale` is omitted. */\n onScaleChange?: (scale: number) => void;\n /** Override `slide.background`. */\n background?: SlideBackground;\n /** Optional play-time effects, all default off. */\n effects?: SlideEffects;\n /** Replace default <img> rendering for image elements. */\n renderImage?: (\n element: PPTImageElement,\n resolvedSrc: string,\n defaultContent: ReactNode,\n ) => ReactNode;\n /** Replace default <video> rendering for video elements. */\n renderVideo?: (element: PPTVideoElement) => ReactNode;\n /** Replace the content node inside the shared text paint wrapper. */\n renderText?: (element: PPTTextElement, defaultContent: ReactNode) => ReactNode;\n /** Replace the static label node inside a Shape element. */\n renderShapeLabel?: (element: PPTShapeElement, defaultContent: ReactNode) => ReactNode;\n /** Replace the static content node inside a Table element. */\n renderTable?: (element: PPTTableElement, defaultContent: ReactNode) => ReactNode;\n /** Enable pointer interaction for video controls or custom video UI. */\n videoInteractive?: boolean;\n /**\n * Background canvases use the frame allowance left by foreground layout\n * effects, then finish in idle time at lower priority. Defaults to normal.\n */\n mathPriority?: 'normal' | 'background';\n /** Click handler invoked on any element. */\n onElementClick?: (element: PPTElement, event: React.MouseEvent) => void;\n /**\n * Prefix used for each element root DOM id. Hosts that layer DOM-measured\n * overlays on top of the canvas can keep their existing id contract.\n */\n elementIdPrefix?: string;\n /** Class on the outer container. */\n className?: string;\n /** Compositor-only offsets used by the editing surface during a move gesture. */\n dragOffsets?: ReadonlyMap<string, { x: number; y: number }>;\n /** Element ids omitted from rendering and effect targeting. */\n hiddenElementIds?: readonly string[];\n /** Inline style on the outer container. */\n style?: CSSProperties;\n /**\n * Card-style chrome on the inner slide container (drop shadow + rounded\n * corners). Defaults to `true` for on-screen previews. Snapshot pipelines\n * pass `false` so the captured PNG matches the source PPT's edges exactly\n * — html2canvas would otherwise bake the 1px shadow outline and the\n * 0.5rem corner radius into the output and the comparator reads them as\n * a thin border + rounded corners that the original PPT does not have.\n */\n chrome?: boolean;\n}\n\nexport function SlideCanvas(props: SlideCanvasProps) {\n const ctx = useOptionalSlideContext();\n const slide = props.slide ?? ctx?.slide;\n if (!slide) {\n throw new Error(\n '<SlideCanvas> requires `slide` either as a prop or via <SlideRendererProvider>.',\n );\n }\n\n const scale = props.scale ?? ctx?.scale;\n const background = props.background ?? ctx?.background;\n const effects = props.effects ?? ctx?.effects;\n const renderImage = props.renderImage ?? ctx?.renderImage;\n const renderVideo = props.renderVideo ?? ctx?.renderVideo;\n const renderText = props.renderText;\n const renderShapeLabel = props.renderShapeLabel;\n const renderTable = props.renderTable;\n const videoInteractive = props.videoInteractive ?? ctx?.videoInteractive;\n const onElementClick = props.onElementClick ?? ctx?.onElementClick;\n const elementIdPrefix = props.elementIdPrefix ?? 'slide-element-';\n const { className, dragOffsets, style } = props;\n const chrome = props.chrome ?? true;\n\n const canvasRef = useRef<HTMLDivElement>(null);\n const elements = slide.elements;\n const visibleElements = useMemo(() => {\n if (!props.hiddenElementIds?.length) return elements;\n const hidden = new Set(props.hiddenElementIds);\n return elements.filter((element) => !hidden.has(element.id));\n }, [elements, props.hiddenElementIds]);\n const elementIndexById = useMemo(\n () => new Map(elements.map((element, index) => [element.id, index + 1])),\n [elements],\n );\n\n const { viewportStyles, fitScale } = useViewportSize(canvasRef, {\n viewportSize: slide.viewportSize,\n viewportRatio: slide.viewportRatio,\n canvasPercentage: props.canvasPercentage,\n onScaleChange: scale === undefined ? props.onScaleChange : undefined,\n });\n const canvasScale = scale ?? fitScale;\n\n const resolvedBackground = background ?? slide.background;\n const { backgroundStyle } = useSlideBackgroundStyle(resolvedBackground);\n\n // Plain derivations: when this package is consumed in a React Compiler build\n // these are auto-memoized; otherwise the cost (O(elements) lookups) is trivial.\n const laserGeometry: PercentageGeometry | null = effects?.laser\n ? findElementGeometry(\n visibleElements,\n effects.laser.elementId,\n slide.viewportSize,\n slide.viewportRatio,\n )\n : null;\n\n const zoomGeometry: PercentageGeometry | null = effects?.zoom\n ? findElementGeometry(\n visibleElements,\n effects.zoom.elementId,\n slide.viewportSize,\n slide.viewportRatio,\n )\n : null;\n\n const highlights = effects?.highlights ?? (effects?.highlight ? [effects.highlight] : []);\n\n return (\n <div\n ref={canvasRef}\n className={className}\n style={{\n position: 'relative',\n width: '100%',\n height: '100%',\n overflow: 'hidden',\n userSelect: 'none',\n ...style,\n }}\n >\n <style dangerouslySetInnerHTML={{ __html: SLIDE_RENDERER_STYLES }} />\n <div\n style={{\n position: 'absolute',\n ...(chrome\n ? {\n boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.01), 0 0 12px 0 rgba(0, 0, 0, 0.1)',\n borderRadius: '0.5rem',\n }\n : {}),\n overflow: 'hidden',\n transitionProperty: 'transform',\n transitionDuration: '700ms',\n width: `${viewportStyles.width * canvasScale}px`,\n height: `${viewportStyles.height * canvasScale}px`,\n left: `${viewportStyles.left}px`,\n top: `${viewportStyles.top}px`,\n ...(effects?.zoom && zoomGeometry\n ? {\n transform: `scale(${effects.zoom.scale})`,\n transformOrigin: `${zoomGeometry.centerX}% ${zoomGeometry.centerY}%`,\n }\n : {}),\n }}\n >\n <div\n style={{\n width: '100%',\n height: '100%',\n backgroundPosition: 'center',\n ...(chrome ? { borderRadius: '0.5rem' } : {}),\n ...backgroundStyle,\n }}\n />\n\n <div\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n transformOrigin: 'top left',\n width: `${viewportStyles.width}px`,\n height: `${viewportStyles.height}px`,\n transform: `scale(${canvasScale})`,\n }}\n >\n <InlineMathPriorityContext.Provider value={props.mathPriority ?? 'normal'}>\n {visibleElements.map((element) => (\n <SlideElement\n key={element.id}\n elementInfo={element}\n elementIndex={elementIndexById.get(element.id) ?? 1}\n theme={slide.theme}\n renderImage={renderImage}\n renderVideo={renderVideo}\n renderText={renderText}\n renderShapeLabel={renderShapeLabel}\n renderTable={renderTable}\n videoInteractive={videoInteractive}\n onElementClick={onElementClick}\n idPrefix={elementIdPrefix}\n dragOffset={dragOffsets?.get(element.id)}\n />\n ))}\n </InlineMathPriorityContext.Provider>\n\n {highlights.map((highlight) => {\n const element = visibleElements.find((el) => el.id === highlight.elementId);\n return element ? (\n <HighlightOverlay key={highlight.elementId} element={element} options={highlight} />\n ) : null;\n })}\n </div>\n\n <SpotlightOverlay\n options={effects?.spotlight}\n elementIdPrefix={elementIdPrefix}\n measurementKey={visibleElements}\n />\n\n <div\n style={{\n position: 'absolute',\n inset: 0,\n pointerEvents: 'none',\n padding: '5%',\n }}\n >\n <div style={{ position: 'relative', width: '100%', height: '100%' }}>\n <AnimatePresence>\n {effects?.laser && laserGeometry && (\n <LaserOverlay\n key={`laser-${effects.laser.elementId}`}\n geometry={laserGeometry}\n color={effects.laser.color}\n duration={effects.laser.duration}\n />\n )}\n </AnimatePresence>\n </div>\n </div>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA8FM;AACJ;;;AAGE;;;;;;;AAUF;AACA;AACA;;;AAGA;;AAEA;AAEA;AACA;AACA;AACE;AAAqC;;AAErC;;AAEF;;;;;AASE;AACD;AACD;AAEA;;;;AAKA;AACE;;AAQF;AACE;;;;AAeI;AACA;AACA;AACA;AACA;AACA;AACD;AAKG;AACA;AACE;AACI;AACA;AACD;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACE;AACI;;AAED;;;AAMH;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;;AAyBA;;;AAeA;AACA;AACA;AACA;AACD;AAkBX;;"}
1
+ {"version":3,"file":"SlideCanvas.js","sources":["../src/SlideCanvas.tsx"],"sourcesContent":["'use client';\n\nimport { useMemo, useRef, type CSSProperties, type ReactNode } from 'react';\nimport { AnimatePresence } from 'motion/react';\n\nimport type {\n PPTElement,\n PPTImageElement,\n PPTShapeElement,\n PPTTableElement,\n PPTTextElement,\n PPTVideoElement,\n Slide,\n SlideBackground,\n} from '@openmaic/dsl';\nimport type { SlideEffects } from './types/effects';\nimport { findElementGeometry, type PercentageGeometry } from './utils/geometry';\nimport { useSlideBackgroundStyle } from './hooks/useSlideBackgroundStyle';\nimport { useViewportSize } from './hooks/useViewportSize';\nimport { SlideElement } from './SlideElement';\nimport { HighlightOverlay } from './effects/HighlightOverlay';\nimport { SpotlightOverlay } from './effects/SpotlightOverlay';\nimport { LaserOverlay } from './effects/LaserOverlay';\nimport { useOptionalSlideContext } from './context';\nimport { SLIDE_RENDERER_STYLES } from './styles';\nimport { InlineMathPriorityContext } from './utils/inlineMath';\n\nexport interface SlideCanvasProps {\n /**\n * Single slide data (PPTist-style). May be omitted when this component is\n * rendered inside a `<SlideRendererProvider>` that supplies it.\n */\n slide?: Slide;\n /**\n * Canvas scale. When omitted, the canvas auto-fits the container using\n * `slide.viewportSize` and `slide.viewportRatio`. Set to a fixed number\n * (e.g. 1) to skip auto-fit and render at slide-native dimensions.\n */\n scale?: number;\n /** Percent of the container to use when auto-fitting the slide. */\n canvasPercentage?: number;\n /** Called with the computed fit scale when `scale` is omitted. */\n onScaleChange?: (scale: number) => void;\n /** Override `slide.background`. */\n background?: SlideBackground;\n /** Optional play-time effects, all default off. */\n effects?: SlideEffects;\n /** Replace default <img> rendering for image elements. */\n renderImage?: (\n element: PPTImageElement,\n resolvedSrc: string,\n defaultContent: ReactNode,\n ) => ReactNode;\n /** Replace default <video> rendering for video elements. */\n renderVideo?: (element: PPTVideoElement) => ReactNode;\n /** Replace the content node inside the shared text paint wrapper. */\n renderText?: (element: PPTTextElement, defaultContent: ReactNode) => ReactNode;\n /** Replace the static label node inside a Shape element. */\n renderShapeLabel?: (element: PPTShapeElement, defaultContent: ReactNode) => ReactNode;\n /** Replace the static content node inside a Table element. */\n renderTable?: (element: PPTTableElement, defaultContent: ReactNode) => ReactNode;\n /** Enable pointer interaction for video controls or custom video UI. */\n videoInteractive?: boolean;\n /**\n * Background canvases use the frame allowance left by foreground layout\n * effects, then finish in idle time at lower priority. Defaults to normal.\n */\n mathPriority?: 'normal' | 'background';\n /** Click handler invoked on any element. */\n onElementClick?: (element: PPTElement, event: React.MouseEvent) => void;\n /**\n * Prefix used for each element root DOM id. Hosts that layer DOM-measured\n * overlays on top of the canvas can keep their existing id contract.\n */\n elementIdPrefix?: string;\n /** Class on the outer container. */\n className?: string;\n /** Compositor-only offsets used by the editing surface during a move gesture. */\n dragOffsets?: ReadonlyMap<string, { x: number; y: number }>;\n /** Element ids omitted from rendering and effect targeting. */\n hiddenElementIds?: readonly string[];\n /** Inline style on the outer container. */\n style?: CSSProperties;\n /**\n * Card-style chrome on the inner slide container (drop shadow + rounded\n * corners). Defaults to `true` for on-screen previews. Snapshot pipelines\n * pass `false` so the captured PNG matches the source PPT's edges exactly\n * — html2canvas would otherwise bake the 1px shadow outline and the\n * 0.5rem corner radius into the output and the comparator reads them as\n * a thin border + rounded corners that the original PPT does not have.\n */\n chrome?: boolean;\n}\n\nexport function SlideCanvas(props: SlideCanvasProps) {\n const ctx = useOptionalSlideContext();\n const slide = props.slide ?? ctx?.slide;\n if (!slide) {\n throw new Error(\n '<SlideCanvas> requires `slide` either as a prop or via <SlideRendererProvider>.',\n );\n }\n\n const scale = props.scale ?? ctx?.scale;\n const background = props.background ?? ctx?.background;\n const effects = props.effects ?? ctx?.effects;\n const renderImage = props.renderImage ?? ctx?.renderImage;\n const renderVideo = props.renderVideo ?? ctx?.renderVideo;\n const renderText = props.renderText;\n const renderShapeLabel = props.renderShapeLabel;\n const renderTable = props.renderTable;\n const videoInteractive = props.videoInteractive ?? ctx?.videoInteractive;\n const onElementClick = props.onElementClick ?? ctx?.onElementClick;\n const elementIdPrefix = props.elementIdPrefix ?? 'slide-element-';\n const { className, dragOffsets, style } = props;\n const chrome = props.chrome ?? true;\n\n const canvasRef = useRef<HTMLDivElement>(null);\n const elements = slide.elements;\n const visibleElements = useMemo(() => {\n if (!props.hiddenElementIds?.length) return elements;\n const hidden = new Set(props.hiddenElementIds);\n return elements.filter((element) => !hidden.has(element.id));\n }, [elements, props.hiddenElementIds]);\n const elementIndexById = useMemo(\n () => new Map(elements.map((element, index) => [element.id, index + 1])),\n [elements],\n );\n\n const { viewportStyles, fitScale } = useViewportSize(canvasRef, {\n viewportSize: slide.viewportSize,\n viewportRatio: slide.viewportRatio,\n canvasPercentage: props.canvasPercentage,\n onScaleChange: scale === undefined ? props.onScaleChange : undefined,\n });\n const canvasScale = scale ?? fitScale;\n\n const resolvedBackground = background ?? slide.background;\n const { backgroundStyle } = useSlideBackgroundStyle(resolvedBackground);\n\n // Plain derivations: when this package is consumed in a React Compiler build\n // these are auto-memoized; otherwise the cost (O(elements) lookups) is trivial.\n const laserGeometry: PercentageGeometry | null = effects?.laser\n ? findElementGeometry(\n visibleElements,\n effects.laser.elementId,\n slide.viewportSize,\n slide.viewportRatio,\n )\n : null;\n\n const zoomGeometry: PercentageGeometry | null = effects?.zoom\n ? findElementGeometry(\n visibleElements,\n effects.zoom.elementId,\n slide.viewportSize,\n slide.viewportRatio,\n )\n : null;\n\n const highlights = effects?.highlights ?? (effects?.highlight ? [effects.highlight] : []);\n\n return (\n <div\n ref={canvasRef}\n className={className}\n style={{\n position: 'relative',\n width: '100%',\n height: '100%',\n overflow: 'hidden',\n userSelect: 'none',\n ...style,\n }}\n >\n <style dangerouslySetInnerHTML={{ __html: SLIDE_RENDERER_STYLES }} />\n <div\n style={{\n position: 'absolute',\n ...(chrome\n ? {\n boxShadow: '0 0 0 1px rgba(0, 0, 0, 0.01), 0 0 12px 0 rgba(0, 0, 0, 0.1)',\n borderRadius: '0.5rem',\n }\n : {}),\n overflow: 'hidden',\n transitionProperty: 'transform',\n transitionDuration: '700ms',\n width: `${viewportStyles.width * canvasScale}px`,\n height: `${viewportStyles.height * canvasScale}px`,\n left: `${viewportStyles.left}px`,\n top: `${viewportStyles.top}px`,\n ...(effects?.zoom && zoomGeometry\n ? {\n transform: `scale(${effects.zoom.scale})`,\n transformOrigin: `${zoomGeometry.centerX}% ${zoomGeometry.centerY}%`,\n }\n : {}),\n }}\n >\n <div\n style={{\n width: '100%',\n height: '100%',\n backgroundPosition: 'center',\n ...(chrome ? { borderRadius: '0.5rem' } : {}),\n ...backgroundStyle,\n }}\n />\n\n <div\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n transformOrigin: 'top left',\n width: `${viewportStyles.width}px`,\n height: `${viewportStyles.height}px`,\n transform: `scale(${canvasScale})`,\n }}\n >\n <InlineMathPriorityContext.Provider value={props.mathPriority ?? 'normal'}>\n {visibleElements.map((element) => (\n <SlideElement\n key={element.id}\n elementInfo={element}\n elementIndex={elementIndexById.get(element.id) ?? 1}\n theme={slide.theme}\n renderImage={renderImage}\n renderVideo={renderVideo}\n renderText={renderText}\n renderShapeLabel={renderShapeLabel}\n renderTable={renderTable}\n videoInteractive={videoInteractive}\n onElementClick={onElementClick}\n idPrefix={elementIdPrefix}\n dragOffset={dragOffsets?.get(element.id)}\n />\n ))}\n </InlineMathPriorityContext.Provider>\n\n {highlights.map((highlight) => {\n const element = visibleElements.find((el) => el.id === highlight.elementId);\n return element ? (\n <HighlightOverlay key={highlight.elementId} element={element} options={highlight} />\n ) : null;\n })}\n </div>\n\n <SpotlightOverlay\n options={effects?.spotlight}\n elementIdPrefix={elementIdPrefix}\n measurementKey={visibleElements}\n />\n\n {/* Laser coords are percentages of the full slide frame, like zoom. */}\n <div style={{ position: 'absolute', inset: 0, pointerEvents: 'none' }}>\n <AnimatePresence>\n {effects?.laser && laserGeometry && (\n <LaserOverlay\n key={`laser-${effects.laser.elementId}`}\n geometry={laserGeometry}\n color={effects.laser.color}\n duration={effects.laser.duration}\n />\n )}\n </AnimatePresence>\n </div>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA8FM;AACJ;;;AAGE;;;;;;;AAUF;AACA;AACA;;;AAGA;;AAEA;AAEA;AACA;AACA;AACE;AAAqC;;AAErC;;AAEF;;;;;AASE;AACD;AACD;AAEA;;;;AAKA;AACE;;AAQF;AACE;;;;AAeI;AACA;AACA;AACA;AACA;AACA;AACD;AAKG;AACA;AACE;AACI;AACA;AACD;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACE;AACI;;AAED;;;AAMH;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;;AAyBA;;AAIF;AAyBV;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmaic/renderer",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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",
@@ -80,7 +82,7 @@
80
82
  "tailwind-merge": "^3.4.0",
81
83
  "tinycolor2": "^1.6.0",
82
84
  "@openmaic/geometry": "^0.1.0",
83
- "@openmaic/dsl": "^0.12.0"
85
+ "@openmaic/dsl": "^0.13.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
+ }