@quartz-community/explorer 0.1.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/CHANGELOG.md +12 -0
- package/LICENSE +21 -0
- package/README.md +96 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +526 -0
- package/dist/components/index.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +526 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +42 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +134 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial Quartz community plugin template.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Quartz Community
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# @quartz-community/explorer
|
|
2
|
+
|
|
3
|
+
The Explorer component for Quartz - navigate your digital garden with an interactive file tree.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 📁 Interactive folder tree with collapse/expand functionality
|
|
8
|
+
- 📱 Mobile-friendly slide-out navigation
|
|
9
|
+
- 💾 Persistent state (remembers open/closed folders)
|
|
10
|
+
- 🔗 Configurable folder click behavior (link or collapse)
|
|
11
|
+
- ⚡ Built-in search and overflow handling
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx quartz plugin add github:quartz-community/explorer
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```yaml title="quartz.config.yaml"
|
|
22
|
+
plugins:
|
|
23
|
+
- source: github:quartz-community/explorer
|
|
24
|
+
enabled: true
|
|
25
|
+
layout:
|
|
26
|
+
position: left
|
|
27
|
+
priority: 50
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
For advanced use cases, you can override in TypeScript:
|
|
31
|
+
|
|
32
|
+
```ts title="quartz.ts (override)"
|
|
33
|
+
import * as ExternalPlugin from "./.quartz/plugins";
|
|
34
|
+
|
|
35
|
+
ExternalPlugin.Explorer({
|
|
36
|
+
title: "Explorer",
|
|
37
|
+
folderDefaultState: "collapsed",
|
|
38
|
+
folderClickBehavior: "link",
|
|
39
|
+
useSavedState: true,
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Configuration Options
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
interface ExplorerOptions {
|
|
47
|
+
/** Title displayed above the explorer */
|
|
48
|
+
title?: string;
|
|
49
|
+
|
|
50
|
+
/** Default state for folders: "collapsed" or "open" */
|
|
51
|
+
folderDefaultState: "collapsed" | "open";
|
|
52
|
+
|
|
53
|
+
/** Behavior when clicking folders: "collapse" to toggle, "link" to navigate */
|
|
54
|
+
folderClickBehavior: "collapse" | "link";
|
|
55
|
+
|
|
56
|
+
/** Whether to persist folder state in localStorage */
|
|
57
|
+
useSavedState: boolean;
|
|
58
|
+
|
|
59
|
+
/** Custom sort function for entries */
|
|
60
|
+
sortFn?: (a: FileTrieNode, b: FileTrieNode) => number;
|
|
61
|
+
|
|
62
|
+
/** Custom filter function for entries */
|
|
63
|
+
filterFn?: (node: FileTrieNode) => boolean;
|
|
64
|
+
|
|
65
|
+
/** Custom map function for transforming entries */
|
|
66
|
+
mapFn?: (node: FileTrieNode) => void;
|
|
67
|
+
|
|
68
|
+
/** Order in which to apply filter, map, and sort */
|
|
69
|
+
order?: Array<"filter" | "map" | "sort">;
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Default Behavior
|
|
74
|
+
|
|
75
|
+
By default, the Explorer:
|
|
76
|
+
|
|
77
|
+
- Shows folders in a collapsed state
|
|
78
|
+
- Opens folders when clicked (navigates to index page)
|
|
79
|
+
- Saves folder states between sessions
|
|
80
|
+
- Excludes the "tags" folder from the tree
|
|
81
|
+
- Sorts folders first, then files alphabetically
|
|
82
|
+
|
|
83
|
+
## Development
|
|
84
|
+
|
|
85
|
+
This is a first-party Quartz community plugin. It serves as both:
|
|
86
|
+
|
|
87
|
+
1. A production-ready Explorer component
|
|
88
|
+
2. A reference implementation for building Quartz community plugins
|
|
89
|
+
|
|
90
|
+
## Documentation
|
|
91
|
+
|
|
92
|
+
See the [Quartz documentation](https://quartz.jzhao.xyz/features/explorer) for more information.
|
|
93
|
+
|
|
94
|
+
## License
|
|
95
|
+
|
|
96
|
+
MIT
|
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
// node_modules/preact/dist/preact.mjs
|
|
2
|
+
var l;
|
|
3
|
+
l = { __e: function(n2, l2, u3, t2) {
|
|
4
|
+
for (var i2, r2, o2; l2 = l2.__; ) if ((i2 = l2.__c) && !i2.__) try {
|
|
5
|
+
if ((r2 = i2.constructor) && null != r2.getDerivedStateFromError && (i2.setState(r2.getDerivedStateFromError(n2)), o2 = i2.__d), null != i2.componentDidCatch && (i2.componentDidCatch(n2, t2 || {}), o2 = i2.__d), o2) return i2.__E = i2;
|
|
6
|
+
} catch (l3) {
|
|
7
|
+
n2 = l3;
|
|
8
|
+
}
|
|
9
|
+
throw n2;
|
|
10
|
+
} }, "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, Math.random().toString(8);
|
|
11
|
+
|
|
12
|
+
// node_modules/preact/jsx-runtime/dist/jsxRuntime.mjs
|
|
13
|
+
var f2 = 0;
|
|
14
|
+
function u2(e2, t2, n2, o2, i2, u3) {
|
|
15
|
+
t2 || (t2 = {});
|
|
16
|
+
var a2, c2, p2 = t2;
|
|
17
|
+
if ("ref" in p2) for (c2 in p2 = {}, t2) "ref" == c2 ? a2 = t2[c2] : p2[c2] = t2[c2];
|
|
18
|
+
var l2 = { type: e2, props: p2, key: n2, ref: a2, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --f2, __i: -1, __u: 0, __source: i2, __self: u3 };
|
|
19
|
+
if ("function" == typeof e2 && (a2 = e2.defaultProps)) for (c2 in a2) void 0 === p2[c2] && (p2[c2] = a2[c2]);
|
|
20
|
+
return l.vnode && l.vnode(l2), l2;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/components/OverflowList.tsx
|
|
24
|
+
var OverflowList = ({
|
|
25
|
+
children,
|
|
26
|
+
...props
|
|
27
|
+
}) => {
|
|
28
|
+
return /* @__PURE__ */ u2("ul", { ...props, class: [props.class, "overflow"].filter(Boolean).join(" "), id: props.id, children: [
|
|
29
|
+
children,
|
|
30
|
+
/* @__PURE__ */ u2("li", { class: "overflow-end" })
|
|
31
|
+
] });
|
|
32
|
+
};
|
|
33
|
+
var numLists = 0;
|
|
34
|
+
var OverflowList_default = () => {
|
|
35
|
+
const id = `list-${numLists++}`;
|
|
36
|
+
return {
|
|
37
|
+
OverflowList: (props) => /* @__PURE__ */ u2(OverflowList, { ...props, id }),
|
|
38
|
+
overflowListAfterDOMLoaded: `
|
|
39
|
+
document.addEventListener("nav", (e) => {
|
|
40
|
+
const ul = document.getElementById("${id}")
|
|
41
|
+
if (!ul) return
|
|
42
|
+
|
|
43
|
+
const end = ul.querySelector(".overflow-end")
|
|
44
|
+
if (!end) return
|
|
45
|
+
|
|
46
|
+
const scrollContainer = ul.parentElement
|
|
47
|
+
const observer = new IntersectionObserver((entries) => {
|
|
48
|
+
for (const entry of entries) {
|
|
49
|
+
const parentUl = entry.target.parentElement
|
|
50
|
+
if (!parentUl) return
|
|
51
|
+
if (entry.isIntersecting) {
|
|
52
|
+
parentUl.classList.remove("gradient-active")
|
|
53
|
+
} else {
|
|
54
|
+
parentUl.classList.add("gradient-active")
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}, scrollContainer ? { root: scrollContainer } : undefined)
|
|
58
|
+
|
|
59
|
+
observer.observe(end)
|
|
60
|
+
window.addCleanup(() => observer.disconnect())
|
|
61
|
+
})
|
|
62
|
+
`
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// node_modules/@quartz-community/utils/dist/lang.js
|
|
67
|
+
function classNames(...classes) {
|
|
68
|
+
return classes.filter(Boolean).join(" ");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/i18n/locales/en-US.ts
|
|
72
|
+
var en_US_default = {
|
|
73
|
+
components: {
|
|
74
|
+
explorer: {
|
|
75
|
+
title: "Explorer"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/i18n/locales/en-GB.ts
|
|
81
|
+
var en_GB_default = {
|
|
82
|
+
components: {
|
|
83
|
+
explorer: {
|
|
84
|
+
title: "Explorer"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
// src/i18n/locales/ar-SA.ts
|
|
90
|
+
var ar_SA_default = {
|
|
91
|
+
components: {
|
|
92
|
+
explorer: {
|
|
93
|
+
title: "\u0627\u0644\u0645\u0633\u062A\u0639\u0631\u0636"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// src/i18n/locales/ca-ES.ts
|
|
99
|
+
var ca_ES_default = {
|
|
100
|
+
components: {
|
|
101
|
+
explorer: {
|
|
102
|
+
title: "Explorador"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
// src/i18n/locales/cs-CZ.ts
|
|
108
|
+
var cs_CZ_default = {
|
|
109
|
+
components: {
|
|
110
|
+
explorer: {
|
|
111
|
+
title: "Proch\xE1zet"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// src/i18n/locales/de-DE.ts
|
|
117
|
+
var de_DE_default = {
|
|
118
|
+
components: {
|
|
119
|
+
explorer: {
|
|
120
|
+
title: "Explorer"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
// src/i18n/locales/es-ES.ts
|
|
126
|
+
var es_ES_default = {
|
|
127
|
+
components: {
|
|
128
|
+
explorer: {
|
|
129
|
+
title: "Explorador"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
// src/i18n/locales/fa-IR.ts
|
|
135
|
+
var fa_IR_default = {
|
|
136
|
+
components: {
|
|
137
|
+
explorer: {
|
|
138
|
+
title: "\u0645\u0637\u0627\u0644\u0628"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
// src/i18n/locales/fi-FI.ts
|
|
144
|
+
var fi_FI_default = {
|
|
145
|
+
components: {
|
|
146
|
+
explorer: {
|
|
147
|
+
title: "Selain"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// src/i18n/locales/fr-FR.ts
|
|
153
|
+
var fr_FR_default = {
|
|
154
|
+
components: {
|
|
155
|
+
explorer: {
|
|
156
|
+
title: "Explorateur"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// src/i18n/locales/he-IL.ts
|
|
162
|
+
var he_IL_default = {
|
|
163
|
+
components: {
|
|
164
|
+
explorer: {
|
|
165
|
+
title: "\u05E1\u05D9\u05D9\u05E8"
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
// src/i18n/locales/hu-HU.ts
|
|
171
|
+
var hu_HU_default = {
|
|
172
|
+
components: {
|
|
173
|
+
explorer: {
|
|
174
|
+
title: "F\xE1jlb\xF6ng\xE9sz\u0151"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
// src/i18n/locales/id-ID.ts
|
|
180
|
+
var id_ID_default = {
|
|
181
|
+
components: {
|
|
182
|
+
explorer: {
|
|
183
|
+
title: "Penjelajah"
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
// src/i18n/locales/it-IT.ts
|
|
189
|
+
var it_IT_default = {
|
|
190
|
+
components: {
|
|
191
|
+
explorer: {
|
|
192
|
+
title: "Esplora"
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
// src/i18n/locales/ja-JP.ts
|
|
198
|
+
var ja_JP_default = {
|
|
199
|
+
components: {
|
|
200
|
+
explorer: {
|
|
201
|
+
title: "\u30A8\u30AF\u30B9\u30D7\u30ED\u30FC\u30E9\u30FC"
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
// src/i18n/locales/kk-KZ.ts
|
|
207
|
+
var kk_KZ_default = {
|
|
208
|
+
components: {
|
|
209
|
+
explorer: {
|
|
210
|
+
title: "\u0417\u0435\u0440\u0442\u0442\u0435\u0443\u0448\u0456"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
// src/i18n/locales/ko-KR.ts
|
|
216
|
+
var ko_KR_default = {
|
|
217
|
+
components: {
|
|
218
|
+
explorer: {
|
|
219
|
+
title: "\uD0D0\uC0C9\uAE30"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
// src/i18n/locales/lt-LT.ts
|
|
225
|
+
var lt_LT_default = {
|
|
226
|
+
components: {
|
|
227
|
+
explorer: {
|
|
228
|
+
title: "Nar\u0161ykl\u0117"
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
// src/i18n/locales/nb-NO.ts
|
|
234
|
+
var nb_NO_default = {
|
|
235
|
+
components: {
|
|
236
|
+
explorer: {
|
|
237
|
+
title: "Utforsker"
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
// src/i18n/locales/nl-NL.ts
|
|
243
|
+
var nl_NL_default = {
|
|
244
|
+
components: {
|
|
245
|
+
explorer: {
|
|
246
|
+
title: "Verkenner"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
|
|
251
|
+
// src/i18n/locales/pl-PL.ts
|
|
252
|
+
var pl_PL_default = {
|
|
253
|
+
components: {
|
|
254
|
+
explorer: {
|
|
255
|
+
title: "Przegl\u0105daj"
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// src/i18n/locales/pt-BR.ts
|
|
261
|
+
var pt_BR_default = {
|
|
262
|
+
components: {
|
|
263
|
+
explorer: {
|
|
264
|
+
title: "Explorador"
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
// src/i18n/locales/ro-RO.ts
|
|
270
|
+
var ro_RO_default = {
|
|
271
|
+
components: {
|
|
272
|
+
explorer: {
|
|
273
|
+
title: "Explorator"
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
// src/i18n/locales/ru-RU.ts
|
|
279
|
+
var ru_RU_default = {
|
|
280
|
+
components: {
|
|
281
|
+
explorer: {
|
|
282
|
+
title: "\u041F\u0440\u043E\u0432\u043E\u0434\u043D\u0438\u043A"
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
// src/i18n/locales/th-TH.ts
|
|
288
|
+
var th_TH_default = {
|
|
289
|
+
components: {
|
|
290
|
+
explorer: {
|
|
291
|
+
title: "\u0E23\u0E32\u0E22\u0E01\u0E32\u0E23\u0E2B\u0E19\u0E49\u0E32"
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
// src/i18n/locales/tr-TR.ts
|
|
297
|
+
var tr_TR_default = {
|
|
298
|
+
components: {
|
|
299
|
+
explorer: {
|
|
300
|
+
title: "Gezgin"
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
// src/i18n/locales/uk-UA.ts
|
|
306
|
+
var uk_UA_default = {
|
|
307
|
+
components: {
|
|
308
|
+
explorer: {
|
|
309
|
+
title: "\u041F\u0440\u043E\u0432\u0456\u0434\u043D\u0438\u043A"
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
// src/i18n/locales/vi-VN.ts
|
|
315
|
+
var vi_VN_default = {
|
|
316
|
+
components: {
|
|
317
|
+
explorer: {
|
|
318
|
+
title: "N\u1ED9i dung"
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// src/i18n/locales/zh-CN.ts
|
|
324
|
+
var zh_CN_default = {
|
|
325
|
+
components: {
|
|
326
|
+
explorer: {
|
|
327
|
+
title: "\u63A2\u7D22"
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
// src/i18n/locales/zh-TW.ts
|
|
333
|
+
var zh_TW_default = {
|
|
334
|
+
components: {
|
|
335
|
+
explorer: {
|
|
336
|
+
title: "\u63A2\u7D22"
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
// src/i18n/index.ts
|
|
342
|
+
var locales = {
|
|
343
|
+
"en-US": en_US_default,
|
|
344
|
+
"en-GB": en_GB_default,
|
|
345
|
+
"ar-SA": ar_SA_default,
|
|
346
|
+
"ca-ES": ca_ES_default,
|
|
347
|
+
"cs-CZ": cs_CZ_default,
|
|
348
|
+
"de-DE": de_DE_default,
|
|
349
|
+
"es-ES": es_ES_default,
|
|
350
|
+
"fa-IR": fa_IR_default,
|
|
351
|
+
"fi-FI": fi_FI_default,
|
|
352
|
+
"fr-FR": fr_FR_default,
|
|
353
|
+
"he-IL": he_IL_default,
|
|
354
|
+
"hu-HU": hu_HU_default,
|
|
355
|
+
"id-ID": id_ID_default,
|
|
356
|
+
"it-IT": it_IT_default,
|
|
357
|
+
"ja-JP": ja_JP_default,
|
|
358
|
+
"kk-KZ": kk_KZ_default,
|
|
359
|
+
"ko-KR": ko_KR_default,
|
|
360
|
+
"lt-LT": lt_LT_default,
|
|
361
|
+
"nb-NO": nb_NO_default,
|
|
362
|
+
"nl-NL": nl_NL_default,
|
|
363
|
+
"pl-PL": pl_PL_default,
|
|
364
|
+
"pt-BR": pt_BR_default,
|
|
365
|
+
"ro-RO": ro_RO_default,
|
|
366
|
+
"ru-RU": ru_RU_default,
|
|
367
|
+
"th-TH": th_TH_default,
|
|
368
|
+
"tr-TR": tr_TR_default,
|
|
369
|
+
"uk-UA": uk_UA_default,
|
|
370
|
+
"vi-VN": vi_VN_default,
|
|
371
|
+
"zh-CN": zh_CN_default,
|
|
372
|
+
"zh-TW": zh_TW_default
|
|
373
|
+
};
|
|
374
|
+
function i18n(locale) {
|
|
375
|
+
return locales[locale] || en_US_default;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// src/components/styles/explorer.scss
|
|
379
|
+
var explorer_default = "@media all and (max-width: 800px) {\n .page > #quartz-body > :not(.sidebar.left:has(.explorer)) {\n transition: transform 300ms ease-in-out;\n }\n .page > #quartz-body.lock-scroll > :not(.sidebar.left:has(.explorer)) {\n transform: translateX(100dvw);\n transition: transform 300ms ease-in-out;\n }\n .page > #quartz-body .sidebar.left:has(.explorer) {\n box-sizing: border-box;\n position: sticky;\n background-color: var(--light);\n padding: 1rem 0 1rem 0;\n margin: 0;\n }\n .page > #quartz-body .hide-until-loaded ~ .explorer-content {\n display: none;\n }\n}\n.explorer {\n display: flex;\n flex-direction: column;\n overflow-y: hidden;\n min-height: 1.2rem;\n flex: 0 1 auto;\n}\n\n.explorer.collapsed {\n flex: 0 1 1.2rem;\n}\n\n.explorer.collapsed .fold {\n transform: rotateZ(-90deg);\n}\n\n.explorer .fold {\n margin-left: 0.5rem;\n transition: transform 0.3s ease;\n opacity: 0.8;\n}\n\n@media all and (max-width: 800px) {\n .explorer {\n order: -1;\n height: initial;\n overflow: hidden;\n flex-shrink: 0;\n align-self: flex-start;\n margin-top: auto;\n margin-bottom: auto;\n }\n}\n.explorer button.mobile-explorer {\n display: none;\n}\n\n.explorer button.desktop-explorer {\n display: flex;\n}\n\n@media all and (max-width: 800px) {\n .explorer button.mobile-explorer {\n display: flex;\n }\n .explorer button.desktop-explorer {\n display: none;\n }\n}\n.explorer svg {\n pointer-events: all;\n transition: transform 0.35s ease;\n}\n\n.explorer svg > polyline {\n pointer-events: none;\n}\n\nbutton.mobile-explorer,\nbutton.desktop-explorer {\n background-color: transparent;\n border: none;\n text-align: left;\n cursor: pointer;\n padding: 0;\n color: var(--dark);\n display: flex;\n align-items: center;\n}\n\nbutton.mobile-explorer h2,\nbutton.desktop-explorer h2 {\n font-size: 1rem;\n display: inline-block;\n margin: 0;\n}\n\n.explorer-content {\n list-style: none;\n overflow: hidden;\n overflow-y: auto;\n margin-top: 0.5rem;\n}\n\n.explorer-content ul {\n list-style: none;\n margin: 0;\n padding: 0;\n}\n\n.explorer-content ul.explorer-ul {\n overscroll-behavior: contain;\n}\n\n.explorer-content ul li > a {\n color: var(--dark);\n opacity: 0.75;\n pointer-events: all;\n}\n\n.explorer-content ul li > a.active {\n opacity: 1;\n color: var(--tertiary);\n}\n\n.explorer-content .folder-outer {\n visibility: collapse;\n display: grid;\n grid-template-rows: 0fr;\n transition-property: grid-template-rows, visibility;\n transition-duration: 0.3s;\n transition-timing-function: ease-in-out;\n}\n\n.explorer-content .folder-outer.open {\n visibility: visible;\n grid-template-rows: 1fr;\n}\n\n.explorer-content .folder-outer > ul {\n overflow: hidden;\n margin-left: 6px;\n padding-left: 0.8rem;\n border-left: 1px solid var(--lightgray);\n}\n\n.folder-container {\n flex-direction: row;\n display: flex;\n align-items: center;\n user-select: none;\n}\n\n.folder-container div > a {\n color: var(--secondary);\n font-family: var(--headerFont);\n font-size: 0.95rem;\n font-weight: 600;\n line-height: 1.5rem;\n display: inline-block;\n}\n\n.folder-container div > a:hover {\n color: var(--tertiary);\n}\n\n.folder-container div > button {\n color: var(--dark);\n background-color: transparent;\n border: none;\n text-align: left;\n cursor: pointer;\n padding-left: 0;\n padding-right: 0;\n display: flex;\n align-items: center;\n font-family: var(--headerFont);\n}\n\n.folder-container div > button span {\n font-size: 0.95rem;\n display: inline-block;\n color: var(--secondary);\n font-weight: 600;\n margin: 0;\n line-height: 1.5rem;\n pointer-events: none;\n}\n\n.folder-icon {\n margin-right: 5px;\n color: var(--secondary);\n cursor: pointer;\n transition: transform 0.3s ease;\n backface-visibility: visible;\n flex-shrink: 0;\n}\n\nli:has(> .folder-outer:not(.open)) > .folder-container > svg {\n transform: rotate(-90deg);\n}\n\n.folder-icon:hover {\n color: var(--tertiary);\n}\n\n@media all and (max-width: 800px) {\n .explorer.collapsed {\n flex: 0 0 34px;\n }\n .explorer.collapsed > .explorer-content {\n transform: translateX(-100vw);\n visibility: hidden;\n }\n .explorer:not(.collapsed) {\n flex: 0 0 34px;\n }\n .explorer:not(.collapsed) > .explorer-content {\n transform: translateX(0);\n visibility: visible;\n }\n .explorer .explorer-content {\n box-sizing: border-box;\n z-index: 100;\n position: absolute;\n top: 0;\n left: 0;\n margin-top: 0;\n background-color: var(--light);\n max-width: 100vw;\n width: 100vw;\n transform: translateX(-100vw);\n transition: transform 200ms ease, visibility 200ms ease;\n overflow: hidden;\n padding: 4rem 0 2rem 0;\n height: 100dvh;\n max-height: 100dvh;\n visibility: hidden;\n }\n .explorer .mobile-explorer {\n margin: 0;\n padding: 5px;\n z-index: 101;\n }\n .explorer .mobile-explorer.hide-until-loaded {\n display: none;\n }\n .explorer .mobile-explorer .lucide-menu {\n stroke: var(--darkgray);\n }\n}\n@media all and (max-width: 800px) {\n .mobile-no-scroll .explorer-content > .explorer-ul {\n overscroll-behavior: contain;\n }\n}";
|
|
380
|
+
|
|
381
|
+
// src/components/scripts/explorer.inline.ts
|
|
382
|
+
var explorer_inline_default = `var U=Object.hasOwnProperty;function S(u){let e=k(I(u,"index"),!0);return e.length===0?"/":e}function T(){return typeof document>"u"?"":document.body?.dataset?.basepath??""}function v(u,e){let D=e??T(),F=u.startsWith("/")?u:"/"+u;return D+F}function W(u,e){return u===e||u.endsWith("/"+e)}function I(u,e){return W(u,e)&&(u=u.slice(0,-e.length)),u}function k(u,e){return u.startsWith("/")&&(u=u.substring(1)),!e&&u.endsWith("/")&&(u=u.slice(0,-1)),u}var y=class u{constructor(e,D){this.children=[],this.slugSegments=e,this.data=D||null,this.isFolder=!1,this.fileSegmentHint=null,this.displayNameOverride=void 0}get displayName(){return this.displayNameOverride!==void 0?this.displayNameOverride:(this.data?.title==="index"?void 0:this.data?.title)||this.fileSegmentHint||this.slugSegment||""}set displayName(e){this.displayNameOverride=e}get slug(){let e=this.slugSegments.join("/");return this.isFolder?e+"/index":e}get slugSegment(){return this.slugSegments[this.slugSegments.length-1]||""}makeChild(e,D){let F=[...this.slugSegments,e[0]],r=new u(F,D);return this.children.push(r),r}insert(e,D){if(e.length===0)return;this.isFolder=!0;let F=e[0];if(e.length===1)F==="index"?this.data||(this.data=D):this.makeChild(e,D);else{let r=this.children.find(n=>n.slugSegment===F);r||(r=this.makeChild(e,void 0));let t=(D.filePath||D.slug||"").split("/");r.fileSegmentHint=t[t.length-e.length],r.insert(e.slice(1),D)}}add(e){this.insert(e.slug.split("/"),e)}sort(e){this.children.sort(e),this.children.forEach(D=>D.sort(e))}filter(e){this.children=this.children.filter(e),this.children.forEach(D=>D.filter(e))}map(e){e(this),this.children.forEach(D=>D.map(e))}static fromEntries(e){let D=new u([],null);return e.forEach(([,F])=>D.add(F)),D}},P=(u,e)=>!u.isFolder&&!e.isFolder||u.isFolder&&e.isFolder?u.displayName.localeCompare(e.displayName,void 0,{numeric:!0,sensitivity:"base"}):!u.isFolder&&e.isFolder?1:-1,O=u=>u.slugSegment!=="tags";function j(u,e,D,F){return D&&u.filter(D),F&&u.map(F),e&&u.sort(e),u}async function R(u){try{console.log("[Explorer] Fetching content index...");let e=await fetchData;if(console.log("[Explorer] Fetched data keys:",Object.keys(e).slice(0,5)),!e)return console.error("[Explorer] No data received"),null;let D=e.content||e,F=Object.entries(D);if(console.log("[Explorer] Entry count:",F.length),F.length===0)return console.warn("[Explorer] No content entries found"),null;let r=y.fromEntries(F);console.log("[Explorer] Trie root children:",r.children.length);let t=P,n=O,d=null;if(u)try{let E=JSON.parse(u);E.sortFn&&(t=new Function("a","b","return ("+E.sortFn+")(a, b)")),E.filterFn&&(n=new Function("node","return ("+E.filterFn+")(node)")),E.mapFn&&(d=new Function("node","("+E.mapFn+")(node)"))}catch(E){console.error("Error parsing data functions:",E)}return j(r,t,n,d)}catch(e){return console.error("Error building file trie:",e),null}}var b=0;function N(u,e,D,F,r,t=""){let n=document.getElementById("template-folder"),d=document.getElementById("template-file");if(!n||!d)return;let E=t?t+"/"+u.slugSegment:u.slugSegment,A=S(D);if(u.isFolder){let s=n.content.cloneNode(!0),a=s.querySelector(".folder-container"),p=s.querySelector(".folder-button"),m=s.querySelector(".folder-title"),l=s.querySelector(".folder-outer"),o=s.querySelector(".content");if(m&&(m.textContent=u.displayName||u.slugSegment),a&&(a.dataset.folderpath=u.slug),F==="link"&&p){let i=document.createElement("a");i.className=p.className;let B=S(u.slug);i.href=v(B||""),m?i.appendChild(m):i.textContent=u.displayName||u.slugSegment,p.replaceWith(i),p=i}let C=r[u.slug]!==void 0?r[u.slug]:!0,c=S(u.slug),f=c&&c===A.slice(0,c.length);if((!C||f)&&l&&l.classList.add("open"),u.children&&u.children.length>0&&o)for(let i of u.children)N(i,o,D,F,r,E);e.appendChild(s)}else if(u.data){let s=d.content.cloneNode(!0),a=s.querySelector("a");a&&(a.href=v(u.data.slug),a.textContent=u.displayName||u.slugSegment,u.data.slug===D&&a.classList.add("active","is-active")),e.appendChild(s)}}async function L(u){let e=++b;try{console.log("[Explorer] Nav event received, generation:",e);let D=(u.detail?.url||"").replace(/^\\/+/,""),F=document.querySelectorAll("div.explorer");console.log("[Explorer] Found",F.length,"explorers");let r={};try{JSON.parse(localStorage.getItem("fileTree")||"[]").forEach(n=>{r[n.path]=n.collapsed})}catch(t){console.error("[Explorer] Error loading saved state:",t)}for(let t of F){let n=t.querySelector(".explorer-ul");if(!n){console.warn("[Explorer] No explorer-ul found");continue}n.innerHTML='<li class="overflow-end"></li>';let d=t.dataset.dataFns,E=t.dataset.behavior||"collapse";console.log("[Explorer] Starting tree build...");let A=await R(d);if(e===b){if(console.log("[Explorer] Render generation is current, rendering tree"),console.log("[Explorer] Trie result:",A?"success":"null"),A&&A.children&&A.children.length>0){n.innerHTML='<li class="overflow-end"></li>',console.log("[Explorer] Rendering",A.children.length,"children");for(let o of A.children)N(o,n,D,E,r,"");console.log("[Explorer] Render complete, final list length:",n.children.length)}else console.warn("[Explorer] No trie or empty children");let l=sessionStorage.getItem("explorerScrollTop");if(l)n.scrollTop=parseInt(l,10);else{let o=n.querySelector(".active");o&&o.scrollIntoView({behavior:"smooth"})}}else console.log("[Explorer] Stale render generation, skipping tree render");let s=[],a=t.getElementsByClassName("explorer-toggle");for(let l of a){let o=function(){let C=this.closest(".explorer");if(!C)return;let c=C.classList.toggle("collapsed");C.setAttribute("aria-expanded",c?"false":"true"),c?document.documentElement.classList.remove("mobile-no-scroll"):document.documentElement.classList.add("mobile-no-scroll")};l.addEventListener("click",o),s.push(()=>l.removeEventListener("click",o))}let p=t.getElementsByClassName("folder-icon");for(let l of p){let o=function(C){C.stopPropagation();let c=this.parentElement;if(!c)return;let f=c.nextElementSibling;if(!f)return;f.classList.toggle("open");let i=!f.classList.contains("open"),B=c.dataset.folderpath,h=JSON.parse(localStorage.getItem("fileTree")||"[]"),g=h.findIndex(x=>x.path===B);g>=0?h[g].collapsed=i:h.push({path:B,collapsed:i}),localStorage.setItem("fileTree",JSON.stringify(h))};l.addEventListener("click",o),s.push(()=>l.removeEventListener("click",o))}let m=t.getElementsByClassName("folder-button");for(let l of m){let o=function(C){let c=this.closest(".folder-container");if(!c)return;let f=t.dataset.behavior||"collapse",i=c.nextElementSibling,B=c.dataset.folderpath;if(f!=="link"){if(C.stopPropagation(),!i)return;i.classList.toggle("open");let h=!i.classList.contains("open"),g=JSON.parse(localStorage.getItem("fileTree")||"[]"),x=g.findIndex(w=>w.path===B);x>=0?g[x].collapsed=h:g.push({path:B,collapsed:h}),localStorage.setItem("fileTree",JSON.stringify(g))}};l.addEventListener("click",o),s.push(()=>l.removeEventListener("click",o))}typeof window<"u"&&window.addCleanup&&window.addCleanup(()=>s.forEach(l=>l()))}for(let t of document.getElementsByClassName("explorer")){let n=t.querySelector(".mobile-explorer");n&&(n.classList.remove("hide-until-loaded"),n.checkVisibility&&n.checkVisibility()&&(t.classList.add("collapsed"),t.setAttribute("aria-expanded","false"),document.documentElement.classList.remove("mobile-no-scroll")))}}catch(D){console.error("[Explorer] Fatal error in nav handler:",D)}}document.addEventListener("nav",L);document.addEventListener("render",L);document.addEventListener("prenav",()=>{let u=document.querySelector(".explorer-ul");u&&sessionStorage.setItem("explorerScrollTop",u.scrollTop.toString())});
|
|
383
|
+
`;
|
|
384
|
+
|
|
385
|
+
// src/components/Explorer.tsx
|
|
386
|
+
var defaultOptions = {
|
|
387
|
+
folderDefaultState: "collapsed",
|
|
388
|
+
folderClickBehavior: "link",
|
|
389
|
+
useSavedState: true,
|
|
390
|
+
mapFn: (node) => {
|
|
391
|
+
return node;
|
|
392
|
+
},
|
|
393
|
+
sortFn: (a2, b2) => {
|
|
394
|
+
if (!a2.isFolder && !b2.isFolder || a2.isFolder && b2.isFolder) {
|
|
395
|
+
return (a2.displayName || "").localeCompare(b2.displayName || "", void 0, {
|
|
396
|
+
numeric: true,
|
|
397
|
+
sensitivity: "base"
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
if (!a2.isFolder && b2.isFolder) {
|
|
401
|
+
return 1;
|
|
402
|
+
}
|
|
403
|
+
return -1;
|
|
404
|
+
},
|
|
405
|
+
filterFn: (node) => node.slugSegment !== "tags",
|
|
406
|
+
order: ["filter", "map", "sort"]
|
|
407
|
+
};
|
|
408
|
+
var numExplorers = 0;
|
|
409
|
+
function concatenateResources(...resources) {
|
|
410
|
+
return resources.filter((r2) => !!r2).join("\n");
|
|
411
|
+
}
|
|
412
|
+
var Explorer_default = ((userOpts) => {
|
|
413
|
+
const opts = { ...defaultOptions, ...userOpts };
|
|
414
|
+
const { OverflowList: OverflowList2, overflowListAfterDOMLoaded } = OverflowList_default();
|
|
415
|
+
const ExplorerComponent = (props) => {
|
|
416
|
+
const { cfg } = props;
|
|
417
|
+
const displayClass = props.displayClass;
|
|
418
|
+
const id = `explorer-${numExplorers++}`;
|
|
419
|
+
const locale = cfg?.locale ?? "en-US";
|
|
420
|
+
const title = opts.title ?? i18n(locale).components.explorer.title;
|
|
421
|
+
return /* @__PURE__ */ u2(
|
|
422
|
+
"div",
|
|
423
|
+
{
|
|
424
|
+
class: classNames(displayClass, "explorer", "nav-files-container"),
|
|
425
|
+
"data-behavior": opts.folderClickBehavior,
|
|
426
|
+
"data-collapsed": opts.folderDefaultState,
|
|
427
|
+
"data-savestate": opts.useSavedState,
|
|
428
|
+
"data-data-fns": JSON.stringify({
|
|
429
|
+
order: opts.order,
|
|
430
|
+
sortFn: opts.sortFn?.toString(),
|
|
431
|
+
filterFn: opts.filterFn?.toString(),
|
|
432
|
+
mapFn: opts.mapFn?.toString()
|
|
433
|
+
}),
|
|
434
|
+
children: [
|
|
435
|
+
/* @__PURE__ */ u2(
|
|
436
|
+
"button",
|
|
437
|
+
{
|
|
438
|
+
type: "button",
|
|
439
|
+
class: "explorer-toggle mobile-explorer hide-until-loaded",
|
|
440
|
+
"data-mobile": true,
|
|
441
|
+
"aria-controls": id,
|
|
442
|
+
"aria-label": i18n(cfg?.locale ?? "en-US").components.explorer.title,
|
|
443
|
+
children: /* @__PURE__ */ u2(
|
|
444
|
+
"svg",
|
|
445
|
+
{
|
|
446
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
447
|
+
width: "24",
|
|
448
|
+
height: "24",
|
|
449
|
+
viewBox: "0 0 24 24",
|
|
450
|
+
"stroke-width": "2",
|
|
451
|
+
"stroke-linecap": "round",
|
|
452
|
+
"stroke-linejoin": "round",
|
|
453
|
+
class: "lucide-menu",
|
|
454
|
+
children: [
|
|
455
|
+
/* @__PURE__ */ u2("line", { x1: "4", x2: "20", y1: "12", y2: "12" }),
|
|
456
|
+
/* @__PURE__ */ u2("line", { x1: "4", x2: "20", y1: "6", y2: "6" }),
|
|
457
|
+
/* @__PURE__ */ u2("line", { x1: "4", x2: "20", y1: "18", y2: "18" })
|
|
458
|
+
]
|
|
459
|
+
}
|
|
460
|
+
)
|
|
461
|
+
}
|
|
462
|
+
),
|
|
463
|
+
/* @__PURE__ */ u2(
|
|
464
|
+
"button",
|
|
465
|
+
{
|
|
466
|
+
type: "button",
|
|
467
|
+
class: "title-button explorer-toggle desktop-explorer",
|
|
468
|
+
"data-mobile": false,
|
|
469
|
+
"aria-expanded": true,
|
|
470
|
+
children: [
|
|
471
|
+
/* @__PURE__ */ u2("h2", { children: title }),
|
|
472
|
+
/* @__PURE__ */ u2(
|
|
473
|
+
"svg",
|
|
474
|
+
{
|
|
475
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
476
|
+
width: "14",
|
|
477
|
+
height: "14",
|
|
478
|
+
viewBox: "5 8 14 8",
|
|
479
|
+
fill: "none",
|
|
480
|
+
stroke: "currentColor",
|
|
481
|
+
"stroke-width": "2",
|
|
482
|
+
"stroke-linecap": "round",
|
|
483
|
+
"stroke-linejoin": "round",
|
|
484
|
+
class: "fold",
|
|
485
|
+
children: /* @__PURE__ */ u2("polyline", { points: "6 9 12 15 18 9" })
|
|
486
|
+
}
|
|
487
|
+
)
|
|
488
|
+
]
|
|
489
|
+
}
|
|
490
|
+
),
|
|
491
|
+
/* @__PURE__ */ u2("div", { id, class: "explorer-content", "aria-expanded": false, role: "group", children: /* @__PURE__ */ u2(OverflowList2, { class: "explorer-ul" }) }),
|
|
492
|
+
/* @__PURE__ */ u2("template", { id: "template-file", children: /* @__PURE__ */ u2("li", { children: /* @__PURE__ */ u2("a", { href: "#", class: "nav-file-title tree-item-self" }) }) }),
|
|
493
|
+
/* @__PURE__ */ u2("template", { id: "template-folder", children: /* @__PURE__ */ u2("li", { children: [
|
|
494
|
+
/* @__PURE__ */ u2("div", { class: "folder-container nav-folder-title tree-item-self", children: [
|
|
495
|
+
/* @__PURE__ */ u2(
|
|
496
|
+
"svg",
|
|
497
|
+
{
|
|
498
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
499
|
+
width: "12",
|
|
500
|
+
height: "12",
|
|
501
|
+
viewBox: "5 8 14 8",
|
|
502
|
+
fill: "none",
|
|
503
|
+
stroke: "currentColor",
|
|
504
|
+
"stroke-width": "2",
|
|
505
|
+
"stroke-linecap": "round",
|
|
506
|
+
"stroke-linejoin": "round",
|
|
507
|
+
class: "folder-icon nav-folder-collapse-indicator collapse-icon",
|
|
508
|
+
children: /* @__PURE__ */ u2("polyline", { points: "6 9 12 15 18 9" })
|
|
509
|
+
}
|
|
510
|
+
),
|
|
511
|
+
/* @__PURE__ */ u2("div", { children: /* @__PURE__ */ u2("button", { class: "folder-button", children: /* @__PURE__ */ u2("span", { class: "folder-title" }) }) })
|
|
512
|
+
] }),
|
|
513
|
+
/* @__PURE__ */ u2("div", { class: "folder-outer", children: /* @__PURE__ */ u2("ul", { class: "content tree-item-children" }) })
|
|
514
|
+
] }) })
|
|
515
|
+
]
|
|
516
|
+
}
|
|
517
|
+
);
|
|
518
|
+
};
|
|
519
|
+
ExplorerComponent.css = explorer_default;
|
|
520
|
+
ExplorerComponent.afterDOMLoaded = concatenateResources(explorer_inline_default, overflowListAfterDOMLoaded);
|
|
521
|
+
return ExplorerComponent;
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
export { Explorer_default as Explorer };
|
|
525
|
+
//# sourceMappingURL=index.js.map
|
|
526
|
+
//# sourceMappingURL=index.js.map
|