@abreen/tada 1.15.13 → 1.16.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.
Files changed (51) hide show
  1. package/README.md +4 -0
  2. package/assets/material-symbols/celebration_24px.svg +1 -0
  3. package/assets/material-symbols/close_24px.svg +1 -0
  4. package/assets/material-symbols/contrast_24px.svg +1 -0
  5. package/assets/material-symbols/contrast_rtl_off_24px.svg +1 -0
  6. package/assets/material-symbols/info_24px.svg +1 -0
  7. package/assets/material-symbols/menu_24px.svg +1 -0
  8. package/assets/material-symbols/north_east_24px.svg +1 -0
  9. package/assets/material-symbols/search_24px.svg +1 -0
  10. package/assets/material-symbols/south_east_24px.svg +1 -0
  11. package/assets/material-symbols/tag_24px.svg +1 -0
  12. package/assets/material-symbols/warning_24px.svg +1 -0
  13. package/bin/validators.ts +2 -0
  14. package/build/bundle.ts +7 -12
  15. package/build/generate-fonts.ts +17 -0
  16. package/build/material-symbols.ts +107 -0
  17. package/build/site-variables.ts +2 -0
  18. package/build/types.d.ts +2 -0
  19. package/build/utils/markdown.ts +11 -43
  20. package/build/utils/render.ts +24 -8
  21. package/build/watch/assets.ts +3 -3
  22. package/fonts/libertinus-mono/LICENSE.txt +99 -0
  23. package/fonts/libertinus-mono/woff2/LibertinusMono-Regular.woff2 +0 -0
  24. package/fonts/source-serif-4/LICENSE.txt +91 -0
  25. package/fonts/source-serif-4/woff2/SourceSerif4-Italic-VariableFont_opsz,wght.woff2 +0 -0
  26. package/fonts/source-serif-4/woff2/SourceSerif4-VariableFont_opsz,wght.woff2 +0 -0
  27. package/package.json +2 -1
  28. package/schema/site.schema.json +10 -0
  29. package/src/_alerts.scss +1 -1
  30. package/src/_base.scss +2 -16
  31. package/src/anchor/index.ts +14 -10
  32. package/src/anchor/style.scss +10 -10
  33. package/src/appearance-picker/index.ts +214 -0
  34. package/src/appearance-picker/style.scss +130 -0
  35. package/src/code.scss +1 -0
  36. package/src/header/_base.scss +34 -6
  37. package/src/header/style.scss +8 -0
  38. package/src/index.ts +2 -0
  39. package/src/material-symbols.scss +11 -0
  40. package/src/navigate/lifecycle.ts +2 -0
  41. package/src/search/style.scss +0 -1
  42. package/src/slides/style.scss +1 -0
  43. package/src/style.scss +30 -28
  44. package/src/toc/style.scss +3 -1
  45. package/src/trace/style.scss +1 -0
  46. package/templates/_appearance-picker.html +18 -0
  47. package/templates/_theme.scss +43 -13
  48. package/templates/_top.html +38 -2
  49. package/templates/code.html +1 -0
  50. package/templates/default.html +1 -0
  51. package/templates/literate.html +1 -0
package/src/style.scss CHANGED
@@ -37,6 +37,32 @@
37
37
  font-display: swap;
38
38
  }
39
39
 
