@bendyline/docblocks-react 1.1.2 → 2.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.
Files changed (225) hide show
  1. package/README.md +37 -5
  2. package/dist/ExportDialog-7LDIXJZ3.js +10 -0
  3. package/dist/ExportDialog-7LDIXJZ3.js.map +1 -0
  4. package/dist/ExportToolbarControls-GHAOJMH6.js +508 -0
  5. package/dist/ExportToolbarControls-GHAOJMH6.js.map +1 -0
  6. package/dist/GitToolbarControl-GNMRVKWQ.js +136 -0
  7. package/dist/GitToolbarControl-GNMRVKWQ.js.map +1 -0
  8. package/dist/GitUI-VHOBQY43.js +1133 -0
  9. package/dist/GitUI-VHOBQY43.js.map +1 -0
  10. package/dist/LazyEditorShell-EF2BWRXU.js +6 -0
  11. package/dist/LazyEditorShell-EF2BWRXU.js.map +1 -0
  12. package/dist/ShareDialog-63ENBEDZ.js +213 -0
  13. package/dist/ShareDialog-63ENBEDZ.js.map +1 -0
  14. package/dist/chunk-4XXSWN3T.js +13 -0
  15. package/dist/chunk-4XXSWN3T.js.map +1 -0
  16. package/dist/chunk-57ZJJOC5.js +89 -0
  17. package/dist/chunk-57ZJJOC5.js.map +1 -0
  18. package/dist/chunk-5A4KEWKT.js +97 -0
  19. package/dist/chunk-5A4KEWKT.js.map +1 -0
  20. package/dist/chunk-DD4VFJQI.js +51 -0
  21. package/dist/chunk-DD4VFJQI.js.map +1 -0
  22. package/dist/chunk-FEWQUQML.js +256 -0
  23. package/dist/chunk-FEWQUQML.js.map +1 -0
  24. package/dist/chunk-FMGTHSTX.js +110 -0
  25. package/dist/chunk-FMGTHSTX.js.map +1 -0
  26. package/dist/chunk-UNYZQXWR.js +324 -0
  27. package/dist/chunk-UNYZQXWR.js.map +1 -0
  28. package/dist/chunk-VHDP4IPL.js +70 -0
  29. package/dist/chunk-VHDP4IPL.js.map +1 -0
  30. package/dist/chunk-ZI56BNB7.js +270 -0
  31. package/dist/chunk-ZI56BNB7.js.map +1 -0
  32. package/dist/editor.d.ts +11 -0
  33. package/dist/editor.js +9 -0
  34. package/dist/editor.js.map +1 -0
  35. package/dist/export/index.d.ts +93 -0
  36. package/dist/export/index.js +27 -0
  37. package/dist/export/index.js.map +1 -0
  38. package/dist/index.d.ts +346 -18
  39. package/dist/index.js +6169 -18
  40. package/dist/index.js.map +1 -1
  41. package/dist/run-export-ICTZITXC.js +10 -0
  42. package/dist/run-export-ICTZITXC.js.map +1 -0
  43. package/dist/settings/index.d.ts +36 -0
  44. package/dist/settings/index.js +14 -0
  45. package/dist/settings/index.js.map +1 -0
  46. package/package.json +33 -13
  47. package/src/styles/docblocks.css +2738 -132
  48. package/dist/AppMenu/AppMenu.d.ts +0 -26
  49. package/dist/AppMenu/AppMenu.d.ts.map +0 -1
  50. package/dist/AppMenu/AppMenu.js +0 -28
  51. package/dist/AppMenu/AppMenu.js.map +0 -1
  52. package/dist/AppMenu/index.d.ts +0 -3
  53. package/dist/AppMenu/index.d.ts.map +0 -1
  54. package/dist/AppMenu/index.js +0 -2
  55. package/dist/AppMenu/index.js.map +0 -1
  56. package/dist/DocBlocksShell/DocBlocksShell.d.ts +0 -36
  57. package/dist/DocBlocksShell/DocBlocksShell.d.ts.map +0 -1
  58. package/dist/DocBlocksShell/DocBlocksShell.js +0 -1351
  59. package/dist/DocBlocksShell/DocBlocksShell.js.map +0 -1
  60. package/dist/DocBlocksShell/index.d.ts +0 -3
  61. package/dist/DocBlocksShell/index.d.ts.map +0 -1
  62. package/dist/DocBlocksShell/index.js +0 -2
  63. package/dist/DocBlocksShell/index.js.map +0 -1
  64. package/dist/Export/ExportDialog.d.ts +0 -16
  65. package/dist/Export/ExportDialog.d.ts.map +0 -1
  66. package/dist/Export/ExportDialog.js +0 -158
  67. package/dist/Export/ExportDialog.js.map +0 -1
  68. package/dist/Export/ExportToolbarControls.d.ts +0 -17
  69. package/dist/Export/ExportToolbarControls.d.ts.map +0 -1
  70. package/dist/Export/ExportToolbarControls.js +0 -200
  71. package/dist/Export/ExportToolbarControls.js.map +0 -1
  72. package/dist/Export/export-options.d.ts +0 -53
  73. package/dist/Export/export-options.d.ts.map +0 -1
  74. package/dist/Export/export-options.js +0 -49
  75. package/dist/Export/export-options.js.map +0 -1
  76. package/dist/Export/index.d.ts +0 -6
  77. package/dist/Export/index.d.ts.map +0 -1
  78. package/dist/Export/index.js +0 -3
  79. package/dist/Export/index.js.map +0 -1
  80. package/dist/Export/run-export.d.ts +0 -8
  81. package/dist/Export/run-export.d.ts.map +0 -1
  82. package/dist/Export/run-export.js +0 -296
  83. package/dist/Export/run-export.js.map +0 -1
  84. package/dist/Export/transform-summaries.d.ts +0 -7
  85. package/dist/Export/transform-summaries.d.ts.map +0 -1
  86. package/dist/Export/transform-summaries.js +0 -6
  87. package/dist/Export/transform-summaries.js.map +0 -1
  88. package/dist/FileExplorer/FileExplorer.d.ts +0 -21
  89. package/dist/FileExplorer/FileExplorer.d.ts.map +0 -1
  90. package/dist/FileExplorer/FileExplorer.js +0 -140
  91. package/dist/FileExplorer/FileExplorer.js.map +0 -1
  92. package/dist/FileExplorer/FileTreeNode.d.ts +0 -18
  93. package/dist/FileExplorer/FileTreeNode.d.ts.map +0 -1
  94. package/dist/FileExplorer/FileTreeNode.js +0 -112
  95. package/dist/FileExplorer/FileTreeNode.js.map +0 -1
  96. package/dist/FileExplorer/index.d.ts +0 -6
  97. package/dist/FileExplorer/index.d.ts.map +0 -1
  98. package/dist/FileExplorer/index.js +0 -4
  99. package/dist/FileExplorer/index.js.map +0 -1
  100. package/dist/FileExplorer/useFileTree.d.ts +0 -35
  101. package/dist/FileExplorer/useFileTree.d.ts.map +0 -1
  102. package/dist/FileExplorer/useFileTree.js +0 -124
  103. package/dist/FileExplorer/useFileTree.js.map +0 -1
  104. package/dist/WorkspacePicker/WorkspacePicker.d.ts +0 -17
  105. package/dist/WorkspacePicker/WorkspacePicker.d.ts.map +0 -1
  106. package/dist/WorkspacePicker/WorkspacePicker.js +0 -63
  107. package/dist/WorkspacePicker/WorkspacePicker.js.map +0 -1
  108. package/dist/WorkspacePicker/WorkspaceSettingsButton.d.ts +0 -11
  109. package/dist/WorkspacePicker/WorkspaceSettingsButton.d.ts.map +0 -1
  110. package/dist/WorkspacePicker/WorkspaceSettingsButton.js +0 -27
  111. package/dist/WorkspacePicker/WorkspaceSettingsButton.js.map +0 -1
  112. package/dist/WorkspacePicker/WorkspaceSettingsDialog.d.ts +0 -20
  113. package/dist/WorkspacePicker/WorkspaceSettingsDialog.d.ts.map +0 -1
  114. package/dist/WorkspacePicker/WorkspaceSettingsDialog.js +0 -36
  115. package/dist/WorkspacePicker/WorkspaceSettingsDialog.js.map +0 -1
  116. package/dist/WorkspacePicker/index.d.ts +0 -3
  117. package/dist/WorkspacePicker/index.d.ts.map +0 -1
  118. package/dist/WorkspacePicker/index.js +0 -2
  119. package/dist/WorkspacePicker/index.js.map +0 -1
  120. package/dist/hooks/index.d.ts +0 -2
  121. package/dist/hooks/index.d.ts.map +0 -1
  122. package/dist/hooks/index.js +0 -2
  123. package/dist/hooks/index.js.map +0 -1
  124. package/dist/hooks/useAutoSave.d.ts +0 -15
  125. package/dist/hooks/useAutoSave.d.ts.map +0 -1
  126. package/dist/hooks/useAutoSave.js +0 -83
  127. package/dist/hooks/useAutoSave.js.map +0 -1
  128. package/dist/icons.d.ts +0 -7
  129. package/dist/icons.d.ts.map +0 -1
  130. package/dist/icons.js +0 -27
  131. package/dist/icons.js.map +0 -1
  132. package/dist/index.d.ts.map +0 -1
  133. package/dist/monaco-slim.d.ts +0 -19
  134. package/dist/monaco-slim.d.ts.map +0 -1
  135. package/dist/monaco-slim.js +0 -19
  136. package/dist/monaco-slim.js.map +0 -1
  137. package/dist/preferences/versioning.d.ts +0 -27
  138. package/dist/preferences/versioning.d.ts.map +0 -1
  139. package/dist/preferences/versioning.js +0 -62
  140. package/dist/preferences/versioning.js.map +0 -1
  141. package/src/AppMenu/AppMenu.tsx +0 -264
  142. package/src/AppMenu/index.ts +0 -2
  143. package/src/DocBlocksShell/DocBlocksShell.tsx +0 -1778
  144. package/src/DocBlocksShell/index.ts +0 -2
  145. package/src/Export/ExportDialog.tsx +0 -383
  146. package/src/Export/ExportToolbarControls.tsx +0 -313
  147. package/src/Export/export-options.ts +0 -99
  148. package/src/Export/index.ts +0 -5
  149. package/src/Export/run-export.ts +0 -349
  150. package/src/Export/transform-summaries.ts +0 -14
  151. package/src/FileExplorer/FileExplorer.tsx +0 -282
  152. package/src/FileExplorer/FileTreeNode.tsx +0 -214
  153. package/src/FileExplorer/index.ts +0 -5
  154. package/src/FileExplorer/useFileTree.ts +0 -178
  155. package/src/WorkspacePicker/WorkspacePicker.tsx +0 -137
  156. package/src/WorkspacePicker/WorkspaceSettingsButton.tsx +0 -88
  157. package/src/WorkspacePicker/WorkspaceSettingsDialog.tsx +0 -121
  158. package/src/WorkspacePicker/index.ts +0 -2
  159. package/src/fonts/fonts.css +0 -362
  160. package/src/fonts/licenses/LICENSE-cormorant-garamond.txt +0 -93
  161. package/src/fonts/licenses/LICENSE-crimson-text.txt +0 -93
  162. package/src/fonts/licenses/LICENSE-dm-sans.txt +0 -93
  163. package/src/fonts/licenses/LICENSE-dm-serif-display.txt +0 -93
  164. package/src/fonts/licenses/LICENSE-hanken-grotesk.txt +0 -94
  165. package/src/fonts/licenses/LICENSE-ibm-plex-sans.txt +0 -93
  166. package/src/fonts/licenses/LICENSE-inter.txt +0 -93
  167. package/src/fonts/licenses/LICENSE-jetbrains-mono.txt +0 -93
  168. package/src/fonts/licenses/LICENSE-lora.txt +0 -93
  169. package/src/fonts/licenses/LICENSE-merriweather.txt +0 -93
  170. package/src/fonts/licenses/LICENSE-oswald.txt +0 -93
  171. package/src/fonts/licenses/LICENSE-playfair-display.txt +0 -93
  172. package/src/fonts/licenses/LICENSE-pt-serif.txt +0 -93
  173. package/src/fonts/licenses/LICENSE-roboto.txt +0 -93
  174. package/src/fonts/licenses/LICENSE-source-serif-4.txt +0 -93
  175. package/src/fonts/woff2/cormorant-garamond-400.woff2 +0 -0
  176. package/src/fonts/woff2/cormorant-garamond-700.woff2 +0 -0
  177. package/src/fonts/woff2/crimson-text-400.woff2 +0 -0
  178. package/src/fonts/woff2/crimson-text-400i.woff2 +0 -0
  179. package/src/fonts/woff2/crimson-text-700.woff2 +0 -0
  180. package/src/fonts/woff2/dm-sans-400.woff2 +0 -0
  181. package/src/fonts/woff2/dm-sans-400i.woff2 +0 -0
  182. package/src/fonts/woff2/dm-sans-500.woff2 +0 -0
  183. package/src/fonts/woff2/dm-sans-700.woff2 +0 -0
  184. package/src/fonts/woff2/dm-serif-display-400.woff2 +0 -0
  185. package/src/fonts/woff2/hanken-grotesk-400.woff2 +0 -0
  186. package/src/fonts/woff2/hanken-grotesk-400i.woff2 +0 -0
  187. package/src/fonts/woff2/hanken-grotesk-500.woff2 +0 -0
  188. package/src/fonts/woff2/hanken-grotesk-600.woff2 +0 -0
  189. package/src/fonts/woff2/hanken-grotesk-700.woff2 +0 -0
  190. package/src/fonts/woff2/ibm-plex-sans-400.woff2 +0 -0
  191. package/src/fonts/woff2/ibm-plex-sans-400i.woff2 +0 -0
  192. package/src/fonts/woff2/ibm-plex-sans-500.woff2 +0 -0
  193. package/src/fonts/woff2/ibm-plex-sans-600.woff2 +0 -0
  194. package/src/fonts/woff2/ibm-plex-sans-700.woff2 +0 -0
  195. package/src/fonts/woff2/inter-400.woff2 +0 -0
  196. package/src/fonts/woff2/inter-400i.woff2 +0 -0
  197. package/src/fonts/woff2/inter-500.woff2 +0 -0
  198. package/src/fonts/woff2/inter-600.woff2 +0 -0
  199. package/src/fonts/woff2/inter-700.woff2 +0 -0
  200. package/src/fonts/woff2/jetbrains-mono-400.woff2 +0 -0
  201. package/src/fonts/woff2/jetbrains-mono-400i.woff2 +0 -0
  202. package/src/fonts/woff2/jetbrains-mono-700.woff2 +0 -0
  203. package/src/fonts/woff2/lora-400.woff2 +0 -0
  204. package/src/fonts/woff2/lora-400i.woff2 +0 -0
  205. package/src/fonts/woff2/lora-700.woff2 +0 -0
  206. package/src/fonts/woff2/merriweather-400.woff2 +0 -0
  207. package/src/fonts/woff2/merriweather-700.woff2 +0 -0
  208. package/src/fonts/woff2/oswald-400.woff2 +0 -0
  209. package/src/fonts/woff2/oswald-700.woff2 +0 -0
  210. package/src/fonts/woff2/playfair-display-400.woff2 +0 -0
  211. package/src/fonts/woff2/playfair-display-700.woff2 +0 -0
  212. package/src/fonts/woff2/pt-serif-400.woff2 +0 -0
  213. package/src/fonts/woff2/pt-serif-700.woff2 +0 -0
  214. package/src/fonts/woff2/roboto-400.woff2 +0 -0
  215. package/src/fonts/woff2/roboto-400i.woff2 +0 -0
  216. package/src/fonts/woff2/roboto-700.woff2 +0 -0
  217. package/src/fonts/woff2/source-serif-4-400.woff2 +0 -0
  218. package/src/fonts/woff2/source-serif-4-400i.woff2 +0 -0
  219. package/src/fonts/woff2/source-serif-4-700.woff2 +0 -0
  220. package/src/hooks/index.ts +0 -1
  221. package/src/hooks/useAutoSave.ts +0 -116
  222. package/src/icons.tsx +0 -70
  223. package/src/index.ts +0 -31
  224. package/src/monaco-slim.ts +0 -20
  225. package/src/preferences/versioning.ts +0 -69
