From 44414a5a6705777616aed2097964dcc42b91ad8a Mon Sep 17 00:00:00 2001 From: Shan Carter Date: Wed, 4 Oct 2017 17:51:42 -0700 Subject: [PATCH] New design --- examples/article.html | 30 ++-- src/components.js | 3 +- src/components/d-abstract.js | 11 +- src/components/d-appendix.js | 4 +- src/components/d-article.js | 236 +++++++++++++++++++++++++- src/components/d-byline.js | 140 +++++++-------- src/components/d-footnote-list.js | 4 + src/components/d-headline.js | 39 +++++ src/styles/styles-article.css | 226 ------------------------ src/styles/styles-base.css | 7 + src/styles/styles-layout.css | 92 +++++----- src/styles/styles.js | 4 +- src/transforms/optional-components.js | 44 ++--- 13 files changed, 459 insertions(+), 381 deletions(-) create mode 100644 src/components/d-headline.js delete mode 100644 src/styles/styles-article.css diff --git a/examples/article.html b/examples/article.html index ee328c9..2855a99 100644 --- a/examples/article.html +++ b/examples/article.html @@ -8,7 +8,7 @@ + +

We often think of Momentum as a means of dampening oscillations and speeding up the iterations, leading to faster convergence. But it has other interesting behavior. It allows a larger range of step-sizes to be used, and creates its own oscillations. What is going on?

+
- -

A popular method for exploring high-dimensional data is something called t-SNE. The technique has become widespread in the field of machine learning, since it has an almost magical ability to create compelling two-dimensonal “maps” from data with hundreds or even thousands of dimensions. Although impressive, these images can be tempting to misread. The purpose of this note is to prevent some common misreadings. -

Before diving in: if you haven’t encountered t-SNE before, here’s what you need to know about the math behind it. The goal is to take a set of points in a high-dimensional space and find a faithful representation of those points in a lower-dimensional space, typically the 2D plane. The algorithm is non-linear and adapts to the underlying data, performing different transformations on different regions. Those differences can be a major source of confusion. + 1 +

A Brief Survey of Techniques

+

Before diving in: if you haven’t encountered t-SNE before, here’s what you need to know about the math behind it. The goal is to take a set of points in a high-dimensional space and find a faithful representation of those points in a lower-dimensional space, typically the 2D plane. The algorithm is non-linear and adapts to the underlying data, performing different transformations on different regions. Those differences can be a major source of confusion.

This is the first paragraph of the article. Test a long — dash -- here it is.

Test for owner's possessive. Test for "quoting a passage." And another sentence. Or two. Some flopping fins; for diving.

+

Here's a test of an inline equation c = a^2 + b^2. Also with configurable katex standards just using inline '$' signs: $$x^2$$ And then there's a block equation:

- c = \pm \sqrt{ \sum_{i=0}^{n}{a^{222} + b^2}} + c = \pm \sqrt{ \sum_{i=0}^{n}{a^{222} + b^2}}

Math can also be quite involved: @@ -53,6 +55,8 @@ \frac{1}{\Bigl(\sqrt{\phi \sqrt{5}}-\phi\Bigr) e^{\frac25 \pi}} = 1+\frac{e^{-2\pi}} {1+\frac{e^{-4\pi}} {1+\frac{e^{-6\pi}} {1+\frac{e^{-8\pi}} {1+\cdots} } } }

+ 1.1 +

Citations

We can also cite external publications.

We should also be testing footnotesThis will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote. This will become a hoverable footnote.. There are multiple footnotes, and they appear in the appendixGiven I have coded them right. Also, here's math in a footnote: c = \sum_0^i{x}. Also, a citation. Box-ception! as well.

@@ -65,6 +69,7 @@
2345423
+ 2

Displaying code snippets

Some inline javascript:var x = 25;. And here's a javascript code block.

@@ -105,18 +110,15 @@ });

That's it for the example article!

-
-
-

Contributions

-

Some text describing who did what.

-

Reviewers

-

Some text with links describing who reviewed the article.

-
+

Contributions

+

Some text describing who did what.

+

Reviewers

+

Some text with links describing who reviewed the article.

