create-odori 0.0.1 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/bin/create-odori.mjs +13 -0
- package/package.json +28 -7
- package/src/index.ts +25 -0
- package/template/odori.config.ts +7 -0
- package/template/package.json +22 -0
- package/template/tsconfig.json +13 -0
- package/template/videos/components/end-card/end-card.preview.tsx +19 -0
- package/template/videos/components/end-card/end-card.tsx +83 -0
- package/template/videos/components/title-reveal/title-reveal.preview.tsx +20 -0
- package/template/videos/components/title-reveal/title-reveal.tsx +84 -0
- package/template/videos/launch/video.tsx +24 -0
- package/template/videos/layout.tsx +26 -0
- package/README.md +0 -7
- package/index.js +0 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Allen Zhou
|
|
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.
|
|
22
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {register} from "tsx/esm/api";
|
|
3
|
+
|
|
4
|
+
register();
|
|
5
|
+
const {createProject} = await import("../src/index.ts");
|
|
6
|
+
const target = process.argv[2];
|
|
7
|
+
if (!target) {
|
|
8
|
+
console.error("Usage: create-odori <directory>");
|
|
9
|
+
process.exit(1);
|
|
10
|
+
}
|
|
11
|
+
const root = await createProject(target);
|
|
12
|
+
console.log(`Created ${root}`);
|
|
13
|
+
console.log("Next: pnpm install, then pnpm odori dev");
|
package/package.json
CHANGED
|
@@ -1,9 +1,30 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-odori",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
}
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Scaffold a odori video project.",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"bin": {
|
|
8
|
+
"create-odori": "./bin/create-odori.mjs"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./src/index.ts"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"bin",
|
|
15
|
+
"src",
|
|
16
|
+
"template"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"tsx": "4.20.5"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/node": "22.19.0",
|
|
23
|
+
"typescript": "5.9.3",
|
|
24
|
+
"@odori/registry": "0.0.3"
|
|
25
|
+
},
|
|
26
|
+
"scripts": {
|
|
27
|
+
"typecheck": "tsc --noEmit",
|
|
28
|
+
"starters": "tsx scripts/starters.ts"
|
|
29
|
+
}
|
|
30
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {cp, mkdir, readFile, readdir, writeFile} from "node:fs/promises";
|
|
2
|
+
import {existsSync} from "node:fs";
|
|
3
|
+
import {dirname, join, resolve} from "node:path";
|
|
4
|
+
import {fileURLToPath} from "node:url";
|
|
5
|
+
|
|
6
|
+
const templateRoot = resolve(dirname(fileURLToPath(import.meta.url)), "..", "template");
|
|
7
|
+
|
|
8
|
+
export const createProject = async (target: string, options: {name?: string} = {}) => {
|
|
9
|
+
const root = resolve(process.cwd(), target);
|
|
10
|
+
if (existsSync(root) && (await readdir(root)).length > 0) {
|
|
11
|
+
throw new Error(`${root} already exists and is not empty.`);
|
|
12
|
+
}
|
|
13
|
+
await mkdir(root, {recursive: true});
|
|
14
|
+
await cp(templateRoot, root, {recursive: true});
|
|
15
|
+
|
|
16
|
+
const packageFile = join(root, "package.json");
|
|
17
|
+
const contents = (await readFile(packageFile, "utf8")).replace(
|
|
18
|
+
"PROJECT_NAME",
|
|
19
|
+
options.name ?? target.split("/").pop() ?? "odori-videos",
|
|
20
|
+
);
|
|
21
|
+
await writeFile(packageFile, contents, "utf8");
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
return root;
|
|
25
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "PROJECT_NAME",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "odori dev",
|
|
8
|
+
"list": "odori list",
|
|
9
|
+
"test": "odori test",
|
|
10
|
+
"export": "odori export launch"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"react": "19.2.3",
|
|
14
|
+
"react-dom": "19.2.3",
|
|
15
|
+
"odori": "^0.0.3"
|
|
16
|
+
},
|
|
17
|
+
"devDependencies": {
|
|
18
|
+
"@odori/cli": "^0.0.3",
|
|
19
|
+
"@types/react": "19.2.7",
|
|
20
|
+
"typescript": "5.9.3"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["DOM", "DOM.Iterable", "ES2022"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Bundler",
|
|
7
|
+
"jsx": "react-jsx",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"noEmit": true,
|
|
10
|
+
"skipLibCheck": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["videos", "odori.config.ts"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {defineComponentPreview} from "odori/preview";
|
|
2
|
+
import {EndCard} from "./end-card";
|
|
3
|
+
|
|
4
|
+
export default defineComponentPreview({
|
|
5
|
+
title: "End card",
|
|
6
|
+
category: "Brand",
|
|
7
|
+
description: "The closing frame: title, supporting line, and a call to action.",
|
|
8
|
+
component: EndCard,
|
|
9
|
+
canvas: {width: 1920, height: 1080, duration: "3s"},
|
|
10
|
+
controls: {
|
|
11
|
+
title: {type: "text", defaultValue: "Author. Preview. Ship.", maxLength: 48},
|
|
12
|
+
detail: {type: "text", defaultValue: "An independent React video framework."},
|
|
13
|
+
callToAction: {type: "text", defaultValue: "npm i odori"},
|
|
14
|
+
},
|
|
15
|
+
examples: [
|
|
16
|
+
{name: "Default", props: {title: "Author. Preview. Ship.", callToAction: "npm i odori"}},
|
|
17
|
+
{name: "Title only", props: {title: "Available today.", detail: undefined, callToAction: undefined}},
|
|
18
|
+
],
|
|
19
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {Fill, Easing, interpolate, spring, useBrand, useFrame, useDesignScale, useVideo} from "odori";
|
|
2
|
+
|
|
3
|
+
export type EndCardProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
detail?: string;
|
|
6
|
+
callToAction?: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/** The closing lockup: the statement, and one command to run. */
|
|
10
|
+
export const EndCard = ({title, detail, callToAction}: EndCardProps) => {
|
|
11
|
+
const frame = useFrame();
|
|
12
|
+
const brand = useBrand();
|
|
13
|
+
const {fps} = useVideo();
|
|
14
|
+
const scale = useDesignScale();
|
|
15
|
+
const rise = spring({frame, fps, from: 0.96, to: 1, damping: 20});
|
|
16
|
+
const line = interpolate(frame, [8, 34], [0, 1], {easing: Easing.standard});
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<Fill style={{alignItems: "center", gap: 30 * scale, justifyContent: "center", padding: 110 * scale}}>
|
|
20
|
+
<div
|
|
21
|
+
style={{
|
|
22
|
+
fontSize: 108 * scale,
|
|
23
|
+
fontWeight: 560,
|
|
24
|
+
letterSpacing: "-0.05em",
|
|
25
|
+
lineHeight: 1.02,
|
|
26
|
+
maxWidth: 1400 * scale,
|
|
27
|
+
opacity: interpolate(frame, [0, 18], [0, 1], {easing: Easing.standard}),
|
|
28
|
+
textAlign: "center",
|
|
29
|
+
transform: `scale(${rise})`,
|
|
30
|
+
whiteSpace: "pre-line",
|
|
31
|
+
}}
|
|
32
|
+
>
|
|
33
|
+
{title}
|
|
34
|
+
</div>
|
|
35
|
+
|
|
36
|
+
<div
|
|
37
|
+
style={{
|
|
38
|
+
background: `linear-gradient(90deg, transparent, ${brand.colors.border}, transparent)`,
|
|
39
|
+
height: 1,
|
|
40
|
+
opacity: line,
|
|
41
|
+
width: `${line * 46}%`,
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
|
|
45
|
+
{detail ? (
|
|
46
|
+
<div
|
|
47
|
+
style={{
|
|
48
|
+
color: brand.colors.muted,
|
|
49
|
+
fontSize: 34 * scale,
|
|
50
|
+
letterSpacing: "-0.015em",
|
|
51
|
+
opacity: interpolate(frame, [14, 30], [0, 1], {easing: Easing.standard}),
|
|
52
|
+
textAlign: "center",
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{detail}
|
|
56
|
+
</div>
|
|
57
|
+
) : null}
|
|
58
|
+
|
|
59
|
+
{callToAction ? (
|
|
60
|
+
<div
|
|
61
|
+
style={{
|
|
62
|
+
alignItems: "center",
|
|
63
|
+
background: "rgba(255,255,255,0.04)",
|
|
64
|
+
border: `1px solid ${brand.colors.border}`,
|
|
65
|
+
borderRadius: 10 * scale,
|
|
66
|
+
color: brand.colors.foreground,
|
|
67
|
+
display: "flex",
|
|
68
|
+
fontFamily: brand.typography.mono,
|
|
69
|
+
fontSize: 28 * scale,
|
|
70
|
+
gap: 14 * scale,
|
|
71
|
+
marginTop: 8 * scale,
|
|
72
|
+
opacity: interpolate(frame, [22, 38], [0, 1], {easing: Easing.standard}),
|
|
73
|
+
padding: `${16 * scale}px ${28 * scale}px`,
|
|
74
|
+
transform: `translateY(${interpolate(frame, [22, 38], [12 * scale, 0], {easing: Easing.standard})}px)`,
|
|
75
|
+
}}
|
|
76
|
+
>
|
|
77
|
+
<span style={{color: brand.colors.muted}}>{"$"}</span>
|
|
78
|
+
{callToAction}
|
|
79
|
+
</div>
|
|
80
|
+
) : null}
|
|
81
|
+
</Fill>
|
|
82
|
+
);
|
|
83
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {defineComponentPreview} from "odori/preview";
|
|
2
|
+
import {TitleReveal} from "./title-reveal";
|
|
3
|
+
|
|
4
|
+
export default defineComponentPreview({
|
|
5
|
+
title: "Title reveal",
|
|
6
|
+
category: "Typography",
|
|
7
|
+
description: "A staggered, word-masked headline.",
|
|
8
|
+
component: TitleReveal,
|
|
9
|
+
canvas: {width: 1920, height: 1080, duration: "4s"},
|
|
10
|
+
controls: {
|
|
11
|
+
title: {type: "text", defaultValue: "Ship the story.", maxLength: 64},
|
|
12
|
+
detail: {type: "text", defaultValue: "An independent React video framework."},
|
|
13
|
+
align: {type: "select", defaultValue: "center", options: ["left", "center"]},
|
|
14
|
+
},
|
|
15
|
+
examples: [
|
|
16
|
+
{name: "Default", props: {title: "Ship the story."}},
|
|
17
|
+
{name: "Two lines", props: {title: "Build videos\nlike applications.", detail: "Author. Preview. Ship."}},
|
|
18
|
+
{name: "Long copy", props: {title: "Build videos like applications, not like exports.", align: "left"}},
|
|
19
|
+
],
|
|
20
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import {Fill, Easing, interpolate, useBrand, useFrame, useDesignScale} from "odori";
|
|
2
|
+
|
|
3
|
+
export type TitleRevealProps = {
|
|
4
|
+
title: string;
|
|
5
|
+
detail?: string;
|
|
6
|
+
align?: "left" | "center";
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A masked, word-staggered headline. Each word rises out of a clipped line
|
|
11
|
+
* box, so the reveal reads as typography rather than a fade.
|
|
12
|
+
*/
|
|
13
|
+
export const TitleReveal = ({title, detail, align = "center"}: TitleRevealProps) => {
|
|
14
|
+
const frame = useFrame();
|
|
15
|
+
const brand = useBrand();
|
|
16
|
+
const scale = useDesignScale();
|
|
17
|
+
const lines = title.split("\n");
|
|
18
|
+
let wordIndex = 0;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<Fill
|
|
22
|
+
style={{
|
|
23
|
+
alignItems: align === "center" ? "center" : "flex-start",
|
|
24
|
+
gap: 34 * scale,
|
|
25
|
+
justifyContent: "center",
|
|
26
|
+
padding: `${120 * scale}px ${140 * scale}px`,
|
|
27
|
+
textAlign: align,
|
|
28
|
+
}}
|
|
29
|
+
>
|
|
30
|
+
<div style={{display: "grid", gap: 6 * scale, maxWidth: 1560 * scale}}>
|
|
31
|
+
{lines.map((line, lineNumber) => (
|
|
32
|
+
<div
|
|
33
|
+
key={`${line}-${lineNumber}`}
|
|
34
|
+
style={{
|
|
35
|
+
display: "flex",
|
|
36
|
+
flexWrap: "wrap",
|
|
37
|
+
gap: `0 ${26 * scale}px`,
|
|
38
|
+
justifyContent: align === "center" ? "center" : "flex-start",
|
|
39
|
+
overflow: "hidden",
|
|
40
|
+
paddingBottom: 12 * scale,
|
|
41
|
+
}}
|
|
42
|
+
>
|
|
43
|
+
{line.split(/\s+/).map((word) => {
|
|
44
|
+
const delay = 4 + wordIndex * brand.motion.staggerFrames;
|
|
45
|
+
wordIndex += 1;
|
|
46
|
+
const progress = interpolate(frame, [delay, delay + 24], [0, 1], {easing: Easing.standard});
|
|
47
|
+
return (
|
|
48
|
+
<span
|
|
49
|
+
key={`${word}-${wordIndex}`}
|
|
50
|
+
style={{
|
|
51
|
+
display: "inline-block",
|
|
52
|
+
fontSize: 116 * scale,
|
|
53
|
+
fontWeight: 560,
|
|
54
|
+
letterSpacing: "-0.045em",
|
|
55
|
+
lineHeight: 1.04,
|
|
56
|
+
opacity: progress,
|
|
57
|
+
transform: `translateY(${(1 - progress) * 78 * scale}px)`,
|
|
58
|
+
}}
|
|
59
|
+
>
|
|
60
|
+
{word}
|
|
61
|
+
</span>
|
|
62
|
+
);
|
|
63
|
+
})}
|
|
64
|
+
</div>
|
|
65
|
+
))}
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
{detail ? (
|
|
69
|
+
<div
|
|
70
|
+
style={{
|
|
71
|
+
color: brand.colors.muted,
|
|
72
|
+
fontSize: 36 * scale,
|
|
73
|
+
letterSpacing: "-0.015em",
|
|
74
|
+
maxWidth: 1100 * scale,
|
|
75
|
+
opacity: interpolate(frame, [16, 34], [0, 1], {easing: Easing.standard}),
|
|
76
|
+
transform: `translateY(${interpolate(frame, [16, 34], [14 * scale, 0], {easing: Easing.standard})}px)`,
|
|
77
|
+
}}
|
|
78
|
+
>
|
|
79
|
+
{detail}
|
|
80
|
+
</div>
|
|
81
|
+
) : null}
|
|
82
|
+
</Fill>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {Scene, Video, defineVideoMetadata} from "odori";
|
|
2
|
+
import {EndCard} from "../components/end-card/end-card";
|
|
3
|
+
import {TitleReveal} from "../components/title-reveal/title-reveal";
|
|
4
|
+
import {productLayout} from "../layout";
|
|
5
|
+
|
|
6
|
+
export const metadata = defineVideoMetadata({
|
|
7
|
+
id: "launch",
|
|
8
|
+
title: "Hello, odori",
|
|
9
|
+
layout: productLayout,
|
|
10
|
+
duration: "8s",
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export default function LaunchVideo() {
|
|
14
|
+
return (
|
|
15
|
+
<Video>
|
|
16
|
+
<Scene id="opening" duration="5s">
|
|
17
|
+
<TitleReveal title="Video projects deserve a framework." />
|
|
18
|
+
</Scene>
|
|
19
|
+
<Scene id="end" duration="3s">
|
|
20
|
+
<EndCard title="Built with odori" callToAction="pnpm odori dev" />
|
|
21
|
+
</Scene>
|
|
22
|
+
</Video>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {defineBrand, defineVideoLayout} from "odori";
|
|
2
|
+
|
|
3
|
+
export const productBrand = defineBrand({
|
|
4
|
+
name: "product",
|
|
5
|
+
colors: {
|
|
6
|
+
background: "#08090b",
|
|
7
|
+
surface: "#111318",
|
|
8
|
+
foreground: "#f7f8fa",
|
|
9
|
+
muted: "#9297a1",
|
|
10
|
+
accent: "#7c8cff",
|
|
11
|
+
border: "#292d36",
|
|
12
|
+
},
|
|
13
|
+
/**
|
|
14
|
+
* Sounds are named here, not in a composition, so re-scoring every video is
|
|
15
|
+
* one edit. The block starts empty on purpose: `odori add @odori/bed-pulse`
|
|
16
|
+
* writes into it, and without somewhere to write it can only print the two
|
|
17
|
+
* lines and ask you to paste them.
|
|
18
|
+
*/
|
|
19
|
+
audio: {cues: {}, targetLufs: -14},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
export const productLayout = defineVideoLayout({
|
|
23
|
+
format: {width: 1920, height: 1080, fps: 30},
|
|
24
|
+
brand: productBrand,
|
|
25
|
+
safeArea: {x: 96, y: 72},
|
|
26
|
+
});
|
package/README.md
DELETED
package/index.js
DELETED