@dooc-dev/dooc 0.0.0-stage → 0.0.1

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 (213) hide show
  1. package/README.md +26 -2
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +244 -0
  4. package/dist/code.global.js +285 -0
  5. package/dist/compiler/bundle-urls.d.ts +3 -0
  6. package/dist/compiler/bundle-urls.js +294 -0
  7. package/dist/compiler/bundle.d.ts +2 -0
  8. package/dist/compiler/bundle.js +100 -0
  9. package/dist/compiler/check-prose.d.ts +11 -0
  10. package/dist/compiler/check-prose.js +138 -0
  11. package/dist/compiler/check-types.d.ts +44 -0
  12. package/dist/compiler/check-types.js +1 -0
  13. package/dist/compiler/check.d.ts +5 -0
  14. package/dist/compiler/check.js +450 -0
  15. package/dist/compiler/code-blocks.d.ts +17 -0
  16. package/dist/compiler/code-blocks.js +198 -0
  17. package/dist/compiler/code-languages.d.ts +10 -0
  18. package/dist/compiler/code-languages.js +109 -0
  19. package/dist/compiler/compile.d.ts +95 -0
  20. package/dist/compiler/compile.js +410 -0
  21. package/dist/compiler/config.d.ts +7 -0
  22. package/dist/compiler/config.js +52 -0
  23. package/dist/compiler/dialect.d.ts +24 -0
  24. package/dist/compiler/dialect.js +198 -0
  25. package/dist/compiler/drawio.d.ts +26 -0
  26. package/dist/compiler/drawio.js +176 -0
  27. package/dist/compiler/figures.d.ts +14 -0
  28. package/dist/compiler/figures.js +221 -0
  29. package/dist/compiler/file-cache.d.ts +14 -0
  30. package/dist/compiler/file-cache.js +61 -0
  31. package/dist/compiler/files.d.ts +29 -0
  32. package/dist/compiler/files.js +431 -0
  33. package/dist/compiler/fonts.d.ts +10 -0
  34. package/dist/compiler/fonts.js +54 -0
  35. package/dist/compiler/format.d.ts +1 -0
  36. package/dist/compiler/format.js +42 -0
  37. package/dist/compiler/from-mdast.d.ts +16 -0
  38. package/dist/compiler/from-mdast.js +142 -0
  39. package/dist/compiler/icons.d.ts +14 -0
  40. package/dist/compiler/icons.js +85 -0
  41. package/dist/compiler/language-codes.d.ts +7 -0
  42. package/dist/compiler/language-codes.js +17 -0
  43. package/dist/compiler/locales.d.ts +7 -0
  44. package/dist/compiler/locales.js +67 -0
  45. package/dist/compiler/manifest.d.ts +6 -0
  46. package/dist/compiler/manifest.js +30 -0
  47. package/dist/compiler/ops.d.ts +44 -0
  48. package/dist/compiler/ops.js +362 -0
  49. package/dist/compiler/public-file.d.ts +2 -0
  50. package/dist/compiler/public-file.js +93 -0
  51. package/dist/compiler/serialize.d.ts +3 -0
  52. package/dist/compiler/serialize.js +16 -0
  53. package/dist/compiler/terms.d.ts +9 -0
  54. package/dist/compiler/terms.js +44 -0
  55. package/dist/compiler/textfile-remote.d.ts +12 -0
  56. package/dist/compiler/textfile-remote.js +124 -0
  57. package/dist/compiler/textfile.d.ts +9 -0
  58. package/dist/compiler/textfile.js +113 -0
  59. package/dist/compiler/theme-variants.d.ts +4 -0
  60. package/dist/compiler/theme-variants.js +22 -0
  61. package/dist/compiler/zip.d.ts +6 -0
  62. package/dist/compiler/zip.js +48 -0
  63. package/dist/core/blocks.d.ts +99 -0
  64. package/dist/core/blocks.js +29 -0
  65. package/dist/core/code-file.d.ts +12 -0
  66. package/dist/core/code-file.js +68 -0
  67. package/dist/core/content-metadata.d.ts +48 -0
  68. package/dist/core/content-metadata.js +264 -0
  69. package/dist/core/content-types.d.ts +45 -0
  70. package/dist/core/content-types.js +1 -0
  71. package/dist/core/figure-frame.d.ts +12 -0
  72. package/dist/core/figure-frame.js +108 -0
  73. package/dist/core/file-embed.d.ts +13 -0
  74. package/dist/core/file-embed.js +43 -0
  75. package/dist/core/files.d.ts +15 -0
  76. package/dist/core/files.js +59 -0
  77. package/dist/core/flow-base-css.generated.d.ts +1 -0
  78. package/dist/core/flow-base-css.generated.js +4 -0
  79. package/dist/core/flow-css.d.ts +9 -0
  80. package/dist/core/flow-css.js +54 -0
  81. package/dist/core/graph-common.d.ts +32 -0
  82. package/dist/core/graph-common.js +113 -0
  83. package/dist/core/graph.d.ts +117 -0
  84. package/dist/core/graph.js +480 -0
  85. package/dist/core/html.d.ts +29 -0
  86. package/dist/core/html.js +444 -0
  87. package/dist/core/icons.d.ts +1 -0
  88. package/dist/core/icons.js +1 -0
  89. package/dist/core/inline.d.ts +27 -0
  90. package/dist/core/inline.js +42 -0
  91. package/dist/core/language.d.ts +41 -0
  92. package/dist/core/language.js +44 -0
  93. package/dist/core/languages/ja.d.ts +2 -0
  94. package/dist/core/languages/ja.js +5 -0
  95. package/dist/core/markdown.d.ts +27 -0
  96. package/dist/core/markdown.js +154 -0
  97. package/dist/core/previewers.d.ts +37 -0
  98. package/dist/core/previewers.js +103 -0
  99. package/dist/core/routing.d.ts +20 -0
  100. package/dist/core/routing.js +64 -0
  101. package/dist/core/schema-comments.d.ts +14 -0
  102. package/dist/core/schema-comments.js +52 -0
  103. package/dist/core/schema-graph-flow.d.ts +9 -0
  104. package/dist/core/schema-graph-flow.js +379 -0
  105. package/dist/core/schema-graph-mount.d.ts +9 -0
  106. package/dist/core/schema-graph-mount.js +105 -0
  107. package/dist/core/schema-graph.d.ts +254 -0
  108. package/dist/core/schema-graph.js +981 -0
  109. package/dist/core/table-ui.d.ts +2 -0
  110. package/dist/core/table-ui.js +180 -0
  111. package/dist/core/taxonomy.d.ts +12 -0
  112. package/dist/core/taxonomy.js +49 -0
  113. package/dist/core/term-reference.d.ts +5 -0
  114. package/dist/core/term-reference.js +19 -0
  115. package/dist/core/terms-ui.d.ts +6 -0
  116. package/dist/core/terms-ui.js +22 -0
  117. package/dist/core/textfile.d.ts +10 -0
  118. package/dist/core/textfile.js +39 -0
  119. package/dist/core/theme-variants.d.ts +3 -0
  120. package/dist/core/theme-variants.js +37 -0
  121. package/dist/core/toc-ui.d.ts +2 -0
  122. package/dist/core/toc-ui.js +161 -0
  123. package/dist/core/video-ui.d.ts +2 -0
  124. package/dist/core/video-ui.js +253 -0
  125. package/dist/core/workspace.d.ts +15 -0
  126. package/dist/core/workspace.js +28 -0
  127. package/dist/edit.global.js +305 -0
  128. package/dist/flow.global.js +4959 -0
  129. package/dist/index.d.ts +17 -0
  130. package/dist/index.js +31 -0
  131. package/dist/mcp.d.ts +24 -0
  132. package/dist/mcp.js +467 -0
  133. package/dist/plugins/actions.d.ts +45 -0
  134. package/dist/plugins/actions.js +125 -0
  135. package/dist/plugins/blocks.d.ts +92 -0
  136. package/dist/plugins/blocks.js +99 -0
  137. package/dist/plugins/index.d.ts +4 -0
  138. package/dist/plugins/index.js +1 -0
  139. package/dist/plugins/oauth.d.ts +14 -0
  140. package/dist/plugins/oauth.js +164 -0
  141. package/dist/plugins/runtime.d.ts +24 -0
  142. package/dist/plugins/runtime.js +339 -0
  143. package/dist/plugins/types.d.ts +56 -0
  144. package/dist/plugins/types.js +1 -0
  145. package/dist/plugins/view.d.ts +29 -0
  146. package/dist/plugins/view.js +60 -0
  147. package/dist/ui.global.js +77 -0
  148. package/dist/viewer/assets.d.ts +2 -0
  149. package/dist/viewer/assets.js +3 -0
  150. package/dist/viewer/build.d.ts +12 -0
  151. package/dist/viewer/build.js +55 -0
  152. package/dist/viewer/bundle-network.d.ts +2 -0
  153. package/dist/viewer/bundle-network.js +88 -0
  154. package/dist/viewer/code-file.d.ts +20 -0
  155. package/dist/viewer/code-file.js +42 -0
  156. package/dist/viewer/editor-tools.d.ts +38 -0
  157. package/dist/viewer/editor-tools.js +211 -0
  158. package/dist/viewer/file-references.d.ts +14 -0
  159. package/dist/viewer/file-references.js +38 -0
  160. package/dist/viewer/font-picker.d.ts +4 -0
  161. package/dist/viewer/font-picker.js +145 -0
  162. package/dist/viewer/font-settings.d.ts +11 -0
  163. package/dist/viewer/font-settings.js +50 -0
  164. package/dist/viewer/fonts/LICENSE.txt +119 -0
  165. package/dist/viewer/fonts/udev-gothic-regular.woff2 +0 -0
  166. package/dist/viewer/fonts.d.ts +2 -0
  167. package/dist/viewer/fonts.js +13 -0
  168. package/dist/viewer/git-diff.d.ts +3 -0
  169. package/dist/viewer/git-diff.js +33 -0
  170. package/dist/viewer/git-types.d.ts +73 -0
  171. package/dist/viewer/git-types.js +1 -0
  172. package/dist/viewer/git.d.ts +5 -0
  173. package/dist/viewer/git.js +337 -0
  174. package/dist/viewer/hmr.d.ts +53 -0
  175. package/dist/viewer/hmr.js +335 -0
  176. package/dist/viewer/i18n.d.ts +6 -0
  177. package/dist/viewer/i18n.js +65 -0
  178. package/dist/viewer/ja-lint.d.ts +3 -0
  179. package/dist/viewer/ja-lint.js +44 -0
  180. package/dist/viewer/language-picker.d.ts +2 -0
  181. package/dist/viewer/language-picker.js +233 -0
  182. package/dist/viewer/languages.d.ts +11 -0
  183. package/dist/viewer/languages.js +20 -0
  184. package/dist/viewer/locales/eng.json +294 -0
  185. package/dist/viewer/locales/jpn.json +294 -0
  186. package/dist/viewer/locales/zho.json +294 -0
  187. package/dist/viewer/nav-focus.d.ts +2 -0
  188. package/dist/viewer/nav-focus.js +64 -0
  189. package/dist/viewer/plugin-blocks.d.ts +3 -0
  190. package/dist/viewer/plugin-blocks.js +115 -0
  191. package/dist/viewer/plugin-config.d.ts +35 -0
  192. package/dist/viewer/plugin-config.js +57 -0
  193. package/dist/viewer/plugin-view.d.ts +3 -0
  194. package/dist/viewer/plugin-view.js +28 -0
  195. package/dist/viewer/plugins.d.ts +8 -0
  196. package/dist/viewer/plugins.js +214 -0
  197. package/dist/viewer/resize.d.ts +4 -0
  198. package/dist/viewer/resize.js +238 -0
  199. package/dist/viewer/resource-library.d.ts +29 -0
  200. package/dist/viewer/resource-library.js +104 -0
  201. package/dist/viewer/search.d.ts +16 -0
  202. package/dist/viewer/search.js +358 -0
  203. package/dist/viewer/serve.d.ts +206 -0
  204. package/dist/viewer/serve.js +3233 -0
  205. package/dist/viewer/site-icon.d.ts +8 -0
  206. package/dist/viewer/site-icon.js +56 -0
  207. package/dist/viewer/textfile.d.ts +9 -0
  208. package/dist/viewer/textfile.js +50 -0
  209. package/dist/viewer/theme-picker.d.ts +2 -0
  210. package/dist/viewer/theme-picker.js +135 -0
  211. package/dist/viewer/workspace.d.ts +4 -0
  212. package/dist/viewer/workspace.js +47 -0
  213. package/package.json +127 -5
