From 07ca5a45aed2e16399699938fb0bc98cee30837e Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Mon, 18 Sep 2023 15:16:08 -0400 Subject: [PATCH] initial --- docs/_includes/default.njk | 2 +- docs/assets/styles/docs.css | 183 +----------- docs/pages/experimental/style-guide.md | 162 ++++++++++- src/themes/applied.css | 374 ++++++++++++++++++++++--- src/themes/default.css | 3 +- 5 files changed, 500 insertions(+), 224 deletions(-) diff --git a/docs/_includes/default.njk b/docs/_includes/default.njk index d3bdf4f75..666381b97 100644 --- a/docs/_includes/default.njk +++ b/docs/_includes/default.njk @@ -51,7 +51,7 @@ - + Skip to main content diff --git a/docs/assets/styles/docs.css b/docs/assets/styles/docs.css index bcc1872f0..3a744bda5 100644 --- a/docs/assets/styles/docs.css +++ b/docs/assets/styles/docs.css @@ -28,18 +28,6 @@ html:not(.wa-theme-dark) .only-dark { display: none !important; } -.visually-hidden:not(:focus-within) { - position: absolute !important; - width: 1px !important; - height: 1px !important; - clip: rect(0 0 0 0) !important; - clip-path: inset(50%) !important; - border: none !important; - overflow: hidden !important; - white-space: nowrap !important; - padding: 0 !important; -} - .nowrap { white-space: nowrap; } @@ -50,24 +38,6 @@ html:not(.wa-theme-dark) .only-dark { } } -/* Bare styles */ -*, -*:before, -*:after { - box-sizing: inherit; -} - -/* Show custom elements only after they're registered */ -:not(:defined), -:not(:defined) * { - opacity: 0; -} - -:defined { - opacity: 1; - transition: 0.1s opacity; -} - html { height: 100%; box-sizing: border-box; @@ -99,86 +69,16 @@ h1:first-of-type { margin-top: 1rem; } -h2 { - font-size: 1.875rem; - border-bottom: var(--wa-border-style) var(--wa-border-width-thin) var(--wa-color-surface-outline); -} - -p { - margin-block-end: 1.5em; -} - .badges img { border-radius: var(--wa-corners-1x); } -.callout img, -details img { +.callout img { width: 100%; margin-left: 0; margin-right: 0; } -details pre { - border: solid var(--wa-border-width-thin) var(--wa-color-surface-outline); -} - -code { - background-color: rgba(0 0 0 / 0.025); - background-blend-mode: darken; - padding: 0.125em 0.25em; -} - -/* Block quotes */ -blockquote { - position: relative; - font-family: var(--wa-font-family-longform); - font-size: var(--wa-font-size-l); - font-style: italic; - color: var(--wa-color-text-normal); - background-color: var(--wa-color-surface-lowered); - border-radius: var(--wa-corners-1x); - border-left: solid var(--wa-border-width-thin) var(--wa-color-surface-outline); - padding: var(--wa-space-xl); - margin: 0 0 var(--wa-space-xl) 0; -} - -blockquote > :first-child { - margin-top: 0; -} - -blockquote > :last-child { - margin-bottom: 0; -} - -/* Lists */ -ul, -ol { - padding: 0; - margin: 0 0 var(--docs-content-vertical-spacing) var(--wa-space-2xl); -} - -ul { - list-style: disc; -} - -li { - padding: 0; - margin: 0 0 var(--wa-space-2xs) 0; -} - -li ul, -li ol { - margin-top: var(--wa-space-2xs); -} - -ul ul:last-child, -ul ol:last-child, -ol ul:last-child, -ol ol:last-child { - margin-bottom: 0; -} - /* Color matching logos */ svg.wordmark { color: var(--wa-color-brand-text-on-surface); @@ -219,29 +119,6 @@ svg.wordmark { } /* Tables */ -table { - max-width: 100%; - border: none; - border-collapse: collapse; - color: inherit; - margin-bottom: var(--docs-content-vertical-spacing); -} - -table tr { - border-bottom: solid var(--wa-border-width-thin) var(--wa-color-surface-outline); -} - -table th { - font-weight: var(--wa-font-weight-medium); - text-align: left; -} - -table td, -table th { - line-height: var(--wa-font-line-height-regular); - padding: 1rem 1rem; -} - table th p:first-child, table td p:first-child { margin-top: 0; @@ -272,15 +149,6 @@ th.table-description { } /* Code blocks */ -pre { - position: relative; - background-color: var(--wa-color-surface-lowered); - font-family: var(--wa-font-family-code); - color: var(--wa-color-text-normal); - border-radius: var(--wa-corners-1x); - padding: 1rem; - white-space: pre; -} pre:not(:last-child) { margin-bottom: 1.5rem; @@ -447,49 +315,6 @@ pre:hover .copy-code-button, } } -/* Details */ -.content details { - background-color: var(--wa-color-surface-lowered); - border-radius: var(--wa-corners-1x); - padding: var(--wa-space-m); - margin: 0 0 var(--docs-content-vertical-spacing) 0; -} - -.content details summary { - font-weight: var(--wa-font-weight-medium); - border-radius: var(--wa-corners-1x); - padding: var(--wa-space-m); - margin: calc(-1 * var(--wa-space-m)); - cursor: pointer; - user-select: none; -} - -.content details summary span { - padding-left: var(--wa-space-xs); -} - -.content details[open] summary { - border-bottom-left-radius: 0; - border-bottom-right-radius: 0; - margin-bottom: 1rem; -} - -.content details[open] summary:focus-visible { - border-radius: var(--wa-corners-1x); -} - -.content details > :last-child { - margin-bottom: 0; -} - -.content details > :nth-child(2) { - margin-top: 0; -} - -.content details + details { - margin-top: calc(-1 * var(--docs-content-vertical-spacing) + (2 * var(--wa-border-width-thin))); -} - /* Sidebar */ #sidebar { position: fixed; @@ -1109,3 +934,9 @@ body[data-page^='/tokens/'] .table-wrapper td:first-child code { grid-column-start: span 6; } } + +.docs-grid { + display: grid; + grid-template-columns: 1fr 1fr 1fr; + gap: 2rem; +} diff --git a/docs/pages/experimental/style-guide.md b/docs/pages/experimental/style-guide.md index 28aba3c7c..004454e5b 100644 --- a/docs/pages/experimental/style-guide.md +++ b/docs/pages/experimental/style-guide.md @@ -6,14 +6,166 @@ meta: # Style Guide +The styles shown below can be all yours by adding Web Awesome's applied stylesheet to your project. + +--- + +## Typography + +Vel risus commodo viverra maecenas accumsan lacus vel facilisis volutpat. Amet mauris commodo quis imperdiet. Bibendum ut tristique et egestas quis ipsum suspendisse. Sit amet nulla facilisi morbi tempus iaculis urna id volutpat. + +Cras pulvinar mattis nunc sed blandit libero. Facilisis magna etiam tempor orci. Scelerisque eleifend donec pretium vulputate sapien nec. Donec et odio pellentesque diam volutpat commodo sed egestas egestas. Mauris rhoncus aenean vel elit scelerisque mauris pellentesque. + +> What is a Web year now, about three months? And when people can browse around, discover new things, and download them fast, when we all have agents - then Web years could slip by before human beings can notice. +> +> — Tim Berners-Lee + +## Inline Text + +
+

Bold

+

Italics

+

Underline

+

Deleted

+

Inserted

+

Strike-through

+

Small

+

Text Sub

+

Text Sup

+

Abbr.

+

Keyboard

+

Highlighted

+

Link text

+

Inline code

+
+ +## Lists + +- List item 1 +- List item 2 +- List item 3 + - Subitem a + - Subitem b + +1. List item 1 +2. List item 2 +3. List item 3 + - Subitem a + - Subitem b + ## Headings -# Heading 1 - -## Heading 2 - ### Heading 3 +Feugiat nisl pretium fusce id. Ipsum dolor sit amet consectetur adipiscing elit. Eget nunc lobortis mattis aliquam faucibus purus. Metus dictum at tempor commodo ullamcorper a lacus vestibulum. Urna condimentum mattis pellentesque id nibh tortor id. + #### Heading 4 -Lorem ipsum dolor sit amet, [consectetur adipiscing elit](#), sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. +Gravida arcu ac tortor dignissim convallis aenean. Pellentesque pulvinar pellentesque habitant morbi tristique senectus et. Ipsum nunc aliquet bibendum enim facilisis gravida neque. Donec adipiscing tristique risus nec feugiat in. + +##### Heading 5 + +Enim diam vulputate ut pharetra sit. Enim facilisis gravida neque convallis a cras. Enim neque volutpat ac tincidunt vitae semper. Sed egestas egestas fringilla phasellus faucibus scelerisque eleifend donec pretium. + +###### Heading 6 + +Tincidunt ornare massa eget egestas purus viverra accumsan in nisl. Facilisis mauris sit amet massa vitae. Nunc faucibus a pellentesque sit amet porttitor. Adipiscing tristique risus nec feugiat in fermentum. + +## Details + +Individual details look like this. + +
+ Tincidunt nunc pulvinar +

Ut lectus arcu bibendum at varius. Convallis a cras semper auctor neque vitae. Odio pellentesque diam volutpat commodo sed egestas. Amet dictum sit amet justo donec enim diam vulputate ut.

+
+ +Grouping them provides accordion-style functionality. + +
+ Enim diam +

Nunc faucibus a pellentesque sit amet porttitor. Adipiscing tristique risus nec feugiat in fermentum. Leo duis ut diam quam nulla porttitor massa id. Mauris nunc congue nisi vitae.

+
+ +
+ Arcu non odio +

Sed libero enim sed faucibus turpis in eu mi bibendum. Nunc mi ipsum faucibus vitae aliquet nec. Ultricies tristique nulla aliquet enim tortor. Tellus at urna condimentum mattis pellentesque.

+
+ +
+ Ut porttitor +

Eu facilisis sed odio morbi quis commodo odio aenean sed. Sit amet purus gravida quis blandit turpis cursus. Eu consequat ac felis donec et odio pellentesque diam volutpat.

+
+ +## Code Blocks + +``` +// do a thing +export function thing() { + return true; +} +``` + +## Images + +![cat](https://placekitten.com/1200/800) + +## Tables + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
I'm just a table
Column 1Column 2Column 3Column 4
CellCellCellCell
CellCellCellCell
CellCellCellCell
CellCellCellCell
+ +## Definition Lists + +
+
Definition 1
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+
Definition 2
+
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
+
Definition 3
+
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo.
+
+ +## Forms + +
+ Fieldset +
+
+ +
diff --git a/src/themes/applied.css b/src/themes/applied.css index df782daf6..16a9a827c 100644 --- a/src/themes/applied.css +++ b/src/themes/applied.css @@ -4,34 +4,76 @@ */ html { box-sizing: border-box; - font-family: var(--wa-font-family-body); - font-size: var(--wa-font-size-root); - font-weight: var(--wa-font-weight-normal); - line-height: var(--wa-font-line-height-regular); - color: var(--wa-color-text-normal); background-color: var(--wa-color-surface-default); - -moz-osx-font-smoothing: grayscale; - -webkit-font-smoothing: antialiased; padding: 0; margin: 0; } -body { - padding: ; -} - *, -*:before, -*:after { +*::before, +*::after { box-sizing: inherit; } +body { + min-height: 100vh; + font-family: var(--wa-font-family-body); + font-size: var(--wa-font-size-root); + font-weight: var(--wa-font-weight-normal); + line-height: var(--wa-font-line-height-regular); + text-size-adjust: none; + color: var(--wa-color-text-normal); + padding: var(--wa-space-m); + margin: 0; + -moz-osx-font-smoothing: grayscale; + -webkit-font-smoothing: antialiased; + -moz-text-size-adjust: none; + -webkit-text-size-adjust: none; +} + +/* Text selection */ ::selection { background-color: var(--wa-color-selection-background); color: var(--wa-color-selection-text); } -/* Headings & Typography */ +/* Show custom elements only after they're registered */ +:not(:defined), +:not(:defined) * { + opacity: 0; +} + +:defined { + opacity: 1; + transition: 0.1s opacity; +} + +/* Content flow */ +address, +audio, +blockquote, +dd, +details, +dl, +fieldset, +figure, +h1, +h2, +h3, +h4, +h5, +h6, +iframe, +ol, +p, +pre, +table, +ul, +video { + margin: 0 0 var(--wa-flow-spacing) 0; +} + +/* Headings & text */ h1, h2, h3, @@ -40,6 +82,8 @@ h5, h6 { font-family: var(--wa-font-family-heading); font-weight: var(--wa-font-weight-medium); + line-height: var(--wa-font-line-height-compact); + text-wrap: balance; } h1 { @@ -66,6 +110,12 @@ h6 { font-size: var(--wa-font-size-xs); } +hr { + border: none; + border-bottom: solid var(--wa-border-width-thin) var(--wa-color-surface-outline); + margin: var(--wa-flow-spacing) 0; +} + em, i { font-style: italic; @@ -76,15 +126,24 @@ b { font-weight: var(--wa-font-weight-heavy); } +s { + text-decoration: line-through; +} + +del, +ins, +mark { + padding: 0.125em 0.25em; +} + ins { background-color: var(--wa-color-success-fill-muted); color: var(--wa-color-success-text-on-muted); border-radius: var(--wa-corners-1x); text-decoration: none; - padding: 0.125em 0.25em; } -s { +del { background-color: var(--wa-color-danger-fill-muted); color: var(--wa-color-danger-text-on-muted); border-radius: var(--wa-corners-1x); @@ -99,22 +158,237 @@ mark { padding: 0.125em 0.25em; } -/* Code */ +small { + font-size: 0.875em; /* relative */ +} + +sub, +sup { + position: relative; + font-size: 0.875em; /* relative */ + line-height: 0; + vertical-align: baseline; +} + +sub { + bottom: -0.25em; +} + +sup { + top: -0.5em; +} + +abbr[title] { + text-decoration: none; + border-bottom: dashed 1px currentColor; + cursor: help; +} + +kbd { + background: var(--wa-color-neutral-fill-muted); + border: solid 1px var(--wa-color-neutral-outline-muted); + box-shadow: inset 0 1px 0 1px var(--wa-color-tint-white), 0 1px 0 0 var(--wa-color-tint-black); + font-family: var(--wa-font-family-code); + border-radius: var(--wa-corners-1x); + color: var(--wa-color-neutral-text-on-muted); + padding: 0.125em 0.4em; +} + +/* Code and similar */ code, pre, kbd, -samp { +samp, +var { font-family: var(--wa-font-family-code); - font-size: 0.9125em; + font-size: 0.975em; + background-color: var(--wa-color-surface-lowered); border-radius: var(--wa-corners-1x); + padding-block: var(--wa-space-3xs); + padding-inline: var(--wa-space-2xs); } -/* Images */ -img { +pre { + color: var(--wa-color-text-normal); + background-color: var(--wa-color-surface-lowered); + border-radius: var(--wa-corners-1x); + padding: var(--wa-space-m); + white-space: pre; +} + +/* Block quotes */ +blockquote { + position: relative; + font-family: var(--wa-font-family-longform); + font-size: var(--wa-font-size-l); + font-style: italic; + background-color: var(--wa-color-surface-lowered); + border-radius: var(--wa-corners-1x); + padding: var(--wa-space-xl); + margin: 0 0 var(--wa-space-xl) 0; +} + +blockquote > :first-child { + margin-block-start: 0; +} + +blockquote > :last-child { + margin-block-end: 0; +} + +/* Lists */ +ul, +ol { + padding: 0; + margin: 0 0 var(--wa-flow-spacing) var(--wa-space-xl); +} + +ul { + list-style: disc; +} + +li { + padding: 0; +} + +li > ul, +li > ol { + margin-block-end: 0; +} + +/* Details */ +details { + background-color: var(--wa-color-surface-lowered); + border-radius: var(--wa-corners-1x); + padding: 0; + margin: 0; + padding-inline: var(--wa-space-m); + margin-block-end: var(--wa-flow-spacing); +} + +details :last-child { + margin-block-end: 0; +} + +summary { + position: relative; + display: block; + cursor: pointer; + text-indent: calc(0.4em + 1em); + padding: 0; + padding-block: var(--wa-space-m); + margin: 0; + user-select: none; +} + +summary::-webkit-details-marker { + display: none; +} + +summary::before { + content: ''; + border-width: 0.4em; + border-style: solid; + border-color: transparent transparent transparent currentColor; + position: absolute; + top: calc(50% - 0.4em); + left: calc(0.4em / 2); + rotate: 0; + transform-origin: calc(0.4em / 2) 50%; +} + +details[open] { + padding-block-end: var(--wa-space-m); +} + +details[open] > summary::before { + rotate: 90deg; +} + +details + details { + margin-top: calc(-1 * var(--wa-flow-spacing) + var(--wa-border-width-thin)); +} + +/* Tables */ +table { + width: 100%; + border: none; + border-collapse: collapse; +} + +caption { + color: var(--wa-color-text-quiet); +} + +tbody tr { + border-top: solid var(--wa-border-width-thin) var(--wa-color-surface-outline); +} + +tbody tr:nth-child(2n + 1) { + background-color: color-mix(in oklab, var(--wa-color-neutral-fill-muted), transparent 50%); +} + +tbody tr:hover { + background-color: color-mix(in oklab, var(--wa-color-brand-fill-muted), transparent 50%); + border-top-color: var(--wa-color-brand-outline-muted); +} + +tbody tr:hover + tr { + border-top-color: var(--wa-color-brand-outline-muted); +} + +th { + font-weight: var(--wa-font-weight-medium); +} + +td, +th { + text-align: start; + padding: var(--wa-space-s); +} + +/* Definition lists */ +dt { + font-weight: var(--wa-font-weight-medium); +} + +dd { + margin-inline-start: var(--wa-space-m); +} + +/* Fieldsets */ +fieldset { + border: solid 1px var(--wa-color-surface-outline); + border-radius: var(--wa-corners-1x); + padding: var(--wa-space-m); + padding-block-end: var(--wa-space-xl); +} + +legend { + padding: 0; + padding-inline: var(--wa-space-2xs); +} + +/* Images, videos, iframes, etc. */ +img, +picture, +svg, +video { + border-radius: var(--wa-corners-1x); max-width: 100%; height: auto; } +embed, +iframe, +object { + max-width: 100%; +} + +iframe { + border: none; +} + /* Links */ a { color: var(--wa-color-text-link); @@ -129,31 +403,51 @@ button:focus { outline: none; } -a:focus-visible, -button:focus-visible { +:focus-visible { outline: var(--wa-focus-ring); outline-offset: var(--wa-focus-ring-offset); } -/* Misc */ -abbr[title] { - text-decoration: none; - border-bottom: dashed 1px var(--wa-color-text-link); - cursor: help; +/* Native form controls */ +button, +input, +select, +textarea { + font: inherit; } -kbd { - background: var(--wa-color-neutral-fill-muted); - border: solid 1px var(--wa-color-neutral-outline-muted); - box-shadow: inset 0 1px 0 1px var(--wa-color-tint-white), 0 1px 0 0 var(--wa-color-tint-black); - font-family: var(--wa-font-family-code); - border-radius: var(--wa-corners-1x); - color: var(--wa-color-neutral-text-on-muted); - padding: 0.125em 0.4em; +/* Utilities */ +.wa-visually-hidden:not(:focus-within) { + position: absolute !important; + width: 1px !important; + height: 1px !important; + clip: rect(0 0 0 0) !important; + clip-path: inset(50%) !important; + border: none !important; + overflow: hidden !important; + white-space: nowrap !important; + padding: 0 !important; } -hr { - border: none; - border-bottom: solid var(--wa-border-width-thin) var(--wa-color-surface-outline); - margin: var(--wa-space-2xl) 0; +/* Print styles */ +@media print { + /* Show URLs for printed links */ + a:not(.anchor-heading)[href]::after { + content: ' (' attr(href) ')'; + } + + details, + pre { + background: none; + border: solid var(--wa-border-width-thin) var(--wa-color-surface-outline); + } + + summary { + list-style: none; + } + + summary::marker, + summary::-webkit-details-marker { + display: none; + } } diff --git a/src/themes/default.css b/src/themes/default.css index d8ca0ca78..9d1d387ba 100644 --- a/src/themes/default.css +++ b/src/themes/default.css @@ -300,6 +300,7 @@ --wa-form-controls-required-content-color: inherit; --wa-form-controls-required-content-offset: -0.1em; + --wa-flow-spacing: 1.5rem; --wa-tooltip-arrow-size: 0.375rem; } @@ -397,5 +398,3 @@ --wa-color-neutral-text-on-muted: var(--wa-color-neutral-70); --wa-color-neutral-text-on-surface: var(--wa-color-neutral-60); } - -/* _utility.css */