import { ArrowDefinition, BoundaryDefinition, ClipDefinition, CompiledNodeLayout, CompositeDefinition, IRAnimationTrack, IRScene, IRViewBox, LowerTex, PathGeneratorDefinition, PathKindDefinition, PatternDefinition, RibbonWidthProfileDefinition, ShapeDefinition } from '@retikz/core'; import { AnimationControls, AnimationPropertyRegistry, EasingRegistry } from '@retikz/render/animation'; import { HydrationHandlers } from '@retikz/render/hydration'; import { CSSProperties, FC, ReactNode, Ref } from 'react'; import { EmbeddableTier2Adapter, ScopeStyleProps } from '../protocol'; /** * @description 含 {@link ScopeStyleProps} 级联样式子集——设任一样式 prop 时把 children 包进合成根 ``, * 等价于用户手写一层根 ``(编译产物同一 IR)。内层 `` / 图元显式属性照常级联覆盖。 * 与直接传 `ir` prop 并用时样式 props 被忽略(dev 警告) */ export type LayoutProps = ScopeStyleProps & { /** 直接喂 IR JSON(持久化 / AI / 编辑器场景),与 children 二选一 */ ir?: IRScene; /** Kernel/Sugar JSX children */ children?: ReactNode; /** * `ir` prop 模式下按图元 id 提供的水合 handler 注册表(无 JSX children 可收集时用) * @description JSX 模式经组件 `on` props 收集,无需此 prop;直接传 `ir` 时无组件 props, * 改由此 prop 按 `{ [id]: { click, ... } }` 提供。两路结果经 `createHydrationController` 绑到 figure root * (svg root 或 ``),svg / canvas 双模共用同一注册表与分发 */ handlers?: HydrationHandlers; /** SVG 元素宽度(CSS 长度或数字) */ width?: number | string; /** SVG 元素高度(CSS 长度或数字) */ height?: number | string; /** * 显式视框 `{ x, y, width, height }`,覆盖自动算的范围(固定尺寸 / 裁剪 / 多图对齐) * @description 注入构造出的 IR 根(`ir.viewBox`);设值时 `` 用它、忽略 padding。 * 与直接传 `ir` prop 自带的 viewBox 冲突时,本 prop 优先;都缺省时回退自动 AABB */ viewBox?: IRViewBox; /** 透传到 svg 元素的 className */ className?: string; /** 透传到 svg 元素的内联样式 */ style?: CSSProperties; /** 渲染目标;缺省为 SVG,设为 canvas 时用同一份图形数据绘制到 `` */ renderer?: 'svg' | 'canvas'; /** * 是否播放动画;未传时跟随系统减少动态效果偏好,显式 `true` / `false` 强制开关 * @description SVG 模式:`load` track 经内联 `