@myst-theme/styles 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/app.css ADDED
@@ -0,0 +1,10 @@
1
+ @import './typography.css';
2
+ @import './grid-system.css';
3
+ @import './details.css';
4
+ @import './citations.css';
5
+ @import './figures.css';
6
+ @import './text-spacers.css';
7
+ @import './code-highlight.css';
8
+ @import './math.css';
9
+ @import './cross-references.css';
10
+ @import './block-styles.css';
@@ -0,0 +1,15 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @layer base {
6
+ .shaded {
7
+ @apply p-2 bg-slate-100;
8
+ }
9
+ .shaded-children > * {
10
+ @apply p-2 bg-slate-100;
11
+ }
12
+ .rounded-children > * {
13
+ @apply rounded;
14
+ }
15
+ }
package/citations.css ADDED
@@ -0,0 +1,18 @@
1
+ cite {
2
+ font-style: normal;
3
+ }
4
+ .cite-group.parenthetical cite::after {
5
+ content: ';\00a0';
6
+ }
7
+ .cite-group.narrative cite::after {
8
+ content: ',\00a0';
9
+ }
10
+ .cite-group > span:last-of-type cite::after {
11
+ content: '';
12
+ }
13
+ .cite-group.parenthetical:before {
14
+ content: '(';
15
+ }
16
+ .cite-group.parenthetical:after {
17
+ content: ')';
18
+ }
@@ -0,0 +1,22 @@
1
+ pre > code > span[data-line-number] {
2
+ display: block;
3
+ position: relative;
4
+ line-height: 1.4rem;
5
+ padding-right: 1rem;
6
+ }
7
+ pre > code > span[data-highlight='true']::after {
8
+ content: ' ';
9
+ position: absolute;
10
+ right: -0.8rem;
11
+ top: 0;
12
+ width: calc(100% + 1.6rem);
13
+ opacity: 0.1;
14
+ pointer-events: none;
15
+ background: #5ca5ee;
16
+ }
17
+ pre > code > span > .linenumber {
18
+ color: rgb(128, 128, 128);
19
+ }
20
+ pre > code > span[data-highlight='true'] > .linenumber {
21
+ color: #5ca5ee;
22
+ }
@@ -0,0 +1,14 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @layer base {
6
+ .popout > h1,
7
+ .popout > h2,
8
+ .popout > h3,
9
+ .popout > h4,
10
+ .popout > h5,
11
+ .popout > h6 {
12
+ margin-top: 0;
13
+ }
14
+ }
package/details.css ADDED
@@ -0,0 +1,19 @@
1
+ details > summary {
2
+ list-style: none;
3
+ transition: margin 150ms ease-out;
4
+ }
5
+ details > summary::marker, /* Latest Chrome, Edge, Firefox */
6
+ details > summary::-webkit-details-marker /* Safari */ {
7
+ display: none;
8
+ }
9
+ details[open] > summary .details-toggle {
10
+ transform: rotate(90deg) translateX(-5px) translateY(-5px);
11
+ }
12
+ details[open] > summary {
13
+ /* Fake the animation */
14
+ margin-bottom: 10px;
15
+ }
16
+ details[open] .details-body {
17
+ /* But keep the placement */
18
+ margin-top: -10px;
19
+ }
package/figures.css ADDED
@@ -0,0 +1,10 @@
1
+ figure.quote figcaption {
2
+ text-align: right;
3
+ }
4
+ figure.quote figcaption > p:before {
5
+ content: '—';
6
+ padding-right: 0.5em;
7
+ }
8
+ figure.code > div {
9
+ margin: 0;
10
+ }
@@ -0,0 +1,45 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @layer base {
6
+ .article-grid {
7
+ @apply grid grid-cols-article-sm md:grid-cols-article-md lg:grid-cols-article-lg xl:grid-cols-article-xl 2xl:grid-cols-article-2xl;
8
+ }
9
+ .article-grid > * {
10
+ /* The default is spanning the body for any child component */
11
+ @apply col-body;
12
+ }
13
+ .article-grid-gap {
14
+ @apply gap-1 md:gap-2 xl:gap-3 2xl:gap-4;
15
+ }
16
+ .article-subgrid-gap {
17
+ @apply gap-x-1 md:gap-x-2 xl:gap-x-3 2xl:gap-x-4;
18
+ }
19
+ /* These columns need more responsive design */
20
+ .col-margin-left {
21
+ @apply col-margin-left-sm xl:col-margin-left-lg;
22
+ }
23
+ .col-margin-right,
24
+ .col-margin {
25
+ @apply col-margin-right-sm lg:col-margin-right-lg;
26
+ }
27
+ .col-gutter-page-right {
28
+ @apply col-gutter-page-right-sm md:col-gutter-page-right-md lg:col-gutter-page-right-lg;
29
+ }
30
+ .col-gutter-page-left {
31
+ @apply col-gutter-page-left-sm md:col-gutter-page-left-md lg:col-gutter-page-left-lg;
32
+ }
33
+ .col-body-inset-right {
34
+ @apply col-body-inset-right-sm lg:col-body-inset-right-lg;
35
+ }
36
+ .col-body-inset-left {
37
+ @apply col-body-inset-left-sm lg:col-body-inset-left-lg;
38
+ }
39
+ .col-page-middle {
40
+ @apply col-page-middle-sm lg:col-page-middle-lg;
41
+ }
42
+ .error-content {
43
+ @apply pt-[80px] prose prose-stone dark:prose-invert break-words mx-5 p-3 max-w-none sm:pl-10 md:max-w-2xl lg:mx-auto xl:max-w-4xl;
44
+ }
45
+ }
package/index.js ADDED
@@ -0,0 +1,182 @@
1
+ const content = [
2
+ './app/**/*.{js,ts,jsx,tsx}',
3
+ // Look to the actual packages too (better than node_modules for pnpm)
4
+ 'node_modules/myst-to-react/{src,dist}/**/*.{js,ts,jsx,tsx}',
5
+ 'node_modules/myst-demo/{src,dist}/**/*.{js,ts,jsx,tsx}',
6
+ 'node_modules/@myst-theme/site/{src,dist}/**/*.{js,ts,jsx,tsx}',
7
+ 'node_modules/@myst-theme/frontmatter/{src,dist}/**/*.{js,ts,jsx,tsx}',
8
+ 'node_modules/@myst-theme/jupyter/{src,dist}/**/*.{js,ts,jsx,tsx}',
9
+ // Duplicate the above in case this is in a submodule
10
+ '../../packages/myst-to-react/{src,dist}/**/*.{js,ts,jsx,tsx}',
11
+ '../../packages/myst-demo/{src,dist}/**/*.{js,ts,jsx,tsx}',
12
+ '../../packages/site/{src,dist}/**/*.{js,ts,jsx,tsx}',
13
+ '../../packages/frontmatter/{src,dist}/**/*.{js,ts,jsx,tsx}',
14
+ '../../packages/jupyter/{src,dist}/**/*.{js,ts,jsx,tsx}',
15
+ ];
16
+
17
+ const themeExtensions = {
18
+ gridTemplateColumns: {
19
+ 'article-sm':
20
+ '[screen-start screen-inset-start] 0.5rem [page-start page-inset-start body-outset-start body-start gutter-left-start body-inset-start middle-start] 1fr 1fr [gutter-left-end] 1fr 1fr [gutter-right-start] 1fr 1fr [middle-end body-inset-end body-end gutter-right-end body-outset-end page-inset-end page-end] 0.5rem [screen-inset-end screen-end]',
21
+ 'article-md':
22
+ '[screen-start] 0.25rem [screen-inset-start page-start page-inset-start body-outset-start] 1fr [body-start gutter-left-start] 1rem [body-inset-start] minmax(2ch, 10ch) [middle-start] minmax(2ch, 10ch) [gutter-left-end] minmax(2ch, 10ch) minmax(2ch, 10ch) [gutter-right-start] minmax(2ch, 10ch) [middle-end] minmax(2ch, 10ch) [body-inset-end] 1rem [body-end gutter-right-end] 1fr [body-outset-end page-inset-end page-end screen-inset-end] 0.25rem [screen-end]',
23
+ 'article-lg':
24
+ '[screen-start] 0.25rem [screen-inset-start page-start] 1rem [page-inset-start body-outset-start] 1fr [body-start gutter-left-start] 1rem [body-inset-start] minmax(8ch, 10ch) [middle-start] minmax(8ch, 10ch) [gutter-left-end] minmax(8ch, 10ch) minmax(8ch, 10ch) [gutter-right-start] minmax(8ch, 10ch) [middle-end] minmax(8ch, 10ch) [body-inset-end] 1rem [body-end gutter-right-end] 3rem [body-outset-end] minmax(5rem, 13rem) [page-inset-end] 3rem [page-end] 1fr [screen-inset-end] 0.25rem [screen-end]',
25
+ 'article-xl':
26
+ '[screen-start] 0.25rem [screen-inset-start] 1fr [page-start] 3rem [page-inset-start] minmax(4rem, 9rem) [body-outset-start] 3rem [body-start gutter-left-start] 1rem [body-inset-start] minmax(8ch, 10ch) [middle-start] minmax(8ch, 10ch) [gutter-left-end] minmax(8ch, 10ch) minmax(8ch, 10ch) [gutter-right-start] minmax(8ch, 10ch) [middle-end] minmax(8ch, 10ch) [body-inset-end] 1rem [body-end gutter-right-end] 3rem [body-outset-end] minmax(5rem, 13rem) [page-inset-end] 3rem [page-end] 1fr [screen-inset-end] 0.25rem [screen-end]',
27
+ 'article-2xl':
28
+ '[screen-start] 0.5rem [screen-inset-start] 1fr [page-start] 3rem [page-inset-start] minmax(4rem, 9rem) [body-outset-start] 3rem [body-start gutter-left-start] 1rem [body-inset-start] minmax(8ch, 10ch) [middle-start] minmax(8ch, 10ch) [gutter-left-end] minmax(8ch, 10ch) minmax(8ch, 10ch) [gutter-right-start] minmax(8ch, 10ch) [middle-end] minmax(8ch, 10ch) [body-inset-end] 1rem [body-end gutter-right-end] 3rem [body-outset-end] minmax(5rem, 13rem) [page-inset-end] 3rem [page-end] 1fr [screen-inset-end] 0.5rem [screen-end]',
29
+ },
30
+ gridColumn: {
31
+ screen: 'screen',
32
+ 'screen-inset': 'screen-inset',
33
+ page: 'page',
34
+ 'gutter-page-left-sm': 'body',
35
+ 'gutter-page-left-md': 'body-outset / gutter-left',
36
+ 'gutter-page-left-lg': 'page / middle-start',
37
+ 'page-middle-sm': 'body',
38
+ 'page-middle-lg': 'middle',
39
+ 'gutter-page-right-sm': 'body',
40
+ 'gutter-page-right-md': 'gutter-right / body-outset',
41
+ 'gutter-page-right-lg': 'middle-end / page',
42
+ 'page-inset': 'page-inset',
43
+ body: 'body',
44
+ 'body-outset': 'body-outset',
45
+ 'body-inset': 'body-inset',
46
+ 'body-inset-right-sm': 'body / gutter-right-start',
47
+ 'body-inset-right-lg': 'body / middle',
48
+ 'body-inset-left-sm': 'gutter-left-end / body',
49
+ 'body-inset-left-lg': 'middle / body',
50
+ 'body-left': 'body / gutter-right-start',
51
+ 'body-right': 'gutter-left-end / body',
52
+ 'gutter-left': 'gutter-left',
53
+ 'gutter-outset-left': 'body-outset / gutter-left',
54
+ 'gutter-right': 'gutter-right',
55
+ 'gutter-outset-right': 'gutter-right / body-outset',
56
+ 'margin-left-sm': 'body',
57
+ 'margin-left-lg': 'page / body-start',
58
+ 'margin-right-sm': 'body',
59
+ 'margin-right-lg': 'body-end / page-end',
60
+ 'body-outset-right': 'body / body-outset',
61
+ 'page-inset-right': 'body / page-inset',
62
+ 'page-right': 'body / page',
63
+ 'screen-inset-right': 'body / screen-inset',
64
+ 'screen-right': 'body / screen',
65
+ 'body-outset-left': 'body-outset / body',
66
+ 'page-inset-left': 'page-inset / body',
67
+ 'page-left': 'page / body',
68
+ 'screen-inset-left': 'screen-inset / body',
69
+ 'screen-left': 'screen / body',
70
+ },
71
+ // See https://github.com/tailwindlabs/tailwindcss-typography/blob/master/src/styles.js
72
+ typography: (theme) => ({
73
+ DEFAULT: {
74
+ css: {
75
+ code: {
76
+ fontWeight: '400',
77
+ },
78
+ 'code::before': {
79
+ content: '',
80
+ },
81
+ 'code::after': {
82
+ content: '',
83
+ },
84
+ 'blockquote p:first-of-type::before': { content: 'none' },
85
+ 'blockquote p:first-of-type::after': { content: 'none' },
86
+ li: {
87
+ marginTop: '0.25rem',
88
+ marginBottom: '0.25rem',
89
+ },
90
+ 'li > p, dd > p, header > p, footer > p': {
91
+ marginTop: '0.25rem',
92
+ marginBottom: '0.25rem',
93
+ },
94
+ },
95
+ },
96
+ invert: {
97
+ css: {
98
+ '--tw-prose-code': theme('colors.pink[500]'),
99
+ },
100
+ },
101
+ stone: {
102
+ css: {
103
+ '--tw-prose-code': theme('colors.pink[600]'),
104
+ },
105
+ },
106
+ }),
107
+ keyframes: {
108
+ load: {
109
+ '0%': { width: '0%' },
110
+ '100%': { width: '50%' },
111
+ },
112
+ fadeIn: {
113
+ '0%': { opacity: 0.0 },
114
+ '25%': { opacity: 0.25 },
115
+ '50%': { opacity: 0.5 },
116
+ '75%': { opacity: 0.75 },
117
+ '100%': { opacity: 1 },
118
+ },
119
+ },
120
+ animation: {
121
+ load: 'load 2.5s ease-out',
122
+ 'fadein-fast': 'fadeIn 1s ease-out',
123
+ },
124
+ };
125
+
126
+ const safeList = [
127
+ 'prose',
128
+ 'col-screen',
129
+ 'col-screen-inset',
130
+ 'col-page',
131
+ 'col-gutter-page-left',
132
+ 'col-page-middle',
133
+ 'col-gutter-page-right',
134
+ 'col-page-inset',
135
+ 'col-body',
136
+ 'col-body-outset',
137
+ 'col-body-inset',
138
+ 'col-body-inset-right',
139
+ 'col-body-inset-left',
140
+ 'col-body-left',
141
+ 'col-body-right',
142
+ 'col-gutter-left',
143
+ 'col-gutter-outset-left',
144
+ 'col-gutter-right',
145
+ 'col-gutter-outset-right',
146
+ 'col-margin-left',
147
+ 'col-margin-right',
148
+ 'col-margin',
149
+ 'col-body-outset-right',
150
+ 'col-page-inset-right',
151
+ 'col-page-right',
152
+ 'col-screen-inset-right',
153
+ 'col-screen-right',
154
+ 'col-body-outset-left',
155
+ 'col-page-inset-left',
156
+ 'col-page-left',
157
+ 'col-screen-inset-left',
158
+ 'col-screen-left',
159
+ // Row and col span
160
+ 'row-span-1',
161
+ 'row-span-2',
162
+ 'row-span-3',
163
+ 'row-span-4',
164
+ 'row-span-5',
165
+ 'row-span-6',
166
+ 'col-span-1',
167
+ 'col-span-2',
168
+ 'col-span-3',
169
+ 'col-span-4',
170
+ 'col-span-5',
171
+ 'col-span-6',
172
+ // Utilities
173
+ 'shaded',
174
+ 'shaded-children',
175
+ 'rounded-children',
176
+ ];
177
+
178
+ module.exports = {
179
+ content,
180
+ themeExtensions,
181
+ safeList,
182
+ };
package/jupyter.css ADDED
@@ -0,0 +1,10 @@
1
+ .font-system {
2
+ font-family: Menlo, Consolas, 'DejaVu Sans Mono', monospace;
3
+ }
4
+ .jupyter-error {
5
+ background-color: rgb(255, 221, 221);
6
+ }
7
+ /* Hide the output prompts from jupyter by default */
8
+ .jp-OutputPrompt {
9
+ display: none;
10
+ }
package/math.css ADDED
@@ -0,0 +1,6 @@
1
+ /* Hide katex generated equation numbers */
2
+ .katex .eqn-num {
3
+ opacity: 0;
4
+ user-select: none;
5
+ pointer-events: none;
6
+ }
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@myst-theme/styles",
3
+ "version": "0.0.1",
4
+ "main": "index.js",
5
+ "style": "app.css",
6
+ "scripts": {
7
+ "build": "tailwindcss -m -i ./app.css -o ../docs/public/tailwind.css",
8
+ "dev": "tailwindcss -w -i ./app.css -o ../docs/public/tailwind.css"
9
+ },
10
+ "author": "Rowan Cockett <rowan@curvenote.com>",
11
+ "license": "MIT",
12
+ "bugs": {
13
+ "url": "https://github.com/executablebooks/myst-theme/issues"
14
+ },
15
+ "homepage": "https://github.com/executablebooks/myst-theme",
16
+ "devDependencies": {
17
+ "@tailwindcss/typography": "^0.5.9",
18
+ "tailwindcss": "^3.2.4"
19
+ }
20
+ }
@@ -0,0 +1,15 @@
1
+ const mystTheme = require('@myst-theme/styles');
2
+
3
+ module.exports = {
4
+ darkMode: 'class',
5
+ content: [
6
+ // Look to the actual packages too works in development
7
+ '../packages/myst-to-react/src/**/*.{js,ts,jsx,tsx}',
8
+ '../packages/myst-demo/src/**/*.{js,ts,jsx,tsx}',
9
+ '../packages/site/src/**/*.{js,ts,jsx,tsx}',
10
+ '../packages/frontmatter/src/**/*.{js,ts,jsx,tsx}',
11
+ '../docs/stories/**/*.{js,ts,jsx,tsx,mdx}',
12
+ ],
13
+ theme: mystTheme.themeExtensions,
14
+ plugins: [require('@tailwindcss/typography')],
15
+ };
@@ -0,0 +1,6 @@
1
+ .text-spacer:after {
2
+ content: '\a0\2219\a0';
3
+ }
4
+ .text-comma:after {
5
+ content: ',\a0\a0';
6
+ }
package/typography.css ADDED
@@ -0,0 +1,39 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
5
+ @layer utilities {
6
+ .smallcaps {
7
+ font-variant: small-caps;
8
+ }
9
+ }
10
+
11
+ @layer base {
12
+ .prose table td {
13
+ @apply p-1 sm:p-2 align-top;
14
+ }
15
+ .prose table p,
16
+ .prose table li,
17
+ .prose figure table {
18
+ @apply mt-0 mb-0;
19
+ }
20
+ .prose table ul > li,
21
+ .prose table ol > li {
22
+ @apply pl-0;
23
+ }
24
+ .prose table tr:hover td {
25
+ @apply bg-slate-50 dark:bg-stone-800;
26
+ }
27
+ .prose dt > strong {
28
+ @apply font-bold text-blue-900 dark:text-blue-100;
29
+ }
30
+ .prose dd {
31
+ @apply ml-8;
32
+ }
33
+ article.content {
34
+ min-height: calc(100vh);
35
+ }
36
+ .article {
37
+ @apply prose max-w-none prose-stone dark:prose-invert break-words;
38
+ }
39
+ }