@cogenta/theme-docs 0.5.7 → 0.6.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/dist/src/render/blocks/logos.d.ts.map +1 -1
- package/dist/src/render/blocks/logos.js +6 -1
- package/dist/src/render/blocks/logos.js.map +1 -1
- package/dist/src/render/doc-page.d.ts.map +1 -1
- package/dist/src/render/doc-page.js +17 -8
- package/dist/src/render/doc-page.js.map +1 -1
- package/dist/src/render/rich-text.d.ts.map +1 -1
- package/dist/src/render/rich-text.js +17 -2
- package/dist/src/render/rich-text.js.map +1 -1
- package/dist/src/render/search.d.ts.map +1 -1
- package/dist/src/render/search.js +6 -1
- package/dist/src/render/search.js.map +1 -1
- package/dist/src/render/strings.d.ts +6 -0
- package/dist/src/render/strings.d.ts.map +1 -1
- package/dist/src/render/strings.js +6 -0
- package/dist/src/render/strings.js.map +1 -1
- package/fonts/OFL-ibm-plex-mono.txt +93 -0
- package/fonts/OFL-ibm-plex-sans.txt +93 -0
- package/fonts/README.md +59 -0
- package/fonts/ibm-plex-mono-italic-latin-0840095f.woff2 +0 -0
- package/fonts/ibm-plex-mono-italic-latin-ext-1b07eee6.woff2 +0 -0
- package/fonts/ibm-plex-mono-normal-latin-01d28544.woff2 +0 -0
- package/fonts/ibm-plex-mono-normal-latin-08949f72.woff2 +0 -0
- package/fonts/ibm-plex-mono-normal-latin-0d1f0b8d.woff2 +0 -0
- package/fonts/ibm-plex-mono-normal-latin-ext-32057cf5.woff2 +0 -0
- package/fonts/ibm-plex-mono-normal-latin-ext-6bb06407.woff2 +0 -0
- package/fonts/ibm-plex-mono-normal-latin-ext-6bc0f226.woff2 +0 -0
- package/fonts/ibm-plex-sans-italic-latin-4363757d.woff2 +0 -0
- package/fonts/ibm-plex-sans-italic-latin-ext-bf44b77c.woff2 +0 -0
- package/fonts/ibm-plex-sans-normal-latin-e2291e84.woff2 +0 -0
- package/fonts/ibm-plex-sans-normal-latin-ext-d160e209.woff2 +0 -0
- package/fonts/manifest.json +101 -0
- package/package.json +11 -8
- package/src/render/blocks/logos.ts +10 -1
- package/src/render/doc-page.ts +36 -9
- package/src/render/rich-text.ts +18 -2
- package/src/render/search.ts +13 -1
- package/src/render/strings.ts +6 -0
- package/src/styles/base.css +9 -0
- package/src/styles/blocks.css +5 -0
- package/src/styles/chrome.css +16 -4
- package/src/styles/docs.css +79 -0
- package/src/styles/fonts.css +125 -0
- package/src/styles/theme.css +3 -3
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
{
|
|
2
|
+
"theme": "docs",
|
|
3
|
+
"faces": [
|
|
4
|
+
{
|
|
5
|
+
"family": "IBM Plex Sans",
|
|
6
|
+
"style": "italic",
|
|
7
|
+
"weight": "100 700",
|
|
8
|
+
"subset": "latin-ext",
|
|
9
|
+
"file": "ibm-plex-sans-italic-latin-ext-bf44b77c.woff2",
|
|
10
|
+
"css": "@font-face {\n font-family: 'IBM Plex Sans';\n font-style: italic;\n font-weight: 100 700;\n font-stretch: 100%;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-sans-italic-latin-ext-bf44b77c.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"family": "IBM Plex Sans",
|
|
14
|
+
"style": "italic",
|
|
15
|
+
"weight": "100 700",
|
|
16
|
+
"subset": "latin",
|
|
17
|
+
"file": "ibm-plex-sans-italic-latin-4363757d.woff2",
|
|
18
|
+
"css": "@font-face {\n font-family: 'IBM Plex Sans';\n font-style: italic;\n font-weight: 100 700;\n font-stretch: 100%;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-sans-italic-latin-4363757d.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"family": "IBM Plex Sans",
|
|
22
|
+
"style": "normal",
|
|
23
|
+
"weight": "100 700",
|
|
24
|
+
"subset": "latin-ext",
|
|
25
|
+
"file": "ibm-plex-sans-normal-latin-ext-d160e209.woff2",
|
|
26
|
+
"css": "@font-face {\n font-family: 'IBM Plex Sans';\n font-style: normal;\n font-weight: 100 700;\n font-stretch: 100%;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-sans-normal-latin-ext-d160e209.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"family": "IBM Plex Sans",
|
|
30
|
+
"style": "normal",
|
|
31
|
+
"weight": "100 700",
|
|
32
|
+
"subset": "latin",
|
|
33
|
+
"file": "ibm-plex-sans-normal-latin-e2291e84.woff2",
|
|
34
|
+
"css": "@font-face {\n font-family: 'IBM Plex Sans';\n font-style: normal;\n font-weight: 100 700;\n font-stretch: 100%;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-sans-normal-latin-e2291e84.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"family": "IBM Plex Mono",
|
|
38
|
+
"style": "italic",
|
|
39
|
+
"weight": "400",
|
|
40
|
+
"subset": "latin-ext",
|
|
41
|
+
"file": "ibm-plex-mono-italic-latin-ext-1b07eee6.woff2",
|
|
42
|
+
"css": "@font-face {\n font-family: 'IBM Plex Mono';\n font-style: italic;\n font-weight: 400;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-mono-italic-latin-ext-1b07eee6.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"family": "IBM Plex Mono",
|
|
46
|
+
"style": "italic",
|
|
47
|
+
"weight": "400",
|
|
48
|
+
"subset": "latin",
|
|
49
|
+
"file": "ibm-plex-mono-italic-latin-0840095f.woff2",
|
|
50
|
+
"css": "@font-face {\n font-family: 'IBM Plex Mono';\n font-style: italic;\n font-weight: 400;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-mono-italic-latin-0840095f.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"family": "IBM Plex Mono",
|
|
54
|
+
"style": "normal",
|
|
55
|
+
"weight": "400",
|
|
56
|
+
"subset": "latin-ext",
|
|
57
|
+
"file": "ibm-plex-mono-normal-latin-ext-6bc0f226.woff2",
|
|
58
|
+
"css": "@font-face {\n font-family: 'IBM Plex Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-ext-6bc0f226.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"family": "IBM Plex Mono",
|
|
62
|
+
"style": "normal",
|
|
63
|
+
"weight": "400",
|
|
64
|
+
"subset": "latin",
|
|
65
|
+
"file": "ibm-plex-mono-normal-latin-08949f72.woff2",
|
|
66
|
+
"css": "@font-face {\n font-family: 'IBM Plex Mono';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-08949f72.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"family": "IBM Plex Mono",
|
|
70
|
+
"style": "normal",
|
|
71
|
+
"weight": "500",
|
|
72
|
+
"subset": "latin-ext",
|
|
73
|
+
"file": "ibm-plex-mono-normal-latin-ext-6bb06407.woff2",
|
|
74
|
+
"css": "@font-face {\n font-family: 'IBM Plex Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-ext-6bb06407.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"family": "IBM Plex Mono",
|
|
78
|
+
"style": "normal",
|
|
79
|
+
"weight": "500",
|
|
80
|
+
"subset": "latin",
|
|
81
|
+
"file": "ibm-plex-mono-normal-latin-01d28544.woff2",
|
|
82
|
+
"css": "@font-face {\n font-family: 'IBM Plex Mono';\n font-style: normal;\n font-weight: 500;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-01d28544.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"family": "IBM Plex Mono",
|
|
86
|
+
"style": "normal",
|
|
87
|
+
"weight": "600",
|
|
88
|
+
"subset": "latin-ext",
|
|
89
|
+
"file": "ibm-plex-mono-normal-latin-ext-32057cf5.woff2",
|
|
90
|
+
"css": "@font-face {\n font-family: 'IBM Plex Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-ext-32057cf5.woff2) format('woff2');\n unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;\n}"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"family": "IBM Plex Mono",
|
|
94
|
+
"style": "normal",
|
|
95
|
+
"weight": "600",
|
|
96
|
+
"subset": "latin",
|
|
97
|
+
"file": "ibm-plex-mono-normal-latin-0d1f0b8d.woff2",
|
|
98
|
+
"css": "@font-face {\n font-family: 'IBM Plex Mono';\n font-style: normal;\n font-weight: 600;\n font-display: swap;\n src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-0d1f0b8d.woff2) format('woff2');\n unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;\n}"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cogenta/theme-docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "A dense, reference-first documentation theme for Cogenta: a sticky sidebar-navigated doc layout, real code blocks, and a genuine dark mode — zero client JavaScript.",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -16,10 +16,13 @@
|
|
|
16
16
|
},
|
|
17
17
|
"./tokens.json": "./tokens.json",
|
|
18
18
|
"./styles/theme.css": "./src/styles/theme.css",
|
|
19
|
-
"./styles/*.css": "./src/styles/*.css"
|
|
19
|
+
"./styles/*.css": "./src/styles/*.css",
|
|
20
|
+
"./fonts/*.woff2": "./fonts/*.woff2",
|
|
21
|
+
"./fonts/manifest.json": "./fonts/manifest.json"
|
|
20
22
|
},
|
|
21
23
|
"files": [
|
|
22
24
|
"dist",
|
|
25
|
+
"fonts",
|
|
23
26
|
"src",
|
|
24
27
|
"tokens.json"
|
|
25
28
|
],
|
|
@@ -36,17 +39,17 @@
|
|
|
36
39
|
"directory": "packages/theme-docs"
|
|
37
40
|
},
|
|
38
41
|
"dependencies": {
|
|
39
|
-
"@cogenta/
|
|
40
|
-
"@cogenta/theme-kit": "0.7.
|
|
41
|
-
"@cogenta/
|
|
42
|
+
"@cogenta/blocks": "1.1.7",
|
|
43
|
+
"@cogenta/theme-kit": "0.7.2",
|
|
44
|
+
"@cogenta/render": "0.6.0"
|
|
42
45
|
},
|
|
43
46
|
"peerDependencies": {
|
|
44
|
-
"astro": "^7.2.
|
|
47
|
+
"astro": "^7.2.8"
|
|
45
48
|
},
|
|
46
49
|
"devDependencies": {
|
|
47
|
-
"astro": "^7.2.
|
|
50
|
+
"astro": "^7.2.8",
|
|
48
51
|
"typescript": "^7.0.2",
|
|
49
|
-
"vitest": "^4.1.
|
|
52
|
+
"vitest": "^4.1.11"
|
|
50
53
|
},
|
|
51
54
|
"scripts": {
|
|
52
55
|
"build": "tsc -p tsconfig.json",
|
|
@@ -34,7 +34,16 @@ export function renderLogos(block: LogosBlock, ctx: RenderContext): HtmlElement
|
|
|
34
34
|
{ class: 'cd-logos__item' },
|
|
35
35
|
item.url === undefined
|
|
36
36
|
? mark
|
|
37
|
-
: h(
|
|
37
|
+
: h(
|
|
38
|
+
'a',
|
|
39
|
+
{
|
|
40
|
+
class: 'cd-logos__link',
|
|
41
|
+
href: ctx.link(item.url),
|
|
42
|
+
'aria-label': item.name,
|
|
43
|
+
rel: 'noopener',
|
|
44
|
+
},
|
|
45
|
+
mark,
|
|
46
|
+
),
|
|
38
47
|
)
|
|
39
48
|
}),
|
|
40
49
|
),
|
package/src/render/doc-page.ts
CHANGED
|
@@ -135,7 +135,12 @@ function renderBreadcrumb(
|
|
|
135
135
|
)
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
function renderToc(
|
|
138
|
+
function renderToc(
|
|
139
|
+
ctx: RenderContext,
|
|
140
|
+
anchors: HeadingAnchors,
|
|
141
|
+
narrow = false,
|
|
142
|
+
): HtmlElement | null {
|
|
143
|
+
const prefix = narrow ? 'cd-tocn' : 'cd-toc'
|
|
139
144
|
const list = [...anchors.values()]
|
|
140
145
|
if (list.length < 2) return null
|
|
141
146
|
const items: HtmlElement[] = []
|
|
@@ -143,9 +148,9 @@ function renderToc(ctx: RenderContext, anchors: HeadingAnchors): HtmlElement | n
|
|
|
143
148
|
let parent: HeadingAnchor | undefined
|
|
144
149
|
const close = (): void => {
|
|
145
150
|
if (parent === undefined) {
|
|
146
|
-
for (const orphan of children) items.push(tocItem(orphan, []))
|
|
151
|
+
for (const orphan of children) items.push(tocItem(orphan, [], prefix))
|
|
147
152
|
} else {
|
|
148
|
-
items.push(tocItem(parent, children))
|
|
153
|
+
items.push(tocItem(parent, children, prefix))
|
|
149
154
|
}
|
|
150
155
|
children = []
|
|
151
156
|
parent = undefined
|
|
@@ -159,25 +164,45 @@ function renderToc(ctx: RenderContext, anchors: HeadingAnchors): HtmlElement | n
|
|
|
159
164
|
}
|
|
160
165
|
}
|
|
161
166
|
close()
|
|
167
|
+
const label = word(ctx.locale, 'onThisPage')
|
|
168
|
+
if (narrow) {
|
|
169
|
+
// Below the wide breakpoint the page rail does not fit: the same list sits
|
|
170
|
+
// under the summary, in a disclosure (no script). Exactly one copy is
|
|
171
|
+
// displayed at any width.
|
|
172
|
+
return h(
|
|
173
|
+
'details',
|
|
174
|
+
{ class: 'cd-tocn' },
|
|
175
|
+
h('summary', { class: 'cd-tocn__summary' }, label),
|
|
176
|
+
h(
|
|
177
|
+
'nav',
|
|
178
|
+
{ class: 'cd-tocn__nav', 'aria-label': label },
|
|
179
|
+
h('ol', { class: 'cd-tocn__items' }, items),
|
|
180
|
+
),
|
|
181
|
+
)
|
|
182
|
+
}
|
|
162
183
|
return h(
|
|
163
184
|
'nav',
|
|
164
185
|
{ class: 'cd-toc', 'aria-labelledby': 'cd-toc-label' },
|
|
165
|
-
h('p', { class: 'cd-toc__label', id: 'cd-toc-label' },
|
|
186
|
+
h('p', { class: 'cd-toc__label', id: 'cd-toc-label' }, label),
|
|
166
187
|
h('ol', { class: 'cd-toc__items' }, items),
|
|
167
188
|
)
|
|
168
189
|
}
|
|
169
190
|
|
|
170
|
-
function tocItem(
|
|
191
|
+
function tocItem(
|
|
192
|
+
anchor: HeadingAnchor,
|
|
193
|
+
children: readonly HeadingAnchor[],
|
|
194
|
+
prefix: string,
|
|
195
|
+
): HtmlElement {
|
|
171
196
|
return h(
|
|
172
197
|
'li',
|
|
173
|
-
{ class:
|
|
174
|
-
h('a', { class:
|
|
198
|
+
{ class: `${prefix}__item`, 'data-level': String(anchor.level) },
|
|
199
|
+
h('a', { class: `${prefix}__link`, href: `#${anchor.id}` }, anchor.text),
|
|
175
200
|
children.length === 0
|
|
176
201
|
? null
|
|
177
202
|
: h(
|
|
178
203
|
'ol',
|
|
179
|
-
{ class:
|
|
180
|
-
children.map((child) => tocItem(child, [])),
|
|
204
|
+
{ class: `${prefix}__items` },
|
|
205
|
+
children.map((child) => tocItem(child, [], prefix)),
|
|
181
206
|
),
|
|
182
207
|
)
|
|
183
208
|
}
|
|
@@ -261,6 +286,7 @@ export function renderDocPage(
|
|
|
261
286
|
const anchors = headingAnchors(content)
|
|
262
287
|
const ownHeading = pageHasOwnHeading(content)
|
|
263
288
|
const toc = renderToc(ctx, anchors)
|
|
289
|
+
const narrowToc = renderToc(ctx, anchors, true)
|
|
264
290
|
|
|
265
291
|
return h(
|
|
266
292
|
'main',
|
|
@@ -287,6 +313,7 @@ export function renderDocPage(
|
|
|
287
313
|
page.entry?.excerpt === undefined
|
|
288
314
|
? null
|
|
289
315
|
: h('p', { class: 'cd-doc__lede' }, page.entry.excerpt),
|
|
316
|
+
narrowToc,
|
|
290
317
|
),
|
|
291
318
|
h(
|
|
292
319
|
'div',
|
package/src/render/rich-text.ts
CHANGED
|
@@ -136,7 +136,8 @@ function isCodeBlock(node: RichTextNode): boolean {
|
|
|
136
136
|
)
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
const NOTE_LABEL =
|
|
139
|
+
const NOTE_LABEL =
|
|
140
|
+
/^(note|tip|important|warning|caution|remarque|astuce|attention|avertissement|mise en garde)\s*[:.]?\s*$/iu
|
|
140
141
|
|
|
141
142
|
function calloutLabel(node: RichTextNode): string | null {
|
|
142
143
|
if (!isTextBlock(node) || node.style !== 'blockquote' || node.children.length < 2) return null
|
|
@@ -225,7 +226,7 @@ function renderCodeBlock(node: TextBlock): HtmlElement {
|
|
|
225
226
|
}
|
|
226
227
|
|
|
227
228
|
function renderCallout(ctx: RenderContext, node: TextBlock, label: string): HtmlElement {
|
|
228
|
-
const kind = /^(note|tip)$/
|
|
229
|
+
const kind = /^(note|tip|remarque|astuce)$/iu.test(label) ? 'note' : 'warning'
|
|
229
230
|
const normalised = label.charAt(0).toUpperCase() + label.slice(1).toLowerCase()
|
|
230
231
|
return h(
|
|
231
232
|
'div',
|
|
@@ -293,6 +294,17 @@ function renderHeading(ctx: RenderContext, node: TextBlock, anchor: HeadingAncho
|
|
|
293
294
|
// ---------------------------------------------------------------------------
|
|
294
295
|
|
|
295
296
|
const NAMED_KEYS: ReadonlySet<string> = new Set([
|
|
297
|
+
'entrée',
|
|
298
|
+
'échap',
|
|
299
|
+
'suppr',
|
|
300
|
+
'maj',
|
|
301
|
+
'majuscule',
|
|
302
|
+
'espace',
|
|
303
|
+
'tabulation',
|
|
304
|
+
'haut',
|
|
305
|
+
'bas',
|
|
306
|
+
'gauche',
|
|
307
|
+
'droite',
|
|
296
308
|
'ctrl',
|
|
297
309
|
'control',
|
|
298
310
|
'cmd',
|
|
@@ -321,6 +333,10 @@ const NAMED_KEYS: ReadonlySet<string> = new Set([
|
|
|
321
333
|
'⌃',
|
|
322
334
|
])
|
|
323
335
|
const LONE_KEYS: ReadonlySet<string> = new Set([
|
|
336
|
+
'entrée',
|
|
337
|
+
'échap',
|
|
338
|
+
'suppr',
|
|
339
|
+
'tabulation',
|
|
324
340
|
'enter',
|
|
325
341
|
'return',
|
|
326
342
|
'esc',
|
package/src/render/search.ts
CHANGED
|
@@ -24,8 +24,20 @@ export function renderSearchForm(locale: string, id: string, size: SearchSize):
|
|
|
24
24
|
action: SEARCH_PATH,
|
|
25
25
|
method: 'get',
|
|
26
26
|
role: 'search',
|
|
27
|
+
'aria-label': word(
|
|
28
|
+
locale,
|
|
29
|
+
id === 'cd-search-header'
|
|
30
|
+
? 'headerSearch'
|
|
31
|
+
: id === 'cd-search-menu'
|
|
32
|
+
? 'menuSearch'
|
|
33
|
+
: 'pageSearch',
|
|
34
|
+
),
|
|
27
35
|
},
|
|
28
|
-
h(
|
|
36
|
+
h(
|
|
37
|
+
'label',
|
|
38
|
+
{ id: `${id}-label`, class: 'cg-visually-hidden', for: id },
|
|
39
|
+
word(locale, 'searchLabel'),
|
|
40
|
+
),
|
|
29
41
|
renderIcon('search', { className: 'cd-search__icon', size: 20 }),
|
|
30
42
|
h('input', {
|
|
31
43
|
id,
|
package/src/render/strings.ts
CHANGED
|
@@ -10,6 +10,9 @@ const STRINGS = {
|
|
|
10
10
|
en: {
|
|
11
11
|
search: 'Search',
|
|
12
12
|
searchLabel: 'Search the documentation',
|
|
13
|
+
headerSearch: 'Search from the header',
|
|
14
|
+
menuSearch: 'Search from the menu',
|
|
15
|
+
pageSearch: 'Search this documentation',
|
|
13
16
|
searchPlaceholder: 'Search the documentation',
|
|
14
17
|
menu: 'Menu',
|
|
15
18
|
documentation: 'Documentation',
|
|
@@ -27,6 +30,9 @@ const STRINGS = {
|
|
|
27
30
|
fr: {
|
|
28
31
|
search: 'Rechercher',
|
|
29
32
|
searchLabel: 'Rechercher dans la documentation',
|
|
33
|
+
headerSearch: 'Rechercher depuis l’en-tête',
|
|
34
|
+
menuSearch: 'Rechercher depuis le menu',
|
|
35
|
+
pageSearch: 'Rechercher dans cette documentation',
|
|
30
36
|
searchPlaceholder: 'Rechercher dans la documentation',
|
|
31
37
|
menu: 'Menu',
|
|
32
38
|
documentation: 'Documentation',
|
package/src/styles/base.css
CHANGED
|
@@ -33,6 +33,15 @@ body {
|
|
|
33
33
|
font-synthesis: none;
|
|
34
34
|
text-rendering: optimizeLegibility;
|
|
35
35
|
-webkit-font-smoothing: antialiased;
|
|
36
|
+
/* A short page (a search with no result, a 404) keeps its footer at the
|
|
37
|
+
bottom of the window rather than under a strip of bare canvas. */
|
|
38
|
+
display: flex;
|
|
39
|
+
flex-direction: column;
|
|
40
|
+
min-block-size: 100vh;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
body > main {
|
|
44
|
+
flex: 1 0 auto;
|
|
36
45
|
}
|
|
37
46
|
|
|
38
47
|
::selection {
|
package/src/styles/blocks.css
CHANGED
|
@@ -536,6 +536,11 @@
|
|
|
536
536
|
quotes: "\201C" "\201D";
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
+
.cd-quote__text:lang(fr),
|
|
540
|
+
.cd-testimonial__quote:lang(fr) > p:first-child {
|
|
541
|
+
quotes: "\00AB\202F" "\202F\00BB";
|
|
542
|
+
}
|
|
543
|
+
|
|
539
544
|
.cd-quote__text::before,
|
|
540
545
|
.cd-testimonial__quote > p:first-child::before {
|
|
541
546
|
content: open-quote;
|
package/src/styles/chrome.css
CHANGED
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
|
|
29
29
|
.cd-header__brand {
|
|
30
30
|
display: inline-flex;
|
|
31
|
-
flex:
|
|
31
|
+
flex: 0 1 auto;
|
|
32
|
+
min-inline-size: 0;
|
|
32
33
|
align-items: center;
|
|
33
34
|
min-block-size: 44px;
|
|
34
35
|
color: var(--cd-ink);
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
font-weight: var(--cd-weight-semibold);
|
|
48
49
|
letter-spacing: var(--cd-tracking-heading);
|
|
49
50
|
line-height: 1;
|
|
50
|
-
|
|
51
|
+
overflow-wrap: anywhere;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
.cd-wordmark__kind {
|
|
@@ -63,6 +64,7 @@
|
|
|
63
64
|
|
|
64
65
|
.cd-header__nav {
|
|
65
66
|
display: none;
|
|
67
|
+
flex: none;
|
|
66
68
|
margin-inline-start: auto;
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -84,6 +86,8 @@
|
|
|
84
86
|
color: var(--cd-ink-soft);
|
|
85
87
|
font-size: var(--cd-text-ui);
|
|
86
88
|
text-decoration: none;
|
|
89
|
+
/* A two-word section ("Premiers pas") never breaks over two lines. */
|
|
90
|
+
white-space: nowrap;
|
|
87
91
|
}
|
|
88
92
|
|
|
89
93
|
.cd-header__item a:hover {
|
|
@@ -92,7 +96,8 @@
|
|
|
92
96
|
|
|
93
97
|
.cd-header__end {
|
|
94
98
|
display: flex;
|
|
95
|
-
flex:
|
|
99
|
+
flex: 0 1 auto;
|
|
100
|
+
min-inline-size: 0;
|
|
96
101
|
align-items: center;
|
|
97
102
|
gap: var(--cd-s2);
|
|
98
103
|
margin-inline-start: auto;
|
|
@@ -130,7 +135,7 @@
|
|
|
130
135
|
border: var(--cd-rule) solid var(--cd-line-strong);
|
|
131
136
|
border-radius: var(--cd-radius-control);
|
|
132
137
|
color: var(--cd-ink);
|
|
133
|
-
|
|
138
|
+
overflow-wrap: anywhere;
|
|
134
139
|
}
|
|
135
140
|
|
|
136
141
|
.cg-action[data-emphasis="outline"]:hover {
|
|
@@ -437,3 +442,10 @@
|
|
|
437
442
|
grid-column: 6 / -1;
|
|
438
443
|
}
|
|
439
444
|
}
|
|
445
|
+
|
|
446
|
+
.cd-header__logo {
|
|
447
|
+
max-inline-size: 100%;
|
|
448
|
+
}
|
|
449
|
+
.cd-header__inner > * {
|
|
450
|
+
min-inline-size: 0;
|
|
451
|
+
}
|
package/src/styles/docs.css
CHANGED
|
@@ -370,6 +370,79 @@
|
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
|
|
373
|
+
/* Narrow screens: the same list in a disclosure under the summary. */
|
|
374
|
+
.cd-tocn {
|
|
375
|
+
max-inline-size: var(--cd-measure);
|
|
376
|
+
margin-block-start: var(--cd-s6);
|
|
377
|
+
border: var(--cd-rule) solid var(--cd-line);
|
|
378
|
+
border-radius: var(--cd-radius-control);
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
@media (min-width: 80rem) {
|
|
382
|
+
.cd-tocn {
|
|
383
|
+
display: none;
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.cd-tocn__summary {
|
|
388
|
+
display: flex;
|
|
389
|
+
align-items: center;
|
|
390
|
+
justify-content: space-between;
|
|
391
|
+
gap: var(--cd-s3);
|
|
392
|
+
min-block-size: 44px;
|
|
393
|
+
padding-inline: var(--cd-s4);
|
|
394
|
+
color: var(--cd-ink);
|
|
395
|
+
font-size: var(--cd-text-ui);
|
|
396
|
+
font-weight: var(--cd-weight-semibold);
|
|
397
|
+
cursor: pointer;
|
|
398
|
+
list-style: none;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.cd-tocn__summary::-webkit-details-marker {
|
|
402
|
+
display: none;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.cd-tocn__summary::after {
|
|
406
|
+
content: "";
|
|
407
|
+
inline-size: 0.5rem;
|
|
408
|
+
block-size: 0.5rem;
|
|
409
|
+
margin-block-start: -0.25rem;
|
|
410
|
+
border-inline-end: var(--cd-rule-strong) solid var(--cd-ink-muted);
|
|
411
|
+
border-block-end: var(--cd-rule-strong) solid var(--cd-ink-muted);
|
|
412
|
+
rotate: 45deg;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.cd-tocn[open] > .cd-tocn__summary::after {
|
|
416
|
+
margin-block-start: 0.25rem;
|
|
417
|
+
rotate: 225deg;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.cd-tocn__nav {
|
|
421
|
+
padding: 0 var(--cd-s4) var(--cd-s3);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.cd-tocn__items {
|
|
425
|
+
display: grid;
|
|
426
|
+
gap: 0;
|
|
427
|
+
margin: 0;
|
|
428
|
+
padding: 0;
|
|
429
|
+
list-style: none;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.cd-tocn__items .cd-tocn__items {
|
|
433
|
+
padding-inline-start: var(--cd-s4);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.cd-tocn__link {
|
|
437
|
+
display: block;
|
|
438
|
+
padding-block: var(--cd-s2);
|
|
439
|
+
color: var(--cd-link);
|
|
440
|
+
font-size: var(--cd-text-ui);
|
|
441
|
+
line-height: var(--cd-leading-ui);
|
|
442
|
+
text-decoration: none;
|
|
443
|
+
overflow-wrap: anywhere;
|
|
444
|
+
}
|
|
445
|
+
|
|
373
446
|
.cd-toc__label {
|
|
374
447
|
margin: 0 0 var(--cd-s3);
|
|
375
448
|
color: var(--cd-ink);
|
|
@@ -402,3 +475,9 @@
|
|
|
402
475
|
.cd-toc__link:hover {
|
|
403
476
|
color: var(--cd-ink);
|
|
404
477
|
}
|
|
478
|
+
|
|
479
|
+
.cd-doc__title,
|
|
480
|
+
.cd-pager__title,
|
|
481
|
+
.cd-doc__body {
|
|
482
|
+
overflow-wrap: anywhere;
|
|
483
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The web fonts of `@cogenta/theme-docs`, served by the site itself.
|
|
3
|
+
*
|
|
4
|
+
* GENERATED by `scripts/fetch-theme-fonts.mjs` — edit that script, not this
|
|
5
|
+
* file. The faces live in this package's `fonts/` directory and are sent by
|
|
6
|
+
* `cogenta serve` at `/_cogenta/fonts/docs/<file>`; no request leaves the
|
|
7
|
+
* site, so a visitor's address is never handed to a font provider. See
|
|
8
|
+
* `fonts/README.md` for the families, their licence and their source.
|
|
9
|
+
*
|
|
10
|
+
* `font-display: swap` keeps text visible in a system face while a file loads,
|
|
11
|
+
* and `unicode-range` splits Latin from Latin Extended so a French page
|
|
12
|
+
* downloads only the first.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
@font-face {
|
|
16
|
+
font-family: 'IBM Plex Sans';
|
|
17
|
+
font-style: italic;
|
|
18
|
+
font-weight: 100 700;
|
|
19
|
+
font-stretch: 100%;
|
|
20
|
+
font-display: swap;
|
|
21
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-sans-italic-latin-ext-bf44b77c.woff2) format('woff2');
|
|
22
|
+
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@font-face {
|
|
26
|
+
font-family: 'IBM Plex Sans';
|
|
27
|
+
font-style: italic;
|
|
28
|
+
font-weight: 100 700;
|
|
29
|
+
font-stretch: 100%;
|
|
30
|
+
font-display: swap;
|
|
31
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-sans-italic-latin-4363757d.woff2) format('woff2');
|
|
32
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@font-face {
|
|
36
|
+
font-family: 'IBM Plex Sans';
|
|
37
|
+
font-style: normal;
|
|
38
|
+
font-weight: 100 700;
|
|
39
|
+
font-stretch: 100%;
|
|
40
|
+
font-display: swap;
|
|
41
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-sans-normal-latin-ext-d160e209.woff2) format('woff2');
|
|
42
|
+
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@font-face {
|
|
46
|
+
font-family: 'IBM Plex Sans';
|
|
47
|
+
font-style: normal;
|
|
48
|
+
font-weight: 100 700;
|
|
49
|
+
font-stretch: 100%;
|
|
50
|
+
font-display: swap;
|
|
51
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-sans-normal-latin-e2291e84.woff2) format('woff2');
|
|
52
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@font-face {
|
|
56
|
+
font-family: 'IBM Plex Mono';
|
|
57
|
+
font-style: italic;
|
|
58
|
+
font-weight: 400;
|
|
59
|
+
font-display: swap;
|
|
60
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-mono-italic-latin-ext-1b07eee6.woff2) format('woff2');
|
|
61
|
+
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
@font-face {
|
|
65
|
+
font-family: 'IBM Plex Mono';
|
|
66
|
+
font-style: italic;
|
|
67
|
+
font-weight: 400;
|
|
68
|
+
font-display: swap;
|
|
69
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-mono-italic-latin-0840095f.woff2) format('woff2');
|
|
70
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@font-face {
|
|
74
|
+
font-family: 'IBM Plex Mono';
|
|
75
|
+
font-style: normal;
|
|
76
|
+
font-weight: 400;
|
|
77
|
+
font-display: swap;
|
|
78
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-ext-6bc0f226.woff2) format('woff2');
|
|
79
|
+
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@font-face {
|
|
83
|
+
font-family: 'IBM Plex Mono';
|
|
84
|
+
font-style: normal;
|
|
85
|
+
font-weight: 400;
|
|
86
|
+
font-display: swap;
|
|
87
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-08949f72.woff2) format('woff2');
|
|
88
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@font-face {
|
|
92
|
+
font-family: 'IBM Plex Mono';
|
|
93
|
+
font-style: normal;
|
|
94
|
+
font-weight: 500;
|
|
95
|
+
font-display: swap;
|
|
96
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-ext-6bb06407.woff2) format('woff2');
|
|
97
|
+
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@font-face {
|
|
101
|
+
font-family: 'IBM Plex Mono';
|
|
102
|
+
font-style: normal;
|
|
103
|
+
font-weight: 500;
|
|
104
|
+
font-display: swap;
|
|
105
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-01d28544.woff2) format('woff2');
|
|
106
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@font-face {
|
|
110
|
+
font-family: 'IBM Plex Mono';
|
|
111
|
+
font-style: normal;
|
|
112
|
+
font-weight: 600;
|
|
113
|
+
font-display: swap;
|
|
114
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-ext-32057cf5.woff2) format('woff2');
|
|
115
|
+
unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@font-face {
|
|
119
|
+
font-family: 'IBM Plex Mono';
|
|
120
|
+
font-style: normal;
|
|
121
|
+
font-weight: 600;
|
|
122
|
+
font-display: swap;
|
|
123
|
+
src: url(/_cogenta/fonts/docs/ibm-plex-mono-normal-latin-0d1f0b8d.woff2) format('woff2');
|
|
124
|
+
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
125
|
+
}
|