@@ -0,0 +1,145 @@
1
+ /** Self-contained because published viewers embed this function directly. */
2
+ export const mountFontPickers = async (createSettings, registered) => {
3
+ const settings = createSettings(registered);
4
+ const root = document.documentElement;
5
+ const t = (key) => window.__docsTranslate?.(key) ??
6
+ key;
7
+ const popup = document.createElement("div");
8
+ popup.className = "theme-picker font-picker";
9
+ popup.id = "font-picker";
10
+ popup.popover = "auto";
11
+ popup.setAttribute("role", "menu");
12
+ document.body.append(popup);
13
+ let trigger;
14
+ let busy = true;
15
+ let message = "Loading fonts";
16
+ const target = (button) => button.dataset.fontPicker === "editor" ? "editor" : "viewer";
17
+ const choices = () => new Map([
18
+ ["", t("Default font")],
19
+ ...registered
20
+ .filter((font) => settings.fonts.has(font.family))
21
+ .map((font) => [font.family, font.name]),
22
+ ]);
23
+ const render = () => {
24
+ if (!trigger)
25
+ return;
26
+ popup.replaceChildren();
27
+ popup.setAttribute("aria-label", t(target(trigger) === "editor" ? "Editor font" : "Viewer font"));
28
+ for (const [family, name] of choices()) {
29
+ const option = document.createElement("button");
30
+ option.type = "button";
31
+ option.dataset.fontValue = family;
32
+ option.setAttribute("role", "menuitemradio");
33
+ option.setAttribute("aria-checked", String(family === settings.selected[target(trigger)]));
34
+ option.textContent = option.title = name;
35
+ popup.append(option);
36
+ }
37
+ if (message) {
38
+ const status = document.createElement("div");
39
+ status.className = "font-status";
40
+ status.setAttribute("role", "status");
41
+ status.textContent = t(message);
42
+ popup.append(status);
43
+ }
44
+ };
45
+ const sync = () => {
46
+ const names = choices();
47
+ for (const button of document.querySelectorAll("[data-font-picker]")) {
48
+ const kind = target(button);
49
+ button.disabled = busy;
50
+ button.title = `${t(kind === "editor" ? "Editor font" : "Viewer font")}: ${names.get(settings.selected[kind]) ?? t("Default font")}`;
51
+ button.setAttribute("aria-label", button.title);
52
+ button.setAttribute("aria-controls", popup.id);
53
+ button.setAttribute("popovertarget", popup.id);
54
+ }
55
+ if (popup.matches(":popover-open"))
56
+ render();
57
+ };
58
+ document.addEventListener("click", (event) => {
59
+ const button = event.target instanceof Element
60
+ ? event.target.closest("[data-font-picker]")
61
+ : null;
62
+ if (!button || busy)
63
+ return;
64
+ event.preventDefault();
65
+ if (trigger === button && popup.matches(":popover-open")) {
66
+ popup.hidePopover();
67
+ return;
68
+ }
69
+ trigger?.setAttribute("aria-expanded", "false");
70
+ if (popup.matches(":popover-open"))
71
+ popup.hidePopover();
72
+ trigger = button;
73
+ popup.dataset.theme =
74
+ (target(button) === "editor"
75
+ ? root.dataset.editorTheme
76
+ : (button.closest(".preview-pane")?.dataset.theme ??
77
+ root.dataset.theme)) ?? "auto";
78
+ render();
79
+ const rect = button.getBoundingClientRect();
80
+ popup.style.left = `${Math.max(8, Math.min(rect.left, innerWidth - 248))}px`;
81
+ popup.style.top = `${rect.bottom + 6}px`;
82
+ popup.style.maxHeight = `${Math.max(60, innerHeight - rect.bottom - 14)}px`;
83
+ popup.showPopover();
84
+ button.setAttribute("aria-expanded", "true");
85
+ popup.querySelector('[aria-checked="true"]')?.focus();
86
+ });
87
+ popup.addEventListener("click", (event) => {
88
+ const option = event.target instanceof Element
89
+ ? event.target.closest("[data-font-value]")
90
+ : null;
91
+ if (!option || !trigger)
92
+ return;
93
+ message = "";
94
+ try {
95
+ settings.select(target(trigger), option.dataset.fontValue ?? "");
96
+ }
97
+ catch (error) {
98
+ message = error instanceof Error ? error.message : "Invalid font file";
99
+ }
100
+ if (!message) {
101
+ popup.hidePopover();
102
+ trigger.focus({ preventScroll: true });
103
+ }
104
+ sync();
105
+ if (message)
106
+ popup.querySelector('[aria-checked="true"]')?.focus();
107
+ });
108
+ popup.addEventListener("keydown", (event) => {
109
+ const options = [...popup.querySelectorAll("button")];
110
+ const index = options.indexOf(document.activeElement);
111
+ if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
112
+ event.preventDefault();
113
+ const next = event.key === "Home"
114
+ ? 0
115
+ : event.key === "End"
116
+ ? options.length - 1
117
+ : (index + (event.key === "ArrowDown" ? 1 : options.length - 1)) %
118
+ options.length;
119
+ options[next]?.focus();
120
+ }
121
+ if (event.key === "Escape")
122
+ trigger?.focus({ preventScroll: true });
123
+ });
124
+ popup.addEventListener("toggle", () => {
125
+ if (!popup.matches(":popover-open"))
126
+ trigger?.setAttribute("aria-expanded", "false");
127
+ });
128
+ new MutationObserver((records) => {
129
+ if (records.some((record) => [...record.addedNodes].some((node) => node instanceof Element &&
130
+ (node.matches("[data-font-picker]") ||
131
+ node.querySelector("[data-font-picker]")))))
132
+ sync();
133
+ }).observe(document.body, { childList: true, subtree: true });
134
+ document.addEventListener("docs:ui-language", sync);
135
+ sync();
136
+ try {
137
+ await settings.ready;
138
+ message = "";
139
+ }
140
+ catch (error) {
141
+ message = error instanceof Error ? error.message : "Invalid font file";
142
+ }
143
+ busy = false;
144
+ sync();
145
+ };
@@ -0,0 +1,11 @@
1
+ import type { ProjectFont } from "../compiler/fonts.js";
2
+ /** Self-contained because published viewers embed this function directly. */
3
+ export declare const createFontSettings: (registered: readonly ProjectFont[]) => {
4
+ fonts: Map<string, FontFace>;
5
+ selected: {
6
+ editor: string;
7
+ viewer: string;
8
+ };
9
+ ready: Promise<void>;
10
+ select: (target: "editor" | "viewer", family: string) => void;
11
+ };
@@ -0,0 +1,50 @@
1
+ /** Self-contained because published viewers embed this function directly. */
2
+ export const createFontSettings = (registered) => {
3
+ const fonts = new Map();
4
+ const selected = { editor: "", viewer: "" };
5
+ const key = (target) => `docs-${target === "viewer" ? "preview" : target}:font`;
6
+ for (const target of ["editor", "viewer"]) {
7
+ try {
8
+ selected[target] = localStorage.getItem(key(target)) ?? "";
9
+ }
10
+ catch {
11
+ /* Defaults still work when storage is unavailable. */
12
+ }
13
+ }
14
+ const apply = () => {
15
+ for (const target of ["editor", "viewer"]) {
16
+ const face = fonts.get(selected[target]);
17
+ if (face)
18
+ document.documentElement.style.setProperty(`--${target}-font`, `"${face.family}", "UDEV Gothic", monospace`);
19
+ else
20
+ document.documentElement.style.removeProperty(`--${target}-font`);
21
+ }
22
+ document.dispatchEvent(new Event("docs:font-change"));
23
+ };
24
+ const select = (target, family) => {
25
+ if (family && !fonts.has(family))
26
+ throw new Error("Invalid font file");
27
+ selected[target] = family;
28
+ apply();
29
+ try {
30
+ localStorage.setItem(key(target), family);
31
+ }
32
+ catch {
33
+ throw new Error("Font choice applies only to this tab");
34
+ }
35
+ };
36
+ const ready = (async () => {
37
+ const results = await Promise.allSettled(registered.map(async ({ family, source }) => {
38
+ const face = await new FontFace(family, source).load();
39
+ document.fonts.add(face);
40
+ fonts.set(family, face);
41
+ }));
42
+ for (const target of ["editor", "viewer"])
43
+ if (!fonts.has(selected[target]))
44
+ selected[target] = "";
45
+ apply();
46
+ if (results.some((result) => result.status === "rejected"))
47
+ throw new Error("Some registered fonts could not be loaded");
48
+ })();
49
+ return { fonts, selected, ready, select };
50
+ };
@@ -0,0 +1,119 @@
1
+ # Licensing
2
+
3
+ - Source fonts are licensed under SIL OPEN FONT LICENSE Version 1.1.
4
+ For more information, see "LICENSE_<FontName>" file contained in the "source" directory.
5
+ - "UDEV Gothic" are licensed under SIL OPEN FONT LICENSE Version 1.1.
6
+
7
+ ## "UDEV Gothic" licensing
8
+
9
+ Copyright (c) 2022 Yuko OTAWARA. with Reserved Font Name "UDEV Gothic"
10
+
11
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
12
+ This license is copied below, and is also available with a FAQ at:
13
+ https://scripts.sil.org/OFL
14
+
15
+
16
+ -----------------------------------------------------------
17
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
18
+ -----------------------------------------------------------
19
+
20
+ PREAMBLE
21
+ The goals of the Open Font License (OFL) are to stimulate worldwide
22
+ development of collaborative font projects, to support the font creation
23
+ efforts of academic and linguistic communities, and to provide a free and
24
+ open framework in which fonts may be shared and improved in partnership
25
+ with others.
26
+
27
+ The OFL allows the licensed fonts to be used, studied, modified and
28
+ redistributed freely as long as they are not sold by themselves. The
29
+ fonts, including any derivative works, can be bundled, embedded,
30
+ redistributed and/or sold with any software provided that any reserved
31
+ names are not used by derivative works. The fonts and derivatives,
32
+ however, cannot be released under any other type of license. The
33
+ requirement for fonts to remain under this license does not apply
34
+ to any document created using the fonts or their derivatives.
35
+
36
+ DEFINITIONS
37
+ "Font Software" refers to the set of files released by the Copyright
38
+ Holder(s) under this license and clearly marked as such. This may
39
+ include source files, build scripts and documentation.
40
+
41
+ "Reserved Font Name" refers to any names specified as such after the
42
+ copyright statement(s).
43
+
44
+ "Original Version" refers to the collection of Font Software components as
45
+ distributed by the Copyright Holder(s).
46
+
47
+ "Modified Version" refers to any derivative made by adding to, deleting,
48
+ or substituting -- in part or in whole -- any of the components of the
49
+ Original Version, by changing formats or by porting the Font Software to a
50
+ new environment.
51
+
52
+ "Author" refers to any designer, engineer, programmer, technical
53
+ writer or other person who contributed to the Font Software.
54
+
55
+ PERMISSION & CONDITIONS
56
+ Permission is hereby granted, free of charge, to any person obtaining
57
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
58
+ redistribute, and sell modified and unmodified copies of the Font
59
+ Software, subject to the following conditions:
60
+
61
+ 1) Neither the Font Software nor any of its individual components,
62
+ in Original or Modified Versions, may be sold by itself.
63
+
64
+ 2) Original or Modified Versions of the Font Software may be bundled,
65
+ redistributed and/or sold with any software, provided that each copy
66
+ contains the above copyright notice and this license. These can be
67
+ included either as stand-alone text files, human-readable headers or
68
+ in the appropriate machine-readable metadata fields within text or
69
+ binary files as long as those fields can be easily viewed by the user.
70
+
71
+ 3) No Modified Version of the Font Software may use the Reserved Font
72
+ Name(s) unless explicit written permission is granted by the corresponding
73
+ Copyright Holder. This restriction only applies to the primary font name as
74
+ presented to the users.
75
+
76
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
77
+ Software shall not be used to promote, endorse or advertise any
78
+ Modified Version, except to acknowledge the contribution(s) of the
79
+ Copyright Holder(s) and the Author(s) or with their explicit written
80
+ permission.
81
+
82
+ 5) The Font Software, modified or unmodified, in part or in whole,
83
+ must be distributed entirely under this license, and must not be
84
+ distributed under any other license. The requirement for fonts to
85
+ remain under this license does not apply to any document created
86
+ using the Font Software.
87
+
88
+ TERMINATION
89
+ This license becomes null and void if any of the above conditions are
90
+ not met.
91
+
92
+ DISCLAIMER
93
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
94
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
95
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
96
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
97
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
98
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
99
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
100
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
101
+ OTHER DEALINGS IN THE FONT SOFTWARE.
102
+
103
+
104
+ ## Included font copyrights
105
+
106
+ [JetBrains Mono]
107
+ Copyright 2020 The JetBrains Mono Project Authors https://github.com/JetBrains/JetBrainsMono
108
+
109
+ [BIZ UDGothic]
110
+ Copyright 2022 The BIZ UDGothic Project Authors https://github.com/googlefonts/morisawa-biz-ud-mincho
111
+
112
+ [Nerd Fonts]
113
+ Copyright (c) 2014, Ryan L McIntyre https://ryanlmcintyre.com
114
+
115
+ [UDEV Gothic]
116
+ Copyright 2022 Yuko Otawara
117
+
118
+ Source: https://github.com/yuru7/udev-gothic/releases/tag/v2.2.0
119
+ UDEVGothic-Regular.ttf (standard 1:2 width, no ligatures), packaged as WOFF2.
@@ -0,0 +1,2 @@
1
+ export declare const readFont: (name: string) => Buffer | undefined;
2
+ export declare function fontCss(inline: boolean): string;
@@ -0,0 +1,13 @@
1
+ import { readViewerAsset } from "./assets.js";
2
+ const fontName = "udev-gothic-regular.woff2";
3
+ const font = readViewerAsset(`fonts/${fontName}`);
4
+ const license = readViewerAsset("fonts/LICENSE.txt").toString("utf8").replaceAll("*/", "* /");
5
+ const face = (url) => `@font-face { font-family:'UDEV Gothic'; font-style:normal; font-weight:400; font-display:swap; src:url(${url}) format('woff2'); }`;
6
+ let embedded;
7
+ export const readFont = (name) => name === fontName ? font : undefined;
8
+ export function fontCss(inline) {
9
+ if (!inline)
10
+ return face(`/assets/fonts/${fontName}`);
11
+ embedded ??= `/* ${license} */\n${face(`data:font/woff2;base64,${font.toString("base64")}`)}`;
12
+ return embedded;
13
+ }
@@ -0,0 +1,3 @@
1
+ /** Compare against HEAD so saving or staging does not clear the editor's changes. */
2
+ export declare const gitBaseText: (root: string, file: string) => string | null;
3
+ export declare const gitBaseBody: (root: string, file: string) => string | null;
@@ -0,0 +1,33 @@
1
+ import { execFileSync } from "node:child_process";
2
+ import { parseDoc } from "../compiler/dialect.js";
3
+ import { textfilePath } from "../compiler/textfile.js";
4
+ /** Compare against HEAD so saving or staging does not clear the editor's changes. */
5
+ export const gitBaseText = (root, file) => {
6
+ const git = (...args) => execFileSync("git", ["-C", root, ...args], {
7
+ encoding: "utf8",
8
+ stdio: ["ignore", "pipe", "ignore"],
9
+ timeout: 2_000,
10
+ maxBuffer: 5_000_000,
11
+ });
12
+ try {
13
+ textfilePath(root, file);
14
+ let head;
15
+ try {
16
+ head = git("rev-parse", "--verify", "--quiet", "HEAD").trim();
17
+ }
18
+ catch (error) {
19
+ return error.status === 1 ? "" : null;
20
+ }
21
+ if (!git("ls-tree", "-z", head, "--", `:(literal)${file}`))
22
+ return "";
23
+ return git("show", `${head}:./${file}`);
24
+ }
25
+ catch {
26
+ // Missing Git or unreadable history must leave the editor usable.
27
+ return null;
28
+ }
29
+ };
30
+ export const gitBaseBody = (root, file) => {
31
+ const raw = gitBaseText(root, file);
32
+ return raw === null ? null : parseDoc(raw).body;
33
+ };
@@ -0,0 +1,73 @@
1
+ export interface GitContext {
2
+ root: string;
3
+ branch: string;
4
+ head: string;
5
+ }
6
+ export interface GitPullRequest {
7
+ number: number;
8
+ title: string;
9
+ body: string;
10
+ url: string;
11
+ head: string;
12
+ base: string;
13
+ headCommit: string;
14
+ draft: boolean;
15
+ status: string;
16
+ }
17
+ export interface GitOriginState {
18
+ url: string;
19
+ defaultBranch: string;
20
+ pullRequests: GitPullRequest[];
21
+ }
22
+ export type GitOriginAction = {
23
+ action: "fetch" | "pull" | "push";
24
+ } | {
25
+ action: "createPr";
26
+ title: string;
27
+ body: string;
28
+ base: string;
29
+ draft: boolean;
30
+ } | {
31
+ action: "updatePr";
32
+ number: number;
33
+ title: string;
34
+ body: string;
35
+ previous: GitPullRequest;
36
+ } | {
37
+ action: "mergePr";
38
+ number: number;
39
+ method: "merge" | "squash" | "rebase";
40
+ previous: GitPullRequest;
41
+ };
42
+ /** Injected by the host, never by dooc.yaml. The host owns credentials and remote policy. */
43
+ export interface GitOrigin {
44
+ name: string;
45
+ capabilities: readonly GitOriginAction["action"][];
46
+ read(context: GitContext): Promise<GitOriginState>;
47
+ execute(context: GitContext, request: GitOriginAction): Promise<void>;
48
+ }
49
+ export interface GitChange {
50
+ path: string;
51
+ index: string;
52
+ worktree: string;
53
+ }
54
+ export interface GitState {
55
+ repo: string;
56
+ branch: string;
57
+ head: string;
58
+ version: string;
59
+ branches: string[];
60
+ changes: GitChange[];
61
+ stash?: {
62
+ id: string;
63
+ label: string;
64
+ };
65
+ upstream: string;
66
+ ahead: number;
67
+ behind: number;
68
+ origin?: GitOriginState & {
69
+ name: string;
70
+ capabilities: readonly GitOriginAction["action"][];
71
+ };
72
+ originError?: string;
73
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { GitChange, GitOrigin } from "./git-types.js";
2
+ export declare const parseGitChanges: (status: string) => GitChange[];
3
+ export declare const validateGitOrigin: (value: unknown) => GitOrigin;
4
+ /** Serialize UI operations; Git's own locks still arbitrate with other Git clients. */
5
+ export declare const createGitHandler: (documentRoot: string, getOrigin: () => GitOrigin | undefined) => (input: Record<string, unknown> | undefined) => Promise<unknown>;