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.

Potentially problematic release.


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

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
package/dist/vite.js ADDED
@@ -0,0 +1,174 @@
1
+ import { n as e } from "./typedown-context-CWA07Yb7.js";
2
+ import "./shared-DzTfF-_d.js";
3
+ import { c as t, r as n } from "./brand-DSd9HWVy.js";
4
+ import r from "@vitejs/plugin-vue";
5
+ //#region src/node/lib/render/vue.ts
6
+ async function i(e, n, r) {
7
+ let i = {
8
+ path: r,
9
+ relativePath: r,
10
+ cleanUrls: !0
11
+ }, a = await e.renderAsync(n.content, i), o = i.title || t(n.header, r), s = {
12
+ schema: n.schema,
13
+ frontmatter: n.header,
14
+ headings: i.headers ?? [],
15
+ title: o
16
+ }, c = JSON.stringify(JSON.stringify(s)), l = JSON.stringify(a);
17
+ return {
18
+ vueSrc: [
19
+ "<script>",
20
+ `export const __pageData = JSON.parse(${c})`,
21
+ `export default { name: ${JSON.stringify(r)}, data() { return { __html: ${l} } } }`,
22
+ "<\/script>",
23
+ "<template><div v-html=\"__html\" /></template>"
24
+ ].join("\n"),
25
+ pageData: s
26
+ };
27
+ }
28
+ //#endregion
29
+ //#region src/node/plugin/constants.ts
30
+ var a = "@typedown/app", o = "\0@typedown/app", s = "__typedown_index__.td";
31
+ //#endregion
32
+ //#region src/node/plugin/codegen.ts
33
+ function c(e) {
34
+ let { contentDir: t, hasIndex: n } = e;
35
+ return `
36
+ import 'typerighter/style.css';
37
+ import { createTypedownApp } from 'typerighter/client';
38
+ import theme from 'typerighter/client/theme-default';
39
+
40
+ const pages = import.meta.glob('${`/${t}/**/*.td`}');
41
+ ${n ? "" : `pages['/${t}/${s}'] = () => import('${s}');`}
42
+
43
+ async function loadPageModule(pagePath) {
44
+ const key = '/${t}/' + pagePath.replace(/^\\//, '') + '.td';
45
+ const altKey = '/${t}/' + pagePath.replace(/^\\//, '') + '/index.td';
46
+ const loader = pages[key] || pages[altKey]${n ? "" : ` || (pagePath === '/' ? pages['/${t}/${s}'] : undefined)`};
47
+ if (!loader) return undefined;
48
+ return loader();
49
+ }
50
+
51
+ const { app } = await createTypedownApp(loadPageModule, theme.Layout, ${JSON.stringify({
52
+ title: e.siteTitle,
53
+ description: e.siteDescription
54
+ })}, ${JSON.stringify({ sidebarGroups: e.sidebarGroups })});
55
+ app.mount('#app');
56
+ `;
57
+ }
58
+ function l(e) {
59
+ let t = JSON.stringify(e).replace(/'/g, "\\'"), n = JSON.stringify({
60
+ schema: "",
61
+ frontmatter: {},
62
+ headings: [],
63
+ title: "Index"
64
+ });
65
+ return `<script>
66
+ import { TdOverview } from 'typerighter/client/theme-default';
67
+ export const __pageData = JSON.parse(${JSON.stringify(n)})
68
+ export default { name: "index", components: { TdOverview } }
69
+ <\/script>
70
+ <template><TdOverview :groups='${t}' /></template>`;
71
+ }
72
+ //#endregion
73
+ //#region src/node/plugin/vite.ts
74
+ function u() {
75
+ let t;
76
+ return [{
77
+ name: "vite-plugin-typedown",
78
+ enforce: "pre",
79
+ transformIndexHtml(e) {
80
+ return e.replace("</head>", ` <link rel="icon" type="image/svg+xml" href="${n}">\n</head>`).replace("</body>", ` <script type="module" src="/${a}"><\/script>\n</body>`);
81
+ },
82
+ resolveId(e) {
83
+ if (e === "/@typedown/app" || e === "@typedown/app") return o;
84
+ if (e.endsWith("__typedown_index__.td")) return e;
85
+ },
86
+ async load(t) {
87
+ if (t === "\0@typedown/app") {
88
+ let [t, n, r] = await Promise.all([
89
+ e.getConfig(),
90
+ e.listFiles(),
91
+ e.listFilesGroupedBySchema()
92
+ ]), i = n.some((e) => e === "index.td");
93
+ return c({
94
+ ...t,
95
+ hasIndex: i,
96
+ sidebarGroups: r
97
+ });
98
+ }
99
+ if (t.endsWith("__typedown_index__.td")) return l(await e.listFilesGroupedBySchema());
100
+ },
101
+ configureServer(r) {
102
+ return t = r, e.rpc.onConfigChanged(() => t && f(t)), e.rpc.onContentChanged(({ content: e }) => {
103
+ if (t) {
104
+ for (let n of t.moduleGraph.idToModuleMap.values()) if (n.file?.endsWith(e)) {
105
+ t.moduleGraph.invalidateModule(n), t.hot.send({
106
+ type: "update",
107
+ updates: [{
108
+ type: "js-update",
109
+ path: n.url,
110
+ acceptedPath: n.url,
111
+ timestamp: Date.now()
112
+ }]
113
+ });
114
+ break;
115
+ }
116
+ }
117
+ }), e.rpc.onContentCreated(() => t && p(t)), e.rpc.onContentDeleted(() => t && p(t)), e.rpc.onSchemaChanged(() => t && p(t)), e.rpc.onSchemaCreated(() => t && p(t)), e.rpc.onSchemaDeleted(() => t && p(t)), () => {
118
+ r.middlewares.use((e, t, r) => {
119
+ if (!e.url || t.writableEnded || e.url.startsWith("/@") || e.url.startsWith("/node_modules") || e.url.includes(".")) return r();
120
+ let i = `<!DOCTYPE html>
121
+ <html lang="en">
122
+ <head>
123
+ <meta charset="UTF-8">
124
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
125
+ <title>Typedown</title>
126
+ <link rel="icon" type="image/svg+xml" href="${n}">
127
+ </head>
128
+ <body>
129
+ <div id="app"></div>
130
+ <script type="module" src="/${a}"><\/script>
131
+ </body>
132
+ </html>`;
133
+ t.setHeader("Content-Type", "text/html"), t.end(i);
134
+ });
135
+ };
136
+ },
137
+ async transform(t, n) {
138
+ let r = n.split("?")[0];
139
+ if (!r.endsWith(".td") || r.includes("__typedown_index__.td")) return;
140
+ let a = (await e.getConfig()).contentDir, o = r.includes(a) ? r.slice(r.indexOf(a) + a.length + 1) : r, s = await e.getFile(o), { vueSrc: c } = await i(e.md, s, o);
141
+ return {
142
+ code: c,
143
+ map: null
144
+ };
145
+ },
146
+ handleHotUpdate({ file: e }) {
147
+ if (e.endsWith(".td")) return [];
148
+ }
149
+ }, r({ include: /\.(?:vue|td)$/ })];
150
+ }
151
+ function d(e) {
152
+ return [...e.moduleGraph.idToModuleMap.entries()].filter(([e]) => e.endsWith(".td")).map(([, e]) => e);
153
+ }
154
+ function f(e) {
155
+ for (let t of d(e)) e.moduleGraph.invalidateModule(t);
156
+ e.hot.send({ type: "full-reload" });
157
+ }
158
+ function p(e) {
159
+ let t = d(e).map((t) => (e.moduleGraph.invalidateModule(t), m(t)));
160
+ 0 < t.length && e.hot.send({
161
+ type: "update",
162
+ updates: t
163
+ });
164
+ }
165
+ function m(e) {
166
+ return {
167
+ type: "js-update",
168
+ path: e.url,
169
+ acceptedPath: e.url,
170
+ timestamp: Date.now()
171
+ };
172
+ }
173
+ //#endregion
174
+ export { u as typedown };