dsh-drawai 0.3.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +4142 -0
- package/README.md +43 -10
- package/lib/audio-media.js +147 -0
- package/lib/audio-service.js +66 -0
- package/lib/canvas-format.js +134 -0
- package/lib/client.js +5283 -223
- package/lib/comfyui-default-workflow.mjs +1825 -0
- package/lib/comfyui-workflow.mjs +426 -0
- package/lib/document-commands.js +12 -0
- package/lib/document-core.js +29 -0
- package/lib/drawing-tasks.js +26 -0
- package/lib/imagegen.mjs +596 -0
- package/lib/index.js +1758 -129
- package/lib/media.js +26 -13
- package/lib/mgstyle-core.js +75 -0
- package/lib/motion/apply.js +180 -0
- package/lib/motion/asset-pack-lock.js +10 -0
- package/lib/motion/asset-pack.js +335 -0
- package/lib/motion/assets.js +290 -0
- package/lib/motion/audio.js +103 -0
- package/lib/motion/audiolevel.js +63 -0
- package/lib/motion/audiomix.js +144 -0
- package/lib/motion/beats.js +337 -0
- package/lib/motion/builtin-assets.js +62 -0
- package/lib/motion/canvas-spec.js +442 -0
- package/lib/motion/capture.js +95 -0
- package/lib/motion/cards.js +80 -0
- package/lib/motion/collect.js +447 -0
- package/lib/motion/delivery.js +112 -0
- package/lib/motion/edge-speech.py +90 -0
- package/lib/motion/entry.jsx +73 -0
- package/lib/motion/export.js +200 -0
- package/lib/motion/ffmpeg.js +42 -0
- package/lib/motion/fonts.js +71 -0
- package/lib/motion/jobs.js +113 -0
- package/lib/motion/json.js +4 -0
- package/lib/motion/media-catalog.js +59 -0
- package/lib/motion/mgstyles/BRIEF-TEMPLATE.md +63 -0
- package/lib/motion/mgstyles/briefs/01-flat-vector.md +104 -0
- package/lib/motion/mgstyles/briefs/02-line-art.md +97 -0
- package/lib/motion/mgstyles/briefs/03-isometric.md +108 -0
- package/lib/motion/mgstyles/briefs/05-cel-boil.md +145 -0
- package/lib/motion/mgstyles/briefs/06-collage.md +149 -0
- package/lib/motion/mgstyles/briefs/07-liquid.md +106 -0
- package/lib/motion/mgstyles/briefs/08-morph.md +111 -0
- package/lib/motion/mgstyles/briefs/09-bauhaus.md +150 -0
- package/lib/motion/mgstyles/briefs/10-synthwave.md +151 -0
- package/lib/motion/mgstyles/briefs/12-aurora-glass.md +147 -0
- package/lib/motion/mgstyles/briefs/18-hanazi.md +140 -0
- package/lib/motion/mgstyles/briefs/19-paperclip.md +156 -0
- package/lib/motion/mgstyles/briefs/20-pixel.md +118 -0
- package/lib/motion/mgstyles/briefs/22-hud.md +118 -0
- package/lib/motion/mgstyles/catalog.d/01-flat-vector.json +34 -0
- package/lib/motion/mgstyles/catalog.d/02-line-art.json +34 -0
- package/lib/motion/mgstyles/catalog.d/03-isometric.json +35 -0
- package/lib/motion/mgstyles/catalog.d/05-cel-boil.json +28 -0
- package/lib/motion/mgstyles/catalog.d/06-collage.json +28 -0
- package/lib/motion/mgstyles/catalog.d/07-liquid.json +28 -0
- package/lib/motion/mgstyles/catalog.d/08-morph.json +28 -0
- package/lib/motion/mgstyles/catalog.d/09-bauhaus.json +28 -0
- package/lib/motion/mgstyles/catalog.d/10-synthwave.json +28 -0
- package/lib/motion/mgstyles/catalog.d/12-aurora-glass.json +28 -0
- package/lib/motion/mgstyles/catalog.d/18-hanazi.json +28 -0
- package/lib/motion/mgstyles/catalog.d/19-paperclip.json +28 -0
- package/lib/motion/mgstyles/catalog.d/20-pixel.json +28 -0
- package/lib/motion/mgstyles/catalog.d/22-hud.json +28 -0
- package/lib/motion/mgstyles/catalog.json +1356 -0
- package/lib/motion/mgstyles/upstream/README.md +147 -0
- package/lib/motion/mgstyles/upstream/README.zh-CN.md +147 -0
- package/lib/motion/mgstyles/upstream/demos/01-flat-vector/cues.json +1 -0
- package/lib/motion/mgstyles/upstream/demos/01-flat-vector/index.html +712 -0
- package/lib/motion/mgstyles/upstream/demos/02-line-art/cues.json +331 -0
- package/lib/motion/mgstyles/upstream/demos/02-line-art/film.js +676 -0
- package/lib/motion/mgstyles/upstream/demos/02-line-art/index.html +18 -0
- package/lib/motion/mgstyles/upstream/demos/02-line-art/tools/dump_timing.mjs +26 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/cues.json +109 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/index.html +25 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/anim.js +82 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/main.js +219 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/night5.js +180 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/render.js +202 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/title.js +167 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/title5.js +294 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/ui.js +141 -0
- package/lib/motion/mgstyles/upstream/demos/03-isometric/js/world.js +1399 -0
- package/lib/motion/mgstyles/upstream/demos/05-cel-boil/cues.json +157 -0
- package/lib/motion/mgstyles/upstream/demos/05-cel-boil/index.html +34 -0
- package/lib/motion/mgstyles/upstream/demos/05-cel-boil/js/engine.js +326 -0
- package/lib/motion/mgstyles/upstream/demos/05-cel-boil/js/scene.js +2036 -0
- package/lib/motion/mgstyles/upstream/demos/06-collage/assets/gen/layout.json +157 -0
- package/lib/motion/mgstyles/upstream/demos/06-collage/cues.json +80 -0
- package/lib/motion/mgstyles/upstream/demos/06-collage/index.html +889 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/cues.json +100 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/index.html +108 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/engine.js +153 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/links.js +64 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/lookdev.js +46 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/scene.js +963 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/shaders.js +647 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/textsdf.js +114 -0
- package/lib/motion/mgstyles/upstream/demos/07-liquid/js/type.js +50 -0
- package/lib/motion/mgstyles/upstream/demos/08-morph/cues.json +131 -0
- package/lib/motion/mgstyles/upstream/demos/08-morph/glyphs.json +1 -0
- package/lib/motion/mgstyles/upstream/demos/08-morph/index.html +901 -0
- package/lib/motion/mgstyles/upstream/demos/09-bauhaus/cues.json +270 -0
- package/lib/motion/mgstyles/upstream/demos/09-bauhaus/film.js +697 -0
- package/lib/motion/mgstyles/upstream/demos/09-bauhaus/index.html +12 -0
- package/lib/motion/mgstyles/upstream/demos/10-synthwave/cues.json +44 -0
- package/lib/motion/mgstyles/upstream/demos/10-synthwave/index.html +1028 -0
- package/lib/motion/mgstyles/upstream/demos/12-aurora-glass/cues.json +67 -0
- package/lib/motion/mgstyles/upstream/demos/12-aurora-glass/index.html +16 -0
- package/lib/motion/mgstyles/upstream/demos/12-aurora-glass/main.js +967 -0
- package/lib/motion/mgstyles/upstream/demos/12-aurora-glass/shaders.js +468 -0
- package/lib/motion/mgstyles/upstream/demos/18-hanazi/cues.json +117 -0
- package/lib/motion/mgstyles/upstream/demos/18-hanazi/index.html +541 -0
- package/lib/motion/mgstyles/upstream/demos/19-paperclip/assets/countries-110m.json +1 -0
- package/lib/motion/mgstyles/upstream/demos/19-paperclip/assets/stickers/meta.json +34 -0
- package/lib/motion/mgstyles/upstream/demos/19-paperclip/cues.json +285 -0
- package/lib/motion/mgstyles/upstream/demos/19-paperclip/index.html +599 -0
- package/lib/motion/mgstyles/upstream/demos/20-pixel/cues.json +42 -0
- package/lib/motion/mgstyles/upstream/demos/20-pixel/film.js +914 -0
- package/lib/motion/mgstyles/upstream/demos/20-pixel/index.html +18 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/cues.json +108 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/index.html +125 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/js/holo.js +275 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/js/hud.js +855 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/js/post.js +150 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/js/util.js +65 -0
- package/lib/motion/mgstyles/upstream/demos/22-hud/js/v5.js +142 -0
- package/lib/motion/mgstyles/upstream/harness/render.mjs +319 -0
- package/lib/motion/mgstyles/upstream/manifest.json +269 -0
- package/lib/motion/mgstyles/upstream/prompts/01-flat-vector.md +98 -0
- package/lib/motion/mgstyles/upstream/prompts/02-line-art.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/03-isometric.md +97 -0
- package/lib/motion/mgstyles/upstream/prompts/05-cel-boil.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/06-collage.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/07-liquid.md +98 -0
- package/lib/motion/mgstyles/upstream/prompts/08-morph.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/09-bauhaus.md +96 -0
- package/lib/motion/mgstyles/upstream/prompts/10-synthwave.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/12-aurora-glass.md +96 -0
- package/lib/motion/mgstyles/upstream/prompts/18-hanazi.md +95 -0
- package/lib/motion/mgstyles/upstream/prompts/19-paperclip.md +96 -0
- package/lib/motion/mgstyles/upstream/prompts/20-pixel.md +96 -0
- package/lib/motion/mgstyles/upstream/prompts/22-hud.md +95 -0
- package/lib/motion/mgstyles/upstream/rubric.md +51 -0
- package/lib/motion/mgstyles/upstream/template.md +36 -0
- package/lib/motion/pixelqa.js +198 -0
- package/lib/motion/preview.js +95 -0
- package/lib/motion/project.js +395 -0
- package/lib/motion/qa.js +290 -0
- package/lib/motion/reference-media.jsx +10 -0
- package/lib/motion/render-settings.js +112 -0
- package/lib/motion/render.js +159 -0
- package/lib/motion/scene-kit.js +183 -0
- package/lib/motion/sfx.js +232 -0
- package/lib/motion/shotcraft/ClipCard.tsx +204 -0
- package/lib/motion/shotcraft/catalog.json +2461 -0
- package/lib/motion/shotcraft/upstream/SKILL.md +286 -0
- package/lib/motion/shotcraft/upstream/assets/lib/Caption.tsx +54 -0
- package/lib/motion/shotcraft/upstream/assets/lib/ClipCard.tsx +200 -0
- package/lib/motion/shotcraft/upstream/assets/lib/DigitRoll.tsx +45 -0
- package/lib/motion/shotcraft/upstream/assets/lib/FlashCut.tsx +20 -0
- package/lib/motion/shotcraft/upstream/assets/lib/FlatPanel.tsx +65 -0
- package/lib/motion/shotcraft/upstream/assets/lib/PageCam.tsx +151 -0
- package/lib/motion/shotcraft/upstream/assets/lib/VerticalTicker.tsx +129 -0
- package/lib/motion/shotcraft/upstream/assets/lib/helpers/camera.tsx +75 -0
- package/lib/motion/shotcraft/upstream/assets/lib/helpers/motion.ts +40 -0
- package/lib/motion/shotcraft/upstream/assets/lib/helpers/rand.ts +11 -0
- package/lib/motion/shotcraft/upstream/assets/lib/helpers/shake.ts +10 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/__pycache__/sfx-source.cpython-313.pyc +0 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/build-readme-cover.mjs +49 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/capture-template.mjs +210 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/sfx-source.py +423 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/smoke-render-demos.py +170 -0
- package/lib/motion/shotcraft/upstream/assets/scripts/test_sfx_source.py +157 -0
- package/lib/motion/shotcraft/upstream/demos/README.md +120 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/Brand.tsx +112 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/Fixtures.tsx +647 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/Look.tsx +316 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/Motion.tsx +82 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/PageCam2D.tsx +115 -0
- package/lib/motion/shotcraft/upstream/demos/_fixtures/Polish.tsx +243 -0
- package/lib/motion/shotcraft/upstream/demos/_textures/live-layout.json +389 -0
- package/lib/motion/shotcraft/upstream/demos/camera/basic-3d-scene/Basic3DScene.tsx +250 -0
- package/lib/motion/shotcraft/upstream/demos/camera/crash-zoom-punch/CrashImpactReal.tsx +305 -0
- package/lib/motion/shotcraft/upstream/demos/camera/crash-zoom-punch/CrashZoomReal.tsx +246 -0
- package/lib/motion/shotcraft/upstream/demos/camera/cursor-flyover/CursorFlyover.tsx +390 -0
- package/lib/motion/shotcraft/upstream/demos/camera/depth-layer-moves/MultiplaneReal.tsx +138 -0
- package/lib/motion/shotcraft/upstream/demos/camera/graze-face-tour/GrazeFaceTour.tsx +542 -0
- package/lib/motion/shotcraft/upstream/demos/camera/overhead-camera-moves/OverheadTabletopDrop.tsx +315 -0
- package/lib/motion/shotcraft/upstream/demos/camera/overhead-camera-moves/TiltReveal.tsx +299 -0
- package/lib/motion/shotcraft/upstream/demos/camera/space-camera-moves/DroneDiveLanding.tsx +173 -0
- package/lib/motion/shotcraft/upstream/demos/camera/space-camera-moves/ExplodedView.tsx +348 -0
- package/lib/motion/shotcraft/upstream/demos/camera/steep-tilt-glide/SteepTiltGlide.tsx +366 -0
- package/lib/motion/shotcraft/upstream/demos/camera/tension-camera-moves/BulletTimeFreezeOrbit.tsx +279 -0
- package/lib/motion/shotcraft/upstream/demos/camera/tension-camera-moves/PullBackIsolation.tsx +184 -0
- package/lib/motion/shotcraft/upstream/demos/camera/terminal-3d/Terminal3D.tsx +390 -0
- package/lib/motion/shotcraft/upstream/demos/data/before-after-slider-scrub/BeforeAfterSliderScrub.tsx +155 -0
- package/lib/motion/shotcraft/upstream/demos/data/chart-live-moves/AxisRescaleShockV2.tsx +303 -0
- package/lib/motion/shotcraft/upstream/demos/data/chart-live-moves/OscilloscopeStreamV2.tsx +290 -0
- package/lib/motion/shotcraft/upstream/demos/data/chart-live-moves/UnitDotSwarmRegroupV2.tsx +278 -0
- package/lib/motion/shotcraft/upstream/demos/data/gauge-readout-moves/NeedleSweepSelftest.tsx +307 -0
- package/lib/motion/shotcraft/upstream/demos/data/gauge-readout-moves/TapeScrollFixedPointer.tsx +215 -0
- package/lib/motion/shotcraft/upstream/demos/data/scroll-brake-moves/BrakeReticleLock.tsx +299 -0
- package/lib/motion/shotcraft/upstream/demos/data/scroll-brake-moves/ChangelogScrollBrake.tsx +232 -0
- package/lib/motion/shotcraft/upstream/demos/data/timeline-travel/TimelineTravel.tsx +290 -0
- package/lib/motion/shotcraft/upstream/demos/effects/assemble-then-type-flyin/AssembleThenTypeFlyin.tsx +273 -0
- package/lib/motion/shotcraft/upstream/demos/effects/aurora-bloom-bg-flip/AuroraBloomBgFlip.tsx +167 -0
- package/lib/motion/shotcraft/upstream/demos/effects/brand-frame-snap/BrandFrameSnap.tsx +536 -0
- package/lib/motion/shotcraft/upstream/demos/effects/fui-hud-moves/ReticleLockOn.tsx +164 -0
- package/lib/motion/shotcraft/upstream/demos/effects/glow-flyline-moves/FlylineArc.tsx +175 -0
- package/lib/motion/shotcraft/upstream/demos/effects/glow-flyline-moves/GlowOrbAmbient.tsx +197 -0
- package/lib/motion/shotcraft/upstream/demos/effects/glow-flyline-moves/OrbFlylineRelay.tsx +241 -0
- package/lib/motion/shotcraft/upstream/demos/effects/icon-performance-moves/AttentionBounce.tsx +279 -0
- package/lib/motion/shotcraft/upstream/demos/effects/impact-feedback/AnimeImpact.tsx +230 -0
- package/lib/motion/shotcraft/upstream/demos/effects/impact-feedback/HitCounter.tsx +345 -0
- package/lib/motion/shotcraft/upstream/demos/effects/light-play-moves/SheenSweepRetry.tsx +275 -0
- package/lib/motion/shotcraft/upstream/demos/effects/light-play-moves/SpotlightSweepReveal.tsx +229 -0
- package/lib/motion/shotcraft/upstream/demos/effects/radial-ripple-phone-chips/RadialRipplePhoneChips.tsx +312 -0
- package/lib/motion/shotcraft/upstream/demos/effects/riso-print-hits/RisoMisregistrationHit.tsx +222 -0
- package/lib/motion/shotcraft/upstream/demos/effects/scan-bracket-sweep/ScanBracketSweep.tsx +295 -0
- package/lib/motion/shotcraft/upstream/demos/effects/scanline-annotate-focus/ScanlineAnnotateFocus.tsx +329 -0
- package/lib/motion/shotcraft/upstream/demos/effects/scanline-assemble-flyin/ScanlineAssembleFlyin.tsx +315 -0
- package/lib/motion/shotcraft/upstream/demos/effects/slam-entrance-moves/ImpactBurstKit.tsx +264 -0
- package/lib/motion/shotcraft/upstream/demos/effects/slam-entrance-moves/KanadaPerspectiveSnap.tsx +260 -0
- package/lib/motion/shotcraft/upstream/demos/effects/slam-entrance-moves/ScoreSlam.tsx +263 -0
- package/lib/motion/shotcraft/upstream/demos/effects/spotlight-sweep-moves/CornerSpotlightReveal.tsx +123 -0
- package/lib/motion/shotcraft/upstream/demos/effects/spotlight-sweep-moves/GlowWakeSleepPanel.tsx +187 -0
- package/lib/motion/shotcraft/upstream/demos/effects/spotlight-sweep-moves/SlideSpotlightPan.tsx +175 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/autolayout-gap-dial/AutolayoutGapDial.tsx +305 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/canvas-materialize-moves/DiagramCascadeBuild.tsx +350 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/canvas-materialize-moves/PanelToCanvasMaterialize.tsx +352 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/chip-grid-single-select-blackout/ChipGridSingleSelectBlackout.tsx +218 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/collab-cursor-moves/CursorCastEnsemble.tsx +297 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/glass-pill-dictation-typing/GlassPillDictationTyping.tsx +157 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/hashtag-to-pill-materialize/HashtagToPillMaterialize.tsx +218 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/picker-carousel-feature-cycle/PickerCarouselFeatureCycle.tsx +202 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/segmented-thumb-hero/SegmentedThumbHero.tsx +265 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/theme-switch-moves/PaletteThemeRipple.tsx +457 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/theme-switch-moves/ThemeSweepToggle.tsx +446 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/type-and-filter/TypeAndFilter.tsx +249 -0
- package/lib/motion/shotcraft/upstream/demos/interaction/voice-waveform-live/VoiceWaveformLive.tsx +278 -0
- package/lib/motion/shotcraft/upstream/demos/opening/crane-rise-reveal/CraneRiseReveal.tsx +332 -0
- package/lib/motion/shotcraft/upstream/demos/opening/dataviz-landscape-open/DatavizLandscapeOpen.tsx +358 -0
- package/lib/motion/shotcraft/upstream/demos/opening/fracture/Fracture.tsx +201 -0
- package/lib/motion/shotcraft/upstream/demos/opening/icon-field-colorize/IconFieldColorize.tsx +200 -0
- package/lib/motion/shotcraft/upstream/demos/opening/letterspace-materialize/LetterspaceMaterialize.tsx +208 -0
- package/lib/motion/shotcraft/upstream/demos/opening/magician-card-flourish/MagicianCardFlourish.tsx +341 -0
- package/lib/motion/shotcraft/upstream/demos/opening/orbit-ring-title-open/OrbitRingTitleOpen.tsx +389 -0
- package/lib/motion/shotcraft/upstream/demos/opening/spotlight-hero-card/SpotlightHeroCard.tsx +293 -0
- package/lib/motion/shotcraft/upstream/demos/opening/stroke-segment-build/StrokeSegmentBuild.tsx +183 -0
- package/lib/motion/shotcraft/upstream/demos/opening/text-as-mask/TextAsMask.tsx +245 -0
- package/lib/motion/shotcraft/upstream/demos/outro/grain-dissolve/GrainDissolve.tsx +222 -0
- package/lib/motion/shotcraft/upstream/demos/outro/logo-shrink-wordmark-lockup/LogoShrinkWordmarkLockup.tsx +223 -0
- package/lib/motion/shotcraft/upstream/demos/outro/neon-triple-marquee/NeonTripleMarquee.tsx +217 -0
- package/lib/motion/shotcraft/upstream/demos/outro/outro-group-photo-launch/OutroGroupPhotoLaunch.tsx +343 -0
- package/lib/motion/shotcraft/upstream/demos/outro/ui-strip-away-outro/UiStripAwayOutro.tsx +357 -0
- package/lib/motion/shotcraft/upstream/demos/outro/ui-to-brand-morph/IconFlipBloomLogo.tsx +187 -0
- package/lib/motion/shotcraft/upstream/demos/outro/ui-to-brand-morph/InputMorphsIntoLogo.tsx +333 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/beat-cut-moves/PaparazziFlash.tsx +274 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/beat-step-list-theme-cycle/BeatStepListThemeCycle.tsx +270 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/panel-grid-moves/ComicPanelSplit.tsx +430 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/quad-split-parallel-scenes/QuadSplitParallelScenes.tsx +252 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/rhythm-interrupt-moves/JumpCutPunchIn.tsx +106 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/sakuga-timing-shift/SakugaTimingShift.tsx +288 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/speed-ramp-freeze/FreezeAnnotateReal.tsx +362 -0
- package/lib/motion/shotcraft/upstream/demos/rhythm/trailer-grammar-moves/TrailerBumper.tsx +168 -0
- package/lib/motion/shotcraft/upstream/demos/transition/bottom-push-stack-wipe/BottomPushStackWipe.tsx +310 -0
- package/lib/motion/shotcraft/upstream/demos/transition/card-flip-reveal/CardFlipReveal.tsx +261 -0
- package/lib/motion/shotcraft/upstream/demos/transition/card-flock-tumble/CardFlockTumble.tsx +459 -0
- package/lib/motion/shotcraft/upstream/demos/transition/circle-match-iris/CircleMatchIris.tsx +294 -0
- package/lib/motion/shotcraft/upstream/demos/transition/gradient-transition/GradientTransition.tsx +161 -0
- package/lib/motion/shotcraft/upstream/demos/transition/line-carry-transition/LineCarryTransition.tsx +248 -0
- package/lib/motion/shotcraft/upstream/demos/transition/mosaic-reframe/MosaicReframe.tsx +359 -0
- package/lib/motion/shotcraft/upstream/demos/transition/page-turn-transitions/BarnDoorSplit.tsx +227 -0
- package/lib/motion/shotcraft/upstream/demos/transition/print-texture-transitions/InkBleedReveal.tsx +162 -0
- package/lib/motion/shotcraft/upstream/demos/transition/shot-transitions/PortalWipeV2.tsx +248 -0
- package/lib/motion/shotcraft/upstream/demos/transition/shot-transitions/WhipBrakeReal.tsx +186 -0
- package/lib/motion/shotcraft/upstream/demos/transition/tear-streak-transitions/GlitchDisplace.tsx +355 -0
- package/lib/motion/shotcraft/upstream/demos/transition/transition-hidden-cut/InvisibleCut.tsx +272 -0
- package/lib/motion/shotcraft/upstream/demos/transition/transition-hidden-cut/LightLeakBurn.tsx +262 -0
- package/lib/motion/shotcraft/upstream/demos/transition/transition-hidden-cut/VersusSlam.tsx +217 -0
- package/lib/motion/shotcraft/upstream/demos/transition/transition-travel/LetterformZoom.tsx +285 -0
- package/lib/motion/shotcraft/upstream/demos/transition/white-flash-logo-simplify-cut/WhiteFlashLogoSimplifyCut.tsx +205 -0
- package/lib/motion/shotcraft/upstream/demos/transition/wipe-transitions/BlindsSlice.tsx +178 -0
- package/lib/motion/shotcraft/upstream/demos/typography/blur-slide/BlurSlide.tsx +147 -0
- package/lib/motion/shotcraft/upstream/demos/typography/brace-expand/BraceExpand.tsx +143 -0
- package/lib/motion/shotcraft/upstream/demos/typography/brand-ink-open/BrandInkOpen.tsx +134 -0
- package/lib/motion/shotcraft/upstream/demos/typography/countdown-arc-scatter/CountdownArcScatter.tsx +217 -0
- package/lib/motion/shotcraft/upstream/demos/typography/flying-words/FlyingWords.tsx +198 -0
- package/lib/motion/shotcraft/upstream/demos/typography/glitch-cycle/GlitchCycle.tsx +221 -0
- package/lib/motion/shotcraft/upstream/demos/typography/gradient-word-sweep/GradientWordSweep.tsx +312 -0
- package/lib/motion/shotcraft/upstream/demos/typography/lead-word-zoom-assemble/LeadWordZoomAssemble.tsx +261 -0
- package/lib/motion/shotcraft/upstream/demos/typography/marker-underline-title/MarkerUnderlineTitle.tsx +121 -0
- package/lib/motion/shotcraft/upstream/demos/typography/outline-word-fill/OutlineWordFill.tsx +153 -0
- package/lib/motion/shotcraft/upstream/demos/typography/paper-title-card/PaperTitleCard.tsx +179 -0
- package/lib/motion/shotcraft/upstream/demos/typography/pill-chip-slot-cycle-handled/PillChipSlotCycleHandled.tsx +140 -0
- package/lib/motion/shotcraft/upstream/demos/typography/pill-slot-cycle/PillSlotCycle.tsx +309 -0
- package/lib/motion/shotcraft/upstream/demos/typography/text-column-converge/TextColumnConverge.tsx +191 -0
- package/lib/motion/shotcraft/upstream/demos/typography/title-demote-to-label/TitleDemoteToLabel.tsx +292 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-assembly-moves/LetterformDriftAssembly.tsx +135 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-assembly-moves/SplitTextStagger.tsx +124 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-assembly-moves/TextOnPath.tsx +255 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-entrance-moves/LetterDropPhysics.tsx +173 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-rhythm-sync/FontWeightPump.tsx +225 -0
- package/lib/motion/shotcraft/upstream/demos/typography/type-rhythm-sync/KaraokeFillSync.tsx +141 -0
- package/lib/motion/shotcraft/upstream/demos/typography/typewriter-moves/TypewriterErrorRetype.tsx +137 -0
- package/lib/motion/shotcraft/upstream/demos/typography/vertical-word-roll-blur-cycle/VerticalWordRollBlurCycle.tsx +147 -0
- package/lib/motion/shotcraft/upstream/demos/typography/word-relay-filmstrip/WordRelayFilmstrip.tsx +409 -0
- package/lib/motion/shotcraft/upstream/demos/typography/word-relay-geometry/WordRelayGeometry.tsx +280 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/avatar-bracket-carousel/AvatarBracketCarousel.tsx +271 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/bezier-source-converge-merge/BezierSourceConvergeMerge.tsx +385 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/card-stack/CardStack.tsx +312 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/carousel-3d/Carousel3D.tsx +303 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/clipcard-looping/ClipCardLooping.tsx +77 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/cloner-depth-echo/ClonerDepthEcho.tsx +311 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/deck-deal-flyin/DeckDealFlyin.tsx +307 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/doc-park-left-pill-deal/DocParkLeftPillDeal.tsx +349 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/document-typewriter-reveal/DocumentTypewriterReveal.tsx +255 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/draw-svg-trace/DrawSvgTrace.tsx +244 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/element-body-moves/ContactShadowLift.tsx +217 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/integration-hub-map/IntegrationHubMap.tsx +652 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/list-reveal/ListReveal.tsx +153 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/list-stack-press/ListStackPress.tsx +238 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/neon-frame-forerun/NeonFrameForerun.tsx +324 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/neon-frame-orbit-drop/NeonFrameForerunOrbit.tsx +354 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/page-waterfall-wall/PageWaterfallWall.tsx +101 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/page-waterfall-wall/VerticalTicker.tsx +129 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/product-card-progressive-assemble/ProductCardProgressiveAssemble.tsx +297 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/radial-wave/RadialWave.tsx +57 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/research-card-stack-scroll/ResearchCardStackScroll.tsx +155 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/row-embed/RowEmbed.tsx +175 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/value-stagger-gradient/ValueStaggerGradient.tsx +153 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/wall-reveal-moves/BentoLightUp.tsx +146 -0
- package/lib/motion/shotcraft/upstream/demos/ui-entrance/wall-reveal-moves/WireframeDrawOn.tsx +226 -0
- package/lib/motion/shotcraft/upstream/gallery/api/library.json +1 -0
- package/lib/motion/shotcraft/upstream/manifest.json +2715 -0
- package/lib/motion/shotcraft/upstream/references/aesthetic-rules.md +193 -0
- package/lib/motion/shotcraft/upstream/references/final-review.md +121 -0
- package/lib/motion/shotcraft/upstream/references/guided-free-creation.md +199 -0
- package/lib/motion/shotcraft/upstream/references/jianying-export.md +183 -0
- package/lib/motion/shotcraft/upstream/references/music-beat-sync.md +257 -0
- package/lib/motion/shotcraft/upstream/references/pipeline.md +382 -0
- package/lib/motion/shotcraft/upstream/references/publish-upload-post.md +111 -0
- package/lib/motion/shotcraft/upstream/references/sequences/promo-energy-arc.md +50 -0
- package/lib/motion/shotcraft/upstream/references/sfx-sourcing.md +95 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/basic-3d-scene.md +41 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/crash-zoom-punch.md +52 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/cursor-flyover.md +39 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/depth-layer-moves.md +39 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/graze-face-tour.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/overhead-camera-moves.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/space-camera-moves.md +46 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/steep-tilt-glide.md +52 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/tension-camera-moves.md +43 -0
- package/lib/motion/shotcraft/upstream/references/shots/camera/terminal-3d.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/data/before-after-slider-scrub.md +48 -0
- package/lib/motion/shotcraft/upstream/references/shots/data/chart-live-moves.md +52 -0
- package/lib/motion/shotcraft/upstream/references/shots/data/gauge-readout-moves.md +45 -0
- package/lib/motion/shotcraft/upstream/references/shots/data/scroll-brake-moves.md +46 -0
- package/lib/motion/shotcraft/upstream/references/shots/data/timeline-travel.md +44 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/assemble-then-type-flyin.md +63 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/aurora-bloom-bg-flip.md +54 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/brand-frame-snap.md +58 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/fui-hud-moves.md +35 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/glow-flyline-moves.md +53 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/icon-performance-moves.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/impact-feedback.md +50 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/light-play-moves.md +46 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/radial-ripple-phone-chips.md +56 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/riso-print-hits.md +49 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/scan-bracket-sweep.md +50 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/scanline-annotate-focus.md +53 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/scanline-assemble-flyin.md +53 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/slam-entrance-moves.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/effects/spotlight-sweep-moves.md +52 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/autolayout-gap-dial.md +60 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/canvas-materialize-moves.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/chip-grid-single-select-blackout.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/collab-cursor-moves.md +41 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/glass-pill-dictation-typing.md +53 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/hashtag-to-pill-materialize.md +60 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/picker-carousel-feature-cycle.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/segmented-thumb-hero.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/theme-switch-moves.md +47 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/type-and-filter.md +37 -0
- package/lib/motion/shotcraft/upstream/references/shots/interaction/voice-waveform-live.md +54 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/brand-ink-open.md +36 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/crane-rise-reveal.md +56 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/dataviz-landscape-open.md +56 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/fracture.md +40 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/icon-field-colorize.md +60 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/letterspace-materialize.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/magician-card-flourish.md +73 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/orbit-ring-title-open.md +87 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/spotlight-hero-card.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/stroke-segment-build.md +50 -0
- package/lib/motion/shotcraft/upstream/references/shots/opening/text-as-mask.md +59 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/grain-dissolve.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/logo-shrink-wordmark-lockup.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/neon-triple-marquee.md +59 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/outro-group-photo-launch.md +39 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/ui-strip-away-outro.md +61 -0
- package/lib/motion/shotcraft/upstream/references/shots/outro/ui-to-brand-morph.md +52 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/beat-cut-moves.md +50 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/beat-step-list-theme-cycle.md +66 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/panel-grid-moves.md +43 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/quad-split-parallel-scenes.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/rhythm-interrupt-moves.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/sakuga-timing-shift.md +56 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/speed-ramp-freeze.md +44 -0
- package/lib/motion/shotcraft/upstream/references/shots/rhythm/trailer-grammar-moves.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/bottom-push-stack-wipe.md +63 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/card-flip-reveal.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/card-flock-tumble.md +63 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/circle-match-iris.md +58 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/gradient-transition.md +45 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/line-carry-transition.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/mosaic-reframe.md +49 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/page-turn-transitions.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/print-texture-transitions.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/shot-transitions.md +45 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/tear-streak-transitions.md +48 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/transition-hidden-cut.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/transition-travel.md +43 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/white-flash-logo-simplify-cut.md +41 -0
- package/lib/motion/shotcraft/upstream/references/shots/transition/wipe-transitions.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/blur-slide.md +59 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/brace-expand.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/countdown-arc-scatter.md +65 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/document-typewriter-reveal.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/flying-words.md +64 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/glitch-cycle.md +64 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/gradient-word-sweep.md +54 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/lead-word-zoom-assemble.md +91 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/marker-underline-title.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/outline-word-fill.md +66 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/paper-title-card.md +38 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/pill-chip-slot-cycle-handled.md +66 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/pill-slot-cycle.md +58 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/text-column-converge.md +61 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/title-demote-to-label.md +64 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/type-assembly-moves.md +45 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/type-entrance-moves.md +41 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/type-rhythm-sync.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/typewriter-moves.md +42 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/vertical-word-roll-blur-cycle.md +63 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/word-relay-filmstrip.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/typography/word-relay-geometry.md +75 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/avatar-bracket-carousel.md +59 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/bezier-source-converge-merge.md +67 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/card-stack.md +60 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/carousel-3d.md +66 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/cloner-depth-echo.md +40 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/deck-deal-flyin.md +45 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/doc-park-left-pill-deal.md +62 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/draw-svg-trace.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/element-body-moves.md +37 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/integration-hub-map.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/list-reveal.md +50 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/list-stack-press.md +43 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/neon-frame-forerun.md +55 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/neon-frame-orbit-drop.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/page-waterfall-wall.md +51 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/product-card-progressive-assemble.md +56 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/radial-wave.md +49 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/research-card-stack-scroll.md +57 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/row-embed.md +36 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/value-stagger-gradient.md +64 -0
- package/lib/motion/shotcraft/upstream/references/shots/ui-entrance/wall-reveal-moves.md +47 -0
- package/lib/motion/shotcraft/upstream/references/sound-design.md +170 -0
- package/lib/motion/shotcraft/upstream/references/workbench.md +157 -0
- package/lib/motion/shotcraft/upstream/template/TEMPLATE.md +103 -0
- package/lib/motion/shotcraft/upstream/template/THEMES.md +44 -0
- package/lib/motion/shotcraft/upstream/template/package.json +20 -0
- package/lib/motion/shotcraft/upstream/template/remotion.config.ts +6 -0
- package/lib/motion/shotcraft/upstream/template/src/Root.tsx +17 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/Caption.tsx +65 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/DigitRoll.tsx +48 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/FlashCut.tsx +24 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/Main.tsx +192 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/PaperTitleCard.tsx +111 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/PageCam.tsx +150 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/SceneDetail.tsx +158 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/SceneFlyIn.tsx +468 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/SceneOpen.tsx +552 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/SceneOutroLive.tsx +411 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/ScenePapers.tsx +200 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live/SceneWbr.tsx +324 -0
- package/lib/motion/shotcraft/upstream/template/src/aifl/live-layout.json +389 -0
- package/lib/motion/shotcraft/upstream/template/src/index.ts +4 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/ThemedFilm.tsx +7 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/manifest.tsx +68 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/palette-assets.json +1 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/palette-assets.ts +24 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/palettes.json +74 -0
- package/lib/motion/shotcraft/upstream/template/src/themes/visual-theme.tsx +91 -0
- package/lib/motion/shotcraft/upstream/template/src/workbench.ts +213 -0
- package/lib/motion/shotcraft/upstream/template/tsconfig.json +15 -0
- package/lib/motion/spec.js +113 -0
- package/lib/motion/style-engine.js +153 -0
- package/lib/motion/style-frames.js +268 -0
- package/lib/motion/sync.js +214 -0
- package/lib/motion/theme.js +121 -0
- package/lib/motion/voice.js +417 -0
- package/lib/motion-agent-files.js +82 -0
- package/lib/motion-agent-protocol.js +66 -0
- package/lib/motion-agent-tools.js +196 -0
- package/lib/motion-agent.js +171 -0
- package/lib/motion-capture.js +92 -0
- package/lib/motion-core.js +238 -0
- package/lib/motion-film-review.js +71 -0
- package/lib/motion-library.js +210 -0
- package/lib/motion-planner.js +254 -0
- package/lib/motion-project.js +80 -0
- package/lib/motion-render-worker.js +145 -0
- package/lib/motion-session.js +32 -0
- package/lib/motion-source.js +49 -0
- package/lib/motion-tasks.js +452 -0
- package/lib/motion-vision.js +43 -0
- package/lib/mxfile.js +27 -7
- package/lib/routing/node-runtime.js +14 -0
- package/lib/routing/router.js +211 -0
- package/lib/routing/vendor/README.md +96 -0
- package/lib/routing/vendor/libavoid-routing.js +753 -0
- package/lib/routing/vendor/libavoid.min.js +59 -0
- package/lib/shotcard-core.js +39 -0
- package/lib/shotcard-reference.js +56 -0
- package/lib/style-kernel.js +37 -3
- package/lib/task-patches.js +26 -2
- package/lib/video-export.js +17 -2
- package/package.json +29 -4
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 动效素材包(字体 + 素材库)的定位与按需下载。
|
|
3
|
+
*
|
|
4
|
+
* 背景:素材约 200MB,塞进 npm tarball 会让包变成 147MB(0.4.0 实测),既不合适
|
|
5
|
+
* 也不好发。改成发到 GitHub Release,插件首次用到时下载一次、逐文件校验、落到
|
|
6
|
+
* 用户目录(`~/.dsh/drawai-assets/<version>/`),之后离线可用。
|
|
7
|
+
*
|
|
8
|
+
* 解析顺序(第一个命中的赢):
|
|
9
|
+
* 1. 环境变量 DRAWAI_ASSETS_DIR —— 测试与自定义安装位置
|
|
10
|
+
* 2. 与代码同级(`lib/motion/` 或 `src/motion/`)—— 开发目录 / 源码安装
|
|
11
|
+
* 3. 用户缓存目录 —— 下载下来的那一份
|
|
12
|
+
*
|
|
13
|
+
* 注意别和 `./assets.js` 搞混:那个管的是**工程里的**素材清单(capture/probe)。
|
|
14
|
+
*/
|
|
15
|
+
import { spawn } from 'node:child_process'
|
|
16
|
+
import { createHash } from 'node:crypto'
|
|
17
|
+
import { createReadStream, createWriteStream, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs'
|
|
18
|
+
import { homedir } from 'node:os'
|
|
19
|
+
import { dirname, join } from 'node:path'
|
|
20
|
+
import { fileURLToPath } from 'node:url'
|
|
21
|
+
import { gunzipSync } from 'node:zlib'
|
|
22
|
+
|
|
23
|
+
import { ASSETS_LOCK } from './asset-pack-lock.js'
|
|
24
|
+
|
|
25
|
+
export const ASSETS_VERSION = ASSETS_LOCK.version
|
|
26
|
+
export const ASSETS_FILE = ASSETS_LOCK.file
|
|
27
|
+
export const ASSETS_REPO = 'fourzkw/dsh-drawai'
|
|
28
|
+
export const ASSETS_TAG = `assets-${ASSETS_VERSION}`
|
|
29
|
+
/** 默认走 GitHub Release;企业内网 / 镜像可用 DRAWAI_ASSETS_URL 指到自己的地址。 */
|
|
30
|
+
export const ASSETS_URL = process.env.DRAWAI_ASSETS_URL || `https://github.com/${ASSETS_REPO}/releases/download/${ASSETS_TAG}/${ASSETS_FILE}`
|
|
31
|
+
export const ASSETS_PAGE = `https://github.com/${ASSETS_REPO}/releases/tag/${ASSETS_TAG}`
|
|
32
|
+
|
|
33
|
+
const SENTINELS = ['fonts/font-faces.json', 'media-library']
|
|
34
|
+
const READY_FILE = '.ready.json'
|
|
35
|
+
|
|
36
|
+
/** 素材缺失 / 下载失败时抛这个:带够用户能自己动手排查的信息。 */
|
|
37
|
+
export class AssetPackError extends Error {
|
|
38
|
+
constructor(message, detail = {}) {
|
|
39
|
+
super(message)
|
|
40
|
+
this.name = 'AssetPackError'
|
|
41
|
+
this.code = detail.code || 'assets-unavailable'
|
|
42
|
+
this.url = ASSETS_URL
|
|
43
|
+
this.dir = detail.dir || cacheDir()
|
|
44
|
+
this.cause = detail.cause
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function cacheDir() {
|
|
49
|
+
const custom = process.env.DRAWAI_ASSETS_DIR
|
|
50
|
+
if (custom) return custom
|
|
51
|
+
return join(homedir(), '.dsh', 'drawai-assets', ASSETS_VERSION)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function isReady(dir) {
|
|
55
|
+
if (!dir) return false
|
|
56
|
+
try {
|
|
57
|
+
return SENTINELS.every((rel) => existsSync(join(dir, rel)))
|
|
58
|
+
} catch {
|
|
59
|
+
return false
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function bundledDir() {
|
|
64
|
+
try {
|
|
65
|
+
return fileURLToPath(new URL('./', import.meta.url))
|
|
66
|
+
} catch {
|
|
67
|
+
return null
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** 已经能用的素材根目录;没有就返回 null。同步、很便宜。 */
|
|
72
|
+
export function assetsRoot() {
|
|
73
|
+
const bundled = bundledDir()
|
|
74
|
+
if (isReady(bundled)) return bundled
|
|
75
|
+
const cache = cacheDir()
|
|
76
|
+
if (isReady(cache)) return cache
|
|
77
|
+
return null
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** 给状态展示用:不下载、只报告。 */
|
|
81
|
+
export function assetsState() {
|
|
82
|
+
const bundled = bundledDir()
|
|
83
|
+
if (isReady(bundled)) return { ready: true, source: 'bundled', root: bundled, dir: cacheDir(), version: ASSETS_VERSION }
|
|
84
|
+
const cache = cacheDir()
|
|
85
|
+
if (isReady(cache)) return { ready: true, source: 'cache', root: cache, dir: cache, version: ASSETS_VERSION }
|
|
86
|
+
return { ready: false, source: null, root: null, dir: cache, version: ASSETS_VERSION, url: ASSETS_URL }
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function readManifest(root) {
|
|
90
|
+
const file = join(root, 'manifest.json')
|
|
91
|
+
if (!existsSync(file)) return null
|
|
92
|
+
try {
|
|
93
|
+
return JSON.parse(readFileSync(file, 'utf8'))
|
|
94
|
+
} catch {
|
|
95
|
+
return null
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function readTar(buf) {
|
|
100
|
+
const entries = []
|
|
101
|
+
let offset = 0
|
|
102
|
+
while (offset + 512 <= buf.length) {
|
|
103
|
+
const header = buf.subarray(offset, offset + 512)
|
|
104
|
+
if (header.every((byte) => byte === 0)) break
|
|
105
|
+
const raw = (start, len) => header.subarray(start, start + len).toString('utf8').replace(/\0.*$/, '').trim()
|
|
106
|
+
const prefix = raw(345, 155)
|
|
107
|
+
const name = raw(0, 100)
|
|
108
|
+
const size = parseInt(raw(124, 12) || '0', 8) || 0
|
|
109
|
+
const flag = String.fromCharCode(header[156] || 48)
|
|
110
|
+
const full = (prefix ? prefix + '/' + name : name).replace(/^\/+/, '')
|
|
111
|
+
offset += 512
|
|
112
|
+
const data = buf.subarray(offset, offset + size)
|
|
113
|
+
offset += Math.ceil(size / 512) * 512
|
|
114
|
+
if (flag === '5') continue
|
|
115
|
+
if (!full) continue
|
|
116
|
+
if (flag !== '0' && flag !== '\0' && flag !== '7') continue
|
|
117
|
+
entries.push({ path: full, data })
|
|
118
|
+
}
|
|
119
|
+
return entries
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function assertSafePath(rel) {
|
|
123
|
+
if (!rel || rel.startsWith('/') || /^[a-zA-Z]:/.test(rel)) throw new Error('素材包里有非法路径:' + rel)
|
|
124
|
+
if (rel.split('/').includes('..')) throw new Error('素材包里有越级路径:' + rel)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Node 22 的 fetch 不认系统/环境代理(NODE_USE_ENV_PROXY 要 24+),
|
|
129
|
+
* 国内直连 github.com 基本连不上。所以设了代理就走 curl(Win10+ / macOS / 主流 Linux 都自带),
|
|
130
|
+
* 由它处理 CONNECT 隧道与重定向。
|
|
131
|
+
*/
|
|
132
|
+
function proxyFromEnv() {
|
|
133
|
+
const raw = process.env.HTTPS_PROXY || process.env.https_proxy
|
|
134
|
+
|| process.env.HTTP_PROXY || process.env.http_proxy
|
|
135
|
+
|| process.env.ALL_PROXY || process.env.all_proxy
|
|
136
|
+
return raw && raw.trim() ? raw.trim() : ''
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function hashFile(path) {
|
|
140
|
+
return new Promise((resolve, reject) => {
|
|
141
|
+
const hash = createHash('sha256')
|
|
142
|
+
const stream = createReadStream(path)
|
|
143
|
+
stream.on('data', (chunk) => hash.update(chunk))
|
|
144
|
+
stream.on('end', () => resolve(hash.digest('hex')))
|
|
145
|
+
stream.on('error', reject)
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function downloadCurl(url, dest, onProgress, proxy) {
|
|
150
|
+
return new Promise((resolve, reject) => {
|
|
151
|
+
const args = [
|
|
152
|
+
'-L', '--fail', '--silent', '--show-error',
|
|
153
|
+
'--connect-timeout', '20', '--retry', '2', '--retry-delay', '2',
|
|
154
|
+
'-o', dest,
|
|
155
|
+
]
|
|
156
|
+
if (proxy) args.push('--proxy', proxy)
|
|
157
|
+
args.push(url)
|
|
158
|
+
const child = spawn('curl', args, { stdio: ['ignore', 'ignore', 'pipe'], windowsHide: true })
|
|
159
|
+
let stderr = ''
|
|
160
|
+
child.stderr.on('data', (chunk) => { if (stderr.length < 500) stderr += chunk.toString() })
|
|
161
|
+
const timer = setInterval(() => {
|
|
162
|
+
try { if (onProgress) onProgress(statSync(dest).size, 0) } catch { /* 还没建文件 */ }
|
|
163
|
+
}, 2000)
|
|
164
|
+
child.on('error', (err) => { clearInterval(timer); reject(err) })
|
|
165
|
+
child.on('close', async (code) => {
|
|
166
|
+
clearInterval(timer)
|
|
167
|
+
if (code !== 0) return reject(new Error('curl 退出码 ' + code + (stderr ? ':' + stderr.trim() : '')))
|
|
168
|
+
try {
|
|
169
|
+
const bytes = statSync(dest).size
|
|
170
|
+
resolve({ bytes, sha256: await hashFile(dest) })
|
|
171
|
+
} catch (err) { reject(err) }
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
async function downloadFetch(url, dest, onProgress) {
|
|
177
|
+
if (typeof fetch !== 'function') throw new AssetPackError('当前 Node 没有 fetch(需要 18+)', { code: 'no-fetch' })
|
|
178
|
+
let res
|
|
179
|
+
try {
|
|
180
|
+
res = await fetch(url, { redirect: 'follow', headers: { 'user-agent': 'dsh-drawai-assets' } })
|
|
181
|
+
} catch (err) {
|
|
182
|
+
const wrapped = new Error(err?.message || String(err))
|
|
183
|
+
wrapped.cause = err
|
|
184
|
+
throw wrapped
|
|
185
|
+
}
|
|
186
|
+
if (!res.ok) throw new AssetPackError('下载失败:HTTP ' + res.status + '(' + url + ')', { code: 'http-' + res.status })
|
|
187
|
+
const total = Number(res.headers.get('content-length') || 0)
|
|
188
|
+
const hash = createHash('sha256')
|
|
189
|
+
const out = createWriteStream(dest)
|
|
190
|
+
let got = 0
|
|
191
|
+
let lastTick = 0
|
|
192
|
+
try {
|
|
193
|
+
for await (const chunk of res.body) {
|
|
194
|
+
hash.update(chunk)
|
|
195
|
+
got += chunk.length
|
|
196
|
+
if (!out.write(chunk)) await new Promise((resolve) => out.once('drain', resolve))
|
|
197
|
+
const now = Date.now()
|
|
198
|
+
if (onProgress && now - lastTick > 2000) {
|
|
199
|
+
lastTick = now
|
|
200
|
+
onProgress(got, total)
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
} finally {
|
|
204
|
+
await new Promise((resolve) => out.end(resolve))
|
|
205
|
+
}
|
|
206
|
+
return { bytes: got, sha256: hash.digest('hex') }
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
async function downloadTo(url, dest, onProgress) {
|
|
210
|
+
const proxy = proxyFromEnv()
|
|
211
|
+
try {
|
|
212
|
+
return await downloadFetch(url, dest, onProgress)
|
|
213
|
+
} catch (first) {
|
|
214
|
+
if (!proxy) throw new AssetPackError('连不上 GitHub:' + (first?.message || first), { code: 'network', cause: first })
|
|
215
|
+
try {
|
|
216
|
+
return await downloadCurl(url, dest, onProgress, proxy)
|
|
217
|
+
} catch (second) {
|
|
218
|
+
const err = new AssetPackError('下载失败(直连与代理 ' + proxy + ' 都不通):' + (second?.message || second), { code: 'network', cause: second })
|
|
219
|
+
err.directCause = first
|
|
220
|
+
throw err
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
let inflight = null
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* 保证素材可用。已经可用时是一次同步检查、立刻返回。
|
|
229
|
+
* @param {{onProgress?: (got:number,total:number)=>void, force?: boolean}} [opts]
|
|
230
|
+
*/
|
|
231
|
+
export async function ensureAssets(opts = {}) {
|
|
232
|
+
const ready = assetsRoot()
|
|
233
|
+
if (ready && !opts.force) return { root: ready, source: 'existing', downloaded: false }
|
|
234
|
+
if (inflight) return inflight
|
|
235
|
+
inflight = (async () => {
|
|
236
|
+
const dir = cacheDir()
|
|
237
|
+
const tmp = `${dir}.tmp-${process.pid}-${Date.now()}`
|
|
238
|
+
const archive = `${tmp}.tar.gz`
|
|
239
|
+
try {
|
|
240
|
+
mkdirSync(dirname(dir), { recursive: true })
|
|
241
|
+
rmSync(tmp, { recursive: true, force: true })
|
|
242
|
+
mkdirSync(tmp, { recursive: true })
|
|
243
|
+
const { bytes, sha256 } = await downloadTo(ASSETS_URL, archive, opts.onProgress)
|
|
244
|
+
if (ASSETS_LOCK.bytes && bytes !== ASSETS_LOCK.bytes) {
|
|
245
|
+
throw new AssetPackError(`素材包大小不对(收到 ${bytes} 字节,应为 ${ASSETS_LOCK.bytes}),可能下载被截断了`, { code: 'size-mismatch' })
|
|
246
|
+
}
|
|
247
|
+
if (ASSETS_LOCK.sha256 && sha256 !== ASSETS_LOCK.sha256) {
|
|
248
|
+
throw new AssetPackError('素材包校验失败(sha256 不匹配),请重试;反复失败请手动下载安装', { code: 'checksum' })
|
|
249
|
+
}
|
|
250
|
+
const entries = readTar(gunzipSync(readFileSync(archive)))
|
|
251
|
+
const manifestEntry = entries.find((item) => item.path === 'manifest.json')
|
|
252
|
+
const manifest = manifestEntry ? JSON.parse(manifestEntry.data.toString('utf8')) : null
|
|
253
|
+
if (!manifest || !Array.isArray(manifest.files)) throw new AssetPackError('素材包里没有 manifest.json,无法校验', { code: 'no-manifest' })
|
|
254
|
+
const expected = new Map(manifest.files.map((item) => [item.path, item.sha256]))
|
|
255
|
+
let written = 0
|
|
256
|
+
for (const entry of entries) {
|
|
257
|
+
if (entry.path === 'manifest.json') continue
|
|
258
|
+
assertSafePath(entry.path)
|
|
259
|
+
const want = expected.get(entry.path)
|
|
260
|
+
const got = createHash('sha256').update(entry.data).digest('hex')
|
|
261
|
+
if (want && want !== got) throw new AssetPackError('素材包内容损坏:' + entry.path, { code: 'bad-file' })
|
|
262
|
+
const target = join(tmp, entry.path)
|
|
263
|
+
mkdirSync(dirname(target), { recursive: true })
|
|
264
|
+
writeFileSync(target, entry.data)
|
|
265
|
+
written += 1
|
|
266
|
+
}
|
|
267
|
+
writeFileSync(join(tmp, READY_FILE), JSON.stringify({
|
|
268
|
+
version: ASSETS_VERSION, files: written, bytes, sha256, at: new Date().toISOString(),
|
|
269
|
+
}, null, 2) + '\n', 'utf8')
|
|
270
|
+
rmSync(dir, { recursive: true, force: true })
|
|
271
|
+
renameSync(tmp, dir)
|
|
272
|
+
return { root: dir, source: 'download', downloaded: true, files: written }
|
|
273
|
+
} catch (err) {
|
|
274
|
+
rmSync(tmp, { recursive: true, force: true })
|
|
275
|
+
if (err instanceof AssetPackError) throw err
|
|
276
|
+
throw new AssetPackError('素材包安装失败:' + (err?.message || err), { code: 'install', cause: err })
|
|
277
|
+
} finally {
|
|
278
|
+
rmSync(archive, { force: true })
|
|
279
|
+
inflight = null
|
|
280
|
+
}
|
|
281
|
+
})()
|
|
282
|
+
return inflight
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/** 工具层用:拿到素材根目录,或者抛一条人能照着做的错误。 */
|
|
286
|
+
export async function requireAssets({ onProgress } = {}) {
|
|
287
|
+
try {
|
|
288
|
+
const got = await ensureAssets({ onProgress })
|
|
289
|
+
return got.root
|
|
290
|
+
} catch (err) {
|
|
291
|
+
const reason = err?.message || String(err)
|
|
292
|
+
throw new AssetPackError(
|
|
293
|
+
'动效素材包(字体 + 素材库,一次性约 ' + Math.round((ASSETS_LOCK.bytes || 0) / 1048576) + 'MB)还没准备好:' + reason + '\n'
|
|
294
|
+
+ '怎么处理:\n'
|
|
295
|
+
+ ' 1) 联网后重试一次刚才的操作,插件会自动下载并校验;\n'
|
|
296
|
+
+ ' 2) 或者手动下载 ' + ASSETS_URL + ' ,解压到 ' + cacheDir()
|
|
297
|
+
+ '(目录里应当直接看到 fonts/ 和 media-library/);\n'
|
|
298
|
+
+ ' 3) 走代理的话先设 HTTPS_PROXY 再重试。\n'
|
|
299
|
+
+ '在此之前,画布与图片相关功能不受影响,只有动效(字体/素材库)用不了。',
|
|
300
|
+
{ dir: cacheDir(), cause: err },
|
|
301
|
+
)
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/** 媒体素材库根目录(没有素材时返回 null,不抛)。 */
|
|
306
|
+
export function mediaLibraryRoot() {
|
|
307
|
+
const root = assetsRoot()
|
|
308
|
+
if (!root) return null
|
|
309
|
+
const dir = join(root, 'media-library')
|
|
310
|
+
return existsSync(dir) ? dir : null
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
/** 字体目录(没有素材时返回 null,不抛)。 */
|
|
314
|
+
export function fontsDir() {
|
|
315
|
+
const root = assetsRoot()
|
|
316
|
+
if (!root) return null
|
|
317
|
+
const dir = join(root, 'fonts')
|
|
318
|
+
return existsSync(dir) ? dir : null
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export function assetsSummary() {
|
|
322
|
+
const state = assetsState()
|
|
323
|
+
if (!state.ready) return { ready: false, version: ASSETS_VERSION, dir: state.dir, url: ASSETS_URL, page: ASSETS_PAGE }
|
|
324
|
+
const manifest = readManifest(state.root) || {}
|
|
325
|
+
return {
|
|
326
|
+
ready: true,
|
|
327
|
+
version: ASSETS_VERSION,
|
|
328
|
+
source: state.source,
|
|
329
|
+
root: state.root,
|
|
330
|
+
files: manifest.counts?.files ?? null,
|
|
331
|
+
bytes: manifest.counts?.bytes ?? null,
|
|
332
|
+
url: ASSETS_URL,
|
|
333
|
+
page: ASSETS_PAGE,
|
|
334
|
+
}
|
|
335
|
+
}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
// 素材捕获:把真实文件搬进工程,并量出场景需要的元数据(尺寸、色板、摘要)。
|
|
2
|
+
//
|
|
3
|
+
// 为什么不是"画布快照":快照经过一次光栅化,颜色和像素都被画布缩放改过。
|
|
4
|
+
// 场景要对齐品牌色、要对齐文案排版,就必须拿到原始字节。
|
|
5
|
+
//
|
|
6
|
+
// 落地形态:<工程>/assets/<名字>.<ext> + <工程>/assets/manifest.json。
|
|
7
|
+
// 目录同时是 Remotion 的 publicDir,场景里用 staticFile('xxx.png') 取。
|
|
8
|
+
|
|
9
|
+
import { createHash, randomUUID } from 'node:crypto'
|
|
10
|
+
import { execFile } from 'node:child_process'
|
|
11
|
+
import { tmpdir } from 'node:os'
|
|
12
|
+
import { promisify } from 'node:util'
|
|
13
|
+
import { open as openFile } from 'node:fs/promises'
|
|
14
|
+
import { chmodSync, closeSync, copyFileSync, existsSync, mkdirSync, openSync, readSync, readFileSync, readdirSync, statSync, unlinkSync, writeFileSync } from 'node:fs'
|
|
15
|
+
import { basename, extname, join } from 'node:path'
|
|
16
|
+
import { ffmpegBinary } from '../video-export.js'
|
|
17
|
+
import { parseProjectJson } from './json.js'
|
|
18
|
+
|
|
19
|
+
const exec = promisify(execFile)
|
|
20
|
+
const IMAGE_EXT = new Set(['.png', '.jpg', '.jpeg', '.webp', '.gif', '.avif'])
|
|
21
|
+
// 矢量素材(官方 logo / 图标)单独一类:不经 ffprobe 量尺寸,场景里 <Img> 照样能画,
|
|
22
|
+
// 而且缩放到 4K 也不糊——品牌资产优先要这个,而不是截一张 PNG。
|
|
23
|
+
const VECTOR_EXT = new Set(['.svg'])
|
|
24
|
+
export const AUDIO_EXT = new Set(['.mp3', '.wav', '.m4a', '.aac', '.ogg', '.flac'])
|
|
25
|
+
const VIDEO_EXT = new Set(['.mp4', '.webm', '.mov', '.mkv'])
|
|
26
|
+
const MAX_BYTES = 24 * 1024 * 1024
|
|
27
|
+
const MAX_VIDEO_BYTES = 256 * 1024 * 1024
|
|
28
|
+
export const MEDIA_EXT = new Set([...IMAGE_EXT, ...AUDIO_EXT, ...VIDEO_EXT, ...VECTOR_EXT])
|
|
29
|
+
|
|
30
|
+
function run(args, options = {}) {
|
|
31
|
+
return exec(ffmpegBinary(), args, { windowsHide: true, timeout: 60000, maxBuffer: 8 * 1024 * 1024, ...options })
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function assetsDirectory(projectDir) {
|
|
35
|
+
return join(projectDir, 'assets')
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function readAssets(projectDir) {
|
|
39
|
+
const file = join(assetsDirectory(projectDir), 'manifest.json')
|
|
40
|
+
if (!existsSync(file)) return { version: 1, items: [] }
|
|
41
|
+
try {
|
|
42
|
+
const raw = parseProjectJson(readFileSync(file, 'utf8'))
|
|
43
|
+
return { version: 1, items: Array.isArray(raw.items) ? raw.items : [] }
|
|
44
|
+
} catch {
|
|
45
|
+
return { version: 1, items: [] }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function writeAssets(projectDir, manifest) {
|
|
50
|
+
const dir = assetsDirectory(projectDir)
|
|
51
|
+
mkdirSync(dir, { recursive: true })
|
|
52
|
+
writeFileSync(join(dir, 'manifest.json'), JSON.stringify({ version: 1, items: manifest.items }, null, 2))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// 素材一变,bundle 就必须重建——所以指纹要参与 bundleKey。
|
|
56
|
+
export function assetsHash(projectDir) {
|
|
57
|
+
const { items } = readAssets(projectDir)
|
|
58
|
+
const hash = createHash('sha256')
|
|
59
|
+
for (const item of items) hash.update(JSON.stringify([item.id, item.file, item.sha256, item.width, item.height]))
|
|
60
|
+
// motion_sfx / motion_audio 落进 assets/sfx 的文件不写 manifest.json,但一样是 public 资源。
|
|
61
|
+
// 只认 manifest 会让 bundle 复用旧 public(缺 sfx/),渲染时 404 —— 所以目录本身也要进指纹。
|
|
62
|
+
const dir = assetsDirectory(projectDir)
|
|
63
|
+
if (existsSync(dir)) {
|
|
64
|
+
const walk = (rel) => {
|
|
65
|
+
for (const entry of readdirSync(join(dir, rel), { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
66
|
+
const next = rel ? join(rel, entry.name) : entry.name
|
|
67
|
+
if (entry.isDirectory()) walk(next)
|
|
68
|
+
else {
|
|
69
|
+
if (!entry.isFile()) throw new Error('素材目录不支持符号链接:' + next)
|
|
70
|
+
const file = join(dir, next), stat = statSync(file)
|
|
71
|
+
hash.update(JSON.stringify([next.replace(/\\/g, '/'), stat.size]))
|
|
72
|
+
const fd = openSync(file, 'r'), buffer = Buffer.allocUnsafe(256 * 1024)
|
|
73
|
+
try { let count; while ((count = readSync(fd, buffer, 0, buffer.length, null)) > 0) hash.update(buffer.subarray(0, count)) } finally { closeSync(fd) }
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
walk('')
|
|
78
|
+
}
|
|
79
|
+
return hash.digest('hex').slice(0, 16)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function listAssets(projectDir) {
|
|
83
|
+
const { items } = readAssets(projectDir)
|
|
84
|
+
return items.map((item) => ({ ...item, path: join(assetsDirectory(projectDir), item.file) }))
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// ffmpeg 不做 ffprobe 的活,但 -i 的 stderr 里第一段视频流就有尺寸。
|
|
88
|
+
export async function probeImage(file) {
|
|
89
|
+
const { stderr } = await run(['-hide_banner', '-i', file, '-f', 'null', '-'], { encoding: 'utf8' })
|
|
90
|
+
const match = /Stream #\d+:\d+.*?(\d{2,5})x(\d{2,5})/.exec(stderr)
|
|
91
|
+
if (!match) throw new Error('读不出图片尺寸:' + basename(file))
|
|
92
|
+
return { width: Number(match[1]), height: Number(match[2]) }
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// 音频只关心时长与峰值:时长给时间轴算 durationInFrames,峰值给"钉帧"用。
|
|
96
|
+
export async function probeAudio(file) {
|
|
97
|
+
const { stderr } = await run(['-hide_banner', '-i', file, '-f', 'null', '-'], { encoding: 'utf8' })
|
|
98
|
+
const duration = /Duration:\s*(\d+):(\d+):(\d+(?:\.\d+)?)/.exec(stderr)
|
|
99
|
+
if (!duration) throw new Error('读不出音频时长:' + basename(file))
|
|
100
|
+
const seconds = Number(duration[1]) * 3600 + Number(duration[2]) * 60 + Number(duration[3])
|
|
101
|
+
const peak = await run(['-hide_banner', '-i', file, '-af', 'volumedetect', '-f', 'null', '-'], { encoding: 'utf8' })
|
|
102
|
+
const maxVolume = /max_volume:\s*(-?\d+(?:\.\d+)?)/.exec(peak.stderr || '')
|
|
103
|
+
return { seconds, samplePeakDb: maxVolume ? Number(maxVolume[1]) : null }
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function rgb(r, g, b) {
|
|
107
|
+
return '#' + [r, g, b].map((value) => Math.max(0, Math.min(255, Math.round(value))).toString(16).padStart(2, '0')).join('')
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function rgbAt(buffer, offset = 0) {
|
|
111
|
+
return rgb(buffer[offset], buffer[offset + 1], buffer[offset + 2])
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// 两种读数:平均色(scale=1:1)给"底色",主色统计(缩到 48×48 再按频次聚类)给"色板"。
|
|
115
|
+
// 不用 palettegen:它会把没用满的槽位填成纯绿,色板里混进假颜色。
|
|
116
|
+
export async function colorsOf(file, maxColors = 8) {
|
|
117
|
+
const average = await run(['-hide_banner', '-loglevel', 'error', '-i', file, '-vf', 'scale=1:1:flags=area', '-frames:v', '1', '-f', 'rawvideo', '-pix_fmt', 'rgb24', '-'], { encoding: 'buffer' })
|
|
118
|
+
const sampled = await run(['-hide_banner', '-loglevel', 'error', '-i', file, '-vf', 'scale=48:48:flags=area', '-frames:v', '1', '-f', 'rawvideo', '-pix_fmt', 'rgb24', '-'], { encoding: 'buffer' })
|
|
119
|
+
const buckets = new Map()
|
|
120
|
+
for (let offset = 0; offset + 2 < sampled.stdout.length; offset += 3) {
|
|
121
|
+
const r = sampled.stdout[offset], g = sampled.stdout[offset + 1], b = sampled.stdout[offset + 2]
|
|
122
|
+
const key = ((r >> 4) << 8) | ((g >> 4) << 4) | (b >> 4)
|
|
123
|
+
const bucket = buckets.get(key) || { count: 0, r: 0, g: 0, b: 0 }
|
|
124
|
+
bucket.count++
|
|
125
|
+
bucket.r += r
|
|
126
|
+
bucket.g += g
|
|
127
|
+
bucket.b += b
|
|
128
|
+
buckets.set(key, bucket)
|
|
129
|
+
}
|
|
130
|
+
const colors = [...buckets.values()]
|
|
131
|
+
.sort((a, b) => b.count - a.count)
|
|
132
|
+
.slice(0, maxColors)
|
|
133
|
+
.map((bucket) => rgb(bucket.r / bucket.count, bucket.g / bucket.count, bucket.b / bucket.count))
|
|
134
|
+
return { average: average.stdout.length >= 3 ? rgbAt(average.stdout) : null, colors }
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function slug(name) {
|
|
138
|
+
return String(name || 'asset')
|
|
139
|
+
.replace(/\.[a-z0-9]+$/i, '')
|
|
140
|
+
.replace(/[^\w\u4e00-\u9fa5-]+/g, '-')
|
|
141
|
+
.replace(/^-+|-+$/g, '')
|
|
142
|
+
.slice(0, 40) || 'asset'
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function uniqueName(projectDir, base, ext) {
|
|
146
|
+
const dir = assetsDirectory(projectDir)
|
|
147
|
+
const taken = new Set(existsSync(dir) ? readdirSync(dir) : [])
|
|
148
|
+
let index = 1, name = base + ext
|
|
149
|
+
while (taken.has(name)) name = base + '-' + (++index) + ext
|
|
150
|
+
return name
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async function describe(file, item) {
|
|
154
|
+
const ext = extname(file).toLowerCase()
|
|
155
|
+
if (VECTOR_EXT.has(ext)) return { ...item, kind: 'vector' }
|
|
156
|
+
if (AUDIO_EXT.has(ext)) {
|
|
157
|
+
const { seconds, samplePeakDb } = await probeAudio(file)
|
|
158
|
+
return { ...item, kind: 'audio', seconds, samplePeakDb }
|
|
159
|
+
}
|
|
160
|
+
if (VIDEO_EXT.has(ext)) {
|
|
161
|
+
const { width, height } = await probeImage(file)
|
|
162
|
+
const { seconds } = await probeAudio(file)
|
|
163
|
+
return { ...item, kind: 'video', width, height, seconds }
|
|
164
|
+
}
|
|
165
|
+
const { width, height } = await probeImage(file)
|
|
166
|
+
const { average, colors } = await colorsOf(file)
|
|
167
|
+
return { ...item, kind: 'image', width, height, average, colors }
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export async function captureAsset(projectDir, sourceFile, options = {}) {
|
|
171
|
+
const ext = extname(sourceFile).toLowerCase()
|
|
172
|
+
if (!MEDIA_EXT.has(ext)) throw new Error('只支持图片 png/jpg/webp/gif/avif、音频 mp3/wav/m4a/aac/ogg/flac、视频 mp4/webm/mov/mkv:' + basename(sourceFile))
|
|
173
|
+
const bytes = statSync(sourceFile).size
|
|
174
|
+
const limit = VIDEO_EXT.has(ext) ? MAX_VIDEO_BYTES : MAX_BYTES
|
|
175
|
+
if (bytes > limit) throw new Error('素材超过 ' + Math.round(limit / 1024 / 1024) + 'MB,请先压缩')
|
|
176
|
+
const dir = assetsDirectory(projectDir)
|
|
177
|
+
mkdirSync(dir, { recursive: true })
|
|
178
|
+
// 内容去重:同一个文件(同 sha256)只落一份。音效被反复引用时,
|
|
179
|
+
// 重复拷贝会让 assets/ 里堆一串 a-2.mp3、a-3.mp3,打包也跟着变大。
|
|
180
|
+
const sha256 = createHash('sha256').update(readFileSync(sourceFile)).digest('hex')
|
|
181
|
+
const existing = readAssets(projectDir).items.find((item) => item.sha256 === sha256 && existsSync(join(dir, item.file)))
|
|
182
|
+
if (existing) return existing
|
|
183
|
+
const file = uniqueName(projectDir, options.name ? slug(options.name) : slug(basename(sourceFile)), ext)
|
|
184
|
+
const target = join(dir, file)
|
|
185
|
+
if (existsSync(target)) chmodSync(target, 0o644)
|
|
186
|
+
copyFileSync(sourceFile, target)
|
|
187
|
+
// 源文件可能带只读属性(截图被复制过来时常见),落地后一律清掉:
|
|
188
|
+
// 否则下一次渲染把素材复制进 bundle/public 会因为目标已存在且只读而 EPERM。
|
|
189
|
+
chmodSync(target, 0o644)
|
|
190
|
+
const entry = await describe(target, {
|
|
191
|
+
id: file.replace(/\.[a-z0-9]+$/i, ''), file, bytes, sha256,
|
|
192
|
+
source: options.source || basename(sourceFile),
|
|
193
|
+
...(options.license ? { license: String(options.license).slice(0, 160) } : {}),
|
|
194
|
+
...(options.caption ? { caption: String(options.caption).slice(0, 400) } : {}),
|
|
195
|
+
at: new Date().toISOString(),
|
|
196
|
+
})
|
|
197
|
+
const manifest = readAssets(projectDir)
|
|
198
|
+
manifest.items.push(entry)
|
|
199
|
+
writeAssets(projectDir, manifest)
|
|
200
|
+
return entry
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export async function cropAsset(projectDir, sourceFile, options = {}) {
|
|
204
|
+
const dir = assetsDirectory(projectDir)
|
|
205
|
+
mkdirSync(dir, { recursive: true })
|
|
206
|
+
const x = Math.max(0, Math.round(Number(options.x) || 0)), y = Math.max(0, Math.round(Number(options.y) || 0))
|
|
207
|
+
const w = Math.round(Number(options.w) || 0), h = Math.round(Number(options.h) || 0)
|
|
208
|
+
if (!w || !h) throw new Error('裁切需要 w 与 h')
|
|
209
|
+
const file = uniqueName(projectDir, options.name ? slug(options.name) : 'crop', '.png')
|
|
210
|
+
const target = join(dir, file)
|
|
211
|
+
await run(['-hide_banner', '-loglevel', 'error', '-y', '-i', sourceFile, '-vf', 'crop=' + w + ':' + h + ':' + x + ':' + y, target])
|
|
212
|
+
const entry = await describe(target, {
|
|
213
|
+
id: file.replace(/\.png$/, ''), file, bytes: statSync(target).size,
|
|
214
|
+
sha256: createHash('sha256').update(readFileSync(target)).digest('hex'),
|
|
215
|
+
source: basename(sourceFile), crop: { x, y, w, h },
|
|
216
|
+
...(options.caption ? { caption: String(options.caption).slice(0, 400) } : {}),
|
|
217
|
+
at: new Date().toISOString(),
|
|
218
|
+
})
|
|
219
|
+
const manifest = readAssets(projectDir)
|
|
220
|
+
manifest.items.push(entry)
|
|
221
|
+
writeAssets(projectDir, manifest)
|
|
222
|
+
return entry
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const MIME_EXT = new Map([
|
|
226
|
+
['image/png', '.png'], ['image/jpeg', '.jpg'], ['image/webp', '.webp'], ['image/gif', '.gif'],
|
|
227
|
+
['image/avif', '.avif'], ['image/svg+xml', '.svg'], ['video/mp4', '.mp4'], ['video/webm', '.webm'],
|
|
228
|
+
['audio/mpeg', '.mp3'], ['audio/wav', '.wav'], ['audio/mp4', '.m4a'], ['audio/ogg', '.ogg'],
|
|
229
|
+
])
|
|
230
|
+
|
|
231
|
+
function extensionForAsset(contentType, sourceUrl) {
|
|
232
|
+
const byType = MIME_EXT.get(String(contentType || '').toLowerCase())
|
|
233
|
+
if (byType) return byType
|
|
234
|
+
try {
|
|
235
|
+
const ext = extname(new URL(sourceUrl).pathname).toLowerCase()
|
|
236
|
+
return MEDIA_EXT.has(ext) ? ext : null
|
|
237
|
+
} catch {
|
|
238
|
+
return null
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* 把网址上的原始字节下载进 assets/。
|
|
244
|
+
*
|
|
245
|
+
* 有它是因为"官方 logo"这件事不能靠截图也不能靠重画:品牌规范里的 SVG 才是唯一正确的像素,
|
|
246
|
+
* 截屏会带背景、会掉精度、比例还可能被浏览器改过。下载后走与 capture 相同的落盘与量测路径,
|
|
247
|
+
* 只是多记一个 source URL —— 交付时要能把"这张图哪来的"说清楚。
|
|
248
|
+
*/
|
|
249
|
+
export async function fetchAsset(projectDir, sourceUrl, options = {}) {
|
|
250
|
+
let url
|
|
251
|
+
try {
|
|
252
|
+
url = new URL(String(sourceUrl))
|
|
253
|
+
} catch {
|
|
254
|
+
throw new Error('不是一个合法的地址:' + sourceUrl)
|
|
255
|
+
}
|
|
256
|
+
if (!['http:', 'https:'].includes(url.protocol)) throw new Error('只支持 http(s) 地址')
|
|
257
|
+
const controller = new AbortController(), upstream = options.signal
|
|
258
|
+
const abort = () => controller.abort(upstream?.reason)
|
|
259
|
+
if (upstream?.aborted) abort()
|
|
260
|
+
else upstream?.addEventListener('abort', abort, { once: true })
|
|
261
|
+
const timer = setTimeout(() => controller.abort(new Error('素材下载超时')), 60000)
|
|
262
|
+
let temp
|
|
263
|
+
try {
|
|
264
|
+
const response = await fetch(url.href, { redirect: 'follow', headers: { 'user-agent': 'dsh-drawai/asset-fetch' }, signal: controller.signal })
|
|
265
|
+
if (!response.ok) throw new Error('下载失败 HTTP ' + response.status + ':' + url.href)
|
|
266
|
+
const contentType = (response.headers.get('content-type') || '').split(';')[0].trim().toLowerCase()
|
|
267
|
+
const ext = extensionForAsset(contentType, url.href)
|
|
268
|
+
if (!ext) { await response.body?.cancel(); throw new Error('这个地址不是图片/音视频/svg(content-type: ' + (contentType || '未知') + '):' + url.href) }
|
|
269
|
+
const limit = VIDEO_EXT.has(ext) ? MAX_VIDEO_BYTES : MAX_BYTES
|
|
270
|
+
const tooLarge = () => new Error('素材超过 ' + Math.round(limit / 1024 / 1024) + 'MB,请先压缩')
|
|
271
|
+
if (Number(response.headers.get('content-length')) > limit) { await response.body?.cancel(); throw tooLarge() }
|
|
272
|
+
temp = join(tmpdir(), 'drawai-fetch-' + randomUUID() + ext)
|
|
273
|
+
const handle = await openFile(temp, 'wx')
|
|
274
|
+
try {
|
|
275
|
+
let bytes = 0
|
|
276
|
+
if (!response.body) throw new Error('下载响应没有内容')
|
|
277
|
+
for await (const chunk of response.body) {
|
|
278
|
+
bytes += chunk.length
|
|
279
|
+
if (bytes > limit) throw tooLarge()
|
|
280
|
+
await handle.writeFile(chunk)
|
|
281
|
+
}
|
|
282
|
+
} finally { await handle.close() }
|
|
283
|
+
const baseName = options.name || basename(url.pathname).replace(/\.[a-z0-9]+$/i, '') || 'asset'
|
|
284
|
+
return await captureAsset(projectDir, temp, { name: baseName, caption: options.caption, source: url.href })
|
|
285
|
+
} finally {
|
|
286
|
+
clearTimeout(timer)
|
|
287
|
+
upstream?.removeEventListener('abort', abort)
|
|
288
|
+
if (temp) try { unlinkSync(temp) } catch {}
|
|
289
|
+
}
|
|
290
|
+
}
|