@clockgrove/assetgrove 0.0.0-stage → 0.3.2
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/README.md +277 -2
- package/dist/animation/commands.d.ts +180 -0
- package/dist/animation/commands.js +515 -0
- package/dist/animation/facing.d.ts +44 -0
- package/dist/animation/facing.js +100 -0
- package/dist/animation/fix.d.ts +136 -0
- package/dist/animation/fix.js +529 -0
- package/dist/animation/flicker.d.ts +44 -0
- package/dist/animation/flicker.js +117 -0
- package/dist/animation/halo.d.ts +72 -0
- package/dist/animation/halo.js +253 -0
- package/dist/animation/holes.d.ts +122 -0
- package/dist/animation/holes.js +262 -0
- package/dist/animation/preview.d.ts +38 -0
- package/dist/animation/preview.js +161 -0
- package/dist/animation/qa.d.ts +57 -0
- package/dist/animation/qa.js +418 -0
- package/dist/animation/run.d.ts +109 -0
- package/dist/animation/run.js +182 -0
- package/dist/animation/strip.d.ts +13 -0
- package/dist/animation/strip.js +41 -0
- package/dist/animation/template-choice.d.ts +75 -0
- package/dist/animation/template-choice.js +153 -0
- package/dist/animation/templates.d.ts +39 -0
- package/dist/animation/templates.js +333 -0
- package/dist/animation/types.d.ts +257 -0
- package/dist/animation/types.js +1 -0
- package/dist/approvals.d.ts +156 -0
- package/dist/approvals.js +369 -0
- package/dist/audio/aac.d.ts +61 -0
- package/dist/audio/aac.js +152 -0
- package/dist/audio/checks.d.ts +38 -0
- package/dist/audio/checks.js +254 -0
- package/dist/audio/delivery.d.ts +52 -0
- package/dist/audio/delivery.js +105 -0
- package/dist/audio/engine.d.ts +65 -0
- package/dist/audio/engine.js +164 -0
- package/dist/audio/handoff.d.ts +75 -0
- package/dist/audio/handoff.js +185 -0
- package/dist/audio/kinds.d.ts +6 -0
- package/dist/audio/kinds.js +315 -0
- package/dist/audio/loudness.d.ts +22 -0
- package/dist/audio/loudness.js +72 -0
- package/dist/audio/ogg.d.ts +27 -0
- package/dist/audio/ogg.js +65 -0
- package/dist/audio/operations.d.ts +20 -0
- package/dist/audio/operations.js +335 -0
- package/dist/audio/opus.d.ts +40 -0
- package/dist/audio/opus.js +108 -0
- package/dist/audio/profile.d.ts +200 -0
- package/dist/audio/profile.js +126 -0
- package/dist/audio/run.d.ts +83 -0
- package/dist/audio/run.js +192 -0
- package/dist/audio/vorbis-comments.d.ts +25 -0
- package/dist/audio/vorbis-comments.js +243 -0
- package/dist/audio/waveform.d.ts +13 -0
- package/dist/audio/waveform.js +52 -0
- package/dist/audio-parameters.d.ts +17 -0
- package/dist/audio-parameters.js +45 -0
- package/dist/audit/bar.d.ts +65 -0
- package/dist/audit/bar.js +97 -0
- package/dist/audit/members.d.ts +40 -0
- package/dist/audit/members.js +119 -0
- package/dist/bible-view.d.ts +10 -0
- package/dist/bible-view.js +122 -0
- package/dist/bible.d.ts +272 -0
- package/dist/bible.js +641 -0
- package/dist/budget.d.ts +119 -0
- package/dist/budget.js +227 -0
- package/dist/call-parameters.d.ts +71 -0
- package/dist/call-parameters.js +90 -0
- package/dist/calls.d.ts +145 -0
- package/dist/calls.js +788 -0
- package/dist/cli/main.d.ts +22 -0
- package/dist/cli/main.js +137 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +5 -0
- package/dist/commands/animation-qa.d.ts +1 -0
- package/dist/commands/animation-qa.js +240 -0
- package/dist/commands/apply.d.ts +12 -0
- package/dist/commands/apply.js +181 -0
- package/dist/commands/audit.d.ts +92 -0
- package/dist/commands/audit.js +555 -0
- package/dist/commands/bible.d.ts +1 -0
- package/dist/commands/bible.js +39 -0
- package/dist/commands/browse.d.ts +12 -0
- package/dist/commands/browse.js +113 -0
- package/dist/commands/card.d.ts +3 -0
- package/dist/commands/card.js +445 -0
- package/dist/commands/compare.d.ts +1 -0
- package/dist/commands/compare.js +90 -0
- package/dist/commands/confirm.d.ts +1 -0
- package/dist/commands/confirm.js +267 -0
- package/dist/commands/context.d.ts +43 -0
- package/dist/commands/context.js +115 -0
- package/dist/commands/deliver.d.ts +1 -0
- package/dist/commands/deliver.js +99 -0
- package/dist/commands/disclosure.d.ts +1 -0
- package/dist/commands/disclosure.js +80 -0
- package/dist/commands/doctor.d.ts +1 -0
- package/dist/commands/doctor.js +112 -0
- package/dist/commands/estimate.d.ts +2 -0
- package/dist/commands/estimate.js +80 -0
- package/dist/commands/extensions.d.ts +2 -0
- package/dist/commands/extensions.js +70 -0
- package/dist/commands/fix-frame.d.ts +1 -0
- package/dist/commands/fix-frame.js +206 -0
- package/dist/commands/generate-sheet.d.ts +1 -0
- package/dist/commands/generate-sheet.js +245 -0
- package/dist/commands/identity-check.d.ts +1 -0
- package/dist/commands/identity-check.js +110 -0
- package/dist/commands/identity-eval.d.ts +1 -0
- package/dist/commands/identity-eval.js +197 -0
- package/dist/commands/import.d.ts +7 -0
- package/dist/commands/import.js +472 -0
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.js +117 -0
- package/dist/commands/intake.d.ts +1 -0
- package/dist/commands/intake.js +56 -0
- package/dist/commands/labels.d.ts +1 -0
- package/dist/commands/labels.js +101 -0
- package/dist/commands/library.d.ts +9 -0
- package/dist/commands/library.js +711 -0
- package/dist/commands/lod.d.ts +1 -0
- package/dist/commands/lod.js +93 -0
- package/dist/commands/look-dev.d.ts +1 -0
- package/dist/commands/look-dev.js +148 -0
- package/dist/commands/materials.d.ts +1 -0
- package/dist/commands/materials.js +223 -0
- package/dist/commands/mcp.d.ts +1 -0
- package/dist/commands/mcp.js +53 -0
- package/dist/commands/migrate.d.ts +1 -0
- package/dist/commands/migrate.js +123 -0
- package/dist/commands/op.d.ts +5 -0
- package/dist/commands/op.js +114 -0
- package/dist/commands/ops.d.ts +1 -0
- package/dist/commands/ops.js +17 -0
- package/dist/commands/pick-batch.d.ts +24 -0
- package/dist/commands/pick-batch.js +343 -0
- package/dist/commands/pick.d.ts +48 -0
- package/dist/commands/pick.js +469 -0
- package/dist/commands/plan.d.ts +3 -0
- package/dist/commands/plan.js +156 -0
- package/dist/commands/recipe.d.ts +1 -0
- package/dist/commands/recipe.js +52 -0
- package/dist/commands/registry.d.ts +5 -0
- package/dist/commands/registry.js +121 -0
- package/dist/commands/render-sprite.d.ts +1 -0
- package/dist/commands/render-sprite.js +67 -0
- package/dist/commands/rendition.d.ts +1 -0
- package/dist/commands/rendition.js +56 -0
- package/dist/commands/request-change.d.ts +2 -0
- package/dist/commands/request-change.js +950 -0
- package/dist/commands/result.d.ts +34 -0
- package/dist/commands/result.js +237 -0
- package/dist/commands/review.d.ts +28 -0
- package/dist/commands/review.js +444 -0
- package/dist/commands/rig.d.ts +1 -0
- package/dist/commands/rig.js +74 -0
- package/dist/commands/runner.d.ts +45 -0
- package/dist/commands/runner.js +297 -0
- package/dist/commands/runs.d.ts +22 -0
- package/dist/commands/runs.js +159 -0
- package/dist/commands/search.d.ts +69 -0
- package/dist/commands/search.js +638 -0
- package/dist/commands/settings.d.ts +2 -0
- package/dist/commands/settings.js +284 -0
- package/dist/commands/spend.d.ts +2 -0
- package/dist/commands/spend.js +159 -0
- package/dist/commands/stage-source.d.ts +1 -0
- package/dist/commands/stage-source.js +58 -0
- package/dist/commands/stage.d.ts +9 -0
- package/dist/commands/stage.js +229 -0
- package/dist/commands/storage.d.ts +3 -0
- package/dist/commands/storage.js +200 -0
- package/dist/commands/turnaround.d.ts +1 -0
- package/dist/commands/turnaround.js +171 -0
- package/dist/commands/types.d.ts +195 -0
- package/dist/commands/types.js +7 -0
- package/dist/commands/vary.d.ts +2 -0
- package/dist/commands/vary.js +222 -0
- package/dist/commands/write-families.d.ts +14 -0
- package/dist/commands/write-families.js +158 -0
- package/dist/compare.d.ts +87 -0
- package/dist/compare.js +306 -0
- package/dist/confirm/delegation.d.ts +30 -0
- package/dist/confirm/delegation.js +31 -0
- package/dist/confirm/index.d.ts +84 -0
- package/dist/confirm/index.js +176 -0
- package/dist/confirm/mcp.d.ts +60 -0
- package/dist/confirm/mcp.js +253 -0
- package/dist/confirm/pending.d.ts +11 -0
- package/dist/confirm/pending.js +40 -0
- package/dist/confirm/prompt.d.ts +65 -0
- package/dist/confirm/prompt.js +68 -0
- package/dist/confirm/records.d.ts +17 -0
- package/dist/confirm/records.js +63 -0
- package/dist/contact.d.ts +80 -0
- package/dist/contact.js +224 -0
- package/dist/credentials.d.ts +170 -0
- package/dist/credentials.js +598 -0
- package/dist/dataflows.d.ts +32 -0
- package/dist/dataflows.js +42 -0
- package/dist/delivery.d.ts +89 -0
- package/dist/delivery.js +355 -0
- package/dist/disclosure.d.ts +84 -0
- package/dist/disclosure.js +397 -0
- package/dist/env.d.ts +90 -0
- package/dist/env.js +236 -0
- package/dist/errors.d.ts +90 -0
- package/dist/errors.js +105 -0
- package/dist/extension/api.d.ts +389 -0
- package/dist/extension/api.js +20 -0
- package/dist/extension/context.d.ts +9 -0
- package/dist/extension/context.js +60 -0
- package/dist/extension/helpers.d.ts +75 -0
- package/dist/extension/helpers.js +107 -0
- package/dist/extension/http.d.ts +32 -0
- package/dist/extension/http.js +104 -0
- package/dist/extension/setup.d.ts +53 -0
- package/dist/extension/setup.js +162 -0
- package/dist/extension/tools.d.ts +97 -0
- package/dist/extension/tools.js +235 -0
- package/dist/extensions/core.d.ts +7 -0
- package/dist/extensions/core.js +18 -0
- package/dist/extensions/errors.d.ts +22 -0
- package/dist/extensions/errors.js +34 -0
- package/dist/extensions/registry.d.ts +119 -0
- package/dist/extensions/registry.js +535 -0
- package/dist/extensions/version.d.ts +9 -0
- package/dist/extensions/version.js +57 -0
- package/dist/formats.d.ts +46 -0
- package/dist/formats.js +81 -0
- package/dist/frames.d.ts +58 -0
- package/dist/frames.js +80 -0
- package/dist/gateway/anthropic.d.ts +22 -0
- package/dist/gateway/anthropic.js +65 -0
- package/dist/gateway/elevenlabs.d.ts +36 -0
- package/dist/gateway/elevenlabs.js +192 -0
- package/dist/gateway/failure.d.ts +29 -0
- package/dist/gateway/failure.js +70 -0
- package/dist/gateway/openai-compatible.d.ts +20 -0
- package/dist/gateway/openai-compatible.js +76 -0
- package/dist/gateway/openai.d.ts +28 -0
- package/dist/gateway/openai.js +101 -0
- package/dist/gateway/provider.d.ts +380 -0
- package/dist/gateway/provider.js +5 -0
- package/dist/gateway/scripted.d.ts +252 -0
- package/dist/gateway/scripted.js +244 -0
- package/dist/gateway/stability.d.ts +38 -0
- package/dist/gateway/stability.js +232 -0
- package/dist/gateway/structured.d.ts +31 -0
- package/dist/gateway/structured.js +83 -0
- package/dist/gateway/tripo.d.ts +48 -0
- package/dist/gateway/tripo.js +374 -0
- package/dist/gateway/vercel.d.ts +52 -0
- package/dist/gateway/vercel.js +298 -0
- package/dist/generators/generator.d.ts +236 -0
- package/dist/generators/generator.js +12 -0
- package/dist/generators/image.d.ts +21 -0
- package/dist/generators/image.js +286 -0
- package/dist/generators/spec-schema.d.ts +29 -0
- package/dist/generators/spec-schema.js +21 -0
- package/dist/git-marker.d.ts +3 -0
- package/dist/git-marker.js +13 -0
- package/dist/gitlfs.d.ts +38 -0
- package/dist/gitlfs.js +171 -0
- package/dist/guard.d.ts +55 -0
- package/dist/guard.js +323 -0
- package/dist/handoff/current-profile.d.ts +48 -0
- package/dist/handoff/current-profile.js +127 -0
- package/dist/handoff/doctor.d.ts +26 -0
- package/dist/handoff/doctor.js +249 -0
- package/dist/handoff/mark-check.d.ts +17 -0
- package/dist/handoff/mark-check.js +66 -0
- package/dist/handoff/presets/aseprite-json.d.ts +5 -0
- package/dist/handoff/presets/aseprite-json.js +45 -0
- package/dist/handoff/presets/atlas-json.d.ts +44 -0
- package/dist/handoff/presets/atlas-json.js +195 -0
- package/dist/handoff/presets/atlas-pack.d.ts +14 -0
- package/dist/handoff/presets/atlas-pack.js +431 -0
- package/dist/handoff/presets/index.d.ts +273 -0
- package/dist/handoff/presets/index.js +58 -0
- package/dist/handoff/presets/manifest.d.ts +2 -0
- package/dist/handoff/presets/manifest.js +49 -0
- package/dist/handoff/usage.d.ts +27 -0
- package/dist/handoff/usage.js +159 -0
- package/dist/handoff.d.ts +345 -0
- package/dist/handoff.js +1221 -0
- package/dist/identity-eval.d.ts +156 -0
- package/dist/identity-eval.js +321 -0
- package/dist/identity.d.ts +293 -0
- package/dist/identity.js +675 -0
- package/dist/image/apply-style.d.ts +4 -0
- package/dist/image/apply-style.js +37 -0
- package/dist/image/digits.d.ts +5 -0
- package/dist/image/digits.js +40 -0
- package/dist/image/ktx2.d.ts +83 -0
- package/dist/image/ktx2.js +196 -0
- package/dist/image/raster.d.ts +23 -0
- package/dist/image/raster.js +77 -0
- package/dist/image/resample.d.ts +10 -0
- package/dist/image/resample.js +82 -0
- package/dist/image/webp.d.ts +17 -0
- package/dist/image/webp.js +323 -0
- package/dist/init.d.ts +132 -0
- package/dist/init.js +425 -0
- package/dist/inputs.d.ts +67 -0
- package/dist/inputs.js +151 -0
- package/dist/json.d.ts +7 -0
- package/dist/json.js +27 -0
- package/dist/keys.d.ts +34 -0
- package/dist/keys.js +198 -0
- package/dist/kind-schemas.d.ts +17 -0
- package/dist/kind-schemas.js +205 -0
- package/dist/library/actions.d.ts +76 -0
- package/dist/library/actions.js +212 -0
- package/dist/library/adopt.d.ts +177 -0
- package/dist/library/adopt.js +624 -0
- package/dist/library/canonical.d.ts +7 -0
- package/dist/library/canonical.js +29 -0
- package/dist/library/card.d.ts +138 -0
- package/dist/library/card.js +532 -0
- package/dist/library/credits.d.ts +70 -0
- package/dist/library/credits.js +222 -0
- package/dist/library/describe.d.ts +48 -0
- package/dist/library/describe.js +199 -0
- package/dist/library/diff.d.ts +26 -0
- package/dist/library/diff.js +208 -0
- package/dist/library/exact.d.ts +15 -0
- package/dist/library/exact.js +47 -0
- package/dist/library/extent.d.ts +56 -0
- package/dist/library/extent.js +205 -0
- package/dist/library/folder.d.ts +85 -0
- package/dist/library/folder.js +291 -0
- package/dist/library/labels.d.ts +29 -0
- package/dist/library/labels.js +112 -0
- package/dist/library/lfs.d.ts +42 -0
- package/dist/library/lfs.js +140 -0
- package/dist/library/maintain.d.ts +100 -0
- package/dist/library/maintain.js +750 -0
- package/dist/library/media-metadata.d.ts +19 -0
- package/dist/library/media-metadata.js +92 -0
- package/dist/library/paths.d.ts +7 -0
- package/dist/library/paths.js +65 -0
- package/dist/library/relations.d.ts +59 -0
- package/dist/library/relations.js +176 -0
- package/dist/library/review.d.ts +204 -0
- package/dist/library/review.js +545 -0
- package/dist/library/stale.d.ts +88 -0
- package/dist/library/stale.js +229 -0
- package/dist/library/suggestions.d.ts +37 -0
- package/dist/library/suggestions.js +146 -0
- package/dist/library/summary.d.ts +65 -0
- package/dist/library/summary.js +138 -0
- package/dist/library/undo.d.ts +18 -0
- package/dist/library/undo.js +141 -0
- package/dist/library/worklist.d.ts +42 -0
- package/dist/library/worklist.js +91 -0
- package/dist/library/write.d.ts +282 -0
- package/dist/library/write.js +790 -0
- package/dist/license.d.ts +67 -0
- package/dist/license.js +205 -0
- package/dist/limits.d.ts +51 -0
- package/dist/limits.js +100 -0
- package/dist/loop.d.ts +244 -0
- package/dist/loop.js +377 -0
- package/dist/material/core.d.ts +70 -0
- package/dist/material/core.js +238 -0
- package/dist/material/engine.d.ts +15 -0
- package/dist/material/engine.js +141 -0
- package/dist/material/flicker.d.ts +26 -0
- package/dist/material/flicker.js +71 -0
- package/dist/material/operations.d.ts +2 -0
- package/dist/material/operations.js +48 -0
- package/dist/material/pipeline.d.ts +51 -0
- package/dist/material/pipeline.js +431 -0
- package/dist/material/profile.d.ts +29 -0
- package/dist/material/profile.js +97 -0
- package/dist/material/rendition.d.ts +5 -0
- package/dist/material/rendition.js +76 -0
- package/dist/mcp.d.ts +72 -0
- package/dist/mcp.js +514 -0
- package/dist/media.d.ts +36 -0
- package/dist/media.js +46 -0
- package/dist/metadata.d.ts +61 -0
- package/dist/metadata.js +748 -0
- package/dist/model-declarations.d.ts +28 -0
- package/dist/model-declarations.js +14 -0
- package/dist/model3d/clip-map.d.ts +49 -0
- package/dist/model3d/clip-map.js +129 -0
- package/dist/model3d/core-checks.d.ts +61 -0
- package/dist/model3d/core-checks.js +278 -0
- package/dist/model3d/facing.d.ts +49 -0
- package/dist/model3d/facing.js +125 -0
- package/dist/model3d/generator.d.ts +19 -0
- package/dist/model3d/generator.js +482 -0
- package/dist/model3d/glb.d.ts +120 -0
- package/dist/model3d/glb.js +155 -0
- package/dist/model3d/handoff.d.ts +37 -0
- package/dist/model3d/handoff.js +131 -0
- package/dist/model3d/lod/chain.d.ts +50 -0
- package/dist/model3d/lod/chain.js +447 -0
- package/dist/model3d/lod/command.d.ts +38 -0
- package/dist/model3d/lod/command.js +377 -0
- package/dist/model3d/lod/qa.d.ts +36 -0
- package/dist/model3d/lod/qa.js +189 -0
- package/dist/model3d/lod/settings.d.ts +36 -0
- package/dist/model3d/lod/settings.js +137 -0
- package/dist/model3d/lod/simplify.d.ts +35 -0
- package/dist/model3d/lod/simplify.js +337 -0
- package/dist/model3d/lod/textures.d.ts +46 -0
- package/dist/model3d/lod/textures.js +190 -0
- package/dist/model3d/lookdev/command.d.ts +219 -0
- package/dist/model3d/lookdev/command.js +1795 -0
- package/dist/model3d/lookdev/edit.d.ts +44 -0
- package/dist/model3d/lookdev/edit.js +241 -0
- package/dist/model3d/lookdev/groom.d.ts +86 -0
- package/dist/model3d/lookdev/groom.js +462 -0
- package/dist/model3d/lookdev/markings.d.ts +98 -0
- package/dist/model3d/lookdev/markings.js +319 -0
- package/dist/model3d/lookdev/project.d.ts +100 -0
- package/dist/model3d/lookdev/project.js +721 -0
- package/dist/model3d/lookdev/settings.d.ts +65 -0
- package/dist/model3d/lookdev/settings.js +103 -0
- package/dist/model3d/lookdev/texels.d.ts +32 -0
- package/dist/model3d/lookdev/texels.js +192 -0
- package/dist/model3d/profile.d.ts +101 -0
- package/dist/model3d/profile.js +132 -0
- package/dist/model3d/prop.d.ts +29 -0
- package/dist/model3d/prop.js +317 -0
- package/dist/model3d/qa.d.ts +27 -0
- package/dist/model3d/qa.js +105 -0
- package/dist/model3d/render.d.ts +172 -0
- package/dist/model3d/render.js +791 -0
- package/dist/model3d/rig/build.d.ts +14 -0
- package/dist/model3d/rig/build.js +210 -0
- package/dist/model3d/rig/candidate.d.ts +50 -0
- package/dist/model3d/rig/candidate.js +132 -0
- package/dist/model3d/rig/command.d.ts +50 -0
- package/dist/model3d/rig/command.js +229 -0
- package/dist/model3d/rig/fit.d.ts +88 -0
- package/dist/model3d/rig/fit.js +568 -0
- package/dist/model3d/rig/gait.d.ts +105 -0
- package/dist/model3d/rig/gait.js +334 -0
- package/dist/model3d/rig/math.d.ts +27 -0
- package/dist/model3d/rig/math.js +92 -0
- package/dist/model3d/rig/motion.d.ts +26 -0
- package/dist/model3d/rig/motion.js +223 -0
- package/dist/model3d/rig/qa.d.ts +76 -0
- package/dist/model3d/rig/qa.js +357 -0
- package/dist/model3d/rig/rig.d.ts +55 -0
- package/dist/model3d/rig/rig.js +213 -0
- package/dist/model3d/rig/template.d.ts +195 -0
- package/dist/model3d/rig/template.js +456 -0
- package/dist/model3d/scene.d.ts +115 -0
- package/dist/model3d/scene.js +684 -0
- package/dist/model3d/views.d.ts +77 -0
- package/dist/model3d/views.js +190 -0
- package/dist/origin.d.ts +162 -0
- package/dist/origin.js +134 -0
- package/dist/paths.d.ts +53 -0
- package/dist/paths.js +240 -0
- package/dist/planning.d.ts +261 -0
- package/dist/planning.js +1470 -0
- package/dist/policy/blocklist.d.ts +28 -0
- package/dist/policy/blocklist.js +58 -0
- package/dist/policy/brief.d.ts +67 -0
- package/dist/policy/brief.js +110 -0
- package/dist/policy/cuts.d.ts +26 -0
- package/dist/policy/cuts.js +80 -0
- package/dist/policy/model.d.ts +69 -0
- package/dist/policy/model.js +202 -0
- package/dist/policy/text.d.ts +183 -0
- package/dist/policy/text.js +285 -0
- package/dist/postprocess.d.ts +68 -0
- package/dist/postprocess.js +302 -0
- package/dist/profile.d.ts +5 -0
- package/dist/profile.js +98 -0
- package/dist/project-rules.d.ts +54 -0
- package/dist/project-rules.js +105 -0
- package/dist/provenance-binding.d.ts +55 -0
- package/dist/provenance-binding.js +352 -0
- package/dist/providers/adapter.d.ts +176 -0
- package/dist/providers/adapter.js +418 -0
- package/dist/providers/index.d.ts +33 -0
- package/dist/providers/index.js +49 -0
- package/dist/providers/script.d.ts +13 -0
- package/dist/providers/script.js +65 -0
- package/dist/providers/set.d.ts +76 -0
- package/dist/providers/set.js +134 -0
- package/dist/pure-cbor.d.ts +1 -0
- package/dist/pure-cbor.js +8 -0
- package/dist/qa/stability.d.ts +215 -0
- package/dist/qa/stability.js +393 -0
- package/dist/qa/stability.json +32 -0
- package/dist/qa.d.ts +36 -0
- package/dist/qa.js +148 -0
- package/dist/reconcile.d.ts +111 -0
- package/dist/reconcile.js +416 -0
- package/dist/redact.d.ts +29 -0
- package/dist/redact.js +74 -0
- package/dist/regions.d.ts +49 -0
- package/dist/regions.js +113 -0
- package/dist/release-policy.d.ts +99 -0
- package/dist/release-policy.js +266 -0
- package/dist/request.d.ts +74 -0
- package/dist/request.js +249 -0
- package/dist/routes.d.ts +327 -0
- package/dist/routes.js +1166 -0
- package/dist/runs/dir.d.ts +33 -0
- package/dist/runs/dir.js +30 -0
- package/dist/runs/execute.d.ts +86 -0
- package/dist/runs/execute.js +422 -0
- package/dist/runs/journal.d.ts +150 -0
- package/dist/runs/journal.js +216 -0
- package/dist/runs/lock.d.ts +57 -0
- package/dist/runs/lock.js +322 -0
- package/dist/runs/plan.d.ts +261 -0
- package/dist/runs/plan.js +404 -0
- package/dist/search/near-match.d.ts +32 -0
- package/dist/search/near-match.js +86 -0
- package/dist/search/reader.d.ts +17 -0
- package/dist/search/reader.js +334 -0
- package/dist/search/sheet.d.ts +4 -0
- package/dist/search/sheet.js +28 -0
- package/dist/search/style-outliers.d.ts +77 -0
- package/dist/search/style-outliers.js +166 -0
- package/dist/settings-write.d.ts +78 -0
- package/dist/settings-write.js +374 -0
- package/dist/settings.d.ts +436 -0
- package/dist/settings.js +622 -0
- package/dist/shared-settings.d.ts +4 -0
- package/dist/shared-settings.js +24 -0
- package/dist/sheet/blobs.d.ts +33 -0
- package/dist/sheet/blobs.js +145 -0
- package/dist/sheet/generate.d.ts +71 -0
- package/dist/sheet/generate.js +278 -0
- package/dist/sheet/group.d.ts +20 -0
- package/dist/sheet/group.js +191 -0
- package/dist/sheet/import.d.ts +315 -0
- package/dist/sheet/import.js +832 -0
- package/dist/sheet/matte.d.ts +25 -0
- package/dist/sheet/matte.js +508 -0
- package/dist/sheet/media-import.d.ts +41 -0
- package/dist/sheet/media-import.js +118 -0
- package/dist/sheet/register.d.ts +17 -0
- package/dist/sheet/register.js +176 -0
- package/dist/sheet/slice.d.ts +73 -0
- package/dist/sheet/slice.js +912 -0
- package/dist/sheet/types.d.ts +225 -0
- package/dist/sheet/types.js +1 -0
- package/dist/source/aseprite.d.ts +14 -0
- package/dist/source/aseprite.js +124 -0
- package/dist/source/stage.d.ts +24 -0
- package/dist/source/stage.js +172 -0
- package/dist/spend.d.ts +220 -0
- package/dist/spend.js +436 -0
- package/dist/sprite/render.d.ts +22 -0
- package/dist/sprite/render.js +272 -0
- package/dist/storage.d.ts +135 -0
- package/dist/storage.js +405 -0
- package/dist/style.d.ts +19 -0
- package/dist/style.js +26 -0
- package/dist/template.d.ts +29 -0
- package/dist/template.js +98 -0
- package/dist/testing/aseprite.d.ts +54 -0
- package/dist/testing/aseprite.js +191 -0
- package/dist/testing/cli.d.ts +24 -0
- package/dist/testing/cli.js +91 -0
- package/dist/testing/conformance.d.ts +61 -0
- package/dist/testing/conformance.js +455 -0
- package/dist/testing/index.d.ts +23 -0
- package/dist/testing/index.js +15 -0
- package/dist/testing/mcp.d.ts +25 -0
- package/dist/testing/mcp.js +80 -0
- package/dist/testing/project.d.ts +81 -0
- package/dist/testing/project.js +215 -0
- package/dist/testing/samples.d.ts +42 -0
- package/dist/testing/samples.js +122 -0
- package/dist/transform/operations.d.ts +5 -0
- package/dist/transform/operations.js +320 -0
- package/dist/transform/raster-engine.d.ts +9 -0
- package/dist/transform/raster-engine.js +329 -0
- package/dist/transform/rendition.d.ts +65 -0
- package/dist/transform/rendition.js +317 -0
- package/dist/transform/run.d.ts +138 -0
- package/dist/transform/run.js +442 -0
- package/dist/transform/schema.d.ts +33 -0
- package/dist/transform/schema.js +73 -0
- package/dist/transform/types.d.ts +101 -0
- package/dist/transform/types.js +1 -0
- package/dist/tree/address.d.ts +18 -0
- package/dist/tree/address.js +59 -0
- package/dist/tree/list.d.ts +18 -0
- package/dist/tree/list.js +101 -0
- package/dist/tree/project.d.ts +61 -0
- package/dist/tree/project.js +145 -0
- package/dist/tree/read.d.ts +43 -0
- package/dist/tree/read.js +715 -0
- package/dist/tree/search.d.ts +20 -0
- package/dist/tree/search.js +44 -0
- package/dist/tree/serve.d.ts +79 -0
- package/dist/tree/serve.js +415 -0
- package/dist/tree/thumbs.d.ts +26 -0
- package/dist/tree/thumbs.js +134 -0
- package/dist/turnaround.d.ts +195 -0
- package/dist/turnaround.js +622 -0
- package/dist/types.d.ts +595 -0
- package/dist/types.js +1 -0
- package/package.json +112 -3
- package/policy/blocklist.json +47 -0
- package/policy/prompt-policy-cuts.json +15 -0
- package/skills/art-direction/SKILL.md +16 -0
- package/skills/art-direction/default.md +14 -0
- package/skills/art-direction/presets/cozy-storybook.md +121 -0
- package/skills/art-direction/presets/dark-gritty-isometric.md +121 -0
- package/skills/art-direction/presets/flat-cartoon-kids.md +121 -0
- package/skills/art-direction/references/bible-format.md +47 -0
- package/skills/assetgrove/SKILL.md +109 -0
- package/skills/assetgrove/references/commands.md +723 -0
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The image operations: name, scope and parameter schema, independent of any engine. Engines
|
|
3
|
+
* implement them (see `raster-engine.ts`); recipes name them.
|
|
4
|
+
*/
|
|
5
|
+
import { AUDIO_OPERATIONS } from "../audio/operations.js";
|
|
6
|
+
import { MATERIAL_OPERATIONS } from "../material/operations.js";
|
|
7
|
+
import { BLOB_KINDS } from "../sheet/types.js";
|
|
8
|
+
const int = (description, minimum = 0, extra = {}) => ({
|
|
9
|
+
type: "integer",
|
|
10
|
+
minimum,
|
|
11
|
+
description,
|
|
12
|
+
...extra,
|
|
13
|
+
});
|
|
14
|
+
const point = {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: { x: { type: "integer" }, y: { type: "integer" } },
|
|
17
|
+
required: ["x", "y"],
|
|
18
|
+
};
|
|
19
|
+
const size = {
|
|
20
|
+
type: "object",
|
|
21
|
+
properties: { width: { type: "integer", minimum: 1 }, height: { type: "integer", minimum: 1 } },
|
|
22
|
+
required: ["width", "height"],
|
|
23
|
+
};
|
|
24
|
+
const filter = {
|
|
25
|
+
type: "string",
|
|
26
|
+
enum: ["antialiased", "crisp"],
|
|
27
|
+
description: "resampling: antialiased (premultiplied filtering) or crisp (nearest neighbour); defaults to the style profile's edges",
|
|
28
|
+
};
|
|
29
|
+
const fill = (params, values) => {
|
|
30
|
+
const out = { ...params };
|
|
31
|
+
for (const [k, v] of Object.entries(values))
|
|
32
|
+
if (out[k] === undefined)
|
|
33
|
+
out[k] = v;
|
|
34
|
+
return out;
|
|
35
|
+
};
|
|
36
|
+
const styleFilter = (params, context) => fill(params, { filter: context.style.edges });
|
|
37
|
+
export const OPERATIONS = [
|
|
38
|
+
...MATERIAL_OPERATIONS,
|
|
39
|
+
{
|
|
40
|
+
name: "crop",
|
|
41
|
+
summary: "cut a box out of each image",
|
|
42
|
+
scope: "each",
|
|
43
|
+
params: {
|
|
44
|
+
type: "object",
|
|
45
|
+
properties: {
|
|
46
|
+
x: int("left edge, px"),
|
|
47
|
+
y: int("top edge, px"),
|
|
48
|
+
width: int("width, px", 1),
|
|
49
|
+
height: int("height, px", 1),
|
|
50
|
+
},
|
|
51
|
+
required: ["x", "y", "width", "height"],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "trim",
|
|
56
|
+
summary: "crop each image to its opaque bounds (alpha at or above the threshold)",
|
|
57
|
+
scope: "each",
|
|
58
|
+
params: {
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: {
|
|
61
|
+
threshold: {
|
|
62
|
+
type: "integer",
|
|
63
|
+
minimum: 1,
|
|
64
|
+
maximum: 255,
|
|
65
|
+
description: "alpha counted as opaque; defaults to the style profile's threshold",
|
|
66
|
+
},
|
|
67
|
+
margin: int("transparent px kept around the bounds", 0, { default: 0 }),
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
defaults: (params, context) => fill(params, { threshold: context.style.alpha.threshold }),
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: "pad",
|
|
74
|
+
summary: "add transparent px around each image",
|
|
75
|
+
scope: "each",
|
|
76
|
+
params: {
|
|
77
|
+
type: "object",
|
|
78
|
+
properties: {
|
|
79
|
+
top: int("px above", 0, { default: 0 }),
|
|
80
|
+
right: int("px to the right", 0, { default: 0 }),
|
|
81
|
+
bottom: int("px below", 0, { default: 0 }),
|
|
82
|
+
left: int("px to the left", 0, { default: 0 }),
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "scale",
|
|
88
|
+
summary: "resample each image by a factor, or to a width or height keeping its aspect",
|
|
89
|
+
scope: "each",
|
|
90
|
+
params: {
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {
|
|
93
|
+
factor: { type: "number", exclusiveMinimum: 0, description: "output px per input px" },
|
|
94
|
+
width: int("output width, px (height follows the aspect)", 1),
|
|
95
|
+
height: int("output height, px (width follows the aspect)", 1),
|
|
96
|
+
filter,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
defaults: styleFilter,
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
name: "slice",
|
|
103
|
+
summary: "split a sheet into one image per figure, dropping labels, specks and background",
|
|
104
|
+
scope: "each",
|
|
105
|
+
params: {
|
|
106
|
+
type: "object",
|
|
107
|
+
properties: {
|
|
108
|
+
grid: {
|
|
109
|
+
type: "object",
|
|
110
|
+
description: "an explicit grid; when absent one is detected",
|
|
111
|
+
properties: {
|
|
112
|
+
columns: int("columns", 1),
|
|
113
|
+
rows: int("rows", 1),
|
|
114
|
+
cellWidth: int("cell width, px", 1),
|
|
115
|
+
cellHeight: int("cell height, px", 1),
|
|
116
|
+
origin: point,
|
|
117
|
+
},
|
|
118
|
+
required: ["columns"],
|
|
119
|
+
},
|
|
120
|
+
count: int("figures the sheet must hold (a spec's frames.count); another number fails the slice, naming the cells behind it", 1),
|
|
121
|
+
components: {
|
|
122
|
+
type: "boolean",
|
|
123
|
+
default: false,
|
|
124
|
+
description: "skip grid detection and locate figures as connected components",
|
|
125
|
+
},
|
|
126
|
+
tolerance: {
|
|
127
|
+
type: "number",
|
|
128
|
+
minimum: 0,
|
|
129
|
+
default: 40,
|
|
130
|
+
description: "RGB distance from the background beyond which a pixel is foreground",
|
|
131
|
+
},
|
|
132
|
+
labelFraction: {
|
|
133
|
+
type: "number",
|
|
134
|
+
minimum: 0,
|
|
135
|
+
maximum: 1,
|
|
136
|
+
default: 0.04,
|
|
137
|
+
description: "components smaller than this fraction of the largest figure are labels",
|
|
138
|
+
},
|
|
139
|
+
padding: int("px kept around each figure", 0, { default: 4 }),
|
|
140
|
+
blobs: {
|
|
141
|
+
type: "array",
|
|
142
|
+
description: "what each ambiguous blob is, by its id (x,y,WxH on the sheet), as the sheet-blob decision answered; a blob with none keeps the area rule",
|
|
143
|
+
items: {
|
|
144
|
+
type: "object",
|
|
145
|
+
properties: {
|
|
146
|
+
id: { type: "string", description: "the blob's box on the sheet, x,y,WxH" },
|
|
147
|
+
kind: { type: "string", enum: [...BLOB_KINDS] },
|
|
148
|
+
with: {
|
|
149
|
+
type: "string",
|
|
150
|
+
description: "for a part, the id of the figure it joins (a figure drawn in pieces); else the nearest figure",
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
required: ["id", "kind"],
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
name: "matte",
|
|
161
|
+
summary: "remove the background to the style profile, unmixing soft edges and removing halo and fringe",
|
|
162
|
+
scope: "each",
|
|
163
|
+
params: {
|
|
164
|
+
type: "object",
|
|
165
|
+
properties: {
|
|
166
|
+
band: {
|
|
167
|
+
type: "number",
|
|
168
|
+
exclusiveMinimum: 0,
|
|
169
|
+
default: 2,
|
|
170
|
+
description: "width of the edge band unmixed into soft alpha, px",
|
|
171
|
+
},
|
|
172
|
+
tolerance: {
|
|
173
|
+
type: "number",
|
|
174
|
+
minimum: 0,
|
|
175
|
+
default: 24,
|
|
176
|
+
description: "RGB distance within which a pixel counts as background in the checks",
|
|
177
|
+
},
|
|
178
|
+
maxHaloFraction: {
|
|
179
|
+
type: "number",
|
|
180
|
+
minimum: 0,
|
|
181
|
+
maximum: 1,
|
|
182
|
+
default: 0.005,
|
|
183
|
+
description: "limit of the halo and leftover-background checks",
|
|
184
|
+
},
|
|
185
|
+
sliceTolerance: {
|
|
186
|
+
type: "number",
|
|
187
|
+
minimum: 0,
|
|
188
|
+
default: 40,
|
|
189
|
+
description: "for an image that was not sliced: RGB distance from its border colour beyond which a pixel is kept",
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "apply-style",
|
|
196
|
+
summary: "re-apply the style profile's alpha and colour rule (binary alpha, palette snap) and clear transparent colour",
|
|
197
|
+
scope: "each",
|
|
198
|
+
params: { type: "object", properties: {} },
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
name: "register",
|
|
202
|
+
summary: "place every image in one frame size with the feet baseline and its pin point (centre of mass, or ground footprint) on the anchor, at one common scale",
|
|
203
|
+
scope: "all",
|
|
204
|
+
params: {
|
|
205
|
+
type: "object",
|
|
206
|
+
properties: {
|
|
207
|
+
frame: { ...size, description: "frame size; defaults to the target profile's frames" },
|
|
208
|
+
anchor: { ...point, description: "pivot; defaults to the bottom centre of the frame" },
|
|
209
|
+
families: {
|
|
210
|
+
type: "array",
|
|
211
|
+
items: { type: "string" },
|
|
212
|
+
description: "one family key per image; normalises scale within each family",
|
|
213
|
+
},
|
|
214
|
+
pins: {
|
|
215
|
+
type: "array",
|
|
216
|
+
items: { type: "string", enum: ["center", "footprint"] },
|
|
217
|
+
description: "one pin per image, the point put on the anchor's column: center (centre of mass, the default) or footprint (the ground footprint, for a planted family)",
|
|
218
|
+
},
|
|
219
|
+
measureThreshold: {
|
|
220
|
+
type: "integer",
|
|
221
|
+
minimum: 1,
|
|
222
|
+
maximum: 255,
|
|
223
|
+
default: 128,
|
|
224
|
+
description: "alpha counted for the baseline",
|
|
225
|
+
},
|
|
226
|
+
margin: {
|
|
227
|
+
type: "number",
|
|
228
|
+
minimum: 0,
|
|
229
|
+
default: 1,
|
|
230
|
+
description: "px kept free at the frame edge",
|
|
231
|
+
},
|
|
232
|
+
clamp: {
|
|
233
|
+
type: "array",
|
|
234
|
+
items: { type: "number", exclusiveMinimum: 0 },
|
|
235
|
+
minItems: 2,
|
|
236
|
+
default: [0.8, 1.25],
|
|
237
|
+
description: "bounds of the per-image family normalisation",
|
|
238
|
+
},
|
|
239
|
+
scale: {
|
|
240
|
+
type: "number",
|
|
241
|
+
exclusiveMinimum: 0,
|
|
242
|
+
description: "use this common scale instead of fitting one",
|
|
243
|
+
},
|
|
244
|
+
filter,
|
|
245
|
+
},
|
|
246
|
+
},
|
|
247
|
+
defaults: (params, context) => {
|
|
248
|
+
const out = styleFilter(params, context);
|
|
249
|
+
if (out["frame"] === undefined && context.frame)
|
|
250
|
+
out["frame"] = { ...context.frame };
|
|
251
|
+
const frame = out["frame"];
|
|
252
|
+
if (out["anchor"] === undefined && frame)
|
|
253
|
+
out["anchor"] = { x: Math.floor(frame.width / 2), y: frame.height - 1 };
|
|
254
|
+
return out;
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
name: "join",
|
|
259
|
+
summary: "assemble the images into one strip or sheet, left to right then top to bottom",
|
|
260
|
+
scope: "all",
|
|
261
|
+
params: {
|
|
262
|
+
type: "object",
|
|
263
|
+
properties: {
|
|
264
|
+
columns: int("columns; defaults to every image in one row (a strip)", 1),
|
|
265
|
+
name: { type: "string", description: "the joined image's name" },
|
|
266
|
+
},
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: "flip",
|
|
271
|
+
summary: "mirror each image",
|
|
272
|
+
scope: "each",
|
|
273
|
+
params: {
|
|
274
|
+
type: "object",
|
|
275
|
+
properties: {
|
|
276
|
+
direction: {
|
|
277
|
+
type: "string",
|
|
278
|
+
enum: ["horizontal", "vertical"],
|
|
279
|
+
default: "horizontal",
|
|
280
|
+
description: "horizontal swaps left and right; vertical swaps top and bottom",
|
|
281
|
+
},
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
name: "renditions",
|
|
287
|
+
summary: "make one copy of each image per scale (the input is 1x), named <name>@<scale>x",
|
|
288
|
+
scope: "each",
|
|
289
|
+
params: {
|
|
290
|
+
type: "object",
|
|
291
|
+
properties: {
|
|
292
|
+
scales: {
|
|
293
|
+
type: "array",
|
|
294
|
+
items: { type: "number", exclusiveMinimum: 0 },
|
|
295
|
+
minItems: 1,
|
|
296
|
+
default: [1, 2],
|
|
297
|
+
},
|
|
298
|
+
filter,
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
defaults: styleFilter,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: "convert",
|
|
305
|
+
summary: "set the format each image is written in, by extension or media type (png, webp)",
|
|
306
|
+
scope: "each",
|
|
307
|
+
params: {
|
|
308
|
+
type: "object",
|
|
309
|
+
properties: {
|
|
310
|
+
format: { type: "string", description: "an extension or media type the engine encodes" },
|
|
311
|
+
},
|
|
312
|
+
required: ["format"],
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
];
|
|
316
|
+
/** Every operation a recipe may name: the image operations, then the audio engine's. */
|
|
317
|
+
export const ALL_OPERATIONS = [...OPERATIONS, ...AUDIO_OPERATIONS];
|
|
318
|
+
export function operationSpec(name) {
|
|
319
|
+
return ALL_OPERATIONS.find((o) => o.name === name);
|
|
320
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Raster } from "../image/raster.ts";
|
|
2
|
+
import type { Box } from "../types.ts";
|
|
3
|
+
import type { ImageEngine } from "./types.ts";
|
|
4
|
+
/** Copies `box` out of `src`; pixels outside the source are transparent. */
|
|
5
|
+
export declare function cropRaster(src: Raster, box: Box): Raster;
|
|
6
|
+
/** The box of pixels with alpha >= threshold, or undefined when there is none. */
|
|
7
|
+
export declare function boundsAt(r: Raster, threshold: number): Box | undefined;
|
|
8
|
+
export declare const RASTER_ENGINE_NAME = "assetgrove-raster";
|
|
9
|
+
export declare const rasterEngine: ImageEngine;
|
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-house engine: Assetgrove's own TypeScript raster code (pngjs and jpeg-js decode, the
|
|
3
|
+
* sheet slicer, matte and registration, an in-house lossless WebP encoder). Every implementation is
|
|
4
|
+
* a pure function of its input pixels and parameters.
|
|
5
|
+
*/
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import { combineDigitalSourceTypes, DIGITAL_SOURCE_TYPES } from "../metadata.js";
|
|
8
|
+
import { InputError } from "../errors.js";
|
|
9
|
+
import { applyStyle } from "../image/apply-style.js";
|
|
10
|
+
import { createRaster, decodeImage, encodePng, toHex } from "../image/raster.js";
|
|
11
|
+
import { flipHorizontal, resampleTo } from "../image/resample.js";
|
|
12
|
+
import { encodeWebpLossless } from "../image/webp.js";
|
|
13
|
+
import { matteChecks, matteFigure } from "../sheet/matte.js";
|
|
14
|
+
import { registerFrames } from "../sheet/register.js";
|
|
15
|
+
import { sliceSheet, wholeImageFigure } from "../sheet/slice.js";
|
|
16
|
+
/** A new item from `item` with new pixels; the slice figure no longer lines up, so it is dropped. */
|
|
17
|
+
function derive(item, raster, meta = {}) {
|
|
18
|
+
return { ...item, raster, figure: undefined, meta: { ...item.meta, ...meta } };
|
|
19
|
+
}
|
|
20
|
+
/** Copies `box` out of `src`; pixels outside the source are transparent. */
|
|
21
|
+
export function cropRaster(src, box) {
|
|
22
|
+
const out = createRaster(box.width, box.height);
|
|
23
|
+
for (let y = 0; y < box.height; y++) {
|
|
24
|
+
const sy = box.y + y;
|
|
25
|
+
if (sy < 0 || sy >= src.height)
|
|
26
|
+
continue;
|
|
27
|
+
const x0 = Math.max(0, -box.x);
|
|
28
|
+
const x1 = Math.min(box.width, src.width - box.x);
|
|
29
|
+
if (x1 <= x0)
|
|
30
|
+
continue;
|
|
31
|
+
const from = (sy * src.width + box.x + x0) * 4;
|
|
32
|
+
out.data.set(src.data.subarray(from, from + (x1 - x0) * 4), (y * box.width + x0) * 4);
|
|
33
|
+
}
|
|
34
|
+
return out;
|
|
35
|
+
}
|
|
36
|
+
/** The box of pixels with alpha >= threshold, or undefined when there is none. */
|
|
37
|
+
export function boundsAt(r, threshold) {
|
|
38
|
+
let minX = Infinity;
|
|
39
|
+
let minY = Infinity;
|
|
40
|
+
let maxX = -1;
|
|
41
|
+
let maxY = -1;
|
|
42
|
+
for (let y = 0; y < r.height; y++) {
|
|
43
|
+
for (let x = 0; x < r.width; x++) {
|
|
44
|
+
if ((r.data[(y * r.width + x) * 4 + 3] ?? 0) >= threshold) {
|
|
45
|
+
if (x < minX)
|
|
46
|
+
minX = x;
|
|
47
|
+
if (y < minY)
|
|
48
|
+
minY = y;
|
|
49
|
+
if (x > maxX)
|
|
50
|
+
maxX = x;
|
|
51
|
+
if (y > maxY)
|
|
52
|
+
maxY = y;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (maxX < 0)
|
|
57
|
+
return undefined;
|
|
58
|
+
return { x: minX, y: minY, width: maxX - minX + 1, height: maxY - minY + 1 };
|
|
59
|
+
}
|
|
60
|
+
function flipVertical(src) {
|
|
61
|
+
const out = createRaster(src.width, src.height);
|
|
62
|
+
const row = src.width * 4;
|
|
63
|
+
for (let y = 0; y < src.height; y++) {
|
|
64
|
+
out.data.set(src.data.subarray(y * row, (y + 1) * row), (src.height - 1 - y) * row);
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
function scaleBy(src, factor, filter) {
|
|
69
|
+
const size = {
|
|
70
|
+
width: Math.max(1, Math.round(src.width * factor)),
|
|
71
|
+
height: Math.max(1, Math.round(src.height * factor)),
|
|
72
|
+
};
|
|
73
|
+
return resampleTo(src, factor, { x: 0, y: 0 }, size, filter);
|
|
74
|
+
}
|
|
75
|
+
function formatScale(s) {
|
|
76
|
+
return String(Number(s.toFixed(4)));
|
|
77
|
+
}
|
|
78
|
+
const ENCODERS = {
|
|
79
|
+
"image/png": { extension: "png", encode: encodePng },
|
|
80
|
+
"image/webp": { extension: "webp", encode: encodeWebpLossless },
|
|
81
|
+
};
|
|
82
|
+
const crop = ([item], p) => {
|
|
83
|
+
const it = item;
|
|
84
|
+
const box = p;
|
|
85
|
+
if (box.x + box.width > it.raster.width || box.y + box.height > it.raster.height) {
|
|
86
|
+
throw new InputError(`crop box ${box.width}x${box.height} at ${box.x},${box.y} lies outside ${it.name} (${it.raster.width}x${it.raster.height})`);
|
|
87
|
+
}
|
|
88
|
+
return { items: [derive(it, cropRaster(it.raster, box))] };
|
|
89
|
+
};
|
|
90
|
+
const trim = ([item], p) => {
|
|
91
|
+
const it = item;
|
|
92
|
+
const threshold = p["threshold"];
|
|
93
|
+
const margin = p["margin"];
|
|
94
|
+
const bounds = boundsAt(it.raster, threshold);
|
|
95
|
+
if (!bounds)
|
|
96
|
+
throw new InputError(`${it.name} has no pixel at alpha ${threshold} or more`);
|
|
97
|
+
const box = {
|
|
98
|
+
x: bounds.x - margin,
|
|
99
|
+
y: bounds.y - margin,
|
|
100
|
+
width: bounds.width + 2 * margin,
|
|
101
|
+
height: bounds.height + 2 * margin,
|
|
102
|
+
};
|
|
103
|
+
return { items: [derive(it, cropRaster(it.raster, box), { trimmedBox: box })] };
|
|
104
|
+
};
|
|
105
|
+
const pad = ([item], p) => {
|
|
106
|
+
const it = item;
|
|
107
|
+
const [top, right, bottom, left] = ["top", "right", "bottom", "left"].map((k) => p[k]);
|
|
108
|
+
const box = {
|
|
109
|
+
x: -left,
|
|
110
|
+
y: -top,
|
|
111
|
+
width: it.raster.width + left + right,
|
|
112
|
+
height: it.raster.height + top + bottom,
|
|
113
|
+
};
|
|
114
|
+
return { items: [derive(it, cropRaster(it.raster, box))] };
|
|
115
|
+
};
|
|
116
|
+
const scale = ([item], p) => {
|
|
117
|
+
const it = item;
|
|
118
|
+
const given = ["factor", "width", "height"].filter((k) => p[k] !== undefined);
|
|
119
|
+
if (given.length !== 1) {
|
|
120
|
+
throw new InputError("scale takes exactly one of factor, width or height");
|
|
121
|
+
}
|
|
122
|
+
const factor = p["factor"] !== undefined
|
|
123
|
+
? p["factor"]
|
|
124
|
+
: p["width"] !== undefined
|
|
125
|
+
? p["width"] / it.raster.width
|
|
126
|
+
: p["height"] / it.raster.height;
|
|
127
|
+
const filter = p["filter"];
|
|
128
|
+
const size = {
|
|
129
|
+
width: p["width"] ?? Math.max(1, Math.round(it.raster.width * factor)),
|
|
130
|
+
height: p["height"] ?? Math.max(1, Math.round(it.raster.height * factor)),
|
|
131
|
+
};
|
|
132
|
+
return { items: [derive(it, resampleTo(it.raster, factor, { x: 0, y: 0 }, size, filter))] };
|
|
133
|
+
};
|
|
134
|
+
const slice = ([item], p) => {
|
|
135
|
+
const it = item;
|
|
136
|
+
const sliced = sliceSheet(it.raster, p);
|
|
137
|
+
if (sliced.figures.length === 0)
|
|
138
|
+
throw new InputError("no figures found on the sheet");
|
|
139
|
+
const items = sliced.figures.map((figure) => ({
|
|
140
|
+
name: `${it.name}-f${String(figure.id).padStart(3, "0")}`,
|
|
141
|
+
raster: figure.crop,
|
|
142
|
+
digitalSourceType: it.digitalSourceType ?? DIGITAL_SOURCE_TYPES.undeclared,
|
|
143
|
+
mediaType: it.mediaType,
|
|
144
|
+
meta: {
|
|
145
|
+
frame: figure.id,
|
|
146
|
+
cell: figure.cell,
|
|
147
|
+
box: figure.box,
|
|
148
|
+
background: toHex(figure.background),
|
|
149
|
+
transforms: figure.transforms,
|
|
150
|
+
},
|
|
151
|
+
figure,
|
|
152
|
+
}));
|
|
153
|
+
return {
|
|
154
|
+
items,
|
|
155
|
+
report: {
|
|
156
|
+
mode: sliced.mode,
|
|
157
|
+
...(sliced.grid !== undefined && { grid: sliced.grid }),
|
|
158
|
+
background: toHex(sliced.background),
|
|
159
|
+
figures: items.length,
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* A hash of a sliced figure's mask, exclusion mask and background: what `matte` reads besides the
|
|
165
|
+
* pixels, recorded in its step so the step can be replayed from its record.
|
|
166
|
+
*/
|
|
167
|
+
function figureHash(figure) {
|
|
168
|
+
const h = createHash("sha256");
|
|
169
|
+
h.update(`figure ${figure.crop.width}x${figure.crop.height} ${toHex(figure.background)}\n`);
|
|
170
|
+
h.update(figure.mask);
|
|
171
|
+
if (figure.excluded)
|
|
172
|
+
h.update("excluded\n").update(figure.excluded);
|
|
173
|
+
return h.digest("hex");
|
|
174
|
+
}
|
|
175
|
+
const matte = ([item], p, { style }) => {
|
|
176
|
+
const it = item;
|
|
177
|
+
const options = { band: p["band"], tolerance: p["tolerance"] };
|
|
178
|
+
const checkOptions = { maxHaloFraction: p["maxHaloFraction"] };
|
|
179
|
+
// A sliced item mattes with its slice figure (mask, exclusions, cell background), recorded as a
|
|
180
|
+
// hash. Any other image (generated, hand-made, or changed since slicing) is one figure: every
|
|
181
|
+
// pixel away from its border colour is kept, however small or detached.
|
|
182
|
+
const figure = it.figure ?? wholeImageFigure(it.raster, p["sliceTolerance"]);
|
|
183
|
+
const matted = matteFigure(figure, style, options);
|
|
184
|
+
return {
|
|
185
|
+
items: [
|
|
186
|
+
derive(it, matted.image, {
|
|
187
|
+
transforms: matted.transforms,
|
|
188
|
+
quality: matted.quality,
|
|
189
|
+
checks: matteChecks(matted.quality, checkOptions),
|
|
190
|
+
}),
|
|
191
|
+
],
|
|
192
|
+
report: {
|
|
193
|
+
figure: {
|
|
194
|
+
source: it.figure ? "slice" : "whole-image",
|
|
195
|
+
background: toHex(figure.background),
|
|
196
|
+
...(it.figure && { sha256: figureHash(it.figure) }),
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
const style = ([item], _p, context) => {
|
|
202
|
+
const it = item;
|
|
203
|
+
return { items: [derive(it, applyStyle(it.raster, context.style))] };
|
|
204
|
+
};
|
|
205
|
+
const register = (items, p) => {
|
|
206
|
+
const frame = p["frame"];
|
|
207
|
+
if (!frame)
|
|
208
|
+
throw new InputError("register needs a frame size (params.frame or a target profile)");
|
|
209
|
+
if (items.length === 0)
|
|
210
|
+
throw new InputError("register needs at least one image");
|
|
211
|
+
const families = p["families"];
|
|
212
|
+
const pins = p["pins"];
|
|
213
|
+
const options = {
|
|
214
|
+
frame,
|
|
215
|
+
anchor: p["anchor"],
|
|
216
|
+
edges: p["filter"],
|
|
217
|
+
measureThreshold: p["measureThreshold"],
|
|
218
|
+
margin: p["margin"],
|
|
219
|
+
clamp: p["clamp"].slice(0, 2),
|
|
220
|
+
...(families !== undefined && { families }),
|
|
221
|
+
...(pins !== undefined && { pins }),
|
|
222
|
+
...(p["scale"] !== undefined && { scale: p["scale"] }),
|
|
223
|
+
};
|
|
224
|
+
const registration = registerFrames(items.map((i) => i.raster), options);
|
|
225
|
+
return {
|
|
226
|
+
items: items.map((it, i) => {
|
|
227
|
+
const r = registration.frames[i];
|
|
228
|
+
if (!r)
|
|
229
|
+
throw new Error("registration lost a frame");
|
|
230
|
+
return derive(it, r.image, {
|
|
231
|
+
transforms: r.transforms,
|
|
232
|
+
jitterPx: r.jitterPx,
|
|
233
|
+
measure: r.measure,
|
|
234
|
+
});
|
|
235
|
+
}),
|
|
236
|
+
report: { scale: registration.scale, jitterPx: registration.jitterPx },
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
const join = (items, p) => {
|
|
240
|
+
const first = items[0];
|
|
241
|
+
if (!first)
|
|
242
|
+
throw new InputError("join needs at least one image");
|
|
243
|
+
const columns = Math.min(p["columns"] ?? items.length, items.length);
|
|
244
|
+
const rows = Math.ceil(items.length / columns);
|
|
245
|
+
const cell = {
|
|
246
|
+
width: Math.max(...items.map((i) => i.raster.width)),
|
|
247
|
+
height: Math.max(...items.map((i) => i.raster.height)),
|
|
248
|
+
};
|
|
249
|
+
const out = createRaster(cell.width * columns, cell.height * rows);
|
|
250
|
+
const placed = items.map((it, i) => {
|
|
251
|
+
const box = {
|
|
252
|
+
x: (i % columns) * cell.width,
|
|
253
|
+
y: Math.floor(i / columns) * cell.height,
|
|
254
|
+
width: it.raster.width,
|
|
255
|
+
height: it.raster.height,
|
|
256
|
+
};
|
|
257
|
+
const row = it.raster.width * 4;
|
|
258
|
+
for (let y = 0; y < it.raster.height; y++) {
|
|
259
|
+
out.data.set(it.raster.data.subarray(y * row, (y + 1) * row), ((box.y + y) * out.width + box.x) * 4);
|
|
260
|
+
}
|
|
261
|
+
return { name: it.name, box };
|
|
262
|
+
});
|
|
263
|
+
const name = p["name"] ?? `${first.name}-${rows === 1 ? "strip" : "sheet"}`;
|
|
264
|
+
return {
|
|
265
|
+
items: [
|
|
266
|
+
{
|
|
267
|
+
name,
|
|
268
|
+
raster: out,
|
|
269
|
+
mediaType: first.mediaType,
|
|
270
|
+
digitalSourceType: combineDigitalSourceTypes(items.map((i) => i.digitalSourceType ?? DIGITAL_SOURCE_TYPES.undeclared)),
|
|
271
|
+
meta: { cell, columns, rows, placed },
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
};
|
|
275
|
+
};
|
|
276
|
+
const flip = ([item], p) => {
|
|
277
|
+
const it = item;
|
|
278
|
+
const raster = p["direction"] === "vertical" ? flipVertical(it.raster) : flipHorizontal(it.raster);
|
|
279
|
+
return { items: [derive(it, raster)] };
|
|
280
|
+
};
|
|
281
|
+
const renditions = ([item], p) => {
|
|
282
|
+
const it = item;
|
|
283
|
+
const filter = p["filter"];
|
|
284
|
+
return {
|
|
285
|
+
items: p["scales"].map((s) => ({
|
|
286
|
+
...derive(it, scaleBy(it.raster, s, filter), { rendition: s }),
|
|
287
|
+
name: `${it.name}@${formatScale(s)}x`,
|
|
288
|
+
})),
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
const convert = ([item], p) => {
|
|
292
|
+
const it = item;
|
|
293
|
+
const format = p["format"].trim().toLowerCase().replace(/^\./, "");
|
|
294
|
+
const mediaType = Object.entries(ENCODERS).find(([type, e]) => type === format || e?.extension === format)?.[0];
|
|
295
|
+
if (!mediaType) {
|
|
296
|
+
throw new InputError(`the ${RASTER_ENGINE_NAME} engine cannot encode "${p["format"]}"; it encodes ${Object.keys(ENCODERS).join(", ")}`);
|
|
297
|
+
}
|
|
298
|
+
return { items: [{ ...it, mediaType }] };
|
|
299
|
+
};
|
|
300
|
+
export const RASTER_ENGINE_NAME = "assetgrove-raster";
|
|
301
|
+
export const rasterEngine = {
|
|
302
|
+
name: RASTER_ENGINE_NAME,
|
|
303
|
+
version: "1.1.0",
|
|
304
|
+
operations: {
|
|
305
|
+
crop,
|
|
306
|
+
trim,
|
|
307
|
+
pad,
|
|
308
|
+
scale,
|
|
309
|
+
slice,
|
|
310
|
+
matte,
|
|
311
|
+
"apply-style": style,
|
|
312
|
+
register,
|
|
313
|
+
join,
|
|
314
|
+
flip,
|
|
315
|
+
renditions,
|
|
316
|
+
convert,
|
|
317
|
+
},
|
|
318
|
+
encoders: ENCODERS,
|
|
319
|
+
decode(bytes) {
|
|
320
|
+
try {
|
|
321
|
+
return decodeImage(bytes);
|
|
322
|
+
}
|
|
323
|
+
catch (error) {
|
|
324
|
+
throw new InputError(`cannot decode the image: ${error.message}`, {
|
|
325
|
+
cause: error,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
};
|