@abreen/tada 1.16.1 → 1.16.3

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 (57) hide show
  1. package/README.md +15 -0
  2. package/assets/material-symbols/celebration_24px.svg +1 -1
  3. package/assets/material-symbols/close_24px.svg +1 -1
  4. package/assets/material-symbols/contrast_20px.svg +1 -0
  5. package/assets/material-symbols/contrast_rtl_off_20px.svg +1 -0
  6. package/assets/material-symbols/info_20px.svg +1 -0
  7. package/assets/material-symbols/info_40px.svg +1 -0
  8. package/assets/material-symbols/menu_24px.svg +1 -1
  9. package/assets/material-symbols/open_in_new_20px.svg +1 -0
  10. package/assets/material-symbols/search_20px.svg +1 -0
  11. package/assets/material-symbols/smart_display_24px.svg +1 -0
  12. package/assets/material-symbols/south_east_20px.svg +1 -0
  13. package/assets/material-symbols/warning_20px.svg +1 -0
  14. package/assets/material-symbols/warning_40px.svg +1 -0
  15. package/build/bundle.ts +23 -4
  16. package/build/custom-fonts.ts +313 -0
  17. package/build/generate-fonts.ts +29 -3
  18. package/build/material-symbols.ts +58 -20
  19. package/build/pipeline.ts +1 -1
  20. package/build/types.d.ts +29 -0
  21. package/build/utils/render.ts +13 -5
  22. package/build/watch/build-full.ts +1 -1
  23. package/build/watch/build-incremental.ts +1 -1
  24. package/build/watch/validation.ts +18 -7
  25. package/init/content/markdown.md +2 -1
  26. package/package.json +2 -2
  27. package/schema/site.schema.json +70 -0
  28. package/src/_alerts.scss +17 -12
  29. package/src/_base.scss +10 -0
  30. package/src/_layout.scss +2 -2
  31. package/src/anchor/index.ts +2 -35
  32. package/src/anchor/style.scss +4 -28
  33. package/src/appearance-picker/index.ts +18 -5
  34. package/src/appearance-picker/style.scss +3 -13
  35. package/src/code.scss +1 -0
  36. package/src/header/_base.scss +10 -6
  37. package/src/material-symbols.scss +16 -3
  38. package/src/navigate/runtime.ts +13 -0
  39. package/src/question/style.scss +1 -2
  40. package/src/search/style.scss +5 -3
  41. package/src/style.scss +15 -7
  42. package/src/timezone/index.ts +42 -2
  43. package/src/timezone/style.scss +0 -6
  44. package/src/timezone/time-format.ts +13 -0
  45. package/src/toc/style.scss +16 -10
  46. package/src/trace/style.scss +1 -0
  47. package/templates/_theme.scss +16 -4
  48. package/templates/_top.html +23 -11
  49. package/templates/code.html +1 -1
  50. package/assets/material-symbols/contrast_24px.svg +0 -1
  51. package/assets/material-symbols/contrast_rtl_off_24px.svg +0 -1
  52. package/assets/material-symbols/info_24px.svg +0 -1
  53. package/assets/material-symbols/north_east_24px.svg +0 -1
  54. package/assets/material-symbols/search_24px.svg +0 -1
  55. package/assets/material-symbols/south_east_24px.svg +0 -1
  56. package/assets/material-symbols/tag_24px.svg +0 -1
  57. package/assets/material-symbols/warning_24px.svg +0 -1
@@ -127,7 +127,9 @@ header {
127
127
  }
128
128
 
129
129
  ol a .title {
130
- font-weight: 500;
130
+ // Values above 500 resolve to the supplied bold face when a custom
131
+ // family provides only fixed 400 and 700 weights.
132
+ font-weight: 600;
131
133
  line-height: var(--heading-line-height);
132
134
  }
133
135
 
