typerighter 0.4.3 → 0.30.3

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 (118) hide show
  1. package/dist/app-gH0dpuch.js +2382 -0
  2. package/dist/brand-CG1fQshq.js +5 -0
  3. package/dist/cli-BFgBPypP.js +440 -0
  4. package/dist/cli.js +1 -1
  5. package/dist/client/app/index.d.ts +43 -4
  6. package/dist/client/app/index.d.ts.map +1 -1
  7. package/dist/client/app/router.d.ts +6 -2
  8. package/dist/client/app/router.d.ts.map +1 -1
  9. package/dist/client/theme-default.js +2314 -593
  10. package/dist/client.js +1 -1
  11. package/dist/fonts.css +2 -0
  12. package/dist/index.js +3 -4
  13. package/dist/init-EKDV1L4U.js +821 -0
  14. package/dist/math.css +1 -0
  15. package/dist/node/build/index.d.ts.map +1 -1
  16. package/dist/node/build/prerender.d.ts +2 -0
  17. package/dist/node/build/prerender.d.ts.map +1 -1
  18. package/dist/node/cli/index.d.ts.map +1 -1
  19. package/dist/node/cli/init.d.ts +7 -1
  20. package/dist/node/cli/init.d.ts.map +1 -1
  21. package/dist/node/context.d.ts.map +1 -1
  22. package/dist/node/lib/html-template.d.ts +22 -0
  23. package/dist/node/lib/html-template.d.ts.map +1 -0
  24. package/dist/node/lib/image-dimensions.d.ts +6 -0
  25. package/dist/node/lib/image-dimensions.d.ts.map +1 -0
  26. package/dist/node/lib/index.d.ts +0 -1
  27. package/dist/node/lib/index.d.ts.map +1 -1
  28. package/dist/node/lib/progress.d.ts +2 -0
  29. package/dist/node/lib/progress.d.ts.map +1 -1
  30. package/dist/node/lib/render/highlight/index.d.ts.map +1 -0
  31. package/dist/node/lib/render/highlight/language.d.ts.map +1 -0
  32. package/dist/node/lib/render/postprocess.d.ts +2 -0
  33. package/dist/node/lib/render/postprocess.d.ts.map +1 -0
  34. package/dist/node/lib/render/vue.d.ts +1 -0
  35. package/dist/node/lib/render/vue.d.ts.map +1 -1
  36. package/dist/node/{plugin/vite/search.d.ts → lib/search-indexer/index.d.ts} +2 -3
  37. package/dist/node/lib/search-indexer/index.d.ts.map +1 -0
  38. package/dist/node/lib/search-indexer/scan.d.ts +4 -0
  39. package/dist/node/lib/search-indexer/scan.d.ts.map +1 -0
  40. package/dist/node/lib/typedown-context.d.ts +6 -10
  41. package/dist/node/lib/typedown-context.d.ts.map +1 -1
  42. package/dist/node/plugin/vite/constants.d.ts +6 -0
  43. package/dist/node/plugin/vite/constants.d.ts.map +1 -1
  44. package/dist/node/plugin/vite/index.d.ts +7 -13
  45. package/dist/node/plugin/vite/index.d.ts.map +1 -1
  46. package/dist/node/plugin/vite/middleware/index.d.ts +3 -0
  47. package/dist/node/plugin/vite/middleware/index.d.ts.map +1 -0
  48. package/dist/node/plugin/vite/middleware/vault-assets.d.ts +5 -0
  49. package/dist/node/plugin/vite/middleware/vault-assets.d.ts.map +1 -0
  50. package/dist/node/plugin/vite/middleware/virtual-html.d.ts +6 -0
  51. package/dist/node/plugin/vite/middleware/virtual-html.d.ts.map +1 -0
  52. package/dist/node/plugin/vite/virtual/app.d.ts +23 -0
  53. package/dist/node/plugin/vite/virtual/app.d.ts.map +1 -0
  54. package/dist/node/plugin/vite/virtual/pages.d.ts +12 -0
  55. package/dist/node/plugin/vite/virtual/pages.d.ts.map +1 -0
  56. package/dist/node/plugin/vite/virtual/search-index.d.ts +11 -0
  57. package/dist/node/plugin/vite/virtual/search-index.d.ts.map +1 -0
  58. package/dist/node/plugin/vite/virtual/site-data.d.ts +13 -0
  59. package/dist/node/plugin/vite/virtual/site-data.d.ts.map +1 -0
  60. package/dist/node/plugin/vite/virtual/utils.d.ts +8 -0
  61. package/dist/node/plugin/vite/virtual/utils.d.ts.map +1 -0
  62. package/dist/shared/constants.d.ts.map +1 -1
  63. package/dist/shared/types/content.d.ts +42 -11
  64. package/dist/shared/types/content.d.ts.map +1 -1
  65. package/dist/shared/types/index.d.ts +0 -1
  66. package/dist/shared/types/index.d.ts.map +1 -1
  67. package/dist/shared/types/ssg.d.ts +15 -3
  68. package/dist/shared/types/ssg.d.ts.map +1 -1
  69. package/dist/shared/utils/content.d.ts +5 -3
  70. package/dist/shared/utils/content.d.ts.map +1 -1
  71. package/dist/shared/utils/field.d.ts +2 -0
  72. package/dist/shared/utils/field.d.ts.map +1 -0
  73. package/dist/shared/utils/html.d.ts +1 -0
  74. package/dist/shared/utils/html.d.ts.map +1 -1
  75. package/dist/shared/utils/index.d.ts +1 -0
  76. package/dist/shared/utils/index.d.ts.map +1 -1
  77. package/dist/shared/utils/path.d.ts +1 -0
  78. package/dist/shared/utils/path.d.ts.map +1 -1
  79. package/dist/shared/utils/url.d.ts +9 -1
  80. package/dist/shared/utils/url.d.ts.map +1 -1
  81. package/dist/shared-BuA2cqMO.js +401 -0
  82. package/dist/shared.js +2 -0
  83. package/dist/temml-DZbhOfRE.js +8146 -0
  84. package/dist/typerighter.css +1 -1
  85. package/dist/vite-CYozrIIG.js +1468 -0
  86. package/dist/vite.js +2 -2
  87. package/package.json +26 -40
  88. package/dist/app-Bw90hv7G.js +0 -266
  89. package/dist/brand-CmL-6h9U.js +0 -203
  90. package/dist/cli-BbvLsY1i.js +0 -640
  91. package/dist/constants-7heqadyd.js +0 -32183
  92. package/dist/init-DCkztTxJ.js +0 -2356
  93. package/dist/node/lib/markdown/index.d.ts +0 -5
  94. package/dist/node/lib/markdown/index.d.ts.map +0 -1
  95. package/dist/node/lib/markdown/plugins/callout-container.d.ts +0 -4
  96. package/dist/node/lib/markdown/plugins/callout-container.d.ts.map +0 -1
  97. package/dist/node/lib/markdown/plugins/custom-container.d.ts +0 -3
  98. package/dist/node/lib/markdown/plugins/custom-container.d.ts.map +0 -1
  99. package/dist/node/lib/markdown/plugins/highlight/index.d.ts.map +0 -1
  100. package/dist/node/lib/markdown/plugins/highlight/language.d.ts.map +0 -1
  101. package/dist/node/lib/markdown/plugins/image.d.ts +0 -3
  102. package/dist/node/lib/markdown/plugins/image.d.ts.map +0 -1
  103. package/dist/node/lib/markdown/plugins/line-number.d.ts +0 -3
  104. package/dist/node/lib/markdown/plugins/line-number.d.ts.map +0 -1
  105. package/dist/node/lib/markdown/plugins/link.d.ts +0 -3
  106. package/dist/node/lib/markdown/plugins/link.d.ts.map +0 -1
  107. package/dist/node/lib/markdown/plugins/pre-wrapper.d.ts +0 -6
  108. package/dist/node/lib/markdown/plugins/pre-wrapper.d.ts.map +0 -1
  109. package/dist/node/lib/markdown/plugins/restore-entities.d.ts +0 -3
  110. package/dist/node/lib/markdown/plugins/restore-entities.d.ts.map +0 -1
  111. package/dist/node/lib/markdown/plugins/table.d.ts +0 -3
  112. package/dist/node/lib/markdown/plugins/table.d.ts.map +0 -1
  113. package/dist/node/plugin/vite/search.d.ts.map +0 -1
  114. package/dist/shared/types/markdown.d.ts +0 -62
  115. package/dist/shared/types/markdown.d.ts.map +0 -1
  116. package/dist/vite-B-ktlRz9.js +0 -309
  117. /package/dist/node/lib/{markdown/plugins → render}/highlight/index.d.ts +0 -0
  118. /package/dist/node/lib/{markdown/plugins → render}/highlight/language.d.ts +0 -0
