typerighter 0.0.0 → 0.1.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 (112) hide show
  1. package/LICENSE +674 -0
  2. package/dist/app-bn8sNpDS.js +180 -0
  3. package/dist/brand-DSd9HWVy.js +19 -0
  4. package/dist/chunk-DfAF0w94-EwUSVR-h.js +13 -0
  5. package/dist/client/app/components/Content.d.ts +4 -0
  6. package/dist/client/app/components/Content.d.ts.map +1 -0
  7. package/dist/client/app/composables/useTdContent.d.ts +4 -0
  8. package/dist/client/app/composables/useTdContent.d.ts.map +1 -0
  9. package/dist/client/app/composables/useTheme.d.ts +9 -0
  10. package/dist/client/app/composables/useTheme.d.ts.map +1 -0
  11. package/dist/client/app/index.d.ts +22 -0
  12. package/dist/client/app/index.d.ts.map +1 -1
  13. package/dist/client/app/router.d.ts +24 -0
  14. package/dist/client/app/router.d.ts.map +1 -0
  15. package/dist/client/index.d.ts +1 -0
  16. package/dist/client/index.d.ts.map +1 -1
  17. package/dist/client/theme-default.js +339 -0
  18. package/dist/client.js +2 -0
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +185 -4
  22. package/dist/lib-CBtriEt5-Ch50D04V.js +3309 -0
  23. package/dist/liteDOM-Cp0aN3bP-YwW1TGWI.js +741 -0
  24. package/dist/logger-DZLd8EDg.js +78 -0
  25. package/dist/node/build/codegen.d.ts +13 -0
  26. package/dist/node/build/codegen.d.ts.map +1 -0
  27. package/dist/node/build/html.d.ts +20 -0
  28. package/dist/node/build/html.d.ts.map +1 -0
  29. package/dist/node/build/index.d.ts +17 -0
  30. package/dist/node/build/index.d.ts.map +1 -0
  31. package/dist/node/build/render.d.ts +14 -0
  32. package/dist/node/build/render.d.ts.map +1 -0
  33. package/dist/node/cli/index.d.ts +2 -0
  34. package/dist/node/cli/index.d.ts.map +1 -0
  35. package/dist/node/cli/server.d.ts +5 -0
  36. package/dist/node/cli/server.d.ts.map +1 -0
  37. package/dist/node/index.d.ts +3 -1
  38. package/dist/node/index.d.ts.map +1 -1
  39. package/dist/node/lib/index.d.ts +4 -0
  40. package/dist/node/lib/index.d.ts.map +1 -0
  41. package/dist/node/lib/logger.d.ts +6 -0
  42. package/dist/node/lib/logger.d.ts.map +1 -0
  43. package/dist/node/lib/markdown/index.d.ts +5 -0
  44. package/dist/node/lib/markdown/index.d.ts.map +1 -0
  45. package/dist/node/lib/markdown/plugins/container.d.ts +3 -0
  46. package/dist/node/lib/markdown/plugins/container.d.ts.map +1 -0
  47. package/dist/node/lib/markdown/plugins/highlight.d.ts +2 -0
  48. package/dist/node/lib/markdown/plugins/highlight.d.ts.map +1 -0
  49. package/dist/node/lib/markdown/plugins/image.d.ts +3 -0
  50. package/dist/node/lib/markdown/plugins/image.d.ts.map +1 -0
  51. package/dist/node/lib/markdown/plugins/line-number.d.ts +3 -0
  52. package/dist/node/lib/markdown/plugins/line-number.d.ts.map +1 -0
  53. package/dist/node/lib/markdown/plugins/link.d.ts +3 -0
  54. package/dist/node/lib/markdown/plugins/link.d.ts.map +1 -0
  55. package/dist/node/lib/markdown/plugins/pre-wrapper.d.ts +6 -0
  56. package/dist/node/lib/markdown/plugins/pre-wrapper.d.ts.map +1 -0
  57. package/dist/node/lib/markdown/plugins/restore-entities.d.ts +3 -0
  58. package/dist/node/lib/markdown/plugins/restore-entities.d.ts.map +1 -0
  59. package/dist/node/lib/markdown/plugins/table.d.ts +3 -0
  60. package/dist/node/lib/markdown/plugins/table.d.ts.map +1 -0
  61. package/dist/node/lib/render/index.d.ts +2 -0
  62. package/dist/node/lib/render/index.d.ts.map +1 -0
  63. package/dist/node/lib/render/vue.d.ts +11 -0
  64. package/dist/node/lib/render/vue.d.ts.map +1 -0
  65. package/dist/node/lib/typedown-context.d.ts +29 -0
  66. package/dist/node/lib/typedown-context.d.ts.map +1 -0
  67. package/dist/node/plugin/codegen.d.ts +16 -0
  68. package/dist/node/plugin/codegen.d.ts.map +1 -0
  69. package/dist/node/plugin/codegen.test.d.ts +2 -0
  70. package/dist/node/plugin/codegen.test.d.ts.map +1 -0
  71. package/dist/node/plugin/constants.d.ts +4 -0
  72. package/dist/node/plugin/constants.d.ts.map +1 -0
  73. package/dist/node/plugin/index.d.ts +2 -0
  74. package/dist/node/plugin/index.d.ts.map +1 -0
  75. package/dist/node/plugin/vite.d.ts +3 -0
  76. package/dist/node/plugin/vite.d.ts.map +1 -0
  77. package/dist/shared/brand.d.ts +7 -0
  78. package/dist/shared/brand.d.ts.map +1 -0
  79. package/dist/shared/index.d.ts +3 -0
  80. package/dist/shared/index.d.ts.map +1 -1
  81. package/dist/shared/regexes.d.ts +2 -0
  82. package/dist/shared/regexes.d.ts.map +1 -0
  83. package/dist/shared/types/content.d.ts +10 -0
  84. package/dist/shared/types/content.d.ts.map +1 -0
  85. package/dist/shared/types/index.d.ts +4 -0
  86. package/dist/shared/types/index.d.ts.map +1 -0
  87. package/dist/shared/types/markdown.d.ts +62 -0
  88. package/dist/shared/types/markdown.d.ts.map +1 -0
  89. package/dist/shared/types/ssg.d.ts +23 -0
  90. package/dist/shared/types/ssg.d.ts.map +1 -0
  91. package/dist/shared/utils/content.d.ts +6 -0
  92. package/dist/shared/utils/content.d.ts.map +1 -0
  93. package/dist/shared/utils/environment.d.ts +2 -0
  94. package/dist/shared/utils/environment.d.ts.map +1 -0
  95. package/dist/shared/utils/highlight.d.ts +3 -0
  96. package/dist/shared/utils/highlight.d.ts.map +1 -0
  97. package/dist/shared/utils/index.d.ts +5 -0
  98. package/dist/shared/utils/index.d.ts.map +1 -0
  99. package/dist/shared/utils/url.d.ts +3 -0
  100. package/dist/shared/utils/url.d.ts.map +1 -0
  101. package/dist/shared-DzTfF-_d.js +14 -0
  102. package/dist/tex-svg-full-BI3fonbT-CfoPQ3xc.js +60224 -0
  103. package/dist/typedown-context-CWA07Yb7.js +9436 -0
  104. package/dist/typedown-context-D78bYNhH.js +2 -0
  105. package/dist/typerighter.css +2 -0
  106. package/dist/vite.js +174 -0
  107. package/dist/wgxpath.install-node-Csk64Aj9-C0enUGLs.js +1094 -0
  108. package/dist/xypic-DrMJn58R-B4fw2rYo.js +14846 -0
  109. package/package.json +49 -16
  110. package/dist/client/theme-default/index.d.ts +0 -1
  111. package/dist/client/theme-default/index.d.ts.map +0 -1
  112. package/dist/index.cjs +0 -1
