chore: import upstream snapshot with attribution
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
* Render context — provides resolved theme/master/layout chain for a given slide.
|
||||
*/
|
||||
|
||||
import type { ECharts } from 'echarts'
|
||||
import type { LayoutData } from '../model/layout'
|
||||
import type { MasterData } from '../model/master'
|
||||
import type { PresentationData } from '../model/presentation'
|
||||
import type { SlideData } from '../model/slide'
|
||||
import type { ThemeData } from '../model/theme'
|
||||
import type { SafeXmlNode } from '../parser/xml-parser'
|
||||
|
||||
export interface RenderContext {
|
||||
presentation: PresentationData
|
||||
slide: SlideData
|
||||
theme: ThemeData
|
||||
master: MasterData
|
||||
layout: LayoutData
|
||||
mediaUrlCache: Map<string, string> // path -> blob URL
|
||||
colorCache: Map<string, { color: string; alpha: number }>
|
||||
/** Shared set of live ECharts instances for explicit disposal. */
|
||||
chartInstances?: Set<ECharts>
|
||||
/** Fill node from parent group's grpSpPr, used to resolve `a:grpFill` in children. */
|
||||
groupFillNode?: SafeXmlNode
|
||||
/**
|
||||
* Navigation callback for shape-level hyperlink actions (action buttons, clickable shapes).
|
||||
* Called with target slide index (0-based) for `ppaction://hlinksldjump`,
|
||||
* or with a URL string for external links.
|
||||
*/
|
||||
onNavigate?: (target: { slideIndex?: number; url?: string }) => void
|
||||
}
|
||||
|
||||
export function createRenderContext(
|
||||
presentation: PresentationData,
|
||||
slide: SlideData,
|
||||
mediaUrlCache?: Map<string, string>,
|
||||
chartInstances?: Set<ECharts>
|
||||
): RenderContext {
|
||||
// Resolve the chain: slide -> layout -> master -> theme
|
||||
const layoutPath = presentation.slideToLayout.get(slide.index) || ''
|
||||
const masterPath = presentation.layoutToMaster.get(layoutPath) || ''
|
||||
const themePath = presentation.masterToTheme.get(masterPath) || ''
|
||||
|
||||
const layout: LayoutData = presentation.layouts.get(layoutPath) || {
|
||||
placeholders: [],
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
spTree: {} as any,
|
||||
rels: new Map(),
|
||||
showMasterSp: true,
|
||||
}
|
||||
|
||||
const master: MasterData = presentation.masters.get(masterPath) || {
|
||||
colorMap: new Map(),
|
||||
textStyles: {},
|
||||
placeholders: [],
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
spTree: {} as any,
|
||||
rels: new Map(),
|
||||
}
|
||||
|
||||
const theme: ThemeData = presentation.themes.get(themePath) || {
|
||||
colorScheme: new Map(),
|
||||
majorFont: { latin: 'Calibri', ea: '', cs: '' },
|
||||
minorFont: { latin: 'Calibri', ea: '', cs: '' },
|
||||
fillStyles: [],
|
||||
lineStyles: [],
|
||||
effectStyles: [],
|
||||
}
|
||||
|
||||
return {
|
||||
presentation,
|
||||
slide,
|
||||
theme,
|
||||
master,
|
||||
layout,
|
||||
mediaUrlCache: mediaUrlCache ?? new Map(),
|
||||
colorCache: new Map(),
|
||||
chartInstances,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user