package/dist/vite.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./vite-B-ktlRz9.js";
2
- export { t as generateClientAppEntry, e as typedown };
1
+ import { n as e, t } from "./vite-CYozrIIG.js";
2
+ export { e as generateClientAppEntry, t as typedown };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "typerighter",
4
- "version": "0.4.3",
4
+ "version": "0.30.3",
5
5
  "description": "Typedown: A typed content framework.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,12 +27,21 @@
27
27
  "types": "./dist/client/index.d.ts",
28
28
  "import": "./dist/client.js"
29
29
  },
30
+ "./shared": {
31
+ "types": "./dist/shared/index.d.ts",
32
+ "import": "./dist/shared.js"
33
+ },
30
34
  "./client/theme-default": {
31
35
  "types": "./dist/client/theme-default/index.d.ts",
32
36
  "import": "./dist/client/theme-default.js"
33
37
  },
34
- "./style.css": "./dist/typerighter.css"
38
+ "./style.css": "./dist/typerighter.css",
39
+ "./fonts.css": "./dist/fonts.css",
40
+ "./math.css": "./dist/math.css"
35
41
  },
42
+ "sideEffects": [
43
+ "*.css"
44
+ ],
36
45
  "files": [
37
46
  "bin",
38
47
  "dist"
@@ -46,56 +55,33 @@
46
55
  "license": "AGPL-3.0-only",
47
56
  "dependencies": {
48
57
  "@clack/prompts": "^1.7.0",
58
+ "@floating-ui/vue": "^2.0.1",
49
59
  "@fontsource-variable/archivo": "^5.3.0",
50
60
  "@fontsource-variable/jetbrains-mono": "^5.3.0",
51
- "@lucide/vue": "^1.30.0",
52
- "@mdit-vue/plugin-frontmatter": "^3.0.2",
53
- "@mdit-vue/plugin-headers": "^3.0.2",
54
- "@mdit-vue/plugin-title": "^3.0.2",
55
- "@mdit-vue/plugin-toc": "^3.0.2",
56
- "@mdit-vue/shared": "^3.0.2",
57
- "@mdit/plugin-anchor": "^1.1.1",
58
- "@mdit/plugin-attrs": "^1.1.1",
59
- "@mdit/plugin-container": "^1.0.1",
60
- "@mdit/plugin-emoji": "^1.1.0",
61
- "@mdit/plugin-katex": "^1.0.2",
62
- "@mdit/plugin-tasklist": "^1.0.1",
63
- "@shikijs/markdown-it": "^4.3.1",
64
- "@shikijs/transformers": "^4.3.1",
65
- "@shikijs/types": "^4.3.1",
61
+ "@lucide/vue": "^1.39.0",
62
+ "@shikijs/transformers": "^4.4.3",
66
63
  "@tailwindcss/vite": "^4.3.3",
67
- "@vitejs/plugin-vue": "^5.0.0 || ^6.0.0",
68
- "@vue/shared": "^3.5.41",
64
+ "@vitejs/plugin-vue": "^6.0.8",
69
65
  "cac": "^7.0.0",
70
- "image-size": "^2.0.2",
71
- "js-yaml": "^5.2.3",
72
- "katex": "^0.18.1",
73
- "markdown-it": "^14.0.0",
74
- "markdown-it-anchor": "^9.0.0",
75
- "markdown-it-async": "^2.2.0",
76
- "markdown-it-container": "^4.0.0",
77
- "markdown-it-emoji": "^3.0.0",
78
- "markdown-it-task-lists": "^2.1.1",
79
66
  "picocolors": "^1.1.1",
80
- "shiki": "^4.3.1",
67
+ "shiki": "^4.4.3",
68
+ "striptags": "^3.2.0",
81
69
  "tailwindcss": "^4.3.3",
82
- "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
83
- "vue": "^3.0.0",
84
- "@typerighter/rpc-client": "0.4.3",
85
- "@typerighter/rpc-server": "0.4.3"
70
+ "temml": "^0.13.5",
71
+ "vite": "^8.2.2",
72
+ "vue": "^3.5.42",
73
+ "@typerighter/rpc-client": "0.30.3",
74
+ "@typerighter/rpc-server": "0.30.3"
86
75
  },
87
76
  "devDependencies": {
88
- "@hdnax/nuclint": "^0.17.4",
89
- "@types/js-yaml": "^4.0.9",
90
- "@types/markdown-it": "^14.0.0",
91
- "@types/markdown-it-container": "^4.0.0",
92
- "@types/markdown-it-emoji": "^3.0.1",
93
- "@types/node": "~24.13.3",
77
+ "@hdnax/nuclint": "^0.17.5",
78
+ "@types/node": "^26.4.1",
94
79
  "minisearch": "^7.2.0",
95
80
  "typescript": "^6.0.3",
96
- "vitest": "^4.1.5"
81
+ "vitest": "^4.1.11"
97
82
  },
98
83
  "scripts": {
84
+ "dev": "vite",
99
85
  "build": "vite build && tsc -p tsconfig.build.json --emitDeclarationOnly",
100
86
  "lint": "eslint .",
101
87
  "lint:fix": "eslint ./src --fix",
@@ -1,266 +0,0 @@
1
- import { computed as e, createApp as t, createElementBlock as n, createElementVNode as r, defineComponent as i, h as a, inject as o, markRaw as s, mergeProps as c, nextTick as l, openBlock as u, provide as d, reactive as f, readonly as p, ref as m, renderSlot as h, shallowRef as g, toDisplayString as _, watch as v, withKeys as y, withModifiers as b } from "vue";
2
- //#region src/client/theme-default/components/custom/TdFlashcard.vue?vue&type=script&setup=true&lang.ts
3
- var x = [
4
- "id",
5
- "tabindex",
6
- "aria-pressed",
7
- "aria-label",
8
- "onKeydown"
9
- ], ee = { class: "flashcard__face flashcard__face--question" }, S = { class: "flashcard__label" }, C = { class: "flashcard__body" }, w = { class: "flashcard__face flashcard__face--key" }, T = { class: "flashcard__label" }, E = { class: "flashcard__body" }, te = /*@__PURE__*/ i({
10
- inheritAttrs: !1,
11
- __name: "TdFlashcard",
12
- props: {
13
- id: { default: () => void 0 },
14
- revealed: {
15
- type: Boolean,
16
- default: !1
17
- },
18
- disabled: {
19
- type: Boolean,
20
- default: !1
21
- },
22
- questionLabel: { default: "Question" },
23
- keyLabel: { default: "Answer" }
24
- },
25
- setup(e, { expose: t }) {
26
- let i = m(e.revealed);
27
- v(() => e.revealed, () => {
28
- i.value = e.revealed;
29
- });
30
- function a() {
31
- if (e.disabled) return i.value;
32
- let t = i.value;
33
- return i.value = !i.value, t;
34
- }
35
- function o() {
36
- let e = i.value;
37
- return i.value = !0, e;
38
- }
39
- function s() {
40
- let e = i.value;
41
- return i.value = !1, e;
42
- }
43
- return t({
44
- flip: a,
45
- showQuestion: s,
46
- showKey: o,
47
- state: p(i)
48
- }), (t, o) => (u(), n("div", c(t.$attrs, {
49
- id: e.id,
50
- class: ["flashcard", {
51
- "is-revealed": i.value,
52
- "is-disabled": e.disabled
53
- }],
54
- role: "button",
55
- tabindex: e.disabled ? -1 : 0,
56
- "aria-pressed": i.value,
57
- "aria-label": i.value ? e.keyLabel : e.questionLabel,
58
- onClick: a,
59
- onKeydown: [y(b(a, ["prevent"]), ["enter"]), y(b(a, ["prevent"]), ["space"])]
60
- }), [r("div", ee, [r("p", S, _(e.questionLabel), 1), r("div", C, [h(t.$slots, "default")])]), r("div", w, [r("p", T, _(e.keyLabel), 1), r("div", E, [h(t.$slots, "key")])])], 16, x));
61
- }
62
- }), D = (e, t) => {
63
- let n = e.__vccOpts || e;
64
- for (let [e, r] of t) n[e] = r;
65
- return n;
66
- }, O = /*#__PURE__*/ D(te, [["__scopeId", "data-v-120343d9"]]), k = typeof window < "u", A = Symbol("typedown-router"), j = {
67
- frontmatter: {},
68
- headings: [],
69
- title: "Not Found"
70
- };
71
- function M(e, t) {
72
- let n = f({
73
- path: "/",
74
- hash: "",
75
- query: "",
76
- contentSfc: void 0,
77
- data: j
78
- }), r = {
79
- route: n,
80
- async go(e, t) {
81
- e = L(e), await r.onBeforeRouteChange?.(e) !== !1 && ((!k || t?.initialLoad || I(e, t)) && await a(e), o(), await r.onAfterRouteChange?.(e));
82
- }
83
- }, i;
84
- async function a(r) {
85
- let a = new URL(r, "http://a.com"), c = i = a.pathname;
86
- try {
87
- let t = await e(c);
88
- if (!t) throw Error(`Page not found: ${c}`);
89
- if (i === c) {
90
- i = void 0;
91
- let { default: e, __pageData: r } = t;
92
- n.path = c, n.contentSfc = s(e), n.data = s(r), o(a), k && l(() => {
93
- N(a.hash);
94
- });
95
- }
96
- } catch {
97
- i === c && (i = void 0, n.path = c, n.contentSfc = t ? s(t) : void 0, n.data = j, o(a));
98
- }
99
- }
100
- function o(e = k ? location : {
101
- search: "",
102
- hash: ""
103
- }) {
104
- n.query = e.search, n.hash = decodeURIComponent(e.hash);
105
- }
106
- return k && (history.state ?? history.replaceState({}, ""), window.addEventListener("click", (e) => {
107
- if (e.defaultPrevented || !(e.target instanceof Element) || e.button !== 0 || e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
108
- let t = e.target.closest("a");
109
- if (!t || t.hasAttribute("download") || t.hasAttribute("target")) return;
110
- let n = t.getAttribute("href");
111
- if (n === null) return;
112
- let { href: i, origin: a, pathname: o } = new URL(n, t.baseURI);
113
- a === location.origin && !o.match(/\.\w+$/) && (e.preventDefault(), r.go(i));
114
- }, { capture: !0 }), window.addEventListener("popstate", async (e) => {
115
- if (e.state == null) return;
116
- let t = L(location.href);
117
- await a(t), o(), await r.onAfterRouteChange?.(t);
118
- }), window.addEventListener("hashchange", (e) => {
119
- e.preventDefault(), o();
120
- })), r;
121
- }
122
- function N(e) {
123
- if (!e) return;
124
- let t;
125
- try {
126
- t = document.getElementById(decodeURIComponent(e).slice(1)) ?? void 0;
127
- } catch {
128
- return;
129
- }
130
- t?.scrollIntoView({ block: "start" });
131
- }
132
- function P() {
133
- return F().route;
134
- }
135
- function F() {
136
- let e = o(A);
137
- if (!e) throw Error("useRouter() called outside of Typedown app");
138
- return e;
139
- }
140
- function I(e, { replace: t = !1 } = {}) {
141
- let n = L(location.href);
142
- if (e === n) return N(new URL(e, "http://a.com").hash), !1;
143
- t ? history.replaceState({}, "", e) : (history.replaceState({ scrollPosition: window.scrollY }, ""), history.pushState({}, "", e));
144
- let r = new URL(e, location.origin), i = new URL(n, location.origin);
145
- return r.pathname === i.pathname ? (N(r.hash), !1) : !0;
146
- }
147
- function L(e) {
148
- let t = new URL(e, "http://a.com");
149
- return t.pathname = t.pathname.replace(/(^|\/)index(\.html)?$/, "$1"), t.pathname + t.search + t.hash;
150
- }
151
- //#endregion
152
- //#region src/client/app/components/Content.ts
153
- var R = i({
154
- name: "TypedownContent",
155
- setup() {
156
- let e = P();
157
- return () => e.contentSfc ? a(e.contentSfc) : void 0;
158
- }
159
- }), z = "td-theme";
160
- function B(e) {
161
- if (typeof document > "u") return;
162
- let t = e === "system" ? V() : e;
163
- document.documentElement.classList.toggle("dark", t === "dark");
164
- }
165
- function V() {
166
- return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
167
- }
168
- var H = m("system"), U = m(V()), W = !1;
169
- function G() {
170
- K();
171
- let t = e(() => H.value === "system" ? U.value : H.value), n = e(() => t.value === "dark");
172
- function r(e) {
173
- H.value = e, B(e), typeof localStorage < "u" && localStorage.setItem(z, e);
174
- }
175
- function i() {
176
- r(t.value === "light" ? "dark" : "light");
177
- }
178
- return {
179
- theme: p(H),
180
- effectiveTheme: t,
181
- isDark: n,
182
- setTheme: r,
183
- toggle: i
184
- };
185
- }
186
- function K() {
187
- if (!W) {
188
- if (W = !0, typeof localStorage < "u") {
189
- let e = localStorage.getItem(z);
190
- (e === "light" || e === "dark" || e === "system") && (H.value = e);
191
- }
192
- B(H.value), typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
193
- U.value = V(), H.value === "system" && B("system");
194
- });
195
- }
196
- }
197
- //#endregion
198
- //#region src/client/app/composables/useTdContent.ts
199
- var q = Symbol("td-content");
200
- function J(t) {
201
- let n = G(), r = {
202
- page: e(() => t.data),
203
- frontmatter: e(() => t.data.frontmatter),
204
- title: e(() => t.data.title),
205
- isDark: e(() => n.isDark.value)
206
- };
207
- return d(q, r), r;
208
- }
209
- function Y() {
210
- let e = o(q);
211
- if (e === void 0) throw Error("useTdContent() called without a parent provideTdContent()");
212
- return e;
213
- }
214
- //#endregion
215
- //#region src/client/app/index.ts
216
- var X = Symbol("typedown-site-config"), Z = Symbol("typedown-site-data"), Q = Symbol("typedown-page-loader"), $ = Symbol("typedown-search-index");
217
- async function ne(e, n, r = {}, o = {}) {
218
- let s = {
219
- title: r.title ?? "",
220
- description: r.description ?? ""
221
- }, c = {
222
- contentTree: o.contentTree ?? {
223
- rootItems: [],
224
- children: []
225
- },
226
- schemas: o.schemas ?? {}
227
- }, l = M(e), u = t(i({
228
- name: "TypedownApp",
229
- setup() {
230
- return J(l.route), () => a(n);
231
- }
232
- }));
233
- u.provide(A, l), u.provide(X, s), u.provide(Z, c), u.provide(Q, e);
234
- let d = g(o.searchIndex);
235
- return u.provide($, d), u.component("TypedownContent", R), u.component("Flashcard", O), typeof window < "u" && await l.go(location.href, {
236
- replace: !0,
237
- initialLoad: !0
238
- }), {
239
- app: u,
240
- router: l,
241
- searchIndex: d
242
- };
243
- }
244
- function re() {
245
- return o(Q, void 0);
246
- }
247
- function ie() {
248
- return o($, g(void 0));
249
- }
250
- function ae() {
251
- return o(X, {
252
- title: "",
253
- description: ""
254
- });
255
- }
256
- function oe() {
257
- return o(Z, {
258
- contentTree: {
259
- rootItems: [],
260
- children: []
261
- },
262
- schemas: {}
263
- });
264
- }
265
- //#endregion
266
- export { oe as a, R as c, D as d, ae as i, P as l, re as n, Y as o, ie as r, G as s, ne as t, F as u };
@@ -1,203 +0,0 @@
1
- //#region src/shared/constants.ts
2
- var e = "index", t = [".td", ".md"], n = "**/*.{td,md}", r = [
3
- "title",
4
- "titles",
5
- "text"
6
- ], i = ["title", "titles"], a = /^[a-z]+:/i;
7
- //#endregion
8
- //#region src/shared/utils/format.ts
9
- function o(e) {
10
- let t = e.match(/^(\d+)[-_](.+)$/);
11
- return t ? {
12
- order: Number(t[1]),
13
- rest: t[2]
14
- } : {
15
- order: Infinity,
16
- rest: e
17
- };
18
- }
19
- function s(e) {
20
- let { rest: t } = o(e), n = t.replace(/[-_]/g, " ").split(" ");
21
- return 0 < n.length && (n[0] = n[0].charAt(0).toUpperCase() + n[0].slice(1)), n.join(" ");
22
- }
23
- //#endregion
24
- //#region src/shared/utils/path.ts
25
- function c(e, t) {
26
- let n = h(e).split("/").pop() ?? "";
27
- return t !== void 0 && n.endsWith(t) ? n.slice(0, -t.length) : n;
28
- }
29
- function l(e) {
30
- let t = h(e).split("/");
31
- return t.pop(), t.join("/");
32
- }
33
- function u(e) {
34
- let t = c(e), n = t.lastIndexOf(".");
35
- return n <= 0 ? "" : t.slice(n);
36
- }
37
- function d(e) {
38
- let t = c(e), n = t.lastIndexOf(".");
39
- return n <= 0 ? t : t.slice(0, n);
40
- }
41
- function f(e) {
42
- return t.includes(u(e));
43
- }
44
- function p(...e) {
45
- return e.filter(Boolean).join("/").replace(/\\+/g, "/").replace(/\/+/g, "/").replace(/\/$/, "") || "/";
46
- }
47
- function m(e) {
48
- let t = u(e);
49
- return t ? e.slice(0, -t.length) : e;
50
- }
51
- function h(e) {
52
- return e.replace(/\\/g, "/");
53
- }
54
- //#endregion
55
- //#region src/shared/utils/url.ts
56
- function g(e) {
57
- return a.test(e);
58
- }
59
- var _ = new Set("3g2,3gp,aac,ai,apng,au,avif,bin,bmp,cer,class,conf,crl,css,csv,dll,doc,eps,epub,exe,gif,gz,ics,ief,jar,jpe,jpeg,jpg,js,json,jsonld,m4a,man,mid,midi,mjs,mov,mp2,mp3,mp4,mpe,mpeg,mpg,mpp,oga,ogg,ogv,ogx,opus,otf,p10,p7c,p7m,p7s,pdf,png,ps,qt,roff,rtf,rtx,ser,svg,t,tif,tiff,tr,ts,tsv,ttf,txt,vtt,wav,weba,webm,webp,woff,woff2,xhtml,xml,yaml,yml,zip".split(","));
60
- function v(e, t) {
61
- return `${e}/${t}`;
62
- }
63
- function y(e) {
64
- return l(e.replace(/\/$/, "")) || "/";
65
- }
66
- function b(e) {
67
- let t = d(e);
68
- if (t === "index") {
69
- let t = l(e);
70
- return t ? "/" + t : "/";
71
- }
72
- return "/" + p(l(e), t);
73
- }
74
- function x(e, t) {
75
- return t.startsWith(e + "/") || t === e;
76
- }
77
- function S(e) {
78
- let t = u(e).slice(1);
79
- return t === "" || !_.has(t.toLowerCase());
80
- }
81
- //#endregion
82
- //#region src/shared/utils/content.ts
83
- function C(e) {
84
- let t = {
85
- name: "",
86
- children: [],
87
- items: []
88
- };
89
- for (let n of e) {
90
- let e = n.filepath.split("/").slice(0, -1), r = t;
91
- for (let t of e) {
92
- let e = r.children.find((e) => e.name === t);
93
- e || (e = {
94
- name: t,
95
- children: [],
96
- items: []
97
- }, r.children.push(e)), r = e;
98
- }
99
- r.items.push(n);
100
- }
101
- return D(t), {
102
- rootItems: t.items,
103
- children: t.children
104
- };
105
- }
106
- function w(e, t) {
107
- let n = {};
108
- function r(e) {
109
- let t = e.items.length;
110
- for (let n of e.children) t += r(n);
111
- return t;
112
- }
113
- function i(e, t) {
114
- let n = e.items[0] ?? e.children[0]?.items[0];
115
- if (!n) return `${t}/${e.name}`;
116
- let r = b(n.filepath);
117
- return d(n.filepath) === "index" ? r : y(r);
118
- }
119
- function a(e, t) {
120
- for (let o of e) {
121
- let e = t ? `${t}/${o.name}` : `/${o.name}`;
122
- n[e] = {
123
- title: s(o.name),
124
- url: e,
125
- subdirectories: o.children.map((t) => ({
126
- name: s(t.name),
127
- url: i(t, e),
128
- count: r(t)
129
- })),
130
- items: o.items.map((e) => ({
131
- name: E(e.header, e.filepath),
132
- url: b(e.filepath)
133
- }))
134
- }, a(o.children, e);
135
- }
136
- }
137
- return n["/"] = {
138
- title: t,
139
- url: "/",
140
- subdirectories: e.map((e) => ({
141
- name: s(e.name),
142
- url: i(e, ""),
143
- count: r(e)
144
- })),
145
- items: []
146
- }, a(e, ""), n;
147
- }
148
- function T(e, t) {
149
- let n = c(l(e));
150
- return n ? s(n) : t;
151
- }
152
- function E(e, t) {
153
- return e._label === void 0 ? e.name === void 0 ? s(d(t)) : String(e.name) : String(e._label);
154
- }
155
- function D(e) {
156
- e.children.sort((e, t) => {
157
- let n = o(e.name), r = o(t.name);
158
- return n.order === r.order ? n.rest.localeCompare(r.rest) : n.order - r.order;
159
- }), e.items.sort((e, t) => {
160
- let n = o(d(e.filepath)), r = o(d(t.filepath));
161
- return n.order === r.order ? E(e.header, e.filepath).localeCompare(E(t.header, t.filepath)) : n.order - r.order;
162
- });
163
- for (let t of e.children) D(t);
164
- }
165
- //#endregion
166
- //#region src/shared/utils/html.ts
167
- function O(e) {
168
- return e.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
169
- }
170
- function k(e) {
171
- return e.replace(/<(style|script)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
172
- }
173
- //#endregion
174
- //#region src/shared/utils/time.ts
175
- var A = 60, j = 60 * A, M = 24 * j, N = 7 * M, P = 30 * M, F = 365 * M, I = 2 * N;
176
- function L(e) {
177
- return (/* @__PURE__ */ new Date(e * 1e3)).toLocaleDateString("en-US", {
178
- year: "numeric",
179
- month: "short",
180
- day: "numeric"
181
- });
182
- }
183
- function R(e, t) {
184
- return Math.floor(Date.now() / 1e3) - e < I ? `${t} ${z(e)}` : `${t} at ${L(e)}`;
185
- }
186
- function z(e) {
187
- let t = Math.floor(Date.now() / 1e3) - e;
188
- return t < A ? "just now" : t < j ? `${Math.floor(t / A)}m ago` : t < M ? `${Math.floor(t / j)}h ago` : t < N ? `${Math.floor(t / M)}d ago` : t < P ? `${Math.floor(t / N)}w ago` : t < F ? `${Math.floor(t / P)}mo ago` : `${Math.floor(t / F)}y ago`;
189
- }
190
- var B = new Intl.DateTimeFormat("en-US", {
191
- year: "numeric",
192
- month: "short",
193
- day: "numeric"
194
- });
195
- function V(e) {
196
- let t = new Date(e);
197
- return Number.isNaN(t.getTime()) ? e : B.format(t);
198
- }
199
- //#endregion
200
- //#region src/shared/brand.ts
201
- var H = "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", U = "M30 30h70v16h-27v52h-16v-52h-27z", W = "m155 98-30-33h20v-35h20v35h20z", G = "0 0 208 128", K = "#a0522d", q = `<svg fill='none' viewBox='${G}' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='${H}' fill-rule='evenodd' fill='${K}'/><path d='${U}' fill='${K}'/><path d='${W}' fill='${K}'/></svg>`, J = `data:image/svg+xml,${encodeURIComponent(q)}`;
202
- //#endregion
203
- export { i as A, m as C, n as D, t as E, e as O, f as S, a as T, b as _, G as a, S as b, z as c, C as d, w as f, y as g, v as h, U as i, r as k, O as l, E as m, H as n, V as o, T as p, J as r, R as s, W as t, k as u, x as v, s as w, d as x, g as y };