@@ -0,0 +1,180 @@
1
+ import "./shared-DzTfF-_d.js";
2
+ import { computed as e, createApp as t, defineComponent as n, h as r, inject as i, markRaw as a, nextTick as o, reactive as s, readonly as c, ref as l } from "vue";
3
+ import { createInjectionState as u } from "@vueuse/core";
4
+ //#region src/shared/utils/environment.ts
5
+ var d = typeof window < "u", f = Symbol("typedown-router"), p = {
6
+ schema: "",
7
+ frontmatter: {},
8
+ headings: [],
9
+ title: "Not Found"
10
+ };
11
+ function m(e, t) {
12
+ let n = s({
13
+ path: "/",
14
+ hash: "",
15
+ query: "",
16
+ contentSfc: void 0,
17
+ data: p
18
+ }), r = {
19
+ route: n,
20
+ async go(e, t) {
21
+ e = y(e), await r.onBeforeRouteChange?.(e) !== !1 && ((!d || t?.initialLoad || v(e, t)) && await c(e), l(), await r.onAfterRouteChange?.(e));
22
+ }
23
+ }, i;
24
+ async function c(r) {
25
+ let s = new URL(r, "http://a.com"), c = i = s.pathname;
26
+ try {
27
+ let t = await e(c);
28
+ if (!t) throw Error(`Page not found: ${c}`);
29
+ if (i === c) {
30
+ i = void 0;
31
+ let { default: e, __pageData: r } = t;
32
+ n.path = c, n.contentSfc = a(e), n.data = a(r), l(s), d && o(() => {
33
+ h(s.hash);
34
+ });
35
+ }
36
+ } catch {
37
+ i === c && (i = void 0, n.path = c, n.contentSfc = t ? a(t) : void 0, n.data = p, l(s));
38
+ }
39
+ }
40
+ function l(e = d ? location : {
41
+ search: "",
42
+ hash: ""
43
+ }) {
44
+ n.query = e.search, n.hash = decodeURIComponent(e.hash);
45
+ }
46
+ return d && (history.state ?? history.replaceState({}, ""), window.addEventListener("click", (e) => {
47
+ if (e.defaultPrevented || !(e.target instanceof Element) || e.button !== 0 || e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
48
+ let t = e.target.closest("a");
49
+ if (!t || t.hasAttribute("download") || t.hasAttribute("target")) return;
50
+ let n = t.getAttribute("href");
51
+ if (n === null) return;
52
+ let { href: i, origin: a, pathname: o } = new URL(n, t.baseURI);
53
+ a === location.origin && !o.match(/\.\w+$/) && (e.preventDefault(), r.go(i));
54
+ }, { capture: !0 }), window.addEventListener("popstate", async (e) => {
55
+ if (e.state == null) return;
56
+ let t = y(location.href);
57
+ await c(t), l(), await r.onAfterRouteChange?.(t);
58
+ }), window.addEventListener("hashchange", (e) => {
59
+ e.preventDefault(), l();
60
+ })), r;
61
+ }
62
+ function h(e) {
63
+ if (!e) return;
64
+ let t;
65
+ try {
66
+ t = document.getElementById(decodeURIComponent(e).slice(1)) ?? void 0;
67
+ } catch {
68
+ return;
69
+ }
70
+ t?.scrollIntoView({ block: "start" });
71
+ }
72
+ function g() {
73
+ return _().route;
74
+ }
75
+ function _() {
76
+ let e = i(f);
77
+ if (!e) throw Error("useRouter() called outside of Typedown app");
78
+ return e;
79
+ }
80
+ function v(e, { replace: t = !1 } = {}) {
81
+ let n = y(location.href);
82
+ if (e === n) return h(new URL(e, "http://a.com").hash), !1;
83
+ t ? history.replaceState({}, "", e) : (history.replaceState({ scrollPosition: window.scrollY }, ""), history.pushState({}, "", e));
84
+ let r = new URL(e, location.origin), i = new URL(n, location.origin);
85
+ return r.pathname === i.pathname ? (h(r.hash), !1) : !0;
86
+ }
87
+ function y(e) {
88
+ let t = new URL(e, "http://a.com");
89
+ return t.pathname = t.pathname.replace(/(^|\/)index(\.html)?$/, "$1"), t.pathname + t.search + t.hash;
90
+ }
91
+ //#endregion
92
+ //#region src/client/app/components/Content.ts
93
+ var b = n({
94
+ name: "TypedownContent",
95
+ setup() {
96
+ let e = g();
97
+ return () => e.contentSfc ? r(e.contentSfc) : void 0;
98
+ }
99
+ }), x = "td-theme";
100
+ function S(e) {
101
+ if (typeof document > "u") return;
102
+ let t = e === "system" ? C() : e;
103
+ document.documentElement.classList.toggle("dark", t === "dark");
104
+ }
105
+ function C() {
106
+ return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
107
+ }
108
+ var w = l("system"), T = l(C()), E = !1;
109
+ function D() {
110
+ O();
111
+ let t = e(() => w.value === "system" ? T.value : w.value), n = e(() => t.value === "dark");
112
+ function r(e) {
113
+ w.value = e, S(e), typeof localStorage < "u" && localStorage.setItem(x, e);
114
+ }
115
+ function i() {
116
+ r(t.value === "light" ? "dark" : "light");
117
+ }
118
+ return {
119
+ theme: c(w),
120
+ effectiveTheme: t,
121
+ isDark: n,
122
+ setTheme: r,
123
+ toggle: i
124
+ };
125
+ }
126
+ function O() {
127
+ if (!E) {
128
+ if (E = !0, typeof localStorage < "u") {
129
+ let e = localStorage.getItem(x);
130
+ (e === "light" || e === "dark" || e === "system") && (w.value = e);
131
+ }
132
+ S(w.value), typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
133
+ T.value = C(), w.value === "system" && S("system");
134
+ });
135
+ }
136
+ }
137
+ //#endregion
138
+ //#region src/client/app/composables/useTdContent.ts
139
+ var [k, A] = u(j);
140
+ function j(t) {
141
+ let n = D();
142
+ return {
143
+ page: e(() => t.data),
144
+ frontmatter: e(() => t.data.frontmatter),
145
+ title: e(() => t.data.title),
146
+ isDark: e(() => n.isDark.value)
147
+ };
148
+ }
149
+ //#endregion
150
+ //#region src/client/app/index.ts
151
+ var M = Symbol("typedown-site-config"), N = Symbol("typedown-site-data");
152
+ async function P(e, i, a = {}, o = {}) {
153
+ let s = {
154
+ title: a.title ?? "",
155
+ description: a.description ?? ""
156
+ }, c = { sidebarGroups: o.sidebarGroups ?? {} }, l = m(e), u = t(n({
157
+ name: "TypedownApp",
158
+ setup() {
159
+ return k(l.route), () => r(i);
160
+ }
161
+ }));
162
+ return u.provide(f, l), u.provide(M, s), u.provide(N, c), u.component("TypedownContent", b), d && await l.go(location.href, {
163
+ replace: !0,
164
+ initialLoad: !0
165
+ }), {
166
+ app: u,
167
+ router: l
168
+ };
169
+ }
170
+ function F() {
171
+ return i(M, {
172
+ title: "",
173
+ description: ""
174
+ });
175
+ }
176
+ function I() {
177
+ return i(N, { sidebarGroups: {} });
178
+ }
179
+ //#endregion
180
+ export { D as a, _ as c, A as i, F as n, b as o, I as r, g as s, P as t };
@@ -0,0 +1,19 @@
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
+ //#region src/shared/brand.ts
17
+ var i = "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", a = "M30 30h70v16h-27v52h-16v-52h-27z", o = "m155 98-30-33h20v-35h20v35h20z", s = "0 0 208 128", c = "#a0522d", l = `<svg fill='none' viewBox='${s}' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='${i}' fill-rule='evenodd' fill='${c}'/><path d='${a}' fill='${c}'/><path d='${o}' fill='${c}'/></svg>`, u = `data:image/svg+xml,${encodeURIComponent(l)}`;
18
+ //#endregion
19
+ export { s as a, n as c, a as i, i as n, e as o, u as r, t as s, o as t };
@@ -0,0 +1,13 @@
1
+ //#region ../../node_modules/.pnpm/mathxyjax3@0.8.3/node_modules/mathxyjax3/dist/chunk-DfAF0w94.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), t.exports), s = (e, i, o, s) => {
3
+ 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, {
4
+ get: ((e) => i[e]).bind(null, d),
5
+ enumerable: !(s = n(i, d)) || s.enumerable
6
+ });
7
+ return e;
8
+ }, c = (n, r, a) => (a = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule ? t(a, "default", {
9
+ value: n,
10
+ enumerable: !0
11
+ }) : a, n)), l = (e) => (t) => c(t.default, e);
12
+ //#endregion
13
+ export { o as n, l as t };
@@ -0,0 +1,4 @@
1
+ export declare const Content: import("vue").DefineComponent<{}, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
2
+ [key: string]: any;
3
+ }> | undefined, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
4
+ //# sourceMappingURL=Content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Content.d.ts","sourceRoot":"","sources":["../../../../src/client/app/components/Content.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,OAAO;;uPAOlB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Route } from '../router';
2
+ import type { TypedownData } from '@/shared';
3
+ export declare const provideTdContent: (route: Route) => TypedownData, useTdContent: () => TypedownData | undefined;
4
+ //# sourceMappingURL=useTdContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTdContent.d.ts","sourceRoot":"","sources":["../../../../src/client/app/composables/useTdContent.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,KAAK,EACN,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EACV,YAAY,EACb,MAAM,UAAU,CAAC;AAElB,eAAO,MACL,gBAAgB,kCAChB,YAAY,gCACyB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export type Theme = 'light' | 'dark' | 'system';
2
+ export declare function useTheme(): {
3
+ theme: Readonly<import("vue").Ref<Theme, Theme>>;
4
+ effectiveTheme: import("vue").ComputedRef<"light" | "dark">;
5
+ isDark: import("vue").ComputedRef<boolean>;
6
+ setTheme: (newTheme: Theme) => void;
7
+ toggle: () => void;
8
+ };
9
+ //# sourceMappingURL=useTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTheme.d.ts","sourceRoot":"","sources":["../../../../src/client/app/composables/useTheme.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AA0BhD,wBAAgB,QAAQ;;;;yBAQO,KAAK,KAAG,IAAI;kBASrB,IAAI;EAWzB"}
@@ -1 +1,23 @@
1
+ import { type App, type Component } from 'vue';
2
+ import { type Router } from './router';
3
+ import { type PageModule, type SidebarGroups } from '@/shared';
4
+ export { useTdContent, } from './composables/useTdContent';
5
+ export { useRouter, useRoute, } from './router';
6
+ export { Content, } from './components/Content';
7
+ export interface TypedownSiteConfig {
8
+ /** Site title */
9
+ title: string;
10
+ /** Site description */
11
+ description: string;
12
+ }
13
+ export interface TypedownSiteData {
14
+ /** Content files grouped by schema */
15
+ sidebarGroups: SidebarGroups;
16
+ }
17
+ export declare function createTypedownApp(loadPageModule: (path: string) => Promise<PageModule | undefined>, Layout: Component, config?: Partial<TypedownSiteConfig>, data?: Partial<TypedownSiteData>): Promise<{
18
+ app: App;
19
+ router: Router;
20
+ }>;
21
+ export declare function useSiteConfig(): TypedownSiteConfig;
22
+ export declare function useSiteData(): TypedownSiteData;
1
23
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/app/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,GAAG,EACR,KAAK,SAAS,EAEf,MAAM,KAAK,CAAC;AAOb,OAAO,EACuB,KAAK,MAAM,EACxC,MAAM,UAAU,CAAC;AAClB,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,aAAa,EACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EACL,YAAY,GACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,SAAS,EAAE,QAAQ,GACpB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,OAAO,GACR,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,kBAAkB;IACjC,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,sCAAsC;IACtC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAKD,wBAAsB,iBAAiB,CACrC,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,EACjE,MAAM,EAAE,SAAS,EACjB,MAAM,GAAE,OAAO,CAAC,kBAAkB,CAAM,EACxC,IAAI,GAAE,OAAO,CAAC,gBAAgB,CAAM,GACnC,OAAO,CAAC;IACT,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC,CAuCD;AAED,wBAAgB,aAAa,IAAK,kBAAkB,CAKnD;AAED,wBAAgB,WAAW,IAAK,gBAAgB,CAI/C"}
@@ -0,0 +1,24 @@
1
+ import type { Component, InjectionKey } from 'vue';
2
+ import type { PageData, PageModule } from '@/shared';
3
+ export interface Route {
4
+ path: string;
5
+ hash: string;
6
+ query: string;
7
+ contentSfc: Component | undefined;
8
+ data: PageData;
9
+ }
10
+ export interface Router {
11
+ route: Route;
12
+ go: (to: string, options?: {
13
+ replace?: boolean;
14
+ initialLoad?: boolean;
15
+ }) => Promise<void>;
16
+ onBeforeRouteChange?: (to: string) => Promise<boolean | undefined> | boolean | undefined;
17
+ onAfterRouteChange?: (to: string) => Promise<undefined> | undefined;
18
+ }
19
+ export declare const routerSymbol: InjectionKey<Router>;
20
+ export declare function createRouter(loadPageModule: (path: string) => Promise<PageModule | undefined>, fallbackComponent?: Component): Router;
21
+ export declare function scrollToHash(hash: string): void;
22
+ export declare function useRoute(): Route;
23
+ export declare function useRouter(): Router;
24
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/client/app/router.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAAE,YAAY,EACxB,MAAM,KAAK,CAAC;AAIb,OAAO,KAAK,EACV,QAAQ,EAAE,UAAU,EACrB,MAAM,UAAU,CAAC;AAKlB,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,SAAS,GAAG,SAAS,CAAC;IAClC,IAAI,EAAE,QAAQ,CAAC;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,KAAK,CAAC;IACb,EAAE,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QACzB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,WAAW,CAAC,EAAE,OAAO,CAAC;KACvB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpB,mBAAmB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,GAAG,OAAO,GAAG,SAAS,CAAC;IACzF,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;CACrE;AAED,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,MAAM,CAA6B,CAAC;AAU5E,wBAAgB,YAAY,CAC1B,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,EACjE,iBAAiB,CAAC,EAAE,SAAS,GAC5B,MAAM,CAoIR;AAGD,wBAAgB,YAAY,CAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAchD;AAGD,wBAAgB,QAAQ,IAAK,KAAK,CAEjC;AAGD,wBAAgB,SAAS,IAAK,MAAM,CAMnC"}
@@ -1 +1,2 @@
1
+ export { createTypedownApp, useTdContent, useRouter, useRoute, useSiteConfig, useSiteData, Content, } from './app';
1
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAAE,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,OAAO,GAC1F,MAAM,OAAO,CAAC"}
@@ -0,0 +1,339 @@
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-bn8sNpDS.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";
5
+ //#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
+ for (let t in e) if (t.startsWith("aria-") || t === "role" || t === "title") return !0;
8
+ 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);
11
+ return t.charAt(0).toUpperCase() + t.slice(1);
12
+ }, M = {
13
+ xmlns: "http://www.w3.org/2000/svg",
14
+ width: 24,
15
+ height: 24,
16
+ viewBox: "0 0 24 24",
17
+ fill: "none",
18
+ stroke: "currentColor",
19
+ "stroke-width": 2,
20
+ "stroke-linecap": "round",
21
+ "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,
24
+ ...c,
25
+ width: o,
26
+ height: o,
27
+ 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, {
32
+ ...i,
33
+ ...n,
34
+ iconNode: t,
35
+ name: e
36
+ }, r), P = N("chevron-down", [["path", {
37
+ d: "m6 9 6 6 6-6",
38
+ key: "qrunsl"
39
+ }]]), F = N("menu", [
40
+ ["path", {
41
+ d: "M4 5h16",
42
+ key: "1tepv9"
43
+ }],
44
+ ["path", {
45
+ d: "M4 12h16",
46
+ key: "1lakjw"
47
+ }],
48
+ ["path", {
49
+ d: "M4 19h16",
50
+ key: "1djgab"
51
+ }]
52
+ ]), I = N("moon", [["path", {
53
+ 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
+ key: "kfwtm"
55
+ }]]), L = N("sun", [
56
+ ["circle", {
57
+ cx: "12",
58
+ cy: "12",
59
+ r: "4",
60
+ key: "4exip2"
61
+ }],
62
+ ["path", {
63
+ d: "M12 2v2",
64
+ key: "tus03m"
65
+ }],
66
+ ["path", {
67
+ d: "M12 20v2",
68
+ key: "1lh1kg"
69
+ }],
70
+ ["path", {
71
+ d: "m4.93 4.93 1.41 1.41",
72
+ key: "149t6j"
73
+ }],
74
+ ["path", {
75
+ d: "m17.66 17.66 1.41 1.41",
76
+ key: "ptbguv"
77
+ }],
78
+ ["path", {
79
+ d: "M2 12h2",
80
+ key: "1t8f8n"
81
+ }],
82
+ ["path", {
83
+ d: "M20 12h2",
84
+ key: "1q8mjw"
85
+ }],
86
+ ["path", {
87
+ d: "m6.34 17.66-1.41 1.41",
88
+ key: "1m8zz5"
89
+ }],
90
+ ["path", {
91
+ d: "m19.07 4.93-1.41 1.41",
92
+ key: "1shlcs"
93
+ }]
94
+ ]), R = N("x", [["path", {
95
+ d: "M18 6 6 18",
96
+ key: "1bl5f8"
97
+ }], ["path", {
98
+ d: "m6 6 12 12",
99
+ key: "d8bk6v"
100
+ }]]), z = [
101
+ "height",
102
+ "width",
103
+ "viewBox"
104
+ ], B = ["d"], V = ["d"], H = ["d"], U = /* @__PURE__ */ _({
105
+ __name: "TdBrandIcon",
106
+ props: { size: { default: 28 } },
107
+ setup(r) {
108
+ return (i, o) => (S(), m("svg", {
109
+ fill: "none",
110
+ height: r.size,
111
+ width: r.size * 208 / 128,
112
+ viewBox: D(e),
113
+ xmlns: "http://www.w3.org/2000/svg"
114
+ }, [
115
+ h("path", {
116
+ "clip-rule": "evenodd",
117
+ d: D(n),
118
+ "fill-rule": "evenodd",
119
+ fill: "currentColor"
120
+ }, null, 8, B),
121
+ h("path", {
122
+ d: D(t),
123
+ fill: "currentColor"
124
+ }, null, 8, V),
125
+ h("path", {
126
+ d: D(a),
127
+ fill: "currentColor"
128
+ }, null, 8, H)
129
+ ], 8, z));
130
+ }
131
+ }), W = ["title", "aria-label"], G = /* @__PURE__ */ _({
132
+ __name: "TdButton",
133
+ props: { label: {} },
134
+ setup(e) {
135
+ return (t, n) => (S(), m("button", {
136
+ type: "button",
137
+ class: "inline-flex items-center justify-center cursor-pointer",
138
+ title: e.label,
139
+ "aria-label": e.label
140
+ }, [T(t.$slots, "default")], 8, W));
141
+ }
142
+ }), le = ["aria-expanded", "onClick"], ue = { key: 0 }, de = ["href"], fe = /*@__PURE__*/ _({
143
+ __name: "TdContentNav",
144
+ props: { groups: {} },
145
+ setup(e) {
146
+ let t = C({});
147
+ function n(e) {
148
+ t.value[e] = !t.value[e];
149
+ }
150
+ return (a, o) => (S(), m("nav", null, [(S(!0), m(u, null, w(e.groups, (e, a) => (S(), m("div", {
151
+ key: a,
152
+ class: "td-content-nav-group"
153
+ }, [h("button", {
154
+ type: "button",
155
+ class: "td-content-nav-label",
156
+ "aria-expanded": !t.value[a],
157
+ onClick: () => n(String(a))
158
+ }, [g(D(P), {
159
+ 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),
164
+ class: "td-content-nav-link"
165
+ }, E(D(r)(e)), 9, de))), 128))]))]))), 128))]));
166
+ }
167
+ }), K = (e, t) => {
168
+ let n = e.__vccOpts || e;
169
+ for (let [e, r] of t) n[e] = r;
170
+ return n;
171
+ }, q = /*#__PURE__*/ K(fe, [["__scopeId", "data-v-deed59ce"]]), J = C(!1);
172
+ function Y() {
173
+ function e() {
174
+ J.value = !J.value;
175
+ }
176
+ function t() {
177
+ J.value = !1;
178
+ }
179
+ return {
180
+ isOpen: re(J),
181
+ toggle: e,
182
+ close: t
183
+ };
184
+ }
185
+ //#endregion
186
+ //#region src/client/theme-default/components/TdMenuButton.vue
187
+ var pe = /* @__PURE__ */ _({
188
+ __name: "TdMenuButton",
189
+ setup(e) {
190
+ let { isOpen: t, toggle: n } = Y();
191
+ return (e, r) => (S(), f(G, {
192
+ class: "td-menu-button w-9 h-9 text-td-gray-600 group",
193
+ label: D(t) ? "Close menu" : "Open menu",
194
+ "aria-expanded": D(t),
195
+ onClick: D(n)
196
+ }, {
197
+ default: k(() => [D(t) ? (S(), f(D(R), {
198
+ key: 0,
199
+ size: 20,
200
+ class: "group-hover:text-td-primary transition-colors"
201
+ })) : (S(), f(D(F), {
202
+ key: 1,
203
+ size: 20,
204
+ class: "group-hover:text-td-primary transition-colors"
205
+ }))]),
206
+ _: 1
207
+ }, 8, [
208
+ "label",
209
+ "aria-expanded",
210
+ "onClick"
211
+ ]));
212
+ }
213
+ }), me = /* @__PURE__ */ _({
214
+ __name: "TdThemeToggle",
215
+ setup(e) {
216
+ let { isDark: t, toggle: n } = o();
217
+ return (e, r) => (S(), f(G, {
218
+ class: "w-9 h-9 text-td-gray-600 group hover:opacity-70",
219
+ label: D(t) ? "Switch to light mode" : "Switch to dark mode",
220
+ onClick: D(n)
221
+ }, {
222
+ default: k(() => [D(t) ? (S(), f(D(L), {
223
+ key: 0,
224
+ size: 18,
225
+ class: "group-hover:text-td-secondary transition-colors"
226
+ })) : (S(), f(D(I), {
227
+ key: 1,
228
+ size: 18,
229
+ class: "group-hover:text-td-primary transition-colors"
230
+ }))]),
231
+ _: 1
232
+ }, 8, ["label", "onClick"]));
233
+ }
234
+ });
235
+ //#endregion
236
+ //#region src/client/theme-default/composables/useCopyCode.ts
237
+ function X() {
238
+ function e(e) {
239
+ let t = e.target?.closest(".copy");
240
+ if (!t) return;
241
+ let n = t.closest("div[class*=\"language-\"]")?.querySelector("code");
242
+ if (!n) return;
243
+ navigator.clipboard.writeText(n.textContent ?? "").catch(() => {}), t.classList.add("copied");
244
+ let r = t.getAttribute("data-copied") ?? "Copied", i = t.getAttribute("title") ?? "";
245
+ t.setAttribute("title", r), setTimeout(() => {
246
+ t.classList.remove("copied"), t.setAttribute("title", i);
247
+ }, 2e3);
248
+ }
249
+ b(() => {
250
+ document.addEventListener("click", e);
251
+ }), x(() => {
252
+ document.removeEventListener("click", e);
253
+ });
254
+ }
255
+ //#endregion
256
+ //#region src/client/theme-default/TdLayout.vue?vue&type=script&setup=true&lang.ts
257
+ var he = { class: "td-header" }, ge = { class: "td-header-left" }, _e = {
258
+ href: "/",
259
+ class: "td-brand"
260
+ }, ve = { class: "td-brand-name" }, ye = { class: "td-header-right" }, be = { class: "td-menu-header" }, xe = { class: "td-header-left" }, Se = {
261
+ href: "/",
262
+ class: "td-brand"
263
+ }, Ce = { class: "td-brand-name" }, we = {
264
+ class: "pt-4",
265
+ "aria-label": "Site navigation"
266
+ }, Te = { class: "td-page" }, Ee = {
267
+ class: "td-sidebar-left",
268
+ "aria-label": "Site navigation"
269
+ }, De = { class: "td-sidebar-left-inner" }, Oe = { class: "td-main-and-toc" }, ke = { class: "td-main" }, Ae = { class: "td-content" }, je = {
270
+ key: 0,
271
+ class: "td-page-title"
272
+ }, Me = {
273
+ class: "td-sidebar-right",
274
+ "aria-label": "Table of contents"
275
+ }, Ne = { class: "td-sidebar-right-inner" }, Pe = {
276
+ key: 0,
277
+ class: "td-toc"
278
+ }, Fe = { class: "td-toc-list" }, Ie = ["href"], Z = /*#__PURE__*/ K(/* @__PURE__ */ _({
279
+ __name: "TdLayout",
280
+ 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, {
285
+ class: "w-9 h-9 text-td-gray-600 hover:text-td-primary",
286
+ label: "Close menu",
287
+ onClick: D(o)
288
+ }, {
289
+ default: k(() => [g(D(R), { size: 20 })]),
290
+ _: 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", {
293
+ key: e.slug,
294
+ class: y({
295
+ "td-toc-indent-1": e.level === 3,
296
+ "td-toc-indent-2": e.level === 4,
297
+ "td-toc-indent-3": e.level === 5
298
+ })
299
+ }, [h("a", {
300
+ href: e.link,
301
+ class: "td-toc-link"
302
+ }, E(e.title), 9, Ie)], 2))), 128))])])) : p("", !0)])])])])
303
+ ]));
304
+ }
305
+ }), [["__scopeId", "data-v-f2419b0d"]]), Le = {}, Re = { class: "pt-16 pb-24" };
306
+ 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", {
312
+ 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
+ href: "/"
314
+ }, "Go Home", -1)
315
+ ]]);
316
+ }
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
+ __name: "TdOverview",
319
+ props: { groups: {} },
320
+ setup(e) {
321
+ let t = d(() => Object.entries(e.groups).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => ({
322
+ schema: e,
323
+ items: [...t].sort((e, t) => r(e).localeCompare(r(t)))
324
+ })));
325
+ return (e, n) => (S(), m("div", ze, [(S(!0), m(u, null, w(t.value, (e) => (S(), m("section", {
326
+ key: e.schema,
327
+ 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),
331
+ 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
+ }
334
+ }), [["__scopeId", "data-v-0d07be91"]]), qe = {
335
+ Layout: Z,
336
+ NotFound: $
337
+ };
338
+ //#endregion
339
+ export { Z as TdLayout, $ as TdNotFound, Ke as TdOverview, qe as default, X as useCopyCode };
package/dist/client.js ADDED
@@ -0,0 +1,2 @@
1
+ import { c as e, i as t, n, o as r, r as i, s as a, t as o } from "./app-bn8sNpDS.js";
2
+ export { r as Content, o as createTypedownApp, a as useRoute, e as useRouter, n as useSiteConfig, i as useSiteData, t as useTdContent };
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { default } from './node/index';
1
+ export * from './node/index';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}