@abreen/tada 1.17.1 → 1.18.0

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 (101) hide show
  1. package/README.md +37 -6
  2. package/bin/tada.ts +16 -7
  3. package/bin/validators.ts +33 -0
  4. package/build/branding.ts +41 -0
  5. package/build/build-manifest.ts +9 -4
  6. package/build/{watch/compiler-types.d.ts → build-types.d.ts} +8 -5
  7. package/build/build-validation.ts +176 -0
  8. package/build/bundle.ts +75 -65
  9. package/build/config-loader.ts +3 -3
  10. package/build/custom-fonts.ts +8 -5
  11. package/build/generate-favicon.ts +7 -6
  12. package/build/generate-fonts.ts +8 -15
  13. package/build/generate-katex-assets.ts +19 -17
  14. package/build/generate-web-app-manifest.ts +3 -11
  15. package/build/lodash-template.ts +14 -0
  16. package/build/output-publication.ts +238 -0
  17. package/build/pagefind.ts +49 -21
  18. package/build/pdf-text.ts +41 -1
  19. package/build/pipeline.ts +95 -101
  20. package/build/site-assets.ts +46 -0
  21. package/build/site-build.ts +267 -0
  22. package/build/source-model.ts +223 -244
  23. package/build/source-records.ts +69 -81
  24. package/build/template-globals.ts +3 -0
  25. package/build/templates.ts +5 -2
  26. package/build/toc-plugin.ts +21 -21
  27. package/build/types.d.ts +38 -38
  28. package/build/util.ts +0 -4
  29. package/build/utils/code.ts +38 -101
  30. package/build/utils/final-html.ts +171 -47
  31. package/build/utils/literate-java.ts +11 -7
  32. package/build/utils/markdown-partials.ts +4 -3
  33. package/build/utils/markdown.ts +6 -17
  34. package/build/utils/paths.ts +3 -0
  35. package/build/utils/plain-text.ts +18 -0
  36. package/build/utils/render.ts +197 -154
  37. package/build/utils/shiki-highlighter.ts +11 -0
  38. package/build/utils/source-template.ts +2 -2
  39. package/build/utils/trace-core.ts +8 -83
  40. package/build/utils/trace.ts +38 -95
  41. package/build/validate-config-links.ts +5 -5
  42. package/build/watch/build-incremental.ts +46 -103
  43. package/build/watch/compiler.ts +158 -37
  44. package/build/watch/engine.ts +207 -176
  45. package/build/watch/index.ts +9 -2
  46. package/build/watch/planner.ts +88 -144
  47. package/build/watch/runtime.ts +21 -34
  48. package/build/watch/types.d.ts +32 -64
  49. package/package.json +4 -4
  50. package/schema/site.schema.json +18 -2
  51. package/src/_content.scss +447 -0
  52. package/src/_fonts.scss +90 -0
  53. package/src/_layout.scss +50 -35
  54. package/src/appearance-picker/{style.scss → _index.scss} +1 -1
  55. package/src/code/{style.scss → _index.scss} +61 -0
  56. package/src/header/{_base.scss → _index.scss} +98 -6
  57. package/src/index.ts +1 -17
  58. package/src/navigate/{style.scss → _index.scss} +20 -0
  59. package/src/navigate/eligible.ts +0 -40
  60. package/src/navigate/index.ts +38 -4
  61. package/src/navigate/lifecycle.ts +19 -2
  62. package/src/navigate/runtime.ts +20 -4
  63. package/src/page-update/index.ts +33 -20
  64. package/src/print/{style.scss → _index.scss} +3 -1
  65. package/src/search/index.ts +7 -0
  66. package/src/slides/{style.scss → _index.scss} +5 -0
  67. package/src/style.scss +24 -536
  68. package/src/toc/index.ts +2 -2
  69. package/templates/_author.html +2 -2
  70. package/templates/_download.html +1 -1
  71. package/templates/_footer.html +1 -1
  72. package/templates/_heading.html +3 -3
  73. package/templates/_nav.html +2 -2
  74. package/templates/_page-bottom.html +6 -0
  75. package/templates/_top.html +18 -14
  76. package/templates/code.html +22 -21
  77. package/templates/default.html +12 -11
  78. package/templates/literate.html +6 -5
  79. package/build/copy.ts +0 -82
  80. package/build/generate-content-assets.ts +0 -121
  81. package/build/utils/content-files.ts +0 -170
  82. package/build/watch/assets.ts +0 -103
  83. package/build/watch/build-full.ts +0 -97
  84. package/build/watch/build-helpers.ts +0 -66
  85. package/build/watch/build-result.ts +0 -19
  86. package/build/watch/fs-commit.ts +0 -218
  87. package/build/watch/mutations.ts +0 -73
  88. package/build/watch/snapshot.ts +0 -201
  89. package/build/watch/validation.ts +0 -57
  90. package/src/code.scss +0 -60
  91. package/src/critical.scss +0 -5
  92. package/src/header/style.scss +0 -91
  93. /package/src/{literate.scss → _literate.scss} +0 -0
  94. /package/src/{material-symbols.scss → _material-symbols.scss} +0 -0
  95. /package/src/anchor/{style.scss → _index.scss} +0 -0
  96. /package/src/page-update/{style.scss → _index.scss} +0 -0
  97. /package/src/question/{style.scss → _index.scss} +0 -0
  98. /package/src/search/{style.scss → _index.scss} +0 -0
  99. /package/src/timezone/{style.scss → _index.scss} +0 -0
  100. /package/src/toc/{style.scss → _index.scss} +0 -0
  101. /package/src/trace/{style.scss → _index.scss} +0 -0
