Repository navigation
feat(docs): Record example heights in the screenshot index and catalog - #123
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 851f4e0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@layerstack/docs
@layerstack/svelte-actions
@layerstack/svelte-state
@layerstack/svelte-stores
@layerstack/svelte-table
@layerstack/tailwind
@layerstack/utils
commit: |
Contributor
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Records each example's rendered height so a docs page can hold the example's space before it renders. LayerChart wants this for its WebGL layer toggle: an example renders nothing while its WebGL version loads, so without a known height the page jumps when it arrives.
Changes
generate-screenshots: measures the.exampleelement's height after the page is ready (before.screenshot-hiddencontrols are hidden, as they take up space on the page) and writes it asheighton each entry in<screenshots-dir>/index.json.--allor touching the screenshots.generate-catalog --screenshots <dir>: reads heights from that screenshot index into each catalog example'sheight. Without the flag, heights are carried over from the existing catalog, the way example dates already are.ExampleInfo.height?: number, plus a note and the flag in the CLI guide.Heights are measured at the screenshot viewport (800px), so they're exact for content of a fixed height (ex. a chart with
height={300}) and close for content that scales with width.Testing
Ran both generators from the built package against LayerChart's docs dev server, on a scratch copy of its screenshot index:
index.jsongot all 5 heights.writeExampleCatalogs({ screenshotsDir })copied the heights into the catalog; examples without one have noheight.svelte-check: 0 errors (1 existing warning inStep.svelte). Prettier is clean.🤖 Generated with Claude Code