typerighter 0.5.1 → 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/app-BZKg-fe3.js +364 -0
- package/dist/brand-BfamszbH.js +12 -0
- package/dist/{cli-CAvgSpyx.js → cli-D5-gYw26.js} +15 -12
- package/dist/cli.js +1 -1
- package/dist/client/app/index.d.ts +3 -1
- package/dist/client/app/index.d.ts.map +1 -1
- package/dist/client/theme-default.js +570 -408
- package/dist/client.js +1 -1
- package/dist/{constants-BVW9e5iH.js → constants-Dq357AVO.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-Dfj-Yf9i.js → init-CzF7lqKE.js} +4 -3
- package/dist/shared/utils/url.d.ts +2 -1
- package/dist/shared/utils/url.d.ts.map +1 -1
- package/dist/{brand-C6VJ3Tpf.js → shared-BoWAaUci.js} +35 -42
- package/dist/typerighter.css +1 -1
- package/dist/{vite-DPRlAukM.js → vite-BrwFwz0T.js} +36 -35
- package/dist/vite.js +1 -1
- package/package.json +3 -3
- package/dist/app-DZLkaV9-.js +0 -266
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { l as e } from "./shared-BoWAaUci.js";
|
|
2
|
+
import { Fragment as t, computed as n, createApp as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, h as l, inject as u, markRaw as d, mergeProps as f, nextTick as p, openBlock as m, provide as h, reactive as g, readonly as _, ref as v, renderList as y, renderSlot as b, shallowRef as x, toDisplayString as S, unref as C, watch as ee, withKeys as w, withModifiers as T } from "vue";
|
|
3
|
+
//#region ../../node_modules/.pnpm/@lucide+vue@1.30.0_vue@3.5.40_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/isEmptyString.mjs
|
|
4
|
+
var E = (e) => e === "", te = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), D = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ne = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), re = (e) => {
|
|
5
|
+
let t = ne(e);
|
|
6
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
7
|
+
}, O = {
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
width: 24,
|
|
10
|
+
height: 24,
|
|
11
|
+
viewBox: "0 0 24 24",
|
|
12
|
+
fill: "none",
|
|
13
|
+
stroke: "currentColor",
|
|
14
|
+
"stroke-width": 2,
|
|
15
|
+
"stroke-linecap": "round",
|
|
16
|
+
"stroke-linejoin": "round"
|
|
17
|
+
}, ie = /* @__PURE__ */ Symbol("lucide-icons");
|
|
18
|
+
function ae() {
|
|
19
|
+
return u(ie, {});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region ../../node_modules/.pnpm/@lucide+vue@1.30.0_vue@3.5.40_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/Icon.mjs
|
|
23
|
+
var oe = ({ name: e, iconNode: t, "icon-node": r, absoluteStrokeWidth: i, "absolute-stroke-width": a, strokeWidth: o, "stroke-width": s, size: c, color: u, ...d }, { slots: f }) => {
|
|
24
|
+
let { size: p, color: m, strokeWidth: h = 2, absoluteStrokeWidth: g = !1, class: _ = "" } = ae(), v = n(() => {
|
|
25
|
+
let e = E(i) || E(a) || i === !0 || a === !0 || g === !0, t = o || s || h || O["stroke-width"];
|
|
26
|
+
return e ? Number(t) * 24 / Number(c ?? p ?? O.width) : t;
|
|
27
|
+
});
|
|
28
|
+
return l("svg", {
|
|
29
|
+
...O,
|
|
30
|
+
...d,
|
|
31
|
+
width: c ?? p ?? O.width,
|
|
32
|
+
height: c ?? p ?? O.height,
|
|
33
|
+
stroke: u ?? m ?? O.stroke,
|
|
34
|
+
"stroke-width": v.value,
|
|
35
|
+
class: te("lucide", _, ...e ? [`lucide-${D(re(e))}-icon`, `lucide-${D(e)}`] : ["lucide-icon"])
|
|
36
|
+
}, [...(t ?? r ?? []).map((e) => l(...e)), ...f.default ? [f.default()] : []]);
|
|
37
|
+
}, k = (e, t) => (n, { slots: r, attrs: i }) => l(oe, {
|
|
38
|
+
...i,
|
|
39
|
+
...n,
|
|
40
|
+
iconNode: t,
|
|
41
|
+
name: e
|
|
42
|
+
}, r.default ? { default: r.default } : void 0), se = k("corner-left-up", [["path", {
|
|
43
|
+
d: "M14 9 9 4 4 9",
|
|
44
|
+
key: "1af5af"
|
|
45
|
+
}], ["path", {
|
|
46
|
+
d: "M20 20h-7a4 4 0 0 1-4-4V4",
|
|
47
|
+
key: "1blwi3"
|
|
48
|
+
}]]), A = k("file", [["path", {
|
|
49
|
+
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
50
|
+
key: "1oefj6"
|
|
51
|
+
}], ["path", {
|
|
52
|
+
d: "M14 2v5a1 1 0 0 0 1 1h5",
|
|
53
|
+
key: "wfsgrz"
|
|
54
|
+
}]]), j = k("folder-open", [["path", {
|
|
55
|
+
d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
|
|
56
|
+
key: "usdka0"
|
|
57
|
+
}]]), ce = ["href"], le = { key: 1 }, ue = ["href"], de = { class: "td-dir-name" }, fe = { class: "td-dir-count" }, pe = { key: 2 }, me = ["href"], he = { class: "td-dir-name" }, ge = /*@__PURE__*/ c({
|
|
58
|
+
__name: "TdDirectoryIndex",
|
|
59
|
+
setup(r) {
|
|
60
|
+
let c = R(), l = $(), u = n(() => {
|
|
61
|
+
let e = c.path, t = l.directoryListings[e] ?? l.directoryListings[e + "/"];
|
|
62
|
+
return {
|
|
63
|
+
url: e,
|
|
64
|
+
subdirectories: t?.subdirectories ?? [],
|
|
65
|
+
items: t?.items ?? []
|
|
66
|
+
};
|
|
67
|
+
}), d = n(() => u.value.url === "/"), f = n(() => e(u.value.url));
|
|
68
|
+
return (e, n) => (m(), a("div", null, [
|
|
69
|
+
d.value ? i("", !0) : (m(), a("a", {
|
|
70
|
+
key: 0,
|
|
71
|
+
href: f.value,
|
|
72
|
+
class: "td-dir-row"
|
|
73
|
+
}, [s(C(se), {
|
|
74
|
+
size: 16,
|
|
75
|
+
class: "td-dir-icon"
|
|
76
|
+
}), n[0] ||= o("span", { class: "td-dir-parent" }, "..", -1)], 8, ce)),
|
|
77
|
+
u.value.subdirectories.length > 0 ? (m(), a("div", le, [(m(!0), a(t, null, y(u.value.subdirectories, (e) => (m(), a("a", {
|
|
78
|
+
key: e.url,
|
|
79
|
+
href: e.url,
|
|
80
|
+
class: "td-dir-row"
|
|
81
|
+
}, [
|
|
82
|
+
s(C(j), {
|
|
83
|
+
size: 16,
|
|
84
|
+
class: "td-dir-icon"
|
|
85
|
+
}),
|
|
86
|
+
o("span", de, S(e.name), 1),
|
|
87
|
+
o("span", fe, S(e.count), 1)
|
|
88
|
+
], 8, ue))), 128))])) : i("", !0),
|
|
89
|
+
u.value.items.length > 0 ? (m(), a("div", pe, [(m(!0), a(t, null, y(u.value.items, (e) => (m(), a("a", {
|
|
90
|
+
key: e.url,
|
|
91
|
+
href: e.url,
|
|
92
|
+
class: "td-dir-row"
|
|
93
|
+
}, [s(C(A), {
|
|
94
|
+
size: 16,
|
|
95
|
+
class: "td-dir-icon"
|
|
96
|
+
}), o("span", he, S(e.name), 1)], 8, me))), 128))])) : i("", !0)
|
|
97
|
+
]));
|
|
98
|
+
}
|
|
99
|
+
}), M = (e, t) => {
|
|
100
|
+
let n = e.__vccOpts || e;
|
|
101
|
+
for (let [e, r] of t) n[e] = r;
|
|
102
|
+
return n;
|
|
103
|
+
}, N = /*#__PURE__*/ M(ge, [["__scopeId", "data-v-9aecbee8"]]), _e = [
|
|
104
|
+
"id",
|
|
105
|
+
"tabindex",
|
|
106
|
+
"aria-pressed",
|
|
107
|
+
"aria-label",
|
|
108
|
+
"onKeydown"
|
|
109
|
+
], ve = { class: "td-flashcard-face td-flashcard-face-question" }, ye = { class: "td-flashcard-label" }, be = { class: "td-flashcard-body" }, xe = { class: "td-flashcard-face td-flashcard-face-key" }, Se = { class: "td-flashcard-label" }, Ce = { class: "td-flashcard-body" }, we = /*#__PURE__*/ M(/* @__PURE__ */ c({
|
|
110
|
+
inheritAttrs: !1,
|
|
111
|
+
__name: "TdFlashcard",
|
|
112
|
+
props: {
|
|
113
|
+
id: { default: () => void 0 },
|
|
114
|
+
revealed: {
|
|
115
|
+
type: Boolean,
|
|
116
|
+
default: !1
|
|
117
|
+
},
|
|
118
|
+
disabled: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: !1
|
|
121
|
+
},
|
|
122
|
+
questionLabel: { default: "Question" },
|
|
123
|
+
keyLabel: { default: "Answer" }
|
|
124
|
+
},
|
|
125
|
+
setup(e, { expose: t }) {
|
|
126
|
+
let n = v(e.revealed);
|
|
127
|
+
ee(() => e.revealed, () => {
|
|
128
|
+
n.value = e.revealed;
|
|
129
|
+
});
|
|
130
|
+
function r() {
|
|
131
|
+
if (e.disabled) return n.value;
|
|
132
|
+
let t = n.value;
|
|
133
|
+
return n.value = !n.value, t;
|
|
134
|
+
}
|
|
135
|
+
function i() {
|
|
136
|
+
let e = n.value;
|
|
137
|
+
return n.value = !0, e;
|
|
138
|
+
}
|
|
139
|
+
function s() {
|
|
140
|
+
let e = n.value;
|
|
141
|
+
return n.value = !1, e;
|
|
142
|
+
}
|
|
143
|
+
return t({
|
|
144
|
+
flip: r,
|
|
145
|
+
showQuestion: s,
|
|
146
|
+
showKey: i,
|
|
147
|
+
state: _(n)
|
|
148
|
+
}), (t, i) => (m(), a("div", f(t.$attrs, {
|
|
149
|
+
id: e.id,
|
|
150
|
+
class: ["td-flashcard", {
|
|
151
|
+
"is-revealed": n.value,
|
|
152
|
+
"is-disabled": e.disabled
|
|
153
|
+
}],
|
|
154
|
+
role: "button",
|
|
155
|
+
tabindex: e.disabled ? -1 : 0,
|
|
156
|
+
"aria-pressed": n.value,
|
|
157
|
+
"aria-label": n.value ? e.keyLabel : e.questionLabel,
|
|
158
|
+
onClick: r,
|
|
159
|
+
onKeydown: [w(T(r, ["prevent"]), ["enter"]), w(T(r, ["prevent"]), ["space"])]
|
|
160
|
+
}), [o("div", ve, [o("p", ye, S(e.questionLabel), 1), o("div", be, [b(t.$slots, "default")])]), o("div", xe, [o("p", Se, S(e.keyLabel), 1), o("div", Ce, [b(t.$slots, "key")])])], 16, _e));
|
|
161
|
+
}
|
|
162
|
+
}), [["__scopeId", "data-v-95dfbffd"]]), P = typeof window < "u", F = Symbol("typedown-router"), I = {
|
|
163
|
+
frontmatter: {},
|
|
164
|
+
headings: [],
|
|
165
|
+
title: "Not Found"
|
|
166
|
+
};
|
|
167
|
+
function Te(e, t) {
|
|
168
|
+
let n = g({
|
|
169
|
+
path: "/",
|
|
170
|
+
hash: "",
|
|
171
|
+
query: "",
|
|
172
|
+
contentSfc: void 0,
|
|
173
|
+
data: I
|
|
174
|
+
}), r = {
|
|
175
|
+
route: n,
|
|
176
|
+
async go(e, t) {
|
|
177
|
+
e = B(e), await r.onBeforeRouteChange?.(e) !== !1 && ((!P || t?.initialLoad || Ee(e, t)) && await a(e), o(), await r.onAfterRouteChange?.(e));
|
|
178
|
+
}
|
|
179
|
+
}, i;
|
|
180
|
+
async function a(r) {
|
|
181
|
+
let a = new URL(r, "http://a.com"), s = i = a.pathname;
|
|
182
|
+
try {
|
|
183
|
+
let t = await e(s);
|
|
184
|
+
if (!t) throw Error(`Page not found: ${s}`);
|
|
185
|
+
if (i === s) {
|
|
186
|
+
i = void 0;
|
|
187
|
+
let { default: e, __pageData: r } = t;
|
|
188
|
+
n.path = s, n.contentSfc = d(e), n.data = d(r), o(a), P && p(() => {
|
|
189
|
+
L(a.hash);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
} catch {
|
|
193
|
+
i === s && (i = void 0, n.path = s, n.contentSfc = t ? d(t) : void 0, n.data = I, o(a));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function o(e = P ? location : {
|
|
197
|
+
search: "",
|
|
198
|
+
hash: ""
|
|
199
|
+
}) {
|
|
200
|
+
n.query = e.search, n.hash = decodeURIComponent(e.hash);
|
|
201
|
+
}
|
|
202
|
+
return P && (history.state ?? history.replaceState({}, ""), window.addEventListener("click", (e) => {
|
|
203
|
+
if (e.defaultPrevented || !(e.target instanceof Element) || e.button !== 0 || e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
|
|
204
|
+
let t = e.target.closest("a");
|
|
205
|
+
if (!t || t.hasAttribute("download") || t.hasAttribute("target")) return;
|
|
206
|
+
let n = t.getAttribute("href");
|
|
207
|
+
if (n === null) return;
|
|
208
|
+
let { href: i, origin: a, pathname: o } = new URL(n, t.baseURI);
|
|
209
|
+
a === location.origin && !o.match(/\.\w+$/) && (e.preventDefault(), r.go(i));
|
|
210
|
+
}, { capture: !0 }), window.addEventListener("popstate", async (e) => {
|
|
211
|
+
if (e.state == null) return;
|
|
212
|
+
let t = B(location.href);
|
|
213
|
+
await a(t), o(), await r.onAfterRouteChange?.(t);
|
|
214
|
+
}), window.addEventListener("hashchange", (e) => {
|
|
215
|
+
e.preventDefault(), o();
|
|
216
|
+
})), r;
|
|
217
|
+
}
|
|
218
|
+
function L(e) {
|
|
219
|
+
if (!e) return;
|
|
220
|
+
let t;
|
|
221
|
+
try {
|
|
222
|
+
t = document.getElementById(decodeURIComponent(e).slice(1)) ?? void 0;
|
|
223
|
+
} catch {
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
t?.scrollIntoView({ block: "start" });
|
|
227
|
+
}
|
|
228
|
+
function R() {
|
|
229
|
+
return z().route;
|
|
230
|
+
}
|
|
231
|
+
function z() {
|
|
232
|
+
let e = u(F);
|
|
233
|
+
if (!e) throw Error("useRouter() called outside of Typedown app");
|
|
234
|
+
return e;
|
|
235
|
+
}
|
|
236
|
+
function Ee(e, { replace: t = !1 } = {}) {
|
|
237
|
+
let n = B(location.href);
|
|
238
|
+
if (e === n) return L(new URL(e, "http://a.com").hash), !1;
|
|
239
|
+
t ? history.replaceState({}, "", e) : (history.replaceState({ scrollPosition: window.scrollY }, ""), history.pushState({}, "", e));
|
|
240
|
+
let r = new URL(e, location.origin), i = new URL(n, location.origin);
|
|
241
|
+
return r.pathname === i.pathname ? (L(r.hash), !1) : !0;
|
|
242
|
+
}
|
|
243
|
+
function B(e) {
|
|
244
|
+
let t = new URL(e, "http://a.com");
|
|
245
|
+
return t.pathname = t.pathname.replace(/\.html$/, ""), t.pathname + t.search + t.hash;
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/client/app/components/Content.ts
|
|
249
|
+
var V = c({
|
|
250
|
+
name: "TypedownContent",
|
|
251
|
+
setup() {
|
|
252
|
+
let e = R();
|
|
253
|
+
return () => e.contentSfc ? l(e.contentSfc) : void 0;
|
|
254
|
+
}
|
|
255
|
+
}), H = "td-theme";
|
|
256
|
+
function U(e) {
|
|
257
|
+
if (typeof document > "u") return;
|
|
258
|
+
let t = e === "system" ? W() : e;
|
|
259
|
+
document.documentElement.classList.toggle("dark", t === "dark");
|
|
260
|
+
}
|
|
261
|
+
function W() {
|
|
262
|
+
return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
263
|
+
}
|
|
264
|
+
var G = v("system"), K = v(W()), q = !1;
|
|
265
|
+
function J() {
|
|
266
|
+
De();
|
|
267
|
+
let e = n(() => G.value === "system" ? K.value : G.value), t = n(() => e.value === "dark");
|
|
268
|
+
function r(e) {
|
|
269
|
+
G.value = e, U(e), typeof localStorage < "u" && localStorage.setItem(H, e);
|
|
270
|
+
}
|
|
271
|
+
function i() {
|
|
272
|
+
r(e.value === "light" ? "dark" : "light");
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
theme: _(G),
|
|
276
|
+
effectiveTheme: e,
|
|
277
|
+
isDark: t,
|
|
278
|
+
setTheme: r,
|
|
279
|
+
toggle: i
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function De() {
|
|
283
|
+
if (!q) {
|
|
284
|
+
if (q = !0, typeof localStorage < "u") {
|
|
285
|
+
let e = localStorage.getItem(H);
|
|
286
|
+
(e === "light" || e === "dark" || e === "system") && (G.value = e);
|
|
287
|
+
}
|
|
288
|
+
U(G.value), typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
289
|
+
K.value = W(), G.value === "system" && U("system");
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/client/app/composables/useTdContent.ts
|
|
295
|
+
var Y = Symbol("td-content");
|
|
296
|
+
function Oe(e) {
|
|
297
|
+
let t = J(), r = {
|
|
298
|
+
page: n(() => e.data),
|
|
299
|
+
frontmatter: n(() => e.data.frontmatter),
|
|
300
|
+
title: n(() => e.data.title),
|
|
301
|
+
isDark: n(() => t.isDark.value)
|
|
302
|
+
};
|
|
303
|
+
return h(Y, r), r;
|
|
304
|
+
}
|
|
305
|
+
function ke() {
|
|
306
|
+
let e = u(Y);
|
|
307
|
+
if (e === void 0) throw Error("useTdContent() called without a parent provideTdContent()");
|
|
308
|
+
return e;
|
|
309
|
+
}
|
|
310
|
+
//#endregion
|
|
311
|
+
//#region src/client/app/index.ts
|
|
312
|
+
var X = Symbol("typedown-site-config"), Z = Symbol("typedown-site-data"), Q = Symbol("typedown-page-loader"), Ae = Symbol("typedown-search-index");
|
|
313
|
+
async function je(e, t, n = {}, i = {}) {
|
|
314
|
+
let a = {
|
|
315
|
+
title: n.title ?? "",
|
|
316
|
+
description: n.description ?? ""
|
|
317
|
+
}, o = {
|
|
318
|
+
contentTree: i.contentTree ?? {
|
|
319
|
+
rootItems: [],
|
|
320
|
+
children: []
|
|
321
|
+
},
|
|
322
|
+
schemas: i.schemas ?? {},
|
|
323
|
+
directoryListings: i.directoryListings ?? {}
|
|
324
|
+
}, s = Te(e), u = r(c({
|
|
325
|
+
name: "TypedownApp",
|
|
326
|
+
setup() {
|
|
327
|
+
return Oe(s.route), () => l(t);
|
|
328
|
+
}
|
|
329
|
+
}));
|
|
330
|
+
u.provide(F, s), u.provide(X, a), u.provide(Z, o), u.provide(Q, e);
|
|
331
|
+
let d = x(i.searchIndex);
|
|
332
|
+
return u.provide(Ae, d), u.component("TypedownContent", V), u.component("DirectoryIndex", N), u.component("Flashcard", we), typeof window < "u" && await s.go(location.href, {
|
|
333
|
+
replace: !0,
|
|
334
|
+
initialLoad: !0
|
|
335
|
+
}), {
|
|
336
|
+
app: u,
|
|
337
|
+
router: s,
|
|
338
|
+
searchIndex: d
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function Me() {
|
|
342
|
+
return u(Q, void 0);
|
|
343
|
+
}
|
|
344
|
+
function Ne() {
|
|
345
|
+
return u(Ae, x(void 0));
|
|
346
|
+
}
|
|
347
|
+
function Pe() {
|
|
348
|
+
return u(X, {
|
|
349
|
+
title: "",
|
|
350
|
+
description: ""
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
function $() {
|
|
354
|
+
return u(Z, {
|
|
355
|
+
contentTree: {
|
|
356
|
+
rootItems: [],
|
|
357
|
+
children: []
|
|
358
|
+
},
|
|
359
|
+
schemas: {},
|
|
360
|
+
directoryListings: {}
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
//#endregion
|
|
364
|
+
export { $ as a, V as c, N as d, M as f, k as h, Pe as i, R as l, A as m, Me as n, ke as o, j as p, Ne as r, J as s, je as t, z as u };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
//#region src/shared/utils/html.ts
|
|
2
|
+
function e(e) {
|
|
3
|
+
return e.replaceAll("&", "&").replaceAll("\"", """).replaceAll("<", "<").replaceAll(">", ">");
|
|
4
|
+
}
|
|
5
|
+
function t(e) {
|
|
6
|
+
return e.replace(/<(style|script)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/shared/brand.ts
|
|
10
|
+
var n = "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", r = "M30 30h70v16h-27v52h-16v-52h-27z", i = "m155 98-30-33h20v-35h20v35h20z", a = "0 0 208 128", o = "#a0522d", s = `<svg fill='none' viewBox='${a}' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='${n}' fill-rule='evenodd' fill='${o}'/><path d='${r}' fill='${o}'/><path d='${i}' fill='${o}'/></svg>`, c = `data:image/svg+xml,${encodeURIComponent(s)}`;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { a, r as i, n, e as o, c as r, t as s, i as t };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { o as e } from "./constants-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { o as e } from "./constants-Dq357AVO.js";
|
|
2
|
+
import { _ as t, a as n, b as r, g as i, i as a, x as o } from "./shared-BoWAaUci.js";
|
|
3
|
+
import { o as s } from "./brand-BfamszbH.js";
|
|
4
|
+
import { n as c, t as l } from "./vite-BrwFwz0T.js";
|
|
4
5
|
import u from "node:path";
|
|
5
6
|
import d from "picocolors";
|
|
6
7
|
import { build as f, createServer as p } from "vite";
|
|
@@ -176,10 +177,13 @@ async function S(e, n = {}) {
|
|
|
176
177
|
i.log(`\nBuild complete. Output: ${o}`);
|
|
177
178
|
}
|
|
178
179
|
function C(e) {
|
|
179
|
-
let t = `/${e.contentDir}/${
|
|
180
|
+
let t = `/${e.contentDir}/${o}`, i = JSON.parse(e.siteConfig), a = JSON.parse(e.siteData), s = n((a.contentTree ?? {
|
|
180
181
|
rootItems: [],
|
|
181
182
|
children: []
|
|
182
|
-
}).children ?? [], i.title ?? "")
|
|
183
|
+
}).children ?? [], i.title ?? ""), c = JSON.stringify({
|
|
184
|
+
...a,
|
|
185
|
+
directoryListings: s
|
|
186
|
+
});
|
|
183
187
|
return `
|
|
184
188
|
import { createTypedownApp } from 'typerighter/client';
|
|
185
189
|
import { TdDirectoryIndex } from 'typerighter/client/theme-default';
|
|
@@ -189,8 +193,7 @@ import theme from '${e.layoutImport}';
|
|
|
189
193
|
|
|
190
194
|
const pages = import.meta.glob('${t}', { eager: true });
|
|
191
195
|
const contentExts = ${JSON.stringify(r)};
|
|
192
|
-
|
|
193
|
-
const directoryIndex = ${JSON.stringify(a)};
|
|
196
|
+
const siteData = ${c};
|
|
194
197
|
|
|
195
198
|
function findPage(base) {
|
|
196
199
|
for (const ext of contentExts) {
|
|
@@ -206,9 +209,9 @@ function loadPageModule(pagePath) {
|
|
|
206
209
|
const page = findPage(base);
|
|
207
210
|
if (page) return Promise.resolve(page);
|
|
208
211
|
|
|
209
|
-
const dir =
|
|
212
|
+
const dir = siteData.directoryListings[pagePath] || siteData.directoryListings[pagePath + '/'];
|
|
210
213
|
if (dir) return Promise.resolve({
|
|
211
|
-
default: { name: 'DirectoryIndex', render() { return h(TdDirectoryIndex
|
|
214
|
+
default: { name: 'DirectoryIndex', render() { return h(TdDirectoryIndex); } },
|
|
212
215
|
__pageData: { frontmatter: {}, headings: [], title: dir.title },
|
|
213
216
|
});
|
|
214
217
|
|
|
@@ -216,7 +219,7 @@ function loadPageModule(pagePath) {
|
|
|
216
219
|
}
|
|
217
220
|
|
|
218
221
|
export async function render(url) {
|
|
219
|
-
const { app, router } = await createTypedownApp(loadPageModule, theme.Layout, ${e.siteConfig},
|
|
222
|
+
const { app, router } = await createTypedownApp(loadPageModule, theme.Layout, ${e.siteConfig}, siteData);
|
|
220
223
|
await router.go(url, { replace: true });
|
|
221
224
|
const html = await renderToString(app);
|
|
222
225
|
return { html, pageData: router.route.data };
|
|
@@ -620,7 +623,7 @@ function J() {
|
|
|
620
623
|
r.dispose();
|
|
621
624
|
}
|
|
622
625
|
}), t.command("init [root]", "Scaffold a new project").action(async (e) => {
|
|
623
|
-
let { initialize: t } = await import("./init-
|
|
626
|
+
let { initialize: t } = await import("./init-CzF7lqKE.js");
|
|
624
627
|
await t(X(e));
|
|
625
628
|
}), t.command("preview [root]", "Preview production build").option("--port <port>", "Port to listen on").action(async (e, t) => {
|
|
626
629
|
let { preview: n } = await import("vite");
|
|
@@ -650,7 +653,7 @@ function J() {
|
|
|
650
653
|
} finally {
|
|
651
654
|
r.dispose();
|
|
652
655
|
}
|
|
653
|
-
}), t.help(), t.version("0.
|
|
656
|
+
}), t.help(), t.version("0.6.0"), t.parse();
|
|
654
657
|
}
|
|
655
658
|
function Y(e, t) {
|
|
656
659
|
let n = t instanceof Error ? t.message : String(t);
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "./cli-
|
|
1
|
+
import { t as e } from "./cli-D5-gYw26.js";
|
|
2
2
|
export { e as cli };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type App, type Component, type ShallowRef } from 'vue';
|
|
2
2
|
import { type Router } from './router';
|
|
3
|
-
import type { PageModule, ContentTree, SchemaDefinition } from '@/shared';
|
|
3
|
+
import type { PageModule, ContentTree, SchemaDefinition, DirectoryListing } from '@/shared';
|
|
4
4
|
export { useTdContent, } from './composables/useTdContent';
|
|
5
5
|
export { useRouter, useRoute, } from './router';
|
|
6
6
|
export { Content, } from './components/Content';
|
|
@@ -17,6 +17,8 @@ export interface TypedownSiteData {
|
|
|
17
17
|
searchIndex?: string;
|
|
18
18
|
/** Schema definitions keyed by schema name */
|
|
19
19
|
schemas: Record<string, SchemaDefinition>;
|
|
20
|
+
/** Directory listings keyed by URL path */
|
|
21
|
+
directoryListings: Record<string, DirectoryListing>;
|
|
20
22
|
}
|
|
21
23
|
type PageLoader = (path: string) => Promise<PageModule | undefined>;
|
|
22
24
|
export declare function createTypedownApp(loadPageModule: (path: string) => Promise<PageModule | undefined>, Layout: Component, config?: Partial<TypedownSiteConfig>, data?: Partial<TypedownSiteData>): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,GAAG,EACR,KAAK,SAAS,EAEd,KAAK,UAAU,EAChB,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,GAAG,EACR,KAAK,SAAS,EAEd,KAAK,UAAU,EAChB,MAAM,KAAK,CAAC;AASb,OAAO,EACuB,KAAK,MAAM,EACxC,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,YAAY,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,SAAS,EAAE,QAAQ,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,OAAO,GACR,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,kBAAkB;IACjC,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,kDAAkD;IAClD,WAAW,EAAE,WAAW,CAAC;IACzB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8CAA8C;IAC9C,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IAC1C,2CAA2C;IAC3C,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CACrD;AAED,KAAK,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;AAOpE,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,EACjE,MAAM,EAAE,SAAS,EACjB,MAAM,GAAE,OAAO,CAAC,kBAAkB,CAAM,EACxC,IAAI,GAAE,OAAO,CAAC,gBAAgB,CAAM,GACnC,OAAO,CAAC;IACT,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAC7C,CAAC,CAuDD;AAED,wBAAgB,aAAa,IAAK,UAAU,GAAG,SAAS,CAEvD;AAGD,wBAAgB,cAAc,IAAK,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC,CAEhE;AAED,wBAAgB,aAAa,IAAK,kBAAkB,CAKnD;AAED,wBAAgB,WAAW,IAAK,gBAAgB,CAS/C"}
|