| 669 | // Guard checks that must pass before capturing the onion-skin shot. Returns the |
| 670 | // message to print when a guard fails, or null when clear to proceed. |
| 671 | function onionShotGuardError( |
| 672 | projectDir: string | undefined, |
| 673 | requests: Array<{ selector: string }>, |
| 674 | ghost: boolean, |
| 675 | ): string | null { |
| 676 | if (!projectDir) return "--shot needs a project directory (not a single .html file)."; |
| 677 | // The rendered onion (--ghost) screenshots the whole painted stage, so it does |
| 678 | // not need an animated DOM element to sample — only the marker onion does. |
| 679 | if (requests.length === 0 && !ghost) |
| 680 | return "--shot: no animated element to sample for the selection."; |
| 681 | return null; |
| 682 | } |
| 683 | |
| 684 | function onionShotOptions(args: ShotArgs & { selector?: string }) { |
| 685 | return { |