@tongue-core/ui 0.1.0-rc.1 → 0.1.0-rc.3
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/LICENSE +21 -0
- package/README.md +4 -0
- package/dist/player/player.js +4 -0
- package/dist/react/timeline.d.ts +2 -0
- package/dist/react/timeline.js +1 -1
- package/dist/timeline/model.d.ts +2 -0
- package/dist/timeline/model.js +1 -1
- package/package.json +5 -5
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Backpine
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -38,6 +38,10 @@ player.fit(canvas.clientWidth); // render a
|
|
|
38
38
|
const bitmap = await player.preview(900, 160); // a thumbnail, when the workers are free
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
The picture keeps the film's shape in whatever box the page gives the canvas: unless the page
|
|
42
|
+
sets its own `object-fit`, the player sets `contain`, so a box of another shape letterboxes the
|
|
43
|
+
frame instead of stretching it.
|
|
44
|
+
|
|
41
45
|
A build is static files: `build.json`, `film.json`, `scenes/*.js`, `assets/…` (`tongue build`
|
|
42
46
|
writes one). The player fetches the manifests and bundles, then the asset files frames need, nearest
|
|
43
47
|
the playhead first, each checked against its hash. **A frame is drawn only once every file it needs
|
package/dist/player/player.js
CHANGED
|
@@ -31,6 +31,10 @@ const SETTLE_MS = 90;
|
|
|
31
31
|
export function createPlayer(options) {
|
|
32
32
|
const canvas = options.canvas;
|
|
33
33
|
const ctx = canvas.getContext("2d");
|
|
34
|
+
// The picture keeps the film's shape in whatever box the page gives the canvas: letterboxed,
|
|
35
|
+
// never stretched. A page that sets its own object-fit keeps it.
|
|
36
|
+
if (canvas.style.objectFit === "")
|
|
37
|
+
canvas.style.objectFit = "contain";
|
|
34
38
|
if (!ctx)
|
|
35
39
|
throw new Error("The player needs a canvas with a 2D context.");
|
|
36
40
|
const pool = new WorkerPool({ workerUrl: options.workerUrl, workers: options.workers ?? defaultWorkers() });
|
package/dist/react/timeline.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export declare const Clip: import("react").NamedExoticComponent<Styled & {
|
|
|
46
46
|
/** A transition: the stretch where two clips overlap. */
|
|
47
47
|
export declare const Transition: import("react").NamedExoticComponent<Styled & {
|
|
48
48
|
readonly transition: TimelineTransition;
|
|
49
|
+
readonly title?: string;
|
|
49
50
|
readonly children?: ReactNode;
|
|
50
51
|
}>;
|
|
51
52
|
/** The playhead. It moves without React: its frame is a CSS variable on itself, set as reports
|
|
@@ -88,6 +89,7 @@ export declare const Timeline: {
|
|
|
88
89
|
}>;
|
|
89
90
|
Transition: import("react").NamedExoticComponent<Styled & {
|
|
90
91
|
readonly transition: TimelineTransition;
|
|
92
|
+
readonly title?: string;
|
|
91
93
|
readonly children?: ReactNode;
|
|
92
94
|
}>;
|
|
93
95
|
Playhead: typeof Playhead;
|
package/dist/react/timeline.js
CHANGED
|
@@ -169,7 +169,7 @@ export const Clip = memo(function Clip(props) {
|
|
|
169
169
|
/** A transition: the stretch where two clips overlap. */
|
|
170
170
|
export const Transition = memo(function Transition(props) {
|
|
171
171
|
const t = props.transition;
|
|
172
|
-
return (_jsx("div", { "data-tl-transition": "", "data-style": t.style, className: props.className, style: { position: "absolute", top: 0, bottom: 0, left: px("--t-start"), width: px("--t-frames"), contain: "strict", "--t-start": t.start, "--t-frames": t.end - t.start, pointerEvents: "none", ...props.style }, children: props.children }));
|
|
172
|
+
return (_jsx("div", { "data-tl-transition": "", "data-style": t.style, title: props.title, className: props.className, style: { position: "absolute", top: 0, bottom: 0, left: px("--t-start"), width: px("--t-frames"), contain: "strict", "--t-start": t.start, "--t-frames": t.end - t.start, pointerEvents: "none", ...props.style }, children: props.children }));
|
|
173
173
|
});
|
|
174
174
|
/** The playhead. It moves without React: its frame is a CSS variable on itself, set as reports
|
|
175
175
|
* come in. When it moves out of view (playing on, a jump) the view follows it (`follow`, on by
|
package/dist/timeline/model.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface TimelineClip {
|
|
|
15
15
|
export interface TimelineTransition {
|
|
16
16
|
readonly row: string;
|
|
17
17
|
readonly style: TransitionDoc["style"];
|
|
18
|
+
/** Everything film.json says about it: a dissolve's noise and edge, a wipe's direction. */
|
|
19
|
+
readonly doc: TransitionDoc;
|
|
18
20
|
readonly from: string;
|
|
19
21
|
readonly to: string;
|
|
20
22
|
/** Film frames [start, end). */
|
package/dist/timeline/model.js
CHANGED
|
@@ -31,7 +31,7 @@ export function timelineModel(doc) {
|
|
|
31
31
|
const transitions = track.transitions.map((t) => {
|
|
32
32
|
edges.add(t.start);
|
|
33
33
|
edges.add(t.end);
|
|
34
|
-
return { row: track.id, style: t.style, from: t.from, to: t.to, start: t.start, end: t.end };
|
|
34
|
+
return { row: track.id, style: t.style, doc: t, from: t.from, to: t.to, start: t.start, end: t.end };
|
|
35
35
|
});
|
|
36
36
|
return { id: track.id, kind: track.kind, clips: rowClips, transitions };
|
|
37
37
|
});
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tongue-core/ui",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.3",
|
|
4
4
|
"description": "The pieces of a film's interface: the player, the timeline's state and geometry, and unstyled React primitives. Build your own studio from them.",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"license": "
|
|
6
|
+
"license": "MIT",
|
|
7
7
|
"author": "Backpine",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
@@ -36,9 +36,9 @@
|
|
|
36
36
|
"README.md"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@tongue-core/engine": "0.1.0-rc.
|
|
40
|
-
"@tongue-core/film": "0.1.0-rc.
|
|
41
|
-
"@tongue-core/project": "0.1.0-rc.
|
|
39
|
+
"@tongue-core/engine": "0.1.0-rc.3",
|
|
40
|
+
"@tongue-core/film": "0.1.0-rc.3",
|
|
41
|
+
"@tongue-core/project": "0.1.0-rc.3"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@effect/atom-react": "^4.0.6",
|