typerighter 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of typerighter might be problematic. Click here for more details.

Files changed (37) hide show
  1. package/dist/app-C-qfoH4a.js +373 -0
  2. package/dist/brand-CG1fQshq.js +5 -0
  3. package/dist/{cli-CDd4TNg1.js → cli-mg9QpUrf.js} +159 -132
  4. package/dist/cli.js +1 -1
  5. package/dist/client/app/index.d.ts +12 -3
  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 +541 -417
  10. package/dist/client.js +1 -1
  11. package/dist/es-CG8rP6j5.js +22524 -0
  12. package/dist/index.js +2 -2
  13. package/dist/{init-Bfnl0t1B.js → init-BSgCv7vy.js} +664 -654
  14. package/dist/node/build/index.d.ts.map +1 -1
  15. package/dist/node/build/prerender.d.ts +2 -0
  16. package/dist/node/build/prerender.d.ts.map +1 -1
  17. package/dist/node/plugin/vite/index.d.ts.map +1 -1
  18. package/dist/shared/utils/field.d.ts +2 -0
  19. package/dist/shared/utils/field.d.ts.map +1 -0
  20. package/dist/shared/utils/index.d.ts +1 -0
  21. package/dist/shared/utils/index.d.ts.map +1 -1
  22. package/dist/shared/utils/url.d.ts +5 -0
  23. package/dist/shared/utils/url.d.ts.map +1 -1
  24. package/dist/shared-BIdsxcZ2.js +265 -0
  25. package/dist/shared.js +2 -0
  26. package/dist/typerighter.css +1 -1
  27. package/dist/vite-8CV23ALg.js +10704 -0
  28. package/dist/vite.js +1 -1
  29. package/package.json +7 -3
  30. package/dist/app-Bf0aLzaG.js +0 -370
  31. package/dist/brand-BfamszbH.js +0 -12
  32. package/dist/client/app/composables/useUrl.d.ts +0 -6
  33. package/dist/client/app/composables/useUrl.d.ts.map +0 -1
  34. package/dist/constants-DJbUAb1-.js +0 -32189
  35. package/dist/es-ClqUVRJn.js +0 -705
  36. package/dist/shared-CpPZZ8IH.js +0 -196
  37. package/dist/vite-DnP-_NzR.js +0 -326
package/dist/vite.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as e, t } from "./vite-DnP-_NzR.js";
1
+ import { n as e, t } from "./vite-8CV23ALg.js";
2
2
  export { t as generateClientAppEntry, e as typedown };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "typerighter",
4
- "version": "0.7.0",
4
+ "version": "0.9.0",
5
5
  "description": "Typedown: A typed content framework.",
6
6
  "repository": {
7
7
  "type": "git",
@@ -27,6 +27,10 @@
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"
@@ -81,8 +85,8 @@
81
85
  "tailwindcss": "^4.3.3",
82
86
  "vite": "^6.0.0 || ^7.0.0 || ^8.0.0",
83
87
  "vue": "^3.0.0",
84
- "@typerighter/rpc-client": "0.7.0",
85
- "@typerighter/rpc-server": "0.7.0"
88
+ "@typerighter/rpc-client": "0.9.0",
89
+ "@typerighter/rpc-server": "0.9.0"
86
90
  },
