kasaframe 0.0.0-stage → 0.1.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 +21 -0
- package/NOTICE +148 -0
- package/README.md +92 -2
- package/app/package.json +12 -0
- package/app/server/engine.ts +533 -0
- package/app/server/main.ts +209 -0
- package/app/web/env.d.ts +2 -0
- package/app/web/icons.ts +31 -0
- package/app/web/index.html +21 -0
- package/app/web/main.ts +1195 -0
- package/app/web/style.css +463 -0
- package/bin/hooks.mjs +64 -0
- package/bin/kf.mjs +32 -0
- package/docs/AGENTS.md +286 -0
- package/music/README.md +37 -0
- package/package.json +44 -4
- package/packages/adapters/package.json +36 -0
- package/packages/adapters/src/css.ts +11 -0
- package/packages/adapters/src/gsap.ts +26 -0
- package/packages/adapters/src/index.ts +9 -0
- package/packages/adapters/src/lottie.ts +22 -0
- package/packages/adapters/src/media.ts +59 -0
- package/packages/adapters/src/page.ts +229 -0
- package/packages/adapters/src/project.ts +214 -0
- package/packages/adapters/src/react.ts +36 -0
- package/packages/adapters/src/svelte.ts +22 -0
- package/packages/adapters/src/three.ts +18 -0
- package/packages/adapters/src/vue.ts +27 -0
- package/packages/check/package.json +19 -0
- package/packages/check/src/check.ts +280 -0
- package/packages/check/src/cli.ts +70 -0
- package/packages/check/src/image.ts +146 -0
- package/packages/check/src/index.ts +9 -0
- package/packages/check/src/ocr.swift +37 -0
- package/packages/check/src/probe.ts +328 -0
- package/packages/check/src/report.ts +44 -0
- package/packages/check/src/rules/assets.ts +45 -0
- package/packages/check/src/rules/beats.ts +212 -0
- package/packages/check/src/rules/camera.ts +217 -0
- package/packages/check/src/rules/captions.ts +49 -0
- package/packages/check/src/rules/flash.ts +235 -0
- package/packages/check/src/rules/frames.ts +136 -0
- package/packages/check/src/rules/layout.ts +281 -0
- package/packages/check/src/rules/page.ts +87 -0
- package/packages/check/src/rules/runs.ts +20 -0
- package/packages/check/src/rules/text.ts +326 -0
- package/packages/check/src/scan.ts +240 -0
- package/packages/check/src/serve.ts +67 -0
- package/packages/check/src/types.ts +80 -0
- package/packages/check/src/video.ts +137 -0
- package/packages/cli/package.json +30 -0
- package/packages/cli/src/blur.ts +80 -0
- package/packages/cli/src/browser.ts +203 -0
- package/packages/cli/src/command.ts +44 -0
- package/packages/cli/src/commands/app.ts +25 -0
- package/packages/cli/src/commands/beats.ts +36 -0
- package/packages/cli/src/commands/bench.ts +123 -0
- package/packages/cli/src/commands/blender.ts +293 -0
- package/packages/cli/src/commands/check.ts +25 -0
- package/packages/cli/src/commands/direct.ts +210 -0
- package/packages/cli/src/commands/doctor.ts +30 -0
- package/packages/cli/src/commands/gen.ts +173 -0
- package/packages/cli/src/commands/look.ts +46 -0
- package/packages/cli/src/commands/lyrics.ts +157 -0
- package/packages/cli/src/commands/make.ts +1121 -0
- package/packages/cli/src/commands/music.ts +78 -0
- package/packages/cli/src/commands/narrate.ts +238 -0
- package/packages/cli/src/commands/new.ts +185 -0
- package/packages/cli/src/commands/preview.ts +43 -0
- package/packages/cli/src/commands/render.ts +250 -0
- package/packages/cli/src/commands/series.ts +110 -0
- package/packages/cli/src/commands/setup.ts +102 -0
- package/packages/cli/src/commands/sheet.ts +114 -0
- package/packages/cli/src/commands/skill.ts +43 -0
- package/packages/cli/src/commands/still.ts +40 -0
- package/packages/cli/src/commands/theme.ts +172 -0
- package/packages/cli/src/commands/transitions.ts +40 -0
- package/packages/cli/src/deps.ts +122 -0
- package/packages/cli/src/ffmpeg.ts +81 -0
- package/packages/cli/src/index.ts +8 -0
- package/packages/cli/src/kf.ts +64 -0
- package/packages/cli/src/lock.ts +72 -0
- package/packages/cli/src/mix.ts +131 -0
- package/packages/cli/src/out.ts +13 -0
- package/packages/cli/src/pool.ts +34 -0
- package/packages/cli/src/segments.ts +402 -0
- package/packages/cli/src/serve.ts +124 -0
- package/packages/clock/package.json +14 -0
- package/packages/clock/src/index.ts +25 -0
- package/packages/clock/src/install.ts +351 -0
- package/packages/clock/src/types.ts +45 -0
- package/packages/core/package.json +9 -0
- package/packages/core/src/beats.ts +283 -0
- package/packages/core/src/ease.ts +87 -0
- package/packages/core/src/frame.ts +99 -0
- package/packages/core/src/index.ts +27 -0
- package/packages/core/src/project.ts +157 -0
- package/packages/core/src/rand.ts +56 -0
- package/packages/core/src/spring.ts +52 -0
- package/packages/core/src/style.ts +100 -0
- package/packages/core/src/time.ts +88 -0
- package/packages/director/package.json +23 -0
- package/packages/director/src/assemble.ts +361 -0
- package/packages/director/src/brief.ts +122 -0
- package/packages/director/src/catalog.ts +49 -0
- package/packages/director/src/content.ts +343 -0
- package/packages/director/src/fallback.ts +58 -0
- package/packages/director/src/index.ts +13 -0
- package/packages/director/src/pattern.ts +90 -0
- package/packages/director/src/patterns/fill/cells.ts +115 -0
- package/packages/director/src/patterns/formula/stack.ts +93 -0
- package/packages/director/src/patterns/util.ts +58 -0
- package/packages/director/src/scene.ts +62 -0
- package/packages/director/src/select.ts +163 -0
- package/packages/director/src/transitions.ts +115 -0
- package/packages/gen/PROVIDERS.md +90 -0
- package/packages/gen/package.json +9 -0
- package/packages/gen/src/ask.ts +132 -0
- package/packages/gen/src/audio.ts +91 -0
- package/packages/gen/src/blender.ts +54 -0
- package/packages/gen/src/capabilities.ts +151 -0
- package/packages/gen/src/generate.ts +206 -0
- package/packages/gen/src/image/codex.ts +117 -0
- package/packages/gen/src/image/og.ts +133 -0
- package/packages/gen/src/index.ts +26 -0
- package/packages/gen/src/keys.ts +86 -0
- package/packages/gen/src/media.ts +150 -0
- package/packages/gen/src/music/elevenlabs.ts +41 -0
- package/packages/gen/src/music/index.ts +120 -0
- package/packages/gen/src/music/library.ts +73 -0
- package/packages/gen/src/music/lyria.ts +52 -0
- package/packages/gen/src/music/types.ts +28 -0
- package/packages/gen/src/plan.ts +106 -0
- package/packages/gen/src/registry.ts +54 -0
- package/packages/gen/src/seam.ts +103 -0
- package/packages/gen/src/tts/dashscope.ts +64 -0
- package/packages/gen/src/tts/elevenlabs.ts +84 -0
- package/packages/gen/src/tts/gemini.ts +73 -0
- package/packages/gen/src/tts/index.ts +241 -0
- package/packages/gen/src/tts/local.ts +42 -0
- package/packages/gen/src/tts/types.ts +44 -0
- package/packages/gen/src/types.ts +90 -0
- package/packages/gen/src/video/fal.ts +140 -0
- package/packages/gen/src/video/h3.ts +112 -0
- package/packages/gen/src/video/http.ts +44 -0
- package/packages/gen/src/video/ltx.ts +60 -0
- package/packages/gen/src/video/minimax.ts +55 -0
- package/packages/gen/src/video/veo.ts +71 -0
- package/packages/jizura/package.json +16 -0
- package/packages/jizura/src/deny.ts +73 -0
- package/packages/jizura/src/index.ts +7 -0
- package/packages/jizura/src/install.ts +269 -0
- package/packages/jizura/src/layer.ts +325 -0
- package/packages/jizura/src/lyrics.ts +81 -0
- package/packages/jizura/src/pin.ts +8 -0
- package/packages/jizura/src/vendor.ts +140 -0
- package/packages/jizura/src/vite.ts +63 -0
- package/packages/jizura/vendor/JIZURA_LICENSE.txt +21 -0
- package/packages/jizura/vendor/NOTICE +43 -0
- package/packages/jizura/vendor/engine.json +47 -0
- package/packages/jizura/vendor/fonts/BlackHanSans-Regular.woff2 +0 -0
- package/packages/jizura/vendor/fonts/DotGothic16-Regular.woff2 +0 -0
- package/packages/jizura/vendor/fonts/GowunBatang-Bold.woff2 +0 -0
- package/packages/jizura/vendor/fonts/IBMPlexMono-Medium.ttf +0 -0
- package/packages/jizura/vendor/fonts/IBMPlexMono-SemiBold.ttf +0 -0
- package/packages/jizura/vendor/fonts/NotoSansKR-VF.woff2 +0 -0
- package/packages/jizura/vendor/fonts/NotoSerifKR-VF.woff2 +0 -0
- package/packages/jizura/vendor/fonts/OFL-blackhansans.txt +93 -0
- package/packages/jizura/vendor/fonts/OFL-dotgothic16.txt +93 -0
- package/packages/jizura/vendor/fonts/OFL-gowunbatang.txt +94 -0
- package/packages/jizura/vendor/fonts/OFL-ibmplexmono.txt +93 -0
- package/packages/jizura/vendor/fonts/OFL-notosanskr.txt +93 -0
- package/packages/jizura/vendor/fonts/OFL-notoserifkr.txt +94 -0
- package/packages/jizura/vendor/fonts/fonts.json +52 -0
- package/packages/jizura/vendor/jizura_engine.js +35024 -0
- package/packages/motion/README.md +153 -0
- package/packages/motion/package.json +30 -0
- package/packages/motion/src/camera.ts +97 -0
- package/packages/motion/src/captions.ts +487 -0
- package/packages/motion/src/enter.ts +128 -0
- package/packages/motion/src/hangul.ts +129 -0
- package/packages/motion/src/impact.ts +100 -0
- package/packages/motion/src/index.ts +17 -0
- package/packages/motion/src/moves/brushWipe.ts +103 -0
- package/packages/motion/src/moves/cloneArray.ts +111 -0
- package/packages/motion/src/moves/curtains.ts +81 -0
- package/packages/motion/src/moves/dress.ts +191 -0
- package/packages/motion/src/moves/echoStack.ts +70 -0
- package/packages/motion/src/moves/fit.ts +70 -0
- package/packages/motion/src/moves/flood.ts +61 -0
- package/packages/motion/src/moves/ghostStack.ts +88 -0
- package/packages/motion/src/moves/gridFloor.ts +100 -0
- package/packages/motion/src/moves/imageSwarm.ts +113 -0
- package/packages/motion/src/moves/index.ts +38 -0
- package/packages/motion/src/moves/irisBlades.ts +113 -0
- package/packages/motion/src/moves/karaokeLine.ts +108 -0
- package/packages/motion/src/moves/ledBoard.ts +94 -0
- package/packages/motion/src/moves/liquidTab.ts +72 -0
- package/packages/motion/src/moves/markerWrite.ts +63 -0
- package/packages/motion/src/moves/menu.ts +138 -0
- package/packages/motion/src/moves/morphBox.ts +96 -0
- package/packages/motion/src/moves/neonSign.ts +78 -0
- package/packages/motion/src/moves/panelPop.ts +78 -0
- package/packages/motion/src/moves/paperTear.ts +75 -0
- package/packages/motion/src/moves/path.ts +64 -0
- package/packages/motion/src/moves/pathText.ts +107 -0
- package/packages/motion/src/moves/pointSphere.ts +109 -0
- package/packages/motion/src/moves/ransomLetters.ts +73 -0
- package/packages/motion/src/moves/shapeMorph.ts +143 -0
- package/packages/motion/src/moves/slamWords.ts +96 -0
- package/packages/motion/src/moves/sparkTrail.ts +130 -0
- package/packages/motion/src/moves/speedLines.ts +91 -0
- package/packages/motion/src/moves/splitFlap.ts +149 -0
- package/packages/motion/src/moves/stepWords.ts +128 -0
- package/packages/motion/src/moves/strikeOut.ts +98 -0
- package/packages/motion/src/moves/sunburst.ts +58 -0
- package/packages/motion/src/moves/tickerRows.ts +91 -0
- package/packages/motion/src/moves/tokenPicker.ts +115 -0
- package/packages/motion/src/moves/truchet.ts +85 -0
- package/packages/motion/src/moves/wordWall.ts +78 -0
- package/packages/motion/src/moves/worldRoll.ts +32 -0
- package/packages/motion/src/particles.ts +102 -0
- package/packages/motion/src/react/index.tsx +21 -0
- package/packages/motion/src/react/parts.tsx +431 -0
- package/packages/motion/src/react/time.tsx +97 -0
- package/packages/motion/src/text.ts +103 -0
- package/packages/motion/src/transition.ts +82 -0
- package/packages/motion/src/transition3d/cards.ts +65 -0
- package/packages/motion/src/transition3d/chain.ts +84 -0
- package/packages/motion/src/transition3d/dive.ts +181 -0
- package/packages/motion/src/transition3d/fold.ts +110 -0
- package/packages/motion/src/transition3d/gl.ts +219 -0
- package/packages/motion/src/transition3d/index.ts +235 -0
- package/packages/motion/src/transition3d/live.ts +70 -0
- package/packages/motion/src/transition3d/portal.ts +115 -0
- package/packages/motion/src/transition3d/react.tsx +29 -0
- package/packages/motion/src/transition3d/rig.ts +600 -0
- package/packages/motion/src/transition3d/shatter.ts +104 -0
- package/packages/motion/src/transition3d/space.ts +173 -0
- package/packages/motion/src/transition3d/whip.ts +78 -0
- package/packages/motion/src/transition3d/world.ts +737 -0
- package/packages/motion/src/transition3d/zoomOut.ts +114 -0
- package/packages/motion/src/transitions2d/catalog.ts +127 -0
- package/packages/motion/src/transitions2d/css.d.ts +2 -0
- package/packages/motion/src/transitions2d/cult-ui/LICENSE.md +9 -0
- package/packages/motion/src/transitions2d/cult-ui/RollingNumber.tsx +43 -0
- package/packages/motion/src/transitions2d/gl-transitions/LICENSE +25 -0
- package/packages/motion/src/transitions2d/gl-transitions/shaders.ts +1931 -0
- package/packages/motion/src/transitions2d/index.ts +2 -0
- package/packages/motion/src/transitions2d/kokonutui/LICENSE +21 -0
- package/packages/motion/src/transitions2d/kokonutui/MatrixText.css +16 -0
- package/packages/motion/src/transitions2d/kokonutui/MatrixText.tsx +94 -0
- package/packages/motion/src/transitions2d/magicui/HyperText.css +15 -0
- package/packages/motion/src/transitions2d/magicui/HyperText.tsx +115 -0
- package/packages/motion/src/transitions2d/magicui/LICENSE.md +21 -0
- package/packages/motion/src/transitions2d/magicui/MorphingText.css +25 -0
- package/packages/motion/src/transitions2d/magicui/MorphingText.tsx +130 -0
- package/packages/motion/src/transitions2d/magicui/WordRotate.tsx +42 -0
- package/packages/motion/src/transitions2d/react.ts +13 -0
- package/packages/motion/src/transitions2d/skiper-ui/ClipDiv.css +39 -0
- package/packages/motion/src/transitions2d/skiper-ui/ClipDiv.tsx +32 -0
- package/packages/motion/src/transitions2d/smoothui/LICENSE +21 -0
- package/packages/motion/src/transitions2d/smoothui/SharedAxisY.tsx +50 -0
- package/packages/motion/src/transitions2d/smoothui/TextMorph.tsx +90 -0
- package/packages/motion/src/transitions2d/smoothui/shaders.ts +223 -0
- package/packages/motion/src/transitions2d/unlumen/LICENSE +21 -0
- package/packages/motion/src/transitions2d/unlumen/ScrambleText.tsx +114 -0
- package/packages/motion/src/transitions2d/vengeance-ui/LICENSE +21 -0
- package/packages/motion/src/transitions2d/vengeance-ui/MorphText.css +69 -0
- package/packages/motion/src/transitions2d/vengeance-ui/MorphText.tsx +45 -0
- package/packages/motion/src/type.ts +131 -0
- package/packages/motion/src/ui.ts +172 -0
- package/packages/patterns/package.json +15 -0
- package/packages/patterns/src/bars/rank.ts +119 -0
- package/packages/patterns/src/before-after/shrink.ts +127 -0
- package/packages/patterns/src/before-after/strike.ts +125 -0
- package/packages/patterns/src/code/terminal.ts +133 -0
- package/packages/patterns/src/compare/bars.ts +142 -0
- package/packages/patterns/src/compare/duel.ts +103 -0
- package/packages/patterns/src/end/lockup.ts +85 -0
- package/packages/patterns/src/end/slam.ts +91 -0
- package/packages/patterns/src/flow/graph.ts +250 -0
- package/packages/patterns/src/hook-number/counter.ts +101 -0
- package/packages/patterns/src/hook-number/roll.ts +179 -0
- package/packages/patterns/src/hook-number/slam.ts +91 -0
- package/packages/patterns/src/index.ts +38 -0
- package/packages/patterns/src/kit.ts +449 -0
- package/packages/patterns/src/limit/gauge.ts +117 -0
- package/packages/patterns/src/list/cards.ts +131 -0
- package/packages/patterns/src/list/cycle.ts +22 -0
- package/packages/patterns/src/media/panels.ts +100 -0
- package/packages/patterns/src/objects.ts +234 -0
- package/packages/patterns/src/quote/karaoke.ts +126 -0
- package/packages/patterns/src/quote/slam.ts +22 -0
- package/packages/patterns/src/screen/focus.ts +85 -0
- package/packages/patterns/src/steps/path.ts +137 -0
- package/packages/patterns/src/steps/stack.ts +111 -0
- package/packages/patterns/src/term-reveal/chips.ts +92 -0
- package/packages/patterns/src/term-reveal/expand.ts +127 -0
- package/packages/patterns/src/timeline/axis.ts +144 -0
- package/packages/patterns/src/title/mask.ts +85 -0
- package/packages/patterns/src/title/slam.ts +23 -0
- package/packages/patterns/src/toggle-sim/switch.ts +92 -0
- package/packages/patterns/src/trend/columns.ts +108 -0
- package/packages/patterns/src/trend/draw.ts +140 -0
- package/packages/patterns/src/types.ts +67 -0
- package/packages/patterns/src/words/moves.ts +42 -0
- package/packages/patterns/src/words/slam.ts +4 -0
- package/packages/plan/package.json +15 -0
- package/packages/plan/src/asks.ts +256 -0
- package/packages/plan/src/brief.ts +383 -0
- package/packages/plan/src/captions.ts +78 -0
- package/packages/plan/src/detect.ts +93 -0
- package/packages/plan/src/index.ts +27 -0
- package/packages/plan/src/layout.ts +176 -0
- package/packages/plan/src/llm.ts +172 -0
- package/packages/plan/src/look.ts +222 -0
- package/packages/plan/src/plan.ts +179 -0
- package/packages/plan/src/request.ts +55 -0
- package/packages/plan/src/series.ts +76 -0
- package/packages/plan/src/studio.ts +53 -0
- package/packages/plan/src/templates.ts +42 -0
- package/packages/plan/src/themes.ts +48 -0
- package/packages/plan/src/types.ts +157 -0
- package/packages/studio/package.json +12 -0
- package/packages/studio/src/index.ts +1 -0
- package/packages/studio/src/plugin.ts +236 -0
- package/packages/studio/src/ui/main.ts +503 -0
- package/packages/studio/src/ui/studio.css +165 -0
- package/packages/studio/src/ui/timeline.ts +317 -0
- package/packages/themes/kit/THEME-MAKE.md +68 -0
- package/packages/themes/kit/THEME.md +30 -0
- package/packages/themes/kit/briefs/og-intro-15s/brief.json +16 -0
- package/packages/themes/kit/briefs/og-intro-15s/facts.ts +29 -0
- package/packages/themes/kit/briefs/og-intro-15s/logo.svg +12 -0
- package/packages/themes/kit/effects.ts +5 -0
- package/packages/themes/kit/sample/index.html +11 -0
- package/packages/themes/kit/sample/main.ts +9 -0
- package/packages/themes/kit/sample/scenes/scene.ts +15 -0
- package/packages/themes/package.json +19 -0
- package/packages/themes/src/factory.ts +296 -0
- package/packages/themes/src/fx.ts +14 -0
- package/packages/themes/src/index.ts +114 -0
- package/packages/themes/src/slotkit.ts +79 -0
- package/packages/themes/src/slots.ts +46 -0
- package/packages/themes/src/stage3d.ts +197 -0
- package/packages/themes/src/types.ts +58 -0
- package/presets/kawaii-pastel.json +94 -0
- package/presets/neutral-dark.json +82 -0
- package/presets/og.json +98 -0
- package/series/og-shorts.json +14 -0
- package/skills/kasaframe/SKILL.md +33 -0
- package/templates/_shared/project/index.html +11 -0
- package/templates/_shared/project/lib/react.ts +22 -0
- package/templates/_shared/project/lib/stage.ts +292 -0
- package/templates/_shared/project/main.ts +9 -0
- package/templates/_shared/scenes/default.ts +21 -0
- package/templates/_shared/scenes/drop.ts +33 -0
- package/templates/_shared/scenes/end.ts +26 -0
- package/templates/_shared/scenes/hook.ts +18 -0
- package/templates/_shared/scenes/seam.ts +41 -0
- package/templates/_shared/scenes/step.ts +49 -0
- package/templates/ad/preview.png +0 -0
- package/templates/ad/template.json +151 -0
- package/templates/demo/preview.png +0 -0
- package/templates/demo/template.json +141 -0
- package/templates/explainer/preview.png +0 -0
- package/templates/explainer/template.json +193 -0
- package/templates/launch/preview.png +0 -0
- package/templates/launch/template.json +163 -0
- package/templates/mv/preview.png +0 -0
- package/templates/mv/scenes/default.ts +98 -0
- package/templates/mv/template.json +178 -0
- package/templates/promo/preview.png +0 -0
- package/templates/promo/template.json +185 -0
- package/templates/shorts/preview.png +0 -0
- package/templates/shorts/scenes/hook.ts +37 -0
- package/templates/shorts/template.json +196 -0
- package/templates/square/preview.png +0 -0
- package/templates/square/template.json +133 -0
- package/themes/debug-hud/THEME.md +39 -0
- package/themes/debug-hud/effects.ts +389 -0
- package/themes/debug-hud/sample/assets/og/logo.svg +12 -0
- package/themes/debug-hud/sample/beats.json +1 -0
- package/themes/debug-hud/sample/index.html +11 -0
- package/themes/debug-hud/sample/kf.json +59 -0
- package/themes/debug-hud/sample/lib/hudkit.ts +49 -0
- package/themes/debug-hud/sample/lib/og.ts +29 -0
- package/themes/debug-hud/sample/main.ts +9 -0
- package/themes/debug-hud/sample/scenes/end.ts +62 -0
- package/themes/debug-hud/sample/scenes/gather.ts +67 -0
- package/themes/debug-hud/sample/scenes/models.ts +70 -0
- package/themes/debug-hud/sample/scenes/price.ts +79 -0
- package/themes/debug-hud/sample/style.json +91 -0
- package/themes/debug-hud/slots.ts +99 -0
- package/themes/debug-hud/still.png +0 -0
- package/themes/debug-hud/style.json +91 -0
- package/themes/debug-hud/theme.json +68 -0
- package/themes/og-measure/THEME.md +47 -0
- package/themes/og-measure/effects.ts +432 -0
- package/themes/og-measure/sample/assets/brand/og-logo-full.svg +12 -0
- package/themes/og-measure/sample/assets/brand/og-logo.svg +12 -0
- package/themes/og-measure/sample/assets/data/measure.json +353 -0
- package/themes/og-measure/sample/beats.json +1 -0
- package/themes/og-measure/sample/index.html +11 -0
- package/themes/og-measure/sample/kf.json +66 -0
- package/themes/og-measure/sample/lib/data.ts +62 -0
- package/themes/og-measure/sample/main.ts +9 -0
- package/themes/og-measure/sample/measure.ts +78 -0
- package/themes/og-measure/sample/scenes/end.ts +47 -0
- package/themes/og-measure/sample/scenes/gather.ts +51 -0
- package/themes/og-measure/sample/scenes/models.ts +34 -0
- package/themes/og-measure/sample/scenes/one.ts +39 -0
- package/themes/og-measure/sample/scenes/price.ts +56 -0
- package/themes/og-measure/sample/style.json +97 -0
- package/themes/og-measure/slots.ts +88 -0
- package/themes/og-measure/still.png +0 -0
- package/themes/og-measure/style.json +97 -0
- package/themes/og-measure/theme.json +79 -0
- package/themes/riso-zine/THEME.md +43 -0
- package/themes/riso-zine/effects.ts +321 -0
- package/themes/riso-zine/sample/assets/og/logo.svg +12 -0
- package/themes/riso-zine/sample/beats.json +1 -0
- package/themes/riso-zine/sample/index.html +11 -0
- package/themes/riso-zine/sample/kf.json +59 -0
- package/themes/riso-zine/sample/lib/og.ts +29 -0
- package/themes/riso-zine/sample/lib/shot.ts +86 -0
- package/themes/riso-zine/sample/lib/zine.ts +42 -0
- package/themes/riso-zine/sample/main.ts +9 -0
- package/themes/riso-zine/sample/scenes/end.ts +61 -0
- package/themes/riso-zine/sample/scenes/gather.ts +62 -0
- package/themes/riso-zine/sample/scenes/models.ts +52 -0
- package/themes/riso-zine/sample/scenes/price.ts +82 -0
- package/themes/riso-zine/sample/style.json +99 -0
- package/themes/riso-zine/slots.ts +81 -0
- package/themes/riso-zine/still.png +0 -0
- package/themes/riso-zine/style.json +99 -0
- package/themes/riso-zine/theme.json +75 -0
- package/tools/beats/beats.py +372 -0
- package/tools/beats/requirements.txt +3 -0
- package/tools/lyrics/align.py +164 -0
- package/tools/lyrics/requirements.txt +9 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { basename, extname, isAbsolute, join, resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
6
|
+
import { checkTheme, themesDir } from "./index.ts";
|
|
7
|
+
import type { ThemeManifest, ThemeStatus } from "./types.ts";
|
|
8
|
+
|
|
9
|
+
// 테마 공장 — 참고 자료에서 테마 팩 뼈대와 지시서(THEME-MAKE.md)를 짓고, 계약을 검사하고, 견본을 review 로 올린다.
|
|
10
|
+
// 테마를 만드는 건 지시서를 받은 모델 세션이다. 공장은 그 세션이 매번 같은 틀·같은 브리프·같은 검사로 끝나게 하는 몫.
|
|
11
|
+
|
|
12
|
+
export const kitDir = fileURLToPath(new URL("../kit/", import.meta.url));
|
|
13
|
+
const repoRoot = resolve(themesDir, "..");
|
|
14
|
+
const kfBin = join(repoRoot, "packages/cli/src/kf.ts");
|
|
15
|
+
|
|
16
|
+
const IMAGE = new Set([".png", ".jpg", ".jpeg", ".webp", ".gif", ".svg", ".avif"]);
|
|
17
|
+
const VIDEO = new Set([".mp4", ".mov", ".webm", ".mkv", ".m4v"]);
|
|
18
|
+
const KOREAN = /Pretendard|Noto Sans KR|Apple SD Gothic Neo|Jua|Galmuri|DungGeunMo|NeoDunggeunmo/;
|
|
19
|
+
// 장면 뼈대에 남겨 둔 표시 — 이게 남아 있으면 장면을 아직 안 썼다
|
|
20
|
+
const SKELETON = "THEME-MAKE.md 5단계에서 이 파일을 통째로 다시 쓴다";
|
|
21
|
+
|
|
22
|
+
export interface BriefKit {
|
|
23
|
+
id: string;
|
|
24
|
+
doc: string;
|
|
25
|
+
label: string;
|
|
26
|
+
share: string;
|
|
27
|
+
music: string;
|
|
28
|
+
from: number;
|
|
29
|
+
to: number;
|
|
30
|
+
assets: Record<string, string>;
|
|
31
|
+
scenes: { id: string; role: string; until: string; idea: string }[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export const briefs = (): string[] => readdirSync(join(kitDir, "briefs")).filter((d) => existsSync(join(kitDir, "briefs", d, "brief.json")));
|
|
35
|
+
|
|
36
|
+
export function loadBrief(id: string): BriefKit {
|
|
37
|
+
const file = join(kitDir, "briefs", id, "brief.json");
|
|
38
|
+
if (!existsSync(file)) throw new Error(`브리프 "${id}" 가 없다. 있는 브리프: ${briefs().join(" ")}`);
|
|
39
|
+
return JSON.parse(readFileSync(file, "utf8")) as BriefKit;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const tilde = (p: string) => (p.startsWith("~/") ? join(homedir(), p.slice(2)) : p);
|
|
43
|
+
const fill = (s: string, v: Record<string, string>) => s.replace(/\{\{(\w+)\}\}/g, (_, k: string) => v[k] ?? `{{${k}}}`);
|
|
44
|
+
const writeJson = (file: string, v: unknown) => writeFileSync(file, `${JSON.stringify(v, null, 2)}\n`);
|
|
45
|
+
const readJson = <T>(file: string): T => JSON.parse(readFileSync(file, "utf8")) as T;
|
|
46
|
+
|
|
47
|
+
function run(cmd: string, args: string[], quiet = false): number {
|
|
48
|
+
const r = spawnSync(cmd, args, { cwd: repoRoot, stdio: quiet ? ["ignore", "ignore", "inherit"] : "inherit" });
|
|
49
|
+
return r.status ?? 1;
|
|
50
|
+
}
|
|
51
|
+
const kf = (args: string[], quiet = false) => run(process.execPath, [kfBin, ...args], quiet);
|
|
52
|
+
|
|
53
|
+
const THREE_NOTE = `
|
|
54
|
+
## 입체(three.js) 테마 — 평면이 아니라 깊이·원근·빛으로 선다
|
|
55
|
+
|
|
56
|
+
- 바탕은 \`@kasaframe/themes/stage3d\`: \`stage3d(root, { ctx, camera: "perspective" | "ortho", fog, env, shot(t, camera) })\` 가 무대(씬·카메라·\`add(rig)\`·\`paint(t)\`)를 주고, 렌더러는 페이지에 하나를 돌려 쓴다(크롬은 한 페이지에 WebGL 문맥을 16 개쯤만 살린다). \`textPlane({ text, family, color, height })\` 은 한글이 서는 글꼴로 그린 글자판, \`roomEnvironment(renderer)\` 는 금속·유리가 비칠 환경광, \`roundRectShape\` 는 OG 로고의 둥근 사각 칸 꼴. \`THREE\` 도 거기서 다시 내보낸다.
|
|
57
|
+
- 테마 효과 중 3D 부품은 kind \`rig\` = \`(stage, opts) => (t) => void\` — 무대에 물체를 얹고 t 로 움직인다. 카메라·빛·재질 값을 **전부 t 로** 정한다 — \`THREE.Clock\`·\`requestAnimationFrame\`·누적 회전 금지.
|
|
58
|
+
- 카메라 경로는 \`flyPath\`(@kasaframe/motion) 나 닫힌 식. 마디마다 컷(카메라를 새 자리로 끊어 옮기거나 다른 세트로), 박마다 큰 사건(물체가 날아들고·켜지고·갈라지고).
|
|
59
|
+
- 화면 글은 3D 공간 안의 글자판으로. 검사의 화면 글 훑기는 WebGL 안 글을 못 읽으니, 끝 카드처럼 꼭 읽혀야 하는 글은 DOM 으로 겹쳐 둬도 된다.
|
|
60
|
+
- 헤드리스 크롬은 GPU 없이 SwiftShader 로 그린다 — 한 프레임 50ms 안을 넘지 않게 정점 수·그림자 맵·후처리를 아낀다. 큰 원통·구는 분할 수를 낮게, 그림자는 하나. 투과 유리(\`MeshPhysicalMaterial.transmission\`)는 그리기를 한 번 더 하니 한 화면에 몇 개만.
|
|
61
|
+
- 컷은 씬 안 오브젝트의 \`visible\` 로(CSS 가 아니다).
|
|
62
|
+
`;
|
|
63
|
+
|
|
64
|
+
export interface ScaffoldOpts {
|
|
65
|
+
refs: string[];
|
|
66
|
+
name?: string;
|
|
67
|
+
brief?: string;
|
|
68
|
+
like?: string;
|
|
69
|
+
kind?: "flat" | "3d";
|
|
70
|
+
force?: boolean;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** themes/<id>/ 를 짓는다 — 계약 파일 뼈대 · refs/ · 브리프대로 자른 곡과 박 · 장면 넷 뼈대 · THEME-MAKE.md */
|
|
74
|
+
export function scaffold(id: string, o: ScaffoldOpts): { dir: string; make: string; refs: string[]; urls: string[] } {
|
|
75
|
+
if (!/^[a-z][a-z0-9-]{1,40}$/.test(id)) throw new Error(`테마 id 는 소문자·숫자·하이픈(첫 글자는 영문): "${id}"`);
|
|
76
|
+
const dir = join(themesDir, id);
|
|
77
|
+
if (existsSync(dir) && readdirSync(dir).length && !o.force) throw new Error(`${dir} 가 이미 있다 — 덮어쓰려면 --force`);
|
|
78
|
+
const brief = loadBrief(o.brief ?? "og-intro-15s");
|
|
79
|
+
const like = o.like && existsSync(join(themesDir, o.like, "style.json")) ? o.like : null;
|
|
80
|
+
mkdirSync(join(dir, "refs", "frames"), { recursive: true });
|
|
81
|
+
|
|
82
|
+
// 참고 자료 — 파일·폴더는 복사, 영상은 장면 여섯 장을 뽑고, 주소는 목록으로
|
|
83
|
+
const files: string[] = [];
|
|
84
|
+
const urls: string[] = [];
|
|
85
|
+
const take = (src: string) => {
|
|
86
|
+
const ext = extname(src).toLowerCase();
|
|
87
|
+
if (!IMAGE.has(ext) && !VIDEO.has(ext)) return;
|
|
88
|
+
const name = basename(src).replace(/[^\w.가-힣-]/g, "_");
|
|
89
|
+
copyFileSync(src, join(dir, "refs", name));
|
|
90
|
+
files.push(`refs/${name}`);
|
|
91
|
+
if (VIDEO.has(ext)) {
|
|
92
|
+
const probe = spawnSync("ffprobe", ["-v", "error", "-show_entries", "format=duration", "-of", "csv=p=0", src], { encoding: "utf8" });
|
|
93
|
+
const dur = Number(probe.stdout) || 6;
|
|
94
|
+
for (let k = 1; k <= 6; k++) {
|
|
95
|
+
const out = join(dir, "refs", "frames", `${name.replace(/\.\w+$/, "")}-${k}.jpg`);
|
|
96
|
+
spawnSync("ffmpeg", ["-v", "error", "-y", "-ss", String((dur * k) / 7), "-i", src, "-frames:v", "1", "-vf", "scale=960:-2", out]);
|
|
97
|
+
if (existsSync(out)) files.push(`refs/frames/${basename(out)}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
for (const r of o.refs) {
|
|
102
|
+
if (/^https?:\/\//.test(r)) {
|
|
103
|
+
urls.push(r);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
const p = resolve(tilde(r));
|
|
107
|
+
if (!existsSync(p)) throw new Error(`참고 자료가 없다: ${r}`);
|
|
108
|
+
if (statSync(p).isDirectory()) for (const f of readdirSync(p)) take(join(p, f));
|
|
109
|
+
else take(p);
|
|
110
|
+
}
|
|
111
|
+
writeJson(join(dir, "refs", "refs.json"), { files, urls });
|
|
112
|
+
|
|
113
|
+
const name = o.name ?? id;
|
|
114
|
+
writeJson(join(dir, "theme.json"), {
|
|
115
|
+
id,
|
|
116
|
+
name,
|
|
117
|
+
metaphor: "",
|
|
118
|
+
status: "draft",
|
|
119
|
+
approvedAt: null,
|
|
120
|
+
purposes: [],
|
|
121
|
+
aspect: ["16:9"],
|
|
122
|
+
effects: [],
|
|
123
|
+
} satisfies ThemeManifest);
|
|
124
|
+
const base = like ? readJson<Record<string, unknown>>(join(themesDir, like, "style.json")) : readJson<Record<string, unknown>>(join(repoRoot, "presets", "neutral-dark.json"));
|
|
125
|
+
writeJson(join(dir, "style.json"), { ...base, name: id, label: name, notes: [`뼈대: ${like ? `테마 ${like}` : "presets/neutral-dark"} 에서 — 3단계에서 통째로 바꾼다`] });
|
|
126
|
+
const vars = { id, name, brief: `${brief.label}(${brief.doc}), 곡 ${basename(brief.music)} ${brief.from}–${brief.to}초`, share: brief.share };
|
|
127
|
+
writeFileSync(join(dir, "THEME.md"), fill(readFileSync(join(kitDir, "THEME.md"), "utf8"), vars));
|
|
128
|
+
writeFileSync(join(dir, "effects.ts"), fill(readFileSync(join(kitDir, "effects.ts"), "utf8"), vars));
|
|
129
|
+
|
|
130
|
+
// 견본 뼈대 — 곡을 브리프 구간으로 자르고 박을 재서 장면 경계를 마디·드롭에 붙인다
|
|
131
|
+
const sample = join(dir, "sample");
|
|
132
|
+
mkdirSync(join(sample, "scenes"), { recursive: true });
|
|
133
|
+
mkdirSync(join(sample, "lib"), { recursive: true });
|
|
134
|
+
mkdirSync(join(sample, "assets", "music"), { recursive: true });
|
|
135
|
+
// 브리프의 곡은 곡 모음(music/·KF_MUSIC_DIR) 안 이름 — 절대 경로·~/ 도 받는다
|
|
136
|
+
const song = isAbsolute(tilde(brief.music)) ? tilde(brief.music) : join(process.env.KF_MUSIC_DIR ?? join(repoRoot, "music"), brief.music);
|
|
137
|
+
const dur = +(brief.to - brief.from).toFixed(4);
|
|
138
|
+
const cut = `${basename(song).replace(/\.\w+$/, "")}-${String(Math.round(brief.from * 100)).padStart(4, "0")}.mp3`;
|
|
139
|
+
spawnSync("ffmpeg", ["-v", "error", "-y", "-ss", String(brief.from), "-t", String(dur), "-i", song, "-af", `afade=t=in:d=0.03,afade=t=out:st=${dur - 0.3}:d=0.3`, "-c:a", "libmp3lame", "-b:a", "192k", join(sample, "assets", "music", cut)]);
|
|
140
|
+
if (kf(["beats", song, "--from", String(brief.from), "--duration", String(dur), "--out", join(sample, "beats.json")], true) !== 0) throw new Error("kf beats 가 실패했다");
|
|
141
|
+
const beats = readJson<{ bars: number[]; drops: number[]; source: string; from: number }>(join(sample, "beats.json"));
|
|
142
|
+
writeJson(join(sample, "beats.json"), { ...beats, source: `assets/music/${cut}`, from: 0 });
|
|
143
|
+
const edge = (until: string): number => {
|
|
144
|
+
if (until === "end") return dur;
|
|
145
|
+
const [kind, v] = until.split(":");
|
|
146
|
+
if (kind === "drop") return beats.drops[Number(v)] ?? dur / 2;
|
|
147
|
+
const want = Number(v);
|
|
148
|
+
return beats.bars.reduce((a, b) => (Math.abs(b - want) < Math.abs(a - want) ? b : a), beats.bars[0] ?? want);
|
|
149
|
+
};
|
|
150
|
+
let from = 0;
|
|
151
|
+
const scenes = brief.scenes.map((s) => {
|
|
152
|
+
const to = +edge(s.until).toFixed(4);
|
|
153
|
+
const e = { id: s.id, from, dur: +(to - from).toFixed(4), file: `scenes/${s.id}.ts`, role: s.role, idea: s.idea };
|
|
154
|
+
from = to;
|
|
155
|
+
return e;
|
|
156
|
+
});
|
|
157
|
+
writeJson(join(sample, "kf.json"), {
|
|
158
|
+
template: "promo",
|
|
159
|
+
title: `${id} · ${brief.label}`,
|
|
160
|
+
theme: id,
|
|
161
|
+
fps: 60,
|
|
162
|
+
width: 1920,
|
|
163
|
+
height: 1080,
|
|
164
|
+
duration: dur,
|
|
165
|
+
mode: "seek",
|
|
166
|
+
style: "style.json",
|
|
167
|
+
music: `assets/music/${cut}`,
|
|
168
|
+
beats: "beats.json",
|
|
169
|
+
captions: "none",
|
|
170
|
+
safeArea: { top: 60, bottom: 60, left: 80, right: 80 },
|
|
171
|
+
text: { policy: "terms-only", maxOnScreen: 0, minPx: 0 },
|
|
172
|
+
scenes,
|
|
173
|
+
});
|
|
174
|
+
copyFileSync(join(dir, "style.json"), join(sample, "style.json"));
|
|
175
|
+
writeFileSync(join(sample, "index.html"), fill(readFileSync(join(kitDir, "sample", "index.html"), "utf8"), vars));
|
|
176
|
+
copyFileSync(join(kitDir, "sample", "main.ts"), join(sample, "main.ts"));
|
|
177
|
+
const sceneKit = readFileSync(join(kitDir, "sample", "scenes", "scene.ts"), "utf8");
|
|
178
|
+
for (const s of scenes) writeFileSync(join(sample, s.file), fill(sceneKit, { ...vars, scene: s.id, idea: s.idea }));
|
|
179
|
+
copyFileSync(join(kitDir, "briefs", brief.id, "facts.ts"), join(sample, "lib", "facts.ts"));
|
|
180
|
+
for (const [to, src] of Object.entries(brief.assets)) {
|
|
181
|
+
mkdirSync(join(sample, "assets", to, ".."), { recursive: true });
|
|
182
|
+
copyFileSync(join(kitDir, "briefs", brief.id, src), join(sample, "assets", to));
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const make = join(dir, "THEME-MAKE.md");
|
|
186
|
+
const refsLine = [...files.map((f) => `\`${f}\``), ...urls.map((u) => `<${u}>`)].join(" · ") || "(없음 — 브리프와 approved 테마만 보고 정한다)";
|
|
187
|
+
writeFileSync(
|
|
188
|
+
make,
|
|
189
|
+
fill(readFileSync(join(kitDir, "THEME-MAKE.md"), "utf8"), {
|
|
190
|
+
...vars,
|
|
191
|
+
refs: refsLine,
|
|
192
|
+
like: like ?? "(없음)",
|
|
193
|
+
briefDoc: brief.doc,
|
|
194
|
+
kindNote: o.kind === "3d" ? THREE_NOTE : "",
|
|
195
|
+
}),
|
|
196
|
+
);
|
|
197
|
+
return { dir, make, refs: files, urls };
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** 계약 + 지시서가 남긴 빈칸까지 — 견본 페이지 검사(kf check)는 따로 */
|
|
201
|
+
export async function staticCheck(id: string): Promise<string[]> {
|
|
202
|
+
const dir = join(themesDir, id);
|
|
203
|
+
if (!existsSync(join(dir, "theme.json"))) return [`themes/${id} 가 없다`];
|
|
204
|
+
const bad = checkTheme(dir);
|
|
205
|
+
const m = readJson<ThemeManifest>(join(dir, "theme.json"));
|
|
206
|
+
const guide = existsSync(join(dir, "THEME.md")) ? readFileSync(join(dir, "THEME.md"), "utf8") : "";
|
|
207
|
+
if (/TODO/.test(guide)) bad.push("THEME.md 에 TODO 가 남았다");
|
|
208
|
+
// 머리말 꼴은 공장이 지은 테마(지시서가 있는 것)에만 — 공장 전에 손으로 만든 테마는 꼴이 다를 수 있다
|
|
209
|
+
if (existsSync(join(dir, "THEME-MAKE.md"))) for (const h of ["**비유:", "## 맞는 내용·용도", "## 금지", "## 움직임", "## 효과"]) if (!guide.includes(h)) bad.push(`THEME.md 에 「${h.replace(/\*/g, "")}」 가 없다`);
|
|
210
|
+
if (existsSync(join(dir, "refs")) && !existsSync(join(dir, "refs", "NOTES.md"))) bad.push("refs/NOTES.md 가 없다 — 참고 자료에서 본 것을 적는다(2단계)");
|
|
211
|
+
try {
|
|
212
|
+
const style = readJson<{ fonts?: Record<string, string> }>(join(dir, "style.json"));
|
|
213
|
+
for (const k of ["sans", "display", "mono"]) if (!KOREAN.test(style.fonts?.[k] ?? "")) bad.push(`style.json fonts.${k} 가 한글이 서는 글꼴로 끝나지 않는다`);
|
|
214
|
+
} catch {
|
|
215
|
+
bad.push("style.json 을 못 읽는다");
|
|
216
|
+
}
|
|
217
|
+
if (existsSync(join(dir, "effects.ts"))) {
|
|
218
|
+
try {
|
|
219
|
+
const mod = (await import(pathToFileURL(join(dir, "effects.ts")).href)) as Record<string, unknown>;
|
|
220
|
+
const exported = Object.keys(mod).filter((k) => typeof mod[k] === "function").sort();
|
|
221
|
+
const listed = (m.effects ?? []).map((e) => e.name).sort();
|
|
222
|
+
const missing = listed.filter((n) => !exported.includes(n));
|
|
223
|
+
const extra = exported.filter((n) => !listed.includes(n));
|
|
224
|
+
if (missing.length) bad.push(`theme.json 에 있는데 effects.ts 에 없는 효과: ${missing.join(" ")}`);
|
|
225
|
+
if (extra.length) bad.push(`effects.ts 가 내보내는데 theme.json 에 없는 효과: ${extra.join(" ")}`);
|
|
226
|
+
} catch (e) {
|
|
227
|
+
bad.push(`effects.ts 를 불러오지 못했다 — ${(e as Error).message.split("\n")[0]}`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
const sample = join(dir, "sample");
|
|
231
|
+
if (existsSync(join(sample, "scenes"))) {
|
|
232
|
+
for (const f of readdirSync(join(sample, "scenes"))) if (readFileSync(join(sample, "scenes", f), "utf8").includes(SKELETON)) bad.push(`sample/scenes/${f} 가 아직 뼈대다`);
|
|
233
|
+
}
|
|
234
|
+
return bad;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export function setStatus(id: string, status: ThemeStatus): ThemeManifest {
|
|
238
|
+
const file = join(themesDir, id, "theme.json");
|
|
239
|
+
const m = readJson<ThemeManifest>(file);
|
|
240
|
+
const d = new Date();
|
|
241
|
+
const today = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
242
|
+
const next = { ...m, status, approvedAt: status === "approved" ? today : null };
|
|
243
|
+
writeJson(file, next);
|
|
244
|
+
return next;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** 견본을 굽고 검사하고 장면 모음·대표 장면·작은 sample.mp4 를 만들어 공유 폴더에 넣고 status 를 review 로 */
|
|
248
|
+
export function review(id: string, o: { brief?: string; tabs?: number; share?: boolean } = {}): { ok: boolean; share: string | null; notes: string[] } {
|
|
249
|
+
const dir = join(themesDir, id);
|
|
250
|
+
const sample = join(dir, "sample");
|
|
251
|
+
const out = join(sample, "out");
|
|
252
|
+
const notes: string[] = [];
|
|
253
|
+
const brief = loadBrief(o.brief ?? "og-intro-15s");
|
|
254
|
+
const tabs = String(o.tabs ?? 2);
|
|
255
|
+
if (kf(["render", sample, "--tabs", tabs]) !== 0) return { ok: false, share: null, notes: ["kf render 가 실패했다"] };
|
|
256
|
+
if (kf(["check", join(out, "render.mp4")]) !== 0) return { ok: false, share: null, notes: ["mp4 검사가 실패했다 — 보고서를 보고 고친다"] };
|
|
257
|
+
kf(["sheet", sample, "--count", "16", "--cols", "4", "--width", "640", "--out", join(out, "scenes.png")], true);
|
|
258
|
+
const beats = readJson<{ drops: number[] }>(join(sample, "beats.json"));
|
|
259
|
+
const stillAt = Math.min((beats.drops[0] ?? 5) + 0.7, brief.to - brief.from - 0.5);
|
|
260
|
+
kf(["still", sample, "--t", stillAt.toFixed(2)], true);
|
|
261
|
+
const still = readdirSync(out).find((f) => f.startsWith("still-") && f.endsWith(".png"));
|
|
262
|
+
if (still) {
|
|
263
|
+
// 종이결·잡음이 많은 테마는 대표 장면이 몇 MB — 레포에는 1280 폭으로
|
|
264
|
+
spawnSync("ffmpeg", ["-v", "error", "-y", "-i", join(out, still), "-vf", "scale='min(1920,iw)':-2", join(dir, "still.png")]);
|
|
265
|
+
if (statSync(join(dir, "still.png")).size > 2_000_000) spawnSync("ffmpeg", ["-v", "error", "-y", "-i", join(out, still), "-vf", "scale=1280:-2", join(dir, "still.png")]);
|
|
266
|
+
}
|
|
267
|
+
const enc = (args: string[], to: string) =>
|
|
268
|
+
spawnSync("ffmpeg", ["-v", "error", "-y", "-i", join(out, "render.mp4"), ...args, "-pix_fmt", "yuv420p", "-color_range", "tv", "-colorspace", "bt709", "-color_primaries", "bt709", "-color_trc", "bt709", "-c:a", "copy", "-movflags", "+faststart", to]);
|
|
269
|
+
const shareMp4 = join(out, "share.mp4");
|
|
270
|
+
enc(["-c:v", "libx264", "-preset", "slow", "-crf", "24"], shareMp4);
|
|
271
|
+
enc(["-c:v", "libx264", "-preset", "slow", "-crf", "26"], join(dir, "sample.mp4"));
|
|
272
|
+
if (statSync(join(dir, "sample.mp4")).size > 8_000_000) enc(["-vf", "scale=1280:720:flags=lanczos", "-c:v", "libx264", "-preset", "slow", "-crf", "30"], join(dir, "sample.mp4"));
|
|
273
|
+
notes.push(`sample.mp4 ${(statSync(join(dir, "sample.mp4")).size / 1e6).toFixed(1)}MB`);
|
|
274
|
+
let share: string | null = null;
|
|
275
|
+
if (o.share !== false) {
|
|
276
|
+
const r = spawnSync("kasaterm-cli", ["share", "new", `kasaframe-테마-${id}`], { encoding: "utf8" });
|
|
277
|
+
share = r.status === 0 ? (r.stdout.trim().split("\n").pop() ?? null) : null;
|
|
278
|
+
if (!share || !existsSync(share)) {
|
|
279
|
+
share = join(homedir(), "Desktop", `kasaframe-테마-${id}`);
|
|
280
|
+
mkdirSync(share, { recursive: true });
|
|
281
|
+
notes.push("kasaterm-cli share 가 없어 바탕화면에 폴더를 만들었다");
|
|
282
|
+
}
|
|
283
|
+
copyFileSync(shareMp4, join(share, `${id}-${brief.share}.mp4`));
|
|
284
|
+
if (existsSync(join(out, "scenes.png"))) copyFileSync(join(out, "scenes.png"), join(share, `장면모음-${brief.share}.png`));
|
|
285
|
+
if (still) copyFileSync(join(out, still), join(share, `대표장면-${brief.share}.png`));
|
|
286
|
+
copyFileSync(join(dir, "THEME.md"), join(share, "THEME.md"));
|
|
287
|
+
}
|
|
288
|
+
setStatus(id, "review");
|
|
289
|
+
return { ok: true, share, notes };
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** 지시서 원문 — 새 세션에 그대로 넘기는 첫 메시지 */
|
|
293
|
+
export function sessionPrompt(id: string): string {
|
|
294
|
+
return `themes/${id}/THEME-MAKE.md 를 처음부터 끝까지 읽고 그대로 따라 테마 ${id} 를 만든다. 끝나면 npx kf theme review ${id} 까지.`;
|
|
295
|
+
}
|
|
296
|
+
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
// 페이지(Vite) 쪽. 테마 폴더를 늘려도 이 파일은 그대로 — themes/*/effects.ts 를 모아 id 로 꺼낸다.
|
|
3
|
+
const mods = import.meta.glob("../../../themes/*/effects.ts", { eager: true }) as Record<string, Record<string, unknown>>;
|
|
4
|
+
|
|
5
|
+
const byId = new Map(Object.entries(mods).map(([path, mod]) => [path.split("/").at(-2)!, mod]));
|
|
6
|
+
|
|
7
|
+
export const themeIds = (): string[] => [...byId.keys()].sort();
|
|
8
|
+
|
|
9
|
+
/** 장면에서: `const { plateStamp, misregister } = fx("riso-zine")` */
|
|
10
|
+
export function fx<T = Record<string, (...args: any[]) => any>>(id: string): T {
|
|
11
|
+
const mod = byId.get(id);
|
|
12
|
+
if (!mod) throw new Error(`테마 효과 "${id}" 가 없다. 있는 테마: ${themeIds().join(" ") || "(없음)"}`);
|
|
13
|
+
return mod as T;
|
|
14
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
import type { KfStyle } from "@kasaframe/core";
|
|
5
|
+
import { THEME_STATUSES, type Theme, type ThemeCard, type ThemeManifest, type ThemeStatus } from "./types.ts";
|
|
6
|
+
|
|
7
|
+
export type * from "./types.ts";
|
|
8
|
+
export { THEME_STATUSES } from "./types.ts";
|
|
9
|
+
|
|
10
|
+
export const themesDir = fileURLToPath(new URL("../../../themes/", import.meta.url));
|
|
11
|
+
|
|
12
|
+
export interface ThemeFilter {
|
|
13
|
+
/** 하나나 여럿. 안 주면 전부 */
|
|
14
|
+
status?: ThemeStatus | ThemeStatus[];
|
|
15
|
+
purpose?: string;
|
|
16
|
+
aspect?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const readJson = <T>(path: string): T => JSON.parse(readFileSync(path, "utf8")) as T;
|
|
20
|
+
const fileOrNull = (path: string): string | null => (existsSync(path) ? path : null);
|
|
21
|
+
|
|
22
|
+
/** 틀이 깨진 곳을 사람이 읽을 줄로. 빈 배열이면 통과 */
|
|
23
|
+
export function checkTheme(dir: string): string[] {
|
|
24
|
+
const bad: string[] = [];
|
|
25
|
+
for (const f of ["theme.json", "style.json", "THEME.md", "effects.ts"]) if (!existsSync(join(dir, f))) bad.push(`${f} 가 없다`);
|
|
26
|
+
if (bad.length) return bad;
|
|
27
|
+
const m = readJson<Partial<ThemeManifest>>(join(dir, "theme.json"));
|
|
28
|
+
const id = dir.replace(/\/+$/, "").split("/").pop();
|
|
29
|
+
if (m.id !== id) bad.push(`theme.json id "${m.id}" 가 폴더 이름 "${id}" 와 다르다`);
|
|
30
|
+
for (const k of ["name", "metaphor"] as const) if (typeof m[k] !== "string" || !m[k]) bad.push(`theme.json ${k} 가 비었다`);
|
|
31
|
+
if (!THEME_STATUSES.includes(m.status as ThemeStatus)) bad.push(`theme.json status 는 ${THEME_STATUSES.join("|")} 중 하나`);
|
|
32
|
+
if (m.status === "approved" && !m.approvedAt) bad.push("approved 인데 approvedAt 이 없다");
|
|
33
|
+
if (!Array.isArray(m.purposes) || !m.purposes.length) bad.push("theme.json purposes 가 비었다");
|
|
34
|
+
if (!Array.isArray(m.aspect) || !m.aspect.length) bad.push("theme.json aspect 가 비었다");
|
|
35
|
+
const n = m.effects?.length ?? 0;
|
|
36
|
+
if (n < 5 || n > 10) bad.push(`효과는 5–10개 — 지금 ${n}개`);
|
|
37
|
+
for (const e of m.effects ?? []) if (!["value", "layer", "rig"].includes(e.kind)) bad.push(`효과 ${e.name} kind 는 value|layer|rig`);
|
|
38
|
+
const s = readJson<Partial<KfStyle>>(join(dir, "style.json"));
|
|
39
|
+
if (s.name !== m.id) bad.push(`style.json name 이 테마 id 와 다르다`);
|
|
40
|
+
if (!s.fonts?.sans || !s.colors?.bg || !s.motion) bad.push("style.json 이 KfStyle 꼴이 아니다(fonts·colors·motion)");
|
|
41
|
+
if (m.status !== "draft") {
|
|
42
|
+
if (!existsSync(join(dir, m.still ?? "still.png"))) bad.push(`${m.status} 인데 대표 장면 ${m.still ?? "still.png"} 가 없다`);
|
|
43
|
+
if (!existsSync(join(dir, "sample", "kf.json"))) bad.push(`${m.status} 인데 견본 프로젝트 sample/ 이 없다`);
|
|
44
|
+
}
|
|
45
|
+
return bad;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function loadTheme(id: string): Theme {
|
|
49
|
+
const dir = join(themesDir, id);
|
|
50
|
+
const bad = checkTheme(dir);
|
|
51
|
+
if (bad.length) throw new Error(`테마 ${id}: ${bad.join(" · ")}`);
|
|
52
|
+
const m = readJson<ThemeManifest>(join(dir, "theme.json"));
|
|
53
|
+
return {
|
|
54
|
+
...m,
|
|
55
|
+
dir,
|
|
56
|
+
style: readJson<KfStyle>(join(dir, "style.json")),
|
|
57
|
+
guide: readFileSync(join(dir, "THEME.md"), "utf8"),
|
|
58
|
+
files: {
|
|
59
|
+
still: fileOrNull(join(dir, m.still ?? "still.png")),
|
|
60
|
+
sample: fileOrNull(join(dir, m.sample ?? "sample.mp4")),
|
|
61
|
+
sampleProject: fileOrNull(join(dir, "sample")),
|
|
62
|
+
effects: join(dir, "effects.ts"),
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** 틀이 깨진 테마는 건너뛴다 — 하나가 깨져도 목록은 선다 */
|
|
68
|
+
export function listThemes(filter: ThemeFilter = {}): Theme[] {
|
|
69
|
+
if (!existsSync(themesDir)) return [];
|
|
70
|
+
const want = filter.status === undefined ? null : [filter.status].flat();
|
|
71
|
+
const out: Theme[] = [];
|
|
72
|
+
for (const id of readdirSync(themesDir).sort()) {
|
|
73
|
+
if (!existsSync(join(themesDir, id, "theme.json")) || checkTheme(join(themesDir, id)).length) continue;
|
|
74
|
+
const t = loadTheme(id);
|
|
75
|
+
if (want && !want.includes(t.status)) continue;
|
|
76
|
+
if (filter.purpose && !t.purposes.includes(filter.purpose)) continue;
|
|
77
|
+
if (filter.aspect && !t.aspect.includes(filter.aspect)) continue;
|
|
78
|
+
out.push(t);
|
|
79
|
+
}
|
|
80
|
+
return out;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** 3D 무대(rig 효과)를 쓰는 테마인가 — 묻기 보기·견본 시트의 2D/3D 표시 */
|
|
84
|
+
export const themeDims = (t: Pick<ThemeManifest, "effects">): "2D" | "3D" => (t.effects.some((e) => e.kind === "rig") ? "3D" : "2D");
|
|
85
|
+
|
|
86
|
+
/** kf theme sheet 가 찍는 견본 — 같은 문장 한 장면을 테마마다 <id>.png, 한 장에 모은 격자 sheet.png */
|
|
87
|
+
export const sheetDir = join(themesDir, "_sheet");
|
|
88
|
+
|
|
89
|
+
/** 묻기 보기에 붙일 견본 — 견본 시트의 그 테마 칸, 아직 안 찍었으면 테마 대표 장면 */
|
|
90
|
+
export const themeSample = (t: Theme): string | null => (existsSync(join(sheetDir, `${t.id}.png`)) ? join(sheetDir, `${t.id}.png`) : t.files.still);
|
|
91
|
+
|
|
92
|
+
export function themeCards(filter: ThemeFilter = {}): ThemeCard[] {
|
|
93
|
+
return listThemes(filter).map((t) => ({
|
|
94
|
+
id: t.id,
|
|
95
|
+
name: t.name,
|
|
96
|
+
metaphor: t.metaphor,
|
|
97
|
+
status: t.status,
|
|
98
|
+
approvedAt: t.approvedAt,
|
|
99
|
+
still: t.files.still,
|
|
100
|
+
sample: t.files.sample,
|
|
101
|
+
purposes: t.purposes,
|
|
102
|
+
aspect: t.aspect,
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* 프로젝트 style.json 으로 쓸 것 — 프리셋과 같은 꼴 통째. 틀의 motion 은 프리셋 때처럼 위에 덮는다.
|
|
108
|
+
* 고른 id 가 draft 면 던진다(견본을 만드는 테마 폴더 안에서만 쓴다)
|
|
109
|
+
*/
|
|
110
|
+
export function themeStyle(id: string, opts: { allowDraft?: boolean } = {}): KfStyle {
|
|
111
|
+
const t = loadTheme(id);
|
|
112
|
+
if (t.status === "draft" && !opts.allowDraft) throw new Error(`테마 ${id} 는 아직 draft — 견본이 review 로 올라온 뒤에 쓴다`);
|
|
113
|
+
return structuredClone(t.style);
|
|
114
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { clamp } from "@kasaframe/core";
|
|
2
|
+
|
|
3
|
+
// 테마 slots.ts 들이 같이 쓰는 작은 도구. 슬롯은 build 때(장면이 숨어 있어 크기 0) 불리므로 크기를 재지 않는 길만 둔다 —
|
|
4
|
+
// 판은 % 로, 선은 점 좌표를 감싸는 캔버스로.
|
|
5
|
+
|
|
6
|
+
export function layer(parent: HTMLElement, css: string, first = false): HTMLDivElement {
|
|
7
|
+
const d = parent.ownerDocument.createElement("div");
|
|
8
|
+
d.style.cssText = `position:absolute;pointer-events:none;${css}`;
|
|
9
|
+
if (first) parent.prepend(d);
|
|
10
|
+
else parent.append(d);
|
|
11
|
+
return d;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** 글자마다 span — 배치를 바꾸지 않게 inline 그대로. 빈칸은 글자로 남긴다 */
|
|
15
|
+
export function letters(el: HTMLElement, text: string): HTMLSpanElement[] {
|
|
16
|
+
el.textContent = "";
|
|
17
|
+
return Array.from(text).map((ch) => {
|
|
18
|
+
const s = el.ownerDocument.createElement("span");
|
|
19
|
+
s.textContent = ch;
|
|
20
|
+
el.append(s);
|
|
21
|
+
return s;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** at 부터 dur 동안 앞에서부터 몇 글자가 찍혔나 — at+dur 부터는 전부 */
|
|
26
|
+
export const shownCount = (n: number, t: number, at: number, dur: number): number =>
|
|
27
|
+
t >= at + dur ? n : t < at ? 0 : Math.min(n, Math.floor(clamp((t - at) / Math.max(1e-3, dur)) * n) + 1);
|
|
28
|
+
|
|
29
|
+
export type Pt = readonly [number, number];
|
|
30
|
+
|
|
31
|
+
/** 꺾은선 길이 비율 p 까지의 점들 — 마지막 점은 선분 안에서 끊는다 */
|
|
32
|
+
export function partial(points: readonly Pt[], p: number): [number, number][] {
|
|
33
|
+
if (points.length < 2) return points.map((q) => [q[0], q[1]]);
|
|
34
|
+
const seg = points.slice(1).map((q, i) => Math.hypot(q[0] - points[i][0], q[1] - points[i][1]));
|
|
35
|
+
const total = seg.reduce((a, b) => a + b, 0) || 1;
|
|
36
|
+
let left = clamp(p) * total;
|
|
37
|
+
const out: [number, number][] = [[points[0][0], points[0][1]]];
|
|
38
|
+
for (let i = 0; i < seg.length; i++) {
|
|
39
|
+
if (left >= seg[i]) {
|
|
40
|
+
out.push([points[i + 1][0], points[i + 1][1]]);
|
|
41
|
+
left -= seg[i];
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const k = seg[i] ? left / seg[i] : 0;
|
|
45
|
+
out.push([points[i][0] + (points[i + 1][0] - points[i][0]) * k, points[i][1] + (points[i + 1][1] - points[i][1]) * k]);
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** 점들을 감싸는 캔버스(여백 pad) — 그리기는 층 좌표 그대로 */
|
|
52
|
+
export function traceCanvas(el: HTMLElement, points: readonly Pt[], pad = 40): { g: CanvasRenderingContext2D; clear(): void } {
|
|
53
|
+
const xs = points.map((q) => q[0]);
|
|
54
|
+
const ys = points.map((q) => q[1]);
|
|
55
|
+
const x = Math.floor(Math.min(...xs) - pad);
|
|
56
|
+
const y = Math.floor(Math.min(...ys) - pad);
|
|
57
|
+
const w = Math.ceil(Math.max(...xs) + pad) - x;
|
|
58
|
+
const h = Math.ceil(Math.max(...ys) + pad) - y;
|
|
59
|
+
const c = el.ownerDocument.createElement("canvas");
|
|
60
|
+
c.width = Math.max(1, w);
|
|
61
|
+
c.height = Math.max(1, h);
|
|
62
|
+
c.style.cssText = `position:absolute;left:${x}px;top:${y}px;width:${w}px;height:${h}px;pointer-events:none`;
|
|
63
|
+
el.append(c);
|
|
64
|
+
const g = c.getContext("2d")!;
|
|
65
|
+
g.translate(-x, -y);
|
|
66
|
+
return { g, clear: () => g.clearRect(x, y, w, h) };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function strokePath(g: CanvasRenderingContext2D, pts: readonly Pt[]): void {
|
|
70
|
+
if (pts.length < 2) return;
|
|
71
|
+
g.beginPath();
|
|
72
|
+
g.moveTo(pts[0][0], pts[0][1]);
|
|
73
|
+
for (const q of pts.slice(1)) g.lineTo(q[0], q[1]);
|
|
74
|
+
g.stroke();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** CSS 변수 색 — 슬롯은 테마 토큰만 쓴다 */
|
|
78
|
+
export const cssVar = (el: HTMLElement, name: string, fallback: string): string =>
|
|
79
|
+
getComputedStyle(el).getPropertyValue(`--kf-${name}`).trim() || fallback;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
// 페이지(Vite) 쪽. 장면 문법 패턴은 테마 이름을 모른다 — 일반 자리 여섯을 부르고, 테마가 themes/<id>/slots.ts 에서 자기 효과로 채운다.
|
|
3
|
+
// effects.ts 와 따로 두는 까닭: effects.ts 내보내기는 theme.json 효과 목록과 같아야 한다(테마 시험).
|
|
4
|
+
import type { SceneCtx, Style } from "@kasaframe/core";
|
|
5
|
+
import type { DropBurstState } from "@kasaframe/motion";
|
|
6
|
+
|
|
7
|
+
export type Paint = (t: number) => void;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 모든 슬롯은 같은 t 면 같은 화면이고, 난수는 seed 로만. 비운 슬롯은 패턴이 제 기본으로 그린다.
|
|
11
|
+
* 화면 전체를 덮는 3D(three)는 surface 에서만 — 크롬이 WebGL 문맥을 몇 개만 살려 두므로 나머지 슬롯은 DOM·캔버스 2D 로.
|
|
12
|
+
*/
|
|
13
|
+
export interface ThemeSlots {
|
|
14
|
+
/** 화면 전체 바탕 질감. el = 장면 맨 뒤 inset:0 층. 장면마다 한 번 짓는다. 글을 두지 않는다 */
|
|
15
|
+
surface?(el: HTMLElement, o: { ctx: SceneCtx; seed: string }): Paint;
|
|
16
|
+
/**
|
|
17
|
+
* 카드·상자 판. el = 패턴이 자리·크기를 잡은 상자(position:absolute). 판은 el 안 맨 앞 자식으로 깔고 내용은 패턴이 그 위에 둔다.
|
|
18
|
+
* at 에 선다(그 전엔 안 보인다). 상자 크기·자리는 바꾸지 않는다 — 배치는 패턴 몫. tone 은 accent 면 강조 판
|
|
19
|
+
*/
|
|
20
|
+
panel?(el: HTMLElement, o: { ctx: SceneCtx; at: number; seed: string; tone?: "base" | "accent" }): Paint;
|
|
21
|
+
/**
|
|
22
|
+
* 앉는 순간 한 번 — 숫자·이름·칸이 at 에 앉을 때. el 둘레에 곁 그림(빛·그림자·도장)을 지어도 되고, 돌려준 Style 은 패턴이 el 에 combine 한다.
|
|
23
|
+
* 섬광·흔들림은 motion 부품(dropBurst·shake)을 거쳐 __kf.events 에 남게. at 에서 0.6초 안에 끝나 선다
|
|
24
|
+
*/
|
|
25
|
+
land?(el: HTMLElement, o: { ctx: SceneCtx; at: number; seed: string }): (t: number) => Style;
|
|
26
|
+
/**
|
|
27
|
+
* 글 찍기 — el(패턴이 글꼴 크기·자리를 잡은 글 상자)에 text 를 at 부터 찍는다. at + dur 부터는 el.textContent 가 text 그대로.
|
|
28
|
+
* 글꼴 크기·줄 수는 바꾸지 않는다(배치가 흔들린다) — 색·그림자·글자 굴림만
|
|
29
|
+
*/
|
|
30
|
+
write?(el: HTMLElement, o: { ctx: SceneCtx; text: string; at: number; dur: number; seed: string }): Paint;
|
|
31
|
+
/** 선 긋기 — el = inset:0 층, points 는 그 층 px. at 부터 dur 동안 그어지고, 다 그은 뒤에도 선 안이 흐른다 */
|
|
32
|
+
trace?(el: HTMLElement, o: { ctx: SceneCtx; points: readonly (readonly [number, number])[]; at: number; dur: number; seed: string; tone?: "base" | "accent" }): Paint;
|
|
33
|
+
/** 드롭 터짐 — 그 테마의 드롭 연출. 돌려준 shake 는 패턴이 화면 틀에, punch 는 주인공에 준다. 드롭 번호로만 */
|
|
34
|
+
drop?(el: HTMLElement, o: { ctx: SceneCtx; drop: number }): (t: number) => DropBurstState;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const SLOT_NAMES = ["surface", "panel", "land", "write", "trace", "drop"] as const satisfies readonly (keyof ThemeSlots)[];
|
|
38
|
+
|
|
39
|
+
const mods = import.meta.glob("../../../themes/*/slots.ts", { eager: true }) as Record<string, { slots?: ThemeSlots }>;
|
|
40
|
+
|
|
41
|
+
const byId = new Map(Object.entries(mods).map(([path, mod]) => [path.split("/").at(-2)!, mod.slots ?? {}]));
|
|
42
|
+
|
|
43
|
+
/** 테마 슬롯 — 없는 테마(npm 묶음에 안 든 테마 포함)나 슬롯을 안 채운 테마는 빈 객체 */
|
|
44
|
+
export const themeSlots = (id: string | undefined | null): ThemeSlots => (id ? byId.get(id) ?? {} : {});
|
|
45
|
+
|
|
46
|
+
export const slotThemeIds = (): string[] => [...byId.keys()].sort();
|