typerighter 0.3.0 → 0.4.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/app-Bw90hv7G.js +266 -0
- package/dist/brand-BtMsUv5o.js +201 -0
- package/dist/{cli-CoyGXgR1.js → cli-s44ly0MH.js} +233 -172
- package/dist/cli.js +1 -1
- package/dist/client/app/index.d.ts +12 -4
- package/dist/client/app/index.d.ts.map +1 -1
- package/dist/client/app/router.d.ts.map +1 -1
- package/dist/client/theme-default.js +707 -149
- package/dist/client.js +2 -2
- package/dist/constants-E2UATqMm.js +32183 -0
- package/dist/es-ClqUVRJn.js +705 -0
- package/dist/index.js +4 -4
- package/dist/{init-CUo89E7j.js → init-0hKcjQtf.js} +10 -12
- package/dist/node/build/index.d.ts.map +1 -1
- package/dist/node/lib/markdown/index.d.ts.map +1 -1
- package/dist/node/lib/markdown/plugins/callout-container.d.ts +4 -0
- package/dist/node/lib/markdown/plugins/callout-container.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/custom-container.d.ts +3 -0
- package/dist/node/lib/markdown/plugins/custom-container.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/{highlight.d.ts → highlight/index.d.ts} +1 -1
- package/dist/node/lib/markdown/plugins/highlight/index.d.ts.map +1 -0
- package/dist/node/lib/markdown/plugins/highlight/language.d.ts +3 -0
- package/dist/node/lib/markdown/plugins/highlight/language.d.ts.map +1 -0
- package/dist/node/lib/progress.d.ts.map +1 -1
- package/dist/node/lib/render/vue.d.ts +2 -2
- package/dist/node/lib/render/vue.d.ts.map +1 -1
- package/dist/node/lib/typedown-context.d.ts +4 -4
- package/dist/node/lib/typedown-context.d.ts.map +1 -1
- package/dist/node/plugin/vite/constants.d.ts +2 -1
- package/dist/node/plugin/vite/constants.d.ts.map +1 -1
- package/dist/node/plugin/vite/index.d.ts +15 -1
- package/dist/node/plugin/vite/index.d.ts.map +1 -1
- package/dist/node/plugin/vite/search.d.ts +15 -0
- package/dist/node/plugin/vite/search.d.ts.map +1 -0
- package/dist/shared/constants.d.ts +6 -0
- package/dist/shared/constants.d.ts.map +1 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/types/content.d.ts +54 -4
- package/dist/shared/types/content.d.ts.map +1 -1
- package/dist/shared/types/ssg.d.ts +3 -1
- package/dist/shared/types/ssg.d.ts.map +1 -1
- package/dist/shared/utils/content.d.ts +5 -5
- package/dist/shared/utils/content.d.ts.map +1 -1
- package/dist/shared/utils/debounce.d.ts +2 -0
- package/dist/shared/utils/debounce.d.ts.map +1 -0
- package/dist/shared/utils/format.d.ts +5 -1
- package/dist/shared/utils/format.d.ts.map +1 -1
- package/dist/shared/utils/html.d.ts +1 -0
- package/dist/shared/utils/html.d.ts.map +1 -1
- package/dist/shared/utils/index.d.ts +6 -4
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/shared/utils/path.d.ts +8 -0
- package/dist/shared/utils/path.d.ts.map +1 -0
- package/dist/shared/utils/regex.d.ts +2 -0
- package/dist/shared/utils/regex.d.ts.map +1 -0
- package/dist/shared/utils/time.d.ts +6 -0
- package/dist/shared/utils/time.d.ts.map +1 -0
- package/dist/shared/utils/url.d.ts +6 -2
- package/dist/shared/utils/url.d.ts.map +1 -1
- package/dist/typerighter.css +1 -1
- package/dist/vite-nzhkELg7.js +309 -0
- package/dist/vite.js +2 -3
- package/package.json +9 -5
- package/dist/app-CM3biamr.js +0 -184
- package/dist/brand-CeSqpEQ2.js +0 -4
- package/dist/chunk-DfAF0w94-EwUSVR-h.js +0 -13
- package/dist/constants-B7b8AsH0.js +0 -9530
- package/dist/content-BM3UKxcc.js +0 -16
- package/dist/lib-CBtriEt5-Ch50D04V.js +0 -3309
- package/dist/liteDOM-Cp0aN3bP-YwW1TGWI.js +0 -741
- package/dist/node/lib/markdown/plugins/container.d.ts +0 -3
- package/dist/node/lib/markdown/plugins/container.d.ts.map +0 -1
- package/dist/node/lib/markdown/plugins/highlight.d.ts.map +0 -1
- package/dist/node/plugin/vite/codegen.d.ts +0 -27
- package/dist/node/plugin/vite/codegen.d.ts.map +0 -1
- package/dist/node/plugin/vite/codegen.test.d.ts +0 -2
- package/dist/node/plugin/vite/codegen.test.d.ts.map +0 -1
- package/dist/plugin-D2xuSVM4.js +0 -1
- package/dist/rolldown-runtime-Dqa2HsxW.js +0 -20
- package/dist/shared/utils/environment.d.ts +0 -2
- package/dist/shared/utils/environment.d.ts.map +0 -1
- package/dist/shared/utils/highlight.d.ts +0 -3
- package/dist/shared/utils/highlight.d.ts.map +0 -1
- package/dist/shared/utils/html.test.d.ts +0 -2
- package/dist/shared/utils/html.test.d.ts.map +0 -1
- package/dist/shared-DzTfF-_d.js +0 -14
- package/dist/tex-svg-full-BI3fonbT-CfoPQ3xc.js +0 -60224
- package/dist/vite-BxXQPieu.js +0 -228
- package/dist/wgxpath.install-node-Csk64Aj9-C0enUGLs.js +0 -1094
- package/dist/xypic-DrMJn58R-B4fw2rYo.js +0 -14846
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { computed as e, createApp as t, createElementBlock as n, createElementVNode as r, defineComponent as i, h as a, inject as o, markRaw as s, mergeProps as c, nextTick as l, openBlock as u, provide as d, reactive as f, readonly as p, ref as m, renderSlot as h, shallowRef as g, toDisplayString as _, watch as v, withKeys as y, withModifiers as b } from "vue";
|
|
2
|
+
//#region src/client/theme-default/components/custom/TdFlashcard.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
+
var x = [
|
|
4
|
+
"id",
|
|
5
|
+
"tabindex",
|
|
6
|
+
"aria-pressed",
|
|
7
|
+
"aria-label",
|
|
8
|
+
"onKeydown"
|
|
9
|
+
], ee = { class: "flashcard__face flashcard__face--question" }, S = { class: "flashcard__label" }, C = { class: "flashcard__body" }, w = { class: "flashcard__face flashcard__face--key" }, T = { class: "flashcard__label" }, E = { class: "flashcard__body" }, te = /*@__PURE__*/ i({
|
|
10
|
+
inheritAttrs: !1,
|
|
11
|
+
__name: "TdFlashcard",
|
|
12
|
+
props: {
|
|
13
|
+
id: { default: () => void 0 },
|
|
14
|
+
revealed: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
default: !1
|
|
17
|
+
},
|
|
18
|
+
disabled: {
|
|
19
|
+
type: Boolean,
|
|
20
|
+
default: !1
|
|
21
|
+
},
|
|
22
|
+
questionLabel: { default: "Question" },
|
|
23
|
+
keyLabel: { default: "Answer" }
|
|
24
|
+
},
|
|
25
|
+
setup(e, { expose: t }) {
|
|
26
|
+
let i = m(e.revealed);
|
|
27
|
+
v(() => e.revealed, () => {
|
|
28
|
+
i.value = e.revealed;
|
|
29
|
+
});
|
|
30
|
+
function a() {
|
|
31
|
+
if (e.disabled) return i.value;
|
|
32
|
+
let t = i.value;
|
|
33
|
+
return i.value = !i.value, t;
|
|
34
|
+
}
|
|
35
|
+
function o() {
|
|
36
|
+
let e = i.value;
|
|
37
|
+
return i.value = !0, e;
|
|
38
|
+
}
|
|
39
|
+
function s() {
|
|
40
|
+
let e = i.value;
|
|
41
|
+
return i.value = !1, e;
|
|
42
|
+
}
|
|
43
|
+
return t({
|
|
44
|
+
flip: a,
|
|
45
|
+
showQuestion: s,
|
|
46
|
+
showKey: o,
|
|
47
|
+
state: p(i)
|
|
48
|
+
}), (t, o) => (u(), n("div", c(t.$attrs, {
|
|
49
|
+
id: e.id,
|
|
50
|
+
class: ["flashcard", {
|
|
51
|
+
"is-revealed": i.value,
|
|
52
|
+
"is-disabled": e.disabled
|
|
53
|
+
}],
|
|
54
|
+
role: "button",
|
|
55
|
+
tabindex: e.disabled ? -1 : 0,
|
|
56
|
+
"aria-pressed": i.value,
|
|
57
|
+
"aria-label": i.value ? e.keyLabel : e.questionLabel,
|
|
58
|
+
onClick: a,
|
|
59
|
+
onKeydown: [y(b(a, ["prevent"]), ["enter"]), y(b(a, ["prevent"]), ["space"])]
|
|
60
|
+
}), [r("div", ee, [r("p", S, _(e.questionLabel), 1), r("div", C, [h(t.$slots, "default")])]), r("div", w, [r("p", T, _(e.keyLabel), 1), r("div", E, [h(t.$slots, "key")])])], 16, x));
|
|
61
|
+
}
|
|
62
|
+
}), D = (e, t) => {
|
|
63
|
+
let n = e.__vccOpts || e;
|
|
64
|
+
for (let [e, r] of t) n[e] = r;
|
|
65
|
+
return n;
|
|
66
|
+
}, O = /*#__PURE__*/ D(te, [["__scopeId", "data-v-120343d9"]]), k = typeof window < "u", A = Symbol("typedown-router"), j = {
|
|
67
|
+
frontmatter: {},
|
|
68
|
+
headings: [],
|
|
69
|
+
title: "Not Found"
|
|
70
|
+
};
|
|
71
|
+
function M(e, t) {
|
|
72
|
+
let n = f({
|
|
73
|
+
path: "/",
|
|
74
|
+
hash: "",
|
|
75
|
+
query: "",
|
|
76
|
+
contentSfc: void 0,
|
|
77
|
+
data: j
|
|
78
|
+
}), r = {
|
|
79
|
+
route: n,
|
|
80
|
+
async go(e, t) {
|
|
81
|
+
e = L(e), await r.onBeforeRouteChange?.(e) !== !1 && ((!k || t?.initialLoad || I(e, t)) && await a(e), o(), await r.onAfterRouteChange?.(e));
|
|
82
|
+
}
|
|
83
|
+
}, i;
|
|
84
|
+
async function a(r) {
|
|
85
|
+
let a = new URL(r, "http://a.com"), c = i = a.pathname;
|
|
86
|
+
try {
|
|
87
|
+
let t = await e(c);
|
|
88
|
+
if (!t) throw Error(`Page not found: ${c}`);
|
|
89
|
+
if (i === c) {
|
|
90
|
+
i = void 0;
|
|
91
|
+
let { default: e, __pageData: r } = t;
|
|
92
|
+
n.path = c, n.contentSfc = s(e), n.data = s(r), o(a), k && l(() => {
|
|
93
|
+
N(a.hash);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
} catch {
|
|
97
|
+
i === c && (i = void 0, n.path = c, n.contentSfc = t ? s(t) : void 0, n.data = j, o(a));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function o(e = k ? location : {
|
|
101
|
+
search: "",
|
|
102
|
+
hash: ""
|
|
103
|
+
}) {
|
|
104
|
+
n.query = e.search, n.hash = decodeURIComponent(e.hash);
|
|
105
|
+
}
|
|
106
|
+
return k && (history.state ?? history.replaceState({}, ""), window.addEventListener("click", (e) => {
|
|
107
|
+
if (e.defaultPrevented || !(e.target instanceof Element) || e.button !== 0 || e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
|
|
108
|
+
let t = e.target.closest("a");
|
|
109
|
+
if (!t || t.hasAttribute("download") || t.hasAttribute("target")) return;
|
|
110
|
+
let n = t.getAttribute("href");
|
|
111
|
+
if (n === null) return;
|
|
112
|
+
let { href: i, origin: a, pathname: o } = new URL(n, t.baseURI);
|
|
113
|
+
a === location.origin && !o.match(/\.\w+$/) && (e.preventDefault(), r.go(i));
|
|
114
|
+
}, { capture: !0 }), window.addEventListener("popstate", async (e) => {
|
|
115
|
+
if (e.state == null) return;
|
|
116
|
+
let t = L(location.href);
|
|
117
|
+
await a(t), o(), await r.onAfterRouteChange?.(t);
|
|
118
|
+
}), window.addEventListener("hashchange", (e) => {
|
|
119
|
+
e.preventDefault(), o();
|
|
120
|
+
})), r;
|
|
121
|
+
}
|
|
122
|
+
function N(e) {
|
|
123
|
+
if (!e) return;
|
|
124
|
+
let t;
|
|
125
|
+
try {
|
|
126
|
+
t = document.getElementById(decodeURIComponent(e).slice(1)) ?? void 0;
|
|
127
|
+
} catch {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
t?.scrollIntoView({ block: "start" });
|
|
131
|
+
}
|
|
132
|
+
function P() {
|
|
133
|
+
return F().route;
|
|
134
|
+
}
|
|
135
|
+
function F() {
|
|
136
|
+
let e = o(A);
|
|
137
|
+
if (!e) throw Error("useRouter() called outside of Typedown app");
|
|
138
|
+
return e;
|
|
139
|
+
}
|
|
140
|
+
function I(e, { replace: t = !1 } = {}) {
|
|
141
|
+
let n = L(location.href);
|
|
142
|
+
if (e === n) return N(new URL(e, "http://a.com").hash), !1;
|
|
143
|
+
t ? history.replaceState({}, "", e) : (history.replaceState({ scrollPosition: window.scrollY }, ""), history.pushState({}, "", e));
|
|
144
|
+
let r = new URL(e, location.origin), i = new URL(n, location.origin);
|
|
145
|
+
return r.pathname === i.pathname ? (N(r.hash), !1) : !0;
|
|
146
|
+
}
|
|
147
|
+
function L(e) {
|
|
148
|
+
let t = new URL(e, "http://a.com");
|
|
149
|
+
return t.pathname = t.pathname.replace(/(^|\/)index(\.html)?$/, "$1"), t.pathname + t.search + t.hash;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
//#region src/client/app/components/Content.ts
|
|
153
|
+
var R = i({
|
|
154
|
+
name: "TypedownContent",
|
|
155
|
+
setup() {
|
|
156
|
+
let e = P();
|
|
157
|
+
return () => e.contentSfc ? a(e.contentSfc) : void 0;
|
|
158
|
+
}
|
|
159
|
+
}), z = "td-theme";
|
|
160
|
+
function B(e) {
|
|
161
|
+
if (typeof document > "u") return;
|
|
162
|
+
let t = e === "system" ? V() : e;
|
|
163
|
+
document.documentElement.classList.toggle("dark", t === "dark");
|
|
164
|
+
}
|
|
165
|
+
function V() {
|
|
166
|
+
return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
167
|
+
}
|
|
168
|
+
var H = m("system"), U = m(V()), W = !1;
|
|
169
|
+
function G() {
|
|
170
|
+
K();
|
|
171
|
+
let t = e(() => H.value === "system" ? U.value : H.value), n = e(() => t.value === "dark");
|
|
172
|
+
function r(e) {
|
|
173
|
+
H.value = e, B(e), typeof localStorage < "u" && localStorage.setItem(z, e);
|
|
174
|
+
}
|
|
175
|
+
function i() {
|
|
176
|
+
r(t.value === "light" ? "dark" : "light");
|
|
177
|
+
}
|
|
178
|
+
return {
|
|
179
|
+
theme: p(H),
|
|
180
|
+
effectiveTheme: t,
|
|
181
|
+
isDark: n,
|
|
182
|
+
setTheme: r,
|
|
183
|
+
toggle: i
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
function K() {
|
|
187
|
+
if (!W) {
|
|
188
|
+
if (W = !0, typeof localStorage < "u") {
|
|
189
|
+
let e = localStorage.getItem(z);
|
|
190
|
+
(e === "light" || e === "dark" || e === "system") && (H.value = e);
|
|
191
|
+
}
|
|
192
|
+
B(H.value), typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
193
|
+
U.value = V(), H.value === "system" && B("system");
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/client/app/composables/useTdContent.ts
|
|
199
|
+
var q = Symbol("td-content");
|
|
200
|
+
function J(t) {
|
|
201
|
+
let n = G(), r = {
|
|
202
|
+
page: e(() => t.data),
|
|
203
|
+
frontmatter: e(() => t.data.frontmatter),
|
|
204
|
+
title: e(() => t.data.title),
|
|
205
|
+
isDark: e(() => n.isDark.value)
|
|
206
|
+
};
|
|
207
|
+
return d(q, r), r;
|
|
208
|
+
}
|
|
209
|
+
function Y() {
|
|
210
|
+
let e = o(q);
|
|
211
|
+
if (e === void 0) throw Error("useTdContent() called without a parent provideTdContent()");
|
|
212
|
+
return e;
|
|
213
|
+
}
|
|
214
|
+
//#endregion
|
|
215
|
+
//#region src/client/app/index.ts
|
|
216
|
+
var X = Symbol("typedown-site-config"), Z = Symbol("typedown-site-data"), Q = Symbol("typedown-page-loader"), $ = Symbol("typedown-search-index");
|
|
217
|
+
async function ne(e, n, r = {}, o = {}) {
|
|
218
|
+
let s = {
|
|
219
|
+
title: r.title ?? "",
|
|
220
|
+
description: r.description ?? ""
|
|
221
|
+
}, c = {
|
|
222
|
+
contentTree: o.contentTree ?? {
|
|
223
|
+
rootItems: [],
|
|
224
|
+
children: []
|
|
225
|
+
},
|
|
226
|
+
schemas: o.schemas ?? {}
|
|
227
|
+
}, l = M(e), u = t(i({
|
|
228
|
+
name: "TypedownApp",
|
|
229
|
+
setup() {
|
|
230
|
+
return J(l.route), () => a(n);
|
|
231
|
+
}
|
|
232
|
+
}));
|
|
233
|
+
u.provide(A, l), u.provide(X, s), u.provide(Z, c), u.provide(Q, e);
|
|
234
|
+
let d = g(o.searchIndex);
|
|
235
|
+
return u.provide($, d), u.component("TypedownContent", R), u.component("Flashcard", O), typeof window < "u" && await l.go(location.href, {
|
|
236
|
+
replace: !0,
|
|
237
|
+
initialLoad: !0
|
|
238
|
+
}), {
|
|
239
|
+
app: u,
|
|
240
|
+
router: l,
|
|
241
|
+
searchIndex: d
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function re() {
|
|
245
|
+
return o(Q, void 0);
|
|
246
|
+
}
|
|
247
|
+
function ie() {
|
|
248
|
+
return o($, g(void 0));
|
|
249
|
+
}
|
|
250
|
+
function ae() {
|
|
251
|
+
return o(X, {
|
|
252
|
+
title: "",
|
|
253
|
+
description: ""
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
function oe() {
|
|
257
|
+
return o(Z, {
|
|
258
|
+
contentTree: {
|
|
259
|
+
rootItems: [],
|
|
260
|
+
children: []
|
|
261
|
+
},
|
|
262
|
+
schemas: {}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
//#endregion
|
|
266
|
+
export { oe as a, R as c, D as d, ae as i, P as l, re as n, Y as o, ie as r, G as s, ne as t, F as u };
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
//#region src/shared/constants.ts
|
|
2
|
+
var e = "index", t = [".td", ".md"], n = "**/*.{td,md}", r = [
|
|
3
|
+
"title",
|
|
4
|
+
"titles",
|
|
5
|
+
"text"
|
|
6
|
+
], i = ["title", "titles"], a = /^[a-z]+:/i;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/shared/utils/format.ts
|
|
9
|
+
function o(e) {
|
|
10
|
+
let t = e.match(/^(\d+)[-_](.+)$/);
|
|
11
|
+
return t ? {
|
|
12
|
+
order: Number(t[1]),
|
|
13
|
+
rest: t[2]
|
|
14
|
+
} : {
|
|
15
|
+
order: Infinity,
|
|
16
|
+
rest: e
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function s(e) {
|
|
20
|
+
let { rest: t } = o(e), n = t.replace(/[-_]/g, " ").split(" ");
|
|
21
|
+
return 0 < n.length && (n[0] = n[0].charAt(0).toUpperCase() + n[0].slice(1)), n.join(" ");
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region src/shared/utils/path.ts
|
|
25
|
+
function c(e, t) {
|
|
26
|
+
let n = h(e).split("/").pop() ?? "";
|
|
27
|
+
return t !== void 0 && n.endsWith(t) ? n.slice(0, -t.length) : n;
|
|
28
|
+
}
|
|
29
|
+
function l(e) {
|
|
30
|
+
let t = h(e).split("/");
|
|
31
|
+
return t.pop(), t.join("/");
|
|
32
|
+
}
|
|
33
|
+
function u(e) {
|
|
34
|
+
let t = c(e), n = t.lastIndexOf(".");
|
|
35
|
+
return n <= 0 ? "" : t.slice(n);
|
|
36
|
+
}
|
|
37
|
+
function d(e) {
|
|
38
|
+
let t = c(e), n = t.lastIndexOf(".");
|
|
39
|
+
return n <= 0 ? t : t.slice(0, n);
|
|
40
|
+
}
|
|
41
|
+
function f(e) {
|
|
42
|
+
return t.includes(u(e));
|
|
43
|
+
}
|
|
44
|
+
function p(...e) {
|
|
45
|
+
return e.filter(Boolean).join("/").replace(/\\+/g, "/").replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
46
|
+
}
|
|
47
|
+
function m(e) {
|
|
48
|
+
let t = u(e);
|
|
49
|
+
return t ? e.slice(0, -t.length) : e;
|
|
50
|
+
}
|
|
51
|
+
function h(e) {
|
|
52
|
+
return e.replace(/\\/g, "/");
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/shared/utils/url.ts
|
|
56
|
+
function g(e) {
|
|
57
|
+
return a.test(e);
|
|
58
|
+
}
|
|
59
|
+
var _ = new Set("3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,yaml,yml,zip".split(","));
|
|
60
|
+
function v(e, t) {
|
|
61
|
+
return `${e}/${t}`;
|
|
62
|
+
}
|
|
63
|
+
function y(e) {
|
|
64
|
+
return l(e.replace(/\/$/, "")) || "/";
|
|
65
|
+
}
|
|
66
|
+
function b(e) {
|
|
67
|
+
let t = d(e);
|
|
68
|
+
if (t === "index") {
|
|
69
|
+
let t = l(e);
|
|
70
|
+
return t ? "/" + t : "/";
|
|
71
|
+
}
|
|
72
|
+
return "/" + p(l(e), t);
|
|
73
|
+
}
|
|
74
|
+
function x(e, t) {
|
|
75
|
+
return t.startsWith(e + "/") || t === e;
|
|
76
|
+
}
|
|
77
|
+
function S(e) {
|
|
78
|
+
let t = u(e).slice(1);
|
|
79
|
+
return t === "" || !_.has(t.toLowerCase());
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/shared/utils/content.ts
|
|
83
|
+
function C(e) {
|
|
84
|
+
let t = {
|
|
85
|
+
name: "",
|
|
86
|
+
children: [],
|
|
87
|
+
items: []
|
|
88
|
+
};
|
|
89
|
+
for (let n of e) {
|
|
90
|
+
let e = n.filepath.split("/").slice(0, -1), r = t;
|
|
91
|
+
for (let t of e) {
|
|
92
|
+
let e = r.children.find((e) => e.name === t);
|
|
93
|
+
e || (e = {
|
|
94
|
+
name: t,
|
|
95
|
+
children: [],
|
|
96
|
+
items: []
|
|
97
|
+
}, r.children.push(e)), r = e;
|
|
98
|
+
}
|
|
99
|
+
r.items.push(n);
|
|
100
|
+
}
|
|
101
|
+
return D(t), {
|
|
102
|
+
rootItems: t.items,
|
|
103
|
+
children: t.children
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function w(e, t) {
|
|
107
|
+
let n = {};
|
|
108
|
+
function r(e) {
|
|
109
|
+
let t = e.items.length;
|
|
110
|
+
for (let n of e.children) t += r(n);
|
|
111
|
+
return t;
|
|
112
|
+
}
|
|
113
|
+
function i(e, t) {
|
|
114
|
+
let n = e.items[0] ?? e.children[0]?.items[0];
|
|
115
|
+
return n ? y(b(n.filepath)) : `${t}/${e.name}`;
|
|
116
|
+
}
|
|
117
|
+
function a(e, t) {
|
|
118
|
+
for (let o of e) {
|
|
119
|
+
let e = t ? `${t}/${o.name}` : `/${o.name}`;
|
|
120
|
+
n[e] = {
|
|
121
|
+
title: s(o.name),
|
|
122
|
+
url: e,
|
|
123
|
+
subdirectories: o.children.map((t) => ({
|
|
124
|
+
name: s(t.name),
|
|
125
|
+
url: i(t, e),
|
|
126
|
+
count: r(t)
|
|
127
|
+
})),
|
|
128
|
+
items: o.items.map((e) => ({
|
|
129
|
+
name: E(e.header, e.filepath),
|
|
130
|
+
url: b(e.filepath)
|
|
131
|
+
}))
|
|
132
|
+
}, a(o.children, e);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return n["/"] = {
|
|
136
|
+
title: t,
|
|
137
|
+
url: "/",
|
|
138
|
+
subdirectories: e.map((e) => ({
|
|
139
|
+
name: s(e.name),
|
|
140
|
+
url: i(e, ""),
|
|
141
|
+
count: r(e)
|
|
142
|
+
})),
|
|
143
|
+
items: []
|
|
144
|
+
}, a(e, ""), n;
|
|
145
|
+
}
|
|
146
|
+
function T(e, t) {
|
|
147
|
+
let n = c(l(e));
|
|
148
|
+
return n ? s(n) : t;
|
|
149
|
+
}
|
|
150
|
+
function E(e, t) {
|
|
151
|
+
return e._label === void 0 ? e.name === void 0 ? s(d(t)) : String(e.name) : String(e._label);
|
|
152
|
+
}
|
|
153
|
+
function D(e) {
|
|
154
|
+
e.children.sort((e, t) => {
|
|
155
|
+
let n = o(e.name), r = o(t.name);
|
|
156
|
+
return n.order === r.order ? n.rest.localeCompare(r.rest) : n.order - r.order;
|
|
157
|
+
}), e.items.sort((e, t) => {
|
|
158
|
+
let n = o(d(e.filepath)), r = o(d(t.filepath));
|
|
159
|
+
return n.order === r.order ? E(e.header, e.filepath).localeCompare(E(t.header, t.filepath)) : n.order - r.order;
|
|
160
|
+
});
|
|
161
|
+
for (let t of e.children) D(t);
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
//#region src/shared/utils/html.ts
|
|
165
|
+
function O(e) {
|
|
166
|
+
return e.replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
167
|
+
}
|
|
168
|
+
function k(e) {
|
|
169
|
+
return e.replace(/<(style|script)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region src/shared/utils/time.ts
|
|
173
|
+
var A = 60, j = 60 * A, M = 24 * j, N = 7 * M, P = 30 * M, F = 365 * M, I = 2 * N;
|
|
174
|
+
function L(e) {
|
|
175
|
+
return (/* @__PURE__ */ new Date(e * 1e3)).toLocaleDateString("en-US", {
|
|
176
|
+
year: "numeric",
|
|
177
|
+
month: "short",
|
|
178
|
+
day: "numeric"
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function R(e, t) {
|
|
182
|
+
return Math.floor(Date.now() / 1e3) - e < I ? `${t} ${z(e)}` : `${t} at ${L(e)}`;
|
|
183
|
+
}
|
|
184
|
+
function z(e) {
|
|
185
|
+
let t = Math.floor(Date.now() / 1e3) - e;
|
|
186
|
+
return t < A ? "just now" : t < j ? `${Math.floor(t / A)}m ago` : t < M ? `${Math.floor(t / j)}h ago` : t < N ? `${Math.floor(t / M)}d ago` : t < P ? `${Math.floor(t / N)}w ago` : t < F ? `${Math.floor(t / P)}mo ago` : `${Math.floor(t / F)}y ago`;
|
|
187
|
+
}
|
|
188
|
+
var B = new Intl.DateTimeFormat("en-US", {
|
|
189
|
+
year: "numeric",
|
|
190
|
+
month: "short",
|
|
191
|
+
day: "numeric"
|
|
192
|
+
});
|
|
193
|
+
function V(e) {
|
|
194
|
+
let t = new Date(e);
|
|
195
|
+
return Number.isNaN(t.getTime()) ? e : B.format(t);
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region src/shared/brand.ts
|
|
199
|
+
var H = "m15 10c-2.7614 0-5 2.2386-5 5v98c0 2.761 2.2386 5 5 5h178c2.761 0 5-2.239 5-5v-98c0-2.7614-2.239-5-5-5zm-15 5c0-8.28427 6.71573-15 15-15h178c8.284 0 15 6.71573 15 15v98c0 8.284-6.716 15-15 15h-178c-8.28427 0-15-6.716-15-15z", U = "M30 30h70v16h-27v52h-16v-52h-27z", W = "m155 98-30-33h20v-35h20v35h20z", G = "0 0 208 128", K = "#a0522d", q = `<svg fill='none' viewBox='${G}' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='${H}' fill-rule='evenodd' fill='${K}'/><path d='${U}' fill='${K}'/><path d='${W}' fill='${K}'/></svg>`, J = `data:image/svg+xml,${encodeURIComponent(q)}`;
|
|
200
|
+
//#endregion
|
|
201
|
+
export { i as A, m as C, n as D, t as E, e as O, f as S, a as T, b as _, G as a, S as b, z as c, C as d, w as f, y as g, v as h, U as i, r as k, O as l, E as m, H as n, V as o, T as p, J as r, R as s, W as t, k as u, x as v, s as w, d as x, g as y };
|