87
91
  "devDependencies": {
88
92
  "@hdnax/nuclint": "^0.17.4",
@@ -1,370 +0,0 @@
1
- import { l as e } from "./shared-CpPZZ8IH.js";
2
- import { Fragment as t, computed as n, createApp as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createVNode as s, defineComponent as c, h as l, inject as u, markRaw as d, mergeProps as f, nextTick as p, openBlock as m, provide as h, reactive as g, readonly as _, ref as v, renderList as y, renderSlot as b, shallowRef as x, toDisplayString as S, unref as C, watch as ee, withKeys as w, withModifiers as T } from "vue";
3
- //#region ../../node_modules/.pnpm/@lucide+vue@1.30.0_vue@3.5.40_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/shared/src/utils/isEmptyString.mjs
4
- var E = (e) => e === "", te = (...e) => e.filter((e, t, n) => !!e && e.trim() !== "" && n.indexOf(e) === t).join(" ").trim(), D = (e) => e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), ne = (e) => e.replace(/^([A-Z])|[\s-_]+(\w)/g, (e, t, n) => n ? n.toUpperCase() : t.toLowerCase()), re = (e) => {
5
- let t = ne(e);
6
- return t.charAt(0).toUpperCase() + t.slice(1);
7
- }, O = {
8
- xmlns: "http://www.w3.org/2000/svg",
9
- width: 24,
10
- height: 24,
11
- viewBox: "0 0 24 24",
12
- fill: "none",
13
- stroke: "currentColor",
14
- "stroke-width": 2,
15
- "stroke-linecap": "round",
16
- "stroke-linejoin": "round"
17
- }, ie = /* @__PURE__ */ Symbol("lucide-icons");
18
- function ae() {
19
- return u(ie, {});
20
- }
21
- //#endregion
22
- //#region ../../node_modules/.pnpm/@lucide+vue@1.30.0_vue@3.5.40_typescript@6.0.3_/node_modules/@lucide/vue/dist/esm/Icon.mjs
23
- var oe = ({ name: e, iconNode: t, "icon-node": r, absoluteStrokeWidth: i, "absolute-stroke-width": a, strokeWidth: o, "stroke-width": s, size: c, color: u, ...d }, { slots: f }) => {
24
- let { size: p, color: m, strokeWidth: h = 2, absoluteStrokeWidth: g = !1, class: _ = "" } = ae(), v = n(() => {
25
- let e = E(i) || E(a) || i === !0 || a === !0 || g === !0, t = o || s || h || O["stroke-width"];
26
- return e ? Number(t) * 24 / Number(c ?? p ?? O.width) : t;
27
- });
28
- return l("svg", {
29
- ...O,
30
- ...d,
31
- width: c ?? p ?? O.width,
32
- height: c ?? p ?? O.height,
33
- stroke: u ?? m ?? O.stroke,
34
- "stroke-width": v.value,
35
- class: te("lucide", _, ...e ? [`lucide-${D(re(e))}-icon`, `lucide-${D(e)}`] : ["lucide-icon"])
36
- }, [...(t ?? r ?? []).map((e) => l(...e)), ...f.default ? [f.default()] : []]);
37
- }, k = (e, t) => (n, { slots: r, attrs: i }) => l(oe, {
38
- ...i,
39
- ...n,
40
- iconNode: t,
41
- name: e
42
- }, r.default ? { default: r.default } : void 0), se = k("corner-left-up", [["path", {
43
- d: "M14 9 9 4 4 9",
44
- key: "1af5af"
45
- }], ["path", {
46
- d: "M20 20h-7a4 4 0 0 1-4-4V4",
47
- key: "1blwi3"
48
- }]]), A = k("file", [["path", {
49
- d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
50
- key: "1oefj6"
51
- }], ["path", {
52
- d: "M14 2v5a1 1 0 0 0 1 1h5",
53
- key: "wfsgrz"
54
- }]]), j = k("folder", [["path", {
55
- d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",
56
- key: "1kt360"
57
- }]]), ce = ["href"], le = { key: 1 }, ue = ["href"], de = { class: "td-dir-name" }, fe = { class: "td-dir-count" }, pe = { key: 2 }, me = ["href"], he = { class: "td-dir-name" }, ge = /*@__PURE__*/ c({
58
- __name: "TdDirectoryIndex",
59
- setup(r) {
60
- let c = R(), l = $(), u = n(() => {
61
- let t = e(c.path), n = l.directoryListings[t] ?? l.directoryListings[t + "/"];
62
- return {
63
- url: t,
64
- subdirectories: n?.subdirectories ?? [],
65
- items: n?.items ?? []
66
- };
67
- }), d = n(() => u.value.url === "/"), f = n(() => {
68
- let t = e(u.value.url);
69
- return t === "/" ? "/index" : t + "/index";
70
- });
71
- return (e, n) => (m(), a("div", null, [
72
- d.value ? i("", !0) : (m(), a("a", {
73
- key: 0,
74
- href: f.value,
75
- class: "td-dir-row"
76
- }, [s(C(se), {
77
- size: 16,
78
- class: "td-dir-icon"
79
- }), n[0] ||= o("span", { class: "td-dir-parent" }, "..", -1)], 8, ce)),
80
- u.value.subdirectories.length > 0 ? (m(), a("div", le, [(m(!0), a(t, null, y(u.value.subdirectories, (e) => (m(), a("a", {
81
- key: e.url,
82
- href: e.url,
83
- class: "td-dir-row"
84
- }, [
85
- s(C(j), {
86
- size: 16,
87
- class: "td-dir-icon"
88
- }),
89
- o("span", de, S(e.name), 1),
90
- o("span", fe, S(e.count), 1)
91
- ], 8, ue))), 128))])) : i("", !0),
92
- u.value.items.length > 0 ? (m(), a("div", pe, [(m(!0), a(t, null, y(u.value.items, (e) => (m(), a("a", {
93
- key: e.url,
94
- href: e.url,
95
- class: "td-dir-row"
96
- }, [s(C(A), {
97
- size: 16,
98
- class: "td-dir-icon"
99
- }), o("span", he, S(e.name), 1)], 8, me))), 128))])) : i("", !0)
100
- ]));
101
- }
102
- }), M = (e, t) => {
103
- let n = e.__vccOpts || e;
104
- for (let [e, r] of t) n[e] = r;
105
- return n;
106
- }, N = /*#__PURE__*/ M(ge, [["__scopeId", "data-v-0a816569"]]), _e = [
107
- "id",
108
- "tabindex",
109
- "aria-pressed",
110
- "aria-label",
111
- "onKeydown"
112
- ], ve = { class: "td-flashcard-face td-flashcard-face-question" }, ye = { class: "td-flashcard-label" }, be = { class: "td-flashcard-body" }, xe = { class: "td-flashcard-face td-flashcard-face-key" }, Se = { class: "td-flashcard-label" }, Ce = { class: "td-flashcard-body" }, we = /*#__PURE__*/ M(/* @__PURE__ */ c({
113
- inheritAttrs: !1,
114
- __name: "TdFlashcard",
115
- props: {
116
- id: { default: () => void 0 },
117
- revealed: {
118
- type: Boolean,
119
- default: !1
120
- },
121
- disabled: {
122
- type: Boolean,
123
- default: !1
124
- },
125
- questionLabel: { default: "Question" },
126
- keyLabel: { default: "Answer" }
127
- },
128
- setup(e, { expose: t }) {
129
- let n = v(e.revealed);
130
- ee(() => e.revealed, () => {
131
- n.value = e.revealed;
132
- });
133
- function r() {
134
- if (e.disabled) return n.value;
135
- let t = n.value;
136
- return n.value = !n.value, t;
137
- }
138
- function i() {
139
- let e = n.value;
140
- return n.value = !0, e;
141
- }
142
- function s() {
143
- let e = n.value;
144
- return n.value = !1, e;
145
- }
146
- return t({
147
- flip: r,
148
- showQuestion: s,
149
- showKey: i,
150
- state: _(n)
151
- }), (t, i) => (m(), a("div", f(t.$attrs, {
152
- id: e.id,
153
- class: ["td-flashcard", {
154
- "is-revealed": n.value,
155
- "is-disabled": e.disabled
156
- }],
157
- role: "button",
158
- tabindex: e.disabled ? -1 : 0,
159
- "aria-pressed": n.value,
160
- "aria-label": n.value ? e.keyLabel : e.questionLabel,
161
- onClick: r,
162
- onKeydown: [w(T(r, ["prevent"]), ["enter"]), w(T(r, ["prevent"]), ["space"])]
163
- }), [o("div", ve, [o("p", ye, S(e.questionLabel), 1), o("div", be, [b(t.$slots, "default")])]), o("div", xe, [o("p", Se, S(e.keyLabel), 1), o("div", Ce, [b(t.$slots, "key")])])], 16, _e));
164
- }
165
- }), [["__scopeId", "data-v-95dfbffd"]]), P = typeof window < "u", F = Symbol("typedown-router"), I = {
166
- frontmatter: {},
167
- headings: [],
168
- title: "Not Found"
169
- };
170
- function Te(e, t) {
171
- let n = g({
172
- path: "/",
173
- hash: "",
174
- query: "",
175
- contentSfc: void 0,
176
- data: I
177
- }), r = {
178
- route: n,
179
- async go(e, t) {
180
- e = B(e), await r.onBeforeRouteChange?.(e) !== !1 && ((!P || t?.initialLoad || Ee(e, t)) && await a(e), o(), await r.onAfterRouteChange?.(e));
181
- }
182
- }, i;
183
- async function a(r) {
184
- let a = new URL(r, "http://a.com"), s = i = a.pathname;
185
- try {
186
- let t = await e(s);
187
- if (!t) throw Error(`Page not found: ${s}`);
188
- if (i === s) {
189
- i = void 0;
190
- let { default: e, __pageData: r } = t;
191
- n.path = s, n.contentSfc = d(e), n.data = d(r), o(a), P && p(() => {
192
- L(a.hash);
193
- });
194
- }
195
- } catch {
196
- i === s && (i = void 0, n.path = s, n.contentSfc = t ? d(t) : void 0, n.data = I, o(a));
197
- }
198
- }
199
- function o(e = P ? location : {
200
- search: "",
201
- hash: ""
202
- }) {
203
- n.query = e.search, n.hash = decodeURIComponent(e.hash);
204
- }
205
- return P && (history.state ?? history.replaceState({}, ""), window.addEventListener("click", (e) => {
206
- if (e.defaultPrevented || !(e.target instanceof Element) || e.button !== 0 || e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) return;
207
- let t = e.target.closest("a");
208
- if (!t || t.hasAttribute("download") || t.hasAttribute("target")) return;
209
- let n = t.getAttribute("href");
210
- if (n === null) return;
211
- let { href: i, origin: a, pathname: o } = new URL(n, t.baseURI);
212
- a === location.origin && !o.match(/\.\w+$/) && (e.preventDefault(), r.go(i));
213
- }, { capture: !0 }), window.addEventListener("popstate", async (e) => {
214
- if (e.state == null) return;
215
- let t = B(location.href);
216
- await a(t), o(), await r.onAfterRouteChange?.(t);
217
- }), window.addEventListener("hashchange", (e) => {
218
- e.preventDefault(), o();
219
- })), r;
220
- }
221
- function L(e) {
222
- if (!e) return;
223
- let t;
224
- try {
225
- t = document.getElementById(decodeURIComponent(e).slice(1)) ?? void 0;
226
- } catch {
227
- return;
228
- }
229
- t?.scrollIntoView({ block: "start" });
230
- }
231
- function R() {
232
- return z().route;
233
- }
234
- function z() {
235
- let e = u(F);
236
- if (!e) throw Error("useRouter() called outside of Typedown app");
237
- return e;
238
- }
239
- function Ee(e, { replace: t = !1 } = {}) {
240
- let n = B(location.href);
241
- if (e === n) return L(new URL(e, "http://a.com").hash), !1;
242
- t ? history.replaceState({}, "", e) : (history.replaceState({ scrollPosition: window.scrollY }, ""), history.pushState({}, "", e));
243
- let r = new URL(e, location.origin), i = new URL(n, location.origin);
244
- return r.pathname === i.pathname ? (L(r.hash), !1) : !0;
245
- }
246
- function B(e) {
247
- let t = new URL(e, "http://a.com");
248
- return t.pathname = t.pathname.replace(/\.html$/, ""), t.pathname === "/" && (t.pathname = "/index"), t.pathname + t.search + t.hash;
249
- }
250
- //#endregion
251
- //#region src/client/app/components/Content.ts
252
- var V = c({
253
- name: "TypedownContent",
254
- setup() {
255
- let e = R();
256
- return () => e.contentSfc ? l(e.contentSfc) : void 0;
257
- }
258
- }), H = "td-theme";
259
- function U(e) {
260
- if (typeof document > "u") return;
261
- let t = e === "system" ? W() : e;
262
- document.documentElement.classList.toggle("dark", t === "dark");
263
- }
264
- function W() {
265
- return typeof window > "u" ? "light" : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
266
- }
267
- var G = v("system"), K = v(W()), q = !1;
268
- function J() {
269
- De();
270
- let e = n(() => G.value === "system" ? K.value : G.value), t = n(() => e.value === "dark");
271
- function r(e) {
272
- G.value = e, U(e), typeof localStorage < "u" && localStorage.setItem(H, e);
273
- }
274
- function i() {
275
- r(e.value === "light" ? "dark" : "light");
276
- }
277
- return {
278
- theme: _(G),
279
- effectiveTheme: e,
280
- isDark: t,
281
- setTheme: r,
282
- toggle: i
283
- };
284
- }
285
- function De() {
286
- if (!q) {
287
- if (q = !0, typeof localStorage < "u") {
288
- let e = localStorage.getItem(H);
289
- (e === "light" || e === "dark" || e === "system") && (G.value = e);
290
- }
291
- U(G.value), typeof window < "u" && window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change", () => {
292
- K.value = W(), G.value === "system" && U("system");
293
- });
294
- }
295
- }
296
- //#endregion
297
- //#region src/client/app/composables/useTdContent.ts
298
- var Y = Symbol("td-content");
299
- function Oe(e) {
300
- let t = J(), r = {
301
- page: n(() => e.data),
302
- frontmatter: n(() => e.data.frontmatter),
303
- title: n(() => e.data.title),
304
- isDark: n(() => t.isDark.value)
305
- };
306
- return h(Y, r), r;
307
- }
308
- function ke() {
309
- let e = u(Y);
310
- if (e === void 0) throw Error("useTdContent() called without a parent provideTdContent()");
311
- return e;
312
- }
313
- //#endregion
314
- //#region src/client/app/index.ts
315
- var X = Symbol("typedown-site-config"), Z = Symbol("typedown-site-data"), Q = Symbol("typedown-page-loader"), Ae = Symbol("typedown-search-index");
316
- async function je(e, t, n = {}, i = {}) {
317
- let a = {
318
- title: n.title ?? "",
319
- description: n.description ?? "",
320
- basePath: n.basePath ?? "/",
321
- repo: n.repo
322
- }, o = {
323
- contentTree: i.contentTree ?? {
324
- rootItems: [],
325
- children: []
326
- },
327
- schemas: i.schemas ?? {},
328
- directoryListings: i.directoryListings ?? {}
329
- }, s = Te(e), u = r(c({
330
- name: "TypedownApp",
331
- setup() {
332
- return Oe(s.route), () => l(t);
333
- }
334
- }));
335
- u.provide(F, s), u.provide(X, a), u.provide(Z, o), u.provide(Q, e);
336
- let d = x(i.searchIndex);
337
- return u.provide(Ae, d), u.component("TypedownContent", V), u.component("DirectoryIndex", N), u.component("Flashcard", we), typeof window < "u" && await s.go(location.href, {
338
- replace: !0,
339
- initialLoad: !0
340
- }), {
341
- app: u,
342
- router: s,
343
- searchIndex: d
344
- };
345
- }
346
- function Me() {
347
- return u(Q, void 0);
348
- }
349
- function Ne() {
350
- return u(Ae, x(void 0));
351
- }
352
- function Pe() {
353
- return u(X, {
354
- title: "",
355
- description: "",
356
- basePath: "/"
357
- });
358
- }
359
- function $() {
360
- return u(Z, {
361
- contentTree: {
362
- rootItems: [],
363
- children: []
364
- },
365
- schemas: {},
366
- directoryListings: {}
367
- });
368
- }
369
- //#endregion
370
- export { $ as a, V as c, N as d, M as f, k as h, Pe as i, R as l, A as m, Me as n, ke as o, j as p, Ne as r, J as s, je as t, z as u };
@@ -1,12 +0,0 @@
1
- //#region src/shared/utils/html.ts
2
- function e(e) {
3
- return e.replaceAll("&", "&amp;").replaceAll("\"", "&quot;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
4
- }
5
- function t(e) {
6
- return e.replace(/<(style|script)[^>]*>[\s\S]*?<\/\1>/gi, "").replace(/<[^>]*>/g, "").replace(/\s+/g, " ").trim();
7
- }
8
- //#endregion
9
- //#region src/shared/brand.ts
10
- var n = "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", r = "M30 30h70v16h-27v52h-16v-52h-27z", i = "m155 98-30-33h20v-35h20v35h20z", a = "0 0 208 128", o = "#a0522d", s = `<svg fill='none' viewBox='${a}' xmlns='http://www.w3.org/2000/svg'><path clip-rule='evenodd' d='${n}' fill-rule='evenodd' fill='${o}'/><path d='${r}' fill='${o}'/><path d='${i}' fill='${o}'/></svg>`, c = `data:image/svg+xml,${encodeURIComponent(s)}`;
11
- //#endregion
12
- export { a, r as i, n, e as o, c as r, t as s, i as t };
@@ -1,6 +0,0 @@
1
- export declare function useUrl(): {
2
- url: (path: string) => string;
3
- homeUrl: () => string;
4
- indexUrl: (directoryPath: string) => string;
5
- };
6
- //# sourceMappingURL=useUrl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useUrl.d.ts","sourceRoot":"","sources":["../../../../src/client/app/composables/useUrl.ts"],"names":[],"mappings":"AAKA,wBAAgB,MAAM;gBAIA,MAAM,KAAG,MAAM;mBAId,MAAM;8BAIO,MAAM,KAAG,MAAM;EASlD"}