Repository navigation
improved selector page #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| <script setup lang="ts"> | ||
| /** | ||
| * An image with a caption. | ||
| * | ||
| * ::doc-figure{src="/images/selectors.png" alt="How a selector resolves to an element"} | ||
| * The path a selector takes from string to element. | ||
| * :: | ||
| * | ||
| * Named doc-figure, not figure: `figure` is a native HTML element, so MDC | ||
| * would render `::figure` as the built-in tag and never reach this component. | ||
| * The doc-note / doc-table components dodge the same collision the same way. | ||
| * | ||
| * `alt` is the screen-reader text and is required — it describes the image for | ||
| * someone who cannot see it. The body is the visible caption below the image | ||
| * and may hold Markdown (links, `code`, emphasis), so it is a slot rather than | ||
| * a prop. A figure with no body renders the image alone, still with its alt. | ||
| */ | ||
| const props = defineProps<{ | ||
| /** Root-absolute path to a file in public/, e.g. /images/foo.png. */ | ||
| src: string | ||
| /** Screen-reader description. Required; keep it a real description. */ | ||
| alt: string | ||
| }>() | ||
| </script> | ||
|
|
||
| <template> | ||
| <figure class="figure"> | ||
| <img class="figure-img" :src="props.src" :alt="props.alt" loading="lazy" decoding="async" /> | ||
| <figcaption class="figure-caption"><slot /></figcaption> | ||
| </figure> | ||
| </template> | ||
|
|
||
| <style scoped> | ||
| /* | ||
| * fit-content shrinks the figure to the image's natural width, so the caption | ||
| * box is exactly as wide as the image and `text-align: center` centres the | ||
| * caption under the image rather than across the page. max-width keeps a wide | ||
| * image from overflowing a narrow column. | ||
| */ | ||
| .figure { | ||
| width: fit-content; | ||
| max-width: 100%; | ||
| margin: var(--sp-6) 0; | ||
| } | ||
|
|
||
| /* display:block + max-width:100% renders at natural size, never upscaled, and | ||
| * only shrinks when the column is narrower than the image. */ | ||
| .figure-img { | ||
| display: block; | ||
| max-width: 100%; | ||
| height: auto; | ||
| } | ||
|
|
||
| /* An empty caption (image-only usage) leaves no stray gap. */ | ||
| .figure-caption:empty { | ||
| display: none; | ||
| } | ||
|
|
||
| .figure-caption { | ||
| margin-top: var(--sp-2); | ||
| font-size: var(--step--1); | ||
| color: var(--faint); | ||
| text-align: center; | ||
| } | ||
|
|
||
| .figure-caption :deep(p) { | ||
| margin: 0; | ||
| } | ||
| </style> |
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| allowBuilds: | ||
| better-sqlite3: true | ||
| esbuild: true | ||
| sharp: true | ||
|
Snooz82 marked this conversation as resolved.
|
||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.