@lalalic/markcut 2.8.0 → 3.0.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.
Files changed (41) hide show
  1. package/B] +2 -0
  2. package/README.md +29 -0
  3. package/package.json +1 -1
  4. package/skills/markcut/SKILL.md +12 -45
  5. package/skills/markcut/docs/components.md +89 -0
  6. package/skills/markcut/docs/markdown-descriptive.md +17 -2
  7. package/skills/markcut/docs/sound-effects.md +45 -0
  8. package/src/components/Markdown.tsx +138 -24
  9. package/src/components/Mermaid.tsx +223 -22
  10. package/src/config.mjs +2 -2
  11. package/src/context/EventContext.tsx +3 -0
  12. package/src/descriptive/compiler.ts +68 -29
  13. package/src/descriptive/markdown.ts +20 -0
  14. package/src/player/browser.tsx +95 -5
  15. package/src/player/bundle/player.js +1078 -629
  16. package/src/player/components/EditControls.tsx +6 -3
  17. package/src/player/components/EditMessagePanel.tsx +96 -0
  18. package/src/player/components/HeaderBar.tsx +9 -11
  19. package/src/player/components/index.ts +1 -0
  20. package/src/player/pipeline.mjs +72 -21
  21. package/src/player/server-shared.mjs +4 -1
  22. package/src/player/server.mjs +202 -42
  23. package/src/render/cli.mjs +1 -1
  24. package/src/schema/index.ts +4 -1
  25. package/src/types/Component.tsx +27 -1
  26. package/src/types/Effect.tsx +13 -6
  27. package/src/types/Folder.tsx +1 -1
  28. package/src/types/Map.tsx +51 -1
  29. package/src/utils/index.ts +14 -2
  30. package/tests/fixtures/md/animate-diagrams.md +40 -0
  31. package/tests/fixtures/md/electricity-grow.md +130 -0
  32. package/tests/tmp/vision-1785081637127-video/videos/.normalized/segments/test-clip_0to3_seg_1100to3000.mp4 +0 -0
  33. package/tests/tmp/vision-1785081637127-video/videos/.normalized/test-clip_0to3.mp4 +0 -0
  34. package/tests/tmp/vision-1785081637127-video/videos/.normalized/test-clip_audio.mp3 +0 -0
  35. package/tests/tmp/vision-1785081637127-video/videos/metadata.json +9 -0
  36. package/tests/tmp/vision-1785081637127-video/videos/test-clip.mp4 +0 -0
  37. package/tests/tmp/vision-1785081637127-video/videos/test-clip.vtt +5 -0
  38. package/tests/tmp/vision-1784830584961/images/.normalized/test-photo_384.jpg +0 -0
  39. package/tests/tmp/vision-1784830584961/images/metadata.json +0 -8
  40. package/tests/tmp/vision-1784830584961/images/test-photo.png +0 -0
  41. package/tmp/frontmatter-test.ts +0 -21