40
+ @font-face {
41
+ font-family: 'Source Serif 4';
42
+ font-style: normal;
43
+ font-weight: 200 900;
44
+ src: url('source-serif-4/SourceSerif4-VariableFont_opsz,wght.woff2')
45
+ format('woff2');
46
+ font-display: swap;
47
+ }
48
+
49
+ @font-face {
50
+ font-family: 'Source Serif 4';
51
+ font-style: italic;
52
+ font-weight: 200 900;
53
+ src: url('source-serif-4/SourceSerif4-Italic-VariableFont_opsz,wght.woff2')
54
+ format('woff2');
55
+ font-display: swap;
56
+ }
57
+
58
+ @font-face {
59
+ font-family: 'Libertinus Mono';
60
+ font-style: normal;
61
+ font-weight: 400;
62
+ src: url('libertinus-mono/LibertinusMono-Regular.woff2') format('woff2');
63
+ font-display: swap;
64
+ }
65
+
40
66
  ::selection {
41
67
  color: var(--bg-color);
42
68
  background: var(--fg-color);
@@ -93,35 +119,14 @@ a.external:not(:has(.external-link-tail))::after {
93
119
  margin: 0;
94
120
  }
95
121
 
96
- .footnotes ol {
97
- padding-left: 0;
98
- list-style: none;
99
- }
100
-
101
122
  .footnotes li {
102
- position: relative;
103
- padding-left: 1.8em;
104
123
  margin-bottom: 8px;
105
124
  }
106
125
 
107
126
  a.footnote-ref {
108
127
  font-size: 0.8em;
109
- font-weight: 600;
110
- vertical-align: text-bottom;
111
- }
112
-
113
- .footnote-marker {
114
- @include user-select(none);
115
-
116
- position: absolute;
117
- top: 0;
118
- left: 0;
119
- font-weight: 500;
120
- }
121
-
122
- a.footnote-ref,
123
- .footnote-marker {
124
- font-feature-settings: 'ss06'; // squared numbers
128
+ vertical-align: super;
129
+ border-bottom: none;
125
130
  }
126
131
 
127
132
  .footnote-item {
@@ -131,10 +136,7 @@ a.footnote-ref,
131
136
  }
132
137
  }
133
138
 
134
- a.footnote-ref {
135
- @include user-select(none);
136
- }
137
-
139
+ a.footnote-ref,
138
140
  .footnotes .footnote-backref {
139
141
  display: inline-block;
140
142
 
@@ -416,7 +418,7 @@ a.breadcrumb {
416
418
  vertical-align: middle;
417
419
  content: '';
418
420
 
419
- @include contained-mask(var(--icon-breadcrumb));
421
+ @include contained-mask(var(--icon-parent));
420
422
  }
421
423
  }
422
424
 
@@ -17,6 +17,7 @@
17
17
  body.code .toc ol li:has(a) {
18
18
  font-family: var(--mono-font);
19
19
  font-size: var(--mono-font-size);
20
+ font-feature-settings: var(--mono-font-feature-settings);
20
21
  }
21
22
 
