typerighter 0.1.6 → 0.2.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.
@@ -0,0 +1,4 @@
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>`, o = `data:image/svg+xml,${encodeURIComponent(a)}`;
3
+ //#endregion
4
+ export { r as a, t as i, e as n, o as r, n as t };
@@ -0,0 +1,160 @@
1
+ import { a as e, c as t } from "./constants-BN1OmC7K.js";
2
+ import { a as n, i as r, n as i, o as a, r as o, t as s } from "./vite-Di36EFu3.js";
3
+ import c from "node:path";
4
+ import l from "node:fs/promises";
5
+ import { build as u, createLogger as d, createServer as f } from "vite";
6
+ //#region src/node/build/render.ts
7
+ var p = /* @__PURE__ */ t(a(), 1);
8
+ async function m(t) {
9
+ let n = await import(t.ssrEntryPath), { clientEntry: r, cssFiles: i, jsFiles: a } = await h(t.clientOutDir);
10
+ for (let o = 0; o < t.pagePaths.length; o += 8) {
11
+ let s = t.pagePaths.slice(o, o + 8);
12
+ await Promise.all(s.map(async (o) => {
13
+ let s = await n.render(o), u = e({
14
+ content: s.html,
15
+ title: s.pageData.title,
16
+ description: s.pageData.frontmatter.description === void 0 ? "" : String(s.pageData.frontmatter.description),
17
+ clientEntry: r,
18
+ cssFiles: i,
19
+ jsFiles: a,
20
+ base: t.base
21
+ }), d = o === "/" ? "index.html" : `${o.replace(/^\//, "")}.html`, f = c.join(t.outDir, d);
22
+ await l.mkdir(c.dirname(f), { recursive: !0 }), await l.writeFile(f, u);
23
+ }));
24
+ }
25
+ }
26
+ async function h(e) {
27
+ let t = c.join(e, "assets"), n = [], r = await l.readdir(t).catch(() => n), i = [], a = [], o = "";
28
+ for (let e of r) e.endsWith(".css") ? i.push(`assets/${e}`) : e.endsWith(".js") && (e.startsWith("client-entry") || e.startsWith("index") ? o = `assets/${e}` : a.push(`assets/${e}`));
29
+ return !o && a.length > 0 && (o = a[0], a.splice(0, 1)), {
30
+ clientEntry: o,
31
+ cssFiles: i,
32
+ jsFiles: a
33
+ };
34
+ }
35
+ //#endregion
36
+ //#region src/node/build/index.ts
37
+ var g = "typerighter/client/theme-default";
38
+ async function _(e) {
39
+ let t = c.resolve(e.root), a = c.resolve(t, e.outDir ?? "dist"), d = e.base ?? "/", f = c.join(a, ".client"), p = c.join(a, ".server"), h = await r(), [_, y, b] = await Promise.all([
40
+ h.getConfig(),
41
+ h.listFiles(),
42
+ h.listFilesGroupedBySchema()
43
+ ]), x = y.some((e) => e === "index.td"), S = JSON.stringify({
44
+ title: _.siteTitle,
45
+ description: _.siteDescription
46
+ }), C = JSON.stringify({ sidebarGroups: b }), w = c.join(t, "node_modules", ".typerighter");
47
+ await l.mkdir(w, { recursive: !0 });
48
+ let T = c.join(w, "client-entry.js"), E = c.join(w, "ssr-entry.js");
49
+ await Promise.all([l.writeFile(T, i({
50
+ contentDir: _.contentDir,
51
+ siteTitle: _.siteTitle,
52
+ siteDescription: _.siteDescription,
53
+ hasIndex: x,
54
+ sidebarGroups: b
55
+ })), l.writeFile(E, o({
56
+ contentDir: _.contentDir,
57
+ layoutImport: g,
58
+ siteConfig: S,
59
+ siteData: C
60
+ }))]);
61
+ try {
62
+ let r = s();
63
+ n.info("Phase 1: Building client bundle..."), await u({
64
+ ...e.viteConfig,
65
+ root: t,
66
+ base: d,
67
+ plugins: r,
68
+ build: {
69
+ ...e.viteConfig?.build,
70
+ outDir: f,
71
+ ssrManifest: !0,
72
+ emptyOutDir: !0,
73
+ rollupOptions: {
74
+ ...e.viteConfig?.build?.rollupOptions,
75
+ input: T
76
+ }
77
+ }
78
+ }), n.info("Phase 2: Building SSR bundle..."), await u({
79
+ ...e.viteConfig,
80
+ root: t,
81
+ base: d,
82
+ plugins: r,
83
+ build: {
84
+ ...e.viteConfig?.build,
85
+ outDir: p,
86
+ ssr: E,
87
+ emptyOutDir: !0
88
+ }
89
+ }), n.info("Phase 3: Pre-rendering pages...");
90
+ let i = y.map((e) => {
91
+ let t = e.replace(/\.td$/, "");
92
+ return t === "index" ? "/" : `/${t}`;
93
+ });
94
+ x || i.push("/"), await m({
95
+ ssrEntryPath: c.join(p, "ssr-entry.js"),
96
+ clientOutDir: f,
97
+ outDir: a,
98
+ base: d,
99
+ pagePaths: i
100
+ });
101
+ let o = c.join(f, "assets"), h = c.join(a, "assets");
102
+ await l.cp(o, h, { recursive: !0 }).catch(() => {}), await v(c.join(t, _.contentDir), a);
103
+ } finally {
104
+ await Promise.all([
105
+ l.rm(w, {
106
+ recursive: !0,
107
+ force: !0
108
+ }),
109
+ l.rm(f, {
110
+ recursive: !0,
111
+ force: !0
112
+ }),
113
+ l.rm(p, {
114
+ recursive: !0,
115
+ force: !0
116
+ })
117
+ ]);
118
+ }
119
+ n.info(`Build complete. Output: ${a}`);
120
+ }
121
+ async function v(e, t) {
122
+ let n = (await l.readdir(e, {
123
+ recursive: !0,
124
+ withFileTypes: !0
125
+ })).filter((e) => e.isFile() && !e.name.endsWith(".td")).map(async (n) => {
126
+ let r = c.join(n.parentPath, n.name), i = c.relative(e, r), a = c.join(t, i);
127
+ return l.mkdir(c.dirname(a), { recursive: !0 }).then(() => l.copyFile(r, a));
128
+ });
129
+ await Promise.all(n);
130
+ }
131
+ //#endregion
132
+ //#region src/node/cli/index.ts
133
+ async function y() {
134
+ let e = process.argv.slice(2), t = e[0], n = e[1] ?? process.cwd();
135
+ try {
136
+ if (!t || t === "dev") {
137
+ let e = await f({
138
+ root: n,
139
+ configFile: !1,
140
+ plugins: [s()]
141
+ });
142
+ await e.listen(), e.printUrls();
143
+ } else if (t === "build") await _({ root: n });
144
+ else if (t === "init") {
145
+ let { initialize: e } = await import("./init-0BIO3hYI.js");
146
+ await e(n);
147
+ } else if (t === "preview") {
148
+ let { preview: e } = await import("vite");
149
+ (await e({ root: n })).printUrls();
150
+ } else b(`unknown command "${t}".`);
151
+ } catch (e) {
152
+ b(`${t ?? "dev"} error:`, e);
153
+ }
154
+ }
155
+ function b(e, t) {
156
+ let n = d(), r = [p.default.red(e)];
157
+ t instanceof Error && (r.push(t.message), t.stack && r.push(t.stack)), n.error(r.join("\n")), process.exit(1);
158
+ }
159
+ //#endregion
160
+ export { _ as n, y as t };
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./cli-CrGQH71K.js";
1
+ import { t as e } from "./cli-ClyVBBVW.js";
2
2
  export { e as cli };
