@serimo/core 0.0.0-stage → 0.1.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/LICENSE.txt ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright (c) Beni Arisandi
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,296 @@
1
- # Temporary Holding Version
1
+ # Serimo Core (`@serimo/core`)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Primitives for defining frame-based motion compositions, seeking GSAP timelines, and mapping word-level captions to frames.
4
+
5
+ ## Features
6
+
7
+ - Validate composition dimensions, frame counts, clip IDs, timing, layers, and props.
8
+ - Resolve active clips and clip-local time for any frame, in layer order.
9
+ - Register paused timelines and seek all mounted clips to a deterministic frame.
10
+ - Create and clean up scoped GSAP timelines with a React hook.
11
+ - Validate word-level caption cues and map millisecond timestamps to frame intervals.
12
+
13
+ ## Installation
14
+
15
+ The public package identity is `@serimo/core`, initially `0.1.0`. It is available as a local tarball and has **not been published to npm**. From the [repository root](../../README.md), use Node.js 22.16.0 or newer and npm >=11.21.1:
16
+
17
+ ```bash
18
+ npm install
19
+ npm run build --workspace=@serimo/core
20
+ ```
21
+
22
+ Import only the public subpaths listed below; there is no root barrel export. React `19.3.1` and GSAP `3.15.0` are external peer dependencies supplied by the consumer.
23
+
24
+ For an independent local consumer, build Core and run `npm pack --workspace=@serimo/core --ignore-scripts --pack-destination <absolute-existing-directory>` from the repository root, replacing the destination with an existing directory outside the checkout. Install `serimo-core-0.1.0.tgz` explicitly in the consumer project alongside those React and GSAP versions. The archive contains built JavaScript, declarations, README, and license. Core follows independent Changesets versioning.
25
+
26
+ The [local registry distribution guide](../../docs/guides/registry-distribution.md) shows the complete archive → npm dependency installation → editable component workflow. CLI dependency checks accept an explicitly installed local `.tgz` only when package declarations, lock metadata, and installed identity/version agree. Runtime dependencies remain external so the consumer supplies React/GSAP rather than loading a second bundled runtime.
27
+
28
+ For previous private-runtime projects, follow the [explicit migration steps](../cli/README.md#migrate-private-runtime-consumers). Source components `0.2.0` use `@serimo/core@^0.1.0`; older immutable snapshots retain their original runtime identity.
29
+
30
+ ## Usage
31
+
32
+ ```ts
33
+ import { getFrameState } from "@serimo/core/clock"
34
+ import { validateComposition } from "@serimo/core/composition"
35
+
36
+ const composition = validateComposition({
37
+ id: "demo",
38
+ width: 640,
39
+ height: 360,
40
+ fps: 30,
41
+ durationInFrames: 150,
42
+ clips: [
43
+ {
44
+ id: "title",
45
+ component: "title-scale",
46
+ startFrame: 45,
47
+ durationInFrames: 60,
48
+ layer: 1,
49
+ props: { title: "Serimo" }
50
+ }
51
+ ]
52
+ })
53
+
54
+ const state = getFrameState(composition, 45)
55
+ console.log(state.activeClips[0]?.localFrame) // 0
56
+ ```
57
+
58
+ A clip is active from `startFrame` (inclusive) to `startFrame + durationInFrames` (exclusive). `getFrameState` rejects frames outside the composition.
59
+
60
+ ## API Reference
61
+
62
+ Core exposes **five package subpaths**; there is no root `@serimo/core` import. Examples below use validated compositions and refer to frames indexed from zero.
63
+
64
+ ### `@serimo/core/composition`
65
+
66
+ Defines and validates the frame-based composition and clip data model.
67
+
68
+ #### `validateComposition(input)`
69
+
70
+ Checks a composition's structure, clip schedule, and frame bounds.
71
+
72
+ ```ts
73
+ import { validateComposition } from "@serimo/core/composition"
74
+
75
+ const composition = validateComposition({
76
+ id: "demo",
77
+ width: 640,
78
+ height: 360,
79
+ fps: 30,
80
+ durationInFrames: 150,
81
+ clips: [
82
+ {
83
+ id: "title",
84
+ component: "title-scale",
85
+ startFrame: 0,
86
+ durationInFrames: 90,
87
+ layer: 0,
88
+ props: { title: "Hello" }
89
+ }
90
+ ]
91
+ })
92
+ ```
93
+
94
+ | Parameter | Type | Description |
95
+ | :---------------------------------------- | :------------------------ | :--------------------------------------------------------------------------------------------------------------------------------- |
96
+ | `input` | `unknown` | **Required.** Composition with non-empty `id`, positive integer `width`, `height`, `fps`, `durationInFrames`, and a `clips` array. |
97
+ | `clips[].id` / `component` | `string` | **Required.** Non-empty clip ID (unique within the composition) and component name. |
98
+ | `clips[].startFrame` / `durationInFrames` | `number` | **Required.** Safe integers; start is ≥ 0, duration is ≥ 1, and the clip must fit within the composition. |
99
+ | `clips[].layer` | `number` | **Required.** Safe integer controlling render order. |
100
+ | `clips[].props` | `Record<string, unknown>` | **Required.** Plain object of component props. |
101
+
102
+ Returns `MotionComposition`; throws on invalid input. The returned composition, clips, and immediate `props` objects are copied, but **nested prop values are not cloned or schema-validated**. Exported types: `MotionComposition` and `MotionClip`.
103
+
104
+ ### `@serimo/core/clock`
105
+
106
+ Resolves active clips and their local timing at each composition frame.
107
+
108
+ #### `getFrameState(composition, globalFrame)`
109
+
110
+ Calculates the frame time and ordered active clips for a global frame.
111
+
112
+ ```ts
113
+ import { getFrameState } from "@serimo/core/clock"
114
+
115
+ const state = getFrameState(composition, 30)
116
+ console.log(state.globalSeconds, state.activeClips[0]?.localFrame)
117
+ ```
118
+
119
+ | Parameter | Type | Description |
120
+ | :------------ | :------------------ | :------------------------------------------------------------- |
121
+ | `composition` | `MotionComposition` | **Required.** Validated composition and clip schedule. |
122
+ | `globalFrame` | `number` | **Required.** Safe integer from `0` to `durationInFrames - 1`. |
123
+
124
+ Returns `FrameState` with `globalFrame`, `globalSeconds`, and `activeClips` (each an `ActiveClip`) (`clip`, `declarationIndex`, `localFrame`, `localSeconds`). Active clips are sorted by ascending layer, then declaration order. Clip end frames are **exclusive**; invalid frame indices throw `RangeError`.
125
+
126
+ ### `@serimo/core/timeline-registry`
127
+
128
+ Coordinates clip timeline registration and deterministic frame seeking.
129
+
130
+ #### `createTimelineRegistry(composition)`
131
+
132
+ Creates a controller for registering and seeking the timelines of a composition.
133
+
134
+ ```ts
135
+ import { createTimelineRegistry } from "@serimo/core/timeline-registry"
136
+
137
+ const registry = createTimelineRegistry(composition)
138
+ const unregister = registry.register("title", {
139
+ seek(localSeconds) {
140
+ console.log(localSeconds)
141
+ },
142
+ setActive(active) {
143
+ console.log(active)
144
+ }
145
+ })
146
+ await registry.whenReady()
147
+ registry.seek(30)
148
+ unregister()
149
+ ```
150
+
151
+ | Parameter / member | Type | Description |
152
+ | :-------------------------- | :----------------------------------------- | :---------------------------------------------------------------------------------------------------- |
153
+ | `composition` | `MotionComposition` | **Required.** Clip schedule captured when the registry is created. |
154
+ | `register(clipId, handle)` | `(string, TimelineHandle) => () => void` | Register a **known, unique** clip; returns a cleanup function. |
155
+ | `handle.seek(localSeconds)` | `(number) => void` | Advance a registered clip to its local time in seconds. |
156
+ | `handle.setActive(active)` | `(boolean) => void` | Show/hide a clip when entering or leaving its range. |
157
+ | `whenReady(options?)` | `(TimelineReadyOptions?) => Promise<void>` | Resolve after **all** scheduled clips are registered; optionally abort waiting with `options.signal`. |
158
+ | `seek(globalFrame)` | `(number) => FrameState` | Seek every registered handle for a valid composition frame. |
159
+
160
+ `seek()` requires a handle for **every** clip, including inactive ones. Duplicate or unknown registrations fail. `whenReady()` does not impose a timeout; supply `{ signal }` if mounting could stall. Exported types: `TimelineHandle` and `TimelineReadyOptions`.
161
+
162
+ ### `@serimo/core/use-motion-timeline`
163
+
164
+ Connects React components and their GSAP timelines to the composition registry.
165
+
166
+ #### `useMotionTimeline({ clipId, rootRef, registry, build })`
167
+
168
+ Builds and registers a paused GSAP timeline tied to a React element.
169
+
170
+ ```tsx
171
+ import type { createTimelineRegistry } from "@serimo/core/timeline-registry"
172
+ import { useMotionTimeline } from "@serimo/core/use-motion-timeline"
173
+ import { useRef } from "react"
174
+
175
+ function TitleClip({
176
+ registry
177
+ }: {
178
+ registry: ReturnType<typeof createTimelineRegistry>
179
+ }) {
180
+ const rootRef = useRef<HTMLDivElement>(null)
181
+ useMotionTimeline({
182
+ clipId: "title",
183
+ rootRef,
184
+ registry,
185
+ build: (timeline, root) => {
186
+ timeline.fromTo(root, { opacity: 0 }, { opacity: 1, duration: 0.5 })
187
+ }
188
+ })
189
+ return <div ref={rootRef}>Hello</div>
190
+ }
191
+ ```
192
+
193
+ | Parameter | Type | Description |
194
+ | :--------- | :------------------------------------------------ | :--------------------------------------------------------------------- |
195
+ | `clipId` | `string` | **Required.** Clip ID declared in the composition. |
196
+ | `rootRef` | `RefObject<T \| null>` | **Required.** Ref to an existing DOM element at layout-effect time. |
197
+ | `registry` | Registry with `register` | **Required.** Timeline registry for this composition. |
198
+ | `build` | `(timeline: gsap.core.Timeline, root: T) => void` | **Required.** Build paused GSAP animations scoped to the root element. |
199
+
200
+ The hook takes a single `UseMotionTimelineOptions<T>` object with all four properties required. It runs in a React layout effect, registers a paused timeline, toggles root visibility through the handle, and reverts GSAP state on cleanup. A missing root throws an error. Keep the `build` callback stable when appropriate to avoid unnecessary re-registration.
201
+
202
+ ### `@serimo/core/caption`
203
+
204
+ Validates timed caption words and converts their timing into frame cues.
205
+
206
+ #### `validateCaptionSegments(input)`
207
+
208
+ Validates caption segments and their ordered, non-overlapping word timings.
209
+
210
+ ```ts
211
+ import { validateCaptionSegments } from "@serimo/core/caption"
212
+
213
+ const segments = validateCaptionSegments([
214
+ { id: "line-1", words: [{ text: "Hello", startMs: 0, endMs: 500 }] }
215
+ ])
216
+ ```
217
+
218
+ | Parameter | Type | Description |
219
+ | :-------------------------- | :-------- | :----------------------------------------------------------------------------------------------------- |
220
+ | `input` | `unknown` | **Required.** Array of unique `CaptionSegment` IDs, each containing a non-empty `words` array. |
221
+ | `words[].text` | `string` | **Required.** Non-empty text. |
222
+ | `words[].startMs` / `endMs` | `number` | **Required.** Safe integer milliseconds, `0 <= startMs < endMs`, globally non-overlapping and ordered. |
223
+
224
+ Returns the **same input array reference**, typed as `CaptionSegment[]`; it is not a snapshot. Exported types include `CaptionSegment` and `CaptionWord`.
225
+
226
+ #### `mapCaptionWordsToFrames(input, options)`
227
+
228
+ Converts millisecond-based caption words into frame ranges at a specified FPS.
229
+
230
+ ```ts
231
+ import {
232
+ mapCaptionWordsToFrames,
233
+ validateCaptionSegments
234
+ } from "@serimo/core/caption"
235
+
236
+ const segments = validateCaptionSegments([
237
+ { id: "line-1", words: [{ text: "Hello", startMs: 0, endMs: 500 }] }
238
+ ])
239
+ const cues = mapCaptionWordsToFrames(segments, {
240
+ fps: 30,
241
+ durationInFrames: 150
242
+ })
243
+ ```
244
+
245
+ | Parameter | Type | Description |
246
+ | :------------------------- | :-------- | :------------------------------------------------------------------------------ |
247
+ | `input` | `unknown` | **Required.** Word segments accepted by `validateCaptionSegments`. |
248
+ | `options.fps` | `number` | **Required.** Positive safe integer frames per second. |
249
+ | `options.durationInFrames` | `number` | **Required.** Positive safe integer clip duration; cues may not extend past it. |
250
+
251
+ `options` is a required `CaptionFrameOptions` object. Returns `CaptionFrameCue[]` (`segmentId`, `wordIndex`, `text`, `startFrame`, `endFrame`) using `Math.round(timeMs * fps / 1000)`. End frames are exclusive; overlapping, zero-frame, or out-of-bounds cues fail.
252
+
253
+ #### `getActiveCaptionWord(cues, localFrame)`
254
+
255
+ Finds the caption word active at a given local frame, if any.
256
+
257
+ ```ts
258
+ import {
259
+ getActiveCaptionWord,
260
+ mapCaptionWordsToFrames
261
+ } from "@serimo/core/caption"
262
+
263
+ const cues = mapCaptionWordsToFrames(
264
+ [{ id: "line-1", words: [{ text: "Hello", startMs: 0, endMs: 500 }] }],
265
+ { fps: 30, durationInFrames: 150 }
266
+ )
267
+ const active = getActiveCaptionWord(cues, 10)
268
+ console.log(active?.text) // "Hello"
269
+ ```
270
+
271
+ | Parameter | Type | Description |
272
+ | :----------- | :--------------------------- | :-------------------------------------------------------- |
273
+ | `cues` | `readonly CaptionFrameCue[]` | **Required.** Converted frame cues. |
274
+ | `localFrame` | `number` | **Required.** Nonnegative safe integer local frame index. |
275
+
276
+ Returns the first matching cue or `undefined`. This function does not parse SRT or VTT.
277
+
278
+ Validate untrusted JSON and component-specific props separately at your application's input boundary.
279
+
280
+ ## Related
281
+
282
+ - [Motion UI](../motion-ui/README.md) — React components consuming the timeline registry.
283
+ - [Renderer](../renderer/README.md) — frame capture from a composition bridge.
284
+ - [Core implementation](src/) and [tests](tests/).
285
+
286
+ Run package checks from the repository root:
287
+
288
+ ```bash
289
+ npm run typecheck --workspace=@serimo/core
290
+ npm run lint --workspace=@serimo/core
291
+ npm run test --workspace=@serimo/core
292
+ ```
293
+
294
+ ## License
295
+
296
+ Licensed under [Apache License 2.0](LICENSE.txt).
@@ -0,0 +1,24 @@
1
+ export interface CaptionWord {
2
+ text: string;
3
+ startMs: number;
4
+ endMs: number;
5
+ }
6
+ export interface CaptionSegment {
7
+ id: string;
8
+ words: CaptionWord[];
9
+ }
10
+ export interface CaptionFrameCue {
11
+ segmentId: string;
12
+ wordIndex: number;
13
+ text: string;
14
+ startFrame: number;
15
+ endFrame: number;
16
+ }
17
+ export interface CaptionFrameOptions {
18
+ fps: number;
19
+ durationInFrames: number;
20
+ }
21
+ export declare function validateCaptionSegments(input: unknown): CaptionSegment[];
22
+ export declare function mapCaptionWordsToFrames(input: unknown, { fps, durationInFrames }: CaptionFrameOptions): CaptionFrameCue[];
23
+ export declare function getActiveCaptionWord(cues: readonly CaptionFrameCue[], localFrame: number): CaptionFrameCue | undefined;
24
+ //# sourceMappingURL=caption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"caption.d.ts","sourceRoot":"","sources":["../src/caption.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,WAAW,EAAE,CAAA;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB,EAAE,MAAM,CAAA;CACzB;AAUD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,EAAE,CA2CxE;AAYD,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,OAAO,EACd,EAAE,GAAG,EAAE,gBAAgB,EAAE,EAAE,mBAAmB,GAC7C,eAAe,EAAE,CAwCnB;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,SAAS,eAAe,EAAE,EAChC,UAAU,EAAE,MAAM,GACjB,eAAe,GAAG,SAAS,CAQ7B"}
@@ -0,0 +1,64 @@
1
+ //#region src/caption.ts
2
+ function isRecord(value) {
3
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
4
+ const prototype = Object.getPrototypeOf(value);
5
+ return prototype === Object.prototype || prototype === null;
6
+ }
7
+ function validateCaptionSegments(input) {
8
+ if (!Array.isArray(input)) throw new TypeError("segments must be an array");
9
+ const ids = /* @__PURE__ */ new Set();
10
+ let previousEndMs = 0;
11
+ for (const [segmentIndex, segment] of input.entries()) {
12
+ const segmentPath = `segments[${segmentIndex}]`;
13
+ if (!isRecord(segment)) throw new TypeError(`${segmentPath} must be a record`);
14
+ if (typeof segment.id !== "string" || segment.id.trim().length === 0) throw new TypeError(`${segmentPath}.id must be a non-empty string`);
15
+ if (ids.has(segment.id)) throw new RangeError(`${segmentPath}.id is a duplicate`);
16
+ ids.add(segment.id);
17
+ if (!Array.isArray(segment.words) || segment.words.length === 0) throw new TypeError(`${segmentPath}.words must be a non-empty array`);
18
+ for (const [wordIndex, word] of segment.words.entries()) {
19
+ const wordPath = `${segmentPath}.words[${wordIndex}]`;
20
+ if (!isRecord(word)) throw new TypeError(`${wordPath} must be a record`);
21
+ if (typeof word.text !== "string" || word.text.trim().length === 0) throw new TypeError(`${wordPath}.text must be a non-empty string`);
22
+ if (!Number.isSafeInteger(word.startMs) || word.startMs < 0) throw new RangeError(`${wordPath}.startMs must be a safe integer >= 0`);
23
+ if (!Number.isSafeInteger(word.endMs) || word.endMs <= word.startMs) throw new RangeError(`${wordPath}.endMs must be after startMs`);
24
+ if (word.startMs < previousEndMs) throw new RangeError(`${wordPath}.startMs overlaps a previous word`);
25
+ previousEndMs = word.endMs;
26
+ }
27
+ }
28
+ return input;
29
+ }
30
+ function timestampToFrame(timeMs, fps, path) {
31
+ const product = timeMs * fps;
32
+ if (!Number.isSafeInteger(product)) throw new RangeError(`${path} cannot be converted without losing integer precision`);
33
+ return Math.round(product / 1e3);
34
+ }
35
+ function mapCaptionWordsToFrames(input, { fps, durationInFrames }) {
36
+ const segments = validateCaptionSegments(input);
37
+ if (!Number.isSafeInteger(fps) || fps < 1) throw new RangeError("fps must be a positive safe integer");
38
+ if (!Number.isSafeInteger(durationInFrames) || durationInFrames < 1) throw new RangeError("durationInFrames must be a positive safe integer");
39
+ const cues = [];
40
+ let previousEndFrame = 0;
41
+ for (const [segmentIndex, segment] of segments.entries()) for (const [wordIndex, word] of segment.words.entries()) {
42
+ const wordPath = `segments[${segmentIndex}].words[${wordIndex}]`;
43
+ const startFrame = timestampToFrame(word.startMs, fps, `${wordPath}.startMs`);
44
+ const endFrame = timestampToFrame(word.endMs, fps, `${wordPath}.endMs`);
45
+ if (startFrame >= endFrame) throw new RangeError(`${wordPath} has no visible frame after rounding`);
46
+ if (startFrame < previousEndFrame) throw new RangeError(`${wordPath} overlaps a previous frame cue`);
47
+ if (endFrame > durationInFrames) throw new RangeError(`${wordPath} exceeds clip duration`);
48
+ cues.push({
49
+ segmentId: segment.id,
50
+ wordIndex,
51
+ text: word.text,
52
+ startFrame,
53
+ endFrame
54
+ });
55
+ previousEndFrame = endFrame;
56
+ }
57
+ return cues;
58
+ }
59
+ function getActiveCaptionWord(cues, localFrame) {
60
+ if (!Number.isSafeInteger(localFrame) || localFrame < 0) throw new RangeError("localFrame must be a safe integer >= 0");
61
+ return cues.find((cue) => cue.startFrame <= localFrame && localFrame < cue.endFrame);
62
+ }
63
+ //#endregion
64
+ export { getActiveCaptionWord, mapCaptionWordsToFrames, validateCaptionSegments };
@@ -0,0 +1,14 @@
1
+ import type { MotionClip, MotionComposition } from './composition.js';
2
+ export interface ActiveClip {
3
+ clip: MotionClip;
4
+ declarationIndex: number;
5
+ localFrame: number;
6
+ localSeconds: number;
7
+ }
8
+ export interface FrameState {
9
+ globalFrame: number;
10
+ globalSeconds: number;
11
+ activeClips: ActiveClip[];
12
+ }
13
+ export declare function getFrameState(composition: MotionComposition, globalFrame: number): FrameState;
14
+ //# sourceMappingURL=clock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../src/clock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAErE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,UAAU,EAAE,CAAA;CAC1B;AAED,wBAAgB,aAAa,CAC3B,WAAW,EAAE,iBAAiB,EAC9B,WAAW,EAAE,MAAM,GAClB,UAAU,CAwCZ"}
package/dist/clock.js ADDED
@@ -0,0 +1,25 @@
1
+ //#region src/clock.ts
2
+ function getFrameState(composition, globalFrame) {
3
+ if (!Number.isSafeInteger(globalFrame) || globalFrame < 0 || globalFrame >= composition.durationInFrames) throw new RangeError(`Frame outside 0..${composition.durationInFrames - 1}: ${globalFrame}`);
4
+ const activeClips = composition.clips.flatMap((clip, declarationIndex) => {
5
+ if (globalFrame < clip.startFrame || globalFrame >= clip.startFrame + clip.durationInFrames) return [];
6
+ const localFrame = globalFrame - clip.startFrame;
7
+ return [{
8
+ clip,
9
+ declarationIndex,
10
+ localFrame,
11
+ localSeconds: localFrame / composition.fps
12
+ }];
13
+ }).sort((left, right) => {
14
+ if (left.clip.layer < right.clip.layer) return -1;
15
+ if (left.clip.layer > right.clip.layer) return 1;
16
+ return left.declarationIndex - right.declarationIndex;
17
+ });
18
+ return {
19
+ globalFrame,
20
+ globalSeconds: globalFrame / composition.fps,
21
+ activeClips
22
+ };
23
+ }
24
+ //#endregion
25
+ export { getFrameState };
@@ -0,0 +1,18 @@
1
+ export interface MotionClip {
2
+ id: string;
3
+ component: string;
4
+ startFrame: number;
5
+ durationInFrames: number;
6
+ layer: number;
7
+ props: Record<string, unknown>;
8
+ }
9
+ export interface MotionComposition {
10
+ id: string;
11
+ width: number;
12
+ height: number;
13
+ fps: number;
14
+ durationInFrames: number;
15
+ clips: MotionClip[];
16
+ }
17
+ export declare function validateComposition(input: unknown): MotionComposition;
18
+ //# sourceMappingURL=composition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,gBAAgB,EAAE,MAAM,CAAA;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,gBAAgB,EAAE,MAAM,CAAA;IACxB,KAAK,EAAE,UAAU,EAAE,CAAA;CACpB;AA0BD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CAkDrE"}
@@ -0,0 +1,55 @@
1
+ //#region src/composition.ts
2
+ function isRecord(value) {
3
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
4
+ const prototype = Object.getPrototypeOf(value);
5
+ return prototype === Object.prototype || prototype === null;
6
+ }
7
+ function assertId(value, path) {
8
+ if (typeof value !== "string" || value.trim().length === 0) throw new TypeError(`${path} must be a non-empty string`);
9
+ }
10
+ function assertInteger(value, path, minimum) {
11
+ if (!Number.isSafeInteger(value) || value < minimum) throw new RangeError(`${path} must be a safe integer >= ${minimum}`);
12
+ }
13
+ function validateComposition(input) {
14
+ if (!isRecord(input)) throw new TypeError("composition must be a record");
15
+ assertId(input.id, "composition.id");
16
+ assertInteger(input.width, "composition.width", 1);
17
+ assertInteger(input.height, "composition.height", 1);
18
+ assertInteger(input.fps, "composition.fps", 1);
19
+ assertInteger(input.durationInFrames, "composition.durationInFrames", 1);
20
+ if (!Array.isArray(input.clips)) throw new TypeError("composition.clips must be an array");
21
+ const ids = /* @__PURE__ */ new Set();
22
+ const clips = [];
23
+ for (const [index, value] of input.clips.entries()) {
24
+ const path = `clips[${index}]`;
25
+ if (!isRecord(value)) throw new TypeError(`${path} must be a record`);
26
+ assertId(value.id, `${path}.id`);
27
+ if (ids.has(value.id)) throw new RangeError(`clip ${value.id} has a duplicate id`);
28
+ ids.add(value.id);
29
+ assertId(value.component, `${path}.component`);
30
+ assertInteger(value.startFrame, `${path}.startFrame`, 0);
31
+ assertInteger(value.durationInFrames, `${path}.durationInFrames`, 1);
32
+ assertInteger(value.layer, `${path}.layer`, Number.MIN_SAFE_INTEGER);
33
+ if (!isRecord(value.props)) throw new TypeError(`${path}.props must be a record`);
34
+ const end = value.startFrame + value.durationInFrames;
35
+ if (!Number.isSafeInteger(end) || end > input.durationInFrames) throw new RangeError(`clip ${value.id} durationInFrames overflows composition`);
36
+ clips.push({
37
+ id: value.id,
38
+ component: value.component,
39
+ startFrame: value.startFrame,
40
+ durationInFrames: value.durationInFrames,
41
+ layer: value.layer,
42
+ props: { ...value.props }
43
+ });
44
+ }
45
+ return {
46
+ id: input.id,
47
+ width: input.width,
48
+ height: input.height,
49
+ fps: input.fps,
50
+ durationInFrames: input.durationInFrames,
51
+ clips
52
+ };
53
+ }
54
+ //#endregion
55
+ export { validateComposition };
@@ -0,0 +1,14 @@
1
+ import { type MotionComposition } from './composition.js';
2
+ export interface TimelineHandle {
3
+ seek(localSeconds: number): void;
4
+ setActive(active: boolean): void;
5
+ }
6
+ export interface TimelineReadyOptions {
7
+ signal?: AbortSignal;
8
+ }
9
+ export declare function createTimelineRegistry(composition: MotionComposition): {
10
+ register(clipId: string, handle: TimelineHandle): () => void;
11
+ whenReady({ signal }?: TimelineReadyOptions): Promise<void>;
12
+ seek(globalFrame: number): import("./clock.js").FrameState;
13
+ };
14
+ //# sourceMappingURL=timeline-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeline-registry.d.ts","sourceRoot":"","sources":["../src/timeline-registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,iBAAiB,EAAuB,MAAM,kBAAkB,CAAA;AAE9E,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAChC,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAA;CACjC;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,CAAC,EAAE,WAAW,CAAA;CACrB;AAED,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,iBAAiB;IA2BjE,QAAQ,SAAS,MAAM,UAAU,cAAc,GAAG,MAAM,IAAI;IAW5D,SAAS,cAAa,oBAAoB,GAAQ,OAAO,CAAC,IAAI,CAAC;IAkB/D,IAAI,cAAc,MAAM;EAmB3B"}
@@ -0,0 +1,60 @@
1
+ import { getFrameState } from "./clock.js";
2
+ import { validateComposition } from "./composition.js";
3
+ //#region src/timeline-registry.ts
4
+ function createTimelineRegistry(composition) {
5
+ const schedule = validateComposition(composition);
6
+ const clipIds = new Set(schedule.clips.map((clip) => clip.id));
7
+ const handles = /* @__PURE__ */ new Map();
8
+ const readyWaiters = /* @__PURE__ */ new Set();
9
+ const abortReason = (signal) => signal.reason ?? new DOMException("Timeline readiness aborted", "AbortError");
10
+ const isReady = () => handles.size === clipIds.size;
11
+ const notifyReady = () => {
12
+ if (!isReady()) return;
13
+ for (const waiter of readyWaiters) {
14
+ readyWaiters.delete(waiter);
15
+ if (waiter.signal && waiter.onAbort) waiter.signal.removeEventListener("abort", waiter.onAbort);
16
+ waiter.resolve();
17
+ }
18
+ };
19
+ return {
20
+ register(clipId, handle) {
21
+ if (!clipIds.has(clipId)) throw new RangeError(`Unknown clip: ${clipId}`);
22
+ if (handles.has(clipId)) throw new RangeError(`Timeline already registered for clip: ${clipId}`);
23
+ handles.set(clipId, handle);
24
+ notifyReady();
25
+ return () => {
26
+ if (handles.get(clipId) === handle) handles.delete(clipId);
27
+ };
28
+ },
29
+ whenReady({ signal } = {}) {
30
+ if (signal?.aborted) return Promise.reject(abortReason(signal));
31
+ if (isReady()) return Promise.resolve();
32
+ return new Promise((resolve, reject) => {
33
+ const waiter = {
34
+ resolve,
35
+ signal,
36
+ onAbort: () => {
37
+ readyWaiters.delete(waiter);
38
+ if (signal) reject(abortReason(signal));
39
+ }
40
+ };
41
+ readyWaiters.add(waiter);
42
+ signal?.addEventListener("abort", waiter.onAbort, { once: true });
43
+ });
44
+ },
45
+ seek(globalFrame) {
46
+ const state = getFrameState(schedule, globalFrame);
47
+ for (const clip of schedule.clips) if (!handles.has(clip.id)) throw new Error(`Timeline missing for clip: ${clip.id}`);
48
+ const activeIds = new Set(state.activeClips.map(({ clip }) => clip.id));
49
+ for (const clip of schedule.clips) if (!activeIds.has(clip.id)) handles.get(clip.id).setActive(false);
50
+ for (const { clip, localSeconds } of state.activeClips) {
51
+ const handle = handles.get(clip.id);
52
+ handle.setActive(true);
53
+ handle.seek(localSeconds);
54
+ }
55
+ return state;
56
+ }
57
+ };
58
+ }
59
+ //#endregion
60
+ export { createTimelineRegistry };
@@ -0,0 +1,13 @@
1
+ import { gsap } from 'gsap';
2
+ import { type RefObject } from 'react';
3
+ import type { createTimelineRegistry } from './timeline-registry.js';
4
+ type TimelineRegistry = Pick<ReturnType<typeof createTimelineRegistry>, 'register'>;
5
+ export interface UseMotionTimelineOptions<T extends HTMLElement> {
6
+ clipId: string;
7
+ rootRef: RefObject<T | null>;
8
+ registry: TimelineRegistry;
9
+ build: (timeline: ReturnType<typeof gsap.timeline>, root: T) => void;
10
+ }
11
+ export declare function useMotionTimeline<T extends HTMLElement>({ clipId, rootRef, registry, build }: UseMotionTimelineOptions<T>): void;
12
+ export {};
13
+ //# sourceMappingURL=use-motion-timeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-motion-timeline.d.ts","sourceRoot":"","sources":["../src/use-motion-timeline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,KAAK,SAAS,EAAmB,MAAM,OAAO,CAAA;AAEvD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAEpE,KAAK,gBAAgB,GAAG,IAAI,CAC1B,UAAU,CAAC,OAAO,sBAAsB,CAAC,EACzC,UAAU,CACX,CAAA;AAED,MAAM,WAAW,wBAAwB,CAAC,CAAC,SAAS,WAAW;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,SAAS,CAAC,CAAC,GAAG,IAAI,CAAC,CAAA;IAC5B,QAAQ,EAAE,gBAAgB,CAAA;IAC1B,KAAK,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC,KAAK,IAAI,CAAA;CACrE;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,WAAW,EAAE,EACvD,MAAM,EACN,OAAO,EACP,QAAQ,EACR,KAAK,EACN,EAAE,wBAAwB,CAAC,CAAC,CAAC,GAAG,IAAI,CAqCpC"}
@@ -0,0 +1,46 @@
1
+ import { gsap } from "gsap";
2
+ import { useLayoutEffect } from "react";
3
+ //#region src/use-motion-timeline.ts
4
+ function useMotionTimeline({ clipId, rootRef, registry, build }) {
5
+ useLayoutEffect(() => {
6
+ const root = rootRef.current;
7
+ if (!root) throw new Error(`Timeline root missing for clip: ${clipId}`);
8
+ const previousVisibility = root.style.visibility;
9
+ let timeline;
10
+ let context;
11
+ try {
12
+ root.style.visibility = "hidden";
13
+ context = gsap.context(() => {}, root);
14
+ context.add(() => {
15
+ timeline = gsap.timeline({ paused: true });
16
+ build(timeline, root);
17
+ });
18
+ const scopedContext = context;
19
+ const unregister = registry.register(clipId, {
20
+ seek: (localSeconds) => timeline.seek(localSeconds, true),
21
+ setActive: (active) => {
22
+ root.style.visibility = active ? "visible" : "hidden";
23
+ }
24
+ });
25
+ return () => {
26
+ unregister();
27
+ scopedContext.revert();
28
+ root.style.visibility = previousVisibility;
29
+ };
30
+ } catch (error) {
31
+ try {
32
+ context?.revert();
33
+ } finally {
34
+ root.style.visibility = previousVisibility;
35
+ }
36
+ throw error;
37
+ }
38
+ }, [
39
+ clipId,
40
+ rootRef,
41
+ registry,
42
+ build
43
+ ]);
44
+ }
45
+ //#endregion
46
+ export { useMotionTimeline };
package/package.json CHANGED
@@ -1,6 +1,64 @@
1
1
  {
2
2
  "name": "@serimo/core",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "files": [
5
+ "dist",
6
+ "LICENSE.txt"
7
+ ],
8
+ "devDependencies": {
9
+ "@repo/eslint-config": "0.0.0",
10
+ "@repo/typescript-config": "0.0.0",
11
+ "@types/node": "26.6.5",
12
+ "@types/react": "^19",
13
+ "@types/react-dom": "^19",
14
+ "happy-dom": "^21.0.3",
15
+ "react-dom": "19.3.1",
16
+ "rolldown": "1.2.14",
17
+ "vitest": "5.0.5",
18
+ "react": "19.3.1",
19
+ "gsap": "3.15.0"
20
+ },
21
+ "exports": {
22
+ "./caption": {
23
+ "types": "./dist/caption.d.ts",
24
+ "default": "./dist/caption.js"
25
+ },
26
+ "./clock": {
27
+ "types": "./dist/clock.d.ts",
28
+ "default": "./dist/clock.js"
29
+ },
30
+ "./composition": {
31
+ "types": "./dist/composition.d.ts",
32
+ "default": "./dist/composition.js"
33
+ },
34
+ "./timeline-registry": {
35
+ "types": "./dist/timeline-registry.d.ts",
36
+ "default": "./dist/timeline-registry.js"
37
+ },
38
+ "./use-motion-timeline": {
39
+ "types": "./dist/use-motion-timeline.d.ts",
40
+ "default": "./dist/use-motion-timeline.js"
41
+ }
42
+ },
43
+ "license": "Apache-2.0",
44
+ "scripts": {
45
+ "build": "rolldown -c && tsc -p tsconfig.build.json",
46
+ "lint": "eslint src tests",
47
+ "test": "vitest run tests",
48
+ "typecheck": "tsc --noEmit -p tsconfig.json"
49
+ },
50
+ "type": "module",
51
+ "description": "Frame-based composition, clock, captions and motion timeline primitives",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "https://github.com/paben-id/serimo.git",
55
+ "directory": "packages/core"
56
+ },
57
+ "engines": {
58
+ "node": ">=22.16.0"
59
+ },
60
+ "peerDependencies": {
61
+ "gsap": "3.15.0",
62
+ "react": "19.3.1"
63
+ }
64
+ }