The VS Code of video editing, built for agents.
TypeScript
Refactor Mask Functionality to Clip Path
konstantin-pauluscde1cc1b5358
diff --git a/apps/web/src/components/sidebar-left/project-menu/object-menu.tsx b/apps/web/src/components/sidebar-left/project-menu/object-menu.tsxindex e53305a7..8c94141f 100644--- a/apps/web/src/components/sidebar-left/project-menu/object-menu.tsx+++ b/apps/web/src/components/sidebar-left/project-menu/object-menu.tsx@@ -152,7 +152,7 @@ export function ObjectMenu() {<DropdownMenuGroup><DropdownMenuItem>- Set mask target+ Set clip path target<DropdownMenuShortcut>⌃⌥M</DropdownMenuShortcut></DropdownMenuItem></DropdownMenuGroup>diff --git a/apps/web/src/components/sidebar-right/inspector/masks.tsx b/apps/web/src/components/sidebar-right/inspector/clip-paths.tsxsimilarity index 54%rename from apps/web/src/components/sidebar-right/inspector/masks.tsxrename to apps/web/src/components/sidebar-right/inspector/clip-paths.tsxindex afadfb04..7bccbe3b 100644--- a/apps/web/src/components/sidebar-right/inspector/masks.tsx+++ b/apps/web/src/components/sidebar-right/inspector/clip-paths.tsx@@ -16,55 +16,55 @@ import { useDerived, useEditor } from "@/engine/hooks";import type { Entity } from "koota";/**- * Where a new mask sits in its parent, px. Offset rather than flush so the- * mask shows itself the moment it is added: at the parent's own size it- * clips a band off two edges instead of landing invisibly on top of it.+ * Where a new clip path sits in its parent, px. Offset rather than flush so+ * the clip path shows itself the moment it is added: at the parent's own size+ * it clips a band off two edges instead of landing invisibly on top of it.*/-const MASK_INSET = 20;+const CLIP_PATH_INSET = 20;-// Stable identity, so a node without masks does not resample every tick.-const NO_MASKS: Entity[] = [];+// Stable identity, so a node without clip paths does not resample every tick.+const NO_CLIP_PATHS: Entity[] = [];-type MasksSettingsProps = {+type ClipPathsSettingsProps = {selection: Entity[];};/**- * The `<rect mask>` children of the selected node: the boxes it is clipped- * to (several intersect). A mask is a rect like any other, so it has no- * inspector of its own — a row selects it and the transform, time and+ * The `<rect clipPath>` children of the selected node: the boxes it is+ * clipped to (several intersect). A clip path is a rect like any other, so it+ * has no inspector of its own — a row selects it and the transform, time and* appearance panels are then its own. Its `fill`, `opacity` and paint- * children have no effect (a mask is never drawn), which is why the plus+ * children have no effect (a clip path is never drawn), which is why the plus* authors neither.*/-export function MasksSettings(props: MasksSettingsProps) {+export function ClipPathsSettings(props: ClipPathsSettingsProps) {const world = useWorld();const editor = useEditor();const entity = () => props.selection[0]!;// Cache is derived state, written without change events.- const masks = useDerived(() => entity().get(Cache)?.masks ?? NO_MASKS);+ const clipPaths = useDerived(() => entity().get(Cache)?.clipPaths ?? NO_CLIP_PATHS);- const handleAppendMask = () => {+ const handleAppendClipPath = () => {const node = entity();const computed = node.get(Computed);const width = Math.round(computed?.width ?? 0);const height = Math.round(computed?.height ?? 0);- // A mask without a size of its own is 500x500, which is the honest+ // A clip path without a size of its own is 500x500, which is the honest// answer for a parent that has no box yet (an empty group).const size = width > 0 && height > 0 ? { width, height } : {};- const [mask] = editor.insertElement(node, () => (- <Rect mask name={getNextName(world, "Mask")} x={MASK_INSET} y={MASK_INSET} {...size} />+ const [clipPath] = editor.insertElement(node, () => (+ <Rect clipPath name={getNextName(world, "Clip Path")} x={CLIP_PATH_INSET} y={CLIP_PATH_INSET} {...size} />));- // The mask is what the user came to place, so the selection moves to it.- if (mask) editor.select(mask);+ // The clip path is what the user came to place, so the selection moves to it.+ if (clipPath) editor.select(clipPath);};return (<PanelSection- title="Masks"+ title="Clip Paths"actions={<Tooltip><TooltipTrigger@@ -72,20 +72,20 @@ export function MasksSettings(props: MasksSettingsProps) {size="icon"variant="ghost"class="text-muted-foreground"- onClick={handleAppendMask}+ onClick={handleAppendClipPath}><Icon name="plus-add" /></TooltipTrigger>- <TooltipContent>Add mask</TooltipContent>+ <TooltipContent>Add clip path</TooltipContent></Tooltip>}>- <For each={masks()}>- {(mask) => (- <MaskRow- mask={mask}- onSelect={() => editor.select(mask)}- onRemove={() => editor.remove(mask)}+ <For each={clipPaths()}>+ {(clipPath) => (+ <ClipPathRow+ clipPath={clipPath}+ onSelect={() => editor.select(clipPath)}+ onRemove={() => editor.remove(clipPath)}/>)}</For>@@ -93,19 +93,19 @@ export function MasksSettings(props: MasksSettingsProps) {);}-type MaskRowProps = {- mask: Entity;+type ClipPathRowProps = {+ clipPath: Entity;onSelect(): void;onRemove(): void;};-function MaskRow(props: MaskRowProps) {- const name = useTrait(() => props.mask, Name);+function ClipPathRow(props: ClipPathRowProps) {+ const name = useTrait(() => props.clipPath, Name);return (<ItemRow- label="Mask"- value={name()?.value || "Mask"}+ label="Clip Path"+ value={name()?.value || "Clip Path"}icon={<Icon name="mask-small" />}class="text-foreground"onClick={props.onSelect}@@ -120,7 +120,7 @@ function MaskRow(props: MaskRowProps) {><Icon name="close-remove-small" /></TooltipTrigger>- <TooltipContent>Remove mask</TooltipContent>+ <TooltipContent>Remove clip path</TooltipContent></Tooltip></ItemRow>);diff --git a/apps/web/src/components/sidebar-right/inspector/inspector.tsx b/apps/web/src/components/sidebar-right/inspector/inspector.tsxindex ade8a7c5..e5b3f094 100644--- a/apps/web/src/components/sidebar-right/inspector/inspector.tsx+++ b/apps/web/src/components/sidebar-right/inspector/inspector.tsx@@ -11,7 +11,7 @@ import {isAudio,isCaption,isGroup,- isMask,+ isClipPath,isScene,isSequence,isShape,@@ -39,7 +39,7 @@ import { ShadowsSettings } from "./shadows";import { EffectsSettings } from "./effects";import { AnimationsSettings } from "./animations";import { TransitionSettings } from "./transition";-import { MasksSettings } from "./masks";+import { ClipPathsSettings } from "./clip-paths";import { AudioSettings } from "./audio";import { InterpolationSettings } from "./interpolation";@@ -51,7 +51,7 @@ export type SelectionTarget =| "keyframe"| "asset"| "scene"- | "mask"+ | "clip-path"| "sequence"| "caption"| "audio"@@ -63,7 +63,7 @@ export type SelectionTarget =function classifyNode(entity: Entity): SelectionTarget {if (isScene(entity)) return "scene";- if (isMask(entity)) return "mask";+ if (isClipPath(entity)) return "clip-path";if (isSequence(entity)) return "sequence";if (isCaption(entity)) return "caption";if (isAudio(entity)) return "audio";@@ -135,19 +135,19 @@ export function Inspector() {<VariablesSettings /></Show>- <Show when={includesTarget("shape", "text", "audio", "scene", "caption", "group", "mask", "adjustment")}>+ <Show when={includesTarget("shape", "text", "audio", "scene", "caption", "group", "clip-path", "adjustment")}><TimeSettings selection={nodes()} /></Show>- <Show when={includesTarget("shape", "text", "audio", "scene", "caption", "group", "mask", "adjustment")}>+ <Show when={includesTarget("shape", "text", "audio", "scene", "caption", "group", "clip-path", "adjustment")}><TransformSettings selection={nodes()} /></Show>- <Show when={includesTarget("shape", "text", "audio", "scene", "mask")}>+ <Show when={includesTarget("shape", "text", "audio", "scene", "clip-path")}><LayoutPanel selection={nodes()} /></Show>- <Show when={includesTarget("shape", "text", "scene", "caption", "group", "audio", "mask")}>+ <Show when={includesTarget("shape", "text", "scene", "caption", "group", "audio", "clip-path")}><AppearanceSettings selection={nodes()} /></Show>@@ -179,7 +179,7 @@ export function Inspector() {<EffectsSettings selection={nodes()} /></Show>- <Show when={includesTarget("shape", "text", "caption", "group", "mask")}>+ <Show when={includesTarget("shape", "text", "caption", "group", "clip-path")}><AnimationsSettings selection={nodes()} /></Show>@@ -188,7 +188,7 @@ export function Inspector() {</Show><Show when={includesTarget("shape", "text", "caption", "group")}>- <MasksSettings selection={nodes()} />+ <ClipPathsSettings selection={nodes()} /></Show><Show when={includesTarget("shape", "audio", "group")}>diff --git a/apps/web/src/components/timeline/layers/context.tsx b/apps/web/src/components/timeline/layers/context.tsxindex 894f84e2..12d20948 100644--- a/apps/web/src/components/timeline/layers/context.tsx+++ b/apps/web/src/components/timeline/layers/context.tsx@@ -4,7 +4,7 @@import { createContext, createSignal, onCleanup, useContext, type JSX, type Signal } from "solid-js";import { useWorld } from "@diffusionstudio/koota-solid";-import { Expanded, getEntityTree, isMask, isSequence } from "@diffusionstudio/runtime";+import { Expanded, getEntityTree, isClipPath, isSequence } from "@diffusionstudio/runtime";import { useEditor, useTimelineIndex } from "@/engine/hooks";import { useTimeline } from "@/context/timeline";@@ -51,7 +51,7 @@ export function LayerContextProvider(props: { children: JSX.Element }) {const [target, setTarget] = createSignal<DropTarget | null>(null);let pending: { entity: Entity; startX: number; startY: number } | null = null;- let active: { entity: Entity; forbidden: Set<Entity>; isMask: boolean } | null = null;+ let active: { entity: Entity; forbidden: Set<Entity>; isClipPath: boolean } | null = null;let dwell: { entity: Entity; since: number } | null = null;let pointerX = 0;let pointerY = 0;@@ -74,7 +74,7 @@ export function LayerContextProvider(props: { children: JSX.Element }) {active = {entity,forbidden: new Set(getEntityTree(world, entity)),- isMask: isMask(entity),+ isClipPath: isClipPath(entity),};dirty = true;setDragging(entity);@@ -190,7 +190,7 @@ export function LayerContextProvider(props: { children: JSX.Element }) {root,dragged: active.entity,forbidden: active.forbidden,- draggedIsMask: active.isMask,+ draggedIsClipPath: active.isClipPath,containerRect,listBottom: getListBottom(layersEl, containerRect),};diff --git a/apps/web/src/components/timeline/layers/drag.ts b/apps/web/src/components/timeline/layers/drag.tsindex 1814a341..6dec6c22 100644--- a/apps/web/src/components/timeline/layers/drag.ts+++ b/apps/web/src/components/timeline/layers/drag.ts@@ -13,7 +13,7 @@* rect, depth and ancestor chain without the rows registering anything.*/-import { isGroupLike, isMask, isSequence } from '@diffusionstudio/runtime';+import { isGroupLike, isClipPath, isSequence } from '@diffusionstudio/runtime';import { NESTED_INDENT_PX } from './config';import type { Accessor } from 'solid-js';@@ -70,8 +70,8 @@ export type GapContext = {dragged: Entity;/** The dragged subtree: nothing in it may become the parent of the drop. */forbidden: Set<Entity>;- /** Masks stack apart from plain layers; anchors must stay in their bucket. */- draggedIsMask: boolean;+ /** Clip paths stack apart from plain layers; anchors must stay in their bucket. */+ draggedIsClipPath: boolean;containerRect: DOMRect;/** Client Y just below the last row of the whole list. */listBottom: number;@@ -171,7 +171,7 @@ export function resolveGap(gapIndex: number, rows: FlatRow[], x: number, context}// The gap right under an open container doubles as its topmost slot —- // for group-likes always, and for clips that already stack layers (masks).+ // for group-likes always, and for clips that already stack layers (clip paths).const canEnterAbove =above.node.expanded &&!context.forbidden.has(above.node.entity) &&@@ -217,7 +217,7 @@ export function resolveGap(gapIndex: number, rows: FlatRow[], x: number, context/*** The document sibling to insert before: the nearest row above the gap at* the chosen depth. Restricted to the dragged layer's stacking bucket —- * masks and plain layers render as separate runs, so an anchor from the+ * clip paths and plain layers render as separate runs, so an anchor from the* other bucket would land the row somewhere the line never was.*/function scanAnchor(@@ -232,9 +232,8 @@ function scanAnchor(if (row.depth < depth) break;if (row.depth > depth) continue;if (row.parent !== parent) break;- // The dragged row is about to leave its spot; it cannot be the anchor.if (row.node.entity === context.dragged) continue;- if (isMask(row.node.entity) === context.draggedIsMask) return row.node.entity;+ if (isClipPath(row.node.entity) === context.draggedIsClipPath) return row.node.entity;}return undefined;diff --git a/apps/web/src/components/timeline/layers/node.tsx b/apps/web/src/components/timeline/layers/node.tsxindex 6e440a6d..0a6db331 100644--- a/apps/web/src/components/timeline/layers/node.tsx+++ b/apps/web/src/components/timeline/layers/node.tsx@@ -19,7 +19,7 @@ import {isAdjustmentLayer,isCaption,isGroup,- isMask,+ isClipPath,isScene,isSequence,isText,@@ -351,7 +351,7 @@ export function NodeLayer(props: LayerRowProps) {function getLayerIcon(world: World, layer: TimelineNode) {const entity = layer.entity;- if (isMask(entity)) return "mask-small";+ if (isClipPath(entity)) return "mask-small";if (isAdjustmentLayer(entity)) return "adjustment-layer";if (isScene(entity)) return "scene-frame-small";if (isSequence(entity)) return "timeline-sequence-small";diff --git a/apps/web/src/dapi/handlers/check.ts b/apps/web/src/dapi/handlers/check.tsindex 03209cb7..5aa12f67 100644--- a/apps/web/src/dapi/handlers/check.ts+++ b/apps/web/src/dapi/handlers/check.ts@@ -4,7 +4,7 @@import {AdjustmentLayer, Audio, Cache, Caption, Computed, FrameRate, Geometry,- Group, Hidden, IsMask, Opacity, PaintType, Scene, Sequential, Source,+ Group, Hidden, IsClipPath, Opacity, PaintType, Scene, Sequential, Source,SourceError, Workarea, framesToSeconds, getIntrinsicPaint, isText,} from "@diffusionstudio/runtime";@@ -18,7 +18,7 @@ import type { ToolHandler } from "../handler";type Interval = { start: number; end: number };function kindOf(entity: Entity): string {- if (entity.has(IsMask)) return "mask";+ if (entity.has(IsClipPath)) return "clip-path";if (entity.has(Scene)) return "scene";if (entity.has(Group)) return entity.has(Sequential) ? "sequence" : "group";if (entity.has(AdjustmentLayer)) return "adjustment-layer";@@ -34,7 +34,7 @@ function kindOf(entity: Entity): string {}// Whether the node itself puts pixels on screen. Containers don't (their-// leaves do), adjustment layers and masks only shape what others draw, and a+// leaves do), adjustment layers and clip paths only shape what others draw, and a// scene's implicit background is exactly what a "black frame" looks like —// so none of those count as coverage.function drawsPixels(entity: Entity): boolean {@@ -42,7 +42,7 @@ function drawsPixels(entity: Entity): boolean {&& !entity.has(Scene)&& !entity.has(Group)&& !entity.has(AdjustmentLayer)- && !entity.has(IsMask)+ && !entity.has(IsClipPath)&& !entity.has(Audio);}@@ -128,8 +128,8 @@ function visit(entity: Entity, window: Interval | null, depth: number, state: Waconst cache = entity.get(Cache);for (const child of cache?.children ?? []) visit(child, visible, depth + 1, state);- // Masks are nodes worth counting and checking, but they add no pixels.- for (const mask of cache?.masks ?? []) visit(mask, null, depth + 1, state);+ // Clip paths are nodes worth counting and checking, but they add no pixels.+ for (const clipPath of cache?.clipPaths ?? []) visit(clipPath, null, depth + 1, state);}/** The spans of `window` no coverage interval touches. */diff --git a/apps/web/src/engine/group.tsx b/apps/web/src/engine/group.tsxindex f01d1c6b..1a6e6fc5 100644--- a/apps/web/src/engine/group.tsx+++ b/apps/web/src/engine/group.tsx@@ -10,7 +10,7 @@ import {FrameRate,Geometry,Group,- IsMask,+ IsClipPath,Position,Scene,Selected,@@ -44,7 +44,7 @@ import type { TransformWrite } from './input/interactions';import type { Mat2D } from '@diffusionstudio/runtime';import type { Entity, World } from 'koota';-/** The node kinds a group holds; a mask belongs to its target, not the group. */+/** The node kinds a group holds; a clip path belongs to its target, not the group. */const NODES = Or(Geometry, Group, AdjustmentLayer);const EPSILON = 1e-6;@@ -69,7 +69,7 @@ function isIdentity(mat: Mat2D): boolean {*/export function groupSelection(world: World): void {const editor = getDocumentEditor(world);- const selected = [...world.query(Selected, NODES, Not(IsMask))];+ const selected = [...world.query(Selected, NODES, Not(IsClipPath))];if (!selected.length) return;const group = editor.wrap(selected, () => <GroupElement name={getNextName(world, 'Group')} />);@@ -87,7 +87,7 @@ export function groupSelection(world: World): void {*/export function wrapSelectionInSequence(world: World): void {const editor = getDocumentEditor(world);- const selected = [...world.query(Selected, NODES, Not(IsMask))];+ const selected = [...world.query(Selected, NODES, Not(IsClipPath))];if (!selected.length) return;const sequence = editor.wrap(selected, () => <SequenceElement name={getNextName(world, 'Sequence')} />);@@ -100,7 +100,7 @@ export function wrapSelectionInSequence(world: World): void {/** The children of `entity` that are nodes of the container, in file order. */function nodeChildren(world: World, entity: Entity): Entity[] {return getEntityChildren(world, entity).filter(- (child) => (child.has(Geometry) || child.has(Group) || child.has(AdjustmentLayer)) && !child.has(IsMask),+ (child) => (child.has(Geometry) || child.has(Group) || child.has(AdjustmentLayer)) && !child.has(IsClipPath),);}@@ -129,7 +129,7 @@ function spatialLeaves(world: World, entity: Entity): Entity[] {*/export function wrapSelectionInScene(world: World): void {const editor = getDocumentEditor(world);- const selected = new Set(world.query(Selected, NODES, Not(IsMask)));+ const selected = new Set(world.query(Selected, NODES, Not(IsClipPath)));const first = [...selected][0];if (!first) return;diff --git a/apps/web/src/engine/timeline/constants.ts b/apps/web/src/engine/timeline/constants.tsindex 01f9b128..0773395d 100644--- a/apps/web/src/engine/timeline/constants.ts+++ b/apps/web/src/engine/timeline/constants.ts@@ -115,7 +115,7 @@ export const COLORS = {primary: '#5AB9DD',foreground: '#DBEAF0',},- mask: {+ clipPath: {background: '#5455DE',foreground: '#EAE8FC',},diff --git a/apps/web/src/engine/timeline/style.ts b/apps/web/src/engine/timeline/style.tsindex d50cd57c..b4fabc92 100644--- a/apps/web/src/engine/timeline/style.ts+++ b/apps/web/src/engine/timeline/style.ts@@ -10,7 +10,7 @@ import {isAdjustmentLayer,isCaption,isGroup,- isMask,+ isClipPath,isRect,isScene,isSequence,@@ -34,7 +34,7 @@ export function getClipStyle(entity: Entity, asset: Asset | null, errored = falsif (isText(entity)) return COLORS.clip.text;if (isScene(entity)) return COLORS.clip.scene;if (isGroup(entity)) return COLORS.clip.group;- if (isMask(entity)) return COLORS.clip.mask;+ if (isClipPath(entity)) return COLORS.clip.clipPath;if (isAdjustmentLayer(entity)) return COLORS.clip.adjustment;if (hasHtmlPaint(entity) || hasSurfacePaint(entity)) return COLORS.clip.html;@@ -68,7 +68,7 @@ export function getClipFallbackName(world: World, entity: Entity): string {if (isScene(entity)) return 'Scene';if (isSequence(entity)) return 'Sequence';if (isGroup(entity)) return 'Group';- if (isMask(entity)) return 'Mask';+ if (isClipPath(entity)) return 'Clip Path';if (isAdjustmentLayer(entity)) return 'Adjustment';if (hasHtmlPaint(entity)) return 'HTML';if (hasSurfacePaint(entity)) return 'Surface';diff --git a/docs/reference/jsx/elements.md b/docs/reference/jsx/elements.mdindex 92f7a2af..fae1961e 100644--- a/docs/reference/jsx/elements.md+++ b/docs/reference/jsx/elements.md@@ -15,7 +15,7 @@ camelCase composition elements map 1:1 onto entities. Lowercase DOM vocabulary i| Element | What it is || ------- | ---------- |-| [`<rect>`](./rect.md) | A rectangle. Takes paints, strokes, shadows and effects. With `mask` it clips its parent instead of drawing. |+| [`<rect>`](./rect.md) | A rectangle. Takes paints, strokes, shadows and effects. With `clipPath` it clips its parent instead of drawing. || [`<text>`](./text.md) | Text; its children are the glyphs. Sizes itself to them unless given a box. || [`<textRange>`](./text.md#textrange) | A style override over a run of the parent `<text>`'s glyphs, by character index. || [`<video>`](./video.md) | A video clip: a rect whose intrinsic paint is the media `src` names. |@@ -67,7 +67,7 @@ User-defined components are ordinary Solid components; they compose the elements| `<scene>` | required — the frame's own size || `<rect>`, `<html>`, `<surface>` | 100 × 100 || `<audio>` | 500 × 150 (the waveform box on the canvas) |-| `<rect mask>` | 500 × 500 |+| `<rect clipPath>` | 500 × 500 || `<text>` | fits its glyphs || `<captions>` | the preset's — it lays out the caption block against the scene's frame || `<group>`, `<sequence>` | fits its children |diff --git a/docs/reference/jsx/rect.md b/docs/reference/jsx/rect.mdindex 785da1b5..47925c11 100644--- a/docs/reference/jsx/rect.md+++ b/docs/reference/jsx/rect.md@@ -13,18 +13,18 @@ All [common props](./elements.md#common-props), plus:| Prop | Type | Default | Meaning || ---- | ---- | ------- | ------- || `fill` | `string` | none | Any CSS color; alpha is ignored (use `opacity`). Shorthand for a solid paint child, drawn beneath any paint children. |-| `mask` | `boolean` | `false` | Makes the rect a mask of its parent instead of a drawn shape — see below. |+| `clipPath` | `boolean` | `false` | Makes the rect a clip path of its parent instead of a drawn shape — see below. `mask` is the old spelling and still works. |-A rect with neither `fill` nor a paint child draws nothing; it is still a box that clips masks, carries children and takes up its place in the timeline. Without `width`/`height` a rect is 100×100.+A rect with neither `fill` nor a paint child draws nothing; it is still a box: its clip paths cut it, it carries children, and it takes up its place in the timeline. Without `width`/`height` a rect is 100×100.-## Masks+## Clip paths-A `<rect mask>` clips the element holding it instead of drawing: the parent's fills, strokes, shadows and children show only inside the rect's box. It is still a rect — same coordinates, `cornerRadius`, transform and timing — so it can be moved, rotated, keyframed and animated independently of what it clips: a mask whose `width` is keyframed across a text is a wipe, a mask that starts later than its parent is a reveal.+A `<rect clipPath>` clips the element holding it instead of drawing: the parent's fills, strokes, shadows and children show only inside the rect's box. It is still a rect — same coordinates, `cornerRadius`, transform and timing — so it can be moved, rotated, keyframed and animated independently of what it clips: a clip path whose `width` is keyframed across a text is a wipe, one that starts later than its parent is a reveal.```tsx<text fontSize={120} color="#FFFFFF" textAlign="center" textBaseline="middle">Hello World- <rect mask>+ <rect clipPath><keyframeTrack property="width"><keyframe time={0} value={0} /><keyframe time={1} value={1920} easing="easeOut" />@@ -33,9 +33,10 @@ A `<rect mask>` clips the element holding it instead of drawing: the parent's fi</text>```-- Any node can hold masks (`<rect>`, `<text>`, `<video>`, `<image>`, `<group>`, `<scene>`); the mask clips that element as a whole.-- Several masks under one element **intersect**: content shows only where every mask covers it.-- Outside the mask's own time window it does not clip and the parent shows in full. Without `end` (or `sourceOut`) a mask clips for the parent's whole window, not the usual 16 s default.+- Any node can hold clip paths (`<rect>`, `<text>`, `<video>`, `<image>`, `<group>`, `<scene>`); the clip path clips that element as a whole.+- Several clip paths under one element **intersect**: content shows only where every clip path covers it.+- Outside the clip path's own time window it does not clip and the parent shows in full. Without `end` (or `sourceOut`) a clip path clips for the parent's whole window, not the usual 16 s default.- Never rendered and never hit on the canvas, so `fill`, `opacity`, `blendMode` and paint / stroke / shadow / effect children have no effect on it.-- Without `width`/`height` a mask is 500×500 (a plain rect is 100×100).-- `hidden` on a mask does not switch it off (it is skipped by role before hiding is looked at); use timing, or set `mask={false}`.+- Without `width`/`height` a clip path is 500×500 (a plain rect is 100×100).+- `hidden` on a clip path does not switch it off (it is skipped by role before hiding is looked at); use timing, or set `clipPath={false}`.+- `<rect mask>` is the old spelling of `<rect clipPath>` and still reads the same; when both are set, `clipPath` wins.diff --git a/docs/reference/tools/check.md b/docs/reference/tools/check.mdindex 61faacea..2a020fb3 100644--- a/docs/reference/tools/check.md+++ b/docs/reference/tools/check.md@@ -19,7 +19,7 @@ The analysis is structural, from the resolved timeline alone, so it is instant a## What counts as visual coverage-Video, image, HTML, shape, text, and caption nodes draw pixels; their scheduled spans cover the timeline. Groups and scenes are covered only where their descendants draw — a scene's background alone is exactly what a black frame looks like, so it never counts. Audio nodes, masks, and adjustment layers add no pixels; neither does anything hidden, fully transparent, or scheduled outside the window its ancestors play. When a scene has a workarea, coverage is judged against the workarea instead of the full span.+Video, image, HTML, shape, text, and caption nodes draw pixels; their scheduled spans cover the timeline. Groups and scenes are covered only where their descendants draw — a scene's background alone is exactly what a black frame looks like, so it never counts. Audio nodes, clip paths, and adjustment layers add no pixels; neither does anything hidden, fully transparent, or scheduled outside the window its ancestors play. When a scene has a workarea, coverage is judged against the workarea instead of the full span.## Output@@ -29,7 +29,7 @@ One JSON object:{stats: {nodes: number; // nodes in the subtree, the checked node included- byKind: Record<string, number>; // "scene" | "sequence" | "group" | "video" | "image" | "html" | "shape" | "text" | "caption" | "audio" | "mask" | "adjustment-layer"+ byKind: Record<string, number>; // "scene" | "sequence" | "group" | "video" | "image" | "html" | "shape" | "text" | "caption" | "audio" | "clip-path" | "adjustment-layer"depth: number; // deepest nesting level below the checked node (0 = no children)duration: number; // seconds the checked node plays (its workarea, when one is set)};diff --git a/packages/jsx/src/types.ts b/packages/jsx/src/types.tsindex 370657a5..730f9623 100644--- a/packages/jsx/src/types.ts+++ b/packages/jsx/src/types.ts@@ -544,15 +544,17 @@ export type AdjustmentLayerProps =export type RectProps = CommonProps & FillProps & {/**- * Makes the rect a mask of its parent: it clips the parent (its fills,+ * Makes the rect a clip path of its parent: it clips the parent (its fills,* strokes and children show only inside the rect's box) instead of drawing.* The rect keeps its transform, `cornerRadius` and timing — a keyframed- * mask sliding across a text is a wipe, one that ends early lets go — and- * several masks under one parent intersect. A mask is never rendered or- * hit, so its `fill`, `opacity`, `blendMode` and paint children have no- * effect. Without `width`/`height` a mask is 500×500, and without `end` it- * clips for the parent's whole window.- */+ * clip path sliding across a text is a wipe, one that ends early lets go —+ * and several clip paths under one parent intersect. A clip path is never+ * rendered or hit, so its `fill`, `opacity`, `blendMode` and paint children+ * have no effect. Without `width`/`height` a clip path is 500×500, and+ * without `end` it clips for the parent's whole window.+ */+ clipPath?: boolean;+ /** @deprecated The old spelling of `clipPath`, read when `clipPath` is not set. */mask?: boolean;/*** Paint children (`<SolidPaint>`, `<LinearGradientPaint>`,diff --git a/packages/reconciler/src/document.ts b/packages/reconciler/src/document.tsindex cc3a15ce..0abdb589 100644--- a/packages/reconciler/src/document.ts+++ b/packages/reconciler/src/document.ts@@ -3,7 +3,7 @@* file, You can obtain one at http://mozilla.org/MPL/2.0/. */-import { Active, AdjustmentLayer, Animation, AnimationPhase, AnimationType, appendChild, AssetId, Audio, Background, bindAsset, BlendMode, BlendModeType, Blur, Caption, CaptionAlign, CAPTION_PRESET_FILLS, CAPTION_PRESET_STYLES, CaptionType, Chars, ClipHeight, ClipsContent, Computed, Constraint, ConstraintCache, ConstraintType, CornerRadius, createEntity, DEFAULT_BACKGROUND, Color, ColorStop, Delay, Effect, EffectType, Expanded, FontStyle, FramePromises, FrameRate, Generating, GenerationRequest, getActiveEntity, Loop, LoadRequest, Matte, Geometry, GeometryType, getEntityTree, getParentEntity, getParentNode, Hidden, Host, IsMask, isText, ItemIndex, KeepAspectRatio, Keyframe, KeyframeTrack, MixedCornerRadius, Mode, Muted, Name, Offset, Opacity, Paint, PaintType, parseColor, PendingSource, PendingSync, Playback, PlaybackRate, Position, removeChild, RenderSurface, resizeEntity, Scale, ScaleMode, ScaleModeType, secondsToFrames, getAsset, getEntityChildren, Group, Sequential, Shader, Size, Stage, Root, Rotation, Scene, Selected, Shadow, Source, SourceFrameRate, setCameraMatrix, setPlayhead, setTimelineView, Stroke, StrokeCap, StrokeJoin, StrokeStyle, SyncRequest, TextAlign, TextBaseline, TextCase, TextRange, TextStyle, TranscriptionRequest, Transition, TransitionType, Trim, UniformScale, Volume, Workarea } from '@diffusionstudio/runtime';+import { Active, AdjustmentLayer, Animation, AnimationPhase, AnimationType, appendChild, AssetId, Audio, Background, bindAsset, BlendMode, BlendModeType, Blur, Caption, CaptionAlign, CAPTION_PRESET_FILLS, CAPTION_PRESET_STYLES, CaptionType, Chars, ClipHeight, ClipsContent, Computed, Constraint, ConstraintCache, ConstraintType, CornerRadius, createEntity, DEFAULT_BACKGROUND, Color, ColorStop, Delay, Effect, EffectType, Expanded, FontStyle, FramePromises, FrameRate, Generating, GenerationRequest, getActiveEntity, Loop, LoadRequest, Matte, Geometry, GeometryType, getEntityTree, getParentEntity, getParentNode, Hidden, Host, IsClipPath, isText, ItemIndex, KeepAspectRatio, Keyframe, KeyframeTrack, MixedCornerRadius, Mode, Muted, Name, Offset, Opacity, Paint, PaintType, parseColor, PendingSource, PendingSync, Playback, PlaybackRate, Position, removeChild, RenderSurface, resizeEntity, Scale, ScaleMode, ScaleModeType, secondsToFrames, getAsset, getEntityChildren, Group, Sequential, Shader, Size, Stage, Root, Rotation, Scene, Selected, Shadow, Source, SourceFrameRate, setCameraMatrix, setPlayhead, setTimelineView, Stroke, StrokeCap, StrokeJoin, StrokeStyle, SyncRequest, TextAlign, TextBaseline, TextCase, TextRange, TextStyle, TranscriptionRequest, Transition, TransitionType, Trim, UniformScale, Volume, Workarea } from '@diffusionstudio/runtime';import { DEFAULT_MASK_SMOOTHING } from '@diffusionstudio/assets';import { LOOP_ATTR, parseTime, SOURCE_ATTR } from '@diffusionstudio/jsx';import { createSignal } from 'solid-js';@@ -962,11 +962,12 @@ export class RuntimeDocument implements ProjectDocument<SceneNode> {entity.set(BlendMode, { value: mode });return;}+ case 'clipPath':case 'mask': {if (value === true && entity !== this.stage.entity) {- entity.add(IsMask);+ entity.add(IsClipPath);} else {- entity.remove(IsMask);+ entity.remove(IsClipPath);}return;}diff --git a/packages/runtime/src/actions/cache.ts b/packages/runtime/src/actions/cache.tsindex 9e2d4e5f..562a92c0 100644--- a/packages/runtime/src/actions/cache.ts+++ b/packages/runtime/src/actions/cache.ts@@ -11,7 +11,7 @@ import { Not, Or } from 'koota';import { store } from '../world/store';import {ChildOf, Cache,- Geometry, Group, AdjustmentLayer, IsMask, Matte, Paint, Stroke, Shadow, Effect,+ Geometry, Group, AdjustmentLayer, IsClipPath, Matte, Paint, Stroke, Shadow, Effect,TextRange, KeyframeTrack, Keyframe, Animation,} from '../traits';import { isStage } from '../queries/predicates';@@ -39,12 +39,12 @@ export function rebuildCaches(world: World, entity: Entity, parent: Entity | nulif (entity.has(Geometry) || entity.has(Group) || entity.has(AdjustmentLayer)) {cache.children[pid] = collect(- Or(Geometry, Group, AdjustmentLayer), ChildOf(parent), Not(IsMask),+ Or(Geometry, Group, AdjustmentLayer), ChildOf(parent), Not(IsClipPath),).sort(sortByItemIndex);}- if (entity.has(IsMask)) {- cache.masks[pid] = collect(Geometry, IsMask, ChildOf(parent))+ if (entity.has(IsClipPath)) {+ cache.clipPaths[pid] = collect(Geometry, IsClipPath, ChildOf(parent)).sort(sortByItemIndex);}@@ -105,7 +105,7 @@ export function rebuildCaches(world: World, entity: Entity, parent: Entity | nul/** Every list a `Cache` keeps, for the paths that cannot ask which one applies. */const CACHE_LISTS = ['children', 'fills', 'shadows', 'strokes', 'effects',- 'textRanges', 'masks', 'mattes', 'keyframeTracks', 'keyframes', 'animations',+ 'textRanges', 'clipPaths', 'mattes', 'keyframeTracks', 'keyframes', 'animations',] as const;/**@@ -138,12 +138,12 @@ export function evictFromCaches(world: World, entity: Entity, parent: Entity | n}/**- * Move an attached geometry between its parent's `children` and `masks` when- * its `IsMask` tag is toggled in place. `rebuildCaches` files by trait on+ * Move an attached geometry between its parent's `children` and `clipPaths` when+ * its `IsClipPath` tag is toggled in place. `rebuildCaches` files by trait on* attach; here the queries cannot be trusted (koota fires onRemove before the* tag is cleared), so the two lists are edited by hand.*/-export function refileMask(world: World, entity: Entity, parent: Entity | null, mask: boolean): void {+export function refileClipPath(world: World, entity: Entity, parent: Entity | null, clipPath: boolean): void {if (parent === null || isStage(parent)) return;if (!parent.has(Cache)) parent.add(Cache);@@ -151,11 +151,11 @@ export function refileMask(world: World, entity: Entity, parent: Entity | null,const pid = parent.id();const without = (list: Entity[] | undefined) => (list ?? []).filter((e) => e !== entity);- const masks = without(cache.masks[pid]);+ const clipPaths = without(cache.clipPaths[pid]);const children = without(cache.children[pid]);- (mask ? masks : children).push(entity);+ (clipPath ? clipPaths : children).push(entity);- cache.masks[pid] = masks.sort(sortByItemIndex);+ cache.clipPaths[pid] = clipPaths.sort(sortByItemIndex);cache.children[pid] = children.sort(sortByItemIndex);}diff --git a/packages/runtime/src/actions/interactive.ts b/packages/runtime/src/actions/interactive.tsindex d867f995..f5a89fea 100644--- a/packages/runtime/src/actions/interactive.ts+++ b/packages/runtime/src/actions/interactive.ts@@ -11,7 +11,7 @@ import { Not, Or } from 'koota';import {AdjustmentLayer, ChildOf, Culled, Geometry, Group, Hovering, Interactive,- IsMask, Root, Sequential,+ IsClipPath, Root, Sequential,} from '../traits';import { isScene } from '../queries/predicates';import { isPointerInEntity } from '../queries/interaction';@@ -52,7 +52,7 @@ export function syncInteractiveState(world: World): void {/** The topmost child of `parent` under a device-pixel point, or null. */export function findChildAt(world: World, parent: Entity, point: Point): Entity | null {- const children = world.query(Or(Geometry, Group), ChildOf(parent), Not(IsMask), Not(Culled));+ const children = world.query(Or(Geometry, Group), ChildOf(parent), Not(IsClipPath), Not(Culled));for (let i = children.length - 1; i >= 0; i--) {const child = children[i]!;diff --git a/packages/runtime/src/actions/timing.ts b/packages/runtime/src/actions/timing.tsindex 5138e5b4..da46afef 100644--- a/packages/runtime/src/actions/timing.ts+++ b/packages/runtime/src/actions/timing.ts@@ -194,8 +194,8 @@ export function propagateTimeRangeDown(world: World, entity: Entity, ignore?: Igfor (const child of entity.get(Cache)?.children ?? []) {propagateTimeRangeDown(world, child);}- for (const mask of entity.get(Cache)?.masks ?? []) {- propagateTimeRangeDown(world, mask);+ for (const clipPath of entity.get(Cache)?.clipPaths ?? []) {+ propagateTimeRangeDown(world, clipPath);}recomputeEntityTimeRange(world, entity, ignore);}diff --git a/packages/runtime/src/queries/predicates.ts b/packages/runtime/src/queries/predicates.tsindex a7703300..a41e351c 100644--- a/packages/runtime/src/queries/predicates.ts+++ b/packages/runtime/src/queries/predicates.ts@@ -3,7 +3,7 @@* file, You can obtain one at http://mozilla.org/MPL/2.0/. */import {- Scene, Group, Sequential, Audio, AdjustmentLayer, Caption, Geometry, IsMask,+ Scene, Group, Sequential, Audio, AdjustmentLayer, Caption, Geometry, IsClipPath,Paint, Cache, Stage,} from '../traits';import { GeometryType, PaintType } from '../constants';@@ -59,8 +59,8 @@ export function isShape(entity: Entity): boolean {&& !entity.has(Audio);}-export function isMask(entity: Entity): boolean {- return entity.has(IsMask);+export function isClipPath(entity: Entity): boolean {+ return entity.has(IsClipPath);}export function hasHtmlPaint(entity: Entity): boolean {diff --git a/packages/runtime/src/queries/timeline-index.ts b/packages/runtime/src/queries/timeline-index.tsindex 0c77d98e..1df8548d 100644--- a/packages/runtime/src/queries/timeline-index.ts+++ b/packages/runtime/src/queries/timeline-index.ts@@ -3,7 +3,7 @@* file, You can obtain one at http://mozilla.org/MPL/2.0/. */import {- ChildOf, Keyframe, KeyframeTrack, IsMask, Geometry, Group,+ ChildOf, Keyframe, KeyframeTrack, IsClipPath, Geometry, Group,AdjustmentLayer, Expanded,} from '../traits';import { isSequence } from './predicates';@@ -31,7 +31,7 @@ export function buildTimelineLayers(world: World, parent: Entity): TimelineNode[const tracks: Entity[] = [];const geoms: Entity[] = [];- const masks: Entity[] = [];+ const clipPaths: Entity[] = [];const subitems: Entity[] = [];for (const child of world.query(ChildOf(parent))) {@@ -40,8 +40,8 @@ export function buildTimelineLayers(world: World, parent: Entity): TimelineNode[if (child.has(KeyframeTrack)) {tracks.push(child);- } else if (child.has(IsMask)) {- masks.push(child);+ } else if (child.has(IsClipPath)) {+ clipPaths.push(child);} else if (child.has(Geometry) || child.has(Group) || child.has(AdjustmentLayer)) {geoms.push(child);} else {@@ -51,7 +51,7 @@ export function buildTimelineLayers(world: World, parent: Entity): TimelineNode[tracks.sort(sortByItemIndex).reverse();geoms.sort(sortByItemIndex).reverse();- masks.sort(sortByItemIndex).reverse();+ clipPaths.sort(sortByItemIndex).reverse();subitems.sort(sortByItemIndex).reverse();const nodes: TimelineNode[] = [];@@ -77,8 +77,8 @@ export function buildTimelineLayers(world: World, parent: Entity): TimelineNode[nodes.push(buildNode(world, geom, 'geometry'));}- for (const mask of masks) {- nodes.push(buildNode(world, mask, 'geometry'));+ for (const clipPath of clipPaths) {+ nodes.push(buildNode(world, clipPath, 'geometry'));}return nodes;@@ -119,7 +119,7 @@ function isExpandable(world: World, parent: Entity): boolean {if (child.has(Keyframe)) continue;if (sequence && !hasKeyframes(world, child)) continue;if (- child.has(IsMask) ||+ child.has(IsClipPath) ||child.has(Geometry) ||child.has(Group) ||child.has(AdjustmentLayer) ||diff --git a/packages/runtime/src/systems/render.ts b/packages/runtime/src/systems/render.tsindex 4a62d73a..48428d3c 100644--- a/packages/runtime/src/systems/render.ts+++ b/packages/runtime/src/systems/render.ts@@ -17,7 +17,7 @@ import {TransitionType,} from '../constants';import {- ChildOf, Hidden, Culled, Interactive, IsMask, AssetId,+ ChildOf, Hidden, Culled, Interactive, IsClipPath, AssetId,ClipsContent, Geometry, Group, Paint, Color, Caption, ScaleMode, Shader,BlendMode, Effect, Matte, Transition, MixedCornerRadius,LocalTransform, WorldTransform, Computed, Cache,@@ -785,7 +785,7 @@ export function renderNode(world: World, entity: Entity): void {});}- if (entity.has(IsMask) || entity.has(Hidden)) return;+ if (entity.has(IsClipPath) || entity.has(Hidden)) return;ctx.save();@@ -799,9 +799,9 @@ export function renderNode(world: World, entity: Entity): void {local.f[eid]!,);- for (const mask of store(world, Cache).masks[eid] ?? []) {- if (computed.visibility[mask.id()] === 0) continue;- clipToMask(world, mask);+ for (const clipPath of store(world, Cache).clipPaths[eid] ?? []) {+ if (computed.visibility[clipPath.id()] === 0) continue;+ clipTo(world, clipPath);}// An effect limited by a `<mask>` takes the node through layers.@@ -822,12 +822,12 @@ export function renderNode(world: World, entity: Entity): void {ctx.restore();}-/** Clips the current context to the box of `mask`, in world space. */-function clipToMask(world: World, mask: Entity): void {+/** Clips the current context to the box of `clipPath`, in world space. */+function clipTo(world: World, clipPath: Entity): void {const ctx = getCtx(world);ctx.save();- setWorldTransform(world, ctx, mask);- drawRectPath(world, mask);+ setWorldTransform(world, ctx, clipPath);+ drawRectPath(world, clipPath);ctx.restore();ctx.clip();}diff --git a/packages/runtime/src/systems/transform.ts b/packages/runtime/src/systems/transform.tsindex 410029f2..2a00e688 100644--- a/packages/runtime/src/systems/transform.ts+++ b/packages/runtime/src/systems/transform.ts@@ -6,7 +6,7 @@ import { Not, Or } from 'koota';import { store } from '../world/store';import {- ChildOf, Geometry, Group, Hidden, IsMask, Sequential, AdjustmentLayer,+ ChildOf, Geometry, Group, Hidden, IsClipPath, Sequential, AdjustmentLayer,Culled, Flip, Anchor, Computed, Cache, LocalTransform, WorldTransform,WorldBounds, RenderSurface,Root,@@ -209,7 +209,7 @@ export function computeGroupBounds(world: World, entity: Entity): void {let maxY = -Infinity;let any = false;- for (const child of world.query(Or(Geometry, Group), ChildOf(entity), Not(Hidden), Not(IsMask))) {+ for (const child of world.query(Or(Geometry, Group), ChildOf(entity), Not(Hidden), Not(IsClipPath))) {const cid = child.id();const mat: Mat2D = {a: localStore.a[cid] ?? 1, b: localStore.b[cid] ?? 0,diff --git a/packages/runtime/src/traits/derived.ts b/packages/runtime/src/traits/derived.tsindex ed0cb219..9093ee76 100644--- a/packages/runtime/src/traits/derived.ts+++ b/packages/runtime/src/traits/derived.ts@@ -55,7 +55,7 @@ export const Cache = trait({strokes: () => [] as Entity[],effects: () => [] as Entity[],textRanges: () => [] as Entity[],- masks: () => [] as Entity[],+ clipPaths: () => [] as Entity[],mattes: () => [] as Entity[],keyframeTracks: () => [] as Entity[],keyframes: () => [] as Entity[],diff --git a/packages/runtime/src/traits/node.ts b/packages/runtime/src/traits/node.tsindex 5960b674..b4ae1e72 100644--- a/packages/runtime/src/traits/node.ts+++ b/packages/runtime/src/traits/node.ts@@ -31,9 +31,9 @@ export const Audio = trait();export const AdjustmentLayer = trait();-// Tag marking an entity as a mask. Masks are ChildOf their target;-// Cache.masks on the target is derived from IsMask + ChildOf queries.-export const IsMask = trait();+// Tag marking an entity as a clip path (`<rect clipPath>`). Clip paths are+// ChildOf their target; Cache.clipPaths on the target is derived from IsClipPath + ChildOf queries.+export const IsClipPath = trait();// Tag for shadow sub-entities (distinguishes them from other Effect// sub-entities in ChildOf queries).diff --git a/packages/runtime/src/traits/relations.ts b/packages/runtime/src/traits/relations.tsindex 86473c98..b01335ed 100644--- a/packages/runtime/src/traits/relations.ts+++ b/packages/runtime/src/traits/relations.ts@@ -11,6 +11,6 @@ import { relation } from 'koota';* exclusive: an entity has at most one parent; re-parenting replaces the* previous target. autoDestroy 'orphan': destroying a parent destroys its* whole subtree. Children are distinguished by their type tags (Shadow,- * Stroke, IsMask, ...). Sibling order is encoded via ItemIndex on each child.+ * Stroke, IsClipPath, ...). Sibling order is encoded via ItemIndex on each child.*/export const ChildOf = relation({ exclusive: true, autoDestroy: 'orphan' });diff --git a/packages/runtime/src/utils/time.ts b/packages/runtime/src/utils/time.tsindex 7c82e4c0..c7981717 100644--- a/packages/runtime/src/utils/time.ts+++ b/packages/runtime/src/utils/time.ts@@ -5,7 +5,7 @@import { CONONICAL_TIME_BASE, PaintType } from '../constants';import {Audio, AssetId, Cache, Computed, Geometry, Paint, Trim, Library, FrameRate,- Delay, IsMask, PlaybackRate, SourceFrameRate,+ Delay, IsClipPath, PlaybackRate, SourceFrameRate,} from '../traits';import { getParentNode } from '../queries/hierarchy';import { getSourceDuration } from '../actions/assets';@@ -171,7 +171,7 @@ export type TimeTrait = typeof Delay | typeof PlaybackRate | typeof SourceFrameR* koota fires onRemove before it clears the trait, so a removal handler has to* ask for the length the node will have once it is gone.*/-export type Ignorable = TimeTrait | typeof Trim | typeof AssetId | typeof IsMask;+export type Ignorable = TimeTrait | typeof Trim | typeof AssetId | typeof IsClipPath;/*** Intrinsic duration (in project frames) of the media asset attached to andiff --git a/packages/runtime/src/world/observers.ts b/packages/runtime/src/world/observers.tsindex 2b16805d..269decb4 100644--- a/packages/runtime/src/world/observers.ts+++ b/packages/runtime/src/world/observers.ts@@ -9,13 +9,13 @@ import {Delay, Trim, PlaybackRate, SourceFrameRate, Keyframe, ItemIndex,Position, Offset, Rotation, Scale, UniformScale, Skew, Anchor, Flip,Opacity, Color, Blur, Volume, Effect, CornerRadius, MixedCornerRadius,- ColorStop, StrokeStyle, Size, Computed, Active, Stage, IsMask,+ ColorStop, StrokeStyle, Size, Computed, Active, Stage, IsClipPath,ImageDecoderHandle, VideoDecoderHandle,AudioDecoderHandle, CaptionDecoderHandle, WaveformHandle,ShaderHostHandle, AudioBusHandle,} from '../traits';import { getParentEntity } from '../queries/hierarchy';-import { evictFromCaches, rebuildCaches, refileMask } from '../actions/cache';+import { evictFromCaches, rebuildCaches, refileClipPath } from '../actions/cache';import { syncStagePlayback } from '../actions/playback';import { disposeDecoders, disconnectAudioBus } from '../media/dispose';import {@@ -99,13 +99,13 @@ export function observeWorld(world: World): () => void {entity.remove(Position, Offset, Rotation, Scale, Skew, Anchor, Flip);}));- const refile = (mask: boolean) => (entity: Entity) => {+ const refile = (clipPath: boolean) => (entity: Entity) => {const parent = getParentEntity(entity);if (parent === null || !world.has(parent)) return;- refileMask(world, entity, parent, mask);+ refileClipPath(world, entity, parent, clipPath);};- subs.push(world.onAdd(IsMask, refile(true)));- subs.push(world.onRemove(IsMask, refile(false)));+ subs.push(world.onAdd(IsClipPath, refile(true)));+ subs.push(world.onRemove(IsClipPath, refile(false)));// One active entity per world, and only a root.subs.push(world.onAdd(Active, (entity) => {diff --git a/packages/runtime/src/world/serialize.ts b/packages/runtime/src/world/serialize.tsindex 032c7b11..185fa4b9 100644--- a/packages/runtime/src/world/serialize.ts+++ b/packages/runtime/src/world/serialize.ts@@ -4,7 +4,7 @@import {ChildOf,- Geometry, Paint, Group, Scene, Audio, AdjustmentLayer, IsMask, Shadow, Stroke,+ Geometry, Paint, Group, Scene, Audio, AdjustmentLayer, IsClipPath, Shadow, Stroke,Hidden, ClipsContent, Name, Key, AssetId, ItemIndex, MountScript, MountPath,Caption,Position, Offset, Rotation, Scale, UniformScale, Anchor, Skew, Size, Flip,@@ -51,7 +51,7 @@ export interface EntityRecord {colors?: number[];verticalAlign?: number;};- IsMask?: {};+ IsClipPath?: {};Shadow?: {};Stroke?: {};Name?: string;@@ -241,8 +241,8 @@ export function serializeEntity(entity: Entity): EntityRecord {if (parent !== undefined && !parent.has(Stage)) {record.ChildOf = parent;}- if (entity.has(IsMask)) {- record.IsMask = {};+ if (entity.has(IsClipPath)) {+ record.IsClipPath = {};}if (entity.has(Position)) {const position = entity.get(Position)!;@@ -487,8 +487,8 @@ export function deserializeEntity(entity: Entity, e: Partial<EntityRecord>): voiif (e.Expanded !== undefined) {entity.add(Expanded);}- if (e.IsMask !== undefined) {- entity.add(IsMask);+ if (e.IsClipPath !== undefined) {+ entity.add(IsClipPath);}if (e.Position !== undefined) {entity.add(Position);@@ -646,7 +646,7 @@ export function deserializeEntity(entity: Entity, e: Partial<EntityRecord>): voientity.set(TextStyle, defined(e.TextStyle));}// Attach to parent last so add/change observers see every trait this entity- // has (KeyframeTrack, Keyframe, Animation, IsMask, ...). Otherwise derived+ // has (KeyframeTrack, Keyframe, Animation, IsClipPath, ...). Otherwise derived// caches stay empty and the UI/motion system can't find them after reload.if (e.ChildOf !== undefined) {entity.add(ChildOf(e.ChildOf as Entity));