@staticbolt/docs 0.0.1-beta.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 (94) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +148 -0
  3. package/lib/collapsible-plugin-Bwt7dmKE.mjs +132 -0
  4. package/lib/ec-config.mjs +59 -0
  5. package/lib/ec.config.d.mts +5 -0
  6. package/lib/index.d.mts +371 -0
  7. package/lib/plugins.mjs +0 -0
  8. package/package.json +113 -0
  9. package/sources/assets/fonts/KaTeX_AMS-Regular.ttf +0 -0
  10. package/sources/assets/fonts/KaTeX_AMS-Regular.woff +0 -0
  11. package/sources/assets/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  12. package/sources/assets/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  13. package/sources/assets/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
  14. package/sources/assets/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  15. package/sources/assets/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  16. package/sources/assets/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
  17. package/sources/assets/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  18. package/sources/assets/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  19. package/sources/assets/fonts/KaTeX_Fraktur-Bold.woff +0 -0
  20. package/sources/assets/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  21. package/sources/assets/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  22. package/sources/assets/fonts/KaTeX_Fraktur-Regular.woff +0 -0
  23. package/sources/assets/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  24. package/sources/assets/fonts/KaTeX_Main-Bold.ttf +0 -0
  25. package/sources/assets/fonts/KaTeX_Main-Bold.woff +0 -0
  26. package/sources/assets/fonts/KaTeX_Main-Bold.woff2 +0 -0
  27. package/sources/assets/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  28. package/sources/assets/fonts/KaTeX_Main-BoldItalic.woff +0 -0
  29. package/sources/assets/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  30. package/sources/assets/fonts/KaTeX_Main-Italic.ttf +0 -0
  31. package/sources/assets/fonts/KaTeX_Main-Italic.woff +0 -0
  32. package/sources/assets/fonts/KaTeX_Main-Italic.woff2 +0 -0
  33. package/sources/assets/fonts/KaTeX_Main-Regular.ttf +0 -0
  34. package/sources/assets/fonts/KaTeX_Main-Regular.woff +0 -0
  35. package/sources/assets/fonts/KaTeX_Main-Regular.woff2 +0 -0
  36. package/sources/assets/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  37. package/sources/assets/fonts/KaTeX_Math-BoldItalic.woff +0 -0
  38. package/sources/assets/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  39. package/sources/assets/fonts/KaTeX_Math-Italic.ttf +0 -0
  40. package/sources/assets/fonts/KaTeX_Math-Italic.woff +0 -0
  41. package/sources/assets/fonts/KaTeX_Math-Italic.woff2 +0 -0
  42. package/sources/assets/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  43. package/sources/assets/fonts/KaTeX_SansSerif-Bold.woff +0 -0
  44. package/sources/assets/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  45. package/sources/assets/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  46. package/sources/assets/fonts/KaTeX_SansSerif-Italic.woff +0 -0
  47. package/sources/assets/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  48. package/sources/assets/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  49. package/sources/assets/fonts/KaTeX_SansSerif-Regular.woff +0 -0
  50. package/sources/assets/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  51. package/sources/assets/fonts/KaTeX_Script-Regular.ttf +0 -0
  52. package/sources/assets/fonts/KaTeX_Script-Regular.woff +0 -0
  53. package/sources/assets/fonts/KaTeX_Script-Regular.woff2 +0 -0
  54. package/sources/assets/fonts/KaTeX_Size1-Regular.ttf +0 -0
  55. package/sources/assets/fonts/KaTeX_Size1-Regular.woff +0 -0
  56. package/sources/assets/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  57. package/sources/assets/fonts/KaTeX_Size2-Regular.ttf +0 -0
  58. package/sources/assets/fonts/KaTeX_Size2-Regular.woff +0 -0
  59. package/sources/assets/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  60. package/sources/assets/fonts/KaTeX_Size3-Regular.ttf +0 -0
  61. package/sources/assets/fonts/KaTeX_Size3-Regular.woff +0 -0
  62. package/sources/assets/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  63. package/sources/assets/fonts/KaTeX_Size4-Regular.ttf +0 -0
  64. package/sources/assets/fonts/KaTeX_Size4-Regular.woff +0 -0
  65. package/sources/assets/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  66. package/sources/assets/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  67. package/sources/assets/fonts/KaTeX_Typewriter-Regular.woff +0 -0
  68. package/sources/assets/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  69. package/sources/parts/badge/badge.part.html +3 -0
  70. package/sources/parts/badge/badge.style.css +44 -0
  71. package/sources/parts/callouts/callouts.part.html +30 -0
  72. package/sources/parts/color-scheme-switch/color-scheme-switch.part.html +111 -0
  73. package/sources/parts/color-scheme-switch/color-scheme-switch.style.css +77 -0
  74. package/sources/parts/document/document.part.html +66 -0
  75. package/sources/parts/header/header.part.html +62 -0
  76. package/sources/parts/header/header.style.css +123 -0
  77. package/sources/parts/mermaid/mermaid.part.html +15 -0
  78. package/sources/parts/pagefind/pagefind.part.html +75 -0
  79. package/sources/parts/pagefind/pagefind.style.css +57 -0
  80. package/sources/parts/pagination-links/pagination-links.part.html +81 -0
  81. package/sources/parts/pagination-links/pagination-links.style.css +58 -0
  82. package/sources/parts/sidebar/directory.part.html +13 -0
  83. package/sources/parts/sidebar/item.part.html +9 -0
  84. package/sources/parts/sidebar/sidebar.part.html +106 -0
  85. package/sources/parts/sidebar/sidebar.style.css +202 -0
  86. package/sources/parts/table-of-content/table-of-content-desktop.part.html +122 -0
  87. package/sources/parts/table-of-content/table-of-content-mobile.part.html +24 -0
  88. package/sources/parts/table-of-content/table-of-content.style.css +189 -0
  89. package/sources/scripts/global.d.ts +27 -0
  90. package/sources/scripts/mermaid.ts +75 -0
  91. package/sources/styles/docs.css +9 -0
  92. package/sources/styles/document.css +579 -0
  93. package/sources/styles/global.css +149 -0
  94. package/sources/styles/katex.css +1445 -0