diff --git a/src/components.js b/src/components.js index 6c1a819..8eee8de 100644 --- a/src/components.js +++ b/src/components.js @@ -14,6 +14,7 @@ import { Code } from './components/d-code'; import { Footnote } from './components/d-footnote'; import { FootnoteList } from './components/d-footnote-list'; import { FrontMatter } from './components/d-front-matter'; +import { Headline } from './components/d-headline'; import { DMath } from './components/d-math'; import { References } from './components/d-references'; import { TOC } from './components/d-toc'; @@ -21,7 +22,7 @@ import { Figure } from './components/d-figure'; const components = [ Abstract, Appendix, Article, Bibliography, Byline, Cite, CitationList, Code, - Footnote, FootnoteList, FrontMatter, DMath, References, TOC, Figure, + Footnote, FootnoteList, FrontMatter, Headline, DMath, References, TOC, Figure, ]; /* Distill website specific components */ diff --git a/src/components/d-abstract.js b/src/components/d-abstract.js index ff46ae5..9cc714c 100644 --- a/src/components/d-abstract.js +++ b/src/components/d-abstract.js @@ -5,10 +5,15 @@ const T = Template('d-abstract', ` diff --git a/src/components/d-appendix.js b/src/components/d-appendix.js index c9a7958..0e832f9 100644 --- a/src/components/d-appendix.js +++ b/src/components/d-appendix.js @@ -6,7 +6,6 @@ const T = Template('d-appendix', ` d-appendix { contain: content; - font-size: 13px; line-height: 1.7em; margin-bottom: 0; @@ -17,6 +16,7 @@ d-appendix { } d-appendix h3 { + grid-column: page-start / text-start; font-size: 15px; font-weight: 500; margin-top: 20px; @@ -30,7 +30,7 @@ d-appendix a { } d-appendix > * { - grid-column: left / text; + grid-column: text; } diff --git a/src/components/d-article.js b/src/components/d-article.js index ba9996f..e552f81 100644 --- a/src/components/d-article.js +++ b/src/components/d-article.js @@ -1,13 +1,238 @@ import { Template } from '../mixins/template'; import { Controller } from '../controller'; -const T = Template('d-article', ` - -`, false); + +d-article > * { + grid-column: text; +} + +@media(min-width: 768px) { + d-article { + font-size: 16px; + } +} + +@media(min-width: 1024px) { + d-article { + font-size: 19px; + } +} + +d-article p { + +} + + +/* H2 */ + + +d-article .marker { + text-decoration: none; + border: none; + counter-reset: section; + grid-column: kicker; + align-items: center; + display: flex; + line-height: 1.7em; +} + +d-article .marker:hover { + border: none; +} + +d-article .marker span { + padding: 0 3px; + border-bottom: 1px solid rgba(0, 0, 0, 0.2); +} + +d-article .marker:hover span { + color: rgba(0, 0, 0, 0.7); + border-bottom: 1px solid rgba(0, 0, 0, 0.7); +} + +d-article h2 { + grid-column-end: span 5; + font-weight: 600; + font-size: 24px; + line-height: 1.25em; +} + +@media(min-width: 1024px) { + d-article h2 { + font-size: 24px; + } +} + +/* H3 */ + +d-article h3 { + font-weight: 700; + font-size: 18px; + line-height: 1.4em; + margin-bottom: 24px; + margin-top: 0; +} + +@media(min-width: 1024px) { + d-article h3 { + font-size: 20px; + } +} + +/* H4 */ + +d-article h4 { + font-weight: 600; + text-transform: uppercase; + font-size: 14px; + line-height: 1.4em; +} + +d-article a { + color: inherit; +} + +d-article p, +d-article ul, +d-article ol { + margin-top: 0; + margin-bottom: 36px; +} + +d-article a { + border-bottom: 1px solid rgba(0, 0, 0, 0.4); + text-decoration: none; +} + +d-article a:hover { + border-bottom: 1px solid rgba(0, 0, 0, 0.8); +} + +d-article .link { + text-decoration: underline; + cursor: pointer; +} + +d-article ul, +d-article ol { + padding-left: 24px; +} + +d-article li { + margin-bottom: 24px; + margin-left: 0; + padding-left: 0; +} + +d-article pre { + font-size: 14px; + margin-bottom: 20px; +} + +d-article hr { + border: none; + border-bottom: 1px solid rgba(0, 0, 0, 0.2); + margin-top: 60px; + margin-bottom: 60px; +} + +d-article section { + margin-top: 60px; + margin-bottom: 60px; +} + +/* Figure */ + +d-article figure { + position: relative; + margin-bottom: 36px; +} + +d-article figure img { + width: 100%; +} + +d-article figure svg text, +d-article figure svg tspan { +} + +d-article figure figcaption { + color: rgba(0, 0, 0, 0.6); + font-size: 12px; + line-height: 1.5em; +} + +@media(min-width: 1024px) { + d-article figure figcaption { + font-size: 13px; + } +} + +d-article figure.external img { + background: white; + border: 1px solid rgba(0, 0, 0, 0.1); + box-shadow: 0 1px 8px rgba(0, 0, 0, 0.1); + padding: 18px; + box-sizing: border-box; +} + +d-article figure figcaption a { + color: rgba(0, 0, 0, 0.6); +} + +d-article span.equation-mimic { + font-family: georgia; + font-size: 115%; + font-style: italic; +} + +d-article figure figcaption b { + font-weight: 600; + color: rgba(0, 0, 0, 1.0); +} + +d-article > d-code, +d-article section > d-code { + display: block; +} + +d-article > d-math[block], +d-article section > d-math[block] { + display: block; +} + +d-article .citation { + color: #668; + cursor: pointer; +} + +d-include { + width: auto; + display: block; +} + +d-figure { + contain: content; + overflow: hidden; + height: 300px; +} + +/* KaTeX */ + +.katex, .katex-prerendered { + contain: content; + display: inline-block; +} + +`; + // export function addInferableTags(dom, frontMatter) { // const title = frontMatter.title; @@ -19,7 +244,8 @@ d-article { const isOnlyWhitespace = /^\s*$/; -export class Article extends T(HTMLElement) { +export class Article extends HTMLElement { + static get is() { return 'd-article'; } constructor() { super(); diff --git a/src/components/d-byline.js b/src/components/d-byline.js index 8c4f564..e6d2eca 100644 --- a/src/components/d-byline.js +++ b/src/components/d-byline.js @@ -1,28 +1,22 @@ export const style = ` d-byline { + border-top: 1px solid rgba(0, 0, 0, 0.1); contain: content; + font-size: 13px; + line-height: 2em; + padding: 1.5em 0; } d-byline .byline { - grid-column: left / page; - font-size: 13px; - line-height: 1.8em; - color: rgba(0, 0, 0, 0.6); + grid-template-columns: repeat(5, 1fr); + grid-column: text-start / page-end; } -d-byline .byline::before { - content: ""; - display: block; - border-bottom: solid 1px #999; - width: 36px; - margin-bottom: 36px; -} -d-byline .byline::after { - content: ""; - display: block; - border-bottom: solid 1px #999; - width: 36px; - margin-top: 36px; - margin-bottom: 36px; + +d-byline h3 { + font-weight: 300; + color: rgba(0, 0, 0, 0.7); + font-size: 14px; + margin: 0; } d-byline a, @@ -37,72 +31,78 @@ d-article d-byline a:hover { border-bottom: none; } +d-byline table tbody td { + margin: 0!important; + padding: 0!important; +} + +d-byline table tr { +} + +d-byline table td:last-child { +} + +d-byline table tr:first-child { + border-top: none; +} + + +/*Authors*/ + d-byline .authors { - text-align: left; -} - -d-byline .author { - margin-right: 12px; -} - -d-byline .author .name { font-weight: 600; - display: inline; - text-transform: uppercase; - margin-right: 10px; } -d-byline .author .affiliation { - display: inline; +d-byline td:first-child { } -d-byline .date { - display: inline; - text-align: left; - margin-right: 12px; +d-byline .colophon, +d-byline .colophon a { + font-size: 12px; + color: rgba(0, 0, 0, 0.5); } -d-byline .date .year, -d-byline .date .month { - display: inline; -} - -d-byline .citation { - display: inline; - text-align: left; -} - -d-byline .citation div { - display: inline; -} `; export function bylineTemplate(frontMatter) { return ` -