diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b62c1539a..56f22de1ce 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,14 +3,9 @@ name: Test on: workflow_dispatch: pull_request: - paths-ignore: - - 'site/**' push: branches: - main - paths-ignore: - - 'site/**' - - 'yarn.lock' jobs: test: diff --git a/site/Gemfile.lock b/site/Gemfile.lock index bc614a8f52..4606b7e54d 100644 --- a/site/Gemfile.lock +++ b/site/Gemfile.lock @@ -1,23 +1,32 @@ GEM remote: https://rubygems.org/ specs: - activesupport (7.0.8) + activesupport (7.1.3) + base64 + bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb i18n (>= 1.6, < 2) minitest (>= 5.1) + mutex_m tzinfo (~> 2.0) - addressable (2.8.5) + addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) - base64 (0.1.1) + base64 (0.2.0) + bigdecimal (3.1.6) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.11.1) colorator (1.1.0) commonmarker (0.23.10) - concurrent-ruby (1.2.2) + concurrent-ruby (1.2.3) + connection_pool (2.4.1) dnsruby (1.70.0) simpleidn (~> 0.2.1) + drb (2.2.0) + ruby2_keywords em-websocket (0.5.3) eventmachine (>= 0.12.9) http_parser.rb (~> 0) @@ -25,12 +34,11 @@ GEM ffi (>= 1.15.0) eventmachine (1.2.7) execjs (2.9.1) - faraday (2.7.11) - base64 - faraday-net_http (>= 2.0, < 3.1) - ruby2_keywords (>= 0.0.4) - faraday-net_http (3.0.2) - ffi (1.16.2) + faraday (2.9.0) + faraday-net_http (>= 2.0, < 3.2) + faraday-net_http (3.1.0) + net-http + ffi (1.16.3) forwardable-extended (2.6.0) gemoji (3.0.1) github-pages (228) @@ -211,12 +219,15 @@ GEM jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.20.0) - nokogiri (1.15.4-arm64-darwin) + minitest (5.21.2) + mutex_m (0.2.0) + net-http (0.4.1) + uri + nokogiri (1.16.0-arm64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-darwin) + nokogiri (1.16.0-x86_64-darwin) racc (~> 1.4) - nokogiri (1.15.4-x86_64-linux) + nokogiri (1.16.0-x86_64-linux) racc (~> 1.4) octokit (4.25.1) faraday (>= 1, < 3) @@ -224,7 +235,7 @@ GEM pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (4.0.7) - racc (1.7.1) + racc (1.7.3) rb-fsevent (0.11.2) rb-inotify (0.10.1) ffi (~> 1.0) @@ -245,20 +256,22 @@ GEM unf (~> 0.1.4) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - typhoeus (1.4.0) + typhoeus (1.4.1) ethon (>= 0.9.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unf (0.1.4) unf_ext - unf_ext (0.0.8.2) + unf_ext (0.0.9.1) unicode-display_width (1.8.0) + uri (0.13.0) webrick (1.8.1) PLATFORMS arm64-darwin-20 arm64-darwin-21 arm64-darwin-22 + arm64-darwin-23 x86_64-darwin-19 x86_64-darwin-20 x86_64-linux diff --git a/site/static/index.ts b/site/static/index.ts index f359698165..eded94b542 100644 --- a/site/static/index.ts +++ b/site/static/index.ts @@ -51,8 +51,7 @@ selectAll('h2, h3, h4, h5, h6').each(function (this: d3.BaseType) { /* Documentation */ function renderExample($target: Selection, specText: string, figureOnly: boolean) { - $target.classed('example', true); - $target.text(''); + $target.classed('example', true).text(''); const vis = $target.append('div').attr('class', 'example-vis'); @@ -108,7 +107,7 @@ export function embedExample($target: any, spec: TopLevelSpec, actions = true, t return view; } -function getSpec(el: d3.BaseType) { +async function getSpec(el: d3.BaseType) { const sel = select(el); const name = sel.attr('data-name'); const figureOnly = !!sel.attr('figure-only'); @@ -116,16 +115,17 @@ function getSpec(el: d3.BaseType) { const dir = sel.attr('data-dir'); const fullUrl = `${BASEURL}/examples/${dir ? `${dir}/` : ''}${name}.vl.json`; - fetch(fullUrl) - .then(response => { - response - .text() - .then(spec => { - renderExample(sel, spec, figureOnly); - }) - .catch(console.error); - }) - .catch(console.error); + try { + const spec = await (await fetch(fullUrl)).text(); + renderExample(sel, spec, figureOnly); + } catch (e) { + sel + .html( + `Could not load spec: ${e}. Please report this issue on GitHub.` + ) + .classed('error', true); + console.error(e); + } } else { console.error('No "data-name" specified to import examples from'); } diff --git a/site/static/main.css b/site/static/main.css index 4436786765..7eb4016836 100644 --- a/site/static/main.css +++ b/site/static/main.css @@ -3,6 +3,7 @@ body { height: 100%; width: 100%; } + body { font: 16px/1.5em 'Helvetica Neue', @@ -18,37 +19,45 @@ body { text-rendering: optimizeLegibility; min-width: 360px; } + header { background-color: #274c71; } + a { cursor: pointer; color: #4682b4; } + a:not(:hover) { text-decoration: none; } + footer { border-top: 1px solid #eee; padding: 1em 0 1em 0; /* for safari */ min-height: 40px; } + footer > div { display: flex; align-items: center; justify-content: space-between; } + blockquote { padding: 0 15px; color: #777; border-left: 4px solid #ddd; margin: 0; } + dt { font-weight: bold; color: #777; } + dd { margin-bottom: 10px; } @@ -70,9 +79,11 @@ dd { margin: 0; padding: 0; } + .page-content table tr:nth-child(2n) { background-color: #f8f8f8; } + .page-content table tr th { font-weight: bold; border: 1px solid #cccccc; @@ -80,16 +91,19 @@ dd { margin: 0; padding: 6px 13px; } + .page-content table tr td { border: 1px solid #cccccc; text-align: left; margin: 0; padding: 6px 13px; } + .page-content table tr th:first-child, .page-content table tr td:first-child { margin-top: 0; } + .page-content table tr th:last-child, .page-content table tr td:last-child { margin-bottom: 0; @@ -98,6 +112,7 @@ dd { .page-content table { width: 100%; } + .page-content .small-table { width: auto; } @@ -105,9 +120,11 @@ dd { .page-content table p { margin: 0.5em 0; } + .page-content table p:first-child { margin-top: 0; } + .page-content table p:last-child { margin-bottom: 0; } @@ -127,6 +144,7 @@ h3, h4 { margin: 0.7em 0 0.3em 0; } + h1 { vertical-align: middle; color: black; @@ -135,6 +153,7 @@ h1 { font-size: 2.5em; margin: 0.7em 0 0.3em 0; } + h2 { font-size: 1.75em; font-weight: 500; @@ -144,20 +163,25 @@ h2 { padding-bottom: 1px; /* more padding between heading and line */ } + h3 { font-size: 1.5em; } + h4 { font-size: 1.3em; color: #333; } + h5 { font-size: 1.1em; } + h6 { color: #777777; font-size: 1.1em; } + .anchor { display: inline-block; margin-left: -22px; @@ -165,6 +189,7 @@ h6 { color: black; outline: 0; } + h2 .octicon-link, h3 .octicon-link, h4 .octicon-link, @@ -174,6 +199,7 @@ h6 .octicon-link { vertical-align: middle; visibility: hidden; } + h2:hover .anchor .octicon-link, h3:hover .anchor .octicon-link, h4:hover .anchor .octicon-link, @@ -192,6 +218,7 @@ tt { font-family: monospace; font-size: 0.8em; } + pre code { margin: 0; padding: 0; @@ -200,12 +227,14 @@ pre code { background: transparent; font-family: monospace; } + pre { line-height: 1em; background: #f9f9f9; border: 1px solid #eee; padding: 8px 10px; } + .hljs { padding: 0; background-color: transparent; @@ -227,13 +256,16 @@ nav a { padding-right: 2em; display: inline-block; } + nav a:last-child { padding-right: 0px; } + nav a[aria-current] { font-weight: bold; color: #fff; } + nav a:hover { color: #e5b928; text-decoration: none; @@ -255,21 +287,25 @@ nav a:hover { margin: 0 auto; padding: 0 20px; } + .page-main { display: flex; flex-direction: column; flex-flow: initial; } + .page-content { padding-bottom: 3em; flex: 1 1 auto; } + .page-sidebar { width: 200px; flex: 0 0 auto; margin-top: 1.7em; padding-right: 0.2em; } + .sub-nav { background-color: #3f6d9c; } @@ -283,14 +319,17 @@ nav a:hover { .sidebar-nav-item { display: block; } + .sidebar-nav-item a { display: block; padding: 0.5em 0; color: #666; } + .sidebar-nav-item a[aria-current] { font-weight: bold; } + .sidebar-nav-item a:hover { color: #4682b4; text-decoration: none; @@ -375,33 +414,42 @@ footer .edit-page { font-size: 1.3em; font-weight: 300; } + .idl-logo { float: right; } + .idl-logo img { height: 40px; } + .fill { flex: 1 0 auto; } + .float-right { float: right; } + .hidden { display: none; } + .lead-columns { display: flex; flex-direction: row; justify-content: space-around; align-items: stretch; } + .lead-columns > span:first-child { margin-right: 60px; } + .lead-buttons { flex: 0 0 auto; } + .lead-buttons a { display: block; width: 250px; @@ -414,19 +462,23 @@ footer .edit-page { border-radius: 4px; font-size: 1.2em; } + .lead-buttons a:last-child { color: #333; background-color: #fff; border-color: #ccc; } + .lead-buttons a:hover { text-decoration: none; background-color: #285e8e; } + .lead-buttons a:last-child:hover { text-decoration: none; background-color: #ebebeb; } + .note-line { font-size: 0.9em !important; margin-top: 8px; @@ -446,6 +498,18 @@ footer .edit-page { text-decoration: underline; } +/* Error */ +.error { + background-color: #b53e3e; + color: white; + padding: 1em; + + a { + color: white; + text-decoration: underline; + } +} + /* Example Gallery */ .preview { display: block; @@ -453,6 +517,7 @@ footer .edit-page { padding: 0.5em 0; padding-right: 0.5em; } + .preview .image { width: 180px; height: 100px; @@ -461,9 +526,11 @@ footer .edit-page { overflow: hidden; transition: background-position 2s; } + .preview:hover .image { background-position: right bottom; } + .preview a { font-size: 0.9em; } @@ -477,6 +544,7 @@ footer .edit-page { padding: 0; position: relative; } + #showcase:after, #showcase:before { content: ''; @@ -487,20 +555,24 @@ footer .edit-page { height: 16px; z-index: 2; } + #showcase:before { bottom: -16px; box-shadow: 0px -8px 16px rgba(0, 0, 0, 0.3); } + #showcase:after { top: -16px; box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.3); } + #showcase .examples { margin: 0 auto; height: 300px; width: 1300px; line-height: 0; } + #showcase .preview { width: 180px; height: 100px; @@ -513,6 +585,7 @@ footer .edit-page { z-index: 0; transition: background-position 2s; } + #showcase .preview:hover { background-position: right bottom; outline: 2px solid #4682b4; @@ -526,6 +599,7 @@ footer .edit-page { flex-wrap: wrap; margin: 0 -12px; } + .gallery .imagegroup { display: inline-block; position: relative; @@ -539,6 +613,7 @@ footer .edit-page { .gallery .imagegroup:hover { text-decoration: none; } + .gallery .image { background-size: cover; display: block; @@ -550,6 +625,7 @@ footer .edit-page { overflow: hidden; transition: background-position 2s; } + .gallery .image:hover { background-position: right bottom; } @@ -568,6 +644,7 @@ footer .edit-page { max-width: 786px; overflow: auto; } + .example .example-vis { flex: 1 1 0; margin-right: 10px; @@ -576,6 +653,7 @@ footer .edit-page { margin-bottom: 1em; align-self: center; } + .example .vega-bind { min-width: 450px; display: inline-block; @@ -600,28 +678,35 @@ footer .edit-page { width: 30%; border: 1px dashed #ddd; } + .vl-example-responsive .example-vis svg { border: none; } + .example-only .example-code { display: none; } + .example .example-code { flex: 1.618 1 0; margin: 0; align-self: flex-start; min-width: 350px; } + .example .example-code code { white-space: pre-wrap; } + .example .vega-actions { font-size: 0.8em; opacity: 0.8; } + .example .vega-actions:hover { opacity: 1; } + .example canvas, .example svg { border: 1px dashed #ddd; @@ -693,6 +778,7 @@ footer .edit-page { list-style: none; padding-left: 0; } + .ecosystem li { margin: 0.2em 0; } @@ -702,7 +788,8 @@ nav .dropdown-content { position: absolute; display: none; min-width: 164px; - top: 54px; /* For Firefox */ + top: 54px; + /* For Firefox */ } nav .dropdown-content a { @@ -753,9 +840,11 @@ kbd { flex-wrap: wrap; justify-content: center; } + .logos li { flex: 0; } + .logos li img { padding: 18px; height: 50px; @@ -763,6 +852,7 @@ kbd { filter: grayscale(100%); opacity: 0.8; } + .logos li img:hover { transition: all 0.4s; opacity: 1; @@ -775,6 +865,7 @@ kbd { body { font-size: 14px; } + nav .dropdown-content { min-width: 129px; } @@ -785,28 +876,35 @@ kbd { flex-direction: row; flex-wrap: wrap; } + .page-centered, .page-content { max-width: 100%; } + .lead-columns { flex-direction: column; } + .lead-columns span:first-child { margin-right: 0px; } + .lead-buttons a { width: inherit; } + .example .example-vis, .example .example-code { flex: 1 1 auto; max-width: 100%; overflow-x: auto; } + .example .example-code code { min-width: 600px; } + .highlight { overflow-x: auto; }