typerighter 0.6.0 → 0.8.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-Dn-65wMj.js +373 -0
- package/dist/{es-ClqUVRJn.js → brand-CJDq15GW.js} +2 -2
- package/dist/{cli-D5-gYw26.js → cli-Doj0ofRb.js} +59 -58
- package/dist/cli.js +1 -1
- package/dist/client/app/index.d.ts +16 -2
- package/dist/client/app/index.d.ts.map +1 -1
- package/dist/client/app/router.d.ts +6 -2
- package/dist/client/app/router.d.ts.map +1 -1
- package/dist/client/theme-default.js +527 -363
- package/dist/client.js +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-CzF7lqKE.js → init-cYe8Z2-E.js} +18 -18
- 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/field.d.ts +2 -0
- package/dist/shared/utils/field.d.ts.map +1 -0
- package/dist/shared/utils/index.d.ts +1 -0
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/shared/utils/url.d.ts +5 -0
- package/dist/shared/utils/url.d.ts.map +1 -1
- package/dist/shared-BIdsxcZ2.js +265 -0
- package/dist/shared.js +2 -0
- package/dist/typerighter.css +1 -1
- package/dist/{constants-Dq357AVO.js → vite-CASZdq-i.js} +323 -16
- package/dist/vite.js +1 -1
- package/package.json +7 -3
- package/dist/app-BZKg-fe3.js +0 -364
- package/dist/brand-BfamszbH.js +0 -12
- package/dist/shared-BoWAaUci.js +0 -192
- package/dist/vite-BrwFwz0T.js +0 -322
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { E as e, _ as t, v as n, w as r } from "./shared-BIdsxcZ2.js";
|
|
2
|
+
import { Fragment as i, computed as a, createApp as o, createCommentVNode as s, createElementBlock as c, createElementVNode as l, createVNode as u, defineComponent as d, h as f, inject as p, markRaw as m, mergeProps as h, nextTick as g, openBlock as _, provide as v, reactive as ee, readonly as y, ref as b, renderList as x, renderSlot as S, shallowRef as C, toDisplayString as w, unref as T, watch as te, withKeys as E, withModifiers as D } 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 O = (e) => e === "", ne = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), k = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), re = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), ie = (e) => {
|
|
5
|
+
let t = re(e);
|
|
6
|
+
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
7
|
+
}, A = {
|
|
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
|
+
}, ae = /* @__PURE__ */ Symbol("lucide-icons");
|
|
18
|
+
function oe() {
|
|
19
|
+
return p(ae, {});
|
|
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 se = ({ name: e, iconNode: t, "icon-node": n, absoluteStrokeWidth: r, "absolute-stroke-width": i, strokeWidth: o, "stroke-width": s, size: c, color: l, ...u }, { slots: d }) => {
|
|
24
|
+
let { size: p, color: m, strokeWidth: h = 2, absoluteStrokeWidth: g = !1, class: _ = "" } = oe(), v = a(() => {
|
|
25
|
+
let e = O(r) || O(i) || r === !0 || i === !0 || g === !0, t = o || s || h || A["stroke-width"];
|
|
26
|
+
return e ? Number(t) * 24 / Number(c ?? p ?? A.width) : t;
|
|
27
|
+
});
|
|
28
|
+
return f("svg", {
|
|
29
|
+
...A,
|
|
30
|
+
...u,
|
|
31
|
+
width: c ?? p ?? A.width,
|
|
32
|
+
height: c ?? p ?? A.height,
|
|
33
|
+
stroke: l ?? m ?? A.stroke,
|
|
34
|
+
"stroke-width": v.value,
|
|
35
|
+
class: ne("lucide", _, ...e ? [`lucide-${k(ie(e))}-icon`, `lucide-${k(e)}`] : ["lucide-icon"])
|
|
36
|
+
}, [...(t ?? n ?? []).map((e) => f(...e)), ...d.default ? [d.default()] : []]);
|
|
37
|
+
}, j = (e, t) => (n, { slots: r, attrs: i }) => f(se, {
|
|
38
|
+
...i,
|
|
39
|
+
...n,
|
|
40
|
+
iconNode: t,
|
|
41
|
+
name: e
|
|
42
|
+
}, r.default ? { default: r.default } : void 0), ce = j("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
|
+
}]]), M = j("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
|
+
}]]), N = j("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
|
+
}]]), le = ["href"], ue = { key: 1 }, de = ["href"], fe = { class: "td-dir-name" }, pe = { class: "td-dir-count" }, me = { key: 2 }, he = ["href"], ge = { class: "td-dir-name" }, _e = /*@__PURE__*/ d({
|
|
58
|
+
__name: "TdDirectoryIndex",
|
|
59
|
+
setup(e) {
|
|
60
|
+
let r = B(), o = $(), { withBase: d } = Le(), f = a(() => {
|
|
61
|
+
let e = n(r.path), t = o.directoryListings[e];
|
|
62
|
+
return {
|
|
63
|
+
url: e,
|
|
64
|
+
subdirectories: t?.subdirectories ?? [],
|
|
65
|
+
items: t?.items ?? []
|
|
66
|
+
};
|
|
67
|
+
}), p = a(() => f.value.url === "/"), m = a(() => d(t(n(f.value.url))));
|
|
68
|
+
return (e, t) => (_(), c("div", null, [
|
|
69
|
+
p.value ? s("", !0) : (_(), c("a", {
|
|
70
|
+
key: 0,
|
|
71
|
+
href: m.value,
|
|
72
|
+
class: "td-dir-row"
|
|
73
|
+
}, [u(T(ce), {
|
|
74
|
+
size: 16,
|
|
75
|
+
class: "td-dir-icon"
|
|
76
|
+
}), t[0] ||= l("span", { class: "td-dir-parent" }, "..", -1)], 8, le)),
|
|
77
|
+
f.value.subdirectories.length > 0 ? (_(), c("div", ue, [(_(!0), c(i, null, x(f.value.subdirectories, (e) => (_(), c("a", {
|
|
78
|
+
key: e.url,
|
|
79
|
+
href: T(d)(e.url),
|
|
80
|
+
class: "td-dir-row"
|
|
81
|
+
}, [
|
|
82
|
+
u(T(N), {
|
|
83
|
+
size: 16,
|
|
84
|
+
class: "td-dir-icon"
|
|
85
|
+
}),
|
|
86
|
+
l("span", fe, w(e.name), 1),
|
|
87
|
+
l("span", pe, w(e.count), 1)
|
|
88
|
+
], 8, de))), 128))])) : s("", !0),
|
|
89
|
+
f.value.items.length > 0 ? (_(), c("div", me, [(_(!0), c(i, null, x(f.value.items, (e) => (_(), c("a", {
|
|
90
|
+
key: e.url,
|
|
91
|
+
href: T(d)(e.url),
|
|
92
|
+
class: "td-dir-row"
|
|
93
|
+
}, [u(T(M), {
|
|
94
|
+
size: 16,
|
|
95
|
+
class: "td-dir-icon"
|
|
96
|
+
}), l("span", ge, w(e.name), 1)], 8, he))), 128))])) : s("", !0)
|
|
97
|
+
]));
|
|
98
|
+
}
|
|
99
|
+
}), P = (e, t) => {
|
|
100
|
+
let n = e.__vccOpts || e;
|
|
101
|
+
for (let [e, r] of t) n[e] = r;
|
|
102
|
+
return n;
|
|
103
|
+
}, F = /*#__PURE__*/ P(_e, [["__scopeId", "data-v-d73874c1"]]), ve = [
|
|
104
|
+
"id",
|
|
105
|
+
"tabindex",
|
|
106
|
+
"aria-pressed",
|
|
107
|
+
"aria-label",
|
|
108
|
+
"onKeydown"
|
|
109
|
+
], ye = { class: "td-flashcard-face td-flashcard-face-question" }, be = { class: "td-flashcard-label" }, xe = { class: "td-flashcard-body" }, Se = { class: "td-flashcard-face td-flashcard-face-key" }, Ce = { class: "td-flashcard-label" }, we = { class: "td-flashcard-body" }, Te = /*#__PURE__*/ P(/* @__PURE__ */ d({
|
|
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 = b(e.revealed);
|
|
127
|
+
te(() => 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 a() {
|
|
140
|
+
let e = n.value;
|
|
141
|
+
return n.value = !1, e;
|
|
142
|
+
}
|
|
143
|
+
return t({
|
|
144
|
+
flip: r,
|
|
145
|
+
showQuestion: a,
|
|
146
|
+
showKey: i,
|
|
147
|
+
state: y(n)
|
|
148
|
+
}), (t, i) => (_(), c("div", h(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: [E(D(r, ["prevent"]), ["enter"]), E(D(r, ["prevent"]), ["space"])]
|
|
160
|
+
}), [l("div", ye, [l("p", be, w(e.questionLabel), 1), l("div", xe, [S(t.$slots, "default")])]), l("div", Se, [l("p", Ce, w(e.keyLabel), 1), l("div", we, [S(t.$slots, "key")])])], 16, ve));
|
|
161
|
+
}
|
|
162
|
+
}), [["__scopeId", "data-v-95dfbffd"]]), I = typeof window < "u", L = Symbol("typedown-router"), R = {
|
|
163
|
+
frontmatter: {},
|
|
164
|
+
headings: [],
|
|
165
|
+
title: "Not Found"
|
|
166
|
+
};
|
|
167
|
+
function Ee(t, n = {}) {
|
|
168
|
+
let r = e(n.basePath ?? "/"), i = ee({
|
|
169
|
+
path: "/",
|
|
170
|
+
hash: "",
|
|
171
|
+
query: "",
|
|
172
|
+
contentSfc: void 0,
|
|
173
|
+
data: R
|
|
174
|
+
}), a = {
|
|
175
|
+
route: i,
|
|
176
|
+
async go(e, t) {
|
|
177
|
+
e = H(e, r), await a.onBeforeRouteChange?.(e) !== !1 && ((!I || t?.initialLoad || De(e, r, t)) && await s(e), c(), await a.onAfterRouteChange?.(e));
|
|
178
|
+
}
|
|
179
|
+
}, o;
|
|
180
|
+
async function s(e) {
|
|
181
|
+
let r = new URL(e, "http://a.com"), a = o = r.pathname;
|
|
182
|
+
try {
|
|
183
|
+
let e = await t(a);
|
|
184
|
+
if (!e) throw Error(`Page not found: ${a}`);
|
|
185
|
+
if (o === a) {
|
|
186
|
+
o = void 0;
|
|
187
|
+
let { default: t, __pageData: n } = e;
|
|
188
|
+
i.path = a, i.contentSfc = m(t), i.data = m(n), c(r), I && g(() => {
|
|
189
|
+
z(r.hash);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
} catch {
|
|
193
|
+
o === a && (o = void 0, i.path = a, i.contentSfc = n.fallbackComponent ? m(n.fallbackComponent) : void 0, i.data = R, c(r));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function c(e = I ? location : {
|
|
197
|
+
search: "",
|
|
198
|
+
hash: ""
|
|
199
|
+
}) {
|
|
200
|
+
i.query = e.search, i.hash = decodeURIComponent(e.hash);
|
|
201
|
+
}
|
|
202
|
+
return I && (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: r, origin: i, pathname: o } = new URL(n, t.baseURI);
|
|
209
|
+
i === location.origin && !o.match(/\.\w+$/) && (e.preventDefault(), a.go(r));
|
|
210
|
+
}, { capture: !0 }), window.addEventListener("popstate", async (e) => {
|
|
211
|
+
if (e.state == null) return;
|
|
212
|
+
let t = H(location.href, r);
|
|
213
|
+
await s(t), c(), await a.onAfterRouteChange?.(t);
|
|
214
|
+
}), window.addEventListener("hashchange", (e) => {
|
|
215
|
+
e.preventDefault(), c();
|
|
216
|
+
})), a;
|
|
217
|
+
}
|
|
218
|
+
function z(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 B() {
|
|
229
|
+
return V().route;
|
|
230
|
+
}
|
|
231
|
+
function V() {
|
|
232
|
+
let e = p(L);
|
|
233
|
+
if (!e) throw Error("useRouter() called outside of Typedown app");
|
|
234
|
+
return e;
|
|
235
|
+
}
|
|
236
|
+
function De(e, t, { replace: n = !1 } = {}) {
|
|
237
|
+
let r = H(location.href, t);
|
|
238
|
+
if (e === r) return z(new URL(e, "http://a.com").hash), !1;
|
|
239
|
+
n ? history.replaceState({}, "", e) : (history.replaceState({ scrollPosition: window.scrollY }, ""), history.pushState({}, "", e));
|
|
240
|
+
let i = new URL(e, location.origin), a = new URL(r, location.origin);
|
|
241
|
+
return i.pathname === a.pathname ? (z(i.hash), !1) : !0;
|
|
242
|
+
}
|
|
243
|
+
function H(e, t) {
|
|
244
|
+
let n = new URL(e, "http://a.com"), i = n.pathname.replace(/\.html$/, "");
|
|
245
|
+
return t && i.startsWith(t) && (i = i.slice(t.length) || "/"), n.pathname = r(i), n.pathname + n.search + n.hash;
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/client/app/components/Content.ts
|
|
249
|
+
var U = d({
|
|
250
|
+
name: "TypedownContent",
|
|
251
|
+
setup() {
|
|
252
|
+
let e = B();
|
|
253
|
+
return () => e.contentSfc ? f(e.contentSfc) : void 0;
|
|
254
|
+
}
|
|
255
|
+
}), W = "td-theme";
|
|
256
|
+
function G(e) {
|
|
257
|
+
if (typeof document > "u") return;
|
|
258
|
+
let t = e === "system" ? K() : e;
|
|
259
|
+
document.documentElement.classList.toggle("dark", t === "dark");
|
|
260
|
+
}
|
|
261
|
+
function K() {
|
|
262
|
+
return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
263
|
+
}
|
|
264
|
+
var q = b("system"), J = b(K()), Y = !1;
|
|
265
|
+
function X() {
|
|
266
|
+
Oe();
|
|
267
|
+
let e = a(() => q.value === "system" ? J.value : q.value), t = a(() => e.value === "dark");
|
|
268
|
+
function n(e) {
|
|
269
|
+
q.value = e, G(e), typeof localStorage < "u" && localStorage.setItem(W, e);
|
|
270
|
+
}
|
|
271
|
+
function r() {
|
|
272
|
+
n(e.value === "light" ? "dark" : "light");
|
|
273
|
+
}
|
|
274
|
+
return {
|
|
275
|
+
theme: y(q),
|
|
276
|
+
effectiveTheme: e,
|
|
277
|
+
isDark: t,
|
|
278
|
+
setTheme: n,
|
|
279
|
+
toggle: r
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function Oe() {
|
|
283
|
+
if (!Y) {
|
|
284
|
+
if (Y = !0, typeof localStorage < "u") {
|
|
285
|
+
let e = localStorage.getItem(W);
|
|
286
|
+
(e === "light" || e === "dark" || e === "system") && (q.value = e);
|
|
287
|
+
}
|
|
288
|
+
G(q.value), typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
289
|
+
J.value = K(), q.value === "system" && G("system");
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/client/app/composables/useTdContent.ts
|
|
295
|
+
var Z = Symbol("td-content");
|
|
296
|
+
function ke(e) {
|
|
297
|
+
let t = X(), n = {
|
|
298
|
+
page: a(() => e.data),
|
|
299
|
+
frontmatter: a(() => e.data.frontmatter),
|
|
300
|
+
title: a(() => e.data.title),
|
|
301
|
+
isDark: a(() => t.isDark.value)
|
|
302
|
+
};
|
|
303
|
+
return v(Z, n), n;
|
|
304
|
+
}
|
|
305
|
+
function Ae() {
|
|
306
|
+
let e = p(Z);
|
|
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 Q = Symbol("typedown-site-config"), je = Symbol("typedown-site-data"), Me = Symbol("typedown-page-loader"), Ne = Symbol("typedown-search-index");
|
|
313
|
+
async function Pe(e, t, n = {}, r = {}) {
|
|
314
|
+
let i = {
|
|
315
|
+
title: n.title ?? "",
|
|
316
|
+
description: n.description ?? "",
|
|
317
|
+
basePath: n.basePath ?? "/",
|
|
318
|
+
repo: n.repo
|
|
319
|
+
}, a = {
|
|
320
|
+
contentTree: r.contentTree ?? {
|
|
321
|
+
rootItems: [],
|
|
322
|
+
children: []
|
|
323
|
+
},
|
|
324
|
+
schemas: r.schemas ?? {},
|
|
325
|
+
directoryListings: r.directoryListings ?? {}
|
|
326
|
+
}, s = Ee(e, { basePath: i.basePath }), c = o(d({
|
|
327
|
+
name: "TypedownApp",
|
|
328
|
+
setup() {
|
|
329
|
+
return ke(s.route), () => f(t);
|
|
330
|
+
}
|
|
331
|
+
}));
|
|
332
|
+
c.provide(L, s), c.provide(Q, i), c.provide(je, a), c.provide(Me, e);
|
|
333
|
+
let l = C(r.searchIndex);
|
|
334
|
+
return c.provide(Ne, l), c.component("TypedownContent", U), c.component("DirectoryIndex", F), c.component("Flashcard", Te), typeof window < "u" && await s.go(location.href, {
|
|
335
|
+
replace: !0,
|
|
336
|
+
initialLoad: !0
|
|
337
|
+
}), {
|
|
338
|
+
app: c,
|
|
339
|
+
router: s,
|
|
340
|
+
searchIndex: l
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function Fe() {
|
|
344
|
+
return p(Me, void 0);
|
|
345
|
+
}
|
|
346
|
+
function Ie() {
|
|
347
|
+
return p(Ne, C(void 0));
|
|
348
|
+
}
|
|
349
|
+
function Le() {
|
|
350
|
+
let t = p(Q, {
|
|
351
|
+
title: "",
|
|
352
|
+
description: "",
|
|
353
|
+
basePath: "/"
|
|
354
|
+
}), n = e(t.basePath);
|
|
355
|
+
return {
|
|
356
|
+
...t,
|
|
357
|
+
withBase(e) {
|
|
358
|
+
return n === "/" ? e : n + e;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function $() {
|
|
363
|
+
return p(je, {
|
|
364
|
+
contentTree: {
|
|
365
|
+
rootItems: [],
|
|
366
|
+
children: []
|
|
367
|
+
},
|
|
368
|
+
schemas: {},
|
|
369
|
+
directoryListings: {}
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
//#endregion
|
|
373
|
+
export { $ as a, U as c, F as d, P as f, j as h, Le as i, B as l, M as m, Fe as n, Ae as o, N as p, Ie as r, X as s, Pe as t, V as u };
|
|
@@ -700,6 +700,6 @@ var v = (e, t) => Object.prototype.hasOwnProperty.call(e, t) ? e[t] : void 0, y
|
|
|
700
700
|
let t = /* @__PURE__ */ new Map(), n = 0;
|
|
701
701
|
for (let r of Object.keys(e)) t.set(parseInt(r, 10), e[r]), ++n % 1e3 == 0 && await F(0);
|
|
702
702
|
return t;
|
|
703
|
-
}, F = (e) => new Promise((t) => setTimeout(t, e)), I = /[\n\r\p{Z}\p{P}]+/u
|
|
703
|
+
}, F = (e) => new Promise((t) => setTimeout(t, e)), I = /[\n\r\p{Z}\p{P}]+/u, L = "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", z = "m155 98-30-33h20v-35h20v35h20z", B = "0 0 208 128", V = "#a0522d", H = `<svg fill='none' viewBox='${B}' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='${L}' fill-rule='evenodd' fill='${V}'/><path d='${R}' fill='${V}'/><path d='${z}' fill='${V}'/></svg>`, U = `data:image/svg+xml,${encodeURIComponent(H)}`;
|
|
704
704
|
//#endregion
|
|
705
|
-
export { _ as t };
|
|
705
|
+
export { B as a, R as i, L as n, _ as o, U as r, z as t };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { o as s } from "./brand-BfamszbH.js";
|
|
4
|
-
import { n as c, t as l } from "./vite-BrwFwz0T.js";
|
|
1
|
+
import { A as e, F as t, O as n, P as r, d as i, f as a, s as o } from "./shared-BIdsxcZ2.js";
|
|
2
|
+
import { a as s, n as c, t as l } from "./vite-CASZdq-i.js";
|
|
5
3
|
import u from "node:path";
|
|
6
4
|
import d from "picocolors";
|
|
7
5
|
import { build as f, createServer as p } from "vite";
|
|
@@ -30,8 +28,8 @@ function _(e) {
|
|
|
30
28
|
<head>
|
|
31
29
|
<meta charset="UTF-8">
|
|
32
30
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
33
|
-
<title>${
|
|
34
|
-
<meta name="description" content="${
|
|
31
|
+
<title>${o(e.title)}</title>
|
|
32
|
+
<meta name="description" content="${o(e.description)}">
|
|
35
33
|
${t}
|
|
36
34
|
${n}
|
|
37
35
|
</head>
|
|
@@ -76,18 +74,18 @@ function b(e) {
|
|
|
76
74
|
//#endregion
|
|
77
75
|
//#region src/node/build/index.ts
|
|
78
76
|
var x = "typerighter/client/theme-default";
|
|
79
|
-
async function S(
|
|
80
|
-
let { root: r, logger:
|
|
77
|
+
async function S(t, n = {}) {
|
|
78
|
+
let { root: r, logger: a } = t, o = u.resolve(r, n.outDir ?? "dist"), s = n.base ?? "/", d = u.join(o, ".client"), p = u.join(o, ".server");
|
|
81
79
|
await h.rm(o, {
|
|
82
80
|
recursive: !0,
|
|
83
81
|
force: !0
|
|
84
82
|
});
|
|
85
|
-
let m = await
|
|
83
|
+
let m = await t.getTdContext(), [_, v, b, S] = await Promise.all([
|
|
86
84
|
m.getConfig(),
|
|
87
85
|
m.listFiles(),
|
|
88
86
|
m.listFilesGroupedBySchema(),
|
|
89
87
|
m.listSchemas()
|
|
90
|
-
]), E = await Promise.all(S.map(async (e) => [e, (await m.getSchema(e)).properties])), D = Object.fromEntries(E), O =
|
|
88
|
+
]), E = await Promise.all(S.map(async (e) => [e, (await m.getSchema(e)).properties])), D = Object.fromEntries(E), O = i(Object.values(b).flat()), k = JSON.stringify({
|
|
91
89
|
title: _.siteTitle,
|
|
92
90
|
description: _.siteDescription
|
|
93
91
|
}), A = JSON.stringify({ contentTree: O }), j = u.join(r, "node_modules", ".typerighter");
|
|
@@ -97,6 +95,7 @@ async function S(e, n = {}) {
|
|
|
97
95
|
contentDir: _.contentDir,
|
|
98
96
|
siteTitle: _.siteTitle,
|
|
99
97
|
siteDescription: _.siteDescription,
|
|
98
|
+
repo: _.repo,
|
|
100
99
|
contentTree: O,
|
|
101
100
|
schemas: D
|
|
102
101
|
})), h.writeFile(N, C({
|
|
@@ -106,12 +105,12 @@ async function S(e, n = {}) {
|
|
|
106
105
|
siteData: A
|
|
107
106
|
}))]);
|
|
108
107
|
try {
|
|
109
|
-
let
|
|
108
|
+
let i = c({ context: t }), l = t.createViteLogger(), m = new y(a, "Building client bundle...");
|
|
110
109
|
await f({
|
|
111
110
|
...n.viteConfig,
|
|
112
111
|
root: r,
|
|
113
112
|
base: s,
|
|
114
|
-
plugins:
|
|
113
|
+
plugins: i,
|
|
115
114
|
customLogger: l,
|
|
116
115
|
logLevel: "silent",
|
|
117
116
|
build: {
|
|
@@ -127,12 +126,12 @@ async function S(e, n = {}) {
|
|
|
127
126
|
});
|
|
128
127
|
let b = await h.readdir(u.join(d, "assets")).catch(() => []);
|
|
129
128
|
m.done(`Client bundle (${b.length} chunks)`);
|
|
130
|
-
let x = new y(
|
|
129
|
+
let x = new y(a, "Building SSR bundle...");
|
|
131
130
|
await f({
|
|
132
131
|
...n.viteConfig,
|
|
133
132
|
root: r,
|
|
134
133
|
base: s,
|
|
135
|
-
plugins:
|
|
134
|
+
plugins: i,
|
|
136
135
|
customLogger: l,
|
|
137
136
|
logLevel: "silent",
|
|
138
137
|
build: {
|
|
@@ -142,12 +141,12 @@ async function S(e, n = {}) {
|
|
|
142
141
|
emptyOutDir: !0
|
|
143
142
|
}
|
|
144
143
|
}), x.done("SSR bundle");
|
|
145
|
-
let S = v.map((
|
|
146
|
-
let n = t
|
|
144
|
+
let S = v.map((t) => {
|
|
145
|
+
let n = e(t);
|
|
147
146
|
return n === "index" ? "/" : `/${n}`;
|
|
148
147
|
});
|
|
149
148
|
S.push("/"), T(O.children, "", S);
|
|
150
|
-
let C = new y(
|
|
149
|
+
let C = new y(a, "Pre-rendering pages...");
|
|
151
150
|
await g({
|
|
152
151
|
ssrEntryPath: u.join(p, "ssr-entry.js"),
|
|
153
152
|
clientOutDir: d,
|
|
@@ -174,24 +173,25 @@ async function S(e, n = {}) {
|
|
|
174
173
|
})
|
|
175
174
|
]);
|
|
176
175
|
}
|
|
177
|
-
|
|
176
|
+
a.log(`\nBuild complete. Output: ${o}`);
|
|
178
177
|
}
|
|
179
178
|
function C(e) {
|
|
180
|
-
let
|
|
179
|
+
let n = `/${e.contentDir}/${t}`, i = JSON.parse(e.siteConfig), o = JSON.parse(e.siteData), s = a((o.contentTree ?? {
|
|
181
180
|
rootItems: [],
|
|
182
181
|
children: []
|
|
183
182
|
}).children ?? [], i.title ?? ""), c = JSON.stringify({
|
|
184
|
-
...
|
|
183
|
+
...o,
|
|
185
184
|
directoryListings: s
|
|
186
185
|
});
|
|
187
186
|
return `
|
|
188
187
|
import { createTypedownApp } from 'typerighter/client';
|
|
189
188
|
import { TdDirectoryIndex } from 'typerighter/client/theme-default';
|
|
189
|
+
import { isIndexUrl, getDirectoryFromPageUrl } from 'typerighter/shared';
|
|
190
190
|
import { renderToString } from 'vue/server-renderer';
|
|
191
191
|
import { h } from 'vue';
|
|
192
192
|
import theme from '${e.layoutImport}';
|
|
193
193
|
|
|
194
|
-
const pages = import.meta.glob('${
|
|
194
|
+
const pages = import.meta.glob('${n}', { eager: true });
|
|
195
195
|
const contentExts = ${JSON.stringify(r)};
|
|
196
196
|
const siteData = ${c};
|
|
197
197
|
|
|
@@ -199,8 +199,6 @@ function findPage(base) {
|
|
|
199
199
|
for (const ext of contentExts) {
|
|
200
200
|
const key = base + ext;
|
|
201
201
|
if (pages[key]) return pages[key];
|
|
202
|
-
const indexKey = base + '/index' + ext;
|
|
203
|
-
if (pages[indexKey]) return pages[indexKey];
|
|
204
202
|
}
|
|
205
203
|
}
|
|
206
204
|
|
|
@@ -209,11 +207,14 @@ function loadPageModule(pagePath) {
|
|
|
209
207
|
const page = findPage(base);
|
|
210
208
|
if (page) return Promise.resolve(page);
|
|
211
209
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
210
|
+
if (isIndexUrl(pagePath)) {
|
|
211
|
+
const dirPath = getDirectoryFromPageUrl(pagePath);
|
|
212
|
+
const dir = siteData.directoryListings[dirPath];
|
|
213
|
+
if (dir) return Promise.resolve({
|
|
214
|
+
default: { name: 'DirectoryIndex', render() { return h(TdDirectoryIndex); } },
|
|
215
|
+
__pageData: { frontmatter: {}, headings: [], title: dir.title },
|
|
216
|
+
});
|
|
217
|
+
}
|
|
217
218
|
|
|
218
219
|
return Promise.resolve(undefined);
|
|
219
220
|
}
|
|
@@ -227,14 +228,14 @@ export async function render(url) {
|
|
|
227
228
|
`;
|
|
228
229
|
}
|
|
229
230
|
async function w(e, t) {
|
|
230
|
-
let
|
|
231
|
+
let r = (await h.readdir(e, {
|
|
231
232
|
recursive: !0,
|
|
232
233
|
withFileTypes: !0
|
|
233
|
-
})).filter((e) => e.isFile() && !
|
|
234
|
+
})).filter((e) => e.isFile() && !n(e.name)).map(async (n) => {
|
|
234
235
|
let r = u.join(n.parentPath, n.name), i = u.relative(e, r), a = u.join(t, i);
|
|
235
236
|
return h.mkdir(u.dirname(a), { recursive: !0 }).then(() => h.copyFile(r, a));
|
|
236
237
|
});
|
|
237
|
-
await Promise.all(
|
|
238
|
+
await Promise.all(r);
|
|
238
239
|
}
|
|
239
240
|
function T(e, t, n) {
|
|
240
241
|
for (let r of e) {
|
|
@@ -596,12 +597,12 @@ var U = class {
|
|
|
596
597
|
}
|
|
597
598
|
}, K = (e = "") => new G(e), q = d.bold(d.cyan("[typerighter]"));
|
|
598
599
|
function J() {
|
|
599
|
-
let
|
|
600
|
+
let e = K("typerighter");
|
|
600
601
|
process.on("uncaughtException", (e) => {
|
|
601
602
|
Y("runtime", e);
|
|
602
603
|
}), process.on("unhandledRejection", (e) => {
|
|
603
604
|
Y("runtime", e instanceof Error ? e : Error(String(e)));
|
|
604
|
-
}),
|
|
605
|
+
}), e.command("[root]", "Start dev server").alias("dev").option("--port <port>", "Port to listen on").option("--host", "Expose to network").action(async (e, t) => {
|
|
605
606
|
let n = await p({
|
|
606
607
|
root: X(e),
|
|
607
608
|
configFile: !1,
|
|
@@ -612,48 +613,48 @@ function J() {
|
|
|
612
613
|
}
|
|
613
614
|
});
|
|
614
615
|
await n.listen(), n.printUrls();
|
|
615
|
-
}),
|
|
616
|
-
let
|
|
616
|
+
}), e.command("build [root]", "Build for production").option("--outDir <dir>", "Output directory", { default: "dist" }).option("--base <path>", "Base public path", { default: "/" }).action(async (e, t) => {
|
|
617
|
+
let n = s(X(e));
|
|
617
618
|
try {
|
|
618
|
-
await S(
|
|
619
|
-
outDir:
|
|
620
|
-
base:
|
|
619
|
+
await S(n, {
|
|
620
|
+
outDir: t.outDir,
|
|
621
|
+
base: t.base
|
|
621
622
|
});
|
|
622
623
|
} finally {
|
|
623
|
-
|
|
624
|
+
n.dispose();
|
|
624
625
|
}
|
|
625
|
-
}),
|
|
626
|
-
let { initialize: t } = await import("./init-
|
|
626
|
+
}), e.command("init [root]", "Scaffold a new project").action(async (e) => {
|
|
627
|
+
let { initialize: t } = await import("./init-cYe8Z2-E.js");
|
|
627
628
|
await t(X(e));
|
|
628
|
-
}),
|
|
629
|
+
}), e.command("preview [root]", "Preview production build").option("--port <port>", "Port to listen on").action(async (e, t) => {
|
|
629
630
|
let { preview: n } = await import("vite");
|
|
630
631
|
(await n({
|
|
631
632
|
root: X(e),
|
|
632
633
|
preview: { port: t.port }
|
|
633
634
|
})).printUrls();
|
|
634
|
-
}),
|
|
635
|
-
let
|
|
635
|
+
}), e.command("check [root]", "Check vault for errors").option("--fix", "Auto-fix formatting issues").action(async (e, t) => {
|
|
636
|
+
let n = s(X(e)), { logger: r } = n;
|
|
636
637
|
try {
|
|
637
|
-
|
|
638
|
-
let e = await
|
|
639
|
-
for (let e of
|
|
640
|
-
if (
|
|
641
|
-
let t = await e.getConfig(), n = await e.listFiles(),
|
|
642
|
-
for (let
|
|
643
|
-
let n = await e.formatFile(
|
|
638
|
+
r.start("Checking vault...");
|
|
639
|
+
let e = await n.getTdContext(), i = await e.checkVault();
|
|
640
|
+
for (let e of i.diagnostics) e.severity === "error" ? r.error(`${e.filepath}:${e.line}:${e.column} ${e.message} (${e.code})`) : r.warn(`${e.filepath}:${e.line}:${e.column} ${e.message} (${e.code})`);
|
|
641
|
+
if (t.fix && 0 < i.warningCount) {
|
|
642
|
+
let t = await e.getConfig(), n = await e.listFiles(), i = 0;
|
|
643
|
+
for (let r of n) {
|
|
644
|
+
let n = await e.formatFile(r);
|
|
644
645
|
if (n.changed) {
|
|
645
|
-
let e = u.resolve(t.contentDir,
|
|
646
|
-
m.writeFileSync(e, n.content),
|
|
646
|
+
let e = u.resolve(t.contentDir, r);
|
|
647
|
+
m.writeFileSync(e, n.content), i++;
|
|
647
648
|
}
|
|
648
649
|
}
|
|
649
|
-
0 <
|
|
650
|
+
0 < i && r.success(`Fixed ${i} file(s)`);
|
|
650
651
|
}
|
|
651
|
-
let a = `${
|
|
652
|
-
0 <
|
|
652
|
+
let a = `${i.fileCount} files checked, ${i.errorCount} error(s), ${i.warningCount} warning(s)`;
|
|
653
|
+
0 < i.errorCount ? (r.error(a), process.exit(1)) : r.success(a);
|
|
653
654
|
} finally {
|
|
654
|
-
|
|
655
|
+
n.dispose();
|
|
655
656
|
}
|
|
656
|
-
}),
|
|
657
|
+
}), e.help(), e.version("0.8.0"), e.parse();
|
|
657
658
|
}
|
|
658
659
|
function Y(e, t) {
|
|
659
660
|
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-Doj0ofRb.js";
|
|
2
2
|
export { e as cli };
|