typerighter 0.5.1 → 0.7.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-Bf0aLzaG.js +370 -0
- package/dist/brand-BfamszbH.js +12 -0
- package/dist/{cli-CAvgSpyx.js → cli-CDd4TNg1.js} +22 -17
- package/dist/cli.js +1 -1
- package/dist/client/app/composables/useUrl.d.ts +6 -0
- package/dist/client/app/composables/useUrl.d.ts.map +1 -0
- package/dist/client/app/index.d.ts +8 -1
- package/dist/client/app/index.d.ts.map +1 -1
- package/dist/client/theme-default.js +655 -427
- package/dist/client.js +1 -1
- package/dist/{constants-BVW9e5iH.js → constants-DJbUAb1-.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-Dfj-Yf9i.js → init-Bfnl0t1B.js} +4 -3
- package/dist/node/build/index.d.ts.map +1 -1
- package/dist/node/plugin/vite/index.d.ts +4 -0
- package/dist/node/plugin/vite/index.d.ts.map +1 -1
- package/dist/shared/utils/content.d.ts.map +1 -1
- 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-CpPZZ8IH.js} +62 -65
- package/dist/typerighter.css +1 -1
- package/dist/{vite-DPRlAukM.js → vite-DnP-_NzR.js} +46 -41
- package/dist/vite.js +1 -1
- package/package.json +3 -3
- package/dist/app-DZLkaV9-.js +0 -266
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { l as e } from "./shared-CpPZZ8IH.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", [["path", {
|
|
55
|
+
d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
|
|
56
|
+
key: "1kt360"
|
|
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 t = e(c.path), n = l.directoryListings[t] ?? l.directoryListings[t + "/"];
|
|
62
|
+
return {
|
|
63
|
+
url: t,
|
|
64
|
+
subdirectories: n?.subdirectories ?? [],
|
|
65
|
+
items: n?.items ?? []
|
|
66
|
+
};
|
|
67
|
+
}), d = n(() => u.value.url === "/"), f = n(() => {
|
|
68
|
+
let t = e(u.value.url);
|
|
69
|
+
return t === "/" ? "/index" : t + "/index";
|
|
70
|
+
});
|
|
71
|
+
return (e, n) => (m(), a("div", null, [
|
|
72
|
+
d.value ? i("", !0) : (m(), a("a", {
|
|
73
|
+
key: 0,
|
|
74
|
+
href: f.value,
|
|
75
|
+
class: "td-dir-row"
|
|
76
|
+
}, [s(C(se), {
|
|
77
|
+
size: 16,
|
|
78
|
+
class: "td-dir-icon"
|
|
79
|
+
}), n[0] ||= o("span", { class: "td-dir-parent" }, "..", -1)], 8, ce)),
|
|
80
|
+
u.value.subdirectories.length > 0 ? (m(), a("div", le, [(m(!0), a(t, null, y(u.value.subdirectories, (e) => (m(), a("a", {
|
|
81
|
+
key: e.url,
|
|
82
|
+
href: e.url,
|
|
83
|
+
class: "td-dir-row"
|
|
84
|
+
}, [
|
|
85
|
+
s(C(j), {
|
|
86
|
+
size: 16,
|
|
87
|
+
class: "td-dir-icon"
|
|
88
|
+
}),
|
|
89
|
+
o("span", de, S(e.name), 1),
|
|
90
|
+
o("span", fe, S(e.count), 1)
|
|
91
|
+
], 8, ue))), 128))])) : i("", !0),
|
|
92
|
+
u.value.items.length > 0 ? (m(), a("div", pe, [(m(!0), a(t, null, y(u.value.items, (e) => (m(), a("a", {
|
|
93
|
+
key: e.url,
|
|
94
|
+
href: e.url,
|
|
95
|
+
class: "td-dir-row"
|
|
96
|
+
}, [s(C(A), {
|
|
97
|
+
size: 16,
|
|
98
|
+
class: "td-dir-icon"
|
|
99
|
+
}), o("span", he, S(e.name), 1)], 8, me))), 128))])) : i("", !0)
|
|
100
|
+
]));
|
|
101
|
+
}
|
|
102
|
+
}), M = (e, t) => {
|
|
103
|
+
let n = e.__vccOpts || e;
|
|
104
|
+
for (let [e, r] of t) n[e] = r;
|
|
105
|
+
return n;
|
|
106
|
+
}, N = /*#__PURE__*/ M(ge, [["__scopeId", "data-v-0a816569"]]), _e = [
|
|
107
|
+
"id",
|
|
108
|
+
"tabindex",
|
|
109
|
+
"aria-pressed",
|
|
110
|
+
"aria-label",
|
|
111
|
+
"onKeydown"
|
|
112
|
+
], 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({
|
|
113
|
+
inheritAttrs: !1,
|
|
114
|
+
__name: "TdFlashcard",
|
|
115
|
+
props: {
|
|
116
|
+
id: { default: () => void 0 },
|
|
117
|
+
revealed: {
|
|
118
|
+
type: Boolean,
|
|
119
|
+
default: !1
|
|
120
|
+
},
|
|
121
|
+
disabled: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
default: !1
|
|
124
|
+
},
|
|
125
|
+
questionLabel: { default: "Question" },
|
|
126
|
+
keyLabel: { default: "Answer" }
|
|
127
|
+
},
|
|
128
|
+
setup(e, { expose: t }) {
|
|
129
|
+
let n = v(e.revealed);
|
|
130
|
+
ee(() => e.revealed, () => {
|
|
131
|
+
n.value = e.revealed;
|
|
132
|
+
});
|
|
133
|
+
function r() {
|
|
134
|
+
if (e.disabled) return n.value;
|
|
135
|
+
let t = n.value;
|
|
136
|
+
return n.value = !n.value, t;
|
|
137
|
+
}
|
|
138
|
+
function i() {
|
|
139
|
+
let e = n.value;
|
|
140
|
+
return n.value = !0, e;
|
|
141
|
+
}
|
|
142
|
+
function s() {
|
|
143
|
+
let e = n.value;
|
|
144
|
+
return n.value = !1, e;
|
|
145
|
+
}
|
|
146
|
+
return t({
|
|
147
|
+
flip: r,
|
|
148
|
+
showQuestion: s,
|
|
149
|
+
showKey: i,
|
|
150
|
+
state: _(n)
|
|
151
|
+
}), (t, i) => (m(), a("div", f(t.$attrs, {
|
|
152
|
+
id: e.id,
|
|
153
|
+
class: ["td-flashcard", {
|
|
154
|
+
"is-revealed": n.value,
|
|
155
|
+
"is-disabled": e.disabled
|
|
156
|
+
}],
|
|
157
|
+
role: "button",
|
|
158
|
+
tabindex: e.disabled ? -1 : 0,
|
|
159
|
+
"aria-pressed": n.value,
|
|
160
|
+
"aria-label": n.value ? e.keyLabel : e.questionLabel,
|
|
161
|
+
onClick: r,
|
|
162
|
+
onKeydown: [w(T(r, ["prevent"]), ["enter"]), w(T(r, ["prevent"]), ["space"])]
|
|
163
|
+
}), [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));
|
|
164
|
+
}
|
|
165
|
+
}), [["__scopeId", "data-v-95dfbffd"]]), P = typeof window < "u", F = Symbol("typedown-router"), I = {
|
|
166
|
+
frontmatter: {},
|
|
167
|
+
headings: [],
|
|
168
|
+
title: "Not Found"
|
|
169
|
+
};
|
|
170
|
+
function Te(e, t) {
|
|
171
|
+
let n = g({
|
|
172
|
+
path: "/",
|
|
173
|
+
hash: "",
|
|
174
|
+
query: "",
|
|
175
|
+
contentSfc: void 0,
|
|
176
|
+
data: I
|
|
177
|
+
}), r = {
|
|
178
|
+
route: n,
|
|
179
|
+
async go(e, t) {
|
|
180
|
+
e = B(e), await r.onBeforeRouteChange?.(e) !== !1 && ((!P || t?.initialLoad || Ee(e, t)) && await a(e), o(), await r.onAfterRouteChange?.(e));
|
|
181
|
+
}
|
|
182
|
+
}, i;
|
|
183
|
+
async function a(r) {
|
|
184
|
+
let a = new URL(r, "http://a.com"), s = i = a.pathname;
|
|
185
|
+
try {
|
|
186
|
+
let t = await e(s);
|
|
187
|
+
if (!t) throw Error(`Page not found: ${s}`);
|
|
188
|
+
if (i === s) {
|
|
189
|
+
i = void 0;
|
|
190
|
+
let { default: e, __pageData: r } = t;
|
|
191
|
+
n.path = s, n.contentSfc = d(e), n.data = d(r), o(a), P && p(() => {
|
|
192
|
+
L(a.hash);
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
} catch {
|
|
196
|
+
i === s && (i = void 0, n.path = s, n.contentSfc = t ? d(t) : void 0, n.data = I, o(a));
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function o(e = P ? location : {
|
|
200
|
+
search: "",
|
|
201
|
+
hash: ""
|
|
202
|
+
}) {
|
|
203
|
+
n.query = e.search, n.hash = decodeURIComponent(e.hash);
|
|
204
|
+
}
|
|
205
|
+
return P && (history.state ?? history.replaceState({}, ""), window.addEventListener("click", (e) => {
|
|
206
|
+
if (e.defaultPrevented || !(e.target instanceof Element) || e.button !== 0 || e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
|
|
207
|
+
let t = e.target.closest("a");
|
|
208
|
+
if (!t || t.hasAttribute("download") || t.hasAttribute("target")) return;
|
|
209
|
+
let n = t.getAttribute("href");
|
|
210
|
+
if (n === null) return;
|
|
211
|
+
let { href: i, origin: a, pathname: o } = new URL(n, t.baseURI);
|
|
212
|
+
a === location.origin && !o.match(/\.\w+$/) && (e.preventDefault(), r.go(i));
|
|
213
|
+
}, { capture: !0 }), window.addEventListener("popstate", async (e) => {
|
|
214
|
+
if (e.state == null) return;
|
|
215
|
+
let t = B(location.href);
|
|
216
|
+
await a(t), o(), await r.onAfterRouteChange?.(t);
|
|
217
|
+
}), window.addEventListener("hashchange", (e) => {
|
|
218
|
+
e.preventDefault(), o();
|
|
219
|
+
})), r;
|
|
220
|
+
}
|
|
221
|
+
function L(e) {
|
|
222
|
+
if (!e) return;
|
|
223
|
+
let t;
|
|
224
|
+
try {
|
|
225
|
+
t = document.getElementById(decodeURIComponent(e).slice(1)) ?? void 0;
|
|
226
|
+
} catch {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
t?.scrollIntoView({ block: "start" });
|
|
230
|
+
}
|
|
231
|
+
function R() {
|
|
232
|
+
return z().route;
|
|
233
|
+
}
|
|
234
|
+
function z() {
|
|
235
|
+
let e = u(F);
|
|
236
|
+
if (!e) throw Error("useRouter() called outside of Typedown app");
|
|
237
|
+
return e;
|
|
238
|
+
}
|
|
239
|
+
function Ee(e, { replace: t = !1 } = {}) {
|
|
240
|
+
let n = B(location.href);
|
|
241
|
+
if (e === n) return L(new URL(e, "http://a.com").hash), !1;
|
|
242
|
+
t ? history.replaceState({}, "", e) : (history.replaceState({ scrollPosition: window.scrollY }, ""), history.pushState({}, "", e));
|
|
243
|
+
let r = new URL(e, location.origin), i = new URL(n, location.origin);
|
|
244
|
+
return r.pathname === i.pathname ? (L(r.hash), !1) : !0;
|
|
245
|
+
}
|
|
246
|
+
function B(e) {
|
|
247
|
+
let t = new URL(e, "http://a.com");
|
|
248
|
+
return t.pathname = t.pathname.replace(/\.html$/, ""), t.pathname === "/" && (t.pathname = "/index"), t.pathname + t.search + t.hash;
|
|
249
|
+
}
|
|
250
|
+
//#endregion
|
|
251
|
+
//#region src/client/app/components/Content.ts
|
|
252
|
+
var V = c({
|
|
253
|
+
name: "TypedownContent",
|
|
254
|
+
setup() {
|
|
255
|
+
let e = R();
|
|
256
|
+
return () => e.contentSfc ? l(e.contentSfc) : void 0;
|
|
257
|
+
}
|
|
258
|
+
}), H = "td-theme";
|
|
259
|
+
function U(e) {
|
|
260
|
+
if (typeof document > "u") return;
|
|
261
|
+
let t = e === "system" ? W() : e;
|
|
262
|
+
document.documentElement.classList.toggle("dark", t === "dark");
|
|
263
|
+
}
|
|
264
|
+
function W() {
|
|
265
|
+
return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
266
|
+
}
|
|
267
|
+
var G = v("system"), K = v(W()), q = !1;
|
|
268
|
+
function J() {
|
|
269
|
+
De();
|
|
270
|
+
let e = n(() => G.value === "system" ? K.value : G.value), t = n(() => e.value === "dark");
|
|
271
|
+
function r(e) {
|
|
272
|
+
G.value = e, U(e), typeof localStorage < "u" && localStorage.setItem(H, e);
|
|
273
|
+
}
|
|
274
|
+
function i() {
|
|
275
|
+
r(e.value === "light" ? "dark" : "light");
|
|
276
|
+
}
|
|
277
|
+
return {
|
|
278
|
+
theme: _(G),
|
|
279
|
+
effectiveTheme: e,
|
|
280
|
+
isDark: t,
|
|
281
|
+
setTheme: r,
|
|
282
|
+
toggle: i
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function De() {
|
|
286
|
+
if (!q) {
|
|
287
|
+
if (q = !0, typeof localStorage < "u") {
|
|
288
|
+
let e = localStorage.getItem(H);
|
|
289
|
+
(e === "light" || e === "dark" || e === "system") && (G.value = e);
|
|
290
|
+
}
|
|
291
|
+
U(G.value), typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
292
|
+
K.value = W(), G.value === "system" && U("system");
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
297
|
+
//#region src/client/app/composables/useTdContent.ts
|
|
298
|
+
var Y = Symbol("td-content");
|
|
299
|
+
function Oe(e) {
|
|
300
|
+
let t = J(), r = {
|
|
301
|
+
page: n(() => e.data),
|
|
302
|
+
frontmatter: n(() => e.data.frontmatter),
|
|
303
|
+
title: n(() => e.data.title),
|
|
304
|
+
isDark: n(() => t.isDark.value)
|
|
305
|
+
};
|
|
306
|
+
return h(Y, r), r;
|
|
307
|
+
}
|
|
308
|
+
function ke() {
|
|
309
|
+
let e = u(Y);
|
|
310
|
+
if (e === void 0) throw Error("useTdContent() called without a parent provideTdContent()");
|
|
311
|
+
return e;
|
|
312
|
+
}
|
|
313
|
+
//#endregion
|
|
314
|
+
//#region src/client/app/index.ts
|
|
315
|
+
var X = Symbol("typedown-site-config"), Z = Symbol("typedown-site-data"), Q = Symbol("typedown-page-loader"), Ae = Symbol("typedown-search-index");
|
|
316
|
+
async function je(e, t, n = {}, i = {}) {
|
|
317
|
+
let a = {
|
|
318
|
+
title: n.title ?? "",
|
|
319
|
+
description: n.description ?? "",
|
|
320
|
+
basePath: n.basePath ?? "/",
|
|
321
|
+
repo: n.repo
|
|
322
|
+
}, o = {
|
|
323
|
+
contentTree: i.contentTree ?? {
|
|
324
|
+
rootItems: [],
|
|
325
|
+
children: []
|
|
326
|
+
},
|
|
327
|
+
schemas: i.schemas ?? {},
|
|
328
|
+
directoryListings: i.directoryListings ?? {}
|
|
329
|
+
}, s = Te(e), u = r(c({
|
|
330
|
+
name: "TypedownApp",
|
|
331
|
+
setup() {
|
|
332
|
+
return Oe(s.route), () => l(t);
|
|
333
|
+
}
|
|
334
|
+
}));
|
|
335
|
+
u.provide(F, s), u.provide(X, a), u.provide(Z, o), u.provide(Q, e);
|
|
336
|
+
let d = x(i.searchIndex);
|
|
337
|
+
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, {
|
|
338
|
+
replace: !0,
|
|
339
|
+
initialLoad: !0
|
|
340
|
+
}), {
|
|
341
|
+
app: u,
|
|
342
|
+
router: s,
|
|
343
|
+
searchIndex: d
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function Me() {
|
|
347
|
+
return u(Q, void 0);
|
|
348
|
+
}
|
|
349
|
+
function Ne() {
|
|
350
|
+
return u(Ae, x(void 0));
|
|
351
|
+
}
|
|
352
|
+
function Pe() {
|
|
353
|
+
return u(X, {
|
|
354
|
+
title: "",
|
|
355
|
+
description: "",
|
|
356
|
+
basePath: "/"
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
function $() {
|
|
360
|
+
return u(Z, {
|
|
361
|
+
contentTree: {
|
|
362
|
+
rootItems: [],
|
|
363
|
+
children: []
|
|
364
|
+
},
|
|
365
|
+
schemas: {},
|
|
366
|
+
directoryListings: {}
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
//#endregion
|
|
370
|
+
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-DJbUAb1-.js";
|
|
2
|
+
import { _ as t, a as n, b as r, g as i, i as a, x as o } from "./shared-CpPZZ8IH.js";
|
|
3
|
+
import { o as s } from "./brand-BfamszbH.js";
|
|
4
|
+
import { n as c, t as l } from "./vite-DnP-_NzR.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";
|
|
@@ -96,6 +97,7 @@ async function S(e, n = {}) {
|
|
|
96
97
|
contentDir: _.contentDir,
|
|
97
98
|
siteTitle: _.siteTitle,
|
|
98
99
|
siteDescription: _.siteDescription,
|
|
100
|
+
repo: _.repo,
|
|
99
101
|
contentTree: O,
|
|
100
102
|
schemas: D
|
|
101
103
|
})), h.writeFile(N, C({
|
|
@@ -176,10 +178,13 @@ async function S(e, n = {}) {
|
|
|
176
178
|
i.log(`\nBuild complete. Output: ${o}`);
|
|
177
179
|
}
|
|
178
180
|
function C(e) {
|
|
179
|
-
let t = `/${e.contentDir}/${
|
|
181
|
+
let t = `/${e.contentDir}/${o}`, i = JSON.parse(e.siteConfig), a = JSON.parse(e.siteData), s = n((a.contentTree ?? {
|
|
180
182
|
rootItems: [],
|
|
181
183
|
children: []
|
|
182
|
-
}).children ?? [], i.title ?? "")
|
|
184
|
+
}).children ?? [], i.title ?? ""), c = JSON.stringify({
|
|
185
|
+
...a,
|
|
186
|
+
directoryListings: s
|
|
187
|
+
});
|
|
183
188
|
return `
|
|
184
189
|
import { createTypedownApp } from 'typerighter/client';
|
|
185
190
|
import { TdDirectoryIndex } from 'typerighter/client/theme-default';
|
|
@@ -189,15 +194,12 @@ import theme from '${e.layoutImport}';
|
|
|
189
194
|
|
|
190
195
|
const pages = import.meta.glob('${t}', { eager: true });
|
|
191
196
|
const contentExts = ${JSON.stringify(r)};
|
|
192
|
-
|
|
193
|
-
const directoryIndex = ${JSON.stringify(a)};
|
|
197
|
+
const siteData = ${c};
|
|
194
198
|
|
|
195
199
|
function findPage(base) {
|
|
196
200
|
for (const ext of contentExts) {
|
|
197
201
|
const key = base + ext;
|
|
198
202
|
if (pages[key]) return pages[key];
|
|
199
|
-
const indexKey = base + '/index' + ext;
|
|
200
|
-
if (pages[indexKey]) return pages[indexKey];
|
|
201
203
|
}
|
|
202
204
|
}
|
|
203
205
|
|
|
@@ -206,17 +208,20 @@ function loadPageModule(pagePath) {
|
|
|
206
208
|
const page = findPage(base);
|
|
207
209
|
if (page) return Promise.resolve(page);
|
|
208
210
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
211
|
+
if (pagePath.endsWith('/index')) {
|
|
212
|
+
const dirPath = pagePath.slice(0, -'/index'.length) || '/';
|
|
213
|
+
const dir = siteData.directoryListings[dirPath] || siteData.directoryListings[dirPath + '/'];
|
|
214
|
+
if (dir) return Promise.resolve({
|
|
215
|
+
default: { name: 'DirectoryIndex', render() { return h(TdDirectoryIndex); } },
|
|
216
|
+
__pageData: { frontmatter: {}, headings: [], title: dir.title },
|
|
217
|
+
});
|
|
218
|
+
}
|
|
214
219
|
|
|
215
220
|
return Promise.resolve(undefined);
|
|
216
221
|
}
|
|
217
222
|
|
|
218
223
|
export async function render(url) {
|
|
219
|
-
const { app, router } = await createTypedownApp(loadPageModule, theme.Layout, ${e.siteConfig},
|
|
224
|
+
const { app, router } = await createTypedownApp(loadPageModule, theme.Layout, ${e.siteConfig}, siteData);
|
|
220
225
|
await router.go(url, { replace: true });
|
|
221
226
|
const html = await renderToString(app);
|
|
222
227
|
return { html, pageData: router.route.data };
|
|
@@ -620,7 +625,7 @@ function J() {
|
|
|
620
625
|
r.dispose();
|
|
621
626
|
}
|
|
622
627
|
}), t.command("init [root]", "Scaffold a new project").action(async (e) => {
|
|
623
|
-
let { initialize: t } = await import("./init-
|
|
628
|
+
let { initialize: t } = await import("./init-Bfnl0t1B.js");
|
|
624
629
|
await t(X(e));
|
|
625
630
|
}), t.command("preview [root]", "Preview production build").option("--port <port>", "Port to listen on").action(async (e, t) => {
|
|
626
631
|
let { preview: n } = await import("vite");
|
|
@@ -650,7 +655,7 @@ function J() {
|
|
|
650
655
|
} finally {
|
|
651
656
|
r.dispose();
|
|
652
657
|
}
|
|
653
|
-
}), t.help(), t.version("0.
|
|
658
|
+
}), t.help(), t.version("0.7.0"), t.parse();
|
|
654
659
|
}
|
|
655
660
|
function Y(e, t) {
|
|
656
661
|
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-CDd4TNg1.js";
|
|
2
2
|
export { e as cli };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUrl.d.ts","sourceRoot":"","sources":["../../../../src/client/app/composables/useUrl.ts"],"names":[],"mappings":"AAKA,wBAAgB,MAAM;gBAIA,MAAM,KAAG,MAAM;mBAId,MAAM;8BAIO,MAAM,KAAG,MAAM;EASlD"}
|
|
@@ -1,7 +1,8 @@
|
|
|
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
|
+
export { useUrl, } from './composables/useUrl';
|
|
5
6
|
export { useRouter, useRoute, } from './router';
|
|
6
7
|
export { Content, } from './components/Content';
|
|
7
8
|
export interface TypedownSiteConfig {
|
|
@@ -9,6 +10,10 @@ export interface TypedownSiteConfig {
|
|
|
9
10
|
title: string;
|
|
10
11
|
/** Site description */
|
|
11
12
|
description: string;
|
|
13
|
+
/** URL base path (e.g. "/" or "/blog") */
|
|
14
|
+
basePath: string;
|
|
15
|
+
/** Repository URL */
|
|
16
|
+
repo?: string;
|
|
12
17
|
}
|
|
13
18
|
export interface TypedownSiteData {
|
|
14
19
|
/** Content files as a recursive directory tree */
|
|
@@ -17,6 +22,8 @@ export interface TypedownSiteData {
|
|
|
17
22
|
searchIndex?: string;
|
|
18
23
|
/** Schema definitions keyed by schema name */
|
|
19
24
|
schemas: Record<string, SchemaDefinition>;
|
|
25
|
+
/** Directory listings keyed by URL path */
|
|
26
|
+
directoryListings: Record<string, DirectoryListing>;
|
|
20
27
|
}
|
|
21
28
|
type PageLoader = (path: string) => Promise<PageModule | undefined>;
|
|
22
29
|
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,MAAM,GACP,MAAM,sBAAsB,CAAC;AAC9B,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;IACpB,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;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,CAyDD;AAED,wBAAgB,aAAa,IAAK,UAAU,GAAG,SAAS,CAEvD;AAGD,wBAAgB,cAAc,IAAK,UAAU,CAAC,MAAM,GAAG,SAAS,CAAC,CAEhE;AAED,wBAAgB,aAAa,IAAK,kBAAkB,CAMnD;AAED,wBAAgB,WAAW,IAAK,gBAAgB,CAS/C"}
|