@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.
- package/LICENSE +22 -0
- package/README.md +148 -0
- package/lib/collapsible-plugin-Bwt7dmKE.mjs +132 -0
- package/lib/ec-config.mjs +59 -0
- package/lib/ec.config.d.mts +5 -0
- package/lib/index.d.mts +371 -0
- package/lib/plugins.mjs +0 -0
- package/package.json +113 -0
- package/sources/assets/fonts/KaTeX_AMS-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_AMS-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_AMS-Regular.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Caligraphic-Bold.woff +0 -0
- package/sources/assets/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Caligraphic-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Fraktur-Bold.woff +0 -0
- package/sources/assets/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Fraktur-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Main-Bold.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Main-Bold.woff +0 -0
- package/sources/assets/fonts/KaTeX_Main-Bold.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Main-BoldItalic.woff +0 -0
- package/sources/assets/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Main-Italic.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Main-Italic.woff +0 -0
- package/sources/assets/fonts/KaTeX_Main-Italic.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Main-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Main-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_Main-Regular.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Math-BoldItalic.woff +0 -0
- package/sources/assets/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Math-Italic.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Math-Italic.woff +0 -0
- package/sources/assets/fonts/KaTeX_Math-Italic.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
- package/sources/assets/fonts/KaTeX_SansSerif-Bold.woff +0 -0
- package/sources/assets/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
- package/sources/assets/fonts/KaTeX_SansSerif-Italic.woff +0 -0
- package/sources/assets/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_SansSerif-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Script-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Script-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_Script-Regular.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Size1-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Size1-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_Size1-Regular.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Size2-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Size2-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_Size2-Regular.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Size3-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Size3-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_Size3-Regular.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Size4-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Size4-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_Size4-Regular.woff2 +0 -0
- package/sources/assets/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
- package/sources/assets/fonts/KaTeX_Typewriter-Regular.woff +0 -0
- package/sources/assets/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
- package/sources/parts/badge/badge.part.html +3 -0
- package/sources/parts/badge/badge.style.css +44 -0
- package/sources/parts/callouts/callouts.part.html +30 -0
- package/sources/parts/color-scheme-switch/color-scheme-switch.part.html +111 -0
- package/sources/parts/color-scheme-switch/color-scheme-switch.style.css +77 -0
- package/sources/parts/document/document.part.html +66 -0
- package/sources/parts/header/header.part.html +62 -0
- package/sources/parts/header/header.style.css +123 -0
- package/sources/parts/mermaid/mermaid.part.html +15 -0
- package/sources/parts/pagefind/pagefind.part.html +75 -0
- package/sources/parts/pagefind/pagefind.style.css +57 -0
- package/sources/parts/pagination-links/pagination-links.part.html +81 -0
- package/sources/parts/pagination-links/pagination-links.style.css +58 -0
- package/sources/parts/sidebar/directory.part.html +13 -0
- package/sources/parts/sidebar/item.part.html +9 -0
- package/sources/parts/sidebar/sidebar.part.html +106 -0
- package/sources/parts/sidebar/sidebar.style.css +202 -0
- package/sources/parts/table-of-content/table-of-content-desktop.part.html +122 -0
- package/sources/parts/table-of-content/table-of-content-mobile.part.html +24 -0
- package/sources/parts/table-of-content/table-of-content.style.css +189 -0
- package/sources/scripts/global.d.ts +27 -0
- package/sources/scripts/mermaid.ts +75 -0
- package/sources/styles/docs.css +9 -0
- package/sources/styles/document.css +579 -0
- package/sources/styles/global.css +149 -0
- package/sources/styles/katex.css +1445 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ahmed Alabsi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
# @staticbolt/docs
|
|
2
|
+
|
|
3
|
+
The parts, styles, and plugins every staticbolt docs site shares.
|
|
4
|
+
The project keeps its own `.staticbolt.ts`, layout, social icons, colors, and any page-specific parts.
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```shellscript
|
|
9
|
+
npm install @staticbolt/docs @staticview/ui
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`@staticview/ui` provides `sv-accordion`, used by the sidebar, the mobile table of contents, and collapsible callouts.
|
|
13
|
+
The layout has to load it.
|
|
14
|
+
|
|
15
|
+
## Config
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { defineConfig } from "@staticbolt/core";
|
|
19
|
+
import * as plugins from "@staticbolt/core/plugins";
|
|
20
|
+
import { rehypeExpressiveCodeOptions } from "@staticbolt/docs/ec-config";
|
|
21
|
+
import * as theme from "@staticbolt/docs/plugins";
|
|
22
|
+
import rehypeCallouts from "rehype-callouts";
|
|
23
|
+
import rehypeKatex from "rehype-katex";
|
|
24
|
+
import remarkMath from "remark-math";
|
|
25
|
+
|
|
26
|
+
export default defineConfig({
|
|
27
|
+
plugins: [
|
|
28
|
+
theme.contentPlugin({
|
|
29
|
+
include: ["pages/**/*.{html,md}"],
|
|
30
|
+
baseDirectory: "pages",
|
|
31
|
+
layouts: { default: "@layouts/document.layout.html" },
|
|
32
|
+
icons: "@parts/sidebar-icons",
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
plugins.htmlLayoutPlugin({ tags: ["layout", "part", "icon"] }),
|
|
36
|
+
theme.HtmlCodeBlockPlugin({ rehypeExpressiveCodeOptions }),
|
|
37
|
+
theme.katexFontsPlugin(),
|
|
38
|
+
theme.pagefindPlugin(),
|
|
39
|
+
theme.llmsPlugin({ siteUrl: "https://example.com" }),
|
|
40
|
+
|
|
41
|
+
plugins.coreMarkdownPlugin({
|
|
42
|
+
allowDangerousHtml: true,
|
|
43
|
+
remarkPlugins: [remarkMath],
|
|
44
|
+
rehypePlugins: [
|
|
45
|
+
[rehypeKatex, { output: "mathml" }],
|
|
46
|
+
theme.wrapTables,
|
|
47
|
+
rehypeCallouts,
|
|
48
|
+
theme.rehypeMermaidFence,
|
|
49
|
+
[theme.cachedRehypeExpressiveCode, rehypeExpressiveCodeOptions],
|
|
50
|
+
],
|
|
51
|
+
}),
|
|
52
|
+
theme.ecCachePlugin(),
|
|
53
|
+
],
|
|
54
|
+
});
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`tags` must include `"icon"` when `icons` is set.
|
|
58
|
+
Callouts, math, and diagrams are opt-in. The project installs what it uses:
|
|
59
|
+
|
|
60
|
+
| Feature | Install | Config |
|
|
61
|
+
| -------- | ----------------------------- | -------------------------------------------------------------- |
|
|
62
|
+
| Callouts | `rehype-callouts` | `rehypeCallouts`, the `callouts` part |
|
|
63
|
+
| Math | `remark-math`, `rehype-katex` | `remarkMath`, `rehypeKatex`, `katexFontsPlugin()`, `katex.css` |
|
|
64
|
+
| Diagrams | `mermaid` | `theme.rehypeMermaidFence`, the `mermaid` part |
|
|
65
|
+
|
|
66
|
+
Needs `@staticbolt/core` with the two fixes from 2026-08-20: sources inside a `node_modules` part resolve,
|
|
67
|
+
and `url()` references move with bundled stylesheets.
|
|
68
|
+
|
|
69
|
+
## Layout
|
|
70
|
+
|
|
71
|
+
The project owns the layout: the `<head>` plus the theme's `document` part, which is the whole docs page.
|
|
72
|
+
Copy this as `sources/layouts/document.layout.html` and edit the names:
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<!doctype html>
|
|
76
|
+
<html dir="ltr" lang="en">
|
|
77
|
+
<head>
|
|
78
|
+
<meta charset="UTF-8" />
|
|
79
|
+
<meta content="light dark" name="color-scheme" />
|
|
80
|
+
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
|
81
|
+
<link bundle href="@styles/docs.css" rel="stylesheet" />
|
|
82
|
+
<link type="image/svg" href="@assets/favicon.svg" rel="icon" />
|
|
83
|
+
<meta content="Documentation for My Project." name="description" />
|
|
84
|
+
<meta content="website" property="og:type" />
|
|
85
|
+
<meta content="My Project" property="og:site_name" />
|
|
86
|
+
<meta content="My Project" property="og:title" />
|
|
87
|
+
<meta content="Documentation for My Project." property="og:description" />
|
|
88
|
+
<meta content="summary" name="twitter:card" />
|
|
89
|
+
<title>My Project</title>
|
|
90
|
+
</head>
|
|
91
|
+
|
|
92
|
+
<body>
|
|
93
|
+
<part
|
|
94
|
+
maxHeading="{{ $data.maxHeading ?? 3 }}"
|
|
95
|
+
minHeading="{{ $data.minHeading ?? 2 }}"
|
|
96
|
+
src="@staticbolt/docs/parts/document/document.part.html"
|
|
97
|
+
title="My Project"
|
|
98
|
+
>
|
|
99
|
+
<part slot="icons" src="@parts/social-icons/social-icons.part.html"></part>
|
|
100
|
+
<slot />
|
|
101
|
+
</part>
|
|
102
|
+
</body>
|
|
103
|
+
</html>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`sources/parts/social-icons/social-icons.part.html` is the project's own part, one `<a>` per link.
|
|
107
|
+
|
|
108
|
+
To change the page structure, copy `node_modules/@staticbolt/docs/sources/parts/document/document.part.html` into the project and point the layout at the copy; it references the other parts by package path, so it works as is.
|
|
109
|
+
|
|
110
|
+
| Part | Role |
|
|
111
|
+
| --------------------- | -------------------------------------------------------------------------------- |
|
|
112
|
+
| `document` | The whole page. `title`, `minHeading`, `maxHeading`, slot `icons`, default slot. |
|
|
113
|
+
| `header` | Takes `title`. Slot `icons` for the social links. |
|
|
114
|
+
| `sidebar` | Filled by `contentPlugin`. Slot `icons` for the social links. |
|
|
115
|
+
| `table-of-content` | `-desktop` takes `minHeading` and `maxHeading`, `-mobile` none. |
|
|
116
|
+
| `pagination-links` | Previous/next links read from the sidebar. |
|
|
117
|
+
| `callouts` | Build-time script turning collapsible callouts into accordions. |
|
|
118
|
+
| `mermaid` | Renders ` ```mermaid ` fences. Removes itself from pages without. |
|
|
119
|
+
| `color-scheme-switch` | Already inside header and sidebar. |
|
|
120
|
+
| `badge` | Used by the sidebar for `data.badgeText` / `data.badgeVariant`. |
|
|
121
|
+
|
|
122
|
+
## Styles
|
|
123
|
+
|
|
124
|
+
`docs.css` in the project:
|
|
125
|
+
|
|
126
|
+
```css
|
|
127
|
+
@import url("@staticbolt/docs/styles/docs.css");
|
|
128
|
+
@import url("@staticbolt/docs/styles/katex.css");
|
|
129
|
+
@import url("@parts/social-icons/social-icons.style.css");
|
|
130
|
+
@import url("@styles/theme.css");
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`katex.css` is only needed with `rehypeKatex`.
|
|
134
|
+
`theme.css` overrides the palette:
|
|
135
|
+
|
|
136
|
+
```css
|
|
137
|
+
:root {
|
|
138
|
+
--sb-hue-accent: 85;
|
|
139
|
+
--sb-hue-base: 305;
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Any `--sb-*` variable from `global.css` can be overridden the same way.
|
|
144
|
+
|
|
145
|
+
## Overriding a part
|
|
146
|
+
|
|
147
|
+
Copy it from `node_modules/@staticbolt/docs/sources/parts/` into the project and point the layout at the copy.
|
|
148
|
+
For the sidebar parts pass the copy through `contentPlugin`'s `sidebarLayout`, `directoryLayout`, or `linkLayout`.
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { definePlugin } from "@expressive-code/core";
|
|
2
|
+
import { h } from "@expressive-code/core/hast";
|
|
3
|
+
//#region plugins/collapsible-plugin.ts
|
|
4
|
+
/**
|
|
5
|
+
* Collapses opted-in code blocks to a fixed number of preview lines.
|
|
6
|
+
*
|
|
7
|
+
* Add the `collapsible` meta flag to collapse a block, or `collapsible=N` to override the number of preview lines for that block.
|
|
8
|
+
* Blocks with no more lines than the preview size are left untouched.
|
|
9
|
+
*
|
|
10
|
+
* The collapsed height is expressed in `lh` units of the rendered code, so blocks render at their final size on first paint
|
|
11
|
+
* without any JavaScript measurements or layout shifts.
|
|
12
|
+
*/
|
|
13
|
+
function pluginCollapsible(options = {}) {
|
|
14
|
+
const defaultPreviewLines = options.previewLines ?? 6;
|
|
15
|
+
const expandButtonText = options.expandButtonText ?? "Show code";
|
|
16
|
+
const collapseButtonText = options.collapseButtonText ?? "Hide code";
|
|
17
|
+
return definePlugin({
|
|
18
|
+
name: "Collapsible",
|
|
19
|
+
baseStyles: ({ cssVar }) => `
|
|
20
|
+
.ec-collapsible {
|
|
21
|
+
position: relative;
|
|
22
|
+
display: grid;
|
|
23
|
+
grid-template-columns: minmax(0, 1fr);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ec-collapsible > * {
|
|
27
|
+
grid-area: 1 / 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ec-collapsible:not(.ec-collapsible-expanded) pre > code {
|
|
31
|
+
box-sizing: content-box;
|
|
32
|
+
max-block-size: calc(var(--ec-collapsible-lines) * 1lh);
|
|
33
|
+
padding-block-end: 0;
|
|
34
|
+
overflow-y: clip;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ec-collapsible:not(.ec-collapsible-expanded)::after {
|
|
38
|
+
position: absolute;
|
|
39
|
+
inset: ${cssVar("borderWidth")};
|
|
40
|
+
content: "";
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
background: linear-gradient(to bottom, transparent, ${cssVar("codeBackground")});
|
|
43
|
+
border-radius: ${cssVar("borderRadius")};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ec-collapsible-toggle {
|
|
47
|
+
z-index: 1;
|
|
48
|
+
align-self: end;
|
|
49
|
+
justify-self: center;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
margin-block-end: 1.2em;
|
|
53
|
+
padding: 0.45em 1.2em;
|
|
54
|
+
font-family: var(--sb-md-font);
|
|
55
|
+
font-size: var(--sb-text-xs);
|
|
56
|
+
font-weight: 500;
|
|
57
|
+
line-height: 1.5;
|
|
58
|
+
color: var(--sb-color-accent-high);
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
background-color: color-mix(in srgb, var(--sb-color-accent) 6%, var(--sb-code-background));
|
|
61
|
+
border: 1px solid color-mix(in srgb, var(--sb-color-accent) 45%, transparent);
|
|
62
|
+
border-radius: 999px;
|
|
63
|
+
transition:
|
|
64
|
+
background-color 200ms ease,
|
|
65
|
+
border-color 200ms ease;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ec-collapsible-expanded .ec-collapsible-toggle {
|
|
69
|
+
position: sticky;
|
|
70
|
+
inset-block-end: 0.875em;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ec-collapsible-toggle:hover {
|
|
74
|
+
background-color: color-mix(in srgb, var(--sb-color-accent) 14%, var(--sb-code-background));
|
|
75
|
+
border-color: var(--sb-color-accent);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.ec-collapsible-toggle:focus-visible {
|
|
79
|
+
outline: 2px solid var(--sb-color-accent-high);
|
|
80
|
+
outline-offset: 2px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.ec-collapsible-hide-label,
|
|
84
|
+
.ec-collapsible-expanded .ec-collapsible-show-label {
|
|
85
|
+
display: none;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.ec-collapsible-expanded .ec-collapsible-hide-label {
|
|
89
|
+
display: inline;
|
|
90
|
+
}
|
|
91
|
+
`,
|
|
92
|
+
hooks: { postprocessRenderedBlock: (context) => {
|
|
93
|
+
const metaOptions = context.codeBlock.metaOptions;
|
|
94
|
+
let previewLines = metaOptions.getInteger("collapsible");
|
|
95
|
+
if (previewLines === void 0 && metaOptions.getBoolean("collapsible")) previewLines = defaultPreviewLines;
|
|
96
|
+
if (previewLines === void 0 || previewLines < 1) return;
|
|
97
|
+
if (context.codeBlock.getLines().length <= previewLines) return;
|
|
98
|
+
const toggle = h("button", {
|
|
99
|
+
class: "ec-collapsible-toggle",
|
|
100
|
+
type: "button",
|
|
101
|
+
"aria-expanded": "false"
|
|
102
|
+
}, [h("span", { class: "ec-collapsible-show-label" }, expandButtonText), h("span", { class: "ec-collapsible-hide-label" }, collapseButtonText)]);
|
|
103
|
+
context.renderData.blockAst = h("div", {
|
|
104
|
+
class: "ec-collapsible",
|
|
105
|
+
style: `--ec-collapsible-lines: ${previewLines}`
|
|
106
|
+
}, [context.renderData.blockAst, toggle]);
|
|
107
|
+
} },
|
|
108
|
+
jsModules: [`
|
|
109
|
+
if (!window.ecCollapsibleInit) {
|
|
110
|
+
window.ecCollapsibleInit = true;
|
|
111
|
+
|
|
112
|
+
document.addEventListener("click", (event) => {
|
|
113
|
+
const toggle = event.target instanceof Element ? event.target.closest(".ec-collapsible-toggle") : null;
|
|
114
|
+
if (!toggle) return;
|
|
115
|
+
|
|
116
|
+
const block = toggle.closest(".ec-collapsible");
|
|
117
|
+
if (!block) return;
|
|
118
|
+
|
|
119
|
+
const isExpanded = block.classList.toggle("ec-collapsible-expanded");
|
|
120
|
+
toggle.setAttribute("aria-expanded", String(isExpanded));
|
|
121
|
+
|
|
122
|
+
if (isExpanded || block.getBoundingClientRect().top >= 0) return;
|
|
123
|
+
|
|
124
|
+
const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
125
|
+
block.scrollIntoView({ behavior: reduceMotion ? "instant" : "smooth", block: "start" });
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
`]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { pluginCollapsible as t };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { t as pluginCollapsible } from "./collapsible-plugin-Bwt7dmKE.mjs";
|
|
2
|
+
import { pluginCollapsibleSections } from "@expressive-code/plugin-collapsible-sections";
|
|
3
|
+
import { pluginLineNumbers } from "@expressive-code/plugin-line-numbers";
|
|
4
|
+
import { pluginFileIcons } from "@xt0rted/expressive-code-file-icons";
|
|
5
|
+
//#region ec.config.ts
|
|
6
|
+
const rehypeExpressiveCodeOptions = {
|
|
7
|
+
themes: ["plastic", "kanagawa-lotus"],
|
|
8
|
+
plugins: [
|
|
9
|
+
pluginLineNumbers(),
|
|
10
|
+
pluginFileIcons(),
|
|
11
|
+
pluginCollapsibleSections(),
|
|
12
|
+
pluginCollapsible({ previewLines: 3 })
|
|
13
|
+
],
|
|
14
|
+
defaultProps: {
|
|
15
|
+
wrap: false,
|
|
16
|
+
showLineNumbers: false,
|
|
17
|
+
collapseStyle: "collapsible-auto"
|
|
18
|
+
},
|
|
19
|
+
useDarkModeMediaQuery: false,
|
|
20
|
+
styleOverrides: {
|
|
21
|
+
codeBackground: "var(--sb-code-background)",
|
|
22
|
+
borderColor: "var(--sb-color-gray-5)",
|
|
23
|
+
borderWidth: "1px",
|
|
24
|
+
gutterHighlightForeground: "var(--sb-color-accent-high)",
|
|
25
|
+
collapsibleSections: {
|
|
26
|
+
openBackgroundColorCollapsible: "var(--sb-color-gray-7)",
|
|
27
|
+
closedBackgroundColor: "var(--sb-color-gray-6)",
|
|
28
|
+
closedTextColor: "var(--sb-color-gray-1)"
|
|
29
|
+
},
|
|
30
|
+
frames: {
|
|
31
|
+
shadowColor: "transparent",
|
|
32
|
+
editorBackground: "var(--sb-code-background)",
|
|
33
|
+
editorTabBarBackground: "var(--sb-code-background)",
|
|
34
|
+
terminalBackground: "var(--sb-code-background)",
|
|
35
|
+
terminalTitlebarBackground: "var(--sb-code-background)",
|
|
36
|
+
terminalTitlebarDotsForeground: "var(--sb-color-accent-high)",
|
|
37
|
+
terminalTitlebarBorderBottomColor: "var(--sb-color-gray-5)",
|
|
38
|
+
editorTabBarBorderBottomColor: "var(--sb-color-gray-5)",
|
|
39
|
+
editorActiveTabBackground: "transparent",
|
|
40
|
+
editorActiveTabIndicatorBottomColor: "var(--sb-color-gray-2)",
|
|
41
|
+
editorActiveTabIndicatorTopColor: "transparent",
|
|
42
|
+
editorActiveTabForeground: "var(--sb-color-gray-0)",
|
|
43
|
+
inlineButtonForeground: "var(--sb-color-accent-high)",
|
|
44
|
+
tooltipSuccessBackground: "var(--sb-color-accent)"
|
|
45
|
+
},
|
|
46
|
+
textMarkers: {
|
|
47
|
+
markBackground: "var(--sb-color-gray-7)",
|
|
48
|
+
markBorderColor: "var(--sb-color-accent-high)",
|
|
49
|
+
insBackground: "light-dark(#2da44e1f, #26561c80)",
|
|
50
|
+
insBorderColor: "light-dark(#2da44e59, #4e7e41d0)",
|
|
51
|
+
insDiffIndicatorColor: "light-dark(#1a7f37, #7eb070d0)",
|
|
52
|
+
delBackground: "light-dark(#cf222e14, #81322b80)",
|
|
53
|
+
delBorderColor: "light-dark(#cf222e4d, #ae594fd0)",
|
|
54
|
+
delDiffIndicatorColor: "light-dark(#cf222e, #e68a7ed0)"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
//#endregion
|
|
59
|
+
export { rehypeExpressiveCodeOptions };
|