typerighter 0.6.0 → 0.7.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.
@@ -1,4 +1,4 @@
1
- import { l as e } from "./shared-BoWAaUci.js";
1
+ import { l as e } from "./shared-CpPZZ8IH.js";
2
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
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
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) => {
@@ -51,20 +51,23 @@ var oe = ({ name: e, iconNode: t, "icon-node": r, absoluteStrokeWidth: i, "absol
51
51
  }], ["path", {
52
52
  d: "M14 2v5a1 1 0 0 0 1 1h5",
53
53
  key: "wfsgrz"
54
- }]]), j = k("folder-open", [["path", {
55
- d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",
56
- key: "usdka0"
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
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
58
  __name: "TdDirectoryIndex",
59
59
  setup(r) {
60
60
  let c = R(), l = $(), u = n(() => {
61
- let e = c.path, t = l.directoryListings[e] ?? l.directoryListings[e + "/"];
61
+ let t = e(c.path), n = l.directoryListings[t] ?? l.directoryListings[t + "/"];
62
62
  return {
63
- url: e,
64
- subdirectories: t?.subdirectories ?? [],
65
- items: t?.items ?? []
63
+ url: t,
64
+ subdirectories: n?.subdirectories ?? [],
65
+ items: n?.items ?? []
66
66
  };
67
- }), d = n(() => u.value.url === "/"), f = n(() => e(u.value.url));
67
+ }), d = n(() => u.value.url === "/"), f = n(() => {
68
+ let t = e(u.value.url);
69
+ return t === "/" ? "/index" : t + "/index";
70
+ });
68
71
  return (e, n) => (m(), a("div", null, [
69
72
  d.value ? i("", !0) : (m(), a("a", {
70
73
  key: 0,
@@ -100,7 +103,7 @@ var oe = ({ name: e, iconNode: t, "icon-node": r, absoluteStrokeWidth: i, "absol
100
103
  let n = e.__vccOpts || e;
101
104
  for (let [e, r] of t) n[e] = r;
102
105
  return n;
103
- }, N = /*#__PURE__*/ M(ge, [["__scopeId", "data-v-9aecbee8"]]), _e = [
106
+ }, N = /*#__PURE__*/ M(ge, [["__scopeId", "data-v-0a816569"]]), _e = [
104
107
  "id",
105
108
  "tabindex",
106
109
  "aria-pressed",
@@ -242,7 +245,7 @@ function Ee(e, { replace: t = !1 } = {}) {
242
245
  }
243
246
  function B(e) {
244
247
  let t = new URL(e, "http://a.com");
245
- return t.pathname = t.pathname.replace(/\.html$/, ""), t.pathname + t.search + t.hash;
248
+ return t.pathname = t.pathname.replace(/\.html$/, ""), t.pathname === "/" && (t.pathname = "/index"), t.pathname + t.search + t.hash;
246
249
  }
247
250
  //#endregion
248
251
  //#region src/client/app/components/Content.ts
@@ -313,7 +316,9 @@ var X = Symbol("typedown-site-config"), Z = Symbol("typedown-site-data"), Q = Sy
313
316
  async function je(e, t, n = {}, i = {}) {
314
317
  let a = {
315
318
  title: n.title ?? "",
316
- description: n.description ?? ""
319
+ description: n.description ?? "",
320
+ basePath: n.basePath ?? "/",
321
+ repo: n.repo
317
322
  }, o = {
318
323
  contentTree: i.contentTree ?? {
319
324
  rootItems: [],
@@ -347,7 +352,8 @@ function Ne() {
347
352
  function Pe() {
348
353
  return u(X, {
349
354
  title: "",
350
- description: ""
355
+ description: "",
356
+ basePath: "/"
351
357
  });
352
358
  }
353
359
  function $() {
@@ -1,7 +1,7 @@
1
- import { o as e } from "./constants-Dq357AVO.js";
2
- import { _ as t, a as n, b as r, g as i, i as a, x as o } from "./shared-BoWAaUci.js";
1
+ import { o as e } from "./constants-DJbUAb1-.js";
2
+ import { _ as t, a as n, b as r, g as i, i as a, x as o } from "./shared-CpPZZ8IH.js";
3
3
  import { o as s } from "./brand-BfamszbH.js";
4
- import { n as c, t as l } from "./vite-BrwFwz0T.js";
4
+ import { n as c, t as l } from "./vite-DnP-_NzR.js";
5
5
  import u from "node:path";
6
6
  import d from "picocolors";
7
7
  import { build as f, createServer as p } from "vite";
@@ -97,6 +97,7 @@ async function S(e, n = {}) {
97
97
  contentDir: _.contentDir,
98
98
  siteTitle: _.siteTitle,
99
99
  siteDescription: _.siteDescription,
100
+ repo: _.repo,
100
101
  contentTree: O,
101
102
  schemas: D
102
103
  })), h.writeFile(N, C({
@@ -199,8 +200,6 @@ function findPage(base) {
199
200
  for (const ext of contentExts) {
200
201
  const key = base + ext;
201
202
  if (pages[key]) return pages[key];
202
- const indexKey = base + '/index' + ext;
203
- if (pages[indexKey]) return pages[indexKey];
204
203
  }
205
204
  }
206
205
 
@@ -209,11 +208,14 @@ function loadPageModule(pagePath) {
209
208
  const page = findPage(base);
210
209
  if (page) return Promise.resolve(page);
211
210
 
212
- const dir = siteData.directoryListings[pagePath] || siteData.directoryListings[pagePath + '/'];
213
- if (dir) return Promise.resolve({
214
- default: { name: 'DirectoryIndex', render() { return h(TdDirectoryIndex); } },
215
- __pageData: { frontmatter: {}, headings: [], title: dir.title },
216
- });
211
+ if (pagePath.endsWith('/index')) {
212
+ const dirPath = pagePath.slice(0, -'/index'.length) || '/';
213
+ const dir = siteData.directoryListings[dirPath] || siteData.directoryListings[dirPath + '/'];
214
+ if (dir) return Promise.resolve({
215
+ default: { name: 'DirectoryIndex', render() { return h(TdDirectoryIndex); } },
216
+ __pageData: { frontmatter: {}, headings: [], title: dir.title },
217
+ });
218
+ }
217
219
 
218
220
  return Promise.resolve(undefined);
219
221
  }
@@ -623,7 +625,7 @@ function J() {
623
625
  r.dispose();
624
626
  }
625
627
  }), t.command("init [root]", "Scaffold a new project").action(async (e) => {
626
- let { initialize: t } = await import("./init-CzF7lqKE.js");
628
+ let { initialize: t } = await import("./init-Bfnl0t1B.js");
627
629
  await t(X(e));
628
630
  }), t.command("preview [root]", "Preview production build").option("--port <port>", "Port to listen on").action(async (e, t) => {
629
631
  let { preview: n } = await import("vite");
@@ -653,7 +655,7 @@ function J() {
653
655
  } finally {
654
656
  r.dispose();
655
657
  }
656
- }), t.help(), t.version("0.6.0"), t.parse();
658
+ }), t.help(), t.version("0.7.0"), t.parse();
657
659
  }
658
660
  function Y(e, t) {
659
661
  let n = t instanceof Error ? t.message : String(t);
package/dist/cli.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./cli-D5-gYw26.js";
1
+ import { t as e } from "./cli-CDd4TNg1.js";
2
2
  export { e as cli };
@@ -0,0 +1,6 @@
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
@@ -0,0 +1 @@
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"}
@@ -2,6 +2,7 @@ import { type App, type Component, type ShallowRef } from 'vue';
2
2
  import { type Router } from './router';
3
3
  import type { PageModule, ContentTree, SchemaDefinition, DirectoryListing } from '@/shared';
4
4
  export { useTdContent, } from './composables/useTdContent';
5
+ export { useUrl, } from './composables/useUrl';
5
6
  export { useRouter, useRoute, } from './router';
6
7
  export { Content, } from './components/Content';
7
8
  export interface TypedownSiteConfig {
@@ -9,6 +10,10 @@ export interface TypedownSiteConfig {
9
10
  title: string;
10
11
  /** Site description */
11
12
  description: string;
13
+ /** URL base path (e.g. "/" or "/blog") */
14
+ basePath: string;
15
+ /** Repository URL */
16
+ repo?: string;
12
17
  }
13
18
  export interface TypedownSiteData {
14
19
  /** Content files as a recursive directory tree */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/client/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,GAAG,EACR,KAAK,SAAS,EAEd,KAAK,UAAU,EAChB,MAAM,KAAK,CAAC;AASb,OAAO,EACuB,KAAK,MAAM,EACxC,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EACjB,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;C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