dopesheet 0.0.0-stage → 0.1.0-beta.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 +21 -0
- package/README.md +78 -2
- package/bin/dopesheet.mjs +50 -0
- package/dist/browser/client.js +9 -0
- package/dist/browser/client.js.map +1 -0
- package/dist/browser/runtime.js +1 -0
- package/dist/browser/src-C-7lxf9e.js +2735 -0
- package/dist/browser/src-C-7lxf9e.js.map +1 -0
- package/dist/browser/src-D2ttZ_j7.js +7089 -0
- package/dist/browser/src-D2ttZ_j7.js.map +1 -0
- package/dist/browser/ui.js +1 -0
- package/dist/index.js +11 -0
- package/dist/loader.cjs +24 -0
- package/dist/next.js +81 -0
- package/dist/shared-CdhNdlQj.js +47 -0
- package/dist/shared-DpUIelWp.js +1454 -0
- package/dist/shared-E9l6ZbF6.js +102 -0
- package/dist/transform.js +2 -0
- package/dist/vite.js +16 -0
- package/docs/agents.md +38 -0
- package/package.json +90 -3
- package/types/next.d.ts +10 -0
- package/types/vite.d.ts +11 -0
- package/types/webpack.d.ts +14 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 The Dopesheet authors
|
|
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
|
@@ -1,3 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Dopesheet
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A visual timeline editor for GSAP. Open it in your running page, scrub, drag and tweak your animations, and click **Save**: Dopesheet writes the new values back into your source code as a small, minimal diff.
|
|
4
|
+
|
|
5
|
+
It runs only in development. Production builds are untouched.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm i -D dopesheet@beta
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
GSAP 3.12 or newer must be installed in your project.
|
|
14
|
+
|
|
15
|
+
### Vite
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// vite.config.ts
|
|
19
|
+
import { defineConfig } from "vite";
|
|
20
|
+
import dopesheet from "dopesheet/vite";
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
plugins: [dopesheet()],
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Next.js
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
// next.config.ts
|
|
31
|
+
import { withDopesheet } from "dopesheet/next";
|
|
32
|
+
|
|
33
|
+
export default withDopesheet({
|
|
34
|
+
/* your Next config */
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Works with Turbopack and `next dev --webpack`. A small save server runs on `127.0.0.1:4855` (change it with `withDopesheet(config, { port })`).
|
|
39
|
+
|
|
40
|
+
### webpack / Rspack
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
// webpack.config.js
|
|
44
|
+
const { webpack: dopesheet } = require("dopesheet/webpack");
|
|
45
|
+
module.exports = { plugins: [dopesheet()] };
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
For Rspack use `require("dopesheet/rspack").rspack()`.
|
|
49
|
+
|
|
50
|
+
## Use
|
|
51
|
+
|
|
52
|
+
1. Start your dev server and open the page.
|
|
53
|
+
2. The editor opens over the page (**Alt+D** hides and shows it).
|
|
54
|
+
3. Pick an animation in **Objects** or on the timeline. Scrub, drag keyframes, edit values in the inspector, or drag the element on the page.
|
|
55
|
+
4. Click **Save**. The change is written into the file that made the call; your dev server reloads as usual.
|
|
56
|
+
|
|
57
|
+
Commit before you start, so every save is a diff you can review.
|
|
58
|
+
|
|
59
|
+
## What it edits
|
|
60
|
+
|
|
61
|
+
- `gsap.to`, `from`, `fromTo`, `set` and timelines (position parameters, labels, nesting)
|
|
62
|
+
- Durations, delays, eases (with a curve editor), repeat and yoyo, staggers, keyframes
|
|
63
|
+
- `gsap.context()`, `useGSAP()`, `matchMedia`, registered effects
|
|
64
|
+
- ScrollTrigger: start/end markers you can drag on the page, scrub, pin, snap and toggleActions
|
|
65
|
+
- Plugins: MotionPath (drag the path's points on the page), DrawSVG, MorphSVG, Text, ScrambleText, SplitText. Flip, Draggable, Observer and Inertia are shown but play live.
|
|
66
|
+
|
|
67
|
+
Values must be written in the code for Dopesheet to save them (`x: 100`, or a `const` in the same file). Values computed at runtime are shown read-only.
|
|
68
|
+
|
|
69
|
+
## Coding agents
|
|
70
|
+
|
|
71
|
+
```sh
|
|
72
|
+
npx dopesheet agents
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
adds a short block to `AGENTS.md` (and `CLAUDE.md` if there is one) pointing agents at [rules](docs/agents.md) that keep animations editable.
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// dopesheet agents [--file AGENTS.md]: adds (or refreshes) a marked block that points coding
|
|
3
|
+
// agents at Dopesheet's rules. Edits CLAUDE.md too when the project has one.
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { basename, resolve } from "node:path";
|
|
6
|
+
|
|
7
|
+
const START = "<!-- dopesheet:start -->";
|
|
8
|
+
const END = "<!-- dopesheet:end -->";
|
|
9
|
+
const BLOCK = `${START}
|
|
10
|
+
## Animations (Dopesheet)
|
|
11
|
+
|
|
12
|
+
This project tunes its GSAP animations visually with Dopesheet, which writes edited values back into
|
|
13
|
+
the source. Before changing animation code, read \`node_modules/dopesheet/docs/agents.md\`.
|
|
14
|
+
In short: literal values in object-literal vars, shared values as same-file consts, position
|
|
15
|
+
parameters in timelines, re-read files before editing (a person may have just saved), no reformatting.
|
|
16
|
+
${END}`;
|
|
17
|
+
|
|
18
|
+
/** Returns `text` with the Dopesheet block added, or replaced in place if it is already there. */
|
|
19
|
+
export function inject(text) {
|
|
20
|
+
const eol = text.includes("\r\n") ? "\r\n" : "\n";
|
|
21
|
+
const block = BLOCK.replace(/\n/g, eol);
|
|
22
|
+
const a = text.indexOf(START);
|
|
23
|
+
const b = text.indexOf(END);
|
|
24
|
+
if (a >= 0 && b > a) return text.slice(0, a) + block + text.slice(b + END.length);
|
|
25
|
+
return (text.trimEnd() ? text.trimEnd() + eol + eol : "") + block + eol;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function main(argv) {
|
|
29
|
+
const [cmd, ...rest] = argv;
|
|
30
|
+
if (cmd !== "agents") {
|
|
31
|
+
console.log("Usage: dopesheet agents [--file AGENTS.md]");
|
|
32
|
+
process.exit(cmd ? 1 : 0);
|
|
33
|
+
}
|
|
34
|
+
const i = rest.indexOf("--file");
|
|
35
|
+
const files = i >= 0 ? [rest[i + 1]] : ["AGENTS.md", ...(existsSync("CLAUDE.md") ? ["CLAUDE.md"] : [])];
|
|
36
|
+
for (const f of files) {
|
|
37
|
+
const path = resolve(f);
|
|
38
|
+
const before = existsSync(path) ? readFileSync(path, "utf8") : "";
|
|
39
|
+
const after = inject(before);
|
|
40
|
+
if (after === before) console.log(`${f}: up to date`);
|
|
41
|
+
else {
|
|
42
|
+
writeFileSync(path, after);
|
|
43
|
+
console.log(`${f}: ${before ? "updated" : "created"}`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Run as a command (npx dopesheet / the bin shim), not when imported by tests.
|
|
49
|
+
const entry = basename(process.argv[1] ?? "");
|
|
50
|
+
if (entry === "dopesheet" || entry === "dopesheet.mjs" || entry === "dopesheet.cmd") main(process.argv.slice(2));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { gsap as e } from "gsap";
|
|
2
|
+
import { n as t } from "./src-C-7lxf9e.js";
|
|
3
|
+
// ../unplugin/src/client.ts
|
|
4
|
+
if (typeof window < "u" && !globalThis.__DOPESHEET__) {
|
|
5
|
+
let n = t(e);
|
|
6
|
+
import("./src-D2ttZ_j7.js").then((e) => e.r).then((e) => e.mount(n, { dock: !1 }));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","names":["g","gsap","install","runtime","n","m"],"sources":["../../../unplugin/src/client.ts"],"sourcesContent":["// The editor in the page, for webpack and Next.js builds. Every tagged module imports this first,\n// so the runtime is installed before any GSAP call runs. On the server (SSR) it does nothing.\nimport { gsap } from \"gsap\";\nimport { install, type Gsap, type Runtime } from \"@dopesheet/runtime\";\n\nconst g = globalThis as { __DOPESHEET__?: Runtime; window?: unknown };\nif (typeof window !== \"undefined\" && !g.__DOPESHEET__) {\n const runtime = install(gsap as unknown as Gsap);\n // Docked mode needs the Vite plugin's dock page.\n void import(\"@dopesheet/ui\").then((m) => m.mount(runtime, { dock: false }));\n}\n"],"mappings":";;;AAMA,IAAI,OAAO,SAAW,OAAe,CAACA,WAAE,eAAe;CACrD,IAAMG,IAAUD,EAAQD,CAAuB;CAE1C,OAAO,oBAAgB,CAAA,MAAAG,MAAAA,EAAA,CAAA,CAAA,CAAC,MAAMC,MAAMA,EAAE,MAAMF,GAAS,EAAE,MAAM,GAAM,CAAC,CAAC;AAC5E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { n as install } from "./src-C-7lxf9e.js";
|