@@ -0,0 +1,189 @@
1
+ :root {
2
+ /* The height when the TOC is collapsed */
3
+ --sb-toc-mobile-height: 0em;
4
+
5
+ @media (max-width: 72rem) {
6
+ --sb-toc-mobile-height: 2.6rem;
7
+ }
8
+ }
9
+
10
+ .toc {
11
+ &.desktop {
12
+ position: sticky;
13
+ inset-block-start: var(--sb-header-height);
14
+ min-inline-size: 10rem;
15
+ font-family: var(--sb-md-font);
16
+
17
+ @media (max-width: 72rem) {
18
+ display: none;
19
+ }
20
+ }
21
+
22
+ .toc-title {
23
+ margin: 0 0 0.75rem;
24
+ font-size: var(--sb-text-h5);
25
+ font-weight: 600;
26
+ line-height: var(--sb-line-height-headings);
27
+ color: var(--sb-color-gray-0);
28
+ }
29
+
30
+ .toc-list {
31
+ display: flex;
32
+ flex-direction: column;
33
+ padding: 0;
34
+ margin: 0;
35
+ list-style: none;
36
+
37
+ li .toc-link {
38
+ --base-indent: 0.75rem;
39
+
40
+ display: block;
41
+ padding: 4px 0 4px 0.75rem;
42
+ padding-inline: calc(var(--base-indent) + (0.75rem * var(--depth))) 0.5em;
43
+ margin-inline-start: -0.5px;
44
+ font-size: var(--sb-text-xs);
45
+ line-height: 1.4;
46
+ color: var(--sb-color-gray-3);
47
+ text-decoration: none;
48
+ border-inline-start: 1px solid transparent;
49
+ border-start-end-radius: 4px;
50
+ border-end-end-radius: 4px;
51
+ transition:
52
+ color 0.15s,
53
+ border-color 0.15s;
54
+
55
+ @media (pointer: fine) {
56
+ &:hover {
57
+ color: var(--sb-color-gray-1);
58
+ background-color: var(--sb-color-gray-6);
59
+ border-inline-start-color: var(--sb-color-accent);
60
+ }
61
+ }
62
+
63
+ &.active {
64
+ color: var(--sb-color-accent-high);
65
+ background-color: var(--sb-color-gray-6);
66
+ border-inline-start-color: var(--sb-color-accent);
67
+ border-start-end-radius: 4px;
68
+ border-end-end-radius: 4px;
69
+ }
70
+ }
71
+
72
+ /* Links are before the active link */
73
+ li:has(~ li .toc-link.active) > .toc-link {
74
+ color: var(--sb-color-gray-1);
75
+ }
76
+ }
77
+
78
+ .toc-nav-container {
79
+ max-block-size: calc(100svh - var(--sb-header-height));
80
+ padding: 1em;
81
+ padding-inline-start: 0;
82
+ overflow-y: auto;
83
+ scrollbar-width: none;
84
+ -ms-overflow-style: none;
85
+
86
+ &::-webkit-scrollbar {
87
+ display: none;
88
+ }
89
+ }
90
+
91
+ .toc-nav {
92
+ inline-size: fit-content;
93
+
94
+ .toc-list:first-of-type {
95
+ border-inline-start: 1px solid var(--sb-color-gray-5);
96
+ }
97
+ }
98
+
99
+ &.mobile {
100
+ position: sticky;
101
+ inset-block-start: var(--sb-header-height);
102
+ z-index: 99;
103
+ display: none;
104
+ align-items: flex-start;
105
+ inline-size: 100%;
106
+ block-size: var(--sb-toc-mobile-height);
107
+ overflow: visible;
108
+ background-color: rgb(from var(--sb-color-black) r g b / 80%);
109
+ border-block-end: 1px solid var(--sb-color-gray-5);
110
+ backdrop-filter: blur(7px);
111
+
112
+ @media (max-width: 72rem) {
113
+ display: flex;
114
+ }
115
+
116
+ .toc-nav-mobile {
117
+ flex: 1;
118
+ min-inline-size: 0;
119
+ max-block-size: calc(100svh - var(--sb-header-height));
120
+ overflow-y: auto;
121
+ overscroll-behavior: contain;
122
+ }
123
+
124
+ .toc-accordion {
125
+ --sv-toggle-dur: 200ms;
126
+ --sv-gray-6: transparent;
127
+ --sv-gray-5: transparent;
128
+
129
+ font-size: var(--sb-text-xs);
130
+
131
+ &::part(container) {
132
+ border: none;
133
+ border-radius: 0;
134
+ }
135
+
136
+ &::part(content) {
137
+ background-color: var(--sb-color-black);
138
+ border-block-end: solid 1px var(--sb-color-gray-5);
139
+ }
140
+
141
+ &::part(trigger) {
142
+ block-size: var(--sb-toc-mobile-height);
143
+ padding-block: 0.4em;
144
+ }
145
+
146
+ span[slot="summary"] {
147
+ display: flex;
148
+ align-items: center;
149
+ overflow: hidden;
150
+ }
151
+
152
+ .toc-accordion-summary {
153
+ padding-block: 0.2em;
154
+ padding-inline-end: 1em;
155
+ margin-inline-end: 1em;
156
+ font-weight: 600;
157
+ border-inline-end: solid 1px var(--sb-color-gray-5);
158
+ }
159
+
160
+ .toc-current-title {
161
+ flex: 1;
162
+ overflow: hidden;
163
+ text-overflow: ellipsis;
164
+ font-weight: normal;
165
+ white-space: nowrap;
166
+ }
167
+
168
+ &:state(--open) .toc-accordion-summary .marker {
169
+ rotate: 0deg;
170
+ }
171
+ }
172
+
173
+ .toc-content {
174
+ padding-block: 0.5em 1em;
175
+ }
176
+
177
+ .toc-list {
178
+ li a {
179
+ padding-block: 0.5em;
180
+ border-inline-start: none;
181
+ border-radius: 4px;
182
+ }
183
+ }
184
+ }
185
+
186
+ @media print {
187
+ display: none !important;
188
+ }
189
+ }
@@ -0,0 +1,27 @@
1
+ import type { ImageFormat, import_as_string, CssLinear } from "@staticbolt/core/plugins";
2
+
3
+ declare global {
4
+ /** True in production */
5
+ const _production: boolean;
6
+
7
+ /**
8
+ * - Replace `cssLinear.[easeName](...args)` with a CSS linear function string `linear(...values)`.
9
+ * - Useful for `element.animate(..., { easing: cssLinear.[easeName](...args) })`.
10
+ */
11
+ const cssLinear: CssLinear;
12
+
13
+ const import_as_string: import_as_string;
14
+
15
+ const _img: {
16
+ /** The image extension. In production, returns the converted format (e.g. `webp`). In development, returns `png` */
17
+ png: ImageFormat;
18
+
19
+ /** The image extension. In production, returns the converted format (e.g. `webp`). In development, returns `jpg` */
20
+ jpg: ImageFormat;
21
+
22
+ /** The image extension. In production, returns the converted format (e.g. `webp`). In development, returns `jpeg` */
23
+ jpeg: ImageFormat;
24
+ };
25
+ }
26
+
27
+ export {};
@@ -0,0 +1,75 @@
1
+ // @ts-expect-error - no types for mermaid esm dist file
2
+ import _mermaid from "mermaid/dist/mermaid.esm.min.mjs";
3
+
4
+ import type { Mermaid } from "mermaid";
5
+
6
+ const mermaid = _mermaid as unknown as Mermaid;
7
+
8
+ // Resolves CSS vars including light-dark() — element must be in DOM
9
+ function resolveColor(cssVariable: string) {
10
+ // Step 1: DOM element resolves light-dark() + CSS variable references
11
+ const element = document.createElement("div");
12
+ element.style.cssText = `display:none; color: var(${cssVariable})`;
13
+ document.body.append(element);
14
+ const computed = getComputedStyle(element).color; // could be rgb(), color(srgb ...), oklch(), etc.
15
+ element.remove();
16
+
17
+ // Step 2: canvas normalizes any color format → integer RGB → hex
18
+ const canvas = document.createElement("canvas");
19
+ canvas.width = canvas.height = 1;
20
+
21
+ const context = canvas.getContext("2d")!;
22
+ context.fillStyle = computed;
23
+ context.fillRect(0, 0, 1, 1);
24
+
25
+ const [r, g, b] = context.getImageData(0, 0, 1, 1).data;
26
+
27
+ return `#${[r, g, b].map(x => x.toString(16).padStart(2, "0")).join("")}`;
28
+ }
29
+
30
+ function buildMermaidTheme() {
31
+ const c = (v: string) => resolveColor(v);
32
+
33
+ return {
34
+ theme: "base" as const,
35
+ themeVariables: {
36
+ background: c("--sb-color-black"),
37
+ mainBkg: c("--sb-color-gray-7"),
38
+ secondaryColor: c("--sb-color-gray-6"),
39
+ tertiaryColor: c("--sb-color-gray-5"),
40
+ clusterBkg: c("--sb-color-gray-7"),
41
+ primaryBorderColor: c("--sb-color-accent"),
42
+ secondaryBorderColor: c("--sb-color-gray-4"),
43
+ tertiaryBorderColor: c("--sb-color-gray-5"),
44
+ primaryTextColor: c("--sb-color-gray-0"),
45
+ secondaryTextColor: c("--sb-color-gray-1"),
46
+ tertiaryTextColor: c("--sb-color-gray-2"),
47
+ titleColor: c("--sb-color-gray-1"),
48
+ edgeLabelBackground: c("--sb-color-gray-6"),
49
+ primaryColor: c("--sb-color-accent"),
50
+ lineColor: c("--sb-color-gray-3"),
51
+ fontFamily: "ui-sans-serif, system-ui, sans-serif",
52
+ fontSize: "14px",
53
+ },
54
+ };
55
+ }
56
+
57
+ // Save original source before first render
58
+ for (const element of document.querySelectorAll<HTMLPreElement>(".mermaid")) {
59
+ element.dataset.src = element.textContent.trim();
60
+ }
61
+
62
+ async function renderDiagrams() {
63
+ // Restore original source — Mermaid replaces it with SVG after first run
64
+ for (const element of document.querySelectorAll<HTMLPreElement>(".mermaid")) {
65
+ element.textContent = element.dataset.src ?? "";
66
+ delete element.dataset.processed;
67
+ }
68
+
69
+ mermaid.initialize({ startOnLoad: false, ...buildMermaidTheme() });
70
+ await mermaid.run();
71
+ }
72
+
73
+ await renderDiagrams();
74
+
75
+ document.addEventListener("color-scheme-changed", renderDiagrams);
@@ -0,0 +1,9 @@
1
+ @import url("@pagefind/component-ui/css");
2
+ @import url("./global.css");
3
+ @import url("./document.css");
4
+ @import url("../parts/header/header.style.css");
5
+ @import url("../parts/sidebar/sidebar.style.css");
6
+ @import url("../parts/table-of-content/table-of-content.style.css");
7
+ @import url("../parts/pagination-links/pagination-links.style.css");
8
+ @import url("../parts/color-scheme-switch/color-scheme-switch.style.css");
9
+ @import url("../parts/badge/badge.style.css");