@compiiile/compiiile 2.18.12 → 2.20.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/.compiiile/components.d.ts +23 -0
- package/.compiiile/src/components/ContentWrapper.vue +0 -187
- package/.compiiile/src/components/SlidesContent.vue +3 -3
- package/.compiiile/src/components/layout/navBar/FilesTree.vue +1 -0
- package/.compiiile/src/components/layout/navBar/NavBar.vue +4 -0
- package/.compiiile/src/components/layout/navBar/NavListItem.vue +142 -26
- package/.compiiile/src/layouts/BaseLayout.astro +2 -0
- package/.compiiile/src/layouts/NavBarFoldersStateLoader.astro +81 -0
- package/.compiiile/src/layouts/WorkspaceLayout.astro +1 -1
- package/.compiiile/src/pages/[...path].astro +1 -1
- package/.compiiile/src/style/content.css +185 -0
- package/.compiiile/src/style/index.css +1 -0
- package/4-pro-features.mdx +5 -5
- package/5-pro-slides.mdx +2 -0
- package/6-deploy.mdx +1 -0
- package/README.md +36 -16
- package/bin/config.js +14 -28
- package/bin/loadConfig.js +6 -0
- package/bin/vitePluginCompiiile/index.js +11 -17
- package/bin/vitePluginCompiiile/markdownConfig.js +28 -20
- package/bin/vitePluginCompiiile/models/Context.js +4 -3
- package/bin/vitePluginCompiiile/rehypeLinkPlugin.js +4 -4
- package/compiiile.config.js +7 -4
- package/dist/style.css +2 -1
- package/package.json +13 -12
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// Generated by unplugin-vue-components
|
|
4
|
+
// Read more: https://github.com/vuejs/core/pull/3399
|
|
5
|
+
export {}
|
|
6
|
+
|
|
7
|
+
/* prettier-ignore */
|
|
8
|
+
declare module 'vue' {
|
|
9
|
+
export interface GlobalComponents {
|
|
10
|
+
ClientScript: typeof import('./src/components/ClientScript.vue')['default']
|
|
11
|
+
ContentWrapper: typeof import('./src/components/ContentWrapper.vue')['default']
|
|
12
|
+
FilesTree: typeof import('./src/components/layout/navBar/FilesTree.vue')['default']
|
|
13
|
+
HamburgerButton: typeof import('./src/components/layout/HamburgerButton.vue')['default']
|
|
14
|
+
NavBar: typeof import('./src/components/layout/navBar/NavBar.vue')['default']
|
|
15
|
+
NavListItem: typeof import('./src/components/layout/navBar/NavListItem.vue')['default']
|
|
16
|
+
SearchBar: typeof import('./src/components/searchBar/SearchBar.vue')['default']
|
|
17
|
+
SearchResult: typeof import('./src/components/searchBar/SearchResult.vue')['default']
|
|
18
|
+
SlidesContent: typeof import('./src/components/SlidesContent.vue')['default']
|
|
19
|
+
TableOfContent: typeof import('./src/components/TableOfContent.vue')['default']
|
|
20
|
+
ThemeSwitcher: typeof import('./src/components/layout/ThemeSwitcher.vue')['default']
|
|
21
|
+
TopBar: typeof import('./src/components/layout/TopBar.vue')['default']
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -119,190 +119,3 @@
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
</script>
|
|
122
|
-
|
|
123
|
-
<style scoped>
|
|
124
|
-
:deep(.markdown-content) {
|
|
125
|
-
margin-right: calc(var(--toc-width) + 80px);
|
|
126
|
-
|
|
127
|
-
h1,
|
|
128
|
-
h2,
|
|
129
|
-
h3,
|
|
130
|
-
h4,
|
|
131
|
-
h5 {
|
|
132
|
-
&:before {
|
|
133
|
-
/* hack to offset scroll on route hash navigation */
|
|
134
|
-
padding-top: calc(var(--top-bar-height) - 1px);
|
|
135
|
-
margin-top: calc((var(--top-bar-height) - 1px) * -1);
|
|
136
|
-
content: " ";
|
|
137
|
-
display: block;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
h2,
|
|
142
|
-
h3,
|
|
143
|
-
h4,
|
|
144
|
-
h5,
|
|
145
|
-
h6 {
|
|
146
|
-
margin: 20px 0 10px;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
h2 {
|
|
150
|
-
margin-top: 40px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
p code,
|
|
154
|
-
li code,
|
|
155
|
-
table code {
|
|
156
|
-
padding: 2px 4px;
|
|
157
|
-
border-radius: 3px;
|
|
158
|
-
background-color: var(--code-background-color);
|
|
159
|
-
border: solid 1px var(--code-background-color); /* same color, useful when printing without background graphics */
|
|
160
|
-
color: var(--code-color);
|
|
161
|
-
font-family: var(--monospace);
|
|
162
|
-
font-size: 0.85rem;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
p,
|
|
166
|
-
ul {
|
|
167
|
-
line-height: 1.618rem;
|
|
168
|
-
margin-bottom: 1rem;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
ul {
|
|
172
|
-
padding-left: 40px;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
hr {
|
|
176
|
-
margin: 40px 0;
|
|
177
|
-
background-color: var(--separator-color);
|
|
178
|
-
height: 1px;
|
|
179
|
-
border: 0;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
blockquote {
|
|
183
|
-
background-color: var(--blockquote-background-color);
|
|
184
|
-
border: solid 1px var(--blockquote-border-color);
|
|
185
|
-
border-radius: 8px;
|
|
186
|
-
padding: 0.5em 1em;
|
|
187
|
-
color: var(--blockquote-color);
|
|
188
|
-
margin: 20px 0;
|
|
189
|
-
|
|
190
|
-
p {
|
|
191
|
-
margin-bottom: 0;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
code {
|
|
195
|
-
background-color: rgb(169 156 231 / 22%);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
img {
|
|
200
|
-
max-width: 100%;
|
|
201
|
-
margin: 20px auto;
|
|
202
|
-
display: block;
|
|
203
|
-
object-fit: contain;
|
|
204
|
-
height: auto;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
a {
|
|
208
|
-
color: var(--link-color);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
table {
|
|
212
|
-
padding: 0;
|
|
213
|
-
border-collapse: collapse;
|
|
214
|
-
margin-bottom: 20px;
|
|
215
|
-
display: block;
|
|
216
|
-
max-width: 100%;
|
|
217
|
-
overflow-x: auto;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
table tr {
|
|
221
|
-
border-top: 1px solid var(--table-border-color);
|
|
222
|
-
background-color: var(--table-odd-lines-background-color);
|
|
223
|
-
margin: 0;
|
|
224
|
-
padding: 0;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
table tr:nth-child(2n) {
|
|
228
|
-
background-color: var(--table-even-lines-background-color);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
table tr th {
|
|
232
|
-
font-weight: bold;
|
|
233
|
-
border: 1px solid var(--table-border-color);
|
|
234
|
-
text-align: left;
|
|
235
|
-
margin: 0;
|
|
236
|
-
padding: 6px 13px;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
table tr td {
|
|
240
|
-
border: 1px solid var(--table-border-color);
|
|
241
|
-
text-align: left;
|
|
242
|
-
margin: 0;
|
|
243
|
-
padding: 6px 13px;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
table tr th :first-child,
|
|
247
|
-
table tr td :first-child {
|
|
248
|
-
margin-top: 0;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
table tr th :last-child,
|
|
252
|
-
table tr td :last-child {
|
|
253
|
-
margin-bottom: 0;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
pre code {
|
|
257
|
-
margin-bottom: 1rem;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
pre.astro-code {
|
|
261
|
-
margin-bottom: 20px;
|
|
262
|
-
font-size: 0.85rem;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
.header-anchor {
|
|
266
|
-
float: left;
|
|
267
|
-
margin-left: -0.87em;
|
|
268
|
-
padding-right: 0.23em;
|
|
269
|
-
font-weight: 500;
|
|
270
|
-
opacity: 0;
|
|
271
|
-
transition: opacity 0.25s;
|
|
272
|
-
text-decoration: none;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
h1:hover .header-anchor,
|
|
276
|
-
h2:hover .header-anchor,
|
|
277
|
-
h3:hover .header-anchor,
|
|
278
|
-
h4:hover .header-anchor,
|
|
279
|
-
h5:hover .header-anchor,
|
|
280
|
-
h6:hover .header-anchor,
|
|
281
|
-
.header-anchor:focus {
|
|
282
|
-
opacity: 1;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
.siblings {
|
|
287
|
-
display: flex;
|
|
288
|
-
margin-right: calc(var(--toc-width) + 80px);
|
|
289
|
-
color: var(--link-color);
|
|
290
|
-
margin-top: 80px;
|
|
291
|
-
gap: 20px;
|
|
292
|
-
flex-wrap: wrap;
|
|
293
|
-
|
|
294
|
-
.sibling-link {
|
|
295
|
-
text-decoration: none;
|
|
296
|
-
border-radius: 2px;
|
|
297
|
-
|
|
298
|
-
&:focus-visible {
|
|
299
|
-
outline: solid 1px var(--separator-color);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
.sibling-link--next {
|
|
304
|
-
text-align: right;
|
|
305
|
-
margin-left: auto;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
</style>
|
|
@@ -73,11 +73,11 @@
|
|
|
73
73
|
</script>
|
|
74
74
|
|
|
75
75
|
<style>
|
|
76
|
-
@import "reveal.js/
|
|
77
|
-
@import "reveal.js/
|
|
76
|
+
@import "reveal.js/reveal.css";
|
|
77
|
+
@import "reveal.js/theme/black.css";
|
|
78
78
|
@import "../style/slides.css";
|
|
79
79
|
|
|
80
|
-
|
|
80
|
+
#app {
|
|
81
81
|
height: 100%;
|
|
82
82
|
}
|
|
83
83
|
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
type: String,
|
|
16
16
|
required: true
|
|
17
17
|
}
|
|
18
|
+
},
|
|
19
|
+
mounted() {
|
|
20
|
+
// This is to delegate folder state to the client instead of the values computed on page load to prevent blinking
|
|
21
|
+
document.getElementById("compiiile-folders-state-style")?.remove()
|
|
18
22
|
}
|
|
19
23
|
}
|
|
20
24
|
</script>
|
|
@@ -1,35 +1,61 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<li v-if="isVisible(item)" class="nav-list-item no-wrap">
|
|
3
3
|
<template v-if="item.isDirectory">
|
|
4
|
-
<
|
|
5
|
-
class="directory-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
viewBox="0 0 256 256"
|
|
4
|
+
<button
|
|
5
|
+
class="directory-toggle"
|
|
6
|
+
type="button"
|
|
7
|
+
:data-folder-id="folderId"
|
|
8
|
+
aria-label="Toggle open directory"
|
|
9
|
+
@click="toggleIsOpen"
|
|
11
10
|
>
|
|
12
|
-
<
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
11
|
+
<svg
|
|
12
|
+
class="directory-caret"
|
|
13
|
+
:class="{ 'directory-caret--open': isOpen }"
|
|
14
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
15
|
+
width="12"
|
|
16
|
+
height="12"
|
|
17
|
+
fill="none"
|
|
18
|
+
viewBox="0 0 256 256"
|
|
19
|
+
>
|
|
20
|
+
<polyline
|
|
21
|
+
points="96 48 176 128 96 208"
|
|
22
|
+
stroke-linecap="round"
|
|
23
|
+
stroke-linejoin="round"
|
|
24
|
+
stroke-width="24"
|
|
25
|
+
></polyline>
|
|
26
|
+
</svg>
|
|
27
|
+
<svg
|
|
28
|
+
class="directory-icon"
|
|
29
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
30
|
+
width="15"
|
|
31
|
+
height="15"
|
|
32
|
+
fill="none"
|
|
33
|
+
viewBox="0 0 256 256"
|
|
34
|
+
>
|
|
35
|
+
<path
|
|
36
|
+
d="M216.9,208H39.4a7.4,7.4,0,0,1-7.4-7.4V80H216a8,8,0,0,1,8,8V200.9A7.1,7.1,0,0,1,216.9,208Z"
|
|
37
|
+
stroke-linecap="round"
|
|
38
|
+
stroke-linejoin="round"
|
|
39
|
+
stroke-width="16"
|
|
40
|
+
></path>
|
|
41
|
+
<path
|
|
42
|
+
d="M32,80V56a8,8,0,0,1,8-8H92.7a7.9,7.9,0,0,1,5.6,2.3L128,80"
|
|
43
|
+
stroke-linecap="round"
|
|
44
|
+
stroke-linejoin="round"
|
|
45
|
+
stroke-width="16"
|
|
46
|
+
></path>
|
|
47
|
+
</svg>
|
|
48
|
+
|
|
49
|
+
<span class="directory-name">{{ item.name }}</span>
|
|
50
|
+
</button>
|
|
51
|
+
|
|
52
|
+
<ul v-if="isOpen && item.children.length > 0" class="nav-list-item-children">
|
|
28
53
|
<nav-list-item
|
|
29
54
|
v-for="child in item.children"
|
|
30
55
|
:key="child.uuid"
|
|
31
56
|
:item="child"
|
|
32
57
|
:current-path="currentPath"
|
|
58
|
+
:tree-path="`${treePath}/${child.name}`"
|
|
33
59
|
/>
|
|
34
60
|
</ul>
|
|
35
61
|
</template>
|
|
@@ -140,6 +166,14 @@
|
|
|
140
166
|
</template>
|
|
141
167
|
|
|
142
168
|
<script>
|
|
169
|
+
import { site } from "virtual:compiiile"
|
|
170
|
+
|
|
171
|
+
const FOLDERS_STATE_KEY = "COMPIIILE_FOLDERS_STATE"
|
|
172
|
+
|
|
173
|
+
const getFoldersState = () => {
|
|
174
|
+
return JSON.parse(localStorage.getItem(FOLDERS_STATE_KEY) || "{}")
|
|
175
|
+
}
|
|
176
|
+
|
|
143
177
|
export default {
|
|
144
178
|
name: "NavListItem",
|
|
145
179
|
props: {
|
|
@@ -150,14 +184,68 @@
|
|
|
150
184
|
currentPath: {
|
|
151
185
|
type: String,
|
|
152
186
|
required: true
|
|
187
|
+
},
|
|
188
|
+
treePath: {
|
|
189
|
+
type: String,
|
|
190
|
+
required: true
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
data() {
|
|
194
|
+
return {
|
|
195
|
+
isOpen: true
|
|
153
196
|
}
|
|
154
197
|
},
|
|
155
198
|
computed: {
|
|
156
199
|
route() {
|
|
157
200
|
return this.$context.routeList.find((route) => route.name === this.item.uuid)
|
|
201
|
+
},
|
|
202
|
+
folderId() {
|
|
203
|
+
// We don't use the uuid but the full tree path so that it's persistent across builds
|
|
204
|
+
return encodeURIComponent(this.treePath)
|
|
158
205
|
}
|
|
159
206
|
},
|
|
207
|
+
watch: {
|
|
208
|
+
currentPath() {
|
|
209
|
+
if (this.item.isDirectory && this.containsCurrentPath(this.item)) {
|
|
210
|
+
this.isOpen = true
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
mounted() {
|
|
215
|
+
this.computeIsOpen()
|
|
216
|
+
},
|
|
160
217
|
methods: {
|
|
218
|
+
computeIsOpen() {
|
|
219
|
+
if (!this.item.isDirectory) {
|
|
220
|
+
return
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
const currentFoldersState = getFoldersState()
|
|
224
|
+
|
|
225
|
+
this.isOpen =
|
|
226
|
+
this.containsCurrentPath(this.item) ||
|
|
227
|
+
(Object.prototype.hasOwnProperty.call(currentFoldersState, this.folderId)
|
|
228
|
+
? currentFoldersState[this.folderId]
|
|
229
|
+
: !site.collapseFolders)
|
|
230
|
+
},
|
|
231
|
+
containsCurrentPath(item) {
|
|
232
|
+
if (!item.isDirectory) {
|
|
233
|
+
const route = this.$context.routeList.find((route) => route.name === item.uuid)
|
|
234
|
+
return route?.path === this.currentPath
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return item.children.some((child) => this.containsCurrentPath(child))
|
|
238
|
+
},
|
|
239
|
+
toggleIsOpen() {
|
|
240
|
+
this.isOpen = !this.isOpen
|
|
241
|
+
|
|
242
|
+
const currentFoldersState = getFoldersState()
|
|
243
|
+
const newFoldersState = {
|
|
244
|
+
...currentFoldersState,
|
|
245
|
+
[this.folderId]: this.isOpen
|
|
246
|
+
}
|
|
247
|
+
localStorage.setItem(FOLDERS_STATE_KEY, JSON.stringify(newFoldersState))
|
|
248
|
+
},
|
|
161
249
|
isVisible(item) {
|
|
162
250
|
if (!item.isDirectory) {
|
|
163
251
|
const route = this.$context.routeList.find((route) => route.name === item.uuid)
|
|
@@ -188,6 +276,37 @@
|
|
|
188
276
|
line-height: 1rem;
|
|
189
277
|
}
|
|
190
278
|
|
|
279
|
+
.directory-toggle {
|
|
280
|
+
display: inline-flex;
|
|
281
|
+
align-items: center;
|
|
282
|
+
gap: 3px;
|
|
283
|
+
padding: 0 3px 0 0;
|
|
284
|
+
border: none;
|
|
285
|
+
border-radius: 4px;
|
|
286
|
+
appearance: none;
|
|
287
|
+
background: transparent;
|
|
288
|
+
color: inherit;
|
|
289
|
+
cursor: pointer;
|
|
290
|
+
font: inherit;
|
|
291
|
+
text-align: left;
|
|
292
|
+
|
|
293
|
+
&:focus-visible {
|
|
294
|
+
outline: solid 1px var(--separator-color);
|
|
295
|
+
outline-offset: 2px;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.directory-caret {
|
|
300
|
+
stroke: var(--dimmed-text-color);
|
|
301
|
+
transform: rotate(0);
|
|
302
|
+
transition: transform 0.1s linear;
|
|
303
|
+
will-change: transform;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.directory-caret--open {
|
|
307
|
+
transform: rotate(90deg);
|
|
308
|
+
}
|
|
309
|
+
|
|
191
310
|
.directory-icon {
|
|
192
311
|
margin-left: 2px;
|
|
193
312
|
}
|
|
@@ -200,9 +319,6 @@
|
|
|
200
319
|
|
|
201
320
|
.directory-name {
|
|
202
321
|
display: inline;
|
|
203
|
-
margin-left: 3px;
|
|
204
|
-
position: relative;
|
|
205
|
-
top: -2px;
|
|
206
322
|
}
|
|
207
323
|
|
|
208
324
|
.file-icon {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
import ThemeLoader from "./ThemeLoader.astro";
|
|
3
|
+
import NavBarFoldersStateLoader from "./NavBarFoldersStateLoader.astro";
|
|
3
4
|
import '../utils/styles.js'
|
|
4
5
|
import {SEO} from "astro-seo"
|
|
5
6
|
const {title, description, isNotFoundPage} = Astro.props
|
|
@@ -37,6 +38,7 @@ const defaultTheme = site.theme
|
|
|
37
38
|
}}
|
|
38
39
|
/>}
|
|
39
40
|
<ThemeLoader defaultTheme={defaultTheme}/>
|
|
41
|
+
<NavBarFoldersStateLoader />
|
|
40
42
|
</head>
|
|
41
43
|
<body>
|
|
42
44
|
<slot></slot>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
---
|
|
2
|
+
import { site, routeList, filesTree } from "virtual:compiiile"
|
|
3
|
+
|
|
4
|
+
let currentPath = Astro.url.pathname
|
|
5
|
+
if(currentPath.length > 1 && currentPath.endsWith("/")){
|
|
6
|
+
currentPath = currentPath.slice(0, -1)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const foldersContainingCurrentPath = {}
|
|
10
|
+
|
|
11
|
+
// Here we manually compute folders that have to be opened on page load if they contain the current page to display
|
|
12
|
+
const scanFoldersContainingCurrentPath = (folder, fullPath) => {
|
|
13
|
+
return folder.children.some(item => {
|
|
14
|
+
if (item.isDirectory) {
|
|
15
|
+
const childPath = `${fullPath}/${item.name}`;
|
|
16
|
+
const childContainsCurrentPath = scanFoldersContainingCurrentPath(item, childPath);
|
|
17
|
+
|
|
18
|
+
if (childContainsCurrentPath) {
|
|
19
|
+
foldersContainingCurrentPath[encodeURIComponent(fullPath)] = true;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return childContainsCurrentPath;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const matchesCurrentPath = routeList.find(r => r.name === item.uuid)?.path === currentPath;
|
|
26
|
+
|
|
27
|
+
if (matchesCurrentPath) {
|
|
28
|
+
foldersContainingCurrentPath[encodeURIComponent(fullPath)] = true;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return matchesCurrentPath;
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
for(const navListItem of filesTree){
|
|
36
|
+
if(navListItem.isDirectory){
|
|
37
|
+
scanFoldersContainingCurrentPath(navListItem, navListItem.name)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
<script is:inline define:vars={{ site, foldersContainingCurrentPath }}>
|
|
44
|
+
/*
|
|
45
|
+
We apply styles in the HTML head to prevent blinking navbar items on page load,
|
|
46
|
+
since their state is computed on the client side because it required localStorage access.
|
|
47
|
+
This style is then removed in `NavBar.vue` to delegate the toggle behavior to the client side.
|
|
48
|
+
*/
|
|
49
|
+
const navStateStyle = document.createElement("style")
|
|
50
|
+
navStateStyle.id = "compiiile-folders-state-style"
|
|
51
|
+
|
|
52
|
+
const foldersState = {
|
|
53
|
+
...JSON.parse(localStorage.getItem("COMPIIILE_FOLDERS_STATE") || "{}"),
|
|
54
|
+
// we overwrite the localStorage expanded (true) or collapsed (false) value if the folder contains the current path
|
|
55
|
+
...foldersContainingCurrentPath
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let navStateStyles = ""
|
|
59
|
+
|
|
60
|
+
// Default values for folder states based on the global parameter `collapseFolders`
|
|
61
|
+
if(site.collapseFolders){
|
|
62
|
+
navStateStyles += `nav .files-tree .nav-list-item-children { display: none !important; }\n`
|
|
63
|
+
navStateStyles += `nav .files-tree .directory-caret { transform: rotate(0); !important }\n`
|
|
64
|
+
} else {
|
|
65
|
+
navStateStyles += `nav .files-tree .nav-list-item-children { display: block !important; }\n`
|
|
66
|
+
navStateStyles += `nav .files-tree .directory-caret { transform: rotate(90deg); !important }\n`
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Custom style declaration to force correct rendering for specific folders on page load
|
|
70
|
+
for (const [treePath, isOpen] of Object.entries(foldersState)) {
|
|
71
|
+
if (isOpen) {
|
|
72
|
+
navStateStyles += `nav .files-tree [data-folder-id="${treePath}"] + .nav-list-item-children { display: block !important; }\n`
|
|
73
|
+
navStateStyles += `nav .files-tree [data-folder-id="${treePath}"] .directory-caret { transform: rotate(90deg); !important }\n`
|
|
74
|
+
} else {
|
|
75
|
+
navStateStyles += `nav .files-tree [data-folder-id="${treePath}"] + .nav-list-item-children { display: none !important; }\n`
|
|
76
|
+
navStateStyles += `nav .files-tree [data-folder-id="${treePath}"] .directory-caret { transform: rotate(0) !important; }\n`
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
navStateStyle.textContent = navStateStyles
|
|
80
|
+
document.head.appendChild(navStateStyle)
|
|
81
|
+
</script>
|
|
@@ -16,7 +16,7 @@ if(currentPath.length > 1 && currentPath.endsWith("/")){
|
|
|
16
16
|
<div class="page">
|
|
17
17
|
<TopBar client:load />
|
|
18
18
|
|
|
19
|
-
<NavBar currentPath={ currentPath }/>
|
|
19
|
+
<NavBar currentPath={ currentPath } client:load/>
|
|
20
20
|
|
|
21
21
|
<div class="centered-layout">
|
|
22
22
|
<div class="content-wrapper">
|
|
@@ -60,7 +60,7 @@ const tableOfContent = getHeadings()
|
|
|
60
60
|
|
|
61
61
|
<WorkspaceLayout title={title} description={description} isNotFoundPage={false}>
|
|
62
62
|
<ContentWrapper name={name} tableOfContent={tableOfContent}>
|
|
63
|
-
<Content/>
|
|
63
|
+
<Content />
|
|
64
64
|
</ContentWrapper>
|
|
65
65
|
</WorkspaceLayout>
|
|
66
66
|
}
|