@visual-check/cli 0.0.0 → 0.1.1
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/dist/addon-build.d.ts +3 -0
- package/dist/addon-build.d.ts.map +1 -0
- package/dist/addon-build.js +4 -0
- package/dist/addon-build.js.map +1 -0
- package/dist/addon-child/addon-child.d.ts +63 -0
- package/dist/addon-child/addon-child.d.ts.map +1 -0
- package/dist/addon-child/addon-child.js +85 -0
- package/dist/addon-child/addon-child.js.map +1 -0
- package/dist/addon-child/image-files.d.ts +11 -0
- package/dist/addon-child/image-files.d.ts.map +1 -0
- package/dist/addon-child/image-files.js +138 -0
- package/dist/addon-child/image-files.js.map +1 -0
- package/dist/addon-child/protocol.d.ts +181 -0
- package/dist/addon-child/protocol.d.ts.map +1 -0
- package/dist/addon-child/protocol.js +2 -0
- package/dist/addon-child/protocol.js.map +1 -0
- package/dist/addon-child/read-request.d.ts +7 -0
- package/dist/addon-child/read-request.d.ts.map +1 -0
- package/dist/addon-child/read-request.js +25 -0
- package/dist/addon-child/read-request.js.map +1 -0
- package/dist/addon-child.d.ts +2 -0
- package/dist/addon-child.d.ts.map +1 -0
- package/dist/addon-child.js +61 -0
- package/dist/addon-child.js.map +1 -0
- package/dist/affected-stories/affected-stories.d.ts +128 -0
- package/dist/affected-stories/affected-stories.d.ts.map +1 -0
- package/dist/affected-stories/affected-stories.js +168 -0
- package/dist/affected-stories/affected-stories.js.map +1 -0
- package/dist/affected-stories/changed-file-rules.d.ts +98 -0
- package/dist/affected-stories/changed-file-rules.d.ts.map +1 -0
- package/dist/affected-stories/changed-file-rules.js +167 -0
- package/dist/affected-stories/changed-file-rules.js.map +1 -0
- package/dist/affected-stories/fallow-graph.d.ts +67 -0
- package/dist/affected-stories/fallow-graph.d.ts.map +1 -0
- package/dist/affected-stories/fallow-graph.js +180 -0
- package/dist/affected-stories/fallow-graph.js.map +1 -0
- package/dist/affected-stories/git-changes.d.ts +57 -0
- package/dist/affected-stories/git-changes.d.ts.map +1 -0
- package/dist/affected-stories/git-changes.js +203 -0
- package/dist/affected-stories/git-changes.js.map +1 -0
- package/dist/affected-stories/group-changes.d.ts +48 -0
- package/dist/affected-stories/group-changes.d.ts.map +1 -0
- package/dist/affected-stories/group-changes.js +41 -0
- package/dist/affected-stories/group-changes.js.map +1 -0
- package/dist/affected-stories/import-graph.d.ts +33 -0
- package/dist/affected-stories/import-graph.d.ts.map +1 -0
- package/dist/affected-stories/import-graph.js +99 -0
- package/dist/affected-stories/import-graph.js.map +1 -0
- package/dist/affected-stories/limited-map.d.ts +9 -0
- package/dist/affected-stories/limited-map.d.ts.map +1 -0
- package/dist/affected-stories/limited-map.js +24 -0
- package/dist/affected-stories/limited-map.js.map +1 -0
- package/dist/affected-stories/package-folder.d.ts +8 -0
- package/dist/affected-stories/package-folder.d.ts.map +1 -0
- package/dist/affected-stories/package-folder.js +45 -0
- package/dist/affected-stories/package-folder.js.map +1 -0
- package/dist/affected-stories/storybook-rules.d.ts +153 -0
- package/dist/affected-stories/storybook-rules.d.ts.map +1 -0
- package/dist/affected-stories/storybook-rules.js +161 -0
- package/dist/affected-stories/storybook-rules.js.map +1 -0
- package/dist/affected-stories/walk-back.d.ts +16 -0
- package/dist/affected-stories/walk-back.d.ts.map +1 -0
- package/dist/affected-stories/walk-back.js +46 -0
- package/dist/affected-stories/walk-back.js.map +1 -0
- package/dist/agent-skill/install-skill.d.ts +34 -0
- package/dist/agent-skill/install-skill.d.ts.map +1 -0
- package/dist/agent-skill/install-skill.js +43 -0
- package/dist/agent-skill/install-skill.js.map +1 -0
- package/dist/agent-skill/refresh-skill.d.ts +62 -0
- package/dist/agent-skill/refresh-skill.d.ts.map +1 -0
- package/dist/agent-skill/refresh-skill.js +105 -0
- package/dist/agent-skill/refresh-skill.js.map +1 -0
- package/dist/agent-skill/setup-file.d.ts +41 -0
- package/dist/agent-skill/setup-file.d.ts.map +1 -0
- package/dist/agent-skill/setup-file.js +38 -0
- package/dist/agent-skill/setup-file.js.map +1 -0
- package/dist/agent-skill/skill-files.d.ts +19 -0
- package/dist/agent-skill/skill-files.d.ts.map +1 -0
- package/dist/agent-skill/skill-files.js +29 -0
- package/dist/agent-skill/skill-files.js.map +1 -0
- package/dist/agent-skill/skill-markdown.d.ts +31 -0
- package/dist/agent-skill/skill-markdown.d.ts.map +1 -0
- package/dist/agent-skill/skill-markdown.js +54 -0
- package/dist/agent-skill/skill-markdown.js.map +1 -0
- package/dist/baselines/baseline-clash.d.ts +31 -0
- package/dist/baselines/baseline-clash.d.ts.map +1 -0
- package/dist/baselines/baseline-clash.js +23 -0
- package/dist/baselines/baseline-clash.js.map +1 -0
- package/dist/baselines/baseline-error.d.ts +39 -0
- package/dist/baselines/baseline-error.d.ts.map +1 -0
- package/dist/baselines/baseline-error.js +42 -0
- package/dist/baselines/baseline-error.js.map +1 -0
- package/dist/baselines/baseline-files.d.ts +130 -0
- package/dist/baselines/baseline-files.d.ts.map +1 -0
- package/dist/baselines/baseline-files.js +292 -0
- package/dist/baselines/baseline-files.js.map +1 -0
- package/dist/baselines/baseline-set.d.ts +42 -0
- package/dist/baselines/baseline-set.d.ts.map +1 -0
- package/dist/baselines/baseline-set.js +104 -0
- package/dist/baselines/baseline-set.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +57 -0
- package/dist/bin.js.map +1 -0
- package/dist/browser/browser-package.d.ts +54 -0
- package/dist/browser/browser-package.d.ts.map +1 -0
- package/dist/browser/browser-package.js +105 -0
- package/dist/browser/browser-package.js.map +1 -0
- package/dist/browser/browser-version.d.ts +67 -0
- package/dist/browser/browser-version.d.ts.map +1 -0
- package/dist/browser/browser-version.js +61 -0
- package/dist/browser/browser-version.js.map +1 -0
- package/dist/browser/chrome-for-testing-platform.d.ts +24 -0
- package/dist/browser/chrome-for-testing-platform.d.ts.map +1 -0
- package/dist/browser/chrome-for-testing-platform.js +39 -0
- package/dist/browser/chrome-for-testing-platform.js.map +1 -0
- package/dist/browser/image-marker.d.ts +46 -0
- package/dist/browser/image-marker.d.ts.map +1 -0
- package/dist/browser/image-marker.js +81 -0
- package/dist/browser/image-marker.js.map +1 -0
- package/dist/browser/read-browser-package.d.ts +58 -0
- package/dist/browser/read-browser-package.d.ts.map +1 -0
- package/dist/browser/read-browser-package.js +130 -0
- package/dist/browser/read-browser-package.js.map +1 -0
- package/dist/browser-download/browser-download-error.d.ts +19 -0
- package/dist/browser-download/browser-download-error.d.ts.map +1 -0
- package/dist/browser-download/browser-download-error.js +21 -0
- package/dist/browser-download/browser-download-error.js.map +1 -0
- package/dist/browser-download/cache-folder.d.ts +7 -0
- package/dist/browser-download/cache-folder.d.ts.map +1 -0
- package/dist/browser-download/cache-folder.js +34 -0
- package/dist/browser-download/cache-folder.js.map +1 -0
- package/dist/browser-download/download-file.d.ts +45 -0
- package/dist/browser-download/download-file.d.ts.map +1 -0
- package/dist/browser-download/download-file.js +340 -0
- package/dist/browser-download/download-file.js.map +1 -0
- package/dist/browser-download/install-headless-shell.d.ts +96 -0
- package/dist/browser-download/install-headless-shell.d.ts.map +1 -0
- package/dist/browser-download/install-headless-shell.js +491 -0
- package/dist/browser-download/install-headless-shell.js.map +1 -0
- package/dist/browser-download/proxy.d.ts +19 -0
- package/dist/browser-download/proxy.d.ts.map +1 -0
- package/dist/browser-download/proxy.js +102 -0
- package/dist/browser-download/proxy.js.map +1 -0
- package/dist/browser-download/unzip.d.ts +11 -0
- package/dist/browser-download/unzip.d.ts.map +1 -0
- package/dist/browser-download/unzip.js +96 -0
- package/dist/browser-download/unzip.js.map +1 -0
- package/dist/browser-process/start-browser-process.d.ts +30 -0
- package/dist/browser-process/start-browser-process.d.ts.map +1 -0
- package/dist/browser-process/start-browser-process.js +131 -0
- package/dist/browser-process/start-browser-process.js.map +1 -0
- package/dist/capture/capture-session.d.ts +479 -0
- package/dist/capture/capture-session.d.ts.map +1 -0
- package/dist/capture/capture-session.js +723 -0
- package/dist/capture/capture-session.js.map +1 -0
- package/dist/capture/driver/cdp/cdp-connection.d.ts +127 -0
- package/dist/capture/driver/cdp/cdp-connection.d.ts.map +1 -0
- package/dist/capture/driver/cdp/cdp-connection.js +243 -0
- package/dist/capture/driver/cdp/cdp-connection.js.map +1 -0
- package/dist/capture/driver/cdp/cdp-driver.d.ts +42 -0
- package/dist/capture/driver/cdp/cdp-driver.d.ts.map +1 -0
- package/dist/capture/driver/cdp/cdp-driver.js +270 -0
- package/dist/capture/driver/cdp/cdp-driver.js.map +1 -0
- package/dist/capture/driver/cdp/cdp-page.d.ts +10 -0
- package/dist/capture/driver/cdp/cdp-page.d.ts.map +1 -0
- package/dist/capture/driver/cdp/cdp-page.js +765 -0
- package/dist/capture/driver/cdp/cdp-page.js.map +1 -0
- package/dist/capture/driver/cdp/last-lines.d.ts +13 -0
- package/dist/capture/driver/cdp/last-lines.d.ts.map +1 -0
- package/dist/capture/driver/cdp/last-lines.js +49 -0
- package/dist/capture/driver/cdp/last-lines.js.map +1 -0
- package/dist/capture/driver/cdp/launch-arguments.d.ts +16 -0
- package/dist/capture/driver/cdp/launch-arguments.d.ts.map +1 -0
- package/dist/capture/driver/cdp/launch-arguments.js +142 -0
- package/dist/capture/driver/cdp/launch-arguments.js.map +1 -0
- package/dist/capture/driver/cdp/loaded-document.d.ts +61 -0
- package/dist/capture/driver/cdp/loaded-document.d.ts.map +1 -0
- package/dist/capture/driver/cdp/loaded-document.js +104 -0
- package/dist/capture/driver/cdp/loaded-document.js.map +1 -0
- package/dist/capture/driver/cdp/main-frame-navigation.d.ts +127 -0
- package/dist/capture/driver/cdp/main-frame-navigation.d.ts.map +1 -0
- package/dist/capture/driver/cdp/main-frame-navigation.js +214 -0
- package/dist/capture/driver/cdp/main-frame-navigation.js.map +1 -0
- package/dist/capture/driver/cdp/request-watch.d.ts +117 -0
- package/dist/capture/driver/cdp/request-watch.d.ts.map +1 -0
- package/dist/capture/driver/cdp/request-watch.js +244 -0
- package/dist/capture/driver/cdp/request-watch.js.map +1 -0
- package/dist/capture/driver/cdp/time-limit.d.ts +29 -0
- package/dist/capture/driver/cdp/time-limit.d.ts.map +1 -0
- package/dist/capture/driver/cdp/time-limit.js +51 -0
- package/dist/capture/driver/cdp/time-limit.js.map +1 -0
- package/dist/capture/driver/driver.d.ts +511 -0
- package/dist/capture/driver/driver.d.ts.map +1 -0
- package/dist/capture/driver/driver.js +283 -0
- package/dist/capture/driver/driver.js.map +1 -0
- package/dist/capture/end-state.d.ts +131 -0
- package/dist/capture/end-state.d.ts.map +1 -0
- package/dist/capture/end-state.js +818 -0
- package/dist/capture/end-state.js.map +1 -0
- package/dist/capture/page-roots.d.ts +18 -0
- package/dist/capture/page-roots.d.ts.map +1 -0
- package/dist/capture/page-roots.js +67 -0
- package/dist/capture/page-roots.js.map +1 -0
- package/dist/capture/page-script.d.ts +118 -0
- package/dist/capture/page-script.d.ts.map +1 -0
- package/dist/capture/page-script.js +399 -0
- package/dist/capture/page-script.js.map +1 -0
- package/dist/capture/prepare-capture.d.ts +228 -0
- package/dist/capture/prepare-capture.d.ts.map +1 -0
- package/dist/capture/prepare-capture.js +480 -0
- package/dist/capture/prepare-capture.js.map +1 -0
- package/dist/capture/read-options.d.ts +65 -0
- package/dist/capture/read-options.d.ts.map +1 -0
- package/dist/capture/read-options.js +211 -0
- package/dist/capture/read-options.js.map +1 -0
- package/dist/capture/remote-content.d.ts +45 -0
- package/dist/capture/remote-content.d.ts.map +1 -0
- package/dist/capture/remote-content.js +309 -0
- package/dist/capture/remote-content.js.map +1 -0
- package/dist/capture/worker-pool.d.ts +35 -0
- package/dist/capture/worker-pool.d.ts.map +1 -0
- package/dist/capture/worker-pool.js +51 -0
- package/dist/capture/worker-pool.js.map +1 -0
- package/dist/commands/abortable.d.ts +9 -0
- package/dist/commands/abortable.d.ts.map +1 -0
- package/dist/commands/abortable.js +18 -0
- package/dist/commands/abortable.js.map +1 -0
- package/dist/commands/browser-route.d.ts +86 -0
- package/dist/commands/browser-route.d.ts.map +1 -0
- package/dist/commands/browser-route.js +27 -0
- package/dist/commands/browser-route.js.map +1 -0
- package/dist/commands/capture-settings.d.ts +8 -0
- package/dist/commands/capture-settings.d.ts.map +1 -0
- package/dist/commands/capture-settings.js +17 -0
- package/dist/commands/capture-settings.js.map +1 -0
- package/dist/commands/check-story.d.ts +91 -0
- package/dist/commands/check-story.d.ts.map +1 -0
- package/dist/commands/check-story.js +52 -0
- package/dist/commands/check-story.js.map +1 -0
- package/dist/commands/check-storybooks.d.ts +71 -0
- package/dist/commands/check-storybooks.d.ts.map +1 -0
- package/dist/commands/check-storybooks.js +49 -0
- package/dist/commands/check-storybooks.js.map +1 -0
- package/dist/commands/consistency-check.d.ts +62 -0
- package/dist/commands/consistency-check.d.ts.map +1 -0
- package/dist/commands/consistency-check.js +63 -0
- package/dist/commands/consistency-check.js.map +1 -0
- package/dist/commands/consistency-output.d.ts +63 -0
- package/dist/commands/consistency-output.d.ts.map +1 -0
- package/dist/commands/consistency-output.js +63 -0
- package/dist/commands/consistency-output.js.map +1 -0
- package/dist/commands/docker-problem.d.ts +23 -0
- package/dist/commands/docker-problem.d.ts.map +1 -0
- package/dist/commands/docker-problem.js +18 -0
- package/dist/commands/docker-problem.js.map +1 -0
- package/dist/commands/launch-browser.d.ts +123 -0
- package/dist/commands/launch-browser.d.ts.map +1 -0
- package/dist/commands/launch-browser.js +113 -0
- package/dist/commands/launch-browser.js.map +1 -0
- package/dist/commands/missing-library.d.ts +6 -0
- package/dist/commands/missing-library.d.ts.map +1 -0
- package/dist/commands/missing-library.js +19 -0
- package/dist/commands/missing-library.js.map +1 -0
- package/dist/commands/network-warning.d.ts +36 -0
- package/dist/commands/network-warning.d.ts.map +1 -0
- package/dist/commands/network-warning.js +92 -0
- package/dist/commands/network-warning.js.map +1 -0
- package/dist/commands/parse-command-line.d.ts +133 -0
- package/dist/commands/parse-command-line.d.ts.map +1 -0
- package/dist/commands/parse-command-line.js +425 -0
- package/dist/commands/parse-command-line.js.map +1 -0
- package/dist/commands/place-browser.d.ts +75 -0
- package/dist/commands/place-browser.d.ts.map +1 -0
- package/dist/commands/place-browser.js +82 -0
- package/dist/commands/place-browser.js.map +1 -0
- package/dist/commands/plan-snapshots.d.ts +134 -0
- package/dist/commands/plan-snapshots.d.ts.map +1 -0
- package/dist/commands/plan-snapshots.js +278 -0
- package/dist/commands/plan-snapshots.js.map +1 -0
- package/dist/commands/platform-problem.d.ts +7 -0
- package/dist/commands/platform-problem.d.ts.map +1 -0
- package/dist/commands/platform-problem.js +12 -0
- package/dist/commands/platform-problem.js.map +1 -0
- package/dist/commands/read-image-fit.d.ts +16 -0
- package/dist/commands/read-image-fit.d.ts.map +1 -0
- package/dist/commands/read-image-fit.js +26 -0
- package/dist/commands/read-image-fit.js.map +1 -0
- package/dist/commands/remote-content-hint.d.ts +6 -0
- package/dist/commands/remote-content-hint.d.ts.map +1 -0
- package/dist/commands/remote-content-hint.js +37 -0
- package/dist/commands/remote-content-hint.js.map +1 -0
- package/dist/commands/report-entries.d.ts +94 -0
- package/dist/commands/report-entries.d.ts.map +1 -0
- package/dist/commands/report-entries.js +384 -0
- package/dist/commands/report-entries.js.map +1 -0
- package/dist/commands/run-browser.d.ts +128 -0
- package/dist/commands/run-browser.d.ts.map +1 -0
- package/dist/commands/run-browser.js +210 -0
- package/dist/commands/run-browser.js.map +1 -0
- package/dist/commands/run-cli.d.ts +125 -0
- package/dist/commands/run-cli.d.ts.map +1 -0
- package/dist/commands/run-cli.js +656 -0
- package/dist/commands/run-cli.js.map +1 -0
- package/dist/commands/run-output.d.ts +78 -0
- package/dist/commands/run-output.d.ts.map +1 -0
- package/dist/commands/run-output.js +71 -0
- package/dist/commands/run-output.js.map +1 -0
- package/dist/commands/run-report.d.ts +147 -0
- package/dist/commands/run-report.d.ts.map +1 -0
- package/dist/commands/run-report.js +137 -0
- package/dist/commands/run-report.js.map +1 -0
- package/dist/commands/run-selection.d.ts +191 -0
- package/dist/commands/run-selection.d.ts.map +1 -0
- package/dist/commands/run-selection.js +150 -0
- package/dist/commands/run-selection.js.map +1 -0
- package/dist/commands/run-snapshots.d.ts +272 -0
- package/dist/commands/run-snapshots.d.ts.map +1 -0
- package/dist/commands/run-snapshots.js +354 -0
- package/dist/commands/run-snapshots.js.map +1 -0
- package/dist/commands/same-address.d.ts +6 -0
- package/dist/commands/same-address.d.ts.map +1 -0
- package/dist/commands/same-address.js +32 -0
- package/dist/commands/same-address.js.map +1 -0
- package/dist/commands/select-stories.d.ts +40 -0
- package/dist/commands/select-stories.d.ts.map +1 -0
- package/dist/commands/select-stories.js +15 -0
- package/dist/commands/select-stories.js.map +1 -0
- package/dist/commands/shard-share.d.ts +41 -0
- package/dist/commands/shard-share.d.ts.map +1 -0
- package/dist/commands/shard-share.js +61 -0
- package/dist/commands/shard-share.js.map +1 -0
- package/dist/commands/snapshot-result.d.ts +165 -0
- package/dist/commands/snapshot-result.d.ts.map +1 -0
- package/dist/commands/snapshot-result.js +136 -0
- package/dist/commands/snapshot-result.js.map +1 -0
- package/dist/commands/stop-message.d.ts +65 -0
- package/dist/commands/stop-message.d.ts.map +1 -0
- package/dist/commands/stop-message.js +186 -0
- package/dist/commands/stop-message.js.map +1 -0
- package/dist/commands/stopped-run.d.ts +116 -0
- package/dist/commands/stopped-run.d.ts.map +1 -0
- package/dist/commands/stopped-run.js +103 -0
- package/dist/commands/stopped-run.js.map +1 -0
- package/dist/commands/story-run.d.ts +196 -0
- package/dist/commands/story-run.d.ts.map +1 -0
- package/dist/commands/story-run.js +258 -0
- package/dist/commands/story-run.js.map +1 -0
- package/dist/commands/take-snapshot.d.ts +27 -0
- package/dist/commands/take-snapshot.d.ts.map +1 -0
- package/dist/commands/take-snapshot.js +16 -0
- package/dist/commands/take-snapshot.js.map +1 -0
- package/dist/commands/test-plan.d.ts +100 -0
- package/dist/commands/test-plan.d.ts.map +1 -0
- package/dist/commands/test-plan.js +66 -0
- package/dist/commands/test-plan.js.map +1 -0
- package/dist/commands/test-snapshot.d.ts +52 -0
- package/dist/commands/test-snapshot.d.ts.map +1 -0
- package/dist/commands/test-snapshot.js +183 -0
- package/dist/commands/test-snapshot.js.map +1 -0
- package/dist/commands/update-baselines.d.ts +93 -0
- package/dist/commands/update-baselines.d.ts.map +1 -0
- package/dist/commands/update-baselines.js +120 -0
- package/dist/commands/update-baselines.js.map +1 -0
- package/dist/commands/update-snapshot.d.ts +69 -0
- package/dist/commands/update-snapshot.d.ts.map +1 -0
- package/dist/commands/update-snapshot.js +214 -0
- package/dist/commands/update-snapshot.js.map +1 -0
- package/dist/commands/update-story.d.ts +70 -0
- package/dist/commands/update-story.d.ts.map +1 -0
- package/dist/commands/update-story.js +64 -0
- package/dist/commands/update-story.js.map +1 -0
- package/dist/commands/warm-browser.d.ts +43 -0
- package/dist/commands/warm-browser.d.ts.map +1 -0
- package/dist/commands/warm-browser.js +192 -0
- package/dist/commands/warm-browser.js.map +1 -0
- package/dist/config/addon-image-folders.d.ts +13 -0
- package/dist/config/addon-image-folders.d.ts.map +1 -0
- package/dist/config/addon-image-folders.js +7 -0
- package/dist/config/addon-image-folders.js.map +1 -0
- package/dist/config/checks.d.ts +108 -0
- package/dist/config/checks.d.ts.map +1 -0
- package/dist/config/checks.js +190 -0
- package/dist/config/checks.js.map +1 -0
- package/dist/config/config-error.d.ts +23 -0
- package/dist/config/config-error.d.ts.map +1 -0
- package/dist/config/config-error.js +23 -0
- package/dist/config/config-error.js.map +1 -0
- package/dist/config/config-thread.d.ts +25 -0
- package/dist/config/config-thread.d.ts.map +1 -0
- package/dist/config/config-thread.js +73 -0
- package/dist/config/config-thread.js.map +1 -0
- package/dist/config/define-config.d.ts +192 -0
- package/dist/config/define-config.d.ts.map +1 -0
- package/dist/config/define-config.js +9 -0
- package/dist/config/define-config.js.map +1 -0
- package/dist/config/evaluate-config.d.ts +6 -0
- package/dist/config/evaluate-config.d.ts.map +1 -0
- package/dist/config/evaluate-config.js +39 -0
- package/dist/config/evaluate-config.js.map +1 -0
- package/dist/config/find-config.d.ts +35 -0
- package/dist/config/find-config.d.ts.map +1 -0
- package/dist/config/find-config.js +71 -0
- package/dist/config/find-config.js.map +1 -0
- package/dist/config/find-storybook-url-problem.d.ts +29 -0
- package/dist/config/find-storybook-url-problem.d.ts.map +1 -0
- package/dist/config/find-storybook-url-problem.js +34 -0
- package/dist/config/find-storybook-url-problem.js.map +1 -0
- package/dist/config/is-ci.d.ts +7 -0
- package/dist/config/is-ci.d.ts.map +1 -0
- package/dist/config/is-ci.js +10 -0
- package/dist/config/is-ci.js.map +1 -0
- package/dist/config/load-config.d.ts +72 -0
- package/dist/config/load-config.d.ts.map +1 -0
- package/dist/config/load-config.js +95 -0
- package/dist/config/load-config.js.map +1 -0
- package/dist/config/load-storybook-config.d.ts +71 -0
- package/dist/config/load-storybook-config.d.ts.map +1 -0
- package/dist/config/load-storybook-config.js +104 -0
- package/dist/config/load-storybook-config.js.map +1 -0
- package/dist/config/mode-rules.d.ts +42 -0
- package/dist/config/mode-rules.d.ts.map +1 -0
- package/dist/config/mode-rules.js +188 -0
- package/dist/config/mode-rules.js.map +1 -0
- package/dist/config/read-config-afresh.d.ts +13 -0
- package/dist/config/read-config-afresh.d.ts.map +1 -0
- package/dist/config/read-config-afresh.js +28 -0
- package/dist/config/read-config-afresh.js.map +1 -0
- package/dist/config/resolve-config.d.ts +162 -0
- package/dist/config/resolve-config.d.ts.map +1 -0
- package/dist/config/resolve-config.js +181 -0
- package/dist/config/resolve-config.js.map +1 -0
- package/dist/config/story-options.d.ts +73 -0
- package/dist/config/story-options.d.ts.map +1 -0
- package/dist/config/story-options.js +175 -0
- package/dist/config/story-options.js.map +1 -0
- package/dist/config/validate-config.d.ts +9 -0
- package/dist/config/validate-config.d.ts.map +1 -0
- package/dist/config/validate-config.js +185 -0
- package/dist/config/validate-config.js.map +1 -0
- package/dist/container/browser-container.d.ts +57 -0
- package/dist/container/browser-container.d.ts.map +1 -0
- package/dist/container/browser-container.js +112 -0
- package/dist/container/browser-container.js.map +1 -0
- package/dist/container/container-error.d.ts +47 -0
- package/dist/container/container-error.d.ts.map +1 -0
- package/dist/container/container-error.js +43 -0
- package/dist/container/container-error.js.map +1 -0
- package/dist/container/docker-probe.d.ts +37 -0
- package/dist/container/docker-probe.d.ts.map +1 -0
- package/dist/container/docker-probe.js +85 -0
- package/dist/container/docker-probe.js.map +1 -0
- package/dist/container/image-pull.d.ts +11 -0
- package/dist/container/image-pull.d.ts.map +1 -0
- package/dist/container/image-pull.js +40 -0
- package/dist/container/image-pull.js.map +1 -0
- package/dist/container/inside-container.d.ts +8 -0
- package/dist/container/inside-container.d.ts.map +1 -0
- package/dist/container/inside-container.js +11 -0
- package/dist/container/inside-container.js.map +1 -0
- package/dist/container/launch-through-proxy.d.ts +16 -0
- package/dist/container/launch-through-proxy.d.ts.map +1 -0
- package/dist/container/launch-through-proxy.js +51 -0
- package/dist/container/launch-through-proxy.js.map +1 -0
- package/dist/container/own-container.d.ts +12 -0
- package/dist/container/own-container.d.ts.map +1 -0
- package/dist/container/own-container.js +61 -0
- package/dist/container/own-container.js.map +1 -0
- package/dist/container/proxy-reach.d.ts +19 -0
- package/dist/container/proxy-reach.d.ts.map +1 -0
- package/dist/container/proxy-reach.js +101 -0
- package/dist/container/proxy-reach.js.map +1 -0
- package/dist/container/run-docker.d.ts +11 -0
- package/dist/container/run-docker.d.ts.map +1 -0
- package/dist/container/run-docker.js +61 -0
- package/dist/container/run-docker.js.map +1 -0
- package/dist/container/socks-proxy.d.ts +28 -0
- package/dist/container/socks-proxy.d.ts.map +1 -0
- package/dist/container/socks-proxy.js +335 -0
- package/dist/container/socks-proxy.js.map +1 -0
- package/dist/docs-site/docs-url.d.ts +7 -0
- package/dist/docs-site/docs-url.d.ts.map +1 -0
- package/dist/docs-site/docs-url.js +13 -0
- package/dist/docs-site/docs-url.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/init/addon-question.d.ts +99 -0
- package/dist/init/addon-question.d.ts.map +1 -0
- package/dist/init/addon-question.js +111 -0
- package/dist/init/addon-question.js.map +1 -0
- package/dist/init/closing-message.d.ts +182 -0
- package/dist/init/closing-message.d.ts.map +1 -0
- package/dist/init/closing-message.js +189 -0
- package/dist/init/closing-message.js.map +1 -0
- package/dist/init/detect-project.d.ts +111 -0
- package/dist/init/detect-project.d.ts.map +1 -0
- package/dist/init/detect-project.js +166 -0
- package/dist/init/detect-project.js.map +1 -0
- package/dist/init/existing-config.d.ts +68 -0
- package/dist/init/existing-config.d.ts.map +1 -0
- package/dist/init/existing-config.js +149 -0
- package/dist/init/existing-config.js.map +1 -0
- package/dist/init/find-storybooks.d.ts +93 -0
- package/dist/init/find-storybooks.d.ts.map +1 -0
- package/dist/init/find-storybooks.js +165 -0
- package/dist/init/find-storybooks.js.map +1 -0
- package/dist/init/init-checks.d.ts +49 -0
- package/dist/init/init-checks.d.ts.map +1 -0
- package/dist/init/init-checks.js +151 -0
- package/dist/init/init-checks.js.map +1 -0
- package/dist/init/install.d.ts +286 -0
- package/dist/init/install.d.ts.map +1 -0
- package/dist/init/install.js +226 -0
- package/dist/init/install.js.map +1 -0
- package/dist/init/list-of.d.ts +10 -0
- package/dist/init/list-of.d.ts.map +1 -0
- package/dist/init/list-of.js +18 -0
- package/dist/init/list-of.js.map +1 -0
- package/dist/init/package-manager.d.ts +214 -0
- package/dist/init/package-manager.d.ts.map +1 -0
- package/dist/init/package-manager.js +308 -0
- package/dist/init/package-manager.js.map +1 -0
- package/dist/init/package-scripts.d.ts +72 -0
- package/dist/init/package-scripts.d.ts.map +1 -0
- package/dist/init/package-scripts.js +29 -0
- package/dist/init/package-scripts.js.map +1 -0
- package/dist/init/prompter.d.ts +143 -0
- package/dist/init/prompter.d.ts.map +1 -0
- package/dist/init/prompter.js +65 -0
- package/dist/init/prompter.js.map +1 -0
- package/dist/init/questions.d.ts +144 -0
- package/dist/init/questions.d.ts.map +1 -0
- package/dist/init/questions.js +342 -0
- package/dist/init/questions.js.map +1 -0
- package/dist/init/run-command.d.ts +27 -0
- package/dist/init/run-command.d.ts.map +1 -0
- package/dist/init/run-command.js +63 -0
- package/dist/init/run-command.js.map +1 -0
- package/dist/init/run-init.d.ts +133 -0
- package/dist/init/run-init.d.ts.map +1 -0
- package/dist/init/run-init.js +330 -0
- package/dist/init/run-init.js.map +1 -0
- package/dist/init/segment.d.ts +60 -0
- package/dist/init/segment.d.ts.map +1 -0
- package/dist/init/segment.js +54 -0
- package/dist/init/segment.js.map +1 -0
- package/dist/init/setup-files.d.ts +85 -0
- package/dist/init/setup-files.d.ts.map +1 -0
- package/dist/init/setup-files.js +191 -0
- package/dist/init/setup-files.js.map +1 -0
- package/dist/init/setup-progress.d.ts +46 -0
- package/dist/init/setup-progress.d.ts.map +1 -0
- package/dist/init/setup-progress.js +36 -0
- package/dist/init/setup-progress.js.map +1 -0
- package/dist/init/skill-setup.d.ts +55 -0
- package/dist/init/skill-setup.d.ts.map +1 -0
- package/dist/init/skill-setup.js +47 -0
- package/dist/init/skill-setup.js.map +1 -0
- package/dist/init/storybook-scripts.d.ts +47 -0
- package/dist/init/storybook-scripts.d.ts.map +1 -0
- package/dist/init/storybook-scripts.js +114 -0
- package/dist/init/storybook-scripts.js.map +1 -0
- package/dist/init/storybook-start.d.ts +145 -0
- package/dist/init/storybook-start.d.ts.map +1 -0
- package/dist/init/storybook-start.js +109 -0
- package/dist/init/storybook-start.js.map +1 -0
- package/dist/init/unlisted-dependencies.d.ts +75 -0
- package/dist/init/unlisted-dependencies.d.ts.map +1 -0
- package/dist/init/unlisted-dependencies.js +142 -0
- package/dist/init/unlisted-dependencies.js.map +1 -0
- package/dist/init/workspace-packages.d.ts +58 -0
- package/dist/init/workspace-packages.d.ts.map +1 -0
- package/dist/init/workspace-packages.js +86 -0
- package/dist/init/workspace-packages.js.map +1 -0
- package/dist/init/workspace.d.ts +109 -0
- package/dist/init/workspace.d.ts.map +1 -0
- package/dist/init/workspace.js +433 -0
- package/dist/init/workspace.js.map +1 -0
- package/dist/report/display-path.d.ts +7 -0
- package/dist/report/display-path.d.ts.map +1 -0
- package/dist/report/display-path.js +10 -0
- package/dist/report/display-path.js.map +1 -0
- package/dist/report/report-document.d.ts +682 -0
- package/dist/report/report-document.d.ts.map +1 -0
- package/dist/report/report-document.js +90 -0
- package/dist/report/report-document.js.map +1 -0
- package/dist/report/report-folder.d.ts +102 -0
- package/dist/report/report-folder.d.ts.map +1 -0
- package/dist/report/report-folder.js +160 -0
- package/dist/report/report-folder.js.map +1 -0
- package/dist/reporter/counts-line.d.ts +14 -0
- package/dist/reporter/counts-line.d.ts.map +1 -0
- package/dist/reporter/counts-line.js +18 -0
- package/dist/reporter/counts-line.js.map +1 -0
- package/dist/reporter/duration.d.ts +8 -0
- package/dist/reporter/duration.d.ts.map +1 -0
- package/dist/reporter/duration.js +18 -0
- package/dist/reporter/duration.js.map +1 -0
- package/dist/reporter/end-block.d.ts +42 -0
- package/dist/reporter/end-block.d.ts.map +1 -0
- package/dist/reporter/end-block.js +121 -0
- package/dist/reporter/end-block.js.map +1 -0
- package/dist/reporter/log-reporter.d.ts +10 -0
- package/dist/reporter/log-reporter.d.ts.map +1 -0
- package/dist/reporter/log-reporter.js +23 -0
- package/dist/reporter/log-reporter.js.map +1 -0
- package/dist/reporter/reporter-choice.d.ts +27 -0
- package/dist/reporter/reporter-choice.d.ts.map +1 -0
- package/dist/reporter/reporter-choice.js +12 -0
- package/dist/reporter/reporter-choice.js.map +1 -0
- package/dist/reporter/run-event.d.ts +90 -0
- package/dist/reporter/run-event.d.ts.map +1 -0
- package/dist/reporter/run-event.js +2 -0
- package/dist/reporter/run-event.js.map +1 -0
- package/dist/sharding/shard.d.ts +17 -0
- package/dist/sharding/shard.d.ts.map +1 -0
- package/dist/sharding/shard.js +2 -0
- package/dist/sharding/shard.js.map +1 -0
- package/dist/sharding/split-stories-files.d.ts +43 -0
- package/dist/sharding/split-stories-files.d.ts.map +1 -0
- package/dist/sharding/split-stories-files.js +70 -0
- package/dist/sharding/split-stories-files.js.map +1 -0
- package/dist/step-summary/step-summary.d.ts +45 -0
- package/dist/step-summary/step-summary.d.ts.map +1 -0
- package/dist/step-summary/step-summary.js +263 -0
- package/dist/step-summary/step-summary.js.map +1 -0
- package/dist/storybook/options-encoding.d.ts +115 -0
- package/dist/storybook/options-encoding.d.ts.map +1 -0
- package/dist/storybook/options-encoding.js +117 -0
- package/dist/storybook/options-encoding.js.map +1 -0
- package/dist/storybook/options-read.d.ts +146 -0
- package/dist/storybook/options-read.d.ts.map +1 -0
- package/dist/storybook/options-read.js +192 -0
- package/dist/storybook/options-read.js.map +1 -0
- package/dist/storybook/preview-script.d.ts +172 -0
- package/dist/storybook/preview-script.d.ts.map +1 -0
- package/dist/storybook/preview-script.js +804 -0
- package/dist/storybook/preview-script.js.map +1 -0
- package/dist/storybook/read-stories.d.ts +72 -0
- package/dist/storybook/read-stories.d.ts.map +1 -0
- package/dist/storybook/read-stories.js +317 -0
- package/dist/storybook/read-stories.js.map +1 -0
- package/dist/storybook/stories-matchers.d.ts +39 -0
- package/dist/storybook/stories-matchers.d.ts.map +1 -0
- package/dist/storybook/stories-matchers.js +149 -0
- package/dist/storybook/stories-matchers.js.map +1 -0
- package/dist/storybook/storybook-error.d.ts +24 -0
- package/dist/storybook/storybook-error.d.ts.map +1 -0
- package/dist/storybook/storybook-error.js +24 -0
- package/dist/storybook/storybook-error.js.map +1 -0
- package/dist/storybook/storybook-version.d.ts +62 -0
- package/dist/storybook/storybook-version.d.ts.map +1 -0
- package/dist/storybook/storybook-version.js +105 -0
- package/dist/storybook/storybook-version.js.map +1 -0
- package/dist/storybook/test-path.d.ts +19 -0
- package/dist/storybook/test-path.d.ts.map +1 -0
- package/dist/storybook/test-path.js +47 -0
- package/dist/storybook/test-path.js.map +1 -0
- package/dist/storybook/wait-hook.d.ts +64 -0
- package/dist/storybook/wait-hook.d.ts.map +1 -0
- package/dist/storybook/wait-hook.js +50 -0
- package/dist/storybook/wait-hook.js.map +1 -0
- package/dist/system-error/system-reason.d.ts +8 -0
- package/dist/system-error/system-reason.d.ts.map +1 -0
- package/dist/system-error/system-reason.js +15 -0
- package/dist/system-error/system-reason.js.map +1 -0
- package/dist/terminal-ui/answered-line.d.ts +21 -0
- package/dist/terminal-ui/answered-line.d.ts.map +1 -0
- package/dist/terminal-ui/answered-line.js +12 -0
- package/dist/terminal-ui/answered-line.js.map +1 -0
- package/dist/terminal-ui/brand-header.d.ts +21 -0
- package/dist/terminal-ui/brand-header.d.ts.map +1 -0
- package/dist/terminal-ui/brand-header.js +12 -0
- package/dist/terminal-ui/brand-header.js.map +1 -0
- package/dist/terminal-ui/checklist-question.d.ts +26 -0
- package/dist/terminal-ui/checklist-question.d.ts.map +1 -0
- package/dist/terminal-ui/checklist-question.js +62 -0
- package/dist/terminal-ui/checklist-question.js.map +1 -0
- package/dist/terminal-ui/choice-line.d.ts +29 -0
- package/dist/terminal-ui/choice-line.d.ts.map +1 -0
- package/dist/terminal-ui/choice-line.js +13 -0
- package/dist/terminal-ui/choice-line.js.map +1 -0
- package/dist/terminal-ui/coloured-text.d.ts +19 -0
- package/dist/terminal-ui/coloured-text.d.ts.map +1 -0
- package/dist/terminal-ui/coloured-text.js +16 -0
- package/dist/terminal-ui/coloured-text.js.map +1 -0
- package/dist/terminal-ui/confirm-question.d.ts +8 -0
- package/dist/terminal-ui/confirm-question.d.ts.map +1 -0
- package/dist/terminal-ui/confirm-question.js +44 -0
- package/dist/terminal-ui/confirm-question.js.map +1 -0
- package/dist/terminal-ui/init-screen.d.ts +23 -0
- package/dist/terminal-ui/init-screen.d.ts.map +1 -0
- package/dist/terminal-ui/init-screen.js +74 -0
- package/dist/terminal-ui/init-screen.js.map +1 -0
- package/dist/terminal-ui/init-view-state.d.ts +294 -0
- package/dist/terminal-ui/init-view-state.d.ts.map +1 -0
- package/dist/terminal-ui/init-view-state.js +148 -0
- package/dist/terminal-ui/init-view-state.js.map +1 -0
- package/dist/terminal-ui/init-view.d.ts +70 -0
- package/dist/terminal-ui/init-view.d.ts.map +1 -0
- package/dist/terminal-ui/init-view.js +128 -0
- package/dist/terminal-ui/init-view.js.map +1 -0
- package/dist/terminal-ui/live-screen.d.ts +22 -0
- package/dist/terminal-ui/live-screen.d.ts.map +1 -0
- package/dist/terminal-ui/live-screen.js +41 -0
- package/dist/terminal-ui/live-screen.js.map +1 -0
- package/dist/terminal-ui/live-view-state.d.ts +64 -0
- package/dist/terminal-ui/live-view-state.d.ts.map +1 -0
- package/dist/terminal-ui/live-view-state.js +54 -0
- package/dist/terminal-ui/live-view-state.js.map +1 -0
- package/dist/terminal-ui/live-view.d.ts +37 -0
- package/dist/terminal-ui/live-view.d.ts.map +1 -0
- package/dist/terminal-ui/live-view.js +67 -0
- package/dist/terminal-ui/live-view.js.map +1 -0
- package/dist/terminal-ui/message-line.d.ts +31 -0
- package/dist/terminal-ui/message-line.d.ts.map +1 -0
- package/dist/terminal-ui/message-line.js +79 -0
- package/dist/terminal-ui/message-line.js.map +1 -0
- package/dist/terminal-ui/output-tail.d.ts +29 -0
- package/dist/terminal-ui/output-tail.d.ts.map +1 -0
- package/dist/terminal-ui/output-tail.js +52 -0
- package/dist/terminal-ui/output-tail.js.map +1 -0
- package/dist/terminal-ui/progress-bar.d.ts +47 -0
- package/dist/terminal-ui/progress-bar.d.ts.map +1 -0
- package/dist/terminal-ui/progress-bar.js +23 -0
- package/dist/terminal-ui/progress-bar.js.map +1 -0
- package/dist/terminal-ui/question-header.d.ts +23 -0
- package/dist/terminal-ui/question-header.d.ts.map +1 -0
- package/dist/terminal-ui/question-header.js +24 -0
- package/dist/terminal-ui/question-header.js.map +1 -0
- package/dist/terminal-ui/question.d.ts +85 -0
- package/dist/terminal-ui/question.d.ts.map +1 -0
- package/dist/terminal-ui/question.js +77 -0
- package/dist/terminal-ui/question.js.map +1 -0
- package/dist/terminal-ui/select-question.d.ts +19 -0
- package/dist/terminal-ui/select-question.d.ts.map +1 -0
- package/dist/terminal-ui/select-question.js +24 -0
- package/dist/terminal-ui/select-question.js.map +1 -0
- package/dist/terminal-ui/spinner.d.ts +26 -0
- package/dist/terminal-ui/spinner.d.ts.map +1 -0
- package/dist/terminal-ui/spinner.js +39 -0
- package/dist/terminal-ui/spinner.js.map +1 -0
- package/dist/terminal-ui/step-list.d.ts +36 -0
- package/dist/terminal-ui/step-list.d.ts.map +1 -0
- package/dist/terminal-ui/step-list.js +122 -0
- package/dist/terminal-ui/step-list.js.map +1 -0
- package/dist/terminal-ui/summary.d.ts +20 -0
- package/dist/terminal-ui/summary.d.ts.map +1 -0
- package/dist/terminal-ui/summary.js +96 -0
- package/dist/terminal-ui/summary.js.map +1 -0
- package/dist/terminal-ui/text-input.d.ts +65 -0
- package/dist/terminal-ui/text-input.d.ts.map +1 -0
- package/dist/terminal-ui/text-input.js +72 -0
- package/dist/terminal-ui/text-input.js.map +1 -0
- package/dist/terminal-ui/text-question.d.ts +18 -0
- package/dist/terminal-ui/text-question.d.ts.map +1 -0
- package/dist/terminal-ui/text-question.js +60 -0
- package/dist/terminal-ui/text-question.js.map +1 -0
- package/dist/terminal-ui/theme.d.ts +106 -0
- package/dist/terminal-ui/theme.d.ts.map +1 -0
- package/dist/terminal-ui/theme.js +97 -0
- package/dist/terminal-ui/theme.js.map +1 -0
- package/dist/terminal-ui/wrapped-lines.d.ts +15 -0
- package/dist/terminal-ui/wrapped-lines.d.ts.map +1 -0
- package/dist/terminal-ui/wrapped-lines.js +105 -0
- package/dist/terminal-ui/wrapped-lines.js.map +1 -0
- package/dist/terminal-ui/wrapped-segments.d.ts +27 -0
- package/dist/terminal-ui/wrapped-segments.d.ts.map +1 -0
- package/dist/terminal-ui/wrapped-segments.js +37 -0
- package/dist/terminal-ui/wrapped-segments.js.map +1 -0
- package/dist/terminal-ui/wrapped-text.d.ts +21 -0
- package/dist/terminal-ui/wrapped-text.d.ts.map +1 -0
- package/dist/terminal-ui/wrapped-text.js +11 -0
- package/dist/terminal-ui/wrapped-text.js.map +1 -0
- package/dist/visual-diff/diff-thread.d.ts +27 -0
- package/dist/visual-diff/diff-thread.d.ts.map +1 -0
- package/dist/visual-diff/diff-thread.js +233 -0
- package/dist/visual-diff/diff-thread.js.map +1 -0
- package/dist/visual-diff/visual-diff.d.ts +259 -0
- package/dist/visual-diff/visual-diff.d.ts.map +1 -0
- package/dist/visual-diff/visual-diff.js +317 -0
- package/dist/visual-diff/visual-diff.js.map +1 -0
- package/fallow-graph.json +1 -0
- package/package.json +61 -4
- package/skill/SKILL.md +93 -0
- package/skill/scripts/run.mjs +1532 -0
- package/README.md +0 -3
|
@@ -0,0 +1,818 @@
|
|
|
1
|
+
import { pageRootsFunction } from './page-roots.js';
|
|
2
|
+
/**
|
|
3
|
+
* How many rounds of finishing animations the end state runs at most.
|
|
4
|
+
*/
|
|
5
|
+
const maxRounds = 20;
|
|
6
|
+
/**
|
|
7
|
+
* How long each of a frame's two tasks lasts in a page without `requestAnimationFrame`, in ms.
|
|
8
|
+
*/
|
|
9
|
+
const taskFrameMs = 16;
|
|
10
|
+
/**
|
|
11
|
+
* The SMIL animation elements an SVG holds.
|
|
12
|
+
*/
|
|
13
|
+
const smilElements = 'animate, animateMotion, animateTransform, set';
|
|
14
|
+
/**
|
|
15
|
+
* The CSS properties whose images the end state looks through for SVG with SMIL animation.
|
|
16
|
+
*/
|
|
17
|
+
const cssImageProperties = ['background-image', 'border-image-source', 'content', 'list-style-image', 'mask-image'];
|
|
18
|
+
/**
|
|
19
|
+
* The attribute that marks an element whose CSS images, or whose pseudo-elements' ones, the end state froze.
|
|
20
|
+
*/
|
|
21
|
+
const frozenSvgAttribute = 'data-visual-check-frozen-svg';
|
|
22
|
+
/**
|
|
23
|
+
* How long a frozen SVG's animations last, about 31 years, so none moves on while the page is open.
|
|
24
|
+
*/
|
|
25
|
+
const heldDuration = '1000000000s';
|
|
26
|
+
/**
|
|
27
|
+
* Matches a `url("…")` token as a computed value serializes it, giving its escaped URL.
|
|
28
|
+
*/
|
|
29
|
+
const cssUrlPattern = String.raw `/url\("((?:[^"\\]|\\[^])*)"\)/g`;
|
|
30
|
+
/**
|
|
31
|
+
* Matches an escape in a CSS string, giving its hex code point or the character it escapes.
|
|
32
|
+
*/
|
|
33
|
+
const cssEscapePattern = String.raw `/\\(?:([0-9a-fA-F]{1,6}) ?|([^]))/g`;
|
|
34
|
+
/**
|
|
35
|
+
* The source of a function, evaluated in the page as part of the page script, that creates the end state. It takes
|
|
36
|
+
* what the page script kept at document start: `shadowRoots`, the browser's own `setTimer`, `clearTimer`,
|
|
37
|
+
* `requestFrame` (`undefined` in a page without `requestAnimationFrame`) and `fetchResource` (`undefined` in a page
|
|
38
|
+
* without `fetch`), `parkedByStorybook`, the Storybook adapter's predicate for the animations Storybook 11 parked, and
|
|
39
|
+
* `stateGlobal`, the name of the global it keeps its state under in every document. It gives a function that takes a
|
|
40
|
+
* time limit in ms and brings the page to its end state, in the document and in every shadow root: the recorded ones,
|
|
41
|
+
* and every open one found by walking each root's elements. It does so in the document of every reachable frame too,
|
|
42
|
+
* as a same-origin or `srcdoc` one's is, with the closed shadow roots the frame's own page script recorded, its open
|
|
43
|
+
* shadow roots and the frames in it. It walks them all again at every check.
|
|
44
|
+
*
|
|
45
|
+
* When it's created, at document start, it wraps `Animation.prototype.finish`, where the page has it, to note each
|
|
46
|
+
* call that doesn't throw. The browser dispatches the end events of an animation finished by a call only at the next
|
|
47
|
+
* rendering update, and Storybook 11 finishes every CSS animation and transition right before `storyFinished`, and
|
|
48
|
+
* every one that starts later. Pinning such an animation before then would cancel it, so its `animationend` would
|
|
49
|
+
* become `animationcancel`, and page logic waiting for it, such as a chained animation's next step or an exit that
|
|
50
|
+
* unmounts, would never run. A call's end events count as pending until two animation frames passed since the latest
|
|
51
|
+
* call, or two tasks of 16 ms in a page without `requestAnimationFrame`: a call made in an event listener during a
|
|
52
|
+
* rendering update has them in the next update, while a callback asked for during the first update's events still
|
|
53
|
+
* runs in that update. The wrapper passes `this`, the arguments, the result and any error through, so it changes
|
|
54
|
+
* nothing the page sees. The end state's own `finish()` calls go through it too.
|
|
55
|
+
*
|
|
56
|
+
* 1. Settles: calls `finish()` on every running finite animation, lets a frame pass so end events run page logic, and
|
|
57
|
+
* checks again. A check that finds end events pending from a `finish()` call lets a frame pass too. It goes on
|
|
58
|
+
* until two checks a frame apart find neither, for at most 20 rounds, each a check that found either. A story with
|
|
59
|
+
* nothing running and nothing pending waits no frame. An animation whose `finish()` throws isn't tried again.
|
|
60
|
+
* 2. Puts every animation still running on its first keyframe, with `pause()` then `currentTime = 0`, as Storybook 11
|
|
61
|
+
* does: infinite ones, finite ones whose `finish()` threw, and finite ones still starting after 20 rounds. One that
|
|
62
|
+
* paused counts as parked even when it can't be seeked to 0.
|
|
63
|
+
* 3. Pins what Chromium might paint stale: every animation step 2 parked, every one Storybook 11 parked, and every
|
|
64
|
+
* finished one whose fill mode still holds its end. It writes each into the element's inline style with
|
|
65
|
+
* `commitStyles()`, then cancels it. A pseudo-element can't take an inline style, so its animation stays as it is.
|
|
66
|
+
* 4. Freezes media:
|
|
67
|
+
* - It pauses every video and stops it playing on its own, so one still loading doesn't start later. It seeks one
|
|
68
|
+
* that was moving (playing, away from 0 or seeking) and has loaded anything to 0, and when a seek starts, it
|
|
69
|
+
* waits for its `seeked` event, which comes once the frame is decoded. A video without a seekable range, such as
|
|
70
|
+
* a live stream or a MediaStream in `srcObject` (a webcam or call preview), starts no seek, and counts as a
|
|
71
|
+
* change only when it was playing. A paused video at 0 isn't seeked, so it keeps its poster.
|
|
72
|
+
* - It pauses the animations of every outermost inline SVG at 0. Every SVG has a running clock, so only one holding
|
|
73
|
+
* SMIL animation elements counts as a change: SMIL reached only through `<use>` is paused but doesn't count.
|
|
74
|
+
* - It replaces every GIF in an `<img>`, by a `data:image/gif` URL or a URL whose path ends in `.gif`, with its
|
|
75
|
+
* first frame. `drawImage()` draws an animated image's default frame, its first, as the HTML spec says. So it
|
|
76
|
+
* loads a fresh copy, with the image's `crossorigin` and referrer policy, for the GIF's pixel size without any
|
|
77
|
+
* `srcset` density, and draws it on a canvas. The canvas's data URL becomes the image's only `srcset` candidate,
|
|
78
|
+
* at the density that keeps the image's size, the image loses its `src`, and it's decoded. It counts once the
|
|
79
|
+
* image shows the frame. A GIF whose copy fails to load is left as it is, and so is a cross-origin one without
|
|
80
|
+
* CORS, as it taints the canvas. A GIF that isn't animated, such as a logo or a spacer, is replaced too and
|
|
81
|
+
* counts as a change, though it shows the same pixels: there's no cheap way to tell an animated GIF from a still
|
|
82
|
+
* one.
|
|
83
|
+
* - It freezes every SVG with SMIL animation that an element, or its `::before` or `::after`, shows as a CSS
|
|
84
|
+
* image: in `background-image`, `border-image-source`, `content`, `list-style-image` (drawn only by a list item)
|
|
85
|
+
* or `mask-image`, by a `data:image/svg+xml` URL or a URL whose path ends in `.svg`. An SVG image runs a clock no
|
|
86
|
+
* script reaches, so it fetches the SVG with the browser's own `fetch` and rewrites it, each URL once: every
|
|
87
|
+
* `animate`, `animateMotion`, `animateTransform` and `set` element gets `calcMode="discrete"`, `set` aside, a
|
|
88
|
+
* duration of about 31 years and no `end`, `repeatDur` or `max`, so it holds the value it starts with. The
|
|
89
|
+
* rewritten SVG becomes a data URL, with the original's fragment, and once an image of it loaded, it's shown in
|
|
90
|
+
* place of the original, in the computed value it was found in. A pseudo-element takes no inline style, so the
|
|
91
|
+
* element gets a numbered `data-visual-check-frozen-svg` attribute and its root, a document, a frame's included,
|
|
92
|
+
* or a shadow root, adopts a sheet its document's window made, whose rules set the values `!important`, in a
|
|
93
|
+
* layer, so they win over the page's own unlayered `!important` ones. It counts as a change once the sheet is adopted. An SVG without SMIL animation elements,
|
|
94
|
+
* one that doesn't parse, and one whose fetch fails, such as a cross-origin one without CORS, are left as they
|
|
95
|
+
* are. A later end state in the page leaves the SVGs it froze alone. An animation that begins later, such as at
|
|
96
|
+
* `begin="1s"` or at another one's end, shows the page's value until it begins, so the SVG is at time 0 only
|
|
97
|
+
* when every animation begins at 0. CSS animations inside the SVG are left too.
|
|
98
|
+
* 5. When step 4 changed anything, lets a frame pass, so the events freezing media fired, such as a video's `pause`
|
|
99
|
+
* and `seeked` or a replaced GIF's `load`, run page logic: a custom player's controls fading in when its video
|
|
100
|
+
* pauses, say. Then it runs steps 1 to 3 once more, with 20 rounds of its own, the settling going on until two
|
|
101
|
+
* checks a frame apart find nothing running and nothing pending, as page logic reacting to an event can start an
|
|
102
|
+
* animation a frame later, once a framework commits. It doesn't freeze media again. When step 4 changed nothing,
|
|
103
|
+
* this costs nothing.
|
|
104
|
+
* 6. Lets two more frames pass when it changed anything, as a change made just before capture can still be rastering
|
|
105
|
+
* on a busy machine.
|
|
106
|
+
*
|
|
107
|
+
* A frame is two `requestFrame` callbacks, then a task. In a page without `requestFrame`, or when asking for the first
|
|
108
|
+
* callback throws, it's two tasks of 16 ms, and when only asking for the second throws, it's one callback, then two
|
|
109
|
+
* tasks of 16 ms. Only animations on their document's timeline are touched, a frame's own for one in a frame:
|
|
110
|
+
* scroll-driven and view-driven ones, and those with no timeline, are left alone, and so are those the page paused
|
|
111
|
+
* itself, Storybook 11's aside. Only `finish()` calls made in the top document are noted: a frame's own calls aren't,
|
|
112
|
+
* though the end state's calls on a frame's animations still wait two quiet checks a frame apart.
|
|
113
|
+
*
|
|
114
|
+
* Left to the project, through a mask or a `wait` hook: SVG in `<img>`, SVG with SMIL animation behind a URL whose
|
|
115
|
+
* path doesn't end in `.svg`, or as a CSS image of another property or pseudo-element, GIFs as CSS backgrounds or cross-origin
|
|
116
|
+
* without CORS, APNG, animated WebP, canvas, Lottie and other script-driven motion, and a video that hasn't loaded
|
|
117
|
+
* anything. An `<img>` inside `<picture>` keeps showing what its `<source>` picks.
|
|
118
|
+
*
|
|
119
|
+
* It answers `{ outcome: 'settled', changed }`, where `changed` says whether it changed anything that was moving: it
|
|
120
|
+
* finished, parked or pinned an animation, paused a playing video or seeked a moving one, paused an SVG holding SMIL
|
|
121
|
+
* animation elements, replaced a GIF the image then shows, or froze an SVG shown as a CSS image. Waiting for end events pending from a `finish()` call
|
|
122
|
+
* counts too, as page logic ran on them: an exit may unmount, a mount may bring images. When the time limit passes
|
|
123
|
+
* while it settles the animations, or, after media changed, during the frame that lets media events run or the
|
|
124
|
+
* settling after it, it answers `{ outcome: 'timed-out', step: 'animations' }`. While it waits for media, or for the
|
|
125
|
+
* last frames after media changed, it answers `{ outcome: 'timed-out', step: 'media' }`, and during the last frames
|
|
126
|
+
* after only animations changed, `step: 'animations'`. It never throws: every call into the page is guarded.
|
|
127
|
+
*/
|
|
128
|
+
export const endStateFunction = `(context) => {
|
|
129
|
+
const { shadowRoots, setTimer, clearTimer, requestFrame, fetchResource, parkedByStorybook, stateGlobal } = context
|
|
130
|
+
const timedOut = Symbol('timed out')
|
|
131
|
+
|
|
132
|
+
// Noting finish() calls: their end events are pending until two animation frames passed since the latest call.
|
|
133
|
+
|
|
134
|
+
let finishCalls = 0
|
|
135
|
+
let endEventsPending = false
|
|
136
|
+
|
|
137
|
+
const noteFinishCall = () => {
|
|
138
|
+
try {
|
|
139
|
+
const call = finishCalls + 1
|
|
140
|
+
const clearIfLatest = () => {
|
|
141
|
+
if (call === finishCalls) {
|
|
142
|
+
endEventsPending = false
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
const nextStep = (callback) => {
|
|
146
|
+
if (requestFrame === undefined) {
|
|
147
|
+
setTimer(callback, ${taskFrameMs})
|
|
148
|
+
} else {
|
|
149
|
+
requestFrame(callback)
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
// The second step clears at once when it can't be scheduled, so a failure never leaves them pending.
|
|
153
|
+
nextStep(() => {
|
|
154
|
+
try {
|
|
155
|
+
nextStep(clearIfLatest)
|
|
156
|
+
} catch {
|
|
157
|
+
clearIfLatest()
|
|
158
|
+
}
|
|
159
|
+
})
|
|
160
|
+
// Noted only once the clearing is on its way, so a call that can't schedule it never leaves them pending.
|
|
161
|
+
finishCalls = call
|
|
162
|
+
endEventsPending = true
|
|
163
|
+
} catch {}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
try {
|
|
167
|
+
if (typeof Animation === 'function' && typeof Animation.prototype.finish === 'function') {
|
|
168
|
+
const apply = Reflect.apply
|
|
169
|
+
const originalFinish = Animation.prototype.finish
|
|
170
|
+
Animation.prototype.finish = function finish() {
|
|
171
|
+
const result = apply(originalFinish, this, arguments)
|
|
172
|
+
noteFinishCall()
|
|
173
|
+
return result
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
} catch {}
|
|
177
|
+
|
|
178
|
+
// Collecting the animations: every root, then every animation on its document's timeline in them, each once.
|
|
179
|
+
|
|
180
|
+
const { elementsOf, rootsOf, read, isObject, recordedRootsOf } = (${pageRootsFunction})()
|
|
181
|
+
|
|
182
|
+
// Every root, each mapped to its document: the top document's roots, then those of every reachable frame's document,
|
|
183
|
+
// as a same-origin or srcdoc one's is, with the shadow roots the frame's own page script recorded, nested frames too.
|
|
184
|
+
const allRoots = () => {
|
|
185
|
+
const documents = new Map()
|
|
186
|
+
const visit = (rootDocument, recordedRoots) => {
|
|
187
|
+
const roots = rootsOf(rootDocument, recordedRoots)
|
|
188
|
+
for (const root of roots) {
|
|
189
|
+
documents.set(root, rootDocument)
|
|
190
|
+
}
|
|
191
|
+
for (const root of roots) {
|
|
192
|
+
for (const frame of elementsOf(root, 'iframe, frame')) {
|
|
193
|
+
const frameDocument = read(() => frame.contentDocument, null)
|
|
194
|
+
if (isObject(frameDocument) && !documents.has(frameDocument)) {
|
|
195
|
+
visit(frameDocument, recordedRootsOf(frame, stateGlobal))
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
visit(document, shadowRoots)
|
|
201
|
+
return documents
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const animationsIn = (root) => {
|
|
205
|
+
try {
|
|
206
|
+
return Array.from(root.getAnimations())
|
|
207
|
+
} catch {
|
|
208
|
+
return []
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// Whether an animation runs on its document's timeline. A frame's timeline is made by the frame's window, so it's
|
|
213
|
+
// checked against that window's DocumentTimeline, not the top window's.
|
|
214
|
+
const onDocumentTimeline = (animation, rootDocument) => {
|
|
215
|
+
try {
|
|
216
|
+
const timeline = animation.timeline
|
|
217
|
+
const ownClass = read(() => rootDocument.defaultView.DocumentTimeline, undefined)
|
|
218
|
+
const timelineClass = typeof ownClass === 'function' ? ownClass : globalThis.DocumentTimeline
|
|
219
|
+
if (typeof timelineClass === 'function') {
|
|
220
|
+
return timeline instanceof timelineClass
|
|
221
|
+
}
|
|
222
|
+
return isObject(timeline) && timeline === rootDocument.timeline
|
|
223
|
+
} catch {
|
|
224
|
+
return false
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const animationsOf = (roots) => {
|
|
229
|
+
const animations = new Set()
|
|
230
|
+
for (const [root, rootDocument] of roots) {
|
|
231
|
+
for (const animation of animationsIn(root)) {
|
|
232
|
+
if (!animations.has(animation) && onDocumentTimeline(animation, rootDocument)) {
|
|
233
|
+
animations.add(animation)
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return Array.from(animations)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Reading an animation, never throwing.
|
|
241
|
+
|
|
242
|
+
const playStateOf = (animation) => {
|
|
243
|
+
try {
|
|
244
|
+
return animation.playState
|
|
245
|
+
} catch {
|
|
246
|
+
return undefined
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
const isFiniteAnimation = (animation) => {
|
|
251
|
+
try {
|
|
252
|
+
return Number.isFinite(animation.effect.getComputedTiming().endTime)
|
|
253
|
+
} catch {
|
|
254
|
+
return false
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
const holdsItsEnd = (animation) => {
|
|
259
|
+
try {
|
|
260
|
+
return animation.effect.getComputedTiming().progress !== null
|
|
261
|
+
} catch {
|
|
262
|
+
return false
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// The steps after settling.
|
|
267
|
+
|
|
268
|
+
const park = (animations) => {
|
|
269
|
+
const parked = new Set()
|
|
270
|
+
for (const animation of animations) {
|
|
271
|
+
if (playStateOf(animation) !== 'running') {
|
|
272
|
+
continue
|
|
273
|
+
}
|
|
274
|
+
try {
|
|
275
|
+
animation.pause()
|
|
276
|
+
} catch {
|
|
277
|
+
continue
|
|
278
|
+
}
|
|
279
|
+
parked.add(animation)
|
|
280
|
+
try {
|
|
281
|
+
animation.currentTime = 0
|
|
282
|
+
} catch {}
|
|
283
|
+
}
|
|
284
|
+
return parked
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
const pin = (animations, parked) => {
|
|
288
|
+
let pinned = 0
|
|
289
|
+
for (const animation of animations) {
|
|
290
|
+
const finishedHoldingEnd = playStateOf(animation) === 'finished' && holdsItsEnd(animation)
|
|
291
|
+
if (!parked.has(animation) && !parkedByStorybook(animation) && !finishedHoldingEnd) {
|
|
292
|
+
continue
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
animation.commitStyles()
|
|
296
|
+
animation.cancel()
|
|
297
|
+
pinned += 1
|
|
298
|
+
} catch {}
|
|
299
|
+
}
|
|
300
|
+
return pinned
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// Freezing media. Each kind gives, or promises, whether it changed something that was moving, and never throws or
|
|
304
|
+
// rejects.
|
|
305
|
+
|
|
306
|
+
const hasLoadedAnything = (video) => {
|
|
307
|
+
try {
|
|
308
|
+
return video.readyState > 0
|
|
309
|
+
} catch {
|
|
310
|
+
return false
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
// Whether a video is playing, and whether it's moving: playing, away from 0 or seeking.
|
|
315
|
+
const motionOf = (video) => {
|
|
316
|
+
try {
|
|
317
|
+
const playing = !video.paused
|
|
318
|
+
return { playing, moving: playing || video.currentTime !== 0 || video.seeking === true }
|
|
319
|
+
} catch {
|
|
320
|
+
return { playing: false, moving: false }
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
const isSeeking = (video) => {
|
|
325
|
+
try {
|
|
326
|
+
return video.seeking === true
|
|
327
|
+
} catch {
|
|
328
|
+
return false
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// Pauses a video and stops it playing on its own, so one still loading doesn't start later. Seeks one that was
|
|
333
|
+
// moving and has loaded anything to 0, and waits for its seeked event, which comes once the frame is decoded. A
|
|
334
|
+
// paused video at 0 isn't seeked, as that would replace its poster with the frame. Chromium sets seeking at once
|
|
335
|
+
// when a seek starts, and a video without a seekable range, such as a live stream or a MediaStream in srcObject (a
|
|
336
|
+
// webcam or call preview), starts none: it changed only when it was playing.
|
|
337
|
+
const freezeVideo = (video) => {
|
|
338
|
+
const { playing, moving } = motionOf(video)
|
|
339
|
+
try {
|
|
340
|
+
video.pause()
|
|
341
|
+
} catch {
|
|
342
|
+
return false
|
|
343
|
+
}
|
|
344
|
+
try {
|
|
345
|
+
video.autoplay = false
|
|
346
|
+
} catch {}
|
|
347
|
+
if (!moving || !hasLoadedAnything(video)) {
|
|
348
|
+
return playing
|
|
349
|
+
}
|
|
350
|
+
try {
|
|
351
|
+
// Caught now: when the listener can't be added and the seek then throws, nothing else would handle it.
|
|
352
|
+
const seeked = new Promise((resolve) => {
|
|
353
|
+
video.addEventListener('seeked', () => resolve(true), { once: true })
|
|
354
|
+
}).catch(() => true)
|
|
355
|
+
video.currentTime = 0
|
|
356
|
+
return isSeeking(video) ? seeked : playing
|
|
357
|
+
} catch {
|
|
358
|
+
return playing
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
// Pauses the animations of an outermost inline SVG at 0: an SVG nested in another shares the outermost one's. Every
|
|
363
|
+
// SVG has a running clock, so only one holding SMIL animation elements counts as a change.
|
|
364
|
+
const freezeSvg = (svg) => {
|
|
365
|
+
try {
|
|
366
|
+
if (svg.ownerSVGElement !== null || typeof svg.pauseAnimations !== 'function') {
|
|
367
|
+
return false
|
|
368
|
+
}
|
|
369
|
+
svg.pauseAnimations()
|
|
370
|
+
} catch {
|
|
371
|
+
return false
|
|
372
|
+
}
|
|
373
|
+
try {
|
|
374
|
+
svg.setCurrentTime(0)
|
|
375
|
+
} catch {}
|
|
376
|
+
try {
|
|
377
|
+
return svg.querySelector('${smilElements}') !== null
|
|
378
|
+
} catch {
|
|
379
|
+
return false
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// The source of an image showing a GIF: a data:image/gif URL, or a URL whose path ends in .gif.
|
|
384
|
+
const gifSourceOf = (image) => {
|
|
385
|
+
try {
|
|
386
|
+
const source = image.currentSrc || image.src
|
|
387
|
+
if (typeof source !== 'string' || source === '') {
|
|
388
|
+
return undefined
|
|
389
|
+
}
|
|
390
|
+
const url = new URL(source, document.baseURI)
|
|
391
|
+
const isGif =
|
|
392
|
+
url.protocol === 'data:'
|
|
393
|
+
? url.pathname.split(/[;,]/)[0].trim().toLowerCase() === 'image/gif'
|
|
394
|
+
: url.pathname.toLowerCase().endsWith('.gif')
|
|
395
|
+
return isGif ? source : undefined
|
|
396
|
+
} catch {
|
|
397
|
+
return undefined
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
// Draws a loaded image on a canvas at its pixel size, and gives the canvas's data URL with that width. drawImage()
|
|
402
|
+
// draws an animated image's default frame, its first, as the HTML spec says. A cross-origin image without CORS
|
|
403
|
+
// taints the canvas, so toDataURL() throws.
|
|
404
|
+
const drawn = (image) => {
|
|
405
|
+
try {
|
|
406
|
+
const canvas = document.createElement('canvas')
|
|
407
|
+
canvas.width = image.naturalWidth
|
|
408
|
+
canvas.height = image.naturalHeight
|
|
409
|
+
canvas.getContext('2d').drawImage(image, 0, 0)
|
|
410
|
+
return { url: canvas.toDataURL(), width: image.naturalWidth }
|
|
411
|
+
} catch {
|
|
412
|
+
return undefined
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
// Loads a fresh copy of a GIF, with the image's crossorigin and referrer policy, and draws it. The copy has the GIF's
|
|
417
|
+
// pixel size, as no srcset or density applies to it. Gives undefined when it can't.
|
|
418
|
+
const firstFrameOf = (image, source) =>
|
|
419
|
+
new Promise((resolve) => {
|
|
420
|
+
try {
|
|
421
|
+
const copy = document.createElement('img')
|
|
422
|
+
const { crossOrigin, referrerPolicy } = image
|
|
423
|
+
if (typeof crossOrigin === 'string') {
|
|
424
|
+
copy.crossOrigin = crossOrigin
|
|
425
|
+
}
|
|
426
|
+
if (typeof referrerPolicy === 'string') {
|
|
427
|
+
copy.referrerPolicy = referrerPolicy
|
|
428
|
+
}
|
|
429
|
+
copy.addEventListener('load', () => resolve(drawn(copy)), { once: true })
|
|
430
|
+
copy.addEventListener('error', () => resolve(undefined), { once: true })
|
|
431
|
+
copy.src = source
|
|
432
|
+
} catch {
|
|
433
|
+
resolve(undefined)
|
|
434
|
+
}
|
|
435
|
+
})
|
|
436
|
+
|
|
437
|
+
// Replaces a GIF in an image with its first frame, as the only candidate of its srcset, at the density that keeps
|
|
438
|
+
// its size: an image's naturalWidth is in CSS pixels, at the density of the candidate it picked. Counts it only once
|
|
439
|
+
// the image shows the frame: one in a <picture> whose <source> picks what it shows keeps showing the GIF.
|
|
440
|
+
const freezeGif = async (image) => {
|
|
441
|
+
const source = gifSourceOf(image)
|
|
442
|
+
if (source === undefined) {
|
|
443
|
+
return false
|
|
444
|
+
}
|
|
445
|
+
const frame = await firstFrameOf(image, source)
|
|
446
|
+
if (frame === undefined) {
|
|
447
|
+
return false
|
|
448
|
+
}
|
|
449
|
+
try {
|
|
450
|
+
const shownWidth = image.naturalWidth
|
|
451
|
+
const density = shownWidth > 0 ? frame.width / shownWidth : 1
|
|
452
|
+
image.srcset = frame.url + ' ' + density + 'x'
|
|
453
|
+
image.removeAttribute('src')
|
|
454
|
+
} catch {
|
|
455
|
+
return false
|
|
456
|
+
}
|
|
457
|
+
try {
|
|
458
|
+
await image.decode()
|
|
459
|
+
} catch {}
|
|
460
|
+
try {
|
|
461
|
+
return image.currentSrc === frame.url
|
|
462
|
+
} catch {
|
|
463
|
+
return false
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Freezing SVG with SMIL animation used as a CSS image. An SVG image runs its own clock, which no script reaches, so
|
|
468
|
+
// the SVG is rewritten with every animation held on the value it starts with, and shown in place of the original.
|
|
469
|
+
|
|
470
|
+
// The URLs the end state froze SVG into, so a later end state in the page doesn't freeze them again.
|
|
471
|
+
const frozenSvgUrls = new Set()
|
|
472
|
+
// How many elements the end state marked, to number the next one.
|
|
473
|
+
let markedElements = 0
|
|
474
|
+
|
|
475
|
+
// Reads a CSS string, as a computed value serializes it, undoing its escapes.
|
|
476
|
+
const unescapedCss = (text) =>
|
|
477
|
+
text.replace(${cssEscapePattern}, (_escape, hex, character) => {
|
|
478
|
+
if (hex === undefined) {
|
|
479
|
+
return character
|
|
480
|
+
}
|
|
481
|
+
const codePoint = Number.parseInt(hex, 16)
|
|
482
|
+
return codePoint > 0 && codePoint <= 0x10ffff ? String.fromCodePoint(codePoint) : '\\ufffd'
|
|
483
|
+
})
|
|
484
|
+
|
|
485
|
+
// The url("…") tokens of a computed value, each with its URL.
|
|
486
|
+
const urlsIn = (value) => {
|
|
487
|
+
try {
|
|
488
|
+
return Array.from(value.matchAll(${cssUrlPattern}), (match) => ({ token: match[0], url: unescapedCss(match[1]) }))
|
|
489
|
+
} catch {
|
|
490
|
+
return []
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Whether a URL is an SVG's: a data:image/svg+xml URL, or a URL whose path ends in .svg.
|
|
495
|
+
const isSvgUrl = (source) => {
|
|
496
|
+
try {
|
|
497
|
+
const url = new URL(source, document.baseURI)
|
|
498
|
+
return url.protocol === 'data:'
|
|
499
|
+
? url.pathname.split(/[;,]/)[0].trim().toLowerCase() === 'image/svg+xml'
|
|
500
|
+
: url.pathname.toLowerCase().endsWith('.svg')
|
|
501
|
+
} catch {
|
|
502
|
+
return false
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
// Holds a SMIL animation element on the value it starts with: discrete, so it doesn't move towards the next value,
|
|
507
|
+
// over about 31 years, and with no end, repeat duration or maximum that would cut it short.
|
|
508
|
+
const holdAnimation = (animation) => {
|
|
509
|
+
if (animation.localName !== 'set') {
|
|
510
|
+
animation.setAttribute('calcMode', 'discrete')
|
|
511
|
+
}
|
|
512
|
+
animation.setAttribute('dur', '${heldDuration}')
|
|
513
|
+
for (const name of ['end', 'repeatDur', 'max']) {
|
|
514
|
+
animation.removeAttribute(name)
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// Waits until an image of the URL loaded or failed, so the CSS image showing it is drawn at once.
|
|
519
|
+
const loaded = (source) =>
|
|
520
|
+
new Promise((resolve) => {
|
|
521
|
+
try {
|
|
522
|
+
const image = document.createElement('img')
|
|
523
|
+
image.addEventListener('load', () => resolve(), { once: true })
|
|
524
|
+
image.addEventListener('error', () => resolve(), { once: true })
|
|
525
|
+
image.src = source
|
|
526
|
+
} catch {
|
|
527
|
+
resolve()
|
|
528
|
+
}
|
|
529
|
+
})
|
|
530
|
+
|
|
531
|
+
// Fetches an SVG, with the browser's own fetch, and gives a data URL of it with every SMIL animation held, keeping
|
|
532
|
+
// its fragment, once that loaded. Gives undefined when it holds no SMIL animation or can't be fetched or parsed, such
|
|
533
|
+
// as a cross-origin one without CORS.
|
|
534
|
+
const frozenSvgOf = async (source) => {
|
|
535
|
+
try {
|
|
536
|
+
const url = new URL(source, document.baseURI)
|
|
537
|
+
const fragment = url.hash
|
|
538
|
+
url.hash = ''
|
|
539
|
+
const response = await fetchResource(url.href)
|
|
540
|
+
if (!response.ok) {
|
|
541
|
+
return undefined
|
|
542
|
+
}
|
|
543
|
+
const svg = new DOMParser().parseFromString(await response.text(), 'image/svg+xml')
|
|
544
|
+
const animations = Array.from(svg.querySelectorAll('${smilElements}'))
|
|
545
|
+
if (animations.length === 0 || svg.querySelector('parsererror') !== null) {
|
|
546
|
+
return undefined
|
|
547
|
+
}
|
|
548
|
+
animations.forEach(holdAnimation)
|
|
549
|
+
const frozen = 'data:image/svg+xml,' + encodeURIComponent(new XMLSerializer().serializeToString(svg)) + fragment
|
|
550
|
+
frozenSvgUrls.add(frozen)
|
|
551
|
+
await loaded(frozen)
|
|
552
|
+
return frozen
|
|
553
|
+
} catch {
|
|
554
|
+
return undefined
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// The CSS images of an element, or of its pseudo-element, that show an SVG not frozen yet: each property, its
|
|
559
|
+
// computed value and its url("…") tokens of such SVGs. A pseudo-element without content isn't drawn, and the list
|
|
560
|
+
// style image, which is inherited, is drawn only by a list item.
|
|
561
|
+
const svgImagesOf = (element, pseudoElement) => {
|
|
562
|
+
let style
|
|
563
|
+
try {
|
|
564
|
+
style = getComputedStyle(element, pseudoElement)
|
|
565
|
+
} catch {
|
|
566
|
+
return []
|
|
567
|
+
}
|
|
568
|
+
const valueOf = (property) => read(() => style.getPropertyValue(property), '')
|
|
569
|
+
if (pseudoElement !== null && ['', 'none', 'normal'].includes(valueOf('content'))) {
|
|
570
|
+
return []
|
|
571
|
+
}
|
|
572
|
+
return ${JSON.stringify(cssImageProperties)}.flatMap((property) => {
|
|
573
|
+
if (property === 'list-style-image' && !valueOf('display').includes('list-item')) {
|
|
574
|
+
return []
|
|
575
|
+
}
|
|
576
|
+
const value = valueOf(property)
|
|
577
|
+
const urls = urlsIn(value).filter(({ url }) => isSvgUrl(url) && !frozenSvgUrls.has(url))
|
|
578
|
+
return urls.length === 0 ? [] : [{ property, value, urls }]
|
|
579
|
+
})
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// The declaration that shows a CSS image's SVGs frozen, or undefined when none of them could be.
|
|
583
|
+
const frozenDeclarationOf = async ({ property, value, urls }, frozenSvgOnce) => {
|
|
584
|
+
let frozenValue = value
|
|
585
|
+
let frozenAny = false
|
|
586
|
+
for (const { token, url } of urls) {
|
|
587
|
+
const frozen = await frozenSvgOnce(url)
|
|
588
|
+
if (frozen !== undefined) {
|
|
589
|
+
frozenValue = frozenValue.replaceAll(token, () => 'url("' + frozen + '")')
|
|
590
|
+
frozenAny = true
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
return frozenAny ? property + ': ' + frozenValue + ' !important;' : undefined
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
// The selector of an element, marked with a number unless it already is, or of its pseudo-element.
|
|
597
|
+
const selectorOf = (element, pseudoElement) => {
|
|
598
|
+
let mark = read(() => element.getAttribute('${frozenSvgAttribute}'), null)
|
|
599
|
+
if (mark === null) {
|
|
600
|
+
markedElements += 1
|
|
601
|
+
mark = String(markedElements)
|
|
602
|
+
element.setAttribute('${frozenSvgAttribute}', mark)
|
|
603
|
+
}
|
|
604
|
+
return '[${frozenSvgAttribute}="' + mark + '"]' + (pseudoElement ?? '')
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// Shows the SVGs with SMIL animation that a root's elements and their ::before and ::after show as CSS images
|
|
608
|
+
// frozen, through a sheet adopted by the root: a pseudo-element takes no inline style. Its rules are !important in a
|
|
609
|
+
// layer, so they win over the page's own, unlayered !important ones too. The sheet is made by the root's document's
|
|
610
|
+
// window, as a document adopts only sheets its own window made. Gives whether it adopted one.
|
|
611
|
+
const freezeCssSvgsIn = async (root, rootDocument, frozenSvgOnce) => {
|
|
612
|
+
const rules = []
|
|
613
|
+
for (const element of elementsOf(root, '*')) {
|
|
614
|
+
for (const pseudoElement of [null, '::before', '::after']) {
|
|
615
|
+
const images = svgImagesOf(element, pseudoElement)
|
|
616
|
+
if (images.length > 0) {
|
|
617
|
+
rules.push({ element, pseudoElement, declarations: images.map((image) => frozenDeclarationOf(image, frozenSvgOnce)) })
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
const cssRules = []
|
|
622
|
+
for (const { element, pseudoElement, declarations } of rules) {
|
|
623
|
+
const frozen = (await Promise.all(declarations)).filter((declaration) => declaration !== undefined)
|
|
624
|
+
if (frozen.length > 0) {
|
|
625
|
+
try {
|
|
626
|
+
cssRules.push(selectorOf(element, pseudoElement) + ' { ' + frozen.join(' ') + ' }')
|
|
627
|
+
} catch {}
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
if (cssRules.length === 0) {
|
|
631
|
+
return false
|
|
632
|
+
}
|
|
633
|
+
try {
|
|
634
|
+
const ownClass = read(() => rootDocument.defaultView.CSSStyleSheet, undefined)
|
|
635
|
+
const sheet = new (typeof ownClass === 'function' ? ownClass : CSSStyleSheet)()
|
|
636
|
+
sheet.replaceSync('@layer { ' + cssRules.join(' ') + ' }')
|
|
637
|
+
root.adoptedStyleSheets = [...root.adoptedStyleSheets, sheet]
|
|
638
|
+
return true
|
|
639
|
+
} catch {
|
|
640
|
+
return false
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// Freezes the SVGs with SMIL animation shown as CSS images in every root, fetching and rewriting each SVG once.
|
|
645
|
+
const freezeCssSvgs = async (roots) => {
|
|
646
|
+
if (typeof fetchResource !== 'function') {
|
|
647
|
+
return false
|
|
648
|
+
}
|
|
649
|
+
const frozenSvgs = new Map()
|
|
650
|
+
const frozenSvgOnce = (url) => {
|
|
651
|
+
if (!frozenSvgs.has(url)) {
|
|
652
|
+
frozenSvgs.set(url, frozenSvgOf(url))
|
|
653
|
+
}
|
|
654
|
+
return frozenSvgs.get(url)
|
|
655
|
+
}
|
|
656
|
+
try {
|
|
657
|
+
const adopted = await Promise.all(
|
|
658
|
+
Array.from(roots, ([root, rootDocument]) => freezeCssSvgsIn(root, rootDocument, frozenSvgOnce)),
|
|
659
|
+
)
|
|
660
|
+
return adopted.includes(true)
|
|
661
|
+
} catch {
|
|
662
|
+
return false
|
|
663
|
+
}
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
// Freezes every video, inline SVG, GIF in an image and SVG with SMIL animation as a CSS image in the roots.
|
|
667
|
+
const freezeMedia = (roots) => {
|
|
668
|
+
const elements = (selector) => Array.from(roots.keys()).flatMap((root) => elementsOf(root, selector))
|
|
669
|
+
return [
|
|
670
|
+
...elements('video').map(freezeVideo),
|
|
671
|
+
...elements('svg').map(freezeSvg),
|
|
672
|
+
...elements('img').map(freezeGif),
|
|
673
|
+
freezeCssSvgs(roots),
|
|
674
|
+
]
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// A frame: two animation frames, then a task. Without requestFrame, or from the point where asking for an animation
|
|
678
|
+
// frame throws, it goes on with two tasks of 16 ms instead. A task that can't be scheduled ends the frame at once, so
|
|
679
|
+
// a frame never throws, in its callbacks either, and never stays pending.
|
|
680
|
+
|
|
681
|
+
const frame = () =>
|
|
682
|
+
new Promise((resolve) => {
|
|
683
|
+
const task = (callback, ms) => {
|
|
684
|
+
try {
|
|
685
|
+
setTimer(callback, ms)
|
|
686
|
+
} catch {
|
|
687
|
+
resolve()
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
const tasks = () => task(() => task(resolve, ${taskFrameMs}), ${taskFrameMs})
|
|
691
|
+
const animationFrame = (callback) => {
|
|
692
|
+
if (requestFrame === undefined) {
|
|
693
|
+
tasks()
|
|
694
|
+
return
|
|
695
|
+
}
|
|
696
|
+
try {
|
|
697
|
+
requestFrame(callback)
|
|
698
|
+
} catch {
|
|
699
|
+
tasks()
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
animationFrame(() => animationFrame(() => task(resolve, 0)))
|
|
703
|
+
})
|
|
704
|
+
|
|
705
|
+
return async (timeoutMs) => {
|
|
706
|
+
let timer
|
|
707
|
+
const deadline = new Promise((resolve) => {
|
|
708
|
+
timer = setTimer(() => resolve(timedOut), timeoutMs)
|
|
709
|
+
})
|
|
710
|
+
const framesPassed = async (count) => {
|
|
711
|
+
for (let passed = 0; passed < count; passed += 1) {
|
|
712
|
+
if ((await Promise.race([frame(), deadline])) === timedOut) {
|
|
713
|
+
return false
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
return true
|
|
717
|
+
}
|
|
718
|
+
// Animations whose finish() threw, such as one with a playback rate of 0, aren't finished again: they're put on
|
|
719
|
+
// their first keyframe with the infinite ones.
|
|
720
|
+
const unfinishable = new Set()
|
|
721
|
+
// Settles the animations, then puts those still running on their first keyframe and pins them. Gives whether it
|
|
722
|
+
// changed anything and the roots its last check walked, or timedOut. After media changed, it stops only at two quiet
|
|
723
|
+
// checks a frame apart, even when nothing ran before, as page logic reacting to a media event can start an
|
|
724
|
+
// animation a frame later.
|
|
725
|
+
const endAnimations = async ({ afterMedia }) => {
|
|
726
|
+
let changed = false
|
|
727
|
+
let rounds = 0
|
|
728
|
+
let quietChecks = 0
|
|
729
|
+
let roots
|
|
730
|
+
for (;;) {
|
|
731
|
+
roots = allRoots()
|
|
732
|
+
const running = animationsOf(roots).filter(
|
|
733
|
+
(animation) =>
|
|
734
|
+
!unfinishable.has(animation) && playStateOf(animation) === 'running' && isFiniteAnimation(animation),
|
|
735
|
+
)
|
|
736
|
+
if (running.length === 0 && !endEventsPending) {
|
|
737
|
+
quietChecks += 1
|
|
738
|
+
// Nothing finished and no end events waited for: no page logic ran that could start another animation, unless
|
|
739
|
+
// an event did, as after media changed.
|
|
740
|
+
if (quietChecks === 2 || (!changed && !afterMedia)) {
|
|
741
|
+
break
|
|
742
|
+
}
|
|
743
|
+
} else {
|
|
744
|
+
quietChecks = 0
|
|
745
|
+
if (rounds === ${maxRounds}) {
|
|
746
|
+
break
|
|
747
|
+
}
|
|
748
|
+
// Waiting for end events counts as a change, as page logic runs on them.
|
|
749
|
+
if (endEventsPending) {
|
|
750
|
+
changed = true
|
|
751
|
+
}
|
|
752
|
+
for (const animation of running) {
|
|
753
|
+
try {
|
|
754
|
+
animation.finish()
|
|
755
|
+
changed = true
|
|
756
|
+
} catch {
|
|
757
|
+
unfinishable.add(animation)
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
rounds += 1
|
|
761
|
+
}
|
|
762
|
+
if (!(await framesPassed(1))) {
|
|
763
|
+
return timedOut
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
// The last check walked the roots with no frame since. Parking and pinning add no element. Page logic can run on
|
|
767
|
+
// the finished and ready promises a cancel() rejects before media are frozen, but freezing queries the elements of
|
|
768
|
+
// each root afresh. So they share its roots rather than walk every element again.
|
|
769
|
+
const parked = park(animationsOf(roots))
|
|
770
|
+
const pinned = pin(animationsOf(roots), parked)
|
|
771
|
+
return { changed: changed || parked.size > 0 || pinned > 0, roots }
|
|
772
|
+
}
|
|
773
|
+
try {
|
|
774
|
+
const ended = await endAnimations({ afterMedia: false })
|
|
775
|
+
if (ended === timedOut) {
|
|
776
|
+
return { outcome: 'timed-out', step: 'animations' }
|
|
777
|
+
}
|
|
778
|
+
const frozen = await Promise.race([Promise.all(freezeMedia(ended.roots)), deadline])
|
|
779
|
+
if (frozen === timedOut) {
|
|
780
|
+
return { outcome: 'timed-out', step: 'media' }
|
|
781
|
+
}
|
|
782
|
+
const mediaChanged = frozen.includes(true)
|
|
783
|
+
// Freezing media fires events, such as a video's pause and seeked or a replaced GIF's load, whose page logic can
|
|
784
|
+
// start animations. A frame lets it run, then the animations are brought to their end once more, only once. What
|
|
785
|
+
// that changes adds nothing to changed, which media already made true.
|
|
786
|
+
if (mediaChanged) {
|
|
787
|
+
const endedAgain = (await framesPassed(1)) && (await endAnimations({ afterMedia: true })) !== timedOut
|
|
788
|
+
if (!endedAgain) {
|
|
789
|
+
return { outcome: 'timed-out', step: 'animations' }
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
const changed = ended.changed || mediaChanged
|
|
793
|
+
if (changed && !(await framesPassed(2))) {
|
|
794
|
+
return { outcome: 'timed-out', step: mediaChanged ? 'media' : 'animations' }
|
|
795
|
+
}
|
|
796
|
+
return { outcome: 'settled', changed }
|
|
797
|
+
} finally {
|
|
798
|
+
clearTimer(timer)
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
}`;
|
|
802
|
+
/**
|
|
803
|
+
* Reads the value the end state expression gave. Throws, quoting the value, when it's not an answer the page gives.
|
|
804
|
+
*/
|
|
805
|
+
export function readEndState(value) {
|
|
806
|
+
const answer = typeof value === 'object' && value !== null ? { ...value } : {};
|
|
807
|
+
if (answer.outcome === 'settled' && typeof answer.changed === 'boolean') {
|
|
808
|
+
return { outcome: 'settled', changed: answer.changed };
|
|
809
|
+
}
|
|
810
|
+
if (answer.outcome === 'timed-out' && (answer.step === 'animations' || answer.step === 'media')) {
|
|
811
|
+
return { outcome: 'timed-out', step: answer.step };
|
|
812
|
+
}
|
|
813
|
+
if (answer.outcome === 'script-missing') {
|
|
814
|
+
return { outcome: 'script-missing' };
|
|
815
|
+
}
|
|
816
|
+
throw new Error(`The end state in the page gave an answer visual-check doesn't know: ${JSON.stringify(value)}.`);
|
|
817
|
+
}
|
|
818
|
+
//# sourceMappingURL=end-state.js.map
|