@@ -138,10 +140,10 @@ header {
138
140
 
139
141
  ol li .excerpt {
140
142
  grid-row-start: 3;
141
- height: 7.5ex;
143
+ height: 4.2em;
142
144
  overflow: hidden;
143
145
  font-size: var(--font-size-small);
144
- line-height: 2.5ex;
146
+ line-height: 1.4;
145
147
  color: var(--fg2-color);
146
148
 
147
149
  mark {
package/src/style.scss CHANGED
@@ -3,6 +3,8 @@
3
3
  @use 'base';
4
4
  @use 'layout';
5
5
  @use 'alerts';
6
+ @include theme.custom-font-faces;
7
+ @include theme.custom-font-tuning;
6
8
 
7
9
  @font-face {
8
10
  font-family: Inter;
@@ -93,9 +95,9 @@ a.disabled {
93
95
  .external-link-tail::after,
94
96
  a.external:not(:has(.external-link-tail))::after {
95
97
  display: inline-block;
96
- width: 1em;
97
- height: 1em;
98
- vertical-align: middle;
98
+ width: var(--icon-external-link-size);
99
+ height: var(--icon-external-link-size);
100
+ vertical-align: text-top;
99
101
  content: '';
100
102
 
101
103
  @include contained-mask(var(--icon-external-link));
@@ -272,6 +274,10 @@ ol {
272
274
  list-style-type: decimal;
273
275
  }
274
276
 
277
+ :root[data-font-preference='serif'] ol > li::marker {
278
+ font-variant-numeric: oldstyle-nums;
279
+ }
280
+
275
281
  ol ol {
276
282
  list-style-type: lower-alpha;
277
283
  }
@@ -385,9 +391,11 @@ h6.has-subtitle {
385
391
  }
386
392
 
387
393
  .small-caps {
388
- font-size: 0.9em;
389
- font-weight: 600;
394
+ margin-right: -0.05em;
395
+ font-variant-caps: all-small-caps;
396
+ font-synthesis-small-caps: none;
390
397
  text-transform: uppercase;
398
+ letter-spacing: 0.05em;
391
399
  }
392
400
 
393
401
  dl {
@@ -413,8 +421,8 @@ a.breadcrumb {
413
421
 
414
422
  &::after {
415
423
  display: inline-block;
416
- width: 1em;
417
- height: 1em;
424
+ width: var(--icon-parent-size);
425
+ height: var(--icon-parent-size);
418
426
  vertical-align: middle;
419
427
  content: '';
420
428
 
@@ -3,6 +3,7 @@ import {
3
3
  detectPeriodStyle,
4
4
  normalizeHM,
5
5
  to12Hour,
6
+ to12HourMarkup,
6
7
  type PeriodStyle,
7
8
  } from './time-format';
8
9
 
@@ -22,6 +23,23 @@ function parseHHMM(hhmm: string) {
22
23
  return Number(h) * 60 + Number(m);
23
24
  }
24
25
 
26
+ function getRangeEnd(el: HTMLTimeElement): HTMLTimeElement | null {
27
+ const separator = el.nextSibling;
28
+ const candidate = separator?.nextSibling;
29
+ if (
30
+ separator?.nodeType !== 3 ||
31
+ !/^\s*(?:--|–|—)\s*$/.test(separator.textContent ?? '') ||
32
+ candidate?.nodeType !== 1
33
+ ) {
34
+ return null;
35
+ }
36
+
37
+ const end = candidate as HTMLElement;
38
+ return end.tagName === 'TIME' && end.hasAttribute('datetime')
39
+ ? (end as HTMLTimeElement)
40
+ : null;
41
+ }
42
+
25
43
  // Compute UTC offset (in minutes) for a time zone at given date (DST-aware)
26
44
  function getOffsetMinutes(tz: string, date: Date): number {
27
45
  const dtf = new Intl.DateTimeFormat('en-US', {
@@ -172,11 +190,33 @@ export default (window: Window) => {
172
190
  const originalStyle = periodStyles.get(el) ?? null;
173
191
  const originalIsPm = Math.floor(baseMinutes / 60) >= 12;
174
192
  const periodChanged = originalIsPm !== h >= 12 || dayShift !== 0;
175
- const style =
193
+ let style =
176
194
  originalStyle === null && periodChanged
177
195
  ? pagePeriodStyle
178
196
  : originalStyle;
179
- el.innerHTML = to12Hour(h, m, style) + suffix;
197
+
198
+ const rangeEnd = getRangeEnd(el);
199
+ const rangeEndDatetime = rangeEnd?.getAttribute('datetime');
200
+ const rangeEndMinutes = rangeEndDatetime
201
+ ? parseHHMM(rangeEndDatetime)
202
+ : NaN;
203
+ if (
204
+ originalStyle === null &&
205
+ rangeEnd !== null &&
206
+ !isNaN(rangeEndMinutes)
207
+ ) {
208
+ const [rangeEndHour] = normalizeHM(rangeEndMinutes + deltaMinutes);
209
+ style =
210
+ h >= 12 === rangeEndHour >= 12
211
+ ? null
212
+ : (periodStyles.get(rangeEnd) ?? pagePeriodStyle);
213
+ }
214
+
215
+ const timeZone =
216
+ isDefault || style === null || rangeEnd !== null
217
+ ? ''
218
+ : ` <span class="small-caps">${target.abbreviation}</span>`;
219
+ el.innerHTML = to12HourMarkup(h, m, style) + timeZone + suffix;
180
220
 
181
221
  if (isDefault) {
182
222
  el.classList.remove('is-modified');
@@ -1,9 +1,3 @@
1
- time[datetime] {
2
- &.is-modified {
3
- text-decoration: var(--fg2-color) underline dotted;
4
- }
5
- }
6
-
7
1
  span.next-prev-day {
8
2
  font-style: italic;
9
3
  color: var(--fg2-color);
@@ -35,6 +35,19 @@ export function to12Hour(
35
35
  return `${hour12}:${pad(m)} ${period}`;
36
36
  }
37
37
 
38
+ export function to12HourMarkup(
39
+ h: number,
40
+ m: number,
41
+ style: PeriodStyle | null = DEFAULT_PERIOD_STYLE,
42
+ ) {
43
+ const hour12 = ((h + 11) % 12) + 1;
44
+ if (!style) {
45
+ return `${hour12}:${pad(m)}`;
46
+ }
47
+ const period = h >= 12 ? style[1] : style[0];
48
+ return `${hour12}:${pad(m)} <span class="small-caps">${period}</span>`;
49
+ }
50
+
38
51
  export function normalizeHM(totalMinutes: number) {
39
52
  const mins = ((totalMinutes % 1440) + 1440) % 1440;
40
53
  const h = Math.floor(mins / 60);
@@ -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-size-adjust: var(--mono-font-size-adjust);
20
21
  font-feature-settings: var(--mono-font-feature-settings);
21
22
  }
22
23
 
@@ -30,6 +31,7 @@ body.code .toc ol a {
30
31
  display: block;
31
32
  font-family: var(--mono-font);
32
33
  font-size: var(--font-size-small);
34
+ font-size-adjust: var(--mono-font-size-adjust);
33
35
  font-style: italic;
34
36
  font-feature-settings: var(--mono-font-feature-settings);
35
37
  text-align: center;
@@ -131,22 +133,26 @@ body.code .toc ol a {
131
133
  position: relative;
132
134
  }
133
135
 
136
+ .toc ol li.alert-item.warning {
137
+ --toc-alert-icon: var(--icon-warning-compact);
138
+ --toc-alert-icon-size: var(--icon-warning-compact-size);
139
+ }
140
+
141
+ .toc ol li.alert-item.note {
142
+ --toc-alert-icon: var(--icon-info-compact);
143
+ --toc-alert-icon-size: var(--icon-info-compact-size);
144
+ }
145
+
134
146
  .toc ol li.alert-item.warning a::before,
135
147
  .toc ol li.alert-item.note a::before {
136
148
  display: inline-block;
137
- width: 20px;
138
- height: 20px;
149
+ width: var(--toc-alert-icon-size);
150
+ height: var(--toc-alert-icon-size);
139
151
  margin-right: 4px;
140
- vertical-align: bottom;
152
+ vertical-align: sub;
141
153
  content: '';
142
- }
143
-
144
- .toc ol li.alert-item.warning a::before {
145
- @include contained-mask(var(--icon-warning));
146
- }
147
154
 
148
- .toc ol li.alert-item.note a::before {
149
- @include contained-mask(var(--icon-info));
155
+ @include contained-mask(var(--toc-alert-icon));
150
156
  }
151
157
 
152
158
  .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-size-adjust: var(--mono-font-size-adjust, none);
189
190
  font-feature-settings: var(--mono-font-feature-settings, normal);
190
191
 
191
192
  .trace-separator {
@@ -1,3 +1,13 @@
1
+ @mixin custom-font-faces {
2
+ /* Site-configured font faces are inserted below. */
3
+ /* TADA_CUSTOM_FONT_FACES */
4
+ }
5
+
6
+ @mixin custom-font-tuning {
7
+ /* Site-configured font tuning is inserted below. */
8
+ /* TADA_CUSTOM_FONT_TUNING */
9
+ }
10
+
1
11
  :root {
2
12
  --theme-color: <%= themeColorLight %>;
3
13
  --theme-color-text: <%= themeColorTextLight %>;
@@ -41,20 +51,22 @@
41
51
  'Helvetica', 'Arial', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
42
52
  'Segoe UI Symbol';
43
53
  --sans-mono-font: 'Google Sans Code', 'Consolas', 'Courier', monospace;
44
- --serif-font: 'Source Serif 4', 'Times New Roman', 'Times', serif;
54
+ --serif-font: <%= serifFontStack %>;
45
55
  --serif-preview-font: 'Times New Roman', 'Times', serif;
46
- --serif-mono-font: 'Libertinus Mono', 'Courier New', 'Courier', monospace;
56
+ --serif-mono-font: <%= serifMonoFontStack %>;
47
57
  --sans-font-feature-settings:
48
58
  'liga', 'calt', 'ss07', 'ss08', 'cv01', 'cv08', 'cv10';
49
59
  --sans-mono-font-feature-settings: normal;
50
- --serif-font-feature-settings: normal;
51
- --serif-mono-font-feature-settings: normal;
60
+ --serif-font-feature-settings: <%= serifFontFeatureSettings %>;
61
+ --serif-mono-font-feature-settings: <%= serifMonoFontFeatureSettings %>;
52
62
  --font: var(--sans-font);
53
63
  --heading-font: var(--font);
54
64
  --heading-line-height: 1.3;
55
65
  --mono-font: var(--sans-mono-font);
56
66
  --font-feature-settings: var(--sans-font-feature-settings);
57
67
  --mono-font-feature-settings: var(--sans-mono-font-feature-settings);
68
+ --font-size-adjust: none;
69
+ --mono-font-size-adjust: none;
58
70
  --font-size: 1rem;
59
71
  --font-size-smaller: 0.9375em;
60
72
  --font-size-small: 0.8125em;
@@ -54,21 +54,33 @@
54
54
  }
55
55
  }
56
56
  } catch {}
57
+ let contrastPreference;
57
58
  try {
58
- const preference = window.localStorage.getItem('contrastPreference');
59
- const configured =
60
- document.documentElement.dataset.defaultContrastPreference;
59
+ contrastPreference = window.localStorage.getItem('contrastPreference');
60
+ } catch {}
61
+ const configuredContrast =
62
+ document.documentElement.dataset.defaultContrastPreference;
63
+ if (
64
+ contrastPreference !== 'high' &&
65
+ contrastPreference !== 'standard'
66
+ ) {
67
+ contrastPreference = configuredContrast;
61
68
  if (
62
- (preference === 'high' || preference === 'standard') &&
63
- preference !== configured
69
+ configuredContrast !== 'high' &&
70
+ typeof window.matchMedia === 'function'
64
71
  ) {
65
- if (preference === 'high') {
66
- document.documentElement.dataset.contrastPreference = 'high';
67
- } else {
68
- delete document.documentElement.dataset.contrastPreference;
69
- }
72
+ try {
73
+ if (window.matchMedia('(prefers-contrast: more)').matches) {
74
+ contrastPreference = 'high';
75
+ }
76
+ } catch {}
70
77
  }
71
- } catch {}
78
+ }
79
+ if (contrastPreference === 'high') {
80
+ document.documentElement.dataset.contrastPreference = 'high';
81
+ } else {
82
+ delete document.documentElement.dataset.contrastPreference;
83
+ }
72
84
  </script>
73
85
  <% if (!isWatchMode) { %>
74
86
  <script type="speculationrules">
@@ -3,7 +3,7 @@
3
3
  <div class="main-content">
4
4
  <main class="body" data-pagefind-body>
5
5
  <div class="file-header">
6
- <h1 data-pagefind-weight="10" data-pagefind-meta="title_html[data-title-html]" data-title-html="<%- page.titleHtml %>"><%= page.titleHtml %></h1>
6
+ <h1 class="file-title" data-pagefind-weight="10" data-pagefind-meta="title_html[data-title-html]" data-title-html="<%- page.titleHtml %>"><%= page.titleHtml %></h1>
7
7
  <%= render('_download.html') %>
8
8
  </div>
9
9
  <div class="code-body">
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm40-83q119-15 199.5-104.5T800-480q0-123-80.5-212.5T520-797v634Z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M819-28 701-146q-48 32-103.5 49T480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-62 17-117.5T146-701L27-820l57-57L876-85l-57 57ZM480-160q45 0 85.5-12t76.5-33L480-367v207Zm335-100-59-59q21-35 32.5-75.5T800-480q0-133-93.5-226.5T480-800v205L260-815q48-31 103.5-48T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 61-17 116.5T815-260Z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M440-280h80v-240h-80v240Zm40-320q17 0 28.5-11.5T520-640q0-17-11.5-28.5T480-680q-17 0-28.5 11.5T440-640q0 17 11.5 28.5T480-600Zm0 520q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm0-80q134 0 227-93t93-227q0-134-93-227t-227-93q-134 0-227 93t-93 227q0 134 93 227t227 93Zm0-320Z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m216-160-56-56 464-464H360v-80h400v400h-80v-264L216-160Z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M784-120 532-372q-30 24-69 38t-83 14q-109 0-184.5-75.5T120-580q0-109 75.5-184.5T380-840q109 0 184.5 75.5T640-580q0 44-14 83t-38 69l252 252-56 56ZM380-400q75 0 127.5-52.5T560-580q0-75-52.5-127.5T380-760q-75 0-127.5 52.5T200-580q0 75 52.5 127.5T380-400Z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="M360-200v-80h264L160-744l56-56 464 464v-264h80v400H360Z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m240-160 40-160H120l20-80h160l40-160H180l20-80h160l40-160h80l-40 160h160l40-160h80l-40 160h160l-20 80H660l-40 160h160l-20 80H600l-40 160h-80l40-160H360l-40 160h-80Zm140-240h160l40-160H420l-40 160Z"/></svg>
@@ -1 +0,0 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 -960 960 960" width="24"><path d="m40-120 440-760 440 760H40Zm138-80h604L480-720 178-200Zm302-40q17 0 28.5-11.5T520-280q0-17-11.5-28.5T480-320q-17 0-28.5 11.5T440-280q0 17 11.5 28.5T480-240Zm-40-120h80v-200h-80v200Zm40-100Z"/></svg>