@@ -1,15 +1,16 @@
1
1
  import "../shared-DzTfF-_d.js";
2
- import { a as e, i as t, n, o as r, s as i, t as a } from "../brand-DSd9HWVy.js";
3
- import { a as o, i as s, n as c, o as l, r as ee, s as te } from "../app-CM3biamr.js";
4
- import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, createTextVNode as ne, createVNode as g, defineComponent as _, h as v, normalizeClass as y, onMounted as b, onUnmounted as x, openBlock as S, readonly as re, ref as C, renderList as w, renderSlot as T, toDisplayString as E, unref as D, watch as O, withCtx as k } from "vue";
2
+ import { n as e, t } from "../content-BM3UKxcc.js";
3
+ import { a as n, i as r, n as i, o as a, r as o, s } from "../app-CM3biamr.js";
4
+ import { a as c, i as l, n as u, t as d } from "../brand-CeSqpEQ2.js";
5
+ import { Fragment as f, computed as p, createBlock as m, createCommentVNode as h, createElementBlock as g, createElementVNode as _, createTextVNode as ee, createVNode as v, defineComponent as y, h as b, normalizeClass as x, onMounted as S, onUnmounted as te, openBlock as C, readonly as ne, ref as w, renderList as T, renderSlot as re, toDisplayString as E, unref as D, watch as O, withCtx as k } from "vue";
5
6
  //#region ../../node_modules/.pnpm/lucide-vue-next@1.0.0_vue@3.5.40_typescript@6.0.3_/node_modules/lucide-vue-next/dist/esm/shared/src/utils/hasA11yProp.js
