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,281 @@
|
|
|
1
|
+
import type { Thumb } from "../image.ts";
|
|
2
|
+
import type { Finding, SafeArea } from "../types.ts";
|
|
3
|
+
|
|
4
|
+
// 멈춤·빈 화면 검사를 다 통과하고도 「화면이 비었다」가 나온다 — 9:16 에 그림·글이 가운데 20% 만 차지하거나,
|
|
5
|
+
// 흐르는 바탕 위에 같은 구도가 9초씩 가는 경우. 둘 다 엄지만 한 썸네일(160px 회색조)로 잰다.
|
|
6
|
+
|
|
7
|
+
export interface SceneSpan {
|
|
8
|
+
id: string;
|
|
9
|
+
from: number;
|
|
10
|
+
dur: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface Thumbish extends Thumb {
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const THUMB_W = 160;
|
|
19
|
+
|
|
20
|
+
function dims(t: Thumbish, aspect: number): { w: number; h: number } {
|
|
21
|
+
const w = t.width ?? THUMB_W;
|
|
22
|
+
return { w, h: t.height ?? (Math.round(t.luma.length / w) || Math.round(w / aspect)) };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// 가장 흔한 밝기(±3)를 바탕으로 본다 — 생성 그림처럼 바탕이 고르지 않으면 바탕 몫이 작아 「꽉 참」으로 나온다
|
|
26
|
+
function background(l: Uint8Array): { value: number; share: number } {
|
|
27
|
+
const hist = new Uint32Array(256);
|
|
28
|
+
for (const v of l) hist[v]++;
|
|
29
|
+
let best = 0;
|
|
30
|
+
let value = 0;
|
|
31
|
+
for (let v = 0; v < 256; v++) {
|
|
32
|
+
let n = 0;
|
|
33
|
+
for (let d = -3; d <= 3; d++) n += hist[v + d] ?? 0;
|
|
34
|
+
if (n > best) {
|
|
35
|
+
best = n;
|
|
36
|
+
value = v;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return { value, share: best / l.length };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// 내용 상자 — 바탕과 다른 픽셀의 가로·세로 분포에서 양 끝 3% 씩 떼어 낸 범위(구석의 작은 로고 하나가 상자를 키우지 않게)
|
|
43
|
+
export function contentBox(l: Uint8Array, w: number, h: number, safe: { x0: number; y0: number; x1: number; y1: number }): { wFrac: number; hFrac: number; area: number } {
|
|
44
|
+
const bg = background(l);
|
|
45
|
+
if (bg.share < 0.45) return { wFrac: 1, hFrac: 1, area: 1 };
|
|
46
|
+
const cols = new Float64Array(w);
|
|
47
|
+
const rows = new Float64Array(h);
|
|
48
|
+
let total = 0;
|
|
49
|
+
for (let y = safe.y0; y < safe.y1; y++) {
|
|
50
|
+
for (let x = safe.x0; x < safe.x1; x++) {
|
|
51
|
+
if (Math.abs(l[y * w + x] - bg.value) > 14) {
|
|
52
|
+
cols[x]++;
|
|
53
|
+
rows[y]++;
|
|
54
|
+
total++;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
const sw = safe.x1 - safe.x0;
|
|
59
|
+
const sh = safe.y1 - safe.y0;
|
|
60
|
+
if (total < 4) return { wFrac: 0, hFrac: 0, area: 0 };
|
|
61
|
+
const span = (arr: Float64Array, lo: number, hi: number) => {
|
|
62
|
+
let acc = 0;
|
|
63
|
+
let a = lo;
|
|
64
|
+
while (a < hi && acc + arr[a] <= total * 0.03) acc += arr[a++];
|
|
65
|
+
acc = 0;
|
|
66
|
+
let b = hi - 1;
|
|
67
|
+
while (b > a && acc + arr[b] <= total * 0.03) acc += arr[b--];
|
|
68
|
+
return b - a + 1;
|
|
69
|
+
};
|
|
70
|
+
const wFrac = span(cols, safe.x0, safe.x1) / sw;
|
|
71
|
+
const hFrac = span(rows, safe.y0, safe.y1) / sh;
|
|
72
|
+
return { wFrac, hFrac, area: wFrac * hFrac };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface FillOptions {
|
|
76
|
+
width: number;
|
|
77
|
+
height: number;
|
|
78
|
+
safe?: SafeArea;
|
|
79
|
+
// 세로 화면은 주 요소가 안전 영역 폭의 이만큼은 차야 한다
|
|
80
|
+
minWidthVertical?: number;
|
|
81
|
+
// 세로 화면은 위아래로도 써야 한다 — 내용이 위쪽에만 몰려 아래가 비면 경고(자막 띠는 빼고 잰다)
|
|
82
|
+
minHeightVertical?: number;
|
|
83
|
+
minArea?: number;
|
|
84
|
+
// 화면 자막 판의 윗변(영상 px) — 그 아래는 장면 내용이 아니라서 채움에서 뺀다
|
|
85
|
+
captionTop?: number;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 판정에 쓸 만큼 그 장면을 봤나 — 구간 검사가 장면 경계에서 시작하면 앞 장면의 마지막 프레임 한두 장(덮기·전환 중)만
|
|
89
|
+
// 그 장면 몫으로 들어와 「채움 0%」로 잡혔다
|
|
90
|
+
const MIN_SAMPLES = 3;
|
|
91
|
+
const enoughOf = (times: number[], dur: number): boolean => times.length >= MIN_SAMPLES && times[times.length - 1] - times[0] >= Math.min(0.5, dur * 0.4);
|
|
92
|
+
|
|
93
|
+
// 시작이 t 이하인 마지막 장면 — kf.json 시각은 넷째 자리에서 반올림돼 경계에 0.0001초 틈이 날 수 있다
|
|
94
|
+
function sceneOf(t: number, scenes: SceneSpan[]): SceneSpan | undefined {
|
|
95
|
+
let hit: SceneSpan | undefined;
|
|
96
|
+
for (const s of scenes) if (s.from <= t + 1e-3) hit = s;
|
|
97
|
+
return hit;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function median(xs: number[]): number {
|
|
101
|
+
const s = [...xs].sort((a, b) => a - b);
|
|
102
|
+
return s.length ? s[Math.floor(s.length / 2)] : 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// 화면 채움 — 장면마다 내용 상자의 가운데값. 넓이 12% 아래면 오류, 세로 화면은 폭 70%·높이 55% 아래면 경고
|
|
106
|
+
export function fill(thumbs: Thumbish[], scenes: SceneSpan[], o: FillOptions): Finding[] {
|
|
107
|
+
if (!thumbs.length) return [];
|
|
108
|
+
const aspect = o.width / o.height;
|
|
109
|
+
const vertical = o.height > o.width;
|
|
110
|
+
const minW = o.minWidthVertical ?? 0.7;
|
|
111
|
+
const minH = o.minHeightVertical ?? 0.55;
|
|
112
|
+
const minArea = o.minArea ?? 0.12;
|
|
113
|
+
const groups = new Map<string, { span: SceneSpan; w: number[]; h: number[]; a: number[]; t: number[] }>();
|
|
114
|
+
for (const t of thumbs) {
|
|
115
|
+
const s = sceneOf(t.t, scenes) ?? { id: "영상", from: 0, dur: Infinity };
|
|
116
|
+
const { w, h } = dims(t, aspect);
|
|
117
|
+
const k = w / o.width;
|
|
118
|
+
const sa = o.safe ?? { top: 0, bottom: 0, left: 0, right: 0 };
|
|
119
|
+
const y0 = Math.max(0, Math.round(sa.top * k));
|
|
120
|
+
const box = contentBox(t.luma, w, h, {
|
|
121
|
+
x0: Math.max(0, Math.round(sa.left * k)),
|
|
122
|
+
y0,
|
|
123
|
+
x1: Math.min(w, w - Math.round(sa.right * k)),
|
|
124
|
+
y1: Math.max(y0 + 1, Math.min(h, h - Math.round(sa.bottom * k), o.captionTop !== undefined ? Math.round(o.captionTop * k) : h)),
|
|
125
|
+
});
|
|
126
|
+
const g = groups.get(s.id) ?? { span: s, w: [], h: [], a: [], t: [] };
|
|
127
|
+
g.w.push(box.wFrac);
|
|
128
|
+
g.h.push(box.hFrac);
|
|
129
|
+
g.a.push(box.area);
|
|
130
|
+
g.t.push(t.t);
|
|
131
|
+
groups.set(s.id, g);
|
|
132
|
+
}
|
|
133
|
+
const out: Finding[] = [];
|
|
134
|
+
for (const { span, w, h, a, t } of groups.values()) {
|
|
135
|
+
if (!enoughOf(t, span.dur)) continue;
|
|
136
|
+
const mw = median(w);
|
|
137
|
+
const mh = median(h);
|
|
138
|
+
const ma = median(a);
|
|
139
|
+
const to = Number.isFinite(span.dur) ? span.from + span.dur : thumbs.at(-1)!.t;
|
|
140
|
+
if (ma < minArea) {
|
|
141
|
+
out.push({
|
|
142
|
+
rule: "layout.fill",
|
|
143
|
+
severity: "error",
|
|
144
|
+
from: span.from,
|
|
145
|
+
to,
|
|
146
|
+
message: `장면 ${span.id} 의 내용이 안전 영역의 ${(ma * 100).toFixed(0)}% 만 차지한다 — 화면이 비어 보인다. 주 요소를 키우거나(큰 글자 단계·도식 확대) 화면을 채우는 바탕·요소를 더한다`,
|
|
147
|
+
detail: { scene: span.id, area: Math.round(ma * 1000) / 1000, width: Math.round(mw * 1000) / 1000 },
|
|
148
|
+
});
|
|
149
|
+
} else if (vertical && mw < minW) {
|
|
150
|
+
out.push({
|
|
151
|
+
rule: "layout.fill",
|
|
152
|
+
severity: "warn",
|
|
153
|
+
from: span.from,
|
|
154
|
+
to,
|
|
155
|
+
message: `장면 ${span.id} 의 주 요소 폭이 안전 영역의 ${(mw * 100).toFixed(0)}% — 세로 화면은 ${Math.round(minW * 100)}% 넘게 채운다`,
|
|
156
|
+
detail: { scene: span.id, area: Math.round(ma * 1000) / 1000, width: Math.round(mw * 1000) / 1000 },
|
|
157
|
+
});
|
|
158
|
+
} else if (vertical && mh < minH) {
|
|
159
|
+
out.push({
|
|
160
|
+
rule: "layout.fill",
|
|
161
|
+
severity: "warn",
|
|
162
|
+
from: span.from,
|
|
163
|
+
to,
|
|
164
|
+
message: `장면 ${span.id} 의 내용이 안전 영역 높이의 ${(mh * 100).toFixed(0)}% 에 몰렸다(자막 띠 빼고) — 세로 화면은 위아래로 써서 ${Math.round(minH * 100)}% 넘게 채운다(큰 숫자 아래 자·막대, 목록은 세로로 쌓기)`,
|
|
165
|
+
detail: { scene: span.id, area: Math.round(ma * 1000) / 1000, width: Math.round(mw * 1000) / 1000, height: Math.round(mh * 1000) / 1000 },
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return out;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// 구도 — 썸네일을 16×N 칸으로 줄인 평균 밝기. 흐르는 점무늬처럼 잔 움직임은 칸 평균에 묻히고, 카메라·확대·새 요소는 칸을 바꾼다
|
|
173
|
+
function layoutSig(t: Thumbish, aspect: number, cols = 16): Float32Array {
|
|
174
|
+
const { w, h } = dims(t, aspect);
|
|
175
|
+
const rows = Math.max(4, Math.round((cols * h) / w));
|
|
176
|
+
const sig = new Float32Array(cols * rows);
|
|
177
|
+
const cnt = new Uint32Array(cols * rows);
|
|
178
|
+
for (let y = 0; y < h; y++) {
|
|
179
|
+
const r = Math.min(rows - 1, Math.floor((y * rows) / h));
|
|
180
|
+
for (let x = 0; x < w; x++) {
|
|
181
|
+
const c = Math.min(cols - 1, Math.floor((x * cols) / w));
|
|
182
|
+
sig[r * cols + c] += t.luma[y * w + x];
|
|
183
|
+
cnt[r * cols + c]++;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
for (let i = 0; i < sig.length; i++) sig[i] /= cnt[i] || 1;
|
|
187
|
+
return sig;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function sigDiff(a: Float32Array, b: Float32Array): number {
|
|
191
|
+
let s = 0;
|
|
192
|
+
for (let i = 0; i < a.length; i++) s += Math.abs(a[i] - b[i]);
|
|
193
|
+
return s / a.length;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// 화면 안 내용 — 칸마다 센 가장자리(이웃 픽셀 밝기 차 합이 24 넘는 픽셀) 수와 평균 밝기. 숫자가 구르고 칸이 차고 줄이 붙으면 이 지도가 바뀐다.
|
|
197
|
+
// 칸 평균 밝기만 보면 이런 변화가 묻혀 모델이 카메라 샷을 박아 넘겼다. 빛 방울·모눈처럼 부드럽거나 가는 바탕 흐름은 센 가장자리를 거의 안 만든다
|
|
198
|
+
interface ContentSig {
|
|
199
|
+
edges: Uint16Array;
|
|
200
|
+
mean: Float32Array;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export function contentSig(t: Thumbish, aspect: number, cols = 32): ContentSig {
|
|
204
|
+
const { w, h } = dims(t, aspect);
|
|
205
|
+
const rows = Math.max(4, Math.round((cols * h) / w));
|
|
206
|
+
const edges = new Uint16Array(cols * rows);
|
|
207
|
+
const mean = new Float32Array(cols * rows);
|
|
208
|
+
const cnt = new Uint16Array(cols * rows);
|
|
209
|
+
const l = t.luma;
|
|
210
|
+
for (let y = 0; y < h; y++) {
|
|
211
|
+
const r = Math.min(rows - 1, Math.floor((y * rows) / h));
|
|
212
|
+
for (let x = 0; x < w; x++) {
|
|
213
|
+
const k = r * cols + Math.min(cols - 1, Math.floor((x * cols) / w));
|
|
214
|
+
const i = y * w + x;
|
|
215
|
+
mean[k] += l[i];
|
|
216
|
+
cnt[k]++;
|
|
217
|
+
if (x < w - 1 && y < h - 1 && Math.abs(l[i] - l[i + 1]) + Math.abs(l[i] - l[i + w]) > 24) edges[k]++;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
for (let k = 0; k < mean.length; k++) mean[k] /= cnt[k] || 1;
|
|
221
|
+
return { edges, mean };
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// 바뀐 칸의 몫 — 가장자리 수가 3 넘게 달라졌거나, 가장자리가 있는 칸(글·칸·막대)의 밝기가 20 넘게 달라졌다(회색 칸이 검게 차는 것).
|
|
225
|
+
// 가장자리 없는 칸의 밝기 변화(부드러운 바탕 흐름)는 세지 않는다
|
|
226
|
+
export function contentChange(a: ContentSig, b: ContentSig): number {
|
|
227
|
+
let n = 0;
|
|
228
|
+
for (let i = 0; i < a.edges.length; i++) {
|
|
229
|
+
if (Math.abs(a.edges[i] - b.edges[i]) > 3 || ((a.edges[i] > 3 || b.edges[i] > 3) && Math.abs(a.mean[i] - b.mean[i]) > 20)) n++;
|
|
230
|
+
}
|
|
231
|
+
return n / a.edges.length;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export interface StaticOptions {
|
|
235
|
+
width: number;
|
|
236
|
+
height: number;
|
|
237
|
+
warnSec?: number;
|
|
238
|
+
errorSec?: number;
|
|
239
|
+
// 칸 평균 밝기 차(0..255). 이보다 덜 바뀌고
|
|
240
|
+
threshold?: number;
|
|
241
|
+
// 화면 안 내용이 바뀐 칸의 몫도 이보다 작으면 같은 구도로 본다
|
|
242
|
+
contentThreshold?: number;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// 장면 안 변화량 — 같은 구도가 1.5초 넘게 가면 경고, 3초 넘으면 오류. 칸 평균 밝기(컷·확대·새 면)와 화면 안 내용(숫자·칸·줄)
|
|
246
|
+
// 둘 다 닻 프레임에서 안 바뀌어야 같은 구도다 — 카메라 컷 없이도 내용이 움직이면 넘는다. 카메라로 메우면 camera.wander
|
|
247
|
+
export function staticLayout(thumbs: Thumbish[], scenes: SceneSpan[], o: StaticOptions): Finding[] {
|
|
248
|
+
const aspect = o.width / o.height;
|
|
249
|
+
const warnSec = o.warnSec ?? 1.5;
|
|
250
|
+
const errorSec = o.errorSec ?? 3;
|
|
251
|
+
const thr = o.threshold ?? 2.5;
|
|
252
|
+
const cthr = o.contentThreshold ?? 0.015;
|
|
253
|
+
const out: Finding[] = [];
|
|
254
|
+
const spans = scenes.length ? scenes : [{ id: "영상", from: 0, dur: Infinity }];
|
|
255
|
+
for (const s of spans) {
|
|
256
|
+
const ts = thumbs.filter((t) => sceneOf(t.t, spans) === s);
|
|
257
|
+
if (ts.length < 2) continue;
|
|
258
|
+
const sigs = ts.map((t) => layoutSig(t, aspect));
|
|
259
|
+
const content = ts.map((t) => contentSig(t, aspect));
|
|
260
|
+
let a = 0;
|
|
261
|
+
while (a < ts.length - 1) {
|
|
262
|
+
let j = a + 1;
|
|
263
|
+
while (j < ts.length && sigDiff(sigs[a], sigs[j]) < thr && contentChange(content[a], content[j]) < cthr) j++;
|
|
264
|
+
const end = j - 1;
|
|
265
|
+
const len = ts[end].t - ts[a].t;
|
|
266
|
+
if (len > warnSec + 1e-6) {
|
|
267
|
+
const severity = len > errorSec + 1e-6 ? "error" : "warn";
|
|
268
|
+
out.push({
|
|
269
|
+
rule: "layout.static",
|
|
270
|
+
severity,
|
|
271
|
+
from: ts[a].t,
|
|
272
|
+
to: ts[end].t,
|
|
273
|
+
message: `장면 ${s.id} 에서 같은 구도가 ${len.toFixed(1)}초 간다 — ${warnSec}초 안에 새 요소·칸 채우기·숫자 키우기·컷·전환으로 구도를 바꾼다(카메라를 이유 없이 옮겨 메우지 않는다)`,
|
|
274
|
+
detail: { scene: s.id, seconds: Math.round(len * 10) / 10 },
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
a = Math.max(end, a + 1);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
return out;
|
|
281
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ContrastSample, RepeatSample } from "../scan.ts";
|
|
2
|
+
import type { Finding } from "../types.ts";
|
|
3
|
+
import { roundBox } from "./text.ts";
|
|
4
|
+
import { runs } from "./runs.ts";
|
|
5
|
+
|
|
6
|
+
// 페이드 중인 글은 낮은 대비가 당연하다. 같은 글이 minSec 넘게 낮은 대비로 머물 때만 말한다.
|
|
7
|
+
// 장식으로 흐리게 깐 작은 글은 일부러일 수 있어 경고에 그친다. 읽으라고 크게 쓴 글이 거의 안 보이면 오류.
|
|
8
|
+
export function contrast(samples: ContrastSample[], o: { shotFps: number; minSec?: number; warnBelow?: number; errorBelow?: number; errorMinPx?: number }): Finding[] {
|
|
9
|
+
const minSec = o.minSec ?? 0.9;
|
|
10
|
+
const warnBelow = o.warnBelow ?? 3;
|
|
11
|
+
const errorBelow = o.errorBelow ?? 1.5;
|
|
12
|
+
const errorMinPx = o.errorMinPx ?? 24;
|
|
13
|
+
const byText = new Map<string, ContrastSample[]>();
|
|
14
|
+
for (const s of samples) {
|
|
15
|
+
if (s.ratio >= warnBelow) continue;
|
|
16
|
+
const key = s.text;
|
|
17
|
+
if (!byText.has(key)) byText.set(key, []);
|
|
18
|
+
byText.get(key)!.push(s);
|
|
19
|
+
}
|
|
20
|
+
const each: { from: number; to: number; text: string; worst: ContrastSample; severe: boolean }[] = [];
|
|
21
|
+
for (const [text, list] of byText) {
|
|
22
|
+
for (const r of runs(list.map((s) => s.t), 1.5 / o.shotFps)) {
|
|
23
|
+
if (r.to - r.from + 1 / o.shotFps < minSec) continue;
|
|
24
|
+
const inRun = list.filter((s) => s.t >= r.from && s.t <= r.to);
|
|
25
|
+
const worst = inRun.reduce((a, b) => (b.ratio < a.ratio ? b : a));
|
|
26
|
+
each.push({ from: r.from, to: r.to + 1 / o.shotFps, text, worst, severe: worst.ratio < errorBelow && worst.sizePx >= errorMinPx });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// 한 화면에 흐린 글이 여럿이면 한 줄로 — 고칠 곳은 대개 그 화면의 바탕이나 덮개 하나다.
|
|
30
|
+
each.sort((a, b) => a.from - b.from);
|
|
31
|
+
const groups: (typeof each)[] = [];
|
|
32
|
+
for (const e of each) {
|
|
33
|
+
const g = groups.find((x) => x[0].severe === e.severe && e.from < Math.max(...x.map((y) => y.to)) && e.to > x[0].from);
|
|
34
|
+
if (g) g.push(e);
|
|
35
|
+
else groups.push([e]);
|
|
36
|
+
}
|
|
37
|
+
return groups.map((g) => {
|
|
38
|
+
const worst = g.reduce((a, b) => (b.worst.ratio < a.worst.ratio ? b : a)).worst;
|
|
39
|
+
const severe = g[0].severe;
|
|
40
|
+
const names = g.slice(0, 4).map((x) => `"${x.text.trim()}"`).join(" · ");
|
|
41
|
+
return {
|
|
42
|
+
rule: "text.contrast",
|
|
43
|
+
severity: severe ? ("error" as const) : ("warn" as const),
|
|
44
|
+
from: Math.min(...g.map((x) => x.from)),
|
|
45
|
+
to: Math.max(...g.map((x) => x.to)),
|
|
46
|
+
message: `글자 대비가 낮다 — 가장 낮은 ${worst.ratio}:1 (${worst.sizePx}px) · 글 ${g.length}개: ${names}${g.length > 4 ? " …" : ""}${severe ? " — 거의 안 보인다" : " — 바탕과 3:1 이상 벌린다"}`,
|
|
47
|
+
detail: { ratio: worst.ratio, sizePx: worst.sizePx, box: roundBox(worst.box), texts: g.map((x) => ({ text: x.text, ratio: x.worst.ratio, from: x.from, to: x.to })) },
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function repeatable(samples: RepeatSample[]): Finding[] {
|
|
53
|
+
const bad = samples.filter((s) => s.diff > 0.5 || !s.textSame);
|
|
54
|
+
return bad.map((s) => ({
|
|
55
|
+
rule: "frame.nondeterministic",
|
|
56
|
+
severity: "error" as const,
|
|
57
|
+
from: s.t,
|
|
58
|
+
to: s.t,
|
|
59
|
+
message: `같은 시각을 두 번 그렸더니 달랐다(차 ${s.diff}${s.textSame ? "" : ", 글도 다름"}) — Math.random·Date.now·누적 상태를 t 의 함수로 바꾼다`,
|
|
60
|
+
detail: { diff: s.diff, textSame: s.textSame },
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export function pageErrors(errors: { t: number; text: string }[], fps: number): Finding[] {
|
|
65
|
+
const byText = new Map<string, number[]>();
|
|
66
|
+
for (const e of errors) {
|
|
67
|
+
// 시각만 다른 같은 오류(「@7.300」 따위)는 한데 묶는다.
|
|
68
|
+
const key = e.text.replace(/@?\d+\.\d+/g, "#").slice(0, 300);
|
|
69
|
+
if (!byText.has(key)) byText.set(key, []);
|
|
70
|
+
byText.get(key)!.push(e.t);
|
|
71
|
+
}
|
|
72
|
+
const out: Finding[] = [];
|
|
73
|
+
for (const [key, times] of byText) {
|
|
74
|
+
const first = errors.find((e) => e.text.replace(/@?\d+\.\d+/g, "#").slice(0, 300) === key)!;
|
|
75
|
+
const valid = times.filter((t) => t >= 0);
|
|
76
|
+
const rs = valid.length ? runs(valid, 1.5 / fps) : [{ from: 0, to: 0, count: times.length }];
|
|
77
|
+
out.push({
|
|
78
|
+
rule: "page.error",
|
|
79
|
+
severity: "error",
|
|
80
|
+
from: rs[0].from,
|
|
81
|
+
to: rs[rs.length - 1].to,
|
|
82
|
+
message: `페이지 오류 ${times.length}번${valid.length ? "" : "(불러올 때)"} — ${first.text.slice(0, 200)}`,
|
|
83
|
+
detail: { count: times.length, spans: rs.length },
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return out;
|
|
87
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface Run {
|
|
2
|
+
from: number;
|
|
3
|
+
to: number;
|
|
4
|
+
count: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// 정렬된 시각들을 maxGap 보다 가까운 것끼리 묶는다 — 「연속 프레임 묶음 = 한 번」.
|
|
8
|
+
export function runs(times: number[], maxGap: number): Run[] {
|
|
9
|
+
const out: Run[] = [];
|
|
10
|
+
for (const t of [...times].sort((a, b) => a - b)) {
|
|
11
|
+
const last = out[out.length - 1];
|
|
12
|
+
if (last && t - last.to <= maxGap) {
|
|
13
|
+
last.to = t;
|
|
14
|
+
last.count++;
|
|
15
|
+
} else {
|
|
16
|
+
out.push({ from: t, to: t, count: 1 });
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|