@motionscript/sdk 0.0.0-stage → 0.1.0-alpha.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/CHANGELOG.md +51 -0
- package/LICENSE +201 -0
- package/README.md +108 -3
- package/dist/browser/component.js +2 -0
- package/dist/browser/component.js.map +7 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/browser/jsx-dev-runtime.js +2 -0
- package/dist/browser/jsx-dev-runtime.js.map +7 -0
- package/dist/browser/jsx-runtime.js +2 -0
- package/dist/browser/jsx-runtime.js.map +7 -0
- package/dist/browser/manifest.json +14 -0
- package/dist/component.d.ts +13 -0
- package/dist/component.d.ts.map +1 -0
- package/dist/component.js +13 -0
- package/dist/component.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +3 -0
- package/dist/jsx-dev-runtime.d.ts.map +1 -0
- package/dist/jsx-dev-runtime.js +2 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-runtime.d.ts +3 -0
- package/dist/jsx-runtime.d.ts.map +1 -0
- package/dist/jsx-runtime.js +2 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/package.json +70 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @motionscript/sdk
|
|
2
|
+
|
|
3
|
+
## 0.1.0-alpha.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6697bb4: Every chart command runs from a document.
|
|
8
|
+
|
|
9
|
+
- Thirteen of the twenty chart commands returned a composition of seekable parts rather than a `Command`, so a document naming one failed to compile with `TypeError: made.at is not a function`: `enter` on all three charts, `showSeries`, `hideSeries` and `spotlightSeries` on the line and bar charts, and `selectSlice`, `deselectSlice`, `selectOnlySlice` and `clearSelection` on the pie. So did `zoomTo` with a region naming neither axis, and `resetZoom` before any zoom. Each now returns a `Command` that lasts the duration it was given. A line or bar `enter` without a legend, whose beats end before that, holds its last frame for the rest of it.
|
|
10
|
+
- `@motionscript/sdk/component` gains `asCommand(part, duration?)`, which makes a composition built with `at`, `sequence`, `together`, `hold`, `compose` or `drive` the `Command` a `@command()` method returns. A part that ends before `duration` holds its last frame, and one that runs longer is played faster, so the command always ends where the part does.
|
|
11
|
+
- A line chart's first `zoomTo` from an auto axis tweens. It started from the unset range and ticks, which the axis tween steps at the midpoint, so the first zoom cut halfway through and only later ones moved. A zoom, and `resetZoom`, now start from the range and ticks the axis draws.
|
|
12
|
+
|
|
13
|
+
- ffd26fd: A `protein`'s `color` now paints. The prop resolves to an RGBA tuple when it is written, and `hexOf` turned anything that was not a string into `#ffffff`. So `colorScheme: 'uniform'` painted every atom, bond, tube and ribbon white whatever `color` was, the `residue` scheme's fallback was white, and a tween of `color` changed nothing. `hexOf` now writes any `Color` as hex through `colorOps`, so `color` drives `uniform` and the fallbacks, and a change to it rebuilds the cached tints. The `element`, `chain`, `secondary` and `residue` colours are unchanged.
|
|
14
|
+
|
|
15
|
+
`colorOps` is now exported from `@motionscript/sdk`, and it gains `hex(value)`, which writes any `Color` as `#rrggbb`, or as `#rrggbbaa` when it is not opaque.
|
|
16
|
+
|
|
17
|
+
- 59c9944: A subclass that redeclares a `@property` or a `@command()` its base already declares now overrides it. `getPropertyMeta` and `getCommandMeta` kept the base's declaration and dropped the subclass's, so a redeclared default, mapper, tween or editor option, or a command's `args` and `name`, never took effect. The most-derived declaration of each key now wins, whole, in the position the base gave it, and an inherited key the subclass does not redeclare is kept as declared. `Registry.describe`, a node type's command table and a new instance's values all read that one declaration.
|
|
18
|
+
|
|
19
|
+
A bare `Globe` now starts at its own camera and key light (orbit −10, elevation 25, zoom 2.8, ambient 0.55, key 1.9) rather than `Canvas3D`'s (35, 20, 12, 0.45, 2.4), which framed it as a small disc twelve radii away. A bare `Protein` likewise starts at elevation 18, zoom 2.6, ambient 0.55 and key 1.6. `describe("graph3d")` no longer reports `Canvas3D`'s defaults for `orbit`, `elevation` and `zoom`, which a graph derives from `camera.initialPosition`.
|
|
20
|
+
|
|
21
|
+
## 0.1.0-alpha.2
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- 0227e28: A command published under a key of its own, `@command({ key: "press" }) pulse()`, runs the method it decorates. The registry recorded the key as the method to call, so dispatching it from a document called whatever the class had under that name: a prop (`Command "press" needs a "press" method`), an inherited method, or nothing. `CommandMeta` now carries `method` beside `key`, and `Registry.addNode` stores it as `NodeCommandEntry.method`. A command whose key is a core command's but whose method is not is no longer taken for the core command when compile decides whether it reads or writes layout. A command declared without a `key` is unchanged.
|
|
26
|
+
|
|
27
|
+
## 0.1.0-alpha.1
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- 59cecba: The SDK carries what a component is written against, so a kit no longer reaches into `@motionscript/core`. New in `@motionscript/sdk` (and `@motionscript/core/sdk`, which it passes through):
|
|
32
|
+
|
|
33
|
+
- `PathShape` and `PathShapeProps`, the document's `"path"` node, whose `data` is in its own box's unit space.
|
|
34
|
+
- `pathOps`, with the `PathSampler`, `PathAnchor`, `PathSubpath` and `VectorPath` types it takes and returns.
|
|
35
|
+
- `textOps`.
|
|
36
|
+
- `toPathString`, plus the `PathBounds` and `GraphicsOp` types.
|
|
37
|
+
- `InsetsProps`, what a `padding`-style prop accepts, and `SizeConstraints`, what an overriding `measure()` is handed.
|
|
38
|
+
- `SpaceCamera`, what `_spaceCamera()` returns to open a 2.5D space.
|
|
39
|
+
- `BufferGeometry3D`.
|
|
40
|
+
|
|
41
|
+
`@motionscript/sdk/component` is a new subpath over `@motionscript/core/component`: seekable entrances (`at`, `sequence`, `together`, `hold`, `compose`, `drive`), `declarePaints`, number formatting and the orbit-camera lerps. It is a subpath because a scene author never needs it, and because its `hold` (a seekable pause) is not the barrel's `hold` (an audio curve).
|
|
42
|
+
|
|
43
|
+
Host machinery stays in core: the asset catalog and declaration pass, render and measure contexts, `SceneTimeline`, `Engine` and `Session`.
|
|
44
|
+
|
|
45
|
+
- 59cecba: Ship a browser build in `dist/browser/`, like every other package: one ES module per export (`.`, `./component`, `./jsx-runtime`, `./jsx-dev-runtime`) and a `manifest.json` mapping each to its file. It imports `@motionscript/core` rather than bundling it, so an import map names core once and the SDK, the backend and every kit share it.
|
|
46
|
+
|
|
47
|
+
`@motionscript/core` is now a peer dependency of the SDK rather than a dependency, as it is of everything else built on core. npm and pnpm install a missing peer for you; with a package manager that does not, add `@motionscript/core` beside `@motionscript/sdk`.
|
|
48
|
+
|
|
49
|
+
## 0.1.0-alpha.0
|
|
50
|
+
|
|
51
|
+
Initial release.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,4 +1,109 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Motionscript
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
**Motion Script** is a TypeScript/JSX framework for making videos with code.
|
|
4
|
+
Describe animations as documents of nodes and commands, then preview
|
|
5
|
+
them live in the browser and export straight to MP4 — no timeline UI, no
|
|
6
|
+
keyframe panel, just a codebase you can version, review, and generate.
|
|
7
|
+
|
|
8
|
+
`@motionscript/sdk` is the flagship package: the authoring surface of
|
|
9
|
+
[`@motionscript/core`](../core) (the document model, scene graph, runtime,
|
|
10
|
+
layout, and JSX runtime) behind a single import.
|
|
11
|
+
|
|
12
|
+
## Getting started
|
|
13
|
+
|
|
14
|
+
Install it with a rendering backend such as
|
|
15
|
+
[`@motionscript/browser`](../browser):
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @motionscript/sdk @motionscript/core @motionscript/browser @motionscript/canvaskit
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
`@motionscript/core` is a peer dependency rather than a bundled one: the
|
|
22
|
+
backend and every component kit share the one copy your project installs,
|
|
23
|
+
because two copies of the engine in one module graph break class identity.
|
|
24
|
+
|
|
25
|
+
## Quick example
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import type { CompositionDocument } from '@motionscript/sdk';
|
|
29
|
+
|
|
30
|
+
// A scene is data: a tree of nodes, then commands placed at times.
|
|
31
|
+
const doc: CompositionDocument = {
|
|
32
|
+
kind: 'composition',
|
|
33
|
+
nodes: [
|
|
34
|
+
{ id: 'card', type: 'rect', parentId: null, layerOrder: 0,
|
|
35
|
+
props: { width: 400, height: 400, fill: 'white', cornerRadius: 20 } },
|
|
36
|
+
{ id: 'lens', type: 'ellipse', parentId: 'card', layerOrder: 0,
|
|
37
|
+
props: { width: 350, height: 350, fill: 'black' } },
|
|
38
|
+
],
|
|
39
|
+
commands: [
|
|
40
|
+
// Slide the lens 300px over 3 seconds.
|
|
41
|
+
{ id: 'slide', type: 'to', targetId: 'lens', at: 0, duration: 3, args: { x: 300 } },
|
|
42
|
+
],
|
|
43
|
+
};
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
A scene is data: nodes, and commands placed at times, so any frame can be asked
|
|
47
|
+
for directly and a seek costs the same in either direction. Custom drawing, and
|
|
48
|
+
anything JSON cannot express, belongs in a node class registered with the engine
|
|
49
|
+
and named by key. Flow layout,
|
|
50
|
+
fills, gradients, filters, SkSL shader effects, paths, text, audio and 3D are
|
|
51
|
+
all supported. See the
|
|
52
|
+
[docs](https://motionscript.dev/docs) for the full feature set.
|
|
53
|
+
|
|
54
|
+
## What's in here
|
|
55
|
+
|
|
56
|
+
- **Documents & projects**: the `ProjectDocument`, `StillDocument`,
|
|
57
|
+
`CompositionDocument` and `AudioDocument` types, `asProjectDocument`,
|
|
58
|
+
`validateDocument`, and the `Registry` a document compiles against.
|
|
59
|
+
- **Nodes**: geometry (`Rect`, `Ellipse`, `Line`, `Path`, `Polygon`,
|
|
60
|
+
`Polygram`, `LineGrid`, `MaskGroup`, `BooleanGroup`), text (`Text`,
|
|
61
|
+
`RichText`, `NumberNode`), structure (`Canvas2D`, `Canvas3D`, `Camera`), and
|
|
62
|
+
media (`Video`; images are a fill, `Fills.image`). Layout is the `flow` prop,
|
|
63
|
+
through `flowOps`.
|
|
64
|
+
- **Animation**: commands (`to`, `set`, `variableTo`/`variableSet` and a node's
|
|
65
|
+
own `@command` methods), each placed at a time, easing (`linear`, `easeIn`,
|
|
66
|
+
`easeOut`, `easeInOut`), and interpolation (`lerpNumber`).
|
|
67
|
+
- **Styling & effects**: `Fills`, `Effects`, `ImageFilters`, `VideoFilters`,
|
|
68
|
+
`AudioFilters`, plus the `Stroke`/`Shadow`/`Corners` attribute types.
|
|
69
|
+
- **Audio**: the `SoundNode` and `AudioBus` nodes.
|
|
70
|
+
- **Utilities**: `createRef`, `clamp`, `generateList`, `createContext`,
|
|
71
|
+
`Random`, the `@property` decorator.
|
|
72
|
+
- **JSX runtime**: `@motionscript/sdk/jsx-runtime` and
|
|
73
|
+
`@motionscript/sdk/jsx-dev-runtime`, so a composite node can build its children
|
|
74
|
+
as TSX.
|
|
75
|
+
- **Component machinery**: `@motionscript/sdk/component`, what a component
|
|
76
|
+
package needs beyond the barrel: seekable entrances (`at`, `sequence`,
|
|
77
|
+
`together`, `hold`, `compose`, `drive`, and `asCommand` to return one from a
|
|
78
|
+
`@command()` method), `declarePaints`, number formatting and the
|
|
79
|
+
orbit-camera lerps.
|
|
80
|
+
|
|
81
|
+
Component kits such as [`@motionscript/code`](../components/code) and
|
|
82
|
+
[`@motionscript/latex`](../components/latex) are not bundled here. They are
|
|
83
|
+
built on this package and take it as a peer dependency. Install one as a
|
|
84
|
+
dependency, or copy a component's source into your project with
|
|
85
|
+
`ms add <name>` (see [`@motionscript/cli`](../cli)).
|
|
86
|
+
|
|
87
|
+
## Loading from a CDN
|
|
88
|
+
|
|
89
|
+
`dist/browser/` holds one ES module per export, with `@motionscript/core` left
|
|
90
|
+
as an import, and `dist/browser/manifest.json` maps each export to its file. An
|
|
91
|
+
import map names `@motionscript/sdk` (and its subpaths) and
|
|
92
|
+
`@motionscript/core` (and its subpaths) once, and every kit loaded beside them
|
|
93
|
+
shares both.
|
|
94
|
+
|
|
95
|
+
This package has no rendering backend of its own. Pair it with
|
|
96
|
+
[`@motionscript/browser`](../browser) (Skia/CanvasKit), and use
|
|
97
|
+
[`@motionscript/react`](../react) to mount a player in a React app.
|
|
98
|
+
|
|
99
|
+
See the [docs](https://motionscript.dev/docs) for the full feature set and API
|
|
100
|
+
reference.
|
|
101
|
+
|
|
102
|
+
## Development
|
|
103
|
+
|
|
104
|
+
From the monorepo root:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
pnpm --filter @motionscript/sdk build
|
|
108
|
+
pnpm --filter @motionscript/sdk test
|
|
109
|
+
```
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/component.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * `@motionscript/sdk/component` — what a component package needs beyond the\n * authoring barrel: seekable entrances (`at`, `sequence`, `together`, `hold`,\n * `compose`, `drive`, and `asCommand` to return one from a `@command()` method),\n * `declarePaints`, number formatting and the orbit-camera lerps.\n *\n * A subpath, not part of `.`, because a scene author never reaches for it and\n * one name collides: `hold` here is a seekable pause, where the barrel's `hold`\n * is an audio curve. The curation is `@motionscript/core/component`'s, for the\n * same reason `index.ts` passes through `@motionscript/core/sdk`.\n */\nexport * from \"@motionscript/core/component\";\n"],
|
|
5
|
+
"mappings": "AAWA,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/index.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * `@motionscript/sdk` — the published, friendly name over `@motionscript/core`.\n *\n * The curation lives in `@motionscript/core`'s own `\"./sdk\"` subpath\n * (`packages/core/src/sdk/index.ts`), not here: a hand-curated copy in a\n * different package than the classes it names is exactly the \"two\n * definitions that can silently disagree\" shape this codebase avoids\n * elsewhere. This file exists so the published package name and its own\n * versioning stay stable — only its implementation is a passthrough.\n */\nexport * from \"@motionscript/core/sdk\";\n"],
|
|
5
|
+
"mappings": "AAUA,WAAc",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/jsx-dev-runtime.ts"],
|
|
4
|
+
"sourcesContent": ["export { jsxDEV, Fragment } from '@motionscript/core/jsx/jsx-dev-runtime';\nexport type { JSX } from '@motionscript/core/jsx/jsx-runtime';\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,UAAAA,EAAQ,YAAAC,MAAgB",
|
|
6
|
+
"names": ["jsxDEV", "Fragment"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/jsx-runtime.ts"],
|
|
4
|
+
"sourcesContent": ["export { jsx, jsxs, Fragment } from '@motionscript/core/jsx/jsx-runtime';\nexport type { JSX } from '@motionscript/core/jsx/jsx-runtime';\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,OAAAA,EAAK,QAAAC,EAAM,YAAAC,MAAgB",
|
|
6
|
+
"names": ["jsx", "jsxs", "Fragment"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@motionscript/sdk",
|
|
3
|
+
"version": "0.1.0-alpha.3",
|
|
4
|
+
"exports": {
|
|
5
|
+
".": "dist/browser/index.js",
|
|
6
|
+
"./component": "dist/browser/component.js",
|
|
7
|
+
"./jsx-runtime": "dist/browser/jsx-runtime.js",
|
|
8
|
+
"./jsx-dev-runtime": "dist/browser/jsx-dev-runtime.js"
|
|
9
|
+
},
|
|
10
|
+
"peers": [
|
|
11
|
+
"@motionscript/core"
|
|
12
|
+
],
|
|
13
|
+
"assets": {}
|
|
14
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@motionscript/sdk/component` — what a component package needs beyond the
|
|
3
|
+
* authoring barrel: seekable entrances (`at`, `sequence`, `together`, `hold`,
|
|
4
|
+
* `compose`, `drive`, and `asCommand` to return one from a `@command()` method),
|
|
5
|
+
* `declarePaints`, number formatting and the orbit-camera lerps.
|
|
6
|
+
*
|
|
7
|
+
* A subpath, not part of `.`, because a scene author never reaches for it and
|
|
8
|
+
* one name collides: `hold` here is a seekable pause, where the barrel's `hold`
|
|
9
|
+
* is an audio curve. The curation is `@motionscript/core/component`'s, for the
|
|
10
|
+
* same reason `index.ts` passes through `@motionscript/core/sdk`.
|
|
11
|
+
*/
|
|
12
|
+
export * from "@motionscript/core/component";
|
|
13
|
+
//# sourceMappingURL=component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@motionscript/sdk/component` — what a component package needs beyond the
|
|
3
|
+
* authoring barrel: seekable entrances (`at`, `sequence`, `together`, `hold`,
|
|
4
|
+
* `compose`, `drive`, and `asCommand` to return one from a `@command()` method),
|
|
5
|
+
* `declarePaints`, number formatting and the orbit-camera lerps.
|
|
6
|
+
*
|
|
7
|
+
* A subpath, not part of `.`, because a scene author never reaches for it and
|
|
8
|
+
* one name collides: `hold` here is a seekable pause, where the barrel's `hold`
|
|
9
|
+
* is an audio curve. The curation is `@motionscript/core/component`'s, for the
|
|
10
|
+
* same reason `index.ts` passes through `@motionscript/core/sdk`.
|
|
11
|
+
*/
|
|
12
|
+
export * from "@motionscript/core/component";
|
|
13
|
+
//# sourceMappingURL=component.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component.js","sourceRoot":"","sources":["../src/component.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,cAAc,8BAA8B,CAAC","sourcesContent":["/**\n * `@motionscript/sdk/component` — what a component package needs beyond the\n * authoring barrel: seekable entrances (`at`, `sequence`, `together`, `hold`,\n * `compose`, `drive`, and `asCommand` to return one from a `@command()` method),\n * `declarePaints`, number formatting and the orbit-camera lerps.\n *\n * A subpath, not part of `.`, because a scene author never reaches for it and\n * one name collides: `hold` here is a seekable pause, where the barrel's `hold`\n * is an audio curve. The curation is `@motionscript/core/component`'s, for the\n * same reason `index.ts` passes through `@motionscript/core/sdk`.\n */\nexport * from \"@motionscript/core/component\";\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@motionscript/sdk` — the published, friendly name over `@motionscript/core`.
|
|
3
|
+
*
|
|
4
|
+
* The curation lives in `@motionscript/core`'s own `"./sdk"` subpath
|
|
5
|
+
* (`packages/core/src/sdk/index.ts`), not here: a hand-curated copy in a
|
|
6
|
+
* different package than the classes it names is exactly the "two
|
|
7
|
+
* definitions that can silently disagree" shape this codebase avoids
|
|
8
|
+
* elsewhere. This file exists so the published package name and its own
|
|
9
|
+
* versioning stay stable — only its implementation is a passthrough.
|
|
10
|
+
*/
|
|
11
|
+
export * from "@motionscript/core/sdk";
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@motionscript/sdk` — the published, friendly name over `@motionscript/core`.
|
|
3
|
+
*
|
|
4
|
+
* The curation lives in `@motionscript/core`'s own `"./sdk"` subpath
|
|
5
|
+
* (`packages/core/src/sdk/index.ts`), not here: a hand-curated copy in a
|
|
6
|
+
* different package than the classes it names is exactly the "two
|
|
7
|
+
* definitions that can silently disagree" shape this codebase avoids
|
|
8
|
+
* elsewhere. This file exists so the published package name and its own
|
|
9
|
+
* versioning stay stable — only its implementation is a passthrough.
|
|
10
|
+
*/
|
|
11
|
+
export * from "@motionscript/core/sdk";
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,cAAc,wBAAwB,CAAC","sourcesContent":["/**\n * `@motionscript/sdk` — the published, friendly name over `@motionscript/core`.\n *\n * The curation lives in `@motionscript/core`'s own `\"./sdk\"` subpath\n * (`packages/core/src/sdk/index.ts`), not here: a hand-curated copy in a\n * different package than the classes it names is exactly the \"two\n * definitions that can silently disagree\" shape this codebase avoids\n * elsewhere. This file exists so the published package name and its own\n * versioning stay stable — only its implementation is a passthrough.\n */\nexport * from \"@motionscript/core/sdk\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAC1E,YAAY,EAAE,GAAG,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-dev-runtime.js","sourceRoot":"","sources":["../src/jsx-dev-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC","sourcesContent":["export { jsxDEV, Fragment } from '@motionscript/core/jsx/jsx-dev-runtime';\nexport type { JSX } from '@motionscript/core/jsx/jsx-runtime';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACzE,YAAY,EAAE,GAAG,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC","sourcesContent":["export { jsx, jsxs, Fragment } from '@motionscript/core/jsx/jsx-runtime';\nexport type { JSX } from '@motionscript/core/jsx/jsx-runtime';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@motionscript/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-alpha.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Engine-agnostic animation library for Motion Script: scenes, nodes, props, tweens, layout, and the JSX runtime.",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/motionscript-dev/motionscript.git",
|
|
9
|
+
"directory": "packages/sdk"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://motionscript.dev",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/motionscript-dev/motionscript/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"motion-script",
|
|
17
|
+
"motion script",
|
|
18
|
+
"animation"
|
|
19
|
+
],
|
|
20
|
+
"license": "Apache-2.0",
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
24
|
+
"main": "dist/index.js",
|
|
25
|
+
"types": "dist/index.d.ts",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"CHANGELOG.md",
|
|
30
|
+
"!dist/**/*.tsbuildinfo"
|
|
31
|
+
],
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"default": "./dist/index.js"
|
|
36
|
+
},
|
|
37
|
+
"./component": {
|
|
38
|
+
"types": "./dist/component.d.ts",
|
|
39
|
+
"default": "./dist/component.js"
|
|
40
|
+
},
|
|
41
|
+
"./jsx-runtime": {
|
|
42
|
+
"types": "./dist/jsx-runtime.d.ts",
|
|
43
|
+
"default": "./dist/jsx-runtime.js"
|
|
44
|
+
},
|
|
45
|
+
"./jsx-dev-runtime": {
|
|
46
|
+
"types": "./dist/jsx-dev-runtime.d.ts",
|
|
47
|
+
"default": "./dist/jsx-dev-runtime.js"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"@motionscript/core": "^0.1.0-alpha.3"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@types/node": "^25.6.2",
|
|
55
|
+
"concurrently": "^9.0.0",
|
|
56
|
+
"eslint": "^9.39.4",
|
|
57
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
58
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
59
|
+
"tsc-alias": "^1.8.16",
|
|
60
|
+
"typescript": "^6.0.3",
|
|
61
|
+
"typescript-eslint": "^8.48.0",
|
|
62
|
+
"vitest": "^4.1.5",
|
|
63
|
+
"@motionscript/core": "0.1.0-alpha.3"
|
|
64
|
+
},
|
|
65
|
+
"scripts": {
|
|
66
|
+
"build": "eslint . && tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && node ../../scripts/build-browser.mjs",
|
|
67
|
+
"dev": "concurrently \"tsc -p tsconfig.build.json --watch\" \"tsc-alias -p tsconfig.build.json -w\"",
|
|
68
|
+
"clean": "rimraf --glob dist .turbo *.tsbuildinfo",
|
|
69
|
+
"test": "vitest",
|
|
70
|
+
"lint": "eslint .",
|
|
71
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
72
|
+
}
|
|
6
73
|
}
|