@@ -1,57 +0,0 @@
1
- import path from 'path';
2
- import { B } from '../colors';
3
- import { makeLogger } from '../log';
4
- import { config, getConfigFileName } from '../templates';
5
- import { validateConfigLinks } from '../validate-config-links';
6
- import { validateCustomFontOverrides } from '../custom-fonts';
7
- import type { SiteVariables } from '../types';
8
- import type { WatchDiagnostic } from './types';
9
- import { assertNoOutputPathConflicts, type TadaProjectScan } from './snapshot';
10
-
11
- const log = makeLogger(import.meta.url);
12
-
13
- export function diagnosticsFromMessages(messages: string[]): WatchDiagnostic[] {
14
- return messages.map(message => ({ message }));
15
- }
16
-
17
- export function validateConfig(
18
- scan: TadaProjectScan,
19
- siteVariables: SiteVariables,
20
- ): WatchDiagnostic[] {
21
- const diagnostics = diagnosticsFromMessages(
22
- validateCustomFontOverrides({
23
- fontOverrides: siteVariables.fontOverrides,
24
- publicDir: scan.publicDir,
25
- publicFiles: scan.publicFiles,
26
- }),
27
- );
28
- const conflicts = assertNoOutputPathConflicts(scan);
29
- if (conflicts.length === 0) {
30
- return diagnostics;
31
- }
32
- for (const relPath of conflicts) {
33
- const sources = [...scan.sourceOutputPaths]
34
- .filter(([, outputs]) => outputs.has(relPath))
35
- .map(([sourcePath]) =>
36
- path.relative(path.dirname(scan.contentDir), sourcePath),
37
- )
38
- .sort();
39
- log.error`${sources.join(' conflicts with ')}: same output path ${B`${relPath}`}`;
40
- }
41
- const noun = conflicts.length === 1 ? 'file' : 'files';
42
- diagnostics.push({
43
- message: `${conflicts.length} output ${noun} ${conflicts.length === 1 ? 'has' : 'have'} multiple sources with the same path`,
44
- });
45
- return diagnostics;
46
- }
47
-
48
- export function validateProjectConfigLinks(
49
- validTargets: Set<string>,
50
- ): WatchDiagnostic[] {
51
- return diagnosticsFromMessages(
52
- validateConfigLinks(validTargets, config('nav'), config('authors'), {
53
- navFileName: getConfigFileName('nav'),
54
- authorsFileName: getConfigFileName('authors'),
55
- }),
56
- );
57
- }
package/src/code.scss DELETED
@@ -1,60 +0,0 @@
1
- @use 'mixins' as *;
2
-
3
- body.code {
4
- --code-gutter-width: 4rem;
5
- }
6
-
7
- .file-header,
8
- .slides-header {
9
- display: flex;
10
- gap: var(--gap);
11
- align-items: center;
12
- justify-content: center;
13
- padding: var(--gap);
14
- margin-bottom: var(--gap);
15
- border: 1px solid var(--fg2-color);
16
- border-radius: var(--border-radius);
17
-
18
- tt,
19
- code {
20
- padding: 0;
21
- background: none;
22
- }
23
- }
24
-
25
- .code-row {
26
- display: grid;
27
- grid-template-columns: var(--code-gutter-width) 1fr;
28
- }
29
-
30
- .line-number {
31
- position: sticky;
32
- left: 0;
33
- z-index: 1;
34
- display: block;
35
- padding: 0 0.75em;
36
- margin-right: var(--gap);
37
- font-family: var(--mono-font);
38
- font-size-adjust: var(--mono-font-size-adjust);
39
- font-feature-settings: var(--mono-font-feature-settings);
40
- color: var(--fg2-color);
41
- text-align: right;
42
- text-decoration: none;
43
- background: var(--bg2-color);
44
- border-right: 1px solid var(--fg2-color);
45
-
46
- @include user-select(none);
47
- }
48
-
49
- a.line-number {
50
- cursor: pointer;
51
-
52
- &:hover {
53
- color: var(--fg-color);
54
- }
55
-
56
- &:target {
57
- color: var(--bg-color);
58
- background: var(--fg2-color);
59
- }
60
- }
package/src/critical.scss DELETED
@@ -1,5 +0,0 @@
1
- @use 'config/theme';
2
- @use 'base';
3
- @use 'layout';
4
- @use 'alerts';
5
- @use 'header/base' as *;
@@ -1,91 +0,0 @@
1
- @use '../mixins' as *;
2
- @use 'base';
3
-
4
- header nav {
5
- display: flex;
6
- flex-wrap: wrap;
7
-
8
- @include user-select(none);
9
-
10
- gap: var(--gap);
11
- margin: var(--gap);
12
- }
13
-
14
- header nav div {
15
- flex: 1 1 150px;
16
- }
17
-
18
- header nav ul {
19
- padding: 0;
20
- margin: 8px 0 0;
21
- list-style-type: none;
22
- }
23
-
24
- header nav ul li {
25
- margin: 0;
26
- }
27
-
28
- header nav a {
29
- display: inline;
30
- border: none;
31
-
32
- @include subdued-link;
33
- }
34
-
35
- header nav a.external {
36
- border: none;
37
- }
38
-
39
- @media only screen and (width >= 740px) {
40
- header details nav {
41
- min-height: 100px;
42
- }
43
- }
44
-
45
- header nav div > p {
46
- padding-bottom: 2px;
47
- font-style: italic;
48
- border-bottom: 1px solid var(--fg-color);
49
-
50
- @include user-select(none);
51
- }
52
-
53
- :root[data-contrast-preference='high'] header:has(details[open]) {
54
- background: var(--bg2-color);
55
- }
56
-
57
- @media (hover: hover) {
58
- header:has(details[open]):hover {
59
- background: var(--bg-color-translucent);
60
- }
61
-
62
- :root[data-contrast-preference='high'] header:hover {
63
- background: var(--bg2-color);
64
- }
65
- }
66
-
67
- header .results-container {
68
- position: absolute;
69
- top: var(--header-collapsed-height);
70
- right: 0;
71
- left: 0;
72
- z-index: 1000;
73
- box-sizing: border-box;
74
- display: block;
75
- max-width: 640px;
76
- padding: var(--gap);
77
- margin: 0 auto;
78
- pointer-events: none;
79
- }
80
-
81
- header ol {
82
- flex: 1;
83
- min-height: 0;
84
- padding: 0;
85
- overflow-y: auto;
86
-
87
- .excerpt {
88
- height: 5ex;
89
- line-height: 2.5ex;
90
- }
91
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes