typerighter 0.5.0 → 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.
Potentially problematic release.
This version of typerighter might be problematic. Click here for more details.
- package/dist/app-BZKg-fe3.js +364 -0
- package/dist/brand-BfamszbH.js +12 -0
- package/dist/{cli-9LGeV7cc.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 +590 -441
- package/dist/client.js +1 -1
- package/dist/{constants-Bo603IxE.js → constants-Dq357AVO.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/{init-a4nECqEz.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-CmL-6h9U.js → shared-BoWAaUci.js} +35 -46
- package/dist/typerighter.css +1 -1
- package/dist/{vite-DaD9YRkN.js → vite-BrwFwz0T.js} +36 -35
- package/dist/vite.js +1 -1
- package/package.json +3 -3
- package/dist/app-Bw90hv7G.js +0 -266
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { i as e, n as t, o as n, r, s as i, t as a } from "./constants-
|
|
2
|
-
import {
|
|
1
|
+
import { i as e, n as t, o as n, r, s as i, t as a } from "./constants-Dq357AVO.js";
|
|
2
|
+
import { C as o, S as s, a as c, b as l, g as u, h as d, i as f, o as p, s as m, u as h, w as g } from "./shared-BoWAaUci.js";
|
|
3
|
+
import { o as _, r as v, s as y } from "./brand-BfamszbH.js";
|
|
3
4
|
import { t as b } from "./es-ClqUVRJn.js";
|
|
4
5
|
import { resolve as x } from "node:path";
|
|
5
6
|
import S from "picocolors";
|
|
@@ -13,7 +14,7 @@ async function D(e, t, n) {
|
|
|
13
14
|
path: n,
|
|
14
15
|
relativePath: n,
|
|
15
16
|
cleanUrls: !0
|
|
16
|
-
}, i = await e.md.renderAsync(t.content, r), a =
|
|
17
|
+
}, i = await e.md.renderAsync(t.content, r), a = d(n) === s, o = r.title || (a ? p(n, (await e.getConfig()).siteTitle) : m(t.header, n)), c = {
|
|
17
18
|
schema: t.schema,
|
|
18
19
|
frontmatter: t.header,
|
|
19
20
|
headings: r.headers ?? [],
|
|
@@ -23,12 +24,12 @@ async function D(e, t, n) {
|
|
|
23
24
|
return {
|
|
24
25
|
vueSrc: [
|
|
25
26
|
"<script>",
|
|
26
|
-
`export const __pageData = JSON.parse(${JSON.stringify(JSON.stringify(
|
|
27
|
+
`export const __pageData = JSON.parse(${JSON.stringify(JSON.stringify(c))})`,
|
|
27
28
|
`export default { name: ${JSON.stringify(n)} }`,
|
|
28
29
|
"<\/script>",
|
|
29
30
|
`<template><div class="typedown-content">\n${O(i)}\n</div></template>`
|
|
30
31
|
].join("\n"),
|
|
31
|
-
pageData:
|
|
32
|
+
pageData: c
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
function O(e) {
|
|
@@ -41,8 +42,8 @@ var k = /<h(\d*).*?>(.*?<a.*? href="#.*?".*?>.*?<\/a>)<\/h\1>/gi, A = /(.*)<a.*?
|
|
|
41
42
|
pageDocIds = /* @__PURE__ */ new Map();
|
|
42
43
|
constructor() {
|
|
43
44
|
this.index = new b({
|
|
44
|
-
fields:
|
|
45
|
-
storeFields:
|
|
45
|
+
fields: o,
|
|
46
|
+
storeFields: g
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
addAll(e) {
|
|
@@ -80,13 +81,13 @@ function* M(e) {
|
|
|
80
81
|
t.shift();
|
|
81
82
|
let n = [];
|
|
82
83
|
for (let e = 0; e < t.length; e += 3) {
|
|
83
|
-
let r = Number.parseInt(t[e]) - 1, i = t[e + 1], a = A.exec(i), o =
|
|
84
|
+
let r = Number.parseInt(t[e]) - 1, i = t[e + 1], a = A.exec(i), o = y(a?.[1] ?? "").trim(), s = a?.[2] ?? "", c = t[e + 2];
|
|
84
85
|
if (!o || !c) continue;
|
|
85
86
|
let l = n.slice(0, r);
|
|
86
87
|
l[r] = o, yield {
|
|
87
88
|
anchor: s,
|
|
88
89
|
titles: l.filter(Boolean),
|
|
89
|
-
text:
|
|
90
|
+
text: y(c)
|
|
90
91
|
}, r === 0 ? (n.length = 0, n[0] = o) : n[r] = o;
|
|
91
92
|
}
|
|
92
93
|
}
|
|
@@ -108,10 +109,11 @@ function F(e) {
|
|
|
108
109
|
let { contentDir: t } = e, n = `/${t}/**/*.{td,md}`, i = JSON.stringify({
|
|
109
110
|
title: e.siteTitle,
|
|
110
111
|
description: e.siteDescription
|
|
111
|
-
}), a = JSON.stringify({
|
|
112
|
+
}), a = c(e.contentTree.children, e.siteTitle), o = JSON.stringify({
|
|
112
113
|
contentTree: e.contentTree,
|
|
113
|
-
schemas: e.schemas ?? {}
|
|
114
|
-
|
|
114
|
+
schemas: e.schemas ?? {},
|
|
115
|
+
directoryListings: a
|
|
116
|
+
});
|
|
115
117
|
return `
|
|
116
118
|
import 'typerighter/style.css';
|
|
117
119
|
import { createTypedownApp } from 'typerighter/client';
|
|
@@ -121,9 +123,8 @@ import theme from 'typerighter/client/theme-default';
|
|
|
121
123
|
import searchIndex from '${r}';
|
|
122
124
|
|
|
123
125
|
const pages = import.meta.glob('${n}');
|
|
124
|
-
const contentExts = ${JSON.stringify(
|
|
125
|
-
|
|
126
|
-
const directoryIndex = ${JSON.stringify(o)};
|
|
126
|
+
const contentExts = ${JSON.stringify(l)};
|
|
127
|
+
const siteData = { ...${o}, searchIndex };
|
|
127
128
|
|
|
128
129
|
function findPage(base) {
|
|
129
130
|
for (const ext of contentExts) {
|
|
@@ -139,16 +140,16 @@ async function loadPageModule(pagePath) {
|
|
|
139
140
|
const loader = findPage(base);
|
|
140
141
|
if (loader) return loader();
|
|
141
142
|
|
|
142
|
-
const dir =
|
|
143
|
+
const dir = siteData.directoryListings[pagePath] || siteData.directoryListings[pagePath + '/'];
|
|
143
144
|
if (dir) return {
|
|
144
|
-
default: { name: 'DirectoryIndex', render() { return h(TdDirectoryIndex
|
|
145
|
+
default: { name: 'DirectoryIndex', render() { return h(TdDirectoryIndex); } },
|
|
145
146
|
__pageData: { frontmatter: {}, headings: [], title: dir.title },
|
|
146
147
|
};
|
|
147
148
|
|
|
148
149
|
return undefined;
|
|
149
150
|
}
|
|
150
151
|
|
|
151
|
-
const { app, searchIndex: searchIndexRef } = await createTypedownApp(loadPageModule, theme.Layout, ${i},
|
|
152
|
+
const { app, searchIndex: searchIndexRef } = await createTypedownApp(loadPageModule, theme.Layout, ${i}, siteData);
|
|
152
153
|
app.mount('#app');
|
|
153
154
|
|
|
154
155
|
// Accept HMR for the search index so it updates without a full reload
|
|
@@ -160,8 +161,8 @@ if (import.meta.hot) {
|
|
|
160
161
|
`;
|
|
161
162
|
}
|
|
162
163
|
function I(r = {}) {
|
|
163
|
-
let o = r.context, s, c = new j(),
|
|
164
|
-
function
|
|
164
|
+
let o = r.context, s, c = new j(), l;
|
|
165
|
+
function d() {
|
|
165
166
|
if (o === void 0) throw Error("typedown plugin not initialized");
|
|
166
167
|
return o.getTdContext();
|
|
167
168
|
}
|
|
@@ -179,12 +180,12 @@ function I(r = {}) {
|
|
|
179
180
|
};
|
|
180
181
|
},
|
|
181
182
|
async buildStart() {
|
|
182
|
-
let e = await (await
|
|
183
|
-
if (e.errorCount
|
|
183
|
+
let e = await (await d()).checkVault();
|
|
184
|
+
if (0 < e.errorCount || 0 < e.warningCount) for (let t of e.diagnostics) {
|
|
184
185
|
let e = `${t.filepath}:${t.line}:${t.column}`, n = t.severity === "error" ? S.red("error") : S.yellow("warn");
|
|
185
186
|
console.error(` ${n} ${e} ${t.message} ${S.dim(`(${t.code})`)}`);
|
|
186
187
|
}
|
|
187
|
-
if (!s && e.errorCount
|
|
188
|
+
if (!s && 0 < e.errorCount) {
|
|
188
189
|
let t = e.diagnostics.filter((e) => e.severity === "error").map((e) => ` ${e.filepath}:${e.line}:${e.column} - ${e.message} (${e.code})`);
|
|
189
190
|
this.error(`Vault check failed with ${e.errorCount} error(s):\n${t.join("\n")}`);
|
|
190
191
|
}
|
|
@@ -194,13 +195,13 @@ function I(r = {}) {
|
|
|
194
195
|
if (e === "@typedown/search-index") return a;
|
|
195
196
|
},
|
|
196
197
|
async load(e) {
|
|
197
|
-
if (e === "\0@typedown/search-index") return
|
|
198
|
+
if (e === "\0@typedown/search-index") return l ||= V(await d(), c), await l, `export default ${JSON.stringify(c.serialize())}`;
|
|
198
199
|
if (e !== "\0@typedown/app") return;
|
|
199
|
-
let t = await
|
|
200
|
+
let t = await d(), [n, r, i] = await Promise.all([
|
|
200
201
|
t.getConfig(),
|
|
201
202
|
t.listFilesGroupedBySchema(),
|
|
202
203
|
t.listSchemas()
|
|
203
|
-
]), a = await Promise.all(i.map(async (e) => [e, (await t.getSchema(e)).properties])), o = Object.fromEntries(a), s =
|
|
204
|
+
]), a = await Promise.all(i.map(async (e) => [e, (await t.getSchema(e)).properties])), o = Object.fromEntries(a), s = f(Object.values(r).flat());
|
|
204
205
|
return F({
|
|
205
206
|
...n,
|
|
206
207
|
contentTree: s,
|
|
@@ -209,7 +210,7 @@ function I(r = {}) {
|
|
|
209
210
|
},
|
|
210
211
|
async configureServer(t) {
|
|
211
212
|
s = t;
|
|
212
|
-
let n = await
|
|
213
|
+
let n = await d();
|
|
213
214
|
n.rpc.onConfigChanged(() => s && z(s)), n.rpc.onContentChanged(({ content: e }) => {
|
|
214
215
|
s && (L(n, e).then((e) => {
|
|
215
216
|
e && s && (c.addPage(e), H(s));
|
|
@@ -225,7 +226,7 @@ function I(r = {}) {
|
|
|
225
226
|
}).catch(() => {}));
|
|
226
227
|
});
|
|
227
228
|
function r() {
|
|
228
|
-
s && (
|
|
229
|
+
s && (l = V(n, c), l.then(() => {
|
|
229
230
|
s && H(s);
|
|
230
231
|
}), B(s));
|
|
231
232
|
}
|
|
@@ -238,8 +239,8 @@ function I(r = {}) {
|
|
|
238
239
|
<head>
|
|
239
240
|
<meta charset="UTF-8">
|
|
240
241
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
241
|
-
<title>${
|
|
242
|
-
<link rel="icon" type="image/svg+xml" href="${
|
|
242
|
+
<title>${_(t.siteTitle)}</title>
|
|
243
|
+
<link rel="icon" type="image/svg+xml" href="${v}">
|
|
243
244
|
</head>
|
|
244
245
|
<body>
|
|
245
246
|
<div id="app"></div>
|
|
@@ -253,15 +254,15 @@ function I(r = {}) {
|
|
|
253
254
|
},
|
|
254
255
|
async transform(e, t) {
|
|
255
256
|
let n = t.split("?")[0];
|
|
256
|
-
if (!
|
|
257
|
-
let r = await
|
|
257
|
+
if (!u(n)) return;
|
|
258
|
+
let r = await d(), i = (await r.getConfig()).contentDir, a = n.includes(i) ? n.slice(n.indexOf(i) + i.length + 1) : n, { vueSrc: o } = await D(r, await r.getFile(a), a);
|
|
258
259
|
return {
|
|
259
260
|
code: o,
|
|
260
261
|
map: null
|
|
261
262
|
};
|
|
262
263
|
},
|
|
263
264
|
handleHotUpdate({ file: e }) {
|
|
264
|
-
if (
|
|
265
|
+
if (u(e)) return [];
|
|
265
266
|
}
|
|
266
267
|
},
|
|
267
268
|
w({ include: /\.(?:vue|td)$/ }),
|
|
@@ -276,8 +277,8 @@ async function L(e, t) {
|
|
|
276
277
|
cleanUrls: !0
|
|
277
278
|
});
|
|
278
279
|
return {
|
|
279
|
-
id:
|
|
280
|
-
title:
|
|
280
|
+
id: h(t),
|
|
281
|
+
title: m(n.header, t),
|
|
281
282
|
html: r
|
|
282
283
|
};
|
|
283
284
|
} catch {
|
package/dist/vite.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "./vite-
|
|
1
|
+
import { n as e, t } from "./vite-BrwFwz0T.js";
|
|
2
2
|
export { t as generateClientAppEntry, e as typedown };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package",
|
|
3
3
|
"name": "typerighter",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.6.0",
|
|
5
5
|
"description": "Typedown: A typed content framework.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"tailwindcss": "^4.3.3",
|
|
82
82
|
"vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
|
|
83
83
|
"vue": "^3.0.0",
|
|
84
|
-
"@typerighter/rpc-client": "0.
|
|
85
|
-
"@typerighter/rpc-server": "0.
|
|
84
|
+
"@typerighter/rpc-client": "0.6.0",
|
|
85
|
+
"@typerighter/rpc-server": "0.6.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
88
|
"@hdnax/nuclint": "^0.17.4",
|
package/dist/app-Bw90hv7G.js
DELETED
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { computed as e, createApp as t, createElementBlock as n, createElementVNode as r, defineComponent as i, h as a, inject as o, markRaw as s, mergeProps as c, nextTick as l, openBlock as u, provide as d, reactive as f, readonly as p, ref as m, renderSlot as h, shallowRef as g, toDisplayString as _, watch as v, withKeys as y, withModifiers as b } from "vue";
|
|
2
|
-
//#region src/client/theme-default/components/custom/TdFlashcard.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
-
var x = [
|
|
4
|
-
"id",
|
|
5
|
-
"tabindex",
|
|
6
|
-
"aria-pressed",
|
|
7
|
-
"aria-label",
|
|
8
|
-
"onKeydown"
|
|
9
|
-
], ee = { class: "flashcard__face flashcard__face--question" }, S = { class: "flashcard__label" }, C = { class: "flashcard__body" }, w = { class: "flashcard__face flashcard__face--key" }, T = { class: "flashcard__label" }, E = { class: "flashcard__body" }, te = /*@__PURE__*/ i({
|
|
10
|
-
inheritAttrs: !1,
|
|
11
|
-
__name: "TdFlashcard",
|
|
12
|
-
props: {
|
|
13
|
-
id: { default: () => void 0 },
|
|
14
|
-
revealed: {
|
|
15
|
-
type: Boolean,
|
|
16
|
-
default: !1
|
|
17
|
-
},
|
|
18
|
-
disabled: {
|
|
19
|
-
type: Boolean,
|
|
20
|
-
default: !1
|
|
21
|
-
},
|
|
22
|
-
questionLabel: { default: "Question" },
|
|
23
|
-
keyLabel: { default: "Answer" }
|
|
24
|
-
},
|
|
25
|
-
setup(e, { expose: t }) {
|
|
26
|
-
let i = m(e.revealed);
|
|
27
|
-
v(() => e.revealed, () => {
|
|
28
|
-
i.value = e.revealed;
|
|
29
|
-
});
|
|
30
|
-
function a() {
|
|
31
|
-
if (e.disabled) return i.value;
|
|
32
|
-
let t = i.value;
|
|
33
|
-
return i.value = !i.value, t;
|
|
34
|
-
}
|
|
35
|
-
function o() {
|
|
36
|
-
let e = i.value;
|
|
37
|
-
return i.value = !0, e;
|
|
38
|
-
}
|
|
39
|
-
function s() {
|
|
40
|
-
let e = i.value;
|
|
41
|
-
return i.value = !1, e;
|
|
42
|
-
}
|
|
43
|
-
return t({
|
|
44
|
-
flip: a,
|
|
45
|
-
showQuestion: s,
|
|
46
|
-
showKey: o,
|
|
47
|
-
state: p(i)
|
|
48
|
-
}), (t, o) => (u(), n("div", c(t.$attrs, {
|
|
49
|
-
id: e.id,
|
|
50
|
-
class: ["flashcard", {
|
|
51
|
-
"is-revealed": i.value,
|
|
52
|
-
"is-disabled": e.disabled
|
|
53
|
-
}],
|
|
54
|
-
role: "button",
|
|
55
|
-
tabindex: e.disabled ? -1 : 0,
|
|
56
|
-
"aria-pressed": i.value,
|
|
57
|
-
"aria-label": i.value ? e.keyLabel : e.questionLabel,
|
|
58
|
-
onClick: a,
|
|
59
|
-
onKeydown: [y(b(a, ["prevent"]), ["enter"]), y(b(a, ["prevent"]), ["space"])]
|
|
60
|
-
}), [r("div", ee, [r("p", S, _(e.questionLabel), 1), r("div", C, [h(t.$slots, "default")])]), r("div", w, [r("p", T, _(e.keyLabel), 1), r("div", E, [h(t.$slots, "key")])])], 16, x));
|
|
61
|
-
}
|
|
62
|
-
}), D = (e, t) => {
|
|
63
|
-
let n = e.__vccOpts || e;
|
|
64
|
-
for (let [e, r] of t) n[e] = r;
|
|
65
|
-
return n;
|
|
66
|
-
}, O = /*#__PURE__*/ D(te, [["__scopeId", "data-v-120343d9"]]), k = typeof window < "u", A = Symbol("typedown-router"), j = {
|
|
67
|
-
frontmatter: {},
|
|
68
|
-
headings: [],
|
|
69
|
-
title: "Not Found"
|
|
70
|
-
};
|
|
71
|
-
function M(e, t) {
|
|
72
|
-
let n = f({
|
|
73
|
-
path: "/",
|
|
74
|
-
hash: "",
|
|
75
|
-
query: "",
|
|
76
|
-
contentSfc: void 0,
|
|
77
|
-
data: j
|
|
78
|
-
}), r = {
|
|
79
|
-
route: n,
|
|
80
|
-
async go(e, t) {
|
|
81
|
-
e = L(e), await r.onBeforeRouteChange?.(e) !== !1 && ((!k || t?.initialLoad || I(e, t)) && await a(e), o(), await r.onAfterRouteChange?.(e));
|
|
82
|
-
}
|
|
83
|
-
}, i;
|
|
84
|
-
async function a(r) {
|
|
85
|
-
let a = new URL(r, "http://a.com"), c = i = a.pathname;
|
|
86
|
-
try {
|
|
87
|
-
let t = await e(c);
|
|
88
|
-
if (!t) throw Error(`Page not found: ${c}`);
|
|
89
|
-
if (i === c) {
|
|
90
|
-
i = void 0;
|
|
91
|
-
let { default: e, __pageData: r } = t;
|
|
92
|
-
n.path = c, n.contentSfc = s(e), n.data = s(r), o(a), k && l(() => {
|
|
93
|
-
N(a.hash);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
} catch {
|
|
97
|
-
i === c && (i = void 0, n.path = c, n.contentSfc = t ? s(t) : void 0, n.data = j, o(a));
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
function o(e = k ? location : {
|
|
101
|
-
search: "",
|
|
102
|
-
hash: ""
|
|
103
|
-
}) {
|
|
104
|
-
n.query = e.search, n.hash = decodeURIComponent(e.hash);
|
|
105
|
-
}
|
|
106
|
-
return k && (history.state ?? history.replaceState({}, ""), window.addEventListener("click", (e) => {
|
|
107
|
-
if (e.defaultPrevented || !(e.target instanceof Element) || e.button !== 0 || e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
|
|
108
|
-
let t = e.target.closest("a");
|
|
109
|
-
if (!t || t.hasAttribute("download") || t.hasAttribute("target")) return;
|
|
110
|
-
let n = t.getAttribute("href");
|
|
111
|
-
if (n === null) return;
|
|
112
|
-
let { href: i, origin: a, pathname: o } = new URL(n, t.baseURI);
|
|
113
|
-
a === location.origin && !o.match(/\.\w+$/) && (e.preventDefault(), r.go(i));
|
|
114
|
-
}, { capture: !0 }), window.addEventListener("popstate", async (e) => {
|
|
115
|
-
if (e.state == null) return;
|
|
116
|
-
let t = L(location.href);
|
|
117
|
-
await a(t), o(), await r.onAfterRouteChange?.(t);
|
|
118
|
-
}), window.addEventListener("hashchange", (e) => {
|
|
119
|
-
e.preventDefault(), o();
|
|
120
|
-
})), r;
|
|
121
|
-
}
|
|
122
|
-
function N(e) {
|
|
123
|
-
if (!e) return;
|
|
124
|
-
let t;
|
|
125
|
-
try {
|
|
126
|
-
t = document.getElementById(decodeURIComponent(e).slice(1)) ?? void 0;
|
|
127
|
-
} catch {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
t?.scrollIntoView({ block: "start" });
|
|
131
|
-
}
|
|
132
|
-
function P() {
|
|
133
|
-
return F().route;
|
|
134
|
-
}
|
|
135
|
-
function F() {
|
|
136
|
-
let e = o(A);
|
|
137
|
-
if (!e) throw Error("useRouter() called outside of Typedown app");
|
|
138
|
-
return e;
|
|
139
|
-
}
|
|
140
|
-
function I(e, { replace: t = !1 } = {}) {
|
|
141
|
-
let n = L(location.href);
|
|
142
|
-
if (e === n) return N(new URL(e, "http://a.com").hash), !1;
|
|
143
|
-
t ? history.replaceState({}, "", e) : (history.replaceState({ scrollPosition: window.scrollY }, ""), history.pushState({}, "", e));
|
|
144
|
-
let r = new URL(e, location.origin), i = new URL(n, location.origin);
|
|
145
|
-
return r.pathname === i.pathname ? (N(r.hash), !1) : !0;
|
|
146
|
-
}
|
|
147
|
-
function L(e) {
|
|
148
|
-
let t = new URL(e, "http://a.com");
|
|
149
|
-
return t.pathname = t.pathname.replace(/(^|\/)index(\.html)?$/, "$1"), t.pathname + t.search + t.hash;
|
|
150
|
-
}
|
|
151
|
-
//#endregion
|
|
152
|
-
//#region src/client/app/components/Content.ts
|
|
153
|
-
var R = i({
|
|
154
|
-
name: "TypedownContent",
|
|
155
|
-
setup() {
|
|
156
|
-
let e = P();
|
|
157
|
-
return () => e.contentSfc ? a(e.contentSfc) : void 0;
|
|
158
|
-
}
|
|
159
|
-
}), z = "td-theme";
|
|
160
|
-
function B(e) {
|
|
161
|
-
if (typeof document > "u") return;
|
|
162
|
-
let t = e === "system" ? V() : e;
|
|
163
|
-
document.documentElement.classList.toggle("dark", t === "dark");
|
|
164
|
-
}
|
|
165
|
-
function V() {
|
|
166
|
-
return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
167
|
-
}
|
|
168
|
-
var H = m("system"), U = m(V()), W = !1;
|
|
169
|
-
function G() {
|
|
170
|
-
K();
|
|
171
|
-
let t = e(() => H.value === "system" ? U.value : H.value), n = e(() => t.value === "dark");
|
|
172
|
-
function r(e) {
|
|
173
|
-
H.value = e, B(e), typeof localStorage < "u" && localStorage.setItem(z, e);
|
|
174
|
-
}
|
|
175
|
-
function i() {
|
|
176
|
-
r(t.value === "light" ? "dark" : "light");
|
|
177
|
-
}
|
|
178
|
-
return {
|
|
179
|
-
theme: p(H),
|
|
180
|
-
effectiveTheme: t,
|
|
181
|
-
isDark: n,
|
|
182
|
-
setTheme: r,
|
|
183
|
-
toggle: i
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
function K() {
|
|
187
|
-
if (!W) {
|
|
188
|
-
if (W = !0, typeof localStorage < "u") {
|
|
189
|
-
let e = localStorage.getItem(z);
|
|
190
|
-
(e === "light" || e === "dark" || e === "system") && (H.value = e);
|
|
191
|
-
}
|
|
192
|
-
B(H.value), typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
|
|
193
|
-
U.value = V(), H.value === "system" && B("system");
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
//#endregion
|
|
198
|
-
//#region src/client/app/composables/useTdContent.ts
|
|
199
|
-
var q = Symbol("td-content");
|
|
200
|
-
function J(t) {
|
|
201
|
-
let n = G(), r = {
|
|
202
|
-
page: e(() => t.data),
|
|
203
|
-
frontmatter: e(() => t.data.frontmatter),
|
|
204
|
-
title: e(() => t.data.title),
|
|
205
|
-
isDark: e(() => n.isDark.value)
|
|
206
|
-
};
|
|
207
|
-
return d(q, r), r;
|
|
208
|
-
}
|
|
209
|
-
function Y() {
|
|
210
|
-
let e = o(q);
|
|
211
|
-
if (e === void 0) throw Error("useTdContent() called without a parent provideTdContent()");
|
|
212
|
-
return e;
|
|
213
|
-
}
|
|
214
|
-
//#endregion
|
|
215
|
-
//#region src/client/app/index.ts
|
|
216
|
-
var X = Symbol("typedown-site-config"), Z = Symbol("typedown-site-data"), Q = Symbol("typedown-page-loader"), $ = Symbol("typedown-search-index");
|
|
217
|
-
async function ne(e, n, r = {}, o = {}) {
|
|
218
|
-
let s = {
|
|
219
|
-
title: r.title ?? "",
|
|
220
|
-
description: r.description ?? ""
|
|
221
|
-
}, c = {
|
|
222
|
-
contentTree: o.contentTree ?? {
|
|
223
|
-
rootItems: [],
|
|
224
|
-
children: []
|
|
225
|
-
},
|
|
226
|
-
schemas: o.schemas ?? {}
|
|
227
|
-
}, l = M(e), u = t(i({
|
|
228
|
-
name: "TypedownApp",
|
|
229
|
-
setup() {
|
|
230
|
-
return J(l.route), () => a(n);
|
|
231
|
-
}
|
|
232
|
-
}));
|
|
233
|
-
u.provide(A, l), u.provide(X, s), u.provide(Z, c), u.provide(Q, e);
|
|
234
|
-
let d = g(o.searchIndex);
|
|
235
|
-
return u.provide($, d), u.component("TypedownContent", R), u.component("Flashcard", O), typeof window < "u" && await l.go(location.href, {
|
|
236
|
-
replace: !0,
|
|
237
|
-
initialLoad: !0
|
|
238
|
-
}), {
|
|
239
|
-
app: u,
|
|
240
|
-
router: l,
|
|
241
|
-
searchIndex: d
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
function re() {
|
|
245
|
-
return o(Q, void 0);
|
|
246
|
-
}
|
|
247
|
-
function ie() {
|
|
248
|
-
return o($, g(void 0));
|
|
249
|
-
}
|
|
250
|
-
function ae() {
|
|
251
|
-
return o(X, {
|
|
252
|
-
title: "",
|
|
253
|
-
description: ""
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
function oe() {
|
|
257
|
-
return o(Z, {
|
|
258
|
-
contentTree: {
|
|
259
|
-
rootItems: [],
|
|
260
|
-
children: []
|
|
261
|
-
},
|
|
262
|
-
schemas: {}
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
//#endregion
|
|
266
|
-
export { oe as a, R as c, D as d, ae as i, P as l, re as n, Y as o, ie as r, G as s, ne as t, F as u };
|