6
- var ie = (e) => {
7
+ var A = (e) => {
7
8
  for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
8
9
  return !1;
9
- }, A = (e) => e === "", ae = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), j = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), oe = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), se = (e) => {
10
- let t = oe(e);
10
+ }, j = (e) => e === "", ie = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), M = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ae = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), oe = (e) => {
11
+ let t = ae(e);
11
12
  return t.charAt(0).toUpperCase() + t.slice(1);
12
- }, M = {
13
+ }, N = {
13
14
  xmlns: "http://www.w3.org/2000/svg",
14
15
  width: 24,
15
16
  height: 24,
@@ -19,24 +20,24 @@ var ie = (e) => {
19
20
  "stroke-width": 2,
20
21
  "stroke-linecap": "round",
21
22
  "stroke-linejoin": "round"
22
- }, ce = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = M.width, color: s = M.stroke, ...c }, { slots: l }) => v("svg", {
23
- ...M,
23
+ }, se = ({ name: e, iconNode: t, absoluteStrokeWidth: n, "absolute-stroke-width": r, strokeWidth: i, "stroke-width": a, size: o = N.width, color: s = N.stroke, ...c }, { slots: l }) => b("svg", {
24
+ ...N,
24
25
  ...c,
25
26
  width: o,
26
27
  height: o,
27
28
  stroke: s,
28
- "stroke-width": A(n) || A(r) || n === !0 || r === !0 ? Number(i || a || M["stroke-width"]) * 24 / Number(o) : i || a || M["stroke-width"],
29
- class: ae("lucide", c.class, ...e ? [`lucide-${j(se(e))}-icon`, `lucide-${j(e)}`] : ["lucide-icon"]),
30
- ...!l.default && !ie(c) && { "aria-hidden": "true" }
31
- }, [...t.map((e) => v(...e)), ...l.default ? [l.default()] : []]), N = (e, t) => (n, { slots: r, attrs: i }) => v(ce, {
29
+ "stroke-width": j(n) || j(r) || n === !0 || r === !0 ? Number(i || a || N["stroke-width"]) * 24 / Number(o) : i || a || N["stroke-width"],
30
+ class: ie("lucide", c.class, ...e ? [`lucide-${M(oe(e))}-icon`, `lucide-${M(e)}`] : ["lucide-icon"]),
31
+ ...!l.default && !A(c) && { "aria-hidden": "true" }
32
+ }, [...t.map((e) => b(...e)), ...l.default ? [l.default()] : []]), P = (e, t) => (n, { slots: r, attrs: i }) => b(se, {
32
33
  ...i,
33
34
  ...n,
34
35
  iconNode: t,
35
36
  name: e
36
- }, r), P = N("chevron-down", [["path", {
37
+ }, r), ce = P("chevron-down", [["path", {
37
38
  d: "m6 9 6 6 6-6",
38
39
  key: "qrunsl"
39
- }]]), F = N("menu", [
40
+ }]]), F = P("menu", [
40
41
  ["path", {
41
42
  d: "M4 5h16",
42
43
  key: "1tepv9"
@@ -49,10 +50,10 @@ var ie = (e) => {
49
50
  d: "M4 19h16",
50
51
  key: "1djgab"
51
52
  }]
52
- ]), I = N("moon", [["path", {
53
+ ]), I = P("moon", [["path", {
53
54
  d: "M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",
54
55
  key: "kfwtm"
55
- }]]), L = N("sun", [
56
+ }]]), L = P("sun", [
56
57
  ["circle", {
57
58
  cx: "12",
58
59
  cy: "12",
@@ -91,7 +92,7 @@ var ie = (e) => {
91
92
  d: "m19.07 4.93-1.41 1.41",
92
93
  key: "1shlcs"
93
94
  }]
94
- ]), R = N("x", [["path", {
95
+ ]), R = P("x", [["path", {
95
96
  d: "M18 6 6 18",
96
97
  key: "1bl5f8"
97
98
  }], ["path", {
@@ -101,74 +102,74 @@ var ie = (e) => {
101
102
  "height",
102
103
  "width",
103
104
  "viewBox"
104
- ], B = ["d"], V = ["d"], H = ["d"], U = /* @__PURE__ */ _({
105
+ ], B = ["d"], V = ["d"], H = ["d"], U = /* @__PURE__ */ y({
105
106
  __name: "TdBrandIcon",
106
107
  props: { size: { default: 28 } },
107
- setup(r) {
108
- return (i, o) => (S(), m("svg", {
108
+ setup(e) {
109
+ return (t, n) => (C(), g("svg", {
109
110
  fill: "none",
110
- height: r.size,
111
- width: r.size * 208 / 128,
112
- viewBox: D(e),
111
+ height: e.size,
112
+ width: e.size * 208 / 128,
113
+ viewBox: D(c),
113
114
  xmlns: "http://www.w3.org/2000/svg"
114
115
  }, [
115
- h("path", {
116
+ _("path", {
116
117
  "clip-rule": "evenodd",
117
- d: D(n),
118
+ d: D(u),
118
119
  "fill-rule": "evenodd",
119
120
  fill: "currentColor"
120
121
  }, null, 8, B),
121
- h("path", {
122
- d: D(t),
122
+ _("path", {
123
+ d: D(l),
123
124
  fill: "currentColor"
124
125
  }, null, 8, V),
125
- h("path", {
126
- d: D(a),
126
+ _("path", {
127
+ d: D(d),
127
128
  fill: "currentColor"
128
129
  }, null, 8, H)
129
130
  ], 8, z));
130
131
  }
131
- }), W = ["title", "aria-label"], G = /* @__PURE__ */ _({
132
+ }), W = ["title", "aria-label"], G = /* @__PURE__ */ y({
132
133
  __name: "TdButton",
133
134
  props: { label: {} },
134
135
  setup(e) {
135
- return (t, n) => (S(), m("button", {
136
+ return (t, n) => (C(), g("button", {
136
137
  type: "button",
137
138
  class: "inline-flex items-center justify-center cursor-pointer",
138
139
  title: e.label,
139
140
  "aria-label": e.label
140
- }, [T(t.$slots, "default")], 8, W));
141
+ }, [re(t.$slots, "default")], 8, W));
141
142
  }
142
- }), le = ["aria-expanded", "onClick"], ue = { key: 0 }, de = ["href"], fe = /*@__PURE__*/ _({
143
+ }), le = ["aria-expanded", "onClick"], ue = { key: 0 }, de = ["href"], fe = /*@__PURE__*/ y({
143
144
  __name: "TdContentNav",
144
145
  props: { groups: {} },
145
- setup(e) {
146
- let t = C({});
147
- function n(e) {
148
- t.value[e] = !t.value[e];
146
+ setup(n) {
147
+ let r = w({});
148
+ function i(e) {
149
+ r.value[e] = !r.value[e];
149
150
  }
150
- return (a, o) => (S(), m("nav", null, [(S(!0), m(u, null, w(e.groups, (e, a) => (S(), m("div", {
151
+ return (a, o) => (C(), g("nav", null, [(C(!0), g(f, null, T(n.groups, (n, a) => (C(), g("div", {
151
152
  key: a,
152
153
  class: "td-content-nav-group"
153
- }, [h("button", {
154
+ }, [_("button", {
154
155
  type: "button",
155
156
  class: "td-content-nav-label",
156
- "aria-expanded": !t.value[a],
157
- onClick: () => n(String(a))
158
- }, [g(D(P), {
157
+ "aria-expanded": !r.value[a],
158
+ onClick: () => i(String(a))
159
+ }, [v(D(ce), {
159
160
  size: 14,
160
- class: y(["td-content-nav-caret", { "is-collapsed": t.value[a] }])
161
- }, null, 8, ["class"]), ne(" " + E(a), 1)], 8, le), t.value[a] ? p("", !0) : (S(), m("div", ue, [(S(!0), m(u, null, w(e, (e) => (S(), m("a", {
162
- key: e.path,
163
- href: D(i)(e),
161
+ class: x(["td-content-nav-caret", { "is-collapsed": r.value[a] }])
162
+ }, null, 8, ["class"]), ee(" " + E(a), 1)], 8, le), r.value[a] ? h("", !0) : (C(), g("div", ue, [(C(!0), g(f, null, T(n, (n) => (C(), g("a", {
163
+ key: n.path,
164
+ href: D(e)(n),
164
165
  class: "td-content-nav-link"
165
- }, E(D(r)(e)), 9, de))), 128))]))]))), 128))]));
166
+ }, E(D(t)(n)), 9, de))), 128))]))]))), 128))]));
166
167
  }
167
168
  }), K = (e, t) => {
168
169
  let n = e.__vccOpts || e;
169
170
  for (let [e, r] of t) n[e] = r;
170
171
  return n;
171
- }, q = /*#__PURE__*/ K(fe, [["__scopeId", "data-v-deed59ce"]]), J = C(!1);
172
+ }, q = /*#__PURE__*/ K(fe, [["__scopeId", "data-v-deed59ce"]]), J = w(!1);
172
173
  function Y() {
173
174
  function e() {
174
175
  J.value = !J.value;
@@ -177,28 +178,28 @@ function Y() {
177
178
  J.value = !1;
178
179
  }
179
180
  return {
180
- isOpen: re(J),
181
+ isOpen: ne(J),
181
182
  toggle: e,
182
183
  close: t
183
184
  };
184
185
  }
185
186
  //#endregion
186
187
  //#region src/client/theme-default/components/TdMenuButton.vue
187
- var pe = /* @__PURE__ */ _({
188
+ var pe = /* @__PURE__ */ y({
188
189
  __name: "TdMenuButton",
189
190
  setup(e) {
190
191
  let { isOpen: t, toggle: n } = Y();
191
- return (e, r) => (S(), f(G, {
192
+ return (e, r) => (C(), m(G, {
192
193
  class: "td-menu-button w-9 h-9 text-td-gray-600 group",
193
194
  label: D(t) ? "Close menu" : "Open menu",
194
195
  "aria-expanded": D(t),
195
196
  onClick: D(n)
196
197
  }, {
197
- default: k(() => [D(t) ? (S(), f(D(R), {
198
+ default: k(() => [D(t) ? (C(), m(D(R), {
198
199
  key: 0,
199
200
  size: 20,
200
201
  class: "group-hover:text-td-primary transition-colors"
201
- })) : (S(), f(D(F), {
202
+ })) : (C(), m(D(F), {
202
203
  key: 1,
203
204
  size: 20,
204
205
  class: "group-hover:text-td-primary transition-colors"
@@ -210,20 +211,20 @@ var pe = /* @__PURE__ */ _({
210
211
  "onClick"
211
212
  ]));
212
213
  }
213
- }), me = /* @__PURE__ */ _({
214
+ }), me = /* @__PURE__ */ y({
214
215
  __name: "TdThemeToggle",
215
216
  setup(e) {
216
- let { isDark: t, toggle: n } = o();
217
- return (e, r) => (S(), f(G, {
217
+ let { isDark: t, toggle: r } = n();
218
+ return (e, n) => (C(), m(G, {
218
219
  class: "w-9 h-9 text-td-gray-600 group hover:opacity-70",
219
220
  label: D(t) ? "Switch to light mode" : "Switch to dark mode",
220
- onClick: D(n)
221
+ onClick: D(r)
221
222
  }, {
222
- default: k(() => [D(t) ? (S(), f(D(L), {
223
+ default: k(() => [D(t) ? (C(), m(D(L), {
223
224
  key: 0,
224
225
  size: 18,
225
226
  class: "group-hover:text-td-secondary transition-colors"
226
- })) : (S(), f(D(I), {
227
+ })) : (C(), m(D(I), {
227
228
  key: 1,
228
229
  size: 18,
229
230
  class: "group-hover:text-td-primary transition-colors"
@@ -246,9 +247,9 @@ function X() {
246
247
  t.classList.remove("copied"), t.setAttribute("title", i);
247
248
  }, 2e3);
248
249
  }
249
- b(() => {
250
+ S(() => {
250
251
  document.addEventListener("click", e);
251
- }), x(() => {
252
+ }), te(() => {
252
253
  document.removeEventListener("click", e);
253
254
  });
254
255
  }
@@ -275,61 +276,61 @@ var he = { class: "td-header" }, ge = { class: "td-header-left" }, _e = {
275
276
  }, Ne = { class: "td-sidebar-right-inner" }, Pe = {
276
277
  key: 0,
277
278
  class: "td-toc"
278
- }, Fe = { class: "td-toc-list" }, Ie = ["href"], Z = /*#__PURE__*/ K(/* @__PURE__ */ _({
279
+ }, Fe = { class: "td-toc-list" }, Ie = ["href"], Z = /*#__PURE__*/ K(/* @__PURE__ */ y({
279
280
  __name: "TdLayout",
280
281
  setup(e) {
281
- let { title: t, page: n } = s(), r = c(), i = ee(), { isOpen: a, close: o } = Y(), d = te();
282
- return O(() => d.path, () => o()), X(), (e, s) => (S(), m("div", null, [
283
- h("header", he, [h("div", ge, [g(pe), h("a", _e, [g(U), h("span", ve, E(D(r).title || "Typedown"), 1)])]), h("div", ye, [g(me)])]),
284
- h("div", { class: y(["td-menu-overlay", { "is-open": D(a) }]) }, [h("header", be, [h("div", xe, [g(G, {
282
+ let { title: t, page: n } = r(), c = i(), l = o(), { isOpen: u, close: d } = Y(), p = s();
283
+ return O(() => p.path, () => d()), X(), (e, r) => (C(), g("div", null, [
284
+ _("header", he, [_("div", ge, [v(pe), _("a", _e, [v(U), _("span", ve, E(D(c).title || "Typedown"), 1)])]), _("div", ye, [v(me)])]),
285
+ _("div", { class: x(["td-menu-overlay", { "is-open": D(u) }]) }, [_("header", be, [_("div", xe, [v(G, {
285
286
  class: "w-9 h-9 text-td-gray-600 hover:text-td-primary",
286
287
  label: "Close menu",
287
- onClick: D(o)
288
+ onClick: D(d)
288
289
  }, {
289
- default: k(() => [g(D(R), { size: 20 })]),
290
+ default: k(() => [v(D(R), { size: 20 })]),
290
291
  _: 1
291
- }, 8, ["onClick"]), h("a", Se, [g(U), h("span", Ce, E(D(r).title || "Typedown"), 1)])])]), h("nav", we, [g(q, { groups: D(i).sidebarGroups }, null, 8, ["groups"])])], 2),
292
- h("div", Te, [h("nav", Ee, [h("div", De, [g(q, { groups: D(i).sidebarGroups }, null, 8, ["groups"])])]), h("div", Oe, [h("main", ke, [h("article", Ae, [D(t) ? (S(), m("h1", je, E(D(t)), 1)) : p("", !0), g(D(l))])]), h("nav", Me, [h("div", Ne, [D(n).headings.length ? (S(), m("div", Pe, [s[0] ||= h("div", { class: "td-toc-label" }, " On this page ", -1), h("ul", Fe, [(S(!0), m(u, null, w(D(n).headings, (e) => (S(), m("li", {
292
+ }, 8, ["onClick"]), _("a", Se, [v(U), _("span", Ce, E(D(c).title || "Typedown"), 1)])])]), _("nav", we, [v(q, { groups: D(l).sidebarGroups }, null, 8, ["groups"])])], 2),
293
+ _("div", Te, [_("nav", Ee, [_("div", De, [v(q, { groups: D(l).sidebarGroups }, null, 8, ["groups"])])]), _("div", Oe, [_("main", ke, [_("article", Ae, [D(t) ? (C(), g("h1", je, E(D(t)), 1)) : h("", !0), v(D(a))])]), _("nav", Me, [_("div", Ne, [D(n).headings.length ? (C(), g("div", Pe, [r[0] ||= _("div", { class: "td-toc-label" }, " On this page ", -1), _("ul", Fe, [(C(!0), g(f, null, T(D(n).headings, (e) => (C(), g("li", {
293
294
  key: e.slug,
294
- class: y({
295
+ class: x({
295
296
  "td-toc-indent-1": e.level === 3,
296
297
  "td-toc-indent-2": e.level === 4,
297
298
  "td-toc-indent-3": e.level === 5
298
299
  })
299
- }, [h("a", {
300
+ }, [_("a", {
300
301
  href: e.link,
301
302
  class: "td-toc-link"
302
- }, E(e.title), 9, Ie)], 2))), 128))])])) : p("", !0)])])])])
303
+ }, E(e.title), 9, Ie)], 2))), 128))])])) : h("", !0)])])])])
303
304
  ]));
304
305
  }
305
306
  }), [["__scopeId", "data-v-f2419b0d"]]), Le = {}, Re = { class: "pt-16 pb-24" };
306
307
  function Q(e, t) {
307
- return S(), m("div", Re, [...t[0] ||= [
308
- h("p", { class: "text-td-display font-td-heading leading-none tracking-td-title text-td-fg-muted" }, " 404 ", -1),
309
- h("h1", { class: "text-td-h2 font-td-heading leading-td-heading tracking-td-heading mt-4" }, " Page Not Found ", -1),
310
- h("p", { class: "text-td-fg-muted mt-2 text-td-body leading-td-body" }, " The page you are looking for does not exist. ", -1),
311
- h("a", {
308
+ return C(), g("div", Re, [...t[0] ||= [
309
+ _("p", { class: "text-td-display font-td-heading leading-none tracking-td-title text-td-fg-muted" }, " 404 ", -1),
310
+ _("h1", { class: "text-td-h2 font-td-heading leading-td-heading tracking-td-heading mt-4" }, " Page Not Found ", -1),
311
+ _("p", { class: "text-td-fg-muted mt-2 text-td-body leading-td-body" }, " The page you are looking for does not exist. ", -1),
312
+ _("a", {
312
313
  class: "inline-flex items-center mt-6 text-td-primary text-td-ui font-td-heading tracking-td-heading hover:text-td-primary-hover",
313
314
  href: "/"
314
315
  }, "Go Home", -1)
315
316
  ]]);
316
317
  }
317
- var $ = /*#__PURE__*/ K(Le, [["render", Q]]), ze = { class: "py-8" }, Be = { class: "border-b-2 border-td-fg pb-2 mb-0.5" }, Ve = { class: "text-td-h2 font-td-heading leading-td-heading tracking-td-heading m-0 inline" }, He = { class: "text-td-label text-td-gray-600 ml-2" }, Ue = ["href"], We = { class: "font-td-semibold text-td-body-sm" }, Ge = { class: "text-td-label text-td-gray-600 ml-2" }, Ke = /*#__PURE__*/ K(/* @__PURE__ */ _({
318
+ var $ = /*#__PURE__*/ K(Le, [["render", Q]]), ze = { class: "py-8" }, Be = { class: "border-b-2 border-td-fg pb-2 mb-0.5" }, Ve = { class: "text-td-h2 font-td-heading leading-td-heading tracking-td-heading m-0 inline" }, He = { class: "text-td-label text-td-gray-600 ml-2" }, Ue = ["href"], We = { class: "font-td-semibold text-td-body-sm" }, Ge = { class: "text-td-label text-td-gray-600 ml-2" }, Ke = /*#__PURE__*/ K(/* @__PURE__ */ y({
318
319
  __name: "TdOverview",
319
320
  props: { groups: {} },
320
- setup(e) {
321
- let t = d(() => Object.entries(e.groups).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => ({
321
+ setup(n) {
322
+ let r = p(() => Object.entries(n.groups).sort(([e], [t]) => e.localeCompare(t)).map(([e, n]) => ({
322
323
  schema: e,
323
- items: [...t].sort((e, t) => r(e).localeCompare(r(t)))
324
+ items: [...n].sort((e, n) => t(e).localeCompare(t(n)))
324
325
  })));
325
- return (e, n) => (S(), m("div", ze, [(S(!0), m(u, null, w(t.value, (e) => (S(), m("section", {
326
- key: e.schema,
326
+ return (n, i) => (C(), g("div", ze, [(C(!0), g(f, null, T(r.value, (n) => (C(), g("section", {
327
+ key: n.schema,
327
328
  class: "mb-10"
328
- }, [h("div", Be, [h("h2", Ve, E(e.schema), 1), h("span", He, E(e.items.length), 1)]), (S(!0), m(u, null, w(e.items, (e) => (S(), m("a", {
329
- key: e.path,
330
- href: D(i)(e),
329
+ }, [_("div", Be, [_("h2", Ve, E(n.schema), 1), _("span", He, E(n.items.length), 1)]), (C(!0), g(f, null, T(n.items, (n) => (C(), g("a", {
330
+ key: n.path,
331
+ href: D(e)(n),
331
332
  class: "td-index-row"
332
- }, [h("span", We, E(D(r)(e)), 1), h("span", Ge, E(e.path), 1)], 8, Ue))), 128))]))), 128))]));
333
+ }, [_("span", We, E(D(t)(n)), 1), _("span", Ge, E(n.path), 1)], 8, Ue))), 128))]))), 128))]));
333
334
  }
334
335
  }), [["__scopeId", "data-v-0d07be91"]]), qe = {
335
336
  Layout: Z,
@@ -0,0 +1,46 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
3
+ let r = {};
4
+ for (var i in e) t(r, i, {
5
+ get: e[i],
6
+ enumerable: !0
7
+ });
8
+ return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ }, c = (e, i, o, s) => {
10
+ if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
11
+ get: ((e) => i[e]).bind(null, d),
12
+ enumerable: !(s = n(i, d)) || s.enumerable
13
+ });
14
+ return e;
15
+ }, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
16
+ value: n,
17
+ enumerable: !0
18
+ }) : a, n));
19
+ //#endregion
20
+ //#region src/node/build/html.ts
21
+ function u(e) {
22
+ let t = e.cssFiles.map((t) => ` <link rel="stylesheet" href="${e.base}${t}">`).join("\n"), n = e.jsFiles.map((t) => ` <link rel="modulepreload" href="${e.base}${t}">`).join("\n");
23
+ return `<!DOCTYPE html>
24
+ <html lang="${e.lang ?? "en"}">
25
+ <head>
26
+ <meta charset="UTF-8">
27
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
28
+ <title>${d(e.title)}</title>
29
+ <meta name="description" content="${d(e.description)}">
30
+ ${t}
31
+ ${n}
32
+ </head>
33
+ <body>
34
+ <div id="app">${e.content}</div>
35
+ <script type="module" src="${e.base}${e.clientEntry}"><\/script>
36
+ </body>
37
+ </html>`;
38
+ }
39
+ function d(e) {
40
+ return e.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
41
+ }
42
+ //#endregion
43
+ //#region src/node/plugin/vite/constants.ts
44
+ var f = "@typedown/app", p = "\0@typedown/app", m = "__typedown_index__.td";
45
+ //#endregion
46
+ export { u as a, l as c, d as i, f as n, o, m as r, s, p as t };
@@ -0,0 +1,16 @@
1
+ //#region src/shared/utils/content.ts
2
+ function e(e) {
3
+ return n(e.header, e.path);
4
+ }
5
+ function t(e) {
6
+ return "/" + e.path.replace(/\.td$/, "");
7
+ }
8
+ function n(e, t) {
9
+ return e._label === void 0 ? e.name === void 0 ? r(t.replace(/\.td$/, "").split("/").pop() ?? "") : String(e.name) : String(e._label);
10
+ }
11
+ function r(e) {
12
+ let t = e.replace(/[-_]/g, " ").split(" ");
13
+ return 0 < t.length && (t[0] = t[0].charAt(0).toUpperCase() + t[0].slice(1)), t.join(" ");
14
+ }
15
+ //#endregion
16
+ export { t as n, n as r, e as t };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./vite-QefJNNFo.js";
2
- import "./plugin-B4GVd-re.js";
3
- import { n as t, t as n } from "./cli-CrGQH71K.js";
1
+ import { t as e } from "./vite-Di36EFu3.js";
2
+ import "./plugin-DStheS2n.js";
3
+ import { n as t, t as n } from "./cli-ClyVBBVW.js";
4
4
  export { t as buildSite, n as cli, e as typedown };