typerighter 0.7.0 → 0.9.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.
Files changed (37) hide show
  1. package/dist/app-C-qfoH4a.js +373 -0
  2. package/dist/brand-CG1fQshq.js +5 -0
  3. package/dist/{cli-CDd4TNg1.js → cli-mg9QpUrf.js} +159 -132
  4. package/dist/cli.js +1 -1
  5. package/dist/client/app/index.d.ts +12 -3
  6. package/dist/client/app/index.d.ts.map +1 -1
  7. package/dist/client/app/router.d.ts +6 -2
  8. package/dist/client/app/router.d.ts.map +1 -1
  9. package/dist/client/theme-default.js +541 -417
  10. package/dist/client.js +1 -1
  11. package/dist/es-CG8rP6j5.js +22524 -0
  12. package/dist/index.js +2 -2
  13. package/dist/{init-Bfnl0t1B.js → init-BSgCv7vy.js} +664 -654
  14. package/dist/node/build/index.d.ts.map +1 -1
  15. package/dist/node/build/prerender.d.ts +2 -0
  16. package/dist/node/build/prerender.d.ts.map +1 -1
  17. package/dist/node/plugin/vite/index.d.ts.map +1 -1
  18. package/dist/shared/utils/field.d.ts +2 -0
  19. package/dist/shared/utils/field.d.ts.map +1 -0
  20. package/dist/shared/utils/index.d.ts +1 -0
  21. package/dist/shared/utils/index.d.ts.map +1 -1
  22. package/dist/shared/utils/url.d.ts +5 -0
  23. package/dist/shared/utils/url.d.ts.map +1 -1
  24. package/dist/shared-BIdsxcZ2.js +265 -0
  25. package/dist/shared.js +2 -0
  26. package/dist/typerighter.css +1 -1
  27. package/dist/vite-8CV23ALg.js +10704 -0
  28. package/dist/vite.js +1 -1
  29. package/package.json +7 -3
  30. package/dist/app-Bf0aLzaG.js +0 -370
  31. package/dist/brand-BfamszbH.js +0 -12
  32. package/dist/client/app/composables/useUrl.d.ts +0 -6
  33. package/dist/client/app/composables/useUrl.d.ts.map +0 -1
  34. package/dist/constants-DJbUAb1-.js +0 -32189
  35. package/dist/es-ClqUVRJn.js +0 -705
  36. package/dist/shared-CpPZZ8IH.js +0 -196
  37. package/dist/vite-DnP-_NzR.js +0 -326
@@ -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
+ r.hash ? z(r.hash) : window.scrollTo(0, 0);
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 };
@@ -0,0 +1,5 @@
1
+ //#region src/shared/brand.ts
2
+ var e = "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", t = "M30 30h70v16h-27v52h-16v-52h-27z", n = "m155 98-30-33h20v-35h20v35h20z", r = "0 0 208 128", i = "#a0522d", a = `<svg fill='none' viewBox='${r}' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='${e}' fill-rule='evenodd' fill='${i}'/><path d='${t}' fill='${i}'/><path d='${n}' fill='${i}'/></svg>`;
3
+ `${encodeURIComponent(a)}`;
4
+ //#endregion
5
+ export { r as a, t as i, e as n, i as r, n as t };