typerighter 0.56.3 → 0.57.1
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-D-dbbyVD.js +7830 -0
- package/dist/{cli-D-sgJzkz.js → cli-aIilXlJS.js} +5 -5
- package/dist/cli.js +1 -1
- package/dist/client/app/index.d.ts +9 -4
- package/dist/client/app/index.d.ts.map +1 -1
- package/dist/client/theme-default/composables/useCopyCode.d.ts +2 -0
- package/dist/client/theme-default/composables/useCopyCode.d.ts.map +1 -0
- package/dist/client/theme-default/composables/useHotkey.d.ts +13 -0
- package/dist/client/theme-default/composables/useHotkey.d.ts.map +1 -0
- package/dist/client/theme-default/index.d.ts +25 -0
- package/dist/client/theme-default/index.d.ts.map +1 -0
- package/dist/client/theme-default/utils/keys.d.ts +58 -0
- package/dist/client/theme-default/utils/keys.d.ts.map +1 -0
- package/dist/client/theme-default.js +3 -3892
- package/dist/client.js +3 -3
- package/dist/index.js +2 -2
- package/dist/{init-CRbtpr2v.js → init-Bvm3vDph.js} +126 -109
- package/dist/node/lib/codegen/app-entry.d.ts.map +1 -1
- package/dist/{page-BreMA8X5.js → page-BbSO0VG8.js} +2 -3
- package/dist/prerenderWorker.js +1 -1
- package/dist/typerighter.css +1 -1
- package/dist/useSidebarConfig-0kMemgUS.js +94 -0
- package/dist/{vite-BeHH_un1.js → vite-ltcrEmat.js} +377 -436
- package/dist/vite.js +1 -1
- package/package.json +3 -3
- package/dist/app-Dm08HnZG.js +0 -3880
- package/dist/useSidebarConfig-DUcdHn0W.js +0 -33
- package/dist/useTheme-BF8TNao6.js +0 -65
package/dist/client.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export {
|
|
1
|
+
import { l as e } from "./useSidebarConfig-0kMemgUS.js";
|
|
2
|
+
import { C as t, T as n, i as r, n as i, r as a, t as o, w as s } from "./app-D-dbbyVD.js";
|
|
3
|
+
export { t as Content, o as createTypedownApp, s as useRoute, n as useRouter, i as useSiteConfig, a as useSiteData, r as useTdContent, e as useTheme };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./vite-
|
|
2
|
-
import { t as s } from "./cli-
|
|
1
|
+
import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./vite-ltcrEmat.js";
|
|
2
|
+
import { t as s } from "./cli-aIilXlJS.js";
|
|
3
3
|
export { n as PAGES_ID, i as PAGE_DATA_EVENT, t as SEARCH_INDEX_ID, e as SITE_DATA_ID, r as THEME_ID, a as buildSite, s as cli, o as typedown };
|
|
@@ -66,7 +66,7 @@ var h = (() => {
|
|
|
66
66
|
limit: Infinity,
|
|
67
67
|
ellipsis: "",
|
|
68
68
|
ellipsisWidth: 0
|
|
69
|
-
}, w = (e, t = {}) => re(e, C, t).width, T = "\x1B", E = "", D = 39, O = "\x07", k = "[", A = "]",
|
|
69
|
+
}, w = (e, t = {}) => re(e, C, t).width, T = "\x1B", E = "", D = 39, O = "\x07", k = "[", A = "]", ie = "m", j = `${A}8;;`, ae = RegExp(`(?:\\${k}(?<code>\\d+)m|\\${j}(?<uri>.*)${O})`, "y"), oe = (e) => {
|
|
70
70
|
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
71
71
|
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
72
72
|
if (e === 1 || e === 2) return 22;
|
|
@@ -76,18 +76,18 @@ var h = (() => {
|
|
|
76
76
|
if (e === 8) return 28;
|
|
77
77
|
if (e === 9) return 29;
|
|
78
78
|
if (e === 0) return 0;
|
|
79
|
-
},
|
|
79
|
+
}, se = (e) => `${T}${k}${e}${ie}`, M = (e) => `${T}${j}${e}${O}`, N = (e, t, n) => {
|
|
80
80
|
let r = t[Symbol.iterator](), i = !1, a = !1, o = e.at(-1), s = o === void 0 ? 0 : w(o), c = r.next(), l = r.next(), u = 0;
|
|
81
81
|
for (; !c.done;) {
|
|
82
82
|
let o = c.value, d = w(o);
|
|
83
|
-
s + d <= n ? e[e.length - 1] += o : (e.push(o), s = 0), (o === T || o === E) && (i = !0, a = t.startsWith(
|
|
83
|
+
s + d <= n ? e[e.length - 1] += o : (e.push(o), s = 0), (o === T || o === E) && (i = !0, a = t.startsWith(j, u + 1)), i ? a ? o === O && (i = !1, a = !1) : o === ie && (i = !1) : (s += d, s === n && !l.done && (e.push(""), s = 0)), c = l, l = r.next(), u += o.length;
|
|
84
84
|
}
|
|
85
85
|
o = e.at(-1), !s && o !== void 0 && o.length && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
86
|
-
},
|
|
86
|
+
}, ce = (e) => {
|
|
87
87
|
let t = e.split(" "), n = t.length;
|
|
88
88
|
for (; n && !w(t[n - 1]);) n--;
|
|
89
89
|
return n === t.length ? e : t.slice(0, n).join(" ") + t.slice(n).join("");
|
|
90
|
-
},
|
|
90
|
+
}, le = (e, t, n = {}) => {
|
|
91
91
|
if (n.trim !== !1 && e.trim() === "") return "";
|
|
92
92
|
let r = "", i, a, o = e.split(" "), s = [""], c = 0;
|
|
93
93
|
for (let e = 0; e < o.length; e++) {
|
|
@@ -100,45 +100,45 @@ var h = (() => {
|
|
|
100
100
|
let i = w(r);
|
|
101
101
|
if (n.hard && i > t) {
|
|
102
102
|
let e = t - c, n = 1 + Math.floor((i - e - 1) / t);
|
|
103
|
-
Math.floor((i - 1) / t) < n && s.push(""),
|
|
103
|
+
Math.floor((i - 1) / t) < n && s.push(""), N(s, r, t), c = w(s.at(-1) ?? "");
|
|
104
104
|
} else {
|
|
105
105
|
if (c + i > t && c && i) {
|
|
106
106
|
if (n.wordWrap === !1 && c < t) {
|
|
107
|
-
|
|
107
|
+
N(s, r, t), c = w(s.at(-1) ?? "");
|
|
108
108
|
continue;
|
|
109
109
|
}
|
|
110
110
|
s.push(""), c = 0;
|
|
111
111
|
}
|
|
112
|
-
c + i > t && n.wordWrap === !1 ? (
|
|
112
|
+
c + i > t && n.wordWrap === !1 ? (N(s, r, t), c = w(s.at(-1) ?? "")) : (s[s.length - 1] += r, c += i);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
n.trim !== !1 && (s = s.map((e) =>
|
|
115
|
+
n.trim !== !1 && (s = s.map((e) => ce(e)));
|
|
116
116
|
let l = s.join("\n"), u = !1;
|
|
117
117
|
for (let e = 0; e < l.length; e++) {
|
|
118
118
|
let t = l[e];
|
|
119
119
|
if (r += t, u) u = !1;
|
|
120
120
|
else if (u = t >= "\ud800" && t <= "\udbff", u) continue;
|
|
121
121
|
if (t === T || t === E) {
|
|
122
|
-
|
|
123
|
-
let t =
|
|
122
|
+
ae.lastIndex = e + 1;
|
|
123
|
+
let t = ae.exec(l)?.groups;
|
|
124
124
|
if (t?.code !== void 0) {
|
|
125
125
|
let e = Number.parseFloat(t.code);
|
|
126
126
|
i = e === D ? void 0 : e;
|
|
127
127
|
} else t?.uri !== void 0 && (a = t.uri.length === 0 ? void 0 : t.uri);
|
|
128
128
|
}
|
|
129
129
|
if (l[e + 1] === "\n") {
|
|
130
|
-
a && (r +=
|
|
131
|
-
let e = i ?
|
|
132
|
-
i && e && (r +=
|
|
133
|
-
} else t === "\n" && (i &&
|
|
130
|
+
a && (r += M(""));
|
|
131
|
+
let e = i ? oe(i) : void 0;
|
|
132
|
+
i && e && (r += se(e));
|
|
133
|
+
} else t === "\n" && (i && oe(i) && (r += se(i)), a && (r += M(a)));
|
|
134
134
|
}
|
|
135
135
|
return r;
|
|
136
|
-
},
|
|
137
|
-
function
|
|
138
|
-
return String(e).normalize().split(
|
|
136
|
+
}, ue = /\r?\n/;
|
|
137
|
+
function P(e, t, n) {
|
|
138
|
+
return String(e).normalize().split(ue).map((e) => le(e, t, n)).join("\n");
|
|
139
139
|
}
|
|
140
140
|
// ../../node_modules/.pnpm/@clack+core@1.4.3/node_modules/@clack/core/dist/index.mjs
|
|
141
|
-
var
|
|
141
|
+
var F = (/* @__PURE__ */ e(((e, t) => {
|
|
142
142
|
var n = "\x1B", r = `${n}[`, i = "\x07", a = {
|
|
143
143
|
to(e, t) {
|
|
144
144
|
return t ? `${r}${t + 1};${e + 1}H` : `${r}${e + 1}G`;
|
|
@@ -181,12 +181,12 @@ var L = (/* @__PURE__ */ e(((e, t) => {
|
|
|
181
181
|
beep: i
|
|
182
182
|
};
|
|
183
183
|
})))();
|
|
184
|
-
function
|
|
184
|
+
function I(e, t, n) {
|
|
185
185
|
if (!n.some((e) => !e.disabled)) return e;
|
|
186
186
|
let r = e + t, i = Math.max(n.length - 1, 0), a = r < 0 ? i : r > i ? 0 : r;
|
|
187
|
-
return n[a]?.disabled ?
|
|
187
|
+
return n[a]?.disabled ? I(a, t < 0 ? -1 : 1, n) : a;
|
|
188
188
|
}
|
|
189
|
-
var
|
|
189
|
+
var L = {
|
|
190
190
|
actions: /* @__PURE__ */ new Set([
|
|
191
191
|
"up",
|
|
192
192
|
"down",
|
|
@@ -233,12 +233,12 @@ var z = {
|
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
};
|
|
236
|
-
function
|
|
237
|
-
if (typeof e == "string") return
|
|
238
|
-
for (let n of e) if (n !== void 0 &&
|
|
236
|
+
function R(e, t) {
|
|
237
|
+
if (typeof e == "string") return L.aliases.get(e) === t;
|
|
238
|
+
for (let n of e) if (n !== void 0 && R(n, t)) return !0;
|
|
239
239
|
return !1;
|
|
240
240
|
}
|
|
241
|
-
function
|
|
241
|
+
function de(e, t) {
|
|
242
242
|
if (e === t) return;
|
|
243
243
|
let n = e.split("\n"), r = t.split("\n"), i = Math.max(n.length, r.length), a = [];
|
|
244
244
|
for (let e = 0; e < i; e++) n[e] !== r[e] && a.push(e);
|
|
@@ -250,17 +250,17 @@ function le(e, t) {
|
|
|
250
250
|
};
|
|
251
251
|
}
|
|
252
252
|
globalThis.process.platform.startsWith("win");
|
|
253
|
-
var
|
|
254
|
-
function
|
|
255
|
-
return e ===
|
|
253
|
+
var z = Symbol("clack:cancel");
|
|
254
|
+
function B(e) {
|
|
255
|
+
return e === z;
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function V(e, t) {
|
|
258
258
|
let n = e;
|
|
259
259
|
n.isTTY && n.setRawMode(t);
|
|
260
260
|
}
|
|
261
|
-
var
|
|
262
|
-
function
|
|
263
|
-
return
|
|
261
|
+
var H = (e) => "columns" in e && typeof e.columns == "number" ? e.columns : 80, U = (e) => "rows" in e && typeof e.rows == "number" ? e.rows : 20;
|
|
262
|
+
function W(e, t, n, r = n, i = n, a) {
|
|
263
|
+
return P(t, H(e ?? p) - n.length, {
|
|
264
264
|
hard: !0,
|
|
265
265
|
trim: !1
|
|
266
266
|
}).split("\n").map((e, t, o) => {
|
|
@@ -268,7 +268,7 @@ function K(e, t, n, r = n, i = n, a) {
|
|
|
268
268
|
return t === 0 ? `${r}${s}` : t === o.length - 1 ? `${i}${s}` : `${n}${s}`;
|
|
269
269
|
}).join("\n");
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function fe(e, t) {
|
|
272
272
|
if ("~standard" in e) {
|
|
273
273
|
let n = e["~standard"].validate(t);
|
|
274
274
|
if (n instanceof Promise) throw TypeError("Schema validation must be synchronous. Update `validate()` and remove any asynchronous logic.");
|
|
@@ -276,7 +276,7 @@ function ue(e, t) {
|
|
|
276
276
|
}
|
|
277
277
|
return e(t);
|
|
278
278
|
}
|
|
279
|
-
var
|
|
279
|
+
var G = class {
|
|
280
280
|
input;
|
|
281
281
|
output;
|
|
282
282
|
_abortSignal;
|
|
@@ -319,7 +319,7 @@ var de = class {
|
|
|
319
319
|
prompt() {
|
|
320
320
|
return new Promise((e) => {
|
|
321
321
|
if (this._abortSignal) {
|
|
322
|
-
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(
|
|
322
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z);
|
|
323
323
|
this._abortSignal.addEventListener("abort", () => {
|
|
324
324
|
this.state = "cancel", this.close();
|
|
325
325
|
}, { once: !0 });
|
|
@@ -330,10 +330,10 @@ var de = class {
|
|
|
330
330
|
prompt: "",
|
|
331
331
|
escapeCodeTimeout: 50,
|
|
332
332
|
terminal: !0
|
|
333
|
-
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress),
|
|
334
|
-
this.output.write(
|
|
333
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), V(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
334
|
+
this.output.write(F.cursor.show), this.output.off("resize", this.render), V(this.input, !1), e(this.value);
|
|
335
335
|
}), this.once("cancel", () => {
|
|
336
|
-
this.output.write(
|
|
336
|
+
this.output.write(F.cursor.show), this.output.off("resize", this.render), V(this.input, !1), e(z);
|
|
337
337
|
});
|
|
338
338
|
});
|
|
339
339
|
}
|
|
@@ -359,38 +359,38 @@ var de = class {
|
|
|
359
359
|
if (this._track && t.name !== "return" && (t.name && this._isActionKey(e, t) && this.rl?.write(null, {
|
|
360
360
|
ctrl: !0,
|
|
361
361
|
name: "h"
|
|
362
|
-
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), t?.name && (!this._track &&
|
|
362
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), t?.name && (!this._track && L.aliases.has(t.name) && this.emit("cursor", L.aliases.get(t.name)), L.actions.has(t.name) && this.emit("cursor", t.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e, t), t?.name === "return" && this._shouldSubmit(e, t)) {
|
|
363
363
|
if (this.opts.validate) {
|
|
364
|
-
let e =
|
|
364
|
+
let e = fe(this.opts.validate, this.value);
|
|
365
365
|
e && (this.error = e instanceof Error ? e.message : e, this.state = "error", this.rl?.write(this.userInput));
|
|
366
366
|
}
|
|
367
367
|
this.state !== "error" && (this.state = "submit");
|
|
368
368
|
}
|
|
369
|
-
|
|
369
|
+
R([
|
|
370
370
|
e,
|
|
371
371
|
t?.name,
|
|
372
372
|
t?.sequence
|
|
373
373
|
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
374
374
|
}
|
|
375
375
|
close() {
|
|
376
|
-
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write("\n"),
|
|
376
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write("\n"), V(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
377
377
|
}
|
|
378
378
|
restoreCursor() {
|
|
379
|
-
let e =
|
|
379
|
+
let e = P(this._prevFrame, process.stdout.columns, {
|
|
380
380
|
hard: !0,
|
|
381
381
|
trim: !1
|
|
382
382
|
}).split("\n").length - 1;
|
|
383
|
-
this.output.write(
|
|
383
|
+
this.output.write(F.cursor.move(-999, e * -1));
|
|
384
384
|
}
|
|
385
385
|
render() {
|
|
386
|
-
let e =
|
|
386
|
+
let e = P(this._render(this) ?? "", process.stdout.columns, {
|
|
387
387
|
hard: !0,
|
|
388
388
|
trim: !1
|
|
389
389
|
});
|
|
390
390
|
if (e !== this._prevFrame) {
|
|
391
|
-
if (this.state === "initial") this.output.write(
|
|
391
|
+
if (this.state === "initial") this.output.write(F.cursor.hide);
|
|
392
392
|
else {
|
|
393
|
-
let t =
|
|
393
|
+
let t = de(this._prevFrame, e), n = U(this.output);
|
|
394
394
|
if (this.restoreCursor(), t) {
|
|
395
395
|
let r = Math.max(0, t.numLinesAfter - n), i = Math.max(0, t.numLinesBefore - n), a = t.lines.find((e) => e >= r);
|
|
396
396
|
if (a === void 0) {
|
|
@@ -398,29 +398,29 @@ var de = class {
|
|
|
398
398
|
return;
|
|
399
399
|
}
|
|
400
400
|
if (t.lines.length === 1) {
|
|
401
|
-
this.output.write(
|
|
401
|
+
this.output.write(F.cursor.move(0, a - i)), this.output.write(F.erase.lines(1));
|
|
402
402
|
let t = e.split("\n");
|
|
403
|
-
this.output.write(t[a]), this._prevFrame = e, this.output.write(
|
|
403
|
+
this.output.write(t[a]), this._prevFrame = e, this.output.write(F.cursor.move(0, t.length - a - 1));
|
|
404
404
|
return;
|
|
405
405
|
}
|
|
406
406
|
if (t.lines.length > 1) {
|
|
407
407
|
if (r < i) a = r;
|
|
408
408
|
else {
|
|
409
409
|
let e = a - i;
|
|
410
|
-
e > 0 && this.output.write(
|
|
410
|
+
e > 0 && this.output.write(F.cursor.move(0, e));
|
|
411
411
|
}
|
|
412
|
-
this.output.write(
|
|
412
|
+
this.output.write(F.erase.down());
|
|
413
413
|
let t = e.split("\n").slice(a);
|
|
414
414
|
this.output.write(t.join("\n")), this._prevFrame = e;
|
|
415
415
|
return;
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
this.output.write(
|
|
418
|
+
this.output.write(F.erase.down());
|
|
419
419
|
}
|
|
420
420
|
this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
|
-
},
|
|
423
|
+
}, pe = class extends G {
|
|
424
424
|
options;
|
|
425
425
|
cursor = 0;
|
|
426
426
|
get _selectedValue() {
|
|
@@ -433,19 +433,19 @@ var de = class {
|
|
|
433
433
|
constructor(e) {
|
|
434
434
|
super(e, !1), this.options = e.options;
|
|
435
435
|
let t = this.options.findIndex(({ value: t }) => t === e.initialValue), n = t === -1 ? 0 : t;
|
|
436
|
-
this.cursor = this.options[n]?.disabled ?
|
|
436
|
+
this.cursor = this.options[n]?.disabled ? I(n, 1, this.options) : n, this.changeValue(), this.on("cursor", (e) => {
|
|
437
437
|
switch (e) {
|
|
438
438
|
case "left":
|
|
439
439
|
case "up":
|
|
440
|
-
this.cursor =
|
|
440
|
+
this.cursor = I(this.cursor, -1, this.options);
|
|
441
441
|
break;
|
|
442
442
|
case "down":
|
|
443
|
-
case "right": this.cursor =
|
|
443
|
+
case "right": this.cursor = I(this.cursor, 1, this.options);
|
|
444
444
|
}
|
|
445
445
|
this.changeValue();
|
|
446
446
|
});
|
|
447
447
|
}
|
|
448
|
-
},
|
|
448
|
+
}, me = class extends G {
|
|
449
449
|
get userInputWithCursor() {
|
|
450
450
|
if (this.state === "submit") return this.userInput;
|
|
451
451
|
let e = this.userInput;
|
|
@@ -468,16 +468,16 @@ var de = class {
|
|
|
468
468
|
}
|
|
469
469
|
};
|
|
470
470
|
// ../../node_modules/.pnpm/@clack+prompts@1.7.0/node_modules/@clack/prompts/dist/index.mjs
|
|
471
|
-
function
|
|
471
|
+
function he() {
|
|
472
472
|
return d.platform === "win32" ? !!d.env.CI || !!d.env.WT_SESSION || !!d.env.TERMINUS_SUBLIME || d.env.ConEmuTask === "{cmd::Cmder}" || d.env.TERM_PROGRAM === "Terminus-Sublime" || d.env.TERM_PROGRAM === "vscode" || d.env.TERM === "xterm-256color" || d.env.TERM === "alacritty" || d.env.TERMINAL_EMULATOR === "JetBrains-JediTerm" : d.env.TERM !== "linux";
|
|
473
473
|
}
|
|
474
|
-
var
|
|
474
|
+
var ge = he(), K = (e, t) => ge ? e : t, _e = K("◆", "*"), ve = K("■", "x"), ye = K("▲", "x"), q = K("◇", "o"), be = K("┌", "T"), J = K("│", "|"), Y = K("└", "—"), xe = K("●", ">"), Se = K("○", " "), Ce = K("●", "•"), we = K("◆", "*"), Te = K("▲", "!"), Ee = K("■", "x"), De = (e) => {
|
|
475
475
|
switch (e) {
|
|
476
476
|
case "initial":
|
|
477
|
-
case "active": return u("cyan",
|
|
478
|
-
case "cancel": return u("red",
|
|
479
|
-
case "error": return u("yellow",
|
|
480
|
-
case "submit": return u("green",
|
|
477
|
+
case "active": return u("cyan", _e);
|
|
478
|
+
case "cancel": return u("red", ve);
|
|
479
|
+
case "error": return u("yellow", ye);
|
|
480
|
+
case "submit": return u("green", q);
|
|
481
481
|
}
|
|
482
482
|
}, Oe = (e) => {
|
|
483
483
|
switch (e) {
|
|
@@ -507,13 +507,13 @@ var Ae = (e, t, n, r, i, a = !1) => {
|
|
|
507
507
|
removals: s
|
|
508
508
|
};
|
|
509
509
|
}, je = ({ cursor: e, options: t, style: n, output: r = process.stdout, maxItems: i = Infinity, columnPadding: a = 0, rowPadding: o = 4 }) => {
|
|
510
|
-
let s =
|
|
510
|
+
let s = H(r) - a, c = U(r), l = u("dim", "..."), d = Math.max(c - o, 0), f = Math.max(Math.min(i, d), 5), p = 0;
|
|
511
511
|
e >= f - 3 && (p = Math.max(Math.min(e - f + 3, t.length - f), 0));
|
|
512
512
|
let m = f < t.length && p > 0, h = f < t.length && p + f < t.length, g = Math.min(p + f, t.length), _ = [], v = 0;
|
|
513
513
|
m && v++, h && v++;
|
|
514
514
|
let y = p + +!!m, b = g - +!!h;
|
|
515
515
|
for (let r = y; r < b; r++) {
|
|
516
|
-
let i = t[r], a =
|
|
516
|
+
let i = t[r], a = P(i ? n(i, r === e) : "", s, {
|
|
517
517
|
hard: !0,
|
|
518
518
|
trim: !1
|
|
519
519
|
}).split("\n");
|
|
@@ -531,7 +531,7 @@ var Ae = (e, t, n, r, i, a = !1) => {
|
|
|
531
531
|
`${u("dim", "↑/↓")}`, `${u("dim", "Space:")}`, `${u("dim", "Enter:")}`;
|
|
532
532
|
var X = {
|
|
533
533
|
message: (e = [], { symbol: t = u("gray", J), secondarySymbol: n = u("gray", J), output: r = process.stdout, spacing: i = 1, withGuide: a } = {}) => {
|
|
534
|
-
let o = [], s = a ??
|
|
534
|
+
let o = [], s = a ?? L.withGuide, c = s ? n : "", l = s ? `${t} ` : "", d = s ? `${n} ` : "";
|
|
535
535
|
for (let e = 0; e < i; e++) o.push(c);
|
|
536
536
|
let f = Array.isArray(e) ? e : e.split("\n");
|
|
537
537
|
if (f.length > 0) {
|
|
@@ -557,7 +557,7 @@ var X = {
|
|
|
557
557
|
step: (e, t) => {
|
|
558
558
|
X.message(e, {
|
|
559
559
|
...t,
|
|
560
|
-
symbol: u("green",
|
|
560
|
+
symbol: u("green", q)
|
|
561
561
|
});
|
|
562
562
|
},
|
|
563
563
|
warn: (e, t) => {
|
|
@@ -576,16 +576,16 @@ var X = {
|
|
|
576
576
|
});
|
|
577
577
|
}
|
|
578
578
|
}, Me = (e = "", t) => {
|
|
579
|
-
let n = t?.output ?? process.stdout, r = t?.withGuide ??
|
|
579
|
+
let n = t?.output ?? process.stdout, r = t?.withGuide ?? L.withGuide ? `${u("gray", Y)} ` : "";
|
|
580
580
|
n.write(`${r}${u("red", e)}
|
|
581
581
|
|
|
582
582
|
`);
|
|
583
583
|
}, Ne = (e = "", t) => {
|
|
584
|
-
let n = t?.output ?? process.stdout, r = t?.withGuide ??
|
|
584
|
+
let n = t?.output ?? process.stdout, r = t?.withGuide ?? L.withGuide ? `${u("gray", be)} ` : "";
|
|
585
585
|
n.write(`${r}${e}
|
|
586
586
|
`);
|
|
587
587
|
}, Pe = (e = "", t) => {
|
|
588
|
-
let n = t?.output ?? process.stdout, r = t?.withGuide ??
|
|
588
|
+
let n = t?.output ?? process.stdout, r = t?.withGuide ?? L.withGuide ? `${u("gray", J)}
|
|
589
589
|
${u("gray", Y)} ` : "";
|
|
590
590
|
n.write(`${r}${e}
|
|
591
591
|
|
|
@@ -602,24 +602,24 @@ ${u("gray", Y)} ` : "";
|
|
|
602
602
|
default: return `${u("dim", Se)} ${Z(n, (e) => u("dim", e))}`;
|
|
603
603
|
}
|
|
604
604
|
}, n = e.showInstructions ?? !0;
|
|
605
|
-
return new
|
|
605
|
+
return new pe({
|
|
606
606
|
options: e.options,
|
|
607
607
|
signal: e.signal,
|
|
608
608
|
input: e.input,
|
|
609
609
|
output: e.output,
|
|
610
610
|
initialValue: e.initialValue,
|
|
611
611
|
render() {
|
|
612
|
-
let r = e.withGuide ??
|
|
612
|
+
let r = e.withGuide ?? L.withGuide, i = `${De(this.state)} `, a = `${Oe(this.state)} `, o = W(e.output, e.message, a, i), s = `${r ? `${u("gray", J)}
|
|
613
613
|
` : ""}${o}
|
|
614
614
|
`;
|
|
615
615
|
switch (this.state) {
|
|
616
616
|
case "submit": {
|
|
617
617
|
let n = r ? `${u("gray", J)} ` : "";
|
|
618
|
-
return `${s}${
|
|
618
|
+
return `${s}${W(e.output, t(this.options[this.cursor], "selected"), n)}`;
|
|
619
619
|
}
|
|
620
620
|
case "cancel": {
|
|
621
621
|
let n = r ? `${u("gray", J)} ` : "";
|
|
622
|
-
return `${s}${
|
|
622
|
+
return `${s}${W(e.output, t(this.options[this.cursor], "cancelled"), n)}${r ? `
|
|
623
623
|
${u("gray", J)}` : ""}`;
|
|
624
624
|
}
|
|
625
625
|
default: {
|
|
@@ -642,7 +642,7 @@ ${c}
|
|
|
642
642
|
}).prompt();
|
|
643
643
|
};
|
|
644
644
|
`${u("gray", J)}`;
|
|
645
|
-
var Le = (e) => new
|
|
645
|
+
var Le = (e) => new me({
|
|
646
646
|
validate: e.validate,
|
|
647
647
|
placeholder: e.placeholder,
|
|
648
648
|
defaultValue: e.defaultValue,
|
|
@@ -651,7 +651,7 @@ var Le = (e) => new pe({
|
|
|
651
651
|
signal: e.signal,
|
|
652
652
|
input: e.input,
|
|
653
653
|
render() {
|
|
654
|
-
let t = e?.withGuide ??
|
|
654
|
+
let t = e?.withGuide ?? L.withGuide, n = `${`${t ? `${u("gray", J)}
|
|
655
655
|
` : ""}${De(this.state)} `}${e.message}
|
|
656
656
|
`, r = e.placeholder && e.placeholder.length > 0 ? u("inverse", e.placeholder[0]) + u("dim", e.placeholder.slice(1)) : u(["inverse", "hidden"], "_"), i = this.userInput ? this.userInputWithCursor : r, a = this.value ?? "";
|
|
657
657
|
switch (this.state) {
|
|
@@ -679,8 +679,8 @@ ${t ? u("cyan", Y) : ""}
|
|
|
679
679
|
}).prompt();
|
|
680
680
|
// src/node/cli/init.ts
|
|
681
681
|
async function Re(e, t = {}) {
|
|
682
|
-
let n = !
|
|
683
|
-
await
|
|
682
|
+
let n = !et(t);
|
|
683
|
+
await nt(e, n ? await ze(e, t) : rt(t)), n && tt(e);
|
|
684
684
|
}
|
|
685
685
|
async function ze(e, t) {
|
|
686
686
|
Ne("typedown");
|
|
@@ -706,7 +706,7 @@ async function Be() {
|
|
|
706
706
|
label: "Cancel"
|
|
707
707
|
}]
|
|
708
708
|
});
|
|
709
|
-
(
|
|
709
|
+
(B(e) || e === "cancel") && (Me("Cancelled."), process.exit(0));
|
|
710
710
|
}
|
|
711
711
|
async function Ve(e) {
|
|
712
712
|
let n = {
|
|
@@ -728,9 +728,15 @@ function He(e) {
|
|
|
728
728
|
return l(s.join(e, "pnpm-lock.yaml")) ? "pnpm" : l(s.join(e, "yarn.lock")) ? "yarn" : l(s.join(e, "bun.lock")) || l(s.join(e, "bun.lockb")) ? "bun" : "npm";
|
|
729
729
|
}
|
|
730
730
|
function Ue() {
|
|
731
|
-
return "---\n_type:
|
|
731
|
+
return "---\n_type: schema\nproperties:\n title:\n type: string\n description:\n type: string?\n tags:\n type: list[string]?\n---\n";
|
|
732
732
|
}
|
|
733
733
|
function We() {
|
|
734
|
+
return "---\n_type: Article\ntitle: \"Built-in components\"\ndescription: \"Components that ship with the default theme\"\n---\n\nTypedown's default theme ships two built-in Vue components you can use in any `.td` file.\n\n## Flashcard\n\nUse a `flashcard` container fence to create a flip card for study or review.\n\n```\n::: flashcard\nWhat does `fref` stand for in Typedown?\n=== key\nFile reference: a typed link from one `.td` node to another.\n:::\n```\n\nThe rendered result is interactive: click or press Space to reveal the answer.\n\n::: flashcard\nWhat does `fref` stand for in Typedown?\n=== key\nFile reference: a typed link from one `.td` node to another.\n:::\n\nThe card starts face-down. Pass `revealed` to start with the answer visible, or `disabled` to prevent flipping.\n\n## Glossary index\n\n`glossary-index` renders all sibling pages in the current directory as a searchable, alphabetical index. Place it on a folder's `index.td` page.\n\nInformative mode (default) shows the `description` and `tags` from each page's frontmatter:\n\n```md\n[[glossary-index]]\n```\n\nDense mode renders a compact three-column link list suited for large directories:\n\n```html\n[[glossary-index {mode=\"dense\"}]]\n```\n\nFor each entry the component reads the `description` and `tags` fields from the page's schema, so make sure your schema exposes them.\n";
|
|
735
|
+
}
|
|
736
|
+
function Ge() {
|
|
737
|
+
return "---\n_type: Note\ntitle: \"Core concepts\"\ndescription: \"Schemas, frefs, and vault queries explained\"\ntags:\n - \"reference\"\nauthor: \"You\"\n---\n\n## Defining a schema\n\nA schema is a `.td` file with `_type: schema` in the frontmatter.\n\n```yaml\n---\n_type: schema\nproperties:\n title:\n type: string\n published:\n type: date?\n tags:\n type: list[string]?\n---\n```\n\nPlace it in `_types/` and reference it from any file with `_type: SchemaName`.\n\n## fref\n\n`fref(\"./path/to/file.td\")` creates a typed link to another node.\nAccess its fields directly: `fref(\"./other.td\").title`.\n\nfrefs are rename-safe - the LSP tracks all references and updates them when a file moves.\n\n## Vault queries\n\nQuery all nodes of a given schema:\n\n```\nvault.from_nodes(Note).filter((n) -> n.tags).to_list()\n```\n\nUse `.first()` to get a single result, `.to_list()` for an array.\n";
|
|
738
|
+
}
|
|
739
|
+
function Ke() {
|
|
734
740
|
return `<svg fill="none" viewBox="${n}" xmlns="http://www.w3.org/2000/svg">
|
|
735
741
|
<path clip-rule="evenodd" d="${i}" fill-rule="evenodd" fill="${a}"/>
|
|
736
742
|
<path d="${r}" fill="${a}"/>
|
|
@@ -738,7 +744,19 @@ function We() {
|
|
|
738
744
|
</svg>
|
|
739
745
|
`;
|
|
740
746
|
}
|
|
741
|
-
function
|
|
747
|
+
function qe() {
|
|
748
|
+
return "---\n_type: Note\ntitle: \"Getting started\"\ndescription: \"A quick tour of typedown basics\"\ntags:\n - \"intro\"\nauthor: \"You\"\n---\n\n## Schemas\n\nThis file uses `_type: Note`, defined in `_types/Note.td`.\nThe `title`, `description`, `tags`, and `author` fields above are all type-checked.\nTry changing `author` to a number - the LSP will flag it.\n\n## Body interpolation\n\nFrontmatter values are available in the body as expressions.\nThis note was written by **${self.author}** and is titled \"${self.title}\".\n\n## fref\n\nA `fref` is a typed link to another file.\nThe companion note is titled \"${fref(\"./core-concepts.td\").title}\".\n\nRename `core-concepts.td` and the LSP will update this fref automatically.\n\n## Directory index\n\nThe [notes index](/notes) uses `glossary-index` to list this page and its siblings.\nAdd more `.td` files to this folder and they appear there without any config.\n";
|
|
749
|
+
}
|
|
750
|
+
function Je() {
|
|
751
|
+
return "---\n_type: Article\ntitle: \"Quick start\"\ndescription: \"Your new typedown vault\"\n---\n\nThis is your vault's home page. Each `.td` file is a page - frontmatter at the top, Markdown body below.\n\n## File structure\n\n```\nvault/\n _types/ schema definitions\n notes/ a section with its own directory index\n index.td this page\n components.td theme component demos\n```\n\n## Commands\n\n| Command | Action |\n| --- | --- |\n| `dev` | Start the dev server with hot reload |\n| `build` | Build the static site |\n| `preview` | Preview the built site locally |\n| `check` | Type-check the whole vault |\n\n## Next steps\n\n- Open [notes/getting-started](/notes/getting-started) to see schemas and frefs in action\n- Open [components](/components) to explore the built-in theme components\n- Edit `_types/Article.td` to add fields to this page's schema\n";
|
|
752
|
+
}
|
|
753
|
+
function Ye() {
|
|
754
|
+
return "---\n_type: schema\nproperties:\n title:\n type: string\n description:\n type: string?\n tags:\n type: list[string]?\n author:\n type: string?\n---\n";
|
|
755
|
+
}
|
|
756
|
+
function Xe() {
|
|
757
|
+
return "---\n_type: Article\ntitle: \"Notes\"\ndescription: \"All notes in this vault\"\n---\n\n[[glossary-index]]\n";
|
|
758
|
+
}
|
|
759
|
+
function Ze(e) {
|
|
742
760
|
return JSON.stringify({
|
|
743
761
|
name: e.projectName,
|
|
744
762
|
version: "0.0.0",
|
|
@@ -751,21 +769,15 @@ function Ge(e) {
|
|
|
751
769
|
check: "typerighter check"
|
|
752
770
|
},
|
|
753
771
|
devDependencies: {
|
|
754
|
-
typerighter: "^0.
|
|
772
|
+
typerighter: "^0.57.1",
|
|
755
773
|
typescript: "^5.0.0"
|
|
756
774
|
}
|
|
757
775
|
}, void 0, 2) + "\n";
|
|
758
776
|
}
|
|
759
|
-
function
|
|
777
|
+
function Qe() {
|
|
760
778
|
return "User-agent: *\nAllow: /\n\nSitemap: /sitemap.xml\n";
|
|
761
779
|
}
|
|
762
|
-
function
|
|
763
|
-
return "---\n_type: Article\ntitle: \"Hello, world\"\ndescription: \"The starting point of your vault\"\n---\n\nWelcome to your new typedown site.\n\nRead `components.td` to learn about the built-in components.\n";
|
|
764
|
-
}
|
|
765
|
-
function Je() {
|
|
766
|
-
return "---\n_type: schema\nproperties:\n title:\n type: string\n description:\n type: string?\n tags:\n type: list[string]?\n---\n";
|
|
767
|
-
}
|
|
768
|
-
function Ye(e) {
|
|
780
|
+
function $e(e) {
|
|
769
781
|
let t = e.siteOrigin === "" ? "" : `\n origin: "${e.siteOrigin}"`;
|
|
770
782
|
return `# yaml-language-server: $schema=./node_modules/typerighter/dist/typedown.schema.json
|
|
771
783
|
version: "1.0.0"
|
|
@@ -776,10 +788,10 @@ site:
|
|
|
776
788
|
description: "${e.siteDescription}"${t}
|
|
777
789
|
`;
|
|
778
790
|
}
|
|
779
|
-
function
|
|
791
|
+
function et(e) {
|
|
780
792
|
return e.name !== void 0 && e.title !== void 0 && e.description !== void 0;
|
|
781
793
|
}
|
|
782
|
-
function
|
|
794
|
+
function tt(e) {
|
|
783
795
|
let t = He(e), n = t === "npm" ? "npm run dev" : `${t} dev`, r = ["Done scaffolding."];
|
|
784
796
|
e !== "." && r.push(`cd ${e}`), r.push(`${t} install`), r.push(n), Pe(r.join("\n"));
|
|
785
797
|
}
|
|
@@ -789,30 +801,35 @@ async function Q(e, t) {
|
|
|
789
801
|
placeholder: t,
|
|
790
802
|
defaultValue: t
|
|
791
803
|
});
|
|
792
|
-
return
|
|
804
|
+
return B(n) && (Me("Cancelled."), process.exit(0)), n;
|
|
793
805
|
}
|
|
794
|
-
async function
|
|
795
|
-
let n = s.join(e, "vault"), r = s.join(e, "vault", "_types"), i = s.join(e, "
|
|
806
|
+
async function nt(e, t) {
|
|
807
|
+
let n = s.join(e, "vault"), r = s.join(e, "vault", "_types"), i = s.join(e, "vault", "notes"), a = s.join(e, "public"), o = s.join(e, ".typedown", ".local");
|
|
796
808
|
await Promise.all([
|
|
797
809
|
c.mkdir(n, { recursive: !0 }),
|
|
798
810
|
c.mkdir(r, { recursive: !0 }),
|
|
799
811
|
c.mkdir(i, { recursive: !0 }),
|
|
800
|
-
c.mkdir(a, { recursive: !0 })
|
|
801
|
-
|
|
812
|
+
c.mkdir(a, { recursive: !0 }),
|
|
813
|
+
c.mkdir(o, { recursive: !0 })
|
|
814
|
+
]), await $(o, ".gitignore", "*\n", { silent: !0 }), await Promise.all([
|
|
802
815
|
$(e, ".gitignore", "node_modules/\ndist/\n", { silent: !0 }),
|
|
803
|
-
$(e, "package.json",
|
|
804
|
-
$(e, "typedown.yaml",
|
|
805
|
-
$(
|
|
806
|
-
$(
|
|
816
|
+
$(e, "package.json", Ze(t)),
|
|
817
|
+
$(e, "typedown.yaml", $e(t)),
|
|
818
|
+
$(a, "favicon.svg", Ke(), { silent: !0 }),
|
|
819
|
+
$(a, "robots.txt", Qe(), { silent: !0 })
|
|
807
820
|
]);
|
|
808
|
-
let
|
|
809
|
-
$(r, "Article.td",
|
|
810
|
-
$(
|
|
811
|
-
$(n, "
|
|
812
|
-
|
|
813
|
-
|
|
821
|
+
let l = await Promise.all([
|
|
822
|
+
$(r, "Article.td", Ue(), { silent: !0 }),
|
|
823
|
+
$(r, "Note.td", Ye(), { silent: !0 }),
|
|
824
|
+
$(n, "index.td", Je(), { silent: !0 }),
|
|
825
|
+
$(n, "components.td", We(), { silent: !0 }),
|
|
826
|
+
$(i, "index.td", Xe(), { silent: !0 }),
|
|
827
|
+
$(i, "getting-started.td", qe(), { silent: !0 }),
|
|
828
|
+
$(i, "core-concepts.td", Ge(), { silent: !0 })
|
|
829
|
+
]), u = l.filter(Boolean), d = l.filter((e) => !e);
|
|
830
|
+
0 < u.length && X.success(`created sample vault (${u.length} files)`), 0 < d.length && X.warn(`skipped ${d.length} sample files (already exist)`);
|
|
814
831
|
}
|
|
815
|
-
function
|
|
832
|
+
function rt(e) {
|
|
816
833
|
return {
|
|
817
834
|
projectName: e.name,
|
|
818
835
|
siteTitle: e.title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-entry.d.ts","sourceRoot":"","sources":["../../../../src/node/lib/codegen/app-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACd,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"app-entry.d.ts","sourceRoot":"","sources":["../../../../src/node/lib/codegen/app-entry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE;QACL,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE;QACJ,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;IACJ,cAAc,CAAC,EAAE,aAAa,EAAE,CAAC;CAClC;AAGD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAGD,wBAAgB,gBAAgB,CAAE,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,gBAAgB,GAAG,MAAM,CAoFzF"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { F as e, J as t, Y as n, c as r, i, k as a, x as o } from "./shared-dB08amQA.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as c } from "./useSidebarConfig-DUcdHn0W.js";
|
|
2
|
+
import { a as s, c } from "./useSidebarConfig-0kMemgUS.js";
|
|
4
3
|
// src/client/theme-default/composables/client-preferences/index.ts
|
|
5
4
|
function l() {
|
|
6
|
-
return
|
|
5
|
+
return c() + s();
|
|
7
6
|
}
|
|
8
7
|
// src/node/lib/html-template.ts
|
|
9
8
|
function u(e) {
|
package/dist/prerenderWorker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { F as e } from "./shared-dB08amQA.js";
|
|
2
|
-
import { n as t, t as n } from "./page-
|
|
2
|
+
import { n as t, t as n } from "./page-BbSO0VG8.js";
|
|
3
3
|
import { pathToFileURL as r } from "node:url";
|
|
4
4
|
import { parentPort as i, workerData as a } from "node:worker_threads";
|
|
5
5
|
// src/node/build/prerenderWorker.ts
|