@@ -1,93 +0,0 @@
1
- Copyright 2014 The Source Serif 4 Project Authors (https://github.com/adobe-fonts/source-serif)
2
-
3
- This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
- This license is copied below, and is also available with a FAQ at:
5
- https://openfontlicense.org
6
-
7
-
8
- -----------------------------------------------------------
9
- SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
- -----------------------------------------------------------
11
-
12
- PREAMBLE
13
- The goals of the Open Font License (OFL) are to stimulate worldwide
14
- development of collaborative font projects, to support the font creation
15
- efforts of academic and linguistic communities, and to provide a free and
16
- open framework in which fonts may be shared and improved in partnership
17
- with others.
18
-
19
- The OFL allows the licensed fonts to be used, studied, modified and
20
- redistributed freely as long as they are not sold by themselves. The
21
- fonts, including any derivative works, can be bundled, embedded,
22
- redistributed and/or sold with any software provided that any reserved
23
- names are not used by derivative works. The fonts and derivatives,
24
- however, cannot be released under any other type of license. The
25
- requirement for fonts to remain under this license does not apply
26
- to any document created using the fonts or their derivatives.
27
-
28
- DEFINITIONS
29
- "Font Software" refers to the set of files released by the Copyright
30
- Holder(s) under this license and clearly marked as such. This may
31
- include source files, build scripts and documentation.
32
-
33
- "Reserved Font Name" refers to any names specified as such after the
34
- copyright statement(s).
35
-
36
- "Original Version" refers to the collection of Font Software components as
37
- distributed by the Copyright Holder(s).
38
-
39
- "Modified Version" refers to any derivative made by adding to, deleting,
40
- or substituting -- in part or in whole -- any of the components of the
41
- Original Version, by changing formats or by porting the Font Software to a
42
- new environment.
43
-
44
- "Author" refers to any designer, engineer, programmer, technical
45
- writer or other person who contributed to the Font Software.
46
-
47
- PERMISSION & CONDITIONS
48
- Permission is hereby granted, free of charge, to any person obtaining
49
- a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
- redistribute, and sell modified and unmodified copies of the Font
51
- Software, subject to the following conditions:
52
-
53
- 1) Neither the Font Software nor any of its individual components,
54
- in Original or Modified Versions, may be sold by itself.
55
-
56
- 2) Original or Modified Versions of the Font Software may be bundled,
57
- redistributed and/or sold with any software, provided that each copy
58
- contains the above copyright notice and this license. These can be
59
- included either as stand-alone text files, human-readable headers or
60
- in the appropriate machine-readable metadata fields within text or
61
- binary files as long as those fields can be easily viewed by the user.
62
-
63
- 3) No Modified Version of the Font Software may use the Reserved Font
64
- Name(s) unless explicit written permission is granted by the corresponding
65
- Copyright Holder. This restriction only applies to the primary font name as
66
- presented to the users.
67
-
68
- 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
- Software shall not be used to promote, endorse or advertise any
70
- Modified Version, except to acknowledge the contribution(s) of the
71
- Copyright Holder(s) and the Author(s) or with their explicit written
72
- permission.
73
-
74
- 5) The Font Software, modified or unmodified, in part or in whole,
75
- must be distributed entirely under this license, and must not be
76
- distributed under any other license. The requirement for fonts to
77
- remain under this license does not apply to any document created
78
- using the Font Software.
79
-
80
- TERMINATION
81
- This license becomes null and void if any of the above conditions are
82
- not met.
83
-
84
- DISCLAIMER
85
- THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
- OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
- COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
- INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
- DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
- FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
- OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- export { useAutoSave } from './useAutoSave.js';
@@ -1,116 +0,0 @@
1
- /**
2
- * useAutoSave — debounced auto-save hook.
3
- *
4
- * Writes content to the FileSystemProvider after a delay
5
- * whenever the content changes. Returns a `flush` function so callers
6
- * (e.g. an explicit Ctrl/Cmd+S handler) can force an immediate write
7
- * and await its completion.
8
- */
9
-
10
- import { useEffect, useRef, useCallback } from 'react';
11
- import type { FileSystemProvider } from '@bendyline/docblocks/filesystem';
12
-
13
- export interface UseAutoSaveResult {
14
- /** Cancel any pending debounce and write the current content immediately. */
15
- flush: () => Promise<void>;
16
- }
17
-
18
- export function useAutoSave(
19
- provider: FileSystemProvider | null,
20
- filePath: string | null,
21
- content: string,
22
- delayMs = 500,
23
- onSaved?: (filePath: string, content: string) => void,
24
- ): UseAutoSaveResult {
25
- const timerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
26
- const contentRef = useRef(content);
27
- const onSavedRef = useRef(onSaved);
28
- const targetRef = useRef<{
29
- provider: FileSystemProvider;
30
- filePath: string;
31
- lastSaved: string;
32
- } | null>(null);
33
-
34
- const clearTimer = useCallback(() => {
35
- if (timerRef.current) {
36
- clearTimeout(timerRef.current);
37
- timerRef.current = null;
38
- }
39
- }, []);
40
-
41
- const flushTarget = useCallback(
42
- async (
43
- target: {
44
- provider: FileSystemProvider;
45
- filePath: string;
46
- lastSaved: string;
47
- },
48
- nextContent: string,
49
- ) => {
50
- if (nextContent === target.lastSaved) return;
51
- const previous = target.lastSaved;
52
- target.lastSaved = nextContent;
53
- try {
54
- await target.provider.writeFile(target.filePath, nextContent);
55
- onSavedRef.current?.(target.filePath, nextContent);
56
- } catch (err) {
57
- target.lastSaved = previous;
58
- throw err;
59
- }
60
- },
61
- [],
62
- );
63
-
64
- useEffect(() => {
65
- onSavedRef.current = onSaved;
66
- }, [onSaved]);
67
-
68
- useEffect(() => {
69
- contentRef.current = content;
70
- }, [content]);
71
-
72
- useEffect(() => {
73
- clearTimer();
74
- targetRef.current = provider && filePath ? { provider, filePath, lastSaved: content } : null;
75
- contentRef.current = content;
76
-
77
- return () => {
78
- clearTimer();
79
- const target = targetRef.current;
80
- if (target) {
81
- void flushTarget(target, contentRef.current).catch(() => undefined);
82
- }
83
- targetRef.current = null;
84
- };
85
- // `content` is intentionally captured only when the save target changes.
86
- // Content edits are handled by the debounced effect below.
87
- // eslint-disable-next-line react-hooks/exhaustive-deps
88
- }, [provider, filePath, clearTimer, flushTarget]);
89
-
90
- useEffect(() => {
91
- const target = targetRef.current;
92
- if (!target) return;
93
- clearTimer();
94
-
95
- if (content !== target.lastSaved) {
96
- timerRef.current = setTimeout(() => {
97
- const currentTarget = targetRef.current;
98
- if (!currentTarget) return;
99
- void flushTarget(currentTarget, contentRef.current).catch(() => undefined);
100
- }, delayMs);
101
- }
102
-
103
- return () => {
104
- clearTimer();
105
- };
106
- }, [content, delayMs, clearTimer, flushTarget]);
107
-
108
- const flush = useCallback(async () => {
109
- clearTimer();
110
- const target = targetRef.current;
111
- if (!target) return;
112
- await flushTarget(target, contentRef.current);
113
- }, [clearTimer, flushTarget]);
114
-
115
- return { flush };
116
- }
package/src/icons.tsx DELETED
@@ -1,70 +0,0 @@
1
- import type { SVGProps } from 'react';
2
-
3
- const defaults: SVGProps<SVGSVGElement> = {
4
- width: 16,
5
- height: 16,
6
- viewBox: '0 0 16 16',
7
- fill: 'none',
8
- stroke: 'currentColor',
9
- strokeWidth: 1.5,
10
- strokeLinecap: 'round' as const,
11
- strokeLinejoin: 'round' as const,
12
- };
13
-
14
- export function NewFileIcon(props: SVGProps<SVGSVGElement>) {
15
- return (
16
- <svg {...defaults} {...props}>
17
- {/* Page outline */}
18
- <path d="M9.5 1.5H4a1 1 0 0 0-1 1v11a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V5l-3.5-3.5Z" />
19
- {/* Fold */}
20
- <path d="M9.5 1.5V5H13" />
21
- {/* Plus sign */}
22
- <line x1="6.5" y1="10" x2="9.5" y2="10" />
23
- <line x1="8" y1="8.5" x2="8" y2="11.5" />
24
- </svg>
25
- );
26
- }
27
-
28
- export function NewFolderIcon(props: SVGProps<SVGSVGElement>) {
29
- return (
30
- <svg {...defaults} {...props}>
31
- {/* Folder outline */}
32
- <path d="M2 3.5a1 1 0 0 1 1-1h3l1.5 1.5H13a1 1 0 0 1 1 1v7a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5Z" />
33
- {/* Plus sign */}
34
- <line x1="6" y1="8.5" x2="10" y2="8.5" />
35
- <line x1="8" y1="6.5" x2="8" y2="10.5" />
36
- </svg>
37
- );
38
- }
39
-
40
- export function RefreshIcon(props: SVGProps<SVGSVGElement>) {
41
- return (
42
- <svg {...defaults} {...props}>
43
- <path d="M13.5 8A5.5 5.5 0 1 1 8 2.5" />
44
- <polyline points="13.5 3 13.5 6.5 10 6.5" />
45
- </svg>
46
- );
47
- }
48
-
49
- export function MoreIcon(props: SVGProps<SVGSVGElement>) {
50
- return (
51
- <svg {...defaults} {...props}>
52
- <circle cx="3.5" cy="8" r="1" fill="currentColor" stroke="none" />
53
- <circle cx="8" cy="8" r="1" fill="currentColor" stroke="none" />
54
- <circle cx="12.5" cy="8" r="1" fill="currentColor" stroke="none" />
55
- </svg>
56
- );
57
- }
58
-
59
- export function WorkspaceIcon(props: SVGProps<SVGSVGElement>) {
60
- return (
61
- <svg {...defaults} {...props}>
62
- {/* Desk surface (top-down rectangle) */}
63
- <rect x="1.5" y="2.5" width="13" height="11" rx="1" />
64
- {/* Blotter/pad with two vertical lines */}
65
- <rect x="4" y="4.5" width="8" height="7" rx="0.5" />
66
- <line x1="6.5" y1="5.5" x2="6.5" y2="10.5" strokeWidth="1" />
67
- <line x1="9.5" y1="5.5" x2="9.5" y2="10.5" strokeWidth="1" />
68
- </svg>
69
- );
70
- }
package/src/index.ts DELETED
@@ -1,31 +0,0 @@
1
- /**
2
- * @bendyline/docblocks-react — React components for DocBlocks
3
- */
4
-
5
- // FileExplorer
6
- export { FileExplorer } from './FileExplorer/index.js';
7
- export type { FileExplorerProps } from './FileExplorer/index.js';
8
- export { FileTreeNode } from './FileExplorer/index.js';
9
- export type { FileTreeNodeProps } from './FileExplorer/index.js';
10
- export { useFileTree } from './FileExplorer/index.js';
11
-
12
- // WorkspacePicker
13
- export { WorkspacePicker } from './WorkspacePicker/index.js';
14
- export type { WorkspacePickerProps } from './WorkspacePicker/index.js';
15
-
16
- // DocBlocksShell
17
- export { DocBlocksShell } from './DocBlocksShell/index.js';
18
- export type { DocBlocksShellProps } from './DocBlocksShell/index.js';
19
-
20
- // AppMenu
21
- export { AppMenu } from './AppMenu/index.js';
22
- export type { AppMenuProps, ThemePreference } from './AppMenu/index.js';
23
-
24
- // Export
25
- export { ExportToolbarControls } from './Export/index.js';
26
- export type { ExportToolbarControlsProps, ExportFormat, ExportOptions } from './Export/index.js';
27
- export { ExportDialog } from './Export/index.js';
28
- export type { ExportDialogProps } from './Export/index.js';
29
-
30
- // Hooks
31
- export { useAutoSave } from './hooks/index.js';
@@ -1,20 +0,0 @@
1
- /**
2
- * Slim Monaco editor bundle for DocBlocks browser surfaces.
3
- *
4
- * Squisq's raw editor lazy-loads `monaco-editor/esm/vs/editor/editor.main.js`
5
- * so syntax highlighting works in raw mode. Alias both that subpath and the
6
- * bare `monaco-editor` specifier to this file to keep the lazy chunk focused
7
- * on markdown plus the languages users most often place in fenced blocks.
8
- */
9
-
10
- export * from 'monaco-editor/esm/vs/editor/editor.api';
11
-
12
- import 'monaco-editor/esm/vs/basic-languages/markdown/markdown.contribution';
13
- import 'monaco-editor/esm/vs/basic-languages/javascript/javascript.contribution';
14
- import 'monaco-editor/esm/vs/basic-languages/typescript/typescript.contribution';
15
- import 'monaco-editor/esm/vs/basic-languages/html/html.contribution';
16
- import 'monaco-editor/esm/vs/basic-languages/css/css.contribution';
17
- import 'monaco-editor/esm/vs/basic-languages/yaml/yaml.contribution';
18
- import 'monaco-editor/esm/vs/basic-languages/python/python.contribution';
19
- import 'monaco-editor/esm/vs/basic-languages/shell/shell.contribution';
20
- import 'monaco-editor/esm/vs/basic-languages/xml/xml.contribution';
@@ -1,69 +0,0 @@
1
- /**
2
- * Versioning preferences — global default + per-workspace resolution.
3
- *
4
- * The global preference controls whether DocBlocks writes version
5
- * snapshots (under `<basename>_files/.versions/`) when editing. The
6
- * default is `'browser-only'` so local-folder workspaces stay clean by
7
- * default and only IndexedDB workspaces accumulate version history.
8
- *
9
- * Each workspace can override the global default with its own setting
10
- * stored on the WorkspaceDescriptor. `'inherit'` (or absent) defers to
11
- * the global preference; `'on'` / `'off'` force the behavior regardless.
12
- */
13
-
14
- import type { WorkspaceDescriptor } from '@bendyline/docblocks/workspace';
15
-
16
- export type VersioningPreference = 'on' | 'browser-only' | 'off';
17
-
18
- const STORAGE_KEY = 'docblocks:versioningPreference';
19
- const DEFAULT_PREFERENCE: VersioningPreference = 'browser-only';
20
-
21
- export function loadVersioningPreference(): VersioningPreference {
22
- try {
23
- const raw = localStorage.getItem(STORAGE_KEY);
24
- if (raw === 'on' || raw === 'browser-only' || raw === 'off') return raw;
25
- } catch {
26
- // ignore
27
- }
28
- return DEFAULT_PREFERENCE;
29
- }
30
-
31
- export function saveVersioningPreference(value: VersioningPreference): void {
32
- try {
33
- localStorage.setItem(STORAGE_KEY, value);
34
- } catch {
35
- // ignore quota errors
36
- }
37
- }
38
-
39
- /** Whether a workspace type is "local" (writes to a real folder on disk). */
40
- export function isLocalWorkspaceType(type: WorkspaceDescriptor['type']): boolean {
41
- return type === 'native' || type === 'electron-native';
42
- }
43
-
44
- /**
45
- * Compute the effective versioning state for a workspace, honoring the
46
- * per-workspace override first and falling back to the global preference.
47
- *
48
- * Returns `false` whenever no workspace is provided so callers can use
49
- * this directly during initial render before a workspace loads.
50
- */
51
- export function resolveVersioningEnabled(
52
- workspace: WorkspaceDescriptor | null,
53
- globalPref: VersioningPreference,
54
- ): boolean {
55
- if (!workspace) return false;
56
-
57
- const override = workspace.versioningOverride;
58
- if (override === 'on') return true;
59
- if (override === 'off') return false;
60
-
61
- switch (globalPref) {
62
- case 'on':
63
- return true;
64
- case 'off':
65
- return false;
66
- case 'browser-only':
67
- return !isLocalWorkspaceType(workspace.type);
68
- }
69
- }