@@ -0,0 +1,130 @@
1
+ # video
2
+ seed:1793769080
3
+ width:640 height:480 fps:30 layout:series
4
+
5
+ ## Title
6
+ layout:parallel
7
+ - component duration:3
8
+ ~~~jsx jsx
9
+ <div style={{width:'100%',height:'100%',display:'flex',flexDirection:'column',alignItems:'center',justifyContent:'center',background:'linear-gradient(135deg,#0c0c1d,#1a1a3e)'}}>
10
+ <h1 style={{color:'#ffd700',fontSize:36,margin:0}}>Global Electricity Generation</h1>
11
+ <p style={{color:'#88ccff',fontSize:20,marginTop:10}}>1985 → 2025</p>
12
+ <p style={{color:'#aaa',fontSize:14,marginTop:20}}>Data: Ember / Energy Institute (Our World in Data)</p>
13
+ </div>
14
+ ~~~
15
+
16
+ ## ChinaSurge
17
+ layout:parallel
18
+ - component duration:6
19
+ ~~~jsx jsx
20
+ <div style={{width:'100%',height:'100%',background:'#0c0c1d',padding:20,fontFamily:'Arial,sans-serif'}}>
21
+ <h2 style={{color:'#ffd700',fontSize:18,textAlign:'center',margin:'0 0 10px 0'}}>China's Electricity Generation (TWh)</h2>
22
+ <svg viewBox='0 0 580 380' width='100%' height='85%'>
23
+ {[1985,1990,1995,2000,2005,2010,2015,2020,2025].map((year,i)=>(
24
+ <g key={year}>
25
+ <rect x={20+i*62} y={350-tween(0,{1985:42,1990:63,1995:97,2000:137,2005:253,2010:425,2015:625,2020:786,2025:1069}[year])} width={42} height={tween(0,{1985:42,1990:63,1995:97,2000:137,2005:253,2010:425,2015:625,2020:786,2025:1069}[year])} fill='#ff4444' rx={3} />
26
+ <text x={20+i*62+21} y={365} textAnchor='middle' fill='#aaa' fontSize={9}>{year}</text>
27
+ <text x={20+i*62+21} y={345-tween(0,{1985:42,1990:63,1995:97,2000:137,2005:253,2010:425,2015:625,2020:786,2025:1069}[year])} textAnchor='middle' fill='#ff8888' fontSize={9}>{Math.round({1985:411,1990:621,1995:928,2000:1356,2005:2500,2010:4207,2015:6186,2020:7779,2025:10583}[year])}</text>
28
+ </g>
29
+ ))}
30
+ <text x={10} y={20} fill='#666' fontSize={10}>TWh</text>
31
+ </svg>
32
+ </div>
33
+ ~~~
34
+
35
+ ## World1985
36
+ layout:parallel
37
+ - component duration:5
38
+ ~~~jsx jsx
39
+ <div style={{width:'100%',height:'100%',background:'#0c0c1d',padding:20,fontFamily:'Arial,sans-serif'}}>
40
+ <h2 style={{color:'#ffd700',fontSize:18,textAlign:'center',margin:'0 0 10px 0'}}>Electricity Generation in 1985 (TWh)</h2>
41
+ <svg viewBox='0 0 580 380' width='100%' height='85%'>
42
+ {[
43
+ {name:'USA',val:2657,color:'#4477ff',scale:266},
44
+ {name:'Russia',val:962,color:'#cc4444',scale:96},
45
+ {name:'Japan',val:672,color:'#44cc44',scale:67},
46
+ {name:'Germany',val:523,color:'#ffaa00',scale:52},
47
+ {name:'Canada',val:459,color:'#ff66aa',scale:46},
48
+ {name:'France',val:344,color:'#aa66ff',scale:34},
49
+ {name:'UK',val:298,color:'#66cccc',scale:30},
50
+ {name:'Brazil',val:194,color:'#66ff66',scale:19},
51
+ {name:'India',val:186,color:'#ff8844',scale:19},
52
+ {name:'China',val:411,color:'#ff4444',scale:41},
53
+ ].map((c,i)=>(
54
+ <g key={c.name}>
55
+ <rect x={20+i*54} y={350-tween(0,c.scale)} width={40} height={tween(0,c.scale)} fill={c.color} rx={3}>
56
+ <animate attributeName='opacity' values='0;1' dur='2s' fill='freeze'/>
57
+ </rect>
58
+ <text x={20+i*54+20} y={365} textAnchor='middle' fill='#aaa' fontSize={9}>{c.name}</text>
59
+ <text x={20+i*54+20} y={345-tween(0,c.scale)} textAnchor='middle' fill='#fff' fontSize={9}>{c.val}</text>
60
+ </g>
61
+ ))}
62
+ </svg>
63
+ </div>
64
+ ~~~
65
+
66
+ ## World2025
67
+ layout:parallel
68
+ - component duration:5
69
+ ~~~jsx jsx
70
+ <div style={{width:'100%',height:'100%',background:'#0c0c1d',padding:20,fontFamily:'Arial,sans-serif'}}>
71
+ <h2 style={{color:'#ffd700',fontSize:18,textAlign:'center',margin:'0 0 10px 0'}}>Electricity Generation in 2025 (TWh)</h2>
72
+ <svg viewBox='0 0 580 380' width='100%' height='85%'>
73
+ {[
74
+ {name:'China',val:10583,color:'#ff4444',scale:280},
75
+ {name:'USA',val:4520,color:'#4477ff',scale:120},
76
+ {name:'India',val:2082,color:'#ff8844',scale:55},
77
+ {name:'Russia',val:1193,color:'#cc4444',scale:32},
78
+ {name:'Japan',val:1030,color:'#44cc44',scale:27},
79
+ {name:'Brazil',val:751,color:'#66ff66',scale:20},
80
+ {name:'Canada',val:652,color:'#ff66aa',scale:17},
81
+ {name:'S.Korea',val:625,color:'#66cccc',scale:17},
82
+ {name:'Germany',val:500,color:'#ffaa00',scale:13},
83
+ {name:'France',val:570,color:'#aa66ff',scale:15},
84
+ ].map((c,i)=>(
85
+ <g key={c.name}>
86
+ <rect x={20+i*54} y={350-tween(0,c.scale)} width={40} height={tween(0,c.scale)} fill={c.color} rx={3}/>
87
+ <text x={20+i*54+20} y={365} textAnchor='middle' fill='#aaa' fontSize={9}>{c.name}</text>
88
+ <text x={20+i*54+20} y={345-tween(0,c.scale)} textAnchor='middle' fill='#fff' fontSize={9}>{c.val}</text>
89
+ </g>
90
+ ))}
91
+ </svg>
92
+ </div>
93
+ ~~~
94
+
95
+ ## GrowthComparison
96
+ layout:parallel
97
+ - component duration:6
98
+ ~~~jsx jsx
99
+ <div style={{width:'100%',height:'100%',background:'#0c0c1d',padding:20,fontFamily:'Arial,sans-serif'}}>
100
+ <h2 style={{color:'#ffd700',fontSize:18,textAlign:'center',margin:'0 0 10px 0'}}>Growth: 1985 → 2025 (TWh)</h2>
101
+ <svg viewBox='0 0 580 380' width='100%' height='85%'>
102
+ {[
103
+ {name:'China',v1985:411,v2025:10583,growth:'+10172',color:'#ff4444',s1985:11,s2025:280},
104
+ {name:'USA',v1985:2657,v2025:4520,growth:'+1863',color:'#4477ff',s1985:70,s2025:120},
105
+ {name:'India',v1985:186,v2025:2082,growth:'+1896',color:'#ff8844',s1985:5,s2025:55},
106
+ {name:'Brazil',v1985:194,v2025:751,growth:'+557',color:'#66ff66',s1985:5,s2025:20},
107
+ ].map((c,i)=>(
108
+ <g key={c.name}>
109
+ <text x={20} y={50+i*80} fill='#aaa' fontSize={14}>{c.name}</text>
110
+ <rect x={20} y={58+i*80} width={tween(0,c.s1985)} height={14} fill={c.color} opacity={0.6} rx={2}/>
111
+ <rect x={20+tween(0,c.s1985)} y={58+i*80} width={tween(0,c.s2025-c.s1985)} height={14} fill={c.color} rx={2}/>
112
+ <text x={20+tween(0,c.s2025)+5} y={70+i*80} fill='#fff' fontSize={11}>{c.v1985} → {c.v2025}</text>
113
+ <text x={20} y={86+i*80} fill='#ffd700' fontSize={10}>Growth: {c.growth} TWh</text>
114
+ </g>
115
+ ))}
116
+ <text x={20} y={370} fill='#666' fontSize={9}>1985 bar (dim) → 2025 bar (bright)</text>
117
+ </svg>
118
+ </div>
119
+ ~~~
120
+
121
+ ## Closing
122
+ layout:parallel
123
+ - component duration:3
124
+ ~~~jsx jsx
125
+ <div style={{width:'100%',height:'100%',display:'flex',flexDirection:'column',alignItems:'center',justifyContent:'center',background:'linear-gradient(135deg,#0c0c1d,#1a1a3e)'}}>
126
+ <h2 style={{color:'#ffd700',fontSize:24,margin:0}}>China leads at 10,583 TWh</h2>
127
+ <p style={{color:'#88ccff',fontSize:16,marginTop:10}}>nearly 25x growth since 1985</p>
128
+ <p style={{color:'#aaa',fontSize:12,marginTop:30}}>Data: Our World in Data · Ember (2026) / Energy Institute (2025)</p>
129
+ </div>
130
+ ~~~
@@ -0,0 +1,9 @@
1
+ {
2
+ "test-clip": {
3
+ "width": 320,
4
+ "height": 240,
5
+ "created": "0000-00-00T00:00:00Z",
6
+ "location": null,
7
+ "duration": 3
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ WEBVTT
2
+
3
+ 00:00.000 --> 00:01.100
4
+ Thank you.
5
+
@@ -1,8 +0,0 @@
1
- {
2
- "test-photo": {
3
- "width": 64,
4
- "height": 64,
5
- "created": null,
6
- "location": null
7
- }
8
- }
@@ -1,21 +0,0 @@
1
- import { parseMarkdownDescriptive } from '../src/descriptive/markdown';
2
- import { applyStoryboardOverrides } from '../src/descriptive/resolve';
3
- import { compileDescriptiveRoot } from '../src/descriptive/compiler';
4
-
5
- const md = [
6
- '---',
7
- 'title: "My Book"',
8
- 'author: John Doe',
9
- 'keywords: dog, confidence, training',
10
- '---',
11
- '# video',
12
- 'width:1080 height:1920 fps:30',
13
- '## Test',
14
- '- image prompt:"a cat" duration:3',
15
- ].join('\n');
16
-
17
- const root = parseMarkdownDescriptive(md);
18
- console.log('rawFrontmatter:', (root as any).rawFrontmatter);
19
- const r = applyStoryboardOverrides(root, { variants: ['default'] });
20
- const c = compileDescriptiveRoot(r);
21
- console.log('data:', JSON.stringify(c.children[0].data, null, 2));