@cutcraft/player 0.1.0 → 0.2.0

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/package.json CHANGED
@@ -1,7 +1,19 @@
1
1
  {
2
2
  "name": "@cutcraft/player",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Browser player for the cut video DSL: WebCodecs decode through mediabunny, canvas compositing, DOM overlays, Web Audio clock.",
5
+ "keywords": [
6
+ "video",
7
+ "video-editing",
8
+ "react",
9
+ "tsx",
10
+ "llm",
11
+ "ai-video",
12
+ "webcodecs",
13
+ "player",
14
+ "web-audio",
15
+ "canvas"
16
+ ],
5
17
  "license": "MIT",
6
18
  "homepage": "https://prefix-tree.github.io/cutcraft/",
7
19
  "repository": {
@@ -16,7 +28,6 @@
16
28
  "exports": {
17
29
  ".": "./dist/index.mjs",
18
30
  "./engine": "./dist/engine.mjs",
19
- "./overlays": "./dist/overlays.mjs",
20
31
  "./fonts.css": "./fonts.css"
21
32
  },
22
33
  "files": [
@@ -39,30 +50,26 @@
39
50
  "mediabunny": "1.62.0",
40
51
  "saxes": "^6.0.0",
41
52
  "zod": "^4.6.7",
42
- "@cutcraft/graphics": "0.1.0",
43
- "@cutcraft/kit": "0.1.0"
53
+ "@cutcraft/graphics": "0.2.0",
54
+ "@cutcraft/kit": "0.2.0"
44
55
  },
45
56
  "devDependencies": {
46
- "@eslint/js": "^9.0.0",
47
57
  "@playwright/test": "1.56.1",
48
58
  "@types/node": "^22.0.0",
49
59
  "@types/react": "^19.3.0",
50
60
  "@types/react-dom": "^19.3.0",
51
- "@vitejs/plugin-react": "^5.0.0",
52
- "eslint": "^9.0.0",
61
+ "@vitejs/plugin-react": "^5.2.0",
62
+ "@vitest/coverage-v8": "5.0.5",
53
63
  "jsdom": "^30.1.3",
54
64
  "react": "^19.3.1",
55
65
  "react-dom": "^19.3.1",
56
66
  "typescript": "^5.9.3",
57
- "typescript-eslint": "^8.72.0",
58
67
  "vite": "^8.3.5",
59
- "vitest": "^5.0.5",
60
- "zod": "^4.6.7"
68
+ "vitest": "^5.0.5"
61
69
  },
62
70
  "scripts": {
63
- "build": "tsdown src/index.ts src/engine.ts src/overlays.ts --dts",
71
+ "build": "tsdown src/index.ts src/engine.ts --dts",
64
72
  "typecheck": "tsc --noEmit -p tsconfig.json",
65
- "lint": "eslint . --max-warnings 0",
66
73
  "test": "vitest run",
67
74
  "test:watch": "vitest",
68
75
  "test:e2e": "playwright test"
@@ -1,131 +0,0 @@
1
- import { FitMode, LayerClock, Placement, ResolvedState, ResolvedTrack, Transform } from "@cutcraft/kit";
2
- declare function frameIndex(t: number, fps: number): number;
3
- declare function frameTime(frame: number, fps: number): number;
4
- /** `mm:ss.ff` for a composition time, what the controls show and the contact sheet labels. */
5
- declare function timecode(t: number, fps: number): string;
6
- /** 0..1 progress through a placement, what `useT()` returns inside a Layer. */
7
- declare function localT(p: Placement, t: number): number;
8
- /** What `useLayer()` returns inside a Layer: progress plus real seconds. */
9
- declare function layerClock(p: Placement, t: number, fps: number): LayerClock;
10
- /**
11
- * Source seconds a media placement shows at composition time `t`: in/out
12
- * trim, constant speed or a speed-key ramp, reverse, and freeze holds.
13
- * A freeze is an insert hold: it shows `at` over its window, then the clip
14
- * resumes from where it stopped; the result is clamped to the trimmed range.
15
- */
16
- declare function placementSourceTime(p: Placement, children: readonly Placement[], t: number): number;
17
- declare function nestedSourceTime(p: Placement, t: number): number;
18
- interface TransitionRole {
19
- readonly placement: Placement;
20
- readonly role: "out" | "in";
21
- /** 0..1 through the transition, eased by its curve. */
22
- readonly progress: number;
23
- }
24
- interface VisibleItem {
25
- readonly placement: Placement;
26
- readonly track: ResolvedTrack;
27
- readonly children: readonly Placement[];
28
- readonly transition?: TransitionRole;
29
- }
30
- /** Visual, timed placements that show at `t`: tracks in document order (the first track is the bottom), items in track order. */
31
- declare function visiblePlacements(state: ResolvedState, t: number): VisibleItem[];
32
- declare function isVisibleAt(p: Placement, t: number, compositionDuration: number): boolean;
33
- /** Placements that sit on a track, in track order; a multicam's generated clips follow their parent. */
34
- declare function trackItems(state: ResolvedState, track: ResolvedTrack): Placement[];
35
- interface DrawRect {
36
- readonly x: number;
37
- readonly y: number;
38
- readonly w: number;
39
- readonly h: number;
40
- }
41
- /** Row-major 2D affine matrix in the canvas/CSS `matrix(a, b, c, d, e, f)` convention. */
42
- interface Matrix2D {
43
- readonly a: number;
44
- readonly b: number;
45
- readonly c: number;
46
- readonly d: number;
47
- readonly e: number;
48
- readonly f: number;
49
- }
50
- interface Layout {
51
- /** Where the element lands in composition pixels before its transform. */
52
- readonly rect: DrawRect;
53
- /** Maps local element coordinates (0..rect.w, 0..rect.h) to composition coordinates. */
54
- readonly matrix: Matrix2D;
55
- /** Source sub-rectangle in source pixels, when cropped. */
56
- readonly crop?: DrawRect;
57
- readonly opacity: number;
58
- }
59
- declare const IDENTITY: Matrix2D;
60
- declare function multiply(m: Matrix2D, n: Matrix2D): Matrix2D;
61
- declare const translate: (x: number, y: number) => Matrix2D;
62
- declare const scaleM: (sx: number, sy: number) => Matrix2D;
63
- declare function rotate(deg: number): Matrix2D;
64
- declare function matrixToCss(m: Matrix2D): string;
65
- interface Box {
66
- readonly width: number;
67
- readonly height: number;
68
- }
69
- /** The fitted rectangle of a source inside the composition, centred. */
70
- declare function fitRect(comp: Box, src: Box, fit: FitMode): DrawRect;
71
- /**
72
- * Lay out a source of `src` pixels in the composition: crop, fit, then the
73
- * element transform (position offset, scale, rotation about the anchor).
74
- */
75
- declare function layoutRect(comp: Box, src: Box, fit: FitMode, transform?: Transform | undefined): Layout;
76
- /** The matrix mapping an element's local pixels to the composition, given its untransformed rect. */
77
- declare function transformMatrix(rect: DrawRect, t: Transform | undefined): Matrix2D;
78
- /** The upright box around `rect` after `m`: where a rectangle of an element's local pixels lands in the composition. */
79
- declare function boundsOf(rect: DrawRect, m: Matrix2D): DrawRect;
80
- /** The transform with its keyframed properties evaluated at element-relative time `rel`. */
81
- declare function animatedTransform(base: Transform | undefined, children: readonly Placement[], rel: number): Transform;
82
- /** CSS for a DOM element laid out like `layoutRect` does: it sits at the origin with `transform-origin: 0 0`. */
83
- declare function cssTransform(layout: Layout): string;
84
- /** An entrance or exit as the schema writes it. */
85
- interface GraphicAnimation {
86
- readonly type: string;
87
- readonly duration?: number;
88
- readonly easing?: string;
89
- }
90
- /** A rectangle in the element's own pixels. */
91
- interface ClipRect {
92
- readonly x: number;
93
- readonly y: number;
94
- readonly w: number;
95
- readonly h: number;
96
- }
97
- /**
98
- * What an element's entrance and exit do to it at one moment, in its own pixels:
99
- * an opacity factor, a matrix applied before its layout, the part of it shown
100
- * (null for all of it) and how much of its strokes are drawn (null when not drawing).
101
- */
102
- interface Motion {
103
- readonly opacity: number;
104
- readonly matrix: Matrix2D;
105
- readonly clip: readonly ClipRect[] | null;
106
- readonly draw: number | null;
107
- }
108
- declare const STILL: Motion;
109
- /**
110
- * The entrance and exit of an element `rel` seconds into its `duration`, for a
111
- * `width` by `height` box. Both can play at once on a short element; their
112
- * effects multiply. Pop, bounce and elastic carry their own curve; the others
113
- * follow the animation's easing (default ease-out).
114
- */
115
- declare function motionAt(enter: GraphicAnimation | undefined, exit: GraphicAnimation | undefined, rel: number, duration: number, width: number, height: number): Motion;
116
- /** One animation at raw progress `x` (0 hidden, 1 fully shown). */
117
- declare function effect(anim: GraphicAnimation, x: number, w: number, h: number): Motion;
118
- /** Both effects at once: opacities and draw amounts multiply, matrices compose, clips intersect. */
119
- declare function combine(a: Motion, b: Motion): Motion;
120
- /** Kinds the overlay plane draws (as DOM in the preview, through Satori and skia in the export) rather than the canvas. */
121
- declare const OVERLAY_KINDS: ReadonlySet<string>;
122
- /**
123
- * The tracks whose overlays draw beneath the footage: those below every
124
- * visible track that holds footage, when one of them holds an overlay (a
125
- * background graphic under the cut, say). Empty otherwise, and then every
126
- * overlay draws above the footage as before. When it is not empty, the canvas
127
- * holds only the footage over a transparent ground, and the composition
128
- * background is painted beneath the backdrop instead.
129
- */
130
- declare function backdropTracks(state: ResolvedState): ReadonlySet<string>;
131
- export { visiblePlacements as A, scaleM as C, VisibleItem as D, TransitionRole as E, nestedSourceTime as F, placementSourceTime as I, timecode as L, frameTime as M, layerClock as N, isVisibleAt as O, localT as P, rotate as S, translate as T, cssTransform as _, Motion as a, matrixToCss as b, effect as c, DrawRect as d, IDENTITY as f, boundsOf as g, animatedTransform as h, GraphicAnimation as i, frameIndex as j, trackItems as k, motionAt as l, Matrix2D as m, backdropTracks as n, STILL as o, Layout as p, ClipRect as r, combine as s, OVERLAY_KINDS as t, Box as u, fitRect as v, transformMatrix as w, multiply as x, layoutRect as y };