22
23
  body.code .toc ol a {
@@ -30,6 +31,7 @@ body.code .toc ol a {
30
31
  font-family: var(--mono-font);
31
32
  font-size: var(--font-size-small);
32
33
  font-style: italic;
34
+ font-feature-settings: var(--mono-font-feature-settings);
33
35
  text-align: center;
34
36
  content: 'On this page';
35
37
  }
@@ -144,7 +146,7 @@ body.code .toc ol a {
144
146
  }
145
147
 
146
148
  .toc ol li.alert-item.note a::before {
147
- @include contained-mask(var(--icon-note));
149
+ @include contained-mask(var(--icon-info));
148
150
  }
149
151
 
150
152
  .toc ol li.label {
@@ -186,6 +186,7 @@
186
186
  height: auto;
187
187
  font-family: var(--mono-font, monospace);
188
188
  font-size: 15px;
189
+ font-feature-settings: var(--mono-font-feature-settings, normal);
189
190
 
190
191
  .trace-separator {
191
192
  stroke: var(--fg2-color);
@@ -0,0 +1,18 @@
1
+ <div class="appearance-pickers" data-pagefind-ignore>
2
+ <div class="preference-picker font-picker" role="group" aria-label="Font style">
3
+ <button type="button" class="preference-picker-option font-picker-option-sans" data-font-preference-value="sans" aria-label="Use sans-serif fonts" aria-pressed="<%= site.defaultFont === 'sans' %>" disabled>
4
+ <span aria-hidden="true">Aa</span>
5
+ </button>
6
+ <button type="button" class="preference-picker-option font-picker-option-serif" data-font-preference-value="serif" aria-label="Use serif fonts" aria-pressed="<%= site.defaultFont === 'serif' %>" disabled>
7
+ <span aria-hidden="true">Aa</span>
8
+ </button>
9
+ </div>
10
+ <div class="preference-picker contrast-picker" role="group" aria-label="Contrast">
11
+ <button type="button" class="preference-picker-option contrast-picker-option-standard" data-contrast-preference-value="standard" aria-label="Use standard contrast" aria-pressed="<%= site.defaultContrast === 'standard' %>" disabled>
12
+ <span class="material-symbol-icon material-symbol-icon-contrast-standard" aria-hidden="true"></span>
13
+ </button>
14
+ <button type="button" class="preference-picker-option contrast-picker-option-high" data-contrast-preference-value="high" aria-label="Use high contrast" aria-pressed="<%= site.defaultContrast === 'high' %>" disabled>
15
+ <span class="material-symbol-icon material-symbol-icon-contrast-high" aria-hidden="true"></span>
16
+ </button>
17
+ </div>
18
+ </div>
@@ -36,13 +36,25 @@
36
36
  --box-shadow: 0 2px 9px
37
37
  hsl(var(--tint-hue) calc(85% * var(--tint-amount)) 10% / 25%);
38
38
  --backdrop-filter: blur(10px);
39
- --font:
39
+ --sans-font:
40
40
  'Inter', -apple-system, 'BlinkMacSystemFont', 'Segoe UI', 'Roboto',
41
41
  'Helvetica', 'Arial', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
42
42
  'Segoe UI Symbol';
43
+ --sans-mono-font: 'Google Sans Code', 'Consolas', 'Courier', monospace;
44
+ --serif-font: 'Source Serif 4', 'Times New Roman', 'Times', serif;
45
+ --serif-preview-font: 'Times New Roman', 'Times', serif;
46
+ --serif-mono-font: 'Libertinus Mono', 'Courier New', 'Courier', monospace;
47
+ --sans-font-feature-settings:
48
+ 'liga', 'calt', 'ss07', 'ss08', 'cv01', 'cv08', 'cv10';
49
+ --sans-mono-font-feature-settings: normal;
50
+ --serif-font-feature-settings: normal;
51
+ --serif-mono-font-feature-settings: normal;
52
+ --font: var(--sans-font);
43
53
  --heading-font: var(--font);
44
54
  --heading-line-height: 1.3;
45
- --mono-font: 'Google Sans Code', 'Consolas', 'Courier', monospace;
55
+ --mono-font: var(--sans-mono-font);
56
+ --font-feature-settings: var(--sans-font-feature-settings);
57
+ --mono-font-feature-settings: var(--sans-mono-font-feature-settings);
46
58
  --font-size: 1rem;
47
59
  --font-size-smaller: 0.9375em;
48
60
  --font-size-small: 0.8125em;
@@ -55,19 +67,30 @@
55
67
 
56
68
  // SVG icons
57
69
  // Mask icons (color-agnostic, painted via background-color: currentColor)
58
- --icon-external-link: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'><path d='M6 18 L20 4 M10 4 H20 V14' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>");
59
- --icon-anchor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 28'><path d='M11 4 L8 20 M17 4 L14 20 M5 9 H21 M3 15 H19' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>");
60
- --icon-warning: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M10.8 4.2 Q12 2 13.2 4.2 L20.8 17.9 Q22 20 19.6 20 H4.4 Q2 20 3.2 17.9 Z' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/><line x1='12' y1='9' x2='12' y2='13' stroke='black' stroke-width='2' stroke-linecap='square'/><line x1='12' y1='16' x2='12' y2='16' stroke='black' stroke-width='2' stroke-linecap='square'/></svg>");
61
- --icon-note: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='9.5' fill='none' stroke='black' stroke-width='1.5'/><line x1='12' y1='10' x2='12' y2='16' stroke='black' stroke-width='2' stroke-linecap='square'/><line x1='12' y1='7' x2='12' y2='7' stroke='black' stroke-width='2' stroke-linecap='square'/></svg>");
62
70
  --icon-check: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'><path d='M5 12.5 10 17 19 7' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>");
63
- --icon-search: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'><circle cx='11' cy='11' r='7' stroke='<%= iconColor %>' stroke-width='2' fill='none'/><line x1='16.5' y1='16.5' x2='22' y2='22' stroke='<%= iconColor %>' stroke-width='2' stroke-linecap='round'/></svg>");
64
- --icon-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><polyline points='9 18 15 12 9 6' stroke='<%= iconColor %>' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
65
- --icon-breadcrumb: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'><path d='M3 7 H17 V22' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/><polyline points='11 16 17 22 23 16' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/></svg>");
66
- --icon-tada: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 -960 960 960'><path d='m121-172 151-426q4-11 13.48-17.5 9.47-6.5 20.3-6.5 7.22 0 13.52 2.5T331-612l277 276q5 5.4 7.5 11.7 2.5 6.3 2.5 13.5 0 10.8-6.5 20.3T594-277L167-126q-11 4-20.53.97-9.54-3.04-16.47-9.97-6.93-6.93-9.97-16.47Q117-161 121-172Zm791-506q-8 8-17 8t-17-8l-17-17q-13.8-14-34.5-14T792-695L589-491q-7.36 7-17.18 7T555-491q-7-7-7-16.82t7-17.18l203-204q28.07-28 67.53-28Q865-757 894-729l18 18q7 7.09 7 16.55 0 9.45-7 16.45ZM418-797q7.36-7 17.18-7t16.82 7l17 17q27 28.53 27 67.77Q496-673 469-644l-17 17q-7.36 7-17.18 7T418-627q-7-7-7-16.82t7-17.18l17-17q14-13.79 14-33.5T435-745l-18-18q-7-7.09-7-16.55 0-9.45 8-17.45Zm119-50q7-7 16.82-7t17.18 7l51 51q29 29 29 68.47 0 39.46-29 67.53L521-559q-7.09 7-16.55 7-9.45 0-17.45-7t-8-17.18q0-10.18 8-17.82l101-101q14-13.6 14-34t-14-34l-51-50q-7-7.36-7-17.18t7-16.82Zm340 407q-7 7-16.82 7T843-440l-51-51q-13.6-14-34-14t-34 14l-68 68q-7.36 7-17.18 7T622-423q-7-7-7-16.82t7-17.18l68-68q29-27 68.5-27.5T826-525l51 51q7 7.36 7 17.18T877-440Z'/></svg>");
71
+ /* TADA_MATERIAL_SYMBOL_VARIABLES */
67
72
 
68
73
  color-scheme: light dark;
69
74
  }
70
75
 
76
+ :root[data-font-preference='serif'] {
77
+ --font: var(--serif-font);
78
+ --mono-font: var(--serif-mono-font);
79
+ --font-feature-settings: var(--serif-font-feature-settings);
80
+ --mono-font-feature-settings: var(--serif-mono-font-feature-settings);
81
+ }
82
+
83
+ :root[data-contrast-preference='high'] {
84
+ --fg-color: hsl(0deg 0% 0%);
85
+ --fg-color-translucent: hsl(0deg 0% 0% / 33%);
86
+ --fg2-color: hsl(0deg 0% 30%);
87
+ --bg-color: hsl(0deg 0% 100%);
88
+ --bg-color-translucent: hsl(0deg 0% 100% / 66%);
89
+ --bg2-color: #f4f4f4;
90
+ --bg2-color-translucent: rgb(244 244 244 / 66%);
91
+ --box-shadow: 0 2px 9px hsl(0deg 0% 0% / 25%);
92
+ }
93
+
71
94
  @media (prefers-color-scheme: dark) {
72
95
  :root {
73
96
  --theme-color: <%= themeColorDark %>;
@@ -94,9 +117,16 @@
94
117
  --link-active-color: #fff;
95
118
  --warning-bg-color: hsl(36deg 77% 27%);
96
119
  --note-bg-color: hsl(209deg 90% 25%);
120
+ }
97
121
 
98
- // SVG icons (dark overrides)
99
- --icon-search: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'><circle cx='11' cy='11' r='7' stroke='<%= iconColorDark %>' stroke-width='2' fill='none'/><line x1='16.5' y1='16.5' x2='22' y2='22' stroke='<%= iconColorDark %>' stroke-width='2' stroke-linecap='round'/></svg>");
100
- --icon-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><polyline points='9 18 15 12 9 6' stroke='<%= iconColorDark %>' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
122
+ :root[data-contrast-preference='high'] {
123
+ --fg-color: hsl(0deg 0% 100%);
124
+ --fg-color-translucent: hsl(0deg 0% 100% / 33%);
125
+ --fg2-color: hsl(0deg 0% 70%);
126
+ --bg-color: hsl(0deg 0% 0%);
127
+ --bg-color-translucent: hsl(0deg 0% 0% / 66%);
128
+ --bg2-color: hsl(0deg 0% 15%);
129
+ --bg2-color-translucent: hsl(0deg 0% 15% / 66%);
130
+ --box-shadow: 0 3px 8px hsl(0deg 0% 0% / 70%);
101
131
  }
102
132
  }
@@ -1,5 +1,9 @@
1
1
  <!doctype html>
2
- <html lang="en">
2
+ <html lang="en"
3
+ data-default-font-preference="<%= site.defaultFont %>"
4
+ data-default-contrast-preference="<%= site.defaultContrast %>"<% if (site.defaultFont === 'serif') { %>
5
+ data-font-preference="serif"<% } %><% if (site.defaultContrast === 'high') { %>
6
+ data-contrast-preference="high"<% } %>>
3
7
  <head>
4
8
  <% if (site.features.favicon) { %>
5
9
  <link rel="icon" href="/favicon.ico" sizes="any" />
@@ -33,7 +37,39 @@
33
37
  <meta property="og:author" content="<%= page.author.name %>" />
34
38
  <% } %>
35
39
  <title><%= page.title %><%= site.titlePostfix %></title>
36
- <script>document.documentElement.classList.add('js')</script>
40
+ <script>
41
+ document.documentElement.classList.add('js');
42
+ try {
43
+ const preference = window.localStorage.getItem('fontPreference');
44
+ const configured =
45
+ document.documentElement.dataset.defaultFontPreference;
46
+ if (
47
+ (preference === 'serif' || preference === 'sans') &&
48
+ preference !== configured
49
+ ) {
50
+ if (preference === 'serif') {
51
+ document.documentElement.dataset.fontPreference = 'serif';
52
+ } else {
53
+ delete document.documentElement.dataset.fontPreference;
54
+ }
55
+ }
56
+ } catch {}
57
+ try {
58
+ const preference = window.localStorage.getItem('contrastPreference');
59
+ const configured =
60
+ document.documentElement.dataset.defaultContrastPreference;
61
+ if (
62
+ (preference === 'high' || preference === 'standard') &&
63
+ preference !== configured
64
+ ) {
65
+ if (preference === 'high') {
66
+ document.documentElement.dataset.contrastPreference = 'high';
67
+ } else {
68
+ delete document.documentElement.dataset.contrastPreference;
69
+ }
70
+ }
71
+ } catch {}
72
+ </script>
37
73
  <% if (!isWatchMode) { %>
38
74
  <script type="speculationrules">
39
75
  {
@@ -23,6 +23,7 @@
23
23
  </div>
24
24
  <% } %>
25
25
  <%= render('_footer.html') %>
26
+ <%= render('_appearance-picker.html') %>
26
27
  </main>
27
28
  <% if (page.tocHtml) { %>
28
29
  <nav class="toc"><%= page.tocHtml %></nav>
@@ -14,6 +14,7 @@
14
14
  <% } %>
15
15
  <%= content %>
16
16
  <%= render('_footer.html') %>
17
+ <%= render('_appearance-picker.html') %>
17
18
  </main>
18
19
  <% if (page.toc && page.tocHtml) { %>
19
20
  <nav class="toc"><%= page.tocHtml %></nav>
@@ -8,6 +8,7 @@
8
8
  </div>
9
9
  <%= content %>
10
10
  <%= render('_footer.html') %>
11
+ <%= render('_appearance-picker.html') %>
11
12
  </main>
12
13
  <% if (page.toc && page.tocHtml) { %>
13
14
  <nav class="toc"><%= page.tocHtml %></nav>